/** * Fuse.js v7.2.0 - Lightweight fuzzy-search (http://fusejs.io) * * Copyright (c) 2026 Kiro Risk (http://kiro.me) * All Rights Reserved. Apache Software License 2.0 * * http://www.apache.org/licenses/LICENSE-2.0 */ function t(t){return Array.isArray?Array.isArray(t):"[object Array]"===h(t)}const e=1/0;function s(t){return null==t?"":function(t){if("string"==typeof t)return t;let s=t+"";return"0"==s&&1/t==-e?"-0":s}(t)}function i(t){return"string"==typeof t}function n(t){return"number"==typeof t}function r(t){return!0===t||!1===t||function(t){return u(t)&&null!==t}(t)&&"[object Boolean]"==h(t)}function u(t){return"object"==typeof t}function c(t){return null!=t}function o(t){return!t.trim().length}function h(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const a=t=>`Missing ${t} property in key`,l=t=>`Property 'weight' in key '${t}' must be a positive integer`,d=Object.prototype.hasOwnProperty;class g{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{let s=f(t);this._keys.push(s),this._keyMap[s.id]=s,e+=s.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function f(e){let s=null,n=null,r=null,u=1,c=null;if(i(e)||t(e))r=e,s=p(e),n=A(e);else{if(!d.call(e,"name"))throw new Error(a("name"));const t=e.name;if(r=t,d.call(e,"weight")&&(u=e.weight,u<=0))throw new Error(l(t));s=p(t),n=A(t),c=e.getFn}return{path:s,id:n,weight:u,src:r,getFn:c}}function p(e){return t(e)?e:e.split(".")}function A(e){return t(e)?e.join("."):e}var m={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx{if(c(e))if(u[l]){const g=e[u[l]];if(!c(g))return;if(l===u.length-1&&(i(g)||n(g)||r(g)))o.push(void 0!==d?{v:s(g),i:d}:s(g));else if(t(g)){h=!0;for(let t=0,e=g.length;t{this._keysMap[t.id]=e}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,i(this.docs[0])?this.docs.forEach(((t,e)=>{this._addString(t,e)})):this.docs.forEach(((t,e)=>{this._addObject(t,e)})),this.norm.clear())}add(t){const e=this.size();i(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,s=this.size();e=0;e-=1)this.records.splice(t[e],1);for(let t=0,e=this.records.length;t{let u=s.getFn?s.getFn(e):this.getFn(e,s.path);if(c(u))if(t(u)){let t=[];for(let e=0,s=u.length;eE)throw new Error(`Pattern length exceeds max of ${E}.`);const a=e.length,l=t.length,d=Math.max(0,Math.min(i,l));let g=r,f=d;const p=(t,e)=>{const s=t/a;if(h)return s;const i=Math.abs(d-e);return n?s+i/n:i?1:s},A=c>1||o,C=A?Array(l):[];let F;for(;(F=t.indexOf(e,f))>-1;){let t=p(0,F);if(g=Math.min(t,g),f=F+a,A){let t=0;for(;t=r;i-=1){let n=i-1,u=s[t[n]];if(A&&(C[n]=+!!u),o[i]=(o[i+1]<<1|1)&u,e&&(o[i]|=(M[i+1]|M[i])<<1|1|M[i+1]),o[i]&B&&(y=p(e,n),y<=g)){if(g=y,f=n,f<=d)break;r=Math.max(1,2*d-f)}}if(p(e+1,d)>g)break;M=o}const x={isMatch:f>=0,score:Math.max(.001,y)};if(A){const t=function(t=[],e=m.minMatchCharLength){let s=[],i=-1,n=-1,r=0;for(let u=t.length;r=e&&s.push([i,n]),i=-1)}return t[r-1]&&r-i>=e&&s.push([i,r-1]),s}(C,c);t.length?o&&(x.indices=t):x.isMatch=!1}return x}function D(t){let e={};for(let s=0,i=t.length;st.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):t=>t;class x{constructor(t,{location:e=m.location,threshold:s=m.threshold,distance:i=m.distance,includeMatches:n=m.includeMatches,findAllMatches:r=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,isCaseSensitive:c=m.isCaseSensitive,ignoreDiacritics:o=m.ignoreDiacritics,ignoreLocation:h=m.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:u,isCaseSensitive:c,ignoreDiacritics:o,ignoreLocation:h},t=c?t:t.toLowerCase(),t=o?B(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:D(t),startIndex:e})},l=this.pattern.length;if(l>E){let t=0;const e=l%E,s=l-e;for(;t{const{isMatch:f,score:p,indices:A}=y(t,e,s,{location:n+g,distance:r,threshold:u,findAllMatches:c,minMatchCharLength:o,includeMatches:i,ignoreLocation:h});f&&(d=!0),l+=p,f&&A&&a.push(...A)}));let g={isMatch:d,score:d?l/this.chunks.length:1};return d&&i&&(g.indices=function(t){if(t.length<=1)return t;t.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]));const e=[t[0]];for(let s=1,i=t.length;s-1;)s=e+n,i.push([e,s-1]);const r=!!i.length;return{isMatch:r,score:r?0:1,indices:i}}}const L=[class extends _{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},k,class extends _{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},class extends _{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends _{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends _{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},class extends _{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},S],w=L.length,I=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const b=new Set([S.type,k.type]);class ${constructor(t,{isCaseSensitive:e=m.isCaseSensitive,ignoreDiacritics:s=m.ignoreDiacritics,includeMatches:i=m.includeMatches,minMatchCharLength:n=m.minMatchCharLength,ignoreLocation:r=m.ignoreLocation,findAllMatches:u=m.findAllMatches,location:c=m.location,threshold:o=m.threshold,distance:h=m.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:s,includeMatches:i,minMatchCharLength:n,findAllMatches:u,ignoreLocation:r,location:c,threshold:o,distance:h},t=e?t:t.toLowerCase(),t=s?B(t):t,this.pattern=t,this.query=function(t,e={}){return t.split("|").map((t=>{let s=t.trim().split(I).filter((t=>t&&!!t.trim())),i=[];for(let t=0,n=s.length;t!(!t[j]&&!t[W]),q=t=>({[j]:Object.keys(t).map((e=>({[e]:t[e]})))});function J(e,s,{auto:n=!0}={}){const r=e=>{let c=Object.keys(e);const o=(t=>!!t[z])(e);if(!o&&c.length>1&&!P(e))return r(q(e));if((e=>!t(e)&&u(e)&&!P(e))(e)){const t=o?e[z]:c[0],r=o?e[K]:e[t];if(!i(r))throw new Error((t=>`Invalid value for key ${t}`)(t));const u={keyId:A(t),pattern:r};return n&&(u.searcher=O(r,s)),u}let h={children:[],operator:c[0]};return c.forEach((s=>{const i=e[s];t(i)&&i.forEach((t=>{h.children.push(r(t))}))})),h};return P(e)||(e=q(e)),r(e)}function Q(t,{ignoreFieldNorm:e=m.ignoreFieldNorm}){let s=1;t.matches.forEach((({key:t,norm:i,score:n})=>{const r=t?t.weight:null;s*=Math.pow(0===n&&r?Number.EPSILON:n,(r||1)*(e?1:i))})),t.score=s}class U{constructor(t){this.limit=t,this.heap=[]}get size(){return this.heap.length}shouldInsert(t){return this.size0;){const s=t-1>>1;if(e[t].score<=e[s].score)break;const i=e[t];e[t]=e[s],e[s]=i,t=s}}_sinkDown(t){const e=this.heap,s=e.length;let i=t;do{const n=2*(t=i)+1,r=2*t+2;if(ne[i].score&&(i=n),re[i].score&&(i=r),i!==t){const s=e[t];e[t]=e[i],e[i]=s}}while(i!==t)}}function V(t,e){const s=t.matches;e.matches=[],c(s)&&s.forEach((t=>{if(!c(t.indices)||!t.indices.length)return;const{indices:s,value:i}=t;let n={indices:s,value:i};t.key&&(n.key=t.key.src),t.idx>-1&&(n.refIndex=t.idx),e.matches.push(n)}))}function G(t,e){e.score=t.score}class H{constructor(t,e={},s){this.options={...m,...e},this.options.useExtendedSearch,this._keyStore=new g(this.options.keys),this.setCollection(t,s),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=O(t,this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof F))throw new Error("Incorrect 'index' type");this._myIndex=e||M(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){c(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=(()=>!1)){const e=[],s=[];for(let i=0,n=this._docs.length;i=0;t-=1)this._docs.splice(s[t],1);this._myIndex.removeAll(s)}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:s,includeScore:r,shouldSort:u,sortFn:c,ignoreFieldNorm:o}=this.options;let h;if(n(e)&&e>0&&i(t)){const s=new U(e);i(this._docs[0])?this._searchStringList(t,{heap:s,ignoreFieldNorm:o}):this._searchObjectList(t,{heap:s,ignoreFieldNorm:o}),h=s.extractSorted(c)}else h=i(t)?i(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),function(t,{ignoreFieldNorm:e=m.ignoreFieldNorm}){t.forEach((t=>{Q(t,{ignoreFieldNorm:e})}))}(h,{ignoreFieldNorm:o}),u&&h.sort(c),n(e)&&e>-1&&(h=h.slice(0,e));return function(t,e,{includeMatches:s=m.includeMatches,includeScore:i=m.includeScore}={}){const n=[];return s&&n.push(V),i&&n.push(G),t.map((t=>{const{idx:s}=t,i={item:e[s],refIndex:s};return n.length&&n.forEach((e=>{e(t,i)})),i}))}(h,this._docs,{includeMatches:s,includeScore:r})}_searchStringList(t,{heap:e,ignoreFieldNorm:s}={}){const i=this._getSearcher(t),{records:n}=this._myIndex,r=e?null:[];return n.forEach((({v:t,i:n,n:u})=>{if(!c(t))return;const{isMatch:o,score:h,indices:a}=i.searchIn(t);if(o){const i={item:t,idx:n,matches:[{score:h,value:t,norm:u,indices:a}]};e?(Q(i,{ignoreFieldNorm:s}),e.shouldInsert(i.score)&&e.insert(i)):r.push(i)}})),r}_searchLogical(t){const e=J(t,this.options),s=(t,e,i)=>{if(!t.children){const{keyId:s,searcher:n}=t,r=this._findMatches({key:this._keyStore.get(s),value:this._myIndex.getValueForItemAtKeyId(e,s),searcher:n});return r&&r.length?[{idx:i,item:e,matches:r}]:[]}const n=[];for(let r=0,u=t.children.length;r{if(c(t)){let u=s(e,t,i);u.length&&(n.has(i)||(n.set(i,{idx:i,item:t,matches:[]}),r.push(n.get(i))),u.forEach((({matches:t})=>{n.get(i).matches.push(...t)})))}})),r}_searchObjectList(t,{heap:e,ignoreFieldNorm:s}={}){const i=this._getSearcher(t),{keys:n,records:r}=this._myIndex,u=e?null:[];return r.forEach((({$:t,i:r})=>{if(!c(t))return;let o=[];if(n.forEach(((e,s)=>{o.push(...this._findMatches({key:e,value:t[s],searcher:i}))})),o.length){const i={idx:r,item:t,matches:o};e?(Q(i,{ignoreFieldNorm:s}),e.shouldInsert(i.score)&&e.insert(i)):u.push(i)}})),u}_findMatches({key:e,value:s,searcher:i}){if(!c(s))return[];let n=[];if(t(s))s.forEach((({v:t,i:s,n:r})=>{if(!c(t))return;const{isMatch:u,score:o,indices:h}=i.searchIn(t);u&&n.push({score:o,key:e,value:t,idx:s,norm:r,indices:h})}));else{const{v:t,n:r}=s,{isMatch:u,score:c,indices:o}=i.searchIn(t);u&&n.push({score:c,key:e,value:t,norm:r,indices:o})}return n}}H.version="7.2.0",H.createIndex=M,H.parseIndex=function(t,{getFn:e=m.getFn,fieldNormWeight:s=m.fieldNormWeight}={}){const{keys:i,records:n}=t,r=new F({getFn:e,fieldNormWeight:s});return r.setKeys(i),r.setIndexRecords(n),r},H.config=m,R($),H.use=function(...t){t.forEach((t=>R(t)))};export{H as default};