UNPKG

@freik/passable

Version:
7 lines 101 kB
#!/usr/bin/env node import{readFileSync as K6,writeFileSync as Y6}from"node:fs";var Z2=Symbol.for("freik.typetag");function k(Q){return Q===void 0}function m1(Q){return!k(Q)}function _2(Q){return Q===void 0||Q===null}function K2(Q){return!_2(Q)}function Y2(Q,X,J){return X(Q)||J(Q)}function q2(Q,X){return(J)=>Y2(J,Q,X)}function H2(Q,X,J){return X(Q)&&J(Q)}function j2(Q,...X){return X.some((J)=>J(Q))}function h1(...Q){return(X)=>j2(X,...Q)}function c0(Q){return H2(Q,W2,K2)}function W2(Q){return typeof Q==="object"}function B0(Q){return Array.isArray(Q)}function y(Q){return typeof Q==="string"}function R0(Q){return typeof Q==="number"&&!isNaN(Q-0)}var G6=q2(y,R0);function l1(Q){return typeof Q==="boolean"}function z0(Q){return typeof Q==="function"}function U2(Q){return Q instanceof Map}function p1(Q,X){if(!B0(Q))return!1;for(let J of Q)if(!X(J))return!1;return!0}function j1(Q){return(X)=>p1(X,Q)}function G2(Q,...X){return B0(Q)&&Q.length===X.length&&X.every((J,$)=>J(Q[$]))}function w2(...Q){return(X)=>G2(X,...Q)}function z2(Q,X,J){if(!U2(Q))return!1;for(let[$,V]of Q){if(!X($))return!1;if(!J(V))return!1}return!0}function g1(Q,X){return(J)=>z2(J,Q,X)}function d1(Q){return typeof Q==="symbol"}function I0(Q,X){return c0(Q)&&X in Q}function O2(Q,X,J){return I0(Q,X)&&J(Q[X])}var O0=O2;function c1(Q,X){return O0(Q,X,y)}function B2(Q,X,J,$){if(!c0(X))return!1;let V=Object.keys(J).length,Z=Object.keys(X),_=Z.length;for(let K of Z){if(!I0(X,K))continue;let Y=X[K];if(k(Y)||X[K]===null){delete X[K],_--;continue}if(O0($,K,z0)){let H=$[K];if(!H(Y))return!1;_--}else if(O0(J,K,z0)){let H=J[K];if(!H(Y))return!1;V--,_--}}return V===0&&(_===0||!Q)}function R2(Q,X={}){return(J)=>B2(!1,J,Q,X)}function I2(Q,X){if(!c0(Q))return!1;let J=Object.keys(Q),$=J.length;for(let V of J){if(!I0(Q,V))continue;let Z=Q[V];if(k(Z)||Q[V]===null){delete Q[V],$--;continue}if(O0(X,V,z0)){let _=X[V];if(!_(Z))return!1;$--}}return $===0}function W1(Q){return(X)=>I2(X,Q)}function M2(Q,X,J){if(!c0(Q))return!1;let $=Object.keys(Q),V=$.length;for(let Z of $){if(!I0(Q,Z))continue;let _=Q[Z];if(!X(Z)||!J(_))return!1;V--}return V===0}function i1(Q,X){return(J)=>M2(J,Q,X)}var A2=new Function("try {return this===global;}catch(e){ return false;}"),F2=new Function("try {return this===window;}catch(e){ return false;}");function C2(){return typeof globalThis!=="undefined"}var o1=Symbol.for("freik.Set"),n1=Symbol.for("freik.Map"),r1=Symbol.for("freik.Symbol"),a1=Symbol.for("freik.RegExp"),s1=Symbol.for("freik.Date"),t1=Symbol.for("freik.BigInt");function L2(Q){return[...Q.entries()]}function N2(Q){return p1(Q,w2(m1,m1))?new Map(Q):void 0}function D2(Q){return[...Q]}function u2(Q){return B0(Q)?new Set(Q):void 0}function E2(Q){let X=Symbol.keyFor(Q);if(X===void 0)throw new Error("Unable to get a key for a symbol for pickling");return X}function S2(Q){return y(Q)?Symbol.for(Q):void 0}function v2(Q){return{source:Q.source,flags:Q.flags}}function P2(Q){if(c1(Q,"source")&&c1(Q,"flags"))return new RegExp(Q.source,Q.flags)}function f2(Q){return Q.toJSON()}function b2(Q){try{return y(Q)?new Date(Q):void 0}catch{return}}function x2(Q){return Q.toString()}function T2(Q){try{return y(Q)?BigInt(Q):void 0}catch{return}}var y2=new Map([[n1,L2],[o1,D2],[r1,E2],[a1,v2],[s1,f2],[t1,x2]]),k2=new Map([[n1,N2],[o1,u2],[r1,S2],[a1,P2],[s1,b2],[t1,T2]]),m2;((Q)=>{Q[Q.Success=0]="Success",Q[Q.Already=1]="Already",Q[Q.Fail=2]="Fail",Q[Q.DetectionFailure=3]="DetectionFailure"})(m2||={});var d0=Z2;function H1(Q){if(!I0(Q,d0))return Q[d0]={to:y2,from:k2},0;if(!O0(Q,d0,R2({to:g1(h1(d1,y),z0),from:g1(h1(d1,y),z0)})))return 2;return 1}function h2(){if(C2())return H1(globalThis);if(F2())return H1(window);if(A2())return H1(global);return 3}switch(h2()){case 2:throw Error(`Invalid <global>[${String(d0)}] object`);case 3:throw Error("Unable to determine environment for pickling");default:break}import*as l0 from"fs";import*as M0 from"path";var e1={useTabs:!1,tabWidth:2,endOfLine:` `,printWidth:80,commands:{add_library:{controlKeywords:["STATIC","SHARED","MODULE","OBJECT","INTERFACE","UNKNOWN","ALIAS"],options:["GLOBAL","EXCLUDE_FROM_ALL","IMPORTED"]},add_executable:{options:["WIN32","MACOSX_BUNDLE","EXCLUDE_FROM_ALL","IMPORTED","ALIAS"]},execute_process:{controlKeywords:["COMMAND","WORKING_DIRECTORY","RESULT_VARIABLE","OUTPUT_VARIABLE","ERROR_VARIABLE","INPUT_FILE","OUTPUT_FILE","ERROR_FILE","TIMEOUT","ECHO_ERROR_VARIABLE","ECHO_OUTPUT_VARIABLE","ECHO_ERROR_VARIABLE","OUTPUT_STRIP_TRAILING_WHITESPACE"]},list:{controlKeywords:["APPEND","INSERT","REMOVE_AT","REMOVE_ITEM","FIND","LENGTH","GET","SUBLIST","SORT","UNIQUE"]},set_target_properties:{controlKeywords:["PROPERTIES"]},target_sources:{controlKeywords:["INTERFACE","PUBLIC","PRIVATE","FILE_SET","TYPE","BASE_DIRS","FILES"],options:["HEADERS","CXX_MODULES"]},target_precompile_headers:{controlKeywords:["INTERFACE","PUBLIC","PRIVATE","REUSE_FROM"]},target_compile_definitions:{controlKeywords:["INTERFACE","PUBLIC","PRIVATE"]},target_include_directories:{controlKeywords:["INTERFACE","PUBLIC","PRIVATE"]},target_link_libraries:{controlKeywords:["INTERFACE","PUBLIC","PRIVATE"]},if:{controlKeywords:["AND","OR"],options:["NOT"]},elseif:{controlKeywords:["AND","OR"],options:["NOT"]},while:{controlKeywords:["AND","OR"],options:["NOT"]},set:{indentAfter:0}}};var d2=Object.freeze({controlKeywords:[],indentAfter:-1,options:[]}),U1={controlKeywords:new Set,indentAfter:-1,options:new Set},c2=W1({controlKeywords:j1(y),indentAfter:R0,options:j1(y)}),l2=W1({useTabs:l1,tabWidth:R0,endOfLine:(Q)=>Q===` `||Q===`\r `,printWidth:R0,commands:i1(y,c2)}),G1=e1;function w1(Q){return Q.endOfLine??G1.endOfLine}function p2(){let Q=process.cwd();while(M0.dirname(Q)!=Q){let X=M0.join(Q,".passablerc.json");if(l0.existsSync(X))return X;Q=M0.dirname(Q)}return}function i2(Q){try{let X=l0.readFileSync(Q,"utf-8"),J=JSON.parse(X);return l2(J)?J:{}}catch(X){return console.error(`Error parsing config file at ${Q}:`,X),{}}}function QQ(){let Q=p2();if(Q)return i2(Q);return{}}function o2(Q){return{controlKeywords:new Set(Q.controlKeywords.map((X)=>X.toUpperCase())),options:new Set(Q.options.map((X)=>X.toUpperCase())),indentAfter:Q.indentAfter??0}}function XQ(Q){let X=new Map;for(let[J,$]of Object.entries(Q))X.set(J.toLowerCase(),[J,o2({...d2,...$})]);return X}var z1=(Q,X,J)=>{let $=Q instanceof RegExp?JQ(Q,J):Q,V=X instanceof RegExp?JQ(X,J):X,Z=$!==null&&V!=null&&n2($,V,J);return Z&&{start:Z[0],end:Z[1],pre:J.slice(0,Z[0]),body:J.slice(Z[0]+$.length,Z[1]),post:J.slice(Z[1]+V.length)}},JQ=(Q,X)=>{let J=X.match(Q);return J?J[0]:null},n2=(Q,X,J)=>{let $,V,Z,_=void 0,K,Y=J.indexOf(Q),H=J.indexOf(X,Y+1),q=Y;if(Y>=0&&H>0){if(Q===X)return[Y,H];$=[],Z=J.length;while(q>=0&&!K){if(q===Y)$.push(q),Y=J.indexOf(Q,q+1);else if($.length===1){let W=$.pop();if(W!==void 0)K=[W,H]}else{if(V=$.pop(),V!==void 0&&V<Z)Z=V,_=H;H=J.indexOf(X,q+1)}q=Y<H&&Y>=0?Y:H}if($.length&&_!==void 0)K=[Z,_]}return K};var $Q="\x00SLASH"+Math.random()+"\x00",VQ="\x00OPEN"+Math.random()+"\x00",B1="\x00CLOSE"+Math.random()+"\x00",ZQ="\x00COMMA"+Math.random()+"\x00",_Q="\x00PERIOD"+Math.random()+"\x00",r2=new RegExp($Q,"g"),a2=new RegExp(VQ,"g"),s2=new RegExp(B1,"g"),t2=new RegExp(ZQ,"g"),e2=new RegExp(_Q,"g"),QX=/\\\\/g,XX=/\\{/g,JX=/\\}/g,$X=/\\,/g,VX=/\\./g;function O1(Q){return!isNaN(Q)?parseInt(Q,10):Q.charCodeAt(0)}function ZX(Q){return Q.replace(QX,$Q).replace(XX,VQ).replace(JX,B1).replace($X,ZQ).replace(VX,_Q)}function _X(Q){return Q.replace(r2,"\\").replace(a2,"{").replace(s2,"}").replace(t2,",").replace(e2,".")}function KQ(Q){if(!Q)return[""];let X=[],J=z1("{","}",Q);if(!J)return Q.split(",");let{pre:$,body:V,post:Z}=J,_=$.split(",");_[_.length-1]+="{"+V+"}";let K=KQ(Z);if(Z.length)_[_.length-1]+=K.shift(),_.push.apply(_,K);return X.push.apply(X,_),X}function YQ(Q){if(!Q)return[];if(Q.slice(0,2)==="{}")Q="\\{\\}"+Q.slice(2);return A0(ZX(Q),!0).map(_X)}function KX(Q){return"{"+Q+"}"}function YX(Q){return/^-?0\d/.test(Q)}function qX(Q,X){return Q<=X}function HX(Q,X){return Q>=X}function A0(Q,X){let J=[],$=z1("{","}",Q);if(!$)return[Q];let V=$.pre,Z=$.post.length?A0($.post,!1):[""];if(/\$$/.test($.pre))for(let _=0;_<Z.length;_++){let K=V+"{"+$.body+"}"+Z[_];J.push(K)}else{let _=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test($.body),K=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test($.body),Y=_||K,H=$.body.indexOf(",")>=0;if(!Y&&!H){if($.post.match(/,(?!,).*\}/))return Q=$.pre+"{"+$.body+B1+$.post,A0(Q);return[Q]}let q;if(Y)q=$.body.split(/\.\./);else if(q=KQ($.body),q.length===1&&q[0]!==void 0){if(q=A0(q[0],!1).map(KX),q.length===1)return Z.map((U)=>$.pre+q[0]+U)}let W;if(Y&&q[0]!==void 0&&q[1]!==void 0){let U=O1(q[0]),O=O1(q[1]),w=Math.max(q[0].length,q[1].length),I=q.length===3&&q[2]!==void 0?Math.abs(O1(q[2])):1,R=qX;if(O<U)I*=-1,R=HX;let F=q.some(YX);W=[];for(let G=U;R(G,O);G+=I){let B;if(K){if(B=String.fromCharCode(G),B==="\\")B=""}else if(B=String(G),F){let A=w-B.length;if(A>0){let j=new Array(A+1).join("0");if(G<0)B="-"+j+B.slice(1);else B=j+B}}W.push(B)}}else{W=[];for(let U=0;U<q.length;U++)W.push.apply(W,A0(q[U],!1))}for(let U=0;U<W.length;U++)for(let O=0;O<Z.length;O++){let w=V+W[U]+Z[O];if(!X||Y||w)J.push(w)}}return J}var F0=(Q)=>{if(typeof Q!=="string")throw new TypeError("invalid pattern");if(Q.length>65536)throw new TypeError("pattern is too long")};var jX={"[: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]},C0=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),WX=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),qQ=(Q)=>Q.join(""),HQ=(Q,X)=>{let J=X;if(Q.charAt(J)!=="[")throw new Error("not in a brace expression");let $=[],V=[],Z=J+1,_=!1,K=!1,Y=!1,H=!1,q=J,W="";Q:while(Z<Q.length){let I=Q.charAt(Z);if((I==="!"||I==="^")&&Z===J+1){H=!0,Z++;continue}if(I==="]"&&_&&!Y){q=Z+1;break}if(_=!0,I==="\\"){if(!Y){Y=!0,Z++;continue}}if(I==="["&&!Y){for(let[R,[M,F,G]]of Object.entries(jX))if(Q.startsWith(R,Z)){if(W)return["$.",!1,Q.length-J,!0];if(Z+=R.length,G)V.push(M);else $.push(M);K=K||F;continue Q}}if(Y=!1,W){if(I>W)$.push(C0(W)+"-"+C0(I));else if(I===W)$.push(C0(I));W="",Z++;continue}if(Q.startsWith("-]",Z+1)){$.push(C0(I+"-")),Z+=2;continue}if(Q.startsWith("-",Z+1)){W=I,Z+=2;continue}$.push(C0(I)),Z++}if(q<Z)return["",!1,0,!1];if(!$.length&&!V.length)return["$.",!1,Q.length-J,!0];if(V.length===0&&$.length===1&&/^\\?.$/.test($[0])&&!H){let I=$[0].length===2?$[0].slice(-1):$[0];return[WX(I),!1,q-J,!1]}let U="["+(H?"^":"")+qQ($)+"]",O="["+(H?"":"^")+qQ(V)+"]";return[$.length&&V.length?"("+U+"|"+O+")":$.length?U:O,K,q-J,!0]};var l=(Q,{windowsPathsNoEscape:X=!1}={})=>{return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var UX=new Set(["!","?","+","*","@"]),jQ=(Q)=>UX.has(Q),GX="(?!(?:^|/)\\.\\.?(?:$|/))",p0="(?!\\.)",wX=new Set(["[","."]),zX=new Set(["..","."]),OX=new Set("().*{}+?[]^$\\!"),BX=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),R1="[^/]",WQ=R1+"*?",UQ=R1+"+?";class v{type;#Q;#X;#Z=!1;#V=[];#_;#I;#O;#K=!1;#j;#Y;#q=!1;constructor(Q,X,J={}){if(this.type=Q,Q)this.#X=!0;if(this.#_=X,this.#Q=this.#_?this.#_.#Q:this,this.#j=this.#Q===this?J:this.#Q.#j,this.#O=this.#Q===this?[]:this.#Q.#O,Q==="!"&&!this.#Q.#K)this.#O.push(this);this.#I=this.#_?this.#_.#V.length:0}get hasMagic(){if(this.#X!==void 0)return this.#X;for(let Q of this.#V){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#X=!0}return this.#X}toString(){if(this.#Y!==void 0)return this.#Y;if(!this.type)return this.#Y=this.#V.map((Q)=>String(Q)).join("");else return this.#Y=this.type+"("+this.#V.map((Q)=>String(Q)).join("|")+")"}#J(){if(this!==this.#Q)throw new Error("should only call on root");if(this.#K)return this;this.toString(),this.#K=!0;let Q;while(Q=this.#O.pop()){if(Q.type!=="!")continue;let X=Q,J=X.#_;while(J){for(let $=X.#I+1;!J.type&&$<J.#V.length;$++)for(let V of Q.#V){if(typeof V==="string")throw new Error("string part in extglob AST??");V.copyIn(J.#V[$])}X=J,J=X.#_}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof v&&X.#_===this))throw new Error("invalid part: "+X);this.#V.push(X)}}toJSON(){let Q=this.type===null?this.#V.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#V.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#K&&this.#_?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#_?.isStart())return!1;if(this.#I===0)return!0;let Q=this.#_;for(let X=0;X<this.#I;X++){let J=Q.#V[X];if(!(J instanceof v&&J.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#_?.type==="!")return!0;if(!this.#_?.isEnd())return!1;if(!this.type)return this.#_?.isEnd();let Q=this.#_?this.#_.#V.length:0;return this.#I===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new v(this.type,Q);for(let J of this.#V)X.copyIn(J);return X}static#W(Q,X,J,$){let V=!1,Z=!1,_=-1,K=!1;if(X.type===null){let U=J,O="";while(U<Q.length){let w=Q.charAt(U++);if(V||w==="\\"){V=!V,O+=w;continue}if(Z){if(U===_+1){if(w==="^"||w==="!")K=!0}else if(w==="]"&&!(U===_+2&&K))Z=!1;O+=w;continue}else if(w==="["){Z=!0,_=U,K=!1,O+=w;continue}if(!$.noext&&jQ(w)&&Q.charAt(U)==="("){X.push(O),O="";let I=new v(w,X);U=v.#W(Q,I,U,$),X.push(I);continue}O+=w}return X.push(O),U}let Y=J+1,H=new v(null,X),q=[],W="";while(Y<Q.length){let U=Q.charAt(Y++);if(V||U==="\\"){V=!V,W+=U;continue}if(Z){if(Y===_+1){if(U==="^"||U==="!")K=!0}else if(U==="]"&&!(Y===_+2&&K))Z=!1;W+=U;continue}else if(U==="["){Z=!0,_=Y,K=!1,W+=U;continue}if(jQ(U)&&Q.charAt(Y)==="("){H.push(W),W="";let O=new v(U,H);H.push(O),Y=v.#W(Q,O,Y,$);continue}if(U==="|"){H.push(W),W="",q.push(H),H=new v(null,X);continue}if(U===")"){if(W===""&&X.#V.length===0)X.#q=!0;return H.push(W),W="",X.push(...q,H),Y}W+=U}return X.type=null,X.#X=void 0,X.#V=[Q.substring(J-1)],Y}static fromGlob(Q,X={}){let J=new v(null,void 0,X);return v.#W(Q,J,0,X),J}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,J,$,V]=this.toRegExpSource();if(!($||this.#X||this.#j.nocase&&!this.#j.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return J;let _=(this.#j.nocase?"i":"")+(V?"u":"");return Object.assign(new RegExp(`^${X}$`,_),{_src:X,_glob:Q})}get options(){return this.#j}toRegExpSource(Q){let X=Q??!!this.#j.dot;if(this.#Q===this)this.#J();if(!this.type){let K=this.isStart()&&this.isEnd(),Y=this.#V.map((U)=>{let[O,w,I,R]=typeof U==="string"?v.#G(U,this.#X,K):U.toRegExpSource(Q);return this.#X=this.#X||I,this.#Z=this.#Z||R,O}).join(""),H="";if(this.isStart()){if(typeof this.#V[0]==="string"){if(!(this.#V.length===1&&zX.has(this.#V[0]))){let O=wX,w=X&&O.has(Y.charAt(0))||Y.startsWith("\\.")&&O.has(Y.charAt(2))||Y.startsWith("\\.\\.")&&O.has(Y.charAt(4)),I=!X&&!Q&&O.has(Y.charAt(0));H=w?GX:I?p0:""}}}let q="";if(this.isEnd()&&this.#Q.#K&&this.#_?.type==="!")q="(?:$|\\/)";return[H+Y+q,l(Y),this.#X=!!this.#X,this.#Z]}let J=this.type==="*"||this.type==="+",$=this.type==="!"?"(?:(?!(?:":"(?:",V=this.#B(X);if(this.isStart()&&this.isEnd()&&!V&&this.type!=="!"){let K=this.toString();return this.#V=[K],this.type=null,this.#X=void 0,[K,l(this.toString()),!1,!1]}let Z=!J||Q||X||!p0?"":this.#B(!0);if(Z===V)Z="";if(Z)V=`(?:${V})(?:${Z})*?`;let _="";if(this.type==="!"&&this.#q)_=(this.isStart()&&!X?p0:"")+UQ;else{let K=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?p0:"")+WQ+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&Z?")":this.type==="*"&&Z?")?":`)${this.type}`;_=$+V+K}return[_,l(V),this.#X=!!this.#X,this.#Z]}#B(Q){return this.#V.map((X)=>{if(typeof X==="string")throw new Error("string type in extglob ast??");let[J,$,V,Z]=X.toRegExpSource(Q);return this.#Z=this.#Z||Z,J}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#G(Q,X,J=!1){let $=!1,V="",Z=!1;for(let _=0;_<Q.length;_++){let K=Q.charAt(_);if($){$=!1,V+=(OX.has(K)?"\\":"")+K;continue}if(K==="\\"){if(_===Q.length-1)V+="\\\\";else $=!0;continue}if(K==="["){let[Y,H,q,W]=HQ(Q,_);if(q){V+=Y,Z=Z||H,_+=q-1,X=X||W;continue}}if(K==="*"){if(J&&Q==="*")V+=UQ;else V+=WQ;X=!0;continue}if(K==="?"){V+=R1,X=!0;continue}V+=BX(K)}return[V,l(Q),!!X,Z]}}var Y0=(Q,{windowsPathsNoEscape:X=!1}={})=>{return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var b=(Q,X,J={})=>{if(F0(X),!J.nocomment&&X.charAt(0)==="#")return!1;return new g(X,J).match(Q)},RX=/^\*+([^+@!?\*\[\(]*)$/,IX=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),MX=(Q)=>(X)=>X.endsWith(Q),AX=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},FX=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},CX=/^\*+\.\*+$/,LX=(Q)=>!Q.startsWith(".")&&Q.includes("."),NX=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),DX=/^\.\*+$/,uX=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),EX=/^\*+$/,SX=(Q)=>Q.length!==0&&!Q.startsWith("."),vX=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",PX=/^\?+([^+@!?\*\[\(]*)?$/,fX=([Q,X=""])=>{let J=zQ([Q]);if(!X)return J;return X=X.toLowerCase(),($)=>J($)&&$.toLowerCase().endsWith(X)},bX=([Q,X=""])=>{let J=OQ([Q]);if(!X)return J;return X=X.toLowerCase(),($)=>J($)&&$.toLowerCase().endsWith(X)},xX=([Q,X=""])=>{let J=OQ([Q]);return!X?J:($)=>J($)&&$.endsWith(X)},TX=([Q,X=""])=>{let J=zQ([Q]);return!X?J:($)=>J($)&&$.endsWith(X)},zQ=([Q])=>{let X=Q.length;return(J)=>J.length===X&&!J.startsWith(".")},OQ=([Q])=>{let X=Q.length;return(J)=>J.length===X&&J!=="."&&J!==".."},BQ=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",GQ={win32:{sep:"\\"},posix:{sep:"/"}},yX=BQ==="win32"?GQ.win32.sep:GQ.posix.sep;b.sep=yX;var P=Symbol("globstar **");b.GLOBSTAR=P;var kX="[^/]",mX=kX+"*?",hX="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",gX="(?:(?!(?:\\/|^)\\.).)*?",dX=(Q,X={})=>(J)=>b(J,Q,X);b.filter=dX;var h=(Q,X={})=>Object.assign({},Q,X),cX=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return b;let X=b;return Object.assign(($,V,Z={})=>X($,V,h(Q,Z)),{Minimatch:class $ extends X.Minimatch{constructor(V,Z={}){super(V,h(Q,Z))}static defaults(V){return X.defaults(h(Q,V)).Minimatch}},AST:class $ extends X.AST{constructor(V,Z,_={}){super(V,Z,h(Q,_))}static fromGlob(V,Z={}){return X.AST.fromGlob(V,h(Q,Z))}},unescape:($,V={})=>X.unescape($,h(Q,V)),escape:($,V={})=>X.escape($,h(Q,V)),filter:($,V={})=>X.filter($,h(Q,V)),defaults:($)=>X.defaults(h(Q,$)),makeRe:($,V={})=>X.makeRe($,h(Q,V)),braceExpand:($,V={})=>X.braceExpand($,h(Q,V)),match:($,V,Z={})=>X.match($,V,h(Q,Z)),sep:X.sep,GLOBSTAR:P})};b.defaults=cX;var RQ=(Q,X={})=>{if(F0(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return YQ(Q)};b.braceExpand=RQ;var lX=(Q,X={})=>new g(Q,X).makeRe();b.makeRe=lX;var pX=(Q,X,J={})=>{let $=new g(X,J);if(Q=Q.filter((V)=>$.match(V)),$.options.nonull&&!Q.length)Q.push(X);return Q};b.match=pX;var wQ=/[?*]|[+@!]\(.*?\)|\[|\]/,iX=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class g{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Q,X={}){if(F0(Q),X=X||{},this.options=X,this.pattern=Q,this.platform=X.platform||BQ,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.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(let Q of this.set)for(let X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...V)=>console.error(...V);this.debug(this.pattern,this.globSet);let J=this.globSet.map((V)=>this.slashSplit(V));this.globParts=this.preprocess(J),this.debug(this.pattern,this.globParts);let $=this.globParts.map((V,Z,_)=>{if(this.isWindows&&this.windowsNoMagicRoot){let K=V[0]===""&&V[1]===""&&(V[2]==="?"||!wQ.test(V[2]))&&!wQ.test(V[3]),Y=/^[a-z]:/i.test(V[0]);if(K)return[...V.slice(0,4),...V.slice(4).map((H)=>this.parse(H))];else if(Y)return[V[0],...V.slice(1).map((H)=>this.parse(H))]}return V.map((K)=>this.parse(K))});if(this.debug(this.pattern,$),this.set=$.filter((V)=>V.indexOf(!1)===-1),this.isWindows)for(let V=0;V<this.set.length;V++){let Z=this.set[V];if(Z[0]===""&&Z[1]===""&&this.globParts[V][2]==="?"&&typeof Z[3]==="string"&&/^[a-z]:$/i.test(Z[3]))Z[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let J=0;J<Q.length;J++)for(let $=0;$<Q[J].length;$++)if(Q[J][$]==="**")Q[J][$]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let J=-1;while((J=X.indexOf("**",J+1))!==-1){let $=J;while(X[$+1]==="**")$++;if($!==J)X.splice(J,$-J)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce((J,$)=>{let V=J[J.length-1];if($==="**"&&V==="**")return J;if($===".."){if(V&&V!==".."&&V!=="."&&V!=="**")return J.pop(),J}return J.push($),J},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let $=1;$<Q.length-1;$++){let V=Q[$];if($===1&&V===""&&Q[0]==="")continue;if(V==="."||V==="")X=!0,Q.splice($,1),$--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let J=0;while((J=Q.indexOf("..",J+1))!==-1){let $=Q[J-1];if($&&$!=="."&&$!==".."&&$!=="**")X=!0,Q.splice(J-1,2),J-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let J of Q){let $=-1;while(($=J.indexOf("**",$+1))!==-1){let Z=$;while(J[Z+1]==="**")Z++;if(Z>$)J.splice($+1,Z-$);let _=J[$+1],K=J[$+2],Y=J[$+3];if(_!=="..")continue;if(!K||K==="."||K===".."||!Y||Y==="."||Y==="..")continue;X=!0,J.splice($,1);let H=J.slice(0);H[$]="**",Q.push(H),$--}if(!this.preserveMultipleSlashes){for(let Z=1;Z<J.length-1;Z++){let _=J[Z];if(Z===1&&_===""&&J[0]==="")continue;if(_==="."||_==="")X=!0,J.splice(Z,1),Z--}if(J[0]==="."&&J.length===2&&(J[1]==="."||J[1]===""))X=!0,J.pop()}let V=0;while((V=J.indexOf("..",V+1))!==-1){let Z=J[V-1];if(Z&&Z!=="."&&Z!==".."&&Z!=="**"){X=!0;let K=V===1&&J[V+1]==="**"?["."]:[];if(J.splice(V-1,2,...K),J.length===0)J.push("");V-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let J=X+1;J<Q.length;J++){let $=this.partsMatch(Q[X],Q[J],!this.preserveMultipleSlashes);if($){Q[X]=[],Q[J]=$;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,J=!1){let $=0,V=0,Z=[],_="";while($<Q.length&&V<X.length)if(Q[$]===X[V])Z.push(_==="b"?X[V]:Q[$]),$++,V++;else if(J&&Q[$]==="**"&&X[V]===Q[$+1])Z.push(Q[$]),$++;else if(J&&X[V]==="**"&&Q[$]===X[V+1])Z.push(X[V]),V++;else if(Q[$]==="*"&&X[V]&&(this.options.dot||!X[V].startsWith("."))&&X[V]!=="**"){if(_==="b")return!1;_="a",Z.push(Q[$]),$++,V++}else if(X[V]==="*"&&Q[$]&&(this.options.dot||!Q[$].startsWith("."))&&Q[$]!=="**"){if(_==="a")return!1;_="b",Z.push(X[V]),$++,V++}else return!1;return Q.length===X.length&&Z}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,J=0;for(let $=0;$<Q.length&&Q.charAt($)==="!";$++)X=!X,J++;if(J)this.pattern=Q.slice(J);this.negate=X}matchOne(Q,X,J=!1){let $=this.options;if(this.isWindows){let w=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),I=!w&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),R=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),M=!R&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),F=I?3:w?0:void 0,G=M?3:R?0:void 0;if(typeof F==="number"&&typeof G==="number"){let[B,A]=[Q[F],X[G]];if(B.toLowerCase()===A.toLowerCase()){if(X[G]=B,G>F)X=X.slice(G);else if(F>G)Q=Q.slice(F)}}}let{optimizationLevel:V=1}=this.options;if(V>=2)Q=this.levelTwoFileOptimize(Q);this.debug("matchOne",this,{file:Q,pattern:X}),this.debug("matchOne",Q.length,X.length);for(var Z=0,_=0,K=Q.length,Y=X.length;Z<K&&_<Y;Z++,_++){this.debug("matchOne loop");var H=X[_],q=Q[Z];if(this.debug(X,H,q),H===!1)return!1;if(H===P){this.debug("GLOBSTAR",[X,H,q]);var W=Z,U=_+1;if(U===Y){this.debug("** at the end");for(;Z<K;Z++)if(Q[Z]==="."||Q[Z]===".."||!$.dot&&Q[Z].charAt(0)===".")return!1;return!0}while(W<K){var O=Q[W];if(this.debug(` globstar while`,Q,W,X,U,O),this.matchOne(Q.slice(W),X.slice(U),J))return this.debug("globstar found match!",W,K,O),!0;else{if(O==="."||O===".."||!$.dot&&O.charAt(0)==="."){this.debug("dot detected!",Q,W,X,U);break}this.debug("globstar swallow a segment, and continue"),W++}}if(J){if(this.debug(` >>> no match, partial?`,Q,W,X,U),W===K)return!0}return!1}let w;if(typeof H==="string")w=q===H,this.debug("string match",H,q,w);else w=H.test(q),this.debug("pattern match",H,q,w);if(!w)return!1}if(Z===K&&_===Y)return!0;else if(Z===K)return J;else if(_===Y)return Z===K-1&&Q[Z]==="";else throw new Error("wtf?")}braceExpand(){return RQ(this.pattern,this.options)}parse(Q){F0(Q);let X=this.options;if(Q==="**")return P;if(Q==="")return"";let J,$=null;if(J=Q.match(EX))$=X.dot?vX:SX;else if(J=Q.match(RX))$=(X.nocase?X.dot?FX:AX:X.dot?MX:IX)(J[1]);else if(J=Q.match(PX))$=(X.nocase?X.dot?bX:fX:X.dot?xX:TX)(J);else if(J=Q.match(CX))$=X.dot?NX:LX;else if(J=Q.match(DX))$=uX;let V=v.fromGlob(Q,this.options).toMMPattern();if($&&typeof V==="object")Reflect.defineProperty(V,"test",{value:$});return V}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,J=X.noglobstar?mX:X.dot?hX:gX,$=new Set(X.nocase?["i"]:[]),V=Q.map((K)=>{let Y=K.map((H)=>{if(H instanceof RegExp)for(let q of H.flags.split(""))$.add(q);return typeof H==="string"?iX(H):H===P?P:H._src});return Y.forEach((H,q)=>{let W=Y[q+1],U=Y[q-1];if(H!==P||U===P)return;if(U===void 0)if(W!==void 0&&W!==P)Y[q+1]="(?:\\/|"+J+"\\/)?"+W;else Y[q]=J;else if(W===void 0)Y[q-1]=U+"(?:\\/|"+J+")?";else if(W!==P)Y[q-1]=U+"(?:\\/|\\/"+J+"\\/)"+W,Y[q+1]=P}),Y.filter((H)=>H!==P).join("/")}).join("|"),[Z,_]=Q.length>1?["(?:",")"]:["",""];if(V="^"+Z+V+_+"$",this.negate)V="^(?!"+V+").+$";try{this.regexp=new RegExp(V,[...$].join(""))}catch(K){this.regexp=!1}return this.regexp}slashSplit(Q){if(this.preserveMultipleSlashes)return Q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Q))return["",...Q.split(/\/+/)];else return Q.split(/\/+/)}match(Q,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let J=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let $=this.slashSplit(Q);this.debug(this.pattern,"split",$);let V=this.set;this.debug(this.pattern,"set",V);let Z=$[$.length-1];if(!Z)for(let _=$.length-2;!Z&&_>=0;_--)Z=$[_];for(let _=0;_<V.length;_++){let K=V[_],Y=$;if(J.matchBase&&K.length===1)Y=[Z];if(this.matchOne(Y,K,X)){if(J.flipNegate)return!0;return!this.negate}}if(J.flipNegate)return!1;return this.negate}static defaults(Q){return b.defaults(Q).Minimatch}}b.AST=v;b.Minimatch=g;b.escape=Y0;b.unescape=l;import{fileURLToPath as C5}from"node:url";var q0=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,MQ=new Set,I1=typeof process==="object"&&!!process?process:{},AQ=(Q,X,J,$)=>{typeof I1.emitWarning==="function"?I1.emitWarning(Q,X,J,$):console.error(`[${J}] ${X}: ${Q}`)},i0=globalThis.AbortController,IQ=globalThis.AbortSignal;if(typeof i0==="undefined"){IQ=class J{onabort;_onabort=[];reason;aborted=!1;addEventListener($,V){this._onabort.push(V)}},i0=class J{constructor(){X()}signal=new IQ;abort($){if(this.signal.aborted)return;this.signal.reason=$,this.signal.aborted=!0;for(let V of this.signal._onabort)V($);this.signal.onabort?.($)}};let Q=I1.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{if(!Q)return;Q=!1,AQ("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",X)}}var oX=(Q)=>!MQ.has(Q),m6=Symbol("type"),X0=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),FQ=(Q)=>!X0(Q)?null:Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?L0:null;class L0 extends Array{constructor(Q){super(Q);this.fill(0)}}class H0{heap;length;static#Q=!1;static create(Q){let X=FQ(Q);if(!X)return[];H0.#Q=!0;let J=new H0(Q,X);return H0.#Q=!1,J}constructor(Q,X){if(!H0.#Q)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new X(Q),this.length=0}push(Q){this.heap[this.length++]=Q}pop(){return this.heap[--this.length]}}class N0{#Q;#X;#Z;#V;#_;#I;#O;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#K;#j;#Y;#q;#J;#W;#B;#G;#w;#D;#z;#u;#A;#M;#R;#L;#U;#S;static unsafeExposeInternals(Q){return{starts:Q.#A,ttls:Q.#M,sizes:Q.#u,keyMap:Q.#Y,keyList:Q.#q,valList:Q.#J,next:Q.#W,prev:Q.#B,get head(){return Q.#G},get tail(){return Q.#w},free:Q.#D,isBackgroundFetch:(X)=>Q.#H(X),backgroundFetch:(X,J,$,V)=>Q.#x(X,J,$,V),moveToTail:(X)=>Q.#k(X),indexes:(X)=>Q.#N(X),rindexes:(X)=>Q.#E(X),isStale:(X)=>Q.#C(X)}}get max(){return this.#Q}get maxSize(){return this.#X}get calculatedSize(){return this.#j}get size(){return this.#K}get fetchMethod(){return this.#I}get memoMethod(){return this.#O}get dispose(){return this.#Z}get onInsert(){return this.#V}get disposeAfter(){return this.#_}constructor(Q){let{max:X=0,ttl:J,ttlResolution:$=1,ttlAutopurge:V,updateAgeOnGet:Z,updateAgeOnHas:_,allowStale:K,dispose:Y,onInsert:H,disposeAfter:q,noDisposeOnSet:W,noUpdateTTL:U,maxSize:O=0,maxEntrySize:w=0,sizeCalculation:I,fetchMethod:R,memoMethod:M,noDeleteOnFetchRejection:F,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:B,allowStaleOnFetchAbort:A,ignoreFetchAbort:j}=Q;if(X!==0&&!X0(X))throw new TypeError("max option must be a nonnegative integer");let z=X?FQ(X):Array;if(!z)throw new Error("invalid max value: "+X);if(this.#Q=X,this.#X=O,this.maxEntrySize=w||this.#X,this.sizeCalculation=I,this.sizeCalculation){if(!this.#X&&!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(M!==void 0&&typeof M!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#O=M,R!==void 0&&typeof R!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#I=R,this.#L=!!R,this.#Y=new Map,this.#q=new Array(X).fill(void 0),this.#J=new Array(X).fill(void 0),this.#W=new z(X),this.#B=new z(X),this.#G=0,this.#w=0,this.#D=H0.create(X),this.#K=0,this.#j=0,typeof Y==="function")this.#Z=Y;if(typeof H==="function")this.#V=H;if(typeof q==="function")this.#_=q,this.#z=[];else this.#_=void 0,this.#z=void 0;if(this.#R=!!this.#Z,this.#S=!!this.#V,this.#U=!!this.#_,this.noDisposeOnSet=!!W,this.noUpdateTTL=!!U,this.noDeleteOnFetchRejection=!!F,this.allowStaleOnFetchRejection=!!B,this.allowStaleOnFetchAbort=!!A,this.ignoreFetchAbort=!!j,this.maxEntrySize!==0){if(this.#X!==0){if(!X0(this.#X))throw new TypeError("maxSize must be a positive integer if specified")}if(!X0(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#h()}if(this.allowStale=!!K,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!Z,this.updateAgeOnHas=!!_,this.ttlResolution=X0($)||$===0?$:1,this.ttlAutopurge=!!V,this.ttl=J||0,this.ttl){if(!X0(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#$()}if(this.#Q===0&&this.ttl===0&&this.#X===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#X){if(oX("LRU_CACHE_UNBOUNDED"))MQ.add("LRU_CACHE_UNBOUNDED"),AQ("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",N0)}}getRemainingTTL(Q){return this.#Y.has(Q)?1/0:0}#$(){let Q=new L0(this.#Q),X=new L0(this.#Q);this.#M=Q,this.#A=X,this.#v=(V,Z,_=q0.now())=>{if(X[V]=Z!==0?_:0,Q[V]=Z,Z!==0&&this.ttlAutopurge){let K=setTimeout(()=>{if(this.#C(V))this.#P(this.#q[V],"expire")},Z+1);if(K.unref)K.unref()}},this.#f=(V)=>{X[V]=Q[V]!==0?q0.now():0},this.#F=(V,Z)=>{if(Q[Z]){let _=Q[Z],K=X[Z];if(!_||!K)return;V.ttl=_,V.start=K,V.now=J||$();let Y=V.now-K;V.remainingTTL=_-Y}};let J=0,$=()=>{let V=q0.now();if(this.ttlResolution>0){J=V;let Z=setTimeout(()=>J=0,this.ttlResolution);if(Z.unref)Z.unref()}return V};this.getRemainingTTL=(V)=>{let Z=this.#Y.get(V);if(Z===void 0)return 0;let _=Q[Z],K=X[Z];if(!_||!K)return 1/0;let Y=(J||$())-K;return _-Y},this.#C=(V)=>{let Z=X[V],_=Q[V];return!!_&&!!Z&&(J||$())-Z>_}}#f=()=>{};#F=()=>{};#v=()=>{};#C=()=>!1;#h(){let Q=new L0(this.#Q);this.#j=0,this.#u=Q,this.#b=(X)=>{this.#j-=Q[X],Q[X]=0},this.#g=(X,J,$,V)=>{if(this.#H(J))return 0;if(!X0($))if(V){if(typeof V!=="function")throw new TypeError("sizeCalculation must be a function");if($=V(J,X),!X0($))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 $},this.#T=(X,J,$)=>{if(Q[X]=J,this.#X){let V=this.#X-Q[X];while(this.#j>V)this.#y(!0)}if(this.#j+=Q[X],$)$.entrySize=J,$.totalCalculatedSize=this.#j}}#b=(Q)=>{};#T=(Q,X,J)=>{};#g=(Q,X,J,$)=>{if(J||$)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#N({allowStale:Q=this.allowStale}={}){if(this.#K)for(let X=this.#w;;){if(!this.#d(X))break;if(Q||!this.#C(X))yield X;if(X===this.#G)break;else X=this.#B[X]}}*#E({allowStale:Q=this.allowStale}={}){if(this.#K)for(let X=this.#G;;){if(!this.#d(X))break;if(Q||!this.#C(X))yield X;if(X===this.#w)break;else X=this.#W[X]}}#d(Q){return Q!==void 0&&this.#Y.get(this.#q[Q])===Q}*entries(){for(let Q of this.#N())if(this.#J[Q]!==void 0&&this.#q[Q]!==void 0&&!this.#H(this.#J[Q]))yield[this.#q[Q],this.#J[Q]]}*rentries(){for(let Q of this.#E())if(this.#J[Q]!==void 0&&this.#q[Q]!==void 0&&!this.#H(this.#J[Q]))yield[this.#q[Q],this.#J[Q]]}*keys(){for(let Q of this.#N()){let X=this.#q[Q];if(X!==void 0&&!this.#H(this.#J[Q]))yield X}}*rkeys(){for(let Q of this.#E()){let X=this.#q[Q];if(X!==void 0&&!this.#H(this.#J[Q]))yield X}}*values(){for(let Q of this.#N())if(this.#J[Q]!==void 0&&!this.#H(this.#J[Q]))yield this.#J[Q]}*rvalues(){for(let Q of this.#E())if(this.#J[Q]!==void 0&&!this.#H(this.#J[Q]))yield this.#J[Q]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Q,X={}){for(let J of this.#N()){let $=this.#J[J],V=this.#H($)?$.__staleWhileFetching:$;if(V===void 0)continue;if(Q(V,this.#q[J],this))return this.get(this.#q[J],X)}}forEach(Q,X=this){for(let J of this.#N()){let $=this.#J[J],V=this.#H($)?$.__staleWhileFetching:$;if(V===void 0)continue;Q.call(X,V,this.#q[J],this)}}rforEach(Q,X=this){for(let J of this.#E()){let $=this.#J[J],V=this.#H($)?$.__staleWhileFetching:$;if(V===void 0)continue;Q.call(X,V,this.#q[J],this)}}purgeStale(){let Q=!1;for(let X of this.#E({allowStale:!0}))if(this.#C(X))this.#P(this.#q[X],"expire"),Q=!0;return Q}info(Q){let X=this.#Y.get(Q);if(X===void 0)return;let J=this.#J[X],$=this.#H(J)?J.__staleWhileFetching:J;if($===void 0)return;let V={value:$};if(this.#M&&this.#A){let Z=this.#M[X],_=this.#A[X];if(Z&&_){let K=Z-(q0.now()-_);V.ttl=K,V.start=Date.now()}}if(this.#u)V.size=this.#u[X];return V}dump(){let Q=[];for(let X of this.#N({allowStale:!0})){let J=this.#q[X],$=this.#J[X],V=this.#H($)?$.__staleWhileFetching:$;if(V===void 0||J===void 0)continue;let Z={value:V};if(this.#M&&this.#A){Z.ttl=this.#M[X];let _=q0.now()-this.#A[X];Z.start=Math.floor(Date.now()-_)}if(this.#u)Z.size=this.#u[X];Q.unshift([J,Z])}return Q}load(Q){this.clear();for(let[X,J]of Q){if(J.start){let $=Date.now()-J.start;J.start=q0.now()-$}this.set(X,J.value,J)}}set(Q,X,J={}){if(X===void 0)return this.delete(Q),this;let{ttl:$=this.ttl,start:V,noDisposeOnSet:Z=this.noDisposeOnSet,sizeCalculation:_=this.sizeCalculation,status:K}=J,{noUpdateTTL:Y=this.noUpdateTTL}=J,H=this.#g(Q,X,J.size||0,_);if(this.maxEntrySize&&H>this.maxEntrySize){if(K)K.set="miss",K.maxEntrySizeExceeded=!0;return this.#P(Q,"set"),this}let q=this.#K===0?void 0:this.#Y.get(Q);if(q===void 0){if(q=this.#K===0?this.#w:this.#D.length!==0?this.#D.pop():this.#K===this.#Q?this.#y(!1):this.#K,this.#q[q]=Q,this.#J[q]=X,this.#Y.set(Q,q),this.#W[this.#w]=q,this.#B[q]=this.#w,this.#w=q,this.#K++,this.#T(q,H,K),K)K.set="add";if(Y=!1,this.#S)this.#V?.(X,Q,"add")}else{this.#k(q);let W=this.#J[q];if(X!==W){if(this.#L&&this.#H(W)){W.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:U}=W;if(U!==void 0&&!Z){if(this.#R)this.#Z?.(U,Q,"set");if(this.#U)this.#z?.push([U,Q,"set"])}}else if(!Z){if(this.#R)this.#Z?.(W,Q,"set");if(this.#U)this.#z?.push([W,Q,"set"])}if(this.#b(q),this.#T(q,H,K),this.#J[q]=X,K){K.set="replace";let U=W&&this.#H(W)?W.__staleWhileFetching:W;if(U!==void 0)K.oldValue=U}}else if(K)K.set="update";if(this.#S)this.onInsert?.(X,Q,X===W?"update":"replace")}if($!==0&&!this.#M)this.#$();if(this.#M){if(!Y)this.#v(q,$,V);if(K)this.#F(K,q)}if(!Z&&this.#U&&this.#z){let W=this.#z,U;while(U=W?.shift())this.#_?.(...U)}return this}pop(){try{while(this.#K){let Q=this.#J[this.#G];if(this.#y(!0),this.#H(Q)){if(Q.__staleWhileFetching)return Q.__staleWhileFetching}else if(Q!==void 0)return Q}}finally{if(this.#U&&this.#z){let Q=this.#z,X;while(X=Q?.shift())this.#_?.(...X)}}}#y(Q){let X=this.#G,J=this.#q[X],$=this.#J[X];if(this.#L&&this.#H($))$.__abortController.abort(new Error("evicted"));else if(this.#R||this.#U){if(this.#R)this.#Z?.($,J,"evict");if(this.#U)this.#z?.push([$,J,"evict"])}if(this.#b(X),Q)this.#q[X]=void 0,this.#J[X]=void 0,this.#D.push(X);if(this.#K===1)this.#G=this.#w=0,this.#D.length=0;else this.#G=this.#W[X];return this.#Y.delete(J),this.#K--,X}has(Q,X={}){let{updateAgeOnHas:J=this.updateAgeOnHas,status:$}=X,V=this.#Y.get(Q);if(V!==void 0){let Z=this.#J[V];if(this.#H(Z)&&Z.__staleWhileFetching===void 0)return!1;if(!this.#C(V)){if(J)this.#f(V);if($)$.has="hit",this.#F($,V);return!0}else if($)$.has="stale",this.#F($,V)}else if($)$.has="miss";return!1}peek(Q,X={}){let{allowStale:J=this.allowStale}=X,$=this.#Y.get(Q);if($===void 0||!J&&this.#C($))return;let V=this.#J[$];return this.#H(V)?V.__staleWhileFetching:V}#x(Q,X,J,$){let V=X===void 0?void 0:this.#J[X];if(this.#H(V))return V;let Z=new i0,{signal:_}=J;_?.addEventListener("abort",()=>Z.abort(_.reason),{signal:Z.signal});let K={signal:Z.signal,options:J,context:$},Y=(w,I=!1)=>{let{aborted:R}=Z.signal,M=J.ignoreFetchAbort&&w!==void 0;if(J.status)if(R&&!I){if(J.status.fetchAborted=!0,J.status.fetchError=Z.signal.reason,M)J.status.fetchAbortIgnored=!0}else J.status.fetchResolved=!0;if(R&&!M&&!I)return q(Z.signal.reason);let F=U;if(this.#J[X]===U)if(w===void 0)if(F.__staleWhileFetching)this.#J[X]=F.__staleWhileFetching;else this.#P(Q,"fetch");else{if(J.status)J.status.fetchUpdated=!0;this.set(Q,w,K.options)}return w},H=(w)=>{if(J.status)J.status.fetchRejected=!0,J.status.fetchError=w;return q(w)},q=(w)=>{let{aborted:I}=Z.signal,R=I&&J.allowStaleOnFetchAbort,M=R||J.allowStaleOnFetchRejection,F=M||J.noDeleteOnFetchRejection,G=U;if(this.#J[X]===U){if(!F||G.__staleWhileFetching===void 0)this.#P(Q,"fetch");else if(!R)this.#J[X]=G.__staleWhileFetching}if(M){if(J.status&&G.__staleWhileFetching!==void 0)J.status.returnedStale=!0;return G.__staleWhileFetching}else if(G.__returned===G)throw w},W=(w,I)=>{let R=this.#I?.(Q,V,K);if(R&&R instanceof Promise)R.then((M)=>w(M===void 0?void 0:M),I);Z.signal.addEventListener("abort",()=>{if(!J.ignoreFetchAbort||J.allowStaleOnFetchAbort){if(w(void 0),J.allowStaleOnFetchAbort)w=(M)=>Y(M,!0)}})};if(J.status)J.status.fetchDispatched=!0;let U=new Promise(W).then(Y,H),O=Object.assign(U,{__abortController:Z,__staleWhileFetching:V,__returned:void 0});if(X===void 0)this.set(Q,O,{...K.options,status:void 0}),X=this.#Y.get(Q);else this.#J[X]=O;return O}#H(Q){if(!this.#L)return!1;let X=Q;return!!X&&X instanceof Promise&&X.hasOwnProperty("__staleWhileFetching")&&X.__abortController instanceof i0}async fetch(Q,X={}){let{allowStale:J=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:V=this.noDeleteOnStaleGet,ttl:Z=this.ttl,noDisposeOnSet:_=this.noDisposeOnSet,size:K=0,sizeCalculation:Y=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:q=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:U=this.ignoreFetchAbort,allowStaleOnFetchAbort:O=this.allowStaleOnFetchAbort,context:w,forceRefresh:I=!1,status:R,signal:M}=X;if(!this.#L){if(R)R.fetch="get";return this.get(Q,{allowStale:J,updateAgeOnGet:$,noDeleteOnStaleGet:V,status:R})}let F={allowStale:J,updateAgeOnGet:$,noDeleteOnStaleGet:V,ttl:Z,noDisposeOnSet:_,size:K,sizeCalculation:Y,noUpdateTTL:H,noDeleteOnFetchRejection:q,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:O,ignoreFetchAbort:U,status:R,signal:M},G=this.#Y.get(Q);if(G===void 0){if(R)R.fetch="miss";let B=this.#x(Q,G,F,w);return B.__returned=B}else{let B=this.#J[G];if(this.#H(B)){let L=J&&B.__staleWhileFetching!==void 0;if(R){if(R.fetch="inflight",L)R.returnedStale=!0}return L?B.__staleWhileFetching:B.__returned=B}let A=this.#C(G);if(!I&&!A){if(R)R.fetch="hit";if(this.#k(G),$)this.#f(G);if(R)this.#F(R,G);return B}let j=this.#x(Q,G,F,w),C=j.__staleWhileFetching!==void 0&&J;if(R){if(R.fetch=A?"stale":"refresh",C&&A)R.returnedStale=!0}return C?j.__staleWhileFetching:j.__returned=j}}async forceFetch(Q,X={}){let J=await this.fetch(Q,X);if(J===void 0)throw new Error("fetch() returned undefined");return J}memo(Q,X={}){let J=this.#O;if(!J)throw new Error("no memoMethod provided to constructor");let{context:$,forceRefresh:V,...Z}=X,_=this.get(Q,Z);if(!V&&_!==void 0)return _;let K=J(Q,_,{options:Z,context:$});return this.set(Q,K,Z),K}get(Q,X={}){let{allowStale:J=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:V=this.noDeleteOnStaleGet,status:Z}=X,_=this.#Y.get(Q);if(_!==void 0){let K=this.#J[_],Y=this.#H(K);if(Z)this.#F(Z,_);if(this.#C(_)){if(Z)Z.get="stale";if(!Y){if(!V)this.#P(Q,"expire");if(Z&&J)Z.returnedStale=!0;return J?K:void 0}else{if(Z&&J&&K.__staleWhileFetching!==void 0)Z.returnedStale=!0;return J?K.__staleWhileFetching:void 0}}else{if(Z)Z.get="hit";if(Y)return K.__staleWhileFetching;if(this.#k(_),$)this.#f(_);return K}}else if(Z)Z.get="miss"}#c(Q,X){this.#B[X]=Q,this.#W[Q]=X}#k(Q){if(Q!==this.#w){if(Q===this.#G)this.#G=this.#W[Q];else this.#c(this.#B[Q],this.#W[Q]);this.#c(this.#w,Q),this.#w=Q}}delete(Q){return this.#P(Q,"delete")}#P(Q,X){let J=!1;if(this.#K!==0){let $=this.#Y.get(Q);if($!==void 0)if(J=!0,this.#K===1)this.#m(X);else{this.#b($);let V=this.#J[$];if(this.#H(V))V.__abortController.abort(new Error("deleted"));else if(this.#R||this.#U){if(this.#R)this.#Z?.(V,Q,X);if(this.#U)this.#z?.push([V,Q,X])}if(this.#Y.delete(Q),this.#q[$]=void 0,this.#J[$]=void 0,$===this.#w)this.#w=this.#B[$];else if($===this.#G)this.#G=this.#W[$];else{let Z=this.#B[$];this.#W[Z]=this.#W[$];let _=this.#W[$];this.#B[_]=this.#B[$]}this.#K--,this.#D.push($)}}if(this.#U&&this.#z?.length){let $=this.#z,V;while(V=$?.shift())this.#_?.(...V)}return J}clear(){return this.#m("delete")}#m(Q){for(let X of this.#E({allowStale:!0})){let J=this.#J[X];if(this.#H(J))J.__abortController.abort(new Error("deleted"));else{let $=this.#q[X];if(this.#R)this.#Z?.(J,$,Q);if(this.#U)this.#z?.push([J,$,Q])}}if(this.#Y.clear(),this.#J.fill(void 0),this.#q.fill(void 0),this.#M&&this.#A)this.#M.fill(0),this.#A.fill(0);if(this.#u)this.#u.fill(0);if(this.#G=0,this.#w=0,this.#D.length=0,this.#j=0,this.#K=0,this.#U&&this.#z){let X=this.#z,J;while(J=X?.shift())this.#_?.(...J)}}}import{posix as V5,win32 as S1}from"node:path";import{fileURLToPath as Z5}from"node:url";import{lstatSync as _5,readdir as K5,readdirSync as Y5,readlinkSync as q5,realpathSync as H5}from"fs";import*as j5 from"node:fs";import{lstat as U5,readdir as G5,readlink as w5,realpath as z5}from"node:fs/promises";import{EventEmitter as N1}from"node:events";import uQ from"node:stream";import{StringDecoder as nX}from"node:string_decoder";var CQ=typeof process==="object"&&process?process:{stdout:null,stderr:null},rX=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof Z0||Q instanceof uQ||aX(Q)||sX(Q)),aX=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof N1&&typeof Q.pipe==="function"&&Q.pipe!==uQ.Writable.prototype.pipe,sX=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof N1&&typeof Q.write==="function"&&typeof Q.end==="function",a=Symbol("EOF"),s=Symbol("maybeEmitEnd"),J0=Symbol("emittedEnd"),o0=Symbol("emittingEnd"),D0=Symbol("emittedError"),n0=Symbol("closed"),LQ=Symbol("read"),r0=Symbol("flush"),NQ=Symbol("flushChunk"),p=Symbol("encoding"),j0=Symbol("decoder"),u=Symbol("flowing"),u0=Symbol("paused"),W0=Symbol("resume"),E=Symbol("buffer"),x=Symbol("pipes"),S=Symbol("bufferLength"),M1=Symbol("bufferPush"),a0=Symbol("bufferShift"),f=Symbol("objectMode"),D=Symbol("destroyed"),A1=Symbol("error"),F1=Symbol("emitData"),DQ=Symbol("emitEnd"),C1=Symbol("emitEnd2"),o=Symbol("async"),L1=Symbol("abort"),s0=Symbol("aborted"),E0=Symbol("signal"),V0=Symbol("dataListeners"),m=Symbol("discarded"),S0=(Q)=>Promise.resolve().then(Q),tX=(Q)=>Q(),eX=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",Q5=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,X5=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class D1{src;dest;opts;ondrain;constructor(Q,X,J){this.src=Q,this.dest=X,this.opts=J,this.ondrain=()=>Q[W0](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class EQ extends D1{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,J){super(Q,X,J);this.proxyErrors=($)=>X.emit("error",$),Q.on("error",this.proxyErrors)}}var J5=(Q)=>!!Q.objectMode,$5=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class Z0 extends N1{[u]=!1;[u0]=!1;[x]=[];[E]=[];[f];[p];[o];[j0];[a]=!1;[J0]=!1;[o0]=!1;[n0]=!1;[D0]=null;[S]=0;[D]=!1;[E0];[s0]=!1;[V0]=0;[m]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(J5(X))this[f]=!0,this[p]=null;else if($5(X))this[p]=X.encoding,this[f]=!1;else this[f]=!1,this[p]=null;if(this[o]=!!X.async,this[j0]=this[p]?new nX(this[p]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[E]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[x]});let{signal:J}=X;if(J)if(this[E0]=J,J.aborted)this[L1]();else J.addEventListener("abort",()=>this[L1]())}get bufferLength(){return this[S]}get encoding(){return this[p]}set encoding(Q){throw new Error("Encoding must be set at instantiation time")}setEncoding(Q){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[f]}set objectMode(Q){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[o]}set["async"](Q){this[o]=this[o]||!!Q}[L1](){this[s0]=!0,this.emit("abort",this[E0]?.reason),this.destroy(this[E0]?.reason)}get aborted(){return this[s0]}set aborted(Q){}write(Q,X,J){if(this[s0])return!1;if(this[a])throw new Error("write after end");if(this[D])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")J=X,X="utf8";if(!X)X="utf8";let $=this[o]?S0:tX;if(!this[f]&&!Buffer.isBuffer(Q)){if(X5(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(Q5(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[f]){if(this[u]&&this[S]!==0)this[r0](!0);if(this[u])this.emit("data",Q);else this[M1](Q);if(this[S]!==0)this.emit("readable");if(J)$(J);return this[u]}if(!Q.length){if(this[S]!==0)this.emit("readable");if(J)$(J);return this[u]}if(typeof Q==="string"&&!(X===this[p]&&!this[j0]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[p])Q=this[j0].write(Q);if(this[u]&&this[S]!==0)this[r0](!0);if(this[u])this.emit("data",Q);else this[M1](Q);if(this[S]!==0)this.emit("readable");if(J)$(J);return this[u]}read(Q){if(this[D])return null;if(this[m]=!1,this[S]===0||Q===0||Q&&Q>this[S])return this[s](),null;if(this[f])Q=null;if(this[E].length>1&&!this[f])this[E]=[this[p]?this[E].join(""):Buffer.concat(this[E],this[S])];let X=this[LQ](Q||null,this[E][0]);re