@seanhogg/builderforce-webcontainers 2026.10.2 → 2026.10.4
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.
- package/README.md +6 -1
- package/dist/assets.d.ts +2 -0
- package/dist/assets.js +4 -2
- package/dist/check/cachedFetch.d.ts +3 -0
- package/dist/check/cachedFetch.d.ts.map +1 -0
- package/dist/check/cachedFetch.js +39 -0
- package/dist/check/cachedFetch.js.map +1 -0
- package/dist/check/index.d.ts +41 -0
- package/dist/check/index.d.ts.map +1 -0
- package/dist/check/index.js +74 -0
- package/dist/check/index.js.map +1 -0
- package/dist/check/protocol.d.ts +29 -0
- package/dist/check/protocol.d.ts.map +1 -0
- package/dist/check/protocol.js +13 -0
- package/dist/check/protocol.js.map +1 -0
- package/dist/check/worker.js +20 -0
- package/dist/componentCompilers.d.ts +21 -0
- package/dist/componentCompilers.d.ts.map +1 -0
- package/dist/componentCompilers.js +35 -0
- package/dist/componentCompilers.js.map +1 -0
- package/dist/esbuildWasm.d.ts +10 -4
- package/dist/esbuildWasm.d.ts.map +1 -1
- package/dist/esbuildWasm.js +14 -6
- package/dist/esbuildWasm.js.map +1 -1
- package/dist/host.d.ts +39 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +22 -7
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +42 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +45 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/processHost.d.ts +65 -0
- package/dist/node/processHost.d.ts.map +1 -0
- package/dist/node/processHost.js +269 -0
- package/dist/node/processHost.js.map +1 -0
- package/dist/node/protocol.d.ts +139 -0
- package/dist/node/protocol.d.ts.map +1 -0
- package/dist/node/protocol.js +5 -0
- package/dist/node/protocol.js.map +1 -0
- package/dist/node/worker.js +197 -0
- package/dist/node/workerProcess.d.ts +22 -0
- package/dist/node/workerProcess.d.ts.map +1 -0
- package/dist/node/workerProcess.js +210 -0
- package/dist/node/workerProcess.js.map +1 -0
- package/dist/packageCache.d.ts +12 -0
- package/dist/packageCache.d.ts.map +1 -0
- package/dist/packageCache.js +28 -0
- package/dist/packageCache.js.map +1 -0
- package/dist/process-worker.js +197 -0
- package/dist/protocol.d.ts +9 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +7 -0
- package/dist/protocol.js.map +1 -1
- package/dist/relay.html +1 -1
- package/dist/relayWorker.d.ts +19 -0
- package/dist/relayWorker.d.ts.map +1 -0
- package/dist/relayWorker.js +39 -0
- package/dist/relayWorker.js.map +1 -0
- package/dist/sw.js +1 -1
- package/dist/swRouter.d.ts +9 -1
- package/dist/swRouter.d.ts.map +1 -1
- package/dist/swRouter.js +26 -4
- package/dist/swRouter.js.map +1 -1
- package/dist/transport.d.ts +7 -0
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +7 -1
- package/dist/transport.js.map +1 -1
- package/package.json +12 -3
- package/src/check/cachedFetch.ts +47 -0
- package/src/check/index.ts +98 -0
- package/src/check/protocol.ts +34 -0
- package/src/check/worker.ts +49 -0
- package/src/componentCompilers.ts +66 -0
- package/src/esbuildWasm.ts +19 -7
- package/src/host.ts +64 -9
- package/src/index.ts +17 -4
- package/src/node/index.ts +69 -0
- package/src/node/processHost.ts +307 -0
- package/src/node/protocol.ts +63 -0
- package/src/node/worker.ts +46 -0
- package/src/node/workerProcess.ts +219 -0
- package/src/packageCache.ts +28 -0
- package/src/protocol.ts +13 -0
- package/src/relay.ts +5 -1
- package/src/relayWorker.ts +53 -0
- package/src/sw.ts +25 -6
- package/src/swRouter.ts +33 -4
- package/src/transport.ts +14 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";(()=>{var Eo=Object.defineProperty;var bo=(t,e,r)=>e in t?Eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var A=(t,e,r)=>bo(t,typeof e!="symbol"?e+"":e,r);function x(t){let e=[];for(let r of t.replace(/\\/g,"/").split("/"))!r||r==="."||(r===".."?e.pop():e.push(r));return"/"+e.join("/")}function T(t){let e=x(t),r=e.lastIndexOf("/");return r<=0?"/":e.slice(0,r)}function Le(t){let e=x(t);return e.slice(e.lastIndexOf("/")+1)}function S(...t){return x(t.join("/"))}function ht(t){let e=Le(t),r=e.lastIndexOf(".");return r<=0?"":e.slice(r).toLowerCase()}var Co=new TextDecoder,dt=class{constructor(){A(this,"files",new Map);A(this,"versions",new Map);A(this,"mtimes",new Map);A(this,"children",new Map([["/",new Set]]));A(this,"explicit",new Set);A(this,"listeners",new Set);A(this,"clock",0)}writeFile(e,r){let n=x(e);if(n==="/"||this.children.has(n))throw new Error(`EISDIR: illegal operation on a directory, open '${n}'`);let s=!this.files.has(n);s&&this.link(n),this.files.set(n,r),this.versions.set(n,++this.clock),this.mtimes.set(n,Date.now()),this.emit({type:"write",path:n,created:s})}readFile(e){return this.files.get(x(e))}readText(e){let r=this.readFile(e);if(r!==void 0)return typeof r=="string"?r:Co.decode(r)}isFile(e){return this.files.has(x(e))}isDirectory(e){return this.children.has(x(e))}exists(e){return this.isFile(e)||this.isDirectory(e)}mkdir(e){let r=x(e);if(this.files.has(r))throw new Error(`EEXIST: file already exists, mkdir '${r}'`);if(r==="/")return;let n=this.children.has(r);this.explicit.add(r),!n&&(this.ensureDir(r),this.emit({type:"mkdir",path:r}))}readdir(e){return[...this.children.get(x(e))??[]].sort()}list(){return[...this.files.keys()].sort()}explicitDirectories(){return[...this.explicit].sort()}rm(e){let r=x(e);if(this.files.has(r)){this.removeFile(r);return}if(!this.children.has(r))return;for(let s of[...this.children.get(r)??[]])this.rm(r==="/"?"/"+s:`${r}/${s}`);if(r==="/")return;let n=this.explicit.delete(r);this.children.has(r)&&this.unlinkDir(r),n&&this.emit({type:"remove",path:r})}version(e){return this.versions.get(x(e))}mtime(e){return this.mtimes.get(x(e))}mount(e,r="/"){for(let[n,s]of Object.entries(e)){let i=S(r,n);typeof s=="string"||s instanceof Uint8Array?this.writeFile(i,s):"file"in s?this.writeFile(i,s.file.contents):(this.mkdir(i),this.mount(s.directory,i))}}toFlat(){let e={};for(let[r,n]of this.files)e[r.slice(1)]=n;return e}watch(e){return this.listeners.add(e),()=>this.listeners.delete(e)}removeFile(e){this.files.delete(e),this.versions.delete(e),this.mtimes.delete(e),this.unlink(e),this.emit({type:"remove",path:e})}link(e){let r=T(e);this.ensureDir(r),this.children.get(r).add(e.slice(e.lastIndexOf("/")+1))}ensureDir(e){if(!this.children.has(e)){if(this.files.has(e))throw new Error(`ENOTDIR: not a directory, '${e}'`);this.children.set(e,new Set),this.link(e)}}unlink(e){let r=T(e),n=this.children.get(r);n&&(n.delete(e.slice(e.lastIndexOf("/")+1)),n.size===0&&r!=="/"&&!this.explicit.has(r)&&this.unlinkDir(r))}unlinkDir(e){this.children.delete(e),this.unlink(e)}emit(e){for(let r of this.listeners)r(e)}};function xn(t){let e={};for(let r of t.split(/\r?\n/)){let n=r.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s<=0)continue;let i=n.slice(0,s).replace(/^export\s+/,"").trim(),o=n.slice(s+1).trim();(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),e[i]=o}return e}function Dn(t){let e=t.split("/"),r=t.startsWith("@")?2:1;return{name:e.slice(0,r).join("/"),subpath:e.length>r?"/"+e.slice(r).join("/"):""}}var On;(function(t){t[t.Static=1]="Static",t[t.Dynamic=2]="Dynamic",t[t.ImportMeta=3]="ImportMeta",t[t.StaticSourcePhase=4]="StaticSourcePhase",t[t.DynamicSourcePhase=5]="DynamicSourcePhase",t[t.StaticDeferPhase=6]="StaticDeferPhase",t[t.DynamicDeferPhase=7]="DynamicDeferPhase"})(On||(On={}));var vo=new Uint8Array(new Uint16Array([1]).buffer)[0]===1;function Rt(t,e="@"){if(!_)return Br.then(()=>Rt(t));let r=t.length+1,n=(_.__heap_base.value||_.__heap_base)+4*r-_.memory.buffer.byteLength;n>0&&_.memory.grow(Math.ceil(n/65536));let s=_.sa(r-1);if((vo?Bo:Qo)(t,new Uint16Array(_.memory.buffer,s,r)),!_.parse())throw Object.assign(new Error(`Parse error ${e}:${t.slice(0,_.e()).split(`
|
|
2
|
+
`).length}:${_.e()-t.lastIndexOf(`
|
|
3
|
+
`,_.e()-1)}`),{idx:_.e()});let i=[],o=[];for(;_.ri();){let c=_.is(),l=_.ie(),f=_.it(),u=_.ai(),h=_.id(),d=_.ss(),g=_.se(),m;_.ip()&&(m=a(t.slice(h===-1?c-1:c,h===-1?l+1:l))),i.push({n:m,t:f,s:c,e:l,ss:d,se:g,d:h,a:u})}for(;_.re();){let c=_.es(),l=_.ee(),f=_.els(),u=_.ele(),h=t.slice(c,l),d=h[0],g=f<0?void 0:t.slice(f,u),m=g?g[0]:"";o.push({s:c,e:l,ls:f,le:u,n:d==='"'||d==="'"?a(h):h,ln:m==='"'||m==="'"?a(g):g})}function a(c){try{return(0,eval)(c)}catch{}}return[i,o,!!_.f(),!!_.ms()]}function Qo(t,e){let r=t.length,n=0;for(;n<r;){let s=t.charCodeAt(n);e[n++]=(255&s)<<8|s>>>8}}function Bo(t,e){let r=t.length,n=0;for(;n<r;)e[n]=t.charCodeAt(n++)}var _,Io=()=>{return t="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GzYCHAtBAEEAKAKwCkECajYCsAoCQAJAAkACQEEAECkiAUHhAEYNACABQfcARg0BQQAoArAKIQEMAgtBACgCsAoiAUECakHACEEKEC8NAUEGIQIMAgtBACgCsAoiAS8BAkHpAEcNACABLwEEQfQARw0AQQQhAiABLwEGQegARg0BC0EAIAFBfmo2ArAKDwtBACABIAJBAXRqNgKwCgJAQQEQKUH7AEYNAEEAIAE2ArAKDwtBACgCsAoiACECA0BBACACQQJqNgKwCgJAAkACQEEBECkiAkEiRg0AIAJBJ0cNAUEnEBpBAEEAKAKwCkECajYCsApBARApIQIMAgtBIhAaQQBBACgCsApBAmo2ArAKQQEQKSECDAELIAIQLCECCwJAIAJBOkYNAEEAIAE2ArAKDwtBAEEAKAKwCkECajYCsAoCQEEBECkiAkEiRg0AIAJBJ0YNAEEAIAE2ArAKDwsgAhAaQQBBACgCsApBAmo2ArAKAkACQEEBECkiAkEsRg0AIAJB/QBGDQFBACABNgKwCg8LQQBBACgCsApBAmo2ArAKQQEQKUH9AEYNAEEAKAKwCiECDAELC0EAKALwCSIBIAA2AhAgAUEAKAKwCkECajYCDAttAQJ/AkACQANAAkAgAEH//wNxIgFBd2oiAkEXSw0AQQEgAnRBn4CABHENAgsgAUGgAUYNASAAIQIgARAoDQJBACECQQBBACgCsAoiAEECajYCsAogAC8BAiIADQAMAgsLIAAhAgsgAkH//wNxC6sBAQR/AkACQEEAKAKwCiICLwEAIgNB4QBGDQAgASEEIAAhBQwBC0EAIAJBBGo2ArAKQQEQKSECQQAoArAKIQUCQAJAIAJBIkYNACACQSdGDQAgAhAsGkEAKAKwCiEEDAELIAIQGkEAQQAoArAKQQJqIgQ2ArAKC0EBECkhA0EAKAKwCiECCwJAIAIgBUYNACAFIARBACAAIAAgAUYiAhtBACABIAIbEAILIAMLcgEEf0EAKAKwCiEAQQAoArQKIQECQAJAA0AgAEECaiECIAAgAU8NAQJAAkAgAi8BACIDQaR/ag4CAQQACyACIQAgA0F2ag4EAgEBAgELIABBBGohAAwACwtBACACNgKwChAlQQAPC0EAIAI2ArAKQd0AC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC+wBAgBBgAgLzgEAAHgAcABvAHIAdABtAHAAbwByAHQAZgBvAHIAZQB0AGEAbwB1AHIAYwBlAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=",typeof Buffer<"u"?Buffer.from(t,"base64"):Uint8Array.from(atob(t),e=>e.charCodeAt(0));var t},Br=WebAssembly.compile(Io()).then(WebAssembly.instantiate).then(({exports:t})=>{_=t});var $=Uint8Array,ie=Uint16Array,_r=Int32Array,Lt=new $([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$t=new $([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),xr=new $([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tn=function(t,e){for(var r=new ie(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var s=new _r(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)s[i]=i-r[n]<<5|n;return{b:r,r:s}},Ln=Tn(Lt,2),$n=Ln.b,Dr=Ln.r;$n[28]=258,Dr[258]=28;var Mn=Tn($t,0),So=Mn.b,Nn=Mn.r,Or=new ie(32768);for(O=0;O<32768;++O)Ce=(O&43690)>>1|(O&21845)<<1,Ce=(Ce&52428)>>2|(Ce&13107)<<2,Ce=(Ce&61680)>>4|(Ce&3855)<<4,Or[O]=((Ce&65280)>>8|(Ce&255)<<8)>>1;var Ce,O,Ae=function(t,e,r){for(var n=t.length,s=0,i=new ie(e);s<n;++s)t[s]&&++i[t[s]-1];var o=new ie(e);for(s=1;s<e;++s)o[s]=o[s-1]+i[s-1]<<1;var a;if(r){a=new ie(1<<e);var c=15-e;for(s=0;s<n;++s)if(t[s])for(var l=s<<4|t[s],f=e-t[s],u=o[t[s]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[Or[u]>>c]=l}else for(a=new ie(n),s=0;s<n;++s)t[s]&&(a[s]=Or[o[t[s]-1]++]>>15-t[s]);return a},De=new $(288);for(O=0;O<144;++O)De[O]=8;var O;for(O=144;O<256;++O)De[O]=9;var O;for(O=256;O<280;++O)De[O]=7;var O;for(O=280;O<288;++O)De[O]=8;var O,mt=new $(32);for(O=0;O<32;++O)mt[O]=5;var O,ko=Ae(De,9,0),xo=Ae(De,9,1),Do=Ae(mt,5,0),Oo=Ae(mt,5,1),Ir=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},fe=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(e&7)&r},Sr=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},Mt=function(t){return(t+7)/8|0},gt=function(t,e,r){return(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length),new $(t.subarray(e,r))};var No=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],j=function(t,e,r){var n=new Error(e||No[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,j),!r)throw n;return n},Ft=function(t,e,r,n){var s=t.length,i=n?n.length:0;if(!s||e.f&&!e.l)return r||new $(0);var o=!r,a=o||e.i!=2,c=e.i;o&&(r=new $(s*3));var l=function(ft){var ut=r.length;if(ft>ut){var ze=new $(Math.max(ut*2,ft));ze.set(r),r=ze}},f=e.f||0,u=e.p||0,h=e.b||0,d=e.l,g=e.d,m=e.m,E=e.n,p=s*8;do{if(!d){f=fe(t,u,1);var C=fe(t,u+1,3);if(u+=3,C)if(C==1)d=xo,g=Oo,m=9,E=5;else if(C==2){var v=fe(t,u,31)+257,B=fe(t,u+10,15)+4,Q=v+fe(t,u+5,31)+1;u+=14;for(var I=new $(Q),N=new $(19),L=0;L<B;++L)N[xr[L]]=fe(t,u+L*3,7);u+=B*3;for(var M=Ir(N),ce=(1<<M)-1,J=Ae(N,M,1),L=0;L<Q;){var ee=J[fe(t,u,ce)];u+=ee&15;var y=ee>>4;if(y<16)I[L++]=y;else{var q=0,F=0;for(y==16?(F=3+fe(t,u,3),u+=2,q=I[L-1]):y==17?(F=3+fe(t,u,7),u+=3):y==18&&(F=11+fe(t,u,127),u+=7);F--;)I[L++]=q}}var te=I.subarray(0,v),W=I.subarray(v);m=Ir(te),E=Ir(W),d=Ae(te,m,1),g=Ae(W,E,1)}else j(1);else{var y=Mt(u)+4,b=t[y-4]|t[y-3]<<8,w=y+b;if(w>s){c&&j(0);break}a&&l(h+b),r.set(t.subarray(y,w),h),e.b=h+=b,e.p=u=w*8,e.f=f;continue}if(u>p){c&&j(0);break}}a&&l(h+131072);for(var lt=(1<<m)-1,le=(1<<E)-1,be=u;;be=u){var q=d[Sr(t,u)<],ne=q>>4;if(u+=q&15,u>p){c&&j(0);break}if(q||j(2),ne<256)r[h++]=ne;else if(ne==256){be=u,d=null;break}else{var se=ne-254;if(ne>264){var L=ne-257,U=Lt[L];se=fe(t,u,(1<<U)-1)+$n[L],u+=U}var de=g[Sr(t,u)&le],qe=de>>4;de||j(3),u+=de&15;var W=So[qe];if(qe>3){var U=$t[qe];W+=Sr(t,u)&(1<<U)-1,u+=U}if(u>p){c&&j(0);break}a&&l(h+131072);var We=h+se;if(h<W){var Nt=i-W,_t=Math.min(W,We);for(Nt+h<0&&j(3);h<_t;++h)r[h]=n[Nt+h]}for(;h<We;++h)r[h]=r[h-W]}}e.l=d,e.p=be,e.b=h,e.f=f,d&&(f=1,e.m=m,e.d=g,e.n=E)}while(!f);return h!=r.length&&o?gt(r,0,h):r.subarray(0,h)},ve=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8},pt=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8,t[n+2]|=r>>16},kr=function(t,e){for(var r=[],n=0;n<t.length;++n)t[n]&&r.push({s:n,f:t[n]});var s=r.length,i=r.slice();if(!s)return{t:Tt,l:0};if(s==1){var o=new $(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(w,v){return w.f-v.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],l=0,f=1,u=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};f!=s-1;)a=r[r[l].f<r[u].f?l++:u++],c=r[l!=f&&r[l].f<r[u].f?l++:u++],r[f++]={s:-1,f:a.f+c.f,l:a,r:c};for(var h=i[0].s,n=1;n<s;++n)i[n].s>h&&(h=i[n].s);var d=new ie(h+1),g=Nr(r[f-1],d,0);if(g>e){var n=0,m=0,E=g-e,p=1<<E;for(i.sort(function(v,B){return d[B.s]-d[v.s]||v.f-B.f});n<s;++n){var C=i[n].s;if(d[C]>e)m+=p-(1<<g-d[C]),d[C]=e;else break}for(m>>=E;m>0;){var y=i[n].s;d[y]<e?m-=1<<e-d[y]++-1:++n}for(;n>=0&&m;--n){var b=i[n].s;d[b]==e&&(--d[b],++m)}g=e}return{t:new $(d),l:g}},Nr=function(t,e,r){return t.s==-1?Math.max(Nr(t.l,e,r+1),Nr(t.r,e,r+1)):e[t.s]=r},_n=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new ie(++e),n=0,s=t[0],i=1,o=function(c){r[n++]=c},a=1;a<=e;++a)if(t[a]==s&&a!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=t[a]}return{c:r.subarray(0,n),n:e}},At=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},Rr=function(t,e,r){var n=r.length,s=Mt(e+2);t[s]=n&255,t[s+1]=n>>8,t[s+2]=t[s]^255,t[s+3]=t[s+1]^255;for(var i=0;i<n;++i)t[s+i+4]=r[i];return(s+4+n)*8},Rn=function(t,e,r,n,s,i,o,a,c,l,f){ve(e,f++,r),++s[256];for(var u=kr(s,15),h=u.t,d=u.l,g=kr(i,15),m=g.t,E=g.l,p=_n(h),C=p.c,y=p.n,b=_n(m),w=b.c,v=b.n,B=new ie(19),Q=0;Q<C.length;++Q)++B[C[Q]&31];for(var Q=0;Q<w.length;++Q)++B[w[Q]&31];for(var I=kr(B,7),N=I.t,L=I.l,M=19;M>4&&!N[xr[M-1]];--M);var ce=l+5<<3,J=At(s,De)+At(i,mt)+o,ee=At(s,h)+At(i,m)+o+14+3*M+At(B,N)+2*B[16]+3*B[17]+7*B[18];if(c>=0&&ce<=J&&ce<=ee)return Rr(e,f,t.subarray(c,c+l));var q,F,te,W;if(ve(e,f,1+(ee<J)),f+=2,ee<J){q=Ae(h,d,0),F=h,te=Ae(m,E,0),W=m;var lt=Ae(N,L,0);ve(e,f,y-257),ve(e,f+5,v-1),ve(e,f+10,M-4),f+=14;for(var Q=0;Q<M;++Q)ve(e,f+3*Q,N[xr[Q]]);f+=3*M;for(var le=[C,w],be=0;be<2;++be)for(var ne=le[be],Q=0;Q<ne.length;++Q){var se=ne[Q]&31;ve(e,f,lt[se]),f+=N[se],se>15&&(ve(e,f,ne[Q]>>5&127),f+=ne[Q]>>12)}}else q=ko,F=De,te=Do,W=mt;for(var Q=0;Q<a;++Q){var U=n[Q];if(U>255){var se=U>>18&31;pt(e,f,q[se+257]),f+=F[se+257],se>7&&(ve(e,f,U>>23&31),f+=Lt[se]);var de=U&31;pt(e,f,te[de]),f+=W[de],de>3&&(pt(e,f,U>>5&8191),f+=$t[de])}else pt(e,f,q[U]),f+=F[U]}return pt(e,f,q[256]),f+F[256]},_o=new _r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Tt=new $(0),Ro=function(t,e,r,n,s,i){var o=i.z||t.length,a=new $(n+o+5*(1+Math.ceil(o/7e3))+s),c=a.subarray(n,a.length-s),l=i.l,f=(i.r||0)&7;if(e){f&&(c[0]=i.r>>3);for(var u=_o[e-1],h=u>>13,d=u&8191,g=(1<<r)-1,m=i.p||new ie(32768),E=i.h||new ie(g+1),p=Math.ceil(r/3),C=2*p,y=function(Qr){return(t[Qr]^t[Qr+1]<<p^t[Qr+2]<<C)&g},b=new _r(25e3),w=new ie(288),v=new ie(32),B=0,Q=0,I=i.i||0,N=0,L=i.w||0,M=0;I+2<o;++I){var ce=y(I),J=I&32767,ee=E[ce];if(m[J]=ee,E[ce]=J,L<=I){var q=o-I;if((B>7e3||N>24576)&&(q>423||!l)){f=Rn(t,c,0,b,w,v,Q,N,M,I-M,f),N=B=Q=0,M=I;for(var F=0;F<286;++F)w[F]=0;for(var F=0;F<30;++F)v[F]=0}var te=2,W=0,lt=d,le=J-ee&32767;if(q>2&&ce==y(I-le))for(var be=Math.min(h,q)-1,ne=Math.min(32767,I),se=Math.min(258,q);le<=ne&&--lt&&J!=ee;){if(t[I+te]==t[I+te-le]){for(var U=0;U<se&&t[I+U]==t[I+U-le];++U);if(U>te){if(te=U,W=le,U>be)break;for(var de=Math.min(le,U-2),qe=0,F=0;F<de;++F){var We=I-le+F&32767,Nt=m[We],_t=We-Nt&32767;_t>qe&&(qe=_t,ee=We)}}}J=ee,ee=m[J],le+=J-ee&32767}if(W){b[N++]=268435456|Dr[te]<<18|Nn[W];var ft=Dr[te]&31,ut=Nn[W]&31;Q+=Lt[ft]+$t[ut],++w[257+ft],++v[ut],L=I+te,++B}else b[N++]=t[I],++w[t[I]]}}for(I=Math.max(I,L);I<o;++I)b[N++]=t[I],++w[t[I]];f=Rn(t,c,l,b,w,v,Q,N,M,I-M,f),l||(i.r=f&7|c[f/8|0]<<3,f-=7,i.h=E,i.p=m,i.i=I,i.w=L)}else{for(var I=i.w||0;I<o+l;I+=65535){var ze=I+65535;ze>=o&&(c[f/8|0]=l,ze=o),f=Rr(c,f+1,t.subarray(I,ze))}i.i=o}return gt(a,0,n+Mt(f)+s)},To=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var r=e,n=9;--n;)r=(r&1&&-306674912)^r>>>1;t[e]=r}return t}(),Fn=function(){var t=-1;return{p:function(e){for(var r=t,n=0;n<e.length;++n)r=To[r&255^e[n]]^r>>>8;t=r},d:function(){return~t}}},Tr=function(){var t=1,e=0;return{p:function(r){for(var n=t,s=e,i=r.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)s+=n+=r[o];n=(n&65535)+15*(n>>16),s=(s&65535)+15*(s>>16)}t=n,e=s},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},Ge=function(t,e,r,n,s){if(!s&&(s={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),o=new $(i.length+t.length);o.set(i),o.set(t,i.length),t=o,s.w=i.length}return Ro(t,e.level==null?6:e.level,e.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,r,n,s)};var Oe=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Un=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&Oe(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var n=0;n<=r.length;++n)t[n+10]=r.charCodeAt(n)}},jn=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&j(6,"invalid gzip data");var e=t[3],r=10;e&4&&(r+=(t[10]|t[11]<<8)+2);for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[r++]);return r+(e&2)},Lo=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},Pn=function(t){return 10+(t.filename?t.filename.length+1:0)},Kn=function(t,e){var r=e.level,n=r==0?0:r<6?1:r==9?3:2;if(t[0]=120,t[1]=n<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var s=Tr();s.p(e.dictionary),Oe(t,2,s.d())}},Hn=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&j(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&j(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function $o(t,e){return typeof t=="function"&&(e=t,t={}),this.ondata=e,t}var xe=function(){function t(e,r){if(typeof e=="function"&&(r=e,e={}),this.ondata=r,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new $(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return t.prototype.p=function(e,r){this.ondata(Ge(e,this.o,0,0,this.s),r)},t.prototype.push=function(e,r){this.ondata||j(5),this.s.l&&j(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var s=new $(n&-32768);s.set(this.b.subarray(0,this.s.z)),this.b=s}var i=this.b.length-this.s.z;this.b.set(e.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(i),32768),this.s.z=e.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=r&1,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2),r&&(this.s=this.o={},this.b=Tt)},t.prototype.flush=function(e){if(this.ondata||j(5),this.s.l&&j(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var r=new $(6);r[0]=this.s.r>>3;var n=Rr(r,this.s.r,Tt);this.s.r=0,this.ondata(r.subarray(0,n>>3),!1)}},t}();function Jn(t,e){return Ge(t,e||{},0,0)}var pe=function(){function t(e,r){typeof e=="function"&&(r=e,e={}),this.ondata=r;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new $(32768),this.p=new $(0),n&&this.o.set(n)}return t.prototype.e=function(e){if(this.ondata||j(5),this.d&&j(4),!this.p.length)this.p=e;else if(e.length){var r=new $(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length),this.p=r}},t.prototype.c=function(e){this.s.i=+(this.d=e||!1);var r=this.s.b,n=Ft(this.p,this.s,this.o);this.ondata(gt(n,r,this.s.b),this.d),this.o=gt(n,this.s.b-32768),this.s.b=this.o.length,this.p=gt(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(e,r){this.e(e),this.c(r)},t}();function Lr(t,e){return Ft(t,{i:2},e&&e.out,e&&e.dictionary)}var qn=function(){function t(e,r){this.c=Fn(),this.l=0,this.v=1,xe.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),this.l+=e.length,xe.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=Ge(e,this.o,this.v&&Pn(this.o),r&&8,this.s);this.v&&(Un(n,this.o),this.v=0),r&&(Oe(n,n.length-8,this.c.d()),Oe(n,n.length-4,this.l)),this.ondata(n,r)},t.prototype.flush=function(e){xe.prototype.flush.call(this,e)},t}();function Wn(t,e){e||(e={});var r=Fn(),n=t.length;r.p(t);var s=Ge(t,e,Pn(e),8),i=s.length;return Un(s,e),Oe(s,i-8,r.d()),Oe(s,i-4,n),s}var $r=function(){function t(e,r){this.v=1,this.r=0,pe.call(this,e,r)}return t.prototype.push=function(e,r){if(pe.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),s=n.length>3?jn(n):4;if(s>n.length){if(!r)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(s),this.v=0}pe.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=Mt(this.s.p)+9,this.s={i:0},this.o=new $(0),this.push(new $(0),r)):r&&pe.prototype.c.call(this,r)},t}();function wt(t,e){var r=jn(t);return r+8>t.length&&j(6,"invalid gzip data"),Ft(t.subarray(r,-8),{i:2},e&&e.out||new $(Lo(t)),e&&e.dictionary)}var zn=function(){function t(e,r){this.c=Tr(),this.v=1,xe.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),xe.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=Ge(e,this.o,this.v&&(this.o.dictionary?6:2),r&&4,this.s);this.v&&(Kn(n,this.o),this.v=0),r&&Oe(n,n.length-4,this.c.d()),this.ondata(n,r)},t.prototype.flush=function(e){xe.prototype.flush.call(this,e)},t}();function Gn(t,e){e||(e={});var r=Tr();r.p(t);var n=Ge(t,e,e.dictionary?6:2,4);return Kn(n,e),Oe(n,n.length-4,r.d()),n}var Mr=function(){function t(e,r){pe.call(this,e,r),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,r){if(pe.prototype.e.call(this,e),this.v){if(this.p.length<6&&!r)return;this.p=this.p.subarray(Hn(this.p,this.v-1)),this.v=0}r&&(this.p.length<4&&j(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),pe.prototype.c.call(this,r)},t}();function Fr(t,e){return Ft(t.subarray(Hn(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var Yn=function(){function t(e,r){this.o=$o.call(this,e,r)||{},this.G=$r,this.I=pe,this.Z=Mr}return t.prototype.i=function(){var e=this;this.s.ondata=function(r,n){e.ondata(r,n)}},t.prototype.push=function(e,r){if(this.ondata||j(5),this.s)this.s.push(e,r);else{if(this.p&&this.p.length){var n=new $(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,r),this.p=null)}},t}();function Vn(t,e){return t[0]==31&&t[1]==139&&t[2]==8?wt(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?Lr(t,e):Fr(t,e)}var Mo=typeof TextDecoder<"u"&&new TextDecoder,Fo=0;try{Mo.decode(Tt,{stream:!0}),Fo=1}catch{}var jo="https://registry.npmjs.org",Po="application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",Ko=new TextEncoder,Zn=new TextDecoder;function Ho(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}function Jo(t){return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}async function Xn(t,e){let r=globalThis.crypto?.subtle;if(!r)return!0;let n=async s=>new Uint8Array(await r.digest(s,t));if(e.integrity){let s={sha512:"SHA-512",sha384:"SHA-384",sha256:"SHA-256",sha1:"SHA-1"};for(let i of e.integrity.split(/\s+/)){let o=i.indexOf("-"),a=s[i.slice(0,o)];if(a&&Ho(await n(a))===i.slice(o+1))return!0}return!1}return e.shasum?Jo(await n("SHA-1"))===e.shasum:!0}var Ut=class{constructor(e){A(this,"options");A(this,"registry");A(this,"packuments",new Map);this.options=e,this.registry=(e.registry??jo).replace(/\/+$/,"")}packument(e){let r=this.packuments.get(e);return r||(r=this.loadPackument(e),r.catch(()=>this.packuments.delete(e)),this.packuments.set(e,r)),r}async tarball(e){let{dist:r}=e,n=`tarball:${r.integrity??r.shasum??r.tarball}`,s=await this.options.cache?.get(n);if(s&&await Xn(s,r))return s;let i=await this.get(r.tarball,{});if(!await Xn(i,r))throw new Error(`Integrity check failed for ${e.name}@${e.version}`);return await this.options.cache?.put(n,i),i}async loadPackument(e){let r=`packument:${this.registry}/${e}`,n=this.options.packumentMaxAgeMs??10*6e4,s=await this.options.cache?.get(r);if(s)try{let c=JSON.parse(Zn.decode(s));if(Date.now()-c.t<n)return c.p}catch{}let i=`${this.registry}/${e.startsWith("@")?"@"+encodeURIComponent(e.slice(1)):encodeURIComponent(e)}`,o=await this.get(i,{accept:Po},e),a=JSON.parse(Zn.decode(o));if(!a.versions)throw new Error(`The registry returned no versions for "${e}".`);return await this.options.cache?.put(r,Ko.encode(JSON.stringify({t:Date.now(),p:a}))),a}async get(e,r,n){let s;for(let i=0;i<2;i++){let o;try{o=await this.options.fetch(e,{headers:r,signal:this.options.signal})}catch(a){if(this.options.signal?.aborted)throw a;s=a;continue}if(o.status===404&&n)throw new Error(`Package "${n}" was not found in ${this.registry}.`);if(!o.ok)throw new Error(`GET ${e} failed with HTTP ${o.status}.`);return new Uint8Array(await o.arrayBuffer())}throw new Error(`GET ${e} failed: ${s instanceof Error?s.message:String(s)}`)}};var qo=/^(?:git\+|git:|github:|gitlab:|bitbucket:|file:|link:|https?:|workspace:)/;function Ur(t){let e=t.indexOf("@",t.startsWith("@")?1:0),r=e<0?t:t.slice(0,e),n=e<0?"":t.slice(e+1);return jr(r,n)}function jr(t,e){if(!t||/\s/.test(t))throw new Error(`Invalid package name "${t}".`);if(e.startsWith("npm:")){let r=Ur(e.slice(4));return{name:t,registryName:r.registryName,range:r.range}}if(qo.test(e)||/^[^@/\s]+\/[^@/\s]+(#.*)?$/.test(e))throw new Error(`"${t}@${e}": only registry packages are supported (not git, file or URL dependencies).`);return{name:t,registryName:t,range:e.trim()}}function jt(t){return Object.fromEntries(Object.entries(t).sort(([e],[r])=>e<r?-1:e>r?1:0))}var Wo=/^\s*[v=]*\s*(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?\s*$/,zo=/^[v=]*(\d+|[xX*])?(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?$/;function Ye(t){let e=Wo.exec(t);if(!e)return null;let r=e[4]?e[4].split(".").map(n=>/^\d+$/.test(n)?Number(n):n):[];return oe(Number(e[1]),Number(e[2]),Number(e[3]),r)}function oe(t,e,r,n=[]){let s=n.length?`-${n.join(".")}`:"";return{major:t,minor:e,patch:r,prerelease:n,version:`${t}.${e}.${r}${s}`}}function Kr(t){return Ye(t)?.version??null}function Go(t,e){if(!t.prerelease.length||!e.prerelease.length)return(e.prerelease.length?1:0)-(t.prerelease.length?1:0)||0;for(let r=0;;r++){let n=t.prerelease[r],s=e.prerelease[r];if(n===void 0&&s===void 0)return 0;if(n===void 0)return-1;if(s===void 0)return 1;if(n!==s)return typeof n=="number"&&typeof s=="number"?n<s?-1:1:typeof n=="number"?-1:typeof s=="number"?1:n<s?-1:1}}function ts(t,e){let r=typeof t=="string"?Ye(t):t,n=typeof e=="string"?Ye(e):e;if(!r||!n)throw new TypeError(`Invalid version: ${String(r?e:t)}`);return Math.sign(r.major-n.major||r.minor-n.minor||r.patch-n.patch)||Go(r,n)}var Pt=t=>t===void 0||t==="x"||t==="X"||t==="*";function Pr(t){let e=/^(~>?|\^|<=|>=|<|>|=)?(.*)$/.exec(t),r=e[1]??"",n=zo.exec(e[2]);if(!n)return null;let[,s,i,o,a]=n,c=a?a.split(".").map(C=>/^\d+$/.test(C)?Number(C):C):[],l=Pt(s),f=l||Pt(i),u=f||Pt(o),h=l?0:Number(s),d=f?0:Number(i),g=u?0:Number(o),m=C=>({op:">=",version:C}),E=C=>({op:"<",version:C}),p=(C,y,b)=>E(oe(C,y,b,[0]));if(r==="^"){if(l)return[];let C=m(oe(h,d,g,c));return h>0||f?[C,p(h+1,0,0)]:d>0||u?[C,p(0,d+1,0)]:[C,p(0,0,g+1)]}if(r==="~"||r==="~>"){if(l)return[];let C=m(oe(h,d,g,c));return f?[C,p(h+1,0,0)]:[C,p(h,d+1,0)]}return r===""||r==="="?l?[]:f?[m(oe(h,0,0)),p(h+1,0,0)]:u?[m(oe(h,d,0)),p(h,d+1,0)]:[{op:"=",version:oe(h,d,g,c)}]:l?r==="<"||r===">"?[E(oe(0,0,0,[0]))]:[]:u?r===">"?[m(f?oe(h+1,0,0):oe(h,d+1,0))]:r==="<="?[f?p(h+1,0,0):p(h,d+1,0)]:r==="<"?[E(oe(h,d,0,[0]))]:[m(oe(h,d,0))]:[{op:r,version:oe(h,d,g,c)}]}function Yo(t){return{parts:t.replace(/^[v=]+/,"").split("-")[0].split("."),full:Ye(t)}}function Vo(t,e){let r=Pr(`>=${t}`);if(!r)return null;let{parts:n,full:s}=Yo(e);if(s)return[...r,{op:"<=",version:s}];if(Pt(n[0]))return r;let i=Pr(`<=${e}`);return i?[...r,...i]:null}var es=new Map;function rs(t){let e=es.get(t);if(e!==void 0)return e;let r=[];for(let n of t.split("||")){let s=n.trim().replace(/(<=|>=|<|>|=|~>?|\^)\s+/g,"$1"),i=/^(\S+)\s+-\s+(\S+)$/.exec(s),o=i?Vo(i[1],i[2]):s.split(/\s+/).filter(Boolean).reduce((a,c)=>{let l=a&&Pr(c);return l?[...a,...l]:null},[]);if(!o){r=null;break}r.push(o)}return es.set(t,r),r}function $e(t){return rs(t)!==null}function Zo(t,e){let r=ts(e,t.version);switch(t.op){case"<":return r<0;case"<=":return r<=0;case">":return r>0;case">=":return r>=0;default:return r===0}}function Xo(t,e,r){return t.every(n=>Zo(n,e))?!e.prerelease.length||r?!0:t.some(n=>n.version.prerelease.length>0&&n.version.major===e.major&&n.version.minor===e.minor&&n.version.patch===e.patch):!1}function Ne(t,e,r={}){let n=typeof t=="string"?Ye(t):t,s=rs(e);return!n||!s?!1:s.some(i=>Xo(i,n,r.includePrerelease??!1))}function ns(t,e){let r=null;for(let n of t){let s=Ye(n);s&&Ne(s,e)&&(!r||ts(s,r)>0)&&(r=s)}return r?.version??null}var yt=(t,e)=>t?`${t}/node_modules/${e}`:`node_modules/${e}`;function Me(t){let e=t.lastIndexOf("/node_modules/");return e<0?"":t.slice(0,e)}function*ss(t){let e=t;for(;;){if(yield e,!e)return;e=Me(e)}}var is=(t,e)=>e===""||t===e||t.startsWith(e+"/node_modules/"),os={os:"linux",cpu:"wasm32"};function ea(t){let e=(r,n)=>!r?.length||r.some(s=>s===n)&&!r.includes("!"+n)||r.every(s=>s.startsWith("!"))&&!r.includes("!"+n);return e(t.os,os.os)&&e(t.cpu,os.cpu)}function ta(t){let e=t.bundleDependencies??t.bundledDependencies;return e===!0?new Set(Object.keys(t.dependencies??{})):new Set(Array.isArray(e)?e:[])}function as(t,e,r){let n=new Map,s=(o,a)=>{for(let[c,l]of Object.entries(o??{}))(!n.has(c)||a==="optional")&&n.set(c,{name:c,range:l,type:a})};if(e&&!r&&s(t.devDependencies,"dev"),s(t.dependencies,"prod"),s(t.optionalDependencies,"optional"),!e){let o=t.peerDependenciesMeta??{};for(let[a,c]of Object.entries(t.peerDependencies??{}))!n.has(a)&&!o[a]?.optional&&n.set(a,{name:a,range:c,type:"peer"})}let i=ta(t);return[...n.values()].filter(o=>!i.has(o.name)).sort((o,a)=>o.name<a.name?-1:1)}function cs(t,e){let r=e||"*";return $e(r)&&Ne(t,r)}async function ls(t){let e=new Map,r=[],n=new Map,s=t.production??!1,i=(f,u)=>{for(let h of ss(f)){let d=yt(h,u);if(e.has(d))return d}},o=f=>{r.push(f);let u=n.get(f.name)??[];u.push(f),n.set(f.name,u)},a=(f,u)=>(n.get(u)??[]).filter(h=>is(h.from,f)&&!(is(Me(h.to),f)&&Me(h.to)!==f)),c=(f,u,h)=>{let d;for(let g of ss(f)){if(e.has(yt(g,u))||a(g,u).some(m=>!cs(h,m.range)))break;d=g}return d===void 0?void 0:yt(d,u)},l=[{location:"",deps:as(t.root,!0,s)}];for(;l.length;){let{location:f,deps:u}=l.shift(),h=new Map;for(let d of u)try{let g=jr(d.name,d.range);h.set(d.name,g),t.prefetch?.(g)}catch(g){if(d.type!=="optional")throw g;t.warn(`skipped optional ${d.name}: ${g.message}`)}for(let d of u){let g=h.get(d.name);if(!g)continue;let m=d.type==="peer"?Me(f):f,E=i(m,d.name),p={...d,range:g.range,owner:f,from:m};if(E&&cs(e.get(E).manifest.version,g.range)){o({...p,to:E});continue}if(E&&d.type==="peer"){t.warn(`peer dependency conflict: ${f||"root"} wants ${d.name}@${g.range}, found ${e.get(E).manifest.version}`),o({...p,to:E});continue}let C;try{C=await t.pick(g)}catch(b){if(d.type!=="optional")throw b;t.warn(`skipped optional ${d.name}: ${b.message}`);continue}if(!ea(C)){if(d.type==="optional")continue;t.warn(`${C.name}@${C.version} targets ${[C.os,C.cpu].flat().filter(Boolean).join("/")} and may not work here`)}if(E&&e.get(E).manifest.version===C.version){o({...p,to:E});continue}let y=c(m,d.name,C.version);if(!y){t.warn(`could not place ${d.name}@${C.version} for ${f||"root"}`);continue}for(let b of a(Me(y),d.name))b.to=y;e.set(y,{location:y,name:d.name,manifest:C,dev:!1,optional:!1}),o({...p,to:y}),t.onResolved?.({name:d.name,version:C.version}),l.push({location:y,deps:as(C,!1,s)})}}return ra(e,r),e}function ra(t,e){let r=i=>{let o=new Set,a=[""];for(;a.length;){let c=a.pop();for(let l of e)l.owner!==c||i(l)||o.has(l.to)||(o.add(l.to),a.push(l.to))}return o},n=r(i=>i.owner===""&&i.type==="dev"),s=r(i=>i.type==="optional");for(let i of t.values())i.dev=!n.has(i.location),i.optional=!s.has(i.location)}function fs(t){if(t)try{let e=JSON.parse(t);return e.lockfileVersion>=2&&e.packages?e:void 0}catch{return}}var na=t=>t.slice(t.lastIndexOf("node_modules/")+13);function sa(t,e){if(!(!e.version||!e.resolved))return{name:e.name??na(t),version:e.version,dependencies:e.dependencies,optionalDependencies:e.optionalDependencies,peerDependencies:e.peerDependencies,peerDependenciesMeta:e.peerDependenciesMeta,bin:e.bin,engines:e.engines,os:e.os,cpu:e.cpu,hasInstallScript:e.hasInstallScript,deprecated:e.deprecated,license:e.license,dist:{tarball:e.resolved,integrity:e.integrity}}}function us(t){let e=new Map;for(let[r,n]of Object.entries(t?.packages??{})){if(!r.includes("node_modules/"))continue;let s=sa(r,n);if(!s)continue;let i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}return e}function Hr(t,e,r){let n=r||"*";if(!$e(n))return;let s;for(let i of t.get(e)??[])Ne(i.version,n)&&(!s||Ne(i.version,`>${s.version}`))&&(s=i);return s}var hs=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function ds(t,e){let r=t.packages[""]??{};return hs.every(n=>{let s=e[n]??{},i=r[n]??{};return[...new Set([...Object.keys(s),...Object.keys(i)])].every(a=>s[a]===i[a])})}var Ve=t=>t&&Object.keys(t).length?t:void 0;function ps(t,e){let r={name:t.name,version:t.version};for(let s of hs)Ve(t[s])&&(r[s]=t[s]);t.bin&&(r.bin=t.bin);let n={"":JSON.parse(JSON.stringify(r))};for(let s of[...e.keys()].sort()){let i=e.get(s),o=i.manifest,a={name:o.name!==i.name?o.name:void 0,version:o.version,resolved:o.dist.tarball,integrity:o.dist.integrity,dev:i.dev||void 0,optional:i.optional||void 0,license:o.license,dependencies:Ve(o.dependencies&&jt(o.dependencies)),optionalDependencies:Ve(o.optionalDependencies),peerDependencies:Ve(o.peerDependencies),peerDependenciesMeta:Ve(o.peerDependenciesMeta),bin:o.bin,engines:Ve(o.engines),os:o.os,cpu:o.cpu,hasInstallScript:o.hasInstallScript||void 0,deprecated:o.deprecated};n[s]=JSON.parse(JSON.stringify(a))}return{name:t.name,version:t.version,lockfileVersion:3,requires:!0,packages:n}}var ms=new TextDecoder;function Fe(t,e,r){let n=t.subarray(e,e+r),s=n.indexOf(0);return ms.decode(s<0?n:n.subarray(0,s))}function As(t,e,r){if(t[e]&128){let s=0;for(let i=e+1;i<e+r;i++)s=s*256+t[i];return s}let n=Fe(t,e,r).trim();return n?parseInt(n,8):0}function gs(t){let e={},r=ms.decode(t),n=0;for(;n<r.length;){let s=r.indexOf(" ",n);if(s<0)break;let i=parseInt(r.slice(n,s),10);if(!i)break;let o=r.slice(s+1,n+i);o.endsWith(`
|
|
4
|
+
`)||(o=r.slice(s+1,r.indexOf(`
|
|
5
|
+
`,s)+1));let a=o.indexOf("=");a>0&&(e[o.slice(0,a)]=o.slice(a+1).replace(/\n$/,"")),n=s+1+o.length}return e}function ia(t,e){for(let r=e;r<e+512;r++)if(t[r]!==0)return!1;return!0}function ws(t){let e=[],r=0,n={},s={},i,o;for(;r+512<=t.length&&!ia(t,r);){let a=Fe(t,r,100),c=As(t,r+100,8),l=As(t,r+124,12),f=String.fromCharCode(t[r+156]||48),u=Fe(t,r+157,100),d=Fe(t,r+257,6).startsWith("ustar")?Fe(t,r+345,155):"",g={...s,...n},m=g.size?Number(g.size):l,E=r+512,p=t.subarray(E,E+m);if(r=E+Math.ceil(m/512)*512,f==="x"){n=gs(p);continue}if(f==="g"){s={...s,...gs(p)};continue}if(f==="L"){i=Fe(p,0,p.length);continue}if(f==="K"){o=Fe(p,0,p.length);continue}let C=g.path??i??(d?`${d}/${a}`:a),y=g.linkpath??o??u;n={},i=void 0,o=void 0,f==="0"||f==="\0"||f==="7"?e.push({path:C,type:"file",data:p,mode:c}):f==="5"?e.push({path:C,type:"directory",data:new Uint8Array(0),mode:c}):f==="2"?e.push({path:C,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:y}):f==="1"&&e.push({path:C,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:y})}return e}var Jr="// @bfwc-bin ";function oa(t,e){if(!e)return{};let r=typeof e=="string"?[[t.replace(/^@[^/]+\//,""),e]]:Object.entries(e),n={};for(let[s,i]of r){let o=s.replace(/^@[^/]+\//,"");!o||/[/\\]/.test(o)||o==="."||o===".."||typeof i!="string"||(n[o]=i.replace(/^\.\//,""))}return n}function aa(t){return`#!/usr/bin/env node
|
|
6
|
+
${Jr}${t}
|
|
7
|
+
require(${JSON.stringify(t)});
|
|
8
|
+
`}function Kt(t,e){let r=t.readText(e);if(!r)return;let n=r.split(`
|
|
9
|
+
`).find(s=>s.startsWith(Jr));return n?S(T(x(e)),n.slice(Jr.length).trim()):void 0}function ys(t,e,r){let n={};for(let s of r)for(let[i,o]of Object.entries(oa(s.name,s.bin))){let a=S(s.dir,o);if(!t.isFile(a))continue;let c=ca(e,a);t.writeFile(S(e,i),aa(c)),n[i]=a}return n}function ca(t,e){let r=x(t).split("/").filter(Boolean),n=x(e).split("/").filter(Boolean),s=0;for(;s<r.length&&s<n.length&&r[s]===n[s];)s++;let o=[...r.slice(s).map(()=>".."),...n.slice(s)].join("/");return o.startsWith("..")?o:`./${o}`}var la=new TextDecoder("utf-8",{fatal:!0}),fa=/\.(?:png|jpe?g|gif|webp|ico|bmp|wasm|node|gz|tgz|zip|br|woff2?|ttf|otf|eot|pdf|mp[34]|webm|ogg|wav|bin|dat)$/i;function Es(t,e){if(fa.test(t)||e.subarray(0,8e3).includes(0))return e.slice();try{return la.decode(e)}catch{return e.slice()}}function Cs(t,e){let r=t["dist-tags"]??{},n=e||"*";if(!$e(n)){let o=r[n];if(o&&t.versions[o])return o;throw new Error(`No version of ${t.name} is tagged "${e}".`)}let s=r.latest;if(s&&t.versions[s]&&Ne(s,n))return s;let i=ns(Object.keys(t.versions),n);if(!i)throw new Error(`No matching version found for ${t.name}@${e}.`);return i}async function ua(t,e,r){let n=0,s=Array.from({length:Math.min(e,t.length)},async()=>{for(;n<t.length;)await r(t[n++])});await Promise.all(s)}function qr(t,e){try{let r=t.readText(e);return r===void 0?void 0:JSON.parse(r)}catch{return}}var bs=(t,e,r)=>t.writeFile(e,JSON.stringify(r,null,2)+`
|
|
10
|
+
`);function ha(t,e){let r=new Map,n=s=>{let i=S(e,s,"node_modules"),o=[];for(let a of t.readdir(i))if(!a.startsWith("."))if(a.startsWith("@"))for(let c of t.readdir(S(i,a)))o.push(`${a}/${c}`);else o.push(a);for(let a of o){let c=yt(s,a),l=qr(t,S(e,c,"package.json"));r.set(c,`${l?.name??""}@${l?.version??""}`),n(c)}};return n(""),r}async function da(t,e,r,n){let s=n?"devDependencies":"dependencies",i=n?"dependencies":"devDependencies";for(let o of r){let a=Ur(o),c=a.range;if(!c||!$e(c)?c=`^${Cs(await t.packument(a.registryName),c||"latest")}`:Kr(c)&&(c=`^${Kr(c)}`),a.registryName!==a.name&&(c=`npm:${a.registryName}@${c}`),e[s]=jt({...e[s]??{},[a.name]:c}),e[i]?.[a.name]){let l={...e[i]};delete l[a.name],e[i]=l}}}async function vs(t){let{fs:e,signal:r}=t,n=S("/",t.cwd??"/"),s=S(n,"package.json"),i=S(n,"package-lock.json"),o=[],a=new Ut({fetch:t.fetch,registry:t.registry,cache:t.cache,signal:r}),c=w=>t.onProgress?.(w),l=qr(e,s);if(!l){if(e.isFile(s))throw new Error(`${s} is not valid JSON.`);if(!t.add?.length)throw new Error(`No package.json in ${n}.`);l={}}t.add?.length&&(await da(a,l,t.add,t.saveDev??!1),bs(e,s,l));let f=fs(e.readText(i));if(t.ci){if(!f)throw new Error("npm ci needs a package-lock.json (lockfileVersion 2 or 3).");if(!ds(f,l))throw new Error("package.json and package-lock.json are out of sync. Run npm install to update the lockfile.");e.rm(S(n,"node_modules"))}let u=us(f),h=new Map,d=w=>{let v=`${w.registryName}@${w.range}`,B=h.get(v);if(!B){let Q=Hr(u,w.registryName,w.range);Q?B=Promise.resolve(Q):t.ci?B=Promise.reject(new Error(`${v} is missing from package-lock.json. Run npm install to update it.`)):B=a.packument(w.registryName).then(I=>{let N=I.versions[Cs(I,w.range)];return{...N,name:N.name??w.registryName}}),B.catch(()=>{}),h.set(v,B)}return B},g=0,m=await ls({root:l,pick:d,prefetch:w=>void(Hr(u,w.registryName,w.range)||t.ci||a.packument(w.registryName).catch(()=>{})),production:t.production,warn:w=>o.push(w),onResolved:({name:w,version:v})=>c({phase:"resolve",package:`${w}@${v}`,done:++g,total:g})});r?.throwIfAborted();let E=0;for(let[w,v]of[...ha(e,n)].sort(([B],[Q])=>B.length-Q.length)){let B=S(n,w);if(!e.exists(B))continue;let Q=m.get(w);(!Q||v!==`${Q.manifest.name}@${Q.manifest.version}`)&&(e.rm(B),E++)}let p=[...m.values()].filter(w=>!e.isFile(S(n,w.location,"package.json"))),C=0;await ua(p,t.concurrency??8,async w=>{r?.throwIfAborted(),await pa(e,S(n,w.location),await a.tarball(w.manifest)),c({phase:"fetch",package:`${w.name}@${w.manifest.version}`,done:++C,total:p.length})});for(let w of m.values())w.manifest.hasInstallScript&&o.push(`skipped install scripts of ${w.name}@${w.manifest.version} (they cannot run in the browser)`),w.manifest.deprecated&&o.push(`deprecated ${w.name}@${w.manifest.version}: ${w.manifest.deprecated}`);let y=Aa(e,n,m),b=ps(l,m);return bs(e,i,b),c({phase:"done",done:m.size,total:m.size}),{added:p.length,removed:E,total:m.size,bins:y,lockfile:b,warnings:o}}async function pa(t,e,r){let n=ws(wt(r)),s;for(let i of n){if(i.type!=="file")continue;let o=i.path.split("/").slice(1).join("/");!o||o.split("/").includes("..")||(o==="package.json"?s=i.data:t.writeFile(S(e,o),Es(o,i.data)))}if(!s)throw new Error(`The tarball for ${e} has no package.json.`);t.writeFile(S(e,"package.json"),Es("package.json",s))}function Aa(t,e,r){let n=new Map;for(let i of r.values()){let o=Me(i.location);n.set(o,[...n.get(o)??[],i])}t.rm(S(e,"node_modules/.bin"));let s={};for(let[i,o]of n){let a=S(e,i,"node_modules/.bin"),c=ys(t,a,o.map(l=>({dir:S(e,l.location),name:l.name,bin:qr(t,S(e,l.location,"package.json"))?.bin??l.manifest.bin})));i===""&&(s=c)}return s}function Ze(t){let e=[];for(let r=x(t);;r=T(r))if(r.endsWith("/node_modules")||e.push(S(r,"node_modules/.bin")),r==="/")return e}function Qe(t,e,r,n){if(e.includes("/")){let i=e.startsWith("/")?x(e):S(r,e);return t.isFile(i)?i:void 0}let s=[...(n.PATH??"").split(":").filter(Boolean),...Ze(r)];for(let i of s){let o=S(i.startsWith("/")?i:S(r,i),e);if(t.isFile(o))return o}}function Qs(t,e){let r=Kt(t,e);if(r)return{name:"node",args:[r]};let n=(t.readText(e)??"").split(`
|
|
11
|
+
`,1)[0]??"";return/^#!.*\b(?:sh|bash|jsh|zsh|dash)\b/.test(n)?{name:"jsh",args:[e]}:[".sh",".bash"].includes(ht(e))?{name:"jsh",args:[e]}:{name:"node",args:[e]}}function Ht(t,e,r,n,s,i){if(!r.includes("/")&&Object.prototype.hasOwnProperty.call(e,r))return{name:r,program:e[r],args:n};let o=Qe(t,r,s,i);if(!o)return;let{name:a,args:c}=Qs(t,o),l=e[a];return l?{name:a,program:l,args:[...c,...n]}:void 0}function Wr(t){return Object.assign(new Error(`spawn ${t} ENOENT`),{code:"ENOENT",errno:-2,syscall:`spawn ${t}`,path:t})}var re=class{constructor(){A(this,"buffered",[]);A(this,"listeners",new Set);A(this,"ended",!1);A(this,"draining",!1)}push(e){this.ended||(e===null&&(this.ended=!0),this.buffered.push(e),this.drain())}subscribe(e){return this.listeners.add(e),this.drain(),()=>this.listeners.delete(e)}drain(){this.draining||!this.listeners.size||!this.buffered.length||(this.draining=!0,queueMicrotask(()=>{for(this.draining=!1;this.buffered.length&&this.listeners.size;){let e=this.buffered.shift();for(let r of[...this.listeners])r(e)}}))}readAll(){return new Promise(e=>{let r="",n=this.subscribe(s=>{s===null?(n(),e(r)):r+=s})})}get isEnded(){return this.ended}};var Ue=class{constructor(e){A(this,"options");A(this,"raw",!1);A(this,"line","");this.options=e}input(e){if(this.raw){this.options.deliver(e);return}let r=e.replace(/\x1b\[[0-9;]*[A-Za-z~]|\x1bO[A-Za-z]/g,"");for(let n of r)switch(n){case"\r":case`
|
|
12
|
+
`:this.options.echo(`\r
|
|
13
|
+
`),this.options.deliver(this.line+`
|
|
14
|
+
`),this.line="";break;case"\x7F":case"\b":this.line&&(this.line=[...this.line].slice(0,-1).join(""),this.options.echo("\b \b"));break;case"":this.options.echo(`^C\r
|
|
15
|
+
`),this.line="",this.options.signal("SIGINT");break;case"":this.options.signal("SIGQUIT");break;case"":this.line?(this.options.deliver(this.line),this.line=""):this.options.deliver(null);break;case"":this.options.echo("\b \b".repeat([...this.line].length)),this.line="";break;default:(n>=" "||n===" ")&&(this.line+=n,this.options.echo(n))}}};var ga=1e3;function Is(){return ga++}function Bs(t){let e=new TextDecoder;return r=>{let n=typeof r=="string"?r:e.decode(r,{stream:!0});n&&t(n)}}function zr(t){let e=t.pid??Is(),r=new re,n=new Set,s=new Set,i=new Set,o=new AbortController,a=E=>n.forEach(p=>p(E)),c=E=>s.forEach(p=>p(E)),l=!1,f=()=>{},u=(E="SIGTERM")=>{l||(o.signal.aborted?E==="SIGKILL"&&f(137):o.abort(E))},h=t.terminal?{...t.terminal}:void 0,d=h?new Ue({echo:a,deliver:E=>r.push(E),signal:E=>u(E)}):void 0,g={stdout:Bs(a),stderr:Bs(c),onStdin:E=>r.subscribe(E),terminal:h&&d?{get cols(){return h.cols},get rows(){return h.rows},onResize(E){return i.add(E),()=>i.delete(E)},setRawMode(E){d.raw=E}}:void 0},m=new Promise(E=>{f=p=>{l=!0,E(p)},queueMicrotask(async()=>{let p;try{p=await t.program({args:t.args,cwd:t.cwd,env:t.env,io:g,system:t.system,signal:o.signal})}catch(C){g.stderr(`${C instanceof Error?C.stack??C.message:String(C)}
|
|
16
|
+
`),p=1}l=!0,E(p)})});return{pid:e,onStdout(E){return n.add(E),()=>n.delete(E)},onStderr(E){return s.add(E),()=>s.delete(E)},write(E){d?d.input(E):r.push(E)},closeStdin:()=>r.push(null),kill:u,resize(E,p){h&&(h.cols=E,h.rows=p,i.forEach(C=>C(E,p)))},exit:m}}var ma=new TextEncoder,wa=new TextDecoder;function Gr(t){switch(String(t??"utf8").toLowerCase()){case"utf8":case"utf-8":return"utf8";case"hex":return"hex";case"base64":return"base64";case"base64url":return"base64url";case"latin1":case"binary":return"latin1";case"ascii":return"ascii";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";default:throw new TypeError(`Unknown encoding: ${String(t)}`)}}function ya(t){let e=t.replace(/[^A-Za-z0-9+/\-_]/g,"").replace(/-/g,"+").replace(/_/g,"/"),r=e+"=".repeat((4-e.length%4)%4),n=atob(e.length%4===1?r.slice(0,-3):r),s=new Uint8Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);return s}function Jt(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return e}function Y(t,e){switch(Gr(e)){case"utf8":return ma.encode(t);case"hex":{let r=Math.floor(t.length/2),n=new Uint8Array(r);for(let s=0;s<r;s++){let i=parseInt(t.substr(s*2,2),16);if(Number.isNaN(i))return n.subarray(0,s);n[s]=i}return n}case"base64":case"base64url":return ya(t);case"utf16le":{let r=new Uint8Array(t.length*2);for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);r[n*2]=s&255,r[n*2+1]=s>>8}return r}default:{let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n)&255;return r}}}function Yr(t,e){switch(Gr(e)){case"utf8":return wa.decode(t);case"hex":return Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");case"base64":return btoa(Jt(t));case"base64url":return btoa(Jt(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");case"ascii":return Jt(t.map(r=>r&127));case"utf16le":{let r="";for(let n=0;n+1<t.length;n+=2)r+=String.fromCharCode(t[n]|t[n+1]<<8);return r}default:return Jt(t)}}var Ea=Uint8Array,z=class z extends Ea{constructor(e,r,n){typeof e=="string"?super(Y(e,r)):e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer?super(e,r,n):super(e)}static from(e,r,n){if(typeof e=="string")return new z(Y(e,r));if(e instanceof ArrayBuffer)return new z(e,r,n);if(ArrayBuffer.isView(e))return new z(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e&&e.type==="Buffer"&&Array.isArray(e.data))return new z(e.data);if(e&&typeof e=="object"&&typeof e.length=="number")return new z(e);throw new TypeError("The first argument must be of type string, Buffer, ArrayBuffer, Array, or Array-like Object.")}static alloc(e,r,n){let s=new z(e);return r!==void 0&&r!==0&&s.fill(r,0,e,n),s}static allocUnsafe(e){return new z(e)}static allocUnsafeSlow(e){return new z(e)}static isBuffer(e){return e instanceof z}static isEncoding(e){try{return Gr(e),typeof e=="string"}catch{return!1}}static byteLength(e,r){return typeof e=="string"?Y(e,r).length:e.byteLength}static concat(e,r){let n=r??e.reduce((o,a)=>o+a.length,0),s=z.alloc(n),i=0;for(let o of e){if(i>=n)break;s.set(o.subarray(0,n-i),i),i+=o.length}return s}static compare(e,r){let n=Math.min(e.length,r.length);for(let s=0;s<n;s++)if(e[s]!==r[s])return e[s]<r[s]?-1:1;return Math.sign(e.length-r.length)}get parent(){return this.buffer}toString(e,r=0,n=this.length){return Yr(this.subarray(Math.max(0,r),Math.min(this.length,n)),e)}toLocaleString(){return this.toString()}toJSON(){return{type:"Buffer",data:Array.from(this)}}equals(e){return z.compare(this,e)===0}compare(e,r=0,n=e.length,s=0,i=this.length){return z.compare(this.subarray(s,i),e.subarray(r,n))}copy(e,r=0,n=0,s=this.length){let i=this.subarray(n,Math.min(s,n+(e.length-r)));return e.set(i,r),i.length}slice(e,r){return this.subarray(e,r)}subarray(e,r){let n=super.subarray(e,r);return new z(n.buffer,n.byteOffset,n.length)}write(e,r,n,s){typeof r=="string"?[s,r,n]=[r,0,void 0]:typeof n=="string"&&([s,n]=[n,void 0]);let i=r??0,o=Y(e,s).subarray(0,Math.min(n??1/0,this.length-i));return this.set(o,i),o.length}fill(e,r=0,n=this.length,s){if(typeof r=="string"&&([s,r]=[r,0]),typeof e=="number")return super.fill(e&255,r,n);let i=typeof e=="string"?Y(e,s):e;if(!i.length)return super.fill(0,r,n);for(let o=r,a=0;o<n;o++,a=(a+1)%i.length)this[o]=i[a];return this}indexOf(e,r=0,n){if(typeof e=="number")return super.indexOf(e&255,r);let s=typeof e=="string"?Y(e,n):e,i=r<0?Math.max(0,this.length+r):r;if(!s.length)return Math.min(i,this.length);e:for(let o=i;o<=this.length-s.length;o++){for(let a=0;a<s.length;a++)if(this[o+a]!==s[a])continue e;return o}return-1}lastIndexOf(e,r=this.length,n){if(typeof e=="number")return super.lastIndexOf(e&255,r);let s=typeof e=="string"?Y(e,n):e;e:for(let i=Math.min(r,this.length-s.length);i>=0;i--){for(let o=0;o<s.length;o++)if(this[i+o]!==s[o])continue e;return i}return-1}includes(e,r=0,n){return this.indexOf(e,r,n)!==-1}view(){return new DataView(this.buffer,this.byteOffset,this.byteLength)}readUInt8(e=0){return this.view().getUint8(e)}readUInt16LE(e=0){return this.view().getUint16(e,!0)}readUInt16BE(e=0){return this.view().getUint16(e)}readUInt32LE(e=0){return this.view().getUint32(e,!0)}readUInt32BE(e=0){return this.view().getUint32(e)}readInt8(e=0){return this.view().getInt8(e)}readInt16LE(e=0){return this.view().getInt16(e,!0)}readInt16BE(e=0){return this.view().getInt16(e)}readInt32LE(e=0){return this.view().getInt32(e,!0)}readInt32BE(e=0){return this.view().getInt32(e)}readFloatLE(e=0){return this.view().getFloat32(e,!0)}readFloatBE(e=0){return this.view().getFloat32(e)}readDoubleLE(e=0){return this.view().getFloat64(e,!0)}readDoubleBE(e=0){return this.view().getFloat64(e)}readBigUInt64LE(e=0){return this.view().getBigUint64(e,!0)}readBigUInt64BE(e=0){return this.view().getBigUint64(e)}readBigInt64LE(e=0){return this.view().getBigInt64(e,!0)}readBigInt64BE(e=0){return this.view().getBigInt64(e)}writeUInt8(e,r=0){return this.view().setUint8(r,e),r+1}writeUInt16LE(e,r=0){return this.view().setUint16(r,e,!0),r+2}writeUInt16BE(e,r=0){return this.view().setUint16(r,e),r+2}writeUInt32LE(e,r=0){return this.view().setUint32(r,e,!0),r+4}writeUInt32BE(e,r=0){return this.view().setUint32(r,e),r+4}writeInt8(e,r=0){return this.view().setInt8(r,e),r+1}writeInt16LE(e,r=0){return this.view().setInt16(r,e,!0),r+2}writeInt16BE(e,r=0){return this.view().setInt16(r,e),r+2}writeInt32LE(e,r=0){return this.view().setInt32(r,e,!0),r+4}writeInt32BE(e,r=0){return this.view().setInt32(r,e),r+4}writeFloatLE(e,r=0){return this.view().setFloat32(r,e,!0),r+4}writeFloatBE(e,r=0){return this.view().setFloat32(r,e),r+4}writeDoubleLE(e,r=0){return this.view().setFloat64(r,e,!0),r+8}writeDoubleBE(e,r=0){return this.view().setFloat64(r,e),r+8}writeBigUInt64LE(e,r=0){return this.view().setBigUint64(r,e,!0),r+8}writeBigUInt64BE(e,r=0){return this.view().setBigUint64(r,e),r+8}};A(z,"poolSize",8192);var k=z;for(let t of Object.getOwnPropertyNames(k.prototype)){let e=t.replace(/UInt/,"Uint");e!==t&&Object.defineProperty(k.prototype,e,Object.getOwnPropertyDescriptor(k.prototype,t))}function Ss(){return{Buffer:k,SlowBuffer:k,kMaxLength:2**31-1,constants:{MAX_LENGTH:2**31-1,MAX_STRING_LENGTH:2**29-24},INSPECT_MAX_BYTES:50,Blob:globalThis.Blob,atob:globalThis.atob,btoa:globalThis.btoa}}function ue(t,e){let r=function(...n){return new.target?Reflect.construct(t,n,new.target):(e(this,...n),this)};return Object.defineProperty(r,"name",{value:t.name}),r.prototype=t.prototype,Object.setPrototypeOf(r,t),Object.defineProperty(t.prototype,"constructor",{value:r,writable:!0,configurable:!0,enumerable:!1}),r}var Xe=class Xe{constructor(){xs(this)}static once(e,r){return new Promise((n,s)=>{let i=a=>{e.removeListener(r,o),s(a)},o=(...a)=>{r!=="error"&&e.removeListener("error",i),n(a)};e.once(r,o),r!=="error"&&e.once("error",i)})}static listenerCount(e,r){return e.listenerCount(r)}addListener(e,r){return this._add(e,r,!1)}on(e,r){return this._add(e,r,!1)}prependListener(e,r){return this._add(e,r,!0)}once(e,r){return this._add(e,this._onceWrap(e,r),!1)}prependOnceListener(e,r){return this._add(e,this._onceWrap(e,r),!0)}removeListener(e,r){let n=this._events?.get(e);if(!n)return this;for(let s=n.length-1;s>=0;s--){let i=n[s];if(i===r||i.listener===r){n.splice(s,1),n.length||this._events.delete(e),this._events.has("removeListener")&&this.emit("removeListener",e,r);break}}return this}off(e,r){return this.removeListener(e,r)}removeAllListeners(e){return this._events?(e===void 0?this._events.clear():this._events.delete(e),this):this}emit(e,...r){let n=this._events?.get(e);if(e==="error"&&(this._events?.get(Xe.errorMonitor)?.slice().forEach(s=>s.apply(this,r)),!n?.length)){let s=r[0];if(s instanceof Error)throw s;let i=new Error(`Unhandled error. (${String(s)})`);throw i.context=s,i}if(!n?.length)return!1;for(let s of n.slice())s.apply(this,r);return!0}listeners(e){return(this._events?.get(e)??[]).map(r=>r.listener??r)}rawListeners(e){return[...this._events?.get(e)??[]]}listenerCount(e){return this._events?.get(e)?.length??0}eventNames(){return[...this._events?.keys()??[]]}setMaxListeners(e){return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners??Xe.defaultMaxListeners}_add(e,r,n){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type function');this._events||(this._events=new Map),this._events.has("newListener")&&this.emit("newListener",e,r.listener??r);let s=this._events.get(e)??[];return n?s.unshift(r):s.push(r),this._events.set(e,s),this}_onceWrap(e,r){let n=!1,s=(...i)=>{if(!n)return n=!0,this.removeListener(e,s),r.apply(this,i)};return s.listener=r,s}};A(Xe,"defaultMaxListeners",10),A(Xe,"errorMonitor",Symbol("events.errorMonitor"));var R=Xe;function xs(t){(!t._events||!(t._events instanceof Map))&&(t._events=new Map)}var ks=ue(R,xs);function Ds(){let t=ks;return t.EventEmitter=ks,t.once=R.once,t.defaultMaxListeners=R.defaultMaxListeners,t}function Os(t,e){let r=[];for(let n of t.split("/"))!n||n==="."||(n===".."?r.length&&r[r.length-1]!==".."?r.pop():e&&r.push(".."):r.push(n));return r.join("/")}function Ns(t){let e=n=>{if(typeof n!="string")throw new TypeError(`The "path" argument must be of type string. Received ${typeof n}`)},r={sep:"/",delimiter:":",normalize(n){if(e(n),!n)return".";let s=n.startsWith("/"),i=n.endsWith("/"),o=Os(n,!s);return!o&&!s&&(o="."),o&&i&&(o+="/"),s?"/"+o:o},join(...n){n.forEach(e);let s=n.filter(Boolean).join("/");return s?r.normalize(s):"."},resolve(...n){let s="";for(let o=n.length-1;o>=-1&&!s.startsWith("/");o--){let a=o>=0?n[o]:t();e(a),a&&(s=s?`${a}/${s}`:a)}return"/"+Os(s,!1)},isAbsolute(n){return e(n),n.startsWith("/")},relative(n,s){let i=r.resolve(n).split("/").filter(Boolean),o=r.resolve(s).split("/").filter(Boolean),a=0;for(;a<i.length&&a<o.length&&i[a]===o[a];)a++;return[...i.slice(a).map(()=>".."),...o.slice(a)].join("/")},dirname(n){if(e(n),!n)return".";let s=n.length>1?n.replace(/\/+$/,""):n,i=s.lastIndexOf("/");return i<0?".":i===0?"/":s.slice(0,i)},basename(n,s){e(n);let i=n.length>1?n.replace(/\/+$/,""):n,o=i.slice(i.lastIndexOf("/")+1);return s&&o.endsWith(s)&&o!==s&&(o=o.slice(0,-s.length)),o},extname(n){let s=r.basename(n),i=s.lastIndexOf(".");return i<=0?"":s.slice(i)},parse(n){let s=n.startsWith("/")?"/":"",i=r.basename(n),o=r.extname(n),a=r.dirname(n),c=a==="."&&!n.includes("/")?"":a;return{root:s,dir:c,base:i,ext:o,name:o?i.slice(0,-o.length):i}},format(n){let s=n.dir??n.root??"",i=n.base??`${n.name??""}${n.ext??""}`;return s?s===n.root?`${s}${i}`:`${s}/${i}`:i},toNamespacedPath(n){return n},matchesGlob(n,s){let i=s.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\/?/g,"\0").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]").replace(/\u0000/g,"(?:.*/)?");return new RegExp(`^${i}$`).test(n)}};return r.posix=r,r.win32=r,r}var _s=Symbol.for("nodejs.util.inspect.custom"),ba=/^[A-Za-z_$][\w$]*$/;function Rs(t){let e=t.includes("'")&&!t.includes('"')?'"':"'";return e+t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(new RegExp(e,"g"),"\\"+e)+e}function qt(t){return typeof t=="symbol"?`[${t.toString()}]`:ba.test(t)?t:Rs(t)}function et(t,e,r,n,s){if(!e.length)return`${t}${r}`;let i=`${t} ${e.join(", ")} ${r}`;if(i.length+s.length<=n&&!e.some(a=>a.includes(`
|
|
17
|
+
`)))return i;let o=s+" ";return`${t}
|
|
18
|
+
${e.map(a=>o+a).join(`,
|
|
19
|
+
`)}
|
|
20
|
+
${s}${r}`}function Et(t){let e=Object.getPrototypeOf(t);if(e===null)return"[Object: null prototype]";let r=e?.constructor?.name;return r&&r!=="Object"?r:void 0}function P(t,e={}){let r=e.depth===null?1/0:e.depth??2,n=e.breakLength??80,s=[],i=(o,a,c,l)=>{switch(typeof o){case"string":return l?Rs(o):o;case"number":return Object.is(o,-0)?"-0":String(o);case"bigint":return`${o}n`;case"boolean":return String(o);case"undefined":return"undefined";case"symbol":return o.toString();case"function":{let g=o.name?`: ${o.name}`:" (anonymous)",m=/^class\s/.test(Function.prototype.toString.call(o))?"class":"Function",E=Object.keys(o),p=m==="class"?`[class ${o.name||"(anonymous)"}]`:`[${m}${g}]`;return!E.length||a>r?p:et(`${p} {`,E.map(C=>`${qt(C)}: ${i(o[C],a+1,c+" ",!0)}`),"}",n,c)}}if(o===null)return"null";let f=o,u=f[_s];if(typeof u=="function"){let g=u.call(f,r-a,{...e,stylize:m=>m},P);return typeof g=="string"?g:i(g,a,c,l)}if(s.includes(f))return"[Circular *1]";if(o instanceof Error){let g=o.stack&&o.stack.includes(o.message)?o.stack:`${o.name}: ${o.message}${o.stack?`
|
|
21
|
+
`+o.stack.split(`
|
|
22
|
+
`).slice(1).join(`
|
|
23
|
+
`):""}`,m=Object.keys(o).filter(p=>p!=="stack"&&p!=="message");if(!m.length||a>r)return g;s.push(f);let E=et(`${g} {`,m.map(p=>`${qt(p)}: ${i(f[p],a+1,c+" ",!0)}`),"}",n,c);return s.pop(),E}if(o instanceof Date)return Number.isNaN(o.getTime())?"Invalid Date":o.toISOString();if(o instanceof RegExp)return String(o);if(o instanceof Promise)return"Promise { <pending> }";if(o instanceof WeakMap)return"WeakMap { <items unknown> }";if(o instanceof WeakSet)return"WeakSet { <items unknown> }";if(ArrayBuffer.isView(o)&&!(o instanceof DataView)){let g=o;if(g.constructor.name==="Buffer"){let m=Array.from(g).slice(0,50).map(E=>E.toString(16).padStart(2,"0"));return`<Buffer${m.length?" "+m.join(" "):""}${g.length>50?` ... ${g.length-50} more bytes`:""}>`}return`${g.constructor.name}(${g.length}) [ ${Array.from(g).slice(0,100).join(", ")} ]`}if(a>r)return Array.isArray(o)?"[Array]":`[${Et(f)??"Object"}]`;s.push(f);let h=g=>i(g,a+1,c+" ",!0),d;if(Array.isArray(o)){let g=o.slice(0,100).map(h);o.length>100&&g.push(`... ${o.length-100} more items`);for(let E of Object.keys(o))/^\d+$/.test(E)||g.push(`${qt(E)}: ${h(f[E])}`);let m=Et(f)&&Et(f)!=="Array"?`${Et(f)}(${o.length}) `:"";d=et(`${m}[`,g,"]",n,c)}else if(o instanceof Map)d=et(`Map(${o.size}) {`,[...o].map(([g,m])=>`${h(g)} => ${h(m)}`),"}",n,c);else if(o instanceof Set)d=et(`Set(${o.size}) {`,[...o].map(h),"}",n,c);else{let g=[...Object.keys(f),...Object.getOwnPropertySymbols(f).filter(y=>Object.getOwnPropertyDescriptor(f,y)?.enumerable)];e.sorted&&g.sort();let m=g.map(y=>{let b=Object.getOwnPropertyDescriptor(f,y),w=b&&(b.get||b.set)?b.get&&b.set?"[Getter/Setter]":b.get?"[Getter]":"[Setter]":h(f[y]);return`${qt(y)}: ${w}`}),E=Et(f),p=f[Symbol.toStringTag],C=E?`${E}${p&&p!==E?` [${p}]`:""} `:p?`Object [${p}] `:"";d=m.length||!C?et(`${C}{`,m,"}",n,c):`${C}{}`}return s.pop(),d};return i(t,0,"",!1)}P.custom=_s;P.defaultOptions={depth:2};function Be(...t){let[e,...r]=t;if(typeof e!="string")return t.map(i=>P(i)).join(" ");let n=0,s=e.replace(/%([sdifjoOc%])/g,(i,o)=>{if(o==="%")return"%";if(n>=r.length)return i;let a=r[n++];switch(o){case"s":return typeof a=="string"?a:typeof a=="bigint"?`${a}n`:typeof a=="object"&&a!==null?P(a,{depth:1}):String(a);case"d":return typeof a=="bigint"?`${a}n`:String(Number(a));case"i":return typeof a=="bigint"?`${a}n`:String(parseInt(String(a),10));case"f":return String(parseFloat(String(a)));case"j":try{return JSON.stringify(a)}catch{return"[Circular]"}case"c":return"";default:return P(a,{depth:o==="o"?4:2})}});for(;n<r.length;n++){let i=r[n];s+=" "+(typeof i=="string"?i:P(i))}return s}var Ts=Symbol.for("nodejs.util.promisify.custom");function Ls(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');let e=t[Ts];if(typeof e=="function")return e;function r(...n){return new Promise((s,i)=>{t.call(this,...n,(o,...a)=>{o?i(o):s(a.length>1?a:a[0])})})}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,Object.getOwnPropertyDescriptors(t))}Ls.custom=Ts;function Ca(t,e){if(!e?.prototype)throw new TypeError('The "superCtor.prototype" property must be of type object');t.super_=e,Object.setPrototypeOf(t.prototype,e.prototype)}function ge(t,e,r=new Map){if(Object.is(t,e))return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(r.get(t)===e)return!0;if(r.set(t,e),t instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp)return String(t)===String(e);if(t instanceof Map){let i=e;if(t.size!==i.size)return!1;for(let[o,a]of t)if(!i.has(o)||!ge(a,i.get(o),r))return!1;return!0}if(t instanceof Set){let i=e;if(t.size!==i.size)return!1;for(let o of t)if(!i.has(o)&&![...i].some(a=>ge(o,a,r)))return!1;return!0}if(ArrayBuffer.isView(t)){let i=t,o=e;if(i.length!==o.length)return!1;for(let a=0;a<i.length;a++)if(!Object.is(i[a],o[a]))return!1;return!0}let n=Object.keys(t),s=Object.keys(e);return n.length!==s.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&ge(t[i],e[i],r))}var je=t=>Object.prototype.toString.call(t).slice(8,-1),tt={isPromise:t=>t instanceof Promise,isDate:t=>t instanceof Date,isRegExp:t=>t instanceof RegExp,isMap:t=>t instanceof Map,isSet:t=>t instanceof Set,isWeakMap:t=>t instanceof WeakMap,isWeakSet:t=>t instanceof WeakSet,isNativeError:t=>t instanceof Error,isTypedArray:t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),isUint8Array:t=>t instanceof Uint8Array,isArrayBuffer:t=>t instanceof ArrayBuffer,isAnyArrayBuffer:t=>t instanceof ArrayBuffer||je(t)==="SharedArrayBuffer",isArrayBufferView:t=>ArrayBuffer.isView(t),isDataView:t=>t instanceof DataView,isAsyncFunction:t=>je(t)==="AsyncFunction"||je(t)==="AsyncGeneratorFunction",isGeneratorFunction:t=>je(t)==="GeneratorFunction"||je(t)==="AsyncGeneratorFunction",isGeneratorObject:t=>je(t)==="Generator",isBoxedPrimitive:t=>t instanceof Number||t instanceof String||t instanceof Boolean,isProxy:()=>!1,isExternal:()=>!1,isModuleNamespaceObject:t=>je(t)==="Module"};function $s(t,e){let r=new Set;return{format:Be,formatWithOptions:(n,...s)=>Be(...s),inspect:P,inherits:Ca,promisify:Ls,callbackify(n){return function(...s){let i=s.pop();n.apply(this,s).then(o=>i(null,o),o=>i(o??new Error("Promise was rejected with a falsy value")))}},deprecate(n,s,i){return function(...o){let a=i??s;return r.has(a)||(r.add(a),e(`(node) [${i??"DEP"}] DeprecationWarning: ${s}`)),n.apply(this,o)}},debuglog(n){let s=new RegExp(`\\b${n}\\b`,"i").test(t().NODE_DEBUG??""),i=(...o)=>s&&e(`${n.toUpperCase()}: ${Be(...o)}`);return i.enabled=s,i},isDeepStrictEqual:(n,s)=>ge(n,s),types:tt,TextEncoder,TextDecoder,stripVTControlCharacters:n=>n.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g,""),styleText:(n,s)=>s,toUSVString:n=>n.replace(/[\uD800-\uDFFF]/g,"\uFFFD"),isArray:Array.isArray,isBoolean:n=>typeof n=="boolean",isNull:n=>n===null,isNullOrUndefined:n=>n==null,isNumber:n=>typeof n=="number",isString:n=>typeof n=="string",isSymbol:n=>typeof n=="symbol",isUndefined:n=>n===void 0,isRegExp:tt.isRegExp,isObject:n=>n!==null&&typeof n=="object",isDate:tt.isDate,isError:tt.isNativeError,isFunction:n=>typeof n=="function",isPrimitive:n=>n===null||typeof n!="object"&&typeof n!="function",isBuffer:n=>n?.constructor?.name==="Buffer"}}var he=t=>queueMicrotask(t),Wt=(t,e)=>t.objectMode?1:e.length;function zt(t,e={}){let r=!!(e.objectMode||e.readableObjectMode);t._readableState={objectMode:r,highWaterMark:e.highWaterMark??(r?16:16*1024),buffer:[],length:0,flowing:null,ended:!1,endEmitted:!1,reading:!1,destroyed:!1,closed:!1,errored:null,encoding:e.encoding??null,autoDestroy:e.autoDestroy??!0,emitClose:e.emitClose??!0,flowScheduled:!1,pipes:[]},typeof e.read=="function"&&(t._read=e.read),typeof e.destroy=="function"&&(t._destroy=e.destroy),e.signal?.addEventListener("abort",()=>t.destroy(new Error("The operation was aborted")))}var V=class t extends R{constructor(e){super(),zt(this,e)}static from(e,r={}){if(typeof e=="string"||e instanceof Uint8Array){let i=new t({objectMode:!1,...r,read(){}});return i.push(e),i.push(null),i}let n=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator](),s=!1;return new t({objectMode:!0,...r,async read(){if(!s){s=!0;try{for(;;){let{value:i,done:o}=await n.next();if(o){this.push(null);break}if(!this.push(await i))break}}catch(i){this.destroy(i)}finally{s=!1}}}})}get readable(){let e=this._readableState;return!!e&&!e.destroyed&&!e.endEmitted&&!e.errored}set readable(e){}get readableEnded(){return this._readableState.endEmitted}get readableFlowing(){return this._readableState.flowing}get readableLength(){return this._readableState.length}get readableHighWaterMark(){return this._readableState.highWaterMark}get readableObjectMode(){return this._readableState.objectMode}get readableEncoding(){return this._readableState.encoding}get destroyed(){return this._readableState.destroyed}set destroyed(e){this._readableState.destroyed=e}get closed(){return this._readableState.closed}get errored(){return this._readableState.errored}_read(e){throw new Error("The _read() method is not implemented")}_destroy(e,r){r(e)}push(e,r){let n=this._readableState;if(n.reading=!1,e===null)return n.ended=!0,this._scheduleFlow(),!1;if(n.ended||n.destroyed)return!1;let s=e;return!n.objectMode&&(typeof s=="string"?s=n.encoding?s:k.from(s,r):s instanceof Uint8Array&&!(s instanceof k)&&(s=k.from(s.buffer,s.byteOffset,s.byteLength)),n.encoding&&s instanceof Uint8Array&&(s=s.toString(n.encoding)),s.length===0)||(n.buffer.push(s),n.length+=Wt(n,s),this._scheduleFlow()),n.length<n.highWaterMark}unshift(e){let r=this._readableState;r.buffer.unshift(e),r.length+=Wt(r,e)}read(e){let r=this._readableState;if(!r.buffer.length)return r.ended?this._scheduleFlow():this._pull(),null;let n;if(r.objectMode)n=r.buffer.shift();else if(e===void 0||e>=r.length){if(e!==void 0&&e>r.length&&!r.ended)return this._pull(),null;n=r.encoding?r.buffer.join(""):r.buffer.length===1?r.buffer[0]:k.concat(r.buffer),r.buffer=[]}else{let s=r.encoding?r.buffer.join(""):k.concat(r.buffer);n=s.slice(0,e),r.buffer=[s.slice(e)]}return r.length-=Wt(r,n),r.length<r.highWaterMark&&this._pull(),r.ended&&!r.buffer.length&&this._scheduleFlow(),n}setEncoding(e){let r=this._readableState;return r.encoding=e,r.buffer=r.buffer.map(n=>n instanceof Uint8Array?n.toString(e):n),this}on(e,r){super.on(e,r);let n=this._readableState;return e==="data"&&n.flowing!==!1&&this.resume(),e==="readable"&&(n.flowing=!1,this._scheduleFlow()),this}addListener(e,r){return this.on(e,r)}resume(){return this._readableState.flowing=!0,this._scheduleFlow(),this}pause(){return this._readableState.flowing=!1,this}isPaused(){return this._readableState.flowing===!1}pipe(e,r={}){this._readableState.pipes.push(e);let s=i=>{e.write(i)===!1&&(this.pause(),(e.once??e.on)?.call(e,"drain",()=>this.resume()))};return this.on("data",s),r.end!==!1&&this.once("end",()=>e.end()),e.emit?.("pipe",this),this.resume(),e}unpipe(e){let r=this._readableState;return r.pipes=e?r.pipes.filter(n=>n!==e):[],r.pipes.length||this.removeAllListeners("data"),this}destroy(e){let r=this._readableState;return r.destroyed?this:(r.destroyed=!0,e&&(r.errored=e),this._destroy(e??null,n=>{he(()=>{n&&this.emit("error",n),r.closed=!0,r.emitClose&&this.emit("close")})}),this)}async*[Symbol.asyncIterator](){let e=this._readableState,r,n,s=()=>{r?.(),r=void 0};this.on("readable",s),this.on("end",s),this.on("close",s),this.on("error",i=>{n=i,s()});try{for(;;){if(n)throw n;let i=this.read();if(i!==null){yield i;continue}if(e.endEmitted||e.ended&&!e.length||e.destroyed){if(n)throw n;return}await new Promise(o=>r=o)}}finally{e.endEmitted||this.destroy()}}_pull(){let e=this._readableState;if(!(e.reading||e.ended||e.destroyed)){e.reading=!0;try{this._read(e.highWaterMark)}catch(r){this.destroy(r)}}}_scheduleFlow(){let e=this._readableState;e.flowScheduled||(e.flowScheduled=!0,he(()=>{e.flowScheduled=!1,this._flow()}))}_flow(){let e=this._readableState;if(!e.destroyed){for(e.flowing===!1&&e.buffer.length&&this.emit("readable");e.flowing===!0&&e.buffer.length;){let r=e.buffer.shift();e.length-=Wt(e,r),this.emit("data",r)}if(e.ended&&!e.buffer.length){if(!e.endEmitted&&(e.flowing!==null||this.listenerCount("end")||this.listenerCount("readable"))){e.flowing===!1&&this.emit("readable"),e.endEmitted=!0,this.emit("end");let r=this._writableState;e.autoDestroy&&(!r||r.finished)&&this.destroy()}return}e.flowing&&e.length<e.highWaterMark&&this._pull()}}};function Gt(t,e={}){let r=!!(e.objectMode||e.writableObjectMode);t._writableState={objectMode:r,highWaterMark:e.highWaterMark??(r?16:16*1024),decodeStrings:e.decodeStrings!==!1,defaultEncoding:e.defaultEncoding??"utf8",queue:[],length:0,writing:!1,corked:0,needDrain:!1,ending:!1,ended:!1,finalCalled:!1,finished:!1,destroyed:!1,closed:!1,errored:null,autoDestroy:e.autoDestroy??!0,emitClose:e.emitClose??!0},typeof e.write=="function"&&(t._write=e.write),typeof e.writev=="function"&&(t._writev=e.writev),typeof e.final=="function"&&(t._final=e.final),typeof e.destroy=="function"&&(t._destroy=e.destroy)}var Z=class extends R{constructor(e){super(),Gt(this,e)}get writable(){let e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&!e.errored}set writable(e){}get writableEnded(){return this._writableState.ending}get writableFinished(){return this._writableState.finished}get writableLength(){return this._writableState.length}get writableHighWaterMark(){return this._writableState.highWaterMark}get writableObjectMode(){return this._writableState.objectMode}get writableCorked(){return this._writableState.corked}get writableNeedDrain(){return this._writableState.needDrain}get destroyed(){return this._writableState.destroyed}set destroyed(e){this._writableState.destroyed=e}_write(e,r,n){if(this._writev)this._writev([{chunk:e,encoding:r}],n);else throw new Error("The _write() method is not implemented")}_destroy(e,r){r(e)}write(e,r,n){typeof r=="function"&&([n,r]=[r,void 0]);let s=this._writableState;if(s.ending||s.destroyed){let c=Object.assign(new Error(s.destroyed?"Cannot call write after a stream was destroyed":"write after end"),{code:s.destroyed?"ERR_STREAM_DESTROYED":"ERR_STREAM_WRITE_AFTER_END"});return he(()=>{n?.(c),this.emit("error",c)}),!1}let i=e,o=r??s.defaultEncoding;if(!s.objectMode){if(typeof i=="string"&&s.decodeStrings)i=k.from(i,o),o="buffer";else if(i instanceof Uint8Array)i instanceof k||(i=k.from(i.buffer,i.byteOffset,i.byteLength)),o="buffer";else if(typeof i!="string")throw new TypeError('The "chunk" argument must be of type string or an instance of Buffer or Uint8Array')}s.length+=s.objectMode?1:i.length,s.queue.push({chunk:i,encoding:o,callback:n});let a=s.length<s.highWaterMark;return a||(s.needDrain=!0),s.corked||this._drainQueue(),a}end(e,r,n){typeof e=="function"?[n,e]=[e,void 0]:typeof r=="function"&&([n,r]=[r,void 0]);let s=this._writableState;return e!=null&&this.write(e,r),n&&(s.finished?he(()=>n()):this.once("finish",()=>n())),s.ending?this:(s.ending=!0,s.corked=0,this._drainQueue(),this)}cork(){this._writableState.corked++}uncork(){let e=this._writableState;e.corked&&e.corked--,e.corked||this._drainQueue()}setDefaultEncoding(e){return this._writableState.defaultEncoding=e,this}destroy(e){let r=this._writableState;return r.destroyed?this:(r.destroyed=!0,e&&(r.errored=e),this._destroy(e??null,n=>{he(()=>{n&&this.emit("error",n),r.closed=!0,r.emitClose&&this.emit("close")})}),this)}_drainQueue(){let e=this._writableState;if(e.writing||e.destroyed)return;let r=e.queue.shift();if(!r){e.ending&&this._finishMaybe();return}e.writing=!0;let n=!0,s=i=>{let o=()=>{if(e.writing=!1,e.length-=e.objectMode?1:r.chunk.length,r.callback?.(i??null),i){e.errored=i,this.destroy(i);return}e.needDrain&&e.length===0&&(e.needDrain=!1,this.emit("drain")),this._drainQueue()};n?he(o):o()};try{this._write(r.chunk,r.encoding,s)}catch(i){s(i)}n=!1}_finishMaybe(){let e=this._writableState;if(e.finished||e.finalCalled||e.writing||e.queue.length)return;e.finalCalled=!0,e.ended=!0;let r=n=>{if(n){this.destroy(n);return}e.finished=!0,this.emit("finish");let s=this._readableState;e.autoDestroy&&(!s||s.endEmitted)&&this.destroy()};this._final?this._final(n=>he(()=>r(n))):he(()=>r())}};var bt=class extends R{pipe(e){return this.on("data",r=>e.write(r)),this.on("end",()=>e.end()),e}};Object.setPrototypeOf(V.prototype,bt.prototype);Object.setPrototypeOf(Z.prototype,bt.prototype);function en(t,e={}){zt(t,e),Gt(t,e),t.allowHalfOpen=e.allowHalfOpen!==!1,t.allowHalfOpen||t.once("end",()=>t.end())}var Pe=class extends V{constructor(e){super(e),en(this,e)}destroy(e){let r=this._writableState;return r&&(r.destroyed=!0),super.destroy(e)}};for(let t of Object.getOwnPropertyNames(Z.prototype))t==="constructor"||t==="destroy"||t==="destroyed"||t==="_destroy"||t in Pe.prototype&&Object.getOwnPropertyDescriptor(Pe.prototype,t)||Object.defineProperty(Pe.prototype,t,Object.getOwnPropertyDescriptor(Z.prototype,t));function Vr(t,e={}){en(t,e),typeof e.transform=="function"&&(t._transform=e.transform),typeof e.flush=="function"&&(t._flush=e.flush)}var _e=class extends Pe{constructor(e){super(e),Vr(this,e)}_transform(e,r,n){throw new Error("The _transform() method is not implemented")}_read(){}_write(e,r,n){this._transform(e,r,(s,i)=>{if(s)return n(s);i!=null&&this.push(i),n()})}_final(e){let r=(n,s)=>{if(n)return e(n);s!=null&&this.push(s),this.push(null),e()};this._flush?this._flush(r):r()}},Zr=class extends _e{_transform(e,r,n){n(null,e)}};function Xr(t,e,r){let n=typeof e=="function"?e:r,s=!1,i=u=>{s||(s=!0,f(),n(u??null))},o=u=>i(u),a=()=>i(),c=()=>{let u=t._readableState,h=t._writableState;u&&!u.endEmitted||h&&!h.finished?i(Object.assign(new Error("Premature close"),{code:"ERR_STREAM_PREMATURE_CLOSE"})):i()},l=!!t._writableState&&!t._readableState;t.on("error",o),t.on(l?"finish":"end",a),t._readableState&&t._writableState&&t.on("finish",()=>t._readableState.endEmitted&&i()),t.on("close",c);let f=()=>{t.removeListener("error",o),t.removeListener("end",a),t.removeListener("finish",a),t.removeListener("close",c)};return(t._readableState?.endEmitted&&!t._writableState||l&&t._writableState.finished)&&he(()=>i()),f}function Ms(...t){let e=typeof t[t.length-1]=="function"?t.pop():void 0,r=Array.isArray(t[0])?t[0]:t;if(r.length<2)throw new Error("pipeline requires at least two streams");let n=!1,s=o=>{if(!n){n=!0;for(let a of r)a.destroy?.(o);e?.(o)}};for(let o=0;o<r.length-1;o++)r[o].pipe(r[o+1]);r.forEach((o,a)=>{a<r.length-1&&o.on("error",s)});let i=r[r.length-1];return Xr(i,o=>{o?s(o):n||e?.(null)}),i}function Fs(){let t=ue(bt,()=>{}),e={Readable:ue(V,(n,s)=>zt(n,s)),Writable:ue(Z,(n,s)=>Gt(n,s)),Duplex:ue(Pe,(n,s)=>en(n,s)),Transform:ue(_e,(n,s)=>Vr(n,s)),PassThrough:ue(Zr,(n,s)=>Vr(n,s))};return Object.assign(t,e,{Stream:t,pipeline:Ms,finished:Xr,promises:{pipeline:(...n)=>new Promise((s,i)=>Ms(...n,o=>o?i(o):s())),finished:n=>new Promise((s,i)=>Xr(n,o=>o?i(o):s()))},addAbortSignal:(n,s)=>s,isReadable:n=>!!n?.readable,isErrored:n=>!!n?._readableState?.errored,isDisturbed:n=>!!n?._readableState?.endEmitted||(n?._readableState?.flowing??null)!==null,getDefaultHighWaterMark:n=>n?16:16*1024,setDefaultHighWaterMark:()=>{}}),t}var va={ENOENT:[-2,"no such file or directory"],EEXIST:[-17,"file already exists"],EISDIR:[-21,"illegal operation on a directory"],ENOTDIR:[-20,"not a directory"],ENOTEMPTY:[-39,"directory not empty"],EBADF:[-9,"bad file descriptor"],EINVAL:[-22,"invalid argument"],EPERM:[-1,"operation not permitted"],EACCES:[-13,"permission denied"],ENOSYS:[-38,"function not implemented"]};function D(t,e,r,n){let[s,i]=va[t]??[-1,t.toLowerCase()],o=r===void 0?"":n===void 0?` '${r}'`:` '${r}' -> '${n}'`,a=new Error(`${t}: ${i}, ${e}${o}`);return a.code=t,a.errno=s,a.syscall=e,r!==void 0&&(a.path=r),n!==void 0&&(a.dest=n),a}function Qa(t){let e=5381;for(let r=0;r<t.length;r++)e=(e*33^t.charCodeAt(r))>>>0;return e}var tn=32768,rn=16384,Ie=class{constructor(e,r,n,s){A(this,"dev",2049);A(this,"ino");A(this,"mode");A(this,"nlink",1);A(this,"uid",1e3);A(this,"gid",1e3);A(this,"rdev",0);A(this,"size");A(this,"blksize",4096);A(this,"blocks");A(this,"atimeMs");A(this,"mtimeMs");A(this,"ctimeMs");A(this,"birthtimeMs");A(this,"atime");A(this,"mtime");A(this,"ctime");A(this,"birthtime");this.ino=Qa(e),this.mode=r==="file"?tn|420:rn|493,this.size=n,this.blocks=Math.ceil(n/512),this.atimeMs=this.mtimeMs=this.ctimeMs=this.birthtimeMs=s,this.atime=new Date(s),this.mtime=new Date(s),this.ctime=new Date(s),this.birthtime=new Date(s)}isFile(){return(this.mode&61440)===tn}isDirectory(){return(this.mode&61440)===rn}isSymbolicLink(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}isSocket(){return!1}},rt=class{constructor(e,r,n){A(this,"name");A(this,"parentPath");A(this,"kind");this.name=e,this.parentPath=r,this.kind=n}get path(){return this.parentPath}isFile(){return this.kind==="file"}isDirectory(){return this.kind==="directory"}isSymbolicLink(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}isSocket(){return!1}},me={F_OK:0,R_OK:4,W_OK:2,X_OK:1,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOFOLLOW:131072,O_SYNC:1052672,O_DSYNC:4096,O_NONBLOCK:2048,S_IFMT:61440,S_IFREG:tn,S_IFDIR:rn,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,UV_FS_COPYFILE_EXCL:1};var Yt=t=>typeof t=="string"?t:t?.encoding;function Us(t){let{vfs:e}=t,r=new Map,n=20,s=y=>{if(y instanceof URL){if(y.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return x(decodeURIComponent(y.pathname))}let b=typeof y=="string"?y:new TextDecoder().decode(y);if(typeof b!="string")throw new TypeError('The "path" argument must be of type string, Buffer or URL');return b.startsWith("file://")?x(decodeURIComponent(new URL(b).pathname)):b.startsWith("/")?x(b):S(t.cwd(),b)},i=y=>{let b=e.readFile(y);return typeof b=="string"?Y(b):b},o=(y,b)=>{let w=T(y);if(e.isFile(w))throw D("ENOTDIR",b,y);if(!e.isDirectory(w))throw D("ENOENT",b,y)},a=(y,b)=>typeof y=="string"?!b||/^utf-?8$/i.test(b)?y:Y(y,b).slice():new Uint8Array(y.buffer,y.byteOffset,y.byteLength).slice(),c=(y,b)=>{let w=s(y);if(e.isFile(w))return new Ie(w,"file",i(w).length,e.mtime(w)??Date.now());if(e.isDirectory(w))return new Ie(w,"directory",4096,0);if(b?.throwIfNoEntry!==!1)throw D("ENOENT","stat",w)},l=(y,b,w)=>{if(typeof y=="number")return f(y,b);let v=s(y),B=typeof w=="object"&&w?w.flag??"w":"w";if(e.isDirectory(v))throw D("EISDIR","open",v);if(o(v,"open"),B.includes("x")&&e.isFile(v))throw D("EEXIST","open",v);if(B.startsWith("a")&&e.isFile(v)){let Q=e.readFile(v),I=a(b,Yt(w));e.writeFile(v,typeof Q=="string"&&typeof I=="string"?Q+I:k.concat([typeof Q=="string"?Y(Q):Q,typeof I=="string"?Y(I):I]));return}e.writeFile(v,a(b,Yt(w)))},f=(y,b,w,v,B)=>{let Q=typeof b=="string"?Y(b,typeof w=="string"?w:void 0):new Uint8Array(b.buffer,b.byteOffset+(typeof w=="number"?w:0),v??b.byteLength-(typeof w=="number"?w:0));if(y===1||y===2)return(y===1?t.stdout:t.stderr)(Q.slice()),Q.length;let I=r.get(y);if(!I||I.flags==="r")throw D("EBADF","write");let N=e.isFile(I.path)?i(I.path):new Uint8Array,L=I.flags.startsWith("a")?N.length:B??I.position,M=new Uint8Array(Math.max(N.length,L+Q.length));return M.set(N),M.set(Q,L),e.writeFile(I.path,M),B==null&&(I.position=L+Q.length),Q.length},u=(y,b,w="")=>{let v=[];for(let B of e.readdir(y)){let Q=S(y,B),I=e.isDirectory(Q)?"directory":"file";v.push({name:w+B,parent:y,kind:I}),b&&I==="directory"&&v.push(...u(Q,!0,`${w}${B}/`))}return v},h=(y,b)=>{let w=s(y),v=typeof b=="object"&&!!b?.recursive;if(e.isFile(w))throw D("EEXIST","mkdir",w);if(e.isDirectory(w)){if(v)return;throw D("EEXIST","mkdir",w)}v||o(w,"mkdir");let B;for(let Q=w;!e.isDirectory(Q);Q=T(Q)){if(e.isFile(Q))throw D("ENOTDIR","mkdir",w);B=Q}return e.mkdir(w),v?B:void 0},d=(y,b)=>{let w=s(y);if(!e.exists(w)){if(b?.force)return;throw D("ENOENT","rm",w)}if(e.isDirectory(w)&&!b?.recursive)throw Object.assign(D("EISDIR","rm",w),{code:"ERR_FS_EISDIR"});e.rm(w)},g=(y,b,w=0)=>{let v=s(y),B=s(b);if(!e.isFile(v))throw D(e.isDirectory(v)?"EISDIR":"ENOENT","copyfile",v,B);if(w&me.COPYFILE_EXCL&&e.exists(B))throw D("EEXIST","copyfile",v,B);o(B,"copyfile");let Q=e.readFile(v);e.writeFile(B,typeof Q=="string"?Q:Q.slice())},m=(y,b)=>{if(e.isFile(y)){let w=e.readFile(y);e.writeFile(b,typeof w=="string"?w:w.slice());return}e.mkdir(b);for(let w of e.readdir(y))m(S(y,w),S(b,w))},E=(y,b="r")=>{let w=s(y),v=typeof b=="number"?b&me.O_APPEND?"a":b&(me.O_WRONLY|me.O_RDWR)?"w":"r":b;if(e.isDirectory(w)&&v!=="r")throw D("EISDIR","open",w);if(v.startsWith("r")){if(!e.exists(w))throw D("ENOENT","open",w)}else{if(v.includes("x")&&e.exists(w))throw D("EEXIST","open",w);o(w,"open"),(v.startsWith("w")||!e.isFile(w))&&e.writeFile(w,"")}let B=n++;return r.set(B,{path:w,flags:v,position:0}),B},p=(y,b)=>{let w=r.get(y);if(!w)throw D("EBADF",b);return w},C={existsSync:y=>{try{return e.exists(s(y))}catch{return!1}},accessSync(y){let b=s(y);if(!e.exists(b))throw D("ENOENT","access",b)},statSync:c,lstatSync:c,fstatSync:y=>c(p(y,"fstat").path),readFileSync(y,b){if(y===0)return k.alloc(0);let w=typeof y=="number"?p(y,"read").path:s(y);if(e.isDirectory(w))throw D("EISDIR","read",w);let v=e.readFile(w);if(v===void 0)throw D("ENOENT","open",w);let B=Yt(b);return B?typeof v=="string"&&/^utf-?8$/i.test(B)?v:k.from(typeof v=="string"?Y(v):v).toString(B):k.from(typeof v=="string"?Y(v):v)},writeFileSync:l,appendFileSync:(y,b,w)=>l(y,b,{...typeof w=="string"?{encoding:w}:w??{},flag:"a"}),mkdirSync:h,mkdtempSync(y){let b=`${y}${Math.random().toString(36).slice(2,8)}`;return h(b),s(b)},readdirSync(y,b){let w=s(y);if(e.isFile(w))throw D("ENOTDIR","scandir",w);if(!e.isDirectory(w))throw D("ENOENT","scandir",w);let v=typeof b=="object"?b:void 0,B=u(w,!!v?.recursive);return v?.withFileTypes?B.map(Q=>new rt(Q.name.slice(Q.name.lastIndexOf("/")+1),Q.name.includes("/")?S(w,Q.name,".."):Q.parent,Q.kind)):B.map(Q=>Yt(b)==="buffer"?k.from(Q.name):Q.name)},rmSync:d,rmdirSync(y,b){let w=s(y);if(e.isFile(w))throw D("ENOTDIR","rmdir",w);if(!e.isDirectory(w))throw D("ENOENT","rmdir",w);if(e.readdir(w).length&&!b?.recursive)throw D("ENOTEMPTY","rmdir",w);e.rm(w)},unlinkSync(y){let b=s(y);if(e.isDirectory(b))throw D("EISDIR","unlink",b);if(!e.isFile(b))throw D("ENOENT","unlink",b);e.rm(b)},renameSync(y,b){let w=s(y),v=s(b);if(!e.exists(w))throw D("ENOENT","rename",w,v);if(w!==v){if(e.isDirectory(v)&&e.isFile(w))throw D("EISDIR","rename",w,v);if(o(v,"rename"),e.isFile(v)&&e.isDirectory(w))throw D("ENOTDIR","rename",w,v);e.rm(v),m(w,v),e.rm(w)}},copyFileSync:g,cpSync(y,b,w){let v=s(y);if(e.isDirectory(v)&&!w?.recursive)throw Object.assign(D("EISDIR","cp",v),{code:"ERR_FS_EISDIR"});if(!e.exists(v))throw D("ENOENT","cp",v);m(v,s(b))},realpathSync:Object.assign(y=>{let b=s(y);if(!e.exists(b))throw D("ENOENT","realpath",b);return b},{native:y=>C.realpathSync(y)}),readlinkSync:y=>{throw D("EINVAL","readlink",s(y))},symlinkSync(y,b){let w=s(b),v=typeof y=="string"&&!y.startsWith("/")?S(T(w),y):s(y);m(v,w)},linkSync:(y,b)=>g(y,b),truncateSync(y,b=0){let w=s(y);if(!e.isFile(w))throw D("ENOENT","open",w);let v=i(w),B=new Uint8Array(b);B.set(v.subarray(0,b)),e.writeFile(w,B)},chmodSync:y=>void C.accessSync(y),lchmodSync:y=>void C.accessSync(y),chownSync:y=>void C.accessSync(y),lchownSync:y=>void C.accessSync(y),utimesSync:y=>void C.accessSync(y),lutimesSync:y=>void C.accessSync(y),fchmodSync:y=>void p(y,"fchmod"),fchownSync:y=>void p(y,"fchown"),futimesSync:y=>void p(y,"futimes"),fsyncSync:y=>void p(y,"fsync"),fdatasyncSync:y=>void p(y,"fdatasync"),ftruncateSync:(y,b=0)=>C.truncateSync(p(y,"ftruncate").path,b),openSync:E,closeSync(y){y>2&&p(y,"close"),r.delete(y)},readSync(y,b,w,v,B){let Q=typeof w=="object"?w:{offset:w,length:v,position:B},I=p(y,"read"),N=i(I.path),L=new Uint8Array(b.buffer,b.byteOffset,b.byteLength),M=Q.offset??0,ce=Q.position??I.position,J=N.subarray(ce,ce+Math.min(Q.length??L.length-M,L.length-M));return L.set(J,M),(Q.position===void 0||Q.position===null)&&(I.position=ce+J.length),J.length},writeSync:f,opendirSync(y){let b=s(y),w=C.readdirSync(b,{withFileTypes:!0}),v=0;return{path:b,readSync:()=>w[v++]??null,read:async()=>w[v++]??null,closeSync:()=>{},close:async()=>{},async*[Symbol.asyncIterator](){for(;v<w.length;)yield w[v++]}}},_resolve:s};return C}var Ba=64*1024;function Ia(t){return typeof t[t.length-1]=="function"?t.pop():void 0}function js(t){let e=Us(t),r=(d,g=m=>[m])=>(...m)=>{let E=Ia(m);queueMicrotask(()=>{let p;try{p=d(...m)}catch(C){E?.(C);return}E?.(null,...g(p,m))})},n=d=>async(...g)=>d(...g);class s extends V{constructor(m,E={}){let p=typeof E=="string"?{encoding:E}:E;super({highWaterMark:p.highWaterMark??Ba,encoding:p.encoding});A(this,"bytesRead",0);A(this,"path");A(this,"fd",null);A(this,"pending",!0);A(this,"data");A(this,"offset");A(this,"endAt");this.path=typeof E=="object"&&p.fd!==void 0?"":e._resolve(m),this.offset=p.start??0,this.endAt=p.end??1/0,queueMicrotask(()=>{try{let C=e.readFileSync(this.path);this.data=C,this.fd=-1,this.pending=!1,this.emit("open",this.fd),this.emit("ready"),this._pull()}catch(C){this.destroy(C)}})}_read(){if(!this.data){this._readableState.reading=!1;return}let m=Math.min(this.data.length,this.endAt+1);if(this.offset>=m){this.push(null);return}let E=this.data.subarray(this.offset,Math.min(m,this.offset+this._readableState.highWaterMark));this.offset+=E.length,this.bytesRead+=E.length,this.push(k.from(E))}close(m){this.destroy(),m&&this.once("close",m)}}class i extends Z{constructor(m,E={}){super({decodeStrings:!0});A(this,"options");A(this,"bytesWritten",0);A(this,"path");A(this,"pending",!1);A(this,"started",!1);this.options=E,this.path=e._resolve(m),queueMicrotask(()=>{try{this.open(),this.emit("open",-1),this.emit("ready")}catch(p){this.destroy(p)}})}open(){if(this.started)return;this.started=!0;let m=typeof this.options=="object"?this.options.flags??"w":"w";(!m.startsWith("a")||!t.vfs.isFile(this.path))&&e.writeFileSync(this.path,"",{flag:m.includes("x")?"wx":"w"})}_write(m,E,p){try{this.open(),e.appendFileSync(this.path,m),this.bytesWritten+=m.length,p()}catch(C){p(C)}}close(m){this.end(),m&&this.once("close",m)}}class o extends R{constructor(m,E,p){super();A(this,"release");A(this,"unwatch");let C=x(m);p&&this.on("change",p),this.release=t.hold(),this.unwatch=t.vfs.watch(y=>{let b=y.path;if(!(b===C||b.startsWith(C==="/"?"/":C+"/")))return;let v=b===C?b.slice(b.lastIndexOf("/")+1):b.slice(C.length+(C==="/"?0:1));!E&&v.includes("/")||this.emit("change",y.type==="write"&&!y.created?"change":"rename",v)})}close(){this.unwatch(),this.release(),this.emit("close")}ref(){return this}unref(){return this}}let a=(d,g,m)=>{typeof g=="function"&&([m,g]=[g,void 0]);let E=e._resolve(d);if(!t.vfs.exists(E))throw e.statSync(E);return new o(E,typeof g=="object"&&!!g?.recursive,m)},c=new Map,l=(d,g,m)=>{let E=typeof g=="function"?g:m,p=e._resolve(d),C=c.get(p);if(!C){let y=new o(p,!1),b={watcher:y,listeners:[]},w=e.statSync(p,{throwIfNoEntry:!1})??new Ie(p,"file",0,0);y.on("change",()=>{let v=e.statSync(p,{throwIfNoEntry:!1})??new Ie(p,"file",0,0);for(let B of b.listeners)B(v,w);w=v}),c.set(p,C=b)}return C.listeners.push(E),C.watcher},f=(d,g)=>{let m=e._resolve(d),E=c.get(m);E&&(E.listeners=g?E.listeners.filter(p=>p!==g):[],E.listeners.length||(E.watcher.close(),c.delete(m)))},u={...e,constants:me,Stats:Ie,Dirent:rt,ReadStream:s,WriteStream:i,FSWatcher:o,F_OK:0,R_OK:4,W_OK:2,X_OK:1};delete u._resolve;for(let d of Object.keys(e)){if(!d.endsWith("Sync"))continue;let g=d.slice(0,-4),m=e[d];g==="exists"?u.exists=(E,p)=>queueMicrotask(()=>p(e.existsSync(E))):g==="read"?u.read=r(m,(E,p)=>[E,p[1]]):g==="write"?u.write=r(m,(E,p)=>[E,p[1]]):u[g]=r(m)}u.realpath.native=u.realpath,u.createReadStream=(d,g)=>new s(d,g),u.createWriteStream=(d,g)=>new i(d,g),u.watch=a,u.watchFile=l,u.unwatchFile=f;let h={constants:me};for(let d of Object.keys(e))!d.endsWith("Sync")||d==="existsSync"||(h[d.slice(0,-4)]=n(e[d]));return h.open=async(d,g)=>Sa(e,e.openSync(d,g),e._resolve(d)),h.watch=(d,g)=>ka(a(d,g),g?.signal),u.promises=h,u}function Sa(t,e,r){return{fd:e,readFile:async n=>t.readFileSync(e,n),writeFile:async n=>void t.writeFileSync(r,n),appendFile:async n=>void t.appendFileSync(r,n),read:async(n,s,i,o)=>({bytesRead:t.readSync(e,n,s,i,o),buffer:n}),write:async(n,...s)=>({bytesWritten:t.writeSync(e,n,...s),buffer:n}),stat:async()=>t.fstatSync(e),truncate:async n=>t.ftruncateSync(e,n),sync:async()=>{},datasync:async()=>{},chmod:async()=>{},close:async()=>t.closeSync(e)}}async function*ka(t,e){let r=[],n;t.on("change",(s,i)=>{r.push({eventType:s,filename:i}),n?.()}),e?.addEventListener("abort",()=>n?.());try{for(;!e?.aborted;)r.length?yield r.shift():await new Promise(s=>n=s)}finally{t.close()}}var Vt=(t,e)=>t<<e|t>>>32-e,we=(t,e)=>t>>>e|t<<32-e;function Zt(t,e,r,n){let s=t.length*8,i=Math.ceil((t.length+1+r)/e)*e,o=new Uint8Array(i);o.set(t),o[t.length]=128;let a=new DataView(o.buffer),c=Math.floor(s/2**32),l=s>>>0;return n?(a.setUint32(i-8,l,!0),a.setUint32(i-4,c,!0)):(a.setUint32(i-4,l),a.setUint32(i-8,c)),o}var xa=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],Da=Array.from({length:64},(t,e)=>Math.floor(Math.abs(Math.sin(e+1))*2**32)>>>0);function Oa(t){let e=Zt(t,64,8,!0),r=new DataView(e.buffer),n=1732584193,s=4023233417,i=2562383102,o=271733878;for(let c=0;c<e.length;c+=64){let l=n,f=s,u=i,h=o;for(let d=0;d<64;d++){let g,m;d<16?[g,m]=[f&u|~f&h,d]:d<32?[g,m]=[h&f|~h&u,(5*d+1)%16]:d<48?[g,m]=[f^u^h,(3*d+5)%16]:[g,m]=[u^(f|~h),7*d%16];let E=h;h=u,u=f,f=f+Vt(l+g+Da[d]+r.getUint32(c+m*4,!0)|0,xa[(d>>4)*4+d%4])|0,l=E}n=n+l|0,s=s+f|0,i=i+u|0,o=o+h|0}let a=new DataView(new ArrayBuffer(16));return[n,s,i,o].forEach((c,l)=>a.setUint32(l*4,c,!0)),new Uint8Array(a.buffer)}function Na(t){let e=Zt(t,64,8,!1),r=new DataView(e.buffer),n=[1732584193,4023233417,2562383102,271733878,3285377520],s=new Int32Array(80);for(let o=0;o<e.length;o+=64){for(let h=0;h<16;h++)s[h]=r.getInt32(o+h*4);for(let h=16;h<80;h++)s[h]=Vt(s[h-3]^s[h-8]^s[h-14]^s[h-16],1);let[a,c,l,f,u]=n;for(let h=0;h<80;h++){let[d,g]=h<20?[c&l|~c&f,1518500249]:h<40?[c^l^f,1859775393]:h<60?[c&l|c&f|l&f,2400959708]:[c^l^f,3395469782],m=Vt(a,5)+d+u+g+s[h]|0;u=f,f=l,l=Vt(c,30),c=a,a=m}n[0]=n[0]+a|0,n[1]=n[1]+c|0,n[2]=n[2]+l|0,n[3]=n[3]+f|0,n[4]=n[4]+u|0}let i=new DataView(new ArrayBuffer(20));return n.forEach((o,a)=>i.setUint32(a*4,o>>>0)),new Uint8Array(i.buffer)}var _a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Ps(t,e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r=8){let n=Zt(t,64,8,!1),s=new DataView(n.buffer),i=[...e],o=new Int32Array(64);for(let c=0;c<n.length;c+=64){for(let p=0;p<16;p++)o[p]=s.getInt32(c+p*4);for(let p=16;p<64;p++){let C=we(o[p-15],7)^we(o[p-15],18)^o[p-15]>>>3,y=we(o[p-2],17)^we(o[p-2],19)^o[p-2]>>>10;o[p]=o[p-16]+C+o[p-7]+y|0}let[l,f,u,h,d,g,m,E]=i;for(let p=0;p<64;p++){let C=E+(we(d,6)^we(d,11)^we(d,25))+(d&g^~d&m)+_a[p]+o[p]|0,y=(we(l,2)^we(l,13)^we(l,22))+(l&f^l&u^f&u)|0;E=m,m=g,g=d,d=h+C|0,h=u,u=f,f=l,l=C+y|0}[l,f,u,h,d,g,m,E].forEach((p,C)=>i[C]=i[C]+p|0)}let a=new DataView(new ArrayBuffer(r*4));for(let c=0;c<r;c++)a.setUint32(c*4,i[c]>>>0);return new Uint8Array(a.buffer)}var Ra=["428a2f98d728ae22","7137449123ef65cd","b5c0fbcfec4d3b2f","e9b5dba58189dbbc","3956c25bf348b538","59f111f1b605d019","923f82a4af194f9b","ab1c5ed5da6d8118","d807aa98a3030242","12835b0145706fbe","243185be4ee4b28c","550c7dc3d5ffb4e2","72be5d74f27b896f","80deb1fe3b1696b1","9bdc06a725c71235","c19bf174cf692694","e49b69c19ef14ad2","efbe4786384f25e3","0fc19dc68b8cd5b5","240ca1cc77ac9c65","2de92c6f592b0275","4a7484aa6ea6e483","5cb0a9dcbd41fbd4","76f988da831153b5","983e5152ee66dfab","a831c66d2db43210","b00327c898fb213f","bf597fc7beef0ee4","c6e00bf33da88fc2","d5a79147930aa725","06ca6351e003826f","142929670a0e6e70","27b70a8546d22ffc","2e1b21385c26c926","4d2c6dfc5ac42aed","53380d139d95b3df","650a73548baf63de","766a0abb3c77b2a8","81c2c92e47edaee6","92722c851482353b","a2bfe8a14cf10364","a81a664bbc423001","c24b8b70d0f89791","c76c51a30654be30","d192e819d6ef5218","d69906245565a910","f40e35855771202a","106aa07032bbd1b8","19a4c116b8d2d0c8","1e376c085141ab53","2748774cdf8eeb99","34b0bcb5e19b48a8","391c0cb3c5c95a63","4ed8aa4ae3418acb","5b9cca4f7763e373","682e6ff3d6b2b8a3","748f82ee5defb2fc","78a5636f43172f60","84c87814a1f0ab72","8cc702081a6439ec","90befffa23631e28","a4506cebde82bde9","bef9a3f7b2c67915","c67178f2e372532b","ca273eceea26619c","d186b8c721c0c207","eada7dd6cde0eb1e","f57d4f7fee6ed178","06f067aa72176fba","0a637dc5a2c898a6","113f9804bef90dae","1b710b35131c471b","28db77f523047d84","32caab7b40c72493","3c9ebe0a15c9bebc","431d67c49c100d4c","4cc5d4becb3e42b6","597f299cfc657e2a","5fcb6fab3ad6faec","6c44198c4a475817"].map(t=>BigInt("0x"+t)),Re=(1n<<64n)-1n,ye=(t,e)=>(t>>e|t<<64n-e)ℜfunction Ks(t,e,r){let n=Zt(t,128,16,!1),s=new DataView(n.buffer),i=e.map(c=>BigInt("0x"+c)),o=new Array(80);for(let c=0;c<n.length;c+=128){for(let p=0;p<16;p++)o[p]=s.getBigUint64(c+p*8);for(let p=16;p<80;p++){let C=ye(o[p-15],1n)^ye(o[p-15],8n)^o[p-15]>>7n,y=ye(o[p-2],19n)^ye(o[p-2],61n)^o[p-2]>>6n;o[p]=o[p-16]+C+o[p-7]+y&Re}let[l,f,u,h,d,g,m,E]=i;for(let p=0;p<80;p++){let C=E+(ye(d,14n)^ye(d,18n)^ye(d,41n))+(d&g^~d&Re&m)+Ra[p]+o[p]&Re,y=(ye(l,28n)^ye(l,34n)^ye(l,39n))+(l&f^l&u^f&u)ℜE=m,m=g,g=d,d=h+C&Re,h=u,u=f,f=l,l=C+y&Re}[l,f,u,h,d,g,m,E].forEach((p,C)=>i[C]=i[C]+p&Re)}let a=new DataView(new ArrayBuffer(64));return i.forEach((c,l)=>a.setBigUint64(l*8,c)),new Uint8Array(a.buffer).slice(0,r)}var Ta=["6a09e667f3bcc908","bb67ae8584caa73b","3c6ef372fe94f82b","a54ff53a5f1d36f1","510e527fade682d1","9b05688c2b3e6c1f","1f83d9abfb41bd6b","5be0cd19137e2179"],La=["cbbb9d5dc1059ed8","629a292a367cd507","9159015a3070dd17","152fecd8f70e5939","67332667ffc00b31","8eb44a8768581511","db0c2e0d64f98fa7","47b5481dbefa4fa4"],nn={md5:{digest:Oa,blockSize:64},sha1:{digest:Na,blockSize:64},sha256:{digest:t=>Ps(t),blockSize:64},sha224:{digest:t=>Ps(t,[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],7),blockSize:64},sha384:{digest:t=>Ks(t,La,48),blockSize:128},sha512:{digest:t=>Ks(t,Ta,64),blockSize:128}};function Ct(t){let e=t.toLowerCase().replace(/^rsa-/,"").replace("-",""),r=nn[e];if(!r)throw new Error(`Digest method not supported: ${t}`);return r}var nt=(t,e)=>typeof t=="string"?k.from(t,e):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),an=(t,e)=>e&&e!=="buffer"?k.from(t).toString(e):k.from(t),er=class t extends _e{constructor(r){super();A(this,"algorithm");A(this,"chunks",[]);A(this,"done",!1);this.algorithm=r,Ct(r)}update(r,n){if(this.done)throw Object.assign(new Error("Digest already called"),{code:"ERR_CRYPTO_HASH_FINALIZED"});return this.chunks.push(nt(r,n).slice()),this}digest(r){return this.done=!0,an(Ct(this.algorithm).digest(k.concat(this.chunks)),r)}copy(){let r=new t(this.algorithm);return r.chunks=[...this.chunks],r}_transform(r,n,s){this.update(r),s()}_flush(r){r(null,this.digest())}};function sn(t,e,r){let{digest:n,blockSize:s}=Ct(t),i=e.length>s?n(e):e,o=new Uint8Array(s);o.set(i),i=o;let a=new Uint8Array(s+r.length),c=new Uint8Array(s);for(let u=0;u<s;u++)a[u]=i[u]^54,c[u]=i[u]^92;a.set(r,s);let l=n(a),f=new Uint8Array(s+l.length);return f.set(c),f.set(l,s),n(f)}var on=class extends er{constructor(r,n){super(r);A(this,"hmacAlgorithm");A(this,"hmacKey");A(this,"parts",[]);this.hmacAlgorithm=r,this.hmacKey=nt(n).slice()}update(r,n){return this.parts.push(nt(r,n).slice()),this}digest(r){return an(sn(this.hmacAlgorithm,this.hmacKey,k.concat(this.parts)),r)}};function Hs(t,e,r,n,s="sha1"){let i=nt(t),o=nt(e),a=new Uint8Array(n);for(let c=1,l=0;l<n;c++){let f=new Uint8Array(o.length+4);f.set(o),new DataView(f.buffer).setUint32(o.length,c);let u=sn(s,i,f),h=u.slice();for(let d=1;d<r;d++){u=sn(s,i,u);for(let g=0;g<h.length;g++)h[g]=h[g]^u[g]}a.set(h.subarray(0,n-l),l),l+=h.length}return k.from(a)}function Xt(t){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);for(let r=0;r<e.length;r+=65536)globalThis.crypto.getRandomValues(e.subarray(r,r+65536));return t}var Ee=t=>()=>{throw Object.assign(new Error(`crypto.${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Js(){let t=(e,r)=>{let n=Xt(k.alloc(e));return r&&queueMicrotask(()=>r(null,n)),n};return{createHash:e=>new er(e),createHmac:(e,r)=>new on(e,r),hash:(e,r,n="hex")=>an(Ct(e).digest(nt(r)),n),getHashes:()=>Object.keys(nn),getCiphers:()=>[],getCurves:()=>[],randomBytes:t,pseudoRandomBytes:t,randomFillSync:(e,r=0,n)=>(Xt(new Uint8Array(e.buffer,e.byteOffset+r,n??e.byteLength-r)),e),randomFill:(e,...r)=>{let n=r.pop();Xt(e),queueMicrotask(()=>n(null,e))},randomUUID:()=>globalThis.crypto.randomUUID(),randomInt(e,r,n){typeof r!="number"&&([n,r,e]=[r,e,0]);let s=e+Math.floor(globalThis.crypto.getRandomValues(new Uint32Array(1))[0]/2**32*(r-e));return n&&queueMicrotask(()=>n(null,s)),s},getRandomValues:e=>Xt(e),timingSafeEqual(e,r){if(e.byteLength!==r.byteLength)throw new RangeError("Input buffers must have the same byte length");let n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),i=0;for(let o=0;o<n.length;o++)i|=n[o]^s[o];return i===0},pbkdf2Sync:Hs,pbkdf2(e,r,n,s,i,o){queueMicrotask(()=>{try{o(null,Hs(e,r,n,s,i))}catch(a){o(a)}})},webcrypto:globalThis.crypto,subtle:globalThis.crypto?.subtle,constants:{},createCipheriv:Ee("createCipheriv"),createDecipheriv:Ee("createDecipheriv"),createSign:Ee("createSign"),createVerify:Ee("createVerify"),generateKeyPairSync:Ee("generateKeyPairSync"),generateKeyPair:Ee("generateKeyPair"),createPrivateKey:Ee("createPrivateKey"),createPublicKey:Ee("createPublicKey"),scryptSync:Ee("scryptSync"),scrypt:Ee("scrypt")}}function qs(){let t=i=>encodeURIComponent(i),e=i=>{try{return decodeURIComponent(i)}catch{return i}},r=i=>typeof i=="string"?i:typeof i=="number"&&Number.isFinite(i)||typeof i=="boolean"||typeof i=="bigint"?String(i):"",n=(i,o="&",a="=",c)=>{let l=Object.create(null);if(typeof i!="string"||!i)return l;let f=c?.decodeURIComponent??e,u=i.split(o),h=c?.maxKeys??1e3;for(let d of h>0?u.slice(0,h):u){if(!d)continue;let g=d.indexOf(a),m=f((g>=0?d.slice(0,g):d).replace(/\+/g," ")),E=g>=0?f(d.slice(g+a.length).replace(/\+/g," ")):"",p=l[m];p===void 0?l[m]=E:Array.isArray(p)?p.push(E):l[m]=[p,E]}return l},s=(i,o="&",a="=",c)=>{let l=c?.encodeURIComponent??t;return!i||typeof i!="object"?"":Object.keys(i).map(f=>{let u=i[f],h=l(r(f))+a;return Array.isArray(u)?u.map(d=>h+l(r(d))).join(o):h+l(r(u))}).filter(Boolean).join(o)};return{parse:n,decode:n,stringify:s,encode:s,escape:t,unescape:e}}function Ws(t){function e(s,i=!1,o=!1){let a=s.trim(),c={protocol:null,slashes:null,auth:null,host:null,port:null,hostname:null,hash:null,search:null,query:null,pathname:null,path:null,href:""},l=a.indexOf("#");l>=0&&(c.hash=a.slice(l),a=a.slice(0,l));let f=a.indexOf("?");f>=0?(c.search=a.slice(f),c.query=a.slice(f+1),a=a.slice(0,f)):i&&(c.search="",c.query={});let u=/^([a-z][a-z0-9.+-]*:)/i.exec(a);if(u&&(c.protocol=u[1].toLowerCase(),a=a.slice(u[1].length)),(u||o)&&a.startsWith("//")){c.slashes=!0,a=a.slice(2);let h=a.search(/[/]/),d=h>=0?a.slice(0,h):a;a=h>=0?a.slice(h):"";let g=d.lastIndexOf("@");g>=0&&(c.auth=decodeURIComponent(d.slice(0,g)),d=d.slice(g+1)),c.host=d.toLowerCase();let m=/:(\d*)$/.exec(c.host);m?(c.port=m[1]||null,c.hostname=c.host.slice(0,-m[0].length)):c.hostname=c.host,c.hostname.startsWith("[")&&c.hostname.endsWith("]")&&(c.hostname=c.hostname.slice(1,-1)),!a&&c.protocol&&/^(https?|ftp|wss?|file):$/.test(c.protocol)&&(a="/")}return c.pathname=a||(c.slashes?"/":null),i&&typeof c.query=="string"&&(c.query=t.parse(c.query)),c.path=(c.pathname??"")+(c.search??"")||null,c.href=r(c),c}function r(s){if(typeof s=="string")return r(e(s));if(s instanceof URL)return s.href;let i=s.protocol?s.protocol.endsWith(":")?s.protocol:s.protocol+":":"",o="";s.host?o=(s.auth?encodeURIComponent(s.auth).replace(/%3A/i,":")+"@":"")+s.host:s.hostname&&(o=(s.auth?s.auth+"@":"")+(s.hostname.includes(":")?`[${s.hostname}]`:s.hostname)+(s.port?":"+s.port:""));let a=s.search??"";if(!a&&s.query&&typeof s.query=="object"){let u=t.stringify(s.query);u&&(a="?"+u)}else a&&!a.startsWith("?")&&(a="?"+a);let c=s.slashes||o&&/^(https?|ftp|wss?|file):$/.test(i)?"//":"",l=s.pathname??"";o&&l&&!l.startsWith("/")&&(l="/"+l);let f=s.hash?s.hash.startsWith("#")?s.hash:"#"+s.hash:"";return`${i}${c}${o}${l}${a}${f}`}function n(s,i){let o=new URL(s,"resolve://"),a=new URL(i,o);if(a.protocol==="resolve:"){let{pathname:c,search:l,hash:f}=a;return c+l+f}return a.href}return{URL,URLSearchParams,parse:e,format:r,resolve:n,resolveObject:(s,i)=>e(n(s,i)),fileURLToPath:s=>{let i=typeof s=="string"?new URL(s):s;if(i.protocol!=="file:")throw Object.assign(new TypeError("The URL must be of scheme file"),{code:"ERR_INVALID_URL_SCHEME"});return decodeURIComponent(i.pathname)},pathToFileURL:s=>new URL("file://"+encodeURI(s).replace(/[?#]/g,encodeURIComponent)),domainToASCII:s=>s,domainToUnicode:s=>s,urlToHttpOptions:s=>({protocol:s.protocol,hostname:s.hostname,hash:s.hash,search:s.search,pathname:s.pathname,path:s.pathname+s.search,href:s.href,port:s.port?Number(s.port):void 0}),Url:function(){}}}var tr=class extends Error{constructor(r){let n=r.message===void 0;super(n?`${P(r.actual)} ${r.operator??"=="} ${P(r.expected)}`:String(r.message));A(this,"code","ERR_ASSERTION");A(this,"actual");A(this,"expected");A(this,"operator");A(this,"generatedMessage");this.name="AssertionError",this.actual=r.actual,this.expected=r.expected,this.operator=r.operator??"==",this.generatedMessage=n}};function cn(t,e){if(t==e)return!0;if(typeof t!="object"||typeof e!="object"||!t||!e)return!1;let r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(s=>cn(t[s],e[s]))}function K(t,e,r,n){throw t instanceof Error?t:new tr({message:t,actual:e,expected:r,operator:n})}function zs(t,e){return e===void 0?!0:typeof e=="function"?e.prototype!==void 0&&t instanceof e?!0:Error.isPrototypeOf(e)?!1:e(t)===!0:e instanceof RegExp?e.test(String(t instanceof Error?t.message:t))||e.test(String(t)):typeof e=="object"&&e?Object.entries(e).every(([r,n])=>n instanceof RegExp?n.test(String(t?.[r])):ge(t?.[r],n)):!1}function rr(t=!1){let e=(a,c)=>{a||K(c??"The expression evaluated to a falsy value",a,!0,"==")},r=t?(a,c,l)=>!Object.is(a,c)&&K(l,a,c,"strictEqual"):(a,c,l)=>a!=c&&!(Number.isNaN(a)&&Number.isNaN(c))&&K(l,a,c,"=="),n=t?(a,c,l)=>!ge(a,c)&&K(l,a,c,"deepStrictEqual"):(a,c,l)=>!cn(a,c)&&K(l,a,c,"deepEqual"),s=(a,c,l)=>{typeof c=="string"&&([l,c]=[c,void 0]);try{a()}catch(f){if(!zs(f,c))throw f;return}K(l??"Missing expected exception.",void 0,c,"throws")},i=async(a,c,l)=>{typeof c=="string"&&([l,c]=[c,void 0]);try{await(typeof a=="function"?a():a)}catch(f){if(!zs(f,c))throw f;return}K(l??"Missing expected rejection.",void 0,c,"rejects")},o=(a,c)=>e(a,c);return Object.assign(o,{ok:e,equal:r,notEqual:t?(a,c,l)=>Object.is(a,c)&&K(l,a,c,"notStrictEqual"):(a,c,l)=>a==c&&K(l,a,c,"!="),strictEqual:(a,c,l)=>!Object.is(a,c)&&K(l,a,c,"strictEqual"),notStrictEqual:(a,c,l)=>Object.is(a,c)&&K(l,a,c,"notStrictEqual"),deepEqual:n,notDeepEqual:(a,c,l)=>(t?ge(a,c):cn(a,c))&&K(l,a,c,"notDeepEqual"),deepStrictEqual:(a,c,l)=>!ge(a,c)&&K(l,a,c,"deepStrictEqual"),notDeepStrictEqual:(a,c,l)=>ge(a,c)&&K(l,a,c,"notDeepStrictEqual"),throws:s,doesNotThrow:(a,c)=>{try{a()}catch(l){K(c??`Got unwanted exception: ${l?.message??l}`,l,void 0,"doesNotThrow")}},rejects:i,doesNotReject:async(a,c)=>{try{await(typeof a=="function"?a():a)}catch(l){K(c??"Got unwanted rejection.",l,void 0,"doesNotReject")}},match:(a,c,l)=>!c.test(a)&&K(l??`The input did not match the regular expression ${c}. Input: ${P(a)}`,a,c,"match"),doesNotMatch:(a,c,l)=>c.test(a)&&K(l,a,c,"doesNotMatch"),ifError:a=>{if(a!=null)throw a},fail:a=>K(a??"Failed",void 0,void 0,"fail"),AssertionError:tr}),o.strict=t?o:rr(!0),o}var ln=t=>typeof t=="string"?k.from(t):t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),it=t=>t?.level===void 0||t.level<0?6:Math.min(9,t.level),$a={gzip:(t,e)=>Wn(t,{level:it(e)}),gunzip:t=>wt(t),deflate:(t,e)=>Gn(t,{level:it(e)}),inflate:t=>Fr(t),deflateRaw:(t,e)=>Jn(t,{level:it(e)}),inflateRaw:t=>Lr(t),unzip:t=>Vn(t)},Gs={Gzip:t=>new qn({level:it(t)}),Gunzip:()=>new $r,Deflate:t=>new zn({level:it(t)}),Inflate:()=>new Mr,DeflateRaw:t=>new xe({level:it(t)}),InflateRaw:()=>new pe,Unzip:()=>new Yn};function nr(t){let e=t instanceof Error?t.message:String(t);return Object.assign(new Error(e||"invalid compressed data"),{code:"Z_DATA_ERROR",errno:-3})}var sr=class extends _e{constructor(r,n){super();A(this,"engine");A(this,"bytesWritten",0);this.engine=Gs[r](n),this.engine.ondata=s=>{s.length&&this.push(k.from(s))}}_transform(r,n,s){try{this.bytesWritten+=r.length,this.engine.push(r,!1),s()}catch(i){s(nr(i))}}_flush(r){try{this.engine.push(new Uint8Array(0),!0),r()}catch(n){r(nr(n))}}flush(r,n){n?.()}params(r,n,s){s?.()}close(r){this.destroy(),r?.()}},st=()=>{throw Object.assign(new Error("Brotli is not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Ys(){let t={constants:{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_PARAM_QUALITY:1},brotliCompressSync:st,brotliDecompressSync:st,brotliCompress:st,brotliDecompress:st,createBrotliCompress:st,createBrotliDecompress:st,crc32:(e,r=0)=>{let n=~r>>>0;for(let s of ln(e)){n^=s;for(let i=0;i<8;i++)n=n&1?n>>>1^3988292384:n>>>1}return~n>>>0}};for(let[e,r]of Object.entries($a))t[`${e}Sync`]=(n,s)=>{try{return k.from(r(ln(n),s))}catch(i){throw nr(i)}},t[e]=(n,s,i)=>{let o=typeof s=="function"?s:i;queueMicrotask(()=>{try{o(null,k.from(r(ln(n),typeof s=="object"?s:void 0)))}catch(a){o(nr(a))}})};for(let e of Object.keys(Gs))t[`create${e}`]=r=>new sr(e,r),t[e]=class extends sr{constructor(r){super(e,r)}};return t}var ir={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},Vs=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];var Se=class extends R{constructor(r=0){super();A(this,"remoteAddress","127.0.0.1");A(this,"remotePort",5e4+Math.floor(Math.random()*1e4));A(this,"remoteFamily","IPv4");A(this,"localAddress","127.0.0.1");A(this,"localPort");A(this,"encrypted",!1);A(this,"readable",!0);A(this,"writable",!0);A(this,"destroyed",!1);A(this,"bytesRead",0);A(this,"bytesWritten",0);this.localPort=r}setTimeout(r,n){return n&&this.once("timeout",n),this}setNoDelay(){return this}setKeepAlive(){return this}address(){return{address:this.localAddress,family:"IPv4",port:this.localPort}}ref(){return this}unref(){return this}cork(){}uncork(){}write(){return!0}end(){return this}destroy(){return this.destroyed=!0,this}};function Ma(t){let e={},r=[];for(let[n,s]of Object.entries(t)){let i=n.toLowerCase();r.push(n,s),e[i]=i==="set-cookie"?[s]:s}return{headers:e,raw:r}}var Ke=class extends V{constructor(r=new Se){super();A(this,"httpVersion","1.1");A(this,"httpVersionMajor",1);A(this,"httpVersionMinor",1);A(this,"method");A(this,"url");A(this,"statusCode");A(this,"statusMessage");A(this,"headers",{});A(this,"rawHeaders",[]);A(this,"trailers",{});A(this,"rawTrailers",[]);A(this,"complete",!1);A(this,"aborted",!1);A(this,"socket");A(this,"connection");this.socket=r,this.connection=r}_read(){}setTimeout(r,n){return n&&this.once("timeout",n),this}_fill(r,n){let{headers:s,raw:i}=Ma(r);this.headers=s,this.rawHeaders=i,n?.length&&this.push(k.from(n)),this.push(null),this.complete=!0}},He=class extends Z{constructor(){super(...arguments);A(this,"_headers",new Map);A(this,"headersSent",!1);A(this,"sendDate",!0)}setHeader(r,n){if(this.headersSent)throw Object.assign(new Error("Cannot set headers after they are sent to the client"),{code:"ERR_HTTP_HEADERS_SENT"});return this._headers.set(r.toLowerCase(),{name:r,value:Array.isArray(n)?n.map(String):String(n)}),this}appendHeader(r,n){let s=this.getHeader(r),i=[...s===void 0?[]:Array.isArray(s)?s:[String(s)],...Array.isArray(n)?n:[n]];return this.setHeader(r,i)}getHeader(r){return this._headers.get(r.toLowerCase())?.value}getHeaders(){let r=Object.create(null);for(let[n,{value:s}]of this._headers)r[n]=s;return r}getHeaderNames(){return[...this._headers.keys()]}getRawHeaderNames(){return[...this._headers.values()].map(r=>r.name)}hasHeader(r){return this._headers.has(r.toLowerCase())}removeHeader(r){this._headers.delete(r.toLowerCase())}flushHeaders(){this.headersSent=!0}setTimeout(r,n){return n&&this.once("timeout",n),this}},vt=class extends He{constructor(r,n){super({decodeStrings:!0});A(this,"onDone");A(this,"statusCode",200);A(this,"statusMessage","");A(this,"req");A(this,"socket");A(this,"connection");A(this,"chunkedEncoding",!1);A(this,"shouldKeepAlive",!1);A(this,"chunks",[]);this.onDone=n,this.req=r,this.socket=r.socket,this.connection=r.socket}get finished(){return this.writableEnded}writeHead(r,n,s){if(typeof n!="string"&&([s,n]=[n,void 0]),this.statusCode=r,n&&(this.statusMessage=n),Array.isArray(s))for(let i=0;i+1<s.length;i+=2)this.setHeader(String(s[i]),s[i+1]);else if(s)for(let[i,o]of Object.entries(s))o!==void 0&&this.setHeader(i,o);return this.headersSent=!0,this}writeContinue(){}writeProcessing(){}writeEarlyHints(){}addTrailers(){}assignSocket(){}detachSocket(){}_write(r,n,s){this.headersSent=!0,this.chunks.push(r),s()}_final(r){this.headersSent=!0;let n={};for(let{name:i,value:o}of this._headers.values())n[i]=o;let s=k.concat(this.chunks);this.req.method==="HEAD"&&(this.chunks.length=0),this.onDone({status:this.statusCode,statusText:this.statusMessage||ir[this.statusCode]||"",headers:n,body:this.req.method==="HEAD"?new Uint8Array:s}),r()}},Qt=class extends R{constructor(r,n,s){super();A(this,"deps");A(this,"listening",!1);A(this,"timeout",0);A(this,"keepAliveTimeout",5e3);A(this,"headersTimeout",6e4);A(this,"requestTimeout",3e5);A(this,"maxHeadersCount",null);A(this,"registration");A(this,"release");this.deps=r,typeof n=="function"&&(s=n),s&&this.on("request",s)}listen(...r){let n=typeof r[r.length-1]=="function"?r.pop():void 0,s=r[0],i=Number(typeof s=="object"&&s?s.port??0:s??0);n&&this.once("listening",n);try{this.registration=this.deps.system.listen(i,o=>this.handle(o))}catch(o){return queueMicrotask(()=>this.emit("error",o)),this}return this.listening=!0,this.release=this.deps.loop.hold(),queueMicrotask(()=>this.emit("listening")),this}address(){return this.registration?{address:"::",family:"IPv6",port:this.registration.port}:null}close(r){return this.registration?(this.registration.close(),this.registration=void 0,this.listening=!1,this.release?.(),this.release=void 0,r&&this.once("close",r),queueMicrotask(()=>this.emit("close")),this):(r&&queueMicrotask(()=>r(Object.assign(new Error("Server is not running."),{code:"ERR_SERVER_NOT_RUNNING"}))),this)}closeAllConnections(){}closeIdleConnections(){}setTimeout(r=0,n){return this.timeout=r,n&&this.on("timeout",n),this}ref(){return this.registration&&!this.release&&(this.release=this.deps.loop.hold()),this}unref(){return this.release?.(),this.release=void 0,this}getConnections(r){r(null,0)}handle(r){return new Promise(n=>{let s=new Se(this.registration?.port??0),i=new Ke(s);i.method=r.method.toUpperCase(),i.url=r.url;let o={...r.headers};!Object.keys(o).some(l=>/^(content-length|transfer-encoding)$/i.test(l))&&r.body?.length&&(o["content-length"]=String(r.body.length)),i._fill(o,r.body);let c=new vt(i,n);this.deps.loop._run(()=>{try{this.emit("request",i,c)}catch(l){throw c.writableEnded||(c.statusCode=500,c.end("Internal Server Error")),l}})})}};var Fa=new Set(["localhost","127.0.0.1","0.0.0.0","::1","[::1]"]),Ua=new Set(["host","connection","content-length","keep-alive","transfer-encoding","upgrade","expect","te","trailer","proxy-connection"]);function ja(t,e,r){let n={};if(typeof t=="string"||t instanceof URL){let s=new URL(String(t));n={protocol:s.protocol,hostname:s.hostname.replace(/^\[|\]$/g,""),port:s.port,path:s.pathname+s.search,auth:s.username?`${decodeURIComponent(s.username)}:${decodeURIComponent(s.password)}`:void 0},e&&typeof e=="object"&&(n={...n,...e})}else t&&typeof t=="object"&&(n={...t});if(n.protocol??(n.protocol=r),!n.hostname&&n.host){let[s,i]=n.host.split(":");n.hostname=s,n.port??(n.port=i)}return n.hostname??(n.hostname="localhost"),n.path??(n.path="/"),n.method=(n.method??"GET").toUpperCase(),n}function Zs(t){return Fa.has(t.toLowerCase())}function Xs(t){let e={};return t.forEach((r,n)=>e[n]=r),e}async function ei(t,e,r,n){if(Zs(e.hostname)){let o=Number(e.port||(e.protocol==="https:"?443:80)),a=await t.loopback(o,r);if(!a)throw Object.assign(new Error(`connect ECONNREFUSED 127.0.0.1:${o}`),{code:"ECONNREFUSED",errno:-111,syscall:"connect",address:"127.0.0.1",port:o});let c=new Headers;for(let[f,u]of Object.entries(a.headers))for(let h of Array.isArray(u)?u:[u])c.append(f,String(h));let l=a.status===204||a.status===304||r.method==="HEAD";return new Response(l?null:a.body,{status:a.status,statusText:a.statusText,headers:c})}let s={};for(let[o,a]of Object.entries(r.headers))Ua.has(o.toLowerCase())||(s[o]=a);let i=r.body&&r.method!=="GET"&&r.method!=="HEAD";return t.fetch(e.href,{method:r.method,headers:s,body:i?r.body:void 0,signal:n})}var Bt=class extends He{constructor(r,n,s,i,o){super({decodeStrings:!0});A(this,"deps");A(this,"method");A(this,"path");A(this,"host");A(this,"protocol");A(this,"aborted",!1);A(this,"reusedSocket",!1);A(this,"socket",new Se);A(this,"connection",this.socket);A(this,"chunks",[]);A(this,"controller",new AbortController);A(this,"options");this.deps=r,typeof s=="function"&&([i,s]=[s,void 0]),this.options=ja(n,s,o),this.method=this.options.method,this.path=this.options.path,this.host=this.options.hostname,this.protocol=this.options.protocol;for(let[a,c]of Object.entries(this.options.headers??{}))this.setHeader(a,c);this.options.auth&&!this.hasHeader("authorization")&&this.setHeader("authorization",`Basic ${k.from(this.options.auth).toString("base64")}`),i&&this.once("response",i),this.options.signal?.addEventListener("abort",()=>this.destroy(Object.assign(new Error("The operation was aborted"),{name:"AbortError",code:"ABORT_ERR"})))}_write(r,n,s){this.chunks.push(r),s()}_final(r){this.headersSent=!0,r(),this.perform()}abort(){this.aborted=!0,this.controller.abort(),this.emit("abort"),this.destroy()}destroy(r){return this.controller.abort(),super.destroy(r)}setNoDelay(){}setSocketKeepAlive(){}async perform(){let r=this.deps.loop.hold();try{let n=this.options.port?`:${this.options.port}`:"",s=this.host.includes(":")?`[${this.host}]`:this.host,i=new URL(`${this.protocol}//${s}${n}${this.path}`),o={};for(let[f,u]of Object.entries(this.getHeaders()))o[f]=Array.isArray(u)?u.join(", "):String(u);let a=this.chunks.length?k.concat(this.chunks):null,c=await ei(this.deps.system,i,{method:this.method,url:this.path,headers:o,body:a},this.controller.signal),l=new Ke(this.socket);l.statusCode=c.status,l.statusMessage=c.statusText,l._fill(Xs(c.headers),new Uint8Array(await c.arrayBuffer())),this.deps.loop._run(()=>{this.emit("response",l)||l.resume()})}catch(n){this.aborted||this.deps.loop._run(()=>this.emit("error",n))}finally{r()}}};function fn(t){return async(e,r)=>{let n=t.loop.hold();try{let s=new Request(e instanceof URL?e.href:e,r),i=new URL(s.url);if(!Zs(i.hostname))return await t.system.fetch(i.href,r??(typeof e=="object"&&!(e instanceof URL)?{method:s.method,headers:s.headers,body:s.body,signal:s.signal}:void 0));let o=s.method==="GET"||s.method==="HEAD"?null:new Uint8Array(await s.arrayBuffer());return await ei(t.system,i,{method:s.method,url:i.pathname+i.search,headers:Xs(s.headers),body:o})}finally{n()}}}var or=class extends R{constructor(r={}){super();A(this,"options");A(this,"maxSockets",1/0);A(this,"maxFreeSockets",256);A(this,"sockets",{});A(this,"requests",{});A(this,"freeSockets",{});this.options=r}destroy(){}};function un(t,e){let r=(i,o,a)=>new Bt(t,i,o,a,e),n=(i,o,a)=>{let c=r(i,o,a);return c.end(),c},s=new or;return{createServer:(i,o)=>new Qt(t,i,o),request:r,get:n,Server:class extends Qt{constructor(i,o){super(t,i,o)}},IncomingMessage:Ke,ServerResponse:vt,OutgoingMessage:He,ClientRequest:Bt,Agent:or,globalAgent:s,STATUS_CODES:ir,METHODS:Vs,maxHeaderSize:16384,validateHeaderName(i){if(!/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/.test(i))throw Object.assign(new TypeError(`Header name must be a valid HTTP token ["${i}"]`),{code:"ERR_INVALID_HTTP_TOKEN"})},validateHeaderValue(i,o){if(o===void 0)throw Object.assign(new TypeError(`Invalid value "undefined" for header "${i}"`),{code:"ERR_HTTP_INVALID_HEADER_VALUE"})},setMaxIdleHTTPParsers:()=>{}}}var ti=/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/,ri=/^(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$/i;function ni(t){class e extends R{constructor(){super(...arguments);A(this,"reservation");A(this,"release");A(this,"listening",!1)}listen(...i){let o=typeof i[i.length-1]=="function"?i.pop():void 0,a=i[0],c=Number(typeof a=="object"&&a?a.port??0:a??0);o&&this.once("listening",o);try{this.reservation=t.system.listen(c,async()=>({status:502,headers:{"content-type":"text/plain"},body:new TextEncoder().encode("Not an HTTP server")}))}catch(l){return queueMicrotask(()=>this.emit("error",l)),this}return this.listening=!0,this.release=t.loop.hold(),queueMicrotask(()=>this.emit("listening")),this}address(){return this.reservation?{address:"::",family:"IPv6",port:this.reservation.port}:null}close(i){return this.reservation?.close(),this.reservation=void 0,this.listening=!1,this.release?.(),i&&this.once("close",i),queueMicrotask(()=>this.emit("close")),this}ref(){return this}unref(){return this.release?.(),this.release=void 0,this}}let r=()=>{throw Object.assign(new Error("Raw TCP sockets are not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};return{createServer:()=>new e,Server:e,Socket:Se,Stream:Se,connect:r,createConnection:r,isIP:n=>ti.test(n)?4:ri.test(n)?6:0,isIPv4:n=>ti.test(n),isIPv6:n=>ri.test(n),getDefaultAutoSelectFamily:()=>!0,setDefaultAutoSelectFamily:()=>{}}}var Pa=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,Je=class extends R{constructor(r,n,s,i){super();A(this,"pid");A(this,"exitCode",null);A(this,"signalCode",null);A(this,"killed",!1);A(this,"connected",!1);A(this,"spawnfile");A(this,"spawnargs");A(this,"stdin");A(this,"stdout");A(this,"stderr");A(this,"stdio");A(this,"handle");this.spawnfile=n,this.spawnargs=[n,...s],this.stdout=new V({read(){}}),this.stderr=new V({read(){}}),this.stdin=new Z({write:(u,h,d)=>{this.handle?.write(typeof u=="string"?u:new TextDecoder().decode(u)),d()},final:u=>{this.handle?.closeStdin(),u()}}),this.stdio=[this.stdin,this.stdout,this.stderr];let o=i.stdio==="inherit"||Array.isArray(i.stdio)&&i.stdio[1]==="inherit",a={};for(let[u,h]of Object.entries(i.env??r.env()))h!==void 0&&(a[u]=String(h));let[c,l]=i.shell?["jsh",["-c",[n,...s].join(" ")]]:[n,s],f=r.loop.hold();try{this.handle=r.system.spawn(c,l,{cwd:i.cwd??r.cwd(),env:a})}catch(u){f();let h=u.code??"ENOENT",d=Object.assign(new Error(`spawn ${n} ${h}`),{code:h,errno:-2,syscall:`spawn ${n}`,path:n,spawnargs:s});queueMicrotask(()=>{this.emit("error",d),this.emit("close",-2,null)});return}this.pid=this.handle.pid,this.handle.onStdout(u=>o?r.stdout(u):this.stdout.push(u)),this.handle.onStderr(u=>o?r.stderr(u):this.stderr.push(u)),i.signal?.addEventListener("abort",()=>this.kill()),queueMicrotask(()=>this.emit("spawn")),this.handle.exit.then(u=>{this.exitCode=this.killed?null:u,this.stdout.push(null),this.stderr.push(null),r.loop._run(()=>{this.emit("exit",this.exitCode,this.signalCode),this.emit("close",this.exitCode,this.signalCode)}),f()})}kill(r="SIGTERM"){return!this.handle||this.exitCode!==null?!1:(this.killed=!0,this.signalCode=r,this.handle.kill(r),!0)}send(){throw Object.assign(new Error("IPC channels are not supported in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})}disconnect(){}ref(){}unref(){}};function si(t,e,r){let n="",s="";return t.stdout.on("data",i=>n+=String(i)),t.stderr.on("data",i=>s+=String(i)),t.on("error",i=>r?.(i,n,s)),t.on("close",(i,o)=>{if(i===-2)return;let a=i===0?null:Object.assign(new Error(`Command failed: ${e}
|
|
24
|
+
${s}`),{code:i??void 0,killed:t.killed,signal:o,cmd:e});r?.(a,n,s)}),t}var hn=t=>()=>{throw Object.assign(new Error(`child_process.${t} is not supported in the browser runtime (a synchronous child would block the thread it needs). Use the async form.`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function ii(t){return{spawn:(r,n,s)=>(Array.isArray(n)||([s,n]=[n,[]]),new Je(t,r,n.map(String),s??{})),exec(r,n,s){return typeof n=="function"&&([s,n]=[n,{}]),si(new Je(t,r,[],{...n,shell:!0}),r,s)},execFile(r,n,s,i){return typeof n=="function"?[i,n,s]=[n,[],{}]:Array.isArray(n)||([i,s,n]=[s,n,[]]),typeof s=="function"&&([i,s]=[s,{}]),si(new Je(t,r,n,s??{}),[r,...n].map(Pa).join(" "),i)},fork(r,n,s){return Array.isArray(n)||([s,n]=[n,[]]),new Je(t,"node",[r,...n],s??{})},execSync:hn("execSync"),execFileSync:hn("execFileSync"),spawnSync:hn("spawnSync"),ChildProcess:Je}}var cr=class extends R{constructor(r,n,s={}){super();A(this,"input");A(this,"output");A(this,"line","");A(this,"cursor",0);A(this,"terminal");A(this,"closed",!1);A(this,"buffer","");A(this,"promptText","> ");A(this,"pendingQuestion");A(this,"onData",r=>this.feed(String(r)));A(this,"onEnd",()=>{this.buffer&&this.emitLine(this.buffer),this.buffer="",this.close()});this.input=r,this.output=n,this.terminal=s.terminal??!!n?.isTTY,s.prompt!==void 0&&(this.promptText=s.prompt),r.setEncoding?.("utf8"),r.on("data",this.onData),r.on("end",this.onEnd),r.resume?.()}setPrompt(r){this.promptText=r}getPrompt(){return this.promptText}prompt(){this.output?.write(this.promptText)}question(r,n,s){let i=typeof n=="function"?n:s;this.output?.write(r),this.pendingQuestion=i}write(r){this.feed(r)}pause(){return this.input.pause?.(),this.emit("pause"),this}resume(){return this.input.resume?.(),this.emit("resume"),this}close(){this.closed||(this.closed=!0,this.input.removeListener("data",this.onData),this.input.removeListener("end",this.onEnd),this.input.pause?.(),this.emit("close"))}getCursorPos(){return{rows:0,cols:this.cursor}}async*[Symbol.asyncIterator](){let r=[],n;for(this.on("line",s=>{r.push(s),n?.()}),this.on("close",()=>n?.());;)if(r.length)yield r.shift();else{if(this.closed)return;await new Promise(s=>n=s)}}feed(r){for(this.buffer+=r;;){let n=this.buffer.search(/\r\n|\n|\r/);if(n<0)break;let s=this.buffer.slice(0,n);this.buffer=this.buffer.slice(this.buffer[n]==="\r"&&this.buffer[n+1]===`
|
|
25
|
+
`?n+2:n+1),this.emitLine(s)}this.line=this.buffer,this.cursor=this.buffer.length}emitLine(r){let n=this.pendingQuestion;n?(this.pendingQuestion=void 0,n(r)):this.emit("line",r)}},ar=(t,e,r)=>(t?.write(e),r?.(),!0);function dn(t=!1){let r={createInterface:(n,s)=>{let i="input"in n&&n.input?n:{input:n,output:s},o=new cr(i.input,i.output,i);if(t){let a=o.question.bind(o);o.question=c=>new Promise(l=>a(c,void 0,l))}return o},Interface:cr,clearLine:(n,s,i)=>ar(n,s<0?"\x1B[1K":s>0?"\x1B[0K":"\x1B[2K",i),clearScreenDown:(n,s)=>ar(n,"\x1B[0J",s),cursorTo:(n,s,i,o)=>ar(n,typeof i=="number"?`\x1B[${i+1};${s+1}H`:`\x1B[${s+1}G`,typeof i=="function"?i:o),moveCursor:(n,s,i,o)=>ar(n,(s<0?`\x1B[${-s}D`:s>0?`\x1B[${s}C`:"")+(i<0?`\x1B[${-i}A`:i>0?`\x1B[${i}B`:""),o),emitKeypressEvents(n){n.__keypress||(n.__keypress=!0,n.on("data",s=>{for(let i of String(s)){let o=i==="\r"||i===`
|
|
26
|
+
`?"return":i==="\x7F"?"backspace":i===""?"c":/[a-z]/i.test(i)?i.toLowerCase():void 0;n.emit("keypress",i,{sequence:i,name:o,ctrl:i==="",meta:!1,shift:/[A-Z]/.test(i)})}}))}};return t||(r.promises=dn(!0)),r}function oi(t){let e=Array.from({length:Math.max(1,Math.min(16,globalThis.navigator?.hardwareConcurrency??4))},()=>({model:"Browser CPU",speed:2400,times:{user:0,nice:0,sys:0,idle:0,irq:0}}));return{EOL:`
|
|
27
|
+
`,devNull:"/dev/null",platform:()=>"linux",type:()=>"Linux",release:()=>"6.1.0-bfwc",version:()=>"#1 SMP BuilderForce WebContainers",machine:()=>"x86_64",arch:()=>"x64",hostname:()=>"localhost",homedir:()=>t().HOME??"/home/user",tmpdir:()=>t().TMPDIR??"/tmp",userInfo:()=>({uid:1e3,gid:1e3,username:t().USER??"user",homedir:t().HOME??"/home/user",shell:"/bin/jsh"}),cpus:()=>e,availableParallelism:()=>e.length,totalmem:()=>4*1024**3,freemem:()=>2*1024**3,loadavg:()=>[0,0,0],uptime:()=>Math.floor(performance.now()/1e3),networkInterfaces:()=>({lo:[{address:"127.0.0.1",netmask:"255.0.0.0",family:"IPv4",mac:"00:00:00:00:00:00",internal:!0,cidr:"127.0.0.1/8"}]}),endianness:()=>"LE",getPriority:()=>0,setPriority:()=>{},constants:{signals:{SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGKILL:9,SIGTERM:15},errno:{},priority:{}}}}function ai(t){return{isatty:e=>t&&e>=0&&e<=2,ReadStream:class extends R{},WriteStream:class extends R{}}}function ci(t){let e={setTimeout:(r,n,s)=>new Promise((i,o)=>{let a=t.setTimeout(()=>i(n),r);s?.signal?.addEventListener("abort",()=>{t.clearTimeout(a),o(Object.assign(new Error("The operation was aborted"),{name:"AbortError",code:"ABORT_ERR"}))})}),setImmediate:r=>new Promise(n=>t.setImmediate(()=>n(r))),async*setInterval(r,n){for(;;)await new Promise(s=>t.setTimeout(s,r)),yield n},scheduler:{wait:r=>new Promise(n=>t.setTimeout(n,r)),yield:()=>new Promise(r=>t.setImmediate(r))}};return{setTimeout:t.setTimeout,clearTimeout:t.clearTimeout,setInterval:t.setInterval,clearInterval:t.clearInterval,setImmediate:t.setImmediate,clearImmediate:t.clearImmediate,promises:e}}function li(){let t=(r,n)=>{r.encoding=(n??"utf8").toLowerCase().replace("-",""),r.encoding==="utf8"&&(r.utf8=new TextDecoder("utf-8"))};class e{constructor(n){t(this,n)}write(n){return typeof n=="string"?n:this.utf8?this.utf8.decode(n,{stream:!0}):Yr(n,this.encoding)}end(n){return(n===void 0?"":this.write(n))+(this.utf8?this.utf8.decode():"")}}return{StringDecoder:ue(e,t)}}function fi(){class t{constructor(){A(this,"store")}getStore(){return this.store}run(n,s,...i){let o=this.store;this.store=n;try{return s(...i)}finally{this.store=o}}enterWith(n){this.store=n}exit(n,...s){return this.run(void 0,n,...s)}disable(){this.store=void 0}static bind(n){return n}static snapshot(){return(n,...s)=>n(...s)}}class e{constructor(n){A(this,"type");this.type=n}runInAsyncScope(n,s,...i){return n.apply(s,i)}bind(n){return n}static bind(n){return n}emitDestroy(){return this}asyncId(){return 1}triggerAsyncId(){return 0}}return{AsyncLocalStorage:t,AsyncResource:e,createHook:()=>({enable(){return this},disable(){return this}}),executionAsyncId:()=>1,triggerAsyncId:()=>0,executionAsyncResource:()=>({})}}function ui(){let t=(r,n={})=>{let s=Object.keys(n).filter(i=>/^[A-Za-z_$][\w$]*$/.test(i));return new Function(...s,`return eval(${JSON.stringify(r)})`)(...s.map(i=>n[i]))};class e{constructor(n){A(this,"code");this.code=n}runInThisContext(){return(0,eval)(this.code)}runInNewContext(n){return t(this.code,n)}runInContext(n){return t(this.code,n)}}return{Script:e,runInThisContext:r=>(0,eval)(r),runInNewContext:t,runInContext:t,createContext:(r={})=>r,isContext:()=>!0,compileFunction:(r,n=[])=>new Function(...n,r)}}function hi(){let t=new Map,e=r=>{let n=t.get(r);if(!n){let s=new Set;n=Object.assign({subscribers:s,name:r},{get hasSubscribers(){return s.size>0},publish:i=>s.forEach(o=>o(i,r)),subscribe:i=>void s.add(i),unsubscribe:i=>s.delete(i)}),t.set(r,n)}return n};return{channel:e,hasSubscribers:r=>(t.get(r)?.subscribers.size??0)>0,subscribe:(r,n)=>e(r).subscribers.add(n),unsubscribe:(r,n)=>e(r).subscribers.delete(n),tracingChannel:r=>({start:e(`tracing:${r}:start`),end:e(`tracing:${r}:end`),error:e(`tracing:${r}:error`),traceSync:n=>n(),tracePromise:n=>n()})}}var X=t=>()=>{throw Object.assign(new Error(`${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function di(){return{perf_hooks:{performance:globalThis.performance,PerformanceObserver:class{observe(){}disconnect(){}},monitorEventLoopDelay:()=>({enable(){},disable(){},percentile:()=>0,mean:0,max:0,min:0}),constants:{}},worker_threads:{isMainThread:!0,parentPort:null,workerData:null,threadId:0,resourceLimits:{},Worker:X("worker_threads.Worker"),MessageChannel,MessagePort:globalThis.MessagePort,BroadcastChannel:globalThis.BroadcastChannel,markAsUntransferable:()=>{},SHARE_ENV:Symbol("SHARE_ENV")},dns:{lookup:(t,e,r)=>queueMicrotask(()=>(typeof e=="function"?e:r)(null,t==="localhost"?"127.0.0.1":t,4)),resolve:X("dns.resolve"),promises:{lookup:async t=>({address:t==="localhost"?"127.0.0.1":t,family:4})},setDefaultResultOrder:()=>{}},v8:{getHeapStatistics:()=>({total_heap_size:3e7,used_heap_size:2e7,heap_size_limit:2e9}),getHeapSpaceStatistics:()=>[],serialize:t=>new TextEncoder().encode(JSON.stringify(t)),deserialize:t=>JSON.parse(new TextDecoder().decode(t)),setFlagsFromString:()=>{},cachedDataVersionTag:()=>0},cluster:{isMaster:!0,isPrimary:!0,isWorker:!1,workers:{},fork:X("cluster.fork"),on:()=>{},settings:{}},inspector:{open:()=>{},close:()=>{},url:()=>{},Session:class{connect(){}post(){}disconnect(){}},console:globalThis.console},punycode:{toASCII:t=>new URL(`http://${t}`).hostname,toUnicode:t=>t,encode:t=>t,decode:t=>t,ucs2:{decode:t=>Array.from(t,e=>e.codePointAt(0)),encode:t=>String.fromCodePoint(...t)}},tls:{connect:X("tls.connect"),createServer:X("tls.createServer"),createSecureContext:()=>({}),DEFAULT_MIN_VERSION:"TLSv1.2",DEFAULT_MAX_VERSION:"TLSv1.3",rootCertificates:[]},dgram:{createSocket:X("dgram.createSocket")},http2:{connect:X("http2.connect"),createServer:X("http2.createServer"),createSecureServer:X("http2.createSecureServer"),constants:{}},trace_events:{createTracing:()=>({enable(){},disable(){}}),getEnabledCategories:()=>""},sqlite:{DatabaseSync:X("sqlite.DatabaseSync")},test:{test:X("node:test"),describe:X("node:test"),it:X("node:test")},wasi:{WASI:X("wasi.WASI")},repl:{start:X("repl.start")},domain:{create:()=>Object.assign(new R,{run:t=>t(),add(){},remove(){},bind:t=>t,intercept:t=>t,enter(){},exit(){},dispose(){}})}}}function pi(t){let{process:e,loop:r,system:n}=t,s=()=>e.env,i=di(),o={system:n,loop:r},a={assert:()=>rr(!1),"assert/strict":()=>rr(!0),async_hooks:()=>fi(),buffer:()=>Ss(),child_process:()=>ii({system:n,loop:r,cwd:()=>e.cwd(),env:s,stdout:f=>e.stdout.write(f),stderr:f=>e.stderr.write(f)}),console:()=>Object.assign(Object.create(t.console),{Console:function(){return t.console}}),constants:f=>({...me,...f("os").constants.signals}),crypto:()=>Js(),diagnostics_channel:()=>hi(),"dns/promises":f=>f("dns").promises,events:()=>Ds(),fs:()=>js({vfs:t.fs,cwd:()=>e.cwd(),stdout:t.io.stdout,stderr:t.io.stderr,hold:()=>r.hold()}),"fs/promises":f=>f("fs").promises,http:()=>un(o,"http:"),https:()=>un(o,"https:"),net:()=>ni(o),os:()=>oi(s),path:()=>Ns(()=>e.cwd()),"path/posix":f=>f("path"),"path/win32":f=>f("path"),process:()=>e,querystring:()=>qs(),readline:()=>dn(),"readline/promises":f=>f("readline").promises,stream:()=>Fs(),"stream/promises":f=>f("stream").promises,"stream/web":()=>({ReadableStream,WritableStream,TransformStream,TextEncoderStream,TextDecoderStream,ByteLengthQueuingStrategy,CountQueuingStrategy}),"stream/consumers":()=>({text:async f=>{let u="";for await(let h of f)u+=typeof h=="string"?h:new TextDecoder().decode(h);return u},json:async f=>{let u="";for await(let h of f)u+=typeof h=="string"?h:new TextDecoder().decode(h);return JSON.parse(u)}}),string_decoder:()=>li(),sys:f=>f("util"),timers:()=>ci(r),"timers/promises":f=>f("timers").promises,tty:()=>ai(!!t.io.terminal),url:f=>Ws(f("querystring")),util:()=>$s(s,f=>e.stderr.write(f+`
|
|
28
|
+
`)),"util/types":()=>tt,vm:()=>ui(),zlib:()=>Ys()};for(let[f,u]of Object.entries(i))a[f]??(a[f]=()=>u);let c=new Map,l=f=>{if(c.has(f))return c.get(f);let u=a[f];if(!u)throw Object.assign(new Error(`No such built-in module: ${f}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});let h=u(l);return c.set(f,h),h};return{names:[...Object.keys(a),"module"].sort(),isBuiltin:f=>f==="module"||f in a,get:l,fetch:fn(o)}}var mi=Br,pn=Symbol.for("bfwc.esm"),Ka=/^[\p{L}_$][\p{L}\p{N}_$]*$/u;function wi(t){return/(?:^|[\s;})])(?:import\s*[\w{*'"]|export\s+|export\s*[{*])/.test(t)}function yi(t){try{let[e,r]=Rt(t);return r.length>0||e.some(n=>n.t===1||n.t===3)}catch{return!1}}function Ai(t){return t.split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let r=/^(?:type\s+)?("[^"]*"|'[^']*'|[^\s]+)(?:\s+as\s+("[^"]*"|'[^']*'|[^\s]+))?$/.exec(e);if(!r)throw new SyntaxError(`Cannot parse import/export list entry "${e}"`);let n=s=>/^["']/.test(s)?s.slice(1,-1):s;return[n(r[1]),n(r[2]??r[1])]})}var Ha=(t,e)=>Ka.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;function Ja(t,e){let r=[],n=0;for(let s=e;s<t.length;s++){let i=t[s];if(i==='"'||i==="'"||i==="`"){let o=i;for(s++;s<t.length&&t[s]!==o;s++)t[s]==="\\"&&s++;continue}if(i==="("||i==="["||i==="{")n++;else if(i===")"||i==="]"||i==="}")n--;else{if(n===0&&i===";")break;if(n===0&&i===`
|
|
29
|
+
`){let o=t.slice(e,s).trimEnd(),a=t.slice(s+1).trimStart();if(!/[,=+\-*/%&|^?:(]$/.test(o)&&!/^[,.=+\-*/%&|^?:)]/.test(a))break}else if(n===0&&i===","){let o=/^\s*([\p{L}_$][\p{L}\p{N}_$]*)/u.exec(t.slice(s+1));o&&r.push(o[1])}}if(n<0)break}return r}var gi=t=>!!t&&/[\p{L}\p{N}_$]/u.test(t);function qa(t,e){for(let r=t.lastIndexOf("export",e-1);r>=0;r=t.lastIndexOf("export",r-1))if(!gi(t[r-1])&&!gi(t[r+6]))return r;return-1}function An(t){let[e,r]=Rt(t),n=[],s=new Map,i=new Set,o=new Set,a=0,c=h=>`__bfwc_import(${JSON.stringify(h)})`;for(let h of e){if(h.t===2){n.push({start:h.ss,end:h.d,text:"__bfwc_dynamic"});continue}if(h.t===3){n.push({start:h.s,end:h.e,text:"__bfwc_meta"});continue}if(h.t!==1||h.n===void 0)continue;let d=t.slice(h.ss,h.se),g=`__bfwc_m${a++}`,m=`const ${g} = ${c(h.n)};`;if(d.startsWith("export")){o.add(h.ss);let b=/^export\s*\*\s*as\s+("[^"]*"|'[^']*'|[^\s]+)/.exec(d);if(b)s.set(b[1].replace(/^["']|["']$/g,""),g);else if(/^export\s*\*/.test(d))n.push({start:h.ss,end:h.se,text:`${m} __bfwc_star(exports, ${g});`});else for(let[w,v]of Ai(/\{([^}]*)\}/.exec(d)?.[1]??""))s.set(v,Ha(g,w));n.some(w=>w.start===h.ss)||n.push({start:h.ss,end:h.se,text:m});continue}let E=/^import\s*([\s\S]*?)\s*from\s*["']/.exec(d)?.[1];if(E===void 0){n.push({start:h.ss,end:h.se,text:`${c(h.n)};`});continue}let p=[m],C=/\{([\s\S]*)\}/.exec(E),y=E.replace(/\{[\s\S]*\}/,"").split(",").map(b=>b.trim()).filter(Boolean);for(let b of y){let w=/^\*\s*as\s+(\S+)$/.exec(b);w?p.push(`const ${w[1]} = ${g};`):p.push(`const ${b} = __bfwc_get(${g}, "default");`)}if(C)for(let[b,w]of Ai(C[1]))p.push(`const ${w} = __bfwc_get(${g}, ${JSON.stringify(b)});`);n.push({start:h.ss,end:h.se,text:p.join(" ")})}let l=new Map;for(let h of r){let d=qa(t,h.s);if(d<0||o.has(d))continue;let g=t.slice(d+6,h.s);if(/^\s*\{/.test(g)){if(!l.has(d)){let E=t.indexOf("}",d)+1,p=/^\s*;/.exec(t.slice(E));p&&(E+=p[0].length),l.set(d,E),n.push({start:d,end:E,text:""})}s.set(h.n,h.ln??h.n);continue}if(h.n==="default"&&t.startsWith("default",h.s)&&!g.trim()){h.ln&&h.ls>=0?(n.push({start:d,end:h.e,text:""}),s.set("default",h.ln)):(n.push({start:d,end:h.e,text:"const __bfwc_default ="}),s.set("default","__bfwc_default"));continue}if(!i.has(d)&&(i.add(d),n.push({start:d,end:d+6,text:""}),/^\s*(const|let|var)\b/.exec(g)))for(let E of Ja(t,h.e))s.set(E,E);s.set(h.n,h.ln??h.n)}n.sort((h,d)=>d.start-h.start);let f=t;for(let h of n)f=f.slice(0,h.start)+h.text+f.slice(h.end);return`"use strict";__bfwc_esm(exports, { ${[...s].map(([h,d])=>`${JSON.stringify(h)}: () => ${d}`).join(", ")} });${f}`}var fr=["node","require","default"],gn=["node","import","default"],Ci=[".js",".json",".cjs",".mjs",".node"];function It(t,e){let r=new Error(`Cannot find module '${t}'${e?`
|
|
30
|
+
Require stack:
|
|
31
|
+
- ${e}`:""}`);return r.code="MODULE_NOT_FOUND",e&&(r.requireStack=[e]),r}function mn(t,e){let r=t.readText(S(e,"package.json"));if(r!==void 0)try{return JSON.parse(r)}catch{return}}function ot(t,e){for(let r=x(e);;r=T(r)){if(!r.endsWith("/node_modules")){let n=mn(t,r);if(n)return{dir:r,pkg:n}}if(r==="/")return}}function wn(t,e){if(t.isFile(e))return e;for(let r of Ci)if(t.isFile(e+r))return e+r}function Ei(t,e){for(let r of Ci)if(t.isFile(S(e,"index"+r)))return S(e,"index"+r)}function vi(t,e){if(!t.isDirectory(e))return;let r=mn(t,e)?.main;if(typeof r=="string"&&r){let n=S(e,r),s=wn(t,n)??Ei(t,n);if(s)return s}return Ei(t,e)}function Qi(t,e){return wn(t,e)??vi(t,e)}function lr(t,e,r){if(typeof t=="string")return t.replace(/\*/g,e);if(Array.isArray(t)){for(let n of t){let s=lr(n,e,r);if(s!==void 0)return s}return}if(t&&typeof t=="object"){for(let[n,s]of Object.entries(t)){if(n!=="default"&&!r.includes(n))continue;let i=lr(s,e,r);if(i!==void 0)return i}return}return t===null?null:void 0}function Bi(t,e,r){let s=typeof t=="string"||Array.isArray(t)||t&&typeof t=="object"&&!Object.keys(t).some(a=>a.startsWith(".")||a.startsWith("#"))?{".":t}:t;if(!s||typeof s!="object")return;if(Object.prototype.hasOwnProperty.call(s,e)&&!e.includes("*"))return lr(s[e],"",r);let i;for(let a of Object.keys(s)){let c=a.indexOf("*");if(c>=0){let l=a.slice(0,c),f=a.slice(c+1);e.startsWith(l)&&e.length>=a.length-1&&e.endsWith(f)&&(!i||l.length>i.key.indexOf("*"))&&(i={key:a,match:e.slice(l.length,e.length-f.length)})}else a.endsWith("/")&&e.startsWith(a)&&(!i||a.length>i.key.length)&&(i={key:a,match:""})}if(!i)return;let o=lr(s[i.key],i.match,r);return o&&i.key.endsWith("/")&&!i.key.includes("*")?o+e.slice(i.key.length):o}function Wa(t,e){let r=new Error(`Package subpath '${e}' is not defined by "exports" in /node_modules/${t}/package.json`);return r.code="ERR_PACKAGE_PATH_NOT_EXPORTED",r}function bi(t,e,r,n,s,i,o){let a=mn(t,e);if(a?.exports!==void 0&&a.exports!==null){let l=n?`.${n}`:".",f=Bi(a.exports,l,s);if(!f)throw Wa(r,l);let u=S(e,f);if(t.isFile(u))return u;throw It(i,o)}let c=Qi(t,S(e,n||"."));if(!c)throw It(i,o);return c}function ur(t,e,r,n){let{conditions:s,from:i}=n;if(e.startsWith("node:")){let u=e.slice(5);if(!n.isBuiltin(u))throw Object.assign(new Error(`No such built-in module: ${e}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});return{builtin:u}}if(n.isBuiltin(e))return{builtin:e};if(e.startsWith("#")){let u=ot(t,r),h=u?.pkg.imports?Bi(u.pkg.imports,e,s):void 0;if(!h||!u)throw Object.assign(new Error(`Package import specifier "${e}" is not defined${u?` in package ${u.dir}/package.json`:""}`),{code:"ERR_PACKAGE_IMPORT_NOT_DEFINED"});if(!h.startsWith("./"))return ur(t,h,u.dir,n);let d=S(u.dir,h);if(t.isFile(d))return{path:d};throw It(e,i)}if(e==="."||e===".."||e.startsWith("./")||e.startsWith("../")||e.startsWith("/")){let u=e.startsWith("/")?x(e):S(r,e),h=e.endsWith("/")?vi(t,u):Qi(t,u);if(!h)throw It(e,i);return{path:h}}let{name:o,subpath:a}=Dn(e),c=ot(t,r);if(c?.pkg.name===o&&c.pkg.exports!==void 0)return{path:bi(t,c.dir,o,a,s,e,i)};let l=n.paths??[],f=[];for(let u=x(r);u.endsWith("/node_modules")||f.push(S(u,"node_modules")),u!=="/";u=T(u));for(let u of l)f.push(u.endsWith("node_modules")?u:S(u,"node_modules"));for(let u of f){let h=S(u,o);if(t.isDirectory(h)||t.isFile(h+".js")||t.isFile(h+".json"))return t.isDirectory(h)?{path:bi(t,h,o,a,s,e,i)}:{path:wn(t,h)}}throw It(e,i)}function hr(t){let e=[];for(let r=x(t);;r=T(r))if(r.endsWith("/node_modules")||e.push(S(r,"node_modules")),r==="/")return e}var za=Object.getPrototypeOf(async()=>{}).constructor;function dr(t){let e=t.charCodeAt(0)===65279?t.slice(1):t;return e.startsWith("#!")?"//"+e.slice(2):e}function Ii(t){let{fs:e}=t,r=Object.create(null),n=new WeakMap,s=Object.keys(t.globals),i=s.map(g=>t.globals[g]),o;function a(g,m){let E=ht(g);return E===".mjs"?!0:E===".cjs"?!1:ot(e,T(g))?.pkg.type==="module"?!0:wi(m)&&yi(m)}function c(g){if(g&&g[pn])return g;if(typeof g!="object"&&typeof g!="function"||g===null)return{default:g};let m=n.get(g);if(!m){m=Object.create(null);for(let E of Object.keys(g))E!=="default"&&Object.defineProperty(m,E,{enumerable:!0,get:()=>g[E]});Object.defineProperty(m,"default",{enumerable:!0,value:g}),n.set(g,m)}return m}let d=class d{constructor(m="",E=void 0){A(this,"parent");A(this,"id");A(this,"filename");A(this,"path");A(this,"exports",{});A(this,"loaded",!1);A(this,"children",[]);A(this,"paths");A(this,"__tla");this.parent=E,this.id=m,this.filename=m,this.path=T(m||"/"),this.paths=hr(this.path),E?.children.push(this)}static _resolveFilename(m,E,p,C){let y=E?.filename?T(E.filename):t.globals.process?.cwd()??"/",b=ur(e,m,y,{conditions:C?.conditions??fr,isBuiltin:t.isBuiltin,from:E?.filename,paths:C?.paths});return"builtin"in b?`node:${b.builtin}`:b.path}static _load(m,E,p=!1){let C=d._resolveFilename(m,E,p);return u(C,E,p).exports}require(m){if(typeof m!="string"||!m)throw new TypeError('The "id" argument must be a non-empty string');return d._load(m,this,!1)}_compile(m,E,p=!1){let C=h(this),y=T(E),b=["exports","require","module","__filename","__dirname",...s],w=[this.exports,C,this,E,y,...i];p&&(b.push("__bfwc_import","__bfwc_dynamic","__bfwc_meta","__bfwc_esm","__bfwc_star","__bfwc_get"),w.push(...f(this,E)));let v=`${dr(m)}
|
|
32
|
+
//# sourceURL=${encodeURI("file://"+E)}`,B;try{B=new Function(...b,v)}catch(I){if(p&&I instanceof SyntaxError&&/await/.test(I.message))B=new za(...b,v);else throw I instanceof Error&&(I.message=`${E}: ${I.message}`),I}let Q=B.apply(this.exports,w);return Q instanceof Promise&&(this.__tla=Q),Q}};A(d,"_cache",r),A(d,"_pathCache",Object.create(null)),A(d,"builtinModules",[]),A(d,"globalPaths",["/usr/local/lib/node"]),A(d,"Module",d),A(d,"_extensions",{".js"(m,E){let p=e.readText(E)??"";a(E,p)?m._compile(An(dr(p)),E,!0):m._compile(p,E)},".cjs"(m,E){m._compile(e.readText(E)??"",E)},".mjs"(m,E){m._compile(An(dr(e.readText(E)??"")),E,!0)},".json"(m,E){try{m.exports=JSON.parse(dr(e.readText(E)??""))}catch(p){throw p.message=`${E}: ${p.message}`,p}},".node"(m,E){throw Object.assign(new Error(`Native addons cannot run in the browser: ${E}`),{code:"ERR_DLOPEN_FAILED"})}}),A(d,"_nodeModulePaths",hr),A(d,"isBuiltin",m=>t.isBuiltin(m.replace(/^node:/,""))),A(d,"createRequire",m=>{let E=typeof m=="string"?m.replace(/^file:\/\//,""):decodeURIComponent(m.pathname);return h(new d(E.endsWith("/")?E+"__entry.js":E))}),A(d,"wrap",m=>`(function (exports, require, module, __filename, __dirname) { ${m}
|
|
33
|
+
});`),A(d,"wrapper",["(function (exports, require, module, __filename, __dirname) { ",`
|
|
34
|
+
});`]),A(d,"syncBuiltinESMExports",()=>{}),A(d,"register",()=>{}),A(d,"findSourceMap",()=>{}),A(d,"runMain",()=>{});let l=d;function f(g,m){let E=B=>{let Q;try{Q=l._resolveFilename(B,g,!1,{conditions:fr})}catch(I){if(I.code!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw I;Q=l._resolveFilename(B,g,!1,{conditions:gn})}return u(Q,g,!1)},p=B=>c(E(B).exports),C={url:"file://"+m,filename:m,dirname:T(m),resolve:B=>{let Q=l._resolveFilename(B,g,!1,{conditions:gn});return Q.startsWith("node:")?Q:"file://"+Q}};return[p,async B=>{let Q=E(String(B));return Q.__tla&&await Q.__tla,c(Q.exports)},C,(B,Q)=>{Object.defineProperty(B,"__esModule",{value:!0}),Object.defineProperty(B,pn,{value:!0});for(let[I,N]of Object.entries(Q))Object.defineProperty(B,I,{enumerable:!0,configurable:!0,get:N})},(B,Q)=>{for(let I of Object.keys(Q))I==="default"||I==="__esModule"||Object.prototype.hasOwnProperty.call(B,I)||Object.defineProperty(B,I,{enumerable:!0,configurable:!0,get:()=>Q[I]})},(B,Q)=>{try{return B[Q]}catch{return}}]}function u(g,m,E){if(g.startsWith("node:")){let y=g.slice(5);return{exports:y==="module"?l:t.builtin(y)}}let p=r[g];if(p)return m&&!m.children.includes(p)&&m.children.push(p),p;let C=new l(g,m??null);E&&(o=C,C.id="."),r[g]=C;try{(l._extensions[ht(g)]??l._extensions[".js"])(C,g)}catch(y){throw delete r[g],y}return C.loaded=!0,C}function h(g){let m=p=>g.require(p),E=(p,C)=>{let y=l._resolveFilename(p,g,!1,C);return y.startsWith("node:")&&!p.startsWith("node:")?p:y};return E.paths=p=>t.isBuiltin(p)?null:hr(g.path),m.resolve=E,m.cache=r,m.extensions=l._extensions,Object.defineProperty(m,"main",{get:()=>o,enumerable:!0}),m}return{Module:l,cache:r,runMain(g){return u(g,void 0,!0)},get main(){return o},createRequire:l.createRequire,resolve(g,m){return ur(e,g,m,{conditions:fr,isBuiltin:t.isBuiltin})}}}var yn=globalThis.setTimeout.bind(globalThis),Ga=globalThis.clearTimeout.bind(globalThis),Ya=globalThis.setInterval.bind(globalThis),Va=globalThis.clearInterval.bind(globalThis),Za=1,En=class{constructor(e,r,n,s,i){A(this,"loop");A(this,"_onTimeout");A(this,"_idleTimeout");A(this,"args");A(this,"_repeat");A(this,"_id",Za++);A(this,"_ref",!0);A(this,"_handle");A(this,"_destroyed",!1);this.loop=e,this._onTimeout=r,this._idleTimeout=n,this.args=s,this._repeat=i}ref(){return!this._ref&&!this._destroyed&&this.loop._refChanged(this,!0),this._ref=!0,this}unref(){return this._ref&&!this._destroyed&&this.loop._refChanged(this,!1),this._ref=!1,this}hasRef(){return this._ref}refresh(){return this._destroyed||this.loop._arm(this),this}close(){return this.loop.clear(this),this}[Symbol.toPrimitive](){return this._id}_fire(){this.loop._run(()=>this._onTimeout(...this.args))}},pr=class{constructor(e){A(this,"options");A(this,"holds",0);A(this,"timers",new Map);A(this,"refTimers",0);A(this,"checkScheduled",!1);A(this,"stopped",!1);A(this,"setTimeout",(e,r,...n)=>this.add(e,r,n,!1));A(this,"setInterval",(e,r,...n)=>this.add(e,r,n,!0));A(this,"setImmediate",(e,...r)=>this.add(e,0,r,!1));A(this,"clearTimeout",e=>this.clear(e));A(this,"clearInterval",e=>this.clear(e));A(this,"clearImmediate",e=>this.clear(e));this.options=e}hold(){if(this.stopped)return()=>{};this.holds++;let e=!1;return()=>{e||(e=!0,this.holds--,this.scheduleCheck())}}_run(e){if(!this.stopped)try{e()}catch(r){this.options.onError(r)}}get alive(){return this.holds>0||this.refTimers>0}clear(e){let r=typeof e=="object"&&e?e._id:Number(e),n=this.timers.get(r);n&&(this.disarm(n),this.timers.delete(r),n._destroyed=!0,n._ref&&(this.refTimers--,this.scheduleCheck()))}scheduleCheck(){this.checkScheduled||this.stopped||(this.checkScheduled=!0,yn(()=>{yn(()=>{this.checkScheduled=!1,!this.alive&&!this.stopped&&this.options.onIdle()},0)},0))}stop(){this.stopped=!0;for(let e of this.timers.values())this.disarm(e);this.timers.clear()}_refChanged(e,r){this.refTimers+=r?1:-1,r||this.scheduleCheck()}_arm(e){this.disarm(e);let r=Math.max(0,e._idleTimeout);e._repeat?e._handle=Ya(()=>e._fire(),Math.max(1,r)):e._handle=yn(()=>{this.timers.delete(e._id),e._destroyed=!0,e._ref&&this.refTimers--,e._fire(),e._ref&&this.scheduleCheck()},r)}add(e,r,n,s){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let i=new En(this,e,Number.isFinite(r)?Number(r):1,n,s);return this.stopped||(this.timers.set(i._id,i),this.refTimers++,this._arm(i)),i}disarm(e){e._handle!==void 0&&(e._repeat?Va(e._handle):Ga(e._handle),e._handle=void 0)}};var St="20.18.0",at=class{constructor(e){A(this,"code");this.code=e}},Xa=100,Ar=class extends Z{constructor(r,n,s){super({decodeStrings:!1});A(this,"sink");A(this,"isTTY");A(this,"fd");A(this,"columns");A(this,"rows");this.sink=n,this.fd=r,this.isTTY=!!s,s&&(this.columns=s.cols,this.rows=s.rows,s.onResize((i,o)=>{this.columns=i,this.rows=o,this.emit("resize")}))}_write(r,n,s){this.sink(r),s()}write(r,n,s){return typeof n=="function"&&(s=n),this.sink(typeof r=="string"||r instanceof Uint8Array?r:String(r)),typeof s=="function"&&queueMicrotask(s),!0}getColorDepth(){return this.isTTY?8:1}hasColors(r=16){return this.isTTY&&r<=256}getWindowSize(){return[this.columns??80,this.rows??24]}cursorTo(r,n,s){return this.write(typeof n=="number"?`\x1B[${n+1};${r+1}H`:`\x1B[${r+1}G`),(typeof n=="function"?n:s)?.(),!0}moveCursor(r,n,s){return this.write((r<0?`\x1B[${-r}D`:r>0?`\x1B[${r}C`:"")+(n<0?`\x1B[${-n}A`:n>0?`\x1B[${n}B`:"")),s?.(),!0}clearLine(r=0,n){return this.write(r<0?"\x1B[1K":r>0?"\x1B[0K":"\x1B[2K"),n?.(),!0}clearScreenDown(r){return this.write("\x1B[0J"),r?.(),!0}},bn=class extends V{constructor(r,n){super({encoding:"utf8"});A(this,"io");A(this,"loop");A(this,"isTTY");A(this,"isRaw",!1);A(this,"fd",0);A(this,"subscription");A(this,"release");this.io=r,this.loop=n,this.isTTY=!!r.terminal}_read(){this.listen()}resume(){return this.listen(),super.resume()}pause(){return this.stopListening(),super.pause()}setRawMode(r){return this.isRaw=r,this.io.terminal?.setRawMode(r),this}ref(){return this.subscription&&!this.release&&(this.release=this.loop.hold()),this}unref(){return this.release?.(),this.release=void 0,this}listen(){this.subscription||(this.release=this.loop.hold(),this.subscription=this.io.onStdin(r=>{r===null?(this.stopListening(),this.push(null)):this.push(r)}))}stopListening(){this.subscription?.(),this.subscription=void 0,this.release?.(),this.release=void 0}};function Si(t){let{io:e,loop:r,fs:n}=t,s=x(t.cwd),i=!1,o=performance.now(),a=new R,c=Xa++,l=h=>{if(h!==void 0&&(a.exitCode=h),!i){i=!0;let d=Number(a.exitCode??0)||0;try{a.emit("exit",d)}catch{}t.onExit(Number(a.exitCode??d)||0)}throw new at(Number(a.exitCode??0)||0)},f=h=>{let d=performance.now(),g=Math.floor(d/1e3),m=Math.floor(d%1e3*1e6);return h&&(g-=h[0],m-=h[1],m<0&&(g--,m+=1e9)),[g,m]};f.bigint=()=>BigInt(Math.floor(performance.now()*1e6));let u=()=>({rss:5e7,heapTotal:3e7,heapUsed:2e7,external:1e6,arrayBuffers:1e5});return u.rss=()=>5e7,Object.assign(a,{title:"node",version:`v${St}`,versions:{node:St,v8:"11.3.244.8-node.23",uv:"1.48.0",zlib:"1.3.0.1",modules:"115",napi:"9",unicode:"15.1"},release:{name:"node",lts:"Iron"},platform:"linux",arch:"x64",pid:c,ppid:c-1,argv:t.argv,argv0:"node",execPath:"/usr/local/bin/node",execArgv:[],env:t.env,exitCode:void 0,config:{variables:{}},features:{inspector:!1,ipv6:!0,tls:!0,typescript:!1},allowedNodeEnvironmentFlags:new Set,stdout:new Ar(1,e.stdout,e.terminal),stderr:new Ar(2,e.stderr,e.terminal),stdin:new bn(e,r),cwd:()=>s,chdir(h){let d=h.startsWith("/")?x(h):S(s,h);if(!n.isDirectory(d))throw D(n.isFile(d)?"ENOTDIR":"ENOENT","chdir",d);s=d},exit:l,reallyExit:l,abort:()=>l(134),kill(h,d="SIGTERM"){if(h!==c)throw Object.assign(new Error("kill ESRCH"),{code:"ESRCH"});return a.listenerCount(String(d))?a.emit(String(d),String(d)):l(143),!0},nextTick(h,...d){queueMicrotask(()=>r._run(()=>h(...d)))},hrtime:f,memoryUsage:u,cpuUsage:()=>({user:Math.floor((performance.now()-o)*1e3),system:0}),resourceUsage:()=>({userCPUTime:0,systemCPUTime:0,maxRSS:5e4}),uptime:()=>(performance.now()-o)/1e3,umask:()=>18,getuid:()=>1e3,geteuid:()=>1e3,getgid:()=>1e3,getegid:()=>1e3,getgroups:()=>[1e3],emitWarning(h,d){let g=typeof d=="string"?d:d?.type??(h instanceof Error?h.name:"Warning"),m=h instanceof Error?h.message:h;a.emit("warning",Object.assign(new Error(m),{name:g})),e.stderr(`(node:${c}) ${g}: ${m}
|
|
35
|
+
`)},binding(h){throw new Error(`No such module: ${h}`)},getActiveResourcesInfo:()=>[],setUncaughtExceptionCaptureCallback:()=>{},hasUncaughtExceptionCaptureCallback:()=>!1,setSourceMapsEnabled:()=>{},report:{getReport:()=>({header:{glibcVersionRuntime:"2.36"}})},connected:!1}),a}function ki(t){let e=c=>(...l)=>t[c].write(Be(...l)+`
|
|
36
|
+
`),r=new Map,n=new Map,s="",i=c=>(...l)=>s?c(s+Be(...l).replace(/\n/g,`
|
|
37
|
+
`+s)):c(...l),o=i(e("stdout")),a=i(e("stderr"));return{log:o,info:o,debug:o,warn:a,error:a,trace:(...c)=>a(`Trace: ${Be(...c)}
|
|
38
|
+
${new Error().stack?.split(`
|
|
39
|
+
`).slice(2).join(`
|
|
40
|
+
`)??""}`),dir:c=>o(c),dirxml:o,table:c=>o(c),assert:(c,...l)=>{c||a("Assertion failed"+(l.length?`: ${Be(...l)}`:""))},count:(c="default")=>{r.set(c,(r.get(c)??0)+1),o(`${c}: ${r.get(c)}`)},countReset:(c="default")=>void r.delete(c),group:(...c)=>{c.length&&o(...c),s+=" "},groupCollapsed:(...c)=>{c.length&&o(...c),s+=" "},groupEnd:()=>void(s=s.slice(2)),time:(c="default")=>void n.set(c,performance.now()),timeLog:(c="default",...l)=>o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`,...l),timeEnd:(c="default")=>{o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`),n.delete(c)},clear:()=>{},profile:()=>{},profileEnd:()=>{},timeStamp:()=>{}}}var ec={SIGINT:130,SIGTERM:143,SIGKILL:137,SIGHUP:129};async function xi(t){await mi;let{system:e,io:r}=t,n,s=new Promise(C=>n=C),i=!1,o=new Set,a={...e,listen(C,y){let b=e.listen(C,y),w={port:b.port,close(){o.delete(w),b.close()}};return o.add(w),w}},c=C=>{if(!i){i=!0,u.stop();for(let y of[...o])y.close();n(C)}},l=C=>{if(C instanceof at||i)return;if(h.listenerCount("uncaughtException"))try{h.emit("uncaughtException",C,"uncaughtException");return}catch(b){C=b}let y=C instanceof Error?C.stack??`${C.name}: ${C.message}`:`Uncaught ${P(C)}`;r.stderr(`${y}
|
|
41
|
+
|
|
42
|
+
Node.js v${h.versions.node}
|
|
43
|
+
`),f(h.exitCode&&h.exitCode!==0?h.exitCode:1)},f=C=>{try{h.exit(C)}catch(y){if(!(y instanceof at))throw y}},u=new pr({onIdle(){if(!i){try{h.emit("beforeExit",Number(h.exitCode??0))}catch(C){l(C)}u.alive||f()}},onError:l}),h=Si({argv:["/usr/local/bin/node",...t.argv],env:t.env,cwd:t.cwd,fs:e.fs,io:r,loop:u,onExit:c}),d=ki(h),g=pi({fs:e.fs,process:h,loop:u,system:a,io:r,console:d}),m={process:h,Buffer:k,console:d,setTimeout:u.setTimeout,setInterval:u.setInterval,setImmediate:u.setImmediate,clearTimeout:u.clearTimeout,clearInterval:u.clearInterval,clearImmediate:u.clearImmediate,fetch:g.fetch};t.installGlobals?(Object.assign(globalThis,m,{global:globalThis}),m.global=globalThis):m.global=Object.assign(Object.create(globalThis),m),m.globalThis=m.global;let E=Ii({fs:e.fs,isBuiltin:g.isBuiltin,builtin:g.get,globals:m});return E.Module.builtinModules=g.names,Object.defineProperty(h,"mainModule",{get:()=>E.main,configurable:!0}),{process:h,modules:E,exit:s,run:C=>{if(!i){try{let y=C();y instanceof Promise&&y.catch(l).finally(()=>u.scheduleCheck())}catch(y){l(y)}u.scheduleCheck()}},kill(C="SIGTERM"){if(!i){if(C!=="SIGKILL"&&h.listenerCount(C)){u._run(()=>h.emit(C,C));return}c(ec[C]??1)}},reportUncaught:l,hold:()=>u.hold()}}var tc=new Set(["-r","--require","--import","--loader","--experimental-loader","-C","--conditions","--input-type","--title","--env-file","--stack-size"]);function rc(t){let e={args:[],preload:[],envFiles:[]};for(let r=0;r<t.length;r++){let n=t[r];if(n==="--"){[e.entry,...e.args]=t.slice(r+1);break}if(!n.startsWith("-")||n==="-"){e.entry=n,e.args=t.slice(r+1);break}let[s,i]=n.includes("=")?[n.slice(0,n.indexOf("=")),n.slice(n.indexOf("=")+1)]:[n,void 0],o=()=>i??t[++r]??"";s==="-v"||s==="--version"?e.version=!0:s==="-h"||s==="--help"?e.help=!0:s==="-e"||s==="--eval"?e.evaluate=o():s==="-p"||s==="--print"?(e.evaluate=o(),e.print=!0):s==="-r"||s==="--require"||s==="--import"?e.preload.push(o()):s==="--env-file"?e.envFiles.push(o()):tc.has(s)&&i===void 0&&r++}return e.evaluate!==void 0&&e.entry!==void 0&&(e.args=[e.entry,...e.args],e.entry=void 0),e}var nc=`Usage: node [options] [ script.js ] [arguments]
|
|
44
|
+
node -e "script" evaluate script
|
|
45
|
+
node -p "expr" evaluate and print
|
|
46
|
+
Options: -v, -r <module>, --env-file=<file>. Running in BuilderForce WebContainers.
|
|
47
|
+
`;async function sc(t){let e="";return await new Promise(r=>{let n=t.io.onStdin(s=>{s===null?(n(),r()):e+=s})}),e}function ic(t,e){let{io:r}=e,n=Di(t,e.cwd,"[repl]","(function* () { let __r; while (true) { const __line = yield __r; try { __r = { value: eval(__line) }; } catch (e) { __r = { error: e }; } } })()");n.next();let s=t.hold();r.stdout(`Welcome to Node.js v${St}.
|
|
48
|
+
Type ".exit" to leave.
|
|
49
|
+
> `);let i=()=>{o(),s(),t.run(()=>t.process.exit(0))},o=r.onStdin(a=>{if(a===null)return i();for(let c of a.split(/\r?\n/)){let l=c.trim();if(!l)continue;if(l===".exit")return i();let f=n.next(l.replace(/^(const|let)\s/,"var ")).value;"error"in f?r.stdout(`Uncaught ${f.error instanceof Error?f.error.stack??f.error.message:P(f.error)}
|
|
50
|
+
`):r.stdout(P(f.value,{colors:!1})+`
|
|
51
|
+
`)}r.stdout("> ")})}function Di(t,e,r,n){let s=S(e,r);return new t.modules.Module(s)._compile(`return eval(${JSON.stringify(n)});`,s)}var Oi=async t=>{let e=rc(t.args);if(e.version)return t.io.stdout(`v${St}
|
|
52
|
+
`),0;if(e.help)return t.io.stdout(nc),0;let r={...t.env};for(let f of e.envFiles){let u=t.system.fs.readText(S(t.cwd,f));if(u===void 0)return t.io.stderr(`node: ${f}: not found
|
|
53
|
+
`),9;Object.assign(r,xn(u))}let n;e.entry!==void 0&&e.entry!=="-"&&(n=e.entry.startsWith("/")?e.entry:S(t.cwd,e.entry),n=Kt(t.system.fs,n)??n);let s=e.evaluate??(e.entry==="-"||!n&&!t.io.terminal?await sc(t):void 0),i=n??(s!==void 0?"[eval]":void 0),o=await xi({system:t.system,io:t.io,cwd:t.cwd,env:r,installGlobals:t.system.ownsRealm,argv:i&&i!=="[eval]"?[i,...e.args]:e.args}),a=()=>o.kill(typeof t.signal.reason=="string"?t.signal.reason:"SIGTERM");t.signal.aborted&&a(),t.signal.addEventListener("abort",a);let c=t.system.trapUncaught?.(f=>o.reportUncaught(f));o.run(()=>{let f=o.modules.createRequire(S(t.cwd,"[eval]"));for(let u of e.preload)f(u.startsWith(".")?S(t.cwd,u):u);if(n){let u;try{u=o.modules.Module._resolveFilename(n,void 0)}catch(h){throw h.code==="MODULE_NOT_FOUND"?Object.assign(new Error(`Cannot find module '${n}'`),{code:"MODULE_NOT_FOUND",requireStack:[]}):h}return o.modules.runMain(u).__tla}if(s!==void 0){let u=Di(o,t.cwd,"[eval]",s);e.print&&o.process.stdout.write(P(u)+`
|
|
54
|
+
`);return}ic(o,t)});let l=await o.exit;return t.signal.removeEventListener("abort",a),c?.(),l};var H=class extends Error{constructor(r,n=!1){super(r);A(this,"incomplete");this.incomplete=n}},oc=["2>&1",">&2","2>>","&&","||",">>","2>","&>","|","&",";",">","<",`
|
|
55
|
+
`],ac=/^[?$#@*!0-9]/;function cc(t,e){let r=1;for(let n=e;n<t.length;n++){let s=t[n];if(s==="\\")n++;else if(s==="'")n=t.indexOf("'",n+1)<0?t.length:t.indexOf("'",n+1);else if(s==='"')for(n++;n<t.length&&t[n]!=='"';n++)t[n]==="\\"&&n++;else if(s==="(")r++;else if(s===")"&&--r===0)return n}throw new H("unexpected end of input: missing )",!0)}function Ni(t,e,r){let n=t[e+1];if(n==="("){let i=cc(t,e+2);return[{kind:"cmd",source:t.slice(e+2,i),quoted:r},i+1]}if(n==="{"){let i=t.indexOf("}",e+2);if(i<0)throw new H("unexpected end of input: missing }",!0);let o=t.slice(e+2,i),a=/^([A-Za-z_][\w]*|[?$#@*!0-9])(?:(:-|-|:=|:\+)(.*))?$/s.exec(o);if(!a)throw new H(`bad substitution: \${${o}}`);let c={kind:"var",name:a[1],quoted:r};return a[2]&&(c.op=a[2],c.arg=lc(a[3]??"",r)),[c,i+1]}if(n&&ac.test(n))return[{kind:"var",name:n,quoted:r},e+2];let s=/^[A-Za-z_]\w*/.exec(t.slice(e+1));return s?[{kind:"var",name:s[0],quoted:r},e+1+s[0].length]:[{kind:"text",value:"$",quoted:r},e+1]}function lc(t,e){let r=Ri(t,!0),n=[];for(let s of r)s.type==="word"&&n.push(...s.word.map(i=>i.kind==="tilde"?i:{...i,quoted:e||"quoted"in i&&i.quoted}));return n}function Ri(t,e=!1){let r=[],n=0;for(;n<t.length;){let s=t[n];if(s===" "||s===" "||s==="\r"){n++;continue}if(s==="\\"&&t[n+1]===`
|
|
56
|
+
`){n+=2;continue}if(s==="#"){for(;n<t.length&&t[n]!==`
|
|
57
|
+
`;)n++;continue}if(!e){let l=oc.find(f=>t.startsWith(f,n));if(l){r.push({type:"op",op:l}),n+=l.length;continue}}let i=[],o=n,a="",c=()=>{a&&i.push({kind:"text",value:a,quoted:!1}),a=""};for(t[n]==="~"&&(n+1>=t.length||/[\s/;|&<>]/.test(t[n+1]))&&(i.push({kind:"tilde"}),n++);n<t.length;){let l=t[n];if(/[\s]/.test(l)&&!e||!e&&/[;|&<>]/.test(l))break;if(l==="\\")a+=t[n+1]??"",n+=2;else if(l==="'"){let f=t.indexOf("'",n+1);if(f<0)throw new H("unexpected end of input: unterminated quote",!0);c(),i.push({kind:"text",value:t.slice(n+1,f),quoted:!0}),n=f+1}else if(l==='"'){c(),n++;let f="",u=()=>{f&&i.push({kind:"text",value:f,quoted:!0}),f=""},h=!1;for(;n<t.length;){let d=t[n];if(d==='"'){h=!0,n++;break}if(d==="\\"&&/["\\$`\n]/.test(t[n+1]??""))f+=t[n+1],n+=2;else if(d==="$"){u();let[g,m]=Ni(t,n,!0);i.push(g),n=m}else if(d==="`"){u();let g=t.indexOf("`",n+1);if(g<0)throw new H("unexpected end of input: unterminated `",!0);i.push({kind:"cmd",source:t.slice(n+1,g),quoted:!0}),n=g+1}else f+=d,n++}if(!h)throw new H("unexpected end of input: unterminated quote",!0);u(),(!i.length||i[i.length-1].kind!=="text")&&i.push({kind:"text",value:"",quoted:!0})}else if(l==="$"){c();let[f,u]=Ni(t,n,!1);i.push(f),n=u}else if(l==="`"){c();let f=t.indexOf("`",n+1);if(f<0)throw new H("unexpected end of input: unterminated `",!0);i.push({kind:"cmd",source:t.slice(n+1,f),quoted:!1}),n=f+1}else a+=l,n++}c(),r.push({type:"word",word:i,raw:t.slice(o,n)})}return r}var fc=/^([A-Za-z_]\w*)=/,_i=new Set([">",">>","<","2>","2>>","&>","2>&1",">&2"]);function gr(t){let e=Ri(t),r=0,n=()=>e[r],s=c=>{let l=e[r];return l?.type==="op"&&l.op===c},i=()=>{let c={assignments:[],words:[],redirects:[]};for(;;){let l=n();if(!l)break;if(l.type==="op"){if(!_i.has(l.op))break;if(r++,l.op==="2>&1"||l.op===">&2"){c.redirects.push({op:l.op});continue}let h=n();if(h?.type!=="word")throw new H(`syntax error near unexpected token \`${h?.type==="op"?h.op.replace(`
|
|
58
|
+
`,"newline"):"newline"}'`);r++,c.redirects.push({op:l.op,target:h.word});continue}r++;let f=l.word[0],u=!c.words.length&&f?.kind==="text"&&!f.quoted?fc.exec(f.value):null;if(u){let h=f.kind==="text"?f.value.slice(u[0].length):"";c.assignments.push({name:u[1],value:[...h?[{kind:"text",value:h,quoted:!1}]:[],...l.word.slice(1)]})}else c.words.push(l.word)}return c},o=()=>{let c=!1,l=n();l?.type==="word"&&l.raw==="!"&&(c=!0,r++);let f=[i()];for(;s("|");){for(r++;s(`
|
|
59
|
+
`);)r++;if(!n())throw new H("unexpected end of input after |",!0);f.push(i())}for(let u of f)if(!u.words.length&&!u.assignments.length&&!u.redirects.length)throw new H("syntax error near unexpected token `|'");return{negate:c,commands:f}},a=[];for(;r<e.length;){if(s(";")||s(`
|
|
60
|
+
`)){r++;continue}let c=n();if(c.type==="op"&&!_i.has(c.op))throw new H(`syntax error near unexpected token \`${c.op}'`);let l={first:o(),rest:[],background:!1};for(;s("&&")||s("||");){let f=e[r].op;for(r++;s(`
|
|
61
|
+
`);)r++;if(!n())throw new H(`unexpected end of input after ${f}`,!0);l.rest.push({op:f,pipeline:o()})}s("&")&&(l.background=!0,r++),a.push(l)}return a}async function uc(t,e){let r;switch(t.name){case"?":r=String(e.lastStatus);break;case"$":r=String(e.pid);break;case"#":r=String(e.positional.length);break;case"@":case"*":r=e.positional.join(" ");break;case"!":r="";break;case"0":r="jsh";break;default:r=/^\d$/.test(t.name)?e.positional[Number(t.name)-1]:e.get(t.name)}if(!t.op)return r??"";let n=async()=>(await kt(t.arg??[],e,{split:!1,glob:!1})).join(" ");switch(t.op){case":-":return r||n();case"-":return r!==void 0?r:n();case":+":return r?n():"";case":=":{if(r)return r;let s=await n();return e.set(t.name,s),s}}}var Cn=/[*?[]/;function hc(t){let e="";for(let r=0;r<t.length;r++){let n=t[r];if(n==="*")e+="[^/]*";else if(n==="?")e+="[^/]";else if(n==="["){let s=t.indexOf("]",r+1);s<0?e+="\\[":(e+="["+t.slice(r+1,s).replace(/^!/,"^").replace(/\\/g,"\\\\")+"]",r=s)}else e+=n.replace(/[.+^${}()|\\]/g,"\\$&")}return new RegExp(`^${e}$`)}function vn(t,e,r){let n=r.startsWith("/"),s=r.split("/").filter((o,a)=>o||a===0),i=[n?"/":""];for(let o of n?s.slice(1):s){let a=[];for(let c of i){let l=c?c.startsWith("/")?c:S(e,c):e;if(!Cn.test(o)){let u=c?c.endsWith("/")?c+o:`${c}/${o}`:o;t.exists(u.startsWith("/")?u:S(e,u))&&a.push(u);continue}let f=hc(o);for(let u of t.readdir(x(l)))u.startsWith(".")&&!o.startsWith(".")||f.test(u)&&a.push(c?c.endsWith("/")?c+u:`${c}/${u}`:u)}i=a}return i.sort()}async function kt(t,e,r={}){let n=r.split??!0,s=[""],i=!1,o=!1,a=l=>{s[s.length-1]+=l};for(let l of t){if(l.kind==="tilde"){a(e.get("HOME")??"/home/user"),i=!0;continue}if(l.kind==="text"){a(l.value),(l.quoted||l.value)&&(i=!0),!l.quoted&&Cn.test(l.value)&&(o=!0);continue}let f=l.kind==="var"?await uc(l,e):(await e.substitute(l.source)).replace(/\n+$/,"");if(l.quoted||!n){a(f),i=!0;continue}f.split(/[ \t\n]+/).forEach((h,d)=>{d>0&&(s[s.length-1]||i)&&s.push(""),h&&(a(h),i=!0)})}let c=s.filter((l,f)=>l!==""||i&&f===s.length-1&&s.length===1);return!i&&c.every(l=>!l)?[]:r.glob===!1||!o?c:c.flatMap(l=>{if(!Cn.test(l))return[l];let f=vn(e.fs,e.cwd,l);return f.length?f:[l]})}async function Ti(t,e){let r=[];for(let n of t)r.push(...await kt(n,e));return r}function G(t,e){return e==="~"||e.startsWith("~/")?S(t.env.HOME??"/home/user",e.slice(1)):e.startsWith("/")?x(e):S(t.cwd,e)}function ae(t,e=[]){let r=new Set,n={},s=[];for(let i=0;i<t.length;i++){let o=t[i];if(o==="--"){s.push(...t.slice(i+1));break}if(o.startsWith("--")&&o.length>2){let[a,c]=o.slice(2).split("=",2);c!==void 0?n[a]=c:e.includes(a)?n[a]=t[++i]??"":r.add(a)}else if(o.startsWith("-")&&o.length>1&&!/^-\d/.test(o))for(let a=1;a<o.length;a++){let c=o[a];if(e.includes(c)){n[c]=o.slice(a+1)||t[++i]||"";break}r.add(c)}else s.push(o)}return{flags:r,values:n,operands:s}}function Li(t,e){return async r=>{let n=new re,s=r.io.onStdin(i=>n.push(i));try{return await t({args:r.args,name:e,cwd:r.cwd,env:r.env,fs:r.system.fs,system:r.system,io:{stdout:r.io.stdout,stderr:r.io.stderr,stdin:n,isTerminal:!!r.io.terminal},signal:r.signal})}finally{s()}}}var dc=new TextEncoder,pc=(t,e)=>{let r=t.readFile(e);return r===void 0?4096:typeof r=="string"?dc.encode(r).length:r.length},Ac=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function gc(t){let e=new Date(t);return`${Ac[e.getMonth()]} ${String(e.getDate()).padStart(2)} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}var $i=async t=>{let{flags:e,operands:r}=ae(t.args),n=e.has("a")||e.has("A"),s=e.has("l"),i=e.has("1")||!t.io.isTerminal,o=r.length?r:["."],a=0,c=(f,u)=>t.io.isTerminal&&u?`\x1B[1;34m${f}\x1B[0m`:f,l=(f,u)=>{if(s){let d=u.map(g=>{let m=g==="."?f:g===".."?T(f):S(f,g),E=t.fs.isDirectory(m),p=E?4096:pc(t.fs,m);return`${E?"drwxr-xr-x":"-rw-r--r--"} 1 user user ${String(p).padStart(8)} ${gc(t.fs.mtime(m)??Date.now())} ${c(g,E)}`});return d.length?`total ${u.length}
|
|
62
|
+
${d.join(`
|
|
63
|
+
`)}
|
|
64
|
+
`:`total 0
|
|
65
|
+
`}let h=u.map(d=>c(d,t.fs.isDirectory(S(f,d))));return h.length?h.join(i?`
|
|
66
|
+
`:" ")+`
|
|
67
|
+
`:""};for(let[f,u]of o.entries()){let h=G(t,u);if(t.fs.isFile(h)){t.io.stdout(l(T(h),[Le(h)]).replace(Le(h),u));continue}if(!t.fs.isDirectory(h)){t.io.stderr(`ls: cannot access '${u}': No such file or directory
|
|
68
|
+
`),a=2;continue}let d=t.fs.readdir(h).filter(g=>n||!g.startsWith("."));e.has("a")&&(d=[".","..",...d]),o.length>1&&t.io.stdout(`${f?`
|
|
69
|
+
`:""}${u}:
|
|
70
|
+
`),t.io.stdout(l(h,d))}return a},Mi=async t=>{let{operands:e}=ae(t.args);if(!e.length||e.length===1&&e[0]==="-")return t.io.stdout(await t.io.stdin.readAll()),0;let r=0;for(let n of e){let s=G(t,n);t.fs.isDirectory(s)?(t.io.stderr(`cat: ${n}: Is a directory
|
|
71
|
+
`),r=1):t.fs.isFile(s)?t.io.stdout(t.fs.readText(s)??""):(t.io.stderr(`cat: ${n}: No such file or directory
|
|
72
|
+
`),r=1)}return r},Fi=async t=>{let{flags:e,operands:r}=ae(t.args,["m"]);if(!r.length)return t.io.stderr(`mkdir: missing operand
|
|
73
|
+
`),1;let n=0;for(let s of r){let i=G(t,s);if(t.fs.exists(i)){if(e.has("p")&&t.fs.isDirectory(i))continue;t.io.stderr(`mkdir: cannot create directory '${s}': File exists
|
|
74
|
+
`),n=1}else!e.has("p")&&!t.fs.isDirectory(T(i))?(t.io.stderr(`mkdir: cannot create directory '${s}': No such file or directory
|
|
75
|
+
`),n=1):t.fs.mkdir(i)}return n},Ui=async t=>{let{flags:e,operands:r}=ae(t.args),n=e.has("r")||e.has("R")||e.has("recursive"),s=e.has("f")||e.has("force");if(!r.length&&!s)return t.io.stderr(`rm: missing operand
|
|
76
|
+
`),1;let i=0;for(let o of r){let a=G(t,o);a==="/"?(t.io.stderr(`rm: it is dangerous to operate recursively on '/'
|
|
77
|
+
`),i=1):t.fs.exists(a)?t.fs.isDirectory(a)&&!n?(t.io.stderr(`rm: cannot remove '${o}': Is a directory
|
|
78
|
+
`),i=1):t.fs.rm(a):s||(t.io.stderr(`rm: cannot remove '${o}': No such file or directory
|
|
79
|
+
`),i=1)}return i};function ji(t,e,r){if(t.isFile(e)){let n=t.readFile(e);t.writeFile(r,typeof n=="string"?n:n.slice());return}t.mkdir(r);for(let n of t.readdir(e))ji(t,S(e,n),S(r,n))}function Pi(t){return async e=>{let{flags:r,operands:n}=ae(e.args);if(n.length<2)return e.io.stderr(`${t}: missing destination file operand
|
|
80
|
+
`),1;let s=G(e,n[n.length-1]),i=n.slice(0,-1),o=e.fs.isDirectory(s);if(i.length>1&&!o)return e.io.stderr(`${t}: target '${n[n.length-1]}' is not a directory
|
|
81
|
+
`),1;let a=0;for(let c of i){let l=G(e,c),f=o?S(s,Le(l)):s;if(!e.fs.exists(l)){e.io.stderr(`${t}: cannot stat '${c}': No such file or directory
|
|
82
|
+
`),a=1;continue}if(t==="cp"&&e.fs.isDirectory(l)&&!(r.has("r")||r.has("R")||r.has("a"))){e.io.stderr(`cp: -r not specified; omitting directory '${c}'
|
|
83
|
+
`),a=1;continue}if(f===l||f.startsWith(l+"/")){e.io.stderr(`${t}: cannot ${t==="cp"?"copy":"move"} '${c}' into itself
|
|
84
|
+
`),a=1;continue}if(e.fs.isFile(f)&&e.fs.isDirectory(l)){e.io.stderr(`${t}: cannot overwrite non-directory '${f}' with directory '${c}'
|
|
85
|
+
`),a=1;continue}e.fs.isFile(f)&&e.fs.rm(f),ji(e.fs,l,f),t==="mv"&&e.fs.rm(l)}return a}}var Ki=Pi("cp"),Hi=Pi("mv"),Ji=async t=>{let{operands:e}=ae(t.args),r=0;for(let n of e){let s=G(t,n);t.fs.isDirectory(T(s))?t.fs.isDirectory(s)||t.fs.writeFile(s,t.fs.readFile(s)??""):(t.io.stderr(`touch: cannot touch '${n}': No such file or directory
|
|
86
|
+
`),r=1)}return r},qi=async t=>(t.io.stdout(t.cwd+`
|
|
87
|
+
`),0);async function Qn(t,e,r){if(!e.length||e.length===1&&e[0]==="-")return[{label:"(standard input)",text:await t.io.stdin.readAll()}];let n=[];for(let s of e){let i=G(t,s);if(!t.fs.isFile(i))return t.io.stderr(`${r}: ${s}: ${t.fs.isDirectory(i)?"Is a directory":"No such file or directory"}
|
|
88
|
+
`),1;n.push({label:s,text:t.fs.readText(i)??""})}return n}var Wi=t=>{let e=t.split(`
|
|
89
|
+
`);return e[e.length-1]===""&&e.pop(),e};function zi(t){return t.replace(/\\(n|t|r|\\|e|a|0)/g,(e,r)=>({n:`
|
|
90
|
+
`,t:" ",r:"\r","\\":"\\",e:"\x1B",a:"\x07",0:"\0"})[r]??r)}var Gi=async t=>{let e=t.args,r=!0,n=!1;for(;e[0]&&/^-[neE]+$/.test(e[0]);)e[0].includes("n")&&(r=!1),e[0].includes("e")&&(n=!0),e=e.slice(1);let s=e.join(" ");return t.io.stdout((n?zi(s):s)+(r?`
|
|
91
|
+
`:"")),0},Yi=async t=>{let[e="",...r]=t.args,n=0,s=zi(e).replace(/%([sdif%])/g,(i,o)=>{if(o==="%")return"%";let a=r[n++]??"";return o==="s"?a:String(o==="f"?parseFloat(a)||0:parseInt(a,10)||0)});return t.io.stdout(s),0};function Vi(t){return async e=>{let r=e.args.find(a=>/^-\d+$/.test(a)),{values:n,operands:s}=ae(e.args.filter(a=>a!==r),["n"]),i=r?Number(r.slice(1)):n.n!==void 0?Number(n.n):10,o=await Qn(e,s,t);return typeof o=="number"?o:(o.forEach((a,c)=>{o.length>1&&e.io.stdout(`${c?`
|
|
92
|
+
`:""}==> ${a.label} <==
|
|
93
|
+
`);let l=Wi(a.text),f=t==="head"?l.slice(0,i):i?l.slice(-i):[];f.length&&e.io.stdout(f.join(`
|
|
94
|
+
`)+`
|
|
95
|
+
`)}),0)}}var Zi=Vi("head"),Xi=Vi("tail"),eo=async t=>{let{flags:e,operands:r}=ae(t.args),[n,...s]=r;if(n===void 0)return t.io.stderr(`Usage: grep [-ivnrclEF] PATTERN [FILE]...
|
|
96
|
+
`),2;let i;try{let f=e.has("F")?n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):e.has("E")?n:n.replace(/\\([|(){}+?])/g,"$1");i=new RegExp(e.has("w")?`\\b(?:${f})\\b`:f,e.has("i")?"i":"")}catch{return t.io.stderr(`grep: invalid pattern: ${n}
|
|
97
|
+
`),2}let o=s;if(e.has("r")||e.has("R")){o=[];let f=(u,h)=>{if(t.fs.isFile(u))o.push(h);else for(let d of t.fs.readdir(u))d!=="node_modules"&&!d.startsWith(".")&&f(S(u,d),h==="."?d:`${h}/${d}`)};for(let u of s.length?s:["."])f(G(t,u),u)}let a=await Qn(t,o,"grep");if(typeof a=="number")return 2;let c=a.length>1,l=0;for(let{label:f,text:u}of a){let h=0;Wi(u).forEach((d,g)=>{i.test(d)!==e.has("v")&&(h++,l++,!(e.has("c")||e.has("l")||e.has("q"))&&t.io.stdout(`${c?f+":":""}${e.has("n")?g+1+":":""}${d}
|
|
98
|
+
`))}),e.has("c")&&t.io.stdout(`${c?f+":":""}${h}
|
|
99
|
+
`),e.has("l")&&h&&t.io.stdout(f+`
|
|
100
|
+
`)}return l?0:1},to=async t=>{let{flags:e,operands:r}=ae(t.args),n=await Qn(t,r,"wc");if(typeof n=="number")return n;let s=["l","w","c"].filter(i=>e.has(i));for(let{label:i,text:o}of n){let a={l:(o.match(/\n/g)??[]).length,w:o.split(/\s+/).filter(Boolean).length,c:new TextEncoder().encode(o).length},c=(s.length?s:["l","w","c"]).map(l=>String(a[l]).padStart(7)).join(" ");t.io.stdout(`${c}${r.length?" "+i:""}
|
|
101
|
+
`)}return 0},ro=async t=>(t.io.stdout(Object.entries(t.env).map(([e,r])=>`${e}=${r}`).join(`
|
|
102
|
+
`)+`
|
|
103
|
+
`),0),no=async t=>(t.io.stdout("\x1B[2J\x1B[3J\x1B[H"),0),so=async t=>{let e=Number(t.args[0]??0);return Number.isFinite(e)?(await new Promise(r=>{let n=setTimeout(r,e*1e3);t.signal.addEventListener("abort",()=>{clearTimeout(n),r()})}),t.signal.aborted?130:0):(t.io.stderr(`sleep: invalid time interval '${t.args[0]}'
|
|
104
|
+
`),1)},io=async t=>{let[e="",r]=t.args,n=Le(e);return r&&n.endsWith(r)&&n!==r&&(n=n.slice(0,-r.length)),t.io.stdout(n+`
|
|
105
|
+
`),0},oo=async t=>{let e=(t.args[0]??".").replace(/(.)\/+$/,"$1"),r=e.lastIndexOf("/");return t.io.stdout((r<0?".":r===0?"/":e.startsWith("/")?T(e):e.slice(0,r))+`
|
|
106
|
+
`),0},ao=async()=>0,co=async()=>1;var Te={ls:$i,cat:Mi,mkdir:Fi,rm:Ui,cp:Ki,mv:Hi,touch:Ji,pwd:qi,echo:Gi,printf:Yi,head:Zi,tail:Xi,grep:eo,wc:to,env:ro,clear:no,sleep:so,basename:io,dirname:oo,true:ao,false:co},mr=["node","npm","npx","jsh","sh","bash"],mc=`jsh \u2014 BuilderForce WebContainers shell
|
|
107
|
+
|
|
108
|
+
Builtins: cd, pwd, export, unset, exit, source, history, type, which, help
|
|
109
|
+
Files: ls [-la], cat, mkdir [-p], rm [-rf], cp [-r], mv, touch
|
|
110
|
+
Text: echo, printf, head, tail, grep, wc, env, clear, sleep, basename, dirname
|
|
111
|
+
Node: node <file>, npm install|ci|run|start|test, npx <bin>
|
|
112
|
+
Syntax: 'quotes' "$VARS" a && b || c; a | b > out.txt >> log 2>&1 2> err; FOO=bar cmd; $(cmd); *.js
|
|
113
|
+
|
|
114
|
+
`,ke={async cd(t,e){let r=e.env.HOME&&t.fs.isDirectory(e.env.HOME)?e.env.HOME:"/",n=t.args[0]==="-"?e.env.OLDPWD??e.cwd:t.args[0]??r,s=G(t,n);return t.fs.isDirectory(s)?(e.env.OLDPWD=e.cwd,e.cwd=s,e.env.PWD=s,t.args[0]==="-"&&t.io.stdout(s+`
|
|
115
|
+
`),0):(t.io.stderr(`cd: ${t.fs.isFile(s)?"not a directory":"no such file or directory"}: ${n}
|
|
116
|
+
`),1)},async export(t,e){if(!t.args.length)return t.io.stdout(Object.entries(e.env).map(([r,n])=>`export ${r}=${JSON.stringify(n)}`).join(`
|
|
117
|
+
`)+`
|
|
118
|
+
`),0;for(let r of t.args){let n=r.indexOf("=");n>0?e.env[r.slice(0,n)]=r.slice(n+1):r in e.env||(e.env[r]="")}return 0},async unset(t,e){for(let r of t.args)delete e.env[r];return 0},async exit(t,e){let r=t.args[0]===void 0?e.lastStatus:Number(t.args[0]);return e.exitRequested=Number.isFinite(r)?r&255:2,e.exitRequested},async source(t,e){let r=t.args[0];if(!r)return t.io.stderr(`source: filename argument required
|
|
119
|
+
`),2;let n=t.fs.readText(G(t,r));return n===void 0?(t.io.stderr(`source: ${r}: No such file or directory
|
|
120
|
+
`),1):e.run(n)},async history(t,e){return t.io.stdout(e.history.map((r,n)=>`${String(n+1).padStart(5)} ${r}`).join(`
|
|
121
|
+
`)+(e.history.length?`
|
|
122
|
+
`:"")),0},async help(t){return t.io.stdout(mc),0},async which(t){let e=0;for(let r of t.args.filter(n=>!n.startsWith("-")))if(r in Te||mr.includes(r))t.io.stdout(`/usr/local/bin/${r}
|
|
123
|
+
`);else if(r in ke)t.io.stdout(`${r}: shell built-in command
|
|
124
|
+
`);else{let n=Qe(t.fs,r,t.cwd,t.env);n?t.io.stdout(n+`
|
|
125
|
+
`):(t.io.stderr(`${r} not found
|
|
126
|
+
`),e=1)}return e},async type(t){let e=0;for(let r of t.args)if(r in ke)t.io.stdout(`${r} is a shell builtin
|
|
127
|
+
`);else if(r in Te||mr.includes(r))t.io.stdout(`${r} is /usr/local/bin/${r}
|
|
128
|
+
`);else{let n=Qe(t.fs,r,t.cwd,t.env);n?t.io.stdout(`${r} is ${n}
|
|
129
|
+
`):(t.io.stderr(`type: ${r}: not found
|
|
130
|
+
`),e=1)}return e},async set(){return 0}};ke["."]=ke.source;ke[":"]=async()=>0;function wr(t){let[e,...r]=t,n=r[0]!==void 0&&!r[0].startsWith("-")?r[0]:void 0;if(e==="vite"&&(n===void 0||n==="dev"||n==="serve"))return{tool:"vite",defaultPort:5173};if((e==="react-scripts"||e==="craco")&&n==="start")return{tool:"react-scripts",defaultPort:3e3}}function wc(t,e,r){let n=t.findIndex(o=>o==="--port"||o.startsWith("--port=")),s=n<0?r.PORT:t[n].includes("=")?t[n].split("=")[1]:t[n+1],i=Number(s);return Number.isInteger(i)&&i>0?i:e}async function lo(t,e,r){let n=t.system.previewUrl;if(!n)return t.io.stderr(`${r.tool}: no in-browser preview is attached to this runtime, so there is nothing to serve.
|
|
131
|
+
`),1;let s=wc(e,r.defaultPort,t.env),i=r.tool==="vite"?`
|
|
132
|
+
VITE (BuilderForce in-browser dev server) ready
|
|
133
|
+
|
|
134
|
+
\u279C Local: ${n}
|
|
135
|
+
|
|
136
|
+
`:`
|
|
137
|
+
Compiled successfully!
|
|
138
|
+
|
|
139
|
+
You can now view the app in the browser.
|
|
140
|
+
|
|
141
|
+
Local: ${n}
|
|
142
|
+
|
|
143
|
+
`;return t.io.stdout(i),t.system.announceServer(s,n),await new Promise(o=>{t.signal.aborted&&o(),t.signal.addEventListener("abort",()=>o())}),130}var yc=500,yr=class t{constructor(e){A(this,"options");A(this,"cwd");A(this,"env");A(this,"lastStatus",0);A(this,"history",[]);A(this,"exitRequested");A(this,"pid",yc++);A(this,"system");A(this,"positional");A(this,"current");this.options=e,this.system=e.system,this.cwd=e.cwd,this.env={...e.env,PWD:e.cwd},this.positional=e.positional??[]}fork(e){return new t({...this.options,cwd:e.cwd??this.cwd,env:{...this.env,...e.env},positional:e.positional})}async exec(e,r,n,s){let i;try{i=gr(e)}catch(a){if(!(a instanceof H))throw a;return r.stderr(`jsh: ${a.message}
|
|
144
|
+
`),this.lastStatus=2,2}let o=this.current;this.current={io:r,input:n,signal:s};try{for(let a of i){if(this.exitRequested!==void 0||s.aborted)break;let c=async()=>{let l=await this.runPipeline(a.first,r,n,s);for(let{op:f,pipeline:u}of a.rest){if(this.exitRequested!==void 0||s.aborted)break;f==="&&"==(l===0)&&(l=await this.runPipeline(u,r,n,s))}return l};a.background?(c(),this.lastStatus=0):this.lastStatus=await c()}}finally{this.current=o}return s.aborted&&this.lastStatus===0&&(this.lastStatus=130),this.exitRequested??this.lastStatus}run(e){let r=this.current;if(!r)throw new Error("Shell.run outside a job");return this.exec(e,r.io,r.input,r.signal)}expandContext(e,r){return{fs:this.system.fs,cwd:this.cwd,get:n=>this.env[n],set:(n,s)=>void(this.env[n]=s),positional:this.positional,lastStatus:this.lastStatus,pid:this.pid,substitute:async n=>{let s="";return await this.fork({}).exec(n,{stdout:o=>s+=o,stderr:e.stderr,isTerminal:!1},{queue:Ec()},r),s}}}async runPipeline(e,r,n,s){let i=e.commands.length,o=Array.from({length:i-1},()=>new re),a=await Promise.all(e.commands.map(async(l,f)=>{let u=f===0?n:{queue:o[f-1]},d={stdout:f===i-1?r.stdout:g=>o[f].push(g),stderr:r.stderr,isTerminal:r.isTerminal&&f===i-1};try{return await this.runCommand(l,d,u,s,i===1)}finally{f<i-1&&o[f].push(null)}})),c=a[a.length-1];return e.negate?c===0?1:0:c}async runCommand(e,r,n,s,i){let o=this.expandContext(r,s),a=await Ti(e.words,o),c={};for(let{name:g,value:m}of e.assignments)c[g]=(await kt(m,o,{split:!1,glob:!1})).join("");if(!a.length)return Object.assign(this.env,c),0;let l=r.stdout,f=r.stderr,u=n,h=r.isTerminal,d=[];for(let g of e.redirects){if(g.op==="2>&1"){f=l;continue}if(g.op===">&2"){l=f;continue}let m=(await kt(g.target,o)).join(" "),E=G(this,m);if(g.op==="<"){let b=this.system.fs.readText(E);if(b===void 0)return r.stderr(`jsh: ${m}: No such file or directory
|
|
145
|
+
`),1;let w=new re;w.push(b),w.push(null),u={queue:w};continue}if(this.system.fs.isDirectory(E))return r.stderr(`jsh: ${m}: Is a directory
|
|
146
|
+
`),1;let C=g.op===">>"||g.op==="2>>"?this.system.fs.readText(E)??"":"";this.system.fs.writeFile(E,C);let y=b=>void(C+=b);d.push(()=>this.system.fs.writeFile(E,C)),g.op==="2>"||g.op==="2>>"?f=y:g.op==="&>"?l=f=y:(l=y,h=!1)}try{return await this.dispatch(a,c,{stdout:l,stderr:f,isTerminal:h},u,s,i&&h)}finally{for(let g of d)g()}}async dispatch(e,r,n,s,i,o){let[a,...c]=e,l={...this.env,...r},f={args:c,name:a,cwd:this.cwd,env:l,fs:this.system.fs,system:this.system,io:{stdout:n.stdout,stderr:n.stderr,stdin:s.queue,isTerminal:n.isTerminal},signal:i},u=ke[a];if(u)return u(f,this);let h=this.options.commands?.[a];if(h)return h(f,this,s);let d=wr(e);if(d)return lo(f,e,d);let g=Te[a];return g?g(f):this.spawnExternal(a,c,l,n,s,i,o)}async spawnExternal(e,r,n,s,i,o,a){let c=a?this.options.terminalSize?.():void 0,l;try{l=this.system.spawn(e,r,{cwd:this.cwd,env:n,terminal:c})}catch(h){if(h.code!=="ENOENT")throw h;return s.stderr(`jsh: command not found: ${e}
|
|
147
|
+
`),127}l.onStdout(s.stdout),l.onStderr(s.stderr);let f;c&&i.setRawSink?i.setRawSink(h=>l.write(h)):f=i.queue.subscribe(h=>h===null?l.closeStdin():l.write(h));let u=()=>l.kill(typeof o.reason=="string"?o.reason:"SIGINT");o.aborted&&u(),o.addEventListener("abort",u);try{return await l.exit}finally{o.removeEventListener("abort",u),c&&i.setRawSink&&i.setRawSink(void 0),f?.()}}};function Ec(){let t=new re;return t.push(null),t}var bc=[[/^\x1b\[(?:1;\d)?A/,"up"],[/^\x1b\[(?:1;\d)?B/,"down"],[/^\x1b\[1;[35]C|^\x1bf/,"wordRight"],[/^\x1b\[1;[35]D|^\x1bb/,"wordLeft"],[/^\x1b\[C|^\x1bOC/,"right"],[/^\x1b\[D|^\x1bOD/,"left"],[/^\x1b\[(?:H|1~|7~)|^\x1bOH/,"home"],[/^\x1b\[(?:F|4~|8~)|^\x1bOF/,"end"],[/^\x1b\[3~/,"delete"],[/^\x1b\[[0-9;]*[~A-Za-z]|^\x1bO[A-Za-z]|^\x1b./,"ignore"]];function Cc(t){if(!t.length)return"";let e=t[0];for(let r of t)for(;!r.startsWith(e);)e=e.slice(0,-1);return e}var Er=class{constructor(e){A(this,"options");A(this,"line","");A(this,"cursor",0);A(this,"prompt","");A(this,"historyIndex",-1);A(this,"draft","");this.options=e}begin(e){this.prompt=e,this.line="",this.cursor=0,this.historyIndex=-1,this.options.write(e)}feed(e){let r=0;for(;r<e.length;){let n=e[r];if(n==="\x1B"){let s=e.slice(r),i=bc.find(([a])=>a.test(s)),o=i?i[0].exec(s)[0]:"\x1B";r+=o.length,this.key(i?.[1]??"ignore");continue}switch(r++,n){case"\r":case`
|
|
148
|
+
`:{n==="\r"&&e[r]===`
|
|
149
|
+
`&&r++;let s=this.line;return this.options.write(`\r
|
|
150
|
+
`),s.trim()&&this.options.history[this.options.history.length-1]!==s&&this.options.history.push(s),this.line="",this.cursor=0,{event:{type:"line",line:s},rest:e.slice(r)}}case"":return this.options.write(`^C\r
|
|
151
|
+
`),this.line="",this.cursor=0,{event:{type:"interrupt"},rest:e.slice(r)};case"":if(!this.line)return{event:{type:"eof"},rest:e.slice(r)};this.key("delete");break;case"\x7F":case"\b":this.cursor>0&&(this.line=this.line.slice(0,this.cursor-1)+this.line.slice(this.cursor),this.cursor--,this.redraw());break;case"":this.key("home");break;case"":this.key("end");break;case"":this.key("left");break;case"":this.key("right");break;case"":this.key("up");break;case"":this.key("down");break;case"":this.line=this.line.slice(this.cursor),this.cursor=0,this.redraw();break;case"\v":this.line=this.line.slice(0,this.cursor),this.redraw();break;case"":{let s=this.line.slice(0,this.cursor).replace(/\S+\s*$/,"");this.line=s+this.line.slice(this.cursor),this.cursor=s.length,this.redraw();break}case"\f":this.options.write("\x1B[2J\x1B[H"),this.redraw();break;case" ":this.complete();break;default:n>=" "&&this.insert(n)}}return{rest:""}}insert(e){this.line=this.line.slice(0,this.cursor)+e+this.line.slice(this.cursor),this.cursor+=e.length,this.cursor===this.line.length?this.options.write(e):this.redraw()}key(e){let r=this.options.history;switch(e){case"left":this.cursor>0&&(this.cursor--,this.options.write("\x1B[D"));return;case"right":this.cursor<this.line.length&&(this.cursor++,this.options.write("\x1B[C"));return;case"wordLeft":return this.cursor=this.line.slice(0,this.cursor).replace(/\S+\s*$/,"").length,this.redraw();case"wordRight":{let n=/^\s*\S+/.exec(this.line.slice(this.cursor));return this.cursor+=n?n[0].length:0,this.redraw()}case"home":return this.cursor=0,this.redraw();case"end":return this.cursor=this.line.length,this.redraw();case"delete":this.cursor<this.line.length&&(this.line=this.line.slice(0,this.cursor)+this.line.slice(this.cursor+1),this.redraw());return;case"up":return r.length?(this.historyIndex===-1?(this.draft=this.line,this.historyIndex=r.length-1):this.historyIndex>0&&this.historyIndex--,this.line=r[this.historyIndex],this.cursor=this.line.length,this.redraw()):void 0;case"down":return this.historyIndex===-1?void 0:(this.historyIndex++,this.historyIndex>=r.length?(this.historyIndex=-1,this.line=this.draft):this.line=r[this.historyIndex],this.cursor=this.line.length,this.redraw())}}complete(){let e=this.line.slice(0,this.cursor),r=/\S*$/.exec(e)[0],n=this.options.complete?.(e,r)??[];if(!n.length)return;if(n.length===1){let i=n[0];this.insert(i.slice(r.length)+(i.endsWith("/")?"":" "));return}let s=Cc(n);if(s.length>r.length){this.insert(s.slice(r.length));return}this.options.write(`\r
|
|
152
|
+
`+n.map(i=>i.slice(i.lastIndexOf("/",i.length-2)+1)).join(" ")+`\r
|
|
153
|
+
`),this.redraw()}redraw(){let e=this.line.length-this.cursor;this.options.write(`\r\x1B[K${this.prompt}${this.line}${e?`\x1B[${e}D`:""}`)}};var fo="10.8.2",Bn=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function Dt(t){return ot(t.fs,t.cwd)?.dir??t.cwd}function xt(t,e){try{return JSON.parse(t.fs.readText(S(e,"package.json"))??"null")??void 0}catch{return}}async function br(t,e,r=Dt(t)){let n=performance.now(),s=t.io.isTerminal;try{let i=await vs({fs:t.fs,fetch:(c,l)=>t.system.fetch(c,l),registry:t.env.npm_config_registry??t.system.registry,cache:t.system.packageCache,cwd:r,signal:t.signal,onProgress:s?c=>c.phase==="fetch"&&t.io.stdout(`\r\x1B[Kfetching ${c.done}/${c.total} ${c.package??""}`):void 0,...e});s&&t.io.stdout("\r\x1B[K");for(let c of i.warnings)t.io.stderr(`npm warn ${c}
|
|
154
|
+
`);let o=((performance.now()-n)/1e3).toFixed(1),a=[i.added&&`added ${i.added} package${i.added===1?"":"s"}`,i.removed&&`removed ${i.removed} package${i.removed===1?"":"s"}`].filter(Boolean);return t.io.stdout(`
|
|
155
|
+
${a.length?a.join(", "):"up to date"}, audited ${i.total+1} packages in ${o}s
|
|
156
|
+
`),0}catch(i){return s&&t.io.stdout("\r\x1B[K"),t.signal.aborted?130:(t.io.stderr(`npm error ${i instanceof Error?i.message:String(i)}
|
|
157
|
+
`),1)}}async function uo(t,e,r,n,s){let i=Dt(t),o=xt(t,i);if(!o)return t.io.stderr(`npm error Could not read package.json in ${i}
|
|
158
|
+
`),1;let a={...o.scripts};if(n==="start"&&!a.start&&t.fs.isFile(S(i,"server.js"))&&(a.start="node server.js"),!a[n])return n==="test"?(t.io.stderr(`npm error Missing script: "test"
|
|
159
|
+
`),1):(t.io.stderr(`npm error Missing script: "${n}"
|
|
160
|
+
|
|
161
|
+
To see a list of scripts, run:
|
|
162
|
+
npm run
|
|
163
|
+
`),1);let c=[...Ze(i),t.env.PATH??""].filter(Boolean).join(":");for(let l of[`pre${n}`,n,`post${n}`]){let f=a[l];if(!f)continue;let u=l===n&&s.length?`${f} ${s.map(Bn).join(" ")}`:f;t.io.stdout(`
|
|
164
|
+
> ${o.name??""}${o.version?"@"+o.version:""} ${l}
|
|
165
|
+
> ${u}
|
|
166
|
+
|
|
167
|
+
`);let d=await e.fork({cwd:i,env:{PATH:c,npm_lifecycle_event:l,npm_lifecycle_script:f,npm_command:"run-script",npm_package_name:o.name??"",npm_package_version:o.version??"",npm_package_json:S(i,"package.json"),INIT_CWD:t.cwd,NODE:"/usr/local/bin/node"}}).exec(u,{stdout:t.io.stdout,stderr:t.io.stderr,isTerminal:t.io.isTerminal},r,t.signal);if(d!==0)return t.signal.aborted||t.io.stderr(`npm error Lifecycle script \`${l}\` failed with error:
|
|
168
|
+
npm error code ${d}
|
|
169
|
+
`),d}return 0}function vc(t){let e=xt(t,Dt(t)),r=Object.entries(e?.scripts??{});return r.length&&t.io.stdout(`Scripts available in ${e?.name??"this package"} via \`npm run-script\`:
|
|
170
|
+
${r.map(([n,s])=>` ${n}
|
|
171
|
+
${s}`).join(`
|
|
172
|
+
`)}
|
|
173
|
+
`),0}async function ho(t,e,r){let[n="help",...s]=t.args,{flags:i,operands:o}=ae(s,["registry"]),a=i.has("D")||i.has("save-dev"),c=i.has("production")||s.includes("--omit=dev");switch(n){case"-v":case"--version":case"version":return t.io.stdout(`${fo}
|
|
174
|
+
`),0;case"install":case"i":case"add":case"isntall":return br(t,{add:o,saveDev:a,production:c});case"ci":case"clean-install":return br(t,{ci:!0,production:c});case"uninstall":case"remove":case"rm":case"un":{let l=Dt(t),f=xt(t,l);if(!f)return t.io.stderr(`npm error No package.json found
|
|
175
|
+
`),1;for(let u of["dependencies","devDependencies","optionalDependencies"])for(let h of o)f[u]&&delete f[u][h];return t.fs.writeFile(S(l,"package.json"),JSON.stringify(f,null,2)+`
|
|
176
|
+
`),br(t,{},l)}case"run":case"run-script":{let l=s.indexOf("--"),[f,...u]=l>=0?[...s.slice(0,l),...s.slice(l+1)]:s;return f?uo(t,e,r,f,u):vc(t)}case"start":case"test":case"t":case"stop":case"restart":return uo(t,e,r,n==="t"?"test":n,s.filter(l=>l!=="--"));case"init":{let l=S(t.cwd,"package.json");if(t.fs.isFile(l))return t.io.stderr(`npm error package.json already exists
|
|
177
|
+
`),1;let u={name:t.cwd.split("/").filter(Boolean).pop()??"project",version:"1.0.0",description:"",main:"index.js",scripts:{test:'echo "Error: no test specified" && exit 1'},keywords:[],author:"",license:"ISC"};return t.fs.writeFile(l,JSON.stringify(u,null,2)+`
|
|
178
|
+
`),t.io.stdout(`Wrote to ${l}:
|
|
179
|
+
|
|
180
|
+
${JSON.stringify(u,null,2)}
|
|
181
|
+
`),0}case"ls":case"list":{let l=Dt(t),f=xt(t,l),u={...f?.dependencies,...f?.devDependencies};t.io.stdout(`${f?.name??""}@${f?.version??""} ${l}
|
|
182
|
+
`);let h=Object.keys(u).sort();return h.forEach((d,g)=>{let m=xt(t,S(l,"node_modules",d))?.version;t.io.stdout(`${g===h.length-1?"\u2514\u2500\u2500":"\u251C\u2500\u2500"} ${d}@${m??`(missing ${u[d]})`}
|
|
183
|
+
`)}),0}case"exec":case"x":return In({...t,args:s.filter(l=>l!=="--")},e,r);case"help":case"-h":case"--help":return t.io.stdout(`npm ${fo} (BuilderForce WebContainers)
|
|
184
|
+
|
|
185
|
+
Usage: npm <install|ci|uninstall|run|start|test|init|ls|exec> \u2026
|
|
186
|
+
`),0;default:return t.io.stderr(`npm error Unknown command: "${n}"
|
|
187
|
+
`),1}}async function In(t,e,r){let n=t.args.filter(u=>u!=="-y"&&u!=="--yes"),s=n.findIndex(u=>u==="-p"||u==="--package"),i=s>=0?n.splice(s,2)[1]:void 0,[o,...a]=n;if(!o)return t.io.stderr(`npx: missing command
|
|
188
|
+
`),1;let c=o.replace(/^@[^/]+\//,"").replace(/@[^@]*$/,""),l={stdout:t.io.stdout,stderr:t.io.stderr,isTerminal:t.io.isTerminal};if(wr([c,...a]))return e.fork({}).exec([c,...a].map(Bn).join(" "),l,r,t.signal);let f=Qe(t.fs,c,t.cwd,{PATH:""});if(!f){let u=i??o,h=`/tmp/.npx/${u.replace(/[^\w.-]+/g,"_")}`;t.fs.isFile(S(h,"package.json"))||t.fs.writeFile(S(h,"package.json"),`{"private": true}
|
|
189
|
+
`),t.io.stderr(`npx: installing ${u}
|
|
190
|
+
`);let d=await br({...t,io:{...t.io,stdout:()=>{}}},{add:[u]},h);if(d!==0)return d;if(f=Qe(t.fs,c,h,{PATH:""})??Qe(t.fs,t.fs.readdir(S(h,"node_modules/.bin"))[0]??c,h,{PATH:""}),!f)return t.io.stderr(`npx: ${u} has no executable named ${c}
|
|
191
|
+
`),1}return e.fork({}).exec([f,...a].map(Bn).join(" "),l,r,t.signal)}var Qc={npm:ho,npx:In};function Cr(t,e=[]){return new yr({system:t.system,cwd:t.cwd,env:{...t.env,SHELL:"/bin/jsh"},positional:e,terminalSize:()=>t.io.terminal?{cols:t.io.terminal.cols,rows:t.io.terminal.rows}:void 0,commands:Qc})}function Ao(t,e){let r=new re,n=t.io.terminal;if(!n){let a=t.io.onStdin(c=>r.push(c));return{input:{queue:r},stop:a}}n.setRawMode(!0);let s,i=new Ue({echo:a=>t.io.stdout(a),deliver:a=>r.push(a),signal:a=>e?.abort(a)}),o=t.io.onStdin(a=>{a===null?r.push(null):s?s(a):i.input(a)});return{input:{queue:r,setRawSink:a=>void(s=a)},stop(){o(),n.setRawMode(!1)}}}async function po(t,e,r){let n=new AbortController,s=()=>n.abort(t.signal.reason);t.signal.addEventListener("abort",s);let{input:i,stop:o}=Ao(t,n);try{return await e.exec(r,Sn(t),i,n.signal)}finally{o(),t.signal.removeEventListener("abort",s)}}var Sn=t=>({stdout:e=>t.io.stdout(e),stderr:e=>t.io.stderr(e),isTerminal:!!t.io.terminal});function Bc(t,e){return e&&(t===e||t.startsWith(e+"/"))?"~"+t.slice(e.length):t}function Ic(t){return(e,r)=>{let n=!/\S\s/.test(e.trimStart())&&!r.includes("/"),s=t.system.fs,i=r.includes("/")?r.slice(0,r.lastIndexOf("/")+1):"",o=vn(s,t.cwd,`${i}*`).filter(c=>c.slice(i.length).startsWith(r.slice(i.length))||!i).filter(c=>c.startsWith(r)).map(c=>s.isDirectory(c.startsWith("/")?c:S(t.cwd,c))?c+"/":c);if(!n)return o.sort();let a=new Set([...Object.keys(ke),...Object.keys(Te),...mr]);for(let c of Ze(t.cwd))for(let l of s.readdir(c))a.add(l);return[...[...a].filter(c=>c.startsWith(r)).sort(),...o.filter(c=>c.endsWith("/"))]}}async function Sc(t){let e=t.io.terminal,r=Cr(t),n=Sn(t);e.setRawMode(!0);let s=new Er({write:E=>t.io.stdout(E),history:r.history,complete:Ic(r)}),i=()=>`\x1B[1;36m${Bc(r.cwd,r.env.HOME)}\x1B[0m \x1B[1;32m$\x1B[0m `,o,a="",c="",l,f=new Promise(E=>l=E),u=async E=>{let p=new re,C=new AbortController,y=new Ue({echo:w=>t.io.stdout(w),deliver:w=>p.push(w),signal:w=>C.abort(w)}),b={controller:C,input:{queue:p},discipline:y};b.input.setRawSink=w=>void(b.rawSink=w),o=b;try{await r.exec(E,n,b.input,C.signal)}catch(w){t.io.stderr(`jsh: ${w instanceof Error?w.message:String(w)}
|
|
192
|
+
`)}if(o=void 0,r.exitRequested!==void 0)return l(r.exitRequested);if(s.begin(i()),c){let w=c;c="",h(w)}},h=E=>{if(o){o.rawSink?o.rawSink(E):o.discipline.input(E);return}let p=E;for(;p&&!o;){let{event:C,rest:y}=s.feed(p);if(p=y,!C)break;if(C.type==="eof")return t.io.stdout(`exit\r
|
|
193
|
+
`),l(r.lastStatus);if(C.type==="interrupt"){a="",r.lastStatus=130,s.begin(i());continue}let b=a?`${a}
|
|
194
|
+
${C.line}`:C.line;try{gr(b)}catch(w){if(w instanceof H&&w.incomplete){a=b,s.begin("> ");continue}}if(a="",!b.trim()){s.begin(i());continue}c=p,p="",u(b)}},d=t.io.onStdin(E=>E===null?l(r.lastStatus):h(E)),g=()=>{o?.controller.abort("SIGHUP"),l(129)};t.signal.addEventListener("abort",g),s.begin(i());let m=await f;return d(),t.signal.removeEventListener("abort",g),e.setRawMode(!1),m}var Ot=async t=>{let e=t.args.filter(a=>a!=="-l"&&a!=="--login"&&a!=="-i");if(e[0]==="-c")return po(t,Cr(t,e.slice(2)),e[1]??"");if(e[0]){let a=e[0].startsWith("/")?e[0]:S(t.cwd,e[0]),c=t.system.fs.readText(a);return c===void 0?(t.io.stderr(`jsh: ${e[0]}: No such file or directory
|
|
195
|
+
`),127):po(t,Cr(t,e.slice(1)),c.replace(/^#!.*\n/,""))}if(t.io.terminal)return Sc(t);let{input:r,stop:n}=Ao(t),s=await r.queue.readAll();n();let i=Cr(t),o=new re;return o.push(null),i.exec(s,Sn(t),{queue:o},t.signal)};var kc=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function go(t){return e=>Ot({...e,args:["-c",[t,...e.args].map(kc).join(" ")]})}function kn(){let t={node:Oi,jsh:Ot,sh:Ot,bash:Ot,npm:go("npm"),npx:go("npx")};for(let[e,r]of Object.entries(Te))t[e]=Li(r,e);return t}function mo(t,e){return`${t}__port/${e}/`}var xc=49152;function wo(t){let e=new dt,r=new Map,n=new Set,s=new Map,i=new Map,o=1,a=1,c=!1,l=[],f=!1,u,h=kn(),d=()=>{if(f=!1,!l.length)return;let p=l;l=[],t.post({type:"fs",ops:p})};e.watch(p=>{c||(p.type==="write"?l.push({op:"write",path:p.path,content:e.readFile(p.path)}):l.push({op:p.type,path:p.path}),f||(f=!0,queueMicrotask(d)))});let g=p=>{c=!0;try{for(let C of p)C.op==="write"?e.writeFile(C.path,C.content):C.op==="mkdir"?e.mkdir(C.path):e.rm(C.path)}finally{c=!1}};function m(p,C,y={}){d();let b=o++,w=new Set,v=new Set,B,Q=new Promise(I=>B=I);return s.set(b,{stdout:w,stderr:v,exit:B}),t.post({type:"spawn",childId:b,command:p,args:C,cwd:y.cwd,env:y.env,terminal:y.terminal}),{pid:b,onStdout:I=>(w.add(I),()=>w.delete(I)),onStderr:I=>(v.add(I),()=>v.delete(I)),write:I=>t.post({type:"child-stdin",childId:b,data:I}),closeStdin:()=>t.post({type:"child-stdin",childId:b,data:null}),kill:(I="SIGTERM")=>t.post({type:"child-kill",childId:b,signal:I}),resize:(I,N)=>t.post({type:"child-resize",childId:b,cols:I,rows:N}),exit:Q}}function E(p){c=!0;for(let b of p.dirs)e.mkdir(b);for(let[b,w]of p.files)e.writeFile(b,w);c=!1;for(let b of p.ports)n.add(b);let C={fs:e,fetch:t.fetch,spawn(b,w,v={}){let B=v.cwd??p.cwd,Q={...p.env,...v.env};if(!Ht(e,h,b,w,B,Q))throw Wr(b);return m(b,w,{...v,cwd:B,env:Q})},listen(b,w){let v=b;if(!v)for(v=xc+p.pid%1e3*8;n.has(v);v++);if(n.has(v))throw Object.assign(new Error(`listen EADDRINUSE: address already in use :::${v}`),{code:"EADDRINUSE",errno:-98,syscall:"listen",port:v});return n.add(v),r.set(v,w),t.post({type:"listen",port:v}),{port:v,close(){r.get(v)===w&&(r.delete(v),n.delete(v),t.post({type:"unlisten",port:v}))}}},loopback(b,w){let v=r.get(b);if(v)return v(w);let B=a++;return new Promise(Q=>{i.set(B,Q),t.post({type:"loopback",reqId:B,port:b,request:w})})},serverUrl:b=>new URL(mo(p.previewBase,b),p.previewOrigin).href,announceServer:(b,w)=>t.post({type:"server-ready",port:b,url:w}),previewUrl:p.previewUrl,registry:p.registry,packageCache:p.packageCache?t.packageCache?.():void 0,ownsRealm:t.ownsRealm,trapUncaught:t.trapUncaught},y=Ht(e,h,p.command,p.args,p.cwd,p.env);if(!y){t.post({type:"stderr",data:`jsh: command not found: ${p.command}
|
|
196
|
+
`}),t.post({type:"exit",code:127});return}u=zr({program:y.program,args:y.args,system:C,cwd:p.cwd,env:p.env,terminal:p.terminal,pid:p.pid}),u.onStdout(b=>t.post({type:"stdout",data:b})),u.onStderr(b=>t.post({type:"stderr",data:b})),u.exit.then(b=>{d(),t.post({type:"exit",code:b})})}return{receive(p){switch(p.type){case"start":return E(p);case"stdin":p.data===null?u?.closeStdin():u?.write(p.data);return;case"kill":return u?.kill(p.signal);case"resize":return u?.resize?.(p.cols,p.rows);case"fs":return g(p.ops);case"ports":for(let C of p.open)n.add(C);for(let C of p.closed)r.has(C)||n.delete(C);return;case"child-out":for(let C of s.get(p.childId)?.[p.stream]??[])C(p.data);return;case"child-exit":s.get(p.childId)?.exit(p.code),s.delete(p.childId);return;case"child-error":{let C=s.get(p.childId);for(let y of C?.stderr??[])y(`${p.message}
|
|
197
|
+
`);C?.exit(p.code==="ENOENT"?127:1),s.delete(p.childId);return}case"http-request":{let C=r.get(p.port),y=b=>t.post({type:"http-response",reqId:p.reqId,response:b});if(!C)return y({status:502,headers:{"content-type":"text/plain"},body:new TextEncoder().encode(`Nothing is listening on port ${p.port}.`)});C(p.request).then(y,b=>y({status:500,headers:{"content-type":"text/plain"},body:new TextEncoder().encode(String(b instanceof Error?b.stack:b))}));return}case"loopback-response":i.get(p.reqId)?.(p.response??void 0),i.delete(p.reqId);return}}}}function yo(t="bfwc-packages"){let e=globalThis.caches;if(!e)return{get:async()=>{},put:async()=>{}};let r,n=()=>r??(r=e.open(t).catch(()=>{})),s=i=>`https://bfwc-cache.invalid/${encodeURIComponent(i)}`;return{async get(i){let o=await(await n())?.match(s(i)).catch(()=>{});return o?new Uint8Array(await o.arrayBuffer()):void 0},async put(i,o){let a=o.slice().buffer;await(await n())?.put(s(i),new Response(a)).catch(()=>{})}}}var vr=globalThis,Dc=globalThis.fetch.bind(globalThis),Oc,ct=new Set;vr.addEventListener("error",t=>{if(ct.size){t.preventDefault();for(let e of ct)e(t.error??new Error(t.message))}});vr.addEventListener("unhandledrejection",t=>{if(ct.size){t.preventDefault();for(let e of ct)e(t.reason)}});var Nc=wo({post:t=>vr.postMessage(t),fetch:(t,e)=>Dc(t,e),packageCache:()=>Oc??(Oc=yo()),ownsRealm:!0,trapUncaught(t){return ct.add(t),()=>ct.delete(t)}});vr.addEventListener("message",t=>Nc.receive(t.data));})();
|