minipp
Version:
Quickly help you find files that are not being used in your project, and slim down your project.
4 lines • 122 kB
JavaScript
#!/usr/bin/env node
import Vt,{realpathSync as Ne,readlinkSync as Me,readdirSync as Oe,readdir as Fe,lstatSync as Re}from"fs";import U from"path";import{g as Be,h as At,p as Le,l as We,s as _e,a as je,b as Si,c as bi,B as $e,m as Ei}from"../../shared/minipp.09TTL1N7.mjs";import{fileURLToPath as xi}from"node:url";import{win32 as Ht,posix as ze}from"node:path";import*as Je from"node:fs";import{realpath as Ue,readlink as Xe,readdir as Ge,lstat as qe}from"node:fs/promises";import{EventEmitter as Kt}from"node:events";import Ti from"node:stream";import{StringDecoder as Ve}from"node:string_decoder";import _ from"node:process";import{stripVTControlCharacters as He}from"node:util";import Ke from"node:tty";import{styleText as pt}from"util";import{parse as Ye}from"@swc/core";import{createInterface as Qe}from"readline/promises";import{stdout as Ze,stdin as ts}from"process";import"url";var Yt,Ai;function is(){if(Ai)return Yt;Ai=1,Yt=n;function n(e,s,r){e instanceof RegExp&&(e=t(e,r)),s instanceof RegExp&&(s=t(s,r));var o=i(e,s,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+e.length,o[1]),post:r.slice(o[1]+s.length)}}function t(e,s){var r=s.match(e);return r?r[0]:null}n.range=i;function i(e,s,r){var o,a,h,l,u,c=r.indexOf(e),f=r.indexOf(s,c+1),p=c;if(c>=0&&f>0){if(e===s)return[c,f];for(o=[],h=r.length;p>=0&&!u;)p==c?(o.push(p),c=r.indexOf(e,p+1)):o.length==1?u=[o.pop(),f]:(a=o.pop(),a<h&&(h=a,l=f),f=r.indexOf(s,p+1)),p=c<f&&c>=0?c:f;o.length&&(u=[h,l])}return u}return Yt}var Qt,Ci;function es(){if(Ci)return Qt;Ci=1;var n=is();Qt=u;var t="\0SLASH"+Math.random()+"\0",i="\0OPEN"+Math.random()+"\0",e="\0CLOSE"+Math.random()+"\0",s="\0COMMA"+Math.random()+"\0",r="\0PERIOD"+Math.random()+"\0";function o(m){return parseInt(m,10)==m?parseInt(m,10):m.charCodeAt(0)}function a(m){return m.split("\\\\").join(t).split("\\{").join(i).split("\\}").join(e).split("\\,").join(s).split("\\.").join(r)}function h(m){return m.split(t).join("\\").split(i).join("{").split(e).join("}").split(s).join(",").split(r).join(".")}function l(m){if(!m)return[""];var g=[],S=n("{","}",m);if(!S)return m.split(",");var y=S.pre,b=S.body,E=S.post,x=y.split(",");x[x.length-1]+="{"+b+"}";var F=l(E);return E.length&&(x[x.length-1]+=F.shift(),x.push.apply(x,F)),g.push.apply(g,x),g}function u(m){return m?(m.substr(0,2)==="{}"&&(m="\\{\\}"+m.substr(2)),d(a(m),!0).map(h)):[]}function c(m){return"{"+m+"}"}function f(m){return/^-?0\d/.test(m)}function p(m,g){return m<=g}function v(m,g){return m>=g}function d(m,g){var S=[],y=n("{","}",m);if(!y)return[m];var b=y.pre,E=y.post.length?d(y.post,!1):[""];if(/\$$/.test(y.pre))for(var x=0;x<E.length;x++){var F=b+"{"+y.body+"}"+E[x];S.push(F)}else{var ot=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(y.body),q=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(y.body),K=ot||q,Ce=y.body.indexOf(",")>=0;if(!K&&!Ce)return y.post.match(/,.*\}/)?(m=y.pre+"{"+y.body+e+y.post,d(m)):[m];var D;if(K)D=y.body.split(/\.\./);else if(D=l(y.body),D.length===1&&(D=d(D[0],!1).map(c),D.length===1))return E.map(function(ke){return y.pre+D[0]+ke});var it;if(K){var di=o(D[0]),mi=o(D[1]),Pe=Math.max(D[0].length,D[1].length),gi=D.length==3?Math.abs(o(D[2])):1,vi=p,De=mi<di;De&&(gi*=-1,vi=v);var Ie=D.some(f);it=[];for(var ft=di;vi(ft,mi);ft+=gi){var J;if(q)J=String.fromCharCode(ft),J==="\\"&&(J="");else if(J=String(ft),Ie){var yi=Pe-J.length;if(yi>0){var wi=new Array(yi+1).join("0");ft<0?J="-"+wi+J.slice(1):J=wi+J}}it.push(J)}}else{it=[];for(var et=0;et<D.length;et++)it.push.apply(it,d(D[et],!1))}for(var et=0;et<it.length;et++)for(var x=0;x<E.length;x++){var F=b+it[et]+E[x];(!g||K||F)&&S.push(F)}}return S}return Qt}var ss=es();const rs=Be(ss),ns=1024*64,Ct=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>ns)throw new TypeError("pattern is too long")},os={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},dt=n=>n.replace(/[[\]\\-]/g,"\\$&"),as=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Pi=n=>n.join(""),hs=(n,t)=>{const i=t;if(n.charAt(i)!=="[")throw new Error("not in a brace expression");const e=[],s=[];let r=i+1,o=!1,a=!1,h=!1,l=!1,u=i,c="";t:for(;r<n.length;){const d=n.charAt(r);if((d==="!"||d==="^")&&r===i+1){l=!0,r++;continue}if(d==="]"&&o&&!h){u=r+1;break}if(o=!0,d==="\\"&&!h){h=!0,r++;continue}if(d==="["&&!h){for(const[m,[g,S,y]]of Object.entries(os))if(n.startsWith(m,r)){if(c)return["$.",!1,n.length-i,!0];r+=m.length,y?s.push(g):e.push(g),a=a||S;continue t}}if(h=!1,c){d>c?e.push(dt(c)+"-"+dt(d)):d===c&&e.push(dt(d)),c="",r++;continue}if(n.startsWith("-]",r+1)){e.push(dt(d+"-")),r+=2;continue}if(n.startsWith("-",r+1)){c=d,r+=2;continue}e.push(dt(d)),r++}if(u<r)return["",!1,0,!1];if(!e.length&&!s.length)return["$.",!1,n.length-i,!0];if(s.length===0&&e.length===1&&/^\\?.$/.test(e[0])&&!l){const d=e[0].length===2?e[0].slice(-1):e[0];return[as(d),!1,u-i,!1]}const f="["+(l?"^":"")+Pi(e)+"]",p="["+(l?"":"^")+Pi(s)+"]";return[e.length&&s.length?"("+f+"|"+p+")":e.length?f:p,a,u-i,!0]},at=(n,{windowsPathsNoEscape:t=!1}={})=>t?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),ls=new Set(["!","?","+","*","@"]),Di=n=>ls.has(n),cs="(?!(?:^|/)\\.\\.?(?:$|/))",Zt="(?!\\.)",us=new Set(["[","."]),fs=new Set(["..","."]),ps=new Set("().*{}+?[]^$\\!"),ds=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ti="[^/]",Ii=ti+"*?",ki=ti+"+?";class O{type;#t;#i;#n=!1;#s=[];#r;#f;#d;#h=!1;#l;#a;#c=!1;constructor(t,i,e={}){this.type=t,t&&(this.#i=!0),this.#r=i,this.#t=this.#r?this.#r.#t:this,this.#l=this.#t===this?e:this.#t.#l,this.#d=this.#t===this?[]:this.#t.#d,t==="!"&&!this.#t.#h&&this.#d.push(this),this.#f=this.#r?this.#r.#s.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(const t of this.#s)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#s.map(t=>String(t)).join("|")+")":this.#a=this.#s.map(t=>String(t)).join("")}#e(){if(this!==this.#t)throw new Error("should only call on root");if(this.#h)return this;this.toString(),this.#h=!0;let t;for(;t=this.#d.pop();){if(t.type!=="!")continue;let i=t,e=i.#r;for(;e;){for(let s=i.#f+1;!e.type&&s<e.#s.length;s++)for(const r of t.#s){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(e.#s[s])}i=e,e=i.#r}}return this}push(...t){for(const i of t)if(i!==""){if(typeof i!="string"&&!(i instanceof O&&i.#r===this))throw new Error("invalid part: "+i);this.#s.push(i)}}toJSON(){const t=this.type===null?this.#s.slice().map(i=>typeof i=="string"?i:i.toJSON()):[this.type,...this.#s.map(i=>i.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#h&&this.#r?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#r?.isStart())return!1;if(this.#f===0)return!0;const t=this.#r;for(let i=0;i<this.#f;i++){const e=t.#s[i];if(!(e instanceof O&&e.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#r?.type==="!")return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();const t=this.#r?this.#r.#s.length:0;return this.#f===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){const i=new O(this.type,t);for(const e of this.#s)i.copyIn(e);return i}static#p(t,i,e,s){let r=!1,o=!1,a=-1,h=!1;if(i.type===null){let p=e,v="";for(;p<t.length;){const d=t.charAt(p++);if(r||d==="\\"){r=!r,v+=d;continue}if(o){p===a+1?(d==="^"||d==="!")&&(h=!0):d==="]"&&!(p===a+2&&h)&&(o=!1),v+=d;continue}else if(d==="["){o=!0,a=p,h=!1,v+=d;continue}if(!s.noext&&Di(d)&&t.charAt(p)==="("){i.push(v),v="";const m=new O(d,i);p=O.#p(t,m,p,s),i.push(m);continue}v+=d}return i.push(v),p}let l=e+1,u=new O(null,i);const c=[];let f="";for(;l<t.length;){const p=t.charAt(l++);if(r||p==="\\"){r=!r,f+=p;continue}if(o){l===a+1?(p==="^"||p==="!")&&(h=!0):p==="]"&&!(l===a+2&&h)&&(o=!1),f+=p;continue}else if(p==="["){o=!0,a=l,h=!1,f+=p;continue}if(Di(p)&&t.charAt(l)==="("){u.push(f),f="";const v=new O(p,u);u.push(v),l=O.#p(t,v,l,s);continue}if(p==="|"){u.push(f),f="",c.push(u),u=new O(null,i);continue}if(p===")")return f===""&&i.#s.length===0&&(i.#c=!0),u.push(f),f="",i.push(...c,u),l;f+=p}return i.type=null,i.#i=void 0,i.#s=[t.substring(e-1)],l}static fromGlob(t,i={}){const e=new O(null,void 0,i);return O.#p(t,e,0,i),e}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();const t=this.toString(),[i,e,s,r]=this.toRegExpSource();if(!(s||this.#i||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return e;const a=(this.#l.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${i}$`,a),{_src:i,_glob:t})}get options(){return this.#l}toRegExpSource(t){const i=t??!!this.#l.dot;if(this.#t===this&&this.#e(),!this.type){const h=this.isStart()&&this.isEnd(),l=this.#s.map(p=>{const[v,d,m,g]=typeof p=="string"?O.#g(p,this.#i,h):p.toRegExpSource(t);return this.#i=this.#i||m,this.#n=this.#n||g,v}).join("");let u="";if(this.isStart()&&typeof this.#s[0]=="string"&&!(this.#s.length===1&&fs.has(this.#s[0]))){const v=us,d=i&&v.has(l.charAt(0))||l.startsWith("\\.")&&v.has(l.charAt(2))||l.startsWith("\\.\\.")&&v.has(l.charAt(4)),m=!i&&!t&&v.has(l.charAt(0));u=d?cs:m?Zt:""}let c="";return this.isEnd()&&this.#t.#h&&this.#r?.type==="!"&&(c="(?:$|\\/)"),[u+l+c,at(l),this.#i=!!this.#i,this.#n]}const e=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:";let r=this.#m(i);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){const h=this.toString();return this.#s=[h],this.type=null,this.#i=void 0,[h,at(this.toString()),!1,!1]}let o=!e||t||i?"":this.#m(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!i?Zt:"")+ki;else{const h=this.type==="!"?"))"+(this.isStart()&&!i&&!t?Zt:"")+Ii+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=s+r+h}return[a,at(r),this.#i=!!this.#i,this.#n]}#m(t){return this.#s.map(i=>{if(typeof i=="string")throw new Error("string type in extglob ast??");const[e,s,r,o]=i.toRegExpSource(t);return this.#n=this.#n||o,e}).filter(i=>!(this.isStart()&&this.isEnd())||!!i).join("|")}static#g(t,i,e=!1){let s=!1,r="",o=!1;for(let a=0;a<t.length;a++){const h=t.charAt(a);if(s){s=!1,r+=(ps.has(h)?"\\":"")+h;continue}if(h==="\\"){a===t.length-1?r+="\\\\":s=!0;continue}if(h==="["){const[l,u,c,f]=hs(t,a);if(c){r+=l,o=o||u,a+=c-1,i=i||f;continue}}if(h==="*"){e&&t==="*"?r+=ki:r+=Ii,i=!0;continue}if(h==="?"){r+=ti,i=!0;continue}r+=ds(h)}return[r,at(t),!!i,o]}}const Ni=(n,{windowsPathsNoEscape:t=!1}={})=>t?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),k=(n,t,i={})=>(Ct(t),!i.nocomment&&t.charAt(0)==="#"?!1:new Y(t,i).match(n)),ms=/^\*+([^+@!?\*\[\(]*)$/,gs=n=>t=>!t.startsWith(".")&&t.endsWith(n),vs=n=>t=>t.endsWith(n),ys=n=>(n=n.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(n)),ws=n=>(n=n.toLowerCase(),t=>t.toLowerCase().endsWith(n)),Ss=/^\*+\.\*+$/,bs=n=>!n.startsWith(".")&&n.includes("."),Es=n=>n!=="."&&n!==".."&&n.includes("."),xs=/^\.\*+$/,Ts=n=>n!=="."&&n!==".."&&n.startsWith("."),As=/^\*+$/,Cs=n=>n.length!==0&&!n.startsWith("."),Ps=n=>n.length!==0&&n!=="."&&n!=="..",Ds=/^\?+([^+@!?\*\[\(]*)?$/,Is=([n,t=""])=>{const i=Mi([n]);return t?(t=t.toLowerCase(),e=>i(e)&&e.toLowerCase().endsWith(t)):i},ks=([n,t=""])=>{const i=Oi([n]);return t?(t=t.toLowerCase(),e=>i(e)&&e.toLowerCase().endsWith(t)):i},Ns=([n,t=""])=>{const i=Oi([n]);return t?e=>i(e)&&e.endsWith(t):i},Ms=([n,t=""])=>{const i=Mi([n]);return t?e=>i(e)&&e.endsWith(t):i},Mi=([n])=>{const t=n.length;return i=>i.length===t&&!i.startsWith(".")},Oi=([n])=>{const t=n.length;return i=>i.length===t&&i!=="."&&i!==".."},Fi=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Ri={win32:{sep:"\\"},posix:{sep:"/"}},Os=Fi==="win32"?Ri.win32.sep:Ri.posix.sep;k.sep=Os;const N=Symbol("globstar **");k.GLOBSTAR=N;const Fs="[^/]",Rs=Fs+"*?",Bs="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ls="(?:(?!(?:\\/|^)\\.).)*?",Ws=(n,t={})=>i=>k(i,n,t);k.filter=Ws;const L=(n,t={})=>Object.assign({},n,t),_s=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return k;const t=k;return Object.assign((e,s,r={})=>t(e,s,L(n,r)),{Minimatch:class extends t.Minimatch{constructor(s,r={}){super(s,L(n,r))}static defaults(s){return t.defaults(L(n,s)).Minimatch}},AST:class extends t.AST{constructor(s,r,o={}){super(s,r,L(n,o))}static fromGlob(s,r={}){return t.AST.fromGlob(s,L(n,r))}},unescape:(e,s={})=>t.unescape(e,L(n,s)),escape:(e,s={})=>t.escape(e,L(n,s)),filter:(e,s={})=>t.filter(e,L(n,s)),defaults:e=>t.defaults(L(n,e)),makeRe:(e,s={})=>t.makeRe(e,L(n,s)),braceExpand:(e,s={})=>t.braceExpand(e,L(n,s)),match:(e,s,r={})=>t.match(e,s,L(n,r)),sep:t.sep,GLOBSTAR:N})};k.defaults=_s;const Bi=(n,t={})=>(Ct(n),t.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:rs(n));k.braceExpand=Bi;const js=(n,t={})=>new Y(n,t).makeRe();k.makeRe=js;const $s=(n,t,i={})=>{const e=new Y(t,i);return n=n.filter(s=>e.match(s)),e.options.nonull&&!n.length&&n.push(t),n};k.match=$s;const Li=/[?*]|[+@!]\(.*?\)|\[|\]/,zs=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class Y{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,i={}){Ct(t),i=i||{},this.options=i,this.pattern=t,this.platform=i.platform||Fi,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!i.windowsPathsNoEscape||i.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!i.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!i.nonegate,this.comment=!1,this.empty=!1,this.partial=!!i.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=i.windowsNoMagicRoot!==void 0?i.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const i of t)if(typeof i!="string")return!0;return!1}debug(...t){}make(){const t=this.pattern,i=this.options;if(!i.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],i.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);const e=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(e),this.debug(this.pattern,this.globParts);let s=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){const h=r[0]===""&&r[1]===""&&(r[2]==="?"||!Li.test(r[2]))&&!Li.test(r[3]),l=/^[a-z]:/i.test(r[0]);if(h)return[...r.slice(0,4),...r.slice(4).map(u=>this.parse(u))];if(l)return[r[0],...r.slice(1).map(u=>this.parse(u))]}return r.map(h=>this.parse(h))});if(this.debug(this.pattern,s),this.set=s.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){const o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let s=0;s<t[e].length;s++)t[e][s]==="**"&&(t[e][s]="*");const{optimizationLevel:i=1}=this.options;return i>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):i>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(i=>{let e=-1;for(;(e=i.indexOf("**",e+1))!==-1;){let s=e;for(;i[s+1]==="**";)s++;s!==e&&i.splice(e,s-e)}return i})}levelOneOptimize(t){return t.map(i=>(i=i.reduce((e,s)=>{const r=e[e.length-1];return s==="**"&&r==="**"?e:s===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(e.pop(),e):(e.push(s),e)},[]),i.length===0?[""]:i))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let i=!1;do{if(i=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){const r=t[s];s===1&&r===""&&t[0]===""||(r==="."||r==="")&&(i=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(i=!0,t.pop())}let e=0;for(;(e=t.indexOf("..",e+1))!==-1;){const s=t[e-1];s&&s!=="."&&s!==".."&&s!=="**"&&(i=!0,t.splice(e-1,2),e-=2)}}while(i);return t.length===0?[""]:t}firstPhasePreProcess(t){let i=!1;do{i=!1;for(let e of t){let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let o=s;for(;e[o+1]==="**";)o++;o>s&&e.splice(s+1,o-s);let a=e[s+1];const h=e[s+2],l=e[s+3];if(a!==".."||!h||h==="."||h===".."||!l||l==="."||l==="..")continue;i=!0,e.splice(s,1);const u=e.slice(0);u[s]="**",t.push(u),s--}if(!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){const a=e[o];o===1&&a===""&&e[0]===""||(a==="."||a==="")&&(i=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(i=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){const o=e[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){i=!0;const h=r===1&&e[r+1]==="**"?["."]:[];e.splice(r-1,2,...h),e.length===0&&e.push(""),r-=2}}}}while(i);return t}secondPhasePreProcess(t){for(let i=0;i<t.length-1;i++)for(let e=i+1;e<t.length;e++){const s=this.partsMatch(t[i],t[e],!this.preserveMultipleSlashes);if(s){t[i]=[],t[e]=s;break}}return t.filter(i=>i.length)}partsMatch(t,i,e=!1){let s=0,r=0,o=[],a="";for(;s<t.length&&r<i.length;)if(t[s]===i[r])o.push(a==="b"?i[r]:t[s]),s++,r++;else if(e&&t[s]==="**"&&i[r]===t[s+1])o.push(t[s]),s++;else if(e&&i[r]==="**"&&t[s]===i[r+1])o.push(i[r]),r++;else if(t[s]==="*"&&i[r]&&(this.options.dot||!i[r].startsWith("."))&&i[r]!=="**"){if(a==="b")return!1;a="a",o.push(t[s]),s++,r++}else if(i[r]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(a==="a")return!1;a="b",o.push(i[r]),s++,r++}else return!1;return t.length===i.length&&o}parseNegate(){if(this.nonegate)return;const t=this.pattern;let i=!1,e=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)i=!i,e++;e&&(this.pattern=t.slice(e)),this.negate=i}matchOne(t,i,e=!1){const s=this.options;if(this.isWindows){const d=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),m=!d&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),g=typeof i[0]=="string"&&/^[a-z]:$/i.test(i[0]),S=!g&&i[0]===""&&i[1]===""&&i[2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3]),y=m?3:d?0:void 0,b=S?3:g?0:void 0;if(typeof y=="number"&&typeof b=="number"){const[E,x]=[t[y],i[b]];E.toLowerCase()===x.toLowerCase()&&(i[b]=E,b>y?i=i.slice(b):y>b&&(t=t.slice(y)))}}const{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:i}),this.debug("matchOne",t.length,i.length);for(var o=0,a=0,h=t.length,l=i.length;o<h&&a<l;o++,a++){this.debug("matchOne loop");var u=i[a],c=t[o];if(this.debug(i,u,c),u===!1)return!1;if(u===N){this.debug("GLOBSTAR",[i,u,c]);var f=o,p=a+1;if(p===l){for(this.debug("** at the end");o<h;o++)if(t[o]==="."||t[o]===".."||!s.dot&&t[o].charAt(0)===".")return!1;return!0}for(;f<h;){var v=t[f];if(this.debug(`
globstar while`,t,f,i,p,v),this.matchOne(t.slice(f),i.slice(p),e))return this.debug("globstar found match!",f,h,v),!0;if(v==="."||v===".."||!s.dot&&v.charAt(0)==="."){this.debug("dot detected!",t,f,i,p);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(e&&(this.debug(`
>>> no match, partial?`,t,f,i,p),f===h))}let d;if(typeof u=="string"?(d=c===u,this.debug("string match",u,c,d)):(d=u.test(c),this.debug("pattern match",u,c,d)),!d)return!1}if(o===h&&a===l)return!0;if(o===h)return e;if(a===l)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Bi(this.pattern,this.options)}parse(t){Ct(t);const i=this.options;if(t==="**")return N;if(t==="")return"";let e,s=null;(e=t.match(As))?s=i.dot?Ps:Cs:(e=t.match(ms))?s=(i.nocase?i.dot?ws:ys:i.dot?vs:gs)(e[1]):(e=t.match(Ds))?s=(i.nocase?i.dot?ks:Is:i.dot?Ns:Ms)(e):(e=t.match(Ss))?s=i.dot?Es:bs:(e=t.match(xs))&&(s=Ts);const r=O.fromGlob(t,this.options).toMMPattern();return s&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:s}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const i=this.options,e=i.noglobstar?Rs:i.dot?Bs:Ls,s=new Set(i.nocase?["i"]:[]);let r=t.map(h=>{const l=h.map(u=>{if(u instanceof RegExp)for(const c of u.flags.split(""))s.add(c);return typeof u=="string"?zs(u):u===N?N:u._src});return l.forEach((u,c)=>{const f=l[c+1],p=l[c-1];u!==N||p===N||(p===void 0?f!==void 0&&f!==N?l[c+1]="(?:\\/|"+e+"\\/)?"+f:l[c]=e:f===void 0?l[c-1]=p+"(?:\\/|"+e+")?":f!==N&&(l[c-1]=p+"(?:\\/|\\/"+e+"\\/)"+f,l[c+1]=N))}),l.filter(u=>u!==N).join("/")}).join("|");const[o,a]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,i=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&i)return!0;const e=this.options;this.isWindows&&(t=t.split("\\").join("/"));const s=this.slashSplit(t);this.debug(this.pattern,"split",s);const r=this.set;this.debug(this.pattern,"set",r);let o=s[s.length-1];if(!o)for(let a=s.length-2;!o&&a>=0;a--)o=s[a];for(let a=0;a<r.length;a++){const h=r[a];let l=s;if(e.matchBase&&h.length===1&&(l=[o]),this.matchOne(l,h,i))return e.flipNegate?!0:!this.negate}return e.flipNegate?!1:this.negate}static defaults(t){return k.defaults(t).Minimatch}}k.AST=O,k.Minimatch=Y,k.escape=Ni,k.unescape=at;const ht=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Wi=new Set,ii=typeof process=="object"&&process?process:{},_i=(n,t,i,e)=>{typeof ii.emitWarning=="function"?ii.emitWarning(n,t,i,e):console.error(`[${i}] ${t}: ${n}`)};let Pt=globalThis.AbortController,ji=globalThis.AbortSignal;if(typeof Pt>"u"){ji=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,s){this._onabort.push(s)}},Pt=class{constructor(){t()}signal=new ji;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const s of this.signal._onabort)s(e);this.signal.onabort?.(e)}}};let n=ii.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1";const t=()=>{n&&(n=!1,_i("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}const Js=n=>!Wi.has(n),Q=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),$i=n=>Q(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Dt:null:null;class Dt extends Array{constructor(t){super(t),this.fill(0)}}class ut{heap;length;static#t=!1;static create(t){const i=$i(t);if(!i)return[];ut.#t=!0;const e=new ut(t,i);return ut.#t=!1,e}constructor(t,i){if(!ut.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class Jt{#t;#i;#n;#s;#r;#f;#d;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#l;#a;#c;#e;#p;#m;#g;#v;#x;#y;#T;#S;#E;#b;#P;#w;#k;static unsafeExposeInternals(t){return{starts:t.#S,ttls:t.#E,sizes:t.#T,keyMap:t.#a,keyList:t.#c,valList:t.#e,next:t.#p,prev:t.#m,get head(){return t.#g},get tail(){return t.#v},free:t.#x,isBackgroundFetch:i=>t.#u(i),backgroundFetch:(i,e,s,r)=>t.#R(i,e,s,r),moveToTail:i=>t.#W(i),indexes:i=>t.#D(i),rindexes:i=>t.#I(i),isStale:i=>t.#C(i)}}get max(){return this.#t}get maxSize(){return this.#i}get calculatedSize(){return this.#l}get size(){return this.#h}get fetchMethod(){return this.#f}get memoMethod(){return this.#d}get dispose(){return this.#n}get onInsert(){return this.#s}get disposeAfter(){return this.#r}constructor(t){const{max:i=0,ttl:e,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:u,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:p,maxSize:v=0,maxEntrySize:d=0,sizeCalculation:m,fetchMethod:g,memoMethod:S,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:x,ignoreFetchAbort:F}=t;if(i!==0&&!Q(i))throw new TypeError("max option must be a nonnegative integer");const ot=i?$i(i):Array;if(!ot)throw new Error("invalid max value: "+i);if(this.#t=i,this.#i=v,this.maxEntrySize=d||this.#i,this.sizeCalculation=m,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#d=S,g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#f=g,this.#P=!!g,this.#a=new Map,this.#c=new Array(i).fill(void 0),this.#e=new Array(i).fill(void 0),this.#p=new ot(i),this.#m=new ot(i),this.#g=0,this.#v=0,this.#x=ut.create(i),this.#h=0,this.#l=0,typeof l=="function"&&(this.#n=l),typeof u=="function"&&(this.#s=u),typeof c=="function"?(this.#r=c,this.#y=[]):(this.#r=void 0,this.#y=void 0),this.#b=!!this.#n,this.#k=!!this.#s,this.#w=!!this.#r,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!x,this.ignoreFetchAbort=!!F,this.maxEntrySize!==0){if(this.#i!==0&&!Q(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!Q(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#j()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Q(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=e||0,this.ttl){if(!Q(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#o()}if(this.#t===0&&this.ttl===0&&this.#i===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#i){const q="LRU_CACHE_UNBOUNDED";Js(q)&&(Wi.add(q),_i("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",q,Jt))}}getRemainingTTL(t){return this.#a.has(t)?1/0:0}#o(){const t=new Dt(this.#t),i=new Dt(this.#t);this.#E=t,this.#S=i,this.#N=(r,o,a=ht.now())=>{if(i[r]=o!==0?a:0,t[r]=o,o!==0&&this.ttlAutopurge){const h=setTimeout(()=>{this.#C(r)&&this.#M(this.#c[r],"expire")},o+1);h.unref&&h.unref()}},this.#O=r=>{i[r]=t[r]!==0?ht.now():0},this.#A=(r,o)=>{if(t[o]){const a=t[o],h=i[o];if(!a||!h)return;r.ttl=a,r.start=h,r.now=e||s();const l=r.now-h;r.remainingTTL=a-l}};let e=0;const s=()=>{const r=ht.now();if(this.ttlResolution>0){e=r;const o=setTimeout(()=>e=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{const o=this.#a.get(r);if(o===void 0)return 0;const a=t[o],h=i[o];if(!a||!h)return 1/0;const l=(e||s())-h;return a-l},this.#C=r=>{const o=i[r],a=t[r];return!!a&&!!o&&(e||s())-o>a}}#O=()=>{};#A=()=>{};#N=()=>{};#C=()=>!1;#j(){const t=new Dt(this.#t);this.#l=0,this.#T=t,this.#F=i=>{this.#l-=t[i],t[i]=0},this.#$=(i,e,s,r)=>{if(this.#u(e))return 0;if(!Q(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(e,i),!Q(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#B=(i,e,s)=>{if(t[i]=e,this.#i){const r=this.#i-t[i];for(;this.#l>r;)this.#L(!0)}this.#l+=t[i],s&&(s.entrySize=e,s.totalCalculatedSize=this.#l)}}#F=t=>{};#B=(t,i,e)=>{};#$=(t,i,e,s)=>{if(e||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:t=this.allowStale}={}){if(this.#h)for(let i=this.#v;!(!this.#z(i)||((t||!this.#C(i))&&(yield i),i===this.#g));)i=this.#m[i]}*#I({allowStale:t=this.allowStale}={}){if(this.#h)for(let i=this.#g;!(!this.#z(i)||((t||!this.#C(i))&&(yield i),i===this.#v));)i=this.#p[i]}#z(t){return t!==void 0&&this.#a.get(this.#c[t])===t}*entries(){for(const t of this.#D())this.#e[t]!==void 0&&this.#c[t]!==void 0&&!this.#u(this.#e[t])&&(yield[this.#c[t],this.#e[t]])}*rentries(){for(const t of this.#I())this.#e[t]!==void 0&&this.#c[t]!==void 0&&!this.#u(this.#e[t])&&(yield[this.#c[t],this.#e[t]])}*keys(){for(const t of this.#D()){const i=this.#c[t];i!==void 0&&!this.#u(this.#e[t])&&(yield i)}}*rkeys(){for(const t of this.#I()){const i=this.#c[t];i!==void 0&&!this.#u(this.#e[t])&&(yield i)}}*values(){for(const t of this.#D())this.#e[t]!==void 0&&!this.#u(this.#e[t])&&(yield this.#e[t])}*rvalues(){for(const t of this.#I())this.#e[t]!==void 0&&!this.#u(this.#e[t])&&(yield this.#e[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,i={}){for(const e of this.#D()){const s=this.#e[e],r=this.#u(s)?s.__staleWhileFetching:s;if(r!==void 0&&t(r,this.#c[e],this))return this.get(this.#c[e],i)}}forEach(t,i=this){for(const e of this.#D()){const s=this.#e[e],r=this.#u(s)?s.__staleWhileFetching:s;r!==void 0&&t.call(i,r,this.#c[e],this)}}rforEach(t,i=this){for(const e of this.#I()){const s=this.#e[e],r=this.#u(s)?s.__staleWhileFetching:s;r!==void 0&&t.call(i,r,this.#c[e],this)}}purgeStale(){let t=!1;for(const i of this.#I({allowStale:!0}))this.#C(i)&&(this.#M(this.#c[i],"expire"),t=!0);return t}info(t){const i=this.#a.get(t);if(i===void 0)return;const e=this.#e[i],s=this.#u(e)?e.__staleWhileFetching:e;if(s===void 0)return;const r={value:s};if(this.#E&&this.#S){const o=this.#E[i],a=this.#S[i];if(o&&a){const h=o-(ht.now()-a);r.ttl=h,r.start=Date.now()}}return this.#T&&(r.size=this.#T[i]),r}dump(){const t=[];for(const i of this.#D({allowStale:!0})){const e=this.#c[i],s=this.#e[i],r=this.#u(s)?s.__staleWhileFetching:s;if(r===void 0||e===void 0)continue;const o={value:r};if(this.#E&&this.#S){o.ttl=this.#E[i];const a=ht.now()-this.#S[i];o.start=Math.floor(Date.now()-a)}this.#T&&(o.size=this.#T[i]),t.unshift([e,o])}return t}load(t){this.clear();for(const[i,e]of t){if(e.start){const s=Date.now()-e.start;e.start=ht.now()-s}this.set(i,e.value,e)}}set(t,i,e={}){if(i===void 0)return this.delete(t),this;const{ttl:s=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=e;let{noUpdateTTL:l=this.noUpdateTTL}=e;const u=this.#$(t,i,e.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.#M(t,"set"),this;let c=this.#h===0?void 0:this.#a.get(t);if(c===void 0)c=this.#h===0?this.#v:this.#x.length!==0?this.#x.pop():this.#h===this.#t?this.#L(!1):this.#h,this.#c[c]=t,this.#e[c]=i,this.#a.set(t,c),this.#p[this.#v]=c,this.#m[c]=this.#v,this.#v=c,this.#h++,this.#B(c,u,h),h&&(h.set="add"),l=!1,this.#k&&this.#s?.(i,t,"add");else{this.#W(c);const f=this.#e[c];if(i!==f){if(this.#P&&this.#u(f)){f.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:p}=f;p!==void 0&&!o&&(this.#b&&this.#n?.(p,t,"set"),this.#w&&this.#y?.push([p,t,"set"]))}else o||(this.#b&&this.#n?.(f,t,"set"),this.#w&&this.#y?.push([f,t,"set"]));if(this.#F(c),this.#B(c,u,h),this.#e[c]=i,h){h.set="replace";const p=f&&this.#u(f)?f.__staleWhileFetching:f;p!==void 0&&(h.oldValue=p)}}else h&&(h.set="update");this.#k&&this.onInsert?.(i,t,i===f?"update":"replace")}if(s!==0&&!this.#E&&this.#o(),this.#E&&(l||this.#N(c,s,r),h&&this.#A(h,c)),!o&&this.#w&&this.#y){const f=this.#y;let p;for(;p=f?.shift();)this.#r?.(...p)}return this}pop(){try{for(;this.#h;){const t=this.#e[this.#g];if(this.#L(!0),this.#u(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#w&&this.#y){const t=this.#y;let i;for(;i=t?.shift();)this.#r?.(...i)}}}#L(t){const i=this.#g,e=this.#c[i],s=this.#e[i];return this.#P&&this.#u(s)?s.__abortController.abort(new Error("evicted")):(this.#b||this.#w)&&(this.#b&&this.#n?.(s,e,"evict"),this.#w&&this.#y?.push([s,e,"evict"])),this.#F(i),t&&(this.#c[i]=void 0,this.#e[i]=void 0,this.#x.push(i)),this.#h===1?(this.#g=this.#v=0,this.#x.length=0):this.#g=this.#p[i],this.#a.delete(e),this.#h--,i}has(t,i={}){const{updateAgeOnHas:e=this.updateAgeOnHas,status:s}=i,r=this.#a.get(t);if(r!==void 0){const o=this.#e[r];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#C(r))s&&(s.has="stale",this.#A(s,r));else return e&&this.#O(r),s&&(s.has="hit",this.#A(s,r)),!0}else s&&(s.has="miss");return!1}peek(t,i={}){const{allowStale:e=this.allowStale}=i,s=this.#a.get(t);if(s===void 0||!e&&this.#C(s))return;const r=this.#e[s];return this.#u(r)?r.__staleWhileFetching:r}#R(t,i,e,s){const r=i===void 0?void 0:this.#e[i];if(this.#u(r))return r;const o=new Pt,{signal:a}=e;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});const h={signal:o.signal,options:e,context:s},l=(d,m=!1)=>{const{aborted:g}=o.signal,S=e.ignoreFetchAbort&&d!==void 0;if(e.status&&(g&&!m?(e.status.fetchAborted=!0,e.status.fetchError=o.signal.reason,S&&(e.status.fetchAbortIgnored=!0)):e.status.fetchResolved=!0),g&&!S&&!m)return c(o.signal.reason);const y=p;return this.#e[i]===p&&(d===void 0?y.__staleWhileFetching?this.#e[i]=y.__staleWhileFetching:this.#M(t,"fetch"):(e.status&&(e.status.fetchUpdated=!0),this.set(t,d,h.options))),d},u=d=>(e.status&&(e.status.fetchRejected=!0,e.status.fetchError=d),c(d)),c=d=>{const{aborted:m}=o.signal,g=m&&e.allowStaleOnFetchAbort,S=g||e.allowStaleOnFetchRejection,y=S||e.noDeleteOnFetchRejection,b=p;if(this.#e[i]===p&&(!y||b.__staleWhileFetching===void 0?this.#M(t,"fetch"):g||(this.#e[i]=b.__staleWhileFetching)),S)return e.status&&b.__staleWhileFetching!==void 0&&(e.status.returnedStale=!0),b.__staleWhileFetching;if(b.__returned===b)throw d},f=(d,m)=>{const g=this.#f?.(t,r,h);g&&g instanceof Promise&&g.then(S=>d(S===void 0?void 0:S),m),o.signal.addEventListener("abort",()=>{(!e.ignoreFetchAbort||e.allowStaleOnFetchAbort)&&(d(void 0),e.allowStaleOnFetchAbort&&(d=S=>l(S,!0)))})};e.status&&(e.status.fetchDispatched=!0);const p=new Promise(f).then(l,u),v=Object.assign(p,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(t,v,{...h.options,status:void 0}),i=this.#a.get(t)):this.#e[i]=v,v}#u(t){if(!this.#P)return!1;const i=t;return!!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Pt}async fetch(t,i={}){const{allowStale:e=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:v=this.allowStaleOnFetchAbort,context:d,forceRefresh:m=!1,status:g,signal:S}=i;if(!this.#P)return g&&(g.fetch="get"),this.get(t,{allowStale:e,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:g});const y={allowStale:e,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:v,ignoreFetchAbort:p,status:g,signal:S};let b=this.#a.get(t);if(b===void 0){g&&(g.fetch="miss");const E=this.#R(t,b,y,d);return E.__returned=E}else{const E=this.#e[b];if(this.#u(E)){const K=e&&E.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",K&&(g.returnedStale=!0)),K?E.__staleWhileFetching:E.__returned=E}const x=this.#C(b);if(!m&&!x)return g&&(g.fetch="hit"),this.#W(b),s&&this.#O(b),g&&this.#A(g,b),E;const F=this.#R(t,b,y,d),q=F.__staleWhileFetching!==void 0&&e;return g&&(g.fetch=x?"stale":"refresh",q&&x&&(g.returnedStale=!0)),q?F.__staleWhileFetching:F.__returned=F}}async forceFetch(t,i={}){const e=await this.fetch(t,i);if(e===void 0)throw new Error("fetch() returned undefined");return e}memo(t,i={}){const e=this.#d;if(!e)throw new Error("no memoMethod provided to constructor");const{context:s,forceRefresh:r,...o}=i,a=this.get(t,o);if(!r&&a!==void 0)return a;const h=e(t,a,{options:o,context:s});return this.set(t,h,o),h}get(t,i={}){const{allowStale:e=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=i,a=this.#a.get(t);if(a!==void 0){const h=this.#e[a],l=this.#u(h);return o&&this.#A(o,a),this.#C(a)?(o&&(o.get="stale"),l?(o&&e&&h.__staleWhileFetching!==void 0&&(o.returnedStale=!0),e?h.__staleWhileFetching:void 0):(r||this.#M(t,"expire"),o&&e&&(o.returnedStale=!0),e?h:void 0)):(o&&(o.get="hit"),l?h.__staleWhileFetching:(this.#W(a),s&&this.#O(a),h))}else o&&(o.get="miss")}#J(t,i){this.#m[i]=t,this.#p[t]=i}#W(t){t!==this.#v&&(t===this.#g?this.#g=this.#p[t]:this.#J(this.#m[t],this.#p[t]),this.#J(this.#v,t),this.#v=t)}delete(t){return this.#M(t,"delete")}#M(t,i){let e=!1;if(this.#h!==0){const s=this.#a.get(t);if(s!==void 0)if(e=!0,this.#h===1)this.#_(i);else{this.#F(s);const r=this.#e[s];if(this.#u(r)?r.__abortController.abort(new Error("deleted")):(this.#b||this.#w)&&(this.#b&&this.#n?.(r,t,i),this.#w&&this.#y?.push([r,t,i])),this.#a.delete(t),this.#c[s]=void 0,this.#e[s]=void 0,s===this.#v)this.#v=this.#m[s];else if(s===this.#g)this.#g=this.#p[s];else{const o=this.#m[s];this.#p[o]=this.#p[s];const a=this.#p[s];this.#m[a]=this.#m[s]}this.#h--,this.#x.push(s)}}if(this.#w&&this.#y?.length){const s=this.#y;let r;for(;r=s?.shift();)this.#r?.(...r)}return e}clear(){return this.#_("delete")}#_(t){for(const i of this.#I({allowStale:!0})){const e=this.#e[i];if(this.#u(e))e.__abortController.abort(new Error("deleted"));else{const s=this.#c[i];this.#b&&this.#n?.(e,s,t),this.#w&&this.#y?.push([e,s,t])}}if(this.#a.clear(),this.#e.fill(void 0),this.#c.fill(void 0),this.#E&&this.#S&&(this.#E.fill(0),this.#S.fill(0)),this.#T&&this.#T.fill(0),this.#g=0,this.#v=0,this.#x.length=0,this.#l=0,this.#h=0,this.#w&&this.#y){const i=this.#y;let e;for(;e=i?.shift();)this.#r?.(...e)}}}const zi=typeof process=="object"&&process?process:{stdout:null,stderr:null},Us=n=>!!n&&typeof n=="object"&&(n instanceof Ft||n instanceof Ti||Xs(n)||Gs(n)),Xs=n=>!!n&&typeof n=="object"&&n instanceof Kt&&typeof n.pipe=="function"&&n.pipe!==Ti.Writable.prototype.pipe,Gs=n=>!!n&&typeof n=="object"&&n instanceof Kt&&typeof n.write=="function"&&typeof n.end=="function",V=Symbol("EOF"),H=Symbol("maybeEmitEnd"),Z=Symbol("emittedEnd"),It=Symbol("emittingEnd"),mt=Symbol("emittedError"),kt=Symbol("closed"),Ji=Symbol("read"),Nt=Symbol("flush"),Ui=Symbol("flushChunk"),j=Symbol("encoding"),lt=Symbol("decoder"),A=Symbol("flowing"),gt=Symbol("paused"),ct=Symbol("resume"),C=Symbol("buffer"),M=Symbol("pipes"),P=Symbol("bufferLength"),ei=Symbol("bufferPush"),Mt=Symbol("bufferShift"),I=Symbol("objectMode"),T=Symbol("destroyed"),si=Symbol("error"),ri=Symbol("emitData"),Xi=Symbol("emitEnd"),ni=Symbol("emitEnd2"),X=Symbol("async"),oi=Symbol("abort"),Ot=Symbol("aborted"),vt=Symbol("signal"),st=Symbol("dataListeners"),B=Symbol("discarded"),yt=n=>Promise.resolve().then(n),qs=n=>n(),Vs=n=>n==="end"||n==="finish"||n==="prefinish",Hs=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,Ks=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n);class Gi{src;dest;opts;ondrain;constructor(t,i,e){this.src=t,this.dest=i,this.opts=e,this.ondrain=()=>t[ct](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class Ys extends Gi{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,i,e){super(t,i,e),this.proxyErrors=s=>i.emit("error",s),t.on("error",this.proxyErrors)}}const Qs=n=>!!n.objectMode,Zs=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer";class Ft extends Kt{[A]=!1;[gt]=!1;[M]=[];[C]=[];[I];[j];[X];[lt];[V]=!1;[Z]=!1;[It]=!1;[kt]=!1;[mt]=null;[P]=0;[T]=!1;[vt];[Ot]=!1;[st]=0;[B]=!1;writable=!0;readable=!0;constructor(...t){const i=t[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Qs(i)?(this[I]=!0,this[j]=null):Zs(i)?(this[j]=i.encoding,this[I]=!1):(this[I]=!1,this[j]=null),this[X]=!!i.async,this[lt]=this[j]?new Ve(this[j]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[C]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[M]});const{signal:e}=i;e&&(this[vt]=e,e.aborted?this[oi]():e.addEventListener("abort",()=>this[oi]()))}get bufferLength(){return this[P]}get encoding(){return this[j]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[I]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[X]}set async(t){this[X]=this[X]||!!t}[oi](){this[Ot]=!0,this.emit("abort",this[vt]?.reason),this.destroy(this[vt]?.reason)}get aborted(){return this[Ot]}set aborted(t){}write(t,i,e){if(this[Ot])return!1;if(this[V])throw new Error("write after end");if(this[T])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(e=i,i="utf8"),i||(i="utf8");const s=this[X]?yt:qs;if(!this[I]&&!Buffer.isBuffer(t)){if(Ks(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Hs(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[I]?(this[A]&&this[P]!==0&&this[Nt](!0),this[A]?this.emit("data",t):this[ei](t),this[P]!==0&&this.emit("readable"),e&&s(e),this[A]):t.length?(typeof t=="string"&&!(i===this[j]&&!this[lt]?.lastNeed)&&(t=Buffer.from(t,i)),Buffer.isBuffer(t)&&this[j]&&(t=this[lt].write(t)),this[A]&&this[P]!==0&&this[Nt](!0),this[A]?this.emit("data",t):this[ei](t),this[P]!==0&&this.emit("readable"),e&&s(e),this[A]):(this[P]!==0&&this.emit("readable"),e&&s(e),this[A])}read(t){if(this[T])return null;if(this[B]=!1,this[P]===0||t===0||t&&t>this[P])return this[H](),null;this[I]&&(t=null),this[C].length>1&&!this[I]&&(this[C]=[this[j]?this[C].join(""):Buffer.concat(this[C],this[P])]);const i=this[Ji](t||null,this[C][0]);return this[H](),i}[Ji](t,i){if(this[I])this[Mt]();else{const e=i;t===e.length||t===null?this[Mt]():typeof e=="string"?(this[C][0]=e.slice(t),i=e.slice(0,t),this[P]-=t):(this[C][0]=e.subarray(t),i=e.subarray(0,t),this[P]-=t)}return this.emit("data",i),!this[C].length&&!this[V]&&this.emit("drain"),i}end(t,i,e){return typeof t=="function"&&(e=t,t=void 0),typeof i=="function"&&(e=i,i="utf8"),t!==void 0&&this.write(t,i),e&&this.once("end",e),this[V]=!0,this.writable=!1,(this[A]||!this[gt])&&this[H](),this}[ct](){this[T]||(!this[st]&&!this[M].length&&(this[B]=!0),this[gt]=!1,this[A]=!0,this.emit("resume"),this[C].length?this[Nt]():this[V]?this[H]():this.emit("drain"))}resume(){return this[ct]()}pause(){this[A]=!1,this[gt]=!0,this[B]=!1}get destroyed(){return this[T]}get flowing(){return this[A]}get paused(){return this[gt]}[ei](t){this[I]?this[P]+=1:this[P]+=t.length,this[C].push(t)}[Mt](){return this[I]?this[P]-=1:this[P]-=this[C][0].length,this[C].shift()}[Nt](t=!1){do;while(this[Ui](this[Mt]())&&this[C].length);!t&&!this[C].length&&!this[V]&&this.emit("drain")}[Ui](t){return this.emit("data",t),this[A]}pipe(t,i){if(this[T])return t;this[B]=!1;const e=this[Z];return i=i||{},t===zi.stdout||t===zi.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,e?i.end&&t.end():(this[M].push(i.proxyErrors?new Ys(this,t,i):new Gi(this,t,i)),this[X]?yt(()=>this[ct]()):this[ct]()),t}unpipe(t){const i=this[M].find(e=>e.dest===t);i&&(this[M].length===1?(this[A]&&this[st]===0&&(this[A]=!1),this[M]=[]):this[M].splice(this[M].indexOf(i),1),i.unpipe())}addListener(t,i){return this.on(t,i)}on(t,i){const e=super.on(t,i);if(t==="data")this[B]=!1,this[st]++,!this[M].length&&!this[A]&&this[ct]();else if(t==="readable"&&this[P]!==0)super.emit("readable");else if(Vs(t)&&this[Z])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[mt]){const s=i;this[X]?yt(()=>s.call(this,this[mt])):s.call(this,this[mt])}return e}removeListener(t,i){return this.off(t,i)}off(t,i){const e=super.off(t,i);return t==="data"&&(this[st]=this.listeners("data").length,this[st]===0&&!this[B]&&!this[M].length&&(this[A]=!1)),e}removeAllListeners(t){const i=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[st]=0,!this[B]&&!this[M].length&&(this[A]=!1)),i}get emittedEnd(){return this[Z]}[H](){!this[It]&&!this[Z]&&!this[T]&&this[C].length===0&&this[V]&&(this[It]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[kt]&&this.emit("close"),this[It]=!1)}emit(t,...i){const e=i[0];if(t!=="error"&&t!=="close"&&t!==T&&this[T])return!1;if(t==="data")return!this[I]&&!e?!1:this[X]?(yt(()=>this[ri](e)),!0):this[ri](e);if(t==="end")return this[Xi]();if(t==="close"){if(this[kt]=!0,!this[Z]&&!this[T])return!1;const r=super.emit("close");return this.removeAllListeners("close"),r}else if(t==="error"){this[mt]=e,super.emit(si,e);const r=!this[vt]||this.listeners("error").length?super.emit("error",e):!1;return this[H](),r}else if(t==="resume"){const r=super.emit("resume");return this[H](),r}else if(t==="finish"||t==="prefinish"){const r=super.emit(t);return this.removeAllListeners(t),r}const s=super.emit(t,...i);return this[H](),s}[ri](t){for(const e of this[M])e.dest.write(t)===!1&&this.pause();const i=this[B]?!1:super.emit("data",t);return this[H](),i}[Xi](){return this[Z]?!1:(this[Z]=!0,this.readable=!1,this[X]?(yt(()=>this[ni]()),!0):this[ni]())}[ni](){if(this[lt]){const i=this[lt].end();if(i){for(const e of this[M])e.dest.write(i);this[B]||super.emit("data",i)}}for(const i of this[M])i.end();const t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){const t=Object.assign([],{dataLength:0});this[I]||(t.dataLength=0);const i=this.promise();return this.on("data",e=>{t.push(e),this[I]||(t.dataLength+=e.length)}),await i,t}async concat(){if(this[I])throw new Error("cannot concat in objectMode");const t=await this.collect();return this[j]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,i)=>{this.on(T,()=>i(new Error("stream destroyed"))),this.on("error",e=>i(e)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[B]=!1;let t=!1;const i=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return i();const s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[V])return i();let r,o;const a=c=>{this.off("data",h),this.off("end",l),this.off(T,u),i(),o(c)},h=c=>{this.off("error",a),this.off("end",l),this.off(T,u),this.pause(),r({value:c,done:!!this[V]})},l=()=>{this.off("error",a),this.off("data",h),this.off(T,u),i(),r({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((c,f)=>{o=f,r=c,this.once(T,u),this.once("error",a),this.once("end",l),this.once("data",h)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[B]=!1;let t=!1;const i=()=>(this.pause(),this.off(si,i),this.off(T,i),this.off("end",i),t=!0,{done:!0,value:void 0}),e=()=>{if(t)return i();const s=this.read();return s===null?i():{done:!1,value:s}};return this.once("end",i),this.once(si,i),this.once(T,i),{next:e,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(t){if(this[T])return t?this.emit("error",t):this.emit(T),this;this[T]=!0,this[B]=!0,this[C].length=0,this[P]=0;const i=this;return typeof i.close=="function"&&!this[kt]&&i.close(),t?this.emit("error",t):this.emit(T),this}static get isStream(){return Us}}const tr=Ne.native,wt={lstatSync:Re,readdir:Fe,readdirSync:Oe,readlinkSync:Me,realpathSync:tr,promises:{lstat:qe,readdir:Ge,readlink:Xe,realpath:Ue}},qi=n=>!n||n===wt||n===Je?wt:{...wt,...n,promises:{...wt.promises,...n.promises||{}}},Vi=/^\\\\\?\\([a-z]:)\\?$/i,ir=n=>n.replace(/\//g,"\\").replace(Vi,"$1\\"),er=/[\\\/]/,W=0,Hi=1,Ki=2,G=4,Yi=6,Qi=8,rt=10,Zi=12,$=15,St=-16,te=16,ie=32,bt=64,z=128,Rt=256,Bt=512,ee=bt|z|Bt,sr=1023,ai=n=>n.isFile()?Qi:n.isDirectory()?G:n.isSymbolicLink()?rt:n.isCharacterDevice()?Ki:n.isBlockDevice()?Yi:n.isSocket()?Zi:n.isFIFO()?Hi:W,se=new Map,Et=n=>{const t=se.get(n);if(t)return t;const i=n.normalize("NFKD");return se.set(n,i),i},re=new Map,Lt=n=>{const t=re.get(n);if(t)return t;const i=Et(n.toLowerCase());return re.set(n,i),i};class ne extends Jt{constructor(){super({max:256})}}class rr extends Jt{constructor(t=16*1024){super({maxSize:t,sizeCalculation:i=>i.length+1})}}const oe=Symbol("PathScurry setAsCwd");class R{name;root;roots;parent;nocase;isCWD=!1;#t;#i;get dev(){return this.#i}#n;get mode(){return this.#n}#s;get nlink(){return this.#s}#r;get uid(){return this.#r}#f;get gid(){return this.#f}#d;get rdev(){return this.#d}#h;get blksize(){return this.#h}