Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fzf

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fzf - npm Package Compare versions

Comparing version 0.4.0-alpha.0 to 0.4.1

dist/types/algo.d.ts

7

dist/fzf.es.js

@@ -1,1 +0,6 @@

const t={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let Q="̀".codePointAt(0);Q<="ͯ".codePointAt(0);++Q){const e=String.fromCodePoint(Q);for(const n of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const r=(n+e).normalize().codePointAt(0);r>126&&(t[r]=n)}}const e={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const Q of Object.keys(e)){const n=Q.toUpperCase();for(let r=e[Q][0];r<=e[Q][1];++r)t[r]=r%2==0?n:Q}function n(e){if(e<192||e>8580)return e;const n=t[e];return void 0!==n?n.codePointAt(0):e}function r(t,e){return t>e?t:e}const o=t=>t.split("").map((t=>t.codePointAt(0))),s=t=>t.map((t=>String.fromCodePoint(t))).join(""),i=new Set(" \f\n\r\t\v  \u2028\u2029   \ufeff".split("").map((t=>t.codePointAt(0))));for(let Q=" ".codePointAt(0);Q<=" ".codePointAt(0);Q++)i.add(Q);const l=t=>i.has(t),c=t=>{let e=0;for(const n of t){if(!l(n))break;e++}return e},a=t=>{let e=0;for(let n=t.length-1;n>=0&&l(t[n]);n--)e++;return e},u="".codePointAt(0),f="A".codePointAt(0),h="Z".codePointAt(0),d="a".codePointAt(0),g="z".codePointAt(0),p="0".codePointAt(0),m="9".codePointAt(0);function b(t,e,n){return n?t:e-t-1}var y,P;function w(t){return t?new Set:null}function z(t,e,n){if(null!==e&&e.i16.length>t+n){return[t+n,e.i16.subarray(t,t+n)]}return[t,new Int16Array(n)]}function A(t,e,n){if(null!==e&&e.i32.length>t+n){return[t+n,e.i32.subarray(t,t+n)]}return[t,new Int32Array(n)]}function L(t){return t>=d&&t<=g?1:t>=f&&t<=h?2:t>=p&&t<=m?4:0}function S(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:null!==e.match(/\p{Number}/gu)?4:null!==e.match(/\p{Letter}/gu)?3:0}function C(t){return t<=u?L(t):S(t)}function v(t,e){return 0===t&&0!==e?8:1===t&&2===e||4!==t&&4===e?7:0===e?8:0}function k(t,e,n,r){let o=t.slice(r),s=o.indexOf(n);if(0===s)return r;if(!e&&n>=d&&n<=g){s>0&&(o=o.slice(0,s));const t=o.indexOf(n-32);t>=0&&(s=t)}return s<0?-1:r+s}function x(t){for(const e of t)if(e>=128)return!1;return!0}function E(t,e,n){if(!x(t))return 0;if(!x(e))return-1;let r=0,o=0;for(let s=0;s<e.length;s++){if(o=k(t,n,e[s],o),o<0)return-1;0===s&&o>0&&(r=o-1),o++}return r}(P=y||(y={}))[P.NonWord=0]="NonWord",P[P.Lower=1]="Lower",P[P.Upper=2]="Upper",P[P.Letter=3]="Letter",P[P.Number=4]="Number";const N=(t,e,o,s,i,l,c)=>{const a=i.length;if(0===a)return[{start:0,end:0,score:0},w(l)];const f=s.length;if(null!==c&&f*a>c.i16.length)return O(t,e,o,s,i,l);const h=E(s,i,t);if(h<0)return[{start:-1,end:-1,score:0},null];let d=0,g=0,p=null,m=null,b=null,y=null;[d,p]=z(d,c,f),[d,m]=z(d,c,f),[d,b]=z(d,c,f),[g,y]=A(g,c,a);const[,P]=A(g,c,f);for(let n=0;n<P.length;n++)P[n]=s[n];let C=0,k=0,x=0,N=0;const F=i[0];let R=i[0],W=0,j=0,I=!1,q=P.subarray(h),U=p.subarray(h).subarray(0,q.length),B=m.subarray(h).subarray(0,q.length),M=b.subarray(h).subarray(0,q.length);for(let[w,z]of q.entries()){let s=null;z<=u?(s=L(z),t||2!==s||(z+=32)):(s=S(z),t||2!==s||(z=String.fromCodePoint(z).toLowerCase().codePointAt(0)),e&&(z=n(z))),q[w]=z;const l=v(j,s);if(M[w]=l,j=s,z===R&&(x<a&&(y[x]=h+w,x++,R=i[Math.min(x,a-1)]),N=h+w),z===F){const t=16+2*l;if(U[w]=t,B[w]=1,1===a&&(o&&t>C||!o&&t>=C)&&(C=t,k=h+w,o&&8===l))break;I=!1}else U[w]=r(I?W+-1:W+-3,0),B[w]=0,I=!0;W=U[w]}if(x!==a)return[{start:-1,end:-1,score:0},null];if(1===a){const t={start:k,end:k+1,score:C};if(!l)return[t,null];const e=new Set;return e.add(k),[t,e]}const D=y[0],G=N-D+1;let T=null;[d,T]=z(d,c,G*a);{const t=p.subarray(D,N+1);for(const[e,n]of t.entries())T[e]=n}let[,V]=z(d,c,G*a);{const t=m.subarray(D,N+1);for(const[e,n]of t.entries())V[e]=n}const J=y.subarray(1),Y=i.slice(1).slice(0,J.length);for(const[n,u]of J.entries()){let t=!1;const e=Y[n],s=n+1,i=s*G,l=P.subarray(u,N+1),c=b.subarray(u).subarray(0,l.length),f=V.subarray(i+u-D).subarray(0,l.length),h=V.subarray(i+u-D-1-G).subarray(0,l.length),d=T.subarray(i+u-D).subarray(0,l.length),g=T.subarray(i+u-D-1-G).subarray(0,l.length),p=T.subarray(i+u-D-1).subarray(0,l.length);p[0]=0;for(const[n,m]of l.entries()){const i=n+u;let l=0,y=0,P=0;if(y=t?p[n]+-1:p[n]+-3,e===m){l=g[n]+16;let t=c[n];P=h[n]+1,8===t?P=1:P>1&&(t=r(t,r(4,b[i-P+1]))),l+t<y?(l+=c[n],P=0):l+=t}f[n]=P,t=l<y;const w=r(r(l,y),0);s===a-1&&(o&&w>C||!o&&w>=C)&&(C=w,k=i),d[n]=w}}const Z=w(l);let H=D;if(l&&null!==Z){let t=a-1;H=k;let e=!0;for(;;){const n=t*G,r=H-D,o=T[n+r];let s=0,i=0;if(t>0&&H>=y[t]&&(s=T[n-G+r-1]),H>y[t]&&(i=T[n+r-1]),o>s&&(o>i||o===i&&e)){if(Z.add(H),0===t)break;t--}e=V[n+r]>1||n+G+r+1<V.length&&V[n+G+r+1]>0,H--}}return[{start:H,end:k+1,score:C},Z]};function F(t,e,o,s,i,l,c){let a=0,d=0,g=!1,p=0,m=0;const b=w(c);let y=0;i>0&&(y=C(o[i-1]));for(let P=i;P<l;P++){let i=o[P];const l=C(i);if(t||(i>=f&&i<=h?i+=32:i>u&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=n(i)),i===s[a]){c&&null!==b&&b.add(P),d+=16;let t=v(y,l);0===p?m=t:(8===t&&(m=t),t=r(r(t,m),4)),d+=0===a?2*t:t,g=!1,p++,a++}else d+=g?-1:-3,g=!0,p=0,m=0;y=l}return[d,b]}const O=(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];if(E(o,s,t)<0)return[{start:-1,end:-1,score:0},null];let c=0,a=-1,d=-1;const g=o.length,p=s.length;for(let m=0;m<g;m++){let i=o[b(m,g,r)];t||(i>=f&&i<=h?i+=32:i>u&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=n(i));if(i===s[b(c,p,r)]&&(a<0&&(a=m),c++,c===p)){d=m+1;break}}if(a>=0&&d>=0){c--;for(let e=d-1;e>=a;e--){let n=o[b(e,g,r)];t||(n>=f&&n<=h?n+=32:n>u&&(n=String.fromCodePoint(n).toLowerCase().codePointAt(0)));if(n===s[b(c,p,r)]&&(c--,c<0)){a=e;break}}if(!r){const t=a;a=g-d,d=g-t}const[n,l]=F(t,e,o,s,a,d,i);return[{start:a,end:d,score:n},l]}return[{start:-1,end:-1,score:0},null]},R=(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];const c=o.length,a=s.length;if(c<a)return[{start:-1,end:-1,score:0},null];if(E(o,s,t)<0)return[{start:-1,end:-1,score:0},null];let d=0,g=-1,p=0,m=-1;for(let w=0;w<c;w++){const i=b(w,c,r);let l=o[i];t||(l>=f&&l<=h?l+=32:l>u&&(l=String.fromCodePoint(l).toLowerCase().codePointAt(0))),e&&(l=n(l));const z=b(d,a,r);if(s[z]===l){if(0===z&&(y=o,p=0===(P=i)?8:v(C(y[P-1]),C(y[P]))),d++,d===a){if(p>m&&(g=w,m=p),8===p)break;w-=d-1,d=0,p=0}}else w-=d,d=0,p=0}var y,P;if(g>=0){let n=0,i=0;r?(n=g-a+1,i=g+1):(n=c-(g+1),i=c-(g-a+1));const[l]=F(t,e,o,s,n,i,!1);return[{start:n,end:i,score:l},null]}return[{start:-1,end:-1,score:0},null]};const W=(j=2048,{i16:new Int16Array(102400),i32:new Int32Array(j)});var j,I,q;(q=I||(I={}))[q.Fuzzy=0]="Fuzzy",q[q.Exact=1]="Exact",q[q.Prefix=2]="Prefix",q[q.Suffix=3]="Suffix",q[q.Equal=4]="Equal";const U={0:N,1:R,2:(t,e,r,o,s,i,a)=>{if(0===s.length)return[{start:0,end:0,score:0},null];let u=0;if(l(s[0])||(u=c(o)),o.length-u<s.length)return[{start:-1,end:-1,score:0},null];for(const[l,c]of s.entries()){let r=o[u+l];if(t||(r=String.fromCodePoint(r).toLowerCase().codePointAt(0)),e&&(r=n(r)),r!==c)return[{start:-1,end:-1,score:0},null]}const f=s.length,[h]=F(t,e,o,s,u,u+f,!1);return[{start:u,end:u+f,score:h},null]},3:(t,e,r,o,s,i,c)=>{let u=o.length;if(0!==s.length&&l(s[s.length-1])||(u-=a(o)),0===s.length)return[{start:u,end:u,score:0},null];const f=u-s.length;if(f<0)return[{start:-1,end:-1,score:0},null];for(const[l,a]of s.entries()){let r=o[l+f];if(t||(r=String.fromCodePoint(r).toLowerCase().codePointAt(0)),e&&(r=n(r)),r!==a)return[{start:-1,end:-1,score:0},null]}const h=u-s.length,d=u,[g]=F(t,e,o,s,h,d,!1);return[{start:h,end:d,score:g},null]},4:(t,e,r,o,i,u,f)=>{const h=i.length;if(0===h)return[{start:-1,end:-1,score:0},null];let d=0;l(i[0])||(d=c(o));let g=0;if(l(i[h-1])||(g=a(o)),o.length-d-g!=h)return[{start:-1,end:-1,score:0},null];let p=!0;if(e){const e=o;for(const[r,o]of i.entries()){let s=e[d+r];if(t||(s=String.fromCodePoint(s).toLowerCase().codePointAt(0)),n(o)!==n(s)){p=!1;break}}}else{let e=s(o).substring(d,o.length-g);t||(e=e.toLowerCase()),p=e===s(i)}return p?[{start:d,end:d+h,score:24*h+8},null]:[{start:-1,end:-1,score:0},null]}};function B(t,e,r,i){let l=!0;{const t=(i=i.trimLeft()).trimRight();i=t.endsWith("\\")&&" "===i[t.length]?t+" ":t}let c=!1,a=[];a=function(t,e,r,i){const l=(i=i.replaceAll("\\ ","\t")).split(/ +/),c=[];let a=[],u=!1,f=!1;for(const h of l){let i=0,l=!1,d=h.replaceAll("\t"," ");const g=d.toLowerCase(),p="case-sensitive"===e||"smart-case"===e&&d!==g,m=r&&g===s(o(g).map(n));if(p||(d=g),t||(i=1),a.length>0&&!f&&"|"===d)u=!1,f=!0;else if(f=!1,d.startsWith("!")&&(l=!0,i=1,d=d.substring(1)),"$"!==d&&d.endsWith("$")&&(i=3,d=d.substring(0,d.length-1)),d.startsWith("'")?(i=t&&!l?1:0,d=d.substring(1)):d.startsWith("^")&&(i=3===i?4:2,d=d.substring(1)),d.length>0){u&&(c.push(a),a=[]);let t=o(d);m&&(t=t.map(n)),a.push({typ:i,inv:l,text:t,caseSensitive:p,normalize:m}),u=!0}}a.length>0&&c.push(a);return c}(t,e,r,i);t:for(const n of a)for(const[e,r]of n.entries())if(r.inv||(c=!0),(!l||e>0||r.inv||t&&0!==r.typ||!t&&1!==r.typ)&&(l=!1,c))break t;return{str:i,termSets:a,sortable:c,cacheable:l,fuzzy:t}}function M(t,e,n,r,o,s,i){for(const l of e){const[e,c]=t(n,r,o,l.text,s,!0,i);if(e.start>=0){const t=e.start+l.prefixLength,n=e.end+l.prefixLength;if(null!==c){const r=new Set;return c.forEach((t=>r.add(l.prefixLength+t))),[[t,n],e.score,r]}return[[t,n],e.score,c]}}return[[-1,-1],0,null]}function D(t,e,n,r){const o=[{text:t,prefixLength:0}],s=[];let i=0;const l=new Set;for(const c of e.termSets){let t=[0,0],e=0,a=!1;for(const s of c){let i=U[s.typ];s.typ===I.Fuzzy&&(i=n);const[c,u,f]=M(i,o,s.caseSensitive,s.normalize,r,s.text,W);if(c[0]>=0){if(s.inv)continue;if(t=c,e=u,a=!0,null!==f)f.forEach((t=>l.add(t)));else for(let t=c[0];t<c[1];++t)l.add(t);break}s.inv&&(t=[0,0],e=0,a=!0)}a&&(s.push(t),i+=e)}return{offsets:s,totalScore:i,allPos:l}}function G(t){const{queryRunes:e,caseSensitive:r}=((t,e,r)=>{let s=!1;switch(e){case"smart-case":t.toLowerCase()!==t&&(s=!0);break;case"case-sensitive":s=!0;break;case"case-insensitive":t=t.toLowerCase(),s=!1}let i=o(t);return r&&(i=i.map(n)),{queryRunes:i,caseSensitive:s}})(t,this.opts.casing,this.opts.normalize),s={};for(let n=0,o=this.runesList.length;n<o;++n){const t=this.runesList[n];if(e.length>t.length)continue;let[o,i]=this.algoFn(r,this.opts.normalize,this.opts.forward,t,e,!0,W);if(-1===o.start)continue;if(!1===this.opts.fuzzy){i=new Set;for(let t=o.start;t<o.end;++t)i.add(t)}const l=this.opts.sort?o.score:0;void 0===s[l]&&(s[l]=[]),s[l].push({item:this.items[n],...o,positions:null!=i?i:new Set})}return V(s,this.opts.limit)}function T(t){const e=B(Boolean(this.opts.fuzzy),this.opts.casing,this.opts.normalize,t),n={};for(const[r,o]of this.runesList.entries()){const t=D(o,e,this.algoFn,this.opts.forward);if(t.offsets.length!==e.termSets.length)continue;let s=-1,i=-1;t.allPos.size>0&&(s=Math.min(...t.allPos),i=Math.max(...t.allPos)+1);const l=this.opts.sort?t.totalScore:0;void 0===n[l]&&(n[l]=[]),n[l].push({score:t.totalScore,item:this.items[r],positions:t.allPos,start:s,end:i})}return V(n,this.opts.limit)}function V(t,e){const n=Object.keys(t).map((t=>parseInt(t,10))).sort(((t,e)=>e-t)),r=[];for(const o of n)if(r.push(...t[o]),r.length>=e)break;return r}const J={limit:1/0,selector:t=>t,casing:"smart-case",normalize:!0,fuzzy:"v2",match:G,tiebreakers:[],sort:!0,forward:!0};class Y{constructor(t,...e){switch(this.opts={...J,...e[0]},this.items=t,this.runesList=t.map((t=>o(this.opts.selector(t).normalize()))),this.algoFn=R,this.opts.fuzzy){case"v2":this.algoFn=N;break;case"v1":this.algoFn=O}}find(t){t=t.normalize();let e=[];if(e=this.opts.match.bind(this)(t),this.opts.sort)for(const n of this.opts.tiebreakers)e.sort(((t,e)=>t.score===e.score?n(t,e,this.opts):0));return Number.isFinite(this.opts.limit)&&e.splice(this.opts.limit),e}}function Z(t,e,n){return n.selector(t.item).length-n.selector(e.item).length}function H(t,e){return t.start-e.start}class K{constructor(t,...e){this.finder=new Y(t,...e),this.find=this.finder.find.bind(this.finder)}}export{K as Fzf,G as basicMatch,Z as byLengthAsc,H as byStartAsc,T as extendedMatch};
/** @license
* fzf v0.4.1
* Copyright (c) 2021 Ajit
* Licensed under BSD 3-Clause
*/
const t={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let Q="̀".codePointAt(0);Q<="ͯ".codePointAt(0);++Q){const e=String.fromCodePoint(Q);for(const n of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const r=(n+e).normalize().codePointAt(0);r>126&&(t[r]=n)}}const e={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const Q of Object.keys(e)){const n=Q.toUpperCase();for(let r=e[Q][0];r<=e[Q][1];++r)t[r]=r%2==0?n:Q}function n(e){if(e<192||e>8580)return e;const n=t[e];return void 0!==n?n.codePointAt(0):e}function r(t,e){return t>e?t:e}const o=t=>t.split("").map((t=>t.codePointAt(0))),s=t=>t.map((t=>String.fromCodePoint(t))).join(""),i=new Set(" \f\n\r\t\v  \u2028\u2029   \ufeff".split("").map((t=>t.codePointAt(0))));for(let Q=" ".codePointAt(0);Q<=" ".codePointAt(0);Q++)i.add(Q);const l=t=>i.has(t),c=t=>{let e=0;for(const n of t){if(!l(n))break;e++}return e},a=t=>{let e=0;for(let n=t.length-1;n>=0&&l(t[n]);n--)e++;return e},u="".codePointAt(0),f="A".codePointAt(0),h="Z".codePointAt(0),d="a".codePointAt(0),g="z".codePointAt(0),p="0".codePointAt(0),m="9".codePointAt(0);function b(t,e,n){return n?t:e-t-1}var y,P;function w(t){return t?new Set:null}function z(t,e,n){if(null!==e&&e.i16.length>t+n){return[t+n,e.i16.subarray(t,t+n)]}return[t,new Int16Array(n)]}function A(t,e,n){if(null!==e&&e.i32.length>t+n){return[t+n,e.i32.subarray(t,t+n)]}return[t,new Int32Array(n)]}function L(t){return t>=d&&t<=g?1:t>=f&&t<=h?2:t>=p&&t<=m?4:0}function S(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:null!==e.match(/\p{Number}/gu)?4:null!==e.match(/\p{Letter}/gu)?3:0}function C(t){return t<=u?L(t):S(t)}function v(t,e){return 0===t&&0!==e?8:1===t&&2===e||4!==t&&4===e?7:0===e?8:0}function k(t,e,n,r){let o=t.slice(r),s=o.indexOf(n);if(0===s)return r;if(!e&&n>=d&&n<=g){s>0&&(o=o.slice(0,s));const t=o.indexOf(n-32);t>=0&&(s=t)}return s<0?-1:r+s}function x(t){for(const e of t)if(e>=128)return!1;return!0}function E(t,e,n){if(!x(t))return 0;if(!x(e))return-1;let r=0,o=0;for(let s=0;s<e.length;s++){if(o=k(t,n,e[s],o),o<0)return-1;0===s&&o>0&&(r=o-1),o++}return r}(P=y||(y={}))[P.NonWord=0]="NonWord",P[P.Lower=1]="Lower",P[P.Upper=2]="Upper",P[P.Letter=3]="Letter",P[P.Number=4]="Number";const N=(t,e,o,s,i,l,c)=>{const a=i.length;if(0===a)return[{start:0,end:0,score:0},w(l)];const f=s.length;if(null!==c&&f*a>c.i16.length)return O(t,e,o,s,i,l);const h=E(s,i,t);if(h<0)return[{start:-1,end:-1,score:0},null];let d=0,g=0,p=null,m=null,b=null,y=null;[d,p]=z(d,c,f),[d,m]=z(d,c,f),[d,b]=z(d,c,f),[g,y]=A(g,c,a);const[,P]=A(g,c,f);for(let n=0;n<P.length;n++)P[n]=s[n];let C=0,k=0,x=0,N=0;const F=i[0];let R=i[0],W=0,j=0,I=!1,q=P.subarray(h),U=p.subarray(h).subarray(0,q.length),B=m.subarray(h).subarray(0,q.length),M=b.subarray(h).subarray(0,q.length);for(let[w,z]of q.entries()){let s=null;z<=u?(s=L(z),t||2!==s||(z+=32)):(s=S(z),t||2!==s||(z=String.fromCodePoint(z).toLowerCase().codePointAt(0)),e&&(z=n(z))),q[w]=z;const l=v(j,s);if(M[w]=l,j=s,z===R&&(x<a&&(y[x]=h+w,x++,R=i[Math.min(x,a-1)]),N=h+w),z===F){const t=16+2*l;if(U[w]=t,B[w]=1,1===a&&(o&&t>C||!o&&t>=C)&&(C=t,k=h+w,o&&8===l))break;I=!1}else U[w]=r(I?W+-1:W+-3,0),B[w]=0,I=!0;W=U[w]}if(x!==a)return[{start:-1,end:-1,score:0},null];if(1===a){const t={start:k,end:k+1,score:C};if(!l)return[t,null];const e=new Set;return e.add(k),[t,e]}const D=y[0],G=N-D+1;let T=null;[d,T]=z(d,c,G*a);{const t=p.subarray(D,N+1);for(const[e,n]of t.entries())T[e]=n}let[,V]=z(d,c,G*a);{const t=m.subarray(D,N+1);for(const[e,n]of t.entries())V[e]=n}const J=y.subarray(1),Y=i.slice(1).slice(0,J.length);for(const[n,u]of J.entries()){let t=!1;const e=Y[n],s=n+1,i=s*G,l=P.subarray(u,N+1),c=b.subarray(u).subarray(0,l.length),f=V.subarray(i+u-D).subarray(0,l.length),h=V.subarray(i+u-D-1-G).subarray(0,l.length),d=T.subarray(i+u-D).subarray(0,l.length),g=T.subarray(i+u-D-1-G).subarray(0,l.length),p=T.subarray(i+u-D-1).subarray(0,l.length);p[0]=0;for(const[n,m]of l.entries()){const i=n+u;let l=0,y=0,P=0;if(y=t?p[n]+-1:p[n]+-3,e===m){l=g[n]+16;let t=c[n];P=h[n]+1,8===t?P=1:P>1&&(t=r(t,r(4,b[i-P+1]))),l+t<y?(l+=c[n],P=0):l+=t}f[n]=P,t=l<y;const w=r(r(l,y),0);s===a-1&&(o&&w>C||!o&&w>=C)&&(C=w,k=i),d[n]=w}}const Z=w(l);let H=D;if(l&&null!==Z){let t=a-1;H=k;let e=!0;for(;;){const n=t*G,r=H-D,o=T[n+r];let s=0,i=0;if(t>0&&H>=y[t]&&(s=T[n-G+r-1]),H>y[t]&&(i=T[n+r-1]),o>s&&(o>i||o===i&&e)){if(Z.add(H),0===t)break;t--}e=V[n+r]>1||n+G+r+1<V.length&&V[n+G+r+1]>0,H--}}return[{start:H,end:k+1,score:C},Z]};function F(t,e,o,s,i,l,c){let a=0,d=0,g=!1,p=0,m=0;const b=w(c);let y=0;i>0&&(y=C(o[i-1]));for(let P=i;P<l;P++){let i=o[P];const l=C(i);if(t||(i>=f&&i<=h?i+=32:i>u&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=n(i)),i===s[a]){c&&null!==b&&b.add(P),d+=16;let t=v(y,l);0===p?m=t:(8===t&&(m=t),t=r(r(t,m),4)),d+=0===a?2*t:t,g=!1,p++,a++}else d+=g?-1:-3,g=!0,p=0,m=0;y=l}return[d,b]}const O=(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];if(E(o,s,t)<0)return[{start:-1,end:-1,score:0},null];let c=0,a=-1,d=-1;const g=o.length,p=s.length;for(let m=0;m<g;m++){let i=o[b(m,g,r)];t||(i>=f&&i<=h?i+=32:i>u&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=n(i));if(i===s[b(c,p,r)]&&(a<0&&(a=m),c++,c===p)){d=m+1;break}}if(a>=0&&d>=0){c--;for(let e=d-1;e>=a;e--){let n=o[b(e,g,r)];t||(n>=f&&n<=h?n+=32:n>u&&(n=String.fromCodePoint(n).toLowerCase().codePointAt(0)));if(n===s[b(c,p,r)]&&(c--,c<0)){a=e;break}}if(!r){const t=a;a=g-d,d=g-t}const[n,l]=F(t,e,o,s,a,d,i);return[{start:a,end:d,score:n},l]}return[{start:-1,end:-1,score:0},null]},R=(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];const c=o.length,a=s.length;if(c<a)return[{start:-1,end:-1,score:0},null];if(E(o,s,t)<0)return[{start:-1,end:-1,score:0},null];let d=0,g=-1,p=0,m=-1;for(let w=0;w<c;w++){const i=b(w,c,r);let l=o[i];t||(l>=f&&l<=h?l+=32:l>u&&(l=String.fromCodePoint(l).toLowerCase().codePointAt(0))),e&&(l=n(l));const z=b(d,a,r);if(s[z]===l){if(0===z&&(y=o,p=0===(P=i)?8:v(C(y[P-1]),C(y[P]))),d++,d===a){if(p>m&&(g=w,m=p),8===p)break;w-=d-1,d=0,p=0}}else w-=d,d=0,p=0}var y,P;if(g>=0){let n=0,i=0;r?(n=g-a+1,i=g+1):(n=c-(g+1),i=c-(g-a+1));const[l]=F(t,e,o,s,n,i,!1);return[{start:n,end:i,score:l},null]}return[{start:-1,end:-1,score:0},null]};const W=(j=2048,{i16:new Int16Array(102400),i32:new Int32Array(j)});var j,I,q;(q=I||(I={}))[q.Fuzzy=0]="Fuzzy",q[q.Exact=1]="Exact",q[q.Prefix=2]="Prefix",q[q.Suffix=3]="Suffix",q[q.Equal=4]="Equal";const U={0:N,1:R,2:(t,e,r,o,s,i,a)=>{if(0===s.length)return[{start:0,end:0,score:0},null];let u=0;if(l(s[0])||(u=c(o)),o.length-u<s.length)return[{start:-1,end:-1,score:0},null];for(const[l,c]of s.entries()){let r=o[u+l];if(t||(r=String.fromCodePoint(r).toLowerCase().codePointAt(0)),e&&(r=n(r)),r!==c)return[{start:-1,end:-1,score:0},null]}const f=s.length,[h]=F(t,e,o,s,u,u+f,!1);return[{start:u,end:u+f,score:h},null]},3:(t,e,r,o,s,i,c)=>{let u=o.length;if(0!==s.length&&l(s[s.length-1])||(u-=a(o)),0===s.length)return[{start:u,end:u,score:0},null];const f=u-s.length;if(f<0)return[{start:-1,end:-1,score:0},null];for(const[l,a]of s.entries()){let r=o[l+f];if(t||(r=String.fromCodePoint(r).toLowerCase().codePointAt(0)),e&&(r=n(r)),r!==a)return[{start:-1,end:-1,score:0},null]}const h=u-s.length,d=u,[g]=F(t,e,o,s,h,d,!1);return[{start:h,end:d,score:g},null]},4:(t,e,r,o,i,u,f)=>{const h=i.length;if(0===h)return[{start:-1,end:-1,score:0},null];let d=0;l(i[0])||(d=c(o));let g=0;if(l(i[h-1])||(g=a(o)),o.length-d-g!=h)return[{start:-1,end:-1,score:0},null];let p=!0;if(e){const e=o;for(const[r,o]of i.entries()){let s=e[d+r];if(t||(s=String.fromCodePoint(s).toLowerCase().codePointAt(0)),n(o)!==n(s)){p=!1;break}}}else{let e=s(o).substring(d,o.length-g);t||(e=e.toLowerCase()),p=e===s(i)}return p?[{start:d,end:d+h,score:24*h+8},null]:[{start:-1,end:-1,score:0},null]}};function B(t,e,r,i){let l=!0;{const t=(i=i.trimLeft()).trimRight();i=t.endsWith("\\")&&" "===i[t.length]?t+" ":t}let c=!1,a=[];a=function(t,e,r,i){const l=(i=i.replace(/\\ /g,"\t")).split(/ +/),c=[];let a=[],u=!1,f=!1;for(const h of l){let i=0,l=!1,d=h.replace(/\t/g," ");const g=d.toLowerCase(),p="case-sensitive"===e||"smart-case"===e&&d!==g,m=r&&g===s(o(g).map(n));if(p||(d=g),t||(i=1),a.length>0&&!f&&"|"===d)u=!1,f=!0;else if(f=!1,d.startsWith("!")&&(l=!0,i=1,d=d.substring(1)),"$"!==d&&d.endsWith("$")&&(i=3,d=d.substring(0,d.length-1)),d.startsWith("'")?(i=t&&!l?1:0,d=d.substring(1)):d.startsWith("^")&&(i=3===i?4:2,d=d.substring(1)),d.length>0){u&&(c.push(a),a=[]);let t=o(d);m&&(t=t.map(n)),a.push({typ:i,inv:l,text:t,caseSensitive:p,normalize:m}),u=!0}}a.length>0&&c.push(a);return c}(t,e,r,i);t:for(const n of a)for(const[e,r]of n.entries())if(r.inv||(c=!0),(!l||e>0||r.inv||t&&0!==r.typ||!t&&1!==r.typ)&&(l=!1,c))break t;return{str:i,termSets:a,sortable:c,cacheable:l,fuzzy:t}}function M(t,e,n,r,o,s,i){for(const l of e){const[e,c]=t(n,r,o,l.text,s,!0,i);if(e.start>=0){const t=e.start+l.prefixLength,n=e.end+l.prefixLength;if(null!==c){const r=new Set;return c.forEach((t=>r.add(l.prefixLength+t))),[[t,n],e.score,r]}return[[t,n],e.score,c]}}return[[-1,-1],0,null]}function D(t,e,n,r){const o=[{text:t,prefixLength:0}],s=[];let i=0;const l=new Set;for(const c of e.termSets){let t=[0,0],e=0,a=!1;for(const s of c){let i=U[s.typ];s.typ===I.Fuzzy&&(i=n);const[c,u,f]=M(i,o,s.caseSensitive,s.normalize,r,s.text,W);if(c[0]>=0){if(s.inv)continue;if(t=c,e=u,a=!0,null!==f)f.forEach((t=>l.add(t)));else for(let t=c[0];t<c[1];++t)l.add(t);break}s.inv&&(t=[0,0],e=0,a=!0)}a&&(s.push(t),i+=e)}return{offsets:s,totalScore:i,allPos:l}}function G(t){const{queryRunes:e,caseSensitive:r}=((t,e,r)=>{let s=!1;switch(e){case"smart-case":t.toLowerCase()!==t&&(s=!0);break;case"case-sensitive":s=!0;break;case"case-insensitive":t=t.toLowerCase(),s=!1}let i=o(t);return r&&(i=i.map(n)),{queryRunes:i,caseSensitive:s}})(t,this.opts.casing,this.opts.normalize),s={};for(let n=0,o=this.runesList.length;n<o;++n){const t=this.runesList[n];if(e.length>t.length)continue;let[o,i]=this.algoFn(r,this.opts.normalize,this.opts.forward,t,e,!0,W);if(-1===o.start)continue;if(!1===this.opts.fuzzy){i=new Set;for(let t=o.start;t<o.end;++t)i.add(t)}const l=this.opts.sort?o.score:0;void 0===s[l]&&(s[l]=[]),s[l].push({item:this.items[n],...o,positions:null!=i?i:new Set})}return V(s,this.opts.limit)}function T(t){const e=B(Boolean(this.opts.fuzzy),this.opts.casing,this.opts.normalize,t),n={};for(const[r,o]of this.runesList.entries()){const t=D(o,e,this.algoFn,this.opts.forward);if(t.offsets.length!==e.termSets.length)continue;let s=-1,i=-1;t.allPos.size>0&&(s=Math.min(...t.allPos),i=Math.max(...t.allPos)+1);const l=this.opts.sort?t.totalScore:0;void 0===n[l]&&(n[l]=[]),n[l].push({score:t.totalScore,item:this.items[r],positions:t.allPos,start:s,end:i})}return V(n,this.opts.limit)}function V(t,e){const n=Object.keys(t).map((t=>parseInt(t,10))).sort(((t,e)=>e-t)),r=[];for(const o of n)if(r.push(...t[o]),r.length>=e)break;return r}const J={limit:1/0,selector:t=>t,casing:"smart-case",normalize:!0,fuzzy:"v2",match:G,tiebreakers:[],sort:!0,forward:!0};class Y{constructor(t,...e){switch(this.opts={...J,...e[0]},this.items=t,this.runesList=t.map((t=>o(this.opts.selector(t).normalize()))),this.algoFn=R,this.opts.fuzzy){case"v2":this.algoFn=N;break;case"v1":this.algoFn=O}}find(t){t=t.normalize();let e=this.opts.match.bind(this)(t);if(this.opts.sort)for(const n of this.opts.tiebreakers)e.sort(((t,e)=>t.score===e.score?n(t,e,this.opts):0));return Number.isFinite(this.opts.limit)&&e.splice(this.opts.limit),e}}function Z(t,e,n){return n.selector(t.item).length-n.selector(e.item).length}function H(t,e){return t.start-e.start}class K{constructor(t,...e){this.finder=new Y(t,...e),this.find=this.finder.find.bind(this.finder)}}export{K as Fzf,G as basicMatch,Z as byLengthAsc,H as byStartAsc,T as extendedMatch};

