x)&&(g=x);let D="";for(let A=h;Ag&&(p=g),h<0?(h+=g,h<0&&(h=0)):h>g&&(h=g),hg)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(p,h,g){p=p>>>0,h=h>>>0,g||ce(p,h,this.length);let x=this[p],D=1,A=0;for(;++A>>0,h=h>>>0,g||ce(p,h,this.length);let x=this[p+--h],D=1;for(;h>0&&(D*=256);)x+=this[p+--h]*D;return x},o.prototype.readUint8=o.prototype.readUInt8=function(p,h){return p=p>>>0,h||ce(p,1,this.length),this[p]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(p,h){return p=p>>>0,h||ce(p,2,this.length),this[p]|this[p+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(p,h){return p=p>>>0,h||ce(p,2,this.length),this[p]<<8|this[p+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(p,h){return p=p>>>0,h||ce(p,4,this.length),(this[p]|this[p+1]<<8|this[p+2]<<16)+this[p+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(p,h){return p=p>>>0,h||ce(p,4,this.length),this[p]*16777216+(this[p+1]<<16|this[p+2]<<8|this[p+3])},o.prototype.readBigUInt64LE=pe(function(p){p=p>>>0,re(p,"offset");let h=this[p],g=this[p+7];(h===void 0||g===void 0)&&_(p,this.length-8);let x=h+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24,D=this[++p]+this[++p]*2**8+this[++p]*2**16+g*2**24;return BigInt(x)+(BigInt(D)<>>0,re(p,"offset");let h=this[p],g=this[p+7];(h===void 0||g===void 0)&&_(p,this.length-8);let x=h*2**24+this[++p]*2**16+this[++p]*2**8+this[++p],D=this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+g;return(BigInt(x)<>>0,h=h>>>0,g||ce(p,h,this.length);let x=this[p],D=1,A=0;for(;++A=D&&(x-=Math.pow(2,8*h)),x},o.prototype.readIntBE=function(p,h,g){p=p>>>0,h=h>>>0,g||ce(p,h,this.length);let x=h,D=1,A=this[p+--x];for(;x>0&&(D*=256);)A+=this[p+--x]*D;return D*=128,A>=D&&(A-=Math.pow(2,8*h)),A},o.prototype.readInt8=function(p,h){return p=p>>>0,h||ce(p,1,this.length),this[p]&128?(255-this[p]+1)*-1:this[p]},o.prototype.readInt16LE=function(p,h){p=p>>>0,h||ce(p,2,this.length);let g=this[p]|this[p+1]<<8;return g&32768?g|4294901760:g},o.prototype.readInt16BE=function(p,h){p=p>>>0,h||ce(p,2,this.length);let g=this[p+1]|this[p]<<8;return g&32768?g|4294901760:g},o.prototype.readInt32LE=function(p,h){return p=p>>>0,h||ce(p,4,this.length),this[p]|this[p+1]<<8|this[p+2]<<16|this[p+3]<<24},o.prototype.readInt32BE=function(p,h){return p=p>>>0,h||ce(p,4,this.length),this[p]<<24|this[p+1]<<16|this[p+2]<<8|this[p+3]},o.prototype.readBigInt64LE=pe(function(p){p=p>>>0,re(p,"offset");let h=this[p],g=this[p+7];(h===void 0||g===void 0)&&_(p,this.length-8);let x=this[p+4]+this[p+5]*2**8+this[p+6]*2**16+(g<<24);return(BigInt(x)<>>0,re(p,"offset");let h=this[p],g=this[p+7];(h===void 0||g===void 0)&&_(p,this.length-8);let x=(h<<24)+this[++p]*2**16+this[++p]*2**8+this[++p];return(BigInt(x)<>>0,h||ce(p,4,this.length),t.read(this,p,!0,23,4)},o.prototype.readFloatBE=function(p,h){return p=p>>>0,h||ce(p,4,this.length),t.read(this,p,!1,23,4)},o.prototype.readDoubleLE=function(p,h){return p=p>>>0,h||ce(p,8,this.length),t.read(this,p,!0,52,8)},o.prototype.readDoubleBE=function(p,h){return p=p>>>0,h||ce(p,8,this.length),t.read(this,p,!1,52,8)};function _e(p,h,g,x,D,A){if(!o.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(h>D||hp.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(p,h,g,x){if(p=+p,h=h>>>0,g=g>>>0,!x){let $=Math.pow(2,8*g)-1;_e(this,p,h,g,$,0)}let D=1,A=0;for(this[h]=p&255;++A>>0,g=g>>>0,!x){let $=Math.pow(2,8*g)-1;_e(this,p,h,g,$,0)}let D=g-1,A=1;for(this[h+D]=p&255;--D>=0&&(A*=256);)this[h+D]=p/A&255;return h+g},o.prototype.writeUint8=o.prototype.writeUInt8=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,1,255,0),this[h]=p&255,h+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,2,65535,0),this[h]=p&255,this[h+1]=p>>>8,h+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,2,65535,0),this[h]=p>>>8,this[h+1]=p&255,h+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,4,4294967295,0),this[h+3]=p>>>24,this[h+2]=p>>>16,this[h+1]=p>>>8,this[h]=p&255,h+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,4,4294967295,0),this[h]=p>>>24,this[h+1]=p>>>16,this[h+2]=p>>>8,this[h+3]=p&255,h+4};function j(p,h,g,x,D){te(h,x,D,p,g,7);let A=Number(h&BigInt(4294967295));p[g++]=A,A=A>>8,p[g++]=A,A=A>>8,p[g++]=A,A=A>>8,p[g++]=A;let $=Number(h>>BigInt(32)&BigInt(4294967295));return p[g++]=$,$=$>>8,p[g++]=$,$=$>>8,p[g++]=$,$=$>>8,p[g++]=$,g}function se(p,h,g,x,D){te(h,x,D,p,g,7);let A=Number(h&BigInt(4294967295));p[g+7]=A,A=A>>8,p[g+6]=A,A=A>>8,p[g+5]=A,A=A>>8,p[g+4]=A;let $=Number(h>>BigInt(32)&BigInt(4294967295));return p[g+3]=$,$=$>>8,p[g+2]=$,$=$>>8,p[g+1]=$,$=$>>8,p[g]=$,g+8}o.prototype.writeBigUInt64LE=pe(function(p,h=0){return j(this,p,h,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=pe(function(p,h=0){return se(this,p,h,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(p,h,g,x){if(p=+p,h=h>>>0,!x){let ne=Math.pow(2,8*g-1);_e(this,p,h,g,ne-1,-ne)}let D=0,A=1,$=0;for(this[h]=p&255;++D>0)-$&255;return h+g},o.prototype.writeIntBE=function(p,h,g,x){if(p=+p,h=h>>>0,!x){let ne=Math.pow(2,8*g-1);_e(this,p,h,g,ne-1,-ne)}let D=g-1,A=1,$=0;for(this[h+D]=p&255;--D>=0&&(A*=256);)p<0&&$===0&&this[h+D+1]!==0&&($=1),this[h+D]=(p/A>>0)-$&255;return h+g},o.prototype.writeInt8=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,1,127,-128),p<0&&(p=255+p+1),this[h]=p&255,h+1},o.prototype.writeInt16LE=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,2,32767,-32768),this[h]=p&255,this[h+1]=p>>>8,h+2},o.prototype.writeInt16BE=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,2,32767,-32768),this[h]=p>>>8,this[h+1]=p&255,h+2},o.prototype.writeInt32LE=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,4,2147483647,-2147483648),this[h]=p&255,this[h+1]=p>>>8,this[h+2]=p>>>16,this[h+3]=p>>>24,h+4},o.prototype.writeInt32BE=function(p,h,g){return p=+p,h=h>>>0,g||_e(this,p,h,4,2147483647,-2147483648),p<0&&(p=4294967295+p+1),this[h]=p>>>24,this[h+1]=p>>>16,this[h+2]=p>>>8,this[h+3]=p&255,h+4},o.prototype.writeBigInt64LE=pe(function(p,h=0){return j(this,p,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=pe(function(p,h=0){return se(this,p,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function fe(p,h,g,x,D,A){if(g+x>p.length)throw new RangeError("Index out of range");if(g<0)throw new RangeError("Index out of range")}function Ae(p,h,g,x,D){return h=+h,g=g>>>0,D||fe(p,h,g,4),t.write(p,h,g,x,23,4),g+4}o.prototype.writeFloatLE=function(p,h,g){return Ae(this,p,h,!0,g)},o.prototype.writeFloatBE=function(p,h,g){return Ae(this,p,h,!1,g)};function ue(p,h,g,x,D){return h=+h,g=g>>>0,D||fe(p,h,g,8),t.write(p,h,g,x,52,8),g+8}o.prototype.writeDoubleLE=function(p,h,g){return ue(this,p,h,!0,g)},o.prototype.writeDoubleBE=function(p,h,g){return ue(this,p,h,!1,g)},o.prototype.copy=function(p,h,g,x){if(!o.isBuffer(p))throw new TypeError("argument should be a Buffer");if(g||(g=0),!x&&x!==0&&(x=this.length),h>=p.length&&(h=p.length),h||(h=0),x>0&&x=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),p.length-h>>0,g=g===void 0?this.length:g>>>0,p||(p=0);let D;if(typeof p=="number")for(D=h;D2**32?D=q(String(g)):typeof g=="bigint"&&(D=String(g),(g>BigInt(2)**BigInt(32)||g<-(BigInt(2)**BigInt(32)))&&(D=q(D)),D+="n"),x+=` It must be ${h}. Received ${D}`,x},RangeError);function q(p){let h="",g=p.length,x=p[0]==="-"?1:0;for(;g>=x+4;g-=3)h=`_${p.slice(g-3,g)}${h}`;return`${p.slice(0,g)}${h}`}function X(p,h,g){re(h,"offset"),(p[h]===void 0||p[h+g]===void 0)&&_(h,p.length-(g+1))}function te(p,h,g,x,D,A){if(p>g||p3?h===0||h===BigInt(0)?ne=`>= 0${$} and < 2${$} ** ${(A+1)*8}${$}`:ne=`>= -(2${$} ** ${(A+1)*8-1}${$}) and < 2 ** ${(A+1)*8-1}${$}`:ne=`>= ${h}${$} and <= ${g}${$}`,new E.ERR_OUT_OF_RANGE("value",ne,p)}X(x,D,A)}function re(p,h){if(typeof p!="number")throw new E.ERR_INVALID_ARG_TYPE(h,"number",p)}function _(p,h,g){throw Math.floor(p)!==p?(re(p,g),new E.ERR_OUT_OF_RANGE(g||"offset","an integer",p)):h<0?new E.ERR_BUFFER_OUT_OF_BOUNDS:new E.ERR_OUT_OF_RANGE(g||"offset",`>= ${g?1:0} and <= ${h}`,p)}let P=/[^+/0-9A-Za-z-_]/g;function w(p){if(p=p.split("=")[0],p=p.trim().replace(P,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function M(p,h){h=h||1/0;let g,x=p.length,D=null,A=[];for(let $=0;$55295&&g<57344){if(!D){if(g>56319){(h-=3)>-1&&A.push(239,191,189);continue}else if($+1===x){(h-=3)>-1&&A.push(239,191,189);continue}D=g;continue}if(g<56320){(h-=3)>-1&&A.push(239,191,189),D=g;continue}g=(D-55296<<10|g-56320)+65536}else D&&(h-=3)>-1&&A.push(239,191,189);if(D=null,g<128){if((h-=1)<0)break;A.push(g)}else if(g<2048){if((h-=2)<0)break;A.push(g>>6|192,g&63|128)}else if(g<65536){if((h-=3)<0)break;A.push(g>>12|224,g>>6&63|128,g&63|128)}else if(g<1114112){if((h-=4)<0)break;A.push(g>>18|240,g>>12&63|128,g>>6&63|128,g&63|128)}else throw new Error("Invalid code point")}return A}function k(p){let h=[];for(let g=0;g>8,D=g%256,A.push(D),A.push(x);return A}function K(p){return e.toByteArray(w(p))}function L(p,h,g,x){let D;for(D=0;D=h.length||D>=p.length);++D)h[D+g]=p[D];return D}function V(p,h){return p instanceof h||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===h.name}function J(p){return p!==p}let le=function(){let p="0123456789abcdef",h=new Array(256);for(let g=0;g<16;++g){let x=g*16;for(let D=0;D<16;++D)h[x+D]=p[g]+p[D]}return h}();function pe(p){return typeof BigInt>"u"?Se:p}function Se(){throw new Error("BigInt not supported")}return Cr}var Tn,Fa,Zn,$a,Cr,Wa,sr,Ln,Lh,Nh,dt=lt(()=>{ye(),ve(),be(),Tn={},Fa=!1,Zn={},$a=!1,Cr={},Wa=!1,sr=bb(),sr.Buffer,sr.SlowBuffer,sr.INSPECT_MAX_BYTES,sr.kMaxLength,Ln=sr.Buffer,Lh=sr.INSPECT_MAX_BYTES,Nh=sr.kMaxLength}),ve=lt(()=>{dt()}),vb=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0});var t=class{constructor(r){this.aliasToTopic={},this.max=r}put(r,n){return n===0||n>this.max?!1:(this.aliasToTopic[n]=r,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(r){return this.aliasToTopic[r]}clear(){this.aliasToTopic={}}};e.default=t}),it=Ee((e,t)=>{ye(),ve(),be(),t.exports={ArrayIsArray(r){return Array.isArray(r)},ArrayPrototypeIncludes(r,n){return r.includes(n)},ArrayPrototypeIndexOf(r,n){return r.indexOf(n)},ArrayPrototypeJoin(r,n){return r.join(n)},ArrayPrototypeMap(r,n){return r.map(n)},ArrayPrototypePop(r,n){return r.pop(n)},ArrayPrototypePush(r,n){return r.push(n)},ArrayPrototypeSlice(r,n,a){return r.slice(n,a)},Error,FunctionPrototypeCall(r,n,...a){return r.call(n,...a)},FunctionPrototypeSymbolHasInstance(r,n){return Function.prototype[Symbol.hasInstance].call(r,n)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(r,n){return Object.defineProperties(r,n)},ObjectDefineProperty(r,n,a){return Object.defineProperty(r,n,a)},ObjectGetOwnPropertyDescriptor(r,n){return Object.getOwnPropertyDescriptor(r,n)},ObjectKeys(r){return Object.keys(r)},ObjectSetPrototypeOf(r,n){return Object.setPrototypeOf(r,n)},Promise,PromisePrototypeCatch(r,n){return r.catch(n)},PromisePrototypeThen(r,n,a){return r.then(n,a)},PromiseReject(r){return Promise.reject(r)},ReflectApply:Reflect.apply,RegExpPrototypeTest(r,n){return r.test(n)},SafeSet:Set,String,StringPrototypeSlice(r,n,a){return r.slice(n,a)},StringPrototypeToLowerCase(r){return r.toLowerCase()},StringPrototypeToUpperCase(r){return r.toUpperCase()},StringPrototypeTrim(r){return r.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(r,n,a){return r.set(n,a)},Uint8Array}}),dr=Ee((e,t)=>{ye(),ve(),be();var r=(dt(),De(ht)),n=Object.getPrototypeOf(async function(){}).constructor,a=globalThis.Blob||r.Blob,i=typeof a<"u"?function(l){return l instanceof a}:function(l){return!1},o=class extends Error{constructor(l){if(!Array.isArray(l))throw new TypeError(`Expected input to be an Array, got ${typeof l}`);let s="";for(let u=0;u{l=u,s=c}),resolve:l,reject:s}},promisify(l){return new Promise((s,u)=>{l((c,...f)=>c?u(c):s(...f))})},debuglog(){return function(){}},format(l,...s){return l.replace(/%([sdifj])/g,function(...[u,c]){let f=s.shift();return c==="f"?f.toFixed(6):c==="j"?JSON.stringify(f):c==="s"&&typeof f=="object"?`${f.constructor!==Object?f.constructor.name:""} {}`.trim():f.toString()})},inspect(l){switch(typeof l){case"string":if(l.includes("'"))if(l.includes('"')){if(!l.includes("`")&&!l.includes("${"))return`\`${l}\``}else return`"${l}"`;return`'${l}'`;case"number":return isNaN(l)?"NaN":Object.is(l,-0)?String(l):l;case"bigint":return`${String(l)}n`;case"boolean":case"undefined":return String(l);case"object":return"{}"}},types:{isAsyncFunction(l){return l instanceof n},isArrayBufferView(l){return ArrayBuffer.isView(l)}},isBlob:i},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),Nl=Ee((e,t)=>{ye(),ve(),be();var{AbortController:r,AbortSignal:n}=typeof self<"u"?self:typeof window<"u"?window:void 0;t.exports=r,t.exports.AbortSignal=n,t.exports.default=r}),At=Ee((e,t)=>{ye(),ve(),be();var{format:r,inspect:n,AggregateError:a}=dr(),i=globalThis.AggregateError||a,o=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],s=/^([A-Z][a-z0-9]*)+$/,u="__node_internal_",c={};function f(C,O){if(!C)throw new c.ERR_INTERNAL_ASSERTION(O)}function d(C){let O="",N=C.length,v=C[0]==="-"?1:0;for(;N>=v+4;N-=3)O=`_${C.slice(N-3,N)}${O}`;return`${C.slice(0,N)}${O}`}function m(C,O,N){if(typeof O=="function")return f(O.length<=N.length,`Code: ${C}; The provided arguments length (${N.length}) does not match the required ones (${O.length}).`),O(...N);let v=(O.match(/%[dfijoOs]/g)||[]).length;return f(v===N.length,`Code: ${C}; The provided arguments length (${N.length}) does not match the required ones (${v}).`),N.length===0?O:r(O,...N)}function y(C,O,N){N||(N=Error);class v extends N{constructor(...U){super(m(C,O,U))}toString(){return`${this.name} [${C}]: ${this.message}`}}Object.defineProperties(v.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${C}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),v.prototype.code=C,v.prototype[o]=!0,c[C]=v}function b(C){let O=u+C.name;return Object.defineProperty(C,"name",{value:O}),C}function T(C,O){if(C&&O&&C!==O){if(Array.isArray(O.errors))return O.errors.push(C),O;let N=new i([O,C],O.message);return N.code=O.code,N}return C||O}var B=class extends Error{constructor(C="The operation was aborted",O=void 0){if(O!==void 0&&typeof O!="object")throw new c.ERR_INVALID_ARG_TYPE("options","Object",O);super(C,O),this.code="ABORT_ERR",this.name="AbortError"}};y("ERR_ASSERTION","%s",Error),y("ERR_INVALID_ARG_TYPE",(C,O,N)=>{f(typeof C=="string","'name' must be a string"),Array.isArray(O)||(O=[O]);let v="The ";C.endsWith(" argument")?v+=`${C} `:v+=`"${C}" ${C.includes(".")?"property":"argument"} `,v+="must be ";let R=[],U=[],F=[];for(let Y of O)f(typeof Y=="string","All expected entries have to be of type string"),l.includes(Y)?R.push(Y.toLowerCase()):s.test(Y)?U.push(Y):(f(Y!=="object",'The value "object" should be written as "Object"'),F.push(Y));if(U.length>0){let Y=R.indexOf("object");Y!==-1&&(R.splice(R,Y,1),U.push("Object"))}if(R.length>0){switch(R.length){case 1:v+=`of type ${R[0]}`;break;case 2:v+=`one of type ${R[0]} or ${R[1]}`;break;default:{let Y=R.pop();v+=`one of type ${R.join(", ")}, or ${Y}`}}(U.length>0||F.length>0)&&(v+=" or ")}if(U.length>0){switch(U.length){case 1:v+=`an instance of ${U[0]}`;break;case 2:v+=`an instance of ${U[0]} or ${U[1]}`;break;default:{let Y=U.pop();v+=`an instance of ${U.join(", ")}, or ${Y}`}}F.length>0&&(v+=" or ")}switch(F.length){case 0:break;case 1:F[0].toLowerCase()!==F[0]&&(v+="an "),v+=`${F[0]}`;break;case 2:v+=`one of ${F[0]} or ${F[1]}`;break;default:{let Y=F.pop();v+=`one of ${F.join(", ")}, or ${Y}`}}if(N==null)v+=`. Received ${N}`;else if(typeof N=="function"&&N.name)v+=`. Received function ${N.name}`;else if(typeof N=="object"){var H;if((H=N.constructor)!==null&&H!==void 0&&H.name)v+=`. Received an instance of ${N.constructor.name}`;else{let Y=n(N,{depth:-1});v+=`. Received ${Y}`}}else{let Y=n(N,{colors:!1});Y.length>25&&(Y=`${Y.slice(0,25)}...`),v+=`. Received type ${typeof N} (${Y})`}return v},TypeError),y("ERR_INVALID_ARG_VALUE",(C,O,N="is invalid")=>{let v=n(O);return v.length>128&&(v=v.slice(0,128)+"..."),`The ${C.includes(".")?"property":"argument"} '${C}' ${N}. Received ${v}`},TypeError),y("ERR_INVALID_RETURN_VALUE",(C,O,N)=>{var v;let R=N!=null&&(v=N.constructor)!==null&&v!==void 0&&v.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${C} to be returned from the "${O}" function but got ${R}.`},TypeError),y("ERR_MISSING_ARGS",(...C)=>{f(C.length>0,"At least one arg needs to be specified");let O,N=C.length;switch(C=(Array.isArray(C)?C:[C]).map(v=>`"${v}"`).join(" or "),N){case 1:O+=`The ${C[0]} argument`;break;case 2:O+=`The ${C[0]} and ${C[1]} arguments`;break;default:{let v=C.pop();O+=`The ${C.join(", ")}, and ${v} arguments`}break}return`${O} must be specified`},TypeError),y("ERR_OUT_OF_RANGE",(C,O,N)=>{f(O,'Missing "range" argument');let v;return Number.isInteger(N)&&Math.abs(N)>2**32?v=d(String(N)):typeof N=="bigint"?(v=String(N),(N>2n**32n||N<-(2n**32n))&&(v=d(v)),v+="n"):v=n(N),`The value of "${C}" is out of range. It must be ${O}. Received ${v}`},RangeError),y("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),y("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),y("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),y("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),y("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),y("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),y("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),y("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),y("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),y("ERR_STREAM_WRITE_AFTER_END","write after end",Error),y("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:B,aggregateTwoErrors:b(T),hideStackFrames:b,codes:c}}),No=Ee((e,t)=>{ye(),ve(),be();var{ArrayIsArray:r,ArrayPrototypeIncludes:n,ArrayPrototypeJoin:a,ArrayPrototypeMap:i,NumberIsInteger:o,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:s,NumberMIN_SAFE_INTEGER:u,NumberParseInt:c,ObjectPrototypeHasOwnProperty:f,RegExpPrototypeExec:d,String:m,StringPrototypeToUpperCase:y,StringPrototypeTrim:b}=it(),{hideStackFrames:T,codes:{ERR_SOCKET_BAD_PORT:B,ERR_INVALID_ARG_TYPE:C,ERR_INVALID_ARG_VALUE:O,ERR_OUT_OF_RANGE:N,ERR_UNKNOWN_SIGNAL:v}}=At(),{normalizeEncoding:R}=dr(),{isAsyncFunction:U,isArrayBufferView:F}=dr().types,H={};function Y(L){return L===(L|0)}function ie(L){return L===L>>>0}var I=/^[0-7]+$/,z="must be a 32-bit unsigned integer or an octal string";function ee(L,V,J){if(typeof L>"u"&&(L=J),typeof L=="string"){if(d(I,L)===null)throw new O(V,L,z);L=c(L,8)}return Z(L,V),L}var oe=T((L,V,J=u,le=s)=>{if(typeof L!="number")throw new C(V,"number",L);if(!o(L))throw new N(V,"an integer",L);if(Lle)throw new N(V,`>= ${J} && <= ${le}`,L)}),ae=T((L,V,J=-2147483648,le=2147483647)=>{if(typeof L!="number")throw new C(V,"number",L);if(!o(L))throw new N(V,"an integer",L);if(Lle)throw new N(V,`>= ${J} && <= ${le}`,L)}),Z=T((L,V,J=!1)=>{if(typeof L!="number")throw new C(V,"number",L);if(!o(L))throw new N(V,"an integer",L);let le=J?1:0,pe=4294967295;if(Lpe)throw new N(V,`>= ${le} && <= ${pe}`,L)});function Q(L,V){if(typeof L!="string")throw new C(V,"string",L)}function he(L,V,J=void 0,le){if(typeof L!="number")throw new C(V,"number",L);if(J!=null&&Lle||(J!=null||le!=null)&&l(L))throw new N(V,`${J!=null?`>= ${J}`:""}${J!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,L)}var ce=T((L,V,J)=>{if(!n(J,L)){let le="must be one of: "+a(i(J,pe=>typeof pe=="string"?`'${pe}'`:m(pe)),", ");throw new O(V,L,le)}});function _e(L,V){if(typeof L!="boolean")throw new C(V,"boolean",L)}function j(L,V,J){return L==null||!f(L,V)?J:L[V]}var se=T((L,V,J=null)=>{let le=j(J,"allowArray",!1),pe=j(J,"allowFunction",!1);if(!j(J,"nullable",!1)&&L===null||!le&&r(L)||typeof L!="object"&&(!pe||typeof L!="function"))throw new C(V,"Object",L)}),fe=T((L,V)=>{if(L!=null&&typeof L!="object"&&typeof L!="function")throw new C(V,"a dictionary",L)}),Ae=T((L,V,J=0)=>{if(!r(L))throw new C(V,"Array",L);if(L.length{if(!F(L))throw new C(V,["Buffer","TypedArray","DataView"],L)});function X(L,V){let J=R(V),le=L.length;if(J==="hex"&&le%2!==0)throw new O("encoding",V,`is invalid for data of length ${le}`)}function te(L,V="Port",J=!0){if(typeof L!="number"&&typeof L!="string"||typeof L=="string"&&b(L).length===0||+L!==+L>>>0||L>65535||L===0&&!J)throw new B(V,L,J);return L|0}var re=T((L,V)=>{if(L!==void 0&&(L===null||typeof L!="object"||!("aborted"in L)))throw new C(V,"AbortSignal",L)}),_=T((L,V)=>{if(typeof L!="function")throw new C(V,"Function",L)}),P=T((L,V)=>{if(typeof L!="function"||U(L))throw new C(V,"Function",L)}),w=T((L,V)=>{if(L!==void 0)throw new C(V,"undefined",L)});function M(L,V,J){if(!n(J,L))throw new C(V,`('${a(J,"|")}')`,L)}var k=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function G(L,V){if(typeof L>"u"||!d(k,L))throw new O(V,L,'must be an array or string of format "; rel=preload; as=style"')}function K(L){if(typeof L=="string")return G(L,"hints"),L;if(r(L)){let V=L.length,J="";if(V===0)return J;for(let le=0;le; rel=preload; as=style"')}t.exports={isInt32:Y,isUint32:ie,parseFileMode:ee,validateArray:Ae,validateStringArray:ue,validateBooleanArray:E,validateBoolean:_e,validateBuffer:q,validateDictionary:fe,validateEncoding:X,validateFunction:_,validateInt32:ae,validateInteger:oe,validateNumber:he,validateObject:se,validateOneOf:ce,validatePlainFunction:P,validatePort:te,validateSignalName:S,validateString:Q,validateUint32:Z,validateUndefined:w,validateUnion:M,validateAbortSignal:re,validateLinkHeaderValue:K}}),vn=Ee((e,t)=>{ye(),ve(),be();var r=t.exports={},n,a;function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?n=setTimeout:n=i}catch{n=i}try{typeof clearTimeout=="function"?a=clearTimeout:a=o}catch{a=o}})();function l(B){if(n===setTimeout)return setTimeout(B,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(B,0);try{return n(B,0)}catch{try{return n.call(null,B,0)}catch{return n.call(this,B,0)}}}function s(B){if(a===clearTimeout)return clearTimeout(B);if((a===o||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(B);try{return a(B)}catch{try{return a.call(null,B)}catch{return a.call(this,B)}}}var u=[],c=!1,f,d=-1;function m(){!c||!f||(c=!1,f.length?u=f.concat(u):d=-1,u.length&&y())}function y(){if(!c){var B=l(m);c=!0;for(var C=u.length;C;){for(f=u,u=[];++d1)for(var O=1;O{ye(),ve(),be();var{Symbol:r,SymbolAsyncIterator:n,SymbolIterator:a,SymbolFor:i}=it(),o=r("kDestroyed"),l=r("kIsErrored"),s=r("kIsReadable"),u=r("kIsDisturbed"),c=i("nodejs.webstream.isClosedPromise"),f=i("nodejs.webstream.controllerErrorFunction");function d(j,se=!1){var fe;return!!(j&&typeof j.pipe=="function"&&typeof j.on=="function"&&(!se||typeof j.pause=="function"&&typeof j.resume=="function")&&(!j._writableState||((fe=j._readableState)===null||fe===void 0?void 0:fe.readable)!==!1)&&(!j._writableState||j._readableState))}function m(j){var se;return!!(j&&typeof j.write=="function"&&typeof j.on=="function"&&(!j._readableState||((se=j._writableState)===null||se===void 0?void 0:se.writable)!==!1))}function y(j){return!!(j&&typeof j.pipe=="function"&&j._readableState&&typeof j.on=="function"&&typeof j.write=="function")}function b(j){return j&&(j._readableState||j._writableState||typeof j.write=="function"&&typeof j.on=="function"||typeof j.pipe=="function"&&typeof j.on=="function")}function T(j){return!!(j&&!b(j)&&typeof j.pipeThrough=="function"&&typeof j.getReader=="function"&&typeof j.cancel=="function")}function B(j){return!!(j&&!b(j)&&typeof j.getWriter=="function"&&typeof j.abort=="function")}function C(j){return!!(j&&!b(j)&&typeof j.readable=="object"&&typeof j.writable=="object")}function O(j){return T(j)||B(j)||C(j)}function N(j,se){return j==null?!1:se===!0?typeof j[n]=="function":se===!1?typeof j[a]=="function":typeof j[n]=="function"||typeof j[a]=="function"}function v(j){if(!b(j))return null;let se=j._writableState,fe=j._readableState,Ae=se||fe;return!!(j.destroyed||j[o]||Ae!=null&&Ae.destroyed)}function R(j){if(!m(j))return null;if(j.writableEnded===!0)return!0;let se=j._writableState;return se!=null&&se.errored?!1:typeof(se==null?void 0:se.ended)!="boolean"?null:se.ended}function U(j,se){if(!m(j))return null;if(j.writableFinished===!0)return!0;let fe=j._writableState;return fe!=null&&fe.errored?!1:typeof(fe==null?void 0:fe.finished)!="boolean"?null:!!(fe.finished||se===!1&&fe.ended===!0&&fe.length===0)}function F(j){if(!d(j))return null;if(j.readableEnded===!0)return!0;let se=j._readableState;return!se||se.errored?!1:typeof(se==null?void 0:se.ended)!="boolean"?null:se.ended}function H(j,se){if(!d(j))return null;let fe=j._readableState;return fe!=null&&fe.errored?!1:typeof(fe==null?void 0:fe.endEmitted)!="boolean"?null:!!(fe.endEmitted||se===!1&&fe.ended===!0&&fe.length===0)}function Y(j){return j&&j[s]!=null?j[s]:typeof(j==null?void 0:j.readable)!="boolean"?null:v(j)?!1:d(j)&&j.readable&&!H(j)}function ie(j){return typeof(j==null?void 0:j.writable)!="boolean"?null:v(j)?!1:m(j)&&j.writable&&!R(j)}function I(j,se){return b(j)?v(j)?!0:!((se==null?void 0:se.readable)!==!1&&Y(j)||(se==null?void 0:se.writable)!==!1&&ie(j)):null}function z(j){var se,fe;return b(j)?j.writableErrored?j.writableErrored:(se=(fe=j._writableState)===null||fe===void 0?void 0:fe.errored)!==null&&se!==void 0?se:null:null}function ee(j){var se,fe;return b(j)?j.readableErrored?j.readableErrored:(se=(fe=j._readableState)===null||fe===void 0?void 0:fe.errored)!==null&&se!==void 0?se:null:null}function oe(j){if(!b(j))return null;if(typeof j.closed=="boolean")return j.closed;let se=j._writableState,fe=j._readableState;return typeof(se==null?void 0:se.closed)=="boolean"||typeof(fe==null?void 0:fe.closed)=="boolean"?(se==null?void 0:se.closed)||(fe==null?void 0:fe.closed):typeof j._closed=="boolean"&&ae(j)?j._closed:null}function ae(j){return typeof j._closed=="boolean"&&typeof j._defaultKeepAlive=="boolean"&&typeof j._removedConnection=="boolean"&&typeof j._removedContLen=="boolean"}function Z(j){return typeof j._sent100=="boolean"&&ae(j)}function Q(j){var se;return typeof j._consuming=="boolean"&&typeof j._dumped=="boolean"&&((se=j.req)===null||se===void 0?void 0:se.upgradeOrConnect)===void 0}function he(j){if(!b(j))return null;let se=j._writableState,fe=j._readableState,Ae=se||fe;return!Ae&&Z(j)||!!(Ae&&Ae.autoDestroy&&Ae.emitClose&&Ae.closed===!1)}function ce(j){var se;return!!(j&&((se=j[u])!==null&&se!==void 0?se:j.readableDidRead||j.readableAborted))}function _e(j){var se,fe,Ae,ue,E,S,q,X,te,re;return!!(j&&((se=(fe=(Ae=(ue=(E=(S=j[l])!==null&&S!==void 0?S:j.readableErrored)!==null&&E!==void 0?E:j.writableErrored)!==null&&ue!==void 0?ue:(q=j._readableState)===null||q===void 0?void 0:q.errorEmitted)!==null&&Ae!==void 0?Ae:(X=j._writableState)===null||X===void 0?void 0:X.errorEmitted)!==null&&fe!==void 0?fe:(te=j._readableState)===null||te===void 0?void 0:te.errored)!==null&&se!==void 0?se:!((re=j._writableState)===null||re===void 0)&&re.errored))}t.exports={kDestroyed:o,isDisturbed:ce,kIsDisturbed:u,isErrored:_e,kIsErrored:l,isReadable:Y,kIsReadable:s,kIsClosedPromise:c,kControllerErrorFunction:f,isClosed:oe,isDestroyed:v,isDuplexNodeStream:y,isFinished:I,isIterable:N,isReadableNodeStream:d,isReadableStream:T,isReadableEnded:F,isReadableFinished:H,isReadableErrored:ee,isNodeStream:b,isWebStream:O,isWritable:ie,isWritableNodeStream:m,isWritableStream:B,isWritableEnded:R,isWritableFinished:U,isWritableErrored:z,isServerRequest:Q,isServerResponse:Z,willEmitClose:he,isTransformStream:C}}),$r=Ee((e,t)=>{ye(),ve(),be();var r=vn(),{AbortError:n,codes:a}=At(),{ERR_INVALID_ARG_TYPE:i,ERR_STREAM_PREMATURE_CLOSE:o}=a,{kEmptyObject:l,once:s}=dr(),{validateAbortSignal:u,validateFunction:c,validateObject:f,validateBoolean:d}=No(),{Promise:m,PromisePrototypeThen:y}=it(),{isClosed:b,isReadable:T,isReadableNodeStream:B,isReadableStream:C,isReadableFinished:O,isReadableErrored:N,isWritable:v,isWritableNodeStream:R,isWritableStream:U,isWritableFinished:F,isWritableErrored:H,isNodeStream:Y,willEmitClose:ie,kIsClosedPromise:I}=br();function z(Q){return Q.setHeader&&typeof Q.abort=="function"}var ee=()=>{};function oe(Q,he,ce){var _e,j;if(arguments.length===2?(ce=he,he=l):he==null?he=l:f(he,"options"),c(ce,"callback"),u(he.signal,"options.signal"),ce=s(ce),C(Q)||U(Q))return ae(Q,he,ce);if(!Y(Q))throw new i("stream",["ReadableStream","WritableStream","Stream"],Q);let se=(_e=he.readable)!==null&&_e!==void 0?_e:B(Q),fe=(j=he.writable)!==null&&j!==void 0?j:R(Q),Ae=Q._writableState,ue=Q._readableState,E=()=>{Q.writable||X()},S=ie(Q)&&B(Q)===se&&R(Q)===fe,q=F(Q,!1),X=()=>{q=!0,Q.destroyed&&(S=!1),!(S&&(!Q.readable||se))&&(!se||te)&&ce.call(Q)},te=O(Q,!1),re=()=>{te=!0,Q.destroyed&&(S=!1),!(S&&(!Q.writable||fe))&&(!fe||q)&&ce.call(Q)},_=K=>{ce.call(Q,K)},P=b(Q),w=()=>{P=!0;let K=H(Q)||N(Q);if(K&&typeof K!="boolean")return ce.call(Q,K);if(se&&!te&&B(Q,!0)&&!O(Q,!1))return ce.call(Q,new o);if(fe&&!q&&!F(Q,!1))return ce.call(Q,new o);ce.call(Q)},M=()=>{P=!0;let K=H(Q)||N(Q);if(K&&typeof K!="boolean")return ce.call(Q,K);ce.call(Q)},k=()=>{Q.req.on("finish",X)};z(Q)?(Q.on("complete",X),S||Q.on("abort",w),Q.req?k():Q.on("request",k)):fe&&!Ae&&(Q.on("end",E),Q.on("close",E)),!S&&typeof Q.aborted=="boolean"&&Q.on("aborted",w),Q.on("end",re),Q.on("finish",X),he.error!==!1&&Q.on("error",_),Q.on("close",w),P?r.nextTick(w):Ae!=null&&Ae.errorEmitted||ue!=null&&ue.errorEmitted?S||r.nextTick(M):(!se&&(!S||T(Q))&&(q||v(Q)===!1)||!fe&&(!S||v(Q))&&(te||T(Q)===!1)||ue&&Q.req&&Q.aborted)&&r.nextTick(M);let G=()=>{ce=ee,Q.removeListener("aborted",w),Q.removeListener("complete",X),Q.removeListener("abort",w),Q.removeListener("request",k),Q.req&&Q.req.removeListener("finish",X),Q.removeListener("end",E),Q.removeListener("close",E),Q.removeListener("finish",X),Q.removeListener("end",re),Q.removeListener("error",_),Q.removeListener("close",w)};if(he.signal&&!P){let K=()=>{let L=ce;G(),L.call(Q,new n(void 0,{cause:he.signal.reason}))};if(he.signal.aborted)r.nextTick(K);else{let L=ce;ce=s((...V)=>{he.signal.removeEventListener("abort",K),L.apply(Q,V)}),he.signal.addEventListener("abort",K)}}return G}function ae(Q,he,ce){let _e=!1,j=ee;if(he.signal)if(j=()=>{_e=!0,ce.call(Q,new n(void 0,{cause:he.signal.reason}))},he.signal.aborted)r.nextTick(j);else{let fe=ce;ce=s((...Ae)=>{he.signal.removeEventListener("abort",j),fe.apply(Q,Ae)}),he.signal.addEventListener("abort",j)}let se=(...fe)=>{_e||r.nextTick(()=>ce.apply(Q,fe))};return y(Q[I].promise,se,se),ee}function Z(Q,he){var ce;let _e=!1;return he===null&&(he=l),(ce=he)!==null&&ce!==void 0&&ce.cleanup&&(d(he.cleanup,"cleanup"),_e=he.cleanup),new m((j,se)=>{let fe=oe(Q,he,Ae=>{_e&&fe(),Ae?se(Ae):j()})})}t.exports=oe,t.exports.finished=Z}),$n=Ee((e,t)=>{ye(),ve(),be();var r=vn(),{aggregateTwoErrors:n,codes:{ERR_MULTIPLE_CALLBACK:a},AbortError:i}=At(),{Symbol:o}=it(),{kDestroyed:l,isDestroyed:s,isFinished:u,isServerRequest:c}=br(),f=o("kDestroy"),d=o("kConstruct");function m(I,z,ee){I&&(I.stack,z&&!z.errored&&(z.errored=I),ee&&!ee.errored&&(ee.errored=I))}function y(I,z){let ee=this._readableState,oe=this._writableState,ae=oe||ee;return oe!=null&&oe.destroyed||ee!=null&&ee.destroyed?(typeof z=="function"&&z(),this):(m(I,oe,ee),oe&&(oe.destroyed=!0),ee&&(ee.destroyed=!0),ae.constructed?b(this,I,z):this.once(f,function(Z){b(this,n(Z,I),z)}),this)}function b(I,z,ee){let oe=!1;function ae(Z){if(oe)return;oe=!0;let Q=I._readableState,he=I._writableState;m(Z,he,Q),he&&(he.closed=!0),Q&&(Q.closed=!0),typeof ee=="function"&&ee(Z),Z?r.nextTick(T,I,Z):r.nextTick(B,I)}try{I._destroy(z||null,ae)}catch(Z){ae(Z)}}function T(I,z){C(I,z),B(I)}function B(I){let z=I._readableState,ee=I._writableState;ee&&(ee.closeEmitted=!0),z&&(z.closeEmitted=!0),(ee!=null&&ee.emitClose||z!=null&&z.emitClose)&&I.emit("close")}function C(I,z){let ee=I._readableState,oe=I._writableState;oe!=null&&oe.errorEmitted||ee!=null&&ee.errorEmitted||(oe&&(oe.errorEmitted=!0),ee&&(ee.errorEmitted=!0),I.emit("error",z))}function O(){let I=this._readableState,z=this._writableState;I&&(I.constructed=!0,I.closed=!1,I.closeEmitted=!1,I.destroyed=!1,I.errored=null,I.errorEmitted=!1,I.reading=!1,I.ended=I.readable===!1,I.endEmitted=I.readable===!1),z&&(z.constructed=!0,z.destroyed=!1,z.closed=!1,z.closeEmitted=!1,z.errored=null,z.errorEmitted=!1,z.finalCalled=!1,z.prefinished=!1,z.ended=z.writable===!1,z.ending=z.writable===!1,z.finished=z.writable===!1)}function N(I,z,ee){let oe=I._readableState,ae=I._writableState;if(ae!=null&&ae.destroyed||oe!=null&&oe.destroyed)return this;oe!=null&&oe.autoDestroy||ae!=null&&ae.autoDestroy?I.destroy(z):z&&(z.stack,ae&&!ae.errored&&(ae.errored=z),oe&&!oe.errored&&(oe.errored=z),ee?r.nextTick(C,I,z):C(I,z))}function v(I,z){if(typeof I._construct!="function")return;let ee=I._readableState,oe=I._writableState;ee&&(ee.constructed=!1),oe&&(oe.constructed=!1),I.once(d,z),!(I.listenerCount(d)>1)&&r.nextTick(R,I)}function R(I){let z=!1;function ee(oe){if(z){N(I,oe??new a);return}z=!0;let ae=I._readableState,Z=I._writableState,Q=Z||ae;ae&&(ae.constructed=!0),Z&&(Z.constructed=!0),Q.destroyed?I.emit(f,oe):oe?N(I,oe,!0):r.nextTick(U,I)}try{I._construct(oe=>{r.nextTick(ee,oe)})}catch(oe){r.nextTick(ee,oe)}}function U(I){I.emit(d)}function F(I){return(I==null?void 0:I.setHeader)&&typeof I.abort=="function"}function H(I){I.emit("close")}function Y(I,z){I.emit("error",z),r.nextTick(H,I)}function ie(I,z){!I||s(I)||(!z&&!u(I)&&(z=new i),c(I)?(I.socket=null,I.destroy(z)):F(I)?I.abort():F(I.req)?I.req.abort():typeof I.destroy=="function"?I.destroy(z):typeof I.close=="function"?I.close():z?r.nextTick(Y,I,z):r.nextTick(H,I),I.destroyed||(I[l]=!0))}t.exports={construct:v,destroyer:ie,destroy:y,undestroy:O,errorOrDestroy:N}});function je(){je.init.call(this)}function Yi(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function jh(e){return e._maxListeners===void 0?je.defaultMaxListeners:e._maxListeners}function nc(e,t,r,n){var a,i,o,l;if(Yi(r),(i=e._events)===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),o===void 0)o=i[t]=r,++e._eventsCount;else if(typeof o=="function"?o=i[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(a=jh(e))>0&&o.length>a&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=o.length,l=s,console&&console.warn&&console.warn(l)}return e}function wb(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ic(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},a=wb.bind(n);return a.listener=r,n.wrapFn=a,a}function oc(e,t,r){var n=e._events;if(n===void 0)return[];var a=n[t];return a===void 0?[]:typeof a=="function"?r?[a.listener||a]:[a]:r?function(i){for(var o=new Array(i.length),l=0;l{ye(),ve(),be(),Gr=typeof Reflect=="object"?Reflect:null,ns=Gr&&typeof Gr.apply=="function"?Gr.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},lc=Gr&&typeof Gr.ownKeys=="function"?Gr.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)},is=Number.isNaN||function(e){return e!=e},ac=je,je.EventEmitter=je,je.prototype._events=void 0,je.prototype._eventsCount=0,je.prototype._maxListeners=void 0,os=10,Object.defineProperty(je,"defaultMaxListeners",{enumerable:!0,get:function(){return os},set:function(e){if(typeof e!="number"||e<0||is(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");os=e}}),je.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},je.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||is(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},je.prototype.getMaxListeners=function(){return jh(this)},je.prototype.emit=function(e){for(var t=[],r=1;r0&&(i=t[0]),i instanceof Error)throw i;var o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var l=a[e];if(l===void 0)return!1;if(typeof l=="function")ns(l,this,t);else{var s=l.length,u=Uh(l,s);for(r=0;r=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,a=i;break}if(a<0)return this;a===0?r.shift():function(l,s){for(;s+1=0;n--)this.removeListener(e,t[n]);return this},je.prototype.listeners=function(e){return oc(this,e,!0)},je.prototype.rawListeners=function(e){return oc(this,e,!1)},je.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):sc.call(e,t)},je.prototype.listenerCount=sc,je.prototype.eventNames=function(){return this._eventsCount>0?lc(this._events):[]},Ct=ac,Ct.EventEmitter,Ct.defaultMaxListeners,Ct.init,Ct.listenerCount,Ct.EventEmitter,Ct.defaultMaxListeners,Ct.init,Ct.listenerCount}),wn={};bn(wn,{EventEmitter:()=>Dh,default:()=>Ct,defaultMaxListeners:()=>Fh,init:()=>$h,listenerCount:()=>Wh,on:()=>Hh,once:()=>Vh});var Dh,Fh,$h,Wh,Hh,Vh,Wn=lt(()=>{ye(),ve(),be(),uc(),uc(),Ct.once=function(e,t){return new Promise((r,n)=>{function a(...o){i!==void 0&&e.removeListener("error",i),r(o)}let i;t!=="error"&&(i=o=>{e.removeListener(name,a),n(o)},e.once("error",i)),e.once(t,a)})},Ct.on=function(e,t){let r=[],n=[],a=null,i=!1,o={async next(){let u=r.shift();if(u)return createIterResult(u,!1);if(a){let c=Promise.reject(a);return a=null,c}return i?createIterResult(void 0,!0):new Promise((c,f)=>n.push({resolve:c,reject:f}))},async return(){e.removeListener(t,l),e.removeListener("error",s),i=!0;for(let u of n)u.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(u){a=u,e.removeListener(t,l),e.removeListener("error",s)},[Symbol.asyncIterator](){return this}};return e.on(t,l),e.on("error",s),o;function l(...u){let c=n.shift();c?c.resolve(createIterResult(u,!1)):r.push(u)}function s(u){i=!0;let c=n.shift();c?c.reject(u):a=u,o.return()}},{EventEmitter:Dh,defaultMaxListeners:Fh,init:$h,listenerCount:Wh,on:Hh,once:Vh}=Ct}),jl=Ee((e,t)=>{ye(),ve(),be();var{ArrayIsArray:r,ObjectSetPrototypeOf:n}=it(),{EventEmitter:a}=(Wn(),De(wn));function i(l){a.call(this,l)}n(i.prototype,a.prototype),n(i,a),i.prototype.pipe=function(l,s){let u=this;function c(B){l.writable&&l.write(B)===!1&&u.pause&&u.pause()}u.on("data",c);function f(){u.readable&&u.resume&&u.resume()}l.on("drain",f),!l._isStdio&&(!s||s.end!==!1)&&(u.on("end",m),u.on("close",y));let d=!1;function m(){d||(d=!0,l.end())}function y(){d||(d=!0,typeof l.destroy=="function"&&l.destroy())}function b(B){T(),a.listenerCount(this,"error")===0&&this.emit("error",B)}o(u,"error",b),o(l,"error",b);function T(){u.removeListener("data",c),l.removeListener("drain",f),u.removeListener("end",m),u.removeListener("close",y),u.removeListener("error",b),l.removeListener("error",b),u.removeListener("end",T),u.removeListener("close",T),l.removeListener("close",T)}return u.on("end",T),u.on("close",T),l.on("close",T),l.emit("pipe",u),l};function o(l,s,u){if(typeof l.prependListener=="function")return l.prependListener(s,u);!l._events||!l._events[s]?l.on(s,u):r(l._events[s])?l._events[s].unshift(u):l._events[s]=[u,l._events[s]]}t.exports={Stream:i,prependListener:o}}),jo=Ee((e,t)=>{ye(),ve(),be();var{AbortError:r,codes:n}=At(),{isNodeStream:a,isWebStream:i,kControllerErrorFunction:o}=br(),l=$r(),{ERR_INVALID_ARG_TYPE:s}=n,u=(c,f)=>{if(typeof c!="object"||!("aborted"in c))throw new s(f,"AbortSignal",c)};t.exports.addAbortSignal=function(c,f){if(u(c,"signal"),!a(f)&&!i(f))throw new s("stream",["ReadableStream","WritableStream","Stream"],f);return t.exports.addAbortSignalNoValidate(c,f)},t.exports.addAbortSignalNoValidate=function(c,f){if(typeof c!="object"||!("aborted"in c))return f;let d=a(f)?()=>{f.destroy(new r(void 0,{cause:c.reason}))}:()=>{f[o](new r(void 0,{cause:c.reason}))};return c.aborted?d():(c.addEventListener("abort",d),l(f,()=>c.removeEventListener("abort",d))),f}}),_b=Ee((e,t)=>{ye(),ve(),be();var{StringPrototypeSlice:r,SymbolIterator:n,TypedArrayPrototypeSet:a,Uint8Array:i}=it(),{Buffer:o}=(dt(),De(ht)),{inspect:l}=dr();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(s){let u={data:s,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}unshift(s){let u={data:s,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}shift(){if(this.length===0)return;let s=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,s}clear(){this.head=this.tail=null,this.length=0}join(s){if(this.length===0)return"";let u=this.head,c=""+u.data;for(;(u=u.next)!==null;)c+=s+u.data;return c}concat(s){if(this.length===0)return o.alloc(0);let u=o.allocUnsafe(s>>>0),c=this.head,f=0;for(;c;)a(u,c.data,f),f+=c.data.length,c=c.next;return u}consume(s,u){let c=this.head.data;if(sd.length)u+=d,s-=d.length;else{s===d.length?(u+=d,++f,c.next?this.head=c.next:this.head=this.tail=null):(u+=r(d,0,s),this.head=c,c.data=r(d,s));break}++f}while((c=c.next)!==null);return this.length-=f,u}_getBuffer(s){let u=o.allocUnsafe(s),c=s,f=this.head,d=0;do{let m=f.data;if(s>m.length)a(u,m,c-s),s-=m.length;else{s===m.length?(a(u,m,c-s),++d,f.next?this.head=f.next:this.head=this.tail=null):(a(u,new i(m.buffer,m.byteOffset,s),c-s),this.head=f,f.data=m.slice(s));break}++d}while((f=f.next)!==null);return this.length-=d,u}[Symbol.for("nodejs.util.inspect.custom")](s,u){return l(this,{...u,depth:0,customInspect:!1})}}}),Ul=Ee((e,t)=>{ye(),ve(),be();var{MathFloor:r,NumberIsInteger:n}=it(),{ERR_INVALID_ARG_VALUE:a}=At().codes;function i(s,u,c){return s.highWaterMark!=null?s.highWaterMark:u?s[c]:null}function o(s){return s?16:16*1024}function l(s,u,c,f){let d=i(u,f,c);if(d!=null){if(!n(d)||d<0){let m=f?`options.${c}`:"options.highWaterMark";throw new a(m,d)}return r(d)}return o(s.objectMode)}t.exports={getHighWaterMark:l,getDefaultHighWaterMark:o}});function cc(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return r===-1&&(r=t),[r,r===t?0:4-r%4]}function Eb(e,t,r){for(var n,a,i=[],o=t;o>18&63]+Ht[a>>12&63]+Ht[a>>6&63]+Ht[63&a]);return i.join("")}function cr(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,we.prototype),t}function we(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ha(e)}return qh(e,t,r)}function qh(e,t,r){if(typeof e=="string")return function(i,o){if(typeof o=="string"&&o!==""||(o="utf8"),!we.isEncoding(o))throw new TypeError("Unknown encoding: "+o);var l=0|Kh(i,o),s=cr(l),u=s.write(i,o);return u!==l&&(s=s.slice(0,u)),s}(e,t);if(ArrayBuffer.isView(e))return ss(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(fr(e,ArrayBuffer)||e&&fr(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(fr(e,SharedArrayBuffer)||e&&fr(e.buffer,SharedArrayBuffer)))return Sb(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return we.from(n,t,r);var a=function(i){if(we.isBuffer(i)){var o=0|Dl(i.length),l=cr(o);return l.length===0||i.copy(l,0,0,o),l}if(i.length!==void 0)return typeof i.length!="number"||Fl(i.length)?cr(0):ss(i);if(i.type==="Buffer"&&Array.isArray(i.data))return ss(i.data)}(e);if(a)return a;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return we.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function zh(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Ha(e){return zh(e),cr(e<0?0:0|Dl(e))}function ss(e){for(var t=e.length<0?0:0|Dl(e.length),r=cr(t),n=0;n=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function Kh(e,t){if(we.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||fr(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Va(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Jh(e).length;default:if(a)return n?-1:Va(e).length;t=(""+t).toLowerCase(),a=!0}}function Ab(e,t,r){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Bb(this,t,r);case"utf8":case"utf-8":return Yh(this,t,r);case"ascii":return xb(this,t,r);case"latin1":case"binary":return kb(this,t,r);case"base64":return Pb(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mb(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Yr(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function fc(e,t,r,n,a){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Fl(r=+r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if(typeof t=="string"&&(t=we.from(t,n)),we.isBuffer(t))return t.length===0?-1:hc(e,t,r,n,a);if(typeof t=="number")return t&=255,typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):hc(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function hc(e,t,r,n,a){var i,o=1,l=e.length,s=t.length;if(n!==void 0&&((n=String(n).toLowerCase())==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,l/=2,s/=2,r/=2}function u(m,y){return o===1?m[y]:m.readUInt16BE(y*o)}if(a){var c=-1;for(i=r;il&&(r=l-s),i=r;i>=0;i--){for(var f=!0,d=0;da&&(n=a):n=a;var i=t.length;n>i/2&&(n=i/2);for(var o=0;o>8,s=o%256,u.push(s),u.push(l);return u}(t,e.length-r),e,r,n)}function Pb(e,t,r){return t===0&&r===e.length?fo.fromByteArray(e):fo.fromByteArray(e.slice(t,r))}function Yh(e,t,r){r=Math.min(e.length,r);for(var n=[],a=t;a239?4:u>223?3:u>191?2:1;if(a+f<=r)switch(f){case 1:u<128&&(c=u);break;case 2:(192&(i=e[a+1]))==128&&(s=(31&u)<<6|63&i)>127&&(c=s);break;case 3:i=e[a+1],o=e[a+2],(192&i)==128&&(192&o)==128&&(s=(15&u)<<12|(63&i)<<6|63&o)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:i=e[a+1],o=e[a+2],l=e[a+3],(192&i)==128&&(192&o)==128&&(192&l)==128&&(s=(15&u)<<18|(63&i)<<12|(63&o)<<6|63&l)>65535&&s<1114112&&(c=s)}c===null?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),a+=f}return function(d){var m=d.length;if(m<=4096)return String.fromCharCode.apply(String,d);for(var y="",b=0;bn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function bt(e,t,r,n,a,i){if(!we.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function Qh(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function dc(e,t,r,n,a){return t=+t,r>>>=0,a||Qh(e,0,r,4),nn.write(e,t,r,n,23,4),r+4}function pc(e,t,r,n,a){return t=+t,r>>>=0,a||Qh(e,0,r,8),nn.write(e,t,r,n,52,8),r+8}function Va(e,t){var r;t=t||1/0;for(var n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function Jh(e){return fo.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Xh,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(e))}function Uo(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function fr(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Fl(e){return e!=e}function gc(e,t){for(var r in e)t[r]=e[r]}function Qr(e,t,r){return $t(e,t,r)}function zn(e){var t;switch(this.encoding=function(r){var n=function(a){if(!a)return"utf8";for(var i;;)switch(a){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return a;default:if(i)return;a=(""+a).toLowerCase(),i=!0}}(r);if(typeof n!="string"&&(ho.isEncoding===qa||!qa(r)))throw new Error("Unknown encoding: "+r);return n||r}(e),this.encoding){case"utf16le":this.text=Nb,this.end=jb,t=4;break;case"utf8":this.fillLast=Lb,t=4;break;case"base64":this.text=Ub,this.end=Db,t=3;break;default:return this.write=Fb,this.end=$b,void 0}this.lastNeed=0,this.lastTotal=0,this.lastChar=ho.allocUnsafe(t)}function as(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function Lb(e){var t=this.lastTotal-this.lastNeed,r=function(n,a,i){if((192&a[0])!=128)return n.lastNeed=0,"�";if(n.lastNeed>1&&a.length>1){if((192&a[1])!=128)return n.lastNeed=1,"�";if(n.lastNeed>2&&a.length>2&&(192&a[2])!=128)return n.lastNeed=2,"�"}}(this,e);return r!==void 0?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length,void 0)}function Nb(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function jb(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function Ub(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function Db(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Fb(e){return e.toString(this.encoding)}function $b(e){return e&&e.length?this.write(e):""}var mc,Ht,Tt,yc,ji,Jr,bc,vc,Kt,fo,nn,ls,Xh,Zh,Kn,Gn,$t,wc,In,ho,qa,_c=lt(()=>{for(ye(),ve(),be(),mc={byteLength:function(e){var t=cc(e),r=t[0],n=t[1];return 3*(r+n)/4-n},toByteArray:function(e){var t,r,n=cc(e),a=n[0],i=n[1],o=new yc(function(u,c,f){return 3*(c+f)/4-f}(0,a,i)),l=0,s=i>0?a-4:a;for(r=0;r>16&255,o[l++]=t>>8&255,o[l++]=255&t;return i===2&&(t=Tt[e.charCodeAt(r)]<<2|Tt[e.charCodeAt(r+1)]>>4,o[l++]=255&t),i===1&&(t=Tt[e.charCodeAt(r)]<<10|Tt[e.charCodeAt(r+1)]<<4|Tt[e.charCodeAt(r+2)]>>2,o[l++]=t>>8&255,o[l++]=255&t),o},fromByteArray:function(e){for(var t,r=e.length,n=r%3,a=[],i=0,o=r-n;io?o:i+16383));return n===1?(t=e[r-1],a.push(Ht[t>>2]+Ht[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],a.push(Ht[t>>10]+Ht[t>>4&63]+Ht[t<<2&63]+"=")),a.join("")}},Ht=[],Tt=[],yc=typeof Uint8Array<"u"?Uint8Array:Array,ji="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jr=0,bc=ji.length;Jr>1,c=-7,f=r?a-1:0,d=r?-1:1,m=e[t+f];for(f+=d,i=m&(1<<-c)-1,m>>=-c,c+=l;c>0;i=256*i+e[t+f],f+=d,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+e[t+f],f+=d,c-=8);if(i===0)i=1-u;else{if(i===s)return o?NaN:1/0*(m?-1:1);o+=Math.pow(2,n),i-=u}return(m?-1:1)*o*Math.pow(2,i-n)},write:function(e,t,r,n,a,i){var o,l,s,u=8*i-a-1,c=(1<>1,d=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:i-1,y=n?1:-1,b=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),(t+=o+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(o++,s/=2),o+f>=c?(l=0,o=c):o+f>=1?(l=(t*s-1)*Math.pow(2,a),o+=f):(l=t*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;e[r+m]=255&l,m+=y,l/=256,a-=8);for(o=o<0;e[r+m]=255&o,m+=y,o/=256,u-=8);e[r+m-y]|=128*b}},Kt={},fo=mc,nn=vc,ls=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null,Kt.Buffer=we,Kt.SlowBuffer=function(e){return+e!=e&&(e=0),we.alloc(+e)},Kt.INSPECT_MAX_BYTES=50,Kt.kMaxLength=2147483647,we.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}(),we.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."),Object.defineProperty(we.prototype,"parent",{enumerable:!0,get:function(){if(we.isBuffer(this))return this.buffer}}),Object.defineProperty(we.prototype,"offset",{enumerable:!0,get:function(){if(we.isBuffer(this))return this.byteOffset}}),we.poolSize=8192,we.from=function(e,t,r){return qh(e,t,r)},Object.setPrototypeOf(we.prototype,Uint8Array.prototype),Object.setPrototypeOf(we,Uint8Array),we.alloc=function(e,t,r){return function(n,a,i){return zh(n),n<=0?cr(n):a!==void 0?typeof i=="string"?cr(n).fill(a,i):cr(n).fill(a):cr(n)}(e,t,r)},we.allocUnsafe=function(e){return Ha(e)},we.allocUnsafeSlow=function(e){return Ha(e)},we.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==we.prototype},we.compare=function(e,t){if(fr(e,Uint8Array)&&(e=we.from(e,e.offset,e.byteLength)),fr(t,Uint8Array)&&(t=we.from(t,t.offset,t.byteLength)),!we.isBuffer(e)||!we.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,a=0,i=Math.min(r,n);at&&(e+=" ... "),""},ls&&(we.prototype[ls]=we.prototype.inspect),we.prototype.compare=function(e,t,r,n,a){if(fr(e,Uint8Array)&&(e=we.from(e,e.offset,e.byteLength)),!we.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),r===void 0&&(r=e?e.length:0),n===void 0&&(n=0),a===void 0&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(a>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),l=Math.min(i,o),s=this.slice(n,a),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,n===void 0&&(n="utf8")):(n=r,r=void 0)}var a=this.length-t;if((r===void 0||r>a)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return Tb(this,e,t,r);case"utf8":case"utf-8":return Ib(this,e,t,r);case"ascii":return Gh(this,e,t,r);case"latin1":case"binary":return Cb(this,e,t,r);case"base64":return Ob(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rb(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},we.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},we.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=t===void 0?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||ot(e,t,this.length);for(var n=this[e],a=1,i=0;++i>>=0,t>>>=0,r||ot(e,t,this.length);for(var n=this[e+--t],a=1;t>0&&(a*=256);)n+=this[e+--t]*a;return n},we.prototype.readUInt8=function(e,t){return e>>>=0,t||ot(e,1,this.length),this[e]},we.prototype.readUInt16LE=function(e,t){return e>>>=0,t||ot(e,2,this.length),this[e]|this[e+1]<<8},we.prototype.readUInt16BE=function(e,t){return e>>>=0,t||ot(e,2,this.length),this[e]<<8|this[e+1]},we.prototype.readUInt32LE=function(e,t){return e>>>=0,t||ot(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},we.prototype.readUInt32BE=function(e,t){return e>>>=0,t||ot(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},we.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||ot(e,t,this.length);for(var n=this[e],a=1,i=0;++i=(a*=128)&&(n-=Math.pow(2,8*t)),n},we.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||ot(e,t,this.length);for(var n=t,a=1,i=this[e+--n];n>0&&(a*=256);)i+=this[e+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*t)),i},we.prototype.readInt8=function(e,t){return e>>>=0,t||ot(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},we.prototype.readInt16LE=function(e,t){e>>>=0,t||ot(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},we.prototype.readInt16BE=function(e,t){e>>>=0,t||ot(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},we.prototype.readInt32LE=function(e,t){return e>>>=0,t||ot(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},we.prototype.readInt32BE=function(e,t){return e>>>=0,t||ot(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},we.prototype.readFloatLE=function(e,t){return e>>>=0,t||ot(e,4,this.length),nn.read(this,e,!0,23,4)},we.prototype.readFloatBE=function(e,t){return e>>>=0,t||ot(e,4,this.length),nn.read(this,e,!1,23,4)},we.prototype.readDoubleLE=function(e,t){return e>>>=0,t||ot(e,8,this.length),nn.read(this,e,!0,52,8)},we.prototype.readDoubleBE=function(e,t){return e>>>=0,t||ot(e,8,this.length),nn.read(this,e,!1,52,8)},we.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||bt(this,e,t,r,Math.pow(2,8*r)-1,0);var a=1,i=0;for(this[t]=255&e;++i>>=0,r>>>=0,n||bt(this,e,t,r,Math.pow(2,8*r)-1,0);var a=r-1,i=1;for(this[t+a]=255&e;--a>=0&&(i*=256);)this[t+a]=e/i&255;return t+r},we.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,1,255,0),this[t]=255&e,t+1},we.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},we.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},we.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},we.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},we.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var a=Math.pow(2,8*r-1);bt(this,e,t,r,a-1,-a)}var i=0,o=1,l=0;for(this[t]=255&e;++i>0)-l&255;return t+r},we.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var a=Math.pow(2,8*r-1);bt(this,e,t,r,a-1,-a)}var i=r-1,o=1,l=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&l===0&&this[t+i+1]!==0&&(l=1),this[t+i]=(e/o>>0)-l&255;return t+r},we.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},we.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},we.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},we.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},we.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||bt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},we.prototype.writeFloatLE=function(e,t,r){return dc(this,e,t,!0,r)},we.prototype.writeFloatBE=function(e,t,r){return dc(this,e,t,!1,r)},we.prototype.writeDoubleLE=function(e,t,r){return pc(this,e,t,!0,r)},we.prototype.writeDoubleBE=function(e,t,r){return pc(this,e,t,!1,r)},we.prototype.copy=function(e,t,r,n){if(!we.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||n===0||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return a},we.prototype.fill=function(e,t,r,n){if(typeof e=="string"){if(typeof t=="string"?(n=t,t=0,r=this.length):typeof r=="string"&&(n=r,r=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!we.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){var a=e.charCodeAt(0);(n==="utf8"&&a<128||n==="latin1")&&(e=a)}}else typeof e=="number"?e&=255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length>>=0,r=r===void 0?this.length:r>>>0,e||(e=0),typeof e=="number")for(i=t;i=0?(s>0&&(a.lastNeed=s-1),s):--l=0?(s>0&&(a.lastNeed=s-2),s):--l=0?(s>0&&(s===2?s=0:a.lastNeed=s-3),s):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},zn.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},In.StringDecoder,In.StringDecoder}),ed={};bn(ed,{StringDecoder:()=>td,default:()=>In});var td,Wb=lt(()=>{ye(),ve(),be(),_c(),_c(),td=In.StringDecoder}),rd=Ee((e,t)=>{ye(),ve(),be();var r=vn(),{PromisePrototypeThen:n,SymbolAsyncIterator:a,SymbolIterator:i}=it(),{Buffer:o}=(dt(),De(ht)),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:s}=At().codes;function u(c,f,d){let m;if(typeof f=="string"||f instanceof o)return new c({objectMode:!0,...d,read(){this.push(f),this.push(null)}});let y;if(f&&f[a])y=!0,m=f[a]();else if(f&&f[i])y=!1,m=f[i]();else throw new l("iterable",["Iterable"],f);let b=new c({objectMode:!0,highWaterMark:1,...d}),T=!1;b._read=function(){T||(T=!0,C())},b._destroy=function(O,N){n(B(O),()=>r.nextTick(N,O),v=>r.nextTick(N,v||O))};async function B(O){let N=O!=null,v=typeof m.throw=="function";if(N&&v){let{value:R,done:U}=await m.throw(O);if(await R,U)return}if(typeof m.return=="function"){let{value:R}=await m.return();await R}}async function C(){for(;;){try{let{value:O,done:N}=y?await m.next():m.next();if(N)b.push(null);else{let v=O&&typeof O.then=="function"?await O:O;if(v===null)throw T=!1,new s;if(b.push(v))continue;T=!1}}catch(O){b.destroy(O)}break}}return b}t.exports=u}),Do=Ee((e,t)=>{ye(),ve(),be();var r=vn(),{ArrayPrototypeIndexOf:n,NumberIsInteger:a,NumberIsNaN:i,NumberParseInt:o,ObjectDefineProperties:l,ObjectKeys:s,ObjectSetPrototypeOf:u,Promise:c,SafeSet:f,SymbolAsyncIterator:d,Symbol:m}=it();t.exports=j,j.ReadableState=_e;var{EventEmitter:y}=(Wn(),De(wn)),{Stream:b,prependListener:T}=jl(),{Buffer:B}=(dt(),De(ht)),{addAbortSignal:C}=jo(),O=$r(),N=dr().debuglog("stream",h=>{N=h}),v=_b(),R=$n(),{getHighWaterMark:U,getDefaultHighWaterMark:F}=Ul(),{aggregateTwoErrors:H,codes:{ERR_INVALID_ARG_TYPE:Y,ERR_METHOD_NOT_IMPLEMENTED:ie,ERR_OUT_OF_RANGE:I,ERR_STREAM_PUSH_AFTER_EOF:z,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:ee}}=At(),{validateObject:oe}=No(),ae=m("kPaused"),{StringDecoder:Z}=(Wb(),De(ed)),Q=rd();u(j.prototype,b.prototype),u(j,b);var he=()=>{},{errorOrDestroy:ce}=R;function _e(h,g,x){typeof x!="boolean"&&(x=g instanceof pr()),this.objectMode=!!(h&&h.objectMode),x&&(this.objectMode=this.objectMode||!!(h&&h.readableObjectMode)),this.highWaterMark=h?U(this,h,"readableHighWaterMark",x):F(!1),this.buffer=new v,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[ae]=null,this.errorEmitted=!1,this.emitClose=!h||h.emitClose!==!1,this.autoDestroy=!h||h.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=h&&h.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,h&&h.encoding&&(this.decoder=new Z(h.encoding),this.encoding=h.encoding)}function j(h){if(!(this instanceof j))return new j(h);let g=this instanceof pr();this._readableState=new _e(h,this,g),h&&(typeof h.read=="function"&&(this._read=h.read),typeof h.destroy=="function"&&(this._destroy=h.destroy),typeof h.construct=="function"&&(this._construct=h.construct),h.signal&&!g&&C(h.signal,this)),b.call(this,h),R.construct(this,()=>{this._readableState.needReadable&&te(this,this._readableState)})}j.prototype.destroy=R.destroy,j.prototype._undestroy=R.undestroy,j.prototype._destroy=function(h,g){g(h)},j.prototype[y.captureRejectionSymbol]=function(h){this.destroy(h)},j.prototype.push=function(h,g){return se(this,h,g,!1)},j.prototype.unshift=function(h,g){return se(this,h,g,!0)};function se(h,g,x,D){N("readableAddChunk",g);let A=h._readableState,$;if(A.objectMode||(typeof g=="string"?(x=x||A.defaultEncoding,A.encoding!==x&&(D&&A.encoding?g=B.from(g,x).toString(A.encoding):(g=B.from(g,x),x=""))):g instanceof B?x="":b._isUint8Array(g)?(g=b._uint8ArrayToBuffer(g),x=""):g!=null&&($=new Y("chunk",["string","Buffer","Uint8Array"],g))),$)ce(h,$);else if(g===null)A.reading=!1,S(h,A);else if(A.objectMode||g&&g.length>0)if(D)if(A.endEmitted)ce(h,new ee);else{if(A.destroyed||A.errored)return!1;fe(h,A,g,!0)}else if(A.ended)ce(h,new z);else{if(A.destroyed||A.errored)return!1;A.reading=!1,A.decoder&&!x?(g=A.decoder.write(g),A.objectMode||g.length!==0?fe(h,A,g,!1):te(h,A)):fe(h,A,g,!1)}else D||(A.reading=!1,te(h,A));return!A.ended&&(A.length0?(g.multiAwaitDrain?g.awaitDrainWriters.clear():g.awaitDrainWriters=null,g.dataEmitted=!0,h.emit("data",x)):(g.length+=g.objectMode?1:x.length,D?g.buffer.unshift(x):g.buffer.push(x),g.needReadable&&q(h)),te(h,g)}j.prototype.isPaused=function(){let h=this._readableState;return h[ae]===!0||h.flowing===!1},j.prototype.setEncoding=function(h){let g=new Z(h);this._readableState.decoder=g,this._readableState.encoding=this._readableState.decoder.encoding;let x=this._readableState.buffer,D="";for(let A of x)D+=g.write(A);return x.clear(),D!==""&&x.push(D),this._readableState.length=D.length,this};var Ae=1073741824;function ue(h){if(h>Ae)throw new I("size","<= 1GiB",h);return h--,h|=h>>>1,h|=h>>>2,h|=h>>>4,h|=h>>>8,h|=h>>>16,h++,h}function E(h,g){return h<=0||g.length===0&&g.ended?0:g.objectMode?1:i(h)?g.flowing&&g.length?g.buffer.first().length:g.length:h<=g.length?h:g.ended?g.length:0}j.prototype.read=function(h){N("read",h),h===void 0?h=NaN:a(h)||(h=o(h,10));let g=this._readableState,x=h;if(h>g.highWaterMark&&(g.highWaterMark=ue(h)),h!==0&&(g.emittedReadable=!1),h===0&&g.needReadable&&((g.highWaterMark!==0?g.length>=g.highWaterMark:g.length>0)||g.ended))return N("read: emitReadable",g.length,g.ended),g.length===0&&g.ended?J(this):q(this),null;if(h=E(h,g),h===0&&g.ended)return g.length===0&&J(this),null;let D=g.needReadable;if(N("need readable",D),(g.length===0||g.length-h0?A=V(h,g):A=null,A===null?(g.needReadable=g.length<=g.highWaterMark,h=0):(g.length-=h,g.multiAwaitDrain?g.awaitDrainWriters.clear():g.awaitDrainWriters=null),g.length===0&&(g.ended||(g.needReadable=!0),x!==h&&g.ended&&J(this)),A!==null&&!g.errorEmitted&&!g.closeEmitted&&(g.dataEmitted=!0,this.emit("data",A)),A};function S(h,g){if(N("onEofChunk"),!g.ended){if(g.decoder){let x=g.decoder.end();x&&x.length&&(g.buffer.push(x),g.length+=g.objectMode?1:x.length)}g.ended=!0,g.sync?q(h):(g.needReadable=!1,g.emittedReadable=!0,X(h))}}function q(h){let g=h._readableState;N("emitReadable",g.needReadable,g.emittedReadable),g.needReadable=!1,g.emittedReadable||(N("emitReadable",g.flowing),g.emittedReadable=!0,r.nextTick(X,h))}function X(h){let g=h._readableState;N("emitReadable_",g.destroyed,g.length,g.ended),!g.destroyed&&!g.errored&&(g.length||g.ended)&&(h.emit("readable"),g.emittedReadable=!1),g.needReadable=!g.flowing&&!g.ended&&g.length<=g.highWaterMark,G(h)}function te(h,g){!g.readingMore&&g.constructed&&(g.readingMore=!0,r.nextTick(re,h,g))}function re(h,g){for(;!g.reading&&!g.ended&&(g.length1&&D.pipes.includes(h)&&(N("false write response, pause",D.awaitDrainWriters.size),D.awaitDrainWriters.add(h)),x.pause()),ge||(ge=_(x,h),h.on("drain",ge))}x.on("data",Ce);function Ce(Xe){N("ondata");let Ze=h.write(Xe);N("dest.write",Ze),Ze===!1&&Te()}function Qe(Xe){if(N("onerror",Xe),mt(),h.removeListener("error",Qe),h.listenerCount("error")===0){let Ze=h._writableState||h._readableState;Ze&&!Ze.errorEmitted?ce(h,Xe):h.emit("error",Xe)}}T(h,"error",Qe);function gt(){h.removeListener("finish",Ue),mt()}h.once("close",gt);function Ue(){N("onfinish"),h.removeListener("close",gt),mt()}h.once("finish",Ue);function mt(){N("unpipe"),x.unpipe(h)}return h.emit("pipe",x),h.writableNeedDrain===!0?D.flowing&&Te():D.flowing||(N("pipe resume"),x.resume()),h};function _(h,g){return function(){let x=h._readableState;x.awaitDrainWriters===g?(N("pipeOnDrain",1),x.awaitDrainWriters=null):x.multiAwaitDrain&&(N("pipeOnDrain",x.awaitDrainWriters.size),x.awaitDrainWriters.delete(g)),(!x.awaitDrainWriters||x.awaitDrainWriters.size===0)&&h.listenerCount("data")&&h.resume()}}j.prototype.unpipe=function(h){let g=this._readableState,x={hasUnpiped:!1};if(g.pipes.length===0)return this;if(!h){let A=g.pipes;g.pipes=[],this.pause();for(let $=0;$0,D.flowing!==!1&&this.resume()):h==="readable"&&!D.endEmitted&&!D.readableListening&&(D.readableListening=D.needReadable=!0,D.flowing=!1,D.emittedReadable=!1,N("on readable",D.length,D.reading),D.length?q(this):D.reading||r.nextTick(w,this)),x},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(h,g){let x=b.prototype.removeListener.call(this,h,g);return h==="readable"&&r.nextTick(P,this),x},j.prototype.off=j.prototype.removeListener,j.prototype.removeAllListeners=function(h){let g=b.prototype.removeAllListeners.apply(this,arguments);return(h==="readable"||h===void 0)&&r.nextTick(P,this),g};function P(h){let g=h._readableState;g.readableListening=h.listenerCount("readable")>0,g.resumeScheduled&&g[ae]===!1?g.flowing=!0:h.listenerCount("data")>0?h.resume():g.readableListening||(g.flowing=null)}function w(h){N("readable nexttick read 0"),h.read(0)}j.prototype.resume=function(){let h=this._readableState;return h.flowing||(N("resume"),h.flowing=!h.readableListening,M(this,h)),h[ae]=!1,this};function M(h,g){g.resumeScheduled||(g.resumeScheduled=!0,r.nextTick(k,h,g))}function k(h,g){N("resume",g.reading),g.reading||h.read(0),g.resumeScheduled=!1,h.emit("resume"),G(h),g.flowing&&!g.reading&&h.read(0)}j.prototype.pause=function(){return N("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(N("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[ae]=!0,this};function G(h){let g=h._readableState;for(N("flow",g.flowing);g.flowing&&h.read()!==null;);}j.prototype.wrap=function(h){let g=!1;h.on("data",D=>{!this.push(D)&&h.pause&&(g=!0,h.pause())}),h.on("end",()=>{this.push(null)}),h.on("error",D=>{ce(this,D)}),h.on("close",()=>{this.destroy()}),h.on("destroy",()=>{this.destroy()}),this._read=()=>{g&&h.resume&&(g=!1,h.resume())};let x=s(h);for(let D=1;D{A=ne?H(A,ne):null,x(),x=he});try{for(;;){let ne=h.destroyed?null:h.read();if(ne!==null)yield ne;else{if(A)throw A;if(A===null)return;await new c(D)}}}catch(ne){throw A=H(A,ne),A}finally{(A||(g==null?void 0:g.destroyOnReturn)!==!1)&&(A===void 0||h._readableState.autoDestroy)?R.destroyer(h,null):(h.off("readable",D),$())}}l(j.prototype,{readable:{__proto__:null,get(){let h=this._readableState;return!!h&&h.readable!==!1&&!h.destroyed&&!h.errorEmitted&&!h.endEmitted},set(h){this._readableState&&(this._readableState.readable=!!h)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(h){this._readableState&&(this._readableState.flowing=h)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(h){this._readableState&&(this._readableState.destroyed=h)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),l(_e.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[ae]!==!1},set(h){this[ae]=!!h}}}),j._fromList=V;function V(h,g){if(g.length===0)return null;let x;return g.objectMode?x=g.buffer.shift():!h||h>=g.length?(g.decoder?x=g.buffer.join(""):g.buffer.length===1?x=g.buffer.first():x=g.buffer.concat(g.length),g.buffer.clear()):x=g.buffer.consume(h,g.decoder),x}function J(h){let g=h._readableState;N("endReadable",g.endEmitted),g.endEmitted||(g.ended=!0,r.nextTick(le,g,h))}function le(h,g){if(N("endReadableNT",h.endEmitted,h.length),!h.errored&&!h.closeEmitted&&!h.endEmitted&&h.length===0){if(h.endEmitted=!0,g.emit("end"),g.writable&&g.allowHalfOpen===!1)r.nextTick(pe,g);else if(h.autoDestroy){let x=g._writableState;(!x||x.autoDestroy&&(x.finished||x.writable===!1))&&g.destroy()}}}function pe(h){h.writable&&!h.writableEnded&&!h.destroyed&&h.end()}j.from=function(h,g){return Q(j,h,g)};var Se;function p(){return Se===void 0&&(Se={}),Se}j.fromWeb=function(h,g){return p().newStreamReadableFromReadableStream(h,g)},j.toWeb=function(h,g){return p().newReadableStreamFromStreamReadable(h,g)},j.wrap=function(h,g){var x,D;return new j({objectMode:(x=(D=h.readableObjectMode)!==null&&D!==void 0?D:h.objectMode)!==null&&x!==void 0?x:!0,...g,destroy(A,$){R.destroyer(h,A),$(A)}}).wrap(h)}}),nd=Ee((e,t)=>{ye(),ve(),be();var r=vn(),{ArrayPrototypeSlice:n,Error:a,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:o,ObjectDefineProperties:l,ObjectSetPrototypeOf:s,StringPrototypeToLowerCase:u,Symbol:c,SymbolHasInstance:f}=it();t.exports=Z,Z.WritableState=oe;var{EventEmitter:d}=(Wn(),De(wn)),m=jl().Stream,{Buffer:y}=(dt(),De(ht)),b=$n(),{addAbortSignal:T}=jo(),{getHighWaterMark:B,getDefaultHighWaterMark:C}=Ul(),{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:N,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:R,ERR_STREAM_DESTROYED:U,ERR_STREAM_ALREADY_FINISHED:F,ERR_STREAM_NULL_VALUES:H,ERR_STREAM_WRITE_AFTER_END:Y,ERR_UNKNOWN_ENCODING:ie}=At().codes,{errorOrDestroy:I}=b;s(Z.prototype,m.prototype),s(Z,m);function z(){}var ee=c("kOnFinished");function oe(w,M,k){typeof k!="boolean"&&(k=M instanceof pr()),this.objectMode=!!(w&&w.objectMode),k&&(this.objectMode=this.objectMode||!!(w&&w.writableObjectMode)),this.highWaterMark=w?B(this,w,"writableHighWaterMark",k):C(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let G=!!(w&&w.decodeStrings===!1);this.decodeStrings=!G,this.defaultEncoding=w&&w.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=j.bind(void 0,M),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,ae(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!w||w.emitClose!==!1,this.autoDestroy=!w||w.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[ee]=[]}function ae(w){w.buffered=[],w.bufferedIndex=0,w.allBuffers=!0,w.allNoop=!0}oe.prototype.getBuffer=function(){return n(this.buffered,this.bufferedIndex)},o(oe.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Z(w){let M=this instanceof pr();if(!M&&!i(Z,this))return new Z(w);this._writableState=new oe(w,this,M),w&&(typeof w.write=="function"&&(this._write=w.write),typeof w.writev=="function"&&(this._writev=w.writev),typeof w.destroy=="function"&&(this._destroy=w.destroy),typeof w.final=="function"&&(this._final=w.final),typeof w.construct=="function"&&(this._construct=w.construct),w.signal&&T(w.signal,this)),m.call(this,w),b.construct(this,()=>{let k=this._writableState;k.writing||ue(this,k),X(this,k)})}o(Z,f,{__proto__:null,value:function(w){return i(this,w)?!0:this!==Z?!1:w&&w._writableState instanceof oe}}),Z.prototype.pipe=function(){I(this,new R)};function Q(w,M,k,G){let K=w._writableState;if(typeof k=="function")G=k,k=K.defaultEncoding;else{if(!k)k=K.defaultEncoding;else if(k!=="buffer"&&!y.isEncoding(k))throw new ie(k);typeof G!="function"&&(G=z)}if(M===null)throw new H;if(!K.objectMode)if(typeof M=="string")K.decodeStrings!==!1&&(M=y.from(M,k),k="buffer");else if(M instanceof y)k="buffer";else if(m._isUint8Array(M))M=m._uint8ArrayToBuffer(M),k="buffer";else throw new O("chunk",["string","Buffer","Uint8Array"],M);let L;return K.ending?L=new Y:K.destroyed&&(L=new U("write")),L?(r.nextTick(G,L),I(w,L,!0),L):(K.pendingcb++,he(w,K,M,k,G))}Z.prototype.write=function(w,M,k){return Q(this,w,M,k)===!0},Z.prototype.cork=function(){this._writableState.corked++},Z.prototype.uncork=function(){let w=this._writableState;w.corked&&(w.corked--,w.writing||ue(this,w))},Z.prototype.setDefaultEncoding=function(w){if(typeof w=="string"&&(w=u(w)),!y.isEncoding(w))throw new ie(w);return this._writableState.defaultEncoding=w,this};function he(w,M,k,G,K){let L=M.objectMode?1:k.length;M.length+=L;let V=M.lengthk.bufferedIndex&&ue(w,k),G?k.afterWriteTickInfo!==null&&k.afterWriteTickInfo.cb===K?k.afterWriteTickInfo.count++:(k.afterWriteTickInfo={count:1,cb:K,stream:w,state:k},r.nextTick(se,k.afterWriteTickInfo)):fe(w,k,1,K))}function se({stream:w,state:M,count:k,cb:G}){return M.afterWriteTickInfo=null,fe(w,M,k,G)}function fe(w,M,k,G){for(!M.ending&&!w.destroyed&&M.length===0&&M.needDrain&&(M.needDrain=!1,w.emit("drain"));k-- >0;)M.pendingcb--,G();M.destroyed&&Ae(M),X(w,M)}function Ae(w){if(w.writing)return;for(let K=w.bufferedIndex;K1&&w._writev){M.pendingcb-=L-1;let J=M.allNoop?z:pe=>{for(let Se=V;Se256?(k.splice(0,V),M.bufferedIndex=0):M.bufferedIndex=V}M.bufferProcessing=!1}Z.prototype._write=function(w,M,k){if(this._writev)this._writev([{chunk:w,encoding:M}],k);else throw new N("_write()")},Z.prototype._writev=null,Z.prototype.end=function(w,M,k){let G=this._writableState;typeof w=="function"?(k=w,w=null,M=null):typeof M=="function"&&(k=M,M=null);let K;if(w!=null){let L=Q(this,w,M);L instanceof a&&(K=L)}return G.corked&&(G.corked=1,this.uncork()),K||(!G.errored&&!G.ending?(G.ending=!0,X(this,G,!0),G.ended=!0):G.finished?K=new F("end"):G.destroyed&&(K=new U("end"))),typeof k=="function"&&(K||G.finished?r.nextTick(k,K):G[ee].push(k)),this};function E(w){return w.ending&&!w.destroyed&&w.constructed&&w.length===0&&!w.errored&&w.buffered.length===0&&!w.finished&&!w.writing&&!w.errorEmitted&&!w.closeEmitted}function S(w,M){let k=!1;function G(K){if(k){I(w,K??v());return}if(k=!0,M.pendingcb--,K){let L=M[ee].splice(0);for(let V=0;V{E(K)?te(G,K):K.pendingcb--},w,M)):E(M)&&(M.pendingcb++,te(w,M))))}function te(w,M){M.pendingcb--,M.finished=!0;let k=M[ee].splice(0);for(let G=0;G{ye(),ve(),be();var r=vn(),n=(dt(),De(ht)),{isReadable:a,isWritable:i,isIterable:o,isNodeStream:l,isReadableNodeStream:s,isWritableNodeStream:u,isDuplexNodeStream:c}=br(),f=$r(),{AbortError:d,codes:{ERR_INVALID_ARG_TYPE:m,ERR_INVALID_RETURN_VALUE:y}}=At(),{destroyer:b}=$n(),T=pr(),B=Do(),{createDeferredPromise:C}=dr(),O=rd(),N=globalThis.Blob||n.Blob,v=typeof N<"u"?function(ie){return ie instanceof N}:function(ie){return!1},R=globalThis.AbortController||Nl().AbortController,{FunctionPrototypeCall:U}=it(),F=class extends T{constructor(ie){super(ie),(ie==null?void 0:ie.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(ie==null?void 0:ie.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function ie(I,z){if(c(I))return I;if(s(I))return Y({readable:I});if(u(I))return Y({writable:I});if(l(I))return Y({writable:!1,readable:!1});if(typeof I=="function"){let{value:oe,write:ae,final:Z,destroy:Q}=H(I);if(o(oe))return O(F,oe,{objectMode:!0,write:ae,final:Z,destroy:Q});let he=oe==null?void 0:oe.then;if(typeof he=="function"){let ce,_e=U(he,oe,j=>{if(j!=null)throw new y("nully","body",j)},j=>{b(ce,j)});return ce=new F({objectMode:!0,readable:!1,write:ae,final(j){Z(async()=>{try{await _e,r.nextTick(j,null)}catch(se){r.nextTick(j,se)}})},destroy:Q})}throw new y("Iterable, AsyncIterable or AsyncFunction",z,oe)}if(v(I))return ie(I.arrayBuffer());if(o(I))return O(F,I,{objectMode:!0,writable:!1});if(typeof(I==null?void 0:I.writable)=="object"||typeof(I==null?void 0:I.readable)=="object"){let oe=I!=null&&I.readable?s(I==null?void 0:I.readable)?I==null?void 0:I.readable:ie(I.readable):void 0,ae=I!=null&&I.writable?u(I==null?void 0:I.writable)?I==null?void 0:I.writable:ie(I.writable):void 0;return Y({readable:oe,writable:ae})}let ee=I==null?void 0:I.then;if(typeof ee=="function"){let oe;return U(ee,I,ae=>{ae!=null&&oe.push(ae),oe.push(null)},ae=>{b(oe,ae)}),oe=new F({objectMode:!0,writable:!1,read(){}})}throw new m(z,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],I)};function H(ie){let{promise:I,resolve:z}=C(),ee=new R,oe=ee.signal;return{value:ie(async function*(){for(;;){let ae=I;I=null;let{chunk:Z,done:Q,cb:he}=await ae;if(r.nextTick(he),Q)return;if(oe.aborted)throw new d(void 0,{cause:oe.reason});({promise:I,resolve:z}=C()),yield Z}}(),{signal:oe}),write(ae,Z,Q){let he=z;z=null,he({chunk:ae,done:!1,cb:Q})},final(ae){let Z=z;z=null,Z({done:!0,cb:ae})},destroy(ae,Z){ee.abort(),Z(ae)}}}function Y(ie){let I=ie.readable&&typeof ie.readable.read!="function"?B.wrap(ie.readable):ie.readable,z=ie.writable,ee=!!a(I),oe=!!i(z),ae,Z,Q,he,ce;function _e(j){let se=he;he=null,se?se(j):j&&ce.destroy(j)}return ce=new F({readableObjectMode:!!(I!=null&&I.readableObjectMode),writableObjectMode:!!(z!=null&&z.writableObjectMode),readable:ee,writable:oe}),oe&&(f(z,j=>{oe=!1,j&&b(I,j),_e(j)}),ce._write=function(j,se,fe){z.write(j,se)?fe():ae=fe},ce._final=function(j){z.end(),Z=j},z.on("drain",function(){if(ae){let j=ae;ae=null,j()}}),z.on("finish",function(){if(Z){let j=Z;Z=null,j()}})),ee&&(f(I,j=>{ee=!1,j&&b(I,j),_e(j)}),I.on("readable",function(){if(Q){let j=Q;Q=null,j()}}),I.on("end",function(){ce.push(null)}),ce._read=function(){for(;;){let j=I.read();if(j===null){Q=ce._read;return}if(!ce.push(j))return}}),ce._destroy=function(j,se){!j&&he!==null&&(j=new d),Q=null,ae=null,Z=null,he===null?se(j):(he=se,b(z,j),b(I,j))},ce}}),pr=Ee((e,t)=>{ye(),ve(),be();var{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:n,ObjectKeys:a,ObjectSetPrototypeOf:i}=it();t.exports=s;var o=Do(),l=nd();i(s.prototype,o.prototype),i(s,o);{let d=a(l.prototype);for(let m=0;m{ye(),ve(),be();var{ObjectSetPrototypeOf:r,Symbol:n}=it();t.exports=s;var{ERR_METHOD_NOT_IMPLEMENTED:a}=At().codes,i=pr(),{getHighWaterMark:o}=Ul();r(s.prototype,i.prototype),r(s,i);var l=n("kCallback");function s(f){if(!(this instanceof s))return new s(f);let d=f?o(this,f,"readableHighWaterMark",!0):null;d===0&&(f={...f,highWaterMark:null,readableHighWaterMark:d,writableHighWaterMark:f.writableHighWaterMark||0}),i.call(this,f),this._readableState.sync=!1,this[l]=null,f&&(typeof f.transform=="function"&&(this._transform=f.transform),typeof f.flush=="function"&&(this._flush=f.flush)),this.on("prefinish",c)}function u(f){typeof this._flush=="function"&&!this.destroyed?this._flush((d,m)=>{if(d){f?f(d):this.destroy(d);return}m!=null&&this.push(m),this.push(null),f&&f()}):(this.push(null),f&&f())}function c(){this._final!==u&&u.call(this)}s.prototype._final=u,s.prototype._transform=function(f,d,m){throw new a("_transform()")},s.prototype._write=function(f,d,m){let y=this._readableState,b=this._writableState,T=y.length;this._transform(f,d,(B,C)=>{if(B){m(B);return}C!=null&&this.push(C),b.ended||T===y.length||y.length{ye(),ve(),be();var{ObjectSetPrototypeOf:r}=it();t.exports=a;var n=id();r(a.prototype,n.prototype),r(a,n);function a(i){if(!(this instanceof a))return new a(i);n.call(this,i)}a.prototype._transform=function(i,o,l){l(null,i)}}),$l=Ee((e,t)=>{ye(),ve(),be();var r=vn(),{ArrayIsArray:n,Promise:a,SymbolAsyncIterator:i}=it(),o=$r(),{once:l}=dr(),s=$n(),u=pr(),{aggregateTwoErrors:c,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:d,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:b},AbortError:T}=At(),{validateFunction:B,validateAbortSignal:C}=No(),{isIterable:O,isReadable:N,isReadableNodeStream:v,isNodeStream:R,isTransformStream:U,isWebStream:F,isReadableStream:H,isReadableEnded:Y}=br(),ie=globalThis.AbortController||Nl().AbortController,I,z;function ee(se,fe,Ae){let ue=!1;se.on("close",()=>{ue=!0});let E=o(se,{readable:fe,writable:Ae},S=>{ue=!S});return{destroy:S=>{ue||(ue=!0,s.destroyer(se,S||new y("pipe")))},cleanup:E}}function oe(se){return B(se[se.length-1],"streams[stream.length - 1]"),se.pop()}function ae(se){if(O(se))return se;if(v(se))return Z(se);throw new f("val",["Readable","Iterable","AsyncIterable"],se)}async function*Z(se){z||(z=Do()),yield*z.prototype[i].call(se)}async function Q(se,fe,Ae,{end:ue}){let E,S=null,q=re=>{if(re&&(E=re),S){let _=S;S=null,_()}},X=()=>new a((re,_)=>{E?_(E):S=()=>{E?_(E):re()}});fe.on("drain",q);let te=o(fe,{readable:!1},q);try{fe.writableNeedDrain&&await X();for await(let re of se)fe.write(re)||await X();ue&&fe.end(),await X(),Ae()}catch(re){Ae(E!==re?c(E,re):re)}finally{te(),fe.off("drain",q)}}async function he(se,fe,Ae,{end:ue}){U(fe)&&(fe=fe.writable);let E=fe.getWriter();try{for await(let S of se)await E.ready,E.write(S).catch(()=>{});await E.ready,ue&&await E.close(),Ae()}catch(S){try{await E.abort(S),Ae(S)}catch(q){Ae(q)}}}function ce(...se){return _e(se,l(oe(se)))}function _e(se,fe,Ae){if(se.length===1&&n(se[0])&&(se=se[0]),se.length<2)throw new m("streams");let ue=new ie,E=ue.signal,S=Ae==null?void 0:Ae.signal,q=[];C(S,"options.signal");function X(){M(new T)}S==null||S.addEventListener("abort",X);let te,re,_=[],P=0;function w(L){M(L,--P===0)}function M(L,V){if(L&&(!te||te.code==="ERR_STREAM_PREMATURE_CLOSE")&&(te=L),!(!te&&!V)){for(;_.length;)_.shift()(te);S==null||S.removeEventListener("abort",X),ue.abort(),V&&(te||q.forEach(J=>J()),r.nextTick(fe,te,re))}}let k;for(let L=0;L0,pe=J||(Ae==null?void 0:Ae.end)!==!1,Se=L===se.length-1;if(R(V)){let p=function(h){h&&h.name!=="AbortError"&&h.code!=="ERR_STREAM_PREMATURE_CLOSE"&&w(h)};if(pe){let{destroy:h,cleanup:g}=ee(V,J,le);_.push(h),N(V)&&Se&&q.push(g)}V.on("error",p),N(V)&&Se&&q.push(()=>{V.removeListener("error",p)})}if(L===0)if(typeof V=="function"){if(k=V({signal:E}),!O(k))throw new d("Iterable, AsyncIterable or Stream","source",k)}else O(V)||v(V)||U(V)?k=V:k=u.from(V);else if(typeof V=="function"){if(U(k)){var G;k=ae((G=k)===null||G===void 0?void 0:G.readable)}else k=ae(k);if(k=V(k,{signal:E}),J){if(!O(k,!0))throw new d("AsyncIterable",`transform[${L-1}]`,k)}else{var K;I||(I=od());let p=new I({objectMode:!0}),h=(K=k)===null||K===void 0?void 0:K.then;if(typeof h=="function")P++,h.call(k,D=>{re=D,D!=null&&p.write(D),pe&&p.end(),r.nextTick(w)},D=>{p.destroy(D),r.nextTick(w,D)});else if(O(k,!0))P++,Q(k,p,w,{end:pe});else if(H(k)||U(k)){let D=k.readable||k;P++,Q(D,p,w,{end:pe})}else throw new d("AsyncIterable or Promise","destination",k);k=p;let{destroy:g,cleanup:x}=ee(k,!1,!0);_.push(g),Se&&q.push(x)}}else if(R(V)){if(v(k)){P+=2;let p=j(k,V,w,{end:pe});N(V)&&Se&&q.push(p)}else if(U(k)||H(k)){let p=k.readable||k;P++,Q(p,V,w,{end:pe})}else if(O(k))P++,Q(k,V,w,{end:pe});else throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);k=V}else if(F(V)){if(v(k))P++,he(ae(k),V,w,{end:pe});else if(H(k)||O(k))P++,he(k,V,w,{end:pe});else if(U(k))P++,he(k.readable,V,w,{end:pe});else throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);k=V}else k=u.from(V)}return(E!=null&&E.aborted||S!=null&&S.aborted)&&r.nextTick(X),k}function j(se,fe,Ae,{end:ue}){let E=!1;if(fe.on("close",()=>{E||Ae(new b)}),se.pipe(fe,{end:!1}),ue){let S=function(){E=!0,fe.end()};Y(se)?r.nextTick(S):se.once("end",S)}else Ae();return o(se,{readable:!0,writable:!1},S=>{let q=se._readableState;S&&S.code==="ERR_STREAM_PREMATURE_CLOSE"&&q&&q.ended&&!q.errored&&!q.errorEmitted?se.once("end",Ae).once("error",Ae):Ae(S)}),o(fe,{readable:!1,writable:!0},Ae)}t.exports={pipelineImpl:_e,pipeline:ce}}),sd=Ee((e,t)=>{ye(),ve(),be();var{pipeline:r}=$l(),n=pr(),{destroyer:a}=$n(),{isNodeStream:i,isReadable:o,isWritable:l,isWebStream:s,isTransformStream:u,isWritableStream:c,isReadableStream:f}=br(),{AbortError:d,codes:{ERR_INVALID_ARG_VALUE:m,ERR_MISSING_ARGS:y}}=At(),b=$r();t.exports=function(...T){if(T.length===0)throw new y("streams");if(T.length===1)return n.from(T[0]);let B=[...T];if(typeof T[0]=="function"&&(T[0]=n.from(T[0])),typeof T[T.length-1]=="function"){let I=T.length-1;T[I]=n.from(T[I])}for(let I=0;I0&&!(l(T[I])||c(T[I])||u(T[I])))throw new m(`streams[${I}]`,B[I],"must be writable")}let C,O,N,v,R;function U(I){let z=v;v=null,z?z(I):I?R.destroy(I):!ie&&!Y&&R.destroy()}let F=T[0],H=r(T,U),Y=!!(l(F)||c(F)||u(F)),ie=!!(o(H)||f(H)||u(H));if(R=new n({writableObjectMode:!!(F!=null&&F.writableObjectMode),readableObjectMode:!!(H!=null&&H.writableObjectMode),writable:Y,readable:ie}),Y){if(i(F))R._write=function(z,ee,oe){F.write(z,ee)?oe():C=oe},R._final=function(z){F.end(),O=z},F.on("drain",function(){if(C){let z=C;C=null,z()}});else if(s(F)){let z=(u(F)?F.writable:F).getWriter();R._write=async function(ee,oe,ae){try{await z.ready,z.write(ee).catch(()=>{}),ae()}catch(Z){ae(Z)}},R._final=async function(ee){try{await z.ready,z.close().catch(()=>{}),O=ee}catch(oe){ee(oe)}}}let I=u(H)?H.readable:H;b(I,()=>{if(O){let z=O;O=null,z()}})}if(ie){if(i(H))H.on("readable",function(){if(N){let I=N;N=null,I()}}),H.on("end",function(){R.push(null)}),R._read=function(){for(;;){let I=H.read();if(I===null){N=R._read;return}if(!R.push(I))return}};else if(s(H)){let I=(u(H)?H.readable:H).getReader();R._read=async function(){for(;;)try{let{value:z,done:ee}=await I.read();if(!R.push(z))return;if(ee){R.push(null);return}}catch{return}}}}return R._destroy=function(I,z){!I&&v!==null&&(I=new d),N=null,C=null,O=null,v===null?z(I):(v=z,i(H)&&a(H,I))},R}}),Vb=Ee((e,t)=>{ye(),ve(),be();var r=globalThis.AbortController||Nl().AbortController,{codes:{ERR_INVALID_ARG_VALUE:n,ERR_INVALID_ARG_TYPE:a,ERR_MISSING_ARGS:i,ERR_OUT_OF_RANGE:o},AbortError:l}=At(),{validateAbortSignal:s,validateInteger:u,validateObject:c}=No(),f=it().Symbol("kWeak"),{finished:d}=$r(),m=sd(),{addAbortSignalNoValidate:y}=jo(),{isWritable:b,isNodeStream:T}=br(),{ArrayPrototypePush:B,MathFloor:C,Number:O,NumberIsNaN:N,Promise:v,PromiseReject:R,PromisePrototypeThen:U,Symbol:F}=it(),H=F("kEmpty"),Y=F("kEof");function ie(ue,E){if(E!=null&&c(E,"options"),(E==null?void 0:E.signal)!=null&&s(E.signal,"options.signal"),T(ue)&&!b(ue))throw new n("stream",ue,"must be writable");let S=m(this,ue);return E!=null&&E.signal&&y(E.signal,S),S}function I(ue,E){if(typeof ue!="function")throw new a("fn",["Function","AsyncFunction"],ue);E!=null&&c(E,"options"),(E==null?void 0:E.signal)!=null&&s(E.signal,"options.signal");let S=1;return(E==null?void 0:E.concurrency)!=null&&(S=C(E.concurrency)),u(S,"concurrency",1),(async function*(){var q,X;let te=new r,re=this,_=[],P=te.signal,w={signal:P},M=()=>te.abort();E!=null&&(q=E.signal)!==null&&q!==void 0&&q.aborted&&M(),E==null||(X=E.signal)===null||X===void 0||X.addEventListener("abort",M);let k,G,K=!1;function L(){K=!0}async function V(){try{for await(let pe of re){var J;if(K)return;if(P.aborted)throw new l;try{pe=ue(pe,w)}catch(Se){pe=R(Se)}pe!==H&&(typeof((J=pe)===null||J===void 0?void 0:J.catch)=="function"&&pe.catch(L),_.push(pe),k&&(k(),k=null),!K&&_.length&&_.length>=S&&await new v(Se=>{G=Se}))}_.push(Y)}catch(pe){let Se=R(pe);U(Se,void 0,L),_.push(Se)}finally{var le;K=!0,k&&(k(),k=null),E==null||(le=E.signal)===null||le===void 0||le.removeEventListener("abort",M)}}V();try{for(;;){for(;_.length>0;){let J=await _[0];if(J===Y)return;if(P.aborted)throw new l;J!==H&&(yield J),_.shift(),G&&(G(),G=null)}await new v(J=>{k=J})}}finally{te.abort(),K=!0,G&&(G(),G=null)}}).call(this)}function z(ue=void 0){return ue!=null&&c(ue,"options"),(ue==null?void 0:ue.signal)!=null&&s(ue.signal,"options.signal"),(async function*(){let E=0;for await(let q of this){var S;if(ue!=null&&(S=ue.signal)!==null&&S!==void 0&&S.aborted)throw new l({cause:ue.signal.reason});yield[E++,q]}}).call(this)}async function ee(ue,E=void 0){for await(let S of Q.call(this,ue,E))return!0;return!1}async function oe(ue,E=void 0){if(typeof ue!="function")throw new a("fn",["Function","AsyncFunction"],ue);return!await ee.call(this,async(...S)=>!await ue(...S),E)}async function ae(ue,E){for await(let S of Q.call(this,ue,E))return S}async function Z(ue,E){if(typeof ue!="function")throw new a("fn",["Function","AsyncFunction"],ue);async function S(q,X){return await ue(q,X),H}for await(let q of I.call(this,S,E));}function Q(ue,E){if(typeof ue!="function")throw new a("fn",["Function","AsyncFunction"],ue);async function S(q,X){return await ue(q,X)?q:H}return I.call(this,S,E)}var he=class extends i{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function ce(ue,E,S){var q;if(typeof ue!="function")throw new a("reducer",["Function","AsyncFunction"],ue);S!=null&&c(S,"options"),(S==null?void 0:S.signal)!=null&&s(S.signal,"options.signal");let X=arguments.length>1;if(S!=null&&(q=S.signal)!==null&&q!==void 0&&q.aborted){let w=new l(void 0,{cause:S.signal.reason});throw this.once("error",()=>{}),await d(this.destroy(w)),w}let te=new r,re=te.signal;if(S!=null&&S.signal){let w={once:!0,[f]:this};S.signal.addEventListener("abort",()=>te.abort(),w)}let _=!1;try{for await(let w of this){var P;if(_=!0,S!=null&&(P=S.signal)!==null&&P!==void 0&&P.aborted)throw new l;X?E=await ue(E,w,{signal:re}):(E=w,X=!0)}if(!_&&!X)throw new he}finally{te.abort()}return E}async function _e(ue){ue!=null&&c(ue,"options"),(ue==null?void 0:ue.signal)!=null&&s(ue.signal,"options.signal");let E=[];for await(let q of this){var S;if(ue!=null&&(S=ue.signal)!==null&&S!==void 0&&S.aborted)throw new l(void 0,{cause:ue.signal.reason});B(E,q)}return E}function j(ue,E){let S=I.call(this,ue,E);return(async function*(){for await(let q of S)yield*q}).call(this)}function se(ue){if(ue=O(ue),N(ue))return 0;if(ue<0)throw new o("number",">= 0",ue);return ue}function fe(ue,E=void 0){return E!=null&&c(E,"options"),(E==null?void 0:E.signal)!=null&&s(E.signal,"options.signal"),ue=se(ue),(async function*(){var S;if(E!=null&&(S=E.signal)!==null&&S!==void 0&&S.aborted)throw new l;for await(let X of this){var q;if(E!=null&&(q=E.signal)!==null&&q!==void 0&&q.aborted)throw new l;ue--<=0&&(yield X)}}).call(this)}function Ae(ue,E=void 0){return E!=null&&c(E,"options"),(E==null?void 0:E.signal)!=null&&s(E.signal,"options.signal"),ue=se(ue),(async function*(){var S;if(E!=null&&(S=E.signal)!==null&&S!==void 0&&S.aborted)throw new l;for await(let X of this){var q;if(E!=null&&(q=E.signal)!==null&&q!==void 0&&q.aborted)throw new l;if(ue-- >0)yield X;else return}}).call(this)}t.exports.streamReturningOperators={asIndexedPairs:z,drop:fe,filter:Q,flatMap:j,map:I,take:Ae,compose:ie},t.exports.promiseReturningOperators={every:oe,forEach:Z,reduce:ce,toArray:_e,some:ee,find:ae}}),ad=Ee((e,t)=>{ye(),ve(),be();var{ArrayPrototypePop:r,Promise:n}=it(),{isIterable:a,isNodeStream:i,isWebStream:o}=br(),{pipelineImpl:l}=$l(),{finished:s}=$r();ld();function u(...c){return new n((f,d)=>{let m,y,b=c[c.length-1];if(b&&typeof b=="object"&&!i(b)&&!a(b)&&!o(b)){let T=r(c);m=T.signal,y=T.end}l(c,(T,B)=>{T?d(T):f(B)},{signal:m,end:y})})}t.exports={finished:s,pipeline:u}}),ld=Ee((e,t)=>{ye(),ve(),be();var{Buffer:r}=(dt(),De(ht)),{ObjectDefineProperty:n,ObjectKeys:a,ReflectApply:i}=it(),{promisify:{custom:o}}=dr(),{streamReturningOperators:l,promiseReturningOperators:s}=Vb(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=At(),c=sd(),{pipeline:f}=$l(),{destroyer:d}=$n(),m=$r(),y=ad(),b=br(),T=t.exports=jl().Stream;T.isDisturbed=b.isDisturbed,T.isErrored=b.isErrored,T.isReadable=b.isReadable,T.Readable=Do();for(let C of a(l)){let O=function(...v){if(new.target)throw u();return T.Readable.from(i(N,this,v))},N=l[C];n(O,"name",{__proto__:null,value:N.name}),n(O,"length",{__proto__:null,value:N.length}),n(T.Readable.prototype,C,{__proto__:null,value:O,enumerable:!1,configurable:!0,writable:!0})}for(let C of a(s)){let O=function(...v){if(new.target)throw u();return i(N,this,v)},N=s[C];n(O,"name",{__proto__:null,value:N.name}),n(O,"length",{__proto__:null,value:N.length}),n(T.Readable.prototype,C,{__proto__:null,value:O,enumerable:!1,configurable:!0,writable:!0})}T.Writable=nd(),T.Duplex=pr(),T.Transform=id(),T.PassThrough=od(),T.pipeline=f;var{addAbortSignal:B}=jo();T.addAbortSignal=B,T.finished=m,T.destroy=d,T.compose=c,n(T,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return y}}),n(f,o,{__proto__:null,enumerable:!0,get(){return y.pipeline}}),n(m,o,{__proto__:null,enumerable:!0,get(){return y.finished}}),T.Stream=T,T._isUint8Array=function(C){return C instanceof Uint8Array},T._uint8ArrayToBuffer=function(C){return r.from(C.buffer,C.byteOffset,C.byteLength)}}),_n=Ee((e,t)=>{ye(),ve(),be();var r=ld(),n=ad(),a=r.Readable.destroy;t.exports=r.Readable,t.exports._uint8ArrayToBuffer=r._uint8ArrayToBuffer,t.exports._isUint8Array=r._isUint8Array,t.exports.isDisturbed=r.isDisturbed,t.exports.isErrored=r.isErrored,t.exports.isReadable=r.isReadable,t.exports.Readable=r.Readable,t.exports.Writable=r.Writable,t.exports.Duplex=r.Duplex,t.exports.Transform=r.Transform,t.exports.PassThrough=r.PassThrough,t.exports.addAbortSignal=r.addAbortSignal,t.exports.finished=r.finished,t.exports.destroy=r.destroy,t.exports.destroy=a,t.exports.pipeline=r.pipeline,t.exports.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get(){return n}}),t.exports.Stream=r.Stream,t.exports.default=t.exports}),qb=Ee((e,t)=>{ye(),ve(),be(),typeof Object.create=="function"?t.exports=function(r,n){n&&(r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(r,n){if(n){r.super_=n;var a=function(){};a.prototype=n.prototype,r.prototype=new a,r.prototype.constructor=r}}}),zb=Ee((e,t)=>{ye(),ve(),be();var{Buffer:r}=(dt(),De(ht)),n=Symbol.for("BufferList");function a(i){if(!(this instanceof a))return new a(i);a._init.call(this,i)}a._init=function(i){Object.defineProperty(this,n,{value:!0}),this._bufs=[],this.length=0,i&&this.append(i)},a.prototype._new=function(i){return new a(i)},a.prototype._offset=function(i){if(i===0)return[0,0];let o=0;for(let l=0;lthis.length||i<0)return;let o=this._offset(i);return this._bufs[o[0]][o[1]]},a.prototype.slice=function(i,o){return typeof i=="number"&&i<0&&(i+=this.length),typeof o=="number"&&o<0&&(o+=this.length),this.copy(null,0,i,o)},a.prototype.copy=function(i,o,l,s){if((typeof l!="number"||l<0)&&(l=0),(typeof s!="number"||s>this.length)&&(s=this.length),l>=this.length||s<=0)return i||r.alloc(0);let u=!!i,c=this._offset(l),f=s-l,d=f,m=u&&o||0,y=c[1];if(l===0&&s===this.length){if(!u)return this._bufs.length===1?this._bufs[0]:r.concat(this._bufs,this.length);for(let b=0;bT)this._bufs[b].copy(i,m,y),m+=T;else{this._bufs[b].copy(i,m,y,y+d),m+=T;break}d-=T,y&&(y=0)}return i.length>m?i.slice(0,m):i},a.prototype.shallowSlice=function(i,o){if(i=i||0,o=typeof o!="number"?this.length:o,i<0&&(i+=this.length),o<0&&(o+=this.length),i===o)return this._new();let l=this._offset(i),s=this._offset(o),u=this._bufs.slice(l[0],s[0]+1);return s[1]===0?u.pop():u[u.length-1]=u[u.length-1].slice(0,s[1]),l[1]!==0&&(u[0]=u[0].slice(l[1])),this._new(u)},a.prototype.toString=function(i,o,l){return this.slice(o,l).toString(i)},a.prototype.consume=function(i){if(i=Math.trunc(i),Number.isNaN(i)||i<=0)return this;for(;this._bufs.length;)if(i>=this._bufs[0].length)i-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(i),this.length-=i;break}return this},a.prototype.duplicate=function(){let i=this._new();for(let o=0;othis.length?this.length:o;let s=this._offset(o),u=s[0],c=s[1];for(;u=i.length){let d=f.indexOf(i,c);if(d!==-1)return this._reverseOffset([u,d]);c=f.length-i.length+1}else{let d=this._reverseOffset([u,c]);if(this._match(d,i))return d;c++}c=0}return-1},a.prototype._match=function(i,o){if(this.length-i{ye(),ve(),be();var r=_n().Duplex,n=qb(),a=zb();function i(o){if(!(this instanceof i))return new i(o);if(typeof o=="function"){this._callback=o;let l=(function(s){this._callback&&(this._callback(s),this._callback=null)}).bind(this);this.on("pipe",function(s){s.on("error",l)}),this.on("unpipe",function(s){s.removeListener("error",l)}),o=null}a._init.call(this,o),r.call(this)}n(i,r),Object.assign(i.prototype,a.prototype),i.prototype._new=function(o){return new i(o)},i.prototype._write=function(o,l,s){this._appendBuffer(o),typeof s=="function"&&s()},i.prototype._read=function(o){if(!this.length)return this.push(null);o=Math.min(o,this.length),this.push(this.slice(0,o)),this.consume(o)},i.prototype.end=function(o){r.prototype.end.call(this,o),this._callback&&(this._callback(null,this.slice()),this._callback=null)},i.prototype._destroy=function(o,l){this._bufs.length=0,this.length=0,l(o)},i.prototype._isBufferList=function(o){return o instanceof i||o instanceof a||i.isBufferList(o)},i.isBufferList=a.isBufferList,t.exports=i,t.exports.BufferListStream=i,t.exports.BufferList=a}),Gb=Ee((e,t)=>{ye(),ve(),be();var r=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};t.exports=r}),ud=Ee((e,t)=>{ye(),ve(),be();var r=t.exports,{Buffer:n}=(dt(),De(ht));r.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},r.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0},r.requiredHeaderFlagsErrors={};for(let i in r.requiredHeaderFlags){let o=r.requiredHeaderFlags[i];r.requiredHeaderFlagsErrors[i]="Invalid header flag bits, must be 0x"+o.toString(16)+" for "+r.types[i]+" packet"}r.codes={};for(let i in r.types){let o=r.types[i];r.codes[o]=i}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=n.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=n.from([r.codes.connack<[0,1].map(l=>[0,1].map(s=>{let u=n.alloc(1);return u.writeUInt8(r.codes[i]<n.from([i])),r.EMPTY={pingreq:n.from([r.codes.pingreq<<4,0]),pingresp:n.from([r.codes.pingresp<<4,0]),disconnect:n.from([r.codes.disconnect<<4,0])},r.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"},r.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},r.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},r.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"},r.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},r.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}}),Yb=Ee((e,t)=>{ye(),ve(),be();var r=1e3,n=r*60,a=n*60,i=a*24,o=i*7,l=i*365.25;t.exports=function(d,m){m=m||{};var y=typeof d;if(y==="string"&&d.length>0)return s(d);if(y==="number"&&isFinite(d))return m.long?c(d):u(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function s(d){if(d=String(d),!(d.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(m){var y=parseFloat(m[1]),b=(m[2]||"ms").toLowerCase();switch(b){case"years":case"year":case"yrs":case"yr":case"y":return y*l;case"weeks":case"week":case"w":return y*o;case"days":case"day":case"d":return y*i;case"hours":case"hour":case"hrs":case"hr":case"h":return y*a;case"minutes":case"minute":case"mins":case"min":case"m":return y*n;case"seconds":case"second":case"secs":case"sec":case"s":return y*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return y;default:return}}}}function u(d){var m=Math.abs(d);return m>=i?Math.round(d/i)+"d":m>=a?Math.round(d/a)+"h":m>=n?Math.round(d/n)+"m":m>=r?Math.round(d/r)+"s":d+"ms"}function c(d){var m=Math.abs(d);return m>=i?f(d,m,i,"day"):m>=a?f(d,m,a,"hour"):m>=n?f(d,m,n,"minute"):m>=r?f(d,m,r,"second"):d+" ms"}function f(d,m,y,b){var T=m>=y*1.5;return Math.round(d/y)+" "+b+(T?"s":"")}}),Qb=Ee((e,t)=>{ye(),ve(),be();function r(n){i.debug=i,i.default=i,i.coerce=f,i.disable=s,i.enable=l,i.enabled=u,i.humanize=Yb(),i.destroy=d,Object.keys(n).forEach(m=>{i[m]=n[m]}),i.names=[],i.skips=[],i.formatters={};function a(m){let y=0;for(let b=0;b{if(F==="%%")return"%";U++;let Y=i.formatters[H];if(typeof Y=="function"){let ie=O[U];F=Y.call(N,ie),O.splice(U,1),U--}return F}),i.formatArgs.call(N,O),(N.log||i.log).apply(N,O)}return C.namespace=m,C.useColors=i.useColors(),C.color=i.selectColor(m),C.extend=o,C.destroy=i.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>b!==null?b:(T!==i.namespaces&&(T=i.namespaces,B=i.enabled(m)),B),set:O=>{b=O}}),typeof i.init=="function"&&i.init(C),C}function o(m,y){let b=i(this.namespace+(typeof y>"u"?":":y)+m);return b.log=this.log,b}function l(m){i.save(m),i.namespaces=m,i.names=[],i.skips=[];let y,b=(typeof m=="string"?m:"").split(/[\s,]+/),T=b.length;for(y=0;y"-"+y)].join(",");return i.enable(""),m}function u(m){if(m[m.length-1]==="*")return!0;let y,b;for(y=0,b=i.skips.length;y{ye(),ve(),be(),e.formatArgs=n,e.save=a,e.load=i,e.useColors=r,e.storage=o(),e.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let u="color: "+this.color;s.splice(1,0,u,"color: inherit");let c=0,f=0;s[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(c++,d==="%c"&&(f=c))}),s.splice(f,0,u)}e.log=console.debug||console.log||(()=>{});function a(s){try{s?e.storage.setItem("debug",s):e.storage.removeItem("debug")}catch{}}function i(){let s;try{s=e.storage.getItem("debug")}catch{}return!s&&typeof et<"u"&&"env"in et&&(s=et.env.DEBUG),s}function o(){try{return localStorage}catch{}}t.exports=Qb()(e);var{formatters:l}=t.exports;l.j=function(s){try{return JSON.stringify(s)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}),Jb=Ee((e,t)=>{ye(),ve(),be();var r=Kb(),{EventEmitter:n}=(Wn(),De(wn)),a=Gb(),i=ud(),o=gr()("mqtt-packet:parser"),l=class za extends n{constructor(){super(),this.parser=this.constructor.parser}static parser(u){return this instanceof za?(this.settings=u||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new za().parser(u)}_resetState(){o("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new a,this.error=null,this._list=r(),this._stateCounter=0}parse(u){for(this.error&&this._resetState(),this._list.append(u),o("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,o("parse: state complete. _stateCounter is now: %d",this._stateCounter),o("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return o("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let u=this._list.readUInt8(0),c=u>>i.CMD_SHIFT;this.packet.cmd=i.types[c];let f=u&15,d=i.requiredHeaderFlags[c];return d!=null&&f!==d?this._emitError(new Error(i.requiredHeaderFlagsErrors[c])):(this.packet.retain=(u&i.RETAIN_MASK)!==0,this.packet.qos=u>>i.QOS_SHIFT&i.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(u&i.DUP_MASK)!==0,o("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let u=this._parseVarByteNum(!0);return u&&(this.packet.length=u.value,this._list.consume(u.bytes)),o("_parseLength %d",u.value),!!u}_parsePayload(){o("_parsePayload: payload %O",this._list);let u=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}u=!0}return o("_parsePayload complete result: %s",u),u}_parseConnect(){o("_parseConnect");let u,c,f,d,m={},y=this.packet,b=this._parseString();if(b===null)return this._emitError(new Error("Cannot parse protocolId"));if(b!=="MQTT"&&b!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(y.protocolId=b,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(y.protocolVersion=this._list.readUInt8(this._pos),y.protocolVersion>=128&&(y.bridgeMode=!0,y.protocolVersion=y.protocolVersion-128),y.protocolVersion!==3&&y.protocolVersion!==4&&y.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(this._list.readUInt8(this._pos)&1)return this._emitError(new Error("Connect flag bit 0 must be 0, but got 1"));m.username=this._list.readUInt8(this._pos)&i.USERNAME_MASK,m.password=this._list.readUInt8(this._pos)&i.PASSWORD_MASK,m.will=this._list.readUInt8(this._pos)&i.WILL_FLAG_MASK;let T=!!(this._list.readUInt8(this._pos)&i.WILL_RETAIN_MASK),B=(this._list.readUInt8(this._pos)&i.WILL_QOS_MASK)>>i.WILL_QOS_SHIFT;if(m.will)y.will={},y.will.retain=T,y.will.qos=B;else{if(T)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(B)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(y.clean=(this._list.readUInt8(this._pos)&i.CLEAN_SESSION_MASK)!==0,this._pos++,y.keepalive=this._parseNum(),y.keepalive===-1)return this._emitError(new Error("Packet too short"));if(y.protocolVersion===5){let O=this._parseProperties();Object.getOwnPropertyNames(O).length&&(y.properties=O)}let C=this._parseString();if(C===null)return this._emitError(new Error("Packet too short"));if(y.clientId=C,o("_parseConnect: packet.clientId: %s",y.clientId),m.will){if(y.protocolVersion===5){let O=this._parseProperties();Object.getOwnPropertyNames(O).length&&(y.will.properties=O)}if(u=this._parseString(),u===null)return this._emitError(new Error("Cannot parse will topic"));if(y.will.topic=u,o("_parseConnect: packet.will.topic: %s",y.will.topic),c=this._parseBuffer(),c===null)return this._emitError(new Error("Cannot parse will payload"));y.will.payload=c,o("_parseConnect: packet.will.paylaod: %s",y.will.payload)}if(m.username){if(d=this._parseString(),d===null)return this._emitError(new Error("Cannot parse username"));y.username=d,o("_parseConnect: packet.username: %s",y.username)}if(m.password){if(f=this._parseBuffer(),f===null)return this._emitError(new Error("Cannot parse password"));y.password=f}return this.settings=y,o("_parseConnect: complete"),y}_parseConnack(){o("_parseConnack");let u=this.packet;if(this._list.length<1)return null;let c=this._list.readUInt8(this._pos++);if(c>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(u.sessionPresent=!!(c&i.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?u.reasonCode=this._list.readUInt8(this._pos++):u.reasonCode=0;else{if(this._list.length<2)return null;u.returnCode=this._list.readUInt8(this._pos++)}if(u.returnCode===-1||u.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let f=this._parseProperties();Object.getOwnPropertyNames(f).length&&(u.properties=f)}o("_parseConnack: complete")}_parsePublish(){o("_parsePublish");let u=this.packet;if(u.topic=this._parseString(),u.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(u.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(u.properties=c)}u.payload=this._list.slice(this._pos,u.length),o("_parsePublish: payload from buffer list: %o",u.payload)}}_parseSubscribe(){o("_parseSubscribe");let u=this.packet,c,f,d,m,y,b,T;if(u.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let B=this._parseProperties();Object.getOwnPropertyNames(B).length&&(u.properties=B)}if(u.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos=u.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(f=this._parseByte(),this.settings.protocolVersion===5){if(f&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(f&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(d=f&i.SUBSCRIBE_OPTIONS_QOS_MASK,d>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(b=(f>>i.SUBSCRIBE_OPTIONS_NL_SHIFT&i.SUBSCRIBE_OPTIONS_NL_MASK)!==0,y=(f>>i.SUBSCRIBE_OPTIONS_RAP_SHIFT&i.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,m=f>>i.SUBSCRIBE_OPTIONS_RH_SHIFT&i.SUBSCRIBE_OPTIONS_RH_MASK,m>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));T={topic:c,qos:d},this.settings.protocolVersion===5?(T.nl=b,T.rap=y,T.rh=m):this.settings.bridgeMode&&(T.rh=0,T.rap=!0,T.nl=!0),o("_parseSubscribe: push subscription `%s` to subscription",T),u.subscriptions.push(T)}}}_parseSuback(){o("_parseSuback");let u=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(u.properties=c)}if(u.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos2&&c!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(c)}}}_parseUnsubscribe(){o("_parseUnsubscribe");let u=this.packet;if(u.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(u.properties=c)}if(u.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos2){switch(u.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!i.MQTT5_PUBACK_PUBREC_CODES[u.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!i.MQTT5_PUBREL_PUBCOMP_CODES[u.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}o("_parseConfirmation: packet.reasonCode `%d`",u.reasonCode)}else u.reasonCode=0;if(u.length>3){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(u.properties=c)}}return!0}_parseDisconnect(){let u=this.packet;if(o("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(u.reasonCode=this._parseByte(),i.MQTT5_DISCONNECT_CODES[u.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):u.reasonCode=0;let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(u.properties=c)}return o("_parseDisconnect result: true"),!0}_parseAuth(){o("_parseAuth");let u=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(u.reasonCode=this._parseByte(),!i.MQTT5_AUTH_CODES[u.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let c=this._parseProperties();return Object.getOwnPropertyNames(c).length&&(u.properties=c),o("_parseAuth: result: true"),!0}_parseMessageId(){let u=this.packet;return u.messageId=this._parseNum(),u.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(o("_parseMessageId: packet.messageId %d",u.messageId),!0)}_parseString(u){let c=this._parseNum(),f=c+this._pos;if(c===-1||f>this._list.length||f>this.packet.length)return null;let d=this._list.toString("utf8",this._pos,f);return this._pos+=c,o("_parseString: result: %s",d),d}_parseStringPair(){return o("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let u=this._parseNum(),c=u+this._pos;if(u===-1||c>this._list.length||c>this.packet.length)return null;let f=this._list.slice(this._pos,c);return this._pos+=u,o("_parseBuffer: result: %o",f),f}_parseNum(){if(this._list.length-this._pos<2)return-1;let u=this._list.readUInt16BE(this._pos);return this._pos+=2,o("_parseNum: result: %s",u),u}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let u=this._list.readUInt32BE(this._pos);return this._pos+=4,o("_parse4ByteNum: result: %s",u),u}_parseVarByteNum(u){o("_parseVarByteNum");let c=4,f=0,d=1,m=0,y=!1,b,T=this._pos?this._pos:0;for(;f=f&&this._emitError(new Error("Invalid variable byte integer")),T&&(this._pos+=f),y?u?y={bytes:f,value:m}:y=m:y=!1,o("_parseVarByteNum: result: %o",y),y}_parseByte(){let u;return this._pos{ye(),ve(),be();var{Buffer:r}=(dt(),De(ht)),n=65536,a={},i=r.isBuffer(r.from([1,2]).subarray(0,1));function o(c){let f=r.allocUnsafe(2);return f.writeUInt8(c>>8,0),f.writeUInt8(c&255,1),f}function l(){for(let c=0;c0&&(f=f|128),m.writeUInt8(f,d++);while(c>0&&d<4);return c>0&&(d=0),i?m.subarray(0,d):m.slice(0,d)}function u(c){let f=r.allocUnsafe(4);return f.writeUInt32BE(c,0),f}t.exports={cache:a,generateCache:l,generateNumber:o,genBufVariableByteInt:s,generate4ByteBuffer:u}}),Zb=Ee((e,t)=>{ye(),ve(),be(),typeof et>"u"||!et.version||et.version.indexOf("v0.")===0||et.version.indexOf("v1.")===0&&et.version.indexOf("v1.8.")!==0?t.exports={nextTick:r}:t.exports=et;function r(n,a,i,o){if(typeof n!="function")throw new TypeError('"callback" argument must be a function');var l=arguments.length,s,u;switch(l){case 0:case 1:return et.nextTick(n);case 2:return et.nextTick(function(){n.call(null,a)});case 3:return et.nextTick(function(){n.call(null,a,i)});case 4:return et.nextTick(function(){n.call(null,a,i,o)});default:for(s=new Array(l-1),u=0;u{ye(),ve(),be();var r=ud(),{Buffer:n}=(dt(),De(ht)),a=n.allocUnsafe(0),i=n.from([0]),o=Xb(),l=Zb().nextTick,s=gr()("mqtt-packet:writeToStream"),u=o.cache,c=o.generateNumber,f=o.generateCache,d=o.genBufVariableByteInt,m=o.generate4ByteBuffer,y=Z,b=!0;function T(E,S,q){switch(s("generate called"),S.cork&&(S.cork(),l(B,S)),b&&(b=!1,f()),s("generate: packet.cmd: %s",E.cmd),E.cmd){case"connect":return C(E,S);case"connack":return O(E,S,q);case"publish":return N(E,S,q);case"puback":case"pubrec":case"pubrel":case"pubcomp":return v(E,S,q);case"subscribe":return R(E,S,q);case"suback":return U(E,S,q);case"unsubscribe":return F(E,S,q);case"unsuback":return H(E,S,q);case"pingreq":case"pingresp":return Y(E,S);case"disconnect":return ie(E,S,q);case"auth":return I(E,S,q);default:return S.destroy(new Error("Unknown command")),!1}}Object.defineProperty(T,"cacheNumbers",{get(){return y===Z},set(E){E?((!u||Object.keys(u).length===0)&&(b=!0),y=Z):(b=!1,y=Q)}});function B(E){E.uncork()}function C(E,S,q){let X=E||{},te=X.protocolId||"MQTT",re=X.protocolVersion||4,_=X.will,P=X.clean,w=X.keepalive||0,M=X.clientId||"",k=X.username,G=X.password,K=X.properties;P===void 0&&(P=!0);let L=0;if(!te||typeof te!="string"&&!n.isBuffer(te))return S.destroy(new Error("Invalid protocolId")),!1;if(L+=te.length+2,re!==3&&re!==4&&re!==5)return S.destroy(new Error("Invalid protocol version")),!1;if(L+=1,(typeof M=="string"||n.isBuffer(M))&&(M||re>=4)&&(M||P))L+=n.byteLength(M)+2;else{if(re<4)return S.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(P*1===0)return S.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof w!="number"||w<0||w>65535||w%1!==0)return S.destroy(new Error("Invalid keepalive")),!1;L+=2,L+=1;let V,J;if(re===5){if(V=_e(S,K),!V)return!1;L+=V.length}if(_){if(typeof _!="object")return S.destroy(new Error("Invalid will")),!1;if(!_.topic||typeof _.topic!="string")return S.destroy(new Error("Invalid will topic")),!1;if(L+=n.byteLength(_.topic)+2,L+=2,_.payload)if(_.payload.length>=0)typeof _.payload=="string"?L+=n.byteLength(_.payload):L+=_.payload.length;else return S.destroy(new Error("Invalid will payload")),!1;if(J={},re===5){if(J=_e(S,_.properties),!J)return!1;L+=J.length}}let le=!1;if(k!=null)if(ue(k))le=!0,L+=n.byteLength(k)+2;else return S.destroy(new Error("Invalid username")),!1;if(G!=null){if(!le)return S.destroy(new Error("Username is required to use password")),!1;if(ue(G))L+=Ae(G)+2;else return S.destroy(new Error("Invalid password")),!1}S.write(r.CONNECT_HEADER),ee(S,L),ce(S,te),X.bridgeMode&&(re+=128),S.write(re===131?r.VERSION131:re===132?r.VERSION132:re===4?r.VERSION4:re===5?r.VERSION5:r.VERSION3);let pe=0;return pe|=k!=null?r.USERNAME_MASK:0,pe|=G!=null?r.PASSWORD_MASK:0,pe|=_&&_.retain?r.WILL_RETAIN_MASK:0,pe|=_&&_.qos?_.qos<0&&y(S,M),K==null||K.write(),s("publish: payload: %o",w),S.write(w)}function v(E,S,q){let X=q?q.protocolVersion:4,te=E||{},re=te.cmd||"puback",_=te.messageId,P=te.dup&&re==="pubrel"?r.DUP_MASK:0,w=0,M=te.reasonCode,k=te.properties,G=X===5?3:2;if(re==="pubrel"&&(w=1),typeof _!="number")return S.destroy(new Error("Invalid messageId")),!1;let K=null;if(X===5&&typeof k=="object"){if(K=j(S,k,q,G),!K)return!1;G+=K.length}return S.write(r.ACKS[re][w][P][0]),G===3&&(G+=M!==0?1:-1),ee(S,G),y(S,_),X===5&&G!==2&&S.write(n.from([M])),K!==null?K.write():G===4&&S.write(n.from([0])),!0}function R(E,S,q){s("subscribe: packet: ");let X=q?q.protocolVersion:4,te=E||{},re=te.dup?r.DUP_MASK:0,_=te.messageId,P=te.subscriptions,w=te.properties,M=0;if(typeof _!="number")return S.destroy(new Error("Invalid messageId")),!1;M+=2;let k=null;if(X===5){if(k=_e(S,w),!k)return!1;M+=k.length}if(typeof P=="object"&&P.length)for(let K=0;K2)return S.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}M+=n.byteLength(L)+2+1}else return S.destroy(new Error("Invalid subscriptions")),!1;s("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),S.write(r.SUBSCRIBE_HEADER[1][re?1:0][0]),ee(S,M),y(S,_),k!==null&&k.write();let G=!0;for(let K of P){let L=K.topic,V=K.qos,J=+K.nl,le=+K.rap,pe=K.rh,Se;oe(S,L),Se=r.SUBSCRIBE_OPTIONS_QOS[V],X===5&&(Se|=J?r.SUBSCRIBE_OPTIONS_NL:0,Se|=le?r.SUBSCRIBE_OPTIONS_RAP:0,Se|=pe?r.SUBSCRIBE_OPTIONS_RH[pe]:0),G=S.write(n.from([Se]))}return G}function U(E,S,q){let X=q?q.protocolVersion:4,te=E||{},re=te.messageId,_=te.granted,P=te.properties,w=0;if(typeof re!="number")return S.destroy(new Error("Invalid messageId")),!1;if(w+=2,typeof _=="object"&&_.length)for(let k=0;k<_.length;k+=1){if(typeof _[k]!="number")return S.destroy(new Error("Invalid qos vector")),!1;w+=1}else return S.destroy(new Error("Invalid qos vector")),!1;let M=null;if(X===5){if(M=j(S,P,q,w),!M)return!1;w+=M.length}return S.write(r.SUBACK_HEADER),ee(S,w),y(S,re),M!==null&&M.write(),S.write(n.from(_))}function F(E,S,q){let X=q?q.protocolVersion:4,te=E||{},re=te.messageId,_=te.dup?r.DUP_MASK:0,P=te.unsubscriptions,w=te.properties,M=0;if(typeof re!="number")return S.destroy(new Error("Invalid messageId")),!1;if(M+=2,typeof P=="object"&&P.length)for(let K=0;Kr.VARBYTEINT_MAX)return E.destroy(new Error(`Invalid variable byte integer: ${S}`)),!1;let q=z[S];return q||(q=d(S),S<16384&&(z[S]=q)),s("writeVarByteInt: writing to stream: %o",q),E.write(q)}function oe(E,S){let q=n.byteLength(S);return y(E,q),s("writeString: %s",S),E.write(S,"utf8")}function ae(E,S,q){oe(E,S),oe(E,q)}function Z(E,S){return s("writeNumberCached: number: %d",S),s("writeNumberCached: %o",u[S]),E.write(u[S])}function Q(E,S){let q=c(S);return s("writeNumberGenerated: %o",q),E.write(q)}function he(E,S){let q=m(S);return s("write4ByteNumber: %o",q),E.write(q)}function ce(E,S){typeof S=="string"?oe(E,S):S?(y(E,S.length),E.write(S)):y(E,0)}function _e(E,S){if(typeof S!="object"||S.length!=null)return{length:1,write(){fe(E,{},0)}};let q=0;function X(te,re){let _=r.propertiesTypes[te],P=0;switch(_){case"byte":{if(typeof re!="boolean")return E.destroy(new Error(`Invalid ${te}: ${re}`)),!1;P+=2;break}case"int8":{if(typeof re!="number"||re<0||re>255)return E.destroy(new Error(`Invalid ${te}: ${re}`)),!1;P+=2;break}case"binary":{if(re&&re===null)return E.destroy(new Error(`Invalid ${te}: ${re}`)),!1;P+=1+n.byteLength(re)+2;break}case"int16":{if(typeof re!="number"||re<0||re>65535)return E.destroy(new Error(`Invalid ${te}: ${re}`)),!1;P+=3;break}case"int32":{if(typeof re!="number"||re<0||re>4294967295)return E.destroy(new Error(`Invalid ${te}: ${re}`)),!1;P+=5;break}case"var":{if(typeof re!="number"||re<0||re>268435455)return E.destroy(new Error(`Invalid ${te}: ${re}`)),!1;P+=1+n.byteLength(d(re));break}case"string":{if(typeof re!="string")return E.destroy(new Error(`Invalid ${te}: ${re}`)),!1;P+=3+n.byteLength(re.toString());break}case"pair":{if(typeof re!="object")return E.destroy(new Error(`Invalid ${te}: ${re}`)),!1;P+=Object.getOwnPropertyNames(re).reduce((w,M)=>{let k=re[M];return Array.isArray(k)?w+=k.reduce((G,K)=>(G+=3+n.byteLength(M.toString())+2+n.byteLength(K.toString()),G),0):w+=3+n.byteLength(M.toString())+2+n.byteLength(re[M].toString()),w},0);break}default:return E.destroy(new Error(`Invalid property ${te}: ${re}`)),!1}return P}if(S)for(let te in S){let re=0,_=0,P=S[te];if(Array.isArray(P))for(let w=0;wre;){let P=te.shift();if(P&&S[P])delete S[P],_=_e(E,S);else return!1}return _}function se(E,S,q){switch(r.propertiesTypes[S]){case"byte":{E.write(n.from([r.properties[S]])),E.write(n.from([+q]));break}case"int8":{E.write(n.from([r.properties[S]])),E.write(n.from([q]));break}case"binary":{E.write(n.from([r.properties[S]])),ce(E,q);break}case"int16":{E.write(n.from([r.properties[S]])),y(E,q);break}case"int32":{E.write(n.from([r.properties[S]])),he(E,q);break}case"var":{E.write(n.from([r.properties[S]])),ee(E,q);break}case"string":{E.write(n.from([r.properties[S]])),oe(E,q);break}case"pair":{Object.getOwnPropertyNames(q).forEach(X=>{let te=q[X];Array.isArray(te)?te.forEach(re=>{E.write(n.from([r.properties[S]])),ae(E,X.toString(),re.toString())}):(E.write(n.from([r.properties[S]])),ae(E,X.toString(),te.toString()))});break}default:return E.destroy(new Error(`Invalid property ${S} value: ${q}`)),!1}}function fe(E,S,q){ee(E,q);for(let X in S)if(Object.prototype.hasOwnProperty.call(S,X)&&S[X]!==null){let te=S[X];if(Array.isArray(te))for(let re=0;re{ye(),ve(),be();var r=cd(),{EventEmitter:n}=(Wn(),De(wn)),{Buffer:a}=(dt(),De(ht));function i(l,s){let u=new o;return r(l,u,s),u.concat()}var o=class extends n{constructor(){super(),this._array=new Array(20),this._i=0}write(l){return this._array[this._i++]=l,!0}concat(){let l=0,s=new Array(this._array.length),u=this._array,c=0,f;for(f=0;f{ye(),ve(),be(),e.parser=Jb().parser,e.generate=e0(),e.writeToStream=cd()}),fd=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0});var t=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let r=this.nextId++;return this.nextId===65536&&(this.nextId=1),r}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(r){return!0}deallocate(r){}clear(){}};e.default=t}),r0=Ee((e,t)=>{ye(),ve(),be(),t.exports=n;function r(i){return i instanceof Ln?Ln.from(i):new i.constructor(i.buffer.slice(),i.byteOffset,i.length)}function n(i){if(i=i||{},i.circles)return a(i);return i.proto?s:l;function o(u,c){for(var f=Object.keys(u),d=new Array(f.length),m=0;m{ye(),ve(),be(),t.exports=r0()()}),i0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0}),e.validateTopics=e.validateTopic=void 0;function t(n){let a=n.split("/");for(let i=0;i{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0});var t=_n(),r={objectMode:!0},n={clean:!0},a=class{constructor(i){this.options=i||{},this.options=Object.assign(Object.assign({},n),i),this._inflights=new Map}put(i,o){return this._inflights.set(i.messageId,i),o&&o(),this}createStream(){let i=new t.Readable(r),o=[],l=!1,s=0;return this._inflights.forEach((u,c)=>{o.push(u)}),i._read=()=>{!l&&s{if(!l)return l=!0,setTimeout(()=>{i.emit("close")},0),i},i}del(i,o){let l=this._inflights.get(i.messageId);return l?(this._inflights.delete(i.messageId),o(null,l)):o&&o(new Error("missing packet")),this}get(i,o){let l=this._inflights.get(i.messageId);return l?o(null,l):o&&o(new Error("missing packet")),this}close(i){this.options.clean&&(this._inflights=null),i&&i()}};e.default=a}),o0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0});var t=[0,16,128,131,135,144,145,151,153],r=(n,a,i)=>{n.log("handlePublish: packet %o",a),i=typeof i<"u"?i:n.noop;let o=a.topic.toString(),l=a.payload,{qos:s}=a,{messageId:u}=a,{options:c}=n;if(n.options.protocolVersion===5){let f;if(a.properties&&(f=a.properties.topicAlias),typeof f<"u")if(o.length===0)if(f>0&&f<=65535){let d=n.topicAliasRecv.getTopicByAlias(f);if(d)o=d,n.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",o,f);else{n.log("handlePublish :: unregistered topic alias. alias: %d",f),n.emit("error",new Error("Received unregistered Topic Alias"));return}}else{n.log("handlePublish :: topic alias out of range. alias: %d",f),n.emit("error",new Error("Received Topic Alias is out of range"));return}else if(n.topicAliasRecv.put(o,f))n.log("handlePublish :: registered topic: %s - alias: %d",o,f);else{n.log("handlePublish :: topic alias out of range. alias: %d",f),n.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(n.log("handlePublish: qos %d",s),s){case 2:{c.customHandleAcks(o,l,a,(f,d)=>{if(typeof f=="number"&&(d=f,f=null),f)return n.emit("error",f);if(t.indexOf(d)===-1)return n.emit("error",new Error("Wrong reason code for pubrec"));d?n._sendPacket({cmd:"pubrec",messageId:u,reasonCode:d},i):n.incomingStore.put(a,()=>{n._sendPacket({cmd:"pubrec",messageId:u},i)})});break}case 1:{c.customHandleAcks(o,l,a,(f,d)=>{if(typeof f=="number"&&(d=f,f=null),f)return n.emit("error",f);if(t.indexOf(d)===-1)return n.emit("error",new Error("Wrong reason code for puback"));d||n.emit("message",o,l,a),n.handleMessage(a,m=>{if(m)return i&&i(m);n._sendPacket({cmd:"puback",messageId:u,reasonCode:d},i)})});break}case 0:n.emit("message",o,l,a),n.handleMessage(a,i);break;default:n.log("handlePublish: unknown QoS. Doing nothing.");break}};e.default=r}),Ti=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0}),e.nextTick=e.applyMixin=e.ErrorWithReasonCode=void 0;var t=class dd extends Error{constructor(a,i){super(a),this.code=i,Object.setPrototypeOf(this,dd.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};e.ErrorWithReasonCode=t;function r(n,a,i=!1){var o;let l=[a];for(;;){let s=l[0],u=Object.getPrototypeOf(s);if(u!=null&&u.prototype)l.unshift(u);else break}for(let s of l)for(let u of Object.getOwnPropertyNames(s.prototype))(i||u!=="constructor")&&Object.defineProperty(n.prototype,u,(o=Object.getOwnPropertyDescriptor(s.prototype,u))!==null&&o!==void 0?o:Object.create(null))}e.applyMixin=r,e.nextTick=et?et.nextTick:n=>{setTimeout(n,0)}}),Fo=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0}),e.ReasonCodes=void 0,e.ReasonCodes={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};var t=(r,n)=>{let{messageId:a}=n,i=n.cmd,o=null,l=r.outgoing[a]?r.outgoing[a].cb:null,s;if(!l){r.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(r.log("_handleAck :: packet type",i),i){case"pubcomp":case"puback":{let u=n.reasonCode;u&&u>0&&u!==16?(s=new Error(`Publish error: ${e.ReasonCodes[u]}`),s.code=u,r._removeOutgoingAndStoreMessage(a,()=>{l(s,n)})):r._removeOutgoingAndStoreMessage(a,l);break}case"pubrec":{o={cmd:"pubrel",qos:2,messageId:a};let u=n.reasonCode;u&&u>0&&u!==16?(s=new Error(`Publish error: ${e.ReasonCodes[u]}`),s.code=u,r._removeOutgoingAndStoreMessage(a,()=>{l(s,n)})):r._sendPacket(o);break}case"suback":{delete r.outgoing[a],r.messageIdProvider.deallocate(a);let u=n.granted;for(let c=0;c{delete r._resubscribeTopics[d]})}delete r.messageIdToTopic[a],r._invokeStoreProcessingQueue(),l(null,n);break}case"unsuback":{delete r.outgoing[a],r.messageIdProvider.deallocate(a),r._invokeStoreProcessingQueue(),l(null);break}default:r.emit("error",new Error("unrecognized packet type"))}r.disconnecting&&Object.keys(r.outgoing).length===0&&r.emit("outgoingEmpty")};e.default=t}),s0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0});var t=Ti(),r=Fo(),n=(a,i)=>{let{options:o}=a,l=o.protocolVersion,s=l===5?i.reasonCode:i.returnCode;if(l!==5){let u=new t.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${l}`,s);a.emit("error",u);return}a.handleAuth(i,(u,c)=>{if(u){a.emit("error",u);return}if(s===24)a.reconnecting=!1,a._sendPacket(c);else{let f=new t.ErrorWithReasonCode(`Connection refused: ${r.ReasonCodes[s]}`,s);a.emit("error",f)}})};e.default=n}),a0=Ee(e=>{var m,y,b,T,B,C,O,N,v,R,U,F,H,Y,ie,I,z,ee,oe,ae,Z,Q,he,ce,_e,j,Ka,fe,Ae,ue,E,S,pd,X,te,re,_,Or,w,Rr,k,Ga,K,Qi,V,Ji,le,We,Se,Ya,h,ei,x;ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=void 0;var t=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,r=new Set,n=typeof et=="object"&&et?et:{},a=(D,A,$,ne)=>{typeof n.emitWarning=="function"?n.emitWarning(D,A,$,ne):console.error(`[${$}] ${A}: ${D}`)},i=globalThis.AbortController,o=globalThis.AbortSignal;if(typeof i>"u"){o=class{constructor(){qe(this,"onabort");qe(this,"_onabort",[]);qe(this,"reason");qe(this,"aborted",!1)}addEventListener($,ne){this._onabort.push(ne)}},i=class{constructor(){qe(this,"signal",new o);A()}abort($){var ne,ge;if(!this.signal.aborted){this.signal.reason=$,this.signal.aborted=!0;for(let de of this.signal._onabort)de($);(ge=(ne=this.signal).onabort)==null||ge.call(ne,$)}}};let D=((m=n.env)==null?void 0:m.LRU_CACHE_IGNORE_AC_WARNING)!=="1",A=()=>{D&&(D=!1,a("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",A))}}var l=D=>!r.has(D),s=D=>D&&D===Math.floor(D)&&D>0&&isFinite(D),u=D=>s(D)?D<=Math.pow(2,8)?Uint8Array:D<=Math.pow(2,16)?Uint16Array:D<=Math.pow(2,32)?Uint32Array:D<=Number.MAX_SAFE_INTEGER?c:null:null,c=class extends Array{constructor(D){super(D),this.fill(0)}},f=(y=class{constructor(A,$){qe(this,"heap");qe(this,"length");if(!W(y,b))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new $(A),this.length=0}static create(A){let $=u(A);if(!$)return[];Oe(y,b,!0);let ne=new y(A,$);return Oe(y,b,!1),ne}push(A){this.heap[this.length++]=A}pop(){return this.heap[--this.length]}},b=new WeakMap,ke(y,b,!1),y),d=(x=class{constructor(A){ke(this,j);ke(this,S);ke(this,_);ke(this,w);ke(this,k);ke(this,K);ke(this,V);ke(this,le);ke(this,Se);ke(this,h);ke(this,T,void 0);ke(this,B,void 0);ke(this,C,void 0);ke(this,O,void 0);ke(this,N,void 0);qe(this,"ttl");qe(this,"ttlResolution");qe(this,"ttlAutopurge");qe(this,"updateAgeOnGet");qe(this,"updateAgeOnHas");qe(this,"allowStale");qe(this,"noDisposeOnSet");qe(this,"noUpdateTTL");qe(this,"maxEntrySize");qe(this,"sizeCalculation");qe(this,"noDeleteOnFetchRejection");qe(this,"noDeleteOnStaleGet");qe(this,"allowStaleOnFetchAbort");qe(this,"allowStaleOnFetchRejection");qe(this,"ignoreFetchAbort");ke(this,v,void 0);ke(this,R,void 0);ke(this,U,void 0);ke(this,F,void 0);ke(this,H,void 0);ke(this,Y,void 0);ke(this,ie,void 0);ke(this,I,void 0);ke(this,z,void 0);ke(this,ee,void 0);ke(this,oe,void 0);ke(this,ae,void 0);ke(this,Z,void 0);ke(this,Q,void 0);ke(this,he,void 0);ke(this,ce,void 0);ke(this,_e,void 0);ke(this,fe,()=>{});ke(this,Ae,()=>{});ke(this,ue,()=>{});ke(this,E,()=>!1);ke(this,X,A=>{});ke(this,te,(A,$,ne)=>{});ke(this,re,(A,$,ne,ge)=>{if(ne||ge)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});let{max:$=0,ttl:ne,ttlResolution:ge=1,ttlAutopurge:de,updateAgeOnGet:me,updateAgeOnHas:Te,allowStale:Ce,dispose:Qe,disposeAfter:gt,noDisposeOnSet:Ue,noUpdateTTL:mt,maxSize:Xe=0,maxEntrySize:Ze=0,sizeCalculation:Je,fetchMethod:ut,noDeleteOnFetchRejection:Pe,noDeleteOnStaleGet:Ge,allowStaleOnFetchRejection:yt,allowStaleOnFetchAbort:at,ignoreFetchAbort:Dt}=A;if($!==0&&!s($))throw new TypeError("max option must be a nonnegative integer");let Hr=$?u($):Array;if(!Hr)throw new Error("invalid max value: "+$);if(Oe(this,T,$),Oe(this,B,Xe),this.maxEntrySize=Ze||W(this,B),this.sizeCalculation=Je,this.sizeCalculation){if(!W(this,B)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(ut!==void 0&&typeof ut!="function")throw new TypeError("fetchMethod must be a function if specified");if(Oe(this,N,ut),Oe(this,ce,!!ut),Oe(this,U,new Map),Oe(this,F,new Array($).fill(void 0)),Oe(this,H,new Array($).fill(void 0)),Oe(this,Y,new Hr($)),Oe(this,ie,new Hr($)),Oe(this,I,0),Oe(this,z,0),Oe(this,ee,f.create($)),Oe(this,v,0),Oe(this,R,0),typeof Qe=="function"&&Oe(this,C,Qe),typeof gt=="function"?(Oe(this,O,gt),Oe(this,oe,[])):(Oe(this,O,void 0),Oe(this,oe,void 0)),Oe(this,he,!!W(this,C)),Oe(this,_e,!!W(this,O)),this.noDisposeOnSet=!!Ue,this.noUpdateTTL=!!mt,this.noDeleteOnFetchRejection=!!Pe,this.allowStaleOnFetchRejection=!!yt,this.allowStaleOnFetchAbort=!!at,this.ignoreFetchAbort=!!Dt,this.maxEntrySize!==0){if(W(this,B)!==0&&!s(W(this,B)))throw new TypeError("maxSize must be a positive integer if specified");if(!s(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ie(this,S,pd).call(this)}if(this.allowStale=!!Ce,this.noDeleteOnStaleGet=!!Ge,this.updateAgeOnGet=!!me,this.updateAgeOnHas=!!Te,this.ttlResolution=s(ge)||ge===0?ge:1,this.ttlAutopurge=!!de,this.ttl=ne||0,this.ttl){if(!s(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ie(this,j,Ka).call(this)}if(W(this,T)===0&&this.ttl===0&&W(this,B)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!W(this,T)&&!W(this,B)){let _r="LRU_CACHE_UNBOUNDED";l(_r)&&(r.add(_r),a("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",_r,x))}}static unsafeExposeInternals(A){return{starts:W(A,Z),ttls:W(A,Q),sizes:W(A,ae),keyMap:W(A,U),keyList:W(A,F),valList:W(A,H),next:W(A,Y),prev:W(A,ie),get head(){return W(A,I)},get tail(){return W(A,z)},free:W(A,ee),isBackgroundFetch:$=>{var ne;return Ie(ne=A,le,We).call(ne,$)},backgroundFetch:($,ne,ge,de)=>{var me;return Ie(me=A,V,Ji).call(me,$,ne,ge,de)},moveToTail:$=>{var ne;return Ie(ne=A,h,ei).call(ne,$)},indexes:$=>{var ne;return Ie(ne=A,_,Or).call(ne,$)},rindexes:$=>{var ne;return Ie(ne=A,w,Rr).call(ne,$)},isStale:$=>{var ne;return W(ne=A,E).call(ne,$)}}}get max(){return W(this,T)}get maxSize(){return W(this,B)}get calculatedSize(){return W(this,R)}get size(){return W(this,v)}get fetchMethod(){return W(this,N)}get dispose(){return W(this,C)}get disposeAfter(){return W(this,O)}getRemainingTTL(A){return W(this,U).has(A)?1/0:0}*entries(){for(let A of Ie(this,_,Or).call(this))W(this,H)[A]!==void 0&&W(this,F)[A]!==void 0&&!Ie(this,le,We).call(this,W(this,H)[A])&&(yield[W(this,F)[A],W(this,H)[A]])}*rentries(){for(let A of Ie(this,w,Rr).call(this))W(this,H)[A]!==void 0&&W(this,F)[A]!==void 0&&!Ie(this,le,We).call(this,W(this,H)[A])&&(yield[W(this,F)[A],W(this,H)[A]])}*keys(){for(let A of Ie(this,_,Or).call(this)){let $=W(this,F)[A];$!==void 0&&!Ie(this,le,We).call(this,W(this,H)[A])&&(yield $)}}*rkeys(){for(let A of Ie(this,w,Rr).call(this)){let $=W(this,F)[A];$!==void 0&&!Ie(this,le,We).call(this,W(this,H)[A])&&(yield $)}}*values(){for(let A of Ie(this,_,Or).call(this))W(this,H)[A]!==void 0&&!Ie(this,le,We).call(this,W(this,H)[A])&&(yield W(this,H)[A])}*rvalues(){for(let A of Ie(this,w,Rr).call(this))W(this,H)[A]!==void 0&&!Ie(this,le,We).call(this,W(this,H)[A])&&(yield W(this,H)[A])}[Symbol.iterator](){return this.entries()}find(A,$={}){for(let ne of Ie(this,_,Or).call(this)){let ge=W(this,H)[ne],de=Ie(this,le,We).call(this,ge)?ge.__staleWhileFetching:ge;if(de!==void 0&&A(de,W(this,F)[ne],this))return this.get(W(this,F)[ne],$)}}forEach(A,$=this){for(let ne of Ie(this,_,Or).call(this)){let ge=W(this,H)[ne],de=Ie(this,le,We).call(this,ge)?ge.__staleWhileFetching:ge;de!==void 0&&A.call($,de,W(this,F)[ne],this)}}rforEach(A,$=this){for(let ne of Ie(this,w,Rr).call(this)){let ge=W(this,H)[ne],de=Ie(this,le,We).call(this,ge)?ge.__staleWhileFetching:ge;de!==void 0&&A.call($,de,W(this,F)[ne],this)}}purgeStale(){let A=!1;for(let $ of Ie(this,w,Rr).call(this,{allowStale:!0}))W(this,E).call(this,$)&&(this.delete(W(this,F)[$]),A=!0);return A}dump(){let A=[];for(let $ of Ie(this,_,Or).call(this,{allowStale:!0})){let ne=W(this,F)[$],ge=W(this,H)[$],de=Ie(this,le,We).call(this,ge)?ge.__staleWhileFetching:ge;if(de===void 0||ne===void 0)continue;let me={value:de};if(W(this,Q)&&W(this,Z)){me.ttl=W(this,Q)[$];let Te=t.now()-W(this,Z)[$];me.start=Math.floor(Date.now()-Te)}W(this,ae)&&(me.size=W(this,ae)[$]),A.unshift([ne,me])}return A}load(A){this.clear();for(let[$,ne]of A){if(ne.start){let ge=Date.now()-ne.start;ne.start=t.now()-ge}this.set($,ne.value,ne)}}set(A,$,ne={}){var mt,Xe,Ze,Je,ut;if($===void 0)return this.delete(A),this;let{ttl:ge=this.ttl,start:de,noDisposeOnSet:me=this.noDisposeOnSet,sizeCalculation:Te=this.sizeCalculation,status:Ce}=ne,{noUpdateTTL:Qe=this.noUpdateTTL}=ne,gt=W(this,re).call(this,A,$,ne.size||0,Te);if(this.maxEntrySize&>>this.maxEntrySize)return Ce&&(Ce.set="miss",Ce.maxEntrySizeExceeded=!0),this.delete(A),this;let Ue=W(this,v)===0?void 0:W(this,U).get(A);if(Ue===void 0)Ue=W(this,v)===0?W(this,z):W(this,ee).length!==0?W(this,ee).pop():W(this,v)===W(this,T)?Ie(this,K,Qi).call(this,!1):W(this,v),W(this,F)[Ue]=A,W(this,H)[Ue]=$,W(this,U).set(A,Ue),W(this,Y)[W(this,z)]=Ue,W(this,ie)[Ue]=W(this,z),Oe(this,z,Ue),Oi(this,v)._++,W(this,te).call(this,Ue,gt,Ce),Ce&&(Ce.set="add"),Qe=!1;else{Ie(this,h,ei).call(this,Ue);let Pe=W(this,H)[Ue];if($!==Pe){if(W(this,ce)&&Ie(this,le,We).call(this,Pe)){Pe.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Ge}=Pe;Ge!==void 0&&!me&&(W(this,he)&&((mt=W(this,C))==null||mt.call(this,Ge,A,"set")),W(this,_e)&&((Xe=W(this,oe))==null||Xe.push([Ge,A,"set"])))}else me||(W(this,he)&&((Ze=W(this,C))==null||Ze.call(this,Pe,A,"set")),W(this,_e)&&((Je=W(this,oe))==null||Je.push([Pe,A,"set"])));if(W(this,X).call(this,Ue),W(this,te).call(this,Ue,gt,Ce),W(this,H)[Ue]=$,Ce){Ce.set="replace";let Ge=Pe&&Ie(this,le,We).call(this,Pe)?Pe.__staleWhileFetching:Pe;Ge!==void 0&&(Ce.oldValue=Ge)}}else Ce&&(Ce.set="update")}if(ge!==0&&!W(this,Q)&&Ie(this,j,Ka).call(this),W(this,Q)&&(Qe||W(this,ue).call(this,Ue,ge,de),Ce&&W(this,Ae).call(this,Ce,Ue)),!me&&W(this,_e)&&W(this,oe)){let Pe=W(this,oe),Ge;for(;Ge=Pe==null?void 0:Pe.shift();)(ut=W(this,O))==null||ut.call(this,...Ge)}return this}pop(){var A;try{for(;W(this,v);){let $=W(this,H)[W(this,I)];if(Ie(this,K,Qi).call(this,!0),Ie(this,le,We).call(this,$)){if($.__staleWhileFetching)return $.__staleWhileFetching}else if($!==void 0)return $}}finally{if(W(this,_e)&&W(this,oe)){let $=W(this,oe),ne;for(;ne=$==null?void 0:$.shift();)(A=W(this,O))==null||A.call(this,...ne)}}}has(A,$={}){let{updateAgeOnHas:ne=this.updateAgeOnHas,status:ge}=$,de=W(this,U).get(A);if(de!==void 0){let me=W(this,H)[de];if(Ie(this,le,We).call(this,me)&&me.__staleWhileFetching===void 0)return!1;if(W(this,E).call(this,de))ge&&(ge.has="stale",W(this,Ae).call(this,ge,de));else return ne&&W(this,fe).call(this,de),ge&&(ge.has="hit",W(this,Ae).call(this,ge,de)),!0}else ge&&(ge.has="miss");return!1}peek(A,$={}){let{allowStale:ne=this.allowStale}=$,ge=W(this,U).get(A);if(ge!==void 0&&(ne||!W(this,E).call(this,ge))){let de=W(this,H)[ge];return Ie(this,le,We).call(this,de)?de.__staleWhileFetching:de}}async fetch(A,$={}){let{allowStale:ne=this.allowStale,updateAgeOnGet:ge=this.updateAgeOnGet,noDeleteOnStaleGet:de=this.noDeleteOnStaleGet,ttl:me=this.ttl,noDisposeOnSet:Te=this.noDisposeOnSet,size:Ce=0,sizeCalculation:Qe=this.sizeCalculation,noUpdateTTL:gt=this.noUpdateTTL,noDeleteOnFetchRejection:Ue=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:mt=this.allowStaleOnFetchRejection,ignoreFetchAbort:Xe=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ze=this.allowStaleOnFetchAbort,context:Je,forceRefresh:ut=!1,status:Pe,signal:Ge}=$;if(!W(this,ce))return Pe&&(Pe.fetch="get"),this.get(A,{allowStale:ne,updateAgeOnGet:ge,noDeleteOnStaleGet:de,status:Pe});let yt={allowStale:ne,updateAgeOnGet:ge,noDeleteOnStaleGet:de,ttl:me,noDisposeOnSet:Te,size:Ce,sizeCalculation:Qe,noUpdateTTL:gt,noDeleteOnFetchRejection:Ue,allowStaleOnFetchRejection:mt,allowStaleOnFetchAbort:Ze,ignoreFetchAbort:Xe,status:Pe,signal:Ge},at=W(this,U).get(A);if(at===void 0){Pe&&(Pe.fetch="miss");let Dt=Ie(this,V,Ji).call(this,A,at,yt,Je);return Dt.__returned=Dt}else{let Dt=W(this,H)[at];if(Ie(this,le,We).call(this,Dt)){let eu=ne&&Dt.__staleWhileFetching!==void 0;return Pe&&(Pe.fetch="inflight",eu&&(Pe.returnedStale=!0)),eu?Dt.__staleWhileFetching:Dt.__returned=Dt}let Hr=W(this,E).call(this,at);if(!ut&&!Hr)return Pe&&(Pe.fetch="hit"),Ie(this,h,ei).call(this,at),ge&&W(this,fe).call(this,at),Pe&&W(this,Ae).call(this,Pe,at),Dt;let _r=Ie(this,V,Ji).call(this,A,at,yt,Je),Zl=_r.__staleWhileFetching!==void 0&≠return Pe&&(Pe.fetch=Hr?"stale":"refresh",Zl&&Hr&&(Pe.returnedStale=!0)),Zl?_r.__staleWhileFetching:_r.__returned=_r}}get(A,$={}){let{allowStale:ne=this.allowStale,updateAgeOnGet:ge=this.updateAgeOnGet,noDeleteOnStaleGet:de=this.noDeleteOnStaleGet,status:me}=$,Te=W(this,U).get(A);if(Te!==void 0){let Ce=W(this,H)[Te],Qe=Ie(this,le,We).call(this,Ce);return me&&W(this,Ae).call(this,me,Te),W(this,E).call(this,Te)?(me&&(me.get="stale"),Qe?(me&&ne&&Ce.__staleWhileFetching!==void 0&&(me.returnedStale=!0),ne?Ce.__staleWhileFetching:void 0):(de||this.delete(A),me&&ne&&(me.returnedStale=!0),ne?Ce:void 0)):(me&&(me.get="hit"),Qe?Ce.__staleWhileFetching:(Ie(this,h,ei).call(this,Te),ge&&W(this,fe).call(this,Te),Ce))}else me&&(me.get="miss")}delete(A){var ne,ge,de,me;let $=!1;if(W(this,v)!==0){let Te=W(this,U).get(A);if(Te!==void 0)if($=!0,W(this,v)===1)this.clear();else{W(this,X).call(this,Te);let Ce=W(this,H)[Te];Ie(this,le,We).call(this,Ce)?Ce.__abortController.abort(new Error("deleted")):(W(this,he)||W(this,_e))&&(W(this,he)&&((ne=W(this,C))==null||ne.call(this,Ce,A,"delete")),W(this,_e)&&((ge=W(this,oe))==null||ge.push([Ce,A,"delete"]))),W(this,U).delete(A),W(this,F)[Te]=void 0,W(this,H)[Te]=void 0,Te===W(this,z)?Oe(this,z,W(this,ie)[Te]):Te===W(this,I)?Oe(this,I,W(this,Y)[Te]):(W(this,Y)[W(this,ie)[Te]]=W(this,Y)[Te],W(this,ie)[W(this,Y)[Te]]=W(this,ie)[Te]),Oi(this,v)._--,W(this,ee).push(Te)}}if(W(this,_e)&&((de=W(this,oe))!=null&&de.length)){let Te=W(this,oe),Ce;for(;Ce=Te==null?void 0:Te.shift();)(me=W(this,O))==null||me.call(this,...Ce)}return $}clear(){var A,$,ne;for(let ge of Ie(this,w,Rr).call(this,{allowStale:!0})){let de=W(this,H)[ge];if(Ie(this,le,We).call(this,de))de.__abortController.abort(new Error("deleted"));else{let me=W(this,F)[ge];W(this,he)&&((A=W(this,C))==null||A.call(this,de,me,"delete")),W(this,_e)&&(($=W(this,oe))==null||$.push([de,me,"delete"]))}}if(W(this,U).clear(),W(this,H).fill(void 0),W(this,F).fill(void 0),W(this,Q)&&W(this,Z)&&(W(this,Q).fill(0),W(this,Z).fill(0)),W(this,ae)&&W(this,ae).fill(0),Oe(this,I,0),Oe(this,z,0),W(this,ee).length=0,Oe(this,R,0),Oe(this,v,0),W(this,_e)&&W(this,oe)){let ge=W(this,oe),de;for(;de=ge==null?void 0:ge.shift();)(ne=W(this,O))==null||ne.call(this,...de)}}},T=new WeakMap,B=new WeakMap,C=new WeakMap,O=new WeakMap,N=new WeakMap,v=new WeakMap,R=new WeakMap,U=new WeakMap,F=new WeakMap,H=new WeakMap,Y=new WeakMap,ie=new WeakMap,I=new WeakMap,z=new WeakMap,ee=new WeakMap,oe=new WeakMap,ae=new WeakMap,Z=new WeakMap,Q=new WeakMap,he=new WeakMap,ce=new WeakMap,_e=new WeakMap,j=new WeakSet,Ka=function(){let A=new c(W(this,T)),$=new c(W(this,T));Oe(this,Q,A),Oe(this,Z,$),Oe(this,ue,(de,me,Te=t.now())=>{if($[de]=me!==0?Te:0,A[de]=me,me!==0&&this.ttlAutopurge){let Ce=setTimeout(()=>{W(this,E).call(this,de)&&this.delete(W(this,F)[de])},me+1);Ce.unref&&Ce.unref()}}),Oe(this,fe,de=>{$[de]=A[de]!==0?t.now():0}),Oe(this,Ae,(de,me)=>{if(A[me]){let Te=A[me],Ce=$[me];de.ttl=Te,de.start=Ce,de.now=ne||ge();let Qe=de.now-Ce;de.remainingTTL=Te-Qe}});let ne=0,ge=()=>{let de=t.now();if(this.ttlResolution>0){ne=de;let me=setTimeout(()=>ne=0,this.ttlResolution);me.unref&&me.unref()}return de};this.getRemainingTTL=de=>{let me=W(this,U).get(de);if(me===void 0)return 0;let Te=A[me],Ce=$[me];if(Te===0||Ce===0)return 1/0;let Qe=(ne||ge())-Ce;return Te-Qe},Oe(this,E,de=>A[de]!==0&&$[de]!==0&&(ne||ge())-$[de]>A[de])},fe=new WeakMap,Ae=new WeakMap,ue=new WeakMap,E=new WeakMap,S=new WeakSet,pd=function(){let A=new c(W(this,T));Oe(this,R,0),Oe(this,ae,A),Oe(this,X,$=>{Oe(this,R,W(this,R)-A[$]),A[$]=0}),Oe(this,re,($,ne,ge,de)=>{if(Ie(this,le,We).call(this,ne))return 0;if(!s(ge))if(de){if(typeof de!="function")throw new TypeError("sizeCalculation must be a function");if(ge=de(ne,$),!s(ge))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return ge}),Oe(this,te,($,ne,ge)=>{if(A[$]=ne,W(this,B)){let de=W(this,B)-A[$];for(;W(this,R)>de;)Ie(this,K,Qi).call(this,!0)}Oe(this,R,W(this,R)+A[$]),ge&&(ge.entrySize=ne,ge.totalCalculatedSize=W(this,R))})},X=new WeakMap,te=new WeakMap,re=new WeakMap,_=new WeakSet,Or=function*({allowStale:A=this.allowStale}={}){if(W(this,v))for(let $=W(this,z);!(!Ie(this,k,Ga).call(this,$)||((A||!W(this,E).call(this,$))&&(yield $),$===W(this,I)));)$=W(this,ie)[$]},w=new WeakSet,Rr=function*({allowStale:A=this.allowStale}={}){if(W(this,v))for(let $=W(this,I);!(!Ie(this,k,Ga).call(this,$)||((A||!W(this,E).call(this,$))&&(yield $),$===W(this,z)));)$=W(this,Y)[$]},k=new WeakSet,Ga=function(A){return A!==void 0&&W(this,U).get(W(this,F)[A])===A},K=new WeakSet,Qi=function(A){var de,me;let $=W(this,I),ne=W(this,F)[$],ge=W(this,H)[$];return W(this,ce)&&Ie(this,le,We).call(this,ge)?ge.__abortController.abort(new Error("evicted")):(W(this,he)||W(this,_e))&&(W(this,he)&&((de=W(this,C))==null||de.call(this,ge,ne,"evict")),W(this,_e)&&((me=W(this,oe))==null||me.push([ge,ne,"evict"]))),W(this,X).call(this,$),A&&(W(this,F)[$]=void 0,W(this,H)[$]=void 0,W(this,ee).push($)),W(this,v)===1?(Oe(this,I,Oe(this,z,0)),W(this,ee).length=0):Oe(this,I,W(this,Y)[$]),W(this,U).delete(ne),Oi(this,v)._--,$},V=new WeakSet,Ji=function(A,$,ne,ge){let de=$===void 0?void 0:W(this,H)[$];if(Ie(this,le,We).call(this,de))return de;let me=new i,{signal:Te}=ne;Te==null||Te.addEventListener("abort",()=>me.abort(Te.reason),{signal:me.signal});let Ce={signal:me.signal,options:ne,context:ge},Qe=(Je,ut=!1)=>{let{aborted:Pe}=me.signal,Ge=ne.ignoreFetchAbort&&Je!==void 0;if(ne.status&&(Pe&&!ut?(ne.status.fetchAborted=!0,ne.status.fetchError=me.signal.reason,Ge&&(ne.status.fetchAbortIgnored=!0)):ne.status.fetchResolved=!0),Pe&&!Ge&&!ut)return Ue(me.signal.reason);let yt=Xe;return W(this,H)[$]===Xe&&(Je===void 0?yt.__staleWhileFetching?W(this,H)[$]=yt.__staleWhileFetching:this.delete(A):(ne.status&&(ne.status.fetchUpdated=!0),this.set(A,Je,Ce.options))),Je},gt=Je=>(ne.status&&(ne.status.fetchRejected=!0,ne.status.fetchError=Je),Ue(Je)),Ue=Je=>{let{aborted:ut}=me.signal,Pe=ut&&ne.allowStaleOnFetchAbort,Ge=Pe||ne.allowStaleOnFetchRejection,yt=Ge||ne.noDeleteOnFetchRejection,at=Xe;if(W(this,H)[$]===Xe&&(!yt||at.__staleWhileFetching===void 0?this.delete(A):Pe||(W(this,H)[$]=at.__staleWhileFetching)),Ge)return ne.status&&at.__staleWhileFetching!==void 0&&(ne.status.returnedStale=!0),at.__staleWhileFetching;if(at.__returned===at)throw Je},mt=(Je,ut)=>{var Ge;let Pe=(Ge=W(this,N))==null?void 0:Ge.call(this,A,de,Ce);Pe&&Pe instanceof Promise&&Pe.then(yt=>Je(yt===void 0?void 0:yt),ut),me.signal.addEventListener("abort",()=>{(!ne.ignoreFetchAbort||ne.allowStaleOnFetchAbort)&&(Je(void 0),ne.allowStaleOnFetchAbort&&(Je=yt=>Qe(yt,!0)))})};ne.status&&(ne.status.fetchDispatched=!0);let Xe=new Promise(mt).then(Qe,gt),Ze=Object.assign(Xe,{__abortController:me,__staleWhileFetching:de,__returned:void 0});return $===void 0?(this.set(A,Ze,{...Ce.options,status:void 0}),$=W(this,U).get(A)):W(this,H)[$]=Ze,Ze},le=new WeakSet,We=function(A){if(!W(this,ce))return!1;let $=A;return!!$&&$ instanceof Promise&&$.hasOwnProperty("__staleWhileFetching")&&$.__abortController instanceof i},Se=new WeakSet,Ya=function(A,$){W(this,ie)[$]=A,W(this,Y)[A]=$},h=new WeakSet,ei=function(A){A!==W(this,z)&&(A===W(this,I)?Oe(this,I,W(this,Y)[A]):Ie(this,Se,Ya).call(this,W(this,ie)[A],W(this,Y)[A]),Ie(this,Se,Ya).call(this,W(this,z),A),Oe(this,z,A))},x);e.LRUCache=d}),vr=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.ContainerIterator=e.Container=e.Base=void 0;var t=class{constructor(a=0){this.iteratorType=a}equals(a){return this.o===a.o}};e.ContainerIterator=t;var r=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};e.Base=r;var n=class extends r{};e.Container=n}),l0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=vr(),r=class extends t.Base{constructor(a=[]){super(),this.S=[];let i=this;a.forEach(function(o){i.push(o)})}clear(){this.i=0,this.S=[]}push(a){return this.S.push(a),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},n=r;e.default=n}),u0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=vr(),r=class extends t.Base{constructor(a=[]){super(),this.j=0,this.q=[];let i=this;a.forEach(function(o){i.push(o)})}clear(){this.q=[],this.i=this.j=0}push(a){let i=this.q.length;if(this.j/i>.5&&this.j+this.i>=i&&i>4096){let o=this.i;for(let l=0;l{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=vr(),r=class extends t.Base{constructor(a=[],i=function(l,s){return l>s?-1:l>1;for(let s=this.i-1>>1;s>=0;--s)this.k(s,l)}m(a){let i=this.C[a];for(;a>0;){let o=a-1>>1,l=this.C[o];if(this.v(l,i)<=0)break;this.C[a]=l,a=o}this.C[a]=i}k(a,i){let o=this.C[a];for(;a0&&(l=s,u=this.C[s]),this.v(u,o)>=0)break;this.C[a]=u,a=l}this.C[a]=o}clear(){this.i=0,this.C.length=0}push(a){this.C.push(a),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let a=this.C[0],i=this.C.pop();return this.i-=1,this.i&&(this.C[0]=i,this.k(0,this.i>>1)),a}top(){return this.C[0]}find(a){return this.C.indexOf(a)>=0}remove(a){let i=this.C.indexOf(a);return i<0?!1:(i===0?this.pop():i===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(i,1,this.C.pop()),this.i-=1,this.m(i),this.k(i,this.i>>1)),!0)}updateItem(a){let i=this.C.indexOf(a);return i<0?!1:(this.m(i),this.k(i,this.i>>1),!0)}toArray(){return[...this.C]}},n=r;e.default=n}),Wl=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=vr(),r=class extends t.Container{},n=r;e.default=n}),wr=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.throwIteratorAccessError=t;function t(){throw new RangeError("Iterator access denied!")}}),gd=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.RandomIterator=void 0;var t=vr(),r=wr(),n=class extends t.ContainerIterator{constructor(a,i){super(i),this.o=a,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,r.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,r.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,r.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,r.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(a){this.container.setElementByPos(this.o,a)}};e.RandomIterator=n}),f0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=n(Wl()),r=gd();function n(l){return l&&l.t?l:{default:l}}var a=class md extends r.RandomIterator{constructor(s,u,c){super(s,c),this.container=u}copy(){return new md(this.o,this.container,this.iteratorType)}},i=class extends t.default{constructor(l=[],s=!0){if(super(),Array.isArray(l))this.J=s?[...l]:l,this.i=l.length;else{this.J=[];let u=this;l.forEach(function(c){u.pushBack(c)})}}clear(){this.i=0,this.J.length=0}begin(){return new a(0,this)}end(){return new a(this.i,this)}rBegin(){return new a(this.i-1,this,1)}rEnd(){return new a(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(l){if(l<0||l>this.i-1)throw new RangeError;return this.J[l]}eraseElementByPos(l){if(l<0||l>this.i-1)throw new RangeError;return this.J.splice(l,1),this.i-=1,this.i}eraseElementByValue(l){let s=0;for(let u=0;uthis.i-1)throw new RangeError;this.J[l]=s}insert(l,s,u=1){if(l<0||l>this.i)throw new RangeError;return this.J.splice(l,0,...new Array(u).fill(s)),this.i+=u,this.i}find(l){for(let s=0;s{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=a(Wl()),r=vr(),n=wr();function a(s){return s&&s.t?s:{default:s}}var i=class yd extends r.ContainerIterator{constructor(u,c,f,d){super(d),this.o=u,this.h=c,this.container=f,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.l}set pointer(u){this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.l=u}copy(){return new yd(this.o,this.h,this.container,this.iteratorType)}},o=class extends t.default{constructor(s=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let u=this;s.forEach(function(c){u.pushBack(c)})}V(s){let{L:u,B:c}=s;u.B=c,c.L=u,s===this.p&&(this.p=c),s===this._&&(this._=u),this.i-=1}G(s,u){let c=u.B,f={l:s,L:u,B:c};u.B=f,c.L=f,u===this.h&&(this.p=f),c===this.h&&(this._=f),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new i(this.p,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this._,this.h,this,1)}rEnd(){return new i(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(s){if(s<0||s>this.i-1)throw new RangeError;let u=this.p;for(;s--;)u=u.B;return u.l}eraseElementByPos(s){if(s<0||s>this.i-1)throw new RangeError;let u=this.p;for(;s--;)u=u.B;return this.V(u),this.i}eraseElementByValue(s){let u=this.p;for(;u!==this.h;)u.l===s&&this.V(u),u=u.B;return this.i}eraseElementByIterator(s){let u=s.o;return u===this.h&&(0,n.throwIteratorAccessError)(),s=s.next(),this.V(u),s}pushBack(s){return this.G(s,this._),this.i}popBack(){if(this.i===0)return;let s=this._.l;return this.V(this._),s}pushFront(s){return this.G(s,this.h),this.i}popFront(){if(this.i===0)return;let s=this.p.l;return this.V(this.p),s}setElementByPos(s,u){if(s<0||s>this.i-1)throw new RangeError;let c=this.p;for(;s--;)c=c.B;c.l=u}insert(s,u,c=1){if(s<0||s>this.i)throw new RangeError;if(c<=0)return this.i;if(s===0)for(;c--;)this.pushFront(u);else if(s===this.i)for(;c--;)this.pushBack(u);else{let f=this.p;for(let m=1;m{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=n(Wl()),r=gd();function n(l){return l&&l.t?l:{default:l}}var a=class bd extends r.RandomIterator{constructor(s,u,c){super(s,c),this.container=u}copy(){return new bd(this.o,this.container,this.iteratorType)}},i=class extends t.default{constructor(l=[],s=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let u=(()=>{if(typeof l.length=="number")return l.length;if(typeof l.size=="number")return l.size;if(typeof l.size=="function")return l.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=s,this.P=Math.max(Math.ceil(u/this.F),1);for(let d=0;d>1)-(c>>1),this.D=this.N=this.F-u%this.F>>1;let f=this;l.forEach(function(d){f.pushBack(d)})}T(){let l=[],s=Math.max(this.P>>1,1);for(let u=0;u>1}begin(){return new a(0,this)}end(){return new a(this.i,this)}rBegin(){return new a(this.i-1,this,1)}rEnd(){return new a(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(l){return this.i&&(this.N0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,l}pushFront(l){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=l,this.i}popFront(){if(this.i===0)return;let l=this.A[this.j][this.D];return this.i!==1&&(this.Dthis.i-1)throw new RangeError;let{curNodeBucketIndex:s,curNodePointerIndex:u}=this.O(l);return this.A[s][u]}setElementByPos(l,s){if(l<0||l>this.i-1)throw new RangeError;let{curNodeBucketIndex:u,curNodePointerIndex:c}=this.O(l);this.A[u][c]=s}insert(l,s,u=1){if(l<0||l>this.i)throw new RangeError;if(l===0)for(;u--;)this.pushFront(s);else if(l===this.i)for(;u--;)this.pushBack(s);else{let c=[];for(let f=l;fthis.i-1)throw new RangeError;if(l===0)this.popFront();else if(l===this.i-1)this.popBack();else{let s=[];for(let c=l+1;cl;)this.popBack();return this.i}sort(l){let s=[];for(let u=0;u{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.TreeNodeEnableIndex=e.TreeNode=void 0;var t=class{constructor(n,a){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=n,this.l=a}L(){let n=this;if(n.ee===1&&n.tt.tt===n)n=n.W;else if(n.U)for(n=n.U;n.W;)n=n.W;else{let a=n.tt;for(;a.U===n;)n=a,a=n.tt;n=a}return n}B(){let n=this;if(n.W){for(n=n.W;n.U;)n=n.U;return n}else{let a=n.tt;for(;a.W===n;)n=a,a=n.tt;return n.W!==a?a:n}}te(){let n=this.tt,a=this.W,i=a.U;return n.tt===this?n.tt=a:n.U===this?n.U=a:n.W=a,a.tt=n,a.U=this,this.tt=a,this.W=i,i&&(i.tt=this),a}se(){let n=this.tt,a=this.U,i=a.W;return n.tt===this?n.tt=a:n.U===this?n.U=a:n.W=a,a.tt=n,a.W=this,this.tt=a,this.U=i,i&&(i.tt=this),a}};e.TreeNode=t;var r=class extends t{constructor(){super(...arguments),this.rt=1}te(){let n=super.te();return this.ie(),n.ie(),n}se(){let n=super.se();return this.ie(),n.ie(),n}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};e.TreeNodeEnableIndex=r}),vd=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=p0(),r=vr(),n=wr(),a=class extends r.Container{constructor(o=function(s,u){return su?1:0},l=!1){super(),this.Y=void 0,this.v=o,l?(this.re=t.TreeNodeEnableIndex,this.M=function(s,u,c){let f=this.ne(s,u,c);if(f){let d=f.tt;for(;d!==this.h;)d.rt+=1,d=d.tt;let m=this.he(f);if(m){let{parentNode:y,grandParent:b,curNode:T}=m;y.ie(),b.ie(),T.ie()}}return this.i},this.V=function(s){let u=this.fe(s);for(;u!==this.h;)u.rt-=1,u=u.tt}):(this.re=t.TreeNode,this.M=function(s,u,c){let f=this.ne(s,u,c);return f&&this.he(f),this.i},this.V=this.fe),this.h=new this.re}X(o,l){let s=this.h;for(;o;){let u=this.v(o.u,l);if(u<0)o=o.W;else if(u>0)s=o,o=o.U;else return o}return s}Z(o,l){let s=this.h;for(;o;)this.v(o.u,l)<=0?o=o.W:(s=o,o=o.U);return s}$(o,l){let s=this.h;for(;o;){let u=this.v(o.u,l);if(u<0)s=o,o=o.W;else if(u>0)o=o.U;else return o}return s}rr(o,l){let s=this.h;for(;o;)this.v(o.u,l)<0?(s=o,o=o.W):o=o.U;return s}ue(o){for(;;){let l=o.tt;if(l===this.h)return;if(o.ee===1){o.ee=0;return}if(o===l.U){let s=l.W;if(s.ee===1)s.ee=0,l.ee=1,l===this.Y?this.Y=l.te():l.te();else if(s.W&&s.W.ee===1){s.ee=l.ee,l.ee=0,s.W.ee=0,l===this.Y?this.Y=l.te():l.te();return}else s.U&&s.U.ee===1?(s.ee=1,s.U.ee=0,s.se()):(s.ee=1,o=l)}else{let s=l.U;if(s.ee===1)s.ee=0,l.ee=1,l===this.Y?this.Y=l.se():l.se();else if(s.U&&s.U.ee===1){s.ee=l.ee,l.ee=0,s.U.ee=0,l===this.Y?this.Y=l.se():l.se();return}else s.W&&s.W.ee===1?(s.ee=1,s.W.ee=0,s.te()):(s.ee=1,o=l)}}}fe(o){if(this.i===1)return this.clear(),this.h;let l=o;for(;l.U||l.W;){if(l.W)for(l=l.W;l.U;)l=l.U;else l=l.U;[o.u,l.u]=[l.u,o.u],[o.l,l.l]=[l.l,o.l],o=l}this.h.U===l?this.h.U=l.tt:this.h.W===l&&(this.h.W=l.tt),this.ue(l);let s=l.tt;return l===s.U?s.U=void 0:s.W=void 0,this.i-=1,this.Y.ee=0,s}oe(o,l){return o===void 0?!1:this.oe(o.U,l)||l(o)?!0:this.oe(o.W,l)}he(o){for(;;){let l=o.tt;if(l.ee===0)return;let s=l.tt;if(l===s.U){let u=s.W;if(u&&u.ee===1){if(u.ee=l.ee=0,s===this.Y)return;s.ee=1,o=s;continue}else if(o===l.W){if(o.ee=0,o.U&&(o.U.tt=l),o.W&&(o.W.tt=s),l.W=o.U,s.U=o.W,o.U=l,o.W=s,s===this.Y)this.Y=o,this.h.tt=o;else{let c=s.tt;c.U===s?c.U=o:c.W=o}return o.tt=s.tt,l.tt=o,s.tt=o,s.ee=1,{parentNode:l,grandParent:s,curNode:o}}else l.ee=0,s===this.Y?this.Y=s.se():s.se(),s.ee=1}else{let u=s.U;if(u&&u.ee===1){if(u.ee=l.ee=0,s===this.Y)return;s.ee=1,o=s;continue}else if(o===l.U){if(o.ee=0,o.U&&(o.U.tt=s),o.W&&(o.W.tt=l),s.W=o.U,l.U=o.W,o.U=s,o.W=l,s===this.Y)this.Y=o,this.h.tt=o;else{let c=s.tt;c.U===s?c.U=o:c.W=o}return o.tt=s.tt,l.tt=o,s.tt=o,s.ee=1,{parentNode:l,grandParent:s,curNode:o}}else l.ee=0,s===this.Y?this.Y=s.te():s.te(),s.ee=1}return}}ne(o,l,s){if(this.Y===void 0){this.i+=1,this.Y=new this.re(o,l),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let u,c=this.h.U,f=this.v(c.u,o);if(f===0){c.l=l;return}else if(f>0)c.U=new this.re(o,l),c.U.tt=c,u=c.U,this.h.U=u;else{let d=this.h.W,m=this.v(d.u,o);if(m===0){d.l=l;return}else if(m<0)d.W=new this.re(o,l),d.W.tt=d,u=d.W,this.h.W=u;else{if(s!==void 0){let y=s.o;if(y!==this.h){let b=this.v(y.u,o);if(b===0){y.l=l;return}else if(b>0){let T=y.L(),B=this.v(T.u,o);if(B===0){T.l=l;return}else B<0&&(u=new this.re(o,l),T.W===void 0?(T.W=u,u.tt=T):(y.U=u,u.tt=y))}}}if(u===void 0)for(u=this.Y;;){let y=this.v(u.u,o);if(y>0){if(u.U===void 0){u.U=new this.re(o,l),u.U.tt=u,u=u.U;break}u=u.U}else if(y<0){if(u.W===void 0){u.W=new this.re(o,l),u.W.tt=u,u=u.W;break}u=u.W}else{u.l=l;return}}}}return this.i+=1,u}I(o,l){for(;o;){let s=this.v(o.u,l);if(s<0)o=o.W;else if(s>0)o=o.U;else return o}return o||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(o,l){let s=o.o;if(s===this.h&&(0,n.throwIteratorAccessError)(),this.i===1)return s.u=l,!0;if(s===this.h.U)return this.v(s.B().u,l)>0?(s.u=l,!0):!1;if(s===this.h.W)return this.v(s.L().u,l)<0?(s.u=l,!0):!1;let u=s.L().u;if(this.v(u,l)>=0)return!1;let c=s.B().u;return this.v(c,l)<=0?!1:(s.u=l,!0)}eraseElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;let l=0,s=this;return this.oe(this.Y,function(u){return o===l?(s.V(u),!0):(l+=1,!1)}),this.i}eraseElementByKey(o){if(this.i===0)return!1;let l=this.I(this.Y,o);return l===this.h?!1:(this.V(l),!0)}eraseElementByIterator(o){let l=o.o;l===this.h&&(0,n.throwIteratorAccessError)();let s=l.W===void 0;return o.iteratorType===0?s&&o.next():(!s||l.U===void 0)&&o.next(),this.V(l),o}forEach(o){let l=0;for(let s of this)o(s,l++,this)}getElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;let l,s=0;for(let u of this){if(s===o){l=u;break}s+=1}return l}getHeight(){if(this.i===0)return 0;let o=function(l){return l?Math.max(o(l.U),o(l.W))+1:0};return o(this.Y)}},i=a;e.default=i}),wd=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=vr(),r=wr(),n=class extends t.ContainerIterator{constructor(i,o,l){super(l),this.o=i,this.h=o,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,r.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,r.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let i=this.o,o=this.h.tt;if(i===this.h)return o?o.rt-1:0;let l=0;for(i.U&&(l+=i.U.rt);i!==o;){let s=i.tt;i===s.W&&(l+=1,s.U&&(l+=s.U.rt)),i=s}return l}},a=n;e.default=a}),g0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=a(vd()),r=a(wd()),n=wr();function a(s){return s&&s.t?s:{default:s}}var i=class _d extends r.default{constructor(u,c,f,d){super(u,c,d),this.container=f}get pointer(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.u}copy(){return new _d(this.o,this.h,this.container,this.iteratorType)}},o=class extends t.default{constructor(s=[],u,c){super(u,c);let f=this;s.forEach(function(d){f.insert(d)})}*K(s){s!==void 0&&(yield*this.K(s.U),yield s.u,yield*this.K(s.W))}begin(){return new i(this.h.U||this.h,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this.h.W||this.h,this.h,this,1)}rEnd(){return new i(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(s,u){return this.M(s,void 0,u)}find(s){let u=this.I(this.Y,s);return new i(u,this.h,this)}lowerBound(s){let u=this.X(this.Y,s);return new i(u,this.h,this)}upperBound(s){let u=this.Z(this.Y,s);return new i(u,this.h,this)}reverseLowerBound(s){let u=this.$(this.Y,s);return new i(u,this.h,this)}reverseUpperBound(s){let u=this.rr(this.Y,s);return new i(u,this.h,this)}union(s){let u=this;return s.forEach(function(c){u.insert(c)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},l=o;e.default=l}),m0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=a(vd()),r=a(wd()),n=wr();function a(s){return s&&s.t?s:{default:s}}var i=class Ed extends r.default{constructor(u,c,f,d){super(u,c,d),this.container=f}get pointer(){this.o===this.h&&(0,n.throwIteratorAccessError)();let u=this;return new Proxy([],{get(c,f){if(f==="0")return u.o.u;if(f==="1")return u.o.l},set(c,f,d){if(f!=="1")throw new TypeError("props must be 1");return u.o.l=d,!0}})}copy(){return new Ed(this.o,this.h,this.container,this.iteratorType)}},o=class extends t.default{constructor(s=[],u,c){super(u,c);let f=this;s.forEach(function(d){f.setElement(d[0],d[1])})}*K(s){s!==void 0&&(yield*this.K(s.U),yield[s.u,s.l],yield*this.K(s.W))}begin(){return new i(this.h.U||this.h,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this.h.W||this.h,this.h,this,1)}rEnd(){return new i(this.h,this.h,this,1)}front(){if(this.i===0)return;let s=this.h.U;return[s.u,s.l]}back(){if(this.i===0)return;let s=this.h.W;return[s.u,s.l]}lowerBound(s){let u=this.X(this.Y,s);return new i(u,this.h,this)}upperBound(s){let u=this.Z(this.Y,s);return new i(u,this.h,this)}reverseLowerBound(s){let u=this.$(this.Y,s);return new i(u,this.h,this)}reverseUpperBound(s){let u=this.rr(this.Y,s);return new i(u,this.h,this)}setElement(s,u,c){return this.M(s,u,c)}find(s){let u=this.I(this.Y,s);return new i(u,this.h,this)}getElementByKey(s){return this.I(this.Y,s).l}union(s){let u=this;return s.forEach(function(c){u.setElement(c[0],c[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},l=o;e.default=l}),Sd=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=t;function t(r){let n=typeof r;return n==="object"&&r!==null||n==="function"}}),Ad=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.HashContainerIterator=e.HashContainer=void 0;var t=vr(),r=a(Sd()),n=wr();function a(l){return l&&l.t?l:{default:l}}var i=class extends t.ContainerIterator{constructor(l,s,u){super(u),this.o=l,this.h=s,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this})}};e.HashContainerIterator=i;var o=class extends t.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(l){let{L:s,B:u}=l;s.B=u,u.L=s,l===this.p&&(this.p=u),l===this._&&(this._=s),this.i-=1}M(l,s,u){u===void 0&&(u=(0,r.default)(l));let c;if(u){let f=l[this.HASH_TAG];if(f!==void 0)return this.H[f].l=s,this.i;Object.defineProperty(l,this.HASH_TAG,{value:this.H.length,configurable:!0}),c={u:l,l:s,L:this._,B:this.h},this.H.push(c)}else{let f=this.g[l];if(f)return f.l=s,this.i;c={u:l,l:s,L:this._,B:this.h},this.g[l]=c}return this.i===0?(this.p=c,this.h.B=c):this._.B=c,this._=c,this.h.L=c,++this.i}I(l,s){if(s===void 0&&(s=(0,r.default)(l)),s){let u=l[this.HASH_TAG];return u===void 0?this.h:this.H[u]}else return this.g[l]||this.h}clear(){let l=this.HASH_TAG;this.H.forEach(function(s){delete s.u[l]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(l,s){let u;if(s===void 0&&(s=(0,r.default)(l)),s){let c=l[this.HASH_TAG];if(c===void 0)return!1;delete l[this.HASH_TAG],u=this.H[c],delete this.H[c]}else{if(u=this.g[l],u===void 0)return!1;delete this.g[l]}return this.V(u),!0}eraseElementByIterator(l){let s=l.o;return s===this.h&&(0,n.throwIteratorAccessError)(),this.V(s),l.next()}eraseElementByPos(l){if(l<0||l>this.i-1)throw new RangeError;let s=this.p;for(;l--;)s=s.B;return this.V(s),this.i}};e.HashContainer=o}),y0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=Ad(),r=wr(),n=class Td extends t.HashContainerIterator{constructor(l,s,u,c){super(l,s,c),this.container=u}get pointer(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o.u}copy(){return new Td(this.o,this.h,this.container,this.iteratorType)}},a=class extends t.HashContainer{constructor(o=[]){super();let l=this;o.forEach(function(s){l.insert(s)})}begin(){return new n(this.p,this.h,this)}end(){return new n(this.h,this.h,this)}rBegin(){return new n(this._,this.h,this,1)}rEnd(){return new n(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(o,l){return this.M(o,void 0,l)}getElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;let l=this.p;for(;o--;)l=l.B;return l.u}find(o,l){let s=this.I(o,l);return new n(s,this.h,this)}forEach(o){let l=0,s=this.p;for(;s!==this.h;)o(s.u,l++,this),s=s.B}[Symbol.iterator](){return(function*(){let o=this.p;for(;o!==this.h;)yield o.u,o=o.B}).bind(this)()}},i=a;e.default=i}),b0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=Ad(),r=a(Sd()),n=wr();function a(s){return s&&s.t?s:{default:s}}var i=class Id extends t.HashContainerIterator{constructor(u,c,f,d){super(u,c,d),this.container=f}get pointer(){this.o===this.h&&(0,n.throwIteratorAccessError)();let u=this;return new Proxy([],{get(c,f){if(f==="0")return u.o.u;if(f==="1")return u.o.l},set(c,f,d){if(f!=="1")throw new TypeError("props must be 1");return u.o.l=d,!0}})}copy(){return new Id(this.o,this.h,this.container,this.iteratorType)}},o=class extends t.HashContainer{constructor(s=[]){super();let u=this;s.forEach(function(c){u.setElement(c[0],c[1])})}begin(){return new i(this.p,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this._,this.h,this,1)}rEnd(){return new i(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(s,u,c){return this.M(s,u,c)}getElementByKey(s,u){if(u===void 0&&(u=(0,r.default)(s)),u){let f=s[this.HASH_TAG];return f!==void 0?this.H[f].l:void 0}let c=this.g[s];return c?c.l:void 0}getElementByPos(s){if(s<0||s>this.i-1)throw new RangeError;let u=this.p;for(;s--;)u=u.B;return[u.u,u.l]}find(s,u){let c=this.I(s,u);return new i(c,this.h,this)}forEach(s){let u=0,c=this.p;for(;c!==this.h;)s([c.u,c.l],u++,this),c=c.B}[Symbol.iterator](){return(function*(){let s=this.p;for(;s!==this.h;)yield[s.u,s.l],s=s.B}).bind(this)()}},l=o;e.default=l}),v0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"t",{value:!0}),Object.defineProperty(e,"Deque",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"HashMap",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"HashSet",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(e,"LinkList",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"OrderedMap",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"OrderedSet",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(e,"PriorityQueue",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"Queue",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"Stack",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"Vector",{enumerable:!0,get:function(){return a.default}});var t=f(l0()),r=f(u0()),n=f(c0()),a=f(f0()),i=f(h0()),o=f(d0()),l=f(g0()),s=f(m0()),u=f(y0()),c=f(b0());function f(d){return d&&d.t?d:{default:d}}}),w0=Ee((e,t)=>{ye(),ve(),be();var r=v0().OrderedSet,n=gr()("number-allocator:trace"),a=gr()("number-allocator:error");function i(l,s){this.low=l,this.high=s}i.prototype.equals=function(l){return this.low===l.low&&this.high===l.high},i.prototype.compare=function(l){return this.lowu.compare(c)),n("Create"),this.clear()}o.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},o.prototype.alloc=function(){if(this.ss.size()===0)return n("alloc():empty"),null;let l=this.ss.begin(),s=l.pointer.low,u=l.pointer.high,c=s;return c+1<=u?this.ss.updateKeyByIterator(l,new i(s+1,u)):this.ss.eraseElementByPos(0),n("alloc():"+c),c},o.prototype.use=function(l){let s=new i(l,l),u=this.ss.lowerBound(s);if(!u.equals(this.ss.end())){let c=u.pointer.low,f=u.pointer.high;return u.pointer.equals(s)?(this.ss.eraseElementByIterator(u),n("use():"+l),!0):c>l?!1:c===l?(this.ss.updateKeyByIterator(u,new i(c+1,f)),n("use():"+l),!0):f===l?(this.ss.updateKeyByIterator(u,new i(c,f-1)),n("use():"+l),!0):(this.ss.updateKeyByIterator(u,new i(l+1,f)),this.ss.insert(new i(c,l-1)),n("use():"+l),!0)}return n("use():failed"),!1},o.prototype.free=function(l){if(lthis.max){a("free():"+l+" is out of range");return}let s=new i(l,l),u=this.ss.upperBound(s);if(u.equals(this.ss.end())){if(u.equals(this.ss.begin())){this.ss.insert(s);return}u.pre();let c=u.pointer.high;u.pointer.high+1===l?this.ss.updateKeyByIterator(u,new i(c,l)):this.ss.insert(s)}else if(u.equals(this.ss.begin()))if(l+1===u.pointer.low){let c=u.pointer.high;this.ss.updateKeyByIterator(u,new i(l,c))}else this.ss.insert(s);else{let c=u.pointer.low,f=u.pointer.high;u.pre();let d=u.pointer.low;u.pointer.high+1===l?l+1===c?(this.ss.eraseElementByIterator(u),this.ss.updateKeyByIterator(u,new i(d,f))):this.ss.updateKeyByIterator(u,new i(d,l)):l+1===c?(this.ss.eraseElementByIterator(u.next()),this.ss.insert(new i(l,f))):this.ss.insert(s)}n("free():"+l)},o.prototype.clear=function(){n("clear()"),this.ss.clear(),this.ss.insert(new i(this.min,this.max))},o.prototype.intervalCount=function(){return this.ss.size()},o.prototype.dump=function(){console.log("length:"+this.ss.size());for(let l of this.ss)console.log(l)},t.exports=o}),Cd=Ee((e,t)=>{ye(),ve(),be();var r=w0();t.exports.NumberAllocator=r}),_0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0});var t=a0(),r=Cd(),n=class{constructor(a){a>0&&(this.aliasToTopic=new t.LRUCache({max:a}),this.topicToAlias={},this.numberAllocator=new r.NumberAllocator(1,a),this.max=a,this.length=0)}put(a,i){if(i===0||i>this.max)return!1;let o=this.aliasToTopic.get(i);return o&&delete this.topicToAlias[o],this.aliasToTopic.set(i,a),this.topicToAlias[a]=i,this.numberAllocator.use(i),this.length=this.aliasToTopic.size,!0}getTopicByAlias(a){return this.aliasToTopic.get(a)}getAliasByTopic(a){let i=this.topicToAlias[a];return typeof i<"u"&&this.aliasToTopic.get(i),i}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){return this.numberAllocator.firstVacant()||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};e.default=n}),E0=Ee(e=>{ye(),ve(),be();var t=e&&e.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(e,"__esModule",{value:!0});var r=Fo(),n=t(_0()),a=Ti(),i=(o,l)=>{o.log("_handleConnack");let{options:s}=o,u=s.protocolVersion===5?l.reasonCode:l.returnCode;if(clearTimeout(o.connackTimer),delete o.topicAliasSend,l.properties){if(l.properties.topicAliasMaximum){if(l.properties.topicAliasMaximum>65535){o.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}l.properties.topicAliasMaximum>0&&(o.topicAliasSend=new n.default(l.properties.topicAliasMaximum))}l.properties.serverKeepAlive&&s.keepalive&&(s.keepalive=l.properties.serverKeepAlive,o._shiftPingInterval()),l.properties.maximumPacketSize&&(s.properties||(s.properties={}),s.properties.maximumPacketSize=l.properties.maximumPacketSize)}if(u===0)o.reconnecting=!1,o._onConnect(l);else if(u>0){let c=new a.ErrorWithReasonCode(`Connection refused: ${r.ReasonCodes[u]}`,u);o.emit("error",c)}};e.default=i}),S0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0});var t=(r,n,a)=>{r.log("handling pubrel packet");let i=typeof a<"u"?a:r.noop,{messageId:o}=n,l={cmd:"pubcomp",messageId:o};r.incomingStore.get(n,(s,u)=>{s?r._sendPacket(l,i):(r.emit("message",u.topic,u.payload,u),r.handleMessage(u,c=>{if(c)return i(c);r.incomingStore.del(u,r.noop),r._sendPacket(l,i)}))})};e.default=t}),A0=Ee(e=>{ye(),ve(),be();var t=e&&e.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(e,"__esModule",{value:!0});var r=t(o0()),n=t(s0()),a=t(E0()),i=t(Fo()),o=t(S0()),l=(s,u,c)=>{let{options:f}=s;if(f.protocolVersion===5&&f.properties&&f.properties.maximumPacketSize&&f.properties.maximumPacketSize{ye(),ve(),be();var t=e&&e.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(e,"__esModule",{value:!0}),e.TypedEventEmitter=void 0;var r=t((Wn(),De(wn))),n=Ti(),a=class{};e.TypedEventEmitter=a,(0,n.applyMixin)(a,r.default)}),I0=Ee((e,t)=>{ye(),ve(),be(),function(r,n){typeof e=="object"&&typeof t<"u"?n(e):typeof define=="function"&&define.amd?define(["exports"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.fastUniqueNumbers={}))}(e,function(r){var n=function(m){return function(y){var b=m(y);return y.add(b),b}},a=function(m){return function(y,b){return m.set(y,b),b}},i=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,l=o*2,s=function(m,y){return function(b){var T=y.get(b),B=T===void 0?b.size:Ti)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;b.has(B);)B=Math.floor(Math.random()*i);return m(b,B)}},u=new WeakMap,c=a(u),f=s(c,u),d=n(f);r.addUniqueNumber=d,r.generateUniqueNumber=f})}),C0=Ee((e,t)=>{ye(),ve(),be(),function(r,n){typeof e=="object"&&typeof t<"u"?n(e,I0()):typeof define=="function"&&define.amd?define(["exports","fast-unique-numbers"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.workerTimersBroker={},r.fastUniqueNumbers))}(e,function(r,n){var a=function(l){return l.method!==void 0&&l.method==="call"},i=function(l){return l.error===null&&typeof l.id=="number"},o=function(l){var s=new Map([[0,function(){}]]),u=new Map([[0,function(){}]]),c=new Map,f=new Worker(l);f.addEventListener("message",function(T){var B=T.data;if(a(B)){var C=B.params,O=C.timerId,N=C.timerType;if(N==="interval"){var v=s.get(O);if(typeof v=="number"){var R=c.get(v);if(R===void 0||R.timerId!==O||R.timerType!==N)throw new Error("The timer is in an undefined state.")}else if(typeof v<"u")v();else throw new Error("The timer is in an undefined state.")}else if(N==="timeout"){var U=u.get(O);if(typeof U=="number"){var F=c.get(U);if(F===void 0||F.timerId!==O||F.timerType!==N)throw new Error("The timer is in an undefined state.")}else if(typeof U<"u")U(),u.delete(O);else throw new Error("The timer is in an undefined state.")}}else if(i(B)){var H=B.id,Y=c.get(H);if(Y===void 0)throw new Error("The timer is in an undefined state.");var ie=Y.timerId,I=Y.timerType;c.delete(H),I==="interval"?s.delete(ie):u.delete(ie)}else{var z=B.error.message;throw new Error(z)}});var d=function(T){var B=n.generateUniqueNumber(c);c.set(B,{timerId:T,timerType:"interval"}),s.set(T,B),f.postMessage({id:B,method:"clear",params:{timerId:T,timerType:"interval"}})},m=function(T){var B=n.generateUniqueNumber(c);c.set(B,{timerId:T,timerType:"timeout"}),u.set(T,B),f.postMessage({id:B,method:"clear",params:{timerId:T,timerType:"timeout"}})},y=function(T,B){var C=n.generateUniqueNumber(s);return s.set(C,function(){T(),typeof s.get(C)=="function"&&f.postMessage({id:null,method:"set",params:{delay:B,now:performance.now(),timerId:C,timerType:"interval"}})}),f.postMessage({id:null,method:"set",params:{delay:B,now:performance.now(),timerId:C,timerType:"interval"}}),C},b=function(T,B){var C=n.generateUniqueNumber(u);return u.set(C,T),f.postMessage({id:null,method:"set",params:{delay:B,now:performance.now(),timerId:C,timerType:"timeout"}}),C};return{clearInterval:d,clearTimeout:m,setInterval:y,setTimeout:b}};r.load=o})}),O0=Ee((e,t)=>{ye(),ve(),be(),function(r,n){typeof e=="object"&&typeof t<"u"?n(e,C0()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.workerTimers={},r.workerTimersBroker))}(e,function(r,n){var a=function(f,d){var m=null;return function(){if(m!==null)return m;var y=new Blob([d],{type:"application/javascript; charset=utf-8"}),b=URL.createObjectURL(y);return m=f(b),setTimeout(function(){return URL.revokeObjectURL(b)}),m}},i=`(()=>{var e={67:(e,t,r)=>{var o,i;void 0===(i="function"==typeof(o=function(){"use strict";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id "'.concat(t,'".'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id "'.concat(e,'".'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:"call",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,"interval"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,"timeout"))};addEventListener("message",(function(e){var t=e.data;try{if("clear"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if("interval"===c)r(d),postMessage({error:null,id:i});else{if("timeout"!==c)throw new Error('The given type "'.concat(c,'" is not supported'));o(d),postMessage({error:null,id:i})}}else{if("set"!==t.method)throw new Error('The given method "'.concat(t.method,'" is not supported'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if("interval"===v)a(l,m,p);else{if("timeout"!==v)throw new Error('The given type "'.concat(v,'" is not supported'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(67)})()})();`,o=a(n.load,i),l=function(f){return o().clearInterval(f)},s=function(f){return o().clearTimeout(f)},u=function(f,d){return o().setInterval(f,d)},c=function(f,d){return o().setTimeout(f,d)};r.clearInterval=l,r.clearTimeout=s,r.setInterval=u,r.setTimeout=c})}),Hl=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0}),e.isWebWorker=void 0;var t=()=>typeof window<"u"&&typeof window.document<"u",r=()=>{var i,o;return!!(typeof self=="object"&&!((o=(i=self==null?void 0:self.constructor)===null||i===void 0?void 0:i.name)===null||o===void 0)&&o.includes("WorkerGlobalScope"))},n=()=>typeof navigator<"u"&&navigator.product==="ReactNative",a=t()||r()||n();e.isWebWorker=r(),e.default=a}),R0=Ee(e=>{ye(),ve(),be();var t=e&&e.__createBinding||(Object.create?function(l,s,u,c){c===void 0&&(c=u);var f=Object.getOwnPropertyDescriptor(s,u);(!f||("get"in f?!s.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return s[u]}}),Object.defineProperty(l,c,f)}:function(l,s,u,c){c===void 0&&(c=u),l[c]=s[u]}),r=e&&e.__setModuleDefault||(Object.create?function(l,s){Object.defineProperty(l,"default",{enumerable:!0,value:s})}:function(l,s){l.default=s}),n=e&&e.__importStar||function(l){if(l&&l.__esModule)return l;var s={};if(l!=null)for(var u in l)u!=="default"&&Object.prototype.hasOwnProperty.call(l,u)&&t(s,l,u);return r(s,l),s};Object.defineProperty(e,"__esModule",{value:!0});var a=O0(),i=n(Hl()),o=class{constructor(l,s){this._setTimeout=i.default&&!i.isWebWorker?a.setTimeout:(u,c)=>setTimeout(u,c),this._clearTimeout=i.default&&!i.isWebWorker?a.clearTimeout:u=>clearTimeout(u),this.keepalive=l*1e3,this.checkPing=s,this.reschedule()}clear(){this.timer&&(this._clearTimeout(this.timer),this.timer=null)}reschedule(){this.clear(),this.timer=this._setTimeout(()=>{this.checkPing(),this.timer&&this.reschedule()},this.keepalive)}};e.default=o}),Qa=Ee(e=>{ye(),ve(),be();var t=e&&e.__createBinding||(Object.create?function(N,v,R,U){U===void 0&&(U=R);var F=Object.getOwnPropertyDescriptor(v,R);(!F||("get"in F?!v.__esModule:F.writable||F.configurable))&&(F={enumerable:!0,get:function(){return v[R]}}),Object.defineProperty(N,U,F)}:function(N,v,R,U){U===void 0&&(U=R),N[U]=v[R]}),r=e&&e.__setModuleDefault||(Object.create?function(N,v){Object.defineProperty(N,"default",{enumerable:!0,value:v})}:function(N,v){N.default=v}),n=e&&e.__importStar||function(N){if(N&&N.__esModule)return N;var v={};if(N!=null)for(var R in N)R!=="default"&&Object.prototype.hasOwnProperty.call(N,R)&&t(v,N,R);return r(v,N),v},a=e&&e.__importDefault||function(N){return N&&N.__esModule?N:{default:N}};Object.defineProperty(e,"__esModule",{value:!0});var i=a(vb()),o=a(t0()),l=a(fd()),s=_n(),u=a(n0()),c=n(i0()),f=a(gr()),d=a(hd()),m=a(A0()),y=Ti(),b=T0(),T=a(R0()),B=globalThis.setImmediate||((...N)=>{let v=N.shift();(0,y.nextTick)(()=>{v(...N)})}),C={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0},O=class Od extends b.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(v,R){super(),this.options=R||{};for(let U in C)typeof this.options[U]>"u"?this.options[U]=C[U]:this.options[U]=R[U];this.log=this.options.log||(0,f.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: options.protocol",R.protocol),this.log("MqttClient :: options.protocolVersion",R.protocolVersion),this.log("MqttClient :: options.username",R.username),this.log("MqttClient :: options.keepalive",R.keepalive),this.log("MqttClient :: options.reconnectPeriod",R.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",R.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",R.properties?R.properties.topicAliasMaximum:void 0),this.options.clientId=typeof R.clientId=="string"?R.clientId:Od.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=R.protocolVersion===5&&R.customHandleAcks?R.customHandleAcks:(...U)=>{U[3](null,0)},this.options.writeCache||(o.default.writeToStream.cacheNumbers=!1),this.streamBuilder=v,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new l.default:this.options.messageIdProvider,this.outgoingStore=R.outgoingStore||new d.default,this.incomingStore=R.incomingStore||new d.default,this.queueQoSZero=R.queueQoSZero===void 0?!0:R.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,R.properties&&R.properties.topicAliasMaximum>0&&(R.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new i.default(R.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:U}=this,F=()=>{let H=U.shift();this.log("deliver :: entry %o",H);let Y=null;if(!H){this._resubscribe();return}Y=H.packet,this.log("deliver :: call _sendPacket for %o",Y);let ie=!0;Y.messageId&&Y.messageId!==0&&(this.messageIdProvider.register(Y.messageId)||(ie=!1)),ie?this._sendPacket(Y,I=>{H.cb&&H.cb(I),F()}):(this.log("messageId: %d has already used. The message is skipped and removed.",Y.messageId),F())};this.log("connect :: sending queued packets"),F()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this.log("close :: clearing ping timer"),this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}handleAuth(v,R){R()}handleMessage(v,R){R()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var v;let R=new s.Writable,U=o.default.parser(this.options),F=null,H=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),U.on("packet",ee=>{this.log("parser :: on packet push to packets array."),H.push(ee)});let Y=()=>{this.log("work :: getting next packet in queue");let ee=H.shift();if(ee)this.log("work :: packet pulled from queue"),(0,m.default)(this,ee,ie);else{this.log("work :: no packets in queue");let oe=F;F=null,this.log("work :: done flag is %s",!!oe),oe&&oe()}},ie=()=>{if(H.length)(0,y.nextTick)(Y);else{let ee=F;F=null,ee()}};R._write=(ee,oe,ae)=>{F=ae,this.log("writable stream :: parsing buffer"),U.parse(ee),Y()};let I=ee=>{this.log("streamErrorHandler :: error",ee.message),ee.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",ee)):this.noop(ee)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(R),this.stream.on("error",I),this.stream.on("close",()=>{this.log("(%s)stream :: on close",this.options.clientId),this._flushVolatile(),this.log("stream: emit close to MqttClient"),this.emit("close")}),this.log("connect: sending packet `connect`");let z={cmd:"connect",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(z.will=Object.assign(Object.assign({},this.options.will),{payload:(v=this.options.will)===null||v===void 0?void 0:v.payload})),this.topicAliasRecv&&(z.properties||(z.properties={}),this.topicAliasRecv&&(z.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(z),U.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let ee=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(ee)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this._cleanUp(!0)},this.options.connectTimeout),this}publish(v,R,U,F){this.log("publish :: message `%s` to topic `%s`",R,v);let{options:H}=this;typeof U=="function"&&(F=U,U=null),U=U||{},U=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),U);let{qos:Y,retain:ie,dup:I,properties:z,cbStorePut:ee}=U;if(this._checkDisconnecting(F))return this;let oe=()=>{let ae=0;if((Y===1||Y===2)&&(ae=this._nextId(),ae===null))return this.log("No messageId left"),!1;let Z={cmd:"publish",topic:v,payload:R,qos:Y,retain:ie,messageId:ae,dup:I};switch(H.protocolVersion===5&&(Z.properties=z),this.log("publish :: qos",Y),Y){case 1:case 2:this.outgoing[Z.messageId]={volatile:!1,cb:F||this.noop},this.log("MqttClient:publish: packet cmd: %s",Z.cmd),this._sendPacket(Z,void 0,ee);break;default:this.log("MqttClient:publish: packet cmd: %s",Z.cmd),this._sendPacket(Z,F,ee);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!oe())&&this._storeProcessingQueue.push({invoke:oe,cbStorePut:U.cbStorePut,callback:F}),this}publishAsync(v,R,U){return new Promise((F,H)=>{this.publish(v,R,U,(Y,ie)=>{Y?H(Y):F(ie)})})}subscribe(v,R,U){let F=this.options.protocolVersion;typeof R=="function"&&(U=R),U=U||this.noop;let H=!1,Y=[];typeof v=="string"?(v=[v],Y=v):Array.isArray(v)?Y=v:typeof v=="object"&&(H=v.resubscribe,delete v.resubscribe,Y=Object.keys(v));let ie=c.validateTopics(Y);if(ie!==null)return B(U,new Error(`Invalid topic ${ie}`)),this;if(this._checkDisconnecting(U))return this.log("subscribe: discconecting true"),this;let I={qos:0};F===5&&(I.nl=!1,I.rap=!1,I.rh=0),R=Object.assign(Object.assign({},I),R);let z=R.properties,ee=[],oe=(Z,Q)=>{if(Q=Q||R,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,Z)||this._resubscribeTopics[Z].qos{this.log("subscribe: array topic %s",Z),oe(Z)}):Object.keys(v).forEach(Z=>{this.log("subscribe: object topic %s, %o",Z,v[Z]),oe(Z,v[Z])}),!ee.length)return U(null,[]),this;let ae=()=>{let Z=this._nextId();if(Z===null)return this.log("No messageId left"),!1;let Q={cmd:"subscribe",subscriptions:ee,messageId:Z};if(z&&(Q.properties=z),this.options.resubscribe){this.log("subscribe :: resubscribe true");let he=[];ee.forEach(ce=>{if(this.options.reconnectPeriod>0){let _e={qos:ce.qos};F===5&&(_e.nl=ce.nl||!1,_e.rap=ce.rap||!1,_e.rh=ce.rh||0,_e.properties=ce.properties),this._resubscribeTopics[ce.topic]=_e,he.push(ce.topic)}}),this.messageIdToTopic[Q.messageId]=he}return this.outgoing[Q.messageId]={volatile:!0,cb(he,ce){if(!he){let{granted:_e}=ce;for(let j=0;j<_e.length;j+=1)ee[j].qos=_e[j]}U(he,ee)}},this.log("subscribe :: call _sendPacket"),this._sendPacket(Q),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ae())&&this._storeProcessingQueue.push({invoke:ae,callback:U}),this}subscribeAsync(v,R){return new Promise((U,F)=>{this.subscribe(v,R,(H,Y)=>{H?F(H):U(Y)})})}unsubscribe(v,R,U){typeof v=="string"&&(v=[v]),typeof R=="function"&&(U=R),U=U||this.noop;let F=c.validateTopics(v);if(F!==null)return B(U,new Error(`Invalid topic ${F}`)),this;if(this._checkDisconnecting(U))return this;let H=()=>{let Y=this._nextId();if(Y===null)return this.log("No messageId left"),!1;let ie={cmd:"unsubscribe",messageId:Y,unsubscriptions:[]};return typeof v=="string"?ie.unsubscriptions=[v]:Array.isArray(v)&&(ie.unsubscriptions=v),this.options.resubscribe&&ie.unsubscriptions.forEach(I=>{delete this._resubscribeTopics[I]}),typeof R=="object"&&R.properties&&(ie.properties=R.properties),this.outgoing[ie.messageId]={volatile:!0,cb:U},this.log("unsubscribe: call _sendPacket"),this._sendPacket(ie),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!H())&&this._storeProcessingQueue.push({invoke:H,callback:U}),this}unsubscribeAsync(v,R){return new Promise((U,F)=>{this.unsubscribe(v,R,(H,Y)=>{H?F(H):U(Y)})})}end(v,R,U){this.log("end :: (%s)",this.options.clientId),(v==null||typeof v!="boolean")&&(U=U||R,R=v,v=!1),typeof R!="object"&&(U=U||R,R=null),this.log("end :: cb? %s",!!U),(!U||typeof U!="function")&&(U=this.noop);let F=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(Y=>{this.outgoingStore.close(ie=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),U){let I=Y||ie;this.log("end :: closeStores: invoking callback with args"),U(I)}})}),this._deferredReconnect&&this._deferredReconnect()},H=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,v),this._cleanUp(v,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,y.nextTick)(F)},R)};return this.disconnecting?(U(),this):(this._clearReconnect(),this.disconnecting=!0,!v&&Object.keys(this.outgoing).length>0?(this.log("end :: (%s) :: calling finish in 10ms once outgoing is empty",this.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,H,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),H()),this)}endAsync(v,R){return new Promise((U,F)=>{this.end(v,R,H=>{H?F(H):U()})})}removeOutgoingMessage(v){if(this.outgoing[v]){let{cb:R}=this.outgoing[v];this._removeOutgoingAndStoreMessage(v,()=>{R(new Error("Message removed"))})}return this}reconnect(v){this.log("client reconnect");let R=()=>{v?(this.options.incomingStore=v.incomingStore,this.options.outgoingStore=v.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new d.default,this.outgoingStore=this.options.outgoingStore||new d.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=R:R(),this}_flushVolatile(){this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach(v=>{this.outgoing[v].volatile&&typeof this.outgoing[v].cb=="function"&&(this.outgoing[v].cb(new Error("Connection closed")),delete this.outgoing[v])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(v=>{typeof this.outgoing[v].cb=="function"&&(this.outgoing[v].cb(new Error("Connection closed")),delete this.outgoing[v])}))}_removeTopicAliasAndRecoverTopicName(v){let R;v.properties&&(R=v.properties.topicAlias);let U=v.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",R,U),U.length===0){if(typeof R>"u")return new Error("Unregistered Topic Alias");if(U=this.topicAliasSend.getTopicByAlias(R),typeof U>"u")return new Error("Unregistered Topic Alias");v.topic=U}R&&delete v.properties.topicAlias}_checkDisconnecting(v){return this.disconnecting&&(v&&v!==this.noop?v(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting}_reconnect(){this.log("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this.connect()}),this.log("client already connected. disconnecting first.")):(this.log("_reconnect: calling connect"),this.connect())}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log("_setupReconnect :: emit `offline` state"),this.emit("offline"),this.log("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),this.log("_setupReconnect :: setting reconnectTimer for %d ms",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log("reconnectTimer :: reconnect triggered!"),this._reconnect()},this.options.reconnectPeriod)):this.log("_setupReconnect :: doing nothing...")}_clearReconnect(){this.log("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}_cleanUp(v,R,U={}){if(R&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",R)),this.log("_cleanUp :: forced? %s",v),v)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let F=Object.assign({cmd:"disconnect"},U);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(F,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),B(()=>{this.stream.end(()=>{this.log("_cleanUp :: (%s) :: stream destroyed",this.options.clientId)})})})}!this.disconnecting&&!this.reconnecting&&(this.log("_cleanUp :: client not disconnecting/reconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer&&(this.log("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),R&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",R),R())}_storeAndSend(v,R,U){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",v.cmd);let F=v,H;if(F.cmd==="publish"&&(F=(0,u.default)(v),H=this._removeTopicAliasAndRecoverTopicName(F),H))return R&&R(H);this.outgoingStore.put(F,Y=>{if(Y)return R&&R(Y);U(),this._writePacket(v,R)})}_applyTopicAlias(v){if(this.options.protocolVersion===5&&v.cmd==="publish"){let R;v.properties&&(R=v.properties.topicAlias);let U=v.topic.toString();if(this.topicAliasSend)if(R){if(U.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",U,R),!this.topicAliasSend.put(U,R)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",U,R),new Error("Sending Topic Alias out of range")}else U.length!==0&&(this.options.autoAssignTopicAlias?(R=this.topicAliasSend.getAliasByTopic(U),R?(v.topic="",v.properties=Object.assign(Object.assign({},v.properties),{topicAlias:R}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",U,R)):(R=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(U,R),v.properties=Object.assign(Object.assign({},v.properties),{topicAlias:R}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",U,R))):this.options.autoUseTopicAlias&&(R=this.topicAliasSend.getAliasByTopic(U),R&&(v.topic="",v.properties=Object.assign(Object.assign({},v.properties),{topicAlias:R}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",U,R))));else if(R)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",U,R),new Error("Sending Topic Alias out of range")}}_noop(v){this.log("noop ::",v)}_writePacket(v,R){this.log("_writePacket :: packet: %O",v),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",v),this._shiftPingInterval(),this.log("_writePacket :: writing to stream");let U=o.default.writeToStream(v,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",U),!U&&R&&R!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",R)):R&&(this.log("_writePacket :: invoking cb"),R())}_sendPacket(v,R,U,F){this.log("_sendPacket :: (%s) :: start",this.options.clientId),U=U||this.noop,R=R||this.noop;let H=this._applyTopicAlias(v);if(H){R(H);return}if(!this.connected){if(v.cmd==="auth"){this._writePacket(v,R);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(v,R,U);return}if(F){this._writePacket(v,R);return}switch(v.cmd){case"publish":break;case"pubrel":this._storeAndSend(v,R,U);return;default:this._writePacket(v,R);return}switch(v.qos){case 2:case 1:this._storeAndSend(v,R,U);break;case 0:default:this._writePacket(v,R);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(v,R,U){this.log("_storePacket :: packet: %o",v),this.log("_storePacket :: cb? %s",!!R),U=U||this.noop;let F=v;if(F.cmd==="publish"){F=(0,u.default)(v);let Y=this._removeTopicAliasAndRecoverTopicName(F);if(Y)return R&&R(Y)}let H=F.qos||0;H===0&&this.queueQoSZero||F.cmd!=="publish"?this.queue.push({packet:F,cb:R}):H>0?(R=this.outgoing[F.messageId]?this.outgoing[F.messageId].cb:null,this.outgoingStore.put(F,Y=>{if(Y)return R&&R(Y);U()})):R&&R(new Error("No connection to broker"))}_setupPingTimer(){this.log("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive),!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=new T.default(this.options.keepalive,()=>{this._checkPing()}))}_shiftPingInterval(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule()}_checkPing(){this.log("_checkPing :: checking ping..."),this.pingResp?(this.log("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(this.log("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))}_resubscribe(){this.log("_resubscribe");let v=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&v.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let R=0;R{let U=this.outgoingStore.createStream(),F=()=>{U.destroy(),U=null,this._flushStoreProcessingQueue(),H()},H=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",F),U.on("error",ie=>{H(),this._flushStoreProcessingQueue(),this.removeListener("close",F),this.emit("error",ie)});let Y=()=>{if(!U)return;let ie=U.read(1),I;if(!ie){U.once("readable",Y);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[ie.messageId]){Y();return}!this.disconnecting&&!this.reconnectTimer?(I=this.outgoing[ie.messageId]?this.outgoing[ie.messageId].cb:null,this.outgoing[ie.messageId]={volatile:!1,cb(z,ee){I&&I(z,ee),Y()}},this._packetIdsDuringStoreProcessing[ie.messageId]=!0,this.messageIdProvider.register(ie.messageId)?this._sendPacket(ie,void 0,void 0,!0):this.log("messageId: %d has already used.",ie.messageId)):U.destroy&&U.destroy()};U.on("end",()=>{let ie=!0;for(let I in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[I]){ie=!1;break}this.removeListener("close",F),ie?(H(),this._invokeAllStoreProcessingQueue(),this.emit("connect",v)):R()}),Y()};R()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let v=this._storeProcessingQueue[0];if(v&&v.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let v of this._storeProcessingQueue)v.cbStorePut&&v.cbStorePut(new Error("Connection closed")),v.callback&&v.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(v,R){delete this.outgoing[v],this.outgoingStore.del({messageId:v},(U,F)=>{R(U,F),this.messageIdProvider.deallocate(v),this._invokeStoreProcessingQueue()})}};e.default=O}),P0=Ee(e=>{ye(),ve(),be(),Object.defineProperty(e,"__esModule",{value:!0});var t=Cd(),r=class{constructor(){this.numberAllocator=new t.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(n){return this.numberAllocator.use(n)}deallocate(n){this.numberAllocator.free(n)}clear(){this.numberAllocator.clear()}};e.default=r});function Xr(e){throw new RangeError(Pd[e])}function Ec(e,t){let r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);let a=function(i,o){let l=[],s=i.length;for(;s--;)l[s]=o(i[s]);return l}((e=e.replace(Rd,".")).split("."),t).join(".");return n+a}function Sc(e){let t=[],r=0,n=e.length;for(;r=55296&&a<=56319&&r{ye(),ve(),be(),Ac=/^xn--/,Tc=/[^\0-\x7E]/,Rd=/[\x2E\u3002\uFF0E\uFF61]/g,Pd={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ft=Math.floor,Ui=String.fromCharCode,us=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},cs=function(e,t,r){let n=0;for(e=r?Ft(e/700):e>>1,e+=Ft(e/t);e>455;n+=36)e=Ft(e/35);return Ft(n+36*e/(e+38))},fs=function(e){let t=[],r=e.length,n=0,a=128,i=72,o=e.lastIndexOf("-");o<0&&(o=0);for(let s=0;s=128&&Xr("not-basic"),t.push(e.charCodeAt(s));for(let s=o>0?o+1:0;s=r&&Xr("invalid-input");let m=(l=e.charCodeAt(s++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:36;(m>=36||m>Ft((2147483647-n)/f))&&Xr("overflow"),n+=m*f;let y=d<=i?1:d>=i+26?26:d-i;if(mFt(2147483647/b)&&Xr("overflow"),f*=b}let c=t.length+1;i=cs(n-u,c,u==0),Ft(n/c)>2147483647-a&&Xr("overflow"),a+=Ft(n/c),n%=c,t.splice(n++,0,a)}var l;return String.fromCodePoint(...t)},hs=function(e){let t=[],r=(e=Sc(e)).length,n=128,a=0,i=72;for(let s of e)s<128&&t.push(Ui(s));let o=t.length,l=o;for(o&&t.push("-");l=n&&cFt((2147483647-a)/u)&&Xr("overflow"),a+=(s-n)*u,n=s;for(let c of e)if(c2147483647&&Xr("overflow"),c==n){let f=a;for(let d=36;;d+=36){let m=d<=i?1:d>=i+26?26:d-i;if(fString.fromCodePoint(...e)},decode:fs,encode:hs,toASCII:function(e){return Ec(e,function(t){return Tc.test(t)?"xn--"+hs(t):t})},toUnicode:function(e){return Ec(e,function(t){return Ac.test(t)?fs(t.slice(4).toLowerCase()):t})}},Pr.decode,Pr.encode,Pr.toASCII,Pr.toUnicode,Pr.ucs2,Pr.version});function k0(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ic,Sn,Cc,Gt,B0=lt(()=>{ye(),ve(),be(),Ic=function(e,t,r,n){t=t||"&",r=r||"=";var a={};if(typeof e!="string"||e.length===0)return a;var i=/\+/g;e=e.split(t);var o=1e3;n&&typeof n.maxKeys=="number"&&(o=n.maxKeys);var l=e.length;o>0&&l>o&&(l=o);for(var s=0;s=0?(u=m.substr(0,y),c=m.substr(y+1)):(u=m,c=""),f=decodeURIComponent(u),d=decodeURIComponent(c),k0(a,f)?Array.isArray(a[f])?a[f].push(d):a[f]=[a[f],d]:a[f]=d}return a},Sn=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},Cc=function(e,t,r,n){return t=t||"&",r=r||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(a){var i=encodeURIComponent(Sn(a))+r;return Array.isArray(e[a])?e[a].map(function(o){return i+encodeURIComponent(Sn(o))}).join(t):i+encodeURIComponent(Sn(e[a]))}).join(t):n?encodeURIComponent(Sn(n))+r+encodeURIComponent(Sn(e)):""},Gt={},Gt.decode=Gt.parse=Ic,Gt.encode=Gt.stringify=Cc,Gt.decode,Gt.encode,Gt.parse,Gt.stringify});function Ja(){throw new Error("setTimeout has not been defined")}function Xa(){throw new Error("clearTimeout has not been defined")}function xd(e){if(ar===setTimeout)return setTimeout(e,0);if((ar===Ja||!ar)&&setTimeout)return ar=setTimeout,setTimeout(e,0);try{return ar(e,0)}catch{try{return ar.call(null,e,0)}catch{return ar.call(this||fn,e,0)}}}function M0(){hn&&an&&(hn=!1,an.length?Xt=an.concat(Xt):fi=-1,Xt.length&&kd())}function kd(){if(!hn){var e=xd(M0);hn=!0;for(var t=Xt.length;t;){for(an=Xt,Xt=[];++fi{ye(),ve(),be(),fn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:ro,Ye=Rc={},function(){try{ar=typeof setTimeout=="function"?setTimeout:Ja}catch{ar=Ja}try{lr=typeof clearTimeout=="function"?clearTimeout:Xa}catch{lr=Xa}}(),Xt=[],hn=!1,fi=-1,Ye.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r1)for(var B=1;B{ye(),ve(),be(),Xi={},Za=!1,en=typeof globalThis<"u"?globalThis:typeof self<"u"?self:ro,He=N0(),He.platform="browser",He.addListener,He.argv,He.binding,He.browser,He.chdir,He.cwd,He.emit,He.env,He.listeners,He.nextTick,He.off,He.on,He.once,He.prependListener,He.prependOnceListener,He.removeAllListeners,He.removeListener,He.title,He.umask,He.version,He.versions});function j0(){if(el)return Zi;el=!0;var e=He;function t(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function r(i,o){for(var l="",s=0,u=-1,c=0,f,d=0;d<=i.length;++d){if(d2){var m=l.lastIndexOf("/");if(m!==l.length-1){m===-1?(l="",s=0):(l=l.slice(0,m),s=l.length-1-l.lastIndexOf("/")),u=d,c=0;continue}}else if(l.length===2||l.length===1){l="",s=0,u=d,c=0;continue}}o&&(l.length>0?l+="/..":l="..",s=2)}else l.length>0?l+="/"+i.slice(u+1,d):l=i.slice(u+1,d),s=d-u-1;u=d,c=0}else f===46&&c!==-1?++c:c=-1}return l}function n(i,o){var l=o.dir||o.root,s=o.base||(o.name||"")+(o.ext||"");return l?l===o.root?l+s:l+i+s:s}var a={resolve:function(){for(var i="",o=!1,l,s=arguments.length-1;s>=-1&&!o;s--){var u;s>=0?u=arguments[s]:(l===void 0&&(l=e.cwd()),u=l),t(u),u.length!==0&&(i=u+"/"+i,o=u.charCodeAt(0)===47)}return i=r(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(t(i),i.length===0)return".";var o=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=r(i,!o),i.length===0&&!o&&(i="."),i.length>0&&l&&(i+="/"),o?"/"+i:i},isAbsolute:function(i){return t(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,o=0;o0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":a.normalize(i)},relative:function(i,o){if(t(i),t(o),i===o||(i=a.resolve(i),o=a.resolve(o),i===o))return"";for(var l=1;lm){if(o.charCodeAt(c+b)===47)return o.slice(c+b+1);if(b===0)return o.slice(c+b)}else u>m&&(i.charCodeAt(l+b)===47?y=b:b===0&&(y=0));break}var T=i.charCodeAt(l+b),B=o.charCodeAt(c+b);if(T!==B)break;T===47&&(y=b)}var C="";for(b=l+y+1;b<=s;++b)(b===s||i.charCodeAt(b)===47)&&(C.length===0?C+="..":C+="/..");return C.length>0?C+o.slice(c+y):(c+=y,o.charCodeAt(c)===47&&++c,o.slice(c))},_makeLong:function(i){return i},dirname:function(i){if(t(i),i.length===0)return".";for(var o=i.charCodeAt(0),l=o===47,s=-1,u=!0,c=i.length-1;c>=1;--c)if(o=i.charCodeAt(c),o===47){if(!u){s=c;break}}else u=!1;return s===-1?l?"/":".":l&&s===1?"//":i.slice(0,s)},basename:function(i,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');t(i);var l=0,s=-1,u=!0,c;if(o!==void 0&&o.length>0&&o.length<=i.length){if(o.length===i.length&&o===i)return"";var f=o.length-1,d=-1;for(c=i.length-1;c>=0;--c){var m=i.charCodeAt(c);if(m===47){if(!u){l=c+1;break}}else d===-1&&(u=!1,d=c+1),f>=0&&(m===o.charCodeAt(f)?--f===-1&&(s=c):(f=-1,s=d))}return l===s?s=d:s===-1&&(s=i.length),i.slice(l,s)}else{for(c=i.length-1;c>=0;--c)if(i.charCodeAt(c)===47){if(!u){l=c+1;break}}else s===-1&&(u=!1,s=c+1);return s===-1?"":i.slice(l,s)}},extname:function(i){t(i);for(var o=-1,l=0,s=-1,u=!0,c=0,f=i.length-1;f>=0;--f){var d=i.charCodeAt(f);if(d===47){if(!u){l=f+1;break}continue}s===-1&&(u=!1,s=f+1),d===46?o===-1?o=f:c!==1&&(c=1):o!==-1&&(c=-1)}return o===-1||s===-1||c===0||c===1&&o===s-1&&o===l+1?"":i.slice(o,s)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return n("/",i)},parse:function(i){t(i);var o={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return o;var l=i.charCodeAt(0),s=l===47,u;s?(o.root="/",u=1):u=0;for(var c=-1,f=0,d=-1,m=!0,y=i.length-1,b=0;y>=u;--y){if(l=i.charCodeAt(y),l===47){if(!m){f=y+1;break}continue}d===-1&&(m=!1,d=y+1),l===46?c===-1?c=y:b!==1&&(b=1):c!==-1&&(b=-1)}return c===-1||d===-1||b===0||b===1&&c===d-1&&c===f+1?d!==-1&&(f===0&&s?o.base=o.name=i.slice(1,d):o.base=o.name=i.slice(f,d)):(f===0&&s?(o.name=i.slice(1,c),o.base=i.slice(1,d)):(o.name=i.slice(f,c),o.base=i.slice(f,d)),o.ext=i.slice(c,d)),f>0?o.dir=i.slice(0,f-1):s&&(o.dir="/"),o},sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,Zi=a,Zi}var Zi,el,tl,U0=lt(()=>{ye(),ve(),be(),Bd(),Zi={},el=!1,tl=j0()}),Md={};bn(Md,{URL:()=>Xd,Url:()=>Kd,default:()=>Ne,fileURLToPath:()=>Ld,format:()=>Gd,parse:()=>Jd,pathToFileURL:()=>Nd,resolve:()=>Yd,resolveObject:()=>Qd});function Pt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function Yn(e,t,r){if(e&&Wt.isObject(e)&&e instanceof Pt)return e;var n=new Pt;return n.parse(e,t,r),n}function D0(){if(rl)return eo;rl=!0;var e=ze;function t(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function r(i,o){for(var l="",s=0,u=-1,c=0,f,d=0;d<=i.length;++d){if(d2){var m=l.lastIndexOf("/");if(m!==l.length-1){m===-1?(l="",s=0):(l=l.slice(0,m),s=l.length-1-l.lastIndexOf("/")),u=d,c=0;continue}}else if(l.length===2||l.length===1){l="",s=0,u=d,c=0;continue}}o&&(l.length>0?l+="/..":l="..",s=2)}else l.length>0?l+="/"+i.slice(u+1,d):l=i.slice(u+1,d),s=d-u-1;u=d,c=0}else f===46&&c!==-1?++c:c=-1}return l}function n(i,o){var l=o.dir||o.root,s=o.base||(o.name||"")+(o.ext||"");return l?l===o.root?l+s:l+i+s:s}var a={resolve:function(){for(var i="",o=!1,l,s=arguments.length-1;s>=-1&&!o;s--){var u;s>=0?u=arguments[s]:(l===void 0&&(l=e.cwd()),u=l),t(u),u.length!==0&&(i=u+"/"+i,o=u.charCodeAt(0)===47)}return i=r(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(t(i),i.length===0)return".";var o=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=r(i,!o),i.length===0&&!o&&(i="."),i.length>0&&l&&(i+="/"),o?"/"+i:i},isAbsolute:function(i){return t(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,o=0;o0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":a.normalize(i)},relative:function(i,o){if(t(i),t(o),i===o||(i=a.resolve(i),o=a.resolve(o),i===o))return"";for(var l=1;lm){if(o.charCodeAt(c+b)===47)return o.slice(c+b+1);if(b===0)return o.slice(c+b)}else u>m&&(i.charCodeAt(l+b)===47?y=b:b===0&&(y=0));break}var T=i.charCodeAt(l+b),B=o.charCodeAt(c+b);if(T!==B)break;T===47&&(y=b)}var C="";for(b=l+y+1;b<=s;++b)(b===s||i.charCodeAt(b)===47)&&(C.length===0?C+="..":C+="/..");return C.length>0?C+o.slice(c+y):(c+=y,o.charCodeAt(c)===47&&++c,o.slice(c))},_makeLong:function(i){return i},dirname:function(i){if(t(i),i.length===0)return".";for(var o=i.charCodeAt(0),l=o===47,s=-1,u=!0,c=i.length-1;c>=1;--c)if(o=i.charCodeAt(c),o===47){if(!u){s=c;break}}else u=!1;return s===-1?l?"/":".":l&&s===1?"//":i.slice(0,s)},basename:function(i,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');t(i);var l=0,s=-1,u=!0,c;if(o!==void 0&&o.length>0&&o.length<=i.length){if(o.length===i.length&&o===i)return"";var f=o.length-1,d=-1;for(c=i.length-1;c>=0;--c){var m=i.charCodeAt(c);if(m===47){if(!u){l=c+1;break}}else d===-1&&(u=!1,d=c+1),f>=0&&(m===o.charCodeAt(f)?--f===-1&&(s=c):(f=-1,s=d))}return l===s?s=d:s===-1&&(s=i.length),i.slice(l,s)}else{for(c=i.length-1;c>=0;--c)if(i.charCodeAt(c)===47){if(!u){l=c+1;break}}else s===-1&&(u=!1,s=c+1);return s===-1?"":i.slice(l,s)}},extname:function(i){t(i);for(var o=-1,l=0,s=-1,u=!0,c=0,f=i.length-1;f>=0;--f){var d=i.charCodeAt(f);if(d===47){if(!u){l=f+1;break}continue}s===-1&&(u=!1,s=f+1),d===46?o===-1?o=f:c!==1&&(c=1):o!==-1&&(c=-1)}return o===-1||s===-1||c===0||c===1&&o===s-1&&o===l+1?"":i.slice(o,s)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return n("/",i)},parse:function(i){t(i);var o={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return o;var l=i.charCodeAt(0),s=l===47,u;s?(o.root="/",u=1):u=0;for(var c=-1,f=0,d=-1,m=!0,y=i.length-1,b=0;y>=u;--y){if(l=i.charCodeAt(y),l===47){if(!m){f=y+1;break}continue}d===-1&&(m=!1,d=y+1),l===46?c===-1?c=y:b!==1&&(b=1):c!==-1&&(b=-1)}return c===-1||d===-1||b===0||b===1&&c===d-1&&c===f+1?d!==-1&&(f===0&&s?o.base=o.name=i.slice(1,d):o.base=o.name=i.slice(f,d)):(f===0&&s?(o.name=i.slice(1,c),o.base=i.slice(1,d)):(o.name=i.slice(f,c),o.base=i.slice(f,d)),o.ext=i.slice(c,d)),f>0?o.dir=i.slice(0,f-1):s&&(o.dir="/"),o},sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,eo=a,eo}function F0(e){if(typeof e=="string")e=new URL(e);else if(!(e instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(e.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return po?$0(e):W0(e)}function $0(e){let t=e.hostname,r=e.pathname;for(let n=0;nFd||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function W0(e){if(e.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let t=e.pathname;for(let r=0;rrp||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function q0(e){if(e.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let t=e.pathname;for(let r=0;r{ye(),ve(),be(),x0(),B0(),L0(),U0(),Bd(),Ne={},Pc=Pr,Wt={isString:function(e){return typeof e=="string"},isObject:function(e){return typeof e=="object"&&e!==null},isNull:function(e){return e===null},isNullOrUndefined:function(e){return e==null}},Ne.parse=Yn,Ne.resolve=function(e,t){return Yn(e,!1,!0).resolve(t)},Ne.resolveObject=function(e,t){return e?Yn(e,!1,!0).resolveObject(t):t},Ne.format=function(e){return Wt.isString(e)&&(e=Yn(e)),e instanceof Pt?e.format():Pt.prototype.format.call(e)},Ne.Url=Pt,xc=/^([a-z0-9.+-]+:)/i,kc=/:[0-9]*$/,Bc=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Mc=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
-`," "]),Di=["'"].concat(Mc),ds=["%","/","?",";","#"].concat(Di),ps=["/","?","#"],gs=/^[+a-z0-9A-Z_-]{0,63}$/,Lc=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Nc={javascript:!0,"javascript:":!0},Fi={javascript:!0,"javascript:":!0},Zr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},$i=Gt,Pt.prototype.parse=function(e,t,r){if(!Wt.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),a=n!==-1&&n