import{t as e}from"./vite-preload-helper-BqcqN_AC.js";var t=Object.freeze({ignoreCase:!0,splitByWhitespace:!0}),n=null,r=async()=>{n||=(console.info(`[ZPinyinSelect] 首次拼音筛选，开始懒加载 pinyin-pro`),e(()=>import(`./dist-BuvKTl7T.js`).then(e=>e.pinyin),[]));try{return await n}catch(e){throw n=null,e}},i=(e,t)=>{if(e==null)return``;let n=String(e);return t?n.toLowerCase():n},a=e=>e.replace(/\s+/g,``),o=(e,t)=>t?e.split(/\s+/).filter(Boolean):[e],s=(e,t)=>{let n=i(e,t),r=a(n);return{raw:n,rawNoSpace:r,full:n,fullNoSpace:r,initials:n,initialsNoSpace:r}},c=e=>({...t,...e||{}}),l=(e,n=t)=>{let{ignoreCase:o}=c(n),l=e==null?``:String(e),u=i(l,o),d=a(u);return r().then(e=>{let t=i(e(l,{toneType:`none`,type:`string`,separator:``,nonZh:`consecutive`}),o),n=i(e(l,{toneType:`none`,type:`string`,separator:``,pattern:`first`,nonZh:`consecutive`}),o);return{raw:u,rawNoSpace:d,full:t,fullNoSpace:a(t),initials:n,initialsNoSpace:a(n)}}).catch(e=>(console.warn(`[usePinyinSelectFilter] 拼音索引构建失败，已降级原文匹配`,{label:l,error:e}),s(l,o)))},u=(e,t)=>{let n=a(e);return n?t.raw.includes(e)||t.rawNoSpace.includes(n)||t.full.includes(e)||t.fullNoSpace.includes(n)||t.initials.includes(e)||t.initialsNoSpace.includes(n):!0},d=(e,n,r=t)=>{let a=c(r),s=i(e,a.ignoreCase).trim();return s?o(s,a.splitByWhitespace).every(e=>u(e,n)):!0},f=(e={})=>{let t=c(e),n=new Map,r=e=>{let r=`${t.ignoreCase?`1`:`0`}:${e??``}`,i=n.get(r);if(i)return i;let a=l(e,t);return n.set(r,a),a};return{isMatchKeyword:async(e,n)=>d(e,await r(n),t),clearCache:()=>{n.clear()},getCacheSize:()=>n.size}};export{f as n,d as r,l as t};