@@ -1,1 +0,6 @@

var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,r)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,__spreadValues=(t,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(t,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(t,r,e[r]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).fzf={})}(this,(function(t){"use strict";const e={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let Z="̀".codePointAt(0);Z<="ͯ".codePointAt(0);++Z){const t=String.fromCodePoint(Z);for(const r of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const n=(r+t).normalize().codePointAt(0);n>126&&(e[n]=r)}}const r={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const Z of Object.keys(r)){const t=Z.toUpperCase();for(let n=r[Z][0];n<=r[Z][1];++n)e[n]=n%2==0?t:Z}function n(t){if(t<192||t>8580)return t;const r=e[t];return void 0!==r?r.codePointAt(0):t}function o(t,e){return t>e?t:e}const s=t=>t.split("").map((t=>t.codePointAt(0))),i=t=>t.map((t=>String.fromCodePoint(t))).join(""),l=new Set(" \f\n\r\t\v  \u2028\u2029   \ufeff".split("").map((t=>t.codePointAt(0))));for(let Z=" ".codePointAt(0);Z<=" ".codePointAt(0);Z++)l.add(Z);const a=t=>l.has(t),c=t=>{let e=0;for(const r of t){if(!a(r))break;e++}return e},u=t=>{let e=0;for(let r=t.length-1;r>=0&&a(t[r]);r--)e++;return e},f="".codePointAt(0),h="A".codePointAt(0),d="Z".codePointAt(0),p="a".codePointAt(0),g="z".codePointAt(0),b="0".codePointAt(0),m="9".codePointAt(0);function y(t,e,r){return r?t:e-t-1}const P=16;var _,w;function S(t){return t?new Set:null}function z(t,e,r){if(null!==e&&e.i16.length>t+r){return[t+r,e.i16.subarray(t,t+r)]}return[t,new Int16Array(r)]}function A(t,e,r){if(null!==e&&e.i32.length>t+r){return[t+r,e.i32.subarray(t,t+r)]}return[t,new Int32Array(r)]}function v(t){return t>=p&&t<=g?1:t>=h&&t<=d?2:t>=b&&t<=m?4:0}function L(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:null!==e.match(/\p{Number}/gu)?4:null!==e.match(/\p{Letter}/gu)?3:0}function C(t){return t<=f?v(t):L(t)}function O(t,e){return 0===t&&0!==e?8:1===t&&2===e||4!==t&&4===e?7:0===e?8:0}function x(t,e,r,n){let o=t.slice(n),s=o.indexOf(r);if(0===s)return n;if(!e&&r>=p&&r<=g){s>0&&(o=o.slice(0,s));const t=o.indexOf(r-32);t>=0&&(s=t)}return s<0?-1:n+s}function k(t){for(const e of t)if(e>=128)return!1;return!0}function j(t,e,r){if(!k(t))return 0;if(!k(e))return-1;let n=0,o=0;for(let s=0;s<e.length;s++){if(o=x(t,r,e[s],o),o<0)return-1;0===s&&o>0&&(n=o-1),o++}return n}(w=_||(_={}))[w.NonWord=0]="NonWord",w[w.Lower=1]="Lower",w[w.Upper=2]="Upper",w[w.Letter=3]="Letter",w[w.Number=4]="Number";const E=(t,e,r,s,i,l,a)=>{const c=i.length;if(0===c)return[{start:0,end:0,score:0},S(l)];const u=s.length;if(null!==a&&u*c>a.i16.length)return F(t,e,r,s,i,l);const h=j(s,i,t);if(h<0)return[{start:-1,end:-1,score:0},null];let d=0,p=0,g=null,b=null,m=null,y=null;[d,g]=z(d,a,u),[d,b]=z(d,a,u),[d,m]=z(d,a,u),[p,y]=A(p,a,c);const[,_]=A(p,a,u);for(let n=0;n<_.length;n++)_[n]=s[n];let w=0,C=0,x=0,k=0;const E=i[0];let N=i[0],I=0,M=0,R=!1,W=_.subarray(h),V=g.subarray(h).subarray(0,W.length),q=b.subarray(h).subarray(0,W.length),D=m.subarray(h).subarray(0,W.length);for(let[S,z]of W.entries()){let s=null;z<=f?(s=v(z),t||2!==s||(z+=32)):(s=L(z),t||2!==s||(z=String.fromCodePoint(z).toLowerCase().codePointAt(0)),e&&(z=n(z))),W[S]=z;const l=O(M,s);if(D[S]=l,M=s,z===N&&(x<c&&(y[x]=h+S,x++,N=i[Math.min(x,c-1)]),k=h+S),z===E){const t=P+2*l;if(V[S]=t,q[S]=1,1===c&&(r&&t>w||!r&&t>=w)&&(w=t,C=h+S,r&&8===l))break;R=!1}else V[S]=o(R?I+-1:I+-3,0),q[S]=0,R=!0;I=V[S]}if(x!==c)return[{start:-1,end:-1,score:0},null];if(1===c){const t={start:C,end:C+1,score:w};if(!l)return[t,null];const e=new Set;return e.add(C),[t,e]}const T=y[0],U=k-T+1;let B=null;[d,B]=z(d,a,U*c);{const t=g.subarray(T,k+1);for(const[e,r]of t.entries())B[e]=r}let[,G]=z(d,a,U*c);{const t=b.subarray(T,k+1);for(const[e,r]of t.entries())G[e]=r}const J=y.subarray(1),Y=i.slice(1).slice(0,J.length);for(const[n,f]of J.entries()){let t=!1;const e=Y[n],s=n+1,i=s*U,l=_.subarray(f,k+1),a=m.subarray(f).subarray(0,l.length),u=G.subarray(i+f-T).subarray(0,l.length),h=G.subarray(i+f-T-1-U).subarray(0,l.length),d=B.subarray(i+f-T).subarray(0,l.length),p=B.subarray(i+f-T-1-U).subarray(0,l.length),g=B.subarray(i+f-T-1).subarray(0,l.length);g[0]=0;for(const[n,b]of l.entries()){const i=n+f;let l=0,y=0,_=0;if(y=t?g[n]+-1:g[n]+-3,e===b){l=p[n]+P;let t=a[n];_=h[n]+1,8===t?_=1:_>1&&(t=o(t,o(4,m[i-_+1]))),l+t<y?(l+=a[n],_=0):l+=t}u[n]=_,t=l<y;const S=o(o(l,y),0);s===c-1&&(r&&S>w||!r&&S>=w)&&(w=S,C=i),d[n]=S}}const Z=S(l);let H=T;if(l&&null!==Z){let t=c-1;H=C;let e=!0;for(;;){const r=t*U,n=H-T,o=B[r+n];let s=0,i=0;if(t>0&&H>=y[t]&&(s=B[r-U+n-1]),H>y[t]&&(i=B[r+n-1]),o>s&&(o>i||o===i&&e)){if(Z.add(H),0===t)break;t--}e=G[r+n]>1||r+U+n+1<G.length&&G[r+U+n+1]>0,H--}}return[{start:H,end:C+1,score:w},Z]};function N(t,e,r,s,i,l,a){let c=0,u=0,p=!1,g=0,b=0;const m=S(a);let y=0;i>0&&(y=C(r[i-1]));for(let _=i;_<l;_++){let i=r[_];const l=C(i);if(t||(i>=h&&i<=d?i+=32:i>f&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=n(i)),i===s[c]){a&&null!==m&&m.add(_),u+=P;let t=O(y,l);0===g?b=t:(8===t&&(b=t),t=o(o(t,b),4)),u+=0===c?2*t:t,p=!1,g++,c++}else u+=p?-1:-3,p=!0,g=0,b=0;y=l}return[u,m]}const F=(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];if(j(o,s,t)<0)return[{start:-1,end:-1,score:0},null];let a=0,c=-1,u=-1;const p=o.length,g=s.length;for(let b=0;b<p;b++){let i=o[y(b,p,r)];t||(i>=h&&i<=d?i+=32:i>f&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=n(i));if(i===s[y(a,g,r)]&&(c<0&&(c=b),a++,a===g)){u=b+1;break}}if(c>=0&&u>=0){a--;for(let e=u-1;e>=c;e--){let n=o[y(e,p,r)];t||(n>=h&&n<=d?n+=32:n>f&&(n=String.fromCodePoint(n).toLowerCase().codePointAt(0)));if(n===s[y(a,g,r)]&&(a--,a<0)){c=e;break}}if(!r){const t=c;c=p-u,u=p-t}const[n,l]=N(t,e,o,s,c,u,i);return[{start:c,end:u,score:n},l]}return[{start:-1,end:-1,score:0},null]},I=(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];const a=o.length,c=s.length;if(a<c)return[{start:-1,end:-1,score:0},null];if(j(o,s,t)<0)return[{start:-1,end:-1,score:0},null];let u=0,p=-1,g=0,b=-1;for(let _=0;_<a;_++){const i=y(_,a,r);let l=o[i];t||(l>=h&&l<=d?l+=32:l>f&&(l=String.fromCodePoint(l).toLowerCase().codePointAt(0))),e&&(l=n(l));const w=y(u,c,r);if(s[w]===l){if(0===w&&(m=o,g=0===(P=i)?8:O(C(m[P-1]),C(m[P]))),u++,u===c){if(g>b&&(p=_,b=g),8===g)break;_-=u-1,u=0,g=0}}else _-=u,u=0,g=0}var m,P;if(p>=0){let n=0,i=0;r?(n=p-c+1,i=p+1):(n=a-(p+1),i=a-(p-c+1));const[l]=N(t,e,o,s,n,i,!1);return[{start:n,end:i,score:l},null]}return[{start:-1,end:-1,score:0},null]};const M=(R=2048,{i16:new Int16Array(102400),i32:new Int32Array(R)});var R,W,V;(V=W||(W={}))[V.Fuzzy=0]="Fuzzy",V[V.Exact=1]="Exact",V[V.Prefix=2]="Prefix",V[V.Suffix=3]="Suffix",V[V.Equal=4]="Equal";const q={0:E,1:I,2:(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];let u=0;if(a(s[0])||(u=c(o)),o.length-u<s.length)return[{start:-1,end:-1,score:0},null];for(const[a,c]of s.entries()){let r=o[u+a];if(t||(r=String.fromCodePoint(r).toLowerCase().codePointAt(0)),e&&(r=n(r)),r!==c)return[{start:-1,end:-1,score:0},null]}const f=s.length,[h]=N(t,e,o,s,u,u+f,!1);return[{start:u,end:u+f,score:h},null]},3:(t,e,r,o,s,i,l)=>{let c=o.length;if(0!==s.length&&a(s[s.length-1])||(c-=u(o)),0===s.length)return[{start:c,end:c,score:0},null];const f=c-s.length;if(f<0)return[{start:-1,end:-1,score:0},null];for(const[a,u]of s.entries()){let r=o[a+f];if(t||(r=String.fromCodePoint(r).toLowerCase().codePointAt(0)),e&&(r=n(r)),r!==u)return[{start:-1,end:-1,score:0},null]}const h=c-s.length,d=c,[p]=N(t,e,o,s,h,d,!1);return[{start:h,end:d,score:p},null]},4:(t,e,r,o,s,l,f)=>{const h=s.length;if(0===h)return[{start:-1,end:-1,score:0},null];let d=0;a(s[0])||(d=c(o));let p=0;if(a(s[h-1])||(p=u(o)),o.length-d-p!=h)return[{start:-1,end:-1,score:0},null];let g=!0;if(e){const e=o;for(const[r,o]of s.entries()){let s=e[d+r];if(t||(s=String.fromCodePoint(s).toLowerCase().codePointAt(0)),n(o)!==n(s)){g=!1;break}}}else{let e=i(o).substring(d,o.length-p);t||(e=e.toLowerCase()),g=e===i(s)}return g?[{start:d,end:d+h,score:24*h+8},null]:[{start:-1,end:-1,score:0},null]}};function D(t,e,r,o){let l=!0;{const t=(o=o.trimLeft()).trimRight();o=t.endsWith("\\")&&" "===o[t.length]?t+" ":t}let a=!1,c=[];c=function(t,e,r,o){const l=(o=o.replaceAll("\\ ","\t")).split(/ +/),a=[];let c=[],u=!1,f=!1;for(const h of l){let o=0,l=!1,d=h.replaceAll("\t"," ");const p=d.toLowerCase(),g="case-sensitive"===e||"smart-case"===e&&d!==p,b=r&&p===i(s(p).map(n));if(g||(d=p),t||(o=1),c.length>0&&!f&&"|"===d)u=!1,f=!0;else if(f=!1,d.startsWith("!")&&(l=!0,o=1,d=d.substring(1)),"$"!==d&&d.endsWith("$")&&(o=3,d=d.substring(0,d.length-1)),d.startsWith("'")?(o=t&&!l?1:0,d=d.substring(1)):d.startsWith("^")&&(o=3===o?4:2,d=d.substring(1)),d.length>0){u&&(a.push(c),c=[]);let t=s(d);b&&(t=t.map(n)),c.push({typ:o,inv:l,text:t,caseSensitive:g,normalize:b}),u=!0}}c.length>0&&a.push(c);return a}(t,e,r,o);t:for(const n of c)for(const[e,r]of n.entries())if(r.inv||(a=!0),(!l||e>0||r.inv||t&&0!==r.typ||!t&&1!==r.typ)&&(l=!1,a))break t;return{str:o,termSets:c,sortable:a,cacheable:l,fuzzy:t}}function T(t,e,r,n,o,s,i){for(const l of e){const[e,a]=t(r,n,o,l.text,s,!0,i);if(e.start>=0){const t=e.start+l.prefixLength,r=e.end+l.prefixLength;if(null!==a){const n=new Set;return a.forEach((t=>n.add(l.prefixLength+t))),[[t,r],e.score,n]}return[[t,r],e.score,a]}}return[[-1,-1],0,null]}function U(t,e,r,n){const o=[{text:t,prefixLength:0}],s=[];let i=0;const l=new Set;for(const a of e.termSets){let t=[0,0],e=0,c=!1;for(const s of a){let i=q[s.typ];s.typ===W.Fuzzy&&(i=r);const[a,u,f]=T(i,o,s.caseSensitive,s.normalize,n,s.text,M);if(a[0]>=0){if(s.inv)continue;if(t=a,e=u,c=!0,null!==f)f.forEach((t=>l.add(t)));else for(let t=a[0];t<a[1];++t)l.add(t);break}s.inv&&(t=[0,0],e=0,c=!0)}c&&(s.push(t),i+=e)}return{offsets:s,totalScore:i,allPos:l}}function B(t){const{queryRunes:e,caseSensitive:r}=((t,e,r)=>{let o=!1;switch(e){case"smart-case":t.toLowerCase()!==t&&(o=!0);break;case"case-sensitive":o=!0;break;case"case-insensitive":t=t.toLowerCase(),o=!1}let i=s(t);return r&&(i=i.map(n)),{queryRunes:i,caseSensitive:o}})(t,this.opts.casing,this.opts.normalize),o={};for(let n=0,s=this.runesList.length;n<s;++n){const t=this.runesList[n];if(e.length>t.length)continue;let[s,i]=this.algoFn(r,this.opts.normalize,this.opts.forward,t,e,!0,M);if(-1===s.start)continue;if(!1===this.opts.fuzzy){i=new Set;for(let t=s.start;t<s.end;++t)i.add(t)}const l=this.opts.sort?s.score:0;void 0===o[l]&&(o[l]=[]),o[l].push(__spreadProps(__spreadValues({item:this.items[n]},s),{positions:null!=i?i:new Set}))}return G(o,this.opts.limit)}function G(t,e){const r=Object.keys(t).map((t=>parseInt(t,10))).sort(((t,e)=>e-t)),n=[];for(const o of r)if(n.push(...t[o]),n.length>=e)break;return n}const J={limit:1/0,selector:t=>t,casing:"smart-case",normalize:!0,fuzzy:"v2",match:B,tiebreakers:[],sort:!0,forward:!0};class Y{constructor(t,...e){switch(this.opts=__spreadValues(__spreadValues({},J),e[0]),this.items=t,this.runesList=t.map((t=>s(this.opts.selector(t).normalize()))),this.algoFn=I,this.opts.fuzzy){case"v2":this.algoFn=E;break;case"v1":this.algoFn=F}}find(t){t=t.normalize();let e=[];if(e=this.opts.match.bind(this)(t),this.opts.sort)for(const r of this.opts.tiebreakers)e.sort(((t,e)=>t.score===e.score?r(t,e,this.opts):0));return Number.isFinite(this.opts.limit)&&e.splice(this.opts.limit),e}}t.Fzf=class{constructor(t,...e){this.finder=new Y(t,...e),this.find=this.finder.find.bind(this.finder)}},t.basicMatch=B,t.byLengthAsc=function(t,e,r){return r.selector(t.item).length-r.selector(e.item).length},t.byStartAsc=function(t,e){return t.start-e.start},t.extendedMatch=function(t){const e=D(Boolean(this.opts.fuzzy),this.opts.casing,this.opts.normalize,t),r={};for(const[n,o]of this.runesList.entries()){const t=U(o,e,this.algoFn,this.opts.forward);if(t.offsets.length!==e.termSets.length)continue;let s=-1,i=-1;t.allPos.size>0&&(s=Math.min(...t.allPos),i=Math.max(...t.allPos)+1);const l=this.opts.sort?t.totalScore:0;void 0===r[l]&&(r[l]=[]),r[l].push({score:t.totalScore,item:this.items[n],positions:t.allPos,start:s,end:i})}return G(r,this.opts.limit)},Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"}));
/** @license
* fzf v0.4.1
* Copyright (c) 2021 Ajit
* Licensed under BSD 3-Clause
*/
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,r)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,__spreadValues=(t,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(t,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(t,r,e[r]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).fzf={})}(this,(function(t){"use strict";const e={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let Z="̀".codePointAt(0);Z<="ͯ".codePointAt(0);++Z){const t=String.fromCodePoint(Z);for(const r of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const n=(r+t).normalize().codePointAt(0);n>126&&(e[n]=r)}}const r={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const Z of Object.keys(r)){const t=Z.toUpperCase();for(let n=r[Z][0];n<=r[Z][1];++n)e[n]=n%2==0?t:Z}function n(t){if(t<192||t>8580)return t;const r=e[t];return void 0!==r?r.codePointAt(0):t}function o(t,e){return t>e?t:e}const s=t=>t.split("").map((t=>t.codePointAt(0))),i=t=>t.map((t=>String.fromCodePoint(t))).join(""),l=new Set(" \f\n\r\t\v  \u2028\u2029   \ufeff".split("").map((t=>t.codePointAt(0))));for(let Z=" ".codePointAt(0);Z<=" ".codePointAt(0);Z++)l.add(Z);const a=t=>l.has(t),c=t=>{let e=0;for(const r of t){if(!a(r))break;e++}return e},u=t=>{let e=0;for(let r=t.length-1;r>=0&&a(t[r]);r--)e++;return e},f="".codePointAt(0),h="A".codePointAt(0),d="Z".codePointAt(0),p="a".codePointAt(0),g="z".codePointAt(0),b="0".codePointAt(0),m="9".codePointAt(0);function y(t,e,r){return r?t:e-t-1}const P=16;var _,w;function S(t){return t?new Set:null}function z(t,e,r){if(null!==e&&e.i16.length>t+r){return[t+r,e.i16.subarray(t,t+r)]}return[t,new Int16Array(r)]}function A(t,e,r){if(null!==e&&e.i32.length>t+r){return[t+r,e.i32.subarray(t,t+r)]}return[t,new Int32Array(r)]}function v(t){return t>=p&&t<=g?1:t>=h&&t<=d?2:t>=b&&t<=m?4:0}function L(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:null!==e.match(/\p{Number}/gu)?4:null!==e.match(/\p{Letter}/gu)?3:0}function C(t){return t<=f?v(t):L(t)}function O(t,e){return 0===t&&0!==e?8:1===t&&2===e||4!==t&&4===e?7:0===e?8:0}function x(t,e,r,n){let o=t.slice(n),s=o.indexOf(r);if(0===s)return n;if(!e&&r>=p&&r<=g){s>0&&(o=o.slice(0,s));const t=o.indexOf(r-32);t>=0&&(s=t)}return s<0?-1:n+s}function k(t){for(const e of t)if(e>=128)return!1;return!0}function j(t,e,r){if(!k(t))return 0;if(!k(e))return-1;let n=0,o=0;for(let s=0;s<e.length;s++){if(o=x(t,r,e[s],o),o<0)return-1;0===s&&o>0&&(n=o-1),o++}return n}(w=_||(_={}))[w.NonWord=0]="NonWord",w[w.Lower=1]="Lower",w[w.Upper=2]="Upper",w[w.Letter=3]="Letter",w[w.Number=4]="Number";const E=(t,e,r,s,i,l,a)=>{const c=i.length;if(0===c)return[{start:0,end:0,score:0},S(l)];const u=s.length;if(null!==a&&u*c>a.i16.length)return F(t,e,r,s,i,l);const h=j(s,i,t);if(h<0)return[{start:-1,end:-1,score:0},null];let d=0,p=0,g=null,b=null,m=null,y=null;[d,g]=z(d,a,u),[d,b]=z(d,a,u),[d,m]=z(d,a,u),[p,y]=A(p,a,c);const[,_]=A(p,a,u);for(let n=0;n<_.length;n++)_[n]=s[n];let w=0,C=0,x=0,k=0;const E=i[0];let N=i[0],I=0,M=0,R=!1,W=_.subarray(h),V=g.subarray(h).subarray(0,W.length),q=b.subarray(h).subarray(0,W.length),D=m.subarray(h).subarray(0,W.length);for(let[S,z]of W.entries()){let s=null;z<=f?(s=v(z),t||2!==s||(z+=32)):(s=L(z),t||2!==s||(z=String.fromCodePoint(z).toLowerCase().codePointAt(0)),e&&(z=n(z))),W[S]=z;const l=O(M,s);if(D[S]=l,M=s,z===N&&(x<c&&(y[x]=h+S,x++,N=i[Math.min(x,c-1)]),k=h+S),z===E){const t=P+2*l;if(V[S]=t,q[S]=1,1===c&&(r&&t>w||!r&&t>=w)&&(w=t,C=h+S,r&&8===l))break;R=!1}else V[S]=o(R?I+-1:I+-3,0),q[S]=0,R=!0;I=V[S]}if(x!==c)return[{start:-1,end:-1,score:0},null];if(1===c){const t={start:C,end:C+1,score:w};if(!l)return[t,null];const e=new Set;return e.add(C),[t,e]}const T=y[0],U=k-T+1;let B=null;[d,B]=z(d,a,U*c);{const t=g.subarray(T,k+1);for(const[e,r]of t.entries())B[e]=r}let[,G]=z(d,a,U*c);{const t=b.subarray(T,k+1);for(const[e,r]of t.entries())G[e]=r}const J=y.subarray(1),Y=i.slice(1).slice(0,J.length);for(const[n,f]of J.entries()){let t=!1;const e=Y[n],s=n+1,i=s*U,l=_.subarray(f,k+1),a=m.subarray(f).subarray(0,l.length),u=G.subarray(i+f-T).subarray(0,l.length),h=G.subarray(i+f-T-1-U).subarray(0,l.length),d=B.subarray(i+f-T).subarray(0,l.length),p=B.subarray(i+f-T-1-U).subarray(0,l.length),g=B.subarray(i+f-T-1).subarray(0,l.length);g[0]=0;for(const[n,b]of l.entries()){const i=n+f;let l=0,y=0,_=0;if(y=t?g[n]+-1:g[n]+-3,e===b){l=p[n]+P;let t=a[n];_=h[n]+1,8===t?_=1:_>1&&(t=o(t,o(4,m[i-_+1]))),l+t<y?(l+=a[n],_=0):l+=t}u[n]=_,t=l<y;const S=o(o(l,y),0);s===c-1&&(r&&S>w||!r&&S>=w)&&(w=S,C=i),d[n]=S}}const Z=S(l);let H=T;if(l&&null!==Z){let t=c-1;H=C;let e=!0;for(;;){const r=t*U,n=H-T,o=B[r+n];let s=0,i=0;if(t>0&&H>=y[t]&&(s=B[r-U+n-1]),H>y[t]&&(i=B[r+n-1]),o>s&&(o>i||o===i&&e)){if(Z.add(H),0===t)break;t--}e=G[r+n]>1||r+U+n+1<G.length&&G[r+U+n+1]>0,H--}}return[{start:H,end:C+1,score:w},Z]};function N(t,e,r,s,i,l,a){let c=0,u=0,p=!1,g=0,b=0;const m=S(a);let y=0;i>0&&(y=C(r[i-1]));for(let _=i;_<l;_++){let i=r[_];const l=C(i);if(t||(i>=h&&i<=d?i+=32:i>f&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=n(i)),i===s[c]){a&&null!==m&&m.add(_),u+=P;let t=O(y,l);0===g?b=t:(8===t&&(b=t),t=o(o(t,b),4)),u+=0===c?2*t:t,p=!1,g++,c++}else u+=p?-1:-3,p=!0,g=0,b=0;y=l}return[u,m]}const F=(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];if(j(o,s,t)<0)return[{start:-1,end:-1,score:0},null];let a=0,c=-1,u=-1;const p=o.length,g=s.length;for(let b=0;b<p;b++){let i=o[y(b,p,r)];t||(i>=h&&i<=d?i+=32:i>f&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=n(i));if(i===s[y(a,g,r)]&&(c<0&&(c=b),a++,a===g)){u=b+1;break}}if(c>=0&&u>=0){a--;for(let e=u-1;e>=c;e--){let n=o[y(e,p,r)];t||(n>=h&&n<=d?n+=32:n>f&&(n=String.fromCodePoint(n).toLowerCase().codePointAt(0)));if(n===s[y(a,g,r)]&&(a--,a<0)){c=e;break}}if(!r){const t=c;c=p-u,u=p-t}const[n,l]=N(t,e,o,s,c,u,i);return[{start:c,end:u,score:n},l]}return[{start:-1,end:-1,score:0},null]},I=(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];const a=o.length,c=s.length;if(a<c)return[{start:-1,end:-1,score:0},null];if(j(o,s,t)<0)return[{start:-1,end:-1,score:0},null];let u=0,p=-1,g=0,b=-1;for(let _=0;_<a;_++){const i=y(_,a,r);let l=o[i];t||(l>=h&&l<=d?l+=32:l>f&&(l=String.fromCodePoint(l).toLowerCase().codePointAt(0))),e&&(l=n(l));const w=y(u,c,r);if(s[w]===l){if(0===w&&(m=o,g=0===(P=i)?8:O(C(m[P-1]),C(m[P]))),u++,u===c){if(g>b&&(p=_,b=g),8===g)break;_-=u-1,u=0,g=0}}else _-=u,u=0,g=0}var m,P;if(p>=0){let n=0,i=0;r?(n=p-c+1,i=p+1):(n=a-(p+1),i=a-(p-c+1));const[l]=N(t,e,o,s,n,i,!1);return[{start:n,end:i,score:l},null]}return[{start:-1,end:-1,score:0},null]};const M=(R=2048,{i16:new Int16Array(102400),i32:new Int32Array(R)});var R,W,V;(V=W||(W={}))[V.Fuzzy=0]="Fuzzy",V[V.Exact=1]="Exact",V[V.Prefix=2]="Prefix",V[V.Suffix=3]="Suffix",V[V.Equal=4]="Equal";const q={0:E,1:I,2:(t,e,r,o,s,i,l)=>{if(0===s.length)return[{start:0,end:0,score:0},null];let u=0;if(a(s[0])||(u=c(o)),o.length-u<s.length)return[{start:-1,end:-1,score:0},null];for(const[a,c]of s.entries()){let r=o[u+a];if(t||(r=String.fromCodePoint(r).toLowerCase().codePointAt(0)),e&&(r=n(r)),r!==c)return[{start:-1,end:-1,score:0},null]}const f=s.length,[h]=N(t,e,o,s,u,u+f,!1);return[{start:u,end:u+f,score:h},null]},3:(t,e,r,o,s,i,l)=>{let c=o.length;if(0!==s.length&&a(s[s.length-1])||(c-=u(o)),0===s.length)return[{start:c,end:c,score:0},null];const f=c-s.length;if(f<0)return[{start:-1,end:-1,score:0},null];for(const[a,u]of s.entries()){let r=o[a+f];if(t||(r=String.fromCodePoint(r).toLowerCase().codePointAt(0)),e&&(r=n(r)),r!==u)return[{start:-1,end:-1,score:0},null]}const h=c-s.length,d=c,[p]=N(t,e,o,s,h,d,!1);return[{start:h,end:d,score:p},null]},4:(t,e,r,o,s,l,f)=>{const h=s.length;if(0===h)return[{start:-1,end:-1,score:0},null];let d=0;a(s[0])||(d=c(o));let p=0;if(a(s[h-1])||(p=u(o)),o.length-d-p!=h)return[{start:-1,end:-1,score:0},null];let g=!0;if(e){const e=o;for(const[r,o]of s.entries()){let s=e[d+r];if(t||(s=String.fromCodePoint(s).toLowerCase().codePointAt(0)),n(o)!==n(s)){g=!1;break}}}else{let e=i(o).substring(d,o.length-p);t||(e=e.toLowerCase()),g=e===i(s)}return g?[{start:d,end:d+h,score:24*h+8},null]:[{start:-1,end:-1,score:0},null]}};function D(t,e,r,o){let l=!0;{const t=(o=o.trimLeft()).trimRight();o=t.endsWith("\\")&&" "===o[t.length]?t+" ":t}let a=!1,c=[];c=function(t,e,r,o){const l=(o=o.replace(/\\ /g,"\t")).split(/ +/),a=[];let c=[],u=!1,f=!1;for(const h of l){let o=0,l=!1,d=h.replace(/\t/g," ");const p=d.toLowerCase(),g="case-sensitive"===e||"smart-case"===e&&d!==p,b=r&&p===i(s(p).map(n));if(g||(d=p),t||(o=1),c.length>0&&!f&&"|"===d)u=!1,f=!0;else if(f=!1,d.startsWith("!")&&(l=!0,o=1,d=d.substring(1)),"$"!==d&&d.endsWith("$")&&(o=3,d=d.substring(0,d.length-1)),d.startsWith("'")?(o=t&&!l?1:0,d=d.substring(1)):d.startsWith("^")&&(o=3===o?4:2,d=d.substring(1)),d.length>0){u&&(a.push(c),c=[]);let t=s(d);b&&(t=t.map(n)),c.push({typ:o,inv:l,text:t,caseSensitive:g,normalize:b}),u=!0}}c.length>0&&a.push(c);return a}(t,e,r,o);t:for(const n of c)for(const[e,r]of n.entries())if(r.inv||(a=!0),(!l||e>0||r.inv||t&&0!==r.typ||!t&&1!==r.typ)&&(l=!1,a))break t;return{str:o,termSets:c,sortable:a,cacheable:l,fuzzy:t}}function T(t,e,r,n,o,s,i){for(const l of e){const[e,a]=t(r,n,o,l.text,s,!0,i);if(e.start>=0){const t=e.start+l.prefixLength,r=e.end+l.prefixLength;if(null!==a){const n=new Set;return a.forEach((t=>n.add(l.prefixLength+t))),[[t,r],e.score,n]}return[[t,r],e.score,a]}}return[[-1,-1],0,null]}function U(t,e,r,n){const o=[{text:t,prefixLength:0}],s=[];let i=0;const l=new Set;for(const a of e.termSets){let t=[0,0],e=0,c=!1;for(const s of a){let i=q[s.typ];s.typ===W.Fuzzy&&(i=r);const[a,u,f]=T(i,o,s.caseSensitive,s.normalize,n,s.text,M);if(a[0]>=0){if(s.inv)continue;if(t=a,e=u,c=!0,null!==f)f.forEach((t=>l.add(t)));else for(let t=a[0];t<a[1];++t)l.add(t);break}s.inv&&(t=[0,0],e=0,c=!0)}c&&(s.push(t),i+=e)}return{offsets:s,totalScore:i,allPos:l}}function B(t){const{queryRunes:e,caseSensitive:r}=((t,e,r)=>{let o=!1;switch(e){case"smart-case":t.toLowerCase()!==t&&(o=!0);break;case"case-sensitive":o=!0;break;case"case-insensitive":t=t.toLowerCase(),o=!1}let i=s(t);return r&&(i=i.map(n)),{queryRunes:i,caseSensitive:o}})(t,this.opts.casing,this.opts.normalize),o={};for(let n=0,s=this.runesList.length;n<s;++n){const t=this.runesList[n];if(e.length>t.length)continue;let[s,i]=this.algoFn(r,this.opts.normalize,this.opts.forward,t,e,!0,M);if(-1===s.start)continue;if(!1===this.opts.fuzzy){i=new Set;for(let t=s.start;t<s.end;++t)i.add(t)}const l=this.opts.sort?s.score:0;void 0===o[l]&&(o[l]=[]),o[l].push(__spreadProps(__spreadValues({item:this.items[n]},s),{positions:null!=i?i:new Set}))}return G(o,this.opts.limit)}function G(t,e){const r=Object.keys(t).map((t=>parseInt(t,10))).sort(((t,e)=>e-t)),n=[];for(const o of r)if(n.push(...t[o]),n.length>=e)break;return n}const J={limit:1/0,selector:t=>t,casing:"smart-case",normalize:!0,fuzzy:"v2",match:B,tiebreakers:[],sort:!0,forward:!0};class Y{constructor(t,...e){switch(this.opts=__spreadValues(__spreadValues({},J),e[0]),this.items=t,this.runesList=t.map((t=>s(this.opts.selector(t).normalize()))),this.algoFn=I,this.opts.fuzzy){case"v2":this.algoFn=E;break;case"v1":this.algoFn=F}}find(t){t=t.normalize();let e=this.opts.match.bind(this)(t);if(this.opts.sort)for(const r of this.opts.tiebreakers)e.sort(((t,e)=>t.score===e.score?r(t,e,this.opts):0));return Number.isFinite(this.opts.limit)&&e.splice(this.opts.limit),e}}t.Fzf=class{constructor(t,...e){this.finder=new Y(t,...e),this.find=this.finder.find.bind(this.finder)}},t.basicMatch=B,t.byLengthAsc=function(t,e,r){return r.selector(t.item).length-r.selector(e.item).length},t.byStartAsc=function(t,e){return t.start-e.start},t.extendedMatch=function(t){const e=D(Boolean(this.opts.fuzzy),this.opts.casing,this.opts.normalize,t),r={};for(const[n,o]of this.runesList.entries()){const t=U(o,e,this.algoFn,this.opts.forward);if(t.offsets.length!==e.termSets.length)continue;let s=-1,i=-1;t.allPos.size>0&&(s=Math.min(...t.allPos),i=Math.max(...t.allPos)+1);const l=this.opts.sort?t.totalScore:0;void 0===r[l]&&(r[l]=[]),r[l].push({score:t.totalScore,item:this.items[n],positions:t.allPos,start:s,end:i})}return G(r,this.opts.limit)},Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"}));

14

package.json
{
"===== INFO =====": "",
"name": "fzf",
"version": "0.4.0-alpha.0",
"version": "0.4.1",
"description": "Do fuzzy matching using FZF algorithm in JavaScript",

@@ -18,3 +18,3 @@ "license": "BSD-3-Clause",

"author": {
"name": "ajit",
"name": "Ajit",
"email": "zlksnkwork+pkgnfo@gmail.com",

@@ -25,10 +25,11 @@ "url": "https://ajitid.in"

"scripts": {
"prepack": "node scripts/prepack.cjs",
"postpack": "node scripts/postpack.cjs",
"dev": "vite -c vite-for-docs.config.ts",
"build": "npm run build:modules && npm run build:types",
"postbuild": "node scripts/postbuild.js",
"build:modules": "tsc && vite build && vite build -c vite-legacy.config.ts",
"build:types": "tsc -p tsconfig-to-build-types.json --outDir dist",
"build:types": "tsc -p tsconfig-to-build-types.json --outDir dist/types",
"build:only-docs": "tsc && vite build -c vite-for-docs.config.ts",
"build:docs": "npm run fill-with-old-docs && npm run build:only-docs",
"prepack": "node scripts/prepack.cjs",
"postpack": "node scripts/postpack.cjs",
"test": "jest",

@@ -51,3 +52,3 @@ "test:watch": "jest --watch -o",

},
"types": "./dist/main.d.ts",
"types": "./dist/types/main.d.ts",
"===== HINTING =====": "",

@@ -82,3 +83,2 @@ "sideEffects": false,

"shelljs": "^0.8.4",
"string.prototype.replaceall": "^1.0.5",
"tailwindcss": "^2.2.4",

@@ -85,0 +85,0 @@ "ts-jest": "^27.0.3",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc