babylonjs-editor-cli 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,4 +18,4 @@ ${t}`,"wrappedToString"),d0=Object.getOwnPropertyDescriptor(Function.prototype,"
18
18
  `)),this}return this.isSpinning?this:(this.#e.hideCursor&&on.hide(this.#l),this.#e.discardStdin&&sr.default.stdin.isTTY&&(pn.start(),this.#w=!0),this.#F(),this.render(),this.#h=setInterval(this.render.bind(this),this.interval),this)}stop(){return clearInterval(this.#h),this.#h=void 0,this.#r=-1,this.#i=0,this.#S(),this.#n(),this.#a&&(this.#l.removeListener("drain",this.#a),this.#a=void 0),this.isEnabled&&(this.clear(),this.#e.hideCursor&&on.show(this.#l)),this.#w&&(this.#w=!1,pn.stop()),this}succeed(t){return this.stopAndPersist({symbol:$t.success,text:t})}fail(t){return this.stopAndPersist({symbol:$t.error,text:t})}warn(t){return this.stopAndPersist({symbol:$t.warning,text:t})}info(t){return this.stopAndPersist({symbol:$t.info,text:t})}stopAndPersist(t={}){if(this.isSilent)return this;let r=t.symbol??" ",i=t.text??this.text,s=t.prefixText??this.#e.prefixText,n=t.suffixText??this.#e.suffixText,a=this.#_(r,i,s,n)+`
19
19
  `;return this.stop(),this.#m(()=>this.#l.write(a)),this}};function Ur(e){return new gn(e)}o(Ur,"ora");async function DS(e,t){let r=typeof e=="function",i=typeof e.then=="function";if(!r&&!i)throw new TypeError("Parameter `action` must be a Function or a Promise");let{successText:s,failText:n}=typeof t=="object"?t:{successText:void 0,failText:void 0},a=Ur(t).start();try{let h=await(r?e(a):e);return a.succeed(s===void 0?void 0:typeof s=="string"?s:s(h)),h}catch(l){throw a.fail(n===void 0?void 0:typeof n=="string"?n:n(l)),l}}o(DS,"oraPromise");var wn=o((e,t,r)=>{let i=e instanceof RegExp?eh(e,r):e,s=t instanceof RegExp?eh(t,r):t,n=i!==null&&s!=null&&D0(i,s,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+i.length,n[1]),post:r.slice(n[1]+s.length)}},"balanced"),eh=o((e,t)=>{let r=t.match(e);return r?r[0]:null},"maybeMatch"),D0=o((e,t,r)=>{let i,s,n,a,l,h=r.indexOf(e),f=r.indexOf(t,h+1),c=h;if(h>=0&&f>0){if(e===t)return[h,f];for(i=[],n=r.length;c>=0&&!l;){if(c===h)i.push(c),h=r.indexOf(e,c+1);else if(i.length===1){let u=i.pop();u!==void 0&&(l=[u,f])}else s=i.pop(),s!==void 0&&s<n&&(n=s,a=f),f=r.indexOf(t,c+1);c=h<f&&h>=0?h:f}i.length&&a!==void 0&&(l=[n,a])}return l},"range");var th="\0SLASH"+Math.random()+"\0",rh="\0OPEN"+Math.random()+"\0",yn="\0CLOSE"+Math.random()+"\0",ih="\0COMMA"+Math.random()+"\0",sh="\0PERIOD"+Math.random()+"\0",B0=new RegExp(th,"g"),j0=new RegExp(rh,"g"),M0=new RegExp(yn,"g"),$0=new RegExp(ih,"g"),q0=new RegExp(sh,"g"),G0=/\\\\/g,W0=/\\{/g,z0=/\\}/g,U0=/\\,/g,H0=/\\./g;function bn(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}o(bn,"numeric");function Y0(e){return e.replace(G0,th).replace(W0,rh).replace(z0,yn).replace(U0,ih).replace(H0,sh)}o(Y0,"escapeBraces");function V0(e){return e.replace(B0,"\\").replace(j0,"{").replace(M0,"}").replace($0,",").replace(q0,".")}o(V0,"unescapeBraces");function nh(e){if(!e)return[""];let t=[],r=wn("{","}",e);if(!r)return e.split(",");let{pre:i,body:s,post:n}=r,a=i.split(",");a[a.length-1]+="{"+s+"}";let l=nh(n);return n.length&&(a[a.length-1]+=l.shift(),a.push.apply(a,l)),t.push.apply(t,a),t}o(nh,"parseCommaParts");function oh(e){return e?(e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Hr(Y0(e),!0).map(V0)):[]}o(oh,"expand");function J0(e){return"{"+e+"}"}o(J0,"embrace");function K0(e){return/^-?0\d/.test(e)}o(K0,"isPadded");function X0(e,t){return e<=t}o(X0,"lte");function Q0(e,t){return e>=t}o(Q0,"gte");function Hr(e,t){let r=[],i=wn("{","}",e);if(!i)return[e];let s=i.pre,n=i.post.length?Hr(i.post,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<n.length;a++){let l=s+"{"+i.body+"}"+n[a];r.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),h=a||l,f=i.body.indexOf(",")>=0;if(!h&&!f)return i.post.match(/,(?!,).*\}/)?(e=i.pre+"{"+i.body+yn+i.post,Hr(e)):[e];let c;if(h)c=i.body.split(/\.\./);else if(c=nh(i.body),c.length===1&&c[0]!==void 0&&(c=Hr(c[0],!1).map(J0),c.length===1))return n.map(m=>i.pre+c[0]+m);let u;if(h&&c[0]!==void 0&&c[1]!==void 0){let m=bn(c[0]),p=bn(c[1]),y=Math.max(c[0].length,c[1].length),b=c.length===3&&c[2]!==void 0?Math.abs(bn(c[2])):1,E=X0;p<m&&(b*=-1,E=Q0);let C=c.some(K0);u=[];for(let A=m;E(A,p);A+=b){let S;if(l)S=String.fromCharCode(A),S==="\\"&&(S="");else if(S=String(A),C){let D=y-S.length;if(D>0){let ke=new Array(D+1).join("0");A<0?S="-"+ke+S.slice(1):S=ke+S}}u.push(S)}}else{u=[];for(let m=0;m<c.length;m++)u.push.apply(u,Hr(c[m],!1))}for(let m=0;m<u.length;m++)for(let p=0;p<n.length;p++){let y=s+u[m]+n[p];(!t||h||y)&&r.push(y)}}return r}o(Hr,"expand_");var US=65536,Yr=o(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Z0={"[: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]},Vr=o(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),eg=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),ah=o(e=>e.join(""),"rangesToString"),lh=o((e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let i=[],s=[],n=r+1,a=!1,l=!1,h=!1,f=!1,c=r,u="";e:for(;n<e.length;){let b=e.charAt(n);if((b==="!"||b==="^")&&n===r+1){f=!0,n++;continue}if(b==="]"&&a&&!h){c=n+1;break}if(a=!0,b==="\\"&&!h){h=!0,n++;continue}if(b==="["&&!h){for(let[E,[x,C,A]]of Object.entries(Z0))if(e.startsWith(E,n)){if(u)return["$.",!1,e.length-r,!0];n+=E.length,A?s.push(x):i.push(x),l=l||C;continue e}}if(h=!1,u){b>u?i.push(Vr(u)+"-"+Vr(b)):b===u&&i.push(Vr(b)),u="",n++;continue}if(e.startsWith("-]",n+1)){i.push(Vr(b+"-")),n+=2;continue}if(e.startsWith("-",n+1)){u=b,n+=2;continue}i.push(Vr(b)),n++}if(c<n)return["",!1,0,!1];if(!i.length&&!s.length)return["$.",!1,e.length-r,!0];if(s.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!f){let b=i[0].length===2?i[0].slice(-1):i[0];return[eg(b),!1,c-r,!1]}let m="["+(f?"^":"")+ah(i)+"]",p="["+(f?"":"^")+ah(s)+"]";return[i.length&&s.length?"("+m+"|"+p+")":i.length?m:p,l,c-r,!0]},"parseClass");var He=o((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),"unescape");var tg=new Set(["!","?","+","*","@"]),hh=o(e=>tg.has(e),"isExtglobType"),rg="(?!(?:^|/)\\.\\.?(?:$|/))",qi="(?!\\.)",ig=new Set(["[","."]),sg=new Set(["..","."]),ng=new Set("().*{}+?[]^$\\!"),og=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),En="[^/]",ch=En+"*?",fh=En+"+?",nr=class e{static{o(this,"AST")}type;#t;#r;#i=!1;#e=[];#o;#l;#h;#f=!1;#c;#a;#s=!1;constructor(t,r,i={}){this.type=t,t&&(this.#r=!0),this.#o=r,this.#t=this.#o?this.#o.#t:this,this.#c=this.#t===this?i:this.#t.#c,this.#h=this.#t===this?[]:this.#t.#h,t==="!"&&!this.#t.#f&&this.#h.push(this),this.#l=this.#o?this.#o.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#e)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#e.map(t=>String(t)).join("|")+")":this.#a=this.#e.map(t=>String(t)).join("")}#w(){if(this!==this.#t)throw new Error("should only call on root");if(this.#f)return this;this.toString(),this.#f=!0;let t;for(;t=this.#h.pop();){if(t.type!=="!")continue;let r=t,i=r.#o;for(;i;){for(let s=r.#l+1;!i.type&&s<i.#e.length;s++)for(let n of t.#e){if(typeof n=="string")throw new Error("string part in extglob AST??");n.copyIn(i.#e[s])}r=i,i=r.#o}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof e&&r.#o===this))throw new Error("invalid part: "+r);this.#e.push(r)}}toJSON(){let t=this.type===null?this.#e.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#e.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#f&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#l===0)return!0;let t=this.#o;for(let r=0;r<this.#l;r++){let i=t.#e[r];if(!(i instanceof e&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#e.length:0;return this.#l===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new e(this.type,t);for(let i of this.#e)r.copyIn(i);return r}static#m(t,r,i,s){let n=!1,a=!1,l=-1,h=!1;if(r.type===null){let p=i,y="";for(;p<t.length;){let b=t.charAt(p++);if(n||b==="\\"){n=!n,y+=b;continue}if(a){p===l+1?(b==="^"||b==="!")&&(h=!0):b==="]"&&!(p===l+2&&h)&&(a=!1),y+=b;continue}else if(b==="["){a=!0,l=p,h=!1,y+=b;continue}if(!s.noext&&hh(b)&&t.charAt(p)==="("){r.push(y),y="";let E=new e(b,r);p=e.#m(t,E,p,s),r.push(E);continue}y+=b}return r.push(y),p}let f=i+1,c=new e(null,r),u=[],m="";for(;f<t.length;){let p=t.charAt(f++);if(n||p==="\\"){n=!n,m+=p;continue}if(a){f===l+1?(p==="^"||p==="!")&&(h=!0):p==="]"&&!(f===l+2&&h)&&(a=!1),m+=p;continue}else if(p==="["){a=!0,l=f,h=!1,m+=p;continue}if(hh(p)&&t.charAt(f)==="("){c.push(m),m="";let y=new e(p,c);c.push(y),f=e.#m(t,y,f,s);continue}if(p==="|"){c.push(m),m="",u.push(c),c=new e(null,r);continue}if(p===")")return m===""&&r.#e.length===0&&(r.#s=!0),c.push(m),m="",r.push(...u,c),f;m+=p}return r.type=null,r.#r=void 0,r.#e=[t.substring(i-1)],f}static fromGlob(t,r={}){let i=new e(null,void 0,r);return e.#m(t,i,0,r),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[r,i,s,n]=this.toRegExpSource();if(!(s||this.#r||this.#c.nocase&&!this.#c.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let l=(this.#c.nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${r}$`,l),{_src:r,_glob:t})}get options(){return this.#c}toRegExpSource(t){let r=t??!!this.#c.dot;if(this.#t===this&&this.#w(),!this.type){let h=this.isStart()&&this.isEnd()&&!this.#e.some(p=>typeof p!="string"),f=this.#e.map(p=>{let[y,b,E,x]=typeof p=="string"?e.#g(p,this.#r,h):p.toRegExpSource(t);return this.#r=this.#r||E,this.#i=this.#i||x,y}).join(""),c="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&sg.has(this.#e[0]))){let y=ig,b=r&&y.has(f.charAt(0))||f.startsWith("\\.")&&y.has(f.charAt(2))||f.startsWith("\\.\\.")&&y.has(f.charAt(4)),E=!r&&!t&&y.has(f.charAt(0));c=b?rg:E?qi:""}let u="";return this.isEnd()&&this.#t.#f&&this.#o?.type==="!"&&(u="(?:$|\\/)"),[c+f+u,He(f),this.#r=!!this.#r,this.#i]}let i=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",n=this.#p(r);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let h=this.toString();return this.#e=[h],this.type=null,this.#r=void 0,[h,He(this.toString()),!1,!1]}let a=!i||t||r||!qi?"":this.#p(!0);a===n&&(a=""),a&&(n=`(?:${n})(?:${a})*?`);let l="";if(this.type==="!"&&this.#s)l=(this.isStart()&&!r?qi:"")+fh;else{let h=this.type==="!"?"))"+(this.isStart()&&!r&&!t?qi:"")+ch+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;l=s+n+h}return[l,He(n),this.#r=!!this.#r,this.#i]}#p(t){return this.#e.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[i,s,n,a]=r.toRegExpSource(t);return this.#i=this.#i||a,i}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#g(t,r,i=!1){let s=!1,n="",a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(s){s=!1,n+=(ng.has(h)?"\\":"")+h;continue}if(h==="\\"){l===t.length-1?n+="\\\\":s=!0;continue}if(h==="["){let[f,c,u,m]=lh(t,l);if(u){n+=f,a=a||c,l+=u-1,r=r||m;continue}}if(h==="*"){n+=i&&t==="*"?fh:ch,r=!0;continue}if(h==="?"){n+=En,r=!0;continue}n+=og(h)}return[n,He(t),!!r,a]}};var or=o((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Se=o((e,t,r={})=>(Yr(t),!r.nocomment&&t.charAt(0)==="#"?!1:new Re(t,r).match(e)),"minimatch"),ag=/^\*+([^+@!?\*\[\(]*)$/,lg=o(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),hg=o(e=>t=>t.endsWith(e),"starDotExtTestDot"),cg=o(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),fg=o(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),ug=/^\*+\.\*+$/,dg=o(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),mg=o(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),pg=/^\.\*+$/,gg=o(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),wg=/^\*+$/,yg=o(e=>e.length!==0&&!e.startsWith("."),"starTest"),bg=o(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),Eg=/^\?+([^+@!?\*\[\(]*)?$/,xg=o(([e,t=""])=>{let r=uh([e]);return t?(t=t.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(t)):r},"qmarksTestNocase"),vg=o(([e,t=""])=>{let r=dh([e]);return t?(t=t.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(t)):r},"qmarksTestNocaseDot"),Sg=o(([e,t=""])=>{let r=dh([e]);return t?i=>r(i)&&i.endsWith(t):r},"qmarksTestDot"),_g=o(([e,t=""])=>{let r=uh([e]);return t?i=>r(i)&&i.endsWith(t):r},"qmarksTest"),uh=o(([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},"qmarksTestNoExt"),dh=o(([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},"qmarksTestNoExtDot"),mh=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ph={win32:{sep:"\\"},posix:{sep:"/"}},Tg=mh==="win32"?ph.win32.sep:ph.posix.sep;Se.sep=Tg;var de=Symbol("globstar **");Se.GLOBSTAR=de;var Fg="[^/]",Ag=Fg+"*?",Pg="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Cg="(?:(?!(?:\\/|^)\\.).)*?",kg=o((e,t={})=>r=>Se(r,e,t),"filter");Se.filter=kg;var De=o((e,t={})=>Object.assign({},e,t),"ext"),Rg=o(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Se;let t=Se;return Object.assign(o((i,s,n={})=>t(i,s,De(e,n)),"m"),{Minimatch:class extends t.Minimatch{static{o(this,"Minimatch")}constructor(s,n={}){super(s,De(e,n))}static defaults(s){return t.defaults(De(e,s)).Minimatch}},AST:class extends t.AST{static{o(this,"AST")}constructor(s,n,a={}){super(s,n,De(e,a))}static fromGlob(s,n={}){return t.AST.fromGlob(s,De(e,n))}},unescape:o((i,s={})=>t.unescape(i,De(e,s)),"unescape"),escape:o((i,s={})=>t.escape(i,De(e,s)),"escape"),filter:o((i,s={})=>t.filter(i,De(e,s)),"filter"),defaults:o(i=>t.defaults(De(e,i)),"defaults"),makeRe:o((i,s={})=>t.makeRe(i,De(e,s)),"makeRe"),braceExpand:o((i,s={})=>t.braceExpand(i,De(e,s)),"braceExpand"),match:o((i,s,n={})=>t.match(i,s,De(e,n)),"match"),sep:t.sep,GLOBSTAR:de})},"defaults");Se.defaults=Rg;var gh=o((e,t={})=>(Yr(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:oh(e)),"braceExpand");Se.braceExpand=gh;var Ig=o((e,t={})=>new Re(e,t).makeRe(),"makeRe");Se.makeRe=Ig;var Og=o((e,t,r={})=>{let i=new Re(t,r);return e=e.filter(s=>i.match(s)),i.options.nonull&&!e.length&&e.push(t),e},"match");Se.match=Og;var wh=/[?*]|[+@!]\(.*?\)|\[|\]/,Lg=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Re=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,r={}){Yr(t),r=r||{},this.options=r,this.pattern=t,this.platform=r.platform||mh,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.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 t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((n,a,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=n[0]===""&&n[1]===""&&(n[2]==="?"||!wh.test(n[2]))&&!wh.test(n[3]),f=/^[a-z]:/i.test(n[0]);if(h)return[...n.slice(0,4),...n.slice(4).map(c=>this.parse(c))];if(f)return[n[0],...n.slice(1).map(c=>this.parse(c))]}return n.map(h=>this.parse(h))});if(this.debug(this.pattern,s),this.set=s.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let a=this.set[n];a[0]===""&&a[1]===""&&this.globParts[n][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i=0;i<t.length;i++)for(let s=0;s<t[i].length;s++)t[i][s]==="**"&&(t[i][s]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let s=i;for(;r[s+1]==="**";)s++;s!==i&&r.splice(i,s-i)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((i,s)=>{let n=i[i.length-1];return s==="**"&&n==="**"?i:s===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(i.pop(),i):(i.push(s),i)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){let n=t[s];s===1&&n===""&&t[0]===""||(n==="."||n==="")&&(r=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let s=t[i-1];s&&s!=="."&&s!==".."&&s!=="**"&&(r=!0,t.splice(i-1,2),i-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let i of t){let s=-1;for(;(s=i.indexOf("**",s+1))!==-1;){let a=s;for(;i[a+1]==="**";)a++;a>s&&i.splice(s+1,a-s);let l=i[s+1],h=i[s+2],f=i[s+3];if(l!==".."||!h||h==="."||h===".."||!f||f==="."||f==="..")continue;r=!0,i.splice(s,1);let c=i.slice(0);c[s]="**",t.push(c),s--}if(!this.preserveMultipleSlashes){for(let a=1;a<i.length-1;a++){let l=i[a];a===1&&l===""&&i[0]===""||(l==="."||l==="")&&(r=!0,i.splice(a,1),a--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(r=!0,i.pop())}let n=0;for(;(n=i.indexOf("..",n+1))!==-1;){let a=i[n-1];if(a&&a!=="."&&a!==".."&&a!=="**"){r=!0;let h=n===1&&i[n+1]==="**"?["."]:[];i.splice(n-1,2,...h),i.length===0&&i.push(""),n-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let i=r+1;i<t.length;i++){let s=this.partsMatch(t[r],t[i],!this.preserveMultipleSlashes);if(s){t[r]=[],t[i]=s;break}}return t.filter(r=>r.length)}partsMatch(t,r,i=!1){let s=0,n=0,a=[],l="";for(;s<t.length&&n<r.length;)if(t[s]===r[n])a.push(l==="b"?r[n]:t[s]),s++,n++;else if(i&&t[s]==="**"&&r[n]===t[s+1])a.push(t[s]),s++;else if(i&&r[n]==="**"&&t[s]===r[n+1])a.push(r[n]),n++;else if(t[s]==="*"&&r[n]&&(this.options.dot||!r[n].startsWith("."))&&r[n]!=="**"){if(l==="b")return!1;l="a",a.push(t[s]),s++,n++}else if(r[n]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(l==="a")return!1;l="b",a.push(r[n]),s++,n++}else return!1;return t.length===r.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,i=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)r=!r,i++;i&&(this.pattern=t.slice(i)),this.negate=r}matchOne(t,r,i=!1){let s=this.options;if(this.isWindows){let b=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),E=!b&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),x=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),C=!x&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),A=E?3:b?0:void 0,S=C?3:x?0:void 0;if(typeof A=="number"&&typeof S=="number"){let[D,ke]=[t[A],r[S]];D.toLowerCase()===ke.toLowerCase()&&(r[S]=D,S>A?r=r.slice(S):A>S&&(t=t.slice(A)))}}let{optimizationLevel:n=1}=this.options;n>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var a=0,l=0,h=t.length,f=r.length;a<h&&l<f;a++,l++){this.debug("matchOne loop");var c=r[l],u=t[a];if(this.debug(r,c,u),c===!1)return!1;if(c===de){this.debug("GLOBSTAR",[r,c,u]);var m=a,p=l+1;if(p===f){for(this.debug("** at the end");a<h;a++)if(t[a]==="."||t[a]===".."||!s.dot&&t[a].charAt(0)===".")return!1;return!0}for(;m<h;){var y=t[m];if(this.debug(`
20
20
  globstar while`,t,m,r,p,y),this.matchOne(t.slice(m),r.slice(p),i))return this.debug("globstar found match!",m,h,y),!0;if(y==="."||y===".."||!s.dot&&y.charAt(0)==="."){this.debug("dot detected!",t,m,r,p);break}this.debug("globstar swallow a segment, and continue"),m++}return!!(i&&(this.debug(`
21
- >>> no match, partial?`,t,m,r,p),m===h))}let b;if(typeof c=="string"?(b=u===c,this.debug("string match",c,u,b)):(b=c.test(u),this.debug("pattern match",c,u,b)),!b)return!1}if(a===h&&l===f)return!0;if(a===h)return i;if(l===f)return a===h-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return gh(this.pattern,this.options)}parse(t){Yr(t);let r=this.options;if(t==="**")return de;if(t==="")return"";let i,s=null;(i=t.match(wg))?s=r.dot?bg:yg:(i=t.match(ag))?s=(r.nocase?r.dot?fg:cg:r.dot?hg:lg)(i[1]):(i=t.match(Eg))?s=(r.nocase?r.dot?vg:xg:r.dot?Sg:_g)(i):(i=t.match(ug))?s=r.dot?mg:dg:(i=t.match(pg))&&(s=gg);let n=nr.fromGlob(t,this.options).toMMPattern();return s&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:s}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?Ag:r.dot?Pg:Cg,s=new Set(r.nocase?["i"]:[]),n=t.map(h=>{let f=h.map(u=>{if(u instanceof RegExp)for(let m of u.flags.split(""))s.add(m);return typeof u=="string"?Lg(u):u===de?de:u._src});f.forEach((u,m)=>{let p=f[m+1],y=f[m-1];u!==de||y===de||(y===void 0?p!==void 0&&p!==de?f[m+1]="(?:\\/|"+i+"\\/)?"+p:f[m]=i:p===void 0?f[m-1]=y+"(?:\\/|\\/"+i+")?":p!==de&&(f[m-1]=y+"(?:\\/|\\/"+i+"\\/)"+p,f[m+1]=de))});let c=f.filter(u=>u!==de);if(this.partial&&c.length>=1){let u=[];for(let m=1;m<=c.length;m++)u.push(c.slice(0,m).join("/"));return"(?:"+u.join("|")+")"}return c.join("/")}).join("|"),[a,l]=t.length>1?["(?:",")"]:["",""];n="^"+a+n+l+"$",this.partial&&(n="^(?:\\/|"+a+n.slice(1,-1)+l+")$"),this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...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,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let n=this.set;this.debug(this.pattern,"set",n);let a=s[s.length-1];if(!a)for(let l=s.length-2;!a&&l>=0;l--)a=s[l];for(let l=0;l<n.length;l++){let h=n[l],f=s;if(i.matchBase&&h.length===1&&(f=[a]),this.matchOne(f,h,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return Se.defaults(t).Minimatch}};Se.AST=nr,Se.Minimatch=Re,Se.escape=or,Se.unescape=He;var ar=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,yh=new Set,xn=typeof process=="object"&&process?process:{},bh=o((e,t,r,i)=>{typeof xn.emitWarning=="function"?xn.emitWarning(e,t,r,i):console.error(`[${r}] ${t}: ${e}`)},"emitWarning"),Gi=globalThis.AbortController,Eh=globalThis.AbortSignal;if(typeof Gi>"u"){Eh=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(i,s){this._onabort.push(s)}},Gi=class{static{o(this,"AbortController")}constructor(){t()}signal=new Eh;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i)}}};let e=xn.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=o(()=>{e&&(e=!1,bh("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))},"warnACPolyfill")}var Ng=o(e=>!yh.has(e),"shouldWarn"),y_=Symbol("type"),Tt=o(e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),"isPosInt"),xh=o(e=>Tt(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?lr:null:null,"getUintArray"),lr=class extends Array{static{o(this,"ZeroArray")}constructor(t){super(t),this.fill(0)}},vn=class e{static{o(this,"Stack")}heap;length;static#t=!1;static create(t){let r=xh(t);if(!r)return[];e.#t=!0;let i=new e(t,r);return e.#t=!1,i}constructor(t,r){if(!e.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Jr=class e{static{o(this,"LRUCache")}#t;#r;#i;#e;#o;#l;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#f;#c;#a;#s;#w;#m;#p;#g;#T;#y;#S;#_;#b;#x;#v;#d;static unsafeExposeInternals(t){return{starts:t.#_,ttls:t.#b,sizes:t.#S,keyMap:t.#c,keyList:t.#a,valList:t.#s,next:t.#w,prev:t.#m,get head(){return t.#p},get tail(){return t.#g},free:t.#T,isBackgroundFetch:o(r=>t.#u(r),"isBackgroundFetch"),backgroundFetch:o((r,i,s,n)=>t.#j(r,i,s,n),"backgroundFetch"),moveToTail:o(r=>t.#$(r),"moveToTail"),indexes:o(r=>t.#P(r),"indexes"),rindexes:o(r=>t.#C(r),"rindexes"),isStale:o(r=>t.#E(r),"isStale")}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#f}get size(){return this.#h}get fetchMethod(){return this.#o}get memoMethod(){return this.#l}get dispose(){return this.#i}get disposeAfter(){return this.#e}constructor(t){let{max:r=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:h,dispose:f,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:m,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:b,fetchMethod:E,memoMethod:x,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:D,ignoreFetchAbort:ke}=t;if(r!==0&&!Tt(r))throw new TypeError("max option must be a nonnegative integer");let Qe=r?xh(r):Array;if(!Qe)throw new Error("invalid max value: "+r);if(this.#t=r,this.#r=p,this.maxEntrySize=y||this.#r,this.sizeCalculation=b,this.sizeCalculation){if(!this.#r&&!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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#l=x,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=E,this.#v=!!E,this.#c=new Map,this.#a=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#w=new Qe(r),this.#m=new Qe(r),this.#p=0,this.#g=0,this.#T=vn.create(r),this.#h=0,this.#f=0,typeof f=="function"&&(this.#i=f),typeof c=="function"?(this.#e=c,this.#y=[]):(this.#e=void 0,this.#y=void 0),this.#x=!!this.#i,this.#d=!!this.#e,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!D,this.ignoreFetchAbort=!!ke,this.maxEntrySize!==0){if(this.#r!==0&&!Tt(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Tt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#R()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=Tt(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!Tt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#A()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let bt="LRU_CACHE_UNBOUNDED";Ng(bt)&&(yh.add(bt),bh("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",bt,e))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#A(){let t=new lr(this.#t),r=new lr(this.#t);this.#b=t,this.#_=r,this.#k=(n,a,l=ar.now())=>{if(r[n]=a!==0?l:0,t[n]=a,a!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#E(n)&&this.#I(this.#a[n],"expire")},a+1);h.unref&&h.unref()}},this.#F=n=>{r[n]=t[n]!==0?ar.now():0},this.#n=(n,a)=>{if(t[a]){let l=t[a],h=r[a];if(!l||!h)return;n.ttl=l,n.start=h,n.now=i||s();let f=n.now-h;n.remainingTTL=l-f}};let i=0,s=o(()=>{let n=ar.now();if(this.ttlResolution>0){i=n;let a=setTimeout(()=>i=0,this.ttlResolution);a.unref&&a.unref()}return n},"getNow");this.getRemainingTTL=n=>{let a=this.#c.get(n);if(a===void 0)return 0;let l=t[a],h=r[a];if(!l||!h)return 1/0;let f=(i||s())-h;return l-f},this.#E=n=>{let a=r[n],l=t[n];return!!l&&!!a&&(i||s())-a>l}}#F=o(()=>{},"#updateItemAge");#n=o(()=>{},"#statusTTL");#k=o(()=>{},"#setItemTTL");#E=o(()=>!1,"#isStale");#R(){let t=new lr(this.#t);this.#f=0,this.#S=t,this.#O=r=>{this.#f-=t[r],t[r]=0},this.#N=(r,i,s,n)=>{if(this.#u(i))return 0;if(!Tt(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,r),!Tt(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.#L=(r,i,s)=>{if(t[r]=i,this.#r){let n=this.#r-t[r];for(;this.#f>n;)this.#B(!0)}this.#f+=t[r],s&&(s.entrySize=i,s.totalCalculatedSize=this.#f)}}#O=o(t=>{},"#removeItemSize");#L=o((t,r,i)=>{},"#addItemSize");#N=o((t,r,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:t=this.allowStale}={}){if(this.#h)for(let r=this.#g;!(!this.#D(r)||((t||!this.#E(r))&&(yield r),r===this.#p));)r=this.#m[r]}*#C({allowStale:t=this.allowStale}={}){if(this.#h)for(let r=this.#p;!(!this.#D(r)||((t||!this.#E(r))&&(yield r),r===this.#g));)r=this.#w[r]}#D(t){return t!==void 0&&this.#c.get(this.#a[t])===t}*entries(){for(let t of this.#P())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#u(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*rentries(){for(let t of this.#C())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#u(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*keys(){for(let t of this.#P()){let r=this.#a[t];r!==void 0&&!this.#u(this.#s[t])&&(yield r)}}*rkeys(){for(let t of this.#C()){let r=this.#a[t];r!==void 0&&!this.#u(this.#s[t])&&(yield r)}}*values(){for(let t of this.#P())this.#s[t]!==void 0&&!this.#u(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#C())this.#s[t]!==void 0&&!this.#u(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let i of this.#P()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#a[i],this))return this.get(this.#a[i],r)}}forEach(t,r=this){for(let i of this.#P()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(r,n,this.#a[i],this)}}rforEach(t,r=this){for(let i of this.#C()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(r,n,this.#a[i],this)}}purgeStale(){let t=!1;for(let r of this.#C({allowStale:!0}))this.#E(r)&&(this.#I(this.#a[r],"expire"),t=!0);return t}info(t){let r=this.#c.get(t);if(r===void 0)return;let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#b&&this.#_){let a=this.#b[r],l=this.#_[r];if(a&&l){let h=a-(ar.now()-l);n.ttl=h,n.start=Date.now()}}return this.#S&&(n.size=this.#S[r]),n}dump(){let t=[];for(let r of this.#P({allowStale:!0})){let i=this.#a[r],s=this.#s[r],n=this.#u(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let a={value:n};if(this.#b&&this.#_){a.ttl=this.#b[r];let l=ar.now()-this.#_[r];a.start=Math.floor(Date.now()-l)}this.#S&&(a.size=this.#S[r]),t.unshift([i,a])}return t}load(t){this.clear();for(let[r,i]of t){if(i.start){let s=Date.now()-i.start;i.start=ar.now()-s}this.set(r,i.value,i)}}set(t,r,i={}){if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:h}=i,{noUpdateTTL:f=this.noUpdateTTL}=i,c=this.#N(t,r,i.size||0,l);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.#I(t,"set"),this;let u=this.#h===0?void 0:this.#c.get(t);if(u===void 0)u=this.#h===0?this.#g:this.#T.length!==0?this.#T.pop():this.#h===this.#t?this.#B(!1):this.#h,this.#a[u]=t,this.#s[u]=r,this.#c.set(t,u),this.#w[this.#g]=u,this.#m[u]=this.#g,this.#g=u,this.#h++,this.#L(u,c,h),h&&(h.set="add"),f=!1;else{this.#$(u);let m=this.#s[u];if(r!==m){if(this.#v&&this.#u(m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=m;p!==void 0&&!a&&(this.#x&&this.#i?.(p,t,"set"),this.#d&&this.#y?.push([p,t,"set"]))}else a||(this.#x&&this.#i?.(m,t,"set"),this.#d&&this.#y?.push([m,t,"set"]));if(this.#O(u),this.#L(u,c,h),this.#s[u]=r,h){h.set="replace";let p=m&&this.#u(m)?m.__staleWhileFetching:m;p!==void 0&&(h.oldValue=p)}}else h&&(h.set="update")}if(s!==0&&!this.#b&&this.#A(),this.#b&&(f||this.#k(u,s,n),h&&this.#n(h,u)),!a&&this.#d&&this.#y){let m=this.#y,p;for(;p=m?.shift();)this.#e?.(...p)}return this}pop(){try{for(;this.#h;){let t=this.#s[this.#p];if(this.#B(!0),this.#u(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#d&&this.#y){let t=this.#y,r;for(;r=t?.shift();)this.#e?.(...r)}}}#B(t){let r=this.#p,i=this.#a[r],s=this.#s[r];return this.#v&&this.#u(s)?s.__abortController.abort(new Error("evicted")):(this.#x||this.#d)&&(this.#x&&this.#i?.(s,i,"evict"),this.#d&&this.#y?.push([s,i,"evict"])),this.#O(r),t&&(this.#a[r]=void 0,this.#s[r]=void 0,this.#T.push(r)),this.#h===1?(this.#p=this.#g=0,this.#T.length=0):this.#p=this.#w[r],this.#c.delete(i),this.#h--,r}has(t,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=r,n=this.#c.get(t);if(n!==void 0){let a=this.#s[n];if(this.#u(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#E(n))s&&(s.has="stale",this.#n(s,n));else return i&&this.#F(n),s&&(s.has="hit",this.#n(s,n)),!0}else s&&(s.has="miss");return!1}peek(t,r={}){let{allowStale:i=this.allowStale}=r,s=this.#c.get(t);if(s===void 0||!i&&this.#E(s))return;let n=this.#s[s];return this.#u(n)?n.__staleWhileFetching:n}#j(t,r,i,s){let n=r===void 0?void 0:this.#s[r];if(this.#u(n))return n;let a=new Gi,{signal:l}=i;l?.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let h={signal:a.signal,options:i,context:s},f=o((b,E=!1)=>{let{aborted:x}=a.signal,C=i.ignoreFetchAbort&&b!==void 0;if(i.status&&(x&&!E?(i.status.fetchAborted=!0,i.status.fetchError=a.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),x&&!C&&!E)return u(a.signal.reason);let A=p;return this.#s[r]===p&&(b===void 0?A.__staleWhileFetching?this.#s[r]=A.__staleWhileFetching:this.#I(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,b,h.options))),b},"cb"),c=o(b=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=b),u(b)),"eb"),u=o(b=>{let{aborted:E}=a.signal,x=E&&i.allowStaleOnFetchAbort,C=x||i.allowStaleOnFetchRejection,A=C||i.noDeleteOnFetchRejection,S=p;if(this.#s[r]===p&&(!A||S.__staleWhileFetching===void 0?this.#I(t,"fetch"):x||(this.#s[r]=S.__staleWhileFetching)),C)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw b},"fetchFail"),m=o((b,E)=>{let x=this.#o?.(t,n,h);x&&x instanceof Promise&&x.then(C=>b(C===void 0?void 0:C),E),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(b(void 0),i.allowStaleOnFetchAbort&&(b=o(C=>f(C,!0),"res")))})},"pcall");i.status&&(i.status.fetchDispatched=!0);let p=new Promise(m).then(f,c),y=Object.assign(p,{__abortController:a,__staleWhileFetching:n,__returned:void 0});return r===void 0?(this.set(t,y,{...h.options,status:void 0}),r=this.#c.get(t)):this.#s[r]=y,y}#u(t){if(!this.#v)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Gi}async fetch(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:h=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:b,forceRefresh:E=!1,status:x,signal:C}=r;if(!this.#v)return x&&(x.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:x});let A={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:a,noDisposeOnSet:l,size:h,sizeCalculation:f,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:x,signal:C},S=this.#c.get(t);if(S===void 0){x&&(x.fetch="miss");let D=this.#j(t,S,A,b);return D.__returned=D}else{let D=this.#s[S];if(this.#u(D)){let L=i&&D.__staleWhileFetching!==void 0;return x&&(x.fetch="inflight",L&&(x.returnedStale=!0)),L?D.__staleWhileFetching:D.__returned=D}let ke=this.#E(S);if(!E&&!ke)return x&&(x.fetch="hit"),this.#$(S),s&&this.#F(S),x&&this.#n(x,S),D;let Qe=this.#j(t,S,A,b),k=Qe.__staleWhileFetching!==void 0&&i;return x&&(x.fetch=ke?"stale":"refresh",k&&ke&&(x.returnedStale=!0)),k?Qe.__staleWhileFetching:Qe.__returned=Qe}}async forceFetch(t,r={}){let i=await this.fetch(t,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,r={}){let i=this.#l;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...a}=r,l=this.get(t,a);if(!n&&l!==void 0)return l;let h=i(t,l,{options:a,context:s});return this.set(t,h,a),h}get(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:a}=r,l=this.#c.get(t);if(l!==void 0){let h=this.#s[l],f=this.#u(h);return a&&this.#n(a,l),this.#E(l)?(a&&(a.get="stale"),f?(a&&i&&h.__staleWhileFetching!==void 0&&(a.returnedStale=!0),i?h.__staleWhileFetching:void 0):(n||this.#I(t,"expire"),a&&i&&(a.returnedStale=!0),i?h:void 0)):(a&&(a.get="hit"),f?h.__staleWhileFetching:(this.#$(l),s&&this.#F(l),h))}else a&&(a.get="miss")}#M(t,r){this.#m[r]=t,this.#w[t]=r}#$(t){t!==this.#g&&(t===this.#p?this.#p=this.#w[t]:this.#M(this.#m[t],this.#w[t]),this.#M(this.#g,t),this.#g=t)}delete(t){return this.#I(t,"delete")}#I(t,r){let i=!1;if(this.#h!==0){let s=this.#c.get(t);if(s!==void 0)if(i=!0,this.#h===1)this.#q(r);else{this.#O(s);let n=this.#s[s];if(this.#u(n)?n.__abortController.abort(new Error("deleted")):(this.#x||this.#d)&&(this.#x&&this.#i?.(n,t,r),this.#d&&this.#y?.push([n,t,r])),this.#c.delete(t),this.#a[s]=void 0,this.#s[s]=void 0,s===this.#g)this.#g=this.#m[s];else if(s===this.#p)this.#p=this.#w[s];else{let a=this.#m[s];this.#w[a]=this.#w[s];let l=this.#w[s];this.#m[l]=this.#m[s]}this.#h--,this.#T.push(s)}}if(this.#d&&this.#y?.length){let s=this.#y,n;for(;n=s?.shift();)this.#e?.(...n)}return i}clear(){return this.#q("delete")}#q(t){for(let r of this.#C({allowStale:!0})){let i=this.#s[r];if(this.#u(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#a[r];this.#x&&this.#i?.(i,s,t),this.#d&&this.#y?.push([i,s,t])}}if(this.#c.clear(),this.#s.fill(void 0),this.#a.fill(void 0),this.#b&&this.#_&&(this.#b.fill(0),this.#_.fill(0)),this.#S&&this.#S.fill(0),this.#p=0,this.#g=0,this.#T.length=0,this.#f=0,this.#h=0,this.#d&&this.#y){let r=this.#y,i;for(;i=r?.shift();)this.#e?.(...i)}}};var Ji=require("node:events"),Cn=M(require("node:stream"),1),Fh=require("node:string_decoder"),vh=typeof process=="object"&&process?process:{stdout:null,stderr:null},Dg=o(e=>!!e&&typeof e=="object"&&(e instanceof At||e instanceof Cn.default||Bg(e)||jg(e)),"isStream"),Bg=o(e=>!!e&&typeof e=="object"&&e instanceof Ji.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==Cn.default.Writable.prototype.pipe,"isReadable"),jg=o(e=>!!e&&typeof e=="object"&&e instanceof Ji.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function","isWritable"),dt=Symbol("EOF"),mt=Symbol("maybeEmitEnd"),Ft=Symbol("emittedEnd"),Wi=Symbol("emittingEnd"),Kr=Symbol("emittedError"),zi=Symbol("closed"),Sh=Symbol("read"),Ui=Symbol("flush"),_h=Symbol("flushChunk"),Ye=Symbol("encoding"),hr=Symbol("decoder"),ie=Symbol("flowing"),Xr=Symbol("paused"),cr=Symbol("resume"),se=Symbol("buffer"),_e=Symbol("pipes"),ne=Symbol("bufferLength"),Sn=Symbol("bufferPush"),Hi=Symbol("bufferShift"),ge=Symbol("objectMode"),J=Symbol("destroyed"),_n=Symbol("error"),Tn=Symbol("emitData"),Th=Symbol("emitEnd"),Fn=Symbol("emitEnd2"),et=Symbol("async"),An=Symbol("abort"),Yi=Symbol("aborted"),Qr=Symbol("signal"),qt=Symbol("dataListeners"),Ie=Symbol("discarded"),Zr=o(e=>Promise.resolve().then(e),"defer"),Mg=o(e=>e(),"nodefer"),$g=o(e=>e==="end"||e==="finish"||e==="prefinish","isEndish"),qg=o(e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,"isArrayBufferLike"),Gg=o(e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),"isArrayBufferView"),Vi=class{static{o(this,"Pipe")}src;dest;opts;ondrain;constructor(t,r,i){this.src=t,this.dest=r,this.opts=i,this.ondrain=()=>t[cr](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Pn=class extends Vi{static{o(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,r,i){super(t,r,i),this.proxyErrors=s=>r.emit("error",s),t.on("error",this.proxyErrors)}},Wg=o(e=>!!e.objectMode,"isObjectModeOptions"),zg=o(e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer","isEncodingOptions"),At=class extends Ji.EventEmitter{static{o(this,"Minipass")}[ie]=!1;[Xr]=!1;[_e]=[];[se]=[];[ge];[Ye];[et];[hr];[dt]=!1;[Ft]=!1;[Wi]=!1;[zi]=!1;[Kr]=null;[ne]=0;[J]=!1;[Qr];[Yi]=!1;[qt]=0;[Ie]=!1;writable=!0;readable=!0;constructor(...t){let r=t[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Wg(r)?(this[ge]=!0,this[Ye]=null):zg(r)?(this[Ye]=r.encoding,this[ge]=!1):(this[ge]=!1,this[Ye]=null),this[et]=!!r.async,this[hr]=this[Ye]?new Fh.StringDecoder(this[Ye]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[se],"get")}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[_e],"get")});let{signal:i}=r;i&&(this[Qr]=i,i.aborted?this[An]():i.addEventListener("abort",()=>this[An]()))}get bufferLength(){return this[ne]}get encoding(){return this[Ye]}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[ge]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[et]}set async(t){this[et]=this[et]||!!t}[An](){this[Yi]=!0,this.emit("abort",this[Qr]?.reason),this.destroy(this[Qr]?.reason)}get aborted(){return this[Yi]}set aborted(t){}write(t,r,i){if(this[Yi])return!1;if(this[dt])throw new Error("write after end");if(this[J])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(i=r,r="utf8"),r||(r="utf8");let s=this[et]?Zr:Mg;if(!this[ge]&&!Buffer.isBuffer(t)){if(Gg(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(qg(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[ge]?(this[ie]&&this[ne]!==0&&this[Ui](!0),this[ie]?this.emit("data",t):this[Sn](t),this[ne]!==0&&this.emit("readable"),i&&s(i),this[ie]):t.length?(typeof t=="string"&&!(r===this[Ye]&&!this[hr]?.lastNeed)&&(t=Buffer.from(t,r)),Buffer.isBuffer(t)&&this[Ye]&&(t=this[hr].write(t)),this[ie]&&this[ne]!==0&&this[Ui](!0),this[ie]?this.emit("data",t):this[Sn](t),this[ne]!==0&&this.emit("readable"),i&&s(i),this[ie]):(this[ne]!==0&&this.emit("readable"),i&&s(i),this[ie])}read(t){if(this[J])return null;if(this[Ie]=!1,this[ne]===0||t===0||t&&t>this[ne])return this[mt](),null;this[ge]&&(t=null),this[se].length>1&&!this[ge]&&(this[se]=[this[Ye]?this[se].join(""):Buffer.concat(this[se],this[ne])]);let r=this[Sh](t||null,this[se][0]);return this[mt](),r}[Sh](t,r){if(this[ge])this[Hi]();else{let i=r;t===i.length||t===null?this[Hi]():typeof i=="string"?(this[se][0]=i.slice(t),r=i.slice(0,t),this[ne]-=t):(this[se][0]=i.subarray(t),r=i.subarray(0,t),this[ne]-=t)}return this.emit("data",r),!this[se].length&&!this[dt]&&this.emit("drain"),r}end(t,r,i){return typeof t=="function"&&(i=t,t=void 0),typeof r=="function"&&(i=r,r="utf8"),t!==void 0&&this.write(t,r),i&&this.once("end",i),this[dt]=!0,this.writable=!1,(this[ie]||!this[Xr])&&this[mt](),this}[cr](){this[J]||(!this[qt]&&!this[_e].length&&(this[Ie]=!0),this[Xr]=!1,this[ie]=!0,this.emit("resume"),this[se].length?this[Ui]():this[dt]?this[mt]():this.emit("drain"))}resume(){return this[cr]()}pause(){this[ie]=!1,this[Xr]=!0,this[Ie]=!1}get destroyed(){return this[J]}get flowing(){return this[ie]}get paused(){return this[Xr]}[Sn](t){this[ge]?this[ne]+=1:this[ne]+=t.length,this[se].push(t)}[Hi](){return this[ge]?this[ne]-=1:this[ne]-=this[se][0].length,this[se].shift()}[Ui](t=!1){do;while(this[_h](this[Hi]())&&this[se].length);!t&&!this[se].length&&!this[dt]&&this.emit("drain")}[_h](t){return this.emit("data",t),this[ie]}pipe(t,r){if(this[J])return t;this[Ie]=!1;let i=this[Ft];return r=r||{},t===vh.stdout||t===vh.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,i?r.end&&t.end():(this[_e].push(r.proxyErrors?new Pn(this,t,r):new Vi(this,t,r)),this[et]?Zr(()=>this[cr]()):this[cr]()),t}unpipe(t){let r=this[_e].find(i=>i.dest===t);r&&(this[_e].length===1?(this[ie]&&this[qt]===0&&(this[ie]=!1),this[_e]=[]):this[_e].splice(this[_e].indexOf(r),1),r.unpipe())}addListener(t,r){return this.on(t,r)}on(t,r){let i=super.on(t,r);if(t==="data")this[Ie]=!1,this[qt]++,!this[_e].length&&!this[ie]&&this[cr]();else if(t==="readable"&&this[ne]!==0)super.emit("readable");else if($g(t)&&this[Ft])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Kr]){let s=r;this[et]?Zr(()=>s.call(this,this[Kr])):s.call(this,this[Kr])}return i}removeListener(t,r){return this.off(t,r)}off(t,r){let i=super.off(t,r);return t==="data"&&(this[qt]=this.listeners("data").length,this[qt]===0&&!this[Ie]&&!this[_e].length&&(this[ie]=!1)),i}removeAllListeners(t){let r=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[qt]=0,!this[Ie]&&!this[_e].length&&(this[ie]=!1)),r}get emittedEnd(){return this[Ft]}[mt](){!this[Wi]&&!this[Ft]&&!this[J]&&this[se].length===0&&this[dt]&&(this[Wi]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[zi]&&this.emit("close"),this[Wi]=!1)}emit(t,...r){let i=r[0];if(t!=="error"&&t!=="close"&&t!==J&&this[J])return!1;if(t==="data")return!this[ge]&&!i?!1:this[et]?(Zr(()=>this[Tn](i)),!0):this[Tn](i);if(t==="end")return this[Th]();if(t==="close"){if(this[zi]=!0,!this[Ft]&&!this[J])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[Kr]=i,super.emit(_n,i);let n=!this[Qr]||this.listeners("error").length?super.emit("error",i):!1;return this[mt](),n}else if(t==="resume"){let n=super.emit("resume");return this[mt](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let s=super.emit(t,...r);return this[mt](),s}[Tn](t){for(let i of this[_e])i.dest.write(t)===!1&&this.pause();let r=this[Ie]?!1:super.emit("data",t);return this[mt](),r}[Th](){return this[Ft]?!1:(this[Ft]=!0,this.readable=!1,this[et]?(Zr(()=>this[Fn]()),!0):this[Fn]())}[Fn](){if(this[hr]){let r=this[hr].end();if(r){for(let i of this[_e])i.dest.write(r);this[Ie]||super.emit("data",r)}}for(let r of this[_e])r.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[ge]||(t.dataLength=0);let r=this.promise();return this.on("data",i=>{t.push(i),this[ge]||(t.dataLength+=i.length)}),await r,t}async concat(){if(this[ge])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[Ye]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,r)=>{this.on(J,()=>r(new Error("stream destroyed"))),this.on("error",i=>r(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[Ie]=!1;let t=!1,r=o(async()=>(this.pause(),t=!0,{value:void 0,done:!0}),"stop");return{next:o(()=>{if(t)return r();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[dt])return r();let n,a,l=o(u=>{this.off("data",h),this.off("end",f),this.off(J,c),r(),a(u)},"onerr"),h=o(u=>{this.off("error",l),this.off("end",f),this.off(J,c),this.pause(),n({value:u,done:!!this[dt]})},"ondata"),f=o(()=>{this.off("error",l),this.off("data",h),this.off(J,c),r(),n({done:!0,value:void 0})},"onend"),c=o(()=>l(new Error("stream destroyed")),"ondestroy");return new Promise((u,m)=>{a=m,n=u,this.once(J,c),this.once("error",l),this.once("end",f),this.once("data",h)})},"next"),throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Ie]=!1;let t=!1,r=o(()=>(this.pause(),this.off(_n,r),this.off(J,r),this.off("end",r),t=!0,{done:!0,value:void 0}),"stop"),i=o(()=>{if(t)return r();let s=this.read();return s===null?r():{done:!1,value:s}},"next");return this.once("end",r),this.once(_n,r),this.once(J,r),{next:i,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(t){if(this[J])return t?this.emit("error",t):this.emit(J),this;this[J]=!0,this[Ie]=!0,this[se].length=0,this[ne]=0;let r=this;return typeof r.close=="function"&&!this[zi]&&r.close(),t?this.emit("error",t):this.emit(J),this}static get isStream(){return Dg}};var dr=require("node:path"),Mh=require("node:url"),rt=require("fs"),Ug=M(require("node:fs"),1),Pt=require("node:fs/promises"),Hg=rt.realpathSync.native,ei={lstatSync:rt.lstatSync,readdir:rt.readdir,readdirSync:rt.readdirSync,readlinkSync:rt.readlinkSync,realpathSync:Hg,promises:{lstat:Pt.lstat,readdir:Pt.readdir,readlink:Pt.readlink,realpath:Pt.realpath}},Ah=o(e=>!e||e===ei||e===Ug?ei:{...ei,...e,promises:{...ei.promises,...e.promises||{}}},"fsFromOption"),Ph=/^\\\\\?\\([a-z]:)\\?$/i,Yg=o(e=>e.replace(/\//g,"\\").replace(Ph,"$1\\"),"uncToDrive"),Vg=/[\\\/]/,Be=0,Ch=1,kh=2,tt=4,Rh=6,Ih=8,Gt=10,Oh=12,je=15,ti=~je,kn=16,Lh=32,ri=64,Ve=128,Ki=256,Xi=512,Nh=ri|Ve|Xi,Jg=1023,Rn=o(e=>e.isFile()?Ih:e.isDirectory()?tt:e.isSymbolicLink()?Gt:e.isCharacterDevice()?kh:e.isBlockDevice()?Rh:e.isSocket()?Oh:e.isFIFO()?Ch:Be,"entToType"),Dh=new Map,ii=o(e=>{let t=Dh.get(e);if(t)return t;let r=e.normalize("NFKD");return Dh.set(e,r),r},"normalize"),Bh=new Map,Qi=o(e=>{let t=Bh.get(e);if(t)return t;let r=ii(e.toLowerCase());return Bh.set(e,r),r},"normalizeNocase"),Zi=class extends Jr{static{o(this,"ResolveCache")}constructor(){super({max:256})}},In=class extends Jr{static{o(this,"ChildrenCache")}constructor(t=16*1024){super({maxSize:t,sizeCalculation:o(r=>r.length+1,"sizeCalculation")})}},jh=Symbol("PathScurry setAsCwd"),we=class{static{o(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#i;get mode(){return this.#i}#e;get nlink(){return this.#e}#o;get uid(){return this.#o}#l;get gid(){return this.#l}#h;get rdev(){return this.#h}#f;get blksize(){return this.#f}#c;get ino(){return this.#c}#a;get size(){return this.#a}#s;get blocks(){return this.#s}#w;get atimeMs(){return this.#w}#m;get mtimeMs(){return this.#m}#p;get ctimeMs(){return this.#p}#g;get birthtimeMs(){return this.#g}#T;get atime(){return this.#T}#y;get mtime(){return this.#y}#S;get ctime(){return this.#S}#_;get birthtime(){return this.#_}#b;#x;#v;#d;#A;#F;#n;#k;#E;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,r=Be,i,s,n,a,l){this.name=t,this.#b=n?Qi(t):ii(t),this.#n=r&Jg,this.nocase=n,this.roots=s,this.root=i||this,this.#k=a,this.#v=l.fullpath,this.#A=l.relative,this.#F=l.relativePosix,this.parent=l.parent,this.parent?this.#t=this.parent.#t:this.#t=Ah(l.fs)}depth(){return this.#x!==void 0?this.#x:this.parent?this.#x=this.parent.depth()+1:this.#x=0}childrenCache(){return this.#k}resolve(t){if(!t)return this;let r=this.getRootString(t),s=t.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#O(s):this.#O(s)}#O(t){let r=this;for(let i of t)r=r.child(i);return r}children(){let t=this.#k.get(this);if(t)return t;let r=Object.assign([],{provisional:0});return this.#k.set(this,r),this.#n&=~kn,r}child(t,r){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let i=this.children(),s=this.nocase?Qi(t):ii(t);for(let h of i)if(h.#b===s)return h;let n=this.parent?this.sep:"",a=this.#v?this.#v+n+t:void 0,l=this.newChild(t,Be,{...r,parent:this,fullpath:a});return this.canReaddir()||(l.#n|=Ve),i.push(l),l}relative(){if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let t=this.name,r=this.parent;if(!r)return this.#A=this.name;let i=r.relative();return i+(!i||!r.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#F!==void 0)return this.#F;let t=this.name,r=this.parent;if(!r)return this.#F=this.fullpathPosix();let i=r.relativePosix();return i+(!i||!r.parent?"":"/")+t}fullpath(){if(this.#v!==void 0)return this.#v;let t=this.name,r=this.parent;if(!r)return this.#v=this.name;let s=r.fullpath()+(r.parent?this.sep:"")+t;return this.#v=s}fullpathPosix(){if(this.#d!==void 0)return this.#d;if(this.sep==="/")return this.#d=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#d=`//?/${s}`:this.#d=s}let t=this.parent,r=t.fullpathPosix(),i=r+(!r||!t.parent?"":"/")+this.name;return this.#d=i}isUnknown(){return(this.#n&je)===Be}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#n&je)===Ih}isDirectory(){return(this.#n&je)===tt}isCharacterDevice(){return(this.#n&je)===kh}isBlockDevice(){return(this.#n&je)===Rh}isFIFO(){return(this.#n&je)===Ch}isSocket(){return(this.#n&je)===Oh}isSymbolicLink(){return(this.#n&Gt)===Gt}lstatCached(){return this.#n&Lh?this:void 0}readlinkCached(){return this.#E}realpathCached(){return this.#R}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#E)return!0;if(!this.parent)return!1;let t=this.#n&je;return!(t!==Be&&t!==Gt||this.#n&Ki||this.#n&Ve)}calledReaddir(){return!!(this.#n&kn)}isENOENT(){return!!(this.#n&Ve)}isNamed(t){return this.nocase?this.#b===Qi(t):this.#b===ii(t)}async readlink(){let t=this.#E;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=await this.#t.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(r);if(i)return this.#E=i}catch(r){this.#u(r.code);return}}readlinkSync(){let t=this.#E;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=this.#t.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(r);if(i)return this.#E=i}catch(r){this.#u(r.code);return}}#L(t){this.#n|=kn;for(let r=t.provisional;r<t.length;r++){let i=t[r];i&&i.#N()}}#N(){this.#n&Ve||(this.#n=(this.#n|Ve)&ti,this.#P())}#P(){let t=this.children();t.provisional=0;for(let r of t)r.#N()}#C(){this.#n|=Xi,this.#D()}#D(){if(this.#n&ri)return;let t=this.#n;(t&je)===tt&&(t&=ti),this.#n=t|ri,this.#P()}#B(t=""){t==="ENOTDIR"||t==="EPERM"?this.#D():t==="ENOENT"?this.#N():this.children().provisional=0}#j(t=""){t==="ENOTDIR"?this.parent.#D():t==="ENOENT"&&this.#N()}#u(t=""){let r=this.#n;r|=Ki,t==="ENOENT"&&(r|=Ve),(t==="EINVAL"||t==="UNKNOWN")&&(r&=ti),this.#n=r,t==="ENOTDIR"&&this.parent&&this.parent.#D()}#M(t,r){return this.#I(t,r)||this.#$(t,r)}#$(t,r){let i=Rn(t),s=this.newChild(t.name,i,{parent:this}),n=s.#n&je;return n!==tt&&n!==Gt&&n!==Be&&(s.#n|=ri),r.unshift(s),r.provisional++,s}#I(t,r){for(let i=r.provisional;i<r.length;i++){let s=r[i];if((this.nocase?Qi(t.name):ii(t.name))===s.#b)return this.#q(t,s,i,r)}}#q(t,r,i,s){let n=r.name;return r.#n=r.#n&ti|Rn(t),n!==t.name&&(r.name=t.name),i!==s.provisional&&(i===s.length-1?s.pop():s.splice(i,1),s.unshift(r)),s.provisional++,r}async lstat(){if((this.#n&Ve)===0)try{return this.#U(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#j(t.code)}}lstatSync(){if((this.#n&Ve)===0)try{return this.#U(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#j(t.code)}}#U(t){let{atime:r,atimeMs:i,birthtime:s,birthtimeMs:n,blksize:a,blocks:l,ctime:h,ctimeMs:f,dev:c,gid:u,ino:m,mode:p,mtime:y,mtimeMs:b,nlink:E,rdev:x,size:C,uid:A}=t;this.#T=r,this.#w=i,this.#_=s,this.#g=n,this.#f=a,this.#s=l,this.#S=h,this.#p=f,this.#r=c,this.#l=u,this.#c=m,this.#i=p,this.#y=y,this.#m=b,this.#e=E,this.#h=x,this.#a=C,this.#o=A;let S=Rn(t);this.#n=this.#n&ti|S|Lh,S!==Be&&S!==tt&&S!==Gt&&(this.#n|=ri)}#W=[];#z=!1;#H(t){this.#z=!1;let r=this.#W.slice();this.#W.length=0,r.forEach(i=>i(null,t))}readdirCB(t,r=!1){if(!this.canReaddir()){r?t(null,[]):queueMicrotask(()=>t(null,[]));return}let i=this.children();if(this.calledReaddir()){let n=i.slice(0,i.provisional);r?t(null,n):queueMicrotask(()=>t(null,n));return}if(this.#W.push(t),this.#z)return;this.#z=!0;let s=this.fullpath();this.#t.readdir(s,{withFileTypes:!0},(n,a)=>{if(n)this.#B(n.code),i.provisional=0;else{for(let l of a)this.#M(l,i);this.#L(i)}this.#H(i.slice(0,i.provisional))})}#G;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();if(this.#G)await this.#G;else{let i=o(()=>{},"resolve");this.#G=new Promise(s=>i=s);try{for(let s of await this.#t.promises.readdir(r,{withFileTypes:!0}))this.#M(s,t);this.#L(t)}catch(s){this.#B(s.code),t.provisional=0}this.#G=void 0,i()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();try{for(let i of this.#t.readdirSync(r,{withFileTypes:!0}))this.#M(i,t);this.#L(t)}catch(i){this.#B(i.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#n&Nh)return!1;let t=je&this.#n;return t===Be||t===tt||t===Gt}shouldWalk(t,r){return(this.#n&tt)===tt&&!(this.#n&Nh)&&!t.has(this)&&(!r||r(this))}async realpath(){if(this.#R)return this.#R;if(!((Xi|Ki|Ve)&this.#n))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#R=this.resolve(t)}catch{this.#C()}}realpathSync(){if(this.#R)return this.#R;if(!((Xi|Ki|Ve)&this.#n))try{let t=this.#t.realpathSync(this.fullpath());return this.#R=this.resolve(t)}catch{this.#C()}}[jh](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let r=new Set([]),i=[],s=this;for(;s&&s.parent;)r.add(s),s.#A=i.join(this.sep),s.#F=i.join("/"),s=s.parent,i.push("..");for(s=t;s&&s.parent&&!r.has(s);)s.#A=void 0,s.#F=void 0,s=s.parent}},es=class e extends we{static{o(this,"PathWin32")}sep="\\";splitSep=Vg;constructor(t,r=Be,i,s,n,a,l){super(t,r,i,s,n,a,l)}newChild(t,r=Be,i={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(t){return dr.win32.parse(t).root}getRoot(t){if(t=Yg(t.toUpperCase()),t===this.root.name)return this.root;for(let[r,i]of Object.entries(this.roots))if(this.sameRoot(t,r))return this.roots[t]=i;return this.roots[t]=new fr(t,this).root}sameRoot(t,r=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(Ph,"$1\\"),t===r}},ts=class e extends we{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(t,r=Be,i,s,n,a,l){super(t,r,i,s,n,a,l)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,r=Be,i={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}},rs=class{static{o(this,"PathScurryBase")}root;rootPath;roots;cwd;#t;#r;#i;nocase;#e;constructor(t=process.cwd(),r,i,{nocase:s,childrenCacheSize:n=16*1024,fs:a=ei}={}){this.#e=Ah(a),(t instanceof URL||t.startsWith("file://"))&&(t=(0,Mh.fileURLToPath)(t));let l=r.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(l),this.#t=new Zi,this.#r=new Zi,this.#i=new In(n);let h=l.substring(this.rootPath.length).split(i);if(h.length===1&&!h[0]&&h.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let f=this.root,c=h.length-1,u=r.sep,m=this.rootPath,p=!1;for(let y of h){let b=c--;f=f.child(y,{relative:new Array(b).fill("..").join(u),relativePosix:new Array(b).fill("..").join("/"),fullpath:m+=(p?"":u)+y}),p=!0}this.cwd=f}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#i}resolve(...t){let r="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let i=this.#t.get(r);if(i!==void 0)return i;let s=this.cwd.resolve(r).fullpath();return this.#t.set(r,s),s}resolvePosix(...t){let r="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let i=this.#r.get(r);if(i!==void 0)return i;let s=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,s),s}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i}=r;if(t.canReaddir()){let s=await t.readdir();return i?s:s.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0}=r;return t.canReaddir()?i?t.readdirSync():t.readdirSync().map(s=>s.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t.withFileTypes,t=this.cwd);let i=await t.readlink();return r?i:i?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t.withFileTypes,t=this.cwd);let i=t.readlinkSync();return r?i:i?.fullpath()}async realpath(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t.withFileTypes,t=this.cwd);let i=await t.realpath();return r?i:i?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t.withFileTypes,t=this.cwd);let i=t.realpathSync();return r?i:i?.fullpath()}async walk(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r,l=[];(!n||n(t))&&l.push(i?t:t.fullpath());let h=new Set,f=o((u,m)=>{h.add(u),u.readdirCB((p,y)=>{if(p)return m(p);let b=y.length;if(!b)return m();let E=o(()=>{--b===0&&m()},"next");for(let x of y)(!n||n(x))&&l.push(i?x:x.fullpath()),s&&x.isSymbolicLink()?x.realpath().then(C=>C?.isUnknown()?C.lstat():C).then(C=>C?.shouldWalk(h,a)?f(C,E):E()):x.shouldWalk(h,a)?f(x,E):E()},!0)},"walk"),c=t;return new Promise((u,m)=>{f(c,p=>{if(p)return m(p);u(l)})})}walkSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r,l=[];(!n||n(t))&&l.push(i?t:t.fullpath());let h=new Set([t]);for(let f of h){let c=f.readdirSync();for(let u of c){(!n||n(u))&&l.push(i?u:u.fullpath());let m=u;if(u.isSymbolicLink()){if(!(s&&(m=u.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(h,a)&&h.add(m)}}return l}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,r={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd),this.stream(t,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r;(!n||n(t))&&(yield i?t:t.fullpath());let l=new Set([t]);for(let h of l){let f=h.readdirSync();for(let c of f){(!n||n(c))&&(yield i?c:c.fullpath());let u=c;if(c.isSymbolicLink()){if(!(s&&(u=c.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(l,a)&&l.add(u)}}}stream(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r,l=new At({objectMode:!0});(!n||n(t))&&l.write(i?t:t.fullpath());let h=new Set,f=[t],c=0,u=o(()=>{let m=!1;for(;!m;){let p=f.shift();if(!p){c===0&&l.end();return}c++,h.add(p);let y=o((E,x,C=!1)=>{if(E)return l.emit("error",E);if(s&&!C){let A=[];for(let S of x)S.isSymbolicLink()&&A.push(S.realpath().then(D=>D?.isUnknown()?D.lstat():D));if(A.length){Promise.all(A).then(()=>y(null,x,!0));return}}for(let A of x)A&&(!n||n(A))&&(l.write(i?A:A.fullpath())||(m=!0));c--;for(let A of x){let S=A.realpathCached()||A;S.shouldWalk(h,a)&&f.push(S)}m&&!l.flowing?l.once("drain",u):b||u()},"onReaddir"),b=!0;p.readdirCB(y,!0),b=!1}},"process");return u(),l}streamSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r,l=new At({objectMode:!0}),h=new Set;(!n||n(t))&&l.write(i?t:t.fullpath());let f=[t],c=0,u=o(()=>{let m=!1;for(;!m;){let p=f.shift();if(!p){c===0&&l.end();return}c++,h.add(p);let y=p.readdirSync();for(let b of y)(!n||n(b))&&(l.write(i?b:b.fullpath())||(m=!0));c--;for(let b of y){let E=b;if(b.isSymbolicLink()){if(!(s&&(E=b.realpathSync())))continue;E.isUnknown()&&E.lstatSync()}E.shouldWalk(h,a)&&f.push(E)}}m&&!l.flowing&&l.once("drain",u)},"process");return u(),l}chdir(t=this.cwd){let r=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[jh](r)}},fr=class extends rs{static{o(this,"PathScurryWin32")}sep="\\";constructor(t=process.cwd(),r={}){let{nocase:i=!0}=r;super(t,dr.win32,"\\",{...r,nocase:i}),this.nocase=i;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(t){return dr.win32.parse(t).root.toUpperCase()}newRoot(t){return new es(this.rootPath,tt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},ur=class extends rs{static{o(this,"PathScurryPosix")}sep="/";constructor(t=process.cwd(),r={}){let{nocase:i=!1}=r;super(t,dr.posix,"/",{...r,nocase:i}),this.nocase=i}parseRootPath(t){return"/"}newRoot(t){return new ts(this.rootPath,tt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},si=class extends ur{static{o(this,"PathScurryDarwin")}constructor(t=process.cwd(),r={}){let{nocase:i=!0}=r;super(t,{...r,nocase:i})}},T_=process.platform==="win32"?es:ts,$h=process.platform==="win32"?fr:process.platform==="darwin"?si:ur;var Kg=o(e=>e.length>=1,"isPatternList"),Xg=o(e=>e.length>=1,"isGlobList"),mr=class e{static{o(this,"Pattern")}#t;#r;#i;length;#e;#o;#l;#h;#f;#c;#a=!0;constructor(t,r,i,s){if(!Kg(t))throw new TypeError("empty pattern list");if(!Xg(r))throw new TypeError("empty glob list");if(r.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#r=r,this.#i=i,this.#e=s,this.#i===0){if(this.isUNC()){let[n,a,l,h,...f]=this.#t,[c,u,m,p,...y]=this.#r;f[0]===""&&(f.shift(),y.shift());let b=[n,a,l,h,""].join("/"),E=[c,u,m,p,""].join("/");this.#t=[b,...f],this.#r=[E,...y],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...a]=this.#t,[l,...h]=this.#r;a[0]===""&&(a.shift(),h.shift());let f=n+"/",c=l+"/";this.#t=[f,...a],this.#r=[c,...h],this.length=this.#t.length}}}pattern(){return this.#t[this.#i]}isString(){return typeof this.#t[this.#i]=="string"}isGlobstar(){return this.#t[this.#i]===de}isRegExp(){return this.#t[this.#i]instanceof RegExp}globString(){return this.#l=this.#l||(this.#i===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new e(this.#t,this.#r,this.#i+1,this.#e),this.#o.#c=this.#c,this.#o.#f=this.#f,this.#o.#h=this.#h,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#f!==void 0?this.#f:this.#f=this.#e==="win32"&&this.#i===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#h!==void 0?this.#h:this.#h=this.#e==="win32"&&this.#i===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#c!==void 0?this.#c:this.#c=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#i===0?t:""}checkFollowGlobstar(){return!(this.#i===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#i===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Qg=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",pr=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:r,nocase:i,noext:s,noglobstar:n,platform:a=Qg}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:r,nocase:i,noext:s,noglobstar:n,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let l of t)this.add(l)}add(t){let r=new Re(t,this.mmopts);for(let i=0;i<r.set.length;i++){let s=r.set[i],n=r.globParts[i];if(!s||!n)throw new Error("invalid pattern object");for(;s[0]==="."&&n[0]===".";)s.shift(),n.shift();let a=new mr(s,n,0,this.platform),l=new Re(a.globString(),this.mmopts),h=n[n.length-1]==="**",f=a.isAbsolute();f?this.absolute.push(l):this.relative.push(l),h&&(f?this.absoluteChildren.push(l):this.relativeChildren.push(l))}}ignored(t){let r=t.fullpath(),i=`${r}/`,s=t.relative()||".",n=`${s}/`;for(let a of this.relative)if(a.match(s)||a.match(n))return!0;for(let a of this.absolute)if(a.match(r)||a.match(i))return!0;return!1}childrenIgnored(t){let r=t.fullpath()+"/",i=(t.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(i))return!0;for(let s of this.absoluteChildren)if(s.match(r))return!0;return!1}};var On=class e{static{o(this,"HasWalkedCache")}store;constructor(t=new Map){this.store=t}copy(){return new e(new Map(this.store))}hasWalked(t,r){return this.store.get(t.fullpath())?.has(r.globString())}storeWalked(t,r){let i=t.fullpath(),s=this.store.get(i);s?s.add(r.globString()):this.store.set(i,new Set([r.globString()]))}},Ln=class{static{o(this,"MatchRecord")}store=new Map;add(t,r,i){let s=(r?2:0)|(i?1:0),n=this.store.get(t);this.store.set(t,n===void 0?s:s&n)}entries(){return[...this.store.entries()].map(([t,r])=>[t,!!(r&2),!!(r&1)])}},Nn=class{static{o(this,"SubWalks")}store=new Map;add(t,r){if(!t.canReaddir())return;let i=this.store.get(t);i?i.find(s=>s.globString()===r.globString())||i.push(r):this.store.set(t,[r])}get(t){let r=this.store.get(t);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},ni=class e{static{o(this,"Processor")}hasWalkedCache;matches=new Ln;subwalks=new Nn;patterns;follow;dot;opts;constructor(t,r){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=r?r.copy():new On}processPatterns(t,r){this.patterns=r;let i=r.map(s=>[t,s]);for(let[s,n]of i){this.hasWalkedCache.storeWalked(s,n);let a=n.root(),l=n.isAbsolute()&&this.opts.absolute!==!1;if(a){s=s.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let u=n.rest();if(u)n=u;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let h,f,c=!1;for(;typeof(h=n.pattern())=="string"&&(f=n.rest());)s=s.resolve(h),n=f,c=!0;if(h=n.pattern(),f=n.rest(),c){if(this.hasWalkedCache.hasWalked(s,n))continue;this.hasWalkedCache.storeWalked(s,n)}if(typeof h=="string"){let u=h===".."||h===""||h===".";this.matches.add(s.resolve(h),l,u);continue}else if(h===de){(!s.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(s,n);let u=f?.pattern(),m=f?.rest();if(!f||(u===""||u===".")&&!m)this.matches.add(s,l,u===""||u===".");else if(u===".."){let p=s.parent||s;m?this.hasWalkedCache.hasWalked(p,m)||this.subwalks.add(p,m):this.matches.add(p,l,!0)}}else h instanceof RegExp&&this.subwalks.add(s,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(t,r){let i=this.subwalks.get(t),s=this.child();for(let n of r)for(let a of i){let l=a.isAbsolute(),h=a.pattern(),f=a.rest();h===de?s.testGlobstar(n,a,f,l):h instanceof RegExp?s.testRegExp(n,h,f,l):s.testString(n,h,f,l)}return s}testGlobstar(t,r,i,s){if((this.dot||!t.name.startsWith("."))&&(r.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,r):t.isSymbolicLink()&&(i&&r.checkFollowGlobstar()?this.subwalks.add(t,i):r.markFollowGlobstar()&&this.subwalks.add(t,r)))),i){let n=i.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,i.rest(),s);else if(n===".."){let a=t.parent||t;this.subwalks.add(a,i)}else n instanceof RegExp&&this.testRegExp(t,n,i.rest(),s)}}testRegExp(t,r,i,s){r.test(t.name)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}testString(t,r,i,s){t.isNamed(r)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}};var Zg=o((e,t)=>typeof e=="string"?new pr([e],t):Array.isArray(e)?new pr(e,t):e,"makeIgnore"),is=class{static{o(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#i;signal;maxDepth;includeChildMatches;constructor(t,r,i){if(this.patterns=t,this.path=r,this.opts=i,this.#i=!i.posix&&i.platform==="win32"?"\\":"/",this.includeChildMatches=i.includeChildMatches!==!1,(i.ignore||!this.includeChildMatches)&&(this.#r=Zg(i.ignore??[],i),!this.includeChildMatches&&typeof this.#r.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(t){return this.seen.has(t)||!!this.#r?.ignored?.(t)}#o(t){return!!this.#r?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=t.realpathCached()||await t.realpath(),!i)return;t=i}let n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let a=await n.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(n,r)}matchCheckTest(t,r){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!r||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#e(t)?t:void 0}matchCheckSync(t,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=t.realpathCached()||t.realpathSync(),!i)return;t=i}let n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let a=n.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(n,r)}matchFinish(t,r){if(this.#e(t))return;if(!this.includeChildMatches&&this.#r?.add){let n=`${t.relativePosix()}/**`;this.#r.add(n)}let i=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(i){let n=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(n+s)}else{let n=this.opts.posix?t.relativePosix():t.relative(),a=this.opts.dotRelative&&!n.startsWith(".."+this.#i)?"."+this.#i:"";this.matchEmit(n?a+n+s:"."+s)}}async match(t,r,i){let s=await this.matchCheck(t,i);s&&this.matchFinish(s,r)}matchSync(t,r,i){let s=this.matchCheckSync(t,i);s&&this.matchFinish(s,r)}walkCB(t,r,i){this.signal?.aborted&&i(),this.walkCB2(t,r,new ni(this.opts),i)}walkCB2(t,r,i,s){if(this.#o(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(t,r,i,s));return}i.processPatterns(t,r);let n=1,a=o(()=>{--n===0&&s()},"next");for(let[l,h,f]of i.matches.entries())this.#e(l)||(n++,this.match(l,h,f).then(()=>a()));for(let l of i.subwalkTargets()){if(this.maxDepth!==1/0&&l.depth()>=this.maxDepth)continue;n++;let h=l.readdirCached();l.calledReaddir()?this.walkCB3(l,h,i,a):l.readdirCB((f,c)=>this.walkCB3(l,c,i,a),!0)}a()}walkCB3(t,r,i,s){i=i.filterEntries(t,r);let n=1,a=o(()=>{--n===0&&s()},"next");for(let[l,h,f]of i.matches.entries())this.#e(l)||(n++,this.match(l,h,f).then(()=>a()));for(let[l,h]of i.subwalks.entries())n++,this.walkCB2(l,h,i.child(),a);a()}walkCBSync(t,r,i){this.signal?.aborted&&i(),this.walkCB2Sync(t,r,new ni(this.opts),i)}walkCB2Sync(t,r,i,s){if(this.#o(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(t,r,i,s));return}i.processPatterns(t,r);let n=1,a=o(()=>{--n===0&&s()},"next");for(let[l,h,f]of i.matches.entries())this.#e(l)||this.matchSync(l,h,f);for(let l of i.subwalkTargets()){if(this.maxDepth!==1/0&&l.depth()>=this.maxDepth)continue;n++;let h=l.readdirSync();this.walkCB3Sync(l,h,i,a)}a()}walkCB3Sync(t,r,i,s){i=i.filterEntries(t,r);let n=1,a=o(()=>{--n===0&&s()},"next");for(let[l,h,f]of i.matches.entries())this.#e(l)||this.matchSync(l,h,f);for(let[l,h]of i.subwalks.entries())n++,this.walkCB2Sync(l,h,i.child(),a);a()}},oi=class extends is{static{o(this,"GlobWalker")}matches=new Set;constructor(t,r,i){super(t,r,i)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},ai=class extends is{static{o(this,"GlobStream")}results;constructor(t,r,i){super(t,r,i),this.results=new At({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var qh=require("node:url"),ew=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Je=class{static{o(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,qh.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(h=>h.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(h=>h.includes("/")?h:`./**/${h}`)}if(this.pattern=t,this.platform=r.platform||ew,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let h=r.platform==="win32"?fr:r.platform==="darwin"?si:r.platform?ur:$h;this.scurry=new h(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",s={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(h=>new Re(h,s)),[a,l]=n.reduce((h,f)=>(h[0].push(...f.set),h[1].push(...f.globParts),h),[[],[]]);this.patterns=a.map((h,f)=>{let c=l[f];if(!c)throw new Error("invalid pattern object");return new mr(h,c,0,this.platform)})}async walk(){return[...await new oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new ai(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new ai(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var Dn=o((e,t={})=>{Array.isArray(e)||(e=[e]);for(let r of e)if(new Re(r,t).hasMagic())return!0;return!1},"hasMagic");function ss(e,t={}){return new Je(e,t).streamSync()}o(ss,"globStreamSync");function Gh(e,t={}){return new Je(e,t).stream()}o(Gh,"globStream");function Wh(e,t={}){return new Je(e,t).walkSync()}o(Wh,"globSync");async function zh(e,t={}){return new Je(e,t).walk()}o(zh,"glob_");function ns(e,t={}){return new Je(e,t).iterateSync()}o(ns,"globIterateSync");function Uh(e,t={}){return new Je(e,t).iterate()}o(Uh,"globIterate");var tw=ss,rw=Object.assign(Gh,{sync:ss}),iw=ns,sw=Object.assign(Uh,{sync:ns}),nw=Object.assign(Wh,{stream:ss,iterate:ns}),os=Object.assign(zh,{glob:zh,globSync:Wh,sync:nw,globStream:Gh,stream:rw,globStreamSync:ss,streamSync:tw,globIterate:Uh,iterate:sw,globIterateSync:ns,iterateSync:iw,Glob:Je,hasMagic:Dn,escape:or,unescape:He});os.glob=os;async function Wt(...e){let t=await os(...e);return t.forEach((r,i)=>{t[i]=t[i].toString().replace(/\\/g,"/")}),t}o(Wt,"normalizedGlob");var Hh=M(require("node:os"),1),Yh=require("node:path/posix"),Ke;function Vh(e){Ke=e}o(Vh,"setPVRTexToolAbsolutePath");async function Jh(){if(process.env.PVRTexToolCLI)return Ke=process.env.PVRTexToolCLI;let e=Hh.default.platform(),t=null;switch(e){case"darwin":t="/Applications/Imagination/";case"win32":t="C:/Imagination Technologies/";default:break}if(!t)return;let r=await Wt((0,Yh.join)(t,"**"),{nodir:!0});switch(e){case"darwin":return Ke=r.find(i=>i.endsWith("macOS/PVRTexToolCLI"));case"win32":return Ke=r.find(i=>i.endsWith("Windows_x86_64/PVRTexToolCLI.exe"))}}o(Jh,"locatePVRTexTool");var O=require("node:path/posix"),K=require("node:fs/promises"),X=M(We(),1);async function Kh(e){await Promise.all([X.default.ensureDir((0,O.join)(e,"nodes")),X.default.ensureDir((0,O.join)(e,"meshes")),X.default.ensureDir((0,O.join)(e,"lods")),X.default.ensureDir((0,O.join)(e,"lights")),X.default.ensureDir((0,O.join)(e,"cameras")),X.default.ensureDir((0,O.join)(e,"geometries")),X.default.ensureDir((0,O.join)(e,"skeletons")),X.default.ensureDir((0,O.join)(e,"shadowGenerators")),X.default.ensureDir((0,O.join)(e,"sceneLinks")),X.default.ensureDir((0,O.join)(e,"gui")),X.default.ensureDir((0,O.join)(e,"sounds")),X.default.ensureDir((0,O.join)(e,"particleSystems")),X.default.ensureDir((0,O.join)(e,"morphTargetManagers")),X.default.ensureDir((0,O.join)(e,"morphTargets")),X.default.ensureDir((0,O.join)(e,"animationGroups")),X.default.ensureDir((0,O.join)(e,"sprite-maps")),X.default.ensureDir((0,O.join)(e,"sprite-managers")),X.default.ensureDir((0,O.join)(e,"nodeParticleSystemSets"))])}o(Kh,"ensureSceneDirectories");async function Xh(e){let[t,r,i,s,n,a,l,h,f,c,u,m,p,y,b,E,x,C]=await Promise.all([(0,K.readdir)((0,O.join)(e,"nodes")),(0,K.readdir)((0,O.join)(e,"meshes")),(0,K.readdir)((0,O.join)(e,"lods")),(0,K.readdir)((0,O.join)(e,"lights")),(0,K.readdir)((0,O.join)(e,"cameras")),(0,K.readdir)((0,O.join)(e,"skeletons")),(0,K.readdir)((0,O.join)(e,"shadowGenerators")),(0,K.readdir)((0,O.join)(e,"sceneLinks")),(0,K.readdir)((0,O.join)(e,"gui")),(0,K.readdir)((0,O.join)(e,"sounds")),(0,K.readdir)((0,O.join)(e,"particleSystems")),(0,K.readdir)((0,O.join)(e,"morphTargetManagers")),(0,K.readdir)((0,O.join)(e,"morphTargets")),(0,K.readdir)((0,O.join)(e,"animationGroups")),(0,K.readdir)((0,O.join)(e,"sprite-maps")),(0,K.readdir)((0,O.join)(e,"sprite-managers")),(0,K.readdir)((0,O.join)(e,"geometries")),(0,K.readdir)((0,O.join)(e,"nodeParticleSystemSets"))]);return{nodesFiles:t,meshesFiles:r,lodsFiles:i,lightsFiles:s,cameraFiles:n,skeletonFiles:a,shadowGeneratorFiles:l,sceneLinkFiles:h,guiFiles:f,soundFiles:c,particleSystemFiles:u,morphTargetManagerFiles:m,morphTargetFiles:p,animationGroupFiles:y,spriteMapFiles:b,spriteManagerFiles:E,geometryFiles:x,nodeParticleSystemSetFiles:C}}o(Xh,"readSceneDirectories");var Yc=require("node:child_process");function Vc(e){return new Promise((t,r)=>{(0,Yc.exec)(e,(i,s,n)=>{i?(console.error(Mt.red(e),Mt.red(n)),r(i)):(console.log(Mt.gray(e),Mt.gray(s)),t())})})}o(Vc,"executeAsync");var Rt=require("node:path/posix"),Kc=M(We(),1),Xc=M(Hc(),1),Qc=require("node:fs"),cy=["-astc.ktx","-dxt.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"],fy=[".png",".jpg",".jpeg",".bmp"];function XT(){let e="";try{e=localStorage.getItem("editor-compressed-textures-cli-path")??""}catch{}return e||null}o(XT,"getCompressedTexturesCliPath");function QT(e){try{localStorage.setItem("editor-compressed-textures-cli-path",e)}catch{}}o(QT,"setCompressedTexturesCliPath");function uy(e,t){return`${e.substring(0,e.lastIndexOf("."))}${t}`}o(uy,"getCompressedTextureFilename");async function $e(e,t){t.format?await Jc(e,t):await Promise.all(cy.map(r=>Jc(e,{...t,format:r})))}o($e,"compressFileToKtx");async function Jc(e,t){let r=(0,Rt.basename)(e),i=(0,Rt.extname)(r).toLocaleLowerCase();if(!fy.includes(i))return null;let s=uy(r,t.format);if(t.destinationFolder??=(0,Rt.dirname)(e),t.destinationFolder=(0,Rt.join)(t.destinationFolder,s),await Kc.default.pathExists(t.destinationFolder)&&!t.force)return t.exportedAssets?.push(t.destinationFolder),t.destinationFolder;let n=await new Promise(l=>{let h=(0,Qc.createReadStream)(e);h.pipe(new Xc.PNG).on("metadata",f=>{l(f.alpha),h.close()}).on("error",()=>{l(!1),h.close()})});if(!Ke)return null;let a=null;switch(t.format){case"-astc.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ASTC_8x8,UBN,lRGB -q astcveryfast -o "${t.destinationFolder}"`;break;case"-dxt.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -m -ics lRGB ${n?"-l":""} -f ${n?"BC2":"BC1"},UBN,lRGB -o "${t.destinationFolder}"`;break;case"-pvrtc.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -square + -m -dither -ics lRGB ${n?"-l":""} -f ${n?"PVRTCI_2BPP_RGBA":"PVRTCI_2BPP_RGB"},UBN,lRGB -q pvrtcfastest -o "${t.destinationFolder}"`;break;case"-etc1.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ETC1,UBN,lRGB -q etcfast -o "${t.destinationFolder}"`;break;case"-etc2.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ${n?"ETC2_RGBA":"ETC2_RGB"},UBN,lRGB -q etcfast -o "${t.destinationFolder}"`;break}if(!a)return null;console.log(`Compressing image "${s}"`);try{return await Vc(a),console.log(`Compressed image "${s}"`),t.exportedAssets?.push(t.destinationFolder),t.destinationFolder}catch{console.error(`Failed to compress image "${s}"`)}return null}o(Jc,"compressFileToKtxFormat");function RA(e=4096,t){let r=t??1,i=[];for(;r<=e;)i.push(r),r<<=1;return i}o(RA,"getPowerOfTwoSizesUntil");function Vt(e){let t=1;for(;t<=e;)t<<=1;return t>>1}o(Vt,"getPowerOfTwoUntil");var wt=require("node:path/posix"),Ao=M(Fo(),1),Po=M(We(),1);function Cr(e){return(0,wt.join)(e,"assets","editor-generated_extracted-textures")}o(Cr,"getExtractedTextureOutputPath");async function Ad(e,t){let r=(0,wt.extname)(e).toLocaleLowerCase(),i=await(0,Ao.default)(e).metadata();if(!i.width||!i.height)return console.error(`Failed to compute exported image "${e}". Image metadata is invalid.`);let s=i.width,n=i.height,a=s===Vt(s)||n===Vt(n),l=[],h=s*.66>>0,f=n*.66>>0;a&&(h=Vt(h),f=Vt(f)),l.push({width:h,height:f});let c=s*.33>>0,u=n*.33>>0;a&&(c=Vt(c),u=Vt(u)),l.push({width:c,height:u});for(let m of l){let y=`${(0,wt.basename)(e).replace(r,"")}_${m.width}_${m.height}${r}`,b=(0,wt.join)((0,wt.dirname)(e),y);if(t.exportedAssets.push(b),t.force||!await Po.default.pathExists(b))try{let E=await(0,Ao.default)(e).resize(m.width,m.height).toBuffer();await Po.default.writeFile(b,E),console.log(`Exported scaled texture "${y}"`)}catch{console.error(`Failed to export image scaled image "${y}"`)}t.compressedTexturesEnabled&&await $e(b,{...t})}}o(Ad,"processExportedTexture");var Pd=require("node:path/posix"),Cd=require("node:worker_threads");function S2(e,t){return e=(0,Pd.join)("__dirname".replace(/\\/g,"/"),e),new Cd.Worker(e,{workerData:t})}o(S2,"loadWorker");async function kd(e,t){let r=S2(e,t);return new Promise(i=>{r.on("message",s=>{t.id&&s.id!==t.id||(t.id||r.terminate(),i(s))})})}o(kd,"executeSimpleWorker");var Co=require("node:path/posix"),ko=M(We(),1),Rd=M(Fo(),1);async function kr(e,t){let r=e.split(","),n=r[0].split(";")[1],a=r[1];if(n==="base64"){let l=Buffer.from(a,"base64"),h=(0,Rd.default)(l),[f,c]=await Promise.all([h.metadata(),kd("workers/md5.mjs",l)]),u;switch(f.format){case"png":u=`${c}.png`;break;case"jpg":case"jpeg":u=`${c}.jpg`;break;default:return console.error(`Unsupported embedded texture format while extracting texture: ${f.format}`),null}let m=(0,Co.join)(t.extractedTexturesOutputPath,u);return await ko.default.pathExists(m)||await ko.default.writeFile(m,l),(0,Co.join)("assets","editor-generated_extracted-textures",u).replace(/\\/g,"/")}return null}o(kr,"extractTextureAssetFromDataString");async function wi(e,t){try{let r=await fetch(e),i=await r.arrayBuffer(),s=Buffer.from(i).toString("base64"),n=`data:${r.headers.get("content-type")??"image/unknown"};base64,${s}`;return kr(n,{...t})}catch(r){console.error(`Failed to extract texture from url "${e}": ${r.message}`)}return null}o(wi,"extractTextureAssetFromUrl");var Id=require("node:path/posix"),Fs=M(We(),1);async function Od(e,t){let r=await Fs.default.readJSON(e);if(r.customType!=="BABYLON.NodeMaterial")return;let i=Cr(t.publicDir);await Fs.default.ensureDir(i);let s=await Ro(r,{extractedTexturesOutputPath:i});await Fs.default.writeJSON(e,r,{encoding:"utf-8"}),await Promise.all(s.map(async n=>{let a=(0,Id.join)(t.publicDir,n);t.exportedAssets.push(a),await $e(a,{force:t.force,exportedAssets:t.exportedAssets})}))}o(Od,"processExportedMaterial");async function Ro(e,t){let r=e.blocks.filter(s=>(s.customType==="BABYLON.TextureBlock"||s.customType==="BABYLON.ImageSourceBlock")&&s.texture?.name),i=[];return await Promise.all(r.map(async s=>{if(s.texture?.name?.startsWith("http://")||s.texture.name.startsWith("https://")){let n=await wi(s.texture.name,{...t});n&&(i.push(n),s.texture.name=s.texture.url=n)}if(s.texture.name?.startsWith("data:")){let n=await kr(s.texture.name,{...t});n&&(i.push(n),s.texture.name=s.texture.url=n)}})),i}o(Ro,"extractNodeMaterialTextures");var Ld=require("node:path/posix"),As=M(We(),1);async function Nd(e,t){let r=await As.default.readJSON(e);if(r.customType!=="BABYLON.NodeParticleSystemSet")return;let i=Cr(t.publicDir);await As.default.ensureDir(i);let s=await Io(r,{extractedTexturesOutputPath:i});await As.default.writeJSON(e,r,{encoding:"utf-8"}),await Promise.all(s.map(async n=>{let a=(0,Ld.join)(t.publicDir,n);t.exportedAssets.push(a),t.optimize&&await $e(a,{force:t.force,exportedAssets:t.exportedAssets})}))}o(Nd,"processExportedNodeParticleSystemSet");async function Dd(e,t){let r=null;return e.texture?.name.startsWith("http://")||e.texture?.name.startsWith("https://")?r=await wi(e.texture.name,{...t}):e.texture?.name.startsWith("data:")&&(r=await kr(e.texture.name,{...t})),r&&(e.texture.name=r,e.texture.url=e.texture.name),r}o(Dd,"extractParticleSystemTextures");async function Io(e,t){let r=e.blocks.filter(s=>s.customType==="BABYLON.ParticleTextureSourceBlock"),i=[];return await Promise.all(r.map(async s=>{if(s.url?.startsWith("http://")||s.url?.startsWith("https://")){let n=await wi(s.url,{...t});n&&(i.push(n),s.url=`/scene/${n}`)}if(s.textureDataUrl?.startsWith("data:")){let n=await kr(s.textureDataUrl,{...t});n&&(i.push(n),delete s.textureDataUrl,s.url=`/scene/${n}`,s.serializedCachedData=!1)}})),i}o(Io,"extractNodeParticleSystemSetTextures");var yt=require("node:path/posix"),yi=M(We(),1),Bd=[".jpg",".jpeg",".webp",".png",".bmp"],_2=[".env",".dds"],T2=[".mp3",".wav",".wave",".ogg"],F2=[".material",".gui",".cinematic",".npss",".json"],A2=[".3dl",".exr",".hdr"],P2=[...Bd,..._2,...T2,...F2,...A2];async function jd(e,t){let r=e.includes(".navmesh"),i=(0,yt.extname)(e).toLocaleLowerCase();if(!r&&!P2.includes(i)||(0,yt.basename)(e).startsWith("editor_preview"))return;let s=e.replace((0,yt.join)(t.projectDir,"/"),""),n=s.split("/"),a="";for(let m=0;m<n.length-1;++m){try{await yi.default.ensureDir((0,yt.join)(t.publicDir,a,n[m]))}catch{}a=(0,yt.join)(a,n[m])}let l=!1,f=(await yi.default.stat(e)).mtimeMs.toString();l=!t.cache[s]||t.cache[s]!==f,t.cache[s]=f;let c=(0,yt.join)(t.publicDir,s),u=await yi.default.pathExists(c);(l||!u)&&await yi.default.copyFile(e,c),t.exportedAssets.push(c),t.optimize&&t.compressedTexturesEnabled&&await $e(c,{force:l,exportedAssets:t.exportedAssets}),t.optimize&&(Bd.includes(i)?await Ad(c,{...t,force:l}):i===".material"?await Od(c,{...t,force:l}):i===".npss"&&await Nd(c,{...t,force:l}))}o(jd,"processAssetFile");var Md=require("node:os"),Ps=require("node:path/posix");async function $d(e){let t=await Wt((0,Ps.join)(e.baseAssetsDir,"**/*"),{nodir:!0,ignore:{childrenIgnored:o(s=>(0,Ps.extname)(s.name)===".scene","childrenIgnored")}}),r=[],i=(0,Md.cpus)().length;console.log(`Using ${i} cpus to process assets...`);for(let s of t)r.length>=i&&(await Promise.all(r),r.length=0),r.push(jd(s,{...e}));await Promise.all(r)}o($d,"createAssets");var q=require("node:path/posix"),me=M(We(),1);async function qd(e){let t=[],r=[],i=[],s=[];await Promise.all(e.directories.meshesFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"meshes",f)),u=c.meshes[0];u.delayLoadingFile&&(u.delayLoadingFile=(0,q.join)(e.sceneName,(0,q.basename)(u.delayLoadingFile))),u.metadata?.parentId&&(u.parentId=u.metadata.parentId),u.instances?.forEach(m=>{m.metadata?.parentId&&(m.parentId=m.metadata.parentId)}),c.basePoseMatrix&&(u.basePoseMatrix=c.basePoseMatrix),t.push(u),c.materials?.forEach(m=>{r.find(y=>y.id===m.id)||r.push(m)})})),await Promise.all(e.directories.morphTargetManagerFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"morphTargetManagers",f));e.babylonjsEditorToolsVersion>="5.2.6"?c.targets.forEach(u=>{u.delayLoadingFile&&(u.delayLoadingFile=(0,q.join)(e.sceneName,"morphTargets",(0,q.basename)(u.delayLoadingFile)))}):await Promise.all(c.targets.map(async u=>{let m=(0,q.join)(e.sceneFile,"morphTargets",(0,q.basename)(u.delayLoadingFile)),p=(await me.default.readFile(m)).buffer;u.positionsCount&&(u.positions=Array.prototype.slice.call(new Float32Array(p,u.positionsOffset,u.positionsCount))),u.normalsCount&&(u.normals=Array.prototype.slice.call(new Float32Array(p,u.normalsOffset,u.normalsCount))),u.tangentsCount&&(u.tangents=Array.prototype.slice.call(new Float32Array(p,u.tangentsOffset,u.tangentsCount))),u.uvsCount&&(u.uvs=Array.prototype.slice.call(new Float32Array(p,u.uvsOffset,u.uvsCount))),u.uv2sCount&&(u.uv2s=Array.prototype.slice.call(new Float32Array(p,u.uv2sOffset,u.uv2sCount))),delete u.delayLoadingFile,delete u.positionsCount,delete u.normalsCount,delete u.tangentsCount,delete u.uvsCount,delete u.uv2sCount,delete u.positionsOffset,delete u.normalsOffset,delete u.tangentsOffset,delete u.uvsOffset,delete u.uv2sOffset})),s.push(c)})),await Promise.all(e.directories.nodesFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"nodes",f));c.metadata?.parentId&&(c.parentId=c.metadata.parentId),i.push(c)})),await Promise.all(e.directories.spriteManagerFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"sprite-managers",f));c.metadata?.parentId&&(c.parentId=c.metadata.parentId),i.push(c)})),await Promise.all(e.directories.spriteMapFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"sprite-maps",f));c.metadata?.parentId&&(c.parentId=c.metadata.parentId),i.push(c)}));let n=Cr(e.publicDir);await me.default.ensureDir(n),await Promise.all(r.map(async f=>{if(f.customType==="BABYLON.NodeMaterial"){let c=await Ro(f,{extractedTexturesOutputPath:n});await Promise.all(c.map(async u=>{let m=(0,q.join)(e.publicDir,u);e.exportedAssets.push(m),e.optimize&&e.compressedTexturesEnabled&&await $e(m,{...e,force:!1,exportedAssets:e.exportedAssets})}))}}));let a=await Promise.all(e.directories.particleSystemFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"particleSystems",f)),u=await Dd(c,{extractedTexturesOutputPath:n});if(u){let m=(0,q.join)(e.publicDir,u);e.exportedAssets.push(m),e.optimize&&e.compressedTexturesEnabled&&await $e(m,{...e,force:!1,exportedAssets:e.exportedAssets})}return c}));await Promise.all(e.directories.nodeParticleSystemSetFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"nodeParticleSystemSets",f));if(c.metadata?.parentId&&(c.parentId=c.metadata.parentId),c.nodeParticleSystemSet){let u=await Io(c.nodeParticleSystemSet,{extractedTexturesOutputPath:n});await Promise.all(u.map(async m=>{let p=(0,q.join)(e.publicDir,m);e.exportedAssets.push(p),e.optimize&&e.compressedTexturesEnabled&&await $e(p,{...e,force:!1,exportedAssets:e.exportedAssets})}))}t.push(c)}));let l={autoClear:!0,physicsEnabled:!0,collisionsEnabled:!0,useRightHandedSystem:!1,physicsEngine:"HavokPlugin",iblIntensity:1,clearColor:e.config.clearColor,ambientColor:e.config.ambientColor,geometries:{boxes:[],spheres:[],cylinders:[],toruses:[],grounds:[],planes:[],torusKnots:[],vertexData:[]},gravity:e.config.gravity??[0,-9.81,0],fogColor:e.config.fog.fogColor,fogStart:e.config.fog.fogStart,fogEnd:e.config.fog.fogEnd,fogDensity:e.config.fog.fogDensity,fogMode:e.config.fog.fogMode,physicsGravity:e.config.physics.gravity,environmentIntensity:e.config.environment.environmentIntensity,environmentTexture:e.config.environment.environmentTexture,metadata:e.config.metadata,animations:e.config.animations,postProcesses:[],multiMaterials:[],spriteManagers:[],reflectionProbes:[],meshes:t,materials:r,morphTargetManagers:s,transformNodes:i,particleSystems:a,animationGroups:await Promise.all(e.directories.animationGroupFiles.map(async f=>me.default.readJSON((0,q.join)(e.sceneFile,"animationGroups",f)))),skeletons:await Promise.all(e.directories.skeletonFiles.map(async f=>me.default.readJSON((0,q.join)(e.sceneFile,"skeletons",f)))),cameras:await Promise.all(e.directories.cameraFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"cameras",f));return c.metadata?.parentId&&(c.parentId=c.metadata.parentId),c})),lights:await Promise.all(e.directories.lightsFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"lights",f));return c.metadata?.parentId&&(c.parentId=c.metadata.parentId),c})),shadowGenerators:await Promise.all(e.directories.shadowGeneratorFiles.map(async f=>me.default.readJSON((0,q.join)(e.sceneFile,"shadowGenerators",f)))),sounds:await Promise.all(e.directories.soundFiles.map(async f=>me.default.readJSON((0,q.join)(e.sceneFile,"sounds",f))))},h=(0,q.join)(e.publicDir,`${e.sceneName}.babylon`);await me.default.writeJSON(h,l,{encoding:"utf-8"}),e.exportedAssets.push(h)}o(qd,"createBabylonScene");var Jt=require("node:path/posix"),bi=M(We(),1);async function Gd(e){await bi.default.ensureDir((0,Jt.join)(e.publicDir,e.sceneName)),await bi.default.ensureDir((0,Jt.join)(e.publicDir,e.sceneName,"morphTargets")),await Promise.all(e.directories.geometryFiles.map(async t=>{let r=(0,Jt.join)(e.publicDir,e.sceneName,t);await bi.default.copyFile((0,Jt.join)(e.sceneFile,"geometries",t),r),e.exportedAssets.push(r)})),e.babylonjsEditorToolsVersion>="5.2.6"&&await Promise.all(e.directories.morphTargetFiles.map(async t=>{let r=(0,Jt.join)(e.publicDir,e.sceneName,"morphTargets",t);await bi.default.copyFile((0,Jt.join)(e.sceneFile,"morphTargets",t),r),e.exportedAssets.push(r)}))}o(Gd,"createGeometryFiles");var ht=M(We(),1),Wd=require("node:path"),le=require("node:path/posix");async function zd(e,t){let r=process.cwd();e!==r&&(e=(0,Wd.resolve)(r,e)),e=e.replace(/\\/g,"/");let s=(await ht.default.readdir(e)).find(E=>(0,le.extname)(E).toLowerCase()===".bjseditor"),n={compressedTexturesEnabled:!1};s&&(n=await ht.default.readJSON((0,le.join)(e,s))),n.compressedTexturesEnabled&&(t.pvrTexToolAbsolutePath?Vh(t.pvrTexToolAbsolutePath):await Jh());let a=(0,le.join)(e,"assets"),l=(0,le.join)(e,"public/scene");await ht.default.ensureDir(l);let h=(0,le.join)(e,"assets"),f=(0,le.join)(l,"assets");await ht.default.ensureDir(f);let c=[],u={};try{u=await ht.default.readJSON((0,le.join)(e,"assets/.export-cache.json"))}catch{}let m=Ur("Packing assets...");m.spinner=ut.dots14,m.start(),await $d({...t,...n,cache:u,projectDir:e,publicDir:l,baseAssetsDir:h,outputAssetsDir:f,exportedAssets:c}),m.succeed("Packed assets");let p="5.0.0";try{p=(await ht.default.readJSON((0,le.join)(e,"node_modules/babylonjs-editor-tools/package.json"))).version}catch{}let y=await Wt(`${a}/**/*`,{nodir:!1,ignore:{ignored:o(E=>!E.isDirectory()||(0,le.extname)(E.name).toLocaleLowerCase()!==".scene","ignored")}});for(let E of y){let x=(0,le.basename)(E),C=(0,le.basename)(E,(0,le.extname)(E)),A=Ur(`Packing ${x}...`);A.spinner=ut.dots14,A.start(),await Kh(E);let S=await Xh(E),D=await ht.default.readJSON((0,le.join)(E,"config.json"));await qd({...t,...n,config:D,directories:S,publicDir:l,sceneFile:E,sceneName:C,exportedAssets:c,babylonjsEditorToolsVersion:p}),await Gd({directories:S,publicDir:l,sceneFile:E,sceneName:C,exportedAssets:c,babylonjsEditorToolsVersion:p}),A.succeed(`Packed ${x}`)}await ht.default.writeJSON((0,le.join)(e,"assets/.export-cache.json"),u,{encoding:"utf-8",spaces:" "}),(await Wt((0,le.join)(l,"**/*"),{nodir:!0})).forEach(E=>{c.includes(E.toString())||ht.default.remove(E)})}o(zd,"pack");0&&(module.exports={pack});
21
+ >>> no match, partial?`,t,m,r,p),m===h))}let b;if(typeof c=="string"?(b=u===c,this.debug("string match",c,u,b)):(b=c.test(u),this.debug("pattern match",c,u,b)),!b)return!1}if(a===h&&l===f)return!0;if(a===h)return i;if(l===f)return a===h-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return gh(this.pattern,this.options)}parse(t){Yr(t);let r=this.options;if(t==="**")return de;if(t==="")return"";let i,s=null;(i=t.match(wg))?s=r.dot?bg:yg:(i=t.match(ag))?s=(r.nocase?r.dot?fg:cg:r.dot?hg:lg)(i[1]):(i=t.match(Eg))?s=(r.nocase?r.dot?vg:xg:r.dot?Sg:_g)(i):(i=t.match(ug))?s=r.dot?mg:dg:(i=t.match(pg))&&(s=gg);let n=nr.fromGlob(t,this.options).toMMPattern();return s&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:s}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?Ag:r.dot?Pg:Cg,s=new Set(r.nocase?["i"]:[]),n=t.map(h=>{let f=h.map(u=>{if(u instanceof RegExp)for(let m of u.flags.split(""))s.add(m);return typeof u=="string"?Lg(u):u===de?de:u._src});f.forEach((u,m)=>{let p=f[m+1],y=f[m-1];u!==de||y===de||(y===void 0?p!==void 0&&p!==de?f[m+1]="(?:\\/|"+i+"\\/)?"+p:f[m]=i:p===void 0?f[m-1]=y+"(?:\\/|\\/"+i+")?":p!==de&&(f[m-1]=y+"(?:\\/|\\/"+i+"\\/)"+p,f[m+1]=de))});let c=f.filter(u=>u!==de);if(this.partial&&c.length>=1){let u=[];for(let m=1;m<=c.length;m++)u.push(c.slice(0,m).join("/"));return"(?:"+u.join("|")+")"}return c.join("/")}).join("|"),[a,l]=t.length>1?["(?:",")"]:["",""];n="^"+a+n+l+"$",this.partial&&(n="^(?:\\/|"+a+n.slice(1,-1)+l+")$"),this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...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,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let n=this.set;this.debug(this.pattern,"set",n);let a=s[s.length-1];if(!a)for(let l=s.length-2;!a&&l>=0;l--)a=s[l];for(let l=0;l<n.length;l++){let h=n[l],f=s;if(i.matchBase&&h.length===1&&(f=[a]),this.matchOne(f,h,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return Se.defaults(t).Minimatch}};Se.AST=nr,Se.Minimatch=Re,Se.escape=or,Se.unescape=He;var ar=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,yh=new Set,xn=typeof process=="object"&&process?process:{},bh=o((e,t,r,i)=>{typeof xn.emitWarning=="function"?xn.emitWarning(e,t,r,i):console.error(`[${r}] ${t}: ${e}`)},"emitWarning"),Gi=globalThis.AbortController,Eh=globalThis.AbortSignal;if(typeof Gi>"u"){Eh=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(i,s){this._onabort.push(s)}},Gi=class{static{o(this,"AbortController")}constructor(){t()}signal=new Eh;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i)}}};let e=xn.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=o(()=>{e&&(e=!1,bh("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))},"warnACPolyfill")}var Ng=o(e=>!yh.has(e),"shouldWarn"),y_=Symbol("type"),Tt=o(e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),"isPosInt"),xh=o(e=>Tt(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?lr:null:null,"getUintArray"),lr=class extends Array{static{o(this,"ZeroArray")}constructor(t){super(t),this.fill(0)}},vn=class e{static{o(this,"Stack")}heap;length;static#t=!1;static create(t){let r=xh(t);if(!r)return[];e.#t=!0;let i=new e(t,r);return e.#t=!1,i}constructor(t,r){if(!e.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Jr=class e{static{o(this,"LRUCache")}#t;#r;#i;#e;#o;#l;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#f;#c;#a;#s;#w;#m;#p;#g;#T;#y;#S;#_;#b;#x;#v;#d;static unsafeExposeInternals(t){return{starts:t.#_,ttls:t.#b,sizes:t.#S,keyMap:t.#c,keyList:t.#a,valList:t.#s,next:t.#w,prev:t.#m,get head(){return t.#p},get tail(){return t.#g},free:t.#T,isBackgroundFetch:o(r=>t.#u(r),"isBackgroundFetch"),backgroundFetch:o((r,i,s,n)=>t.#j(r,i,s,n),"backgroundFetch"),moveToTail:o(r=>t.#$(r),"moveToTail"),indexes:o(r=>t.#P(r),"indexes"),rindexes:o(r=>t.#C(r),"rindexes"),isStale:o(r=>t.#E(r),"isStale")}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#f}get size(){return this.#h}get fetchMethod(){return this.#o}get memoMethod(){return this.#l}get dispose(){return this.#i}get disposeAfter(){return this.#e}constructor(t){let{max:r=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:h,dispose:f,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:m,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:b,fetchMethod:E,memoMethod:x,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:D,ignoreFetchAbort:ke}=t;if(r!==0&&!Tt(r))throw new TypeError("max option must be a nonnegative integer");let Qe=r?xh(r):Array;if(!Qe)throw new Error("invalid max value: "+r);if(this.#t=r,this.#r=p,this.maxEntrySize=y||this.#r,this.sizeCalculation=b,this.sizeCalculation){if(!this.#r&&!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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#l=x,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=E,this.#v=!!E,this.#c=new Map,this.#a=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#w=new Qe(r),this.#m=new Qe(r),this.#p=0,this.#g=0,this.#T=vn.create(r),this.#h=0,this.#f=0,typeof f=="function"&&(this.#i=f),typeof c=="function"?(this.#e=c,this.#y=[]):(this.#e=void 0,this.#y=void 0),this.#x=!!this.#i,this.#d=!!this.#e,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!D,this.ignoreFetchAbort=!!ke,this.maxEntrySize!==0){if(this.#r!==0&&!Tt(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Tt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#R()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=Tt(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!Tt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#A()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let bt="LRU_CACHE_UNBOUNDED";Ng(bt)&&(yh.add(bt),bh("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",bt,e))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#A(){let t=new lr(this.#t),r=new lr(this.#t);this.#b=t,this.#_=r,this.#k=(n,a,l=ar.now())=>{if(r[n]=a!==0?l:0,t[n]=a,a!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#E(n)&&this.#I(this.#a[n],"expire")},a+1);h.unref&&h.unref()}},this.#F=n=>{r[n]=t[n]!==0?ar.now():0},this.#n=(n,a)=>{if(t[a]){let l=t[a],h=r[a];if(!l||!h)return;n.ttl=l,n.start=h,n.now=i||s();let f=n.now-h;n.remainingTTL=l-f}};let i=0,s=o(()=>{let n=ar.now();if(this.ttlResolution>0){i=n;let a=setTimeout(()=>i=0,this.ttlResolution);a.unref&&a.unref()}return n},"getNow");this.getRemainingTTL=n=>{let a=this.#c.get(n);if(a===void 0)return 0;let l=t[a],h=r[a];if(!l||!h)return 1/0;let f=(i||s())-h;return l-f},this.#E=n=>{let a=r[n],l=t[n];return!!l&&!!a&&(i||s())-a>l}}#F=o(()=>{},"#updateItemAge");#n=o(()=>{},"#statusTTL");#k=o(()=>{},"#setItemTTL");#E=o(()=>!1,"#isStale");#R(){let t=new lr(this.#t);this.#f=0,this.#S=t,this.#O=r=>{this.#f-=t[r],t[r]=0},this.#N=(r,i,s,n)=>{if(this.#u(i))return 0;if(!Tt(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,r),!Tt(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.#L=(r,i,s)=>{if(t[r]=i,this.#r){let n=this.#r-t[r];for(;this.#f>n;)this.#B(!0)}this.#f+=t[r],s&&(s.entrySize=i,s.totalCalculatedSize=this.#f)}}#O=o(t=>{},"#removeItemSize");#L=o((t,r,i)=>{},"#addItemSize");#N=o((t,r,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:t=this.allowStale}={}){if(this.#h)for(let r=this.#g;!(!this.#D(r)||((t||!this.#E(r))&&(yield r),r===this.#p));)r=this.#m[r]}*#C({allowStale:t=this.allowStale}={}){if(this.#h)for(let r=this.#p;!(!this.#D(r)||((t||!this.#E(r))&&(yield r),r===this.#g));)r=this.#w[r]}#D(t){return t!==void 0&&this.#c.get(this.#a[t])===t}*entries(){for(let t of this.#P())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#u(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*rentries(){for(let t of this.#C())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#u(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*keys(){for(let t of this.#P()){let r=this.#a[t];r!==void 0&&!this.#u(this.#s[t])&&(yield r)}}*rkeys(){for(let t of this.#C()){let r=this.#a[t];r!==void 0&&!this.#u(this.#s[t])&&(yield r)}}*values(){for(let t of this.#P())this.#s[t]!==void 0&&!this.#u(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#C())this.#s[t]!==void 0&&!this.#u(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let i of this.#P()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#a[i],this))return this.get(this.#a[i],r)}}forEach(t,r=this){for(let i of this.#P()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(r,n,this.#a[i],this)}}rforEach(t,r=this){for(let i of this.#C()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(r,n,this.#a[i],this)}}purgeStale(){let t=!1;for(let r of this.#C({allowStale:!0}))this.#E(r)&&(this.#I(this.#a[r],"expire"),t=!0);return t}info(t){let r=this.#c.get(t);if(r===void 0)return;let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#b&&this.#_){let a=this.#b[r],l=this.#_[r];if(a&&l){let h=a-(ar.now()-l);n.ttl=h,n.start=Date.now()}}return this.#S&&(n.size=this.#S[r]),n}dump(){let t=[];for(let r of this.#P({allowStale:!0})){let i=this.#a[r],s=this.#s[r],n=this.#u(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let a={value:n};if(this.#b&&this.#_){a.ttl=this.#b[r];let l=ar.now()-this.#_[r];a.start=Math.floor(Date.now()-l)}this.#S&&(a.size=this.#S[r]),t.unshift([i,a])}return t}load(t){this.clear();for(let[r,i]of t){if(i.start){let s=Date.now()-i.start;i.start=ar.now()-s}this.set(r,i.value,i)}}set(t,r,i={}){if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:h}=i,{noUpdateTTL:f=this.noUpdateTTL}=i,c=this.#N(t,r,i.size||0,l);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.#I(t,"set"),this;let u=this.#h===0?void 0:this.#c.get(t);if(u===void 0)u=this.#h===0?this.#g:this.#T.length!==0?this.#T.pop():this.#h===this.#t?this.#B(!1):this.#h,this.#a[u]=t,this.#s[u]=r,this.#c.set(t,u),this.#w[this.#g]=u,this.#m[u]=this.#g,this.#g=u,this.#h++,this.#L(u,c,h),h&&(h.set="add"),f=!1;else{this.#$(u);let m=this.#s[u];if(r!==m){if(this.#v&&this.#u(m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=m;p!==void 0&&!a&&(this.#x&&this.#i?.(p,t,"set"),this.#d&&this.#y?.push([p,t,"set"]))}else a||(this.#x&&this.#i?.(m,t,"set"),this.#d&&this.#y?.push([m,t,"set"]));if(this.#O(u),this.#L(u,c,h),this.#s[u]=r,h){h.set="replace";let p=m&&this.#u(m)?m.__staleWhileFetching:m;p!==void 0&&(h.oldValue=p)}}else h&&(h.set="update")}if(s!==0&&!this.#b&&this.#A(),this.#b&&(f||this.#k(u,s,n),h&&this.#n(h,u)),!a&&this.#d&&this.#y){let m=this.#y,p;for(;p=m?.shift();)this.#e?.(...p)}return this}pop(){try{for(;this.#h;){let t=this.#s[this.#p];if(this.#B(!0),this.#u(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#d&&this.#y){let t=this.#y,r;for(;r=t?.shift();)this.#e?.(...r)}}}#B(t){let r=this.#p,i=this.#a[r],s=this.#s[r];return this.#v&&this.#u(s)?s.__abortController.abort(new Error("evicted")):(this.#x||this.#d)&&(this.#x&&this.#i?.(s,i,"evict"),this.#d&&this.#y?.push([s,i,"evict"])),this.#O(r),t&&(this.#a[r]=void 0,this.#s[r]=void 0,this.#T.push(r)),this.#h===1?(this.#p=this.#g=0,this.#T.length=0):this.#p=this.#w[r],this.#c.delete(i),this.#h--,r}has(t,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=r,n=this.#c.get(t);if(n!==void 0){let a=this.#s[n];if(this.#u(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#E(n))s&&(s.has="stale",this.#n(s,n));else return i&&this.#F(n),s&&(s.has="hit",this.#n(s,n)),!0}else s&&(s.has="miss");return!1}peek(t,r={}){let{allowStale:i=this.allowStale}=r,s=this.#c.get(t);if(s===void 0||!i&&this.#E(s))return;let n=this.#s[s];return this.#u(n)?n.__staleWhileFetching:n}#j(t,r,i,s){let n=r===void 0?void 0:this.#s[r];if(this.#u(n))return n;let a=new Gi,{signal:l}=i;l?.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let h={signal:a.signal,options:i,context:s},f=o((b,E=!1)=>{let{aborted:x}=a.signal,C=i.ignoreFetchAbort&&b!==void 0;if(i.status&&(x&&!E?(i.status.fetchAborted=!0,i.status.fetchError=a.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),x&&!C&&!E)return u(a.signal.reason);let A=p;return this.#s[r]===p&&(b===void 0?A.__staleWhileFetching?this.#s[r]=A.__staleWhileFetching:this.#I(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,b,h.options))),b},"cb"),c=o(b=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=b),u(b)),"eb"),u=o(b=>{let{aborted:E}=a.signal,x=E&&i.allowStaleOnFetchAbort,C=x||i.allowStaleOnFetchRejection,A=C||i.noDeleteOnFetchRejection,S=p;if(this.#s[r]===p&&(!A||S.__staleWhileFetching===void 0?this.#I(t,"fetch"):x||(this.#s[r]=S.__staleWhileFetching)),C)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw b},"fetchFail"),m=o((b,E)=>{let x=this.#o?.(t,n,h);x&&x instanceof Promise&&x.then(C=>b(C===void 0?void 0:C),E),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(b(void 0),i.allowStaleOnFetchAbort&&(b=o(C=>f(C,!0),"res")))})},"pcall");i.status&&(i.status.fetchDispatched=!0);let p=new Promise(m).then(f,c),y=Object.assign(p,{__abortController:a,__staleWhileFetching:n,__returned:void 0});return r===void 0?(this.set(t,y,{...h.options,status:void 0}),r=this.#c.get(t)):this.#s[r]=y,y}#u(t){if(!this.#v)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Gi}async fetch(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:h=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:b,forceRefresh:E=!1,status:x,signal:C}=r;if(!this.#v)return x&&(x.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:x});let A={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:a,noDisposeOnSet:l,size:h,sizeCalculation:f,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:x,signal:C},S=this.#c.get(t);if(S===void 0){x&&(x.fetch="miss");let D=this.#j(t,S,A,b);return D.__returned=D}else{let D=this.#s[S];if(this.#u(D)){let L=i&&D.__staleWhileFetching!==void 0;return x&&(x.fetch="inflight",L&&(x.returnedStale=!0)),L?D.__staleWhileFetching:D.__returned=D}let ke=this.#E(S);if(!E&&!ke)return x&&(x.fetch="hit"),this.#$(S),s&&this.#F(S),x&&this.#n(x,S),D;let Qe=this.#j(t,S,A,b),k=Qe.__staleWhileFetching!==void 0&&i;return x&&(x.fetch=ke?"stale":"refresh",k&&ke&&(x.returnedStale=!0)),k?Qe.__staleWhileFetching:Qe.__returned=Qe}}async forceFetch(t,r={}){let i=await this.fetch(t,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,r={}){let i=this.#l;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...a}=r,l=this.get(t,a);if(!n&&l!==void 0)return l;let h=i(t,l,{options:a,context:s});return this.set(t,h,a),h}get(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:a}=r,l=this.#c.get(t);if(l!==void 0){let h=this.#s[l],f=this.#u(h);return a&&this.#n(a,l),this.#E(l)?(a&&(a.get="stale"),f?(a&&i&&h.__staleWhileFetching!==void 0&&(a.returnedStale=!0),i?h.__staleWhileFetching:void 0):(n||this.#I(t,"expire"),a&&i&&(a.returnedStale=!0),i?h:void 0)):(a&&(a.get="hit"),f?h.__staleWhileFetching:(this.#$(l),s&&this.#F(l),h))}else a&&(a.get="miss")}#M(t,r){this.#m[r]=t,this.#w[t]=r}#$(t){t!==this.#g&&(t===this.#p?this.#p=this.#w[t]:this.#M(this.#m[t],this.#w[t]),this.#M(this.#g,t),this.#g=t)}delete(t){return this.#I(t,"delete")}#I(t,r){let i=!1;if(this.#h!==0){let s=this.#c.get(t);if(s!==void 0)if(i=!0,this.#h===1)this.#q(r);else{this.#O(s);let n=this.#s[s];if(this.#u(n)?n.__abortController.abort(new Error("deleted")):(this.#x||this.#d)&&(this.#x&&this.#i?.(n,t,r),this.#d&&this.#y?.push([n,t,r])),this.#c.delete(t),this.#a[s]=void 0,this.#s[s]=void 0,s===this.#g)this.#g=this.#m[s];else if(s===this.#p)this.#p=this.#w[s];else{let a=this.#m[s];this.#w[a]=this.#w[s];let l=this.#w[s];this.#m[l]=this.#m[s]}this.#h--,this.#T.push(s)}}if(this.#d&&this.#y?.length){let s=this.#y,n;for(;n=s?.shift();)this.#e?.(...n)}return i}clear(){return this.#q("delete")}#q(t){for(let r of this.#C({allowStale:!0})){let i=this.#s[r];if(this.#u(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#a[r];this.#x&&this.#i?.(i,s,t),this.#d&&this.#y?.push([i,s,t])}}if(this.#c.clear(),this.#s.fill(void 0),this.#a.fill(void 0),this.#b&&this.#_&&(this.#b.fill(0),this.#_.fill(0)),this.#S&&this.#S.fill(0),this.#p=0,this.#g=0,this.#T.length=0,this.#f=0,this.#h=0,this.#d&&this.#y){let r=this.#y,i;for(;i=r?.shift();)this.#e?.(...i)}}};var Ji=require("node:events"),Cn=M(require("node:stream"),1),Fh=require("node:string_decoder"),vh=typeof process=="object"&&process?process:{stdout:null,stderr:null},Dg=o(e=>!!e&&typeof e=="object"&&(e instanceof At||e instanceof Cn.default||Bg(e)||jg(e)),"isStream"),Bg=o(e=>!!e&&typeof e=="object"&&e instanceof Ji.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==Cn.default.Writable.prototype.pipe,"isReadable"),jg=o(e=>!!e&&typeof e=="object"&&e instanceof Ji.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function","isWritable"),dt=Symbol("EOF"),mt=Symbol("maybeEmitEnd"),Ft=Symbol("emittedEnd"),Wi=Symbol("emittingEnd"),Kr=Symbol("emittedError"),zi=Symbol("closed"),Sh=Symbol("read"),Ui=Symbol("flush"),_h=Symbol("flushChunk"),Ye=Symbol("encoding"),hr=Symbol("decoder"),ie=Symbol("flowing"),Xr=Symbol("paused"),cr=Symbol("resume"),se=Symbol("buffer"),_e=Symbol("pipes"),ne=Symbol("bufferLength"),Sn=Symbol("bufferPush"),Hi=Symbol("bufferShift"),ge=Symbol("objectMode"),J=Symbol("destroyed"),_n=Symbol("error"),Tn=Symbol("emitData"),Th=Symbol("emitEnd"),Fn=Symbol("emitEnd2"),et=Symbol("async"),An=Symbol("abort"),Yi=Symbol("aborted"),Qr=Symbol("signal"),qt=Symbol("dataListeners"),Ie=Symbol("discarded"),Zr=o(e=>Promise.resolve().then(e),"defer"),Mg=o(e=>e(),"nodefer"),$g=o(e=>e==="end"||e==="finish"||e==="prefinish","isEndish"),qg=o(e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,"isArrayBufferLike"),Gg=o(e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),"isArrayBufferView"),Vi=class{static{o(this,"Pipe")}src;dest;opts;ondrain;constructor(t,r,i){this.src=t,this.dest=r,this.opts=i,this.ondrain=()=>t[cr](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Pn=class extends Vi{static{o(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,r,i){super(t,r,i),this.proxyErrors=s=>r.emit("error",s),t.on("error",this.proxyErrors)}},Wg=o(e=>!!e.objectMode,"isObjectModeOptions"),zg=o(e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer","isEncodingOptions"),At=class extends Ji.EventEmitter{static{o(this,"Minipass")}[ie]=!1;[Xr]=!1;[_e]=[];[se]=[];[ge];[Ye];[et];[hr];[dt]=!1;[Ft]=!1;[Wi]=!1;[zi]=!1;[Kr]=null;[ne]=0;[J]=!1;[Qr];[Yi]=!1;[qt]=0;[Ie]=!1;writable=!0;readable=!0;constructor(...t){let r=t[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Wg(r)?(this[ge]=!0,this[Ye]=null):zg(r)?(this[Ye]=r.encoding,this[ge]=!1):(this[ge]=!1,this[Ye]=null),this[et]=!!r.async,this[hr]=this[Ye]?new Fh.StringDecoder(this[Ye]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[se],"get")}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[_e],"get")});let{signal:i}=r;i&&(this[Qr]=i,i.aborted?this[An]():i.addEventListener("abort",()=>this[An]()))}get bufferLength(){return this[ne]}get encoding(){return this[Ye]}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[ge]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[et]}set async(t){this[et]=this[et]||!!t}[An](){this[Yi]=!0,this.emit("abort",this[Qr]?.reason),this.destroy(this[Qr]?.reason)}get aborted(){return this[Yi]}set aborted(t){}write(t,r,i){if(this[Yi])return!1;if(this[dt])throw new Error("write after end");if(this[J])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(i=r,r="utf8"),r||(r="utf8");let s=this[et]?Zr:Mg;if(!this[ge]&&!Buffer.isBuffer(t)){if(Gg(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(qg(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[ge]?(this[ie]&&this[ne]!==0&&this[Ui](!0),this[ie]?this.emit("data",t):this[Sn](t),this[ne]!==0&&this.emit("readable"),i&&s(i),this[ie]):t.length?(typeof t=="string"&&!(r===this[Ye]&&!this[hr]?.lastNeed)&&(t=Buffer.from(t,r)),Buffer.isBuffer(t)&&this[Ye]&&(t=this[hr].write(t)),this[ie]&&this[ne]!==0&&this[Ui](!0),this[ie]?this.emit("data",t):this[Sn](t),this[ne]!==0&&this.emit("readable"),i&&s(i),this[ie]):(this[ne]!==0&&this.emit("readable"),i&&s(i),this[ie])}read(t){if(this[J])return null;if(this[Ie]=!1,this[ne]===0||t===0||t&&t>this[ne])return this[mt](),null;this[ge]&&(t=null),this[se].length>1&&!this[ge]&&(this[se]=[this[Ye]?this[se].join(""):Buffer.concat(this[se],this[ne])]);let r=this[Sh](t||null,this[se][0]);return this[mt](),r}[Sh](t,r){if(this[ge])this[Hi]();else{let i=r;t===i.length||t===null?this[Hi]():typeof i=="string"?(this[se][0]=i.slice(t),r=i.slice(0,t),this[ne]-=t):(this[se][0]=i.subarray(t),r=i.subarray(0,t),this[ne]-=t)}return this.emit("data",r),!this[se].length&&!this[dt]&&this.emit("drain"),r}end(t,r,i){return typeof t=="function"&&(i=t,t=void 0),typeof r=="function"&&(i=r,r="utf8"),t!==void 0&&this.write(t,r),i&&this.once("end",i),this[dt]=!0,this.writable=!1,(this[ie]||!this[Xr])&&this[mt](),this}[cr](){this[J]||(!this[qt]&&!this[_e].length&&(this[Ie]=!0),this[Xr]=!1,this[ie]=!0,this.emit("resume"),this[se].length?this[Ui]():this[dt]?this[mt]():this.emit("drain"))}resume(){return this[cr]()}pause(){this[ie]=!1,this[Xr]=!0,this[Ie]=!1}get destroyed(){return this[J]}get flowing(){return this[ie]}get paused(){return this[Xr]}[Sn](t){this[ge]?this[ne]+=1:this[ne]+=t.length,this[se].push(t)}[Hi](){return this[ge]?this[ne]-=1:this[ne]-=this[se][0].length,this[se].shift()}[Ui](t=!1){do;while(this[_h](this[Hi]())&&this[se].length);!t&&!this[se].length&&!this[dt]&&this.emit("drain")}[_h](t){return this.emit("data",t),this[ie]}pipe(t,r){if(this[J])return t;this[Ie]=!1;let i=this[Ft];return r=r||{},t===vh.stdout||t===vh.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,i?r.end&&t.end():(this[_e].push(r.proxyErrors?new Pn(this,t,r):new Vi(this,t,r)),this[et]?Zr(()=>this[cr]()):this[cr]()),t}unpipe(t){let r=this[_e].find(i=>i.dest===t);r&&(this[_e].length===1?(this[ie]&&this[qt]===0&&(this[ie]=!1),this[_e]=[]):this[_e].splice(this[_e].indexOf(r),1),r.unpipe())}addListener(t,r){return this.on(t,r)}on(t,r){let i=super.on(t,r);if(t==="data")this[Ie]=!1,this[qt]++,!this[_e].length&&!this[ie]&&this[cr]();else if(t==="readable"&&this[ne]!==0)super.emit("readable");else if($g(t)&&this[Ft])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Kr]){let s=r;this[et]?Zr(()=>s.call(this,this[Kr])):s.call(this,this[Kr])}return i}removeListener(t,r){return this.off(t,r)}off(t,r){let i=super.off(t,r);return t==="data"&&(this[qt]=this.listeners("data").length,this[qt]===0&&!this[Ie]&&!this[_e].length&&(this[ie]=!1)),i}removeAllListeners(t){let r=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[qt]=0,!this[Ie]&&!this[_e].length&&(this[ie]=!1)),r}get emittedEnd(){return this[Ft]}[mt](){!this[Wi]&&!this[Ft]&&!this[J]&&this[se].length===0&&this[dt]&&(this[Wi]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[zi]&&this.emit("close"),this[Wi]=!1)}emit(t,...r){let i=r[0];if(t!=="error"&&t!=="close"&&t!==J&&this[J])return!1;if(t==="data")return!this[ge]&&!i?!1:this[et]?(Zr(()=>this[Tn](i)),!0):this[Tn](i);if(t==="end")return this[Th]();if(t==="close"){if(this[zi]=!0,!this[Ft]&&!this[J])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[Kr]=i,super.emit(_n,i);let n=!this[Qr]||this.listeners("error").length?super.emit("error",i):!1;return this[mt](),n}else if(t==="resume"){let n=super.emit("resume");return this[mt](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let s=super.emit(t,...r);return this[mt](),s}[Tn](t){for(let i of this[_e])i.dest.write(t)===!1&&this.pause();let r=this[Ie]?!1:super.emit("data",t);return this[mt](),r}[Th](){return this[Ft]?!1:(this[Ft]=!0,this.readable=!1,this[et]?(Zr(()=>this[Fn]()),!0):this[Fn]())}[Fn](){if(this[hr]){let r=this[hr].end();if(r){for(let i of this[_e])i.dest.write(r);this[Ie]||super.emit("data",r)}}for(let r of this[_e])r.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[ge]||(t.dataLength=0);let r=this.promise();return this.on("data",i=>{t.push(i),this[ge]||(t.dataLength+=i.length)}),await r,t}async concat(){if(this[ge])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[Ye]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,r)=>{this.on(J,()=>r(new Error("stream destroyed"))),this.on("error",i=>r(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[Ie]=!1;let t=!1,r=o(async()=>(this.pause(),t=!0,{value:void 0,done:!0}),"stop");return{next:o(()=>{if(t)return r();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[dt])return r();let n,a,l=o(u=>{this.off("data",h),this.off("end",f),this.off(J,c),r(),a(u)},"onerr"),h=o(u=>{this.off("error",l),this.off("end",f),this.off(J,c),this.pause(),n({value:u,done:!!this[dt]})},"ondata"),f=o(()=>{this.off("error",l),this.off("data",h),this.off(J,c),r(),n({done:!0,value:void 0})},"onend"),c=o(()=>l(new Error("stream destroyed")),"ondestroy");return new Promise((u,m)=>{a=m,n=u,this.once(J,c),this.once("error",l),this.once("end",f),this.once("data",h)})},"next"),throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Ie]=!1;let t=!1,r=o(()=>(this.pause(),this.off(_n,r),this.off(J,r),this.off("end",r),t=!0,{done:!0,value:void 0}),"stop"),i=o(()=>{if(t)return r();let s=this.read();return s===null?r():{done:!1,value:s}},"next");return this.once("end",r),this.once(_n,r),this.once(J,r),{next:i,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(t){if(this[J])return t?this.emit("error",t):this.emit(J),this;this[J]=!0,this[Ie]=!0,this[se].length=0,this[ne]=0;let r=this;return typeof r.close=="function"&&!this[zi]&&r.close(),t?this.emit("error",t):this.emit(J),this}static get isStream(){return Dg}};var dr=require("node:path"),Mh=require("node:url"),rt=require("fs"),Ug=M(require("node:fs"),1),Pt=require("node:fs/promises"),Hg=rt.realpathSync.native,ei={lstatSync:rt.lstatSync,readdir:rt.readdir,readdirSync:rt.readdirSync,readlinkSync:rt.readlinkSync,realpathSync:Hg,promises:{lstat:Pt.lstat,readdir:Pt.readdir,readlink:Pt.readlink,realpath:Pt.realpath}},Ah=o(e=>!e||e===ei||e===Ug?ei:{...ei,...e,promises:{...ei.promises,...e.promises||{}}},"fsFromOption"),Ph=/^\\\\\?\\([a-z]:)\\?$/i,Yg=o(e=>e.replace(/\//g,"\\").replace(Ph,"$1\\"),"uncToDrive"),Vg=/[\\\/]/,Be=0,Ch=1,kh=2,tt=4,Rh=6,Ih=8,Gt=10,Oh=12,je=15,ti=~je,kn=16,Lh=32,ri=64,Ve=128,Ki=256,Xi=512,Nh=ri|Ve|Xi,Jg=1023,Rn=o(e=>e.isFile()?Ih:e.isDirectory()?tt:e.isSymbolicLink()?Gt:e.isCharacterDevice()?kh:e.isBlockDevice()?Rh:e.isSocket()?Oh:e.isFIFO()?Ch:Be,"entToType"),Dh=new Map,ii=o(e=>{let t=Dh.get(e);if(t)return t;let r=e.normalize("NFKD");return Dh.set(e,r),r},"normalize"),Bh=new Map,Qi=o(e=>{let t=Bh.get(e);if(t)return t;let r=ii(e.toLowerCase());return Bh.set(e,r),r},"normalizeNocase"),Zi=class extends Jr{static{o(this,"ResolveCache")}constructor(){super({max:256})}},In=class extends Jr{static{o(this,"ChildrenCache")}constructor(t=16*1024){super({maxSize:t,sizeCalculation:o(r=>r.length+1,"sizeCalculation")})}},jh=Symbol("PathScurry setAsCwd"),we=class{static{o(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#i;get mode(){return this.#i}#e;get nlink(){return this.#e}#o;get uid(){return this.#o}#l;get gid(){return this.#l}#h;get rdev(){return this.#h}#f;get blksize(){return this.#f}#c;get ino(){return this.#c}#a;get size(){return this.#a}#s;get blocks(){return this.#s}#w;get atimeMs(){return this.#w}#m;get mtimeMs(){return this.#m}#p;get ctimeMs(){return this.#p}#g;get birthtimeMs(){return this.#g}#T;get atime(){return this.#T}#y;get mtime(){return this.#y}#S;get ctime(){return this.#S}#_;get birthtime(){return this.#_}#b;#x;#v;#d;#A;#F;#n;#k;#E;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,r=Be,i,s,n,a,l){this.name=t,this.#b=n?Qi(t):ii(t),this.#n=r&Jg,this.nocase=n,this.roots=s,this.root=i||this,this.#k=a,this.#v=l.fullpath,this.#A=l.relative,this.#F=l.relativePosix,this.parent=l.parent,this.parent?this.#t=this.parent.#t:this.#t=Ah(l.fs)}depth(){return this.#x!==void 0?this.#x:this.parent?this.#x=this.parent.depth()+1:this.#x=0}childrenCache(){return this.#k}resolve(t){if(!t)return this;let r=this.getRootString(t),s=t.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#O(s):this.#O(s)}#O(t){let r=this;for(let i of t)r=r.child(i);return r}children(){let t=this.#k.get(this);if(t)return t;let r=Object.assign([],{provisional:0});return this.#k.set(this,r),this.#n&=~kn,r}child(t,r){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let i=this.children(),s=this.nocase?Qi(t):ii(t);for(let h of i)if(h.#b===s)return h;let n=this.parent?this.sep:"",a=this.#v?this.#v+n+t:void 0,l=this.newChild(t,Be,{...r,parent:this,fullpath:a});return this.canReaddir()||(l.#n|=Ve),i.push(l),l}relative(){if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let t=this.name,r=this.parent;if(!r)return this.#A=this.name;let i=r.relative();return i+(!i||!r.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#F!==void 0)return this.#F;let t=this.name,r=this.parent;if(!r)return this.#F=this.fullpathPosix();let i=r.relativePosix();return i+(!i||!r.parent?"":"/")+t}fullpath(){if(this.#v!==void 0)return this.#v;let t=this.name,r=this.parent;if(!r)return this.#v=this.name;let s=r.fullpath()+(r.parent?this.sep:"")+t;return this.#v=s}fullpathPosix(){if(this.#d!==void 0)return this.#d;if(this.sep==="/")return this.#d=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#d=`//?/${s}`:this.#d=s}let t=this.parent,r=t.fullpathPosix(),i=r+(!r||!t.parent?"":"/")+this.name;return this.#d=i}isUnknown(){return(this.#n&je)===Be}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#n&je)===Ih}isDirectory(){return(this.#n&je)===tt}isCharacterDevice(){return(this.#n&je)===kh}isBlockDevice(){return(this.#n&je)===Rh}isFIFO(){return(this.#n&je)===Ch}isSocket(){return(this.#n&je)===Oh}isSymbolicLink(){return(this.#n&Gt)===Gt}lstatCached(){return this.#n&Lh?this:void 0}readlinkCached(){return this.#E}realpathCached(){return this.#R}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#E)return!0;if(!this.parent)return!1;let t=this.#n&je;return!(t!==Be&&t!==Gt||this.#n&Ki||this.#n&Ve)}calledReaddir(){return!!(this.#n&kn)}isENOENT(){return!!(this.#n&Ve)}isNamed(t){return this.nocase?this.#b===Qi(t):this.#b===ii(t)}async readlink(){let t=this.#E;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=await this.#t.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(r);if(i)return this.#E=i}catch(r){this.#u(r.code);return}}readlinkSync(){let t=this.#E;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=this.#t.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(r);if(i)return this.#E=i}catch(r){this.#u(r.code);return}}#L(t){this.#n|=kn;for(let r=t.provisional;r<t.length;r++){let i=t[r];i&&i.#N()}}#N(){this.#n&Ve||(this.#n=(this.#n|Ve)&ti,this.#P())}#P(){let t=this.children();t.provisional=0;for(let r of t)r.#N()}#C(){this.#n|=Xi,this.#D()}#D(){if(this.#n&ri)return;let t=this.#n;(t&je)===tt&&(t&=ti),this.#n=t|ri,this.#P()}#B(t=""){t==="ENOTDIR"||t==="EPERM"?this.#D():t==="ENOENT"?this.#N():this.children().provisional=0}#j(t=""){t==="ENOTDIR"?this.parent.#D():t==="ENOENT"&&this.#N()}#u(t=""){let r=this.#n;r|=Ki,t==="ENOENT"&&(r|=Ve),(t==="EINVAL"||t==="UNKNOWN")&&(r&=ti),this.#n=r,t==="ENOTDIR"&&this.parent&&this.parent.#D()}#M(t,r){return this.#I(t,r)||this.#$(t,r)}#$(t,r){let i=Rn(t),s=this.newChild(t.name,i,{parent:this}),n=s.#n&je;return n!==tt&&n!==Gt&&n!==Be&&(s.#n|=ri),r.unshift(s),r.provisional++,s}#I(t,r){for(let i=r.provisional;i<r.length;i++){let s=r[i];if((this.nocase?Qi(t.name):ii(t.name))===s.#b)return this.#q(t,s,i,r)}}#q(t,r,i,s){let n=r.name;return r.#n=r.#n&ti|Rn(t),n!==t.name&&(r.name=t.name),i!==s.provisional&&(i===s.length-1?s.pop():s.splice(i,1),s.unshift(r)),s.provisional++,r}async lstat(){if((this.#n&Ve)===0)try{return this.#U(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#j(t.code)}}lstatSync(){if((this.#n&Ve)===0)try{return this.#U(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#j(t.code)}}#U(t){let{atime:r,atimeMs:i,birthtime:s,birthtimeMs:n,blksize:a,blocks:l,ctime:h,ctimeMs:f,dev:c,gid:u,ino:m,mode:p,mtime:y,mtimeMs:b,nlink:E,rdev:x,size:C,uid:A}=t;this.#T=r,this.#w=i,this.#_=s,this.#g=n,this.#f=a,this.#s=l,this.#S=h,this.#p=f,this.#r=c,this.#l=u,this.#c=m,this.#i=p,this.#y=y,this.#m=b,this.#e=E,this.#h=x,this.#a=C,this.#o=A;let S=Rn(t);this.#n=this.#n&ti|S|Lh,S!==Be&&S!==tt&&S!==Gt&&(this.#n|=ri)}#W=[];#z=!1;#H(t){this.#z=!1;let r=this.#W.slice();this.#W.length=0,r.forEach(i=>i(null,t))}readdirCB(t,r=!1){if(!this.canReaddir()){r?t(null,[]):queueMicrotask(()=>t(null,[]));return}let i=this.children();if(this.calledReaddir()){let n=i.slice(0,i.provisional);r?t(null,n):queueMicrotask(()=>t(null,n));return}if(this.#W.push(t),this.#z)return;this.#z=!0;let s=this.fullpath();this.#t.readdir(s,{withFileTypes:!0},(n,a)=>{if(n)this.#B(n.code),i.provisional=0;else{for(let l of a)this.#M(l,i);this.#L(i)}this.#H(i.slice(0,i.provisional))})}#G;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();if(this.#G)await this.#G;else{let i=o(()=>{},"resolve");this.#G=new Promise(s=>i=s);try{for(let s of await this.#t.promises.readdir(r,{withFileTypes:!0}))this.#M(s,t);this.#L(t)}catch(s){this.#B(s.code),t.provisional=0}this.#G=void 0,i()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();try{for(let i of this.#t.readdirSync(r,{withFileTypes:!0}))this.#M(i,t);this.#L(t)}catch(i){this.#B(i.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#n&Nh)return!1;let t=je&this.#n;return t===Be||t===tt||t===Gt}shouldWalk(t,r){return(this.#n&tt)===tt&&!(this.#n&Nh)&&!t.has(this)&&(!r||r(this))}async realpath(){if(this.#R)return this.#R;if(!((Xi|Ki|Ve)&this.#n))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#R=this.resolve(t)}catch{this.#C()}}realpathSync(){if(this.#R)return this.#R;if(!((Xi|Ki|Ve)&this.#n))try{let t=this.#t.realpathSync(this.fullpath());return this.#R=this.resolve(t)}catch{this.#C()}}[jh](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let r=new Set([]),i=[],s=this;for(;s&&s.parent;)r.add(s),s.#A=i.join(this.sep),s.#F=i.join("/"),s=s.parent,i.push("..");for(s=t;s&&s.parent&&!r.has(s);)s.#A=void 0,s.#F=void 0,s=s.parent}},es=class e extends we{static{o(this,"PathWin32")}sep="\\";splitSep=Vg;constructor(t,r=Be,i,s,n,a,l){super(t,r,i,s,n,a,l)}newChild(t,r=Be,i={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(t){return dr.win32.parse(t).root}getRoot(t){if(t=Yg(t.toUpperCase()),t===this.root.name)return this.root;for(let[r,i]of Object.entries(this.roots))if(this.sameRoot(t,r))return this.roots[t]=i;return this.roots[t]=new fr(t,this).root}sameRoot(t,r=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(Ph,"$1\\"),t===r}},ts=class e extends we{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(t,r=Be,i,s,n,a,l){super(t,r,i,s,n,a,l)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,r=Be,i={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}},rs=class{static{o(this,"PathScurryBase")}root;rootPath;roots;cwd;#t;#r;#i;nocase;#e;constructor(t=process.cwd(),r,i,{nocase:s,childrenCacheSize:n=16*1024,fs:a=ei}={}){this.#e=Ah(a),(t instanceof URL||t.startsWith("file://"))&&(t=(0,Mh.fileURLToPath)(t));let l=r.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(l),this.#t=new Zi,this.#r=new Zi,this.#i=new In(n);let h=l.substring(this.rootPath.length).split(i);if(h.length===1&&!h[0]&&h.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let f=this.root,c=h.length-1,u=r.sep,m=this.rootPath,p=!1;for(let y of h){let b=c--;f=f.child(y,{relative:new Array(b).fill("..").join(u),relativePosix:new Array(b).fill("..").join("/"),fullpath:m+=(p?"":u)+y}),p=!0}this.cwd=f}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#i}resolve(...t){let r="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let i=this.#t.get(r);if(i!==void 0)return i;let s=this.cwd.resolve(r).fullpath();return this.#t.set(r,s),s}resolvePosix(...t){let r="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let i=this.#r.get(r);if(i!==void 0)return i;let s=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,s),s}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i}=r;if(t.canReaddir()){let s=await t.readdir();return i?s:s.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0}=r;return t.canReaddir()?i?t.readdirSync():t.readdirSync().map(s=>s.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t.withFileTypes,t=this.cwd);let i=await t.readlink();return r?i:i?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t.withFileTypes,t=this.cwd);let i=t.readlinkSync();return r?i:i?.fullpath()}async realpath(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t.withFileTypes,t=this.cwd);let i=await t.realpath();return r?i:i?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t.withFileTypes,t=this.cwd);let i=t.realpathSync();return r?i:i?.fullpath()}async walk(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r,l=[];(!n||n(t))&&l.push(i?t:t.fullpath());let h=new Set,f=o((u,m)=>{h.add(u),u.readdirCB((p,y)=>{if(p)return m(p);let b=y.length;if(!b)return m();let E=o(()=>{--b===0&&m()},"next");for(let x of y)(!n||n(x))&&l.push(i?x:x.fullpath()),s&&x.isSymbolicLink()?x.realpath().then(C=>C?.isUnknown()?C.lstat():C).then(C=>C?.shouldWalk(h,a)?f(C,E):E()):x.shouldWalk(h,a)?f(x,E):E()},!0)},"walk"),c=t;return new Promise((u,m)=>{f(c,p=>{if(p)return m(p);u(l)})})}walkSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r,l=[];(!n||n(t))&&l.push(i?t:t.fullpath());let h=new Set([t]);for(let f of h){let c=f.readdirSync();for(let u of c){(!n||n(u))&&l.push(i?u:u.fullpath());let m=u;if(u.isSymbolicLink()){if(!(s&&(m=u.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(h,a)&&h.add(m)}}return l}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,r={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd),this.stream(t,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r;(!n||n(t))&&(yield i?t:t.fullpath());let l=new Set([t]);for(let h of l){let f=h.readdirSync();for(let c of f){(!n||n(c))&&(yield i?c:c.fullpath());let u=c;if(c.isSymbolicLink()){if(!(s&&(u=c.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(l,a)&&l.add(u)}}}stream(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r,l=new At({objectMode:!0});(!n||n(t))&&l.write(i?t:t.fullpath());let h=new Set,f=[t],c=0,u=o(()=>{let m=!1;for(;!m;){let p=f.shift();if(!p){c===0&&l.end();return}c++,h.add(p);let y=o((E,x,C=!1)=>{if(E)return l.emit("error",E);if(s&&!C){let A=[];for(let S of x)S.isSymbolicLink()&&A.push(S.realpath().then(D=>D?.isUnknown()?D.lstat():D));if(A.length){Promise.all(A).then(()=>y(null,x,!0));return}}for(let A of x)A&&(!n||n(A))&&(l.write(i?A:A.fullpath())||(m=!0));c--;for(let A of x){let S=A.realpathCached()||A;S.shouldWalk(h,a)&&f.push(S)}m&&!l.flowing?l.once("drain",u):b||u()},"onReaddir"),b=!0;p.readdirCB(y,!0),b=!1}},"process");return u(),l}streamSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof we||(r=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=r,l=new At({objectMode:!0}),h=new Set;(!n||n(t))&&l.write(i?t:t.fullpath());let f=[t],c=0,u=o(()=>{let m=!1;for(;!m;){let p=f.shift();if(!p){c===0&&l.end();return}c++,h.add(p);let y=p.readdirSync();for(let b of y)(!n||n(b))&&(l.write(i?b:b.fullpath())||(m=!0));c--;for(let b of y){let E=b;if(b.isSymbolicLink()){if(!(s&&(E=b.realpathSync())))continue;E.isUnknown()&&E.lstatSync()}E.shouldWalk(h,a)&&f.push(E)}}m&&!l.flowing&&l.once("drain",u)},"process");return u(),l}chdir(t=this.cwd){let r=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[jh](r)}},fr=class extends rs{static{o(this,"PathScurryWin32")}sep="\\";constructor(t=process.cwd(),r={}){let{nocase:i=!0}=r;super(t,dr.win32,"\\",{...r,nocase:i}),this.nocase=i;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(t){return dr.win32.parse(t).root.toUpperCase()}newRoot(t){return new es(this.rootPath,tt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},ur=class extends rs{static{o(this,"PathScurryPosix")}sep="/";constructor(t=process.cwd(),r={}){let{nocase:i=!1}=r;super(t,dr.posix,"/",{...r,nocase:i}),this.nocase=i}parseRootPath(t){return"/"}newRoot(t){return new ts(this.rootPath,tt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},si=class extends ur{static{o(this,"PathScurryDarwin")}constructor(t=process.cwd(),r={}){let{nocase:i=!0}=r;super(t,{...r,nocase:i})}},T_=process.platform==="win32"?es:ts,$h=process.platform==="win32"?fr:process.platform==="darwin"?si:ur;var Kg=o(e=>e.length>=1,"isPatternList"),Xg=o(e=>e.length>=1,"isGlobList"),mr=class e{static{o(this,"Pattern")}#t;#r;#i;length;#e;#o;#l;#h;#f;#c;#a=!0;constructor(t,r,i,s){if(!Kg(t))throw new TypeError("empty pattern list");if(!Xg(r))throw new TypeError("empty glob list");if(r.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#r=r,this.#i=i,this.#e=s,this.#i===0){if(this.isUNC()){let[n,a,l,h,...f]=this.#t,[c,u,m,p,...y]=this.#r;f[0]===""&&(f.shift(),y.shift());let b=[n,a,l,h,""].join("/"),E=[c,u,m,p,""].join("/");this.#t=[b,...f],this.#r=[E,...y],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...a]=this.#t,[l,...h]=this.#r;a[0]===""&&(a.shift(),h.shift());let f=n+"/",c=l+"/";this.#t=[f,...a],this.#r=[c,...h],this.length=this.#t.length}}}pattern(){return this.#t[this.#i]}isString(){return typeof this.#t[this.#i]=="string"}isGlobstar(){return this.#t[this.#i]===de}isRegExp(){return this.#t[this.#i]instanceof RegExp}globString(){return this.#l=this.#l||(this.#i===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new e(this.#t,this.#r,this.#i+1,this.#e),this.#o.#c=this.#c,this.#o.#f=this.#f,this.#o.#h=this.#h,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#f!==void 0?this.#f:this.#f=this.#e==="win32"&&this.#i===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#h!==void 0?this.#h:this.#h=this.#e==="win32"&&this.#i===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#c!==void 0?this.#c:this.#c=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#i===0?t:""}checkFollowGlobstar(){return!(this.#i===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#i===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Qg=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",pr=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:r,nocase:i,noext:s,noglobstar:n,platform:a=Qg}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:r,nocase:i,noext:s,noglobstar:n,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let l of t)this.add(l)}add(t){let r=new Re(t,this.mmopts);for(let i=0;i<r.set.length;i++){let s=r.set[i],n=r.globParts[i];if(!s||!n)throw new Error("invalid pattern object");for(;s[0]==="."&&n[0]===".";)s.shift(),n.shift();let a=new mr(s,n,0,this.platform),l=new Re(a.globString(),this.mmopts),h=n[n.length-1]==="**",f=a.isAbsolute();f?this.absolute.push(l):this.relative.push(l),h&&(f?this.absoluteChildren.push(l):this.relativeChildren.push(l))}}ignored(t){let r=t.fullpath(),i=`${r}/`,s=t.relative()||".",n=`${s}/`;for(let a of this.relative)if(a.match(s)||a.match(n))return!0;for(let a of this.absolute)if(a.match(r)||a.match(i))return!0;return!1}childrenIgnored(t){let r=t.fullpath()+"/",i=(t.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(i))return!0;for(let s of this.absoluteChildren)if(s.match(r))return!0;return!1}};var On=class e{static{o(this,"HasWalkedCache")}store;constructor(t=new Map){this.store=t}copy(){return new e(new Map(this.store))}hasWalked(t,r){return this.store.get(t.fullpath())?.has(r.globString())}storeWalked(t,r){let i=t.fullpath(),s=this.store.get(i);s?s.add(r.globString()):this.store.set(i,new Set([r.globString()]))}},Ln=class{static{o(this,"MatchRecord")}store=new Map;add(t,r,i){let s=(r?2:0)|(i?1:0),n=this.store.get(t);this.store.set(t,n===void 0?s:s&n)}entries(){return[...this.store.entries()].map(([t,r])=>[t,!!(r&2),!!(r&1)])}},Nn=class{static{o(this,"SubWalks")}store=new Map;add(t,r){if(!t.canReaddir())return;let i=this.store.get(t);i?i.find(s=>s.globString()===r.globString())||i.push(r):this.store.set(t,[r])}get(t){let r=this.store.get(t);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},ni=class e{static{o(this,"Processor")}hasWalkedCache;matches=new Ln;subwalks=new Nn;patterns;follow;dot;opts;constructor(t,r){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=r?r.copy():new On}processPatterns(t,r){this.patterns=r;let i=r.map(s=>[t,s]);for(let[s,n]of i){this.hasWalkedCache.storeWalked(s,n);let a=n.root(),l=n.isAbsolute()&&this.opts.absolute!==!1;if(a){s=s.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let u=n.rest();if(u)n=u;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let h,f,c=!1;for(;typeof(h=n.pattern())=="string"&&(f=n.rest());)s=s.resolve(h),n=f,c=!0;if(h=n.pattern(),f=n.rest(),c){if(this.hasWalkedCache.hasWalked(s,n))continue;this.hasWalkedCache.storeWalked(s,n)}if(typeof h=="string"){let u=h===".."||h===""||h===".";this.matches.add(s.resolve(h),l,u);continue}else if(h===de){(!s.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(s,n);let u=f?.pattern(),m=f?.rest();if(!f||(u===""||u===".")&&!m)this.matches.add(s,l,u===""||u===".");else if(u===".."){let p=s.parent||s;m?this.hasWalkedCache.hasWalked(p,m)||this.subwalks.add(p,m):this.matches.add(p,l,!0)}}else h instanceof RegExp&&this.subwalks.add(s,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(t,r){let i=this.subwalks.get(t),s=this.child();for(let n of r)for(let a of i){let l=a.isAbsolute(),h=a.pattern(),f=a.rest();h===de?s.testGlobstar(n,a,f,l):h instanceof RegExp?s.testRegExp(n,h,f,l):s.testString(n,h,f,l)}return s}testGlobstar(t,r,i,s){if((this.dot||!t.name.startsWith("."))&&(r.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,r):t.isSymbolicLink()&&(i&&r.checkFollowGlobstar()?this.subwalks.add(t,i):r.markFollowGlobstar()&&this.subwalks.add(t,r)))),i){let n=i.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,i.rest(),s);else if(n===".."){let a=t.parent||t;this.subwalks.add(a,i)}else n instanceof RegExp&&this.testRegExp(t,n,i.rest(),s)}}testRegExp(t,r,i,s){r.test(t.name)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}testString(t,r,i,s){t.isNamed(r)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}};var Zg=o((e,t)=>typeof e=="string"?new pr([e],t):Array.isArray(e)?new pr(e,t):e,"makeIgnore"),is=class{static{o(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#i;signal;maxDepth;includeChildMatches;constructor(t,r,i){if(this.patterns=t,this.path=r,this.opts=i,this.#i=!i.posix&&i.platform==="win32"?"\\":"/",this.includeChildMatches=i.includeChildMatches!==!1,(i.ignore||!this.includeChildMatches)&&(this.#r=Zg(i.ignore??[],i),!this.includeChildMatches&&typeof this.#r.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(t){return this.seen.has(t)||!!this.#r?.ignored?.(t)}#o(t){return!!this.#r?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=t.realpathCached()||await t.realpath(),!i)return;t=i}let n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let a=await n.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(n,r)}matchCheckTest(t,r){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!r||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#e(t)?t:void 0}matchCheckSync(t,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=t.realpathCached()||t.realpathSync(),!i)return;t=i}let n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let a=n.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(n,r)}matchFinish(t,r){if(this.#e(t))return;if(!this.includeChildMatches&&this.#r?.add){let n=`${t.relativePosix()}/**`;this.#r.add(n)}let i=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(i){let n=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(n+s)}else{let n=this.opts.posix?t.relativePosix():t.relative(),a=this.opts.dotRelative&&!n.startsWith(".."+this.#i)?"."+this.#i:"";this.matchEmit(n?a+n+s:"."+s)}}async match(t,r,i){let s=await this.matchCheck(t,i);s&&this.matchFinish(s,r)}matchSync(t,r,i){let s=this.matchCheckSync(t,i);s&&this.matchFinish(s,r)}walkCB(t,r,i){this.signal?.aborted&&i(),this.walkCB2(t,r,new ni(this.opts),i)}walkCB2(t,r,i,s){if(this.#o(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(t,r,i,s));return}i.processPatterns(t,r);let n=1,a=o(()=>{--n===0&&s()},"next");for(let[l,h,f]of i.matches.entries())this.#e(l)||(n++,this.match(l,h,f).then(()=>a()));for(let l of i.subwalkTargets()){if(this.maxDepth!==1/0&&l.depth()>=this.maxDepth)continue;n++;let h=l.readdirCached();l.calledReaddir()?this.walkCB3(l,h,i,a):l.readdirCB((f,c)=>this.walkCB3(l,c,i,a),!0)}a()}walkCB3(t,r,i,s){i=i.filterEntries(t,r);let n=1,a=o(()=>{--n===0&&s()},"next");for(let[l,h,f]of i.matches.entries())this.#e(l)||(n++,this.match(l,h,f).then(()=>a()));for(let[l,h]of i.subwalks.entries())n++,this.walkCB2(l,h,i.child(),a);a()}walkCBSync(t,r,i){this.signal?.aborted&&i(),this.walkCB2Sync(t,r,new ni(this.opts),i)}walkCB2Sync(t,r,i,s){if(this.#o(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(t,r,i,s));return}i.processPatterns(t,r);let n=1,a=o(()=>{--n===0&&s()},"next");for(let[l,h,f]of i.matches.entries())this.#e(l)||this.matchSync(l,h,f);for(let l of i.subwalkTargets()){if(this.maxDepth!==1/0&&l.depth()>=this.maxDepth)continue;n++;let h=l.readdirSync();this.walkCB3Sync(l,h,i,a)}a()}walkCB3Sync(t,r,i,s){i=i.filterEntries(t,r);let n=1,a=o(()=>{--n===0&&s()},"next");for(let[l,h,f]of i.matches.entries())this.#e(l)||this.matchSync(l,h,f);for(let[l,h]of i.subwalks.entries())n++,this.walkCB2Sync(l,h,i.child(),a);a()}},oi=class extends is{static{o(this,"GlobWalker")}matches=new Set;constructor(t,r,i){super(t,r,i)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},ai=class extends is{static{o(this,"GlobStream")}results;constructor(t,r,i){super(t,r,i),this.results=new At({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var qh=require("node:url"),ew=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Je=class{static{o(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,qh.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(h=>h.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(h=>h.includes("/")?h:`./**/${h}`)}if(this.pattern=t,this.platform=r.platform||ew,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let h=r.platform==="win32"?fr:r.platform==="darwin"?si:r.platform?ur:$h;this.scurry=new h(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",s={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(h=>new Re(h,s)),[a,l]=n.reduce((h,f)=>(h[0].push(...f.set),h[1].push(...f.globParts),h),[[],[]]);this.patterns=a.map((h,f)=>{let c=l[f];if(!c)throw new Error("invalid pattern object");return new mr(h,c,0,this.platform)})}async walk(){return[...await new oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new ai(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new ai(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var Dn=o((e,t={})=>{Array.isArray(e)||(e=[e]);for(let r of e)if(new Re(r,t).hasMagic())return!0;return!1},"hasMagic");function ss(e,t={}){return new Je(e,t).streamSync()}o(ss,"globStreamSync");function Gh(e,t={}){return new Je(e,t).stream()}o(Gh,"globStream");function Wh(e,t={}){return new Je(e,t).walkSync()}o(Wh,"globSync");async function zh(e,t={}){return new Je(e,t).walk()}o(zh,"glob_");function ns(e,t={}){return new Je(e,t).iterateSync()}o(ns,"globIterateSync");function Uh(e,t={}){return new Je(e,t).iterate()}o(Uh,"globIterate");var tw=ss,rw=Object.assign(Gh,{sync:ss}),iw=ns,sw=Object.assign(Uh,{sync:ns}),nw=Object.assign(Wh,{stream:ss,iterate:ns}),os=Object.assign(zh,{glob:zh,globSync:Wh,sync:nw,globStream:Gh,stream:rw,globStreamSync:ss,streamSync:tw,globIterate:Uh,iterate:sw,globIterateSync:ns,iterateSync:iw,Glob:Je,hasMagic:Dn,escape:or,unescape:He});os.glob=os;async function Wt(...e){let t=await os(...e);return t.forEach((r,i)=>{t[i]=t[i].toString().replace(/\\/g,"/")}),t}o(Wt,"normalizedGlob");var Hh=M(require("node:os"),1),Yh=require("node:path/posix"),Ke;function Vh(e){Ke=e}o(Vh,"setPVRTexToolAbsolutePath");async function Jh(){if(process.env.PVRTexToolCLI)return Ke=process.env.PVRTexToolCLI;let e=Hh.default.platform(),t=null;switch(e){case"darwin":t="/Applications/Imagination/";break;case"win32":t="C:/Imagination Technologies/";break;default:break}if(!t)return;let r=await Wt((0,Yh.join)(t,"**"),{nodir:!0});switch(e){case"darwin":return Ke=r.find(i=>i.endsWith("macOS/PVRTexToolCLI"));case"win32":return Ke=r.find(i=>i.endsWith("Windows_x86_64/PVRTexToolCLI.exe"))}}o(Jh,"locatePVRTexTool");var O=require("node:path/posix"),K=require("node:fs/promises"),X=M(We(),1);async function Kh(e){await Promise.all([X.default.ensureDir((0,O.join)(e,"nodes")),X.default.ensureDir((0,O.join)(e,"meshes")),X.default.ensureDir((0,O.join)(e,"lods")),X.default.ensureDir((0,O.join)(e,"lights")),X.default.ensureDir((0,O.join)(e,"cameras")),X.default.ensureDir((0,O.join)(e,"geometries")),X.default.ensureDir((0,O.join)(e,"skeletons")),X.default.ensureDir((0,O.join)(e,"shadowGenerators")),X.default.ensureDir((0,O.join)(e,"sceneLinks")),X.default.ensureDir((0,O.join)(e,"gui")),X.default.ensureDir((0,O.join)(e,"sounds")),X.default.ensureDir((0,O.join)(e,"particleSystems")),X.default.ensureDir((0,O.join)(e,"morphTargetManagers")),X.default.ensureDir((0,O.join)(e,"morphTargets")),X.default.ensureDir((0,O.join)(e,"animationGroups")),X.default.ensureDir((0,O.join)(e,"sprite-maps")),X.default.ensureDir((0,O.join)(e,"sprite-managers")),X.default.ensureDir((0,O.join)(e,"nodeParticleSystemSets"))])}o(Kh,"ensureSceneDirectories");async function Xh(e){let[t,r,i,s,n,a,l,h,f,c,u,m,p,y,b,E,x,C]=await Promise.all([(0,K.readdir)((0,O.join)(e,"nodes")),(0,K.readdir)((0,O.join)(e,"meshes")),(0,K.readdir)((0,O.join)(e,"lods")),(0,K.readdir)((0,O.join)(e,"lights")),(0,K.readdir)((0,O.join)(e,"cameras")),(0,K.readdir)((0,O.join)(e,"skeletons")),(0,K.readdir)((0,O.join)(e,"shadowGenerators")),(0,K.readdir)((0,O.join)(e,"sceneLinks")),(0,K.readdir)((0,O.join)(e,"gui")),(0,K.readdir)((0,O.join)(e,"sounds")),(0,K.readdir)((0,O.join)(e,"particleSystems")),(0,K.readdir)((0,O.join)(e,"morphTargetManagers")),(0,K.readdir)((0,O.join)(e,"morphTargets")),(0,K.readdir)((0,O.join)(e,"animationGroups")),(0,K.readdir)((0,O.join)(e,"sprite-maps")),(0,K.readdir)((0,O.join)(e,"sprite-managers")),(0,K.readdir)((0,O.join)(e,"geometries")),(0,K.readdir)((0,O.join)(e,"nodeParticleSystemSets"))]);return{nodesFiles:t,meshesFiles:r,lodsFiles:i,lightsFiles:s,cameraFiles:n,skeletonFiles:a,shadowGeneratorFiles:l,sceneLinkFiles:h,guiFiles:f,soundFiles:c,particleSystemFiles:u,morphTargetManagerFiles:m,morphTargetFiles:p,animationGroupFiles:y,spriteMapFiles:b,spriteManagerFiles:E,geometryFiles:x,nodeParticleSystemSetFiles:C}}o(Xh,"readSceneDirectories");var Yc=require("node:child_process");function Vc(e){return new Promise((t,r)=>{(0,Yc.exec)(e,(i,s,n)=>{i?(console.error(Mt.red(e),Mt.red(n)),r(i)):(console.log(Mt.gray(e),Mt.gray(s)),t())})})}o(Vc,"executeAsync");var Rt=require("node:path/posix"),Kc=M(We(),1),Xc=M(Hc(),1),Qc=require("node:fs"),cy=["-astc.ktx","-dxt.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"],fy=[".png",".jpg",".jpeg",".bmp"];function XT(){let e="";try{e=localStorage.getItem("editor-compressed-textures-cli-path")??""}catch{}return e||null}o(XT,"getCompressedTexturesCliPath");function QT(e){try{localStorage.setItem("editor-compressed-textures-cli-path",e)}catch{}}o(QT,"setCompressedTexturesCliPath");function uy(e,t){return`${e.substring(0,e.lastIndexOf("."))}${t}`}o(uy,"getCompressedTextureFilename");async function $e(e,t){t.format?await Jc(e,t):await Promise.all(cy.map(r=>Jc(e,{...t,format:r})))}o($e,"compressFileToKtx");async function Jc(e,t){let r=(0,Rt.basename)(e),i=(0,Rt.extname)(r).toLocaleLowerCase();if(!fy.includes(i))return null;let s=uy(r,t.format);if(t.destinationFolder??=(0,Rt.dirname)(e),t.destinationFolder=(0,Rt.join)(t.destinationFolder,s),await Kc.default.pathExists(t.destinationFolder)&&!t.force)return t.exportedAssets?.push(t.destinationFolder),t.destinationFolder;let n=await new Promise(l=>{let h=(0,Qc.createReadStream)(e);h.pipe(new Xc.PNG).on("metadata",f=>{l(f.alpha),h.close()}).on("error",()=>{l(!1),h.close()})});if(!Ke)return null;let a=null;switch(t.format){case"-astc.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ASTC_8x8,UBN,lRGB -q astcveryfast -o "${t.destinationFolder}"`;break;case"-dxt.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -m -ics lRGB ${n?"-l":""} -f ${n?"BC2":"BC1"},UBN,lRGB -o "${t.destinationFolder}"`;break;case"-pvrtc.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -square + -m -dither -ics lRGB ${n?"-l":""} -f ${n?"PVRTCI_2BPP_RGBA":"PVRTCI_2BPP_RGB"},UBN,lRGB -q pvrtcfastest -o "${t.destinationFolder}"`;break;case"-etc1.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ETC1,UBN,lRGB -q etcfast -o "${t.destinationFolder}"`;break;case"-etc2.ktx":a=`"${Ke}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ${n?"ETC2_RGBA":"ETC2_RGB"},UBN,lRGB -q etcfast -o "${t.destinationFolder}"`;break}if(!a)return null;console.log(`Compressing image "${s}"`);try{return await Vc(a),console.log(`Compressed image "${s}"`),t.exportedAssets?.push(t.destinationFolder),t.destinationFolder}catch{console.error(`Failed to compress image "${s}"`)}return null}o(Jc,"compressFileToKtxFormat");function RA(e=4096,t){let r=t??1,i=[];for(;r<=e;)i.push(r),r<<=1;return i}o(RA,"getPowerOfTwoSizesUntil");function Vt(e){let t=1;for(;t<=e;)t<<=1;return t>>1}o(Vt,"getPowerOfTwoUntil");var wt=require("node:path/posix"),Ao=M(Fo(),1),Po=M(We(),1);function Cr(e){return(0,wt.join)(e,"assets","editor-generated_extracted-textures")}o(Cr,"getExtractedTextureOutputPath");async function Ad(e,t){let r=(0,wt.extname)(e).toLocaleLowerCase(),i=await(0,Ao.default)(e).metadata();if(!i.width||!i.height)return console.error(`Failed to compute exported image "${e}". Image metadata is invalid.`);let s=i.width,n=i.height,a=s===Vt(s)||n===Vt(n),l=[],h=s*.66>>0,f=n*.66>>0;a&&(h=Vt(h),f=Vt(f)),l.push({width:h,height:f});let c=s*.33>>0,u=n*.33>>0;a&&(c=Vt(c),u=Vt(u)),l.push({width:c,height:u});for(let m of l){let y=`${(0,wt.basename)(e).replace(r,"")}_${m.width}_${m.height}${r}`,b=(0,wt.join)((0,wt.dirname)(e),y);if(t.exportedAssets.push(b),t.force||!await Po.default.pathExists(b))try{let E=await(0,Ao.default)(e).resize(m.width,m.height).toBuffer();await Po.default.writeFile(b,E),console.log(`Exported scaled texture "${y}"`)}catch{console.error(`Failed to export image scaled image "${y}"`)}t.compressedTexturesEnabled&&await $e(b,{...t})}}o(Ad,"processExportedTexture");var Pd=require("node:path/posix"),Cd=require("node:worker_threads");function S2(e,t){return e=(0,Pd.join)("__dirname".replace(/\\/g,"/"),e),new Cd.Worker(e,{workerData:t})}o(S2,"loadWorker");async function kd(e,t){let r=S2(e,t);return new Promise(i=>{r.on("message",s=>{t.id&&s.id!==t.id||(t.id||r.terminate(),i(s))})})}o(kd,"executeSimpleWorker");var Co=require("node:path/posix"),ko=M(We(),1),Rd=M(Fo(),1);async function kr(e,t){let r=e.split(","),n=r[0].split(";")[1],a=r[1];if(n==="base64"){let l=Buffer.from(a,"base64"),h=(0,Rd.default)(l),[f,c]=await Promise.all([h.metadata(),kd("workers/md5.mjs",l)]),u;switch(f.format){case"png":u=`${c}.png`;break;case"jpg":case"jpeg":u=`${c}.jpg`;break;default:return console.error(`Unsupported embedded texture format while extracting texture: ${f.format}`),null}let m=(0,Co.join)(t.extractedTexturesOutputPath,u);return await ko.default.pathExists(m)||await ko.default.writeFile(m,l),(0,Co.join)("assets","editor-generated_extracted-textures",u).replace(/\\/g,"/")}return null}o(kr,"extractTextureAssetFromDataString");async function wi(e,t){try{let r=await fetch(e),i=await r.arrayBuffer(),s=Buffer.from(i).toString("base64"),n=`data:${r.headers.get("content-type")??"image/unknown"};base64,${s}`;return kr(n,{...t})}catch(r){console.error(`Failed to extract texture from url "${e}": ${r.message}`)}return null}o(wi,"extractTextureAssetFromUrl");var Id=require("node:path/posix"),Fs=M(We(),1);async function Od(e,t){let r=await Fs.default.readJSON(e);if(r.customType!=="BABYLON.NodeMaterial")return;let i=Cr(t.publicDir);await Fs.default.ensureDir(i);let s=await Ro(r,{extractedTexturesOutputPath:i});await Fs.default.writeJSON(e,r,{encoding:"utf-8"}),await Promise.all(s.map(async n=>{let a=(0,Id.join)(t.publicDir,n);t.exportedAssets.push(a),await $e(a,{force:t.force,exportedAssets:t.exportedAssets})}))}o(Od,"processExportedMaterial");async function Ro(e,t){let r=e.blocks.filter(s=>(s.customType==="BABYLON.TextureBlock"||s.customType==="BABYLON.ImageSourceBlock")&&s.texture?.name),i=[];return await Promise.all(r.map(async s=>{if(s.texture?.name?.startsWith("http://")||s.texture.name.startsWith("https://")){let n=await wi(s.texture.name,{...t});n&&(i.push(n),s.texture.name=s.texture.url=n)}if(s.texture.name?.startsWith("data:")){let n=await kr(s.texture.name,{...t});n&&(i.push(n),s.texture.name=s.texture.url=n)}})),i}o(Ro,"extractNodeMaterialTextures");var Ld=require("node:path/posix"),As=M(We(),1);async function Nd(e,t){let r=await As.default.readJSON(e);if(r.customType!=="BABYLON.NodeParticleSystemSet")return;let i=Cr(t.publicDir);await As.default.ensureDir(i);let s=await Io(r,{extractedTexturesOutputPath:i});await As.default.writeJSON(e,r,{encoding:"utf-8"}),await Promise.all(s.map(async n=>{let a=(0,Ld.join)(t.publicDir,n);t.exportedAssets.push(a),t.optimize&&await $e(a,{force:t.force,exportedAssets:t.exportedAssets})}))}o(Nd,"processExportedNodeParticleSystemSet");async function Dd(e,t){let r=null;return e.texture?.name.startsWith("http://")||e.texture?.name.startsWith("https://")?r=await wi(e.texture.name,{...t}):e.texture?.name.startsWith("data:")&&(r=await kr(e.texture.name,{...t})),r&&(e.texture.name=r,e.texture.url=e.texture.name),r}o(Dd,"extractParticleSystemTextures");async function Io(e,t){let r=e.blocks.filter(s=>s.customType==="BABYLON.ParticleTextureSourceBlock"),i=[];return await Promise.all(r.map(async s=>{if(s.url?.startsWith("http://")||s.url?.startsWith("https://")){let n=await wi(s.url,{...t});n&&(i.push(n),s.url=`/scene/${n}`)}if(s.textureDataUrl?.startsWith("data:")){let n=await kr(s.textureDataUrl,{...t});n&&(i.push(n),delete s.textureDataUrl,s.url=`/scene/${n}`,s.serializedCachedData=!1)}})),i}o(Io,"extractNodeParticleSystemSetTextures");var yt=require("node:path/posix"),yi=M(We(),1),Bd=[".jpg",".jpeg",".webp",".png",".bmp"],_2=[".env",".dds"],T2=[".mp3",".wav",".wave",".ogg"],F2=[".material",".gui",".cinematic",".npss",".json"],A2=[".3dl",".exr",".hdr"],P2=[...Bd,..._2,...T2,...F2,...A2];async function jd(e,t){let r=e.includes(".navmesh"),i=(0,yt.extname)(e).toLocaleLowerCase();if(!r&&!P2.includes(i)||(0,yt.basename)(e).startsWith("editor_preview"))return;let s=e.replace((0,yt.join)(t.projectDir,"/"),""),n=s.split("/"),a="";for(let m=0;m<n.length-1;++m){try{await yi.default.ensureDir((0,yt.join)(t.publicDir,a,n[m]))}catch{}a=(0,yt.join)(a,n[m])}let l=!1,f=(await yi.default.stat(e)).mtimeMs.toString();l=!t.cache[s]||t.cache[s]!==f,t.cache[s]=f;let c=(0,yt.join)(t.publicDir,s),u=await yi.default.pathExists(c);(l||!u)&&await yi.default.copyFile(e,c),t.exportedAssets.push(c),t.optimize&&t.compressedTexturesEnabled&&await $e(c,{force:l,exportedAssets:t.exportedAssets}),t.optimize&&(Bd.includes(i)?await Ad(c,{...t,force:l}):i===".material"?await Od(c,{...t,force:l}):i===".npss"&&await Nd(c,{...t,force:l}))}o(jd,"processAssetFile");var Md=require("node:os"),Ps=require("node:path/posix");async function $d(e){let t=await Wt((0,Ps.join)(e.baseAssetsDir,"**/*"),{nodir:!0,ignore:{childrenIgnored:o(s=>(0,Ps.extname)(s.name)===".scene","childrenIgnored")}}),r=[],i=(0,Md.cpus)().length;console.log(`Using ${i} cpus to process assets...`);for(let s of t)r.length>=i&&(await Promise.all(r),r.length=0),r.push(jd(s,{...e}));await Promise.all(r)}o($d,"createAssets");var q=require("node:path/posix"),me=M(We(),1);async function qd(e){let t=[],r=[],i=[],s=[];await Promise.all(e.directories.meshesFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"meshes",f)),u=c.meshes[0];u.delayLoadingFile&&(u.delayLoadingFile=(0,q.join)(e.sceneName,(0,q.basename)(u.delayLoadingFile))),u.metadata?.parentId&&(u.parentId=u.metadata.parentId),u.instances?.forEach(m=>{m.metadata?.parentId&&(m.parentId=m.metadata.parentId)}),c.basePoseMatrix&&(u.basePoseMatrix=c.basePoseMatrix),t.push(u),c.materials?.forEach(m=>{r.find(y=>y.id===m.id)||r.push(m)})})),await Promise.all(e.directories.morphTargetManagerFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"morphTargetManagers",f));e.babylonjsEditorToolsVersion>="5.2.6"?c.targets.forEach(u=>{u.delayLoadingFile&&(u.delayLoadingFile=(0,q.join)(e.sceneName,"morphTargets",(0,q.basename)(u.delayLoadingFile)))}):await Promise.all(c.targets.map(async u=>{let m=(0,q.join)(e.sceneFile,"morphTargets",(0,q.basename)(u.delayLoadingFile)),p=(await me.default.readFile(m)).buffer;u.positionsCount&&(u.positions=Array.prototype.slice.call(new Float32Array(p,u.positionsOffset,u.positionsCount))),u.normalsCount&&(u.normals=Array.prototype.slice.call(new Float32Array(p,u.normalsOffset,u.normalsCount))),u.tangentsCount&&(u.tangents=Array.prototype.slice.call(new Float32Array(p,u.tangentsOffset,u.tangentsCount))),u.uvsCount&&(u.uvs=Array.prototype.slice.call(new Float32Array(p,u.uvsOffset,u.uvsCount))),u.uv2sCount&&(u.uv2s=Array.prototype.slice.call(new Float32Array(p,u.uv2sOffset,u.uv2sCount))),delete u.delayLoadingFile,delete u.positionsCount,delete u.normalsCount,delete u.tangentsCount,delete u.uvsCount,delete u.uv2sCount,delete u.positionsOffset,delete u.normalsOffset,delete u.tangentsOffset,delete u.uvsOffset,delete u.uv2sOffset})),s.push(c)})),await Promise.all(e.directories.nodesFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"nodes",f));c.metadata?.parentId&&(c.parentId=c.metadata.parentId),i.push(c)})),await Promise.all(e.directories.spriteManagerFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"sprite-managers",f));c.metadata?.parentId&&(c.parentId=c.metadata.parentId),i.push(c)})),await Promise.all(e.directories.spriteMapFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"sprite-maps",f));c.metadata?.parentId&&(c.parentId=c.metadata.parentId),i.push(c)}));let n=Cr(e.publicDir);await me.default.ensureDir(n),await Promise.all(r.map(async f=>{if(f.customType==="BABYLON.NodeMaterial"){let c=await Ro(f,{extractedTexturesOutputPath:n});await Promise.all(c.map(async u=>{let m=(0,q.join)(e.publicDir,u);e.exportedAssets.push(m),e.optimize&&e.compressedTexturesEnabled&&await $e(m,{...e,force:!1,exportedAssets:e.exportedAssets})}))}}));let a=await Promise.all(e.directories.particleSystemFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"particleSystems",f)),u=await Dd(c,{extractedTexturesOutputPath:n});if(u){let m=(0,q.join)(e.publicDir,u);e.exportedAssets.push(m),e.optimize&&e.compressedTexturesEnabled&&await $e(m,{...e,force:!1,exportedAssets:e.exportedAssets})}return c}));await Promise.all(e.directories.nodeParticleSystemSetFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"nodeParticleSystemSets",f));if(c.metadata?.parentId&&(c.parentId=c.metadata.parentId),c.nodeParticleSystemSet){let u=await Io(c.nodeParticleSystemSet,{extractedTexturesOutputPath:n});await Promise.all(u.map(async m=>{let p=(0,q.join)(e.publicDir,m);e.exportedAssets.push(p),e.optimize&&e.compressedTexturesEnabled&&await $e(p,{...e,force:!1,exportedAssets:e.exportedAssets})}))}t.push(c)}));let l={autoClear:!0,physicsEnabled:!0,collisionsEnabled:!0,useRightHandedSystem:!1,physicsEngine:"HavokPlugin",iblIntensity:1,clearColor:e.config.clearColor,ambientColor:e.config.ambientColor,geometries:{boxes:[],spheres:[],cylinders:[],toruses:[],grounds:[],planes:[],torusKnots:[],vertexData:[]},gravity:e.config.gravity??[0,-9.81,0],fogColor:e.config.fog.fogColor,fogStart:e.config.fog.fogStart,fogEnd:e.config.fog.fogEnd,fogDensity:e.config.fog.fogDensity,fogMode:e.config.fog.fogMode,physicsGravity:e.config.physics.gravity,environmentIntensity:e.config.environment.environmentIntensity,environmentTexture:e.config.environment.environmentTexture,metadata:e.config.metadata,animations:e.config.animations,postProcesses:[],multiMaterials:[],spriteManagers:[],reflectionProbes:[],meshes:t,materials:r,morphTargetManagers:s,transformNodes:i,particleSystems:a,animationGroups:await Promise.all(e.directories.animationGroupFiles.map(async f=>me.default.readJSON((0,q.join)(e.sceneFile,"animationGroups",f)))),skeletons:await Promise.all(e.directories.skeletonFiles.map(async f=>me.default.readJSON((0,q.join)(e.sceneFile,"skeletons",f)))),cameras:await Promise.all(e.directories.cameraFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"cameras",f));return c.metadata?.parentId&&(c.parentId=c.metadata.parentId),c})),lights:await Promise.all(e.directories.lightsFiles.map(async f=>{let c=await me.default.readJSON((0,q.join)(e.sceneFile,"lights",f));return c.metadata?.parentId&&(c.parentId=c.metadata.parentId),c})),shadowGenerators:await Promise.all(e.directories.shadowGeneratorFiles.map(async f=>me.default.readJSON((0,q.join)(e.sceneFile,"shadowGenerators",f)))),sounds:await Promise.all(e.directories.soundFiles.map(async f=>me.default.readJSON((0,q.join)(e.sceneFile,"sounds",f))))},h=(0,q.join)(e.publicDir,`${e.sceneName}.babylon`);await me.default.writeJSON(h,l,{encoding:"utf-8"}),e.exportedAssets.push(h)}o(qd,"createBabylonScene");var Jt=require("node:path/posix"),bi=M(We(),1);async function Gd(e){await bi.default.ensureDir((0,Jt.join)(e.publicDir,e.sceneName)),await bi.default.ensureDir((0,Jt.join)(e.publicDir,e.sceneName,"morphTargets")),await Promise.all(e.directories.geometryFiles.map(async t=>{let r=(0,Jt.join)(e.publicDir,e.sceneName,t);await bi.default.copyFile((0,Jt.join)(e.sceneFile,"geometries",t),r),e.exportedAssets.push(r)})),e.babylonjsEditorToolsVersion>="5.2.6"&&await Promise.all(e.directories.morphTargetFiles.map(async t=>{let r=(0,Jt.join)(e.publicDir,e.sceneName,"morphTargets",t);await bi.default.copyFile((0,Jt.join)(e.sceneFile,"morphTargets",t),r),e.exportedAssets.push(r)}))}o(Gd,"createGeometryFiles");var ht=M(We(),1),Wd=require("node:path"),le=require("node:path/posix");async function zd(e,t){let r=process.cwd();e!==r&&(e=(0,Wd.resolve)(r,e)),e=e.replace(/\\/g,"/");let s=(await ht.default.readdir(e)).find(E=>(0,le.extname)(E).toLowerCase()===".bjseditor"),n={compressedTexturesEnabled:!1};s&&(n=await ht.default.readJSON((0,le.join)(e,s))),n.compressedTexturesEnabled&&(t.pvrTexToolAbsolutePath?Vh(t.pvrTexToolAbsolutePath):await Jh());let a=(0,le.join)(e,"assets"),l=(0,le.join)(e,"public/scene");await ht.default.ensureDir(l);let h=(0,le.join)(e,"assets"),f=(0,le.join)(l,"assets");await ht.default.ensureDir(f);let c=[],u={};try{u=await ht.default.readJSON((0,le.join)(e,"assets/.export-cache.json"))}catch{}let m=Ur("Packing assets...");m.spinner=ut.dots14,m.start(),await $d({...t,...n,cache:u,projectDir:e,publicDir:l,baseAssetsDir:h,outputAssetsDir:f,exportedAssets:c}),m.succeed("Packed assets");let p="5.0.0";try{p=(await ht.default.readJSON((0,le.join)(e,"node_modules/babylonjs-editor-tools/package.json"))).version}catch{}let y=await Wt(`${a}/**/*`,{nodir:!1,ignore:{ignored:o(E=>!E.isDirectory()||(0,le.extname)(E.name).toLocaleLowerCase()!==".scene","ignored")}});for(let E of y){let x=(0,le.basename)(E),C=(0,le.basename)(E,(0,le.extname)(E)),A=Ur(`Packing ${x}...`);A.spinner=ut.dots14,A.start(),await Kh(E);let S=await Xh(E),D=await ht.default.readJSON((0,le.join)(E,"config.json"));await qd({...t,...n,config:D,directories:S,publicDir:l,sceneFile:E,sceneName:C,exportedAssets:c,babylonjsEditorToolsVersion:p}),await Gd({directories:S,publicDir:l,sceneFile:E,sceneName:C,exportedAssets:c,babylonjsEditorToolsVersion:p}),A.succeed(`Packed ${x}`)}await ht.default.writeJSON((0,le.join)(e,"assets/.export-cache.json"),u,{encoding:"utf-8",spaces:" "}),(await Wt((0,le.join)(l,"**/*"),{nodir:!0})).forEach(E=>{c.includes(E.toString())||ht.default.remove(E)})}o(zd,"pack");0&&(module.exports={pack});
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-editor-cli",
3
- "version": "5.0.0",
3
+ "version": "5.2.5",
4
4
  "description": "Babylon.js Editor CLI is a command line interface to help you package your scenes made using the Babylon.js Editor",
5
5
  "productName": "Babylon.js Editor CLI",
6
6
  "scripts": {
@@ -14,8 +14,10 @@ export async function locatePVRTexTool() {
14
14
  switch (platform) {
15
15
  case "darwin":
16
16
  absolutePathToCheck = "/Applications/Imagination/";
17
+ break;
17
18
  case "win32":
18
19
  absolutePathToCheck = "C:/Imagination Technologies/";
20
+ break;
19
21
  default:
20
22
  break;
21
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ktx.mjs","sourceRoot":"","sources":["../../../src/tools/ktx.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,CAAC,IAAI,sBAA0C,CAAC;AAEtD,MAAM,UAAU,yBAAyB,CAAC,YAAoB;IAC7D,sBAAsB,GAAG,YAAY,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAC/B,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,IAAI,mBAAmB,GAAkB,IAAI,CAAC;IAC9C,QAAQ,QAAQ,EAAE,CAAC;QAClB,KAAK,QAAQ;YACZ,mBAAmB,GAAG,4BAA4B,CAAC;QACpD,KAAK,OAAO;YACX,mBAAmB,GAAG,8BAA8B,CAAC;QACtD;YACC,MAAM;IACR,CAAC;IAED,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,EAAE;QACnE,KAAK,EAAE,IAAI;KACX,CAAC,CAAC;IAEH,QAAQ,QAAQ,EAAE,CAAC;QAClB,KAAK,QAAQ;YACZ,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9F,KAAK,OAAO;YACX,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC,CAAC,CAAC;IAC5G,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"ktx.mjs","sourceRoot":"","sources":["../../../src/tools/ktx.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,CAAC,IAAI,sBAA0C,CAAC;AAEtD,MAAM,UAAU,yBAAyB,CAAC,YAAoB;IAC7D,sBAAsB,GAAG,YAAY,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAC/B,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,IAAI,mBAAmB,GAAkB,IAAI,CAAC;IAC9C,QAAQ,QAAQ,EAAE,CAAC;QAClB,KAAK,QAAQ;YACZ,mBAAmB,GAAG,4BAA4B,CAAC;YACnD,MAAM;QACP,KAAK,OAAO;YACX,mBAAmB,GAAG,8BAA8B,CAAC;YACrD,MAAM;QACP;YACC,MAAM;IACR,CAAC;IAED,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,EAAE;QACnE,KAAK,EAAE,IAAI;KACX,CAAC,CAAC;IAEH,QAAQ,QAAQ,EAAE,CAAC;QAClB,KAAK,QAAQ;YACZ,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9F,KAAK,OAAO;YACX,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC,CAAC,CAAC;IAC5G,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-editor-cli",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Babylon.js Editor CLI is a command line interface to help you package your scenes made using the Babylon.js Editor",
5
5
  "productName": "Babylon.js Editor CLI",
6
6
  "scripts": {