@aikaara/chat-sdk 0.2.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/headless.cjs CHANGED
@@ -1,8 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const lt=require("./AikaaraChatClient-ChZ2bL9f.cjs");class Na extends lt.EventEmitter{registration=null;pendingEdits=[];constructor(u){super(),this.setupListeners(u)}registerForm(u){this.registration=u;const o=this.pendingEdits.filter(s=>s.entity_type===u.entityType&&String(s.entity_id)===String(u.entityId));if(o.length>0){for(const s of o)u.onFieldUpdate(s.fields),this.emit("edit:applied",{entityType:s.entity_type,entityId:s.entity_id,fields:s.fields});this.pendingEdits=this.pendingEdits.filter(s=>!(s.entity_type===u.entityType&&String(s.entity_id)===String(u.entityId)))}}unregisterForm(u,o){this.registration?.entityType===u&&String(this.registration?.entityId)===String(o)&&(this.registration=null)}get currentForm(){return this.registration}pushFieldUpdates(u,o,s){this.registration&&this.registration.entityType===u&&String(this.registration.entityId)===String(o)?(this.registration.onFieldUpdate(s),this.emit("edit:applied",{entityType:u,entityId:o,fields:s})):(this.pendingEdits.push({action:"edit_entity",entity_type:u,entity_id:o,fields:s}),this.emit("edit:pending",{entityType:u,entityId:o,fields:s}))}async requestSave(){if(!this.registration)return{success:!1,error:"No form registered"};try{return await this.registration.onSave(),this.emit("save:success",{entityType:this.registration.entityType,entityId:this.registration.entityId}),{success:!0}}catch(u){const o=u instanceof Error?u.message:"Save failed";return this.emit("save:error",{entityType:this.registration.entityType,entityId:this.registration.entityId,error:o}),{success:!1,error:o}}}async requestTest(u){if(!this.registration?.onTest)return{success:!1,error:"Current form does not support testing"};try{return await this.registration.onTest(u),{success:!0}}catch(o){return{success:!1,error:o instanceof Error?o.message:"Test failed"}}}setupListeners(u){u.on("action:edit_entity",o=>{this.pushFieldUpdates(o.entity_type,o.entity_id,o.fields)}),u.on("action:save_entity",o=>{this.requestSave()}),u.on("action:test_tool",o=>{this.emit("test:triggered",{toolId:o.tool_id,parameters:o.parameters}),this.requestTest(o.parameters)})}}var ji=Object.defineProperty,Ba=Object.getOwnPropertyDescriptor,Ua=Object.getOwnPropertyNames,La=Object.prototype.hasOwnProperty,He=(g,u)=>()=>(g&&(u=g(g=0)),u),de=(g,u)=>()=>(u||g((u={exports:{}}).exports,u),u.exports),Mt=(g,u)=>{for(var o in u)ji(g,o,{get:u[o],enumerable:!0})},Fa=(g,u,o,s)=>{if(u&&typeof u=="object"||typeof u=="function")for(let f of Ua(u))!La.call(g,f)&&f!==o&&ji(g,f,{get:()=>u[f],enumerable:!(s=Ba(u,f))||s.enumerable});return g},Pe=g=>Fa(ji({},"__esModule",{value:!0}),g),le=He(()=>{}),Re={};Mt(Re,{_debugEnd:()=>yn,_debugProcess:()=>gn,_events:()=>Rn,_eventsCount:()=>Cn,_exiting:()=>en,_fatalExceptions:()=>hn,_getActiveHandles:()=>cs,_getActiveRequests:()=>us,_kill:()=>nn,_linkedBinding:()=>as,_maxListeners:()=>Pn,_preload_modules:()=>kn,_rawDebug:()=>Jr,_startProfilerIdleNotifier:()=>bn,_stopProfilerIdleNotifier:()=>mn,_tickCallback:()=>dn,abort:()=>Sn,addListener:()=>Mn,allowedNodeEnvironmentFlags:()=>cn,arch:()=>Ur,argv:()=>Dr,argv0:()=>Tn,assert:()=>fs,binding:()=>zr,browser:()=>Yr,chdir:()=>Gr,config:()=>tn,cpuUsage:()=>Wt,cwd:()=>Kr,debugPort:()=>xn,default:()=>Bi,dlopen:()=>ls,domain:()=>Zr,emit:()=>Ln,emitWarning:()=>Hr,env:()=>Fr,execArgv:()=>Wr,execPath:()=>In,exit:()=>ln,features:()=>fn,hasUncaughtExceptionCaptureCallback:()=>hs,hrtime:()=>er,kill:()=>an,listeners:()=>ds,memoryUsage:()=>sn,moduleLoadList:()=>Xr,nextTick:()=>os,off:()=>Nn,on:()=>rt,once:()=>jn,openStdin:()=>un,pid:()=>En,platform:()=>Lr,ppid:()=>An,prependListener:()=>Fn,prependOnceListener:()=>Dn,reallyExit:()=>rn,release:()=>Qr,removeAllListeners:()=>Un,removeListener:()=>Bn,resourceUsage:()=>on,setSourceMapsEnabled:()=>On,setUncaughtExceptionCaptureCallback:()=>pn,stderr:()=>wn,stdin:()=>_n,stdout:()=>vn,title:()=>Br,umask:()=>Vr,uptime:()=>ps,version:()=>qr,versions:()=>$r});function Ni(g){throw new Error("Node.js process "+g+" is not supported by JSPM core outside of Node.js")}function Da(){!Et||!_t||(Et=!1,_t.length?Ze=_t.concat(Ze):zt=-1,Ze.length&&is())}function is(){if(!Et){var g=setTimeout(Da,0);Et=!0;for(var u=Ze.length;u;){for(_t=Ze,Ze=[];++zt<u;)_t&&_t[zt].run();zt=-1,u=Ze.length}_t=null,Et=!1,clearTimeout(g)}}function os(g){var u=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)u[o-1]=arguments[o];Ze.push(new ss(g,u)),Ze.length===1&&!Et&&setTimeout(is,0)}function ss(g,u){this.fun=g,this.array=u}function Le(){}function as(g){Ni("_linkedBinding")}function ls(g){Ni("dlopen")}function us(){return[]}function cs(){return[]}function fs(g,u){if(!g)throw new Error(u||"assertion error")}function hs(){return!1}function ps(){return it.now()/1e3}function er(g){var u=Math.floor((Date.now()-it.now())*.001),o=it.now()*.001,s=Math.floor(o)+u,f=Math.floor(o%1*1e9);return g&&(s=s-g[0],f=f-g[1],f<0&&(s--,f+=tr)),[s,f]}function rt(){return Bi}function ds(g){return[]}var Ze,Et,_t,zt,Br,Ur,Lr,Fr,Dr,Wr,qr,$r,Hr,zr,Vr,Kr,Gr,Qr,Yr,Jr,Xr,Zr,en,tn,rn,nn,Wt,on,sn,an,ln,un,cn,fn,hn,pn,dn,gn,yn,bn,mn,vn,wn,_n,Sn,En,An,In,xn,Tn,kn,On,it,Mr,tr,Pn,Rn,Cn,Mn,jn,Nn,Bn,Un,Ln,Fn,Dn,Bi,Wa=He(()=>{le(),ce(),ue(),Ze=[],Et=!1,zt=-1,ss.prototype.run=function(){this.fun.apply(null,this.array)},Br="browser",Ur="x64",Lr="browser",Fr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Dr=["/usr/bin/node"],Wr=[],qr="v16.8.0",$r={},Hr=function(g,u){console.warn((u?u+": ":"")+g)},zr=function(g){Ni("binding")},Vr=function(g){return 0},Kr=function(){return"/"},Gr=function(g){},Qr={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},Yr=!0,Jr=Le,Xr=[],Zr={},en=!1,tn={},rn=Le,nn=Le,Wt=function(){return{}},on=Wt,sn=Wt,an=Le,ln=Le,un=Le,cn={},fn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},hn=Le,pn=Le,dn=Le,gn=Le,yn=Le,bn=Le,mn=Le,vn=void 0,wn=void 0,_n=void 0,Sn=Le,En=2,An=1,In="/bin/usr/node",xn=9229,Tn="node",kn=[],On=Le,it={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},it.now===void 0&&(Mr=Date.now(),it.timing&&it.timing.navigationStart&&(Mr=it.timing.navigationStart),it.now=()=>Date.now()-Mr),tr=1e9,er.bigint=function(g){var u=er(g);return typeof BigInt>"u"?u[0]*tr+u[1]:BigInt(u[0]*tr)+BigInt(u[1])},Pn=10,Rn={},Cn=0,Mn=rt,jn=rt,Nn=rt,Bn=rt,Un=rt,Ln=Le,Fn=rt,Dn=rt,Bi={version:qr,versions:$r,arch:Ur,platform:Lr,browser:Yr,release:Qr,_rawDebug:Jr,moduleLoadList:Xr,binding:zr,_linkedBinding:as,_events:Rn,_eventsCount:Cn,_maxListeners:Pn,on:rt,addListener:Mn,once:jn,off:Nn,removeListener:Bn,removeAllListeners:Un,emit:Ln,prependListener:Fn,prependOnceListener:Dn,listeners:ds,domain:Zr,_exiting:en,config:tn,dlopen:ls,uptime:ps,_getActiveRequests:us,_getActiveHandles:cs,reallyExit:rn,_kill:nn,cpuUsage:Wt,resourceUsage:on,memoryUsage:sn,kill:an,exit:ln,openStdin:un,allowedNodeEnvironmentFlags:cn,assert:fs,features:fn,_fatalExceptions:hn,setUncaughtExceptionCaptureCallback:pn,hasUncaughtExceptionCaptureCallback:hs,emitWarning:Hr,nextTick:os,_tickCallback:dn,_debugProcess:gn,_debugEnd:yn,_startProfilerIdleNotifier:bn,_stopProfilerIdleNotifier:mn,stdout:vn,stdin:_n,stderr:wn,abort:Sn,umask:Vr,chdir:Gr,cwd:Kr,env:Fr,title:Br,argv:Dr,execArgv:Wr,pid:En,ppid:An,execPath:In,debugPort:xn,hrtime:er,argv0:Tn,_preload_modules:kn,setSourceMapsEnabled:On}}),ue=He(()=>{Wa()});function qa(){if(Wn)return Pt;Wn=!0,Pt.byteLength=n,Pt.toByteArray=i,Pt.fromByteArray=p;for(var g=[],u=[],o=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,r=s.length;f<r;++f)g[f]=s[f],u[s.charCodeAt(f)]=f;u[45]=62,u[95]=63;function t(m){var c=m.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var y=m.indexOf("=");y===-1&&(y=c);var b=y===c?0:4-y%4;return[y,b]}function n(m){var c=t(m),y=c[0],b=c[1];return(y+b)*3/4-b}function e(m,c,y){return(c+y)*3/4-y}function i(m){var c,y=t(m),b=y[0],S=y[1],h=new o(e(m,b,S)),_=0,I=S>0?b-4:b,v;for(v=0;v<I;v+=4)c=u[m.charCodeAt(v)]<<18|u[m.charCodeAt(v+1)]<<12|u[m.charCodeAt(v+2)]<<6|u[m.charCodeAt(v+3)],h[_++]=c>>16&255,h[_++]=c>>8&255,h[_++]=c&255;return S===2&&(c=u[m.charCodeAt(v)]<<2|u[m.charCodeAt(v+1)]>>4,h[_++]=c&255),S===1&&(c=u[m.charCodeAt(v)]<<10|u[m.charCodeAt(v+1)]<<4|u[m.charCodeAt(v+2)]>>2,h[_++]=c>>8&255,h[_++]=c&255),h}function a(m){return g[m>>18&63]+g[m>>12&63]+g[m>>6&63]+g[m&63]}function d(m,c,y){for(var b,S=[],h=c;h<y;h+=3)b=(m[h]<<16&16711680)+(m[h+1]<<8&65280)+(m[h+2]&255),S.push(a(b));return S.join("")}function p(m){for(var c,y=m.length,b=y%3,S=[],h=16383,_=0,I=y-b;_<I;_+=h)S.push(d(m,_,_+h>I?I:_+h));return b===1?(c=m[y-1],S.push(g[c>>2]+g[c<<4&63]+"==")):b===2&&(c=(m[y-2]<<8)+m[y-1],S.push(g[c>>10]+g[c>>4&63]+g[c<<2&63]+"=")),S.join("")}return Pt}function $a(){return qn?qt:(qn=!0,qt.read=function(g,u,o,s,f){var r,t,n=f*8-s-1,e=(1<<n)-1,i=e>>1,a=-7,d=o?f-1:0,p=o?-1:1,m=g[u+d];for(d+=p,r=m&(1<<-a)-1,m>>=-a,a+=n;a>0;r=r*256+g[u+d],d+=p,a-=8);for(t=r&(1<<-a)-1,r>>=-a,a+=s;a>0;t=t*256+g[u+d],d+=p,a-=8);if(r===0)r=1-i;else{if(r===e)return t?NaN:(m?-1:1)*(1/0);t=t+Math.pow(2,s),r=r-i}return(m?-1:1)*t*Math.pow(2,r-s)},qt.write=function(g,u,o,s,f,r){var t,n,e,i=r*8-f-1,a=(1<<i)-1,d=a>>1,p=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=s?0:r-1,c=s?1:-1,y=u<0||u===0&&1/u<0?1:0;for(u=Math.abs(u),isNaN(u)||u===1/0?(n=isNaN(u)?1:0,t=a):(t=Math.floor(Math.log(u)/Math.LN2),u*(e=Math.pow(2,-t))<1&&(t--,e*=2),t+d>=1?u+=p/e:u+=p*Math.pow(2,1-d),u*e>=2&&(t++,e/=2),t+d>=a?(n=0,t=a):t+d>=1?(n=(u*e-1)*Math.pow(2,f),t=t+d):(n=u*Math.pow(2,d-1)*Math.pow(2,f),t=0));f>=8;g[o+m]=n&255,m+=c,n/=256,f-=8);for(t=t<<f|n,i+=f;i>0;g[o+m]=t&255,m+=c,t/=256,i-=8);g[o+m-c]|=y*128},qt)}function Ha(){if($n)return dt;$n=!0;let g=qa(),u=$a(),o=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;dt.Buffer=t,dt.SlowBuffer=S,dt.INSPECT_MAX_BYTES=50;let s=2147483647;dt.kMaxLength=s,t.TYPED_ARRAY_SUPPORT=f(),!t.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function f(){try{let l=new Uint8Array(1),w={foo:function(){return 42}};return Object.setPrototypeOf(w,Uint8Array.prototype),Object.setPrototypeOf(l,w),l.foo()===42}catch{return!1}}Object.defineProperty(t.prototype,"parent",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.buffer}}),Object.defineProperty(t.prototype,"offset",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.byteOffset}});function r(l){if(l>s)throw new RangeError('The value "'+l+'" is invalid for option "size"');let w=new Uint8Array(l);return Object.setPrototypeOf(w,t.prototype),w}function t(l,w,x){if(typeof l=="number"){if(typeof w=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return a(l)}return n(l,w,x)}t.poolSize=8192;function n(l,w,x){if(typeof l=="string")return d(l,w);if(ArrayBuffer.isView(l))return m(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if($(l,ArrayBuffer)||l&&$(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($(l,SharedArrayBuffer)||l&&$(l.buffer,SharedArrayBuffer)))return c(l,w,x);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let U=l.valueOf&&l.valueOf();if(U!=null&&U!==l)return t.from(U,w,x);let X=y(l);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return t.from(l[Symbol.toPrimitive]("string"),w,x);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}t.from=function(l,w,x){return n(l,w,x)},Object.setPrototypeOf(t.prototype,Uint8Array.prototype),Object.setPrototypeOf(t,Uint8Array);function e(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function i(l,w,x){return e(l),l<=0?r(l):w!==void 0?typeof x=="string"?r(l).fill(w,x):r(l).fill(w):r(l)}t.alloc=function(l,w,x){return i(l,w,x)};function a(l){return e(l),r(l<0?0:b(l)|0)}t.allocUnsafe=function(l){return a(l)},t.allocUnsafeSlow=function(l){return a(l)};function d(l,w){if((typeof w!="string"||w==="")&&(w="utf8"),!t.isEncoding(w))throw new TypeError("Unknown encoding: "+w);let x=h(l,w)|0,U=r(x),X=U.write(l,w);return X!==x&&(U=U.slice(0,X)),U}function p(l){let w=l.length<0?0:b(l.length)|0,x=r(w);for(let U=0;U<w;U+=1)x[U]=l[U]&255;return x}function m(l){if($(l,Uint8Array)){let w=new Uint8Array(l);return c(w.buffer,w.byteOffset,w.byteLength)}return p(l)}function c(l,w,x){if(w<0||l.byteLength<w)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<w+(x||0))throw new RangeError('"length" is outside of buffer bounds');let U;return w===void 0&&x===void 0?U=new Uint8Array(l):x===void 0?U=new Uint8Array(l,w):U=new Uint8Array(l,w,x),Object.setPrototypeOf(U,t.prototype),U}function y(l){if(t.isBuffer(l)){let w=b(l.length)|0,x=r(w);return x.length===0||l.copy(x,0,0,w),x}if(l.length!==void 0)return typeof l.length!="number"||ge(l.length)?r(0):p(l);if(l.type==="Buffer"&&Array.isArray(l.data))return p(l.data)}function b(l){if(l>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return l|0}function S(l){return+l!=l&&(l=0),t.alloc(+l)}t.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==t.prototype},t.compare=function(l,w){if($(l,Uint8Array)&&(l=t.from(l,l.offset,l.byteLength)),$(w,Uint8Array)&&(w=t.from(w,w.offset,w.byteLength)),!t.isBuffer(l)||!t.isBuffer(w))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===w)return 0;let x=l.length,U=w.length;for(let X=0,fe=Math.min(x,U);X<fe;++X)if(l[X]!==w[X]){x=l[X],U=w[X];break}return x<U?-1:U<x?1:0},t.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(l,w){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return t.alloc(0);let x;if(w===void 0)for(w=0,x=0;x<l.length;++x)w+=l[x].length;let U=t.allocUnsafe(w),X=0;for(x=0;x<l.length;++x){let fe=l[x];if($(fe,Uint8Array))X+fe.length>U.length?(t.isBuffer(fe)||(fe=t.from(fe)),fe.copy(U,X)):Uint8Array.prototype.set.call(U,fe,X);else if(t.isBuffer(fe))fe.copy(U,X);else throw new TypeError('"list" argument must be an Array of Buffers');X+=fe.length}return U};function h(l,w){if(t.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||$(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let x=l.length,U=arguments.length>2&&arguments[2]===!0;if(!U&&x===0)return 0;let X=!1;for(;;)switch(w){case"ascii":case"latin1":case"binary":return x;case"utf8":case"utf-8":return W(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x*2;case"hex":return x>>>1;case"base64":return pe(l).length;default:if(X)return U?-1:W(l).length;w=(""+w).toLowerCase(),X=!0}}t.byteLength=h;function _(l,w,x){let U=!1;if((w===void 0||w<0)&&(w=0),w>this.length||((x===void 0||x>this.length)&&(x=this.length),x<=0)||(x>>>=0,w>>>=0,x<=w))return"";for(l||(l="utf8");;)switch(l){case"hex":return V(this,w,x);case"utf8":case"utf-8":return q(this,w,x);case"ascii":return ae(this,w,x);case"latin1":case"binary":return Q(this,w,x);case"base64":return k(this,w,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return re(this,w,x);default:if(U)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),U=!0}}t.prototype._isBuffer=!0;function I(l,w,x){let U=l[w];l[w]=l[x],l[x]=U}t.prototype.swap16=function(){let l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let w=0;w<l;w+=2)I(this,w,w+1);return this},t.prototype.swap32=function(){let l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let w=0;w<l;w+=4)I(this,w,w+3),I(this,w+1,w+2);return this},t.prototype.swap64=function(){let l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let w=0;w<l;w+=8)I(this,w,w+7),I(this,w+1,w+6),I(this,w+2,w+5),I(this,w+3,w+4);return this},t.prototype.toString=function(){let l=this.length;return l===0?"":arguments.length===0?q(this,0,l):_.apply(this,arguments)},t.prototype.toLocaleString=t.prototype.toString,t.prototype.equals=function(l){if(!t.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:t.compare(this,l)===0},t.prototype.inspect=function(){let l="",w=dt.INSPECT_MAX_BYTES;return l=this.toString("hex",0,w).replace(/(.{2})/g,"$1 ").trim(),this.length>w&&(l+=" ... "),"<Buffer "+l+">"},o&&(t.prototype[o]=t.prototype.inspect),t.prototype.compare=function(l,w,x,U,X){if($(l,Uint8Array)&&(l=t.from(l,l.offset,l.byteLength)),!t.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof l);if(w===void 0&&(w=0),x===void 0&&(x=l?l.length:0),U===void 0&&(U=0),X===void 0&&(X=this.length),w<0||x>l.length||U<0||X>this.length)throw new RangeError("out of range index");if(U>=X&&w>=x)return 0;if(U>=X)return-1;if(w>=x)return 1;if(w>>>=0,x>>>=0,U>>>=0,X>>>=0,this===l)return 0;let fe=X-U,Se=x-w,z=Math.min(fe,Se),ie=this.slice(U,X),Ie=l.slice(w,x);for(let xe=0;xe<z;++xe)if(ie[xe]!==Ie[xe]){fe=ie[xe],Se=Ie[xe];break}return fe<Se?-1:Se<fe?1:0};function v(l,w,x,U,X){if(l.length===0)return-1;if(typeof x=="string"?(U=x,x=0):x>2147483647?x=2147483647:x<-2147483648&&(x=-2147483648),x=+x,ge(x)&&(x=X?0:l.length-1),x<0&&(x=l.length+x),x>=l.length){if(X)return-1;x=l.length-1}else if(x<0)if(X)x=0;else return-1;if(typeof w=="string"&&(w=t.from(w,U)),t.isBuffer(w))return w.length===0?-1:A(l,w,x,U,X);if(typeof w=="number")return w=w&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(l,w,x):Uint8Array.prototype.lastIndexOf.call(l,w,x):A(l,[w],x,U,X);throw new TypeError("val must be string, number or Buffer")}function A(l,w,x,U,X){let fe=1,Se=l.length,z=w.length;if(U!==void 0&&(U=String(U).toLowerCase(),U==="ucs2"||U==="ucs-2"||U==="utf16le"||U==="utf-16le")){if(l.length<2||w.length<2)return-1;fe=2,Se/=2,z/=2,x/=2}function ie(xe,Te){return fe===1?xe[Te]:xe.readUInt16BE(Te*fe)}let Ie;if(X){let xe=-1;for(Ie=x;Ie<Se;Ie++)if(ie(l,Ie)===ie(w,xe===-1?0:Ie-xe)){if(xe===-1&&(xe=Ie),Ie-xe+1===z)return xe*fe}else xe!==-1&&(Ie-=Ie-xe),xe=-1}else for(x+z>Se&&(x=Se-z),Ie=x;Ie>=0;Ie--){let xe=!0;for(let Te=0;Te<z;Te++)if(ie(l,Ie+Te)!==ie(w,Te)){xe=!1;break}if(xe)return Ie}return-1}t.prototype.includes=function(l,w,x){return this.indexOf(l,w,x)!==-1},t.prototype.indexOf=function(l,w,x){return v(this,l,w,x,!0)},t.prototype.lastIndexOf=function(l,w,x){return v(this,l,w,x,!1)};function E(l,w,x,U){x=Number(x)||0;let X=l.length-x;U?(U=Number(U),U>X&&(U=X)):U=X;let fe=w.length;U>fe/2&&(U=fe/2);let Se;for(Se=0;Se<U;++Se){let z=parseInt(w.substr(Se*2,2),16);if(ge(z))return Se;l[x+Se]=z}return Se}function T(l,w,x,U){return me(W(w,l.length-x),l,x,U)}function C(l,w,x,U){return me(ee(w),l,x,U)}function P(l,w,x,U){return me(pe(w),l,x,U)}function L(l,w,x,U){return me(he(w,l.length-x),l,x,U)}t.prototype.write=function(l,w,x,U){if(w===void 0)U="utf8",x=this.length,w=0;else if(x===void 0&&typeof w=="string")U=w,x=this.length,w=0;else if(isFinite(w))w=w>>>0,isFinite(x)?(x=x>>>0,U===void 0&&(U="utf8")):(U=x,x=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let X=this.length-w;if((x===void 0||x>X)&&(x=X),l.length>0&&(x<0||w<0)||w>this.length)throw new RangeError("Attempt to write outside buffer bounds");U||(U="utf8");let fe=!1;for(;;)switch(U){case"hex":return E(this,l,w,x);case"utf8":case"utf-8":return T(this,l,w,x);case"ascii":case"latin1":case"binary":return C(this,l,w,x);case"base64":return P(this,l,w,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,l,w,x);default:if(fe)throw new TypeError("Unknown encoding: "+U);U=(""+U).toLowerCase(),fe=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(l,w,x){return w===0&&x===l.length?g.fromByteArray(l):g.fromByteArray(l.slice(w,x))}function q(l,w,x){x=Math.min(l.length,x);let U=[],X=w;for(;X<x;){let fe=l[X],Se=null,z=fe>239?4:fe>223?3:fe>191?2:1;if(X+z<=x){let ie,Ie,xe,Te;switch(z){case 1:fe<128&&(Se=fe);break;case 2:ie=l[X+1],(ie&192)===128&&(Te=(fe&31)<<6|ie&63,Te>127&&(Se=Te));break;case 3:ie=l[X+1],Ie=l[X+2],(ie&192)===128&&(Ie&192)===128&&(Te=(fe&15)<<12|(ie&63)<<6|Ie&63,Te>2047&&(Te<55296||Te>57343)&&(Se=Te));break;case 4:ie=l[X+1],Ie=l[X+2],xe=l[X+3],(ie&192)===128&&(Ie&192)===128&&(xe&192)===128&&(Te=(fe&15)<<18|(ie&63)<<12|(Ie&63)<<6|xe&63,Te>65535&&Te<1114112&&(Se=Te))}}Se===null?(Se=65533,z=1):Se>65535&&(Se-=65536,U.push(Se>>>10&1023|55296),Se=56320|Se&1023),U.push(Se),X+=z}return B(U)}let F=4096;function B(l){let w=l.length;if(w<=F)return String.fromCharCode.apply(String,l);let x="",U=0;for(;U<w;)x+=String.fromCharCode.apply(String,l.slice(U,U+=F));return x}function ae(l,w,x){let U="";x=Math.min(l.length,x);for(let X=w;X<x;++X)U+=String.fromCharCode(l[X]&127);return U}function Q(l,w,x){let U="";x=Math.min(l.length,x);for(let X=w;X<x;++X)U+=String.fromCharCode(l[X]);return U}function V(l,w,x){let U=l.length;(!w||w<0)&&(w=0),(!x||x<0||x>U)&&(x=U);let X="";for(let fe=w;fe<x;++fe)X+=ve[l[fe]];return X}function re(l,w,x){let U=l.slice(w,x),X="";for(let fe=0;fe<U.length-1;fe+=2)X+=String.fromCharCode(U[fe]+U[fe+1]*256);return X}t.prototype.slice=function(l,w){let x=this.length;l=~~l,w=w===void 0?x:~~w,l<0?(l+=x,l<0&&(l=0)):l>x&&(l=x),w<0?(w+=x,w<0&&(w=0)):w>x&&(w=x),w<l&&(w=l);let U=this.subarray(l,w);return Object.setPrototypeOf(U,t.prototype),U};function D(l,w,x){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+w>x)throw new RangeError("Trying to access beyond buffer length")}t.prototype.readUintLE=t.prototype.readUIntLE=function(l,w,x){l=l>>>0,w=w>>>0,x||D(l,w,this.length);let U=this[l],X=1,fe=0;for(;++fe<w&&(X*=256);)U+=this[l+fe]*X;return U},t.prototype.readUintBE=t.prototype.readUIntBE=function(l,w,x){l=l>>>0,w=w>>>0,x||D(l,w,this.length);let U=this[l+--w],X=1;for(;w>0&&(X*=256);)U+=this[l+--w]*X;return U},t.prototype.readUint8=t.prototype.readUInt8=function(l,w){return l=l>>>0,w||D(l,1,this.length),this[l]},t.prototype.readUint16LE=t.prototype.readUInt16LE=function(l,w){return l=l>>>0,w||D(l,2,this.length),this[l]|this[l+1]<<8},t.prototype.readUint16BE=t.prototype.readUInt16BE=function(l,w){return l=l>>>0,w||D(l,2,this.length),this[l]<<8|this[l+1]},t.prototype.readUint32LE=t.prototype.readUInt32LE=function(l,w){return l=l>>>0,w||D(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},t.prototype.readUint32BE=t.prototype.readUInt32BE=function(l,w){return l=l>>>0,w||D(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},t.prototype.readBigUInt64LE=se(function(l){l=l>>>0,Y(l,"offset");let w=this[l],x=this[l+7];(w===void 0||x===void 0)&&ye(l,this.length-8);let U=w+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24,X=this[++l]+this[++l]*2**8+this[++l]*2**16+x*2**24;return BigInt(U)+(BigInt(X)<<BigInt(32))}),t.prototype.readBigUInt64BE=se(function(l){l=l>>>0,Y(l,"offset");let w=this[l],x=this[l+7];(w===void 0||x===void 0)&&ye(l,this.length-8);let U=w*2**24+this[++l]*2**16+this[++l]*2**8+this[++l],X=this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+x;return(BigInt(U)<<BigInt(32))+BigInt(X)}),t.prototype.readIntLE=function(l,w,x){l=l>>>0,w=w>>>0,x||D(l,w,this.length);let U=this[l],X=1,fe=0;for(;++fe<w&&(X*=256);)U+=this[l+fe]*X;return X*=128,U>=X&&(U-=Math.pow(2,8*w)),U},t.prototype.readIntBE=function(l,w,x){l=l>>>0,w=w>>>0,x||D(l,w,this.length);let U=w,X=1,fe=this[l+--U];for(;U>0&&(X*=256);)fe+=this[l+--U]*X;return X*=128,fe>=X&&(fe-=Math.pow(2,8*w)),fe},t.prototype.readInt8=function(l,w){return l=l>>>0,w||D(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},t.prototype.readInt16LE=function(l,w){l=l>>>0,w||D(l,2,this.length);let x=this[l]|this[l+1]<<8;return x&32768?x|4294901760:x},t.prototype.readInt16BE=function(l,w){l=l>>>0,w||D(l,2,this.length);let x=this[l+1]|this[l]<<8;return x&32768?x|4294901760:x},t.prototype.readInt32LE=function(l,w){return l=l>>>0,w||D(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},t.prototype.readInt32BE=function(l,w){return l=l>>>0,w||D(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},t.prototype.readBigInt64LE=se(function(l){l=l>>>0,Y(l,"offset");let w=this[l],x=this[l+7];(w===void 0||x===void 0)&&ye(l,this.length-8);let U=this[l+4]+this[l+5]*2**8+this[l+6]*2**16+(x<<24);return(BigInt(U)<<BigInt(32))+BigInt(w+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24)}),t.prototype.readBigInt64BE=se(function(l){l=l>>>0,Y(l,"offset");let w=this[l],x=this[l+7];(w===void 0||x===void 0)&&ye(l,this.length-8);let U=(w<<24)+this[++l]*2**16+this[++l]*2**8+this[++l];return(BigInt(U)<<BigInt(32))+BigInt(this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+x)}),t.prototype.readFloatLE=function(l,w){return l=l>>>0,w||D(l,4,this.length),u.read(this,l,!0,23,4)},t.prototype.readFloatBE=function(l,w){return l=l>>>0,w||D(l,4,this.length),u.read(this,l,!1,23,4)},t.prototype.readDoubleLE=function(l,w){return l=l>>>0,w||D(l,8,this.length),u.read(this,l,!0,52,8)},t.prototype.readDoubleBE=function(l,w){return l=l>>>0,w||D(l,8,this.length),u.read(this,l,!1,52,8)};function Z(l,w,x,U,X,fe){if(!t.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(w>X||w<fe)throw new RangeError('"value" argument is out of bounds');if(x+U>l.length)throw new RangeError("Index out of range")}t.prototype.writeUintLE=t.prototype.writeUIntLE=function(l,w,x,U){if(l=+l,w=w>>>0,x=x>>>0,!U){let Se=Math.pow(2,8*x)-1;Z(this,l,w,x,Se,0)}let X=1,fe=0;for(this[w]=l&255;++fe<x&&(X*=256);)this[w+fe]=l/X&255;return w+x},t.prototype.writeUintBE=t.prototype.writeUIntBE=function(l,w,x,U){if(l=+l,w=w>>>0,x=x>>>0,!U){let Se=Math.pow(2,8*x)-1;Z(this,l,w,x,Se,0)}let X=x-1,fe=1;for(this[w+X]=l&255;--X>=0&&(fe*=256);)this[w+X]=l/fe&255;return w+x},t.prototype.writeUint8=t.prototype.writeUInt8=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,1,255,0),this[w]=l&255,w+1},t.prototype.writeUint16LE=t.prototype.writeUInt16LE=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,2,65535,0),this[w]=l&255,this[w+1]=l>>>8,w+2},t.prototype.writeUint16BE=t.prototype.writeUInt16BE=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,2,65535,0),this[w]=l>>>8,this[w+1]=l&255,w+2},t.prototype.writeUint32LE=t.prototype.writeUInt32LE=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,4,4294967295,0),this[w+3]=l>>>24,this[w+2]=l>>>16,this[w+1]=l>>>8,this[w]=l&255,w+4},t.prototype.writeUint32BE=t.prototype.writeUInt32BE=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,4,4294967295,0),this[w]=l>>>24,this[w+1]=l>>>16,this[w+2]=l>>>8,this[w+3]=l&255,w+4};function R(l,w,x,U,X){G(w,U,X,l,x,7);let fe=Number(w&BigInt(4294967295));l[x++]=fe,fe=fe>>8,l[x++]=fe,fe=fe>>8,l[x++]=fe,fe=fe>>8,l[x++]=fe;let Se=Number(w>>BigInt(32)&BigInt(4294967295));return l[x++]=Se,Se=Se>>8,l[x++]=Se,Se=Se>>8,l[x++]=Se,Se=Se>>8,l[x++]=Se,x}function J(l,w,x,U,X){G(w,U,X,l,x,7);let fe=Number(w&BigInt(4294967295));l[x+7]=fe,fe=fe>>8,l[x+6]=fe,fe=fe>>8,l[x+5]=fe,fe=fe>>8,l[x+4]=fe;let Se=Number(w>>BigInt(32)&BigInt(4294967295));return l[x+3]=Se,Se=Se>>8,l[x+2]=Se,Se=Se>>8,l[x+1]=Se,Se=Se>>8,l[x]=Se,x+8}t.prototype.writeBigUInt64LE=se(function(l,w=0){return R(this,l,w,BigInt(0),BigInt("0xffffffffffffffff"))}),t.prototype.writeBigUInt64BE=se(function(l,w=0){return J(this,l,w,BigInt(0),BigInt("0xffffffffffffffff"))}),t.prototype.writeIntLE=function(l,w,x,U){if(l=+l,w=w>>>0,!U){let z=Math.pow(2,8*x-1);Z(this,l,w,x,z-1,-z)}let X=0,fe=1,Se=0;for(this[w]=l&255;++X<x&&(fe*=256);)l<0&&Se===0&&this[w+X-1]!==0&&(Se=1),this[w+X]=(l/fe>>0)-Se&255;return w+x},t.prototype.writeIntBE=function(l,w,x,U){if(l=+l,w=w>>>0,!U){let z=Math.pow(2,8*x-1);Z(this,l,w,x,z-1,-z)}let X=x-1,fe=1,Se=0;for(this[w+X]=l&255;--X>=0&&(fe*=256);)l<0&&Se===0&&this[w+X+1]!==0&&(Se=1),this[w+X]=(l/fe>>0)-Se&255;return w+x},t.prototype.writeInt8=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,1,127,-128),l<0&&(l=255+l+1),this[w]=l&255,w+1},t.prototype.writeInt16LE=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,2,32767,-32768),this[w]=l&255,this[w+1]=l>>>8,w+2},t.prototype.writeInt16BE=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,2,32767,-32768),this[w]=l>>>8,this[w+1]=l&255,w+2},t.prototype.writeInt32LE=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,4,2147483647,-2147483648),this[w]=l&255,this[w+1]=l>>>8,this[w+2]=l>>>16,this[w+3]=l>>>24,w+4},t.prototype.writeInt32BE=function(l,w,x){return l=+l,w=w>>>0,x||Z(this,l,w,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[w]=l>>>24,this[w+1]=l>>>16,this[w+2]=l>>>8,this[w+3]=l&255,w+4},t.prototype.writeBigInt64LE=se(function(l,w=0){return R(this,l,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),t.prototype.writeBigInt64BE=se(function(l,w=0){return J(this,l,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function be(l,w,x,U,X,fe){if(x+U>l.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("Index out of range")}function te(l,w,x,U,X){return w=+w,x=x>>>0,X||be(l,w,x,4),u.write(l,w,x,U,23,4),x+4}t.prototype.writeFloatLE=function(l,w,x){return te(this,l,w,!0,x)},t.prototype.writeFloatBE=function(l,w,x){return te(this,l,w,!1,x)};function we(l,w,x,U,X){return w=+w,x=x>>>0,X||be(l,w,x,8),u.write(l,w,x,U,52,8),x+8}t.prototype.writeDoubleLE=function(l,w,x){return we(this,l,w,!0,x)},t.prototype.writeDoubleBE=function(l,w,x){return we(this,l,w,!1,x)},t.prototype.copy=function(l,w,x,U){if(!t.isBuffer(l))throw new TypeError("argument should be a Buffer");if(x||(x=0),!U&&U!==0&&(U=this.length),w>=l.length&&(w=l.length),w||(w=0),U>0&&U<x&&(U=x),U===x||l.length===0||this.length===0)return 0;if(w<0)throw new RangeError("targetStart out of bounds");if(x<0||x>=this.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("sourceEnd out of bounds");U>this.length&&(U=this.length),l.length-w<U-x&&(U=l.length-w+x);let X=U-x;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(w,x,U):Uint8Array.prototype.set.call(l,this.subarray(x,U),w),X},t.prototype.fill=function(l,w,x,U){if(typeof l=="string"){if(typeof w=="string"?(U=w,w=0,x=this.length):typeof x=="string"&&(U=x,x=this.length),U!==void 0&&typeof U!="string")throw new TypeError("encoding must be a string");if(typeof U=="string"&&!t.isEncoding(U))throw new TypeError("Unknown encoding: "+U);if(l.length===1){let fe=l.charCodeAt(0);(U==="utf8"&&fe<128||U==="latin1")&&(l=fe)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(w<0||this.length<w||this.length<x)throw new RangeError("Out of range index");if(x<=w)return this;w=w>>>0,x=x===void 0?this.length:x>>>0,l||(l=0);let X;if(typeof l=="number")for(X=w;X<x;++X)this[X]=l;else{let fe=t.isBuffer(l)?l:t.from(l,U),Se=fe.length;if(Se===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(X=0;X<x-w;++X)this[X+w]=fe[X%Se]}return this};let K={};function N(l,w,x){K[l]=class extends x{constructor(){super(),Object.defineProperty(this,"message",{value:w.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name}get code(){return l}set code(U){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:U,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}N("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),N("ERR_INVALID_ARG_TYPE",function(l,w){return`The "${l}" argument must be of type number. Received type ${typeof w}`},TypeError),N("ERR_OUT_OF_RANGE",function(l,w,x){let U=`The value of "${l}" is out of range.`,X=x;return Number.isInteger(x)&&Math.abs(x)>2**32?X=ne(String(x)):typeof x=="bigint"&&(X=String(x),(x>BigInt(2)**BigInt(32)||x<-(BigInt(2)**BigInt(32)))&&(X=ne(X)),X+="n"),U+=` It must be ${w}. Received ${X}`,U},RangeError);function ne(l){let w="",x=l.length,U=l[0]==="-"?1:0;for(;x>=U+4;x-=3)w=`_${l.slice(x-3,x)}${w}`;return`${l.slice(0,x)}${w}`}function H(l,w,x){Y(w,"offset"),(l[w]===void 0||l[w+x]===void 0)&&ye(w,l.length-(x+1))}function G(l,w,x,U,X,fe){if(l>x||l<w){let Se=typeof w=="bigint"?"n":"",z;throw w===0||w===BigInt(0)?z=`>= 0${Se} and < 2${Se} ** ${(fe+1)*8}${Se}`:z=`>= -(2${Se} ** ${(fe+1)*8-1}${Se}) and < 2 ** ${(fe+1)*8-1}${Se}`,new K.ERR_OUT_OF_RANGE("value",z,l)}H(U,X,fe)}function Y(l,w){if(typeof l!="number")throw new K.ERR_INVALID_ARG_TYPE(w,"number",l)}function ye(l,w,x){throw Math.floor(l)!==l?(Y(l,x),new K.ERR_OUT_OF_RANGE("offset","an integer",l)):w<0?new K.ERR_BUFFER_OUT_OF_BOUNDS:new K.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${w}`,l)}let oe=/[^+/0-9A-Za-z-_]/g;function M(l){if(l=l.split("=")[0],l=l.trim().replace(oe,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function W(l,w){w=w||1/0;let x,U=l.length,X=null,fe=[];for(let Se=0;Se<U;++Se){if(x=l.charCodeAt(Se),x>55295&&x<57344){if(!X){if(x>56319){(w-=3)>-1&&fe.push(239,191,189);continue}else if(Se+1===U){(w-=3)>-1&&fe.push(239,191,189);continue}X=x;continue}if(x<56320){(w-=3)>-1&&fe.push(239,191,189),X=x;continue}x=(X-55296<<10|x-56320)+65536}else X&&(w-=3)>-1&&fe.push(239,191,189);if(X=null,x<128){if((w-=1)<0)break;fe.push(x)}else if(x<2048){if((w-=2)<0)break;fe.push(x>>6|192,x&63|128)}else if(x<65536){if((w-=3)<0)break;fe.push(x>>12|224,x>>6&63|128,x&63|128)}else if(x<1114112){if((w-=4)<0)break;fe.push(x>>18|240,x>>12&63|128,x>>6&63|128,x&63|128)}else throw new Error("Invalid code point")}return fe}function ee(l){let w=[];for(let x=0;x<l.length;++x)w.push(l.charCodeAt(x)&255);return w}function he(l,w){let x,U,X,fe=[];for(let Se=0;Se<l.length&&!((w-=2)<0);++Se)x=l.charCodeAt(Se),U=x>>8,X=x%256,fe.push(X),fe.push(U);return fe}function pe(l){return g.toByteArray(M(l))}function me(l,w,x,U){let X;for(X=0;X<U&&!(X+x>=w.length||X>=l.length);++X)w[X+x]=l[X];return X}function $(l,w){return l instanceof w||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===w.name}function ge(l){return l!==l}let ve=(function(){let l="0123456789abcdef",w=new Array(256);for(let x=0;x<16;++x){let U=x*16;for(let X=0;X<16;++X)w[U+X]=l[x]+l[X]}return w})();function se(l){return typeof BigInt>"u"?ke:l}function ke(){throw new Error("BigInt not supported")}return dt}var Pt,Wn,qt,qn,dt,$n,za=He(()=>{le(),ce(),ue(),Pt={},Wn=!1,qt={},qn=!1,dt={},$n=!1}),Ne={};Mt(Ne,{Buffer:()=>Ir,INSPECT_MAX_BYTES:()=>gs,default:()=>nt,kMaxLength:()=>ys});var nt,Ir,gs,ys,Be=He(()=>{le(),ce(),ue(),za(),nt=Ha(),nt.Buffer,nt.SlowBuffer,nt.INSPECT_MAX_BYTES,nt.kMaxLength,Ir=nt.Buffer,gs=nt.INSPECT_MAX_BYTES,ys=nt.kMaxLength}),ce=He(()=>{Be()}),Me=de((g,u)=>{le(),ce(),ue();var o=class extends Error{constructor(s){if(!Array.isArray(s))throw new TypeError(`Expected input to be an Array, got ${typeof s}`);let f="";for(let r=0;r<s.length;r++)f+=` ${s[r].stack}
2
- `;super(f),this.name="AggregateError",this.errors=s}};u.exports={AggregateError:o,ArrayIsArray(s){return Array.isArray(s)},ArrayPrototypeIncludes(s,f){return s.includes(f)},ArrayPrototypeIndexOf(s,f){return s.indexOf(f)},ArrayPrototypeJoin(s,f){return s.join(f)},ArrayPrototypeMap(s,f){return s.map(f)},ArrayPrototypePop(s,f){return s.pop(f)},ArrayPrototypePush(s,f){return s.push(f)},ArrayPrototypeSlice(s,f,r){return s.slice(f,r)},Error,FunctionPrototypeCall(s,f,...r){return s.call(f,...r)},FunctionPrototypeSymbolHasInstance(s,f){return Function.prototype[Symbol.hasInstance].call(s,f)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(s,f){return Object.defineProperties(s,f)},ObjectDefineProperty(s,f,r){return Object.defineProperty(s,f,r)},ObjectGetOwnPropertyDescriptor(s,f){return Object.getOwnPropertyDescriptor(s,f)},ObjectKeys(s){return Object.keys(s)},ObjectSetPrototypeOf(s,f){return Object.setPrototypeOf(s,f)},Promise,PromisePrototypeCatch(s,f){return s.catch(f)},PromisePrototypeThen(s,f,r){return s.then(f,r)},PromiseReject(s){return Promise.reject(s)},PromiseResolve(s){return Promise.resolve(s)},ReflectApply:Reflect.apply,RegExpPrototypeTest(s,f){return s.test(f)},SafeSet:Set,String,StringPrototypeSlice(s,f,r){return s.slice(f,r)},StringPrototypeToLowerCase(s){return s.toLowerCase()},StringPrototypeToUpperCase(s){return s.toUpperCase()},StringPrototypeTrim(s){return s.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(s,f,r){return s.set(f,r)},Boolean,Uint8Array}}),bs=de((g,u)=>{le(),ce(),ue(),u.exports={format(o,...s){return o.replace(/%([sdifj])/g,function(...[f,r]){let t=s.shift();return r==="f"?t.toFixed(6):r==="j"?JSON.stringify(t):r==="s"&&typeof t=="object"?`${t.constructor!==Object?t.constructor.name:""} {}`.trim():t.toString()})},inspect(o){switch(typeof o){case"string":if(o.includes("'"))if(o.includes('"')){if(!o.includes("`")&&!o.includes("${"))return`\`${o}\``}else return`"${o}"`;return`'${o}'`;case"number":return isNaN(o)?"NaN":Object.is(o,-0)?String(o):o;case"bigint":return`${String(o)}n`;case"boolean":case"undefined":return String(o);case"object":return"{}"}}}}),qe=de((g,u)=>{le(),ce(),ue();var{format:o,inspect:s}=bs(),{AggregateError:f}=Me(),r=globalThis.AggregateError||f,t=Symbol("kIsNodeError"),n=["string","function","number","object","Function","Object","boolean","bigint","symbol"],e=/^([A-Z][a-z0-9]*)+$/,i="__node_internal_",a={};function d(h,_){if(!h)throw new a.ERR_INTERNAL_ASSERTION(_)}function p(h){let _="",I=h.length,v=h[0]==="-"?1:0;for(;I>=v+4;I-=3)_=`_${h.slice(I-3,I)}${_}`;return`${h.slice(0,I)}${_}`}function m(h,_,I){if(typeof _=="function")return d(_.length<=I.length,`Code: ${h}; The provided arguments length (${I.length}) does not match the required ones (${_.length}).`),_(...I);let v=(_.match(/%[dfijoOs]/g)||[]).length;return d(v===I.length,`Code: ${h}; The provided arguments length (${I.length}) does not match the required ones (${v}).`),I.length===0?_:o(_,...I)}function c(h,_,I){I||(I=Error);class v extends I{constructor(...E){super(m(h,_,E))}toString(){return`${this.name} [${h}]: ${this.message}`}}Object.defineProperties(v.prototype,{name:{value:I.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${h}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),v.prototype.code=h,v.prototype[t]=!0,a[h]=v}function y(h){let _=i+h.name;return Object.defineProperty(h,"name",{value:_}),h}function b(h,_){if(h&&_&&h!==_){if(Array.isArray(_.errors))return _.errors.push(h),_;let I=new r([_,h],_.message);return I.code=_.code,I}return h||_}var S=class extends Error{constructor(h="The operation was aborted",_=void 0){if(_!==void 0&&typeof _!="object")throw new a.ERR_INVALID_ARG_TYPE("options","Object",_);super(h,_),this.code="ABORT_ERR",this.name="AbortError"}};c("ERR_ASSERTION","%s",Error),c("ERR_INVALID_ARG_TYPE",(h,_,I)=>{d(typeof h=="string","'name' must be a string"),Array.isArray(_)||(_=[_]);let v="The ";h.endsWith(" argument")?v+=`${h} `:v+=`"${h}" ${h.includes(".")?"property":"argument"} `,v+="must be ";let A=[],E=[],T=[];for(let P of _)d(typeof P=="string","All expected entries have to be of type string"),n.includes(P)?A.push(P.toLowerCase()):e.test(P)?E.push(P):(d(P!=="object",'The value "object" should be written as "Object"'),T.push(P));if(E.length>0){let P=A.indexOf("object");P!==-1&&(A.splice(A,P,1),E.push("Object"))}if(A.length>0){switch(A.length){case 1:v+=`of type ${A[0]}`;break;case 2:v+=`one of type ${A[0]} or ${A[1]}`;break;default:{let P=A.pop();v+=`one of type ${A.join(", ")}, or ${P}`}}(E.length>0||T.length>0)&&(v+=" or ")}if(E.length>0){switch(E.length){case 1:v+=`an instance of ${E[0]}`;break;case 2:v+=`an instance of ${E[0]} or ${E[1]}`;break;default:{let P=E.pop();v+=`an instance of ${E.join(", ")}, or ${P}`}}T.length>0&&(v+=" or ")}switch(T.length){case 0:break;case 1:T[0].toLowerCase()!==T[0]&&(v+="an "),v+=`${T[0]}`;break;case 2:v+=`one of ${T[0]} or ${T[1]}`;break;default:{let P=T.pop();v+=`one of ${T.join(", ")}, or ${P}`}}if(I==null)v+=`. Received ${I}`;else if(typeof I=="function"&&I.name)v+=`. Received function ${I.name}`;else if(typeof I=="object"){var C;if((C=I.constructor)!==null&&C!==void 0&&C.name)v+=`. Received an instance of ${I.constructor.name}`;else{let P=s(I,{depth:-1});v+=`. Received ${P}`}}else{let P=s(I,{colors:!1});P.length>25&&(P=`${P.slice(0,25)}...`),v+=`. Received type ${typeof I} (${P})`}return v},TypeError),c("ERR_INVALID_ARG_VALUE",(h,_,I="is invalid")=>{let v=s(_);return v.length>128&&(v=v.slice(0,128)+"..."),`The ${h.includes(".")?"property":"argument"} '${h}' ${I}. Received ${v}`},TypeError),c("ERR_INVALID_RETURN_VALUE",(h,_,I)=>{var v;let A=I!=null&&(v=I.constructor)!==null&&v!==void 0&&v.name?`instance of ${I.constructor.name}`:`type ${typeof I}`;return`Expected ${h} to be returned from the "${_}" function but got ${A}.`},TypeError),c("ERR_MISSING_ARGS",(...h)=>{d(h.length>0,"At least one arg needs to be specified");let _,I=h.length;switch(h=(Array.isArray(h)?h:[h]).map(v=>`"${v}"`).join(" or "),I){case 1:_+=`The ${h[0]} argument`;break;case 2:_+=`The ${h[0]} and ${h[1]} arguments`;break;default:{let v=h.pop();_+=`The ${h.join(", ")}, and ${v} arguments`}break}return`${_} must be specified`},TypeError),c("ERR_OUT_OF_RANGE",(h,_,I)=>{d(_,'Missing "range" argument');let v;if(Number.isInteger(I)&&Math.abs(I)>2**32)v=p(String(I));else if(typeof I=="bigint"){v=String(I);let A=BigInt(2)**BigInt(32);(I>A||I<-A)&&(v=p(v)),v+="n"}else v=s(I);return`The value of "${h}" is out of range. It must be ${_}. Received ${v}`},RangeError),c("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),c("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),c("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),c("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),c("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),c("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),c("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),c("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),c("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),c("ERR_STREAM_WRITE_AFTER_END","write after end",Error),c("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),u.exports={AbortError:S,aggregateTwoErrors:y(b),hideStackFrames:y,codes:a}}),Kt=de((g,u)=>{le(),ce(),ue();var{AbortController:o,AbortSignal:s}=typeof self<"u"?self:typeof window<"u"?window:void 0;u.exports=o,u.exports.AbortSignal=s,u.exports.default=o}),bt={};Mt(bt,{EventEmitter:()=>ms,default:()=>Rt,defaultMaxListeners:()=>vs,init:()=>ws,listenerCount:()=>_s,on:()=>Ss,once:()=>Es});function Va(){if(Hn)return $t;Hn=!0;var g=typeof Reflect=="object"?Reflect:null,u=g&&typeof g.apply=="function"?g.apply:function(I,v,A){return Function.prototype.apply.call(I,v,A)},o;g&&typeof g.ownKeys=="function"?o=g.ownKeys:Object.getOwnPropertySymbols?o=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:o=function(I){return Object.getOwnPropertyNames(I)};function s(I){console&&console.warn&&console.warn(I)}var f=Number.isNaN||function(I){return I!==I};function r(){r.init.call(this)}$t=r,$t.once=S,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var t=10;function n(I){if(typeof I!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof I)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return t},set:function(I){if(typeof I!="number"||I<0||f(I))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+I+".");t=I}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||f(I))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+I+".");return this._maxListeners=I,this};function e(I){return I._maxListeners===void 0?r.defaultMaxListeners:I._maxListeners}r.prototype.getMaxListeners=function(){return e(this)},r.prototype.emit=function(I){for(var v=[],A=1;A<arguments.length;A++)v.push(arguments[A]);var E=I==="error",T=this._events;if(T!==void 0)E=E&&T.error===void 0;else if(!E)return!1;if(E){var C;if(v.length>0&&(C=v[0]),C instanceof Error)throw C;var P=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw P.context=C,P}var L=T[I];if(L===void 0)return!1;if(typeof L=="function")u(L,this,v);else for(var k=L.length,q=c(L,k),A=0;A<k;++A)u(q[A],this,v);return!0};function i(I,v,A,E){var T,C,P;if(n(A),C=I._events,C===void 0?(C=I._events=Object.create(null),I._eventsCount=0):(C.newListener!==void 0&&(I.emit("newListener",v,A.listener?A.listener:A),C=I._events),P=C[v]),P===void 0)P=C[v]=A,++I._eventsCount;else if(typeof P=="function"?P=C[v]=E?[A,P]:[P,A]:E?P.unshift(A):P.push(A),T=e(I),T>0&&P.length>T&&!P.warned){P.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=I,L.type=v,L.count=P.length,s(L)}return I}r.prototype.addListener=function(I,v){return i(this,I,v,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(I,v){return i(this,I,v,!0)};function a(){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 d(I,v,A){var E={fired:!1,wrapFn:void 0,target:I,type:v,listener:A},T=a.bind(E);return T.listener=A,E.wrapFn=T,T}r.prototype.once=function(I,v){return n(v),this.on(I,d(this,I,v)),this},r.prototype.prependOnceListener=function(I,v){return n(v),this.prependListener(I,d(this,I,v)),this},r.prototype.removeListener=function(I,v){var A,E,T,C,P;if(n(v),E=this._events,E===void 0)return this;if(A=E[I],A===void 0)return this;if(A===v||A.listener===v)--this._eventsCount===0?this._events=Object.create(null):(delete E[I],E.removeListener&&this.emit("removeListener",I,A.listener||v));else if(typeof A!="function"){for(T=-1,C=A.length-1;C>=0;C--)if(A[C]===v||A[C].listener===v){P=A[C].listener,T=C;break}if(T<0)return this;T===0?A.shift():y(A,T),A.length===1&&(E[I]=A[0]),E.removeListener!==void 0&&this.emit("removeListener",I,P||v)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(I){var v,A,E;if(A=this._events,A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[I]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[I]),this;if(arguments.length===0){var T=Object.keys(A),C;for(E=0;E<T.length;++E)C=T[E],C!=="removeListener"&&this.removeAllListeners(C);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(v=A[I],typeof v=="function")this.removeListener(I,v);else if(v!==void 0)for(E=v.length-1;E>=0;E--)this.removeListener(I,v[E]);return this};function p(I,v,A){var E=I._events;if(E===void 0)return[];var T=E[v];return T===void 0?[]:typeof T=="function"?A?[T.listener||T]:[T]:A?b(T):c(T,T.length)}r.prototype.listeners=function(I){return p(this,I,!0)},r.prototype.rawListeners=function(I){return p(this,I,!1)},r.listenerCount=function(I,v){return typeof I.listenerCount=="function"?I.listenerCount(v):m.call(I,v)},r.prototype.listenerCount=m;function m(I){var v=this._events;if(v!==void 0){var A=v[I];if(typeof A=="function")return 1;if(A!==void 0)return A.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?o(this._events):[]};function c(I,v){for(var A=new Array(v),E=0;E<v;++E)A[E]=I[E];return A}function y(I,v){for(;v+1<I.length;v++)I[v]=I[v+1];I.pop()}function b(I){for(var v=new Array(I.length),A=0;A<v.length;++A)v[A]=I[A].listener||I[A];return v}function S(I,v){return new Promise(function(A,E){function T(P){I.removeListener(v,C),E(P)}function C(){typeof I.removeListener=="function"&&I.removeListener("error",T),A([].slice.call(arguments))}_(I,v,C,{once:!0}),v!=="error"&&h(I,T,{once:!0})})}function h(I,v,A){typeof I.on=="function"&&_(I,"error",v,A)}function _(I,v,A,E){if(typeof I.on=="function")E.once?I.once(v,A):I.on(v,A);else if(typeof I.addEventListener=="function")I.addEventListener(v,function T(C){E.once&&I.removeEventListener(v,T),A(C)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof I)}return $t}var $t,Hn,Rt,ms,vs,ws,_s,Ss,Es,It=He(()=>{le(),ce(),ue(),$t={},Hn=!1,Rt=Va(),Rt.once,Rt.once=function(g,u){return new Promise((o,s)=>{function f(...t){r!==void 0&&g.removeListener("error",r),o(t)}let r;u!=="error"&&(r=t=>{g.removeListener(name,f),s(t)},g.once("error",r)),g.once(u,f)})},Rt.on=function(g,u){let o=[],s=[],f=null,r=!1,t={async next(){let i=o.shift();if(i)return createIterResult(i,!1);if(f){let a=Promise.reject(f);return f=null,a}return r?createIterResult(void 0,!0):new Promise((a,d)=>s.push({resolve:a,reject:d}))},async return(){g.removeListener(u,n),g.removeListener("error",e),r=!0;for(let i of s)i.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(i){f=i,g.removeListener(u,n),g.removeListener("error",e)},[Symbol.asyncIterator](){return this}};return g.on(u,n),g.on("error",e),t;function n(...i){let a=s.shift();a?a.resolve(createIterResult(i,!1)):o.push(i)}function e(i){r=!0;let a=s.shift();a?a.reject(i):f=i,t.return()}},{EventEmitter:ms,defaultMaxListeners:vs,init:ws,listenerCount:_s,on:Ss,once:Es}=Rt}),$e=de((g,u)=>{le(),ce(),ue();var o=(Be(),Pe(Ne)),{format:s,inspect:f}=bs(),{codes:{ERR_INVALID_ARG_TYPE:r}}=qe(),{kResistStopPropagation:t,AggregateError:n,SymbolDispose:e}=Me(),i=globalThis.AbortSignal||Kt().AbortSignal,a=globalThis.AbortController||Kt().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||o.Blob,m=typeof p<"u"?function(b){return b instanceof p}:function(b){return!1},c=(b,S)=>{if(b!==void 0&&(b===null||typeof b!="object"||!("aborted"in b)))throw new r(S,"AbortSignal",b)},y=(b,S)=>{if(typeof b!="function")throw new r(S,"Function",b)};u.exports={AggregateError:n,kEmptyObject:Object.freeze({}),once(b){let S=!1;return function(...h){S||(S=!0,b.apply(this,h))}},createDeferredPromise:function(){let b,S;return{promise:new Promise((h,_)=>{b=h,S=_}),resolve:b,reject:S}},promisify(b){return new Promise((S,h)=>{b((_,...I)=>_?h(_):S(...I))})},debuglog(){return function(){}},format:s,inspect:f,types:{isAsyncFunction(b){return b instanceof d},isArrayBufferView(b){return ArrayBuffer.isView(b)}},isBlob:m,deprecate(b,S){return b},addAbortListener:(It(),Pe(bt)).addAbortListener||function(b,S){if(b===void 0)throw new r("signal","AbortSignal",b);c(b,"signal"),y(S,"listener");let h;return b.aborted?queueMicrotask(()=>S()):(b.addEventListener("abort",S,{__proto__:null,once:!0,[t]:!0}),h=()=>{b.removeEventListener("abort",S)}),{__proto__:null,[e](){var _;(_=h)===null||_===void 0||_()}}},AbortSignalAny:i.any||function(b){if(b.length===1)return b[0];let S=new a,h=()=>S.abort();return b.forEach(_=>{c(_,"signals"),_.addEventListener("abort",h,{once:!0})}),S.signal.addEventListener("abort",()=>{b.forEach(_=>_.removeEventListener("abort",h))},{once:!0}),S.signal}},u.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),Gt=de((g,u)=>{le(),ce(),ue();var{ArrayIsArray:o,ArrayPrototypeIncludes:s,ArrayPrototypeJoin:f,ArrayPrototypeMap:r,NumberIsInteger:t,NumberIsNaN:n,NumberMAX_SAFE_INTEGER:e,NumberMIN_SAFE_INTEGER:i,NumberParseInt:a,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:p,String:m,StringPrototypeToUpperCase:c,StringPrototypeTrim:y}=Me(),{hideStackFrames:b,codes:{ERR_SOCKET_BAD_PORT:S,ERR_INVALID_ARG_TYPE:h,ERR_INVALID_ARG_VALUE:_,ERR_OUT_OF_RANGE:I,ERR_UNKNOWN_SIGNAL:v}}=qe(),{normalizeEncoding:A}=$e(),{isAsyncFunction:E,isArrayBufferView:T}=$e().types,C={};function P($){return $===($|0)}function L($){return $===$>>>0}var k=/^[0-7]+$/,q="must be a 32-bit unsigned integer or an octal string";function F($,ge,ve){if(typeof $>"u"&&($=ve),typeof $=="string"){if(p(k,$)===null)throw new _(ge,$,q);$=a($,8)}return Q($,ge),$}var B=b(($,ge,ve=i,se=e)=>{if(typeof $!="number")throw new h(ge,"number",$);if(!t($))throw new I(ge,"an integer",$);if($<ve||$>se)throw new I(ge,`>= ${ve} && <= ${se}`,$)}),ae=b(($,ge,ve=-2147483648,se=2147483647)=>{if(typeof $!="number")throw new h(ge,"number",$);if(!t($))throw new I(ge,"an integer",$);if($<ve||$>se)throw new I(ge,`>= ${ve} && <= ${se}`,$)}),Q=b(($,ge,ve=!1)=>{if(typeof $!="number")throw new h(ge,"number",$);if(!t($))throw new I(ge,"an integer",$);let se=ve?1:0,ke=4294967295;if($<se||$>ke)throw new I(ge,`>= ${se} && <= ${ke}`,$)});function V($,ge){if(typeof $!="string")throw new h(ge,"string",$)}function re($,ge,ve=void 0,se){if(typeof $!="number")throw new h(ge,"number",$);if(ve!=null&&$<ve||se!=null&&$>se||(ve!=null||se!=null)&&n($))throw new I(ge,`${ve!=null?`>= ${ve}`:""}${ve!=null&&se!=null?" && ":""}${se!=null?`<= ${se}`:""}`,$)}var D=b(($,ge,ve)=>{if(!s(ve,$)){let se="must be one of: "+f(r(ve,ke=>typeof ke=="string"?`'${ke}'`:m(ke)),", ");throw new _(ge,$,se)}});function Z($,ge){if(typeof $!="boolean")throw new h(ge,"boolean",$)}function R($,ge,ve){return $==null||!d($,ge)?ve:$[ge]}var J=b(($,ge,ve=null)=>{let se=R(ve,"allowArray",!1),ke=R(ve,"allowFunction",!1);if(!R(ve,"nullable",!1)&&$===null||!se&&o($)||typeof $!="object"&&(!ke||typeof $!="function"))throw new h(ge,"Object",$)}),be=b(($,ge)=>{if($!=null&&typeof $!="object"&&typeof $!="function")throw new h(ge,"a dictionary",$)}),te=b(($,ge,ve=0)=>{if(!o($))throw new h(ge,"Array",$);if($.length<ve){let se=`must be longer than ${ve}`;throw new _(ge,$,se)}});function we($,ge){te($,ge);for(let ve=0;ve<$.length;ve++)V($[ve],`${ge}[${ve}]`)}function K($,ge){te($,ge);for(let ve=0;ve<$.length;ve++)Z($[ve],`${ge}[${ve}]`)}function N($,ge){te($,ge);for(let ve=0;ve<$.length;ve++){let se=$[ve],ke=`${ge}[${ve}]`;if(se==null)throw new h(ke,"AbortSignal",se);ye(se,ke)}}function ne($,ge="signal"){if(V($,ge),C[$]===void 0)throw C[c($)]!==void 0?new v($+" (signals must use all capital letters)"):new v($)}var H=b(($,ge="buffer")=>{if(!T($))throw new h(ge,["Buffer","TypedArray","DataView"],$)});function G($,ge){let ve=A(ge),se=$.length;if(ve==="hex"&&se%2!==0)throw new _("encoding",ge,`is invalid for data of length ${se}`)}function Y($,ge="Port",ve=!0){if(typeof $!="number"&&typeof $!="string"||typeof $=="string"&&y($).length===0||+$!==+$>>>0||$>65535||$===0&&!ve)throw new S(ge,$,ve);return $|0}var ye=b(($,ge)=>{if($!==void 0&&($===null||typeof $!="object"||!("aborted"in $)))throw new h(ge,"AbortSignal",$)}),oe=b(($,ge)=>{if(typeof $!="function")throw new h(ge,"Function",$)}),M=b(($,ge)=>{if(typeof $!="function"||E($))throw new h(ge,"Function",$)}),W=b(($,ge)=>{if($!==void 0)throw new h(ge,"undefined",$)});function ee($,ge,ve){if(!s(ve,$))throw new h(ge,`('${f(ve,"|")}')`,$)}var he=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe($,ge){if(typeof $>"u"||!p(he,$))throw new _(ge,$,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me($){if(typeof $=="string")return pe($,"hints"),$;if(o($)){let ge=$.length,ve="";if(ge===0)return ve;for(let se=0;se<ge;se++){let ke=$[se];pe(ke,"hints"),ve+=ke,se!==ge-1&&(ve+=", ")}return ve}throw new _("hints",$,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}u.exports={isInt32:P,isUint32:L,parseFileMode:F,validateArray:te,validateStringArray:we,validateBooleanArray:K,validateAbortSignalArray:N,validateBoolean:Z,validateBuffer:H,validateDictionary:be,validateEncoding:G,validateFunction:oe,validateInt32:ae,validateInteger:B,validateNumber:re,validateObject:J,validateOneOf:D,validatePlainFunction:M,validatePort:Y,validateSignalName:ne,validateString:V,validateUint32:Q,validateUndefined:W,validateUnion:ee,validateAbortSignal:ye,validateLinkHeaderValue:me}}),xt=de((g,u)=>{le(),ce(),ue();var o=u.exports={},s,f;function r(){throw new Error("setTimeout has not been defined")}function t(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?s=setTimeout:s=r}catch{s=r}try{typeof clearTimeout=="function"?f=clearTimeout:f=t}catch{f=t}})();function n(S){if(s===setTimeout)return setTimeout(S,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(S,0);try{return s(S,0)}catch{try{return s.call(null,S,0)}catch{return s.call(this,S,0)}}}function e(S){if(f===clearTimeout)return clearTimeout(S);if((f===t||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(S);try{return f(S)}catch{try{return f.call(null,S)}catch{return f.call(this,S)}}}var i=[],a=!1,d,p=-1;function m(){!a||!d||(a=!1,d.length?i=d.concat(i):p=-1,i.length&&c())}function c(){if(!a){var S=n(m);a=!0;for(var h=i.length;h;){for(d=i,i=[];++p<h;)d&&d[p].run();p=-1,h=i.length}d=null,a=!1,e(S)}}o.nextTick=function(S){var h=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)h[_-1]=arguments[_];i.push(new y(S,h)),i.length===1&&!a&&n(c)};function y(S,h){this.fun=S,this.array=h}y.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={};function b(){}o.on=b,o.addListener=b,o.once=b,o.off=b,o.removeListener=b,o.removeAllListeners=b,o.emit=b,o.prependListener=b,o.prependOnceListener=b,o.listeners=function(S){return[]},o.binding=function(S){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(S){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}),ut=de((g,u)=>{le(),ce(),ue();var{SymbolAsyncIterator:o,SymbolIterator:s,SymbolFor:f}=Me(),r=f("nodejs.stream.destroyed"),t=f("nodejs.stream.errored"),n=f("nodejs.stream.readable"),e=f("nodejs.stream.writable"),i=f("nodejs.stream.disturbed"),a=f("nodejs.webstream.isClosedPromise"),d=f("nodejs.webstream.controllerErrorFunction");function p(R,J=!1){var be;return!!(R&&typeof R.pipe=="function"&&typeof R.on=="function"&&(!J||typeof R.pause=="function"&&typeof R.resume=="function")&&(!R._writableState||((be=R._readableState)===null||be===void 0?void 0:be.readable)!==!1)&&(!R._writableState||R._readableState))}function m(R){var J;return!!(R&&typeof R.write=="function"&&typeof R.on=="function"&&(!R._readableState||((J=R._writableState)===null||J===void 0?void 0:J.writable)!==!1))}function c(R){return!!(R&&typeof R.pipe=="function"&&R._readableState&&typeof R.on=="function"&&typeof R.write=="function")}function y(R){return R&&(R._readableState||R._writableState||typeof R.write=="function"&&typeof R.on=="function"||typeof R.pipe=="function"&&typeof R.on=="function")}function b(R){return!!(R&&!y(R)&&typeof R.pipeThrough=="function"&&typeof R.getReader=="function"&&typeof R.cancel=="function")}function S(R){return!!(R&&!y(R)&&typeof R.getWriter=="function"&&typeof R.abort=="function")}function h(R){return!!(R&&!y(R)&&typeof R.readable=="object"&&typeof R.writable=="object")}function _(R){return b(R)||S(R)||h(R)}function I(R,J){return R==null?!1:J===!0?typeof R[o]=="function":J===!1?typeof R[s]=="function":typeof R[o]=="function"||typeof R[s]=="function"}function v(R){if(!y(R))return null;let J=R._writableState,be=R._readableState,te=J||be;return!!(R.destroyed||R[r]||te!=null&&te.destroyed)}function A(R){if(!m(R))return null;if(R.writableEnded===!0)return!0;let J=R._writableState;return J!=null&&J.errored?!1:typeof J?.ended!="boolean"?null:J.ended}function E(R,J){if(!m(R))return null;if(R.writableFinished===!0)return!0;let be=R._writableState;return be!=null&&be.errored?!1:typeof be?.finished!="boolean"?null:!!(be.finished||J===!1&&be.ended===!0&&be.length===0)}function T(R){if(!p(R))return null;if(R.readableEnded===!0)return!0;let J=R._readableState;return!J||J.errored?!1:typeof J?.ended!="boolean"?null:J.ended}function C(R,J){if(!p(R))return null;let be=R._readableState;return be!=null&&be.errored?!1:typeof be?.endEmitted!="boolean"?null:!!(be.endEmitted||J===!1&&be.ended===!0&&be.length===0)}function P(R){return R&&R[n]!=null?R[n]:typeof R?.readable!="boolean"?null:v(R)?!1:p(R)&&R.readable&&!C(R)}function L(R){return R&&R[e]!=null?R[e]:typeof R?.writable!="boolean"?null:v(R)?!1:m(R)&&R.writable&&!A(R)}function k(R,J){return y(R)?v(R)?!0:!(J?.readable!==!1&&P(R)||J?.writable!==!1&&L(R)):null}function q(R){var J,be;return y(R)?R.writableErrored?R.writableErrored:(J=(be=R._writableState)===null||be===void 0?void 0:be.errored)!==null&&J!==void 0?J:null:null}function F(R){var J,be;return y(R)?R.readableErrored?R.readableErrored:(J=(be=R._readableState)===null||be===void 0?void 0:be.errored)!==null&&J!==void 0?J:null:null}function B(R){if(!y(R))return null;if(typeof R.closed=="boolean")return R.closed;let J=R._writableState,be=R._readableState;return typeof J?.closed=="boolean"||typeof be?.closed=="boolean"?J?.closed||be?.closed:typeof R._closed=="boolean"&&ae(R)?R._closed:null}function ae(R){return typeof R._closed=="boolean"&&typeof R._defaultKeepAlive=="boolean"&&typeof R._removedConnection=="boolean"&&typeof R._removedContLen=="boolean"}function Q(R){return typeof R._sent100=="boolean"&&ae(R)}function V(R){var J;return typeof R._consuming=="boolean"&&typeof R._dumped=="boolean"&&((J=R.req)===null||J===void 0?void 0:J.upgradeOrConnect)===void 0}function re(R){if(!y(R))return null;let J=R._writableState,be=R._readableState,te=J||be;return!te&&Q(R)||!!(te&&te.autoDestroy&&te.emitClose&&te.closed===!1)}function D(R){var J;return!!(R&&((J=R[i])!==null&&J!==void 0?J:R.readableDidRead||R.readableAborted))}function Z(R){var J,be,te,we,K,N,ne,H,G,Y;return!!(R&&((J=(be=(te=(we=(K=(N=R[t])!==null&&N!==void 0?N:R.readableErrored)!==null&&K!==void 0?K:R.writableErrored)!==null&&we!==void 0?we:(ne=R._readableState)===null||ne===void 0?void 0:ne.errorEmitted)!==null&&te!==void 0?te:(H=R._writableState)===null||H===void 0?void 0:H.errorEmitted)!==null&&be!==void 0?be:(G=R._readableState)===null||G===void 0?void 0:G.errored)!==null&&J!==void 0?J:!((Y=R._writableState)===null||Y===void 0)&&Y.errored))}u.exports={isDestroyed:v,kIsDestroyed:r,isDisturbed:D,kIsDisturbed:i,isErrored:Z,kIsErrored:t,isReadable:P,kIsReadable:n,kIsClosedPromise:a,kControllerErrorFunction:d,kIsWritable:e,isClosed:B,isDuplexNodeStream:c,isFinished:k,isIterable:I,isReadableNodeStream:p,isReadableStream:b,isReadableEnded:T,isReadableFinished:C,isReadableErrored:F,isNodeStream:y,isWebStream:_,isWritable:L,isWritableNodeStream:m,isWritableStream:S,isWritableEnded:A,isWritableFinished:E,isWritableErrored:q,isServerRequest:V,isServerResponse:Q,willEmitClose:re,isTransformStream:h}}),mt=de((g,u)=>{le(),ce(),ue();var o=xt(),{AbortError:s,codes:f}=qe(),{ERR_INVALID_ARG_TYPE:r,ERR_STREAM_PREMATURE_CLOSE:t}=f,{kEmptyObject:n,once:e}=$e(),{validateAbortSignal:i,validateFunction:a,validateObject:d,validateBoolean:p}=Gt(),{Promise:m,PromisePrototypeThen:c,SymbolDispose:y}=Me(),{isClosed:b,isReadable:S,isReadableNodeStream:h,isReadableStream:_,isReadableFinished:I,isReadableErrored:v,isWritable:A,isWritableNodeStream:E,isWritableStream:T,isWritableFinished:C,isWritableErrored:P,isNodeStream:L,willEmitClose:k,kIsClosedPromise:q}=ut(),F;function B(D){return D.setHeader&&typeof D.abort=="function"}var ae=()=>{};function Q(D,Z,R){var J,be;if(arguments.length===2?(R=Z,Z=n):Z==null?Z=n:d(Z,"options"),a(R,"callback"),i(Z.signal,"options.signal"),R=e(R),_(D)||T(D))return V(D,Z,R);if(!L(D))throw new r("stream",["ReadableStream","WritableStream","Stream"],D);let te=(J=Z.readable)!==null&&J!==void 0?J:h(D),we=(be=Z.writable)!==null&&be!==void 0?be:E(D),K=D._writableState,N=D._readableState,ne=()=>{D.writable||Y()},H=k(D)&&h(D)===te&&E(D)===we,G=C(D,!1),Y=()=>{G=!0,D.destroyed&&(H=!1),!(H&&(!D.readable||te))&&(!te||ye)&&R.call(D)},ye=I(D,!1),oe=()=>{ye=!0,D.destroyed&&(H=!1),!(H&&(!D.writable||we))&&(!we||G)&&R.call(D)},M=$=>{R.call(D,$)},W=b(D),ee=()=>{W=!0;let $=P(D)||v(D);if($&&typeof $!="boolean")return R.call(D,$);if(te&&!ye&&h(D,!0)&&!I(D,!1))return R.call(D,new t);if(we&&!G&&!C(D,!1))return R.call(D,new t);R.call(D)},he=()=>{W=!0;let $=P(D)||v(D);if($&&typeof $!="boolean")return R.call(D,$);R.call(D)},pe=()=>{D.req.on("finish",Y)};B(D)?(D.on("complete",Y),H||D.on("abort",ee),D.req?pe():D.on("request",pe)):we&&!K&&(D.on("end",ne),D.on("close",ne)),!H&&typeof D.aborted=="boolean"&&D.on("aborted",ee),D.on("end",oe),D.on("finish",Y),Z.error!==!1&&D.on("error",M),D.on("close",ee),W?o.nextTick(ee):K!=null&&K.errorEmitted||N!=null&&N.errorEmitted?H||o.nextTick(he):(!te&&(!H||S(D))&&(G||A(D)===!1)||!we&&(!H||A(D))&&(ye||S(D)===!1)||N&&D.req&&D.aborted)&&o.nextTick(he);let me=()=>{R=ae,D.removeListener("aborted",ee),D.removeListener("complete",Y),D.removeListener("abort",ee),D.removeListener("request",pe),D.req&&D.req.removeListener("finish",Y),D.removeListener("end",ne),D.removeListener("close",ne),D.removeListener("finish",Y),D.removeListener("end",oe),D.removeListener("error",M),D.removeListener("close",ee)};if(Z.signal&&!W){let $=()=>{let ge=R;me(),ge.call(D,new s(void 0,{cause:Z.signal.reason}))};if(Z.signal.aborted)o.nextTick($);else{F=F||$e().addAbortListener;let ge=F(Z.signal,$),ve=R;R=e((...se)=>{ge[y](),ve.apply(D,se)})}}return me}function V(D,Z,R){let J=!1,be=ae;if(Z.signal)if(be=()=>{J=!0,R.call(D,new s(void 0,{cause:Z.signal.reason}))},Z.signal.aborted)o.nextTick(be);else{F=F||$e().addAbortListener;let we=F(Z.signal,be),K=R;R=e((...N)=>{we[y](),K.apply(D,N)})}let te=(...we)=>{J||o.nextTick(()=>R.apply(D,we))};return c(D[q].promise,te,te),ae}function re(D,Z){var R;let J=!1;return Z===null&&(Z=n),(R=Z)!==null&&R!==void 0&&R.cleanup&&(p(Z.cleanup,"cleanup"),J=Z.cleanup),new m((be,te)=>{let we=Q(D,Z,K=>{J&&we(),K?te(K):be()})})}u.exports=Q,u.exports.finished=re}),jt=de((g,u)=>{le(),ce(),ue();var o=xt(),{aggregateTwoErrors:s,codes:{ERR_MULTIPLE_CALLBACK:f},AbortError:r}=qe(),{Symbol:t}=Me(),{kIsDestroyed:n,isDestroyed:e,isFinished:i,isServerRequest:a}=ut(),d=t("kDestroy"),p=t("kConstruct");function m(k,q,F){k&&(k.stack,q&&!q.errored&&(q.errored=k),F&&!F.errored&&(F.errored=k))}function c(k,q){let F=this._readableState,B=this._writableState,ae=B||F;return B!=null&&B.destroyed||F!=null&&F.destroyed?(typeof q=="function"&&q(),this):(m(k,B,F),B&&(B.destroyed=!0),F&&(F.destroyed=!0),ae.constructed?y(this,k,q):this.once(d,function(Q){y(this,s(Q,k),q)}),this)}function y(k,q,F){let B=!1;function ae(Q){if(B)return;B=!0;let V=k._readableState,re=k._writableState;m(Q,re,V),re&&(re.closed=!0),V&&(V.closed=!0),typeof F=="function"&&F(Q),Q?o.nextTick(b,k,Q):o.nextTick(S,k)}try{k._destroy(q||null,ae)}catch(Q){ae(Q)}}function b(k,q){h(k,q),S(k)}function S(k){let q=k._readableState,F=k._writableState;F&&(F.closeEmitted=!0),q&&(q.closeEmitted=!0),(F!=null&&F.emitClose||q!=null&&q.emitClose)&&k.emit("close")}function h(k,q){let F=k._readableState,B=k._writableState;B!=null&&B.errorEmitted||F!=null&&F.errorEmitted||(B&&(B.errorEmitted=!0),F&&(F.errorEmitted=!0),k.emit("error",q))}function _(){let k=this._readableState,q=this._writableState;k&&(k.constructed=!0,k.closed=!1,k.closeEmitted=!1,k.destroyed=!1,k.errored=null,k.errorEmitted=!1,k.reading=!1,k.ended=k.readable===!1,k.endEmitted=k.readable===!1),q&&(q.constructed=!0,q.destroyed=!1,q.closed=!1,q.closeEmitted=!1,q.errored=null,q.errorEmitted=!1,q.finalCalled=!1,q.prefinished=!1,q.ended=q.writable===!1,q.ending=q.writable===!1,q.finished=q.writable===!1)}function I(k,q,F){let B=k._readableState,ae=k._writableState;if(ae!=null&&ae.destroyed||B!=null&&B.destroyed)return this;B!=null&&B.autoDestroy||ae!=null&&ae.autoDestroy?k.destroy(q):q&&(q.stack,ae&&!ae.errored&&(ae.errored=q),B&&!B.errored&&(B.errored=q),F?o.nextTick(h,k,q):h(k,q))}function v(k,q){if(typeof k._construct!="function")return;let F=k._readableState,B=k._writableState;F&&(F.constructed=!1),B&&(B.constructed=!1),k.once(p,q),!(k.listenerCount(p)>1)&&o.nextTick(A,k)}function A(k){let q=!1;function F(B){if(q){I(k,B??new f);return}q=!0;let ae=k._readableState,Q=k._writableState,V=Q||ae;ae&&(ae.constructed=!0),Q&&(Q.constructed=!0),V.destroyed?k.emit(d,B):B?I(k,B,!0):o.nextTick(E,k)}try{k._construct(B=>{o.nextTick(F,B)})}catch(B){o.nextTick(F,B)}}function E(k){k.emit(p)}function T(k){return k?.setHeader&&typeof k.abort=="function"}function C(k){k.emit("close")}function P(k,q){k.emit("error",q),o.nextTick(C,k)}function L(k,q){!k||e(k)||(!q&&!i(k)&&(q=new r),a(k)?(k.socket=null,k.destroy(q)):T(k)?k.abort():T(k.req)?k.req.abort():typeof k.destroy=="function"?k.destroy(q):typeof k.close=="function"?k.close():q?o.nextTick(P,k,q):o.nextTick(C,k),k.destroyed||(k[n]=!0))}u.exports={construct:v,destroyer:L,destroy:c,undestroy:_,errorOrDestroy:I}}),Ui=de((g,u)=>{le(),ce(),ue();var{ArrayIsArray:o,ObjectSetPrototypeOf:s}=Me(),{EventEmitter:f}=(It(),Pe(bt));function r(n){f.call(this,n)}s(r.prototype,f.prototype),s(r,f),r.prototype.pipe=function(n,e){let i=this;function a(S){n.writable&&n.write(S)===!1&&i.pause&&i.pause()}i.on("data",a);function d(){i.readable&&i.resume&&i.resume()}n.on("drain",d),!n._isStdio&&(!e||e.end!==!1)&&(i.on("end",m),i.on("close",c));let p=!1;function m(){p||(p=!0,n.end())}function c(){p||(p=!0,typeof n.destroy=="function"&&n.destroy())}function y(S){b(),f.listenerCount(this,"error")===0&&this.emit("error",S)}t(i,"error",y),t(n,"error",y);function b(){i.removeListener("data",a),n.removeListener("drain",d),i.removeListener("end",m),i.removeListener("close",c),i.removeListener("error",y),n.removeListener("error",y),i.removeListener("end",b),i.removeListener("close",b),n.removeListener("close",b)}return i.on("end",b),i.on("close",b),n.on("close",b),n.emit("pipe",i),n};function t(n,e,i){if(typeof n.prependListener=="function")return n.prependListener(e,i);!n._events||!n._events[e]?n.on(e,i):o(n._events[e])?n._events[e].unshift(i):n._events[e]=[i,n._events[e]]}u.exports={Stream:r,prependListener:t}}),Tr=de((g,u)=>{le(),ce(),ue();var{SymbolDispose:o}=Me(),{AbortError:s,codes:f}=qe(),{isNodeStream:r,isWebStream:t,kControllerErrorFunction:n}=ut(),e=mt(),{ERR_INVALID_ARG_TYPE:i}=f,a,d=(p,m)=>{if(typeof p!="object"||!("aborted"in p))throw new i(m,"AbortSignal",p)};u.exports.addAbortSignal=function(p,m){if(d(p,"signal"),!r(m)&&!t(m))throw new i("stream",["ReadableStream","WritableStream","Stream"],m);return u.exports.addAbortSignalNoValidate(p,m)},u.exports.addAbortSignalNoValidate=function(p,m){if(typeof p!="object"||!("aborted"in p))return m;let c=r(m)?()=>{m.destroy(new s(void 0,{cause:p.reason}))}:()=>{m[n](new s(void 0,{cause:p.reason}))};if(p.aborted)c();else{a=a||$e().addAbortListener;let y=a(p,c);e(m,y[o])}return m}}),Ka=de((g,u)=>{le(),ce(),ue();var{StringPrototypeSlice:o,SymbolIterator:s,TypedArrayPrototypeSet:f,Uint8Array:r}=Me(),{Buffer:t}=(Be(),Pe(Ne)),{inspect:n}=$e();u.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let i={data:e,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}unshift(e){let i={data:e,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let i=this.head,a=""+i.data;for(;(i=i.next)!==null;)a+=e+i.data;return a}concat(e){if(this.length===0)return t.alloc(0);let i=t.allocUnsafe(e>>>0),a=this.head,d=0;for(;a;)f(i,a.data,d),d+=a.data.length,a=a.next;return i}consume(e,i){let a=this.head.data;if(e<a.length){let d=a.slice(0,e);return this.head.data=a.slice(e),d}return e===a.length?this.shift():i?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[s](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let i="",a=this.head,d=0;do{let p=a.data;if(e>p.length)i+=p,e-=p.length;else{e===p.length?(i+=p,++d,a.next?this.head=a.next:this.head=this.tail=null):(i+=o(p,0,e),this.head=a,a.data=o(p,e));break}++d}while((a=a.next)!==null);return this.length-=d,i}_getBuffer(e){let i=t.allocUnsafe(e),a=e,d=this.head,p=0;do{let m=d.data;if(e>m.length)f(i,m,a-e),e-=m.length;else{e===m.length?(f(i,m,a-e),++p,d.next?this.head=d.next:this.head=this.tail=null):(f(i,new r(m.buffer,m.byteOffset,e),a-e),this.head=d,d.data=m.slice(e));break}++p}while((d=d.next)!==null);return this.length-=p,i}[Symbol.for("nodejs.util.inspect.custom")](e,i){return n(this,{...i,depth:0,customInspect:!1})}}}),kr=de((g,u)=>{le(),ce(),ue();var{MathFloor:o,NumberIsInteger:s}=Me(),{validateInteger:f}=Gt(),{ERR_INVALID_ARG_VALUE:r}=qe().codes,t=16*1024,n=16;function e(p,m,c){return p.highWaterMark!=null?p.highWaterMark:m?p[c]:null}function i(p){return p?n:t}function a(p,m){f(m,"value",0),p?n=m:t=m}function d(p,m,c,y){let b=e(m,y,c);if(b!=null){if(!s(b)||b<0){let S=y?`options.${c}`:"options.highWaterMark";throw new r(S,b)}return o(b)}return i(p.objectMode)}u.exports={getHighWaterMark:d,getDefaultHighWaterMark:i,setDefaultHighWaterMark:a}}),Ga=de((g,u)=>{le(),ce(),ue();var o=(Be(),Pe(Ne)),s=o.Buffer;function f(t,n){for(var e in t)n[e]=t[e]}s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?u.exports=o:(f(o,g),g.Buffer=r);function r(t,n,e){return s(t,n,e)}r.prototype=Object.create(s.prototype),f(s,r),r.from=function(t,n,e){if(typeof t=="number")throw new TypeError("Argument must not be a number");return s(t,n,e)},r.alloc=function(t,n,e){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=s(t);return n!==void 0?typeof e=="string"?i.fill(n,e):i.fill(n):i.fill(0),i},r.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return s(t)},r.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return o.SlowBuffer(t)}}),Qa=de(g=>{le(),ce(),ue();var u=Ga().Buffer,o=u.isEncoding||function(h){switch(h=""+h,h&&h.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(h){if(!h)return"utf8";for(var _;;)switch(h){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 h;default:if(_)return;h=(""+h).toLowerCase(),_=!0}}function f(h){var _=s(h);if(typeof _!="string"&&(u.isEncoding===o||!o(h)))throw new Error("Unknown encoding: "+h);return _||h}g.StringDecoder=r;function r(h){this.encoding=f(h);var _;switch(this.encoding){case"utf16le":this.text=p,this.end=m,_=4;break;case"utf8":this.fillLast=i,_=4;break;case"base64":this.text=c,this.end=y,_=3;break;default:this.write=b,this.end=S;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=u.allocUnsafe(_)}r.prototype.write=function(h){if(h.length===0)return"";var _,I;if(this.lastNeed){if(_=this.fillLast(h),_===void 0)return"";I=this.lastNeed,this.lastNeed=0}else I=0;return I<h.length?_?_+this.text(h,I):this.text(h,I):_||""},r.prototype.end=d,r.prototype.text=a,r.prototype.fillLast=function(h){if(this.lastNeed<=h.length)return h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,h.length),this.lastNeed-=h.length};function t(h){return h<=127?0:h>>5===6?2:h>>4===14?3:h>>3===30?4:h>>6===2?-1:-2}function n(h,_,I){var v=_.length-1;if(v<I)return 0;var A=t(_[v]);return A>=0?(A>0&&(h.lastNeed=A-1),A):--v<I||A===-2?0:(A=t(_[v]),A>=0?(A>0&&(h.lastNeed=A-2),A):--v<I||A===-2?0:(A=t(_[v]),A>=0?(A>0&&(A===2?A=0:h.lastNeed=A-3),A):0))}function e(h,_,I){if((_[0]&192)!==128)return h.lastNeed=0,"�";if(h.lastNeed>1&&_.length>1){if((_[1]&192)!==128)return h.lastNeed=1,"�";if(h.lastNeed>2&&_.length>2&&(_[2]&192)!==128)return h.lastNeed=2,"�"}}function i(h){var _=this.lastTotal-this.lastNeed,I=e(this,h);if(I!==void 0)return I;if(this.lastNeed<=h.length)return h.copy(this.lastChar,_,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);h.copy(this.lastChar,_,0,h.length),this.lastNeed-=h.length}function a(h,_){var I=n(this,h,_);if(!this.lastNeed)return h.toString("utf8",_);this.lastTotal=I;var v=h.length-(I-this.lastNeed);return h.copy(this.lastChar,0,v),h.toString("utf8",_,v)}function d(h){var _=h&&h.length?this.write(h):"";return this.lastNeed?_+"�":_}function p(h,_){if((h.length-_)%2===0){var I=h.toString("utf16le",_);if(I){var v=I.charCodeAt(I.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1],I.slice(0,-1)}return I}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=h[h.length-1],h.toString("utf16le",_,h.length-1)}function m(h){var _=h&&h.length?this.write(h):"";if(this.lastNeed){var I=this.lastTotal-this.lastNeed;return _+this.lastChar.toString("utf16le",0,I)}return _}function c(h,_){var I=(h.length-_)%3;return I===0?h.toString("base64",_):(this.lastNeed=3-I,this.lastTotal=3,I===1?this.lastChar[0]=h[h.length-1]:(this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1]),h.toString("base64",_,h.length-I))}function y(h){var _=h&&h.length?this.write(h):"";return this.lastNeed?_+this.lastChar.toString("base64",0,3-this.lastNeed):_}function b(h){return h.toString(this.encoding)}function S(h){return h&&h.length?this.write(h):""}}),As=de((g,u)=>{le(),ce(),ue();var o=xt(),{PromisePrototypeThen:s,SymbolAsyncIterator:f,SymbolIterator:r}=Me(),{Buffer:t}=(Be(),Pe(Ne)),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_NULL_VALUES:e}=qe().codes;function i(a,d,p){let m;if(typeof d=="string"||d instanceof t)return new a({objectMode:!0,...p,read(){this.push(d),this.push(null)}});let c;if(d&&d[f])c=!0,m=d[f]();else if(d&&d[r])c=!1,m=d[r]();else throw new n("iterable",["Iterable"],d);let y=new a({objectMode:!0,highWaterMark:1,...p}),b=!1;y._read=function(){b||(b=!0,h())},y._destroy=function(_,I){s(S(_),()=>o.nextTick(I,_),v=>o.nextTick(I,v||_))};async function S(_){let I=_!=null,v=typeof m.throw=="function";if(I&&v){let{value:A,done:E}=await m.throw(_);if(await A,E)return}if(typeof m.return=="function"){let{value:A}=await m.return();await A}}async function h(){for(;;){try{let{value:_,done:I}=c?await m.next():m.next();if(I)y.push(null);else{let v=_&&typeof _.then=="function"?await _:_;if(v===null)throw b=!1,new e;if(y.push(v))continue;b=!1}}catch(_){y.destroy(_)}break}}return y}u.exports=i}),Or=de((g,u)=>{le(),ce(),ue();var o=xt(),{ArrayPrototypeIndexOf:s,NumberIsInteger:f,NumberIsNaN:r,NumberParseInt:t,ObjectDefineProperties:n,ObjectKeys:e,ObjectSetPrototypeOf:i,Promise:a,SafeSet:d,SymbolAsyncDispose:p,SymbolAsyncIterator:m,Symbol:c}=Me();u.exports=se,se.ReadableState=ve;var{EventEmitter:y}=(It(),Pe(bt)),{Stream:b,prependListener:S}=Ui(),{Buffer:h}=(Be(),Pe(Ne)),{addAbortSignal:_}=Tr(),I=mt(),v=$e().debuglog("stream",O=>{v=O}),A=Ka(),E=jt(),{getHighWaterMark:T,getDefaultHighWaterMark:C}=kr(),{aggregateTwoErrors:P,codes:{ERR_INVALID_ARG_TYPE:L,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:q,ERR_STREAM_PUSH_AFTER_EOF:F,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:B},AbortError:ae}=qe(),{validateObject:Q}=Gt(),V=c("kPaused"),{StringDecoder:re}=Qa(),D=As();i(se.prototype,b.prototype),i(se,b);var Z=()=>{},{errorOrDestroy:R}=E,J=1,be=2,te=4,we=8,K=16,N=32,ne=64,H=128,G=256,Y=512,ye=1024,oe=2048,M=4096,W=8192,ee=16384,he=32768,pe=65536,me=1<<17,$=1<<18;function ge(O){return{enumerable:!1,get(){return(this.state&O)!==0},set(j){j?this.state|=O:this.state&=~O}}}n(ve.prototype,{objectMode:ge(J),ended:ge(be),endEmitted:ge(te),reading:ge(we),constructed:ge(K),sync:ge(N),needReadable:ge(ne),emittedReadable:ge(H),readableListening:ge(G),resumeScheduled:ge(Y),errorEmitted:ge(ye),emitClose:ge(oe),autoDestroy:ge(M),destroyed:ge(W),closed:ge(ee),closeEmitted:ge(he),multiAwaitDrain:ge(pe),readingMore:ge(me),dataEmitted:ge($)});function ve(O,j,_e){typeof _e!="boolean"&&(_e=j instanceof st()),this.state=oe|M|K|N,O&&O.objectMode&&(this.state|=J),_e&&O&&O.readableObjectMode&&(this.state|=J),this.highWaterMark=O?T(this,O,"readableHighWaterMark",_e):C(!1),this.buffer=new A,this.length=0,this.pipes=[],this.flowing=null,this[V]=null,O&&O.emitClose===!1&&(this.state&=~oe),O&&O.autoDestroy===!1&&(this.state&=~M),this.errored=null,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,O&&O.encoding&&(this.decoder=new re(O.encoding),this.encoding=O.encoding)}function se(O){if(!(this instanceof se))return new se(O);let j=this instanceof st();this._readableState=new ve(O,this,j),O&&(typeof O.read=="function"&&(this._read=O.read),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&!j&&_(O.signal,this)),b.call(this,O),E.construct(this,()=>{this._readableState.needReadable&&z(this,this._readableState)})}se.prototype.destroy=E.destroy,se.prototype._undestroy=E.undestroy,se.prototype._destroy=function(O,j){j(O)},se.prototype[y.captureRejectionSymbol]=function(O){this.destroy(O)},se.prototype[p]=function(){let O;return this.destroyed||(O=this.readableEnded?null:new ae,this.destroy(O)),new a((j,_e)=>I(this,Ee=>Ee&&Ee!==O?_e(Ee):j(null)))},se.prototype.push=function(O,j){return ke(this,O,j,!1)},se.prototype.unshift=function(O,j){return ke(this,O,j,!0)};function ke(O,j,_e,Ee){v("readableAddChunk",j);let Ae=O._readableState,je;if((Ae.state&J)===0&&(typeof j=="string"?(_e=_e||Ae.defaultEncoding,Ae.encoding!==_e&&(Ee&&Ae.encoding?j=h.from(j,_e).toString(Ae.encoding):(j=h.from(j,_e),_e=""))):j instanceof h?_e="":b._isUint8Array(j)?(j=b._uint8ArrayToBuffer(j),_e=""):j!=null&&(je=new L("chunk",["string","Buffer","Uint8Array"],j))),je)R(O,je);else if(j===null)Ae.state&=~we,X(O,Ae);else if((Ae.state&J)!==0||j&&j.length>0)if(Ee)if((Ae.state&te)!==0)R(O,new B);else{if(Ae.destroyed||Ae.errored)return!1;l(O,Ae,j,!0)}else if(Ae.ended)R(O,new F);else{if(Ae.destroyed||Ae.errored)return!1;Ae.state&=~we,Ae.decoder&&!_e?(j=Ae.decoder.write(j),Ae.objectMode||j.length!==0?l(O,Ae,j,!1):z(O,Ae)):l(O,Ae,j,!1)}else Ee||(Ae.state&=~we,z(O,Ae));return!Ae.ended&&(Ae.length<Ae.highWaterMark||Ae.length===0)}function l(O,j,_e,Ee){j.flowing&&j.length===0&&!j.sync&&O.listenerCount("data")>0?((j.state&pe)!==0?j.awaitDrainWriters.clear():j.awaitDrainWriters=null,j.dataEmitted=!0,O.emit("data",_e)):(j.length+=j.objectMode?1:_e.length,Ee?j.buffer.unshift(_e):j.buffer.push(_e),(j.state&ne)!==0&&fe(O)),z(O,j)}se.prototype.isPaused=function(){let O=this._readableState;return O[V]===!0||O.flowing===!1},se.prototype.setEncoding=function(O){let j=new re(O);this._readableState.decoder=j,this._readableState.encoding=this._readableState.decoder.encoding;let _e=this._readableState.buffer,Ee="";for(let Ae of _e)Ee+=j.write(Ae);return _e.clear(),Ee!==""&&_e.push(Ee),this._readableState.length=Ee.length,this};var w=1073741824;function x(O){if(O>w)throw new q("size","<= 1GiB",O);return O--,O|=O>>>1,O|=O>>>2,O|=O>>>4,O|=O>>>8,O|=O>>>16,O++,O}function U(O,j){return O<=0||j.length===0&&j.ended?0:(j.state&J)!==0?1:r(O)?j.flowing&&j.length?j.buffer.first().length:j.length:O<=j.length?O:j.ended?j.length:0}se.prototype.read=function(O){v("read",O),O===void 0?O=NaN:f(O)||(O=t(O,10));let j=this._readableState,_e=O;if(O>j.highWaterMark&&(j.highWaterMark=x(O)),O!==0&&(j.state&=~H),O===0&&j.needReadable&&((j.highWaterMark!==0?j.length>=j.highWaterMark:j.length>0)||j.ended))return v("read: emitReadable",j.length,j.ended),j.length===0&&j.ended?Ye(this):fe(this),null;if(O=U(O,j),O===0&&j.ended)return j.length===0&&Ye(this),null;let Ee=(j.state&ne)!==0;if(v("need readable",Ee),(j.length===0||j.length-O<j.highWaterMark)&&(Ee=!0,v("length less than watermark",Ee)),j.ended||j.reading||j.destroyed||j.errored||!j.constructed)Ee=!1,v("reading, ended or constructing",Ee);else if(Ee){v("do read"),j.state|=we|N,j.length===0&&(j.state|=ne);try{this._read(j.highWaterMark)}catch(je){R(this,je)}j.state&=~N,j.reading||(O=U(_e,j))}let Ae;return O>0?Ae=kt(O,j):Ae=null,Ae===null?(j.needReadable=j.length<=j.highWaterMark,O=0):(j.length-=O,j.multiAwaitDrain?j.awaitDrainWriters.clear():j.awaitDrainWriters=null),j.length===0&&(j.ended||(j.needReadable=!0),_e!==O&&j.ended&&Ye(this)),Ae!==null&&!j.errorEmitted&&!j.closeEmitted&&(j.dataEmitted=!0,this.emit("data",Ae)),Ae};function X(O,j){if(v("onEofChunk"),!j.ended){if(j.decoder){let _e=j.decoder.end();_e&&_e.length&&(j.buffer.push(_e),j.length+=j.objectMode?1:_e.length)}j.ended=!0,j.sync?fe(O):(j.needReadable=!1,j.emittedReadable=!0,Se(O))}}function fe(O){let j=O._readableState;v("emitReadable",j.needReadable,j.emittedReadable),j.needReadable=!1,j.emittedReadable||(v("emitReadable",j.flowing),j.emittedReadable=!0,o.nextTick(Se,O))}function Se(O){let j=O._readableState;v("emitReadable_",j.destroyed,j.length,j.ended),!j.destroyed&&!j.errored&&(j.length||j.ended)&&(O.emit("readable"),j.emittedReadable=!1),j.needReadable=!j.flowing&&!j.ended&&j.length<=j.highWaterMark,Ge(O)}function z(O,j){!j.readingMore&&j.constructed&&(j.readingMore=!0,o.nextTick(ie,O,j))}function ie(O,j){for(;!j.reading&&!j.ended&&(j.length<j.highWaterMark||j.flowing&&j.length===0);){let _e=j.length;if(v("maybeReadMore read 0"),O.read(0),_e===j.length)break}j.readingMore=!1}se.prototype._read=function(O){throw new k("_read()")},se.prototype.pipe=function(O,j){let _e=this,Ee=this._readableState;Ee.pipes.length===1&&(Ee.multiAwaitDrain||(Ee.multiAwaitDrain=!0,Ee.awaitDrainWriters=new d(Ee.awaitDrainWriters?[Ee.awaitDrainWriters]:[]))),Ee.pipes.push(O),v("pipe count=%d opts=%j",Ee.pipes.length,j);let Ae=(!j||j.end!==!1)&&O!==o.stdout&&O!==o.stderr?We:wt;Ee.endEmitted?o.nextTick(Ae):_e.once("end",Ae),O.on("unpipe",je);function je(Xe,tt){v("onunpipe"),Xe===_e&&tt&&tt.hasUnpiped===!1&&(tt.hasUnpiped=!0,Ft())}function We(){v("onend"),O.end()}let Ve,Lt=!1;function Ft(){v("cleanup"),O.removeListener("close",Je),O.removeListener("finish",ht),Ve&&O.removeListener("drain",Ve),O.removeListener("error",vt),O.removeListener("unpipe",je),_e.removeListener("end",We),_e.removeListener("end",wt),_e.removeListener("data",Jt),Lt=!0,Ve&&Ee.awaitDrainWriters&&(!O._writableState||O._writableState.needDrain)&&Ve()}function Dt(){Lt||(Ee.pipes.length===1&&Ee.pipes[0]===O?(v("false write response, pause",0),Ee.awaitDrainWriters=O,Ee.multiAwaitDrain=!1):Ee.pipes.length>1&&Ee.pipes.includes(O)&&(v("false write response, pause",Ee.awaitDrainWriters.size),Ee.awaitDrainWriters.add(O)),_e.pause()),Ve||(Ve=Ie(_e,O),O.on("drain",Ve))}_e.on("data",Jt);function Jt(Xe){v("ondata");let tt=O.write(Xe);v("dest.write",tt),tt===!1&&Dt()}function vt(Xe){if(v("onerror",Xe),wt(),O.removeListener("error",vt),O.listenerCount("error")===0){let tt=O._writableState||O._readableState;tt&&!tt.errorEmitted?R(O,Xe):O.emit("error",Xe)}}S(O,"error",vt);function Je(){O.removeListener("finish",ht),wt()}O.once("close",Je);function ht(){v("onfinish"),O.removeListener("close",Je),wt()}O.once("finish",ht);function wt(){v("unpipe"),_e.unpipe(O)}return O.emit("pipe",_e),O.writableNeedDrain===!0?Dt():Ee.flowing||(v("pipe resume"),_e.resume()),O};function Ie(O,j){return function(){let _e=O._readableState;_e.awaitDrainWriters===j?(v("pipeOnDrain",1),_e.awaitDrainWriters=null):_e.multiAwaitDrain&&(v("pipeOnDrain",_e.awaitDrainWriters.size),_e.awaitDrainWriters.delete(j)),(!_e.awaitDrainWriters||_e.awaitDrainWriters.size===0)&&O.listenerCount("data")&&O.resume()}}se.prototype.unpipe=function(O){let j=this._readableState,_e={hasUnpiped:!1};if(j.pipes.length===0)return this;if(!O){let Ae=j.pipes;j.pipes=[],this.pause();for(let je=0;je<Ae.length;je++)Ae[je].emit("unpipe",this,{hasUnpiped:!1});return this}let Ee=s(j.pipes,O);return Ee===-1?this:(j.pipes.splice(Ee,1),j.pipes.length===0&&this.pause(),O.emit("unpipe",this,_e),this)},se.prototype.on=function(O,j){let _e=b.prototype.on.call(this,O,j),Ee=this._readableState;return O==="data"?(Ee.readableListening=this.listenerCount("readable")>0,Ee.flowing!==!1&&this.resume()):O==="readable"&&!Ee.endEmitted&&!Ee.readableListening&&(Ee.readableListening=Ee.needReadable=!0,Ee.flowing=!1,Ee.emittedReadable=!1,v("on readable",Ee.length,Ee.reading),Ee.length?fe(this):Ee.reading||o.nextTick(Te,this)),_e},se.prototype.addListener=se.prototype.on,se.prototype.removeListener=function(O,j){let _e=b.prototype.removeListener.call(this,O,j);return O==="readable"&&o.nextTick(xe,this),_e},se.prototype.off=se.prototype.removeListener,se.prototype.removeAllListeners=function(O){let j=b.prototype.removeAllListeners.apply(this,arguments);return(O==="readable"||O===void 0)&&o.nextTick(xe,this),j};function xe(O){let j=O._readableState;j.readableListening=O.listenerCount("readable")>0,j.resumeScheduled&&j[V]===!1?j.flowing=!0:O.listenerCount("data")>0?O.resume():j.readableListening||(j.flowing=null)}function Te(O){v("readable nexttick read 0"),O.read(0)}se.prototype.resume=function(){let O=this._readableState;return O.flowing||(v("resume"),O.flowing=!O.readableListening,Oe(this,O)),O[V]=!1,this};function Oe(O,j){j.resumeScheduled||(j.resumeScheduled=!0,o.nextTick(Ke,O,j))}function Ke(O,j){v("resume",j.reading),j.reading||O.read(0),j.resumeScheduled=!1,O.emit("resume"),Ge(O),j.flowing&&!j.reading&&O.read(0)}se.prototype.pause=function(){return v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(v("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[V]=!0,this};function Ge(O){let j=O._readableState;for(v("flow",j.flowing);j.flowing&&O.read()!==null;);}se.prototype.wrap=function(O){let j=!1;O.on("data",Ee=>{!this.push(Ee)&&O.pause&&(j=!0,O.pause())}),O.on("end",()=>{this.push(null)}),O.on("error",Ee=>{R(this,Ee)}),O.on("close",()=>{this.destroy()}),O.on("destroy",()=>{this.destroy()}),this._read=()=>{j&&O.resume&&(j=!1,O.resume())};let _e=e(O);for(let Ee=1;Ee<_e.length;Ee++){let Ae=_e[Ee];this[Ae]===void 0&&typeof O[Ae]=="function"&&(this[Ae]=O[Ae].bind(O))}return this},se.prototype[m]=function(){return Ue(this)},se.prototype.iterator=function(O){return O!==void 0&&Q(O,"options"),Ue(this,O)};function Ue(O,j){typeof O.read!="function"&&(O=se.wrap(O,{objectMode:!0}));let _e=Qe(O,j);return _e.stream=O,_e}async function*Qe(O,j){let _e=Z;function Ee(We){this===O?(_e(),_e=Z):_e=We}O.on("readable",Ee);let Ae,je=I(O,{writable:!1},We=>{Ae=We?P(Ae,We):null,_e(),_e=Z});try{for(;;){let We=O.destroyed?null:O.read();if(We!==null)yield We;else{if(Ae)throw Ae;if(Ae===null)return;await new a(Ee)}}}catch(We){throw Ae=P(Ae,We),Ae}finally{(Ae||j?.destroyOnReturn!==!1)&&(Ae===void 0||O._readableState.autoDestroy)?E.destroyer(O,null):(O.off("readable",Ee),je())}}n(se.prototype,{readable:{__proto__:null,get(){let O=this._readableState;return!!O&&O.readable!==!1&&!O.destroyed&&!O.errorEmitted&&!O.endEmitted},set(O){this._readableState&&(this._readableState.readable=!!O)}},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(O){this._readableState&&(this._readableState.flowing=O)}},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(O){this._readableState&&(this._readableState.destroyed=O)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),n(ve.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[V]!==!1},set(O){this[V]=!!O}}}),se._fromList=kt;function kt(O,j){if(j.length===0)return null;let _e;return j.objectMode?_e=j.buffer.shift():!O||O>=j.length?(j.decoder?_e=j.buffer.join(""):j.buffer.length===1?_e=j.buffer.first():_e=j.buffer.concat(j.length),j.buffer.clear()):_e=j.buffer.consume(O,j.decoder),_e}function Ye(O){let j=O._readableState;v("endReadable",j.endEmitted),j.endEmitted||(j.ended=!0,o.nextTick(ze,j,O))}function ze(O,j){if(v("endReadableNT",O.endEmitted,O.length),!O.errored&&!O.closeEmitted&&!O.endEmitted&&O.length===0){if(O.endEmitted=!0,j.emit("end"),j.writable&&j.allowHalfOpen===!1)o.nextTick(Yt,j);else if(O.autoDestroy){let _e=j._writableState;(!_e||_e.autoDestroy&&(_e.finished||_e.writable===!1))&&j.destroy()}}}function Yt(O){O.writable&&!O.writableEnded&&!O.destroyed&&O.end()}se.from=function(O,j){return D(se,O,j)};var Ot;function Ut(){return Ot===void 0&&(Ot={}),Ot}se.fromWeb=function(O,j){return Ut().newStreamReadableFromReadableStream(O,j)},se.toWeb=function(O,j){return Ut().newReadableStreamFromStreamReadable(O,j)},se.wrap=function(O,j){var _e,Ee;return new se({objectMode:(_e=(Ee=O.readableObjectMode)!==null&&Ee!==void 0?Ee:O.objectMode)!==null&&_e!==void 0?_e:!0,...j,destroy(Ae,je){E.destroyer(O,Ae),je(Ae)}}).wrap(O)}}),Li=de((g,u)=>{le(),ce(),ue();var o=xt(),{ArrayPrototypeSlice:s,Error:f,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:t,ObjectDefineProperties:n,ObjectSetPrototypeOf:e,StringPrototypeToLowerCase:i,Symbol:a,SymbolHasInstance:d}=Me();u.exports=Q,Q.WritableState=B;var{EventEmitter:p}=(It(),Pe(bt)),m=Ui().Stream,{Buffer:c}=(Be(),Pe(Ne)),y=jt(),{addAbortSignal:b}=Tr(),{getHighWaterMark:S,getDefaultHighWaterMark:h}=kr(),{ERR_INVALID_ARG_TYPE:_,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:A,ERR_STREAM_DESTROYED:E,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:C,ERR_STREAM_WRITE_AFTER_END:P,ERR_UNKNOWN_ENCODING:L}=qe().codes,{errorOrDestroy:k}=y;e(Q.prototype,m.prototype),e(Q,m);function q(){}var F=a("kOnFinished");function B(M,W,ee){typeof ee!="boolean"&&(ee=W instanceof st()),this.objectMode=!!(M&&M.objectMode),ee&&(this.objectMode=this.objectMode||!!(M&&M.writableObjectMode)),this.highWaterMark=M?S(this,M,"writableHighWaterMark",ee):h(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let he=!!(M&&M.decodeStrings===!1);this.decodeStrings=!he,this.defaultEncoding=M&&M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=R.bind(void 0,W),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=!M||M.emitClose!==!1,this.autoDestroy=!M||M.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[F]=[]}function ae(M){M.buffered=[],M.bufferedIndex=0,M.allBuffers=!0,M.allNoop=!0}B.prototype.getBuffer=function(){return s(this.buffered,this.bufferedIndex)},t(B.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Q(M){let W=this instanceof st();if(!W&&!r(Q,this))return new Q(M);this._writableState=new B(M,this,W),M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final),typeof M.construct=="function"&&(this._construct=M.construct),M.signal&&b(M.signal,this)),m.call(this,M),y.construct(this,()=>{let ee=this._writableState;ee.writing||we(this,ee),H(this,ee)})}t(Q,d,{__proto__:null,value:function(M){return r(this,M)?!0:this!==Q?!1:M&&M._writableState instanceof B}}),Q.prototype.pipe=function(){k(this,new A)};function V(M,W,ee,he){let pe=M._writableState;if(typeof ee=="function")he=ee,ee=pe.defaultEncoding;else{if(!ee)ee=pe.defaultEncoding;else if(ee!=="buffer"&&!c.isEncoding(ee))throw new L(ee);typeof he!="function"&&(he=q)}if(W===null)throw new C;if(!pe.objectMode)if(typeof W=="string")pe.decodeStrings!==!1&&(W=c.from(W,ee),ee="buffer");else if(W instanceof c)ee="buffer";else if(m._isUint8Array(W))W=m._uint8ArrayToBuffer(W),ee="buffer";else throw new _("chunk",["string","Buffer","Uint8Array"],W);let me;return pe.ending?me=new P:pe.destroyed&&(me=new E("write")),me?(o.nextTick(he,me),k(M,me,!0),me):(pe.pendingcb++,re(M,pe,W,ee,he))}Q.prototype.write=function(M,W,ee){return V(this,M,W,ee)===!0},Q.prototype.cork=function(){this._writableState.corked++},Q.prototype.uncork=function(){let M=this._writableState;M.corked&&(M.corked--,M.writing||we(this,M))},Q.prototype.setDefaultEncoding=function(M){if(typeof M=="string"&&(M=i(M)),!c.isEncoding(M))throw new L(M);return this._writableState.defaultEncoding=M,this};function re(M,W,ee,he,pe){let me=W.objectMode?1:ee.length;W.length+=me;let $=W.length<W.highWaterMark;return $||(W.needDrain=!0),W.writing||W.corked||W.errored||!W.constructed?(W.buffered.push({chunk:ee,encoding:he,callback:pe}),W.allBuffers&&he!=="buffer"&&(W.allBuffers=!1),W.allNoop&&pe!==q&&(W.allNoop=!1)):(W.writelen=me,W.writecb=pe,W.writing=!0,W.sync=!0,M._write(ee,he,W.onwrite),W.sync=!1),$&&!W.errored&&!W.destroyed}function D(M,W,ee,he,pe,me,$){W.writelen=he,W.writecb=$,W.writing=!0,W.sync=!0,W.destroyed?W.onwrite(new E("write")):ee?M._writev(pe,W.onwrite):M._write(pe,me,W.onwrite),W.sync=!1}function Z(M,W,ee,he){--W.pendingcb,he(ee),te(W),k(M,ee)}function R(M,W){let ee=M._writableState,he=ee.sync,pe=ee.writecb;if(typeof pe!="function"){k(M,new v);return}ee.writing=!1,ee.writecb=null,ee.length-=ee.writelen,ee.writelen=0,W?(W.stack,ee.errored||(ee.errored=W),M._readableState&&!M._readableState.errored&&(M._readableState.errored=W),he?o.nextTick(Z,M,ee,W,pe):Z(M,ee,W,pe)):(ee.buffered.length>ee.bufferedIndex&&we(M,ee),he?ee.afterWriteTickInfo!==null&&ee.afterWriteTickInfo.cb===pe?ee.afterWriteTickInfo.count++:(ee.afterWriteTickInfo={count:1,cb:pe,stream:M,state:ee},o.nextTick(J,ee.afterWriteTickInfo)):be(M,ee,1,pe))}function J({stream:M,state:W,count:ee,cb:he}){return W.afterWriteTickInfo=null,be(M,W,ee,he)}function be(M,W,ee,he){for(!W.ending&&!M.destroyed&&W.length===0&&W.needDrain&&(W.needDrain=!1,M.emit("drain"));ee-- >0;)W.pendingcb--,he();W.destroyed&&te(W),H(M,W)}function te(M){if(M.writing)return;for(let pe=M.bufferedIndex;pe<M.buffered.length;++pe){var W;let{chunk:me,callback:$}=M.buffered[pe],ge=M.objectMode?1:me.length;M.length-=ge,$((W=M.errored)!==null&&W!==void 0?W:new E("write"))}let ee=M[F].splice(0);for(let pe=0;pe<ee.length;pe++){var he;ee[pe]((he=M.errored)!==null&&he!==void 0?he:new E("end"))}ae(M)}function we(M,W){if(W.corked||W.bufferProcessing||W.destroyed||!W.constructed)return;let{buffered:ee,bufferedIndex:he,objectMode:pe}=W,me=ee.length-he;if(!me)return;let $=he;if(W.bufferProcessing=!0,me>1&&M._writev){W.pendingcb-=me-1;let ge=W.allNoop?q:se=>{for(let ke=$;ke<ee.length;++ke)ee[ke].callback(se)},ve=W.allNoop&&$===0?ee:s(ee,$);ve.allBuffers=W.allBuffers,D(M,W,!0,W.length,ve,"",ge),ae(W)}else{do{let{chunk:ge,encoding:ve,callback:se}=ee[$];ee[$++]=null;let ke=pe?1:ge.length;D(M,W,!1,ke,ge,ve,se)}while($<ee.length&&!W.writing);$===ee.length?ae(W):$>256?(ee.splice(0,$),W.bufferedIndex=0):W.bufferedIndex=$}W.bufferProcessing=!1}Q.prototype._write=function(M,W,ee){if(this._writev)this._writev([{chunk:M,encoding:W}],ee);else throw new I("_write()")},Q.prototype._writev=null,Q.prototype.end=function(M,W,ee){let he=this._writableState;typeof M=="function"?(ee=M,M=null,W=null):typeof W=="function"&&(ee=W,W=null);let pe;if(M!=null){let me=V(this,M,W);me instanceof f&&(pe=me)}return he.corked&&(he.corked=1,this.uncork()),pe||(!he.errored&&!he.ending?(he.ending=!0,H(this,he,!0),he.ended=!0):he.finished?pe=new T("end"):he.destroyed&&(pe=new E("end"))),typeof ee=="function"&&(pe||he.finished?o.nextTick(ee,pe):he[F].push(ee)),this};function K(M){return M.ending&&!M.destroyed&&M.constructed&&M.length===0&&!M.errored&&M.buffered.length===0&&!M.finished&&!M.writing&&!M.errorEmitted&&!M.closeEmitted}function N(M,W){let ee=!1;function he(pe){if(ee){k(M,pe??v());return}if(ee=!0,W.pendingcb--,pe){let me=W[F].splice(0);for(let $=0;$<me.length;$++)me[$](pe);k(M,pe,W.sync)}else K(W)&&(W.prefinished=!0,M.emit("prefinish"),W.pendingcb++,o.nextTick(G,M,W))}W.sync=!0,W.pendingcb++;try{M._final(he)}catch(pe){he(pe)}W.sync=!1}function ne(M,W){!W.prefinished&&!W.finalCalled&&(typeof M._final=="function"&&!W.destroyed?(W.finalCalled=!0,N(M,W)):(W.prefinished=!0,M.emit("prefinish")))}function H(M,W,ee){K(W)&&(ne(M,W),W.pendingcb===0&&(ee?(W.pendingcb++,o.nextTick((he,pe)=>{K(pe)?G(he,pe):pe.pendingcb--},M,W)):K(W)&&(W.pendingcb++,G(M,W))))}function G(M,W){W.pendingcb--,W.finished=!0;let ee=W[F].splice(0);for(let he=0;he<ee.length;he++)ee[he]();if(M.emit("finish"),W.autoDestroy){let he=M._readableState;(!he||he.autoDestroy&&(he.endEmitted||he.readable===!1))&&M.destroy()}}n(Q.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(M){this._writableState&&(this._writableState.destroyed=M)}},writable:{__proto__:null,get(){let M=this._writableState;return!!M&&M.writable!==!1&&!M.destroyed&&!M.errored&&!M.ending&&!M.ended},set(M){this._writableState&&(this._writableState.writable=!!M)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let M=this._writableState;return M?!M.destroyed&&!M.ending&&M.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var Y=y.destroy;Q.prototype.destroy=function(M,W){let ee=this._writableState;return!ee.destroyed&&(ee.bufferedIndex<ee.buffered.length||ee[F].length)&&o.nextTick(te,ee),Y.call(this,M,W),this},Q.prototype._undestroy=y.undestroy,Q.prototype._destroy=function(M,W){W(M)},Q.prototype[p.captureRejectionSymbol]=function(M){this.destroy(M)};var ye;function oe(){return ye===void 0&&(ye={}),ye}Q.fromWeb=function(M,W){return oe().newStreamWritableFromWritableStream(M,W)},Q.toWeb=function(M){return oe().newWritableStreamFromStreamWritable(M)}}),Ya=de((g,u)=>{le(),ce(),ue();var o=xt(),s=(Be(),Pe(Ne)),{isReadable:f,isWritable:r,isIterable:t,isNodeStream:n,isReadableNodeStream:e,isWritableNodeStream:i,isDuplexNodeStream:a,isReadableStream:d,isWritableStream:p}=ut(),m=mt(),{AbortError:c,codes:{ERR_INVALID_ARG_TYPE:y,ERR_INVALID_RETURN_VALUE:b}}=qe(),{destroyer:S}=jt(),h=st(),_=Or(),I=Li(),{createDeferredPromise:v}=$e(),A=As(),E=globalThis.Blob||s.Blob,T=typeof E<"u"?function(F){return F instanceof E}:function(F){return!1},C=globalThis.AbortController||Kt().AbortController,{FunctionPrototypeCall:P}=Me(),L=class extends h{constructor(F){super(F),F?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),F?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};u.exports=function F(B,ae){if(a(B))return B;if(e(B))return q({readable:B});if(i(B))return q({writable:B});if(n(B))return q({writable:!1,readable:!1});if(d(B))return q({readable:_.fromWeb(B)});if(p(B))return q({writable:I.fromWeb(B)});if(typeof B=="function"){let{value:V,write:re,final:D,destroy:Z}=k(B);if(t(V))return A(L,V,{objectMode:!0,write:re,final:D,destroy:Z});let R=V?.then;if(typeof R=="function"){let J,be=P(R,V,te=>{if(te!=null)throw new b("nully","body",te)},te=>{S(J,te)});return J=new L({objectMode:!0,readable:!1,write:re,final(te){D(async()=>{try{await be,o.nextTick(te,null)}catch(we){o.nextTick(te,we)}})},destroy:Z})}throw new b("Iterable, AsyncIterable or AsyncFunction",ae,V)}if(T(B))return F(B.arrayBuffer());if(t(B))return A(L,B,{objectMode:!0,writable:!1});if(d(B?.readable)&&p(B?.writable))return L.fromWeb(B);if(typeof B?.writable=="object"||typeof B?.readable=="object"){let V=B!=null&&B.readable?e(B?.readable)?B?.readable:F(B.readable):void 0,re=B!=null&&B.writable?i(B?.writable)?B?.writable:F(B.writable):void 0;return q({readable:V,writable:re})}let Q=B?.then;if(typeof Q=="function"){let V;return P(Q,B,re=>{re!=null&&V.push(re),V.push(null)},re=>{S(V,re)}),V=new L({objectMode:!0,writable:!1,read(){}})}throw new y(ae,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],B)};function k(F){let{promise:B,resolve:ae}=v(),Q=new C,V=Q.signal;return{value:F((async function*(){for(;;){let re=B;B=null;let{chunk:D,done:Z,cb:R}=await re;if(o.nextTick(R),Z)return;if(V.aborted)throw new c(void 0,{cause:V.reason});({promise:B,resolve:ae}=v()),yield D}})(),{signal:V}),write(re,D,Z){let R=ae;ae=null,R({chunk:re,done:!1,cb:Z})},final(re){let D=ae;ae=null,D({done:!0,cb:re})},destroy(re,D){Q.abort(),D(re)}}}function q(F){let B=F.readable&&typeof F.readable.read!="function"?_.wrap(F.readable):F.readable,ae=F.writable,Q=!!f(B),V=!!r(ae),re,D,Z,R,J;function be(te){let we=R;R=null,we?we(te):te&&J.destroy(te)}return J=new L({readableObjectMode:!!(B!=null&&B.readableObjectMode),writableObjectMode:!!(ae!=null&&ae.writableObjectMode),readable:Q,writable:V}),V&&(m(ae,te=>{V=!1,te&&S(B,te),be(te)}),J._write=function(te,we,K){ae.write(te,we)?K():re=K},J._final=function(te){ae.end(),D=te},ae.on("drain",function(){if(re){let te=re;re=null,te()}}),ae.on("finish",function(){if(D){let te=D;D=null,te()}})),Q&&(m(B,te=>{Q=!1,te&&S(B,te),be(te)}),B.on("readable",function(){if(Z){let te=Z;Z=null,te()}}),B.on("end",function(){J.push(null)}),J._read=function(){for(;;){let te=B.read();if(te===null){Z=J._read;return}if(!J.push(te))return}}),J._destroy=function(te,we){!te&&R!==null&&(te=new c),Z=null,re=null,D=null,R===null?we(te):(R=we,S(ae,te),S(B,te))},J}}),st=de((g,u)=>{le(),ce(),ue();var{ObjectDefineProperties:o,ObjectGetOwnPropertyDescriptor:s,ObjectKeys:f,ObjectSetPrototypeOf:r}=Me();u.exports=e;var t=Or(),n=Li();r(e.prototype,t.prototype),r(e,t);{let p=f(n.prototype);for(let m=0;m<p.length;m++){let c=p[m];e.prototype[c]||(e.prototype[c]=n.prototype[c])}}function e(p){if(!(this instanceof e))return new e(p);t.call(this,p),n.call(this,p),p?(this.allowHalfOpen=p.allowHalfOpen!==!1,p.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),p.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}o(e.prototype,{writable:{__proto__:null,...s(n.prototype,"writable")},writableHighWaterMark:{__proto__:null,...s(n.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...s(n.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...s(n.prototype,"writableBuffer")},writableLength:{__proto__:null,...s(n.prototype,"writableLength")},writableFinished:{__proto__:null,...s(n.prototype,"writableFinished")},writableCorked:{__proto__:null,...s(n.prototype,"writableCorked")},writableEnded:{__proto__:null,...s(n.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...s(n.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(p){this._readableState&&this._writableState&&(this._readableState.destroyed=p,this._writableState.destroyed=p)}}});var i;function a(){return i===void 0&&(i={}),i}e.fromWeb=function(p,m){return a().newStreamDuplexFromReadableWritablePair(p,m)},e.toWeb=function(p){return a().newReadableWritablePairFromDuplex(p)};var d;e.from=function(p){return d||(d=Ya()),d(p,"body")}}),Is=de((g,u)=>{le(),ce(),ue();var{ObjectSetPrototypeOf:o,Symbol:s}=Me();u.exports=e;var{ERR_METHOD_NOT_IMPLEMENTED:f}=qe().codes,r=st(),{getHighWaterMark:t}=kr();o(e.prototype,r.prototype),o(e,r);var n=s("kCallback");function e(d){if(!(this instanceof e))return new e(d);let p=d?t(this,d,"readableHighWaterMark",!0):null;p===0&&(d={...d,highWaterMark:null,readableHighWaterMark:p,writableHighWaterMark:d.writableHighWaterMark||0}),r.call(this,d),this._readableState.sync=!1,this[n]=null,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",a)}function i(d){typeof this._flush=="function"&&!this.destroyed?this._flush((p,m)=>{if(p){d?d(p):this.destroy(p);return}m!=null&&this.push(m),this.push(null),d&&d()}):(this.push(null),d&&d())}function a(){this._final!==i&&i.call(this)}e.prototype._final=i,e.prototype._transform=function(d,p,m){throw new f("_transform()")},e.prototype._write=function(d,p,m){let c=this._readableState,y=this._writableState,b=c.length;this._transform(d,p,(S,h)=>{if(S){m(S);return}h!=null&&this.push(h),y.ended||b===c.length||c.length<c.highWaterMark?m():this[n]=m})},e.prototype._read=function(){if(this[n]){let d=this[n];this[n]=null,d()}}}),xs=de((g,u)=>{le(),ce(),ue();var{ObjectSetPrototypeOf:o}=Me();u.exports=f;var s=Is();o(f.prototype,s.prototype),o(f,s);function f(r){if(!(this instanceof f))return new f(r);s.call(this,r)}f.prototype._transform=function(r,t,n){n(null,r)}}),Fi=de((g,u)=>{le(),ce(),ue();var o=xt(),{ArrayIsArray:s,Promise:f,SymbolAsyncIterator:r,SymbolDispose:t}=Me(),n=mt(),{once:e}=$e(),i=jt(),a=st(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:p,ERR_INVALID_RETURN_VALUE:m,ERR_MISSING_ARGS:c,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:b},AbortError:S}=qe(),{validateFunction:h,validateAbortSignal:_}=Gt(),{isIterable:I,isReadable:v,isReadableNodeStream:A,isNodeStream:E,isTransformStream:T,isWebStream:C,isReadableStream:P,isReadableFinished:L}=ut(),k=globalThis.AbortController||Kt().AbortController,q,F,B;function ae(te,we,K){let N=!1;te.on("close",()=>{N=!0});let ne=n(te,{readable:we,writable:K},H=>{N=!H});return{destroy:H=>{N||(N=!0,i.destroyer(te,H||new y("pipe")))},cleanup:ne}}function Q(te){return h(te[te.length-1],"streams[stream.length - 1]"),te.pop()}function V(te){if(I(te))return te;if(A(te))return re(te);throw new p("val",["Readable","Iterable","AsyncIterable"],te)}async function*re(te){F||(F=Or()),yield*F.prototype[r].call(te)}async function D(te,we,K,{end:N}){let ne,H=null,G=oe=>{if(oe&&(ne=oe),H){let M=H;H=null,M()}},Y=()=>new f((oe,M)=>{ne?M(ne):H=()=>{ne?M(ne):oe()}});we.on("drain",G);let ye=n(we,{readable:!1},G);try{we.writableNeedDrain&&await Y();for await(let oe of te)we.write(oe)||await Y();N&&(we.end(),await Y()),K()}catch(oe){K(ne!==oe?d(ne,oe):oe)}finally{ye(),we.off("drain",G)}}async function Z(te,we,K,{end:N}){T(we)&&(we=we.writable);let ne=we.getWriter();try{for await(let H of te)await ne.ready,ne.write(H).catch(()=>{});await ne.ready,N&&await ne.close(),K()}catch(H){try{await ne.abort(H),K(H)}catch(G){K(G)}}}function R(...te){return J(te,e(Q(te)))}function J(te,we,K){if(te.length===1&&s(te[0])&&(te=te[0]),te.length<2)throw new c("streams");let N=new k,ne=N.signal,H=K?.signal,G=[];_(H,"options.signal");function Y(){pe(new S)}B=B||$e().addAbortListener;let ye;H&&(ye=B(H,Y));let oe,M,W=[],ee=0;function he(ve){pe(ve,--ee===0)}function pe(ve,se){var ke;if(ve&&(!oe||oe.code==="ERR_STREAM_PREMATURE_CLOSE")&&(oe=ve),!(!oe&&!se)){for(;W.length;)W.shift()(oe);(ke=ye)===null||ke===void 0||ke[t](),N.abort(),se&&(oe||G.forEach(l=>l()),o.nextTick(we,oe,M))}}let me;for(let ve=0;ve<te.length;ve++){let se=te[ve],ke=ve<te.length-1,l=ve>0,w=ke||K?.end!==!1,x=ve===te.length-1;if(E(se)){let U=function(X){X&&X.name!=="AbortError"&&X.code!=="ERR_STREAM_PREMATURE_CLOSE"&&he(X)};if(w){let{destroy:X,cleanup:fe}=ae(se,ke,l);W.push(X),v(se)&&x&&G.push(fe)}se.on("error",U),v(se)&&x&&G.push(()=>{se.removeListener("error",U)})}if(ve===0)if(typeof se=="function"){if(me=se({signal:ne}),!I(me))throw new m("Iterable, AsyncIterable or Stream","source",me)}else I(se)||A(se)||T(se)?me=se:me=a.from(se);else if(typeof se=="function"){if(T(me)){var $;me=V(($=me)===null||$===void 0?void 0:$.readable)}else me=V(me);if(me=se(me,{signal:ne}),ke){if(!I(me,!0))throw new m("AsyncIterable",`transform[${ve-1}]`,me)}else{var ge;q||(q=xs());let U=new q({objectMode:!0}),X=(ge=me)===null||ge===void 0?void 0:ge.then;if(typeof X=="function")ee++,X.call(me,z=>{M=z,z!=null&&U.write(z),w&&U.end(),o.nextTick(he)},z=>{U.destroy(z),o.nextTick(he,z)});else if(I(me,!0))ee++,D(me,U,he,{end:w});else if(P(me)||T(me)){let z=me.readable||me;ee++,D(z,U,he,{end:w})}else throw new m("AsyncIterable or Promise","destination",me);me=U;let{destroy:fe,cleanup:Se}=ae(me,!1,!0);W.push(fe),x&&G.push(Se)}}else if(E(se)){if(A(me)){ee+=2;let U=be(me,se,he,{end:w});v(se)&&x&&G.push(U)}else if(T(me)||P(me)){let U=me.readable||me;ee++,D(U,se,he,{end:w})}else if(I(me))ee++,D(me,se,he,{end:w});else throw new p("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=se}else if(C(se)){if(A(me))ee++,Z(V(me),se,he,{end:w});else if(P(me)||I(me))ee++,Z(me,se,he,{end:w});else if(T(me))ee++,Z(me.readable,se,he,{end:w});else throw new p("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=se}else me=a.from(se)}return(ne!=null&&ne.aborted||H!=null&&H.aborted)&&o.nextTick(Y),me}function be(te,we,K,{end:N}){let ne=!1;if(we.on("close",()=>{ne||K(new b)}),te.pipe(we,{end:!1}),N){let H=function(){ne=!0,we.end()};L(te)?o.nextTick(H):te.once("end",H)}else K();return n(te,{readable:!0,writable:!1},H=>{let G=te._readableState;H&&H.code==="ERR_STREAM_PREMATURE_CLOSE"&&G&&G.ended&&!G.errored&&!G.errorEmitted?te.once("end",K).once("error",K):K(H)}),n(we,{readable:!1,writable:!0},K)}u.exports={pipelineImpl:J,pipeline:R}}),Ts=de((g,u)=>{le(),ce(),ue();var{pipeline:o}=Fi(),s=st(),{destroyer:f}=jt(),{isNodeStream:r,isReadable:t,isWritable:n,isWebStream:e,isTransformStream:i,isWritableStream:a,isReadableStream:d}=ut(),{AbortError:p,codes:{ERR_INVALID_ARG_VALUE:m,ERR_MISSING_ARGS:c}}=qe(),y=mt();u.exports=function(...b){if(b.length===0)throw new c("streams");if(b.length===1)return s.from(b[0]);let S=[...b];if(typeof b[0]=="function"&&(b[0]=s.from(b[0])),typeof b[b.length-1]=="function"){let k=b.length-1;b[k]=s.from(b[k])}for(let k=0;k<b.length;++k)if(!(!r(b[k])&&!e(b[k]))){if(k<b.length-1&&!(t(b[k])||d(b[k])||i(b[k])))throw new m(`streams[${k}]`,S[k],"must be readable");if(k>0&&!(n(b[k])||a(b[k])||i(b[k])))throw new m(`streams[${k}]`,S[k],"must be writable")}let h,_,I,v,A;function E(k){let q=v;v=null,q?q(k):k?A.destroy(k):!L&&!P&&A.destroy()}let T=b[0],C=o(b,E),P=!!(n(T)||a(T)||i(T)),L=!!(t(C)||d(C)||i(C));if(A=new s({writableObjectMode:!!(T!=null&&T.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:P,readable:L}),P){if(r(T))A._write=function(q,F,B){T.write(q,F)?B():h=B},A._final=function(q){T.end(),_=q},T.on("drain",function(){if(h){let q=h;h=null,q()}});else if(e(T)){let q=(i(T)?T.writable:T).getWriter();A._write=async function(F,B,ae){try{await q.ready,q.write(F).catch(()=>{}),ae()}catch(Q){ae(Q)}},A._final=async function(F){try{await q.ready,q.close().catch(()=>{}),_=F}catch(B){F(B)}}}let k=i(C)?C.readable:C;y(k,()=>{if(_){let q=_;_=null,q()}})}if(L){if(r(C))C.on("readable",function(){if(I){let k=I;I=null,k()}}),C.on("end",function(){A.push(null)}),A._read=function(){for(;;){let k=C.read();if(k===null){I=A._read;return}if(!A.push(k))return}};else if(e(C)){let k=(i(C)?C.readable:C).getReader();A._read=async function(){for(;;)try{let{value:q,done:F}=await k.read();if(!A.push(q))return;if(F){A.push(null);return}}catch{return}}}}return A._destroy=function(k,q){!k&&v!==null&&(k=new p),I=null,h=null,_=null,v===null?q(k):(v=q,r(C)&&f(C,k))},A}}),Ja=de((g,u)=>{le(),ce(),ue();var o=globalThis.AbortController||Kt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:s,ERR_INVALID_ARG_TYPE:f,ERR_MISSING_ARGS:r,ERR_OUT_OF_RANGE:t},AbortError:n}=qe(),{validateAbortSignal:e,validateInteger:i,validateObject:a}=Gt(),d=Me().Symbol("kWeak"),p=Me().Symbol("kResistStopPropagation"),{finished:m}=mt(),c=Ts(),{addAbortSignalNoValidate:y}=Tr(),{isWritable:b,isNodeStream:S}=ut(),{deprecate:h}=$e(),{ArrayPrototypePush:_,Boolean:I,MathFloor:v,Number:A,NumberIsNaN:E,Promise:T,PromiseReject:C,PromiseResolve:P,PromisePrototypeThen:L,Symbol:k}=Me(),q=k("kEmpty"),F=k("kEof");function B(H,G){if(G!=null&&a(G,"options"),G?.signal!=null&&e(G.signal,"options.signal"),S(H)&&!b(H))throw new s("stream",H,"must be writable");let Y=c(this,H);return G!=null&&G.signal&&y(G.signal,Y),Y}function ae(H,G){if(typeof H!="function")throw new f("fn",["Function","AsyncFunction"],H);G!=null&&a(G,"options"),G?.signal!=null&&e(G.signal,"options.signal");let Y=1;G?.concurrency!=null&&(Y=v(G.concurrency));let ye=Y-1;return G?.highWaterMark!=null&&(ye=v(G.highWaterMark)),i(Y,"options.concurrency",1),i(ye,"options.highWaterMark",0),ye+=Y,(async function*(){let oe=$e().AbortSignalAny([G?.signal].filter(I)),M=this,W=[],ee={signal:oe},he,pe,me=!1,$=0;function ge(){me=!0,ve()}function ve(){$-=1,se()}function se(){pe&&!me&&$<Y&&W.length<ye&&(pe(),pe=null)}async function ke(){try{for await(let l of M){if(me)return;if(oe.aborted)throw new n;try{if(l=H(l,ee),l===q)continue;l=P(l)}catch(w){l=C(w)}$+=1,L(l,ve,ge),W.push(l),he&&(he(),he=null),!me&&(W.length>=ye||$>=Y)&&await new T(w=>{pe=w})}W.push(F)}catch(l){let w=C(l);L(w,ve,ge),W.push(w)}finally{me=!0,he&&(he(),he=null)}}ke();try{for(;;){for(;W.length>0;){let l=await W[0];if(l===F)return;if(oe.aborted)throw new n;l!==q&&(yield l),W.shift(),se()}await new T(l=>{he=l})}}finally{me=!0,pe&&(pe(),pe=null)}}).call(this)}function Q(H=void 0){return H!=null&&a(H,"options"),H?.signal!=null&&e(H.signal,"options.signal"),(async function*(){let G=0;for await(let ye of this){var Y;if(H!=null&&(Y=H.signal)!==null&&Y!==void 0&&Y.aborted)throw new n({cause:H.signal.reason});yield[G++,ye]}}).call(this)}async function V(H,G=void 0){for await(let Y of R.call(this,H,G))return!0;return!1}async function re(H,G=void 0){if(typeof H!="function")throw new f("fn",["Function","AsyncFunction"],H);return!await V.call(this,async(...Y)=>!await H(...Y),G)}async function D(H,G){for await(let Y of R.call(this,H,G))return Y}async function Z(H,G){if(typeof H!="function")throw new f("fn",["Function","AsyncFunction"],H);async function Y(ye,oe){return await H(ye,oe),q}for await(let ye of ae.call(this,Y,G));}function R(H,G){if(typeof H!="function")throw new f("fn",["Function","AsyncFunction"],H);async function Y(ye,oe){return await H(ye,oe)?ye:q}return ae.call(this,Y,G)}var J=class extends r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function be(H,G,Y){var ye;if(typeof H!="function")throw new f("reducer",["Function","AsyncFunction"],H);Y!=null&&a(Y,"options"),Y?.signal!=null&&e(Y.signal,"options.signal");let oe=arguments.length>1;if(Y!=null&&(ye=Y.signal)!==null&&ye!==void 0&&ye.aborted){let pe=new n(void 0,{cause:Y.signal.reason});throw this.once("error",()=>{}),await m(this.destroy(pe)),pe}let M=new o,W=M.signal;if(Y!=null&&Y.signal){let pe={once:!0,[d]:this,[p]:!0};Y.signal.addEventListener("abort",()=>M.abort(),pe)}let ee=!1;try{for await(let pe of this){var he;if(ee=!0,Y!=null&&(he=Y.signal)!==null&&he!==void 0&&he.aborted)throw new n;oe?G=await H(G,pe,{signal:W}):(G=pe,oe=!0)}if(!ee&&!oe)throw new J}finally{M.abort()}return G}async function te(H){H!=null&&a(H,"options"),H?.signal!=null&&e(H.signal,"options.signal");let G=[];for await(let ye of this){var Y;if(H!=null&&(Y=H.signal)!==null&&Y!==void 0&&Y.aborted)throw new n(void 0,{cause:H.signal.reason});_(G,ye)}return G}function we(H,G){let Y=ae.call(this,H,G);return(async function*(){for await(let ye of Y)yield*ye}).call(this)}function K(H){if(H=A(H),E(H))return 0;if(H<0)throw new t("number",">= 0",H);return H}function N(H,G=void 0){return G!=null&&a(G,"options"),G?.signal!=null&&e(G.signal,"options.signal"),H=K(H),(async function*(){var Y;if(G!=null&&(Y=G.signal)!==null&&Y!==void 0&&Y.aborted)throw new n;for await(let oe of this){var ye;if(G!=null&&(ye=G.signal)!==null&&ye!==void 0&&ye.aborted)throw new n;H--<=0&&(yield oe)}}).call(this)}function ne(H,G=void 0){return G!=null&&a(G,"options"),G?.signal!=null&&e(G.signal,"options.signal"),H=K(H),(async function*(){var Y;if(G!=null&&(Y=G.signal)!==null&&Y!==void 0&&Y.aborted)throw new n;for await(let oe of this){var ye;if(G!=null&&(ye=G.signal)!==null&&ye!==void 0&&ye.aborted)throw new n;if(H-- >0&&(yield oe),H<=0)return}}).call(this)}u.exports.streamReturningOperators={asIndexedPairs:h(Q,"readable.asIndexedPairs will be removed in a future version."),drop:N,filter:R,flatMap:we,map:ae,take:ne,compose:B},u.exports.promiseReturningOperators={every:re,forEach:Z,reduce:be,toArray:te,some:V,find:D}}),ks=de((g,u)=>{le(),ce(),ue();var{ArrayPrototypePop:o,Promise:s}=Me(),{isIterable:f,isNodeStream:r,isWebStream:t}=ut(),{pipelineImpl:n}=Fi(),{finished:e}=mt();Os();function i(...a){return new s((d,p)=>{let m,c,y=a[a.length-1];if(y&&typeof y=="object"&&!r(y)&&!f(y)&&!t(y)){let b=o(a);m=b.signal,c=b.end}n(a,(b,S)=>{b?p(b):d(S)},{signal:m,end:c})})}u.exports={finished:e,pipeline:i}}),Os=de((g,u)=>{le(),ce(),ue();var{Buffer:o}=(Be(),Pe(Ne)),{ObjectDefineProperty:s,ObjectKeys:f,ReflectApply:r}=Me(),{promisify:{custom:t}}=$e(),{streamReturningOperators:n,promiseReturningOperators:e}=Ja(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:i}}=qe(),a=Ts(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:p}=kr(),{pipeline:m}=Fi(),{destroyer:c}=jt(),y=mt(),b=ks(),S=ut(),h=u.exports=Ui().Stream;h.isDestroyed=S.isDestroyed,h.isDisturbed=S.isDisturbed,h.isErrored=S.isErrored,h.isReadable=S.isReadable,h.isWritable=S.isWritable,h.Readable=Or();for(let I of f(n)){let v=function(...E){if(new.target)throw i();return h.Readable.from(r(A,this,E))},A=n[I];s(v,"name",{__proto__:null,value:A.name}),s(v,"length",{__proto__:null,value:A.length}),s(h.Readable.prototype,I,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let I of f(e)){let v=function(...E){if(new.target)throw i();return r(A,this,E)},A=e[I];s(v,"name",{__proto__:null,value:A.name}),s(v,"length",{__proto__:null,value:A.length}),s(h.Readable.prototype,I,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}h.Writable=Li(),h.Duplex=st(),h.Transform=Is(),h.PassThrough=xs(),h.pipeline=m;var{addAbortSignal:_}=Tr();h.addAbortSignal=_,h.finished=y,h.destroy=c,h.compose=a,h.setDefaultHighWaterMark=d,h.getDefaultHighWaterMark=p,s(h,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return b}}),s(m,t,{__proto__:null,enumerable:!0,get(){return b.pipeline}}),s(y,t,{__proto__:null,enumerable:!0,get(){return b.finished}}),h.Stream=h,h._isUint8Array=function(I){return I instanceof Uint8Array},h._uint8ArrayToBuffer=function(I){return o.from(I.buffer,I.byteOffset,I.byteLength)}}),Tt=de((g,u)=>{le(),ce(),ue();var o=Os(),s=ks(),f=o.Readable.destroy;u.exports=o.Readable,u.exports._uint8ArrayToBuffer=o._uint8ArrayToBuffer,u.exports._isUint8Array=o._isUint8Array,u.exports.isDisturbed=o.isDisturbed,u.exports.isErrored=o.isErrored,u.exports.isReadable=o.isReadable,u.exports.Readable=o.Readable,u.exports.Writable=o.Writable,u.exports.Duplex=o.Duplex,u.exports.Transform=o.Transform,u.exports.PassThrough=o.PassThrough,u.exports.addAbortSignal=o.addAbortSignal,u.exports.finished=o.finished,u.exports.destroy=o.destroy,u.exports.destroy=f,u.exports.pipeline=o.pipeline,u.exports.compose=o.compose,Object.defineProperty(o,"promises",{configurable:!0,enumerable:!0,get(){return s}}),u.exports.Stream=o.Stream,u.exports.default=u.exports}),Xa=de((g,u)=>{le(),ce(),ue(),typeof Object.create=="function"?u.exports=function(o,s){s&&(o.super_=s,o.prototype=Object.create(s.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:u.exports=function(o,s){if(s){o.super_=s;var f=function(){};f.prototype=s.prototype,o.prototype=new f,o.prototype.constructor=o}}}),Za=de((g,u)=>{le(),ce(),ue();var{Buffer:o}=(Be(),Pe(Ne)),s=Symbol.for("BufferList");function f(r){if(!(this instanceof f))return new f(r);f._init.call(this,r)}f._init=function(r){Object.defineProperty(this,s,{value:!0}),this._bufs=[],this.length=0,r&&this.append(r)},f.prototype._new=function(r){return new f(r)},f.prototype._offset=function(r){if(r===0)return[0,0];let t=0;for(let n=0;n<this._bufs.length;n++){let e=t+this._bufs[n].length;if(r<e||n===this._bufs.length-1)return[n,r-t];t=e}},f.prototype._reverseOffset=function(r){let t=r[0],n=r[1];for(let e=0;e<t;e++)n+=this._bufs[e].length;return n},f.prototype.getBuffers=function(){return this._bufs},f.prototype.get=function(r){if(r>this.length||r<0)return;let t=this._offset(r);return this._bufs[t[0]][t[1]]},f.prototype.slice=function(r,t){return typeof r=="number"&&r<0&&(r+=this.length),typeof t=="number"&&t<0&&(t+=this.length),this.copy(null,0,r,t)},f.prototype.copy=function(r,t,n,e){if((typeof n!="number"||n<0)&&(n=0),(typeof e!="number"||e>this.length)&&(e=this.length),n>=this.length||e<=0)return r||o.alloc(0);let i=!!r,a=this._offset(n),d=e-n,p=d,m=i&&t||0,c=a[1];if(n===0&&e===this.length){if(!i)return this._bufs.length===1?this._bufs[0]:o.concat(this._bufs,this.length);for(let y=0;y<this._bufs.length;y++)this._bufs[y].copy(r,m),m+=this._bufs[y].length;return r}if(p<=this._bufs[a[0]].length-c)return i?this._bufs[a[0]].copy(r,t,c,c+p):this._bufs[a[0]].slice(c,c+p);i||(r=o.allocUnsafe(d));for(let y=a[0];y<this._bufs.length;y++){let b=this._bufs[y].length-c;if(p>b)this._bufs[y].copy(r,m,c),m+=b;else{this._bufs[y].copy(r,m,c,c+p),m+=b;break}p-=b,c&&(c=0)}return r.length>m?r.slice(0,m):r},f.prototype.shallowSlice=function(r,t){if(r=r||0,t=typeof t!="number"?this.length:t,r<0&&(r+=this.length),t<0&&(t+=this.length),r===t)return this._new();let n=this._offset(r),e=this._offset(t),i=this._bufs.slice(n[0],e[0]+1);return e[1]===0?i.pop():i[i.length-1]=i[i.length-1].slice(0,e[1]),n[1]!==0&&(i[0]=i[0].slice(n[1])),this._new(i)},f.prototype.toString=function(r,t,n){return this.slice(t,n).toString(r)},f.prototype.consume=function(r){if(r=Math.trunc(r),Number.isNaN(r)||r<=0)return this;for(;this._bufs.length;)if(r>=this._bufs[0].length)r-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(r),this.length-=r;break}return this},f.prototype.duplicate=function(){let r=this._new();for(let t=0;t<this._bufs.length;t++)r.append(this._bufs[t]);return r},f.prototype.append=function(r){return this._attach(r,f.prototype._appendBuffer)},f.prototype.prepend=function(r){return this._attach(r,f.prototype._prependBuffer,!0)},f.prototype._attach=function(r,t,n){if(r==null)return this;if(r.buffer)t.call(this,o.from(r.buffer,r.byteOffset,r.byteLength));else if(Array.isArray(r)){let[e,i]=n?[r.length-1,-1]:[0,1];for(let a=e;a>=0&&a<r.length;a+=i)this._attach(r[a],t,n)}else if(this._isBufferList(r)){let[e,i]=n?[r._bufs.length-1,-1]:[0,1];for(let a=e;a>=0&&a<r._bufs.length;a+=i)this._attach(r._bufs[a],t,n)}else typeof r=="number"&&(r=r.toString()),t.call(this,o.from(r));return this},f.prototype._appendBuffer=function(r){this._bufs.push(r),this.length+=r.length},f.prototype._prependBuffer=function(r){this._bufs.unshift(r),this.length+=r.length},f.prototype.indexOf=function(r,t,n){if(n===void 0&&typeof t=="string"&&(n=t,t=void 0),typeof r=="function"||Array.isArray(r))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof r=="number"?r=o.from([r]):typeof r=="string"?r=o.from(r,n):this._isBufferList(r)?r=r.slice():Array.isArray(r.buffer)?r=o.from(r.buffer,r.byteOffset,r.byteLength):o.isBuffer(r)||(r=o.from(r)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),r.length===0)return t>this.length?this.length:t;let e=this._offset(t),i=e[0],a=e[1];for(;i<this._bufs.length;i++){let d=this._bufs[i];for(;a<d.length;)if(d.length-a>=r.length){let p=d.indexOf(r,a);if(p!==-1)return this._reverseOffset([i,p]);a=d.length-r.length+1}else{let p=this._reverseOffset([i,a]);if(this._match(p,r))return p;a++}a=0}return-1},f.prototype._match=function(r,t){if(this.length-r<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(r+n)!==t[n])return!1;return!0},(function(){let r={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readBigInt64BE:8,readBigInt64LE:8,readBigUInt64BE:8,readBigUInt64LE:8,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let t in r)(function(n){r[n]===null?f.prototype[n]=function(e,i){return this.slice(e,e+i)[n](0,i)}:f.prototype[n]=function(e=0){return this.slice(e,e+r[n])[n](0)}})(t)})(),f.prototype._isBufferList=function(r){return r instanceof f||f.isBufferList(r)},f.isBufferList=function(r){return r!=null&&r[s]},u.exports=f}),el=de((g,u)=>{le(),ce(),ue();var o=Tt().Duplex,s=Xa(),f=Za();function r(t){if(!(this instanceof r))return new r(t);if(typeof t=="function"){this._callback=t;let n=(function(e){this._callback&&(this._callback(e),this._callback=null)}).bind(this);this.on("pipe",function(e){e.on("error",n)}),this.on("unpipe",function(e){e.removeListener("error",n)}),t=null}f._init.call(this,t),o.call(this)}s(r,o),Object.assign(r.prototype,f.prototype),r.prototype._new=function(t){return new r(t)},r.prototype._write=function(t,n,e){this._appendBuffer(t),typeof e=="function"&&e()},r.prototype._read=function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},r.prototype.end=function(t){o.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},r.prototype._destroy=function(t,n){this._bufs.length=0,this.length=0,n(t)},r.prototype._isBufferList=function(t){return t instanceof r||t instanceof f||r.isBufferList(t)},r.isBufferList=f.isBufferList,u.exports=r,u.exports.BufferListStream=r,u.exports.BufferList=f}),tl=de((g,u)=>{le(),ce(),ue();var o=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};u.exports=o}),Ps=de((g,u)=>{le(),ce(),ue();var o=u.exports,{Buffer:s}=(Be(),Pe(Ne));o.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"},o.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},o.requiredHeaderFlagsErrors={};for(let r in o.requiredHeaderFlags){let t=o.requiredHeaderFlags[r];o.requiredHeaderFlagsErrors[r]="Invalid header flag bits, must be 0x"+t.toString(16)+" for "+o.types[r]+" packet"}o.codes={};for(let r in o.types){let t=o.types[r];o.codes[t]=r}o.CMD_SHIFT=4,o.CMD_MASK=240,o.DUP_MASK=8,o.QOS_MASK=3,o.QOS_SHIFT=1,o.RETAIN_MASK=1,o.VARBYTEINT_MASK=127,o.VARBYTEINT_FIN_MASK=128,o.VARBYTEINT_MAX=268435455,o.SESSIONPRESENT_MASK=1,o.SESSIONPRESENT_HEADER=s.from([o.SESSIONPRESENT_MASK]),o.CONNACK_HEADER=s.from([o.codes.connack<<o.CMD_SHIFT]),o.USERNAME_MASK=128,o.PASSWORD_MASK=64,o.WILL_RETAIN_MASK=32,o.WILL_QOS_MASK=24,o.WILL_QOS_SHIFT=3,o.WILL_FLAG_MASK=4,o.CLEAN_SESSION_MASK=2,o.CONNECT_HEADER=s.from([o.codes.connect<<o.CMD_SHIFT]),o.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},o.propertiesCodes={};for(let r in o.properties){let t=o.properties[r];o.propertiesCodes[t]=r}o.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function f(r){return[0,1,2].map(t=>[0,1].map(n=>[0,1].map(e=>{let i=s.alloc(1);return i.writeUInt8(o.codes[r]<<o.CMD_SHIFT|(n?o.DUP_MASK:0)|t<<o.QOS_SHIFT|e,0,!0),i})))}o.PUBLISH_HEADER=f("publish"),o.SUBSCRIBE_HEADER=f("subscribe"),o.SUBSCRIBE_OPTIONS_QOS_MASK=3,o.SUBSCRIBE_OPTIONS_NL_MASK=1,o.SUBSCRIBE_OPTIONS_NL_SHIFT=2,o.SUBSCRIBE_OPTIONS_RAP_MASK=1,o.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,o.SUBSCRIBE_OPTIONS_RH_MASK=3,o.SUBSCRIBE_OPTIONS_RH_SHIFT=4,o.SUBSCRIBE_OPTIONS_RH=[0,16,32],o.SUBSCRIBE_OPTIONS_NL=4,o.SUBSCRIBE_OPTIONS_RAP=8,o.SUBSCRIBE_OPTIONS_QOS=[0,1,2],o.UNSUBSCRIBE_HEADER=f("unsubscribe"),o.ACKS={unsuback:f("unsuback"),puback:f("puback"),pubcomp:f("pubcomp"),pubrel:f("pubrel"),pubrec:f("pubrec")},o.SUBACK_HEADER=s.from([o.codes.suback<<o.CMD_SHIFT]),o.VERSION3=s.from([3]),o.VERSION4=s.from([4]),o.VERSION5=s.from([5]),o.VERSION131=s.from([131]),o.VERSION132=s.from([132]),o.QOS=[0,1,2].map(r=>s.from([r])),o.EMPTY={pingreq:s.from([o.codes.pingreq<<4,0]),pingresp:s.from([o.codes.pingresp<<4,0]),disconnect:s.from([o.codes.disconnect<<4,0])},o.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"},o.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},o.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"},o.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"},o.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"},o.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}}),rl=de((g,u)=>{le(),ce(),ue();var o=1e3,s=o*60,f=s*60,r=f*24,t=r*7,n=r*365.25;u.exports=function(p,m){m=m||{};var c=typeof p;if(c==="string"&&p.length>0)return e(p);if(c==="number"&&isFinite(p))return m.long?a(p):i(p);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(p))};function e(p){if(p=String(p),!(p.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(p);if(m){var c=parseFloat(m[1]),y=(m[2]||"ms").toLowerCase();switch(y){case"years":case"year":case"yrs":case"yr":case"y":return c*n;case"weeks":case"week":case"w":return c*t;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*f;case"minutes":case"minute":case"mins":case"min":case"m":return c*s;case"seconds":case"second":case"secs":case"sec":case"s":return c*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}function i(p){var m=Math.abs(p);return m>=r?Math.round(p/r)+"d":m>=f?Math.round(p/f)+"h":m>=s?Math.round(p/s)+"m":m>=o?Math.round(p/o)+"s":p+"ms"}function a(p){var m=Math.abs(p);return m>=r?d(p,m,r,"day"):m>=f?d(p,m,f,"hour"):m>=s?d(p,m,s,"minute"):m>=o?d(p,m,o,"second"):p+" ms"}function d(p,m,c,y){var b=m>=c*1.5;return Math.round(p/c)+" "+y+(b?"s":"")}}),nl=de((g,u)=>{le(),ce(),ue();function o(s){r.debug=r,r.default=r,r.coerce=d,r.disable=i,r.enable=n,r.enabled=a,r.humanize=rl(),r.destroy=p,Object.keys(s).forEach(m=>{r[m]=s[m]}),r.names=[],r.skips=[],r.formatters={};function f(m){let c=0;for(let y=0;y<m.length;y++)c=(c<<5)-c+m.charCodeAt(y),c|=0;return r.colors[Math.abs(c)%r.colors.length]}r.selectColor=f;function r(m){let c,y=null,b,S;function h(..._){if(!h.enabled)return;let I=h,v=Number(new Date),A=v-(c||v);I.diff=A,I.prev=c,I.curr=v,c=v,_[0]=r.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let E=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(T,C)=>{if(T==="%%")return"%";E++;let P=r.formatters[C];if(typeof P=="function"){let L=_[E];T=P.call(I,L),_.splice(E,1),E--}return T}),r.formatArgs.call(I,_),(I.log||r.log).apply(I,_)}return h.namespace=m,h.useColors=r.useColors(),h.color=r.selectColor(m),h.extend=t,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(b!==r.namespaces&&(b=r.namespaces,S=r.enabled(m)),S),set:_=>{y=_}}),typeof r.init=="function"&&r.init(h),h}function t(m,c){let y=r(this.namespace+(typeof c>"u"?":":c)+m);return y.log=this.log,y}function n(m){r.save(m),r.namespaces=m,r.names=[],r.skips=[];let c=(typeof m=="string"?m:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let y of c)y[0]==="-"?r.skips.push(y.slice(1)):r.names.push(y)}function e(m,c){let y=0,b=0,S=-1,h=0;for(;y<m.length;)if(b<c.length&&(c[b]===m[y]||c[b]==="*"))c[b]==="*"?(S=b,h=y,b++):(y++,b++);else if(S!==-1)b=S+1,h++,y=h;else return!1;for(;b<c.length&&c[b]==="*";)b++;return b===c.length}function i(){let m=[...r.names,...r.skips.map(c=>"-"+c)].join(",");return r.enable(""),m}function a(m){for(let c of r.skips)if(e(m,c))return!1;for(let c of r.names)if(e(m,c))return!0;return!1}function d(m){return m instanceof Error?m.stack||m.message:m}function p(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}u.exports=o}),at=de((g,u)=>{le(),ce(),ue(),g.formatArgs=s,g.save=f,g.load=r,g.useColors=o,g.storage=t(),g.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})(),g.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 o(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return 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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+u.exports.humanize(this.diff),!this.useColors)return;let i="color: "+this.color;e.splice(1,0,i,"color: inherit");let a=0,d=0;e[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(a++,p==="%c"&&(d=a))}),e.splice(d,0,i)}g.log=console.debug||console.log||(()=>{});function f(e){try{e?g.storage.setItem("debug",e):g.storage.removeItem("debug")}catch{}}function r(){let e;try{e=g.storage.getItem("debug")||g.storage.getItem("DEBUG")}catch{}return!e&&typeof Re<"u"&&"env"in Re&&(e=Re.env.DEBUG),e}function t(){try{return localStorage}catch{}}u.exports=nl()(g);var{formatters:n}=u.exports;n.j=function(e){try{return JSON.stringify(e)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}}}),il=de((g,u)=>{le(),ce(),ue();var o=el(),{EventEmitter:s}=(It(),Pe(bt)),f=tl(),r=Ps(),t=at()("mqtt-packet:parser"),n=class zn extends s{constructor(){super(),this.parser=this.constructor.parser}static parser(i){return this instanceof zn?(this.settings=i||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new zn().parser(i)}_resetState(){t("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new f,this.error=null,this._list=o(),this._stateCounter=0}parse(i){for(this.error&&this._resetState(),this._list.append(i),t("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++,t("parse: state complete. _stateCounter is now: %d",this._stateCounter),t("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return t("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let i=this._list.readUInt8(0),a=i>>r.CMD_SHIFT;this.packet.cmd=r.types[a];let d=i&15,p=r.requiredHeaderFlags[a];return p!=null&&d!==p?this._emitError(new Error(r.requiredHeaderFlagsErrors[a])):(this.packet.retain=(i&r.RETAIN_MASK)!==0,this.packet.qos=i>>r.QOS_SHIFT&r.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(i&r.DUP_MASK)!==0,t("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let i=this._parseVarByteNum(!0);return i&&(this.packet.length=i.value,this._list.consume(i.bytes)),t("_parseLength %d",i.value),!!i}_parsePayload(){t("_parsePayload: payload %O",this._list);let i=!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"))}i=!0}return t("_parsePayload complete result: %s",i),i}_parseConnect(){t("_parseConnect");let i,a,d,p,m={},c=this.packet,y=this._parseString();if(y===null)return this._emitError(new Error("Cannot parse protocolId"));if(y!=="MQTT"&&y!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(c.protocolId=y,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(c.protocolVersion=this._list.readUInt8(this._pos),c.protocolVersion>=128&&(c.bridgeMode=!0,c.protocolVersion=c.protocolVersion-128),c.protocolVersion!==3&&c.protocolVersion!==4&&c.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)&r.USERNAME_MASK,m.password=this._list.readUInt8(this._pos)&r.PASSWORD_MASK,m.will=this._list.readUInt8(this._pos)&r.WILL_FLAG_MASK;let b=!!(this._list.readUInt8(this._pos)&r.WILL_RETAIN_MASK),S=(this._list.readUInt8(this._pos)&r.WILL_QOS_MASK)>>r.WILL_QOS_SHIFT;if(m.will)c.will={},c.will.retain=b,c.will.qos=S;else{if(b)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(S)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(c.clean=(this._list.readUInt8(this._pos)&r.CLEAN_SESSION_MASK)!==0,this._pos++,c.keepalive=this._parseNum(),c.keepalive===-1)return this._emitError(new Error("Packet too short"));if(c.protocolVersion===5){let _=this._parseProperties();Object.getOwnPropertyNames(_).length&&(c.properties=_)}let h=this._parseString();if(h===null)return this._emitError(new Error("Packet too short"));if(c.clientId=h,t("_parseConnect: packet.clientId: %s",c.clientId),m.will){if(c.protocolVersion===5){let _=this._parseProperties();Object.getOwnPropertyNames(_).length&&(c.will.properties=_)}if(i=this._parseString(),i===null)return this._emitError(new Error("Cannot parse will topic"));if(c.will.topic=i,t("_parseConnect: packet.will.topic: %s",c.will.topic),a=this._parseBuffer(),a===null)return this._emitError(new Error("Cannot parse will payload"));c.will.payload=a,t("_parseConnect: packet.will.paylaod: %s",c.will.payload)}if(m.username){if(p=this._parseString(),p===null)return this._emitError(new Error("Cannot parse username"));c.username=p,t("_parseConnect: packet.username: %s",c.username)}if(m.password){if(d=this._parseBuffer(),d===null)return this._emitError(new Error("Cannot parse password"));c.password=d}return this.settings=c,t("_parseConnect: complete"),c}_parseConnack(){t("_parseConnack");let i=this.packet;if(this._list.length<1)return null;let a=this._list.readUInt8(this._pos++);if(a>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(i.sessionPresent=!!(a&r.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?i.reasonCode=this._list.readUInt8(this._pos++):i.reasonCode=0;else{if(this._list.length<2)return null;i.returnCode=this._list.readUInt8(this._pos++)}if(i.returnCode===-1||i.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(i.properties=d)}t("_parseConnack: complete")}_parsePublish(){t("_parsePublish");let i=this.packet;if(i.topic=this._parseString(),i.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(i.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let a=this._parseProperties();Object.getOwnPropertyNames(a).length&&(i.properties=a)}i.payload=this._list.slice(this._pos,i.length),t("_parsePublish: payload from buffer list: %o",i.payload)}}_parseSubscribe(){t("_parseSubscribe");let i=this.packet,a,d,p,m,c,y,b;if(i.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let S=this._parseProperties();Object.getOwnPropertyNames(S).length&&(i.properties=S)}if(i.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<i.length;){if(a=this._parseString(),a===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=i.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(d=this._parseByte(),this.settings.protocolVersion===5){if(d&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(d&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(p=d&r.SUBSCRIBE_OPTIONS_QOS_MASK,p>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(y=(d>>r.SUBSCRIBE_OPTIONS_NL_SHIFT&r.SUBSCRIBE_OPTIONS_NL_MASK)!==0,c=(d>>r.SUBSCRIBE_OPTIONS_RAP_SHIFT&r.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,m=d>>r.SUBSCRIBE_OPTIONS_RH_SHIFT&r.SUBSCRIBE_OPTIONS_RH_MASK,m>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));b={topic:a,qos:p},this.settings.protocolVersion===5?(b.nl=y,b.rap=c,b.rh=m):this.settings.bridgeMode&&(b.rh=0,b.rap=!0,b.nl=!0),t("_parseSubscribe: push subscription `%s` to subscription",b),i.subscriptions.push(b)}}}_parseSuback(){t("_parseSuback");let i=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let a=this._parseProperties();Object.getOwnPropertyNames(a).length&&(i.properties=a)}if(i.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let a=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!r.MQTT5_SUBACK_CODES[a])return this._emitError(new Error("Invalid suback code"))}else if(a>2&&a!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(a)}}}_parseUnsubscribe(){t("_parseUnsubscribe");let i=this.packet;if(i.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let a=this._parseProperties();Object.getOwnPropertyNames(a).length&&(i.properties=a)}if(i.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<i.length;){let a=this._parseString();if(a===null)return this._emitError(new Error("Cannot parse topic"));t("_parseUnsubscribe: push topic `%s` to unsubscriptions",a),i.unsubscriptions.push(a)}}}_parseUnsuback(){t("_parseUnsuback");let i=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&i.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(i.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){let a=this._parseProperties();for(Object.getOwnPropertyNames(a).length&&(i.properties=a),i.granted=[];this._pos<this.packet.length;){let d=this._list.readUInt8(this._pos++);if(!r.MQTT5_UNSUBACK_CODES[d])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(d)}}}_parseConfirmation(){t("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let i=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(i.length>2){switch(i.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!r.MQTT5_PUBACK_PUBREC_CODES[i.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!r.MQTT5_PUBREL_PUBCOMP_CODES[i.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}t("_parseConfirmation: packet.reasonCode `%d`",i.reasonCode)}else i.reasonCode=0;if(i.length>3){let a=this._parseProperties();Object.getOwnPropertyNames(a).length&&(i.properties=a)}}return!0}_parseDisconnect(){let i=this.packet;if(t("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(i.reasonCode=this._parseByte(),r.MQTT5_DISCONNECT_CODES[i.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):i.reasonCode=0;let a=this._parseProperties();Object.getOwnPropertyNames(a).length&&(i.properties=a)}return t("_parseDisconnect result: true"),!0}_parseAuth(){t("_parseAuth");let i=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(i.reasonCode=this._parseByte(),!r.MQTT5_AUTH_CODES[i.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let a=this._parseProperties();return Object.getOwnPropertyNames(a).length&&(i.properties=a),t("_parseAuth: result: true"),!0}_parseMessageId(){let i=this.packet;return i.messageId=this._parseNum(),i.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(t("_parseMessageId: packet.messageId %d",i.messageId),!0)}_parseString(i){let a=this._parseNum(),d=a+this._pos;if(a===-1||d>this._list.length||d>this.packet.length)return null;let p=this._list.toString("utf8",this._pos,d);return this._pos+=a,t("_parseString: result: %s",p),p}_parseStringPair(){return t("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let i=this._parseNum(),a=i+this._pos;if(i===-1||a>this._list.length||a>this.packet.length)return null;let d=this._list.slice(this._pos,a);return this._pos+=i,t("_parseBuffer: result: %o",d),d}_parseNum(){if(this._list.length-this._pos<2)return-1;let i=this._list.readUInt16BE(this._pos);return this._pos+=2,t("_parseNum: result: %s",i),i}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let i=this._list.readUInt32BE(this._pos);return this._pos+=4,t("_parse4ByteNum: result: %s",i),i}_parseVarByteNum(i){t("_parseVarByteNum");let a=4,d=0,p=1,m=0,c=!1,y,b=this._pos?this._pos:0;for(;d<a&&b+d<this._list.length;){if(y=this._list.readUInt8(b+d++),m+=p*(y&r.VARBYTEINT_MASK),p*=128,(y&r.VARBYTEINT_FIN_MASK)===0){c=!0;break}if(this._list.length<=d)break}return!c&&d===a&&this._list.length>=d&&this._emitError(new Error("Invalid variable byte integer")),b&&(this._pos+=d),c?i?c={bytes:d,value:m}:c=m:c=!1,t("_parseVarByteNum: result: %o",c),c}_parseByte(){let i;return this._pos<this._list.length&&(i=this._list.readUInt8(this._pos),this._pos++),t("_parseByte: result: %o",i),i}_parseByType(i){switch(t("_parseByType: type: %s",i),i){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){t("_parseProperties");let i=this._parseVarByteNum(),a=this._pos+i,d={};for(;this._pos<a;){let p=this._parseByte();if(!p)return this._emitError(new Error("Cannot parse property code type")),!1;let m=r.propertiesCodes[p];if(!m)return this._emitError(new Error("Unknown property")),!1;if(m==="userProperties"){d[m]||(d[m]=Object.create(null));let c=this._parseByType(r.propertiesTypes[m]);if(d[m][c.name])if(Array.isArray(d[m][c.name]))d[m][c.name].push(c.value);else{let y=d[m][c.name];d[m][c.name]=[y],d[m][c.name].push(c.value)}else d[m][c.name]=c.value;continue}d[m]?Array.isArray(d[m])?d[m].push(this._parseByType(r.propertiesTypes[m])):(d[m]=[d[m]],d[m].push(this._parseByType(r.propertiesTypes[m]))):d[m]=this._parseByType(r.propertiesTypes[m])}return d}_newPacket(){return t("_newPacket"),this.packet&&(this._list.consume(this.packet.length),t("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),t("_newPacket: new packet"),this.packet=new f,this._pos=0,!0}_emitError(i){t("_emitError",i),this.error=i,this.emit("error",i)}};u.exports=n}),ol=de((g,u)=>{le(),ce(),ue();var{Buffer:o}=(Be(),Pe(Ne)),s=65536,f={},r=o.isBuffer(o.from([1,2]).subarray(0,1));function t(a){let d=o.allocUnsafe(2);return d.writeUInt8(a>>8,0),d.writeUInt8(a&255,1),d}function n(){for(let a=0;a<s;a++)f[a]=t(a)}function e(a){let d=0,p=0,m=o.allocUnsafe(4);do d=a%128|0,a=a/128|0,a>0&&(d=d|128),m.writeUInt8(d,p++);while(a>0&&p<4);return a>0&&(p=0),r?m.subarray(0,p):m.slice(0,p)}function i(a){let d=o.allocUnsafe(4);return d.writeUInt32BE(a,0),d}u.exports={cache:f,generateCache:n,generateNumber:t,genBufVariableByteInt:e,generate4ByteBuffer:i}}),sl=de((g,u)=>{le(),ce(),ue(),typeof Re>"u"||!Re.version||Re.version.indexOf("v0.")===0||Re.version.indexOf("v1.")===0&&Re.version.indexOf("v1.8.")!==0?u.exports={nextTick:o}:u.exports=Re;function o(s,f,r,t){if(typeof s!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,e,i;switch(n){case 0:case 1:return Re.nextTick(s);case 2:return Re.nextTick(function(){s.call(null,f)});case 3:return Re.nextTick(function(){s.call(null,f,r)});case 4:return Re.nextTick(function(){s.call(null,f,r,t)});default:for(e=new Array(n-1),i=0;i<e.length;)e[i++]=arguments[i];return Re.nextTick(function(){s.apply(null,e)})}}}),Rs=de((g,u)=>{le(),ce(),ue();var o=Ps(),{Buffer:s}=(Be(),Pe(Ne)),f=s.allocUnsafe(0),r=s.from([0]),t=ol(),n=sl().nextTick,e=at()("mqtt-packet:writeToStream"),i=t.cache,a=t.generateNumber,d=t.generateCache,p=t.genBufVariableByteInt,m=t.generate4ByteBuffer,c=Q,y=!0;function b(K,N,ne){switch(e("generate called"),N.cork&&(N.cork(),n(S,N)),y&&(y=!1,d()),e("generate: packet.cmd: %s",K.cmd),K.cmd){case"connect":return h(K,N);case"connack":return _(K,N,ne);case"publish":return I(K,N,ne);case"puback":case"pubrec":case"pubrel":case"pubcomp":return v(K,N,ne);case"subscribe":return A(K,N,ne);case"suback":return E(K,N,ne);case"unsubscribe":return T(K,N,ne);case"unsuback":return C(K,N,ne);case"pingreq":case"pingresp":return P(K,N);case"disconnect":return L(K,N,ne);case"auth":return k(K,N,ne);default:return N.destroy(new Error("Unknown command")),!1}}Object.defineProperty(b,"cacheNumbers",{get(){return c===Q},set(K){K?((!i||Object.keys(i).length===0)&&(y=!0),c=Q):(y=!1,c=V)}});function S(K){K.uncork()}function h(K,N,ne){let H=K||{},G=H.protocolId||"MQTT",Y=H.protocolVersion||4,ye=H.will,oe=H.clean,M=H.keepalive||0,W=H.clientId||"",ee=H.username,he=H.password,pe=H.properties;oe===void 0&&(oe=!0);let me=0;if(typeof G!="string"&&!s.isBuffer(G))return N.destroy(new Error("Invalid protocolId")),!1;if(me+=G.length+2,Y!==3&&Y!==4&&Y!==5)return N.destroy(new Error("Invalid protocol version")),!1;if(me+=1,(typeof W=="string"||s.isBuffer(W))&&(W||Y>=4)&&(W||oe))me+=s.byteLength(W)+2;else{if(Y<4)return N.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(oe*1===0)return N.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof M!="number"||M<0||M>65535||M%1!==0)return N.destroy(new Error("Invalid keepalive")),!1;me+=2,me+=1;let $,ge;if(Y===5){if($=Z(N,pe),!$)return!1;me+=$.length}if(ye){if(typeof ye!="object")return N.destroy(new Error("Invalid will")),!1;if(!ye.topic||typeof ye.topic!="string")return N.destroy(new Error("Invalid will topic")),!1;if(me+=s.byteLength(ye.topic)+2,me+=2,ye.payload)if(ye.payload.length>=0)typeof ye.payload=="string"?me+=s.byteLength(ye.payload):me+=ye.payload.length;else return N.destroy(new Error("Invalid will payload")),!1;if(ge={},Y===5){if(ge=Z(N,ye.properties),!ge)return!1;me+=ge.length}}let ve=!1;if(ee!=null)if(we(ee))ve=!0,me+=s.byteLength(ee)+2;else return N.destroy(new Error("Invalid username")),!1;if(he!=null){if(!ve)return N.destroy(new Error("Username is required to use password")),!1;if(we(he))me+=te(he)+2;else return N.destroy(new Error("Invalid password")),!1}N.write(o.CONNECT_HEADER),F(N,me),D(N,G),H.bridgeMode&&(Y+=128),N.write(Y===131?o.VERSION131:Y===132?o.VERSION132:Y===4?o.VERSION4:Y===5?o.VERSION5:o.VERSION3);let se=0;return se|=ee!=null?o.USERNAME_MASK:0,se|=he!=null?o.PASSWORD_MASK:0,se|=ye&&ye.retain?o.WILL_RETAIN_MASK:0,se|=ye&&ye.qos?ye.qos<<o.WILL_QOS_SHIFT:0,se|=ye?o.WILL_FLAG_MASK:0,se|=oe?o.CLEAN_SESSION_MASK:0,N.write(s.from([se])),c(N,M),Y===5&&$.write(),D(N,W),ye&&(Y===5&&ge.write(),B(N,ye.topic),D(N,ye.payload)),ee!=null&&D(N,ee),he!=null&&D(N,he),!0}function _(K,N,ne){let H=ne?ne.protocolVersion:4,G=K||{},Y=H===5?G.reasonCode:G.returnCode,ye=G.properties,oe=2;if(typeof Y!="number")return N.destroy(new Error("Invalid return code")),!1;let M=null;if(H===5){if(M=Z(N,ye),!M)return!1;oe+=M.length}return N.write(o.CONNACK_HEADER),F(N,oe),N.write(G.sessionPresent?o.SESSIONPRESENT_HEADER:r),N.write(s.from([Y])),M?.write(),!0}function I(K,N,ne){e("publish: packet: %o",K);let H=ne?ne.protocolVersion:4,G=K||{},Y=G.qos||0,ye=G.retain?o.RETAIN_MASK:0,oe=G.topic,M=G.payload||f,W=G.messageId,ee=G.properties,he=0;if(typeof oe=="string")he+=s.byteLength(oe)+2;else if(s.isBuffer(oe))he+=oe.length+2;else return N.destroy(new Error("Invalid topic")),!1;if(s.isBuffer(M)?he+=M.length:he+=s.byteLength(M),Y&&typeof W!="number")return N.destroy(new Error("Invalid messageId")),!1;Y&&(he+=2);let pe=null;if(H===5){if(pe=Z(N,ee),!pe)return!1;he+=pe.length}return N.write(o.PUBLISH_HEADER[Y][G.dup?1:0][ye?1:0]),F(N,he),c(N,te(oe)),N.write(oe),Y>0&&c(N,W),pe?.write(),e("publish: payload: %o",M),N.write(M)}function v(K,N,ne){let H=ne?ne.protocolVersion:4,G=K||{},Y=G.cmd||"puback",ye=G.messageId,oe=G.dup&&Y==="pubrel"?o.DUP_MASK:0,M=0,W=G.reasonCode,ee=G.properties,he=H===5?3:2;if(Y==="pubrel"&&(M=1),typeof ye!="number")return N.destroy(new Error("Invalid messageId")),!1;let pe=null;if(H===5&&typeof ee=="object"){if(pe=R(N,ee,ne,he),!pe)return!1;he+=pe.length}return N.write(o.ACKS[Y][M][oe][0]),he===3&&(he+=W!==0?1:-1),F(N,he),c(N,ye),H===5&&he!==2&&N.write(s.from([W])),pe!==null?pe.write():he===4&&N.write(s.from([0])),!0}function A(K,N,ne){e("subscribe: packet: ");let H=ne?ne.protocolVersion:4,G=K||{},Y=G.dup?o.DUP_MASK:0,ye=G.messageId,oe=G.subscriptions,M=G.properties,W=0;if(typeof ye!="number")return N.destroy(new Error("Invalid messageId")),!1;W+=2;let ee=null;if(H===5){if(ee=Z(N,M),!ee)return!1;W+=ee.length}if(typeof oe=="object"&&oe.length)for(let pe=0;pe<oe.length;pe+=1){let me=oe[pe].topic,$=oe[pe].qos;if(typeof me!="string")return N.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof $!="number")return N.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(H===5){if(typeof(oe[pe].nl||!1)!="boolean")return N.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(oe[pe].rap||!1)!="boolean")return N.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;let ge=oe[pe].rh||0;if(typeof ge!="number"||ge>2)return N.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}W+=s.byteLength(me)+2+1}else return N.destroy(new Error("Invalid subscriptions")),!1;e("subscribe: writing to stream: %o",o.SUBSCRIBE_HEADER),N.write(o.SUBSCRIBE_HEADER[1][Y?1:0][0]),F(N,W),c(N,ye),ee!==null&&ee.write();let he=!0;for(let pe of oe){let me=pe.topic,$=pe.qos,ge=+pe.nl,ve=+pe.rap,se=pe.rh,ke;B(N,me),ke=o.SUBSCRIBE_OPTIONS_QOS[$],H===5&&(ke|=ge?o.SUBSCRIBE_OPTIONS_NL:0,ke|=ve?o.SUBSCRIBE_OPTIONS_RAP:0,ke|=se?o.SUBSCRIBE_OPTIONS_RH[se]:0),he=N.write(s.from([ke]))}return he}function E(K,N,ne){let H=ne?ne.protocolVersion:4,G=K||{},Y=G.messageId,ye=G.granted,oe=G.properties,M=0;if(typeof Y!="number")return N.destroy(new Error("Invalid messageId")),!1;if(M+=2,typeof ye=="object"&&ye.length)for(let ee=0;ee<ye.length;ee+=1){if(typeof ye[ee]!="number")return N.destroy(new Error("Invalid qos vector")),!1;M+=1}else return N.destroy(new Error("Invalid qos vector")),!1;let W=null;if(H===5){if(W=R(N,oe,ne,M),!W)return!1;M+=W.length}return N.write(o.SUBACK_HEADER),F(N,M),c(N,Y),W!==null&&W.write(),N.write(s.from(ye))}function T(K,N,ne){let H=ne?ne.protocolVersion:4,G=K||{},Y=G.messageId,ye=G.dup?o.DUP_MASK:0,oe=G.unsubscriptions,M=G.properties,W=0;if(typeof Y!="number")return N.destroy(new Error("Invalid messageId")),!1;if(W+=2,typeof oe=="object"&&oe.length)for(let pe=0;pe<oe.length;pe+=1){if(typeof oe[pe]!="string")return N.destroy(new Error("Invalid unsubscriptions")),!1;W+=s.byteLength(oe[pe])+2}else return N.destroy(new Error("Invalid unsubscriptions")),!1;let ee=null;if(H===5){if(ee=Z(N,M),!ee)return!1;W+=ee.length}N.write(o.UNSUBSCRIBE_HEADER[1][ye?1:0][0]),F(N,W),c(N,Y),ee!==null&&ee.write();let he=!0;for(let pe=0;pe<oe.length;pe++)he=B(N,oe[pe]);return he}function C(K,N,ne){let H=ne?ne.protocolVersion:4,G=K||{},Y=G.messageId,ye=G.dup?o.DUP_MASK:0,oe=G.granted,M=G.properties,W=G.cmd,ee=0,he=2;if(typeof Y!="number")return N.destroy(new Error("Invalid messageId")),!1;if(H===5)if(typeof oe=="object"&&oe.length)for(let me=0;me<oe.length;me+=1){if(typeof oe[me]!="number")return N.destroy(new Error("Invalid qos vector")),!1;he+=1}else return N.destroy(new Error("Invalid qos vector")),!1;let pe=null;if(H===5){if(pe=R(N,M,ne,he),!pe)return!1;he+=pe.length}return N.write(o.ACKS[W][ee][ye][0]),F(N,he),c(N,Y),pe!==null&&pe.write(),H===5&&N.write(s.from(oe)),!0}function P(K,N,ne){return N.write(o.EMPTY[K.cmd])}function L(K,N,ne){let H=ne?ne.protocolVersion:4,G=K||{},Y=G.reasonCode,ye=G.properties,oe=H===5?1:0,M=null;if(H===5){if(M=R(N,ye,ne,oe),!M)return!1;oe+=M.length}return N.write(s.from([o.codes.disconnect<<4])),F(N,oe),H===5&&N.write(s.from([Y])),M!==null&&M.write(),!0}function k(K,N,ne){let H=ne?ne.protocolVersion:4,G=K||{},Y=G.reasonCode,ye=G.properties,oe=H===5?1:0;H!==5&&N.destroy(new Error("Invalid mqtt version for auth packet"));let M=R(N,ye,ne,oe);return M?(oe+=M.length,N.write(s.from([o.codes.auth<<4])),F(N,oe),N.write(s.from([Y])),M!==null&&M.write(),!0):!1}var q={};function F(K,N){if(N>o.VARBYTEINT_MAX)return K.destroy(new Error(`Invalid variable byte integer: ${N}`)),!1;let ne=q[N];return ne||(ne=p(N),N<16384&&(q[N]=ne)),e("writeVarByteInt: writing to stream: %o",ne),K.write(ne)}function B(K,N){let ne=s.byteLength(N);return c(K,ne),e("writeString: %s",N),K.write(N,"utf8")}function ae(K,N,ne){B(K,N),B(K,ne)}function Q(K,N){return e("writeNumberCached: number: %d",N),e("writeNumberCached: %o",i[N]),K.write(i[N])}function V(K,N){let ne=a(N);return e("writeNumberGenerated: %o",ne),K.write(ne)}function re(K,N){let ne=m(N);return e("write4ByteNumber: %o",ne),K.write(ne)}function D(K,N){typeof N=="string"?B(K,N):N?(c(K,N.length),K.write(N)):c(K,0)}function Z(K,N){if(typeof N!="object"||N.length!=null)return{length:1,write(){be(K,{},0)}};let ne=0;function H(G,Y){let ye=o.propertiesTypes[G],oe=0;switch(ye){case"byte":{if(typeof Y!="boolean")return K.destroy(new Error(`Invalid ${G}: ${Y}`)),!1;oe+=2;break}case"int8":{if(typeof Y!="number"||Y<0||Y>255)return K.destroy(new Error(`Invalid ${G}: ${Y}`)),!1;oe+=2;break}case"binary":{if(Y&&Y===null)return K.destroy(new Error(`Invalid ${G}: ${Y}`)),!1;oe+=1+s.byteLength(Y)+2;break}case"int16":{if(typeof Y!="number"||Y<0||Y>65535)return K.destroy(new Error(`Invalid ${G}: ${Y}`)),!1;oe+=3;break}case"int32":{if(typeof Y!="number"||Y<0||Y>4294967295)return K.destroy(new Error(`Invalid ${G}: ${Y}`)),!1;oe+=5;break}case"var":{if(typeof Y!="number"||Y<0||Y>268435455)return K.destroy(new Error(`Invalid ${G}: ${Y}`)),!1;oe+=1+s.byteLength(p(Y));break}case"string":{if(typeof Y!="string")return K.destroy(new Error(`Invalid ${G}: ${Y}`)),!1;oe+=3+s.byteLength(Y.toString());break}case"pair":{if(typeof Y!="object")return K.destroy(new Error(`Invalid ${G}: ${Y}`)),!1;oe+=Object.getOwnPropertyNames(Y).reduce((M,W)=>{let ee=Y[W];return Array.isArray(ee)?M+=ee.reduce((he,pe)=>(he+=3+s.byteLength(W.toString())+2+s.byteLength(pe.toString()),he),0):M+=3+s.byteLength(W.toString())+2+s.byteLength(Y[W].toString()),M},0);break}default:return K.destroy(new Error(`Invalid property ${G}: ${Y}`)),!1}return oe}if(N)for(let G in N){let Y=0,ye=0,oe=N[G];if(oe!==void 0){if(Array.isArray(oe))for(let M=0;M<oe.length;M++){if(ye=H(G,oe[M]),!ye)return!1;Y+=ye}else{if(ye=H(G,oe),!ye)return!1;Y=ye}if(!Y)return!1;ne+=Y}}return{length:s.byteLength(p(ne))+ne,write(){be(K,N,ne)}}}function R(K,N,ne,H){let G=["reasonString","userProperties"],Y=ne&&ne.properties&&ne.properties.maximumPacketSize?ne.properties.maximumPacketSize:0,ye=Z(K,N);if(Y)for(;H+ye.length>Y;){let oe=G.shift();if(oe&&N[oe])delete N[oe],ye=Z(K,N);else return!1}return ye}function J(K,N,ne){switch(o.propertiesTypes[N]){case"byte":{K.write(s.from([o.properties[N]])),K.write(s.from([+ne]));break}case"int8":{K.write(s.from([o.properties[N]])),K.write(s.from([ne]));break}case"binary":{K.write(s.from([o.properties[N]])),D(K,ne);break}case"int16":{K.write(s.from([o.properties[N]])),c(K,ne);break}case"int32":{K.write(s.from([o.properties[N]])),re(K,ne);break}case"var":{K.write(s.from([o.properties[N]])),F(K,ne);break}case"string":{K.write(s.from([o.properties[N]])),B(K,ne);break}case"pair":{Object.getOwnPropertyNames(ne).forEach(H=>{let G=ne[H];Array.isArray(G)?G.forEach(Y=>{K.write(s.from([o.properties[N]])),ae(K,H.toString(),Y.toString())}):(K.write(s.from([o.properties[N]])),ae(K,H.toString(),G.toString()))});break}default:return K.destroy(new Error(`Invalid property ${N} value: ${ne}`)),!1}}function be(K,N,ne){F(K,ne);for(let H in N)if(Object.prototype.hasOwnProperty.call(N,H)&&N[H]!=null){let G=N[H];if(Array.isArray(G))for(let Y=0;Y<G.length;Y++)J(K,H,G[Y]);else J(K,H,G)}}function te(K){return K?K instanceof s?K.length:s.byteLength(K):0}function we(K){return typeof K=="string"||K instanceof s}u.exports=b}),al=de((g,u)=>{le(),ce(),ue();var o=Rs(),{EventEmitter:s}=(It(),Pe(bt)),{Buffer:f}=(Be(),Pe(Ne));function r(n,e){let i=new t;return o(n,i,e),i.concat()}var t=class extends s{constructor(){super(),this._array=new Array(20),this._i=0}write(n){return this._array[this._i++]=n,!0}concat(){let n=0,e=new Array(this._array.length),i=this._array,a=0,d;for(d=0;d<i.length&&i[d]!==void 0;d++)typeof i[d]!="string"?e[d]=i[d].length:e[d]=f.byteLength(i[d]),n+=e[d];let p=f.allocUnsafe(n);for(d=0;d<i.length&&i[d]!==void 0;d++)typeof i[d]!="string"?(i[d].copy(p,a),a+=e[d]):(p.write(i[d],a),a+=e[d]);return p}destroy(n){n&&this.emit("error",n)}};u.exports=r}),ll=de(g=>{le(),ce(),ue(),g.parser=il().parser,g.generate=al(),g.writeToStream=Rs()}),ul=de((g,u)=>{le(),ce(),ue(),u.exports=s;function o(r){return r instanceof Ir?Ir.from(r):new r.constructor(r.buffer.slice(),r.byteOffset,r.length)}function s(r){if(r=r||{},r.circles)return f(r);let t=new Map;if(t.set(Date,d=>new Date(d)),t.set(Map,(d,p)=>new Map(e(Array.from(d),p))),t.set(Set,(d,p)=>new Set(e(Array.from(d),p))),r.constructorHandlers)for(let d of r.constructorHandlers)t.set(d[0],d[1]);let n=null;return r.proto?a:i;function e(d,p){let m=Object.keys(d),c=new Array(m.length);for(let y=0;y<m.length;y++){let b=m[y],S=d[b];typeof S!="object"||S===null?c[b]=S:S.constructor!==Object&&(n=t.get(S.constructor))?c[b]=n(S,p):ArrayBuffer.isView(S)?c[b]=o(S):c[b]=p(S)}return c}function i(d){if(typeof d!="object"||d===null)return d;if(Array.isArray(d))return e(d,i);if(d.constructor!==Object&&(n=t.get(d.constructor)))return n(d,i);let p={};for(let m in d){if(Object.hasOwnProperty.call(d,m)===!1)continue;let c=d[m];typeof c!="object"||c===null?p[m]=c:c.constructor!==Object&&(n=t.get(c.constructor))?p[m]=n(c,i):ArrayBuffer.isView(c)?p[m]=o(c):p[m]=i(c)}return p}function a(d){if(typeof d!="object"||d===null)return d;if(Array.isArray(d))return e(d,a);if(d.constructor!==Object&&(n=t.get(d.constructor)))return n(d,a);let p={};for(let m in d){let c=d[m];typeof c!="object"||c===null?p[m]=c:c.constructor!==Object&&(n=t.get(c.constructor))?p[m]=n(c,a):ArrayBuffer.isView(c)?p[m]=o(c):p[m]=a(c)}return p}}function f(r){let t=[],n=[],e=new Map;if(e.set(Date,m=>new Date(m)),e.set(Map,(m,c)=>new Map(a(Array.from(m),c))),e.set(Set,(m,c)=>new Set(a(Array.from(m),c))),r.constructorHandlers)for(let m of r.constructorHandlers)e.set(m[0],m[1]);let i=null;return r.proto?p:d;function a(m,c){let y=Object.keys(m),b=new Array(y.length);for(let S=0;S<y.length;S++){let h=y[S],_=m[h];if(typeof _!="object"||_===null)b[h]=_;else if(_.constructor!==Object&&(i=e.get(_.constructor)))b[h]=i(_,c);else if(ArrayBuffer.isView(_))b[h]=o(_);else{let I=t.indexOf(_);I!==-1?b[h]=n[I]:b[h]=c(_)}}return b}function d(m){if(typeof m!="object"||m===null)return m;if(Array.isArray(m))return a(m,d);if(m.constructor!==Object&&(i=e.get(m.constructor)))return i(m,d);let c={};t.push(m),n.push(c);for(let y in m){if(Object.hasOwnProperty.call(m,y)===!1)continue;let b=m[y];if(typeof b!="object"||b===null)c[y]=b;else if(b.constructor!==Object&&(i=e.get(b.constructor)))c[y]=i(b,d);else if(ArrayBuffer.isView(b))c[y]=o(b);else{let S=t.indexOf(b);S!==-1?c[y]=n[S]:c[y]=d(b)}}return t.pop(),n.pop(),c}function p(m){if(typeof m!="object"||m===null)return m;if(Array.isArray(m))return a(m,p);if(m.constructor!==Object&&(i=e.get(m.constructor)))return i(m,p);let c={};t.push(m),n.push(c);for(let y in m){let b=m[y];if(typeof b!="object"||b===null)c[y]=b;else if(b.constructor!==Object&&(i=e.get(b.constructor)))c[y]=i(b,p);else if(ArrayBuffer.isView(b))c[y]=o(b);else{let S=t.indexOf(b);S!==-1?c[y]=n[S]:c[y]=p(b)}}return t.pop(),n.pop(),c}}}),cl=de((g,u)=>{le(),ce(),ue(),u.exports=ul()()}),Cs=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0}),g.validateTopic=u,g.validateTopics=o;function u(s){let f=s.split("/");for(let r=0;r<f.length;r++)if(f[r]!=="+"){if(f[r]==="#")return r===f.length-1;if(f[r].indexOf("+")!==-1||f[r].indexOf("#")!==-1)return!1}return!0}function o(s){if(s.length===0)return"empty_topic_list";for(let f=0;f<s.length;f++)if(!u(s[f]))return s[f];return null}}),Ms=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=Tt(),o={objectMode:!0},s={clean:!0},f=class{options;_inflights;constructor(r){this.options=r||{},this.options={...s,...r},this._inflights=new Map}put(r,t){return this._inflights.set(r.messageId,r),t&&t(),this}createStream(){let r=new u.Readable(o),t=[],n=!1,e=0;return this._inflights.forEach((i,a)=>{t.push(i)}),r._read=()=>{!n&&e<t.length?r.push(t[e++]):r.push(null)},r.destroy=i=>{if(!n)return n=!0,setTimeout(()=>{r.emit("close")},0),r},r}del(r,t){let n=this._inflights.get(r.messageId);return n?(this._inflights.delete(r.messageId),t(null,n)):t&&t(new Error("missing packet")),this}get(r,t){let n=this._inflights.get(r.messageId);return n?t(null,n):t&&t(new Error("missing packet")),this}close(r){this.options.clean&&(this._inflights=null),r&&r()}};g.default=f}),fl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=[0,16,128,131,135,144,145,151,153],o=(s,f,r)=>{s.log("handlePublish: packet %o",f),r=typeof r<"u"?r:s.noop;let t=f.topic.toString(),n=f.payload,{qos:e}=f,{messageId:i}=f,{options:a}=s;if(s.options.protocolVersion===5){let d;if(f.properties&&(d=f.properties.topicAlias),typeof d<"u")if(t.length===0)if(d>0&&d<=65535){let p=s.topicAliasRecv.getTopicByAlias(d);if(p)t=p,s.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",t,d);else{s.log("handlePublish :: unregistered topic alias. alias: %d",d),s.emit("error",new Error("Received unregistered Topic Alias"));return}}else{s.log("handlePublish :: topic alias out of range. alias: %d",d),s.emit("error",new Error("Received Topic Alias is out of range"));return}else if(s.topicAliasRecv.put(t,d))s.log("handlePublish :: registered topic: %s - alias: %d",t,d);else{s.log("handlePublish :: topic alias out of range. alias: %d",d),s.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(s.log("handlePublish: qos %d",e),e){case 2:{a.customHandleAcks(t,n,f,(d,p)=>{if(typeof d=="number"&&(p=d,d=null),d)return s.emit("error",d);if(u.indexOf(p)===-1)return s.emit("error",new Error("Wrong reason code for pubrec"));p?s._sendPacket({cmd:"pubrec",messageId:i,reasonCode:p},r):s.incomingStore.put(f,()=>{s._sendPacket({cmd:"pubrec",messageId:i},r)})});break}case 1:{a.customHandleAcks(t,n,f,(d,p)=>{if(typeof d=="number"&&(p=d,d=null),d)return s.emit("error",d);if(u.indexOf(p)===-1)return s.emit("error",new Error("Wrong reason code for puback"));p||s.emit("message",t,n,f),s.handleMessage(f,m=>{if(m)return r&&r(m);s._sendPacket({cmd:"puback",messageId:i,reasonCode:p},r)})});break}case 0:s.emit("message",t,n,f),s.handleMessage(f,r);break;default:s.log("handlePublish: unknown QoS. Doing nothing.");break}};g.default=o}),hl=de((g,u)=>{u.exports={version:"5.15.0"}}),Nt=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0}),g.MQTTJS_VERSION=g.nextTick=g.ErrorWithSubackPacket=g.ErrorWithReasonCode=void 0,g.applyMixin=s;var u=class js extends Error{code;constructor(r,t){super(r),this.code=t,Object.setPrototypeOf(this,js.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};g.ErrorWithReasonCode=u;var o=class Ns extends Error{packet;constructor(r,t){super(r),this.packet=t,Object.setPrototypeOf(this,Ns.prototype),Object.getPrototypeOf(this).name="ErrorWithSubackPacket"}};g.ErrorWithSubackPacket=o;function s(f,r,t=!1){let n=[r];for(;;){let e=n[0],i=Object.getPrototypeOf(e);if(i?.prototype)n.unshift(i);else break}for(let e of n)for(let i of Object.getOwnPropertyNames(e.prototype))(t||i!=="constructor")&&Object.defineProperty(f.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i)??Object.create(null))}g.nextTick=typeof Re?.nextTick=="function"?Re.nextTick:f=>{setTimeout(f,0)},g.MQTTJS_VERSION=hl().version}),Pr=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0}),g.ReasonCodes=void 0;var u=Nt();g.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 o=(s,f)=>{let{messageId:r}=f,t=f.cmd,n=null,e=s.outgoing[r]?s.outgoing[r].cb:null,i=null;if(!e){s.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(s.log("_handleAck :: packet type",t),t){case"pubcomp":case"puback":{let a=f.reasonCode;a&&a>0&&a!==16?(i=new u.ErrorWithReasonCode(`Publish error: ${g.ReasonCodes[a]}`,a),s._removeOutgoingAndStoreMessage(r,()=>{e(i,f)})):s._removeOutgoingAndStoreMessage(r,e);break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:r};let a=f.reasonCode;a&&a>0&&a!==16?(i=new u.ErrorWithReasonCode(`Publish error: ${g.ReasonCodes[a]}`,a),s._removeOutgoingAndStoreMessage(r,()=>{e(i,f)})):s._sendPacket(n);break}case"suback":{delete s.outgoing[r],s.messageIdProvider.deallocate(r);let a=f.granted;for(let d=0;d<a.length;d++){let p=a[d];if((p&128)!==0){i=new Error(`Subscribe error: ${g.ReasonCodes[p]}`),i.code=p;let m=s.messageIdToTopic[r];m&&m.forEach(c=>{delete s._resubscribeTopics[c]})}}delete s.messageIdToTopic[r],s._invokeStoreProcessingQueue(),e(i,f);break}case"unsuback":{delete s.outgoing[r],s.messageIdProvider.deallocate(r),s._invokeStoreProcessingQueue(),e(null,f);break}default:s.emit("error",new Error("unrecognized packet type"))}s.disconnecting&&Object.keys(s.outgoing).length===0&&s.emit("outgoingEmpty")};g.default=o}),pl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=Nt(),o=Pr(),s=(f,r)=>{let{options:t}=f,n=t.protocolVersion,e=n===5?r.reasonCode:r.returnCode;if(n!==5){let i=new u.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${n}`,e);f.emit("error",i);return}f.handleAuth(r,(i,a)=>{if(i){f.emit("error",i);return}if(e===24)f.reconnecting=!1,f._sendPacket(a);else{let d=new u.ErrorWithReasonCode(`Connection refused: ${o.ReasonCodes[e]}`,e);f.emit("error",d)}})};g.default=s}),dl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0}),g.LRUCache=void 0;var u=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,o=new Set,s=typeof Re=="object"&&Re?Re:{},f=(m,c,y,b)=>{typeof s.emitWarning=="function"?s.emitWarning(m,c,y,b):console.error(`[${y}] ${c}: ${m}`)},r=globalThis.AbortController,t=globalThis.AbortSignal;if(typeof r>"u"){t=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(y,b){this._onabort.push(b)}},r=class{constructor(){c()}signal=new t;abort(y){if(!this.signal.aborted){this.signal.reason=y,this.signal.aborted=!0;for(let b of this.signal._onabort)b(y);this.signal.onabort?.(y)}}};let m=s.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",c=()=>{m&&(m=!1,f("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",c))}}var n=m=>!o.has(m),e=m=>m&&m===Math.floor(m)&&m>0&&isFinite(m),i=m=>e(m)?m<=Math.pow(2,8)?Uint8Array:m<=Math.pow(2,16)?Uint16Array:m<=Math.pow(2,32)?Uint32Array:m<=Number.MAX_SAFE_INTEGER?a:null:null,a=class extends Array{constructor(m){super(m),this.fill(0)}},d=class Ht{heap;length;static#l=!1;static create(c){let y=i(c);if(!y)return[];Ht.#l=!0;let b=new Ht(c,y);return Ht.#l=!1,b}constructor(c,y){if(!Ht.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new y(c),this.length=0}push(c){this.heap[this.length++]=c}pop(){return this.heap[--this.length]}},p=class Bs{#l;#f;#g;#y;#P;#R;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#b;#n;#r;#e;#u;#h;#a;#o;#m;#s;#v;#w;#p;#_;#x;#c;static unsafeExposeInternals(c){return{starts:c.#w,ttls:c.#p,sizes:c.#v,keyMap:c.#n,keyList:c.#r,valList:c.#e,next:c.#u,prev:c.#h,get head(){return c.#a},get tail(){return c.#o},free:c.#m,isBackgroundFetch:y=>c.#t(y),backgroundFetch:(y,b,S,h)=>c.#j(y,b,S,h),moveToTail:y=>c.#O(y),indexes:y=>c.#S(y),rindexes:y=>c.#E(y),isStale:y=>c.#d(y)}}get max(){return this.#l}get maxSize(){return this.#f}get calculatedSize(){return this.#b}get size(){return this.#i}get fetchMethod(){return this.#P}get memoMethod(){return this.#R}get dispose(){return this.#g}get disposeAfter(){return this.#y}constructor(c){let{max:y=0,ttl:b,ttlResolution:S=1,ttlAutopurge:h,updateAgeOnGet:_,updateAgeOnHas:I,allowStale:v,dispose:A,disposeAfter:E,noDisposeOnSet:T,noUpdateTTL:C,maxSize:P=0,maxEntrySize:L=0,sizeCalculation:k,fetchMethod:q,memoMethod:F,noDeleteOnFetchRejection:B,noDeleteOnStaleGet:ae,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:V,ignoreFetchAbort:re}=c;if(y!==0&&!e(y))throw new TypeError("max option must be a nonnegative integer");let D=y?i(y):Array;if(!D)throw new Error("invalid max value: "+y);if(this.#l=y,this.#f=P,this.maxEntrySize=L||this.#f,this.sizeCalculation=k,this.sizeCalculation){if(!this.#f&&!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(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#R=F,q!==void 0&&typeof q!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#P=q,this.#x=!!q,this.#n=new Map,this.#r=new Array(y).fill(void 0),this.#e=new Array(y).fill(void 0),this.#u=new D(y),this.#h=new D(y),this.#a=0,this.#o=0,this.#m=d.create(y),this.#i=0,this.#b=0,typeof A=="function"&&(this.#g=A),typeof E=="function"?(this.#y=E,this.#s=[]):(this.#y=void 0,this.#s=void 0),this.#_=!!this.#g,this.#c=!!this.#y,this.noDisposeOnSet=!!T,this.noUpdateTTL=!!C,this.noDeleteOnFetchRejection=!!B,this.allowStaleOnFetchRejection=!!Q,this.allowStaleOnFetchAbort=!!V,this.ignoreFetchAbort=!!re,this.maxEntrySize!==0){if(this.#f!==0&&!e(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!e(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#W()}if(this.allowStale=!!v,this.noDeleteOnStaleGet=!!ae,this.updateAgeOnGet=!!_,this.updateAgeOnHas=!!I,this.ttlResolution=e(S)||S===0?S:1,this.ttlAutopurge=!!h,this.ttl=b||0,this.ttl){if(!e(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#l===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#f){let Z="LRU_CACHE_UNBOUNDED";n(Z)&&(o.add(Z),f("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Z,Bs))}}getRemainingTTL(c){return this.#n.has(c)?1/0:0}#N(){let c=new a(this.#l),y=new a(this.#l);this.#p=c,this.#w=y,this.#B=(h,_,I=u.now())=>{if(y[h]=_!==0?I:0,c[h]=_,_!==0&&this.ttlAutopurge){let v=setTimeout(()=>{this.#d(h)&&this.#A(this.#r[h],"expire")},_+1);v.unref&&v.unref()}},this.#T=h=>{y[h]=c[h]!==0?u.now():0},this.#I=(h,_)=>{if(c[_]){let I=c[_],v=y[_];if(!I||!v)return;h.ttl=I,h.start=v,h.now=b||S();let A=h.now-v;h.remainingTTL=I-A}};let b=0,S=()=>{let h=u.now();if(this.ttlResolution>0){b=h;let _=setTimeout(()=>b=0,this.ttlResolution);_.unref&&_.unref()}return h};this.getRemainingTTL=h=>{let _=this.#n.get(h);if(_===void 0)return 0;let I=c[_],v=y[_];if(!I||!v)return 1/0;let A=(b||S())-v;return I-A},this.#d=h=>{let _=y[h],I=c[h];return!!I&&!!_&&(b||S())-_>I}}#T=()=>{};#I=()=>{};#B=()=>{};#d=()=>!1;#W(){let c=new a(this.#l);this.#b=0,this.#v=c,this.#k=y=>{this.#b-=c[y],c[y]=0},this.#U=(y,b,S,h)=>{if(this.#t(b))return 0;if(!e(S))if(h){if(typeof h!="function")throw new TypeError("sizeCalculation must be a function");if(S=h(b,y),!e(S))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return S},this.#C=(y,b,S)=>{if(c[y]=b,this.#f){let h=this.#f-c[y];for(;this.#b>h;)this.#M(!0)}this.#b+=c[y],S&&(S.entrySize=b,S.totalCalculatedSize=this.#b)}}#k=c=>{};#C=(c,y,b)=>{};#U=(c,y,b,S)=>{if(b||S)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:c=this.allowStale}={}){if(this.#i)for(let y=this.#o;!(!this.#L(y)||((c||!this.#d(y))&&(yield y),y===this.#a));)y=this.#h[y]}*#E({allowStale:c=this.allowStale}={}){if(this.#i)for(let y=this.#a;!(!this.#L(y)||((c||!this.#d(y))&&(yield y),y===this.#o));)y=this.#u[y]}#L(c){return c!==void 0&&this.#n.get(this.#r[c])===c}*entries(){for(let c of this.#S())this.#e[c]!==void 0&&this.#r[c]!==void 0&&!this.#t(this.#e[c])&&(yield[this.#r[c],this.#e[c]])}*rentries(){for(let c of this.#E())this.#e[c]!==void 0&&this.#r[c]!==void 0&&!this.#t(this.#e[c])&&(yield[this.#r[c],this.#e[c]])}*keys(){for(let c of this.#S()){let y=this.#r[c];y!==void 0&&!this.#t(this.#e[c])&&(yield y)}}*rkeys(){for(let c of this.#E()){let y=this.#r[c];y!==void 0&&!this.#t(this.#e[c])&&(yield y)}}*values(){for(let c of this.#S())this.#e[c]!==void 0&&!this.#t(this.#e[c])&&(yield this.#e[c])}*rvalues(){for(let c of this.#E())this.#e[c]!==void 0&&!this.#t(this.#e[c])&&(yield this.#e[c])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(c,y={}){for(let b of this.#S()){let S=this.#e[b],h=this.#t(S)?S.__staleWhileFetching:S;if(h!==void 0&&c(h,this.#r[b],this))return this.get(this.#r[b],y)}}forEach(c,y=this){for(let b of this.#S()){let S=this.#e[b],h=this.#t(S)?S.__staleWhileFetching:S;h!==void 0&&c.call(y,h,this.#r[b],this)}}rforEach(c,y=this){for(let b of this.#E()){let S=this.#e[b],h=this.#t(S)?S.__staleWhileFetching:S;h!==void 0&&c.call(y,h,this.#r[b],this)}}purgeStale(){let c=!1;for(let y of this.#E({allowStale:!0}))this.#d(y)&&(this.#A(this.#r[y],"expire"),c=!0);return c}info(c){let y=this.#n.get(c);if(y===void 0)return;let b=this.#e[y],S=this.#t(b)?b.__staleWhileFetching:b;if(S===void 0)return;let h={value:S};if(this.#p&&this.#w){let _=this.#p[y],I=this.#w[y];if(_&&I){let v=_-(u.now()-I);h.ttl=v,h.start=Date.now()}}return this.#v&&(h.size=this.#v[y]),h}dump(){let c=[];for(let y of this.#S({allowStale:!0})){let b=this.#r[y],S=this.#e[y],h=this.#t(S)?S.__staleWhileFetching:S;if(h===void 0||b===void 0)continue;let _={value:h};if(this.#p&&this.#w){_.ttl=this.#p[y];let I=u.now()-this.#w[y];_.start=Math.floor(Date.now()-I)}this.#v&&(_.size=this.#v[y]),c.unshift([b,_])}return c}load(c){this.clear();for(let[y,b]of c){if(b.start){let S=Date.now()-b.start;b.start=u.now()-S}this.set(y,b.value,b)}}set(c,y,b={}){if(y===void 0)return this.delete(c),this;let{ttl:S=this.ttl,start:h,noDisposeOnSet:_=this.noDisposeOnSet,sizeCalculation:I=this.sizeCalculation,status:v}=b,{noUpdateTTL:A=this.noUpdateTTL}=b,E=this.#U(c,y,b.size||0,I);if(this.maxEntrySize&&E>this.maxEntrySize)return v&&(v.set="miss",v.maxEntrySizeExceeded=!0),this.#A(c,"set"),this;let T=this.#i===0?void 0:this.#n.get(c);if(T===void 0)T=this.#i===0?this.#o:this.#m.length!==0?this.#m.pop():this.#i===this.#l?this.#M(!1):this.#i,this.#r[T]=c,this.#e[T]=y,this.#n.set(c,T),this.#u[this.#o]=T,this.#h[T]=this.#o,this.#o=T,this.#i++,this.#C(T,E,v),v&&(v.set="add"),A=!1;else{this.#O(T);let C=this.#e[T];if(y!==C){if(this.#x&&this.#t(C)){C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:P}=C;P!==void 0&&!_&&(this.#_&&this.#g?.(P,c,"set"),this.#c&&this.#s?.push([P,c,"set"]))}else _||(this.#_&&this.#g?.(C,c,"set"),this.#c&&this.#s?.push([C,c,"set"]));if(this.#k(T),this.#C(T,E,v),this.#e[T]=y,v){v.set="replace";let P=C&&this.#t(C)?C.__staleWhileFetching:C;P!==void 0&&(v.oldValue=P)}}else v&&(v.set="update")}if(S!==0&&!this.#p&&this.#N(),this.#p&&(A||this.#B(T,S,h),v&&this.#I(v,T)),!_&&this.#c&&this.#s){let C=this.#s,P;for(;P=C?.shift();)this.#y?.(...P)}return this}pop(){try{for(;this.#i;){let c=this.#e[this.#a];if(this.#M(!0),this.#t(c)){if(c.__staleWhileFetching)return c.__staleWhileFetching}else if(c!==void 0)return c}}finally{if(this.#c&&this.#s){let c=this.#s,y;for(;y=c?.shift();)this.#y?.(...y)}}}#M(c){let y=this.#a,b=this.#r[y],S=this.#e[y];return this.#x&&this.#t(S)?S.__abortController.abort(new Error("evicted")):(this.#_||this.#c)&&(this.#_&&this.#g?.(S,b,"evict"),this.#c&&this.#s?.push([S,b,"evict"])),this.#k(y),c&&(this.#r[y]=void 0,this.#e[y]=void 0,this.#m.push(y)),this.#i===1?(this.#a=this.#o=0,this.#m.length=0):this.#a=this.#u[y],this.#n.delete(b),this.#i--,y}has(c,y={}){let{updateAgeOnHas:b=this.updateAgeOnHas,status:S}=y,h=this.#n.get(c);if(h!==void 0){let _=this.#e[h];if(this.#t(_)&&_.__staleWhileFetching===void 0)return!1;if(this.#d(h))S&&(S.has="stale",this.#I(S,h));else return b&&this.#T(h),S&&(S.has="hit",this.#I(S,h)),!0}else S&&(S.has="miss");return!1}peek(c,y={}){let{allowStale:b=this.allowStale}=y,S=this.#n.get(c);if(S===void 0||!b&&this.#d(S))return;let h=this.#e[S];return this.#t(h)?h.__staleWhileFetching:h}#j(c,y,b,S){let h=y===void 0?void 0:this.#e[y];if(this.#t(h))return h;let _=new r,{signal:I}=b;I?.addEventListener("abort",()=>_.abort(I.reason),{signal:_.signal});let v={signal:_.signal,options:b,context:S},A=(k,q=!1)=>{let{aborted:F}=_.signal,B=b.ignoreFetchAbort&&k!==void 0;if(b.status&&(F&&!q?(b.status.fetchAborted=!0,b.status.fetchError=_.signal.reason,B&&(b.status.fetchAbortIgnored=!0)):b.status.fetchResolved=!0),F&&!B&&!q)return T(_.signal.reason);let ae=P;return this.#e[y]===P&&(k===void 0?ae.__staleWhileFetching?this.#e[y]=ae.__staleWhileFetching:this.#A(c,"fetch"):(b.status&&(b.status.fetchUpdated=!0),this.set(c,k,v.options))),k},E=k=>(b.status&&(b.status.fetchRejected=!0,b.status.fetchError=k),T(k)),T=k=>{let{aborted:q}=_.signal,F=q&&b.allowStaleOnFetchAbort,B=F||b.allowStaleOnFetchRejection,ae=B||b.noDeleteOnFetchRejection,Q=P;if(this.#e[y]===P&&(!ae||Q.__staleWhileFetching===void 0?this.#A(c,"fetch"):F||(this.#e[y]=Q.__staleWhileFetching)),B)return b.status&&Q.__staleWhileFetching!==void 0&&(b.status.returnedStale=!0),Q.__staleWhileFetching;if(Q.__returned===Q)throw k},C=(k,q)=>{let F=this.#P?.(c,h,v);F&&F instanceof Promise&&F.then(B=>k(B===void 0?void 0:B),q),_.signal.addEventListener("abort",()=>{(!b.ignoreFetchAbort||b.allowStaleOnFetchAbort)&&(k(void 0),b.allowStaleOnFetchAbort&&(k=B=>A(B,!0)))})};b.status&&(b.status.fetchDispatched=!0);let P=new Promise(C).then(A,E),L=Object.assign(P,{__abortController:_,__staleWhileFetching:h,__returned:void 0});return y===void 0?(this.set(c,L,{...v.options,status:void 0}),y=this.#n.get(c)):this.#e[y]=L,L}#t(c){if(!this.#x)return!1;let y=c;return!!y&&y instanceof Promise&&y.hasOwnProperty("__staleWhileFetching")&&y.__abortController instanceof r}async fetch(c,y={}){let{allowStale:b=this.allowStale,updateAgeOnGet:S=this.updateAgeOnGet,noDeleteOnStaleGet:h=this.noDeleteOnStaleGet,ttl:_=this.ttl,noDisposeOnSet:I=this.noDisposeOnSet,size:v=0,sizeCalculation:A=this.sizeCalculation,noUpdateTTL:E=this.noUpdateTTL,noDeleteOnFetchRejection:T=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:C=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:L=this.allowStaleOnFetchAbort,context:k,forceRefresh:q=!1,status:F,signal:B}=y;if(!this.#x)return F&&(F.fetch="get"),this.get(c,{allowStale:b,updateAgeOnGet:S,noDeleteOnStaleGet:h,status:F});let ae={allowStale:b,updateAgeOnGet:S,noDeleteOnStaleGet:h,ttl:_,noDisposeOnSet:I,size:v,sizeCalculation:A,noUpdateTTL:E,noDeleteOnFetchRejection:T,allowStaleOnFetchRejection:C,allowStaleOnFetchAbort:L,ignoreFetchAbort:P,status:F,signal:B},Q=this.#n.get(c);if(Q===void 0){F&&(F.fetch="miss");let V=this.#j(c,Q,ae,k);return V.__returned=V}else{let V=this.#e[Q];if(this.#t(V)){let R=b&&V.__staleWhileFetching!==void 0;return F&&(F.fetch="inflight",R&&(F.returnedStale=!0)),R?V.__staleWhileFetching:V.__returned=V}let re=this.#d(Q);if(!q&&!re)return F&&(F.fetch="hit"),this.#O(Q),S&&this.#T(Q),F&&this.#I(F,Q),V;let D=this.#j(c,Q,ae,k),Z=D.__staleWhileFetching!==void 0&&b;return F&&(F.fetch=re?"stale":"refresh",Z&&re&&(F.returnedStale=!0)),Z?D.__staleWhileFetching:D.__returned=D}}async forceFetch(c,y={}){let b=await this.fetch(c,y);if(b===void 0)throw new Error("fetch() returned undefined");return b}memo(c,y={}){let b=this.#R;if(!b)throw new Error("no memoMethod provided to constructor");let{context:S,forceRefresh:h,..._}=y,I=this.get(c,_);if(!h&&I!==void 0)return I;let v=b(c,I,{options:_,context:S});return this.set(c,v,_),v}get(c,y={}){let{allowStale:b=this.allowStale,updateAgeOnGet:S=this.updateAgeOnGet,noDeleteOnStaleGet:h=this.noDeleteOnStaleGet,status:_}=y,I=this.#n.get(c);if(I!==void 0){let v=this.#e[I],A=this.#t(v);return _&&this.#I(_,I),this.#d(I)?(_&&(_.get="stale"),A?(_&&b&&v.__staleWhileFetching!==void 0&&(_.returnedStale=!0),b?v.__staleWhileFetching:void 0):(h||this.#A(c,"expire"),_&&b&&(_.returnedStale=!0),b?v:void 0)):(_&&(_.get="hit"),A?v.__staleWhileFetching:(this.#O(I),S&&this.#T(I),v))}else _&&(_.get="miss")}#F(c,y){this.#h[y]=c,this.#u[c]=y}#O(c){c!==this.#o&&(c===this.#a?this.#a=this.#u[c]:this.#F(this.#h[c],this.#u[c]),this.#F(this.#o,c),this.#o=c)}delete(c){return this.#A(c,"delete")}#A(c,y){let b=!1;if(this.#i!==0){let S=this.#n.get(c);if(S!==void 0)if(b=!0,this.#i===1)this.#D(y);else{this.#k(S);let h=this.#e[S];if(this.#t(h)?h.__abortController.abort(new Error("deleted")):(this.#_||this.#c)&&(this.#_&&this.#g?.(h,c,y),this.#c&&this.#s?.push([h,c,y])),this.#n.delete(c),this.#r[S]=void 0,this.#e[S]=void 0,S===this.#o)this.#o=this.#h[S];else if(S===this.#a)this.#a=this.#u[S];else{let _=this.#h[S];this.#u[_]=this.#u[S];let I=this.#u[S];this.#h[I]=this.#h[S]}this.#i--,this.#m.push(S)}}if(this.#c&&this.#s?.length){let S=this.#s,h;for(;h=S?.shift();)this.#y?.(...h)}return b}clear(){return this.#D("delete")}#D(c){for(let y of this.#E({allowStale:!0})){let b=this.#e[y];if(this.#t(b))b.__abortController.abort(new Error("deleted"));else{let S=this.#r[y];this.#_&&this.#g?.(b,S,c),this.#c&&this.#s?.push([b,S,c])}}if(this.#n.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#p&&this.#w&&(this.#p.fill(0),this.#w.fill(0)),this.#v&&this.#v.fill(0),this.#a=0,this.#o=0,this.#m.length=0,this.#b=0,this.#i=0,this.#c&&this.#s){let y=this.#s,b;for(;b=y?.shift();)this.#y?.(...b)}}};g.LRUCache=p}),ct=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.ContainerIterator=g.Container=g.Base=void 0;var u=class{constructor(f=0){this.iteratorType=f}equals(f){return this.o===f.o}};g.ContainerIterator=u;var o=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};g.Base=o;var s=class extends o{};g.Container=s}),gl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=ct(),o=class extends u.Base{constructor(f=[]){super(),this.S=[];let r=this;f.forEach(function(t){r.push(t)})}clear(){this.i=0,this.S=[]}push(f){return this.S.push(f),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},s=o;g.default=s}),yl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=ct(),o=class extends u.Base{constructor(f=[]){super(),this.j=0,this.q=[];let r=this;f.forEach(function(t){r.push(t)})}clear(){this.q=[],this.i=this.j=0}push(f){let r=this.q.length;if(this.j/r>.5&&this.j+this.i>=r&&r>4096){let t=this.i;for(let n=0;n<t;++n)this.q[n]=this.q[this.j+n];this.j=0,this.q[this.i]=f}else this.q[this.j+this.i]=f;return++this.i}pop(){if(this.i===0)return;let f=this.q[this.j++];return this.i-=1,f}front(){if(this.i!==0)return this.q[this.j]}},s=o;g.default=s}),bl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=ct(),o=class extends u.Base{constructor(f=[],r=function(n,e){return n>e?-1:n<e?1:0},t=!0){if(super(),this.v=r,Array.isArray(f))this.C=t?[...f]:f;else{this.C=[];let e=this;f.forEach(function(i){e.C.push(i)})}this.i=this.C.length;let n=this.i>>1;for(let e=this.i-1>>1;e>=0;--e)this.k(e,n)}m(f){let r=this.C[f];for(;f>0;){let t=f-1>>1,n=this.C[t];if(this.v(n,r)<=0)break;this.C[f]=n,f=t}this.C[f]=r}k(f,r){let t=this.C[f];for(;f<r;){let n=f<<1|1,e=n+1,i=this.C[n];if(e<this.i&&this.v(i,this.C[e])>0&&(n=e,i=this.C[e]),this.v(i,t)>=0)break;this.C[f]=i,f=n}this.C[f]=t}clear(){this.i=0,this.C.length=0}push(f){this.C.push(f),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let f=this.C[0],r=this.C.pop();return this.i-=1,this.i&&(this.C[0]=r,this.k(0,this.i>>1)),f}top(){return this.C[0]}find(f){return this.C.indexOf(f)>=0}remove(f){let r=this.C.indexOf(f);return r<0?!1:(r===0?this.pop():r===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(r,1,this.C.pop()),this.i-=1,this.m(r),this.k(r,this.i>>1)),!0)}updateItem(f){let r=this.C.indexOf(f);return r<0?!1:(this.m(r),this.k(r,this.i>>1),!0)}toArray(){return[...this.C]}},s=o;g.default=s}),Di=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=ct(),o=class extends u.Container{},s=o;g.default=s}),ft=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.throwIteratorAccessError=u;function u(){throw new RangeError("Iterator access denied!")}}),Us=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.RandomIterator=void 0;var u=ct(),o=ft(),s=class extends u.ContainerIterator{constructor(f,r){super(r),this.o=f,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,o.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,o.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,o.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,o.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(f){this.container.setElementByPos(this.o,f)}};g.RandomIterator=s}),ml=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=s(Di()),o=Us();function s(n){return n&&n.t?n:{default:n}}var f=class Ls extends o.RandomIterator{constructor(e,i,a){super(e,a),this.container=i}copy(){return new Ls(this.o,this.container,this.iteratorType)}},r=class extends u.default{constructor(n=[],e=!0){if(super(),Array.isArray(n))this.J=e?[...n]:n,this.i=n.length;else{this.J=[];let i=this;n.forEach(function(a){i.pushBack(a)})}}clear(){this.i=0,this.J.length=0}begin(){return new f(0,this)}end(){return new f(this.i,this)}rBegin(){return new f(this.i-1,this,1)}rEnd(){return new f(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;return this.J[n]}eraseElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;return this.J.splice(n,1),this.i-=1,this.i}eraseElementByValue(n){let e=0;for(let i=0;i<this.i;++i)this.J[i]!==n&&(this.J[e++]=this.J[i]);return this.i=this.J.length=e,this.i}eraseElementByIterator(n){let e=n.o;return n=n.next(),this.eraseElementByPos(e),n}pushBack(n){return this.J.push(n),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(n,e){if(n<0||n>this.i-1)throw new RangeError;this.J[n]=e}insert(n,e,i=1){if(n<0||n>this.i)throw new RangeError;return this.J.splice(n,0,...new Array(i).fill(e)),this.i+=i,this.i}find(n){for(let e=0;e<this.i;++e)if(this.J[e]===n)return new f(e,this);return this.end()}reverse(){this.J.reverse()}unique(){let n=1;for(let e=1;e<this.i;++e)this.J[e]!==this.J[e-1]&&(this.J[n++]=this.J[e]);return this.i=this.J.length=n,this.i}sort(n){this.J.sort(n)}forEach(n){for(let e=0;e<this.i;++e)n(this.J[e],e,this)}[Symbol.iterator](){return(function*(){yield*this.J}).bind(this)()}},t=r;g.default=t}),vl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=f(Di()),o=ct(),s=ft();function f(e){return e&&e.t?e:{default:e}}var r=class Fs extends o.ContainerIterator{constructor(i,a,d,p){super(p),this.o=i,this.h=a,this.container=d,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o.l}set pointer(i){this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o.l=i}copy(){return new Fs(this.o,this.h,this.container,this.iteratorType)}},t=class extends u.default{constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let i=this;e.forEach(function(a){i.pushBack(a)})}V(e){let{L:i,B:a}=e;i.B=a,a.L=i,e===this.p&&(this.p=a),e===this._&&(this._=i),this.i-=1}G(e,i){let a=i.B,d={l:e,L:i,B:a};i.B=d,a.L=d,i===this.h&&(this.p=d),a===this.h&&(this._=d),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new r(this.p,this.h,this)}end(){return new r(this.h,this.h,this)}rBegin(){return new r(this._,this.h,this,1)}rEnd(){return new r(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;return i.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;return this.V(i),this.i}eraseElementByValue(e){let i=this.p;for(;i!==this.h;)i.l===e&&this.V(i),i=i.B;return this.i}eraseElementByIterator(e){let i=e.o;return i===this.h&&(0,s.throwIteratorAccessError)(),e=e.next(),this.V(i),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(this.i===0)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(this.i===0)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,i){if(e<0||e>this.i-1)throw new RangeError;let a=this.p;for(;e--;)a=a.B;a.l=i}insert(e,i,a=1){if(e<0||e>this.i)throw new RangeError;if(a<=0)return this.i;if(e===0)for(;a--;)this.pushFront(i);else if(e===this.i)for(;a--;)this.pushBack(i);else{let d=this.p;for(let m=1;m<e;++m)d=d.B;let p=d.B;for(this.i+=a;a--;)d.B={l:i,L:d},d.B.L=d,d=d.B;d.B=p,p.L=d}return this.i}find(e){let i=this.p;for(;i!==this.h;){if(i.l===e)return new r(i,this.h,this);i=i.B}return this.end()}reverse(){if(this.i<=1)return;let e=this.p,i=this._,a=0;for(;a<<1<this.i;){let d=e.l;e.l=i.l,i.l=d,e=e.B,i=i.L,a+=1}}unique(){if(this.i<=1)return this.i;let e=this.p;for(;e!==this.h;){let i=e;for(;i.B!==this.h&&i.l===i.B.l;)i=i.B,this.i-=1;e.B=i.B,e.B.L=e,e=e.B}return this.i}sort(e){if(this.i<=1)return;let i=[];this.forEach(function(d){i.push(d)}),i.sort(e);let a=this.p;i.forEach(function(d){a.l=d,a=a.B})}merge(e){let i=this;if(this.i===0)e.forEach(function(a){i.pushBack(a)});else{let a=this.p;e.forEach(function(d){for(;a!==i.h&&a.l<=d;)a=a.B;i.G(d,a.L)})}return this.i}forEach(e){let i=this.p,a=0;for(;i!==this.h;)e(i.l,a++,this),i=i.B}[Symbol.iterator](){return(function*(){if(this.i===0)return;let e=this.p;for(;e!==this.h;)yield e.l,e=e.B}).bind(this)()}},n=t;g.default=n}),wl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=s(Di()),o=Us();function s(n){return n&&n.t?n:{default:n}}var f=class Ds extends o.RandomIterator{constructor(e,i,a){super(e,a),this.container=i}copy(){return new Ds(this.o,this.container,this.iteratorType)}},r=class extends u.default{constructor(n=[],e=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let i=(()=>{if(typeof n.length=="number")return n.length;if(typeof n.size=="number")return n.size;if(typeof n.size=="function")return n.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=e,this.P=Math.max(Math.ceil(i/this.F),1);for(let p=0;p<this.P;++p)this.A.push(new Array(this.F));let a=Math.ceil(i/this.F);this.j=this.R=(this.P>>1)-(a>>1),this.D=this.N=this.F-i%this.F>>1;let d=this;n.forEach(function(p){d.pushBack(p)})}T(){let n=[],e=Math.max(this.P>>1,1);for(let i=0;i<e;++i)n[i]=new Array(this.F);for(let i=this.j;i<this.P;++i)n[n.length]=this.A[i];for(let i=0;i<this.R;++i)n[n.length]=this.A[i];n[n.length]=[...this.A[this.R]],this.j=e,this.R=n.length-1;for(let i=0;i<e;++i)n[n.length]=new Array(this.F);this.A=n,this.P=n.length}O(n){let e=this.D+n+1,i=e%this.F,a=i-1,d=this.j+(e-i)/this.F;return i===0&&(d-=1),d%=this.P,a<0&&(a+=this.F),{curNodeBucketIndex:d,curNodePointerIndex:a}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new f(0,this)}end(){return new f(this.i,this)}rBegin(){return new f(this.i-1,this,1)}rEnd(){return new f(-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(n){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=n,this.i}popBack(){if(this.i===0)return;let n=this.A[this.R][this.N];return this.i!==1&&(this.N>0?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,n}pushFront(n){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]=n,this.i}popFront(){if(this.i===0)return;let n=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,n}getElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;let{curNodeBucketIndex:e,curNodePointerIndex:i}=this.O(n);return this.A[e][i]}setElementByPos(n,e){if(n<0||n>this.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:a}=this.O(n);this.A[i][a]=e}insert(n,e,i=1){if(n<0||n>this.i)throw new RangeError;if(n===0)for(;i--;)this.pushFront(e);else if(n===this.i)for(;i--;)this.pushBack(e);else{let a=[];for(let d=n;d<this.i;++d)a.push(this.getElementByPos(d));this.cut(n-1);for(let d=0;d<i;++d)this.pushBack(e);for(let d=0;d<a.length;++d)this.pushBack(a[d])}return this.i}cut(n){if(n<0)return this.clear(),0;let{curNodeBucketIndex:e,curNodePointerIndex:i}=this.O(n);return this.R=e,this.N=i,this.i=n+1,this.i}eraseElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;if(n===0)this.popFront();else if(n===this.i-1)this.popBack();else{let e=[];for(let a=n+1;a<this.i;++a)e.push(this.getElementByPos(a));this.cut(n),this.popBack();let i=this;e.forEach(function(a){i.pushBack(a)})}return this.i}eraseElementByValue(n){if(this.i===0)return 0;let e=[];for(let a=0;a<this.i;++a){let d=this.getElementByPos(a);d!==n&&e.push(d)}let i=e.length;for(let a=0;a<i;++a)this.setElementByPos(a,e[a]);return this.cut(i-1)}eraseElementByIterator(n){let e=n.o;return this.eraseElementByPos(e),n=n.next(),n}find(n){for(let e=0;e<this.i;++e)if(this.getElementByPos(e)===n)return new f(e,this);return this.end()}reverse(){let n=0,e=this.i-1;for(;n<e;){let i=this.getElementByPos(n);this.setElementByPos(n,this.getElementByPos(e)),this.setElementByPos(e,i),n+=1,e-=1}}unique(){if(this.i<=1)return this.i;let n=1,e=this.getElementByPos(0);for(let i=1;i<this.i;++i){let a=this.getElementByPos(i);a!==e&&(e=a,this.setElementByPos(n++,a))}for(;this.i>n;)this.popBack();return this.i}sort(n){let e=[];for(let i=0;i<this.i;++i)e.push(this.getElementByPos(i));e.sort(n);for(let i=0;i<this.i;++i)this.setElementByPos(i,e[i])}shrinkToFit(){if(this.i===0)return;let n=[];this.forEach(function(e){n.push(e)}),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let e=0;e<this.P;++e)this.A.push(new Array(this.F));for(let e=0;e<n.length;++e)this.pushBack(n[e])}forEach(n){for(let e=0;e<this.i;++e)n(this.getElementByPos(e),e,this)}[Symbol.iterator](){return(function*(){for(let n=0;n<this.i;++n)yield this.getElementByPos(n)}).bind(this)()}},t=r;g.default=t}),_l=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.TreeNodeEnableIndex=g.TreeNode=void 0;var u=class{constructor(s,f){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=s,this.l=f}L(){let s=this;if(s.ee===1&&s.tt.tt===s)s=s.W;else if(s.U)for(s=s.U;s.W;)s=s.W;else{let f=s.tt;for(;f.U===s;)s=f,f=s.tt;s=f}return s}B(){let s=this;if(s.W){for(s=s.W;s.U;)s=s.U;return s}else{let f=s.tt;for(;f.W===s;)s=f,f=s.tt;return s.W!==f?f:s}}te(){let s=this.tt,f=this.W,r=f.U;return s.tt===this?s.tt=f:s.U===this?s.U=f:s.W=f,f.tt=s,f.U=this,this.tt=f,this.W=r,r&&(r.tt=this),f}se(){let s=this.tt,f=this.U,r=f.W;return s.tt===this?s.tt=f:s.U===this?s.U=f:s.W=f,f.tt=s,f.W=this,this.tt=f,this.U=r,r&&(r.tt=this),f}};g.TreeNode=u;var o=class extends u{constructor(){super(...arguments),this.rt=1}te(){let s=super.te();return this.ie(),s.ie(),s}se(){let s=super.se();return this.ie(),s.ie(),s}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};g.TreeNodeEnableIndex=o}),Ws=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=_l(),o=ct(),s=ft(),f=class extends o.Container{constructor(t=function(e,i){return e<i?-1:e>i?1:0},n=!1){super(),this.Y=void 0,this.v=t,n?(this.re=u.TreeNodeEnableIndex,this.M=function(e,i,a){let d=this.ne(e,i,a);if(d){let p=d.tt;for(;p!==this.h;)p.rt+=1,p=p.tt;let m=this.he(d);if(m){let{parentNode:c,grandParent:y,curNode:b}=m;c.ie(),y.ie(),b.ie()}}return this.i},this.V=function(e){let i=this.fe(e);for(;i!==this.h;)i.rt-=1,i=i.tt}):(this.re=u.TreeNode,this.M=function(e,i,a){let d=this.ne(e,i,a);return d&&this.he(d),this.i},this.V=this.fe),this.h=new this.re}X(t,n){let e=this.h;for(;t;){let i=this.v(t.u,n);if(i<0)t=t.W;else if(i>0)e=t,t=t.U;else return t}return e}Z(t,n){let e=this.h;for(;t;)this.v(t.u,n)<=0?t=t.W:(e=t,t=t.U);return e}$(t,n){let e=this.h;for(;t;){let i=this.v(t.u,n);if(i<0)e=t,t=t.W;else if(i>0)t=t.U;else return t}return e}rr(t,n){let e=this.h;for(;t;)this.v(t.u,n)<0?(e=t,t=t.W):t=t.U;return e}ue(t){for(;;){let n=t.tt;if(n===this.h)return;if(t.ee===1){t.ee=0;return}if(t===n.U){let e=n.W;if(e.ee===1)e.ee=0,n.ee=1,n===this.Y?this.Y=n.te():n.te();else if(e.W&&e.W.ee===1){e.ee=n.ee,n.ee=0,e.W.ee=0,n===this.Y?this.Y=n.te():n.te();return}else e.U&&e.U.ee===1?(e.ee=1,e.U.ee=0,e.se()):(e.ee=1,t=n)}else{let e=n.U;if(e.ee===1)e.ee=0,n.ee=1,n===this.Y?this.Y=n.se():n.se();else if(e.U&&e.U.ee===1){e.ee=n.ee,n.ee=0,e.U.ee=0,n===this.Y?this.Y=n.se():n.se();return}else e.W&&e.W.ee===1?(e.ee=1,e.W.ee=0,e.te()):(e.ee=1,t=n)}}}fe(t){if(this.i===1)return this.clear(),this.h;let n=t;for(;n.U||n.W;){if(n.W)for(n=n.W;n.U;)n=n.U;else n=n.U;[t.u,n.u]=[n.u,t.u],[t.l,n.l]=[n.l,t.l],t=n}this.h.U===n?this.h.U=n.tt:this.h.W===n&&(this.h.W=n.tt),this.ue(n);let e=n.tt;return n===e.U?e.U=void 0:e.W=void 0,this.i-=1,this.Y.ee=0,e}oe(t,n){return t===void 0?!1:this.oe(t.U,n)||n(t)?!0:this.oe(t.W,n)}he(t){for(;;){let n=t.tt;if(n.ee===0)return;let e=n.tt;if(n===e.U){let i=e.W;if(i&&i.ee===1){if(i.ee=n.ee=0,e===this.Y)return;e.ee=1,t=e;continue}else if(t===n.W){if(t.ee=0,t.U&&(t.U.tt=n),t.W&&(t.W.tt=e),n.W=t.U,e.U=t.W,t.U=n,t.W=e,e===this.Y)this.Y=t,this.h.tt=t;else{let a=e.tt;a.U===e?a.U=t:a.W=t}return t.tt=e.tt,n.tt=t,e.tt=t,e.ee=1,{parentNode:n,grandParent:e,curNode:t}}else n.ee=0,e===this.Y?this.Y=e.se():e.se(),e.ee=1}else{let i=e.U;if(i&&i.ee===1){if(i.ee=n.ee=0,e===this.Y)return;e.ee=1,t=e;continue}else if(t===n.U){if(t.ee=0,t.U&&(t.U.tt=e),t.W&&(t.W.tt=n),e.W=t.U,n.U=t.W,t.U=e,t.W=n,e===this.Y)this.Y=t,this.h.tt=t;else{let a=e.tt;a.U===e?a.U=t:a.W=t}return t.tt=e.tt,n.tt=t,e.tt=t,e.ee=1,{parentNode:n,grandParent:e,curNode:t}}else n.ee=0,e===this.Y?this.Y=e.te():e.te(),e.ee=1}return}}ne(t,n,e){if(this.Y===void 0){this.i+=1,this.Y=new this.re(t,n),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 i,a=this.h.U,d=this.v(a.u,t);if(d===0){a.l=n;return}else if(d>0)a.U=new this.re(t,n),a.U.tt=a,i=a.U,this.h.U=i;else{let p=this.h.W,m=this.v(p.u,t);if(m===0){p.l=n;return}else if(m<0)p.W=new this.re(t,n),p.W.tt=p,i=p.W,this.h.W=i;else{if(e!==void 0){let c=e.o;if(c!==this.h){let y=this.v(c.u,t);if(y===0){c.l=n;return}else if(y>0){let b=c.L(),S=this.v(b.u,t);if(S===0){b.l=n;return}else S<0&&(i=new this.re(t,n),b.W===void 0?(b.W=i,i.tt=b):(c.U=i,i.tt=c))}}}if(i===void 0)for(i=this.Y;;){let c=this.v(i.u,t);if(c>0){if(i.U===void 0){i.U=new this.re(t,n),i.U.tt=i,i=i.U;break}i=i.U}else if(c<0){if(i.W===void 0){i.W=new this.re(t,n),i.W.tt=i,i=i.W;break}i=i.W}else{i.l=n;return}}}}return this.i+=1,i}I(t,n){for(;t;){let e=this.v(t.u,n);if(e<0)t=t.W;else if(e>0)t=t.U;else return t}return t||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(t,n){let e=t.o;if(e===this.h&&(0,s.throwIteratorAccessError)(),this.i===1)return e.u=n,!0;if(e===this.h.U)return this.v(e.B().u,n)>0?(e.u=n,!0):!1;if(e===this.h.W)return this.v(e.L().u,n)<0?(e.u=n,!0):!1;let i=e.L().u;if(this.v(i,n)>=0)return!1;let a=e.B().u;return this.v(a,n)<=0?!1:(e.u=n,!0)}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n=0,e=this;return this.oe(this.Y,function(i){return t===n?(e.V(i),!0):(n+=1,!1)}),this.i}eraseElementByKey(t){if(this.i===0)return!1;let n=this.I(this.Y,t);return n===this.h?!1:(this.V(n),!0)}eraseElementByIterator(t){let n=t.o;n===this.h&&(0,s.throwIteratorAccessError)();let e=n.W===void 0;return t.iteratorType===0?e&&t.next():(!e||n.U===void 0)&&t.next(),this.V(n),t}forEach(t){let n=0;for(let e of this)t(e,n++,this)}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n,e=0;for(let i of this){if(e===t){n=i;break}e+=1}return n}getHeight(){if(this.i===0)return 0;let t=function(n){return n?Math.max(t(n.U),t(n.W))+1:0};return t(this.Y)}},r=f;g.default=r}),qs=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=ct(),o=ft(),s=class extends u.ContainerIterator{constructor(r,t,n){super(n),this.o=r,this.h=t,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,o.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,o.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,o.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,o.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let r=this.o,t=this.h.tt;if(r===this.h)return t?t.rt-1:0;let n=0;for(r.U&&(n+=r.U.rt);r!==t;){let e=r.tt;r===e.W&&(n+=1,e.U&&(n+=e.U.rt)),r=e}return n}},f=s;g.default=f}),Sl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=f(Ws()),o=f(qs()),s=ft();function f(e){return e&&e.t?e:{default:e}}var r=class $s extends o.default{constructor(i,a,d,p){super(i,a,p),this.container=d}get pointer(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o.u}copy(){return new $s(this.o,this.h,this.container,this.iteratorType)}},t=class extends u.default{constructor(e=[],i,a){super(i,a);let d=this;e.forEach(function(p){d.insert(p)})}*K(e){e!==void 0&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W))}begin(){return new r(this.h.U||this.h,this.h,this)}end(){return new r(this.h,this.h,this)}rBegin(){return new r(this.h.W||this.h,this.h,this,1)}rEnd(){return new r(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(e,i){return this.M(e,void 0,i)}find(e){let i=this.I(this.Y,e);return new r(i,this.h,this)}lowerBound(e){let i=this.X(this.Y,e);return new r(i,this.h,this)}upperBound(e){let i=this.Z(this.Y,e);return new r(i,this.h,this)}reverseLowerBound(e){let i=this.$(this.Y,e);return new r(i,this.h,this)}reverseUpperBound(e){let i=this.rr(this.Y,e);return new r(i,this.h,this)}union(e){let i=this;return e.forEach(function(a){i.insert(a)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},n=t;g.default=n}),El=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=f(Ws()),o=f(qs()),s=ft();function f(e){return e&&e.t?e:{default:e}}var r=class Hs extends o.default{constructor(i,a,d,p){super(i,a,p),this.container=d}get pointer(){this.o===this.h&&(0,s.throwIteratorAccessError)();let i=this;return new Proxy([],{get(a,d){if(d==="0")return i.o.u;if(d==="1")return i.o.l},set(a,d,p){if(d!=="1")throw new TypeError("props must be 1");return i.o.l=p,!0}})}copy(){return new Hs(this.o,this.h,this.container,this.iteratorType)}},t=class extends u.default{constructor(e=[],i,a){super(i,a);let d=this;e.forEach(function(p){d.setElement(p[0],p[1])})}*K(e){e!==void 0&&(yield*this.K(e.U),yield[e.u,e.l],yield*this.K(e.W))}begin(){return new r(this.h.U||this.h,this.h,this)}end(){return new r(this.h,this.h,this)}rBegin(){return new r(this.h.W||this.h,this.h,this,1)}rEnd(){return new r(this.h,this.h,this,1)}front(){if(this.i===0)return;let e=this.h.U;return[e.u,e.l]}back(){if(this.i===0)return;let e=this.h.W;return[e.u,e.l]}lowerBound(e){let i=this.X(this.Y,e);return new r(i,this.h,this)}upperBound(e){let i=this.Z(this.Y,e);return new r(i,this.h,this)}reverseLowerBound(e){let i=this.$(this.Y,e);return new r(i,this.h,this)}reverseUpperBound(e){let i=this.rr(this.Y,e);return new r(i,this.h,this)}setElement(e,i,a){return this.M(e,i,a)}find(e){let i=this.I(this.Y,e);return new r(i,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let i=this;return e.forEach(function(a){i.setElement(a[0],a[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},n=t;g.default=n}),zs=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=u;function u(o){let s=typeof o;return s==="object"&&o!==null||s==="function"}}),Vs=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.HashContainerIterator=g.HashContainer=void 0;var u=ct(),o=f(zs()),s=ft();function f(n){return n&&n.t?n:{default:n}}var r=class extends u.ContainerIterator{constructor(n,e,i){super(i),this.o=n,this.h=e,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L,this})}};g.HashContainerIterator=r;var t=class extends u.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(n){let{L:e,B:i}=n;e.B=i,i.L=e,n===this.p&&(this.p=i),n===this._&&(this._=e),this.i-=1}M(n,e,i){i===void 0&&(i=(0,o.default)(n));let a;if(i){let d=n[this.HASH_TAG];if(d!==void 0)return this.H[d].l=e,this.i;Object.defineProperty(n,this.HASH_TAG,{value:this.H.length,configurable:!0}),a={u:n,l:e,L:this._,B:this.h},this.H.push(a)}else{let d=this.g[n];if(d)return d.l=e,this.i;a={u:n,l:e,L:this._,B:this.h},this.g[n]=a}return this.i===0?(this.p=a,this.h.B=a):this._.B=a,this._=a,this.h.L=a,++this.i}I(n,e){if(e===void 0&&(e=(0,o.default)(n)),e){let i=n[this.HASH_TAG];return i===void 0?this.h:this.H[i]}else return this.g[n]||this.h}clear(){let n=this.HASH_TAG;this.H.forEach(function(e){delete e.u[n]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(n,e){let i;if(e===void 0&&(e=(0,o.default)(n)),e){let a=n[this.HASH_TAG];if(a===void 0)return!1;delete n[this.HASH_TAG],i=this.H[a],delete this.H[a]}else{if(i=this.g[n],i===void 0)return!1;delete this.g[n]}return this.V(i),!0}eraseElementByIterator(n){let e=n.o;return e===this.h&&(0,s.throwIteratorAccessError)(),this.V(e),n.next()}eraseElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;let e=this.p;for(;n--;)e=e.B;return this.V(e),this.i}};g.HashContainer=t}),Al=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=Vs(),o=ft(),s=class Ks extends u.HashContainerIterator{constructor(n,e,i,a){super(n,e,a),this.container=i}get pointer(){return this.o===this.h&&(0,o.throwIteratorAccessError)(),this.o.u}copy(){return new Ks(this.o,this.h,this.container,this.iteratorType)}},f=class extends u.HashContainer{constructor(t=[]){super();let n=this;t.forEach(function(e){n.insert(e)})}begin(){return new s(this.p,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this._,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(t,n){return this.M(t,void 0,n)}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n=this.p;for(;t--;)n=n.B;return n.u}find(t,n){let e=this.I(t,n);return new s(e,this.h,this)}forEach(t){let n=0,e=this.p;for(;e!==this.h;)t(e.u,n++,this),e=e.B}[Symbol.iterator](){return(function*(){let t=this.p;for(;t!==this.h;)yield t.u,t=t.B}).bind(this)()}},r=f;g.default=r}),Il=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),g.default=void 0;var u=Vs(),o=f(zs()),s=ft();function f(e){return e&&e.t?e:{default:e}}var r=class Gs extends u.HashContainerIterator{constructor(i,a,d,p){super(i,a,p),this.container=d}get pointer(){this.o===this.h&&(0,s.throwIteratorAccessError)();let i=this;return new Proxy([],{get(a,d){if(d==="0")return i.o.u;if(d==="1")return i.o.l},set(a,d,p){if(d!=="1")throw new TypeError("props must be 1");return i.o.l=p,!0}})}copy(){return new Gs(this.o,this.h,this.container,this.iteratorType)}},t=class extends u.HashContainer{constructor(e=[]){super();let i=this;e.forEach(function(a){i.setElement(a[0],a[1])})}begin(){return new r(this.p,this.h,this)}end(){return new r(this.h,this.h,this)}rBegin(){return new r(this._,this.h,this,1)}rEnd(){return new r(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(e,i,a){return this.M(e,i,a)}getElementByKey(e,i){if(i===void 0&&(i=(0,o.default)(e)),i){let d=e[this.HASH_TAG];return d!==void 0?this.H[d].l:void 0}let a=this.g[e];return a?a.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;return[i.u,i.l]}find(e,i){let a=this.I(e,i);return new r(a,this.h,this)}forEach(e){let i=0,a=this.p;for(;a!==this.h;)e([a.u,a.l],i++,this),a=a.B}[Symbol.iterator](){return(function*(){let e=this.p;for(;e!==this.h;)yield[e.u,e.l],e=e.B}).bind(this)()}},n=t;g.default=n}),xl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"t",{value:!0}),Object.defineProperty(g,"Deque",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(g,"HashMap",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(g,"HashSet",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(g,"LinkList",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(g,"OrderedMap",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(g,"OrderedSet",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(g,"PriorityQueue",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(g,"Queue",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(g,"Stack",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(g,"Vector",{enumerable:!0,get:function(){return f.default}});var u=d(gl()),o=d(yl()),s=d(bl()),f=d(ml()),r=d(vl()),t=d(wl()),n=d(Sl()),e=d(El()),i=d(Al()),a=d(Il());function d(p){return p&&p.t?p:{default:p}}}),Tl=de((g,u)=>{le(),ce(),ue();var o=xl().OrderedSet,s=at()("number-allocator:trace"),f=at()("number-allocator:error");function r(n,e){this.low=n,this.high=e}r.prototype.equals=function(n){return this.low===n.low&&this.high===n.high},r.prototype.compare=function(n){return this.low<n.low&&this.high<n.low?-1:n.low<this.low&&n.high<this.low?1:0};function t(n,e){if(!(this instanceof t))return new t(n,e);this.min=n,this.max=e,this.ss=new o([],(i,a)=>i.compare(a)),s("Create"),this.clear()}t.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},t.prototype.alloc=function(){if(this.ss.size()===0)return s("alloc():empty"),null;let n=this.ss.begin(),e=n.pointer.low,i=n.pointer.high,a=e;return a+1<=i?this.ss.updateKeyByIterator(n,new r(e+1,i)):this.ss.eraseElementByPos(0),s("alloc():"+a),a},t.prototype.use=function(n){let e=new r(n,n),i=this.ss.lowerBound(e);if(!i.equals(this.ss.end())){let a=i.pointer.low,d=i.pointer.high;return i.pointer.equals(e)?(this.ss.eraseElementByIterator(i),s("use():"+n),!0):a>n?!1:a===n?(this.ss.updateKeyByIterator(i,new r(a+1,d)),s("use():"+n),!0):d===n?(this.ss.updateKeyByIterator(i,new r(a,d-1)),s("use():"+n),!0):(this.ss.updateKeyByIterator(i,new r(n+1,d)),this.ss.insert(new r(a,n-1)),s("use():"+n),!0)}return s("use():failed"),!1},t.prototype.free=function(n){if(n<this.min||n>this.max){f("free():"+n+" is out of range");return}let e=new r(n,n),i=this.ss.upperBound(e);if(i.equals(this.ss.end())){if(i.equals(this.ss.begin())){this.ss.insert(e);return}i.pre();let a=i.pointer.high;i.pointer.high+1===n?this.ss.updateKeyByIterator(i,new r(a,n)):this.ss.insert(e)}else if(i.equals(this.ss.begin()))if(n+1===i.pointer.low){let a=i.pointer.high;this.ss.updateKeyByIterator(i,new r(n,a))}else this.ss.insert(e);else{let a=i.pointer.low,d=i.pointer.high;i.pre();let p=i.pointer.low;i.pointer.high+1===n?n+1===a?(this.ss.eraseElementByIterator(i),this.ss.updateKeyByIterator(i,new r(p,d))):this.ss.updateKeyByIterator(i,new r(p,n)):n+1===a?(this.ss.eraseElementByIterator(i.next()),this.ss.insert(new r(n,d))):this.ss.insert(e)}s("free():"+n)},t.prototype.clear=function(){s("clear()"),this.ss.clear(),this.ss.insert(new r(this.min,this.max))},t.prototype.intervalCount=function(){return this.ss.size()},t.prototype.dump=function(){console.log("length:"+this.ss.size());for(let n of this.ss)console.log(n)},u.exports=t}),Qs=de((g,u)=>{le(),ce(),ue();var o=Tl();u.exports.NumberAllocator=o}),kl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=dl(),o=Qs(),s=class{aliasToTopic;topicToAlias;max;numberAllocator;length;constructor(f){f>0&&(this.aliasToTopic=new u.LRUCache({max:f}),this.topicToAlias={},this.numberAllocator=new o.NumberAllocator(1,f),this.max=f,this.length=0)}put(f,r){if(r===0||r>this.max)return!1;let t=this.aliasToTopic.get(r);return t&&delete this.topicToAlias[t],this.aliasToTopic.set(r,f),this.topicToAlias[f]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(f){return this.aliasToTopic.get(f)}getAliasByTopic(f){let r=this.topicToAlias[f];return typeof r<"u"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){return this.numberAllocator.firstVacant()||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};g.default=s}),Ol=de(g=>{le(),ce(),ue();var u=g&&g.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(g,"__esModule",{value:!0});var o=Pr(),s=u(kl()),f=Nt(),r=(t,n)=>{t.log("_handleConnack");let{options:e}=t,i=e.protocolVersion===5?n.reasonCode:n.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,n.properties){if(n.properties.topicAliasMaximum){if(n.properties.topicAliasMaximum>65535){t.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}n.properties.topicAliasMaximum>0&&(t.topicAliasSend=new s.default(n.properties.topicAliasMaximum))}n.properties.serverKeepAlive&&e.keepalive&&(e.keepalive=n.properties.serverKeepAlive),n.properties.maximumPacketSize&&(e.properties||(e.properties={}),e.properties.maximumPacketSize=n.properties.maximumPacketSize)}if(i===0)t.reconnecting=!1,t._onConnect(n);else if(i>0){let a=new f.ErrorWithReasonCode(`Connection refused: ${o.ReasonCodes[i]}`,i);t.emit("error",a),t.options.reconnectOnConnackError&&t._cleanUp(!0)}};g.default=r}),Pl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=(o,s,f)=>{o.log("handling pubrel packet");let r=typeof f<"u"?f:o.noop,{messageId:t}=s,n={cmd:"pubcomp",messageId:t};o.incomingStore.get(s,(e,i)=>{e?o._sendPacket(n,r):(o.emit("message",i.topic,i.payload,i),o.handleMessage(i,a=>{if(a)return r(a);o.incomingStore.del(i,o.noop),o._sendPacket(n,r)}))})};g.default=u}),Rl=de(g=>{le(),ce(),ue();var u=g&&g.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(g,"__esModule",{value:!0});var o=u(fl()),s=u(pl()),f=u(Ol()),r=u(Pr()),t=u(Pl()),n=(e,i,a)=>{let{options:d}=e;if(d.protocolVersion===5&&d.properties&&d.properties.maximumPacketSize&&d.properties.maximumPacketSize<i.length)return e.emit("error",new Error(`exceeding packets size ${i.cmd}`)),e.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),e;switch(e.log("_handlePacket :: emitting packetreceive"),e.emit("packetreceive",i),i.cmd){case"publish":(0,o.default)(e,i,a);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":e.reschedulePing(),(0,r.default)(e,i),a();break;case"pubrel":e.reschedulePing(),(0,t.default)(e,i,a);break;case"connack":(0,f.default)(e,i),a();break;case"auth":e.reschedulePing(),(0,s.default)(e,i),a();break;case"pingresp":e.log("_handlePacket :: received pingresp"),e.reschedulePing(!0),a();break;case"disconnect":e.emit("disconnect",i),a();break;default:e.log("_handlePacket :: unknown command"),a();break}};g.default=n}),Ys=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=class{nextId;constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let o=this.nextId++;return this.nextId===65536&&(this.nextId=1),o}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(o){return!0}deallocate(o){}clear(){}};g.default=u}),Cl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=class{aliasToTopic;max;length;constructor(o){this.aliasToTopic={},this.max=o}put(o,s){return s===0||s>this.max?!1:(this.aliasToTopic[s]=o,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(o){return this.aliasToTopic[o]}clear(){this.aliasToTopic={}}};g.default=u}),Ml=de(g=>{le(),ce(),ue();var u=g&&g.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(g,"__esModule",{value:!0}),g.TypedEventEmitter=void 0;var o=u((It(),Pe(bt))),s=Nt(),f=class{};g.TypedEventEmitter=f,(0,s.applyMixin)(f,o.default)}),Rr=de((g,u)=>{le(),ce(),ue();function o(s){"@babel/helpers - typeof";return u.exports=o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},u.exports.__esModule=!0,u.exports.default=u.exports,o(s)}u.exports=o,u.exports.__esModule=!0,u.exports.default=u.exports}),jl=de((g,u)=>{le(),ce(),ue();var o=Rr().default;function s(f,r){if(o(f)!="object"||!f)return f;var t=f[Symbol.toPrimitive];if(t!==void 0){var n=t.call(f,r||"default");if(o(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(f)}u.exports=s,u.exports.__esModule=!0,u.exports.default=u.exports}),Nl=de((g,u)=>{le(),ce(),ue();var o=Rr().default,s=jl();function f(r){var t=s(r,"string");return o(t)=="symbol"?t:t+""}u.exports=f,u.exports.__esModule=!0,u.exports.default=u.exports}),Bl=de((g,u)=>{le(),ce(),ue();var o=Nl();function s(f,r,t){return(r=o(r))in f?Object.defineProperty(f,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):f[r]=t,f}u.exports=s,u.exports.__esModule=!0,u.exports.default=u.exports}),Ul=de((g,u)=>{le(),ce(),ue();function o(s){if(Array.isArray(s))return s}u.exports=o,u.exports.__esModule=!0,u.exports.default=u.exports}),Ll=de((g,u)=>{le(),ce(),ue();function o(s,f){var r=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(r!=null){var t,n,e,i,a=[],d=!0,p=!1;try{if(e=(r=r.call(s)).next,f===0){if(Object(r)!==r)return;d=!1}else for(;!(d=(t=e.call(r)).done)&&(a.push(t.value),a.length!==f);d=!0);}catch(m){p=!0,n=m}finally{try{if(!d&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(p)throw n}}return a}}u.exports=o,u.exports.__esModule=!0,u.exports.default=u.exports}),Fl=de((g,u)=>{le(),ce(),ue();function o(s,f){(f==null||f>s.length)&&(f=s.length);for(var r=0,t=Array(f);r<f;r++)t[r]=s[r];return t}u.exports=o,u.exports.__esModule=!0,u.exports.default=u.exports}),Dl=de((g,u)=>{le(),ce(),ue();var o=Fl();function s(f,r){if(f){if(typeof f=="string")return o(f,r);var t={}.toString.call(f).slice(8,-1);return t==="Object"&&f.constructor&&(t=f.constructor.name),t==="Map"||t==="Set"?Array.from(f):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(f,r):void 0}}u.exports=s,u.exports.__esModule=!0,u.exports.default=u.exports}),Wl=de((g,u)=>{le(),ce(),ue();function o(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}u.exports=o,u.exports.__esModule=!0,u.exports.default=u.exports}),ql=de((g,u)=>{le(),ce(),ue();var o=Ul(),s=Ll(),f=Dl(),r=Wl();function t(n,e){return o(n)||s(n,e)||f(n,e)||r()}u.exports=t,u.exports.__esModule=!0,u.exports.default=u.exports}),Js=de((g,u)=>{le(),ce(),ue(),(function(o,s){typeof g=="object"&&typeof u<"u"?s(g):typeof define=="function"&&define.amd?define(["exports"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.fastUniqueNumbers={}))})(g,function(o){var s=function(m){return function(c){var y=m(c);return c.add(y),y}},f=function(m){return function(c,y){return m.set(c,y),y}},r=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,t=536870912,n=t*2,e=function(m,c){return function(y){var b=c.get(y),S=b===void 0?y.size:b<n?b+1:0;if(!y.has(S))return m(y,S);if(y.size<t){for(;y.has(S);)S=Math.floor(Math.random()*n);return m(y,S)}if(y.size>r)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;y.has(S);)S=Math.floor(Math.random()*r);return m(y,S)}},i=new WeakMap,a=f(i),d=e(a,i),p=s(d);o.addUniqueNumber=p,o.generateUniqueNumber=d})}),$l=de((g,u)=>{le(),ce(),ue();function o(f,r,t,n,e,i,a){try{var d=f[i](a),p=d.value}catch(m){return void t(m)}d.done?r(p):Promise.resolve(p).then(n,e)}function s(f){return function(){var r=this,t=arguments;return new Promise(function(n,e){var i=f.apply(r,t);function a(p){o(i,n,e,a,d,"next",p)}function d(p){o(i,n,e,a,d,"throw",p)}a(void 0)})}}u.exports=s,u.exports.__esModule=!0,u.exports.default=u.exports}),Xs=de((g,u)=>{le(),ce(),ue();function o(s,f){this.v=s,this.k=f}u.exports=o,u.exports.__esModule=!0,u.exports.default=u.exports}),Zs=de((g,u)=>{le(),ce(),ue();function o(s,f,r,t){var n=Object.defineProperty;try{n({},"",{})}catch{n=0}u.exports=o=function(e,i,a,d){function p(m,c){o(e,m,function(y){return this._invoke(m,c,y)})}i?n?n(e,i,{value:a,enumerable:!d,configurable:!d,writable:!d}):e[i]=a:(p("next",0),p("throw",1),p("return",2))},u.exports.__esModule=!0,u.exports.default=u.exports,o(s,f,r,t)}u.exports=o,u.exports.__esModule=!0,u.exports.default=u.exports}),ea=de((g,u)=>{le(),ce(),ue();var o=Zs();function s(){var f,r,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",e=t.toStringTag||"@@toStringTag";function i(S,h,_,I){var v=h&&h.prototype instanceof d?h:d,A=Object.create(v.prototype);return o(A,"_invoke",(function(E,T,C){var P,L,k,q=0,F=C||[],B=!1,ae={p:0,n:0,v:f,a:Q,f:Q.bind(f,4),d:function(V,re){return P=V,L=0,k=f,ae.n=re,a}};function Q(V,re){for(L=V,k=re,r=0;!B&&q&&!D&&r<F.length;r++){var D,Z=F[r],R=ae.p,J=Z[2];V>3?(D=J===re)&&(k=Z[(L=Z[4])?5:(L=3,3)],Z[4]=Z[5]=f):Z[0]<=R&&((D=V<2&&R<Z[1])?(L=0,ae.v=re,ae.n=Z[1]):R<J&&(D=V<3||Z[0]>re||re>J)&&(Z[4]=V,Z[5]=re,ae.n=J,L=0))}if(D||V>1)return a;throw B=!0,re}return function(V,re,D){if(q>1)throw TypeError("Generator is already running");for(B&&re===1&&Q(re,D),L=re,k=D;(r=L<2?f:k)||!B;){P||(L?L<3?(L>1&&(ae.n=-1),Q(L,k)):ae.n=k:ae.v=k);try{if(q=2,P){if(L||(V="next"),r=P[V]){if(!(r=r.call(P,k)))throw TypeError("iterator result is not an object");if(!r.done)return r;k=r.value,L<2&&(L=0)}else L===1&&(r=P.return)&&r.call(P),L<2&&(k=TypeError("The iterator does not provide a '"+V+"' method"),L=1);P=f}else if((r=(B=ae.n<0)?k:E.call(T,ae))!==a)break}catch(Z){P=f,L=1,k=Z}finally{q=1}}return{value:r,done:B}}})(S,_,I),!0),A}var a={};function d(){}function p(){}function m(){}r=Object.getPrototypeOf;var c=[][n]?r(r([][n]())):(o(r={},n,function(){return this}),r),y=m.prototype=d.prototype=Object.create(c);function b(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,m):(S.__proto__=m,o(S,e,"GeneratorFunction")),S.prototype=Object.create(y),S}return p.prototype=m,o(y,"constructor",m),o(m,"constructor",p),p.displayName="GeneratorFunction",o(m,e,"GeneratorFunction"),o(y),o(y,e,"Generator"),o(y,n,function(){return this}),o(y,"toString",function(){return"[object Generator]"}),(u.exports=s=function(){return{w:i,m:b}},u.exports.__esModule=!0,u.exports.default=u.exports)()}u.exports=s,u.exports.__esModule=!0,u.exports.default=u.exports}),ta=de((g,u)=>{le(),ce(),ue();var o=Xs(),s=Zs();function f(r,t){function n(i,a,d,p){try{var m=r[i](a),c=m.value;return c instanceof o?t.resolve(c.v).then(function(y){n("next",y,d,p)},function(y){n("throw",y,d,p)}):t.resolve(c).then(function(y){m.value=y,d(m)},function(y){return n("throw",y,d,p)})}catch(y){p(y)}}var e;this.next||(s(f.prototype),s(f.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),s(this,"_invoke",function(i,a,d){function p(){return new t(function(m,c){n(i,d,m,c)})}return e=e?e.then(p,p):p()},!0)}u.exports=f,u.exports.__esModule=!0,u.exports.default=u.exports}),ra=de((g,u)=>{le(),ce(),ue();var o=ea(),s=ta();function f(r,t,n,e,i){return new s(o().w(r,t,n,e),i||Promise)}u.exports=f,u.exports.__esModule=!0,u.exports.default=u.exports}),Hl=de((g,u)=>{le(),ce(),ue();var o=ra();function s(f,r,t,n,e){var i=o(f,r,t,n,e);return i.next().then(function(a){return a.done?a.value:i.next()})}u.exports=s,u.exports.__esModule=!0,u.exports.default=u.exports}),zl=de((g,u)=>{le(),ce(),ue();function o(s){var f=Object(s),r=[];for(var t in f)r.unshift(t);return function n(){for(;r.length;)if((t=r.pop())in f)return n.value=t,n.done=!1,n;return n.done=!0,n}}u.exports=o,u.exports.__esModule=!0,u.exports.default=u.exports}),Vl=de((g,u)=>{le(),ce(),ue();var o=Rr().default;function s(f){if(f!=null){var r=f[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],t=0;if(r)return r.call(f);if(typeof f.next=="function")return f;if(!isNaN(f.length))return{next:function(){return f&&t>=f.length&&(f=void 0),{value:f&&f[t++],done:!f}}}}throw new TypeError(o(f)+" is not iterable")}u.exports=s,u.exports.__esModule=!0,u.exports.default=u.exports}),Kl=de((g,u)=>{le(),ce(),ue();var o=Xs(),s=ea(),f=Hl(),r=ra(),t=ta(),n=zl(),e=Vl();function i(){var a=s(),d=a.m(i),p=(Object.getPrototypeOf?Object.getPrototypeOf(d):d.__proto__).constructor;function m(b){var S=typeof b=="function"&&b.constructor;return!!S&&(S===p||(S.displayName||S.name)==="GeneratorFunction")}var c={throw:1,return:2,break:3,continue:3};function y(b){var S,h;return function(_){S||(S={stop:function(){return h(_.a,2)},catch:function(){return _.v},abrupt:function(I,v){return h(_.a,c[I],v)},delegateYield:function(I,v,A){return S.resultName=v,h(_.d,e(I),A)},finish:function(I){return h(_.f,I)}},h=function(I,v,A){_.p=S.prev,_.n=S.next;try{return I(v,A)}finally{S.next=_.n}}),S.resultName&&(S[S.resultName]=_.v,S.resultName=void 0),S.sent=_.v,S.next=_.n;try{return b.call(this,S)}finally{_.p=S.prev,_.n=S.next}}}return(u.exports=i=function(){return{wrap:function(b,S,h,_){return a.w(y(b),S,h,_&&_.reverse())},isGeneratorFunction:m,mark:a.m,awrap:function(b,S){return new o(b,S)},AsyncIterator:t,async:function(b,S,h,_,I){return(m(S)?r:f)(y(b),S,h,_,I)},keys:n,values:e}},u.exports.__esModule=!0,u.exports.default=u.exports)()}u.exports=i,u.exports.__esModule=!0,u.exports.default=u.exports}),Gl=de((g,u)=>{le(),ce(),ue();var o=Kl()();u.exports=o;try{regeneratorRuntime=o}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}),Ql=de((g,u)=>{le(),ce(),ue(),(function(o,s){typeof g=="object"&&typeof u<"u"?s(g,Bl(),ql(),Js(),$l(),Gl()):typeof define=="function"&&define.amd?define(["exports","@babel/runtime/helpers/defineProperty","@babel/runtime/helpers/slicedToArray","fast-unique-numbers","@babel/runtime/helpers/asyncToGenerator","@babel/runtime/regenerator"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.brokerFactory={},o._defineProperty,o._slicedToArray,o.fastUniqueNumbers,o._asyncToGenerator,o._regeneratorRuntime))})(g,function(o,s,f,r,t,n){var e=function(h){return typeof h.start=="function"},i=new WeakMap;function a(h,_){var I=Object.keys(h);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(h);_&&(v=v.filter(function(A){return Object.getOwnPropertyDescriptor(h,A).enumerable})),I.push.apply(I,v)}return I}function d(h){for(var _=1;_<arguments.length;_++){var I=arguments[_]!=null?arguments[_]:{};_%2?a(Object(I),!0).forEach(function(v){s(h,v,I[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(I)):a(Object(I)).forEach(function(v){Object.defineProperty(h,v,Object.getOwnPropertyDescriptor(I,v))})}return h}var p=function(h){return d(d({},h),{},{connect:function(_){var I=_.call;return t(n.mark(function v(){var A,E,T,C;return n.wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return A=new MessageChannel,E=A.port1,T=A.port2,P.next=1,I("connect",{port:E},[E]);case 1:return C=P.sent,i.set(T,C),P.abrupt("return",T);case 2:case"end":return P.stop()}},v)}))},disconnect:function(_){var I=_.call;return(function(){var v=t(n.mark(function A(E){var T;return n.wrap(function(C){for(;;)switch(C.prev=C.next){case 0:if(T=i.get(E),T!==void 0){C.next=1;break}throw new Error("The given port is not connected.");case 1:return C.next=2,I("disconnect",{portId:T});case 2:case"end":return C.stop()}},A)}));return function(A){return v.apply(this,arguments)}})()},isSupported:function(_){var I=_.call;return function(){return I("isSupported")}}})};function m(h,_){var I=Object.keys(h);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(h);_&&(v=v.filter(function(A){return Object.getOwnPropertyDescriptor(h,A).enumerable})),I.push.apply(I,v)}return I}function c(h){for(var _=1;_<arguments.length;_++){var I=arguments[_]!=null?arguments[_]:{};_%2?m(Object(I),!0).forEach(function(v){s(h,v,I[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(I)):m(Object(I)).forEach(function(v){Object.defineProperty(h,v,Object.getOwnPropertyDescriptor(I,v))})}return h}var y=new WeakMap,b=function(h){if(y.has(h))return y.get(h);var _=new Map;return y.set(h,_),_},S=function(h){var _=p(h);return function(I){var v=b(I);I.addEventListener("message",function(F){var B=F.data,ae=B.id;if(ae!==null&&v.has(ae)){var Q=v.get(ae),V=Q.reject,re=Q.resolve;v.delete(ae),B.error===void 0?re(B.result):V(new Error(B.error.message))}}),e(I)&&I.start();for(var A=function(F){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return new Promise(function(Q,V){var re=r.generateUniqueNumber(v);v.set(re,{reject:V,resolve:Q}),B===null?I.postMessage({id:re,method:F},ae):I.postMessage({id:re,method:F,params:B},ae)})},E=function(F,B){var ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];I.postMessage({id:null,method:F,params:B},ae)},T={},C=0,P=Object.entries(_);C<P.length;C++){var L=f(P[C],2),k=L[0],q=L[1];T=c(c({},T),{},s({},k,q({call:A,notify:E})))}return c({},T)}};o.createBroker=S})}),Yl=de((g,u)=>{le(),ce(),ue(),(function(o,s){typeof g=="object"&&typeof u<"u"?s(g,Rr(),Ql(),Js()):typeof define=="function"&&define.amd?define(["exports","@babel/runtime/helpers/typeof","broker-factory","fast-unique-numbers"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.workerTimersBroker={},o._typeof,o.brokerFactory,o.fastUniqueNumbers))})(g,function(o,s,f,r){var t=new Map([[0,null]]),n=new Map([[0,null]]),e=f.createBroker({clearInterval:function(a){var d=a.call;return function(p){s(t.get(p))==="symbol"&&(t.set(p,null),d("clear",{timerId:p,timerType:"interval"}).then(function(){t.delete(p)}))}},clearTimeout:function(a){var d=a.call;return function(p){s(n.get(p))==="symbol"&&(n.set(p,null),d("clear",{timerId:p,timerType:"timeout"}).then(function(){n.delete(p)}))}},setInterval:function(a){var d=a.call;return function(p){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,c=arguments.length,y=new Array(c>2?c-2:0),b=2;b<c;b++)y[b-2]=arguments[b];var S=Symbol(),h=r.generateUniqueNumber(t);t.set(h,S);var _=function(){return d("set",{delay:m,now:performance.timeOrigin+performance.now(),timerId:h,timerType:"interval"}).then(function(){var I=t.get(h);if(I===void 0)throw new Error("The timer is in an undefined state.");I===S&&(p.apply(void 0,y),t.get(h)===S&&_())})};return _(),h}},setTimeout:function(a){var d=a.call;return function(p){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,c=arguments.length,y=new Array(c>2?c-2:0),b=2;b<c;b++)y[b-2]=arguments[b];var S=Symbol(),h=r.generateUniqueNumber(n);return n.set(h,S),d("set",{delay:m,now:performance.timeOrigin+performance.now(),timerId:h,timerType:"timeout"}).then(function(){var _=n.get(h);if(_===void 0)throw new Error("The timer is in an undefined state.");_===S&&(n.delete(h),p.apply(void 0,y))}),h}}}),i=function(a){var d=new Worker(a);return e(d)};o.load=i,o.wrap=e})}),Jl=de((g,u)=>{le(),ce(),ue(),(function(o,s){typeof g=="object"&&typeof u<"u"?s(g,Yl()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.workerTimers={},o.workerTimersBroker))})(g,function(o,s){var f=function(d,p){var m=null;return function(){if(m!==null)return m;var c=new Blob([p],{type:"application/javascript; charset=utf-8"}),y=URL.createObjectURL(c);return m=d(y),setTimeout(function(){return URL.revokeObjectURL(y)}),m}},r=`(()=>{var e={45:(e,t,r)=>{var n=r(738).default;e.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},79:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports},122:(e,t,r)=>{var n=r(79);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},156:e=>{e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u,a,i=[],s=!0,c=!1;try{if(u=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=u.call(r)).done)&&(i.push(n.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return i}},e.exports.__esModule=!0,e.exports.default=e.exports},172:e=>{e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},293:e=>{function t(e,t,r,n,o,u,a){try{var i=e[u](a),s=i.value}catch(e){return void r(e)}i.done?t(s):Promise.resolve(s).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,u){var a=e.apply(r,n);function i(e){t(a,o,u,i,s,"next",e)}function s(e){t(a,o,u,i,s,"throw",e)}i(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},373:e=>{e.exports=function(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},389:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,u=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<u?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*u);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,s=r(i),c=a(s,i),f=t(c);e.addUniqueNumber=f,e.generateUniqueNumber=c}(t)},472:function(e,t,r){!function(e,t,r,n){"use strict";var o=function(e,t){return function(r){var o=t.get(r);if(void 0===o)return Promise.resolve(!1);var u=n(o,2),a=u[0],i=u[1];return e(a),t.delete(r),i(!1),Promise.resolve(!0)}},u=function(e,t){var r=function(n,o,u,a){var i=n-e.now();i>0?o.set(a,[t(r,i,n,o,u,a),u]):(o.delete(a),u(!0))};return r},a=function(e,t,r,n){return function(o,u,a){var i=o+u-t.timeOrigin,s=i-t.now();return new Promise((function(t){e.set(a,[r(n,s,i,e,t,a),t])}))}},i=new Map,s=o(globalThis.clearTimeout,i),c=new Map,f=o(globalThis.clearTimeout,c),l=u(performance,globalThis.setTimeout),p=a(i,performance,globalThis.setTimeout,l),d=a(c,performance,globalThis.setTimeout,l);r.createWorker(self,{clear:function(){var r=e(t.mark((function e(r){var n,o,u;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.timerId,o=r.timerType,e.next=1,"interval"===o?s(n):f(n);case 1:return u=e.sent,e.abrupt("return",{result:u});case 2:case"end":return e.stop()}}),e)})));function n(e){return r.apply(this,arguments)}return n}(),set:function(){var r=e(t.mark((function e(r){var n,o,u,a,i;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.delay,o=r.now,u=r.timerId,a=r.timerType,e.next=1,("interval"===a?p:d)(n,o,u);case 1:return i=e.sent,e.abrupt("return",{result:i});case 2:case"end":return e.stop()}}),e)})));function n(e){return r.apply(this,arguments)}return n}()})}(r(293),r(756),r(623),r(715))},546:e=>{function t(r,n,o,u){var a=Object.defineProperty;try{a({},"",{})}catch(r){a=0}e.exports=t=function(e,r,n,o){if(r)a?a(e,r,{value:n,enumerable:!o,configurable:!o,writable:!o}):e[r]=n;else{var u=function(r,n){t(e,r,(function(e){return this._invoke(r,n,e)}))};u("next",0),u("throw",1),u("return",2)}},e.exports.__esModule=!0,e.exports.default=e.exports,t(r,n,o,u)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},579:(e,t,r)=>{var n=r(738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(n(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},623:function(e,t,r){!function(e,t,r,n,o){"use strict";var u={INTERNAL_ERROR:-32603,INVALID_PARAMS:-32602,METHOD_NOT_FOUND:-32601},a=function(e,t){return Object.assign(new Error(e),{status:t})},i=function(e){return a('The requested method called "'.concat(e,'" is not supported.'),u.METHOD_NOT_FOUND)},s=function(e){return a('The handler of the method called "'.concat(e,'" returned no required result.'),u.INTERNAL_ERROR)},c=function(e){return a('The handler of the method called "'.concat(e,'" returned an unexpected result.'),u.INTERNAL_ERROR)},f=function(e){return a('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),u.INVALID_PARAMS)},l=function(e,n){return function(){var o=t(r.mark((function t(o){var u,a,f,l,p,d,v,x,y,b,h,m,_,g,w;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(u=o.data,a=u.id,f=u.method,l=u.params,p=n[f],t.prev=1,void 0!==p){t.next=2;break}throw i(f);case 2:if(void 0!==(d=void 0===l?p():p(l))){t.next=3;break}throw s(f);case 3:if(!(d instanceof Promise)){t.next=5;break}return t.next=4,d;case 4:g=t.sent,t.next=6;break;case 5:g=d;case 6:if(v=g,null!==a){t.next=8;break}if(void 0===v.result){t.next=7;break}throw c(f);case 7:t.next=10;break;case 8:if(void 0!==v.result){t.next=9;break}throw c(f);case 9:x=v.result,y=v.transferables,b=void 0===y?[]:y,e.postMessage({id:a,result:x},b);case 10:t.next=12;break;case 11:t.prev=11,w=t.catch(1),h=w.message,m=w.status,_=void 0===m?-32603:m,e.postMessage({error:{code:_,message:h},id:a});case 12:case"end":return t.stop()}}),t,null,[[1,11]])})));return function(e){return o.apply(this,arguments)}}()},p=function(){return new Promise((function(e){var t=new ArrayBuffer(0),r=new MessageChannel,n=r.port1,o=r.port2;n.onmessage=function(t){var r=t.data;return e(null!==r)},o.postMessage(t,[t])}))};function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var x=new Map,y=function(e,n,u){return v(v({},n),{},{connect:function(t){var r=t.port;r.start();var u=e(r,n),a=o.generateUniqueNumber(x);return x.set(a,(function(){u(),r.close(),x.delete(a)})),{result:a}},disconnect:function(e){var t=e.portId,r=x.get(t);if(void 0===r)throw f(t);return r(),{result:null}},isSupported:function(){var e=t(r.mark((function e(){var t,n,o;return r.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,p();case 1:if(!e.sent){e.next=5;break}if(!((t=u())instanceof Promise)){e.next=3;break}return e.next=2,t;case 2:o=e.sent,e.next=4;break;case 3:o=t;case 4:return n=o,e.abrupt("return",{result:n});case 5:return e.abrupt("return",{result:!1});case 6:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()})},b=function(e,t){var r=y(b,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0}),n=l(e,r);return e.addEventListener("message",n),function(){return e.removeEventListener("message",n)}};e.createWorker=b,e.isSupported=p}(t,r(293),r(756),r(693),r(389))},633:(e,t,r)=>{var n=r(172),o=r(993),u=r(869),a=r(887),i=r(791),s=r(373),c=r(579);function f(){"use strict";var t=o(),r=t.m(f),l=(Object.getPrototypeOf?Object.getPrototypeOf(r):r.__proto__).constructor;function p(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))}var d={throw:1,return:2,break:3,continue:3};function v(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,d[e],t)},delegateYield:function(e,o,u){return t.resultName=o,r(n.d,c(e),u)},finish:function(e){return r(n.f,e)}},r=function(e,r,o){n.p=t.prev,n.n=t.next;try{return e(r,o)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(e.exports=f=function(){return{wrap:function(e,r,n,o){return t.w(v(e),r,n,o&&o.reverse())},isGeneratorFunction:p,mark:t.m,awrap:function(e,t){return new n(e,t)},AsyncIterator:i,async:function(e,t,r,n,o){return(p(t)?a:u)(v(e),t,r,n,o)},keys:s,values:c}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=f,e.exports.__esModule=!0,e.exports.default=e.exports},693:(e,t,r)=>{var n=r(736);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},715:(e,t,r)=>{var n=r(987),o=r(156),u=r(122),a=r(752);e.exports=function(e,t){return n(e)||o(e,t)||u(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},736:(e,t,r)=>{var n=r(738).default,o=r(45);e.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},738:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},752:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},756:(e,t,r)=>{var n=r(633)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},791:(e,t,r)=>{var n=r(172),o=r(546);e.exports=function e(t,r){function u(e,o,a,i){try{var s=t[e](o),c=s.value;return c instanceof n?r.resolve(c.v).then((function(e){u("next",e,a,i)}),(function(e){u("throw",e,a,i)})):r.resolve(c).then((function(e){s.value=e,a(s)}),(function(e){return u("throw",e,a,i)}))}catch(e){i(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),o(this,"_invoke",(function(e,t,n){function o(){return new r((function(t,r){u(e,n,t,r)}))}return a=a?a.then(o,o):o()}),!0)},e.exports.__esModule=!0,e.exports.default=e.exports},869:(e,t,r)=>{var n=r(887);e.exports=function(e,t,r,o,u){var a=n(e,t,r,o,u);return a.next().then((function(e){return e.done?e.value:a.next()}))},e.exports.__esModule=!0,e.exports.default=e.exports},887:(e,t,r)=>{var n=r(993),o=r(791);e.exports=function(e,t,r,u,a){return new o(n().w(e,t,r,u),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},987:e=>{e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},993:(e,t,r)=>{var n=r(546);function o(){var t,r,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",i=u.toStringTag||"@@toStringTag";function s(e,o,u,a){var i=o&&o.prototype instanceof f?o:f,s=Object.create(i.prototype);return n(s,"_invoke",function(e,n,o){var u,a,i,s=0,f=o||[],l=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return u=e,a=0,i=t,p.n=r,c}};function d(e,n){for(a=e,i=n,r=0;!l&&s&&!o&&r<f.length;r++){var o,u=f[r],d=p.p,v=u[2];e>3?(o=v===n)&&(i=u[(a=u[4])?5:(a=3,3)],u[4]=u[5]=t):u[0]<=d&&((o=e<2&&d<u[1])?(a=0,p.v=n,p.n=u[1]):d<v&&(o=e<3||u[0]>n||n>v)&&(u[4]=e,u[5]=n,p.n=v,a=0))}if(o||e>1)return c;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&d(f,v),a=f,i=v;(r=a<2?t:i)||!l;){u||(a?a<3?(a>1&&(p.n=-1),d(a,i)):p.n=i:p.v=i);try{if(s=2,u){if(a||(o="next"),r=u[o]){if(!(r=r.call(u,i)))throw TypeError("iterator result is not an object");if(!r.done)return r;i=r.value,a<2&&(a=0)}else 1===a&&(r=u.return)&&r.call(u),a<2&&(i=TypeError("The iterator does not provide a '"+o+"' method"),a=1);u=t}else if((r=(l=p.n<0)?i:e.call(n,p))!==c)break}catch(e){u=t,a=1,i=e}finally{s=1}}return{value:r,done:l}}}(e,u,a),!0),s}var c={};function f(){}function l(){}function p(){}r=Object.getPrototypeOf;var d=[][a]?r(r([][a]())):(n(r={},a,(function(){return this})),r),v=p.prototype=f.prototype=Object.create(d);function x(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,n(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e}return l.prototype=p,n(v,"constructor",p),n(p,"constructor",l),l.displayName="GeneratorFunction",n(p,i,"GeneratorFunction"),n(v),n(v,i,"Generator"),n(v,a,(function(){return this})),n(v,"toString",(function(){return"[object Generator]"})),(e.exports=o=function(){return{w:s,m:x}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var u=t[n]={exports:{}};return e[n].call(u.exports,u,u.exports,r),u.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 n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(472)})()})();`,t=f(s.load,r),n=function(d){return t().clearInterval(d)},e=function(d){return t().clearTimeout(d)},i=function(){var d;return(d=t()).setInterval.apply(d,arguments)},a=function(){var d;return(d=t()).setTimeout.apply(d,arguments)};o.clearInterval=n,o.clearTimeout=e,o.setInterval=i,o.setTimeout=a})}),Cr=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0}),g.isReactNativeBrowser=g.isWebWorker=void 0;var u=()=>typeof window<"u"?typeof navigator<"u"&&navigator.userAgent?.toLowerCase().indexOf(" electron/")>-1&&Re?.versions?!Object.prototype.hasOwnProperty.call(Re.versions,"electron"):typeof window.document<"u":!1,o=()=>!!(typeof self=="object"&&self?.constructor?.name?.includes("WorkerGlobalScope")&&typeof Deno>"u"),s=()=>typeof navigator<"u"&&navigator.product==="ReactNative",f=u()||o()||s();g.isWebWorker=o(),g.isReactNativeBrowser=s(),g.default=f}),Xl=de(g=>{le(),ce(),ue();var u=g&&g.__createBinding||(Object.create?function(i,a,d,p){p===void 0&&(p=d);var m=Object.getOwnPropertyDescriptor(a,d);(!m||("get"in m?!a.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return a[d]}}),Object.defineProperty(i,p,m)}:function(i,a,d,p){p===void 0&&(p=d),i[p]=a[d]}),o=g&&g.__setModuleDefault||(Object.create?function(i,a){Object.defineProperty(i,"default",{enumerable:!0,value:a})}:function(i,a){i.default=a}),s=g&&g.__importStar||(function(){var i=function(a){return i=Object.getOwnPropertyNames||function(d){var p=[];for(var m in d)Object.prototype.hasOwnProperty.call(d,m)&&(p[p.length]=m);return p},i(a)};return function(a){if(a&&a.__esModule)return a;var d={};if(a!=null)for(var p=i(a),m=0;m<p.length;m++)p[m]!=="default"&&u(d,a,p[m]);return o(d,a),d}})();Object.defineProperty(g,"__esModule",{value:!0});var f=Jl(),r=s(Cr()),t={set:f.setInterval,clear:f.clearInterval},n={set:(i,a)=>setInterval(i,a),clear:i=>clearInterval(i)},e=i=>{switch(i){case"native":return n;case"worker":return t;default:return r.default&&!r.isWebWorker&&!r.isReactNativeBrowser?t:n}};g.default=e}),na=de(g=>{le(),ce(),ue();var u=g&&g.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(g,"__esModule",{value:!0});var o=u(Xl()),s=class{_keepalive;timerId;timer;destroyed=!1;counter;client;_keepaliveTimeoutTimestamp;_intervalEvery;get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}constructor(f,r){this.client=f,this.timer=typeof r=="object"&&"set"in r&&"clear"in r?r:(0,o.default)(r),this.setKeepalive(f.options.keepalive)}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(f){if(f*=1e3,isNaN(f)||f<=0||f>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${f}`);this._keepalive=f,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${f}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let f=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+f,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set(()=>{this.destroyed||(this.counter+=1,this.counter===2?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())},this._intervalEvery)}};g.default=s}),Vn=de(g=>{le(),ce(),ue();var u=g&&g.__createBinding||(Object.create?function(v,A,E,T){T===void 0&&(T=E);var C=Object.getOwnPropertyDescriptor(A,E);(!C||("get"in C?!A.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return A[E]}}),Object.defineProperty(v,T,C)}:function(v,A,E,T){T===void 0&&(T=E),v[T]=A[E]}),o=g&&g.__setModuleDefault||(Object.create?function(v,A){Object.defineProperty(v,"default",{enumerable:!0,value:A})}:function(v,A){v.default=A}),s=g&&g.__importStar||(function(){var v=function(A){return v=Object.getOwnPropertyNames||function(E){var T=[];for(var C in E)Object.prototype.hasOwnProperty.call(E,C)&&(T[T.length]=C);return T},v(A)};return function(A){if(A&&A.__esModule)return A;var E={};if(A!=null)for(var T=v(A),C=0;C<T.length;C++)T[C]!=="default"&&u(E,A,T[C]);return o(E,A),E}})(),f=g&&g.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(g,"__esModule",{value:!0});var r=f(ll()),t=Tt(),n=f(cl()),e=f(at()),i=s(Cs()),a=f(Ms()),d=f(Rl()),p=f(Ys()),m=f(Cl()),c=Nt(),y=Ml(),b=f(na()),S=s(Cr()),h=globalThis.setImmediate||((...v)=>{let A=v.shift();(0,c.nextTick)(()=>{A(...v)})}),_={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,subscribeBatchSize:null,writeCache:!0,timerVariant:"auto"},I=class Kn extends y.TypedEventEmitter{static VERSION=c.MQTTJS_VERSION;connected;disconnecting;disconnected;reconnecting;incomingStore;outgoingStore;options;queueQoSZero;_reconnectCount;log;messageIdProvider;outgoing;messageIdToTopic;noop;keepaliveManager;stream;queue;streamBuilder;_resubscribeTopics;connackTimer;reconnectTimer;_storeProcessing;_packetIdsDuringStoreProcessing;_storeProcessingQueue;_firstConnection;topicAliasRecv;topicAliasSend;_deferredReconnect;connackPacket;static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(A,E){super(),this.options=E||{};for(let T in _)typeof this.options[T]>"u"?this.options[T]=_[T]:this.options[T]=E[T];this.log=this.options.log||(0,e.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",Kn.VERSION),S.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",S.default?"browser":"node"),this.log("MqttClient :: options.protocol",E.protocol),this.log("MqttClient :: options.protocolVersion",E.protocolVersion),this.log("MqttClient :: options.username",E.username),this.log("MqttClient :: options.keepalive",E.keepalive),this.log("MqttClient :: options.reconnectPeriod",E.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",E.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",E.properties?E.properties.topicAliasMaximum:void 0),this.options.clientId=typeof E.clientId=="string"?E.clientId:Kn.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=E.protocolVersion===5&&E.customHandleAcks?E.customHandleAcks:(...T)=>{T[3](null,0)},this.options.writeCache||(r.default.writeToStream.cacheNumbers=!1),this.streamBuilder=A,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new p.default:this.options.messageIdProvider,this.outgoingStore=E.outgoingStore||new a.default,this.incomingStore=E.incomingStore||new a.default,this.queueQoSZero=E.queueQoSZero===void 0?!0:E.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.keepaliveManager=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,E.properties&&E.properties.topicAliasMaximum>0&&(E.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new m.default(E.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:T}=this,C=()=>{let P=T.shift();this.log("deliver :: entry %o",P);let L=null;if(!P){this._resubscribe();return}L=P.packet,this.log("deliver :: call _sendPacket for %o",L);let k=!0;L.messageId&&L.messageId!==0&&(this.messageIdProvider.register(L.messageId)||(k=!1)),k?this._sendPacket(L,q=>{P.cb&&P.cb(q),C()}):(this.log("messageId: %d has already used. The message is skipped and removed.",L.messageId),C())};this.log("connect :: sending queued packets"),C()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this._destroyKeepaliveManager(),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}handleAuth(A,E){E()}handleMessage(A,E){E()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){let A=new t.Writable,E=r.default.parser(this.options),T=null,C=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new a.default,this.outgoingStore=this.options.outgoingStore||new a.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),E.on("packet",F=>{this.log("parser :: on packet push to packets array."),C.push(F)});let P=()=>{this.log("work :: getting next packet in queue");let F=C.shift();if(F)this.log("work :: packet pulled from queue"),(0,d.default)(this,F,L);else{this.log("work :: no packets in queue");let B=T;T=null,this.log("work :: done flag is %s",!!B),B&&B()}},L=()=>{if(C.length)(0,c.nextTick)(P);else{let F=T;T=null,F()}};A._write=(F,B,ae)=>{T=ae,this.log("writable stream :: parsing buffer"),E.parse(F),P()};let k=F=>{this.log("streamErrorHandler :: error",F.message),F.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",F)):this.noop(F)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(A),this.stream.on("error",k),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 q={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&&(q.will={...this.options.will,payload:this.options.will?.payload}),this.topicAliasRecv&&(q.properties||(q.properties={}),this.topicAliasRecv&&(q.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(q),E.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 F={cmd:"auth",reasonCode:0,...this.options.authPacket};this._writePacket(F)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this.emit("error",new Error("connack timeout")),this._cleanUp(!0)},this.options.connectTimeout),this}publish(A,E,T,C){this.log("publish :: message `%s` to topic `%s`",E,A);let{options:P}=this;typeof T=="function"&&(C=T,T=null),T=T||{},T={qos:0,retain:!1,dup:!1,...T};let{qos:L,retain:k,dup:q,properties:F,cbStorePut:B}=T;if(this._checkDisconnecting(C))return this;let ae=()=>{let Q=0;if((L===1||L===2)&&(Q=this._nextId(),Q===null))return this.log("No messageId left"),!1;let V={cmd:"publish",topic:A,payload:E,qos:L,retain:k,messageId:Q,dup:q};switch(P.protocolVersion===5&&(V.properties=F),this.log("publish :: qos",L),L){case 1:case 2:this.outgoing[V.messageId]={volatile:!1,cb:C||this.noop},this.log("MqttClient:publish: packet cmd: %s",V.cmd),this._sendPacket(V,void 0,B);break;default:this.log("MqttClient:publish: packet cmd: %s",V.cmd),this._sendPacket(V,C,B);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ae())&&this._storeProcessingQueue.push({invoke:ae,cbStorePut:T.cbStorePut,callback:C}),this}publishAsync(A,E,T){return new Promise((C,P)=>{this.publish(A,E,T,(L,k)=>{L?P(L):C(k)})})}subscribe(A,E,T){let C=this.options.protocolVersion;typeof E=="function"&&(T=E),T=T||this.noop;let P=!1,L=[];typeof A=="string"?(A=[A],L=A):Array.isArray(A)?L=A:typeof A=="object"&&(P=A.resubscribe,delete A.resubscribe,L=Object.keys(A));let k=i.validateTopics(L);if(k!==null)return h(T,new Error(`Invalid topic ${k}`)),this;if(this._checkDisconnecting(T))return this.log("subscribe: discconecting true"),this;let q={qos:0};C===5&&(q.nl=!1,q.rap=!1,q.rh=0),E={...q,...E};let{properties:F}=E,B=[],ae=(re,D)=>{if(D=D||E,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,re)||this._resubscribeTopics[re].qos<D.qos||P){let Z={topic:re,qos:D.qos};C===5&&(Z.nl=D.nl,Z.rap=D.rap,Z.rh=D.rh,Z.properties=F),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",Z.topic,Z.qos),B.push(Z)}};if(Array.isArray(A)?A.forEach(re=>{this.log("subscribe: array topic %s",re),ae(re)}):Object.keys(A).forEach(re=>{this.log("subscribe: object topic %s, %o",re,A[re]),ae(re,A[re])}),!B.length)return T(null,[]),this;let Q=(re,D)=>{let Z={cmd:"subscribe",subscriptions:re,messageId:D};if(F&&(Z.properties=F),this.options.resubscribe){this.log("subscribe :: resubscribe true");let J=[];re.forEach(be=>{if(this.options.reconnectPeriod>0){let te={qos:be.qos};C===5&&(te.nl=be.nl||!1,te.rap=be.rap||!1,te.rh=be.rh||0,te.properties=be.properties),this._resubscribeTopics[be.topic]=te,J.push(be.topic)}}),this.messageIdToTopic[Z.messageId]=J}let R=new Promise((J,be)=>{this.outgoing[Z.messageId]={volatile:!0,cb(te,we){if(!te){let{granted:K}=we;for(let N=0;N<K.length;N+=1)re[N].qos=K[N]}te?be(new c.ErrorWithSubackPacket(te.message,we)):J(we)}}});return this.log("subscribe :: call _sendPacket"),this._sendPacket(Z),R},V=()=>{let re=this.options.subscribeBatchSize??B.length,D=[];for(let Z=0;Z<B.length;Z+=re){let R=B.slice(Z,Z+re),J=this._nextId();if(J===null)return this.log("No messageId left"),!1;D.push(Q(R,J))}return Promise.all(D).then(Z=>{T(null,B,Z.at(-1))}).catch(Z=>{T(Z,B,Z.packet)}),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!V())&&this._storeProcessingQueue.push({invoke:V,callback:T}),this}subscribeAsync(A,E){return new Promise((T,C)=>{this.subscribe(A,E,(P,L)=>{P?C(P):T(L)})})}unsubscribe(A,E,T){typeof A=="string"&&(A=[A]),typeof E=="function"&&(T=E),T=T||this.noop;let C=i.validateTopics(A);if(C!==null)return h(T,new Error(`Invalid topic ${C}`)),this;if(this._checkDisconnecting(T))return this;let P=()=>{let L=this._nextId();if(L===null)return this.log("No messageId left"),!1;let k={cmd:"unsubscribe",messageId:L,unsubscriptions:[]};return typeof A=="string"?k.unsubscriptions=[A]:Array.isArray(A)&&(k.unsubscriptions=A),this.options.resubscribe&&k.unsubscriptions.forEach(q=>{delete this._resubscribeTopics[q]}),typeof E=="object"&&E.properties&&(k.properties=E.properties),this.outgoing[k.messageId]={volatile:!0,cb:T},this.log("unsubscribe: call _sendPacket"),this._sendPacket(k),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!P())&&this._storeProcessingQueue.push({invoke:P,callback:T}),this}unsubscribeAsync(A,E){return new Promise((T,C)=>{this.unsubscribe(A,E,(P,L)=>{P?C(P):T(L)})})}end(A,E,T){this.log("end :: (%s)",this.options.clientId),(A==null||typeof A!="boolean")&&(T=T||E,E=A,A=!1),typeof E!="object"&&(T=T||E,E=null),this.log("end :: cb? %s",!!T),(!T||typeof T!="function")&&(T=this.noop);let C=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(L=>{this.outgoingStore.close(k=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),T){let q=L||k;this.log("end :: closeStores: invoking callback with args"),T(q)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},P=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,A),this._cleanUp(A,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,c.nextTick)(C)},E)};return this.disconnecting?(T(),this):(this._clearReconnect(),this.disconnecting=!0,!A&&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,P,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),P()),this)}endAsync(A,E){return new Promise((T,C)=>{this.end(A,E,P=>{P?C(P):T()})})}removeOutgoingMessage(A){if(this.outgoing[A]){let{cb:E}=this.outgoing[A];this._removeOutgoingAndStoreMessage(A,()=>{E(new Error("Message removed"))})}return this}reconnect(A){this.log("client reconnect");let E=()=>{A?(this.options.incomingStore=A.incomingStore,this.options.outgoingStore=A.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new a.default,this.outgoingStore=this.options.outgoingStore||new a.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=E:E(),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(A=>{this.outgoing[A].volatile&&typeof this.outgoing[A].cb=="function"&&(this.outgoing[A].cb(new Error("Connection closed")),delete this.outgoing[A])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(A=>{typeof this.outgoing[A].cb=="function"&&(this.outgoing[A].cb(new Error("Connection closed")),delete this.outgoing[A])}))}_removeTopicAliasAndRecoverTopicName(A){let E;A.properties&&(E=A.properties.topicAlias);let T=A.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",E,T),T.length===0){if(typeof E>"u")return new Error("Unregistered Topic Alias");if(T=this.topicAliasSend.getTopicByAlias(E),typeof T>"u")return new Error("Unregistered Topic Alias");A.topic=T}E&&delete A.properties.topicAlias}_checkDisconnecting(A){return this.disconnecting&&(A&&A!==this.noop?A(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(A,E,T={}){if(E&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",E)),this.log("_cleanUp :: forced? %s",A),A)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let C={cmd:"disconnect",...T};this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(C,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),h(()=>{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._destroyKeepaliveManager(),E&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",E),E())}_storeAndSend(A,E,T){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",A.cmd);let C=A,P;if(C.cmd==="publish"&&(C=(0,n.default)(A),P=this._removeTopicAliasAndRecoverTopicName(C),P))return E&&E(P);this.outgoingStore.put(C,L=>{if(L)return E&&E(L);T(),this._writePacket(A,E)})}_applyTopicAlias(A){if(this.options.protocolVersion===5&&A.cmd==="publish"){let E;A.properties&&(E=A.properties.topicAlias);let T=A.topic.toString();if(this.topicAliasSend)if(E){if(T.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",T,E),!this.topicAliasSend.put(T,E)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",T,E),new Error("Sending Topic Alias out of range")}else T.length!==0&&(this.options.autoAssignTopicAlias?(E=this.topicAliasSend.getAliasByTopic(T),E?(A.topic="",A.properties={...A.properties,topicAlias:E},this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",T,E)):(E=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(T,E),A.properties={...A.properties,topicAlias:E},this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",T,E))):this.options.autoUseTopicAlias&&(E=this.topicAliasSend.getAliasByTopic(T),E&&(A.topic="",A.properties={...A.properties,topicAlias:E},this.log("applyTopicAlias :: auto use topic: %s - alias: %d",T,E))));else if(E)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",T,E),new Error("Sending Topic Alias out of range")}}_noop(A){this.log("noop ::",A)}_writePacket(A,E){this.log("_writePacket :: packet: %O",A),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",A),this.log("_writePacket :: writing to stream");let T=r.default.writeToStream(A,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",T),!T&&E&&E!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",E)):E&&(this.log("_writePacket :: invoking cb"),E())}_sendPacket(A,E,T,C){this.log("_sendPacket :: (%s) :: start",this.options.clientId),T=T||this.noop,E=E||this.noop;let P=this._applyTopicAlias(A);if(P){E(P);return}if(!this.connected){if(A.cmd==="auth"){this._writePacket(A,E);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(A,E,T);return}if(C){this._writePacket(A,E);return}switch(A.cmd){case"publish":break;case"pubrel":this._storeAndSend(A,E,T);return;default:this._writePacket(A,E);return}switch(A.qos){case 2:case 1:this._storeAndSend(A,E,T);break;default:this._writePacket(A,E);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(A,E,T){this.log("_storePacket :: packet: %o",A),this.log("_storePacket :: cb? %s",!!E),T=T||this.noop;let C=A;if(C.cmd==="publish"){C=(0,n.default)(A);let L=this._removeTopicAliasAndRecoverTopicName(C);if(L)return E&&E(L)}let P=C.qos||0;P===0&&this.queueQoSZero||C.cmd!=="publish"?this.queue.push({packet:C,cb:E}):P>0?(E=this.outgoing[C.messageId]?this.outgoing[C.messageId].cb:null,this.outgoingStore.put(C,L=>{if(L)return E&&E(L);T()})):E&&E(new Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new b.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(A=!1){this.keepaliveManager&&this.options.keepalive&&(A||this.options.reschedulePings)&&this._reschedulePing()}_reschedulePing(){this.log("_reschedulePing :: rescheduling ping"),this.keepaliveManager.reschedule()}sendPing(){this.log("_sendPing :: sending pingreq"),this._sendPacket({cmd:"pingreq"})}onKeepaliveTimeout(){this.emit("error",new Error("Keepalive timeout")),this.log("onKeepaliveTimeout :: calling _cleanUp with force true"),this._cleanUp(!0)}_resubscribe(){this.log("_resubscribe");let A=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&A.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let E=0;E<A.length;E++){let T={};T[A[E]]=this._resubscribeTopics[A[E]],T.resubscribe=!0,this.subscribe(T,{properties:T[A[E]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(A){if(this.disconnected){this.emit("connect",A);return}this.connackPacket=A,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;let E=()=>{let T=this.outgoingStore.createStream(),C=()=>{T.destroy(),T=null,this._flushStoreProcessingQueue(),P()},P=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",C),T.on("error",k=>{P(),this._flushStoreProcessingQueue(),this.removeListener("close",C),this.emit("error",k)});let L=()=>{if(!T)return;let k=T.read(1),q;if(!k){T.once("readable",L);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[k.messageId]){L();return}!this.disconnecting&&!this.reconnectTimer?(q=this.outgoing[k.messageId]?this.outgoing[k.messageId].cb:null,this.outgoing[k.messageId]={volatile:!1,cb(F,B){q&&q(F,B),L()}},this._packetIdsDuringStoreProcessing[k.messageId]=!0,this.messageIdProvider.register(k.messageId)?this._sendPacket(k,void 0,void 0,!0):this.log("messageId: %d has already used.",k.messageId)):T.destroy&&T.destroy()};T.on("end",()=>{let k=!0;for(let q in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[q]){k=!1;break}this.removeListener("close",C),k?(P(),this._invokeAllStoreProcessingQueue(),this.emit("connect",A)):E()}),L()};E()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let A=this._storeProcessingQueue[0];if(A&&A.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let A of this._storeProcessingQueue)A.cbStorePut&&A.cbStorePut(new Error("Connection closed")),A.callback&&A.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(A,E){delete this.outgoing[A],this.outgoingStore.del({messageId:A},(T,C)=>{E(T,C),this.messageIdProvider.deallocate(A),this._invokeStoreProcessingQueue()})}};g.default=I}),Zl=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=Qs(),o=class{numberAllocator;lastId;constructor(){this.numberAllocator=new u.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(s){return this.numberAllocator.use(s)}deallocate(s){this.numberAllocator.free(s)}clear(){this.numberAllocator.clear()}};g.default=o});function eu(){if(Gn)return rr;Gn=!0;let g=2147483647,u=36,o=1,s=26,f=38,r=700,t=72,n=128,e="-",i=/^xn--/,a=/[^\0-\x7F]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=u-o,c=Math.floor,y=String.fromCharCode;function b(P){throw new RangeError(p[P])}function S(P,L){let k=[],q=P.length;for(;q--;)k[q]=L(P[q]);return k}function h(P,L){let k=P.split("@"),q="";k.length>1&&(q=k[0]+"@",P=k[1]),P=P.replace(d,".");let F=P.split("."),B=S(F,L).join(".");return q+B}function _(P){let L=[],k=0,q=P.length;for(;k<q;){let F=P.charCodeAt(k++);if(F>=55296&&F<=56319&&k<q){let B=P.charCodeAt(k++);(B&64512)==56320?L.push(((F&1023)<<10)+(B&1023)+65536):(L.push(F),k--)}else L.push(F)}return L}let I=P=>String.fromCodePoint(...P),v=function(P){return P>=48&&P<58?26+(P-48):P>=65&&P<91?P-65:P>=97&&P<123?P-97:u},A=function(P,L){return P+22+75*(P<26)-((L!=0)<<5)},E=function(P,L,k){let q=0;for(P=k?c(P/r):P>>1,P+=c(P/L);P>m*s>>1;q+=u)P=c(P/m);return c(q+(m+1)*P/(P+f))},T=function(P){let L=[],k=P.length,q=0,F=n,B=t,ae=P.lastIndexOf(e);ae<0&&(ae=0);for(let Q=0;Q<ae;++Q)P.charCodeAt(Q)>=128&&b("not-basic"),L.push(P.charCodeAt(Q));for(let Q=ae>0?ae+1:0;Q<k;){let V=q;for(let D=1,Z=u;;Z+=u){Q>=k&&b("invalid-input");let R=v(P.charCodeAt(Q++));R>=u&&b("invalid-input"),R>c((g-q)/D)&&b("overflow"),q+=R*D;let J=Z<=B?o:Z>=B+s?s:Z-B;if(R<J)break;let be=u-J;D>c(g/be)&&b("overflow"),D*=be}let re=L.length+1;B=E(q-V,re,V==0),c(q/re)>g-F&&b("overflow"),F+=c(q/re),q%=re,L.splice(q++,0,F)}return String.fromCodePoint(...L)},C=function(P){let L=[];P=_(P);let k=P.length,q=n,F=0,B=t;for(let V of P)V<128&&L.push(y(V));let ae=L.length,Q=ae;for(ae&&L.push(e);Q<k;){let V=g;for(let D of P)D>=q&&D<V&&(V=D);let re=Q+1;V-q>c((g-F)/re)&&b("overflow"),F+=(V-q)*re,q=V;for(let D of P)if(D<q&&++F>g&&b("overflow"),D===q){let Z=F;for(let R=u;;R+=u){let J=R<=B?o:R>=B+s?s:R-B;if(Z<J)break;let be=Z-J,te=u-J;L.push(y(A(J+be%te,0))),Z=c(be/te)}L.push(y(A(Z,0))),B=E(F,re,Q===ae),F=0,++Q}++F,++q}return L.join("")};return rr={version:"2.3.1",ucs2:{decode:_,encode:I},decode:T,encode:C,toASCII:function(P){return h(P,function(L){return a.test(L)?"xn--"+C(L):L})},toUnicode:function(P){return h(P,function(L){return i.test(L)?T(L.slice(4).toLowerCase()):L})}},rr}var rr,Gn,gt,tu=He(()=>{le(),ce(),ue(),rr={},Gn=!1,gt=eu(),gt.decode,gt.encode,gt.toASCII,gt.toUnicode,gt.ucs2,gt.version});function ru(){return Yn||(Yn=!0,Qn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var g={},u=Symbol("test"),o=Object(u);if(typeof u=="string"||Object.prototype.toString.call(u)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var s=42;g[u]=s;for(u in g)return!1;if(typeof Object.keys=="function"&&Object.keys(g).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(g).length!==0)return!1;var f=Object.getOwnPropertySymbols(g);if(f.length!==1||f[0]!==u||!Object.prototype.propertyIsEnumerable.call(g,u))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var r=Object.getOwnPropertyDescriptor(g,u);if(r.value!==s||r.enumerable!==!0)return!1}return!0}),Qn}function nu(){return Xn||(Xn=!0,Jn=Error),Jn}function iu(){return ei||(ei=!0,Zn=EvalError),Zn}function ou(){return ri||(ri=!0,ti=RangeError),ti}function su(){return ii||(ii=!0,ni=ReferenceError),ni}function ia(){return si||(si=!0,oi=SyntaxError),oi}function Qt(){return li||(li=!0,ai=TypeError),ai}function au(){return ci||(ci=!0,ui=URIError),ui}function lu(){if(fi)return nr;fi=!0;var g=typeof Symbol<"u"&&Symbol,u=ru();return nr=function(){return typeof g!="function"||typeof Symbol!="function"||typeof g("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:u()},nr}function uu(){if(hi)return ir;hi=!0;var g={__proto__:null,foo:{}},u=Object;return ir=function(){return{__proto__:g}.foo===g.foo&&!(g instanceof u)},ir}function cu(){if(pi)return or;pi=!0;var g="Function.prototype.bind called on incompatible ",u=Object.prototype.toString,o=Math.max,s="[object Function]",f=function(n,e){for(var i=[],a=0;a<n.length;a+=1)i[a]=n[a];for(var d=0;d<e.length;d+=1)i[d+n.length]=e[d];return i},r=function(n,e){for(var i=[],a=e,d=0;a<n.length;a+=1,d+=1)i[d]=n[a];return i},t=function(n,e){for(var i="",a=0;a<n.length;a+=1)i+=n[a],a+1<n.length&&(i+=e);return i};return or=function(n){var e=this;if(typeof e!="function"||u.apply(e)!==s)throw new TypeError(g+e);for(var i=r(arguments,1),a,d=function(){if(this instanceof a){var b=e.apply(this,f(i,arguments));return Object(b)===b?b:this}return e.apply(n,f(i,arguments))},p=o(0,e.length-i.length),m=[],c=0;c<p;c++)m[c]="$"+c;if(a=Function("binder","return function ("+t(m,",")+"){ return binder.apply(this,arguments); }")(d),e.prototype){var y=function(){};y.prototype=e.prototype,a.prototype=new y,y.prototype=null}return a},or}function Wi(){if(di)return sr;di=!0;var g=cu();return sr=Function.prototype.bind||g,sr}function fu(){if(gi)return ar;gi=!0;var g=Function.prototype.call,u=Object.prototype.hasOwnProperty,o=Wi();return ar=o.call(g,u),ar}function Bt(){if(yi)return lr;yi=!0;var g,u=nu(),o=iu(),s=ou(),f=su(),r=ia(),t=Qt(),n=au(),e=Function,i=function(Q){try{return e('"use strict"; return ('+Q+").constructor;")()}catch{}},a=Object.getOwnPropertyDescriptor;if(a)try{a({},"")}catch{a=null}var d=function(){throw new t},p=a?(function(){try{return arguments.callee,d}catch{try{return a(arguments,"callee").get}catch{return d}}})():d,m=lu()(),c=uu()(),y=Object.getPrototypeOf||(c?function(Q){return Q.__proto__}:null),b={},S=typeof Uint8Array>"u"||!y?g:y(Uint8Array),h={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?g:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?g:ArrayBuffer,"%ArrayIteratorPrototype%":m&&y?y([][Symbol.iterator]()):g,"%AsyncFromSyncIteratorPrototype%":g,"%AsyncFunction%":b,"%AsyncGenerator%":b,"%AsyncGeneratorFunction%":b,"%AsyncIteratorPrototype%":b,"%Atomics%":typeof Atomics>"u"?g:Atomics,"%BigInt%":typeof BigInt>"u"?g:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?g:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?g:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?g:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":u,"%eval%":eval,"%EvalError%":o,"%Float32Array%":typeof Float32Array>"u"?g:Float32Array,"%Float64Array%":typeof Float64Array>"u"?g:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?g:FinalizationRegistry,"%Function%":e,"%GeneratorFunction%":b,"%Int8Array%":typeof Int8Array>"u"?g:Int8Array,"%Int16Array%":typeof Int16Array>"u"?g:Int16Array,"%Int32Array%":typeof Int32Array>"u"?g:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&y?y(y([][Symbol.iterator]())):g,"%JSON%":typeof JSON=="object"?JSON:g,"%Map%":typeof Map>"u"?g:Map,"%MapIteratorPrototype%":typeof Map>"u"||!m||!y?g:y(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?g:Promise,"%Proxy%":typeof Proxy>"u"?g:Proxy,"%RangeError%":s,"%ReferenceError%":f,"%Reflect%":typeof Reflect>"u"?g:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?g:Set,"%SetIteratorPrototype%":typeof Set>"u"||!m||!y?g:y(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?g:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&y?y(""[Symbol.iterator]()):g,"%Symbol%":m?Symbol:g,"%SyntaxError%":r,"%ThrowTypeError%":p,"%TypedArray%":S,"%TypeError%":t,"%Uint8Array%":typeof Uint8Array>"u"?g:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?g:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?g:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?g:Uint32Array,"%URIError%":n,"%WeakMap%":typeof WeakMap>"u"?g:WeakMap,"%WeakRef%":typeof WeakRef>"u"?g:WeakRef,"%WeakSet%":typeof WeakSet>"u"?g:WeakSet};if(y)try{null.error}catch(Q){var _=y(y(Q));h["%Error.prototype%"]=_}var I=function Q(V){var re;if(V==="%AsyncFunction%")re=i("async function () {}");else if(V==="%GeneratorFunction%")re=i("function* () {}");else if(V==="%AsyncGeneratorFunction%")re=i("async function* () {}");else if(V==="%AsyncGenerator%"){var D=Q("%AsyncGeneratorFunction%");D&&(re=D.prototype)}else if(V==="%AsyncIteratorPrototype%"){var Z=Q("%AsyncGenerator%");Z&&y&&(re=y(Z.prototype))}return h[V]=re,re},v={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},A=Wi(),E=fu(),T=A.call(Function.call,Array.prototype.concat),C=A.call(Function.apply,Array.prototype.splice),P=A.call(Function.call,String.prototype.replace),L=A.call(Function.call,String.prototype.slice),k=A.call(Function.call,RegExp.prototype.exec),q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,F=/\\(\\)?/g,B=function(Q){var V=L(Q,0,1),re=L(Q,-1);if(V==="%"&&re!=="%")throw new r("invalid intrinsic syntax, expected closing `%`");if(re==="%"&&V!=="%")throw new r("invalid intrinsic syntax, expected opening `%`");var D=[];return P(Q,q,function(Z,R,J,be){D[D.length]=J?P(be,F,"$1"):R||Z}),D},ae=function(Q,V){var re=Q,D;if(E(v,re)&&(D=v[re],re="%"+D[0]+"%"),E(h,re)){var Z=h[re];if(Z===b&&(Z=I(re)),typeof Z>"u"&&!V)throw new t("intrinsic "+Q+" exists, but is not available. Please file an issue!");return{alias:D,name:re,value:Z}}throw new r("intrinsic "+Q+" does not exist!")};return lr=function(Q,V){if(typeof Q!="string"||Q.length===0)throw new t("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof V!="boolean")throw new t('"allowMissing" argument must be a boolean');if(k(/^%?[^%]*%?$/,Q)===null)throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var re=B(Q),D=re.length>0?re[0]:"",Z=ae("%"+D+"%",V),R=Z.name,J=Z.value,be=!1,te=Z.alias;te&&(D=te[0],C(re,T([0,1],te)));for(var we=1,K=!0;we<re.length;we+=1){var N=re[we],ne=L(N,0,1),H=L(N,-1);if((ne==='"'||ne==="'"||ne==="`"||H==='"'||H==="'"||H==="`")&&ne!==H)throw new r("property names with quotes must have matching quotes");if((N==="constructor"||!K)&&(be=!0),D+="."+N,R="%"+D+"%",E(h,R))J=h[R];else if(J!=null){if(!(N in J)){if(!V)throw new t("base intrinsic for "+Q+" exists, but the property is not available.");return}if(a&&we+1>=re.length){var G=a(J,N);K=!!G,K&&"get"in G&&!("originalValue"in G.get)?J=G.get:J=J[N]}else K=E(J,N),J=J[N];K&&!be&&(h[R]=J)}}return J},lr}function qi(){if(bi)return ur;bi=!0;var g=Bt(),u=g("%Object.defineProperty%",!0)||!1;if(u)try{u({},"a",{value:1})}catch{u=!1}return ur=u,ur}function oa(){if(mi)return cr;mi=!0;var g=Bt(),u=g("%Object.getOwnPropertyDescriptor%",!0);if(u)try{u([],"length")}catch{u=null}return cr=u,cr}function hu(){if(vi)return fr;vi=!0;var g=qi(),u=ia(),o=Qt(),s=oa();return fr=function(f,r,t){if(!f||typeof f!="object"&&typeof f!="function")throw new o("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new o("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,e=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,d=!!s&&s(f,r);if(g)g(f,r,{configurable:i===null&&d?d.configurable:!i,enumerable:n===null&&d?d.enumerable:!n,value:t,writable:e===null&&d?d.writable:!e});else if(a||!n&&!e&&!i)f[r]=t;else throw new u("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},fr}function pu(){if(wi)return hr;wi=!0;var g=qi(),u=function(){return!!g};return u.hasArrayLengthDefineBug=function(){if(!g)return null;try{return g([],"length",{value:1}).length!==1}catch{return!0}},hr=u,hr}function du(){if(_i)return pr;_i=!0;var g=Bt(),u=hu(),o=pu()(),s=oa(),f=Qt(),r=g("%Math.floor%");return pr=function(t,n){if(typeof t!="function")throw new f("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||r(n)!==n)throw new f("`length` must be a positive 32-bit integer");var e=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in t&&s){var d=s(t,"length");d&&!d.configurable&&(i=!1),d&&!d.writable&&(a=!1)}return(i||a||!e)&&(o?u(t,"length",n,!0,!0):u(t,"length",n)),t},pr}function gu(){if(Si)return Ct;Si=!0;var g=Wi(),u=Bt(),o=du(),s=Qt(),f=u("%Function.prototype.apply%"),r=u("%Function.prototype.call%"),t=u("%Reflect.apply%",!0)||g.call(r,f),n=qi(),e=u("%Math.max%");Ct=function(a){if(typeof a!="function")throw new s("a function is required");var d=t(g,r,arguments);return o(d,1+e(0,a.length-(arguments.length-1)),!0)};var i=function(){return t(g,f,arguments)};return n?n(Ct,"apply",{value:i}):Ct.apply=i,Ct}function yu(){if(Ei)return dr;Ei=!0;var g=Bt(),u=gu(),o=u(g("String.prototype.indexOf"));return dr=function(s,f){var r=g(s,!!f);return typeof r=="function"&&o(s,".prototype.")>-1?u(r):r},dr}var Qn,Yn,Jn,Xn,Zn,ei,ti,ri,ni,ii,oi,si,ai,li,ui,ci,nr,fi,ir,hi,or,pi,sr,di,ar,gi,lr,yi,ur,bi,cr,mi,fr,vi,hr,wi,pr,_i,Ct,Si,dr,Ei,bu=He(()=>{le(),ce(),ue(),Qn={},Yn=!1,Jn={},Xn=!1,Zn={},ei=!1,ti={},ri=!1,ni={},ii=!1,oi={},si=!1,ai={},li=!1,ui={},ci=!1,nr={},fi=!1,ir={},hi=!1,or={},pi=!1,sr={},di=!1,ar={},gi=!1,lr={},yi=!1,ur={},bi=!1,cr={},mi=!1,fr={},vi=!1,hr={},wi=!1,pr={},_i=!1,Ct={},Si=!1,dr={},Ei=!1});function $i(g){throw new Error("Node.js process "+g+" is not supported by JSPM core outside of Node.js")}function mu(){!At||!St||(At=!1,St.length?et=St.concat(et):Vt=-1,et.length&&sa())}function sa(){if(!At){var g=setTimeout(mu,0);At=!0;for(var u=et.length;u;){for(St=et,et=[];++Vt<u;)St&&St[Vt].run();Vt=-1,u=et.length}St=null,At=!1,clearTimeout(g)}}function vu(g){var u=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)u[o-1]=arguments[o];et.push(new aa(g,u)),et.length===1&&!At&&setTimeout(sa,0)}function aa(g,u){this.fun=g,this.array=u}function Fe(){}function wu(g){$i("_linkedBinding")}function _u(g){$i("dlopen")}function Su(){return[]}function Eu(){return[]}function Au(g,u){if(!g)throw new Error(u||"assertion error")}function Iu(){return!1}function xu(){return ot.now()/1e3}function jr(g){var u=Math.floor((Date.now()-ot.now())*.001),o=ot.now()*.001,s=Math.floor(o)+u,f=Math.floor(o%1*1e9);return g&&(s=s-g[0],f=f-g[1],f<0&&(s--,f+=gr)),[s,f]}function pt(){return Hi}function Tu(g){return[]}var et,At,St,Vt,Gi,Qi,Yi,Ji,Xi,Zi,eo,to,ro,no,io,oo,so,ao,lo,uo,co,fo,ho,po,go,Xt,yo,bo,mo,vo,wo,_o,So,Eo,Ao,Io,xo,To,ko,Oo,Po,Ro,Co,Mo,jo,No,Bo,Uo,Lo,Fo,Do,ot,Nr,gr,Wo,qo,$o,Ho,zo,Vo,Ko,Go,Qo,Yo,Jo,Hi,la=He(()=>{le(),ce(),ue(),et=[],At=!1,Vt=-1,aa.prototype.run=function(){this.fun.apply(null,this.array)},Gi="browser",Qi="x64",Yi="browser",Ji={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Xi=["/usr/bin/node"],Zi=[],eo="v16.8.0",to={},ro=function(g,u){console.warn((u?u+": ":"")+g)},no=function(g){$i("binding")},io=function(g){return 0},oo=function(){return"/"},so=function(g){},ao={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},lo=Fe,uo=[],co={},fo=!1,ho={},po=Fe,go=Fe,Xt=function(){return{}},yo=Xt,bo=Xt,mo=Fe,vo=Fe,wo=Fe,_o={},So={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Eo=Fe,Ao=Fe,Io=Fe,xo=Fe,To=Fe,ko=Fe,Oo=Fe,Po=void 0,Ro=void 0,Co=void 0,Mo=Fe,jo=2,No=1,Bo="/bin/usr/node",Uo=9229,Lo="node",Fo=[],Do=Fe,ot={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},ot.now===void 0&&(Nr=Date.now(),ot.timing&&ot.timing.navigationStart&&(Nr=ot.timing.navigationStart),ot.now=()=>Date.now()-Nr),gr=1e9,jr.bigint=function(g){var u=jr(g);return typeof BigInt>"u"?u[0]*gr+u[1]:BigInt(u[0]*gr)+BigInt(u[1])},Wo=10,qo={},$o=0,Ho=pt,zo=pt,Vo=pt,Ko=pt,Go=pt,Qo=Fe,Yo=pt,Jo=pt,Hi={version:eo,versions:to,arch:Qi,platform:Yi,release:ao,_rawDebug:lo,moduleLoadList:uo,binding:no,_linkedBinding:wu,_events:qo,_eventsCount:$o,_maxListeners:Wo,on:pt,addListener:Ho,once:zo,off:Vo,removeListener:Ko,removeAllListeners:Go,emit:Qo,prependListener:Yo,prependOnceListener:Jo,listeners:Tu,domain:co,_exiting:fo,config:ho,dlopen:_u,uptime:xu,_getActiveRequests:Su,_getActiveHandles:Eu,reallyExit:po,_kill:go,cpuUsage:Xt,resourceUsage:yo,memoryUsage:bo,kill:mo,exit:vo,openStdin:wo,allowedNodeEnvironmentFlags:_o,assert:Au,features:So,_fatalExceptions:Eo,setUncaughtExceptionCaptureCallback:Ao,hasUncaughtExceptionCaptureCallback:Iu,emitWarning:ro,nextTick:vu,_tickCallback:Io,_debugProcess:xo,_debugEnd:To,_startProfilerIdleNotifier:ko,_stopProfilerIdleNotifier:Oo,stdout:Po,stdin:Co,stderr:Ro,abort:Mo,umask:io,chdir:so,cwd:oo,env:Ji,title:Gi,argv:Xi,execArgv:Zi,pid:jo,ppid:No,execPath:Bo,debugPort:Uo,hrtime:jr,argv0:Lo,_preload_modules:Fo,setSourceMapsEnabled:Do}});function ku(){if(Ai)return yr;Ai=!0;var g=Hi;function u(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}function o(r,t){for(var n="",e=0,i=-1,a=0,d,p=0;p<=r.length;++p){if(p<r.length)d=r.charCodeAt(p);else{if(d===47)break;d=47}if(d===47){if(!(i===p-1||a===1))if(i!==p-1&&a===2){if(n.length<2||e!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var m=n.lastIndexOf("/");if(m!==n.length-1){m===-1?(n="",e=0):(n=n.slice(0,m),e=n.length-1-n.lastIndexOf("/")),i=p,a=0;continue}}else if(n.length===2||n.length===1){n="",e=0,i=p,a=0;continue}}t&&(n.length>0?n+="/..":n="..",e=2)}else n.length>0?n+="/"+r.slice(i+1,p):n=r.slice(i+1,p),e=p-i-1;i=p,a=0}else d===46&&a!==-1?++a:a=-1}return n}function s(r,t){var n=t.dir||t.root,e=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+e:n+r+e:e}var f={resolve:function(){for(var r="",t=!1,n,e=arguments.length-1;e>=-1&&!t;e--){var i;e>=0?i=arguments[e]:(n===void 0&&(n=g.cwd()),i=n),u(i),i.length!==0&&(r=i+"/"+r,t=i.charCodeAt(0)===47)}return r=o(r,!t),t?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(r){if(u(r),r.length===0)return".";var t=r.charCodeAt(0)===47,n=r.charCodeAt(r.length-1)===47;return r=o(r,!t),r.length===0&&!t&&(r="."),r.length>0&&n&&(r+="/"),t?"/"+r:r},isAbsolute:function(r){return u(r),r.length>0&&r.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var r,t=0;t<arguments.length;++t){var n=arguments[t];u(n),n.length>0&&(r===void 0?r=n:r+="/"+n)}return r===void 0?".":f.normalize(r)},relative:function(r,t){if(u(r),u(t),r===t||(r=f.resolve(r),t=f.resolve(t),r===t))return"";for(var n=1;n<r.length&&r.charCodeAt(n)===47;++n);for(var e=r.length,i=e-n,a=1;a<t.length&&t.charCodeAt(a)===47;++a);for(var d=t.length,p=d-a,m=i<p?i:p,c=-1,y=0;y<=m;++y){if(y===m){if(p>m){if(t.charCodeAt(a+y)===47)return t.slice(a+y+1);if(y===0)return t.slice(a+y)}else i>m&&(r.charCodeAt(n+y)===47?c=y:y===0&&(c=0));break}var b=r.charCodeAt(n+y),S=t.charCodeAt(a+y);if(b!==S)break;b===47&&(c=y)}var h="";for(y=n+c+1;y<=e;++y)(y===e||r.charCodeAt(y)===47)&&(h.length===0?h+="..":h+="/..");return h.length>0?h+t.slice(a+c):(a+=c,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(r){return r},dirname:function(r){if(u(r),r.length===0)return".";for(var t=r.charCodeAt(0),n=t===47,e=-1,i=!0,a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!i){e=a;break}}else i=!1;return e===-1?n?"/":".":n&&e===1?"//":r.slice(0,e)},basename:function(r,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');u(r);var n=0,e=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";var d=t.length-1,p=-1;for(a=r.length-1;a>=0;--a){var m=r.charCodeAt(a);if(m===47){if(!i){n=a+1;break}}else p===-1&&(i=!1,p=a+1),d>=0&&(m===t.charCodeAt(d)?--d===-1&&(e=a):(d=-1,e=p))}return n===e?e=p:e===-1&&(e=r.length),r.slice(n,e)}else{for(a=r.length-1;a>=0;--a)if(r.charCodeAt(a)===47){if(!i){n=a+1;break}}else e===-1&&(i=!1,e=a+1);return e===-1?"":r.slice(n,e)}},extname:function(r){u(r);for(var t=-1,n=0,e=-1,i=!0,a=0,d=r.length-1;d>=0;--d){var p=r.charCodeAt(d);if(p===47){if(!i){n=d+1;break}continue}e===-1&&(i=!1,e=d+1),p===46?t===-1?t=d:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||e===-1||a===0||a===1&&t===e-1&&t===n+1?"":r.slice(t,e)},format:function(r){if(r===null||typeof r!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof r);return s("/",r)},parse:function(r){u(r);var t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;var n=r.charCodeAt(0),e=n===47,i;e?(t.root="/",i=1):i=0;for(var a=-1,d=0,p=-1,m=!0,c=r.length-1,y=0;c>=i;--c){if(n=r.charCodeAt(c),n===47){if(!m){d=c+1;break}continue}p===-1&&(m=!1,p=c+1),n===46?a===-1?a=c:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||p===-1||y===0||y===1&&a===p-1&&a===d+1?p!==-1&&(d===0&&e?t.base=t.name=r.slice(1,p):t.base=t.name=r.slice(d,p)):(d===0&&e?(t.name=r.slice(1,a),t.base=r.slice(1,p)):(t.name=r.slice(d,a),t.base=r.slice(d,p)),t.ext=r.slice(a,p)),d>0?t.dir=r.slice(0,d-1):e&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};return f.posix=f,yr=f,yr}var yr,Ai,Ii,Ou=He(()=>{le(),ce(),ue(),la(),yr={},Ai=!1,Ii=ku()}),ua={};Mt(ua,{URL:()=>va,Url:()=>da,default:()=>De,fileURLToPath:()=>fa,format:()=>ga,parse:()=>ma,pathToFileURL:()=>ha,resolve:()=>ya,resolveObject:()=>ba});function Pu(){if(xi)return br;xi=!0;var g=typeof Map=="function"&&Map.prototype,u=Object.getOwnPropertyDescriptor&&g?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=g&&u&&typeof u.get=="function"?u.get:null,s=g&&Map.prototype.forEach,f=typeof Set=="function"&&Set.prototype,r=Object.getOwnPropertyDescriptor&&f?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,t=f&&r&&typeof r.get=="function"?r.get:null,n=f&&Set.prototype.forEach,e=typeof WeakMap=="function"&&WeakMap.prototype,i=e?WeakMap.prototype.has:null,a=typeof WeakSet=="function"&&WeakSet.prototype,d=a?WeakSet.prototype.has:null,p=typeof WeakRef=="function"&&WeakRef.prototype,m=p?WeakRef.prototype.deref:null,c=Boolean.prototype.valueOf,y=Object.prototype.toString,b=Function.prototype.toString,S=String.prototype.match,h=String.prototype.slice,_=String.prototype.replace,I=String.prototype.toUpperCase,v=String.prototype.toLowerCase,A=RegExp.prototype.test,E=Array.prototype.concat,T=Array.prototype.join,C=Array.prototype.slice,P=Math.floor,L=typeof BigInt=="function"?BigInt.prototype.valueOf:null,k=Object.getOwnPropertySymbols,q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,F=typeof Symbol=="function"&&typeof Symbol.iterator=="object",B=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===F||!0)?Symbol.toStringTag:null,ae=Object.prototype.propertyIsEnumerable,Q=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(z){return z.__proto__}:null);function V(z,ie){if(z===1/0||z===-1/0||z!==z||z&&z>-1e3&&z<1e3||A.call(/e/,ie))return ie;var Ie=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof z=="number"){var xe=z<0?-P(-z):P(z);if(xe!==z){var Te=String(xe),Oe=h.call(ie,Te.length+1);return _.call(Te,Ie,"$&_")+"."+_.call(_.call(Oe,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(ie,Ie,"$&_")}var re=pa,D=re.custom,Z=G(D)?D:null;br=function z(ie,Ie,xe,Te){var Oe=Ie||{};if(oe(Oe,"quoteStyle")&&Oe.quoteStyle!=="single"&&Oe.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(oe(Oe,"maxStringLength")&&(typeof Oe.maxStringLength=="number"?Oe.maxStringLength<0&&Oe.maxStringLength!==1/0:Oe.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ke=oe(Oe,"customInspect")?Oe.customInspect:!0;if(typeof Ke!="boolean"&&Ke!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(oe(Oe,"indent")&&Oe.indent!==null&&Oe.indent!==" "&&!(parseInt(Oe.indent,10)===Oe.indent&&Oe.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(oe(Oe,"numericSeparator")&&typeof Oe.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Ge=Oe.numericSeparator;if(typeof ie>"u")return"undefined";if(ie===null)return"null";if(typeof ie=="boolean")return ie?"true":"false";if(typeof ie=="string")return se(ie,Oe);if(typeof ie=="number"){if(ie===0)return 1/0/ie>0?"0":"-0";var Ue=String(ie);return Ge?V(ie,Ue):Ue}if(typeof ie=="bigint"){var Qe=String(ie)+"n";return Ge?V(ie,Qe):Qe}var kt=typeof Oe.depth>"u"?5:Oe.depth;if(typeof xe>"u"&&(xe=0),xe>=kt&&kt>0&&typeof ie=="object")return be(ie)?"[Array]":"[Object]";var Ye=X(Oe,xe);if(typeof Te>"u")Te=[];else if(ee(Te,ie)>=0)return"[Circular]";function ze(Je,ht,wt){if(ht&&(Te=C.call(Te),Te.push(ht)),wt){var Xe={depth:Oe.depth};return oe(Oe,"quoteStyle")&&(Xe.quoteStyle=Oe.quoteStyle),z(Je,Xe,xe+1,Te)}return z(Je,Oe,xe+1,Te)}if(typeof ie=="function"&&!we(ie)){var Yt=W(ie),Ot=Se(ie,ze);return"[Function"+(Yt?": "+Yt:" (anonymous)")+"]"+(Ot.length>0?" { "+T.call(Ot,", ")+" }":"")}if(G(ie)){var Ut=F?_.call(String(ie),/^(Symbol\(.*\))_[^)]*$/,"$1"):q.call(ie);return typeof ie=="object"&&!F?l(Ut):Ut}if(ve(ie)){for(var O="<"+v.call(String(ie.nodeName)),j=ie.attributes||[],_e=0;_e<j.length;_e++)O+=" "+j[_e].name+"="+R(J(j[_e].value),"double",Oe);return O+=">",ie.childNodes&&ie.childNodes.length&&(O+="..."),O+="</"+v.call(String(ie.nodeName))+">",O}if(be(ie)){if(ie.length===0)return"[]";var Ee=Se(ie,ze);return Ye&&!U(Ee)?"["+fe(Ee,Ye)+"]":"[ "+T.call(Ee,", ")+" ]"}if(K(ie)){var Ae=Se(ie,ze);return!("cause"in Error.prototype)&&"cause"in ie&&!ae.call(ie,"cause")?"{ ["+String(ie)+"] "+T.call(E.call("[cause]: "+ze(ie.cause),Ae),", ")+" }":Ae.length===0?"["+String(ie)+"]":"{ ["+String(ie)+"] "+T.call(Ae,", ")+" }"}if(typeof ie=="object"&&Ke){if(Z&&typeof ie[Z]=="function"&&re)return re(ie,{depth:kt-xe});if(Ke!=="symbol"&&typeof ie.inspect=="function")return ie.inspect()}if(he(ie)){var je=[];return s&&s.call(ie,function(Je,ht){je.push(ze(ht,ie,!0)+" => "+ze(Je,ie))}),x("Map",o.call(ie),je,Ye)}if($(ie)){var We=[];return n&&n.call(ie,function(Je){We.push(ze(Je,ie))}),x("Set",t.call(ie),We,Ye)}if(pe(ie))return w("WeakMap");if(ge(ie))return w("WeakSet");if(me(ie))return w("WeakRef");if(ne(ie))return l(ze(Number(ie)));if(Y(ie))return l(ze(L.call(ie)));if(H(ie))return l(c.call(ie));if(N(ie))return l(ze(String(ie)));if(typeof window<"u"&&ie===window)return"{ [object Window] }";if(typeof globalThis<"u"&&ie===globalThis||typeof mr<"u"&&ie===mr)return"{ [object globalThis] }";if(!te(ie)&&!we(ie)){var Ve=Se(ie,ze),Lt=Q?Q(ie)===Object.prototype:ie instanceof Object||ie.constructor===Object,Ft=ie instanceof Object?"":"null prototype",Dt=!Lt&&B&&Object(ie)===ie&&B in ie?h.call(M(ie),8,-1):Ft?"Object":"",Jt=Lt||typeof ie.constructor!="function"?"":ie.constructor.name?ie.constructor.name+" ":"",vt=Jt+(Dt||Ft?"["+T.call(E.call([],Dt||[],Ft||[]),": ")+"] ":"");return Ve.length===0?vt+"{}":Ye?vt+"{"+fe(Ve,Ye)+"}":vt+"{ "+T.call(Ve,", ")+" }"}return String(ie)};function R(z,ie,Ie){var xe=(Ie.quoteStyle||ie)==="double"?'"':"'";return xe+z+xe}function J(z){return _.call(String(z),/"/g,"&quot;")}function be(z){return M(z)==="[object Array]"&&(!B||!(typeof z=="object"&&B in z))}function te(z){return M(z)==="[object Date]"&&(!B||!(typeof z=="object"&&B in z))}function we(z){return M(z)==="[object RegExp]"&&(!B||!(typeof z=="object"&&B in z))}function K(z){return M(z)==="[object Error]"&&(!B||!(typeof z=="object"&&B in z))}function N(z){return M(z)==="[object String]"&&(!B||!(typeof z=="object"&&B in z))}function ne(z){return M(z)==="[object Number]"&&(!B||!(typeof z=="object"&&B in z))}function H(z){return M(z)==="[object Boolean]"&&(!B||!(typeof z=="object"&&B in z))}function G(z){if(F)return z&&typeof z=="object"&&z instanceof Symbol;if(typeof z=="symbol")return!0;if(!z||typeof z!="object"||!q)return!1;try{return q.call(z),!0}catch{}return!1}function Y(z){if(!z||typeof z!="object"||!L)return!1;try{return L.call(z),!0}catch{}return!1}var ye=Object.prototype.hasOwnProperty||function(z){return z in(this||mr)};function oe(z,ie){return ye.call(z,ie)}function M(z){return y.call(z)}function W(z){if(z.name)return z.name;var ie=S.call(b.call(z),/^function\s*([\w$]+)/);return ie?ie[1]:null}function ee(z,ie){if(z.indexOf)return z.indexOf(ie);for(var Ie=0,xe=z.length;Ie<xe;Ie++)if(z[Ie]===ie)return Ie;return-1}function he(z){if(!o||!z||typeof z!="object")return!1;try{o.call(z);try{t.call(z)}catch{return!0}return z instanceof Map}catch{}return!1}function pe(z){if(!i||!z||typeof z!="object")return!1;try{i.call(z,i);try{d.call(z,d)}catch{return!0}return z instanceof WeakMap}catch{}return!1}function me(z){if(!m||!z||typeof z!="object")return!1;try{return m.call(z),!0}catch{}return!1}function $(z){if(!t||!z||typeof z!="object")return!1;try{t.call(z);try{o.call(z)}catch{return!0}return z instanceof Set}catch{}return!1}function ge(z){if(!d||!z||typeof z!="object")return!1;try{d.call(z,d);try{i.call(z,i)}catch{return!0}return z instanceof WeakSet}catch{}return!1}function ve(z){return!z||typeof z!="object"?!1:typeof HTMLElement<"u"&&z instanceof HTMLElement?!0:typeof z.nodeName=="string"&&typeof z.getAttribute=="function"}function se(z,ie){if(z.length>ie.maxStringLength){var Ie=z.length-ie.maxStringLength,xe="... "+Ie+" more character"+(Ie>1?"s":"");return se(h.call(z,0,ie.maxStringLength),ie)+xe}var Te=_.call(_.call(z,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ke);return R(Te,"single",ie)}function ke(z){var ie=z.charCodeAt(0),Ie={8:"b",9:"t",10:"n",12:"f",13:"r"}[ie];return Ie?"\\"+Ie:"\\x"+(ie<16?"0":"")+I.call(ie.toString(16))}function l(z){return"Object("+z+")"}function w(z){return z+" { ? }"}function x(z,ie,Ie,xe){var Te=xe?fe(Ie,xe):T.call(Ie,", ");return z+" ("+ie+") {"+Te+"}"}function U(z){for(var ie=0;ie<z.length;ie++)if(ee(z[ie],`
4
- `)>=0)return!1;return!0}function X(z,ie){var Ie;if(z.indent===" ")Ie=" ";else if(typeof z.indent=="number"&&z.indent>0)Ie=T.call(Array(z.indent+1)," ");else return null;return{base:Ie,prev:T.call(Array(ie+1),Ie)}}function fe(z,ie){if(z.length===0)return"";var Ie=`
5
- `+ie.prev+ie.base;return Ie+T.call(z,","+Ie)+`
6
- `+ie.prev}function Se(z,ie){var Ie=be(z),xe=[];if(Ie){xe.length=z.length;for(var Te=0;Te<z.length;Te++)xe[Te]=oe(z,Te)?ie(z[Te],z):""}var Oe=typeof k=="function"?k(z):[],Ke;if(F){Ke={};for(var Ge=0;Ge<Oe.length;Ge++)Ke["$"+Oe[Ge]]=Oe[Ge]}for(var Ue in z)oe(z,Ue)&&(Ie&&String(Number(Ue))===Ue&&Ue<z.length||F&&Ke["$"+Ue]instanceof Symbol||(A.call(/[^\w$]/,Ue)?xe.push(ie(Ue,z)+": "+ie(z[Ue],z)):xe.push(Ue+": "+ie(z[Ue],z))));if(typeof k=="function")for(var Qe=0;Qe<Oe.length;Qe++)ae.call(z,Oe[Qe])&&xe.push("["+ie(Oe[Qe])+"]: "+ie(z[Oe[Qe]],z));return xe}return br}function Ru(){if(Ti)return vr;Ti=!0;var g=Bt(),u=yu(),o=Pu(),s=Qt(),f=g("%WeakMap%",!0),r=g("%Map%",!0),t=u("WeakMap.prototype.get",!0),n=u("WeakMap.prototype.set",!0),e=u("WeakMap.prototype.has",!0),i=u("Map.prototype.get",!0),a=u("Map.prototype.set",!0),d=u("Map.prototype.has",!0),p=function(b,S){for(var h=b,_;(_=h.next)!==null;h=_)if(_.key===S)return h.next=_.next,_.next=b.next,b.next=_,_},m=function(b,S){var h=p(b,S);return h&&h.value},c=function(b,S,h){var _=p(b,S);_?_.value=h:b.next={key:S,next:b.next,value:h}},y=function(b,S){return!!p(b,S)};return vr=function(){var b,S,h,_={assert:function(I){if(!_.has(I))throw new s("Side channel does not contain "+o(I))},get:function(I){if(f&&I&&(typeof I=="object"||typeof I=="function")){if(b)return t(b,I)}else if(r){if(S)return i(S,I)}else if(h)return m(h,I)},has:function(I){if(f&&I&&(typeof I=="object"||typeof I=="function")){if(b)return e(b,I)}else if(r){if(S)return d(S,I)}else if(h)return y(h,I);return!1},set:function(I,v){f&&I&&(typeof I=="object"||typeof I=="function")?(b||(b=new f),n(b,I,v)):r?(S||(S=new r),a(S,I,v)):(h||(h={key:{},next:null}),c(h,I,v))}};return _},vr}function zi(){if(ki)return wr;ki=!0;var g=String.prototype.replace,u=/%20/g,o={RFC1738:"RFC1738",RFC3986:"RFC3986"};return wr={default:o.RFC3986,formatters:{RFC1738:function(s){return g.call(s,u,"+")},RFC3986:function(s){return String(s)}},RFC1738:o.RFC1738,RFC3986:o.RFC3986},wr}function ca(){if(Oi)return _r;Oi=!0;var g=zi(),u=Object.prototype.hasOwnProperty,o=Array.isArray,s=(function(){for(var b=[],S=0;S<256;++S)b.push("%"+((S<16?"0":"")+S.toString(16)).toUpperCase());return b})(),f=function(b){for(;b.length>1;){var S=b.pop(),h=S.obj[S.prop];if(o(h)){for(var _=[],I=0;I<h.length;++I)typeof h[I]<"u"&&_.push(h[I]);S.obj[S.prop]=_}}},r=function(b,S){for(var h=S&&S.plainObjects?Object.create(null):{},_=0;_<b.length;++_)typeof b[_]<"u"&&(h[_]=b[_]);return h},t=function b(S,h,_){if(!h)return S;if(typeof h!="object"){if(o(S))S.push(h);else if(S&&typeof S=="object")(_&&(_.plainObjects||_.allowPrototypes)||!u.call(Object.prototype,h))&&(S[h]=!0);else return[S,h];return S}if(!S||typeof S!="object")return[S].concat(h);var I=S;return o(S)&&!o(h)&&(I=r(S,_)),o(S)&&o(h)?(h.forEach(function(v,A){if(u.call(S,A)){var E=S[A];E&&typeof E=="object"&&v&&typeof v=="object"?S[A]=b(E,v,_):S.push(v)}else S[A]=v}),S):Object.keys(h).reduce(function(v,A){var E=h[A];return u.call(v,A)?v[A]=b(v[A],E,_):v[A]=E,v},I)},n=function(b,S){return Object.keys(S).reduce(function(h,_){return h[_]=S[_],h},b)},e=function(b,S,h){var _=b.replace(/\+/g," ");if(h==="iso-8859-1")return _.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(_)}catch{return _}},i=1024,a=function(b,S,h,_,I){if(b.length===0)return b;var v=b;if(typeof b=="symbol"?v=Symbol.prototype.toString.call(b):typeof b!="string"&&(v=String(b)),h==="iso-8859-1")return escape(v).replace(/%u[0-9a-f]{4}/gi,function(k){return"%26%23"+parseInt(k.slice(2),16)+"%3B"});for(var A="",E=0;E<v.length;E+=i){for(var T=v.length>=i?v.slice(E,E+i):v,C=[],P=0;P<T.length;++P){var L=T.charCodeAt(P);if(L===45||L===46||L===95||L===126||L>=48&&L<=57||L>=65&&L<=90||L>=97&&L<=122||I===g.RFC1738&&(L===40||L===41)){C[C.length]=T.charAt(P);continue}if(L<128){C[C.length]=s[L];continue}if(L<2048){C[C.length]=s[192|L>>6]+s[128|L&63];continue}if(L<55296||L>=57344){C[C.length]=s[224|L>>12]+s[128|L>>6&63]+s[128|L&63];continue}P+=1,L=65536+((L&1023)<<10|T.charCodeAt(P)&1023),C[C.length]=s[240|L>>18]+s[128|L>>12&63]+s[128|L>>6&63]+s[128|L&63]}A+=C.join("")}return A},d=function(b){for(var S=[{obj:{o:b},prop:"o"}],h=[],_=0;_<S.length;++_)for(var I=S[_],v=I.obj[I.prop],A=Object.keys(v),E=0;E<A.length;++E){var T=A[E],C=v[T];typeof C=="object"&&C!==null&&h.indexOf(C)===-1&&(S.push({obj:v,prop:T}),h.push(C))}return f(S),b},p=function(b){return Object.prototype.toString.call(b)==="[object RegExp]"},m=function(b){return!b||typeof b!="object"?!1:!!(b.constructor&&b.constructor.isBuffer&&b.constructor.isBuffer(b))},c=function(b,S){return[].concat(b,S)},y=function(b,S){if(o(b)){for(var h=[],_=0;_<b.length;_+=1)h.push(S(b[_]));return h}return S(b)};return _r={arrayToObject:r,assign:n,combine:c,compact:d,decode:e,encode:a,isBuffer:m,isRegExp:p,maybeMap:y,merge:t},_r}function Cu(){if(Pi)return Sr;Pi=!0;var g=Ru(),u=ca(),o=zi(),s=Object.prototype.hasOwnProperty,f={brackets:function(y){return y+"[]"},comma:"comma",indices:function(y,b){return y+"["+b+"]"},repeat:function(y){return y}},r=Array.isArray,t=Array.prototype.push,n=function(y,b){t.apply(y,r(b)?b:[b])},e=Date.prototype.toISOString,i=o.default,a={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:u.encode,encodeValuesOnly:!1,format:i,formatter:o.formatters[i],indices:!1,serializeDate:function(y){return e.call(y)},skipNulls:!1,strictNullHandling:!1},d=function(y){return typeof y=="string"||typeof y=="number"||typeof y=="boolean"||typeof y=="symbol"||typeof y=="bigint"},p={},m=function y(b,S,h,_,I,v,A,E,T,C,P,L,k,q,F,B,ae,Q){for(var V=b,re=Q,D=0,Z=!1;(re=re.get(p))!==void 0&&!Z;){var R=re.get(b);if(D+=1,typeof R<"u"){if(R===D)throw new RangeError("Cyclic object value");Z=!0}typeof re.get(p)>"u"&&(D=0)}if(typeof C=="function"?V=C(S,V):V instanceof Date?V=k(V):h==="comma"&&r(V)&&(V=u.maybeMap(V,function(M){return M instanceof Date?k(M):M})),V===null){if(v)return T&&!B?T(S,a.encoder,ae,"key",q):S;V=""}if(d(V)||u.isBuffer(V)){if(T){var J=B?S:T(S,a.encoder,ae,"key",q);return[F(J)+"="+F(T(V,a.encoder,ae,"value",q))]}return[F(S)+"="+F(String(V))]}var be=[];if(typeof V>"u")return be;var te;if(h==="comma"&&r(V))B&&T&&(V=u.maybeMap(V,T)),te=[{value:V.length>0?V.join(",")||null:void 0}];else if(r(C))te=C;else{var we=Object.keys(V);te=P?we.sort(P):we}var K=E?S.replace(/\./g,"%2E"):S,N=_&&r(V)&&V.length===1?K+"[]":K;if(I&&r(V)&&V.length===0)return N+"[]";for(var ne=0;ne<te.length;++ne){var H=te[ne],G=typeof H=="object"&&typeof H.value<"u"?H.value:V[H];if(!(A&&G===null)){var Y=L&&E?H.replace(/\./g,"%2E"):H,ye=r(V)?typeof h=="function"?h(N,Y):N:N+(L?"."+Y:"["+Y+"]");Q.set(b,D);var oe=g();oe.set(p,Q),n(be,y(G,ye,h,_,I,v,A,E,h==="comma"&&B&&r(V)?null:T,C,P,L,k,q,F,B,ae,oe))}}return be},c=function(y){if(!y)return a;if(typeof y.allowEmptyArrays<"u"&&typeof y.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof y.encodeDotInKeys<"u"&&typeof y.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(y.encoder!==null&&typeof y.encoder<"u"&&typeof y.encoder!="function")throw new TypeError("Encoder has to be a function.");var b=y.charset||a.charset;if(typeof y.charset<"u"&&y.charset!=="utf-8"&&y.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var S=o.default;if(typeof y.format<"u"){if(!s.call(o.formatters,y.format))throw new TypeError("Unknown format option provided.");S=y.format}var h=o.formatters[S],_=a.filter;(typeof y.filter=="function"||r(y.filter))&&(_=y.filter);var I;if(y.arrayFormat in f?I=y.arrayFormat:"indices"in y?I=y.indices?"indices":"repeat":I=a.arrayFormat,"commaRoundTrip"in y&&typeof y.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var v=typeof y.allowDots>"u"?y.encodeDotInKeys===!0?!0:a.allowDots:!!y.allowDots;return{addQueryPrefix:typeof y.addQueryPrefix=="boolean"?y.addQueryPrefix:a.addQueryPrefix,allowDots:v,allowEmptyArrays:typeof y.allowEmptyArrays=="boolean"?!!y.allowEmptyArrays:a.allowEmptyArrays,arrayFormat:I,charset:b,charsetSentinel:typeof y.charsetSentinel=="boolean"?y.charsetSentinel:a.charsetSentinel,commaRoundTrip:y.commaRoundTrip,delimiter:typeof y.delimiter>"u"?a.delimiter:y.delimiter,encode:typeof y.encode=="boolean"?y.encode:a.encode,encodeDotInKeys:typeof y.encodeDotInKeys=="boolean"?y.encodeDotInKeys:a.encodeDotInKeys,encoder:typeof y.encoder=="function"?y.encoder:a.encoder,encodeValuesOnly:typeof y.encodeValuesOnly=="boolean"?y.encodeValuesOnly:a.encodeValuesOnly,filter:_,format:S,formatter:h,serializeDate:typeof y.serializeDate=="function"?y.serializeDate:a.serializeDate,skipNulls:typeof y.skipNulls=="boolean"?y.skipNulls:a.skipNulls,sort:typeof y.sort=="function"?y.sort:null,strictNullHandling:typeof y.strictNullHandling=="boolean"?y.strictNullHandling:a.strictNullHandling}};return Sr=function(y,b){var S=y,h=c(b),_,I;typeof h.filter=="function"?(I=h.filter,S=I("",S)):r(h.filter)&&(I=h.filter,_=I);var v=[];if(typeof S!="object"||S===null)return"";var A=f[h.arrayFormat],E=A==="comma"&&h.commaRoundTrip;_||(_=Object.keys(S)),h.sort&&_.sort(h.sort);for(var T=g(),C=0;C<_.length;++C){var P=_[C];h.skipNulls&&S[P]===null||n(v,m(S[P],P,A,E,h.allowEmptyArrays,h.strictNullHandling,h.skipNulls,h.encodeDotInKeys,h.encode?h.encoder:null,h.filter,h.sort,h.allowDots,h.serializeDate,h.format,h.formatter,h.encodeValuesOnly,h.charset,T))}var L=v.join(h.delimiter),k=h.addQueryPrefix===!0?"?":"";return h.charsetSentinel&&(h.charset==="iso-8859-1"?k+="utf8=%26%2310003%3B&":k+="utf8=%E2%9C%93&"),L.length>0?k+L:""},Sr}function Mu(){if(Ri)return Er;Ri=!0;var g=ca(),u=Object.prototype.hasOwnProperty,o=Array.isArray,s={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:g.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},f=function(p){return p.replace(/&#(\d+);/g,function(m,c){return String.fromCharCode(parseInt(c,10))})},r=function(p,m){return p&&typeof p=="string"&&m.comma&&p.indexOf(",")>-1?p.split(","):p},t="utf8=%26%2310003%3B",n="utf8=%E2%9C%93",e=function(p,m){var c={__proto__:null},y=m.ignoreQueryPrefix?p.replace(/^\?/,""):p;y=y.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var b=m.parameterLimit===1/0?void 0:m.parameterLimit,S=y.split(m.delimiter,b),h=-1,_,I=m.charset;if(m.charsetSentinel)for(_=0;_<S.length;++_)S[_].indexOf("utf8=")===0&&(S[_]===n?I="utf-8":S[_]===t&&(I="iso-8859-1"),h=_,_=S.length);for(_=0;_<S.length;++_)if(_!==h){var v=S[_],A=v.indexOf("]="),E=A===-1?v.indexOf("="):A+1,T,C;E===-1?(T=m.decoder(v,s.decoder,I,"key"),C=m.strictNullHandling?null:""):(T=m.decoder(v.slice(0,E),s.decoder,I,"key"),C=g.maybeMap(r(v.slice(E+1),m),function(L){return m.decoder(L,s.decoder,I,"value")})),C&&m.interpretNumericEntities&&I==="iso-8859-1"&&(C=f(C)),v.indexOf("[]=")>-1&&(C=o(C)?[C]:C);var P=u.call(c,T);P&&m.duplicates==="combine"?c[T]=g.combine(c[T],C):(!P||m.duplicates==="last")&&(c[T]=C)}return c},i=function(p,m,c,y){for(var b=y?m:r(m,c),S=p.length-1;S>=0;--S){var h,_=p[S];if(_==="[]"&&c.parseArrays)h=c.allowEmptyArrays&&(b===""||c.strictNullHandling&&b===null)?[]:[].concat(b);else{h=c.plainObjects?Object.create(null):{};var I=_.charAt(0)==="["&&_.charAt(_.length-1)==="]"?_.slice(1,-1):_,v=c.decodeDotInKeys?I.replace(/%2E/g,"."):I,A=parseInt(v,10);!c.parseArrays&&v===""?h={0:b}:!isNaN(A)&&_!==v&&String(A)===v&&A>=0&&c.parseArrays&&A<=c.arrayLimit?(h=[],h[A]=b):v!=="__proto__"&&(h[v]=b)}b=h}return b},a=function(p,m,c,y){if(p){var b=c.allowDots?p.replace(/\.([^.[]+)/g,"[$1]"):p,S=/(\[[^[\]]*])/,h=/(\[[^[\]]*])/g,_=c.depth>0&&S.exec(b),I=_?b.slice(0,_.index):b,v=[];if(I){if(!c.plainObjects&&u.call(Object.prototype,I)&&!c.allowPrototypes)return;v.push(I)}for(var A=0;c.depth>0&&(_=h.exec(b))!==null&&A<c.depth;){if(A+=1,!c.plainObjects&&u.call(Object.prototype,_[1].slice(1,-1))&&!c.allowPrototypes)return;v.push(_[1])}if(_){if(c.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+c.depth+" and strictDepth is true");v.push("["+b.slice(_.index)+"]")}return i(v,m,c,y)}},d=function(p){if(!p)return s;if(typeof p.allowEmptyArrays<"u"&&typeof p.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof p.decodeDotInKeys<"u"&&typeof p.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(p.decoder!==null&&typeof p.decoder<"u"&&typeof p.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof p.charset<"u"&&p.charset!=="utf-8"&&p.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var m=typeof p.charset>"u"?s.charset:p.charset,c=typeof p.duplicates>"u"?s.duplicates:p.duplicates;if(c!=="combine"&&c!=="first"&&c!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var y=typeof p.allowDots>"u"?p.decodeDotInKeys===!0?!0:s.allowDots:!!p.allowDots;return{allowDots:y,allowEmptyArrays:typeof p.allowEmptyArrays=="boolean"?!!p.allowEmptyArrays:s.allowEmptyArrays,allowPrototypes:typeof p.allowPrototypes=="boolean"?p.allowPrototypes:s.allowPrototypes,allowSparse:typeof p.allowSparse=="boolean"?p.allowSparse:s.allowSparse,arrayLimit:typeof p.arrayLimit=="number"?p.arrayLimit:s.arrayLimit,charset:m,charsetSentinel:typeof p.charsetSentinel=="boolean"?p.charsetSentinel:s.charsetSentinel,comma:typeof p.comma=="boolean"?p.comma:s.comma,decodeDotInKeys:typeof p.decodeDotInKeys=="boolean"?p.decodeDotInKeys:s.decodeDotInKeys,decoder:typeof p.decoder=="function"?p.decoder:s.decoder,delimiter:typeof p.delimiter=="string"||g.isRegExp(p.delimiter)?p.delimiter:s.delimiter,depth:typeof p.depth=="number"||p.depth===!1?+p.depth:s.depth,duplicates:c,ignoreQueryPrefix:p.ignoreQueryPrefix===!0,interpretNumericEntities:typeof p.interpretNumericEntities=="boolean"?p.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:typeof p.parameterLimit=="number"?p.parameterLimit:s.parameterLimit,parseArrays:p.parseArrays!==!1,plainObjects:typeof p.plainObjects=="boolean"?p.plainObjects:s.plainObjects,strictDepth:typeof p.strictDepth=="boolean"?!!p.strictDepth:s.strictDepth,strictNullHandling:typeof p.strictNullHandling=="boolean"?p.strictNullHandling:s.strictNullHandling}};return Er=function(p,m){var c=d(m);if(p===""||p===null||typeof p>"u")return c.plainObjects?Object.create(null):{};for(var y=typeof p=="string"?e(p,c):p,b=c.plainObjects?Object.create(null):{},S=Object.keys(y),h=0;h<S.length;++h){var _=S[h],I=a(_,y[_],c,typeof p=="string");b=g.merge(b,I,c)}return c.allowSparse===!0?b:g.compact(b)},Er}function ju(){if(Ci)return Ar;Ci=!0;var g=Cu(),u=Mu(),o=zi();return Ar={formats:o,parse:u,stringify:g},Ar}function Nu(){if(Mi)return yt;Mi=!0;var g=gt;function u(){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}var o=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,r=["<",">",'"',"`"," ","\r",`
7
- `," "],t=["{","}","|","\\","^","`"].concat(r),n=["'"].concat(t),e=["%","/","?",";","#"].concat(n),i=["/","?","#"],a=255,d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},c={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=ju();function S(v,A,E){if(v&&typeof v=="object"&&v instanceof u)return v;var T=new u;return T.parse(v,A,E),T}u.prototype.parse=function(v,A,E){if(typeof v!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof v);var T=v.indexOf("?"),C=T!==-1&&T<v.indexOf("#")?"?":"#",P=v.split(C),L=/\\/g;P[0]=P[0].replace(L,"/"),v=P.join(C);var k=v;if(k=k.trim(),!E&&v.split("#").length===1){var q=f.exec(k);if(q)return this.path=k,this.href=k,this.pathname=q[1],q[2]?(this.search=q[2],A?this.query=b.parse(this.search.substr(1)):this.query=this.search.substr(1)):A&&(this.search="",this.query={}),this}var F=o.exec(k);if(F){F=F[0];var B=F.toLowerCase();this.protocol=B,k=k.substr(F.length)}if(E||F||k.match(/^\/\/[^@/]+@[^@/]+/)){var ae=k.substr(0,2)==="//";ae&&!(F&&c[F])&&(k=k.substr(2),this.slashes=!0)}if(!c[F]&&(ae||F&&!y[F])){for(var Q=-1,V=0;V<i.length;V++){var re=k.indexOf(i[V]);re!==-1&&(Q===-1||re<Q)&&(Q=re)}var D,Z;Q===-1?Z=k.lastIndexOf("@"):Z=k.lastIndexOf("@",Q),Z!==-1&&(D=k.slice(0,Z),k=k.slice(Z+1),this.auth=decodeURIComponent(D)),Q=-1;for(var V=0;V<e.length;V++){var re=k.indexOf(e[V]);re!==-1&&(Q===-1||re<Q)&&(Q=re)}Q===-1&&(Q=k.length),this.host=k.slice(0,Q),k=k.slice(Q),this.parseHost(),this.hostname=this.hostname||"";var R=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!R)for(var J=this.hostname.split(/\./),V=0,be=J.length;V<be;V++){var te=J[V];if(te&&!te.match(d)){for(var we="",K=0,N=te.length;K<N;K++)te.charCodeAt(K)>127?we+="x":we+=te[K];if(!we.match(d)){var ne=J.slice(0,V),H=J.slice(V+1),G=te.match(p);G&&(ne.push(G[1]),H.unshift(G[2])),H.length&&(k="/"+H.join(".")+k),this.hostname=ne.join(".");break}}}this.hostname.length>a?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=g.toASCII(this.hostname));var Y=this.port?":"+this.port:"",ye=this.hostname||"";this.host=ye+Y,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!m[B])for(var V=0,be=n.length;V<be;V++){var oe=n[V];if(k.indexOf(oe)!==-1){var M=encodeURIComponent(oe);M===oe&&(M=escape(oe)),k=k.split(oe).join(M)}}var W=k.indexOf("#");W!==-1&&(this.hash=k.substr(W),k=k.slice(0,W));var ee=k.indexOf("?");if(ee!==-1?(this.search=k.substr(ee),this.query=k.substr(ee+1),A&&(this.query=b.parse(this.query)),k=k.slice(0,ee)):A&&(this.search="",this.query={}),k&&(this.pathname=k),y[B]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Y=this.pathname||"",he=this.search||"";this.path=Y+he}return this.href=this.format(),this};function h(v){return typeof v=="string"&&(v=S(v)),v instanceof u?v.format():u.prototype.format.call(v)}u.prototype.format=function(){var v=this.auth||"";v&&(v=encodeURIComponent(v),v=v.replace(/%3A/i,":"),v+="@");var A=this.protocol||"",E=this.pathname||"",T=this.hash||"",C=!1,P="";this.host?C=v+this.host:this.hostname&&(C=v+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(C+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(P=b.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var L=this.search||P&&"?"+P||"";return A&&A.substr(-1)!==":"&&(A+=":"),this.slashes||(!A||y[A])&&C!==!1?(C="//"+(C||""),E&&E.charAt(0)!=="/"&&(E="/"+E)):C||(C=""),T&&T.charAt(0)!=="#"&&(T="#"+T),L&&L.charAt(0)!=="?"&&(L="?"+L),E=E.replace(/[?#]/g,function(k){return encodeURIComponent(k)}),L=L.replace("#","%23"),A+C+E+L+T};function _(v,A){return S(v,!1,!0).resolve(A)}u.prototype.resolve=function(v){return this.resolveObject(S(v,!1,!0)).format()};function I(v,A){return v?S(v,!1,!0).resolveObject(A):A}return u.prototype.resolveObject=function(v){if(typeof v=="string"){var A=new u;A.parse(v,!1,!0),v=A}for(var E=new u,T=Object.keys(this),C=0;C<T.length;C++){var P=T[C];E[P]=this[P]}if(E.hash=v.hash,v.href==="")return E.href=E.format(),E;if(v.slashes&&!v.protocol){for(var L=Object.keys(v),k=0;k<L.length;k++){var q=L[k];q!=="protocol"&&(E[q]=v[q])}return y[E.protocol]&&E.hostname&&!E.pathname&&(E.pathname="/",E.path=E.pathname),E.href=E.format(),E}if(v.protocol&&v.protocol!==E.protocol){if(!y[v.protocol]){for(var F=Object.keys(v),B=0;B<F.length;B++){var ae=F[B];E[ae]=v[ae]}return E.href=E.format(),E}if(E.protocol=v.protocol,!v.host&&!c[v.protocol]){for(var be=(v.pathname||"").split("/");be.length&&!(v.host=be.shift()););v.host||(v.host=""),v.hostname||(v.hostname=""),be[0]!==""&&be.unshift(""),be.length<2&&be.unshift(""),E.pathname=be.join("/")}else E.pathname=v.pathname;if(E.search=v.search,E.query=v.query,E.host=v.host||"",E.auth=v.auth,E.hostname=v.hostname||v.host,E.port=v.port,E.pathname||E.search){var Q=E.pathname||"",V=E.search||"";E.path=Q+V}return E.slashes=E.slashes||v.slashes,E.href=E.format(),E}var re=E.pathname&&E.pathname.charAt(0)==="/",D=v.host||v.pathname&&v.pathname.charAt(0)==="/",Z=D||re||E.host&&v.pathname,R=Z,J=E.pathname&&E.pathname.split("/")||[],be=v.pathname&&v.pathname.split("/")||[],te=E.protocol&&!y[E.protocol];if(te&&(E.hostname="",E.port=null,E.host&&(J[0]===""?J[0]=E.host:J.unshift(E.host)),E.host="",v.protocol&&(v.hostname=null,v.port=null,v.host&&(be[0]===""?be[0]=v.host:be.unshift(v.host)),v.host=null),Z=Z&&(be[0]===""||J[0]==="")),D)E.host=v.host||v.host===""?v.host:E.host,E.hostname=v.hostname||v.hostname===""?v.hostname:E.hostname,E.search=v.search,E.query=v.query,J=be;else if(be.length)J||(J=[]),J.pop(),J=J.concat(be),E.search=v.search,E.query=v.query;else if(v.search!=null){if(te){E.host=J.shift(),E.hostname=E.host;var we=E.host&&E.host.indexOf("@")>0?E.host.split("@"):!1;we&&(E.auth=we.shift(),E.hostname=we.shift(),E.host=E.hostname)}return E.search=v.search,E.query=v.query,(E.pathname!==null||E.search!==null)&&(E.path=(E.pathname?E.pathname:"")+(E.search?E.search:"")),E.href=E.format(),E}if(!J.length)return E.pathname=null,E.search?E.path="/"+E.search:E.path=null,E.href=E.format(),E;for(var K=J.slice(-1)[0],N=(E.host||v.host||J.length>1)&&(K==="."||K==="..")||K==="",ne=0,H=J.length;H>=0;H--)K=J[H],K==="."?J.splice(H,1):K===".."?(J.splice(H,1),ne++):ne&&(J.splice(H,1),ne--);if(!Z&&!R)for(;ne--;ne)J.unshift("..");Z&&J[0]!==""&&(!J[0]||J[0].charAt(0)!=="/")&&J.unshift(""),N&&J.join("/").substr(-1)!=="/"&&J.push("");var G=J[0]===""||J[0]&&J[0].charAt(0)==="/";if(te){E.hostname=G?"":J.length?J.shift():"",E.host=E.hostname;var we=E.host&&E.host.indexOf("@")>0?E.host.split("@"):!1;we&&(E.auth=we.shift(),E.hostname=we.shift(),E.host=E.hostname)}return Z=Z||E.host&&J.length,Z&&!G&&J.unshift(""),J.length>0?E.pathname=J.join("/"):(E.pathname=null,E.path=null),(E.pathname!==null||E.search!==null)&&(E.path=(E.pathname?E.pathname:"")+(E.search?E.search:"")),E.auth=v.auth||E.auth,E.slashes=E.slashes||v.slashes,E.href=E.format(),E},u.prototype.parseHost=function(){var v=this.host,A=s.exec(v);A&&(A=A[0],A!==":"&&(this.port=A.substr(1)),v=v.substr(0,v.length-A.length)),v&&(this.hostname=v)},yt.parse=S,yt.resolve=_,yt.resolveObject=I,yt.format=h,yt.Url=u,yt}function fa(g){if(typeof g=="string")g=new URL(g);else if(!(g instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(g.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return xr?Bu(g):Uu(g)}function Bu(g){let u=g.hostname,o=g.pathname;for(let s=0;s<o.length;s++)if(o[s]==="%"){let f=o.codePointAt(s+2)||32;if(o[s+1]==="2"&&f===102||o[s+1]==="5"&&f===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(o=o.replace(Aa,"\\"),o=decodeURIComponent(o),u!=="")return`\\\\${u}${o}`;{let s=o.codePointAt(1)|32,f=o[2];if(s<Sa||s>Ea||f!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return o.slice(1)}}function Uu(g){if(g.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let u=g.pathname;for(let o=0;o<u.length;o++)if(u[o]==="%"){let s=u.codePointAt(o+2)||32;if(u[o+1]==="2"&&s===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(u)}function ha(g){let u=Ii.resolve(g),o=g.charCodeAt(g.length-1);(o===_a||xr&&o===wa)&&u[u.length-1]!==Ii.sep&&(u+="/");let s=new URL("file://");return u.includes("%")&&(u=u.replace(Ia,"%25")),!xr&&u.includes("\\")&&(u=u.replace(xa,"%5C")),u.includes(`
8
- `)&&(u=u.replace(Ta,"%0A")),u.includes("\r")&&(u=u.replace(ka,"%0D")),u.includes(" ")&&(u=u.replace(Oa,"%09")),s.pathname=u,s}var pa,br,xi,mr,vr,Ti,wr,ki,_r,Oi,Sr,Pi,Er,Ri,Ar,Ci,yt,Mi,De,Xo,da,ga,ya,ba,ma,va,wa,_a,Sa,Ea,xr,Aa,Ia,xa,Ta,ka,Oa,Lu=He(()=>{le(),ce(),ue(),tu(),bu(),Ou(),la(),pa=Object.freeze(Object.create(null)),br={},xi=!1,mr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,vr={},Ti=!1,wr={},ki=!1,_r={},Oi=!1,Sr={},Pi=!1,Er={},Ri=!1,Ar={},Ci=!1,yt={},Mi=!1,De=Nu(),De.parse,De.resolve,De.resolveObject,De.format,De.Url,Xo=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0,De.URL=typeof URL<"u"?URL:null,De.pathToFileURL=ha,De.fileURLToPath=fa,da=De.Url,ga=De.format,ya=De.resolve,ba=De.resolveObject,ma=De.parse,va=De.URL,wa=92,_a=47,Sa=97,Ea=122,xr=Xo==="win32",Aa=/\//g,Ia=/%/g,xa=/\\/g,Ta=/\n/g,ka=/\r/g,Oa=/\t/g}),Fu=de((g,u)=>{le(),ce(),ue(),u.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}),Vi=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0}),g.BufferedDuplex=void 0,g.writev=s;var u=Tt(),o=(Be(),Pe(Ne));function s(r,t){let n=new Array(r.length);for(let e=0;e<r.length;e++)typeof r[e].chunk=="string"?n[e]=o.Buffer.from(r[e].chunk,"utf8"):n[e]=r[e].chunk;this._write(o.Buffer.concat(n),"binary",t)}var f=class extends u.Duplex{socket;proxy;isSocketOpen;writeQueue;constructor(r,t,n){super({objectMode:!0}),this.proxy=t,this.socket=n,this.writeQueue=[],r.objectMode||(this._writev=s.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",e=>{!this.destroyed&&this.readable&&this.push(e)})}_read(r){this.proxy.read(r)}_write(r,t,n){this.isSocketOpen?this.writeToProxy(r,t,n):this.writeQueue.push({chunk:r,encoding:t,cb:n})}_final(r){this.writeQueue=[],this.proxy.end(r)}_destroy(r,t){this.writeQueue=[],this.proxy.destroy(),t(r)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(r,t,n){this.proxy.write(r,t)===!1?this.proxy.once("drain",n):n()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:r,encoding:t,cb:n}=this.writeQueue.shift();this.writeToProxy(r,t,n)}}};g.BufferedDuplex=f}),Zt=de(g=>{le(),ce(),ue();var u=g&&g.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(g,"__esModule",{value:!0}),g.streamBuilder=g.browserStreamBuilder=void 0;var o=(Be(),Pe(Ne)),s=u(Fu()),f=u(at()),r=Tt(),t=u(Cr()),n=Vi(),e=(0,f.default)("mqttjs:ws"),i=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function a(S,h){let _=`${S.protocol}://${S.hostname}:${S.port}${S.path}`;return typeof S.transformWsUrl=="function"&&(_=S.transformWsUrl(_,S,h)),_}function d(S){let h=S;return S.port||(S.protocol==="wss"?h.port=443:h.port=80),S.path||(h.path="/"),S.wsOptions||(h.wsOptions={}),!t.default&&!S.forceNativeWebSocket&&S.protocol==="wss"&&i.forEach(_=>{Object.prototype.hasOwnProperty.call(S,_)&&!Object.prototype.hasOwnProperty.call(S.wsOptions,_)&&(h.wsOptions[_]=S[_])}),h}function p(S){let h=d(S);if(h.hostname||(h.hostname=h.host),!h.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let _=new URL(document.URL);h.hostname=_.hostname,h.port||(h.port=Number(_.port))}return h.objectMode===void 0&&(h.objectMode=!(h.binary===!0||h.binary===void 0)),h}function m(S,h,_){e("createWebSocket"),e(`protocol: ${_.protocolId} ${_.protocolVersion}`);let I=_.protocolId==="MQIsdp"&&_.protocolVersion===3?"mqttv3.1":"mqtt";e(`creating new Websocket for url: ${h} and protocol: ${I}`);let v;return _.createWebsocket?v=_.createWebsocket(h,[I],_):v=new s.default(h,[I],_.wsOptions),v}function c(S,h){let _=h.protocolId==="MQIsdp"&&h.protocolVersion===3?"mqttv3.1":"mqtt",I=a(h,S),v;return h.createWebsocket?v=h.createWebsocket(I,[_],h):v=new WebSocket(I,[_]),v.binaryType="arraybuffer",v}var y=(S,h)=>{e("streamBuilder");let _=d(h);_.hostname=_.hostname||_.host||"localhost";let I=a(_,S),v=m(S,I,_),A=s.default.createWebSocketStream(v,_.wsOptions);return A.url=I,v.on("close",()=>{A.destroy()}),A};g.streamBuilder=y;var b=(S,h)=>{e("browserStreamBuilder");let _,I=p(h).browserBufferSize||1024*512,v=h.browserBufferTimeout||1e3,A=!h.objectMode,E=c(S,h),T=P(h,B,ae);h.objectMode||(T._writev=n.writev.bind(T)),T.on("close",()=>{E.close()});let C=typeof E.addEventListener<"u";E.readyState===E.OPEN?(_=T,_.socket=E):(_=new n.BufferedDuplex(h,T,E),C?E.addEventListener("open",L):E.onopen=L),C?(E.addEventListener("close",k),E.addEventListener("error",q),E.addEventListener("message",F)):(E.onclose=k,E.onerror=q,E.onmessage=F);function P(Q,V,re){let D=new r.Transform({objectMode:Q.objectMode});return D._write=V,D._flush=re,D}function L(){e("WebSocket onOpen"),_ instanceof n.BufferedDuplex&&_.socketReady()}function k(Q){e("WebSocket onClose",Q),_.end(),_.destroy()}function q(Q){e("WebSocket onError",Q);let V=new Error("WebSocket error");V.event=Q,_.destroy(V)}async function F(Q){if(!T||!T.readable||!T.writable)return;let{data:V}=Q;V instanceof ArrayBuffer?V=o.Buffer.from(V):V instanceof Blob?V=o.Buffer.from(await new Response(V).arrayBuffer()):V=o.Buffer.from(V,"utf8"),T.push(V)}function B(Q,V,re){if(E.bufferedAmount>I){setTimeout(B,v,Q,V,re);return}A&&typeof Q=="string"&&(Q=o.Buffer.from(Q,"utf8"));try{E.send(Q)}catch(D){return re(D)}re()}function ae(Q){E.close(),Q()}return _};g.browserStreamBuilder=b}),Ki={};Mt(Ki,{Server:()=>Ce,Socket:()=>Ce,Stream:()=>Ce,_createServerHandle:()=>Ce,_normalizeArgs:()=>Ce,_setSimultaneousAccepts:()=>Ce,connect:()=>Ce,createConnection:()=>Ce,createServer:()=>Ce,default:()=>Pa,isIP:()=>Ce,isIPv4:()=>Ce,isIPv6:()=>Ce});function Ce(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var Pa,Ra=He(()=>{le(),ce(),ue(),Pa={_createServerHandle:Ce,_normalizeArgs:Ce,_setSimultaneousAccepts:Ce,connect:Ce,createConnection:Ce,createServer:Ce,isIP:Ce,isIPv4:Ce,isIPv6:Ce,Server:Ce,Socket:Ce,Stream:Ce}}),Ca=de((g,u)=>{le(),ce(),ue(),u.exports={}}),Zo=de(g=>{le(),ce(),ue();var u=g&&g.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(g,"__esModule",{value:!0});var o=u((Ra(),Pe(Ki))),s=u(at()),f=u(Ca()),r=(0,s.default)("mqttjs:tcp"),t=(n,e)=>{if(e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost",e.socksProxy)return(0,f.default)(e.hostname,e.port,e.socksProxy,{timeout:e.socksTimeout});let{port:i,path:a}=e,d=e.hostname;return r("port %d and host %s",i,d),o.default.createConnection({port:i,host:d,path:a})};g.default=t}),Ma={};Mt(Ma,{default:()=>ja});var ja,Du=He(()=>{le(),ce(),ue(),ja={}}),es=de(g=>{le(),ce(),ue();var u=g&&g.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(g,"__esModule",{value:!0});var o=(Du(),Pe(Ma)),s=u((Ra(),Pe(Ki))),f=u(at()),r=u(Ca()),t=(0,f.default)("mqttjs:tls");function n(i){let{host:a,port:d,socksProxy:p,...m}=i;if(p!==void 0){let c=(0,r.default)(a,d,p,{timeout:i.socksTimeout});return(0,o.connect)({...m,socket:c})}return(0,o.connect)(i)}var e=(i,a)=>{a.port=a.port||8883,a.host=a.hostname||a.host||"localhost",s.default.isIP(a.host)===0&&(a.servername=a.host),a.rejectUnauthorized=a.rejectUnauthorized!==!1,delete a.path,t("port %d host %s rejectUnauthorized %b",a.port,a.host,a.rejectUnauthorized);let d=n(a);d.on("secureConnect",()=>{a.rejectUnauthorized&&!d.authorized?d.emit("error",new Error("TLS not authorized")):d.removeListener("error",p)});function p(m){a.rejectUnauthorized&&i.emit("error",m),d.end()}return d.on("error",p),d};g.default=e}),ts=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=(Be(),Pe(Ne)),o=Tt(),s=Vi(),f,r,t;function n(){let p=new o.Transform;return p._write=(m,c,y)=>{f.send({data:m.buffer,success(){y()},fail(b){y(new Error(b))}})},p._flush=m=>{f.close({success(){m()}})},p}function e(p){p.hostname||(p.hostname="localhost"),p.path||(p.path="/"),p.wsOptions||(p.wsOptions={})}function i(p,m){let c=p.protocol==="wxs"?"wss":"ws",y=`${c}://${p.hostname}${p.path}`;return p.port&&p.port!==80&&p.port!==443&&(y=`${c}://${p.hostname}:${p.port}${p.path}`),typeof p.transformWsUrl=="function"&&(y=p.transformWsUrl(y,p,m)),y}function a(){f.onOpen(()=>{t.socketReady()}),f.onMessage(p=>{let{data:m}=p;m instanceof ArrayBuffer?m=u.Buffer.from(m):m=u.Buffer.from(m,"utf8"),r.push(m)}),f.onClose(()=>{t.emit("close"),t.end(),t.destroy()}),f.onError(p=>{let m=new Error(p.errMsg);t.destroy(m)})}var d=(p,m)=>{if(m.hostname=m.hostname||m.host,!m.hostname)throw new Error("Could not determine host. Specify host manually.");let c=m.protocolId==="MQIsdp"&&m.protocolVersion===3?"mqttv3.1":"mqtt";e(m);let y=i(m,p);f=wx.connectSocket({url:y,protocols:[c]}),r=n(),t=new s.BufferedDuplex(m,r,f),t._destroy=(S,h)=>{f.close({success(){h&&h(S)}})};let b=t.destroy;return t.destroy=(S,h)=>(t.destroy=b,setTimeout(()=>{f.close({fail(){t._destroy(S,h)}})},0),t),a(),t};g.default=d}),rs=de(g=>{le(),ce(),ue(),Object.defineProperty(g,"__esModule",{value:!0});var u=(Be(),Pe(Ne)),o=Tt(),s=Vi(),f,r,t,n=!1;function e(){let m=new o.Transform;return m._write=(c,y,b)=>{f.sendSocketMessage({data:c.buffer,success(){b()},fail(){b(new Error)}})},m._flush=c=>{f.closeSocket({success(){c()}})},m}function i(m){m.hostname||(m.hostname="localhost"),m.path||(m.path="/"),m.wsOptions||(m.wsOptions={})}function a(m,c){let y=m.protocol==="alis"?"wss":"ws",b=`${y}://${m.hostname}${m.path}`;return m.port&&m.port!==80&&m.port!==443&&(b=`${y}://${m.hostname}:${m.port}${m.path}`),typeof m.transformWsUrl=="function"&&(b=m.transformWsUrl(b,m,c)),b}function d(){n||(n=!0,f.onSocketOpen(()=>{t.socketReady()}),f.onSocketMessage(m=>{if(typeof m.data=="string"){let c=u.Buffer.from(m.data,"base64");r.push(c)}else{let c=new FileReader;c.addEventListener("load",()=>{if(c.result instanceof ArrayBuffer){r.push(u.Buffer.from(c.result));return}r.push(u.Buffer.from(c.result,"utf-8"))}),c.readAsArrayBuffer(m.data)}}),f.onSocketClose(()=>{t.end(),t.destroy()}),f.onSocketError(m=>{t.destroy(m)}))}var p=(m,c)=>{if(c.hostname=c.hostname||c.host,!c.hostname)throw new Error("Could not determine host. Specify host manually.");let y=c.protocolId==="MQIsdp"&&c.protocolVersion===3?"mqttv3.1":"mqtt";i(c);let b=a(c,m);return f=c.my,f.connectSocket({url:b,protocols:y}),r=e(),t=new s.BufferedDuplex(c,r,f),d(),t};g.default=p}),Wu=de(g=>{le(),ce(),ue();var u=g&&g.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(g,"__esModule",{value:!0}),g.connectAsync=a;var o=u(at()),s=u((Lu(),Pe(ua))),f=u(Vn()),r=u(Cr());typeof Re?.nextTick!="function"&&(Re.nextTick=setImmediate);var t=(0,o.default)("mqttjs"),n=null;function e(d){let p;if(d.auth)if(p=d.auth.match(/^(.+):(.+)$/),p){let[,m,c]=p;d.username=m,d.password=c}else d.username=d.auth}function i(d,p){if(t("connecting to an MQTT broker..."),typeof d=="object"&&!p&&(p=d,d=""),p=p||{},d&&typeof d=="string"){let y=s.default.parse(d,!0),b={};if(y.port!=null&&(b.port=Number(y.port)),b.host=y.hostname,b.query=y.query,b.auth=y.auth,b.protocol=y.protocol,b.path=y.path,p={...b,...p},!p.protocol)throw new Error("Missing protocol");p.protocol=p.protocol.replace(/:$/,"")}if(p.unixSocket=p.unixSocket||p.protocol?.includes("+unix"),p.unixSocket?p.protocol=p.protocol.replace("+unix",""):!p.protocol?.startsWith("ws")&&!p.protocol?.startsWith("wx")&&delete p.path,e(p),p.query&&typeof p.query.clientId=="string"&&(p.clientId=p.query.clientId),r.default||p.unixSocket?p.socksProxy=void 0:p.socksProxy===void 0&&typeof Re<"u"&&(p.socksProxy=Re.env.MQTTJS_SOCKS_PROXY),p.cert&&p.key)if(p.protocol){if(["mqtts","wss","wxs","alis"].indexOf(p.protocol)===-1)switch(p.protocol){case"mqtt":p.protocol="mqtts";break;case"ws":p.protocol="wss";break;case"wx":p.protocol="wxs";break;case"ali":p.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${p.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(n||(n={},!r.default&&!p.forceNativeWebSocket?(n.ws=Zt().streamBuilder,n.wss=Zt().streamBuilder,n.mqtt=Zo().default,n.tcp=Zo().default,n.ssl=es().default,n.tls=n.ssl,n.mqtts=es().default):(n.ws=Zt().browserStreamBuilder,n.wss=Zt().browserStreamBuilder,n.wx=ts().default,n.wxs=ts().default,n.ali=rs().default,n.alis=rs().default)),!n[p.protocol]){let y=["mqtts","wss"].indexOf(p.protocol)!==-1;p.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((b,S)=>y&&S%2===0?!1:typeof n[b]=="function")[0]}if(p.clean===!1&&!p.clientId)throw new Error("Missing clientId for unclean clients");p.protocol&&(p.defaultProtocol=p.protocol);function m(y){return p.servers&&((!y._reconnectCount||y._reconnectCount===p.servers.length)&&(y._reconnectCount=0),p.host=p.servers[y._reconnectCount].host,p.port=p.servers[y._reconnectCount].port,p.protocol=p.servers[y._reconnectCount].protocol?p.servers[y._reconnectCount].protocol:p.defaultProtocol,p.hostname=p.host,y._reconnectCount++),t("calling streambuilder for",p.protocol),n[p.protocol](y,p)}let c=new f.default(m,p);return c.on("error",()=>{}),c}function a(d,p,m=!0){return new Promise((c,y)=>{let b=i(d,p),S={connect:_=>{h(),c(b)},end:()=>{h(),c(b)},error:_=>{h(),b.end(),y(_)}};m===!1&&(S.close=()=>{S.error(new Error("Couldn't connect to server"))});function h(){Object.keys(S).forEach(_=>{b.off(_,S[_])})}Object.keys(S).forEach(_=>{b.on(_,S[_])})})}g.default=i}),ns=de(g=>{le(),ce(),ue();var u=g&&g.__createBinding||(Object.create?function(m,c,y,b){b===void 0&&(b=y);var S=Object.getOwnPropertyDescriptor(c,y);(!S||("get"in S?!c.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return c[y]}}),Object.defineProperty(m,b,S)}:function(m,c,y,b){b===void 0&&(b=y),m[b]=c[y]}),o=g&&g.__setModuleDefault||(Object.create?function(m,c){Object.defineProperty(m,"default",{enumerable:!0,value:c})}:function(m,c){m.default=c}),s=g&&g.__importStar||(function(){var m=function(c){return m=Object.getOwnPropertyNames||function(y){var b=[];for(var S in y)Object.prototype.hasOwnProperty.call(y,S)&&(b[b.length]=S);return b},m(c)};return function(c){if(c&&c.__esModule)return c;var y={};if(c!=null)for(var b=m(c),S=0;S<b.length;S++)b[S]!=="default"&&u(y,c,b[S]);return o(y,c),y}})(),f=g&&g.__exportStar||function(m,c){for(var y in m)y!=="default"&&!Object.prototype.hasOwnProperty.call(c,y)&&u(c,m,y)},r=g&&g.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(g,"__esModule",{value:!0}),g.ReasonCodes=g.KeepaliveManager=g.UniqueMessageIdProvider=g.DefaultMessageIdProvider=g.Store=g.MqttClient=g.connectAsync=g.connect=g.Client=void 0;var t=r(Vn());g.MqttClient=t.default;var n=r(Ys());g.DefaultMessageIdProvider=n.default;var e=r(Zl());g.UniqueMessageIdProvider=e.default;var i=r(Ms());g.Store=i.default;var a=s(Wu());g.connect=a.default,Object.defineProperty(g,"connectAsync",{enumerable:!0,get:function(){return a.connectAsync}});var d=r(na());g.KeepaliveManager=d.default,g.Client=t.default,f(Vn(),g),f(Nt(),g),f(Cs(),g);var p=Pr();Object.defineProperty(g,"ReasonCodes",{enumerable:!0,get:function(){return p.ReasonCodes}})}),qu=de(g=>{le(),ce(),ue();var u=g&&g.__createBinding||(Object.create?function(t,n,e,i){i===void 0&&(i=e);var a=Object.getOwnPropertyDescriptor(n,e);(!a||("get"in a?!n.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return n[e]}}),Object.defineProperty(t,i,a)}:function(t,n,e,i){i===void 0&&(i=e),t[i]=n[e]}),o=g&&g.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),s=g&&g.__importStar||(function(){var t=function(n){return t=Object.getOwnPropertyNames||function(e){var i=[];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(i[i.length]=a);return i},t(n)};return function(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var i=t(n),a=0;a<i.length;a++)i[a]!=="default"&&u(e,n,i[a]);return o(e,n),e}})(),f=g&&g.__exportStar||function(t,n){for(var e in t)e!=="default"&&!Object.prototype.hasOwnProperty.call(n,e)&&u(n,t,e)};Object.defineProperty(g,"__esModule",{value:!0});var r=s(ns());g.default=r,f(ns(),g)});const $u=qu();class Hu{client=null;config;messageHandlers=[];stateHandlers=[];subscribedTopics=new Set;reconnectAttempt=0;maxReconnectAttempts=10;disposed=!1;constructor(u){this.config=u}async connect(){if(this.disposed)return;const u={clientId:`aikaara_${this.config.userId}_${Date.now()}`,username:this.config.userId,password:this.config.jwtToken,clean:!0,reconnectPeriod:0,connectTimeout:1e4,protocolVersion:4};return new Promise((o,s)=>{this.client=$u.connect(this.config.mqttEndpoint,u),this.client.on("connect",()=>{this.reconnectAttempt=0,this.notifyStateChange(!0),o()}),this.client.on("message",(f,r)=>{try{const t=JSON.parse(r.toString());this.messageHandlers.forEach(n=>n(t))}catch{}}),this.client.on("close",()=>{this.notifyStateChange(!1),this.disposed||this.scheduleReconnect()}),this.client.on("error",f=>{this.reconnectAttempt===0&&s(f)})})}subscribeToConversation(u){const o=`/apps/tilechat/users/${this.config.userId}/${u}/messages/clientadded`;this.client&&!this.subscribedTopics.has(o)&&(this.client.subscribe(o),this.subscribedTopics.add(o))}unsubscribeFromConversation(u){const o=`/apps/tilechat/users/${this.config.userId}/${u}/messages/clientadded`;this.client&&this.subscribedTopics.has(o)&&(this.client.unsubscribe(o),this.subscribedTopics.delete(o))}publishMessage(u,o){if(!this.client)return;const s={text:o,type:"text",sender:this.config.userId,senderFullname:this.config.userName||this.config.userId,recipient:u,timestamp:Date.now()},f=`/apps/tilechat/outgoing/users/${this.config.userId}/${u}/messages`;this.client.publish(f,JSON.stringify(s))}onMessage(u){return this.messageHandlers.push(u),()=>{this.messageHandlers=this.messageHandlers.filter(o=>o!==u)}}onStateChange(u){return this.stateHandlers.push(u),()=>{this.stateHandlers=this.stateHandlers.filter(o=>o!==u)}}disconnect(){this.disposed=!0,this.client&&(this.subscribedTopics.forEach(u=>this.client.unsubscribe(u)),this.subscribedTopics.clear(),this.client.end(!0),this.client=null),this.messageHandlers=[],this.stateHandlers=[]}get isConnected(){return this.client?.connected??!1}scheduleReconnect(){if(this.reconnectAttempt>=this.maxReconnectAttempts||this.disposed)return;const u=Math.min(1e3*Math.pow(2,this.reconnectAttempt),3e4);this.reconnectAttempt++,setTimeout(async()=>{if(!this.disposed)try{await this.connect();const o=[...this.subscribedTopics];this.subscribedTopics.clear(),o.forEach(s=>{this.client&&(this.client.subscribe(s),this.subscribedTopics.add(s))})}catch{}},u)}notifyStateChange(u){this.stateHandlers.forEach(o=>o(u))}}exports.ActionCableClient=lt.ActionCableClient;exports.AikaaraChatClient=lt.AikaaraChatClient;exports.ApiClient=lt.ApiClient;exports.ChannelSubscription=lt.ChannelSubscription;exports.ConnectionManager=lt.ConnectionManager;exports.ConversationManager=lt.ConversationManager;exports.EventEmitter=lt.EventEmitter;exports.MessageStore=lt.MessageStore;exports.FormBridge=Na;exports.TiledeskTransport=Hu;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./ui-B0-Np9Dn.cjs");class x extends s.EventEmitter{registration=null;pendingEdits=[];constructor(e){super(),this.setupListeners(e)}registerForm(e){this.registration=e;const r=this.pendingEdits.filter(i=>i.entity_type===e.entityType&&String(i.entity_id)===String(e.entityId));if(r.length>0){for(const i of r)e.onFieldUpdate(i.fields),this.emit("edit:applied",{entityType:i.entity_type,entityId:i.entity_id,fields:i.fields});this.pendingEdits=this.pendingEdits.filter(i=>!(i.entity_type===e.entityType&&String(i.entity_id)===String(e.entityId)))}}unregisterForm(e,r){this.registration?.entityType===e&&String(this.registration?.entityId)===String(r)&&(this.registration=null)}get currentForm(){return this.registration}pushFieldUpdates(e,r,i){this.registration&&this.registration.entityType===e&&String(this.registration.entityId)===String(r)?(this.registration.onFieldUpdate(i),this.emit("edit:applied",{entityType:e,entityId:r,fields:i})):(this.pendingEdits.push({action:"edit_entity",entity_type:e,entity_id:r,fields:i}),this.emit("edit:pending",{entityType:e,entityId:r,fields:i}))}async requestSave(){if(!this.registration)return{success:!1,error:"No form registered"};try{return await this.registration.onSave(),this.emit("save:success",{entityType:this.registration.entityType,entityId:this.registration.entityId}),{success:!0}}catch(e){const r=e instanceof Error?e.message:"Save failed";return this.emit("save:error",{entityType:this.registration.entityType,entityId:this.registration.entityId,error:r}),{success:!1,error:r}}}async requestTest(e){if(!this.registration?.onTest)return{success:!1,error:"Current form does not support testing"};try{return await this.registration.onTest(e),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:"Test failed"}}}setupListeners(e){e.on("action:edit_entity",r=>{this.pushFieldUpdates(r.entity_type,r.entity_id,r.fields)}),e.on("action:save_entity",r=>{this.requestSave()}),e.on("action:test_tool",r=>{this.emit("test:triggered",{toolId:r.tool_id,parameters:r.parameters}),this.requestTest(r.parameters)})}}function I(t){return{async upload(e,r){const i=new FormData,o=t.fieldName??"file";i.append(o,e,e.name);const a=typeof t.extraFields=="function"?t.extraFields(r):t.extraFields;if(a)for(const[h,f]of Object.entries(a))i.append(h,f);i.append("conversationId",r.conversationId),i.append("userId",r.userId),r.projectId&&i.append("projectId",r.projectId);const d=typeof t.headers=="function"?await t.headers():t.headers??{},u=await fetch(t.endpoint,{method:t.method??"POST",body:i,headers:d,credentials:t.credentials});if(!u.ok)throw new Error(`Upload failed: ${u.status} ${u.statusText}`);const l=await u.json().catch(()=>({}));if(t.parseResponse)return t.parseResponse(l,r);const n=l,c=n.url??n.fileUrl??n.publicUrl,y=n.fileName??n.name??e.name;if(!c)throw new Error('Upload response missing "url" / "fileUrl" / "publicUrl"');return{url:c,fileName:y,cloudFileId:typeof n.cloudFileId=="string"?n.cloudFileId:void 0,relativePath:typeof n.path=="string"?n.path:void 0,contentType:typeof n.contentType=="string"?n.contentType:void 0,byteSize:typeof n.byteSize=="number"?n.byteSize:void 0,meta:n}}}}const S="/tilechat/{userId}/conversations/{conversationId}/messages?pageSize={pageSize}";function T(t){const e=t.apiBase.replace(/\/$/,""),r=t.pageSize??200,i=t.pathTemplate??S;return{async fetchMessages(o,a){const d=i.replace("{userId}",encodeURIComponent(a.userId)).replace("{conversationId}",encodeURIComponent(o)).replace("{appId}",encodeURIComponent(a.appId??"tilechat")).replace("{projectId}",encodeURIComponent(a.projectId??"")).replace("{pageSize}",String(r)),u=d.startsWith("http")?d:`${e}${d.startsWith("/")?d:`/${d}`}`,l={accept:"application/json","content-type":"application/json",...t.extraHeaders??{}};if(t.getToken){const h=await t.getToken();h&&(l.authorization=h)}const n=await fetch(u,{method:"GET",headers:l,credentials:"include"}),c=await n.json().catch(()=>null);if(t.parseResponse&&c)return t.parseResponse(c);const y=c;if(y&&Array.isArray(y.result))return y.result;if(!n.ok)throw new Error(`History fetch failed: ${n.status} ${n.statusText}`);return[]}}}function w(){const t=typeof crypto<"u"?crypto:null;if(t?.randomUUID)return t.randomUUID();if(t?.getRandomValues){const e=new Uint8Array(16);t.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=[...e].map(i=>i.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}const k="aikaara_chat:requestId";function g(t,e){return`${k}:${t}:${e}`}function b(t,e){try{return localStorage.getItem(g(t,e))}catch{return null}}function E(t,e,r){try{localStorage.setItem(g(t,e),r)}catch{}}function A(t,e){try{localStorage.removeItem(g(t,e))}catch{}}async function C(t,e){const r=await fetch(t,{method:"GET",headers:{accept:"application/json",...e??{}}});if(!r.ok){const o=await r.text().catch(()=>"");throw new Error(`Widget config fetch failed: ${r.status} ${r.statusText} ${o.slice(0,200)}`)}const i=await r.json();if(i&&typeof i=="object"){if("config"in i)return i.config;if("data"in i)return i.data}return i}function F(t,e){return t.replace("{projectId}",e).replace("{uuid}",w().replace(/-/g,""))}async function U(t){const e={...t.config??(t.configUrl?await C(t.configUrl,t.configHeaders):{}),...t.overrides??{}},r=e.transport??"tiledesk",i=e.tiledesk;if((r==="tiledesk"||r==="dual")&&!i)throw new Error("mount: descriptor.tiledesk is required for tiledesk/dual transport");const o=i?.projectId??"",a=t.identity.userId,d=t.forceNewConversation?null:b(a,o),u=i?.requestIdTemplate??"support-group-{projectId}-{uuid}",l=t.conversationId??d??F(u,o);(!d||t.forceNewConversation)&&o&&E(a,o,l);const n=await t.tokenProvider(),c=t.tokenProvider,y=t.historyTokenProvider??c,h=i?{mqttEndpoint:i.mqttEndpoint,jwtToken:n,userId:a,userName:t.identity.userName,projectId:i.projectId,appId:i.appId,mqttUsername:i.mqttUsername,protocolId:i.protocolId,protocolVersion:i.protocolVersion,keepAliveSec:i.keepAliveSec,connectTimeoutMs:i.connectTimeoutMs,maxReconnectAttempts:i.maxReconnectAttempts,reconnectMaxDelayMs:i.reconnectMaxDelayMs,wildcardSubscribe:i.wildcardSubscribe,enablePresence:i.enablePresence,autoInitiateOnEmpty:i.autoInitiateOnEmpty,chatInitiatedAttributes:i.chatInitiatedAttributes,messageDefaults:{...i.messageDefaults,...t.identity.departmentId?{departmentId:t.identity.departmentId}:i.messageDefaults?.departmentId?{departmentId:i.messageDefaults.departmentId}:{}},fileTemplate:i.fileTemplate,topicTemplates:i.topicTemplates,debug:i.debug,senderFullname:t.identity.senderFullname??t.identity.userName,tokenProvider:c}:void 0,f=t.uploadAdapter??(e.uploadEndpoint?I({endpoint:e.uploadEndpoint,fieldName:e.uploadFieldName,extraFields:e.uploadExtraFields}):void 0),v=t.historyAdapter??(e.historyApiBase?T({apiBase:e.historyApiBase,pageSize:e.historyPageSize??200,pathTemplate:e.historyPathTemplate,getToken:y}):void 0),p={transport:r,baseUrl:"",userToken:a,conversationId:l,display:e.display??"embed",position:e.position,primaryColor:e.primaryColor,title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,width:e.width,height:e.height,borderRadius:e.borderRadius,fontFamily:e.fontFamily,welcomeMessage:e.welcomeMessage,placeholder:e.placeholder,showTimestamps:e.showTimestamps,persistConversation:e.persistConversation,tiledesk:h,tiledeskIdentity:{userId:a,userName:t.identity.userName,departmentId:t.identity.departmentId,senderFullname:t.identity.senderFullname??t.identity.userName},templateActionAttributes:e.templateActionAttributes,uploadAdapter:f,historyAdapter:v,onError:t.onError},m=document.createElement("aikaara-chat-widget");return m.configure(p),p.title&&m.setAttribute("title",p.title),p.primaryColor&&m.setAttribute("primary-color",p.primaryColor),p.display&&m.setAttribute("display",p.display),p.display==="embed"&&(m.style.cssText="display:flex;flex-direction:column;width:100%;height:100%;min-height:0;"),t.container.appendChild(m),{widget:m,requestId:l,config:p,destroy(){m.remove()}}}exports.ActionCableClient=s.ActionCableClient;exports.AikaaraChatClient=s.AikaaraChatClient;exports.ApiClient=s.ApiClient;exports.ChannelSubscription=s.ChannelSubscription;exports.ConnectionManager=s.ConnectionManager;exports.ConversationManager=s.ConversationManager;exports.EventEmitter=s.EventEmitter;exports.MessageStore=s.MessageStore;exports.TiledeskTransport=s.TiledeskTransport;exports.extractTiledeskFileEnvelope=s.extractTiledeskFileEnvelope;exports.inferTiledeskRole=s.inferTiledeskRole;exports.isTiledeskSelfEcho=s.isTiledeskSelfEcho;exports.parseTiledeskTemplate=s.parseTiledeskTemplate;exports.FormBridge=x;exports.clearPersistedConversationId=A;exports.createFetchUploadAdapter=I;exports.createTiledeskHistoryAdapter=T;exports.mountTenantWidget=U;