(function(Dt){typeof define=="function"&&define.amd?define(Dt):Dt()})(function(){"use strict";var Zl=Object.defineProperty;var Ql=(Dt,se,ie)=>se in Dt?Zl(Dt,se,{enumerable:!0,configurable:!0,writable:!0,value:ie}):Dt[se]=ie;var Ve=(Dt,se,ie)=>(Ql(Dt,typeof se!="symbol"?se+"":se,ie),ie);var Dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},se={},ie={};ie.byteLength=tf,ie.toByteArray=rf,ie.fromByteArray=sf;for(var ue=[],Zt=[],Qu=typeof Uint8Array<"u"?Uint8Array:Array,xn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hr=0,bu=xn.length;hr0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function tf(t){var e=co(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ef(t,e,r){return(e+r)*3/4-r}function rf(t){var e,r=co(t),n=r[0],i=r[1],o=new Qu(ef(t,n,i)),s=0,u=i>0?n-4:n,m;for(m=0;m>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=Zt[t.charCodeAt(m)]<<2|Zt[t.charCodeAt(m+1)]>>4,o[s++]=e&255),i===1&&(e=Zt[t.charCodeAt(m)]<<10|Zt[t.charCodeAt(m+1)]<<4|Zt[t.charCodeAt(m+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function nf(t){return ue[t>>18&63]+ue[t>>12&63]+ue[t>>6&63]+ue[t&63]}function of(t,e,r){for(var n,i=[],o=e;ou?u:s+o));return n===1?(e=t[r-1],i.push(ue[e>>2]+ue[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(ue[e>>10]+ue[e>>4&63]+ue[e<<2&63]+"=")),i.join("")}var br={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */br.read=function(t,e,r,n,i){var o,s,u=i*8-n-1,m=(1<>1,E=-7,w=r?i-1:0,I=r?-1:1,S=t[e+w];for(w+=I,o=S&(1<<-E)-1,S>>=-E,E+=u;E>0;o=o*256+t[e+w],w+=I,E-=8);for(s=o&(1<<-E)-1,o>>=-E,E+=n;E>0;s=s*256+t[e+w],w+=I,E-=8);if(o===0)o=1-g;else{if(o===m)return s?NaN:(S?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-g}return(S?-1:1)*s*Math.pow(2,o-n)},br.write=function(t,e,r,n,i,o){var s,u,m,g=o*8-i-1,E=(1<>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=n?0:o-1,L=n?1:-1,G=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=E):(s=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-s))<1&&(s--,m*=2),s+w>=1?e+=I/m:e+=I*Math.pow(2,1-w),e*m>=2&&(s++,m/=2),s+w>=E?(u=0,s=E):s+w>=1?(u=(e*m-1)*Math.pow(2,i),s=s+w):(u=e*Math.pow(2,w-1)*Math.pow(2,i),s=0));i>=8;t[r+S]=u&255,S+=L,u/=256,i-=8);for(s=s<0;t[r+S]=s&255,S+=L,s/=256,g-=8);t[r+S-L]|=G*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */(function(t){var e=ie,r=br,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=tt,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,u.TYPED_ARRAY_SUPPORT=o(),!u.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 o(){try{var A=new Uint8Array(1),a={foo:function(){return 42}};return Object.setPrototypeOf(a,Uint8Array.prototype),Object.setPrototypeOf(A,a),A.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function s(A){if(A>i)throw new RangeError('The value "'+A+'" is invalid for option "size"');var a=new Uint8Array(A);return Object.setPrototypeOf(a,u.prototype),a}function u(A,a,_){if(typeof A=="number"){if(typeof a=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(A)}return m(A,a,_)}u.poolSize=8192;function m(A,a,_){if(typeof A=="string")return I(A,a);if(ArrayBuffer.isView(A))return L(A);if(A==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof A);if(At(A,ArrayBuffer)||A&&At(A.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(At(A,SharedArrayBuffer)||A&&At(A.buffer,SharedArrayBuffer)))return G(A,a,_);if(typeof A=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var O=A.valueOf&&A.valueOf();if(O!=null&&O!==A)return u.from(O,a,_);var W=Y(A);if(W)return W;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof A[Symbol.toPrimitive]=="function")return u.from(A[Symbol.toPrimitive]("string"),a,_);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof A)}u.from=function(A,a,_){return m(A,a,_)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function g(A){if(typeof A!="number")throw new TypeError('"size" argument must be of type number');if(A<0)throw new RangeError('The value "'+A+'" is invalid for option "size"')}function E(A,a,_){return g(A),A<=0?s(A):a!==void 0?typeof _=="string"?s(A).fill(a,_):s(A).fill(a):s(A)}u.alloc=function(A,a,_){return E(A,a,_)};function w(A){return g(A),s(A<0?0:b(A)|0)}u.allocUnsafe=function(A){return w(A)},u.allocUnsafeSlow=function(A){return w(A)};function I(A,a){if((typeof a!="string"||a==="")&&(a="utf8"),!u.isEncoding(a))throw new TypeError("Unknown encoding: "+a);var _=X(A,a)|0,O=s(_),W=O.write(A,a);return W!==_&&(O=O.slice(0,W)),O}function S(A){for(var a=A.length<0?0:b(A.length)|0,_=s(a),O=0;O=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return A|0}function tt(A){return+A!=A&&(A=0),u.alloc(+A)}u.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==u.prototype},u.compare=function(a,_){if(At(a,Uint8Array)&&(a=u.from(a,a.offset,a.byteLength)),At(_,Uint8Array)&&(_=u.from(_,_.offset,_.byteLength)),!u.isBuffer(a)||!u.isBuffer(_))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===_)return 0;for(var O=a.length,W=_.length,K=0,z=Math.min(O,W);KW.length?u.from(z).copy(W,K):Uint8Array.prototype.set.call(W,z,K);else if(u.isBuffer(z))z.copy(W,K);else throw new TypeError('"list" argument must be an Array of Buffers');K+=z.length}return W};function X(A,a){if(u.isBuffer(A))return A.length;if(ArrayBuffer.isView(A)||At(A,ArrayBuffer))return A.byteLength;if(typeof A!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof A);var _=A.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&_===0)return 0;for(var W=!1;;)switch(a){case"ascii":case"latin1":case"binary":return _;case"utf8":case"utf-8":return It(A).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _*2;case"hex":return _>>>1;case"base64":return Gt(A).length;default:if(W)return O?-1:It(A).length;a=(""+a).toLowerCase(),W=!0}}u.byteLength=X;function et(A,a,_){var O=!1;if((a===void 0||a<0)&&(a=0),a>this.length||((_===void 0||_>this.length)&&(_=this.length),_<=0)||(_>>>=0,a>>>=0,_<=a))return"";for(A||(A="utf8");;)switch(A){case"hex":return N(this,a,_);case"utf8":case"utf-8":return it(this,a,_);case"ascii":return at(this,a,_);case"latin1":case"binary":return U(this,a,_);case"base64":return ot(this,a,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,a,_);default:if(O)throw new TypeError("Unknown encoding: "+A);A=(A+"").toLowerCase(),O=!0}}u.prototype._isBuffer=!0;function nt(A,a,_){var O=A[a];A[a]=A[_],A[_]=O}u.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var _=0;__&&(a+=" ... "),""},n&&(u.prototype[n]=u.prototype.inspect),u.prototype.compare=function(a,_,O,W,K){if(At(a,Uint8Array)&&(a=u.from(a,a.offset,a.byteLength)),!u.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof a);if(_===void 0&&(_=0),O===void 0&&(O=a?a.length:0),W===void 0&&(W=0),K===void 0&&(K=this.length),_<0||O>a.length||W<0||K>this.length)throw new RangeError("out of range index");if(W>=K&&_>=O)return 0;if(W>=K)return-1;if(_>=O)return 1;if(_>>>=0,O>>>=0,W>>>=0,K>>>=0,this===a)return 0;for(var z=K-W,ht=O-_,yt=Math.min(z,ht),pt=this.slice(W,K),Ct=a.slice(_,O),d=0;d2147483647?_=2147483647:_<-2147483648&&(_=-2147483648),_=+_,zt(_)&&(_=W?0:A.length-1),_<0&&(_=A.length+_),_>=A.length){if(W)return-1;_=A.length-1}else if(_<0)if(W)_=0;else return-1;if(typeof a=="string"&&(a=u.from(a,O)),u.isBuffer(a))return a.length===0?-1:C(A,a,_,O,W);if(typeof a=="number")return a=a&255,typeof Uint8Array.prototype.indexOf=="function"?W?Uint8Array.prototype.indexOf.call(A,a,_):Uint8Array.prototype.lastIndexOf.call(A,a,_):C(A,[a],_,O,W);throw new TypeError("val must be string, number or Buffer")}function C(A,a,_,O,W){var K=1,z=A.length,ht=a.length;if(O!==void 0&&(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le")){if(A.length<2||a.length<2)return-1;K=2,z/=2,ht/=2,_/=2}function yt(c,T){return K===1?c[T]:c.readUInt16BE(T*K)}var pt;if(W){var Ct=-1;for(pt=_;ptz&&(_=z-ht),pt=_;pt>=0;pt--){for(var d=!0,h=0;hW&&(O=W)):O=W;var K=a.length;O>K/2&&(O=K/2);for(var z=0;z>>0,isFinite(O)?(O=O>>>0,W===void 0&&(W="utf8")):(W=O,O=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var K=this.length-_;if((O===void 0||O>K)&&(O=K),a.length>0&&(O<0||_<0)||_>this.length)throw new RangeError("Attempt to write outside buffer bounds");W||(W="utf8");for(var z=!1;;)switch(W){case"hex":return k(this,a,_,O);case"utf8":case"utf-8":return $(this,a,_,O);case"ascii":case"latin1":case"binary":return j(this,a,_,O);case"base64":return J(this,a,_,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rt(this,a,_,O);default:if(z)throw new TypeError("Unknown encoding: "+W);W=(""+W).toLowerCase(),z=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ot(A,a,_){return a===0&&_===A.length?e.fromByteArray(A):e.fromByteArray(A.slice(a,_))}function it(A,a,_){_=Math.min(A.length,_);for(var O=[],W=a;W<_;){var K=A[W],z=null,ht=K>239?4:K>223?3:K>191?2:1;if(W+ht<=_){var yt,pt,Ct,d;switch(ht){case 1:K<128&&(z=K);break;case 2:yt=A[W+1],(yt&192)===128&&(d=(K&31)<<6|yt&63,d>127&&(z=d));break;case 3:yt=A[W+1],pt=A[W+2],(yt&192)===128&&(pt&192)===128&&(d=(K&15)<<12|(yt&63)<<6|pt&63,d>2047&&(d<55296||d>57343)&&(z=d));break;case 4:yt=A[W+1],pt=A[W+2],Ct=A[W+3],(yt&192)===128&&(pt&192)===128&&(Ct&192)===128&&(d=(K&15)<<18|(yt&63)<<12|(pt&63)<<6|Ct&63,d>65535&&d<1114112&&(z=d))}}z===null?(z=65533,ht=1):z>65535&&(z-=65536,O.push(z>>>10&1023|55296),z=56320|z&1023),O.push(z),W+=ht}return ft(O)}var ut=4096;function ft(A){var a=A.length;if(a<=ut)return String.fromCharCode.apply(String,A);for(var _="",O=0;OO)&&(_=O);for(var W="",K=a;K<_;++K)W+=je[A[K]];return W}function P(A,a,_){for(var O=A.slice(a,_),W="",K=0;KO&&(a=O),_<0?(_+=O,_<0&&(_=0)):_>O&&(_=O),__)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(a,_,O){a=a>>>0,_=_>>>0,O||x(a,_,this.length);for(var W=this[a],K=1,z=0;++z<_&&(K*=256);)W+=this[a+z]*K;return W},u.prototype.readUintBE=u.prototype.readUIntBE=function(a,_,O){a=a>>>0,_=_>>>0,O||x(a,_,this.length);for(var W=this[a+--_],K=1;_>0&&(K*=256);)W+=this[a+--_]*K;return W},u.prototype.readUint8=u.prototype.readUInt8=function(a,_){return a=a>>>0,_||x(a,1,this.length),this[a]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(a,_){return a=a>>>0,_||x(a,2,this.length),this[a]|this[a+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(a,_){return a=a>>>0,_||x(a,2,this.length),this[a]<<8|this[a+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(a,_){return a=a>>>0,_||x(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(a,_){return a=a>>>0,_||x(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},u.prototype.readIntLE=function(a,_,O){a=a>>>0,_=_>>>0,O||x(a,_,this.length);for(var W=this[a],K=1,z=0;++z<_&&(K*=256);)W+=this[a+z]*K;return K*=128,W>=K&&(W-=Math.pow(2,8*_)),W},u.prototype.readIntBE=function(a,_,O){a=a>>>0,_=_>>>0,O||x(a,_,this.length);for(var W=_,K=1,z=this[a+--W];W>0&&(K*=256);)z+=this[a+--W]*K;return K*=128,z>=K&&(z-=Math.pow(2,8*_)),z},u.prototype.readInt8=function(a,_){return a=a>>>0,_||x(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},u.prototype.readInt16LE=function(a,_){a=a>>>0,_||x(a,2,this.length);var O=this[a]|this[a+1]<<8;return O&32768?O|4294901760:O},u.prototype.readInt16BE=function(a,_){a=a>>>0,_||x(a,2,this.length);var O=this[a+1]|this[a]<<8;return O&32768?O|4294901760:O},u.prototype.readInt32LE=function(a,_){return a=a>>>0,_||x(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},u.prototype.readInt32BE=function(a,_){return a=a>>>0,_||x(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},u.prototype.readFloatLE=function(a,_){return a=a>>>0,_||x(a,4,this.length),r.read(this,a,!0,23,4)},u.prototype.readFloatBE=function(a,_){return a=a>>>0,_||x(a,4,this.length),r.read(this,a,!1,23,4)},u.prototype.readDoubleLE=function(a,_){return a=a>>>0,_||x(a,8,this.length),r.read(this,a,!0,52,8)},u.prototype.readDoubleBE=function(a,_){return a=a>>>0,_||x(a,8,this.length),r.read(this,a,!1,52,8)};function q(A,a,_,O,W,K){if(!u.isBuffer(A))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>W||aA.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(a,_,O,W){if(a=+a,_=_>>>0,O=O>>>0,!W){var K=Math.pow(2,8*O)-1;q(this,a,_,O,K,0)}var z=1,ht=0;for(this[_]=a&255;++ht>>0,O=O>>>0,!W){var K=Math.pow(2,8*O)-1;q(this,a,_,O,K,0)}var z=O-1,ht=1;for(this[_+z]=a&255;--z>=0&&(ht*=256);)this[_+z]=a/ht&255;return _+O},u.prototype.writeUint8=u.prototype.writeUInt8=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,1,255,0),this[_]=a&255,_+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,2,65535,0),this[_]=a&255,this[_+1]=a>>>8,_+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,2,65535,0),this[_]=a>>>8,this[_+1]=a&255,_+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,4,4294967295,0),this[_+3]=a>>>24,this[_+2]=a>>>16,this[_+1]=a>>>8,this[_]=a&255,_+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,4,4294967295,0),this[_]=a>>>24,this[_+1]=a>>>16,this[_+2]=a>>>8,this[_+3]=a&255,_+4},u.prototype.writeIntLE=function(a,_,O,W){if(a=+a,_=_>>>0,!W){var K=Math.pow(2,8*O-1);q(this,a,_,O,K-1,-K)}var z=0,ht=1,yt=0;for(this[_]=a&255;++z>0)-yt&255;return _+O},u.prototype.writeIntBE=function(a,_,O,W){if(a=+a,_=_>>>0,!W){var K=Math.pow(2,8*O-1);q(this,a,_,O,K-1,-K)}var z=O-1,ht=1,yt=0;for(this[_+z]=a&255;--z>=0&&(ht*=256);)a<0&&yt===0&&this[_+z+1]!==0&&(yt=1),this[_+z]=(a/ht>>0)-yt&255;return _+O},u.prototype.writeInt8=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,1,127,-128),a<0&&(a=255+a+1),this[_]=a&255,_+1},u.prototype.writeInt16LE=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,2,32767,-32768),this[_]=a&255,this[_+1]=a>>>8,_+2},u.prototype.writeInt16BE=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,2,32767,-32768),this[_]=a>>>8,this[_+1]=a&255,_+2},u.prototype.writeInt32LE=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,4,2147483647,-2147483648),this[_]=a&255,this[_+1]=a>>>8,this[_+2]=a>>>16,this[_+3]=a>>>24,_+4},u.prototype.writeInt32BE=function(a,_,O){return a=+a,_=_>>>0,O||q(this,a,_,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[_]=a>>>24,this[_+1]=a>>>16,this[_+2]=a>>>8,this[_+3]=a&255,_+4};function _t(A,a,_,O,W,K){if(_+O>A.length)throw new RangeError("Index out of range");if(_<0)throw new RangeError("Index out of range")}function mt(A,a,_,O,W){return a=+a,_=_>>>0,W||_t(A,a,_,4),r.write(A,a,_,O,23,4),_+4}u.prototype.writeFloatLE=function(a,_,O){return mt(this,a,_,!0,O)},u.prototype.writeFloatBE=function(a,_,O){return mt(this,a,_,!1,O)};function wt(A,a,_,O,W){return a=+a,_=_>>>0,W||_t(A,a,_,8),r.write(A,a,_,O,52,8),_+8}u.prototype.writeDoubleLE=function(a,_,O){return wt(this,a,_,!0,O)},u.prototype.writeDoubleBE=function(a,_,O){return wt(this,a,_,!1,O)},u.prototype.copy=function(a,_,O,W){if(!u.isBuffer(a))throw new TypeError("argument should be a Buffer");if(O||(O=0),!W&&W!==0&&(W=this.length),_>=a.length&&(_=a.length),_||(_=0),W>0&&W=this.length)throw new RangeError("Index out of range");if(W<0)throw new RangeError("sourceEnd out of bounds");W>this.length&&(W=this.length),a.length-_>>0,O=O===void 0?this.length:O>>>0,a||(a=0);var z;if(typeof a=="number")for(z=_;z55295&&_<57344){if(!W){if(_>56319){(a-=3)>-1&&K.push(239,191,189);continue}else if(z+1===O){(a-=3)>-1&&K.push(239,191,189);continue}W=_;continue}if(_<56320){(a-=3)>-1&&K.push(239,191,189),W=_;continue}_=(W-55296<<10|_-56320)+65536}else W&&(a-=3)>-1&&K.push(239,191,189);if(W=null,_<128){if((a-=1)<0)break;K.push(_)}else if(_<2048){if((a-=2)<0)break;K.push(_>>6|192,_&63|128)}else if(_<65536){if((a-=3)<0)break;K.push(_>>12|224,_>>6&63|128,_&63|128)}else if(_<1114112){if((a-=4)<0)break;K.push(_>>18|240,_>>12&63|128,_>>6&63|128,_&63|128)}else throw new Error("Invalid code point")}return K}function ne(A){for(var a=[],_=0;_>8,W=_%256,K.push(W),K.push(O);return K}function Gt(A){return e.toByteArray(Ye(A))}function Pt(A,a,_,O){for(var W=0;W=a.length||W>=A.length);++W)a[W+_]=A[W];return W}function At(A,a){return A instanceof a||A!=null&&A.constructor!=null&&A.constructor.name!=null&&A.constructor.name===a.name}function zt(A){return A!==A}var je=function(){for(var A="0123456789abcdef",a=new Array(256),_=0;_<16;++_)for(var O=_*16,W=0;W<16;++W)a[O+W]=A[_]+A[W];return a}()})(se);var oe={},uf={get exports(){return oe},set exports(t){oe=t}},Nt=uf.exports={},fe,he;function Hn(){throw new Error("setTimeout has not been defined")}function Yn(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?fe=setTimeout:fe=Hn}catch{fe=Hn}try{typeof clearTimeout=="function"?he=clearTimeout:he=Yn}catch{he=Yn}})();function ao(t){if(fe===setTimeout)return setTimeout(t,0);if((fe===Hn||!fe)&&setTimeout)return fe=setTimeout,setTimeout(t,0);try{return fe(t,0)}catch{try{return fe.call(null,t,0)}catch{return fe.call(this,t,0)}}}function ff(t){if(he===clearTimeout)return clearTimeout(t);if((he===Yn||!he)&&clearTimeout)return he=clearTimeout,clearTimeout(t);try{return he(t)}catch{try{return he.call(null,t)}catch{return he.call(this,t)}}}var Se=[],lr=!1,Ke,tn=-1;function hf(){!lr||!Ke||(lr=!1,Ke.length?Se=Ke.concat(Se):tn=-1,Se.length&&po())}function po(){if(!lr){var t=ao(hf);lr=!0;for(var e=Se.length;e;){for(Ke=Se,Se=[];++tn1)for(var r=1;r=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function rn(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;t=r.call(t);var n,i=[];try{for(;(e===void 0||0t;++t)ce[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t],Qt["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(t)]=t;Qt[45]=62,Qt[95]=63}function pf(t,e,r){for(var n=[],i=e;i>18&63]+ce[e>>12&63]+ce[e>>6&63]+ce[e&63]);return n.join("")}function go(t){Vn||yo();for(var e=t.length,r=e%3,n="",i=[],o=0,s=e-r;os?s:o+16383));return r===1?(t=t[e-1],n+=ce[t>>2],n+=ce[t<<4&63],n+="=="):r===2&&(t=(t[e-2]<<8)+t[e-1],n+=ce[t>>10],n+=ce[t>>4&63],n+=ce[t<<2&63],n+="="),i.push(n),i.join("")}function sn(t,e,r,n,i){var o=8*i-n-1,s=(1<>1,m=-7;i=r?i-1:0;var g=r?-1:1,E=t[e+i];for(i+=g,r=E&(1<<-m)-1,E>>=-m,m+=o;0>=-m,m+=n;0>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;o=n?0:o-1;var w=n?1:-1,I=0>e||e===0&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(e=isNaN(e)?1:0,n=m):(n=Math.floor(Math.log(e)/Math.LN2),1>e*(s=Math.pow(2,-n))&&(n--,s*=2),e=1<=n+g?e+E/s:e+E*Math.pow(2,1-g),2<=e*s&&(n++,s/=2),n+g>=m?(e=0,n=m):1<=n+g?(e=(e*s-1)*Math.pow(2,i),n+=g):(e=e*Math.pow(2,g-1)*Math.pow(2,i),n=0));8<=i;t[r+o]=e&255,o+=w,e/=256,i-=8);for(n=n<r||e.byteLengtht)throw new RangeError('"size" argument must not be negative')}V.alloc=function(t,e,r){return So(t),t=0>=t?we(null,t):e!==void 0?typeof r=="string"?we(null,t).fill(e,r):we(null,t).fill(e):we(null,t),t};function Kn(t,e){if(So(e),t=we(t,0>e?0:qn(e)|0),!V.TYPED_ARRAY_SUPPORT)for(var r=0;re.length?0:qn(e.length)|0;t=we(t,r);for(var n=0;n=(V.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(V.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return t|0}V.isBuffer=Bo;function ae(t){return!(t==null||!t._isBuffer)}V.compare=function(t,e){if(!ae(t)||!ae(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i>>1;case"base64":return Oo(t).length;default:if(n)return cn(t).length;e=(""+e).toLowerCase(),n=!0}}V.byteLength=Io;function df(t,e,r){var n=!1;if((e===void 0||0>e)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),0>=r)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":for(t=e,e=r,r=this.length,(!t||0>t)&&(t=0),(!e||0>e||e>r)&&(e=r),n="",r=t;rn?"0"+n.toString(16):n.toString(16),n=t+n;return n;case"utf8":case"utf-8":return To(this,e,r);case"ascii":for(t="",r=Math.min(this.length,r);e"},V.prototype.compare=function(t,e,r,n,i){if(!ae(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),n===void 0&&(n=0),i===void 0&&(i=this.length),0>e||r>t.length||0>n||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;var o=i-n,s=r-e,u=Math.min(o,s);for(n=this.slice(n,i),t=t.slice(e,r),e=0;er&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),0>r&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(0>r)if(i)r=0;else return-1;if(typeof e=="string"&&(e=V.from(e,n)),ae(e))return e.length===0?-1:Ao(t,e,r,n,i);if(typeof e=="number")return e&=255,V.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ao(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Ao(t,e,r,n,i){function o(g,E){return s===1?g[E]:g.readUInt16BE(E*s)}var s=1,u=t.length,m=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(2>t.length||2>e.length)return-1;s=2,u/=2,m/=2,r/=2}if(i)for(n=-1;ru&&(r=u-m);0<=r;r--){for(u=!0,n=0;ni)&&(r=i),0r||0>e)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");for(n||(n="utf8"),i=!1;;)switch(n){case"hex":t:{if(e=Number(e)||0,n=this.length-e,r?(r=Number(r),r>n&&(r=n)):r=n,n=t.length,n%2!==0)throw new TypeError("Invalid hex string");for(r>n/2&&(r=n/2),n=0;n(i-=2));++s){var u=n.charCodeAt(s);t=u>>8,u%=256,o.push(u),o.push(t)}return Ur(o,this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},V.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function To(t,e,r){r=Math.min(t.length,r);for(var n=[];ei&&(o=i);break;case 2:var u=t[e+1];(u&192)===128&&(i=(i&31)<<6|u&63,127i||57343i&&(o=i))}o===null?(o=65533,s=1):65535>>10&1023|55296),o=56320|o&1023),n.push(o),e+=s}if(t=n.length,t<=vo)n=String.fromCharCode.apply(String,n);else{for(r="",e=0;et?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),et)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}V.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||Wt(t,e,this.length),r=this[t];for(var n=1,i=0;++i=128*n&&(r-=Math.pow(2,8*e)),r},V.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||Wt(t,e,this.length),r=e;for(var n=1,i=this[t+--r];0=128*n&&(i-=Math.pow(2,8*e)),i},V.prototype.readInt8=function(t,e){return e||Wt(t,1,this.length),this[t]&128?-1*(255-this[t]+1):this[t]},V.prototype.readInt16LE=function(t,e){return e||Wt(t,2,this.length),t=this[t]|this[t+1]<<8,t&32768?t|4294901760:t},V.prototype.readInt16BE=function(t,e){return e||Wt(t,2,this.length),t=this[t+1]|this[t]<<8,t&32768?t|4294901760:t},V.prototype.readInt32LE=function(t,e){return e||Wt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},V.prototype.readInt32BE=function(t,e){return e||Wt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},V.prototype.readFloatLE=function(t,e){return e||Wt(t,4,this.length),sn(this,t,!0,23,4)},V.prototype.readFloatBE=function(t,e){return e||Wt(t,4,this.length),sn(this,t,!1,23,4)},V.prototype.readDoubleLE=function(t,e){return e||Wt(t,8,this.length),sn(this,t,!0,52,8)},V.prototype.readDoubleBE=function(t,e){return e||Wt(t,8,this.length),sn(this,t,!1,52,8)};function Yt(t,e,r,n,i,o){if(!ae(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}V.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||Yt(this,t,e,r,Math.pow(2,8*r)-1,0),n=1;var i=0;for(this[e]=t&255;++ie&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}V.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,2,65535,0),V.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):fn(this,t,e,!0),e+2},V.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,2,65535,0),V.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):fn(this,t,e,!1),e+2};function hn(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}V.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,4,4294967295,0),V.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):hn(this,t,e,!0),e+4},V.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,4,4294967295,0),V.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):hn(this,t,e,!1),e+4},V.prototype.writeIntLE=function(t,e,r,n){t=+t,e|=0,n||(n=Math.pow(2,8*r-1),Yt(this,t,e,r,n-1,-n)),n=0;var i=1,o=0;for(this[e]=t&255;++nt&&o===0&&this[e+n-1]!==0&&(o=1),this[e+n]=(t/i>>0)-o&255;return e+r},V.prototype.writeIntBE=function(t,e,r,n){t=+t,e|=0,n||(n=Math.pow(2,8*r-1),Yt(this,t,e,r,n-1,-n)),n=r-1;var i=1,o=0;for(this[e+n]=t&255;0<=--n&&(i*=256);)0>t&&o===0&&this[e+n+1]!==0&&(o=1),this[e+n]=(t/i>>0)-o&255;return e+r},V.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,1,127,-128),V.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=t&255,e+1},V.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,2,32767,-32768),V.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):fn(this,t,e,!0),e+2},V.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,2,32767,-32768),V.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):fn(this,t,e,!1),e+2},V.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,4,2147483647,-2147483648),V.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):hn(this,t,e,!0),e+4},V.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||Yt(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),V.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):hn(this,t,e,!1),e+4};function ln(t,e,r,n){if(r+n>t.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}V.prototype.writeFloatLE=function(t,e,r){return r||ln(this,t,e,4),un(this,t,e,!0,23,4),e+4},V.prototype.writeFloatBE=function(t,e,r){return r||ln(this,t,e,4),un(this,t,e,!1,23,4),e+4},V.prototype.writeDoubleLE=function(t,e,r){return r||ln(this,t,e,8),un(this,t,e,!0,52,8),e+8},V.prototype.writeDoubleBE=function(t,e,r){return r||ln(this,t,e,8),un(this,t,e,!1,52,8),e+8},V.prototype.copy=function(t,e,r,n){if(r||(r=0),n||n===0||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),0e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-ei||!V.TYPED_ARRAY_SUPPORT)for(n=0;ni&&(t=i)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!V.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof t=="number"&&(t&=255);if(0>e||this.length>>=0,r=r===void 0?this.length:r>>>0,t||(t=0),typeof t=="number")for(n=e;nr){if(!i){if(56319r){-1<(e-=3)&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&-1<(e-=3)&&o.push(239,191,189);if(i=null,128>r){if(0>--e)break;o.push(r)}else if(2048>r){if(0>(e-=2))break;o.push(r>>6|192,r&63|128)}else if(65536>r){if(0>(e-=3))break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(1114112>r){if(0>(e-=4))break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw Error("Invalid code point")}return o}function Ro(t){for(var e=[],r=0;rt.length)t="";else for(;t.length%4!==0;)t+="=";Vn||yo();var e=t.length;if(0>16&255,n[o++]=s>>8&255,n[o++]=s&255}return r===2?(s=Qt[t.charCodeAt(e)]<<2|Qt[t.charCodeAt(e+1)]>>4,n[o++]=s&255):r===1&&(s=Qt[t.charCodeAt(e)]<<10|Qt[t.charCodeAt(e+1)]<<4|Qt[t.charCodeAt(e+2)]>>2,n[o++]=s>>8&255,n[o++]=s&255),n}function Ur(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Bo(t){return t!=null&&(!!t._isBuffer||No(t)||typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&No(t.slice(0,0)))}function No(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var an=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:yf,Buffer:V,SlowBuffer:function(t){return+t!=t&&(t=0),V.alloc(+t)},isBuffer:Bo}),vt=V,pn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof le<"u"?le:typeof self<"u"?self:{};function Xn(t,e){return e={exports:{}},t(e,e.exports),e.exports}function Fo(){throw Error("setTimeout has not been defined")}function Lo(){throw Error("clearTimeout has not been defined")}var Ne=Fo,Fe=Lo;typeof Wr.setTimeout=="function"&&(Ne=setTimeout),typeof Wr.clearTimeout=="function"&&(Fe=clearTimeout);function Co(t){if(Ne===setTimeout)return setTimeout(t,0);if((Ne===Fo||!Ne)&&setTimeout)return Ne=setTimeout,setTimeout(t,0);try{return Ne(t,0)}catch{try{return Ne.call(null,t,0)}catch{return Ne.call(this,t,0)}}}function mf(t){if(Fe===clearTimeout)return clearTimeout(t);if((Fe===Lo||!Fe)&&clearTimeout)return Fe=clearTimeout,clearTimeout(t);try{return Fe(t)}catch{try{return Fe.call(null,t)}catch{return Fe.call(this,t)}}}var Ae=[],cr=!1,qe,_n=-1;function Sf(){cr&&qe&&(cr=!1,qe.length?Ae=qe.concat(Ae):_n=-1,Ae.length&&Wo())}function Wo(){if(!cr){var t=Co(Sf);cr=!0;for(var e=Ae.length;e;){for(qe=Ae,Ae=[];++_ne&&(r--,e+=1e9)),[r,e]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-wf)/1e3}},Po=Xn(function(t,e){function r(o,s){for(var u in o)s[u]=o[u]}function n(o,s,u){return i(o,s,u)}var i=an.Buffer;i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=an:(r(an,e),e.Buffer=n),n.prototype=Object.create(i.prototype),r(i,n),n.from=function(o,s,u){if(typeof o=="number")throw new TypeError("Argument must not be a number");return i(o,s,u)},n.alloc=function(o,s,u){if(typeof o!="number")throw new TypeError("Argument must be a number");return o=i(o),s!==void 0?typeof u=="string"?o.fill(s,u):o.fill(s):o.fill(0),o},n.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return i(o)},n.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return an.SlowBuffer(o)}}),Tf=Xn(function(t,e){function r(){throw Error(`secure random number generation not supported by this browser use chrome, FireFox or Internet Explorer 11`)}function n(I,S){if(typeof I!="number"||I!==I)throw new TypeError("offset must be a number");if(I>w||0>I)throw new TypeError("offset must be a uint32");if(I>g||I>S)throw new RangeError("offset out of range")}function i(I,S,L){if(typeof I!="number"||I!==I)throw new TypeError("size must be a number");if(I>w||0>I)throw new TypeError("size must be a uint32");if(I+S>L||I>g)throw new RangeError("buffer too small")}function o(I,S,L,G){if(!(m.isBuffer(I)||I instanceof pn.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof S=="function")G=S,S=0,L=I.length;else if(typeof L=="function")G=L,L=I.length-S;else if(typeof G!="function")throw new TypeError('"cb" argument must be a function');return n(S,I.length),i(L,S,I.length),s(I,S,L,G)}function s(I,S,L,G){if(S=new Uint8Array(I.buffer,S,L),E.getRandomValues(S),G)Uo(function(){G(null,I)});else return I}function u(I,S,L){if(typeof S>"u"&&(S=0),!(m.isBuffer(I)||I instanceof pn.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return n(S,I.length),L===void 0&&(L=I.length-S),i(L,S,I.length),s(I,S,L)}var m=Po.Buffer,g=Po.kMaxLength,E=pn.crypto||pn.msCrypto,w=Math.pow(2,32)-1;E&&E.getRandomValues?(e.randomFill=o,e.randomFillSync=u):(e.randomFill=r,e.randomFillSync=r)}),vf=Xn(function(t){t.exports=Tf}).randomFillSync,Rf=Math.floor(.001*(Date.now()-performance.now()));function pe(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function Mo(t,e){for(var r="",n=0,i=-1,o=0,s,u=0;u<=t.length;++u){if(ur.length||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(2u){if(e.charCodeAt(o+g)===47)return e.slice(o+g+1);if(g===0)return e.slice(o+g)}else i>u&&(t.charCodeAt(r+g)===47?m=g:g===0&&(m=0));break}var E=t.charCodeAt(r+g),w=e.charCodeAt(o+g);if(E!==w)break;E===47&&(m=g)}for(i="",g=r+m+1;g<=n;++g)(g===n||t.charCodeAt(g)===47)&&(i=i.length===0?i+"..":i+"/..");return 0=i;--g)if(r=t.charCodeAt(g),r===47){if(!m){s=g+1;break}}else u===-1&&(m=!1,u=g+1),r===46?o===-1?o=g:E!==1&&(E=1):o!==-1&&(E=-1);return o===-1||u===-1||E===0||E===1&&o===u-1&&o===s+1?u!==-1&&(e.base=s===0&&n?e.name=t.slice(1,u):e.name=t.slice(s,u)):(s===0&&n?(e.name=t.slice(1,o),e.base=t.slice(1,u)):(e.name=t.slice(s,o),e.base=t.slice(s,u)),e.ext=t.slice(o,u)),0e&&(r--,e+=1e9)),[r,e]}),exit:function(t){throw new Wf(t)},kill:function(t){throw new Uf(t)},randomFillSync:vf,isTTY:function(){return!0},path:Of,fs:null},St,Je=Z(1),Le=Z(2),pr=Z(4),_r=Z(8),Ce=Z(16),Jn=Z(32),We=Z(64),yr=Z(128),yn=Z(256),Zn=Z(512),Qn=Z(1024),bn=Z(2048),ti=Z(4096),gn=Z(8192),dn=Z(16384),ei=Z(32768),ri=Z(65536),ni=Z(131072),ii=Z(262144),oi=Z(524288),si=Z(1048576),Ue=Z(2097152),En=Z(4194304),mn=Z(8388608),ui=Z(16777216),fi=Z(33554432),hi=Z(67108864),Ze=Z(134217728),xo=Z(268435456),gr=Je|Le|pr|_r|Ce|Jn|We|yr|yn|Zn|Qn|bn|ti|gn|dn|ei|ri|ni|ii|oi|si|Ue|mn|En|ui|hi|fi|Ze|xo,Ho=Je|Le|pr|_r|Ce|Jn|We|yr|yn|Ue|En|mn|Ze,Bf=Z(0),li=_r|Ce|yr|Zn|Qn|bn|ti|gn|dn|ei|ri|ni|ii|oi|si|Ue|mn|ui|hi|fi|Ze,Yo=li|Ho,jo=Le|_r|We|Ue|Ze|xo,Nf=Le|_r|We|Ue|Ze,Ff=Z(0),Lf={E2BIG:1,EACCES:2,EADDRINUSE:3,EADDRNOTAVAIL:4,EAFNOSUPPORT:5,EALREADY:7,EAGAIN:6,EBADF:8,EBADMSG:9,EBUSY:10,ECANCELED:11,ECHILD:12,ECONNABORTED:13,ECONNREFUSED:14,ECONNRESET:15,EDEADLOCK:16,EDESTADDRREQ:17,EDOM:18,EDQUOT:19,EEXIST:20,EFAULT:21,EFBIG:22,EHOSTDOWN:23,EHOSTUNREACH:23,EIDRM:24,EILSEQ:25,EINPROGRESS:26,EINTR:27,EINVAL:28,EIO:29,EISCONN:30,EISDIR:31,ELOOP:32,EMFILE:33,EMLINK:34,EMSGSIZE:35,EMULTIHOP:36,ENAMETOOLONG:37,ENETDOWN:38,ENETRESET:39,ENETUNREACH:40,ENFILE:41,ENOBUFS:42,ENODEV:43,ENOENT:44,ENOEXEC:45,ENOLCK:46,ENOLINK:47,ENOMEM:48,ENOMSG:49,ENOPROTOOPT:50,ENOSPC:51,ENOSYS:52,ENOTCONN:53,ENOTDIR:54,ENOTEMPTY:55,ENOTRECOVERABLE:56,ENOTSOCK:57,ENOTTY:59,ENXIO:60,EOVERFLOW:61,EOWNERDEAD:62,EPERM:63,EPIPE:64,EPROTO:65,EPROTONOSUPPORT:66,EPROTOTYPE:67,ERANGE:68,EROFS:69,ESPIPE:70,ESRCH:71,ESTALE:72,ETIMEDOUT:73,ETXTBSY:74,EXDEV:75},$o=(St={},St[6]="SIGHUP",St[8]="SIGINT",St[11]="SIGQUIT",St[7]="SIGILL",St[15]="SIGTRAP",St[0]="SIGABRT",St[2]="SIGBUS",St[5]="SIGFPE",St[9]="SIGKILL",St[20]="SIGUSR1",St[12]="SIGSEGV",St[21]="SIGUSR2",St[10]="SIGPIPE",St[1]="SIGALRM",St[14]="SIGTERM",St[3]="SIGCHLD",St[4]="SIGCONT",St[13]="SIGSTOP",St[16]="SIGTSTP",St[17]="SIGTTIN",St[18]="SIGTTOU",St[19]="SIGURG",St[23]="SIGXCPU",St[24]="SIGXFSZ",St[22]="SIGVTALRM",St),Cf=Je|Le|Ce|yr|Ue|Ze,Vo=Je|We|Ce|yr|Ue|Ze;function Qe(t){var e=Math.trunc(t);return t=Z(Math.round(1e6*(t-e))),Z(e)*Z(1e6)+t}function dr(t){return typeof t=="number"&&(t=Math.trunc(t)),t=Z(t),Number(t/Z(1e6))}function gt(t){return function(){for(var e=[],r=0;rR.rights.base||(R.rights.inheriting|k)>R.rights.inheriting?63:(R.rights.base=C,R.rights.inheriting=k,0)}),fd_filestat_get:gt(function(R,C){R=n(R,Ue);var k=w.fstatSync(R.real);return s.refreshMemory(),s.view.setBigUint64(C,Z(k.dev),!0),C+=8,s.view.setBigUint64(C,Z(k.ino),!0),C+=8,s.view.setUint8(C,R.filetype),C+=8,s.view.setBigUint64(C,Z(k.nlink),!0),C+=8,s.view.setBigUint64(C,Z(k.size),!0),C+=8,s.view.setBigUint64(C,Qe(k.atimeMs),!0),C+=8,s.view.setBigUint64(C,Qe(k.mtimeMs),!0),s.view.setBigUint64(C+8,Qe(k.ctimeMs),!0),0}),fd_filestat_set_size:gt(function(R,C){return R=n(R,En),w.ftruncateSync(R.real,Number(C)),0}),fd_filestat_set_times:gt(function(R,C,k,$){R=n(R,mn);var j=w.fstatSync(R.real),J=j.atime;j=j.mtime;var rt=dr(r(0));return($&3)===3||($&12)===12?28:(($&1)===1?J=dr(C):($&2)===2&&(J=rt),($&4)===4?j=dr(k):($&8)===8&&(j=rt),w.futimesSync(R.real,new Date(J),new Date(j)),0)}),fd_prestat_get:gt(function(R,C){return R=n(R,Z(0)),R.path?(s.refreshMemory(),s.view.setUint8(C,0),s.view.setUint32(C+4,vt.byteLength(R.fakePath),!0),0):28}),fd_prestat_dir_name:gt(function(R,C,k){return R=n(R,Z(0)),R.path?(s.refreshMemory(),vt.from(s.memory.buffer).write(R.fakePath,C,k,"utf8"),0):28}),fd_pwrite:gt(function(R,C,k,$,j){var J=n(R,We|pr),rt=0;return i(C,k).forEach(function(ot){for(var it=0;itk||(s.view.setBigUint64(C,Z($+1),!0),C+=8,C-rt>k))break;var ut=w.statSync(I.resolve(R.path,ot.name));if(s.view.setBigUint64(C,Z(ut.ino),!0),C+=8,C-rt>k||(s.view.setUint32(C,it,!0),C+=4,C-rt>k))break;switch(!0){case ut.isBlockDevice():ut=1;break;case ut.isCharacterDevice():ut=2;break;case ut.isDirectory():ut=3;break;case ut.isFIFO():ut=6;break;case ut.isFile():ut=4;break;case ut.isSocket():ut=6;break;case ut.isSymbolicLink():ut=7;break;default:ut=0}if(s.view.setUint8(C,ut),C+=1,C+=3,C+it>=rt+k)break;vt.from(s.memory.buffer).write(ot.name,C),C+=it}return s.view.setUint32(j,Math.min(C-rt,k),!0),0}),fd_renumber:gt(function(R,C){return n(R,Z(0)),n(C,Z(0)),w.closeSync(s.FD_MAP.get(R).real),s.FD_MAP.set(R,s.FD_MAP.get(C)),s.FD_MAP.delete(C),0}),fd_seek:gt(function(R,C,k,$){switch(R=n(R,pr),s.refreshMemory(),k){case 1:R.offset=(R.offset?R.offset:Z(0))+Z(C);break;case 2:k=w.fstatSync(R.real).size,R.offset=Z(k)+Z(C);break;case 0:R.offset=Z(C)}return s.view.setBigUint64($,R.offset,!0),0}),fd_tell:gt(function(R,C){return R=n(R,Jn),s.refreshMemory(),R.offset||(R.offset=Z(0)),s.view.setBigUint64(C,R.offset,!0),0}),fd_sync:gt(function(R){return R=n(R,Ce),w.fsyncSync(R.real),0}),path_create_directory:gt(function(R,C,k){return R=n(R,Zn),R.path?(s.refreshMemory(),C=vt.from(s.memory.buffer,C,k).toString(),w.mkdirSync(I.resolve(R.path,C)),0):28}),path_filestat_get:gt(function(R,C,k,$,j){return R=n(R,ii),R.path?(s.refreshMemory(),k=vt.from(s.memory.buffer,k,$).toString(),k=w.statSync(I.resolve(R.path,k)),s.view.setBigUint64(j,Z(k.dev),!0),j+=8,s.view.setBigUint64(j,Z(k.ino),!0),j+=8,s.view.setUint8(j,zo(s,void 0,k).filetype),j+=8,s.view.setBigUint64(j,Z(k.nlink),!0),j+=8,s.view.setBigUint64(j,Z(k.size),!0),j+=8,s.view.setBigUint64(j,Qe(k.atimeMs),!0),j+=8,s.view.setBigUint64(j,Qe(k.mtimeMs),!0),s.view.setBigUint64(j+8,Qe(k.ctimeMs),!0),0):28}),path_filestat_set_times:gt(function(R,C,k,$,j,J,rt){if(R=n(R,si),!R.path)return 28;s.refreshMemory();var ot=w.fstatSync(R.real);C=ot.atime,ot=ot.mtime;var it=dr(r(0));return(rt&3)===3||(rt&12)===12?28:((rt&1)===1?C=dr(j):(rt&2)===2&&(C=it),(rt&4)===4?ot=dr(J):(rt&8)===8&&(ot=it),k=vt.from(s.memory.buffer,k,$).toString(),w.utimesSync(I.resolve(R.path,k),new Date(C),new Date(ot)),0)}),path_link:gt(function(R,C,k,$,j,J,rt){return R=n(R,bn),j=n(j,ti),!R.path||!j.path?28:(s.refreshMemory(),k=vt.from(s.memory.buffer,k,$).toString(),J=vt.from(s.memory.buffer,J,rt).toString(),w.linkSync(I.resolve(R.path,k),I.resolve(j.path,J)),0)}),path_open:gt(function(R,C,k,$,j,J,rt,ot,it){C=n(R,gn),J=Z(J),rt=Z(rt),R=(J&(Le|dn))!==Z(0);var ut=(J&(Je|We|yn|En))!==Z(0);if(ut&&R)var ft=w.constants.O_RDWR;else R?ft=w.constants.O_RDONLY:ut&&(ft=w.constants.O_WRONLY);if(R=J|gn,J|=rt,j&1&&(ft|=w.constants.O_CREAT,R|=Qn),j&2&&(ft|=w.constants.O_DIRECTORY),j&4&&(ft|=w.constants.O_EXCL),j&8&&(ft|=w.constants.O_TRUNC,R|=oi),ot&1&&(ft|=w.constants.O_APPEND),ot&2&&(ft=w.constants.O_DSYNC?ft|w.constants.O_DSYNC:ft|w.constants.O_SYNC,J|=Je),ot&4&&(ft|=w.constants.O_NONBLOCK),ot&8&&(ft=w.constants.O_RSYNC?ft|w.constants.O_RSYNC:ft|w.constants.O_SYNC,J|=Ce),ot&16&&(ft|=w.constants.O_SYNC,J|=Ce),ut&&!(ft&(w.constants.O_APPEND|w.constants.O_TRUNC))&&(J|=pr),s.refreshMemory(),k=vt.from(s.memory.buffer,k,$).toString(),k=I.resolve(C.path,k),I.relative(C.path,k).startsWith(".."))return 76;try{var at=w.realpathSync(k);if(I.relative(C.path,at).startsWith(".."))return 76}catch(N){if(N.code==="ENOENT")at=k;else throw N}try{var U=w.statSync(at).isDirectory()}catch{}return ft=!ut&&U?w.openSync(at,w.constants.O_RDONLY):w.openSync(at,ft),U=nn(s.FD_MAP.keys()).reverse()[0]+1,s.FD_MAP.set(U,{real:ft,filetype:void 0,rights:{base:R,inheriting:J},path:at}),Ko(s,U),s.view.setUint32(it,U,!0),0}),path_readlink:gt(function(R,C,k,$,j,J){return R=n(R,ei),R.path?(s.refreshMemory(),C=vt.from(s.memory.buffer,C,k).toString(),C=I.resolve(R.path,C),C=w.readlinkSync(C),$=vt.from(s.memory.buffer).write(C,$,j),s.view.setUint32(J,$,!0),0):28}),path_remove_directory:gt(function(R,C,k){return R=n(R,fi),R.path?(s.refreshMemory(),C=vt.from(s.memory.buffer,C,k).toString(),w.rmdirSync(I.resolve(R.path,C)),0):28}),path_rename:gt(function(R,C,k,$,j,J){return R=n(R,ri),$=n($,ni),!R.path||!$.path?28:(s.refreshMemory(),C=vt.from(s.memory.buffer,C,k).toString(),j=vt.from(s.memory.buffer,j,J).toString(),w.renameSync(I.resolve(R.path,C),I.resolve($.path,j)),0)}),path_symlink:gt(function(R,C,k,$,j){return k=n(k,ui),k.path?(s.refreshMemory(),R=vt.from(s.memory.buffer,R,C).toString(),$=vt.from(s.memory.buffer,$,j).toString(),w.symlinkSync(R,I.resolve(k.path,$)),0):28}),path_unlink_file:gt(function(R,C,k){return R=n(R,hi),R.path?(s.refreshMemory(),C=vt.from(s.memory.buffer,C,k).toString(),w.unlinkSync(I.resolve(R.path,C)),0):28}),poll_oneoff:function(R,C,k,$){var j=0,J=0;s.refreshMemory();for(var rt=0;rtJ?it:J),s.view.setBigUint64(C,ot,!0),C+=8,s.view.setUint16(C,ft,!0),C+=2,s.view.setUint8(C,0),C+=1,C+=5,j+=1;break;case 1:case 2:R+=3,s.view.getUint32(R,!0),R+=4,s.view.setBigUint64(C,ot,!0),C+=8,s.view.setUint16(C,52,!0),C+=2,s.view.setUint8(C,it),C+=1,C+=5,j+=1;break;default:return 28}}for(s.view.setUint32($,j,!0);E.hrtime() "+j),j}catch(J){throw console.log("Catched error: "+J),J}}})}return t.prototype.refreshMemory=function(){this.view&&this.view.buffer.byteLength!==0||(this.view=new on(this.memory.buffer))},t.prototype.setMemory=function(e){this.memory=e},t.prototype.start=function(e){if(e=e.exports,e===null||typeof e!="object")throw Error("instance.exports must be an Object. Received "+e+".");var r=e.memory;if(!(r instanceof WebAssembly.Memory))throw Error("instance.exports.memory must be a WebAssembly.Memory. Recceived "+r+".");this.setMemory(r),e._start&&e._start()},t.prototype.getImportNamespace=function(e){var r,n=null;try{for(var i=en(WebAssembly.Module.imports(e)),o=i.next();!o.done;o=i.next()){var s=o.value;if(s.kind==="function"&&s.module.startsWith("wasi_")){if(!n)n=s.module;else if(n!==s.module)throw Error("Multiple namespaces detected.")}}}catch(m){var u={error:m}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(u)throw u.error}}return n},t.prototype.getImports=function(e){switch(this.getImportNamespace(e)){case"wasi_unstable":return{wasi_unstable:this.wasiImport};case"wasi_snapshot_preview1":return{wasi_snapshot_preview1:this.wasiImport};default:throw Error("Can't detect a WASI namespace for the WebAssembly Module")}},t.defaultBindings=Go,t}();function Pf(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(g){try{m(n.next(g))}catch(E){o(E)}}function u(g){try{m(n.throw(g))}catch(E){o(E)}}function m(g){g.done?i(g.value):new r(function(E){E(g.value)}).then(s,u)}m((n=n.apply(t,e||[])).next())})}function Mf(t,e){function r(g){return function(E){return n([g,E])}}function n(g){if(o)throw new TypeError("Generator is already executing.");for(;i;)try{if(o=1,s&&(u=g[0]&2?s.return:g[0]?s.throw||((u=s.return)&&u.call(s),0):s.next)&&!(u=u.call(s,g[1])).done)return u;switch(s=0,u&&(g=[g[0]&2,u.value]),g[0]){case 0:case 1:u=g;break;case 4:return i.label++,{value:g[1],done:!1};case 5:i.label++,s=g[1],g=[0];continue;case 7:g=i.ops.pop(),i.trys.pop();continue;default:if(u=i.trys,!(u=0u[0]&&g[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function kf(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;t=r.call(t);var n,i=[];try{for(;(e===void 0||0t;++t)_e[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t],bt["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(t)]=t;bt[45]=62,bt[95]=63}function Yf(t,e,r){for(var n=[],i=e;i>18&63]+_e[e>>12&63]+_e[e>>6&63]+_e[e&63]);return n.join("")}function Xo(t){pi||qo();for(var e=t.length,r=e%3,n="",i=[],o=0,s=e-r;os?s:o+16383));return r===1?(t=t[e-1],n+=_e[t>>2],n+=_e[t<<4&63],n+="=="):r===2&&(t=(t[e-2]<<8)+t[e-1],n+=_e[t>>10],n+=_e[t>>4&63],n+=_e[t<<2&63],n+="="),i.push(n),i.join("")}function Sn(t,e,r,n,i){var o=8*i-n-1,s=(1<>1,m=-7;i=r?i-1:0;var g=r?-1:1,E=t[e+i];for(i+=g,r=E&(1<<-m)-1,E>>=-m,m+=o;0>=-m,m+=n;0>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;o=n?0:o-1;var w=n?1:-1,I=0>e||e===0&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(e=isNaN(e)?1:0,n=m):(n=Math.floor(Math.log(e)/Math.LN2),1>e*(s=Math.pow(2,-n))&&(n--,s*=2),e=1<=n+g?e+E/s:e+E*Math.pow(2,1-g),2<=e*s&&(n++,s/=2),n+g>=m?(e=0,n=m):1<=n+g?(e=(e*s-1)*Math.pow(2,i),n+=g):(e=e*Math.pow(2,g-1)*Math.pow(2,i),n=0));8<=i;t[r+o]=e&255,o+=w,e/=256,i-=8);for(n=n<r||e.byteLengtht)throw new RangeError('"size" argument must not be negative')}H.alloc=function(t,e,r){return Qo(t),t=0>=t?Te(null,t):e!==void 0?typeof r=="string"?Te(null,t).fill(e,r):Te(null,t).fill(e):Te(null,t),t};function _i(t,e){if(Qo(e),t=Te(t,0>e?0:gi(e)|0),!H.TYPED_ARRAY_SUPPORT)for(var r=0;re.length?0:gi(e.length)|0;t=Te(t,r);for(var n=0;n=(H.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(H.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return t|0}H.isBuffer=ve;function ye(t){return!(t==null||!t._isBuffer)}H.compare=function(t,e){if(!ye(t)||!ye(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i>>1;case"base64":return os(t).length;default:if(n)return vn(t).length;e=(""+e).toLowerCase(),n=!0}}H.byteLength=bo;function Kf(t,e,r){var n=!1;if((e===void 0||0>e)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),0>=r)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":for(t=e,e=r,r=this.length,(!t||0>t)&&(t=0),(!e||0>e||e>r)&&(e=r),n="",r=t;rn?"0"+n.toString(16):n.toString(16),n=t+n;return n;case"utf8":case"utf-8":return rs(this,e,r);case"ascii":for(t="",r=Math.min(this.length,r);e"},H.prototype.compare=function(t,e,r,n,i){if(!ye(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),n===void 0&&(n=0),i===void 0&&(i=this.length),0>e||r>t.length||0>n||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;var o=i-n,s=r-e,u=Math.min(o,s);for(n=this.slice(n,i),t=t.slice(e,r),e=0;er&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),0>r&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(0>r)if(i)r=0;else return-1;if(typeof e=="string"&&(e=H.from(e,n)),ye(e))return e.length===0?-1:es(t,e,r,n,i);if(typeof e=="number")return e&=255,H.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):es(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function es(t,e,r,n,i){function o(g,E){return s===1?g[E]:g.readUInt16BE(E*s)}var s=1,u=t.length,m=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(2>t.length||2>e.length)return-1;s=2,u/=2,m/=2,r/=2}if(i)for(n=-1;ru&&(r=u-m);0<=r;r--){for(u=!0,n=0;ni)&&(r=i),0r||0>e)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");for(n||(n="utf8"),i=!1;;)switch(n){case"hex":t:{if(e=Number(e)||0,n=this.length-e,r?(r=Number(r),r>n&&(r=n)):r=n,n=t.length,n%2!==0)throw new TypeError("Invalid hex string");for(r>n/2&&(r=n/2),n=0;n(i-=2));++s){var u=n.charCodeAt(s);t=u>>8,u%=256,o.push(u),o.push(t)}return Pr(o,this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},H.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rs(t,e,r){r=Math.min(t.length,r);for(var n=[];ei&&(o=i);break;case 2:var u=t[e+1];(u&192)===128&&(i=(i&31)<<6|u&63,127i||57343i&&(o=i))}o===null?(o=65533,s=1):65535>>10&1023|55296),o=56320|o&1023),n.push(o),e+=s}if(t=n.length,t<=ns)n=String.fromCharCode.apply(String,n);else{for(r="",e=0;et?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),et)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}H.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||Ut(t,e,this.length),r=this[t];for(var n=1,i=0;++i=128*n&&(r-=Math.pow(2,8*e)),r},H.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||Ut(t,e,this.length),r=e;for(var n=1,i=this[t+--r];0=128*n&&(i-=Math.pow(2,8*e)),i},H.prototype.readInt8=function(t,e){return e||Ut(t,1,this.length),this[t]&128?-1*(255-this[t]+1):this[t]},H.prototype.readInt16LE=function(t,e){return e||Ut(t,2,this.length),t=this[t]|this[t+1]<<8,t&32768?t|4294901760:t},H.prototype.readInt16BE=function(t,e){return e||Ut(t,2,this.length),t=this[t+1]|this[t]<<8,t&32768?t|4294901760:t},H.prototype.readInt32LE=function(t,e){return e||Ut(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},H.prototype.readInt32BE=function(t,e){return e||Ut(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},H.prototype.readFloatLE=function(t,e){return e||Ut(t,4,this.length),Sn(this,t,!0,23,4)},H.prototype.readFloatBE=function(t,e){return e||Ut(t,4,this.length),Sn(this,t,!1,23,4)},H.prototype.readDoubleLE=function(t,e){return e||Ut(t,8,this.length),Sn(this,t,!0,52,8)},H.prototype.readDoubleBE=function(t,e){return e||Ut(t,8,this.length),Sn(this,t,!1,52,8)};function jt(t,e,r,n,i,o){if(!ye(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}H.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||jt(this,t,e,r,Math.pow(2,8*r)-1,0),n=1;var i=0;for(this[e]=t&255;++ie&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}H.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,2,65535,0),H.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):wn(this,t,e,!0),e+2},H.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,2,65535,0),H.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):wn(this,t,e,!1),e+2};function An(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}H.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,4,4294967295,0),H.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):An(this,t,e,!0),e+4},H.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,4,4294967295,0),H.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):An(this,t,e,!1),e+4},H.prototype.writeIntLE=function(t,e,r,n){t=+t,e|=0,n||(n=Math.pow(2,8*r-1),jt(this,t,e,r,n-1,-n)),n=0;var i=1,o=0;for(this[e]=t&255;++nt&&o===0&&this[e+n-1]!==0&&(o=1),this[e+n]=(t/i>>0)-o&255;return e+r},H.prototype.writeIntBE=function(t,e,r,n){t=+t,e|=0,n||(n=Math.pow(2,8*r-1),jt(this,t,e,r,n-1,-n)),n=r-1;var i=1,o=0;for(this[e+n]=t&255;0<=--n&&(i*=256);)0>t&&o===0&&this[e+n+1]!==0&&(o=1),this[e+n]=(t/i>>0)-o&255;return e+r},H.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,1,127,-128),H.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=t&255,e+1},H.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,2,32767,-32768),H.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):wn(this,t,e,!0),e+2},H.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,2,32767,-32768),H.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):wn(this,t,e,!1),e+2},H.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,4,2147483647,-2147483648),H.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):An(this,t,e,!0),e+4},H.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||jt(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),H.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):An(this,t,e,!1),e+4};function Tn(t,e,r,n){if(r+n>t.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}H.prototype.writeFloatLE=function(t,e,r){return r||Tn(this,t,e,4),In(this,t,e,!0,23,4),e+4},H.prototype.writeFloatBE=function(t,e,r){return r||Tn(this,t,e,4),In(this,t,e,!1,23,4),e+4},H.prototype.writeDoubleLE=function(t,e,r){return r||Tn(this,t,e,8),In(this,t,e,!0,52,8),e+8},H.prototype.writeDoubleBE=function(t,e,r){return r||Tn(this,t,e,8),In(this,t,e,!1,52,8),e+8},H.prototype.copy=function(t,e,r,n){if(r||(r=0),n||n===0||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),0e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-ei||!H.TYPED_ARRAY_SUPPORT)for(n=0;ni&&(t=i)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!H.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof t=="number"&&(t&=255);if(0>e||this.length>>=0,r=r===void 0?this.length:r>>>0,t||(t=0),typeof t=="number")for(n=e;nr){if(!i){if(56319r){-1<(e-=3)&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&-1<(e-=3)&&o.push(239,191,189);if(i=null,128>r){if(0>--e)break;o.push(r)}else if(2048>r){if(0>(e-=2))break;o.push(r>>6|192,r&63|128)}else if(65536>r){if(0>(e-=3))break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(1114112>r){if(0>(e-=4))break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw Error("Invalid code point")}return o}function is(t){for(var e=[],r=0;rt.length)t="";else for(;t.length%4!==0;)t+="=";pi||qo();var e=t.length;if(0>16&255,n[o++]=s>>8&255,n[o++]=s&255}return r===2?(s=bt[t.charCodeAt(e)]<<2|bt[t.charCodeAt(e+1)]>>4,n[o++]=s&255):r===1&&(s=bt[t.charCodeAt(e)]<<10|bt[t.charCodeAt(e+1)]<<4|bt[t.charCodeAt(e+2)]>>2,n[o++]=s>>8&255,n[o++]=s&255),n}function Pr(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function ve(t){return t!=null&&(!!t._isBuffer||ss(t)||typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ss(t.slice(0,0)))}function ss(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var Mr=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:$f,Buffer:H,SlowBuffer:function(t){return+t!=t&&(t=0),H.alloc(+t)},isBuffer:ve}),Tt=Mt(function(t,e){function r(i){for(var o=[],s=1;se&&(r--,e+=1e9)),[r,e]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Zf)/1e3}},Me=typeof Object.create=="function"?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){function r(){}t.super_=e,r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},Qf=/%[sdj%]/g;function di(t){if(!nr(t)){for(var e=[],r=0;r=i)return s;switch(s){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return s}});for(var o=n[r];rr?wr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),i=s?nh(t,e,r,o,i):i.map(function(m){return Ii(t,e,r,o,m,s)}),t.seen.pop(),ih(i,n,u))}function rh(t,e){if(Oe(e))return t.stylize("undefined","undefined");if(nr(e))return e="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",t.stylize(e,"string");if(_s(e))return t.stylize(""+e,"number");if(wi(e))return t.stylize(""+e,"boolean");if(e===null)return t.stylize("null","null")}function Si(t){return"["+Error.prototype.toString.call(t)+"]"}function nh(t,e,r,n,i){for(var o=[],s=0,u=e.length;st.seen.indexOf(e.value)?(u=r===null?Bn(t,e.value,null):Bn(t,e.value,r-1),-1"u"}function Ti(t){return 10>t?"0"+t.toString(10):t.toString(10)}var oh="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");function sh(){var t=new Date,e=[Ti(t.getHours()),Ti(t.getMinutes()),Ti(t.getSeconds())].join(":");return[t.getDate(),oh[t.getMonth()],e].join(" ")}function ys(t,e){if(!e||!ke(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}var xr={inherits:Me,_extend:ys,log:function(){console.log("%s - %s",sh(),di.apply(null,arguments))},isBuffer:function(t){return ve(t)},isPrimitive:Ai,isFunction:Ar,isError:Gr,isDate:kr,isObject:ke,isRegExp:wr,isUndefined:Oe,isSymbol:function(t){return typeof t=="symbol"},isString:nr,isNumber:_s,isNullOrUndefined:function(t){return t==null},isNull:function(t){return t===null},isBoolean:wi,isArray:ps,inspect:ge,deprecate:Ei,format:di,debuglog:as};function gs(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i"u"?"_kCode":Symbol("code"),m={};t=function(g){function E(w){if(typeof w!="object"||w===null)throw new e.TypeError("ERR_INVALID_ARG_TYPE","options","object");var I=w.message?g.call(this,w.message)||this:g.call(this,xr.inspect(w.actual).slice(0,128)+" "+(w.operator+" "+xr.inspect(w.expected).slice(0,128)))||this;return I.generatedMessage=!w.message,I.name="AssertionError [ERR_ASSERTION]",I.code="ERR_ASSERTION",I.actual=w.actual,I.expected=w.expected,I.operator=w.operator,e.Error.captureStackTrace(I,w.stackStartFunction),I}return s(E,g),E}(Lt.Error),e.AssertionError=t,e.message=n,e.E=i,e.Error=r(Lt.Error),e.TypeError=r(Lt.TypeError),e.RangeError=r(Lt.RangeError),i("ERR_ARG_NOT_ITERABLE","%s must be iterable"),i("ERR_ASSERTION","%s"),i("ERR_BUFFER_OUT_OF_BOUNDS",function(g,E){return E?"Attempt to write outside buffer bounds":'"'+g+'" is outside of buffer bounds'}),i("ERR_CHILD_CLOSED_BEFORE_REPLY","Child closed before reply received"),i("ERR_CONSOLE_WRITABLE_STREAM","Console expects a writable stream instance for %s"),i("ERR_CPU_USAGE","Unable to obtain cpu usage %s"),i("ERR_DNS_SET_SERVERS_FAILED",function(g,E){return'c-ares failed to set servers: "'+g+'" ['+E+"]"}),i("ERR_FALSY_VALUE_REJECTION","Promise was rejected with falsy value"),i("ERR_ENCODING_NOT_SUPPORTED",function(g){return'The "'+g+'" encoding is not supported'}),i("ERR_ENCODING_INVALID_ENCODED_DATA",function(g){return"The encoded data was not valid for encoding "+g}),i("ERR_HTTP_HEADERS_SENT","Cannot render headers after they are sent to the client"),i("ERR_HTTP_INVALID_STATUS_CODE","Invalid status code: %s"),i("ERR_HTTP_TRAILER_INVALID","Trailers are invalid with this transfer encoding"),i("ERR_INDEX_OUT_OF_RANGE","Index out of range"),i("ERR_INVALID_ARG_TYPE",function(g,E,w){if(Rt(g,"name is required"),E.includes("not ")){var I="must not be";E=E.split("not ")[1]}else I="must be";if(Array.isArray(g))I="The "+g.map(function(L){return'"'+L+'"'}).join(", ")+" arguments "+I+" "+o(E,"type");else if(g.includes(" argument"))I="The "+g+" "+I+" "+o(E,"type");else{var S=g.includes(".")?"property":"argument";I='The "'+g+'" '+S+" "+I+" "+o(E,"type")}return 3<=arguments.length&&(I+=". Received type "+(w!==null?typeof w:"null")),I}),i("ERR_INVALID_ARRAY_LENGTH",function(g,E,w){return Rt.strictEqual(typeof w,"number"),'The array "'+g+'" (length '+w+") must be of length "+E+"."}),i("ERR_INVALID_BUFFER_SIZE","Buffer size must be a multiple of %s"),i("ERR_INVALID_CALLBACK","Callback must be a function"),i("ERR_INVALID_CHAR","Invalid character in %s"),i("ERR_INVALID_CURSOR_POS","Cannot set cursor row without setting its column"),i("ERR_INVALID_FD",'"fd" must be a positive integer: %s'),i("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s'),i("ERR_INVALID_FILE_URL_PATH","File URL path %s"),i("ERR_INVALID_HANDLE_TYPE","This handle type cannot be sent"),i("ERR_INVALID_IP_ADDRESS","Invalid IP address: %s"),i("ERR_INVALID_OPT_VALUE",function(g,E){return'The value "'+String(E)+'" is invalid for option "'+g+'"'}),i("ERR_INVALID_OPT_VALUE_ENCODING",function(g){return'The value "'+String(g)+'" is invalid for option "encoding"'}),i("ERR_INVALID_REPL_EVAL_CONFIG",'Cannot specify both "breakEvalOnSigint" and "eval" for REPL'),i("ERR_INVALID_SYNC_FORK_INPUT","Asynchronous forks do not support Buffer, Uint8Array or string input: %s"),i("ERR_INVALID_THIS",'Value of "this" must be of type %s'),i("ERR_INVALID_TUPLE","%s must be an iterable %s tuple"),i("ERR_INVALID_URL","Invalid URL: %s"),i("ERR_INVALID_URL_SCHEME",function(g){return"The URL must be "+o(g,"scheme")}),i("ERR_IPC_CHANNEL_CLOSED","Channel closed"),i("ERR_IPC_DISCONNECTED","IPC channel is already disconnected"),i("ERR_IPC_ONE_PIPE","Child process can have only one IPC pipe"),i("ERR_IPC_SYNC_FORK","IPC cannot be used with synchronous forks"),i("ERR_MISSING_ARGS",function(){for(var g=[],E=0;E 0 and < 65536"),i("ERR_SOCKET_BAD_TYPE","Bad socket type specified. Valid types are: udp4, udp6"),i("ERR_SOCKET_CANNOT_SEND","Unable to send data"),i("ERR_SOCKET_CLOSED","Socket is closed"),i("ERR_SOCKET_DGRAM_NOT_RUNNING","Not running"),i("ERR_STDERR_CLOSE","process.stderr cannot be closed"),i("ERR_STDOUT_CLOSE","process.stdout cannot be closed"),i("ERR_STREAM_WRAP","Stream has StringDecoder set or is in objectMode"),i("ERR_TLS_CERT_ALTNAME_INVALID","Hostname/IP does not match certificate's altnames: %s"),i("ERR_TLS_DH_PARAM_SIZE",function(g){return"DH parameter size "+g+" is less than 2048"}),i("ERR_TLS_HANDSHAKE_TIMEOUT","TLS handshake timeout"),i("ERR_TLS_RENEGOTIATION_FAILED","Failed to renegotiate"),i("ERR_TLS_REQUIRED_SERVER_NAME",'"servername" is required parameter for Server.addContext'),i("ERR_TLS_SESSION_ATTACK","TSL session renegotiation attack detected"),i("ERR_TRANSFORM_ALREADY_TRANSFORMING","Calling transform done when still transforming"),i("ERR_TRANSFORM_WITH_LENGTH_0","Calling transform done when writableState.length != 0"),i("ERR_UNKNOWN_ENCODING","Unknown encoding: %s"),i("ERR_UNKNOWN_SIGNAL","Unknown signal: %s"),i("ERR_UNKNOWN_STDIN_TYPE","Unknown stdin file type"),i("ERR_UNKNOWN_STREAM_TYPE","Unknown stream file type"),i("ERR_V8BREAKITERATOR","Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl")});xt(Hr);var te=Mt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ENCODING_UTF8="utf8",e.assertEncoding=function(r){if(r&&!Tt.Buffer.isEncoding(r))throw new Hr.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",r)},e.strToEncoding=function(r,n){return n&&n!==e.ENCODING_UTF8?n==="buffer"?new Tt.Buffer(r):new Tt.Buffer(r).toString(n):r}});xt(te);var Bi=Mt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var r=lt.constants.S_IFMT,n=lt.constants.S_IFDIR,i=lt.constants.S_IFREG,o=lt.constants.S_IFBLK,s=lt.constants.S_IFCHR,u=lt.constants.S_IFLNK,m=lt.constants.S_IFIFO,g=lt.constants.S_IFSOCK;t=function(){function E(){this.name="",this.mode=0}return E.build=function(w,I){var S=new E,L=w.getNode().mode;return S.name=te.strToEncoding(w.getName(),I),S.mode=L,S},E.prototype._checkModeProperty=function(w){return(this.mode&r)===w},E.prototype.isDirectory=function(){return this._checkModeProperty(n)},E.prototype.isFile=function(){return this._checkModeProperty(i)},E.prototype.isBlockDevice=function(){return this._checkModeProperty(o)},E.prototype.isCharacterDevice=function(){return this._checkModeProperty(s)},E.prototype.isSymbolicLink=function(){return this._checkModeProperty(u)},E.prototype.isFIFO=function(){return this._checkModeProperty(m)},E.prototype.isSocket=function(){return this._checkModeProperty(g)},E}(),e.Dirent=t,e.default=t});xt(Bi);function Ds(t,e){for(var r=0,n=t.length-1;0<=n;n--){var i=t[n];i==="."?t.splice(n,1):i===".."?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}var Ni=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;function Fi(){for(var t="",e=!1,r=arguments.length-1;-1<=r&&!e;r--){var n=0<=r?arguments[r]:"/";if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");n&&(t=n+"/"+t,e=n.charAt(0)==="/")}return t=Ds(Wi(t.split("/"),function(i){return!!i}),!e).join("/"),(e?"/":"")+t||"."}function Ps(t){var e=Ms(t),r=ph(t,-1)==="/";return(t=Ds(Wi(t.split("/"),function(n){return!!n}),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t}function Ms(t){return t.charAt(0)==="/"}function Li(t,e){function r(s){for(var u=0;um?[]:s.slice(u,m-u+1)}t=Fi(t).substr(1),e=Fi(e).substr(1),t=r(t.split("/")),e=r(e.split("/"));for(var n=Math.min(t.length,e.length),i=n,o=0;oe&&(e=t.length+e),t.substr(e,r)},vr=Mt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),t=typeof setImmediate=="function"?setImmediate.bind(Lt):setTimeout.bind(Lt),e.default=t});xt(vr);var Ht=Mt(function(t,e){function r(){var n=Ir||{};return n.getuid||(n.getuid=function(){return 0}),n.getgid||(n.getgid=function(){return 0}),n.cwd||(n.cwd=function(){return"/"}),n.nextTick||(n.nextTick=vr.default),n.emitWarning||(n.emitWarning=function(i,o){console.warn(""+o+(o?": ":"")+i)}),n.env||(n.env={}),n}Object.defineProperty(e,"__esModule",{value:!0}),e.createProcess=r,e.default=r()});xt(Ht);function Ge(){}Ge.prototype=Object.create(null);function ct(){ct.init.call(this)}ct.EventEmitter=ct,ct.usingDomains=!1,ct.prototype.domain=void 0,ct.prototype._events=void 0,ct.prototype._maxListeners=void 0,ct.defaultMaxListeners=10,ct.init=function(){this.domain=null,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Ge,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ct.prototype.setMaxListeners=function(t){if(typeof t!="number"||0>t||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},ct.prototype.getMaxListeners=function(){return this._maxListeners===void 0?ct.defaultMaxListeners:this._maxListeners},ct.prototype.emit=function(t){var e,r,n=t==="error";if(e=this._events)n=n&&e.error==null;else if(!n)return!1;var i=this.domain;if(n){if(e=arguments[1],i)e||(e=Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=i,e.domainThrown=!1,i.emit("error",e);else throw e instanceof Error?e:(i=Error('Uncaught, unspecified "error" event. ('+e+")"),i.context=e,i);return!1}if(i=e[t],!i)return!1;e=typeof i=="function";var o=arguments.length;switch(o){case 1:if(e)i.call(this);else for(e=i.length,i=Yr(i,e),n=0;nr&&(o.warned=!0,r=Error("Possible EventEmitter memory leak detected. "+o.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit"),r.name="MaxListenersExceededWarning",r.emitter=t,r.type=e,r.count=o.length,typeof console.warn=="function"?console.warn(r):console.log(r))):(i[e]=r,++t._eventsCount),t}ct.prototype.addListener=function(t,e){return ks(this,t,e,!1)},ct.prototype.on=ct.prototype.addListener,ct.prototype.prependListener=function(t,e){return ks(this,t,e,!0)};function Gs(t,e,r){function n(){t.removeListener(e,n),i||(i=!0,r.apply(t,arguments))}var i=!1;return n.listener=r,n}ct.prototype.once=function(t,e){if(typeof e!="function")throw new TypeError('"listener" argument must be a function');return this.on(t,Gs(this,t,e)),this},ct.prototype.prependOnceListener=function(t,e){if(typeof e!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(t,Gs(this,t,e)),this},ct.prototype.removeListener=function(t,e){var r;if(typeof e!="function")throw new TypeError('"listener" argument must be a function');var n=this._events;if(!n)return this;var i=n[t];if(!i)return this;if(i===e||i.listener&&i.listener===e)--this._eventsCount===0?this._events=new Ge:(delete n[t],n.removeListener&&this.emit("removeListener",t,i.listener||e));else if(typeof i!="function"){var o=-1;for(r=i.length;0o)return this;if(i.length===1){if(i[0]=void 0,--this._eventsCount===0)return this._events=new Ge,this;delete n[t]}else{r=o+1;for(var u=i.length;rthis.buf.length){var L=Tt.bufferAllocUnsafe(S+I);this.buf.copy(L,0,0,this.buf.length),this.buf=L}return E.copy(this.buf,S,w,w+I),this.touch(),I},g.prototype.read=function(E,w,I,S){return w===void 0&&(w=0),I===void 0&&(I=E.byteLength),S===void 0&&(S=0),this.buf||(this.buf=Tt.bufferAllocUnsafe(0)),I>E.byteLength&&(I=E.byteLength),I+S>this.buf.length&&(I=this.buf.length-S),this.buf.copy(E,w,S,S+I),I},g.prototype.truncate=function(E){if(E===void 0&&(E=0),E)if(this.buf||(this.buf=Tt.bufferAllocUnsafe(0)),E<=this.buf.length)this.buf=this.buf.slice(0,E);else{var w=Tt.bufferAllocUnsafe(0);this.buf.copy(w),w.fill(0,E)}else this.buf=Tt.bufferAllocUnsafe(0);this.touch()},g.prototype.chmod=function(E){this.perm=E,this.mode=this.mode&-512|E,this.touch()},g.prototype.chown=function(E,w){this.uid=E,this.gid=w,this.touch()},g.prototype.touch=function(){this.mtime=new Date,this.emit("change",this)},g.prototype.canRead=function(E,w){return E===void 0&&(E=Ht.default.getuid()),w===void 0&&(w=Ht.default.getgid()),!!(this.perm&4||w===this.gid&&this.perm&32||E===this.uid&&this.perm&256)},g.prototype.canWrite=function(E,w){return E===void 0&&(E=Ht.default.getuid()),w===void 0&&(w=Ht.default.getgid()),!!(this.perm&2||w===this.gid&&this.perm&16||E===this.uid&&this.perm&128)},g.prototype.del=function(){this.emit("delete",this)},g.prototype.toJSON=function(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}},g}(ct.EventEmitter),e.Node=t,t=function(m){function g(E,w,I){var S=m.call(this)||this;return S.children={},S.steps=[],S.ino=0,S.length=0,S.vol=E,S.parent=w,S.steps=w?w.steps.concat([I]):[I],S}return r(g,m),g.prototype.setNode=function(E){this.node=E,this.ino=E.ino},g.prototype.getNode=function(){return this.node},g.prototype.createChild=function(E,w){w===void 0&&(w=this.vol.createNode());var I=new g(this.vol,this,E);return I.setNode(w),w.isDirectory(),this.setChild(E,I),I},g.prototype.setChild=function(E,w){return w===void 0&&(w=new g(this.vol,this,E)),this.children[E]=w,w.parent=this,this.length++,this.emit("child:add",w,this),w},g.prototype.deleteChild=function(E){delete this.children[E.getName()],this.length--,this.emit("child:delete",E,this)},g.prototype.getChild=function(E){if(Object.hasOwnProperty.call(this.children,E))return this.children[E]},g.prototype.getPath=function(){return this.steps.join(e.SEP)},g.prototype.getName=function(){return this.steps[this.steps.length-1]},g.prototype.walk=function(E,w,I){if(w===void 0&&(w=E.length),I===void 0&&(I=0),I>=E.length||I>=w)return this;var S=this.getChild(E[I]);return S?S.walk(E,w,I+1):null},g.prototype.toJSON=function(){return{steps:this.steps,ino:this.ino,children:Object.keys(this.children)}},g}(ct.EventEmitter),e.Link=t,t=function(){function m(g,E,w,I){this.position=0,this.link=g,this.node=E,this.flags=w,this.fd=I}return m.prototype.getString=function(){return this.node.getString()},m.prototype.setString=function(g){this.node.setString(g)},m.prototype.getBuffer=function(){return this.node.getBuffer()},m.prototype.setBuffer=function(g){this.node.setBuffer(g)},m.prototype.getSize=function(){return this.node.getSize()},m.prototype.truncate=function(g){this.node.truncate(g)},m.prototype.seekTo=function(g){this.position=g},m.prototype.stats=function(){return Er.default.build(this.node)},m.prototype.write=function(g,E,w,I){return E===void 0&&(E=0),w===void 0&&(w=g.length),typeof I!="number"&&(I=this.position),this.flags&u&&(I=this.getSize()),g=this.node.write(g,E,w,I),this.position=I+g,g},m.prototype.read=function(g,E,w,I){return E===void 0&&(E=0),w===void 0&&(w=g.byteLength),typeof I!="number"&&(I=this.position),g=this.node.read(g,E,w,I),this.position=I+g,g},m.prototype.chmod=function(g){this.node.chmod(g)},m.prototype.chown=function(g,E){this.node.chown(g,E)},m}(),e.File=t});xt(jr);var _h=jr.Node,Hs=Mt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(r,n,i){var o=setTimeout.apply(null,arguments);return o&&typeof o=="object"&&typeof o.unref=="function"&&o.unref(),o}});xt(Hs);function ir(){this.tail=this.head=null,this.length=0}ir.prototype.push=function(t){t={data:t,next:null},0>>0);for(var e=this.head,r=0;e;)e.data.copy(t,r),r+=e.data.length,e=e.next;return t};var yh=H.isEncoding||function(t){switch(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 $r(t){if(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),t&&!yh(t))throw Error("Unknown encoding: "+t);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=dh;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Eh;break;default:this.write=gh;return}this.charBuffer=new H(6),this.charLength=this.charReceived=0}$r.prototype.write=function(t){for(var e="";this.charLength;){if(e=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length,t.copy(this.charBuffer,this.charReceived,0,e),this.charReceived+=e,this.charReceived=r)this.charLength+=this.surrogateSize,e="";else{if(this.charReceived=this.charLength=0,t.length===0)return e;break}}this.detectIncompleteChar(t);var n=t.length;return this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,n),n-=this.charReceived),e+=t.toString(this.encoding,0,n),n=e.length-1,r=e.charCodeAt(n),55296<=r&&56319>=r?(r=this.surrogateSize,this.charLength+=r,this.charReceived+=r,this.charBuffer.copy(this.charBuffer,r,0,r),t.copy(this.charBuffer,0,0,r),e.substring(0,n)):e},$r.prototype.detectIncompleteChar=function(t){for(var e=3<=t.length?3:t.length;0>5==6){this.charLength=2;break}if(2>=e&&r>>4==14){this.charLength=3;break}if(3>=e&&r>>3==30){this.charLength=4;break}}this.charReceived=e},$r.prototype.end=function(t){var e="";return t&&t.length&&(e=this.write(t)),this.charReceived&&(t=this.encoding,e+=this.charBuffer.slice(0,this.charReceived).toString(t)),e};function gh(t){return t.toString(this.encoding)}function dh(t){this.charLength=(this.charReceived=t.length%2)?2:0}function Eh(t){this.charLength=(this.charReceived=t.length%3)?3:0}Ot.ReadableState=Ys;var Et=as("stream");Me(Ot,ct);function mh(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}function Ys(t,e){t=t||{},this.objectMode=!!t.objectMode,e instanceof ee&&(this.objectMode=this.objectMode||!!t.readableObjectMode),e=t.highWaterMark;var r=this.objectMode?16:16384;this.highWaterMark=e||e===0?e:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new ir,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.reading=this.endEmitted=this.ended=!1,this.sync=!0,this.resumeScheduled=this.readableListening=this.emittedReadable=this.needReadable=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.encoding=this.decoder=null,t.encoding&&(this.decoder=new $r(t.encoding),this.encoding=t.encoding)}function Ot(t){if(!(this instanceof Ot))return new Ot(t);this._readableState=new Ys(t,this),this.readable=!0,t&&typeof t.read=="function"&&(this._read=t.read),ct.call(this)}Ot.prototype.push=function(t,e){var r=this._readableState;return r.objectMode||typeof t!="string"||(e=e||r.defaultEncoding,e!==r.encoding&&(t=H.from(t,e),e="")),js(this,r,t,e,!1)},Ot.prototype.unshift=function(t){return js(this,this._readableState,t,"",!0)},Ot.prototype.isPaused=function(){return this._readableState.flowing===!1};function js(t,e,r,n,i){var o=r,s=null;if(ve(o)||typeof o=="string"||o===null||o===void 0||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),o=s)t.emit("error",o);else if(r===null)e.reading=!1,e.ended||(e.decoder&&(r=e.decoder.end())&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length),e.ended=!0,Nn(t));else if(e.objectMode||r&&0=t||e.length===0&&e.ended)return 0;if(e.objectMode)return 1;if(t!==t)return e.flowing&&e.length?e.buffer.head.data.length:e.length;if(t>e.highWaterMark){var r=t;8388608<=r?r=8388608:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),e.highWaterMark=r}return t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0)}Ot.prototype.read=function(t){Et("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return Et("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Di(this):Nn(this),null;if(t=$s(t,e),t===0&&e.ended)return e.length===0&&Di(this),null;var n=e.needReadable;return Et("need readable",n),(e.length===0||e.length-t=e.length)r=e.decoder?e.buffer.join(""):e.buffer.length===1?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear();else{if(r=e.buffer,e=e.decoder,to.length?o.length:t;if(i=s===o.length?i+o:i+o.slice(0,t),t-=s,t===0){s===o.length?(++n,r.head=e.next?e.next:r.tail=null):(r.head=e,e.data=o.slice(s));break}++n}r.length-=n,r=i}else{for(e=H.allocUnsafe(t),n=r.head,i=1,n.data.copy(e),t-=n.data.length;n=n.next;){if(o=n.data,s=t>o.length?o.length:t,o.copy(e,e.length-t,0,s),t-=s,t===0){s===o.length?(++i,r.head=n.next?n.next:r.tail=null):(r.head=n,n.data=o.slice(s));break}++i}r.length-=i,r=e}e=r}r=e}return r}function Di(t){var e=t._readableState;if(0arguments.length?e:t.apply(null,[e].concat(Lh.call(arguments,2)))}},eu=Mt(function(t,e){function r(o,s,u){return u===void 0&&(u=function(m){return m}),function(){for(var m=[],g=0;g"u"?null:{FileHandle:i,access:function(s,u){return r(o,"access")(s,u)},appendFile:function(s,u,m){return r(o,"appendFile")(s instanceof i?s.fd:s,u,m)},chmod:function(s,u){return r(o,"chmod")(s,u)},chown:function(s,u,m){return r(o,"chown")(s,u,m)},copyFile:function(s,u,m){return r(o,"copyFile")(s,u,m)},lchmod:function(s,u){return r(o,"lchmod")(s,u)},lchown:function(s,u,m){return r(o,"lchown")(s,u,m)},link:function(s,u){return r(o,"link")(s,u)},lstat:function(s,u){return r(o,"lstat")(s,u)},mkdir:function(s,u){return r(o,"mkdir")(s,u)},mkdtemp:function(s,u){return r(o,"mkdtemp")(s,u)},open:function(s,u,m){return r(o,"open",function(g){return new i(o,g)})(s,u,m)},readdir:function(s,u){return r(o,"readdir")(s,u)},readFile:function(s,u){return r(o,"readFile")(s instanceof i?s.fd:s,u)},readlink:function(s,u){return r(o,"readlink")(s,u)},realpath:function(s,u){return r(o,"realpath")(s,u)},rename:function(s,u){return r(o,"rename")(s,u)},rmdir:function(s){return r(o,"rmdir")(s)},stat:function(s,u){return r(o,"stat")(s,u)},symlink:function(s,u,m){return r(o,"symlink")(s,u,m)},truncate:function(s,u){return r(o,"truncate")(s,u)},unlink:function(s){return r(o,"unlink")(s)},utimes:function(s,u,m){return r(o,"utimes")(s,u,m)},writeFile:function(s,u,m){return r(o,"writeFile")(s instanceof i?s.fd:s,u,m)}}}});xt(eu);var Wh=/[^\x20-\x7E]/,Uh=/[\x2E\u3002\uFF0E\uFF61]/g,ru={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Rr=Math.floor,xi=String.fromCharCode;function Dh(t,e){var r=t.split("@"),n="";1t)-((e!=0)<<5)}function Ph(t){return Dh(t,function(e){if(Wh.test(e)){var r,n=[],i=[],o=0;for(r=e.length;o=s&&oE&&n.push(xi(E))}for((o=r=n.length)&&n.push("-");o=i&&ERr((2147483647-m)/I))throw new RangeError(ru.overflow);for(m+=(w-i)*I,i=w,s=0;s=g+26?26:w-g,!(S>1,m+=Rr(m/g);455e&&(n=e),e=0;e"` \r\n '.split("")),Hi=["'"].concat(jh),uu=["%","/","?",";","#"].concat(Hi),fu=["/","?","#"],$h=255,hu=/^[+a-z0-9A-Z_-]{0,63}$/,Vh=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Kh={javascript:!0,"javascript:":!0},Yi={javascript:!0,"javascript:":!0},Or={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Fn(t,e,r){if(t&&ke(t)&&t instanceof Ee)return t;var n=new Ee;return n.parse(t,e,r),n}Ee.prototype.parse=function(t,e,r){return lu(this,t,e,r)};function lu(t,e,r,n){if(!nr(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?");if(i=i!==-1&&i$h?"":t.hostname.toLowerCase(),s||(t.hostname=Ph(t.hostname)),n=t.port?":"+t.port:"",t.host=(t.hostname||"")+n,t.href+=t.host,s&&(t.hostname=t.hostname.substr(1,t.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!Kh[o])for(n=0,e=Hi.length;no.length&&o.unshift(""),e.pathname=o.join("/")}return e.search=t.search,e.query=t.query,e.host=t.host||"",e.auth=t.auth,e.hostname=t.hostname||t.host,e.port=t.port,(e.pathname||e.search)&&(e.path=(e.pathname||"")+(e.search||"")),e.slashes=e.slashes||t.slashes,e.href=e.format(),e}r=e.pathname&&e.pathname.charAt(0)==="/";var s=t.host||t.pathname&&t.pathname.charAt(0)==="/",u=r=s||r||e.host&&t.pathname;if(n=e.pathname&&e.pathname.split("/")||[],i=e.protocol&&!Or[e.protocol],o=t.pathname&&t.pathname.split("/")||[],i&&(e.hostname="",e.port=null,e.host&&(n[0]===""?n[0]=e.host:n.unshift(e.host)),e.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(o[0]===""?o[0]=t.host:o.unshift(t.host)),t.host=null),r=r&&(o[0]===""||n[0]==="")),s)e.host=t.host||t.host===""?t.host:e.host,e.hostname=t.hostname||t.hostname===""?t.hostname:e.hostname,e.search=t.search,e.query=t.query,n=o;else if(o.length)n||(n=[]),n.pop(),n=n.concat(o),e.search=t.search,e.query=t.query;else if(t.search!=null)return i&&(e.hostname=e.host=n.shift(),i=e.host&&0u)u=s;else{for(;r(s,u);)u--;u=s.substr(0,u+1)}return u.replace(/^([a-zA-Z]+:|\.\/)/,"")}return o}Object.defineProperty(e,"__esModule",{value:!0}),e.unixify=n,e.correctPath=function(o){return n(o.replace(/^\\\\\?\\.:\\/,"\\"))};var i=Ir.platform==="win32"});xt(au);var or=Mt(function(t,e){function r(p,f){return f===void 0&&(f=Ht.default.cwd()),ut(f,p)}function n(p,f){return typeof p=="function"?[i(),p]:[i(p),w(f)]}function i(p){return p===void 0&&(p={}),it({},d,p)}function o(p){return typeof p=="number"?it({},ht,{mode:p}):it({},ht,p)}function s(p,f,l,y){f===void 0&&(f=""),l===void 0&&(l=""),y===void 0&&(y="");var v="";switch(l&&(v=" '"+l+"'"),y&&(v+=" -> '"+y+"'"),p){case"ENOENT":return"ENOENT: no such file or directory, "+f+v;case"EBADF":return"EBADF: bad file descriptor, "+f+v;case"EINVAL":return"EINVAL: invalid argument, "+f+v;case"EPERM":return"EPERM: operation not permitted, "+f+v;case"EPROTO":return"EPROTO: protocol error, "+f+v;case"EEXIST":return"EEXIST: file already exists, "+f+v;case"ENOTDIR":return"ENOTDIR: not a directory, "+f+v;case"EISDIR":return"EISDIR: illegal operation on a directory, "+f+v;case"EACCES":return"EACCES: permission denied, "+f+v;case"ENOTEMPTY":return"ENOTEMPTY: directory not empty, "+f+v;case"EMFILE":return"EMFILE: too many open files, "+f+v;case"ENOSYS":return"ENOSYS: function not implemented, "+f+v;default:return p+": error occurred, "+f+v}}function u(p,f,l,y,v){return f===void 0&&(f=""),l===void 0&&(l=""),y===void 0&&(y=""),v===void 0&&(v=Error),f=new v(s(p,f,l,y)),f.code=p,f}function m(p){if(typeof p=="number")return p;if(typeof p=="string"){var f=Pt[p];if(typeof f<"u")return f}throw new Hr.TypeError("ERR_INVALID_OPT_VALUE","flags",p)}function g(p,f){if(f){var l=typeof f;switch(l){case"string":p=it({},p,{encoding:f});break;case"object":p=it({},p,f);break;default:throw TypeError("Expected options to be either an object or a string, but got "+l+" instead")}}else return p;return p.encoding!=="buffer"&&te.assertEncoding(p.encoding),p}function E(p){return function(f){return g(p,f)}}function w(p){if(typeof p!="function")throw TypeError(Gt.CB);return p}function I(p){return function(f,l){return typeof f=="function"?[p(),f]:[p(f),w(l)]}}function S(p){if(typeof p!="string"&&!Tt.Buffer.isBuffer(p)){try{if(!(p instanceof Gh.URL))throw new TypeError(Gt.PATH_STR)}catch{throw new TypeError(Gt.PATH_STR)}if(p.hostname!=="")throw new Hr.TypeError("ERR_INVALID_FILE_URL_HOST",Ht.default.platform);p=p.pathname;for(var f=0;f>>0!==p)throw TypeError(Gt.FD)}function nt(p){if(typeof p=="string"&&+p==p)return+p;if(p instanceof Date)return p.getTime()/1e3;if(isFinite(p))return 0>p?Date.now()/1e3:p;throw Error("Cannot parse time: "+p)}function R(p){if(typeof p!="number")throw TypeError(Gt.UID)}function C(p){if(typeof p!="number")throw TypeError(Gt.GID)}function k(p){p.emit("stop")}function $(p,f,l){if(!(this instanceof $))return new $(p,f,l);if(this._vol=p,l=it({},g(l,{})),l.highWaterMark===void 0&&(l.highWaterMark=65536),Xt.Readable.call(this,l),this.path=S(f),this.fd=l.fd===void 0?null:l.fd,this.flags=l.flags===void 0?"r":l.flags,this.mode=l.mode===void 0?438:l.mode,this.start=l.start,this.end=l.end,this.autoClose=l.autoClose===void 0?!0:l.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}function j(){this.close()}function J(p,f,l){if(!(this instanceof J))return new J(p,f,l);if(this._vol=p,l=it({},g(l,{})),Xt.Writable.call(this,l),this.path=S(f),this.fd=l.fd===void 0?null:l.fd,this.flags=l.flags===void 0?"w":l.flags,this.mode=l.mode===void 0?438:l.mode,this.start=l.start,this.autoClose=l.autoClose===void 0?!0:!!l.autoClose,this.pos=void 0,this.bytesWritten=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(0>this.start)throw Error('"start" must be >= zero');this.pos=this.start}l.encoding&&this.setDefaultEncoding(l.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}var rt=Lt&&Lt.__extends||function(){function p(f,l){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,v){y.__proto__=v}||function(y,v){for(var D in v)v.hasOwnProperty(D)&&(y[D]=v[D])},p(f,l)}return function(f,l){function y(){this.constructor=f}p(f,l),f.prototype=l===null?Object.create(l):(y.prototype=l.prototype,new y)}}(),ot=Lt&&Lt.__spreadArrays||function(){for(var p=0,f=0,l=arguments.length;f>>0!==f)throw TypeError(Gt.FD);if(f=this.getFileByFd(f),!f)throw u("EBADF",l);return f},p.prototype.getNodeByIdOrCreate=function(f,l,y){if(typeof f=="number"){if(f=this.getFileByFd(f),!f)throw Error("File nto found");return f.node}var v=G(f),D=this.getLink(v);if(D)return D.getNode();if(l&N&&(l=this.getLinkParent(v)))return D=this.createLink(l,v[v.length-1],!1,y),D.getNode();throw u("ENOENT","getNodeByIdOrCreate",S(f))},p.prototype.wrapAsync=function(f,l,y){var v=this;w(y),vr.default(function(){try{y(null,f.apply(v,l))}catch(D){y(D)}})},p.prototype._toJSON=function(f,l,y){var v;f===void 0&&(f=this.root),l===void 0&&(l={});var D=!0,Q=f.children;f.getNode().isFile()&&(Q=(v={},v[f.getName()]=f.parent.getChild(f.getName()),v),f=f.parent);for(var Ft in Q){if(D=!1,Q=f.getChild(Ft),!Q)throw Error("_toJSON: unexpected undefined");v=Q.getNode(),v.isFile()?(Q=Q.getPath(),y&&(Q=ne(y,Q)),l[Q]=v.getString()):v.isDirectory()&&this._toJSON(Q,l,y)}return f=f.getPath(),y&&(f=ne(y,f)),f&&D&&(l[f]=null),l},p.prototype.toJSON=function(f,l,y){l===void 0&&(l={}),y===void 0&&(y=!1);var v=[];if(f){f instanceof Array||(f=[f]);for(var D=0;D=this.maxFiles)throw u("EMFILE","open",f.getPath());var v=f;if(y&&(v=this.resolveSymlinks(f)),!v)throw u("ENOENT","open",f.getPath());if(y=v.getNode(),y.isDirectory()){if((l&(ft|U|at))!==ft)throw u("EISDIR","open",f.getPath())}else if(l&mt)throw u("ENOTDIR","open",f.getPath());if(!(l&at||y.canRead()))throw u("EACCES","open",f.getPath());return f=new this.props.File(f,y,l,this.newFdNumber()),this.fds[f.fd]=f,this.openFiles++,l&x&&f.truncate(),f},p.prototype.openFile=function(f,l,y,v){v===void 0&&(v=!0);var D=L(f),Q=v?this.getResolvedLink(D):this.getLink(D);if(!Q&&l&N){var Ft=this.getResolvedLink(D.slice(0,D.length-1));if(!Ft)throw u("ENOENT","open",It+D.join(It));l&N&&typeof y=="number"&&(Q=this.createLink(Ft,D[D.length-1],!1,y))}if(Q)return this.openLink(Q,l,v);throw u("ENOENT","open",f)},p.prototype.openBase=function(f,l,y,v){if(v===void 0&&(v=!0),l=this.openFile(f,l,y,v),!l)throw u("ENOENT","open",f);return l.fd},p.prototype.openSync=function(f,l,y){return y===void 0&&(y=438),y=X(y),f=S(f),l=m(l),this.openBase(f,l,y)},p.prototype.open=function(f,l,y,v){var D=y;typeof y=="function"&&(D=438,v=y),y=X(D||438),f=S(f),l=m(l),this.wrapAsync(this.openBase,[f,l,y],v)},p.prototype.closeFile=function(f){this.fds[f.fd]&&(this.openFiles--,delete this.fds[f.fd],this.releasedFds.push(f.fd))},p.prototype.closeSync=function(f){et(f),f=this.getFileByFdOrThrow(f,"close"),this.closeFile(f)},p.prototype.close=function(f,l){et(f),this.wrapAsync(this.closeSync,[f],l)},p.prototype.openFileOrGetById=function(f,l,y){if(typeof f=="number"){if(f=this.fds[f],!f)throw u("ENOENT");return f}return this.openFile(S(f),l,y)},p.prototype.readBase=function(f,l,y,v,D){return this.getFileByFdOrThrow(f).read(l,Number(y),Number(v),D)},p.prototype.readSync=function(f,l,y,v,D){return et(f),this.readBase(f,l,y,v,D)},p.prototype.read=function(f,l,y,v,D,Q){var Ft=this;if(w(Q),v===0)return Ht.default.nextTick(function(){Q&&Q(null,0,l)});vr.default(function(){try{var Jt=Ft.readBase(f,l,y,v,D);Q(null,Jt,l)}catch($e){Q($e)}})},p.prototype.readFileBase=function(f,l,y){var v=typeof f=="number"&&f>>>0===f;if(!v){var D=S(f);if(D=L(D),(D=this.getResolvedLink(D))&&D.getNode().isDirectory())throw u("EISDIR","open",D.getPath());f=this.openSync(f,l)}try{var Q=b(this.getFileByFdOrThrow(f).getBuffer(),y)}finally{v||this.closeSync(f)}return Q},p.prototype.readFileSync=function(f,l){l=je(l);var y=m(l.flag);return this.readFileBase(f,y,l.encoding)},p.prototype.readFile=function(f,l,y){y=I(je)(l,y),l=y[0],y=y[1];var v=m(l.flag);this.wrapAsync(this.readFileBase,[f,v,l.encoding],y)},p.prototype.writeBase=function(f,l,y,v,D){return this.getFileByFdOrThrow(f,"write").write(l,y,v,D)},p.prototype.writeSync=function(f,l,y,v,D){et(f);var Q=typeof l!="string";if(Q){var Ft=(y||0)|0,Jt=v;y=D}else var $e=v;return l=Y(l,$e),Q?typeof Jt>"u"&&(Jt=l.length):(Ft=0,Jt=l.length),this.writeBase(f,l,Ft,Jt,y)},p.prototype.write=function(f,l,y,v,D,Q){var Ft=this;et(f);var Jt=typeof l,$e=typeof y,Xu=typeof v,Ju=typeof D;if(Jt!=="string")if($e==="function")var fr=y;else if(Xu==="function"){var kn=y|0;fr=v}else if(Ju==="function"){kn=y|0;var Qr=v;fr=D}else{kn=y|0,Qr=v;var ho=D;fr=Q}else if($e==="function")fr=y;else if(Xu==="function")ho=y,fr=v;else if(Ju==="function"){ho=y;var Xl=v;fr=D}var Gn=Y(l,Xl);Jt!=="string"?typeof Qr>"u"&&(Qr=Gn.length):(kn=0,Qr=Gn.length);var lo=w(fr);vr.default(function(){try{var Zu=Ft.writeBase(f,Gn,kn,Qr,ho);Jt!=="string"?lo(null,Zu,Gn):lo(null,Zu,l)}catch(Jl){lo(Jl)}})},p.prototype.writeFileBase=function(f,l,y,v){var D=typeof f=="number";f=D?f:this.openBase(S(f),y,v),v=0;var Q=l.length;y=y&q?void 0:0;try{for(;0=f.nlink&&this.deleteNode(f)},p.prototype.unlinkSync=function(f){f=S(f),this.unlinkBase(f)},p.prototype.unlink=function(f,l){f=S(f),this.wrapAsync(this.unlinkBase,[f],l)},p.prototype.symlinkBase=function(f,l){var y=L(l),v=this.getLinkParent(y);if(!v)throw u("ENOENT","symlink",f,l);if(y=y[y.length-1],v.getChild(y))throw u("EEXIST","symlink",f,l);return l=v.createChild(y),l.getNode().makeSymlink(L(f)),l},p.prototype.symlinkSync=function(f,l){f=S(f),l=S(l),this.symlinkBase(f,l)},p.prototype.symlink=function(f,l,y,v){y=w(typeof y=="function"?y:v),f=S(f),l=S(l),this.wrapAsync(this.symlinkBase,[f,l],y)},p.prototype.realpathBase=function(f,l){var y=L(f);if(y=this.getResolvedLink(y),!y)throw u("ENOENT","realpath",f);return te.strToEncoding(y.getPath(),l)},p.prototype.realpathSync=function(f,l){return this.realpathBase(S(f),K(l).encoding)},p.prototype.realpath=function(f,l,y){y=z(l,y),l=y[0],y=y[1],f=S(f),this.wrapAsync(this.realpathBase,[f,l.encoding],y)},p.prototype.lstatBase=function(f,l){l===void 0&&(l=!1);var y=this.getLink(L(f));if(!y)throw u("ENOENT","lstat",f);return Er.default.build(y.getNode(),l)},p.prototype.lstatSync=function(f,l){return this.lstatBase(S(f),i(l).bigint)},p.prototype.lstat=function(f,l,y){y=n(l,y),l=y[0],y=y[1],this.wrapAsync(this.lstatBase,[S(f),l.bigint],y)},p.prototype.statBase=function(f,l){l===void 0&&(l=!1);var y=this.getResolvedLink(L(f));if(!y)throw u("ENOENT","stat",f);return Er.default.build(y.getNode(),l)},p.prototype.statSync=function(f,l){return this.statBase(S(f),i(l).bigint)},p.prototype.stat=function(f,l,y){y=n(l,y),l=y[0],y=y[1],this.wrapAsync(this.statBase,[S(f),l.bigint],y)},p.prototype.fstatBase=function(f,l){if(l===void 0&&(l=!1),f=this.getFileByFd(f),!f)throw u("EBADF","fstat");return Er.default.build(f.node,l)},p.prototype.fstatSync=function(f,l){return this.fstatBase(f,i(l).bigint)},p.prototype.fstat=function(f,l,y){l=n(l,y),this.wrapAsync(this.fstatBase,[f,l[0].bigint],l[1])},p.prototype.renameBase=function(f,l){var y=this.getLink(L(f));if(!y)throw u("ENOENT","rename",f,l);var v=L(l),D=this.getLinkParent(v);if(!D)throw u("ENOENT","rename",f,l);(f=y.parent)&&f.deleteChild(y),y.steps=ot(D.steps,[v[v.length-1]]),D.setChild(y.getName(),y)},p.prototype.renameSync=function(f,l){f=S(f),l=S(l),this.renameBase(f,l)},p.prototype.rename=function(f,l,y){f=S(f),l=S(l),this.wrapAsync(this.renameBase,[f,l],y)},p.prototype.existsBase=function(f){return!!this.statBase(f)},p.prototype.existsSync=function(f){try{return this.existsBase(S(f))}catch{return!1}},p.prototype.exists=function(f,l){var y=this,v=S(f);if(typeof l!="function")throw Error(Gt.CB);vr.default(function(){try{l(y.existsBase(v))}catch{l(!1)}})},p.prototype.accessBase=function(f){this.getLinkOrThrow(f,"access")},p.prototype.accessSync=function(f,l){l===void 0&&(l=wt),f=S(f),this.accessBase(f,l|0)},p.prototype.access=function(f,l,y){var v=wt;typeof l!="function"&&(v=l|0,l=w(y)),f=S(f),this.wrapAsync(this.accessBase,[f,v],l)},p.prototype.appendFileSync=function(f,l,y){y===void 0&&(y=_),y=O(y),y.flag&&f>>>0!==f||(y.flag="a"),this.writeFileSync(f,l,y)},p.prototype.appendFile=function(f,l,y,v){v=W(y,v),y=v[0],v=v[1],y.flag&&f>>>0!==f||(y.flag="a"),this.writeFile(f,l,y,v)},p.prototype.readdirBase=function(f,l){var y=L(f);if(y=this.getResolvedLink(y),!y)throw u("ENOENT","readdir",f);if(!y.getNode().isDirectory())throw u("ENOTDIR","scandir",f);if(l.withFileTypes){var v=[];for(D in y.children)(f=y.getChild(D))&&v.push(Bi.default.build(f,l.encoding));return Kt||l.encoding==="buffer"||v.sort(function(Q,Ft){return Q.nameFt.name?1:0}),v}var D=[];for(v in y.children)D.push(te.strToEncoding(v,l.encoding));return Kt||l.encoding==="buffer"||D.sort(),D},p.prototype.readdirSync=function(f,l){return l=pt(l),f=S(f),this.readdirBase(f,l)},p.prototype.readdir=function(f,l,y){y=Ct(l,y),l=y[0],y=y[1],f=S(f),this.wrapAsync(this.readdirBase,[f,l],y)},p.prototype.readlinkBase=function(f,l){var y=this.getLinkOrThrow(f,"readlink").getNode();if(!y.isSymlink())throw u("EINVAL","readlink",f);return f=It+y.symlink.join(It),te.strToEncoding(f,l)},p.prototype.readlinkSync=function(f,l){return l=At(l),f=S(f),this.readlinkBase(f,l.encoding)},p.prototype.readlink=function(f,l,y){y=zt(l,y),l=y[0],y=y[1],f=S(f),this.wrapAsync(this.readlinkBase,[f,l.encoding],y)},p.prototype.fsyncBase=function(f){this.getFileByFdOrThrow(f,"fsync")},p.prototype.fsyncSync=function(f){this.fsyncBase(f)},p.prototype.fsync=function(f,l){this.wrapAsync(this.fsyncBase,[f],l)},p.prototype.fdatasyncBase=function(f){this.getFileByFdOrThrow(f,"fdatasync")},p.prototype.fdatasyncSync=function(f){this.fdatasyncBase(f)},p.prototype.fdatasync=function(f,l){this.wrapAsync(this.fdatasyncBase,[f],l)},p.prototype.ftruncateBase=function(f,l){this.getFileByFdOrThrow(f,"ftruncate").truncate(l)},p.prototype.ftruncateSync=function(f,l){this.ftruncateBase(f,l)},p.prototype.ftruncate=function(f,l,y){var v=typeof l=="number"?l:0;l=w(typeof l=="number"?y:l),this.wrapAsync(this.ftruncateBase,[f,v],l)},p.prototype.truncateBase=function(f,l){f=this.openSync(f,"r+");try{this.ftruncateSync(f,l)}finally{this.closeSync(f)}},p.prototype.truncateSync=function(f,l){if(f>>>0===f)return this.ftruncateSync(f,l);this.truncateBase(f,l)},p.prototype.truncate=function(f,l,y){var v=typeof l=="number"?l:0;if(l=w(typeof l=="number"?y:l),f>>>0===f)return this.ftruncate(f,v,l);this.wrapAsync(this.truncateBase,[f,v],l)},p.prototype.futimesBase=function(f,l,y){f=this.getFileByFdOrThrow(f,"futimes").node,f.atime=new Date(1e3*l),f.mtime=new Date(1e3*y)},p.prototype.futimesSync=function(f,l,y){this.futimesBase(f,nt(l),nt(y))},p.prototype.futimes=function(f,l,y,v){this.wrapAsync(this.futimesBase,[f,nt(l),nt(y)],v)},p.prototype.utimesBase=function(f,l,y){f=this.openSync(f,"r+");try{this.futimesBase(f,l,y)}finally{this.closeSync(f)}},p.prototype.utimesSync=function(f,l,y){this.utimesBase(S(f),nt(l),nt(y))},p.prototype.utimes=function(f,l,y,v){this.wrapAsync(this.utimesBase,[S(f),nt(l),nt(y)],v)},p.prototype.mkdirBase=function(f,l){var y=L(f);if(!y.length)throw u("EISDIR","mkdir",f);var v=this.getLinkParentAsDirOrThrow(f,"mkdir");if(y=y[y.length-1],v.getChild(y))throw u("EEXIST","mkdir",f);v.createChild(y,this.createNode(!0,l))},p.prototype.mkdirpBase=function(f,l){f=L(f);for(var y=this.root,v=0;vthis.prev.mtimeMs||l.nlink!==this.prev.nlink},f.prototype.start=function(l,y,v){y===void 0&&(y=!0),v===void 0&&(v=5007),this.filename=S(l),this.setTimeout=y?setTimeout:Hs.default,this.interval=v,this.prev=this.vol.statSync(this.filename),this.loop()},f.prototype.stop=function(){clearTimeout(this.timeoutRef),Ht.default.nextTick(k,this)},f}(ct.EventEmitter);e.StatWatcher=T;var F;xr.inherits($,Xt.Readable),e.ReadStream=$,$.prototype.open=function(){var p=this;this._vol.open(this.path,this.flags,this.mode,function(f,l){f?(p.autoClose&&p.destroy&&p.destroy(),p.emit("error",f)):(p.fd=l,p.emit("open",l),p.read())})},$.prototype._read=function(p){if(typeof this.fd!="number")return this.once("open",function(){this._read(p)});if(!this.destroyed){(!F||128>F.length-F.used)&&(F=Tt.bufferAllocUnsafe(this._readableState.highWaterMark),F.used=0);var f=F,l=Math.min(F.length-F.used,p),y=F.used;if(this.pos!==void 0&&(l=Math.min(this.end-this.pos+1,l)),0>=l)return this.push(null);var v=this;this._vol.read(this.fd,F,F.used,l,this.pos,function(D,Q){D?(v.autoClose&&v.destroy&&v.destroy(),v.emit("error",D)):(D=null,0 * @license MIT */(function(t){const e=ie,r=br,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=tt,t.INSPECT_MAX_BYTES=50;const i=2147483647;t.kMaxLength=i,u.TYPED_ARRAY_SUPPORT=o(),!u.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 o(){try{const d=new Uint8Array(1),h={foo:function(){return 42}};return Object.setPrototypeOf(h,Uint8Array.prototype),Object.setPrototypeOf(d,h),d.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function s(d){if(d>i)throw new RangeError('The value "'+d+'" is invalid for option "size"');const h=new Uint8Array(d);return Object.setPrototypeOf(h,u.prototype),h}function u(d,h,c){if(typeof d=="number"){if(typeof h=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(d)}return m(d,h,c)}u.poolSize=8192;function m(d,h,c){if(typeof d=="string")return I(d,h);if(ArrayBuffer.isView(d))return L(d);if(d==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof d);if(z(d,ArrayBuffer)||d&&z(d.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(z(d,SharedArrayBuffer)||d&&z(d.buffer,SharedArrayBuffer)))return G(d,h,c);if(typeof d=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const T=d.valueOf&&d.valueOf();if(T!=null&&T!==d)return u.from(T,h,c);const F=Y(d);if(F)return F;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof d[Symbol.toPrimitive]=="function")return u.from(d[Symbol.toPrimitive]("string"),h,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof d)}u.from=function(d,h,c){return m(d,h,c)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function g(d){if(typeof d!="number")throw new TypeError('"size" argument must be of type number');if(d<0)throw new RangeError('The value "'+d+'" is invalid for option "size"')}function E(d,h,c){return g(d),d<=0?s(d):h!==void 0?typeof c=="string"?s(d).fill(h,c):s(d).fill(h):s(d)}u.alloc=function(d,h,c){return E(d,h,c)};function w(d){return g(d),s(d<0?0:b(d)|0)}u.allocUnsafe=function(d){return w(d)},u.allocUnsafeSlow=function(d){return w(d)};function I(d,h){if((typeof h!="string"||h==="")&&(h="utf8"),!u.isEncoding(h))throw new TypeError("Unknown encoding: "+h);const c=X(d,h)|0;let T=s(c);const F=T.write(d,h);return F!==c&&(T=T.slice(0,F)),T}function S(d){const h=d.length<0?0:b(d.length)|0,c=s(h);for(let T=0;T=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return d|0}function tt(d){return+d!=d&&(d=0),u.alloc(+d)}u.isBuffer=function(h){return h!=null&&h._isBuffer===!0&&h!==u.prototype},u.compare=function(h,c){if(z(h,Uint8Array)&&(h=u.from(h,h.offset,h.byteLength)),z(c,Uint8Array)&&(c=u.from(c,c.offset,c.byteLength)),!u.isBuffer(h)||!u.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(h===c)return 0;let T=h.length,F=c.length;for(let M=0,p=Math.min(T,F);MF.length?(u.isBuffer(p)||(p=u.from(p)),p.copy(F,M)):Uint8Array.prototype.set.call(F,p,M);else if(u.isBuffer(p))p.copy(F,M);else throw new TypeError('"list" argument must be an Array of Buffers');M+=p.length}return F};function X(d,h){if(u.isBuffer(d))return d.length;if(ArrayBuffer.isView(d)||z(d,ArrayBuffer))return d.byteLength;if(typeof d!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof d);const c=d.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&c===0)return 0;let F=!1;for(;;)switch(h){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return a(d).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return W(d).length;default:if(F)return T?-1:a(d).length;h=(""+h).toLowerCase(),F=!0}}u.byteLength=X;function et(d,h,c){let T=!1;if((h===void 0||h<0)&&(h=0),h>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,h>>>=0,c<=h))return"";for(d||(d="utf8");;)switch(d){case"hex":return N(this,h,c);case"utf8":case"utf-8":return it(this,h,c);case"ascii":return at(this,h,c);case"latin1":case"binary":return U(this,h,c);case"base64":return ot(this,h,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,h,c);default:if(T)throw new TypeError("Unknown encoding: "+d);d=(d+"").toLowerCase(),T=!0}}u.prototype._isBuffer=!0;function nt(d,h,c){const T=d[h];d[h]=d[c],d[c]=T}u.prototype.swap16=function(){const h=this.length;if(h%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let c=0;cc&&(h+=" ... "),""},n&&(u.prototype[n]=u.prototype.inspect),u.prototype.compare=function(h,c,T,F,M){if(z(h,Uint8Array)&&(h=u.from(h,h.offset,h.byteLength)),!u.isBuffer(h))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof h);if(c===void 0&&(c=0),T===void 0&&(T=h?h.length:0),F===void 0&&(F=0),M===void 0&&(M=this.length),c<0||T>h.length||F<0||M>this.length)throw new RangeError("out of range index");if(F>=M&&c>=T)return 0;if(F>=M)return-1;if(c>=T)return 1;if(c>>>=0,T>>>=0,F>>>=0,M>>>=0,this===h)return 0;let p=M-F,f=T-c;const l=Math.min(p,f),y=this.slice(F,M),v=h.slice(c,T);for(let D=0;D2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,ht(c)&&(c=F?0:d.length-1),c<0&&(c=d.length+c),c>=d.length){if(F)return-1;c=d.length-1}else if(c<0)if(F)c=0;else return-1;if(typeof h=="string"&&(h=u.from(h,T)),u.isBuffer(h))return h.length===0?-1:C(d,h,c,T,F);if(typeof h=="number")return h=h&255,typeof Uint8Array.prototype.indexOf=="function"?F?Uint8Array.prototype.indexOf.call(d,h,c):Uint8Array.prototype.lastIndexOf.call(d,h,c):C(d,[h],c,T,F);throw new TypeError("val must be string, number or Buffer")}function C(d,h,c,T,F){let M=1,p=d.length,f=h.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(d.length<2||h.length<2)return-1;M=2,p/=2,f/=2,c/=2}function l(v,D){return M===1?v[D]:v.readUInt16BE(D*M)}let y;if(F){let v=-1;for(y=c;yp&&(c=p-f),y=c;y>=0;y--){let v=!0;for(let D=0;DF&&(T=F)):T=F;const M=h.length;T>M/2&&(T=M/2);let p;for(p=0;p>>0,isFinite(T)?(T=T>>>0,F===void 0&&(F="utf8")):(F=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const M=this.length-c;if((T===void 0||T>M)&&(T=M),h.length>0&&(T<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");F||(F="utf8");let p=!1;for(;;)switch(F){case"hex":return k(this,h,c,T);case"utf8":case"utf-8":return $(this,h,c,T);case"ascii":case"latin1":case"binary":return j(this,h,c,T);case"base64":return J(this,h,c,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rt(this,h,c,T);default:if(p)throw new TypeError("Unknown encoding: "+F);F=(""+F).toLowerCase(),p=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ot(d,h,c){return h===0&&c===d.length?e.fromByteArray(d):e.fromByteArray(d.slice(h,c))}function it(d,h,c){c=Math.min(d.length,c);const T=[];let F=h;for(;F239?4:M>223?3:M>191?2:1;if(F+f<=c){let l,y,v,D;switch(f){case 1:M<128&&(p=M);break;case 2:l=d[F+1],(l&192)===128&&(D=(M&31)<<6|l&63,D>127&&(p=D));break;case 3:l=d[F+1],y=d[F+2],(l&192)===128&&(y&192)===128&&(D=(M&15)<<12|(l&63)<<6|y&63,D>2047&&(D<55296||D>57343)&&(p=D));break;case 4:l=d[F+1],y=d[F+2],v=d[F+3],(l&192)===128&&(y&192)===128&&(v&192)===128&&(D=(M&15)<<18|(l&63)<<12|(y&63)<<6|v&63,D>65535&&D<1114112&&(p=D))}}p===null?(p=65533,f=1):p>65535&&(p-=65536,T.push(p>>>10&1023|55296),p=56320|p&1023),T.push(p),F+=f}return ft(T)}const ut=4096;function ft(d){const h=d.length;if(h<=ut)return String.fromCharCode.apply(String,d);let c="",T=0;for(;TT)&&(c=T);let F="";for(let M=h;MT&&(h=T),c<0?(c+=T,c<0&&(c=0)):c>T&&(c=T),cc)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(h,c,T){h=h>>>0,c=c>>>0,T||x(h,c,this.length);let F=this[h],M=1,p=0;for(;++p>>0,c=c>>>0,T||x(h,c,this.length);let F=this[h+--c],M=1;for(;c>0&&(M*=256);)F+=this[h+--c]*M;return F},u.prototype.readUint8=u.prototype.readUInt8=function(h,c){return h=h>>>0,c||x(h,1,this.length),this[h]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(h,c){return h=h>>>0,c||x(h,2,this.length),this[h]|this[h+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(h,c){return h=h>>>0,c||x(h,2,this.length),this[h]<<8|this[h+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(h,c){return h=h>>>0,c||x(h,4,this.length),(this[h]|this[h+1]<<8|this[h+2]<<16)+this[h+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(h,c){return h=h>>>0,c||x(h,4,this.length),this[h]*16777216+(this[h+1]<<16|this[h+2]<<8|this[h+3])},u.prototype.readBigUInt64LE=pt(function(h){h=h>>>0,At(h,"offset");const c=this[h],T=this[h+7];(c===void 0||T===void 0)&&zt(h,this.length-8);const F=c+this[++h]*2**8+this[++h]*2**16+this[++h]*2**24,M=this[++h]+this[++h]*2**8+this[++h]*2**16+T*2**24;return BigInt(F)+(BigInt(M)<>>0,At(h,"offset");const c=this[h],T=this[h+7];(c===void 0||T===void 0)&&zt(h,this.length-8);const F=c*2**24+this[++h]*2**16+this[++h]*2**8+this[++h],M=this[++h]*2**24+this[++h]*2**16+this[++h]*2**8+T;return(BigInt(F)<>>0,c=c>>>0,T||x(h,c,this.length);let F=this[h],M=1,p=0;for(;++p=M&&(F-=Math.pow(2,8*c)),F},u.prototype.readIntBE=function(h,c,T){h=h>>>0,c=c>>>0,T||x(h,c,this.length);let F=c,M=1,p=this[h+--F];for(;F>0&&(M*=256);)p+=this[h+--F]*M;return M*=128,p>=M&&(p-=Math.pow(2,8*c)),p},u.prototype.readInt8=function(h,c){return h=h>>>0,c||x(h,1,this.length),this[h]&128?(255-this[h]+1)*-1:this[h]},u.prototype.readInt16LE=function(h,c){h=h>>>0,c||x(h,2,this.length);const T=this[h]|this[h+1]<<8;return T&32768?T|4294901760:T},u.prototype.readInt16BE=function(h,c){h=h>>>0,c||x(h,2,this.length);const T=this[h+1]|this[h]<<8;return T&32768?T|4294901760:T},u.prototype.readInt32LE=function(h,c){return h=h>>>0,c||x(h,4,this.length),this[h]|this[h+1]<<8|this[h+2]<<16|this[h+3]<<24},u.prototype.readInt32BE=function(h,c){return h=h>>>0,c||x(h,4,this.length),this[h]<<24|this[h+1]<<16|this[h+2]<<8|this[h+3]},u.prototype.readBigInt64LE=pt(function(h){h=h>>>0,At(h,"offset");const c=this[h],T=this[h+7];(c===void 0||T===void 0)&&zt(h,this.length-8);const F=this[h+4]+this[h+5]*2**8+this[h+6]*2**16+(T<<24);return(BigInt(F)<>>0,At(h,"offset");const c=this[h],T=this[h+7];(c===void 0||T===void 0)&&zt(h,this.length-8);const F=(c<<24)+this[++h]*2**16+this[++h]*2**8+this[++h];return(BigInt(F)<>>0,c||x(h,4,this.length),r.read(this,h,!0,23,4)},u.prototype.readFloatBE=function(h,c){return h=h>>>0,c||x(h,4,this.length),r.read(this,h,!1,23,4)},u.prototype.readDoubleLE=function(h,c){return h=h>>>0,c||x(h,8,this.length),r.read(this,h,!0,52,8)},u.prototype.readDoubleBE=function(h,c){return h=h>>>0,c||x(h,8,this.length),r.read(this,h,!1,52,8)};function q(d,h,c,T,F,M){if(!u.isBuffer(d))throw new TypeError('"buffer" argument must be a Buffer instance');if(h>F||hd.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(h,c,T,F){if(h=+h,c=c>>>0,T=T>>>0,!F){const f=Math.pow(2,8*T)-1;q(this,h,c,T,f,0)}let M=1,p=0;for(this[c]=h&255;++p>>0,T=T>>>0,!F){const f=Math.pow(2,8*T)-1;q(this,h,c,T,f,0)}let M=T-1,p=1;for(this[c+M]=h&255;--M>=0&&(p*=256);)this[c+M]=h/p&255;return c+T},u.prototype.writeUint8=u.prototype.writeUInt8=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,1,255,0),this[c]=h&255,c+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,2,65535,0),this[c]=h&255,this[c+1]=h>>>8,c+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,2,65535,0),this[c]=h>>>8,this[c+1]=h&255,c+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,4,4294967295,0),this[c+3]=h>>>24,this[c+2]=h>>>16,this[c+1]=h>>>8,this[c]=h&255,c+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,4,4294967295,0),this[c]=h>>>24,this[c+1]=h>>>16,this[c+2]=h>>>8,this[c+3]=h&255,c+4};function _t(d,h,c,T,F){Pt(h,T,F,d,c,7);let M=Number(h&BigInt(4294967295));d[c++]=M,M=M>>8,d[c++]=M,M=M>>8,d[c++]=M,M=M>>8,d[c++]=M;let p=Number(h>>BigInt(32)&BigInt(4294967295));return d[c++]=p,p=p>>8,d[c++]=p,p=p>>8,d[c++]=p,p=p>>8,d[c++]=p,c}function mt(d,h,c,T,F){Pt(h,T,F,d,c,7);let M=Number(h&BigInt(4294967295));d[c+7]=M,M=M>>8,d[c+6]=M,M=M>>8,d[c+5]=M,M=M>>8,d[c+4]=M;let p=Number(h>>BigInt(32)&BigInt(4294967295));return d[c+3]=p,p=p>>8,d[c+2]=p,p=p>>8,d[c+1]=p,p=p>>8,d[c]=p,c+8}u.prototype.writeBigUInt64LE=pt(function(h,c=0){return _t(this,h,c,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=pt(function(h,c=0){return mt(this,h,c,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(h,c,T,F){if(h=+h,c=c>>>0,!F){const l=Math.pow(2,8*T-1);q(this,h,c,T,l-1,-l)}let M=0,p=1,f=0;for(this[c]=h&255;++M>0)-f&255;return c+T},u.prototype.writeIntBE=function(h,c,T,F){if(h=+h,c=c>>>0,!F){const l=Math.pow(2,8*T-1);q(this,h,c,T,l-1,-l)}let M=T-1,p=1,f=0;for(this[c+M]=h&255;--M>=0&&(p*=256);)h<0&&f===0&&this[c+M+1]!==0&&(f=1),this[c+M]=(h/p>>0)-f&255;return c+T},u.prototype.writeInt8=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,1,127,-128),h<0&&(h=255+h+1),this[c]=h&255,c+1},u.prototype.writeInt16LE=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,2,32767,-32768),this[c]=h&255,this[c+1]=h>>>8,c+2},u.prototype.writeInt16BE=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,2,32767,-32768),this[c]=h>>>8,this[c+1]=h&255,c+2},u.prototype.writeInt32LE=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,4,2147483647,-2147483648),this[c]=h&255,this[c+1]=h>>>8,this[c+2]=h>>>16,this[c+3]=h>>>24,c+4},u.prototype.writeInt32BE=function(h,c,T){return h=+h,c=c>>>0,T||q(this,h,c,4,2147483647,-2147483648),h<0&&(h=4294967295+h+1),this[c]=h>>>24,this[c+1]=h>>>16,this[c+2]=h>>>8,this[c+3]=h&255,c+4},u.prototype.writeBigInt64LE=pt(function(h,c=0){return _t(this,h,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=pt(function(h,c=0){return mt(this,h,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function wt(d,h,c,T,F,M){if(c+T>d.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function Vt(d,h,c,T,F){return h=+h,c=c>>>0,F||wt(d,h,c,4),r.write(d,h,c,T,23,4),c+4}u.prototype.writeFloatLE=function(h,c,T){return Vt(this,h,c,!0,T)},u.prototype.writeFloatBE=function(h,c,T){return Vt(this,h,c,!1,T)};function Ye(d,h,c,T,F){return h=+h,c=c>>>0,F||wt(d,h,c,8),r.write(d,h,c,T,52,8),c+8}u.prototype.writeDoubleLE=function(h,c,T){return Ye(this,h,c,!0,T)},u.prototype.writeDoubleBE=function(h,c,T){return Ye(this,h,c,!1,T)},u.prototype.copy=function(h,c,T,F){if(!u.isBuffer(h))throw new TypeError("argument should be a Buffer");if(T||(T=0),!F&&F!==0&&(F=this.length),c>=h.length&&(c=h.length),c||(c=0),F>0&&F=this.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("sourceEnd out of bounds");F>this.length&&(F=this.length),h.length-c>>0,T=T===void 0?this.length:T>>>0,h||(h=0);let M;if(typeof h=="number")for(M=c;M2**32?F=Kt(String(c)):typeof c=="bigint"&&(F=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(F=Kt(F)),F+="n"),T+=` It must be ${h}. Received ${F}`,T},RangeError);function Kt(d){let h="",c=d.length;const T=d[0]==="-"?1:0;for(;c>=T+4;c-=3)h=`_${d.slice(c-3,c)}${h}`;return`${d.slice(0,c)}${h}`}function Gt(d,h,c){At(h,"offset"),(d[h]===void 0||d[h+c]===void 0)&&zt(h,d.length-(c+1))}function Pt(d,h,c,T,F,M){if(d>c||d3?h===0||h===BigInt(0)?f=`>= 0${p} and < 2${p} ** ${(M+1)*8}${p}`:f=`>= -(2${p} ** ${(M+1)*8-1}${p}) and < 2 ** ${(M+1)*8-1}${p}`:f=`>= ${h}${p} and <= ${c}${p}`,new It.ERR_OUT_OF_RANGE("value",f,d)}Gt(T,F,M)}function At(d,h){if(typeof d!="number")throw new It.ERR_INVALID_ARG_TYPE(h,"number",d)}function zt(d,h,c){throw Math.floor(d)!==d?(At(d,c),new It.ERR_OUT_OF_RANGE(c||"offset","an integer",d)):h<0?new It.ERR_BUFFER_OUT_OF_BOUNDS:new It.ERR_OUT_OF_RANGE(c||"offset",`>= ${c?1:0} and <= ${h}`,d)}const je=/[^+/0-9A-Za-z-_]/g;function A(d){if(d=d.split("=")[0],d=d.trim().replace(je,""),d.length<2)return"";for(;d.length%4!==0;)d=d+"=";return d}function a(d,h){h=h||1/0;let c;const T=d.length;let F=null;const M=[];for(let p=0;p55295&&c<57344){if(!F){if(c>56319){(h-=3)>-1&&M.push(239,191,189);continue}else if(p+1===T){(h-=3)>-1&&M.push(239,191,189);continue}F=c;continue}if(c<56320){(h-=3)>-1&&M.push(239,191,189),F=c;continue}c=(F-55296<<10|c-56320)+65536}else F&&(h-=3)>-1&&M.push(239,191,189);if(F=null,c<128){if((h-=1)<0)break;M.push(c)}else if(c<2048){if((h-=2)<0)break;M.push(c>>6|192,c&63|128)}else if(c<65536){if((h-=3)<0)break;M.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((h-=4)<0)break;M.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return M}function _(d){const h=[];for(let c=0;c>8,F=c%256,M.push(F),M.push(T);return M}function W(d){return e.toByteArray(A(d))}function K(d,h,c,T){let F;for(F=0;F=h.length||F>=d.length);++F)h[F+c]=d[F];return F}function z(d,h){return d instanceof h||d!=null&&d.constructor!=null&&d.constructor.name!=null&&d.constructor.name===h.name}function ht(d){return d!==d}const yt=function(){const d="0123456789abcdef",h=new Array(256);for(let c=0;c<16;++c){const T=c*16;for(let F=0;F<16;++F)h[T+F]=d[c]+d[F]}return h}();function pt(d){return typeof BigInt>"u"?Ct:d}function Ct(){throw new Error("BigInt not supported")}})(du);/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(t,e){var r=du,n=r.Buffer;function i(s,u){for(var m in s)u[m]=s[m]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o);function o(s,u,m){return n(s,u,m)}o.prototype=Object.create(n.prototype),i(n,o),o.from=function(s,u,m){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,u,m)},o.alloc=function(s,u,m){if(typeof s!="number")throw new TypeError("Argument must be a number");var g=n(s);return u!==void 0?typeof m=="string"?g.fill(u,m):g.fill(u):g.fill(0),g},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(s)}})(bh,qr);var Vi={},Eu={get exports(){return Vi},set exports(t){Vi=t}},Ki=65536,tl=4294967295;function el(){throw new Error(`Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11`)}var rl=qr.Buffer,Ln=Dt.crypto||Dt.msCrypto;Ln&&Ln.getRandomValues?Eu.exports=nl:Eu.exports=el;function nl(t,e){if(t>tl)throw new RangeError("requested too many random bytes");var r=rl.allocUnsafe(t);if(t>0)if(t>Ki)for(var n=0;nTu||t<0)throw new TypeError("offset must be a uint32");if(t>Au||t>e)throw new RangeError("offset out of range")}function Ru(t,e,r){if(typeof t!="number"||t!==t)throw new TypeError("size must be a number");if(t>Tu||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>Au)throw new RangeError("buffer too small")}zi&&zi.getRandomValues||!oe.browser?(zr.randomFill=il,zr.randomFillSync=ol):(zr.randomFill=mu,zr.randomFillSync=mu);function il(t,e,r,n){if(!wu.isBuffer(t)&&!(t instanceof Dt.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof e=="function")n=e,e=0,r=t.length;else if(typeof r=="function")n=r,r=t.length-e;else if(typeof n!="function")throw new TypeError('"cb" argument must be a function');return vu(e,t.length),Ru(r,e,t.length),Ou(t,e,r,n)}function Ou(t,e,r,n){if(oe.browser){var i=t.buffer,o=new Uint8Array(i,e,r);if(zi.getRandomValues(o),n){oe.nextTick(function(){n(null,t)});return}return t}if(n){Iu(r,function(u,m){if(u)return n(u);m.copy(t,e),n(null,t)});return}var s=Iu(r);return s.copy(t,e),t}function ol(t,e,r){if(typeof e>"u"&&(e=0),!wu.isBuffer(t)&&!(t instanceof Dt.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return vu(e,t.length),r===void 0&&(r=t.length-e),Ru(r,e,t.length),Ou(t,e,r)}var qi={};Object.defineProperty(qi,"__esModule",{value:!0});const sl=Math.floor((Date.now()-performance.now())*.001);function ul(t){let e=performance.now()*.001,r=Math.floor(e)+sl,n=Math.floor(e%1*1e9);return t&&(r=r-t[0],n=n-t[1],n<0&&(r--,n+=1e9)),[r,n]}qi.default=ul;function me(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function Bu(t,e){for(var r="",n=0,i=-1,o=0,s,u=0;u<=t.length;++u){if(u2){var m=r.lastIndexOf("/");if(m!==r.length-1){m===-1?(r="",n=0):(r=r.slice(0,m),n=r.length-1-r.lastIndexOf("/")),i=u,o=0;continue}}else if(r.length===2||r.length===1){r="",n=0,i=u,o=0;continue}}e&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+t.slice(i+1,u):r=t.slice(i+1,u),n=u-i-1;i=u,o=0}else s===46&&o!==-1?++o:o=-1}return r}function fl(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+t+n:n}var Br={resolve:function(){for(var e="",r=!1,n,i=arguments.length-1;i>=-1&&!r;i--){var o;i>=0?o=arguments[i]:(n===void 0&&(n=oe.cwd()),o=n),me(o),o.length!==0&&(e=o+"/"+e,r=o.charCodeAt(0)===47)}return e=Bu(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(me(e),e.length===0)return".";var r=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Bu(e,!r),e.length===0&&!r&&(e="."),e.length>0&&n&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return me(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,r=0;r0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":Br.normalize(e)},relative:function(e,r){if(me(e),me(r),e===r||(e=Br.resolve(e),r=Br.resolve(r),e===r))return"";for(var n=1;ng){if(r.charCodeAt(s+w)===47)return r.slice(s+w+1);if(w===0)return r.slice(s+w)}else o>g&&(e.charCodeAt(n+w)===47?E=w:w===0&&(E=0));break}var I=e.charCodeAt(n+w),S=r.charCodeAt(s+w);if(I!==S)break;I===47&&(E=w)}var L="";for(w=n+E+1;w<=i;++w)(w===i||e.charCodeAt(w)===47)&&(L.length===0?L+="..":L+="/..");return L.length>0?L+r.slice(s+E):(s+=E,r.charCodeAt(s)===47&&++s,r.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(me(e),e.length===0)return".";for(var r=e.charCodeAt(0),n=r===47,i=-1,o=!0,s=e.length-1;s>=1;--s)if(r=e.charCodeAt(s),r===47){if(!o){i=s;break}}else o=!1;return i===-1?n?"/":".":n&&i===1?"//":e.slice(0,i)},basename:function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');me(e);var n=0,i=-1,o=!0,s;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var u=r.length-1,m=-1;for(s=e.length-1;s>=0;--s){var g=e.charCodeAt(s);if(g===47){if(!o){n=s+1;break}}else m===-1&&(o=!1,m=s+1),u>=0&&(g===r.charCodeAt(u)?--u===-1&&(i=s):(u=-1,i=m))}return n===i?i=m:i===-1&&(i=e.length),e.slice(n,i)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!o){n=s+1;break}}else i===-1&&(o=!1,i=s+1);return i===-1?"":e.slice(n,i)}},extname:function(e){me(e);for(var r=-1,n=0,i=-1,o=!0,s=0,u=e.length-1;u>=0;--u){var m=e.charCodeAt(u);if(m===47){if(!o){n=u+1;break}continue}i===-1&&(o=!1,i=u+1),m===46?r===-1?r=u:s!==1&&(s=1):r!==-1&&(s=-1)}return r===-1||i===-1||s===0||s===1&&r===i-1&&r===n+1?"":e.slice(r,i)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return fl("/",e)},parse:function(e){me(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var n=e.charCodeAt(0),i=n===47,o;i?(r.root="/",o=1):o=0;for(var s=-1,u=0,m=-1,g=!0,E=e.length-1,w=0;E>=o;--E){if(n=e.charCodeAt(E),n===47){if(!g){u=E+1;break}continue}m===-1&&(g=!1,m=E+1),n===46?s===-1?s=E:w!==1&&(w=1):s!==-1&&(w=-1)}return s===-1||m===-1||w===0||w===1&&s===m-1&&s===u+1?m!==-1&&(u===0&&i?r.base=r.name=e.slice(1,m):r.base=r.name=e.slice(u,m)):(u===0&&i?(r.name=e.slice(1,s),r.base=e.slice(1,m)):(r.name=e.slice(u,s),r.base=e.slice(u,m)),r.ext=e.slice(s,m)),u>0?r.dir=e.slice(0,u-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};Br.posix=Br;var hl=Br,sr={},Xr={};Object.defineProperty(Xr,"__esModule",{value:!0});const ll=typeof globalThis<"u"?globalThis:typeof Dt<"u"?Dt:{};Xr.BigIntPolyfill=typeof BigInt<"u"?BigInt:ll.BigInt||Number;var Xi={};Object.defineProperty(Xi,"__esModule",{value:!0});const cl=Xr;let Cn=DataView;Cn.prototype.setBigUint64||(Cn.prototype.setBigUint64=function(t,e,r){let n,i;if(e<2**32)n=Number(e),i=0;else{for(var o=e.toString(2),s="",u=0;u<64-o.length;u++)s+="0";s+=o,i=parseInt(s.substring(0,32),2),n=parseInt(s.substring(32),2)}this.setUint32(t+(r?0:4),n,r),this.setUint32(t+(r?4:0),i,r)},Cn.prototype.getBigUint64=function(t,e){let r=this.getUint32(t+(e?0:4),e),n=this.getUint32(t+(e?4:0),e);for(var i=r.toString(2),o=n.toString(2),s="",u=0;u<32-i.length;u++)s+="0";return s+=i,cl.BigIntPolyfill("0b"+o+s)}),Xi.DataViewPolyfill=Cn;var Ji={};Object.defineProperty(Ji,"__esModule",{value:!0});const al=se.Buffer;Ji.default=al;var Nu={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Xr;t.WASI_ESUCCESS=0,t.WASI_E2BIG=1,t.WASI_EACCES=2,t.WASI_EADDRINUSE=3,t.WASI_EADDRNOTAVAIL=4,t.WASI_EAFNOSUPPORT=5,t.WASI_EAGAIN=6,t.WASI_EALREADY=7,t.WASI_EBADF=8,t.WASI_EBADMSG=9,t.WASI_EBUSY=10,t.WASI_ECANCELED=11,t.WASI_ECHILD=12,t.WASI_ECONNABORTED=13,t.WASI_ECONNREFUSED=14,t.WASI_ECONNRESET=15,t.WASI_EDEADLK=16,t.WASI_EDESTADDRREQ=17,t.WASI_EDOM=18,t.WASI_EDQUOT=19,t.WASI_EEXIST=20,t.WASI_EFAULT=21,t.WASI_EFBIG=22,t.WASI_EHOSTUNREACH=23,t.WASI_EIDRM=24,t.WASI_EILSEQ=25,t.WASI_EINPROGRESS=26,t.WASI_EINTR=27,t.WASI_EINVAL=28,t.WASI_EIO=29,t.WASI_EISCONN=30,t.WASI_EISDIR=31,t.WASI_ELOOP=32,t.WASI_EMFILE=33,t.WASI_EMLINK=34,t.WASI_EMSGSIZE=35,t.WASI_EMULTIHOP=36,t.WASI_ENAMETOOLONG=37,t.WASI_ENETDOWN=38,t.WASI_ENETRESET=39,t.WASI_ENETUNREACH=40,t.WASI_ENFILE=41,t.WASI_ENOBUFS=42,t.WASI_ENODEV=43,t.WASI_ENOENT=44,t.WASI_ENOEXEC=45,t.WASI_ENOLCK=46,t.WASI_ENOLINK=47,t.WASI_ENOMEM=48,t.WASI_ENOMSG=49,t.WASI_ENOPROTOOPT=50,t.WASI_ENOSPC=51,t.WASI_ENOSYS=52,t.WASI_ENOTCONN=53,t.WASI_ENOTDIR=54,t.WASI_ENOTEMPTY=55,t.WASI_ENOTRECOVERABLE=56,t.WASI_ENOTSOCK=57,t.WASI_ENOTSUP=58,t.WASI_ENOTTY=59,t.WASI_ENXIO=60,t.WASI_EOVERFLOW=61,t.WASI_EOWNERDEAD=62,t.WASI_EPERM=63,t.WASI_EPIPE=64,t.WASI_EPROTO=65,t.WASI_EPROTONOSUPPORT=66,t.WASI_EPROTOTYPE=67,t.WASI_ERANGE=68,t.WASI_EROFS=69,t.WASI_ESPIPE=70,t.WASI_ESRCH=71,t.WASI_ESTALE=72,t.WASI_ETIMEDOUT=73,t.WASI_ETXTBSY=74,t.WASI_EXDEV=75,t.WASI_ENOTCAPABLE=76,t.WASI_SIGABRT=0,t.WASI_SIGALRM=1,t.WASI_SIGBUS=2,t.WASI_SIGCHLD=3,t.WASI_SIGCONT=4,t.WASI_SIGFPE=5,t.WASI_SIGHUP=6,t.WASI_SIGILL=7,t.WASI_SIGINT=8,t.WASI_SIGKILL=9,t.WASI_SIGPIPE=10,t.WASI_SIGQUIT=11,t.WASI_SIGSEGV=12,t.WASI_SIGSTOP=13,t.WASI_SIGTERM=14,t.WASI_SIGTRAP=15,t.WASI_SIGTSTP=16,t.WASI_SIGTTIN=17,t.WASI_SIGTTOU=18,t.WASI_SIGURG=19,t.WASI_SIGUSR1=20,t.WASI_SIGUSR2=21,t.WASI_SIGVTALRM=22,t.WASI_SIGXCPU=23,t.WASI_SIGXFSZ=24,t.WASI_FILETYPE_UNKNOWN=0,t.WASI_FILETYPE_BLOCK_DEVICE=1,t.WASI_FILETYPE_CHARACTER_DEVICE=2,t.WASI_FILETYPE_DIRECTORY=3,t.WASI_FILETYPE_REGULAR_FILE=4,t.WASI_FILETYPE_SOCKET_DGRAM=5,t.WASI_FILETYPE_SOCKET_STREAM=6,t.WASI_FILETYPE_SYMBOLIC_LINK=7,t.WASI_FDFLAG_APPEND=1,t.WASI_FDFLAG_DSYNC=2,t.WASI_FDFLAG_NONBLOCK=4,t.WASI_FDFLAG_RSYNC=8,t.WASI_FDFLAG_SYNC=16,t.WASI_RIGHT_FD_DATASYNC=e.BigIntPolyfill(1),t.WASI_RIGHT_FD_READ=e.BigIntPolyfill(2),t.WASI_RIGHT_FD_SEEK=e.BigIntPolyfill(4),t.WASI_RIGHT_FD_FDSTAT_SET_FLAGS=e.BigIntPolyfill(8),t.WASI_RIGHT_FD_SYNC=e.BigIntPolyfill(16),t.WASI_RIGHT_FD_TELL=e.BigIntPolyfill(32),t.WASI_RIGHT_FD_WRITE=e.BigIntPolyfill(64),t.WASI_RIGHT_FD_ADVISE=e.BigIntPolyfill(128),t.WASI_RIGHT_FD_ALLOCATE=e.BigIntPolyfill(256),t.WASI_RIGHT_PATH_CREATE_DIRECTORY=e.BigIntPolyfill(512),t.WASI_RIGHT_PATH_CREATE_FILE=e.BigIntPolyfill(1024),t.WASI_RIGHT_PATH_LINK_SOURCE=e.BigIntPolyfill(2048),t.WASI_RIGHT_PATH_LINK_TARGET=e.BigIntPolyfill(4096),t.WASI_RIGHT_PATH_OPEN=e.BigIntPolyfill(8192),t.WASI_RIGHT_FD_READDIR=e.BigIntPolyfill(16384),t.WASI_RIGHT_PATH_READLINK=e.BigIntPolyfill(32768),t.WASI_RIGHT_PATH_RENAME_SOURCE=e.BigIntPolyfill(65536),t.WASI_RIGHT_PATH_RENAME_TARGET=e.BigIntPolyfill(131072),t.WASI_RIGHT_PATH_FILESTAT_GET=e.BigIntPolyfill(262144),t.WASI_RIGHT_PATH_FILESTAT_SET_SIZE=e.BigIntPolyfill(524288),t.WASI_RIGHT_PATH_FILESTAT_SET_TIMES=e.BigIntPolyfill(1048576),t.WASI_RIGHT_FD_FILESTAT_GET=e.BigIntPolyfill(2097152),t.WASI_RIGHT_FD_FILESTAT_SET_SIZE=e.BigIntPolyfill(4194304),t.WASI_RIGHT_FD_FILESTAT_SET_TIMES=e.BigIntPolyfill(8388608),t.WASI_RIGHT_PATH_SYMLINK=e.BigIntPolyfill(16777216),t.WASI_RIGHT_PATH_REMOVE_DIRECTORY=e.BigIntPolyfill(33554432),t.WASI_RIGHT_PATH_UNLINK_FILE=e.BigIntPolyfill(67108864),t.WASI_RIGHT_POLL_FD_READWRITE=e.BigIntPolyfill(134217728),t.WASI_RIGHT_SOCK_SHUTDOWN=e.BigIntPolyfill(268435456),t.RIGHTS_ALL=t.WASI_RIGHT_FD_DATASYNC|t.WASI_RIGHT_FD_READ|t.WASI_RIGHT_FD_SEEK|t.WASI_RIGHT_FD_FDSTAT_SET_FLAGS|t.WASI_RIGHT_FD_SYNC|t.WASI_RIGHT_FD_TELL|t.WASI_RIGHT_FD_WRITE|t.WASI_RIGHT_FD_ADVISE|t.WASI_RIGHT_FD_ALLOCATE|t.WASI_RIGHT_PATH_CREATE_DIRECTORY|t.WASI_RIGHT_PATH_CREATE_FILE|t.WASI_RIGHT_PATH_LINK_SOURCE|t.WASI_RIGHT_PATH_LINK_TARGET|t.WASI_RIGHT_PATH_OPEN|t.WASI_RIGHT_FD_READDIR|t.WASI_RIGHT_PATH_READLINK|t.WASI_RIGHT_PATH_RENAME_SOURCE|t.WASI_RIGHT_PATH_RENAME_TARGET|t.WASI_RIGHT_PATH_FILESTAT_GET|t.WASI_RIGHT_PATH_FILESTAT_SET_SIZE|t.WASI_RIGHT_PATH_FILESTAT_SET_TIMES|t.WASI_RIGHT_FD_FILESTAT_GET|t.WASI_RIGHT_FD_FILESTAT_SET_TIMES|t.WASI_RIGHT_FD_FILESTAT_SET_SIZE|t.WASI_RIGHT_PATH_SYMLINK|t.WASI_RIGHT_PATH_UNLINK_FILE|t.WASI_RIGHT_PATH_REMOVE_DIRECTORY|t.WASI_RIGHT_POLL_FD_READWRITE|t.WASI_RIGHT_SOCK_SHUTDOWN,t.RIGHTS_BLOCK_DEVICE_BASE=t.RIGHTS_ALL,t.RIGHTS_BLOCK_DEVICE_INHERITING=t.RIGHTS_ALL,t.RIGHTS_CHARACTER_DEVICE_BASE=t.RIGHTS_ALL,t.RIGHTS_CHARACTER_DEVICE_INHERITING=t.RIGHTS_ALL,t.RIGHTS_REGULAR_FILE_BASE=t.WASI_RIGHT_FD_DATASYNC|t.WASI_RIGHT_FD_READ|t.WASI_RIGHT_FD_SEEK|t.WASI_RIGHT_FD_FDSTAT_SET_FLAGS|t.WASI_RIGHT_FD_SYNC|t.WASI_RIGHT_FD_TELL|t.WASI_RIGHT_FD_WRITE|t.WASI_RIGHT_FD_ADVISE|t.WASI_RIGHT_FD_ALLOCATE|t.WASI_RIGHT_FD_FILESTAT_GET|t.WASI_RIGHT_FD_FILESTAT_SET_SIZE|t.WASI_RIGHT_FD_FILESTAT_SET_TIMES|t.WASI_RIGHT_POLL_FD_READWRITE,t.RIGHTS_REGULAR_FILE_INHERITING=e.BigIntPolyfill(0),t.RIGHTS_DIRECTORY_BASE=t.WASI_RIGHT_FD_FDSTAT_SET_FLAGS|t.WASI_RIGHT_FD_SYNC|t.WASI_RIGHT_FD_ADVISE|t.WASI_RIGHT_PATH_CREATE_DIRECTORY|t.WASI_RIGHT_PATH_CREATE_FILE|t.WASI_RIGHT_PATH_LINK_SOURCE|t.WASI_RIGHT_PATH_LINK_TARGET|t.WASI_RIGHT_PATH_OPEN|t.WASI_RIGHT_FD_READDIR|t.WASI_RIGHT_PATH_READLINK|t.WASI_RIGHT_PATH_RENAME_SOURCE|t.WASI_RIGHT_PATH_RENAME_TARGET|t.WASI_RIGHT_PATH_FILESTAT_GET|t.WASI_RIGHT_PATH_FILESTAT_SET_SIZE|t.WASI_RIGHT_PATH_FILESTAT_SET_TIMES|t.WASI_RIGHT_FD_FILESTAT_GET|t.WASI_RIGHT_FD_FILESTAT_SET_TIMES|t.WASI_RIGHT_PATH_SYMLINK|t.WASI_RIGHT_PATH_UNLINK_FILE|t.WASI_RIGHT_PATH_REMOVE_DIRECTORY|t.WASI_RIGHT_POLL_FD_READWRITE,t.RIGHTS_DIRECTORY_INHERITING=t.RIGHTS_DIRECTORY_BASE|t.RIGHTS_REGULAR_FILE_BASE,t.RIGHTS_SOCKET_BASE=t.WASI_RIGHT_FD_READ|t.WASI_RIGHT_FD_FDSTAT_SET_FLAGS|t.WASI_RIGHT_FD_WRITE|t.WASI_RIGHT_FD_FILESTAT_GET|t.WASI_RIGHT_POLL_FD_READWRITE|t.WASI_RIGHT_SOCK_SHUTDOWN,t.RIGHTS_SOCKET_INHERITING=t.RIGHTS_ALL,t.RIGHTS_TTY_BASE=t.WASI_RIGHT_FD_READ|t.WASI_RIGHT_FD_FDSTAT_SET_FLAGS|t.WASI_RIGHT_FD_WRITE|t.WASI_RIGHT_FD_FILESTAT_GET|t.WASI_RIGHT_POLL_FD_READWRITE,t.RIGHTS_TTY_INHERITING=e.BigIntPolyfill(0),t.WASI_CLOCK_REALTIME=0,t.WASI_CLOCK_MONOTONIC=1,t.WASI_CLOCK_PROCESS_CPUTIME_ID=2,t.WASI_CLOCK_THREAD_CPUTIME_ID=3,t.WASI_EVENTTYPE_CLOCK=0,t.WASI_EVENTTYPE_FD_READ=1,t.WASI_EVENTTYPE_FD_WRITE=2,t.WASI_FILESTAT_SET_ATIM=1<<0,t.WASI_FILESTAT_SET_ATIM_NOW=1<<1,t.WASI_FILESTAT_SET_MTIM=1<<2,t.WASI_FILESTAT_SET_MTIM_NOW=1<<3,t.WASI_O_CREAT=1<<0,t.WASI_O_DIRECTORY=1<<1,t.WASI_O_EXCL=1<<2,t.WASI_O_TRUNC=1<<3,t.WASI_PREOPENTYPE_DIR=0,t.WASI_DIRCOOKIE_START=0,t.WASI_STDIN_FILENO=0,t.WASI_STDOUT_FILENO=1,t.WASI_STDERR_FILENO=2,t.WASI_WHENCE_SET=0,t.WASI_WHENCE_CUR=1,t.WASI_WHENCE_END=2,t.ERROR_MAP={E2BIG:t.WASI_E2BIG,EACCES:t.WASI_EACCES,EADDRINUSE:t.WASI_EADDRINUSE,EADDRNOTAVAIL:t.WASI_EADDRNOTAVAIL,EAFNOSUPPORT:t.WASI_EAFNOSUPPORT,EALREADY:t.WASI_EALREADY,EAGAIN:t.WASI_EAGAIN,EBADF:t.WASI_EBADF,EBADMSG:t.WASI_EBADMSG,EBUSY:t.WASI_EBUSY,ECANCELED:t.WASI_ECANCELED,ECHILD:t.WASI_ECHILD,ECONNABORTED:t.WASI_ECONNABORTED,ECONNREFUSED:t.WASI_ECONNREFUSED,ECONNRESET:t.WASI_ECONNRESET,EDEADLOCK:t.WASI_EDEADLK,EDESTADDRREQ:t.WASI_EDESTADDRREQ,EDOM:t.WASI_EDOM,EDQUOT:t.WASI_EDQUOT,EEXIST:t.WASI_EEXIST,EFAULT:t.WASI_EFAULT,EFBIG:t.WASI_EFBIG,EHOSTDOWN:t.WASI_EHOSTUNREACH,EHOSTUNREACH:t.WASI_EHOSTUNREACH,EIDRM:t.WASI_EIDRM,EILSEQ:t.WASI_EILSEQ,EINPROGRESS:t.WASI_EINPROGRESS,EINTR:t.WASI_EINTR,EINVAL:t.WASI_EINVAL,EIO:t.WASI_EIO,EISCONN:t.WASI_EISCONN,EISDIR:t.WASI_EISDIR,ELOOP:t.WASI_ELOOP,EMFILE:t.WASI_EMFILE,EMLINK:t.WASI_EMLINK,EMSGSIZE:t.WASI_EMSGSIZE,EMULTIHOP:t.WASI_EMULTIHOP,ENAMETOOLONG:t.WASI_ENAMETOOLONG,ENETDOWN:t.WASI_ENETDOWN,ENETRESET:t.WASI_ENETRESET,ENETUNREACH:t.WASI_ENETUNREACH,ENFILE:t.WASI_ENFILE,ENOBUFS:t.WASI_ENOBUFS,ENODEV:t.WASI_ENODEV,ENOENT:t.WASI_ENOENT,ENOEXEC:t.WASI_ENOEXEC,ENOLCK:t.WASI_ENOLCK,ENOLINK:t.WASI_ENOLINK,ENOMEM:t.WASI_ENOMEM,ENOMSG:t.WASI_ENOMSG,ENOPROTOOPT:t.WASI_ENOPROTOOPT,ENOSPC:t.WASI_ENOSPC,ENOSYS:t.WASI_ENOSYS,ENOTCONN:t.WASI_ENOTCONN,ENOTDIR:t.WASI_ENOTDIR,ENOTEMPTY:t.WASI_ENOTEMPTY,ENOTRECOVERABLE:t.WASI_ENOTRECOVERABLE,ENOTSOCK:t.WASI_ENOTSOCK,ENOTTY:t.WASI_ENOTTY,ENXIO:t.WASI_ENXIO,EOVERFLOW:t.WASI_EOVERFLOW,EOWNERDEAD:t.WASI_EOWNERDEAD,EPERM:t.WASI_EPERM,EPIPE:t.WASI_EPIPE,EPROTO:t.WASI_EPROTO,EPROTONOSUPPORT:t.WASI_EPROTONOSUPPORT,EPROTOTYPE:t.WASI_EPROTOTYPE,ERANGE:t.WASI_ERANGE,EROFS:t.WASI_EROFS,ESPIPE:t.WASI_ESPIPE,ESRCH:t.WASI_ESRCH,ESTALE:t.WASI_ESTALE,ETIMEDOUT:t.WASI_ETIMEDOUT,ETXTBSY:t.WASI_ETXTBSY,EXDEV:t.WASI_EXDEV},t.SIGNAL_MAP={[t.WASI_SIGHUP]:"SIGHUP",[t.WASI_SIGINT]:"SIGINT",[t.WASI_SIGQUIT]:"SIGQUIT",[t.WASI_SIGILL]:"SIGILL",[t.WASI_SIGTRAP]:"SIGTRAP",[t.WASI_SIGABRT]:"SIGABRT",[t.WASI_SIGBUS]:"SIGBUS",[t.WASI_SIGFPE]:"SIGFPE",[t.WASI_SIGKILL]:"SIGKILL",[t.WASI_SIGUSR1]:"SIGUSR1",[t.WASI_SIGSEGV]:"SIGSEGV",[t.WASI_SIGUSR2]:"SIGUSR2",[t.WASI_SIGPIPE]:"SIGPIPE",[t.WASI_SIGALRM]:"SIGALRM",[t.WASI_SIGTERM]:"SIGTERM",[t.WASI_SIGCHLD]:"SIGCHLD",[t.WASI_SIGCONT]:"SIGCONT",[t.WASI_SIGSTOP]:"SIGSTOP",[t.WASI_SIGTSTP]:"SIGTSTP",[t.WASI_SIGTTIN]:"SIGTTIN",[t.WASI_SIGTTOU]:"SIGTTOU",[t.WASI_SIGURG]:"SIGURG",[t.WASI_SIGXCPU]:"SIGXCPU",[t.WASI_SIGXFSZ]:"SIGXFSZ",[t.WASI_SIGVTALRM]:"SIGVTALRM"}})(Nu),Object.defineProperty(sr,"__esModule",{value:!0});const st=Xr,pl=Xi,Bt=Ji;let Fu;const B=Nu,_l=B.WASI_RIGHT_FD_DATASYNC|B.WASI_RIGHT_FD_READ|B.WASI_RIGHT_FD_SYNC|B.WASI_RIGHT_FD_ADVISE|B.WASI_RIGHT_FD_FILESTAT_GET|B.WASI_RIGHT_POLL_FD_READWRITE,Lu=B.WASI_RIGHT_FD_DATASYNC|B.WASI_RIGHT_FD_WRITE|B.WASI_RIGHT_FD_SYNC|B.WASI_RIGHT_FD_ADVISE|B.WASI_RIGHT_FD_FILESTAT_GET|B.WASI_RIGHT_POLL_FD_READWRITE,yl=Lu,ur=t=>{const e=Math.trunc(t),r=st.BigIntPolyfill(Math.round((t-e)*1e6));return st.BigIntPolyfill(e)*st.BigIntPolyfill(1e6)+r},Nr=t=>{typeof t=="number"&&(t=Math.trunc(t));const e=st.BigIntPolyfill(t);return Number(e/st.BigIntPolyfill(1e6))},dt=t=>(...e)=>{try{return t(...e)}catch(r){if(r&&r.code&&typeof r.code=="string")return B.ERROR_MAP[r.code]||B.WASI_EINVAL;if(r instanceof Fr)return r.errno;throw r}},Cu=(t,e)=>{const r=t.FD_MAP.get(e);if(!r)throw new Fr(B.WASI_EBADF);if(r.filetype===void 0){const n=t.bindings.fs.fstatSync(r.real),{filetype:i,rightsBase:o,rightsInheriting:s}=Wu(t,e,n);r.filetype=i,r.rights||(r.rights={base:o,inheriting:s})}return r},Wu=(t,e,r)=>{switch(!0){case r.isBlockDevice():return{filetype:B.WASI_FILETYPE_BLOCK_DEVICE,rightsBase:B.RIGHTS_BLOCK_DEVICE_BASE,rightsInheriting:B.RIGHTS_BLOCK_DEVICE_INHERITING};case r.isCharacterDevice():{const n=B.WASI_FILETYPE_CHARACTER_DEVICE;return e!==void 0&&t.bindings.isTTY(e)?{filetype:n,rightsBase:B.RIGHTS_TTY_BASE,rightsInheriting:B.RIGHTS_TTY_INHERITING}:{filetype:n,rightsBase:B.RIGHTS_CHARACTER_DEVICE_BASE,rightsInheriting:B.RIGHTS_CHARACTER_DEVICE_INHERITING}}case r.isDirectory():return{filetype:B.WASI_FILETYPE_DIRECTORY,rightsBase:B.RIGHTS_DIRECTORY_BASE,rightsInheriting:B.RIGHTS_DIRECTORY_INHERITING};case r.isFIFO():return{filetype:B.WASI_FILETYPE_SOCKET_STREAM,rightsBase:B.RIGHTS_SOCKET_BASE,rightsInheriting:B.RIGHTS_SOCKET_INHERITING};case r.isFile():return{filetype:B.WASI_FILETYPE_REGULAR_FILE,rightsBase:B.RIGHTS_REGULAR_FILE_BASE,rightsInheriting:B.RIGHTS_REGULAR_FILE_INHERITING};case r.isSocket():return{filetype:B.WASI_FILETYPE_SOCKET_STREAM,rightsBase:B.RIGHTS_SOCKET_BASE,rightsInheriting:B.RIGHTS_SOCKET_INHERITING};case r.isSymbolicLink():return{filetype:B.WASI_FILETYPE_SYMBOLIC_LINK,rightsBase:st.BigIntPolyfill(0),rightsInheriting:st.BigIntPolyfill(0)};default:return{filetype:B.WASI_FILETYPE_UNKNOWN,rightsBase:st.BigIntPolyfill(0),rightsInheriting:st.BigIntPolyfill(0)}}};class Fr extends Error{constructor(e){super(),this.errno=e,Object.setPrototypeOf(this,Fr.prototype)}}sr.WASIError=Fr;class Zi extends Error{constructor(e){super(`WASI Exit error: ${e}`),this.code=e,Object.setPrototypeOf(this,Zi.prototype)}}sr.WASIExitError=Zi;class Qi extends Error{constructor(e){super(`WASI Kill signal: ${e}`),this.signal=e,Object.setPrototypeOf(this,Qi.prototype)}}sr.WASIKillError=Qi;class bi{constructor(e){let r={};e&&e.preopens?r=e.preopens:e&&e.preopenDirectories&&(r=e.preopenDirectories);let n={};e&&e.env&&(n=e.env);let i=[];e&&e.args&&(i=e.args);let o=Fu;e&&e.bindings&&(o=e.bindings),this.memory=void 0,this.view=void 0,this.bindings=o,this.FD_MAP=new Map([[B.WASI_STDIN_FILENO,{real:0,filetype:B.WASI_FILETYPE_CHARACTER_DEVICE,rights:{base:_l,inheriting:st.BigIntPolyfill(0)},path:void 0}],[B.WASI_STDOUT_FILENO,{real:1,filetype:B.WASI_FILETYPE_CHARACTER_DEVICE,rights:{base:Lu,inheriting:st.BigIntPolyfill(0)},path:void 0}],[B.WASI_STDERR_FILENO,{real:2,filetype:B.WASI_FILETYPE_CHARACTER_DEVICE,rights:{base:yl,inheriting:st.BigIntPolyfill(0)},path:void 0}]]);let s=this.bindings.fs,u=this.bindings.path;for(const[I,S]of Object.entries(r)){const L=s.openSync(S,s.constants.O_RDONLY),G=[...this.FD_MAP.keys()].reverse()[0]+1;this.FD_MAP.set(G,{real:L,filetype:B.WASI_FILETYPE_DIRECTORY,rights:{base:B.RIGHTS_DIRECTORY_BASE,inheriting:B.RIGHTS_DIRECTORY_INHERITING},fakePath:I,path:S})}const m=(I,S)=>(this.refreshMemory(),Array.from({length:S},(G,Y)=>{const b=I+Y*8,tt=this.view.getUint32(b,!0),X=this.view.getUint32(b+4,!0);return new Uint8Array(this.memory.buffer,tt,X)})),g=(I,S)=>{const L=Cu(this,I);if(S!==st.BigIntPolyfill(0)&&(L.rights.base&S)===st.BigIntPolyfill(0))throw new Fr(B.WASI_EPERM);return L},E=o.hrtime(),w=I=>{switch(I){case B.WASI_CLOCK_MONOTONIC:return o.hrtime();case B.WASI_CLOCK_REALTIME:return ur(Date.now());case B.WASI_CLOCK_PROCESS_CPUTIME_ID:case B.WASI_CLOCK_THREAD_CPUTIME_ID:return o.hrtime()-E;default:return null}};this.wasiImport={args_get:(I,S)=>{this.refreshMemory();let L=I,G=S;return i.forEach(Y=>{this.view.setUint32(L,G,!0),L+=4,G+=Bt.default.from(this.memory.buffer).write(`${Y}\0`,G)}),B.WASI_ESUCCESS},args_sizes_get:(I,S)=>{this.refreshMemory(),this.view.setUint32(I,i.length,!0);const L=i.reduce((G,Y)=>G+Bt.default.byteLength(Y)+1,0);return this.view.setUint32(S,L,!0),B.WASI_ESUCCESS},environ_get:(I,S)=>{this.refreshMemory();let L=I,G=S;return Object.entries(n).forEach(([Y,b])=>{this.view.setUint32(L,G,!0),L+=4,G+=Bt.default.from(this.memory.buffer).write(`${Y}=${b}\0`,G)}),B.WASI_ESUCCESS},environ_sizes_get:(I,S)=>{this.refreshMemory();const L=Object.entries(n).map(([Y,b])=>`${Y}=${b}\0`),G=L.reduce((Y,b)=>Y+Bt.default.byteLength(b),0);return this.view.setUint32(I,L.length,!0),this.view.setUint32(S,G,!0),B.WASI_ESUCCESS},clock_res_get:(I,S)=>{let L;switch(I){case B.WASI_CLOCK_MONOTONIC:case B.WASI_CLOCK_PROCESS_CPUTIME_ID:case B.WASI_CLOCK_THREAD_CPUTIME_ID:{L=st.BigIntPolyfill(1);break}case B.WASI_CLOCK_REALTIME:{L=st.BigIntPolyfill(1e3);break}}return this.view.setBigUint64(S,L),B.WASI_ESUCCESS},clock_time_get:(I,S,L)=>{this.refreshMemory();const G=w(I);return G===null?B.WASI_EINVAL:(this.view.setBigUint64(L,st.BigIntPolyfill(G),!0),B.WASI_ESUCCESS)},fd_advise:dt((I,S,L,G)=>(g(I,B.WASI_RIGHT_FD_ADVISE),B.WASI_ENOSYS)),fd_allocate:dt((I,S,L)=>(g(I,B.WASI_RIGHT_FD_ALLOCATE),B.WASI_ENOSYS)),fd_close:dt(I=>{const S=g(I,st.BigIntPolyfill(0));return s.closeSync(S.real),this.FD_MAP.delete(I),B.WASI_ESUCCESS}),fd_datasync:dt(I=>{const S=g(I,B.WASI_RIGHT_FD_DATASYNC);return s.fdatasyncSync(S.real),B.WASI_ESUCCESS}),fd_fdstat_get:dt((I,S)=>{const L=g(I,st.BigIntPolyfill(0));return this.refreshMemory(),this.view.setUint8(S,L.filetype),this.view.setUint16(S+2,0,!0),this.view.setUint16(S+4,0,!0),this.view.setBigUint64(S+8,st.BigIntPolyfill(L.rights.base),!0),this.view.setBigUint64(S+8+8,st.BigIntPolyfill(L.rights.inheriting),!0),B.WASI_ESUCCESS}),fd_fdstat_set_flags:dt((I,S)=>(g(I,B.WASI_RIGHT_FD_FDSTAT_SET_FLAGS),B.WASI_ENOSYS)),fd_fdstat_set_rights:dt((I,S,L)=>{const G=g(I,st.BigIntPolyfill(0));return(G.rights.base|S)>G.rights.base||(G.rights.inheriting|L)>G.rights.inheriting?B.WASI_EPERM:(G.rights.base=S,G.rights.inheriting=L,B.WASI_ESUCCESS)}),fd_filestat_get:dt((I,S)=>{const L=g(I,B.WASI_RIGHT_FD_FILESTAT_GET),G=s.fstatSync(L.real);return this.refreshMemory(),this.view.setBigUint64(S,st.BigIntPolyfill(G.dev),!0),S+=8,this.view.setBigUint64(S,st.BigIntPolyfill(G.ino),!0),S+=8,this.view.setUint8(S,L.filetype),S+=8,this.view.setBigUint64(S,st.BigIntPolyfill(G.nlink),!0),S+=8,this.view.setBigUint64(S,st.BigIntPolyfill(G.size),!0),S+=8,this.view.setBigUint64(S,ur(G.atimeMs),!0),S+=8,this.view.setBigUint64(S,ur(G.mtimeMs),!0),S+=8,this.view.setBigUint64(S,ur(G.ctimeMs),!0),B.WASI_ESUCCESS}),fd_filestat_set_size:dt((I,S)=>{const L=g(I,B.WASI_RIGHT_FD_FILESTAT_SET_SIZE);return s.ftruncateSync(L.real,Number(S)),B.WASI_ESUCCESS}),fd_filestat_set_times:dt((I,S,L,G)=>{const Y=g(I,B.WASI_RIGHT_FD_FILESTAT_SET_TIMES),b=s.fstatSync(Y.real);let tt=b.atime,X=b.mtime;const et=Nr(w(B.WASI_CLOCK_REALTIME)),nt=B.WASI_FILESTAT_SET_ATIM|B.WASI_FILESTAT_SET_ATIM_NOW;if((G&nt)===nt)return B.WASI_EINVAL;const R=B.WASI_FILESTAT_SET_MTIM|B.WASI_FILESTAT_SET_MTIM_NOW;return(G&R)===R?B.WASI_EINVAL:((G&B.WASI_FILESTAT_SET_ATIM)===B.WASI_FILESTAT_SET_ATIM?tt=Nr(S):(G&B.WASI_FILESTAT_SET_ATIM_NOW)===B.WASI_FILESTAT_SET_ATIM_NOW&&(tt=et),(G&B.WASI_FILESTAT_SET_MTIM)===B.WASI_FILESTAT_SET_MTIM?X=Nr(L):(G&B.WASI_FILESTAT_SET_MTIM_NOW)===B.WASI_FILESTAT_SET_MTIM_NOW&&(X=et),s.futimesSync(Y.real,new Date(tt),new Date(X)),B.WASI_ESUCCESS)}),fd_prestat_get:dt((I,S)=>{const L=g(I,st.BigIntPolyfill(0));return L.path?(this.refreshMemory(),this.view.setUint8(S,B.WASI_PREOPENTYPE_DIR),this.view.setUint32(S+4,Bt.default.byteLength(L.fakePath),!0),B.WASI_ESUCCESS):B.WASI_EINVAL}),fd_prestat_dir_name:dt((I,S,L)=>{const G=g(I,st.BigIntPolyfill(0));return G.path?(this.refreshMemory(),Bt.default.from(this.memory.buffer).write(G.fakePath,S,L,"utf8"),B.WASI_ESUCCESS):B.WASI_EINVAL}),fd_pwrite:dt((I,S,L,G,Y)=>{const b=g(I,B.WASI_RIGHT_FD_WRITE|B.WASI_RIGHT_FD_SEEK);let tt=0;return m(S,L).forEach(X=>{let et=0;for(;et{const Y=g(I,B.WASI_RIGHT_FD_WRITE);let b=0;return m(S,L).forEach(tt=>{let X=0;for(;X{const b=g(I,B.WASI_RIGHT_FD_READ|B.WASI_RIGHT_FD_SEEK);let tt=0;t:for(const X of m(S,L)){let et=0;for(;et{const Y=g(I,B.WASI_RIGHT_FD_READ),b=Y.real===0;let tt=0;t:for(const X of m(S,L)){let et=0;for(;et{const b=g(I,B.WASI_RIGHT_FD_READDIR);this.refreshMemory();const tt=s.readdirSync(b.path,{withFileTypes:!0}),X=S;for(let nt=Number(G);ntL||(this.view.setBigUint64(S,st.BigIntPolyfill(nt+1),!0),S+=8,S-X>L))break;const k=s.statSync(u.resolve(b.path,R.name));if(this.view.setBigUint64(S,st.BigIntPolyfill(k.ino),!0),S+=8,S-X>L||(this.view.setUint32(S,C,!0),S+=4,S-X>L))break;let $;switch(!0){case k.isBlockDevice():$=B.WASI_FILETYPE_BLOCK_DEVICE;break;case k.isCharacterDevice():$=B.WASI_FILETYPE_CHARACTER_DEVICE;break;case k.isDirectory():$=B.WASI_FILETYPE_DIRECTORY;break;case k.isFIFO():$=B.WASI_FILETYPE_SOCKET_STREAM;break;case k.isFile():$=B.WASI_FILETYPE_REGULAR_FILE;break;case k.isSocket():$=B.WASI_FILETYPE_SOCKET_STREAM;break;case k.isSymbolicLink():$=B.WASI_FILETYPE_SYMBOLIC_LINK;break;default:$=B.WASI_FILETYPE_UNKNOWN;break}if(this.view.setUint8(S,$),S+=1,S+=3,S+C>=X+L)break;Bt.default.from(this.memory.buffer).write(R.name,S),S+=C}const et=S-X;return this.view.setUint32(Y,Math.min(et,L),!0),B.WASI_ESUCCESS}),fd_renumber:dt((I,S)=>(g(I,st.BigIntPolyfill(0)),g(S,st.BigIntPolyfill(0)),s.closeSync(this.FD_MAP.get(I).real),this.FD_MAP.set(I,this.FD_MAP.get(S)),this.FD_MAP.delete(S),B.WASI_ESUCCESS)),fd_seek:dt((I,S,L,G)=>{const Y=g(I,B.WASI_RIGHT_FD_SEEK);switch(this.refreshMemory(),L){case B.WASI_WHENCE_CUR:Y.offset=(Y.offset?Y.offset:st.BigIntPolyfill(0))+st.BigIntPolyfill(S);break;case B.WASI_WHENCE_END:const{size:b}=s.fstatSync(Y.real);Y.offset=st.BigIntPolyfill(b)+st.BigIntPolyfill(S);break;case B.WASI_WHENCE_SET:Y.offset=st.BigIntPolyfill(S);break}return this.view.setBigUint64(G,Y.offset,!0),B.WASI_ESUCCESS}),fd_tell:dt((I,S)=>{const L=g(I,B.WASI_RIGHT_FD_TELL);return this.refreshMemory(),L.offset||(L.offset=st.BigIntPolyfill(0)),this.view.setBigUint64(S,L.offset,!0),B.WASI_ESUCCESS}),fd_sync:dt(I=>{const S=g(I,B.WASI_RIGHT_FD_SYNC);return s.fsyncSync(S.real),B.WASI_ESUCCESS}),path_create_directory:dt((I,S,L)=>{const G=g(I,B.WASI_RIGHT_PATH_CREATE_DIRECTORY);if(!G.path)return B.WASI_EINVAL;this.refreshMemory();const Y=Bt.default.from(this.memory.buffer,S,L).toString();return s.mkdirSync(u.resolve(G.path,Y)),B.WASI_ESUCCESS}),path_filestat_get:dt((I,S,L,G,Y)=>{const b=g(I,B.WASI_RIGHT_PATH_FILESTAT_GET);if(!b.path)return B.WASI_EINVAL;this.refreshMemory();const tt=Bt.default.from(this.memory.buffer,L,G).toString(),X=s.statSync(u.resolve(b.path,tt));return this.view.setBigUint64(Y,st.BigIntPolyfill(X.dev),!0),Y+=8,this.view.setBigUint64(Y,st.BigIntPolyfill(X.ino),!0),Y+=8,this.view.setUint8(Y,Wu(this,void 0,X).filetype),Y+=8,this.view.setBigUint64(Y,st.BigIntPolyfill(X.nlink),!0),Y+=8,this.view.setBigUint64(Y,st.BigIntPolyfill(X.size),!0),Y+=8,this.view.setBigUint64(Y,ur(X.atimeMs),!0),Y+=8,this.view.setBigUint64(Y,ur(X.mtimeMs),!0),Y+=8,this.view.setBigUint64(Y,ur(X.ctimeMs),!0),B.WASI_ESUCCESS}),path_filestat_set_times:dt((I,S,L,G,Y,b,tt)=>{const X=g(I,B.WASI_RIGHT_PATH_FILESTAT_SET_TIMES);if(!X.path)return B.WASI_EINVAL;this.refreshMemory();const et=s.fstatSync(X.real);let nt=et.atime,R=et.mtime;const C=Nr(w(B.WASI_CLOCK_REALTIME)),k=B.WASI_FILESTAT_SET_ATIM|B.WASI_FILESTAT_SET_ATIM_NOW;if((tt&k)===k)return B.WASI_EINVAL;const $=B.WASI_FILESTAT_SET_MTIM|B.WASI_FILESTAT_SET_MTIM_NOW;if((tt&$)===$)return B.WASI_EINVAL;(tt&B.WASI_FILESTAT_SET_ATIM)===B.WASI_FILESTAT_SET_ATIM?nt=Nr(Y):(tt&B.WASI_FILESTAT_SET_ATIM_NOW)===B.WASI_FILESTAT_SET_ATIM_NOW&&(nt=C),(tt&B.WASI_FILESTAT_SET_MTIM)===B.WASI_FILESTAT_SET_MTIM?R=Nr(b):(tt&B.WASI_FILESTAT_SET_MTIM_NOW)===B.WASI_FILESTAT_SET_MTIM_NOW&&(R=C);const j=Bt.default.from(this.memory.buffer,L,G).toString();return s.utimesSync(u.resolve(X.path,j),new Date(nt),new Date(R)),B.WASI_ESUCCESS}),path_link:dt((I,S,L,G,Y,b,tt)=>{const X=g(I,B.WASI_RIGHT_PATH_LINK_SOURCE),et=g(Y,B.WASI_RIGHT_PATH_LINK_TARGET);if(!X.path||!et.path)return B.WASI_EINVAL;this.refreshMemory();const nt=Bt.default.from(this.memory.buffer,L,G).toString(),R=Bt.default.from(this.memory.buffer,b,tt).toString();return s.linkSync(u.resolve(X.path,nt),u.resolve(et.path,R)),B.WASI_ESUCCESS}),path_open:dt((I,S,L,G,Y,b,tt,X,et)=>{const nt=g(I,B.WASI_RIGHT_PATH_OPEN);b=st.BigIntPolyfill(b),tt=st.BigIntPolyfill(tt);const R=(b&(B.WASI_RIGHT_FD_READ|B.WASI_RIGHT_FD_READDIR))!==st.BigIntPolyfill(0),C=(b&(B.WASI_RIGHT_FD_DATASYNC|B.WASI_RIGHT_FD_WRITE|B.WASI_RIGHT_FD_ALLOCATE|B.WASI_RIGHT_FD_FILESTAT_SET_SIZE))!==st.BigIntPolyfill(0);let k;C&&R?k=s.constants.O_RDWR:R?k=s.constants.O_RDONLY:C&&(k=s.constants.O_WRONLY);let $=b|B.WASI_RIGHT_PATH_OPEN,j=b|tt;Y&B.WASI_O_CREAT&&(k|=s.constants.O_CREAT,$|=B.WASI_RIGHT_PATH_CREATE_FILE),Y&B.WASI_O_DIRECTORY&&(k|=s.constants.O_DIRECTORY),Y&B.WASI_O_EXCL&&(k|=s.constants.O_EXCL),Y&B.WASI_O_TRUNC&&(k|=s.constants.O_TRUNC,$|=B.WASI_RIGHT_PATH_FILESTAT_SET_SIZE),X&B.WASI_FDFLAG_APPEND&&(k|=s.constants.O_APPEND),X&B.WASI_FDFLAG_DSYNC&&(s.constants.O_DSYNC?k|=s.constants.O_DSYNC:k|=s.constants.O_SYNC,j|=B.WASI_RIGHT_FD_DATASYNC),X&B.WASI_FDFLAG_NONBLOCK&&(k|=s.constants.O_NONBLOCK),X&B.WASI_FDFLAG_RSYNC&&(s.constants.O_RSYNC?k|=s.constants.O_RSYNC:k|=s.constants.O_SYNC,j|=B.WASI_RIGHT_FD_SYNC),X&B.WASI_FDFLAG_SYNC&&(k|=s.constants.O_SYNC,j|=B.WASI_RIGHT_FD_SYNC),C&&!(k&(s.constants.O_APPEND|s.constants.O_TRUNC))&&(j|=B.WASI_RIGHT_FD_SEEK),this.refreshMemory();const J=Bt.default.from(this.memory.buffer,L,G).toString(),rt=u.resolve(nt.path,J);if(u.relative(nt.path,rt).startsWith(".."))return B.WASI_ENOTCAPABLE;let ot;try{if(ot=s.realpathSync(rt),u.relative(nt.path,ot).startsWith(".."))return B.WASI_ENOTCAPABLE}catch(at){if(at.code==="ENOENT")ot=rt;else throw at}let it;try{it=s.statSync(ot).isDirectory()}catch{}let ut;!C&&it?ut=s.openSync(ot,s.constants.O_RDONLY):ut=s.openSync(ot,k);const ft=[...this.FD_MAP.keys()].reverse()[0]+1;return this.FD_MAP.set(ft,{real:ut,filetype:void 0,rights:{base:$,inheriting:j},path:ot}),Cu(this,ft),this.view.setUint32(et,ft,!0),B.WASI_ESUCCESS}),path_readlink:dt((I,S,L,G,Y,b)=>{const tt=g(I,B.WASI_RIGHT_PATH_READLINK);if(!tt.path)return B.WASI_EINVAL;this.refreshMemory();const X=Bt.default.from(this.memory.buffer,S,L).toString(),et=u.resolve(tt.path,X),nt=s.readlinkSync(et),R=Bt.default.from(this.memory.buffer).write(nt,G,Y);return this.view.setUint32(b,R,!0),B.WASI_ESUCCESS}),path_remove_directory:dt((I,S,L)=>{const G=g(I,B.WASI_RIGHT_PATH_REMOVE_DIRECTORY);if(!G.path)return B.WASI_EINVAL;this.refreshMemory();const Y=Bt.default.from(this.memory.buffer,S,L).toString();return s.rmdirSync(u.resolve(G.path,Y)),B.WASI_ESUCCESS}),path_rename:dt((I,S,L,G,Y,b)=>{const tt=g(I,B.WASI_RIGHT_PATH_RENAME_SOURCE),X=g(G,B.WASI_RIGHT_PATH_RENAME_TARGET);if(!tt.path||!X.path)return B.WASI_EINVAL;this.refreshMemory();const et=Bt.default.from(this.memory.buffer,S,L).toString(),nt=Bt.default.from(this.memory.buffer,Y,b).toString();return s.renameSync(u.resolve(tt.path,et),u.resolve(X.path,nt)),B.WASI_ESUCCESS}),path_symlink:dt((I,S,L,G,Y)=>{const b=g(L,B.WASI_RIGHT_PATH_SYMLINK);if(!b.path)return B.WASI_EINVAL;this.refreshMemory();const tt=Bt.default.from(this.memory.buffer,I,S).toString(),X=Bt.default.from(this.memory.buffer,G,Y).toString();return s.symlinkSync(tt,u.resolve(b.path,X)),B.WASI_ESUCCESS}),path_unlink_file:dt((I,S,L)=>{const G=g(I,B.WASI_RIGHT_PATH_UNLINK_FILE);if(!G.path)return B.WASI_EINVAL;this.refreshMemory();const Y=Bt.default.from(this.memory.buffer,S,L).toString();return s.unlinkSync(u.resolve(G.path,Y)),B.WASI_ESUCCESS}),poll_oneoff:(I,S,L,G)=>{let Y=0,b=0;this.refreshMemory();for(let tt=0;ttb?J:b}this.view.setBigUint64(S,X,!0),S+=8,this.view.setUint16(S,$,!0),S+=2,this.view.setUint8(S,B.WASI_EVENTTYPE_CLOCK),S+=1,S+=5,Y+=1;break}case B.WASI_EVENTTYPE_FD_READ:case B.WASI_EVENTTYPE_FD_WRITE:{I+=3,this.view.getUint32(I,!0),I+=4,this.view.setBigUint64(S,X,!0),S+=8,this.view.setUint16(S,B.WASI_ENOSYS,!0),S+=2,this.view.setUint8(S,et),S+=1,S+=5,Y+=1;break}default:return B.WASI_EINVAL}}for(this.view.setUint32(G,Y,!0);o.hrtime()(o.exit(I),B.WASI_ESUCCESS),proc_raise:I=>I in B.SIGNAL_MAP?(o.kill(B.SIGNAL_MAP[I]),B.WASI_ESUCCESS):B.WASI_EINVAL,random_get:(I,S)=>(this.refreshMemory(),o.randomFillSync(new Uint8Array(this.memory.buffer),I,S),B.WASI_ESUCCESS),sched_yield(){return B.WASI_ESUCCESS},sock_recv(){return B.WASI_ENOSYS},sock_send(){return B.WASI_ENOSYS},sock_shutdown(){return B.WASI_ENOSYS}},e.traceSyscalls&&Object.keys(this.wasiImport).forEach(I=>{const S=this.wasiImport[I];this.wasiImport[I]=function(...L){console.log(`WASI: wasiImport called: ${I} (${L})`);try{let G=S(...L);return console.log(`WASI: => ${G}`),G}catch(G){throw console.log(`Catched error: ${G}`),G}}})}refreshMemory(){(!this.view||this.view.buffer.byteLength===0)&&(this.view=new pl.DataViewPolyfill(this.memory.buffer))}setMemory(e){this.memory=e}start(e){const r=e.exports;if(r===null||typeof r!="object")throw new Error(`instance.exports must be an Object. Received ${r}.`);const{memory:n}=r;if(!(n instanceof WebAssembly.Memory))throw new Error(`instance.exports.memory must be a WebAssembly.Memory. Recceived ${n}.`);this.setMemory(n),r._start&&r._start()}getImportNamespace(e){let r=null;for(let n of WebAssembly.Module.imports(e))if(n.kind==="function"&&n.module.startsWith("wasi_")){if(!r)r=n.module;else if(r!==n.module)throw new Error("Multiple namespaces detected.")}return r}getImports(e){switch(this.getImportNamespace(e)){case"wasi_unstable":return{wasi_unstable:this.wasiImport};case"wasi_snapshot_preview1":return{wasi_snapshot_preview1:this.wasiImport};default:throw new Error("Can't detect a WASI namespace for the WebAssembly Module")}}}sr.default=bi,bi.defaultBindings=Fu,sr.WASI=bi;var to={};Object.defineProperty(to,"__esModule",{value:!0});const gl=1e9,dl=t=>e=>{const r=t(e);return r[0]*gl+r[1]};to.default=dl,Object.defineProperty(gu,"__esModule",{value:!0});const El=zr,ml=qi,Sl=hl,Uu=sr,Il={hrtime:to.default(ml.default),exit:t=>{throw new Uu.WASIExitError(t)},kill:t=>{throw new Uu.WASIKillError(t)},randomFillSync:El.randomFillSync,isTTY:()=>!0,path:Sl,fs:null};var wl=gu.default=Il;const Al=(t=>{if(typeof t!="object"||t===null)return t;const e=Symbol.toStringTag in t&&t[Symbol.toStringTag]==="Module"?t.default??t:t;return"__esModule"in e&&e.__esModule&&e.default!==void 0?e.default:e})(wl);function Tl(t){return new Df({args:[],env:Object.fromEntries(t),bindings:{...Al,fs:new Qh().fs}})}function vl(t,e){return Ol(t)?e.getImports(t):{}}function Rl(t,e){t.setMemory(e.exports.memory)}function Ol(t){return WebAssembly.Module.imports(t).find(n=>n.module==="wasi_snapshot_preview1"||n.module==="wasi_unstable")!==void 0}async function Du(t){let e;const r=new Array(128).fill(void 0);r.push(void 0,null,!0,!1);let n=r.length;function i(U){n===r.length&&r.push(r.length+1);const N=n;if(n=r[N],typeof n!="number")throw new Error("corrupt heap");return r[N]=U,N}function o(U){return r[U]}function s(U){U<132||(r[U]=n,n=U)}function u(U){const N=o(U);return s(U),N}function m(U){const N=typeof U;if(N=="number"||N=="boolean"||U==null)return`${U}`;if(N=="string")return`"${U}"`;if(N=="symbol"){const q=U.description;return q==null?"Symbol":`Symbol(${q})`}if(N=="function"){const q=U.name;return typeof q=="string"&&q.length>0?`Function(${q})`:"Function"}if(Array.isArray(U)){const q=U.length;let _t="[";q>0&&(_t+=m(U[0]));for(let mt=1;mt1)x=P[1];else return toString.call(U);if(x=="Object")try{return"Object("+JSON.stringify(U)+")"}catch{return"Object"}return U instanceof Error?`${U.name}: ${U.message} ${U.stack}`:x}const g=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});g.decode();let E=null;function w(){return(E===null||E.byteLength===0)&&(E=new Float64Array(e.memory.buffer)),E}let I=null;function S(){return(I===null||I.byteLength===0)&&(I=new BigInt64Array(e.memory.buffer)),I}let L=new Uint8Array;function G(){return L.byteLength===0&&(L=new Uint8Array(e.memory.buffer)),L}function Y(U,N){return U=U>>>0,g.decode(G().subarray(U,U+N))}let b=0;const tt=new TextEncoder("utf-8"),X=typeof tt.encodeInto=="function"?function(U,N){return tt.encodeInto(U,N)}:function(U,N){const P=tt.encode(U);return N.set(P),{read:U.length,written:P.length}};function et(U,N,P){if(P===void 0){const wt=tt.encode(U),Vt=N(wt.length,1)>>>0;return G().subarray(Vt,Vt+wt.length).set(wt),b=wt.length,Vt}let x=U.length,q=N(x,1)>>>0;const _t=G();let mt=0;for(;mt127)break;_t[q+mt]=wt}if(mt!==x){mt!==0&&(U=U.slice(mt)),q=P(q,x,x=mt+U.length*3,1)>>>0;const wt=G().subarray(q+mt,q+x),Vt=X(U,wt);mt+=Vt.written}return b=mt,q}let nt=new Int32Array;function R(U,N,P,x){const q={a:U,b:N,cnt:1,dtor:P},_t=(...mt)=>{q.cnt++;const wt=q.a;q.a=0;try{return x(wt,q.b,...mt)}finally{--q.cnt===0?e.__wbindgen_export_2.get(q.dtor)(wt,q.b):q.a=wt}};return _t.original=q,_t}let C=128;function k(U){if(C==1)throw new Error("out of js stack");return r[--C]=U,C}function $(U,N,P){try{const x=e._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h456d3b24afa0f1f3(U,N,k(P));return u(x)}finally{r[C++]=void 0}}function j(){return nt.byteLength===0&&(nt=new Int32Array(e.memory.buffer)),nt}function J(U,N){try{return U.apply(this,N)}catch(P){e.__wbindgen_exn_store(i(P))}}function rt(U){return U==null}function ot(U,N,P){try{const _t=e.__wbindgen_add_to_stack_pointer(-16);e.register_module(_t,i(U),i(N),i(P));var x=j()[_t/4+0],q=j()[_t/4+1];if(q)throw u(x)}finally{e.__wbindgen_add_to_stack_pointer(16)}}function it(U,N,P,x){let q,_t;try{const Kt=e.__wbindgen_add_to_stack_pointer(-16),Gt=et(U,e.__wbindgen_malloc,e.__wbindgen_realloc),Pt=b,At=et(N,e.__wbindgen_malloc,e.__wbindgen_realloc),zt=b,je=et(P,e.__wbindgen_malloc,e.__wbindgen_realloc),A=b;e.call_module(Kt,Gt,Pt,At,zt,je,A,i(x));var mt=j()[Kt/4+0],wt=j()[Kt/4+1],Vt=j()[Kt/4+2],Ye=j()[Kt/4+3],It=mt,ne=wt;if(Ye)throw It=0,ne=0,u(Vt);return q=It,_t=ne,Y(It,ne)}finally{e.__wbindgen_add_to_stack_pointer(16),e.__wbindgen_free(q,_t,1)}}function ut(){const U={};return U.wbg={},U.wbg.__wbg_new_898a68150f225f2e=function(){const N=new Array;return i(N)},U.wbg.__wbg_apply_f9ecfcbfefaf7349=function(){return J(function(N,P,x){const q=Reflect.apply(o(N),o(P),o(x));return i(q)},arguments)},U.wbg.__wbindgen_string_new=function(N,P){const x=Y(N,P);return i(x)},U.wbg.__wbg_log_576ca876af0d4a77=function(N,P){console.log(o(N),o(P))},U.wbg.__wbindgen_object_drop_ref=function(N){u(N)},U.wbg.__wbindgen_object_clone_ref=function(N){const P=o(N);return i(P)},U.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return i(Symbol.iterator)},U.wbg.__wbg_get_97b561fb56f034b5=function(){return J(function(N,P){const x=Reflect.get(o(N),o(P));return i(x)},arguments)},U.wbg.__wbindgen_is_function=function(N){return typeof o(N)=="function"},U.wbg.__wbg_call_cb65541d95d71282=function(){return J(function(N,P){const x=o(N).call(o(P));return i(x)},arguments)},U.wbg.__wbindgen_is_object=function(N){const P=o(N);return typeof P=="object"&&P!==null},U.wbg.__wbg_next_526fc47e980da008=function(N){const P=o(N).next;return i(P)},U.wbg.__wbindgen_memory=function(){const N=e.memory;return i(N)},U.wbg.__wbg_buffer_085ec1f694018c4f=function(N){const P=o(N).buffer;return i(P)},U.wbg.__wbg_new_8125e318e6245eed=function(N){const P=new Uint8Array(o(N));return i(P)},U.wbg.__wbg_set_5cf90238115182c3=function(N,P,x){o(N).set(o(P),x>>>0)},U.wbg.__wbg_length_72e2208bbc0efc61=function(N){return o(N).length},U.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa=function(N,P,x){const q=new Uint8Array(o(N),P>>>0,x>>>0);return i(q)},U.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(N,P){const x=o(N)[o(P)];return i(x)},U.wbg.__wbindgen_is_undefined=function(N){return o(N)===void 0},U.wbg.__wbindgen_in=function(N,P){return o(N)in o(P)},U.wbg.__wbg_setindex_24de8908d99d47eb=function(N,P,x){o(N)[P>>>0]=x},U.wbg.__wbg_newwithlength_e5d69174d6984cd7=function(N){const P=new Uint8Array(N>>>0);return i(P)},U.wbg.__wbg_new_553093d7f6eb5551=function(){return J(function(N){const P=new WebAssembly.Module(o(N));return i(P)},arguments)},U.wbg.__wbg_new_56693dbed0c32988=function(){return i(new Map)},U.wbg.__wbg_set_bedc3d02d0f05eb0=function(N,P,x){const q=o(N).set(o(P),o(x));return i(q)},U.wbg.__wbg_createwasi_4e512e33ff502e0b=function(N){const P=Tl(u(N));return i(P)},U.wbg.__wbindgen_jsval_loose_eq=function(N,P){return o(N)==o(P)},U.wbg.__wbindgen_number_get=function(N,P){const x=o(P),q=typeof x=="number"?x:void 0;w()[N/8+1]=rt(q)?0:q,j()[N/4+0]=!rt(q)},U.wbg.__wbg_isSafeInteger_bb8e18dd21c97288=function(N){return Number.isSafeInteger(o(N))},U.wbg.__wbg_isArray_4c24b343cb13cfb1=function(N){return Array.isArray(o(N))},U.wbg.__wbg_length_fff51ee6522a1a18=function(N){return o(N).length},U.wbg.__wbg_get_44be0491f933a435=function(N,P){const x=o(N)[P>>>0];return i(x)},U.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return J(function(N){const P=o(N).next();return i(P)},arguments)},U.wbg.__wbg_done_5c1f01fb660d73b5=function(N){return o(N).done},U.wbg.__wbg_value_1695675138684bd5=function(N){const P=o(N).value;return i(P)},U.wbg.__wbindgen_boolean_get=function(N){const P=o(N);return typeof P=="boolean"?P?1:0:2},U.wbg.__wbg_byteLength_0488a7a303dccf40=function(N){return o(N).byteLength},U.wbg.__wbg_getindex_961202524f8271d6=function(N,P){return o(N)[P>>>0]},U.wbg.__wbg_new_b51585de1b234aff=function(){const N=new Object;return i(N)},U.wbg.__wbg_set_841ac57cff3d672b=function(N,P,x){o(N)[u(P)]=u(x)},U.wbg.__wbg_push_ca1c26067ef907ac=function(N,P){return o(N).push(o(P))},U.wbg.__wbg_error_c9309504864e78b5=function(N,P){console.error(o(N),o(P))},U.wbg.__wbg_log_53ed96ea72ace5e9=function(N,P){console.log(Y(N,P))},U.wbg.__wbg_error_93b671ae91baaee7=function(N,P){console.error(Y(N,P))},U.wbg.__wbg_warn_52c5b3e773c3a056=function(N,P){console.warn(Y(N,P))},U.wbg.__wbindgen_error_new=function(N,P){const x=new Error(Y(N,P));return i(x)},U.wbg.__wbg_entries_e51f29c7bba0c054=function(N){const P=Object.entries(o(N));return i(P)},U.wbg.__wbg_keys_386d224d0262f361=function(N){const P=Object.keys(o(N));return i(P)},U.wbg.__wbindgen_is_string=function(N){return typeof o(N)=="string"},U.wbg.__wbindgen_string_get=function(N,P){const x=o(P),q=typeof x=="string"?x:void 0;var _t=rt(q)?0:et(q,e.__wbindgen_malloc,e.__wbindgen_realloc),mt=b;j()[N/4+1]=mt,j()[N/4+0]=_t},U.wbg.__wbindgen_number_new=function(N){return i(N)},U.wbg.__wbindgen_bigint_from_i64=function(N){return i(N)},U.wbg.__wbindgen_bigint_get_as_i64=function(N,P){const x=o(P),q=typeof x=="bigint"?x:void 0;S()[N/8+1]=rt(q)?BigInt(0):q,j()[N/4+0]=!rt(q)},U.wbg.__wbindgen_jsval_eq=function(N,P){return o(N)===o(P)},U.wbg.__wbg_generatewasiimports_56d8e071d0378317=function(N,P){const x=vl(o(N),o(P));return i(x)},U.wbg.__wbg_set_092e06b0f9d71865=function(){return J(function(N,P,x){return Reflect.set(o(N),o(P),o(x))},arguments)},U.wbg.__wbg_log_1d3ae0273d8f4f8a=function(N){console.log(o(N))},U.wbg.__wbg_new_c9e5fb776850b9aa=function(){return J(function(N,P){const x=new WebAssembly.Instance(o(N),o(P));return i(x)},arguments)},U.wbg.__wbg_bindtoinstance_72627d6cd6c160b6=function(N,P){Rl(o(N),o(P))},U.wbg.__wbg_exports_9484b00cdfd311fc=function(N){const P=o(N).exports;return i(P)},U.wbg.__wbg_subarray_13db269f57aa838d=function(N,P,x){const q=o(N).subarray(P>>>0,x>>>0);return i(q)},U.wbg.__wbg_newwithargs_a0432b7780c1dfa1=function(N,P,x,q){const _t=new Function(Y(N,P),Y(x,q));return i(_t)},U.wbg.__wbg_bind_f9d2c8ec337bbbe7=function(N,P,x){const q=o(N).bind(o(P),o(x));return i(q)},U.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(N){let P;try{P=o(N)instanceof Uint8Array}catch{P=!1}return P},U.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(N){let P;try{P=o(N)instanceof ArrayBuffer}catch{P=!1}return P},U.wbg.__wbg_String_88810dfeb4021902=function(N,P){const x=String(o(P)),q=et(x,e.__wbindgen_malloc,e.__wbindgen_realloc),_t=b;j()[N/4+1]=_t,j()[N/4+0]=q},U.wbg.__wbindgen_debug_string=function(N,P){const x=m(o(P)),q=et(x,e.__wbindgen_malloc,e.__wbindgen_realloc),_t=b;j()[N/4+1]=_t,j()[N/4+0]=q},U.wbg.__wbindgen_throw=function(N,P){throw new Error(Y(N,P))},U.wbg.__wbindgen_closure_wrapper1408=function(N,P,x){const q=R(N,P,130,$);return i(q)},U}function ft(U,N){return e=U.exports,Du.__wbindgen_wasm_module=N,nt=new Int32Array,L=new Uint8Array,e.__wbindgen_start(),e}async function at(U){const N=ut(),P=await WebAssembly.instantiate(U,N);return ft(P,t)}return await at(t),{wasm:e,register_module:ot,call_module:it}}class Bl{constructor(e,r,n,i,o,s){Ve(this,"controlModule");Ve(this,"serviceId");Ve(this,"logFunction");Ve(this,"serviceConfig");Ve(this,"modules");Ve(this,"env",{});Ve(this,"_controlModuleInstance","not-set");this.controlModule=e,this.serviceId=r,this.logFunction=n,this.serviceConfig=i,this.modules=o,this.serviceConfig.modules_config.forEach(u=>{u.config.wasi.envs={WASM_LOG:"off",...s,...u.config.wasi.envs}})}async init(){const e=await Du(this.controlModule);e.register_module(this.serviceConfig,this.modules,this.logFunction),this._controlModuleInstance=e}terminate(){this._controlModuleInstance="not-set"}call(e,r,n){if(this._controlModuleInstance==="not-set")throw new Error("Not initialized");if(this._controlModuleInstance==="terminated")throw new Error("Terminated");const i=this.serviceConfig.modules_config[this.serviceConfig.modules_config.length-1].import_name,o=JSON.stringify(r),s=this._controlModuleInstance.call_module(i,e,o,n);return JSON.parse(s)}}const Pu=()=>typeof Symbol=="function",eo=t=>Pu()&&Boolean(Symbol[t]),ro=t=>eo(t)?Symbol[t]:"@@"+t;eo("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const Nl=ro("iterator"),no=ro("observable"),Mu=ro("species");function Wn(t,e){const r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Jr(t){let e=t.constructor;return e!==void 0&&(e=e[Mu],e===null&&(e=void 0)),e!==void 0?e:Be}function Fl(t){return t instanceof Be}function Lr(t){Lr.log?Lr.log(t):setTimeout(()=>{throw t},0)}function Un(t){Promise.resolve().then(()=>{try{t()}catch(e){Lr(e)}})}function ku(t){const e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{const r=Wn(e,"unsubscribe");r&&r.call(e)}}catch(r){Lr(r)}}function io(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Ll(t){const e=t._queue;if(e){t._queue=void 0,t._state="ready";for(const r of e)if(Gu(t,r.type,r.value),t._state==="closed")break}}function Gu(t,e,r){t._state="running";const n=t._observer;try{const i=n?Wn(n,e):void 0;switch(e){case"next":i&&i.call(n,r);break;case"error":if(io(t),i)i.call(n,r);else throw r;break;case"complete":io(t),i&&i.call(n);break}}catch(i){Lr(i)}t._state==="closed"?ku(t):t._state==="running"&&(t._state="ready")}function oo(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue=t._queue||[],t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],Un(()=>Ll(t));return}Gu(t,e,r)}}class Cl{constructor(e,r){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const n=new Wl(this);try{this._cleanup=r.call(void 0,n)}catch(i){n.error(i)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(io(this),ku(this))}}class Wl{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){oo(this._subscription,"next",e)}error(e){oo(this._subscription,"error",e)}complete(){oo(this._subscription,"complete")}}class Be{constructor(e){if(!(this instanceof Be))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,r,n){return(typeof e!="object"||e===null)&&(e={next:e,error:r,complete:n}),new Cl(e,this._subscriber)}pipe(e,...r){let n=this;for(const i of[e,...r])n=i(n);return n}tap(e,r,n){const i=typeof e!="object"||e===null?{next:e,error:r,complete:n}:e;return new Be(o=>this.subscribe({next(s){i.next&&i.next(s),o.next(s)},error(s){i.error&&i.error(s),o.error(s)},complete(){i.complete&&i.complete(),o.complete()},start(s){i.start&&i.start(s)}}))}forEach(e){return new Promise((r,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function i(){o.unsubscribe(),r(void 0)}const o=this.subscribe({next(s){try{e(s,i)}catch(u){n(u),o.unsubscribe()}},error(s){n(s)},complete(){r(void 0)}})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Jr(this);return new r(n=>this.subscribe({next(i){let o=i;try{o=e(i)}catch(s){return n.error(s)}n.next(o)},error(i){n.error(i)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Jr(this);return new r(n=>this.subscribe({next(i){try{if(!e(i))return}catch(o){return n.error(o)}n.next(i)},error(i){n.error(i)},complete(){n.complete()}}))}reduce(e,r){if(typeof e!="function")throw new TypeError(e+" is not a function");const n=Jr(this),i=arguments.length>1;let o=!1,s=r;return new n(u=>this.subscribe({next(m){const g=!o;if(o=!0,!g||i)try{s=e(s,m)}catch(E){return u.error(E)}else s=m},error(m){u.error(m)},complete(){if(!o&&!i)return u.error(new TypeError("Cannot reduce an empty sequence"));u.next(s),u.complete()}}))}concat(...e){const r=Jr(this);return new r(n=>{let i,o=0;function s(u){i=u.subscribe({next(m){n.next(m)},error(m){n.error(m)},complete(){o===e.length?(i=void 0,n.complete()):s(r.from(e[o++]))}})}return s(this),()=>{i&&(i.unsubscribe(),i=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Jr(this);return new r(n=>{const i=[],o=this.subscribe({next(u){let m;if(e)try{m=e(u)}catch(E){return n.error(E)}else m=u;const g=r.from(m).subscribe({next(E){n.next(E)},error(E){n.error(E)},complete(){const E=i.indexOf(g);E>=0&&i.splice(E,1),s()}});i.push(g)},error(u){n.error(u)},complete(){s()}});function s(){o.closed&&i.length===0&&n.complete()}return()=>{i.forEach(u=>u.unsubscribe()),o.unsubscribe()}})}[no](){return this}static from(e){const r=typeof this=="function"?this:Be;if(e==null)throw new TypeError(e+" is not an object");const n=Wn(e,no);if(n){const i=n.call(e);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Fl(i)&&i.constructor===r?i:new r(o=>i.subscribe(o))}if(eo("iterator")){const i=Wn(e,Nl);if(i)return new r(o=>{Un(()=>{if(!o.closed){for(const s of i.call(e))if(o.next(s),o.closed)return;o.complete()}})})}if(Array.isArray(e))return new r(i=>{Un(()=>{if(!i.closed){for(const o of e)if(i.next(o),i.closed)return;i.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){const r=typeof this=="function"?this:Be;return new r(n=>{Un(()=>{if(!n.closed){for(const i of e)if(n.next(i),n.closed)return;n.complete()}})})}static get[Mu](){return this}}Pu()&&Object.defineProperty(Be,Symbol("extensions"),{value:{symbol:no,hostReportError:Lr},configurable:!0});const xu=Be;class Ul extends xu{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(const r of this._observers)r.next(e)}error(e){for(const r of this._observers)r.error(e)}complete(){for(const e of this._observers)e.complete()}}const Dl=Ul,Hu={deserialize(t){return Object.assign(Error(t.message),{name:t.name,stack:t.stack})},serialize(t){return{__error_marker:"$$error",message:t.message,name:t.name,stack:t.stack}}},Pl=t=>t&&typeof t=="object"&&"__error_marker"in t&&t.__error_marker==="$$error";let Yu={deserialize(t){return Pl(t)?Hu.deserialize(t):t},serialize(t){return t instanceof Error?Hu.serialize(t):t}};function ju(t){return Yu.deserialize(t)}function Cr(t){return Yu.serialize(t)}const Ml=Symbol("thread.transferable");function kl(t){return t&&typeof t=="object"&&t[Ml]}var Dn;(function(t){t.cancel="cancel",t.run="run"})(Dn||(Dn={}));var xe;(function(t){t.error="error",t.init="init",t.result="result",t.running="running",t.uncaughtError="uncaughtError"})(xe||(xe={}));var Gl=t=>t?typeof Symbol.observable=="symbol"&&typeof t[Symbol.observable]=="function"?t===t[Symbol.observable]():typeof t["@@observable"]=="function"?t===t["@@observable"]():!1:!1;const re={isWorkerRuntime:function(){const e=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!e)},postMessageToMaster:function(e,r){self.postMessage(e,r)},subscribeToMasterMessages:function(e){const r=i=>{e(i.data)},n=()=>{self.removeEventListener("message",r)};return self.addEventListener("message",r),n}};var xl=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(E){try{g(n.next(E))}catch(w){s(w)}}function m(E){try{g(n.throw(E))}catch(w){s(w)}}function g(E){E.done?o(E.value):i(E.value).then(u,m)}g((n=n.apply(t,e||[])).next())})};let $u=!1;const Zr=new Map,Hl=t=>t&&t.type===Dn.cancel,Vu=t=>t&&t.type===Dn.run,Ku=t=>Gl(t)||Yl(t);function Yl(t){return t&&typeof t=="object"&&typeof t.subscribe=="function"}function zu(t){return kl(t)?{payload:t.send,transferables:t.transferables}:{payload:t,transferables:void 0}}function jl(){const t={type:xe.init,exposed:{type:"function"}};re.postMessageToMaster(t)}function $l(t){const e={type:xe.init,exposed:{type:"module",methods:t}};re.postMessageToMaster(e)}function so(t,e){const{payload:r,transferables:n}=zu(e),i={type:xe.error,uid:t,error:Cr(r)};re.postMessageToMaster(i,n)}function uo(t,e,r){const{payload:n,transferables:i}=zu(r),o={type:xe.result,uid:t,complete:e?!0:void 0,payload:n};re.postMessageToMaster(o,i)}function Vl(t,e){const r={type:xe.running,uid:t,resultType:e};re.postMessageToMaster(r)}function Pn(t){try{const e={type:xe.uncaughtError,error:Cr(t)};re.postMessageToMaster(e)}catch(e){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already. Latest error:`,e,` Original error:`,t)}}function qu(t,e,r){return xl(this,void 0,void 0,function*(){let n;try{n=e(...r)}catch(o){return so(t,o)}const i=Ku(n)?"observable":"promise";if(Vl(t,i),Ku(n)){const o=n.subscribe(s=>uo(t,!1,Cr(s)),s=>{so(t,Cr(s)),Zr.delete(t)},()=>{uo(t,!0),Zr.delete(t)});Zr.set(t,o)}else try{const o=yield n;uo(t,!0,Cr(o))}catch(o){so(t,Cr(o))}})}function Kl(t){if(!re.isWorkerRuntime())throw Error("expose() called in the master thread.");if($u)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if($u=!0,typeof t=="function")re.subscribeToMasterMessages(e=>{Vu(e)&&!e.method&&qu(e.uid,t,e.args.map(ju))}),jl();else if(typeof t=="object"&&t){re.subscribeToMasterMessages(r=>{Vu(r)&&r.method&&qu(r.uid,t[r.method],r.args.map(ju))});const e=Object.keys(t).filter(r=>typeof t[r]=="function");$l(e)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${t}`);re.subscribeToMasterMessages(e=>{if(Hl(e)){const r=e.uid,n=Zr.get(r);n&&(n.unsubscribe(),Zr.delete(r))}})}typeof self<"u"&&typeof self.addEventListener=="function"&&re.isWorkerRuntime()&&(self.addEventListener("error",t=>{setTimeout(()=>Pn(t.error||t),250)}),self.addEventListener("unhandledrejection",t=>{const e=t.reason;e&&typeof e.message=="string"&&setTimeout(()=>Pn(e),250)})),typeof oe<"u"&&typeof oe.on=="function"&&re.isWorkerRuntime()&&(oe.on("uncaughtException",t=>{setTimeout(()=>Pn(t),250)}),oe.on("unhandledRejection",t=>{t&&typeof t.message=="string"&&setTimeout(()=>Pn(t),250)}));const zl=(t,e)=>({import_name:t,config:{logger_enabled:!0,logging_mask:0,wasi:{envs:{...e},preopened_files:new Set,mapped_dirs:new Map}}}),ql=(t,e)=>({modules_config:[zl(t,e)]});let He=new Map,fo;const Mn=new Dl;Kl({init:async t=>{fo=new WebAssembly.Module(new Uint8Array(t))},createService:async(t,e,r)=>{if(!fo)throw new Error("MarineJS is not initialized. To initialize call `init` function");if(He.has(e))throw new Error(`Service with name ${e} already registered`);const n=ql(e,r),i={[e]:new Uint8Array(t)},o=new Bl(fo,e,Mn.next.bind(Mn),n,i,r);await o.init(),He.set(e,o)},hasService:async t=>He.has(t),removeService:async t=>{var e;if(t==="avm")throw new Error("Cannot remove 'avm' service");return(e=He.get(t))==null||e.terminate(),He.delete(t)},terminate:async()=>{He.forEach((t,e)=>{t.terminate()}),He.clear(),Mn.complete()},callService:async(t,e,r,n)=>{const i=He.get(t);if(!i)throw new Error(`service with id=${t} not found`);return i.call(e,r,n)},onLogMessage(){return xu.from(Mn)}})});