@zenfs/core 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/backends/Index.d.ts +3 -3
  2. package/dist/backends/Index.js +4 -4
  3. package/dist/backends/backend.d.ts +1 -2
  4. package/dist/backends/backend.js +0 -5
  5. package/dist/backends/{Fetch.d.ts → fetch.d.ts} +4 -4
  6. package/dist/backends/{Fetch.js → fetch.js} +6 -7
  7. package/dist/backends/{Locked.d.ts → locked.d.ts} +2 -2
  8. package/dist/backends/{Locked.js → locked.js} +4 -5
  9. package/dist/backends/{InMemory.d.ts → memory.d.ts} +7 -9
  10. package/dist/backends/memory.js +38 -0
  11. package/dist/backends/{Overlay.d.ts → overlay.d.ts} +12 -13
  12. package/dist/backends/{Overlay.js → overlay.js} +98 -103
  13. package/dist/backends/port/fs.d.ts +15 -16
  14. package/dist/backends/port/fs.js +20 -22
  15. package/dist/backends/store/fs.d.ts +169 -0
  16. package/dist/backends/store/fs.js +743 -0
  17. package/dist/backends/store/simple.d.ts +64 -0
  18. package/dist/backends/store/simple.js +111 -0
  19. package/dist/backends/store/store.d.ts +111 -0
  20. package/dist/backends/store/store.js +62 -0
  21. package/dist/browser.min.js +4 -4
  22. package/dist/browser.min.js.map +4 -4
  23. package/dist/config.d.ts +1 -1
  24. package/dist/config.js +1 -1
  25. package/dist/emulation/shared.js +1 -1
  26. package/dist/error.d.ts +0 -1
  27. package/dist/error.js +0 -1
  28. package/dist/file.js +1 -1
  29. package/dist/filesystem.d.ts +3 -3
  30. package/dist/filesystem.js +26 -29
  31. package/dist/index.d.ts +7 -7
  32. package/dist/index.js +7 -7
  33. package/dist/inode.d.ts +1 -1
  34. package/package.json +1 -1
  35. package/src/backends/Index.ts +4 -4
  36. package/src/backends/backend.ts +3 -7
  37. package/src/backends/{Fetch.ts → fetch.ts} +13 -14
  38. package/src/backends/{Locked.ts → locked.ts} +5 -6
  39. package/src/backends/memory.ts +44 -0
  40. package/src/backends/{Overlay.ts → overlay.ts} +99 -105
  41. package/src/backends/port/fs.ts +24 -26
  42. package/src/backends/store/fs.ts +881 -0
  43. package/src/backends/store/readme.md +9 -0
  44. package/src/backends/store/simple.ts +144 -0
  45. package/src/backends/store/store.ts +164 -0
  46. package/src/config.ts +3 -3
  47. package/src/emulation/shared.ts +1 -1
  48. package/src/error.ts +0 -1
  49. package/src/file.ts +1 -1
  50. package/src/filesystem.ts +29 -32
  51. package/src/index.ts +7 -7
  52. package/src/inode.ts +1 -1
  53. package/dist/backends/AsyncStore.d.ts +0 -204
  54. package/dist/backends/AsyncStore.js +0 -509
  55. package/dist/backends/InMemory.js +0 -49
  56. package/dist/backends/SyncStore.d.ts +0 -213
  57. package/dist/backends/SyncStore.js +0 -445
  58. package/dist/backends/port/store.d.ts +0 -30
  59. package/dist/backends/port/store.js +0 -142
  60. package/src/backends/AsyncStore.ts +0 -655
  61. package/src/backends/InMemory.ts +0 -56
  62. package/src/backends/SyncStore.ts +0 -589
  63. package/src/backends/port/store.ts +0 -187
@@ -1,7 +1,7 @@
1
- "use strict";var ZenFS=(()=>{var id=Object.create;var Pi=Object.defineProperty;var rd=Object.getOwnPropertyDescriptor;var nd=Object.getOwnPropertyNames;var od=Object.getPrototypeOf,sd=Object.prototype.hasOwnProperty;var o=(t,e)=>Pi(t,"name",{value:e,configurable:!0}),ad=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),_r=(t,e)=>{for(var i in e)Pi(t,i,{get:e[i],enumerable:!0})},Gs=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of nd(e))!sd.call(t,n)&&n!==i&&Pi(t,n,{get:()=>e[n],enumerable:!(r=rd(e,n))||r.enumerable});return t};var Er=(t,e,i)=>(i=t!=null?id(od(t)):{},Gs(e||!t||!t.__esModule?Pi(i,"default",{value:t,enumerable:!0}):i,t)),ld=t=>Gs(Pi({},"__esModule",{value:!0}),t);var ca=T(qr=>{"use strict";qr.byteLength=Qd;qr.toByteArray=eh;qr.fromByteArray=rh;var Ue=[],we=[],Jd=typeof Uint8Array<"u"?Uint8Array:Array,Zn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ot=0,aa=Zn.length;Ot<aa;++Ot)Ue[Ot]=Zn[Ot],we[Zn.charCodeAt(Ot)]=Ot;var Ot,aa;we[45]=62;we[95]=63;function la(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");i===-1&&(i=e);var r=i===e?0:4-i%4;return[i,r]}o(la,"getLens");function Qd(t){var e=la(t),i=e[0],r=e[1];return(i+r)*3/4-r}o(Qd,"byteLength");function Zd(t,e,i){return(e+i)*3/4-i}o(Zd,"_byteLength");function eh(t){var e,i=la(t),r=i[0],n=i[1],s=new Jd(Zd(t,r,n)),a=0,l=n>0?r-4:r,c;for(c=0;c<l;c+=4)e=we[t.charCodeAt(c)]<<18|we[t.charCodeAt(c+1)]<<12|we[t.charCodeAt(c+2)]<<6|we[t.charCodeAt(c+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=we[t.charCodeAt(c)]<<2|we[t.charCodeAt(c+1)]>>4,s[a++]=e&255),n===1&&(e=we[t.charCodeAt(c)]<<10|we[t.charCodeAt(c+1)]<<4|we[t.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}o(eh,"toByteArray");function th(t){return Ue[t>>18&63]+Ue[t>>12&63]+Ue[t>>6&63]+Ue[t&63]}o(th,"tripletToBase64");function ih(t,e,i){for(var r,n=[],s=e;s<i;s+=3)r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(th(r));return n.join("")}o(ih,"encodeChunk");function rh(t){for(var e,i=t.length,r=i%3,n=[],s=16383,a=0,l=i-r;a<l;a+=s)n.push(ih(t,a,a+s>l?l:a+s));return r===1?(e=t[i-1],n.push(Ue[e>>2]+Ue[e<<4&63]+"==")):r===2&&(e=(t[i-2]<<8)+t[i-1],n.push(Ue[e>>10]+Ue[e>>4&63]+Ue[e<<2&63]+"=")),n.join("")}o(rh,"fromByteArray")});var fa=T(eo=>{eo.read=function(t,e,i,r,n){var s,a,l=n*8-r-1,c=(1<<l)-1,u=c>>1,d=-7,h=i?n-1:0,b=i?-1:1,m=t[e+h];for(h+=b,s=m&(1<<-d)-1,m>>=-d,d+=l;d>0;s=s*256+t[e+h],h+=b,d-=8);for(a=s&(1<<-d)-1,s>>=-d,d+=r;d>0;a=a*256+t[e+h],h+=b,d-=8);if(s===0)s=1-u;else{if(s===c)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,r),s=s-u}return(m?-1:1)*a*Math.pow(2,s-r)};eo.write=function(t,e,i,r,n,s){var a,l,c,u=s*8-n-1,d=(1<<u)-1,h=d>>1,b=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:s-1,w=r?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,a=d):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+h>=1?e+=b/c:e+=b*Math.pow(2,1-h),e*c>=2&&(a++,c/=2),a+h>=d?(l=0,a=d):a+h>=1?(l=(e*c-1)*Math.pow(2,n),a=a+h):(l=e*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;t[i+m]=l&255,m+=w,l/=256,n-=8);for(a=a<<n|l,u+=n;u>0;t[i+m]=a&255,m+=w,a/=256,u-=8);t[i+m-w]|=g*128}});var Ie=T(ni=>{"use strict";var to=ca(),ii=fa(),ua=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ni.Buffer=y;ni.SlowBuffer=ch;ni.INSPECT_MAX_BYTES=50;var jr=2147483647;ni.kMaxLength=jr;y.TYPED_ARRAY_SUPPORT=nh();!y.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function nh(){try{let t=new Uint8Array(1),e={foo:o(function(){return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}o(nh,"typedArraySupport");Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:o(function(){if(y.isBuffer(this))return this.buffer},"get")});Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:o(function(){if(y.isBuffer(this))return this.byteOffset},"get")});function Qe(t){if(t>jr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,y.prototype),e}o(Qe,"createBuffer");function y(t,e,i){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return oo(t)}return ya(t,e,i)}o(y,"Buffer");y.poolSize=8192;function ya(t,e,i){if(typeof t=="string")return sh(t,e);if(ArrayBuffer.isView(t))return ah(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(qe(t,ArrayBuffer)||t&&qe(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(qe(t,SharedArrayBuffer)||t&&qe(t.buffer,SharedArrayBuffer)))return ro(t,e,i);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return y.from(r,e,i);let n=lh(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return y.from(t[Symbol.toPrimitive]("string"),e,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}o(ya,"from");y.from=function(t,e,i){return ya(t,e,i)};Object.setPrototypeOf(y.prototype,Uint8Array.prototype);Object.setPrototypeOf(y,Uint8Array);function ma(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}o(ma,"assertSize");function oh(t,e,i){return ma(t),t<=0?Qe(t):e!==void 0?typeof i=="string"?Qe(t).fill(e,i):Qe(t).fill(e):Qe(t)}o(oh,"alloc");y.alloc=function(t,e,i){return oh(t,e,i)};function oo(t){return ma(t),Qe(t<0?0:so(t)|0)}o(oo,"allocUnsafe");y.allocUnsafe=function(t){return oo(t)};y.allocUnsafeSlow=function(t){return oo(t)};function sh(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!y.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let i=ba(t,e)|0,r=Qe(i),n=r.write(t,e);return n!==i&&(r=r.slice(0,n)),r}o(sh,"fromString");function io(t){let e=t.length<0?0:so(t.length)|0,i=Qe(e);for(let r=0;r<e;r+=1)i[r]=t[r]&255;return i}o(io,"fromArrayLike");function ah(t){if(qe(t,Uint8Array)){let e=new Uint8Array(t);return ro(e.buffer,e.byteOffset,e.byteLength)}return io(t)}o(ah,"fromArrayView");function ro(t,e,i){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(i||0))throw new RangeError('"length" is outside of buffer bounds');let r;return e===void 0&&i===void 0?r=new Uint8Array(t):i===void 0?r=new Uint8Array(t,e):r=new Uint8Array(t,e,i),Object.setPrototypeOf(r,y.prototype),r}o(ro,"fromArrayBuffer");function lh(t){if(y.isBuffer(t)){let e=so(t.length)|0,i=Qe(e);return i.length===0||t.copy(i,0,0,e),i}if(t.length!==void 0)return typeof t.length!="number"||lo(t.length)?Qe(0):io(t);if(t.type==="Buffer"&&Array.isArray(t.data))return io(t.data)}o(lh,"fromObject");function so(t){if(t>=jr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+jr.toString(16)+" bytes");return t|0}o(so,"checked");function ch(t){return+t!=t&&(t=0),y.alloc(+t)}o(ch,"SlowBuffer");y.isBuffer=o(function(e){return e!=null&&e._isBuffer===!0&&e!==y.prototype},"isBuffer");y.compare=o(function(e,i){if(qe(e,Uint8Array)&&(e=y.from(e,e.offset,e.byteLength)),qe(i,Uint8Array)&&(i=y.from(i,i.offset,i.byteLength)),!y.isBuffer(e)||!y.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===i)return 0;let r=e.length,n=i.length;for(let s=0,a=Math.min(r,n);s<a;++s)if(e[s]!==i[s]){r=e[s],n=i[s];break}return r<n?-1:n<r?1:0},"compare");y.isEncoding=o(function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding");y.concat=o(function(e,i){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return y.alloc(0);let r;if(i===void 0)for(i=0,r=0;r<e.length;++r)i+=e[r].length;let n=y.allocUnsafe(i),s=0;for(r=0;r<e.length;++r){let a=e[r];if(qe(a,Uint8Array))s+a.length>n.length?(y.isBuffer(a)||(a=y.from(a)),a.copy(n,s)):Uint8Array.prototype.set.call(n,a,s);else if(y.isBuffer(a))a.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return n},"concat");function ba(t,e){if(y.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||qe(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let i=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&i===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return no(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return Ia(t).length;default:if(n)return r?-1:no(t).length;e=(""+e).toLowerCase(),n=!0}}o(ba,"byteLength");y.byteLength=ba;function fh(t,e,i){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,e>>>=0,i<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Sh(this,e,i);case"utf8":case"utf-8":return wa(this,e,i);case"ascii":return gh(this,e,i);case"latin1":case"binary":return wh(this,e,i);case"base64":return mh(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _h(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}o(fh,"slowToString");y.prototype._isBuffer=!0;function Ct(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}o(Ct,"swap");y.prototype.swap16=o(function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let i=0;i<e;i+=2)Ct(this,i,i+1);return this},"swap16");y.prototype.swap32=o(function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let i=0;i<e;i+=4)Ct(this,i,i+3),Ct(this,i+1,i+2);return this},"swap32");y.prototype.swap64=o(function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let i=0;i<e;i+=8)Ct(this,i,i+7),Ct(this,i+1,i+6),Ct(this,i+2,i+5),Ct(this,i+3,i+4);return this},"swap64");y.prototype.toString=o(function(){let e=this.length;return e===0?"":arguments.length===0?wa(this,0,e):fh.apply(this,arguments)},"toString");y.prototype.toLocaleString=y.prototype.toString;y.prototype.equals=o(function(e){if(!y.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:y.compare(this,e)===0},"equals");y.prototype.inspect=o(function(){let e="",i=ni.INSPECT_MAX_BYTES;return e=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(e+=" ... "),"<Buffer "+e+">"},"inspect");ua&&(y.prototype[ua]=y.prototype.inspect);y.prototype.compare=o(function(e,i,r,n,s){if(qe(e,Uint8Array)&&(e=y.from(e,e.offset,e.byteLength)),!y.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(i===void 0&&(i=0),r===void 0&&(r=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),i<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&i>=r)return 0;if(n>=s)return-1;if(i>=r)return 1;if(i>>>=0,r>>>=0,n>>>=0,s>>>=0,this===e)return 0;let a=s-n,l=r-i,c=Math.min(a,l),u=this.slice(n,s),d=e.slice(i,r);for(let h=0;h<c;++h)if(u[h]!==d[h]){a=u[h],l=d[h];break}return a<l?-1:l<a?1:0},"compare");function ga(t,e,i,r,n){if(t.length===0)return-1;if(typeof i=="string"?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,lo(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0)if(n)i=0;else return-1;if(typeof e=="string"&&(e=y.from(e,r)),y.isBuffer(e))return e.length===0?-1:da(t,e,i,r,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):da(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}o(ga,"bidirectionalIndexOf");function da(t,e,i,r,n){let s=1,a=t.length,l=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,i/=2}function c(d,h){return s===1?d[h]:d.readUInt16BE(h*s)}o(c,"read");let u;if(n){let d=-1;for(u=i;u<a;u++)if(c(t,u)===c(e,d===-1?0:u-d)){if(d===-1&&(d=u),u-d+1===l)return d*s}else d!==-1&&(u-=u-d),d=-1}else for(i+l>a&&(i=a-l),u=i;u>=0;u--){let d=!0;for(let h=0;h<l;h++)if(c(t,u+h)!==c(e,h)){d=!1;break}if(d)return u}return-1}o(da,"arrayIndexOf");y.prototype.includes=o(function(e,i,r){return this.indexOf(e,i,r)!==-1},"includes");y.prototype.indexOf=o(function(e,i,r){return ga(this,e,i,r,!0)},"indexOf");y.prototype.lastIndexOf=o(function(e,i,r){return ga(this,e,i,r,!1)},"lastIndexOf");function uh(t,e,i,r){i=Number(i)||0;let n=t.length-i;r?(r=Number(r),r>n&&(r=n)):r=n;let s=e.length;r>s/2&&(r=s/2);let a;for(a=0;a<r;++a){let l=parseInt(e.substr(a*2,2),16);if(lo(l))return a;t[i+a]=l}return a}o(uh,"hexWrite");function dh(t,e,i,r){return $r(no(e,t.length-i),t,i,r)}o(dh,"utf8Write");function hh(t,e,i,r){return $r(Fh(e),t,i,r)}o(hh,"asciiWrite");function ph(t,e,i,r){return $r(Ia(e),t,i,r)}o(ph,"base64Write");function yh(t,e,i,r){return $r(Ih(e,t.length-i),t,i,r)}o(yh,"ucs2Write");y.prototype.write=o(function(e,i,r,n){if(i===void 0)n="utf8",r=this.length,i=0;else if(r===void 0&&typeof i=="string")n=i,r=this.length,i=0;else if(isFinite(i))i=i>>>0,isFinite(r)?(r=r>>>0,n===void 0&&(n="utf8")):(n=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-i;if((r===void 0||r>s)&&(r=s),e.length>0&&(r<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return uh(this,e,i,r);case"utf8":case"utf-8":return dh(this,e,i,r);case"ascii":case"latin1":case"binary":return hh(this,e,i,r);case"base64":return ph(this,e,i,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yh(this,e,i,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},"write");y.prototype.toJSON=o(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function mh(t,e,i){return e===0&&i===t.length?to.fromByteArray(t):to.fromByteArray(t.slice(e,i))}o(mh,"base64Slice");function wa(t,e,i){i=Math.min(t.length,i);let r=[],n=e;for(;n<i;){let s=t[n],a=null,l=s>239?4:s>223?3:s>191?2:1;if(n+l<=i){let c,u,d,h;switch(l){case 1:s<128&&(a=s);break;case 2:c=t[n+1],(c&192)===128&&(h=(s&31)<<6|c&63,h>127&&(a=h));break;case 3:c=t[n+1],u=t[n+2],(c&192)===128&&(u&192)===128&&(h=(s&15)<<12|(c&63)<<6|u&63,h>2047&&(h<55296||h>57343)&&(a=h));break;case 4:c=t[n+1],u=t[n+2],d=t[n+3],(c&192)===128&&(u&192)===128&&(d&192)===128&&(h=(s&15)<<18|(c&63)<<12|(u&63)<<6|d&63,h>65535&&h<1114112&&(a=h))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),n+=l}return bh(r)}o(wa,"utf8Slice");var ha=4096;function bh(t){let e=t.length;if(e<=ha)return String.fromCharCode.apply(String,t);let i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=ha));return i}o(bh,"decodeCodePointsArray");function gh(t,e,i){let r="";i=Math.min(t.length,i);for(let n=e;n<i;++n)r+=String.fromCharCode(t[n]&127);return r}o(gh,"asciiSlice");function wh(t,e,i){let r="";i=Math.min(t.length,i);for(let n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}o(wh,"latin1Slice");function Sh(t,e,i){let r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);let n="";for(let s=e;s<i;++s)n+=vh[t[s]];return n}o(Sh,"hexSlice");function _h(t,e,i){let r=t.slice(e,i),n="";for(let s=0;s<r.length-1;s+=2)n+=String.fromCharCode(r[s]+r[s+1]*256);return n}o(_h,"utf16leSlice");y.prototype.slice=o(function(e,i){let r=this.length;e=~~e,i=i===void 0?r:~~i,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),i<0?(i+=r,i<0&&(i=0)):i>r&&(i=r),i<e&&(i=e);let n=this.subarray(e,i);return Object.setPrototypeOf(n,y.prototype),n},"slice");function X(t,e,i){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}o(X,"checkOffset");y.prototype.readUintLE=y.prototype.readUIntLE=o(function(e,i,r){e=e>>>0,i=i>>>0,r||X(e,i,this.length);let n=this[e],s=1,a=0;for(;++a<i&&(s*=256);)n+=this[e+a]*s;return n},"readUIntLE");y.prototype.readUintBE=y.prototype.readUIntBE=o(function(e,i,r){e=e>>>0,i=i>>>0,r||X(e,i,this.length);let n=this[e+--i],s=1;for(;i>0&&(s*=256);)n+=this[e+--i]*s;return n},"readUIntBE");y.prototype.readUint8=y.prototype.readUInt8=o(function(e,i){return e=e>>>0,i||X(e,1,this.length),this[e]},"readUInt8");y.prototype.readUint16LE=y.prototype.readUInt16LE=o(function(e,i){return e=e>>>0,i||X(e,2,this.length),this[e]|this[e+1]<<8},"readUInt16LE");y.prototype.readUint16BE=y.prototype.readUInt16BE=o(function(e,i){return e=e>>>0,i||X(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");y.prototype.readUint32LE=y.prototype.readUInt32LE=o(function(e,i){return e=e>>>0,i||X(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE");y.prototype.readUint32BE=y.prototype.readUInt32BE=o(function(e,i){return e=e>>>0,i||X(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"readUInt32BE");y.prototype.readBigUInt64LE=ut(o(function(e){e=e>>>0,ri(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Xi(e,this.length-8);let n=i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))},"readBigUInt64LE"));y.prototype.readBigUInt64BE=ut(o(function(e){e=e>>>0,ri(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Xi(e,this.length-8);let n=i*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(n)<<BigInt(32))+BigInt(s)},"readBigUInt64BE"));y.prototype.readIntLE=o(function(e,i,r){e=e>>>0,i=i>>>0,r||X(e,i,this.length);let n=this[e],s=1,a=0;for(;++a<i&&(s*=256);)n+=this[e+a]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*i)),n},"readIntLE");y.prototype.readIntBE=o(function(e,i,r){e=e>>>0,i=i>>>0,r||X(e,i,this.length);let n=i,s=1,a=this[e+--n];for(;n>0&&(s*=256);)a+=this[e+--n]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*i)),a},"readIntBE");y.prototype.readInt8=o(function(e,i){return e=e>>>0,i||X(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8");y.prototype.readInt16LE=o(function(e,i){e=e>>>0,i||X(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r},"readInt16LE");y.prototype.readInt16BE=o(function(e,i){e=e>>>0,i||X(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r},"readInt16BE");y.prototype.readInt32LE=o(function(e,i){return e=e>>>0,i||X(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");y.prototype.readInt32BE=o(function(e,i){return e=e>>>0,i||X(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");y.prototype.readBigInt64LE=ut(o(function(e){e=e>>>0,ri(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Xi(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)},"readBigInt64LE"));y.prototype.readBigInt64BE=ut(o(function(e){e=e>>>0,ri(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Xi(e,this.length-8);let n=(i<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r)},"readBigInt64BE"));y.prototype.readFloatLE=o(function(e,i){return e=e>>>0,i||X(e,4,this.length),ii.read(this,e,!0,23,4)},"readFloatLE");y.prototype.readFloatBE=o(function(e,i){return e=e>>>0,i||X(e,4,this.length),ii.read(this,e,!1,23,4)},"readFloatBE");y.prototype.readDoubleLE=o(function(e,i){return e=e>>>0,i||X(e,8,this.length),ii.read(this,e,!0,52,8)},"readDoubleLE");y.prototype.readDoubleBE=o(function(e,i){return e=e>>>0,i||X(e,8,this.length),ii.read(this,e,!1,52,8)},"readDoubleBE");function le(t,e,i,r,n,s){if(!y.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}o(le,"checkInt");y.prototype.writeUintLE=y.prototype.writeUIntLE=o(function(e,i,r,n){if(e=+e,i=i>>>0,r=r>>>0,!n){let l=Math.pow(2,8*r)-1;le(this,e,i,r,l,0)}let s=1,a=0;for(this[i]=e&255;++a<r&&(s*=256);)this[i+a]=e/s&255;return i+r},"writeUIntLE");y.prototype.writeUintBE=y.prototype.writeUIntBE=o(function(e,i,r,n){if(e=+e,i=i>>>0,r=r>>>0,!n){let l=Math.pow(2,8*r)-1;le(this,e,i,r,l,0)}let s=r-1,a=1;for(this[i+s]=e&255;--s>=0&&(a*=256);)this[i+s]=e/a&255;return i+r},"writeUIntBE");y.prototype.writeUint8=y.prototype.writeUInt8=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,1,255,0),this[i]=e&255,i+1},"writeUInt8");y.prototype.writeUint16LE=y.prototype.writeUInt16LE=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,2,65535,0),this[i]=e&255,this[i+1]=e>>>8,i+2},"writeUInt16LE");y.prototype.writeUint16BE=y.prototype.writeUInt16BE=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,2,65535,0),this[i]=e>>>8,this[i+1]=e&255,i+2},"writeUInt16BE");y.prototype.writeUint32LE=y.prototype.writeUInt32LE=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,4,4294967295,0),this[i+3]=e>>>24,this[i+2]=e>>>16,this[i+1]=e>>>8,this[i]=e&255,i+4},"writeUInt32LE");y.prototype.writeUint32BE=y.prototype.writeUInt32BE=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,4,4294967295,0),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4},"writeUInt32BE");function Sa(t,e,i,r,n){Fa(e,r,n,t,i,7);let s=Number(e&BigInt(4294967295));t[i++]=s,s=s>>8,t[i++]=s,s=s>>8,t[i++]=s,s=s>>8,t[i++]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[i++]=a,a=a>>8,t[i++]=a,a=a>>8,t[i++]=a,a=a>>8,t[i++]=a,i}o(Sa,"wrtBigUInt64LE");function _a(t,e,i,r,n){Fa(e,r,n,t,i,7);let s=Number(e&BigInt(4294967295));t[i+7]=s,s=s>>8,t[i+6]=s,s=s>>8,t[i+5]=s,s=s>>8,t[i+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[i+3]=a,a=a>>8,t[i+2]=a,a=a>>8,t[i+1]=a,a=a>>8,t[i]=a,i+8}o(_a,"wrtBigUInt64BE");y.prototype.writeBigUInt64LE=ut(o(function(e,i=0){return Sa(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE"));y.prototype.writeBigUInt64BE=ut(o(function(e,i=0){return _a(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE"));y.prototype.writeIntLE=o(function(e,i,r,n){if(e=+e,i=i>>>0,!n){let c=Math.pow(2,8*r-1);le(this,e,i,r,c-1,-c)}let s=0,a=1,l=0;for(this[i]=e&255;++s<r&&(a*=256);)e<0&&l===0&&this[i+s-1]!==0&&(l=1),this[i+s]=(e/a>>0)-l&255;return i+r},"writeIntLE");y.prototype.writeIntBE=o(function(e,i,r,n){if(e=+e,i=i>>>0,!n){let c=Math.pow(2,8*r-1);le(this,e,i,r,c-1,-c)}let s=r-1,a=1,l=0;for(this[i+s]=e&255;--s>=0&&(a*=256);)e<0&&l===0&&this[i+s+1]!==0&&(l=1),this[i+s]=(e/a>>0)-l&255;return i+r},"writeIntBE");y.prototype.writeInt8=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,1,127,-128),e<0&&(e=255+e+1),this[i]=e&255,i+1},"writeInt8");y.prototype.writeInt16LE=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,2,32767,-32768),this[i]=e&255,this[i+1]=e>>>8,i+2},"writeInt16LE");y.prototype.writeInt16BE=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,2,32767,-32768),this[i]=e>>>8,this[i+1]=e&255,i+2},"writeInt16BE");y.prototype.writeInt32LE=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,4,2147483647,-2147483648),this[i]=e&255,this[i+1]=e>>>8,this[i+2]=e>>>16,this[i+3]=e>>>24,i+4},"writeInt32LE");y.prototype.writeInt32BE=o(function(e,i,r){return e=+e,i=i>>>0,r||le(this,e,i,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4},"writeInt32BE");y.prototype.writeBigInt64LE=ut(o(function(e,i=0){return Sa(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));y.prototype.writeBigInt64BE=ut(o(function(e,i=0){return _a(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Ea(t,e,i,r,n,s){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}o(Ea,"checkIEEE754");function xa(t,e,i,r,n){return e=+e,i=i>>>0,n||Ea(t,e,i,4,34028234663852886e22,-34028234663852886e22),ii.write(t,e,i,r,23,4),i+4}o(xa,"writeFloat");y.prototype.writeFloatLE=o(function(e,i,r){return xa(this,e,i,!0,r)},"writeFloatLE");y.prototype.writeFloatBE=o(function(e,i,r){return xa(this,e,i,!1,r)},"writeFloatBE");function ka(t,e,i,r,n){return e=+e,i=i>>>0,n||Ea(t,e,i,8,17976931348623157e292,-17976931348623157e292),ii.write(t,e,i,r,52,8),i+8}o(ka,"writeDouble");y.prototype.writeDoubleLE=o(function(e,i,r){return ka(this,e,i,!0,r)},"writeDoubleLE");y.prototype.writeDoubleBE=o(function(e,i,r){return ka(this,e,i,!1,r)},"writeDoubleBE");y.prototype.copy=o(function(e,i,r,n){if(!y.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&n!==0&&(n=this.length),i>=e.length&&(i=e.length),i||(i=0),n>0&&n<r&&(n=r),n===r||e.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-i<n-r&&(n=e.length-i+r);let s=n-r;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(i,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),i),s},"copy");y.prototype.fill=o(function(e,i,r,n){if(typeof e=="string"){if(typeof i=="string"?(n=i,i=0,r=this.length):typeof r=="string"&&(n=r,r=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!y.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let a=e.charCodeAt(0);(n==="utf8"&&a<128||n==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(i<0||this.length<i||this.length<r)throw new RangeError("Out of range index");if(r<=i)return this;i=i>>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let s;if(typeof e=="number")for(s=i;s<r;++s)this[s]=e;else{let a=y.isBuffer(e)?e:y.from(e,n),l=a.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-i;++s)this[s+i]=a[s%l]}return this},"fill");var ti={};function ao(t,e,i){ti[t]=class extends i{static{o(this,"NodeError")}constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}o(ao,"E");ao("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ao("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ao("ERR_OUT_OF_RANGE",function(t,e,i){let r=`The value of "${t}" is out of range.`,n=i;return Number.isInteger(i)&&Math.abs(i)>2**32?n=pa(String(i)):typeof i=="bigint"&&(n=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(n=pa(n)),n+="n"),r+=` It must be ${e}. Received ${n}`,r},RangeError);function pa(t){let e="",i=t.length,r=t[0]==="-"?1:0;for(;i>=r+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}o(pa,"addNumericalSeparator");function Eh(t,e,i){ri(e,"offset"),(t[e]===void 0||t[e+i]===void 0)&&Xi(e,t.length-(i+1))}o(Eh,"checkBounds");function Fa(t,e,i,r,n,s){if(t>i||t<e){let a=typeof e=="bigint"?"n":"",l;throw s>3?e===0||e===BigInt(0)?l=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:l=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:l=`>= ${e}${a} and <= ${i}${a}`,new ti.ERR_OUT_OF_RANGE("value",l,t)}Eh(r,n,s)}o(Fa,"checkIntBI");function ri(t,e){if(typeof t!="number")throw new ti.ERR_INVALID_ARG_TYPE(e,"number",t)}o(ri,"validateNumber");function Xi(t,e,i){throw Math.floor(t)!==t?(ri(t,i),new ti.ERR_OUT_OF_RANGE(i||"offset","an integer",t)):e<0?new ti.ERR_BUFFER_OUT_OF_BOUNDS:new ti.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${e}`,t)}o(Xi,"boundsError");var xh=/[^+/0-9A-Za-z-_]/g;function kh(t){if(t=t.split("=")[0],t=t.trim().replace(xh,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}o(kh,"base64clean");function no(t,e){e=e||1/0;let i,r=t.length,n=null,s=[];for(let a=0;a<r;++a){if(i=t.charCodeAt(a),i>55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===r){(e-=3)>-1&&s.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&s.push(239,191,189),n=i;continue}i=(n-55296<<10|i-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;s.push(i)}else if(i<2048){if((e-=2)<0)break;s.push(i>>6|192,i&63|128)}else if(i<65536){if((e-=3)<0)break;s.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((e-=4)<0)break;s.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return s}o(no,"utf8ToBytes");function Fh(t){let e=[];for(let i=0;i<t.length;++i)e.push(t.charCodeAt(i)&255);return e}o(Fh,"asciiToBytes");function Ih(t,e){let i,r,n,s=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)i=t.charCodeAt(a),r=i>>8,n=i%256,s.push(n),s.push(r);return s}o(Ih,"utf16leToBytes");function Ia(t){return to.toByteArray(kh(t))}o(Ia,"base64ToBytes");function $r(t,e,i,r){let n;for(n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}o($r,"blitBuffer");function qe(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}o(qe,"isInstance");function lo(t){return t!==t}o(lo,"numberIsNaN");var vh=function(){let t="0123456789abcdef",e=new Array(256);for(let i=0;i<16;++i){let r=i*16;for(let n=0;n<16;++n)e[r+n]=t[i]+t[n]}return e}();function ut(t){return typeof BigInt>"u"?Ph:t}o(ut,"defineBigIntMethod");function Ph(){throw new Error("BigInt not supported")}o(Ph,"BufferBigIntNotDefined")});var W=T((B_,Ja)=>{"use strict";Ja.exports={ArrayIsArray:o(function(t){return Array.isArray(t)},"ArrayIsArray"),ArrayPrototypeIncludes:o(function(t,e){return t.includes(e)},"ArrayPrototypeIncludes"),ArrayPrototypeIndexOf:o(function(t,e){return t.indexOf(e)},"ArrayPrototypeIndexOf"),ArrayPrototypeJoin:o(function(t,e){return t.join(e)},"ArrayPrototypeJoin"),ArrayPrototypeMap:o(function(t,e){return t.map(e)},"ArrayPrototypeMap"),ArrayPrototypePop:o(function(t,e){return t.pop(e)},"ArrayPrototypePop"),ArrayPrototypePush:o(function(t,e){return t.push(e)},"ArrayPrototypePush"),ArrayPrototypeSlice:o(function(t,e,i){return t.slice(e,i)},"ArrayPrototypeSlice"),Error,FunctionPrototypeCall:o(function(t,e,...i){return t.call(e,...i)},"FunctionPrototypeCall"),FunctionPrototypeSymbolHasInstance:o(function(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},"FunctionPrototypeSymbolHasInstance"),MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:o(function(t,e){return Object.defineProperties(t,e)},"ObjectDefineProperties"),ObjectDefineProperty:o(function(t,e,i){return Object.defineProperty(t,e,i)},"ObjectDefineProperty"),ObjectGetOwnPropertyDescriptor:o(function(t,e){return Object.getOwnPropertyDescriptor(t,e)},"ObjectGetOwnPropertyDescriptor"),ObjectKeys:o(function(t){return Object.keys(t)},"ObjectKeys"),ObjectSetPrototypeOf:o(function(t,e){return Object.setPrototypeOf(t,e)},"ObjectSetPrototypeOf"),Promise,PromisePrototypeCatch:o(function(t,e){return t.catch(e)},"PromisePrototypeCatch"),PromisePrototypeThen:o(function(t,e,i){return t.then(e,i)},"PromisePrototypeThen"),PromiseReject:o(function(t){return Promise.reject(t)},"PromiseReject"),PromiseResolve:o(function(t){return Promise.resolve(t)},"PromiseResolve"),ReflectApply:Reflect.apply,RegExpPrototypeTest:o(function(t,e){return t.test(e)},"RegExpPrototypeTest"),SafeSet:Set,String,StringPrototypeSlice:o(function(t,e,i){return t.slice(e,i)},"StringPrototypeSlice"),StringPrototypeToLowerCase:o(function(t){return t.toLowerCase()},"StringPrototypeToLowerCase"),StringPrototypeToUpperCase:o(function(t){return t.toUpperCase()},"StringPrototypeToUpperCase"),StringPrototypeTrim:o(function(t){return t.trim()},"StringPrototypeTrim"),Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet:o(function(t,e,i){return t.set(e,i)},"TypedArrayPrototypeSet"),Boolean,Uint8Array}});var fi=T((W_,Jr)=>{"use strict";var{AbortController:Qa,AbortSignal:Oh}=typeof self<"u"?self:typeof window<"u"?window:void 0;Jr.exports=Qa;Jr.exports.AbortSignal=Oh;Jr.exports.default=Qa});var rr=T((U_,go)=>{"use strict";var ui=typeof Reflect=="object"?Reflect:null,Za=ui&&typeof ui.apply=="function"?ui.apply:o(function(e,i,r){return Function.prototype.apply.call(e,i,r)},"ReflectApply"),Qr;ui&&typeof ui.ownKeys=="function"?Qr=ui.ownKeys:Object.getOwnPropertySymbols?Qr=o(function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):Qr=o(function(e){return Object.getOwnPropertyNames(e)},"ReflectOwnKeys");function Ch(t){console&&console.warn&&console.warn(t)}o(Ch,"ProcessEmitWarning");var tl=Number.isNaN||o(function(e){return e!==e},"NumberIsNaN");function R(){R.init.call(this)}o(R,"EventEmitter");go.exports=R;go.exports.once=Bh;R.EventEmitter=R;R.prototype._events=void 0;R.prototype._eventsCount=0;R.prototype._maxListeners=void 0;var el=10;function Zr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}o(Zr,"checkListener");Object.defineProperty(R,"defaultMaxListeners",{enumerable:!0,get:o(function(){return el},"get"),set:o(function(t){if(typeof t!="number"||t<0||tl(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");el=t},"set")});R.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};R.prototype.setMaxListeners=o(function(e){if(typeof e!="number"||e<0||tl(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},"setMaxListeners");function il(t){return t._maxListeners===void 0?R.defaultMaxListeners:t._maxListeners}o(il,"_getMaxListeners");R.prototype.getMaxListeners=o(function(){return il(this)},"getMaxListeners");R.prototype.emit=o(function(e){for(var i=[],r=1;r<arguments.length;r++)i.push(arguments[r]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var a;if(i.length>0&&(a=i[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Za(c,this,i);else for(var u=c.length,d=al(c,u),r=0;r<u;++r)Za(d[r],this,i);return!0},"emit");function rl(t,e,i,r){var n,s,a;if(Zr(i),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,i.listener?i.listener:i),s=t._events),a=s[e]),a===void 0)a=s[e]=i,++t._eventsCount;else if(typeof a=="function"?a=s[e]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),n=il(t),n>0&&a.length>n&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,Ch(l)}return t}o(rl,"_addListener");R.prototype.addListener=o(function(e,i){return rl(this,e,i,!1)},"addListener");R.prototype.on=R.prototype.addListener;R.prototype.prependListener=o(function(e,i){return rl(this,e,i,!0)},"prependListener");function Lh(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}o(Lh,"onceWrapper");function nl(t,e,i){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},n=Lh.bind(r);return n.listener=i,r.wrapFn=n,n}o(nl,"_onceWrap");R.prototype.once=o(function(e,i){return Zr(i),this.on(e,nl(this,e,i)),this},"once");R.prototype.prependOnceListener=o(function(e,i){return Zr(i),this.prependListener(e,nl(this,e,i)),this},"prependOnceListener");R.prototype.removeListener=o(function(e,i){var r,n,s,a,l;if(Zr(i),n=this._events,n===void 0)return this;if(r=n[e],r===void 0)return this;if(r===i||r.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||i));else if(typeof r!="function"){for(s=-1,a=r.length-1;a>=0;a--)if(r[a]===i||r[a].listener===i){l=r[a].listener,s=a;break}if(s<0)return this;s===0?r.shift():Nh(r,s),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,l||i)}return this},"removeListener");R.prototype.off=R.prototype.removeListener;R.prototype.removeAllListeners=o(function(e){var i,r,n;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s=Object.keys(r),a;for(n=0;n<s.length;++n)a=s[n],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=r[e],typeof i=="function")this.removeListener(e,i);else if(i!==void 0)for(n=i.length-1;n>=0;n--)this.removeListener(e,i[n]);return this},"removeAllListeners");function ol(t,e,i){var r=t._events;if(r===void 0)return[];var n=r[e];return n===void 0?[]:typeof n=="function"?i?[n.listener||n]:[n]:i?Dh(n):al(n,n.length)}o(ol,"_listeners");R.prototype.listeners=o(function(e){return ol(this,e,!0)},"listeners");R.prototype.rawListeners=o(function(e){return ol(this,e,!1)},"rawListeners");R.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):sl.call(t,e)};R.prototype.listenerCount=sl;function sl(t){var e=this._events;if(e!==void 0){var i=e[t];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}o(sl,"listenerCount");R.prototype.eventNames=o(function(){return this._eventsCount>0?Qr(this._events):[]},"eventNames");function al(t,e){for(var i=new Array(e),r=0;r<e;++r)i[r]=t[r];return i}o(al,"arrayClone");function Nh(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}o(Nh,"spliceOne");function Dh(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}o(Dh,"unwrapListeners");function Bh(t,e){return new Promise(function(i,r){function n(a){t.removeListener(e,s),r(a)}o(n,"errorListener");function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),i([].slice.call(arguments))}o(s,"resolver"),ll(t,e,s,{once:!0}),e!=="error"&&Mh(t,n,{once:!0})})}o(Bh,"once");function Mh(t,e,i){typeof t.on=="function"&&ll(t,"error",e,i)}o(Mh,"addErrorHandlerIfEventEmitter");function ll(t,e,i,r){if(typeof t.on=="function")r.once?t.once(e,i):t.on(e,i);else if(typeof t.addEventListener=="function")t.addEventListener(e,o(function n(s){r.once&&t.removeEventListener(e,n),i(s)},"wrapListener"));else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}o(ll,"eventTargetAgnosticAddListener")});var ee=T((j_,So)=>{"use strict";var Wh=Ie(),{kResistStopPropagation:Uh,SymbolDispose:qh}=W(),jh=globalThis.AbortSignal||fi().AbortSignal,$h=globalThis.AbortController||fi().AbortController,Vh=Object.getPrototypeOf(async function(){}).constructor,cl=globalThis.Blob||Wh.Blob,zh=o(typeof cl<"u"?function(e){return e instanceof cl}:function(e){return!1},"isBlob"),fl=o((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},"validateAbortSignal"),Hh=o((t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},"validateFunction"),wo=class extends Error{static{o(this,"AggregateError")}constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let i="";for(let r=0;r<e.length;r++)i+=` ${e[r].stack}
2
- `;super(i),this.name="AggregateError",this.errors=e}};So.exports={AggregateError:wo,kEmptyObject:Object.freeze({}),once:o(function(t){let e=!1;return function(...i){e||(e=!0,t.apply(this,i))}},"once"),createDeferredPromise:o(function(){let t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}},"createDeferredPromise"),promisify:o(function(t){return new Promise((e,i)=>{t((r,...n)=>r?i(r):e(...n))})},"promisify"),debuglog:o(function(){return function(){}},"debuglog"),format:o(function(t,...e){return t.replace(/%([sdifj])/g,function(...[i,r]){let n=e.shift();return r==="f"?n.toFixed(6):r==="j"?JSON.stringify(n):r==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},"format"),inspect:o(function(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},"inspect"),types:{isAsyncFunction:o(function(t){return t instanceof Vh},"isAsyncFunction"),isArrayBufferView:o(function(t){return ArrayBuffer.isView(t)},"isArrayBufferView")},isBlob:zh,deprecate:o(function(t,e){return t},"deprecate"),addAbortListener:rr().addAbortListener||o(function(e,i){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);fl(e,"signal"),Hh(i,"listener");let r;return e.aborted?queueMicrotask(()=>i()):(e.addEventListener("abort",i,{__proto__:null,once:!0,[Uh]:!0}),r=o(()=>{e.removeEventListener("abort",i)},"removeEventListener")),{__proto__:null,[qh](){var n;(n=r)===null||n===void 0||n()}}},"addAbortListener"),AbortSignalAny:jh.any||o(function(e){if(e.length===1)return e[0];let i=new $h,r=o(()=>i.abort(),"abort");return e.forEach(n=>{fl(n,"signals"),n.addEventListener("abort",r,{once:!0})}),i.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",r))},{once:!0}),i.signal},"AbortSignalAny")};So.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ne=T((V_,hl)=>{"use strict";var{format:Yh,inspect:en,AggregateError:Gh}=ee(),Kh=globalThis.AggregateError||Gh,Xh=Symbol("kIsNodeError"),Jh=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Qh=/^([A-Z][a-z0-9]*)+$/,Zh="__node_internal_",tn={};function Dt(t,e){if(!t)throw new tn.ERR_INTERNAL_ASSERTION(e)}o(Dt,"assert");function ul(t){let e="",i=t.length,r=t[0]==="-"?1:0;for(;i>=r+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}o(ul,"addNumericalSeparator");function ep(t,e,i){if(typeof e=="function")return Dt(e.length<=i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${e.length}).`),e(...i);let r=(e.match(/%[dfijoOs]/g)||[]).length;return Dt(r===i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${r}).`),i.length===0?e:Yh(e,...i)}o(ep,"getMessage");function Q(t,e,i){i||(i=Error);class r extends i{static{o(this,"NodeError")}constructor(...s){super(ep(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:i.name,writable:!0,enumerable:!1,configurable:!0},toString:{value:o(function(){return`${this.name} [${t}]: ${this.message}`},"value"),writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=t,r.prototype[Xh]=!0,tn[t]=r}o(Q,"E");function dl(t){let e=Zh+t.name;return Object.defineProperty(t,"name",{value:e}),t}o(dl,"hideStackFrames");function tp(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let i=new Kh([e,t],e.message);return i.code=e.code,i}return t||e}o(tp,"aggregateTwoErrors");var _o=class extends Error{static{o(this,"AbortError")}constructor(e="The operation was aborted",i=void 0){if(i!==void 0&&typeof i!="object")throw new tn.ERR_INVALID_ARG_TYPE("options","Object",i);super(e,i),this.code="ABORT_ERR",this.name="AbortError"}};Q("ERR_ASSERTION","%s",Error);Q("ERR_INVALID_ARG_TYPE",(t,e,i)=>{Dt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let r="The ";t.endsWith(" argument")?r+=`${t} `:r+=`"${t}" ${t.includes(".")?"property":"argument"} `,r+="must be ";let n=[],s=[],a=[];for(let c of e)Dt(typeof c=="string","All expected entries have to be of type string"),Jh.includes(c)?n.push(c.toLowerCase()):Qh.test(c)?s.push(c):(Dt(c!=="object",'The value "object" should be written as "Object"'),a.push(c));if(s.length>0){let c=n.indexOf("object");c!==-1&&(n.splice(n,c,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:r+=`of type ${n[0]}`;break;case 2:r+=`one of type ${n[0]} or ${n[1]}`;break;default:{let c=n.pop();r+=`one of type ${n.join(", ")}, or ${c}`}}(s.length>0||a.length>0)&&(r+=" or ")}if(s.length>0){switch(s.length){case 1:r+=`an instance of ${s[0]}`;break;case 2:r+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let c=s.pop();r+=`an instance of ${s.join(", ")}, or ${c}`}}a.length>0&&(r+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(r+="an "),r+=`${a[0]}`;break;case 2:r+=`one of ${a[0]} or ${a[1]}`;break;default:{let c=a.pop();r+=`one of ${a.join(", ")}, or ${c}`}}if(i==null)r+=`. Received ${i}`;else if(typeof i=="function"&&i.name)r+=`. Received function ${i.name}`;else if(typeof i=="object"){var l;if((l=i.constructor)!==null&&l!==void 0&&l.name)r+=`. Received an instance of ${i.constructor.name}`;else{let c=en(i,{depth:-1});r+=`. Received ${c}`}}else{let c=en(i,{colors:!1});c.length>25&&(c=`${c.slice(0,25)}...`),r+=`. Received type ${typeof i} (${c})`}return r},TypeError);Q("ERR_INVALID_ARG_VALUE",(t,e,i="is invalid")=>{let r=en(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${i}. Received ${r}`},TypeError);Q("ERR_INVALID_RETURN_VALUE",(t,e,i)=>{var r;let n=i!=null&&(r=i.constructor)!==null&&r!==void 0&&r.name?`instance of ${i.constructor.name}`:`type ${typeof i}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);Q("ERR_MISSING_ARGS",(...t)=>{Dt(t.length>0,"At least one arg needs to be specified");let e,i=t.length;switch(t=(Array.isArray(t)?t:[t]).map(r=>`"${r}"`).join(" or "),i){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let r=t.pop();e+=`The ${t.join(", ")}, and ${r} arguments`}break}return`${e} must be specified`},TypeError);Q("ERR_OUT_OF_RANGE",(t,e,i)=>{Dt(e,'Missing "range" argument');let r;return Number.isInteger(i)&&Math.abs(i)>2**32?r=ul(String(i)):typeof i=="bigint"?(r=String(i),(i>2n**32n||i<-(2n**32n))&&(r=ul(r)),r+="n"):r=en(i),`The value of "${t}" is out of range. It must be ${e}. Received ${r}`},RangeError);Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Q("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Q("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Q("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Q("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Q("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);hl.exports={AbortError:_o,aggregateTwoErrors:dl(tp),hideStackFrames:dl,codes:tn}});var hi=T((H_,xl)=>{"use strict";var{ArrayIsArray:xo,ArrayPrototypeIncludes:bl,ArrayPrototypeJoin:gl,ArrayPrototypeMap:ip,NumberIsInteger:ko,NumberIsNaN:rp,NumberMAX_SAFE_INTEGER:np,NumberMIN_SAFE_INTEGER:op,NumberParseInt:sp,ObjectPrototypeHasOwnProperty:ap,RegExpPrototypeExec:wl,String:lp,StringPrototypeToUpperCase:cp,StringPrototypeTrim:fp}=W(),{hideStackFrames:_e,codes:{ERR_SOCKET_BAD_PORT:up,ERR_INVALID_ARG_TYPE:te,ERR_INVALID_ARG_VALUE:di,ERR_OUT_OF_RANGE:Bt,ERR_UNKNOWN_SIGNAL:pl}}=ne(),{normalizeEncoding:dp}=ee(),{isAsyncFunction:hp,isArrayBufferView:pp}=ee().types,yl={};function yp(t){return t===(t|0)}o(yp,"isInt32");function mp(t){return t===t>>>0}o(mp,"isUint32");var bp=/^[0-7]+$/,gp="must be a 32-bit unsigned integer or an octal string";function wp(t,e,i){if(typeof t>"u"&&(t=i),typeof t=="string"){if(wl(bp,t)===null)throw new di(e,t,gp);t=sp(t,8)}return Sl(t,e),t}o(wp,"parseFileMode");var Sp=_e((t,e,i=op,r=np)=>{if(typeof t!="number")throw new te(e,"number",t);if(!ko(t))throw new Bt(e,"an integer",t);if(t<i||t>r)throw new Bt(e,`>= ${i} && <= ${r}`,t)}),_p=_e((t,e,i=-2147483648,r=2147483647)=>{if(typeof t!="number")throw new te(e,"number",t);if(!ko(t))throw new Bt(e,"an integer",t);if(t<i||t>r)throw new Bt(e,`>= ${i} && <= ${r}`,t)}),Sl=_e((t,e,i=!1)=>{if(typeof t!="number")throw new te(e,"number",t);if(!ko(t))throw new Bt(e,"an integer",t);let r=i?1:0,n=4294967295;if(t<r||t>n)throw new Bt(e,`>= ${r} && <= ${n}`,t)});function Fo(t,e){if(typeof t!="string")throw new te(e,"string",t)}o(Fo,"validateString");function Ep(t,e,i=void 0,r){if(typeof t!="number")throw new te(e,"number",t);if(i!=null&&t<i||r!=null&&t>r||(i!=null||r!=null)&&rp(t))throw new Bt(e,`${i!=null?`>= ${i}`:""}${i!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,t)}o(Ep,"validateNumber");var xp=_e((t,e,i)=>{if(!bl(i,t)){let n="must be one of: "+gl(ip(i,s=>typeof s=="string"?`'${s}'`:lp(s)),", ");throw new di(e,t,n)}});function _l(t,e){if(typeof t!="boolean")throw new te(e,"boolean",t)}o(_l,"validateBoolean");function Eo(t,e,i){return t==null||!ap(t,e)?i:t[e]}o(Eo,"getOwnPropertyValueOrDefault");var kp=_e((t,e,i=null)=>{let r=Eo(i,"allowArray",!1),n=Eo(i,"allowFunction",!1);if(!Eo(i,"nullable",!1)&&t===null||!r&&xo(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new te(e,"Object",t)}),Fp=_e((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new te(e,"a dictionary",t)}),rn=_e((t,e,i=0)=>{if(!xo(t))throw new te(e,"Array",t);if(t.length<i){let r=`must be longer than ${i}`;throw new di(e,t,r)}});function Ip(t,e){rn(t,e);for(let i=0;i<t.length;i++)Fo(t[i],`${e}[${i}]`)}o(Ip,"validateStringArray");function vp(t,e){rn(t,e);for(let i=0;i<t.length;i++)_l(t[i],`${e}[${i}]`)}o(vp,"validateBooleanArray");function Pp(t,e){rn(t,e);for(let i=0;i<t.length;i++){let r=t[i],n=`${e}[${i}]`;if(r==null)throw new te(n,"AbortSignal",r);El(r,n)}}o(Pp,"validateAbortSignalArray");function Tp(t,e="signal"){if(Fo(t,e),yl[t]===void 0)throw yl[cp(t)]!==void 0?new pl(t+" (signals must use all capital letters)"):new pl(t)}o(Tp,"validateSignalName");var Ap=_e((t,e="buffer")=>{if(!pp(t))throw new te(e,["Buffer","TypedArray","DataView"],t)});function Rp(t,e){let i=dp(e),r=t.length;if(i==="hex"&&r%2!==0)throw new di("encoding",e,`is invalid for data of length ${r}`)}o(Rp,"validateEncoding");function Op(t,e="Port",i=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&fp(t).length===0||+t!==+t>>>0||t>65535||t===0&&!i)throw new up(e,t,i);return t|0}o(Op,"validatePort");var El=_e((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new te(e,"AbortSignal",t)}),Cp=_e((t,e)=>{if(typeof t!="function")throw new te(e,"Function",t)}),Lp=_e((t,e)=>{if(typeof t!="function"||hp(t))throw new te(e,"Function",t)}),Np=_e((t,e)=>{if(t!==void 0)throw new te(e,"undefined",t)});function Dp(t,e,i){if(!bl(i,t))throw new te(e,`('${gl(i,"|")}')`,t)}o(Dp,"validateUnion");var Bp=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ml(t,e){if(typeof t>"u"||!wl(Bp,t))throw new di(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}o(ml,"validateLinkHeaderFormat");function Mp(t){if(typeof t=="string")return ml(t,"hints"),t;if(xo(t)){let e=t.length,i="";if(e===0)return i;for(let r=0;r<e;r++){let n=t[r];ml(n,"hints"),i+=n,r!==e-1&&(i+=", ")}return i}throw new di("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}o(Mp,"validateLinkHeaderValue");xl.exports={isInt32:yp,isUint32:mp,parseFileMode:wp,validateArray:rn,validateStringArray:Ip,validateBooleanArray:vp,validateAbortSignalArray:Pp,validateBoolean:_l,validateBuffer:Ap,validateDictionary:Fp,validateEncoding:Rp,validateFunction:Cp,validateInt32:_p,validateInteger:Sp,validateNumber:Ep,validateObject:kp,validateOneOf:xp,validatePlainFunction:Lp,validatePort:Op,validateSignalName:Tp,validateString:Fo,validateUint32:Sl,validateUndefined:Np,validateUnion:Dp,validateAbortSignal:El,validateLinkHeaderValue:Mp}});var yt=T((G_,vl)=>{var $=vl.exports={},je,$e;function Io(){throw new Error("setTimeout has not been defined")}o(Io,"defaultSetTimout");function vo(){throw new Error("clearTimeout has not been defined")}o(vo,"defaultClearTimeout");(function(){try{typeof setTimeout=="function"?je=setTimeout:je=Io}catch{je=Io}try{typeof clearTimeout=="function"?$e=clearTimeout:$e=vo}catch{$e=vo}})();function kl(t){if(je===setTimeout)return setTimeout(t,0);if((je===Io||!je)&&setTimeout)return je=setTimeout,setTimeout(t,0);try{return je(t,0)}catch{try{return je.call(null,t,0)}catch{return je.call(this,t,0)}}}o(kl,"runTimeout");function Wp(t){if($e===clearTimeout)return clearTimeout(t);if(($e===vo||!$e)&&clearTimeout)return $e=clearTimeout,clearTimeout(t);try{return $e(t)}catch{try{return $e.call(null,t)}catch{return $e.call(this,t)}}}o(Wp,"runClearTimeout");var et=[],pi=!1,Mt,nn=-1;function Up(){!pi||!Mt||(pi=!1,Mt.length?et=Mt.concat(et):nn=-1,et.length&&Fl())}o(Up,"cleanUpNextTick");function Fl(){if(!pi){var t=kl(Up);pi=!0;for(var e=et.length;e;){for(Mt=et,et=[];++nn<e;)Mt&&Mt[nn].run();nn=-1,e=et.length}Mt=null,pi=!1,Wp(t)}}o(Fl,"drainQueue");$.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];et.push(new Il(t,e)),et.length===1&&!pi&&kl(Fl)};function Il(t,e){this.fun=t,this.array=e}o(Il,"Item");Il.prototype.run=function(){this.fun.apply(null,this.array)};$.title="browser";$.browser=!0;$.env={};$.argv=[];$.version="";$.versions={};function tt(){}o(tt,"noop");$.on=tt;$.addListener=tt;$.once=tt;$.off=tt;$.removeListener=tt;$.removeAllListeners=tt;$.emit=tt;$.prependListener=tt;$.prependOnceListener=tt;$.listeners=function(t){return[]};$.binding=function(t){throw new Error("process.binding is not supported")};$.cwd=function(){return"/"};$.chdir=function(t){throw new Error("process.chdir is not supported")};$.umask=function(){return 0}});var ze=T((X_,jl)=>{"use strict";var{SymbolAsyncIterator:Pl,SymbolIterator:Tl,SymbolFor:Wt}=W(),Al=Wt("nodejs.stream.destroyed"),Rl=Wt("nodejs.stream.errored"),Po=Wt("nodejs.stream.readable"),To=Wt("nodejs.stream.writable"),Ol=Wt("nodejs.stream.disturbed"),qp=Wt("nodejs.webstream.isClosedPromise"),jp=Wt("nodejs.webstream.controllerErrorFunction");function on(t,e=!1){var i;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((i=t._readableState)===null||i===void 0?void 0:i.readable)!==!1)&&(!t._writableState||t._readableState))}o(on,"isReadableNodeStream");function sn(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}o(sn,"isWritableNodeStream");function $p(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}o($p,"isDuplexNodeStream");function Ve(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}o(Ve,"isNodeStream");function Cl(t){return!!(t&&!Ve(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}o(Cl,"isReadableStream");function Ll(t){return!!(t&&!Ve(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}o(Ll,"isWritableStream");function Nl(t){return!!(t&&!Ve(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}o(Nl,"isTransformStream");function Vp(t){return Cl(t)||Ll(t)||Nl(t)}o(Vp,"isWebStream");function zp(t,e){return t==null?!1:e===!0?typeof t[Pl]=="function":e===!1?typeof t[Tl]=="function":typeof t[Pl]=="function"||typeof t[Tl]=="function"}o(zp,"isIterable");function an(t){if(!Ve(t))return null;let e=t._writableState,i=t._readableState,r=e||i;return!!(t.destroyed||t[Al]||r!=null&&r.destroyed)}o(an,"isDestroyed");function Dl(t){if(!sn(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}o(Dl,"isWritableEnded");function Hp(t,e){if(!sn(t))return null;if(t.writableFinished===!0)return!0;let i=t._writableState;return i!=null&&i.errored?!1:typeof i?.finished!="boolean"?null:!!(i.finished||e===!1&&i.ended===!0&&i.length===0)}o(Hp,"isWritableFinished");function Yp(t){if(!on(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}o(Yp,"isReadableEnded");function Bl(t,e){if(!on(t))return null;let i=t._readableState;return i!=null&&i.errored?!1:typeof i?.endEmitted!="boolean"?null:!!(i.endEmitted||e===!1&&i.ended===!0&&i.length===0)}o(Bl,"isReadableFinished");function Ml(t){return t&&t[Po]!=null?t[Po]:typeof t?.readable!="boolean"?null:an(t)?!1:on(t)&&t.readable&&!Bl(t)}o(Ml,"isReadable");function Wl(t){return t&&t[To]!=null?t[To]:typeof t?.writable!="boolean"?null:an(t)?!1:sn(t)&&t.writable&&!Dl(t)}o(Wl,"isWritable");function Gp(t,e){return Ve(t)?an(t)?!0:!(e?.readable!==!1&&Ml(t)||e?.writable!==!1&&Wl(t)):null}o(Gp,"isFinished");function Kp(t){var e,i;return Ve(t)?t.writableErrored?t.writableErrored:(e=(i=t._writableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}o(Kp,"isWritableErrored");function Xp(t){var e,i;return Ve(t)?t.readableErrored?t.readableErrored:(e=(i=t._readableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}o(Xp,"isReadableErrored");function Jp(t){if(!Ve(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,i=t._readableState;return typeof e?.closed=="boolean"||typeof i?.closed=="boolean"?e?.closed||i?.closed:typeof t._closed=="boolean"&&Ul(t)?t._closed:null}o(Jp,"isClosed");function Ul(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}o(Ul,"isOutgoingMessage");function ql(t){return typeof t._sent100=="boolean"&&Ul(t)}o(ql,"isServerResponse");function Qp(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}o(Qp,"isServerRequest");function Zp(t){if(!Ve(t))return null;let e=t._writableState,i=t._readableState,r=e||i;return!r&&ql(t)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}o(Zp,"willEmitClose");function ey(t){var e;return!!(t&&((e=t[Ol])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}o(ey,"isDisturbed");function ty(t){var e,i,r,n,s,a,l,c,u,d;return!!(t&&((e=(i=(r=(n=(s=(a=t[Rl])!==null&&a!==void 0?a:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(l=t._readableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(c=t._writableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&i!==void 0?i:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((d=t._writableState)===null||d===void 0)&&d.errored))}o(ty,"isErrored");jl.exports={isDestroyed:an,kIsDestroyed:Al,isDisturbed:ey,kIsDisturbed:Ol,isErrored:ty,kIsErrored:Rl,isReadable:Ml,kIsReadable:Po,kIsClosedPromise:qp,kControllerErrorFunction:jp,kIsWritable:To,isClosed:Jp,isDuplexNodeStream:$p,isFinished:Gp,isIterable:zp,isReadableNodeStream:on,isReadableStream:Cl,isReadableEnded:Yp,isReadableFinished:Bl,isReadableErrored:Xp,isNodeStream:Ve,isWebStream:Vp,isWritable:Wl,isWritableNodeStream:sn,isWritableStream:Ll,isWritableEnded:Dl,isWritableFinished:Hp,isWritableErrored:Kp,isServerRequest:Qp,isServerResponse:ql,willEmitClose:Zp,isTransformStream:Nl}});var it=T((Q_,Lo)=>{var mt=yt(),{AbortError:Jl,codes:iy}=ne(),{ERR_INVALID_ARG_TYPE:ry,ERR_STREAM_PREMATURE_CLOSE:$l}=iy,{kEmptyObject:Ro,once:Oo}=ee(),{validateAbortSignal:ny,validateFunction:oy,validateObject:sy,validateBoolean:ay}=hi(),{Promise:ly,PromisePrototypeThen:cy,SymbolDispose:Ql}=W(),{isClosed:fy,isReadable:Vl,isReadableNodeStream:Ao,isReadableStream:uy,isReadableFinished:zl,isReadableErrored:Hl,isWritable:Yl,isWritableNodeStream:Gl,isWritableStream:dy,isWritableFinished:Kl,isWritableErrored:Xl,isNodeStream:hy,willEmitClose:py,kIsClosedPromise:yy}=ze(),yi;function my(t){return t.setHeader&&typeof t.abort=="function"}o(my,"isRequest");var Co=o(()=>{},"nop");function Zl(t,e,i){var r,n;if(arguments.length===2?(i=e,e=Ro):e==null?e=Ro:sy(e,"options"),oy(i,"callback"),ny(e.signal,"options.signal"),i=Oo(i),uy(t)||dy(t))return by(t,e,i);if(!hy(t))throw new ry("stream",["ReadableStream","WritableStream","Stream"],t);let s=(r=e.readable)!==null&&r!==void 0?r:Ao(t),a=(n=e.writable)!==null&&n!==void 0?n:Gl(t),l=t._writableState,c=t._readableState,u=o(()=>{t.writable||b()},"onlegacyfinish"),d=py(t)&&Ao(t)===s&&Gl(t)===a,h=Kl(t,!1),b=o(()=>{h=!0,t.destroyed&&(d=!1),!(d&&(!t.readable||s))&&(!s||m)&&i.call(t)},"onfinish"),m=zl(t,!1),w=o(()=>{m=!0,t.destroyed&&(d=!1),!(d&&(!t.writable||a))&&(!a||h)&&i.call(t)},"onend"),g=o(z=>{i.call(t,z)},"onerror"),v=fy(t),S=o(()=>{v=!0;let z=Xl(t)||Hl(t);if(z&&typeof z!="boolean")return i.call(t,z);if(s&&!m&&Ao(t,!0)&&!zl(t,!1))return i.call(t,new $l);if(a&&!h&&!Kl(t,!1))return i.call(t,new $l);i.call(t)},"onclose"),A=o(()=>{v=!0;let z=Xl(t)||Hl(t);if(z&&typeof z!="boolean")return i.call(t,z);i.call(t)},"onclosed"),q=o(()=>{t.req.on("finish",b)},"onrequest");my(t)?(t.on("complete",b),d||t.on("abort",S),t.req?q():t.on("request",q)):a&&!l&&(t.on("end",u),t.on("close",u)),!d&&typeof t.aborted=="boolean"&&t.on("aborted",S),t.on("end",w),t.on("finish",b),e.error!==!1&&t.on("error",g),t.on("close",S),v?mt.nextTick(S):l!=null&&l.errorEmitted||c!=null&&c.errorEmitted?d||mt.nextTick(A):(!s&&(!d||Vl(t))&&(h||Yl(t)===!1)||!a&&(!d||Yl(t))&&(m||Vl(t)===!1)||c&&t.req&&t.aborted)&&mt.nextTick(A);let P=o(()=>{i=Co,t.removeListener("aborted",S),t.removeListener("complete",b),t.removeListener("abort",S),t.removeListener("request",q),t.req&&t.req.removeListener("finish",b),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",b),t.removeListener("end",w),t.removeListener("error",g),t.removeListener("close",S)},"cleanup");if(e.signal&&!v){let z=o(()=>{let _t=i;P(),_t.call(t,new Jl(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)mt.nextTick(z);else{yi=yi||ee().addAbortListener;let _t=yi(e.signal,z),pe=i;i=Oo((...Kt)=>{_t[Ql](),pe.apply(t,Kt)})}}return P}o(Zl,"eos");function by(t,e,i){let r=!1,n=Co;if(e.signal)if(n=o(()=>{r=!0,i.call(t,new Jl(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)mt.nextTick(n);else{yi=yi||ee().addAbortListener;let a=yi(e.signal,n),l=i;i=Oo((...c)=>{a[Ql](),l.apply(t,c)})}let s=o((...a)=>{r||mt.nextTick(()=>i.apply(t,a))},"resolverFn");return cy(t[yy].promise,s,s),Co}o(by,"eosWeb");function gy(t,e){var i;let r=!1;return e===null&&(e=Ro),(i=e)!==null&&i!==void 0&&i.cleanup&&(ay(e.cleanup,"cleanup"),r=e.cleanup),new ly((n,s)=>{let a=Zl(t,e,l=>{r&&a(),l?s(l):n()})})}o(gy,"finished");Lo.exports=Zl;Lo.exports.finished=gy});var Ut=T((eE,ac)=>{"use strict";var He=yt(),{aggregateTwoErrors:wy,codes:{ERR_MULTIPLE_CALLBACK:Sy},AbortError:_y}=ne(),{Symbol:ic}=W(),{kIsDestroyed:Ey,isDestroyed:xy,isFinished:ky,isServerRequest:Fy}=ze(),rc=ic("kDestroy"),No=ic("kConstruct");function nc(t,e,i){t&&(t.stack,e&&!e.errored&&(e.errored=t),i&&!i.errored&&(i.errored=t))}o(nc,"checkError");function Iy(t,e){let i=this._readableState,r=this._writableState,n=r||i;return r!=null&&r.destroyed||i!=null&&i.destroyed?(typeof e=="function"&&e(),this):(nc(t,r,i),r&&(r.destroyed=!0),i&&(i.destroyed=!0),n.constructed?ec(this,t,e):this.once(rc,function(s){ec(this,wy(s,t),e)}),this)}o(Iy,"destroy");function ec(t,e,i){let r=!1;function n(s){if(r)return;r=!0;let a=t._readableState,l=t._writableState;nc(s,l,a),l&&(l.closed=!0),a&&(a.closed=!0),typeof i=="function"&&i(s),s?He.nextTick(vy,t,s):He.nextTick(oc,t)}o(n,"onDestroy");try{t._destroy(e||null,n)}catch(s){n(s)}}o(ec,"_destroy");function vy(t,e){Do(t,e),oc(t)}o(vy,"emitErrorCloseNT");function oc(t){let e=t._readableState,i=t._writableState;i&&(i.closeEmitted=!0),e&&(e.closeEmitted=!0),(i!=null&&i.emitClose||e!=null&&e.emitClose)&&t.emit("close")}o(oc,"emitCloseNT");function Do(t,e){let i=t._readableState,r=t._writableState;r!=null&&r.errorEmitted||i!=null&&i.errorEmitted||(r&&(r.errorEmitted=!0),i&&(i.errorEmitted=!0),t.emit("error",e))}o(Do,"emitErrorNT");function Py(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}o(Py,"undestroy");function Bo(t,e,i){let r=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||r!=null&&r.destroyed)return this;r!=null&&r.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),r&&!r.errored&&(r.errored=e),i?He.nextTick(Do,t,e):Do(t,e))}o(Bo,"errorOrDestroy");function Ty(t,e){if(typeof t._construct!="function")return;let i=t._readableState,r=t._writableState;i&&(i.constructed=!1),r&&(r.constructed=!1),t.once(No,e),!(t.listenerCount(No)>1)&&He.nextTick(Ay,t)}o(Ty,"construct");function Ay(t){let e=!1;function i(r){if(e){Bo(t,r??new Sy);return}e=!0;let n=t._readableState,s=t._writableState,a=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),a.destroyed?t.emit(rc,r):r?Bo(t,r,!0):He.nextTick(Ry,t)}o(i,"onConstruct");try{t._construct(r=>{He.nextTick(i,r)})}catch(r){He.nextTick(i,r)}}o(Ay,"constructNT");function Ry(t){t.emit(No)}o(Ry,"emitConstructNT");function tc(t){return t?.setHeader&&typeof t.abort=="function"}o(tc,"isRequest");function sc(t){t.emit("close")}o(sc,"emitCloseLegacy");function Oy(t,e){t.emit("error",e),He.nextTick(sc,t)}o(Oy,"emitErrorCloseLegacy");function Cy(t,e){!t||xy(t)||(!e&&!ky(t)&&(e=new _y),Fy(t)?(t.socket=null,t.destroy(e)):tc(t)?t.abort():tc(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?He.nextTick(Oy,t,e):He.nextTick(sc,t),t.destroyed||(t[Ey]=!0))}o(Cy,"destroyer");ac.exports={construct:Ty,destroyer:Cy,destroy:Iy,undestroy:Py,errorOrDestroy:Bo}});var fn=T((iE,cc)=>{"use strict";var{ArrayIsArray:Ly,ObjectSetPrototypeOf:lc}=W(),{EventEmitter:ln}=rr();function cn(t){ln.call(this,t)}o(cn,"Stream");lc(cn.prototype,ln.prototype);lc(cn,ln);cn.prototype.pipe=function(t,e){let i=this;function r(d){t.writable&&t.write(d)===!1&&i.pause&&i.pause()}o(r,"ondata"),i.on("data",r);function n(){i.readable&&i.resume&&i.resume()}o(n,"ondrain"),t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(i.on("end",a),i.on("close",l));let s=!1;function a(){s||(s=!0,t.end())}o(a,"onend");function l(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}o(l,"onclose");function c(d){u(),ln.listenerCount(this,"error")===0&&this.emit("error",d)}o(c,"onerror"),Mo(i,"error",c),Mo(t,"error",c);function u(){i.removeListener("data",r),t.removeListener("drain",n),i.removeListener("end",a),i.removeListener("close",l),i.removeListener("error",c),t.removeListener("error",c),i.removeListener("end",u),i.removeListener("close",u),t.removeListener("close",u)}return o(u,"cleanup"),i.on("end",u),i.on("close",u),t.on("close",u),t.emit("pipe",i),t};function Mo(t,e,i){if(typeof t.prependListener=="function")return t.prependListener(e,i);!t._events||!t._events[e]?t.on(e,i):Ly(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]}o(Mo,"prependListener");cc.exports={Stream:cn,prependListener:Mo}});var nr=T((nE,un)=>{"use strict";var{SymbolDispose:Ny}=W(),{AbortError:fc,codes:Dy}=ne(),{isNodeStream:uc,isWebStream:By,kControllerErrorFunction:My}=ze(),Wy=it(),{ERR_INVALID_ARG_TYPE:dc}=Dy,Wo,Uy=o((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new dc(e,"AbortSignal",t)},"validateAbortSignal");un.exports.addAbortSignal=o(function(e,i){if(Uy(e,"signal"),!uc(i)&&!By(i))throw new dc("stream",["ReadableStream","WritableStream","Stream"],i);return un.exports.addAbortSignalNoValidate(e,i)},"addAbortSignal");un.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let i=uc(e)?()=>{e.destroy(new fc(void 0,{cause:t.reason}))}:()=>{e[My](new fc(void 0,{cause:t.reason}))};if(t.aborted)i();else{Wo=Wo||ee().addAbortListener;let r=Wo(t,i);Wy(e,r[Ny])}return e}});var yc=T((aE,pc)=>{"use strict";var{StringPrototypeSlice:hc,SymbolIterator:qy,TypedArrayPrototypeSet:dn,Uint8Array:jy}=W(),{Buffer:Uo}=Ie(),{inspect:$y}=ee();pc.exports=class{static{o(this,"BufferList")}constructor(){this.head=null,this.tail=null,this.length=0}push(e){let i={data:e,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}unshift(e){let i={data:e,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let i=this.head,r=""+i.data;for(;(i=i.next)!==null;)r+=e+i.data;return r}concat(e){if(this.length===0)return Uo.alloc(0);let i=Uo.allocUnsafe(e>>>0),r=this.head,n=0;for(;r;)dn(i,r.data,n),n+=r.data.length,r=r.next;return i}consume(e,i){let r=this.head.data;if(e<r.length){let n=r.slice(0,e);return this.head.data=r.slice(e),n}return e===r.length?this.shift():i?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[qy](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let i="",r=this.head,n=0;do{let s=r.data;if(e>s.length)i+=s,e-=s.length;else{e===s.length?(i+=s,++n,r.next?this.head=r.next:this.head=this.tail=null):(i+=hc(s,0,e),this.head=r,r.data=hc(s,e));break}++n}while((r=r.next)!==null);return this.length-=n,i}_getBuffer(e){let i=Uo.allocUnsafe(e),r=e,n=this.head,s=0;do{let a=n.data;if(e>a.length)dn(i,a,r-e),e-=a.length;else{e===a.length?(dn(i,a,r-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(dn(i,new jy(a.buffer,a.byteOffset,e),r-e),this.head=n,n.data=a.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,i}[Symbol.for("nodejs.util.inspect.custom")](e,i){return $y(this,{...i,depth:0,customInspect:!1})}}});var or=T((cE,wc)=>{"use strict";var{MathFloor:Vy,NumberIsInteger:zy}=W(),{validateInteger:Hy}=hi(),{ERR_INVALID_ARG_VALUE:Yy}=ne().codes,mc=16*1024,bc=16;function Gy(t,e,i){return t.highWaterMark!=null?t.highWaterMark:e?t[i]:null}o(Gy,"highWaterMarkFrom");function gc(t){return t?bc:mc}o(gc,"getDefaultHighWaterMark");function Ky(t,e){Hy(e,"value",0),t?bc=e:mc=e}o(Ky,"setDefaultHighWaterMark");function Xy(t,e,i,r){let n=Gy(e,r,i);if(n!=null){if(!zy(n)||n<0){let s=r?`options.${i}`:"options.highWaterMark";throw new Yy(s,n)}return Vy(n)}return gc(t.objectMode)}o(Xy,"getHighWaterMark");wc.exports={getHighWaterMark:Xy,getDefaultHighWaterMark:gc,setDefaultHighWaterMark:Ky}});var Ec=T((qo,_c)=>{var hn=Ie(),Ye=hn.Buffer;function Sc(t,e){for(var i in t)e[i]=t[i]}o(Sc,"copyProps");Ye.from&&Ye.alloc&&Ye.allocUnsafe&&Ye.allocUnsafeSlow?_c.exports=hn:(Sc(hn,qo),qo.Buffer=qt);function qt(t,e,i){return Ye(t,e,i)}o(qt,"SafeBuffer");qt.prototype=Object.create(Ye.prototype);Sc(Ye,qt);qt.from=function(t,e,i){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Ye(t,e,i)};qt.alloc=function(t,e,i){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=Ye(t);return e!==void 0?typeof i=="string"?r.fill(e,i):r.fill(e):r.fill(0),r};qt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Ye(t)};qt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return hn.SlowBuffer(t)}});var Fc=T(kc=>{"use strict";var $o=Ec().Buffer,xc=$o.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Jy(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}o(Jy,"_normalizeEncoding");function Qy(t){var e=Jy(t);if(typeof e!="string"&&($o.isEncoding===xc||!xc(t)))throw new Error("Unknown encoding: "+t);return e||t}o(Qy,"normalizeEncoding");kc.StringDecoder=sr;function sr(t){this.encoding=Qy(t);var e;switch(this.encoding){case"utf16le":this.text=nm,this.end=om,e=4;break;case"utf8":this.fillLast=tm,e=4;break;case"base64":this.text=sm,this.end=am,e=3;break;default:this.write=lm,this.end=cm;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=$o.allocUnsafe(e)}o(sr,"StringDecoder");sr.prototype.write=function(t){if(t.length===0)return"";var e,i;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?e?e+this.text(t,i):this.text(t,i):e||""};sr.prototype.end=rm;sr.prototype.text=im;sr.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function jo(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}o(jo,"utf8CheckByte");function Zy(t,e,i){var r=e.length-1;if(r<i)return 0;var n=jo(e[r]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--r<i||n===-2?0:(n=jo(e[r]),n>=0?(n>0&&(t.lastNeed=n-2),n):--r<i||n===-2?0:(n=jo(e[r]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}o(Zy,"utf8CheckIncomplete");function em(t,e,i){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}o(em,"utf8CheckExtraBytes");function tm(t){var e=this.lastTotal-this.lastNeed,i=em(this,t,e);if(i!==void 0)return i;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}o(tm,"utf8FillLast");function im(t,e){var i=Zy(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)}o(im,"utf8Text");function rm(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}o(rm,"utf8End");function nm(t,e){if((t.length-e)%2===0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}o(nm,"utf16Text");function om(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}o(om,"utf16End");function sm(t,e){var i=(t.length-e)%3;return i===0?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,i===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}o(sm,"base64Text");function am(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}o(am,"base64End");function lm(t){return t.toString(this.encoding)}o(lm,"simpleWrite");function cm(t){return t&&t.length?this.write(t):""}o(cm,"simpleEnd")});var Vo=T((pE,Tc)=>{"use strict";var Ic=yt(),{PromisePrototypeThen:fm,SymbolAsyncIterator:vc,SymbolIterator:Pc}=W(),{Buffer:um}=Ie(),{ERR_INVALID_ARG_TYPE:dm,ERR_STREAM_NULL_VALUES:hm}=ne().codes;function pm(t,e,i){let r;if(typeof e=="string"||e instanceof um)return new t({objectMode:!0,...i,read:o(function(){this.push(e),this.push(null)},"read")});let n;if(e&&e[vc])n=!0,r=e[vc]();else if(e&&e[Pc])n=!1,r=e[Pc]();else throw new dm("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...i}),a=!1;s._read=function(){a||(a=!0,c())},s._destroy=function(u,d){fm(l(u),()=>Ic.nextTick(d,u),h=>Ic.nextTick(d,h||u))};async function l(u){let d=u!=null,h=typeof r.throw=="function";if(d&&h){let{value:b,done:m}=await r.throw(u);if(await b,m)return}if(typeof r.return=="function"){let{value:b}=await r.return();await b}}o(l,"close");async function c(){for(;;){try{let{value:u,done:d}=n?await r.next():r.next();if(d)s.push(null);else{let h=u&&typeof u.then=="function"?await u:u;if(h===null)throw a=!1,new hm;if(s.push(h))continue;a=!1}}catch(u){s.destroy(u)}break}}return o(c,"next"),s}o(pm,"from");Tc.exports=pm});var lr=T((mE,Yc)=>{var ve=yt(),{ArrayPrototypeIndexOf:ym,NumberIsInteger:mm,NumberIsNaN:bm,NumberParseInt:gm,ObjectDefineProperties:Qo,ObjectKeys:wm,ObjectSetPrototypeOf:Oc,Promise:Cc,SafeSet:Sm,SymbolAsyncDispose:_m,SymbolAsyncIterator:Em,Symbol:xm}=W();Yc.exports=E;E.ReadableState=bn;var{EventEmitter:km}=rr(),{Stream:bt,prependListener:Fm}=fn(),{Buffer:zo}=Ie(),{addAbortSignal:Im}=nr(),Lc=it(),I=ee().debuglog("stream",t=>{I=t}),vm=yc(),gi=Ut(),{getHighWaterMark:Pm,getDefaultHighWaterMark:Tm}=or(),{aggregateTwoErrors:Ac,codes:{ERR_INVALID_ARG_TYPE:Am,ERR_METHOD_NOT_IMPLEMENTED:Rm,ERR_OUT_OF_RANGE:Om,ERR_STREAM_PUSH_AFTER_EOF:Cm,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Lm},AbortError:Nm}=ne(),{validateObject:Dm}=hi(),jt=xm("kPaused"),{StringDecoder:Nc}=Fc(),Bm=Vo();Oc(E.prototype,bt.prototype);Oc(E,bt);var Ho=o(()=>{},"nop"),{errorOrDestroy:mi}=gi,bi=1,Mm=2,Dc=4,ar=8,Bc=16,pn=32,yn=64,Mc=128,Wm=256,Um=512,qm=1024,Xo=2048,Jo=4096,jm=8192,$m=16384,Vm=32768,Wc=65536,zm=1<<17,Hm=1<<18;function Y(t){return{enumerable:!1,get:o(function(){return(this.state&t)!==0},"get"),set:o(function(e){e?this.state|=t:this.state&=~t},"set")}}o(Y,"makeBitMapDescriptor");Qo(bn.prototype,{objectMode:Y(bi),ended:Y(Mm),endEmitted:Y(Dc),reading:Y(ar),constructed:Y(Bc),sync:Y(pn),needReadable:Y(yn),emittedReadable:Y(Mc),readableListening:Y(Wm),resumeScheduled:Y(Um),errorEmitted:Y(qm),emitClose:Y(Xo),autoDestroy:Y(Jo),destroyed:Y(jm),closed:Y($m),closeEmitted:Y(Vm),multiAwaitDrain:Y(Wc),readingMore:Y(zm),dataEmitted:Y(Hm)});function bn(t,e,i){typeof i!="boolean"&&(i=e instanceof Ge()),this.state=Xo|Jo|Bc|pn,t&&t.objectMode&&(this.state|=bi),i&&t&&t.readableObjectMode&&(this.state|=bi),this.highWaterMark=t?Pm(this,t,"readableHighWaterMark",i):Tm(!1),this.buffer=new vm,this.length=0,this.pipes=[],this.flowing=null,this[jt]=null,t&&t.emitClose===!1&&(this.state&=~Xo),t&&t.autoDestroy===!1&&(this.state&=~Jo),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Nc(t.encoding),this.encoding=t.encoding)}o(bn,"ReadableState");function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof Ge();this._readableState=new bn(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Im(t.signal,this)),bt.call(this,t),gi.construct(this,()=>{this._readableState.needReadable&&mn(this,this._readableState)})}o(E,"Readable");E.prototype.destroy=gi.destroy;E.prototype._undestroy=gi.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[km.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[_m]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Nm,this.destroy(t)),new Cc((e,i)=>Lc(this,r=>r&&r!==t?i(r):e(null)))};E.prototype.push=function(t,e){return Uc(this,t,e,!1)};E.prototype.unshift=function(t,e){return Uc(this,t,e,!0)};function Uc(t,e,i,r){I("readableAddChunk",e);let n=t._readableState,s;if(n.state&bi||(typeof e=="string"?(i=i||n.defaultEncoding,n.encoding!==i&&(r&&n.encoding?e=zo.from(e,i).toString(n.encoding):(e=zo.from(e,i),i=""))):e instanceof zo?i="":bt._isUint8Array(e)?(e=bt._uint8ArrayToBuffer(e),i=""):e!=null&&(s=new Am("chunk",["string","Buffer","Uint8Array"],e))),s)mi(t,s);else if(e===null)n.state&=~ar,Km(t,n);else if(n.state&bi||e&&e.length>0)if(r)if(n.state&Dc)mi(t,new Lm);else{if(n.destroyed||n.errored)return!1;Yo(t,n,e,!0)}else if(n.ended)mi(t,new Cm);else{if(n.destroyed||n.errored)return!1;n.state&=~ar,n.decoder&&!i?(e=n.decoder.write(e),n.objectMode||e.length!==0?Yo(t,n,e,!1):mn(t,n)):Yo(t,n,e,!1)}else r||(n.state&=~ar,mn(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}o(Uc,"readableAddChunk");function Yo(t,e,i,r){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&Wc?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",i)):(e.length+=e.objectMode?1:i.length,r?e.buffer.unshift(i):e.buffer.push(i),e.state&yn&&gn(t)),mn(t,e)}o(Yo,"addChunk");E.prototype.isPaused=function(){let t=this._readableState;return t[jt]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new Nc(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let i=this._readableState.buffer,r="";for(let n of i)r+=e.write(n);return i.clear(),r!==""&&i.push(r),this._readableState.length=r.length,this};var Ym=1073741824;function Gm(t){if(t>Ym)throw new Om("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}o(Gm,"computeNewHighWaterMark");function Rc(t,e){return t<=0||e.length===0&&e.ended?0:e.state&bi?1:bm(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}o(Rc,"howMuchToRead");E.prototype.read=function(t){I("read",t),t===void 0?t=NaN:mm(t)||(t=gm(t,10));let e=this._readableState,i=t;if(t>e.highWaterMark&&(e.highWaterMark=Gm(t)),t!==0&&(e.state&=~Mc),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return I("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Go(this):gn(this),null;if(t=Rc(t,e),t===0&&e.ended)return e.length===0&&Go(this),null;let r=(e.state&yn)!==0;if(I("need readable",r),(e.length===0||e.length-t<e.highWaterMark)&&(r=!0,I("length less than watermark",r)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)r=!1,I("reading, ended or constructing",r);else if(r){I("do read"),e.state|=ar|pn,e.length===0&&(e.state|=yn);try{this._read(e.highWaterMark)}catch(s){mi(this,s)}e.state&=~pn,e.reading||(t=Rc(i,e))}let n;return t>0?n=zc(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&Go(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function Km(t,e){if(I("onEofChunk"),!e.ended){if(e.decoder){let i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,e.sync?gn(t):(e.needReadable=!1,e.emittedReadable=!0,qc(t))}}o(Km,"onEofChunk");function gn(t){let e=t._readableState;I("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(I("emitReadable",e.flowing),e.emittedReadable=!0,ve.nextTick(qc,t))}o(gn,"emitReadable");function qc(t){let e=t._readableState;I("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,$c(t)}o(qc,"emitReadable_");function mn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ve.nextTick(Xm,t,e))}o(mn,"maybeReadMore");function Xm(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let i=e.length;if(I("maybeReadMore read 0"),t.read(0),i===e.length)break}e.readingMore=!1}o(Xm,"maybeReadMore_");E.prototype._read=function(t){throw new Rm("_read()")};E.prototype.pipe=function(t,e){let i=this,r=this._readableState;r.pipes.length===1&&(r.multiAwaitDrain||(r.multiAwaitDrain=!0,r.awaitDrainWriters=new Sm(r.awaitDrainWriters?[r.awaitDrainWriters]:[]))),r.pipes.push(t),I("pipe count=%d opts=%j",r.pipes.length,e);let s=(!e||e.end!==!1)&&t!==ve.stdout&&t!==ve.stderr?l:v;r.endEmitted?ve.nextTick(s):i.once("end",s),t.on("unpipe",a);function a(S,A){I("onunpipe"),S===i&&A&&A.hasUnpiped===!1&&(A.hasUnpiped=!0,d())}o(a,"onunpipe");function l(){I("onend"),t.end()}o(l,"onend");let c,u=!1;function d(){I("cleanup"),t.removeListener("close",w),t.removeListener("finish",g),c&&t.removeListener("drain",c),t.removeListener("error",m),t.removeListener("unpipe",a),i.removeListener("end",l),i.removeListener("end",v),i.removeListener("data",b),u=!0,c&&r.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}o(d,"cleanup");function h(){u||(r.pipes.length===1&&r.pipes[0]===t?(I("false write response, pause",0),r.awaitDrainWriters=t,r.multiAwaitDrain=!1):r.pipes.length>1&&r.pipes.includes(t)&&(I("false write response, pause",r.awaitDrainWriters.size),r.awaitDrainWriters.add(t)),i.pause()),c||(c=Jm(i,t),t.on("drain",c))}o(h,"pause"),i.on("data",b);function b(S){I("ondata");let A=t.write(S);I("dest.write",A),A===!1&&h()}o(b,"ondata");function m(S){if(I("onerror",S),v(),t.removeListener("error",m),t.listenerCount("error")===0){let A=t._writableState||t._readableState;A&&!A.errorEmitted?mi(t,S):t.emit("error",S)}}o(m,"onerror"),Fm(t,"error",m);function w(){t.removeListener("finish",g),v()}o(w,"onclose"),t.once("close",w);function g(){I("onfinish"),t.removeListener("close",w),v()}o(g,"onfinish"),t.once("finish",g);function v(){I("unpipe"),i.unpipe(t)}return o(v,"unpipe"),t.emit("pipe",i),t.writableNeedDrain===!0?h():r.flowing||(I("pipe resume"),i.resume()),t};function Jm(t,e){return o(function(){let r=t._readableState;r.awaitDrainWriters===e?(I("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(I("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(e)),(!r.awaitDrainWriters||r.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}o(Jm,"pipeOnDrain");E.prototype.unpipe=function(t){let e=this._readableState,i={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let r=ym(e.pipes,t);return r===-1?this:(e.pipes.splice(r,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,i),this)};E.prototype.on=function(t,e){let i=bt.prototype.on.call(this,t,e),r=this._readableState;return t==="data"?(r.readableListening=this.listenerCount("readable")>0,r.flowing!==!1&&this.resume()):t==="readable"&&!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,I("on readable",r.length,r.reading),r.length?gn(this):r.reading||ve.nextTick(Qm,this)),i};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let i=bt.prototype.removeListener.call(this,t,e);return t==="readable"&&ve.nextTick(jc,this),i};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=bt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ve.nextTick(jc,this),e};function jc(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[jt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}o(jc,"updateReadableListening");function Qm(t){I("readable nexttick read 0"),t.read(0)}o(Qm,"nReadingNextTick");E.prototype.resume=function(){let t=this._readableState;return t.flowing||(I("resume"),t.flowing=!t.readableListening,Zm(this,t)),t[jt]=!1,this};function Zm(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ve.nextTick(eb,t,e))}o(Zm,"resume");function eb(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),$c(t),e.flowing&&!e.reading&&t.read(0)}o(eb,"resume_");E.prototype.pause=function(){return I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(I("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[jt]=!0,this};function $c(t){let e=t._readableState;for(I("flow",e.flowing);e.flowing&&t.read()!==null;);}o($c,"flow");E.prototype.wrap=function(t){let e=!1;t.on("data",r=>{!this.push(r)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",r=>{mi(this,r)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let i=wm(t);for(let r=1;r<i.length;r++){let n=i[r];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};E.prototype[Em]=function(){return Vc(this)};E.prototype.iterator=function(t){return t!==void 0&&Dm(t,"options"),Vc(this,t)};function Vc(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let i=tb(t,e);return i.stream=t,i}o(Vc,"streamToAsyncIterator");async function*tb(t,e){let i=Ho;function r(a){this===t?(i(),i=Ho):i=a}o(r,"next"),t.on("readable",r);let n,s=Lc(t,{writable:!1},a=>{n=a?Ac(n,a):null,i(),i=Ho});try{for(;;){let a=t.destroyed?null:t.read();if(a!==null)yield a;else{if(n)throw n;if(n===null)return;await new Cc(r)}}}catch(a){throw n=Ac(n,a),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?gi.destroyer(t,null):(t.off("readable",r),s())}}o(tb,"createAsyncIterator");Qo(E.prototype,{readable:{__proto__:null,get:o(function(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},"get"),set:o(function(t){this._readableState&&(this._readableState.readable=!!t)},"set")},readableDidRead:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState.dataEmitted},"get")},readableAborted:{__proto__:null,enumerable:!1,get:o(function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)},"get")},readableHighWaterMark:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState.highWaterMark},"get")},readableBuffer:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState&&this._readableState.buffer},"get")},readableFlowing:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState.flowing},"get"),set:o(function(t){this._readableState&&(this._readableState.flowing=t)},"set")},readableLength:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState.length},"get")},readableObjectMode:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState?this._readableState.objectMode:!1},"get")},readableEncoding:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState?this._readableState.encoding:null},"get")},errored:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState?this._readableState.errored:null},"get")},closed:{__proto__:null,get:o(function(){return this._readableState?this._readableState.closed:!1},"get")},destroyed:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState?this._readableState.destroyed:!1},"get"),set:o(function(t){this._readableState&&(this._readableState.destroyed=t)},"set")},readableEnded:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState?this._readableState.endEmitted:!1},"get")}});Qo(bn.prototype,{pipesCount:{__proto__:null,get:o(function(){return this.pipes.length},"get")},paused:{__proto__:null,get:o(function(){return this[jt]!==!1},"get"),set:o(function(t){this[jt]=!!t},"set")}});E._fromList=zc;function zc(t,e){if(e.length===0)return null;let i;return e.objectMode?i=e.buffer.shift():!t||t>=e.length?(e.decoder?i=e.buffer.join(""):e.buffer.length===1?i=e.buffer.first():i=e.buffer.concat(e.length),e.buffer.clear()):i=e.buffer.consume(t,e.decoder),i}o(zc,"fromList");function Go(t){let e=t._readableState;I("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,ve.nextTick(ib,e,t))}o(Go,"endReadable");function ib(t,e){if(I("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)ve.nextTick(rb,e);else if(t.autoDestroy){let i=e._writableState;(!i||i.autoDestroy&&(i.finished||i.writable===!1))&&e.destroy()}}}o(ib,"endReadableNT");function rb(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}o(rb,"endWritableNT");E.from=function(t,e){return Bm(E,t,e)};var Ko;function Hc(){return Ko===void 0&&(Ko={}),Ko}o(Hc,"lazyWebStreams");E.fromWeb=function(t,e){return Hc().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return Hc().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var i,r;return new E({objectMode:(i=(r=t.readableObjectMode)!==null&&r!==void 0?r:t.objectMode)!==null&&i!==void 0?i:!0,...e,destroy:o(function(n,s){gi.destroyer(t,n),s(n)},"destroy")}).wrap(t)}});var xn=T((gE,sf)=>{var $t=yt(),{ArrayPrototypeSlice:Xc,Error:nb,FunctionPrototypeSymbolHasInstance:Jc,ObjectDefineProperty:Qc,ObjectDefineProperties:ob,ObjectSetPrototypeOf:Zc,StringPrototypeToLowerCase:sb,Symbol:ab,SymbolHasInstance:lb}=W();sf.exports=U;U.WritableState=ur;var{EventEmitter:cb}=rr(),cr=fn().Stream,{Buffer:wn}=Ie(),En=Ut(),{addAbortSignal:fb}=nr(),{getHighWaterMark:ub,getDefaultHighWaterMark:db}=or(),{ERR_INVALID_ARG_TYPE:hb,ERR_METHOD_NOT_IMPLEMENTED:pb,ERR_MULTIPLE_CALLBACK:ef,ERR_STREAM_CANNOT_PIPE:yb,ERR_STREAM_DESTROYED:fr,ERR_STREAM_ALREADY_FINISHED:mb,ERR_STREAM_NULL_VALUES:bb,ERR_STREAM_WRITE_AFTER_END:gb,ERR_UNKNOWN_ENCODING:tf}=ne().codes,{errorOrDestroy:wi}=En;Zc(U.prototype,cr.prototype);Zc(U,cr);function ts(){}o(ts,"nop");var Si=ab("kOnFinished");function ur(t,e,i){typeof i!="boolean"&&(i=e instanceof Ge()),this.objectMode=!!(t&&t.objectMode),i&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?ub(this,t,"writableHighWaterMark",i):db(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(t&&t.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=Sb.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,_n(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Si]=[]}o(ur,"WritableState");function _n(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}o(_n,"resetBuffer");ur.prototype.getBuffer=o(function(){return Xc(this.buffered,this.bufferedIndex)},"getBuffer");Qc(ur.prototype,"bufferedRequestCount",{__proto__:null,get:o(function(){return this.buffered.length-this.bufferedIndex},"get")});function U(t){let e=this instanceof Ge();if(!e&&!Jc(U,this))return new U(t);this._writableState=new ur(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&fb(t.signal,this)),cr.call(this,t),En.construct(this,()=>{let i=this._writableState;i.writing||rs(this,i),ns(this,i)})}o(U,"Writable");Qc(U,lb,{__proto__:null,value:o(function(t){return Jc(this,t)?!0:this!==U?!1:t&&t._writableState instanceof ur},"value")});U.prototype.pipe=function(){wi(this,new yb)};function rf(t,e,i,r){let n=t._writableState;if(typeof i=="function")r=i,i=n.defaultEncoding;else{if(!i)i=n.defaultEncoding;else if(i!=="buffer"&&!wn.isEncoding(i))throw new tf(i);typeof r!="function"&&(r=ts)}if(e===null)throw new bb;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=wn.from(e,i),i="buffer");else if(e instanceof wn)i="buffer";else if(cr._isUint8Array(e))e=cr._uint8ArrayToBuffer(e),i="buffer";else throw new hb("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new gb:n.destroyed&&(s=new fr("write")),s?($t.nextTick(r,s),wi(t,s,!0),s):(n.pendingcb++,wb(t,n,e,i,r))}o(rf,"_write");U.prototype.write=function(t,e,i){return rf(this,t,e,i)===!0};U.prototype.cork=function(){this._writableState.corked++};U.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||rs(this,t))};U.prototype.setDefaultEncoding=o(function(e){if(typeof e=="string"&&(e=sb(e)),!wn.isEncoding(e))throw new tf(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function wb(t,e,i,r,n){let s=e.objectMode?1:i.length;e.length+=s;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:i,encoding:r,callback:n}),e.allBuffers&&r!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==ts&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(i,r,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}o(wb,"writeOrBuffer");function Gc(t,e,i,r,n,s,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new fr("write")):i?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}o(Gc,"doWrite");function Kc(t,e,i,r){--e.pendingcb,r(i),is(e),wi(t,i)}o(Kc,"onwriteError");function Sb(t,e){let i=t._writableState,r=i.sync,n=i.writecb;if(typeof n!="function"){wi(t,new ef);return}i.writing=!1,i.writecb=null,i.length-=i.writelen,i.writelen=0,e?(e.stack,i.errored||(i.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),r?$t.nextTick(Kc,t,i,e,n):Kc(t,i,e,n)):(i.buffered.length>i.bufferedIndex&&rs(t,i),r?i.afterWriteTickInfo!==null&&i.afterWriteTickInfo.cb===n?i.afterWriteTickInfo.count++:(i.afterWriteTickInfo={count:1,cb:n,stream:t,state:i},$t.nextTick(_b,i.afterWriteTickInfo)):nf(t,i,1,n))}o(Sb,"onwrite");function _b({stream:t,state:e,count:i,cb:r}){return e.afterWriteTickInfo=null,nf(t,e,i,r)}o(_b,"afterWriteTick");function nf(t,e,i,r){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));i-- >0;)e.pendingcb--,r();e.destroyed&&is(e),ns(t,e)}o(nf,"afterWrite");function is(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:a}=t.buffered[n],l=t.objectMode?1:s.length;t.length-=l,a((e=t.errored)!==null&&e!==void 0?e:new fr("write"))}let i=t[Si].splice(0);for(let n=0;n<i.length;n++){var r;i[n]((r=t.errored)!==null&&r!==void 0?r:new fr("end"))}_n(t)}o(is,"errorBuffer");function rs(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:i,bufferedIndex:r,objectMode:n}=e,s=i.length-r;if(!s)return;let a=r;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let l=e.allNoop?ts:u=>{for(let d=a;d<i.length;++d)i[d].callback(u)},c=e.allNoop&&a===0?i:Xc(i,a);c.allBuffers=e.allBuffers,Gc(t,e,!0,e.length,c,"",l),_n(e)}else{do{let{chunk:l,encoding:c,callback:u}=i[a];i[a++]=null;let d=n?1:l.length;Gc(t,e,!1,d,l,c,u)}while(a<i.length&&!e.writing);a===i.length?_n(e):a>256?(i.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}o(rs,"clearBuffer");U.prototype._write=function(t,e,i){if(this._writev)this._writev([{chunk:t,encoding:e}],i);else throw new pb("_write()")};U.prototype._writev=null;U.prototype.end=function(t,e,i){let r=this._writableState;typeof t=="function"?(i=t,t=null,e=null):typeof e=="function"&&(i=e,e=null);let n;if(t!=null){let s=rf(this,t,e);s instanceof nb&&(n=s)}return r.corked&&(r.corked=1,this.uncork()),n||(!r.errored&&!r.ending?(r.ending=!0,ns(this,r,!0),r.ended=!0):r.finished?n=new mb("end"):r.destroyed&&(n=new fr("end"))),typeof i=="function"&&(n||r.finished?$t.nextTick(i,n):r[Si].push(i)),this};function Sn(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}o(Sn,"needFinish");function Eb(t,e){let i=!1;function r(n){if(i){wi(t,n??ef());return}if(i=!0,e.pendingcb--,n){let s=e[Si].splice(0);for(let a=0;a<s.length;a++)s[a](n);wi(t,n,e.sync)}else Sn(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,$t.nextTick(es,t,e))}o(r,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(r)}catch(n){r(n)}e.sync=!1}o(Eb,"callFinal");function xb(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Eb(t,e)):(e.prefinished=!0,t.emit("prefinish")))}o(xb,"prefinish");function ns(t,e,i){Sn(e)&&(xb(t,e),e.pendingcb===0&&(i?(e.pendingcb++,$t.nextTick((r,n)=>{Sn(n)?es(r,n):n.pendingcb--},t,e)):Sn(e)&&(e.pendingcb++,es(t,e))))}o(ns,"finishMaybe");function es(t,e){e.pendingcb--,e.finished=!0;let i=e[Si].splice(0);for(let r=0;r<i.length;r++)i[r]();if(t.emit("finish"),e.autoDestroy){let r=t._readableState;(!r||r.autoDestroy&&(r.endEmitted||r.readable===!1))&&t.destroy()}}o(es,"finish");ob(U.prototype,{closed:{__proto__:null,get:o(function(){return this._writableState?this._writableState.closed:!1},"get")},destroyed:{__proto__:null,get:o(function(){return this._writableState?this._writableState.destroyed:!1},"get"),set:o(function(t){this._writableState&&(this._writableState.destroyed=t)},"set")},writable:{__proto__:null,get:o(function(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},"get"),set:o(function(t){this._writableState&&(this._writableState.writable=!!t)},"set")},writableFinished:{__proto__:null,get:o(function(){return this._writableState?this._writableState.finished:!1},"get")},writableObjectMode:{__proto__:null,get:o(function(){return this._writableState?this._writableState.objectMode:!1},"get")},writableBuffer:{__proto__:null,get:o(function(){return this._writableState&&this._writableState.getBuffer()},"get")},writableEnded:{__proto__:null,get:o(function(){return this._writableState?this._writableState.ending:!1},"get")},writableNeedDrain:{__proto__:null,get:o(function(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1},"get")},writableHighWaterMark:{__proto__:null,get:o(function(){return this._writableState&&this._writableState.highWaterMark},"get")},writableCorked:{__proto__:null,get:o(function(){return this._writableState?this._writableState.corked:0},"get")},writableLength:{__proto__:null,get:o(function(){return this._writableState&&this._writableState.length},"get")},errored:{__proto__:null,enumerable:!1,get:o(function(){return this._writableState?this._writableState.errored:null},"get")},writableAborted:{__proto__:null,enumerable:!1,get:o(function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)},"get")}});var kb=En.destroy;U.prototype.destroy=function(t,e){let i=this._writableState;return!i.destroyed&&(i.bufferedIndex<i.buffered.length||i[Si].length)&&$t.nextTick(is,i),kb.call(this,t,e),this};U.prototype._undestroy=En.undestroy;U.prototype._destroy=function(t,e){e(t)};U.prototype[cb.captureRejectionSymbol]=function(t){this.destroy(t)};var Zo;function of(){return Zo===void 0&&(Zo={}),Zo}o(of,"lazyWebStreams");U.fromWeb=function(t,e){return of().newStreamWritableFromWritableStream(t,e)};U.toWeb=function(t){return of().newWritableStreamFromStreamWritable(t)}});var _f=T((SE,Sf)=>{var os=yt(),Fb=Ie(),{isReadable:Ib,isWritable:vb,isIterable:af,isNodeStream:Pb,isReadableNodeStream:lf,isWritableNodeStream:cf,isDuplexNodeStream:Tb,isReadableStream:ff,isWritableStream:uf}=ze(),df=it(),{AbortError:gf,codes:{ERR_INVALID_ARG_TYPE:Ab,ERR_INVALID_RETURN_VALUE:hf}}=ne(),{destroyer:Ei}=Ut(),Rb=Ge(),wf=lr(),Ob=xn(),{createDeferredPromise:pf}=ee(),yf=Vo(),mf=globalThis.Blob||Fb.Blob,Cb=o(typeof mf<"u"?function(e){return e instanceof mf}:function(e){return!1},"isBlob"),Lb=globalThis.AbortController||fi().AbortController,{FunctionPrototypeCall:bf}=W(),gt=class extends Rb{static{o(this,"Duplexify")}constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Sf.exports=o(function t(e,i){if(Tb(e))return e;if(lf(e))return _i({readable:e});if(cf(e))return _i({writable:e});if(Pb(e))return _i({writable:!1,readable:!1});if(ff(e))return _i({readable:wf.fromWeb(e)});if(uf(e))return _i({writable:Ob.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:a,destroy:l}=Nb(e);if(af(n))return yf(gt,n,{objectMode:!0,write:s,final:a,destroy:l});let c=n?.then;if(typeof c=="function"){let u,d=bf(c,n,h=>{if(h!=null)throw new hf("nully","body",h)},h=>{Ei(u,h)});return u=new gt({objectMode:!0,readable:!1,write:s,final:o(function(h){a(async()=>{try{await d,os.nextTick(h,null)}catch(b){os.nextTick(h,b)}})},"final"),destroy:l})}throw new hf("Iterable, AsyncIterable or AsyncFunction",i,n)}if(Cb(e))return t(e.arrayBuffer());if(af(e))return yf(gt,e,{objectMode:!0,writable:!1});if(ff(e?.readable)&&uf(e?.writable))return gt.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?lf(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?cf(e?.writable)?e?.writable:t(e.writable):void 0;return _i({readable:n,writable:s})}let r=e?.then;if(typeof r=="function"){let n;return bf(r,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{Ei(n,s)}),n=new gt({objectMode:!0,writable:!1,read:o(function(){},"read")})}throw new Ab(i,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function Nb(t){let{promise:e,resolve:i}=pf(),r=new Lb,n=r.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:l,done:c,cb:u}=await a;if(os.nextTick(u),c)return;if(n.aborted)throw new gf(void 0,{cause:n.reason});({promise:e,resolve:i}=pf()),yield l}}(),{signal:n}),write:o(function(a,l,c){let u=i;i=null,u({chunk:a,done:!1,cb:c})},"write"),final:o(function(a){let l=i;i=null,l({done:!0,cb:a})},"final"),destroy:o(function(a,l){r.abort(),l(a)},"destroy")}}o(Nb,"fromAsyncGen");function _i(t){let e=t.readable&&typeof t.readable.read!="function"?wf.wrap(t.readable):t.readable,i=t.writable,r=!!Ib(e),n=!!vb(i),s,a,l,c,u;function d(h){let b=c;c=null,b?b(h):h&&u.destroy(h)}return o(d,"onfinished"),u=new gt({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(i!=null&&i.writableObjectMode),readable:r,writable:n}),n&&(df(i,h=>{n=!1,h&&Ei(e,h),d(h)}),u._write=function(h,b,m){i.write(h,b)?m():s=m},u._final=function(h){i.end(),a=h},i.on("drain",function(){if(s){let h=s;s=null,h()}}),i.on("finish",function(){if(a){let h=a;a=null,h()}})),r&&(df(e,h=>{r=!1,h&&Ei(e,h),d(h)}),e.on("readable",function(){if(l){let h=l;l=null,h()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let h=e.read();if(h===null){l=u._read;return}if(!u.push(h))return}}),u._destroy=function(h,b){!h&&c!==null&&(h=new gf),l=null,s=null,a=null,c===null?b(h):(c=b,Ei(i,h),Ei(e,h))},u}o(_i,"_duplexify")});var Ge=T((EE,kf)=>{"use strict";var{ObjectDefineProperties:Db,ObjectGetOwnPropertyDescriptor:rt,ObjectKeys:Bb,ObjectSetPrototypeOf:Ef}=W();kf.exports=Pe;var ls=lr(),Ee=xn();Ef(Pe.prototype,ls.prototype);Ef(Pe,ls);{let t=Bb(Ee.prototype);for(let e=0;e<t.length;e++){let i=t[e];Pe.prototype[i]||(Pe.prototype[i]=Ee.prototype[i])}}function Pe(t){if(!(this instanceof Pe))return new Pe(t);ls.call(this,t),Ee.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}o(Pe,"Duplex");Db(Pe.prototype,{writable:{__proto__:null,...rt(Ee.prototype,"writable")},writableHighWaterMark:{__proto__:null,...rt(Ee.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...rt(Ee.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...rt(Ee.prototype,"writableBuffer")},writableLength:{__proto__:null,...rt(Ee.prototype,"writableLength")},writableFinished:{__proto__:null,...rt(Ee.prototype,"writableFinished")},writableCorked:{__proto__:null,...rt(Ee.prototype,"writableCorked")},writableEnded:{__proto__:null,...rt(Ee.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...rt(Ee.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get:o(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:o(function(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)},"set")}});var ss;function xf(){return ss===void 0&&(ss={}),ss}o(xf,"lazyWebStreams");Pe.fromWeb=function(t,e){return xf().newStreamDuplexFromReadableWritablePair(t,e)};Pe.toWeb=function(t){return xf().newReadableWritablePairFromDuplex(t)};var as;Pe.from=function(t){return as||(as=_f()),as(t,"body")}});var us=T((kE,If)=>{"use strict";var{ObjectSetPrototypeOf:Ff,Symbol:Mb}=W();If.exports=nt;var{ERR_METHOD_NOT_IMPLEMENTED:Wb}=ne().codes,fs=Ge(),{getHighWaterMark:Ub}=or();Ff(nt.prototype,fs.prototype);Ff(nt,fs);var dr=Mb("kCallback");function nt(t){if(!(this instanceof nt))return new nt(t);let e=t?Ub(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),fs.call(this,t),this._readableState.sync=!1,this[dr]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",qb)}o(nt,"Transform");function cs(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,i)=>{if(e){t?t(e):this.destroy(e);return}i!=null&&this.push(i),this.push(null),t&&t()}):(this.push(null),t&&t())}o(cs,"final");function qb(){this._final!==cs&&cs.call(this)}o(qb,"prefinish");nt.prototype._final=cs;nt.prototype._transform=function(t,e,i){throw new Wb("_transform()")};nt.prototype._write=function(t,e,i){let r=this._readableState,n=this._writableState,s=r.length;this._transform(t,e,(a,l)=>{if(a){i(a);return}l!=null&&this.push(l),n.ended||s===r.length||r.length<r.highWaterMark?i():this[dr]=i})};nt.prototype._read=function(){if(this[dr]){let t=this[dr];this[dr]=null,t()}}});var hs=T((IE,Pf)=>{"use strict";var{ObjectSetPrototypeOf:vf}=W();Pf.exports=xi;var ds=us();vf(xi.prototype,ds.prototype);vf(xi,ds);function xi(t){if(!(this instanceof xi))return new xi(t);ds.call(this,t)}o(xi,"PassThrough");xi.prototype._transform=function(t,e,i){i(null,t)}});var vn=T((PE,Cf)=>{var hr=yt(),{ArrayIsArray:jb,Promise:$b,SymbolAsyncIterator:Vb,SymbolDispose:zb}=W(),In=it(),{once:Hb}=ee(),Yb=Ut(),Tf=Ge(),{aggregateTwoErrors:Gb,codes:{ERR_INVALID_ARG_TYPE:Es,ERR_INVALID_RETURN_VALUE:ps,ERR_MISSING_ARGS:Kb,ERR_STREAM_DESTROYED:Xb,ERR_STREAM_PREMATURE_CLOSE:Jb},AbortError:Qb}=ne(),{validateFunction:Zb,validateAbortSignal:eg}=hi(),{isIterable:Vt,isReadable:ys,isReadableNodeStream:Fn,isNodeStream:Af,isTransformStream:ki,isWebStream:tg,isReadableStream:ms,isReadableFinished:ig}=ze(),rg=globalThis.AbortController||fi().AbortController,bs,gs,ws;function Rf(t,e,i){let r=!1;t.on("close",()=>{r=!0});let n=In(t,{readable:e,writable:i},s=>{r=!s});return{destroy:o(s=>{r||(r=!0,Yb.destroyer(t,s||new Xb("pipe")))},"destroy"),cleanup:n}}o(Rf,"destroyer");function ng(t){return Zb(t[t.length-1],"streams[stream.length - 1]"),t.pop()}o(ng,"popCallback");function Ss(t){if(Vt(t))return t;if(Fn(t))return og(t);throw new Es("val",["Readable","Iterable","AsyncIterable"],t)}o(Ss,"makeAsyncIterable");async function*og(t){gs||(gs=lr()),yield*gs.prototype[Vb].call(t)}o(og,"fromReadable");async function kn(t,e,i,{end:r}){let n,s=null,a=o(u=>{if(u&&(n=u),s){let d=s;s=null,d()}},"resume"),l=o(()=>new $b((u,d)=>{n?d(n):s=o(()=>{n?d(n):u()},"onresolve")}),"wait");e.on("drain",a);let c=In(e,{readable:!1},a);try{e.writableNeedDrain&&await l();for await(let u of t)e.write(u)||await l();r&&(e.end(),await l()),i()}catch(u){i(n!==u?Gb(n,u):u)}finally{c(),e.off("drain",a)}}o(kn,"pumpToNode");async function _s(t,e,i,{end:r}){ki(e)&&(e=e.writable);let n=e.getWriter();try{for await(let s of t)await n.ready,n.write(s).catch(()=>{});await n.ready,r&&await n.close(),i()}catch(s){try{await n.abort(s),i(s)}catch(a){i(a)}}}o(_s,"pumpToWeb");function sg(...t){return Of(t,Hb(ng(t)))}o(sg,"pipeline");function Of(t,e,i){if(t.length===1&&jb(t[0])&&(t=t[0]),t.length<2)throw new Kb("streams");let r=new rg,n=r.signal,s=i?.signal,a=[];eg(s,"options.signal");function l(){w(new Qb)}o(l,"abort"),ws=ws||ee().addAbortListener;let c;s&&(c=ws(s,l));let u,d,h=[],b=0;function m(q){w(q,--b===0)}o(m,"finish");function w(q,P){var z;if(q&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=q),!(!u&&!P)){for(;h.length;)h.shift()(u);(z=c)===null||z===void 0||z[zb](),r.abort(),P&&(u||a.forEach(_t=>_t()),hr.nextTick(e,u,d))}}o(w,"finishImpl");let g;for(let q=0;q<t.length;q++){let P=t[q],z=q<t.length-1,_t=q>0,pe=z||i?.end!==!1,Kt=q===t.length-1;if(Af(P)){let oe=function(Xe){Xe&&Xe.name!=="AbortError"&&Xe.code!=="ERR_STREAM_PREMATURE_CLOSE"&&m(Xe)};var A=oe;if(o(oe,"onError"),pe){let{destroy:Xe,cleanup:Un}=Rf(P,z,_t);h.push(Xe),ys(P)&&Kt&&a.push(Un)}P.on("error",oe),ys(P)&&Kt&&a.push(()=>{P.removeListener("error",oe)})}if(q===0)if(typeof P=="function"){if(g=P({signal:n}),!Vt(g))throw new ps("Iterable, AsyncIterable or Stream","source",g)}else Vt(P)||Fn(P)||ki(P)?g=P:g=Tf.from(P);else if(typeof P=="function"){if(ki(g)){var v;g=Ss((v=g)===null||v===void 0?void 0:v.readable)}else g=Ss(g);if(g=P(g,{signal:n}),z){if(!Vt(g,!0))throw new ps("AsyncIterable",`transform[${q-1}]`,g)}else{var S;bs||(bs=hs());let oe=new bs({objectMode:!0}),Xe=(S=g)===null||S===void 0?void 0:S.then;if(typeof Xe=="function")b++,Xe.call(g,st=>{d=st,st!=null&&oe.write(st),pe&&oe.end(),hr.nextTick(m)},st=>{oe.destroy(st),hr.nextTick(m,st)});else if(Vt(g,!0))b++,kn(g,oe,m,{end:pe});else if(ms(g)||ki(g)){let st=g.readable||g;b++,kn(st,oe,m,{end:pe})}else throw new ps("AsyncIterable or Promise","destination",g);g=oe;let{destroy:Un,cleanup:td}=Rf(g,!1,!0);h.push(Un),Kt&&a.push(td)}}else if(Af(P)){if(Fn(g)){b+=2;let oe=ag(g,P,m,{end:pe});ys(P)&&Kt&&a.push(oe)}else if(ki(g)||ms(g)){let oe=g.readable||g;b++,kn(oe,P,m,{end:pe})}else if(Vt(g))b++,kn(g,P,m,{end:pe});else throw new Es("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],g);g=P}else if(tg(P)){if(Fn(g))b++,_s(Ss(g),P,m,{end:pe});else if(ms(g)||Vt(g))b++,_s(g,P,m,{end:pe});else if(ki(g))b++,_s(g.readable,P,m,{end:pe});else throw new Es("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],g);g=P}else g=Tf.from(P)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&hr.nextTick(l),g}o(Of,"pipelineImpl");function ag(t,e,i,{end:r}){let n=!1;if(e.on("close",()=>{n||i(new Jb)}),t.pipe(e,{end:!1}),r){let a=function(){n=!0,e.end()};var s=a;o(a,"endFn"),ig(t)?hr.nextTick(a):t.once("end",a)}else i();return In(t,{readable:!0,writable:!1},a=>{let l=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?t.once("end",i).once("error",i):i(a)}),In(e,{readable:!1,writable:!0},i)}o(ag,"pipe");Cf.exports={pipelineImpl:Of,pipeline:sg}});var ks=T((AE,Wf)=>{"use strict";var{pipeline:lg}=vn(),Pn=Ge(),{destroyer:cg}=Ut(),{isNodeStream:Tn,isReadable:Lf,isWritable:Nf,isWebStream:xs,isTransformStream:zt,isWritableStream:Df,isReadableStream:Bf}=ze(),{AbortError:fg,codes:{ERR_INVALID_ARG_VALUE:Mf,ERR_MISSING_ARGS:ug}}=ne(),dg=it();Wf.exports=o(function(...e){if(e.length===0)throw new ug("streams");if(e.length===1)return Pn.from(e[0]);let i=[...e];if(typeof e[0]=="function"&&(e[0]=Pn.from(e[0])),typeof e[e.length-1]=="function"){let m=e.length-1;e[m]=Pn.from(e[m])}for(let m=0;m<e.length;++m)if(!(!Tn(e[m])&&!xs(e[m]))){if(m<e.length-1&&!(Lf(e[m])||Bf(e[m])||zt(e[m])))throw new Mf(`streams[${m}]`,i[m],"must be readable");if(m>0&&!(Nf(e[m])||Df(e[m])||zt(e[m])))throw new Mf(`streams[${m}]`,i[m],"must be writable")}let r,n,s,a,l;function c(m){let w=a;a=null,w?w(m):m?l.destroy(m):!b&&!h&&l.destroy()}o(c,"onfinished");let u=e[0],d=lg(e,c),h=!!(Nf(u)||Df(u)||zt(u)),b=!!(Lf(d)||Bf(d)||zt(d));if(l=new Pn({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(d!=null&&d.readableObjectMode),writable:h,readable:b}),h){if(Tn(u))l._write=function(w,g,v){u.write(w,g)?v():r=v},l._final=function(w){u.end(),n=w},u.on("drain",function(){if(r){let w=r;r=null,w()}});else if(xs(u)){let g=(zt(u)?u.writable:u).getWriter();l._write=async function(v,S,A){try{await g.ready,g.write(v).catch(()=>{}),A()}catch(q){A(q)}},l._final=async function(v){try{await g.ready,g.close().catch(()=>{}),n=v}catch(S){v(S)}}}let m=zt(d)?d.readable:d;dg(m,()=>{if(n){let w=n;n=null,w()}})}if(b){if(Tn(d))d.on("readable",function(){if(s){let m=s;s=null,m()}}),d.on("end",function(){l.push(null)}),l._read=function(){for(;;){let m=d.read();if(m===null){s=l._read;return}if(!l.push(m))return}};else if(xs(d)){let w=(zt(d)?d.readable:d).getReader();l._read=async function(){for(;;)try{let{value:g,done:v}=await w.read();if(!l.push(g))return;if(v){l.push(null);return}}catch{return}}}}return l._destroy=function(m,w){!m&&a!==null&&(m=new fg),s=null,r=null,n=null,a===null?w(m):(a=w,Tn(d)&&cg(d,m))},l},"compose")});var Kf=T((OE,vs)=>{"use strict";var hg=globalThis.AbortController||fi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:pg,ERR_INVALID_ARG_TYPE:pr,ERR_MISSING_ARGS:yg,ERR_OUT_OF_RANGE:mg},AbortError:Ke}=ne(),{validateAbortSignal:Ht,validateInteger:Uf,validateObject:Yt}=hi(),bg=W().Symbol("kWeak"),gg=W().Symbol("kResistStopPropagation"),{finished:wg}=it(),Sg=ks(),{addAbortSignalNoValidate:_g}=nr(),{isWritable:Eg,isNodeStream:xg}=ze(),{deprecate:kg}=ee(),{ArrayPrototypePush:Fg,Boolean:Ig,MathFloor:qf,Number:vg,NumberIsNaN:Pg,Promise:jf,PromiseReject:$f,PromiseResolve:Tg,PromisePrototypeThen:Vf,Symbol:Hf}=W(),An=Hf("kEmpty"),zf=Hf("kEof");function Ag(t,e){if(e!=null&&Yt(e,"options"),e?.signal!=null&&Ht(e.signal,"options.signal"),xg(t)&&!Eg(t))throw new pg("stream",t,"must be writable");let i=Sg(this,t);return e!=null&&e.signal&&_g(e.signal,i),i}o(Ag,"compose");function Rn(t,e){if(typeof t!="function")throw new pr("fn",["Function","AsyncFunction"],t);e!=null&&Yt(e,"options"),e?.signal!=null&&Ht(e.signal,"options.signal");let i=1;e?.concurrency!=null&&(i=qf(e.concurrency));let r=i-1;return e?.highWaterMark!=null&&(r=qf(e.highWaterMark)),Uf(i,"options.concurrency",1),Uf(r,"options.highWaterMark",0),r+=i,o(async function*(){let s=ee().AbortSignalAny([e?.signal].filter(Ig)),a=this,l=[],c={signal:s},u,d,h=!1,b=0;function m(){h=!0,w()}o(m,"onCatch");function w(){b-=1,g()}o(w,"afterItemProcessed");function g(){d&&!h&&b<i&&l.length<r&&(d(),d=null)}o(g,"maybeResume");async function v(){try{for await(let S of a){if(h)return;if(s.aborted)throw new Ke;try{if(S=t(S,c),S===An)continue;S=Tg(S)}catch(A){S=$f(A)}b+=1,Vf(S,w,m),l.push(S),u&&(u(),u=null),!h&&(l.length>=r||b>=i)&&await new jf(A=>{d=A})}l.push(zf)}catch(S){let A=$f(S);Vf(A,w,m),l.push(A)}finally{h=!0,u&&(u(),u=null)}}o(v,"pump"),v();try{for(;;){for(;l.length>0;){let S=await l[0];if(S===zf)return;if(s.aborted)throw new Ke;S!==An&&(yield S),l.shift(),g()}await new jf(S=>{u=S})}}finally{h=!0,d&&(d(),d=null)}},"map").call(this)}o(Rn,"map");function Rg(t=void 0){return t!=null&&Yt(t,"options"),t?.signal!=null&&Ht(t.signal,"options.signal"),o(async function*(){let i=0;for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ke({cause:t.signal.reason});yield[i++,n]}},"asIndexedPairs").call(this)}o(Rg,"asIndexedPairs");async function Yf(t,e=void 0){for await(let i of Is.call(this,t,e))return!0;return!1}o(Yf,"some");async function Og(t,e=void 0){if(typeof t!="function")throw new pr("fn",["Function","AsyncFunction"],t);return!await Yf.call(this,async(...i)=>!await t(...i),e)}o(Og,"every");async function Cg(t,e){for await(let i of Is.call(this,t,e))return i}o(Cg,"find");async function Lg(t,e){if(typeof t!="function")throw new pr("fn",["Function","AsyncFunction"],t);async function i(r,n){return await t(r,n),An}o(i,"forEachFn");for await(let r of Rn.call(this,i,e));}o(Lg,"forEach");function Is(t,e){if(typeof t!="function")throw new pr("fn",["Function","AsyncFunction"],t);async function i(r,n){return await t(r,n)?r:An}return o(i,"filterFn"),Rn.call(this,i,e)}o(Is,"filter");var Fs=class extends yg{static{o(this,"ReduceAwareErrMissingArgs")}constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Ng(t,e,i){var r;if(typeof t!="function")throw new pr("reducer",["Function","AsyncFunction"],t);i!=null&&Yt(i,"options"),i?.signal!=null&&Ht(i.signal,"options.signal");let n=arguments.length>1;if(i!=null&&(r=i.signal)!==null&&r!==void 0&&r.aborted){let u=new Ke(void 0,{cause:i.signal.reason});throw this.once("error",()=>{}),await wg(this.destroy(u)),u}let s=new hg,a=s.signal;if(i!=null&&i.signal){let u={once:!0,[bg]:this,[gg]:!0};i.signal.addEventListener("abort",()=>s.abort(),u)}let l=!1;try{for await(let u of this){var c;if(l=!0,i!=null&&(c=i.signal)!==null&&c!==void 0&&c.aborted)throw new Ke;n?e=await t(e,u,{signal:a}):(e=u,n=!0)}if(!l&&!n)throw new Fs}finally{s.abort()}return e}o(Ng,"reduce");async function Dg(t){t!=null&&Yt(t,"options"),t?.signal!=null&&Ht(t.signal,"options.signal");let e=[];for await(let r of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Ke(void 0,{cause:t.signal.reason});Fg(e,r)}return e}o(Dg,"toArray");function Bg(t,e){let i=Rn.call(this,t,e);return o(async function*(){for await(let n of i)yield*n},"flatMap").call(this)}o(Bg,"flatMap");function Gf(t){if(t=vg(t),Pg(t))return 0;if(t<0)throw new mg("number",">= 0",t);return t}o(Gf,"toIntegerOrInfinity");function Mg(t,e=void 0){return e!=null&&Yt(e,"options"),e?.signal!=null&&Ht(e.signal,"options.signal"),t=Gf(t),o(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Ke;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ke;t--<=0&&(yield s)}},"drop").call(this)}o(Mg,"drop");function Wg(t,e=void 0){return e!=null&&Yt(e,"options"),e?.signal!=null&&Ht(e.signal,"options.signal"),t=Gf(t),o(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Ke;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ke;if(t-- >0&&(yield s),t<=0)return}},"take").call(this)}o(Wg,"take");vs.exports.streamReturningOperators={asIndexedPairs:kg(Rg,"readable.asIndexedPairs will be removed in a future version."),drop:Mg,filter:Is,flatMap:Bg,map:Rn,take:Wg,compose:Ag};vs.exports.promiseReturningOperators={every:Og,forEach:Lg,reduce:Ng,toArray:Dg,some:Yf,find:Cg}});var Ps=T((LE,Xf)=>{"use strict";var{ArrayPrototypePop:Ug,Promise:qg}=W(),{isIterable:jg,isNodeStream:$g,isWebStream:Vg}=ze(),{pipelineImpl:zg}=vn(),{finished:Hg}=it();Ts();function Yg(...t){return new qg((e,i)=>{let r,n,s=t[t.length-1];if(s&&typeof s=="object"&&!$g(s)&&!jg(s)&&!Vg(s)){let a=Ug(t);r=a.signal,n=a.end}zg(t,(a,l)=>{a?i(a):e(l)},{signal:r,end:n})})}o(Yg,"pipeline");Xf.exports={finished:Hg,pipeline:Yg}});var Ts=T((DE,ou)=>{var{Buffer:Gg}=Ie(),{ObjectDefineProperty:ot,ObjectKeys:Zf,ReflectApply:eu}=W(),{promisify:{custom:tu}}=ee(),{streamReturningOperators:Jf,promiseReturningOperators:Qf}=Kf(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:iu}}=ne(),Kg=ks(),{setDefaultHighWaterMark:Xg,getDefaultHighWaterMark:Jg}=or(),{pipeline:ru}=vn(),{destroyer:Qg}=Ut(),nu=it(),As=Ps(),yr=ze(),L=ou.exports=fn().Stream;L.isDestroyed=yr.isDestroyed;L.isDisturbed=yr.isDisturbed;L.isErrored=yr.isErrored;L.isReadable=yr.isReadable;L.isWritable=yr.isWritable;L.Readable=lr();for(let t of Zf(Jf)){let i=function(...r){if(new.target)throw iu();return L.Readable.from(eu(e,this,r))};Rs=i,o(i,"fn");let e=Jf[t];ot(i,"name",{__proto__:null,value:e.name}),ot(i,"length",{__proto__:null,value:e.length}),ot(L.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var Rs;for(let t of Zf(Qf)){let i=function(...n){if(new.target)throw iu();return eu(e,this,n)};Rs=i,o(i,"fn");let e=Qf[t];ot(i,"name",{__proto__:null,value:e.name}),ot(i,"length",{__proto__:null,value:e.length}),ot(L.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var Rs;L.Writable=xn();L.Duplex=Ge();L.Transform=us();L.PassThrough=hs();L.pipeline=ru;var{addAbortSignal:Zg}=nr();L.addAbortSignal=Zg;L.finished=nu;L.destroy=Qg;L.compose=Kg;L.setDefaultHighWaterMark=Xg;L.getDefaultHighWaterMark=Jg;ot(L,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:o(function(){return As},"get")});ot(ru,tu,{__proto__:null,enumerable:!0,get:o(function(){return As.pipeline},"get")});ot(nu,tu,{__proto__:null,enumerable:!0,get:o(function(){return As.finished},"get")});L.Stream=L;L._isUint8Array=o(function(e){return e instanceof Uint8Array},"isUint8Array");L._uint8ArrayToBuffer=o(function(e){return Gg.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var su=T((ME,V)=>{"use strict";var G=Ts(),ew=Ps(),tw=G.Readable.destroy;V.exports=G.Readable;V.exports._uint8ArrayToBuffer=G._uint8ArrayToBuffer;V.exports._isUint8Array=G._isUint8Array;V.exports.isDisturbed=G.isDisturbed;V.exports.isErrored=G.isErrored;V.exports.isReadable=G.isReadable;V.exports.Readable=G.Readable;V.exports.Writable=G.Writable;V.exports.Duplex=G.Duplex;V.exports.Transform=G.Transform;V.exports.PassThrough=G.PassThrough;V.exports.addAbortSignal=G.addAbortSignal;V.exports.finished=G.finished;V.exports.destroy=G.destroy;V.exports.destroy=tw;V.exports.pipeline=G.pipeline;V.exports.compose=G.compose;Object.defineProperty(G,"promises",{configurable:!0,enumerable:!0,get:o(function(){return ew},"get")});V.exports.Stream=G.Stream;V.exports.default=V.exports});var ow={};_r(ow,{ActionType:()=>Fr,Async:()=>Di,AsyncIndexFS:()=>zi,AsyncStoreFS:()=>ji,BigIntStats:()=>re,BigIntStatsFs:()=>zn,Dir:()=>pt,Dirent:()=>ht,Errno:()=>C,ErrnoError:()=>f,Fetch:()=>Gd,FetchFS:()=>Mr,File:()=>vt,FileIndex:()=>Rt,FileSystem:()=>Z,FileType:()=>j,InMemory:()=>Tt,InMemoryStore:()=>Pr,IndexDirInode:()=>ft,IndexFS:()=>Vi,IndexFileInode:()=>Dr,IndexInode:()=>$i,Inode:()=>Fe,LockedFS:()=>Yi,Mutex:()=>Hi,NoSyncFile:()=>Je,Overlay:()=>Kd,OverlayFS:()=>Gi,Port:()=>jd,PortFS:()=>Or,PortFile:()=>qi,PortStore:()=>Lr,PortStoreBackend:()=>zd,PortTransaction:()=>Nr,PreloadFile:()=>ae,ReadStream:()=>wt,Readonly:()=>Yn,SimpleSyncTransaction:()=>Mi,Stats:()=>D,StatsCommon:()=>Ri,StatsFs:()=>Oi,Sync:()=>Hn,SyncIndexFS:()=>Xn,SyncStoreFS:()=>Wi,UnlockedOverlayFS:()=>Wr,WriteStream:()=>St,_toUnixTimestamp:()=>Md,access:()=>Uu,accessSync:()=>za,appendFile:()=>mu,appendFileSync:()=>Oa,attachFS:()=>Ud,attachStore:()=>$d,checkOptions:()=>Ur,chmod:()=>Nu,chmodSync:()=>ja,chown:()=>Cu,chownSync:()=>Ua,close:()=>gu,closeSync:()=>Ze,configure:()=>rw,constants:()=>It,copyFile:()=>Gu,copyFileSync:()=>mo,cp:()=>Qu,cpSync:()=>bo,createBackend:()=>Xd,createReadStream:()=>Vu,createWriteStream:()=>zu,decode:()=>vr,decodeDirListing:()=>Bi,default:()=>nw,detachFS:()=>qd,detachStore:()=>Vd,encode:()=>We,encodeDirListing:()=>ue,errorMessages:()=>qn,exists:()=>lu,existsSync:()=>si,fchmod:()=>Fu,fchmodSync:()=>Gr,fchown:()=>ku,fchownSync:()=>Yr,fdatasync:()=>_u,fdatasyncSync:()=>Na,flagToMode:()=>lt,flagToNumber:()=>Dd,flagToString:()=>Qs,fs:()=>Sr,fstat:()=>bu,fstatSync:()=>Ca,fsync:()=>Su,fsyncSync:()=>La,ftruncate:()=>wu,ftruncateSync:()=>fo,futimes:()=>Iu,futimesSync:()=>Kr,isAppendable:()=>ct,isBackend:()=>Ki,isBackendConfig:()=>Qn,isExclusive:()=>ea,isReadable:()=>at,isSynchronous:()=>Ci,isTruncating:()=>Zs,isWriteable:()=>me,lchmod:()=>Du,lchmodSync:()=>$a,lchown:()=>Lu,lchownSync:()=>qa,levenshtein:()=>Gn,link:()=>Au,linkSync:()=>Ma,lopenSync:()=>tr,lstat:()=>fu,lstatSync:()=>co,lutimes:()=>Mu,lutimesSync:()=>Va,mkdir:()=>Pu,mkdirSync:()=>Xr,mkdirpSync:()=>ta,mkdtemp:()=>Yu,mkdtempSync:()=>Ha,mount:()=>Qi,mountObject:()=>Zi,mounts:()=>Se,nop:()=>_,normalizeMode:()=>be,normalizeOptions:()=>ge,normalizePath:()=>x,normalizeTime:()=>Pt,open:()=>hu,openAsBlob:()=>ed,openSync:()=>li,opendir:()=>Ju,opendirSync:()=>Ka,parseFlag:()=>B,pathExistsAction:()=>Li,pathNotExistsAction:()=>Ni,promises:()=>wr,randomIno:()=>Qt,read:()=>xu,readFile:()=>pu,readFileSync:()=>Hr,readSync:()=>Ba,readdir:()=>Tu,readdirSync:()=>ci,readlink:()=>Ou,readlinkSync:()=>ho,readv:()=>Ku,readvSync:()=>Ya,realpath:()=>Wu,realpathSync:()=>oi,rename:()=>au,renameSync:()=>Ta,resolveMountConfig:()=>Ys,rm:()=>Hu,rmSync:()=>yo,rmdir:()=>vu,rmdirSync:()=>uo,rootCred:()=>Re,rootIno:()=>ye,setImmediate:()=>Bd,size_max:()=>kr,stat:()=>cu,statSync:()=>er,statfs:()=>Zu,statfsSync:()=>Xa,symlink:()=>Ru,symlinkSync:()=>Wa,truncate:()=>uu,truncateSync:()=>Aa,umount:()=>Vr,unlink:()=>du,unlinkSync:()=>zr,unwatchFile:()=>ju,utimes:()=>Bu,utimesSync:()=>po,watch:()=>$u,watchFile:()=>qu,write:()=>Eu,writeFile:()=>yu,writeFileSync:()=>ir,writeSync:()=>Da,writev:()=>Xu,writevSync:()=>Ga});var C=(p=>(p[p.EPERM=1]="EPERM",p[p.ENOENT=2]="ENOENT",p[p.EINTR=4]="EINTR",p[p.EIO=5]="EIO",p[p.ENXIO=6]="ENXIO",p[p.EBADF=9]="EBADF",p[p.EAGAIN=11]="EAGAIN",p[p.ENOMEM=12]="ENOMEM",p[p.EACCES=13]="EACCES",p[p.EFAULT=14]="EFAULT",p[p.ENOTBLK=15]="ENOTBLK",p[p.EBUSY=16]="EBUSY",p[p.EEXIST=17]="EEXIST",p[p.EXDEV=18]="EXDEV",p[p.ENODEV=19]="ENODEV",p[p.ENOTDIR=20]="ENOTDIR",p[p.EISDIR=21]="EISDIR",p[p.EINVAL=22]="EINVAL",p[p.ENFILE=23]="ENFILE",p[p.EMFILE=24]="EMFILE",p[p.ETXTBSY=26]="ETXTBSY",p[p.EFBIG=27]="EFBIG",p[p.ENOSPC=28]="ENOSPC",p[p.ESPIPE=29]="ESPIPE",p[p.EROFS=30]="EROFS",p[p.EMLINK=31]="EMLINK",p[p.EPIPE=32]="EPIPE",p[p.EDOM=33]="EDOM",p[p.ERANGE=34]="ERANGE",p[p.EDEADLK=35]="EDEADLK",p[p.ENAMETOOLONG=36]="ENAMETOOLONG",p[p.ENOLCK=37]="ENOLCK",p[p.ENOSYS=38]="ENOSYS",p[p.ENOTEMPTY=39]="ENOTEMPTY",p[p.ELOOP=40]="ELOOP",p[p.ENOMSG=42]="ENOMSG",p[p.EBADE=52]="EBADE",p[p.EBADR=53]="EBADR",p[p.EXFULL=54]="EXFULL",p[p.ENOANO=55]="ENOANO",p[p.EBADRQC=56]="EBADRQC",p[p.ENOSTR=60]="ENOSTR",p[p.ENODATA=61]="ENODATA",p[p.ETIME=62]="ETIME",p[p.ENOSR=63]="ENOSR",p[p.ENONET=64]="ENONET",p[p.EREMOTE=66]="EREMOTE",p[p.ENOLINK=67]="ENOLINK",p[p.ECOMM=70]="ECOMM",p[p.EPROTO=71]="EPROTO",p[p.EBADMSG=74]="EBADMSG",p[p.EOVERFLOW=75]="EOVERFLOW",p[p.EBADFD=77]="EBADFD",p[p.ESTRPIPE=86]="ESTRPIPE",p[p.ENOTSOCK=88]="ENOTSOCK",p[p.EDESTADDRREQ=89]="EDESTADDRREQ",p[p.EMSGSIZE=90]="EMSGSIZE",p[p.EPROTOTYPE=91]="EPROTOTYPE",p[p.ENOPROTOOPT=92]="ENOPROTOOPT",p[p.EPROTONOSUPPORT=93]="EPROTONOSUPPORT",p[p.ESOCKTNOSUPPORT=94]="ESOCKTNOSUPPORT",p[p.ENOTSUP=95]="ENOTSUP",p[p.ENETDOWN=100]="ENETDOWN",p[p.ENETUNREACH=101]="ENETUNREACH",p[p.ENETRESET=102]="ENETRESET",p[p.ETIMEDOUT=110]="ETIMEDOUT",p[p.ECONNREFUSED=111]="ECONNREFUSED",p[p.EHOSTDOWN=112]="EHOSTDOWN",p[p.EHOSTUNREACH=113]="EHOSTUNREACH",p[p.EALREADY=114]="EALREADY",p[p.EINPROGRESS=115]="EINPROGRESS",p[p.ESTALE=116]="ESTALE",p[p.EREMOTEIO=121]="EREMOTEIO",p[p.EDQUOT=122]="EDQUOT",p))(C||{}),qn={1:"Operation not permitted",2:"No such file or directory",4:"Interrupted system call",5:"Input/output error",6:"No such device or address",9:"Bad file descriptor",11:"Resource temporarily unavailable",12:"Cannot allocate memory",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Resource busy or locked",17:"File exists",18:"Invalid cross-device link",19:"No such device",20:"File is not a directory",21:"File is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",26:"Text file busy",27:"File is too big",28:"No space left on disk",29:"Illegal seek",30:"Cannot modify a read-only file system",31:"Too many links",32:"Broken pipe",33:"Numerical argument out of domain",34:"Numerical result out of range",35:"Resource deadlock would occur",36:"File name too long",37:"No locks available",38:"Function not implemented",39:"Directory is not empty",40:"Too many levels of symbolic links",42:"No message of desired type",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",60:"Device not a stream",61:"No data available",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",66:"Object is remote",67:"Link has been severed",70:"Communication error on send",71:"Protocol error",74:"Bad message",75:"Value too large for defined data type",77:"File descriptor in bad state",86:"Streams pipe error",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Protocol not supported",94:"Socket type not supported",95:"Operation is not supported",100:"Network is down",101:"Network is unreachable",102:"Network dropped connection on reset",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"No route to host",114:"Operation already in progress",115:"Operation now in progress",116:"Stale file handle",121:"Remote I/O error",122:"Disk quota exceeded"},f=class t extends Error{constructor(i,r=qn[i],n,s=""){super(r);this.errno=i;this.path=n;this.syscall=s;this.code=C[i],this.message=`${this.code}: ${r}${this.path?`, '${this.path}'`:""}`}static{o(this,"ErrnoError")}static fromJSON(i){let r=new t(i.errno,i.message,i.path,i.syscall);return r.code=i.code,r.stack=i.stack,r}static With(i,r,n){return new t(C[i],qn[C[i]],r,n)}toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message,syscall:this.syscall}}bufferSize(){return 4+JSON.stringify(this.toJSON()).length}};var Re={uid:0,gid:0,suid:0,sgid:0,euid:0,egid:0};var cd="/";var Ks="/";function Xs(t,e){let i="",r=0,n=-1,s=0,a="\0";for(let l=0;l<=t.length;++l){if(l<t.length)a=t[l];else{if(a=="/")break;a="/"}if(a=="/"){if(!(n===l-1||s===1))if(s===2){if(i.length<2||r!==2||i.at(-1)!=="."||i.at(-2)!=="."){if(i.length>2){let c=i.lastIndexOf("/");c===-1?(i="",r=0):(i=i.slice(0,c),r=i.length-1-i.lastIndexOf("/")),n=l,s=0;continue}else if(i.length!==0){i="",r=0,n=l,s=0;continue}}e&&(i+=i.length>0?"/..":"..",r=2)}else i.length>0?i+="/"+t.slice(n+1,l):i=t.slice(n+1,l),r=l-n-1;n=l,s=0}else a==="."&&s!==-1?++s:s=-1}return i}o(Xs,"normalizeString");function xe(...t){let e="";for(let r of[...t.reverse(),cd])if(r.length&&(e=`${r}/${e}`,r.startsWith("/")))break;let i=e.startsWith("/");return e=Xs(e,!i),i?`/${e}`:e.length?e:"/"}o(xe,"resolve");function fd(t){if(!t.length)return".";let e=t.startsWith("/"),i=t.endsWith("/");return t=Xs(t,!e),t.length?(i&&(t+="/"),e?`/${t}`:t):e?"/":i?"./":"."}o(fd,"normalize");function N(...t){if(!t.length)return".";let e=t.join("/");return e?.length?fd(e):"."}o(N,"join");function k(t){if(t.length===0)return".";let e=t[0]==="/",i=-1,r=!0;for(let n=t.length-1;n>=1;--n)if(t[n]==="/"){if(!r){i=n;break}}else r=!1;return i===-1?e?"/":".":e&&i===1?"//":t.slice(0,i)}o(k,"dirname");function O(t,e){let i=0,r=-1,n=!0;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e===t)return"";let s=e.length-1,a=-1;for(let l=t.length-1;l>=0;--l)if(t[l]==="/"){if(!n){i=l+1;break}}else a===-1&&(n=!1,a=l+1),s>=0&&(t[l]===e[s]?--s===-1&&(r=l):(s=-1,r=a));return i===r?r=a:r===-1&&(r=t.length),t.slice(i,r)}for(let s=t.length-1;s>=0;--s)if(t[s]==="/"){if(!n){i=s+1;break}}else r===-1&&(n=!1,r=s+1);return r===-1?"":t.slice(i,r)}o(O,"basename");function xr(t){let e=t.startsWith("/"),i={root:e?"/":"",dir:"",base:"",ext:"",name:""};if(t.length===0)return i;let r=e?1:0,n=-1,s=0,a=-1,l=!0,c=t.length-1,u=0;for(;c>=r;--c){if(t[c]==="/"){if(!l){s=c+1;break}continue}a===-1&&(l=!1,a=c+1),t[c]==="."?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}if(a!==-1){let d=s===0&&e?1:s;n===-1||u===0||u===1&&n===a-1&&n===s+1?i.base=i.name=t.slice(d,a):(i.name=t.slice(d,n),i.base=t.slice(d,a),i.ext=t.slice(n,a))}return s>0?i.dir=t.slice(0,s-1):e&&(i.dir="/"),i}o(xr,"parse");var It={};_r(It,{COPYFILE_EXCL:()=>Ai,COPYFILE_FICLONE:()=>dd,COPYFILE_FICLONE_FORCE:()=>hd,F_OK:()=>Ti,O_APPEND:()=>Ne,O_CREAT:()=>K,O_DIRECT:()=>Sd,O_DIRECTORY:()=>yd,O_DSYNC:()=>gd,O_EXCL:()=>Ce,O_NOATIME:()=>md,O_NOCTTY:()=>pd,O_NOFOLLOW:()=>bd,O_NONBLOCK:()=>_d,O_RDONLY:()=>Xt,O_RDWR:()=>se,O_SYMLINK:()=>wd,O_SYNC:()=>Jt,O_TRUNC:()=>Le,O_WRONLY:()=>Oe,R_OK:()=>ke,S_IFBLK:()=>xt,S_IFCHR:()=>kt,S_IFDIR:()=>Me,S_IFIFO:()=>Ft,S_IFLNK:()=>De,S_IFMT:()=>J,S_IFREG:()=>Be,S_IFSOCK:()=>Et,S_IRGRP:()=>Pd,S_IROTH:()=>Rd,S_IRUSR:()=>Fd,S_IRWXG:()=>$n,S_IRWXO:()=>Vn,S_IRWXU:()=>jn,S_ISGID:()=>xd,S_ISUID:()=>Ed,S_ISVTX:()=>kd,S_IWGRP:()=>Td,S_IWOTH:()=>Od,S_IWUSR:()=>Id,S_IXGRP:()=>Ad,S_IXOTH:()=>Cd,S_IXUSR:()=>vd,UV_FS_O_FILEMAP:()=>Ld,W_OK:()=>fe,X_OK:()=>ud});var Ti=0,ke=4,fe=2,ud=1,Ai=1,dd=2,hd=4,Xt=0,Oe=1,se=2,K=64,Ce=128,pd=256,Le=512,Ne=1024,yd=65536,md=262144,bd=131072,Jt=1052672,gd=4096,wd=32768,Sd=16384,_d=2048,J=61440,Et=49152,De=40960,Be=32768,xt=24576,Me=16384,kt=8192,Ft=4096,Ed=2048,xd=1024,kd=512,jn=448,Fd=256,Id=128,vd=64,$n=56,Pd=32,Td=16,Ad=8,Vn=7,Rd=4,Od=2,Cd=1,Ld=0;var j=(r=>(r[r.FILE=32768]="FILE",r[r.DIRECTORY=16384]="DIRECTORY",r[r.SYMLINK=40960]="SYMLINK",r))(j||{}),Ri=class{constructor({atimeMs:e,mtimeMs:i,ctimeMs:r,birthtimeMs:n,uid:s,gid:a,size:l,mode:c,ino:u}={}){this.dev=this._convert(0);this.ino=this._convert(0);this.rdev=this._convert(0);this.nlink=this._convert(1);this.blksize=this._convert(4096);this.uid=this._convert(0);this.gid=this._convert(0);let d=Date.now(),h=o((m,w)=>typeof m==this._typename?m:this._convert(typeof m==this._typename_inverse?m:w),"resolveT");this.atimeMs=h(e,d),this.mtimeMs=h(i,d),this.ctimeMs=h(r,d),this.birthtimeMs=h(n,d),this.uid=h(s,0),this.gid=h(a,0),this.size=h(l,0),this.ino=h(u,0);let b=Number(c)&61440||j.FILE;if(c)this.mode=this._convert(c);else switch(b){case j.FILE:this.mode=this._convert(420);break;case j.DIRECTORY:default:this.mode=this._convert(511)}this.blocks=this._convert(Math.ceil(Number(l)/512)),this.mode&61440||(this.mode=this.mode|this._convert(b))}static{o(this,"StatsCommon")}get _typename(){return this._isBigint?"bigint":"number"}get _typename_inverse(){return this._isBigint?"number":"bigint"}_convert(e){return this._isBigint?BigInt(e):Number(e)}get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}hasAccess(e,i){if(i.euid===0||i.egid===0)return!0;let r=(i.uid==this.uid?448:0)|(i.gid==this.gid?56:0)|7;return(e&this.mode&r)==e}cred(e=Number(this.uid),i=Number(this.gid)){return{uid:e,gid:i,suid:Number(this.uid),sgid:Number(this.gid),euid:e,egid:i}}chmod(e){this.mode=this._convert(this.mode&61440|e)}chown(e,i){e=Number(e),i=Number(i),!isNaN(e)&&0<=e&&e<2**32&&(this.uid=this._convert(e)),!isNaN(i)&&0<=i&&i<2**32&&(this.gid=this._convert(i))}get atimeNs(){return BigInt(this.atimeMs)}get mtimeNs(){return BigInt(this.mtimeMs)}get ctimeNs(){return BigInt(this.ctimeMs)}get birthtimeNs(){return BigInt(this.birthtimeMs)}},D=class t extends Ri{constructor(){super(...arguments);this._isBigint=!1}static{o(this,"Stats")}static clone(i){return new t(i)}},re=class t extends Ri{constructor(){super(...arguments);this._isBigint=!0}static{o(this,"BigIntStats")}static clone(i){return new t(i)}},Oi=class{constructor(){this.type=0;this.bsize=0;this.blocks=0;this.bfree=0;this.bavail=0;this.files=0;this.ffree=0}static{o(this,"StatsFs")}},zn=class{constructor(){this.type=0n;this.bsize=0n;this.blocks=0n;this.bfree=0n;this.bavail=0n;this.files=0n;this.ffree=0n}static{o(this,"BigIntStatsFs")}};var kr=2**32-1,ye=0n;function Js(){return Math.round(Math.random()*2**32).toString(16)}o(Js,"_random");function Qt(){return BigInt("0x"+Js()+Js())}o(Qt,"randomIno");var Fe=class{static{o(this,"Inode")}get data(){return new Uint8Array(this.buffer)}constructor(e){let i=!e;if(e??=new ArrayBuffer(58),e?.byteLength<58)throw new RangeError("Can not create an inode from a buffer less than 58 bytes");if(this.view=new DataView(e),this.buffer=e,!i)return;this.ino=Qt(),this.nlink=1,this.size=4096;let r=Date.now();this.atimeMs=r,this.mtimeMs=r,this.ctimeMs=r,this.birthtimeMs=r}get ino(){return this.view.getBigUint64(0,!0)}set ino(e){this.view.setBigUint64(0,e,!0)}get size(){return this.view.getUint32(8,!0)}set size(e){this.view.setUint32(8,e,!0)}get mode(){return this.view.getUint16(12,!0)}set mode(e){this.view.setUint16(12,e,!0)}get nlink(){return this.view.getUint32(14,!0)}set nlink(e){this.view.setUint32(14,e,!0)}get uid(){return this.view.getUint32(18,!0)}set uid(e){this.view.setUint32(18,e,!0)}get gid(){return this.view.getUint32(22,!0)}set gid(e){this.view.setUint32(22,e,!0)}get atimeMs(){return this.view.getFloat64(26,!0)}set atimeMs(e){this.view.setFloat64(26,e,!0)}get birthtimeMs(){return this.view.getFloat64(34,!0)}set birthtimeMs(e){this.view.setFloat64(34,e,!0)}get mtimeMs(){return this.view.getFloat64(42,!0)}set mtimeMs(e){this.view.setFloat64(42,e,!0)}get ctimeMs(){return this.view.getFloat64(50,!0)}set ctimeMs(e){this.view.setFloat64(50,e,!0)}toStats(){return new D(this)}update(e){let i=!1;return this.size!==e.size&&(this.size=e.size,i=!0),this.mode!==e.mode&&(this.mode=e.mode,i=!0),this.nlink!==e.nlink&&(this.nlink=e.nlink,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.atimeMs!==e.atimeMs&&(this.atimeMs=e.atimeMs,i=!0),this.mtimeMs!==e.mtimeMs&&(this.mtimeMs=e.mtimeMs,i=!0),this.ctimeMs!==e.ctimeMs&&(this.ctimeMs=e.ctimeMs,i=!0),i}};var Fr=(n=>(n[n.NOP=0]="NOP",n[n.THROW=1]="THROW",n[n.TRUNCATE=2]="TRUNCATE",n[n.CREATE=3]="CREATE",n))(Fr||{}),Nd=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];function B(t){if(typeof t=="number")return Qs(t);if(!Nd.includes(t))throw new Error("Invalid flag string: "+t);return t}o(B,"parseFlag");function Qs(t){switch(t){case 0:return"r";case 1052672:return"rs";case 2:return"r+";case 1052674:return"rs+";case 577:return"w";case 705:return"wx";case 578:return"w+";case 706:return"wx+";case 1089:return"a";case 1217:return"ax";case 1090:return"a+";case 1218:return"ax+";default:throw new Error("Invalid flag number: "+t)}}o(Qs,"flagToString");function Dd(t){switch(t){case"r":return 0;case"rs":return 1052672;case"r+":return 2;case"rs+":return 1052674;case"w":return 577;case"wx":return 705;case"w+":return 578;case"wx+":return 706;case"a":return 1089;case"ax":return 1217;case"a+":return 1090;case"ax+":return 1218;default:throw new Error("Invalid flag string: "+t)}}o(Dd,"flagToNumber");function lt(t){let e=0;return e<<=1,e+=+at(t),e<<=1,e+=+me(t),e<<=1,e}o(lt,"flagToMode");function at(t){return t.indexOf("r")!==-1||t.indexOf("+")!==-1}o(at,"isReadable");function me(t){return t.indexOf("w")!==-1||t.indexOf("a")!==-1||t.indexOf("+")!==-1}o(me,"isWriteable");function Zs(t){return t.indexOf("w")!==-1}o(Zs,"isTruncating");function ct(t){return t.indexOf("a")!==-1}o(ct,"isAppendable");function Ci(t){return t.indexOf("s")!==-1}o(Ci,"isSynchronous");function ea(t){return t.indexOf("x")!==-1}o(ea,"isExclusive");function Li(t){return ea(t)?1:Zs(t)?2:0}o(Li,"pathExistsAction");function Ni(t){return(me(t)||ct(t))&&t!=="r+"?3:1}o(Ni,"pathNotExistsAction");var vt=class{static{o(this,"File")}[Symbol.asyncDispose](){return this.close()}[Symbol.dispose](){return this.closeSync()}datasync(){return this.sync()}datasyncSync(){return this.syncSync()}},ae=class extends vt{constructor(i,r,n,s,a=new Uint8Array(new ArrayBuffer(0,{maxByteLength:kr}))){super();this.fs=i;this.path=r;this.flag=n;this.stats=s;this._buffer=a;this._position=0;this._dirty=!1;if(this.stats.size!=a.byteLength){if(at(this.flag))throw new Error(`Size mismatch: buffer length ${a.byteLength}, stats size ${this.stats.size}`);this._dirty=!0}}static{o(this,"PreloadFile")}get buffer(){return this._buffer}get position(){return ct(this.flag)?this.stats.size:this._position}set position(i){this._position=i}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this._buffer,this.stats),this._dirty=!1)}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this._dirty=!1)}async close(){await this.sync()}closeSync(){this.syncSync()}async stat(){return new D(this.stats)}statSync(){return new D(this.stats)}async truncate(i){if(this.truncateSync(i),Ci(this.flag))return this.sync()}truncateSync(i){if(this._dirty=!0,!me(this.flag))throw new f(1,"File not opened with a writeable mode.");if(this.stats.mtimeMs=Date.now(),i>this._buffer.length){let r=new Uint8Array(i-this._buffer.length);this.writeSync(r,0,r.length,this._buffer.length),Ci(this.flag)&&this.syncSync();return}this.stats.size=i,this._buffer=this._buffer.subarray(0,i),Ci(this.flag)&&this.syncSync()}async write(i,r=0,n=this.stats.size,s=0){let a=this.writeSync(i,r,n,s);return await this.sync(),a}writeSync(i,r=0,n=this.stats.size,s=0){if(this._dirty=!0,s??=this.position,!me(this.flag))throw new f(1,"File not opened with a writeable mode.");let a=s+n;if(a>this.stats.size&&(this.stats.size=a,a>this._buffer.byteLength))if(this._buffer.buffer.resizable&&this._buffer.buffer.maxByteLength<=a)this._buffer.buffer.resize(a);else{let u=new Uint8Array(new ArrayBuffer(a,{maxByteLength:kr}));u.set(this._buffer),this._buffer=u}let l=i.slice(r,r+n);this._buffer.set(l,s);let c=l.byteLength;return this.stats.mtimeMs=Date.now(),Ci(this.flag)?(this.syncSync(),c):(this.position=s+c,c)}async read(i,r=0,n=this.stats.size,s=0){return{bytesRead:this.readSync(i,r,n,s),buffer:i}}readSync(i,r=0,n=this.stats.size,s){if(!at(this.flag))throw new f(1,"File not opened with a readable mode.");s??=this.position;let a=s+n;a>this.stats.size&&(a=s+Math.max(this.stats.size-s,0)),this.stats.atimeMs=Date.now(),this._position=a;let l=a-s;return l==0||new Uint8Array(i.buffer,0,n).set(this._buffer.slice(s,a),r),l}async chmod(i){this.chmodSync(i)}chmodSync(i){this._dirty=!0,this.stats.chmod(i),this.syncSync()}async chown(i,r){this.chownSync(i,r)}chownSync(i,r){this._dirty=!0,this.stats.chown(i,r),this.syncSync()}async utimes(i,r){this.utimesSync(i,r)}utimesSync(i,r){this._dirty=!0,this.stats.atime=i,this.stats.mtime=r,this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}_setType(i){return this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.sync()}_setTypeSync(i){this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.syncSync()}},Je=class extends ae{static{o(this,"NoSyncFile")}constructor(e,i,r,n,s){super(e,i,r,n,s)}async sync(){}syncSync(){}async close(){}closeSync(){}};var Z=class{static{o(this,"FileSystem")}metadata(){return{name:this.constructor.name,readonly:!1,totalSpace:0,freeSpace:0}}constructor(e){}async ready(){return this}async exists(e,i){try{return await this.stat(e,i),!0}catch{return!1}}existsSync(e,i){try{return this.statSync(e,i),!0}catch{return!1}}};function Hn(t){class e extends t{static{o(this,"_SyncFileSystem")}async exists(r,n){return this.existsSync(r,n)}async rename(r,n,s){return this.renameSync(r,n,s)}async stat(r,n){return this.statSync(r,n)}async createFile(r,n,s,a){return this.createFileSync(r,n,s,a)}async openFile(r,n,s){return this.openFileSync(r,n,s)}async unlink(r,n){return this.unlinkSync(r,n)}async rmdir(r,n){return this.rmdirSync(r,n)}async mkdir(r,n,s){return this.mkdirSync(r,n,s)}async readdir(r,n){return this.readdirSync(r,n)}async link(r,n,s){return this.linkSync(r,n,s)}async sync(r,n,s){return this.syncSync(r,n,s)}}return e}o(Hn,"Sync");function Di(t){class e extends t{constructor(){super(...arguments);this._queue=[];this._isInitialized=!1}static{o(this,"_AsyncFileSystem")}get _queueRunning(){return!!this._queue.length}queueDone(){return new Promise(n=>{let s=o(()=>this._queueRunning?setTimeout(s):n(),"check");s()})}async ready(){if(await this._sync.ready(),await super.ready(),this._isInitialized)return this;try{await this.crossCopy("/"),this._isInitialized=!0}catch(n){throw this._isInitialized=!1,n}return this}renameSync(n,s,a){this._sync.renameSync(n,s,a),this.queue("rename",n,s,a)}statSync(n,s){return this._sync.statSync(n,s)}createFileSync(n,s,a,l){let c=this._sync.createFileSync(n,s,a,l);this.queue("createFile",n,s,a,l);let u=c.statSync(),d=new Uint8Array(u.size);return c.readSync(d),new ae(this,n,s,u,d)}openFileSync(n,s,a){return this._sync.openFileSync(n,s,a)}unlinkSync(n,s){this._sync.unlinkSync(n,s),this.queue("unlink",n,s)}rmdirSync(n,s){this._sync.rmdirSync(n,s),this.queue("rmdir",n,s)}mkdirSync(n,s,a){this._sync.mkdirSync(n,s,a),this.queue("mkdir",n,s,a)}readdirSync(n,s){return this._sync.readdirSync(n,s)}linkSync(n,s,a){this._sync.linkSync(n,s,a),this.queue("link",n,s,a)}syncSync(n,s,a){this._sync.syncSync(n,s,a),this.queue("sync",n,s,a)}existsSync(n,s){return this._sync.existsSync(n,s)}async crossCopy(n){let s=await this.stat(n,Re);if(s.isDirectory()){if(n!=="/"){let l=await this.stat(n,Re);this._sync.mkdirSync(n,l.mode,l.cred())}let a=await this.readdir(n,Re);for(let l of a)await this.crossCopy(N(n,l))}else{let a=await this.openFile(n,B("r"),Re),l=this._sync.createFileSync(n,B("w"),s.mode,s.cred());try{let c=new Uint8Array(s.size);await a.read(c),l.writeSync(c,0,s.size)}finally{await a.close(),l.closeSync()}}}async _next(){if(!this._queueRunning)return;let[n,...s]=this._queue.shift();await this[n](...s),await this._next()}queue(...n){this._queue.push(n),this._next()}}return e}o(Di,"Async");function Yn(t){class e extends t{static{o(this,"_ReadonlyFileSystem")}metadata(){return{...super.metadata(),readonly:!0}}async rename(r,n,s){throw new f(30)}renameSync(r,n,s){throw new f(30)}async createFile(r,n,s,a){throw new f(30)}createFileSync(r,n,s,a){throw new f(30)}async unlink(r,n){throw new f(30)}unlinkSync(r,n){throw new f(30)}async rmdir(r,n){throw new f(30)}rmdirSync(r,n){throw new f(30)}async mkdir(r,n,s){throw new f(30)}mkdirSync(r,n,s){throw new f(30)}async link(r,n,s){throw new f(30)}linkSync(r,n,s){throw new f(30)}async sync(r,n,s){throw new f(30)}syncSync(r,n,s){throw new f(30)}}return e}o(Yn,"Readonly");function ta(t,e,i,r){r.existsSync(t,i)||(ta(k(t),e,i,r),r.mkdirSync(t,e,i))}o(ta,"mkdirpSync");function Ir(t,e,i,r,n){return Math.min(t+1,e+1,i+1,r===n?e:e+1)}o(Ir,"_min");function Gn(t,e){if(t===e)return 0;t.length>e.length&&([t,e]=[e,t]);let i=t.length,r=e.length;for(;i>0&&t.charCodeAt(i-1)===e.charCodeAt(r-1);)i--,r--;let n=0;for(;n<i&&t.charCodeAt(n)===e.charCodeAt(n);)n++;if(i-=n,r-=n,i===0||r===1)return r;let s=new Array(i<<1);for(let b=0;b<i;)s[i+b]=t.charCodeAt(n+b),s[b]=++b;let a,l,c,u,d;for(a=0;a+3<r;){let b=e.charCodeAt(n+(l=a)),m=e.charCodeAt(n+(c=a+1)),w=e.charCodeAt(n+(u=a+2)),g=e.charCodeAt(n+(d=a+3)),v=a+=4;for(let S=0;S<i;){let A=s[i+S],q=s[S];l=Ir(q,l,c,b,A),c=Ir(l,c,u,m,A),u=Ir(c,u,d,w,A),v=Ir(u,d,v,g,A),s[S++]=v,d=u,u=c,c=l,l=q}}let h=0;for(;a<r;){let b=e.charCodeAt(n+(l=a));h=++a;for(let m=0;m<i;m++){let w=s[m];s[m]=h=w<l||h<l?w>h?h+1:w+1:b===s[i+m]?l:l+1,l=w}}return h}o(Gn,"levenshtein");var Bd=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:t=>setTimeout(t,0);function We(t){if(typeof t!="string")throw new f(22,"Can not encode a non-string");return new Uint8Array(Array.from(t).map(e=>e.charCodeAt(0)))}o(We,"encode");function vr(t){if(!(t instanceof Uint8Array))throw new f(22,"Can not decode a non-Uint8Array");return Array.from(t).map(e=>String.fromCharCode(e)).join("")}o(vr,"decode");function Bi(t){return JSON.parse(vr(t),(e,i)=>e==""?i:BigInt(i))}o(Bi,"decodeDirListing");function ue(t){return We(JSON.stringify(t,(e,i)=>e==""?i:i.toString()))}o(ue,"encodeDirListing");function Md(t){if(typeof t=="number")return Math.floor(t);if(t instanceof Date)return Math.floor(t.getTime()/1e3);throw new Error("Cannot parse time: "+t)}o(Md,"_toUnixTimestamp");function be(t,e){if(typeof t=="number")return t;if(typeof t=="string"){let i=parseInt(t,8);if(!isNaN(i))return i}if(typeof e=="number")return e;throw new f(22,"Invalid mode: "+t?.toString())}o(be,"normalizeMode");function Pt(t){if(t instanceof Date)return t;if(typeof t=="number")return new Date(t*1e3);if(typeof t=="string")return new Date(t);throw new f(22,"Invalid time.")}o(Pt,"normalizeTime");function x(t){if(t=t.toString(),t.includes("\0"))throw new f(22,"Path can not contain null character");if(t.length==0)throw new f(22,"Path can not be empty");return xe(t.replaceAll(/[/\\]+/g,"/"))}o(x,"normalizePath");function ge(t,e="utf8",i,r=0){return typeof t!="object"||t===null?{encoding:typeof t=="string"?t:e??null,flag:i,mode:r}:{encoding:typeof t?.encoding=="string"?t.encoding:e??null,flag:typeof t?.flag=="string"?t.flag:i,mode:be("mode"in t?t?.mode:null,r)}}o(ge,"normalizeOptions");function _(){}o(_,"nop");var Mi=class{constructor(e){this.store=e;this.originalData=new Map;this.modifiedKeys=new Set}static{o(this,"SimpleSyncTransaction")}get(e){let i=this.store.get(e);return this.stashOldValue(e,i),i}put(e,i,r){return this.markModified(e),this.store.put(e,i,r)}remove(e){this.markModified(e),this.store.remove(e)}commit(){}abort(){for(let e of this.modifiedKeys){let i=this.originalData.get(e);i?this.store.put(e,i,!0):this.store.remove(e)}}stashOldValue(e,i){this.originalData.has(e)||this.originalData.set(e,i)}markModified(e){this.modifiedKeys.add(e),this.originalData.has(e)||this.originalData.set(e,this.store.get(e))}},Wi=class extends Hn(Z){static{o(this,"SyncStoreFS")}constructor(e){super(),this.store=e.store,this.makeRootDirectory()}metadata(){return{...super.metadata(),name:this.store.name}}empty(){this.store.clear(),this.makeRootDirectory()}renameSync(e,i,r){let n=this.store.beginTransaction(),s=k(e),a=O(e),l=k(i),c=O(i),u=this.findINode(n,s),d=this.getDirListing(n,u,s);if(!u.toStats().hasAccess(2,r))throw f.With("EACCES",e,"rename");if(!d[a])throw f.With("ENOENT",e,"rename");let h=d[a];if(delete d[a],(l+"/").indexOf(e+"/")==0)throw new f(16,s);let b,m;if(l===s?(b=u,m=d):(b=this.findINode(n,l),m=this.getDirListing(n,b,l)),m[c]){let w=this.getINode(n,m[c],i);if(w.toStats().isFile())try{n.remove(w.ino),n.remove(m[c])}catch(g){throw n.abort(),g}else throw f.With("EPERM",i,"rename")}m[c]=h;try{n.put(u.ino,ue(d),!0),n.put(b.ino,ue(m),!0)}catch(w){throw n.abort(),w}n.commit()}statSync(e,i){let r=this.findINode(this.store.beginTransaction(),e).toStats();if(!r.hasAccess(4,i))throw f.With("EACCES",e,"stat");return r}createFileSync(e,i,r,n){return this.commitNewFile(e,j.FILE,r,n),this.openFileSync(e,i,n)}openFileSync(e,i,r){let n=this.store.beginTransaction(),s=this.findINode(n,e),a=n.get(s.ino);if(!s.toStats().hasAccess(lt(i),r))throw f.With("EACCES",e,"openFile");if(!a)throw f.With("ENOENT",e,"openFile");return new ae(this,e,i,s.toStats(),a)}unlinkSync(e,i){this.removeEntry(e,!1,i)}rmdirSync(e,i){if(this.readdirSync(e,i).length>0)throw f.With("ENOTEMPTY",e,"rmdir");this.removeEntry(e,!0,i)}mkdirSync(e,i,r){this.commitNewFile(e,j.DIRECTORY,i,r,We("{}"))}readdirSync(e,i){let r=this.store.beginTransaction(),n=this.findINode(r,e);if(!n.toStats().hasAccess(4,i))throw f.With("EACCES",e,"readdir");return Object.keys(this.getDirListing(r,n,e))}syncSync(e,i,r){let n=this.store.beginTransaction(),s=this._findINode(n,k(e),O(e)),a=this.getINode(n,s,e),l=a.update(r);try{n.put(a.ino,i,!0),l&&n.put(s,a.data,!0)}catch(c){throw n.abort(),c}n.commit()}linkSync(e,i,r){let n=this.store.beginTransaction(),s=k(e);if(!this.findINode(n,s).toStats().hasAccess(4,r))throw f.With("EACCES",s,"link");let l=k(i),c=this.findINode(n,l),u=this.getDirListing(n,c,l);if(!c.toStats().hasAccess(2,r))throw f.With("EACCES",l,"link");let d=this._findINode(n,s,O(e)),h=this.getINode(n,d,e);if(!h.toStats().hasAccess(2,r))throw f.With("EACCES",i,"link");h.nlink++,u[O(i)]=d;try{n.put(d,h.data,!0),n.put(c.ino,ue(u),!0)}catch(b){throw n.abort(),b}n.commit()}makeRootDirectory(){let e=this.store.beginTransaction();if(e.get(ye))return;let i=new Fe;i.mode=511|j.DIRECTORY,e.put(i.ino,We("{}"),!1),e.put(ye,i.data,!1),e.commit()}_findINode(e,i,r,n=new Set){let s=N(i,r);if(n.has(s))throw new f(5,"Infinite loop detected while finding inode",s);if(n.add(s),i!="/"){let a=this._findINode(e,k(i),O(i),n),l=this.getDirListing(e,this.getINode(e,a,i+Ks+r),i);if(!(r in l))throw f.With("ENOENT",xe(i,r),"_findINode");return l[r]}if(r!=""){let a=this.getDirListing(e,this.getINode(e,ye,i),i);if(!(r in a))throw f.With("ENOENT",xe(i,r),"_findINode");return a[r]}return ye}findINode(e,i){let r=this._findINode(e,k(i),O(i));return this.getINode(e,r,i)}getINode(e,i,r){let n=e.get(i);if(!n)throw f.With("ENOENT",r,"getINode");return new Fe(n.buffer)}getDirListing(e,i,r){if(!i.toStats().isDirectory())throw f.With("ENOTDIR",r,"getDirListing");let n=e.get(i.ino);if(!n)throw f.With("ENOENT",r,"getDirListing");return Bi(n)}addNewNode(e,i,r=5){for(let n=0;n<r;n++){let s=Qt();if(e.put(s,i,!1))return s}throw new f(5,"Unable to commit data to key-value store.")}commitNewFile(e,i,r,n,s=new Uint8Array){let a=this.store.beginTransaction(),l=k(e),c=O(e),u=this.findINode(a,l),d=this.getDirListing(a,u,l);if(!u.toStats().hasAccess(2,n))throw f.With("EACCES",e,"commitNewFile");if(e==="/")throw f.With("EEXIST",e,"commitNewFile");if(d[c])throw f.With("EEXIST",e,"commitNewFile");let h=new Fe;try{h.ino=this.addNewNode(a,s),h.size=s.length,h.mode=r|i,h.uid=n.uid,h.gid=n.gid,d[c]=this.addNewNode(a,h.data),a.put(u.ino,ue(d),!0)}catch(b){throw a.abort(),b}return a.commit(),h}removeEntry(e,i,r){let n=this.store.beginTransaction(),s=k(e),a=this.findINode(n,s),l=this.getDirListing(n,a,s),c=O(e),u=l[c];if(!u)throw f.With("ENOENT",e,"removeEntry");let d=this.getINode(n,u,e);if(!d.toStats().hasAccess(2,r))throw f.With("EACCES",e,"removeEntry");if(delete l[c],!i&&d.toStats().isDirectory())throw f.With("EISDIR",e,"removeEntry");if(i&&!d.toStats().isDirectory())throw f.With("ENOTDIR",e,"removeEntry");try{n.put(a.ino,ue(l),!0),--d.nlink<1&&(n.remove(d.ino),n.remove(u))}catch(h){throw n.abort(),h}n.commit()}};var Pr=class{constructor(e="tmp"){this.name=e;this.store=new Map}static{o(this,"InMemoryStore")}clear(){this.store.clear()}beginTransaction(){return new Mi(this)}get(e){return this.store.get(e)}put(e,i,r){return!r&&this.store.has(e)?!1:(this.store.set(e,i),!0)}remove(e){this.store.delete(e)}},Tt={name:"InMemory",isAvailable:o(function(){return!0},"isAvailable"),options:{name:{type:"string",required:!1,description:"The name of the store"}},create:o(function({name:t}){return new Wi({store:new Pr(t)})},"create")};function Wd(t){return typeof t=="object"&&t!=null&&"fd"in t&&"path"in t&&"position"in t}o(Wd,"isFileData");function Ui(t){return typeof t=="object"&&t!=null&&"_zenfs"in t&&!!t._zenfs}o(Ui,"isMessage");var Zt=new Map;function At(t,{port:e,timeout:i=1e3,fs:r}={}){let n=new Error().stack.slice(6);if(!e)throw f.With("EINVAL");return new Promise((s,a)=>{let l=Math.random().toString(16).slice(10);Zt.set(l,{resolve:s,reject:a,fs:r}),e.postMessage({...t,_zenfs:!0,id:l,stack:n}),setTimeout(()=>{let c=new f(5,"RPC Failed");c.stack+=n,a(c)},i)})}o(At,"request");function Tr(t){if(!Ui(t))return;let{id:e,value:i,error:r,stack:n}=t;if(!Zt.has(e)){let c=new f(5,"Invalid RPC id:"+e);throw c.stack+=n,c}let{resolve:s,reject:a,fs:l}=Zt.get(e);if(r){let c=f.fromJSON(i);c.stack+=n,a(c),Zt.delete(e);return}if(Wd(i)){let{fd:c,path:u,position:d}=i,h=new qi(l,c,u,d);s(h),Zt.delete(e);return}s(i),Zt.delete(e)}o(Tr,"handleResponse");function ei(t,e){if(!t)throw f.With("EINVAL");t["on"in t?"on":"addEventListener"]("message",i=>{e("data"in i?i.data:i)})}o(ei,"attach");function Ar(t,e){if(!t)throw f.With("EINVAL");t["off"in t?"off":"removeEventListener"]("message",i=>{e("data"in i?i.data:i)})}o(Ar,"detach");var qi=class extends vt{constructor(i,r,n,s){super();this.fs=i;this.fd=r;this.path=n;this.position=s}static{o(this,"PortFile")}rpc(i,...r){return At({scope:"file",fd:this.fd,method:i,args:r},this.fs.options)}stat(){return this.rpc("stat")}statSync(){throw f.With("ENOSYS",this.path,"PortFile.stat")}truncate(i){return this.rpc("truncate",i)}truncateSync(){throw f.With("ENOSYS",this.path,"PortFile.truncate")}write(i,r,n,s){return this.rpc("write",i,r,n,s)}writeSync(){throw f.With("ENOSYS",this.path,"PortFile.write")}async read(i,r,n,s){return await this.rpc("read",i,r,n,s)}readSync(){throw f.With("ENOSYS",this.path,"PortFile.read")}chown(i,r){return this.rpc("chown",i,r)}chownSync(){throw f.With("ENOSYS",this.path,"PortFile.chown")}chmod(i){return this.rpc("chmod",i)}chmodSync(){throw f.With("ENOSYS",this.path,"PortFile.chmod")}utimes(i,r){return this.rpc("utimes",i,r)}utimesSync(){throw f.With("ENOSYS",this.path,"PortFile.utimes")}_setType(i){return this.rpc("_setType",i)}_setTypeSync(){throw f.With("ENOSYS",this.path,"PortFile._setType")}close(){return this.rpc("close")}closeSync(){throw f.With("ENOSYS",this.path,"PortFile.close")}sync(){return this.rpc("sync")}syncSync(){throw f.With("ENOSYS",this.path,"PortFile.sync")}},Or=class extends Di(Z){constructor(i){super();this.options=i;this._sync=Tt.create({name:"port-tmpfs"});this.port=i.port,ei(this.port,Tr)}static{o(this,"PortFS")}metadata(){return{...super.metadata(),name:"PortFS"}}rpc(i,...r){return At({scope:"fs",method:i,args:r},{...this.options,fs:this})}async ready(){return await this.rpc("ready"),await super.ready(),this}rename(i,r,n){return this.rpc("rename",i,r,n)}async stat(i,r){return new D(await this.rpc("stat",i,r))}sync(i,r,n){return this.rpc("sync",i,r,n)}openFile(i,r,n){return this.rpc("openFile",i,r,n)}createFile(i,r,n,s){return this.rpc("createFile",i,r,n,s)}unlink(i,r){return this.rpc("unlink",i,r)}rmdir(i,r){return this.rpc("rmdir",i,r)}mkdir(i,r,n){return this.rpc("mkdir",i,r,n)}readdir(i,r){return this.rpc("readdir",i,r)}exists(i,r){return this.rpc("exists",i,r)}link(i,r,n){return this.rpc("link",i,r,n)}},ra=0,Rr=new Map;async function na(t,e,i){if(!Ui(i))return;let{method:r,args:n,id:s,scope:a,stack:l}=i,c,u=!1;try{switch(a){case"fs":c=await e[r](...n),c instanceof vt&&(Rr.set(++ra,c),c={fd:ra,path:c.path,position:c.position});break;case"file":let{fd:d}=i;if(!Rr.has(d))throw new f(9);c=await Rr.get(d)[r](...n),r=="close"&&Rr.delete(d);break;default:return}}catch(d){c=d,u=!0}t.postMessage({_zenfs:!0,scope:a,id:s,error:u,method:r,stack:l,value:c instanceof f?c.toJSON():c})}o(na,"handleRequest");function Ud(t,e){ei(t,i=>na(t,e,i))}o(Ud,"attachFS");function qd(t,e){Ar(t,i=>na(t,e,i))}o(qd,"detachFS");var jd={name:"Port",options:{port:{type:"object",required:!0,description:"The target port that you want to connect to",validator:o(function(t){if(typeof t?.postMessage!="function")throw new f(22,"option must be a port.")},"validator")},timeout:{type:"number",required:!1,description:"How long to wait before the request times out"}},isAvailable:o(async function(t){return!0},"isAvailable"),create:o(function(t){return new Or(t)},"create")};var Kn=class{constructor(e){this.limit=e;this.cache=[]}static{o(this,"LRUCache")}set(e,i){let r=this.cache.findIndex(n=>n.key===e);r!=-1?this.cache.splice(r,1):this.cache.length>=this.limit&&this.cache.shift(),this.cache.push({key:e,value:i})}get(e){let i=this.cache.find(r=>r.key===e);if(i)return this.set(e,i.value),i.value}remove(e){let i=this.cache.findIndex(r=>r.key===e);i!==-1&&this.cache.splice(i,1)}reset(){this.cache=[]}},ji=class extends Di(Z){constructor(i){super();this._options=i;this._initialized=!1;this._sync=Tt.create({name:"test"})}static{o(this,"AsyncStoreFS")}get store(){if(!this._store)throw new f(61,"No store attached");return this._store}async ready(){return this._initialized?this:(this._initialized=!0,this._options.lruCacheSize&&(this._cache=new Kn(this._options.lruCacheSize)),this._store=await this._options.store,this._sync=this._options.sync||this._sync,await this.makeRootDirectory(),await super.ready(),this)}metadata(){return{...super.metadata(),name:this.store.name}}async empty(){this._cache&&this._cache.reset(),await this.store.clear(),await this.makeRootDirectory()}async rename(i,r,n){await this.queueDone();let s=this._cache;this._cache&&(delete this._cache,s?.reset());try{let a=this.store.beginTransaction(),l=k(i),c=O(i),u=k(r),d=O(r),h=await this.findINode(a,l),b=await this.getDirListing(a,h,l);if(!h.toStats().hasAccess(2,n))throw f.With("EACCES",i,"rename");if(!b[c])throw f.With("ENOENT",i,"rename");let m=b[c];if(delete b[c],(u+"/").indexOf(i+"/")===0)throw new f(16,l);let w,g;if(u===l?(w=h,g=b):(w=await this.findINode(a,u),g=await this.getDirListing(a,w,u)),g[d]){let v=await this.getINode(a,g[d],r);if(v.toStats().isFile())try{await a.remove(v.ino),await a.remove(g[d])}catch(S){throw await a.abort(),S}else throw f.With("EPERM",r,"rename")}g[d]=m;try{await a.put(h.ino,ue(b),!0),await a.put(w.ino,ue(g),!0)}catch(v){throw await a.abort(),v}await a.commit()}finally{s&&(this._cache=s)}}async stat(i,r){await this.queueDone();let n=this.store.beginTransaction(),s=await this.findINode(n,i);if(!s)throw f.With("ENOENT",i,"stat");let a=s.toStats();if(!a.hasAccess(4,r))throw f.With("EACCES",i,"stat");return a}async createFile(i,r,n,s){await this.queueDone();let a=this.store.beginTransaction(),l=new Uint8Array(0),c=await this.commitNewFile(a,i,j.FILE,n,s,l);return new ae(this,i,r,c.toStats(),l)}async openFile(i,r,n){await this.queueDone();let s=this.store.beginTransaction(),a=await this.findINode(s,i),l=await s.get(a.ino);if(!a.toStats().hasAccess(lt(r),n))throw f.With("EACCES",i,"openFile");if(!l)throw f.With("ENOENT",i,"openFile");return new ae(this,i,r,a.toStats(),l)}async unlink(i,r){return await this.queueDone(),this.removeEntry(i,!1,r)}async rmdir(i,r){if(await this.queueDone(),(await this.readdir(i,r)).length>0)throw f.With("ENOTEMPTY",i,"rmdir");await this.removeEntry(i,!0,r)}async mkdir(i,r,n){await this.queueDone();let s=this.store.beginTransaction(),a=We("{}");await this.commitNewFile(s,i,j.DIRECTORY,r,n,a)}async readdir(i,r){await this.queueDone();let n=this.store.beginTransaction(),s=await this.findINode(n,i);if(!s.toStats().hasAccess(4,r))throw f.With("EACCES",i,"readdur");return Object.keys(await this.getDirListing(n,s,i))}async sync(i,r,n){await this.queueDone();let s=this.store.beginTransaction(),a=await this._findINode(s,k(i),O(i)),l=await this.getINode(s,a,i),c=l.update(n);try{await s.put(l.ino,r,!0),c&&await s.put(a,l.data,!0)}catch(u){throw await s.abort(),u}await s.commit()}async link(i,r,n){await this.queueDone();let s=this.store.beginTransaction(),a=k(i);if(!(await this.findINode(s,a)).toStats().hasAccess(4,n))throw f.With("EACCES",a,"link");let c=k(r),u=await this.findINode(s,c),d=await this.getDirListing(s,u,c);if(!u.toStats().hasAccess(2,n))throw f.With("EACCES",c,"link");let h=await this._findINode(s,a,O(i)),b=await this.getINode(s,h,i);if(!b.toStats().hasAccess(2,n))throw f.With("EACCES",r,"link");b.nlink++,d[O(r)]=h;try{s.put(h,b.data,!0),s.put(u.ino,ue(d),!0)}catch(m){throw s.abort(),m}s.commit()}async makeRootDirectory(){let i=this.store.beginTransaction();if(!await i.get(ye)){let r=new Fe;r.mode=511|j.DIRECTORY,await i.put(r.ino,We("{}"),!1),await i.put(ye,r.data,!1),await i.commit()}}async _findINode(i,r,n,s=new Set){let a=N(r,n);if(s.has(a))throw new f(5,"Infinite loop detected while finding inode",a);if(s.add(a),this._cache){let l=this._cache.get(a);if(l)return l}if(r==="/"){if(n==="")return this._cache&&this._cache.set(a,ye),ye;{let l=await this.getINode(i,ye,r),c=await this.getDirListing(i,l,r);if(c[n]){let u=c[n];return this._cache&&this._cache.set(a,u),u}else throw f.With("ENOENT",xe(r,n),"_findINode")}}else{let l=await this.findINode(i,r,s),c=await this.getDirListing(i,l,r);if(c[n]){let u=c[n];return this._cache&&this._cache.set(a,u),u}else throw f.With("ENOENT",xe(r,n),"_findINode")}}async findINode(i,r,n=new Set){let s=await this._findINode(i,k(r),O(r),n);return this.getINode(i,s,r)}async getINode(i,r,n){let s=await i.get(r);if(!s)throw f.With("ENOENT",n,"getINode");return new Fe(s.buffer)}async getDirListing(i,r,n){if(!r.toStats().isDirectory())throw f.With("ENOTDIR",n,"getDirListing");let s=await i.get(r.ino);if(!s)throw f.With("ENOENT",n,"getDirListing");return Bi(s)}async addNewNode(i,r,n=5){if(n<=0)throw new f(5,"Unable to commit data to key-value store.");let s=Qt();return await i.put(s,r,!1)?s:await this.addNewNode(i,r,--n)}async commitNewFile(i,r,n,s,a,l){let c=k(r),u=O(r),d=await this.findINode(i,c),h=await this.getDirListing(i,d,c);if(!d.toStats().hasAccess(2,a))throw f.With("EACCES",r,"commitNewFile");if(r==="/")throw f.With("EEXIST",r,"commitNewFile");if(h[u])throw await i.abort(),f.With("EEXIST",r,"commitNewFile");try{let b=new Fe;return b.ino=await this.addNewNode(i,l),b.mode=s|n,b.uid=a.uid,b.gid=a.gid,b.size=l.length,h[u]=await this.addNewNode(i,b.data),await i.put(d.ino,ue(h),!0),await i.commit(),b}catch(b){throw i.abort(),b}}async removeEntry(i,r,n){this._cache&&this._cache.remove(i);let s=this.store.beginTransaction(),a=k(i),l=await this.findINode(s,a),c=await this.getDirListing(s,l,a),u=O(i);if(!c[u])throw f.With("ENOENT",i,"removeEntry");let d=c[u],h=await this.getINode(s,d,i);if(!h.toStats().hasAccess(2,n))throw f.With("EACCES",i,"removeEntry");if(delete c[u],!r&&h.toStats().isDirectory())throw f.With("EISDIR",i,"removeEntry");if(r&&!h.toStats().isDirectory())throw f.With("ENOTDIR",i,"removeEntry");try{await s.put(l.ino,ue(c),!0),--h.nlink<1&&(await s.remove(h.ino),await s.remove(d))}catch(b){throw await s.abort(),b}await s.commit()}};var Lr=class{constructor(e,i="port"){this.options=e;this.name=i;this.port=e.port,ei(this.port,Tr)}static{o(this,"PortStore")}clear(){return At({scope:"store",method:"clear",args:[]},this.options)}beginTransaction(){let e=At({scope:"store",method:"beginTransaction",args:[]},this.options);return new Nr(this,e)}},Nr=class{constructor(e,i){this.store=e;this.id=i}static{o(this,"PortTransaction")}async rpc(e,...i){return At({scope:"transaction",tx:await this.id,method:e,args:i},this.store.options)}get(e){return this.rpc("get",e)}async put(e,i,r){return await this.rpc("put",e,i,r)}async remove(e){return await this.rpc("remove",e)}async commit(){return await this.rpc("commit")}async abort(){return await this.rpc("abort")}},oa=0,Cr=new Map;async function sa(t,e,i){if(!Ui(i))return;let{method:r,args:n,id:s,scope:a,stack:l}=i,c,u=!1;try{switch(a){case"store":c=await e[r](...n),r=="beginTransaction"&&(Cr.set(++oa,c),c=oa);break;case"transaction":let{tx:d}=i;if(!Cr.has(d))throw new f(9);c=await Cr.get(d)[r](...n),r=="close"&&Cr.delete(d);break;default:return}}catch(d){c=d,u=!0}t.postMessage({_zenfs:!0,scope:a,id:s,error:u,method:r,stack:l,value:c instanceof f?c.toJSON():c})}o(sa,"handleRequest");function $d(t,e){ei(t,i=>sa(t,e,i))}o($d,"attachStore");function Vd(t,e){Ar(t,i=>sa(t,e,i))}o(Vd,"detachStore");var zd={name:"PortStore",options:{port:{type:"object",description:"The target port that you want to connect to",validator:o(function(t){if(typeof t?.postMessage!="function")throw new f(22,"option must be a port.")},"validator")}},isAvailable:o(async function(){if("WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope)return!0;try{return"Worker"in await import("node:worker_threads")}catch{return!1}},"isAvailable"),create:o(function(t){return new ji({...t,store:new Lr(t,t?.name)})},"create")};var Rt=class t{constructor(){this._index=new Map;this.add("/",new ft)}static{o(this,"FileIndex")}static FromListing(e){let i=new t,r=new ft;i._index.set("/",r);let n=[{pwd:"",tree:e,parent:r}];for(;n.length>0;){let s,{tree:a,pwd:l,parent:c}=n.pop();for(let u in a){if(!Object.hasOwn(a,u))continue;let d=a[u];if(d){let h=l+"/"+u;s=new ft,i._index.set(h,s),n.push({pwd:h,tree:d,parent:s})}else s=new Dr(new D({mode:j.FILE|365}));c&&c._listing.set(u,s)}}return i}files(){let e=[];for(let i of this._index.values())for(let r of i.listing){let n=i.get(r);n&&n.isFile()&&e.push(n)}return e}add(e,i){if(!i)throw new f(22,"Inode must be specified",e,"FileIndex.add");if(!e.startsWith("/"))throw new f(22,"Path not absolute",e,"FileIndex.add");if(this._index.has(e))return this._index.get(e)===i;let r=k(e),n=this._index.has(r),s=n?this._index.get(r):new ft;return!n&&e!="/"&&!this.add(r,s)||e!="/"&&!s.add(O(e),i)?!1:(i.isDirectory()&&this._index.set(e,i),!0)}addFast(e,i){let r=k(e),n=O(e),s=this._index.get(r);return s||(s=new ft,this.addFast(r,s)),s.add(n,i)?(i.isDirectory()&&this._index.set(e,i),!0):!1}remove(e){let i=k(e),r=this._index.get(i);if(!r)return;let n=r.remove(O(e));if(!n)return;if(!n.isDirectory())return n;let s=n.listing;for(let a of s)this.remove(N(e,a));e!="/"&&this._index.delete(e)}ls(e){return this._index.get(e)?.listing}get(e){let i=k(e),r=this._index.get(i);return i==e?r:r?.get(O(e))}},$i=class{constructor(e){this.data=e}static{o(this,"IndexInode")}},Dr=class extends $i{static{o(this,"IndexFileInode")}isFile(){return!0}isDirectory(){return!1}toStats(){return new D({mode:j.FILE|438,size:4096})}},ft=class extends $i{constructor(){super(...arguments);this._listing=new Map}static{o(this,"IndexDirInode")}isFile(){return!1}isDirectory(){return!0}get stats(){return new D({mode:j.DIRECTORY|365,size:4096})}toStats(){return this.stats}get listing(){return[...this._listing.keys()]}get(i){return this._listing.get(i)}add(i,r){return this._listing.has(i)?!1:(this._listing.set(i,r),!0)}remove(i){let r=this._listing.get(i);if(r)return this._listing.delete(i),r}},Vi=class extends Yn(Z){static{o(this,"IndexFS")}constructor(e){super(),this._index=Rt.FromListing(e)}async stat(e){let i=this._index.get(e);if(!i)throw f.With("ENOENT",e,"stat");if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInode(i,e);throw new f(22,"Invalid inode.")}statSync(e){let i=this._index.get(e);if(!i)throw f.With("ENOENT",e,"stat");if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInodeSync(i,e);throw new f(22,"Invalid inode.")}async openFile(e,i,r){if(me(i))throw new f(1,e);let n=this._index.get(e);if(!n)throw f.With("ENOENT",e,"openFile");if(!n.toStats().hasAccess(lt(i),r))throw f.With("EACCES",e,"openFile");if(n.isDirectory()){let s=n.stats;return new Je(this,e,i,s,s.fileData)}return this.openFileInode(n,e,i)}openFileSync(e,i,r){if(me(i))throw new f(1,e);let n=this._index.get(e);if(!n)throw f.With("ENOENT",e,"openFile");if(!n.toStats().hasAccess(lt(i),r))throw f.With("EACCES",e,"openFile");if(n.isDirectory()){let s=n.stats;return new Je(this,e,i,s,s.fileData)}return this.openFileInodeSync(n,e,i)}async readdir(e){let i=this._index.get(e);if(!i)throw f.With("ENOENT",e,"readdir");if(i.isDirectory())return i.listing;throw f.With("ENOTDIR",e,"readdir")}readdirSync(e){let i=this._index.get(e);if(!i)throw f.With("ENOENT",e,"readdir");if(i.isDirectory())return i.listing;throw f.With("ENOTDIR",e,"readdir")}},Xn=class extends Vi{static{o(this,"SyncIndexFS")}async statFileInode(e,i){return this.statFileInodeSync(e,i)}async openFileInode(e,i,r){return this.openFileInodeSync(e,i,r)}},zi=class extends Vi{static{o(this,"AsyncIndexFS")}statFileInodeSync(e,i){throw f.With("ENOSYS",i,"AsyncIndexFS.statFileInodeSync")}openFileInodeSync(e,i,r){throw f.With("ENOSYS",i,"AsyncIndexFS.openFileInodeSync")}};function Br(t){throw new f(5,t.message)}o(Br,"convertError");async function Hd(t,e){let i=await fetch(t).catch(Br);if(!i.ok)throw new f(5,"fetch failed: response returned code "+i.status);switch(e){case"buffer":let r=await i.arrayBuffer().catch(Br);return new Uint8Array(r);case"json":return i.json().catch(Br);default:throw new f(22,"Invalid download type: "+e)}}o(Hd,"fetchFile");async function Yd(t){let e=await fetch(t,{method:"HEAD"}).catch(Br);if(!e.ok)throw new f(5,"fetch failed: HEAD response returned code "+e.status);return parseInt(e.headers.get("Content-Length")||"-1",10)}o(Yd,"fetchSize");var Mr=class t extends zi{static{o(this,"FetchFS")}async _initialize(e){if(typeof e!="string"){this._index=Rt.FromListing(e);return}try{let i=await fetch(e);this._index=Rt.FromListing(await i.json())}catch{throw new f(22,"Invalid or unavailable file listing tree")}}async ready(){return await this._init,this}constructor({index:e="index.json",baseUrl:i=""}){super({}),i.at(-1)!="/"&&(i+="/"),this.prefixUrl=i,this._init=this._initialize(e)}metadata(){return{...super.metadata(),name:t.name,readonly:!0}}empty(){for(let e of this._index.files())delete e.data.fileData}preloadFile(e,i){let r=this._index.get(e);if(!r)throw f.With("ENOENT",e,"preloadFile");if(!r.isFile())throw f.With("EISDIR",e,"preloadFile");let n=r.data;n.size=i.length,n.fileData=i}async statFileInode(e,i){let r=e.data;return r.size<0&&(r.size=await this._fetchSize(i)),r}async openFileInode(e,i,r){let n=e.data;if(n.fileData)return new Je(this,i,r,new D(n),n.fileData);let s=await this._fetchFile(i,"buffer");return n.size=s.length,n.fileData=s,new Je(this,i,r,new D(n),s)}_getRemotePath(e){return e.charAt(0)==="/"&&(e=e.slice(1)),this.prefixUrl+e}_fetchFile(e,i){return Hd(this._getRemotePath(e),i)}_fetchSize(e){return Yd(this._getRemotePath(e))}},Gd={name:"Fetch",options:{index:{type:["string","object"],required:!1,description:"URL to a file index as a JSON file or the file index object itself, generated with the make_http_index script. Defaults to `index.json`."},baseUrl:{type:"string",required:!1,description:"Used as the URL prefix for fetched files. Default: Fetch files relative to the index."}},isAvailable:o(function(){return typeof globalThis.fetch=="function"},"isAvailable"),create:o(function(t){return new Mr(t)},"create")};var Hi=class{constructor(){this._locks=new Map}static{o(this,"Mutex")}lock(e){return new Promise(i=>{this._locks.has(e)?this._locks.get(e).push(i):this._locks.set(e,[i])})}unlock(e){if(!this._locks.has(e))throw new f(1,"Can not unlock an already unlocked path",e);let i=this._locks.get(e)?.shift();if(i){setTimeout(i,0);return}this._locks.delete(e)}tryLock(e){return this._locks.has(e)?!1:(this._locks.set(e,[]),!0)}isLocked(e){return this._locks.has(e)}};var Yi=class{constructor(e){this.fs=e;this._mu=new Hi}static{o(this,"LockedFS")}async ready(){return await this.fs.ready(),this}metadata(){return{...this.fs.metadata(),name:"Locked<"+this.fs.metadata().name+">"}}async rename(e,i,r){await this._mu.lock(e),await this.fs.rename(e,i,r),this._mu.unlock(e)}renameSync(e,i,r){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"rename");return this.fs.renameSync(e,i,r)}async stat(e,i){await this._mu.lock(e);let r=await this.fs.stat(e,i);return this._mu.unlock(e),r}statSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"stat");return this.fs.statSync(e,i)}async openFile(e,i,r){await this._mu.lock(e);let n=await this.fs.openFile(e,i,r);return this._mu.unlock(e),n}openFileSync(e,i,r){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"openFile");return this.fs.openFileSync(e,i,r)}async createFile(e,i,r,n){await this._mu.lock(e);let s=await this.fs.createFile(e,i,r,n);return this._mu.unlock(e),s}createFileSync(e,i,r,n){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"createFile");return this.fs.createFileSync(e,i,r,n)}async unlink(e,i){await this._mu.lock(e),await this.fs.unlink(e,i),this._mu.unlock(e)}unlinkSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"unlink");return this.fs.unlinkSync(e,i)}async rmdir(e,i){await this._mu.lock(e),await this.fs.rmdir(e,i),this._mu.unlock(e)}rmdirSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"rmdir");return this.fs.rmdirSync(e,i)}async mkdir(e,i,r){await this._mu.lock(e),await this.fs.mkdir(e,i,r),this._mu.unlock(e)}mkdirSync(e,i,r){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"mkdir");return this.fs.mkdirSync(e,i,r)}async readdir(e,i){await this._mu.lock(e);let r=await this.fs.readdir(e,i);return this._mu.unlock(e),r}readdirSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"readdir");return this.fs.readdirSync(e,i)}async exists(e,i){await this._mu.lock(e);let r=await this.fs.exists(e,i);return this._mu.unlock(e),r}existsSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"exists");return this.fs.existsSync(e,i)}async link(e,i,r){await this._mu.lock(e),await this.fs.link(e,i,r),this._mu.unlock(e)}linkSync(e,i,r){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"link");return this.fs.linkSync(e,i,r)}async sync(e,i,r){await this._mu.lock(e),await this.fs.sync(e,i,r),this._mu.unlock(e)}syncSync(e,i,r){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"sync");return this.fs.syncSync(e,i,r)}};var Jn="/.deleted",Wr=class extends Z{constructor({writable:i,readable:r}){super();this._isInitialized=!1;this._deletedFiles=new Set;this._deleteLog="";this._deleteLogUpdatePending=!1;this._deleteLogUpdateNeeded=!1;if(this._writable=i,this._readable=r,this._writable.metadata().readonly)throw new f(22,"Writable file system must be writable.");this._ready=this._initialize()}static{o(this,"UnlockedOverlayFS")}async ready(){return await this._readable.ready(),await this._writable.ready(),await this._ready,this}metadata(){return{...super.metadata(),name:Gi.name}}getOverlayedFileSystems(){return{readable:this._readable,writable:this._writable}}async sync(i,r,n){let s=n.cred(0,0);await this.createParentDirectories(i,s),await this._writable.sync(i,r,n)}syncSync(i,r,n){let s=n.cred(0,0);this.createParentDirectoriesSync(i,s),this._writable.syncSync(i,r,n)}async _initialize(){if(!this._isInitialized){try{let i=await this._writable.openFile(Jn,B("r"),Re),{size:r}=await i.stat(),{buffer:n}=await i.read(new Uint8Array(r));this._deleteLog=vr(n)}catch(i){if(i.errno!==2)throw i}this._isInitialized=!0,this._reparseDeletionLog()}}getDeletionLog(){return this._deleteLog}restoreDeletionLog(i,r){this._deleteLog=i,this._reparseDeletionLog(),this.updateLog("",r)}async rename(i,r,n){this.checkInitialized(),this.checkPath(i),this.checkPath(r);try{await this._writable.rename(i,r,n)}catch{if(this._deletedFiles.has(i))throw f.With("ENOENT",i,"rename")}}renameSync(i,r,n){this.checkInitialized(),this.checkPath(i),this.checkPath(r);try{this._writable.renameSync(i,r,n)}catch{if(this._deletedFiles.has(i))throw f.With("ENOENT",i,"rename")}}async stat(i,r){this.checkInitialized();try{return this._writable.stat(i,r)}catch{if(this._deletedFiles.has(i))throw f.With("ENOENT",i,"stat");let s=new D(await this._readable.stat(i,r));return s.mode|=146,s}}statSync(i,r){this.checkInitialized();try{return this._writable.statSync(i,r)}catch{if(this._deletedFiles.has(i))throw f.With("ENOENT",i,"stat");let s=new D(this._readable.statSync(i,r));return s.mode|=146,s}}async openFile(i,r,n){if(await this._writable.exists(i,n))return this._writable.openFile(i,r,n);let s=await this._readable.openFile(i,B("r"),n),a=new D(await s.stat()),{buffer:l}=await s.read(new Uint8Array(a.size));return new ae(this,i,r,a,l)}openFileSync(i,r,n){if(this._writable.existsSync(i,n))return this._writable.openFileSync(i,r,n);let s=this._readable.openFileSync(i,B("r"),n),a=D.clone(s.statSync()),l=new Uint8Array(a.size);return s.readSync(l),new ae(this,i,r,a,l)}async createFile(i,r,n,s){return this.checkInitialized(),await this._writable.createFile(i,r,n,s),this.openFile(i,r,s)}createFileSync(i,r,n,s){return this.checkInitialized(),this._writable.createFileSync(i,r,n,s),this.openFileSync(i,r,s)}async link(i,r,n){this.checkInitialized(),await this._writable.link(i,r,n)}linkSync(i,r,n){this.checkInitialized(),this._writable.linkSync(i,r,n)}async unlink(i,r){if(this.checkInitialized(),this.checkPath(i),!await this.exists(i,r))throw f.With("ENOENT",i,"unlink");await this._writable.exists(i,r)&&await this._writable.unlink(i,r),await this.exists(i,r)&&this.deletePath(i,r)}unlinkSync(i,r){if(this.checkInitialized(),this.checkPath(i),!this.existsSync(i,r))throw f.With("ENOENT",i,"unlink");this._writable.existsSync(i,r)&&this._writable.unlinkSync(i,r),this.existsSync(i,r)&&this.deletePath(i,r)}async rmdir(i,r){if(this.checkInitialized(),!await this.exists(i,r))throw f.With("ENOENT",i,"rmdir");if(await this._writable.exists(i,r)&&await this._writable.rmdir(i,r),await this.exists(i,r)){if((await this.readdir(i,r)).length>0)throw f.With("ENOTEMPTY",i,"rmdir");this.deletePath(i,r)}}rmdirSync(i,r){if(this.checkInitialized(),!this.existsSync(i,r))throw f.With("ENOENT",i,"rmdir");if(this._writable.existsSync(i,r)&&this._writable.rmdirSync(i,r),this.existsSync(i,r)){if(this.readdirSync(i,r).length>0)throw f.With("ENOTEMPTY",i,"rmdir");this.deletePath(i,r)}}async mkdir(i,r,n){if(this.checkInitialized(),await this.exists(i,n))throw f.With("EEXIST",i,"mkdir");await this.createParentDirectories(i,n),await this._writable.mkdir(i,r,n)}mkdirSync(i,r,n){if(this.checkInitialized(),this.existsSync(i,n))throw f.With("EEXIST",i,"mkdir");this.createParentDirectoriesSync(i,n),this._writable.mkdirSync(i,r,n)}async readdir(i,r){if(this.checkInitialized(),!(await this.stat(i,r)).isDirectory())throw f.With("ENOTDIR",i,"readdir");let s=[];try{s.push(...await this._writable.readdir(i,r))}catch{}try{s.push(...(await this._readable.readdir(i,r)).filter(l=>!this._deletedFiles.has(`${i}/${l}`)))}catch{}let a={};return s.filter(l=>{let c=!a[l];return a[l]=!0,c})}readdirSync(i,r){if(this.checkInitialized(),!this.statSync(i,r).isDirectory())throw f.With("ENOTDIR",i,"readdir");let s=[];try{s=s.concat(this._writable.readdirSync(i,r))}catch{}try{s=s.concat(this._readable.readdirSync(i,r).filter(l=>!this._deletedFiles.has(`${i}/${l}`)))}catch{}let a={};return s.filter(l=>{let c=!a[l];return a[l]=!0,c})}deletePath(i,r){this._deletedFiles.add(i),this.updateLog(`d${i}
3
- `,r)}async updateLog(i,r){if(this._deleteLog+=i,this._deleteLogUpdatePending){this._deleteLogUpdateNeeded=!0;return}this._deleteLogUpdatePending=!0;let n=await this._writable.openFile(Jn,B("w"),r);try{await n.write(We(this._deleteLog)),this._deleteLogUpdateNeeded&&(this._deleteLogUpdateNeeded=!1,this.updateLog("",r))}catch(s){this._deleteLogError=s}finally{this._deleteLogUpdatePending=!1}}_reparseDeletionLog(){this._deletedFiles.clear();for(let i of this._deleteLog.split(`
4
- `))i.startsWith("d")&&this._deletedFiles.add(i.slice(1))}checkInitialized(){if(!this._isInitialized)throw new f(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(!this._deleteLogError)return;let i=this._deleteLogError;throw delete this._deleteLogError,i}checkPath(i){if(i==Jn)throw f.With("EPERM",i,"checkPath")}createParentDirectoriesSync(i,r){let n=k(i),s=[];for(;!this._writable.existsSync(n,r);)s.push(n),n=k(n);s=s.reverse();for(let a of s)this._writable.mkdirSync(a,this.statSync(a,r).mode,r)}async createParentDirectories(i,r){let n=k(i),s=[];for(;!await this._writable.exists(n,r);)s.push(n),n=k(n);s=s.reverse();for(let a of s){let l=await this.stat(a,r);await this._writable.mkdir(a,l.mode,r)}}operateOnWritable(i,r){if(!this.existsSync(i,r))throw f.With("ENOENT",i,"operateOnWriteable");this._writable.existsSync(i,r)||this.copyToWritableSync(i,r)}async operateOnWritableAsync(i,r){if(!await this.exists(i,r))throw f.With("ENOENT",i,"operateOnWritable");if(!await this._writable.exists(i,r))return this.copyToWritable(i,r)}copyToWritableSync(i,r){let n=this.statSync(i,r);if(n.isDirectory()){this._writable.mkdirSync(i,n.mode,r);return}let s=new Uint8Array(n.size),a=this._readable.openFileSync(i,B("r"),r);a.readSync(s),a.closeSync();let l=this._writable.openFileSync(i,B("w"),r);l.writeSync(s),l.closeSync()}async copyToWritable(i,r){let n=await this.stat(i,r);if(n.isDirectory()){await this._writable.mkdir(i,n.mode,r);return}let s=new Uint8Array(n.size),a=await this._readable.openFile(i,B("r"),r);await a.read(s),await a.close();let l=await this._writable.openFile(i,B("w"),r);await l.write(s),await l.close()}},Gi=class extends Yi{static{o(this,"OverlayFS")}async ready(){return await super.ready(),this}constructor(e){super(new Wr(e))}getOverlayedFileSystems(){return super.fs.getOverlayedFileSystems()}getDeletionLog(){return super.fs.getDeletionLog()}resDeletionLog(){return super.fs.getDeletionLog()}unwrap(){return super.fs}},Kd={name:"Overlay",options:{writable:{type:"object",required:!0,description:"The file system to write modified files to."},readable:{type:"object",required:!0,description:"The file system that initially populates this file system."}},isAvailable:o(function(){return!0},"isAvailable"),create:o(function(t){return new Gi(t)},"create")};function Ki(t){return t!=null&&typeof t=="object"&&"isAvailable"in t&&typeof t.isAvailable=="function"&&"create"in t&&typeof t.create=="function"}o(Ki,"isBackend");async function Ur(t,e){if(typeof e!="object"||e===null)throw new f(22,"Invalid options");for(let[i,r]of Object.entries(t.options)){let n=e?.[i];if(n==null){if(!r.required)continue;let a=Object.keys(e).filter(l=>!(l in t.options)).map(l=>({str:l,distance:Gn(i,l)})).filter(l=>l.distance<5).sort((l,c)=>l.distance-c.distance);throw new f(22,`${t.name}: Required option '${i}' not provided.${a.length>0?` You provided '${a[0].str}', did you mean '${i}'.`:""}`)}if(!(Array.isArray(r.type)?r.type.indexOf(typeof n)!=-1:typeof n==r.type))throw new f(22,`${t.name}: Value provided for option ${i} is not the proper type. Expected ${Array.isArray(r.type)?`one of {${r.type.join(", ")}}`:r.type}, but received ${typeof n}`);r.validator&&await r.validator(n)}}o(Ur,"checkOptions");async function Xd(t,e={}){return await Ur(t,e),t.create(e).ready()}o(Xd,"createBackend");function Qn(t){return t!=null&&typeof t=="object"&&"backend"in t&&Ki(t.backend)}o(Qn,"isBackendConfig");var Sr={};_r(Sr,{BigIntStats:()=>re,Dir:()=>pt,Dirent:()=>ht,ReadStream:()=>wt,Stats:()=>D,StatsFs:()=>Oi,WriteStream:()=>St,access:()=>Uu,accessSync:()=>za,appendFile:()=>mu,appendFileSync:()=>Oa,chmod:()=>Nu,chmodSync:()=>ja,chown:()=>Cu,chownSync:()=>Ua,close:()=>gu,closeSync:()=>Ze,constants:()=>It,copyFile:()=>Gu,copyFileSync:()=>mo,cp:()=>Qu,cpSync:()=>bo,createReadStream:()=>Vu,createWriteStream:()=>zu,exists:()=>lu,existsSync:()=>si,fchmod:()=>Fu,fchmodSync:()=>Gr,fchown:()=>ku,fchownSync:()=>Yr,fdatasync:()=>_u,fdatasyncSync:()=>Na,fstat:()=>bu,fstatSync:()=>Ca,fsync:()=>Su,fsyncSync:()=>La,ftruncate:()=>wu,ftruncateSync:()=>fo,futimes:()=>Iu,futimesSync:()=>Kr,lchmod:()=>Du,lchmodSync:()=>$a,lchown:()=>Lu,lchownSync:()=>qa,link:()=>Au,linkSync:()=>Ma,lopenSync:()=>tr,lstat:()=>fu,lstatSync:()=>co,lutimes:()=>Mu,lutimesSync:()=>Va,mkdir:()=>Pu,mkdirSync:()=>Xr,mkdtemp:()=>Yu,mkdtempSync:()=>Ha,mount:()=>Qi,mountObject:()=>Zi,mounts:()=>Se,open:()=>hu,openAsBlob:()=>ed,openSync:()=>li,opendir:()=>Ju,opendirSync:()=>Ka,promises:()=>wr,read:()=>xu,readFile:()=>pu,readFileSync:()=>Hr,readSync:()=>Ba,readdir:()=>Tu,readdirSync:()=>ci,readlink:()=>Ou,readlinkSync:()=>ho,readv:()=>Ku,readvSync:()=>Ya,realpath:()=>Wu,realpathSync:()=>oi,rename:()=>au,renameSync:()=>Ta,rm:()=>Hu,rmSync:()=>yo,rmdir:()=>vu,rmdirSync:()=>uo,stat:()=>cu,statSync:()=>er,statfs:()=>Zu,statfsSync:()=>Xa,symlink:()=>Ru,symlinkSync:()=>Wa,truncate:()=>uu,truncateSync:()=>Aa,umount:()=>Vr,unlink:()=>du,unlinkSync:()=>zr,unwatchFile:()=>ju,utimes:()=>Bu,utimesSync:()=>po,watch:()=>$u,watchFile:()=>qu,write:()=>Eu,writeFile:()=>yu,writeFileSync:()=>ir,writeSync:()=>Da,writev:()=>Xu,writevSync:()=>Ga});var wr={};_r(wr,{FileHandle:()=>ie,access:()=>js,appendFile:()=>Ls,chmod:()=>Ws,chown:()=>Bs,constants:()=>It,copyFile:()=>Mn,cp:()=>Wn,exists:()=>Ae,lchmod:()=>Us,lchown:()=>Ms,link:()=>Ns,lstat:()=>Cn,lutimes:()=>qs,mkdir:()=>gr,mkdtemp:()=>$s,open:()=>he,opendir:()=>Vs,readFile:()=>br,readdir:()=>Nt,readlink:()=>Nn,realpath:()=>Te,rename:()=>Os,rm:()=>Bn,rmdir:()=>Ln,stat:()=>Fi,statfs:()=>zs,symlink:()=>Ds,truncate:()=>Cs,unlink:()=>mr,utimes:()=>Dn,watch:()=>iw,writeFile:()=>vi});var Gt=Er(Ie(),1);var dt=Er(Ie(),1);var F=Re;function Pa(t){F=t}o(Pa,"setCred");var Lt=new Map,Th=100;function Ji(t){let e=Th++;return Lt.set(e,t),e}o(Ji,"file2fd");function M(t){if(!Lt.has(t))throw new f(9);return Lt.get(t)}o(M,"fd2file");var Se=new Map;Qi("/",Tt.create({name:"root"}));function Qi(t,e){if(t[0]!=="/"&&(t="/"+t),t=xe(t),Se.has(t))throw new f(22,"Mount point "+t+" is already in use.");Se.set(t,e)}o(Qi,"mount");function Vr(t){if(t[0]!=="/"&&(t=`/${t}`),t=xe(t),!Se.has(t))throw new f(22,"Mount point "+t+" is already unmounted.");Se.delete(t)}o(Vr,"umount");function H(t){t=x(t);let e=[...Se].sort((i,r)=>i[0].length>r[0].length?-1:1);for(let[i,r]of e)if(i.length<=t.length&&t.startsWith(i))return t=t.slice(i.length>1?i.length:0),t===""&&(t="/"),{fs:r,path:t,mountPoint:i};throw new f(5,"ZenFS not initialized with a file system")}o(H,"resolveMount");function va(t,e){for(let[i,r]of Object.entries(e))t=t?.replaceAll(i,r);return t}o(va,"fixPaths");function ce(t,e){return typeof t.stack=="string"&&(t.stack=va(t.stack,e)),t.message=va(t.message,e),t}o(ce,"fixError");function Zi(t){"/"in t&&Vr("/");for(let[e,i]of Object.entries(t))Qi(e,i)}o(Zi,"mountObject");function de(...[t,e,i,...r]){i=x(i);let{fs:n,path:s}=H(e&&si(i)?oi(i):i);try{return n[t](s,...r)}catch(a){throw ce(a,{[s]:i})}}o(de,"doOp");function Ta(t,e){t=x(t),e=x(e);let i=H(t),r=H(e),n={[i.path]:t,[r.path]:e};try{if(i===r)return i.fs.renameSync(i.path,r.path,F);ir(e,Hr(t)),zr(t)}catch(s){throw ce(s,n)}}o(Ta,"renameSync");function si(t){t=x(t);try{let{fs:e,path:i}=H(oi(t));return e.existsSync(i,F)}catch(e){if(e.errno==2)return!1;throw e}}o(si,"existsSync");function er(t,e){let i=de("statSync",!0,t.toString(),F);return e?.bigint?new re(i):i}o(er,"statSync");function co(t,e){let i=de("statSync",!1,t.toString(),F);return e?.bigint?new re(i):i}o(co,"lstatSync");function Aa(t,e=0){let i=li(t,"r+");try{fo(i,e)}finally{Ze(i)}}o(Aa,"truncateSync");function zr(t){return de("unlinkSync",!1,t.toString(),F)}o(zr,"unlinkSync");function ai(t,e,i,r=!0){let n=x(t),s=be(i,420),a=B(e),l;try{l=de("statSync",r,n,F)}catch{switch(Ni(a)){case 3:if(!de("statSync",r,k(n),F).isDirectory())throw f.With("ENOTDIR",k(n),"_open");return de("createFileSync",r,n,a,s,F);case 1:throw f.With("ENOENT",n,"_open");default:throw new f(22,"Invalid FileFlag object.")}}if(!l.hasAccess(s,F))throw f.With("EACCES",n,"_open");switch(Li(a)){case 1:throw f.With("EEXIST",n,"_open");case 2:return de("unlinkSync",r,n,F),de("createFileSync",r,n,a,l.mode,F);case 0:return de("openFileSync",r,n,a,F);default:throw new f(22,"Invalid FileFlag object.")}}o(ai,"_openSync");function li(t,e,i=0){return Ji(ai(t,e,i,!0))}o(li,"openSync");function tr(t,e,i){return Ji(ai(t,e,i,!1))}o(tr,"lopenSync");function Ra(t,e,i){let r=ai(t,e,420,i);try{let n=r.statSync(),s=new Uint8Array(n.size);return r.readSync(s,0,n.size,0),r.closeSync(),s}finally{r.closeSync()}}o(Ra,"_readFileSync");function Hr(t,e={}){let i=ge(e,null,"r",420),r=B(i.flag);if(!at(r))throw new f(22,"Flag passed to readFile must allow for reading.");let n=dt.Buffer.from(Ra(typeof t=="number"?M(t).path:t.toString(),i.flag,!0));return i.encoding?n.toString(i.encoding):n}o(Hr,"readFileSync");function Ah(t,e,i,r,n){let s=ai(t,i,r,n);try{s.writeSync(e,0,e.byteLength,0)}finally{s.closeSync()}}o(Ah,"_writeFileSync");function ir(t,e,i={}){let r=ge(i,"utf8","w+",420),n=B(r.flag);if(!me(n))throw new f(22,"Flag passed to writeFile must allow for writing.");if(typeof e!="string"&&!r.encoding)throw new f(22,"Encoding not specified");let s=typeof e=="string"?dt.Buffer.from(e,r.encoding):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(!s)throw new f(22,"Data not specified");Ah(typeof t=="number"?M(t).path:t.toString(),s,r.flag,r.mode,!0)}o(ir,"writeFileSync");function Rh(t,e,i,r,n){let s=ai(t,i,r,n);try{s.writeSync(e,0,e.byteLength,null)}finally{s.closeSync()}}o(Rh,"_appendFileSync");function Oa(t,e,i={}){let r=ge(i,"utf8","a",420),n=B(r.flag);if(!ct(n))throw new f(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new f(22,"Encoding not specified");let s=typeof e=="string"?dt.Buffer.from(e,r.encoding):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);Rh(typeof t=="number"?M(t).path:t.toString(),s,r.flag,r.mode,!0)}o(Oa,"appendFileSync");function Ca(t,e){let i=M(t).statSync();return e?.bigint?new re(i):i}o(Ca,"fstatSync");function Ze(t){M(t).closeSync(),Lt.delete(t)}o(Ze,"closeSync");function fo(t,e=0){if(e||=0,e<0)throw new f(22);M(t).truncateSync(e)}o(fo,"ftruncateSync");function La(t){M(t).syncSync()}o(La,"fsyncSync");function Na(t){M(t).datasyncSync()}o(Na,"fdatasyncSync");function Da(t,e,i,r,n){let s,a,l,c;if(typeof e=="string"){c=typeof i=="number"?i:null;let d=typeof r=="string"?r:"utf8";a=0,s=dt.Buffer.from(e,d),l=s.byteLength}else s=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=i,l=r,c=typeof n=="number"?n:null;let u=M(t);return c??=u.position,u.writeSync(s,a,l,c)}o(Da,"writeSync");function Ba(t,e,i,r,n){let s=M(t),a=typeof i=="object"?i.offset:i;return typeof i=="object"&&(r=i.length,n=i.position),n=Number(n),isNaN(n)&&(n=s.position),s.readSync(e,a,r,n)}o(Ba,"readSync");function Yr(t,e,i){M(t).chownSync(e,i)}o(Yr,"fchownSync");function Gr(t,e){let i=be(e,-1);if(i<0)throw new f(22,"Invalid mode.");M(t).chmodSync(i)}o(Gr,"fchmodSync");function Kr(t,e,i){M(t).utimesSync(Pt(e),Pt(i))}o(Kr,"futimesSync");function uo(t){return de("rmdirSync",!0,t.toString(),F)}o(uo,"rmdirSync");function Xr(t,e){let i=typeof e=="number"||typeof e=="string"?e:e?.mode,r=typeof e=="object"&&e?.recursive;de("mkdirSync",!0,t.toString(),be(i,511),F)}o(Xr,"mkdirSync");function ci(t,e){t=x(t);let i=de("readdirSync",!0,t,F);for(let r of Se.keys()){if(!r.startsWith(t))continue;let n=r.slice(t.length);n.includes("/")||n.length==0||i.push(n)}return i.map(r=>typeof e=="object"&&e?.withFileTypes?new ht(r,er(N(t.toString(),r))):e=="buffer"||typeof e=="object"&&e?.encoding=="buffer"?dt.Buffer.from(r):r)}o(ci,"readdirSync");function Ma(t,e){return e=x(e),de("linkSync",!1,t.toString(),e.toString(),F)}o(Ma,"linkSync");function Wa(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new f(22,"Invalid type: "+i);if(si(e))throw f.With("EEXIST",e.toString(),"symlink");ir(e,t.toString()),ai(e,"r+",420,!1)._setTypeSync(j.SYMLINK)}o(Wa,"symlinkSync");function ho(t,e){let i=dt.Buffer.from(Ra(t.toString(),"r",!1)),r=typeof e=="object"?e?.encoding:e;return r=="buffer"?i:i.toString(r)}o(ho,"readlinkSync");function Ua(t,e,i){let r=li(t,"r+");Yr(r,e,i),Ze(r)}o(Ua,"chownSync");function qa(t,e,i){let r=tr(t,"r+");Yr(r,e,i),Ze(r)}o(qa,"lchownSync");function ja(t,e){let i=li(t,"r+");Gr(i,e),Ze(i)}o(ja,"chmodSync");function $a(t,e){let i=tr(t,"r+");Gr(i,e),Ze(i)}o($a,"lchmodSync");function po(t,e,i){let r=li(t,"r+");Kr(r,e,i),Ze(r)}o(po,"utimesSync");function Va(t,e,i){let r=tr(t,"r+");Kr(r,e,i),Ze(r)}o(Va,"lutimesSync");function oi(t,e){t=x(t);let{base:i,dir:r}=xr(t),n=N(r=="/"?"/":oi(r),i),{fs:s,path:a,mountPoint:l}=H(n);try{return s.statSync(a,F).isSymbolicLink()?oi(l+ho(n)):n}catch(c){throw ce(c,{[a]:n})}}o(oi,"realpathSync");function za(t,e=384){if(!er(t).hasAccess(e,F))throw new f(13)}o(za,"accessSync");function yo(t,e){switch(t=x(t),er(t).mode&61440){case 16384:if(e?.recursive)for(let r of ci(t))yo(N(t,r));uo(t);return;case 32768:case 40960:zr(t);return;case 24576:case 8192:case 4096:case 49152:default:throw new f(1,"File type not supported",t,"rm")}}o(yo,"rmSync");function Ha(t,e){let i=typeof e=="object"?e?.encoding:e||"utf8",n="/tmp/"+`${t}${Date.now()}-${Math.random().toString(36).slice(2)}`;return Xr(n),i=="buffer"?dt.Buffer.from(n):n}o(Ha,"mkdtempSync");function mo(t,e,i){if(t=x(t),e=x(e),i&&i&1&&si(e))throw new f(17,"Destination file already exists.",e,"copyFile");ir(e,Hr(t))}o(mo,"copyFileSync");function Ya(t,e,i){let r=M(t),n=0;for(let s of e)n+=r.readSync(s,0,s.byteLength,i+n);return n}o(Ya,"readvSync");function Ga(t,e,i){let r=M(t),n=0;for(let s of e)n+=r.writeSync(new Uint8Array(s.buffer),0,s.byteLength,i+n);return n}o(Ga,"writevSync");function Ka(t,e){return t=x(t),new pt(t)}o(Ka,"opendirSync");function bo(t,e,i){t=x(t),e=x(e);let r=co(t);if(i?.errorOnExist&&si(e))throw new f(17,"Destination file or directory already exists.",e,"cp");switch(r.mode&61440){case 16384:if(!i?.recursive)throw new f(21,t+" is a directory (not copied)",t,"cp");Xr(e,{recursive:!0});for(let n of ci(t,{withFileTypes:!0}))i.filter&&!i.filter(N(t,n.name),N(e,n.name))||bo(N(t,n.name),N(e,n.name),i);break;case 32768:case 40960:mo(t,e);break;case 24576:case 8192:case 4096:case 49152:default:throw new f(1,"File type not supported",t,"rm")}i?.preserveTimestamps&&po(e,r.atime,r.mtime)}o(bo,"cpSync");function Xa(t,e){throw f.With("ENOSYS",t.toString(),"statfs")}o(Xa,"statfsSync");var ht=class{constructor(e,i){this.path=e;this.stats=i}static{o(this,"Dirent")}get name(){return O(this.path)}isFile(){return this.stats.isFile()}isDirectory(){return this.stats.isDirectory()}isBlockDevice(){return this.stats.isBlockDevice()}isCharacterDevice(){return this.stats.isCharacterDevice()}isSymbolicLink(){return this.stats.isSymbolicLink()}isFIFO(){return this.stats.isFIFO()}isSocket(){return this.stats.isSocket()}},pt=class{constructor(e){this.path=e;this.closed=!1;this._entries=[]}static{o(this,"Dir")}checkClosed(){if(this.closed)throw new f(9,"Can not use closed Dir")}close(e){if(this.closed=!0,!e)return Promise.resolve();e()}closeSync(){this.closed=!0}async _read(){return this._entries||(this._entries=await Nt(this.path,{withFileTypes:!0})),this._entries.length&&this._entries.shift()||null}read(e){if(!e)return this._read();this._read().then(i=>e(void 0,i))}readSync(){return this._entries||(this._entries=ci(this.path,{withFileTypes:!0})),this._entries.length&&this._entries.shift()||null}[Symbol.asyncIterator](){let e=this;return{[Symbol.asyncIterator]:this[Symbol.asyncIterator],next:o(async function(){let i=await e._read();return i!=null?{done:!1,value:i}:(await e.close(),{done:!0,value:void 0})},"next")}}};var On=Er(su(),1);var wt=class extends On.Readable{static{o(this,"ReadStream")}close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(new f(5,i.toString()))}}},St=class extends On.Writable{static{o(this,"WriteStream")}close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(new f(5,i.toString()))}}};var ie=class{static{o(this,"FileHandle")}constructor(e){let i=typeof e!="number";this.fd=i?Ji(e):e,this.file=i?e:M(e)}chown(e,i){return this.file.chown(e,i)}chmod(e){let i=be(e,-1);if(i<0)throw new f(22,"Invalid mode.");return this.file.chmod(i)}datasync(){return this.file.datasync()}sync(){return this.file.sync()}truncate(e){if(e||=0,e<0)throw new f(22);return this.file.truncate(e)}utimes(e,i){return this.file.utimes(Pt(e),Pt(i))}async appendFile(e,i={}){let r=ge(i,"utf8","a",420),n=B(r.flag);if(!ct(n))throw new f(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new f(22,"Encoding not specified");let s=typeof e=="string"?Gt.Buffer.from(e,r.encoding):e;await this.file.write(s,0,s.length,null)}read(e,i,r,n){return isNaN(+n)&&(n=this.file.position),this.file.read(e,i,r,n)}async readFile(e){let i=ge(e,null,"r",292),r=B(i.flag);if(!at(r))throw new f(22,"Flag passed must allow for reading.");let{size:n}=await this.stat(),s=new Uint8Array(n);await this.file.read(s,0,n,0);let a=Gt.Buffer.from(s);return i.encoding?a.toString(i.encoding):a}readableWebStream(e={}){let i=o(async({close:r,enqueue:n,error:s})=>{try{let c=0,u=0,d=NaN;for(;d>0;){let h=await this.read(new Uint8Array(65536),0,65536,u);if(!h.bytesRead){r();return}if(n(h.buffer.slice(0,h.bytesRead)),u+=h.bytesRead,++c>=1e7)throw new f(27,"Too many iterations on readable stream",this.file.path,"FileHandle.readableWebStream");d=h.bytesRead}}catch(a){s(a)}},"start");return new globalThis.ReadableStream({start:i,type:e.type})}readLines(e){throw f.With("ENOSYS",this.file.path,"FileHandle.readLines")}[Symbol.asyncDispose](){return this.close()}async stat(e){let i=await this.file.stat();return e?.bigint?new re(i):i}async write(e,i,r,n){let s,a,l;if(typeof e=="string"){n=typeof i=="number"?i:null;let u=typeof r=="string"?r:"utf8";a=0,s=Gt.Buffer.from(e,u),l=s.length}else s=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=i,l=r,n=typeof n=="number"?n:null;n??=this.file.position;let c=await this.file.write(s,a,l,n);return{buffer:s,bytesWritten:c}}async writeFile(e,i={}){let r=ge(i,"utf8","w",420),n=B(r.flag);if(!me(n))throw new f(22,"Flag passed must allow for writing.");if(typeof e!="string"&&!r.encoding)throw new f(22,"Encoding not specified");let s=typeof e=="string"?Gt.Buffer.from(e,r.encoding):e;await this.file.write(s,0,s.length,0)}async close(){await this.file.close(),Lt.delete(this.fd)}async writev(e,i){let r=0;for(let n of e)r+=(await this.write(n,0,n.length,i+r)).bytesWritten;return{bytesWritten:r,buffers:e}}async readv(e,i){let r=0;for(let n of e)r+=(await this.read(n,0,n.byteLength,i+r)).bytesRead;return{bytesRead:r,buffers:e}}createReadStream(e){let i=new wt({highWaterMark:e?.highWaterMark||65536,encoding:e.encoding,read:o(async r=>{try{let n=await this.read(new Uint8Array(r),0,r,this.file.position);i.push(n.bytesRead?n.buffer.slice(0,n.bytesRead):null),this.file.position+=n.bytesRead}catch(n){i.destroy(n)}},"read")});return i.path=this.file.path,i}createWriteStream(e){let i={highWaterMark:e?.highWaterMark,encoding:e?.encoding,write:o(async(n,s,a)=>{try{let{bytesWritten:l}=await this.write(n,null,s);a(l==n.length?null:new Error("Failed to write full chunk"))}catch(l){a(l)}},"write")},r=new St(i);return r.path=this.file.path,r}};async function Os(t,e){t=x(t),e=x(e);let i=H(t),r=H(e);try{if(i.mountPoint==r.mountPoint){await i.fs.rename(i.path,r.path,F);return}await vi(e,await br(t)),await mr(t)}catch(n){throw ce(n,{[i.path]:t,[r.path]:e})}}o(Os,"rename");async function Ae(t){try{let{fs:e,path:i}=H(await Te(t));return await e.exists(i,F)}catch(e){if(e instanceof f&&e.code=="ENOENT")return!1;throw e}}o(Ae,"exists");async function Fi(t,e){t=x(t);let{fs:i,path:r}=H(await Ae(t)?await Te(t):t);try{let n=await i.stat(r,F);return e?.bigint?new re(n):n}catch(n){throw ce(n,{[r]:t})}}o(Fi,"stat");async function Cn(t,e){t=x(t);let{fs:i,path:r}=H(t);try{let n=await i.stat(r,F);return e?.bigint?new re(n):n}catch(n){throw ce(n,{[r]:t})}}o(Cn,"lstat");async function Cs(t,e=0){let i=await he(t,"r+");try{await i.truncate(e)}finally{await i.close()}}o(Cs,"truncate");async function mr(t){t=x(t);let{fs:e,path:i}=H(t);try{await e.unlink(i,F)}catch(r){throw ce(r,{[i]:t})}}o(mr,"unlink");async function Ii(t,e,i=420,r){t=x(t);let n=be(i,420),s=B(e);t=r&&await Ae(t)?await Te(t):t;let{fs:a,path:l}=H(t);try{switch(Li(s)){case 1:throw f.With("EEXIST",t,"_open");case 2:let c=await a.openFile(l,s,F);return await c.truncate(0),await c.sync(),new ie(c);case 0:return new ie(await a.openFile(l,s,F));default:throw new f(22,"Invalid file flag")}}catch{switch(Ni(s)){case 3:let u=await a.stat(k(l),F);if(u&&!u.isDirectory())throw f.With("ENOTDIR",k(t),"_open");return new ie(await a.createFile(l,s,n,F));case 1:throw f.With("ENOENT",t,"_open");default:throw new f(22,"Invalid file flag")}}}o(Ii,"_open");async function he(t,e="r",i=420){return await Ii(t,e,i,!0)}o(he,"open");async function br(t,e){let i=ge(e,null,"r",420),r=typeof t=="object"&&"fd"in t?t:await he(t,i.flag,i.mode);try{return await r.readFile(i)}finally{await r.close()}}o(br,"readFile");async function vi(t,e,i){let r=ge(i,"utf8","w+",420),n=t instanceof ie?t:await he(t.toString(),r.flag,r.mode);try{let s=e;if(typeof s!="string"&&!(s instanceof Uint8Array))throw new f(22,"Iterables and streams not supported",n.file.path,"writeFile");await n.writeFile(s,r)}finally{await n.close()}}o(vi,"writeFile");async function Ls(t,e,i){let r=ge(i,"utf8","a",420),n=B(r.flag);if(!ct(n))throw new f(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new f(22,"Encoding not specified");let s=typeof e=="string"?Gt.Buffer.from(e,r.encoding):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=typeof t=="object"&&"fd"in t?t:await he(t,r.flag,r.mode);try{await a.appendFile(s,r)}finally{await a.close()}}o(Ls,"appendFile");async function Ln(t){t=x(t),t=await Ae(t)?await Te(t):t;let{fs:e,path:i}=H(t);try{await e.rmdir(i,F)}catch(r){throw ce(r,{[i]:t})}}o(Ln,"rmdir");async function gr(t,e){t=x(t),t=await Ae(t)?await Te(t):t;let{fs:i,path:r}=H(t);try{await i.mkdir(r,be(typeof e=="object"?e?.mode:e,511),F)}catch(n){throw ce(n,{[r]:t})}}o(gr,"mkdir");async function Nt(t,e){t=x(t),t=await Ae(t)?await Te(t):t;let{fs:i,path:r}=H(t),n;try{n=await i.readdir(r,F)}catch(a){throw ce(a,{[r]:t})}for(let a of Se.keys())if(a.startsWith(t)){let l=a.slice(t.length);if(l.includes("/")||l.length==0)continue;n.push(l)}let s=[];for(let a of n)s.push(typeof e=="object"&&e?.withFileTypes?new ht(a,await Fi(N(t,a))):a);return s}o(Nt,"readdir");async function Ns(t,e){t=x(t),e=x(e);let{fs:i,path:r}=H(e);try{return await i.link(t,e,F)}catch(n){throw ce(n,{[r]:e})}}o(Ns,"link");async function Ds(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new f(22,"Invalid symlink type: "+i);if(await Ae(e))throw f.With("EEXIST",e.toString(),"symlink");await vi(e,t.toString()),await(await Ii(e,"r+",420,!1)).file._setType(j.SYMLINK)}o(Ds,"symlink");async function Nn(t,e){let i=await Ii(x(t),"r",420,!1);try{let r=await i.readFile(),n=typeof e=="object"?e?.encoding:e;return n=="buffer"?r:r.toString(n)}finally{await i.close()}}o(Nn,"readlink");async function Bs(t,e,i){let r=await he(t,"r+");try{await r.chown(e,i)}finally{await r.close()}}o(Bs,"chown");async function Ms(t,e,i){let r=await Ii(t,"r+",420,!1);try{await r.chown(e,i)}finally{await r.close()}}o(Ms,"lchown");async function Ws(t,e){let i=await he(t,"r+");try{await i.chmod(e)}finally{await i.close()}}o(Ws,"chmod");async function Us(t,e){let i=await Ii(t,"r+",420,!1);try{await i.chmod(e)}finally{await i.close()}}o(Us,"lchmod");async function Dn(t,e,i){let r=await he(t,"r+");try{await r.utimes(e,i)}finally{await r.close()}}o(Dn,"utimes");async function qs(t,e,i){let r=await Ii(t,"r+",420,!1);try{await r.utimes(new Date(e),new Date(i))}finally{await r.close()}}o(qs,"lutimes");async function Te(t,e){t=x(t);let{base:i,dir:r}=xr(t),n=N(r=="/"?"/":await Te(r),i),{fs:s,path:a,mountPoint:l}=H(n);try{return(await s.stat(a,F)).isSymbolicLink()?Te(l+await Nn(n)):n}catch(c){throw ce(c,{[a]:n})}}o(Te,"realpath");function iw(t,e={}){throw f.With("ENOSYS",t.toString(),"watch")}o(iw,"watch");async function js(t,e=0){if(!(await Fi(t)).hasAccess(e,F))throw new f(13)}o(js,"access");async function Bn(t,e){switch(t=x(t),(await Fi(t)).mode&61440){case 16384:if(e?.recursive)for(let r of await Nt(t))await Bn(N(t,r));await Ln(t);return;case 32768:case 40960:await mr(t);return;case 24576:case 8192:case 4096:case 49152:default:throw new f(1,"File type not supported",t,"rm")}}o(Bn,"rm");async function $s(t,e){let i=typeof e=="object"?e?.encoding:e||"utf8",n="/tmp/"+`${t}${Date.now()}-${Math.random().toString(36).slice(2)}`;return await gr(n),i=="buffer"?Gt.Buffer.from(n):n}o($s,"mkdtemp");async function Mn(t,e,i){if(t=x(t),e=x(e),i&&i&1&&await Ae(e))throw new f(17,"Destination file already exists.",e,"copyFile");await vi(e,await br(t))}o(Mn,"copyFile");async function Vs(t,e){return t=x(t),new pt(t)}o(Vs,"opendir");async function Wn(t,e,i){t=x(t),e=x(e);let r=await Cn(t);if(i?.errorOnExist&&await Ae(e))throw new f(17,"Destination file or directory already exists.",e,"cp");switch(r.mode&61440){case 16384:if(!i?.recursive)throw new f(21,t+" is a directory (not copied)",t,"cp");await gr(e,{recursive:!0});for(let n of await Nt(t,{withFileTypes:!0}))i.filter&&!i.filter(N(t,n.name),N(e,n.name))||await Wn(N(t,n.name),N(e,n.name),i);break;case 32768:case 40960:await Mn(t,e);break;case 24576:case 8192:case 4096:case 49152:default:throw new f(1,"File type not supported",t,"rm")}i?.preserveTimestamps&&await Dn(e,r.atime,r.mtime)}o(Wn,"cp");async function zs(t,e){throw f.With("ENOSYS",t.toString(),"statfs")}o(zs,"statfs");function au(t,e,i=_){Os(t,e).then(()=>i()).catch(i)}o(au,"rename");function lu(t,e=_){Ae(t).then(e).catch(()=>e(!1))}o(lu,"exists");function cu(t,e,i=_){i=typeof e=="function"?e:i,Fi(t,typeof e!="function"?e:{}).then(r=>i(void 0,r)).catch(i)}o(cu,"stat");function fu(t,e,i=_){i=typeof e=="function"?e:i,Cn(t,typeof e!="function"?e:{}).then(r=>i(void 0,r)).catch(i)}o(fu,"lstat");function uu(t,e=0,i=_){i=typeof e=="function"?e:i,Cs(t,typeof e=="number"?e:0).then(()=>i()).catch(i)}o(uu,"truncate");function du(t,e=_){mr(t).then(()=>e()).catch(e)}o(du,"unlink");function hu(t,e,i,r=_){let n=be(i,420);r=typeof i=="function"?i:r,he(t,e,n).then(s=>r(void 0,s.fd)).catch(r)}o(hu,"open");function pu(t,e,i=_){i=typeof e=="function"?e:i,br(t,typeof e=="function"?null:e).then(r=>i(void 0,r)).catch(i)}o(pu,"readFile");function yu(t,e,i,r=_){r=typeof i=="function"?i:r,vi(t,e,typeof i!="function"?i:null).then(()=>r(void 0)).catch(r)}o(yu,"writeFile");function mu(t,e,i,r=_){r=typeof i=="function"?i:r,Ls(t,e,typeof i=="function"?null:i).then(()=>r()).catch(r)}o(mu,"appendFile");function bu(t,e,i=_){i=typeof e=="function"?e:i,M(t).stat().then(r=>i(void 0,typeof e=="object"&&e?.bigint?new re(r):r)).catch(i)}o(bu,"fstat");function gu(t,e=_){new ie(t).close().then(()=>e()).catch(e)}o(gu,"close");function wu(t,e,i=_){let r=typeof e=="number"?e:0;i=typeof e=="function"?e:i;let n=M(t);if(r<0)throw new f(22);n.truncate(r).then(()=>i()).catch(i)}o(wu,"ftruncate");function Su(t,e=_){M(t).sync().then(()=>e()).catch(e)}o(Su,"fsync");function _u(t,e=_){M(t).datasync().then(()=>e()).catch(e)}o(_u,"fdatasync");function Eu(t,e,i,r,n,s=_){let a,l,c,u,d,h=new ie(t);if(typeof e=="string"){switch(d="utf8",typeof i){case"function":s=i;break;case"number":u=i,d=typeof r=="string"?r:"utf8",s=typeof n=="function"?n:s;break;default:s=typeof r=="function"?r:typeof n=="function"?n:s,s(new f(22,"Invalid arguments."));return}a=Buffer.from(e),l=0,c=a.length;let b=s;h.write(a,l,c,u).then(({bytesWritten:m})=>b(void 0,m,a.toString(d))).catch(b)}else{a=Buffer.from(e.buffer),l=i,c=r,u=typeof n=="number"?n:null;let b=typeof n=="function"?n:s;h.write(a,l,c,u).then(({bytesWritten:m})=>b(void 0,m,a)).catch(b)}}o(Eu,"write");function xu(t,e,i,r,n,s=_){new ie(t).read(e,i,r,n).then(({bytesRead:a,buffer:l})=>s(void 0,a,l)).catch(s)}o(xu,"read");function ku(t,e,i,r=_){new ie(t).chown(e,i).then(()=>r()).catch(r)}o(ku,"fchown");function Fu(t,e,i){new ie(t).chmod(e).then(()=>i()).catch(i)}o(Fu,"fchmod");function Iu(t,e,i,r=_){new ie(t).utimes(e,i).then(()=>r()).catch(r)}o(Iu,"futimes");function vu(t,e=_){Ln(t).then(()=>e()).catch(e)}o(vu,"rmdir");function Pu(t,e,i=_){gr(t,e).then(()=>i()).catch(i)}o(Pu,"mkdir");function Tu(t,e,i=_){i=typeof e=="function"?e:i,Nt(t,typeof e!="function"?e:{}).then(n=>i(void 0,n)).catch(i)}o(Tu,"readdir");function Au(t,e,i=_){Ns(t,e).then(()=>i()).catch(i)}o(Au,"link");function Ru(t,e,i,r=_){let n=typeof i=="string"?i:"file";r=typeof i=="function"?i:r,Ds(t,e,n).then(()=>r()).catch(r)}o(Ru,"symlink");function Ou(t,e,i=_){i=typeof e=="function"?e:i,Nn(t).then(r=>i(void 0,r)).catch(i)}o(Ou,"readlink");function Cu(t,e,i,r=_){Bs(t,e,i).then(()=>r()).catch(r)}o(Cu,"chown");function Lu(t,e,i,r=_){Ms(t,e,i).then(()=>r()).catch(r)}o(Lu,"lchown");function Nu(t,e,i=_){Ws(t,e).then(()=>i()).catch(i)}o(Nu,"chmod");function Du(t,e,i=_){Us(t,e).then(()=>i()).catch(i)}o(Du,"lchmod");function Bu(t,e,i,r=_){Dn(t,e,i).then(()=>r()).catch(r)}o(Bu,"utimes");function Mu(t,e,i,r=_){qs(t,e,i).then(()=>r()).catch(r)}o(Mu,"lutimes");function Wu(t,e,i=_){i=typeof e=="function"?e:i,Te(t,typeof e=="function"?null:e).then(r=>i(void 0,r)).catch(i)}o(Wu,"realpath");function Uu(t,e,i=_){let r=typeof e=="number"?e:4;i=typeof e=="function"?e:i,js(t,typeof e=="function"?null:e).then(()=>i()).catch(i)}o(Uu,"access");function qu(t,e,i=_){throw f.With("ENOSYS",t.toString(),"watchFile")}o(qu,"watchFile");function ju(t,e=_){throw f.With("ENOSYS",t.toString(),"unwatchFile")}o(ju,"unwatchFile");function $u(t,e,i=_){throw f.With("ENOSYS",t.toString(),"watch")}o($u,"watch");function Vu(t,e){let i=typeof e=="object"?e:{encoding:e},r,n=new wt({highWaterMark:i.highWaterMark||64*1024,encoding:i.encoding||"utf8",read:o(async function(s){try{r||=await he(t,"r",i?.mode);let a=await r.read(new Uint8Array(s),0,s,r.file.position);n.push(a.bytesRead?a.buffer.slice(0,a.bytesRead):null),r.file.position+=a.bytesRead,a.bytesRead||await r.close()}catch(a){await r?.close(),n.destroy(a)}},"read"),destroy:o(function(s,a){r?.close().then(()=>a(s)).catch(a)},"destroy")});return n.path=t.toString(),n}o(Vu,"createReadStream");function zu(t,e){let i=typeof e=="object"?e:{encoding:e},r,n=new St({highWaterMark:i?.highWaterMark,write:o(async function(s,a,l){try{r||=await he(t,"w",i?.mode||438),await r.write(s,0,a),l(void 0)}catch(c){await r?.close(),l(c)}},"write"),destroy:o(function(s,a){a(s),r?.close().then(()=>a(s)).catch(a)},"destroy"),final:o(function(s){r?.close().then(()=>s()).catch(s)},"final")});return n.path=t.toString(),n}o(zu,"createWriteStream");function Hu(t,e,i=_){i=typeof e=="function"?e:i,Bn(t,typeof e=="function"?void 0:e).then(()=>i(void 0)).catch(i)}o(Hu,"rm");function Yu(t,e,i=_){i=typeof e=="function"?e:i,$s(t,typeof e!="function"?e:null).then(r=>i(void 0,r)).catch(i)}o(Yu,"mkdtemp");function Gu(t,e,i,r=_){r=typeof i=="function"?i:r,Mn(t,e,typeof i=="function"?void 0:i).then(()=>r(void 0)).catch(r)}o(Gu,"copyFile");function Ku(t,e,i,r=_){r=typeof i=="function"?i:r,new ie(t).readv(e,typeof i=="function"?void 0:i).then(({buffers:n,bytesRead:s})=>r(void 0,s,n)).catch(r)}o(Ku,"readv");function Xu(t,e,i,r=_){r=typeof i=="function"?i:r,new ie(t).writev(e,typeof i=="function"?void 0:i).then(({buffers:n,bytesWritten:s})=>r(void 0,s,n)).catch(r)}o(Xu,"writev");function Ju(t,e,i=_){i=typeof e=="function"?e:i,Vs(t,typeof e=="function"?void 0:e).then(r=>i(void 0,r)).catch(i)}o(Ju,"opendir");function Qu(t,e,i,r=_){r=typeof i=="function"?i:r,Wn(t,e,typeof i=="function"?void 0:i).then(()=>r(void 0)).catch(r)}o(Qu,"cp");function Zu(t,e,i=_){i=typeof e=="function"?e:i,zs(t,typeof e=="function"?void 0:e).then(r=>i(void 0,r)).catch(i)}o(Zu,"statfs");async function ed(t,e){let i=await he(t.toString(),"r"),r=await i.readFile();return await i.close(),new Blob([r],e)}o(ed,"openAsBlob");function Hs(t){return Qn(t)||Ki(t)||t instanceof Z}o(Hs,"isMountConfig");async function Ys(t,e=0){if(typeof t!="object"||t==null)throw new f(22,"Invalid options on mount configuration");if(!Hs(t))throw new f(22,"Invalid mount configuration");if(t instanceof Z)return t;Ki(t)&&(t={backend:t});for(let[n,s]of Object.entries(t))if(n!="backend"&&Hs(s)){if(e>10)throw new f(22,"Invalid configuration, too deep and possibly infinite");t[n]=await Ys(s,++e)}let{backend:i}=t;if(!await i.isAvailable())throw new f(1,"Backend not available: "+i);Ur(i,t);let r=i.create(t);return await r.ready(),r}o(Ys,"resolveMountConfig");async function rw(t){let e="uid"in t&&t.uid||0,i="gid"in t&&t.gid||0;Hs(t)&&(t={mounts:{"/":t}});for(let[r,n]of Object.entries(t.mounts)){if(!r.startsWith("/"))throw new f(22,"Mount points must have absolute paths");t.mounts[r]=await Ys(n)}Zi(t.mounts),Pa({uid:e,gid:i,suid:e,sgid:i,euid:e,egid:i})}o(rw,"configure");var nw=Sr;return ld(ow);})();
1
+ "use strict";var ZenFS=(()=>{var Ju=Object.create;var Fi=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var ed=Object.getPrototypeOf,td=Object.prototype.hasOwnProperty;var s=(t,e)=>Fi(t,"name",{value:e,configurable:!0});var A=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gn=(t,e)=>{for(var i in e)Fi(t,i,{get:e[i],enumerable:!0})},Vs=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Zu(e))!td.call(t,r)&&r!==i&&Fi(t,r,{get:()=>e[r],enumerable:!(n=Qu(e,r))||n.enumerable});return t};var Or=(t,e,i)=>(i=t!=null?Ju(ed(t)):{},Vs(e||!t||!t.__esModule?Fi(i,"default",{value:t,enumerable:!0}):i,t)),id=t=>Vs(Fi({},"__esModule",{value:!0}),t);var ra=A(Cn=>{"use strict";Cn.byteLength=Vd;Cn.toByteArray=Hd;Cn.fromByteArray=Kd;var Me=[],ge=[],$d=typeof Uint8Array<"u"?Uint8Array:Array,Kr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tt=0,ia=Kr.length;Tt<ia;++Tt)Me[Tt]=Kr[Tt],ge[Kr.charCodeAt(Tt)]=Tt;var Tt,ia;ge[45]=62;ge[95]=63;function na(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");i===-1&&(i=e);var n=i===e?0:4-i%4;return[i,n]}s(na,"getLens");function Vd(t){var e=na(t),i=e[0],n=e[1];return(i+n)*3/4-n}s(Vd,"byteLength");function zd(t,e,i){return(e+i)*3/4-i}s(zd,"_byteLength");function Hd(t){var e,i=na(t),n=i[0],r=i[1],o=new $d(zd(t,n,r)),a=0,l=r>0?n-4:n,c;for(c=0;c<l;c+=4)e=ge[t.charCodeAt(c)]<<18|ge[t.charCodeAt(c+1)]<<12|ge[t.charCodeAt(c+2)]<<6|ge[t.charCodeAt(c+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return r===2&&(e=ge[t.charCodeAt(c)]<<2|ge[t.charCodeAt(c+1)]>>4,o[a++]=e&255),r===1&&(e=ge[t.charCodeAt(c)]<<10|ge[t.charCodeAt(c+1)]<<4|ge[t.charCodeAt(c+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}s(Hd,"toByteArray");function Yd(t){return Me[t>>18&63]+Me[t>>12&63]+Me[t>>6&63]+Me[t&63]}s(Yd,"tripletToBase64");function Gd(t,e,i){for(var n,r=[],o=e;o<i;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),r.push(Yd(n));return r.join("")}s(Gd,"encodeChunk");function Kd(t){for(var e,i=t.length,n=i%3,r=[],o=16383,a=0,l=i-n;a<l;a+=o)r.push(Gd(t,a,a+o>l?l:a+o));return n===1?(e=t[i-1],r.push(Me[e>>2]+Me[e<<4&63]+"==")):n===2&&(e=(t[i-2]<<8)+t[i-1],r.push(Me[e>>10]+Me[e>>4&63]+Me[e<<2&63]+"=")),r.join("")}s(Kd,"fromByteArray")});var oa=A(Xr=>{Xr.read=function(t,e,i,n,r){var o,a,l=r*8-n-1,c=(1<<l)-1,u=c>>1,h=-7,d=i?r-1:0,b=i?-1:1,m=t[e+d];for(d+=b,o=m&(1<<-h)-1,m>>=-h,h+=l;h>0;o=o*256+t[e+d],d+=b,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[e+d],d+=b,h-=8);if(o===0)o=1-u;else{if(o===c)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(m?-1:1)*a*Math.pow(2,o-n)};Xr.write=function(t,e,i,n,r,o){var a,l,c,u=o*8-r-1,h=(1<<u)-1,d=h>>1,b=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,w=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+d>=1?e+=b/c:e+=b*Math.pow(2,1-d),e*c>=2&&(a++,c/=2),a+d>=h?(l=0,a=h):a+d>=1?(l=(e*c-1)*Math.pow(2,r),a=a+d):(l=e*Math.pow(2,d-1)*Math.pow(2,r),a=0));r>=8;t[i+m]=l&255,m+=w,l/=256,r-=8);for(a=a<<r|l,u+=r;u>0;t[i+m]=a&255,m+=w,a/=256,u-=8);t[i+m-w]|=g*128}});var Ee=A(ti=>{"use strict";var Jr=ra(),Zt=oa(),sa=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ti.Buffer=y;ti.SlowBuffer=th;ti.INSPECT_MAX_BYTES=50;var Rn=2147483647;ti.kMaxLength=Rn;y.TYPED_ARRAY_SUPPORT=Xd();!y.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Xd(){try{let t=new Uint8Array(1),e={foo:s(function(){return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}s(Xd,"typedArraySupport");Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:s(function(){if(y.isBuffer(this))return this.buffer},"get")});Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:s(function(){if(y.isBuffer(this))return this.byteOffset},"get")});function Je(t){if(t>Rn)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,y.prototype),e}s(Je,"createBuffer");function y(t,e,i){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return to(t)}return fa(t,e,i)}s(y,"Buffer");y.poolSize=8192;function fa(t,e,i){if(typeof t=="string")return Qd(t,e);if(ArrayBuffer.isView(t))return Zd(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(We(t,ArrayBuffer)||t&&We(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(We(t,SharedArrayBuffer)||t&&We(t.buffer,SharedArrayBuffer)))return Zr(t,e,i);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return y.from(n,e,i);let r=eh(t);if(r)return r;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return y.from(t[Symbol.toPrimitive]("string"),e,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}s(fa,"from");y.from=function(t,e,i){return fa(t,e,i)};Object.setPrototypeOf(y.prototype,Uint8Array.prototype);Object.setPrototypeOf(y,Uint8Array);function ua(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}s(ua,"assertSize");function Jd(t,e,i){return ua(t),t<=0?Je(t):e!==void 0?typeof i=="string"?Je(t).fill(e,i):Je(t).fill(e):Je(t)}s(Jd,"alloc");y.alloc=function(t,e,i){return Jd(t,e,i)};function to(t){return ua(t),Je(t<0?0:io(t)|0)}s(to,"allocUnsafe");y.allocUnsafe=function(t){return to(t)};y.allocUnsafeSlow=function(t){return to(t)};function Qd(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!y.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let i=da(t,e)|0,n=Je(i),r=n.write(t,e);return r!==i&&(n=n.slice(0,r)),n}s(Qd,"fromString");function Qr(t){let e=t.length<0?0:io(t.length)|0,i=Je(e);for(let n=0;n<e;n+=1)i[n]=t[n]&255;return i}s(Qr,"fromArrayLike");function Zd(t){if(We(t,Uint8Array)){let e=new Uint8Array(t);return Zr(e.buffer,e.byteOffset,e.byteLength)}return Qr(t)}s(Zd,"fromArrayView");function Zr(t,e,i){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(i||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&i===void 0?n=new Uint8Array(t):i===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,i),Object.setPrototypeOf(n,y.prototype),n}s(Zr,"fromArrayBuffer");function eh(t){if(y.isBuffer(t)){let e=io(t.length)|0,i=Je(e);return i.length===0||t.copy(i,0,0,e),i}if(t.length!==void 0)return typeof t.length!="number"||ro(t.length)?Je(0):Qr(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Qr(t.data)}s(eh,"fromObject");function io(t){if(t>=Rn)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Rn.toString(16)+" bytes");return t|0}s(io,"checked");function th(t){return+t!=t&&(t=0),y.alloc(+t)}s(th,"SlowBuffer");y.isBuffer=s(function(e){return e!=null&&e._isBuffer===!0&&e!==y.prototype},"isBuffer");y.compare=s(function(e,i){if(We(e,Uint8Array)&&(e=y.from(e,e.offset,e.byteLength)),We(i,Uint8Array)&&(i=y.from(i,i.offset,i.byteLength)),!y.isBuffer(e)||!y.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===i)return 0;let n=e.length,r=i.length;for(let o=0,a=Math.min(n,r);o<a;++o)if(e[o]!==i[o]){n=e[o],r=i[o];break}return n<r?-1:r<n?1:0},"compare");y.isEncoding=s(function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding");y.concat=s(function(e,i){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return y.alloc(0);let n;if(i===void 0)for(i=0,n=0;n<e.length;++n)i+=e[n].length;let r=y.allocUnsafe(i),o=0;for(n=0;n<e.length;++n){let a=e[n];if(We(a,Uint8Array))o+a.length>r.length?(y.isBuffer(a)||(a=y.from(a)),a.copy(r,o)):Uint8Array.prototype.set.call(r,a,o);else if(y.isBuffer(a))a.copy(r,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return r},"concat");function da(t,e){if(y.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||We(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let i=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&i===0)return 0;let r=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return eo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return _a(t).length;default:if(r)return n?-1:eo(t).length;e=(""+e).toLowerCase(),r=!0}}s(da,"byteLength");y.byteLength=da;function ih(t,e,i){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,e>>>=0,i<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return dh(this,e,i);case"utf8":case"utf-8":return pa(this,e,i);case"ascii":return fh(this,e,i);case"latin1":case"binary":return uh(this,e,i);case"base64":return lh(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hh(this,e,i);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s(ih,"slowToString");y.prototype._isBuffer=!0;function Ot(t,e,i){let n=t[e];t[e]=t[i],t[i]=n}s(Ot,"swap");y.prototype.swap16=s(function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let i=0;i<e;i+=2)Ot(this,i,i+1);return this},"swap16");y.prototype.swap32=s(function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let i=0;i<e;i+=4)Ot(this,i,i+3),Ot(this,i+1,i+2);return this},"swap32");y.prototype.swap64=s(function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let i=0;i<e;i+=8)Ot(this,i,i+7),Ot(this,i+1,i+6),Ot(this,i+2,i+5),Ot(this,i+3,i+4);return this},"swap64");y.prototype.toString=s(function(){let e=this.length;return e===0?"":arguments.length===0?pa(this,0,e):ih.apply(this,arguments)},"toString");y.prototype.toLocaleString=y.prototype.toString;y.prototype.equals=s(function(e){if(!y.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:y.compare(this,e)===0},"equals");y.prototype.inspect=s(function(){let e="",i=ti.INSPECT_MAX_BYTES;return e=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(e+=" ... "),"<Buffer "+e+">"},"inspect");sa&&(y.prototype[sa]=y.prototype.inspect);y.prototype.compare=s(function(e,i,n,r,o){if(We(e,Uint8Array)&&(e=y.from(e,e.offset,e.byteLength)),!y.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(i===void 0&&(i=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),o===void 0&&(o=this.length),i<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&i>=n)return 0;if(r>=o)return-1;if(i>=n)return 1;if(i>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;let a=o-r,l=n-i,c=Math.min(a,l),u=this.slice(r,o),h=e.slice(i,n);for(let d=0;d<c;++d)if(u[d]!==h[d]){a=u[d],l=h[d];break}return a<l?-1:l<a?1:0},"compare");function ha(t,e,i,n,r){if(t.length===0)return-1;if(typeof i=="string"?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,ro(i)&&(i=r?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(r)return-1;i=t.length-1}else if(i<0)if(r)i=0;else return-1;if(typeof e=="string"&&(e=y.from(e,n)),y.isBuffer(e))return e.length===0?-1:aa(t,e,i,n,r);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?r?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):aa(t,[e],i,n,r);throw new TypeError("val must be string, number or Buffer")}s(ha,"bidirectionalIndexOf");function aa(t,e,i,n,r){let o=1,a=t.length,l=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,l/=2,i/=2}function c(h,d){return o===1?h[d]:h.readUInt16BE(d*o)}s(c,"read");let u;if(r){let h=-1;for(u=i;u<a;u++)if(c(t,u)===c(e,h===-1?0:u-h)){if(h===-1&&(h=u),u-h+1===l)return h*o}else h!==-1&&(u-=u-h),h=-1}else for(i+l>a&&(i=a-l),u=i;u>=0;u--){let h=!0;for(let d=0;d<l;d++)if(c(t,u+d)!==c(e,d)){h=!1;break}if(h)return u}return-1}s(aa,"arrayIndexOf");y.prototype.includes=s(function(e,i,n){return this.indexOf(e,i,n)!==-1},"includes");y.prototype.indexOf=s(function(e,i,n){return ha(this,e,i,n,!0)},"indexOf");y.prototype.lastIndexOf=s(function(e,i,n){return ha(this,e,i,n,!1)},"lastIndexOf");function nh(t,e,i,n){i=Number(i)||0;let r=t.length-i;n?(n=Number(n),n>r&&(n=r)):n=r;let o=e.length;n>o/2&&(n=o/2);let a;for(a=0;a<n;++a){let l=parseInt(e.substr(a*2,2),16);if(ro(l))return a;t[i+a]=l}return a}s(nh,"hexWrite");function rh(t,e,i,n){return Ln(eo(e,t.length-i),t,i,n)}s(rh,"utf8Write");function oh(t,e,i,n){return Ln(bh(e),t,i,n)}s(oh,"asciiWrite");function sh(t,e,i,n){return Ln(_a(e),t,i,n)}s(sh,"base64Write");function ah(t,e,i,n){return Ln(gh(e,t.length-i),t,i,n)}s(ah,"ucs2Write");y.prototype.write=s(function(e,i,n,r){if(i===void 0)r="utf8",n=this.length,i=0;else if(n===void 0&&typeof i=="string")r=i,n=this.length,i=0;else if(isFinite(i))i=i>>>0,isFinite(n)?(n=n>>>0,r===void 0&&(r="utf8")):(r=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-i;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let a=!1;for(;;)switch(r){case"hex":return nh(this,e,i,n);case"utf8":case"utf-8":return rh(this,e,i,n);case"ascii":case"latin1":case"binary":return oh(this,e,i,n);case"base64":return sh(this,e,i,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ah(this,e,i,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},"write");y.prototype.toJSON=s(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function lh(t,e,i){return e===0&&i===t.length?Jr.fromByteArray(t):Jr.fromByteArray(t.slice(e,i))}s(lh,"base64Slice");function pa(t,e,i){i=Math.min(t.length,i);let n=[],r=e;for(;r<i;){let o=t[r],a=null,l=o>239?4:o>223?3:o>191?2:1;if(r+l<=i){let c,u,h,d;switch(l){case 1:o<128&&(a=o);break;case 2:c=t[r+1],(c&192)===128&&(d=(o&31)<<6|c&63,d>127&&(a=d));break;case 3:c=t[r+1],u=t[r+2],(c&192)===128&&(u&192)===128&&(d=(o&15)<<12|(c&63)<<6|u&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:c=t[r+1],u=t[r+2],h=t[r+3],(c&192)===128&&(u&192)===128&&(h&192)===128&&(d=(o&15)<<18|(c&63)<<12|(u&63)<<6|h&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),r+=l}return ch(n)}s(pa,"utf8Slice");var la=4096;function ch(t){let e=t.length;if(e<=la)return String.fromCharCode.apply(String,t);let i="",n=0;for(;n<e;)i+=String.fromCharCode.apply(String,t.slice(n,n+=la));return i}s(ch,"decodeCodePointsArray");function fh(t,e,i){let n="";i=Math.min(t.length,i);for(let r=e;r<i;++r)n+=String.fromCharCode(t[r]&127);return n}s(fh,"asciiSlice");function uh(t,e,i){let n="";i=Math.min(t.length,i);for(let r=e;r<i;++r)n+=String.fromCharCode(t[r]);return n}s(uh,"latin1Slice");function dh(t,e,i){let n=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>n)&&(i=n);let r="";for(let o=e;o<i;++o)r+=wh[t[o]];return r}s(dh,"hexSlice");function hh(t,e,i){let n=t.slice(e,i),r="";for(let o=0;o<n.length-1;o+=2)r+=String.fromCharCode(n[o]+n[o+1]*256);return r}s(hh,"utf16leSlice");y.prototype.slice=s(function(e,i){let n=this.length;e=~~e,i=i===void 0?n:~~i,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),i<0?(i+=n,i<0&&(i=0)):i>n&&(i=n),i<e&&(i=e);let r=this.subarray(e,i);return Object.setPrototypeOf(r,y.prototype),r},"slice");function X(t,e,i){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}s(X,"checkOffset");y.prototype.readUintLE=y.prototype.readUIntLE=s(function(e,i,n){e=e>>>0,i=i>>>0,n||X(e,i,this.length);let r=this[e],o=1,a=0;for(;++a<i&&(o*=256);)r+=this[e+a]*o;return r},"readUIntLE");y.prototype.readUintBE=y.prototype.readUIntBE=s(function(e,i,n){e=e>>>0,i=i>>>0,n||X(e,i,this.length);let r=this[e+--i],o=1;for(;i>0&&(o*=256);)r+=this[e+--i]*o;return r},"readUIntBE");y.prototype.readUint8=y.prototype.readUInt8=s(function(e,i){return e=e>>>0,i||X(e,1,this.length),this[e]},"readUInt8");y.prototype.readUint16LE=y.prototype.readUInt16LE=s(function(e,i){return e=e>>>0,i||X(e,2,this.length),this[e]|this[e+1]<<8},"readUInt16LE");y.prototype.readUint16BE=y.prototype.readUInt16BE=s(function(e,i){return e=e>>>0,i||X(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");y.prototype.readUint32LE=y.prototype.readUInt32LE=s(function(e,i){return e=e>>>0,i||X(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE");y.prototype.readUint32BE=y.prototype.readUInt32BE=s(function(e,i){return e=e>>>0,i||X(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"readUInt32BE");y.prototype.readBigUInt64LE=ft(s(function(e){e=e>>>0,ei(e,"offset");let i=this[e],n=this[e+7];(i===void 0||n===void 0)&&Hi(e,this.length-8);let r=i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))},"readBigUInt64LE"));y.prototype.readBigUInt64BE=ft(s(function(e){e=e>>>0,ei(e,"offset");let i=this[e],n=this[e+7];(i===void 0||n===void 0)&&Hi(e,this.length-8);let r=i*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(o)},"readBigUInt64BE"));y.prototype.readIntLE=s(function(e,i,n){e=e>>>0,i=i>>>0,n||X(e,i,this.length);let r=this[e],o=1,a=0;for(;++a<i&&(o*=256);)r+=this[e+a]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*i)),r},"readIntLE");y.prototype.readIntBE=s(function(e,i,n){e=e>>>0,i=i>>>0,n||X(e,i,this.length);let r=i,o=1,a=this[e+--r];for(;r>0&&(o*=256);)a+=this[e+--r]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*i)),a},"readIntBE");y.prototype.readInt8=s(function(e,i){return e=e>>>0,i||X(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8");y.prototype.readInt16LE=s(function(e,i){e=e>>>0,i||X(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},"readInt16LE");y.prototype.readInt16BE=s(function(e,i){e=e>>>0,i||X(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},"readInt16BE");y.prototype.readInt32LE=s(function(e,i){return e=e>>>0,i||X(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");y.prototype.readInt32BE=s(function(e,i){return e=e>>>0,i||X(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");y.prototype.readBigInt64LE=ft(s(function(e){e=e>>>0,ei(e,"offset");let i=this[e],n=this[e+7];(i===void 0||n===void 0)&&Hi(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)},"readBigInt64LE"));y.prototype.readBigInt64BE=ft(s(function(e){e=e>>>0,ei(e,"offset");let i=this[e],n=this[e+7];(i===void 0||n===void 0)&&Hi(e,this.length-8);let r=(i<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)},"readBigInt64BE"));y.prototype.readFloatLE=s(function(e,i){return e=e>>>0,i||X(e,4,this.length),Zt.read(this,e,!0,23,4)},"readFloatLE");y.prototype.readFloatBE=s(function(e,i){return e=e>>>0,i||X(e,4,this.length),Zt.read(this,e,!1,23,4)},"readFloatBE");y.prototype.readDoubleLE=s(function(e,i){return e=e>>>0,i||X(e,8,this.length),Zt.read(this,e,!0,52,8)},"readDoubleLE");y.prototype.readDoubleBE=s(function(e,i){return e=e>>>0,i||X(e,8,this.length),Zt.read(this,e,!1,52,8)},"readDoubleBE");function ae(t,e,i,n,r,o){if(!y.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<o)throw new RangeError('"value" argument is out of bounds');if(i+n>t.length)throw new RangeError("Index out of range")}s(ae,"checkInt");y.prototype.writeUintLE=y.prototype.writeUIntLE=s(function(e,i,n,r){if(e=+e,i=i>>>0,n=n>>>0,!r){let l=Math.pow(2,8*n)-1;ae(this,e,i,n,l,0)}let o=1,a=0;for(this[i]=e&255;++a<n&&(o*=256);)this[i+a]=e/o&255;return i+n},"writeUIntLE");y.prototype.writeUintBE=y.prototype.writeUIntBE=s(function(e,i,n,r){if(e=+e,i=i>>>0,n=n>>>0,!r){let l=Math.pow(2,8*n)-1;ae(this,e,i,n,l,0)}let o=n-1,a=1;for(this[i+o]=e&255;--o>=0&&(a*=256);)this[i+o]=e/a&255;return i+n},"writeUIntBE");y.prototype.writeUint8=y.prototype.writeUInt8=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,1,255,0),this[i]=e&255,i+1},"writeUInt8");y.prototype.writeUint16LE=y.prototype.writeUInt16LE=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,2,65535,0),this[i]=e&255,this[i+1]=e>>>8,i+2},"writeUInt16LE");y.prototype.writeUint16BE=y.prototype.writeUInt16BE=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,2,65535,0),this[i]=e>>>8,this[i+1]=e&255,i+2},"writeUInt16BE");y.prototype.writeUint32LE=y.prototype.writeUInt32LE=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,4,4294967295,0),this[i+3]=e>>>24,this[i+2]=e>>>16,this[i+1]=e>>>8,this[i]=e&255,i+4},"writeUInt32LE");y.prototype.writeUint32BE=y.prototype.writeUInt32BE=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,4,4294967295,0),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4},"writeUInt32BE");function ya(t,e,i,n,r){Sa(e,n,r,t,i,7);let o=Number(e&BigInt(4294967295));t[i++]=o,o=o>>8,t[i++]=o,o=o>>8,t[i++]=o,o=o>>8,t[i++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[i++]=a,a=a>>8,t[i++]=a,a=a>>8,t[i++]=a,a=a>>8,t[i++]=a,i}s(ya,"wrtBigUInt64LE");function ma(t,e,i,n,r){Sa(e,n,r,t,i,7);let o=Number(e&BigInt(4294967295));t[i+7]=o,o=o>>8,t[i+6]=o,o=o>>8,t[i+5]=o,o=o>>8,t[i+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[i+3]=a,a=a>>8,t[i+2]=a,a=a>>8,t[i+1]=a,a=a>>8,t[i]=a,i+8}s(ma,"wrtBigUInt64BE");y.prototype.writeBigUInt64LE=ft(s(function(e,i=0){return ya(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE"));y.prototype.writeBigUInt64BE=ft(s(function(e,i=0){return ma(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE"));y.prototype.writeIntLE=s(function(e,i,n,r){if(e=+e,i=i>>>0,!r){let c=Math.pow(2,8*n-1);ae(this,e,i,n,c-1,-c)}let o=0,a=1,l=0;for(this[i]=e&255;++o<n&&(a*=256);)e<0&&l===0&&this[i+o-1]!==0&&(l=1),this[i+o]=(e/a>>0)-l&255;return i+n},"writeIntLE");y.prototype.writeIntBE=s(function(e,i,n,r){if(e=+e,i=i>>>0,!r){let c=Math.pow(2,8*n-1);ae(this,e,i,n,c-1,-c)}let o=n-1,a=1,l=0;for(this[i+o]=e&255;--o>=0&&(a*=256);)e<0&&l===0&&this[i+o+1]!==0&&(l=1),this[i+o]=(e/a>>0)-l&255;return i+n},"writeIntBE");y.prototype.writeInt8=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,1,127,-128),e<0&&(e=255+e+1),this[i]=e&255,i+1},"writeInt8");y.prototype.writeInt16LE=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,2,32767,-32768),this[i]=e&255,this[i+1]=e>>>8,i+2},"writeInt16LE");y.prototype.writeInt16BE=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,2,32767,-32768),this[i]=e>>>8,this[i+1]=e&255,i+2},"writeInt16BE");y.prototype.writeInt32LE=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,4,2147483647,-2147483648),this[i]=e&255,this[i+1]=e>>>8,this[i+2]=e>>>16,this[i+3]=e>>>24,i+4},"writeInt32LE");y.prototype.writeInt32BE=s(function(e,i,n){return e=+e,i=i>>>0,n||ae(this,e,i,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4},"writeInt32BE");y.prototype.writeBigInt64LE=ft(s(function(e,i=0){return ya(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));y.prototype.writeBigInt64BE=ft(s(function(e,i=0){return ma(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function ba(t,e,i,n,r,o){if(i+n>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}s(ba,"checkIEEE754");function ga(t,e,i,n,r){return e=+e,i=i>>>0,r||ba(t,e,i,4,34028234663852886e22,-34028234663852886e22),Zt.write(t,e,i,n,23,4),i+4}s(ga,"writeFloat");y.prototype.writeFloatLE=s(function(e,i,n){return ga(this,e,i,!0,n)},"writeFloatLE");y.prototype.writeFloatBE=s(function(e,i,n){return ga(this,e,i,!1,n)},"writeFloatBE");function wa(t,e,i,n,r){return e=+e,i=i>>>0,r||ba(t,e,i,8,17976931348623157e292,-17976931348623157e292),Zt.write(t,e,i,n,52,8),i+8}s(wa,"writeDouble");y.prototype.writeDoubleLE=s(function(e,i,n){return wa(this,e,i,!0,n)},"writeDoubleLE");y.prototype.writeDoubleBE=s(function(e,i,n){return wa(this,e,i,!1,n)},"writeDoubleBE");y.prototype.copy=s(function(e,i,n,r){if(!y.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!r&&r!==0&&(r=this.length),i>=e.length&&(i=e.length),i||(i=0),r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-i<r-n&&(r=e.length-i+n);let o=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(i,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),i),o},"copy");y.prototype.fill=s(function(e,i,n,r){if(typeof e=="string"){if(typeof i=="string"?(r=i,i=0,n=this.length):typeof n=="string"&&(r=n,n=this.length),r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!y.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(e.length===1){let a=e.charCodeAt(0);(r==="utf8"&&a<128||r==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(i<0||this.length<i||this.length<n)throw new RangeError("Out of range index");if(n<=i)return this;i=i>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=i;o<n;++o)this[o]=e;else{let a=y.isBuffer(e)?e:y.from(e,r),l=a.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-i;++o)this[o+i]=a[o%l]}return this},"fill");var Qt={};function no(t,e,i){Qt[t]=class extends i{static{s(this,"NodeError")}constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(r){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:r,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}s(no,"E");no("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);no("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);no("ERR_OUT_OF_RANGE",function(t,e,i){let n=`The value of "${t}" is out of range.`,r=i;return Number.isInteger(i)&&Math.abs(i)>2**32?r=ca(String(i)):typeof i=="bigint"&&(r=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(r=ca(r)),r+="n"),n+=` It must be ${e}. Received ${r}`,n},RangeError);function ca(t){let e="",i=t.length,n=t[0]==="-"?1:0;for(;i>=n+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}s(ca,"addNumericalSeparator");function ph(t,e,i){ei(e,"offset"),(t[e]===void 0||t[e+i]===void 0)&&Hi(e,t.length-(i+1))}s(ph,"checkBounds");function Sa(t,e,i,n,r,o){if(t>i||t<e){let a=typeof e=="bigint"?"n":"",l;throw o>3?e===0||e===BigInt(0)?l=`>= 0${a} and < 2${a} ** ${(o+1)*8}${a}`:l=`>= -(2${a} ** ${(o+1)*8-1}${a}) and < 2 ** ${(o+1)*8-1}${a}`:l=`>= ${e}${a} and <= ${i}${a}`,new Qt.ERR_OUT_OF_RANGE("value",l,t)}ph(n,r,o)}s(Sa,"checkIntBI");function ei(t,e){if(typeof t!="number")throw new Qt.ERR_INVALID_ARG_TYPE(e,"number",t)}s(ei,"validateNumber");function Hi(t,e,i){throw Math.floor(t)!==t?(ei(t,i),new Qt.ERR_OUT_OF_RANGE(i||"offset","an integer",t)):e<0?new Qt.ERR_BUFFER_OUT_OF_BOUNDS:new Qt.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${e}`,t)}s(Hi,"boundsError");var yh=/[^+/0-9A-Za-z-_]/g;function mh(t){if(t=t.split("=")[0],t=t.trim().replace(yh,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}s(mh,"base64clean");function eo(t,e){e=e||1/0;let i,n=t.length,r=null,o=[];for(let a=0;a<n;++a){if(i=t.charCodeAt(a),i>55295&&i<57344){if(!r){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}r=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),r=i;continue}i=(r-55296<<10|i-56320)+65536}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,i&63|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return o}s(eo,"utf8ToBytes");function bh(t){let e=[];for(let i=0;i<t.length;++i)e.push(t.charCodeAt(i)&255);return e}s(bh,"asciiToBytes");function gh(t,e){let i,n,r,o=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)i=t.charCodeAt(a),n=i>>8,r=i%256,o.push(r),o.push(n);return o}s(gh,"utf16leToBytes");function _a(t){return Jr.toByteArray(mh(t))}s(_a,"base64ToBytes");function Ln(t,e,i,n){let r;for(r=0;r<n&&!(r+i>=e.length||r>=t.length);++r)e[r+i]=t[r];return r}s(Ln,"blitBuffer");function We(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}s(We,"isInstance");function ro(t){return t!==t}s(ro,"numberIsNaN");var wh=function(){let t="0123456789abcdef",e=new Array(256);for(let i=0;i<16;++i){let n=i*16;for(let r=0;r<16;++r)e[n+r]=t[i]+t[r]}return e}();function ft(t){return typeof BigInt>"u"?Sh:t}s(ft,"defineBigIntMethod");function Sh(){throw new Error("BigInt not supported")}s(Sh,"BufferBigIntNotDefined")});var W=A((m_,Ha)=>{"use strict";Ha.exports={ArrayIsArray:s(function(t){return Array.isArray(t)},"ArrayIsArray"),ArrayPrototypeIncludes:s(function(t,e){return t.includes(e)},"ArrayPrototypeIncludes"),ArrayPrototypeIndexOf:s(function(t,e){return t.indexOf(e)},"ArrayPrototypeIndexOf"),ArrayPrototypeJoin:s(function(t,e){return t.join(e)},"ArrayPrototypeJoin"),ArrayPrototypeMap:s(function(t,e){return t.map(e)},"ArrayPrototypeMap"),ArrayPrototypePop:s(function(t,e){return t.pop(e)},"ArrayPrototypePop"),ArrayPrototypePush:s(function(t,e){return t.push(e)},"ArrayPrototypePush"),ArrayPrototypeSlice:s(function(t,e,i){return t.slice(e,i)},"ArrayPrototypeSlice"),Error,FunctionPrototypeCall:s(function(t,e,...i){return t.call(e,...i)},"FunctionPrototypeCall"),FunctionPrototypeSymbolHasInstance:s(function(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},"FunctionPrototypeSymbolHasInstance"),MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:s(function(t,e){return Object.defineProperties(t,e)},"ObjectDefineProperties"),ObjectDefineProperty:s(function(t,e,i){return Object.defineProperty(t,e,i)},"ObjectDefineProperty"),ObjectGetOwnPropertyDescriptor:s(function(t,e){return Object.getOwnPropertyDescriptor(t,e)},"ObjectGetOwnPropertyDescriptor"),ObjectKeys:s(function(t){return Object.keys(t)},"ObjectKeys"),ObjectSetPrototypeOf:s(function(t,e){return Object.setPrototypeOf(t,e)},"ObjectSetPrototypeOf"),Promise,PromisePrototypeCatch:s(function(t,e){return t.catch(e)},"PromisePrototypeCatch"),PromisePrototypeThen:s(function(t,e,i){return t.then(e,i)},"PromisePrototypeThen"),PromiseReject:s(function(t){return Promise.reject(t)},"PromiseReject"),PromiseResolve:s(function(t){return Promise.resolve(t)},"PromiseResolve"),ReflectApply:Reflect.apply,RegExpPrototypeTest:s(function(t,e){return t.test(e)},"RegExpPrototypeTest"),SafeSet:Set,String,StringPrototypeSlice:s(function(t,e,i){return t.slice(e,i)},"StringPrototypeSlice"),StringPrototypeToLowerCase:s(function(t){return t.toLowerCase()},"StringPrototypeToLowerCase"),StringPrototypeToUpperCase:s(function(t){return t.toUpperCase()},"StringPrototypeToUpperCase"),StringPrototypeTrim:s(function(t){return t.trim()},"StringPrototypeTrim"),Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet:s(function(t,e,i){return t.set(e,i)},"TypedArrayPrototypeSet"),Boolean,Uint8Array}});var ai=A((g_,jn)=>{"use strict";var{AbortController:Ya,AbortSignal:kh}=typeof self<"u"?self:typeof window<"u"?window:void 0;jn.exports=Ya;jn.exports.AbortSignal=kh;jn.exports.default=Ya});var Zi=A((w_,po)=>{"use strict";var li=typeof Reflect=="object"?Reflect:null,Ga=li&&typeof li.apply=="function"?li.apply:s(function(e,i,n){return Function.prototype.apply.call(e,i,n)},"ReflectApply"),$n;li&&typeof li.ownKeys=="function"?$n=li.ownKeys:Object.getOwnPropertySymbols?$n=s(function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):$n=s(function(e){return Object.getOwnPropertyNames(e)},"ReflectOwnKeys");function Fh(t){console&&console.warn&&console.warn(t)}s(Fh,"ProcessEmitWarning");var Xa=Number.isNaN||s(function(e){return e!==e},"NumberIsNaN");function O(){O.init.call(this)}s(O,"EventEmitter");po.exports=O;po.exports.once=Ah;O.EventEmitter=O;O.prototype._events=void 0;O.prototype._eventsCount=0;O.prototype._maxListeners=void 0;var Ka=10;function Vn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}s(Vn,"checkListener");Object.defineProperty(O,"defaultMaxListeners",{enumerable:!0,get:s(function(){return Ka},"get"),set:s(function(t){if(typeof t!="number"||t<0||Xa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ka=t},"set")});O.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};O.prototype.setMaxListeners=s(function(e){if(typeof e!="number"||e<0||Xa(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},"setMaxListeners");function Ja(t){return t._maxListeners===void 0?O.defaultMaxListeners:t._maxListeners}s(Ja,"_getMaxListeners");O.prototype.getMaxListeners=s(function(){return Ja(this)},"getMaxListeners");O.prototype.emit=s(function(e){for(var i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);var r=e==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var a;if(i.length>0&&(a=i[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var c=o[e];if(c===void 0)return!1;if(typeof c=="function")Ga(c,this,i);else for(var u=c.length,h=il(c,u),n=0;n<u;++n)Ga(h[n],this,i);return!0},"emit");function Qa(t,e,i,n){var r,o,a;if(Vn(i),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,i.listener?i.listener:i),o=t._events),a=o[e]),a===void 0)a=o[e]=i,++t._eventsCount;else if(typeof a=="function"?a=o[e]=n?[i,a]:[a,i]:n?a.unshift(i):a.push(i),r=Ja(t),r>0&&a.length>r&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,Fh(l)}return t}s(Qa,"_addListener");O.prototype.addListener=s(function(e,i){return Qa(this,e,i,!1)},"addListener");O.prototype.on=O.prototype.addListener;O.prototype.prependListener=s(function(e,i){return Qa(this,e,i,!0)},"prependListener");function vh(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}s(vh,"onceWrapper");function Za(t,e,i){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},r=vh.bind(n);return r.listener=i,n.wrapFn=r,r}s(Za,"_onceWrap");O.prototype.once=s(function(e,i){return Vn(i),this.on(e,Za(this,e,i)),this},"once");O.prototype.prependOnceListener=s(function(e,i){return Vn(i),this.prependListener(e,Za(this,e,i)),this},"prependOnceListener");O.prototype.removeListener=s(function(e,i){var n,r,o,a,l;if(Vn(i),r=this._events,r===void 0)return this;if(n=r[e],n===void 0)return this;if(n===i||n.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||i));else if(typeof n!="function"){for(o=-1,a=n.length-1;a>=0;a--)if(n[a]===i||n[a].listener===i){l=n[a].listener,o=a;break}if(o<0)return this;o===0?n.shift():Ih(n,o),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",e,l||i)}return this},"removeListener");O.prototype.off=O.prototype.removeListener;O.prototype.removeAllListeners=s(function(e){var i,n,r;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var o=Object.keys(n),a;for(r=0;r<o.length;++r)a=o[r],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=n[e],typeof i=="function")this.removeListener(e,i);else if(i!==void 0)for(r=i.length-1;r>=0;r--)this.removeListener(e,i[r]);return this},"removeAllListeners");function el(t,e,i){var n=t._events;if(n===void 0)return[];var r=n[e];return r===void 0?[]:typeof r=="function"?i?[r.listener||r]:[r]:i?Ph(r):il(r,r.length)}s(el,"_listeners");O.prototype.listeners=s(function(e){return el(this,e,!0)},"listeners");O.prototype.rawListeners=s(function(e){return el(this,e,!1)},"rawListeners");O.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):tl.call(t,e)};O.prototype.listenerCount=tl;function tl(t){var e=this._events;if(e!==void 0){var i=e[t];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}s(tl,"listenerCount");O.prototype.eventNames=s(function(){return this._eventsCount>0?$n(this._events):[]},"eventNames");function il(t,e){for(var i=new Array(e),n=0;n<e;++n)i[n]=t[n];return i}s(il,"arrayClone");function Ih(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}s(Ih,"spliceOne");function Ph(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}s(Ph,"unwrapListeners");function Ah(t,e){return new Promise(function(i,n){function r(a){t.removeListener(e,o),n(a)}s(r,"errorListener");function o(){typeof t.removeListener=="function"&&t.removeListener("error",r),i([].slice.call(arguments))}s(o,"resolver"),nl(t,e,o,{once:!0}),e!=="error"&&Th(t,r,{once:!0})})}s(Ah,"once");function Th(t,e,i){typeof t.on=="function"&&nl(t,"error",e,i)}s(Th,"addErrorHandlerIfEventEmitter");function nl(t,e,i,n){if(typeof t.on=="function")n.once?t.once(e,i):t.on(e,i);else if(typeof t.addEventListener=="function")t.addEventListener(e,s(function r(o){n.once&&t.removeEventListener(e,r),i(o)},"wrapListener"));else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}s(nl,"eventTargetAgnosticAddListener")});var Z=A((__,mo)=>{"use strict";var Oh=Ee(),{kResistStopPropagation:Ch,SymbolDispose:Rh}=W(),Lh=globalThis.AbortSignal||ai().AbortSignal,Nh=globalThis.AbortController||ai().AbortController,Dh=Object.getPrototypeOf(async function(){}).constructor,rl=globalThis.Blob||Oh.Blob,Bh=s(typeof rl<"u"?function(e){return e instanceof rl}:function(e){return!1},"isBlob"),ol=s((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},"validateAbortSignal"),Mh=s((t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},"validateFunction"),yo=class extends Error{static{s(this,"AggregateError")}constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let i="";for(let n=0;n<e.length;n++)i+=` ${e[n].stack}
2
+ `;super(i),this.name="AggregateError",this.errors=e}};mo.exports={AggregateError:yo,kEmptyObject:Object.freeze({}),once:s(function(t){let e=!1;return function(...i){e||(e=!0,t.apply(this,i))}},"once"),createDeferredPromise:s(function(){let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}},"createDeferredPromise"),promisify:s(function(t){return new Promise((e,i)=>{t((n,...r)=>n?i(n):e(...r))})},"promisify"),debuglog:s(function(){return function(){}},"debuglog"),format:s(function(t,...e){return t.replace(/%([sdifj])/g,function(...[i,n]){let r=e.shift();return n==="f"?r.toFixed(6):n==="j"?JSON.stringify(r):n==="s"&&typeof r=="object"?`${r.constructor!==Object?r.constructor.name:""} {}`.trim():r.toString()})},"format"),inspect:s(function(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},"inspect"),types:{isAsyncFunction:s(function(t){return t instanceof Dh},"isAsyncFunction"),isArrayBufferView:s(function(t){return ArrayBuffer.isView(t)},"isArrayBufferView")},isBlob:Bh,deprecate:s(function(t,e){return t},"deprecate"),addAbortListener:Zi().addAbortListener||s(function(e,i){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);ol(e,"signal"),Mh(i,"listener");let n;return e.aborted?queueMicrotask(()=>i()):(e.addEventListener("abort",i,{__proto__:null,once:!0,[Ch]:!0}),n=s(()=>{e.removeEventListener("abort",i)},"removeEventListener")),{__proto__:null,[Rh](){var r;(r=n)===null||r===void 0||r()}}},"addAbortListener"),AbortSignalAny:Lh.any||s(function(e){if(e.length===1)return e[0];let i=new Nh,n=s(()=>i.abort(),"abort");return e.forEach(r=>{ol(r,"signals"),r.addEventListener("abort",n,{once:!0})}),i.signal.addEventListener("abort",()=>{e.forEach(r=>r.removeEventListener("abort",n))},{once:!0}),i.signal},"AbortSignalAny")};mo.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ne=A((x_,ll)=>{"use strict";var{format:Wh,inspect:zn,AggregateError:Uh}=Z(),qh=globalThis.AggregateError||Uh,jh=Symbol("kIsNodeError"),$h=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Vh=/^([A-Z][a-z0-9]*)+$/,zh="__node_internal_",Hn={};function Lt(t,e){if(!t)throw new Hn.ERR_INTERNAL_ASSERTION(e)}s(Lt,"assert");function sl(t){let e="",i=t.length,n=t[0]==="-"?1:0;for(;i>=n+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}s(sl,"addNumericalSeparator");function Hh(t,e,i){if(typeof e=="function")return Lt(e.length<=i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${e.length}).`),e(...i);let n=(e.match(/%[dfijoOs]/g)||[]).length;return Lt(n===i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${n}).`),i.length===0?e:Wh(e,...i)}s(Hh,"getMessage");function Q(t,e,i){i||(i=Error);class n extends i{static{s(this,"NodeError")}constructor(...o){super(Hh(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:i.name,writable:!0,enumerable:!1,configurable:!0},toString:{value:s(function(){return`${this.name} [${t}]: ${this.message}`},"value"),writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[jh]=!0,Hn[t]=n}s(Q,"E");function al(t){let e=zh+t.name;return Object.defineProperty(t,"name",{value:e}),t}s(al,"hideStackFrames");function Yh(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let i=new qh([e,t],e.message);return i.code=e.code,i}return t||e}s(Yh,"aggregateTwoErrors");var bo=class extends Error{static{s(this,"AbortError")}constructor(e="The operation was aborted",i=void 0){if(i!==void 0&&typeof i!="object")throw new Hn.ERR_INVALID_ARG_TYPE("options","Object",i);super(e,i),this.code="ABORT_ERR",this.name="AbortError"}};Q("ERR_ASSERTION","%s",Error);Q("ERR_INVALID_ARG_TYPE",(t,e,i)=>{Lt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let r=[],o=[],a=[];for(let c of e)Lt(typeof c=="string","All expected entries have to be of type string"),$h.includes(c)?r.push(c.toLowerCase()):Vh.test(c)?o.push(c):(Lt(c!=="object",'The value "object" should be written as "Object"'),a.push(c));if(o.length>0){let c=r.indexOf("object");c!==-1&&(r.splice(r,c,1),o.push("Object"))}if(r.length>0){switch(r.length){case 1:n+=`of type ${r[0]}`;break;case 2:n+=`one of type ${r[0]} or ${r[1]}`;break;default:{let c=r.pop();n+=`one of type ${r.join(", ")}, or ${c}`}}(o.length>0||a.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let c=o.pop();n+=`an instance of ${o.join(", ")}, or ${c}`}}a.length>0&&(n+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`;break;case 2:n+=`one of ${a[0]} or ${a[1]}`;break;default:{let c=a.pop();n+=`one of ${a.join(", ")}, or ${c}`}}if(i==null)n+=`. Received ${i}`;else if(typeof i=="function"&&i.name)n+=`. Received function ${i.name}`;else if(typeof i=="object"){var l;if((l=i.constructor)!==null&&l!==void 0&&l.name)n+=`. Received an instance of ${i.constructor.name}`;else{let c=zn(i,{depth:-1});n+=`. Received ${c}`}}else{let c=zn(i,{colors:!1});c.length>25&&(c=`${c.slice(0,25)}...`),n+=`. Received type ${typeof i} (${c})`}return n},TypeError);Q("ERR_INVALID_ARG_VALUE",(t,e,i="is invalid")=>{let n=zn(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${i}. Received ${n}`},TypeError);Q("ERR_INVALID_RETURN_VALUE",(t,e,i)=>{var n;let r=i!=null&&(n=i.constructor)!==null&&n!==void 0&&n.name?`instance of ${i.constructor.name}`:`type ${typeof i}`;return`Expected ${t} to be returned from the "${e}" function but got ${r}.`},TypeError);Q("ERR_MISSING_ARGS",(...t)=>{Lt(t.length>0,"At least one arg needs to be specified");let e,i=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),i){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);Q("ERR_OUT_OF_RANGE",(t,e,i)=>{Lt(e,'Missing "range" argument');let n;return Number.isInteger(i)&&Math.abs(i)>2**32?n=sl(String(i)):typeof i=="bigint"?(n=String(i),(i>2n**32n||i<-(2n**32n))&&(n=sl(n)),n+="n"):n=zn(i),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Q("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Q("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Q("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Q("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Q("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);ll.exports={AbortError:bo,aggregateTwoErrors:al(Yh),hideStackFrames:al,codes:Hn}});var fi=A((F_,gl)=>{"use strict";var{ArrayIsArray:wo,ArrayPrototypeIncludes:dl,ArrayPrototypeJoin:hl,ArrayPrototypeMap:Gh,NumberIsInteger:So,NumberIsNaN:Kh,NumberMAX_SAFE_INTEGER:Xh,NumberMIN_SAFE_INTEGER:Jh,NumberParseInt:Qh,ObjectPrototypeHasOwnProperty:Zh,RegExpPrototypeExec:pl,String:ep,StringPrototypeToUpperCase:tp,StringPrototypeTrim:ip}=W(),{hideStackFrames:Se,codes:{ERR_SOCKET_BAD_PORT:np,ERR_INVALID_ARG_TYPE:ee,ERR_INVALID_ARG_VALUE:ci,ERR_OUT_OF_RANGE:Nt,ERR_UNKNOWN_SIGNAL:cl}}=ne(),{normalizeEncoding:rp}=Z(),{isAsyncFunction:op,isArrayBufferView:sp}=Z().types,fl={};function ap(t){return t===(t|0)}s(ap,"isInt32");function lp(t){return t===t>>>0}s(lp,"isUint32");var cp=/^[0-7]+$/,fp="must be a 32-bit unsigned integer or an octal string";function up(t,e,i){if(typeof t>"u"&&(t=i),typeof t=="string"){if(pl(cp,t)===null)throw new ci(e,t,fp);t=Qh(t,8)}return yl(t,e),t}s(up,"parseFileMode");var dp=Se((t,e,i=Jh,n=Xh)=>{if(typeof t!="number")throw new ee(e,"number",t);if(!So(t))throw new Nt(e,"an integer",t);if(t<i||t>n)throw new Nt(e,`>= ${i} && <= ${n}`,t)}),hp=Se((t,e,i=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new ee(e,"number",t);if(!So(t))throw new Nt(e,"an integer",t);if(t<i||t>n)throw new Nt(e,`>= ${i} && <= ${n}`,t)}),yl=Se((t,e,i=!1)=>{if(typeof t!="number")throw new ee(e,"number",t);if(!So(t))throw new Nt(e,"an integer",t);let n=i?1:0,r=4294967295;if(t<n||t>r)throw new Nt(e,`>= ${n} && <= ${r}`,t)});function _o(t,e){if(typeof t!="string")throw new ee(e,"string",t)}s(_o,"validateString");function pp(t,e,i=void 0,n){if(typeof t!="number")throw new ee(e,"number",t);if(i!=null&&t<i||n!=null&&t>n||(i!=null||n!=null)&&Kh(t))throw new Nt(e,`${i!=null?`>= ${i}`:""}${i!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}s(pp,"validateNumber");var yp=Se((t,e,i)=>{if(!dl(i,t)){let r="must be one of: "+hl(Gh(i,o=>typeof o=="string"?`'${o}'`:ep(o)),", ");throw new ci(e,t,r)}});function ml(t,e){if(typeof t!="boolean")throw new ee(e,"boolean",t)}s(ml,"validateBoolean");function go(t,e,i){return t==null||!Zh(t,e)?i:t[e]}s(go,"getOwnPropertyValueOrDefault");var mp=Se((t,e,i=null)=>{let n=go(i,"allowArray",!1),r=go(i,"allowFunction",!1);if(!go(i,"nullable",!1)&&t===null||!n&&wo(t)||typeof t!="object"&&(!r||typeof t!="function"))throw new ee(e,"Object",t)}),bp=Se((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new ee(e,"a dictionary",t)}),Yn=Se((t,e,i=0)=>{if(!wo(t))throw new ee(e,"Array",t);if(t.length<i){let n=`must be longer than ${i}`;throw new ci(e,t,n)}});function gp(t,e){Yn(t,e);for(let i=0;i<t.length;i++)_o(t[i],`${e}[${i}]`)}s(gp,"validateStringArray");function wp(t,e){Yn(t,e);for(let i=0;i<t.length;i++)ml(t[i],`${e}[${i}]`)}s(wp,"validateBooleanArray");function Sp(t,e){Yn(t,e);for(let i=0;i<t.length;i++){let n=t[i],r=`${e}[${i}]`;if(n==null)throw new ee(r,"AbortSignal",n);bl(n,r)}}s(Sp,"validateAbortSignalArray");function _p(t,e="signal"){if(_o(t,e),fl[t]===void 0)throw fl[tp(t)]!==void 0?new cl(t+" (signals must use all capital letters)"):new cl(t)}s(_p,"validateSignalName");var Ep=Se((t,e="buffer")=>{if(!sp(t))throw new ee(e,["Buffer","TypedArray","DataView"],t)});function xp(t,e){let i=rp(e),n=t.length;if(i==="hex"&&n%2!==0)throw new ci("encoding",e,`is invalid for data of length ${n}`)}s(xp,"validateEncoding");function kp(t,e="Port",i=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&ip(t).length===0||+t!==+t>>>0||t>65535||t===0&&!i)throw new np(e,t,i);return t|0}s(kp,"validatePort");var bl=Se((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ee(e,"AbortSignal",t)}),Fp=Se((t,e)=>{if(typeof t!="function")throw new ee(e,"Function",t)}),vp=Se((t,e)=>{if(typeof t!="function"||op(t))throw new ee(e,"Function",t)}),Ip=Se((t,e)=>{if(t!==void 0)throw new ee(e,"undefined",t)});function Pp(t,e,i){if(!dl(i,t))throw new ee(e,`('${hl(i,"|")}')`,t)}s(Pp,"validateUnion");var Ap=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ul(t,e){if(typeof t>"u"||!pl(Ap,t))throw new ci(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}s(ul,"validateLinkHeaderFormat");function Tp(t){if(typeof t=="string")return ul(t,"hints"),t;if(wo(t)){let e=t.length,i="";if(e===0)return i;for(let n=0;n<e;n++){let r=t[n];ul(r,"hints"),i+=r,n!==e-1&&(i+=", ")}return i}throw new ci("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}s(Tp,"validateLinkHeaderValue");gl.exports={isInt32:ap,isUint32:lp,parseFileMode:up,validateArray:Yn,validateStringArray:gp,validateBooleanArray:wp,validateAbortSignalArray:Sp,validateBoolean:ml,validateBuffer:Ep,validateDictionary:bp,validateEncoding:xp,validateFunction:Fp,validateInt32:hp,validateInteger:dp,validateNumber:pp,validateObject:mp,validateOneOf:yp,validatePlainFunction:vp,validatePort:kp,validateSignalName:_p,validateString:_o,validateUint32:yl,validateUndefined:Ip,validateUnion:Pp,validateAbortSignal:bl,validateLinkHeaderValue:Tp}});var pt=A((I_,El)=>{var j=El.exports={},Ue,qe;function Eo(){throw new Error("setTimeout has not been defined")}s(Eo,"defaultSetTimout");function xo(){throw new Error("clearTimeout has not been defined")}s(xo,"defaultClearTimeout");(function(){try{typeof setTimeout=="function"?Ue=setTimeout:Ue=Eo}catch{Ue=Eo}try{typeof clearTimeout=="function"?qe=clearTimeout:qe=xo}catch{qe=xo}})();function wl(t){if(Ue===setTimeout)return setTimeout(t,0);if((Ue===Eo||!Ue)&&setTimeout)return Ue=setTimeout,setTimeout(t,0);try{return Ue(t,0)}catch{try{return Ue.call(null,t,0)}catch{return Ue.call(this,t,0)}}}s(wl,"runTimeout");function Op(t){if(qe===clearTimeout)return clearTimeout(t);if((qe===xo||!qe)&&clearTimeout)return qe=clearTimeout,clearTimeout(t);try{return qe(t)}catch{try{return qe.call(null,t)}catch{return qe.call(this,t)}}}s(Op,"runClearTimeout");var Ze=[],ui=!1,Dt,Gn=-1;function Cp(){!ui||!Dt||(ui=!1,Dt.length?Ze=Dt.concat(Ze):Gn=-1,Ze.length&&Sl())}s(Cp,"cleanUpNextTick");function Sl(){if(!ui){var t=wl(Cp);ui=!0;for(var e=Ze.length;e;){for(Dt=Ze,Ze=[];++Gn<e;)Dt&&Dt[Gn].run();Gn=-1,e=Ze.length}Dt=null,ui=!1,Op(t)}}s(Sl,"drainQueue");j.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];Ze.push(new _l(t,e)),Ze.length===1&&!ui&&wl(Sl)};function _l(t,e){this.fun=t,this.array=e}s(_l,"Item");_l.prototype.run=function(){this.fun.apply(null,this.array)};j.title="browser";j.browser=!0;j.env={};j.argv=[];j.version="";j.versions={};function et(){}s(et,"noop");j.on=et;j.addListener=et;j.once=et;j.off=et;j.removeListener=et;j.removeAllListeners=et;j.emit=et;j.prependListener=et;j.prependOnceListener=et;j.listeners=function(t){return[]};j.binding=function(t){throw new Error("process.binding is not supported")};j.cwd=function(){return"/"};j.chdir=function(t){throw new Error("process.chdir is not supported")};j.umask=function(){return 0}});var $e=A((A_,Bl)=>{"use strict";var{SymbolAsyncIterator:xl,SymbolIterator:kl,SymbolFor:Bt}=W(),Fl=Bt("nodejs.stream.destroyed"),vl=Bt("nodejs.stream.errored"),ko=Bt("nodejs.stream.readable"),Fo=Bt("nodejs.stream.writable"),Il=Bt("nodejs.stream.disturbed"),Rp=Bt("nodejs.webstream.isClosedPromise"),Lp=Bt("nodejs.webstream.controllerErrorFunction");function Kn(t,e=!1){var i;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((i=t._readableState)===null||i===void 0?void 0:i.readable)!==!1)&&(!t._writableState||t._readableState))}s(Kn,"isReadableNodeStream");function Xn(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}s(Xn,"isWritableNodeStream");function Np(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}s(Np,"isDuplexNodeStream");function je(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}s(je,"isNodeStream");function Pl(t){return!!(t&&!je(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}s(Pl,"isReadableStream");function Al(t){return!!(t&&!je(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}s(Al,"isWritableStream");function Tl(t){return!!(t&&!je(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}s(Tl,"isTransformStream");function Dp(t){return Pl(t)||Al(t)||Tl(t)}s(Dp,"isWebStream");function Bp(t,e){return t==null?!1:e===!0?typeof t[xl]=="function":e===!1?typeof t[kl]=="function":typeof t[xl]=="function"||typeof t[kl]=="function"}s(Bp,"isIterable");function Jn(t){if(!je(t))return null;let e=t._writableState,i=t._readableState,n=e||i;return!!(t.destroyed||t[Fl]||n!=null&&n.destroyed)}s(Jn,"isDestroyed");function Ol(t){if(!Xn(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}s(Ol,"isWritableEnded");function Mp(t,e){if(!Xn(t))return null;if(t.writableFinished===!0)return!0;let i=t._writableState;return i!=null&&i.errored?!1:typeof i?.finished!="boolean"?null:!!(i.finished||e===!1&&i.ended===!0&&i.length===0)}s(Mp,"isWritableFinished");function Wp(t){if(!Kn(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}s(Wp,"isReadableEnded");function Cl(t,e){if(!Kn(t))return null;let i=t._readableState;return i!=null&&i.errored?!1:typeof i?.endEmitted!="boolean"?null:!!(i.endEmitted||e===!1&&i.ended===!0&&i.length===0)}s(Cl,"isReadableFinished");function Rl(t){return t&&t[ko]!=null?t[ko]:typeof t?.readable!="boolean"?null:Jn(t)?!1:Kn(t)&&t.readable&&!Cl(t)}s(Rl,"isReadable");function Ll(t){return t&&t[Fo]!=null?t[Fo]:typeof t?.writable!="boolean"?null:Jn(t)?!1:Xn(t)&&t.writable&&!Ol(t)}s(Ll,"isWritable");function Up(t,e){return je(t)?Jn(t)?!0:!(e?.readable!==!1&&Rl(t)||e?.writable!==!1&&Ll(t)):null}s(Up,"isFinished");function qp(t){var e,i;return je(t)?t.writableErrored?t.writableErrored:(e=(i=t._writableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}s(qp,"isWritableErrored");function jp(t){var e,i;return je(t)?t.readableErrored?t.readableErrored:(e=(i=t._readableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}s(jp,"isReadableErrored");function $p(t){if(!je(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,i=t._readableState;return typeof e?.closed=="boolean"||typeof i?.closed=="boolean"?e?.closed||i?.closed:typeof t._closed=="boolean"&&Nl(t)?t._closed:null}s($p,"isClosed");function Nl(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}s(Nl,"isOutgoingMessage");function Dl(t){return typeof t._sent100=="boolean"&&Nl(t)}s(Dl,"isServerResponse");function Vp(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}s(Vp,"isServerRequest");function zp(t){if(!je(t))return null;let e=t._writableState,i=t._readableState,n=e||i;return!n&&Dl(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}s(zp,"willEmitClose");function Hp(t){var e;return!!(t&&((e=t[Il])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}s(Hp,"isDisturbed");function Yp(t){var e,i,n,r,o,a,l,c,u,h;return!!(t&&((e=(i=(n=(r=(o=(a=t[vl])!==null&&a!==void 0?a:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&r!==void 0?r:(l=t._readableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&n!==void 0?n:(c=t._writableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&i!==void 0?i:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((h=t._writableState)===null||h===void 0)&&h.errored))}s(Yp,"isErrored");Bl.exports={isDestroyed:Jn,kIsDestroyed:Fl,isDisturbed:Hp,kIsDisturbed:Il,isErrored:Yp,kIsErrored:vl,isReadable:Rl,kIsReadable:ko,kIsClosedPromise:Rp,kControllerErrorFunction:Lp,kIsWritable:Fo,isClosed:$p,isDuplexNodeStream:Np,isFinished:Up,isIterable:Bp,isReadableNodeStream:Kn,isReadableStream:Pl,isReadableEnded:Wp,isReadableFinished:Cl,isReadableErrored:jp,isNodeStream:je,isWebStream:Dp,isWritable:Ll,isWritableNodeStream:Xn,isWritableStream:Al,isWritableEnded:Ol,isWritableFinished:Mp,isWritableErrored:qp,isServerRequest:Vp,isServerResponse:Dl,willEmitClose:zp,isTransformStream:Tl}});var tt=A((O_,To)=>{var yt=pt(),{AbortError:Hl,codes:Gp}=ne(),{ERR_INVALID_ARG_TYPE:Kp,ERR_STREAM_PREMATURE_CLOSE:Ml}=Gp,{kEmptyObject:Io,once:Po}=Z(),{validateAbortSignal:Xp,validateFunction:Jp,validateObject:Qp,validateBoolean:Zp}=fi(),{Promise:ey,PromisePrototypeThen:ty,SymbolDispose:Yl}=W(),{isClosed:iy,isReadable:Wl,isReadableNodeStream:vo,isReadableStream:ny,isReadableFinished:Ul,isReadableErrored:ql,isWritable:jl,isWritableNodeStream:$l,isWritableStream:ry,isWritableFinished:Vl,isWritableErrored:zl,isNodeStream:oy,willEmitClose:sy,kIsClosedPromise:ay}=$e(),di;function ly(t){return t.setHeader&&typeof t.abort=="function"}s(ly,"isRequest");var Ao=s(()=>{},"nop");function Gl(t,e,i){var n,r;if(arguments.length===2?(i=e,e=Io):e==null?e=Io:Qp(e,"options"),Jp(i,"callback"),Xp(e.signal,"options.signal"),i=Po(i),ny(t)||ry(t))return cy(t,e,i);if(!oy(t))throw new Kp("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:vo(t),a=(r=e.writable)!==null&&r!==void 0?r:$l(t),l=t._writableState,c=t._readableState,u=s(()=>{t.writable||b()},"onlegacyfinish"),h=sy(t)&&vo(t)===o&&$l(t)===a,d=Vl(t,!1),b=s(()=>{d=!0,t.destroyed&&(h=!1),!(h&&(!t.readable||o))&&(!o||m)&&i.call(t)},"onfinish"),m=Ul(t,!1),w=s(()=>{m=!0,t.destroyed&&(h=!1),!(h&&(!t.writable||a))&&(!a||d)&&i.call(t)},"onend"),g=s(V=>{i.call(t,V)},"onerror"),I=iy(t),_=s(()=>{I=!0;let V=zl(t)||ql(t);if(V&&typeof V!="boolean")return i.call(t,V);if(o&&!m&&vo(t,!0)&&!Ul(t,!1))return i.call(t,new Ml);if(a&&!d&&!Vl(t,!1))return i.call(t,new Ml);i.call(t)},"onclose"),T=s(()=>{I=!0;let V=zl(t)||ql(t);if(V&&typeof V!="boolean")return i.call(t,V);i.call(t)},"onclosed"),q=s(()=>{t.req.on("finish",b)},"onrequest");ly(t)?(t.on("complete",b),h||t.on("abort",_),t.req?q():t.on("request",q)):a&&!l&&(t.on("end",u),t.on("close",u)),!h&&typeof t.aborted=="boolean"&&t.on("aborted",_),t.on("end",w),t.on("finish",b),e.error!==!1&&t.on("error",g),t.on("close",_),I?yt.nextTick(_):l!=null&&l.errorEmitted||c!=null&&c.errorEmitted?h||yt.nextTick(T):(!o&&(!h||Wl(t))&&(d||jl(t)===!1)||!a&&(!h||jl(t))&&(m||Wl(t)===!1)||c&&t.req&&t.aborted)&&yt.nextTick(T);let P=s(()=>{i=Ao,t.removeListener("aborted",_),t.removeListener("complete",b),t.removeListener("abort",_),t.removeListener("request",q),t.req&&t.req.removeListener("finish",b),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",b),t.removeListener("end",w),t.removeListener("error",g),t.removeListener("close",_)},"cleanup");if(e.signal&&!I){let V=s(()=>{let St=i;P(),St.call(t,new Hl(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)yt.nextTick(V);else{di=di||Z().addAbortListener;let St=di(e.signal,V),de=i;i=Po((...Yt)=>{St[Yl](),de.apply(t,Yt)})}}return P}s(Gl,"eos");function cy(t,e,i){let n=!1,r=Ao;if(e.signal)if(r=s(()=>{n=!0,i.call(t,new Hl(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)yt.nextTick(r);else{di=di||Z().addAbortListener;let a=di(e.signal,r),l=i;i=Po((...c)=>{a[Yl](),l.apply(t,c)})}let o=s((...a)=>{n||yt.nextTick(()=>i.apply(t,a))},"resolverFn");return ty(t[ay].promise,o,o),Ao}s(cy,"eosWeb");function fy(t,e){var i;let n=!1;return e===null&&(e=Io),(i=e)!==null&&i!==void 0&&i.cleanup&&(Zp(e.cleanup,"cleanup"),n=e.cleanup),new ey((r,o)=>{let a=Gl(t,e,l=>{n&&a(),l?o(l):r()})})}s(fy,"finished");To.exports=Gl;To.exports.finished=fy});var Mt=A((R_,ic)=>{"use strict";var Ve=pt(),{aggregateTwoErrors:uy,codes:{ERR_MULTIPLE_CALLBACK:dy},AbortError:hy}=ne(),{Symbol:Jl}=W(),{kIsDestroyed:py,isDestroyed:yy,isFinished:my,isServerRequest:by}=$e(),Ql=Jl("kDestroy"),Oo=Jl("kConstruct");function Zl(t,e,i){t&&(t.stack,e&&!e.errored&&(e.errored=t),i&&!i.errored&&(i.errored=t))}s(Zl,"checkError");function gy(t,e){let i=this._readableState,n=this._writableState,r=n||i;return n!=null&&n.destroyed||i!=null&&i.destroyed?(typeof e=="function"&&e(),this):(Zl(t,n,i),n&&(n.destroyed=!0),i&&(i.destroyed=!0),r.constructed?Kl(this,t,e):this.once(Ql,function(o){Kl(this,uy(o,t),e)}),this)}s(gy,"destroy");function Kl(t,e,i){let n=!1;function r(o){if(n)return;n=!0;let a=t._readableState,l=t._writableState;Zl(o,l,a),l&&(l.closed=!0),a&&(a.closed=!0),typeof i=="function"&&i(o),o?Ve.nextTick(wy,t,o):Ve.nextTick(ec,t)}s(r,"onDestroy");try{t._destroy(e||null,r)}catch(o){r(o)}}s(Kl,"_destroy");function wy(t,e){Co(t,e),ec(t)}s(wy,"emitErrorCloseNT");function ec(t){let e=t._readableState,i=t._writableState;i&&(i.closeEmitted=!0),e&&(e.closeEmitted=!0),(i!=null&&i.emitClose||e!=null&&e.emitClose)&&t.emit("close")}s(ec,"emitCloseNT");function Co(t,e){let i=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||i!=null&&i.errorEmitted||(n&&(n.errorEmitted=!0),i&&(i.errorEmitted=!0),t.emit("error",e))}s(Co,"emitErrorNT");function Sy(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}s(Sy,"undestroy");function Ro(t,e,i){let n=t._readableState,r=t._writableState;if(r!=null&&r.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||r!=null&&r.autoDestroy?t.destroy(e):e&&(e.stack,r&&!r.errored&&(r.errored=e),n&&!n.errored&&(n.errored=e),i?Ve.nextTick(Co,t,e):Co(t,e))}s(Ro,"errorOrDestroy");function _y(t,e){if(typeof t._construct!="function")return;let i=t._readableState,n=t._writableState;i&&(i.constructed=!1),n&&(n.constructed=!1),t.once(Oo,e),!(t.listenerCount(Oo)>1)&&Ve.nextTick(Ey,t)}s(_y,"construct");function Ey(t){let e=!1;function i(n){if(e){Ro(t,n??new dy);return}e=!0;let r=t._readableState,o=t._writableState,a=o||r;r&&(r.constructed=!0),o&&(o.constructed=!0),a.destroyed?t.emit(Ql,n):n?Ro(t,n,!0):Ve.nextTick(xy,t)}s(i,"onConstruct");try{t._construct(n=>{Ve.nextTick(i,n)})}catch(n){Ve.nextTick(i,n)}}s(Ey,"constructNT");function xy(t){t.emit(Oo)}s(xy,"emitConstructNT");function Xl(t){return t?.setHeader&&typeof t.abort=="function"}s(Xl,"isRequest");function tc(t){t.emit("close")}s(tc,"emitCloseLegacy");function ky(t,e){t.emit("error",e),Ve.nextTick(tc,t)}s(ky,"emitErrorCloseLegacy");function Fy(t,e){!t||yy(t)||(!e&&!my(t)&&(e=new hy),by(t)?(t.socket=null,t.destroy(e)):Xl(t)?t.abort():Xl(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Ve.nextTick(ky,t,e):Ve.nextTick(tc,t),t.destroyed||(t[py]=!0))}s(Fy,"destroyer");ic.exports={construct:_y,destroyer:Fy,destroy:gy,undestroy:Sy,errorOrDestroy:Ro}});var er=A((N_,rc)=>{"use strict";var{ArrayIsArray:vy,ObjectSetPrototypeOf:nc}=W(),{EventEmitter:Qn}=Zi();function Zn(t){Qn.call(this,t)}s(Zn,"Stream");nc(Zn.prototype,Qn.prototype);nc(Zn,Qn);Zn.prototype.pipe=function(t,e){let i=this;function n(h){t.writable&&t.write(h)===!1&&i.pause&&i.pause()}s(n,"ondata"),i.on("data",n);function r(){i.readable&&i.resume&&i.resume()}s(r,"ondrain"),t.on("drain",r),!t._isStdio&&(!e||e.end!==!1)&&(i.on("end",a),i.on("close",l));let o=!1;function a(){o||(o=!0,t.end())}s(a,"onend");function l(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}s(l,"onclose");function c(h){u(),Qn.listenerCount(this,"error")===0&&this.emit("error",h)}s(c,"onerror"),Lo(i,"error",c),Lo(t,"error",c);function u(){i.removeListener("data",n),t.removeListener("drain",r),i.removeListener("end",a),i.removeListener("close",l),i.removeListener("error",c),t.removeListener("error",c),i.removeListener("end",u),i.removeListener("close",u),t.removeListener("close",u)}return s(u,"cleanup"),i.on("end",u),i.on("close",u),t.on("close",u),t.emit("pipe",i),t};function Lo(t,e,i){if(typeof t.prependListener=="function")return t.prependListener(e,i);!t._events||!t._events[e]?t.on(e,i):vy(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]}s(Lo,"prependListener");rc.exports={Stream:Zn,prependListener:Lo}});var en=A((B_,tr)=>{"use strict";var{SymbolDispose:Iy}=W(),{AbortError:oc,codes:Py}=ne(),{isNodeStream:sc,isWebStream:Ay,kControllerErrorFunction:Ty}=$e(),Oy=tt(),{ERR_INVALID_ARG_TYPE:ac}=Py,No,Cy=s((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new ac(e,"AbortSignal",t)},"validateAbortSignal");tr.exports.addAbortSignal=s(function(e,i){if(Cy(e,"signal"),!sc(i)&&!Ay(i))throw new ac("stream",["ReadableStream","WritableStream","Stream"],i);return tr.exports.addAbortSignalNoValidate(e,i)},"addAbortSignal");tr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let i=sc(e)?()=>{e.destroy(new oc(void 0,{cause:t.reason}))}:()=>{e[Ty](new oc(void 0,{cause:t.reason}))};if(t.aborted)i();else{No=No||Z().addAbortListener;let n=No(t,i);Oy(e,n[Iy])}return e}});var fc=A((U_,cc)=>{"use strict";var{StringPrototypeSlice:lc,SymbolIterator:Ry,TypedArrayPrototypeSet:ir,Uint8Array:Ly}=W(),{Buffer:Do}=Ee(),{inspect:Ny}=Z();cc.exports=class{static{s(this,"BufferList")}constructor(){this.head=null,this.tail=null,this.length=0}push(e){let i={data:e,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}unshift(e){let i={data:e,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let i=this.head,n=""+i.data;for(;(i=i.next)!==null;)n+=e+i.data;return n}concat(e){if(this.length===0)return Do.alloc(0);let i=Do.allocUnsafe(e>>>0),n=this.head,r=0;for(;n;)ir(i,n.data,r),r+=n.data.length,n=n.next;return i}consume(e,i){let n=this.head.data;if(e<n.length){let r=n.slice(0,e);return this.head.data=n.slice(e),r}return e===n.length?this.shift():i?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Ry](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let i="",n=this.head,r=0;do{let o=n.data;if(e>o.length)i+=o,e-=o.length;else{e===o.length?(i+=o,++r,n.next?this.head=n.next:this.head=this.tail=null):(i+=lc(o,0,e),this.head=n,n.data=lc(o,e));break}++r}while((n=n.next)!==null);return this.length-=r,i}_getBuffer(e){let i=Do.allocUnsafe(e),n=e,r=this.head,o=0;do{let a=r.data;if(e>a.length)ir(i,a,n-e),e-=a.length;else{e===a.length?(ir(i,a,n-e),++o,r.next?this.head=r.next:this.head=this.tail=null):(ir(i,new Ly(a.buffer,a.byteOffset,e),n-e),this.head=r,r.data=a.slice(e));break}++o}while((r=r.next)!==null);return this.length-=o,i}[Symbol.for("nodejs.util.inspect.custom")](e,i){return Ny(this,{...i,depth:0,customInspect:!1})}}});var tn=A((j_,pc)=>{"use strict";var{MathFloor:Dy,NumberIsInteger:By}=W(),{validateInteger:My}=fi(),{ERR_INVALID_ARG_VALUE:Wy}=ne().codes,uc=16*1024,dc=16;function Uy(t,e,i){return t.highWaterMark!=null?t.highWaterMark:e?t[i]:null}s(Uy,"highWaterMarkFrom");function hc(t){return t?dc:uc}s(hc,"getDefaultHighWaterMark");function qy(t,e){My(e,"value",0),t?dc=e:uc=e}s(qy,"setDefaultHighWaterMark");function jy(t,e,i,n){let r=Uy(e,n,i);if(r!=null){if(!By(r)||r<0){let o=n?`options.${i}`:"options.highWaterMark";throw new Wy(o,r)}return Dy(r)}return hc(t.objectMode)}s(jy,"getHighWaterMark");pc.exports={getHighWaterMark:jy,getDefaultHighWaterMark:hc,setDefaultHighWaterMark:qy}});var bc=A((Bo,mc)=>{var nr=Ee(),ze=nr.Buffer;function yc(t,e){for(var i in t)e[i]=t[i]}s(yc,"copyProps");ze.from&&ze.alloc&&ze.allocUnsafe&&ze.allocUnsafeSlow?mc.exports=nr:(yc(nr,Bo),Bo.Buffer=Wt);function Wt(t,e,i){return ze(t,e,i)}s(Wt,"SafeBuffer");Wt.prototype=Object.create(ze.prototype);yc(ze,Wt);Wt.from=function(t,e,i){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ze(t,e,i)};Wt.alloc=function(t,e,i){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ze(t);return e!==void 0?typeof i=="string"?n.fill(e,i):n.fill(e):n.fill(0),n};Wt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ze(t)};Wt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return nr.SlowBuffer(t)}});var Sc=A(wc=>{"use strict";var Wo=bc().Buffer,gc=Wo.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function $y(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}s($y,"_normalizeEncoding");function Vy(t){var e=$y(t);if(typeof e!="string"&&(Wo.isEncoding===gc||!gc(t)))throw new Error("Unknown encoding: "+t);return e||t}s(Vy,"normalizeEncoding");wc.StringDecoder=nn;function nn(t){this.encoding=Vy(t);var e;switch(this.encoding){case"utf16le":this.text=Xy,this.end=Jy,e=4;break;case"utf8":this.fillLast=Yy,e=4;break;case"base64":this.text=Qy,this.end=Zy,e=3;break;default:this.write=em,this.end=tm;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Wo.allocUnsafe(e)}s(nn,"StringDecoder");nn.prototype.write=function(t){if(t.length===0)return"";var e,i;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?e?e+this.text(t,i):this.text(t,i):e||""};nn.prototype.end=Ky;nn.prototype.text=Gy;nn.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function Mo(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}s(Mo,"utf8CheckByte");function zy(t,e,i){var n=e.length-1;if(n<i)return 0;var r=Mo(e[n]);return r>=0?(r>0&&(t.lastNeed=r-1),r):--n<i||r===-2?0:(r=Mo(e[n]),r>=0?(r>0&&(t.lastNeed=r-2),r):--n<i||r===-2?0:(r=Mo(e[n]),r>=0?(r>0&&(r===2?r=0:t.lastNeed=r-3),r):0))}s(zy,"utf8CheckIncomplete");function Hy(t,e,i){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}s(Hy,"utf8CheckExtraBytes");function Yy(t){var e=this.lastTotal-this.lastNeed,i=Hy(this,t,e);if(i!==void 0)return i;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}s(Yy,"utf8FillLast");function Gy(t,e){var i=zy(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var n=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}s(Gy,"utf8Text");function Ky(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}s(Ky,"utf8End");function Xy(t,e){if((t.length-e)%2===0){var i=t.toString("utf16le",e);if(i){var n=i.charCodeAt(i.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}s(Xy,"utf16Text");function Jy(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}s(Jy,"utf16End");function Qy(t,e){var i=(t.length-e)%3;return i===0?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,i===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}s(Qy,"base64Text");function Zy(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}s(Zy,"base64End");function em(t){return t.toString(this.encoding)}s(em,"simpleWrite");function tm(t){return t&&t.length?this.write(t):""}s(tm,"simpleEnd")});var Uo=A((Y_,kc)=>{"use strict";var _c=pt(),{PromisePrototypeThen:im,SymbolAsyncIterator:Ec,SymbolIterator:xc}=W(),{Buffer:nm}=Ee(),{ERR_INVALID_ARG_TYPE:rm,ERR_STREAM_NULL_VALUES:om}=ne().codes;function sm(t,e,i){let n;if(typeof e=="string"||e instanceof nm)return new t({objectMode:!0,...i,read:s(function(){this.push(e),this.push(null)},"read")});let r;if(e&&e[Ec])r=!0,n=e[Ec]();else if(e&&e[xc])r=!1,n=e[xc]();else throw new rm("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...i}),a=!1;o._read=function(){a||(a=!0,c())},o._destroy=function(u,h){im(l(u),()=>_c.nextTick(h,u),d=>_c.nextTick(h,d||u))};async function l(u){let h=u!=null,d=typeof n.throw=="function";if(h&&d){let{value:b,done:m}=await n.throw(u);if(await b,m)return}if(typeof n.return=="function"){let{value:b}=await n.return();await b}}s(l,"close");async function c(){for(;;){try{let{value:u,done:h}=r?await n.next():n.next();if(h)o.push(null);else{let d=u&&typeof u.then=="function"?await u:u;if(d===null)throw a=!1,new om;if(o.push(d))continue;a=!1}}catch(u){o.destroy(u)}break}}return s(c,"next"),o}s(sm,"from");kc.exports=sm});var on=A((K_,jc)=>{var xe=pt(),{ArrayPrototypeIndexOf:am,NumberIsInteger:lm,NumberIsNaN:cm,NumberParseInt:fm,ObjectDefineProperties:Go,ObjectKeys:um,ObjectSetPrototypeOf:Ic,Promise:Pc,SafeSet:dm,SymbolAsyncDispose:hm,SymbolAsyncIterator:pm,Symbol:ym}=W();jc.exports=E;E.ReadableState=ar;var{EventEmitter:mm}=Zi(),{Stream:mt,prependListener:bm}=er(),{Buffer:qo}=Ee(),{addAbortSignal:gm}=en(),Ac=tt(),F=Z().debuglog("stream",t=>{F=t}),wm=fc(),yi=Mt(),{getHighWaterMark:Sm,getDefaultHighWaterMark:_m}=tn(),{aggregateTwoErrors:Fc,codes:{ERR_INVALID_ARG_TYPE:Em,ERR_METHOD_NOT_IMPLEMENTED:xm,ERR_OUT_OF_RANGE:km,ERR_STREAM_PUSH_AFTER_EOF:Fm,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:vm},AbortError:Im}=ne(),{validateObject:Pm}=fi(),Ut=ym("kPaused"),{StringDecoder:Tc}=Sc(),Am=Uo();Ic(E.prototype,mt.prototype);Ic(E,mt);var jo=s(()=>{},"nop"),{errorOrDestroy:hi}=yi,pi=1,Tm=2,Oc=4,rn=8,Cc=16,rr=32,or=64,Rc=128,Om=256,Cm=512,Rm=1024,Ho=2048,Yo=4096,Lm=8192,Nm=16384,Dm=32768,Lc=65536,Bm=1<<17,Mm=1<<18;function Y(t){return{enumerable:!1,get:s(function(){return(this.state&t)!==0},"get"),set:s(function(e){e?this.state|=t:this.state&=~t},"set")}}s(Y,"makeBitMapDescriptor");Go(ar.prototype,{objectMode:Y(pi),ended:Y(Tm),endEmitted:Y(Oc),reading:Y(rn),constructed:Y(Cc),sync:Y(rr),needReadable:Y(or),emittedReadable:Y(Rc),readableListening:Y(Om),resumeScheduled:Y(Cm),errorEmitted:Y(Rm),emitClose:Y(Ho),autoDestroy:Y(Yo),destroyed:Y(Lm),closed:Y(Nm),closeEmitted:Y(Dm),multiAwaitDrain:Y(Lc),readingMore:Y(Bm),dataEmitted:Y(Mm)});function ar(t,e,i){typeof i!="boolean"&&(i=e instanceof He()),this.state=Ho|Yo|Cc|rr,t&&t.objectMode&&(this.state|=pi),i&&t&&t.readableObjectMode&&(this.state|=pi),this.highWaterMark=t?Sm(this,t,"readableHighWaterMark",i):_m(!1),this.buffer=new wm,this.length=0,this.pipes=[],this.flowing=null,this[Ut]=null,t&&t.emitClose===!1&&(this.state&=~Ho),t&&t.autoDestroy===!1&&(this.state&=~Yo),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Tc(t.encoding),this.encoding=t.encoding)}s(ar,"ReadableState");function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof He();this._readableState=new ar(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&gm(t.signal,this)),mt.call(this,t),yi.construct(this,()=>{this._readableState.needReadable&&sr(this,this._readableState)})}s(E,"Readable");E.prototype.destroy=yi.destroy;E.prototype._undestroy=yi.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[mm.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[hm]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Im,this.destroy(t)),new Pc((e,i)=>Ac(this,n=>n&&n!==t?i(n):e(null)))};E.prototype.push=function(t,e){return Nc(this,t,e,!1)};E.prototype.unshift=function(t,e){return Nc(this,t,e,!0)};function Nc(t,e,i,n){F("readableAddChunk",e);let r=t._readableState,o;if(r.state&pi||(typeof e=="string"?(i=i||r.defaultEncoding,r.encoding!==i&&(n&&r.encoding?e=qo.from(e,i).toString(r.encoding):(e=qo.from(e,i),i=""))):e instanceof qo?i="":mt._isUint8Array(e)?(e=mt._uint8ArrayToBuffer(e),i=""):e!=null&&(o=new Em("chunk",["string","Buffer","Uint8Array"],e))),o)hi(t,o);else if(e===null)r.state&=~rn,qm(t,r);else if(r.state&pi||e&&e.length>0)if(n)if(r.state&Oc)hi(t,new vm);else{if(r.destroyed||r.errored)return!1;$o(t,r,e,!0)}else if(r.ended)hi(t,new Fm);else{if(r.destroyed||r.errored)return!1;r.state&=~rn,r.decoder&&!i?(e=r.decoder.write(e),r.objectMode||e.length!==0?$o(t,r,e,!1):sr(t,r)):$o(t,r,e,!1)}else n||(r.state&=~rn,sr(t,r));return!r.ended&&(r.length<r.highWaterMark||r.length===0)}s(Nc,"readableAddChunk");function $o(t,e,i,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&Lc?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",i)):(e.length+=e.objectMode?1:i.length,n?e.buffer.unshift(i):e.buffer.push(i),e.state&or&&lr(t)),sr(t,e)}s($o,"addChunk");E.prototype.isPaused=function(){let t=this._readableState;return t[Ut]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new Tc(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let i=this._readableState.buffer,n="";for(let r of i)n+=e.write(r);return i.clear(),n!==""&&i.push(n),this._readableState.length=n.length,this};var Wm=1073741824;function Um(t){if(t>Wm)throw new km("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}s(Um,"computeNewHighWaterMark");function vc(t,e){return t<=0||e.length===0&&e.ended?0:e.state&pi?1:cm(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}s(vc,"howMuchToRead");E.prototype.read=function(t){F("read",t),t===void 0?t=NaN:lm(t)||(t=fm(t,10));let e=this._readableState,i=t;if(t>e.highWaterMark&&(e.highWaterMark=Um(t)),t!==0&&(e.state&=~Rc),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return F("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Vo(this):lr(this),null;if(t=vc(t,e),t===0&&e.ended)return e.length===0&&Vo(this),null;let n=(e.state&or)!==0;if(F("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,F("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,F("reading, ended or constructing",n);else if(n){F("do read"),e.state|=rn|rr,e.length===0&&(e.state|=or);try{this._read(e.highWaterMark)}catch(o){hi(this,o)}e.state&=~rr,e.reading||(t=vc(i,e))}let r;return t>0?r=Uc(t,e):r=null,r===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&Vo(this)),r!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",r)),r};function qm(t,e){if(F("onEofChunk"),!e.ended){if(e.decoder){let i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,e.sync?lr(t):(e.needReadable=!1,e.emittedReadable=!0,Dc(t))}}s(qm,"onEofChunk");function lr(t){let e=t._readableState;F("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(F("emitReadable",e.flowing),e.emittedReadable=!0,xe.nextTick(Dc,t))}s(lr,"emitReadable");function Dc(t){let e=t._readableState;F("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Mc(t)}s(Dc,"emitReadable_");function sr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,xe.nextTick(jm,t,e))}s(sr,"maybeReadMore");function jm(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let i=e.length;if(F("maybeReadMore read 0"),t.read(0),i===e.length)break}e.readingMore=!1}s(jm,"maybeReadMore_");E.prototype._read=function(t){throw new xm("_read()")};E.prototype.pipe=function(t,e){let i=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new dm(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),F("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==xe.stdout&&t!==xe.stderr?l:I;n.endEmitted?xe.nextTick(o):i.once("end",o),t.on("unpipe",a);function a(_,T){F("onunpipe"),_===i&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,h())}s(a,"onunpipe");function l(){F("onend"),t.end()}s(l,"onend");let c,u=!1;function h(){F("cleanup"),t.removeListener("close",w),t.removeListener("finish",g),c&&t.removeListener("drain",c),t.removeListener("error",m),t.removeListener("unpipe",a),i.removeListener("end",l),i.removeListener("end",I),i.removeListener("data",b),u=!0,c&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}s(h,"cleanup");function d(){u||(n.pipes.length===1&&n.pipes[0]===t?(F("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(F("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),i.pause()),c||(c=$m(i,t),t.on("drain",c))}s(d,"pause"),i.on("data",b);function b(_){F("ondata");let T=t.write(_);F("dest.write",T),T===!1&&d()}s(b,"ondata");function m(_){if(F("onerror",_),I(),t.removeListener("error",m),t.listenerCount("error")===0){let T=t._writableState||t._readableState;T&&!T.errorEmitted?hi(t,_):t.emit("error",_)}}s(m,"onerror"),bm(t,"error",m);function w(){t.removeListener("finish",g),I()}s(w,"onclose"),t.once("close",w);function g(){F("onfinish"),t.removeListener("close",w),I()}s(g,"onfinish"),t.once("finish",g);function I(){F("unpipe"),i.unpipe(t)}return s(I,"unpipe"),t.emit("pipe",i),t.writableNeedDrain===!0?d():n.flowing||(F("pipe resume"),i.resume()),t};function $m(t,e){return s(function(){let n=t._readableState;n.awaitDrainWriters===e?(F("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(F("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}s($m,"pipeOnDrain");E.prototype.unpipe=function(t){let e=this._readableState,i={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let r=e.pipes;e.pipes=[],this.pause();for(let o=0;o<r.length;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}let n=am(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,i),this)};E.prototype.on=function(t,e){let i=mt.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,F("on readable",n.length,n.reading),n.length?lr(this):n.reading||xe.nextTick(Vm,this)),i};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let i=mt.prototype.removeListener.call(this,t,e);return t==="readable"&&xe.nextTick(Bc,this),i};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=mt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&xe.nextTick(Bc,this),e};function Bc(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Ut]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}s(Bc,"updateReadableListening");function Vm(t){F("readable nexttick read 0"),t.read(0)}s(Vm,"nReadingNextTick");E.prototype.resume=function(){let t=this._readableState;return t.flowing||(F("resume"),t.flowing=!t.readableListening,zm(this,t)),t[Ut]=!1,this};function zm(t,e){e.resumeScheduled||(e.resumeScheduled=!0,xe.nextTick(Hm,t,e))}s(zm,"resume");function Hm(t,e){F("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Mc(t),e.flowing&&!e.reading&&t.read(0)}s(Hm,"resume_");E.prototype.pause=function(){return F("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(F("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Ut]=!0,this};function Mc(t){let e=t._readableState;for(F("flow",e.flowing);e.flowing&&t.read()!==null;);}s(Mc,"flow");E.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{hi(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let i=um(t);for(let n=1;n<i.length;n++){let r=i[n];this[r]===void 0&&typeof t[r]=="function"&&(this[r]=t[r].bind(t))}return this};E.prototype[pm]=function(){return Wc(this)};E.prototype.iterator=function(t){return t!==void 0&&Pm(t,"options"),Wc(this,t)};function Wc(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let i=Ym(t,e);return i.stream=t,i}s(Wc,"streamToAsyncIterator");async function*Ym(t,e){let i=jo;function n(a){this===t?(i(),i=jo):i=a}s(n,"next"),t.on("readable",n);let r,o=Ac(t,{writable:!1},a=>{r=a?Fc(r,a):null,i(),i=jo});try{for(;;){let a=t.destroyed?null:t.read();if(a!==null)yield a;else{if(r)throw r;if(r===null)return;await new Pc(n)}}}catch(a){throw r=Fc(r,a),r}finally{(r||e?.destroyOnReturn!==!1)&&(r===void 0||t._readableState.autoDestroy)?yi.destroyer(t,null):(t.off("readable",n),o())}}s(Ym,"createAsyncIterator");Go(E.prototype,{readable:{__proto__:null,get:s(function(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},"get"),set:s(function(t){this._readableState&&(this._readableState.readable=!!t)},"set")},readableDidRead:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState.dataEmitted},"get")},readableAborted:{__proto__:null,enumerable:!1,get:s(function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)},"get")},readableHighWaterMark:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState.highWaterMark},"get")},readableBuffer:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState&&this._readableState.buffer},"get")},readableFlowing:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState.flowing},"get"),set:s(function(t){this._readableState&&(this._readableState.flowing=t)},"set")},readableLength:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState.length},"get")},readableObjectMode:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState?this._readableState.objectMode:!1},"get")},readableEncoding:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState?this._readableState.encoding:null},"get")},errored:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState?this._readableState.errored:null},"get")},closed:{__proto__:null,get:s(function(){return this._readableState?this._readableState.closed:!1},"get")},destroyed:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState?this._readableState.destroyed:!1},"get"),set:s(function(t){this._readableState&&(this._readableState.destroyed=t)},"set")},readableEnded:{__proto__:null,enumerable:!1,get:s(function(){return this._readableState?this._readableState.endEmitted:!1},"get")}});Go(ar.prototype,{pipesCount:{__proto__:null,get:s(function(){return this.pipes.length},"get")},paused:{__proto__:null,get:s(function(){return this[Ut]!==!1},"get"),set:s(function(t){this[Ut]=!!t},"set")}});E._fromList=Uc;function Uc(t,e){if(e.length===0)return null;let i;return e.objectMode?i=e.buffer.shift():!t||t>=e.length?(e.decoder?i=e.buffer.join(""):e.buffer.length===1?i=e.buffer.first():i=e.buffer.concat(e.length),e.buffer.clear()):i=e.buffer.consume(t,e.decoder),i}s(Uc,"fromList");function Vo(t){let e=t._readableState;F("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,xe.nextTick(Gm,e,t))}s(Vo,"endReadable");function Gm(t,e){if(F("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)xe.nextTick(Km,e);else if(t.autoDestroy){let i=e._writableState;(!i||i.autoDestroy&&(i.finished||i.writable===!1))&&e.destroy()}}}s(Gm,"endReadableNT");function Km(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}s(Km,"endWritableNT");E.from=function(t,e){return Am(E,t,e)};var zo;function qc(){return zo===void 0&&(zo={}),zo}s(qc,"lazyWebStreams");E.fromWeb=function(t,e){return qc().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return qc().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var i,n;return new E({objectMode:(i=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&i!==void 0?i:!0,...e,destroy:s(function(r,o){yi.destroyer(t,r),o(r)},"destroy")}).wrap(t)}});var hr=A((J_,ef)=>{var qt=pt(),{ArrayPrototypeSlice:zc,Error:Xm,FunctionPrototypeSymbolHasInstance:Hc,ObjectDefineProperty:Yc,ObjectDefineProperties:Jm,ObjectSetPrototypeOf:Gc,StringPrototypeToLowerCase:Qm,Symbol:Zm,SymbolHasInstance:eb}=W();ef.exports=U;U.WritableState=ln;var{EventEmitter:tb}=Zi(),sn=er().Stream,{Buffer:cr}=Ee(),dr=Mt(),{addAbortSignal:ib}=en(),{getHighWaterMark:nb,getDefaultHighWaterMark:rb}=tn(),{ERR_INVALID_ARG_TYPE:ob,ERR_METHOD_NOT_IMPLEMENTED:sb,ERR_MULTIPLE_CALLBACK:Kc,ERR_STREAM_CANNOT_PIPE:ab,ERR_STREAM_DESTROYED:an,ERR_STREAM_ALREADY_FINISHED:lb,ERR_STREAM_NULL_VALUES:cb,ERR_STREAM_WRITE_AFTER_END:fb,ERR_UNKNOWN_ENCODING:Xc}=ne().codes,{errorOrDestroy:mi}=dr;Gc(U.prototype,sn.prototype);Gc(U,sn);function Jo(){}s(Jo,"nop");var bi=Zm("kOnFinished");function ln(t,e,i){typeof i!="boolean"&&(i=e instanceof He()),this.objectMode=!!(t&&t.objectMode),i&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?nb(this,t,"writableHighWaterMark",i):rb(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=db.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,ur(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[bi]=[]}s(ln,"WritableState");function ur(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}s(ur,"resetBuffer");ln.prototype.getBuffer=s(function(){return zc(this.buffered,this.bufferedIndex)},"getBuffer");Yc(ln.prototype,"bufferedRequestCount",{__proto__:null,get:s(function(){return this.buffered.length-this.bufferedIndex},"get")});function U(t){let e=this instanceof He();if(!e&&!Hc(U,this))return new U(t);this._writableState=new ln(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&ib(t.signal,this)),sn.call(this,t),dr.construct(this,()=>{let i=this._writableState;i.writing||Zo(this,i),es(this,i)})}s(U,"Writable");Yc(U,eb,{__proto__:null,value:s(function(t){return Hc(this,t)?!0:this!==U?!1:t&&t._writableState instanceof ln},"value")});U.prototype.pipe=function(){mi(this,new ab)};function Jc(t,e,i,n){let r=t._writableState;if(typeof i=="function")n=i,i=r.defaultEncoding;else{if(!i)i=r.defaultEncoding;else if(i!=="buffer"&&!cr.isEncoding(i))throw new Xc(i);typeof n!="function"&&(n=Jo)}if(e===null)throw new cb;if(!r.objectMode)if(typeof e=="string")r.decodeStrings!==!1&&(e=cr.from(e,i),i="buffer");else if(e instanceof cr)i="buffer";else if(sn._isUint8Array(e))e=sn._uint8ArrayToBuffer(e),i="buffer";else throw new ob("chunk",["string","Buffer","Uint8Array"],e);let o;return r.ending?o=new fb:r.destroyed&&(o=new an("write")),o?(qt.nextTick(n,o),mi(t,o,!0),o):(r.pendingcb++,ub(t,r,e,i,n))}s(Jc,"_write");U.prototype.write=function(t,e,i){return Jc(this,t,e,i)===!0};U.prototype.cork=function(){this._writableState.corked++};U.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Zo(this,t))};U.prototype.setDefaultEncoding=s(function(e){if(typeof e=="string"&&(e=Qm(e)),!cr.isEncoding(e))throw new Xc(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function ub(t,e,i,n,r){let o=e.objectMode?1:i.length;e.length+=o;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:i,encoding:n,callback:r}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&r!==Jo&&(e.allNoop=!1)):(e.writelen=o,e.writecb=r,e.writing=!0,e.sync=!0,t._write(i,n,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}s(ub,"writeOrBuffer");function $c(t,e,i,n,r,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new an("write")):i?t._writev(r,e.onwrite):t._write(r,o,e.onwrite),e.sync=!1}s($c,"doWrite");function Vc(t,e,i,n){--e.pendingcb,n(i),Qo(e),mi(t,i)}s(Vc,"onwriteError");function db(t,e){let i=t._writableState,n=i.sync,r=i.writecb;if(typeof r!="function"){mi(t,new Kc);return}i.writing=!1,i.writecb=null,i.length-=i.writelen,i.writelen=0,e?(e.stack,i.errored||(i.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?qt.nextTick(Vc,t,i,e,r):Vc(t,i,e,r)):(i.buffered.length>i.bufferedIndex&&Zo(t,i),n?i.afterWriteTickInfo!==null&&i.afterWriteTickInfo.cb===r?i.afterWriteTickInfo.count++:(i.afterWriteTickInfo={count:1,cb:r,stream:t,state:i},qt.nextTick(hb,i.afterWriteTickInfo)):Qc(t,i,1,r))}s(db,"onwrite");function hb({stream:t,state:e,count:i,cb:n}){return e.afterWriteTickInfo=null,Qc(t,e,i,n)}s(hb,"afterWriteTick");function Qc(t,e,i,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));i-- >0;)e.pendingcb--,n();e.destroyed&&Qo(e),es(t,e)}s(Qc,"afterWrite");function Qo(t){if(t.writing)return;for(let r=t.bufferedIndex;r<t.buffered.length;++r){var e;let{chunk:o,callback:a}=t.buffered[r],l=t.objectMode?1:o.length;t.length-=l,a((e=t.errored)!==null&&e!==void 0?e:new an("write"))}let i=t[bi].splice(0);for(let r=0;r<i.length;r++){var n;i[r]((n=t.errored)!==null&&n!==void 0?n:new an("end"))}ur(t)}s(Qo,"errorBuffer");function Zo(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:i,bufferedIndex:n,objectMode:r}=e,o=i.length-n;if(!o)return;let a=n;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let l=e.allNoop?Jo:u=>{for(let h=a;h<i.length;++h)i[h].callback(u)},c=e.allNoop&&a===0?i:zc(i,a);c.allBuffers=e.allBuffers,$c(t,e,!0,e.length,c,"",l),ur(e)}else{do{let{chunk:l,encoding:c,callback:u}=i[a];i[a++]=null;let h=r?1:l.length;$c(t,e,!1,h,l,c,u)}while(a<i.length&&!e.writing);a===i.length?ur(e):a>256?(i.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}s(Zo,"clearBuffer");U.prototype._write=function(t,e,i){if(this._writev)this._writev([{chunk:t,encoding:e}],i);else throw new sb("_write()")};U.prototype._writev=null;U.prototype.end=function(t,e,i){let n=this._writableState;typeof t=="function"?(i=t,t=null,e=null):typeof e=="function"&&(i=e,e=null);let r;if(t!=null){let o=Jc(this,t,e);o instanceof Xm&&(r=o)}return n.corked&&(n.corked=1,this.uncork()),r||(!n.errored&&!n.ending?(n.ending=!0,es(this,n,!0),n.ended=!0):n.finished?r=new lb("end"):n.destroyed&&(r=new an("end"))),typeof i=="function"&&(r||n.finished?qt.nextTick(i,r):n[bi].push(i)),this};function fr(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}s(fr,"needFinish");function pb(t,e){let i=!1;function n(r){if(i){mi(t,r??Kc());return}if(i=!0,e.pendingcb--,r){let o=e[bi].splice(0);for(let a=0;a<o.length;a++)o[a](r);mi(t,r,e.sync)}else fr(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,qt.nextTick(Xo,t,e))}s(n,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(n)}catch(r){n(r)}e.sync=!1}s(pb,"callFinal");function yb(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,pb(t,e)):(e.prefinished=!0,t.emit("prefinish")))}s(yb,"prefinish");function es(t,e,i){fr(e)&&(yb(t,e),e.pendingcb===0&&(i?(e.pendingcb++,qt.nextTick((n,r)=>{fr(r)?Xo(n,r):r.pendingcb--},t,e)):fr(e)&&(e.pendingcb++,Xo(t,e))))}s(es,"finishMaybe");function Xo(t,e){e.pendingcb--,e.finished=!0;let i=e[bi].splice(0);for(let n=0;n<i.length;n++)i[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}s(Xo,"finish");Jm(U.prototype,{closed:{__proto__:null,get:s(function(){return this._writableState?this._writableState.closed:!1},"get")},destroyed:{__proto__:null,get:s(function(){return this._writableState?this._writableState.destroyed:!1},"get"),set:s(function(t){this._writableState&&(this._writableState.destroyed=t)},"set")},writable:{__proto__:null,get:s(function(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},"get"),set:s(function(t){this._writableState&&(this._writableState.writable=!!t)},"set")},writableFinished:{__proto__:null,get:s(function(){return this._writableState?this._writableState.finished:!1},"get")},writableObjectMode:{__proto__:null,get:s(function(){return this._writableState?this._writableState.objectMode:!1},"get")},writableBuffer:{__proto__:null,get:s(function(){return this._writableState&&this._writableState.getBuffer()},"get")},writableEnded:{__proto__:null,get:s(function(){return this._writableState?this._writableState.ending:!1},"get")},writableNeedDrain:{__proto__:null,get:s(function(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1},"get")},writableHighWaterMark:{__proto__:null,get:s(function(){return this._writableState&&this._writableState.highWaterMark},"get")},writableCorked:{__proto__:null,get:s(function(){return this._writableState?this._writableState.corked:0},"get")},writableLength:{__proto__:null,get:s(function(){return this._writableState&&this._writableState.length},"get")},errored:{__proto__:null,enumerable:!1,get:s(function(){return this._writableState?this._writableState.errored:null},"get")},writableAborted:{__proto__:null,enumerable:!1,get:s(function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)},"get")}});var mb=dr.destroy;U.prototype.destroy=function(t,e){let i=this._writableState;return!i.destroyed&&(i.bufferedIndex<i.buffered.length||i[bi].length)&&qt.nextTick(Qo,i),mb.call(this,t,e),this};U.prototype._undestroy=dr.undestroy;U.prototype._destroy=function(t,e){e(t)};U.prototype[tb.captureRejectionSymbol]=function(t){this.destroy(t)};var Ko;function Zc(){return Ko===void 0&&(Ko={}),Ko}s(Zc,"lazyWebStreams");U.fromWeb=function(t,e){return Zc().newStreamWritableFromWritableStream(t,e)};U.toWeb=function(t){return Zc().newWritableStreamFromStreamWritable(t)}});var mf=A((Z_,yf)=>{var ts=pt(),bb=Ee(),{isReadable:gb,isWritable:wb,isIterable:tf,isNodeStream:Sb,isReadableNodeStream:nf,isWritableNodeStream:rf,isDuplexNodeStream:_b,isReadableStream:of,isWritableStream:sf}=$e(),af=tt(),{AbortError:hf,codes:{ERR_INVALID_ARG_TYPE:Eb,ERR_INVALID_RETURN_VALUE:lf}}=ne(),{destroyer:wi}=Mt(),xb=He(),pf=on(),kb=hr(),{createDeferredPromise:cf}=Z(),ff=Uo(),uf=globalThis.Blob||bb.Blob,Fb=s(typeof uf<"u"?function(e){return e instanceof uf}:function(e){return!1},"isBlob"),vb=globalThis.AbortController||ai().AbortController,{FunctionPrototypeCall:df}=W(),bt=class extends xb{static{s(this,"Duplexify")}constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};yf.exports=s(function t(e,i){if(_b(e))return e;if(nf(e))return gi({readable:e});if(rf(e))return gi({writable:e});if(Sb(e))return gi({writable:!1,readable:!1});if(of(e))return gi({readable:pf.fromWeb(e)});if(sf(e))return gi({writable:kb.fromWeb(e)});if(typeof e=="function"){let{value:r,write:o,final:a,destroy:l}=Ib(e);if(tf(r))return ff(bt,r,{objectMode:!0,write:o,final:a,destroy:l});let c=r?.then;if(typeof c=="function"){let u,h=df(c,r,d=>{if(d!=null)throw new lf("nully","body",d)},d=>{wi(u,d)});return u=new bt({objectMode:!0,readable:!1,write:o,final:s(function(d){a(async()=>{try{await h,ts.nextTick(d,null)}catch(b){ts.nextTick(d,b)}})},"final"),destroy:l})}throw new lf("Iterable, AsyncIterable or AsyncFunction",i,r)}if(Fb(e))return t(e.arrayBuffer());if(tf(e))return ff(bt,e,{objectMode:!0,writable:!1});if(of(e?.readable)&&sf(e?.writable))return bt.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let r=e!=null&&e.readable?nf(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?rf(e?.writable)?e?.writable:t(e.writable):void 0;return gi({readable:r,writable:o})}let n=e?.then;if(typeof n=="function"){let r;return df(n,e,o=>{o!=null&&r.push(o),r.push(null)},o=>{wi(r,o)}),r=new bt({objectMode:!0,writable:!1,read:s(function(){},"read")})}throw new Eb(i,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function Ib(t){let{promise:e,resolve:i}=cf(),n=new vb,r=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:l,done:c,cb:u}=await a;if(ts.nextTick(u),c)return;if(r.aborted)throw new hf(void 0,{cause:r.reason});({promise:e,resolve:i}=cf()),yield l}}(),{signal:r}),write:s(function(a,l,c){let u=i;i=null,u({chunk:a,done:!1,cb:c})},"write"),final:s(function(a){let l=i;i=null,l({done:!0,cb:a})},"final"),destroy:s(function(a,l){n.abort(),l(a)},"destroy")}}s(Ib,"fromAsyncGen");function gi(t){let e=t.readable&&typeof t.readable.read!="function"?pf.wrap(t.readable):t.readable,i=t.writable,n=!!gb(e),r=!!wb(i),o,a,l,c,u;function h(d){let b=c;c=null,b?b(d):d&&u.destroy(d)}return s(h,"onfinished"),u=new bt({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(i!=null&&i.writableObjectMode),readable:n,writable:r}),r&&(af(i,d=>{r=!1,d&&wi(e,d),h(d)}),u._write=function(d,b,m){i.write(d,b)?m():o=m},u._final=function(d){i.end(),a=d},i.on("drain",function(){if(o){let d=o;o=null,d()}}),i.on("finish",function(){if(a){let d=a;a=null,d()}})),n&&(af(e,d=>{n=!1,d&&wi(e,d),h(d)}),e.on("readable",function(){if(l){let d=l;l=null,d()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let d=e.read();if(d===null){l=u._read;return}if(!u.push(d))return}}),u._destroy=function(d,b){!d&&c!==null&&(d=new hf),l=null,o=null,a=null,c===null?b(d):(c=b,wi(i,d),wi(e,d))},u}s(gi,"_duplexify")});var He=A((tE,wf)=>{"use strict";var{ObjectDefineProperties:Pb,ObjectGetOwnPropertyDescriptor:it,ObjectKeys:Ab,ObjectSetPrototypeOf:bf}=W();wf.exports=ke;var rs=on(),_e=hr();bf(ke.prototype,rs.prototype);bf(ke,rs);{let t=Ab(_e.prototype);for(let e=0;e<t.length;e++){let i=t[e];ke.prototype[i]||(ke.prototype[i]=_e.prototype[i])}}function ke(t){if(!(this instanceof ke))return new ke(t);rs.call(this,t),_e.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}s(ke,"Duplex");Pb(ke.prototype,{writable:{__proto__:null,...it(_e.prototype,"writable")},writableHighWaterMark:{__proto__:null,...it(_e.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...it(_e.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...it(_e.prototype,"writableBuffer")},writableLength:{__proto__:null,...it(_e.prototype,"writableLength")},writableFinished:{__proto__:null,...it(_e.prototype,"writableFinished")},writableCorked:{__proto__:null,...it(_e.prototype,"writableCorked")},writableEnded:{__proto__:null,...it(_e.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...it(_e.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get:s(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:s(function(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)},"set")}});var is;function gf(){return is===void 0&&(is={}),is}s(gf,"lazyWebStreams");ke.fromWeb=function(t,e){return gf().newStreamDuplexFromReadableWritablePair(t,e)};ke.toWeb=function(t){return gf().newReadableWritablePairFromDuplex(t)};var ns;ke.from=function(t){return ns||(ns=mf()),ns(t,"body")}});var as=A((nE,_f)=>{"use strict";var{ObjectSetPrototypeOf:Sf,Symbol:Tb}=W();_f.exports=nt;var{ERR_METHOD_NOT_IMPLEMENTED:Ob}=ne().codes,ss=He(),{getHighWaterMark:Cb}=tn();Sf(nt.prototype,ss.prototype);Sf(nt,ss);var cn=Tb("kCallback");function nt(t){if(!(this instanceof nt))return new nt(t);let e=t?Cb(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ss.call(this,t),this._readableState.sync=!1,this[cn]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Rb)}s(nt,"Transform");function os(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,i)=>{if(e){t?t(e):this.destroy(e);return}i!=null&&this.push(i),this.push(null),t&&t()}):(this.push(null),t&&t())}s(os,"final");function Rb(){this._final!==os&&os.call(this)}s(Rb,"prefinish");nt.prototype._final=os;nt.prototype._transform=function(t,e,i){throw new Ob("_transform()")};nt.prototype._write=function(t,e,i){let n=this._readableState,r=this._writableState,o=n.length;this._transform(t,e,(a,l)=>{if(a){i(a);return}l!=null&&this.push(l),r.ended||o===n.length||n.length<n.highWaterMark?i():this[cn]=i})};nt.prototype._read=function(){if(this[cn]){let t=this[cn];this[cn]=null,t()}}});var cs=A((oE,xf)=>{"use strict";var{ObjectSetPrototypeOf:Ef}=W();xf.exports=Si;var ls=as();Ef(Si.prototype,ls.prototype);Ef(Si,ls);function Si(t){if(!(this instanceof Si))return new Si(t);ls.call(this,t)}s(Si,"PassThrough");Si.prototype._transform=function(t,e,i){i(null,t)}});var br=A((aE,Pf)=>{var fn=pt(),{ArrayIsArray:Lb,Promise:Nb,SymbolAsyncIterator:Db,SymbolDispose:Bb}=W(),mr=tt(),{once:Mb}=Z(),Wb=Mt(),kf=He(),{aggregateTwoErrors:Ub,codes:{ERR_INVALID_ARG_TYPE:gs,ERR_INVALID_RETURN_VALUE:fs,ERR_MISSING_ARGS:qb,ERR_STREAM_DESTROYED:jb,ERR_STREAM_PREMATURE_CLOSE:$b},AbortError:Vb}=ne(),{validateFunction:zb,validateAbortSignal:Hb}=fi(),{isIterable:jt,isReadable:us,isReadableNodeStream:yr,isNodeStream:Ff,isTransformStream:_i,isWebStream:Yb,isReadableStream:ds,isReadableFinished:Gb}=$e(),Kb=globalThis.AbortController||ai().AbortController,hs,ps,ys;function vf(t,e,i){let n=!1;t.on("close",()=>{n=!0});let r=mr(t,{readable:e,writable:i},o=>{n=!o});return{destroy:s(o=>{n||(n=!0,Wb.destroyer(t,o||new jb("pipe")))},"destroy"),cleanup:r}}s(vf,"destroyer");function Xb(t){return zb(t[t.length-1],"streams[stream.length - 1]"),t.pop()}s(Xb,"popCallback");function ms(t){if(jt(t))return t;if(yr(t))return Jb(t);throw new gs("val",["Readable","Iterable","AsyncIterable"],t)}s(ms,"makeAsyncIterable");async function*Jb(t){ps||(ps=on()),yield*ps.prototype[Db].call(t)}s(Jb,"fromReadable");async function pr(t,e,i,{end:n}){let r,o=null,a=s(u=>{if(u&&(r=u),o){let h=o;o=null,h()}},"resume"),l=s(()=>new Nb((u,h)=>{r?h(r):o=s(()=>{r?h(r):u()},"onresolve")}),"wait");e.on("drain",a);let c=mr(e,{readable:!1},a);try{e.writableNeedDrain&&await l();for await(let u of t)e.write(u)||await l();n&&(e.end(),await l()),i()}catch(u){i(r!==u?Ub(r,u):u)}finally{c(),e.off("drain",a)}}s(pr,"pumpToNode");async function bs(t,e,i,{end:n}){_i(e)&&(e=e.writable);let r=e.getWriter();try{for await(let o of t)await r.ready,r.write(o).catch(()=>{});await r.ready,n&&await r.close(),i()}catch(o){try{await r.abort(o),i(o)}catch(a){i(a)}}}s(bs,"pumpToWeb");function Qb(...t){return If(t,Mb(Xb(t)))}s(Qb,"pipeline");function If(t,e,i){if(t.length===1&&Lb(t[0])&&(t=t[0]),t.length<2)throw new qb("streams");let n=new Kb,r=n.signal,o=i?.signal,a=[];Hb(o,"options.signal");function l(){w(new Vb)}s(l,"abort"),ys=ys||Z().addAbortListener;let c;o&&(c=ys(o,l));let u,h,d=[],b=0;function m(q){w(q,--b===0)}s(m,"finish");function w(q,P){var V;if(q&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=q),!(!u&&!P)){for(;d.length;)d.shift()(u);(V=c)===null||V===void 0||V[Bb](),n.abort(),P&&(u||a.forEach(St=>St()),fn.nextTick(e,u,h))}}s(w,"finishImpl");let g;for(let q=0;q<t.length;q++){let P=t[q],V=q<t.length-1,St=q>0,de=V||i?.end!==!1,Yt=q===t.length-1;if(Ff(P)){let re=function(Ge){Ge&&Ge.name!=="AbortError"&&Ge.code!=="ERR_STREAM_PREMATURE_CLOSE"&&m(Ge)};var T=re;if(s(re,"onError"),de){let{destroy:Ge,cleanup:Tr}=vf(P,V,St);d.push(Ge),us(P)&&Yt&&a.push(Tr)}P.on("error",re),us(P)&&Yt&&a.push(()=>{P.removeListener("error",re)})}if(q===0)if(typeof P=="function"){if(g=P({signal:r}),!jt(g))throw new fs("Iterable, AsyncIterable or Stream","source",g)}else jt(P)||yr(P)||_i(P)?g=P:g=kf.from(P);else if(typeof P=="function"){if(_i(g)){var I;g=ms((I=g)===null||I===void 0?void 0:I.readable)}else g=ms(g);if(g=P(g,{signal:r}),V){if(!jt(g,!0))throw new fs("AsyncIterable",`transform[${q-1}]`,g)}else{var _;hs||(hs=cs());let re=new hs({objectMode:!0}),Ge=(_=g)===null||_===void 0?void 0:_.then;if(typeof Ge=="function")b++,Ge.call(g,ot=>{h=ot,ot!=null&&re.write(ot),de&&re.end(),fn.nextTick(m)},ot=>{re.destroy(ot),fn.nextTick(m,ot)});else if(jt(g,!0))b++,pr(g,re,m,{end:de});else if(ds(g)||_i(g)){let ot=g.readable||g;b++,pr(ot,re,m,{end:de})}else throw new fs("AsyncIterable or Promise","destination",g);g=re;let{destroy:Tr,cleanup:Xu}=vf(g,!1,!0);d.push(Tr),Yt&&a.push(Xu)}}else if(Ff(P)){if(yr(g)){b+=2;let re=Zb(g,P,m,{end:de});us(P)&&Yt&&a.push(re)}else if(_i(g)||ds(g)){let re=g.readable||g;b++,pr(re,P,m,{end:de})}else if(jt(g))b++,pr(g,P,m,{end:de});else throw new gs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],g);g=P}else if(Yb(P)){if(yr(g))b++,bs(ms(g),P,m,{end:de});else if(ds(g)||jt(g))b++,bs(g,P,m,{end:de});else if(_i(g))b++,bs(g.readable,P,m,{end:de});else throw new gs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],g);g=P}else g=kf.from(P)}return(r!=null&&r.aborted||o!=null&&o.aborted)&&fn.nextTick(l),g}s(If,"pipelineImpl");function Zb(t,e,i,{end:n}){let r=!1;if(e.on("close",()=>{r||i(new $b)}),t.pipe(e,{end:!1}),n){let a=function(){r=!0,e.end()};var o=a;s(a,"endFn"),Gb(t)?fn.nextTick(a):t.once("end",a)}else i();return mr(t,{readable:!0,writable:!1},a=>{let l=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?t.once("end",i).once("error",i):i(a)}),mr(e,{readable:!1,writable:!0},i)}s(Zb,"pipe");Pf.exports={pipelineImpl:If,pipeline:Qb}});var Ss=A((cE,Lf)=>{"use strict";var{pipeline:eg}=br(),gr=He(),{destroyer:tg}=Mt(),{isNodeStream:wr,isReadable:Af,isWritable:Tf,isWebStream:ws,isTransformStream:$t,isWritableStream:Of,isReadableStream:Cf}=$e(),{AbortError:ig,codes:{ERR_INVALID_ARG_VALUE:Rf,ERR_MISSING_ARGS:ng}}=ne(),rg=tt();Lf.exports=s(function(...e){if(e.length===0)throw new ng("streams");if(e.length===1)return gr.from(e[0]);let i=[...e];if(typeof e[0]=="function"&&(e[0]=gr.from(e[0])),typeof e[e.length-1]=="function"){let m=e.length-1;e[m]=gr.from(e[m])}for(let m=0;m<e.length;++m)if(!(!wr(e[m])&&!ws(e[m]))){if(m<e.length-1&&!(Af(e[m])||Cf(e[m])||$t(e[m])))throw new Rf(`streams[${m}]`,i[m],"must be readable");if(m>0&&!(Tf(e[m])||Of(e[m])||$t(e[m])))throw new Rf(`streams[${m}]`,i[m],"must be writable")}let n,r,o,a,l;function c(m){let w=a;a=null,w?w(m):m?l.destroy(m):!b&&!d&&l.destroy()}s(c,"onfinished");let u=e[0],h=eg(e,c),d=!!(Tf(u)||Of(u)||$t(u)),b=!!(Af(h)||Cf(h)||$t(h));if(l=new gr({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(h!=null&&h.readableObjectMode),writable:d,readable:b}),d){if(wr(u))l._write=function(w,g,I){u.write(w,g)?I():n=I},l._final=function(w){u.end(),r=w},u.on("drain",function(){if(n){let w=n;n=null,w()}});else if(ws(u)){let g=($t(u)?u.writable:u).getWriter();l._write=async function(I,_,T){try{await g.ready,g.write(I).catch(()=>{}),T()}catch(q){T(q)}},l._final=async function(I){try{await g.ready,g.close().catch(()=>{}),r=I}catch(_){I(_)}}}let m=$t(h)?h.readable:h;rg(m,()=>{if(r){let w=r;r=null,w()}})}if(b){if(wr(h))h.on("readable",function(){if(o){let m=o;o=null,m()}}),h.on("end",function(){l.push(null)}),l._read=function(){for(;;){let m=h.read();if(m===null){o=l._read;return}if(!l.push(m))return}};else if(ws(h)){let w=($t(h)?h.readable:h).getReader();l._read=async function(){for(;;)try{let{value:g,done:I}=await w.read();if(!l.push(g))return;if(I){l.push(null);return}}catch{return}}}}return l._destroy=function(m,w){!m&&a!==null&&(m=new ig),o=null,n=null,r=null,a===null?w(m):(a=w,wr(h)&&tg(h,m))},l},"compose")});var Vf=A((uE,xs)=>{"use strict";var og=globalThis.AbortController||ai().AbortController,{codes:{ERR_INVALID_ARG_VALUE:sg,ERR_INVALID_ARG_TYPE:un,ERR_MISSING_ARGS:ag,ERR_OUT_OF_RANGE:lg},AbortError:Ye}=ne(),{validateAbortSignal:Vt,validateInteger:Nf,validateObject:zt}=fi(),cg=W().Symbol("kWeak"),fg=W().Symbol("kResistStopPropagation"),{finished:ug}=tt(),dg=Ss(),{addAbortSignalNoValidate:hg}=en(),{isWritable:pg,isNodeStream:yg}=$e(),{deprecate:mg}=Z(),{ArrayPrototypePush:bg,Boolean:gg,MathFloor:Df,Number:wg,NumberIsNaN:Sg,Promise:Bf,PromiseReject:Mf,PromiseResolve:_g,PromisePrototypeThen:Wf,Symbol:qf}=W(),Sr=qf("kEmpty"),Uf=qf("kEof");function Eg(t,e){if(e!=null&&zt(e,"options"),e?.signal!=null&&Vt(e.signal,"options.signal"),yg(t)&&!pg(t))throw new sg("stream",t,"must be writable");let i=dg(this,t);return e!=null&&e.signal&&hg(e.signal,i),i}s(Eg,"compose");function _r(t,e){if(typeof t!="function")throw new un("fn",["Function","AsyncFunction"],t);e!=null&&zt(e,"options"),e?.signal!=null&&Vt(e.signal,"options.signal");let i=1;e?.concurrency!=null&&(i=Df(e.concurrency));let n=i-1;return e?.highWaterMark!=null&&(n=Df(e.highWaterMark)),Nf(i,"options.concurrency",1),Nf(n,"options.highWaterMark",0),n+=i,s(async function*(){let o=Z().AbortSignalAny([e?.signal].filter(gg)),a=this,l=[],c={signal:o},u,h,d=!1,b=0;function m(){d=!0,w()}s(m,"onCatch");function w(){b-=1,g()}s(w,"afterItemProcessed");function g(){h&&!d&&b<i&&l.length<n&&(h(),h=null)}s(g,"maybeResume");async function I(){try{for await(let _ of a){if(d)return;if(o.aborted)throw new Ye;try{if(_=t(_,c),_===Sr)continue;_=_g(_)}catch(T){_=Mf(T)}b+=1,Wf(_,w,m),l.push(_),u&&(u(),u=null),!d&&(l.length>=n||b>=i)&&await new Bf(T=>{h=T})}l.push(Uf)}catch(_){let T=Mf(_);Wf(T,w,m),l.push(T)}finally{d=!0,u&&(u(),u=null)}}s(I,"pump"),I();try{for(;;){for(;l.length>0;){let _=await l[0];if(_===Uf)return;if(o.aborted)throw new Ye;_!==Sr&&(yield _),l.shift(),g()}await new Bf(_=>{u=_})}}finally{d=!0,h&&(h(),h=null)}},"map").call(this)}s(_r,"map");function xg(t=void 0){return t!=null&&zt(t,"options"),t?.signal!=null&&Vt(t.signal,"options.signal"),s(async function*(){let i=0;for await(let r of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Ye({cause:t.signal.reason});yield[i++,r]}},"asIndexedPairs").call(this)}s(xg,"asIndexedPairs");async function jf(t,e=void 0){for await(let i of Es.call(this,t,e))return!0;return!1}s(jf,"some");async function kg(t,e=void 0){if(typeof t!="function")throw new un("fn",["Function","AsyncFunction"],t);return!await jf.call(this,async(...i)=>!await t(...i),e)}s(kg,"every");async function Fg(t,e){for await(let i of Es.call(this,t,e))return i}s(Fg,"find");async function vg(t,e){if(typeof t!="function")throw new un("fn",["Function","AsyncFunction"],t);async function i(n,r){return await t(n,r),Sr}s(i,"forEachFn");for await(let n of _r.call(this,i,e));}s(vg,"forEach");function Es(t,e){if(typeof t!="function")throw new un("fn",["Function","AsyncFunction"],t);async function i(n,r){return await t(n,r)?n:Sr}return s(i,"filterFn"),_r.call(this,i,e)}s(Es,"filter");var _s=class extends ag{static{s(this,"ReduceAwareErrMissingArgs")}constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Ig(t,e,i){var n;if(typeof t!="function")throw new un("reducer",["Function","AsyncFunction"],t);i!=null&&zt(i,"options"),i?.signal!=null&&Vt(i.signal,"options.signal");let r=arguments.length>1;if(i!=null&&(n=i.signal)!==null&&n!==void 0&&n.aborted){let u=new Ye(void 0,{cause:i.signal.reason});throw this.once("error",()=>{}),await ug(this.destroy(u)),u}let o=new og,a=o.signal;if(i!=null&&i.signal){let u={once:!0,[cg]:this,[fg]:!0};i.signal.addEventListener("abort",()=>o.abort(),u)}let l=!1;try{for await(let u of this){var c;if(l=!0,i!=null&&(c=i.signal)!==null&&c!==void 0&&c.aborted)throw new Ye;r?e=await t(e,u,{signal:a}):(e=u,r=!0)}if(!l&&!r)throw new _s}finally{o.abort()}return e}s(Ig,"reduce");async function Pg(t){t!=null&&zt(t,"options"),t?.signal!=null&&Vt(t.signal,"options.signal");let e=[];for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Ye(void 0,{cause:t.signal.reason});bg(e,n)}return e}s(Pg,"toArray");function Ag(t,e){let i=_r.call(this,t,e);return s(async function*(){for await(let r of i)yield*r},"flatMap").call(this)}s(Ag,"flatMap");function $f(t){if(t=wg(t),Sg(t))return 0;if(t<0)throw new lg("number",">= 0",t);return t}s($f,"toIntegerOrInfinity");function Tg(t,e=void 0){return e!=null&&zt(e,"options"),e?.signal!=null&&Vt(e.signal,"options.signal"),t=$f(t),s(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ye;for await(let o of this){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Ye;t--<=0&&(yield o)}},"drop").call(this)}s(Tg,"drop");function Og(t,e=void 0){return e!=null&&zt(e,"options"),e?.signal!=null&&Vt(e.signal,"options.signal"),t=$f(t),s(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ye;for await(let o of this){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Ye;if(t-- >0&&(yield o),t<=0)return}},"take").call(this)}s(Og,"take");xs.exports.streamReturningOperators={asIndexedPairs:mg(xg,"readable.asIndexedPairs will be removed in a future version."),drop:Tg,filter:Es,flatMap:Ag,map:_r,take:Og,compose:Eg};xs.exports.promiseReturningOperators={every:kg,forEach:vg,reduce:Ig,toArray:Pg,some:jf,find:Fg}});var ks=A((hE,zf)=>{"use strict";var{ArrayPrototypePop:Cg,Promise:Rg}=W(),{isIterable:Lg,isNodeStream:Ng,isWebStream:Dg}=$e(),{pipelineImpl:Bg}=br(),{finished:Mg}=tt();Fs();function Wg(...t){return new Rg((e,i)=>{let n,r,o=t[t.length-1];if(o&&typeof o=="object"&&!Ng(o)&&!Lg(o)&&!Dg(o)){let a=Cg(t);n=a.signal,r=a.end}Bg(t,(a,l)=>{a?i(a):e(l)},{signal:n,end:r})})}s(Wg,"pipeline");zf.exports={finished:Mg,pipeline:Wg}});var Fs=A((yE,eu)=>{var{Buffer:Ug}=Ee(),{ObjectDefineProperty:rt,ObjectKeys:Gf,ReflectApply:Kf}=W(),{promisify:{custom:Xf}}=Z(),{streamReturningOperators:Hf,promiseReturningOperators:Yf}=Vf(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Jf}}=ne(),qg=Ss(),{setDefaultHighWaterMark:jg,getDefaultHighWaterMark:$g}=tn(),{pipeline:Qf}=br(),{destroyer:Vg}=Mt(),Zf=tt(),vs=ks(),dn=$e(),C=eu.exports=er().Stream;C.isDestroyed=dn.isDestroyed;C.isDisturbed=dn.isDisturbed;C.isErrored=dn.isErrored;C.isReadable=dn.isReadable;C.isWritable=dn.isWritable;C.Readable=on();for(let t of Gf(Hf)){let i=function(...n){if(new.target)throw Jf();return C.Readable.from(Kf(e,this,n))};Is=i,s(i,"fn");let e=Hf[t];rt(i,"name",{__proto__:null,value:e.name}),rt(i,"length",{__proto__:null,value:e.length}),rt(C.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var Is;for(let t of Gf(Yf)){let i=function(...r){if(new.target)throw Jf();return Kf(e,this,r)};Is=i,s(i,"fn");let e=Yf[t];rt(i,"name",{__proto__:null,value:e.name}),rt(i,"length",{__proto__:null,value:e.length}),rt(C.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var Is;C.Writable=hr();C.Duplex=He();C.Transform=as();C.PassThrough=cs();C.pipeline=Qf;var{addAbortSignal:zg}=en();C.addAbortSignal=zg;C.finished=Zf;C.destroy=Vg;C.compose=qg;C.setDefaultHighWaterMark=jg;C.getDefaultHighWaterMark=$g;rt(C,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:s(function(){return vs},"get")});rt(Qf,Xf,{__proto__:null,enumerable:!0,get:s(function(){return vs.pipeline},"get")});rt(Zf,Xf,{__proto__:null,enumerable:!0,get:s(function(){return vs.finished},"get")});C.Stream=C;C._isUint8Array=s(function(e){return e instanceof Uint8Array},"isUint8Array");C._uint8ArrayToBuffer=s(function(e){return Ug.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var tu=A((bE,$)=>{"use strict";var G=Fs(),Hg=ks(),Yg=G.Readable.destroy;$.exports=G.Readable;$.exports._uint8ArrayToBuffer=G._uint8ArrayToBuffer;$.exports._isUint8Array=G._isUint8Array;$.exports.isDisturbed=G.isDisturbed;$.exports.isErrored=G.isErrored;$.exports.isReadable=G.isReadable;$.exports.Readable=G.Readable;$.exports.Writable=G.Writable;$.exports.Duplex=G.Duplex;$.exports.Transform=G.Transform;$.exports.PassThrough=G.PassThrough;$.exports.addAbortSignal=G.addAbortSignal;$.exports.finished=G.finished;$.exports.destroy=G.destroy;$.exports.destroy=Yg;$.exports.pipeline=G.pipeline;$.exports.compose=G.compose;Object.defineProperty(G,"promises",{configurable:!0,enumerable:!0,get:s(function(){return Hg},"get")});$.exports.Stream=G.Stream;$.exports.default=$.exports});var Jg={};gn(Jg,{ActionType:()=>Sn,Async:()=>Br,AsyncIndexFS:()=>qi,AsyncTransaction:()=>Ur,BigIntStats:()=>ie,BigIntStatsFs:()=>Dr,Dir:()=>ht,Dirent:()=>dt,Errno:()=>D,ErrnoError:()=>f,Fetch:()=>qd,FetchFS:()=>Tn,File:()=>vt,FileIndex:()=>At,FileSystem:()=>se,FileType:()=>z,InMemory:()=>Bi,InMemoryStore:()=>Fn,IndexDirInode:()=>ct,IndexFS:()=>Ui,IndexFileInode:()=>Pn,IndexInode:()=>Wi,Inode:()=>Ne,LockedFS:()=>$i,Mutex:()=>ji,NoSyncFile:()=>Ke,Overlay:()=>jd,OverlayFS:()=>Vi,Port:()=>Md,PortFS:()=>In,PortFile:()=>Mi,PreloadFile:()=>ce,ReadStream:()=>gt,Readonly:()=>Mr,SimpleAsyncStore:()=>qr,SimpleTransaction:()=>Xt,Stats:()=>R,StatsCommon:()=>Pi,StatsFs:()=>Ai,StoreFS:()=>Li,Sync:()=>Od,SyncIndexFS:()=>zr,SyncTransaction:()=>Di,Transaction:()=>Ni,UnlockedOverlayFS:()=>On,WriteStream:()=>wt,_toUnixTimestamp:()=>Rd,access:()=>Nu,accessSync:()=>Ua,appendFile:()=>uu,appendFileSync:()=>Ia,attachFS:()=>Dd,checkOptions:()=>Yr,chmod:()=>Tu,chmodSync:()=>Ba,chown:()=>Pu,chownSync:()=>Na,close:()=>hu,closeSync:()=>Qe,configure:()=>Kg,constants:()=>Ft,copyFile:()=>$u,copyFileSync:()=>uo,cp:()=>Yu,cpSync:()=>ho,createReadStream:()=>Wu,createWriteStream:()=>Uu,decode:()=>xn,decodeDirListing:()=>kn,default:()=>Xg,detachFS:()=>Bd,encode:()=>Xe,encodeDirListing:()=>ye,errorMessages:()=>Cr,exists:()=>nu,existsSync:()=>ni,fchmod:()=>Su,fchmodSync:()=>Wn,fchown:()=>wu,fchownSync:()=>Mn,fdatasync:()=>mu,fdatasyncSync:()=>Ta,flagToMode:()=>It,flagToNumber:()=>Pd,flagToString:()=>Hs,fs:()=>bn,fstat:()=>du,fstatSync:()=>Pa,fsync:()=>yu,fsyncSync:()=>Aa,ftruncate:()=>pu,ftruncateSync:()=>so,futimes:()=>_u,futimesSync:()=>Un,isAppendable:()=>at,isBackend:()=>zi,isBackendConfig:()=>Gr,isExclusive:()=>Gs,isReadable:()=>st,isSynchronous:()=>Oi,isTruncating:()=>Ys,isWriteable:()=>pe,lchmod:()=>Ou,lchmodSync:()=>Ma,lchown:()=>Au,lchownSync:()=>Da,levenshtein:()=>Wr,link:()=>Fu,linkSync:()=>Ra,lopenSync:()=>Ji,lstat:()=>ou,lstatSync:()=>oo,lutimes:()=>Ru,lutimesSync:()=>Wa,mkdir:()=>xu,mkdirSync:()=>qn,mkdirpSync:()=>Xs,mkdtemp:()=>ju,mkdtempSync:()=>qa,mount:()=>Gi,mountObject:()=>Ki,mounts:()=>we,nop:()=>S,normalizeMode:()=>me,normalizeOptions:()=>be,normalizePath:()=>x,normalizeTime:()=>Pt,open:()=>lu,openAsBlob:()=>Ku,openSync:()=>oi,opendir:()=>Hu,opendirSync:()=>Va,parseFlag:()=>L,pathExistsAction:()=>Ci,pathNotExistsAction:()=>Ri,promises:()=>mn,randomIno:()=>Ti,read:()=>gu,readFile:()=>cu,readFileSync:()=>Bn,readSync:()=>Ca,readdir:()=>ku,readdirSync:()=>si,readlink:()=>Iu,readlinkSync:()=>lo,readv:()=>Vu,readvSync:()=>ja,realpath:()=>Lu,realpathSync:()=>ii,rename:()=>iu,renameSync:()=>ka,resolveMountConfig:()=>$s,rm:()=>qu,rmSync:()=>fo,rmdir:()=>Eu,rmdirSync:()=>ao,rootCred:()=>Be,rootIno:()=>De,setImmediate:()=>Cd,size_max:()=>wn,stat:()=>ru,statSync:()=>Xi,statfs:()=>Gu,statfsSync:()=>za,symlink:()=>vu,symlinkSync:()=>La,truncate:()=>su,truncateSync:()=>Fa,umount:()=>Nn,unlink:()=>au,unlinkSync:()=>Dn,unwatchFile:()=>Bu,utimes:()=>Cu,utimesSync:()=>co,watch:()=>Mu,watchFile:()=>Du,write:()=>bu,writeFile:()=>fu,writeFileSync:()=>Qi,writeSync:()=>Oa,writev:()=>zu,writevSync:()=>$a});var D=(p=>(p[p.EPERM=1]="EPERM",p[p.ENOENT=2]="ENOENT",p[p.EINTR=4]="EINTR",p[p.EIO=5]="EIO",p[p.ENXIO=6]="ENXIO",p[p.EBADF=9]="EBADF",p[p.EAGAIN=11]="EAGAIN",p[p.ENOMEM=12]="ENOMEM",p[p.EACCES=13]="EACCES",p[p.EFAULT=14]="EFAULT",p[p.ENOTBLK=15]="ENOTBLK",p[p.EBUSY=16]="EBUSY",p[p.EEXIST=17]="EEXIST",p[p.EXDEV=18]="EXDEV",p[p.ENODEV=19]="ENODEV",p[p.ENOTDIR=20]="ENOTDIR",p[p.EISDIR=21]="EISDIR",p[p.EINVAL=22]="EINVAL",p[p.ENFILE=23]="ENFILE",p[p.EMFILE=24]="EMFILE",p[p.ETXTBSY=26]="ETXTBSY",p[p.EFBIG=27]="EFBIG",p[p.ENOSPC=28]="ENOSPC",p[p.ESPIPE=29]="ESPIPE",p[p.EROFS=30]="EROFS",p[p.EMLINK=31]="EMLINK",p[p.EPIPE=32]="EPIPE",p[p.EDOM=33]="EDOM",p[p.ERANGE=34]="ERANGE",p[p.EDEADLK=35]="EDEADLK",p[p.ENAMETOOLONG=36]="ENAMETOOLONG",p[p.ENOLCK=37]="ENOLCK",p[p.ENOSYS=38]="ENOSYS",p[p.ENOTEMPTY=39]="ENOTEMPTY",p[p.ELOOP=40]="ELOOP",p[p.ENOMSG=42]="ENOMSG",p[p.EBADE=52]="EBADE",p[p.EBADR=53]="EBADR",p[p.EXFULL=54]="EXFULL",p[p.ENOANO=55]="ENOANO",p[p.EBADRQC=56]="EBADRQC",p[p.ENOSTR=60]="ENOSTR",p[p.ENODATA=61]="ENODATA",p[p.ETIME=62]="ETIME",p[p.ENOSR=63]="ENOSR",p[p.ENONET=64]="ENONET",p[p.EREMOTE=66]="EREMOTE",p[p.ENOLINK=67]="ENOLINK",p[p.ECOMM=70]="ECOMM",p[p.EPROTO=71]="EPROTO",p[p.EBADMSG=74]="EBADMSG",p[p.EOVERFLOW=75]="EOVERFLOW",p[p.EBADFD=77]="EBADFD",p[p.ESTRPIPE=86]="ESTRPIPE",p[p.ENOTSOCK=88]="ENOTSOCK",p[p.EDESTADDRREQ=89]="EDESTADDRREQ",p[p.EMSGSIZE=90]="EMSGSIZE",p[p.EPROTOTYPE=91]="EPROTOTYPE",p[p.ENOPROTOOPT=92]="ENOPROTOOPT",p[p.EPROTONOSUPPORT=93]="EPROTONOSUPPORT",p[p.ESOCKTNOSUPPORT=94]="ESOCKTNOSUPPORT",p[p.ENOTSUP=95]="ENOTSUP",p[p.ENETDOWN=100]="ENETDOWN",p[p.ENETUNREACH=101]="ENETUNREACH",p[p.ENETRESET=102]="ENETRESET",p[p.ETIMEDOUT=110]="ETIMEDOUT",p[p.ECONNREFUSED=111]="ECONNREFUSED",p[p.EHOSTDOWN=112]="EHOSTDOWN",p[p.EHOSTUNREACH=113]="EHOSTUNREACH",p[p.EALREADY=114]="EALREADY",p[p.EINPROGRESS=115]="EINPROGRESS",p[p.ESTALE=116]="ESTALE",p[p.EREMOTEIO=121]="EREMOTEIO",p[p.EDQUOT=122]="EDQUOT",p))(D||{}),Cr={1:"Operation not permitted",2:"No such file or directory",4:"Interrupted system call",5:"Input/output error",6:"No such device or address",9:"Bad file descriptor",11:"Resource temporarily unavailable",12:"Cannot allocate memory",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Resource busy or locked",17:"File exists",18:"Invalid cross-device link",19:"No such device",20:"File is not a directory",21:"File is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",26:"Text file busy",27:"File is too big",28:"No space left on disk",29:"Illegal seek",30:"Cannot modify a read-only file system",31:"Too many links",32:"Broken pipe",33:"Numerical argument out of domain",34:"Numerical result out of range",35:"Resource deadlock would occur",36:"File name too long",37:"No locks available",38:"Function not implemented",39:"Directory is not empty",40:"Too many levels of symbolic links",42:"No message of desired type",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",60:"Device not a stream",61:"No data available",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",66:"Object is remote",67:"Link has been severed",70:"Communication error on send",71:"Protocol error",74:"Bad message",75:"Value too large for defined data type",77:"File descriptor in bad state",86:"Streams pipe error",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Protocol not supported",94:"Socket type not supported",95:"Operation is not supported",100:"Network is down",101:"Network is unreachable",102:"Network dropped connection on reset",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"No route to host",114:"Operation already in progress",115:"Operation now in progress",116:"Stale file handle",121:"Remote I/O error",122:"Disk quota exceeded"},f=class t extends Error{constructor(i,n=Cr[i],r,o=""){super(n);this.errno=i;this.path=r;this.syscall=o;this.code=D[i],this.message=`${this.code}: ${n}${this.path?`, '${this.path}'`:""}`}static{s(this,"ErrnoError")}static fromJSON(i){let n=new t(i.errno,i.message,i.path,i.syscall);return n.code=i.code,n.stack=i.stack,n}static With(i,n,r){return new t(D[i],Cr[D[i]],n,r)}toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message,syscall:this.syscall}}bufferSize(){return 4+JSON.stringify(this.toJSON()).length}};var Ft={};gn(Ft,{COPYFILE_EXCL:()=>Ii,COPYFILE_FICLONE:()=>rd,COPYFILE_FICLONE_FORCE:()=>od,F_OK:()=>vi,O_APPEND:()=>Oe,O_CREAT:()=>K,O_DIRECT:()=>dd,O_DIRECTORY:()=>ad,O_DSYNC:()=>fd,O_EXCL:()=>Ae,O_NOATIME:()=>ld,O_NOCTTY:()=>sd,O_NOFOLLOW:()=>cd,O_NONBLOCK:()=>hd,O_RDONLY:()=>Gt,O_RDWR:()=>oe,O_SYMLINK:()=>ud,O_SYNC:()=>Kt,O_TRUNC:()=>Te,O_WRONLY:()=>Pe,R_OK:()=>Ie,S_IFBLK:()=>Et,S_IFCHR:()=>xt,S_IFDIR:()=>Le,S_IFIFO:()=>kt,S_IFLNK:()=>Ce,S_IFMT:()=>J,S_IFREG:()=>Re,S_IFSOCK:()=>_t,S_IRGRP:()=>Sd,S_IROTH:()=>xd,S_IRUSR:()=>bd,S_IRWXG:()=>Lr,S_IRWXO:()=>Nr,S_IRWXU:()=>Rr,S_ISGID:()=>yd,S_ISUID:()=>pd,S_ISVTX:()=>md,S_IWGRP:()=>_d,S_IWOTH:()=>kd,S_IWUSR:()=>gd,S_IXGRP:()=>Ed,S_IXOTH:()=>Fd,S_IXUSR:()=>wd,UV_FS_O_FILEMAP:()=>vd,W_OK:()=>he,X_OK:()=>nd});var vi=0,Ie=4,he=2,nd=1,Ii=1,rd=2,od=4,Gt=0,Pe=1,oe=2,K=64,Ae=128,sd=256,Te=512,Oe=1024,ad=65536,ld=262144,cd=131072,Kt=1052672,fd=4096,ud=32768,dd=16384,hd=2048,J=61440,_t=49152,Ce=40960,Re=32768,Et=24576,Le=16384,xt=8192,kt=4096,pd=2048,yd=1024,md=512,Rr=448,bd=256,gd=128,wd=64,Lr=56,Sd=32,_d=16,Ed=8,Nr=7,xd=4,kd=2,Fd=1,vd=0;var z=(n=>(n[n.FILE=32768]="FILE",n[n.DIRECTORY=16384]="DIRECTORY",n[n.SYMLINK=40960]="SYMLINK",n))(z||{}),Pi=class{constructor({atimeMs:e,mtimeMs:i,ctimeMs:n,birthtimeMs:r,uid:o,gid:a,size:l,mode:c,ino:u}={}){this.dev=this._convert(0);this.ino=this._convert(0);this.rdev=this._convert(0);this.nlink=this._convert(1);this.blksize=this._convert(4096);this.uid=this._convert(0);this.gid=this._convert(0);let h=Date.now(),d=s((m,w)=>typeof m==this._typename?m:this._convert(typeof m==this._typename_inverse?m:w),"resolveT");this.atimeMs=d(e,h),this.mtimeMs=d(i,h),this.ctimeMs=d(n,h),this.birthtimeMs=d(r,h),this.uid=d(o,0),this.gid=d(a,0),this.size=d(l,0),this.ino=d(u,0);let b=Number(c)&61440||z.FILE;if(c)this.mode=this._convert(c);else switch(b){case z.FILE:this.mode=this._convert(420);break;case z.DIRECTORY:default:this.mode=this._convert(511)}this.blocks=this._convert(Math.ceil(Number(l)/512)),this.mode&61440||(this.mode=this.mode|this._convert(b))}static{s(this,"StatsCommon")}get _typename(){return this._isBigint?"bigint":"number"}get _typename_inverse(){return this._isBigint?"number":"bigint"}_convert(e){return this._isBigint?BigInt(e):Number(e)}get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}hasAccess(e,i){if(i.euid===0||i.egid===0)return!0;let n=(i.uid==this.uid?448:0)|(i.gid==this.gid?56:0)|7;return(e&this.mode&n)==e}cred(e=Number(this.uid),i=Number(this.gid)){return{uid:e,gid:i,suid:Number(this.uid),sgid:Number(this.gid),euid:e,egid:i}}chmod(e){this.mode=this._convert(this.mode&61440|e)}chown(e,i){e=Number(e),i=Number(i),!isNaN(e)&&0<=e&&e<2**32&&(this.uid=this._convert(e)),!isNaN(i)&&0<=i&&i<2**32&&(this.gid=this._convert(i))}get atimeNs(){return BigInt(this.atimeMs)}get mtimeNs(){return BigInt(this.mtimeMs)}get ctimeNs(){return BigInt(this.ctimeMs)}get birthtimeNs(){return BigInt(this.birthtimeMs)}},R=class t extends Pi{constructor(){super(...arguments);this._isBigint=!1}static{s(this,"Stats")}static clone(i){return new t(i)}},ie=class t extends Pi{constructor(){super(...arguments);this._isBigint=!0}static{s(this,"BigIntStats")}static clone(i){return new t(i)}},Ai=class{constructor(){this.type=0;this.bsize=0;this.blocks=0;this.bfree=0;this.bavail=0;this.files=0;this.ffree=0}static{s(this,"StatsFs")}},Dr=class{constructor(){this.type=0n;this.bsize=0n;this.blocks=0n;this.bfree=0n;this.bavail=0n;this.files=0n;this.ffree=0n}static{s(this,"BigIntStatsFs")}};var wn=2**32-1,De=0n;function zs(){return Math.round(Math.random()*2**32).toString(16)}s(zs,"_random");function Ti(){return BigInt("0x"+zs()+zs())}s(Ti,"randomIno");var Ne=class{static{s(this,"Inode")}get data(){return new Uint8Array(this.buffer)}constructor(e){let i=!e;if(e??=new ArrayBuffer(58),e?.byteLength<58)throw new RangeError("Can not create an inode from a buffer less than 58 bytes");if(this.view=new DataView(e),this.buffer=e,!i)return;this.ino=Ti(),this.nlink=1,this.size=4096;let n=Date.now();this.atimeMs=n,this.mtimeMs=n,this.ctimeMs=n,this.birthtimeMs=n}get ino(){return this.view.getBigUint64(0,!0)}set ino(e){this.view.setBigUint64(0,e,!0)}get size(){return this.view.getUint32(8,!0)}set size(e){this.view.setUint32(8,e,!0)}get mode(){return this.view.getUint16(12,!0)}set mode(e){this.view.setUint16(12,e,!0)}get nlink(){return this.view.getUint32(14,!0)}set nlink(e){this.view.setUint32(14,e,!0)}get uid(){return this.view.getUint32(18,!0)}set uid(e){this.view.setUint32(18,e,!0)}get gid(){return this.view.getUint32(22,!0)}set gid(e){this.view.setUint32(22,e,!0)}get atimeMs(){return this.view.getFloat64(26,!0)}set atimeMs(e){this.view.setFloat64(26,e,!0)}get birthtimeMs(){return this.view.getFloat64(34,!0)}set birthtimeMs(e){this.view.setFloat64(34,e,!0)}get mtimeMs(){return this.view.getFloat64(42,!0)}set mtimeMs(e){this.view.setFloat64(42,e,!0)}get ctimeMs(){return this.view.getFloat64(50,!0)}set ctimeMs(e){this.view.setFloat64(50,e,!0)}toStats(){return new R(this)}update(e){let i=!1;return this.size!==e.size&&(this.size=e.size,i=!0),this.mode!==e.mode&&(this.mode=e.mode,i=!0),this.nlink!==e.nlink&&(this.nlink=e.nlink,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.atimeMs!==e.atimeMs&&(this.atimeMs=e.atimeMs,i=!0),this.mtimeMs!==e.mtimeMs&&(this.mtimeMs=e.mtimeMs,i=!0),this.ctimeMs!==e.ctimeMs&&(this.ctimeMs=e.ctimeMs,i=!0),i}};var Sn=(r=>(r[r.NOP=0]="NOP",r[r.THROW=1]="THROW",r[r.TRUNCATE=2]="TRUNCATE",r[r.CREATE=3]="CREATE",r))(Sn||{}),Id=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];function L(t){if(typeof t=="number")return Hs(t);if(!Id.includes(t))throw new Error("Invalid flag string: "+t);return t}s(L,"parseFlag");function Hs(t){switch(t){case 0:return"r";case 1052672:return"rs";case 2:return"r+";case 1052674:return"rs+";case 577:return"w";case 705:return"wx";case 578:return"w+";case 706:return"wx+";case 1089:return"a";case 1217:return"ax";case 1090:return"a+";case 1218:return"ax+";default:throw new Error("Invalid flag number: "+t)}}s(Hs,"flagToString");function Pd(t){switch(t){case"r":return 0;case"rs":return 1052672;case"r+":return 2;case"rs+":return 1052674;case"w":return 577;case"wx":return 705;case"w+":return 578;case"wx+":return 706;case"a":return 1089;case"ax":return 1217;case"a+":return 1090;case"ax+":return 1218;default:throw new Error("Invalid flag string: "+t)}}s(Pd,"flagToNumber");function It(t){let e=0;return e<<=1,e+=+st(t),e<<=1,e+=+pe(t),e<<=1,e}s(It,"flagToMode");function st(t){return t.indexOf("r")!==-1||t.indexOf("+")!==-1}s(st,"isReadable");function pe(t){return t.indexOf("w")!==-1||t.indexOf("a")!==-1||t.indexOf("+")!==-1}s(pe,"isWriteable");function Ys(t){return t.indexOf("w")!==-1}s(Ys,"isTruncating");function at(t){return t.indexOf("a")!==-1}s(at,"isAppendable");function Oi(t){return t.indexOf("s")!==-1}s(Oi,"isSynchronous");function Gs(t){return t.indexOf("x")!==-1}s(Gs,"isExclusive");function Ci(t){return Gs(t)?1:Ys(t)?2:0}s(Ci,"pathExistsAction");function Ri(t){return(pe(t)||at(t))&&t!=="r+"?3:1}s(Ri,"pathNotExistsAction");var vt=class{static{s(this,"File")}[Symbol.asyncDispose](){return this.close()}[Symbol.dispose](){return this.closeSync()}datasync(){return this.sync()}datasyncSync(){return this.syncSync()}},ce=class extends vt{constructor(i,n,r,o,a=new Uint8Array(new ArrayBuffer(0,{maxByteLength:wn}))){super();this.fs=i;this.path=n;this.flag=r;this.stats=o;this._buffer=a;this._position=0;this._dirty=!1;if(this.stats.size!=a.byteLength){if(st(this.flag))throw new Error(`Size mismatch: buffer length ${a.byteLength}, stats size ${this.stats.size}`);this._dirty=!0}}static{s(this,"PreloadFile")}get buffer(){return this._buffer}get position(){return at(this.flag)?this.stats.size:this._position}set position(i){this._position=i}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this._buffer,this.stats),this._dirty=!1)}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this._dirty=!1)}async close(){await this.sync()}closeSync(){this.syncSync()}async stat(){return new R(this.stats)}statSync(){return new R(this.stats)}async truncate(i){if(this.truncateSync(i),Oi(this.flag))return this.sync()}truncateSync(i){if(this._dirty=!0,!pe(this.flag))throw new f(1,"File not opened with a writeable mode.");if(this.stats.mtimeMs=Date.now(),i>this._buffer.length){let n=new Uint8Array(i-this._buffer.length);this.writeSync(n,0,n.length,this._buffer.length),Oi(this.flag)&&this.syncSync();return}this.stats.size=i,this._buffer=this._buffer.subarray(0,i),Oi(this.flag)&&this.syncSync()}async write(i,n=0,r=this.stats.size,o=0){let a=this.writeSync(i,n,r,o);return await this.sync(),a}writeSync(i,n=0,r=this.stats.size,o=0){if(this._dirty=!0,o??=this.position,!pe(this.flag))throw new f(1,"File not opened with a writeable mode.");let a=o+r;if(a>this.stats.size&&(this.stats.size=a,a>this._buffer.byteLength))if(this._buffer.buffer.resizable&&this._buffer.buffer.maxByteLength<=a)this._buffer.buffer.resize(a);else{let u=new Uint8Array(new ArrayBuffer(a,{maxByteLength:wn}));u.set(this._buffer),this._buffer=u}let l=i.slice(n,n+r);this._buffer.set(l,o);let c=l.byteLength;return this.stats.mtimeMs=Date.now(),Oi(this.flag)?(this.syncSync(),c):(this.position=o+c,c)}async read(i,n=0,r=this.stats.size,o=0){return{bytesRead:this.readSync(i,n,r,o),buffer:i}}readSync(i,n=0,r=this.stats.size,o){if(!st(this.flag))throw new f(1,"File not opened with a readable mode.");o??=this.position;let a=o+r;a>this.stats.size&&(a=o+Math.max(this.stats.size-o,0)),this.stats.atimeMs=Date.now(),this._position=a;let l=a-o;return l==0||new Uint8Array(i.buffer,n,r).set(this._buffer.slice(o,a)),l}async chmod(i){this.chmodSync(i)}chmodSync(i){this._dirty=!0,this.stats.chmod(i),this.syncSync()}async chown(i,n){this.chownSync(i,n)}chownSync(i,n){this._dirty=!0,this.stats.chown(i,n),this.syncSync()}async utimes(i,n){this.utimesSync(i,n)}utimesSync(i,n){this._dirty=!0,this.stats.atime=i,this.stats.mtime=n,this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}_setType(i){return this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.sync()}_setTypeSync(i){this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.syncSync()}},Ke=class extends ce{static{s(this,"NoSyncFile")}constructor(e,i,n,r,o){super(e,i,n,r,o)}async sync(){}syncSync(){}async close(){}closeSync(){}};var Be={uid:0,gid:0,suid:0,sgid:0,euid:0,egid:0};var Ad="/";function Ks(t,e){let i="",n=0,r=-1,o=0,a="\0";for(let l=0;l<=t.length;++l){if(l<t.length)a=t[l];else{if(a=="/")break;a="/"}if(a=="/"){if(!(r===l-1||o===1))if(o===2){if(i.length<2||n!==2||i.at(-1)!=="."||i.at(-2)!=="."){if(i.length>2){let c=i.lastIndexOf("/");c===-1?(i="",n=0):(i=i.slice(0,c),n=i.length-1-i.lastIndexOf("/")),r=l,o=0;continue}else if(i.length!==0){i="",n=0,r=l,o=0;continue}}e&&(i+=i.length>0?"/..":"..",n=2)}else i.length>0?i+="/"+t.slice(r+1,l):i=t.slice(r+1,l),n=l-r-1;r=l,o=0}else a==="."&&o!==-1?++o:o=-1}return i}s(Ks,"normalizeString");function lt(...t){let e="";for(let n of[...t.reverse(),Ad])if(n.length&&(e=`${n}/${e}`,n.startsWith("/")))break;let i=e.startsWith("/");return e=Ks(e,!i),i?`/${e}`:e.length?e:"/"}s(lt,"resolve");function Td(t){if(!t.length)return".";let e=t.startsWith("/"),i=t.endsWith("/");return t=Ks(t,!e),t.length?(i&&(t+="/"),e?`/${t}`:t):e?"/":i?"./":"."}s(Td,"normalize");function B(...t){if(!t.length)return".";let e=t.join("/");return e?.length?Td(e):"."}s(B,"join");function v(t){if(t.length===0)return".";let e=t[0]==="/",i=-1,n=!0;for(let r=t.length-1;r>=1;--r)if(t[r]==="/"){if(!n){i=r;break}}else n=!1;return i===-1?e?"/":".":e&&i===1?"//":t.slice(0,i)}s(v,"dirname");function N(t,e){let i=0,n=-1,r=!0;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e===t)return"";let o=e.length-1,a=-1;for(let l=t.length-1;l>=0;--l)if(t[l]==="/"){if(!r){i=l+1;break}}else a===-1&&(r=!1,a=l+1),o>=0&&(t[l]===e[o]?--o===-1&&(n=l):(o=-1,n=a));return i===n?n=a:n===-1&&(n=t.length),t.slice(i,n)}for(let o=t.length-1;o>=0;--o)if(t[o]==="/"){if(!r){i=o+1;break}}else n===-1&&(r=!1,n=o+1);return n===-1?"":t.slice(i,n)}s(N,"basename");function _n(t){let e=t.startsWith("/"),i={root:e?"/":"",dir:"",base:"",ext:"",name:""};if(t.length===0)return i;let n=e?1:0,r=-1,o=0,a=-1,l=!0,c=t.length-1,u=0;for(;c>=n;--c){if(t[c]==="/"){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),t[c]==="."?r===-1?r=c:u!==1&&(u=1):r!==-1&&(u=-1)}if(a!==-1){let h=o===0&&e?1:o;r===-1||u===0||u===1&&r===a-1&&r===o+1?i.base=i.name=t.slice(h,a):(i.name=t.slice(h,r),i.base=t.slice(h,a),i.ext=t.slice(r,a))}return o>0?i.dir=t.slice(0,o-1):e&&(i.dir="/"),i}s(_n,"parse");var se=class{static{s(this,"FileSystem")}metadata(){return{name:this.constructor.name,readonly:!1,totalSpace:0,freeSpace:0}}constructor(e){}async ready(){}async exists(e,i){try{return await this.stat(e,i),!0}catch{return!1}}existsSync(e,i){try{return this.statSync(e,i),!0}catch{return!1}}};function Od(t){class e extends t{static{s(this,"_SyncFileSystem")}async exists(n,r){return this.existsSync(n,r)}async rename(n,r,o){return this.renameSync(n,r,o)}async stat(n,r){return this.statSync(n,r)}async createFile(n,r,o,a){return this.createFileSync(n,r,o,a)}async openFile(n,r,o){return this.openFileSync(n,r,o)}async unlink(n,r){return this.unlinkSync(n,r)}async rmdir(n,r){return this.rmdirSync(n,r)}async mkdir(n,r,o){return this.mkdirSync(n,r,o)}async readdir(n,r){return this.readdirSync(n,r)}async link(n,r,o){return this.linkSync(n,r,o)}async sync(n,r,o){return this.syncSync(n,r,o)}}return e}s(Od,"Sync");function Br(t){class e extends t{constructor(){super(...arguments);this._queue=[];this._isInitialized=!1}static{s(this,"_AsyncFileSystem")}get _queueRunning(){return!!this._queue.length}queueDone(){return new Promise(r=>{let o=s(()=>this._queueRunning?setTimeout(o):r(),"check");o()})}async ready(){if(await this._sync.ready(),await super.ready(),!this._isInitialized)try{await this.crossCopy("/"),this._isInitialized=!0}catch(r){throw this._isInitialized=!1,r}}renameSync(r,o,a){this._sync.renameSync(r,o,a),this.queue("rename",r,o,a)}statSync(r,o){return this._sync.statSync(r,o)}createFileSync(r,o,a,l){let c=this._sync.createFileSync(r,o,a,l);this.queue("createFile",r,o,a,l);let u=c.statSync(),h=new Uint8Array(u.size);return c.readSync(h),new ce(this,r,o,u,h)}openFileSync(r,o,a){return this._sync.openFileSync(r,o,a)}unlinkSync(r,o){this._sync.unlinkSync(r,o),this.queue("unlink",r,o)}rmdirSync(r,o){this._sync.rmdirSync(r,o),this.queue("rmdir",r,o)}mkdirSync(r,o,a){this._sync.mkdirSync(r,o,a),this.queue("mkdir",r,o,a)}readdirSync(r,o){return this._sync.readdirSync(r,o)}linkSync(r,o,a){this._sync.linkSync(r,o,a),this.queue("link",r,o,a)}syncSync(r,o,a){this._sync.syncSync(r,o,a),this.queue("sync",r,o,a)}existsSync(r,o){return this._sync.existsSync(r,o)}async crossCopy(r){let o=await this.stat(r,Be);if(o.isDirectory()){if(r!=="/"){let l=await this.stat(r,Be);this._sync.mkdirSync(r,l.mode,l.cred())}let a=await this.readdir(r,Be);for(let l of a)await this.crossCopy(B(r,l))}else{let a=await this.openFile(r,L("r"),Be),l=this._sync.createFileSync(r,L("w"),o.mode,o.cred());try{let c=new Uint8Array(o.size);await a.read(c),l.writeSync(c,0,o.size)}finally{await a.close(),l.closeSync()}}}async _next(){if(!this._queueRunning)return;let[r,...o]=this._queue.shift();await this[r](...o),await this._next()}queue(...r){this._queue.push(r),this._next()}}return e}s(Br,"Async");function Mr(t){class e extends t{static{s(this,"_ReadonlyFileSystem")}metadata(){return{...super.metadata(),readonly:!0}}async rename(n,r,o){throw new f(30)}renameSync(n,r,o){throw new f(30)}async createFile(n,r,o,a){throw new f(30)}createFileSync(n,r,o,a){throw new f(30)}async unlink(n,r){throw new f(30)}unlinkSync(n,r){throw new f(30)}async rmdir(n,r){throw new f(30)}rmdirSync(n,r){throw new f(30)}async mkdir(n,r,o){throw new f(30)}mkdirSync(n,r,o){throw new f(30)}async link(n,r,o){throw new f(30)}linkSync(n,r,o){throw new f(30)}async sync(n,r,o){throw new f(30)}syncSync(n,r,o){throw new f(30)}}return e}s(Mr,"Readonly");function Xs(t,e,i,n){n.existsSync(t,i)||(Xs(v(t),e,i,n),n.mkdirSync(t,e,i))}s(Xs,"mkdirpSync");function En(t,e,i,n,r){return Math.min(t+1,e+1,i+1,n===r?e:e+1)}s(En,"_min");function Wr(t,e){if(t===e)return 0;t.length>e.length&&([t,e]=[e,t]);let i=t.length,n=e.length;for(;i>0&&t.charCodeAt(i-1)===e.charCodeAt(n-1);)i--,n--;let r=0;for(;r<i&&t.charCodeAt(r)===e.charCodeAt(r);)r++;if(i-=r,n-=r,i===0||n===1)return n;let o=new Array(i<<1);for(let b=0;b<i;)o[i+b]=t.charCodeAt(r+b),o[b]=++b;let a,l,c,u,h;for(a=0;a+3<n;){let b=e.charCodeAt(r+(l=a)),m=e.charCodeAt(r+(c=a+1)),w=e.charCodeAt(r+(u=a+2)),g=e.charCodeAt(r+(h=a+3)),I=a+=4;for(let _=0;_<i;){let T=o[i+_],q=o[_];l=En(q,l,c,b,T),c=En(l,c,u,m,T),u=En(c,u,h,w,T),I=En(u,h,I,g,T),o[_++]=I,h=u,u=c,c=l,l=q}}let d=0;for(;a<n;){let b=e.charCodeAt(r+(l=a));d=++a;for(let m=0;m<i;m++){let w=o[m];o[m]=d=w<l||d<l?w>d?d+1:w+1:b===o[i+m]?l:l+1,l=w}}return d}s(Wr,"levenshtein");var Cd=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:t=>setTimeout(t,0);function Xe(t){if(typeof t!="string")throw new f(22,"Can not encode a non-string");return new Uint8Array(Array.from(t).map(e=>e.charCodeAt(0)))}s(Xe,"encode");function xn(t){if(!(t instanceof Uint8Array))throw new f(22,"Can not decode a non-Uint8Array");return Array.from(t).map(e=>String.fromCharCode(e)).join("")}s(xn,"decode");function kn(t){return JSON.parse(xn(t),(e,i)=>e==""?i:BigInt(i))}s(kn,"decodeDirListing");function ye(t){return Xe(JSON.stringify(t,(e,i)=>e==""?i:i.toString()))}s(ye,"encodeDirListing");function Rd(t){if(typeof t=="number")return Math.floor(t);if(t instanceof Date)return Math.floor(t.getTime()/1e3);throw new Error("Cannot parse time: "+t)}s(Rd,"_toUnixTimestamp");function me(t,e){if(typeof t=="number")return t;if(typeof t=="string"){let i=parseInt(t,8);if(!isNaN(i))return i}if(typeof e=="number")return e;throw new f(22,"Invalid mode: "+t?.toString())}s(me,"normalizeMode");function Pt(t){if(t instanceof Date)return t;if(typeof t=="number")return new Date(t*1e3);if(typeof t=="string")return new Date(t);throw new f(22,"Invalid time.")}s(Pt,"normalizeTime");function x(t){if(t=t.toString(),t.includes("\0"))throw new f(22,"Path can not contain null character");if(t.length==0)throw new f(22,"Path can not be empty");return lt(t.replaceAll(/[/\\]+/g,"/"))}s(x,"normalizePath");function be(t,e="utf8",i,n=0){return typeof t!="object"||t===null?{encoding:typeof t=="string"?t:e??null,flag:i,mode:n}:{encoding:typeof t?.encoding=="string"?t.encoding:e??null,flag:typeof t?.flag=="string"?t.flag:i,mode:me("mode"in t?t?.mode:null,n)}}s(be,"normalizeOptions");function S(){}s(S,"nop");var Js=5,Li=class extends se{constructor(i){super();this.$store=i;this._initialized=!1;i instanceof Promise||(this._store=i,this._initialized=!0,this.makeRootDirectorySync())}static{s(this,"StoreFS")}get store(){if(!this._store)throw new f(61,"No store attached");return this._store}async ready(){await super.ready(),!this._initialized&&(this._initialized=!0,this._store=await this.$store)}metadata(){return{...super.metadata(),name:this.store.name}}async empty(){await this.store.clear(),await this.makeRootDirectory()}emptySync(){this.store.clearSync(),this.makeRootDirectorySync()}async rename(i,n,r){let o=this.store.transaction(),a=v(i),l=N(i),c=v(n),u=N(n),h=await this.findINode(o,a),d=await this.getDirListing(o,h,a);if(!h.toStats().hasAccess(2,r))throw f.With("EACCES",i,"rename");if(!d[l])throw f.With("ENOENT",i,"rename");let b=d[l];if(delete d[l],(c+"/").indexOf(i+"/")===0)throw new f(16,a);let m,w;if(c===a?(m=h,w=d):(m=await this.findINode(o,c),w=await this.getDirListing(o,m,c)),w[u]){let g=await this.getINode(o,w[u],n);if(g.toStats().isFile())try{await o.remove(g.ino),await o.remove(w[u])}catch(I){throw await o.abort(),I}else throw f.With("EPERM",n,"rename")}w[u]=b;try{await o.set(h.ino,ye(d)),await o.set(m.ino,ye(w))}catch(g){throw await o.abort(),g}await o.commit()}renameSync(i,n,r){let o=this.store.transaction(),a=v(i),l=N(i),c=v(n),u=N(n),h=this.findINodeSync(o,a),d=this.getDirListingSync(o,h,a);if(!h.toStats().hasAccess(2,r))throw f.With("EACCES",i,"rename");if(!d[l])throw f.With("ENOENT",i,"rename");let b=d[l];if(delete d[l],(c+"/").indexOf(i+"/")==0)throw new f(16,a);let m,w;if(c===a?(m=h,w=d):(m=this.findINodeSync(o,c),w=this.getDirListingSync(o,m,c)),w[u]){let g=this.getINodeSync(o,w[u],n);if(g.toStats().isFile())try{o.removeSync(g.ino),o.removeSync(w[u])}catch(I){throw o.abortSync(),I}else throw f.With("EPERM",n,"rename")}w[u]=b;try{o.setSync(h.ino,ye(d)),o.setSync(m.ino,ye(w))}catch(g){throw o.abortSync(),g}o.commitSync()}async stat(i,n){let r=this.store.transaction(),o=await this.findINode(r,i);if(!o)throw f.With("ENOENT",i,"stat");let a=o.toStats();if(!a.hasAccess(4,n))throw f.With("EACCES",i,"stat");return a}statSync(i,n){let r=this.findINodeSync(this.store.transaction(),i).toStats();if(!r.hasAccess(4,n))throw f.With("EACCES",i,"stat");return r}async createFile(i,n,r,o){let a=new Uint8Array(0),l=await this.commitNew(this.store.transaction(),i,z.FILE,r,o,a);return new ce(this,i,n,l.toStats(),a)}createFileSync(i,n,r,o){return this.commitNewSync(i,z.FILE,r,o),this.openFileSync(i,n,o)}async openFile(i,n,r){let o=this.store.transaction(),a=await this.findINode(o,i),l=await o.get(a.ino);if(!a.toStats().hasAccess(It(n),r))throw f.With("EACCES",i,"openFile");if(!l)throw f.With("ENOENT",i,"openFile");return new ce(this,i,n,a.toStats(),l)}openFileSync(i,n,r){let o=this.store.transaction(),a=this.findINodeSync(o,i),l=o.getSync(a.ino);if(!a.toStats().hasAccess(It(n),r))throw f.With("EACCES",i,"openFile");if(!l)throw f.With("ENOENT",i,"openFile");return new ce(this,i,n,a.toStats(),l)}async unlink(i,n){return this.remove(i,!1,n)}unlinkSync(i,n){this.removeSync(i,!1,n)}async rmdir(i,n){if((await this.readdir(i,n)).length>0)throw f.With("ENOTEMPTY",i,"rmdir");await this.remove(i,!0,n)}rmdirSync(i,n){if(this.readdirSync(i,n).length>0)throw f.With("ENOTEMPTY",i,"rmdir");this.removeSync(i,!0,n)}async mkdir(i,n,r){let o=this.store.transaction(),a=Xe("{}");await this.commitNew(o,i,z.DIRECTORY,n,r,a)}mkdirSync(i,n,r){this.commitNewSync(i,z.DIRECTORY,n,r,Xe("{}"))}async readdir(i,n){let r=this.store.transaction(),o=await this.findINode(r,i);if(!o.toStats().hasAccess(4,n))throw f.With("EACCES",i,"readdur");return Object.keys(await this.getDirListing(r,o,i))}readdirSync(i,n){let r=this.store.transaction(),o=this.findINodeSync(r,i);if(!o.toStats().hasAccess(4,n))throw f.With("EACCES",i,"readdir");return Object.keys(this.getDirListingSync(r,o,i))}async sync(i,n,r){let o=this.store.transaction(),a=await this._findINode(o,v(i),N(i)),l=await this.getINode(o,a,i),c=l.update(r);try{await o.set(l.ino,n),c&&await o.set(a,l.data)}catch(u){throw await o.abort(),u}await o.commit()}syncSync(i,n,r){let o=this.store.transaction(),a=this._findINodeSync(o,v(i),N(i)),l=this.getINodeSync(o,a,i),c=l.update(r);try{o.setSync(l.ino,n),c&&o.setSync(a,l.data)}catch(u){throw o.abortSync(),u}o.commitSync()}async link(i,n,r){let o=this.store.transaction(),a=v(i);if(!(await this.findINode(o,a)).toStats().hasAccess(4,r))throw f.With("EACCES",a,"link");let c=v(n),u=await this.findINode(o,c),h=await this.getDirListing(o,u,c);if(!u.toStats().hasAccess(2,r))throw f.With("EACCES",c,"link");let d=await this._findINode(o,a,N(i)),b=await this.getINode(o,d,i);if(!b.toStats().hasAccess(2,r))throw f.With("EACCES",n,"link");b.nlink++,h[N(n)]=d;try{o.setSync(d,b.data),o.setSync(u.ino,ye(h))}catch(m){throw o.abortSync(),m}o.commitSync()}linkSync(i,n,r){let o=this.store.transaction(),a=v(i);if(!this.findINodeSync(o,a).toStats().hasAccess(4,r))throw f.With("EACCES",a,"link");let c=v(n),u=this.findINodeSync(o,c),h=this.getDirListingSync(o,u,c);if(!u.toStats().hasAccess(2,r))throw f.With("EACCES",c,"link");let d=this._findINodeSync(o,a,N(i)),b=this.getINodeSync(o,d,i);if(!b.toStats().hasAccess(2,r))throw f.With("EACCES",n,"link");b.nlink++,h[N(n)]=d;try{o.setSync(d,b.data),o.setSync(u.ino,ye(h))}catch(m){throw o.abortSync(),m}o.commitSync()}async makeRootDirectory(){let i=this.store.transaction();if(await i.get(De))return;let n=new Ne;n.mode=511|z.DIRECTORY,await i.set(n.ino,Xe("{}")),await i.set(De,n.data),await i.commit()}makeRootDirectorySync(){let i=this.store.transaction();if(i.getSync(De))return;let n=new Ne;n.mode=511|z.DIRECTORY,i.setSync(n.ino,Xe("{}")),i.setSync(De,n.data),i.commitSync()}async _findINode(i,n,r,o=new Set){let a=B(n,r);if(o.has(a))throw new f(5,"Infinite loop detected while finding inode",a);if(o.add(a),n=="/"&&r==="")return De;let l=n=="/"?await this.getINode(i,De,n):await this.findINode(i,n,o),c=await this.getDirListing(i,l,n);if(!(r in c))throw f.With("ENOENT",lt(n,r),"_findINode");return c[r]}_findINodeSync(i,n,r,o=new Set){let a=B(n,r);if(o.has(a))throw new f(5,"Infinite loop detected while finding inode",a);if(o.add(a),n=="/"&&r==="")return De;let l=n=="/"?this.getINodeSync(i,De,n):this.findINodeSync(i,n,o),c=this.getDirListingSync(i,l,n);if(!(r in c))throw f.With("ENOENT",lt(n,r),"_findINode");return c[r]}async findINode(i,n,r=new Set){let o=await this._findINode(i,v(n),N(n),r);return this.getINode(i,o,n)}findINodeSync(i,n,r=new Set){let o=this._findINodeSync(i,v(n),N(n),r);return this.getINodeSync(i,o,n)}async getINode(i,n,r){let o=await i.get(n);if(!o)throw f.With("ENOENT",r,"getINode");return new Ne(o.buffer)}getINodeSync(i,n,r){let o=i.getSync(n);if(!o)throw f.With("ENOENT",r,"getINode");return new Ne(o.buffer)}async getDirListing(i,n,r){if(!n.toStats().isDirectory())throw f.With("ENOTDIR",r,"getDirListing");let o=await i.get(n.ino);if(!o)throw f.With("ENOENT",r,"getDirListing");return kn(o)}getDirListingSync(i,n,r){if(!n.toStats().isDirectory())throw f.With("ENOTDIR",r,"getDirListing");let o=i.getSync(n.ino);if(!o)throw f.With("ENOENT",r,"getDirListing");return kn(o)}async addNew(i,n,r){for(let o=0;o<Js;o++){let a=Ti();if(!await i.get(a))return await i.set(a,n),a}throw new f(28,"No inode IDs available",r,"addNewNode")}addNewSync(i,n,r){for(let o=0;o<Js;o++){let a=Ti();if(!i.getSync(a))return i.setSync(a,n),a}throw new f(28,"No inode IDs available",r,"addNewNode")}async commitNew(i,n,r,o,a,l){let c=v(n),u=await this.findINode(i,c);if(!u.toStats().hasAccess(2,a))throw f.With("EACCES",n,"commitNewFile");let h=N(n),d=await this.getDirListing(i,u,c);if(n==="/")throw f.With("EEXIST",n,"commitNewFile");if(d[h])throw await i.abort(),f.With("EEXIST",n,"commitNewFile");try{let b=new Ne;return b.ino=await this.addNew(i,l,n),b.mode=o|r,b.uid=a.uid,b.gid=a.gid,b.size=l.length,d[h]=await this.addNew(i,b.data,n),await i.set(u.ino,ye(d)),await i.commit(),b}catch(b){throw i.abort(),b}}commitNewSync(i,n,r,o,a=new Uint8Array){let l=this.store.transaction(),c=v(i),u=this.findINodeSync(l,c);if(!u.toStats().hasAccess(2,o))throw f.With("EACCES",i,"commitNewFile");let h=N(i),d=this.getDirListingSync(l,u,c);if(i==="/")throw f.With("EEXIST",i,"commitNewFile");if(d[h])throw f.With("EEXIST",i,"commitNewFile");let b=new Ne;try{b.ino=this.addNewSync(l,a,i),b.size=a.length,b.mode=r|n,b.uid=o.uid,b.gid=o.gid,d[h]=this.addNewSync(l,b.data,i),l.setSync(u.ino,ye(d))}catch(m){throw l.abortSync(),m}return l.commitSync(),b}async remove(i,n,r){let o=this.store.transaction(),a=v(i),l=await this.findINode(o,a),c=await this.getDirListing(o,l,a),u=N(i);if(!c[u])throw f.With("ENOENT",i,"removeEntry");let h=c[u],d=await this.getINode(o,h,i);if(!d.toStats().hasAccess(2,r))throw f.With("EACCES",i,"removeEntry");if(delete c[u],!n&&d.toStats().isDirectory())throw f.With("EISDIR",i,"removeEntry");if(n&&!d.toStats().isDirectory())throw f.With("ENOTDIR",i,"removeEntry");try{await o.set(l.ino,ye(c)),--d.nlink<1&&(await o.remove(d.ino),await o.remove(h))}catch(b){throw await o.abort(),b}await o.commit()}removeSync(i,n,r){let o=this.store.transaction(),a=v(i),l=this.findINodeSync(o,a),c=this.getDirListingSync(o,l,a),u=N(i),h=c[u];if(!h)throw f.With("ENOENT",i,"removeEntry");let d=this.getINodeSync(o,h,i);if(!d.toStats().hasAccess(2,r))throw f.With("EACCES",i,"removeEntry");if(delete c[u],!n&&d.toStats().isDirectory())throw f.With("EISDIR",i,"removeEntry");if(n&&!d.toStats().isDirectory())throw f.With("ENOTDIR",i,"removeEntry");try{o.setSync(l.ino,ye(c)),--d.nlink<1&&(o.removeSync(d.ino),o.removeSync(h))}catch(b){throw o.abortSync(),b}o.commitSync()}};var Ni=class{constructor(){this.aborted=!1}static{s(this,"Transaction")}async[Symbol.asyncDispose](){this.aborted||await this.commit()}[Symbol.dispose](){this.aborted||this.commitSync()}},Di=class extends Ni{static{s(this,"SyncTransaction")}async get(e){return this.getSync(e)}async set(e,i){return this.setSync(e,i)}async remove(e){return this.removeSync(e)}async commit(){return this.commitSync()}async abort(){return this.abortSync()}},Ur=class extends Ni{static{s(this,"AsyncTransaction")}getSync(e){throw f.With("ENOSYS",void 0,"AsyncTransaction.getSync")}setSync(e,i){throw f.With("ENOSYS",void 0,"AsyncTransaction.setSync")}removeSync(e){throw f.With("ENOSYS",void 0,"AsyncTransaction.removeSync")}commitSync(){throw f.With("ENOSYS",void 0,"AsyncTransaction.commitSync")}abortSync(){throw f.With("ENOSYS",void 0,"AsyncTransaction.abortSync")}};var qr=class{constructor(){this.cache=new Map;this.queue=new Set}static{s(this,"SimpleAsyncStore")}get(e){return this.cache.get(e)}set(e,i){this.cache.set(e,i),this.queue.add(this._set(e,i))}delete(e){this.cache.delete(e),this.queue.add(this._delete(e))}clearSync(){this.cache.clear(),this.queue.add(this.clear())}async sync(){for(let[e,i]of await this.entries())this.cache.has(e)||this.cache.set(e,i);for(let e of this.queue)await e}transaction(){return new Xt(this)}},Xt=class extends Di{constructor(i){super();this.store=i;this.originalData=new Map;this.modifiedKeys=new Set}static{s(this,"SimpleTransaction")}getSync(i){let n=this.store.get(i);return this.stashOldValue(i,n),n}setSync(i,n){return this.markModified(i),this.store.set(i,n)}removeSync(i){this.markModified(i),this.store.delete(i)}commitSync(){}abortSync(){for(let i of this.modifiedKeys){let n=this.originalData.get(i);n?this.store.set(i,n):this.store.delete(i)}}stashOldValue(i,n){this.originalData.has(i)||this.originalData.set(i,n)}markModified(i){this.modifiedKeys.add(i),this.originalData.has(i)||this.originalData.set(i,this.store.get(i))}};var Fn=class extends Map{constructor(i="tmp"){super();this.name=i}static{s(this,"InMemoryStore")}async sync(){}clearSync(){this.clear()}transaction(){return new Xt(this)}},Bi={name:"InMemory",isAvailable:s(function(){return!0},"isAvailable"),options:{name:{type:"string",required:!1,description:"The name of the store"}},create:s(function({name:t}){return new Li(new Fn(t))},"create")};function Ld(t){return typeof t=="object"&&t!=null&&"fd"in t&&"path"in t&&"position"in t}s(Ld,"isFileData");function jr(t){return typeof t=="object"&&t!=null&&"_zenfs"in t&&!!t._zenfs}s(jr,"isMessage");var Jt=new Map;function $r(t,{port:e,timeout:i=1e3,fs:n}={}){let r=new Error().stack.slice(6);if(!e)throw f.With("EINVAL");return new Promise((o,a)=>{let l=Math.random().toString(16).slice(10);Jt.set(l,{resolve:o,reject:a,fs:n}),e.postMessage({...t,_zenfs:!0,id:l,stack:r}),setTimeout(()=>{let c=new f(5,"RPC Failed");c.stack+=r,a(c)},i)})}s($r,"request");function Qs(t){if(!jr(t))return;let{id:e,value:i,error:n,stack:r}=t;if(!Jt.has(e)){let c=new f(5,"Invalid RPC id:"+e);throw c.stack+=r,c}let{resolve:o,reject:a,fs:l}=Jt.get(e);if(n){let c=f.fromJSON(i);c.stack+=r,a(c),Jt.delete(e);return}if(Ld(i)){let{fd:c,path:u,position:h}=i,d=new Mi(l,c,u,h);o(d),Jt.delete(e);return}o(i),Jt.delete(e)}s(Qs,"handleResponse");function Vr(t,e){if(!t)throw f.With("EINVAL");t["on"in t?"on":"addEventListener"]("message",i=>{e("data"in i?i.data:i)})}s(Vr,"attach");function Zs(t,e){if(!t)throw f.With("EINVAL");t["off"in t?"off":"removeEventListener"]("message",i=>{e("data"in i?i.data:i)})}s(Zs,"detach");var Mi=class extends vt{constructor(i,n,r,o){super();this.fs=i;this.fd=n;this.path=r;this.position=o}static{s(this,"PortFile")}rpc(i,...n){return $r({scope:"file",fd:this.fd,method:i,args:n},this.fs.options)}stat(){return this.rpc("stat")}statSync(){throw f.With("ENOSYS",this.path,"PortFile.stat")}truncate(i){return this.rpc("truncate",i)}truncateSync(){throw f.With("ENOSYS",this.path,"PortFile.truncate")}write(i,n,r,o){return this.rpc("write",i,n,r,o)}writeSync(){throw f.With("ENOSYS",this.path,"PortFile.write")}async read(i,n,r,o){return await this.rpc("read",i,n,r,o)}readSync(){throw f.With("ENOSYS",this.path,"PortFile.read")}chown(i,n){return this.rpc("chown",i,n)}chownSync(){throw f.With("ENOSYS",this.path,"PortFile.chown")}chmod(i){return this.rpc("chmod",i)}chmodSync(){throw f.With("ENOSYS",this.path,"PortFile.chmod")}utimes(i,n){return this.rpc("utimes",i,n)}utimesSync(){throw f.With("ENOSYS",this.path,"PortFile.utimes")}_setType(i){return this.rpc("_setType",i)}_setTypeSync(){throw f.With("ENOSYS",this.path,"PortFile._setType")}close(){return this.rpc("close")}closeSync(){throw f.With("ENOSYS",this.path,"PortFile.close")}sync(){return this.rpc("sync")}syncSync(){throw f.With("ENOSYS",this.path,"PortFile.sync")}},In=class extends Br(se){constructor(i){super();this.options=i;this._sync=Bi.create({name:"port-tmpfs"});this.port=i.port,Vr(this.port,Qs)}static{s(this,"PortFS")}metadata(){return{...super.metadata(),name:"PortFS"}}rpc(i,...n){return $r({scope:"fs",method:i,args:n},{...this.options,fs:this})}async ready(){await this.rpc("ready"),await super.ready()}rename(i,n,r){return this.rpc("rename",i,n,r)}async stat(i,n){return new R(await this.rpc("stat",i,n))}sync(i,n,r){return this.rpc("sync",i,n,r)}openFile(i,n,r){return this.rpc("openFile",i,n,r)}createFile(i,n,r,o){return this.rpc("createFile",i,n,r,o)}unlink(i,n){return this.rpc("unlink",i,n)}rmdir(i,n){return this.rpc("rmdir",i,n)}mkdir(i,n,r){return this.rpc("mkdir",i,n,r)}readdir(i,n){return this.rpc("readdir",i,n)}exists(i,n){return this.rpc("exists",i,n)}link(i,n,r){return this.rpc("link",i,n,r)}},ea=0,vn=new Map;async function ta(t,e,i){if(!jr(i))return;let{method:n,args:r,id:o,scope:a,stack:l}=i,c,u=!1;try{switch(a){case"fs":c=await e[n](...r),c instanceof vt&&(vn.set(++ea,c),c={fd:ea,path:c.path,position:c.position});break;case"file":let{fd:h}=i;if(!vn.has(h))throw new f(9);c=await vn.get(h)[n](...r),n=="close"&&vn.delete(h);break;default:return}}catch(h){c=h,u=!0}t.postMessage({_zenfs:!0,scope:a,id:o,error:u,method:n,stack:l,value:c instanceof f?c.toJSON():c})}s(ta,"handleRequest");function Dd(t,e){Vr(t,i=>ta(t,e,i))}s(Dd,"attachFS");function Bd(t,e){Zs(t,i=>ta(t,e,i))}s(Bd,"detachFS");var Md={name:"Port",options:{port:{type:"object",required:!0,description:"The target port that you want to connect to",validator:s(function(t){if(typeof t?.postMessage!="function")throw new f(22,"option must be a port.")},"validator")},timeout:{type:"number",required:!1,description:"How long to wait before the request times out"}},isAvailable:s(async function(){return!0},"isAvailable"),create:s(function(t){return new In(t)},"create")};var At=class t{constructor(){this._index=new Map;this.add("/",new ct)}static{s(this,"FileIndex")}static FromListing(e){let i=new t,n=new ct;i._index.set("/",n);let r=[{pwd:"",tree:e,parent:n}];for(;r.length>0;){let o,{tree:a,pwd:l,parent:c}=r.pop();for(let u in a){if(!Object.hasOwn(a,u))continue;let h=a[u];if(h){let d=l+"/"+u;o=new ct,i._index.set(d,o),r.push({pwd:d,tree:h,parent:o})}else o=new Pn(new R({mode:z.FILE|365}));c&&c._listing.set(u,o)}}return i}files(){let e=[];for(let i of this._index.values())for(let n of i.listing){let r=i.get(n);r&&r.isFile()&&e.push(r)}return e}add(e,i){if(!i)throw new f(22,"Inode must be specified",e,"FileIndex.add");if(!e.startsWith("/"))throw new f(22,"Path not absolute",e,"FileIndex.add");if(this._index.has(e))return this._index.get(e)===i;let n=v(e),r=this._index.has(n),o=r?this._index.get(n):new ct;return!r&&e!="/"&&!this.add(n,o)||e!="/"&&!o.add(N(e),i)?!1:(i.isDirectory()&&this._index.set(e,i),!0)}addFast(e,i){let n=v(e),r=N(e),o=this._index.get(n);return o||(o=new ct,this.addFast(n,o)),o.add(r,i)?(i.isDirectory()&&this._index.set(e,i),!0):!1}remove(e){let i=v(e),n=this._index.get(i);if(!n)return;let r=n.remove(N(e));if(!r)return;if(!r.isDirectory())return r;let o=r.listing;for(let a of o)this.remove(B(e,a));e!="/"&&this._index.delete(e)}ls(e){return this._index.get(e)?.listing}get(e){let i=v(e),n=this._index.get(i);return i==e?n:n?.get(N(e))}},Wi=class{constructor(e){this.data=e}static{s(this,"IndexInode")}},Pn=class extends Wi{static{s(this,"IndexFileInode")}isFile(){return!0}isDirectory(){return!1}toStats(){return new R({mode:z.FILE|438,size:4096})}},ct=class extends Wi{constructor(){super(...arguments);this._listing=new Map}static{s(this,"IndexDirInode")}isFile(){return!1}isDirectory(){return!0}get stats(){return new R({mode:z.DIRECTORY|365,size:4096})}toStats(){return this.stats}get listing(){return[...this._listing.keys()]}get(i){return this._listing.get(i)}add(i,n){return this._listing.has(i)?!1:(this._listing.set(i,n),!0)}remove(i){let n=this._listing.get(i);if(n)return this._listing.delete(i),n}},Ui=class extends Mr(se){static{s(this,"IndexFS")}constructor(e){super(),this._index=At.FromListing(e)}async stat(e){let i=this._index.get(e);if(!i)throw f.With("ENOENT",e,"stat");if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInode(i,e);throw new f(22,"Invalid inode.")}statSync(e){let i=this._index.get(e);if(!i)throw f.With("ENOENT",e,"stat");if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInodeSync(i,e);throw new f(22,"Invalid inode.")}async openFile(e,i,n){if(pe(i))throw new f(1,e);let r=this._index.get(e);if(!r)throw f.With("ENOENT",e,"openFile");if(!r.toStats().hasAccess(It(i),n))throw f.With("EACCES",e,"openFile");if(r.isDirectory()){let o=r.stats;return new Ke(this,e,i,o,o.fileData)}return this.openFileInode(r,e,i)}openFileSync(e,i,n){if(pe(i))throw new f(1,e);let r=this._index.get(e);if(!r)throw f.With("ENOENT",e,"openFile");if(!r.toStats().hasAccess(It(i),n))throw f.With("EACCES",e,"openFile");if(r.isDirectory()){let o=r.stats;return new Ke(this,e,i,o,o.fileData)}return this.openFileInodeSync(r,e,i)}async readdir(e){let i=this._index.get(e);if(!i)throw f.With("ENOENT",e,"readdir");if(i.isDirectory())return i.listing;throw f.With("ENOTDIR",e,"readdir")}readdirSync(e){let i=this._index.get(e);if(!i)throw f.With("ENOENT",e,"readdir");if(i.isDirectory())return i.listing;throw f.With("ENOTDIR",e,"readdir")}},zr=class extends Ui{static{s(this,"SyncIndexFS")}async statFileInode(e,i){return this.statFileInodeSync(e,i)}async openFileInode(e,i,n){return this.openFileInodeSync(e,i,n)}},qi=class extends Ui{static{s(this,"AsyncIndexFS")}statFileInodeSync(e,i){throw f.With("ENOSYS",i,"AsyncIndexFS.statFileInodeSync")}openFileInodeSync(e,i,n){throw f.With("ENOSYS",i,"AsyncIndexFS.openFileInodeSync")}};function An(t){throw new f(5,t.message)}s(An,"convertError");async function Wd(t,e){let i=await fetch(t).catch(An);if(!i.ok)throw new f(5,"fetch failed: response returned code "+i.status);switch(e){case"buffer":let n=await i.arrayBuffer().catch(An);return new Uint8Array(n);case"json":return i.json().catch(An);default:throw new f(22,"Invalid download type: "+e)}}s(Wd,"fetchFile");async function Ud(t){let e=await fetch(t,{method:"HEAD"}).catch(An);if(!e.ok)throw new f(5,"fetch failed: HEAD response returned code "+e.status);return parseInt(e.headers.get("Content-Length")||"-1",10)}s(Ud,"fetchSize");var Tn=class t extends qi{static{s(this,"FetchFS")}async _initialize(e){if(typeof e!="string"){this._index=At.FromListing(e);return}try{let i=await fetch(e);this._index=At.FromListing(await i.json())}catch{throw new f(22,"Invalid or unavailable file listing tree")}}async ready(){await this._init}constructor({index:e="index.json",baseUrl:i=""}){super({}),i.at(-1)!="/"&&(i+="/"),this.prefixUrl=i,this._init=this._initialize(e)}metadata(){return{...super.metadata(),name:t.name,readonly:!0}}empty(){for(let e of this._index.files())delete e.data.fileData}preloadFile(e,i){let n=this._index.get(e);if(!n)throw f.With("ENOENT",e,"preloadFile");if(!n.isFile())throw f.With("EISDIR",e,"preloadFile");let r=n.data;r.size=i.length,r.fileData=i}async statFileInode(e,i){let n=e.data;return n.size<0&&(n.size=await this._fetchSize(i)),n}async openFileInode(e,i,n){let r=e.data;if(r.fileData)return new Ke(this,i,n,new R(r),r.fileData);let o=await this._fetchFile(i,"buffer");return r.size=o.length,r.fileData=o,new Ke(this,i,n,new R(r),o)}_getRemotePath(e){return e.charAt(0)==="/"&&(e=e.slice(1)),this.prefixUrl+e}_fetchFile(e,i){return Wd(this._getRemotePath(e),i)}_fetchSize(e){return Ud(this._getRemotePath(e))}},qd={name:"Fetch",options:{index:{type:["string","object"],required:!1,description:"URL to a file index as a JSON file or the file index object itself, generated with the make_http_index script. Defaults to `index.json`."},baseUrl:{type:"string",required:!1,description:"Used as the URL prefix for fetched files. Default: Fetch files relative to the index."}},isAvailable:s(function(){return typeof globalThis.fetch=="function"},"isAvailable"),create:s(function(t){return new Tn(t)},"create")};var ji=class{constructor(){this._locks=new Map}static{s(this,"Mutex")}lock(e){return new Promise(i=>{this._locks.has(e)?this._locks.get(e).push(i):this._locks.set(e,[i])})}unlock(e){if(!this._locks.has(e))throw new f(1,"Can not unlock an already unlocked path",e);let i=this._locks.get(e)?.shift();if(i){setTimeout(i,0);return}this._locks.delete(e)}tryLock(e){return this._locks.has(e)?!1:(this._locks.set(e,[]),!0)}isLocked(e){return this._locks.has(e)}};var $i=class{constructor(e){this.fs=e;this._mu=new ji}static{s(this,"LockedFS")}async ready(){await this.fs.ready()}metadata(){return{...this.fs.metadata(),name:"Locked<"+this.fs.metadata().name+">"}}async rename(e,i,n){await this._mu.lock(e),await this.fs.rename(e,i,n),this._mu.unlock(e)}renameSync(e,i,n){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"rename");return this.fs.renameSync(e,i,n)}async stat(e,i){await this._mu.lock(e);let n=await this.fs.stat(e,i);return this._mu.unlock(e),n}statSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"stat");return this.fs.statSync(e,i)}async openFile(e,i,n){await this._mu.lock(e);let r=await this.fs.openFile(e,i,n);return this._mu.unlock(e),r}openFileSync(e,i,n){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"openFile");return this.fs.openFileSync(e,i,n)}async createFile(e,i,n,r){await this._mu.lock(e);let o=await this.fs.createFile(e,i,n,r);return this._mu.unlock(e),o}createFileSync(e,i,n,r){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"createFile");return this.fs.createFileSync(e,i,n,r)}async unlink(e,i){await this._mu.lock(e),await this.fs.unlink(e,i),this._mu.unlock(e)}unlinkSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"unlink");return this.fs.unlinkSync(e,i)}async rmdir(e,i){await this._mu.lock(e),await this.fs.rmdir(e,i),this._mu.unlock(e)}rmdirSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"rmdir");return this.fs.rmdirSync(e,i)}async mkdir(e,i,n){await this._mu.lock(e),await this.fs.mkdir(e,i,n),this._mu.unlock(e)}mkdirSync(e,i,n){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"mkdir");return this.fs.mkdirSync(e,i,n)}async readdir(e,i){await this._mu.lock(e);let n=await this.fs.readdir(e,i);return this._mu.unlock(e),n}readdirSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"readdir");return this.fs.readdirSync(e,i)}async exists(e,i){await this._mu.lock(e);let n=await this.fs.exists(e,i);return this._mu.unlock(e),n}existsSync(e,i){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"exists");return this.fs.existsSync(e,i)}async link(e,i,n){await this._mu.lock(e),await this.fs.link(e,i,n),this._mu.unlock(e)}linkSync(e,i,n){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"link");return this.fs.linkSync(e,i,n)}async sync(e,i,n){await this._mu.lock(e),await this.fs.sync(e,i,n),this._mu.unlock(e)}syncSync(e,i,n){if(this._mu.isLocked(e))throw f.With("EBUSY",e,"sync");return this.fs.syncSync(e,i,n)}};var Hr="/.deleted",On=class extends se{constructor({writable:i,readable:n}){super();this._isInitialized=!1;this._deletedFiles=new Set;this._deleteLog="";this._deleteLogUpdatePending=!1;this._deleteLogUpdateNeeded=!1;if(this._writable=i,this._readable=n,this._writable.metadata().readonly)throw new f(22,"Writable file system must be writable.");this._ready=this._initialize()}static{s(this,"UnlockedOverlayFS")}async ready(){await this._readable.ready(),await this._writable.ready(),await this._ready}metadata(){return{...super.metadata(),name:Vi.name}}getOverlayedFileSystems(){return{readable:this._readable,writable:this._writable}}async sync(i,n,r){let o=r.cred(0,0);await this.createParentDirectories(i,o),await this._writable.sync(i,n,r)}syncSync(i,n,r){let o=r.cred(0,0);this.createParentDirectoriesSync(i,o),this._writable.syncSync(i,n,r)}async _initialize(){if(!this._isInitialized){try{let i=await this._writable.openFile(Hr,L("r"),Be),{size:n}=await i.stat(),{buffer:r}=await i.read(new Uint8Array(n));this._deleteLog=xn(r)}catch(i){if(i.errno!==2)throw i}this._isInitialized=!0,this._reparseDeletionLog()}}getDeletionLog(){return this._deleteLog}restoreDeletionLog(i,n){this._deleteLog=i,this._reparseDeletionLog(),this.updateLog("",n)}async rename(i,n,r){this.checkInitialized(),this.checkPath(i),this.checkPath(n);try{await this._writable.rename(i,n,r)}catch{if(this._deletedFiles.has(i))throw f.With("ENOENT",i,"rename")}}renameSync(i,n,r){this.checkInitialized(),this.checkPath(i),this.checkPath(n);try{this._writable.renameSync(i,n,r)}catch{if(this._deletedFiles.has(i))throw f.With("ENOENT",i,"rename")}}async stat(i,n){this.checkInitialized();try{return this._writable.stat(i,n)}catch{if(this._deletedFiles.has(i))throw f.With("ENOENT",i,"stat");let o=new R(await this._readable.stat(i,n));return o.mode|=146,o}}statSync(i,n){this.checkInitialized();try{return this._writable.statSync(i,n)}catch{if(this._deletedFiles.has(i))throw f.With("ENOENT",i,"stat");let o=new R(this._readable.statSync(i,n));return o.mode|=146,o}}async openFile(i,n,r){if(await this._writable.exists(i,r))return this._writable.openFile(i,n,r);let o=await this._readable.openFile(i,L("r"),r),a=new R(await o.stat()),{buffer:l}=await o.read(new Uint8Array(a.size));return new ce(this,i,n,a,l)}openFileSync(i,n,r){if(this._writable.existsSync(i,r))return this._writable.openFileSync(i,n,r);let o=this._readable.openFileSync(i,L("r"),r),a=R.clone(o.statSync()),l=new Uint8Array(a.size);return o.readSync(l),new ce(this,i,n,a,l)}async createFile(i,n,r,o){return this.checkInitialized(),await this._writable.createFile(i,n,r,o),this.openFile(i,n,o)}createFileSync(i,n,r,o){return this.checkInitialized(),this._writable.createFileSync(i,n,r,o),this.openFileSync(i,n,o)}async link(i,n,r){this.checkInitialized(),await this._writable.link(i,n,r)}linkSync(i,n,r){this.checkInitialized(),this._writable.linkSync(i,n,r)}async unlink(i,n){if(this.checkInitialized(),this.checkPath(i),!await this.exists(i,n))throw f.With("ENOENT",i,"unlink");await this._writable.exists(i,n)&&await this._writable.unlink(i,n),await this.exists(i,n)&&this.deletePath(i,n)}unlinkSync(i,n){if(this.checkInitialized(),this.checkPath(i),!this.existsSync(i,n))throw f.With("ENOENT",i,"unlink");this._writable.existsSync(i,n)&&this._writable.unlinkSync(i,n),this.existsSync(i,n)&&this.deletePath(i,n)}async rmdir(i,n){if(this.checkInitialized(),!await this.exists(i,n))throw f.With("ENOENT",i,"rmdir");if(await this._writable.exists(i,n)&&await this._writable.rmdir(i,n),await this.exists(i,n)){if((await this.readdir(i,n)).length>0)throw f.With("ENOTEMPTY",i,"rmdir");this.deletePath(i,n)}}rmdirSync(i,n){if(this.checkInitialized(),!this.existsSync(i,n))throw f.With("ENOENT",i,"rmdir");if(this._writable.existsSync(i,n)&&this._writable.rmdirSync(i,n),this.existsSync(i,n)){if(this.readdirSync(i,n).length>0)throw f.With("ENOTEMPTY",i,"rmdir");this.deletePath(i,n)}}async mkdir(i,n,r){if(this.checkInitialized(),await this.exists(i,r))throw f.With("EEXIST",i,"mkdir");await this.createParentDirectories(i,r),await this._writable.mkdir(i,n,r)}mkdirSync(i,n,r){if(this.checkInitialized(),this.existsSync(i,r))throw f.With("EEXIST",i,"mkdir");this.createParentDirectoriesSync(i,r),this._writable.mkdirSync(i,n,r)}async readdir(i,n){if(this.checkInitialized(),!(await this.stat(i,n)).isDirectory())throw f.With("ENOTDIR",i,"readdir");let o=[];try{o.push(...await this._writable.readdir(i,n))}catch{}try{o.push(...(await this._readable.readdir(i,n)).filter(l=>!this._deletedFiles.has(`${i}/${l}`)))}catch{}let a={};return o.filter(l=>{let c=!a[l];return a[l]=!0,c})}readdirSync(i,n){if(this.checkInitialized(),!this.statSync(i,n).isDirectory())throw f.With("ENOTDIR",i,"readdir");let o=[];try{o=o.concat(this._writable.readdirSync(i,n))}catch{}try{o=o.concat(this._readable.readdirSync(i,n).filter(l=>!this._deletedFiles.has(`${i}/${l}`)))}catch{}let a={};return o.filter(l=>{let c=!a[l];return a[l]=!0,c})}deletePath(i,n){this._deletedFiles.add(i),this.updateLog(`d${i}
3
+ `,n)}async updateLog(i,n){if(this._deleteLog+=i,this._deleteLogUpdatePending){this._deleteLogUpdateNeeded=!0;return}this._deleteLogUpdatePending=!0;let r=await this._writable.openFile(Hr,L("w"),n);try{await r.write(Xe(this._deleteLog)),this._deleteLogUpdateNeeded&&(this._deleteLogUpdateNeeded=!1,this.updateLog("",n))}catch(o){this._deleteLogError=o}finally{this._deleteLogUpdatePending=!1}}_reparseDeletionLog(){this._deletedFiles.clear();for(let i of this._deleteLog.split(`
4
+ `))i.startsWith("d")&&this._deletedFiles.add(i.slice(1))}checkInitialized(){if(!this._isInitialized)throw new f(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(!this._deleteLogError)return;let i=this._deleteLogError;throw delete this._deleteLogError,i}checkPath(i){if(i==Hr)throw f.With("EPERM",i,"checkPath")}createParentDirectoriesSync(i,n){let r=v(i),o=[];for(;!this._writable.existsSync(r,n);)o.push(r),r=v(r);o=o.reverse();for(let a of o)this._writable.mkdirSync(a,this.statSync(a,n).mode,n)}async createParentDirectories(i,n){let r=v(i),o=[];for(;!await this._writable.exists(r,n);)o.push(r),r=v(r);o=o.reverse();for(let a of o){let l=await this.stat(a,n);await this._writable.mkdir(a,l.mode,n)}}operateOnWritable(i,n){if(!this.existsSync(i,n))throw f.With("ENOENT",i,"operateOnWriteable");this._writable.existsSync(i,n)||this.copyToWritableSync(i,n)}async operateOnWritableAsync(i,n){if(!await this.exists(i,n))throw f.With("ENOENT",i,"operateOnWritable");if(!await this._writable.exists(i,n))return this.copyToWritable(i,n)}copyToWritableSync(i,n){let r=this.statSync(i,n);if(r.isDirectory()){this._writable.mkdirSync(i,r.mode,n);return}let o=new Uint8Array(r.size),a=this._readable.openFileSync(i,L("r"),n);a.readSync(o),a.closeSync();let l=this._writable.openFileSync(i,L("w"),n);l.writeSync(o),l.closeSync()}async copyToWritable(i,n){let r=await this.stat(i,n);if(r.isDirectory()){await this._writable.mkdir(i,r.mode,n);return}let o=new Uint8Array(r.size),a=await this._readable.openFile(i,L("r"),n);await a.read(o),await a.close();let l=await this._writable.openFile(i,L("w"),n);await l.write(o),await l.close()}},Vi=class extends $i{static{s(this,"OverlayFS")}constructor(e){super(new On(e))}getOverlayedFileSystems(){return super.fs.getOverlayedFileSystems()}getDeletionLog(){return super.fs.getDeletionLog()}resDeletionLog(){return super.fs.getDeletionLog()}unwrap(){return super.fs}},jd={name:"Overlay",options:{writable:{type:"object",required:!0,description:"The file system to write modified files to."},readable:{type:"object",required:!0,description:"The file system that initially populates this file system."}},isAvailable:s(function(){return!0},"isAvailable"),create:s(function(t){return new Vi(t)},"create")};function zi(t){return t!=null&&typeof t=="object"&&"isAvailable"in t&&typeof t.isAvailable=="function"&&"create"in t&&typeof t.create=="function"}s(zi,"isBackend");async function Yr(t,e){if(typeof e!="object"||e===null)throw new f(22,"Invalid options");for(let[i,n]of Object.entries(t.options)){let r=e?.[i];if(r==null){if(!n.required)continue;let a=Object.keys(e).filter(l=>!(l in t.options)).map(l=>({str:l,distance:Wr(i,l)})).filter(l=>l.distance<5).sort((l,c)=>l.distance-c.distance);throw new f(22,`${t.name}: Required option '${i}' not provided.${a.length>0?` You provided '${a[0].str}', did you mean '${i}'.`:""}`)}if(!(Array.isArray(n.type)?n.type.indexOf(typeof r)!=-1:typeof r==n.type))throw new f(22,`${t.name}: Value provided for option ${i} is not the proper type. Expected ${Array.isArray(n.type)?`one of {${n.type.join(", ")}}`:n.type}, but received ${typeof r}`);n.validator&&await n.validator(r)}}s(Yr,"checkOptions");function Gr(t){return t!=null&&typeof t=="object"&&"backend"in t&&zi(t.backend)}s(Gr,"isBackendConfig");var bn={};gn(bn,{BigIntStats:()=>ie,Dir:()=>ht,Dirent:()=>dt,ReadStream:()=>gt,Stats:()=>R,StatsFs:()=>Ai,WriteStream:()=>wt,access:()=>Nu,accessSync:()=>Ua,appendFile:()=>uu,appendFileSync:()=>Ia,chmod:()=>Tu,chmodSync:()=>Ba,chown:()=>Pu,chownSync:()=>Na,close:()=>hu,closeSync:()=>Qe,constants:()=>Ft,copyFile:()=>$u,copyFileSync:()=>uo,cp:()=>Yu,cpSync:()=>ho,createReadStream:()=>Wu,createWriteStream:()=>Uu,exists:()=>nu,existsSync:()=>ni,fchmod:()=>Su,fchmodSync:()=>Wn,fchown:()=>wu,fchownSync:()=>Mn,fdatasync:()=>mu,fdatasyncSync:()=>Ta,fstat:()=>du,fstatSync:()=>Pa,fsync:()=>yu,fsyncSync:()=>Aa,ftruncate:()=>pu,ftruncateSync:()=>so,futimes:()=>_u,futimesSync:()=>Un,lchmod:()=>Ou,lchmodSync:()=>Ma,lchown:()=>Au,lchownSync:()=>Da,link:()=>Fu,linkSync:()=>Ra,lopenSync:()=>Ji,lstat:()=>ou,lstatSync:()=>oo,lutimes:()=>Ru,lutimesSync:()=>Wa,mkdir:()=>xu,mkdirSync:()=>qn,mkdtemp:()=>ju,mkdtempSync:()=>qa,mount:()=>Gi,mountObject:()=>Ki,mounts:()=>we,open:()=>lu,openAsBlob:()=>Ku,openSync:()=>oi,opendir:()=>Hu,opendirSync:()=>Va,promises:()=>mn,read:()=>gu,readFile:()=>cu,readFileSync:()=>Bn,readSync:()=>Ca,readdir:()=>ku,readdirSync:()=>si,readlink:()=>Iu,readlinkSync:()=>lo,readv:()=>Vu,readvSync:()=>ja,realpath:()=>Lu,realpathSync:()=>ii,rename:()=>iu,renameSync:()=>ka,rm:()=>qu,rmSync:()=>fo,rmdir:()=>Eu,rmdirSync:()=>ao,stat:()=>ru,statSync:()=>Xi,statfs:()=>Gu,statfsSync:()=>za,symlink:()=>vu,symlinkSync:()=>La,truncate:()=>su,truncateSync:()=>Fa,umount:()=>Nn,unlink:()=>au,unlinkSync:()=>Dn,unwatchFile:()=>Bu,utimes:()=>Cu,utimesSync:()=>co,watch:()=>Mu,watchFile:()=>Du,write:()=>bu,writeFile:()=>fu,writeFileSync:()=>Qi,writeSync:()=>Oa,writev:()=>zu,writevSync:()=>$a});var mn={};gn(mn,{FileHandle:()=>te,access:()=>Ms,appendFile:()=>Ts,chmod:()=>Ns,chown:()=>Rs,constants:()=>Ft,copyFile:()=>Pr,cp:()=>Ar,exists:()=>ve,lchmod:()=>Ds,lchown:()=>Ls,link:()=>Os,lstat:()=>xr,lutimes:()=>Bs,mkdir:()=>yn,mkdtemp:()=>Ws,open:()=>ue,opendir:()=>Us,readFile:()=>pn,readdir:()=>Rt,readlink:()=>Fr,realpath:()=>Fe,rename:()=>Ps,rm:()=>Ir,rmdir:()=>kr,stat:()=>Ei,statfs:()=>qs,symlink:()=>Cs,truncate:()=>As,unlink:()=>hn,utimes:()=>vr,watch:()=>Gg,writeFile:()=>ki});var Ht=Or(Ee(),1);var ut=Or(Ee(),1);var k=Be;function xa(t){k=t}s(xa,"setCred");var Ct=new Map,_h=100;function Yi(t){let e=_h++;return Ct.set(e,t),e}s(Yi,"file2fd");function M(t){if(!Ct.has(t))throw new f(9);return Ct.get(t)}s(M,"fd2file");var we=new Map;Gi("/",Bi.create({name:"root"}));function Gi(t,e){if(t[0]!=="/"&&(t="/"+t),t=lt(t),we.has(t))throw new f(22,"Mount point "+t+" is already in use.");we.set(t,e)}s(Gi,"mount");function Nn(t){if(t[0]!=="/"&&(t=`/${t}`),t=lt(t),!we.has(t))throw new f(22,"Mount point "+t+" is already unmounted.");we.delete(t)}s(Nn,"umount");function H(t){t=x(t);let e=[...we].sort((i,n)=>i[0].length>n[0].length?-1:1);for(let[i,n]of e)if(i.length<=t.length&&t.startsWith(i))return t=t.slice(i.length>1?i.length:0),t===""&&(t="/"),{fs:n,path:t,mountPoint:i};throw new f(5,"ZenFS not initialized with a file system")}s(H,"resolveMount");function Ea(t,e){for(let[i,n]of Object.entries(e))t=t?.replaceAll(i,n);return t}s(Ea,"fixPaths");function le(t,e){return typeof t.stack=="string"&&(t.stack=Ea(t.stack,e)),t.message=Ea(t.message,e),t}s(le,"fixError");function Ki(t){"/"in t&&Nn("/");for(let[e,i]of Object.entries(t))Gi(e,i)}s(Ki,"mountObject");function fe(...[t,e,i,...n]){i=x(i);let{fs:r,path:o}=H(e&&ni(i)?ii(i):i);try{return r[t](o,...n)}catch(a){throw le(a,{[o]:i})}}s(fe,"doOp");function ka(t,e){t=x(t),e=x(e);let i=H(t),n=H(e),r={[i.path]:t,[n.path]:e};try{if(i===n)return i.fs.renameSync(i.path,n.path,k);Qi(e,Bn(t)),Dn(t)}catch(o){throw le(o,r)}}s(ka,"renameSync");function ni(t){t=x(t);try{let{fs:e,path:i}=H(ii(t));return e.existsSync(i,k)}catch(e){if(e.errno==2)return!1;throw e}}s(ni,"existsSync");function Xi(t,e){let i=fe("statSync",!0,t.toString(),k);return e?.bigint?new ie(i):i}s(Xi,"statSync");function oo(t,e){let i=fe("statSync",!1,t.toString(),k);return e?.bigint?new ie(i):i}s(oo,"lstatSync");function Fa(t,e=0){let i=oi(t,"r+");try{so(i,e)}finally{Qe(i)}}s(Fa,"truncateSync");function Dn(t){return fe("unlinkSync",!1,t.toString(),k)}s(Dn,"unlinkSync");function ri(t,e,i,n=!0){let r=x(t),o=me(i,420),a=L(e),l;try{l=fe("statSync",n,r,k)}catch{switch(Ri(a)){case 3:if(!fe("statSync",n,v(r),k).isDirectory())throw f.With("ENOTDIR",v(r),"_open");return fe("createFileSync",n,r,a,o,k);case 1:throw f.With("ENOENT",r,"_open");default:throw new f(22,"Invalid FileFlag object.")}}if(!l.hasAccess(o,k))throw f.With("EACCES",r,"_open");switch(Ci(a)){case 1:throw f.With("EEXIST",r,"_open");case 2:return fe("unlinkSync",n,r,k),fe("createFileSync",n,r,a,l.mode,k);case 0:return fe("openFileSync",n,r,a,k);default:throw new f(22,"Invalid FileFlag object.")}}s(ri,"_openSync");function oi(t,e,i=0){return Yi(ri(t,e,i,!0))}s(oi,"openSync");function Ji(t,e,i){return Yi(ri(t,e,i,!1))}s(Ji,"lopenSync");function va(t,e,i){let n=ri(t,e,420,i);try{let r=n.statSync(),o=new Uint8Array(r.size);return n.readSync(o,0,r.size,0),n.closeSync(),o}finally{n.closeSync()}}s(va,"_readFileSync");function Bn(t,e={}){let i=be(e,null,"r",420),n=L(i.flag);if(!st(n))throw new f(22,"Flag passed to readFile must allow for reading.");let r=ut.Buffer.from(va(typeof t=="number"?M(t).path:t.toString(),i.flag,!0));return i.encoding?r.toString(i.encoding):r}s(Bn,"readFileSync");function Eh(t,e,i,n,r){let o=ri(t,i,n,r);try{o.writeSync(e,0,e.byteLength,0)}finally{o.closeSync()}}s(Eh,"_writeFileSync");function Qi(t,e,i={}){let n=be(i,"utf8","w+",420),r=L(n.flag);if(!pe(r))throw new f(22,"Flag passed to writeFile must allow for writing.");if(typeof e!="string"&&!n.encoding)throw new f(22,"Encoding not specified");let o=typeof e=="string"?ut.Buffer.from(e,n.encoding):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(!o)throw new f(22,"Data not specified");Eh(typeof t=="number"?M(t).path:t.toString(),o,n.flag,n.mode,!0)}s(Qi,"writeFileSync");function xh(t,e,i,n,r){let o=ri(t,i,n,r);try{o.writeSync(e,0,e.byteLength,null)}finally{o.closeSync()}}s(xh,"_appendFileSync");function Ia(t,e,i={}){let n=be(i,"utf8","a",420),r=L(n.flag);if(!at(r))throw new f(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!n.encoding)throw new f(22,"Encoding not specified");let o=typeof e=="string"?ut.Buffer.from(e,n.encoding):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);xh(typeof t=="number"?M(t).path:t.toString(),o,n.flag,n.mode,!0)}s(Ia,"appendFileSync");function Pa(t,e){let i=M(t).statSync();return e?.bigint?new ie(i):i}s(Pa,"fstatSync");function Qe(t){M(t).closeSync(),Ct.delete(t)}s(Qe,"closeSync");function so(t,e=0){if(e||=0,e<0)throw new f(22);M(t).truncateSync(e)}s(so,"ftruncateSync");function Aa(t){M(t).syncSync()}s(Aa,"fsyncSync");function Ta(t){M(t).datasyncSync()}s(Ta,"fdatasyncSync");function Oa(t,e,i,n,r){let o,a,l,c;if(typeof e=="string"){c=typeof i=="number"?i:null;let h=typeof n=="string"?n:"utf8";a=0,o=ut.Buffer.from(e,h),l=o.byteLength}else o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=i,l=n,c=typeof r=="number"?r:null;let u=M(t);return c??=u.position,u.writeSync(o,a,l,c)}s(Oa,"writeSync");function Ca(t,e,i,n,r){let o=M(t),a=typeof i=="object"?i.offset:i;return typeof i=="object"&&(n=i.length,r=i.position),r=Number(r),isNaN(r)&&(r=o.position),o.readSync(e,a,n,r)}s(Ca,"readSync");function Mn(t,e,i){M(t).chownSync(e,i)}s(Mn,"fchownSync");function Wn(t,e){let i=me(e,-1);if(i<0)throw new f(22,"Invalid mode.");M(t).chmodSync(i)}s(Wn,"fchmodSync");function Un(t,e,i){M(t).utimesSync(Pt(e),Pt(i))}s(Un,"futimesSync");function ao(t){return fe("rmdirSync",!0,t.toString(),k)}s(ao,"rmdirSync");function qn(t,e){let i=typeof e=="number"||typeof e=="string"?e:e?.mode,n=typeof e=="object"&&e?.recursive;fe("mkdirSync",!0,t.toString(),me(i,511),k)}s(qn,"mkdirSync");function si(t,e){t=x(t);let i=fe("readdirSync",!0,t,k);for(let n of we.keys()){if(!n.startsWith(t))continue;let r=n.slice(t.length);r.includes("/")||r.length==0||i.push(r)}return i.map(n=>typeof e=="object"&&e?.withFileTypes?new dt(n,Xi(B(t.toString(),n))):e=="buffer"||typeof e=="object"&&e?.encoding=="buffer"?ut.Buffer.from(n):n)}s(si,"readdirSync");function Ra(t,e){return e=x(e),fe("linkSync",!1,t.toString(),e.toString(),k)}s(Ra,"linkSync");function La(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new f(22,"Invalid type: "+i);if(ni(e))throw f.With("EEXIST",e.toString(),"symlink");Qi(e,t.toString()),ri(e,"r+",420,!1)._setTypeSync(z.SYMLINK)}s(La,"symlinkSync");function lo(t,e){let i=ut.Buffer.from(va(t.toString(),"r",!1)),n=typeof e=="object"?e?.encoding:e;return n=="buffer"?i:i.toString(n)}s(lo,"readlinkSync");function Na(t,e,i){let n=oi(t,"r+");Mn(n,e,i),Qe(n)}s(Na,"chownSync");function Da(t,e,i){let n=Ji(t,"r+");Mn(n,e,i),Qe(n)}s(Da,"lchownSync");function Ba(t,e){let i=oi(t,"r+");Wn(i,e),Qe(i)}s(Ba,"chmodSync");function Ma(t,e){let i=Ji(t,"r+");Wn(i,e),Qe(i)}s(Ma,"lchmodSync");function co(t,e,i){let n=oi(t,"r+");Un(n,e,i),Qe(n)}s(co,"utimesSync");function Wa(t,e,i){let n=Ji(t,"r+");Un(n,e,i),Qe(n)}s(Wa,"lutimesSync");function ii(t,e){t=x(t);let{base:i,dir:n}=_n(t),r=B(n=="/"?"/":ii(n),i),{fs:o,path:a,mountPoint:l}=H(r);try{return o.statSync(a,k).isSymbolicLink()?ii(l+lo(r)):r}catch(c){throw le(c,{[a]:r})}}s(ii,"realpathSync");function Ua(t,e=384){if(!Xi(t).hasAccess(e,k))throw new f(13)}s(Ua,"accessSync");function fo(t,e){switch(t=x(t),Xi(t).mode&61440){case 16384:if(e?.recursive)for(let n of si(t))fo(B(t,n));ao(t);return;case 32768:case 40960:Dn(t);return;case 24576:case 8192:case 4096:case 49152:default:throw new f(1,"File type not supported",t,"rm")}}s(fo,"rmSync");function qa(t,e){let i=typeof e=="object"?e?.encoding:e||"utf8",r="/tmp/"+`${t}${Date.now()}-${Math.random().toString(36).slice(2)}`;return qn(r),i=="buffer"?ut.Buffer.from(r):r}s(qa,"mkdtempSync");function uo(t,e,i){if(t=x(t),e=x(e),i&&i&1&&ni(e))throw new f(17,"Destination file already exists.",e,"copyFile");Qi(e,Bn(t))}s(uo,"copyFileSync");function ja(t,e,i){let n=M(t),r=0;for(let o of e)r+=n.readSync(o,0,o.byteLength,i+r);return r}s(ja,"readvSync");function $a(t,e,i){let n=M(t),r=0;for(let o of e)r+=n.writeSync(new Uint8Array(o.buffer),0,o.byteLength,i+r);return r}s($a,"writevSync");function Va(t,e){return t=x(t),new ht(t)}s(Va,"opendirSync");function ho(t,e,i){t=x(t),e=x(e);let n=oo(t);if(i?.errorOnExist&&ni(e))throw new f(17,"Destination file or directory already exists.",e,"cp");switch(n.mode&61440){case 16384:if(!i?.recursive)throw new f(21,t+" is a directory (not copied)",t,"cp");qn(e,{recursive:!0});for(let r of si(t,{withFileTypes:!0}))i.filter&&!i.filter(B(t,r.name),B(e,r.name))||ho(B(t,r.name),B(e,r.name),i);break;case 32768:case 40960:uo(t,e);break;case 24576:case 8192:case 4096:case 49152:default:throw new f(1,"File type not supported",t,"rm")}i?.preserveTimestamps&&co(e,n.atime,n.mtime)}s(ho,"cpSync");function za(t,e){throw f.With("ENOSYS",t.toString(),"statfs")}s(za,"statfsSync");var dt=class{constructor(e,i){this.path=e;this.stats=i}static{s(this,"Dirent")}get name(){return N(this.path)}isFile(){return this.stats.isFile()}isDirectory(){return this.stats.isDirectory()}isBlockDevice(){return this.stats.isBlockDevice()}isCharacterDevice(){return this.stats.isCharacterDevice()}isSymbolicLink(){return this.stats.isSymbolicLink()}isFIFO(){return this.stats.isFIFO()}isSocket(){return this.stats.isSocket()}},ht=class{constructor(e){this.path=e;this.closed=!1;this._entries=[]}static{s(this,"Dir")}checkClosed(){if(this.closed)throw new f(9,"Can not use closed Dir")}close(e){if(this.closed=!0,!e)return Promise.resolve();e()}closeSync(){this.closed=!0}async _read(){return this._entries||(this._entries=await Rt(this.path,{withFileTypes:!0})),this._entries.length&&this._entries.shift()||null}read(e){if(!e)return this._read();this._read().then(i=>e(void 0,i))}readSync(){return this._entries||(this._entries=si(this.path,{withFileTypes:!0})),this._entries.length&&this._entries.shift()||null}[Symbol.asyncIterator](){let e=this;return{[Symbol.asyncIterator]:this[Symbol.asyncIterator],next:s(async function(){let i=await e._read();return i!=null?{done:!1,value:i}:(await e.close(),{done:!0,value:void 0})},"next")}}};var Er=Or(tu(),1);var gt=class extends Er.Readable{static{s(this,"ReadStream")}close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(new f(5,i.toString()))}}},wt=class extends Er.Writable{static{s(this,"WriteStream")}close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(new f(5,i.toString()))}}};var te=class{static{s(this,"FileHandle")}constructor(e){let i=typeof e!="number";this.fd=i?Yi(e):e,this.file=i?e:M(e)}chown(e,i){return this.file.chown(e,i)}chmod(e){let i=me(e,-1);if(i<0)throw new f(22,"Invalid mode.");return this.file.chmod(i)}datasync(){return this.file.datasync()}sync(){return this.file.sync()}truncate(e){if(e||=0,e<0)throw new f(22);return this.file.truncate(e)}utimes(e,i){return this.file.utimes(Pt(e),Pt(i))}async appendFile(e,i={}){let n=be(i,"utf8","a",420),r=L(n.flag);if(!at(r))throw new f(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!n.encoding)throw new f(22,"Encoding not specified");let o=typeof e=="string"?Ht.Buffer.from(e,n.encoding):e;await this.file.write(o,0,o.length,null)}read(e,i,n,r){return isNaN(+r)&&(r=this.file.position),this.file.read(e,i,n,r)}async readFile(e){let i=be(e,null,"r",292),n=L(i.flag);if(!st(n))throw new f(22,"Flag passed must allow for reading.");let{size:r}=await this.stat(),o=new Uint8Array(r);await this.file.read(o,0,r,0);let a=Ht.Buffer.from(o);return i.encoding?a.toString(i.encoding):a}readableWebStream(e={}){let i=s(async({close:n,enqueue:r,error:o})=>{try{let c=0,u=0,h=NaN;for(;h>0;){let d=await this.read(new Uint8Array(65536),0,65536,u);if(!d.bytesRead){n();return}if(r(d.buffer.slice(0,d.bytesRead)),u+=d.bytesRead,++c>=1e7)throw new f(27,"Too many iterations on readable stream",this.file.path,"FileHandle.readableWebStream");h=d.bytesRead}}catch(a){o(a)}},"start");return new globalThis.ReadableStream({start:i,type:e.type})}readLines(e){throw f.With("ENOSYS",this.file.path,"FileHandle.readLines")}[Symbol.asyncDispose](){return this.close()}async stat(e){let i=await this.file.stat();return e?.bigint?new ie(i):i}async write(e,i,n,r){let o,a,l;if(typeof e=="string"){r=typeof i=="number"?i:null;let u=typeof n=="string"?n:"utf8";a=0,o=Ht.Buffer.from(e,u),l=o.length}else o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=i,l=n,r=typeof r=="number"?r:null;r??=this.file.position;let c=await this.file.write(o,a,l,r);return{buffer:o,bytesWritten:c}}async writeFile(e,i={}){let n=be(i,"utf8","w",420),r=L(n.flag);if(!pe(r))throw new f(22,"Flag passed must allow for writing.");if(typeof e!="string"&&!n.encoding)throw new f(22,"Encoding not specified");let o=typeof e=="string"?Ht.Buffer.from(e,n.encoding):e;await this.file.write(o,0,o.length,0)}async close(){await this.file.close(),Ct.delete(this.fd)}async writev(e,i){let n=0;for(let r of e)n+=(await this.write(r,0,r.length,i+n)).bytesWritten;return{bytesWritten:n,buffers:e}}async readv(e,i){let n=0;for(let r of e)n+=(await this.read(r,0,r.byteLength,i+n)).bytesRead;return{bytesRead:n,buffers:e}}createReadStream(e){let i=new gt({highWaterMark:e?.highWaterMark||65536,encoding:e.encoding,read:s(async n=>{try{let r=await this.read(new Uint8Array(n),0,n,this.file.position);i.push(r.bytesRead?r.buffer.slice(0,r.bytesRead):null),this.file.position+=r.bytesRead}catch(r){i.destroy(r)}},"read")});return i.path=this.file.path,i}createWriteStream(e){let i={highWaterMark:e?.highWaterMark,encoding:e?.encoding,write:s(async(r,o,a)=>{try{let{bytesWritten:l}=await this.write(r,null,o);a(l==r.length?null:new Error("Failed to write full chunk"))}catch(l){a(l)}},"write")},n=new wt(i);return n.path=this.file.path,n}};async function Ps(t,e){t=x(t),e=x(e);let i=H(t),n=H(e);try{if(i.mountPoint==n.mountPoint){await i.fs.rename(i.path,n.path,k);return}await ki(e,await pn(t)),await hn(t)}catch(r){throw le(r,{[i.path]:t,[n.path]:e})}}s(Ps,"rename");async function ve(t){try{let{fs:e,path:i}=H(await Fe(t));return await e.exists(i,k)}catch(e){if(e instanceof f&&e.code=="ENOENT")return!1;throw e}}s(ve,"exists");async function Ei(t,e){t=x(t);let{fs:i,path:n}=H(await ve(t)?await Fe(t):t);try{let r=await i.stat(n,k);return e?.bigint?new ie(r):r}catch(r){throw le(r,{[n]:t})}}s(Ei,"stat");async function xr(t,e){t=x(t);let{fs:i,path:n}=H(t);try{let r=await i.stat(n,k);return e?.bigint?new ie(r):r}catch(r){throw le(r,{[n]:t})}}s(xr,"lstat");async function As(t,e=0){let i=await ue(t,"r+");try{await i.truncate(e)}finally{await i.close()}}s(As,"truncate");async function hn(t){t=x(t);let{fs:e,path:i}=H(t);try{await e.unlink(i,k)}catch(n){throw le(n,{[i]:t})}}s(hn,"unlink");async function xi(t,e,i=420,n){t=x(t);let r=me(i,420),o=L(e);t=n&&await ve(t)?await Fe(t):t;let{fs:a,path:l}=H(t);try{switch(Ci(o)){case 1:throw f.With("EEXIST",t,"_open");case 2:let c=await a.openFile(l,o,k);return await c.truncate(0),await c.sync(),new te(c);case 0:return new te(await a.openFile(l,o,k));default:throw new f(22,"Invalid file flag")}}catch{switch(Ri(o)){case 3:let u=await a.stat(v(l),k);if(u&&!u.isDirectory())throw f.With("ENOTDIR",v(t),"_open");return new te(await a.createFile(l,o,r,k));case 1:throw f.With("ENOENT",t,"_open");default:throw new f(22,"Invalid file flag")}}}s(xi,"_open");async function ue(t,e="r",i=420){return await xi(t,e,i,!0)}s(ue,"open");async function pn(t,e){let i=be(e,null,"r",420),n=typeof t=="object"&&"fd"in t?t:await ue(t,i.flag,i.mode);try{return await n.readFile(i)}finally{await n.close()}}s(pn,"readFile");async function ki(t,e,i){let n=be(i,"utf8","w+",420),r=t instanceof te?t:await ue(t.toString(),n.flag,n.mode);try{let o=e;if(typeof o!="string"&&!(o instanceof Uint8Array))throw new f(22,"Iterables and streams not supported",r.file.path,"writeFile");await r.writeFile(o,n)}finally{await r.close()}}s(ki,"writeFile");async function Ts(t,e,i){let n=be(i,"utf8","a",420),r=L(n.flag);if(!at(r))throw new f(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!n.encoding)throw new f(22,"Encoding not specified");let o=typeof e=="string"?Ht.Buffer.from(e,n.encoding):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=typeof t=="object"&&"fd"in t?t:await ue(t,n.flag,n.mode);try{await a.appendFile(o,n)}finally{await a.close()}}s(Ts,"appendFile");async function kr(t){t=x(t),t=await ve(t)?await Fe(t):t;let{fs:e,path:i}=H(t);try{await e.rmdir(i,k)}catch(n){throw le(n,{[i]:t})}}s(kr,"rmdir");async function yn(t,e){t=x(t),t=await ve(t)?await Fe(t):t;let{fs:i,path:n}=H(t);try{await i.mkdir(n,me(typeof e=="object"?e?.mode:e,511),k)}catch(r){throw le(r,{[n]:t})}}s(yn,"mkdir");async function Rt(t,e){t=x(t),t=await ve(t)?await Fe(t):t;let{fs:i,path:n}=H(t),r;try{r=await i.readdir(n,k)}catch(a){throw le(a,{[n]:t})}for(let a of we.keys())if(a.startsWith(t)){let l=a.slice(t.length);if(l.includes("/")||l.length==0)continue;r.push(l)}let o=[];for(let a of r)o.push(typeof e=="object"&&e?.withFileTypes?new dt(a,await Ei(B(t,a))):a);return o}s(Rt,"readdir");async function Os(t,e){t=x(t),e=x(e);let{fs:i,path:n}=H(e);try{return await i.link(t,e,k)}catch(r){throw le(r,{[n]:e})}}s(Os,"link");async function Cs(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new f(22,"Invalid symlink type: "+i);if(await ve(e))throw f.With("EEXIST",e.toString(),"symlink");await ki(e,t.toString()),await(await xi(e,"r+",420,!1)).file._setType(z.SYMLINK)}s(Cs,"symlink");async function Fr(t,e){let i=await xi(x(t),"r",420,!1);try{let n=await i.readFile(),r=typeof e=="object"?e?.encoding:e;return r=="buffer"?n:n.toString(r)}finally{await i.close()}}s(Fr,"readlink");async function Rs(t,e,i){let n=await ue(t,"r+");try{await n.chown(e,i)}finally{await n.close()}}s(Rs,"chown");async function Ls(t,e,i){let n=await xi(t,"r+",420,!1);try{await n.chown(e,i)}finally{await n.close()}}s(Ls,"lchown");async function Ns(t,e){let i=await ue(t,"r+");try{await i.chmod(e)}finally{await i.close()}}s(Ns,"chmod");async function Ds(t,e){let i=await xi(t,"r+",420,!1);try{await i.chmod(e)}finally{await i.close()}}s(Ds,"lchmod");async function vr(t,e,i){let n=await ue(t,"r+");try{await n.utimes(e,i)}finally{await n.close()}}s(vr,"utimes");async function Bs(t,e,i){let n=await xi(t,"r+",420,!1);try{await n.utimes(new Date(e),new Date(i))}finally{await n.close()}}s(Bs,"lutimes");async function Fe(t,e){t=x(t);let{base:i,dir:n}=_n(t),r=B(n=="/"?"/":await Fe(n),i),{fs:o,path:a,mountPoint:l}=H(r);try{return(await o.stat(a,k)).isSymbolicLink()?Fe(l+await Fr(r)):r}catch(c){throw le(c,{[a]:r})}}s(Fe,"realpath");function Gg(t,e={}){throw f.With("ENOSYS",t.toString(),"watch")}s(Gg,"watch");async function Ms(t,e=0){if(!(await Ei(t)).hasAccess(e,k))throw new f(13)}s(Ms,"access");async function Ir(t,e){switch(t=x(t),(await Ei(t)).mode&61440){case 16384:if(e?.recursive)for(let n of await Rt(t))await Ir(B(t,n));await kr(t);return;case 32768:case 40960:await hn(t);return;case 24576:case 8192:case 4096:case 49152:default:throw new f(1,"File type not supported",t,"rm")}}s(Ir,"rm");async function Ws(t,e){let i=typeof e=="object"?e?.encoding:e||"utf8",r="/tmp/"+`${t}${Date.now()}-${Math.random().toString(36).slice(2)}`;return await yn(r),i=="buffer"?Ht.Buffer.from(r):r}s(Ws,"mkdtemp");async function Pr(t,e,i){if(t=x(t),e=x(e),i&&i&1&&await ve(e))throw new f(17,"Destination file already exists.",e,"copyFile");await ki(e,await pn(t))}s(Pr,"copyFile");async function Us(t,e){return t=x(t),new ht(t)}s(Us,"opendir");async function Ar(t,e,i){t=x(t),e=x(e);let n=await xr(t);if(i?.errorOnExist&&await ve(e))throw new f(17,"Destination file or directory already exists.",e,"cp");switch(n.mode&61440){case 16384:if(!i?.recursive)throw new f(21,t+" is a directory (not copied)",t,"cp");await yn(e,{recursive:!0});for(let r of await Rt(t,{withFileTypes:!0}))i.filter&&!i.filter(B(t,r.name),B(e,r.name))||await Ar(B(t,r.name),B(e,r.name),i);break;case 32768:case 40960:await Pr(t,e);break;case 24576:case 8192:case 4096:case 49152:default:throw new f(1,"File type not supported",t,"rm")}i?.preserveTimestamps&&await vr(e,n.atime,n.mtime)}s(Ar,"cp");async function qs(t,e){throw f.With("ENOSYS",t.toString(),"statfs")}s(qs,"statfs");function iu(t,e,i=S){Ps(t,e).then(()=>i()).catch(i)}s(iu,"rename");function nu(t,e=S){ve(t).then(e).catch(()=>e(!1))}s(nu,"exists");function ru(t,e,i=S){i=typeof e=="function"?e:i,Ei(t,typeof e!="function"?e:{}).then(n=>i(void 0,n)).catch(i)}s(ru,"stat");function ou(t,e,i=S){i=typeof e=="function"?e:i,xr(t,typeof e!="function"?e:{}).then(n=>i(void 0,n)).catch(i)}s(ou,"lstat");function su(t,e=0,i=S){i=typeof e=="function"?e:i,As(t,typeof e=="number"?e:0).then(()=>i()).catch(i)}s(su,"truncate");function au(t,e=S){hn(t).then(()=>e()).catch(e)}s(au,"unlink");function lu(t,e,i,n=S){let r=me(i,420);n=typeof i=="function"?i:n,ue(t,e,r).then(o=>n(void 0,o.fd)).catch(n)}s(lu,"open");function cu(t,e,i=S){i=typeof e=="function"?e:i,pn(t,typeof e=="function"?null:e).then(n=>i(void 0,n)).catch(i)}s(cu,"readFile");function fu(t,e,i,n=S){n=typeof i=="function"?i:n,ki(t,e,typeof i!="function"?i:null).then(()=>n(void 0)).catch(n)}s(fu,"writeFile");function uu(t,e,i,n=S){n=typeof i=="function"?i:n,Ts(t,e,typeof i=="function"?null:i).then(()=>n()).catch(n)}s(uu,"appendFile");function du(t,e,i=S){i=typeof e=="function"?e:i,M(t).stat().then(n=>i(void 0,typeof e=="object"&&e?.bigint?new ie(n):n)).catch(i)}s(du,"fstat");function hu(t,e=S){new te(t).close().then(()=>e()).catch(e)}s(hu,"close");function pu(t,e,i=S){let n=typeof e=="number"?e:0;i=typeof e=="function"?e:i;let r=M(t);if(n<0)throw new f(22);r.truncate(n).then(()=>i()).catch(i)}s(pu,"ftruncate");function yu(t,e=S){M(t).sync().then(()=>e()).catch(e)}s(yu,"fsync");function mu(t,e=S){M(t).datasync().then(()=>e()).catch(e)}s(mu,"fdatasync");function bu(t,e,i,n,r,o=S){let a,l,c,u,h,d=new te(t);if(typeof e=="string"){switch(h="utf8",typeof i){case"function":o=i;break;case"number":u=i,h=typeof n=="string"?n:"utf8",o=typeof r=="function"?r:o;break;default:o=typeof n=="function"?n:typeof r=="function"?r:o,o(new f(22,"Invalid arguments."));return}a=Buffer.from(e),l=0,c=a.length;let b=o;d.write(a,l,c,u).then(({bytesWritten:m})=>b(void 0,m,a.toString(h))).catch(b)}else{a=Buffer.from(e.buffer),l=i,c=n,u=typeof r=="number"?r:null;let b=typeof r=="function"?r:o;d.write(a,l,c,u).then(({bytesWritten:m})=>b(void 0,m,a)).catch(b)}}s(bu,"write");function gu(t,e,i,n,r,o=S){new te(t).read(e,i,n,r).then(({bytesRead:a,buffer:l})=>o(void 0,a,l)).catch(o)}s(gu,"read");function wu(t,e,i,n=S){new te(t).chown(e,i).then(()=>n()).catch(n)}s(wu,"fchown");function Su(t,e,i){new te(t).chmod(e).then(()=>i()).catch(i)}s(Su,"fchmod");function _u(t,e,i,n=S){new te(t).utimes(e,i).then(()=>n()).catch(n)}s(_u,"futimes");function Eu(t,e=S){kr(t).then(()=>e()).catch(e)}s(Eu,"rmdir");function xu(t,e,i=S){yn(t,e).then(()=>i()).catch(i)}s(xu,"mkdir");function ku(t,e,i=S){i=typeof e=="function"?e:i,Rt(t,typeof e!="function"?e:{}).then(r=>i(void 0,r)).catch(i)}s(ku,"readdir");function Fu(t,e,i=S){Os(t,e).then(()=>i()).catch(i)}s(Fu,"link");function vu(t,e,i,n=S){let r=typeof i=="string"?i:"file";n=typeof i=="function"?i:n,Cs(t,e,r).then(()=>n()).catch(n)}s(vu,"symlink");function Iu(t,e,i=S){i=typeof e=="function"?e:i,Fr(t).then(n=>i(void 0,n)).catch(i)}s(Iu,"readlink");function Pu(t,e,i,n=S){Rs(t,e,i).then(()=>n()).catch(n)}s(Pu,"chown");function Au(t,e,i,n=S){Ls(t,e,i).then(()=>n()).catch(n)}s(Au,"lchown");function Tu(t,e,i=S){Ns(t,e).then(()=>i()).catch(i)}s(Tu,"chmod");function Ou(t,e,i=S){Ds(t,e).then(()=>i()).catch(i)}s(Ou,"lchmod");function Cu(t,e,i,n=S){vr(t,e,i).then(()=>n()).catch(n)}s(Cu,"utimes");function Ru(t,e,i,n=S){Bs(t,e,i).then(()=>n()).catch(n)}s(Ru,"lutimes");function Lu(t,e,i=S){i=typeof e=="function"?e:i,Fe(t,typeof e=="function"?null:e).then(n=>i(void 0,n)).catch(i)}s(Lu,"realpath");function Nu(t,e,i=S){let n=typeof e=="number"?e:4;i=typeof e=="function"?e:i,Ms(t,typeof e=="function"?null:e).then(()=>i()).catch(i)}s(Nu,"access");function Du(t,e,i=S){throw f.With("ENOSYS",t.toString(),"watchFile")}s(Du,"watchFile");function Bu(t,e=S){throw f.With("ENOSYS",t.toString(),"unwatchFile")}s(Bu,"unwatchFile");function Mu(t,e,i=S){throw f.With("ENOSYS",t.toString(),"watch")}s(Mu,"watch");function Wu(t,e){let i=typeof e=="object"?e:{encoding:e},n,r=new gt({highWaterMark:i.highWaterMark||64*1024,encoding:i.encoding||"utf8",read:s(async function(o){try{n||=await ue(t,"r",i?.mode);let a=await n.read(new Uint8Array(o),0,o,n.file.position);r.push(a.bytesRead?a.buffer.slice(0,a.bytesRead):null),n.file.position+=a.bytesRead,a.bytesRead||await n.close()}catch(a){await n?.close(),r.destroy(a)}},"read"),destroy:s(function(o,a){n?.close().then(()=>a(o)).catch(a)},"destroy")});return r.path=t.toString(),r}s(Wu,"createReadStream");function Uu(t,e){let i=typeof e=="object"?e:{encoding:e},n,r=new wt({highWaterMark:i?.highWaterMark,write:s(async function(o,a,l){try{n||=await ue(t,"w",i?.mode||438),await n.write(o,0,a),l(void 0)}catch(c){await n?.close(),l(c)}},"write"),destroy:s(function(o,a){a(o),n?.close().then(()=>a(o)).catch(a)},"destroy"),final:s(function(o){n?.close().then(()=>o()).catch(o)},"final")});return r.path=t.toString(),r}s(Uu,"createWriteStream");function qu(t,e,i=S){i=typeof e=="function"?e:i,Ir(t,typeof e=="function"?void 0:e).then(()=>i(void 0)).catch(i)}s(qu,"rm");function ju(t,e,i=S){i=typeof e=="function"?e:i,Ws(t,typeof e!="function"?e:null).then(n=>i(void 0,n)).catch(i)}s(ju,"mkdtemp");function $u(t,e,i,n=S){n=typeof i=="function"?i:n,Pr(t,e,typeof i=="function"?void 0:i).then(()=>n(void 0)).catch(n)}s($u,"copyFile");function Vu(t,e,i,n=S){n=typeof i=="function"?i:n,new te(t).readv(e,typeof i=="function"?void 0:i).then(({buffers:r,bytesRead:o})=>n(void 0,o,r)).catch(n)}s(Vu,"readv");function zu(t,e,i,n=S){n=typeof i=="function"?i:n,new te(t).writev(e,typeof i=="function"?void 0:i).then(({buffers:r,bytesWritten:o})=>n(void 0,o,r)).catch(n)}s(zu,"writev");function Hu(t,e,i=S){i=typeof e=="function"?e:i,Us(t,typeof e=="function"?void 0:e).then(n=>i(void 0,n)).catch(i)}s(Hu,"opendir");function Yu(t,e,i,n=S){n=typeof i=="function"?i:n,Ar(t,e,typeof i=="function"?void 0:i).then(()=>n(void 0)).catch(n)}s(Yu,"cp");function Gu(t,e,i=S){i=typeof e=="function"?e:i,qs(t,typeof e=="function"?void 0:e).then(n=>i(void 0,n)).catch(i)}s(Gu,"statfs");async function Ku(t,e){let i=await ue(t.toString(),"r"),n=await i.readFile();return await i.close(),new Blob([n],e)}s(Ku,"openAsBlob");function js(t){return Gr(t)||zi(t)||t instanceof se}s(js,"isMountConfig");async function $s(t,e=0){if(typeof t!="object"||t==null)throw new f(22,"Invalid options on mount configuration");if(!js(t))throw new f(22,"Invalid mount configuration");if(t instanceof se)return t;zi(t)&&(t={backend:t});for(let[r,o]of Object.entries(t))if(r!="backend"&&js(o)){if(e>10)throw new f(22,"Invalid configuration, too deep and possibly infinite");t[r]=await $s(o,++e)}let{backend:i}=t;if(!await i.isAvailable())throw new f(1,"Backend not available: "+i);Yr(i,t);let n=await i.create(t);return await n.ready(),n}s($s,"resolveMountConfig");async function Kg(t){let e="uid"in t&&t.uid||0,i="gid"in t&&t.gid||0;js(t)&&(t={mounts:{"/":t}});for(let[n,r]of Object.entries(t.mounts)){if(!n.startsWith("/"))throw new f(22,"Mount points must have absolute paths");t.mounts[n]=await $s(r)}Ki(t.mounts),xa({uid:e,gid:i,suid:e,sgid:i,euid:e,egid:i})}s(Kg,"configure");var Xg=bn;return id(Jg);})();
5
5
  /*! Bundled license information:
6
6
 
7
7
  ieee754/index.js: