site-panzai/node_modules/fzf/dist/fzf.umd.js

8 lines
15 KiB
JavaScript
Raw Permalink Normal View History

2026-11-13 13:57:04 +01:00
/** @license
* fzf v0.5.2
* Copyright (c) 2021 Ajit
* Licensed under BSD 3-Clause
*/
(function(C,z){typeof exports=="object"&&typeof module!="undefined"?z(exports):typeof define=="function"&&define.amd?define(["exports"],z):(C=typeof globalThis!="undefined"?globalThis:C||self,z(C.fzf={}))})(this,function(C){"use strict";const z={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 t="\u0300".codePointAt(0);t<="\u036F".codePointAt(0);++t){const e=String.fromCodePoint(t);for(const s of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const n=(s+e).normalize().codePointAt(0);n>126&&(z[n]=s)}}const rt={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const t of Object.keys(rt)){const e=t.toUpperCase();for(let s=rt[t][0];s<=rt[t][1];++s)z[s]=s%2===0?e:t}function E(t){if(t<192||t>8580)return t;const e=z[t];return e!==void 0?e.codePointAt(0):t}function Re(t){return t}function Ne(t){return t}function _(t,e){return t>e?t:e}const $=t=>t.split("").map(e=>e.codePointAt(0)),ot=t=>t.map(e=>String.fromCodePoint(e)).join(""),bt=new Set(` \f
\r \v\xA0\u1680\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("").map(t=>t.codePointAt(0)));for(let t="\u2000".codePointAt(0);t<="\u200A".codePointAt(0);t++)bt.add(t);const B=t=>bt.has(t),pt=t=>{let e=0;for(const s of t)if(B(s))e++;else break;return e},At=t=>{let e=0;for(let s=t.length-1;s>=0&&B(t[s]);s--)e++;return e},v="\x7F".codePointAt(0),W="A".codePointAt(0),G="Z".codePointAt(0),Pt="a".codePointAt(0),yt="z".codePointAt(0),Kt="0".codePointAt(0),Yt="9".codePointAt(0);function U(t,e,s){return s?t:e-t-1}const j=16,q=-3,Z=-1,R=j/2,Jt=j/2,Xt=R+Z,St=-(q+Z),ct=2;function lt(t){return t?new Set:null}function V(t,e,s){if(e!==null&&e.i16.length>t+s){const i=e.i16.subarray(t,t+s);return[t+s,i]}return[t,new Int16Array(s)]}function Ct(t,e,s){if(e!==null&&e.i32.length>t+s){const i=e.i32.subarray(t,t+s);return[t+s,i]}return[t,new Int32Array(s)]}function Lt(t){return t>=Pt&&t<=yt?1:t>=W&&t<=G?2:t>=Kt&&t<=Yt?4:0}function Et(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:e.match(/\p{Number}/gu)!==null?4:e.match(/\p{Letter}/gu)!==null?3:0}function tt(t){return t<=v?Lt(t):Et(t)}function ft(t,e){return t===0&&e!==0?R:t===1&&e===2||t!==4&&e===4?Xt:e===0?Jt:0}function Qt(t,e){return e===0?R:ft(tt(t[e-1]),tt(t[e]))}function $t(t,e,s,i){let n=t.slice(i),l=n.indexOf(s);if(l===0)return i;if(!e&&s>=Pt&&s<=yt){l>0&&(n=n.slice(0,l));const u=n.indexOf(s-32);u>=0&&(l=u)}return l<0?-1:i+l}function xt(t){for(const e of t)if(e>=128)return!1;return!0}function ut(t,e,s){if(!xt(t))return 0;if(!xt(e))return-1;let i=0,n=0;for(let l=0;l<e.length;l++){if(n=$t(t,s,e[l],n),n<0)return-1;l===0&&n>0&&(i=n-1),n++}return i}const wt=(t,e,s,i,n,l,u)=>{const r=n.length;if(r===0)return[{start:0,end:0,score:0},lt(l)];const o=i.length;if(u!==null&&o*r>u.i16.length)return Mt(t,e,s,i,n,l);const f=ut(i,n,t);if(f<0)return[{start:-1,end:-1,score:0},null];let a=0,d=0,c=null,h=null,g=null,m=null;[a,c]=V(a,u,o),[a,h]=V(a,u,o),[a,g]=V(a,u,o),[d,m]=Ct(d,u,r);const[,p]=Ct(d,u,o);for(let b=0;b<p.length;b++)p[b]=i[b];let P=0,S=0,K=0,Y=0;const ye=n[0];let Ht=n[0],ht=0,Tt=0,dt=!1,J=p.subarray(f),st=c.subarray(f).subarray(0,J.length),Wt=h.subarray(f).subarray(0,J.length),Se=g.subarray(f).subarray(0,J.length);for(let[b,A]of J.entries()){let y=null;A<=v?(y=Lt(A),!t&&y===2&&(A+=32)):(y=Et(A),!t&&y===2&&(A=String.fromCodePoint(A).toLowerCase().codePointAt(0)),e&&(A=E(A))),J[b]=A;const L=ft(Tt,y);if(Se[b]=L,Tt=y,A===Ht&&(K<r&&(m[K]=f+b,K++,Ht=n[Math.min(K,r-1)]),Y=f+b),A===ye){const x=j+L*ct;if(st[b]=x,Wt[b]=1,r===1&&(s&&x>P||!s&&x>=P)&&(P=x,S=f+b,s&&L===R))break;dt=!1}else dt?st[b]=_(ht+Z,0):st[b]=_(ht+q,0),Wt[b]=0,dt=!0;ht=st[b]}if(K!==r)return[{start:-1,end:-1,score:0},null];if(r===1){const b={start:S,end:S+1,score:P};if(!l)return[b,null];const A=new Set;return A.add(S),[b,A]}const M=m[0],N=Y-M+1;let k=null;[a,k]=V(a,u,N*r);{const b=c.subarray(M,Y+1);for(const[A,y]of b.entries())k[A]=y}let[,D]=V(a,u,N*r);{const b=h.subarray(M,Y+1);for(const[A,y]of b.entries())D[A]=y}const Gt=m.subarray(1),Ce=n.slice(1).slice(0,Gt.length);for(const[b,A]of Gt.entries()){let y=!1;const L=Ce[b],x=b+1,F=x*N,w=p.subarray(A,Y+1),Zt=g.subarray(A).subarray(0,w.length),Le=D.subarray(F+A-M).subarray(0,w.length),Ee=D.subarray(F+A-M-1-N).subarray(0,w.length),xe=k.subarray(F+A-M).subarray(0,w.length),we=k.subarray(F+A-M-1-N).subarray(0,w.length),mt=k.subarray(F+A-M-1).subarray(0,w.length);mt[0]=0;for(const[I,Me]of w.entries()){const Vt=I+A;let H=0,X=0,T=0;if(y?X=mt[I]+Z:X=mt[I]+q,L===Me){H=we[I]+j;let Q=Zt[I];T=Ee[I]+1,Q===R?T=1:T>1&&(Q=_(Q,_(St,g[Vt-T+1]))),H+Q<X?(H+=Zt[I],T=0):H+=Q}Le[I]=T,y=H<X;const it=_(_(H,X),0);x===r-1&&(s&&it>P||!s&&it>=P)&&(P=it,S=Vt),xe[I]=it}}const gt=lt(l);let O=M;if(l&&gt!==null){let b=r-1;O=S;let A=!0;for(;;){const y=b*N,L=O-M,x=k[y+L];let F=0,w=0;if(b>0&&O>=m[b]&&(F=k[y-N+L-1]),O>m[b]&&(w=k[y+L-1]),x>F&&(x>w||x===w&&A)){if(gt.add(O),b===0)break;b--}A=D[y+L]>1||y+N+L+1<D.length&&D[y+N+L+1]>0,O--}}return[{start:O,end:S+1,score:P},gt]};function et(t,e,s,i,n,l,u){let r=0,o=0,f=!1,a=0,d=0;const c=lt(u);let h=0;n>0&&(h=tt(s[n-1]));for(let g=n;g<l;g++){let m