@liascript/exporter 2.6.40--0.17.2 → 2.6.41--0.17.2
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/assets/capacitor/index.46046734.js +2 -0
- package/dist/assets/capacitor/index.86d74a0c.js +3 -0
- package/dist/assets/capacitor/index.b5aed5b7.js +1 -0
- package/dist/assets/capacitor/index.dc0d877e.js +1 -0
- package/dist/assets/capacitor/index.html +1 -1
- package/dist/assets/capacitor/trystero-mqtt.min.6d9c6703.js +1 -0
- package/dist/assets/capacitor/trystero-mqtt.min.e0182753.js +1 -0
- package/dist/assets/capacitor/trystero-nostr.min.2980a983.js +1 -0
- package/dist/assets/capacitor/trystero-nostr.min.d5bf7194.js +1 -0
- package/dist/assets/capacitor/trystero-torrent.min.9a850ad2.js +1 -0
- package/dist/assets/capacitor/trystero-torrent.min.efe48994.js +1 -0
- package/dist/assets/indexeddb/index.57fae40d.js +1 -0
- package/dist/assets/indexeddb/index.b5aed5b7.js +1 -0
- package/dist/assets/indexeddb/index.c00f6c31.js +1 -0
- package/dist/assets/indexeddb/index.dc0d877e.js +1 -0
- package/dist/assets/indexeddb/index.html +1 -1
- package/dist/assets/indexeddb/trystero-mqtt.min.6d9c6703.js +1 -0
- package/dist/assets/indexeddb/trystero-mqtt.min.e0182753.js +1 -0
- package/dist/assets/indexeddb/trystero-nostr.min.2980a983.js +1 -0
- package/dist/assets/indexeddb/trystero-nostr.min.d5bf7194.js +1 -0
- package/dist/assets/indexeddb/trystero-torrent.min.9a850ad2.js +1 -0
- package/dist/assets/indexeddb/trystero-torrent.min.efe48994.js +1 -0
- package/dist/assets/pdf/index.2b68bcde.js +1 -0
- package/dist/assets/pdf/index.87cd0e1f.js +1 -0
- package/dist/assets/pdf/index.990b9637.js +1 -0
- package/dist/assets/pdf/index.b568f8ce.js +1 -0
- package/dist/assets/pdf/index.html +1 -1
- package/dist/assets/pdf/jszip.min.19c66d77.js +13 -0
- package/dist/assets/scorm1.2/index.2c8361f8.js +1 -0
- package/dist/assets/scorm1.2/index.b5aed5b7.js +1 -0
- package/dist/assets/scorm1.2/index.dc0d877e.js +1 -0
- package/dist/assets/scorm1.2/index.e41eeaf5.js +1 -0
- package/dist/assets/scorm1.2/index.html +1 -1
- package/dist/assets/scorm1.2/trystero-mqtt.min.6d9c6703.js +1 -0
- package/dist/assets/scorm1.2/trystero-mqtt.min.e0182753.js +1 -0
- package/dist/assets/scorm1.2/trystero-nostr.min.2980a983.js +1 -0
- package/dist/assets/scorm1.2/trystero-nostr.min.d5bf7194.js +1 -0
- package/dist/assets/scorm1.2/trystero-torrent.min.9a850ad2.js +1 -0
- package/dist/assets/scorm1.2/trystero-torrent.min.efe48994.js +1 -0
- package/dist/assets/scorm2004/SCORM2004.b05ecf91.js +1 -0
- package/dist/assets/scorm2004/SCORM2004.dc46cb61.js +1 -0
- package/dist/assets/scorm2004/index.81e0d7d5.js +1 -0
- package/dist/assets/scorm2004/index.92824222.js +1 -0
- package/dist/assets/scorm2004/index.b5aed5b7.js +1 -0
- package/dist/assets/scorm2004/index.dc0d877e.js +1 -0
- package/dist/assets/scorm2004/index.html +1 -1
- package/dist/assets/scorm2004/jszip.min.19c66d77.js +13 -0
- package/dist/assets/scorm2004/trystero-mqtt.min.6d9c6703.js +1 -0
- package/dist/assets/scorm2004/trystero-mqtt.min.e0182753.js +1 -0
- package/dist/assets/scorm2004/trystero-nostr.min.2980a983.js +1 -0
- package/dist/assets/scorm2004/trystero-nostr.min.d5bf7194.js +1 -0
- package/dist/assets/scorm2004/trystero-torrent.min.9a850ad2.js +1 -0
- package/dist/assets/scorm2004/trystero-torrent.min.efe48994.js +1 -0
- package/dist/assets/web/index.3731b339.js +1 -0
- package/dist/assets/web/index.60ae0439.js +1 -0
- package/dist/assets/web/index.b5aed5b7.js +1 -0
- package/dist/assets/web/index.dc0d877e.js +1 -0
- package/dist/assets/web/index.html +1 -1
- package/dist/assets/web/jszip.min.63142cc8.js +13 -0
- package/dist/assets/web/trystero-mqtt.min.6d9c6703.js +1 -0
- package/dist/assets/web/trystero-mqtt.min.e0182753.js +1 -0
- package/dist/assets/web/trystero-nostr.min.2980a983.js +1 -0
- package/dist/assets/web/trystero-nostr.min.d5bf7194.js +1 -0
- package/dist/assets/web/trystero-torrent.min.9a850ad2.js +1 -0
- package/dist/assets/web/trystero-torrent.min.efe48994.js +1 -0
- package/dist/assets/xapi/index.a011f589.js +1 -0
- package/dist/assets/xapi/index.b5aed5b7.js +1 -0
- package/dist/assets/xapi/index.cbea2dcb.js +1 -0
- package/dist/assets/xapi/index.dc0d877e.js +1 -0
- package/dist/assets/xapi/index.html +1 -1
- package/dist/assets/xapi/trystero-mqtt.min.6d9c6703.js +1 -0
- package/dist/assets/xapi/trystero-mqtt.min.e0182753.js +1 -0
- package/dist/assets/xapi/trystero-nostr.min.2980a983.js +1 -0
- package/dist/assets/xapi/trystero-nostr.min.d5bf7194.js +1 -0
- package/dist/assets/xapi/trystero-torrent.min.9a850ad2.js +1 -0
- package/dist/assets/xapi/trystero-torrent.min.efe48994.js +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/assets/capacitor/index.1ab7546b.js +0 -3
- package/dist/assets/capacitor/index.5d64fecf.js +0 -1
- package/dist/assets/capacitor/index.9c8d301a.js +0 -1
- package/dist/assets/capacitor/index.b0296e15.js +0 -2
- package/dist/assets/capacitor/trystero-mqtt.min.6e40f6de.js +0 -1
- package/dist/assets/capacitor/trystero-mqtt.min.a2199647.js +0 -1
- package/dist/assets/capacitor/trystero-nostr.min.765a883b.js +0 -1
- package/dist/assets/capacitor/trystero-nostr.min.fe4ac2f4.js +0 -1
- package/dist/assets/capacitor/trystero-torrent.min.d39641f1.js +0 -1
- package/dist/assets/capacitor/trystero-torrent.min.dbd208ec.js +0 -1
- package/dist/assets/indexeddb/index.10a81eac.js +0 -1
- package/dist/assets/indexeddb/index.5d64fecf.js +0 -1
- package/dist/assets/indexeddb/index.7fcdfa74.js +0 -1
- package/dist/assets/indexeddb/index.9c8d301a.js +0 -1
- package/dist/assets/indexeddb/trystero-mqtt.min.6e40f6de.js +0 -1
- package/dist/assets/indexeddb/trystero-mqtt.min.a2199647.js +0 -1
- package/dist/assets/indexeddb/trystero-nostr.min.765a883b.js +0 -1
- package/dist/assets/indexeddb/trystero-nostr.min.fe4ac2f4.js +0 -1
- package/dist/assets/indexeddb/trystero-torrent.min.d39641f1.js +0 -1
- package/dist/assets/indexeddb/trystero-torrent.min.dbd208ec.js +0 -1
- package/dist/assets/pdf/index.4c925f39.js +0 -1
- package/dist/assets/pdf/index.5493b5c3.js +0 -1
- package/dist/assets/pdf/index.54d437aa.js +0 -1
- package/dist/assets/pdf/index.84a3e762.js +0 -1
- package/dist/assets/pdf/jszip.min.eaecf580.js +0 -13
- package/dist/assets/scorm1.2/index.5d64fecf.js +0 -1
- package/dist/assets/scorm1.2/index.9c8d301a.js +0 -1
- package/dist/assets/scorm1.2/index.a1d98fe8.js +0 -1
- package/dist/assets/scorm1.2/index.fb6f86f8.js +0 -1
- package/dist/assets/scorm1.2/trystero-mqtt.min.6e40f6de.js +0 -1
- package/dist/assets/scorm1.2/trystero-mqtt.min.a2199647.js +0 -1
- package/dist/assets/scorm1.2/trystero-nostr.min.765a883b.js +0 -1
- package/dist/assets/scorm1.2/trystero-nostr.min.fe4ac2f4.js +0 -1
- package/dist/assets/scorm1.2/trystero-torrent.min.d39641f1.js +0 -1
- package/dist/assets/scorm1.2/trystero-torrent.min.dbd208ec.js +0 -1
- package/dist/assets/scorm2004/SCORM2004.9a05bfd8.js +0 -1
- package/dist/assets/scorm2004/SCORM2004.f751d884.js +0 -1
- package/dist/assets/scorm2004/index.163a95f1.js +0 -1
- package/dist/assets/scorm2004/index.374c449f.js +0 -1
- package/dist/assets/scorm2004/index.5d64fecf.js +0 -1
- package/dist/assets/scorm2004/index.9c8d301a.js +0 -1
- package/dist/assets/scorm2004/jszip.min.eaecf580.js +0 -13
- package/dist/assets/scorm2004/trystero-mqtt.min.6e40f6de.js +0 -1
- package/dist/assets/scorm2004/trystero-mqtt.min.a2199647.js +0 -1
- package/dist/assets/scorm2004/trystero-nostr.min.765a883b.js +0 -1
- package/dist/assets/scorm2004/trystero-nostr.min.fe4ac2f4.js +0 -1
- package/dist/assets/scorm2004/trystero-torrent.min.d39641f1.js +0 -1
- package/dist/assets/scorm2004/trystero-torrent.min.dbd208ec.js +0 -1
- package/dist/assets/web/index.5d64fecf.js +0 -1
- package/dist/assets/web/index.9c8d301a.js +0 -1
- package/dist/assets/web/index.c4e6ed4e.js +0 -1
- package/dist/assets/web/index.dae2afac.js +0 -1
- package/dist/assets/web/jszip.min.4fbcc13f.js +0 -13
- package/dist/assets/web/trystero-mqtt.min.6e40f6de.js +0 -1
- package/dist/assets/web/trystero-mqtt.min.a2199647.js +0 -1
- package/dist/assets/web/trystero-nostr.min.765a883b.js +0 -1
- package/dist/assets/web/trystero-nostr.min.fe4ac2f4.js +0 -1
- package/dist/assets/web/trystero-torrent.min.d39641f1.js +0 -1
- package/dist/assets/web/trystero-torrent.min.dbd208ec.js +0 -1
- package/dist/assets/xapi/index.5d64fecf.js +0 -1
- package/dist/assets/xapi/index.9c8d301a.js +0 -1
- package/dist/assets/xapi/index.e19ea3b2.js +0 -1
- package/dist/assets/xapi/index.f9fadbb3.js +0 -1
- package/dist/assets/xapi/trystero-mqtt.min.6e40f6de.js +0 -1
- package/dist/assets/xapi/trystero-mqtt.min.a2199647.js +0 -1
- package/dist/assets/xapi/trystero-nostr.min.765a883b.js +0 -1
- package/dist/assets/xapi/trystero-nostr.min.fe4ac2f4.js +0 -1
- package/dist/assets/xapi/trystero-torrent.min.d39641f1.js +0 -1
- package/dist/assets/xapi/trystero-torrent.min.dbd208ec.js +0 -1
- /package/dist/assets/{web → capacitor}/jszip.min.19c66d77.js +0 -0
- /package/dist/assets/{indexeddb → capacitor}/jszip.min.4fbcc13f.js +0 -0
- /package/dist/assets/{xapi → indexeddb}/jszip.min.19c66d77.js +0 -0
- /package/dist/assets/{capacitor → indexeddb}/jszip.min.63142cc8.js +0 -0
- /package/dist/assets/{scorm1.2 → pdf}/jszip.min.63142cc8.js +0 -0
- /package/dist/assets/{pdf → scorm1.2}/jszip.min.4fbcc13f.js +0 -0
- /package/dist/assets/{xapi → scorm2004}/jszip.min.63142cc8.js +0 -0
- /package/dist/assets/{capacitor → web}/jszip.min.eaecf580.js +0 -0
- /package/dist/assets/{scorm2004 → xapi}/jszip.min.4fbcc13f.js +0 -0
- /package/dist/assets/{indexeddb → xapi}/jszip.min.eaecf580.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function t(e,t,r,i){Object.defineProperty(e,t,{get:r,set:i,enumerable:!0,configurable:!0})}var r=e.parcelRequire55a5;r.register("i0BT1",(function(i,n){t(i.exports,"joinRoom",(function(){return Ms}));var o,s,a,l,u,h,c,f,d,p,g,b,m=r("e963W"),y=r("lvOWe"),v=r("ezKE5"),w=r("dpALB"),_=r("1VQD5"),E=r("cJcuy"),S=r("5F6LX"),A=r("gsBWm"),k=r("2Xs1f"),I=r("dM3DM"),T=r("aQXMn"),P=r("dCZQ6"),C=Object.defineProperty,R=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,B={}.hasOwnProperty,x=(e,t)=>()=>(e&&(t=e(e=0)),t),M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),L=(e,t)=>{for(var r in t)C(e,r,{get:t[r],enumerable:!0})},U=e=>((e,t,r,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of O(t))!B.call(e,r)&&void 0!==r&&C(e,r,{get:()=>t[r],enumerable:!(i=R(t,r))||i.enumerable});return e})(C({},"__esModule",{value:!0}),e),j=x((()=>{})),N={};function D(e){throw Error("Node.js process "+e+" is not supported by JSPM core outside of Node.js")}function W(){!re||!ie||(re=!1,ie.length?te=ie.concat(te):ne=-1,te.length&&F())}function F(){if(!re){var e=setTimeout(W,0);re=!0;for(var t=te.length;t;){for(ie=te,te=[];++ne<t;)ie&&ie[ne].run();ne=-1,t=te.length}ie=null,re=!1,clearTimeout(e)}}function q(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];te.push(new $(e,t)),1===te.length&&!re&&setTimeout(F,0)}function $(e,t){this.fun=e,this.array=t}function H(){}function V(){D("_linkedBinding")}function z(){D("dlopen")}function K(){return[]}function G(){return[]}function Q(e,t){if(!e)throw Error(t||"assertion error")}function Y(){return!1}function J(){return Xe.now()/1e3}function X(e){var t=Math.floor(.001*(Date.now()-Xe.now())),r=.001*Xe.now(),i=Math.floor(r)+t,n=Math.floor(r%1*1e9);return e&&(i-=e[0],(n-=e[1])<0&&(i--,n+=et)),[i,n]}function Z(){return ft}function ee(){return[]}L(N,{_debugEnd:()=>Ne,_debugProcess:()=>je,_events:()=>rt,_eventsCount:()=>it,_exiting:()=>Ee,_fatalExceptions:()=>Me,_getActiveHandles:()=>G,_getActiveRequests:()=>K,_kill:()=>ke,_linkedBinding:()=>V,_maxListeners:()=>tt,_preload_modules:()=>Ye,_rawDebug:()=>ve,_startProfilerIdleNotifier:()=>De,_stopProfilerIdleNotifier:()=>We,_tickCallback:()=>Ue,abort:()=>He,addListener:()=>nt,allowedNodeEnvironmentFlags:()=>Be,arch:()=>se,argv:()=>ue,argv0:()=>Qe,assert:()=>Q,binding:()=>pe,chdir:()=>me,config:()=>Se,cpuUsage:()=>Ie,cwd:()=>be,debugPort:()=>Ge,default:()=>ft,dlopen:()=>z,domain:()=>_e,emit:()=>ut,emitWarning:()=>de,env:()=>le,execArgv:()=>he,execPath:()=>Ke,exit:()=>Re,features:()=>xe,hasUncaughtExceptionCaptureCallback:()=>Y,hrtime:()=>X,kill:()=>Ce,listeners:()=>ee,memoryUsage:()=>Pe,moduleLoadList:()=>we,nextTick:()=>q,off:()=>st,on:()=>Z,once:()=>ot,openStdin:()=>Oe,pid:()=>Ve,platform:()=>ae,ppid:()=>ze,prependListener:()=>ht,prependOnceListener:()=>ct,reallyExit:()=>Ae,release:()=>ye,removeAllListeners:()=>lt,removeListener:()=>at,resourceUsage:()=>Te,setSourceMapsEnabled:()=>Je,setUncaughtExceptionCaptureCallback:()=>Le,stderr:()=>qe,stdin:()=>$e,stdout:()=>Fe,title:()=>oe,umask:()=>ge,uptime:()=>J,version:()=>ce,versions:()=>fe});var te,re,ie,ne,oe,se,ae,le,ue,he,ce,fe,de,pe,ge,be,me,ye,ve,we,_e,Ee,Se,Ae,ke,Ie,Te,Pe,Ce,Re,Oe,Be,xe,Me,Le,Ue,je,Ne,De,We,Fe,qe,$e,He,Ve,ze,Ke,Ge,Qe,Ye,Je,Xe,Ze,et,tt,rt,it,nt,ot,st,at,lt,ut,ht,ct,ft,dt=x((()=>{j(),Pt(),pt(),te=[],re=!1,ne=-1,$.prototype.run=function(){this.fun.apply(null,this.array)},oe="browser",se="x64",ae="browser",le={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},ue=["/usr/bin/node"],he=[],ce="v16.8.0",fe={},de=(e,t)=>{console.warn((t?t+": ":"")+e)},pe=()=>{D("binding")},ge=()=>0,be=()=>"/",me=()=>{},ye={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},ve=H,we=[],_e={},Ee=!1,Se={},Ae=H,ke=H,Te=Ie=()=>({}),Pe=Ie,Ce=H,Re=H,Oe=H,Be={},xe={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Me=H,Le=H,Ue=H,je=H,Ne=H,De=H,We=H,Fe=void 0,qe=void 0,$e=void 0,He=H,Ve=2,ze=1,Ke="/bin/usr/node",Ge=9229,Qe="node",Ye=[],Je=H,void 0===(Xe={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0}).now&&(Ze=Date.now(),Xe.timing&&Xe.timing.navigationStart&&(Ze=Xe.timing.navigationStart),Xe.now=()=>Date.now()-Ze),et=1e9,X.bigint=e=>{var t=X(e);return typeof BigInt>"u"?t[0]*et+t[1]:BigInt(t[0]*et)+BigInt(t[1])},ft={version:ce,versions:fe,arch:se,platform:ae,release:ye,_rawDebug:ve,moduleLoadList:we,binding:pe,_linkedBinding:V,_events:rt={},_eventsCount:it=0,_maxListeners:tt=10,on:Z,addListener:nt=Z,once:ot=Z,off:st=Z,removeListener:at=Z,removeAllListeners:lt=Z,emit:ut=H,prependListener:ht=Z,prependOnceListener:ct=Z,listeners:ee,domain:_e,_exiting:Ee,config:Se,dlopen:z,uptime:J,_getActiveRequests:K,_getActiveHandles:G,reallyExit:Ae,_kill:ke,cpuUsage:Ie,resourceUsage:Te,memoryUsage:Pe,kill:Ce,exit:Re,openStdin:Oe,allowedNodeEnvironmentFlags:Be,assert:Q,features:xe,_fatalExceptions:Me,setUncaughtExceptionCaptureCallback:Le,hasUncaughtExceptionCaptureCallback:Y,emitWarning:de,nextTick:q,_tickCallback:Ue,_debugProcess:je,_debugEnd:Ne,_startProfilerIdleNotifier:De,_stopProfilerIdleNotifier:We,stdout:Fe,stdin:$e,stderr:qe,abort:He,umask:ge,chdir:me,cwd:be,env:le,title:oe,argv:ue,execArgv:he,pid:Ve,ppid:ze,execPath:Ke,debugPort:Ge,hrtime:X,argv0:Qe,_preload_modules:Ye,setSourceMapsEnabled:Je}})),pt=x((()=>{dt()})),gt={};function bt(){if(Et)return _t;Et=!0;let e=function(){if(yt)return mt;yt=!0,mt.byteLength=e=>{var t=o(e),r=t[0],i=t[1];return 3*(r+i)/4-i},mt.toByteArray=e=>{var i,n,s=o(e),a=s[0],l=s[1],u=new r(((e,t,r)=>3*(t+r)/4-r)(0,a,l)),h=0,c=l>0?a-4:a;for(n=0;n<c;n+=4)i=t[e.charCodeAt(n)]<<18|t[e.charCodeAt(n+1)]<<12|t[e.charCodeAt(n+2)]<<6|t[e.charCodeAt(n+3)],u[h++]=i>>16&255,u[h++]=i>>8&255,u[h++]=255&i;return 2===l&&(i=t[e.charCodeAt(n)]<<2|t[e.charCodeAt(n+1)]>>4,u[h++]=255&i),1===l&&(i=t[e.charCodeAt(n)]<<10|t[e.charCodeAt(n+1)]<<4|t[e.charCodeAt(n+2)]>>2,u[h++]=i>>8&255,u[h++]=255&i),u},mt.fromByteArray=t=>{for(var r,i=t.length,n=i%3,o=[],s=16383,l=0,u=i-n;l<u;l+=s)o.push(a(t,l,l+s>u?u:l+s));return 1===n?(r=t[i-1],o.push(e[r>>2]+e[r<<4&63]+"==")):2===n&&(r=(t[i-2]<<8)+t[i-1],o.push(e[r>>10]+e[r>>4&63]+e[r<<2&63]+"=")),o.join("")};for(var e=[],t=[],r=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0;n<64;++n)e[n]=i[n],t[i.charCodeAt(n)]=n;function o(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function s(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function a(e,t,r){for(var i,n=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),n.push(s(i));return n.join("")}return t[45]=62,t[95]=63,mt}(),t=(wt||(wt=!0,vt.read=(e,t,r,i,n)=>{var o,s,a=8*n-i-1,l=(1<<a)-1,u=l>>1,h=-7,c=r?n-1:0,f=r?-1:1,d=e[t+c];for(c+=f,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+e[t+c],c+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+e[t+c],c+=f,h-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=u}return(d?-1:1)*s*Math.pow(2,o-i)},vt.write=(e,t,r,i,n,o)=>{var s,a,l,u=8*o-n-1,h=(1<<u)-1,c=h>>1,f=23===n?5.960464477539062e-8:0,d=i?0:o-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(a=isNaN(t)?1:0,s=h):(t*(l=Math.pow(2,-(s=Math.floor(Math.log(t)/Math.LN2))))<1&&(s--,l*=2),(t+=s+c>=1?f/l:f*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(t*l-1)*Math.pow(2,n),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;e[r+d]=255&a,d+=p,a/=256,n-=8);for(s=s<<n|a,u+=n;u>0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*g}),vt),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;_t.Buffer=o,_t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},_t.INSPECT_MAX_BYTES=50;let i=2147483647;function n(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=0|f(e,t),i=n(r),s=i.write(e,t);return s!==r&&(i=i.slice(0,s)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(z(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(z(e,ArrayBuffer)||e&&z(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(z(e,SharedArrayBuffer)||e&&z(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return o.from(i,t,r);let s=function(e){if(o.isBuffer(e)){let t=0|c(e.length),r=n(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||K(e.length)?n(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(s)return s;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return a(e),n(e<0?0:0|c(e))}function u(e){let t=e.length<0?0:0|c(e.length),r=n(t);for(let i=0;i<t;i+=1)r[i]=255&e[i];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(i,o.prototype),i}function c(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(n)return i?-1:$(e).length;t=(""+t).toLowerCase(),n=!0}}function d(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function p(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function g(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),K(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=o.from(t,i)),o.isBuffer(t))return 0===t.length?-1:b(e,t,r,i,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,i,n){let o,s=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=(i+"").toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){let i=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===i?0:o-i)){if(-1===i&&(i=o),o-i+1===l)return i*s}else-1!==i&&(o-=o-i),i=-1}else for(r+l>a&&(r=a-l),o=r;o>=0;o--){let r=!0;for(let i=0;i<l;i++)if(u(e,o+i)!==u(t,i)){r=!1;break}if(r)return o}return-1}function m(e,t,r,i){r=Number(r)||0;let n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;let o,s=t.length;for(i>s/2&&(i=s/2),o=0;o<i;++o){let i=parseInt(t.substr(2*o,2),16);if(K(i))return o;e[r+o]=i}return o}function y(e,t,r,i){return V($(t,e.length-r),e,r,i)}function v(e,t,r,i){return V(function(e){let t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function w(e,t,r,i){return V(H(t),e,r,i)}function _(e,t,r,i){return V(function(e,t){let r,i,n,o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i);return o}(t,e.length-r),e,r,i)}function E(t,r,i){return 0===r&&i===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,i))}function S(e,t,r){r=Math.min(e.length,r);let i=[],n=t;for(;n<r;){let t=e[n],o=null,s=t>239?4:t>223?3:t>191?2:1;if(n+s<=r){let r,i,a,l;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[n+1],128==(192&r)&&(l=(31&t)<<6|63&r,l>127&&(o=l));break;case 3:r=e[n+1],i=e[n+2],128==(192&r)&&128==(192&i)&&(l=(15&t)<<12|(63&r)<<6|63&i,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:r=e[n+1],i=e[n+2],a=e[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(l=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),n+=s}return function(e){let t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=A));return r}(i)}_t.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:()=>42};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=(e,t,r)=>s(e,t,r),Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=(e,t,r)=>function(e,t,r){return a(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}(e,t,r),o.allocUnsafe=e=>l(e),o.allocUnsafeSlow=e=>l(e),o.isBuffer=e=>null!=e&&!0===e._isBuffer&&e!==o.prototype,o.compare=(e,t)=>{if(z(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),z(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},o.isEncoding=e=>{switch((e+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=(e,t)=>{if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;let i=o.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){let t=e[r];if(z(t,Uint8Array))n+t.length>i.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(i,n)):Uint8Array.prototype.set.call(i,t,n);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,n)}n+=t.length}return i},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)p(this,t,t+1);return this},o.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},o.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},o.prototype.toString=function(){let e=this.length;return 0===e?"":0===arguments.length?S(this,0,e):d.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="",t=_t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,r,i,n){if(z(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(t>>>=0),l=Math.min(s,a),u=this.slice(i,n),h=e.slice(t,r);for(let e=0;e<l;++e)if(u[e]!==h[e]){s=u[e],a=h[e];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},o.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}let n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":case"latin1":case"binary":return v(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:[].slice.call(this._arr||this,0)}};let A=4096;function k(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function I(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function T(e,t,r){let i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=t;i<r;++i)n+=G[e[i]];return n}function P(e,t,r){let i=e.slice(t,r),n="";for(let e=0;e<i.length-1;e+=2)n+=String.fromCharCode(i[e]+256*i[e+1]);return n}function C(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,i,n,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function O(e,t,r,i,n){D(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function B(e,t,r,i,n){D(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function x(e,t,r,i){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,r,i,n,o){return r=+r,i>>>=0,o||x(e,0,i,4),t.write(e,r,i,n,23,4),i+4}function L(e,r,i,n,o){return r=+r,i>>>=0,o||x(e,0,i,8),t.write(e,r,i,n,52,8),i+8}o.prototype.slice=function(e,t){let r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,o.prototype),i},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let i=this[e],n=1,o=0;for(;++o<t&&(n*=256);)i+=this[e+o]*n;return i},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let i=this[e+--t],n=1;for(;t>0&&(n*=256);)i+=this[e+--t]*n;return i},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Q((function(e){W(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&F(e,this.length-8);let i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(i)+(BigInt(n)<<BigInt(32))})),o.prototype.readBigUInt64BE=Q((function(e){W(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&F(e,this.length-8);let i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let i=this[e],n=1,o=0;for(;++o<t&&(n*=256);)i+=this[e+o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let i=t,n=1,o=this[e+--i];for(;i>0&&(n*=256);)o+=this[e+--i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Q((function(e){W(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&F(e,this.length-8);let i=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Q((function(e){W(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&F(e,this.length-8);let i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),o.prototype.readFloatLE=function(e,r){return e>>>=0,r||C(e,4,this.length),t.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,r){return e>>>=0,r||C(e,4,this.length),t.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,r){return e>>>=0,r||C(e,8,this.length),t.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,r){return e>>>=0,r||C(e,8,this.length),t.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||R(this,e,t,r,Math.pow(2,8*r)-1,0);let n=1,o=0;for(this[t]=255&e;++o<r&&(n*=256);)this[t+o]=e/n&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||R(this,e,t,r,Math.pow(2,8*r)-1,0);let n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Q((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Q((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){let i=Math.pow(2,8*r-1);R(this,e,t,r,i-1,-i)}let n=0,o=1,s=0;for(this[t]=255&e;++n<r&&(o*=256);)e<0&&0===s&&0!==this[t+n-1]&&(s=1),this[t+n]=(e/o|0)-s&255;return t+r},o.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){let i=Math.pow(2,8*r-1);R(this,e,t,r,i-1,-i)}let n=r-1,o=1,s=0;for(this[t+n]=255&e;--n>=0&&(o*=256);)e<0&&0===s&&0!==this[t+n+1]&&(s=1),this[t+n]=(e/o|0)-s&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Q((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Q((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,i){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&0!==i&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r||0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);let n=i-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),t),n},o.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){let t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{let s=o.isBuffer(e)?e:o.from(e,i),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=s[n%a]}return this};let U={};function j(e,t,r){U[e]=class extends r{get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}}}function N(e){let t="",r=e.length,i="-"===e[0]?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function D(e,t,r,i,n,o){if(e>r||e<t){let r,i="bigint"==typeof t?"n":"";throw r=0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`,new U.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,r){W(t,"offset"),(void 0===e[t]||void 0===e[t+r])&&F(t,e.length-(r+1))}(i,n,o)}function W(e,t){if("number"!=typeof e)throw new U.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,r){throw Math.floor(e)!==e?(W(e,r),new U.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE("offset",">= 0 and <= "+t,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(e=>e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"),RangeError),j("ERR_INVALID_ARG_TYPE",((e,t)=>`The "${e}" argument must be of type number. Received type ${typeof t}`),TypeError),j("ERR_OUT_OF_RANGE",((e,t,r)=>{let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=N(r+""):"bigint"==typeof r&&(n=r+"",(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=N(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i}),RangeError);let q=/[^+/0-9A-Za-z-_]/g;function $(e,t){t=t||1/0;let r,i=e.length,n=null,o=[];for(let s=0;s<i;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function H(t){return e.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(t))}function V(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function K(e){return e!=e}let G=(()=>{let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let i=16*r;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t})();function Q(e){return typeof BigInt>"u"?Y:e}function Y(){throw Error("BigInt not supported")}return _t}L(gt,{Buffer:()=>At,INSPECT_MAX_BYTES:()=>kt,default:()=>St,kMaxLength:()=>It});var mt,yt,vt,wt,_t,Et,St,At,kt,It,Tt=x((()=>{j(),Pt(),pt(),mt={},yt=!1,vt={},wt=!1,_t={},Et=!1,(St=bt()).Buffer,St.SlowBuffer,St.INSPECT_MAX_BYTES,St.kMaxLength,At=St.Buffer,kt=St.INSPECT_MAX_BYTES,It=St.kMaxLength})),Pt=x((()=>{Tt()})),Ct=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{put(e,t){return!(0===t||t>this.max||(this.aliasToTopic[t]=e,this.length=Object.keys(this.aliasToTopic).length,0))}getTopicByAlias(e){return this.aliasToTopic[e]}clear(){this.aliasToTopic={}}constructor(e){this.aliasToTopic={},this.max=e}}})),Rt=M(((e,t)=>{j(),Pt(),pt(),t.exports={AggregateError:class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r<e.length;r++)t+=` ${e[r].stack}\n`;super(t),this.name="AggregateError",this.errors=e}},ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error:Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number: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:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise:Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),PromiseResolve:e=>Promise.resolve(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String:String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol(),SymbolAsyncDispose:Symbol.asyncDispose||Symbol(),TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Boolean:Boolean,Uint8Array:Uint8Array}})),Ot=M(((e,t)=>{j(),Pt(),pt(),t.exports={format:(e,...t)=>e.replace(/%([sdifj])/g,((...[e,r])=>{let i=t.shift();return"f"===r?i.toFixed(6):"j"===r?JSON.stringify(i):"s"===r&&"object"==typeof i?((i.constructor!==Object?i.constructor.name:"")+" {}").trim():i.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?e+"":e;case"bigint":return e+"n";case"boolean":case"undefined":return e+"";case"object":return"{}"}}}})),Bt=M(((e,t)=>{j(),Pt(),pt();var{format:r,inspect:i}=Ot(),{AggregateError:n}=Rt(),o=globalThis.AggregateError||n,s=Symbol(),a=["string","function","number","object","Function","Object","boolean","bigint","symbol"],l=/^([A-Z][a-z0-9]*)+$/,u={};function h(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function c(e){let t="",r=e.length,i="-"===e[0]?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function f(e,t,i){i||(i=Error);class n extends i{toString(){return`${this.name} [${e}]: ${this.message}`}constructor(...i){super(function(e,t,i){if("function"==typeof t)return h(t.length<=i.length,`Code: ${e}; The provided arguments length (${i.length}) does not match the required ones (${t.length}).`),t(...i);let n=(t.match(/%[dfijoOs]/g)||[]).length;return h(n===i.length,`Code: ${e}; The provided arguments length (${i.length}) does not match the required ones (${n}).`),0===i.length?t:r(t,...i)}(e,t,i))}}Object.defineProperties(n.prototype,{name:{value:i.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=e,n.prototype[s]=!0,u[e]=n}function d(e){let t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}f("ERR_ASSERTION","%s",Error),f("ERR_INVALID_ARG_TYPE",((e,t,r)=>{h("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=e+" ":n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";let o=[],s=[],u=[];for(let e of t)h("string"==typeof e,"All expected entries have to be of type string"),a.includes(e)?o.push(e.toLowerCase()):l.test(e)?s.push(e):(h("object"!==e,'The value "object" should be written as "Object"'),u.push(e));if(s.length>0){let e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),s.push("Object"))}if(o.length>0){switch(o.length){case 1:n+="of type "+o[0];break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{let e=o.pop();n+=`one of type ${o.join(", ")}, or ${e}`}}(s.length>0||u.length>0)&&(n+=" or ")}if(s.length>0){switch(s.length){case 1:n+="an instance of "+s[0];break;case 2:n+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let e=s.pop();n+=`an instance of ${s.join(", ")}, or ${e}`}}u.length>0&&(n+=" or ")}switch(u.length){case 0:break;case 1:u[0].toLowerCase()!==u[0]&&(n+="an "),n+=""+u[0];break;case 2:n+=`one of ${u[0]} or ${u[1]}`;break;default:{let e=u.pop();n+=`one of ${u.join(", ")}, or ${e}`}}if(null==r)n+=". Received "+r;else if("function"==typeof r&&r.name)n+=". Received function "+r.name;else if("object"==typeof r){var c;null!==(c=r.constructor)&&void 0!==c&&c.name?n+=". Received an instance of "+r.constructor.name:n+=". Received "+i(r,{depth:-1})}else{let e=i(r,{colors:!1});e.length>25&&(e=e.slice(0,25)+"..."),n+=`. Received type ${typeof r} (${e})`}return n}),TypeError),f("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),f("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var i;return`Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(i=r.constructor)&&void 0!==i&&i.name?"instance of "+r.constructor.name:"type "+typeof r}.`}),TypeError),f("ERR_MISSING_ARGS",((...e)=>{h(e.length>0,"At least one arg needs to be specified");let t,r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`}}return t+" must be specified"}),TypeError),f("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;if(h(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32)n=c(r+"");else if("bigint"==typeof r){n=r+"";let e=BigInt(2)**BigInt(32);(r>e||r<-e)&&(n=c(n)),n+="n"}else n=i(r);return`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),f("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),f("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),f("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),f("ERR_STREAM_WRITE_AFTER_END","write after end",Error),f("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:class extends Error{constructor(e="The operation was aborted",t){if(void 0!==t&&"object"!=typeof t)throw new u.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}},aggregateTwoErrors:d((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let r=new o([t,e],t.message);return r.code=t.code,r}return e||t})),hideStackFrames:d,codes:u}})),xt=M(((e,t)=>{j(),Pt(),pt();var{AbortController:r,AbortSignal:i}=typeof self<"u"?self:typeof window<"u"?window:void 0;t.exports=r,t.exports.AbortSignal=i,t.exports.default=r}));function Mt(){Mt.init.call(this)}function Lt(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Ut(e){return void 0===e._maxListeners?Mt.defaultMaxListeners:e._maxListeners}function jt(e,t,r,i){var n,o,s;if(Lt(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=Ut(e))>0&&s.length>n&&!s.warned){s.warned=!0;var a=Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,console&&console.warn&&console.warn(a)}return e}function Nt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Dt(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=Nt.bind(i);return n.listener=r,i.wrapFn=n,n}function Wt(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?(e=>{for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t})(n):qt(n,n.length)}function Ft(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function qt(e,t){for(var r=Array(t),i=0;i<t;++i)r[i]=e[i];return r}var $t,Ht,Vt,zt,Kt,Gt,Qt,Yt=x((()=>{j(),Pt(),pt(),Vt="object"==typeof Reflect?Reflect:null,zt=Vt&&"function"==typeof Vt.apply?Vt.apply:(e,t,r)=>function(){}.apply.call(e,t,r),Ht=Vt&&"function"==typeof Vt.ownKeys?Vt.ownKeys:Object.getOwnPropertySymbols?e=>Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)):e=>Object.getOwnPropertyNames(e),Kt=Number.isNaN||(e=>e!=e),$t=Mt,Mt.EventEmitter=Mt,Mt.prototype._events=void 0,Mt.prototype._eventsCount=0,Mt.prototype._maxListeners=void 0,Gt=10,Object.defineProperty(Mt,"defaultMaxListeners",{enumerable:!0,get:()=>Gt,set(e){if("number"!=typeof e||e<0||Kt(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Gt=e}}),Mt.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Mt.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Kt(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Mt.prototype.getMaxListeners=function(){return Ut(this)},Mt.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)zt(a,this,t);else{var l=a.length,u=qt(a,l);for(r=0;r<l;++r)zt(u[r],this,t)}return!0},Mt.prototype.addListener=function(e,t){return jt(this,e,t,!1)},Mt.prototype.on=Mt.prototype.addListener,Mt.prototype.prependListener=function(e,t){return jt(this,e,t,!0)},Mt.prototype.once=function(e,t){return Lt(t),this.on(e,Dt(this,e,t)),this},Mt.prototype.prependOnceListener=function(e,t){return Lt(t),this.prependListener(e,Dt(this,e,t)),this},Mt.prototype.removeListener=function(e,t){var r,i,n,o,s;if(Lt(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():((e,t)=>{for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()})(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},Mt.prototype.off=Mt.prototype.removeListener,Mt.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,o=Object.keys(r);for(i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},Mt.prototype.listeners=function(e){return Wt(this,e,!0)},Mt.prototype.rawListeners=function(e){return Wt(this,e,!1)},Mt.listenerCount=(e,t)=>"function"==typeof e.listenerCount?e.listenerCount(t):Ft.call(e,t),Mt.prototype.listenerCount=Ft,Mt.prototype.eventNames=function(){return this._eventsCount>0?Ht(this._events):[]},(Qt=$t).EventEmitter,Qt.defaultMaxListeners,Qt.init,Qt.listenerCount,Qt.EventEmitter,Qt.defaultMaxListeners,Qt.init,Qt.listenerCount})),Jt={};L(Jt,{EventEmitter:()=>Xt,default:()=>Qt,defaultMaxListeners:()=>Zt,init:()=>er,listenerCount:()=>tr,on:()=>rr,once:()=>ir});var Xt,Zt,er,tr,rr,ir,nr=x((()=>{j(),Pt(),pt(),Yt(),Yt(),Qt.once=(e,t)=>new Promise(((r,i)=>{function n(...t){void 0!==o&&e.removeListener("error",o),r(t)}let o;"error"!==t&&(o=t=>{e.removeListener(name,n),i(t)},e.once("error",o)),e.once(t,n)})),Qt.on=function(e,t){let r=[],i=[],n=null,o=!1,s={async next(){let e=r.shift();if(e)return createIterResult(e,!1);if(n){let e=Promise.reject(n);return n=null,e}return o?createIterResult(void 0,!0):new Promise(((e,t)=>i.push({resolve:e,reject:t})))},async return(){e.removeListener(t,a),e.removeListener("error",l),o=!0;for(let e of i)e.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(r){n=r,e.removeListener(t,a),e.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return e.on(t,a),e.on("error",l),s;function a(...e){let t=i.shift();t?t.resolve(createIterResult(e,!1)):r.push(e)}function l(e){o=!0;let t=i.shift();t?t.reject(e):n=e,s.return()}},({EventEmitter:Xt,defaultMaxListeners:Zt,init:er,listenerCount:tr,on:rr,once:ir}=Qt)})),or=M(((e,t)=>{j(),Pt(),pt();var r=(Tt(),U(gt)),{format:i,inspect:n}=Ot(),{codes:{ERR_INVALID_ARG_TYPE:o}}=Bt(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:l}=Rt(),u=globalThis.AbortSignal||xt().AbortSignal,h=globalThis.AbortController||xt().AbortController,c=Object.getPrototypeOf((async()=>{})).constructor,f=globalThis.Blob||r.Blob,d=typeof f<"u"?e=>e instanceof f:()=>!1,p=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new o(t,"AbortSignal",e)};t.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...r){t||(t=!0,e.apply(this,r))}},createDeferredPromise(){let e,t;return{promise:new Promise(((r,i)=>{e=r,t=i})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...i)=>e?r(e):t(...i)))})),debuglog:()=>()=>{},format:i,inspect:n,types:{isAsyncFunction:e=>e instanceof c,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:d,deprecate:e=>e,addAbortListener:(nr(),U(Jt)).addAbortListener||((e,t)=>{if(void 0===e)throw new o("signal","AbortSignal",e);let r;return p(e,"signal"),((e,t)=>{if("function"!=typeof e)throw new o("listener","Function",e)})(t),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[s]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[l](){var e;null===(e=r)||void 0===e||e()}}}),AbortSignalAny:u.any||(e=>{if(1===e.length)return e[0];let t=new h,r=()=>t.abort();return e.forEach((e=>{p(e,"signals"),e.addEventListener("abort",r,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",r)))}),{once:!0}),t.signal})},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})),sr=M(((e,t)=>{j(),Pt(),pt();var{ArrayIsArray:r,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:n,ArrayPrototypeMap:o,NumberIsInteger:s,NumberIsNaN:a,NumberMAX_SAFE_INTEGER:l,NumberMIN_SAFE_INTEGER:u,NumberParseInt:h,ObjectPrototypeHasOwnProperty:c,RegExpPrototypeExec:f,String:d,StringPrototypeToUpperCase:p,StringPrototypeTrim:g}=Rt(),{hideStackFrames:b,codes:{ERR_SOCKET_BAD_PORT:m,ERR_INVALID_ARG_TYPE:y,ERR_INVALID_ARG_VALUE:v,ERR_OUT_OF_RANGE:w,ERR_UNKNOWN_SIGNAL:_}}=Bt(),{normalizeEncoding:E}=or(),{isAsyncFunction:S,isArrayBufferView:A}=or().types,k={},I=/^[0-7]+$/,T=b(((e,t,r=u,i=l)=>{if("number"!=typeof e)throw new y(t,"number",e);if(!s(e))throw new w(t,"an integer",e);if(e<r||e>i)throw new w(t,`>= ${r} && <= ${i}`,e)})),P=b(((e,t,r=-2147483648,i=2147483647)=>{if("number"!=typeof e)throw new y(t,"number",e);if(!s(e))throw new w(t,"an integer",e);if(e<r||e>i)throw new w(t,`>= ${r} && <= ${i}`,e)})),C=b(((e,t,r=!1)=>{if("number"!=typeof e)throw new y(t,"number",e);if(!s(e))throw new w(t,"an integer",e);let i=r?1:0,n=4294967295;if(e<i||e>n)throw new w(t,`>= ${i} && <= ${n}`,e)}));function R(e,t){if("string"!=typeof e)throw new y(t,"string",e)}var O=b(((e,t,r)=>{if(!i(r,e)){let i="must be one of: "+n(o(r,(e=>"string"==typeof e?`'${e}'`:d(e))),", ");throw new v(t,e,i)}}));function B(e,t){if("boolean"!=typeof e)throw new y(t,"boolean",e)}function x(e,t,r){return null!=e&&c(e,t)?e[t]:r}var M=b(((e,t,i=null)=>{let n=x(i,"allowArray",!1),o=x(i,"allowFunction",!1);if(!x(i,"nullable",!1)&&null===e||!n&&r(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new y(t,"Object",e)})),L=b(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new y(t,"a dictionary",e)})),U=b(((e,t,i=0)=>{if(!r(e))throw new y(t,"Array",e);if(e.length<i)throw new v(t,e,"must be longer than "+i)})),N=b(((e,t="buffer")=>{if(!A(e))throw new y(t,["Buffer","TypedArray","DataView"],e)})),D=b(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new y(t,"AbortSignal",e)})),W=b(((e,t)=>{if("function"!=typeof e)throw new y(t,"Function",e)})),F=b(((e,t)=>{if("function"!=typeof e||S(e))throw new y(t,"Function",e)})),q=b(((e,t)=>{if(void 0!==e)throw new y(t,"undefined",e)})),$=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function H(e,t){if(typeof e>"u"||!f($,e))throw new v(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:e=>e===(0|e),isUint32:e=>e===e>>>0,parseFileMode(e,t,r){if(typeof e>"u"&&(e=r),"string"==typeof e){if(null===f(I,e))throw new v(t,e,"must be a 32-bit unsigned integer or an octal string");e=h(e,8)}return C(e,t),e},validateArray:U,validateStringArray(e,t){U(e,t);for(let r=0;r<e.length;r++)R(e[r],`${t}[${r}]`)},validateBooleanArray(e,t){U(e,t);for(let r=0;r<e.length;r++)B(e[r],`${t}[${r}]`)},validateAbortSignalArray(e,t){U(e,t);for(let r=0;r<e.length;r++){let i=e[r],n=`${t}[${r}]`;if(null==i)throw new y(n,"AbortSignal",i);D(i,n)}},validateBoolean:B,validateBuffer:N,validateDictionary:L,validateEncoding(e,t){let r=E(t),i=e.length;if("hex"===r&&i%2!=0)throw new v("encoding",t,"is invalid for data of length "+i)},validateFunction:W,validateInt32:P,validateInteger:T,validateNumber(e,t,r,i){if("number"!=typeof e)throw new y(t,"number",e);if(null!=r&&e<r||null!=i&&e>i||(null!=r||null!=i)&&a(e))throw new w(t,`${null!=r?">= "+r:""}${null!=r&&null!=i?" && ":""}${null!=i?"<= "+i:""}`,e)},validateObject:M,validateOneOf:O,validatePlainFunction:F,validatePort(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===g(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new m(t,e,r);return 0|e},validateSignalName(e,t="signal"){if(R(e,t),void 0===k[e])throw void 0!==k[p(e)]?new _(e+" (signals must use all capital letters)"):new _(e)},validateString:R,validateUint32:C,validateUndefined:q,validateUnion(e,t,r){if(!i(r,e))throw new y(t,`('${n(r,"|")}')`,e)},validateAbortSignal:D,validateLinkHeaderValue(e){if("string"==typeof e)return H(e,"hints"),e;if(r(e)){let t=e.length,r="";if(0===t)return r;for(let i=0;i<t;i++){let n=e[i];H(n,"hints"),r+=n,i!==t-1&&(r+=", ")}return r}throw new v("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}}})),ar=M(((e,t)=>{j(),Pt(),pt();var r,i,n=t.exports={};function o(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}(()=>{try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}})();var l,u=[],h=!1,c=-1;function f(){!h||!l||(h=!1,l.length?u=l.concat(u):c=-1,u.length&&d())}function d(){if(!h){var e=a(f);h=!0;for(var t=u.length;t;){for(l=u,u=[];++c<t;)l&&l[c].run();c=-1,t=u.length}l=null,h=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function g(){}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new p(e,t)),1===u.length&&!h&&a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=()=>[],n.binding=()=>{throw Error("process.binding is not supported")},n.cwd=()=>"/",n.chdir=()=>{throw Error("process.chdir is not supported")},n.umask=()=>0})),lr=M(((e,t)=>{j(),Pt(),pt();var{SymbolAsyncIterator:r,SymbolIterator:i,SymbolFor:n}=Rt(),o=n("nodejs.stream.destroyed"),s=n("nodejs.stream.errored"),a=n("nodejs.stream.readable"),l=n("nodejs.stream.writable"),u=n("nodejs.stream.disturbed"),h=n("nodejs.webstream.isClosedPromise"),c=n("nodejs.webstream.controllerErrorFunction");function f(e,t=!1){var r;return!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(r=e._readableState)||void 0===r?void 0:r.readable)||e._writableState&&!e._readableState)}function d(e){var t;return!(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function p(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function g(e){return!(!e||p(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function b(e){return!(!e||p(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function m(e){return!(!e||p(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function y(e){if(!p(e))return null;let t=e._writableState,r=e._readableState,i=t||r;return!!(e.destroyed||e[o]||null!=i&&i.destroyed)}function v(e){if(!d(e))return null;if(!0===e.writableEnded)return!0;let t=e._writableState;return(null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function w(e,t){if(!f(e))return null;let r=e._readableState;return(null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.endEmitted)?null:!!(r.endEmitted||!1===t&&!0===r.ended&&0===r.length))}function _(e){return e&&null!=e[a]?e[a]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!y(e)&&f(e)&&e.readable&&!w(e)}function E(e){return e&&null!=e[l]?e[l]:"boolean"!=typeof(null==e?void 0:e.writable)?null:!y(e)&&d(e)&&e.writable&&!v(e)}function S(e){return"boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function A(e){return"boolean"==typeof e._sent100&&S(e)}t.exports={isDestroyed:y,kIsDestroyed:o,isDisturbed(e){var t;return!(!e||!(null!==(t=e[u])&&void 0!==t?t:e.readableDidRead||e.readableAborted))},kIsDisturbed:u,isErrored(e){var t,r,i,n,o,a,l,u,h,c;return!(!e||!(null!==(t=null!==(r=null!==(i=null!==(n=null!==(o=null!==(a=e[s])&&void 0!==a?a:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==n?n:null===(l=e._readableState)||void 0===l?void 0:l.errorEmitted)&&void 0!==i?i:null===(u=e._writableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==r?r:null===(h=e._readableState)||void 0===h?void 0:h.errored)&&void 0!==t?t:null!==(c=e._writableState)&&void 0!==c&&c.errored))},kIsErrored:s,isReadable:_,kIsReadable:a,kIsClosedPromise:h,kControllerErrorFunction:c,kIsWritable:l,isClosed(e){if(!p(e))return null;if("boolean"==typeof e.closed)return e.closed;let t=e._writableState,r=e._readableState;return"boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==r?void 0:r.closed)?(null==t?void 0:t.closed)||(null==r?void 0:r.closed):"boolean"==typeof e._closed&&S(e)?e._closed:null},isDuplexNodeStream:e=>!(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write),isFinished:(e,t)=>p(e)?!!y(e)||!(!1!==(null==t?void 0:t.readable)&&_(e)||!1!==(null==t?void 0:t.writable)&&E(e)):null,isIterable:(e,t)=>null!=e&&(!0===t?"function"==typeof e[r]:!1===t?"function"==typeof e[i]:"function"==typeof e[r]||"function"==typeof e[i]),isReadableNodeStream:f,isReadableStream:g,isReadableEnded(e){if(!f(e))return null;if(!0===e.readableEnded)return!0;let t=e._readableState;return!(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)},isReadableFinished:w,isReadableErrored(e){var t,r;return p(e)?e.readableErrored?e.readableErrored:null!==(t=null===(r=e._readableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null},isNodeStream:p,isWebStream:e=>g(e)||b(e)||m(e),isWritable:E,isWritableNodeStream:d,isWritableStream:b,isWritableEnded:v,isWritableFinished(e,t){if(!d(e))return null;if(!0===e.writableFinished)return!0;let r=e._writableState;return(null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.finished)?null:!!(r.finished||!1===t&&!0===r.ended&&0===r.length))},isWritableErrored(e){var t,r;return p(e)?e.writableErrored?e.writableErrored:null!==(t=null===(r=e._writableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null},isServerRequest(e){var t;return"boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)},isServerResponse:A,willEmitClose(e){if(!p(e))return null;let t=e._writableState,r=e._readableState,i=t||r;return!i&&A(e)||!!(i&&i.autoDestroy&&i.emitClose&&!1===i.closed)},isTransformStream:m}})),ur=M(((e,t)=>{j(),Pt(),pt();var r,i=ar(),{AbortError:n,codes:o}=Bt(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_PREMATURE_CLOSE:a}=o,{kEmptyObject:l,once:u}=or(),{validateAbortSignal:h,validateFunction:c,validateObject:f,validateBoolean:d}=sr(),{Promise:p,PromisePrototypeThen:g,SymbolDispose:b}=Rt(),{isClosed:m,isReadable:y,isReadableNodeStream:v,isReadableStream:w,isReadableFinished:_,isReadableErrored:E,isWritable:S,isWritableNodeStream:A,isWritableStream:k,isWritableFinished:I,isWritableErrored:T,isNodeStream:P,willEmitClose:C,kIsClosedPromise:R}=lr(),O=()=>{};function B(e,t,o){var d,p;if(2===arguments.length?(o=t,t=l):null==t?t=l:f(t,"options"),c(o,"callback"),h(t.signal,"options.signal"),o=u(o),w(e)||k(e))return function(e,t,o){let s=!1,a=O;if(t.signal)if(a=()=>{s=!0,o.call(e,new n(void 0,{cause:t.signal.reason}))},t.signal.aborted)i.nextTick(a);else{let i=(r=r||or().addAbortListener)(t.signal,a),n=o;o=u(((...t)=>{i[b](),n.apply(e,t)}))}let l=(...t)=>{s||i.nextTick((()=>o.apply(e,t)))};return g(e[R].promise,l,l),O}(e,t,o);if(!P(e))throw new s("stream",["ReadableStream","WritableStream","Stream"],e);let B=null!==(d=t.readable)&&void 0!==d?d:v(e),x=null!==(p=t.writable)&&void 0!==p?p:A(e),M=e._writableState,L=e._readableState,U=()=>{e.writable||D()},j=C(e)&&v(e)===B&&A(e)===x,N=I(e,!1),D=()=>{N=!0,e.destroyed&&(j=!1),(!j||e.readable&&!B)&&(!B||W)&&o.call(e)},W=_(e,!1),F=()=>{W=!0,e.destroyed&&(j=!1),(!j||e.writable&&!x)&&(!x||N)&&o.call(e)},q=t=>{o.call(e,t)},$=m(e),H=()=>{$=!0;let t=T(e)||E(e);return t&&"boolean"!=typeof t?o.call(e,t):B&&!W&&v(e,!0)&&!_(e,!1)?o.call(e,new a):!x||N||I(e,!1)?void o.call(e):o.call(e,new a)},V=()=>{$=!0;let t=T(e)||E(e);if(t&&"boolean"!=typeof t)return o.call(e,t);o.call(e)},z=()=>{e.req.on("finish",D)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?x&&!M&&(e.on("end",U),e.on("close",U)):(e.on("complete",D),j||e.on("abort",H),e.req?z():e.on("request",z)),!j&&"boolean"==typeof e.aborted&&e.on("aborted",H),e.on("end",F),e.on("finish",D),!1!==t.error&&e.on("error",q),e.on("close",H),$?i.nextTick(H):null!=M&&M.errorEmitted||null!=L&&L.errorEmitted?j||i.nextTick(V):(!B&&(!j||y(e))&&(N||!1===S(e))||!x&&(!j||S(e))&&(W||!1===y(e))||L&&e.req&&e.aborted)&&i.nextTick(V);let K=()=>{o=O,e.removeListener("aborted",H),e.removeListener("complete",D),e.removeListener("abort",H),e.removeListener("request",z),e.req&&e.req.removeListener("finish",D),e.removeListener("end",U),e.removeListener("close",U),e.removeListener("finish",D),e.removeListener("end",F),e.removeListener("error",q),e.removeListener("close",H)};if(t.signal&&!$){let s=()=>{let r=o;K(),r.call(e,new n(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)i.nextTick(s);else{let i=(r=r||or().addAbortListener)(t.signal,s),n=o;o=u(((...t)=>{i[b](),n.apply(e,t)}))}}return K}t.exports=B,t.exports.finished=function(e,t){var r;let i=!1;return null===t&&(t=l),null!==(r=t)&&void 0!==r&&r.cleanup&&(d(t.cleanup,"cleanup"),i=t.cleanup),new p(((r,n)=>{let o=B(e,t,(e=>{i&&o(),e?n(e):r()}))}))}})),hr=M(((e,t)=>{j(),Pt(),pt();var r=ar(),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:n},AbortError:o}=Bt(),{Symbol:s}=Rt(),{kIsDestroyed:a,isDestroyed:l,isFinished:u,isServerRequest:h}=lr(),c=s("kDestroy"),f=s("kConstruct");function d(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function p(e,t,i){let n=!1;function o(t){if(n)return;n=!0;let o=e._readableState,s=e._writableState;d(t,s,o),s&&(s.closed=!0),o&&(o.closed=!0),"function"==typeof i&&i(t),t?r.nextTick(g,e,t):r.nextTick(b,e)}try{e._destroy(t||null,o)}catch(e){o(e)}}function g(e,t){m(e,t),b(e)}function b(e){let t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function m(e,t){let r=e._readableState,i=e._writableState;null!=i&&i.errorEmitted||null!=r&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function y(e,t,i){let n=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=n&&n.destroyed)return this;null!=n&&n.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),n&&!n.errored&&(n.errored=t),i?r.nextTick(m,e,t):m(e,t))}function v(e){let t=!1;function i(i){if(t)return void y(e,null!=i?i:new n);t=!0;let o=e._readableState,s=e._writableState,a=s||o;o&&(o.constructed=!0),s&&(s.constructed=!0),a.destroyed?e.emit(c,i):i?y(e,i,!0):r.nextTick(w,e)}try{e._construct((e=>{r.nextTick(i,e)}))}catch(e){r.nextTick(i,e)}}function w(e){e.emit(f)}function _(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function E(e){e.emit("close")}function S(e,t){e.emit("error",t),r.nextTick(E,e)}t.exports={construct(e,t){if("function"!=typeof e._construct)return;let i=e._readableState,n=e._writableState;i&&(i.constructed=!1),n&&(n.constructed=!1),e.once(f,t),!(e.listenerCount(f)>1)&&r.nextTick(v,e)},destroyer(e,t){!e||l(e)||(!t&&!u(e)&&(t=new o),h(e)?(e.socket=null,e.destroy(t)):_(e)?e.abort():_(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?r.nextTick(S,e,t):r.nextTick(E,e),e.destroyed||(e[a]=!0))},destroy(e,t){let r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(d(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?p(this,e,t):this.once(c,(function(r){p(this,i(r,e),t)})),this)},undestroy(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:y}})),cr=M(((e,t)=>{j(),Pt(),pt();var{ArrayIsArray:r,ObjectSetPrototypeOf:i}=Rt(),{EventEmitter:n}=(nr(),U(Jt));function o(e){n.call(this,e)}function s(e,t,i){if("function"==typeof e.prependListener)return e.prependListener(t,i);e._events&&e._events[t]?r(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]:e.on(t,i)}i(o.prototype,n.prototype),i(o,n),o.prototype.pipe=function(e,t){let r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),!e._isStdio&&(!t||!1!==t.end)&&(r.on("end",l),r.on("close",u));let a=!1;function l(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function h(e){c(),0===n.listenerCount(this,"error")&&this.emit("error",e)}function c(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",l),r.removeListener("close",u),r.removeListener("error",h),e.removeListener("error",h),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return s(r,"error",h),s(e,"error",h),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e},t.exports={Stream:o,prependListener:s}})),fr=M(((e,t)=>{j(),Pt(),pt();var r,{SymbolDispose:i}=Rt(),{AbortError:n,codes:o}=Bt(),{isNodeStream:s,isWebStream:a,kControllerErrorFunction:l}=lr(),u=ur(),{ERR_INVALID_ARG_TYPE:h}=o;t.exports.addAbortSignal=(e,r)=>{if(((e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new h("signal","AbortSignal",e)})(e),!s(r)&&!a(r))throw new h("stream",["ReadableStream","WritableStream","Stream"],r);return t.exports.addAbortSignalNoValidate(e,r)},t.exports.addAbortSignalNoValidate=(e,t)=>{if("object"!=typeof e||!("aborted"in e))return t;let o=s(t)?()=>{t.destroy(new n(void 0,{cause:e.reason}))}:()=>{t[l](new n(void 0,{cause:e.reason}))};if(e.aborted)o();else{let n=(r=r||or().addAbortListener)(e,o);u(t,n[i])}return t}})),dr=M(((e,t)=>{j(),Pt(),pt();var{StringPrototypeSlice:r,SymbolIterator:i,TypedArrayPrototypeSet:n,Uint8Array:o}=Rt(),{Buffer:s}=(Tt(),U(gt)),{inspect:a}=or();t.exports=class{push(e){let t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){let t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;let e=this.head.data;return 1===this.length?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(0===this.length)return"";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return s.alloc(0);let t=s.allocUnsafe(e>>>0),r=this.head,i=0;for(;r;)n(t,r.data,i),i+=r.data.length,r=r.next;return t}consume(e,t){let r=this.head.data;if(e<r.length){let t=r.slice(0,e);return this.head.data=r.slice(e),t}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t="",i=this.head,n=0;do{let o=i.data;if(!(e>o.length)){e===o.length?(t+=o,++n,i.next?this.head=i.next:this.head=this.tail=null):(t+=r(o,0,e),this.head=i,i.data=r(o,e));break}t+=o,e-=o.length,++n}while(null!==(i=i.next));return this.length-=n,t}_getBuffer(e){let t=s.allocUnsafe(e),r=e,i=this.head,a=0;do{let s=i.data;if(!(e>s.length)){e===s.length?(n(t,s,r-e),++a,i.next?this.head=i.next:this.head=this.tail=null):(n(t,new o(s.buffer,s.byteOffset,e),r-e),this.head=i,i.data=s.slice(e));break}n(t,s,r-e),e-=s.length,++a}while(null!==(i=i.next));return this.length-=a,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return a(this,(0,T.default)((0,I.default)({},t),{depth:0,customInspect:!1}))}constructor(){this.head=null,this.tail=null,this.length=0}}})),pr=M(((e,t)=>{j(),Pt(),pt();var{MathFloor:r,NumberIsInteger:i}=Rt(),{validateInteger:n}=sr(),{ERR_INVALID_ARG_VALUE:o}=Bt().codes,s=16384,a=16;function l(e){return e?a:s}t.exports={getHighWaterMark(e,t,n,s){let a=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,s,n);if(null!=a){if(!i(a)||a<0)throw new o(s?"options."+n:"options.highWaterMark",a);return r(a)}return l(e.objectMode)},getDefaultHighWaterMark:l,setDefaultHighWaterMark(e,t){n(t,"value",0),e?a=t:s=t}}})),gr=M(((e,t)=>{j(),Pt(),pt();var r=(Tt(),U(gt)),i=r.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(n(r,e),e.Buffer=o),o.prototype=Object.create(i.prototype),n(i,o),o.from=(e,t,r)=>{if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=(e,t,r)=>{if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=e=>{if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=e=>{if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}})),br=M((e=>{j(),Pt(),pt();var t=gr().Buffer,r=t.isEncoding||(e=>{switch((e=""+e)&&e.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 i(e){var i;switch(this.encoding=function(e){var i=(e=>{if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}})(e);if("string"!=typeof i&&(t.isEncoding===r||!r(e)))throw Error("Unknown encoding: "+e);return i||e}(e),this.encoding){case"utf16le":this.text=s,this.end=a,i=4;break;case"utf8":this.fillLast=o,i=4;break;case"base64":this.text=l,this.end=u,i=3;break;default:return this.write=h,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function n(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function s(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function u(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}e.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},i.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},i.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var o=n(t[i]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--i<r||-2===o?0:(o=n(t[i]))>=0?(o>0&&(e.lastNeed=o-2),o):--i<r||-2===o?0:(o=n(t[i]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}})),mr=M(((e,t)=>{j(),Pt(),pt();var r=ar(),{PromisePrototypeThen:i,SymbolAsyncIterator:n,SymbolIterator:o}=Rt(),{Buffer:s}=(Tt(),U(gt)),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_NULL_VALUES:l}=Bt().codes;t.exports=function(e,t,u){let h,c;if("string"==typeof t||t instanceof s)return new e((0,T.default)((0,I.default)({objectMode:!0},u),{read(){this.push(t),this.push(null)}}));if(t&&t[n])c=!0,h=t[n]();else{if(!t||!t[o])throw new a("iterable",["Iterable"],t);c=!1,h=t[o]()}let f=new e((0,I.default)({objectMode:!0,highWaterMark:1},u)),d=!1;return f._read=()=>{d||(d=!0,async function(){for(;;){try{let{value:e,done:t}=c?await h.next():h.next();if(t)f.push(null);else{let t=e&&"function"==typeof e.then?await e:e;if(null===t)throw d=!1,new l;if(f.push(t))continue;d=!1}}catch(e){f.destroy(e)}break}}())},f._destroy=(e,t)=>{i(async function(e){let t=null!=e,r="function"==typeof h.throw;if(t&&r){let{value:t,done:r}=await h.throw(e);if(await t,r)return}if("function"==typeof h.return){let{value:e}=await h.return();await e}}(e),(()=>r.nextTick(t,e)),(i=>r.nextTick(t,i||e)))},f}})),yr=M(((e,t)=>{j(),Pt(),pt();var r=ar(),{ArrayPrototypeIndexOf:i,NumberIsInteger:n,NumberIsNaN:o,NumberParseInt:s,ObjectDefineProperties:a,ObjectKeys:l,ObjectSetPrototypeOf:u,Promise:h,SafeSet:c,SymbolAsyncDispose:f,SymbolAsyncIterator:d,Symbol:p}=Rt();t.exports=J,J.ReadableState=Y;var{EventEmitter:g}=(nr(),U(Jt)),{Stream:b,prependListener:m}=cr(),{Buffer:y}=(Tt(),U(gt)),{addAbortSignal:v}=fr(),w=ur(),_=or().debuglog("stream",(e=>{_=e})),E=dr(),S=hr(),{getHighWaterMark:A,getDefaultHighWaterMark:k}=pr(),{aggregateTwoErrors:P,codes:{ERR_INVALID_ARG_TYPE:C,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:O,ERR_STREAM_PUSH_AFTER_EOF:B,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:M}=Bt(),{validateObject:L}=sr(),N=p("kPaused"),{StringDecoder:D}=br(),W=mr();u(J.prototype,b.prototype),u(J,b);var F,q=()=>{},{errorOrDestroy:$}=S,H=1,V=16,z=32,K=2048,G=4096;function Q(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function Y(e,t,r){"boolean"!=typeof r&&(r=t instanceof _r()),this.state=K|G|V|z,e&&e.objectMode&&(this.state|=H),r&&e&&e.readableObjectMode&&(this.state|=H),this.highWaterMark=e?A(this,e,"readableHighWaterMark",r):k(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this[N]=null,e&&!1===e.emitClose&&(this.state&=-2049),e&&!1===e.autoDestroy&&(this.state&=-4097),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new D(e.encoding),this.encoding=e.encoding)}function J(e){if(!(this instanceof J))return new J(e);let t=this instanceof _r();this._readableState=new Y(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&v(e.signal,this)),b.call(this,e),S.construct(this,(()=>{this._readableState.needReadable&&ie(this,this._readableState)}))}function X(e,t,r,i){_("readableAddChunk",t);let n,o=e._readableState;if(o.state&H||("string"==typeof t?(r=r||o.defaultEncoding,o.encoding!==r&&(i&&o.encoding?t=y.from(t,r).toString(o.encoding):(t=y.from(t,r),r=""))):t instanceof y?r="":b._isUint8Array(t)?(t=b._uint8ArrayToBuffer(t),r=""):null!=t&&(n=new C("chunk",["string","Buffer","Uint8Array"],t))),n)$(e,n);else if(null===t)o.state&=-9,function(e,t){if(_("onEofChunk"),!t.ended){if(t.decoder){let e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?te(e):(t.needReadable=!1,t.emittedReadable=!0,re(e))}}(e,o);else if(o.state&H||t&&t.length>0)if(i)if(4&o.state)$(e,new x);else{if(o.destroyed||o.errored)return!1;Z(e,o,t,!0)}else if(o.ended)$(e,new B);else{if(o.destroyed||o.errored)return!1;o.state&=-9,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?Z(e,o,t,!1):ie(e,o)):Z(e,o,t,!1)}else i||(o.state&=-9,ie(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function Z(e,t,r,i){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(65536&t.state?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),64&t.state&&te(e)),ie(e,t)}function ee(e,t){return e<=0||0===t.length&&t.ended?0:t.state&H?1:o(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function te(e){let t=e._readableState;_("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(_("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(re,e))}function re(e){let t=e._readableState;_("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,le(e)}function ie(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,r.nextTick(ne,e,t))}function ne(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){let r=t.length;if(_("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function oe(e){let t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[N]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function se(e){_("readable nexttick read 0"),e.read(0)}function ae(e,t){_("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),le(e),t.flowing&&!t.reading&&e.read(0)}function le(e){let t=e._readableState;for(_("flow",t.flowing);t.flowing&&null!==e.read(););}function ue(e,t){"function"!=typeof e.read&&(e=J.wrap(e,{objectMode:!0}));let r=async function*(e,t){let r=q;function i(t){this===e?(r(),r=q):r=t}e.on("readable",i);let n,o=w(e,{writable:!1},(e=>{n=e?P(n,e):null,r(),r=q}));try{for(;;){let t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(n)throw n;if(null===n)return;await new h(i)}}}catch(e){throw n=P(n,e),n}finally{!n&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==n&&!e._readableState.autoDestroy?(e.off("readable",i),o()):S.destroyer(e,null)}}(e,t);return r.stream=e,r}function he(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ce(e){let t=e._readableState;_("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(fe,t,e))}function fe(e,t){if(_("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)r.nextTick(de,t);else if(e.autoDestroy){let e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function de(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}function pe(){return void 0===F&&(F={}),F}a(Y.prototype,{objectMode:Q(H),ended:Q(2),endEmitted:Q(4),reading:Q(8),constructed:Q(V),sync:Q(z),needReadable:Q(64),emittedReadable:Q(128),readableListening:Q(256),resumeScheduled:Q(512),errorEmitted:Q(1024),emitClose:Q(K),autoDestroy:Q(G),destroyed:Q(8192),closed:Q(16384),closeEmitted:Q(32768),multiAwaitDrain:Q(65536),readingMore:Q(131072),dataEmitted:Q(262144)}),J.prototype.destroy=S.destroy,J.prototype._undestroy=S.undestroy,J.prototype._destroy=(e,t)=>{t(e)},J.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},J.prototype[f]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new M,this.destroy(e)),new h(((t,r)=>w(this,(i=>i&&i!==e?r(i):t(null)))))},J.prototype.push=function(e,t){return X(this,e,t,!1)},J.prototype.unshift=function(e,t){return X(this,e,t,!0)},J.prototype.isPaused=function(){let e=this._readableState;return!0===e[N]||!1===e.flowing},J.prototype.setEncoding=function(e){let t=new D(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let e of r)i+=t.write(e);return r.clear(),""!==i&&r.push(i),this._readableState.length=i.length,this},J.prototype.read=function(e){_("read",e),void 0===e?e=NaN:n(e)||(e=s(e,10));let t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new O("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return _("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ce(this):te(this),null;if(0===(e=ee(e,t))&&t.ended)return 0===t.length&&ce(this),null;let i,o=!!(64&t.state);if(_("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&(o=!0,_("length less than watermark",o)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)o=!1,_("reading, ended or constructing",o);else if(o){_("do read"),t.state|=8|z,0===t.length&&(t.state|=64);try{this._read(t.highWaterMark)}catch(e){$(this,e)}t.state&=-33,t.reading||(e=ee(r,t))}return i=e>0?he(e,t):null,null===i?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&ce(this)),null!==i&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit("data",i)),i},J.prototype._read=()=>{throw new R("_read()")},J.prototype.pipe=function(e,t){let i=this,n=this._readableState;1===n.pipes.length&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new c(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(e),_("pipe count=%d opts=%j",n.pipes.length,t);let o=t&&!1===t.end||e===r.stdout||e===r.stderr?g:s;function s(){_("onend"),e.end()}n.endEmitted?r.nextTick(o):i.once("end",o),e.on("unpipe",(function t(r,o){_("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,_("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),a&&e.removeListener("drain",a),e.removeListener("error",f),e.removeListener("unpipe",t),i.removeListener("end",s),i.removeListener("end",g),i.removeListener("data",h),l=!0,a&&n.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&a())}));let a,l=!1;function u(){l||(1===n.pipes.length&&n.pipes[0]===e?(_("false write response, pause",0),n.awaitDrainWriters=e,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(e)&&(_("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(e)),i.pause()),a||(a=function(e,t){return()=>{let r=e._readableState;r.awaitDrainWriters===t?(_("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(_("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),(!r.awaitDrainWriters||0===r.awaitDrainWriters.size)&&e.listenerCount("data")&&e.resume()}}(i,e),e.on("drain",a))}function h(t){_("ondata");let r=e.write(t);_("dest.write",r),!1===r&&u()}function f(t){if(_("onerror",t),g(),e.removeListener("error",f),0===e.listenerCount("error")){let r=e._writableState||e._readableState;r&&!r.errorEmitted?$(e,t):e.emit("error",t)}}function d(){e.removeListener("finish",p),g()}function p(){_("onfinish"),e.removeListener("close",d),g()}function g(){_("unpipe"),i.unpipe(e)}return i.on("data",h),m(e,"error",f),e.once("close",d),e.once("finish",p),e.emit("pipe",i),!0===e.writableNeedDrain?u():n.flowing||(_("pipe resume"),i.resume()),e},J.prototype.unpipe=function(e){let t=this._readableState;if(0===t.pipes.length)return this;if(!e){let e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}let r=i(t.pipes,e);return-1===r||(t.pipes.splice(r,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,{hasUnpiped:!1})),this},J.prototype.on=function(e,t){let i=b.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,_("on readable",n.length,n.reading),n.length?te(this):n.reading||r.nextTick(se,this)),i},J.prototype.addListener=J.prototype.on,J.prototype.removeListener=function(e,t){let i=b.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(oe,this),i},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function(e){let t=b.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&r.nextTick(oe,this),t},J.prototype.resume=function(){let e=this._readableState;return e.flowing||(_("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(ae,e,t))}(this,e)),e[N]=!1,this},J.prototype.pause=function(){return _("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(_("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[N]=!0,this},J.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{$(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let r=l(e);for(let t=1;t<r.length;t++){let i=r[t];void 0===this[i]&&"function"==typeof e[i]&&(this[i]=e[i].bind(e))}return this},J.prototype[d]=function(){return ue(this)},J.prototype.iterator=function(e){return void 0!==e&&L(e,"options"),ue(this,e)},a(J.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get(){return!(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get(){return this._readableState.flowing},set(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.objectMode}},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}},destroyed:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.endEmitted}}}),a(Y.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return!1!==this[N]},set(e){this[N]=!!e}}}),J._fromList=he,J.from=(e,t)=>W(J,e,t),J.fromWeb=(e,t)=>pe().newStreamReadableFromReadableStream(e,t),J.toWeb=(e,t)=>pe().newReadableStreamFromStreamReadable(e,t),J.wrap=(e,t)=>{var r,i;return new J((0,T.default)((0,I.default)({objectMode:null===(r=null!==(i=e.readableObjectMode)&&void 0!==i?i:e.objectMode)||void 0===r||r},t),{destroy(t,r){S.destroyer(e,t),r(t)}})).wrap(e)}})),vr=M(((e,t)=>{j(),Pt(),pt();var r=ar(),{ArrayPrototypeSlice:i,Error:n,FunctionPrototypeSymbolHasInstance:o,ObjectDefineProperty:s,ObjectDefineProperties:a,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:u,Symbol:h,SymbolHasInstance:c}=Rt();t.exports=x,x.WritableState=O;var{EventEmitter:f}=(nr(),U(Jt)),d=cr().Stream,{Buffer:p}=(Tt(),U(gt)),g=hr(),{addAbortSignal:b}=fr(),{getHighWaterMark:m,getDefaultHighWaterMark:y}=pr(),{ERR_INVALID_ARG_TYPE:v,ERR_METHOD_NOT_IMPLEMENTED:w,ERR_MULTIPLE_CALLBACK:_,ERR_STREAM_CANNOT_PIPE:E,ERR_STREAM_DESTROYED:S,ERR_STREAM_ALREADY_FINISHED:A,ERR_STREAM_NULL_VALUES:k,ERR_STREAM_WRITE_AFTER_END:I,ERR_UNKNOWN_ENCODING:T}=Bt().codes,{errorOrDestroy:P}=g;function C(){}l(x.prototype,d.prototype),l(x,d);var R=h("kOnFinished");function O(e,t,r){"boolean"!=typeof r&&(r=t instanceof _r()),this.objectMode=!(!e||!e.objectMode),r&&(this.objectMode=this.objectMode||!(!e||!e.writableObjectMode)),this.highWaterMark=e?m(this,e,"writableHighWaterMark",r):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!(!e||!1!==e.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=D.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,B(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[R]=[]}function B(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}function x(e){let t=this instanceof _r();if(!t&&!o(x,this))return new x(e);this._writableState=new O(e,this,t),e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&b(e.signal,this)),d.call(this,e),g.construct(this,(()=>{let e=this._writableState;e.writing||$(this,e),V(this,e)}))}function M(e,t,i,n){let o,s=e._writableState;if("function"==typeof i)n=i,i=s.defaultEncoding;else{if(i){if("buffer"!==i&&!p.isEncoding(i))throw new T(i)}else i=s.defaultEncoding;"function"!=typeof n&&(n=C)}if(null===t)throw new k;if(!s.objectMode)if("string"==typeof t)!1!==s.decodeStrings&&(t=p.from(t,i),i="buffer");else if(t instanceof p)i="buffer";else{if(!d._isUint8Array(t))throw new v("chunk",["string","Buffer","Uint8Array"],t);t=d._uint8ArrayToBuffer(t),i="buffer"}return s.ending?o=new I:s.destroyed&&(o=new S("write")),o?(r.nextTick(n,o),P(e,o,!0),o):(s.pendingcb++,function(e,t,r,i,n){let o=t.objectMode?1:r.length;t.length+=o;let s=t.length<t.highWaterMark;return s||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:r,encoding:i,callback:n}),t.allBuffers&&"buffer"!==i&&(t.allBuffers=!1),t.allNoop&&n!==C&&(t.allNoop=!1)):(t.writelen=o,t.writecb=n,t.writing=!0,t.sync=!0,e._write(r,i,t.onwrite),t.sync=!1),s&&!t.errored&&!t.destroyed}(e,s,t,i,n))}function L(e,t,r,i,n,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new S("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function N(e,t,r,i){--t.pendingcb,i(r),q(t),P(e,r)}function D(e,t){let i=e._writableState,n=i.sync,o=i.writecb;"function"==typeof o?(i.writing=!1,i.writecb=null,i.length-=i.writelen,i.writelen=0,t?(t.stack,i.errored||(i.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),n?r.nextTick(N,e,i,t,o):N(e,i,t,o)):(i.buffered.length>i.bufferedIndex&&$(e,i),n?null!==i.afterWriteTickInfo&&i.afterWriteTickInfo.cb===o?i.afterWriteTickInfo.count++:(i.afterWriteTickInfo={count:1,cb:o,stream:e,state:i},r.nextTick(W,i.afterWriteTickInfo)):F(e,i,1,o))):P(e,new _)}function W({stream:e,state:t,count:r,cb:i}){return t.afterWriteTickInfo=null,F(e,t,r,i)}function F(e,t,r,i){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,i();t.destroyed&&q(t),V(e,t)}function q(e){if(e.writing)return;for(let r=e.bufferedIndex;r<e.buffered.length;++r){var t;let{chunk:i,callback:n}=e.buffered[r],o=e.objectMode?1:i.length;e.length-=o,n(null!==(t=e.errored)&&void 0!==t?t:new S("write"))}let r=e[R].splice(0);for(let t=0;t<r.length;t++){var i;r[t](null!==(i=e.errored)&&void 0!==i?i:new S("end"))}B(e)}function $(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:o}=t,s=r.length-n;if(!s)return;let a=n;if(t.bufferProcessing=!0,s>1&&e._writev){t.pendingcb-=s-1;let n=t.allNoop?C:e=>{for(let t=a;t<r.length;++t)r[t].callback(e)},o=t.allNoop&&0===a?r:i(r,a);o.allBuffers=t.allBuffers,L(e,t,!0,t.length,o,"",n),B(t)}else{do{let{chunk:i,encoding:n,callback:s}=r[a];r[a++]=null,L(e,t,!1,o?1:i.length,i,n,s)}while(a<r.length&&!t.writing);a===r.length?B(t):a>256?(r.splice(0,a),t.bufferedIndex=0):t.bufferedIndex=a}t.bufferProcessing=!1}function H(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function V(e,t,i){H(t)&&(function(e,t){!t.prefinished&&!t.finalCalled&&("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let i=!1;function n(n){if(i)P(e,null!=n?n:_());else if(i=!0,t.pendingcb--,n){let r=t[R].splice(0);for(let e=0;e<r.length;e++)r[e](n);P(e,n,t.sync)}else H(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,r.nextTick(z,e,t))}t.sync=!0,t.pendingcb++;try{e._final(n)}catch(e){n(e)}t.sync=!1}(e,t)))}(e,t),0===t.pendingcb&&(i?(t.pendingcb++,r.nextTick(((e,t)=>{H(t)?z(e,t):t.pendingcb--}),e,t)):H(t)&&(t.pendingcb++,z(e,t))))}function z(e,t){t.pendingcb--,t.finished=!0;let r=t[R].splice(0);for(let e=0;e<r.length;e++)r[e]();if(e.emit("finish"),t.autoDestroy){let t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy()}}O.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(O.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),s(x,c,{__proto__:null,value(e){return!!o(this,e)||this===x&&e&&e._writableState instanceof O}}),x.prototype.pipe=function(){P(this,new E)},x.prototype.write=function(e,t,r){return!0===M(this,e,t,r)},x.prototype.cork=function(){this._writableState.corked++},x.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||$(this,e))},x.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=u(e)),!p.isEncoding(e))throw new T(e);return this._writableState.defaultEncoding=e,this},x.prototype._write=function(e,t,r){if(!this._writev)throw new w("_write()");this._writev([{chunk:e,encoding:t}],r)},x.prototype._writev=null,x.prototype.end=function(e,t,i){let o,s=this._writableState;if("function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!=e){let r=M(this,e,t);r instanceof n&&(o=r)}return s.corked&&(s.corked=1,this.uncork()),o||(s.errored||s.ending?s.finished?o=new A("end"):s.destroyed&&(o=new S("end")):(s.ending=!0,V(this,s,!0),s.ended=!0)),"function"==typeof i&&(o||s.finished?r.nextTick(i,o):s[R].push(i)),this},a(x.prototype,{closed:{__proto__:null,get(){return!!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return!!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return!!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return!!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return!!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&e.needDrain}},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(){return!(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});var K,G=g.destroy;function Q(){return void 0===K&&(K={}),K}x.prototype.destroy=function(e,t){let i=this._writableState;return!i.destroyed&&(i.bufferedIndex<i.buffered.length||i[R].length)&&r.nextTick(q,i),G.call(this,e,t),this},x.prototype._undestroy=g.undestroy,x.prototype._destroy=(e,t)=>{t(e)},x.prototype[f.captureRejectionSymbol]=function(e){this.destroy(e)},x.fromWeb=(e,t)=>Q().newStreamWritableFromWritableStream(e,t),x.toWeb=e=>Q().newWritableStreamFromStreamWritable(e)})),wr=M(((e,t)=>{j(),Pt(),pt();var r=ar(),i=(Tt(),U(gt)),{isReadable:n,isWritable:o,isIterable:s,isNodeStream:a,isReadableNodeStream:l,isWritableNodeStream:u,isDuplexNodeStream:h,isReadableStream:c,isWritableStream:f}=lr(),d=ur(),{AbortError:p,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:b}}=Bt(),{destroyer:m}=hr(),y=_r(),v=yr(),w=vr(),{createDeferredPromise:_}=or(),E=mr(),S=globalThis.Blob||i.Blob,A=typeof S<"u"?e=>e instanceof S:()=>!1,k=globalThis.AbortController||xt().AbortController,{FunctionPrototypeCall:I}=Rt(),T=class extends y{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};function P(e){let t,r,i,s,a,l=e.readable&&"function"!=typeof e.readable.read?v.wrap(e.readable):e.readable,u=e.writable,h=!!n(l),c=!!o(u);function f(e){let t=s;s=null,t?t(e):e&&a.destroy(e)}return a=new T({readableObjectMode:!(null==l||!l.readableObjectMode),writableObjectMode:!(null==u||!u.writableObjectMode),readable:h,writable:c}),c&&(d(u,(e=>{c=!1,e&&m(l,e),f(e)})),a._write=(e,r,i)=>{u.write(e,r)?i():t=i},a._final=e=>{u.end(),r=e},u.on("drain",(()=>{if(t){let e=t;t=null,e()}})),u.on("finish",(()=>{if(r){let e=r;r=null,e()}}))),h&&(d(l,(e=>{h=!1,e&&m(l,e),f(e)})),l.on("readable",(()=>{if(i){let e=i;i=null,e()}})),l.on("end",(()=>{a.push(null)})),a._read=()=>{for(;;){let e=l.read();if(null===e)return void(i=a._read);if(!a.push(e))return}}),a._destroy=(e,n)=>{!e&&null!==s&&(e=new p),i=null,t=null,r=null,null===s?n(e):(s=n,m(u,e),m(l,e))},a}t.exports=function e(t,i){if(h(t))return t;if(l(t))return P({readable:t});if(u(t))return P({writable:t});if(a(t))return P({writable:!1,readable:!1});if(c(t))return P({readable:v.fromWeb(t)});if(f(t))return P({writable:w.fromWeb(t)});if("function"==typeof t){let{value:e,write:n,final:o,destroy:a}=function(e){let{promise:t,resolve:i}=_(),n=new k,o=n.signal;return{value:e(async function*(){for(;;){let e=t;t=null;let{chunk:n,done:s,cb:a}=await e;if(r.nextTick(a),s)return;if(o.aborted)throw new p(void 0,{cause:o.reason});({promise:t,resolve:i}=_()),yield n}}(),{signal:o}),write(e,t,r){let n=i;i=null,n({chunk:e,done:!1,cb:r})},final(e){let t=i;i=null,t({done:!0,cb:e})},destroy(e,t){n.abort(),t(e)}}}(t);if(s(e))return E(T,e,{objectMode:!0,write:n,final:o,destroy:a});let l=null==e?void 0:e.then;if("function"==typeof l){let t,i=I(l,e,(e=>{if(null!=e)throw new b("nully","body",e)}),(e=>{m(t,e)}));return t=new T({objectMode:!0,readable:!1,write:n,final(e){o((async()=>{try{await i,r.nextTick(e,null)}catch(t){r.nextTick(e,t)}}))},destroy:a})}throw new b("Iterable, AsyncIterable or AsyncFunction",i,e)}if(A(t))return e(t.arrayBuffer());if(s(t))return E(T,t,{objectMode:!0,writable:!1});if(c(null==t?void 0:t.readable)&&f(null==t?void 0:t.writable))return T.fromWeb(t);if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return P({readable:null!=t&&t.readable?l(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?u(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});let n=null==t?void 0:t.then;if("function"==typeof n){let e;return I(n,t,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{m(e,t)})),e=new T({objectMode:!0,writable:!1,read(){}})}throw new g(i,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}})),_r=M(((e,t)=>{j(),Pt(),pt();var{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:n,ObjectSetPrototypeOf:o}=Rt();t.exports=h;var s,a,l=yr(),u=vr();o(h.prototype,l.prototype),o(h,l);{let e=n(u.prototype);for(let t=0;t<e.length;t++){let r=e[t];h.prototype[r]||(h.prototype[r]=u.prototype[r])}}function h(e){if(!(this instanceof h))return new h(e);l.call(this,e),u.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}function c(){return void 0===s&&(s={}),s}r(h.prototype,{writable:(0,I.default)({__proto__:null},i(u.prototype,"writable")),writableHighWaterMark:(0,I.default)({__proto__:null},i(u.prototype,"writableHighWaterMark")),writableObjectMode:(0,I.default)({__proto__:null},i(u.prototype,"writableObjectMode")),writableBuffer:(0,I.default)({__proto__:null},i(u.prototype,"writableBuffer")),writableLength:(0,I.default)({__proto__:null},i(u.prototype,"writableLength")),writableFinished:(0,I.default)({__proto__:null},i(u.prototype,"writableFinished")),writableCorked:(0,I.default)({__proto__:null},i(u.prototype,"writableCorked")),writableEnded:(0,I.default)({__proto__:null},i(u.prototype,"writableEnded")),writableNeedDrain:(0,I.default)({__proto__:null},i(u.prototype,"writableNeedDrain")),destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}}),h.fromWeb=(e,t)=>c().newStreamDuplexFromReadableWritablePair(e,t),h.toWeb=e=>c().newReadableWritablePairFromDuplex(e),h.from=e=>(a||(a=wr()),a(e,"body"))})),Er=M(((e,t)=>{j(),Pt(),pt();var{ObjectSetPrototypeOf:r,Symbol:i}=Rt();t.exports=l;var{ERR_METHOD_NOT_IMPLEMENTED:n}=Bt().codes,o=_r(),{getHighWaterMark:s}=pr();r(l.prototype,o.prototype),r(l,o);var a=i("kCallback");function l(e){if(!(this instanceof l))return new l(e);let t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e=(0,T.default)((0,I.default)({},e),{highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0})),o.call(this,e),this._readableState.sync=!1,this[a]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",h)}function u(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,r)=>{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e())}))}function h(){this._final!==u&&u.call(this)}l.prototype._final=u,l.prototype._transform=()=>{throw new n("_transform()")},l.prototype._write=function(e,t,r){let i=this._readableState,n=this._writableState,o=i.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),n.ended||o===i.length||i.length<i.highWaterMark?r():this[a]=r)}))},l.prototype._read=function(){if(this[a]){let e=this[a];this[a]=null,e()}}})),Sr=M(((e,t)=>{j(),Pt(),pt();var{ObjectSetPrototypeOf:r}=Rt();t.exports=n;var i=Er();function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}r(n.prototype,i.prototype),r(n,i),n.prototype._transform=(e,t,r)=>{r(null,e)}})),Ar=M(((e,t)=>{j(),Pt(),pt();var r,i,n,o=ar(),{ArrayIsArray:s,Promise:a,SymbolAsyncIterator:l,SymbolDispose:u}=Rt(),h=ur(),{once:c}=or(),f=hr(),d=_r(),{aggregateTwoErrors:p,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:b,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:v},AbortError:w}=Bt(),{validateFunction:_,validateAbortSignal:E}=sr(),{isIterable:S,isReadable:A,isReadableNodeStream:k,isNodeStream:I,isTransformStream:T,isWebStream:P,isReadableStream:C,isReadableFinished:R}=lr(),O=globalThis.AbortController||xt().AbortController;function B(e,t,r){let i=!1;e.on("close",(()=>{i=!0}));let n=h(e,{readable:t,writable:r},(e=>{i=!e}));return{destroy(t){i||(i=!0,f.destroyer(e,t||new y("pipe")))},cleanup:n}}function x(e){if(S(e))return e;if(k(e))return async function*(e){i||(i=yr()),yield*i.prototype[l].call(e)}(e);throw new g("val",["Readable","Iterable","AsyncIterable"],e)}async function M(e,t,r,{end:i}){let n,o=null,s=e=>{if(e&&(n=e),o){let e=o;o=null,e()}},l=()=>new a(((e,t)=>{n?t(n):o=()=>{n?t(n):e()}}));t.on("drain",s);let u=h(t,{readable:!1},s);try{t.writableNeedDrain&&await l();for await(let r of e)t.write(r)||await l();i&&(t.end(),await l()),r()}catch(e){r(n!==e?p(n,e):e)}finally{u(),t.off("drain",s)}}async function L(e,t,r,{end:i}){T(t)&&(t=t.writable);let n=t.getWriter();try{for await(let t of e)await n.ready,n.write(t).catch((()=>{}));await n.ready,i&&await n.close(),r()}catch(e){try{await n.abort(e),r(e)}catch(e){r(e)}}}function U(e,t,i){if(1===e.length&&s(e[0])&&(e=e[0]),e.length<2)throw new m("streams");let a,l=new O,h=l.signal,c=null==i?void 0:i.signal,f=[];function p(){D(new w)}E(c,"options.signal"),n=n||or().addAbortListener,c&&(a=n(c,p));let y,v,_,R=[],U=0;function j(e){D(e,0==--U)}function D(e,r){var i;if(e&&(!y||"ERR_STREAM_PREMATURE_CLOSE"===y.code)&&(y=e),y||r){for(;R.length;)R.shift()(y);null===(i=a)||void 0===i||i[u](),l.abort(),r&&(y||f.forEach((e=>e())),o.nextTick(t,y,v))}}for(let t=0;t<e.length;t++){let n=e[t],s=t<e.length-1,a=t>0,l=s||!1!==(null==i?void 0:i.end),u=t===e.length-1;if(I(n)){let e=e=>{e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&j(e)};if(l){let{destroy:e,cleanup:t}=B(n,s,a);R.push(e),A(n)&&u&&f.push(t)}n.on("error",e),A(n)&&u&&f.push((()=>{n.removeListener("error",e)}))}if(0===t)if("function"==typeof n){if(_=n({signal:h}),!S(_))throw new b("Iterable, AsyncIterable or Stream","source",_)}else _=S(n)||k(n)||T(n)?n:d.from(n);else if("function"==typeof n){var W;if(_=T(_)?x(null===(W=_)||void 0===W?void 0:W.readable):x(_),_=n(_,{signal:h}),s){if(!S(_,!0))throw new b("AsyncIterable",`transform[${t-1}]`,_)}else{var F;r||(r=Sr());let e=new r({objectMode:!0}),t=null===(F=_)||void 0===F?void 0:F.then;if("function"==typeof t)U++,t.call(_,(t=>{v=t,null!=t&&e.write(t),l&&e.end(),o.nextTick(j)}),(t=>{e.destroy(t),o.nextTick(j,t)}));else if(S(_,!0))U++,M(_,e,j,{end:l});else{if(!C(_)&&!T(_))throw new b("AsyncIterable or Promise","destination",_);{let t=_.readable||_;U++,M(t,e,j,{end:l})}}_=e;let{destroy:i,cleanup:n}=B(_,!1,!0);R.push(i),u&&f.push(n)}}else if(I(n)){if(k(_)){U+=2;let e=N(_,n,j,{end:l});A(n)&&u&&f.push(e)}else if(T(_)||C(_)){let e=_.readable||_;U++,M(e,n,j,{end:l})}else{if(!S(_))throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);U++,M(_,n,j,{end:l})}_=n}else if(P(n)){if(k(_))U++,L(x(_),n,j,{end:l});else if(C(_)||S(_))U++,L(_,n,j,{end:l});else{if(!T(_))throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);U++,L(_.readable,n,j,{end:l})}_=n}else _=d.from(n)}return(null!=h&&h.aborted||null!=c&&c.aborted)&&o.nextTick(p),_}function N(e,t,r,{end:i}){let n=!1;if(t.on("close",(()=>{n||r(new v)})),e.pipe(t,{end:!1}),i){let r=()=>{n=!0,t.end()};R(e)?o.nextTick(r):e.once("end",r)}else r();return h(e,{readable:!0,writable:!1},(t=>{let i=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&i&&i.ended&&!i.errored&&!i.errorEmitted?e.once("end",r).once("error",r):r(t)})),h(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:U,pipeline:(...e)=>U(e,c(function(e){return _(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}})),kr=M(((e,t)=>{j(),Pt(),pt();var{pipeline:r}=Ar(),i=_r(),{destroyer:n}=hr(),{isNodeStream:o,isReadable:s,isWritable:a,isWebStream:l,isTransformStream:u,isWritableStream:h,isReadableStream:c}=lr(),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:d,ERR_MISSING_ARGS:p}}=Bt(),g=ur();t.exports=(...e)=>{if(0===e.length)throw new p("streams");if(1===e.length)return i.from(e[0]);let t,b,m,y,v,w=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){let t=e.length-1;e[t]=i.from(e[t])}for(let t=0;t<e.length;++t)if(o(e[t])||l(e[t])){if(t<e.length-1&&!(s(e[t])||c(e[t])||u(e[t])))throw new d(`streams[${t}]`,w[t],"must be readable");if(t>0&&!(a(e[t])||h(e[t])||u(e[t])))throw new d(`streams[${t}]`,w[t],"must be writable")}let _=e[0],E=r(e,(function(e){let t=y;y=null,t?t(e):e?v.destroy(e):!A&&!S&&v.destroy()})),S=!!(a(_)||h(_)||u(_)),A=!!(s(E)||c(E)||u(E));if(v=new i({writableObjectMode:!(null==_||!_.writableObjectMode),readableObjectMode:!(null==E||!E.readableObjectMode),writable:S,readable:A}),S){if(o(_))v._write=(e,r,i)=>{_.write(e,r)?i():t=i},v._final=e=>{_.end(),b=e},_.on("drain",(()=>{if(t){let e=t;t=null,e()}}));else if(l(_)){let e=(u(_)?_.writable:_).getWriter();v._write=async(t,r,i)=>{try{await e.ready,e.write(t).catch((()=>{})),i()}catch(e){i(e)}},v._final=async t=>{try{await e.ready,e.close().catch((()=>{})),b=t}catch(e){t(e)}}}let e=u(E)?E.readable:E;g(e,(()=>{if(b){let e=b;b=null,e()}}))}if(A)if(o(E))E.on("readable",(()=>{if(m){let e=m;m=null,e()}})),E.on("end",(()=>{v.push(null)})),v._read=()=>{for(;;){let e=E.read();if(null===e)return void(m=v._read);if(!v.push(e))return}};else if(l(E)){let e=(u(E)?E.readable:E).getReader();v._read=async()=>{for(;;)try{let{value:t,done:r}=await e.read();if(!v.push(t))return;if(r)return void v.push(null)}catch(e){return}}}return v._destroy=(e,r)=>{!e&&null!==y&&(e=new f),m=null,t=null,b=null,null===y?r(e):(y=r,o(E)&&n(E,e))},v}})),Ir=M(((e,t)=>{j(),Pt(),pt();var r=globalThis.AbortController||xt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:n,ERR_MISSING_ARGS:o,ERR_OUT_OF_RANGE:s},AbortError:a}=Bt(),{validateAbortSignal:l,validateInteger:u,validateObject:h}=sr(),c=Rt().Symbol("kWeak"),f=Rt().Symbol("kResistStopPropagation"),{finished:d}=ur(),p=kr(),{addAbortSignalNoValidate:g}=fr(),{isWritable:b,isNodeStream:m}=lr(),{deprecate:y}=or(),{ArrayPrototypePush:v,Boolean:w,MathFloor:_,Number:E,NumberIsNaN:S,Promise:A,PromiseReject:k,PromiseResolve:I,PromisePrototypeThen:T,Symbol:P}=Rt(),C=P("kEmpty"),R=P("kEof");function O(e,t){if("function"!=typeof e)throw new n("fn",["Function","AsyncFunction"],e);null!=t&&h(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal");let r=1;null!=(null==t?void 0:t.concurrency)&&(r=_(t.concurrency));let i=r-1;return null!=(null==t?void 0:t.highWaterMark)&&(i=_(t.highWaterMark)),u(r,"options.concurrency",1),u(i,"options.highWaterMark",0),i+=r,async function*(){let n,o,s=or().AbortSignalAny([null==t?void 0:t.signal].filter(w)),l=this,u=[],h={signal:s},c=!1,f=0;function d(){c=!0,p()}function p(){f-=1,g()}function g(){o&&!c&&f<r&&u.length<i&&(o(),o=null)}!async function(){try{for await(let t of l){if(c)return;if(s.aborted)throw new a;try{if(t=e(t,h),t===C)continue;t=I(t)}catch(e){t=k(e)}f+=1,T(t,p,d),u.push(t),n&&(n(),n=null),!c&&(u.length>=i||f>=r)&&await new A((e=>{o=e}))}u.push(R)}catch(e){let t=k(e);T(t,p,d),u.push(t)}finally{c=!0,n&&(n(),n=null)}}();try{for(;;){for(;u.length>0;){let e=await u[0];if(e===R)return;if(s.aborted)throw new a;e!==C&&(yield e),u.shift(),g()}await new A((e=>{n=e}))}}finally{c=!0,o&&(o(),o=null)}}.call(this)}async function B(e,t){for await(let r of x.call(this,e,t))return!0;return!1}function x(e,t){if("function"!=typeof e)throw new n("fn",["Function","AsyncFunction"],e);return O.call(this,(async function(t,r){return await e(t,r)?t:C}),t)}var M=class extends o{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};function L(e){if(e=E(e),S(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}t.exports.streamReturningOperators={asIndexedPairs:y((function(e){return null!=e&&h(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),async function*(){let t=0;for await(let i of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new a({cause:e.signal.reason});yield[t++,i]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop(e,t){return null!=t&&h(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),e=L(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new a;for await(let r of this){var i;if(null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted)throw new a;e--<=0&&(yield r)}}.call(this)},filter:x,flatMap(e,t){let r=O.call(this,e,t);return async function*(){for await(let e of r)yield*e}()},map:O,take(e,t){return null!=t&&h(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),e=L(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new a;for await(let r of this){var i;if(null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted)throw new a;if(e-- >0&&(yield r),e<=0)return}}.call(this)},compose(e,t){if(null!=t&&h(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),m(e)&&!b(e))throw new i("stream",e,"must be writable");let r=p(this,e);return null!=t&&t.signal&&g(t.signal,r),r}},t.exports.promiseReturningOperators={async every(e,t){if("function"!=typeof e)throw new n("fn",["Function","AsyncFunction"],e);return!await B.call(this,(async(...t)=>!await e(...t)),t)},async forEach(e,t){if("function"!=typeof e)throw new n("fn",["Function","AsyncFunction"],e);for await(let r of O.call(this,(async function(t,r){return await e(t,r),C}),t));},async reduce(e,t,i){var o;if("function"!=typeof e)throw new n("reducer",["Function","AsyncFunction"],e);null!=i&&h(i,"options"),null!=(null==i?void 0:i.signal)&&l(i.signal,"options.signal");let s=arguments.length>1;if(null!=i&&null!==(o=i.signal)&&void 0!==o&&o.aborted){let e=new a(void 0,{cause:i.signal.reason});throw this.once("error",(()=>{})),await d(this.destroy(e)),e}let u=new r,p=u.signal;if(null!=i&&i.signal){let e={once:!0,[c]:this,[f]:!0};i.signal.addEventListener("abort",(()=>u.abort()),e)}let g=!1;try{for await(let r of this){var b;if(g=!0,null!=i&&null!==(b=i.signal)&&void 0!==b&&b.aborted)throw new a;s?t=await e(t,r,{signal:p}):(t=r,s=!0)}if(!g&&!s)throw new M}finally{u.abort()}return t},async toArray(e){null!=e&&h(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal");let t=[];for await(let i of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new a(void 0,{cause:e.signal.reason});v(t,i)}return t},some:B,async find(e,t){for await(let r of x.call(this,e,t))return r}}})),Tr=M(((e,t)=>{j(),Pt(),pt();var{ArrayPrototypePop:r,Promise:i}=Rt(),{isIterable:n,isNodeStream:o,isWebStream:s}=lr(),{pipelineImpl:a}=Ar(),{finished:l}=ur();Pr(),t.exports={finished:l,pipeline:(...e)=>new i(((t,i)=>{let l,u,h=e[e.length-1];if(h&&"object"==typeof h&&!o(h)&&!n(h)&&!s(h)){let t=r(e);l=t.signal,u=t.end}a(e,((e,r)=>{e?i(e):t(r)}),{signal:l,end:u})}))}})),Pr=M(((e,t)=>{j(),Pt(),pt();var{Buffer:r}=(Tt(),U(gt)),{ObjectDefineProperty:i,ObjectKeys:n,ReflectApply:o}=Rt(),{promisify:{custom:s}}=or(),{streamReturningOperators:a,promiseReturningOperators:l}=Ir(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=Bt(),h=kr(),{setDefaultHighWaterMark:c,getDefaultHighWaterMark:f}=pr(),{pipeline:d}=Ar(),{destroyer:p}=hr(),g=ur(),b=Tr(),m=lr(),y=t.exports=cr().Stream;y.isDestroyed=m.isDestroyed,y.isDisturbed=m.isDisturbed,y.isErrored=m.isErrored,y.isReadable=m.isReadable,y.isWritable=m.isWritable,y.Readable=yr();for(let e of n(a)){let t=function(...e){if(new.target)throw u();return y.Readable.from(o(r,this,e))},r=a[e];i(t,"name",{__proto__:null,value:r.name}),i(t,"length",{__proto__:null,value:r.length}),i(y.Readable.prototype,e,{__proto__:null,value:t,enumerable:!1,configurable:!0,writable:!0})}for(let e of n(l)){let t=function(...e){if(new.target)throw u();return o(r,this,e)},r=l[e];i(t,"name",{__proto__:null,value:r.name}),i(t,"length",{__proto__:null,value:r.length}),i(y.Readable.prototype,e,{__proto__:null,value:t,enumerable:!1,configurable:!0,writable:!0})}y.Writable=vr(),y.Duplex=_r(),y.Transform=Er(),y.PassThrough=Sr(),y.pipeline=d;var{addAbortSignal:v}=fr();y.addAbortSignal=v,y.finished=g,y.destroy=p,y.compose=h,y.setDefaultHighWaterMark=c,y.getDefaultHighWaterMark=f,i(y,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>b}),i(d,s,{__proto__:null,enumerable:!0,get:()=>b.pipeline}),i(g,s,{__proto__:null,enumerable:!0,get:()=>b.finished}),y.Stream=y,y._isUint8Array=e=>e instanceof Uint8Array,y._uint8ArrayToBuffer=e=>r.from(e.buffer,e.byteOffset,e.byteLength)})),Cr=M(((e,t)=>{j(),Pt(),pt();var r=Pr(),i=Tr(),n=r.Readable.destroy;t.exports=r.Readable,t.exports._uint8ArrayToBuffer=r._uint8ArrayToBuffer,t.exports._isUint8Array=r._isUint8Array,t.exports.isDisturbed=r.isDisturbed,t.exports.isErrored=r.isErrored,t.exports.isReadable=r.isReadable,t.exports.Readable=r.Readable,t.exports.Writable=r.Writable,t.exports.Duplex=r.Duplex,t.exports.Transform=r.Transform,t.exports.PassThrough=r.PassThrough,t.exports.addAbortSignal=r.addAbortSignal,t.exports.finished=r.finished,t.exports.destroy=r.destroy,t.exports.destroy=n,t.exports.pipeline=r.pipeline,t.exports.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get:()=>i}),t.exports.Stream=r.Stream,t.exports.default=t.exports})),Rr=M(((e,t)=>{j(),Pt(),pt(),t.exports="function"==typeof Object.create?(e,t)=>{t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:(e,t)=>{if(t){e.super_=t;var r=()=>{};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),Or=M(((e,t)=>{j(),Pt(),pt();var{Buffer:r}=(Tt(),U(gt)),i=Symbol.for("BufferList");function n(e){if(!(this instanceof n))return new n(e);n._init.call(this,e)}n._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},n.prototype._new=e=>new n(e),n.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){let i=t+this._bufs[r].length;if(e<i||r===this._bufs.length-1)return[r,e-t];t=i}},n.prototype._reverseOffset=function(e){let t=e[0],r=e[1];for(let e=0;e<t;e++)r+=this._bufs[e].length;return r},n.prototype.get=function(e){if(e>this.length||e<0)return;let t=this._offset(e);return this._bufs[t[0]][t[1]]},n.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},n.prototype.copy=function(e,t,i,n){if(("number"!=typeof i||i<0)&&(i=0),("number"!=typeof n||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||r.alloc(0);let o=!!e,s=this._offset(i),a=n-i,l=a,u=o&&t||0,h=s[1];if(0===i&&n===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:r.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(l<=this._bufs[s[0]].length-h)return o?this._bufs[s[0]].copy(e,t,h,h+l):this._bufs[s[0]].slice(h,h+l);o||(e=r.allocUnsafe(a));for(let t=s[0];t<this._bufs.length;t++){let r=this._bufs[t].length-h;if(!(l>r)){this._bufs[t].copy(e,u,h,h+l),u+=r;break}this._bufs[t].copy(e,u,h),u+=r,l-=r,h&&(h=0)}return e.length>u?e.slice(0,u):e},n.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();let r=this._offset(e),i=this._offset(t),n=this._bufs.slice(r[0],i[0]+1);return 0===i[1]?n.pop():n[n.length-1]=n[n.length-1].slice(0,i[1]),0!==r[1]&&(n[0]=n[0].slice(r[1])),this._new(n)},n.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},n.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},n.prototype.duplicate=function(){let e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},n.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(r.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(r.from(e));return this},n.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},n.prototype.indexOf=function(e,t,i){if(void 0===i&&"string"==typeof t&&(i=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=r.from([e]):"string"==typeof e?e=r.from(e,i):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=r.from(e.buffer,e.byteOffset,e.byteLength):r.isBuffer(e)||(e=r.from(e)),isNaN(t=Number(t||0))&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;let n=this._offset(t),o=n[0],s=n[1];for(;o<this._bufs.length;o++){let t=this._bufs[o];for(;s<t.length;)if(t.length-s>=e.length){let r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{let t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}s=0}return-1},n.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){let e={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 e)!function(t){n.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(r=0){return this.slice(r,r+e[t])[t](0)}}(t)}(),n.prototype._isBufferList=e=>e instanceof n||n.isBufferList(e),n.isBufferList=e=>null!=e&&e[i],t.exports=n})),Br=M(((e,t)=>{j(),Pt(),pt();var r=Cr().Duplex,i=Rr(),n=Or();function o(e){if(!(this instanceof o))return new o(e);if("function"==typeof e){this._callback=e;let t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(e=>{e.on("error",t)})),this.on("unpipe",(e=>{e.removeListener("error",t)})),e=null}n._init.call(this,e),r.call(this)}i(o,r),Object.assign(o.prototype,n.prototype),o.prototype._new=e=>new o(e),o.prototype._write=function(e,t,r){this._appendBuffer(e),"function"==typeof r&&r()},o.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},o.prototype.end=function(e){r.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},o.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},o.prototype._isBufferList=e=>e instanceof o||e instanceof n||o.isBufferList(e),o.isBufferList=n.isBufferList,t.exports=o,t.exports.BufferListStream=o,t.exports.BufferList=n})),xr=M(((e,t)=>{j(),Pt(),pt(),t.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}})),Mr=M(((e,t)=>{j(),Pt(),pt();var r=t.exports,{Buffer:i}=(Tt(),U(gt));r.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},r.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0},r.requiredHeaderFlagsErrors={};for(let e in r.requiredHeaderFlags){let t=r.requiredHeaderFlags[e];r.requiredHeaderFlagsErrors[e]="Invalid header flag bits, must be 0x"+t.toString(16)+" for "+r.types[e]+" packet"}r.codes={};for(let e in r.types){let t=r.types[e];r.codes[t]=e}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=i.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=i.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=i.from([r.codes.connect<<r.CMD_SHIFT]),r.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},r.propertiesCodes={};for(let e in r.properties){let t=r.properties[e];r.propertiesCodes[t]=e}function n(e){return[0,1,2].map((t=>[0,1].map((n=>[0,1].map((o=>{let s=i.alloc(1);return s.writeUInt8(r.codes[e]<<r.CMD_SHIFT|(n?r.DUP_MASK:0)|t<<r.QOS_SHIFT|o,0,!0),s}))))))}r.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"},r.PUBLISH_HEADER=n("publish"),r.SUBSCRIBE_HEADER=n("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=n("unsubscribe"),r.ACKS={unsuback:n("unsuback"),puback:n("puback"),pubcomp:n("pubcomp"),pubrel:n("pubrel"),pubrec:n("pubrec")},r.SUBACK_HEADER=i.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=i.from([3]),r.VERSION4=i.from([4]),r.VERSION5=i.from([5]),r.VERSION131=i.from([131]),r.VERSION132=i.from([132]),r.QOS=[0,1,2].map((e=>i.from([e]))),r.EMPTY={pingreq:i.from([r.codes.pingreq<<4,0]),pingresp:i.from([r.codes.pingresp<<4,0]),disconnect:i.from([r.codes.disconnect<<4,0])},r.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"},r.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},r.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},r.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"},r.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},r.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}})),Lr=M(((e,t)=>{j(),Pt(),pt();var r=1e3,i=6e4,n=60*i,o=24*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}t.exports=(e,t)=>{t=t||{};var a=typeof e;if("string"===a&&e.length>0)return function(e){if(!((e+="").length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*i;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===a&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=o?s(e,t,o,"day"):t>=n?s(e,t,n,"hour"):t>=i?s(e,t,i,"minute"):t>=r?s(e,t,r,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=n?Math.round(e/n)+"h":t>=i?Math.round(e/i)+"m":t>=r?Math.round(e/r)+"s":e+"ms"}(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}})),Ur=M(((e,t)=>{j(),Pt(),pt(),t.exports=function(e){function t(e){let i,n,o,s=null;function a(...e){if(!a.enabled)return;let r=a,n=Number(new Date),o=n-(i||n);r.diff=o,r.prev=i,r.curr=n,i=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((i,n)=>{if("%%"===i)return"%";s++;let o=t.formatters[n];if("function"==typeof o){let t=e[s];i=o.call(r,t),e.splice(s,1),s--}return i})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set(e){s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){let i=t(this.namespace+(typeof r>"u"?":":r)+e);return i.log=this.log,i}function i(e,t){let r=0,i=0,n=-1,o=0;for(;r<e.length;)if(i<t.length&&(t[i]===e[r]||"*"===t[i]))"*"===t[i]?(n=i,o=r,i++):(r++,i++);else{if(-1===n)return!1;i=n+1,o++,r=o}for(;i<t.length&&"*"===t[i];)i++;return i===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(let e of r)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(let r of t.skips)if(i(e,r))return!1;for(let r of t.names)if(i(e,r))return!0;return!1},t.humanize=Lr(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}})),jr=M(((e,t)=>{j(),Pt(),pt(),e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let i=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))})),e.splice(n,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(e){}return!t&&typeof N<"u"&&"env"in N&&(t=N.env.DEBUG),t},e.useColors=function(){if(typeof window<"u"&&window.process&&("renderer"===window.process.type||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+)/)},e.storage=function(){try{return localStorage}catch(e){}}(),e.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`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=Ur()(e);var{formatters:r}=t.exports;r.j=e=>{try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),Nr=M(((e,t)=>{j(),Pt(),pt();var r=Br(),{EventEmitter:i}=(nr(),U(Jt)),n=xr(),o=Mr(),s=jr()("mqtt-packet:parser");t.exports=class e extends i{static parser(t){return this instanceof e?(this.settings=t||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new e).parser(t)}_resetState(){s("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new n,this.error=null,this._list=r(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),s("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,s("parse: state complete. _stateCounter is now: %d",this._stateCounter),s("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return s("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0),t=e>>o.CMD_SHIFT;this.packet.cmd=o.types[t];let r=15&e,i=o.requiredHeaderFlags[t];return null!=i&&r!==i?this._emitError(Error(o.requiredHeaderFlagsErrors[t])):(this.packet.retain=!!(e&o.RETAIN_MASK),this.packet.qos=e>>o.QOS_SHIFT&o.QOS_MASK,this.packet.qos>2?this._emitError(Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=!!(e&o.DUP_MASK),s("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),s("_parseLength %d",e.value),!!e}_parsePayload(){s("_parsePayload: payload %O",this._list);let e=!1;if(0===this.packet.length||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(Error("Not supported"))}e=!0}return s("_parsePayload complete result: %s",e),e}_parseConnect(){s("_parseConnect");let e,t,r,i,n={},a=this.packet,l=this._parseString();if(null===l)return this._emitError(Error("Cannot parse protocolId"));if("MQTT"!==l&&"MQIsdp"!==l)return this._emitError(Error("Invalid protocolId"));if(a.protocolId=l,this._pos>=this._list.length)return this._emitError(Error("Packet too short"));if(a.protocolVersion=this._list.readUInt8(this._pos),a.protocolVersion>=128&&(a.bridgeMode=!0,a.protocolVersion=a.protocolVersion-128),3!==a.protocolVersion&&4!==a.protocolVersion&&5!==a.protocolVersion)return this._emitError(Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(Error("Packet too short"));if(1&this._list.readUInt8(this._pos))return this._emitError(Error("Connect flag bit 0 must be 0, but got 1"));n.username=this._list.readUInt8(this._pos)&o.USERNAME_MASK,n.password=this._list.readUInt8(this._pos)&o.PASSWORD_MASK,n.will=this._list.readUInt8(this._pos)&o.WILL_FLAG_MASK;let u=!!(this._list.readUInt8(this._pos)&o.WILL_RETAIN_MASK),h=(this._list.readUInt8(this._pos)&o.WILL_QOS_MASK)>>o.WILL_QOS_SHIFT;if(n.will)a.will={},a.will.retain=u,a.will.qos=h;else{if(u)return this._emitError(Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(h)return this._emitError(Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(a.clean=!!(this._list.readUInt8(this._pos)&o.CLEAN_SESSION_MASK),this._pos++,a.keepalive=this._parseNum(),-1===a.keepalive)return this._emitError(Error("Packet too short"));if(5===a.protocolVersion){let e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(a.properties=e)}let c=this._parseString();if(null===c)return this._emitError(Error("Packet too short"));if(a.clientId=c,s("_parseConnect: packet.clientId: %s",a.clientId),n.will){if(5===a.protocolVersion){let e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(a.will.properties=e)}if(e=this._parseString(),null===e)return this._emitError(Error("Cannot parse will topic"));if(a.will.topic=e,s("_parseConnect: packet.will.topic: %s",a.will.topic),t=this._parseBuffer(),null===t)return this._emitError(Error("Cannot parse will payload"));a.will.payload=t,s("_parseConnect: packet.will.paylaod: %s",a.will.payload)}if(n.username){if(i=this._parseString(),null===i)return this._emitError(Error("Cannot parse username"));a.username=i,s("_parseConnect: packet.username: %s",a.username)}if(n.password){if(r=this._parseBuffer(),null===r)return this._emitError(Error("Cannot parse password"));a.password=r}return this.settings=a,s("_parseConnect: complete"),a}_parseConnack(){s("_parseConnack");let e=this.packet;if(this._list.length<1)return null;let t=this._list.readUInt8(this._pos++);if(t>1)return this._emitError(Error("Invalid connack flags, bits 7-1 must be set to 0"));if(e.sessionPresent=!!(t&o.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(-1===e.returnCode||-1===e.reasonCode)return this._emitError(Error("Cannot parse return code"));if(5===this.settings.protocolVersion){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}s("_parseConnack: complete")}_parsePublish(){s("_parsePublish");let e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),s("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){s("_parseSubscribe");let e,t,r,i,n,a,l,u=this.packet;if(u.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){let e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(u.properties=e)}if(u.length<=0)return this._emitError(Error("Malformed subscribe, no payload specified"));for(;this._pos<u.length;){if(e=this._parseString(),null===e)return this._emitError(Error("Cannot parse topic"));if(this._pos>=u.length)return this._emitError(Error("Malformed Subscribe Payload"));if(t=this._parseByte(),5===this.settings.protocolVersion){if(192&t)return this._emitError(Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(252&t)return this._emitError(Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(r=t&o.SUBSCRIBE_OPTIONS_QOS_MASK,r>2)return this._emitError(Error("Invalid subscribe QoS, must be <= 2"));if(a=!!(t>>o.SUBSCRIBE_OPTIONS_NL_SHIFT&o.SUBSCRIBE_OPTIONS_NL_MASK),n=!!(t>>o.SUBSCRIBE_OPTIONS_RAP_SHIFT&o.SUBSCRIBE_OPTIONS_RAP_MASK),i=t>>o.SUBSCRIBE_OPTIONS_RH_SHIFT&o.SUBSCRIBE_OPTIONS_RH_MASK,i>2)return this._emitError(Error("Invalid retain handling, must be <= 2"));l={topic:e,qos:r},5===this.settings.protocolVersion?(l.nl=a,l.rap=n,l.rh=i):this.settings.bridgeMode&&(l.rh=0,l.rap=!0,l.nl=!0),s("_parseSubscribe: push subscription `%s` to subscription",l),u.subscriptions.push(l)}}}_parseSuback(){s("_parseSuback");let e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}if(e.length<=0)return this._emitError(Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let e=this._list.readUInt8(this._pos++);if(5===this.settings.protocolVersion){if(!o.MQTT5_SUBACK_CODES[e])return this._emitError(Error("Invalid suback code"))}else if(e>2&&128!==e)return this._emitError(Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(e)}}}_parseUnsubscribe(){s("_parseUnsubscribe");let e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}if(e.length<=0)return this._emitError(Error("Malformed unsubscribe, no payload specified"));for(;this._pos<e.length;){let t=this._parseString();if(null===t)return this._emitError(Error("Cannot parse topic"));s("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){s("_parseUnsuback");let e=this.packet;if(!this._parseMessageId())return this._emitError(Error("Cannot parse messageId"));if((3===this.settings.protocolVersion||4===this.settings.protocolVersion)&&2!==e.length)return this._emitError(Error("Malformed unsuback, payload length must be 2"));if(e.length<=0)return this._emitError(Error("Malformed unsuback, no payload specified"));if(5===this.settings.protocolVersion){let t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;){let e=this._list.readUInt8(this._pos++);if(!o.MQTT5_UNSUBACK_CODES[e])return this._emitError(Error("Invalid unsuback code"));this.packet.granted.push(e)}}}_parseConfirmation(){s("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion){if(e.length>2){switch(e.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!o.MQTT5_PUBACK_PUBREC_CODES[e.reasonCode])return this._emitError(Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!o.MQTT5_PUBREL_PUBCOMP_CODES[e.reasonCode])return this._emitError(Error("Invalid "+this.packet.cmd+" reason code"))}s("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)}else e.reasonCode=0;if(e.length>3){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}}return!0}_parseDisconnect(){let e=this.packet;if(s("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?(e.reasonCode=this._parseByte(),o.MQTT5_DISCONNECT_CODES[e.reasonCode]||this._emitError(Error("Invalid disconnect reason code"))):e.reasonCode=0;let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return s("_parseDisconnect result: true"),!0}_parseAuth(){s("_parseAuth");let e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(Error("Not supported auth packet for this version MQTT"));if(e.reasonCode=this._parseByte(),!o.MQTT5_AUTH_CODES[e.reasonCode])return this._emitError(Error("Invalid auth reason code"));let t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),s("_parseAuth: result: true"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(Error("Cannot parse messageId")),!1):(s("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;let i=this._list.toString("utf8",this._pos,r);return this._pos+=t,s("_parseString: result: %s",i),i}_parseStringPair(){return s("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;let r=this._list.slice(this._pos,t);return this._pos+=e,s("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,s("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,s("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){s("_parseVarByteNum");let t,r=0,i=1,n=0,a=!1,l=this._pos?this._pos:0;for(;r<4&&l+r<this._list.length;){if(t=this._list.readUInt8(l+r++),n+=i*(t&o.VARBYTEINT_MASK),i*=128,!(t&o.VARBYTEINT_FIN_MASK)){a=!0;break}if(this._list.length<=r)break}return!a&&4===r&&this._list.length>=r&&this._emitError(Error("Invalid variable byte integer")),l&&(this._pos+=r),a=!!a&&(e?{bytes:r,value:n}:n),s("_parseVarByteNum: result: %o",a),a}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),s("_parseByte: result: %o",e),e}_parseByType(e){switch(s("_parseByType: type: %s",e),e){case"byte":return 0!==this._parseByte();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(){s("_parseProperties");let e=this._parseVarByteNum(),t=this._pos+e,r={};for(;this._pos<t;){let e=this._parseByte();if(!e)return this._emitError(Error("Cannot parse property code type")),!1;let t=o.propertiesCodes[e];if(!t)return this._emitError(Error("Unknown property")),!1;if("userProperties"!==t)r[t]?(Array.isArray(r[t])||(r[t]=[r[t]]),r[t].push(this._parseByType(o.propertiesTypes[t]))):r[t]=this._parseByType(o.propertiesTypes[t]);else{r[t]||(r[t]=Object.create(null));let e=this._parseByType(o.propertiesTypes[t]);if(r[t][e.name])if(Array.isArray(r[t][e.name]))r[t][e.name].push(e.value);else{let i=r[t][e.name];r[t][e.name]=[i],r[t][e.name].push(e.value)}else r[t][e.name]=e.value}}return r}_newPacket(){return s("_newPacket"),this.packet&&(this._list.consume(this.packet.length),s("_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)),s("_newPacket: new packet"),this.packet=new n,this._pos=0,!0}_emitError(e){s("_emitError",e),this.error=e,this.emit("error",e)}constructor(){super(),this.parser=this.constructor.parser}}})),Dr=M(((e,t)=>{j(),Pt(),pt();var{Buffer:r}=(Tt(),U(gt)),i={},n=r.isBuffer(r.from([1,2]).subarray(0,1));function o(e){let t=r.allocUnsafe(2);return t.writeUInt8(e>>8,0),t.writeUInt8(255&e,1),t}t.exports={cache:i,generateCache(){for(let e=0;e<65536;e++)i[e]=o(e)},generateNumber:o,genBufVariableByteInt(e){let t=0,i=0,o=r.allocUnsafe(4);do{t=e%128|0,(e=e/128|0)>0&&(t|=128),o.writeUInt8(t,i++)}while(e>0&&i<4);return e>0&&(i=0),n?o.subarray(0,i):o.slice(0,i)},generate4ByteBuffer(e){let t=r.allocUnsafe(4);return t.writeUInt32BE(e,0),t}}})),Wr=M(((e,t)=>{j(),Pt(),pt(),typeof N>"u"||!N.version||0===N.version.indexOf("v0.")||0===N.version.indexOf("v1.")&&0!==N.version.indexOf("v1.8.")?t.exports={nextTick(e,t,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var n,o,s=arguments.length;switch(s){case 0:case 1:return N.nextTick(e);case 2:return N.nextTick((()=>{e.call(null,t)}));case 3:return N.nextTick((()=>{e.call(null,t,r)}));case 4:return N.nextTick((()=>{e.call(null,t,r,i)}));default:for(n=Array(s-1),o=0;o<n.length;)n[o++]=arguments[o];return N.nextTick((()=>{e.apply(null,n)}))}}}:t.exports=N})),Fr=M(((e,t)=>{j(),Pt(),pt();var r=Mr(),{Buffer:i}=(Tt(),U(gt)),n=i.allocUnsafe(0),o=i.from([0]),s=Dr(),a=Wr().nextTick,l=jr()("mqtt-packet:writeToStream"),u=s.cache,h=s.generateNumber,c=s.generateCache,f=s.genBufVariableByteInt,d=s.generate4ByteBuffer,p=E,g=!0;function b(e,t,s){switch(l("generate called"),t.cork&&(t.cork(),a(m,t)),g&&(g=!1,c()),l("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return function(e,t){let n=e||{},o=n.protocolId||"MQTT",s=n.protocolVersion||4,a=n.will,l=n.clean,u=n.keepalive||0,h=n.clientId||"",c=n.username,f=n.password,d=n.properties;void 0===l&&(l=!0);let g,b,m=0;if("string"!=typeof o&&!i.isBuffer(o))return t.destroy(Error("Invalid protocolId")),!1;if(m+=o.length+2,3!==s&&4!==s&&5!==s)return t.destroy(Error("Invalid protocol version")),!1;if(m+=1,("string"==typeof h||i.isBuffer(h))&&(h||s>=4)&&(h||l))m+=i.byteLength(h)+2;else{if(s<4)return t.destroy(Error("clientId must be supplied before 3.1.1")),!1;if(1*l==0)return t.destroy(Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof u||u<0||u>65535||u%1!=0)return t.destroy(Error("Invalid keepalive")),!1;if(m+=2,m+=1,5===s){if(g=k(t,d),!g)return!1;m+=g.length}if(a){if("object"!=typeof a)return t.destroy(Error("Invalid will")),!1;if(!a.topic||"string"!=typeof a.topic)return t.destroy(Error("Invalid will topic")),!1;if(m+=i.byteLength(a.topic)+2,m+=2,a.payload){if(!(a.payload.length>=0))return t.destroy(Error("Invalid will payload")),!1;"string"==typeof a.payload?m+=i.byteLength(a.payload):m+=a.payload.length}if(b={},5===s){if(b=k(t,a.properties),!b)return!1;m+=b.length}}let y=!1;if(null!=c){if(!R(c))return t.destroy(Error("Invalid username")),!1;y=!0,m+=i.byteLength(c)+2}if(null!=f){if(!y)return t.destroy(Error("Username is required to use password")),!1;if(!R(f))return t.destroy(Error("Invalid password")),!1;m+=C(f)+2}t.write(r.CONNECT_HEADER),v(t,m),A(t,o),n.bridgeMode&&(s+=128),t.write(131===s?r.VERSION131:132===s?r.VERSION132:4===s?r.VERSION4:5===s?r.VERSION5:r.VERSION3);let _=0;return _|=null!=c?r.USERNAME_MASK:0,_|=null!=f?r.PASSWORD_MASK:0,_|=a&&a.retain?r.WILL_RETAIN_MASK:0,_|=a&&a.qos?a.qos<<r.WILL_QOS_SHIFT:0,_|=a?r.WILL_FLAG_MASK:0,_|=l?r.CLEAN_SESSION_MASK:0,t.write(i.from([_])),p(t,u),5===s&&g.write(),A(t,h),a&&(5===s&&b.write(),w(t,a.topic),A(t,a.payload)),null!=c&&A(t,c),null!=f&&A(t,f),!0}(e,t);case"connack":return function(e,t,n){let s=n?n.protocolVersion:4,a=e||{},l=5===s?a.reasonCode:a.returnCode,u=a.properties,h=2;if("number"!=typeof l)return t.destroy(Error("Invalid return code")),!1;let c=null;if(5===s){if(c=k(t,u),!c)return!1;h+=c.length}return t.write(r.CONNACK_HEADER),v(t,h),t.write(a.sessionPresent?r.SESSIONPRESENT_HEADER:o),t.write(i.from([l])),null==c||c.write(),!0}(e,t,s);case"publish":return function(e,t,o){l("publish: packet: %o",e);let s=o?o.protocolVersion:4,a=e||{},u=a.qos||0,h=a.retain?r.RETAIN_MASK:0,c=a.topic,f=a.payload||n,d=a.messageId,g=a.properties,b=0;if("string"==typeof c)b+=i.byteLength(c)+2;else{if(!i.isBuffer(c))return t.destroy(Error("Invalid topic")),!1;b+=c.length+2}if(i.isBuffer(f)?b+=f.length:b+=i.byteLength(f),u&&"number"!=typeof d)return t.destroy(Error("Invalid messageId")),!1;u&&(b+=2);let m=null;if(5===s){if(m=k(t,g),!m)return!1;b+=m.length}return t.write(r.PUBLISH_HEADER[u][a.dup?1:0][h?1:0]),v(t,b),p(t,C(c)),t.write(c),u>0&&p(t,d),null==m||m.write(),l("publish: payload: %o",f),t.write(f)}(e,t,s);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(e,t,n){let o=n?n.protocolVersion:4,s=e||{},a=s.cmd||"puback",l=s.messageId,u=s.dup&&"pubrel"===a?r.DUP_MASK:0,h=0,c=s.reasonCode,f=s.properties,d=5===o?3:2;if("pubrel"===a&&(h=1),"number"!=typeof l)return t.destroy(Error("Invalid messageId")),!1;let g=null;if(5===o&&"object"==typeof f){if(g=I(t,f,n,d),!g)return!1;d+=g.length}return t.write(r.ACKS[a][h][u][0]),3===d&&(d+=0!==c?1:-1),v(t,d),p(t,l),5===o&&2!==d&&t.write(i.from([c])),null!==g?g.write():4===d&&t.write(i.from([0])),!0}(e,t,s);case"subscribe":return function(e,t,n){l("subscribe: packet: ");let o=n?n.protocolVersion:4,s=e||{},a=s.dup?r.DUP_MASK:0,u=s.messageId,h=s.subscriptions,c=s.properties,f=0;if("number"!=typeof u)return t.destroy(Error("Invalid messageId")),!1;f+=2;let d=null;if(5===o){if(d=k(t,c),!d)return!1;f+=d.length}if("object"!=typeof h||!h.length)return t.destroy(Error("Invalid subscriptions")),!1;for(let e=0;e<h.length;e+=1){let r=h[e].topic,n=h[e].qos;if("string"!=typeof r)return t.destroy(Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof n)return t.destroy(Error("Invalid subscriptions - invalid qos")),!1;if(5===o){if("boolean"!=typeof(h[e].nl||!1))return t.destroy(Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(h[e].rap||!1))return t.destroy(Error("Invalid subscriptions - invalid Retain as Published")),!1;let r=h[e].rh||0;if("number"!=typeof r||r>2)return t.destroy(Error("Invalid subscriptions - invalid Retain Handling")),!1}f+=i.byteLength(r)+2+1}l("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),t.write(r.SUBSCRIBE_HEADER[1][a?1:0][0]),v(t,f),p(t,u),null!==d&&d.write();let g=!0;for(let e of h){let n,s=e.topic,a=e.qos,l=+e.nl,u=+e.rap,h=e.rh;w(t,s),n=r.SUBSCRIBE_OPTIONS_QOS[a],5===o&&(n|=l?r.SUBSCRIBE_OPTIONS_NL:0,n|=u?r.SUBSCRIBE_OPTIONS_RAP:0,n|=h?r.SUBSCRIBE_OPTIONS_RH[h]:0),g=t.write(i.from([n]))}return g}(e,t,s);case"suback":return function(e,t,n){let o=n?n.protocolVersion:4,s=e||{},a=s.messageId,l=s.granted,u=s.properties,h=0;if("number"!=typeof a)return t.destroy(Error("Invalid messageId")),!1;if(h+=2,"object"!=typeof l||!l.length)return t.destroy(Error("Invalid qos vector")),!1;for(let e=0;e<l.length;e+=1){if("number"!=typeof l[e])return t.destroy(Error("Invalid qos vector")),!1;h+=1}let c=null;if(5===o){if(c=I(t,u,n,h),!c)return!1;h+=c.length}return t.write(r.SUBACK_HEADER),v(t,h),p(t,a),null!==c&&c.write(),t.write(i.from(l))}(e,t,s);case"unsubscribe":return function(e,t,n){let o=n?n.protocolVersion:4,s=e||{},a=s.messageId,l=s.dup?r.DUP_MASK:0,u=s.unsubscriptions,h=s.properties,c=0;if("number"!=typeof a)return t.destroy(Error("Invalid messageId")),!1;if(c+=2,"object"!=typeof u||!u.length)return t.destroy(Error("Invalid unsubscriptions")),!1;for(let e=0;e<u.length;e+=1){if("string"!=typeof u[e])return t.destroy(Error("Invalid unsubscriptions")),!1;c+=i.byteLength(u[e])+2}let f=null;if(5===o){if(f=k(t,h),!f)return!1;c+=f.length}t.write(r.UNSUBSCRIBE_HEADER[1][l?1:0][0]),v(t,c),p(t,a),null!==f&&f.write();let d=!0;for(let e=0;e<u.length;e++)d=w(t,u[e]);return d}(e,t,s);case"unsuback":return function(e,t,n){let o=n?n.protocolVersion:4,s=e||{},a=s.messageId,l=s.dup?r.DUP_MASK:0,u=s.granted,h=s.properties,c=s.cmd,f=2;if("number"!=typeof a)return t.destroy(Error("Invalid messageId")),!1;if(5===o){if("object"!=typeof u||!u.length)return t.destroy(Error("Invalid qos vector")),!1;for(let e=0;e<u.length;e+=1){if("number"!=typeof u[e])return t.destroy(Error("Invalid qos vector")),!1;f+=1}}let d=null;if(5===o){if(d=I(t,h,n,f),!d)return!1;f+=d.length}return t.write(r.ACKS[c][0][l][0]),v(t,f),p(t,a),null!==d&&d.write(),5===o&&t.write(i.from(u)),!0}(e,t,s);case"pingreq":case"pingresp":return function(e,t){return t.write(r.EMPTY[e.cmd])}(e,t);case"disconnect":return function(e,t,n){let o=n?n.protocolVersion:4,s=e||{},a=s.reasonCode,l=s.properties,u=5===o?1:0,h=null;if(5===o){if(h=I(t,l,n,u),!h)return!1;u+=h.length}return t.write(i.from([r.codes.disconnect<<4])),v(t,u),5===o&&t.write(i.from([a])),null!==h&&h.write(),!0}(e,t,s);case"auth":return function(e,t,n){let o=n?n.protocolVersion:4,s=e||{},a=s.reasonCode,l=s.properties,u=5===o?1:0;5!==o&&t.destroy(Error("Invalid mqtt version for auth packet"));let h=I(t,l,n,u);return!!h&&(u+=h.length,t.write(i.from([r.codes.auth<<4])),v(t,u),t.write(i.from([a])),null!==h&&h.write(),!0)}(e,t,s);default:return t.destroy(Error("Unknown command")),!1}}function m(e){e.uncork()}Object.defineProperty(b,"cacheNumbers",{get:()=>p===E,set(e){e?((!u||0===Object.keys(u).length)&&(g=!0),p=E):(g=!1,p=S)}});var y={};function v(e,t){if(t>r.VARBYTEINT_MAX)return e.destroy(Error("Invalid variable byte integer: "+t)),!1;let i=y[t];return i||(i=f(t),t<16384&&(y[t]=i)),l("writeVarByteInt: writing to stream: %o",i),e.write(i)}function w(e,t){let r=i.byteLength(t);return p(e,r),l("writeString: %s",t),e.write(t,"utf8")}function _(e,t,r){w(e,t),w(e,r)}function E(e,t){return l("writeNumberCached: number: %d",t),l("writeNumberCached: %o",u[t]),e.write(u[t])}function S(e,t){let r=h(t);return l("writeNumberGenerated: %o",r),e.write(r)}function A(e,t){"string"==typeof t?w(e,t):t?(p(e,t.length),e.write(t)):p(e,0)}function k(e,t){if("object"!=typeof t||null!=t.length)return{length:1,write(){P(e,{},0)}};let n=0;function o(t,n){let o=0;switch(r.propertiesTypes[t]){case"byte":if("boolean"!=typeof n)return e.destroy(Error(`Invalid ${t}: ${n}`)),!1;o+=2;break;case"int8":if("number"!=typeof n||n<0||n>255)return e.destroy(Error(`Invalid ${t}: ${n}`)),!1;o+=2;break;case"binary":if(n&&null===n)return e.destroy(Error(`Invalid ${t}: ${n}`)),!1;o+=1+i.byteLength(n)+2;break;case"int16":if("number"!=typeof n||n<0||n>65535)return e.destroy(Error(`Invalid ${t}: ${n}`)),!1;o+=3;break;case"int32":if("number"!=typeof n||n<0||n>4294967295)return e.destroy(Error(`Invalid ${t}: ${n}`)),!1;o+=5;break;case"var":if("number"!=typeof n||n<0||n>268435455)return e.destroy(Error(`Invalid ${t}: ${n}`)),!1;o+=1+i.byteLength(f(n));break;case"string":if("string"!=typeof n)return e.destroy(Error(`Invalid ${t}: ${n}`)),!1;o+=3+i.byteLength(n.toString());break;case"pair":if("object"!=typeof n)return e.destroy(Error(`Invalid ${t}: ${n}`)),!1;o+=Object.getOwnPropertyNames(n).reduce(((e,t)=>{let r=n[t];return e+(Array.isArray(r)?r.reduce(((e,r)=>e+(3+i.byteLength(t.toString())+2+i.byteLength(r.toString()))),0):3+i.byteLength(t.toString())+2+i.byteLength(n[t].toString()))}),0);break;default:return e.destroy(Error(`Invalid property ${t}: ${n}`)),!1}return o}if(t)for(let e in t){let r=0,i=0,s=t[e];if(Array.isArray(s))for(let t=0;t<s.length;t++){if(i=o(e,s[t]),!i)return!1;r+=i}else{if(i=o(e,s),!i)return!1;r=i}if(!r)return!1;n+=r}return{length:i.byteLength(f(n))+n,write(){P(e,t,n)}}}function I(e,t,r,i){let n=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0,s=k(e,t);if(o)for(;i+s.length>o;){let r=n.shift();if(!r||!t[r])return!1;delete t[r],s=k(e,t)}return s}function T(e,t,n){switch(r.propertiesTypes[t]){case"byte":e.write(i.from([r.properties[t]])),e.write(i.from([+n]));break;case"int8":e.write(i.from([r.properties[t]])),e.write(i.from([n]));break;case"binary":e.write(i.from([r.properties[t]])),A(e,n);break;case"int16":e.write(i.from([r.properties[t]])),p(e,n);break;case"int32":e.write(i.from([r.properties[t]])),function(e,t){let r=d(t);l("write4ByteNumber: %o",r),e.write(r)}(e,n);break;case"var":e.write(i.from([r.properties[t]])),v(e,n);break;case"string":e.write(i.from([r.properties[t]])),w(e,n);break;case"pair":Object.getOwnPropertyNames(n).forEach((o=>{let s=n[o];Array.isArray(s)?s.forEach((n=>{e.write(i.from([r.properties[t]])),_(e,o.toString(),n.toString())})):(e.write(i.from([r.properties[t]])),_(e,o.toString(),s.toString()))}));break;default:return e.destroy(Error(`Invalid property ${t} value: ${n}`)),!1}}function P(e,t,r){v(e,r);for(let r in t)if({}.hasOwnProperty.call(t,r)&&null!==t[r]){let i=t[r];if(Array.isArray(i))for(let t=0;t<i.length;t++)T(e,r,i[t]);else T(e,r,i)}}function C(e){return e?e instanceof i?e.length:i.byteLength(e):0}function R(e){return"string"==typeof e||e instanceof i}t.exports=b})),qr=M(((e,t)=>{j(),Pt(),pt();var r=Fr(),{EventEmitter:i}=(nr(),U(Jt)),{Buffer:n}=(Tt(),U(gt)),o=class extends i{write(e){return this._array[this._i++]=e,!0}concat(){let e,t=0,r=Array(this._array.length),i=this._array,o=0;for(e=0;e<i.length&&void 0!==i[e];e++)"string"!=typeof i[e]?r[e]=i[e].length:r[e]=n.byteLength(i[e]),t+=r[e];let s=n.allocUnsafe(t);for(e=0;e<i.length&&void 0!==i[e];e++)"string"!=typeof i[e]?(i[e].copy(s,o),o+=r[e]):(s.write(i[e],o),o+=r[e]);return s}destroy(e){e&&this.emit("error",e)}constructor(){super(),this._array=Array(20),this._i=0}};t.exports=function(e,t){let i=new o;return r(e,i,t),i.concat()}})),$r=M((e=>{j(),Pt(),pt(),e.parser=Nr().parser,e.generate=qr(),e.writeToStream=Fr()})),Hr=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{allocate(){let e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e}getLastAllocated(){return 1===this.nextId?65535:this.nextId-1}register(e){return!0}deallocate(e){}clear(){}constructor(){this.nextId=Math.max(1,Math.floor(65535*Math.random()))}}})),Vr=M(((e,t)=>{function r(e){return e instanceof At?At.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}j(),Pt(),pt(),t.exports=function(e){if((e=e||{}).circles)return function(e){let t=[],i=[],n=new Map;if(n.set(Date,(e=>new Date(e))),n.set(Map,((e,t)=>new Map(s(Array.from(e),t)))),n.set(Set,((e,t)=>new Set(s(Array.from(e),t)))),e.constructorHandlers)for(let t of e.constructorHandlers)n.set(t[0],t[1]);let o=null;return e.proto?function e(a){if("object"!=typeof a||null===a)return a;if(Array.isArray(a))return s(a,e);if(a.constructor!==Object&&(o=n.get(a.constructor)))return o(a,e);let l={};t.push(a),i.push(l);for(let s in a){let u=a[s];if("object"!=typeof u||null===u)l[s]=u;else if(u.constructor!==Object&&(o=n.get(u.constructor)))l[s]=o(u,e);else if(ArrayBuffer.isView(u))l[s]=r(u);else{let r=t.indexOf(u);l[s]=-1!==r?i[r]:e(u)}}return t.pop(),i.pop(),l}:function e(a){if("object"!=typeof a||null===a)return a;if(Array.isArray(a))return s(a,e);if(a.constructor!==Object&&(o=n.get(a.constructor)))return o(a,e);let l={};t.push(a),i.push(l);for(let s in a){if(!1===Object.hasOwnProperty.call(a,s))continue;let u=a[s];if("object"!=typeof u||null===u)l[s]=u;else if(u.constructor!==Object&&(o=n.get(u.constructor)))l[s]=o(u,e);else if(ArrayBuffer.isView(u))l[s]=r(u);else{let r=t.indexOf(u);l[s]=-1!==r?i[r]:e(u)}}return t.pop(),i.pop(),l};function s(e,s){let a=Object.keys(e),l=Array(a.length);for(let u=0;u<a.length;u++){let h=a[u],c=e[h];if("object"!=typeof c||null===c)l[h]=c;else if(c.constructor!==Object&&(o=n.get(c.constructor)))l[h]=o(c,s);else if(ArrayBuffer.isView(c))l[h]=r(c);else{let e=t.indexOf(c);l[h]=-1!==e?i[e]:s(c)}}return l}}(e);let t=new Map;if(t.set(Date,(e=>new Date(e))),t.set(Map,((e,t)=>new Map(n(Array.from(e),t)))),t.set(Set,((e,t)=>new Set(n(Array.from(e),t)))),e.constructorHandlers)for(let r of e.constructorHandlers)t.set(r[0],r[1]);let i=null;return e.proto?function e(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return n(o,e);if(o.constructor!==Object&&(i=t.get(o.constructor)))return i(o,e);let s={};for(let n in o){let a=o[n];"object"!=typeof a||null===a?s[n]=a:a.constructor!==Object&&(i=t.get(a.constructor))?s[n]=i(a,e):ArrayBuffer.isView(a)?s[n]=r(a):s[n]=e(a)}return s}:function e(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return n(o,e);if(o.constructor!==Object&&(i=t.get(o.constructor)))return i(o,e);let s={};for(let n in o){if(!1===Object.hasOwnProperty.call(o,n))continue;let a=o[n];"object"!=typeof a||null===a?s[n]=a:a.constructor!==Object&&(i=t.get(a.constructor))?s[n]=i(a,e):ArrayBuffer.isView(a)?s[n]=r(a):s[n]=e(a)}return s};function n(e,n){let o=Object.keys(e),s=Array(o.length);for(let a=0;a<o.length;a++){let l=o[a],u=e[l];"object"!=typeof u||null===u?s[l]=u:u.constructor!==Object&&(i=t.get(u.constructor))?s[l]=i(u,n):ArrayBuffer.isView(u)?s[l]=r(u):s[l]=n(u)}return s}}})),zr=M(((e,t)=>{j(),Pt(),pt(),t.exports=Vr()()})),Kr=M((e=>{function t(e){let t=e.split("/");for(let e=0;e<t.length;e++)if("+"!==t[e]){if("#"===t[e])return e===t.length-1;if(-1!==t[e].indexOf("+")||-1!==t[e].indexOf("#"))return!1}return!0}j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.validateTopic=t,e.validateTopics=function(e){if(0===e.length)return"empty_topic_list";for(let r=0;r<e.length;r++)if(!t(e[r]))return e[r];return null}})),Gr=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0});var t=Cr(),r={objectMode:!0},i={clean:!0};e.default=class{put(e,t){return this._inflights.set(e.messageId,e),t&&t(),this}createStream(){let e=new t.Readable(r),i=[],n=!1,o=0;return this._inflights.forEach((e=>{i.push(e)})),e._read=()=>{!n&&o<i.length?e.push(i[o++]):e.push(null)},e.destroy=()=>{if(!n)return n=!0,setTimeout((()=>{e.emit("close")}),0),e},e}del(e,t){let r=this._inflights.get(e.messageId);return r?(this._inflights.delete(e.messageId),t(null,r)):t&&t(Error("missing packet")),this}get(e,t){let r=this._inflights.get(e.messageId);return r?t(null,r):t&&t(Error("missing packet")),this}close(e){this.options.clean&&(this._inflights=null),e&&e()}constructor(e){this.options=e||{},this.options=Object.assign(Object.assign({},i),e),this._inflights=new Map}}})),Qr=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0});var t=[0,16,128,131,135,144,145,151,153];e.default=(e,r,i)=>{e.log("handlePublish: packet %o",r),i=typeof i<"u"?i:e.noop;let n=r.topic.toString(),o=r.payload,{qos:s}=r,{messageId:a}=r,{options:l}=e;if(5===e.options.protocolVersion){let t;if(r.properties&&(t=r.properties.topicAlias),typeof t<"u")if(0===n.length){if(!(t>0&&t<=65535))return e.log("handlePublish :: topic alias out of range. alias: %d",t),void e.emit("error",Error("Received Topic Alias is out of range"));{let r=e.topicAliasRecv.getTopicByAlias(t);if(!r)return e.log("handlePublish :: unregistered topic alias. alias: %d",t),void e.emit("error",Error("Received unregistered Topic Alias"));n=r,e.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",n,t)}}else{if(!e.topicAliasRecv.put(n,t))return e.log("handlePublish :: topic alias out of range. alias: %d",t),void e.emit("error",Error("Received Topic Alias is out of range"));e.log("handlePublish :: registered topic: %s - alias: %d",n,t)}}switch(e.log("handlePublish: qos %d",s),s){case 2:l.customHandleAcks(n,o,r,((n,o)=>("number"==typeof n&&(o=n,n=null),n?e.emit("error",n):-1===t.indexOf(o)?e.emit("error",Error("Wrong reason code for pubrec")):void(o?e._sendPacket({cmd:"pubrec",messageId:a,reasonCode:o},i):e.incomingStore.put(r,(()=>{e._sendPacket({cmd:"pubrec",messageId:a},i)}))))));break;case 1:l.customHandleAcks(n,o,r,((s,l)=>("number"==typeof s&&(l=s,s=null),s?e.emit("error",s):-1===t.indexOf(l)?e.emit("error",Error("Wrong reason code for puback")):(l||e.emit("message",n,o,r),void e.handleMessage(r,(t=>{if(t)return i&&i(t);e._sendPacket({cmd:"puback",messageId:a,reasonCode:l},i)}))))));break;case 0:e.emit("message",n,o,r),e.handleMessage(r,i);break;default:e.log("handlePublish: unknown QoS. Doing nothing.")}}})),Yr=M(((e,t)=>{t.exports={version:"5.10.4"}})),Jr=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.MQTTJS_VERSION=e.nextTick=e.ErrorWithReasonCode=void 0,e.applyMixin=function(e,t,r=!1){var i;let n=[t];for(;;){let e=n[0],t=Object.getPrototypeOf(e);if(!(null==t?void 0:t.prototype))break;n.unshift(t)}for(let t of n)for(let n of Object.getOwnPropertyNames(t.prototype))(r||"constructor"!==n)&&Object.defineProperty(e.prototype,n,null!==(i=Object.getOwnPropertyDescriptor(t.prototype,n))&&void 0!==i?i:Object.create(null))},e.ErrorWithReasonCode=class e extends Error{constructor(t,r){super(t),this.code=r,Object.setPrototypeOf(this,e.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}},e.nextTick="function"==typeof(null==N?void 0:N.nextTick)?N.nextTick:e=>{setTimeout(e,0)},e.MQTTJS_VERSION=Yr().version})),Xr=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.ReasonCodes=void 0;var t=Jr();e.ReasonCodes={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},e.default=(r,i)=>{let{messageId:n}=i,o=i.cmd,s=null,a=r.outgoing[n]?r.outgoing[n].cb:null,l=null;if(a){switch(r.log("_handleAck :: packet type",o),o){case"pubcomp":case"puback":{let o=i.reasonCode;o&&o>0&&16!==o?(l=new t.ErrorWithReasonCode("Publish error: "+e.ReasonCodes[o],o),r._removeOutgoingAndStoreMessage(n,(()=>{a(l,i)}))):r._removeOutgoingAndStoreMessage(n,a);break}case"pubrec":{s={cmd:"pubrel",qos:2,messageId:n};let o=i.reasonCode;o&&o>0&&16!==o?(l=new t.ErrorWithReasonCode("Publish error: "+e.ReasonCodes[o],o),r._removeOutgoingAndStoreMessage(n,(()=>{a(l,i)}))):r._sendPacket(s);break}case"suback":{delete r.outgoing[n],r.messageIdProvider.deallocate(n);let t=i.granted;for(let i=0;i<t.length;i++){let o=t[i];if(128&o){l=Error("Subscribe error: "+e.ReasonCodes[o]),l.code=o;let t=r.messageIdToTopic[n];t&&t.forEach((e=>{delete r._resubscribeTopics[e]}))}}delete r.messageIdToTopic[n],r._invokeStoreProcessingQueue(),a(l,i);break}case"unsuback":delete r.outgoing[n],r.messageIdProvider.deallocate(n),r._invokeStoreProcessingQueue(),a(null,i);break;default:r.emit("error",Error("unrecognized packet type"))}r.disconnecting&&0===Object.keys(r.outgoing).length&&r.emit("outgoingEmpty")}else r.log("_handleAck :: Server sent an ack in error. Ignoring.")}})),Zr=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0});var t=Jr(),r=Xr();e.default=(e,i)=>{let{options:n}=e,o=n.protocolVersion,s=5===o?i.reasonCode:i.returnCode;if(5===o)e.handleAuth(i,((i,n)=>{if(i)e.emit("error",i);else if(24===s)e.reconnecting=!1,e._sendPacket(n);else{let i=new t.ErrorWithReasonCode("Connection refused: "+r.ReasonCodes[s],s);e.emit("error",i)}}));else{let r=new t.ErrorWithReasonCode("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+o,s);e.emit("error",r)}}})),ei=M((e=>{let t,r;var i,n,o,s,a,l,u,h,c,f,d,p,g,b,C,R,O,B,x,M,L,U,D,W,F,q,$,H,V,z,K,G,Q,Y,J,X,Z,ee,te,re,ie,ne,oe,se;j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=void 0;var ae,le="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,ue=new Set,he="object"==typeof N&&N?N:{},ce=(e,t,r,i)=>{"function"==typeof he.emitWarning?he.emitWarning(e,t,r,i):console.error(`[${r}] ${t}: ${e}`)},fe=globalThis.AbortController,de=globalThis.AbortSignal;if(typeof fe>"u"){var pe;de=class{addEventListener(e,t){this._onabort.push(t)}constructor(){(0,k.default)(this,"onabort",void 0),(0,k.default)(this,"_onabort",[]),(0,k.default)(this,"reason",void 0),(0,k.default)(this,"aborted",!1)}},fe=class{abort(e){if(!this.signal.aborted){var t,r;this.signal.reason=e,this.signal.aborted=!0;for(let t of this.signal._onabort)t(e);null===(r=(t=this.signal).onabort)||void 0===r||r.call(t,e)}}constructor(){(0,k.default)(this,"signal",new de),t()}};let e="1"!==(null===(pe=he.env)||void 0===pe?void 0:pe.LRU_CACHE_IGNORE_AC_WARNING),t=()=>{e&&(e=!1,ce("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",t))}}var ge=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),be=e=>ge(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=4294967296?Uint32Array:e<=Number.MAX_SAFE_INTEGER?me:null:null,me=class extends Array{constructor(e){super(e),this.fill(0)}},ye=(i=class e{static create(t){let r=be(t);if(!r)return[];(0,A.default)(e,i,n,!0);let o=new e(t,r);return(0,A.default)(e,i,n,!1),o}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}constructor(t,r){if((0,k.default)(this,"heap",void 0),(0,k.default)(this,"length",void 0),!(0,S.default)(e,i,n))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}},n={writable:!0,value:!1},i),ve=(o=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,u=new WeakMap,h=new WeakMap,c=new WeakMap,f=new WeakMap,d=new WeakMap,p=new WeakMap,g=new WeakMap,b=new WeakMap,C=new WeakMap,R=new WeakMap,O=new WeakMap,B=new WeakMap,x=new WeakMap,M=new WeakMap,L=new WeakMap,U=new WeakMap,D=new WeakMap,W=new WeakMap,F=new WeakMap,q=new WeakSet,$=new WeakMap,H=new WeakMap,V=new WeakMap,z=new WeakMap,K=new WeakSet,G=new WeakMap,Q=new WeakMap,Y=new WeakMap,J=new WeakSet,X=new WeakSet,Z=new WeakSet,ee=new WeakSet,te=new WeakSet,re=new WeakSet,ie=new WeakSet,ne=new WeakSet,oe=new WeakSet,se=new WeakSet,t=Symbol.iterator,r=Symbol.toStringTag,ae=class e{static unsafeExposeInternals(e){return{starts:(0,m.default)(e,L),ttls:(0,m.default)(e,U),sizes:(0,m.default)(e,M),keyMap:(0,m.default)(e,d),keyList:(0,m.default)(e,p),valList:(0,m.default)(e,g),next:(0,m.default)(e,b),prev:(0,m.default)(e,C),get head(){return(0,m.default)(e,R)},get tail(){return(0,m.default)(e,O)},free:(0,m.default)(e,B),isBackgroundFetch:t=>(0,_.default)(e,re,Te).call(e,t),backgroundFetch:(t,r,i,n)=>(0,_.default)(e,te,Ie).call(e,t,r,i,n),moveToTail:t=>(0,_.default)(e,ne,Ce).call(e,t),indexes:t=>(0,_.default)(e,J,Ee).call(e,t),rindexes:t=>(0,_.default)(e,X,Se).call(e,t),isStale:t=>(0,m.default)(e,z).call(e,t)}}get max(){return(0,m.default)(this,o)}get maxSize(){return(0,m.default)(this,s)}get calculatedSize(){return(0,m.default)(this,f)}get size(){return(0,m.default)(this,c)}get fetchMethod(){return(0,m.default)(this,u)}get memoMethod(){return(0,m.default)(this,h)}get dispose(){return(0,m.default)(this,a)}get disposeAfter(){return(0,m.default)(this,l)}getRemainingTTL(e){return(0,m.default)(this,d).has(e)?1/0:0}*entries(){for(let e of(0,_.default)(this,J,Ee).call(this))void 0!==(0,m.default)(this,g)[e]&&void 0!==(0,m.default)(this,p)[e]&&!(0,_.default)(this,re,Te).call(this,(0,m.default)(this,g)[e])&&(yield[(0,m.default)(this,p)[e],(0,m.default)(this,g)[e]])}*rentries(){for(let e of(0,_.default)(this,X,Se).call(this))void 0!==(0,m.default)(this,g)[e]&&void 0!==(0,m.default)(this,p)[e]&&!(0,_.default)(this,re,Te).call(this,(0,m.default)(this,g)[e])&&(yield[(0,m.default)(this,p)[e],(0,m.default)(this,g)[e]])}*keys(){for(let e of(0,_.default)(this,J,Ee).call(this)){let t=(0,m.default)(this,p)[e];void 0!==t&&!(0,_.default)(this,re,Te).call(this,(0,m.default)(this,g)[e])&&(yield t)}}*rkeys(){for(let e of(0,_.default)(this,X,Se).call(this)){let t=(0,m.default)(this,p)[e];void 0!==t&&!(0,_.default)(this,re,Te).call(this,(0,m.default)(this,g)[e])&&(yield t)}}*values(){for(let e of(0,_.default)(this,J,Ee).call(this))void 0!==(0,m.default)(this,g)[e]&&!(0,_.default)(this,re,Te).call(this,(0,m.default)(this,g)[e])&&(yield(0,m.default)(this,g)[e])}*rvalues(){for(let e of(0,_.default)(this,X,Se).call(this))void 0!==(0,m.default)(this,g)[e]&&!(0,_.default)(this,re,Te).call(this,(0,m.default)(this,g)[e])&&(yield(0,m.default)(this,g)[e])}[t](){return this.entries()}find(e,t={}){for(let r of(0,_.default)(this,J,Ee).call(this)){let i=(0,m.default)(this,g)[r],n=(0,_.default)(this,re,Te).call(this,i)?i.__staleWhileFetching:i;if(void 0!==n&&e(n,(0,m.default)(this,p)[r],this))return this.get((0,m.default)(this,p)[r],t)}}forEach(e,t=this){for(let r of(0,_.default)(this,J,Ee).call(this)){let i=(0,m.default)(this,g)[r],n=(0,_.default)(this,re,Te).call(this,i)?i.__staleWhileFetching:i;void 0!==n&&e.call(t,n,(0,m.default)(this,p)[r],this)}}rforEach(e,t=this){for(let r of(0,_.default)(this,X,Se).call(this)){let i=(0,m.default)(this,g)[r],n=(0,_.default)(this,re,Te).call(this,i)?i.__staleWhileFetching:i;void 0!==n&&e.call(t,n,(0,m.default)(this,p)[r],this)}}purgeStale(){let e=!1;for(let t of(0,_.default)(this,X,Se).call(this,{allowStale:!0}))(0,m.default)(this,z).call(this,t)&&((0,_.default)(this,oe,Re).call(this,(0,m.default)(this,p)[t],"expire"),e=!0);return e}info(e){let t=(0,m.default)(this,d).get(e);if(void 0===t)return;let r=(0,m.default)(this,g)[t],i=(0,_.default)(this,re,Te).call(this,r)?r.__staleWhileFetching:r;if(void 0===i)return;let n={value:i};if((0,m.default)(this,U)&&(0,m.default)(this,L)){let e=(0,m.default)(this,U)[t],r=(0,m.default)(this,L)[t];if(e&&r){let t=e-(le.now()-r);n.ttl=t,n.start=Date.now()}}return(0,m.default)(this,M)&&(n.size=(0,m.default)(this,M)[t]),n}dump(){let e=[];for(let t of(0,_.default)(this,J,Ee).call(this,{allowStale:!0})){let r=(0,m.default)(this,p)[t],i=(0,m.default)(this,g)[t],n=(0,_.default)(this,re,Te).call(this,i)?i.__staleWhileFetching:i;if(void 0===n||void 0===r)continue;let o={value:n};if((0,m.default)(this,U)&&(0,m.default)(this,L)){o.ttl=(0,m.default)(this,U)[t];let e=le.now()-(0,m.default)(this,L)[t];o.start=Math.floor(Date.now()-e)}(0,m.default)(this,M)&&(o.size=(0,m.default)(this,M)[t]),e.unshift([r,o])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let e=Date.now()-r.start;r.start=le.now()-e}this.set(t,r.value,r)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;let{ttl:i=this.ttl,start:n,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:h}=r,{noUpdateTTL:f=this.noUpdateTTL}=r,y=(0,m.default)(this,Y).call(this,e,t,r.size||0,u);if(this.maxEntrySize&&y>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),(0,_.default)(this,oe,Re).call(this,e,"set"),this;let E=0===(0,m.default)(this,c)?void 0:(0,m.default)(this,d).get(e);if(void 0===E)E=0===(0,m.default)(this,c)?(0,m.default)(this,O):0!==(0,m.default)(this,B).length?(0,m.default)(this,B).pop():(0,m.default)(this,c)===(0,m.default)(this,o)?(0,_.default)(this,ee,ke).call(this,!1):(0,m.default)(this,c),(0,m.default)(this,p)[E]=e,(0,m.default)(this,g)[E]=t,(0,m.default)(this,d).set(e,E),(0,m.default)(this,b)[(0,m.default)(this,O)]=E,(0,m.default)(this,C)[E]=(0,m.default)(this,O),(0,v.default)(this,O,E),(0,w.default)(this,c).value++,(0,m.default)(this,Q).call(this,E,y,h),h&&(h.set="add"),f=!1;else{(0,_.default)(this,ne,Ce).call(this,E);let r=(0,m.default)(this,g)[E];if(t!==r){var S,A;if((0,m.default)(this,W)&&(0,_.default)(this,re,Te).call(this,r)){var k,I;r.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=r;void 0!==t&&!s&&((0,m.default)(this,D)&&(null===(k=(0,m.default)(this,a))||void 0===k||k.call(this,t,e,"set")),(0,m.default)(this,F)&&(null===(I=(0,m.default)(this,x))||void 0===I||I.push([t,e,"set"])))}else s||((0,m.default)(this,D)&&(null===(S=(0,m.default)(this,a))||void 0===S||S.call(this,r,e,"set")),(0,m.default)(this,F)&&(null===(A=(0,m.default)(this,x))||void 0===A||A.push([r,e,"set"])));if((0,m.default)(this,G).call(this,E),(0,m.default)(this,Q).call(this,E,y,h),(0,m.default)(this,g)[E]=t,h){h.set="replace";let e=r&&(0,_.default)(this,re,Te).call(this,r)?r.__staleWhileFetching:r;void 0!==e&&(h.oldValue=e)}}else h&&(h.set="update")}if(0!==i&&!(0,m.default)(this,U)&&(0,_.default)(this,q,we).call(this),(0,m.default)(this,U)&&(f||(0,m.default)(this,V).call(this,E,i,n),h&&(0,m.default)(this,H).call(this,h,E)),!s&&(0,m.default)(this,F)&&(0,m.default)(this,x)){var T;let e,t=(0,m.default)(this,x);for(;e=null==t?void 0:t.shift();)null===(T=(0,m.default)(this,l))||void 0===T||T.call(this,...e)}return this}pop(){try{for(;(0,m.default)(this,c);){let e=(0,m.default)(this,g)[(0,m.default)(this,R)];if((0,_.default)(this,ee,ke).call(this,!0),(0,_.default)(this,re,Te).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if((0,m.default)(this,F)&&(0,m.default)(this,x)){var e;let t,r=(0,m.default)(this,x);for(;t=null==r?void 0:r.shift();)null===(e=(0,m.default)(this,l))||void 0===e||e.call(this,...t)}}}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,n=(0,m.default)(this,d).get(e);if(void 0!==n){let e=(0,m.default)(this,g)[n];if((0,_.default)(this,re,Te).call(this,e)&&void 0===e.__staleWhileFetching)return!1;if(!(0,m.default)(this,z).call(this,n))return r&&(0,m.default)(this,$).call(this,n),i&&(i.has="hit",(0,m.default)(this,H).call(this,i,n)),!0;i&&(i.has="stale",(0,m.default)(this,H).call(this,i,n))}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=(0,m.default)(this,d).get(e);if(void 0===i||!r&&(0,m.default)(this,z).call(this,i))return;let n=(0,m.default)(this,g)[i];return(0,_.default)(this,re,Te).call(this,n)?n.__staleWhileFetching:n}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:b,forceRefresh:y=!1,status:v,signal:w}=t;if(!(0,m.default)(this,W))return v&&(v.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:n,status:v});let E={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:s,size:a,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:v,signal:w},S=(0,m.default)(this,d).get(e);if(void 0===S){v&&(v.fetch="miss");let t=(0,_.default)(this,te,Ie).call(this,e,S,E,b);return t.__returned=t}{let t=(0,m.default)(this,g)[S];if((0,_.default)(this,re,Te).call(this,t)){let e=r&&void 0!==t.__staleWhileFetching;return v&&(v.fetch="inflight",e&&(v.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let n=(0,m.default)(this,z).call(this,S);if(!y&&!n)return v&&(v.fetch="hit"),(0,_.default)(this,ne,Ce).call(this,S),i&&(0,m.default)(this,$).call(this,S),v&&(0,m.default)(this,H).call(this,v,S),t;let o=(0,_.default)(this,te,Ie).call(this,e,S,E,b),s=void 0!==o.__staleWhileFetching&&r;return v&&(v.fetch=n?"stale":"refresh",s&&n&&(v.returnedStale=!0)),s?o.__staleWhileFetching:o.__returned=o}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(void 0===r)throw Error("fetch() returned undefined");return r}memo(e,t={}){let r=(0,m.default)(this,h);if(!r)throw Error("no memoMethod provided to constructor");let{context:i,forceRefresh:n}=t,o=(0,P.default)(t,["context","forceRefresh"]),s=this.get(e,o);if(!n&&void 0!==s)return s;let a=r(e,s,{options:o,context:i});return this.set(e,a,o),a}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=t,s=(0,m.default)(this,d).get(e);if(void 0!==s){let t=(0,m.default)(this,g)[s],a=(0,_.default)(this,re,Te).call(this,t);return o&&(0,m.default)(this,H).call(this,o,s),(0,m.default)(this,z).call(this,s)?(o&&(o.get="stale"),a?(o&&r&&void 0!==t.__staleWhileFetching&&(o.returnedStale=!0),r?t.__staleWhileFetching:void 0):(n||(0,_.default)(this,oe,Re).call(this,e,"expire"),o&&r&&(o.returnedStale=!0),r?t:void 0)):(o&&(o.get="hit"),a?t.__staleWhileFetching:((0,_.default)(this,ne,Ce).call(this,s),i&&(0,m.default)(this,$).call(this,s),t))}o&&(o.get="miss")}delete(e){return(0,_.default)(this,oe,Re).call(this,e,"delete")}clear(){return(0,_.default)(this,se,Oe).call(this,"delete")}constructor(t){(0,E.default)(this,q),(0,E.default)(this,K),(0,E.default)(this,J),(0,E.default)(this,X),(0,E.default)(this,Z),(0,E.default)(this,ee),(0,E.default)(this,te),(0,E.default)(this,re),(0,E.default)(this,ie),(0,E.default)(this,ne),(0,E.default)(this,oe),(0,E.default)(this,se),(0,y.default)(this,o,{writable:!0,value:void 0}),(0,y.default)(this,s,{writable:!0,value:void 0}),(0,y.default)(this,a,{writable:!0,value:void 0}),(0,y.default)(this,l,{writable:!0,value:void 0}),(0,y.default)(this,u,{writable:!0,value:void 0}),(0,y.default)(this,h,{writable:!0,value:void 0}),(0,k.default)(this,"ttl",void 0),(0,k.default)(this,"ttlResolution",void 0),(0,k.default)(this,"ttlAutopurge",void 0),(0,k.default)(this,"updateAgeOnGet",void 0),(0,k.default)(this,"updateAgeOnHas",void 0),(0,k.default)(this,"allowStale",void 0),(0,k.default)(this,"noDisposeOnSet",void 0),(0,k.default)(this,"noUpdateTTL",void 0),(0,k.default)(this,"maxEntrySize",void 0),(0,k.default)(this,"sizeCalculation",void 0),(0,k.default)(this,"noDeleteOnFetchRejection",void 0),(0,k.default)(this,"noDeleteOnStaleGet",void 0),(0,k.default)(this,"allowStaleOnFetchAbort",void 0),(0,k.default)(this,"allowStaleOnFetchRejection",void 0),(0,k.default)(this,"ignoreFetchAbort",void 0),(0,y.default)(this,c,{writable:!0,value:void 0}),(0,y.default)(this,f,{writable:!0,value:void 0}),(0,y.default)(this,d,{writable:!0,value:void 0}),(0,y.default)(this,p,{writable:!0,value:void 0}),(0,y.default)(this,g,{writable:!0,value:void 0}),(0,y.default)(this,b,{writable:!0,value:void 0}),(0,y.default)(this,C,{writable:!0,value:void 0}),(0,y.default)(this,R,{writable:!0,value:void 0}),(0,y.default)(this,O,{writable:!0,value:void 0}),(0,y.default)(this,B,{writable:!0,value:void 0}),(0,y.default)(this,x,{writable:!0,value:void 0}),(0,y.default)(this,M,{writable:!0,value:void 0}),(0,y.default)(this,L,{writable:!0,value:void 0}),(0,y.default)(this,U,{writable:!0,value:void 0}),(0,y.default)(this,D,{writable:!0,value:void 0}),(0,y.default)(this,W,{writable:!0,value:void 0}),(0,y.default)(this,F,{writable:!0,value:void 0}),(0,y.default)(this,$,{writable:!0,value:()=>{}}),(0,y.default)(this,H,{writable:!0,value:()=>{}}),(0,y.default)(this,V,{writable:!0,value:()=>{}}),(0,y.default)(this,z,{writable:!0,value:()=>!1}),(0,y.default)(this,G,{writable:!0,value:()=>{}}),(0,y.default)(this,Q,{writable:!0,value:()=>{}}),(0,y.default)(this,Y,{writable:!0,value:(e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}}),(0,k.default)(this,r,"LRUCache");let{max:i=0,ttl:n,ttlResolution:w=1,ttlAutopurge:S,updateAgeOnGet:A,updateAgeOnHas:I,allowStale:T,dispose:P,disposeAfter:j,noDisposeOnSet:N,noUpdateTTL:ae,maxSize:le=0,maxEntrySize:he=0,sizeCalculation:fe,fetchMethod:de,memoMethod:pe,noDeleteOnFetchRejection:me,noDeleteOnStaleGet:ve,allowStaleOnFetchRejection:Ee,allowStaleOnFetchAbort:Se,ignoreFetchAbort:Ae}=t;if(0!==i&&!ge(i))throw new TypeError("max option must be a nonnegative integer");let ke=i?be(i):Array;if(!ke)throw Error("invalid max value: "+i);if((0,v.default)(this,o,i),(0,v.default)(this,s,le),this.maxEntrySize=he||(0,m.default)(this,s),this.sizeCalculation=fe,this.sizeCalculation){if(!(0,m.default)(this,s)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==pe&&"function"!=typeof pe)throw new TypeError("memoMethod must be a function if defined");if((0,v.default)(this,h,pe),void 0!==de&&"function"!=typeof de)throw new TypeError("fetchMethod must be a function if specified");if((0,v.default)(this,u,de),(0,v.default)(this,W,!!de),(0,v.default)(this,d,new Map),(0,v.default)(this,p,Array(i).fill(void 0)),(0,v.default)(this,g,Array(i).fill(void 0)),(0,v.default)(this,b,new ke(i)),(0,v.default)(this,C,new ke(i)),(0,v.default)(this,R,0),(0,v.default)(this,O,0),(0,v.default)(this,B,ye.create(i)),(0,v.default)(this,c,0),(0,v.default)(this,f,0),"function"==typeof P&&(0,v.default)(this,a,P),"function"==typeof j?((0,v.default)(this,l,j),(0,v.default)(this,x,[])):((0,v.default)(this,l,void 0),(0,v.default)(this,x,void 0)),(0,v.default)(this,D,!!(0,m.default)(this,a)),(0,v.default)(this,F,!!(0,m.default)(this,l)),this.noDisposeOnSet=!!N,this.noUpdateTTL=!!ae,this.noDeleteOnFetchRejection=!!me,this.allowStaleOnFetchRejection=!!Ee,this.allowStaleOnFetchAbort=!!Se,this.ignoreFetchAbort=!!Ae,0!==this.maxEntrySize){if(0!==(0,m.default)(this,s)&&!ge((0,m.default)(this,s)))throw new TypeError("maxSize must be a positive integer if specified");if(!ge(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");(0,_.default)(this,K,_e).call(this)}if(this.allowStale=!!T,this.noDeleteOnStaleGet=!!ve,this.updateAgeOnGet=!!A,this.updateAgeOnHas=!!I,this.ttlResolution=ge(w)||0===w?w:1,this.ttlAutopurge=!!S,this.ttl=n||0,this.ttl){if(!ge(this.ttl))throw new TypeError("ttl must be a positive integer if specified");(0,_.default)(this,q,we).call(this)}if(0===(0,m.default)(this,o)&&0===this.ttl&&0===(0,m.default)(this,s))throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!(0,m.default)(this,o)&&!(0,m.default)(this,s)){let t="LRU_CACHE_UNBOUNDED";(e=>!ue.has(e))(t)&&(ue.add(t),ce("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}},ae);function we(){let e=new me((0,m.default)(this,o)),t=new me((0,m.default)(this,o));(0,v.default)(this,U,e),(0,v.default)(this,L,t),(0,v.default)(this,V,((r,i,n=le.now())=>{if(t[r]=0!==i?n:0,e[r]=i,0!==i&&this.ttlAutopurge){let e=setTimeout((()=>{(0,m.default)(this,z).call(this,r)&&(0,_.default)(this,oe,Re).call(this,(0,m.default)(this,p)[r],"expire")}),i+1);e.unref&&e.unref()}})),(0,v.default)(this,$,(r=>{t[r]=0!==e[r]?le.now():0})),(0,v.default)(this,H,((n,o)=>{if(e[o]){let s=e[o],a=t[o];if(!s||!a)return;n.ttl=s,n.start=a,n.now=r||i();let l=n.now-a;n.remainingTTL=s-l}}));let r=0,i=()=>{let e=le.now();if(this.ttlResolution>0){r=e;let t=setTimeout((()=>r=0),this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{let o=(0,m.default)(this,d).get(n);if(void 0===o)return 0;let s=e[o],a=t[o];return s&&a?s-((r||i())-a):1/0},(0,v.default)(this,z,(n=>{let o=t[n],s=e[n];return!!s&&!!o&&(r||i())-o>s}))}function _e(){let e=new me((0,m.default)(this,o));(0,v.default)(this,f,0),(0,v.default)(this,M,e),(0,v.default)(this,G,(t=>{(0,v.default)(this,f,(0,m.default)(this,f)-e[t]),e[t]=0})),(0,v.default)(this,Y,((e,t,r,i)=>{if((0,_.default)(this,re,Te).call(this,t))return 0;if(!ge(r)){if(!i)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof i)throw new TypeError("sizeCalculation must be a function");if(r=i(t,e),!ge(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r})),(0,v.default)(this,Q,((t,r,i)=>{if(e[t]=r,(0,m.default)(this,s)){let r=(0,m.default)(this,s)-e[t];for(;(0,m.default)(this,f)>r;)(0,_.default)(this,ee,ke).call(this,!0)}(0,v.default)(this,f,(0,m.default)(this,f)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=(0,m.default)(this,f))}))}function*Ee({allowStale:e=this.allowStale}={}){if((0,m.default)(this,c))for(let t=(0,m.default)(this,O);(0,_.default)(this,Z,Ae).call(this,t)&&((e||!(0,m.default)(this,z).call(this,t))&&(yield t),t!==(0,m.default)(this,R));)t=(0,m.default)(this,C)[t]}function*Se({allowStale:e=this.allowStale}={}){if((0,m.default)(this,c))for(let t=(0,m.default)(this,R);(0,_.default)(this,Z,Ae).call(this,t)&&((e||!(0,m.default)(this,z).call(this,t))&&(yield t),t!==(0,m.default)(this,O));)t=(0,m.default)(this,b)[t]}function Ae(e){return void 0!==e&&(0,m.default)(this,d).get((0,m.default)(this,p)[e])===e}function ke(e){var t,r;let i=(0,m.default)(this,R),n=(0,m.default)(this,p)[i],o=(0,m.default)(this,g)[i];return(0,m.default)(this,W)&&(0,_.default)(this,re,Te).call(this,o)?o.__abortController.abort(Error("evicted")):((0,m.default)(this,D)||(0,m.default)(this,F))&&((0,m.default)(this,D)&&(null===(t=(0,m.default)(this,a))||void 0===t||t.call(this,o,n,"evict")),(0,m.default)(this,F)&&(null===(r=(0,m.default)(this,x))||void 0===r||r.push([o,n,"evict"]))),(0,m.default)(this,G).call(this,i),e&&((0,m.default)(this,p)[i]=void 0,(0,m.default)(this,g)[i]=void 0,(0,m.default)(this,B).push(i)),1===(0,m.default)(this,c)?((0,v.default)(this,R,(0,v.default)(this,O,0)),(0,m.default)(this,B).length=0):(0,v.default)(this,R,(0,m.default)(this,b)[i]),(0,m.default)(this,d).delete(n),(0,w.default)(this,c).value--,i}function Ie(e,t,r,i){let n=void 0===t?void 0:(0,m.default)(this,g)[t];if((0,_.default)(this,re,Te).call(this,n))return n;let o=new fe,{signal:s}=r;null==s||s.addEventListener("abort",(()=>o.abort(s.reason)),{signal:o.signal});let a={signal:o.signal,options:r,context:i},l=(i,n=!1)=>{let{aborted:s}=o.signal,l=r.ignoreFetchAbort&&void 0!==i;if(r.status&&(s&&!n?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,l&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),s&&!l&&!n)return h(o.signal.reason);let u=c;return(0,m.default)(this,g)[t]===c&&(void 0===i?u.__staleWhileFetching?(0,m.default)(this,g)[t]=u.__staleWhileFetching:(0,_.default)(this,oe,Re).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,i,a.options))),i},h=i=>{let{aborted:n}=o.signal,s=n&&r.allowStaleOnFetchAbort,a=s||r.allowStaleOnFetchRejection,l=a||r.noDeleteOnFetchRejection,u=c;if((0,m.default)(this,g)[t]===c&&(l&&void 0!==u.__staleWhileFetching?s||((0,m.default)(this,g)[t]=u.__staleWhileFetching):(0,_.default)(this,oe,Re).call(this,e,"fetch")),a)return r.status&&void 0!==u.__staleWhileFetching&&(r.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw i};r.status&&(r.status.fetchDispatched=!0);let c=new Promise(((t,i)=>{var s;let h=null===(s=(0,m.default)(this,u))||void 0===s?void 0:s.call(this,e,n,a);h&&h instanceof Promise&&h.then((e=>t(void 0===e?void 0:e)),i),o.signal.addEventListener("abort",(()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))}))})).then(l,(e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),h(e)))),f=Object.assign(c,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return void 0===t?(this.set(e,f,(0,T.default)((0,I.default)({},a.options),{status:void 0})),t=(0,m.default)(this,d).get(e)):(0,m.default)(this,g)[t]=f,f}function Te(e){if(!(0,m.default)(this,W))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof fe}function Pe(e,t){(0,m.default)(this,C)[t]=e,(0,m.default)(this,b)[e]=t}function Ce(e){e!==(0,m.default)(this,O)&&(e===(0,m.default)(this,R)?(0,v.default)(this,R,(0,m.default)(this,b)[e]):(0,_.default)(this,ie,Pe).call(this,(0,m.default)(this,C)[e],(0,m.default)(this,b)[e]),(0,_.default)(this,ie,Pe).call(this,(0,m.default)(this,O),e),(0,v.default)(this,O,e))}function Re(e,t){var r;let i=!1;if(0!==(0,m.default)(this,c)){let r=(0,m.default)(this,d).get(e);if(void 0!==r)if(i=!0,1===(0,m.default)(this,c))(0,_.default)(this,se,Oe).call(this,t);else{var n,o;(0,m.default)(this,G).call(this,r);let i=(0,m.default)(this,g)[r];if((0,_.default)(this,re,Te).call(this,i)?i.__abortController.abort(Error("deleted")):((0,m.default)(this,D)||(0,m.default)(this,F))&&((0,m.default)(this,D)&&(null===(n=(0,m.default)(this,a))||void 0===n||n.call(this,i,e,t)),(0,m.default)(this,F)&&(null===(o=(0,m.default)(this,x))||void 0===o||o.push([i,e,t]))),(0,m.default)(this,d).delete(e),(0,m.default)(this,p)[r]=void 0,(0,m.default)(this,g)[r]=void 0,r===(0,m.default)(this,O))(0,v.default)(this,O,(0,m.default)(this,C)[r]);else if(r===(0,m.default)(this,R))(0,v.default)(this,R,(0,m.default)(this,b)[r]);else{let e=(0,m.default)(this,C)[r];(0,m.default)(this,b)[e]=(0,m.default)(this,b)[r];let t=(0,m.default)(this,b)[r];(0,m.default)(this,C)[t]=(0,m.default)(this,C)[r]}(0,w.default)(this,c).value--,(0,m.default)(this,B).push(r)}}if((0,m.default)(this,F)&&(null===(r=(0,m.default)(this,x))||void 0===r?void 0:r.length)){var s;let e,t=(0,m.default)(this,x);for(;e=null==t?void 0:t.shift();)null===(s=(0,m.default)(this,l))||void 0===s||s.call(this,...e)}return i}function Oe(e){for(let i of(0,_.default)(this,X,Se).call(this,{allowStale:!0})){let n=(0,m.default)(this,g)[i];if((0,_.default)(this,re,Te).call(this,n))n.__abortController.abort(Error("deleted"));else{var t,r;let o=(0,m.default)(this,p)[i];(0,m.default)(this,D)&&(null===(t=(0,m.default)(this,a))||void 0===t||t.call(this,n,o,e)),(0,m.default)(this,F)&&(null===(r=(0,m.default)(this,x))||void 0===r||r.push([n,o,e]))}}if((0,m.default)(this,d).clear(),(0,m.default)(this,g).fill(void 0),(0,m.default)(this,p).fill(void 0),(0,m.default)(this,U)&&(0,m.default)(this,L)&&((0,m.default)(this,U).fill(0),(0,m.default)(this,L).fill(0)),(0,m.default)(this,M)&&(0,m.default)(this,M).fill(0),(0,v.default)(this,R,0),(0,v.default)(this,O,0),(0,m.default)(this,B).length=0,(0,v.default)(this,f,0),(0,v.default)(this,c,0),(0,m.default)(this,F)&&(0,m.default)(this,x)){var i;let e,t=(0,m.default)(this,x);for(;e=null==t?void 0:t.shift();)null===(i=(0,m.default)(this,l))||void 0===i||i.call(this,...e)}}e.LRUCache=ve})),ti=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.ContainerIterator=e.Container=e.Base=void 0,e.ContainerIterator=class{equals(e){return this.o===e.o}constructor(e=0){this.iteratorType=e}};var t=class{get length(){return this.i}size(){return this.i}empty(){return 0===this.i}constructor(){this.i=0}};e.Base=t,e.Container=class extends t{}})),ri=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=ti(),r=class extends t.Base{clear(){this.i=0,this.S=[]}push(e){return this.S.push(e),this.i+=1,this.i}pop(){if(0!==this.i)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}constructor(e=[]){super(),this.S=[];let t=this;e.forEach((e=>{t.push(e)}))}};e.default=r})),ii=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=ti(),r=class extends t.Base{clear(){this.q=[],this.i=this.j=0}push(e){let t=this.q.length;if(this.j/t>.5&&this.j+this.i>=t&&t>4096){let t=this.i;for(let e=0;e<t;++e)this.q[e]=this.q[this.j+e];this.j=0,this.q[this.i]=e}else this.q[this.j+this.i]=e;return++this.i}pop(){if(0===this.i)return;let e=this.q[this.j++];return this.i-=1,e}front(){if(0!==this.i)return this.q[this.j]}constructor(e=[]){super(),this.j=0,this.q=[];let t=this;e.forEach((e=>{t.push(e)}))}};e.default=r})),ni=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=ti(),r=class extends t.Base{m(e){let t=this.C[e];for(;e>0;){let r=e-1>>1,i=this.C[r];if(this.v(i,t)<=0)break;this.C[e]=i,e=r}this.C[e]=t}k(e,t){let r=this.C[e];for(;e<t;){let t=e<<1|1,i=t+1,n=this.C[t];if(i<this.i&&this.v(n,this.C[i])>0&&(t=i,n=this.C[i]),this.v(n,r)>=0)break;this.C[e]=n,e=t}this.C[e]=r}clear(){this.i=0,this.C.length=0}push(e){this.C.push(e),this.m(this.i),this.i+=1}pop(){if(0===this.i)return;let e=this.C[0],t=this.C.pop();return this.i-=1,this.i&&(this.C[0]=t,this.k(0,this.i>>1)),e}top(){return this.C[0]}find(e){return this.C.indexOf(e)>=0}remove(e){let t=this.C.indexOf(e);return!(t<0||(0===t?this.pop():t===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(t,1,this.C.pop()),this.i-=1,this.m(t),this.k(t,this.i>>1)),0))}updateItem(e){let t=this.C.indexOf(e);return!(t<0||(this.m(t),this.k(t,this.i>>1),0))}toArray(){return[...this.C]}constructor(e=[],t=((e,t)=>e>t?-1:e<t?1:0),r=!0){if(super(),this.v=t,Array.isArray(e))this.C=r?[...e]:e;else{this.C=[];let t=this;e.forEach((e=>{t.C.push(e)}))}this.i=this.C.length;let i=this.i>>1;for(let e=this.i-1>>1;e>=0;--e)this.k(e,i)}};e.default=r})),oi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=ti(),r=class extends t.Container{};e.default=r})),si=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.throwIteratorAccessError=function(){throw new RangeError("Iterator access denied!")}})),ai=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.RandomIterator=void 0;var t=ti(),r=si(),i=class extends t.ContainerIterator{get pointer(){return this.container.getElementByPos(this.o)}set pointer(e){this.container.setElementByPos(this.o,e)}constructor(e,t){super(t),this.o=e,0===this.iteratorType?(this.pre=function(){return 0===this.o&&(0,r.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,r.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,r.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return-1===this.o&&(0,r.throwIteratorAccessError)(),this.o-=1,this})}};e.RandomIterator=i})),li=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t,r=(t=oi())&&t.t?t:{default:t},i=ai(),n=class e extends i.RandomIterator{copy(){return new e(this.o,this.container,this.iteratorType)}constructor(e,t,r){super(e,r),this.container=t}},o=class extends r.default{clear(){this.i=0,this.J.length=0}begin(){return new n(0,this)}end(){return new n(this.i,this)}rBegin(){return new n(this.i-1,this,1)}rEnd(){return new n(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let t=0;for(let r=0;r<this.i;++r)this.J[r]!==e&&(this.J[t++]=this.J[r]);return this.i=this.J.length=t,this.i}eraseElementByIterator(e){let t=e.o;return e=e.next(),this.eraseElementByPos(t),e}pushBack(e){return this.J.push(e),this.i+=1,this.i}popBack(){if(0!==this.i)return this.i-=1,this.J.pop()}setElementByPos(e,t){if(e<0||e>this.i-1)throw new RangeError;this.J[e]=t}insert(e,t,r=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...Array(r).fill(t)),this.i+=r,this.i}find(e){for(let t=0;t<this.i;++t)if(this.J[t]===e)return new n(t,this);return this.end()}reverse(){this.J.reverse()}unique(){let e=1;for(let t=1;t<this.i;++t)this.J[t]!==this.J[t-1]&&(this.J[e++]=this.J[t]);return this.i=this.J.length=e,this.i}sort(e){this.J.sort(e)}forEach(e){for(let t=0;t<this.i;++t)e(this.J[t],t,this)}[Symbol.iterator](){return function*(){yield*this.J}.bind(this)()}constructor(e=[],t=!0){if(super(),Array.isArray(e))this.J=t?[...e]:e,this.i=e.length;else{this.J=[];let t=this;e.forEach((e=>{t.pushBack(e)}))}}};e.default=o})),ui=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t,r=(t=oi())&&t.t?t:{default:t},i=ti(),n=si(),o=class e extends i.ContainerIterator{get pointer(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.l}set pointer(e){this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.l=e}copy(){return new e(this.o,this.h,this.container,this.iteratorType)}constructor(e,t,r,i){super(i),this.o=e,this.h=t,this.container=r,0===this.iteratorType?(this.pre=function(){return this.o.L===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this})}},s=class extends r.default{V(e){let{L:t,B:r}=e;t.B=r,r.L=t,e===this.p&&(this.p=r),e===this._&&(this._=t),this.i-=1}G(e,t){let r=t.B,i={l:e,L:t,B:r};t.B=i,r.L=i,t===this.h&&(this.p=i),r===this.h&&(this._=i),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new o(this.p,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this._,this.h,this,1)}rEnd(){return new o(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 t=this.p;for(;e--;)t=t.B;return t.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let t=this.p;for(;e--;)t=t.B;return this.V(t),this.i}eraseElementByValue(e){let t=this.p;for(;t!==this.h;)t.l===e&&this.V(t),t=t.B;return this.i}eraseElementByIterator(e){let t=e.o;return t===this.h&&(0,n.throwIteratorAccessError)(),e=e.next(),this.V(t),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(0===this.i)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(0===this.i)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,t){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;r.l=t}insert(e,t,r=1){if(e<0||e>this.i)throw new RangeError;if(r<=0)return this.i;if(0===e)for(;r--;)this.pushFront(t);else if(e===this.i)for(;r--;)this.pushBack(t);else{let i=this.p;for(let t=1;t<e;++t)i=i.B;let n=i.B;for(this.i+=r;r--;)i.B={l:t,L:i},i.B.L=i,i=i.B;i.B=n,n.L=i}return this.i}find(e){let t=this.p;for(;t!==this.h;){if(t.l===e)return new o(t,this.h,this);t=t.B}return this.end()}reverse(){if(this.i<=1)return;let e=this.p,t=this._,r=0;for(;r<<1<this.i;){let i=e.l;e.l=t.l,t.l=i,e=e.B,t=t.L,r+=1}}unique(){if(this.i<=1)return this.i;let e=this.p;for(;e!==this.h;){let t=e;for(;t.B!==this.h&&t.l===t.B.l;)t=t.B,this.i-=1;e.B=t.B,e.B.L=e,e=e.B}return this.i}sort(e){if(this.i<=1)return;let t=[];this.forEach((e=>{t.push(e)})),t.sort(e);let r=this.p;t.forEach((e=>{r.l=e,r=r.B}))}merge(e){let t=this;if(0===this.i)e.forEach((e=>{t.pushBack(e)}));else{let r=this.p;e.forEach((e=>{for(;r!==t.h&&r.l<=e;)r=r.B;t.G(e,r.L)}))}return this.i}forEach(e){let t=this.p,r=0;for(;t!==this.h;)e(t.l,r++,this),t=t.B}[Symbol.iterator](){return function*(){if(0===this.i)return;let e=this.p;for(;e!==this.h;)yield e.l,e=e.B}.bind(this)()}constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let t=this;e.forEach((e=>{t.pushBack(e)}))}};e.default=s})),hi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t,r=(t=oi())&&t.t?t:{default:t},i=ai(),n=class e extends i.RandomIterator{copy(){return new e(this.o,this.container,this.iteratorType)}constructor(e,t,r){super(e,r),this.container=t}},o=class extends r.default{T(){let e=[],t=Math.max(this.P>>1,1);for(let r=0;r<t;++r)e[r]=Array(this.F);for(let t=this.j;t<this.P;++t)e[e.length]=this.A[t];for(let t=0;t<this.R;++t)e[e.length]=this.A[t];e[e.length]=[...this.A[this.R]],this.j=t,this.R=e.length-1;for(let r=0;r<t;++r)e[e.length]=Array(this.F);this.A=e,this.P=e.length}O(e){let t=this.D+e+1,r=t%this.F,i=r-1,n=this.j+(t-r)/this.F;return 0===r&&(n-=1),n%=this.P,i<0&&(i+=this.F),{curNodeBucketIndex:n,curNodePointerIndex:i}}clear(){this.A=[Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new n(0,this)}end(){return new n(this.i,this)}rBegin(){return new n(this.i-1,this,1)}rEnd(){return new n(-1,this,1)}front(){if(0!==this.i)return this.A[this.j][this.D]}back(){if(0!==this.i)return this.A[this.R][this.N]}pushBack(e){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]=e,this.i}popBack(){if(0===this.i)return;let e=this.A[this.R][this.N];return 1!==this.i&&(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,e}pushFront(e){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]=e,this.i}popFront(){if(0===this.i)return;let e=this.A[this.j][this.D];return 1!==this.i&&(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,e}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:t,curNodePointerIndex:r}=this.O(e);return this.A[t][r]}setElementByPos(e,t){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);this.A[r][i]=t}insert(e,t,r=1){if(e<0||e>this.i)throw new RangeError;if(0===e)for(;r--;)this.pushFront(t);else if(e===this.i)for(;r--;)this.pushBack(t);else{let i=[];for(let t=e;t<this.i;++t)i.push(this.getElementByPos(t));this.cut(e-1);for(let e=0;e<r;++e)this.pushBack(t);for(let e=0;e<i.length;++e)this.pushBack(i[e])}return this.i}cut(e){if(e<0)return this.clear(),0;let{curNodeBucketIndex:t,curNodePointerIndex:r}=this.O(e);return this.R=t,this.N=r,this.i=e+1,this.i}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;if(0===e)this.popFront();else if(e===this.i-1)this.popBack();else{let t=[];for(let r=e+1;r<this.i;++r)t.push(this.getElementByPos(r));this.cut(e),this.popBack();let r=this;t.forEach((e=>{r.pushBack(e)}))}return this.i}eraseElementByValue(e){if(0===this.i)return 0;let t=[];for(let r=0;r<this.i;++r){let i=this.getElementByPos(r);i!==e&&t.push(i)}let r=t.length;for(let e=0;e<r;++e)this.setElementByPos(e,t[e]);return this.cut(r-1)}eraseElementByIterator(e){let t=e.o;return this.eraseElementByPos(t),e.next()}find(e){for(let t=0;t<this.i;++t)if(this.getElementByPos(t)===e)return new n(t,this);return this.end()}reverse(){let e=0,t=this.i-1;for(;e<t;){let r=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,r),e+=1,t-=1}}unique(){if(this.i<=1)return this.i;let e=1,t=this.getElementByPos(0);for(let r=1;r<this.i;++r){let i=this.getElementByPos(r);i!==t&&(t=i,this.setElementByPos(e++,i))}for(;this.i>e;)this.popBack();return this.i}sort(e){let t=[];for(let e=0;e<this.i;++e)t.push(this.getElementByPos(e));t.sort(e);for(let e=0;e<this.i;++e)this.setElementByPos(e,t[e])}shrinkToFit(){if(0===this.i)return;let e=[];this.forEach((t=>{e.push(t)})),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(Array(this.F));for(let t=0;t<e.length;++t)this.pushBack(e[t])}forEach(e){for(let t=0;t<this.i;++t)e(this.getElementByPos(t),t,this)}[Symbol.iterator](){return function*(){for(let e=0;e<this.i;++e)yield this.getElementByPos(e)}.bind(this)()}constructor(e=[],t=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let r=(()=>{if("number"==typeof e.length)return e.length;if("number"==typeof e.size)return e.size;if("function"==typeof e.size)return e.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=t,this.P=Math.max(Math.ceil(r/this.F),1);for(let e=0;e<this.P;++e)this.A.push(Array(this.F));let i=Math.ceil(r/this.F);this.j=this.R=(this.P>>1)-(i>>1),this.D=this.N=this.F-r%this.F>>1;let n=this;e.forEach((e=>{n.pushBack(e)}))}};e.default=o})),ci=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.TreeNodeEnableIndex=e.TreeNode=void 0;var t=class{L(){let e=this;if(1===e.ee&&e.tt.tt===e)e=e.W;else if(e.U)for(e=e.U;e.W;)e=e.W;else{let t=e.tt;for(;t.U===e;)e=t,t=e.tt;e=t}return e}B(){let e=this;if(e.W){for(e=e.W;e.U;)e=e.U;return e}{let t=e.tt;for(;t.W===e;)e=t,t=e.tt;return e.W!==t?t:e}}te(){let e=this.tt,t=this.W,r=t.U;return e.tt===this?e.tt=t:e.U===this?e.U=t:e.W=t,t.tt=e,t.U=this,this.tt=t,this.W=r,r&&(r.tt=this),t}se(){let e=this.tt,t=this.U,r=t.W;return e.tt===this?e.tt=t:e.U===this?e.U=t:e.W=t,t.tt=e,t.W=this,this.tt=t,this.U=r,r&&(r.tt=this),t}constructor(e,t){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=e,this.l=t}};e.TreeNode=t,e.TreeNodeEnableIndex=class extends t{te(){let e=super.te();return this.ie(),e.ie(),e}se(){let e=super.se();return this.ie(),e.ie(),e}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}constructor(){super(...arguments),this.rt=1}}})),fi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=ci(),r=ti(),i=si(),n=class extends r.Container{X(e,t){let r=this.h;for(;e;){let i=this.v(e.u,t);if(i<0)e=e.W;else{if(!(i>0))return e;r=e,e=e.U}}return r}Z(e,t){let r=this.h;for(;e;)this.v(e.u,t)<=0?e=e.W:(r=e,e=e.U);return r}$(e,t){let r=this.h;for(;e;){let i=this.v(e.u,t);if(i<0)r=e,e=e.W;else{if(!(i>0))return e;e=e.U}}return r}rr(e,t){let r=this.h;for(;e;)this.v(e.u,t)<0?(r=e,e=e.W):e=e.U;return r}ue(e){for(;;){let t=e.tt;if(t===this.h)return;if(1===e.ee)return void(e.ee=0);if(e===t.U){let r=t.W;if(1===r.ee)r.ee=0,t.ee=1,t===this.Y?this.Y=t.te():t.te();else{if(r.W&&1===r.W.ee)return r.ee=t.ee,t.ee=0,r.W.ee=0,void(t===this.Y?this.Y=t.te():t.te());r.U&&1===r.U.ee?(r.ee=1,r.U.ee=0,r.se()):(r.ee=1,e=t)}}else{let r=t.U;if(1===r.ee)r.ee=0,t.ee=1,t===this.Y?this.Y=t.se():t.se();else{if(r.U&&1===r.U.ee)return r.ee=t.ee,t.ee=0,r.U.ee=0,void(t===this.Y?this.Y=t.se():t.se());r.W&&1===r.W.ee?(r.ee=1,r.W.ee=0,r.te()):(r.ee=1,e=t)}}}}fe(e){if(1===this.i)return this.clear(),this.h;let t=e;for(;t.U||t.W;){if(t.W)for(t=t.W;t.U;)t=t.U;else t=t.U;[e.u,t.u]=[t.u,e.u],[e.l,t.l]=[t.l,e.l],e=t}this.h.U===t?this.h.U=t.tt:this.h.W===t&&(this.h.W=t.tt),this.ue(t);let r=t.tt;return t===r.U?r.U=void 0:r.W=void 0,this.i-=1,this.Y.ee=0,r}oe(e,t){return void 0!==e&&(!(!this.oe(e.U,t)&&!t(e))||this.oe(e.W,t))}he(e){for(;;){let t=e.tt;if(0===t.ee)return;let r=t.tt;if(t===r.U){let i=r.W;if(i&&1===i.ee){if(i.ee=t.ee=0,r===this.Y)return;r.ee=1,e=r;continue}if(e===t.W){if(e.ee=0,e.U&&(e.U.tt=t),e.W&&(e.W.tt=r),t.W=e.U,r.U=e.W,e.U=t,e.W=r,r===this.Y)this.Y=e,this.h.tt=e;else{let t=r.tt;t.U===r?t.U=e:t.W=e}return e.tt=r.tt,t.tt=e,r.tt=e,r.ee=1,{parentNode:t,grandParent:r,curNode:e}}t.ee=0,r===this.Y?this.Y=r.se():r.se(),r.ee=1}else{let i=r.U;if(i&&1===i.ee){if(i.ee=t.ee=0,r===this.Y)return;r.ee=1,e=r;continue}if(e===t.U){if(e.ee=0,e.U&&(e.U.tt=r),e.W&&(e.W.tt=t),r.W=e.U,t.U=e.W,e.U=r,e.W=t,r===this.Y)this.Y=e,this.h.tt=e;else{let t=r.tt;t.U===r?t.U=e:t.W=e}return e.tt=r.tt,t.tt=e,r.tt=e,r.ee=1,{parentNode:t,grandParent:r,curNode:e}}t.ee=0,r===this.Y?this.Y=r.te():r.te(),r.ee=1}return}}ne(e,t,r){if(void 0===this.Y)return this.i+=1,this.Y=new this.re(e,t),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,void(this.h.W=this.Y);let i,n=this.h.U,o=this.v(n.u,e);if(0!==o){if(o>0)n.U=new this.re(e,t),n.U.tt=n,i=n.U,this.h.U=i;else{let n=this.h.W,o=this.v(n.u,e);if(0===o)return void(n.l=t);if(o<0)n.W=new this.re(e,t),n.W.tt=n,i=n.W,this.h.W=i;else{if(void 0!==r){let n=r.o;if(n!==this.h){let r=this.v(n.u,e);if(0===r)return void(n.l=t);if(r>0){let r=n.L(),o=this.v(r.u,e);if(0===o)return void(r.l=t);o<0&&(i=new this.re(e,t),void 0===r.W?(r.W=i,i.tt=r):(n.U=i,i.tt=n))}}}if(void 0===i)for(i=this.Y;;){let r=this.v(i.u,e);if(r>0){if(void 0===i.U){i.U=new this.re(e,t),i.U.tt=i,i=i.U;break}i=i.U}else{if(!(r<0))return void(i.l=t);if(void 0===i.W){i.W=new this.re(e,t),i.W.tt=i,i=i.W;break}i=i.W}}}}return this.i+=1,i}n.l=t}I(e,t){for(;e;){let r=this.v(e.u,t);if(r<0)e=e.W;else{if(!(r>0))return e;e=e.U}}return e||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(e,t){let r=e.o;if(r===this.h&&(0,i.throwIteratorAccessError)(),1===this.i)return r.u=t,!0;if(r===this.h.U)return this.v(r.B().u,t)>0&&(r.u=t,!0);if(r===this.h.W)return this.v(r.L().u,t)<0&&(r.u=t,!0);let n=r.L().u;if(this.v(n,t)>=0)return!1;let o=r.B().u;return!(this.v(o,t)<=0||(r.u=t,0))}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let t=0,r=this;return this.oe(this.Y,(i=>e===t?(r.V(i),!0):(t+=1,!1))),this.i}eraseElementByKey(e){if(0===this.i)return!1;let t=this.I(this.Y,e);return t!==this.h&&(this.V(t),!0)}eraseElementByIterator(e){let t=e.o;t===this.h&&(0,i.throwIteratorAccessError)();let r=void 0===t.W;return 0===e.iteratorType?r&&e.next():(!r||void 0===t.U)&&e.next(),this.V(t),e}forEach(e){let t=0;for(let r of this)e(r,t++,this)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let t,r=0;for(let i of this){if(r===e){t=i;break}r+=1}return t}getHeight(){if(0===this.i)return 0;let e=t=>t?Math.max(e(t.U),e(t.W))+1:0;return e(this.Y)}constructor(e=((e,t)=>e<t?-1:e>t?1:0),r=!1){super(),this.Y=void 0,this.v=e,r?(this.re=t.TreeNodeEnableIndex,this.M=function(e,t,r){let i=this.ne(e,t,r);if(i){let e=i.tt;for(;e!==this.h;)e.rt+=1,e=e.tt;let t=this.he(i);if(t){let{parentNode:e,grandParent:r,curNode:i}=t;e.ie(),r.ie(),i.ie()}}return this.i},this.V=function(e){let t=this.fe(e);for(;t!==this.h;)t.rt-=1,t=t.tt}):(this.re=t.TreeNode,this.M=function(e,t,r){let i=this.ne(e,t,r);return i&&this.he(i),this.i},this.V=this.fe),this.h=new this.re}};e.default=n})),di=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=ti(),r=si(),i=class extends t.ContainerIterator{get index(){let e=this.o,t=this.h.tt;if(e===this.h)return t?t.rt-1:0;let r=0;for(e.U&&(r+=e.U.rt);e!==t;){let t=e.tt;e===t.W&&(r+=1,t.U&&(r+=t.U.rt)),e=t}return r}constructor(e,t,i){super(i),this.o=e,this.h=t,0===this.iteratorType?(this.pre=function(){return this.o===this.h.U&&(0,r.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,r.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o=this.o.L(),this})}};e.default=i})),pi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=n(fi()),r=n(di()),i=si();function n(e){return e&&e.t?e:{default:e}}var o=class e extends r.default{get pointer(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o.u}copy(){return new e(this.o,this.h,this.container,this.iteratorType)}constructor(e,t,r,i){super(e,t,i),this.container=r}},s=class extends t.default{*K(e){void 0!==e&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W))}begin(){return new o(this.h.U||this.h,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this.h.W||this.h,this.h,this,1)}rEnd(){return new o(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,t){return this.M(e,void 0,t)}find(e){let t=this.I(this.Y,e);return new o(t,this.h,this)}lowerBound(e){let t=this.X(this.Y,e);return new o(t,this.h,this)}upperBound(e){let t=this.Z(this.Y,e);return new o(t,this.h,this)}reverseLowerBound(e){let t=this.$(this.Y,e);return new o(t,this.h,this)}reverseUpperBound(e){let t=this.rr(this.Y,e);return new o(t,this.h,this)}union(e){let t=this;return e.forEach((e=>{t.insert(e)})),this.i}[Symbol.iterator](){return this.K(this.Y)}constructor(e=[],t,r){super(t,r);let i=this;e.forEach((e=>{i.insert(e)}))}};e.default=s})),gi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=n(fi()),r=n(di()),i=si();function n(e){return e&&e.t?e:{default:e}}var o=class e extends r.default{get pointer(){this.o===this.h&&(0,i.throwIteratorAccessError)();let e=this;return new Proxy([],{get:(t,r)=>"0"===r?e.o.u:"1"===r?e.o.l:void 0,set(t,r,i){if("1"!==r)throw new TypeError("props must be 1");return e.o.l=i,!0}})}copy(){return new e(this.o,this.h,this.container,this.iteratorType)}constructor(e,t,r,i){super(e,t,i),this.container=r}},s=class extends t.default{*K(e){void 0!==e&&(yield*this.K(e.U),yield[e.u,e.l],yield*this.K(e.W))}begin(){return new o(this.h.U||this.h,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this.h.W||this.h,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){if(0===this.i)return;let e=this.h.U;return[e.u,e.l]}back(){if(0===this.i)return;let e=this.h.W;return[e.u,e.l]}lowerBound(e){let t=this.X(this.Y,e);return new o(t,this.h,this)}upperBound(e){let t=this.Z(this.Y,e);return new o(t,this.h,this)}reverseLowerBound(e){let t=this.$(this.Y,e);return new o(t,this.h,this)}reverseUpperBound(e){let t=this.rr(this.Y,e);return new o(t,this.h,this)}setElement(e,t,r){return this.M(e,t,r)}find(e){let t=this.I(this.Y,e);return new o(t,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let t=this;return e.forEach((e=>{t.setElement(e[0],e[1])})),this.i}[Symbol.iterator](){return this.K(this.Y)}constructor(e=[],t,r){super(t,r);let i=this;e.forEach((e=>{i.setElement(e[0],e[1])}))}};e.default=s})),bi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=function(e){let t=typeof e;return"object"===t&&null!==e||"function"===t}})),mi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.HashContainerIterator=e.HashContainer=void 0;var t,r=ti(),i=(t=bi())&&t.t?t:{default:t},n=si(),o=class extends r.ContainerIterator{constructor(e,t,r){super(r),this.o=e,this.h=t,0===this.iteratorType?(this.pre=function(){return this.o.L===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o=this.o.L,this})}};e.HashContainerIterator=o;var s=class extends r.Container{V(e){let{L:t,B:r}=e;t.B=r,r.L=t,e===this.p&&(this.p=r),e===this._&&(this._=t),this.i-=1}M(e,t,r){let n;if(void 0===r&&(r=(0,i.default)(e)),r){let r=e[this.HASH_TAG];if(void 0!==r)return this.H[r].l=t,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),n={u:e,l:t,L:this._,B:this.h},this.H.push(n)}else{let r=this.g[e];if(r)return r.l=t,this.i;n={u:e,l:t,L:this._,B:this.h},this.g[e]=n}return 0===this.i?(this.p=n,this.h.B=n):this._.B=n,this._=n,this.h.L=n,++this.i}I(e,t){if(void 0===t&&(t=(0,i.default)(e)),t){let t=e[this.HASH_TAG];return void 0===t?this.h:this.H[t]}return this.g[e]||this.h}clear(){let e=this.HASH_TAG;this.H.forEach((t=>{delete t.u[e]})),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(e,t){let r;if(void 0===t&&(t=(0,i.default)(e)),t){let t=e[this.HASH_TAG];if(void 0===t)return!1;delete e[this.HASH_TAG],r=this.H[t],delete this.H[t]}else{if(r=this.g[e],void 0===r)return!1;delete this.g[e]}return this.V(r),!0}eraseElementByIterator(e){let t=e.o;return t===this.h&&(0,n.throwIteratorAccessError)(),this.V(t),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let t=this.p;for(;e--;)t=t.B;return this.V(t),this.i}constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol(),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}};e.HashContainer=s})),yi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=mi(),r=si(),i=class e extends t.HashContainerIterator{get pointer(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o.u}copy(){return new e(this.o,this.h,this.container,this.iteratorType)}constructor(e,t,r,i){super(e,t,i),this.container=r}},n=class extends t.HashContainer{begin(){return new i(this.p,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this._,this.h,this,1)}rEnd(){return new i(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(e,t){return this.M(e,void 0,t)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let t=this.p;for(;e--;)t=t.B;return t.u}find(e,t){let r=this.I(e,t);return new i(r,this.h,this)}forEach(e){let t=0,r=this.p;for(;r!==this.h;)e(r.u,t++,this),r=r.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield e.u,e=e.B}.bind(this)()}constructor(e=[]){super();let t=this;e.forEach((e=>{t.insert(e)}))}};e.default=n})),vi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t,r=mi(),i=(t=bi())&&t.t?t:{default:t},n=si(),o=class e extends r.HashContainerIterator{get pointer(){this.o===this.h&&(0,n.throwIteratorAccessError)();let e=this;return new Proxy([],{get:(t,r)=>"0"===r?e.o.u:"1"===r?e.o.l:void 0,set(t,r,i){if("1"!==r)throw new TypeError("props must be 1");return e.o.l=i,!0}})}copy(){return new e(this.o,this.h,this.container,this.iteratorType)}constructor(e,t,r,i){super(e,t,i),this.container=r}},s=class extends r.HashContainer{begin(){return new o(this.p,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this._,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){if(0!==this.i)return[this.p.u,this.p.l]}back(){if(0!==this.i)return[this._.u,this._.l]}setElement(e,t,r){return this.M(e,t,r)}getElementByKey(e,t){if(void 0===t&&(t=(0,i.default)(e)),t){let t=e[this.HASH_TAG];return void 0!==t?this.H[t].l:void 0}let r=this.g[e];return r?r.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let t=this.p;for(;e--;)t=t.B;return[t.u,t.l]}find(e,t){let r=this.I(e,t);return new o(r,this.h,this)}forEach(e){let t=0,r=this.p;for(;r!==this.h;)e([r.u,r.l],t++,this),r=r.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield[e.u,e.l],e=e.B}.bind(this)()}constructor(e=[]){super();let t=this;e.forEach((e=>{t.setElement(e[0],e[1])}))}};e.default=s})),wi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"t",{value:!0}),Object.defineProperty(e,"Deque",{enumerable:!0,get:()=>s.default}),Object.defineProperty(e,"HashMap",{enumerable:!0,get:()=>h.default}),Object.defineProperty(e,"HashSet",{enumerable:!0,get:()=>u.default}),Object.defineProperty(e,"LinkList",{enumerable:!0,get:()=>o.default}),Object.defineProperty(e,"OrderedMap",{enumerable:!0,get:()=>l.default}),Object.defineProperty(e,"OrderedSet",{enumerable:!0,get:()=>a.default}),Object.defineProperty(e,"PriorityQueue",{enumerable:!0,get:()=>i.default}),Object.defineProperty(e,"Queue",{enumerable:!0,get:()=>r.default}),Object.defineProperty(e,"Stack",{enumerable:!0,get:()=>t.default}),Object.defineProperty(e,"Vector",{enumerable:!0,get:()=>n.default});var t=c(ri()),r=c(ii()),i=c(ni()),n=c(li()),o=c(ui()),s=c(hi()),a=c(pi()),l=c(gi()),u=c(yi()),h=c(vi());function c(e){return e&&e.t?e:{default:e}}})),_i=M(((e,t)=>{j(),Pt(),pt();var r=wi().OrderedSet,i=jr()("number-allocator:trace"),n=jr()("number-allocator:error");function o(e,t){this.low=e,this.high=t}function s(e,t){if(!(this instanceof s))return new s(e,t);this.min=e,this.max=t,this.ss=new r([],((e,t)=>e.compare(t))),i("Create"),this.clear()}o.prototype.equals=function(e){return this.low===e.low&&this.high===e.high},o.prototype.compare=function(e){return this.low<e.low&&this.high<e.low?-1:e.low<this.low&&e.high<this.low?1:0},s.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},s.prototype.alloc=function(){if(0===this.ss.size())return i("alloc():empty"),null;let e=this.ss.begin(),t=e.pointer.low,r=e.pointer.high,n=t;return n+1<=r?this.ss.updateKeyByIterator(e,new o(t+1,r)):this.ss.eraseElementByPos(0),i("alloc():"+n),n},s.prototype.use=function(e){let t=new o(e,e),r=this.ss.lowerBound(t);if(!r.equals(this.ss.end())){let n=r.pointer.low,s=r.pointer.high;return r.pointer.equals(t)?(this.ss.eraseElementByIterator(r),i("use():"+e),!0):!(n>e||(n===e?(this.ss.updateKeyByIterator(r,new o(n+1,s)),i("use():"+e),0):s===e?(this.ss.updateKeyByIterator(r,new o(n,s-1)),i("use():"+e),0):(this.ss.updateKeyByIterator(r,new o(e+1,s)),this.ss.insert(new o(n,e-1)),i("use():"+e),0)))}return i("use():failed"),!1},s.prototype.free=function(e){if(e<this.min||e>this.max)return void n("free():"+e+" is out of range");let t=new o(e,e),r=this.ss.upperBound(t);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin()))return void this.ss.insert(t);r.pre();let i=r.pointer.high;r.pointer.high+1===e?this.ss.updateKeyByIterator(r,new o(i,e)):this.ss.insert(t)}else if(r.equals(this.ss.begin()))if(e+1===r.pointer.low){let t=r.pointer.high;this.ss.updateKeyByIterator(r,new o(e,t))}else this.ss.insert(t);else{let i=r.pointer.low,n=r.pointer.high;r.pre();let s=r.pointer.low;r.pointer.high+1===e?e+1===i?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new o(s,n))):this.ss.updateKeyByIterator(r,new o(s,e)):e+1===i?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new o(e,n))):this.ss.insert(t)}i("free():"+e)},s.prototype.clear=function(){i("clear()"),this.ss.clear(),this.ss.insert(new o(this.min,this.max))},s.prototype.intervalCount=function(){return this.ss.size()},s.prototype.dump=function(){for(let e of this.ss);},t.exports=s})),Ei=M(((e,t)=>{j(),Pt(),pt();var r=_i();t.exports.NumberAllocator=r})),Si=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0});var t=ei(),r=Ei();e.default=class{put(e,t){if(0===t||t>this.max)return!1;let r=this.aliasToTopic.get(t);return r&&delete this.topicToAlias[r],this.aliasToTopic.set(t,e),this.topicToAlias[e]=t,this.numberAllocator.use(t),this.length=this.aliasToTopic.size,!0}getTopicByAlias(e){return this.aliasToTopic.get(e)}getAliasByTopic(e){let t=this.topicToAlias[e];return typeof t<"u"&&this.aliasToTopic.get(t),t}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){return this.numberAllocator.firstVacant()||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}constructor(e){e>0&&(this.aliasToTopic=new t.LRUCache({max:e}),this.topicToAlias={},this.numberAllocator=new r.NumberAllocator(1,e),this.max=e,this.length=0)}}})),Ai=M((e=>{j(),Pt(),pt();var t=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0});var r=Xr(),i=t(Si()),n=Jr();e.default=(e,t)=>{e.log("_handleConnack");let{options:o}=e,s=5===o.protocolVersion?t.reasonCode:t.returnCode;if(clearTimeout(e.connackTimer),delete e.topicAliasSend,t.properties){if(t.properties.topicAliasMaximum){if(t.properties.topicAliasMaximum>65535)return void e.emit("error",Error("topicAliasMaximum from broker is out of range"));t.properties.topicAliasMaximum>0&&(e.topicAliasSend=new i.default(t.properties.topicAliasMaximum))}t.properties.serverKeepAlive&&o.keepalive&&(o.keepalive=t.properties.serverKeepAlive),t.properties.maximumPacketSize&&(o.properties||(o.properties={}),o.properties.maximumPacketSize=t.properties.maximumPacketSize)}if(0===s)e.reconnecting=!1,e._onConnect(t);else if(s>0){let t=new n.ErrorWithReasonCode("Connection refused: "+r.ReasonCodes[s],s);e.emit("error",t),e.options.reconnectOnConnackError&&e._cleanUp(!0)}}})),ki=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.default=(e,t,r)=>{e.log("handling pubrel packet");let i=typeof r<"u"?r:e.noop,{messageId:n}=t,o={cmd:"pubcomp",messageId:n};e.incomingStore.get(t,((t,r)=>{t?e._sendPacket(o,i):(e.emit("message",r.topic,r.payload,r),e.handleMessage(r,(t=>{if(t)return i(t);e.incomingStore.del(r,e.noop),e._sendPacket(o,i)})))}))}})),Ii=M((e=>{j(),Pt(),pt();var t=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0});var r=t(Qr()),i=t(Zr()),n=t(Ai()),o=t(Xr()),s=t(ki());e.default=(e,t,a)=>{let{options:l}=e;if(5===l.protocolVersion&&l.properties&&l.properties.maximumPacketSize&&l.properties.maximumPacketSize<t.length)return e.emit("error",Error("exceeding packets size "+t.cmd)),e.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),e;switch(e.log("_handlePacket :: emitting packetreceive"),e.emit("packetreceive",t),t.cmd){case"publish":(0,r.default)(e,t,a);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":e.reschedulePing(),(0,o.default)(e,t),a();break;case"pubrel":e.reschedulePing(),(0,s.default)(e,t,a);break;case"connack":(0,n.default)(e,t),a();break;case"auth":e.reschedulePing(),(0,i.default)(e,t),a();break;case"pingresp":e.log("_handlePacket :: received pingresp"),e.reschedulePing(!0),a();break;case"disconnect":e.emit("disconnect",t),a();break;default:e.log("_handlePacket :: unknown command"),a()}}})),Ti=M((e=>{j(),Pt(),pt();var t=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0}),e.TypedEventEmitter=void 0;var r=t((nr(),U(Jt))),i=Jr(),n=class{};e.TypedEventEmitter=n,(0,i.applyMixin)(n,r.default)})),Pi=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.isReactNativeBrowser=e.isWebWorker=void 0;var t,r=()=>{var e,t;return!("object"!=typeof self||null===(t=null===(e=null===self||void 0===self?void 0:self.constructor)||void 0===e?void 0:e.name)||void 0===t||!t.includes("WorkerGlobalScope"))},i=()=>typeof navigator<"u"&&"ReactNative"===navigator.product,n=typeof window<"u"&&(typeof navigator<"u"&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.toLowerCase().indexOf(" electron/"))>-1&&null!=N&&N.versions?!{}.hasOwnProperty.call(N.versions,"electron"):typeof window.document<"u")||r()||i();e.isWebWorker=r(),e.isReactNativeBrowser=i(),e.default=n})),Ci=M(((e,t)=>{var r,i;j(),Pt(),pt(),r=e,i=e=>{var t,r=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,i=536870912,n=2*i,o=new WeakMap,s=((e,t)=>o=>{var s=t.get(o),a=void 0===s?o.size:s<n?s+1:0;if(!o.has(a))return e(o,a);if(o.size<i){for(;o.has(a);)a=Math.floor(Math.random()*n);return e(o,a)}if(o.size>r)throw Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;o.has(a);)a=Math.floor(Math.random()*r);return e(o,a)})((t=o,(e,r)=>(t.set(e,r),r)),o),a=(e=>t=>{var r=e(t);return t.add(r),r})(s);e.addUniqueNumber=a,e.generateUniqueNumber=s},"object"==typeof e&&typeof t<"u"?i(e):"function"==typeof define&&define.amd?define(["exports"],i):i((r=typeof globalThis<"u"?globalThis:r||self).fastUniqueNumbers={})})),Ri=M(((e,t)=>{var r,i;j(),Pt(),pt(),r=e,i=(e,t)=>{e.load=e=>{var r=new Map([[0,()=>{}]]),i=new Map([[0,()=>{}]]),n=new Map,o=new Worker(e);return o.addEventListener("message",(e=>{var t=e.data;if((e=>void 0!==e.method&&"call"===e.method)(t)){var o=t.params,s=o.timerId,a=o.timerType;if("interval"===a){var l=r.get(s);if("number"==typeof l){var u=n.get(l);if(void 0===u||u.timerId!==s||u.timerType!==a)throw Error("The timer is in an undefined state.")}else{if(!(typeof l<"u"))throw Error("The timer is in an undefined state.");l()}}else if("timeout"===a){var h=i.get(s);if("number"==typeof h){var c=n.get(h);if(void 0===c||c.timerId!==s||c.timerType!==a)throw Error("The timer is in an undefined state.")}else{if(!(typeof h<"u"))throw Error("The timer is in an undefined state.");h(),i.delete(s)}}}else{if(!(e=>null===e.error&&"number"==typeof e.id)(t)){var f=t.error.message;throw Error(f)}var d=t.id,p=n.get(d);if(void 0===p)throw Error("The timer is in an undefined state.");var g=p.timerId,b=p.timerType;n.delete(d),"interval"===b?r.delete(g):i.delete(g)}})),{clearInterval(e){var i=t.generateUniqueNumber(n);n.set(i,{timerId:e,timerType:"interval"}),r.set(e,i),o.postMessage({id:i,method:"clear",params:{timerId:e,timerType:"interval"}})},clearTimeout(e){var r=t.generateUniqueNumber(n);n.set(r,{timerId:e,timerType:"timeout"}),i.set(e,r),o.postMessage({id:r,method:"clear",params:{timerId:e,timerType:"timeout"}})},setInterval(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.generateUniqueNumber(r);return r.set(n,(()=>{e(),"function"==typeof r.get(n)&&o.postMessage({id:null,method:"set",params:{delay:i,now:performance.now(),timerId:n,timerType:"interval"}})})),o.postMessage({id:null,method:"set",params:{delay:i,now:performance.now(),timerId:n,timerType:"interval"}}),n},setTimeout(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.generateUniqueNumber(i);return i.set(n,e),o.postMessage({id:null,method:"set",params:{delay:r,now:performance.now(),timerId:n,timerType:"timeout"}}),n}}}},"object"==typeof e&&typeof t<"u"?i(e,Ci()):"function"==typeof define&&define.amd?define(["exports","fast-unique-numbers"],i):i((r=typeof globalThis<"u"?globalThis:r||self).workerTimersBroker={},r.fastUniqueNumbers)})),Oi=M(((e,t)=>{var r,i;j(),Pt(),pt(),r=e,i=(e,t)=>{var r,i,n=(r=t.load,i=null,()=>{if(null!==i)return i;var e=new Blob(['(()=>{var e={472:(e,t,r)=>{var o,i;void 0===(i="function"==typeof(o=function(){"use strict";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error(\'There is no interval scheduled with the given id "\'.concat(t,\'".\'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:"call",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,"interval"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,"timeout"))};addEventListener("message",(function(e){var t=e.data;try{if("clear"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if("interval"===c)r(d),postMessage({error:null,id:i});else{if("timeout"!==c)throw new Error(\'The given type "\'.concat(c,\'" is not supported\'));o(d),postMessage({error:null,id:i})}}else{if("set"!==t.method)throw new Error(\'The given method "\'.concat(t.method,\'" is not supported\'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if("interval"===v)a(l,m,p);else{if("timeout"!==v)throw new Error(\'The given type "\'.concat(v,\'" is not supported\'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(472)})()})();'],{type:"application/javascript; charset=utf-8"}),t=URL.createObjectURL(e);return i=r(t),setTimeout((()=>URL.revokeObjectURL(t))),i});e.clearInterval=e=>n().clearInterval(e),e.clearTimeout=e=>n().clearTimeout(e),e.setInterval=function(){var e;return(e=n()).setInterval.apply(e,arguments)},e.setTimeout=function(){var e;return(e=n()).setTimeout.apply(e,arguments)}},"object"==typeof e&&typeof t<"u"?i(e,Ri()):"function"==typeof define&&define.amd?define(["exports","worker-timers-broker"],i):i((r=typeof globalThis<"u"?globalThis:r||self).workerTimers={},r.workerTimersBroker)})),Bi=M((e=>{j(),Pt(),pt();var t,r=e&&e.__createBinding||(Object.create?(e,t,r,i)=>{void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:()=>t[r]}),Object.defineProperty(e,i,n)}:(e,t,r,i)=>{void 0===i&&(i=r),e[i]=t[r]}),i=e&&e.__setModuleDefault||(Object.create?(e,t)=>{Object.defineProperty(e,"default",{enumerable:!0,value:t})}:(e,t)=>{e.default=t}),n=e&&e.__importStar||(t=e=>(t=Object.getOwnPropertyNames||(e=>{var t=[];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[t.length]=r);return t}))(e),e=>{if(e&&e.__esModule)return e;var n={};if(null!=e)for(var o=t(e),s=0;s<o.length;s++)"default"!==o[s]&&r(n,e,o[s]);return i(n,e),n});Object.defineProperty(e,"__esModule",{value:!0});var o=n(Pi()),s=Oi(),a={set:s.setInterval,clear:s.clearInterval},l={set:(e,t)=>setInterval(e,t),clear:e=>clearInterval(e)};e.default=e=>{switch(e){case"native":return l;case"worker":return a;default:return!o.default||o.isWebWorker||o.isReactNativeBrowser?l:a}}})),xi=M((e=>{j(),Pt(),pt();var t=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0});var r=t(Bi());e.default=class{get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(e){if(isNaN(e*=1e3)||e<=0||e>2147483647)throw Error("Keepalive value must be an integer between 0 and 2147483647. Provided value is "+e);this._keepalive=e,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${e}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let e=Math.ceil(1.5*this._keepalive);this._keepaliveTimeoutTimestamp=Date.now()+e,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set((()=>{this.destroyed||(this.counter+=1,2===this.counter?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())}),this._intervalEvery)}constructor(e,t){this.destroyed=!1,this.client=e,this.timer="object"==typeof t&&"set"in t&&"clear"in t?t:(0,r.default)(t),this.setKeepalive(e.options.keepalive)}}})),Mi=M((e=>{j(),Pt(),pt();var t,r=e&&e.__createBinding||(Object.create?(e,t,r,i)=>{void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:()=>t[r]}),Object.defineProperty(e,i,n)}:(e,t,r,i)=>{void 0===i&&(i=r),e[i]=t[r]}),i=e&&e.__setModuleDefault||(Object.create?(e,t)=>{Object.defineProperty(e,"default",{enumerable:!0,value:t})}:(e,t)=>{e.default=t}),n=e&&e.__importStar||(t=e=>(t=Object.getOwnPropertyNames||(e=>{var t=[];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[t.length]=r);return t}))(e),e=>{if(e&&e.__esModule)return e;var n={};if(null!=e)for(var o=t(e),s=0;s<o.length;s++)"default"!==o[s]&&r(n,e,o[s]);return i(n,e),n}),o=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0});var s=o(Ct()),a=o($r()),l=o(Hr()),u=Cr(),h=o(zr()),c=n(Kr()),f=o(jr()),d=o(Gr()),p=o(Ii()),g=Jr(),b=Ti(),m=o(xi()),y=n(Pi()),v=globalThis.setImmediate||((...e)=>{let t=e.shift();(0,g.nextTick)((()=>{t(...e)}))}),w={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:"auto"},_=class e extends b.TypedEventEmitter{static defaultId(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}handleAuth(e,t){t()}handleMessage(e,t){t()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var e;let t=new u.Writable,r=a.default.parser(this.options),i=null,n=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new d.default,this.outgoingStore=this.options.outgoingStore||new d.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",(e=>{this.log("parser :: on packet push to packets array."),n.push(e)}));let o=()=>{this.log("work :: getting next packet in queue");let e=n.shift();if(e)this.log("work :: packet pulled from queue"),(0,p.default)(this,e,s);else{this.log("work :: no packets in queue");let e=i;i=null,this.log("work :: done flag is %s",!!e),e&&e()}},s=()=>{if(n.length)(0,g.nextTick)(o);else{let e=i;i=null,e()}};t._write=(e,t,n)=>{i=n,this.log("writable stream :: parsing buffer"),r.parse(e),o()},this.log("connect :: pipe stream to writable stream"),this.stream.pipe(t),this.stream.on("error",(e=>{this.log("streamErrorHandler :: error",e.message),e.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",e)):this.noop(e)})),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 l={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&&(l.will=Object.assign(Object.assign({},this.options.will),{payload:null===(e=this.options.will)||void 0===e?void 0:e.payload})),this.topicAliasRecv&&(l.properties||(l.properties={}),this.topicAliasRecv&&(l.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(l),r.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",Error("Packet has no Authentication Method")))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket){let e=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(e)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this.emit("error",Error("connack timeout")),this._cleanUp(!0)}),this.options.connectTimeout),this}publish(e,t,r,i){this.log("publish :: message `%s` to topic `%s`",t,e);let{options:n}=this;"function"==typeof r&&(i=r,r=null),r=r||{},r=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),r);let{qos:o,retain:s,dup:a,properties:l,cbStorePut:u}=r;if(this._checkDisconnecting(i))return this;let h=()=>{let r=0;if((1===o||2===o)&&(r=this._nextId(),null===r))return this.log("No messageId left"),!1;let h={cmd:"publish",topic:e,payload:t,qos:o,retain:s,messageId:r,dup:a};switch(5===n.protocolVersion&&(h.properties=l),this.log("publish :: qos",o),o){case 1:case 2:this.outgoing[h.messageId]={volatile:!1,cb:i||this.noop},this.log("MqttClient:publish: packet cmd: %s",h.cmd),this._sendPacket(h,void 0,u);break;default:this.log("MqttClient:publish: packet cmd: %s",h.cmd),this._sendPacket(h,i,u)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!h())&&this._storeProcessingQueue.push({invoke:h,cbStorePut:r.cbStorePut,callback:i}),this}publishAsync(e,t,r){return new Promise(((i,n)=>{this.publish(e,t,r,((e,t)=>{e?n(e):i(t)}))}))}subscribe(e,t,r){let i=this.options.protocolVersion;"function"==typeof t&&(r=t),r=r||this.noop;let n=!1,o=[];"string"==typeof e?o=e=[e]:Array.isArray(e)?o=e:"object"==typeof e&&(n=e.resubscribe,delete e.resubscribe,o=Object.keys(e));let s=c.validateTopics(o);if(null!==s)return v(r,Error("Invalid topic "+s)),this;if(this._checkDisconnecting(r))return this.log("subscribe: discconecting true"),this;let a={qos:0};5===i&&(a.nl=!1,a.rap=!1,a.rh=0);let l=(t=Object.assign(Object.assign({},a),t)).properties,u=[],h=(e,r)=>{if(r=r||t,!{}.hasOwnProperty.call(this._resubscribeTopics,e)||this._resubscribeTopics[e].qos<r.qos||n){let t={topic:e,qos:r.qos};5===i&&(t.nl=r.nl,t.rap=r.rap,t.rh=r.rh,t.properties=l),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",t.topic,t.qos),u.push(t)}};if(Array.isArray(e)?e.forEach((e=>{this.log("subscribe: array topic %s",e),h(e)})):Object.keys(e).forEach((t=>{this.log("subscribe: object topic %s, %o",t,e[t]),h(t,e[t])})),!u.length)return r(null,[]),this;let f=()=>{let e=this._nextId();if(null===e)return this.log("No messageId left"),!1;let t={cmd:"subscribe",subscriptions:u,messageId:e};if(l&&(t.properties=l),this.options.resubscribe){this.log("subscribe :: resubscribe true");let e=[];u.forEach((t=>{if(this.options.reconnectPeriod>0){let r={qos:t.qos};5===i&&(r.nl=t.nl||!1,r.rap=t.rap||!1,r.rh=t.rh||0,r.properties=t.properties),this._resubscribeTopics[t.topic]=r,e.push(t.topic)}})),this.messageIdToTopic[t.messageId]=e}return this.outgoing[t.messageId]={volatile:!0,cb(e,t){if(!e){let{granted:e}=t;for(let t=0;t<e.length;t+=1)u[t].qos=e[t]}r(e,u,t)}},this.log("subscribe :: call _sendPacket"),this._sendPacket(t),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!f())&&this._storeProcessingQueue.push({invoke:f,callback:r}),this}subscribeAsync(e,t){return new Promise(((r,i)=>{this.subscribe(e,t,((e,t)=>{e?i(e):r(t)}))}))}unsubscribe(e,t,r){"string"==typeof e&&(e=[e]),"function"==typeof t&&(r=t),r=r||this.noop;let i=c.validateTopics(e);if(null!==i)return v(r,Error("Invalid topic "+i)),this;if(this._checkDisconnecting(r))return this;let n=()=>{let i=this._nextId();if(null===i)return this.log("No messageId left"),!1;let n={cmd:"unsubscribe",messageId:i,unsubscriptions:[]};return"string"==typeof e?n.unsubscriptions=[e]:Array.isArray(e)&&(n.unsubscriptions=e),this.options.resubscribe&&n.unsubscriptions.forEach((e=>{delete this._resubscribeTopics[e]})),"object"==typeof t&&t.properties&&(n.properties=t.properties),this.outgoing[n.messageId]={volatile:!0,cb:r},this.log("unsubscribe: call _sendPacket"),this._sendPacket(n),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!n())&&this._storeProcessingQueue.push({invoke:n,callback:r}),this}unsubscribeAsync(e,t){return new Promise(((r,i)=>{this.unsubscribe(e,t,((e,t)=>{e?i(e):r(t)}))}))}end(e,t,r){this.log("end :: (%s)",this.options.clientId),(null==e||"boolean"!=typeof e)&&(r=r||t,t=e,e=!1),"object"!=typeof t&&(r=r||t,t=null),this.log("end :: cb? %s",!!r),(!r||"function"!=typeof r)&&(r=this.noop);let i=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close((e=>{this.outgoingStore.close((t=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),r){let i=e||t;this.log("end :: closeStores: invoking callback with args"),r(i)}}))})),this._deferredReconnect?this._deferredReconnect():(0===this.options.reconnectPeriod||this.options.manualConnect)&&(this.disconnecting=!1)},n=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,e),this._cleanUp(e,(()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,g.nextTick)(i)}),t)};return this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&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,n,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),n()),this)}endAsync(e,t){return new Promise(((r,i)=>{this.end(e,t,(e=>{e?i(e):r()}))}))}removeOutgoingMessage(e){if(this.outgoing[e]){let{cb:t}=this.outgoing[e];this._removeOutgoingAndStoreMessage(e,(()=>{t(Error("Message removed"))}))}return this}reconnect(e){this.log("client reconnect");let t=()=>{e?(this.options.incomingStore=e.incomingStore,this.options.outgoingStore=e.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new d.default,this.outgoingStore=this.options.outgoingStore||new d.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=t:t(),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((e=>{this.outgoing[e].volatile&&"function"==typeof this.outgoing[e].cb&&(this.outgoing[e].cb(Error("Connection closed")),delete this.outgoing[e])})))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach((e=>{"function"==typeof this.outgoing[e].cb&&(this.outgoing[e].cb(Error("Connection closed")),delete this.outgoing[e])})))}_removeTopicAliasAndRecoverTopicName(e){let t;e.properties&&(t=e.properties.topicAlias);let r=e.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",t,r),0===r.length){if(typeof t>"u")return Error("Unregistered Topic Alias");if(r=this.topicAliasSend.getTopicByAlias(t),typeof r>"u")return Error("Unregistered Topic Alias");e.topic=r}t&&delete e.properties.topicAlias}_checkDisconnecting(e){return this.disconnecting&&(e&&e!==this.noop?e(Error("client disconnecting")):this.emit("error",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(e,t,r={}){if(t&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),this.log("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let e=Object.assign({cmd:"disconnect"},r);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(e,(()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),v((()=>{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(),t&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())}_storeAndSend(e,t,r){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let i,n=e;if("publish"===n.cmd&&(n=(0,h.default)(e),i=this._removeTopicAliasAndRecoverTopicName(n),i))return t&&t(i);this.outgoingStore.put(n,(i=>{if(i)return t&&t(i);r(),this._writePacket(e,t)}))}_applyTopicAlias(e){if(5===this.options.protocolVersion&&"publish"===e.cmd){let t;e.properties&&(t=e.properties.topicAlias);let r=e.topic.toString();if(this.topicAliasSend)if(t){if(0!==r.length&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",r,t),!this.topicAliasSend.put(r,t)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",r,t),Error("Sending Topic Alias out of range")}else 0!==r.length&&(this.options.autoAssignTopicAlias?(t=this.topicAliasSend.getAliasByTopic(r),t?(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:t}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",r,t)):(t=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(r,t),e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:t}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",r,t))):this.options.autoUseTopicAlias&&(t=this.topicAliasSend.getAliasByTopic(r),t&&(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:t}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",r,t))));else if(t)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",r,t),Error("Sending Topic Alias out of range")}}_noop(e){this.log("noop ::",e)}_writePacket(e,t){this.log("_writePacket :: packet: %O",e),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",e),this.log("_writePacket :: writing to stream");let r=a.default.writeToStream(e,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",r),!r&&t&&t!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",t)):t&&(this.log("_writePacket :: invoking cb"),t())}_sendPacket(e,t,r,i){this.log("_sendPacket :: (%s) :: start",this.options.clientId),r=r||this.noop,t=t||this.noop;let n=this._applyTopicAlias(e);if(n)t(n);else{if(!this.connected)return"auth"===e.cmd?void this._writePacket(e,t):(this.log("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,r));if(i)this._writePacket(e,t);else{switch(e.cmd){case"publish":break;case"pubrel":return void this._storeAndSend(e,t,r);default:return void this._writePacket(e,t)}switch(e.qos){case 2:case 1:this._storeAndSend(e,t,r);break;default:this._writePacket(e,t)}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}}}_storePacket(e,t,r){this.log("_storePacket :: packet: %o",e),this.log("_storePacket :: cb? %s",!!t),r=r||this.noop;let i=e;if("publish"===i.cmd){i=(0,h.default)(e);let r=this._removeTopicAliasAndRecoverTopicName(i);if(r)return t&&t(r)}let n=i.qos||0;0===n&&this.queueQoSZero||"publish"!==i.cmd?this.queue.push({packet:i,cb:t}):n>0?(t=this.outgoing[i.messageId]?this.outgoing[i.messageId].cb:null,this.outgoingStore.put(i,(e=>{if(e)return t&&t(e);r()}))):t&&t(Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new m.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(e=!1){this.keepaliveManager&&this.options.keepalive&&(e||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",Error("Keepalive timeout")),this.log("onKeepaliveTimeout :: calling _cleanUp with force true"),this._cleanUp(!0)}_resubscribe(){this.log("_resubscribe");let e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){this.log("_resubscribe: protocolVersion 5");for(let t=0;t<e.length;t++){let r={};r[e[t]]=this._resubscribeTopics[e[t]],r.resubscribe=!0,this.subscribe(r,{properties:r[e[t]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(e){if(this.disconnected)return void this.emit("connect",e);this.connackPacket=e,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;let t=()=>{let r=this.outgoingStore.createStream(),i=()=>{r.destroy(),r=null,this._flushStoreProcessingQueue(),n()},n=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",i),r.on("error",(e=>{n(),this._flushStoreProcessingQueue(),this.removeListener("close",i),this.emit("error",e)}));let o=()=>{if(!r)return;let e,t=r.read(1);t?(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[t.messageId]?o():this.disconnecting||this.reconnectTimer?r.destroy&&r.destroy():(e=this.outgoing[t.messageId]?this.outgoing[t.messageId].cb:null,this.outgoing[t.messageId]={volatile:!1,cb(t,r){e&&e(t,r),o()}},this._packetIdsDuringStoreProcessing[t.messageId]=!0,this.messageIdProvider.register(t.messageId)?this._sendPacket(t,void 0,void 0,!0):this.log("messageId: %d has already used.",t.messageId))):r.once("readable",o)};r.on("end",(()=>{let r=!0;for(let e in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[e]){r=!1;break}this.removeListener("close",i),r?(n(),this._invokeAllStoreProcessingQueue(),this.emit("connect",e)):t()})),o()};t()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(Error("Connection closed")),e.callback&&e.callback(Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(e,t){delete this.outgoing[e],this.outgoingStore.del({messageId:e},((r,i)=>{t(r,i),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue()}))}constructor(t,r){super(),this.options=r||{};for(let e in w)typeof this.options[e]>"u"?this.options[e]=w[e]:this.options[e]=r[e];this.log=this.options.log||(0,f.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",e.VERSION),y.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",y.default?"browser":"node"),this.log("MqttClient :: options.protocol",r.protocol),this.log("MqttClient :: options.protocolVersion",r.protocolVersion),this.log("MqttClient :: options.username",r.username),this.log("MqttClient :: options.keepalive",r.keepalive),this.log("MqttClient :: options.reconnectPeriod",r.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",r.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",r.properties?r.properties.topicAliasMaximum:void 0),this.options.clientId="string"==typeof r.clientId?r.clientId:e.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===r.protocolVersion&&r.customHandleAcks?r.customHandleAcks:(...e)=>{e[3](null,0)},this.options.writeCache||(a.default.writeToStream.cacheNumbers=!1),this.streamBuilder=t,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new l.default:this.options.messageIdProvider,this.outgoingStore=r.outgoingStore||new d.default,this.incomingStore=r.incomingStore||new d.default,this.queueQoSZero=void 0===r.queueQoSZero||r.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,r.properties&&r.properties.topicAliasMaximum>0&&(r.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new s.default(r.properties.topicAliasMaximum)),this.on("connect",(()=>{let{queue:e}=this,t=()=>{let r=e.shift();this.log("deliver :: entry %o",r);let i=null;if(!r)return void this._resubscribe();i=r.packet,this.log("deliver :: call _sendPacket for %o",i);let n=!0;i.messageId&&0!==i.messageId&&(this.messageIdProvider.register(i.messageId)||(n=!1)),n?this._sendPacket(i,(e=>{r.cb&&r.cb(e),t()})):(this.log("messageId: %d has already used. The message is skipped and removed.",i.messageId),t())};this.log("connect :: sending queued packets"),t()})),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())}};_.VERSION=g.MQTTJS_VERSION,e.default=_})),Li=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0});var t=Ei();e.default=class{allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(e){return this.numberAllocator.use(e)}deallocate(e){this.numberAllocator.free(e)}clear(){this.numberAllocator.clear()}constructor(){this.numberAllocator=new t.NumberAllocator(1,65535)}}}));function Ui(e){throw new RangeError(qi[e])}function ji(e,t){let r=e.split("@"),i="";return r.length>1&&(i=r[0]+"@",e=r[1]),i+((e,t)=>{let r=[],i=e.length;for(;i--;)r[i]=t(e[i]);return r})((e=e.replace(Fi,".")).split("."),t).join(".")}function Ni(e){let t=[],r=0,i=e.length;for(;r<i;){let n=e.charCodeAt(r++);if(n>=55296&&n<=56319&&r<i){let i=e.charCodeAt(r++);56320==(64512&i)?t.push(((1023&n)<<10)+(1023&i)+65536):(t.push(n),r--)}else t.push(n)}return t}var Di,Wi,Fi,qi,$i,Hi,Vi,zi,Ki,Gi,Qi,Yi=x((()=>{j(),Pt(),pt(),Di=/^xn--/,Wi=/[^\0-\x7E]/,Fi=/[\x2E\u3002\uFF0E\uFF61]/g,qi={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$i=Math.floor,Hi=String.fromCharCode,Vi=(e,t)=>e+22+75*(e<26)-((0!=t)<<5),zi=(e,t,r)=>{let i=0;for(e=r?$i(e/700):e>>1,e+=$i(e/t);e>455;i+=36)e=$i(e/35);return $i(i+36*e/(e+38))},Gi=e=>{let t=[],r=(e=Ni(e)).length,i=128,n=0,o=72;for(let r of e)r<128&&t.push(Hi(r));let s=t.length,a=s;for(s&&t.push("-");a<r;){let r=2147483647;for(let t of e)t>=i&&t<r&&(r=t);let l=a+1;r-i>$i((2147483647-n)/l)&&Ui("overflow"),n+=(r-i)*l,i=r;for(let r of e)if(r<i&&++n>2147483647&&Ui("overflow"),r==i){let e=n;for(let r=36;;r+=36){let i=r<=o?1:r>=o+26?26:r-o;if(e<i)break;let n=e-i,s=36-i;t.push(Hi(Vi(i+n%s,0))),e=$i(n/s)}t.push(Hi(Vi(e,0))),o=zi(n,l,a==s),n=0,++a}++n,++i}return t.join("")},Qi={version:"2.1.0",ucs2:{decode:Ni,encode:e=>String.fromCodePoint(...e)},decode:Ki=e=>{let t=[],r=e.length,i=0,n=128,o=72,s=e.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)e.charCodeAt(r)>=128&&Ui("not-basic"),t.push(e.charCodeAt(r));for(let l=s>0?s+1:0;l<r;){let s=i;for(let t=1,n=36;;n+=36){l>=r&&Ui("invalid-input");let s=(a=e.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(s>=36||s>$i((2147483647-i)/t))&&Ui("overflow"),i+=s*t;let u=n<=o?1:n>=o+26?26:n-o;if(s<u)break;let h=36-u;t>$i(2147483647/h)&&Ui("overflow"),t*=h}let u=t.length+1;o=zi(i-s,u,0==s),$i(i/u)>2147483647-n&&Ui("overflow"),n+=$i(i/u),i%=u,t.splice(i++,0,n)}var a;return String.fromCodePoint(...t)},encode:Gi,toASCII:e=>ji(e,(e=>Wi.test(e)?"xn--"+Gi(e):e)),toUnicode:e=>ji(e,(e=>Di.test(e)?Ki(e.slice(4).toLowerCase()):e))},Qi.toASCII,Qi.toUnicode,Qi.ucs2,Qi.version}));function Ji(e,t){return{}.hasOwnProperty.call(e,t)}var Xi,Zi,en,tn,rn=x((()=>{j(),Pt(),pt(),Xi=(e,t,r,i)=>{t=t||"&",r=r||"=";var n={};if("string"!=typeof e||0===e.length)return n;var o=/\+/g;e=e.split(t);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var a=e.length;s>0&&a>s&&(a=s);for(var l=0;l<a;++l){var u,h,c,f,d=e[l].replace(o,"%20"),p=d.indexOf(r);p>=0?(u=d.substr(0,p),h=d.substr(p+1)):(u=d,h=""),c=decodeURIComponent(u),f=decodeURIComponent(h),Ji(n,c)?Array.isArray(n[c])?n[c].push(f):n[c]=[n[c],f]:n[c]=f}return n},Zi=e=>{switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},en=(e,t,r,i)=>(t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((i=>{var n=encodeURIComponent(Zi(i))+r;return Array.isArray(e[i])?e[i].map((e=>n+encodeURIComponent(Zi(e)))).join(t):n+encodeURIComponent(Zi(e[i]))})).join(t):i?encodeURIComponent(Zi(i))+r+encodeURIComponent(Zi(e)):""),(tn={}).decode=tn.parse=Xi,tn.encode=tn.stringify=en,tn.decode,tn.encode,tn.parse,tn.stringify}));function nn(){throw Error("setTimeout has not been defined")}function on(){throw Error("clearTimeout has not been defined")}function sn(e){if(fn===setTimeout)return setTimeout(e,0);if((fn===nn||!fn)&&setTimeout)return fn=setTimeout,setTimeout(e,0);try{return fn(e,0)}catch(t){try{return fn.call(null,e,0)}catch(t){return fn.call(this||pn,e,0)}}}function an(){yn&&bn&&(yn=!1,bn.length?mn=bn.concat(mn):vn=-1,mn.length&&ln())}function ln(){if(!yn){var e=sn(an);yn=!0;for(var t=mn.length;t;){for(bn=mn,mn=[];++vn<t;)bn&&bn[vn].run();vn=-1,t=mn.length}bn=null,yn=!1,function(e){if(dn===clearTimeout)return clearTimeout(e);if((dn===on||!dn)&&clearTimeout)return dn=clearTimeout,clearTimeout(e);try{dn(e)}catch(t){try{return dn.call(null,e)}catch(t){return dn.call(this||pn,e)}}}(e)}}function un(e,t){(this||pn).fun=e,(this||pn).array=t}function hn(){}var cn,fn,dn,pn,gn,bn,mn,yn,vn,wn,_n,En,Sn,An,kn,In,Tn,Pn=x((()=>{j(),Pt(),pt(),pn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:e,gn=cn={},(()=>{try{fn="function"==typeof setTimeout?setTimeout:nn}catch(e){fn=nn}try{dn="function"==typeof clearTimeout?clearTimeout:on}catch(e){dn=on}})(),mn=[],yn=!1,vn=-1,gn.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];mn.push(new un(e,t)),1!==mn.length||yn||sn(ln)},un.prototype.run=function(){(this||pn).fun.apply(null,(this||pn).array)},gn.title="browser",gn.browser=!0,gn.env={},gn.argv=[],gn.version="",gn.versions={},gn.on=hn,gn.addListener=hn,gn.once=hn,gn.off=hn,gn.removeListener=hn,gn.removeAllListeners=hn,gn.emit=hn,gn.prependListener=hn,gn.prependOnceListener=hn,gn.listeners=()=>[],gn.binding=()=>{throw Error("process.binding is not supported")},gn.cwd=()=>"/",gn.chdir=()=>{throw Error("process.chdir is not supported")},gn.umask=()=>0,(wn=cn).binding,wn.browser,wn.chdir,wn.cwd,wn.emit,wn.env,wn.listeners,wn.nextTick,wn.off,wn.on,wn.once,wn.prependListener,wn.prependOnceListener,wn.removeAllListeners,wn.removeListener,wn.title,wn.umask,wn.version,wn.versions})),Cn=x((()=>{j(),Pt(),pt(),_n={},En=!1,Sn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:e,(An=function(){if(En)return _n;En=!0;var e,t,r=_n={};function i(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this||Sn,t,0)}}}(()=>{try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{t="function"==typeof clearTimeout?clearTimeout:n}catch(e){t=n}})();var s,a=[],l=!1,u=-1;function h(){!l||!s||(l=!1,s.length?a=s.concat(a):u=-1,a.length&&c())}function c(){if(!l){var e=o(h);l=!0;for(var r=a.length;r;){for(s=a,a=[];++u<r;)s&&s[u].run();u=-1,r=a.length}s=null,l=!1,function(e){if(t===clearTimeout)return clearTimeout(e);if((t===n||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(e);try{t(e)}catch(r){try{return t.call(null,e)}catch(r){return t.call(this||Sn,e)}}}(e)}}function f(e,t){(this||Sn).fun=e,(this||Sn).array=t}function d(){}return r.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];a.push(new f(e,t)),1===a.length&&!l&&o(c)},f.prototype.run=function(){(this||Sn).fun.apply(null,(this||Sn).array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=d,r.addListener=d,r.once=d,r.off=d,r.removeListener=d,r.removeAllListeners=d,r.emit=d,r.prependListener=d,r.prependOnceListener=d,r.listeners=()=>[],r.binding=()=>{throw Error("process.binding is not supported")},r.cwd=()=>"/",r.chdir=()=>{throw Error("process.chdir is not supported")},r.umask=()=>0,_n}()).platform="browser",An.addListener,An.argv,An.binding,An.browser,An.chdir,An.cwd,An.emit,An.env,An.listeners,An.nextTick,An.off,An.on,An.once,An.prependListener,An.prependOnceListener,An.removeAllListeners,An.removeListener,An.title,An.umask,An.version,An.versions})),Rn=x((()=>{j(),Pt(),pt(),Cn(),kn={},In=!1,Tn=function(){if(In)return kn;In=!0;var e=An;function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,i="",n=0,o=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(o!==a-1&&1!==s)if(o!==a-1&&2===s){if(i.length<2||2!==n||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var l=i.lastIndexOf("/");if(l!==i.length-1){-1===l?(i="",n=0):n=(i=i.slice(0,l)).length-1-i.lastIndexOf("/"),o=a,s=0;continue}}else if(2===i.length||1===i.length){i="",n=0,o=a,s=0;continue}t&&(i.length>0?i+="/..":i="..",n=2)}else i.length>0?i+="/"+e.slice(o+1,a):i=e.slice(o+1,a),n=a-o-1;o=a,s=0}else 46===r&&-1!==s?++s:s=-1}return i}var i={resolve(){for(var i,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===i&&(i=e.cwd()),a=i),t(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize(e){if(t(e),0===e.length)return".";var i=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0===(e=r(e,!i)).length&&!i&&(e="."),e.length>0&&n&&(e+="/"),i?"/"+e:e},isAbsolute:e=>(t(e),e.length>0&&47===e.charCodeAt(0)),join(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var n=arguments[r];t(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":i.normalize(e)},relative(e,r){if(t(e),t(r),e===r||(e=i.resolve(e))===(r=i.resolve(r)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var o=e.length,s=o-n,a=1;a<r.length&&47===r.charCodeAt(a);++a);for(var l=r.length-a,u=s<l?s:l,h=-1,c=0;c<=u;++c){if(c===u){if(l>u){if(47===r.charCodeAt(a+c))return r.slice(a+c+1);if(0===c)return r.slice(a+c)}else s>u&&(47===e.charCodeAt(n+c)?h=c:0===c&&(h=0));break}var f=e.charCodeAt(n+c);if(f!==r.charCodeAt(a+c))break;47===f&&(h=c)}var d="";for(c=n+h+1;c<=o;++c)(c===o||47===e.charCodeAt(c))&&(0===d.length?d+="..":d+="/..");return d.length>0?d+r.slice(a+h):(a+=h,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:e=>e,dirname(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),i=47===r,n=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(r=e.charCodeAt(s))){if(!o){n=s;break}}else o=!1;return-1===n?i?"/":".":i&&1===n?"//":e.slice(0,n)},basename(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var i,n=0,o=-1,s=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,l=-1;for(i=e.length-1;i>=0;--i){var u=e.charCodeAt(i);if(47===u){if(!s){n=i+1;break}}else-1===l&&(s=!1,l=i+1),a>=0&&(u===r.charCodeAt(a)?-1==--a&&(o=i):(a=-1,o=l))}return n===o?o=l:-1===o&&(o=e.length),e.slice(n,o)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!s){n=i+1;break}}else-1===o&&(s=!1,o=i+1);return-1===o?"":e.slice(n,o)},extname(e){t(e);for(var r=-1,i=0,n=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===n&&(o=!1,n=a+1),46===l?-1===r?r=a:1!==s&&(s=1):-1!==r&&(s=-1);else if(!o){i=a+1;break}}return-1===r||-1===n||0===s||1===s&&r===n-1&&r===i+1?"":e.slice(r,n)},format(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return((e,t)=>{var r=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+i:r+"/"+i:i})(0,e)},parse(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var i,n=e.charCodeAt(0),o=47===n;o?(r.root="/",i=1):i=0;for(var s=-1,a=0,l=-1,u=!0,h=e.length-1,c=0;h>=i;--h)if(47!==(n=e.charCodeAt(h)))-1===l&&(u=!1,l=h+1),46===n?-1===s?s=h:1!==c&&(c=1):-1!==s&&(c=-1);else if(!u){a=h+1;break}return-1===s||-1===l||0===c||1===c&&s===l-1&&s===a+1?-1!==l&&(r.base=r.name=0===a&&o?e.slice(1,l):e.slice(a,l)):(0===a&&o?(r.name=e.slice(1,s),r.base=e.slice(1,l)):(r.name=e.slice(a,s),r.base=e.slice(a,l)),r.ext=e.slice(s,l)),a>0?r.dir=e.slice(0,a-1):o&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,kn=i}()})),On={};function Bn(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function xn(e,t,r){if(e&&Wn.isObject(e)&&e instanceof Bn)return e;var i=new Bn;return i.parse(e,t,r),i}function Mn(e){if("string"==typeof e)e=new URL(e);else if(!(e instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if("file:"!==e.protocol)throw new Deno.errors.InvalidData("invalid url scheme");return lo?function(e){let t=e.hostname,r=e.pathname;for(let e=0;e<r.length;e++)if("%"===r[e]){let t=r.codePointAt(e+2)||32;if("2"===r[e+1]&&102===t||"5"===r[e+1]&&99===t)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(uo,"\\"),r=decodeURIComponent(r),""!==t)return`\\\\${t}${r}`;{let e=32|r.codePointAt(1),t=r[2];if(e<so||e>ao||":"!==t)throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}(e):function(e){if(""!==e.hostname)throw new Deno.errors.InvalidData("invalid file url hostname");let t=e.pathname;for(let e=0;e<t.length;e++)if("%"===t[e]){let r=t.codePointAt(e+2)||32;if("2"===t[e+1]&&102===r)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(t)}(e)}function Ln(e){let t=ro.resolve(e),r=e.charCodeAt(e.length-1);(r===oo||lo&&r===no)&&t[t.length-1]!==ro.sep&&(t+="/");let i=new URL("file://");return t.includes("%")&&(t=t.replace(ho,"%25")),!lo&&t.includes("\\")&&(t=t.replace(co,"%5C")),t.includes("\n")&&(t=t.replace(fo,"%0A")),t.includes("\r")&&(t=t.replace(po,"%0D")),t.includes("\t")&&(t=t.replace(go,"%09")),i.pathname=t,i}function Un(e){if("string"==typeof e)e=new URL(e);else if(!(e instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if("file:"!==e.protocol)throw new Deno.errors.InvalidData("invalid url scheme");return To?function(e){let t=e.hostname,r=e.pathname;for(let e=0;e<r.length;e++)if("%"===r[e]){let t=r.codePointAt(e+2)||32;if("2"===r[e+1]&&102===t||"5"===r[e+1]&&99===t)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(Po,"\\"),r=decodeURIComponent(r),""!==t)return`\\\\${t}${r}`;{let e=32|r.codePointAt(1),t=r[2];if(e<ko||e>Io||":"!==t)throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}(e):function(e){if(""!==e.hostname)throw new Deno.errors.InvalidData("invalid file url hostname");let t=e.pathname;for(let e=0;e<t.length;e++)if("%"===t[e]){let r=t.codePointAt(e+2)||32;if("2"===t[e+1]&&102===r)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(t)}(e)}function jn(e){let t=Tn.resolve(e),r=e.charCodeAt(e.length-1);(r===Ao||To&&r===So)&&t[t.length-1]!==Tn.sep&&(t+="/");let i=new URL("file://");return t.includes("%")&&(t=t.replace(Co,"%25")),!To&&t.includes("\\")&&(t=t.replace(Ro,"%5C")),t.includes("\n")&&(t=t.replace(Oo,"%0A")),t.includes("\r")&&(t=t.replace(Bo,"%0D")),t.includes("\t")&&(t=t.replace(xo,"%09")),i.pathname=t,i}L(On,{URL:()=>Eo,Url:()=>mo,default:()=>Nn,fileURLToPath:()=>Un,format:()=>yo,parse:()=>_o,pathToFileURL:()=>jn,resolve:()=>vo,resolveObject:()=>wo});var Nn,Dn,Wn,Fn,qn,$n,Hn,Vn,zn,Kn,Gn,Qn,Yn,Jn,Xn,Zn,eo,to,ro,io,no,oo,so,ao,lo,uo,ho,co,fo,po,go,bo,mo,yo,vo,wo,_o,Eo,So,Ao,ko,Io,To,Po,Co,Ro,Oo,Bo,xo,Mo=x((()=>{j(),Pt(),pt(),Yi(),rn(),Pn(),Rn(),Cn(),Dn=Qi,Wn={isString:e=>"string"==typeof e,isObject:e=>"object"==typeof e&&null!==e,isNull:e=>null===e,isNullOrUndefined:e=>null==e},(Nn={}).parse=xn,Nn.resolve=(e,t)=>xn(e,!1,!0).resolve(t),Nn.resolveObject=(e,t)=>e?xn(e,!1,!0).resolveObject(t):t,Nn.format=e=>(Wn.isString(e)&&(e=xn(e)),e instanceof Bn?e.format():Bn.prototype.format.call(e)),Nn.Url=Bn,Fn=/^([a-z0-9.+-]+:)/i,qn=/:[0-9]*$/,$n=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Hn=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Vn=["'"].concat(Hn),zn=["%","/","?",";","#"].concat(Vn),Kn=["/","?","#"],Gn=/^[+a-z0-9A-Z_-]{0,63}$/,Qn=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Yn={javascript:!0,"javascript:":!0},Jn={javascript:!0,"javascript:":!0},Xn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Zn=tn,Bn.prototype.parse=function(e,t,r){if(!Wn.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),n=-1!==i&&i<e.indexOf("#")?"?":"#",o=e.split(n);o[0]=o[0].replace(/\\/g,"/");var s=e=o.join(n);if(s=s.trim(),!r&&1===e.split("#").length){var a=$n.exec(s);if(a)return this.path=s,this.href=s,this.pathname=a[1],a[2]?(this.search=a[2],this.query=t?Zn.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=Fn.exec(s);if(l){var u=(l=l[0]).toLowerCase();this.protocol=u,s=s.substr(l.length)}if(r||l||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var h="//"===s.substr(0,2);!h||l&&Jn[l]||(s=s.substr(2),this.slashes=!0)}if(!Jn[l]&&(h||l&&!Xn[l])){for(var c,f,d=-1,p=0;p<Kn.length;p++)-1!==(g=s.indexOf(Kn[p]))&&(-1===d||g<d)&&(d=g);for(-1!==(f=-1===d?s.lastIndexOf("@"):s.lastIndexOf("@",d))&&(c=s.slice(0,f),s=s.slice(f+1),this.auth=decodeURIComponent(c)),d=-1,p=0;p<zn.length;p++){var g;-1!==(g=s.indexOf(zn[p]))&&(-1===d||g<d)&&(d=g)}-1===d&&(d=s.length),this.host=s.slice(0,d),s=s.slice(d),this.parseHost(),this.hostname=this.hostname||"";var b="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!b)for(var m=this.hostname.split(/\./),y=(p=0,m.length);p<y;p++){var v=m[p];if(v&&!v.match(Gn)){for(var w="",_=0,E=v.length;_<E;_++)v.charCodeAt(_)>127?w+="x":w+=v[_];if(!w.match(Gn)){var S=m.slice(0,p),A=m.slice(p+1),k=v.match(Qn);k&&(S.push(k[1]),A.unshift(k[2])),A.length&&(s="/"+A.join(".")+s),this.hostname=S.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),b||(this.hostname=Dn.toASCII(this.hostname));var I=this.port?":"+this.port:"",T=this.hostname||"";this.host=T+I,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!Yn[u])for(p=0,y=Vn.length;p<y;p++){var P=Vn[p];if(-1!==s.indexOf(P)){var C=encodeURIComponent(P);C===P&&(C=escape(P)),s=s.split(P).join(C)}}var R=s.indexOf("#");-1!==R&&(this.hash=s.substr(R),s=s.slice(0,R));var O=s.indexOf("?");if(-1!==O?(this.search=s.substr(O),this.query=s.substr(O+1),t&&(this.query=Zn.parse(this.query)),s=s.slice(0,O)):t&&(this.search="",this.query={}),s&&(this.pathname=s),Xn[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){I=this.pathname||"";var B=this.search||"";this.path=I+B}return this.href=this.format(),this},Bn.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",i=this.hash||"",n=!1,o="";this.host?n=e+this.host:this.hostname&&(n=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&Wn.isObject(this.query)&&Object.keys(this.query).length&&(o=Zn.stringify(this.query));var s=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||Xn[t])&&!1!==n?(n="//"+(n||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):n||(n=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),t+n+(r=r.replace(/[?#]/g,(e=>encodeURIComponent(e))))+(s=s.replace("#","%23"))+i},Bn.prototype.resolve=function(e){return this.resolveObject(xn(e,!1,!0)).format()},Bn.prototype.resolveObject=function(e){if(Wn.isString(e)){var t=new Bn;t.parse(e,!1,!0),e=t}for(var r=new Bn,i=Object.keys(this),n=0;n<i.length;n++){var o=i[n];r[o]=this[o]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),a=0;a<s.length;a++){var l=s[a];"protocol"!==l&&(r[l]=e[l])}return Xn[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!Xn[e.protocol]){for(var u=Object.keys(e),h=0;h<u.length;h++){var c=u[h];r[c]=e[c]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||Jn[e.protocol])r.pathname=e.pathname;else{for(var f=(e.pathname||"").split("/");f.length&&!(e.host=f.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==f[0]&&f.unshift(""),f.length<2&&f.unshift(""),r.pathname=f.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var d=r.pathname||"",p=r.search||"";r.path=d+p}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var g=r.pathname&&"/"===r.pathname.charAt(0),b=e.host||e.pathname&&"/"===e.pathname.charAt(0),m=b||g||r.host&&e.pathname,y=m,v=r.pathname&&r.pathname.split("/")||[],w=(f=e.pathname&&e.pathname.split("/")||[],r.protocol&&!Xn[r.protocol]);if(w&&(r.hostname="",r.port=null,r.host&&(""===v[0]?v[0]=r.host:v.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===f[0]?f[0]=e.host:f.unshift(e.host)),e.host=null),m=m&&(""===f[0]||""===v[0])),b)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,v=f;else if(f.length)v||(v=[]),v.pop(),v=v.concat(f),r.search=e.search,r.query=e.query;else if(!Wn.isNullOrUndefined(e.search))return w&&(r.hostname=r.host=v.shift(),(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift())),r.search=e.search,r.query=e.query,Wn.isNull(r.pathname)&&Wn.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!v.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var _=v.slice(-1)[0],E=(r.host||e.host||v.length>1)&&("."===_||".."===_)||""===_,S=0,A=v.length;A>=0;A--)"."===(_=v[A])?v.splice(A,1):".."===_?(v.splice(A,1),S++):S&&(v.splice(A,1),S--);if(!m&&!y)for(;S--;S)v.unshift("..");!m||""===v[0]||v[0]&&"/"===v[0].charAt(0)||v.unshift(""),E&&"/"!==v.join("/").substr(-1)&&v.push("");var k,I=""===v[0]||v[0]&&"/"===v[0].charAt(0);return w&&(r.hostname=r.host=I?"":v.length?v.shift():"",(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift())),(m=m||r.host&&v.length)&&!I&&v.unshift(""),v.length?r.pathname=v.join("/"):(r.pathname=null,r.path=null),Wn.isNull(r.pathname)&&Wn.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},Bn.prototype.parseHost=function(){var e=this.host,t=qn.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},Nn.Url,Nn.format,Nn.resolve,Nn.resolveObject,eo={},to=!1,ro=function(){if(to)return eo;to=!0;var e=wn;function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,i="",n=0,o=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(o!==a-1&&1!==s)if(o!==a-1&&2===s){if(i.length<2||2!==n||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var l=i.lastIndexOf("/");if(l!==i.length-1){-1===l?(i="",n=0):n=(i=i.slice(0,l)).length-1-i.lastIndexOf("/"),o=a,s=0;continue}}else if(2===i.length||1===i.length){i="",n=0,o=a,s=0;continue}t&&(i.length>0?i+="/..":i="..",n=2)}else i.length>0?i+="/"+e.slice(o+1,a):i=e.slice(o+1,a),n=a-o-1;o=a,s=0}else 46===r&&-1!==s?++s:s=-1}return i}var i={resolve(){for(var i,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===i&&(i=e.cwd()),a=i),t(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize(e){if(t(e),0===e.length)return".";var i=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0===(e=r(e,!i)).length&&!i&&(e="."),e.length>0&&n&&(e+="/"),i?"/"+e:e},isAbsolute:e=>(t(e),e.length>0&&47===e.charCodeAt(0)),join(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var n=arguments[r];t(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":i.normalize(e)},relative(e,r){if(t(e),t(r),e===r||(e=i.resolve(e))===(r=i.resolve(r)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var o=e.length,s=o-n,a=1;a<r.length&&47===r.charCodeAt(a);++a);for(var l=r.length-a,u=s<l?s:l,h=-1,c=0;c<=u;++c){if(c===u){if(l>u){if(47===r.charCodeAt(a+c))return r.slice(a+c+1);if(0===c)return r.slice(a+c)}else s>u&&(47===e.charCodeAt(n+c)?h=c:0===c&&(h=0));break}var f=e.charCodeAt(n+c);if(f!==r.charCodeAt(a+c))break;47===f&&(h=c)}var d="";for(c=n+h+1;c<=o;++c)(c===o||47===e.charCodeAt(c))&&(0===d.length?d+="..":d+="/..");return d.length>0?d+r.slice(a+h):(a+=h,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:e=>e,dirname(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),i=47===r,n=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(r=e.charCodeAt(s))){if(!o){n=s;break}}else o=!1;return-1===n?i?"/":".":i&&1===n?"//":e.slice(0,n)},basename(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var i,n=0,o=-1,s=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,l=-1;for(i=e.length-1;i>=0;--i){var u=e.charCodeAt(i);if(47===u){if(!s){n=i+1;break}}else-1===l&&(s=!1,l=i+1),a>=0&&(u===r.charCodeAt(a)?-1==--a&&(o=i):(a=-1,o=l))}return n===o?o=l:-1===o&&(o=e.length),e.slice(n,o)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!s){n=i+1;break}}else-1===o&&(s=!1,o=i+1);return-1===o?"":e.slice(n,o)},extname(e){t(e);for(var r=-1,i=0,n=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===n&&(o=!1,n=a+1),46===l?-1===r?r=a:1!==s&&(s=1):-1!==r&&(s=-1);else if(!o){i=a+1;break}}return-1===r||-1===n||0===s||1===s&&r===n-1&&r===i+1?"":e.slice(r,n)},format(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return((e,t)=>{var r=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+i:r+"/"+i:i})(0,e)},parse(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var i,n=e.charCodeAt(0),o=47===n;o?(r.root="/",i=1):i=0;for(var s=-1,a=0,l=-1,u=!0,h=e.length-1,c=0;h>=i;--h)if(47!==(n=e.charCodeAt(h)))-1===l&&(u=!1,l=h+1),46===n?-1===s?s=h:1!==c&&(c=1):-1!==s&&(c=-1);else if(!u){a=h+1;break}return-1===s||-1===l||0===c||1===c&&s===l-1&&s===a+1?-1!==l&&(r.base=r.name=0===a&&o?e.slice(1,l):e.slice(a,l)):(0===a&&o?(r.name=e.slice(1,s),r.base=e.slice(1,l)):(r.name=e.slice(a,s),r.base=e.slice(a,l)),r.ext=e.slice(s,l)),a>0?r.dir=e.slice(0,a-1):o&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,eo=i}(),io=typeof Deno<"u"?"windows"===Deno.build.os?"win32":Deno.build.os:void 0,Nn.URL=typeof URL<"u"?URL:null,Nn.pathToFileURL=Ln,Nn.fileURLToPath=Mn,Nn.Url,Nn.format,Nn.resolve,Nn.resolveObject,Nn.URL,no=92,oo=47,so=97,ao=122,lo="win32"===io,uo=/\//g,ho=/%/g,co=/\\/g,fo=/\n/g,po=/\r/g,go=/\t/g,bo=typeof Deno<"u"?"windows"===Deno.build.os?"win32":Deno.build.os:void 0,Nn.URL=typeof URL<"u"?URL:null,Nn.pathToFileURL=jn,Nn.fileURLToPath=Un,mo=Nn.Url,yo=Nn.format,vo=Nn.resolve,wo=Nn.resolveObject,_o=Nn.parse,Eo=Nn.URL,So=92,Ao=47,ko=97,Io=122,To="win32"===bo,Po=/\//g,Co=/%/g,Ro=/\\/g,Oo=/\n/g,Bo=/\r/g,xo=/\t/g})),Lo=M(((e,t)=>{j(),Pt(),pt(),t.exports=()=>{throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}})),Uo=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0}),e.BufferedDuplex=void 0,e.writev=i;var t=Cr(),r=(Tt(),U(gt));function i(e,t){let i=Array(e.length);for(let t=0;t<e.length;t++)"string"==typeof e[t].chunk?i[t]=r.Buffer.from(e[t].chunk,"utf8"):i[t]=e[t].chunk;this._write(r.Buffer.concat(i),"binary",t)}var n=class extends t.Duplex{_read(e){this.proxy.read(e)}_write(e,t,r){this.isSocketOpen?this.writeToProxy(e,t,r):this.writeQueue.push({chunk:e,encoding:t,cb:r})}_final(e){this.writeQueue=[],this.proxy.end(e)}_destroy(e,t){this.writeQueue=[],this.proxy.destroy(),t(e)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(e,t,r){!1===this.proxy.write(e,t)?this.proxy.once("drain",r):r()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:t,cb:r}=this.writeQueue.shift();this.writeToProxy(e,t,r)}}constructor(e,t,r){super({objectMode:!0}),this.proxy=t,this.socket=r,this.writeQueue=[],e.objectMode||(this._writev=i.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",(e=>{!this.destroyed&&this.readable&&this.push(e)}))}};e.BufferedDuplex=n})),jo=M((e=>{j(),Pt(),pt();var t=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0}),e.streamBuilder=e.browserStreamBuilder=void 0;var r=(Tt(),U(gt)),i=t(Lo()),n=t(jr()),o=Cr(),s=t(Pi()),a=Uo(),l=(0,n.default)("mqttjs:ws"),u=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function h(e,t){let r=`${e.protocol}://${e.hostname}:${e.port}${e.path}`;return"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function c(e){let t=e;return e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),!s.default&&!e.forceNativeWebSocket&&"wss"===e.protocol&&u.forEach((r=>{({}).hasOwnProperty.call(e,r)&&!{}.hasOwnProperty.call(e.wsOptions,r)&&(t.wsOptions[r]=e[r])})),t}e.streamBuilder=(e,t)=>{l("streamBuilder");let r=c(t);r.hostname=r.hostname||r.host||"localhost";let n=h(r,e),o=function(e,t,r){l("createWebSocket"),l(`protocol: ${r.protocolId} ${r.protocolVersion}`);let n,o="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return l(`creating new Websocket for url: ${t} and protocol: ${o}`),n=r.createWebsocket?r.createWebsocket(t,[o],r):new i.default(t,[o],r.wsOptions),n}(0,n,r),s=i.default.createWebSocketStream(o,r.wsOptions);return s.url=n,o.on("close",(()=>{s.destroy()})),s},e.browserStreamBuilder=(e,t)=>{l("browserStreamBuilder");let i,n=function(e){let t=c(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if(typeof document>"u")throw Error("Could not determine host. Specify host manually.");let e=new URL(document.URL);t.hostname=e.hostname,t.port||(t.port=Number(e.port))}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}(t).browserBufferSize||524288,s=t.browserBufferTimeout||1e3,u=!t.objectMode,f=function(e,t){let r,i="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt",n=h(t,e);return r=t.createWebsocket?t.createWebsocket(n,[i],t):new WebSocket(n,[i]),r.binaryType="arraybuffer",r}(e,t),d=function(e,t,r){let i=new o.Transform({objectMode:e.objectMode});return i._write=t,i._flush=function(e){f.close(),e()},i}(t,(function e(t,i,o){if(f.bufferedAmount>n)setTimeout(e,s,t,i,o);else{u&&"string"==typeof t&&(t=r.Buffer.from(t,"utf8"));try{f.send(t)}catch(e){return o(e)}o()}}));t.objectMode||(d._writev=a.writev.bind(d)),d.on("close",(()=>{f.close()}));let p=typeof f.addEventListener<"u";function g(){l("WebSocket onOpen"),i instanceof a.BufferedDuplex&&i.socketReady()}function b(e){l("WebSocket onClose",e),i.end(),i.destroy()}function m(e){l("WebSocket onError",e);let t=Error("WebSocket error");t.event=e,i.destroy(t)}async function y(e){if(!d||d.destroyed||!d.readable)return;let{data:t}=e;t=t instanceof ArrayBuffer?r.Buffer.from(t):t instanceof Blob?r.Buffer.from(await new Response(t).arrayBuffer()):r.Buffer.from(t,"utf8"),d.push(t)}return f.readyState===f.OPEN?(i=d,i.socket=f):(i=new a.BufferedDuplex(t,d,f),p?f.addEventListener("open",g):f.onopen=g),p?(f.addEventListener("close",b),f.addEventListener("error",m),f.addEventListener("message",y)):(f.onclose=b,f.onerror=m,f.onmessage=y),i}})),No={};function Do(){throw Error("Node.js net module is not supported by JSPM core outside of Node.js")}L(No,{Server:()=>Do,Socket:()=>Do,Stream:()=>Do,_createServerHandle:()=>Do,_normalizeArgs:()=>Do,_setSimultaneousAccepts:()=>Do,connect:()=>Do,createConnection:()=>Do,createServer:()=>Do,default:()=>Wo,isIP:()=>Do,isIPv4:()=>Do,isIPv6:()=>Do});var Wo,Fo=x((()=>{j(),Pt(),pt(),Wo={_createServerHandle:Do,_normalizeArgs:Do,_setSimultaneousAccepts:Do,connect:Do,createConnection:Do,createServer:Do,isIP:Do,isIPv4:Do,isIPv6:Do,Server:Do,Socket:Do,Stream:Do}})),qo=M((e=>{j(),Pt(),pt();var t=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0});var r=t((Fo(),U(No))),i=(0,t(jr()).default)("mqttjs:tcp");e.default=(e,t)=>{t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost";let{port:n,path:o}=t,s=t.hostname;return i("port %d and host %s",n,s),r.default.createConnection({port:n,host:s,path:o})}})),$o={};L($o,{default:()=>Ho});var Ho,Vo=x((()=>{j(),Pt(),pt(),Ho={}})),zo=M((e=>{j(),Pt(),pt();var t=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0});var r=t((Vo(),U($o))),i=t((Fo(),U(No))),n=(0,t(jr()).default)("mqttjs:tls");e.default=(e,t)=>{t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",0===i.default.isIP(t.host)&&(t.servername=t.host),t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,n("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized);let o=r.default.connect(t);function s(r){t.rejectUnauthorized&&e.emit("error",r),o.end()}return o.on("secureConnect",(()=>{t.rejectUnauthorized&&!o.authorized?o.emit("error",Error("TLS not authorized")):o.removeListener("error",s)})),o.on("error",s),o}})),Ko=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0});var t,r,i,n=(Tt(),U(gt)),o=Cr(),s=Uo();e.default=(e,a)=>{if(a.hostname=a.hostname||a.host,!a.hostname)throw Error("Could not determine host. Specify host manually.");let l="MQIsdp"===a.protocolId&&3===a.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(a);let u=function(e,t){let r="wxs"===e.protocol?"wss":"ws",i=`${r}://${e.hostname}${e.path}`;return e.port&&80!==e.port&&443!==e.port&&(i=`${r}://${e.hostname}:${e.port}${e.path}`),"function"==typeof e.transformWsUrl&&(i=e.transformWsUrl(i,e,t)),i}(a,e);t=wx.connectSocket({url:u,protocols:[l]}),r=function(){let e=new o.Transform;return e._write=(e,r,i)=>{t.send({data:e.buffer,success(){i()},fail(e){i(Error(e))}})},e._flush=e=>{t.close({success(){e()}})},e}(),(i=new s.BufferedDuplex(a,r,t))._destroy=(e,r)=>{t.close({success(){r&&r(e)}})};let h=i.destroy;return i.destroy=(e,r)=>(i.destroy=h,setTimeout((()=>{t.close({fail(){i._destroy(e,r)}})}),0),i),t.onOpen((()=>{i.socketReady()})),t.onMessage((e=>{let{data:t}=e;t=t instanceof ArrayBuffer?n.Buffer.from(t):n.Buffer.from(t,"utf8"),r.push(t)})),t.onClose((()=>{i.emit("close"),i.end(),i.destroy()})),t.onError((e=>{let t=Error(e.errMsg);i.destroy(t)})),i}})),Go=M((e=>{j(),Pt(),pt(),Object.defineProperty(e,"__esModule",{value:!0});var t,r,i,n=(Tt(),U(gt)),o=Cr(),s=Uo(),a=!1;e.default=(e,l)=>{if(l.hostname=l.hostname||l.host,!l.hostname)throw Error("Could not determine host. Specify host manually.");let u="MQIsdp"===l.protocolId&&3===l.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(l);let h=function(e,t){let r="alis"===e.protocol?"wss":"ws",i=`${r}://${e.hostname}${e.path}`;return e.port&&80!==e.port&&443!==e.port&&(i=`${r}://${e.hostname}:${e.port}${e.path}`),"function"==typeof e.transformWsUrl&&(i=e.transformWsUrl(i,e,t)),i}(l,e);return(t=l.my).connectSocket({url:h,protocols:u}),r=function(){let e=new o.Transform;return e._write=(e,r,i)=>{t.sendSocketMessage({data:e.buffer,success(){i()},fail(){i(Error())}})},e._flush=e=>{t.closeSocket({success(){e()}})},e}(),i=new s.BufferedDuplex(l,r,t),a||(a=!0,t.onSocketOpen((()=>{i.socketReady()})),t.onSocketMessage((e=>{if("string"==typeof e.data){let t=n.Buffer.from(e.data,"base64");r.push(t)}else{let t=new FileReader;t.addEventListener("load",(()=>{let e=t.result;e=e instanceof ArrayBuffer?n.Buffer.from(e):n.Buffer.from(e,"utf8"),r.push(e)})),t.readAsArrayBuffer(e.data)}})),t.onSocketClose((()=>{i.end(),i.destroy()})),t.onSocketError((e=>{i.destroy(e)}))),i}})),Qo=M((e=>{j(),Pt(),pt();var t=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0}),e.connectAsync=function(e,t,r=!0){return new Promise(((i,n)=>{let o=l(e,t),s={connect(){a(),i(o)},end(){a(),i(o)},error(e){a(),o.end(),n(e)}};function a(){Object.keys(s).forEach((e=>{o.off(e,s[e])}))}!1===r&&(s.close=()=>{s.error(Error("Couldn't connect to server"))}),Object.keys(s).forEach((e=>{o.on(e,s[e])}))}))};var r=t(jr()),i=t((Mo(),U(On))),n=t(Mi()),o=t(Pi());"function"!=typeof(null==N?void 0:N.nextTick)&&(N.nextTick=setImmediate);var s=(0,r.default)("mqttjs"),a=null;function l(e,t){var r,l,u;if(s("connecting to an MQTT broker..."),"object"==typeof e&&!t&&(t=e,e=""),t=t||{},e&&"string"==typeof e){let r=i.default.parse(e,!0),n={};if(null!=r.port&&(n.port=Number(r.port)),n.host=r.hostname,n.query=r.query,n.auth=r.auth,n.protocol=r.protocol,n.path=r.path,!(t=Object.assign(Object.assign({},n),t)).protocol)throw Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(t.unixSocket=t.unixSocket||(null===(r=t.protocol)||void 0===r?void 0:r.includes("+unix")),t.unixSocket?t.protocol=t.protocol.replace("+unix",""):null!==(l=t.protocol)&&void 0!==l&&l.startsWith("ws")||null!==(u=t.protocol)&&void 0!==u&&u.startsWith("wx")||delete t.path,function(e){let t;e.auth&&(t=e.auth.match(/^(.+):(.+)$/),t?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;case"ali":t.protocol="alis";break;default:throw Error(`Unknown protocol for secure connection: "${t.protocol}"!`)}}if(a||(a={},o.default||t.forceNativeWebSocket?(a.ws=jo().browserStreamBuilder,a.wss=jo().browserStreamBuilder,a.wx=Ko().default,a.wxs=Ko().default,a.ali=Go().default,a.alis=Go().default):(a.ws=jo().streamBuilder,a.wss=jo().streamBuilder,a.mqtt=qo().default,a.tcp=qo().default,a.ssl=zo().default,a.tls=a.ssl,a.mqtts=zo().default)),!a[t.protocol]){let e=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(((t,r)=>(!e||r%2!=0)&&"function"==typeof a[t]))[0]}if(!1===t.clean&&!t.clientId)throw Error("Missing clientId for unclean clients");t.protocol&&(t.defaultProtocol=t.protocol);let h=new n.default((function(e){return t.servers&&((!e._reconnectCount||e._reconnectCount===t.servers.length)&&(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),s("calling streambuilder for",t.protocol),a[t.protocol](e,t)}),t);return h.on("error",(()=>{})),h}e.default=l})),Yo=M((e=>{j(),Pt(),pt();var t,r=e&&e.__createBinding||(Object.create?(e,t,r,i)=>{void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:()=>t[r]}),Object.defineProperty(e,i,n)}:(e,t,r,i)=>{void 0===i&&(i=r),e[i]=t[r]}),i=e&&e.__setModuleDefault||(Object.create?(e,t)=>{Object.defineProperty(e,"default",{enumerable:!0,value:t})}:(e,t)=>{e.default=t}),n=e&&e.__importStar||(t=e=>(t=Object.getOwnPropertyNames||(e=>{var t=[];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[t.length]=r);return t}))(e),e=>{if(e&&e.__esModule)return e;var n={};if(null!=e)for(var o=t(e),s=0;s<o.length;s++)"default"!==o[s]&&r(n,e,o[s]);return i(n,e),n}),o=e&&e.__exportStar||((e,t)=>{for(var i in e)"default"!==i&&!{}.hasOwnProperty.call(t,i)&&r(t,e,i)}),s=e&&e.__importDefault||(e=>e&&e.__esModule?e:{default:e});Object.defineProperty(e,"__esModule",{value:!0}),e.ReasonCodes=e.KeepaliveManager=e.UniqueMessageIdProvider=e.DefaultMessageIdProvider=e.Store=e.MqttClient=e.connectAsync=e.connect=e.Client=void 0;var a=s(Mi());e.MqttClient=a.default;var l=s(Hr());e.DefaultMessageIdProvider=l.default;var u=s(Li());e.UniqueMessageIdProvider=u.default;var h=s(Gr());e.Store=h.default;var c=n(Qo());e.connect=c.default,Object.defineProperty(e,"connectAsync",{enumerable:!0,get:()=>c.connectAsync});var f=s(xi());e.KeepaliveManager=f.default,e.Client=a.default,o(Mi(),e),o(Jr(),e);var d=Xr();Object.defineProperty(e,"ReasonCodes",{enumerable:!0,get:()=>d.ReasonCodes})})),Jo=M((e=>{j(),Pt(),pt();var t,r=e&&e.__createBinding||(Object.create?(e,t,r,i)=>{void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:()=>t[r]}),Object.defineProperty(e,i,n)}:(e,t,r,i)=>{void 0===i&&(i=r),e[i]=t[r]}),i=e&&e.__setModuleDefault||(Object.create?(e,t)=>{Object.defineProperty(e,"default",{enumerable:!0,value:t})}:(e,t)=>{e.default=t}),n=e&&e.__importStar||(t=e=>(t=Object.getOwnPropertyNames||(e=>{var t=[];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[t.length]=r);return t}))(e),e=>{if(e&&e.__esModule)return e;var n={};if(null!=e)for(var o=t(e),s=0;s<o.length;s++)"default"!==o[s]&&r(n,e,o[s]);return i(n,e),n}),o=e&&e.__exportStar||((e,t)=>{for(var i in e)"default"!==i&&!{}.hasOwnProperty.call(t,i)&&r(t,e,i)});Object.defineProperty(e,"__esModule",{value:!0});var s=n(Yo());e.default=s,o(Yo(),e)}))();const{floor:Xo,random:Zo}=Math,es="Trystero",ts=(e,t)=>Array(e).fill().map(t),rs=ts(20,(()=>"0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"[Xo(62*Zo())])).join(""),is=Promise.all.bind(Promise),ns="undefined"!=typeof window,{entries:os,fromEntries:ss,keys:as}=Object,ls=()=>{},us=e=>Error(`${es}: ${e}`),hs=new TextEncoder,cs=new TextDecoder,fs=e=>hs.encode(e),ds=e=>cs.decode(e),ps=(...e)=>e.join("@"),gs=JSON.stringify,bs=JSON.parse,ms="AES-GCM",ys={},vs=async e=>ys[e]||(ys[e]=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-1",fs(e)))).map((e=>e.toString(36))).join("")),ws=async(e,t)=>{const r=crypto.getRandomValues(new Uint8Array(16));var i;return r.join(",")+"$"+(i=await crypto.subtle.encrypt({name:ms,iv:r},await e,fs(t)),btoa(String.fromCharCode.apply(null,new Uint8Array(i))))},_s=async(e,t)=>{const[r,i]=t.split("$");return ds(await crypto.subtle.decrypt({name:ms,iv:new Uint8Array(r.split(","))},await e,(e=>{const t=atob(e);return new Uint8Array(t.length).map(((e,r)=>t.charCodeAt(r))).buffer})(i)))},Es="icegatheringstatechange",Ss=e=>e.replace(/a=ice-options:trickle\s\n/g,"");var As=(e,{rtcConfig:t,rtcPolyfill:r,turnConfig:i})=>{const n=new(r||RTCPeerConnection)((0,I.default)({iceServers:ks.concat(i||[])},t)),o={},s=e=>{e.binaryType="arraybuffer",e.bufferedAmountLowThreshold=65535,e.onmessage=e=>{var t;return null===(t=o.data)||void 0===t?void 0:t.call(o,e.data)},e.onopen=()=>{var e;return null===(e=o.connect)||void 0===e?void 0:e.call(o)},e.onclose=()=>{var e;return null===(e=o.close)||void 0===e?void 0:e.call(o)},e.onerror=e=>{var t;return null===(t=o.error)||void 0===t?void 0:t.call(o,e)}},a=async e=>{if(!e.localDescription)throw Error("No local description available");return await Promise.race([new Promise((t=>{const r=()=>{"complete"===e.iceGatheringState&&(e.removeEventListener(Es,r),t())};e.addEventListener(Es,r),r()})),new Promise((e=>setTimeout(e,5e3)))]),{type:e.localDescription.type,sdp:Ss(e.localDescription.sdp)}};let l=!1,u=null,h=!1;return e?(u=n.createDataChannel("data"),s(u)):n.ondatachannel=({channel:e})=>{u=e,s(e)},n.onnegotiationneeded=async()=>{try{var e;l=!0,await n.setLocalDescription();const t=await a(n);null===(e=o.signal)||void 0===e||e.call(o,{type:t.type,sdp:Ss(t.sdp)})}catch(e){var t;null===(t=o.error)||void 0===t||t.call(o,e)}finally{l=!1}},n.onconnectionstatechange=()=>{var e;["disconnected","failed","closed"].includes(n.connectionState)&&(null===(e=o.close)||void 0===e||e.call(o))},n.ontrack=e=>{var t,r;null===(t=o.track)||void 0===t||t.call(o,e.track,e.streams[0]),null===(r=o.stream)||void 0===r||r.call(o,e.streams[0])},n.onremovestream=e=>{var t;null===(t=o.stream)||void 0===t||t.call(o,e.stream,{removed:!0})},{created:Date.now(),connection:n,get channel(){return u},get isDead(){return"closed"===n.connectionState},async signal(t){if("open"!==(null==u?void 0:u.readyState))try{if("offer"===t.type){var r;if((l||"stable"!==n.signalingState)&&(h=!e,h))return;await n.setRemoteDescription(t),await n.setLocalDescription();const i=await a(n),s=Ss(i.sdp);return null===(r=o.signal)||void 0===r||r.call(o,{type:i.type,sdp:s}),{type:i.type,sdp:s}}"answer"!==t.type||"have-local-offer"!==n.signalingState&&"have-remote-offer"!==n.signalingState||await n.setRemoteDescription(t)}catch(e){var i;null===(i=o.error)||void 0===i||i.call(o,e)}else if(("offer"===t.type||"stable"!==n.signalingState)&&(await n.setRemoteDescription(t),"offer"===t.type)){var s;await n.setLocalDescription();const e=await a(n);return null===(s=o.signal)||void 0===s||s.call(o,{type:e.type,sdp:e.sdp}),{type:e.type,sdp:e.sdp}}},sendData:e=>u.send(e),destroy(){u&&u.close(),n.close()},setHandlers:e=>Object.assign(o,e),offerPromise:e?new Promise((e=>{o.signal=t=>{"offer"===t.type&&e(t)}})):Promise.resolve(),addStream(e){e.getTracks().forEach((t=>n.addTrack(t,e)))},removeStream(e){n.getSenders().filter((t=>e.getTracks().includes(t.track))).forEach((e=>n.removeTrack(e)))},addTrack:(e,t)=>n.addTrack(e,t),removeTrack(e){const t=n.getSenders().find((t=>t.track===e));t&&n.removeTrack(t)},async replaceTrack(e,t){const r=n.getSenders().find((t=>t.track===e));r&&await r.replaceTrack(t)}}};const ks=[...ts(3,((e,t)=>`stun:stun${t||""}.l.google.com:19302`)),"stun:global.stun.twilio.com:3478"].map((e=>({urls:e}))),Is=Object.getPrototypeOf(Uint8Array),Ts=16369,Ps=255,Cs="bufferedamountlow",Rs=e=>"@_"+e,Os={},Bs={},xs=({options:e})=>e.host+e.path,Ms=(({init:e,subscribe:t,announce:r})=>{const i={};let n,m,y,v=!1;return(w,_,E)=>{var S;const{appId:A}=w;if(null===(S=i[A])||void 0===S?void 0:S[_])return i[A][_];const k={},P={},C=ps(es,A,_),R=vs(C),O=vs(ps(C,rs)),B=(async(e,t,r)=>crypto.subtle.importKey("raw",await crypto.subtle.digest({name:"SHA-256"},fs(`${e}:${t}:${r}`)),{name:ms},!1,["encrypt","decrypt"]))(w.password||"",A,_),x=e=>async t=>({type:t.type,sdp:await e(B,t.sdp)}),M=x(_s),L=x(ws),U=()=>As(!0,w),j=(e,t,r)=>{var i;P[t]?P[t]!==e&&e.destroy():(P[t]=e,H(e,t),null===(i=k[t])||void 0===i||i.forEach(((e,t)=>{t!==r&&e.destroy()})),delete k[t])},N=(e,t)=>{P[t]===e&&delete P[t]},D=e=>(m.push(...ts(e,U)),is(m.splice(0,e).map((e=>e.offerPromise.then(L).then((t=>({peer:e,offer:t}))))))),W=(e,t)=>null==E?void 0:E({error:`incorrect password (${w.password}) when decrypting ${t}`,appId:A,peerId:e,roomId:_});if(!w)throw us("requires a config map as the first argument");if(!A&&!w.firebaseApp)throw us("config map is missing appId field");if(!_)throw us("roomId argument required");if(!v){const t=e(w);m=ts(20,U),n=Array.isArray(t)?t:[t],v=!0,y=setInterval((()=>m=m.filter((e=>{const t=Date.now()-e.created<57333;return t||e.destroy(),t}))),59052.99)}const F=n.map((()=>5333)),q=[],$=n.map((async(e,r)=>t(await e,await R,await O,(e=>async(t,r,i)=>{const[n,a]=await is([R,O]);if(t!==n&&t!==a)return;const{peerId:l,offer:u,answer:h,peer:c}="string"==typeof r?bs(r):r;if(l!==rs&&!P[l])if(!l||u||h){if(u){var f;if((null===(f=k[l])||void 0===f?void 0:f[e])&&rs>l)return;const t=As(!1,w);let r;t.setHandlers({connect:()=>j(t,l,e),close:()=>N(t,l)});try{r=await M(u)}catch(e){return void W(l,"offer")}if(t.isDead)return;const[n,o]=await is([vs(ps(C,l)),t.signal(r)]);i(n,gs({peerId:rs,answer:await L(o)}))}else if(h){let t;try{t=await M(h)}catch(e){return void W(l,"answer")}if(c)c.setHandlers({connect:()=>j(c,l,e),close:()=>N(c,l)}),c.signal(t);else{var d;const r=null===(d=k[l])||void 0===d?void 0:d[e];r&&!r.isDead&&r.signal(t)}}}else{var p;if(null===(p=k[l])||void 0===p?void 0:p[e])return;const[[{peer:t,offer:r}],n]=await is([D(1),vs(ps(C,l))]);(o=k)[s=l]||(o[s]=[]),k[l][e]=t,setTimeout((()=>((e,t)=>{var r;if(P[e])return;const i=null===(r=k[e])||void 0===r?void 0:r[t];i&&(delete k[e][t],i.destroy())})(l,e)),.9*F[e]),t.setHandlers({connect:()=>j(t,l,e),close:()=>N(t,l)}),i(n,gs({peerId:rs,offer:r}))}})(r),D)));is([R,O]).then((([e,t])=>{const i=async(n,o)=>{const s=await r(n,e,t);"number"==typeof s&&(F[o]=s),q[o]=setTimeout((()=>i(n,o)),F[o])};$.forEach((async(e,t)=>{await e,i(await n[t],t)}))}));let H=ls;return(a=i)[l=A]||(a[l]={}),i[A][_]=((e,t,r)=>{const i={},n={},o={},s={},a={},l={},m={},y={onPeerJoin:ls,onPeerLeave:ls,onPeerStream:ls,onPeerTrack:ls},v=(e,t)=>(e?Array.isArray(e)?e:[e]:as(i)).flatMap((e=>{const r=i[e];return r?t(e,r):(console.warn(`${es}: no peer with id ${e} found`),[])})),w=e=>{i[e]&&(delete i[e],delete s[e],delete a[e],y.onPeerLeave(e),t(e))},_=e=>{if(n[e])return o[e];if(!e)throw us("action type argument is required");const t=fs(e);if(t.byteLength>12)throw us(`action type string "${e}" (${t.byteLength}b) exceeds byte limit (12). Hint: choose a shorter name.`);const r=new Uint8Array(12);r.set(t);let s=0;return n[e]={onComplete:ls,onProgress:ls,setOnComplete:t=>n[e]=(0,T.default)((0,I.default)({},n[e]),{onComplete:t}),setOnProgress:t=>n[e]=(0,T.default)((0,I.default)({},n[e]),{onProgress:t}),async send(e,t,n,o){if(n&&"object"!=typeof n)throw us("action meta argument must be an object");const a=typeof e;if("undefined"===a)throw us("action data cannot be undefined");const l="string"!==a,u=e instanceof Blob,h=u||e instanceof ArrayBuffer||e instanceof Is;if(n&&!h)throw us("action meta argument can only be used with binary data");const c=h?new Uint8Array(u?await e.arrayBuffer():e):fs(l?gs(e):e),f=n?fs(gs(n)):null,d=Math.ceil(c.byteLength/Ts)+(n?1:0)||1,p=ts(d,((e,t)=>{const i=t===d-1,o=n&&0===t,a=new Uint8Array(15+(o?f.byteLength:i?c.byteLength-Ts*(d-(n?2:1)):Ts));return a.set(r),a.set([s],12),a.set([i|o<<1|h<<2|l<<3],13),a.set([Math.round((t+1)/d*Ps)],14),a.set(n?o?f:c.subarray((t-1)*Ts,t*Ts):c.subarray(t*Ts,(t+1)*Ts),15),a}));return s=s+1&Ps,is(v(t,(async(e,t)=>{const{channel:r}=t;let s=0;for(;s<d;){const a=p[s];if(r.bufferedAmount>r.bufferedAmountLowThreshold&&await new Promise((e=>{const t=()=>{r.removeEventListener(Cs,t),e()};r.addEventListener(Cs,t)})),!i[e])break;t.sendData(a),s++,null==o||o(a[14]/Ps,e,n)}})))}},(u=o)[h=e]||(u[h]=[n[e].send,n[e].setOnComplete,n[e].setOnProgress])},E=(e,t)=>{const r=new Uint8Array(t),i=ds(r.subarray(0,12)).replaceAll("\0",""),[o]=r.subarray(12,13),[a]=r.subarray(13,14),[l]=r.subarray(14,15),u=r.subarray(15),h=!!(1&a),m=!!(2&a),y=!!(4&a),v=!!(8&a);if(!n[i])return void console.warn(`${es}: received message with unregistered type (${i})`);(c=s)[f=e]||(c[f]={}),(d=s[e])[p=i]||(d[p]={});const w=(g=s[e][i])[b=o]||(g[b]={chunks:[]});if(m?w.meta=bs(ds(u)):w.chunks.push(u),n[i].onProgress(l/Ps,e,w.meta),!h)return;const _=new Uint8Array(w.chunks.reduce(((e,t)=>e+t.byteLength),0));if(w.chunks.reduce(((e,t)=>(_.set(t,e),e+t.byteLength)),0),delete s[e][i][o],y)n[i].onComplete(_,e,w.meta);else{const t=ds(_);n[i].onComplete(v?bs(t):t,e)}},S=async()=>{await U(""),await new Promise((e=>setTimeout(e,99))),os(i).forEach((([e,t])=>{t.destroy(),delete i[e]})),r()},[A,k]=_(Rs("ping")),[P,C]=_(Rs("pong")),[R,O]=_(Rs("signal")),[B,x]=_(Rs("stream")),[M,L]=_(Rs("track")),[U,j]=_(Rs("leave"));return H=(e,t)=>{var r;i[t]||(i[t]=e,e.setHandlers({data:e=>E(t,e),stream(e){y.onPeerStream(e,t,l[t]),delete l[t]},track(e,r){y.onPeerTrack(e,r,t,m[t]),delete m[t]},signal:e=>R(e,t),close:()=>w(t),error:()=>w(t)}),y.onPeerJoin(t),null===(r=e.drainEarlyData)||void 0===r||r.call(e,(e=>E(t,e))))},k(((e,t)=>P("",t))),C(((e,t)=>{var r;null===(r=a[t])||void 0===r||r.call(a),delete a[t]})),O(((e,t)=>{var r;return null===(r=i[t])||void 0===r?void 0:r.signal(e)})),x(((e,t)=>l[t]=e)),L(((e,t)=>m[t]=e)),j(((e,t)=>w(t))),ns&&addEventListener("beforeunload",S),{makeAction:_,leave:S,async ping(e){if(!e)throw us("ping() must be called with target peer ID");const t=Date.now();return A("",e),await new Promise((t=>a[e]=t)),Date.now()-t},getPeers:()=>ss(os(i).map((([e,t])=>[e,t.connection]))),addStream:(e,t,r)=>v(t,(async(t,i)=>{r&&await B(r,t),i.addStream(e)})),removeStream:(e,t)=>v(t,((t,r)=>r.removeStream(e))),addTrack:(e,t,r,i)=>v(r,(async(r,n)=>{i&&await M(i,r),n.addTrack(e,t)})),removeTrack:(e,t,r)=>v(r,((r,i)=>i.removeTrack(e,t))),replaceTrack:(e,t,r,i,n)=>v(i,(async(i,o)=>{n&&await M(n,i),o.replaceTrack(e,t,r)})),onPeerJoin:e=>y.onPeerJoin=e,onPeerLeave:e=>y.onPeerLeave=e,onPeerStream:e=>y.onPeerStream=e,onPeerTrack:e=>y.onPeerTrack=e}})(0,(e=>delete P[e]),(()=>{delete i[A][_],q.forEach(clearTimeout),$.forEach((async e=>(await e)())),clearInterval(y)}))}})({init:e=>((e,t,r)=>(e.relayUrls||t).slice(0,e.relayUrls?e.relayUrls.length:e.relayRedundancy||4))(e,Ls).map((e=>{const t=Jo.connect(e),r=xs(t);return Os[r]=t.stream.socket,Bs[r]={},t.on("message",((e,t)=>{var i,n;return null===(n=(i=Bs[r])[e])||void 0===n?void 0:n.call(i,e,t.toString())})).on("error",(e=>console.error(e))),new Promise((e=>t.on("connect",(()=>e(t)))))})),subscribe(e,t,r,i){const n=xs(e);return Bs[n][t]=Bs[n][r]=(t,r)=>i(t,r,e.publish.bind(e)),e.subscribe(t),e.subscribe(r),()=>{e.unsubscribe(t),e.unsubscribe(r),delete Bs[n][t],delete Bs[n][r]}},announce:(e,t)=>e.publish(t,gs({peerId:rs}))}),Ls=["mqtt.eclipseprojects.io/mqtt","broker.hivemq.com:8884/mqtt","broker.emqx.io:8084/mqtt","test.mosquitto.org:8081/mqtt"].map((e=>"wss://"+e))})),r.register("e963W",(function(e,i){t(e.exports,"default",(function(){return s}));var n=r("2wTKP"),o=r("6br39");function s(e,t){var r=(0,n.default)(e,t,"get");return(0,o.default)(e,r)}})),r.register("2wTKP",(function(e,r){function i(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}t(e.exports,"default",(function(){return i}))})),r.register("6br39",(function(e,r){function i(e,t){return t.get?t.get.call(e):t.value}t(e.exports,"default",(function(){return i}))})),r.register("lvOWe",(function(e,i){t(e.exports,"default",(function(){return o}));var n=r("jb4AR");function o(e,t,r){(0,n.default)(e,t),t.set(e,r)}})),r.register("jb4AR",(function(e,r){function i(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}t(e.exports,"default",(function(){return i}))})),r.register("ezKE5",(function(e,i){t(e.exports,"default",(function(){return s}));var n=r("2wTKP"),o=r("iceM3");function s(e,t,r){var i=(0,n.default)(e,t,"set");return(0,o.default)(e,i,r),r}})),r.register("iceM3",(function(e,r){function i(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}t(e.exports,"default",(function(){return i}))})),r.register("dpALB",(function(e,i){t(e.exports,"default",(function(){return s}));var n=r("2wTKP"),o=r("14QXB");function s(e,t){var r=(0,n.default)(e,t,"update");return(0,o.default)(e,r)}})),r.register("14QXB",(function(e,r){function i(e,t){if(t.set){if(!t.get)throw new TypeError("attempted to read set only private field");return"__destrWrapper"in t||(t.__destrWrapper={set value(r){t.set.call(e,r)},get value(){return t.get.call(e)}}),t.__destrWrapper}if(!t.writable)throw new TypeError("attempted to set read only private field");return t}t(e.exports,"default",(function(){return i}))})),r.register("1VQD5",(function(e,r){function i(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}t(e.exports,"default",(function(){return i}))})),r.register("cJcuy",(function(e,i){t(e.exports,"default",(function(){return o}));var n=r("jb4AR");function o(e,t){(0,n.default)(e,t),t.add(e)}})),r.register("5F6LX",(function(e,i){t(e.exports,"default",(function(){return a}));var n=r("Y35Fr"),o=r("a7JGM"),s=r("6br39");function a(e,t,r){return(0,n.default)(e,t),(0,o.default)(r,"get"),(0,s.default)(e,r)}})),r.register("Y35Fr",(function(e,r){function i(e,t){if(e!==t)throw new TypeError("Private static access of wrong provenance")}t(e.exports,"default",(function(){return i}))})),r.register("a7JGM",(function(e,r){function i(e,t){if(void 0===e)throw new TypeError("attempted to "+t+" private static field before its declaration")}t(e.exports,"default",(function(){return i}))})),r.register("gsBWm",(function(e,i){t(e.exports,"default",(function(){return a}));var n=r("Y35Fr"),o=r("a7JGM"),s=r("iceM3");function a(e,t,r,i){return(0,n.default)(e,t),(0,o.default)(r,"set"),(0,s.default)(e,r,i),i}}));
|