UNPKG

@liascript/exporter

Version:
2 lines 452 kB
!function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function t(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var r=e.parcelRequire55a5;r.register("aB40U",(function(n,i){t(n.exports,"joinRoom",(function(){return Zl}));var o,a,s,u,l,c,f,h,d,p,v,g=r("f1evb"),y=r("1PH9R"),b=r("3u2tY"),m=r("hnmIs"),_=r("9yQwa"),w=r("9Klpk"),k=r("8qpTe"),E=r("gwSkA"),S=r("7ukXT"),A=r("8TzS1"),T=r("aFAb1"),C=r("kw2NY"),I=r("lxHBR"),R=r("gJ3S3"),x=r("3bWnf"),O=r("eT7f3"),P=r("9WzNc"),M=r("div3d"),B=r("kb0qF"),L=r("bgoEC"),N=r("7j4mF"),U=r("1Qswt"),j=r("5ENmm"),D=r("6Wo7Q"),F=r("rJmE6"),W=r("hXL9f"),q=r("fSF4h"),H=r("bWNdT"),V=r("32Euv"),z=(V=r("32Euv"),r("84cK9")),K=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,G=Object.getOwnPropertyNames,Q={}.hasOwnProperty,J=function(e,t){return function(){return e&&(t=e(e=0)),t}},X=function(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}},$=function(e,t){for(var r in t)K(e,r,{get:t[r],enumerable:!0})},Z=function(e){return function(e,t,r,n){var i=!0,o=!1,a=void 0;if(t&&"object"==typeof t||"function"==typeof t)try{for(var s,u=function(){var r=s.value;!Q.call(e,r)&&void 0!==r&&K(e,r,{get:function(){return t[r]},enumerable:!(n=Y(t,r))||n.enumerable})},l=G(t)[Symbol.iterator]();!(i=(s=l.next()).done);i=!0)u()}catch(e){o=!0,a=e}finally{try{i||null==l.return||l.return()}finally{if(o)throw a}}return e}(K({},"__esModule",{value:!0}),e)},ee=J((function(){v={deviceMemory:8,hardwareConcurrency:8,language:"en-US"}})),te={};function re(e){throw Error("Node.js process "+e+" is not supported by JSPM core outside of Node.js")}function ne(){!me||!_e||(me=!1,_e.length?be=_e.concat(be):we=-1,be.length&&ie())}function ie(){if(!me){var e=setTimeout(ne,0);me=!0;for(var t=be.length;t;){for(_e=be,be=[];++we<t;)_e&&_e[we].run();we=-1,t=be.length}_e=null,me=!1,clearTimeout(e)}}function oe(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];be.push(new ae(e,t)),1===be.length&&!me&&setTimeout(ie,0)}function ae(e,t){this.fun=e,this.array=t}function se(){}function ue(){re("_linkedBinding")}function le(){re("dlopen")}function ce(){return[]}function fe(){return[]}function he(e,t){if(!e)throw Error(t||"assertion error")}function de(){return!1}function pe(){return vt.now()/1e3}function ve(e){var t=Math.floor(.001*(Date.now()-vt.now())),r=.001*vt.now(),n=Math.floor(r)+t,i=Math.floor(r%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=yt)),[n,i]}function ge(){return Rt}function ye(){return[]}$(te,{_debugEnd:function(){return tt},_debugProcess:function(){return et},_events:function(){return mt},_eventsCount:function(){return _t},_exiting:function(){return De},_fatalExceptions:function(){return Xe},_getActiveHandles:function(){return fe},_getActiveRequests:function(){return ce},_kill:function(){return qe},_linkedBinding:function(){return ue},_maxListeners:function(){return bt},_preload_modules:function(){return dt},_rawDebug:function(){return Ne},_startProfilerIdleNotifier:function(){return rt},_stopProfilerIdleNotifier:function(){return nt},_tickCallback:function(){return Ze},abort:function(){return st},addListener:function(){return wt},allowedNodeEnvironmentFlags:function(){return Qe},arch:function(){return Ee},argv:function(){return Te},argv0:function(){return ht},assert:function(){return he},binding:function(){return Oe},chdir:function(){return Be},config:function(){return Fe},cpuUsage:function(){return He},cwd:function(){return Me},debugPort:function(){return ft},default:function(){return Rt},dlopen:function(){return le},domain:function(){return je},emit:function(){return Tt},emitWarning:function(){return xe},env:function(){return Ae},execArgv:function(){return Ce},execPath:function(){return ct},exit:function(){return Ye},features:function(){return Je},hasUncaughtExceptionCaptureCallback:function(){return de},hrtime:function(){return ve},kill:function(){return Ke},listeners:function(){return ye},memoryUsage:function(){return ze},moduleLoadList:function(){return Ue},nextTick:function(){return oe},off:function(){return Et},on:function(){return ge},once:function(){return kt},openStdin:function(){return Ge},pid:function(){return ut},platform:function(){return Se},ppid:function(){return lt},prependListener:function(){return Ct},prependOnceListener:function(){return It},reallyExit:function(){return We},release:function(){return Le},removeAllListeners:function(){return At},removeListener:function(){return St},resourceUsage:function(){return Ve},setSourceMapsEnabled:function(){return pt},setUncaughtExceptionCaptureCallback:function(){return $e},stderr:function(){return ot},stdin:function(){return at},stdout:function(){return it},title:function(){return ke},umask:function(){return Pe},uptime:function(){return pe},version:function(){return Ie},versions:function(){return Re}});var be,me,_e,we,ke,Ee,Se,Ae,Te,Ce,Ie,Re,xe,Oe,Pe,Me,Be,Le,Ne,Ue,je,De,Fe,We,qe,He,Ve,ze,Ke,Ye,Ge,Qe,Je,Xe,$e,Ze,et,tt,rt,nt,it,ot,at,st,ut,lt,ct,ft,ht,dt,pt,vt,gt,yt,bt,mt,_t,wt,kt,Et,St,At,Tt,Ct,It,Rt,xt=J((function(){zt(),Ot(),ee(),be=[],me=!1,we=-1,ae.prototype.run=function(){this.fun.apply(null,this.array)},ke="browser",Ee="x64",Se="browser",Ae={PATH:"/usr/bin",LANG:v.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Te=["/usr/bin/node"],Ce=[],Ie="v16.8.0",Re={},xe=function(e,t){console.warn((t?t+": ":"")+e)},Oe=function(){re("binding")},Pe=function(){return 0},Me=function(){return"/"},Be=function(){},Le={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},Ne=se,Ue=[],je={},De=!1,Fe={},We=se,qe=se,Ve=He=function(){return{}},ze=He,Ke=se,Ye=se,Ge=se,Qe={},Je={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Xe=se,$e=se,Ze=se,et=se,tt=se,rt=se,nt=se,it=void 0,ot=void 0,at=void 0,st=se,ut=2,lt=1,ct="/bin/usr/node",ft=9229,ht="node",dt=[],pt=se,void 0===(vt={now:("undefined"==typeof performance?"undefined":(0,F.default)(performance))<"u"?performance.now.bind(performance):void 0,timing:("undefined"==typeof performance?"undefined":(0,F.default)(performance))<"u"?performance.timing:void 0}).now&&(gt=Date.now(),vt.timing&&vt.timing.navigationStart&&(gt=vt.timing.navigationStart),vt.now=function(){return Date.now()-gt}),yt=1e9,ve.bigint=function(e){var t=ve(e);return("undefined"==typeof BigInt?"undefined":(0,F.default)(BigInt))>"u"?t[0]*yt+t[1]:BigInt(t[0]*yt)+BigInt(t[1])},Rt={version:Ie,versions:Re,arch:Ee,platform:Se,release:Le,_rawDebug:Ne,moduleLoadList:Ue,binding:Oe,_linkedBinding:ue,_events:mt={},_eventsCount:_t=0,_maxListeners:bt=10,on:ge,addListener:wt=ge,once:kt=ge,off:Et=ge,removeListener:St=ge,removeAllListeners:At=ge,emit:Tt=se,prependListener:Ct=ge,prependOnceListener:It=ge,listeners:ye,domain:je,_exiting:De,config:Fe,dlopen:le,uptime:pe,_getActiveRequests:ce,_getActiveHandles:fe,reallyExit:We,_kill:qe,cpuUsage:He,resourceUsage:Ve,memoryUsage:ze,kill:Ke,exit:Ye,openStdin:Ge,allowedNodeEnvironmentFlags:Qe,assert:he,features:Je,_fatalExceptions:Xe,setUncaughtExceptionCaptureCallback:$e,hasUncaughtExceptionCaptureCallback:de,emitWarning:xe,nextTick:oe,_tickCallback:Ze,_debugProcess:et,_debugEnd:tt,_startProfilerIdleNotifier:rt,_stopProfilerIdleNotifier:nt,stdout:it,stdin:at,stderr:ot,abort:st,umask:Pe,chdir:Be,cwd:Me,env:Ae,title:ke,argv:Te,execArgv:Ce,pid:ut,ppid:lt,execPath:ct,debugPort:ft,hrtime:ve,argv0:ht,_preload_modules:dt,setSourceMapsEnabled:pt}})),Ot=J((function(){xt()})),Pt={};function Mt(){if(Dt)return jt;Dt=!0;var e=function(){if(Lt)return Bt;Lt=!0,Bt.byteLength=function(e){var t=o(e),r=t[0],n=t[1];return 3*(r+n)/4-n},Bt.toByteArray=function(e){var n,i,a=o(e),s=a[0],u=a[1],l=new r(function(e,t,r){return 3*(t+r)/4-r}(0,s,u)),c=0,f=u>0?s-4:s;for(i=0;i<f;i+=4)n=t[e.charCodeAt(i)]<<18|t[e.charCodeAt(i+1)]<<12|t[e.charCodeAt(i+2)]<<6|t[e.charCodeAt(i+3)],l[c++]=n>>16&255,l[c++]=n>>8&255,l[c++]=255&n;return 2===u&&(n=t[e.charCodeAt(i)]<<2|t[e.charCodeAt(i+1)]>>4,l[c++]=255&n),1===u&&(n=t[e.charCodeAt(i)]<<10|t[e.charCodeAt(i+1)]<<4|t[e.charCodeAt(i+2)]>>2,l[c++]=n>>8&255,l[c++]=255&n),l},Bt.fromByteArray=function(t){for(var r,n=t.length,i=n%3,o=[],a=16383,u=0,l=n-i;u<l;u+=a)o.push(s(t,u,u+a>l?l:u+a));return 1===i?(r=t[n-1],o.push(e[r>>2]+e[r<<4&63]+"==")):2===i&&(r=(t[n-2]<<8)+t[n-1],o.push(e[r>>10]+e[r>>4&63]+e[r<<2&63]+"=")),o.join("")};for(var e=[],t=[],r=("undefined"==typeof Uint8Array?"undefined":(0,F.default)(Uint8Array))<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)e[i]=n[i],t[n.charCodeAt(i)]=i;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 a(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function s(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(a(n));return i.join("")}return t[45]=62,t[95]=63,Bt}(),t=(Ut||(Ut=!0,Nt.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,l=u>>1,c=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+f],f+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=l}return(d?-1:1)*a*Math.pow(2,o-n)},Nt.write=function(e,t,r,n,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,f=c>>1,h=23===i?5.960464477539062e-8:0,d=n?0:o-1,p=n?1:-1,v=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(s=isNaN(t)?1:0,a=c):(t*(u=Math.pow(2,-(a=Math.floor(Math.log(t)/Math.LN2))))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[r+d]=255&a,d+=p,a/=256,l-=8);e[r+d-p]|=128*v}),Nt),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;jt.Buffer=o,jt.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},jt.INSPECT_MAX_BYTES=50;var n=2147483647;function i(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');var 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 u(e)}return a(e,t,r)}function a(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);var r=0|h(e,t),n=i(r),a=n.write(e,t);return a!==r&&(n=n.slice(0,a)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){var t=new Uint8Array(e);return c(t.buffer,t.byteOffset,t.byteLength)}return l(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 "+(void 0===e?"undefined":(0,F.default)(e)));if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer)||("undefined"==typeof SharedArrayBuffer?"undefined":(0,F.default)(SharedArrayBuffer))<"u"&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return c(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return o.from(n,t,r);var a=function(e){if(o.isBuffer(e)){var t=0|f(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||ee(e.length)?i(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(a)return a;if(("undefined"==typeof Symbol?"undefined":(0,F.default)(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 "+(void 0===e?"undefined":(0,F.default)(e)))}function s(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 u(e){return s(e),i(e<0?0:0|f(e))}function l(e){for(var t=e.length<0?0:0|f(e.length),r=i(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function c(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');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,o.prototype),n}function f(e){if(e>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function h(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 '+(void 0===e?"undefined":(0,F.default)(e)));var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(i)return n?-1:J(e).length;t=(""+t).toLowerCase(),i=!0}}function d(e,t,r){var n=!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 R(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),ee(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=(n+"").toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o<s;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var f=!0,h=0;h<u;h++)if(l(e,o+h)!==l(t,h)){f=!1;break}if(f)return o}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o,a=t.length;for(n>a/2&&(n=a/2),o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(ee(s))return o;e[r+o]=s}return o}function m(e,t,r,n){return $(J(t,e.length-r),e,r,n)}function _(e,t,r,n){return $(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function k(e,t,r,n){return $(X(t),e,r,n)}function E(e,t,r,n){return $(function(e,t){for(var r,n,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function S(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o=e[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=r){var u=void 0,l=void 0,c=void 0,f=void 0;switch(s){case 1:o<128&&(a=o);break;case 2:128==(192&(u=e[i+1]))&&(f=(31&o)<<6|63&u)>127&&(a=f);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(f=(15&o)<<12|(63&u)<<6|63&l)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(f=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&f<1114112&&(a=f)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T));return r}(n)}jt.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!o.TYPED_ARRAY_SUPPORT&&("undefined"==typeof console?"undefined":(0,F.default)(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:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return a(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return function(e,t,r){return s(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(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;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(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=function(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);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(Z(a,Uint8Array))i+a.length>n.length?(o.isBuffer(a)||(a=o.from(a)),a.copy(n,i)):Uint8Array.prototype.set.call(n,a,i);else{if(!o.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i)}i+=a.length}return n},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)p(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var 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(){var e=this.length;return 0===e?"":0===arguments.length?A(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(){var e="",t=jt.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,n,i){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 '+(void 0===e?"undefined":(0,F.default)(e)));if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),u=Math.min(a,s),l=this.slice(n,i),c=e.slice(t,r),f=0;f<u;++f)if(l[f]!==c[f]){a=l[f],s=c[f];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=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===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:[].slice.call(this._arr||this,0)}};var T=4096;function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function I(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function R(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=te[e[o]];return i}function O(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(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 M(e,t,r,n,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function L(e,t,r,n,i){K(t,n,i,e,r,7);var o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;var a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function N(e,t,r,n,i){K(t,n,i,e,r,7);var 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;var a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function j(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,r,n,i,o){return r=+r,n>>>=0,o||j(e,0,n,4),t.write(e,r,n,i,23,4),n+4}function W(e,r,n,i,o){return r=+r,n>>>=0,o||j(e,0,n,8),t.write(e,r,n,i,52,8),n+8}o.prototype.slice=function(e,t){var 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);var n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(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||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=re((function(e){Y(e>>>=0,"offset");var t=this[e],r=this[e+7];(void 0===t||void 0===r)&&G(e,this.length-8);var n=t+256*this[++e]+65536*this[++e]+this[++e]*Math.pow(2,24),i=this[++e]+256*this[++e]+65536*this[++e]+r*Math.pow(2,24);return BigInt(n)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=re((function(e){Y(e>>>=0,"offset");var t=this[e],r=this[e+7];(void 0===t||void 0===r)&&G(e,this.length-8);var n=t*Math.pow(2,24)+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*Math.pow(2,24)+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(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||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=re((function(e){Y(e>>>=0,"offset");var t=this[e],r=this[e+7];(void 0===t||void 0===r)&&G(e,this.length-8);var n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*Math.pow(2,24))})),o.prototype.readBigInt64BE=re((function(e){Y(e>>>=0,"offset");var t=this[e],r=this[e+7];(void 0===t||void 0===r)&&G(e,this.length-8);var n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*Math.pow(2,24)+65536*this[++e]+256*this[++e]+r)})),o.prototype.readFloatLE=function(e,r){return e>>>=0,r||P(e,4,this.length),t.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,r){return e>>>=0,r||P(e,4,this.length),t.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,r){return e>>>=0,r||P(e,8,this.length),t.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,r){return e>>>=0,r||P(e,8,this.length),t.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(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||M(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||M(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||M(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||M(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=re((function(e){return L(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=re((function(e){return N(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(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||M(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||M(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||M(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||M(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=re((function(e){return L(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=re((function(e){return N(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return W(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return W(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&0!==n&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===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(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}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;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var s=o.isBuffer(e)?e:o.from(e,n),u=s.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<r-t;++a)this[a+t]=s[a%u]}return this};var q={};function V(e,t,r){q[e]=function(r){"use strict";(0,B.default)(i,r);var n=(0,H.default)(i);function i(){var r;return(0,w.default)(this,i),r=n.call(this),Object.defineProperty((0,g.default)(r),"message",{value:t.apply((0,g.default)(r),arguments),writable:!0,configurable:!0}),r.name="".concat(r.name," [").concat(e,"]"),r.stack,delete r.name,(0,U.default)(r)}return(0,x.default)(i,[{key:"code",get:function(){return e},set:function(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}},{key:"toString",value:function(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}]),i}(r)}function z(e){for(var t="",r=e.length,n="-"===e[0]?1:0;r>=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function K(e,t,r,n,i,o){if(e>r||e<t){var a,s="bigint"==(void 0===t?"undefined":(0,F.default)(t))?"n":"";throw a=0===t||t===BigInt(0)?">= 0".concat(s," and < 2").concat(s," ** ").concat(8*(o+1)).concat(s):">= -(2".concat(s," ** ").concat(8*(o+1)-1).concat(s,") and < 2 ** ").concat(8*(o+1)-1).concat(s),new q.ERR_OUT_OF_RANGE("value",a,e)}!function(e,t,r){Y(t,"offset"),(void 0===e[t]||void 0===e[t+r])&&G(t,e.length-(r+1))}(n,i,o)}function Y(e,t){if("number"!=typeof e)throw new q.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,r){throw Math.floor(e)!==e?(Y(e,r),new q.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new q.ERR_BUFFER_OUT_OF_BOUNDS:new q.ERR_OUT_OF_RANGE("offset",">= 0 and <= "+t,e)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(void 0===t?"undefined":(0,F.default)(t))}),TypeError),V("ERR_OUT_OF_RANGE",(function(e,t,r){var n='The value of "'.concat(e,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>Math.pow(2,32)?i=z(r+""):"bigint"==(void 0===r?"undefined":(0,F.default)(r))&&(i=r+"",(r>Math.pow(BigInt(2),BigInt(32))||r<-Math.pow(BigInt(2),BigInt(32)))&&(i=z(i)),i+="n"),n+" It must be ".concat(t,". Received ").concat(i)}),RangeError);var Q=/[^+/0-9A-Za-z-_]/g;function J(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=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 X(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 $(e,t,r,n){var i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function ee(e){return e!=e}var te=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}();function re(e){return("undefined"==typeof BigInt?"undefined":(0,F.default)(BigInt))>"u"?ne:e}function ne(){throw Error("BigInt not supported")}return jt}$(Pt,{Buffer:function(){return Wt},INSPECT_MAX_BYTES:function(){return qt},default:function(){return Ft},kMaxLength:function(){return Ht}});var Bt,Lt,Nt,Ut,jt,Dt,Ft,Wt,qt,Ht,Vt=J((function(){zt(),Ot(),ee(),Bt={},Lt=!1,Nt={},Ut=!1,jt={},Dt=!1,(Ft=Mt()).Buffer,Ft.SlowBuffer,Ft.INSPECT_MAX_BYTES,Ft.kMaxLength,Wt=Ft.Buffer,qt=Ft.INSPECT_MAX_BYTES,Ht=Ft.kMaxLength})),zt=J((function(){Vt()})),Kt=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){"use strict";function e(t){(0,w.default)(this,e),this.aliasToTopic={},this.max=t}return(0,x.default)(e,[{key:"put",value:function(e,t){return!(0===t||t>this.max||(this.aliasToTopic[t]=e,this.length=Object.keys(this.aliasToTopic).length,0))}},{key:"getTopicByAlias",value:function(e){return this.aliasToTopic[e]}},{key:"clear",value:function(){this.aliasToTopic={}}}]),e}()})),Yt=X((function(e,t){var r;zt(),Ot(),ee(),t.exports={ArrayIsArray:function(e){return Array.isArray(e)},ArrayPrototypeIncludes:function(e,t){return e.includes(t)},ArrayPrototypeIndexOf:function(e,t){return e.indexOf(t)},ArrayPrototypeJoin:function(e,t){return e.join(t)},ArrayPrototypeMap:function(e,t){return e.map(t)},ArrayPrototypePop:function(e,t){return e.pop(t)},ArrayPrototypePush:function(e,t){return e.push(t)},ArrayPrototypeSlice:function(e,t,r){return e.slice(t,r)},Error:Error,FunctionPrototypeCall:function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return(r=e).call.apply(r,[t].concat((0,D.default)(i)))},FunctionPrototypeSymbolHasInstance:function(e,t){return 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:function(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty:function(e,t,r){return Object.defineProperty(e,t,r)},ObjectGetOwnPropertyDescriptor:function(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys:function(e){return Object.keys(e)},ObjectSetPrototypeOf:function(e,t){return Object.setPrototypeOf(e,t)},Promise:Promise,PromisePrototypeCatch:function(e,t){return e.catch(t)},PromisePrototypeThen:function(e,t,r){return e.then(t,r)},PromiseReject:function(e){return Promise.reject(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest:function(e,t){return e.test(t)},SafeSet:Set,String:String,StringPrototypeSlice:function(e,t,r){return e.slice(t,r)},StringPrototypeToLowerCase:function(e){return e.toLowerCase()},StringPrototypeToUpperCase:function(e){return e.toUpperCase()},StringPrototypeTrim:function(e){return e.trim()},Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet:function(e,t,r){return e.set(t,r)},Uint8Array:Uint8Array}})),Gt=X((function(e,t){zt(),Ot(),ee();var r=(Vt(),Z(Pt)),n=Object.getPrototypeOf((0,m.default)((function(){return(0,V.__generator)(this,(function(e){return[2]}))}))).constructor,i=globalThis.Blob||r.Blob,o=(void 0===i?"undefined":(0,F.default)(i))<"u"?function(e){return e instanceof i}:function(){return!1};t.exports={AggregateError:function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e){var n;if((0,w.default)(this,r),!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+(void 0===e?"undefined":(0,F.default)(e)));for(var i="",o=0;o<e.length;o++)i+="    ".concat(e[o].stack,"\n");return(n=t.call(this,i)).name="AggregateError",n.errors=e,(0,U.default)(n)}return r}((0,q.default)(Error)),kEmptyObject:Object.freeze({}),once:function(e){var t=!1;return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){var e,t;return{promise:new Promise((function(r,n){e=r,t=n})),resolve:e,reject:t}},promisify:function(e){return new Promise((function(t,r){e((function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return e?r(e):t.apply(void 0,(0,D.default)(i))}))}))},debuglog:function(){return function(){}},format:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.replace(/%([sdifj])/g,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=(0,j.default)(t,2),o=(i[0],i[1]),a=r.shift();return"f"===o?a.toFixed(6):"j"===o?JSON.stringify(a):"s"===o&&"object"==typeof a?((a.constructor!==Object?a.constructor.name:"")+" {}").trim():a.toString()}))},inspect:function(e){switch(void 0===e?"undefined":(0,F.default)(e)){case"string":if(e.includes("'")){if(!e.includes('"'))return'"'.concat(e,'"');if(!e.includes("`")&&!e.includes("${"))return"`".concat(e,"`")}return"'".concat(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"{}"}},types:{isAsyncFunction:function(e){return e instanceof n},isArrayBufferView:function(e){return ArrayBuffer.isView(e)}},isBlob:o},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})),Qt=X((function(e,t){zt(),Ot(),ee();var r=("undefined"==typeof self?"undefined":(0,F.default)(self))<"u"?self:("undefined"==typeof window?"undefined":(0,F.default)(window))<"u"?window:void 0,n=r.AbortController,i=r.AbortSignal;t.exports=n,t.exports.AbortSignal=i,t.exports.default=n})),Jt=X((function(e,t){zt(),Ot(),ee();var r=Gt(),n=r.format,i=r.inspect,o=r.AggregateError,a=globalThis.AggregateError||o,s=Symbol(),u=["string","function","number","object","Function","Object","boolean","bigint","symbol"],l=/^([A-Z][a-z0-9]*)+$/,c={};function f(e,t){if(!e)throw new c.ERR_INTERNAL_ASSERTION(t)}function h(e){for(var t="",r=e.length,n="-"===e[0]?1:0;r>=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function d(e,t,r){r||(r=Error);var i=function(r){"use strict";(0,B.default)(o,r);var i=(0,H.default)(o);function o(){for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return(0,w.default)(this,o),i.call(this,function(e,t,r){if("function"==typeof t)return f(t.length<=r.length,"Code: ".concat(e,"; The provided arguments length (").concat(r.length,") does not match the required ones (").concat(t.length,").")),t.apply(void 0,(0,D.default)(r));var i=(t.match(/%[dfijoOs]/g)||[]).length;return f(i===r.length,"Code: ".concat(e,"; The provided arguments length (").concat(r.length,") does not match the required ones (").concat(i,").")),0===r.length?t:n.apply(void 0,[t].concat((0,D.default)(r)))}(e,t,a))}return(0,x.default)(o,[{key:"toString",value:function(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}]),o}(r);Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value:function(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[s]=!0,c[e]=i}function p(e){var t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}d("ERR_ASSERTION","%s",Error),d("ERR_INVALID_ARG_TYPE",(function(e,t,r){f("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);var n="The ";e.endsWith(" argument")?n+=e+" ":n+='"'.concat(e,'" ').concat(e.includes(".")?"property":"argument"," "),n+="must be ";var o=[],a=[],s=[],c=!0,h=!1,d=void 0;try{for(var p,v=t[Symbol.iterator]();!(c=(p=v.next()).done);c=!0){var g=p.value;f("string"==typeof g,"All expected entries have to be of type string"),u.includes(g)?o.push(g.toLowerCase()):l.test(g)?a.push(g):(f("object"!==g,'The value "object" should be written as "Object"'),s.push(g))}}catch(e){h=!0,d=e}finally{try{c||null==v.return||v.return()}finally{if(h)throw d}}if(a.length>0){var y=o.indexOf("object");-1!==y&&(o.splice(o,y,1),a.push("Object"))}if(o.length>0){switch(o.length){case 1:n+="of type "+o[0];break;case 2:n+="one of type ".concat(o[0]," or ").concat(o[1]);break;default:var b=o.pop();n+="one of type ".concat(o.join(", "),", or ").concat(b)}(a.length>0||s.length>0)&&(n+=" or ")}if(a.length>0){switch(a.length){case 1:n+="an instance of "+a[0];break;case 2:n+="an instance of ".concat(a[0]," or ").concat(a[1]);break;default:var m=a.pop();n+="an instance of ".concat(a.join(", "),", or ").concat(m)}s.length>0&&(n+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=""+s[0];break;case 2:n+="one of ".concat(s[0]," or ").concat(s[1]);break;default:var _=s.pop();n+="one of ".concat(s.join(", "),", or ").concat(_)}if(null==r)n+=". Received "+r;else if("function"==typeof r&&r.name)n+=". Received function "+r.name;else if("object"==typeof r){var w;null!==(w=r.constructor)&&void 0!==w&&w.name?n+=". Received an instance of "+r.constructor.name:n+=". Received "+i(r,{depth:-1})}else{var k=i(r,{colors:!1});k.length>25&&(k=k.slice(0,25)+"..."),n+=". Received type ".concat(void 0===r?"undefined":(0,F.default)(r)," (").concat(k,")")}return n}),TypeError),d("ERR_INVALID_ARG_VALUE",(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid",n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),"The ".concat(e.includes(".")?"property":"argument"," '").concat(e,"' ").concat(r,". Received ").concat(n)}),TypeError),d("ERR_INVALID_RETURN_VALUE",(function(e,t,r){var n;return"Expected ".concat(e,' to be returned from the "').concat(t,'" function but got ').concat(null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?"instance of "+r.constructor.name:"type "+(void 0===r?"undefined":(0,F.default)(r)),".")}),TypeError),d("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];f(t.length>0,"At least one arg needs to be specified");var n,i=t.length;switch(t=(Array.isArray(t)?t:[t]).map((function(e){return'"'.concat(e,'"')})).join(" or "),i){case 1:n+="The ".concat(t[0]," argument");break;case 2:n+="The ".concat(t[0]," and ").concat(t[1]," arguments");break;default:var o=t.pop();n+="The ".concat(t.join(", "),", and ").concat(o," arguments")}return n+" must be specified"}),TypeError),d("ERR_OUT_OF_RANGE",(function(e,t,r){var n;return f(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>Math.pow(2,32)?n=h(r+""):"bigint"==(void 0===r?"undefined":(0,F.default)(r))?(n=r+"",(r>Math.pow(2n,32n)||r<-Math.pow(2n,32n))&&(n=h(n)),n+="n"):n=i(r),'The value of "'.concat(e,'" is out of range. It must be ').concat(t,". Received ").concat(n)}),RangeError),d("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),d("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),d("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),d("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),d("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),d("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),d("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),d("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),d("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),d("ERR_STREAM_WRITE_AFTER_END","write after end",Error),d("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The operation was aborted",i=arguments.length>1?arguments[1]:void 0;if((0,w.default)(this,r),void 0!==i&&"object"!=typeof i)throw new c.ERR_INVALID_ARG_TYPE("options","Object",i);return(e=t.call(this,n,i)).code="ABORT_ERR",e.name="AbortError",(0,U.default)(e)}return r}((0,q.default)(Error)),aggregateTwoErrors:p((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;var r=new a([t,e],t.message);return r.code=t.code,r}return e||t})),hideStackFrames:p,codes:c}})),Xt=X((function(e,t){zt(),Ot(),ee();var r=Yt(),n=r.ArrayIsArray,i=r.ArrayPrototypeIncludes,o=r.ArrayPrototypeJoin,a=r.ArrayPrototypeMap,s=r.NumberIsInteger,u=r.NumberIsNaN,l=r.NumberMAX_SAFE_INTEGER,c=r.NumberMIN_SAFE_INTEGER,f=r.NumberParseInt,h=r.ObjectPrototypeHasOwnProperty,d=r.RegExpPrototypeExec,p=r.String,v=r.StringPrototypeToUpperCase,g=r.StringPrototypeTrim,y=Jt(),b=y.hideStackFrames,m=y.codes,_=m.ERR_SOCKET_BAD_PORT,w=m.ERR_INVALID_ARG_TYPE,k=m.ERR_INVALID_ARG_VALUE,E=m.ERR_OUT_OF_RANGE,S=m.ERR_UNKNOWN_SIGNAL,A=Gt().normalizeEncoding,T=Gt().types,C=T.isAsyncFunction,I=T.isArrayBufferView,R={},x=/^[0-7]+$/,O=b((function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l;if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new E(t,"an integer",e);if(e<r||e>n)throw new E(t,">= ".concat(r," && <= ").concat(n),e)})),P=b((function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-2147483648,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2147483647;if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new E(t,"an integer",e);if(e<r||e>n)throw new E(t,">= ".concat(r," && <= ").concat(n),e)})),M=b((function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new E(t,"an integer",e);var n=r?1:0,i=4294967295;if(e<n||e>i)throw new E(t,">= ".concat(n," && <= ").concat(i),e)}));function B(e,t){if("string"!=typeof e)throw new w(t,"string",e)}var L=b((function(e,t,r){if(!i(r,e)){var n="must be one of: "+o(a(r,(function(e){return"string"==typeof e?"'".concat(e,"'"):p(e)})),", ");throw new k(t,e,n)}}));function N(e,t){if("boolean"!=typeof e)throw new w(t,"boolean",e)}function U(e,t,r){return null!=e&&h(e,t)?e[t]:r}var j=b((function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=U(r,"allowArray",!1),o=U(r,"allowFunction",!1);if(!U(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new w(t,"Object",e)})),D=b((function(e,t){if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new w(t,"a dictionary",e)})),W=b((function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!n(e))throw new w(t,"Array",e);if(e.length<r)throw new k(t,e,"must be longer than "+r)})),q=b((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"buffer";if(!I(e))throw new w(t,["Buffer","TypedArray","DataView"],e)})),H=b((function(e,t){if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new w(t,"AbortSignal",e)})),V=b((function(e,t){if("function"!=typeof e)throw new w(t,"Function",e)})),z=b((function(e,t){if("function"!=typeof e||C(e))throw new w(t,"Function",e)})),K=b((function(e,t){if(void 0!==e)throw new w(t,"undefined",e)})),Y=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function G(e,t){if((void 0===e?"undefined":(0,F.default)(e))>"u"||!d(Y,e))throw new k(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,r){if((void 0===e?"undefined":(0,F.default)(e))>"u"&&(e=r),"string"==typeof e){if(null===d(x,e))throw new k(t,e,"must be a 32-bit unsigned integer or an octal string");e=f(e,8)}return M(e,t),e},validateArray:W,validateStringArray:function(e,t){W(e,t);for(var r=0;r<e.length;r++)B(e[r],"".concat(t,"[").concat(r,"]"))},validateBooleanArray:function(e,t){W(e,t);for(var r=0;r<e.length;r++)N(e[r],"".concat(t,"[").concat(r,"]"))},validateBoolean:N,validateBuffer:q,validateDictionary:D,validateEncoding:function(e,t){var r=A(t),n=e.length;if("hex"===r&&n%2!=0)throw new k("encoding",t,"is invalid for data of length "+n)},validateFunction:V,validateInt32:P,validateInteger:O,validateNumber:function(e,t,r,n){if("number"!=typeof e)throw new w(t,"number",e);if(null!=r&&e<r||null!=n&&e>n||(null!=r||null!=n)&&u(e))throw new E(t,"".concat(null!=r?">= "+r:"").concat(null!=r&&null!=n?" && ":"").concat(null!=n?"<= "+n:""),e)},validateObject:j,validateOneOf:L,validatePlainFunction:z,validatePort:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Port",r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===g(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new _(t,e,r);return 0|e},validateSignalName:function(e){if(B(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"signal"),void 0===R[e])throw void 0!==R[v(e)]?new S(e+" (signals must use all capital letters)"):new S(e)},validateString:B,validateUint32:M,validateUndefined:K,validateUnion:function(e,t,r){if(!i(r,e))throw new w(t,"('".concat(o(r,"|"),"')"),e)},validateAbortSignal:H,validateLinkHeaderValue:function(e){if("string"==typeof e)return G(e,"hints"),e;if(n(e)){var t=e.length,r="";if(0===t)return r;for(var i=0;i<t;i++){var o=e[i];G(o,"hints"),r+=o,i!==t-1&&(r+=", ")}return r}throw new k("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}}})),$t=X((function(e,t){zt(),Ot(),ee();var r,n,i=t.exports={};function o(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function s(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)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,l=[],c=!1,f=-1;function h(){!c||!u||(c=!1,u.length?l=u.concat(l):f=-1,l.length&&d())}function d(){if(!c){var e=s(h);c=!0;for(var t=l.length;t;){for(u=l,l=[];++f<t;)u&&u[f].run();f=-1,t=l.length}u=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.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];l.push(new p(e,t)),1===l.length&&!c&&s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(){return[]},i.binding=function(){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(){throw Error("process.chdir is not supported")},i.umask=function(){return 0}})),Zt=X((function(e,t){zt(),Ot(),ee();var r=Yt(),n=r.Symbol,i=r.SymbolAsyncIterator,o=r.SymbolIterator,a=r.SymbolFor,s=n("kDestroyed"),u=n("kIsErrored"),l=n("kIsReadable"),c=n("kIsDisturbed"),f=a("nodejs.webstream.isClosedPromise"),h=a("nodejs.webstream.controllerErrorFunction");function d(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||r&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(t=e._readableState)||void 0===t?void 0:t.readable)||e._writableState&&!e._readableState)}function p(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 v(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||v(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function y(e){return!(!e||v(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function b(e){return!(!e||v(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function m(e){if(!v(e))return null;var t=e._writableState,r=e._readableState,n=t||r;return!!(e.destroyed||e[s]||null!=n&&n.destroyed)}function _(e){if(!p(e))return null;if(!0===e.writableEnded)return!0;var t=e._writableState;return(null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function w(e,t){if(!d(e))return null;var 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 k(e){return e&&null!=e[l]?e[l]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!m(e)&&d(e)&&e.readable&&!w(e)}function E(e){return"boolean"!=typeof(null==e?void 0:e.writable)?null:!m(e)&&p(e)&&e.writable&&!_(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={kDestroyed:s,isDisturbed:function(e){var t;return!(!e||!(null!==(t=e[c])&&void 0!==t?t:e.readableDidRead||e.readableAborted))},kIsDisturbed:c,isErrored:function(e){var t,r,n,i,o,a,s,l,c,f;return!(!e||!(null!==(t=null!==(r=null!==(n=null!==(i=null!==(o=null!==(a=e[u])&&void 0!==a?a:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==i?i:null===(s=e._readableState)||void 0===s?void 0:s.errorEmitted)&&void 0!==n?n:null===(l=e._writableState)||void 0===l?void 0:l.errorEmitted)&&void 0!==r?r:null===(c=e._readableState)||void 0===c?void 0:c.errored)&&void 0!==t?t:null!==(f=e._writableState)&&void 0!==f&&f.errored))},kIsErrored:u,isReadable:k,kIsReadable:l,kIsClosedPromise:f,kControllerErrorFunction:h,isClosed:function(e){if(!v(e))return null;if("boolean"==typeof e.closed)return e.closed;var 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},isDestroyed:m,isDuplexNodeStream:function(e){return!(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)},isFinished:function(e,t){return v(e)?!!m(e)||!(!1!==(null==t?void 0:t.readable)&&k(e)||!1!==(null==t?void 0:t.writable)&&E(e)):null},isIterable:function(e,t){return null!=e&&(!0===t?"function"==typeof e[i]:!1===t?"function"==typeof e[o]:"function"==typeof e[i]||"function"==typeof e[o])},isReadableNodeStream:d,isReadableStream:g,isReadableEnded:function(e){if(!d(e))return null;if(!0===e.readableEnded)return!0;var t=e._readableState;return!(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)},isReadableFinished:w,isReadableErrored:function(e){var t,r;return v(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:v,isWebStream:function(e){return g(e)||y(e)||b(e)},isWritable:E,isWritableNodeStream:p,isWritableStream:y,isWritableEnded:_,isWritableFinished:function(e,t){if(!p(e))return null;if(!0===e.writableFinished)return!0;var 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:function(e){var t,r;return v(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:function(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:function(e){if(!v(e))return null;var t=e._writableState,r=e._readableState,n=t||r;return!n&&A(e)||!!(n&&n.autoDestroy&&n.emitClose&&!1===n.closed)},isTransformStream:b}})),er=X((function(e,t){zt(),Ot(),ee();var r=$t(),n=Jt(),i=n.AbortError,o=n.codes,a=o.ERR_INVALID_ARG_TYPE,s=o.ERR_STREAM_PREMATURE_CLOSE,u=Gt(),l=u.kEmptyObject,c=u.once,f=Xt(),h=f.validateAbortSignal,d=f.validateFunction,p=f.validateObject,v=f.validateBoolean,g=Yt(),y=g.Promise,b=g.PromisePrototypeThen,m=Zt(),_=m.isClosed,w=m.isReadable,k=m.isReadableNodeStream,E=m.isReadableStream,S=m.isReadableFinished,A=m.isReadableErrored,T=m.isWritable,C=m.isWritableNodeStream,I=m.isWritableStream,R=m.isWritableFinished,x=m.isWritableErrored,O=m.isNodeStream,P=m.willEmitClose,M=m.kIsClosedPromise,B=function(){};function L(e,t,n){var o,u;if(2===arguments.length?(n=t,t=l):null==t?t=l:p(t,"options"),d(n,"callback"),h(t.signal,"options.signal"),n=c(n),E(e)||I(e))return function(e,t,n){var o=!1,a=B;if(t.signal)if(a=function(){o=!0,n.call(e,new i(void 0,{cause:t.signal.reason}))},t.signal.aborted)r.nextTick(a);else{var s=n;n=c((function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.signal.removeEventListener("abort",a),s.apply(e,n)})),t.signal.addEventListener("abort",a)}var u=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];o||r.nextTick((function(){return n.apply(e,i)}))};return b(e[M].promise,u,u),B}(e,t,n);if(!O(e))throw new a("stream",["ReadableStream","WritableStream","Stream"],e);var f=null!==(o=t.readable)&&void 0!==o?o:k(e),v=null!==(u=t.writable)&&void 0!==u?u:C(e),g=e._writableState,y=e._readableState,m=function(){e.writable||U()},L=P(e)&&k(e)===f&&C(e)===v,N=R(e,!1),U=function(){N=!0,e.destroyed&&(L=!1),(!L||e.readable&&!f)&&(!f||j)&&n.call(e)},j=S(e,!1),D=function(){j=!0,e.destroyed&&(L=!1),(!L||e.writable&&!v)&&(!v||N)&&n.call(e)},F=function(t){n.call(e,t)},W=_(e),q=function(){W=!0;var t=x(e)||A(e);return t&&"boolean"!=typeof t?n.call(e,t):f&&!j&&k(e,!0)&&!S(e,!1)?n.call(e,new s):!v||N||R(e,!1)?void n.call(e):n.call(e,new s)},H=function(){W=!0;var t=x(e)||A(e);if(t&&"boolean"!=typeof t)return n.call(e,t);n.call(e)},V=function(){e.req.on("finish",U)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?v&&!g&&(e.on("end",m),e.on("close",m)):(e.on("complete",U),L||e.on("abort",q),e.req?V():e.on("request",V)),!L&&"boolean"==typeof e.aborted&&e.on("aborted",q),e.on("end",D),e.on("finish",U),!1!==t.error&&e.on("error",F),e.on("close",q),W?r.nextTick(q):null!=g&&g.errorEmitted||null!=y&&y.errorEmitted?L||r.nextTick(H):(!f&&(!L||w(e))&&(N||!1===T(e))||!v&&(!L||T(e))&&(j||!1===w(e))||y&&e.req&&e.aborted)&&r.nextTick(H);var z=function(){n=B,e.removeListener("aborted",q),e.removeListener("complete",U),e.removeListener("abort",q),e.removeListener("request",V),e.req&&e.req.removeListener("finish",U),e.removeListener("end",m),e.removeListener("close",m),e.removeListener("finish",U),e.removeListener("end",D),e.removeListener("error",F),e.removeListener("close",q)};if(t.signal&&!W){var K=function(){var r=n;z(),r.call(e,new i(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)r.nextTick(K);else{var Y=n;n=c((function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.signal.removeEventListener("abort",K),Y.apply(e,n)})),t.signal.addEventListener("abort",K)}}return z}t.exports=L,t.exports.finished=function(e,t){var r,n=!1;return null===t&&(t=l),null!==(r=t)&&void 0!==r&&r.cleanup&&(v(t.cleanup,"cleanup"),n=t.cleanup),new y((function(r,i){var o=L(e,t,(function(e){n&&o(),e?i(e):r()}))}))}})),tr=X((function(e,t){zt(),Ot(),ee();var r=$t(),n=Jt(),i=n.aggregateTwoErrors,o=n.codes.ERR_MULTIPLE_CALLBACK,a=n.AbortError,s=Yt().Symbol,u=Zt(),l=u.kDestroyed,c=u.isDestroyed,f=u.isFinished,h=u.isServerRequest,d=s("kDestroy"),p=s("kConstruct");function v(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function g(e,t,n){var i=!1;function o(t){if(!i){i=!0;var o=e._readableState,a=e._writableState;v(t,a,o),a&&(a.closed=!0),o&&(o.closed=!0),"function"==typeof n&&n(t),t?r.nextTick(y,e,t):r.nextTick(b,e)}}try{e._destroy(t||null,o)}catch(e){o(e)}}function y(e,t){m(e,t),b(e)}function b(e){var 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){var r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function _(e,t,n){var i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),n?r.nextTick(m,e,t):m(e,t))}function w(e){var t=!1;function n(n){if(t)_(e,null!=n?n:new o);else{t=!0;var i=e._readableState,a=e._writableState,s=a||i;i&&(i.constructed=!0),a&&(a.constructed=!0),s.destroyed?e.emit(d,n):n?_(e,n,!0):r.nextTick(k,e)}}try{e._construct((function(e){r.nextTick(n,e)}))}catch(e){r.nextTick(n,e)}}function k(e){e.emit(p)}function E(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close")}function A(e,t){e.emit("error",t),r.nextTick(S,e)}t.exports={construct:function(e,t){if("function"==typeof e._construct){var n=e._readableState,i=e._writableState;n&&(n.constructed=!1),i&&(i.constructed=!1),e.once(p,t),!(e.listenerCount(p)>1)&&r.nextTick(w,e)}},destroyer:function(e,t){!e||c(e)||(!t&&!f(e)&&(t=new a),h(e)?(e.socket=null,e.destroy(t)):E(e)?e.abort():E(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?r.nextTick(A,e,t):r.nextTick(S,e),e.destroyed||(e[l]=!0))},destroy:function(e,t){var r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(v(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?g(this,e,t):this.once(d,(function(r){g(this,i(r,e),t)})),this)},undestroy:function(){var 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:_}}));function rr(){rr.init.call(this)}function nr(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+(void 0===e?"undefined":(0,F.default)(e)))}function ir(e){return void 0===e._maxListeners?rr.defaultMaxListeners:e._maxListeners}function or(e,t,r,n){var i,o,a;if(nr(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),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=ir(e))>0&&a.length>i&&!a.warned){a.warned=!0;var s=Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,console&&console.warn&&console.warn(s)}return e}function ar(){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 sr(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=ar.bind(n);return i.listener=r,n.wrapFn=i,i}function ur(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):cr(i,i.length)}function lr(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 cr(e,t){for(var r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}var fr,hr,dr,pr,vr,gr,yr,br=J((function(){zt(),Ot(),ee(),dr="object"==typeof Reflect?Reflect:null,pr=dr&&"function"==typeof dr.apply?dr.apply:function(e,t,r){return function(){}.apply.call(e,t,r)},hr=dr&&"function"==typeof dr.ownKeys?dr.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)},vr=Number.isNaN||function(e){return e!=e},fr=rr,rr.EventEmitter=rr,rr.prototype._events=void 0,rr.prototype._eventsCount=0,rr.prototype._maxListeners=void 0,gr=10,Object.defineProperty(rr,"defaultMaxListeners",{enumerable:!0,get:function(){return gr},set:function(e){if("number"!=typeof e||e<0||vr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");gr=e}}),rr.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},rr.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||vr(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},rr.prototype.getMaxListeners=function(){return ir(this)},rr.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)pr(s,this,t);else{var u=s.length,l=cr(s,u);for(r=0;r<u;++r)pr(l[r],this,t)}return!0},rr.prototype.addListener=function(e,t){return or(this,e,t,!1)},rr.prototype.on=rr.prototype.addListener,rr.prototype.prependListener=function(e,t){return or(this,e,t,!0)},rr.prototype.once=function(e,t){return nr(t),this.on(e,sr(this,e,t)),this},rr.prototype.prependOnceListener=function(e,t){return nr(t),this.prependListener(e,sr(this,e,t)),this},rr.prototype.removeListener=function(e,t){var r,n,i,o,a;if(nr(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},rr.prototype.off=rr.prototype.removeListener,rr.prototype.removeAllListeners=function(e){var t,r,n;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 i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);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(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},rr.prototype.listeners=function(e){return ur(this,e,!0)},rr.prototype.rawListeners=function(e){return ur(this,e,!1)},rr.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):lr.call(e,t)},rr.prototype.listenerCount=lr,rr.prototype.eventNames=function(){return this._eventsCount>0?hr(this._events):[]},(yr=fr).EventEmitter,yr.defaultMaxListeners,yr.init,yr.listenerCount,yr.EventEmitter,yr.defaultMaxListeners,yr.init,yr.listenerCount})),mr={};$(mr,{EventEmitter:function(){return _r},default:function(){return yr},defaultMaxListeners:function(){return wr},init:function(){return kr},listenerCount:function(){return Er},on:function(){return Sr},once:function(){return Ar}});var _r,wr,kr,Er,Sr,Ar,Tr=J((function(){var e;zt(),Ot(),ee(),br(),br(),yr.once=function(e,t){return new Promise((function(r,n){function i(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];void 0!==o&&e.removeListener("error",o),r(n)}var o;"error"!==t&&(o=function(t){e.removeListener(name,i),n(t)},e.once("error",o)),e.once(t,i)}))},yr.on=function(e,t){var r=[],n=[],i=null,o=!1,a=(0,O.default)({next:function(){return(0,m.default)((function(){var e,t;return(0,V.__generator)(this,(function(a){return(e=r.shift())?[2,createIterResult(e,!1)]:i?(t=Promise.reject(i),[2,(i=null,t)]):[2,o?createIterResult(void 0,!0):new Promise((function(e,t){return n.push({resolve:e,reject:t})}))]}))}))()},return:function(){return(0,m.default)((function(){var r,i,a,l,c;return(0,V.__generator)(this,(function(f){e.removeListener(t,s),e.removeListener("error",u),o=!0,r=!0,i=!1,a=void 0;try{for(l=n[Symbol.iterator]();!(r=(c=l.next()).done);r=!0)c.value.resolve(createIterResult(void 0,!0))}catch(e){i=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}return[2,createIterResult(void 0,!0)]}))}))()},throw:function(r){i=r,e.removeListener(t,s),e.removeListener("error",u)}},Symbol.asyncIterator,(function(){return this}));return e.on(t,s),e.on("error",u),a;function s(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var o=n.shift();o?o.resolve(createIterResult(t,!1)):r.push(t)}function u(e){o=!0;var t=n.shift();t?t.reject(e):i=e,a.return()}},_r=(e=yr).EventEmitter,wr=e.defaultMaxListeners,kr=e.init,Er=e.listenerCount,Sr=e.on,Ar=e.once})),Cr=X((function(e,t){zt(),Ot(),ee();var r=Yt(),n=r.ArrayIsArray,i=r.ObjectSetPrototypeOf,o=(Tr(),Z(mr)).EventEmitter;function a(e){o.call(this,e)}function s(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}i(a.prototype,o.prototype),i(a,o),a.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",i),!e._isStdio&&(!t||!1!==t.end)&&(r.on("end",u),r.on("close",l));var a=!1;function u(){a||(a=!0,e.end())}function l(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){f(),0===o.listenerCount(this,"error")&&this.emit("error",e)}function f(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",u),r.removeListener("close",l),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",f),r.removeListener("close",f),e.removeListener("close",f)}return s(r,"error",c),s(e,"error",c),r.on("end",f),r.on("close",f),e.on("close",f),e.emit("pipe",r),e},t.exports={Stream:a,prependListener:s}})),Ir=X((function(e,t){zt(),Ot(),ee();var r=Jt(),n=r.AbortError,i=r.codes,o=Zt(),a=o.isNodeStream,s=o.isWebStream,u=o.kControllerErrorFunction,l=er(),c=i.ERR_INVALID_ARG_TYPE;t.exports.addAbortSignal=function(e,r){if(function(e,t){if("object"!=typeof e||!("aborted"in e))throw new c("signal","AbortSignal",e)}(e),!a(r)&&!s(r))throw new c("stream",["ReadableStream","WritableStream","Stream"],r);return t.exports.addAbortSignalNoValidate(e,r)},t.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;var r=a(t)?function(){t.destroy(new n(void 0,{cause:e.reason}))}:function(){t[u](new n(void 0,{cause:e.reason}))};return e.aborted?r():(e.addEventListener("abort",r),l(t,(function(){return e.removeEventListener("abort",r)}))),t}})),Rr=X((function(e,t){zt(),Ot(),ee();var r=Yt(),n=r.StringPrototypeSlice,i=r.SymbolIterator,o=r.TypedArrayPrototypeSet,a=r.Uint8Array,s=(Vt(),Z(Pt)).Buffer,u=Gt().inspect;t.exports=function(){"use strict";function e(){(0,w.default)(this,e),this.head=null,this.tail=null,this.length=0}return(0,x.default)(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;null!==(t=t.next);)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t=s.allocUnsafe(e>>>0),r=this.head,n=0;r;)o(t,r.data,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r=this.head.data;if(e<r.length){var n=r.slice(0,e);return this.head.data=r.slice(e),n}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}},{key:"first",value:function(){return this.head.data}},{key:i,value:function(){var e;return(0,V.__generator)(this,(function(t){switch(t.label){case 0:e=this.head,t.label=1;case 1:return e?[4,e.data]:[3,4];case 2:t.sent(),t.label=3;case 3:return e=e.next,[3,1];case 4:return[2]}}))}},{key:"_getString",value:function(e){var t="",r=this.head,i=0;do{var o=r.data;if(!(e>o.length)){e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(o,0,e),this.head=r,r.data=n(o,e));break}t+=o,e-=o.length,++i}while(null!==(r=r.next));return this.length-=i,t}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=e,n=this.head,i=0;do{var u=n.data;if(!(e>u.length)){e===u.length?(o(t,u,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(t,new a(u.buffer,u.byteOffset,e),r-e),this.head=n,n.data=u.slice(e));break}o(t,u,r-e),e-=u.length,++i}while(null!==(n=n.next));return this.length-=i,t}},{key:Symbol.for("nodejs.util.inspect.custom"),value:function(e,t){return u(this,(0,N.default)((0,L.default)({},t),{depth:0,customInspect:!1}))}}]),e}()})),xr=X((function(e,t){zt(),Ot(),ee();var r=Yt(),n=r.MathFloor,i=r.NumberIsInteger,o=Jt().codes.ERR_INVALID_ARG_VALUE;function a(e){return e?16:16384}t.exports={getHighWaterMark:function(e,t,r,s){var u=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,s,r);if(null!=u){if(!i(u)||u<0)throw new o(s?"options."+r:"options.highWaterMark",u);return n(u)}return a(e.objectMode)},getDefaultHighWaterMark:a}}));function Or(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 Pr(e,t,r){for(var n,i,o=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(Tn[(i=n)>>18&63]+Tn[i>>12&63]+Tn[i>>6&63]+Tn[63&i]);return o.join("")}function Mr(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Br.prototype),t}function Br(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 Ur(e)}return Lr(e,t,r)}function Lr(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!Br.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|Fr(e,t),n=Mr(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return jr(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 "+(void 0===e?"undefined":(0,F.default)(e)));if(hn(e,ArrayBuffer)||e&&hn(e.buffer,ArrayBuffer)||("undefined"==typeof SharedArrayBuffer?"undefined":(0,F.default)(SharedArrayBuffer))<"u"&&(hn(e,SharedArrayBuffer)||e&&hn(e.buffer,SharedArrayBuffer)))return function(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');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,Br.prototype),n}(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return Br.from(n,t,r);var i=function(e){if(Br.isBuffer(e)){var t=0|Dr(e.length),r=Mr(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||dn(e.length)?Mr(0):jr(e):"Buffer"===e.type&&Array.isArray(e.data)?jr(e.data):void 0}(e);if(i)return i;if(("undefined"==typeof Symbol?"undefined":(0,F.default)(Symbol))<"u"&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Br.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 "+(void 0===e?"undefined":(0,F.default)(e)))}function Nr(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 Ur(e){return Nr(e),Mr(e<0?0:0|Dr(e))}function jr(e){for(var t=e.length<0?0:0|Dr(e.length),r=Mr(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function Dr(e){if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function Fr(e,t){if(Br.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||hn(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 '+(void 0===e?"undefined":(0,F.default)(e)));var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ln(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return cn(e).length;default:if(i)return n?-1:ln(e).length;t=(""+t).toLowerCase(),i=!0}}function Wr(e,t,r){var n=!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 tn(this,t,r);case"utf8":case"utf-8":return $r(this,t,r);case"ascii":return Zr(this,t,r);case"latin1":case"binary":return en(this,t,r);case"base64":return Xr(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rn(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function qr(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Hr(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),dn(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=Br.from(t,n)),Br.isBuffer(t))return 0===t.length?-1:Vr(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Vr(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Vr(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=(n+"").toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o<s;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var f=!0,h=0;h<u;h++)if(l(e,o+h)!==l(t,h)){f=!1;break}if(f)return o}return-1}function zr(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(dn(s))return a;e[r+a]=s}return a}function Kr(e,t,r,n){return fn(ln(t,e.length-r),e,r,n)}function Yr(e,t,r,n){return fn(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function Gr(e,t,r,n){return Yr(e,t,r,n)}function Qr(e,t,r,n){return fn(cn(t),e,r,n)}function Jr(e,t,r,n){return fn(function(e,t){for(var r,n,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function Xr(e,t,r){return 0===t&&r===e.length?Pn.fromByteArray(e):Pn.fromByteArray(e.slice(t,r))}function $r(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,u,l=e[i],c=null,f=l>239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function Zr(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function en(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function tn(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=Nn[e[o]];return i}function rn(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function nn(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 on(e,t,r,n,i,o){if(!Br.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function an(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function sn(e,t,r,n,i){return t=+t,r>>>=0,i||an(e,0,r,4),Mn.write(e,t,r,n,23,4),r+4}function un(e,t,r,n,i){return t=+t,r>>>=0,i||an(e,0,r,8),Mn.write(e,t,r,n,52,8),r+8}function ln(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=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 cn(e){return Pn.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(Ln,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function fn(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function hn(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function dn(e){return e!=e}function pn(e,t){for(var r in e)t[r]=e[r]}function vn(e,t,r){return Dn(e,t,r)}function gn(e){var t;switch(this.encoding=function(e){var t=function(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 t&&(Wn.isEncoding===qn||!qn(e)))throw Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=mn,this.end=_n,t=4;break;case"utf8":this.fillLast=bn,t=4;break;case"base64":this.text=wn,this.end=kn,t=3;break;default:return this.write=En,void(this.end=Sn)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Wn.allocUnsafe(t)}function yn(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function bn(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 mn(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function _n(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 wn(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 kn(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function En(e){return e.toString(this.encoding)}function Sn(e){return e&&e.length?this.write(e):""}var An,Tn,Cn,In,Rn,xn,On,Pn,Mn,Bn,Ln,Nn,Un,jn,Dn,Fn,Wn,qn,Hn=J((function(){for(zt(),Ot(),ee(),An={byteLength:function(e){var t=Or(e),r=t[0],n=t[1];return 3*(r+n)/4-n},toByteArray:function(e){var t,r,n,i=Or(e),o=i[0],a=i[1],s=new In(3*(o+(n=a))/4-n),u=0,l=a>0?o-4:o;for(r=0;r<l;r+=4)t=Cn[e.charCodeAt(r)]<<18|Cn[e.charCodeAt(r+1)]<<12|Cn[e.charCodeAt(r+2)]<<6|Cn[e.charCodeAt(r+3)],s[u++]=t>>16&255,s[u++]=t>>8&255,s[u++]=255&t;return 2===a&&(t=Cn[e.charCodeAt(r)]<<2|Cn[e.charCodeAt(r+1)]>>4,s[u++]=255&t),1===a&&(t=Cn[e.charCodeAt(r)]<<10|Cn[e.charCodeAt(r+1)]<<4|Cn[e.charCodeAt(r+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t),s},fromByteArray:function(e){for(var t,r=e.length,n=r%3,i=[],o=0,a=r-n;o<a;o+=16383)i.push(Pr(e,o,o+16383>a?a:o+16383));return 1===n?(t=e[r-1],i.push(Tn[t>>2]+Tn[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(Tn[t>>10]+Tn[t>>4&63]+Tn[t<<2&63]+"=")),i.join("")}},Tn=[],Cn=[],In=("undefined"==typeof Uint8Array?"undefined":(0,F.default)(Uint8Array))<"u"?Uint8Array:Array,Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xn=0;xn<64;++xn)Tn[xn]=Rn[xn],Cn[Rn.charCodeAt(xn)]=xn;Cn[45]=62,Cn[95]=63,On={},Pn=An,Mn={read:function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,l=u>>1,c=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+f],f+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=l}return(d?-1:1)*a*Math.pow(2,o-n)},write:function(e,t,r,n,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,f=c>>1,h=23===i?5.960464477539062e-8:0,d=n?0:o-1,p=n?1:-1,v=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(s=isNaN(t)?1:0,a=c):(t*(u=Math.pow(2,-(a=Math.floor(Math.log(t)/Math.LN2))))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[r+d]=255&a,d+=p,a/=256,l-=8);e[r+d-p]|=128*v}},Bn="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null,On.Buffer=Br,On.SlowBuffer=function(e){return+e!=e&&(e=0),Br.alloc(+e)},On.INSPECT_MAX_BYTES=50,On.kMaxLength=2147483647,Br.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),Br.TYPED_ARRAY_SUPPORT||("undefined"==typeof console?"undefined":(0,F.default)(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(Br.prototype,"parent",{enumerable:!0,get:function(){if(Br.isBuffer(this))return this.buffer}}),Object.defineProperty(Br.prototype,"offset",{enumerable:!0,get:function(){if(Br.isBuffer(this))return this.byteOffset}}),Br.poolSize=8192,Br.from=function(e,t,r){return Lr(e,t,r)},Object.setPrototypeOf(Br.prototype,Uint8Array.prototype),Object.setPrototypeOf(Br,Uint8Array),Br.alloc=function(e,t,r){return function(e,t,r){return Nr(e),e<=0?Mr(e):void 0!==t?"string"==typeof r?Mr(e).fill(t,r):Mr(e).fill(t):Mr(e)}(e,t,r)},Br.allocUnsafe=function(e){return Ur(e)},Br.allocUnsafeSlow=function(e){return Ur(e)},Br.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==Br.prototype},Br.compare=function(e,t){if(hn(e,Uint8Array)&&(e=Br.from(e,e.offset,e.byteLength)),hn(t,Uint8Array)&&(t=Br.from(t,t.offset,t.byteLength)),!Br.isBuffer(e)||!Br.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},Br.isEncoding=function(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}},Br.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Br.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Br.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(hn(o,Uint8Array)&&(o=Br.from(o)),!Br.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},Br.byteLength=Fr,Br.prototype._isBuffer=!0,Br.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)qr(this,t,t+1);return this},Br.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)qr(this,t,t+3),qr(this,t+1,t+2);return this},Br.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)qr(this,t,t+7),qr(this,t+1,t+6),qr(this,t+2,t+5),qr(this,t+3,t+4);return this},Br.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?$r(this,0,e):Wr.apply(this,arguments)},Br.prototype.toLocaleString=Br.prototype.toString,Br.prototype.equals=function(e){if(!Br.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Br.compare(this,e)},Br.prototype.inspect=function(){var e="",t=On.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},Bn&&(Br.prototype[Bn]=Br.prototype.inspect),Br.prototype.compare=function(e,t,r,n,i){if(hn(e,Uint8Array)&&(e=Br.from(e,e.offset,e.byteLength)),!Br.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+(void 0===e?"undefined":(0,F.default)(e)));if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(n,i),l=e.slice(t,r),c=0;c<s;++c)if(u[c]!==l[c]){o=u[c],a=l[c];break}return o<a?-1:a<o?1:0},Br.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Br.prototype.indexOf=function(e,t,r){return Hr(this,e,t,r,!0)},Br.prototype.lastIndexOf=function(e,t,r){return Hr(this,e,t,r,!1)},Br.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=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===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return zr(this,e,t,r);case"utf8":case"utf-8":return Kr(this,e,t,r);case"ascii":return Yr(this,e,t,r);case"latin1":case"binary":return Gr(this,e,t,r);case"base64":return Qr(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jr(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Br.prototype.toJSON=function(){return{type:"Buffer",data:[].slice.call(this._arr||this,0)}},Br.prototype.slice=function(e,t){var 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);var n=this.subarray(e,t);return Object.setPrototypeOf(n,Br.prototype),n},Br.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||nn(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},Br.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||nn(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Br.prototype.readUInt8=function(e,t){return e>>>=0,t||nn(e,1,this.length),this[e]},Br.prototype.readUInt16LE=function(e,t){return e>>>=0,t||nn(e,2,this.length),this[e]|this[e+1]<<8},Br.prototype.readUInt16BE=function(e,t){return e>>>=0,t||nn(e,2,this.length),this[e]<<8|this[e+1]},Br.prototype.readUInt32LE=function(e,t){return e>>>=0,t||nn(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Br.prototype.readUInt32BE=function(e,t){return e>>>=0,t||nn(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Br.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||nn(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Br.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||nn(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},Br.prototype.readInt8=function(e,t){return e>>>=0,t||nn(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Br.prototype.readInt16LE=function(e,t){e>>>=0,t||nn(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Br.prototype.readInt16BE=function(e,t){e>>>=0,t||nn(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Br.prototype.readInt32LE=function(e,t){return e>>>=0,t||nn(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Br.prototype.readInt32BE=function(e,t){return e>>>=0,t||nn(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Br.prototype.readFloatLE=function(e,t){return e>>>=0,t||nn(e,4,this.length),Mn.read(this,e,!0,23,4)},Br.prototype.readFloatBE=function(e,t){return e>>>=0,t||nn(e,4,this.length),Mn.read(this,e,!1,23,4)},Br.prototype.readDoubleLE=function(e,t){return e>>>=0,t||nn(e,8,this.length),Mn.read(this,e,!0,52,8)},Br.prototype.readDoubleBE=function(e,t){return e>>>=0,t||nn(e,8,this.length),Mn.read(this,e,!1,52,8)},Br.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||on(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},Br.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||on(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},Br.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||on(this,e,t,1,255,0),this[t]=255&e,t+1},Br.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||on(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Br.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||on(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Br.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||on(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},Br.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||on(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},Br.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);on(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},Br.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);on(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},Br.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||on(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Br.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||on(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Br.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||on(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Br.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||on(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},Br.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||on(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},Br.prototype.writeFloatLE=function(e,t,r){return sn(this,e,t,!0,r)},Br.prototype.writeFloatBE=function(e,t,r){return sn(this,e,t,!1,r)},Br.prototype.writeDoubleLE=function(e,t,r){return un(this,e,t,!0,r)},Br.prototype.writeDoubleBE=function(e,t,r){return un(this,e,t,!1,r)},Br.prototype.copy=function(e,t,r,n){if(!Br.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===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(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},Br.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Br.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}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;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var a=Br.isBuffer(e)?e:Br.from(e,n),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=a[o%s]}return this},Ln=/[^+/0-9A-Za-z-_]/g,Nn=function(){for(var e=Array(256),t=0;t<16;++t)for(var r=16*t,n=0;n<16;++n)e[r+n]="0123456789abcdef"[t]+"0123456789abcdef"[n];return e}(),On.Buffer,On.INSPECT_MAX_BYTES,On.kMaxLength,Un={},(Dn=(jn=On).Buffer).from&&Dn.alloc&&Dn.allocUnsafe&&Dn.allocUnsafeSlow?Un=jn:(pn(jn,Un),Un.Buffer=vn),vn.prototype=Object.create(Dn.prototype),pn(Dn,vn),vn.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return Dn(e,t,r)},vn.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=Dn(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},vn.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return Dn(e)},vn.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return jn.SlowBuffer(e)},Fn={},Wn=Un.Buffer,qn=Wn.isEncoding||function(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}},Fn.StringDecoder=gn,gn.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||""},gn.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},gn.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=yn(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=yn(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=yn(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},gn.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},Fn.StringDecoder,Fn.StringDecoder})),Vn={};$(Vn,{StringDecoder:function(){return zn},default:function(){return Fn}});var zn,Kn=J((function(){zt(),Ot(),ee(),Hn(),Hn(),zn=Fn.StringDecoder})),Yn=X((function(e,t){zt(),Ot(),ee();var r=$t(),n=Yt(),i=n.PromisePrototypeThen,o=n.SymbolAsyncIterator,a=n.SymbolIterator,s=(Vt(),Z(Pt)).Buffer,u=Jt().codes,l=u.ERR_INVALID_ARG_TYPE,c=u.ERR_STREAM_NULL_VALUES;t.exports=function(e,t,n){var u,f;if("string"==typeof t||t instanceof s)return new e((0,N.default)((0,L.default)({objectMode:!0},n),{read:function(){this.push(t),this.push(null)}}));if(t&&t[o])f=!0,u=t[o]();else{if(!t||!t[a])throw new l("iterable",["Iterable"],t);f=!1,u=t[a]()}var h=new e((0,L.default)({objectMode:!0,highWaterMark:1},n)),d=!1;return h._read=function(){d||(d=!0,(0,m.default)((function(){var e,t,r,n,i,o;return(0,V.__generator)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,9,,10]),f?[4,u.next()]:[3,2];case 1:return r=a.sent(),[3,3];case 2:r=u.next(),a.label=3;case 3:return t=(e=r).value,e.done?(h.push(null),[3,8]):[3,4];case 4:return t&&"function"==typeof t.then?[4,t]:[3,6];case 5:return i=a.sent(),[3,7];case 6:i=t,a.label=7;case 7:if(null===(n=i))throw d=!1,new c;if(h.push(n))return[3,11];d=!1,a.label=8;case 8:return[3,10];case 9:return o=a.sent(),h.destroy(o),[3,10];case 10:return[3,12];case 11:return[3,0];case 12:return[2]}}))}))())},h._destroy=function(e,t){i(function(){var e=(0,m.default)((function(e){var t,r,n,i,o;return(0,V.__generator)(this,(function(a){switch(a.label){case 0:return t=null!=e,r="function"==typeof u.throw,t&&r?[4,u.throw(e)]:[3,3];case 1:return n=a.sent(),i=n.value,o=n.done,[4,i];case 2:if(a.sent(),o)return[2];a.label=3;case 3:return"function"!=typeof u.return?[3,6]:[4,u.return()];case 4:return[4,a.sent().value];case 5:a.sent(),a.label=6;case 6:return[2]}}))}));return function(t){return e.apply(this,arguments)}}()(e),(function(){return r.nextTick(t,e)}),(function(n){return r.nextTick(t,n||e)}))},h}})),Gn=X((function(e,t){zt(),Ot(),ee();var r=$t(),n=Yt(),i=n.ArrayPrototypeIndexOf,o=n.NumberIsInteger,a=n.NumberIsNaN,s=n.NumberParseInt,u=n.ObjectDefineProperties,l=n.ObjectKeys,c=n.ObjectSetPrototypeOf,f=n.Promise,h=n.SafeSet,d=n.SymbolAsyncIterator,p=n.Symbol;t.exports=Q,Q.ReadableState=G;var v=(Tr(),Z(mr)).EventEmitter,g=Cr(),y=g.Stream,b=g.prependListener,m=(Vt(),Z(Pt)).Buffer,w=Ir().addAbortSignal,k=er(),E=Gt().debuglog("stream",(function(e){E=e})),S=Rr(),A=tr(),T=xr(),C=T.getHighWaterMark,I=T.getDefaultHighWaterMark,R=Jt(),x=R.aggregateTwoErrors,O=R.codes,P=O.ERR_INVALID_ARG_TYPE,M=O.ERR_METHOD_NOT_IMPLEMENTED,B=O.ERR_OUT_OF_RANGE,U=O.ERR_STREAM_PUSH_AFTER_EOF,j=O.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,D=Xt().validateObject,F=p("kPaused"),q=(Kn(),Z(Vn)).StringDecoder,H=Yn();c(Q.prototype,y.prototype),c(Q,y);var z,K=function(){},Y=A.errorOrDestroy;function G(e,t,r){"boolean"!=typeof r&&(r=t instanceof Xn()),this.objectMode=!(!e||!e.objectMode),r&&(this.objectMode=this.objectMode||!(!e||!e.readableObjectMode)),this.highWaterMark=e?C(this,e,"readableHighWaterMark",r):I(!1),this.buffer=new S,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[F]=null,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new q(e.encoding),this.encoding=e.encoding)}function Q(e){var t=this;if(!(this instanceof Q))return new Q(e);var r=this instanceof Xn();this._readableState=new G(e,this,r),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&&!r&&w(e.signal,this)),y.call(this,e),A.construct(this,(function(){t._readableState.needReadable&&ne(t,t._readableState)}))}function J(e,t,r,n){E("readableAddChunk",t);var i,o=e._readableState;if(o.objectMode||("string"==typeof t?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?t=m.from(t,r).toString(o.encoding):(t=m.from(t,r),r=""))):t instanceof m?r="":y._isUint8Array(t)?(t=y._uint8ArrayToBuffer(t),r=""):null!=t&&(i=new P("chunk",["string","Buffer","Uint8Array"],t))),i)Y(e,i);else if(null===t)o.reading=!1,function(e,t){if(E("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?te(e):(t.needReadable=!1,t.emittedReadable=!0,re(e))}}(e,o);else if(o.objectMode||t&&t.length>0)if(n)if(o.endEmitted)Y(e,new j);else{if(o.destroyed||o.errored)return!1;X(e,o,t,!0)}else if(o.ended)Y(e,new U);else{if(o.destroyed||o.errored)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?X(e,o,t,!1):ne(e,o)):X(e,o,t,!1)}else n||(o.reading=!1,ne(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function X(e,t,r,n){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&te(e)),ne(e,t)}function $(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function te(e){var t=e._readableState;E("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(E("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(re,e))}function re(e){var t=e._readableState;E("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,ue(e)}function ne(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,r.nextTick(ie,e,t))}function ie(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(E("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function oe(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[F]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function ae(e){E("readable nexttick read 0"),e.read(0)}function se(e,t){E("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ue(e),t.flowing&&!t.reading&&e.read(0)}function ue(e){var t=e._readableState;for(E("flow",t.flowing);t.flowing&&null!==e.read(););}function le(e,t){"function"!=typeof e.read&&(e=Q.wrap(e,{objectMode:!0}));var r=function(){var e=(0,W.default)((function(e,t){var r,n,i,o,a;function s(t){this===e?(r(),r=K):r=t}return(0,V.__generator)(this,(function(u){switch(u.label){case 0:r=K,e.on("readable",s),i=k(e,{writable:!1},(function(e){n=e?x(n,e):null,r(),r=K})),u.label=1;case 1:return u.trys.push([1,7,8,9]),null===(o=e.destroyed?null:e.read())?[3,3]:[4,o];case 2:return u.sent(),[3,5];case 3:if(n)throw n;return null===n?[2]:[4,(0,_.default)(new f(s))];case 4:u.sent(),u.label=5;case 5:return[3,1];case 6:return[3,9];case 7:throw a=u.sent(),n=x(n,a);case 8:return!n&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==n&&!e._readableState.autoDestroy?(e.off("readable",s),i()):A.destroyer(e,null),[7];case 9:return[2]}}))}));return function(t,r){return e.apply(this,arguments)}}()(e,t);return r.stream=e,r}function ce(e,t){return 0===t.length?null:(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);var r}function fe(e){var t=e._readableState;E("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(he,t,e))}function he(e,t){if(E("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){var n=t._writableState;(!n||n.autoDestroy&&(n.finished||!1===n.writable))&&t.destroy()}}function de(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}function pe(){return void 0===z&&(z={}),z}Q.prototype.destroy=A.destroy,Q.prototype._undestroy=A.undestroy,Q.prototype._destroy=function(e,t){t(e)},Q.prototype[v.captureRejectionSymbol]=function(e){this.destroy(e)},Q.prototype.push=function(e,t){return J(this,e,t,!1)},Q.prototype.unshift=function(e,t){return J(this,e,t,!0)},Q.prototype.isPaused=function(){var e=this._readableState;return!0===e[F]||!1===e.flowing},Q.prototype.setEncoding=function(e){var t=new q(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;var r=this._readableState.buffer,n="",i=!0,o=!1,a=void 0;try{for(var s,u=r[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var l=s.value;n+=t.write(l)}}catch(e){o=!0,a=e}finally{try{i||null==u.return||u.return()}finally{if(o)throw a}}return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this},Q.prototype.read=function(e){E("read",e),void 0===e?e=NaN:o(e)||(e=s(e,10));var t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new B("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.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return E("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?fe(this):te(this),null;if(0===(e=$(e,t))&&t.ended)return 0===t.length&&fe(this),null;var n,i=t.needReadable;if(E("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&E("length less than watermark",i=!0),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)E("reading, ended or constructing",i=!1);else if(i){E("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0);try{this._read(t.highWaterMark)}catch(e){Y(this,e)}t.sync=!1,t.reading||(e=$(r,t))}return null===(n=e>0?ce(e,t):null)?(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&&fe(this)),null!==n&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit("data",n)),n},Q.prototype._read=function(){throw new M("_read()")},Q.prototype.pipe=function(e,t){var n=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),E("pipe count=%d opts=%j",i.pipes.length,t);var o=t&&!1===t.end||e===r.stdout||e===r.stderr?v:a;function a(){E("onend"),e.end()}i.endEmitted?r.nextTick(o):n.once("end",o),e.on("unpipe",(function t(r,o){E("onunpipe"),r===n&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,E("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),s&&e.removeListener("drain",s),e.removeListener("error",f),e.removeListener("unpipe",t),n.removeListener("end",a),n.removeListener("end",v),n.removeListener("data",c),u=!0,s&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&s())}));var s,u=!1;function l(){u||(1===i.pipes.length&&i.pipes[0]===e?(E("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(E("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),n.pause()),s||(s=function(e,t){return function(){var r=e._readableState;r.awaitDrainWriters===t?(E("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(E("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),(!r.awaitDrainWriters||0===r.awaitDrainWriters.size)&&e.listenerCount("data")&&e.resume()}}(n,e),e.on("drain",s))}function c(t){E("ondata");var r=e.write(t);E("dest.write",r),!1===r&&l()}function f(t){if(E("onerror",t),v(),e.removeListener("error",f),0===e.listenerCount("error")){var r=e._writableState||e._readableState;r&&!r.errorEmitted?Y(e,t):e.emit("error",t)}}function d(){e.removeListener("finish",p),v()}function p(){E("onfinish"),e.removeListener("close",d),v()}function v(){E("unpipe"),n.unpipe(e)}return n.on("data",c),b(e,"error",f),e.once("close",d),e.once("finish",p),e.emit("pipe",n),!0===e.writableNeedDrain?i.flowing&&l():i.flowing||(E("pipe resume"),n.resume()),e},Q.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipes.length)return this;if(!e){var r=t.pipes;t.pipes=[],this.pause();for(var n=0;n<r.length;n++)r[n].emit("unpipe",this,{hasUnpiped:!1});return this}var o=i(t.pipes,e);return-1===o||(t.pipes.splice(o,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,{hasUnpiped:!1})),this},Q.prototype.on=function(e,t){var n=y.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,E("on readable",i.length,i.reading),i.length?te(this):i.reading||r.nextTick(ae,this)),n},Q.prototype.addListener=Q.prototype.on,Q.prototype.removeListener=function(e,t){var n=y.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(oe,this),n},Q.prototype.off=Q.prototype.removeListener,Q.prototype.removeAllListeners=function(e){var t=y.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&r.nextTick(oe,this),t},Q.prototype.resume=function(){var e=this._readableState;return e.flowing||(E("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(se,e,t))}(this,e)),e[F]=!1,this},Q.prototype.pause=function(){return E("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(E("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[F]=!0,this},Q.prototype.wrap=function(e){var t=this,r=!1;e.on("data",(function(n){!t.push(n)&&e.pause&&(r=!0,e.pause())})),e.on("end",(function(){t.push(null)})),e.on("error",(function(e){Y(t,e)})),e.on("close",(function(){t.destroy()})),e.on("destroy",(function(){t.destroy()})),this._read=function(){r&&e.resume&&(r=!1,e.resume())};for(var n=l(e),i=1;i<n.length;i++){var o=n[i];void 0===this[o]&&"function"==typeof e[o]&&(this[o]=e[o].bind(e))}return this},Q.prototype[d]=function(){return le(this)},Q.prototype.iterator=function(e){return void 0!==e&&D(e,"options"),le(this,e)},u(Q.prototype,{readable:{__proto__:null,get:function(){var e=this._readableState;return!(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set:function(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get:function(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get:function(){return!!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get:function(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get:function(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get:function(){return!!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get:function(){return!!this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get:function(){return!!this._readableState&&this._readableState.endEmitted}}}),u(G.prototype,{pipesCount:{__proto__:null,get:function(){return this.pipes.length}},paused:{__proto__:null,get:function(){return!1!==this[F]},set:function(e){this[F]=!!e}}}),Q._fromList=ce,Q.from=function(e,t){return H(Q,e,t)},Q.fromWeb=function(e,t){return pe().newStreamReadableFromReadableStream(e,t)},Q.toWeb=function(e,t){return pe().newReadableStreamFromStreamReadable(e,t)},Q.wrap=function(e,t){var r,n;return new Q((0,N.default)((0,L.default)({objectMode:null===(r=null!==(n=e.readableObjectMode)&&void 0!==n?n:e.objectMode)||void 0===r||r},t),{destroy:function(t,r){A.destroyer(e,t),r(t)}})).wrap(e)}})),Qn=X((function(e,t){zt(),Ot(),ee();var r=$t(),n=Yt(),i=n.ArrayPrototypeSlice,o=n.Error,a=n.FunctionPrototypeSymbolHasInstance,s=n.ObjectDefineProperty,u=n.ObjectDefineProperties,l=n.ObjectSetPrototypeOf,c=n.StringPrototypeToLowerCase,f=n.Symbol,h=n.SymbolHasInstance;t.exports=N,N.WritableState=B;var d=(Tr(),Z(mr)).EventEmitter,p=Cr().Stream,v=(Vt(),Z(Pt)).Buffer,g=tr(),y=Ir().addAbortSignal,b=xr(),m=b.getHighWaterMark,_=b.getDefaultHighWaterMark,w=Jt().codes,k=w.ERR_INVALID_ARG_TYPE,E=w.ERR_METHOD_NOT_IMPLEMENTED,S=w.ERR_MULTIPLE_CALLBACK,A=w.ERR_STREAM_CANNOT_PIPE,T=w.ERR_STREAM_DESTROYED,C=w.ERR_STREAM_ALREADY_FINISHED,I=w.ERR_STREAM_NULL_VALUES,R=w.ERR_STREAM_WRITE_AFTER_END,x=w.ERR_UNKNOWN_ENCODING,O=g.errorOrDestroy;function P(){}l(N.prototype,p.prototype),l(N,p);var M=f("kOnFinished");function B(e,t,r){"boolean"!=typeof r&&(r=t instanceof Xn()),this.objectMode=!(!e||!e.objectMode),r&&(this.objectMode=this.objectMode||!(!e||!e.writableObjectMode)),this.highWaterMark=e?m(this,e,"writableHighWaterMark",r):_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=!(!e||!1!==e.decodeStrings);this.decodeStrings=!n,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=F.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,L(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[M]=[]}function L(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}function N(e){var t=this,r=this instanceof Xn();if(!r&&!a(N,this))return new N(e);this._writableState=new B(e,this,r),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&&y(e.signal,this)),p.call(this,e),g.construct(this,(function(){var e=t._writableState;e.writing||V(t,e),K(t,e)}))}function U(e,t,n,i){var o,a=e._writableState;if("function"==typeof n)i=n,n=a.defaultEncoding;else{if(n){if("buffer"!==n&&!v.isEncoding(n))throw new x(n)}else n=a.defaultEncoding;"function"!=typeof i&&(i=P)}if(null===t)throw new I;if(!a.objectMode)if("string"==typeof t)!1!==a.decodeStrings&&(t=v.from(t,n),n="buffer");else if(t instanceof v)n="buffer";else{if(!p._isUint8Array(t))throw new k("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),n="buffer"}return a.ending?o=new R:a.destroyed&&(o=new T("write")),o?(r.nextTick(i,o),O(e,o,!0),o):(a.pendingcb++,function(e,t,r,n,i){var o=t.objectMode?1:r.length;t.length+=o;var a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:r,encoding:n,callback:i}),t.allBuffers&&"buffer"!==n&&(t.allBuffers=!1),t.allNoop&&i!==P&&(t.allNoop=!1)):(t.writelen=o,t.writecb=i,t.writing=!0,t.sync=!0,e._write(r,n,t.onwrite),t.sync=!1),a&&!t.errored&&!t.destroyed}(e,a,t,n,i))}function j(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new T("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function D(e,t,r,n){--t.pendingcb,n(r),H(t),O(e,r)}function F(e,t){var n=e._writableState,i=n.sync,o=n.writecb;"function"==typeof o?(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t?(t.stack,n.errored||(n.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?r.nextTick(D,e,n,t,o):D(e,n,t,o)):(n.buffered.length>n.bufferedIndex&&V(e,n),i?null!==n.afterWriteTickInfo&&n.afterWriteTickInfo.cb===o?n.afterWriteTickInfo.count++:(n.afterWriteTickInfo={count:1,cb:o,stream:e,state:n},r.nextTick(W,n.afterWriteTickInfo)):q(e,n,1,o))):O(e,new S)}function W(e){var t=e.stream,r=e.state,n=e.count,i=e.cb;return r.afterWriteTickInfo=null,q(t,r,n,i)}function q(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&H(t),K(e,t)}function H(e){if(!e.writing){for(var t=e.bufferedIndex;t<e.buffered.length;++t){var r,n=e.buffered[t],i=n.chunk,o=n.callback,a=e.objectMode?1:i.length;e.length-=a,o(null!==(r=e.errored)&&void 0!==r?r:new T("write"))}for(var s=e[M].splice(0),u=0;u<s.length;u++){var l;s[u](null!==(l=e.errored)&&void 0!==l?l:new T("end"))}L(e)}}function V(e,t){if(!(t.corked||t.bufferProcessing||t.destroyed)&&t.constructed){var r=t.buffered,n=t.bufferedIndex,o=t.objectMode,a=r.length-n;if(a){var s=n;if(t.bufferProcessing=!0,a>1&&e._writev){t.pendingcb-=a-1;var u=t.allNoop?P:function(e){for(var t=s;t<r.length;++t)r[t].callback(e)},l=t.allNoop&&0===s?r:i(r,s);l.allBuffers=t.allBuffers,j(e,t,!0,t.length,l,"",u),L(t)}else{do{var c=r[s],f=c.chunk,h=c.encoding,d=c.callback;r[s++]=null,j(e,t,!1,o?1:f.length,f,h,d)}while(s<r.length&&!t.writing);s===r.length?L(t):s>256?(r.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}}}function z(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 K(e,t,n){z(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){var n=!1;function i(i){if(n)O(e,null!=i?i:S());else if(n=!0,t.pendingcb--,i){for(var o=t[M].splice(0),a=0;a<o.length;a++)o[a](i);O(e,i,t.sync)}else z(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,r.nextTick(Y,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}(e,t)))}(e,t),0===t.pendingcb&&(n?(t.pendingcb++,r.nextTick((function(e,t){z(t)?Y(e,t):t.pendingcb--}),e,t)):z(t)&&(t.pendingcb++,Y(e,t))))}function Y(e,t){t.pendingcb--,t.finished=!0;for(var r=t[M].splice(0),n=0;n<r.length;n++)r[n]();if(e.emit("finish"),t.autoDestroy){var i=e._readableState;(!i||i.autoDestroy&&(i.endEmitted||!1===i.readable))&&e.destroy()}}B.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(B.prototype,"bufferedRequestCount",{__proto__:null,get:function(){return this.buffered.length-this.bufferedIndex}}),s(N,h,{__proto__:null,value:function(e){return!!a(this,e)||this===N&&e&&e._writableState instanceof B}}),N.prototype.pipe=function(){O(this,new A)},N.prototype.write=function(e,t,r){return!0===U(this,e,t,r)},N.prototype.cork=function(){this._writableState.corked++},N.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||V(this,e))},N.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=c(e)),!v.isEncoding(e))throw new x(e);return this._writableState.defaultEncoding=e,this},N.prototype._write=function(e,t,r){if(!this._writev)throw new E("_write()");this._writev([{chunk:e,encoding:t}],r)},N.prototype._writev=null,N.prototype.end=function(e,t,n){var i,a=this._writableState;if("function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e){var s=U(this,e,t);s instanceof o&&(i=s)}return a.corked&&(a.corked=1,this.uncork()),i||(a.errored||a.ending?a.finished?i=new C("end"):a.destroyed&&(i=new T("end")):(a.ending=!0,K(this,a,!0),a.ended=!0)),"function"==typeof n&&(i||a.finished?r.nextTick(n,i):a[M].push(n)),this},u(N.prototype,{closed:{__proto__:null,get:function(){return!!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get:function(){return!!this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get:function(){var e=this._writableState;return!(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set:function(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get:function(){return!!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get:function(){return!!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get:function(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get:function(){return!!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get:function(){var e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&e.needDrain}},writableHighWaterMark:{__proto__:null,get:function(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get:function(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get:function(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get:function(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});var G,Q=g.destroy;function J(){return void 0===G&&(G={}),G}N.prototype.destroy=function(e,t){var n=this._writableState;return!n.destroyed&&(n.bufferedIndex<n.buffered.length||n[M].length)&&r.nextTick(H,n),Q.call(this,e,t),this},N.prototype._undestroy=g.undestroy,N.prototype._destroy=function(e,t){t(e)},N.prototype[d.captureRejectionSymbol]=function(e){this.destroy(e)},N.fromWeb=function(e,t){return J().newStreamWritableFromWritableStream(e,t)},N.toWeb=function(e){return J().newWritableStreamFromStreamWritable(e)}})),Jn=X((function(e,t){zt(),Ot(),ee();var r=$t(),n=(Vt(),Z(Pt)),i=Zt(),o=i.isReadable,a=i.isWritable,s=i.isIterable,u=i.isNodeStream,l=i.isReadableNodeStream,c=i.isWritableNodeStream,f=i.isDuplexNodeStream,h=er(),d=Jt(),p=d.AbortError,v=d.codes,g=v.ERR_INVALID_ARG_TYPE,y=v.ERR_INVALID_RETURN_VALUE,b=tr().destroyer,k=Xn(),E=Gn(),S=Gt().createDeferredPromise,A=Yn(),T=globalThis.Blob||n.Blob,C=(void 0===T?"undefined":(0,F.default)(T))<"u"?function(e){return e instanceof T}:function(){return!1},I=globalThis.AbortController||Qt().AbortController,R=Yt().FunctionPrototypeCall,x=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e){var n;return(0,w.default)(this,r),n=t.call(this,e),!1===(null==e?void 0:e.readable)&&(n._readableState.readable=!1,n._readableState.ended=!0,n._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(n._writableState.writable=!1,n._writableState.ending=!0,n._writableState.ended=!0,n._writableState.finished=!0),(0,U.default)(n)}return r}(k);function O(e){var t,r,n,i,s,u=e.readable&&"function"!=typeof e.readable.read?E.wrap(e.readable):e.readable,l=e.writable,c=!!o(u),f=!!a(l);function d(e){var t=i;i=null,t?t(e):e&&s.destroy(e)}return s=new x({readableObjectMode:!(null==u||!u.readableObjectMode),writableObjectMode:!(null==l||!l.writableObjectMode),readable:c,writable:f}),f&&(h(l,(function(e){f=!1,e&&b(u,e),d(e)})),s._write=function(e,r,n){l.write(e,r)?n():t=n},s._final=function(e){l.end(),r=e},l.on("drain",(function(){if(t){var e=t;t=null,e()}})),l.on("finish",(function(){if(r){var e=r;r=null,e()}}))),c&&(h(u,(function(e){c=!1,e&&b(u,e),d(e)})),u.on("readable",(function(){if(n){var e=n;n=null,e()}})),u.on("end",(function(){s.push(null)})),s._read=function(){for(;;){var e=u.read();if(null===e)return void(n=s._read);if(!s.push(e))return}}),s._destroy=function(e,o){!e&&null!==i&&(e=new p),n=null,t=null,r=null,null===i?o(e):(i=o,b(l,e),b(u,e))},s}t.exports=function e(t,n){if(f(t))return t;if(l(t))return O({readable:t});if(c(t))return O({writable:t});if(u(t))return O({writable:!1,readable:!1});if("function"==typeof t){var i=function(e){var t=S(),n=t.promise,i=t.resolve,o=new I,a=o.signal;return{value:e((0,W.default)((function(){var e,t,o,s,u,l;return(0,V.__generator)(this,(function(c){switch(c.label){case 0:return e=n,n=null,[4,(0,_.default)(e)];case 1:if(t=c.sent(),o=t.chunk,s=t.done,u=t.cb,r.nextTick(u),s)return[2];if(a.aborted)throw new p(void 0,{cause:a.reason});return l=S(),n=l.promise,i=l.resolve,[4,o];case 2:c.sent(),c.label=3;case 3:return[3,0];case 4:return[2]}}))}))(),{signal:a}),write:function(e,t,r){var n=i;i=null,n({chunk:e,done:!1,cb:r})},final:function(e){var t=i;i=null,t({done:!0,cb:e})},destroy:function(e,t){o.abort(),t(e)}}}(t),o=i.value,a=i.write,h=i.final,d=i.destroy;if(s(o))return A(x,o,{objectMode:!0,write:a,final:h,destroy:d});var v=null==o?void 0:o.then;if("function"==typeof v){var w,k=R(v,o,(function(e){if(null!=e)throw new y("nully","body",e)}),(function(e){b(w,e)}));return w=new x({objectMode:!0,readable:!1,write:a,final:function(e){h((0,m.default)((function(){var t;return(0,V.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,k];case 1:return n.sent(),r.nextTick(e,null),[3,3];case 2:return t=n.sent(),r.nextTick(e,t),[3,3];case 3:return[2]}}))})))},destroy:d})}throw new y("Iterable, AsyncIterable or AsyncFunction",n,o)}if(C(t))return e(t.arrayBuffer());if(s(t))return A(x,t,{objectMode:!0,writable:!1});if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return O({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?c(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});var E,T=null==t?void 0:t.then;if("function"==typeof T)return R(T,t,(function(e){null!=e&&E.push(e),E.push(null)}),(function(e){b(E,e)})),E=new x({objectMode:!0,writable:!1,read:function(){}});throw new g(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}})),Xn=X((function(e,t){zt(),Ot(),ee();var r=Yt(),n=r.ObjectDefineProperties,i=r.ObjectGetOwnPropertyDescriptor,o=r.ObjectKeys,a=r.ObjectSetPrototypeOf;t.exports=p;var s,u,l=Gn(),c=Qn();a(p.prototype,l.prototype),a(p,l);for(var f=o(c.prototype),h=0;h<f.length;h++){var d=f[h];p.prototype[d]||(p.prototype[d]=c.prototype[d])}function p(e){if(!(this instanceof p))return new p(e);l.call(this,e),c.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 v(){return void 0===s&&(s={}),s}n(p.prototype,{writable:(0,L.default)({__proto__:null},i(c.prototype,"writable")),writableHighWaterMark:(0,L.default)({__proto__:null},i(c.prototype,"writableHighWaterMark")),writableObjectMode:(0,L.default)({__proto__:null},i(c.prototype,"writableObjectMode")),writableBuffer:(0,L.default)({__proto__:null},i(c.prototype,"writableBuffer")),writableLength:(0,L.default)({__proto__:null},i(c.prototype,"writableLength")),writableFinished:(0,L.default)({__proto__:null},i(c.prototype,"writableFinished")),writableCorked:(0,L.default)({__proto__:null},i(c.prototype,"writableCorked")),writableEnded:(0,L.default)({__proto__:null},i(c.prototype,"writableEnded")),writableNeedDrain:(0,L.default)({__proto__:null},i(c.prototype,"writableNeedDrain")),destroyed:{__proto__:null,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}}),p.fromWeb=function(e,t){return v().newStreamDuplexFromReadableWritablePair(e,t)},p.toWeb=function(e){return v().newReadableWritablePairFromDuplex(e)},p.from=function(e){return u||(u=Jn()),u(e,"body")}})),$n=X((function(e,t){zt(),Ot(),ee();var r=Yt(),n=r.ObjectSetPrototypeOf,i=r.Symbol;t.exports=l;var o=Jt().codes.ERR_METHOD_NOT_IMPLEMENTED,a=Xn(),s=xr().getHighWaterMark;n(l.prototype,a.prototype),n(l,a);var u=i("kCallback");function l(e){if(!(this instanceof l))return new l(e);var t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e=(0,N.default)((0,L.default)({},e),{highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0})),a.call(this,e),this._readableState.sync=!1,this[u]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",f)}function c(e){var t=this;"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush((function(r,n){r?e?e(r):t.destroy(r):(null!=n&&t.push(n),t.push(null),e&&e())}))}function f(){this._final!==c&&c.call(this)}l.prototype._final=c,l.prototype._transform=function(){throw new o("_transform()")},l.prototype._write=function(e,t,r){var n=this,i=this._readableState,o=this._writableState,a=i.length;this._transform(e,t,(function(e,t){e?r(e):(null!=t&&n.push(t),o.ended||a===i.length||i.length<i.highWaterMark?r():n[u]=r)}))},l.prototype._read=function(){if(this[u]){var e=this[u];this[u]=null,e()}}})),Zn=X((function(e,t){zt(),Ot(),ee();var r=Yt().ObjectSetPrototypeOf;t.exports=i;var n=$n();function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(i.prototype,n.prototype),r(i,n),i.prototype._transform=function(e,t,r){r(null,e)}})),ei=X((function(e,t){zt(),Ot(),ee();var r,n,i=$t(),o=Yt(),a=o.ArrayIsArray,s=o.Promise,u=o.SymbolAsyncIterator,l=er(),c=Gt().once,f=tr(),h=Xn(),d=Jt(),p=d.aggregateTwoErrors,v=d.codes,g=v.ERR_INVALID_ARG_TYPE,w=v.ERR_INVALID_RETURN_VALUE,k=v.ERR_MISSING_ARGS,E=v.ERR_STREAM_DESTROYED,S=v.ERR_STREAM_PREMATURE_CLOSE,A=d.AbortError,T=Xt(),C=T.validateFunction,I=T.validateAbortSignal,R=Zt(),x=R.isIterable,O=R.isReadable,P=R.isReadableNodeStream,M=R.isNodeStream,B=R.isTransformStream,L=R.isWebStream,N=R.isReadableStream,U=R.isReadableEnded,j=globalThis.AbortController||Qt().AbortController;function D(e,t,r){var n=!1;e.on("close",(function(){n=!0}));var i=l(e,{readable:t,writable:r},(function(e){n=!e}));return{destroy:function(t){n||(n=!0,f.destroyer(e,t||new E("pipe")))},cleanup:i}}function F(e){if(x(e))return e;if(P(e))return(t=(0,W.default)((function(e){return(0,V.__generator)(this,(function(t){switch(t.label){case 0:return n||(n=Gn()),[5,(0,V.__values)((0,y.default)((0,b.default)(n.prototype[u].call(e)),_.default))];case 1:return t.sent(),[2]}}))})),function(e){return t.apply(this,arguments)})(e);var t;throw new g("val",["Readable","Iterable","AsyncIterable"],e)}function q(e,t,r,n){return H.apply(this,arguments)}function H(){return H=(0,m.default)((function(e,t,r,n){var i,o,a,u,c,f,h,d,v,g,y,m,_,w,k;return(0,V.__generator)(this,(function(E){switch(E.label){case 0:i=n.end,a=null,u=function(e){if(e&&(o=e),a){var t=a;a=null,t()}},c=function(){return new s((function(e,t){o?t(o):a=function(){o?t(o):e()}}))},t.on("drain",u),f=l(t,{readable:!1},u),E.label=1;case 1:return E.trys.push([1,19,20,21]),t.writableNeedDrain?[4,c()]:[3,3];case 2:E.sent(),E.label=3;case 3:h=!1,d=!1,E.label=4;case 4:E.trys.push([4,11,12,17]),g=(0,b.default)(e),E.label=5;case 5:return[4,g.next()];case 6:return(h=!(y=E.sent()).done)?(m=y.value,_=m,t.write(_)?[3,8]:[4,c()]):[3,10];case 7:E.sent(),E.label=8;case 8:E.label=9;case 9:return h=!1,[3,5];case 10:return[3,17];case 11:return w=E.sent(),d=!0,v=w,[3,17];case 12:return E.trys.push([12,,15,16]),h&&null!=g.return?[4,g.return()]:[3,14];case 13:E.sent(),E.label=14;case 14:return[3,16];case 15:if(d)throw v;return[7];case 16:return[7];case 17:return i&&t.end(),[4,c()];case 18:return E.sent(),r(),[3,21];case 19:return k=E.sent(),r(o!==k?p(o,k):k),[3,21];case 20:return f(),t.off("drain",u),[7];case 21:return[2]}}))})),H.apply(this,arguments)}function z(e,t,r,n){return K.apply(this,arguments)}function K(){return K=(0,m.default)((function(e,t,r,n){var i,o,a,s,u,l,c,f,h,d,p,v;return(0,V.__generator)(this,(function(g){switch(g.label){case 0:i=n.end,B(t)&&(t=t.writable),o=t.getWriter(),g.label=1;case 1:g.trys.push([1,18,,23]),a=!1,s=!1,g.label=2;case 2:g.trys.push([2,8,9,14]),l=(0,b.default)(e),g.label=3;case 3:return[4,l.next()];case 4:return(a=!(c=g.sent()).done)?(f=c.value,h=f,[4,o.ready]):[3,7];case 5:g.sent(),o.write(h).catch((function(){})),g.label=6;case 6:return a=!1,[3,3];case 7:return[3,14];case 8:return d=g.sent(),s=!0,u=d,[3,14];case 9:return g.trys.push([9,,12,13]),a&&null!=l.return?[4,l.return()]:[3,11];case 10:g.sent(),g.label=11;case 11:return[3,13];case 12:if(s)throw u;return[7];case 13:return[7];case 14:return[4,o.ready];case 15:return g.sent(),i?[4,o.close()]:[3,17];case 16:g.sent(),g.label=17;case 17:return r(),[3,23];case 18:p=g.sent(),g.label=19;case 19:return g.trys.push([19,21,,22]),[4,o.abort(p)];case 20:return g.sent(),r(p),[3,22];case 21:return v=g.sent(),r(v),[3,22];case 22:return[3,23];case 23:return[2]}}))})),K.apply(this,arguments)}function Y(e,t,n){var o=function(t){var o=e[t],a=t<e.length-1,s=t>0,l=a||!1!==(null==n?void 0:n.end),f=t===e.length-1;if(M(o)){var d=function(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&m(e)};if(l){var _=D(o,a,s),k=_.destroy,E=_.cleanup;y.push(k),O(o)&&f&&c.push(E)}o.on("error",d),O(o)&&f&&c.push((function(){o.removeListener("error",d)}))}if(0===t)if("function"==typeof o){if(v=o({signal:u}),!x(v))throw new w("Iterable, AsyncIterable or Stream","source",v)}else v=x(o)||P(o)||B(o)?o:h.from(o);else if("function"==typeof o){var S;if(v=B(v)?F(null===(S=v)||void 0===S?void 0:S.readable):F(v),v=o(v,{signal:u}),a){if(!x(v,!0))throw new w("AsyncIterable","transform[".concat(t-1,"]"),v)}else{var A;r||(r=Zn());var T=new r({objectMode:!0}),C=null===(A=v)||void 0===A?void 0:A.then;if("function"==typeof C)b++,C.call(v,(function(e){p=e,null!=e&&T.write(e),l&&T.end(),i.nextTick(m)}),(function(e){T.destroy(e),i.nextTick(m,e)}));else if(x(v,!0))b++,q(v,T,m,{end:l});else{if(!N(v)&&!B(v))throw new w("AsyncIterable or Promise","destination",v);var I=v.readable||v;b++,q(I,T,m,{end:l})}var R=D(v=T,!1,!0),U=R.destroy,j=R.cleanup;y.push(U),f&&c.push(j)}}else if(M(o)){if(P(v)){b+=2;var W=G(v,o,m,{end:l});O(o)&&f&&c.push(W)}else if(B(v)||N(v)){var H=v.readable||v;b++,q(H,o,m,{end:l})}else{if(!x(v))throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],v);b++,q(v,o,m,{end:l})}v=o}else if(L(o)){if(P(v))b++,z(F(v),o,m,{end:l});else if(N(v)||x(v))b++,z(v,o,m,{end:l});else{if(!B(v))throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],v);b++,z(v.readable,o,m,{end:l})}v=o}else v=h.from(o)};if(1===e.length&&a(e[0])&&(e=e[0]),e.length<2)throw new k("streams");var s=new j,u=s.signal,l=null==n?void 0:n.signal,c=[];function f(){_(new A)}I(l,"options.signal"),null==l||l.addEventListener("abort",f);var d,p,v,y=[],b=0;function m(e){_(e,0==--b)}function _(e,r){if(e&&(!d||"ERR_STREAM_PREMATURE_CLOSE"===d.code)&&(d=e),d||r){for(;y.length;)y.shift()(d);null==l||l.removeEventListener("abort",f),s.abort(),r&&(d||c.forEach((function(e){return e()})),i.nextTick(t,d,p))}}for(var E=0;E<e.length;E++)o(E);return(null!=u&&u.aborted||null!=l&&l.aborted)&&i.nextTick(f),v}function G(e,t,r,n){var o=n.end,a=!1;if(t.on("close",(function(){a||r(new S)})),e.pipe(t,{end:!1}),o){var s=function(){a=!0,t.end()};U(e)?i.nextTick(s):e.once("end",s)}else r();return l(e,{readable:!0,writable:!1},(function(t){var n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t)})),l(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:Y,pipeline:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Y(t,c(function(e){return C(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(t)))}}})),ti=X((function(e,t){zt(),Ot(),ee();var r=ei().pipeline,n=Xn(),i=tr().destroyer,o=Zt(),a=o.isNodeStream,s=o.isReadable,u=o.isWritable,l=o.isWebStream,c=o.isTransformStream,f=o.isWritableStream,h=o.isReadableStream,d=Jt(),p=d.AbortError,v=d.codes,g=v.ERR_INVALID_ARG_VALUE,y=v.ERR_MISSING_ARGS,b=er();t.exports=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(0===t.length)throw new y("streams");if(1===t.length)return n.from(t[0]);var d,v,_,w,k,E=(0,D.default)(t);if("function"==typeof t[0]&&(t[0]=n.from(t[0])),"function"==typeof t[t.length-1]){var S=t.length-1;t[S]=n.from(t[S])}for(var A=0;A<t.length;++A)if(a(t[A])||l(t[A])){if(A<t.length-1&&!(s(t[A])||h(t[A])||c(t[A])))throw new g("streams[".concat(A,"]"),E[A],"must be readable");if(A>0&&!(u(t[A])||f(t[A])||c(t[A])))throw new g("streams[".concat(A,"]"),E[A],"must be writable")}var T,C=t[0],I=r(t,(function(e){var t=w;w=null,t?t(e):e?k.destroy(e):!x&&!R&&k.destroy()})),R=!!(u(C)||f(C)||c(C)),x=!!(s(I)||h(I)||c(I));if(k=new n({writableObjectMode:!(null==C||!C.writableObjectMode),readableObjectMode:!(null==I||!I.writableObjectMode),writable:R,readable:x}),R){if(a(C))k._write=function(e,t,r){C.write(e,t)?r():d=r},k._final=function(e){C.end(),v=e},C.on("drain",(function(){if(d){var e=d;d=null,e()}}));else if(l(C)){var O=(c(C)?C.writable:C).getWriter();k._write=(T=(0,m.default)((function(e,t,r){var n;return(0,V.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,O.ready];case 1:return t.sent(),O.write(e).catch((function(){})),r(),[3,3];case 2:return n=t.sent(),r(n),[3,3];case 3:return[2]}}))})),function(e,t,r){return T.apply(this,arguments)}),k._final=function(){var e=(0,m.default)((function(e){var t;return(0,V.__generator)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,O.ready];case 1:return r.sent(),O.close().catch((function(){})),v=e,[3,3];case 2:return t=r.sent(),e(t),[3,3];case 3:return[2]}}))}));return function(t){return e.apply(this,arguments)}}()}var P=c(I)?I.readable:I;b(P,(function(){if(v){var e=v;v=null,e()}}))}if(x)if(a(I))I.on("readable",(function(){if(_){var e=_;_=null,e()}})),I.on("end",(function(){k.push(null)})),k._read=function(){for(;;){var e=I.read();if(null===e)return void(_=k._read);if(!k.push(e))return}};else if(l(I)){var M=(c(I)?I.readable:I).getReader();k._read=(0,m.default)((function(){var e,t,r;return(0,V.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,M.read()];case 1:return e=n.sent(),t=e.value,r=e.done,k.push(t)?r?[2,void k.push(null)]:[3,3]:[2];case 2:return n.sent(),[2];case 3:return[3,0];case 4:return[2]}}))}))}return k._destroy=function(e,t){!e&&null!==w&&(e=new p),_=null,d=null,v=null,null===w?t(e):(w=t,a(I)&&i(I,e))},k}})),ri=X((function(e,t){zt(),Ot(),ee();var r=globalThis.AbortController||Qt().AbortController,n=Jt(),i=n.codes,o=i.ERR_INVALID_ARG_VALUE,a=i.ERR_INVALID_ARG_TYPE,s=i.ERR_MISSING_ARGS,u=i.ERR_OUT_OF_RANGE,l=n.AbortError,c=Xt(),f=c.validateAbortSignal,h=c.validateInteger,d=c.validateObject,p=Yt().Symbol("kWeak"),v=er().finished,g=ti(),k=Ir().addAbortSignalNoValidate,E=Zt(),S=E.isWritable,A=E.isNodeStream,T=Yt(),C=T.ArrayPrototypePush,I=T.MathFloor,R=T.Number,x=T.NumberIsNaN,P=T.Promise,M=T.PromiseReject,L=T.PromisePrototypeThen,N=T.Symbol,j=N("kEmpty"),F=N("kEof");function q(e,t){if("function"!=typeof e)throw new a("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&f(t.signal,"options.signal");var n=1;return null!=(null==t?void 0:t.concurrency)&&(n=I(t.concurrency)),h(n,"concurrency",1),(0,W.default)((function(){var i,o,a,s,u,c,f,h,d,p,v,g;function y(){v=!0}return(0,V.__generator)(this,(function(w){switch(w.label){case 0:a=new r,s=this,u=[],c=a.signal,f={signal:c},h=function(){return a.abort()},null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted&&h(),null==t||null===(o=t.signal)||void 0===o||o.addEventListener("abort",h),v=!1,(0,m.default)((function(){var r,i,o,a,g,m,_,w,k,E,S,A;return(0,V.__generator)(this,(function(T){switch(T.label){case 0:T.trys.push([0,16,17,18]),r=!1,i=!1,T.label=1;case 1:T.trys.push([1,9,10,15]),a=(0,b.default)(s),T.label=2;case 2:return[4,a.next()];case 3:if(!(r=!(g=T.sent()).done))return[3,8];if(m=g.value,_=m,v)return[2];if(c.aborted)throw new l;try{_=e(_,f)}catch(e){_=M(e)}return _!==j?("function"==typeof(null===(w=_)||void 0===w?void 0:w.catch)&&_.catch(y),u.push(_),d&&(d(),d=null),!v&&u.length&&u.length>=n?[4,new P((function(e){p=e}))]:[3,5]):[3,6];case 4:T.sent(),T.label=5;case 5:T.label=6;case 6:T.label=7;case 7:return r=!1,[3,2];case 8:return[3,15];case 9:return k=T.sent(),i=!0,o=k,[3,15];case 10:return T.trys.push([10,,13,14]),r&&null!=a.return?[4,a.return()]:[3,12];case 11:T.sent(),T.label=12;case 12:return[3,14];case 13:if(i)throw o;return[7];case 14:return[7];case 15:return u.push(F),[3,18];case 16:return E=T.sent(),S=M(E),L(S,void 0,y),u.push(S),[3,18];case 17:return v=!0,d&&(d(),d=null),null==t||null===(A=t.signal)||void 0===A||A.removeEventListener("abort",h),[7];case 18:return[2]}}))}))(),w.label=1;case 1:return w.trys.push([1,,10,11]),u.length>0?[4,(0,_.default)(u[0])]:[3,6];case 2:if((g=w.sent())===F)return[2];if(c.aborted)throw new l;return g!==j?[4,g]:[3,4];case 3:w.sent(),w.label=4;case 4:u.shift(),p&&(p(),p=null),w.label=5;case 5:return[3,1];case 6:return[4,(0,_.default)(new P((function(e){d=e})))];case 7:w.sent(),w.label=8;case 8:return[3,1];case 9:return[3,11];case 10:return a.abort(),v=!0,p&&(p(),p=null),[7];case 11:return[2]}}))})).call(this)}function z(e,t){return K.apply(this,arguments)}function K(){return K=(0,m.default)((function(e,t){var r,n,i,o,a,s;return(0,V.__generator)(this,(function(u){switch(u.label){case 0:r=!1,n=!1,u.label=1;case 1:u.trys.push([1,6,7,12]),o=(0,b.default)(Y.call(this,e,t)),u.label=2;case 2:return[4,o.next()];case 3:return(r=!(a=u.sent()).done)?(a.value,[2,!0]):[3,5];case 4:return r=!1,[3,2];case 5:return[3,12];case 6:return s=u.sent(),n=!0,i=s,[3,12];case 7:return u.trys.push([7,,10,11]),r&&null!=o.return?[4,o.return()]:[3,9];case 8:u.sent(),u.label=9;case 9:return[3,11];case 10:if(n)throw i;return[7];case 11:return[7];case 12:return[2,!1]}}))})),K.apply(this,arguments)}function Y(e,t){if("function"!=typeof e)throw new a("fn",["Function","AsyncFunction"],e);return q.call(this,(r=(0,m.default)((function(t,r){return(0,V.__generator)(this,(function(n){switch(n.label){case 0:return[4,e(t,r)];case 1:return[2,n.sent()?t:j]}}))})),function(e,t){return r.apply(this,arguments)}),t);var r}var G=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e;return(0,w.default)(this,r),(e=t.call(this,"reduce")).message="Reduce of an empty stream requires an initial value",(0,U.default)(e)}return r}(s);function Q(e){if(e=R(e),x(e))return 0;if(e<0)throw new u("number",">= 0",e);return e}t.exports.streamReturningOperators={asIndexedPairs:function(e){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&f(e.signal,"options.signal"),(0,W.default)((function(){var t,r,n,i,o,a,s,u,c,f;return(0,V.__generator)(this,(function(h){switch(h.label){case 0:t=0,r=!1,n=!1,h.label=1;case 1:h.trys.push([1,7,8,13]),o=(0,b.default)(this),h.label=2;case 2:return[4,(0,_.default)(o.next())];case 3:if(!(r=!(a=h.sent()).done))return[3,6];if(s=a.value,u=s,null!=e&&null!==(c=e.signal)&&void 0!==c&&c.aborted)throw new l({cause:e.signal.reason});return[4,[t++,u]];case 4:h.sent(),h.label=5;case 5:return r=!1,[3,2];case 6:return[3,13];case 7:return f=h.sent(),n=!0,i=f,[3,13];case 8:return h.trys.push([8,,11,12]),r&&null!=o.return?[4,o.return()]:[3,10];case 9:h.sent(),h.label=10;case 10:return[3,12];case 11:if(n)throw i;return[7];case 12:return[7];case 13:return[2]}}))})).call(this)},drop:function(e,t){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&f(t.signal,"options.signal"),e=Q(e),(0,W.default)((function(){var r,n,i,o,a,s,u,c,f,h;return(0,V.__generator)(this,(function(d){switch(d.label){case 0:if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;n=!1,i=!1,d.label=1;case 1:d.trys.push([1,8,9,14]),a=(0,b.default)(this),d.label=2;case 2:return[4,(0,_.default)(a.next())];case 3:if(!(n=!(s=d.sent()).done))return[3,7];if(u=s.value,c=u,null!=t&&null!==(f=t.signal)&&void 0!==f&&f.aborted)throw new l;return e--<=0?[4,c]:[3,5];case 4:d.sent(),d.label=5;case 5:d.label=6;case 6:return n=!1,[3,2];case 7:return[3,14];case 8:return h=d.sent(),i=!0,o=h,[3,14];case 9:return d.trys.push([9,,12,13]),n&&null!=a.return?[4,a.return()]:[3,11];case 10:d.sent(),d.label=11;case 11:return[3,13];case 12:if(i)throw o;return[7];case 13:return[7];case 14:return[2]}}))})).call(this)},filter:Y,flatMap:function(e,t){var r=q.call(this,e,t);return(0,W.default)((function(){var e,t,n,i,o,a,s,u;return(0,V.__generator)(this,(function(l){switch(l.label){case 0:e=!1,t=!1,l.label=1;case 1:l.trys.push([1,7,8,13]),i=(0,b.default)(r),l.label=2;case 2:return[4,(0,_.default)(i.next())];case 3:return(e=!(o=l.sent()).done)?(a=o.value,s=a,[5,(0,V.__values)((0,y.default)((0,b.default)(s),_.default))]):[3,6];case 4:l.sent(),l.label=5;case 5:return e=!1,[3,2];case 6:return[3,13];case 7:return u=l.sent(),t=!0,n=u,[3,13];case 8:return l.trys.push([8,,11,12]),e&&null!=i.return?[4,i.return()]:[3,10];case 9:l.sent(),l.label=10;case 10:return[3,12];case 11:if(t)throw n;return[7];case 12:return[7];case 13:return[2]}}))}))()},map:q,take:function(e,t){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&f(t.signal,"options.signal"),e=Q(e),(0,W.default)((function(){var r,n,i,o,a,s,u,c,f,h;return(0,V.__generator)(this,(function(d){switch(d.label){case 0:if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;n=!1,i=!1,d.label=1;case 1:d.trys.push([1,7,8,13]),a=(0,b.default)(this),d.label=2;case 2:return[4,(0,_.default)(a.next())];case 3:if(!(n=!(s=d.sent()).done))return[3,6];if(u=s.value,c=u,null!=t&&null!==(f=t.signal)&&void 0!==f&&f.aborted)throw new l;return e-- >0?[4,c]:[2];case 4:d.sent(),d.label=5;case 5:return n=!1,[3,2];case 6:return[3,13];case 7:return h=d.sent(),i=!0,o=h,[3,13];case 8:return d.trys.push([8,,11,12]),n&&null!=a.return?[4,a.return()]:[3,10];case 9:d.sent(),d.label=10;case 10:return[3,12];case 11:if(i)throw o;return[7];case 12:return[7];case 13:return[2]}}))})).call(this)},compose:function(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&f(t.signal,"options.signal"),A(e)&&!S(e))throw new o("stream",e,"must be writable");var r=g(this,e);return null!=t&&t.signal&&k(t.signal,r),r}},t.exports.promiseReturningOperators={every:function(e,t){return(0,m.default)((function(){return(0,V.__generator)(this,(function(r){switch(r.label){case 0:if("function"!=typeof e)throw new a("fn",["Function","AsyncFunction"],e);return[4,z.call(this,(0,m.default)((function(){var t,r,n,i=arguments;return(0,V.__generator)(this,(function(o){switch(o.label){case 0:for(t=i.length,r=new Array(t),n=0;n<t;n++)r[n]=i[n];return[4,e.apply(void 0,(0,D.default)(r))];case 1:return[2,!o.sent()]}}))})),t)];case 1:return[2,!r.sent()]}}))})).apply(this)},forEach:function(e,t){return(0,m.default)((function(){var r,n,i,o,s,u;return(0,V.__generator)(this,(function(l){switch(l.label){case 0:if("function"!=typeof e)throw new a("fn",["Function","AsyncFunction"],e);r=!1,n=!1,l.label=1;case 1:l.trys.push([1,6,7,12]),o=(0,b.default)(q.call(this,(c=(0,m.default)((function(t,r){return(0,V.__generator)(this,(function(n){switch(n.label){case 0:return[4,e(t,r)];case 1:return[2,(n.sent(),j)]}}))})),function(e,t){return c.apply(this,arguments)}),t)),l.label=2;case 2:return[4,o.next()];case 3:if(!(r=!(s=l.sent()).done))return[3,5];s.value,l.label=4;case 4:return r=!1,[3,2];case 5:return[3,12];case 6:return u=l.sent(),n=!0,i=u,[3,12];case 7:return l.trys.push([7,,10,11]),r&&null!=o.return?[4,o.return()]:[3,9];case 8:l.sent(),l.label=9;case 9:return[3,11];case 10:if(n)throw i;return[7];case 11:return[7];case 12:return[2]}var c}))})).apply(this)},reduce:function(e,t,n){return(0,m.default)((function(){var i,o,s,u,c,h,g,y,m,_,w,k,E,S,A,T;return(0,V.__generator)(this,(function(C){switch(C.label){case 0:if("function"!=typeof e)throw new a("reducer",["Function","AsyncFunction"],e);return null!=n&&d(n,"options"),null!=(null==n?void 0:n.signal)&&f(n.signal,"options.signal"),o=arguments.length>1,null!=n&&null!==(i=n.signal)&&void 0!==i&&i.aborted?(s=new l(void 0,{cause:n.signal.reason}),this.once("error",(function(){})),[4,v(this.destroy(s))]):[3,2];case 1:throw C.sent(),s;case 2:u=new r,c=u.signal,null!=n&&n.signal&&(h=(0,O.default)({once:!0},p,this),n.signal.addEventListener("abort",(function(){return u.abort()}),h)),g=!1,C.label=3;case 3:C.trys.push([3,,19,20]),y=!1,m=!1,C.label=4;case 4:C.trys.push([4,12,13,18]),w=(0,b.default)(this),C.label=5;case 5:return[4,w.next()];case 6:if(!(y=!(k=C.sent()).done))return[3,11];if(E=k.value,S=E,g=!0,null!=n&&null!==(A=n.signal)&&void 0!==A&&A.aborted)throw new l;return o?[4,e(t,S,{signal:c})]:[3,8];case 7:return t=C.sent(),[3,9];case 8:t=S,o=!0,C.label=9;case 9:C.label=10;case 10:return y=!1,[3,5];case 11:return[3,18];case 12:return T=C.sent(),m=!0,_=T,[3,18];case 13:return C.trys.push([13,,16,17]),y&&null!=w.return?[4,w.return()]:[3,15];case 14:C.sent(),C.label=15;case 15:return[3,17];case 16:if(m)throw _;return[7];case 17:return[7];case 18:if(!g&&!o)throw new G;return[3,20];case 19:return u.abort(),[7];case 20:return[2,t]}}))})).apply(this)},toArray:function(e){return(0,m.default)((function(){var t,r,n,i,o,a,s,u,c,h;return(0,V.__generator)(this,(function(p){switch(p.label){case 0:null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&f(e.signal,"options.signal"),t=[],r=!1,n=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),o=(0,b.default)(this),p.label=2;case 2:return[4,o.next()];case 3:if(!(r=!(a=p.sent()).done))return[3,5];if(s=a.value,u=s,null!=e&&null!==(c=e.signal)&&void 0!==c&&c.aborted)throw new l(void 0,{cause:e.signal.reason});C(t,u),p.label=4;case 4:return r=!1,[3,2];case 5:return[3,12];case 6:return h=p.sent(),n=!0,i=h,[3,12];case 7:return p.trys.push([7,,10,11]),r&&null!=o.return?[4,o.return()]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(n)throw i;return[7];case 11:return[7];case 12:return[2,t]}}))})).apply(this)},some:z,find:function(e,t){return(0,m.default)((function(){var r,n,i,o,a,s;return(0,V.__generator)(this,(function(u){switch(u.label){case 0:r=!1,n=!1,u.label=1;case 1:u.trys.push([1,6,7,12]),o=(0,b.default)(Y.call(this,e,t)),u.label=2;case 2:return[4,o.next()];case 3:return(r=!(a=u.sent()).done)?[2,a.value]:[3,5];case 4:return r=!1,[3,2];case 5:return[3,12];case 6:return s=u.sent(),n=!0,i=s,[3,12];case 7:return u.trys.push([7,,10,11]),r&&null!=o.return?[4,o.return()]:[3,9];case 8:u.sent(),u.label=9;case 9:return[3,11];case 10:if(n)throw i;return[7];case 11:return[7];case 12:return[2]}}))})).apply(this)}}})),ni=X((function(e,t){zt(),Ot(),ee();var r=Yt(),n=r.ArrayPrototypePop,i=r.Promise,o=Zt(),a=o.isIterable,s=o.isNodeStream,u=o.isWebStream,l=ei().pipelineImpl,c=er().finished;ii(),t.exports={finished:c,pipeline:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return new i((function(e,r){var i,o,c=t[t.length-1];if(c&&"object"==typeof c&&!s(c)&&!a(c)&&!u(c)){var f=n(t);i=f.signal,o=f.end}l(t,(function(t,n){t?r(t):e(n)}),{signal:i,end:o})}))}}})),ii=X((function(e,t){zt(),Ot(),ee();var r=(Vt(),Z(Pt)).Buffer,n=Yt(),i=n.ObjectDefineProperty,o=n.ObjectKeys,a=n.ReflectApply,s=Gt().promisify.custom,u=ri(),l=u.streamReturningOperators,c=u.promiseReturningOperators,f=Jt().codes.ERR_ILLEGAL_CONSTRUCTOR,h=ti(),d=ei().pipeline,p=tr().destroyer,v=er(),g=ni(),y=Zt(),b=t.exports=Cr().Stream;b.isDisturbed=y.isDisturbed,b.isErrored=y.isErrored,b.isReadable=y.isReadable,b.Readable=Gn();var m=!0,_=!1,w=void 0;try{for(var k,E=function(){var e=k.value,t=function e(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(this instanceof e?this.constructor:void 0)throw f();return b.Readable.from(a(r,this,n))},r=l[e];i(t,"name",{__proto__:null,value:r.name}),i(t,"length",{__proto__:null,value:r.length}),i(b.Readable.prototype,e,{__proto__:null,value:t,enumerable:!1,configurable:!0,writable:!0})},S=o(l)[Symbol.iterator]();!(m=(k=S.next()).done);m=!0)E()}catch(e){_=!0,w=e}finally{try{m||null==S.return||S.return()}finally{if(_)throw w}}var A=!0,T=!1,C=void 0;try{for(var I,R=function(){var e=I.value,t=function e(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(this instanceof e?this.constructor:void 0)throw f();return a(r,this,n)},r=c[e];i(t,"name",{__proto__:null,value:r.name}),i(t,"length",{__proto__:null,value:r.length}),i(b.Readable.prototype,e,{__proto__:null,value:t,enumerable:!1,configurable:!0,writable:!0})},x=o(c)[Symbol.iterator]();!(A=(I=x.next()).done);A=!0)R()}catch(e){T=!0,C=e}finally{try{A||null==x.return||x.return()}finally{if(T)throw C}}b.Writable=Qn(),b.Duplex=Xn(),b.Transform=$n(),b.PassThrough=Zn(),b.pipeline=d;var O=Ir().addAbortSignal;b.addAbortSignal=O,b.finished=v,b.destroy=p,b.compose=h,i(b,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:function(){return g}}),i(d,s,{__proto__:null,enumerable:!0,get:function(){return g.pipeline}}),i(v,s,{__proto__:null,enumerable:!0,get:function(){return g.finished}}),b.Stream=b,b._isUint8Array=function(e){return e instanceof Uint8Array},b._uint8ArrayToBuffer=function(e){return r.from(e.buffer,e.byteOffset,e.byteLength)}})),oi=X((function(e,t){zt(),Ot(),ee();var r=ii(),n=ni(),i=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=i,t.exports.pipeline=r.pipeline,t.exports.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get:function(){return n}}),t.exports.Stream=r.Stream,t.exports.default=t.exports})),ai=X((function(e,t){zt(),Ot(),ee(),t.exports="function"==typeof Object.create?function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),si=X((function(e,t){zt(),Ot(),ee();var r=(Vt(),Z(Pt)).Buffer,n=Symbol.for("BufferList");function i(e){if(!(this instanceof i))return new i(e);i._init.call(this,e)}i._init=function(e){Object.defineProperty(this,n,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},i.prototype._new=function(e){return new i(e)},i.prototype._offset=function(e){if(0===e)return[0,0];for(var t=0,r=0;r<this._bufs.length;r++){var n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},i.prototype._reverseOffset=function(e){for(var t=e[0],r=e[1],n=0;n<t;n++)r+=this._bufs[n].length;return r},i.prototype.get=function(e){if(!(e>this.length||e<0)){var t=this._offset(e);return this._bufs[t[0]][t[1]]}},i.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)},i.prototype.copy=function(e,t,n,i){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof i||i>this.length)&&(i=this.length),n>=this.length||i<=0)return e||r.alloc(0);var o=!!e,a=this._offset(n),s=i-n,u=s,l=o&&t||0,c=a[1];if(0===n&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:r.concat(this._bufs,this.length);for(var f=0;f<this._bufs.length;f++)this._bufs[f].copy(e,l),l+=this._bufs[f].length;return e}if(u<=this._bufs[a[0]].length-c)return o?this._bufs[a[0]].copy(e,t,c,c+u):this._bufs[a[0]].slice(c,c+u);o||(e=r.allocUnsafe(s));for(var h=a[0];h<this._bufs.length;h++){var d=this._bufs[h].length-c;if(!(u>d)){this._bufs[h].copy(e,l,c,c+u),l+=d;break}this._bufs[h].copy(e,l,c),l+=d,u-=d,c&&(c=0)}return e.length>l?e.slice(0,l):e},i.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();var r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},i.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},i.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},i.prototype.duplicate=function(){for(var e=this._new(),t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},i.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(var t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(var n=0;n<e._bufs.length;n++)this.append(e._bufs[n]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(r.from(e));return this},i.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},i.prototype.indexOf=function(e,t,n){if(void 0===n&&"string"==typeof t&&(n=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,n):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;for(var i=this._offset(t),o=i[0],a=i[1];o<this._bufs.length;o++){for(var s=this._bufs[o];a<s.length;)if(s.length-a>=e.length){var u=s.indexOf(e,a);if(-1!==u)return this._reverseOffset([o,u]);a=s.length-e.length+1}else{var l=this._reverseOffset([o,a]);if(this._match(l,e))return l;a++}a=0}return-1},i.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(var r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){var 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(var t in e)!function(t){i.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.slice(r,r+e[t])[t](0)}}(t)}(),i.prototype._isBufferList=function(e){return e instanceof i||i.isBufferList(e)},i.isBufferList=function(e){return null!=e&&e[n]},t.exports=i})),ui=X((function(e,t){zt(),Ot(),ee();var r=oi().Duplex,n=ai(),i=si();function o(e){if(!(this instanceof o))return new o(e);if("function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)})),e=null}i._init.call(this,e),r.call(this)}n(o,r),Object.assign(o.prototype,i.prototype),o.prototype._new=function(e){return 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=function(e){return e instanceof o||e instanceof i||o.isBufferList(e)},o.isBufferList=i.isBufferList,t.exports=o,t.exports.BufferListStream=o,t.exports.BufferList=i})),li=X((function(e,t){zt(),Ot(),ee(),t.exports=function e(){"use strict";(0,w.default)(this,e),this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}})),ci=X((function(e,t){zt(),Ot(),ee();var r=t.exports,n=(Vt(),Z(Pt)).Buffer;for(var i in 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={},r.requiredHeaderFlags){var o=r.requiredHeaderFlags[i];r.requiredHeaderFlagsErrors[i]="Invalid header flag bits, must be 0x"+o.toString(16)+" for "+r.types[i]+" packet"}for(var a in r.codes={},r.types){var s=r.types[a];r.codes[s]=a}for(var u in r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=n.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=n.from([r.codes.connack<<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=n.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={},r.properties){var l=r.properties[u];r.propertiesCodes[l]=u}function c(e){return[0,1,2].map((function(t){return[0,1].map((function(i){return[0,1].map((function(o){var a=n.alloc(1);return a.writeUInt8(r.codes[e]<<r.CMD_SHIFT|(i?r.DUP_MASK:0)|t<<r.QOS_SHIFT|o,0,!0),a}))}))}))}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=c("publish"),r.SUBSCRIBE_HEADER=c("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=c("unsubscribe"),r.ACKS={unsuback:c("unsuback"),puback:c("puback"),pubcomp:c("pubcomp"),pubrel:c("pubrel"),pubrec:c("pubrec")},r.SUBACK_HEADER=n.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=n.from([3]),r.VERSION4=n.from([4]),r.VERSION5=n.from([5]),r.VERSION131=n.from([131]),r.VERSION132=n.from([132]),r.QOS=[0,1,2].map((function(e){return n.from([e])})),r.EMPTY={pingreq:n.from([r.codes.pingreq<<4,0]),pingresp:n.from([r.codes.pingresp<<4,0]),disconnect:n.from([r.codes.disconnect<<4,0])},r.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"},r.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},r.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},r.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"},r.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},r.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}})),fi=X((function(e,t){zt(),Ot(),ee();var r=1e3,n=6e4,i=60*n,o=24*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var s=void 0===e?"undefined":(0,F.default)(e);if("string"===s&&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 a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===s&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=o?a(e,t,o,"day"):t>=i?a(e,t,i,"hour"):t>=n?a(e,t,n,"minute"):t>=r?a(e,t,r,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=n?Math.round(e/n)+"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))}})),hi=X((function(e,t){zt(),Ot(),ee(),t.exports=function(e){function t(e){var n,i,o,a=null;function s(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];if(s.enabled){var o=s,a=Number(new Date),u=a-(n||a);o.diff=u,o.prev=n,o.curr=a,n=a,r[0]=t.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var l=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(e,n){if("%%"===e)return"%";l++;var i=t.formatters[n];if("function"==typeof i){var a=r[l];e=i.call(o,a),r.splice(l,1),l--}return e})),t.formatArgs.call(o,r),(o.log||t.log).apply(o,r)}}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:function(){return null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o)},set:function(e){a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,r){var n=t(this.namespace+((void 0===r?"undefined":(0,F.default)(r))>"u"?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){var e=(0,D.default)(t.names.map(n)).concat((0,D.default)(t.skips.map(n).map((function(e){return"-"+e})))).join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];var r,n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(RegExp("^"+e.slice(1)+"$")):t.names.push(RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=fi(),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((function(r){t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}})),di=X((function(e,t){var r;zt(),Ot(),ee(),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){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(i=n))})),e.splice(i,0,r)}},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){var t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&(void 0===te?"undefined":(0,F.default)(te))<"u"&&"env"in te&&(t=te.env.DEBUG),t},e.useColors=function(){return!(!(("undefined"==typeof window?"undefined":(0,F.default)(window))<"u"&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!((void 0===v?"undefined":(0,F.default)(v))<"u"&&v.userAgent&&v.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(("undefined"==typeof document?"undefined":(0,F.default)(document))<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||("undefined"==typeof window?"undefined":(0,F.default)(window))<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||(void 0===v?"undefined":(0,F.default)(v))<"u"&&v.userAgent&&v.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||(void 0===v?"undefined":(0,F.default)(v))<"u"&&v.userAgent&&v.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},e.storage=function(){try{return localStorage}catch(e){}}(),e.destroy=(r=!1,function(){r||(r=!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||function(){},t.exports=hi()(e),t.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),pi=X((function(e,t){zt(),Ot(),ee();var r=ui(),n=(Tr(),Z(mr)).EventEmitter,i=li(),o=ci(),a=di()("mqtt-packet:parser");t.exports=function(e){"use strict";(0,B.default)(n,e);var t=(0,H.default)(n);function n(){var e;return(0,w.default)(this,n),(e=t.call(this)).parser=e.constructor.parser,(0,U.default)(e)}return(0,x.default)(n,[{key:"_resetState",value:function(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new i,this.error=null,this._list=r(),this._stateCounter=0}},{key:"parse",value:function(e){for(this.error&&this._resetState(),this._list.append(e),a("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++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}},{key:"_parseHeader",value:function(){var e=this._list.readUInt8(0),t=e>>o.CMD_SHIFT;this.packet.cmd=o.types[t];var r=15&e,n=o.requiredHeaderFlags[t];return null!=n&&r!==n?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),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}},{key:"_parseLength",value:function(){var e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),a("_parseLength %d",e.value),!!e}},{key:"_parsePayload",value:function(){a("_parsePayload: payload %O",this._list);var 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 a("_parsePayload complete result: %s",e),e}},{key:"_parseConnect",value:function(){a("_parseConnect");var e,t,r,n,i={},s=this.packet,u=this._parseString();if(null===u)return this._emitError(Error("Cannot parse protocolId"));if("MQTT"!==u&&"MQIsdp"!==u)return this._emitError(Error("Invalid protocolId"));if(s.protocolId=u,this._pos>=this._list.length)return this._emitError(Error("Packet too short"));if(s.protocolVersion=this._list.readUInt8(this._pos),s.protocolVersion>=128&&(s.bridgeMode=!0,s.protocolVersion=s.protocolVersion-128),3!==s.protocolVersion&&4!==s.protocolVersion&&5!==s.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"));i.username=this._list.readUInt8(this._pos)&o.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&o.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&o.WILL_FLAG_MASK;var l=!!(this._list.readUInt8(this._pos)&o.WILL_RETAIN_MASK),c=(this._list.readUInt8(this._pos)&o.WILL_QOS_MASK)>>o.WILL_QOS_SHIFT;if(i.will)s.will={},s.will.retain=l,s.will.qos=c;else{if(l)return this._emitError(Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(c)return this._emitError(Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(s.clean=!!(this._list.readUInt8(this._pos)&o.CLEAN_SESSION_MASK),this._pos++,s.keepalive=this._parseNum(),-1===s.keepalive)return this._emitError(Error("Packet too short"));if(5===s.protocolVersion){var f=this._parseProperties();Object.getOwnPropertyNames(f).length&&(s.properties=f)}var h=this._parseString();if(null===h)return this._emitError(Error("Packet too short"));if(s.clientId=h,a("_parseConnect: packet.clientId: %s",s.clientId),i.will){if(5===s.protocolVersion){var d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.will.properties=d)}if(null===(e=this._parseString()))return this._emitError(Error("Cannot parse will topic"));if(s.will.topic=e,a("_parseConnect: packet.will.topic: %s",s.will.topic),null===(t=this._parseBuffer()))return this._emitError(Error("Cannot parse will payload"));s.will.payload=t,a("_parseConnect: packet.will.paylaod: %s",s.will.payload)}if(i.username){if(null===(n=this._parseString()))return this._emitError(Error("Cannot parse username"));s.username=n,a("_parseConnect: packet.username: %s",s.username)}if(i.password){if(null===(r=this._parseBuffer()))return this._emitError(Error("Cannot parse password"));s.password=r}return this.settings=s,a("_parseConnect: complete"),s}},{key:"_parseConnack",value:function(){a("_parseConnack");var e=this.packet;if(this._list.length<1)return null;var 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){var r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}a("_parseConnack: complete")}},{key:"_parsePublish",value:function(){a("_parsePublish");var 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){var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),a("_parsePublish: payload from buffer list: %o",e.payload)}}},{key:"_parseSubscribe",value:function(){a("_parseSubscribe");var e,t,r,n,i,s,u,l=this.packet;if(l.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){var c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(l.properties=c)}if(l.length<=0)return this._emitError(Error("Malformed subscribe, no payload specified"));for(;this._pos<l.length;){if(null===(e=this._parseString()))return this._emitError(Error("Cannot parse topic"));if(this._pos>=l.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)>2)return this._emitError(Error("Invalid subscribe QoS, must be <= 2"));if(s=!!(t>>o.SUBSCRIBE_OPTIONS_NL_SHIFT&o.SUBSCRIBE_OPTIONS_NL_MASK),i=!!(t>>o.SUBSCRIBE_OPTIONS_RAP_SHIFT&o.SUBSCRIBE_OPTIONS_RAP_MASK),(n=t>>o.SUBSCRIBE_OPTIONS_RH_SHIFT&o.SUBSCRIBE_OPTIONS_RH_MASK)>2)return this._emitError(Error("Invalid retain handling, must be <= 2"));u={topic:e,qos:r},5===this.settings.protocolVersion?(u.nl=s,u.rap=i,u.rh=n):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",u),l.subscriptions.push(u)}}}},{key:"_parseSuback",value:function(){a("_parseSuback");var e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){var 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;){var r=this._list.readUInt8(this._pos++);if(5===this.settings.protocolVersion){if(!o.MQTT5_SUBACK_CODES[r])return this._emitError(Error("Invalid suback code"))}else if(r>2&&128!==r)return this._emitError(Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(r)}}}},{key:"_parseUnsubscribe",value:function(){a("_parseUnsubscribe");var e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){var 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;){var r=this._parseString();if(null===r)return this._emitError(Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",r),e.unsubscriptions.push(r)}}}},{key:"_parseUnsuback",value:function(){a("_parseUnsuback");var 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){var t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;){var r=this._list.readUInt8(this._pos++);if(!o.MQTT5_UNSUBACK_CODES[r])return this._emitError(Error("Invalid unsuback code"));this.packet.granted.push(r)}}}},{key:"_parseConfirmation",value:function(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);var 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"))}a("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)}else e.reasonCode=0;if(e.length>3){var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}}return!0}},{key:"_parseDisconnect",value:function(){var e=this.packet;if(a("_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;var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return a("_parseDisconnect result: true"),!0}},{key:"_parseAuth",value:function(){a("_parseAuth");var 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"));var t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),a("_parseAuth: result: true"),!0}},{key:"_parseMessageId",value:function(){var e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",e.messageId),!0)}},{key:"_parseString",value:function(e){var t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;var n=this._list.toString("utf8",this._pos,r);return this._pos+=t,a("_parseString: result: %s",n),n}},{key:"_parseStringPair",value:function(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}},{key:"_parseBuffer",value:function(){var e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;var r=this._list.slice(this._pos,t);return this._pos+=e,a("_parseBuffer: result: %o",r),r}},{key:"_parseNum",value:function(){if(this._list.length-this._pos<2)return-1;var e=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",e),e}},{key:"_parse4ByteNum",value:function(){if(this._list.length-this._pos<4)return-1;var e=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",e),e}},{key:"_parseVarByteNum",value:function(e){a("_parseVarByteNum");for(var t,r=0,n=1,i=0,s=!1,u=this._pos?this._pos:0;r<4&&u+r<this._list.length;){if(i+=n*((t=this._list.readUInt8(u+r++))&o.VARBYTEINT_MASK),n*=128,!(t&o.VARBYTEINT_FIN_MASK)){s=!0;break}if(this._list.length<=r)break}return!s&&4===r&&this._list.length>=r&&this._emitError(Error("Invalid variable byte integer")),u&&(this._pos+=r),a("_parseVarByteNum: result: %o",s=!!s&&(e?{bytes:r,value:i}:i)),s}},{key:"_parseByte",value:function(){var e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",e),e}},{key:"_parseByType",value:function(e){switch(a("_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()}}},{key:"_parseProperties",value:function(){a("_parseProperties");for(var e=this._parseVarByteNum(),t=this._pos+e,r={};this._pos<t;){var n=this._parseByte();if(!n)return this._emitError(Error("Cannot parse property code type")),!1;var i=o.propertiesCodes[n];if(!i)return this._emitError(Error("Unknown property")),!1;if("userProperties"!==i)r[i]?(Array.isArray(r[i])||(r[i]=[r[i]]),r[i].push(this._parseByType(o.propertiesTypes[i]))):r[i]=this._parseByType(o.propertiesTypes[i]);else{r[i]||(r[i]=Object.create(null));var s=this._parseByType(o.propertiesTypes[i]);if(r[i][s.name])if(Array.isArray(r[i][s.name]))r[i][s.name].push(s.value);else{var u=r[i][s.name];r[i][s.name]=[u],r[i][s.name].push(s.value)}else r[i][s.name]=s.value}}return r}},{key:"_newPacket",value:function(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_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)),a("_newPacket: new packet"),this.packet=new i,this._pos=0,!0}},{key:"_emitError",value:function(e){a("_emitError",e),this.error=e,this.emit("error",e)}}],[{key:"parser",value:function(e){return this instanceof n?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new n).parser(e)}}]),n}(n)})),vi=X((function(e,t){zt(),Ot(),ee();var r=(Vt(),Z(Pt)).Buffer,n={},i=r.isBuffer(r.from([1,2]).subarray(0,1));function o(e){var t=r.allocUnsafe(2);return t.writeUInt8(e>>8,0),t.writeUInt8(255&e,1),t}t.exports={cache:n,generateCache:function(){for(var e=0;e<65536;e++)n[e]=o(e)},generateNumber:o,genBufVariableByteInt:function(e){var t=0,n=0,o=r.allocUnsafe(4);do{t=e%128|0,(e=e/128|0)>0&&(t|=128),o.writeUInt8(t,n++)}while(e>0&&n<4);return e>0&&(n=0),i?o.subarray(0,n):o.slice(0,n)},generate4ByteBuffer:function(e){var t=r.allocUnsafe(4);return t.writeUInt32BE(e,0),t}}})),gi=X((function(e,t){zt(),Ot(),ee(),(void 0===te?"undefined":(0,F.default)(te))>"u"||!te.version||0===te.version.indexOf("v0.")||0===te.version.indexOf("v1.")&&0!==te.version.indexOf("v1.8.")?t.exports={nextTick:function(e,t,r,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,o,a=arguments.length;switch(a){case 0:case 1:return te.nextTick(e);case 2:return te.nextTick((function(){e.call(null,t)}));case 3:return te.nextTick((function(){e.call(null,t,r)}));case 4:return te.nextTick((function(){e.call(null,t,r,n)}));default:for(i=Array(a-1),o=0;o<i.length;)i[o++]=arguments[o];return te.nextTick((function(){e.apply(null,i)}))}}}:t.exports=te})),yi=X((function(e,t){zt(),Ot(),ee();var r=ci(),n=(Vt(),Z(Pt)).Buffer,i=n.allocUnsafe(0),o=n.from([0]),a=vi(),s=gi().nextTick,u=di()("mqtt-packet:writeToStream"),l=a.cache,c=a.generateNumber,f=a.generateCache,h=a.genBufVariableByteInt,d=a.generate4ByteBuffer,p=k,v=!0;function g(e,t,a){switch(u("generate called"),t.cork&&(t.cork(),s(y,t)),v&&(v=!1,f()),u("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return function(e,t){var i=e||{},o=i.protocolId||"MQTT",a=i.protocolVersion||4,s=i.will,u=i.clean,l=i.keepalive||0,c=i.clientId||"",f=i.username,h=i.password,d=i.properties;void 0===u&&(u=!0);var v,g,y=0;if(!o||"string"!=typeof o&&!n.isBuffer(o))return t.destroy(Error("Invalid protocolId")),!1;if(y+=o.length+2,3!==a&&4!==a&&5!==a)return t.destroy(Error("Invalid protocol version")),!1;if(y+=1,("string"==typeof c||n.isBuffer(c))&&(c||a>=4)&&(c||u))y+=n.byteLength(c)+2;else{if(a<4)return t.destroy(Error("clientId must be supplied before 3.1.1")),!1;if(1*u==0)return t.destroy(Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof l||l<0||l>65535||l%1!=0)return t.destroy(Error("Invalid keepalive")),!1;if(y+=2,y+=1,5===a){if(!(v=A(t,d)))return!1;y+=v.length}if(s){if("object"!=typeof s)return t.destroy(Error("Invalid will")),!1;if(!s.topic||"string"!=typeof s.topic)return t.destroy(Error("Invalid will topic")),!1;if(y+=n.byteLength(s.topic)+2,y+=2,s.payload){if(!(s.payload.length>=0))return t.destroy(Error("Invalid will payload")),!1;"string"==typeof s.payload?y+=n.byteLength(s.payload):y+=s.payload.length}if(g={},5===a){if(!(g=A(t,s.properties)))return!1;y+=g.length}}var b=!1;if(null!=f){if(!x(f))return t.destroy(Error("Invalid username")),!1;b=!0,y+=n.byteLength(f)+2}if(null!=h){if(!b)return t.destroy(Error("Username is required to use password")),!1;if(!x(h))return t.destroy(Error("Invalid password")),!1;y+=R(h)+2}t.write(r.CONNECT_HEADER),m(t,y),S(t,o),i.bridgeMode&&(a+=128),t.write(131===a?r.VERSION131:132===a?r.VERSION132:4===a?r.VERSION4:5===a?r.VERSION5:r.VERSION3);var w=0;return w|=null!=f?r.USERNAME_MASK:0,w|=null!=h?r.PASSWORD_MASK:0,w|=s&&s.retain?r.WILL_RETAIN_MASK:0,w|=s&&s.qos?s.qos<<r.WILL_QOS_SHIFT:0,w|=s?r.WILL_FLAG_MASK:0,w|=u?r.CLEAN_SESSION_MASK:0,t.write(n.from([w])),p(t,l),5===a&&v.write(),S(t,c),s&&(5===a&&g.write(),_(t,s.topic),S(t,s.payload)),null!=f&&S(t,f),null!=h&&S(t,h),!0}(e,t);case"connack":return function(e,t,i){var a=i?i.protocolVersion:4,s=e||{},u=5===a?s.reasonCode:s.returnCode,l=s.properties,c=2;if("number"!=typeof u)return t.destroy(Error("Invalid return code")),!1;var f=null;if(5===a){if(!(f=A(t,l)))return!1;c+=f.length}return t.write(r.CONNACK_HEADER),m(t,c),t.write(s.sessionPresent?r.SESSIONPRESENT_HEADER:o),t.write(n.from([u])),null==f||f.write(),!0}(e,t,a);case"publish":return function(e,t,o){u("publish: packet: %o",e);var a=o?o.protocolVersion:4,s=e||{},l=s.qos||0,c=s.retain?r.RETAIN_MASK:0,f=s.topic,h=s.payload||i,d=s.messageId,v=s.properties,g=0;if("string"==typeof f)g+=n.byteLength(f)+2;else{if(!n.isBuffer(f))return t.destroy(Error("Invalid topic")),!1;g+=f.length+2}if(n.isBuffer(h)?g+=h.length:g+=n.byteLength(h),l&&"number"!=typeof d)return t.destroy(Error("Invalid messageId")),!1;l&&(g+=2);var y=null;if(5===a){if(!(y=A(t,v)))return!1;g+=y.length}return t.write(r.PUBLISH_HEADER[l][s.dup?1:0][c?1:0]),m(t,g),p(t,R(f)),t.write(f),l>0&&p(t,d),null==y||y.write(),u("publish: payload: %o",h),t.write(h)}(e,t,a);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(e,t,i){var o=i?i.protocolVersion:4,a=e||{},s=a.cmd||"puback",u=a.messageId,l=a.dup&&"pubrel"===s?r.DUP_MASK:0,c=0,f=a.reasonCode,h=a.properties,d=5===o?3:2;if("pubrel"===s&&(c=1),"number"!=typeof u)return t.destroy(Error("Invalid messageId")),!1;var v=null;if(5===o&&"object"==typeof h){if(!(v=T(t,h,i,d)))return!1;d+=v.length}return t.write(r.ACKS[s][c][l][0]),3===d&&(d+=0!==f?1:-1),m(t,d),p(t,u),5===o&&2!==d&&t.write(n.from([f])),null!==v?v.write():4===d&&t.write(n.from([0])),!0}(e,t,a);case"subscribe":return function(e,t,i){u("subscribe: packet: ");var o=i?i.protocolVersion:4,a=e||{},s=a.dup?r.DUP_MASK:0,l=a.messageId,c=a.subscriptions,f=a.properties,h=0;if("number"!=typeof l)return t.destroy(Error("Invalid messageId")),!1;h+=2;var d=null;if(5===o){if(!(d=A(t,f)))return!1;h+=d.length}if("object"!=typeof c||!c.length)return t.destroy(Error("Invalid subscriptions")),!1;for(var v=0;v<c.length;v+=1){var g=c[v].topic,y=c[v].qos;if("string"!=typeof g)return t.destroy(Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof y)return t.destroy(Error("Invalid subscriptions - invalid qos")),!1;if(5===o){if("boolean"!=typeof(c[v].nl||!1))return t.destroy(Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(c[v].rap||!1))return t.destroy(Error("Invalid subscriptions - invalid Retain as Published")),!1;var b=c[v].rh||0;if("number"!=typeof b||b>2)return t.destroy(Error("Invalid subscriptions - invalid Retain Handling")),!1}h+=n.byteLength(g)+2+1}u("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),t.write(r.SUBSCRIBE_HEADER[1][s?1:0][0]),m(t,h),p(t,l),null!==d&&d.write();var w=!0,k=!0,E=!1,S=void 0;try{for(var T,C=c[Symbol.iterator]();!(k=(T=C.next()).done);k=!0){var I=T.value,R=void 0,x=I.topic,O=I.qos,P=+I.nl,M=+I.rap,B=I.rh;_(t,x),R=r.SUBSCRIBE_OPTIONS_QOS[O],5===o&&(R|=P?r.SUBSCRIBE_OPTIONS_NL:0,R|=M?r.SUBSCRIBE_OPTIONS_RAP:0,R|=B?r.SUBSCRIBE_OPTIONS_RH[B]:0),w=t.write(n.from([R]))}}catch(e){E=!0,S=e}finally{try{k||null==C.return||C.return()}finally{if(E)throw S}}return w}(e,t,a);case"suback":return function(e,t,i){var o=i?i.protocolVersion:4,a=e||{},s=a.messageId,u=a.granted,l=a.properties,c=0;if("number"!=typeof s)return t.destroy(Error("Invalid messageId")),!1;if(c+=2,"object"!=typeof u||!u.length)return t.destroy(Error("Invalid qos vector")),!1;for(var f=0;f<u.length;f+=1){if("number"!=typeof u[f])return t.destroy(Error("Invalid qos vector")),!1;c+=1}var h=null;if(5===o){if(!(h=T(t,l,i,c)))return!1;c+=h.length}return t.write(r.SUBACK_HEADER),m(t,c),p(t,s),null!==h&&h.write(),t.write(n.from(u))}(e,t,a);case"unsubscribe":return function(e,t,i){var o=i?i.protocolVersion:4,a=e||{},s=a.messageId,u=a.dup?r.DUP_MASK:0,l=a.unsubscriptions,c=a.properties,f=0;if("number"!=typeof s)return t.destroy(Error("Invalid messageId")),!1;if(f+=2,"object"!=typeof l||!l.length)return t.destroy(Error("Invalid unsubscriptions")),!1;for(var h=0;h<l.length;h+=1){if("string"!=typeof l[h])return t.destroy(Error("Invalid unsubscriptions")),!1;f+=n.byteLength(l[h])+2}var d=null;if(5===o){if(!(d=A(t,c)))return!1;f+=d.length}t.write(r.UNSUBSCRIBE_HEADER[1][u?1:0][0]),m(t,f),p(t,s),null!==d&&d.write();for(var v=!0,g=0;g<l.length;g++)v=_(t,l[g]);return v}(e,t,a);case"unsuback":return function(e,t,i){var o=i?i.protocolVersion:4,a=e||{},s=a.messageId,u=a.dup?r.DUP_MASK:0,l=a.granted,c=a.properties,f=a.cmd,h=2;if("number"!=typeof s)return t.destroy(Error("Invalid messageId")),!1;if(5===o){if("object"!=typeof l||!l.length)return t.destroy(Error("Invalid qos vector")),!1;for(var d=0;d<l.length;d+=1){if("number"!=typeof l[d])return t.destroy(Error("Invalid qos vector")),!1;h+=1}}var v=null;if(5===o){if(!(v=T(t,c,i,h)))return!1;h+=v.length}return t.write(r.ACKS[f][0][u][0]),m(t,h),p(t,s),null!==v&&v.write(),5===o&&t.write(n.from(l)),!0}(e,t,a);case"pingreq":case"pingresp":return function(e,t){return t.write(r.EMPTY[e.cmd])}(e,t);case"disconnect":return function(e,t,i){var o=i?i.protocolVersion:4,a=e||{},s=a.reasonCode,u=a.properties,l=5===o?1:0,c=null;if(5===o){if(!(c=T(t,u,i,l)))return!1;l+=c.length}return t.write(n.from([r.codes.disconnect<<4])),m(t,l),5===o&&t.write(n.from([s])),null!==c&&c.write(),!0}(e,t,a);case"auth":return function(e,t,i){var o=i?i.protocolVersion:4,a=e||{},s=a.reasonCode,u=a.properties,l=5===o?1:0;5!==o&&t.destroy(Error("Invalid mqtt version for auth packet"));var c=T(t,u,i,l);return!!c&&(l+=c.length,t.write(n.from([r.codes.auth<<4])),m(t,l),t.write(n.from([s])),null!==c&&c.write(),!0)}(e,t,a);default:return t.destroy(Error("Unknown command")),!1}}function y(e){e.uncork()}Object.defineProperty(g,"cacheNumbers",{get:function(){return p===k},set:function(e){e?((!l||0===Object.keys(l).length)&&(v=!0),p=k):(v=!1,p=E)}});var b={};function m(e,t){if(t>r.VARBYTEINT_MAX)return e.destroy(Error("Invalid variable byte integer: "+t)),!1;var n=b[t];return n||(n=h(t),t<16384&&(b[t]=n)),u("writeVarByteInt: writing to stream: %o",n),e.write(n)}function _(e,t){var r=n.byteLength(t);return p(e,r),u("writeString: %s",t),e.write(t,"utf8")}function w(e,t,r){_(e,t),_(e,r)}function k(e,t){return u("writeNumberCached: number: %d",t),u("writeNumberCached: %o",l[t]),e.write(l[t])}function E(e,t){var r=c(t);return u("writeNumberGenerated: %o",r),e.write(r)}function S(e,t){"string"==typeof t?_(e,t):t?(p(e,t.length),e.write(t)):p(e,0)}function A(e,t){if("object"!=typeof t||null!=t.length)return{length:1,write:function(){I(e,{},0)}};var i=0;function o(t,i){var o=0;switch(r.propertiesTypes[t]){case"byte":if("boolean"!=typeof i)return e.destroy(Error("Invalid ".concat(t,": ").concat(i))),!1;o+=2;break;case"int8":if("number"!=typeof i||i<0||i>255)return e.destroy(Error("Invalid ".concat(t,": ").concat(i))),!1;o+=2;break;case"binary":if(i&&null===i)return e.destroy(Error("Invalid ".concat(t,": ").concat(i))),!1;o+=1+n.byteLength(i)+2;break;case"int16":if("number"!=typeof i||i<0||i>65535)return e.destroy(Error("Invalid ".concat(t,": ").concat(i))),!1;o+=3;break;case"int32":if("number"!=typeof i||i<0||i>4294967295)return e.destroy(Error("Invalid ".concat(t,": ").concat(i))),!1;o+=5;break;case"var":if("number"!=typeof i||i<0||i>268435455)return e.destroy(Error("Invalid ".concat(t,": ").concat(i))),!1;o+=1+n.byteLength(h(i));break;case"string":if("string"!=typeof i)return e.destroy(Error("Invalid ".concat(t,": ").concat(i))),!1;o+=3+n.byteLength(i.toString());break;case"pair":if("object"!=typeof i)return e.destroy(Error("Invalid ".concat(t,": ").concat(i))),!1;o+=Object.getOwnPropertyNames(i).reduce((function(e,t){var r=i[t];return e+(Array.isArray(r)?r.reduce((function(e,r){return e+(3+n.byteLength(t.toString())+2+n.byteLength(r.toString()))}),0):3+n.byteLength(t.toString())+2+n.byteLength(i[t].toString()))}),0);break;default:return e.destroy(Error("Invalid property ".concat(t,": ").concat(i))),!1}return o}if(t)for(var a in t){var s=0,u=0,l=t[a];if(Array.isArray(l))for(var c=0;c<l.length;c++){if(!(u=o(a,l[c])))return!1;s+=u}else{if(!(u=o(a,l)))return!1;s=u}if(!s)return!1;i+=s}return{length:n.byteLength(h(i))+i,write:function(){I(e,t,i)}}}function T(e,t,r,n){var i=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0,a=A(e,t);if(o)for(;n+a.length>o;){var s=i.shift();if(!s||!t[s])return!1;delete t[s],a=A(e,t)}return a}function C(e,t,i){switch(r.propertiesTypes[t]){case"byte":e.write(n.from([r.properties[t]])),e.write(n.from([+i]));break;case"int8":e.write(n.from([r.properties[t]])),e.write(n.from([i]));break;case"binary":e.write(n.from([r.properties[t]])),S(e,i);break;case"int16":e.write(n.from([r.properties[t]])),p(e,i);break;case"int32":e.write(n.from([r.properties[t]])),function(e,t){var r=d(t);u("write4ByteNumber: %o",r),e.write(r)}(e,i);break;case"var":e.write(n.from([r.properties[t]])),m(e,i);break;case"string":e.write(n.from([r.properties[t]])),_(e,i);break;case"pair":Object.getOwnPropertyNames(i).forEach((function(o){var a=i[o];Array.isArray(a)?a.forEach((function(i){e.write(n.from([r.properties[t]])),w(e,o.toString(),i.toString())})):(e.write(n.from([r.properties[t]])),w(e,o.toString(),a.toString()))}));break;default:return e.destroy(Error("Invalid property ".concat(t," value: ").concat(i))),!1}}function I(e,t,r){for(var n in m(e,r),t)if({}.hasOwnProperty.call(t,n)&&null!==t[n]){var i=t[n];if(Array.isArray(i))for(var o=0;o<i.length;o++)C(e,n,i[o]);else C(e,n,i)}}function R(e){return e?e instanceof n?e.length:n.byteLength(e):0}function x(e){return"string"==typeof e||e instanceof n}t.exports=g})),bi=X((function(e,t){zt(),Ot(),ee();var r=yi(),n=(Tr(),Z(mr)).EventEmitter,i=(Vt(),Z(Pt)).Buffer,o=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e;return(0,w.default)(this,r),(e=t.call(this))._array=Array(20),e._i=0,(0,U.default)(e)}return(0,x.default)(r,[{key:"write",value:function(e){return this._array[this._i++]=e,!0}},{key:"concat",value:function(){var e,t=0,r=Array(this._array.length),n=this._array,o=0;for(e=0;e<n.length&&void 0!==n[e];e++)"string"!=typeof n[e]?r[e]=n[e].length:r[e]=i.byteLength(n[e]),t+=r[e];var a=i.allocUnsafe(t);for(e=0;e<n.length&&void 0!==n[e];e++)"string"!=typeof n[e]?(n[e].copy(a,o),o+=r[e]):(a.write(n[e],o),o+=r[e]);return a}},{key:"destroy",value:function(e){e&&this.emit("error",e)}}]),r}(n);t.exports=function(e,t){var n=new o;return r(e,n,t),n.concat()}})),mi=X((function(e){zt(),Ot(),ee(),e.parser=pi().parser,e.generate=bi(),e.writeToStream=yi()})),_i=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){"use strict";function e(){(0,w.default)(this,e),this.nextId=Math.max(1,Math.floor(65535*Math.random()))}return(0,x.default)(e,[{key:"allocate",value:function(){var e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e}},{key:"getLastAllocated",value:function(){return 1===this.nextId?65535:this.nextId-1}},{key:"register",value:function(e){return!0}},{key:"deallocate",value:function(e){}},{key:"clear",value:function(){}}]),e}()})),wi=X((function(e,t){function r(e){return e instanceof Wt?Wt.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}zt(),Ot(),ee(),t.exports=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return i(o,e);if(o instanceof Map)return new Map(i(Array.from(o),e));if(o instanceof Set)return new Set(i(Array.from(o),e));var a={};for(var s in t.push(o),n.push(a),o){var u=o[s];if("object"!=typeof u||null===u)a[s]=u;else if(u instanceof Date)a[s]=new Date(u);else if(u instanceof Map)a[s]=new Map(i(Array.from(u),e));else if(u instanceof Set)a[s]=new Set(i(Array.from(u),e));else if(ArrayBuffer.isView(u))a[s]=r(u);else{var l=t.indexOf(u);a[s]=-1!==l?n[l]:e(u)}}return t.pop(),n.pop(),a}:function e(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return i(o,e);if(o instanceof Map)return new Map(i(Array.from(o),e));if(o instanceof Set)return new Set(i(Array.from(o),e));var a={};for(var s in t.push(o),n.push(a),o)if(!1!==Object.hasOwnProperty.call(o,s)){var u=o[s];if("object"!=typeof u||null===u)a[s]=u;else if(u instanceof Date)a[s]=new Date(u);else if(u instanceof Map)a[s]=new Map(i(Array.from(u),e));else if(u instanceof Set)a[s]=new Set(i(Array.from(u),e));else if(ArrayBuffer.isView(u))a[s]=r(u);else{var l=t.indexOf(u);a[s]=-1!==l?n[l]:e(u)}}return t.pop(),n.pop(),a};function i(e,i){for(var o=Object.keys(e),a=Array(o.length),s=0;s<o.length;s++){var u=o[s],l=e[u];if("object"!=typeof l||null===l)a[u]=l;else if(l instanceof Date)a[u]=new Date(l);else if(ArrayBuffer.isView(l))a[u]=r(l);else{var c=t.indexOf(l);a[u]=-1!==c?n[c]:i(l)}}return a}}(e):e.proto?function e(n){if("object"!=typeof n||null===n)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return t(n,e);if(n instanceof Map)return new Map(t(Array.from(n),e));if(n instanceof Set)return new Set(t(Array.from(n),e));var i={};for(var o in n){var a=n[o];"object"!=typeof a||null===a?i[o]=a:a instanceof Date?i[o]=new Date(a):a instanceof Map?i[o]=new Map(t(Array.from(a),e)):a instanceof Set?i[o]=new Set(t(Array.from(a),e)):ArrayBuffer.isView(a)?i[o]=r(a):i[o]=e(a)}return i}:function e(n){if("object"!=typeof n||null===n)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return t(n,e);if(n instanceof Map)return new Map(t(Array.from(n),e));if(n instanceof Set)return new Set(t(Array.from(n),e));var i={};for(var o in n)if(!1!==Object.hasOwnProperty.call(n,o)){var a=n[o];"object"!=typeof a||null===a?i[o]=a:a instanceof Date?i[o]=new Date(a):a instanceof Map?i[o]=new Map(t(Array.from(a),e)):a instanceof Set?i[o]=new Set(t(Array.from(a),e)):ArrayBuffer.isView(a)?i[o]=r(a):i[o]=e(a)}return i};function t(e,t){for(var n=Object.keys(e),i=Array(n.length),o=0;o<n.length;o++){var a=n[o],s=e[a];"object"!=typeof s||null===s?i[a]=s:s instanceof Date?i[a]=new Date(s):ArrayBuffer.isView(s)?i[a]=r(s):i[a]=t(s)}return i}}})),ki=X((function(e,t){zt(),Ot(),ee(),t.exports=wi()()})),Ei=X((function(e){function t(e){for(var t=e.split("/"),r=0;r<t.length;r++)if("+"!==t[r]){if("#"===t[r])return r===t.length-1;if(-1!==t[r].indexOf("+")||-1!==t[r].indexOf("#"))return!1}return!0}zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.validateTopics=e.validateTopic=void 0,e.validateTopic=t,e.validateTopics=function(e){if(0===e.length)return"empty_topic_list";for(var r=0;r<e.length;r++)if(!t(e[r]))return e[r];return null}})),Si=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0});var t=oi(),r={objectMode:!0},n={clean:!0};e.default=function(){"use strict";function e(t){(0,w.default)(this,e),this.options=t||{},this.options=Object.assign(Object.assign({},n),t),this._inflights=new Map}return(0,x.default)(e,[{key:"put",value:function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this}},{key:"createStream",value:function(){var e=new t.Readable(r),n=[],i=!1,o=0;return this._inflights.forEach((function(e){n.push(e)})),e._read=function(){!i&&o<n.length?e.push(n[o++]):e.push(null)},e.destroy=function(){if(!i)return i=!0,setTimeout((function(){e.emit("close")}),0),e},e}},{key:"del",value:function(e,t){var r=this._inflights.get(e.messageId);return r?(this._inflights.delete(e.messageId),t(null,r)):t&&t(Error("missing packet")),this}},{key:"get",value:function(e,t){var r=this._inflights.get(e.messageId);return r?t(null,r):t&&t(Error("missing packet")),this}},{key:"close",value:function(e){this.options.clean&&(this._inflights=null),e&&e()}}]),e}()})),Ai=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0});var t=[0,16,128,131,135,144,145,151,153];e.default=function(e,r,n){e.log("handlePublish: packet %o",r),n=(void 0===n?"undefined":(0,F.default)(n))<"u"?n:e.noop;var i,o=r.topic.toString(),a=r.payload,s=r.qos,u=r.messageId,l=e.options;if(5===e.options.protocolVersion&&(r.properties&&(i=r.properties.topicAlias),(void 0===i?"undefined":(0,F.default)(i))<"u"))if(0===o.length){if(!(i>0&&i<=65535))return e.log("handlePublish :: topic alias out of range. alias: %d",i),void e.emit("error",Error("Received Topic Alias is out of range"));var c=e.topicAliasRecv.getTopicByAlias(i);if(!c)return e.log("handlePublish :: unregistered topic alias. alias: %d",i),void e.emit("error",Error("Received unregistered Topic Alias"));o=c,e.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",o,i)}else{if(!e.topicAliasRecv.put(o,i))return e.log("handlePublish :: topic alias out of range. alias: %d",i),void e.emit("error",Error("Received Topic Alias is out of range"));e.log("handlePublish :: registered topic: %s - alias: %d",o,i)}switch(e.log("handlePublish: qos %d",s),s){case 2:l.customHandleAcks(o,a,r,(function(i,o){return"number"==typeof i&&(o=i,i=null),i?e.emit("error",i):-1===t.indexOf(o)?e.emit("error",Error("Wrong reason code for pubrec")):void(o?e._sendPacket({cmd:"pubrec",messageId:u,reasonCode:o},n):e.incomingStore.put(r,(function(){e._sendPacket({cmd:"pubrec",messageId:u},n)})))}));break;case 1:l.customHandleAcks(o,a,r,(function(i,s){return"number"==typeof i&&(s=i,i=null),i?e.emit("error",i):-1===t.indexOf(s)?e.emit("error",Error("Wrong reason code for puback")):(s||e.emit("message",o,a,r),void e.handleMessage(r,(function(t){if(t)return n&&n(t);e._sendPacket({cmd:"puback",messageId:u,reasonCode:s},n)})))}));break;case 0:e.emit("message",o,a,r),e.handleMessage(r,n);break;default:e.log("handlePublish: unknown QoS. Doing nothing.")}}})),Ti=X((function(e,t){t.exports={version:"5.8.0"}})),Ci=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.MQTTJS_VERSION=e.nextTick=e.applyMixin=e.ErrorWithReasonCode=void 0,e.ErrorWithReasonCode=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n){var i;return(0,w.default)(this,r),(i=t.call(this,e)).code=n,Object.setPrototypeOf((0,g.default)(i),r.prototype),Object.getPrototypeOf(i).name="ErrorWithReasonCode",(0,U.default)(i)}return r}((0,q.default)(Error)),e.applyMixin=function(e,t){for(var r,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[t];;){var o=i[0],a=Object.getPrototypeOf(o);if(!(null==a?void 0:a.prototype))break;i.unshift(a)}var s=!0,u=!1,l=void 0,c=!0,f=!1,h=void 0;try{for(var d,p=i[Symbol.iterator]();!(c=(d=p.next()).done);c=!0){var v=d.value;try{for(var g,y=Object.getOwnPropertyNames(v.prototype)[Symbol.iterator]();!(s=(g=y.next()).done);s=!0){var b=g.value;(n||"constructor"!==b)&&Object.defineProperty(e.prototype,b,null!==(r=Object.getOwnPropertyDescriptor(v.prototype,b))&&void 0!==r?r:Object.create(null))}}catch(e){u=!0,l=e}finally{try{s||null==y.return||y.return()}finally{if(u)throw l}}}}catch(e){f=!0,h=e}finally{try{c||null==p.return||p.return()}finally{if(f)throw h}}},e.nextTick="function"==typeof(null==te?void 0:te.nextTick)?te.nextTick:function(e){setTimeout(e,0)},e.MQTTJS_VERSION=Ti().version})),Ii=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.ReasonCodes=void 0,e.ReasonCodes={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},e.default=function(t,r){var n=r.messageId,i=r.cmd,o=null,a=t.outgoing[n]?t.outgoing[n].cb:null,s=null;if(a){switch(t.log("_handleAck :: packet type",i),i){case"pubcomp":case"puback":var u=r.reasonCode;u&&u>0&&16!==u?((s=Error("Publish error: "+e.ReasonCodes[u])).code=u,t._removeOutgoingAndStoreMessage(n,(function(){a(s,r)}))):t._removeOutgoingAndStoreMessage(n,a);break;case"pubrec":o={cmd:"pubrel",qos:2,messageId:n};var l=r.reasonCode;l&&l>0&&16!==l?((s=Error("Publish error: "+e.ReasonCodes[l])).code=l,t._removeOutgoingAndStoreMessage(n,(function(){a(s,r)}))):t._sendPacket(o);break;case"suback":delete t.outgoing[n],t.messageIdProvider.deallocate(n);for(var c=r.granted,f=0;f<c.length;f++){var h=c[f];if(128&h){(s=Error("Subscribe error: "+e.ReasonCodes[h])).code=h;var d=t.messageIdToTopic[n];d&&d.forEach((function(e){delete t._resubscribeTopics[e]}))}}delete t.messageIdToTopic[n],t._invokeStoreProcessingQueue(),a(s,r);break;case"unsuback":delete t.outgoing[n],t.messageIdProvider.deallocate(n),t._invokeStoreProcessingQueue(),a(null);break;default:t.emit("error",Error("unrecognized packet type"))}t.disconnecting&&0===Object.keys(t.outgoing).length&&t.emit("outgoingEmpty")}else t.log("_handleAck :: Server sent an ack in error. Ignoring.")}})),Ri=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0});var t=Ci(),r=Ii();e.default=function(e,n){var i=e.options.protocolVersion,o=5===i?n.reasonCode:n.returnCode;if(5===i)e.handleAuth(n,(function(n,i){if(n)e.emit("error",n);else if(24===o)e.reconnecting=!1,e._sendPacket(i);else{var a=new t.ErrorWithReasonCode("Connection refused: "+r.ReasonCodes[o],o);e.emit("error",a)}}));else{var a=new t.ErrorWithReasonCode("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+i,o);e.emit("error",a)}}})),xi=X((function(e){var t,r,n,i,o,a,s,u,l,c,f,h,d,p,v,g,y,b,_,P,M,W,z,K,Y,G,Q,J,X,$,Z,re,ne,ie,oe,ae,se,ue,le,ce,fe,he,de;zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=void 0;var pe="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,ve=new Set,ge="object"==typeof te&&te?te:{},ye=function(e,t,r,n){"function"==typeof ge.emitWarning?ge.emitWarning(e,t,r,n):console.error("[".concat(r,"] ").concat(t,": ").concat(e))},be=globalThis.AbortController,me=globalThis.AbortSignal;if((void 0===be?"undefined":(0,F.default)(be))>"u"){var _e;me=function(){"use strict";function e(){(0,w.default)(this,e),(0,O.default)(this,"onabort",void 0),(0,O.default)(this,"_onabort",[]),(0,O.default)(this,"reason",void 0),(0,O.default)(this,"aborted",!1)}return(0,x.default)(e,[{key:"addEventListener",value:function(e,t){this._onabort.push(t)}}]),e}(),be=function(){"use strict";function e(){(0,w.default)(this,e),(0,O.default)(this,"signal",new me),ke()}return(0,x.default)(e,[{key:"abort",value:function(e){if(!this.signal.aborted){var t,r;this.signal.reason=e,this.signal.aborted=!0;var n=!0,i=!1,o=void 0;try{for(var a,s=this.signal._onabort[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)(0,a.value)(e)}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}null===(r=(t=this.signal).onabort)||void 0===r||r.call(t,e)}}}]),e}();var we="1"!==(null===(_e=ge.env)||void 0===_e?void 0:_e.LRU_CACHE_IGNORE_AC_WARNING),ke=function(){we&&(we=!1,ye("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",ke))}}var Ee=function(e){return e&&e===Math.floor(e)&&e>0&&isFinite(e)},Se=function(e){return Ee(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=4294967296?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Ae:null:null},Ae=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e){var n;return(0,w.default)(this,r),(n=t.call(this,e)).fill(0),(0,U.default)(n)}return r}((0,q.default)(Array)),Te=(r=function(){"use strict";function e(t,i){if((0,w.default)(this,e),(0,O.default)(this,"heap",void 0),(0,O.default)(this,"length",void 0),!(0,I.default)(e,r,n))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0}return(0,x.default)(e,[{key:"push",value:function(e){this.heap[this.length++]=e}},{key:"pop",value:function(){return this.heap[--this.length]}}],[{key:"create",value:function(t){var i=Se(t);if(!i)return[];(0,R.default)(e,r,n,!0);var o=new e(t,i);return(0,R.default)(e,r,n,!1),o}}]),e}(),n={writable:!0,value:!1},r),Ce=(i=new WeakMap,o=new WeakMap,a=new WeakMap,s=new WeakMap,u=new WeakMap,l=new WeakMap,c=new WeakMap,f=new WeakMap,h=new WeakMap,d=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakMap,y=new WeakMap,b=new WeakMap,_=new WeakMap,P=new WeakMap,M=new WeakMap,W=new WeakMap,z=new WeakMap,K=new WeakMap,Y=new WeakMap,G=new WeakSet,Q=new WeakMap,J=new WeakMap,X=new WeakMap,$=new WeakMap,Z=new WeakSet,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakSet,ae=new WeakSet,se=new WeakSet,ue=new WeakSet,le=new WeakSet,ce=new WeakSet,fe=new WeakSet,he=new WeakSet,t=Symbol.iterator,de=function(){"use strict";function e(t){(0,w.default)(this,e),(0,C.default)(this,G),(0,C.default)(this,Z),(0,C.default)(this,oe),(0,C.default)(this,ae),(0,C.default)(this,se),(0,C.default)(this,ue),(0,C.default)(this,le),(0,C.default)(this,ce),(0,C.default)(this,fe),(0,C.default)(this,he),(0,E.default)(this,i,{writable:!0,value:void 0}),(0,E.default)(this,o,{writable:!0,value:void 0}),(0,E.default)(this,a,{writable:!0,value:void 0}),(0,E.default)(this,s,{writable:!0,value:void 0}),(0,E.default)(this,u,{writable:!0,value:void 0}),(0,O.default)(this,"ttl",void 0),(0,O.default)(this,"ttlResolution",void 0),(0,O.default)(this,"ttlAutopurge",void 0),(0,O.default)(this,"updateAgeOnGet",void 0),(0,O.default)(this,"updateAgeOnHas",void 0),(0,O.default)(this,"allowStale",void 0),(0,O.default)(this,"noDisposeOnSet",void 0),(0,O.default)(this,"noUpdateTTL",void 0),(0,O.default)(this,"maxEntrySize",void 0),(0,O.default)(this,"sizeCalculation",void 0),(0,O.default)(this,"noDeleteOnFetchRejection",void 0),(0,O.default)(this,"noDeleteOnStaleGet",void 0),(0,O.default)(this,"allowStaleOnFetchAbort",void 0),(0,O.default)(this,"allowStaleOnFetchRejection",void 0),(0,O.default)(this,"ignoreFetchAbort",void 0),(0,E.default)(this,l,{writable:!0,value:void 0}),(0,E.default)(this,c,{writable:!0,value:void 0}),(0,E.default)(this,f,{writable:!0,value:void 0}),(0,E.default)(this,h,{writable:!0,value:void 0}),(0,E.default)(this,d,{writable:!0,value:void 0}),(0,E.default)(this,p,{writable:!0,value:void 0}),(0,E.default)(this,v,{writable:!0,value:void 0}),(0,E.default)(this,g,{writable:!0,value:void 0}),(0,E.default)(this,y,{writable:!0,value:void 0}),(0,E.default)(this,b,{writable:!0,value:void 0}),(0,E.default)(this,_,{writable:!0,value:void 0}),(0,E.default)(this,P,{writable:!0,value:void 0}),(0,E.default)(this,M,{writable:!0,value:void 0}),(0,E.default)(this,W,{writable:!0,value:void 0}),(0,E.default)(this,z,{writable:!0,value:void 0}),(0,E.default)(this,K,{writable:!0,value:void 0}),(0,E.default)(this,Y,{writable:!0,value:void 0}),(0,E.default)(this,Q,{writable:!0,value:function(){}}),(0,E.default)(this,J,{writable:!0,value:function(){}}),(0,E.default)(this,X,{writable:!0,value:function(){}}),(0,E.default)(this,$,{writable:!0,value:function(){return!1}}),(0,E.default)(this,re,{writable:!0,value:function(){}}),(0,E.default)(this,ne,{writable:!0,value:function(){}}),(0,E.default)(this,ie,{writable:!0,value:function(e,t,r,n){if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}});var r=t.max,n=void 0===r?0:r,m=t.ttl,A=t.ttlResolution,I=void 0===A?1:A,R=t.ttlAutopurge,x=t.updateAgeOnGet,B=t.updateAgeOnHas,L=t.allowStale,N=t.dispose,U=t.disposeAfter,j=t.noDisposeOnSet,D=t.noUpdateTTL,F=t.maxSize,q=void 0===F?0:F,H=t.maxEntrySize,V=void 0===H?0:H,ee=t.sizeCalculation,te=t.fetchMethod,de=t.noDeleteOnFetchRejection,pe=t.noDeleteOnStaleGet,ge=t.allowStaleOnFetchRejection,be=t.allowStaleOnFetchAbort,me=t.ignoreFetchAbort;if(0!==n&&!Ee(n))throw new TypeError("max option must be a nonnegative integer");var _e=n?Se(n):Array;if(!_e)throw Error("invalid max value: "+n);if((0,S.default)(this,i,n),(0,S.default)(this,o,q),this.maxEntrySize=V||(0,k.default)(this,o),this.sizeCalculation=ee,this.sizeCalculation){if(!(0,k.default)(this,o)&&!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!==te&&"function"!=typeof te)throw new TypeError("fetchMethod must be a function if specified");if((0,S.default)(this,u,te),(0,S.default)(this,K,!!te),(0,S.default)(this,f,new Map),(0,S.default)(this,h,Array(n).fill(void 0)),(0,S.default)(this,d,Array(n).fill(void 0)),(0,S.default)(this,p,new _e(n)),(0,S.default)(this,v,new _e(n)),(0,S.default)(this,g,0),(0,S.default)(this,y,0),(0,S.default)(this,b,Te.create(n)),(0,S.default)(this,l,0),(0,S.default)(this,c,0),"function"==typeof N&&(0,S.default)(this,a,N),"function"==typeof U?((0,S.default)(this,s,U),(0,S.default)(this,_,[])):((0,S.default)(this,s,void 0),(0,S.default)(this,_,void 0)),(0,S.default)(this,z,!!(0,k.default)(this,a)),(0,S.default)(this,Y,!!(0,k.default)(this,s)),this.noDisposeOnSet=!!j,this.noUpdateTTL=!!D,this.noDeleteOnFetchRejection=!!de,this.allowStaleOnFetchRejection=!!ge,this.allowStaleOnFetchAbort=!!be,this.ignoreFetchAbort=!!me,0!==this.maxEntrySize){if(0!==(0,k.default)(this,o)&&!Ee((0,k.default)(this,o)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ee(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");(0,T.default)(this,Z,Re).call(this)}if(this.allowStale=!!L,this.noDeleteOnStaleGet=!!pe,this.updateAgeOnGet=!!x,this.updateAgeOnHas=!!B,this.ttlResolution=Ee(I)||0===I?I:1,this.ttlAutopurge=!!R,this.ttl=m||0,this.ttl){if(!Ee(this.ttl))throw new TypeError("ttl must be a positive integer if specified");(0,T.default)(this,G,Ie).call(this)}if(0===(0,k.default)(this,i)&&0===this.ttl&&0===(0,k.default)(this,o))throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!(0,k.default)(this,i)&&!(0,k.default)(this,o)){var we="LRU_CACHE_UNBOUNDED";(function(e){return!ve.has(e)})(we)&&(ve.add(we),ye("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",we,e))}}return(0,x.default)(e,[{key:"max",get:function(){return(0,k.default)(this,i)}},{key:"maxSize",get:function(){return(0,k.default)(this,o)}},{key:"calculatedSize",get:function(){return(0,k.default)(this,c)}},{key:"size",get:function(){return(0,k.default)(this,l)}},{key:"fetchMethod",get:function(){return(0,k.default)(this,u)}},{key:"dispose",get:function(){return(0,k.default)(this,a)}},{key:"disposeAfter",get:function(){return(0,k.default)(this,s)}},{key:"getRemainingTTL",value:function(e){return(0,k.default)(this,f).has(e)?1/0:0}},{key:"entries",value:function(){var e,t,r,n,i,o,a;return(0,V.__generator)(this,(function(s){switch(s.label){case 0:e=!0,t=!1,r=void 0,s.label=1;case 1:s.trys.push([1,7,8,9]),n=(0,T.default)(this,oe,xe).call(this)[Symbol.iterator](),s.label=2;case 2:return(e=(i=n.next()).done)?[3,6]:(o=i.value,void 0===(0,k.default)(this,d)[o]||void 0===(0,k.default)(this,h)[o]||(0,T.default)(this,ce,Le).call(this,(0,k.default)(this,d)[o])?[3,4]:[4,[(0,k.default)(this,h)[o],(0,k.default)(this,d)[o]]]);case 3:s.sent(),s.label=4;case 4:s.label=5;case 5:return e=!0,[3,2];case 6:return[3,9];case 7:return a=s.sent(),t=!0,r=a,[3,9];case 8:try{e||null==n.return||n.return()}finally{if(t)throw r}return[7];case 9:return[2]}}))}},{key:"rentries",value:function(){var e,t,r,n,i,o,a;return(0,V.__generator)(this,(function(s){switch(s.label){case 0:e=!0,t=!1,r=void 0,s.label=1;case 1:s.trys.push([1,7,8,9]),n=(0,T.default)(this,ae,Oe).call(this)[Symbol.iterator](),s.label=2;case 2:return(e=(i=n.next()).done)?[3,6]:(o=i.value,void 0===(0,k.default)(this,d)[o]||void 0===(0,k.default)(this,h)[o]||(0,T.default)(this,ce,Le).call(this,(0,k.default)(this,d)[o])?[3,4]:[4,[(0,k.default)(this,h)[o],(0,k.default)(this,d)[o]]]);case 3:s.sent(),s.label=4;case 4:s.label=5;case 5:return e=!0,[3,2];case 6:return[3,9];case 7:return a=s.sent(),t=!0,r=a,[3,9];case 8:try{e||null==n.return||n.return()}finally{if(t)throw r}return[7];case 9:return[2]}}))}},{key:"keys",value:function(){var e,t,r,n,i,o,a,s;return(0,V.__generator)(this,(function(u){switch(u.label){case 0:e=!0,t=!1,r=void 0,u.label=1;case 1:u.trys.push([1,7,8,9]),n=(0,T.default)(this,oe,xe).call(this)[Symbol.iterator](),u.label=2;case 2:return(e=(i=n.next()).done)?[3,6]:(o=i.value,void 0===(a=(0,k.default)(this,h)[o])||(0,T.default)(this,ce,Le).call(this,(0,k.default)(this,d)[o])?[3,4]:[4,a]);case 3:u.sent(),u.label=4;case 4:u.label=5;case 5:return e=!0,[3,2];case 6:return[3,9];case 7:return s=u.sent(),t=!0,r=s,[3,9];case 8:try{e||null==n.return||n.return()}finally{if(t)throw r}return[7];case 9:return[2]}}))}},{key:"rkeys",value:function(){var e,t,r,n,i,o,a,s;return(0,V.__generator)(this,(function(u){switch(u.label){case 0:e=!0,t=!1,r=void 0,u.label=1;case 1:u.trys.push([1,7,8,9]),n=(0,T.default)(this,ae,Oe).call(this)[Symbol.iterator](),u.label=2;case 2:return(e=(i=n.next()).done)?[3,6]:(o=i.value,void 0===(a=(0,k.default)(this,h)[o])||(0,T.default)(this,ce,Le).call(this,(0,k.default)(this,d)[o])?[3,4]:[4,a]);case 3:u.sent(),u.label=4;case 4:u.label=5;case 5:return e=!0,[3,2];case 6:return[3,9];case 7:return s=u.sent(),t=!0,r=s,[3,9];case 8:try{e||null==n.return||n.return()}finally{if(t)throw r}return[7];case 9:return[2]}}))}},{key:"values",value:function(){var e,t,r,n,i,o,a;return(0,V.__generator)(this,(function(s){switch(s.label){case 0:e=!0,t=!1,r=void 0,s.label=1;case 1:s.trys.push([1,7,8,9]),n=(0,T.default)(this,oe,xe).call(this)[Symbol.iterator](),s.label=2;case 2:return(e=(i=n.next()).done)?[3,6]:(o=i.value,void 0===(0,k.default)(this,d)[o]||(0,T.default)(this,ce,Le).call(this,(0,k.default)(this,d)[o])?[3,4]:[4,(0,k.default)(this,d)[o]]);case 3:s.sent(),s.label=4;case 4:s.label=5;case 5:return e=!0,[3,2];case 6:return[3,9];case 7:return a=s.sent(),t=!0,r=a,[3,9];case 8:try{e||null==n.return||n.return()}finally{if(t)throw r}return[7];case 9:return[2]}}))}},{key:"rvalues",value:function(){var e,t,r,n,i,o,a;return(0,V.__generator)(this,(function(s){switch(s.label){case 0:e=!0,t=!1,r=void 0,s.label=1;case 1:s.trys.push([1,7,8,9]),n=(0,T.default)(this,ae,Oe).call(this)[Symbol.iterator](),s.label=2;case 2:return(e=(i=n.next()).done)?[3,6]:(o=i.value,void 0===(0,k.default)(this,d)[o]||(0,T.default)(this,ce,Le).call(this,(0,k.default)(this,d)[o])?[3,4]:[4,(0,k.default)(this,d)[o]]);case 3:s.sent(),s.label=4;case 4:s.label=5;case 5:return e=!0,[3,2];case 6:return[3,9];case 7:return a=s.sent(),t=!0,r=a,[3,9];case 8:try{e||null==n.return||n.return()}finally{if(t)throw r}return[7];case 9:return[2]}}))}},{key:t,value:function(){return this.entries()}},{key:"find",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!0,n=!1,i=void 0;try{for(var o,a=(0,T.default)(this,oe,xe).call(this)[Symbol.iterator]();!(r=(o=a.next()).done);r=!0){var s=o.value,u=(0,k.default)(this,d)[s],l=(0,T.default)(this,ce,Le).call(this,u)?u.__staleWhileFetching:u;if(void 0!==l&&e(l,(0,k.default)(this,h)[s],this))return this.get((0,k.default)(this,h)[s],t)}}catch(e){n=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw i}}}},{key:"forEach",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,r=!0,n=!1,i=void 0;try{for(var o,a=(0,T.default)(this,oe,xe).call(this)[Symbol.iterator]();!(r=(o=a.next()).done);r=!0){var s=o.value,u=(0,k.default)(this,d)[s],l=(0,T.default)(this,ce,Le).call(this,u)?u.__staleWhileFetching:u;void 0!==l&&e.call(t,l,(0,k.default)(this,h)[s],this)}}catch(e){n=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw i}}}},{key:"rforEach",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,r=!0,n=!1,i=void 0;try{for(var o,a=(0,T.default)(this,ae,Oe).call(this)[Symbol.iterator]();!(r=(o=a.next()).done);r=!0){var s=o.value,u=(0,k.default)(this,d)[s],l=(0,T.default)(this,ce,Le).call(this,u)?u.__staleWhileFetching:u;void 0!==l&&e.call(t,l,(0,k.default)(this,h)[s],this)}}catch(e){n=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw i}}}},{key:"purgeStale",value:function(){var e=!1,t=!0,r=!1,n=void 0;try{for(var i,o=(0,T.default)(this,ae,Oe).call(this,{allowStale:!0})[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value;(0,k.default)(this,$).call(this,a)&&(this.delete((0,k.default)(this,h)[a]),e=!0)}}catch(e){r=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw n}}return e}},{key:"dump",value:function(){var e=[],t=!0,r=!1,n=void 0;try{for(var i,o=(0,T.default)(this,oe,xe).call(this,{allowStale:!0})[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value,s=(0,k.default)(this,h)[a],u=(0,k.default)(this,d)[a],l=(0,T.default)(this,ce,Le).call(this,u)?u.__staleWhileFetching:u;if(void 0!==l&&void 0!==s){var c={value:l};if((0,k.default)(this,W)&&(0,k.default)(this,M)){c.ttl=(0,k.default)(this,W)[a];var f=pe.now()-(0,k.default)(this,M)[a];c.start=Math.floor(Date.now()-f)}(0,k.default)(this,P)&&(c.size=(0,k.default)(this,P)[a]),e.unshift([s,c])}}}catch(e){r=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw n}}return e}},{key:"load",value:function(e){this.clear();var t=!0,r=!1,n=void 0;try{for(var i,o=e[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=(0,j.default)(i.value,2),s=a[0],u=a[1];if(u.start){var l=Date.now()-u.start;u.start=pe.now()-l}this.set(s,u.value,u)}}catch(e){r=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw n}}}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(void 0===t)return this.delete(e),this;var n=r.ttl,o=void 0===n?this.ttl:n,u=r.start,c=r.noDisposeOnSet,g=void 0===c?this.noDisposeOnSet:c,m=r.sizeCalculation,w=void 0===m?this.sizeCalculation:m,E=r.status,C=r.noUpdateTTL,I=void 0===C?this.noUpdateTTL:C,R=(0,k.default)(this,ie).call(this,e,t,r.size||0,w);if(this.maxEntrySize&&R>this.maxEntrySize)return E&&(E.set="miss",E.maxEntrySizeExceeded=!0),this.delete(e),this;var x=0===(0,k.default)(this,l)?void 0:(0,k.default)(this,f).get(e);if(void 0===x)x=0===(0,k.default)(this,l)?(0,k.default)(this,y):0!==(0,k.default)(this,b).length?(0,k.default)(this,b).pop():(0,k.default)(this,l)===(0,k.default)(this,i)?(0,T.default)(this,ue,Me).call(this,!1):(0,k.default)(this,l),(0,k.default)(this,h)[x]=e,(0,k.default)(this,d)[x]=t,(0,k.default)(this,f).set(e,x),(0,k.default)(this,p)[(0,k.default)(this,y)]=x,(0,k.default)(this,v)[x]=(0,k.default)(this,y),(0,S.default)(this,y,x),(0,A.default)(this,l).value++,(0,k.default)(this,ne).call(this,x,R,E),E&&(E.set="add"),I=!1;else{(0,T.default)(this,he,Ue).call(this,x);var O=(0,k.default)(this,d)[x];if(t!==O){var P,M;if((0,k.default)(this,K)&&(0,T.default)(this,ce,Le).call(this,O)){var B,L;O.__abortController.abort(Error("replaced"));var N=O.__staleWhileFetching;void 0!==N&&!g&&((0,k.default)(this,z)&&(null===(B=(0,k.default)(this,a))||void 0===B||B.call(this,N,e,"set")),(0,k.default)(this,Y)&&(null===(L=(0,k.default)(this,_))||void 0===L||L.push([N,e,"set"])))}else g||((0,k.default)(this,z)&&(null===(P=(0,k.default)(this,a))||void 0===P||P.call(this,O,e,"set")),(0,k.default)(this,Y)&&(null===(M=(0,k.default)(this,_))||void 0===M||M.push([O,e,"set"])));if((0,k.default)(this,re).call(this,x),(0,k.default)(this,ne).call(this,x,R,E),(0,k.default)(this,d)[x]=t,E){E.set="replace";var U=O&&(0,T.default)(this,ce,Le).call(this,O)?O.__staleWhileFetching:O;void 0!==U&&(E.oldValue=U)}}else E&&(E.set="update")}if(0!==o&&!(0,k.default)(this,W)&&(0,T.default)(this,G,Ie).call(this),(0,k.default)(this,W)&&(I||(0,k.default)(this,X).call(this,x,o,u),E&&(0,k.default)(this,J).call(this,E,x)),!g&&(0,k.default)(this,Y)&&(0,k.default)(this,_))for(var j,F,q=(0,k.default)(this,_);F=null==q?void 0:q.shift();)null===(j=(0,k.default)(this,s))||void 0===j||j.call.apply(j,[this].concat((0,D.default)(F)));return this}},{key:"pop",value:function(){try{for(;(0,k.default)(this,l);){var e=(0,k.default)(this,d)[(0,k.default)(this,g)];if((0,T.default)(this,ue,Me).call(this,!0),(0,T.default)(this,ce,Le).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if((0,k.default)(this,Y)&&(0,k.default)(this,_))for(var t,r,n=(0,k.default)(this,_);r=null==n?void 0:n.shift();)null===(t=(0,k.default)(this,s))||void 0===t||t.call.apply(t,[this].concat((0,D.default)(r)))}}},{key:"has",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.updateAgeOnHas,n=void 0===r?this.updateAgeOnHas:r,i=t.status,o=(0,k.default)(this,f).get(e);if(void 0!==o){var a=(0,k.default)(this,d)[o];if((0,T.default)(this,ce,Le).call(this,a)&&void 0===a.__staleWhileFetching)return!1;if(!(0,k.default)(this,$).call(this,o))return n&&(0,k.default)(this,Q).call(this,o),i&&(i.has="hit",(0,k.default)(this,J).call(this,i,o)),!0;i&&(i.has="stale",(0,k.default)(this,J).call(this,i,o))}else i&&(i.has="miss");return!1}},{key:"peek",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowStale,r=void 0===t?this.allowStale:t,n=(0,k.default)(this,f).get(e);if(void 0!==n&&(r||!(0,k.default)(this,$).call(this,n))){var i=(0,k.default)(this,d)[n];return(0,T.default)(this,ce,Le).call(this,i)?i.__staleWhileFetching:i}}},{key:"fetch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this;return(0,m.default)((function(){var n,i,o,a,s,u,l,c,h,p,v,g,y,b,m,_,w,E,S,A,C,I,R,x,O,P,M,B,L,N,U,j,D,F,W,q,H;return(0,V.__generator)(this,(function(V){return n=t.allowStale,i=void 0===n?r.allowStale:n,o=t.updateAgeOnGet,a=void 0===o?r.updateAgeOnGet:o,s=t.noDeleteOnStaleGet,u=void 0===s?r.noDeleteOnStaleGet:s,l=t.ttl,c=void 0===l?r.ttl:l,h=t.noDisposeOnSet,p=void 0===h?r.noDisposeOnSet:h,v=t.size,g=void 0===v?0:v,y=t.sizeCalculation,b=void 0===y?r.sizeCalculation:y,m=t.noUpdateTTL,_=void 0===m?r.noUpdateTTL:m,w=t.noDeleteOnFetchRejection,E=void 0===w?r.noDeleteOnFetchRejection:w,S=t.allowStaleOnFetchRejection,A=void 0===S?r.allowStaleOnFetchRejection:S,C=t.ignoreFetchAbort,I=void 0===C?r.ignoreFetchAbort:C,R=t.allowStaleOnFetchAbort,x=void 0===R?r.allowStaleOnFetchAbort:R,O=t.context,P=t.forceRefresh,M=void 0!==P&&P,B=t.status,L=t.signal,(0,k.default)(r,K)?(N={allowStale:i,updateAgeOnGet:a,noDeleteOnStaleGet:u,ttl:c,noDisposeOnSet:p,size:g,sizeCalculation:b,noUpdateTTL:_,noDeleteOnFetchRejection:E,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:x,ignoreFetchAbort:I,status:B,signal:L},void 0===(U=(0,k.default)(r,f).get(e))?(B&&(B.fetch="miss"),[2,(j=(0,T.default)(r,le,Be).call(r,e,U,N,O)).__returned=j]):(D=(0,k.default)(r,d)[U],(0,T.default)(r,ce,Le).call(r,D)?(F=i&&void 0!==D.__staleWhileFetching,[2,(B&&(B.fetch="inflight",F&&(B.returnedStale=!0)),F?D.__staleWhileFetching:D.__returned=D)]):(W=(0,k.default)(r,$).call(r,U),M||W?(q=(0,T.default)(r,le,Be).call(r,e,U,N,O),H=void 0!==q.__staleWhileFetching&&i,[2,(B&&(B.fetch=W?"stale":"refresh",H&&W&&(B.returnedStale=!0)),H?q.__staleWhileFetching:q.__returned=q)]):[2,(B&&(B.fetch="hit"),(0,T.default)(r,he,Ue).call(r,U),a&&(0,k.default)(r,Q).call(r,U),B&&(0,k.default)(r,J).call(r,B,U),D)]))):[2,(B&&(B.fetch="get"),r.get(e,{allowStale:i,updateAgeOnGet:a,noDeleteOnStaleGet:u,status:B}))]}))}))()}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.allowStale,n=void 0===r?this.allowStale:r,i=t.updateAgeOnGet,o=void 0===i?this.updateAgeOnGet:i,a=t.noDeleteOnStaleGet,s=void 0===a?this.noDeleteOnStaleGet:a,u=t.status,l=(0,k.default)(this,f).get(e);if(void 0!==l){var c=(0,k.default)(this,d)[l],h=(0,T.default)(this,ce,Le).call(this,c);return u&&(0,k.default)(this,J).call(this,u,l),(0,k.default)(this,$).call(this,l)?(u&&(u.get="stale"),h?(u&&n&&void 0!==c.__staleWhileFetching&&(u.returnedStale=!0),n?c.__staleWhileFetching:void 0):(s||this.delete(e),u&&n&&(u.returnedStale=!0),n?c:void 0)):(u&&(u.get="hit"),h?c.__staleWhileFetching:((0,T.default)(this,he,Ue).call(this,l),o&&(0,k.default)(this,Q).call(this,l),c))}u&&(u.get="miss")}},{key:"delete",value:function(e){var t,r=!1;if(0!==(0,k.default)(this,l)){var n=(0,k.default)(this,f).get(e);if(void 0!==n)if(r=!0,1===(0,k.default)(this,l))this.clear();else{var i,o;(0,k.default)(this,re).call(this,n);var u=(0,k.default)(this,d)[n];(0,T.default)(this,ce,Le).call(this,u)?u.__abortController.abort(Error("deleted")):((0,k.default)(this,z)||(0,k.default)(this,Y))&&((0,k.default)(this,z)&&(null===(i=(0,k.default)(this,a))||void 0===i||i.call(this,u,e,"delete")),(0,k.default)(this,Y)&&(null===(o=(0,k.default)(this,_))||void 0===o||o.push([u,e,"delete"]))),(0,k.default)(this,f).delete(e),(0,k.default)(this,h)[n]=void 0,(0,k.default)(this,d)[n]=void 0,n===(0,k.default)(this,y)?(0,S.default)(this,y,(0,k.default)(this,v)[n]):n===(0,k.default)(this,g)?(0,S.default)(this,g,(0,k.default)(this,p)[n]):((0,k.default)(this,p)[(0,k.default)(this,v)[n]]=(0,k.default)(this,p)[n],(0,k.default)(this,v)[(0,k.default)(this,p)[n]]=(0,k.default)(this,v)[n]),(0,A.default)(this,l).value--,(0,k.default)(this,b).push(n)}}if((0,k.default)(this,Y)&&(null===(t=(0,k.default)(this,_))||void 0===t?void 0:t.length))for(var c,m,w=(0,k.default)(this,_);m=null==w?void 0:w.shift();)null===(c=(0,k.default)(this,s))||void 0===c||c.call.apply(c,[this].concat((0,D.default)(m)));return r}},{key:"clear",value:function(){var e=!0,t=!1,r=void 0;try{for(var n,i=(0,T.default)(this,ae,Oe).call(this,{allowStale:!0})[Symbol.iterator]();!(e=(n=i.next()).done);e=!0){var o=n.value,u=(0,k.default)(this,d)[o];if((0,T.default)(this,ce,Le).call(this,u))u.__abortController.abort(Error("deleted"));else{var p,v,m=(0,k.default)(this,h)[o];(0,k.default)(this,z)&&(null===(p=(0,k.default)(this,a))||void 0===p||p.call(this,u,m,"delete")),(0,k.default)(this,Y)&&(null===(v=(0,k.default)(this,_))||void 0===v||v.push([u,m,"delete"]))}}}catch(e){t=!0,r=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw r}}if((0,k.default)(this,f).clear(),(0,k.default)(this,d).fill(void 0),(0,k.default)(this,h).fill(void 0),(0,k.default)(this,W)&&(0,k.default)(this,M)&&((0,k.default)(this,W).fill(0),(0,k.default)(this,M).fill(0)),(0,k.default)(this,P)&&(0,k.default)(this,P).fill(0),(0,S.default)(this,g,0),(0,S.default)(this,y,0),(0,k.default)(this,b).length=0,(0,S.default)(this,c,0),(0,S.default)(this,l,0),(0,k.default)(this,Y)&&(0,k.default)(this,_))for(var w,E,A=(0,k.default)(this,_);E=null==A?void 0:A.shift();)null===(w=(0,k.default)(this,s))||void 0===w||w.call.apply(w,[this].concat((0,D.default)(E)))}}],[{key:"unsafeExposeInternals",value:function(e){return{starts:(0,k.default)(e,M),ttls:(0,k.default)(e,W),sizes:(0,k.default)(e,P),keyMap:(0,k.default)(e,f),keyList:(0,k.default)(e,h),valList:(0,k.default)(e,d),next:(0,k.default)(e,p),prev:(0,k.default)(e,v),get head(){return(0,k.default)(e,g)},get tail(){return(0,k.default)(e,y)},free:(0,k.default)(e,b),isBackgroundFetch:function(t){return(0,T.default)(e,ce,Le).call(e,t)},backgroundFetch:function(t,r,n,i){return(0,T.default)(e,le,Be).call(e,t,r,n,i)},moveToTail:function(t){return(0,T.default)(e,he,Ue).call(e,t)},indexes:function(t){return(0,T.default)(e,oe,xe).call(e,t)},rindexes:function(t){return(0,T.default)(e,ae,Oe).call(e,t)},isStale:function(t){return(0,k.default)(e,$).call(e,t)}}}}]),e}(),de);function Ie(){var e=this,t=new Ae((0,k.default)(this,i)),r=new Ae((0,k.default)(this,i));(0,S.default)(this,W,t),(0,S.default)(this,M,r),(0,S.default)(this,X,(function(n,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pe.now();if(r[n]=0!==i?o:0,t[n]=i,0!==i&&e.ttlAutopurge){var a=setTimeout((function(){(0,k.default)(e,$).call(e,n)&&e.delete((0,k.default)(e,h)[n])}),i+1);a.unref&&a.unref()}})),(0,S.default)(this,Q,(function(e){r[e]=0!==t[e]?pe.now():0})),(0,S.default)(this,J,(function(e,i){if(t[i]){var a=t[i],s=r[i];e.ttl=a,e.start=s,e.now=n||o();var u=e.now-s;e.remainingTTL=a-u}}));var n=0,o=function(){var t=pe.now();if(e.ttlResolution>0){n=t;var r=setTimeout((function(){return n=0}),e.ttlResolution);r.unref&&r.unref()}return t};this.getRemainingTTL=function(i){var a=(0,k.default)(e,f).get(i);if(void 0===a)return 0;var s=t[a],u=r[a];return 0===s||0===u?1/0:s-((n||o())-u)},(0,S.default)(this,$,(function(e){return 0!==t[e]&&0!==r[e]&&(n||o())-r[e]>t[e]}))}function Re(){var e=this,t=new Ae((0,k.default)(this,i));(0,S.default)(this,c,0),(0,S.default)(this,P,t),(0,S.default)(this,re,(function(r){(0,S.default)(e,c,(0,k.default)(e,c)-t[r]),t[r]=0})),(0,S.default)(this,ie,(function(t,r,n,i){if((0,T.default)(e,ce,Le).call(e,r))return 0;if(!Ee(n)){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(n=i(r,t),!Ee(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return n})),(0,S.default)(this,ne,(function(r,n,i){if(t[r]=n,(0,k.default)(e,o))for(var a=(0,k.default)(e,o)-t[r];(0,k.default)(e,c)>a;)(0,T.default)(e,ue,Me).call(e,!0);(0,S.default)(e,c,(0,k.default)(e,c)+t[r]),i&&(i.entrySize=n,i.totalCalculatedSize=(0,k.default)(e,c))}))}function xe(){var e,t,r,n,i=arguments;return(0,V.__generator)(this,(function(o){switch(o.label){case 0:if(e=(i.length>0&&void 0!==i[0]?i[0]:{}).allowStale,t=void 0===e?this.allowStale:e,!(0,k.default)(this,l))return[3,6];r=(0,k.default)(this,y),o.label=1;case 1:return(n=(0,T.default)(this,se,Pe).call(this,r))?t||!(0,k.default)(this,$).call(this,r)?[4,r]:[3,3]:[3,4];case 2:o.sent(),o.label=3;case 3:n=r!==(0,k.default)(this,g),o.label=4;case 4:if(!n)return[3,6];r=(0,k.default)(this,v)[r],o.label=5;case 5:return[3,1];case 6:return[2]}}))}function Oe(){var e,t,r,n,i=arguments;return(0,V.__generator)(this,(function(o){switch(o.label){case 0:if(e=(i.length>0&&void 0!==i[0]?i[0]:{}).allowStale,t=void 0===e?this.allowStale:e,!(0,k.default)(this,l))return[3,6];r=(0,k.default)(this,g),o.label=1;case 1:return(n=(0,T.default)(this,se,Pe).call(this,r))?t||!(0,k.default)(this,$).call(this,r)?[4,r]:[3,3]:[3,4];case 2:o.sent(),o.label=3;case 3:n=r!==(0,k.default)(this,y),o.label=4;case 4:if(!n)return[3,6];r=(0,k.default)(this,p)[r],o.label=5;case 5:return[3,1];case 6:return[2]}}))}function Pe(e){return void 0!==e&&(0,k.default)(this,f).get((0,k.default)(this,h)[e])===e}function Me(e){var t,r,n=(0,k.default)(this,g),i=(0,k.default)(this,h)[n],o=(0,k.default)(this,d)[n];return(0,k.default)(this,K)&&(0,T.default)(this,ce,Le).call(this,o)?o.__abortController.abort(Error("evicted")):((0,k.default)(this,z)||(0,k.default)(this,Y))&&((0,k.default)(this,z)&&(null===(t=(0,k.default)(this,a))||void 0===t||t.call(this,o,i,"evict")),(0,k.default)(this,Y)&&(null===(r=(0,k.default)(this,_))||void 0===r||r.push([o,i,"evict"]))),(0,k.default)(this,re).call(this,n),e&&((0,k.default)(this,h)[n]=void 0,(0,k.default)(this,d)[n]=void 0,(0,k.default)(this,b).push(n)),1===(0,k.default)(this,l)?((0,S.default)(this,g,(0,S.default)(this,y,0)),(0,k.default)(this,b).length=0):(0,S.default)(this,g,(0,k.default)(this,p)[n]),(0,k.default)(this,f).delete(i),(0,A.default)(this,l).value--,n}function Be(e,t,r,n){var i=this,o=void 0===t?void 0:(0,k.default)(this,d)[t];if((0,T.default)(this,ce,Le).call(this,o))return o;var a=new be,s=r.signal;null==s||s.addEventListener("abort",(function(){return a.abort(s.reason)}),{signal:a.signal});var l={signal:a.signal,options:r,context:n},c=function(n){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=a.signal.aborted,u=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(s&&!o?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,u&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),s&&!u&&!o)return h(a.signal.reason);var c=p;return(0,k.default)(i,d)[t]===p&&(void 0===n?c.__staleWhileFetching?(0,k.default)(i,d)[t]=c.__staleWhileFetching:i.delete(e):(r.status&&(r.status.fetchUpdated=!0),i.set(e,n,l.options))),n},h=function(n){var o=a.signal.aborted&&r.allowStaleOnFetchAbort,s=o||r.allowStaleOnFetchRejection,u=s||r.noDeleteOnFetchRejection,l=p;if((0,k.default)(i,d)[t]===p&&(u&&void 0!==l.__staleWhileFetching?o||((0,k.default)(i,d)[t]=l.__staleWhileFetching):i.delete(e)),s)return r.status&&void 0!==l.__staleWhileFetching&&(r.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw n};r.status&&(r.status.fetchDispatched=!0);var p=new Promise((function(t,n){var s,f=null===(s=(0,k.default)(i,u))||void 0===s?void 0:s.call(i,e,o,l);f&&f instanceof Promise&&f.then((function(e){return t(void 0===e?void 0:e)}),n),a.signal.addEventListener("abort",(function(){(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(t(void 0),r.allowStaleOnFetchAbort&&(t=function(e){return c(e,!0)}))}))})).then(c,(function(e){return r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),h(e)})),v=Object.assign(p,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return void 0===t?(this.set(e,v,(0,N.default)((0,L.default)({},l.options),{status:void 0})),t=(0,k.default)(this,f).get(e)):(0,k.default)(this,d)[t]=v,v}function Le(e){if(!(0,k.default)(this,K))return!1;var t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof be}function Ne(e,t){(0,k.default)(this,v)[t]=e,(0,k.default)(this,p)[e]=t}function Ue(e){e!==(0,k.default)(this,y)&&(e===(0,k.default)(this,g)?(0,S.default)(this,g,(0,k.default)(this,p)[e]):(0,T.default)(this,fe,Ne).call(this,(0,k.default)(this,v)[e],(0,k.default)(this,p)[e]),(0,T.default)(this,fe,Ne).call(this,(0,k.default)(this,y),e),(0,S.default)(this,y,e))}e.LRUCache=Ce})),Oi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.ContainerIterator=e.Container=e.Base=void 0,e.ContainerIterator=function(){"use strict";function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,w.default)(this,e),this.iteratorType=t}return(0,x.default)(e,[{key:"equals",value:function(e){return this.o===e.o}}]),e}();var t=function(){"use strict";function e(){(0,w.default)(this,e),this.i=0}return(0,x.default)(e,[{key:"length",get:function(){return this.i}},{key:"size",value:function(){return this.i}},{key:"empty",value:function(){return 0===this.i}}]),e}();e.Base=t,e.Container=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){return(0,w.default)(this,r),t.apply(this,arguments)}return r}(t)})),Pi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(0,w.default)(this,r),(e=t.call(this)).S=[];var i=(0,g.default)(e);return n.forEach((function(e){i.push(e)})),(0,U.default)(e)}return(0,x.default)(r,[{key:"clear",value:function(){this.i=0,this.S=[]}},{key:"push",value:function(e){return this.S.push(e),this.i+=1,this.i}},{key:"pop",value:function(){if(0!==this.i)return this.i-=1,this.S.pop()}},{key:"top",value:function(){return this.S[this.i-1]}}]),r}(Oi().Base),r=t;e.default=r})),Mi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(0,w.default)(this,r),(e=t.call(this)).j=0,e.q=[];var i=(0,g.default)(e);return n.forEach((function(e){i.push(e)})),(0,U.default)(e)}return(0,x.default)(r,[{key:"clear",value:function(){this.q=[],this.i=this.j=0}},{key:"push",value:function(e){var t=this.q.length;if(this.j/t>.5&&this.j+this.i>=t&&t>4096){for(var r=this.i,n=0;n<r;++n)this.q[n]=this.q[this.j+n];this.j=0,this.q[this.i]=e}else this.q[this.j+this.i]=e;return++this.i}},{key:"pop",value:function(){if(0!==this.i){var e=this.q[this.j++];return this.i-=1,e}}},{key:"front",value:function(){if(0!==this.i)return this.q[this.j]}}]),r}(Oi().Base),r=t;e.default=r})),Bi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return e>t?-1:e<t?1:0},o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if((0,w.default)(this,r),(e=t.call(this)).v=i,Array.isArray(n))e.C=o?(0,D.default)(n):n;else{e.C=[];var a=(0,g.default)(e);n.forEach((function(e){a.C.push(e)}))}e.i=e.C.length;for(var s=e.i>>1,u=e.i-1>>1;u>=0;--u)e.k(u,s);return(0,U.default)(e)}return(0,x.default)(r,[{key:"m",value:function(e){for(var t=this.C[e];e>0;){var r=e-1>>1,n=this.C[r];if(this.v(n,t)<=0)break;this.C[e]=n,e=r}this.C[e]=t}},{key:"k",value:function(e,t){for(var r=this.C[e];e<t;){var n=e<<1|1,i=n+1,o=this.C[n];if(i<this.i&&this.v(o,this.C[i])>0&&(n=i,o=this.C[i]),this.v(o,r)>=0)break;this.C[e]=o,e=n}this.C[e]=r}},{key:"clear",value:function(){this.i=0,this.C.length=0}},{key:"push",value:function(e){this.C.push(e),this.m(this.i),this.i+=1}},{key:"pop",value:function(){if(0!==this.i){var 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}}},{key:"top",value:function(){return this.C[0]}},{key:"find",value:function(e){return this.C.indexOf(e)>=0}},{key:"remove",value:function(e){var 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))}},{key:"updateItem",value:function(e){var t=this.C.indexOf(e);return!(t<0||(this.m(t),this.k(t,this.i>>1),0))}},{key:"toArray",value:function(){return(0,D.default)(this.C)}}]),r}(Oi().Base),r=t;e.default=r})),Li=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){return(0,w.default)(this,r),t.apply(this,arguments)}return r}(Oi().Container);e.default=t})),Ni=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.throwIteratorAccessError=function(){throw new RangeError("Iterator access denied!")}})),Ui=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.RandomIterator=void 0;var t=Oi(),r=Ni(),n=function(e){"use strict";(0,B.default)(n,e);var t=(0,H.default)(n);function n(e,i){var o;return(0,w.default)(this,n),(o=t.call(this,i)).o=e,0===o.iteratorType?(o.pre=function(){return 0===this.o&&(0,r.throwIteratorAccessError)(),this.o-=1,this},o.next=function(){return this.o===this.container.size()&&(0,r.throwIteratorAccessError)(),this.o+=1,this}):(o.pre=function(){return this.o===this.container.size()-1&&(0,r.throwIteratorAccessError)(),this.o+=1,this},o.next=function(){return-1===this.o&&(0,r.throwIteratorAccessError)(),this.o-=1,this}),(0,U.default)(o)}return(0,x.default)(n,[{key:"pointer",get:function(){return this.container.getElementByPos(this.o)},set:function(e){this.container.setElementByPos(this.o,e)}}]),n}(t.ContainerIterator);e.RandomIterator=n})),ji=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t,r=(t=Li())&&t.t?t:{default:t},n=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n,i){var o;return(0,w.default)(this,r),(o=t.call(this,e,i)).container=n,(0,U.default)(o)}return(0,x.default)(r,[{key:"copy",value:function(){return new r(this.o,this.container,this.iteratorType)}}]),r}(Ui().RandomIterator),i=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if((0,w.default)(this,r),e=t.call(this),Array.isArray(n))e.J=i?(0,D.default)(n):n,e.i=n.length;else{e.J=[];var o=(0,g.default)(e);n.forEach((function(e){o.pushBack(e)}))}return(0,U.default)(e)}return(0,x.default)(r,[{key:"clear",value:function(){this.i=0,this.J.length=0}},{key:"begin",value:function(){return new n(0,this)}},{key:"end",value:function(){return new n(this.i,this)}},{key:"rBegin",value:function(){return new n(this.i-1,this,1)}},{key:"rEnd",value:function(){return new n(-1,this,1)}},{key:"front",value:function(){return this.J[0]}},{key:"back",value:function(){return this.J[this.i-1]}},{key:"getElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}},{key:"eraseElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}},{key:"eraseElementByValue",value:function(e){for(var t=0,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}},{key:"eraseElementByIterator",value:function(e){var t=e.o;return e=e.next(),this.eraseElementByPos(t),e}},{key:"pushBack",value:function(e){return this.J.push(e),this.i+=1,this.i}},{key:"popBack",value:function(){if(0!==this.i)return this.i-=1,this.J.pop()}},{key:"setElementByPos",value:function(e,t){if(e<0||e>this.i-1)throw new RangeError;this.J[e]=t}},{key:"insert",value:function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e<0||e>this.i)throw new RangeError;return(r=this.J).splice.apply(r,[e,0].concat((0,D.default)(Array(n).fill(t)))),this.i+=n,this.i}},{key:"find",value:function(e){for(var t=0;t<this.i;++t)if(this.J[t]===e)return new n(t,this);return this.end()}},{key:"reverse",value:function(){this.J.reverse()}},{key:"unique",value:function(){for(var e=1,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}},{key:"sort",value:function(e){this.J.sort(e)}},{key:"forEach",value:function(e){for(var t=0;t<this.i;++t)e(this.J[t],t,this)}},{key:Symbol.iterator,value:function(){return function(){return(0,V.__generator)(this,(function(e){switch(e.label){case 0:return[5,(0,V.__values)(this.J)];case 1:return e.sent(),[2]}}))}.bind(this)()}}]),r}(r.default),o=i;e.default=o})),Di=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t,r=(t=Li())&&t.t?t:{default:t},n=Oi(),i=Ni(),o=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n,o,a){var s;return(0,w.default)(this,r),(s=t.call(this,a)).o=e,s.h=n,s.container=o,0===s.iteratorType?(s.pre=function(){return this.o.L===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.L,this},s.next=function(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.B,this}):(s.pre=function(){return this.o.B===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.B,this},s.next=function(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.L,this}),(0,U.default)(s)}return(0,x.default)(r,[{key:"pointer",get:function(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o.l},set:function(e){this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o.l=e}},{key:"copy",value:function(){return new r(this.o,this.h,this.container,this.iteratorType)}}]),r}(n.ContainerIterator),a=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(0,w.default)(this,r),(e=t.call(this)).h={},e.p=e._=e.h.L=e.h.B=e.h;var i=(0,g.default)(e);return n.forEach((function(e){i.pushBack(e)})),(0,U.default)(e)}return(0,x.default)(r,[{key:"V",value:function(e){var t=e.L,r=e.B;t.B=r,r.L=t,e===this.p&&(this.p=r),e===this._&&(this._=t),this.i-=1}},{key:"G",value:function(e,t){var r=t.B,n={l:e,L:t,B:r};t.B=n,r.L=n,t===this.h&&(this.p=n),r===this.h&&(this._=n),this.i+=1}},{key:"clear",value:function(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}},{key:"begin",value:function(){return new o(this.p,this.h,this)}},{key:"end",value:function(){return new o(this.h,this.h,this)}},{key:"rBegin",value:function(){return new o(this._,this.h,this,1)}},{key:"rEnd",value:function(){return new o(this.h,this.h,this,1)}},{key:"front",value:function(){return this.p.l}},{key:"back",value:function(){return this._.l}},{key:"getElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;for(var t=this.p;e--;)t=t.B;return t.l}},{key:"eraseElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;for(var t=this.p;e--;)t=t.B;return this.V(t),this.i}},{key:"eraseElementByValue",value:function(e){for(var t=this.p;t!==this.h;)t.l===e&&this.V(t),t=t.B;return this.i}},{key:"eraseElementByIterator",value:function(e){var t=e.o;return t===this.h&&(0,i.throwIteratorAccessError)(),e=e.next(),this.V(t),e}},{key:"pushBack",value:function(e){return this.G(e,this._),this.i}},{key:"popBack",value:function(){if(0!==this.i){var e=this._.l;return this.V(this._),e}}},{key:"pushFront",value:function(e){return this.G(e,this.h),this.i}},{key:"popFront",value:function(){if(0!==this.i){var e=this.p.l;return this.V(this.p),e}}},{key:"setElementByPos",value:function(e,t){if(e<0||e>this.i-1)throw new RangeError;for(var r=this.p;e--;)r=r.B;r.l=t}},{key:"insert",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]: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{for(var n=this.p,i=1;i<e;++i)n=n.B;var o=n.B;for(this.i+=r;r--;)n.B={l:t,L:n},n.B.L=n,n=n.B;n.B=o,o.L=n}return this.i}},{key:"find",value:function(e){for(var t=this.p;t!==this.h;){if(t.l===e)return new o(t,this.h,this);t=t.B}return this.end()}},{key:"reverse",value:function(){if(!(this.i<=1))for(var e=this.p,t=this._,r=0;r<<1<this.i;){var n=e.l;e.l=t.l,t.l=n,e=e.B,t=t.L,r+=1}}},{key:"unique",value:function(){if(this.i<=1)return this.i;for(var e=this.p;e!==this.h;){for(var t=e;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}},{key:"sort",value:function(e){if(!(this.i<=1)){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);var r=this.p;t.forEach((function(e){r.l=e,r=r.B}))}}},{key:"merge",value:function(e){var t=this;if(0===this.i)e.forEach((function(e){t.pushBack(e)}));else{var r=this.p;e.forEach((function(e){for(;r!==t.h&&r.l<=e;)r=r.B;t.G(e,r.L)}))}return this.i}},{key:"forEach",value:function(e){for(var t=this.p,r=0;t!==this.h;)e(t.l,r++,this),t=t.B}},{key:Symbol.iterator,value:function(){return function(){var e;return(0,V.__generator)(this,(function(t){switch(t.label){case 0:if(0===this.i)return[2];e=this.p,t.label=1;case 1:return e===this.h?[3,4]:[4,e.l];case 2:t.sent(),e=e.B,t.label=3;case 3:return[3,1];case 4:return[2]}}))}.bind(this)()}}]),r}(r.default),s=a;e.default=s})),Fi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t,r=(t=Li())&&t.t?t:{default:t},n=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n,i){var o;return(0,w.default)(this,r),(o=t.call(this,e,i)).container=n,(0,U.default)(o)}return(0,x.default)(r,[{key:"copy",value:function(){return new r(this.o,this.container,this.iteratorType)}}]),r}(Ui().RandomIterator),i=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;(0,w.default)(this,r),(e=t.call(this)).j=0,e.D=0,e.R=0,e.N=0,e.P=0,e.A=[];var o=function(){if("number"==typeof n.length)return n.length;if("number"==typeof n.size)return n.size;if("function"==typeof n.size)return n.size();throw new TypeError("Cannot get the length or size of the container")}();e.F=i,e.P=Math.max(Math.ceil(o/e.F),1);for(var a=0;a<e.P;++a)e.A.push(Array(e.F));var s=Math.ceil(o/e.F);e.j=e.R=(e.P>>1)-(s>>1),e.D=e.N=e.F-o%e.F>>1;var u=(0,g.default)(e);return n.forEach((function(e){u.pushBack(e)})),(0,U.default)(e)}return(0,x.default)(r,[{key:"T",value:function(){for(var e=[],t=Math.max(this.P>>1,1),r=0;r<t;++r)e[r]=Array(this.F);for(var n=this.j;n<this.P;++n)e[e.length]=this.A[n];for(var i=0;i<this.R;++i)e[e.length]=this.A[i];e[e.length]=(0,D.default)(this.A[this.R]),this.j=t,this.R=e.length-1;for(var o=0;o<t;++o)e[e.length]=Array(this.F);this.A=e,this.P=e.length}},{key:"O",value:function(e){var t=this.D+e+1,r=t%this.F,n=r-1,i=this.j+(t-r)/this.F;return 0===r&&(i-=1),i%=this.P,n<0&&(n+=this.F),{curNodeBucketIndex:i,curNodePointerIndex:n}}},{key:"clear",value:function(){this.A=[Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}},{key:"begin",value:function(){return new n(0,this)}},{key:"end",value:function(){return new n(this.i,this)}},{key:"rBegin",value:function(){return new n(this.i-1,this,1)}},{key:"rEnd",value:function(){return new n(-1,this,1)}},{key:"front",value:function(){if(0!==this.i)return this.A[this.j][this.D]}},{key:"back",value:function(){if(0!==this.i)return this.A[this.R][this.N]}},{key:"pushBack",value:function(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}},{key:"popBack",value:function(){if(0!==this.i){var 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}}},{key:"pushFront",value:function(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}},{key:"popFront",value:function(){if(0!==this.i){var 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}}},{key:"getElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;var t=this.O(e),r=t.curNodeBucketIndex,n=t.curNodePointerIndex;return this.A[r][n]}},{key:"setElementByPos",value:function(e,t){if(e<0||e>this.i-1)throw new RangeError;var r=this.O(e),n=r.curNodeBucketIndex,i=r.curNodePointerIndex;this.A[n][i]=t}},{key:"insert",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]: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{for(var n=[],i=e;i<this.i;++i)n.push(this.getElementByPos(i));this.cut(e-1);for(var o=0;o<r;++o)this.pushBack(t);for(var a=0;a<n.length;++a)this.pushBack(n[a])}return this.i}},{key:"cut",value:function(e){if(e<0)return this.clear(),0;var t=this.O(e),r=t.curNodeBucketIndex,n=t.curNodePointerIndex;return this.R=r,this.N=n,this.i=e+1,this.i}},{key:"eraseElementByPos",value:function(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{for(var t=[],r=e+1;r<this.i;++r)t.push(this.getElementByPos(r));this.cut(e),this.popBack();var n=this;t.forEach((function(e){n.pushBack(e)}))}return this.i}},{key:"eraseElementByValue",value:function(e){if(0===this.i)return 0;for(var t=[],r=0;r<this.i;++r){var n=this.getElementByPos(r);n!==e&&t.push(n)}for(var i=t.length,o=0;o<i;++o)this.setElementByPos(o,t[o]);return this.cut(i-1)}},{key:"eraseElementByIterator",value:function(e){var t=e.o;return this.eraseElementByPos(t),e.next()}},{key:"find",value:function(e){for(var t=0;t<this.i;++t)if(this.getElementByPos(t)===e)return new n(t,this);return this.end()}},{key:"reverse",value:function(){for(var e=0,t=this.i-1;e<t;){var r=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,r),e+=1,t-=1}}},{key:"unique",value:function(){if(this.i<=1)return this.i;for(var e=1,t=this.getElementByPos(0),r=1;r<this.i;++r){var n=this.getElementByPos(r);n!==t&&(t=n,this.setElementByPos(e++,n))}for(;this.i>e;)this.popBack();return this.i}},{key:"sort",value:function(e){for(var t=[],r=0;r<this.i;++r)t.push(this.getElementByPos(r));t.sort(e);for(var n=0;n<this.i;++n)this.setElementByPos(n,t[n])}},{key:"shrinkToFit",value:function(){if(0!==this.i){var e=[];this.forEach((function(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(var t=0;t<this.P;++t)this.A.push(Array(this.F));for(var r=0;r<e.length;++r)this.pushBack(e[r])}}},{key:"forEach",value:function(e){for(var t=0;t<this.i;++t)e(this.getElementByPos(t),t,this)}},{key:Symbol.iterator,value:function(){return function(){var e;return(0,V.__generator)(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<this.i?[4,this.getElementByPos(e)]:[3,4];case 2:t.sent(),t.label=3;case 3:return++e,[3,1];case 4:return[2]}}))}.bind(this)()}}]),r}(r.default),o=i;e.default=o})),Wi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.TreeNodeEnableIndex=e.TreeNode=void 0;var t=function(){"use strict";function e(t,r){(0,w.default)(this,e),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=t,this.l=r}return(0,x.default)(e,[{key:"L",value:function(){var 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{for(var t=e.tt;t.U===e;)t=(e=t).tt;e=t}return e}},{key:"B",value:function(){var e=this;if(e.W){for(e=e.W;e.U;)e=e.U;return e}for(var t=e.tt;t.W===e;)t=(e=t).tt;return e.W!==t?t:e}},{key:"te",value:function(){var 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}},{key:"se",value:function(){var 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}}]),e}();e.TreeNode=t,e.TreeNodeEnableIndex=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e;return(0,w.default)(this,r),(e=t.call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))).rt=1,(0,U.default)(e)}return(0,x.default)(r,[{key:"te",value:function(){var e=(0,P.default)((0,M.default)(r.prototype),"te",this).call(this);return this.ie(),e.ie(),e}},{key:"se",value:function(){var e=(0,P.default)((0,M.default)(r.prototype),"se",this).call(this);return this.ie(),e.ie(),e}},{key:"ie",value:function(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}}]),r}(t)})),qi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=Wi(),r=Oi(),n=Ni(),i=function(e){"use strict";(0,B.default)(i,e);var r=(0,H.default)(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e,t){return e<t?-1:e>t?1:0},o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,w.default)(this,i),(e=r.call(this)).Y=void 0,e.v=n,o?(e.re=t.TreeNodeEnableIndex,e.M=function(e,t,r){var n=this.ne(e,t,r);if(n){for(var i=n.tt;i!==this.h;)i.rt+=1,i=i.tt;var o=this.he(n);if(o){var a=o.parentNode,s=o.grandParent,u=o.curNode;a.ie(),s.ie(),u.ie()}}return this.i},e.V=function(e){for(var t=this.fe(e);t!==this.h;)t.rt-=1,t=t.tt}):(e.re=t.TreeNode,e.M=function(e,t,r){var n=this.ne(e,t,r);return n&&this.he(n),this.i},e.V=e.fe),e.h=new e.re,(0,U.default)(e)}return(0,x.default)(i,[{key:"X",value:function(e,t){for(var r=this.h;e;){var n=this.v(e.u,t);if(n<0)e=e.W;else{if(!(n>0))return e;r=e,e=e.U}}return r}},{key:"Z",value:function(e,t){for(var r=this.h;e;)this.v(e.u,t)<=0?e=e.W:(r=e,e=e.U);return r}},{key:"$",value:function(e,t){for(var r=this.h;e;){var n=this.v(e.u,t);if(n<0)r=e,e=e.W;else{if(!(n>0))return e;e=e.U}}return r}},{key:"rr",value:function(e,t){for(var r=this.h;e;)this.v(e.u,t)<0?(r=e,e=e.W):e=e.U;return r}},{key:"ue",value:function(e){for(;;){var t=e.tt;if(t===this.h)return;if(1===e.ee)return void(e.ee=0);if(e===t.U){var 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{var n=t.U;if(1===n.ee)n.ee=0,t.ee=1,t===this.Y?this.Y=t.se():t.se();else{if(n.U&&1===n.U.ee)return n.ee=t.ee,t.ee=0,n.U.ee=0,void(t===this.Y?this.Y=t.se():t.se());n.W&&1===n.W.ee?(n.ee=1,n.W.ee=0,n.te()):(n.ee=1,e=t)}}}}},{key:"fe",value:function(e){if(1===this.i)return this.clear(),this.h;for(var t=e;t.U||t.W;){if(t.W)for(t=t.W;t.U;)t=t.U;else t=t.U;var r,n;r=[t.u,e.u],e.u=r[0],t.u=r[1],n=[t.l,e.l],e.l=n[0],t.l=n[1],e=t}this.h.U===t?this.h.U=t.tt:this.h.W===t&&(this.h.W=t.tt),this.ue(t);var i=t.tt;return t===i.U?i.U=void 0:i.W=void 0,this.i-=1,this.Y.ee=0,i}},{key:"oe",value:function(e,t){return void 0!==e&&(!(!this.oe(e.U,t)&&!t(e))||this.oe(e.W,t))}},{key:"he",value:function(e){for(;;){var t=e.tt;if(0===t.ee)return;var r=t.tt;if(t===r.U){var n=r.W;if(n&&1===n.ee){if(n.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{var i=r.tt;i.U===r?i.U=e:i.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{var o=r.U;if(o&&1===o.ee){if(o.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{var a=r.tt;a.U===r?a.U=e:a.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}}},{key:"ne",value:function(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);var n,i=this.h.U,o=this.v(i.u,e);if(0!==o){if(o>0)i.U=new this.re(e,t),i.U.tt=i,n=i.U,this.h.U=n;else{var a=this.h.W,s=this.v(a.u,e);if(0===s)return void(a.l=t);if(s<0)a.W=new this.re(e,t),a.W.tt=a,n=a.W,this.h.W=n;else{if(void 0!==r){var u=r.o;if(u!==this.h){var l=this.v(u.u,e);if(0===l)return void(u.l=t);if(l>0){var c=u.L(),f=this.v(c.u,e);if(0===f)return void(c.l=t);f<0&&(n=new this.re(e,t),void 0===c.W?(c.W=n,n.tt=c):(u.U=n,n.tt=u))}}}if(void 0===n)for(n=this.Y;;){var h=this.v(n.u,e);if(h>0){if(void 0===n.U){n.U=new this.re(e,t),n.U.tt=n,n=n.U;break}n=n.U}else{if(!(h<0))return void(n.l=t);if(void 0===n.W){n.W=new this.re(e,t),n.W.tt=n,n=n.W;break}n=n.W}}}}return this.i+=1,n}i.l=t}},{key:"I",value:function(e,t){for(;e;){var 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}},{key:"clear",value:function(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}},{key:"updateKeyByIterator",value:function(e,t){var r=e.o;if(r===this.h&&(0,n.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);var i=r.L().u;if(this.v(i,t)>=0)return!1;var o=r.B().u;return!(this.v(o,t)<=0||(r.u=t,0))}},{key:"eraseElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;var t=0,r=this;return this.oe(this.Y,(function(n){return e===t?(r.V(n),!0):(t+=1,!1)})),this.i}},{key:"eraseElementByKey",value:function(e){if(0===this.i)return!1;var t=this.I(this.Y,e);return t!==this.h&&(this.V(t),!0)}},{key:"eraseElementByIterator",value:function(e){var t=e.o;t===this.h&&(0,n.throwIteratorAccessError)();var r=void 0===t.W;return 0===e.iteratorType?r&&e.next():(!r||void 0===t.U)&&e.next(),this.V(t),e}},{key:"forEach",value:function(e){var t=0,r=!0,n=!1,i=void 0;try{for(var o,a=this[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)e(o.value,t++,this)}catch(e){n=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw i}}}},{key:"getElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;var t,r=0,n=!0,i=!1,o=void 0;try{for(var a,s=this[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(r===e){t=u;break}r+=1}}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return t}},{key:"getHeight",value:function(){if(0===this.i)return 0;var e=function(t){return t?Math.max(e(t.U),e(t.W))+1:0};return e(this.Y)}}]),i}(r.Container),o=i;e.default=o})),Hi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=Oi(),r=Ni(),n=function(e){"use strict";(0,B.default)(n,e);var t=(0,H.default)(n);function n(e,i,o){var a;return(0,w.default)(this,n),(a=t.call(this,o)).o=e,a.h=i,0===a.iteratorType?(a.pre=function(){return this.o===this.h.U&&(0,r.throwIteratorAccessError)(),this.o=this.o.L(),this},a.next=function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o=this.o.B(),this}):(a.pre=function(){return this.o===this.h.W&&(0,r.throwIteratorAccessError)(),this.o=this.o.B(),this},a.next=function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o=this.o.L(),this}),(0,U.default)(a)}return(0,x.default)(n,[{key:"index",get:function(){var e=this.o,t=this.h.tt;if(e===this.h)return t?t.rt-1:0;var r=0;for(e.U&&(r+=e.U.rt);e!==t;){var n=e.tt;e===n.W&&(r+=1,n.U&&(r+=n.U.rt)),e=n}return r}}]),n}(t.ContainerIterator),i=n;e.default=i})),Vi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=i(qi()),r=i(Hi()),n=Ni();function i(e){return e&&e.t?e:{default:e}}var o=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n,i,o){var a;return(0,w.default)(this,r),(a=t.call(this,e,n,o)).container=i,(0,U.default)(a)}return(0,x.default)(r,[{key:"pointer",get:function(){return this.o===this.h&&(0,n.throwIteratorAccessError)(),this.o.u}},{key:"copy",value:function(){return new r(this.o,this.h,this.container,this.iteratorType)}}]),r}(r.default),a=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0;(0,w.default)(this,r),e=t.call(this,i,o);var a=(0,g.default)(e);return n.forEach((function(e){a.insert(e)})),e}return(0,x.default)(r,[{key:"K",value:function(e){return(0,V.__generator)(this,(function(t){switch(t.label){case 0:return void 0!==e?[5,(0,V.__values)(this.K(e.U))]:[3,4];case 1:return t.sent(),[4,e.u];case 2:return t.sent(),[5,(0,V.__values)(this.K(e.W))];case 3:t.sent(),t.label=4;case 4:return[2]}}))}},{key:"begin",value:function(){return new o(this.h.U||this.h,this.h,this)}},{key:"end",value:function(){return new o(this.h,this.h,this)}},{key:"rBegin",value:function(){return new o(this.h.W||this.h,this.h,this,1)}},{key:"rEnd",value:function(){return new o(this.h,this.h,this,1)}},{key:"front",value:function(){return this.h.U?this.h.U.u:void 0}},{key:"back",value:function(){return this.h.W?this.h.W.u:void 0}},{key:"insert",value:function(e,t){return this.M(e,void 0,t)}},{key:"find",value:function(e){var t=this.I(this.Y,e);return new o(t,this.h,this)}},{key:"lowerBound",value:function(e){var t=this.X(this.Y,e);return new o(t,this.h,this)}},{key:"upperBound",value:function(e){var t=this.Z(this.Y,e);return new o(t,this.h,this)}},{key:"reverseLowerBound",value:function(e){var t=this.$(this.Y,e);return new o(t,this.h,this)}},{key:"reverseUpperBound",value:function(e){var t=this.rr(this.Y,e);return new o(t,this.h,this)}},{key:"union",value:function(e){var t=this;return e.forEach((function(e){t.insert(e)})),this.i}},{key:Symbol.iterator,value:function(){return this.K(this.Y)}}]),r}(t.default),s=a;e.default=s})),zi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=i(qi()),r=i(Hi()),n=Ni();function i(e){return e&&e.t?e:{default:e}}var o=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n,i,o){var a;return(0,w.default)(this,r),(a=t.call(this,e,n,o)).container=i,(0,U.default)(a)}return(0,x.default)(r,[{key:"pointer",get:function(){this.o===this.h&&(0,n.throwIteratorAccessError)();var e=this;return new Proxy([],{get:function(t,r){return"0"===r?e.o.u:"1"===r?e.o.l:void 0},set:function(t,r,n){if("1"!==r)throw new TypeError("props must be 1");return e.o.l=n,!0}})}},{key:"copy",value:function(){return new r(this.o,this.h,this.container,this.iteratorType)}}]),r}(r.default),a=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0;(0,w.default)(this,r),e=t.call(this,i,o);var a=(0,g.default)(e);return n.forEach((function(e){a.setElement(e[0],e[1])})),e}return(0,x.default)(r,[{key:"K",value:function(e){return(0,V.__generator)(this,(function(t){switch(t.label){case 0:return void 0!==e?[5,(0,V.__values)(this.K(e.U))]:[3,4];case 1:return t.sent(),[4,[e.u,e.l]];case 2:return t.sent(),[5,(0,V.__values)(this.K(e.W))];case 3:t.sent(),t.label=4;case 4:return[2]}}))}},{key:"begin",value:function(){return new o(this.h.U||this.h,this.h,this)}},{key:"end",value:function(){return new o(this.h,this.h,this)}},{key:"rBegin",value:function(){return new o(this.h.W||this.h,this.h,this,1)}},{key:"rEnd",value:function(){return new o(this.h,this.h,this,1)}},{key:"front",value:function(){if(0!==this.i){var e=this.h.U;return[e.u,e.l]}}},{key:"back",value:function(){if(0!==this.i){var e=this.h.W;return[e.u,e.l]}}},{key:"lowerBound",value:function(e){var t=this.X(this.Y,e);return new o(t,this.h,this)}},{key:"upperBound",value:function(e){var t=this.Z(this.Y,e);return new o(t,this.h,this)}},{key:"reverseLowerBound",value:function(e){var t=this.$(this.Y,e);return new o(t,this.h,this)}},{key:"reverseUpperBound",value:function(e){var t=this.rr(this.Y,e);return new o(t,this.h,this)}},{key:"setElement",value:function(e,t,r){return this.M(e,t,r)}},{key:"find",value:function(e){var t=this.I(this.Y,e);return new o(t,this.h,this)}},{key:"getElementByKey",value:function(e){return this.I(this.Y,e).l}},{key:"union",value:function(e){var t=this;return e.forEach((function(e){t.setElement(e[0],e[1])})),this.i}},{key:Symbol.iterator,value:function(){return this.K(this.Y)}}]),r}(t.default),s=a;e.default=s})),Ki=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=function(e){var t=void 0===e?"undefined":(0,F.default)(e);return"object"===t&&null!==e||"function"===t}})),Yi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.HashContainerIterator=e.HashContainer=void 0;var t,r=Oi(),n=(t=Ki())&&t.t?t:{default:t},i=Ni(),o=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n,o){var a;return(0,w.default)(this,r),(a=t.call(this,o)).o=e,a.h=n,0===a.iteratorType?(a.pre=function(){return this.o.L===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.L,this},a.next=function(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.B,this}):(a.pre=function(){return this.o.B===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.B,this},a.next=function(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.L,this}),(0,U.default)(a)}return r}(r.ContainerIterator);e.HashContainerIterator=o;var a=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e;return(0,w.default)(this,r),(e=t.call(this)).H=[],e.g={},e.HASH_TAG=Symbol(),Object.setPrototypeOf(e.g,null),e.h={},e.h.L=e.h.B=e.p=e._=e.h,(0,U.default)(e)}return(0,x.default)(r,[{key:"V",value:function(e){var t=e.L,r=e.B;t.B=r,r.L=t,e===this.p&&(this.p=r),e===this._&&(this._=t),this.i-=1}},{key:"M",value:function(e,t,r){var i;if(void 0===r&&(r=(0,n.default)(e)),r){var o=e[this.HASH_TAG];if(void 0!==o)return this.H[o].l=t,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),i={u:e,l:t,L:this._,B:this.h},this.H.push(i)}else{var a=this.g[e];if(a)return a.l=t,this.i;i={u:e,l:t,L:this._,B:this.h},this.g[e]=i}return 0===this.i?(this.p=i,this.h.B=i):this._.B=i,this._=i,this.h.L=i,++this.i}},{key:"I",value:function(e,t){if(void 0===t&&(t=(0,n.default)(e)),t){var r=e[this.HASH_TAG];return void 0===r?this.h:this.H[r]}return this.g[e]||this.h}},{key:"clear",value:function(){var e=this.HASH_TAG;this.H.forEach((function(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}},{key:"eraseElementByKey",value:function(e,t){var r;if(void 0===t&&(t=(0,n.default)(e)),t){var i=e[this.HASH_TAG];if(void 0===i)return!1;delete e[this.HASH_TAG],r=this.H[i],delete this.H[i]}else{if(void 0===(r=this.g[e]))return!1;delete this.g[e]}return this.V(r),!0}},{key:"eraseElementByIterator",value:function(e){var t=e.o;return t===this.h&&(0,i.throwIteratorAccessError)(),this.V(t),e.next()}},{key:"eraseElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;for(var t=this.p;e--;)t=t.B;return this.V(t),this.i}}]),r}(r.Container);e.HashContainer=a})),Gi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t=Yi(),r=Ni(),n=function(e){"use strict";(0,B.default)(n,e);var t=(0,H.default)(n);function n(e,r,i,o){var a;return(0,w.default)(this,n),(a=t.call(this,e,r,o)).container=i,(0,U.default)(a)}return(0,x.default)(n,[{key:"pointer",get:function(){return this.o===this.h&&(0,r.throwIteratorAccessError)(),this.o.u}},{key:"copy",value:function(){return new n(this.o,this.h,this.container,this.iteratorType)}}]),n}(t.HashContainerIterator),i=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(0,w.default)(this,r),e=t.call(this);var i=(0,g.default)(e);return n.forEach((function(e){i.insert(e)})),e}return(0,x.default)(r,[{key:"begin",value:function(){return new n(this.p,this.h,this)}},{key:"end",value:function(){return new n(this.h,this.h,this)}},{key:"rBegin",value:function(){return new n(this._,this.h,this,1)}},{key:"rEnd",value:function(){return new n(this.h,this.h,this,1)}},{key:"front",value:function(){return this.p.u}},{key:"back",value:function(){return this._.u}},{key:"insert",value:function(e,t){return this.M(e,void 0,t)}},{key:"getElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;for(var t=this.p;e--;)t=t.B;return t.u}},{key:"find",value:function(e,t){var r=this.I(e,t);return new n(r,this.h,this)}},{key:"forEach",value:function(e){for(var t=0,r=this.p;r!==this.h;)e(r.u,t++,this),r=r.B}},{key:Symbol.iterator,value:function(){return function(){var e;return(0,V.__generator)(this,(function(t){switch(t.label){case 0:e=this.p,t.label=1;case 1:return e===this.h?[3,4]:[4,e.u];case 2:t.sent(),e=e.B,t.label=3;case 3:return[3,1];case 4:return[2]}}))}.bind(this)()}}]),r}(t.HashContainer),o=i;e.default=o})),Qi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var t,r=Yi(),n=(t=Ki())&&t.t?t:{default:t},i=Ni(),o=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n,i,o){var a;return(0,w.default)(this,r),(a=t.call(this,e,n,o)).container=i,(0,U.default)(a)}return(0,x.default)(r,[{key:"pointer",get:function(){this.o===this.h&&(0,i.throwIteratorAccessError)();var e=this;return new Proxy([],{get:function(t,r){return"0"===r?e.o.u:"1"===r?e.o.l:void 0},set:function(t,r,n){if("1"!==r)throw new TypeError("props must be 1");return e.o.l=n,!0}})}},{key:"copy",value:function(){return new r(this.o,this.h,this.container,this.iteratorType)}}]),r}(r.HashContainerIterator),a=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(0,w.default)(this,r),e=t.call(this);var i=(0,g.default)(e);return n.forEach((function(e){i.setElement(e[0],e[1])})),e}return(0,x.default)(r,[{key:"begin",value:function(){return new o(this.p,this.h,this)}},{key:"end",value:function(){return new o(this.h,this.h,this)}},{key:"rBegin",value:function(){return new o(this._,this.h,this,1)}},{key:"rEnd",value:function(){return new o(this.h,this.h,this,1)}},{key:"front",value:function(){if(0!==this.i)return[this.p.u,this.p.l]}},{key:"back",value:function(){if(0!==this.i)return[this._.u,this._.l]}},{key:"setElement",value:function(e,t,r){return this.M(e,t,r)}},{key:"getElementByKey",value:function(e,t){if(void 0===t&&(t=(0,n.default)(e)),t){var r=e[this.HASH_TAG];return void 0!==r?this.H[r].l:void 0}var i=this.g[e];return i?i.l:void 0}},{key:"getElementByPos",value:function(e){if(e<0||e>this.i-1)throw new RangeError;for(var t=this.p;e--;)t=t.B;return[t.u,t.l]}},{key:"find",value:function(e,t){var r=this.I(e,t);return new o(r,this.h,this)}},{key:"forEach",value:function(e){for(var t=0,r=this.p;r!==this.h;)e([r.u,r.l],t++,this),r=r.B}},{key:Symbol.iterator,value:function(){return function(){var e;return(0,V.__generator)(this,(function(t){switch(t.label){case 0:e=this.p,t.label=1;case 1:return e===this.h?[3,4]:[4,[e.u,e.l]];case 2:t.sent(),e=e.B,t.label=3;case 3:return[3,1];case 4:return[2]}}))}.bind(this)()}}]),r}(r.HashContainer),s=a;e.default=s})),Ji=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"t",{value:!0}),Object.defineProperty(e,"Deque",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"HashMap",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"HashSet",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(e,"LinkList",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"OrderedMap",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(e,"OrderedSet",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"PriorityQueue",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"Queue",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"Stack",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"Vector",{enumerable:!0,get:function(){return i.default}});var t=f(Pi()),r=f(Mi()),n=f(Bi()),i=f(ji()),o=f(Di()),a=f(Fi()),s=f(Vi()),u=f(zi()),l=f(Gi()),c=f(Qi());function f(e){return e&&e.t?e:{default:e}}})),Xi=X((function(e,t){zt(),Ot(),ee();var r=Ji().OrderedSet,n=di()("number-allocator:trace"),i=di()("number-allocator:error");function o(e,t){this.low=e,this.high=t}function a(e,t){if(!(this instanceof a))return new a(e,t);this.min=e,this.max=t,this.ss=new r([],(function(e,t){return e.compare(t)})),n("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},a.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},a.prototype.alloc=function(){if(0===this.ss.size())return n("alloc():empty"),null;var e=this.ss.begin(),t=e.pointer.low,r=e.pointer.high,i=t;return i+1<=r?this.ss.updateKeyByIterator(e,new o(t+1,r)):this.ss.eraseElementByPos(0),n("alloc():"+i),i},a.prototype.use=function(e){var t=new o(e,e),r=this.ss.lowerBound(t);if(!r.equals(this.ss.end())){var i=r.pointer.low,a=r.pointer.high;return r.pointer.equals(t)?(this.ss.eraseElementByIterator(r),n("use():"+e),!0):!(i>e||(i===e?(this.ss.updateKeyByIterator(r,new o(i+1,a)),n("use():"+e),0):a===e?(this.ss.updateKeyByIterator(r,new o(i,a-1)),n("use():"+e),0):(this.ss.updateKeyByIterator(r,new o(e+1,a)),this.ss.insert(new o(i,e-1)),n("use():"+e),0)))}return n("use():failed"),!1},a.prototype.free=function(e){if(e<this.min||e>this.max)i("free():"+e+" is out of range");else{var 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();var a=r.pointer.high;r.pointer.high+1===e?this.ss.updateKeyByIterator(r,new o(a,e)):this.ss.insert(t)}else if(r.equals(this.ss.begin()))if(e+1===r.pointer.low){var s=r.pointer.high;this.ss.updateKeyByIterator(r,new o(e,s))}else this.ss.insert(t);else{var u=r.pointer.low,l=r.pointer.high;r.pre();var c=r.pointer.low;r.pointer.high+1===e?e+1===u?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new o(c,l))):this.ss.updateKeyByIterator(r,new o(c,e)):e+1===u?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new o(e,l))):this.ss.insert(t)}n("free():"+e)}},a.prototype.clear=function(){n("clear()"),this.ss.clear(),this.ss.insert(new o(this.min,this.max))},a.prototype.intervalCount=function(){return this.ss.size()},a.prototype.dump=function(){var e=!0,t=!1,r=void 0;try{for(var n,i=this.ss[Symbol.iterator]();!(e=(n=i.next()).done);e=!0)n.value}catch(e){t=!0,r=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw r}}},t.exports=a})),$i=X((function(e,t){zt(),Ot(),ee();var r=Xi();t.exports.NumberAllocator=r})),Zi=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0});var t=xi(),r=$i();e.default=function(){"use strict";function e(n){(0,w.default)(this,e),n>0&&(this.aliasToTopic=new t.LRUCache({max:n}),this.topicToAlias={},this.numberAllocator=new r.NumberAllocator(1,n),this.max=n,this.length=0)}return(0,x.default)(e,[{key:"put",value:function(e,t){if(0===t||t>this.max)return!1;var 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}},{key:"getTopicByAlias",value:function(e){return this.aliasToTopic.get(e)}},{key:"getAliasByTopic",value:function(e){var t=this.topicToAlias[e];return(void 0===t?"undefined":(0,F.default)(t))<"u"&&this.aliasToTopic.get(t),t}},{key:"clear",value:function(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}},{key:"getLruAlias",value:function(){return this.numberAllocator.firstVacant()||(0,D.default)(this.aliasToTopic.keys())[this.aliasToTopic.size-1]}}]),e}()})),eo=X((function(e){zt(),Ot(),ee();var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var r=Ii(),n=t(Zi()),i=Ci();e.default=function(e,t){e.log("_handleConnack");var o=e.options,a=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 n.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===a)e.reconnecting=!1,e._onConnect(t);else if(a>0){var s=new i.ErrorWithReasonCode("Connection refused: "+r.ReasonCodes[a],a);e.emit("error",s)}}})),to=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e,t,r){e.log("handling pubrel packet");var n=(void 0===r?"undefined":(0,F.default)(r))<"u"?r:e.noop,i={cmd:"pubcomp",messageId:t.messageId};e.incomingStore.get(t,(function(t,r){t?e._sendPacket(i,n):(e.emit("message",r.topic,r.payload,r),e.handleMessage(r,(function(t){if(t)return n(t);e.incomingStore.del(r,e.noop),e._sendPacket(i,n)})))}))}})),ro=X((function(e){zt(),Ot(),ee();var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var r=t(Ai()),n=t(Ri()),i=t(eo()),o=t(Ii()),a=t(to());e.default=function(e,t,s){var u=e.options;if(5===u.protocolVersion&&u.properties&&u.properties.maximumPacketSize&&u.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,s);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":e.reschedulePing(),(0,o.default)(e,t),s();break;case"pubrel":e.reschedulePing(),(0,a.default)(e,t,s);break;case"connack":(0,i.default)(e,t),s();break;case"auth":e.reschedulePing(),(0,n.default)(e,t),s();break;case"pingresp":e.log("_handlePacket :: received pingresp"),e.reschedulePing(),s();break;case"disconnect":e.emit("disconnect",t),s();break;default:e.log("_handlePacket :: unknown command"),s()}}})),no=X((function(e){zt(),Ot(),ee();var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.TypedEventEmitter=void 0;var r=t((Tr(),Z(mr))),n=Ci(),i=function e(){"use strict";(0,w.default)(this,e)};e.TypedEventEmitter=i,(0,n.applyMixin)(i,r.default)})),io=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.isReactNativeBrowser=e.isWebWorker=void 0;var t,r=function(){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"))},n=function(){return(void 0===v?"undefined":(0,F.default)(v))<"u"&&"ReactNative"===v.product},i=("undefined"==typeof window?"undefined":(0,F.default)(window))<"u"&&((void 0===v?"undefined":(0,F.default)(v))<"u"&&(null===(t=v.userAgent)||void 0===t?void 0:t.toLowerCase().indexOf(" electron/"))>-1&&null!=te&&te.versions?!{}.hasOwnProperty.call(te.versions,"electron"):(0,F.default)(window.document)<"u")||r()||n()||(void 0===v?"undefined":(0,F.default)(v))<"u"&&"txiki.js"===v.userAgent;e.isWebWorker=r(),e.isReactNativeBrowser=n(),e.default=i})),oo=X((function(e,t){var r,n;zt(),Ot(),ee(),r=e,n=function(e){var t,r=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,i=2*n,o=new WeakMap,a=function(e,t){return function(o){var a=t.get(o),s=void 0===a?o.size:a<i?a+1:0;if(!o.has(s))return e(o,s);if(o.size<n){for(;o.has(s);)s=Math.floor(Math.random()*i);return e(o,s)}if(o.size>r)throw Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;o.has(s);)s=Math.floor(Math.random()*r);return e(o,s)}}((t=o,function(e,r){return t.set(e,r),r}),o),s=function(e){return function(t){var r=e(t);return t.add(r),r}}(a);e.addUniqueNumber=s,e.generateUniqueNumber=a},"object"==typeof e&&(void 0===t?"undefined":(0,F.default)(t))<"u"?n(e):"function"==typeof define&&define.amd?define(["exports"],n):n((r=("undefined"==typeof globalThis?"undefined":(0,F.default)(globalThis))<"u"?globalThis:r||self).fastUniqueNumbers={})})),ao=X((function(e,t){var r,n;zt(),Ot(),ee(),r=e,n=function(e,t){e.load=function(e){var r=new Map([[0,function(){}]]),n=new Map([[0,function(){}]]),i=new Map,o=new Worker(e);return o.addEventListener("message",(function(e){var t=e.data;if(function(e){return void 0!==e.method&&"call"===e.method}(t)){var o=t.params,a=o.timerId,s=o.timerType;if("interval"===s){var u=r.get(a);if("number"==typeof u){var l=i.get(u);if(void 0===l||l.timerId!==a||l.timerType!==s)throw Error("The timer is in an undefined state.")}else{if(!((void 0===u?"undefined":(0,F.default)(u))<"u"))throw Error("The timer is in an undefined state.");u()}}else if("timeout"===s){var c=n.get(a);if("number"==typeof c){var f=i.get(c);if(void 0===f||f.timerId!==a||f.timerType!==s)throw Error("The timer is in an undefined state.")}else{if(!((void 0===c?"undefined":(0,F.default)(c))<"u"))throw Error("The timer is in an undefined state.");c(),n.delete(a)}}}else{if(!function(e){return null===e.error&&"number"==typeof e.id}(t)){var h=t.error.message;throw Error(h)}var d=t.id,p=i.get(d);if(void 0===p)throw Error("The timer is in an undefined state.");var v=p.timerId,g=p.timerType;i.delete(d),"interval"===g?r.delete(v):n.delete(v)}})),{clearInterval:function(e){var n=t.generateUniqueNumber(i);i.set(n,{timerId:e,timerType:"interval"}),r.set(e,n),o.postMessage({id:n,method:"clear",params:{timerId:e,timerType:"interval"}})},clearTimeout:function(e){var r=t.generateUniqueNumber(i);i.set(r,{timerId:e,timerType:"timeout"}),n.set(e,r),o.postMessage({id:r,method:"clear",params:{timerId:e,timerType:"timeout"}})},setInterval:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=t.generateUniqueNumber(r);return r.set(i,(function(){e(),"function"==typeof r.get(i)&&o.postMessage({id:null,method:"set",params:{delay:n,now:performance.now(),timerId:i,timerType:"interval"}})})),o.postMessage({id:null,method:"set",params:{delay:n,now:performance.now(),timerId:i,timerType:"interval"}}),i},setTimeout:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=t.generateUniqueNumber(n);return n.set(i,e),o.postMessage({id:null,method:"set",params:{delay:r,now:performance.now(),timerId:i,timerType:"timeout"}}),i}}}},"object"==typeof e&&(void 0===t?"undefined":(0,F.default)(t))<"u"?n(e,oo()):"function"==typeof define&&define.amd?define(["exports","fast-unique-numbers"],n):n((r=("undefined"==typeof globalThis?"undefined":(0,F.default)(globalThis))<"u"?globalThis:r||self).workerTimersBroker={},r.fastUniqueNumbers)})),so=X((function(e,t){var r,n;zt(),Ot(),ee(),r=e,n=function(e,t){var r,n,i=(r=t.load,n=null,function(){if(null!==n)return n;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 n=r(t),setTimeout((function(){return URL.revokeObjectURL(t)})),n});e.clearInterval=function(e){return i().clearInterval(e)},e.clearTimeout=function(e){return i().clearTimeout(e)},e.setInterval=function(){var e;return(e=i()).setInterval.apply(e,arguments)},e.setTimeout=function(){var e;return(e=i()).setTimeout.apply(e,arguments)}},"object"==typeof e&&(void 0===t?"undefined":(0,F.default)(t))<"u"?n(e,ao()):"function"==typeof define&&define.amd?define(["exports","worker-timers-broker"],n):n((r=("undefined"==typeof globalThis?"undefined":(0,F.default)(globalThis))<"u"?globalThis:r||self).workerTimers={},r.workerTimersBroker)})),uo=X((function(e){zt(),Ot(),ee();var t=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n};Object.defineProperty(e,"__esModule",{value:!0});var i=n(io()),o=so(),a={set:o.setInterval,clear:o.clearInterval},s={set:function(e,t){return setInterval(e,t)},clear:function(e){return clearInterval(e)}};e.default=function(e){switch(e){case"native":return s;case"worker":return a;default:return!i.default||i.isWebWorker||i.isReactNativeBrowser?s:a}}})),lo=X((function(e){zt(),Ot(),ee();var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var r=t(uo());e.default=function(){"use strict";function e(t,n){(0,w.default)(this,e),this.destroyed=!1,this.client=t,this.timer="object"==typeof n&&"set"in n&&"clear"in n?n:(0,r.default)(n),this.setKeepalive(t.options.keepalive)}return(0,x.default)(e,[{key:"keepaliveTimeoutTimestamp",get:function(){return this._keepaliveTimeoutTimestamp}},{key:"intervalEvery",get:function(){return this._intervalEvery}},{key:"keepalive",get:function(){return this._keepalive}},{key:"clear",value:function(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}},{key:"setKeepalive",value:function(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 ".concat(e,"ms"))}},{key:"destroy",value:function(){this.clear(),this.destroyed=!0}},{key:"reschedule",value:function(){var e=this;if(!this.destroyed){this.clear(),this.counter=0;var t=Math.ceil(1.5*this._keepalive);this._keepaliveTimeoutTimestamp=Date.now()+t,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set((function(){e.destroyed||(e.counter+=1,2===e.counter?e.client.sendPing():e.counter>2&&e.client.onKeepaliveTimeout())}),this._intervalEvery)}}}]),e}()})),co=X((function(e){zt(),Ot(),ee();var t=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n},i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var o=i(Kt()),a=i(mi()),s=i(_i()),u=oi(),l=i(ki()),c=n(Ei()),f=i(di()),h=i(Si()),d=i(ro()),p=Ci(),v=no(),y=i(lo()),b=n(io()),m=globalThis.setImmediate||function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.shift();(0,p.nextTick)((function(){n.apply(void 0,(0,D.default)(t))}))},_={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:"auto"},k=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,n){var i;for(var u in(0,w.default)(this,r),(i=t.call(this)).options=n||{},_)(0,F.default)(i.options[u])>"u"?i.options[u]=_[u]:i.options[u]=n[u];return i.log=i.options.log||(0,f.default)("mqttjs:client"),i.noop=i._noop.bind((0,g.default)(i)),i.log("MqttClient :: version:",r.VERSION),b.isWebWorker?i.log("MqttClient :: environment","webworker"):i.log("MqttClient :: environment",b.default?"browser":"node"),i.log("MqttClient :: options.protocol",n.protocol),i.log("MqttClient :: options.protocolVersion",n.protocolVersion),i.log("MqttClient :: options.username",n.username),i.log("MqttClient :: options.keepalive",n.keepalive),i.log("MqttClient :: options.reconnectPeriod",n.reconnectPeriod),i.log("MqttClient :: options.rejectUnauthorized",n.rejectUnauthorized),i.log("MqttClient :: options.properties.topicAliasMaximum",n.properties?n.properties.topicAliasMaximum:void 0),i.options.clientId="string"==typeof n.clientId?n.clientId:r.defaultId(),i.log("MqttClient :: clientId",i.options.clientId),i.options.customHandleAcks=5===n.protocolVersion&&n.customHandleAcks?n.customHandleAcks:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t[3](null,0)},i.options.writeCache||(a.default.writeToStream.cacheNumbers=!1),i.streamBuilder=e,i.messageIdProvider=(0,F.default)(i.options.messageIdProvider)>"u"?new s.default:i.options.messageIdProvider,i.outgoingStore=n.outgoingStore||new h.default,i.incomingStore=n.incomingStore||new h.default,i.queueQoSZero=void 0===n.queueQoSZero||n.queueQoSZero,i._resubscribeTopics={},i.messageIdToTopic={},i.keepaliveManager=null,i.connected=!1,i.disconnecting=!1,i.reconnecting=!1,i.queue=[],i.connackTimer=null,i.reconnectTimer=null,i._storeProcessing=!1,i._packetIdsDuringStoreProcessing={},i._storeProcessingQueue=[],i.outgoing={},i._firstConnection=!0,n.properties&&n.properties.topicAliasMaximum>0&&(n.properties.topicAliasMaximum>65535?i.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):i.topicAliasRecv=new o.default(n.properties.topicAliasMaximum)),i.on("connect",(function(){var e=(0,g.default)(i).queue,t=function(){var r,n=e.shift();if(i.log("deliver :: entry %o",n),n){r=n.packet,i.log("deliver :: call _sendPacket for %o",r);var o=!0;r.messageId&&0!==r.messageId&&(i.messageIdProvider.register(r.messageId)||(o=!1)),o?i._sendPacket(r,(function(e){n.cb&&n.cb(e),t()})):(i.log("messageId: %d has already used. The message is skipped and removed.",r.messageId),t())}else i._resubscribe()};i.log("connect :: sending queued packets"),t()})),i.on("close",(function(){i.log("close :: connected set to `false`"),i.connected=!1,i.log("close :: clearing connackTimer"),clearTimeout(i.connackTimer),i._destroyKeepaliveManager(),i.topicAliasRecv&&i.topicAliasRecv.clear(),i.log("close :: calling _setupReconnect"),i._setupReconnect()})),i.options.manualConnect||(i.log("MqttClient :: setting up stream"),i.connect()),(0,U.default)(i)}return(0,x.default)(r,[{key:"handleAuth",value:function(e,t){t()}},{key:"handleMessage",value:function(e,t){t()}},{key:"_nextId",value:function(){return this.messageIdProvider.allocate()}},{key:"getLastMessageId",value:function(){return this.messageIdProvider.getLastAllocated()}},{key:"connect",value:function(){var e,t=this,r=new u.Writable,n=a.default.parser(this.options),i=null,o=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),n.on("packet",(function(e){t.log("parser :: on packet push to packets array."),o.push(e)}));var s=function(){t.log("work :: getting next packet in queue");var e=o.shift();if(e)t.log("work :: packet pulled from queue"),(0,d.default)(t,e,l);else{t.log("work :: no packets in queue");var r=i;i=null,t.log("work :: done flag is %s",!!r),r&&r()}},l=function(){if(o.length)(0,p.nextTick)(s);else{var e=i;i=null,e()}};r._write=function(e,r,o){i=o,t.log("writable stream :: parsing buffer"),n.parse(e),s()},this.log("connect :: pipe stream to writable stream"),this.stream.pipe(r),this.stream.on("error",(function(e){t.log("streamErrorHandler :: error",e.message),e.code?(t.log("streamErrorHandler :: emitting error"),t.emit("error",e)):t.noop(e)})),this.stream.on("close",(function(){t.log("(%s)stream :: on close",t.options.clientId),t._flushVolatile(),t.log("stream: emit close to MqttClient"),t.emit("close")})),this.log("connect: sending packet `connect`");var c={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&&(c.will=Object.assign(Object.assign({},this.options.will),{payload:null===(e=this.options.will)||void 0===e?void 0:e.payload})),this.topicAliasRecv&&(c.properties||(c.properties={}),this.topicAliasRecv&&(c.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(c),n.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end((function(){return t.emit("error",Error("Packet has no Authentication Method"))})),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket){var f=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(f)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){t.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),t.emit("error",Error("connack timeout")),t._cleanUp(!0)}),this.options.connectTimeout),this}},{key:"publish",value:function(e,t,r,n){var i=this;this.log("publish :: message `%s` to topic `%s`",t,e);var o=this.options;"function"==typeof r&&(n=r,r=null),r=r||{};var a=(r=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),r)).qos,s=r.retain,u=r.dup,l=r.properties,c=r.cbStorePut;if(this._checkDisconnecting(n))return this;var f=function(){var r=0;if((1===a||2===a)&&null===(r=i._nextId()))return i.log("No messageId left"),!1;var f={cmd:"publish",topic:e,payload:t,qos:a,retain:s,messageId:r,dup:u};switch(5===o.protocolVersion&&(f.properties=l),i.log("publish :: qos",a),a){case 1:case 2:i.outgoing[f.messageId]={volatile:!1,cb:n||i.noop},i.log("MqttClient:publish: packet cmd: %s",f.cmd),i._sendPacket(f,void 0,c);break;default:i.log("MqttClient:publish: packet cmd: %s",f.cmd),i._sendPacket(f,n,c)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!f())&&this._storeProcessingQueue.push({invoke:f,cbStorePut:r.cbStorePut,callback:n}),this}},{key:"publishAsync",value:function(e,t,r){var n=this;return new Promise((function(i,o){n.publish(e,t,r,(function(e,t){e?o(e):i(t)}))}))}},{key:"subscribe",value:function(e,t,r){var n=this,i=this.options.protocolVersion;"function"==typeof t&&(r=t),r=r||this.noop;var o=!1,a=[];"string"==typeof e?a=e=[e]:Array.isArray(e)?a=e:"object"==typeof e&&(o=e.resubscribe,delete e.resubscribe,a=Object.keys(e));var s=c.validateTopics(a);if(null!==s)return m(r,Error("Invalid topic "+s)),this;if(this._checkDisconnecting(r))return this.log("subscribe: discconecting true"),this;var u={qos:0};5===i&&(u.nl=!1,u.rap=!1,u.rh=0);var l=(t=Object.assign(Object.assign({},u),t)).properties,f=[],h=function(e,r){if(r=r||t,!{}.hasOwnProperty.call(n._resubscribeTopics,e)||n._resubscribeTopics[e].qos<r.qos||o){var a={topic:e,qos:r.qos};5===i&&(a.nl=r.nl,a.rap=r.rap,a.rh=r.rh,a.properties=l),n.log("subscribe: pushing topic `%s` and qos `%s` to subs list",a.topic,a.qos),f.push(a)}};if(Array.isArray(e)?e.forEach((function(e){n.log("subscribe: array topic %s",e),h(e)})):Object.keys(e).forEach((function(t){n.log("subscribe: object topic %s, %o",t,e[t]),h(t,e[t])})),!f.length)return r(null,[]),this;var d=function(){var e=n._nextId();if(null===e)return n.log("No messageId left"),!1;var t={cmd:"subscribe",subscriptions:f,messageId:e};if(l&&(t.properties=l),n.options.resubscribe){n.log("subscribe :: resubscribe true");var o=[];f.forEach((function(e){if(n.options.reconnectPeriod>0){var t={qos:e.qos};5===i&&(t.nl=e.nl||!1,t.rap=e.rap||!1,t.rh=e.rh||0,t.properties=e.properties),n._resubscribeTopics[e.topic]=t,o.push(e.topic)}})),n.messageIdToTopic[t.messageId]=o}return n.outgoing[t.messageId]={volatile:!0,cb:function(e,t){if(!e)for(var n=t.granted,i=0;i<n.length;i+=1)f[i].qos=n[i];r(e,f)}},n.log("subscribe :: call _sendPacket"),n._sendPacket(t),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!d())&&this._storeProcessingQueue.push({invoke:d,callback:r}),this}},{key:"subscribeAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.subscribe(e,t,(function(e,t){e?i(e):n(t)}))}))}},{key:"unsubscribe",value:function(e,t,r){var n=this;"string"==typeof e&&(e=[e]),"function"==typeof t&&(r=t),r=r||this.noop;var i=c.validateTopics(e);if(null!==i)return m(r,Error("Invalid topic "+i)),this;if(this._checkDisconnecting(r))return this;var o=function(){var i=n._nextId();if(null===i)return n.log("No messageId left"),!1;var o={cmd:"unsubscribe",messageId:i,unsubscriptions:[]};return"string"==typeof e?o.unsubscriptions=[e]:Array.isArray(e)&&(o.unsubscriptions=e),n.options.resubscribe&&o.unsubscriptions.forEach((function(e){delete n._resubscribeTopics[e]})),"object"==typeof t&&t.properties&&(o.properties=t.properties),n.outgoing[o.messageId]={volatile:!0,cb:r},n.log("unsubscribe: call _sendPacket"),n._sendPacket(o),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:r}),this}},{key:"unsubscribeAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.unsubscribe(e,t,(function(e,t){e?i(e):n(t)}))}))}},{key:"end",value:function(e,t,r){var n=this;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);var i=function(){n.log("end :: closeStores: closing incoming and outgoing stores"),n.disconnected=!0,n.incomingStore.close((function(e){n.outgoingStore.close((function(t){if(n.log("end :: closeStores: emitting end"),n.emit("end"),r){var i=e||t;n.log("end :: closeStores: invoking callback with args"),r(i)}}))})),n._deferredReconnect&&n._deferredReconnect()},o=function(){n.log("end :: (%s) :: finish :: calling _cleanUp with force %s",n.options.clientId,e),n._cleanUp(e,(function(){n.log("end :: finish :: calling process.nextTick on closeStores"),(0,p.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,o,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),o()),this)}},{key:"endAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.end(e,t,(function(e){e?i(e):n()}))}))}},{key:"removeOutgoingMessage",value:function(e){if(this.outgoing[e]){var t=this.outgoing[e].cb;this._removeOutgoingAndStoreMessage(e,(function(){t(Error("Message removed"))}))}return this}},{key:"reconnect",value:function(e){var t=this;this.log("client reconnect");var r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new h.default,t.outgoingStore=t.options.outgoingStore||new h.default,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this}},{key:"_flushVolatile",value:function(){var e=this;this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach((function(t){e.outgoing[t].volatile&&"function"==typeof e.outgoing[t].cb&&(e.outgoing[t].cb(Error("Connection closed")),delete e.outgoing[t])})))}},{key:"_flush",value:function(){var e=this;this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach((function(t){"function"==typeof e.outgoing[t].cb&&(e.outgoing[t].cb(Error("Connection closed")),delete e.outgoing[t])})))}},{key:"_removeTopicAliasAndRecoverTopicName",value:function(e){var t;e.properties&&(t=e.properties.topicAlias);var r=e.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",t,r),0===r.length){if((void 0===t?"undefined":(0,F.default)(t))>"u")return Error("Unregistered Topic Alias");if((void 0===(r=this.topicAliasSend.getTopicByAlias(t))?"undefined":(0,F.default)(r))>"u")return Error("Unregistered Topic Alias");e.topic=r}t&&delete e.properties.topicAlias}},{key:"_checkDisconnecting",value:function(e){return this.disconnecting&&(e&&e!==this.noop?e(Error("client disconnecting")):this.emit("error",Error("client disconnecting"))),this.disconnecting}},{key:"_reconnect",value:function(){var e=this;this.log("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((function(){e.connect()})),this.log("client already connected. disconnecting first.")):(this.log("_reconnect: calling connect"),this.connect())}},{key:"_setupReconnect",value:function(){var e=this;!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((function(){e.log("reconnectTimer :: reconnect triggered!"),e._reconnect()}),this.options.reconnectPeriod)):this.log("_setupReconnect :: doing nothing...")}},{key:"_clearReconnect",value:function(){this.log("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}},{key:"_cleanUp",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this;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{var i=Object.assign({cmd:"disconnect"},r);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(i,(function(){n.log("_cleanUp :: (%s) :: destroying stream",n.options.clientId),m((function(){n.stream.end((function(){n.log("_cleanUp :: (%s) :: stream destroyed",n.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())}},{key:"_storeAndSend",value:function(e,t,r){var n=this;this.log("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);var i,o=e;if("publish"===o.cmd&&(o=(0,l.default)(e),i=this._removeTopicAliasAndRecoverTopicName(o)))return t&&t(i);this.outgoingStore.put(o,(function(i){if(i)return t&&t(i);r(),n._writePacket(e,t)}))}},{key:"_applyTopicAlias",value:function(e){if(5===this.options.protocolVersion&&"publish"===e.cmd){var t;e.properties&&(t=e.properties.topicAlias);var 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))?(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))&&(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")}}},{key:"_noop",value:function(e){this.log("noop ::",e)}},{key:"_writePacket",value:function(e,t){this.log("_writePacket :: packet: %O",e),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",e),this.log("_writePacket :: writing to stream");var 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())}},{key:"_sendPacket",value:function(e,t,r,n){this.log("_sendPacket :: (%s) ::  start",this.options.clientId),r=r||this.noop,t=t||this.noop;var i=this._applyTopicAlias(e);if(i)t(i);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(n)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)}}}},{key:"_storePacket",value:function(e,t,r){this.log("_storePacket :: packet: %o",e),this.log("_storePacket :: cb? %s",!!t),r=r||this.noop;var n=e;if("publish"===n.cmd){n=(0,l.default)(e);var i=this._removeTopicAliasAndRecoverTopicName(n);if(i)return t&&t(i)}var o=n.qos||0;0===o&&this.queueQoSZero||"publish"!==n.cmd?this.queue.push({packet:n,cb:t}):o>0?(t=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,(function(e){if(e)return t&&t(e);r()}))):t&&t(Error("No connection to broker"))}},{key:"_setupKeepaliveManager",value:function(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new y.default(this,this.options.timerVariant))}},{key:"_destroyKeepaliveManager",value:function(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}},{key:"reschedulePing",value:function(){this.keepaliveManager&&this.options.keepalive&&this.options.reschedulePings&&this._reschedulePing()}},{key:"_reschedulePing",value:function(){this.log("_reschedulePing :: rescheduling ping"),this.keepaliveManager.reschedule()}},{key:"sendPing",value:function(){this.log("_sendPing :: sending pingreq"),this._sendPacket({cmd:"pingreq"})}},{key:"onKeepaliveTimeout",value:function(){this.emit("error",Error("Keepalive timeout")),this.log("onKeepaliveTimeout :: calling _cleanUp with force true"),this._cleanUp(!0)}},{key:"_resubscribe",value:function(){this.log("_resubscribe");var 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(var t=0;t<e.length;t++){var 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}},{key:"_onConnect",value:function(e){var t=this;if(this.disconnected)this.emit("connect",e);else{this.connackPacket=e,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;var r=function(){var n=t.outgoingStore.createStream(),i=function(){n.destroy(),n=null,t._flushStoreProcessingQueue(),o()},o=function(){t._storeProcessing=!1,t._packetIdsDuringStoreProcessing={}};t.once("close",i),n.on("error",(function(e){o(),t._flushStoreProcessingQueue(),t.removeListener("close",i),t.emit("error",e)}));var a=function(){if(n){var e,r=n.read(1);r?(t._storeProcessing=!0,t._packetIdsDuringStoreProcessing[r.messageId]?a():t.disconnecting||t.reconnectTimer?n.destroy&&n.destroy():(e=t.outgoing[r.messageId]?t.outgoing[r.messageId].cb:null,t.outgoing[r.messageId]={volatile:!1,cb:function(t,r){e&&e(t,r),a()}},t._packetIdsDuringStoreProcessing[r.messageId]=!0,t.messageIdProvider.register(r.messageId)?t._sendPacket(r,void 0,void 0,!0):t.log("messageId: %d has already used.",r.messageId))):n.once("readable",a)}};n.on("end",(function(){var n=!0;for(var a in t._packetIdsDuringStoreProcessing)if(!t._packetIdsDuringStoreProcessing[a]){n=!1;break}t.removeListener("close",i),n?(o(),t._invokeAllStoreProcessingQueue(),t.emit("connect",e)):r()})),a()};r()}}},{key:"_invokeStoreProcessingQueue",value:function(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){var e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1}},{key:"_invokeAllStoreProcessingQueue",value:function(){for(;this._invokeStoreProcessingQueue(););}},{key:"_flushStoreProcessingQueue",value:function(){var e=!0,t=!1,r=void 0;try{for(var n,i=this._storeProcessingQueue[Symbol.iterator]();!(e=(n=i.next()).done);e=!0){var o=n.value;o.cbStorePut&&o.cbStorePut(Error("Connection closed")),o.callback&&o.callback(Error("Connection closed"))}}catch(e){t=!0,r=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw r}}this._storeProcessingQueue.splice(0)}},{key:"_removeOutgoingAndStoreMessage",value:function(e,t){var r=this;delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(n,i){t(n,i),r.messageIdProvider.deallocate(e),r._invokeStoreProcessingQueue()}))}}],[{key:"defaultId",value:function(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}}]),r}(v.TypedEventEmitter);k.VERSION=p.MQTTJS_VERSION,e.default=k})),fo=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0});var t=$i();e.default=function(){"use strict";function e(){(0,w.default)(this,e),this.numberAllocator=new t.NumberAllocator(1,65535)}return(0,x.default)(e,[{key:"allocate",value:function(){return this.lastId=this.numberAllocator.alloc(),this.lastId}},{key:"getLastAllocated",value:function(){return this.lastId}},{key:"register",value:function(e){return this.numberAllocator.use(e)}},{key:"deallocate",value:function(e){this.numberAllocator.free(e)}},{key:"clear",value:function(){this.numberAllocator.clear()}}]),e}()}));function ho(e){throw new RangeError(mo[e])}function po(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+function(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}((e=e.replace(bo,".")).split("."),t).join(".")}function vo(e){for(var t=[],r=0,n=e.length;r<n;){var i=e.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){var o=e.charCodeAt(r++);56320==(64512&o)?t.push(((1023&i)<<10)+(1023&o)+65536):(t.push(i),r--)}else t.push(i)}return t}var go,yo,bo,mo,_o,wo,ko,Eo,So,Ao,To,Co=J((function(){zt(),Ot(),ee(),go=/^xn--/,yo=/[^\0-\x7E]/,bo=/[\x2E\u3002\uFF0E\uFF61]/g,mo={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_o=Math.floor,wo=String.fromCharCode,ko=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},Eo=function(e,t,r){var n=0;for(e=r?_o(e/700):e>>1,e+=_o(e/t);e>455;n+=36)e=_o(e/35);return _o(n+36*e/(e+38))},Ao=function(e){var t=[],r=(e=vo(e)).length,n=128,i=0,o=72,a=!0,s=!1,u=void 0;try{for(var l,c=e[Symbol.iterator]();!(a=(l=c.next()).done);a=!0){var f=l.value;f<128&&t.push(wo(f))}}catch(e){s=!0,u=e}finally{try{a||null==c.return||c.return()}finally{if(s)throw u}}var h=t.length,d=h;for(h&&t.push("-");d<r;){var p=2147483647,v=!0,g=!1,y=void 0;try{for(var b,m=e[Symbol.iterator]();!(v=(b=m.next()).done);v=!0){var _=b.value;_>=n&&_<p&&(p=_)}}catch(e){g=!0,y=e}finally{try{v||null==m.return||m.return()}finally{if(g)throw y}}var w=d+1;p-n>_o((2147483647-i)/w)&&ho("overflow"),i+=(p-n)*w,n=p;var k=!0,E=!1,S=void 0;try{for(var A,T=e[Symbol.iterator]();!(k=(A=T.next()).done);k=!0){var C=A.value;if(C<n&&++i>2147483647&&ho("overflow"),C==n){for(var I=i,R=36;;R+=36){var x=R<=o?1:R>=o+26?26:R-o;if(I<x)break;var O=I-x,P=36-x;t.push(wo(ko(x+O%P,0))),I=_o(O/P)}t.push(wo(ko(I,0))),o=Eo(i,w,d==h),i=0,++d}}}catch(e){E=!0,S=e}finally{try{k||null==T.return||T.return()}finally{if(E)throw S}}++i,++n}return t.join("")},To={version:"2.1.0",ucs2:{decode:vo,encode:function(e){var t;return(t=String).fromCodePoint.apply(t,(0,D.default)(e))}},decode:So=function(e){var t,r,n=[],i=e.length,o=0,a=128,s=72,u=e.lastIndexOf("-");u<0&&(u=0);for(var l=0;l<u;++l)e.charCodeAt(l)>=128&&ho("not-basic"),n.push(e.charCodeAt(l));for(var c=u>0?u+1:0;c<i;){for(var f=o,h=1,d=36;;d+=36){c>=i&&ho("invalid-input");var p=(r=e.charCodeAt(c++))-48<10?r-22:r-65<26?r-65:r-97<26?r-97:36;(p>=36||p>_o((2147483647-o)/h))&&ho("overflow"),o+=p*h;var v=d<=s?1:d>=s+26?26:d-s;if(p<v)break;var g=36-v;h>_o(2147483647/g)&&ho("overflow"),h*=g}var y=n.length+1;s=Eo(o-f,y,0==f),_o(o/y)>2147483647-a&&ho("overflow"),a+=_o(o/y),o%=y,n.splice(o++,0,a)}return(t=String).fromCodePoint.apply(t,(0,D.default)(n))},encode:Ao,toASCII:function(e){return po(e,(function(e){return yo.test(e)?"xn--"+Ao(e):e}))},toUnicode:function(e){return po(e,(function(e){return go.test(e)?So(e.slice(4).toLowerCase()):e}))}},To.toASCII,To.toUnicode,To.ucs2,To.version}));function Io(e,t){return{}.hasOwnProperty.call(e,t)}var Ro,xo,Oo,Po,Mo=J((function(){zt(),Ot(),ee(),Ro=function(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var u=0;u<s;++u){var l,c,f,h,d=e[u].replace(o,"%20"),p=d.indexOf(r);p>=0?(l=d.substr(0,p),c=d.substr(p+1)):(l=d,c=""),f=decodeURIComponent(l),h=decodeURIComponent(c),Io(i,f)?Array.isArray(i[f])?i[f].push(h):i[f]=[i[f],h]:i[f]=h}return i},xo=function(e){switch(void 0===e?"undefined":(0,F.default)(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},Oo=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(n){var i=encodeURIComponent(xo(n))+r;return Array.isArray(e[n])?e[n].map((function(e){return i+encodeURIComponent(xo(e))})).join(t):i+encodeURIComponent(xo(e[n]))})).join(t):n?encodeURIComponent(xo(n))+r+encodeURIComponent(xo(e)):""},(Po={}).decode=Po.parse=Ro,Po.encode=Po.stringify=Oo,Po.decode,Po.encode,Po.parse,Po.stringify}));function Bo(){throw Error("setTimeout has not been defined")}function Lo(){throw Error("clearTimeout has not been defined")}function No(e){if(qo===setTimeout)return setTimeout(e,0);if((qo===Bo||!qo)&&setTimeout)return qo=setTimeout,setTimeout(e,0);try{return qo(e,0)}catch(t){try{return qo.call(null,e,0)}catch(t){return qo.call(this||Vo,e,0)}}}function Uo(){Go&&Ko&&(Go=!1,Ko.length?Yo=Ko.concat(Yo):Qo=-1,Yo.length&&jo())}function jo(){if(!Go){var e=No(Uo);Go=!0;for(var t=Yo.length;t;){for(Ko=Yo,Yo=[];++Qo<t;)Ko&&Ko[Qo].run();Qo=-1,t=Yo.length}Ko=null,Go=!1,function(e){if(Ho===clearTimeout)return clearTimeout(e);if((Ho===Lo||!Ho)&&clearTimeout)return Ho=clearTimeout,clearTimeout(e);try{Ho(e)}catch(t){try{return Ho.call(null,e)}catch(t){return Ho.call(this||Vo,e)}}}(e)}}function Do(e,t){(this||Vo).fun=e,(this||Vo).array=t}function Fo(){}var Wo,qo,Ho,Vo,zo,Ko,Yo,Go,Qo,Jo,Xo,$o,Zo,ea,ta,ra,na,ia=J((function(){zt(),Ot(),ee(),Vo=("undefined"==typeof globalThis?"undefined":(0,F.default)(globalThis))<"u"?globalThis:("undefined"==typeof self?"undefined":(0,F.default)(self))<"u"?self:e,zo=Wo={},function(){try{qo="function"==typeof setTimeout?setTimeout:Bo}catch(e){qo=Bo}try{Ho="function"==typeof clearTimeout?clearTimeout:Lo}catch(e){Ho=Lo}}(),Yo=[],Go=!1,Qo=-1,zo.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];Yo.push(new Do(e,t)),1!==Yo.length||Go||No(jo)},Do.prototype.run=function(){(this||Vo).fun.apply(null,(this||Vo).array)},zo.title="browser",zo.browser=!0,zo.env={},zo.argv=[],zo.version="",zo.versions={},zo.on=Fo,zo.addListener=Fo,zo.once=Fo,zo.off=Fo,zo.removeListener=Fo,zo.removeAllListeners=Fo,zo.emit=Fo,zo.prependListener=Fo,zo.prependOnceListener=Fo,zo.listeners=function(){return[]},zo.binding=function(){throw Error("process.binding is not supported")},zo.cwd=function(){return"/"},zo.chdir=function(){throw Error("process.chdir is not supported")},zo.umask=function(){return 0},(Jo=Wo).binding,Jo.browser,Jo.chdir,Jo.cwd,Jo.emit,Jo.env,Jo.listeners,Jo.nextTick,Jo.off,Jo.on,Jo.once,Jo.prependListener,Jo.prependOnceListener,Jo.removeAllListeners,Jo.removeListener,Jo.title,Jo.umask,Jo.version,Jo.versions})),oa=J((function(){zt(),Ot(),ee(),Xo={},$o=!1,Zo=("undefined"==typeof globalThis?"undefined":(0,F.default)(globalThis))<"u"?globalThis:("undefined"==typeof self?"undefined":(0,F.default)(self))<"u"?self:e,(ea=function(){if($o)return Xo;$o=!0;var e,t,r=Xo={};function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!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||Zo,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{t="function"==typeof clearTimeout?clearTimeout:i}catch(e){t=i}}();var a,s=[],u=!1,l=-1;function c(){!u||!a||(u=!1,a.length?s=a.concat(s):l=-1,s.length&&f())}function f(){if(!u){var e=o(c);u=!0;for(var r=s.length;r;){for(a=s,s=[];++l<r;)a&&a[l].run();l=-1,r=s.length}a=null,u=!1,function(e){if(t===clearTimeout)return clearTimeout(e);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(e);try{t(e)}catch(r){try{return t.call(null,e)}catch(r){return t.call(this||Zo,e)}}}(e)}}function h(e,t){(this||Zo).fun=e,(this||Zo).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];s.push(new h(e,t)),1===s.length&&!u&&o(f)},h.prototype.run=function(){(this||Zo).fun.apply(null,(this||Zo).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=function(){return[]},r.binding=function(){throw Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw Error("process.chdir is not supported")},r.umask=function(){return 0},Xo}()).platform="browser",ea.addListener,ea.argv,ea.binding,ea.browser,ea.chdir,ea.cwd,ea.emit,ea.env,ea.listeners,ea.nextTick,ea.off,ea.on,ea.once,ea.prependListener,ea.prependOnceListener,ea.removeAllListeners,ea.removeListener,ea.title,ea.umask,ea.version,ea.versions})),aa=J((function(){zt(),Ot(),ee(),oa(),ta={},ra=!1,na=function(){if(ra)return ta;ra=!0;var e=ea;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,n="",i=0,o=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)r=e.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(o!==s-1&&1!==a)if(o!==s-1&&2===a){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=s,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var n,i="",o=!1,a=arguments.length-1;a>=-1&&!o;a--){var s;a>=0?s=arguments[a]:(void 0===n&&(n=e.cwd()),s=n),t(s),0!==s.length&&(i=s+"/"+i,o=47===s.charCodeAt(0))}return i=r(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0===(e=r(e,!n)).length&&!n&&(e="."),e.length>0&&i&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var i=arguments[r];t(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=n.resolve(e))===(r=n.resolve(r)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var o=e.length,a=o-i,s=1;s<r.length&&47===r.charCodeAt(s);++s);for(var u=r.length-s,l=a<u?a:u,c=-1,f=0;f<=l;++f){if(f===l){if(u>l){if(47===r.charCodeAt(s+f))return r.slice(s+f+1);if(0===f)return r.slice(s+f)}else a>l&&(47===e.charCodeAt(i+f)?c=f:0===f&&(c=0));break}var h=e.charCodeAt(i+f);if(h!==r.charCodeAt(s+f))break;47===h&&(c=f)}var d="";for(f=i+c+1;f<=o;++f)(f===o||47===e.charCodeAt(f))&&(0===d.length?d+="..":d+="/..");return d.length>0?d+r.slice(s+c):(s+=c,47===r.charCodeAt(s)&&++s,r.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,i=-1,o=!0,a=e.length-1;a>=1;--a)if(47===(r=e.charCodeAt(a))){if(!o){i=a;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,i=0,o=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var s=r.length-1,u=-1;for(n=e.length-1;n>=0;--n){var l=e.charCodeAt(n);if(47===l){if(!a){i=n+1;break}}else-1===u&&(a=!1,u=n+1),s>=0&&(l===r.charCodeAt(s)?-1==--s&&(o=n):(s=-1,o=u))}return i===o?o=u:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){i=n+1;break}}else-1===o&&(a=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){t(e);for(var r=-1,n=0,i=-1,o=!0,a=0,s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(47!==u)-1===i&&(o=!1,i=s+1),46===u?-1===r?r=s:1!==a&&(a=1):-1!==r&&(a=-1);else if(!o){n=s+1;break}}return-1===r||-1===i||0===a||1===a&&r===i-1&&r===n+1?"":e.slice(r,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+(void 0===e?"undefined":(0,F.default)(e)));return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,i=e.charCodeAt(0),o=47===i;o?(r.root="/",n=1):n=0;for(var a=-1,s=0,u=-1,l=!0,c=e.length-1,f=0;c>=n;--c)if(47!==(i=e.charCodeAt(c)))-1===u&&(l=!1,u=c+1),46===i?-1===a?a=c:1!==f&&(f=1):-1!==a&&(f=-1);else if(!l){s=c+1;break}return-1===a||-1===u||0===f||1===f&&a===u-1&&a===s+1?-1!==u&&(r.base=r.name=0===s&&o?e.slice(1,u):e.slice(s,u)):(0===s&&o?(r.name=e.slice(1,a),r.base=e.slice(1,u)):(r.name=e.slice(s,a),r.base=e.slice(s,u)),r.ext=e.slice(a,u)),s>0?r.dir=e.slice(0,s-1):o&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,ta=n}()})),sa={};function ua(){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 la(e,t,r){if(e&&ga.isObject(e)&&e instanceof ua)return e;var n=new ua;return n.parse(e,t,r),n}function ca(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 ja?function(e){for(var t=e.hostname,r=e.pathname,n=0;n<r.length;n++)if("%"===r[n]){var i=r.codePointAt(n+2)||32;if("2"===r[n+1]&&102===i||"5"===r[n+1]&&99===i)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(Da,"\\"),r=decodeURIComponent(r),""!==t)return"\\\\".concat(t).concat(r);var o=32|r.codePointAt(1),a=r[2];if(o<Na||o>Ua||":"!==a)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");for(var t=e.pathname,r=0;r<t.length;r++)if("%"===t[r]){var n=t.codePointAt(r+2)||32;if("2"===t[r+1]&&102===n)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(t)}(e)}function fa(e){var t=Pa.resolve(e),r=e.charCodeAt(e.length-1);(r===La||ja&&r===Ba)&&t[t.length-1]!==Pa.sep&&(t+="/");var n=new URL("file://");return t.includes("%")&&(t=t.replace(Fa,"%25")),!ja&&t.includes("\\")&&(t=t.replace(Wa,"%5C")),t.includes("\n")&&(t=t.replace(qa,"%0A")),t.includes("\r")&&(t=t.replace(Ha,"%0D")),t.includes("\t")&&(t=t.replace(Va,"%09")),n.pathname=t,n}function ha(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 rs?function(e){for(var t=e.hostname,r=e.pathname,n=0;n<r.length;n++)if("%"===r[n]){var i=r.codePointAt(n+2)||32;if("2"===r[n+1]&&102===i||"5"===r[n+1]&&99===i)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(ns,"\\"),r=decodeURIComponent(r),""!==t)return"\\\\".concat(t).concat(r);var o=32|r.codePointAt(1),a=r[2];if(o<es||o>ts||":"!==a)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");for(var t=e.pathname,r=0;r<t.length;r++)if("%"===t[r]){var n=t.codePointAt(r+2)||32;if("2"===t[r+1]&&102===n)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(t)}(e)}function da(e){var t=na.resolve(e),r=e.charCodeAt(e.length-1);(r===Za||rs&&r===$a)&&t[t.length-1]!==na.sep&&(t+="/");var n=new URL("file://");return t.includes("%")&&(t=t.replace(is,"%25")),!rs&&t.includes("\\")&&(t=t.replace(os,"%5C")),t.includes("\n")&&(t=t.replace(as,"%0A")),t.includes("\r")&&(t=t.replace(ss,"%0D")),t.includes("\t")&&(t=t.replace(us,"%09")),n.pathname=t,n}$(sa,{URL:function(){return Xa},Url:function(){return Ka},default:function(){return pa},fileURLToPath:function(){return ha},format:function(){return Ya},parse:function(){return Ja},pathToFileURL:function(){return da},resolve:function(){return Ga},resolveObject:function(){return Qa}});var pa,va,ga,ya,ba,ma,_a,wa,ka,Ea,Sa,Aa,Ta,Ca,Ia,Ra,xa,Oa,Pa,Ma,Ba,La,Na,Ua,ja,Da,Fa,Wa,qa,Ha,Va,za,Ka,Ya,Ga,Qa,Ja,Xa,$a,Za,es,ts,rs,ns,is,os,as,ss,us,ls=J((function(){zt(),Ot(),ee(),Co(),Mo(),ia(),aa(),oa(),va=To,ga={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}},(pa={}).parse=la,pa.resolve=function(e,t){return la(e,!1,!0).resolve(t)},pa.resolveObject=function(e,t){return e?la(e,!1,!0).resolveObject(t):t},pa.format=function(e){return ga.isString(e)&&(e=la(e)),e instanceof ua?e.format():ua.prototype.format.call(e)},pa.Url=ua,ya=/^([a-z0-9.+-]+:)/i,ba=/:[0-9]*$/,ma=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,_a=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),wa=["'"].concat(_a),ka=["%","/","?",";","#"].concat(wa),Ea=["/","?","#"],Sa=/^[+a-z0-9A-Z_-]{0,63}$/,Aa=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ta={javascript:!0,"javascript:":!0},Ca={javascript:!0,"javascript:":!0},Ia={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ra=Po,ua.prototype.parse=function(e,t,r){if(!ga.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+(void 0===e?"undefined":(0,F.default)(e)));var n=e.indexOf("?"),i=-1!==n&&n<e.indexOf("#")?"?":"#",o=e.split(i);o[0]=o[0].replace(/\\/g,"/");var a=e=o.join(i);if(a=a.trim(),!r&&1===e.split("#").length){var s=ma.exec(a);if(s)return this.path=a,this.href=a,this.pathname=s[1],s[2]?(this.search=s[2],this.query=t?Ra.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var u=ya.exec(a);if(u){var l=(u=u[0]).toLowerCase();this.protocol=l,a=a.substr(u.length)}if(r||u||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var c="//"===a.substr(0,2);!c||u&&Ca[u]||(a=a.substr(2),this.slashes=!0)}if(!Ca[u]&&(c||u&&!Ia[u])){for(var f,h,d=-1,p=0;p<Ea.length;p++)-1!==(v=a.indexOf(Ea[p]))&&(-1===d||v<d)&&(d=v);for(-1!==(h=-1===d?a.lastIndexOf("@"):a.lastIndexOf("@",d))&&(f=a.slice(0,h),a=a.slice(h+1),this.auth=decodeURIComponent(f)),d=-1,p=0;p<ka.length;p++){var v;-1!==(v=a.indexOf(ka[p]))&&(-1===d||v<d)&&(d=v)}-1===d&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var g="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!g)for(var y=this.hostname.split(/\./),b=(p=0,y.length);p<b;p++){var m=y[p];if(m&&!m.match(Sa)){for(var _="",w=0,k=m.length;w<k;w++)m.charCodeAt(w)>127?_+="x":_+=m[w];if(!_.match(Sa)){var E=y.slice(0,p),S=y.slice(p+1),A=m.match(Aa);A&&(E.push(A[1]),S.unshift(A[2])),S.length&&(a="/"+S.join(".")+a),this.hostname=E.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),g||(this.hostname=va.toASCII(this.hostname));var T=this.port?":"+this.port:"",C=this.hostname||"";this.host=C+T,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!Ta[l])for(p=0,b=wa.length;p<b;p++){var I=wa[p];if(-1!==a.indexOf(I)){var R=encodeURIComponent(I);R===I&&(R=escape(I)),a=a.split(I).join(R)}}var x=a.indexOf("#");-1!==x&&(this.hash=a.substr(x),a=a.slice(0,x));var O=a.indexOf("?");if(-1!==O?(this.search=a.substr(O),this.query=a.substr(O+1),t&&(this.query=Ra.parse(this.query)),a=a.slice(0,O)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Ia[l]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){T=this.pathname||"";var P=this.search||"";this.path=T+P}return this.href=this.format(),this},ua.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=e+this.host:this.hostname&&(i=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&ga.isObject(this.query)&&Object.keys(this.query).length&&(o=Ra.stringify(this.query));var a=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||Ia[t])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+i+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+n},ua.prototype.resolve=function(e){return this.resolveObject(la(e,!1,!0)).format()},ua.prototype.resolveObject=function(e){if(ga.isString(e)){var t=new ua;t.parse(e,!1,!0),e=t}for(var r=new ua,n=Object.keys(this),i=0;i<n.length;i++){var o=n[i];r[o]=this[o]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var a=Object.keys(e),s=0;s<a.length;s++){var u=a[s];"protocol"!==u&&(r[u]=e[u])}return Ia[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!Ia[e.protocol]){for(var l=Object.keys(e),c=0;c<l.length;c++){var f=l[c];r[f]=e[f]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||Ca[e.protocol])r.pathname=e.pathname;else{for(var h=(e.pathname||"").split("/");h.length&&!(e.host=h.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),r.pathname=h.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 v=r.pathname&&"/"===r.pathname.charAt(0),g=e.host||e.pathname&&"/"===e.pathname.charAt(0),y=g||v||r.host&&e.pathname,b=y,m=r.pathname&&r.pathname.split("/")||[],_=(h=e.pathname&&e.pathname.split("/")||[],r.protocol&&!Ia[r.protocol]);if(_&&(r.hostname="",r.port=null,r.host&&(""===m[0]?m[0]=r.host:m.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===h[0]?h[0]=e.host:h.unshift(e.host)),e.host=null),y=y&&(""===h[0]||""===m[0])),g)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,m=h;else if(h.length)m||(m=[]),m.pop(),m=m.concat(h),r.search=e.search,r.query=e.query;else if(!ga.isNullOrUndefined(e.search))return _&&(r.hostname=r.host=m.shift(),(A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift())),r.search=e.search,r.query=e.query,ga.isNull(r.pathname)&&ga.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!m.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var w=m.slice(-1)[0],k=(r.host||e.host||m.length>1)&&("."===w||".."===w)||""===w,E=0,S=m.length;S>=0;S--)"."===(w=m[S])?m.splice(S,1):".."===w?(m.splice(S,1),E++):E&&(m.splice(S,1),E--);if(!y&&!b)for(;E--;E)m.unshift("..");!y||""===m[0]||m[0]&&"/"===m[0].charAt(0)||m.unshift(""),k&&"/"!==m.join("/").substr(-1)&&m.push("");var A,T=""===m[0]||m[0]&&"/"===m[0].charAt(0);return _&&(r.hostname=r.host=T?"":m.length?m.shift():"",(A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift())),(y=y||r.host&&m.length)&&!T&&m.unshift(""),m.length?r.pathname=m.join("/"):(r.pathname=null,r.path=null),ga.isNull(r.pathname)&&ga.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},ua.prototype.parseHost=function(){var e=this.host,t=ba.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},pa.Url,pa.format,pa.resolve,pa.resolveObject,xa={},Oa=!1,Pa=function(){if(Oa)return xa;Oa=!0;var e=Jo;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,n="",i=0,o=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)r=e.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(o!==s-1&&1!==a)if(o!==s-1&&2===a){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=s,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var n,i="",o=!1,a=arguments.length-1;a>=-1&&!o;a--){var s;a>=0?s=arguments[a]:(void 0===n&&(n=e.cwd()),s=n),t(s),0!==s.length&&(i=s+"/"+i,o=47===s.charCodeAt(0))}return i=r(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0===(e=r(e,!n)).length&&!n&&(e="."),e.length>0&&i&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var i=arguments[r];t(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=n.resolve(e))===(r=n.resolve(r)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var o=e.length,a=o-i,s=1;s<r.length&&47===r.charCodeAt(s);++s);for(var u=r.length-s,l=a<u?a:u,c=-1,f=0;f<=l;++f){if(f===l){if(u>l){if(47===r.charCodeAt(s+f))return r.slice(s+f+1);if(0===f)return r.slice(s+f)}else a>l&&(47===e.charCodeAt(i+f)?c=f:0===f&&(c=0));break}var h=e.charCodeAt(i+f);if(h!==r.charCodeAt(s+f))break;47===h&&(c=f)}var d="";for(f=i+c+1;f<=o;++f)(f===o||47===e.charCodeAt(f))&&(0===d.length?d+="..":d+="/..");return d.length>0?d+r.slice(s+c):(s+=c,47===r.charCodeAt(s)&&++s,r.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,i=-1,o=!0,a=e.length-1;a>=1;--a)if(47===(r=e.charCodeAt(a))){if(!o){i=a;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,i=0,o=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var s=r.length-1,u=-1;for(n=e.length-1;n>=0;--n){var l=e.charCodeAt(n);if(47===l){if(!a){i=n+1;break}}else-1===u&&(a=!1,u=n+1),s>=0&&(l===r.charCodeAt(s)?-1==--s&&(o=n):(s=-1,o=u))}return i===o?o=u:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){i=n+1;break}}else-1===o&&(a=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){t(e);for(var r=-1,n=0,i=-1,o=!0,a=0,s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(47!==u)-1===i&&(o=!1,i=s+1),46===u?-1===r?r=s:1!==a&&(a=1):-1!==r&&(a=-1);else if(!o){n=s+1;break}}return-1===r||-1===i||0===a||1===a&&r===i-1&&r===n+1?"":e.slice(r,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+(void 0===e?"undefined":(0,F.default)(e)));return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,i=e.charCodeAt(0),o=47===i;o?(r.root="/",n=1):n=0;for(var a=-1,s=0,u=-1,l=!0,c=e.length-1,f=0;c>=n;--c)if(47!==(i=e.charCodeAt(c)))-1===u&&(l=!1,u=c+1),46===i?-1===a?a=c:1!==f&&(f=1):-1!==a&&(f=-1);else if(!l){s=c+1;break}return-1===a||-1===u||0===f||1===f&&a===u-1&&a===s+1?-1!==u&&(r.base=r.name=0===s&&o?e.slice(1,u):e.slice(s,u)):(0===s&&o?(r.name=e.slice(1,a),r.base=e.slice(1,u)):(r.name=e.slice(s,a),r.base=e.slice(s,u)),r.ext=e.slice(a,u)),s>0?r.dir=e.slice(0,s-1):o&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,xa=n}(),Ma=("undefined"==typeof Deno?"undefined":(0,F.default)(Deno))<"u"?"windows"===Deno.build.os?"win32":Deno.build.os:void 0,pa.URL=("undefined"==typeof URL?"undefined":(0,F.default)(URL))<"u"?URL:null,pa.pathToFileURL=fa,pa.fileURLToPath=ca,pa.Url,pa.format,pa.resolve,pa.resolveObject,pa.URL,Ba=92,La=47,Na=97,Ua=122,ja="win32"===Ma,Da=/\//g,Fa=/%/g,Wa=/\\/g,qa=/\n/g,Ha=/\r/g,Va=/\t/g,za=("undefined"==typeof Deno?"undefined":(0,F.default)(Deno))<"u"?"windows"===Deno.build.os?"win32":Deno.build.os:void 0,pa.URL=("undefined"==typeof URL?"undefined":(0,F.default)(URL))<"u"?URL:null,pa.pathToFileURL=da,pa.fileURLToPath=ha,Ka=pa.Url,Ya=pa.format,Ga=pa.resolve,Qa=pa.resolveObject,Ja=pa.parse,Xa=pa.URL,$a=92,Za=47,es=97,ts=122,rs="win32"===za,ns=/\//g,is=/%/g,os=/\\/g,as=/\n/g,ss=/\r/g,us=/\t/g})),cs={};function fs(){throw Error("Node.js net module is not supported by JSPM core outside of Node.js")}$(cs,{Server:function(){return fs},Socket:function(){return fs},Stream:function(){return fs},_createServerHandle:function(){return fs},_normalizeArgs:function(){return fs},_setSimultaneousAccepts:function(){return fs},connect:function(){return fs},createConnection:function(){return fs},createServer:function(){return fs},default:function(){return hs},isIP:function(){return fs},isIPv4:function(){return fs},isIPv6:function(){return fs}});var hs,ds=J((function(){zt(),Ot(),ee(),hs={_createServerHandle:fs,_normalizeArgs:fs,_setSimultaneousAccepts:fs,connect:fs,createConnection:fs,createServer:fs,isIP:fs,isIPv4:fs,isIPv6:fs,Server:fs,Socket:fs,Stream:fs}})),ps=X((function(e){zt(),Ot(),ee();var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var r=t((ds(),Z(cs))),n=(0,t(di()).default)("mqttjs:tcp");e.default=function(e,t){t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost";var i=t.port,o=t.path,a=t.hostname;return n("port %d and host %s",i,a),r.default.createConnection({port:i,host:a,path:o})}})),vs={};$(vs,{default:function(){return gs}});var gs,ys,bs=J((function(){zt(),Ot(),ee(),gs={}})),ms=X((function(e){zt(),Ot(),ee();var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var r=t((bs(),Z(vs))),n=t((ds(),Z(cs))),i=(0,t(di()).default)("mqttjs:tls");e.default=function(e,t){t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",0===n.default.isIP(t.host)&&(t.servername=t.host),t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,i("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized);var o=r.default.connect(t);function a(r){t.rejectUnauthorized&&e.emit("error",r),o.end()}return o.on("secureConnect",(function(){t.rejectUnauthorized&&!o.authorized?o.emit("error",Error("TLS not authorized")):o.removeListener("error",a)})),o.on("error",a),o}})),_s=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0}),e.BufferedDuplex=e.writev=void 0;var t=oi(),r=(Vt(),Z(Pt));function n(e,t){for(var n=Array(e.length),i=0;i<e.length;i++)"string"==typeof e[i].chunk?n[i]=r.Buffer.from(e[i].chunk,"utf8"):n[i]=e[i].chunk;this._write(r.Buffer.concat(n),"binary",t)}e.writev=n;var i=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e,i,o){var a;return(0,w.default)(this,r),(a=t.call(this,{objectMode:!0})).proxy=i,a.socket=o,a.writeQueue=[],e.objectMode||(a._writev=n.bind((0,g.default)(a))),a.isSocketOpen=!1,a.proxy.on("data",(function(e){a.push(e)})),(0,U.default)(a)}return(0,x.default)(r,[{key:"_read",value:function(e){this.proxy.read(e)}},{key:"_write",value:function(e,t,r){this.isSocketOpen?this.writeToProxy(e,t,r):this.writeQueue.push({chunk:e,encoding:t,cb:r})}},{key:"_final",value:function(e){this.writeQueue=[],this.proxy.end(e)}},{key:"_destroy",value:function(e,t){this.writeQueue=[],this.proxy.destroy(),t(e)}},{key:"socketReady",value:function(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}},{key:"writeToProxy",value:function(e,t,r){!1===this.proxy.write(e,t)?this.proxy.once("drain",r):r()}},{key:"processWriteQueue",value:function(){for(;this.writeQueue.length>0;){var e=this.writeQueue.shift(),t=e.chunk,r=e.encoding,n=e.cb;this.writeToProxy(t,r,n)}}}]),r}(t.Duplex);e.BufferedDuplex=i})),ws=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0});var t,r,n,i=(Vt(),Z(Pt)),o=oi(),a=_s();e.default=function(e,s){if(s.hostname=s.hostname||s.host,!s.hostname)throw Error("Could not determine host. Specify host manually.");var u="MQIsdp"===s.protocolId&&3===s.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(s);var l,c=function(e,t){var r="wxs"===e.protocol?"wss":"ws",n="".concat(r,"://").concat(e.hostname).concat(e.path);return e.port&&80!==e.port&&443!==e.port&&(n="".concat(r,"://").concat(e.hostname,":").concat(e.port).concat(e.path)),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(s,e);t=wx.connectSocket({url:c,protocols:[u]}),(l=new o.Transform)._write=function(e,r,n){t.send({data:e.buffer,success:function(){n()},fail:function(e){n(Error(e))}})},l._flush=function(e){t.close({success:function(){e()}})},r=l,(n=new a.BufferedDuplex(s,r,t))._destroy=function(e,r){t.close({success:function(){r&&r(e)}})};var f=n.destroy;return n.destroy=function(e,r){return n.destroy=f,setTimeout((function(){t.close({fail:function(){n._destroy(e,r)}})}),0),n},t.onOpen((function(){n.socketReady()})),t.onMessage((function(e){var t=e.data;t=t instanceof ArrayBuffer?i.Buffer.from(t):i.Buffer.from(t,"utf8"),r.push(t)})),t.onClose((function(){n.emit("close"),n.end(),n.destroy()})),t.onError((function(e){var t=Error(e.errMsg);n.destroy(t)})),n}})),ks=X((function(e){zt(),Ot(),ee(),Object.defineProperty(e,"__esModule",{value:!0});var t,r,n,i=(Vt(),Z(Pt)),o=oi(),a=_s(),s=!1;e.default=function(e,u){if(u.hostname=u.hostname||u.host,!u.hostname)throw Error("Could not determine host. Specify host manually.");var l="MQIsdp"===u.protocolId&&3===u.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(u);var c,f=function(e,t){var r="alis"===e.protocol?"wss":"ws",n="".concat(r,"://").concat(e.hostname).concat(e.path);return e.port&&80!==e.port&&443!==e.port&&(n="".concat(r,"://").concat(e.hostname,":").concat(e.port).concat(e.path)),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(u,e);return(t=u.my).connectSocket({url:f,protocols:l}),(c=new o.Transform)._write=function(e,r,n){t.sendSocketMessage({data:e.buffer,success:function(){n()},fail:function(){n(Error())}})},c._flush=function(e){t.closeSocket({success:function(){e()}})},r=c,n=new a.BufferedDuplex(u,r,t),s||(s=!0,t.onSocketOpen((function(){n.socketReady()})),t.onSocketMessage((function(e){if("string"==typeof e.data){var t=i.Buffer.from(e.data,"base64");r.push(t)}else{var n=new FileReader;n.addEventListener("load",(function(){var e=n.result;e=e instanceof ArrayBuffer?i.Buffer.from(e):i.Buffer.from(e,"utf8"),r.push(e)})),n.readAsArrayBuffer(e.data)}})),t.onSocketClose((function(){n.end(),n.destroy()})),t.onSocketError((function(e){n.destroy(e)}))),n}})),Es=X((function(e,t){zt(),Ot(),ee(),t.exports=function(){throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}})),Ss=X((function(e){zt(),Ot(),ee();var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var r=(Vt(),Z(Pt)),n=t(Es()),i=t(di()),o=oi(),a=t(io()),s=_s(),u=(0,i.default)("mqttjs:ws"),l=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function c(e,t){var r="".concat(e.protocol,"://").concat(e.hostname,":").concat(e.port).concat(e.path);return"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function f(e){var t=e;return e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),!a.default&&"wss"===e.protocol&&l.forEach((function(r){({}).hasOwnProperty.call(e,r)&&!{}.hasOwnProperty.call(e.wsOptions,r)&&(t.wsOptions[r]=e[r])})),t}e.default=a.default?function(e,t){u("browserStreamBuilder");var n,i=function(e){var t=f(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if(("undefined"==typeof document?"undefined":(0,F.default)(document))>"u")throw Error("Could not determine host. Specify host manually.");var r=new URL(document.URL);t.hostname=r.hostname,t.port||(t.port=Number(r.port))}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}(t).browserBufferSize||524288,a=t.browserBufferTimeout||1e3,l=!t.objectMode,h=function(e,t){var r,n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt",i=c(t,e);return(r=t.createWebsocket?t.createWebsocket(i,[n],t):new WebSocket(i,[n])).binaryType="arraybuffer",r}(e,t),d=function(e,t,r){var n=new o.Transform({objectMode:e.objectMode});return n._write=t,n._flush=function(e){h.close(),e()},n}(t,(function e(t,n,o){if(h.bufferedAmount>i)setTimeout(e,a,t,n,o);else{l&&"string"==typeof t&&(t=r.Buffer.from(t,"utf8"));try{h.send(t)}catch(e){return o(e)}o()}}));t.objectMode||(d._writev=s.writev.bind(d)),d.on("close",(function(){h.close()}));var p=(0,F.default)(h.addEventListener)<"u";function v(){u("WebSocket onOpen"),n instanceof s.BufferedDuplex&&n.socketReady()}function g(e){u("WebSocket onClose",e),n.end(),n.destroy()}function y(e){u("WebSocket onError",e);var t=Error("WebSocket error");t.event=e,n.destroy(t)}function b(e){var t=e.data;t=t instanceof ArrayBuffer?r.Buffer.from(t):r.Buffer.from(t,"utf8"),d.push(t)}return h.readyState===h.OPEN?(n=d).socket=h:(n=new s.BufferedDuplex(t,d,h),p?h.addEventListener("open",v):h.onopen=v),p?(h.addEventListener("close",g),h.addEventListener("error",y),h.addEventListener("message",b)):(h.onclose=g,h.onerror=y,h.onmessage=b),n}:function(e,t){u("streamBuilder");var r=f(t);r.hostname=r.hostname||r.host||"localhost";var i=c(r,e),o=function(e,t,r){u("createWebSocket"),u("protocol: ".concat(r.protocolId," ").concat(r.protocolVersion));var i="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return u("creating new Websocket for url: ".concat(t," and protocol: ").concat(i)),r.createWebsocket?r.createWebsocket(t,[i],r):new n.default(t,[i],r.wsOptions)}(0,i,r),a=n.default.createWebSocketStream(o,r.wsOptions);return a.url=i,o.on("close",(function(){a.destroy()})),a}})),As=X((function(e){zt(),Ot(),ee();var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.connectAsync=void 0;var r=t(di()),n=t((ls(),Z(sa))),i=t(co()),o=t(io());"function"!=typeof(null==te?void 0:te.nextTick)&&(te.nextTick=setImmediate);var a=(0,r.default)("mqttjs"),s={};function u(e,t){var r,o,u,l;if(a("connecting to an MQTT broker..."),"object"==typeof e&&!t&&(t=e,e=""),t=t||{},e&&"string"==typeof e){var c=n.default.parse(e,!0),f={};if(null!=c.port&&(f.port=Number(c.port)),f.host=c.hostname,f.query=c.query,f.auth=c.auth,f.protocol=c.protocol,f.path=c.path,f.protocol=null===(r=f.protocol)||void 0===r?void 0:r.replace(/:$/,""),!(t=Object.assign(Object.assign({},f),t)).protocol)throw Error("Missing protocol")}if(t.unixSocket=t.unixSocket||(null===(o=t.protocol)||void 0===o?void 0:o.includes("+unix")),t.unixSocket?t.protocol=t.protocol.replace("+unix",""):null!==(u=t.protocol)&&void 0!==u&&u.startsWith("ws")||null!==(l=t.protocol)&&void 0!==l&&l.startsWith("wx")||delete t.path,function(e){var t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(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: "'.concat(t.protocol,'"!'))}}if(!s[t.protocol]){var h=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(e,t){return(!h||t%2!=0)&&"function"==typeof s[e]}))[0]}if(!1===t.clean&&!t.clientId)throw Error("Missing clientId for unclean clients");t.protocol&&(t.defaultProtocol=t.protocol);var d=new i.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++),a("calling streambuilder for",t.protocol),s[t.protocol](e,t)}),t);return d.on("error",(function(){})),d}o.default?(s.wx=ws().default,s.wxs=ws().default,s.ali=ks().default,s.alis=ks().default):(s.mqtt=ps().default,s.tcp=ps().default,s.ssl=ms().default,s.tls=s.ssl,s.mqtts=ms().default),s.ws=Ss().default,s.wss=Ss().default,e.connectAsync=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return new Promise((function(n,i){var o=u(e,t),a={connect:function(){s(),n(o)},end:function(){s(),n(o)},error:function(e){s(),o.end(),i(e)}};function s(){Object.keys(a).forEach((function(e){o.off(e,a[e])}))}!1===r&&(a.close=function(){a.error(Error("Couldn't connect to server"))}),Object.keys(a).forEach((function(e){o.on(e,a[e])}))}))},e.default=u})),Ts=X((function(e){zt(),Ot(),ee();var t=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n},i=e&&e.__exportStar||function(e,r){for(var n in e)"default"!==n&&!{}.hasOwnProperty.call(r,n)&&t(r,e,n)},o=e&&e.__importDefault||function(e){return 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=o(co());e.MqttClient=a.default;var s=o(_i());e.DefaultMessageIdProvider=s.default;var u=o(fo());e.UniqueMessageIdProvider=u.default;var l=o(Si());e.Store=l.default;var c=n(As());e.connect=c.default,Object.defineProperty(e,"connectAsync",{enumerable:!0,get:function(){return c.connectAsync}});var f=o(lo());e.KeepaliveManager=f.default,e.Client=a.default,i(co(),e),i(Ci(),e);var h=Ii();Object.defineProperty(e,"ReasonCodes",{enumerable:!0,get:function(){return h.ReasonCodes}})})),Cs=X((function(e){zt(),Ot(),ee();var t=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n},i=e&&e.__exportStar||function(e,r){for(var n in e)"default"!==n&&!{}.hasOwnProperty.call(r,n)&&t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(Ts());e.default=o,i(Ts(),e)})),Is=Cs(),Rs="Trystero",xs=function(e,t){return Array(e).fill().map(t)},Os=xs(20,(function(){return"0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"[Math.floor(62*Math.random())]})).join(""),Ps=Promise.all.bind(Promise),Ms=Object.entries,Bs=Object.fromEntries,Ls=Object.keys,Ns=function(){},Us=function(e){return Error("".concat(Rs,": ").concat(e))},js=new TextEncoder,Ds=new TextDecoder,Fs=function(e){return js.encode(e)},Ws=function(e){return Ds.decode(e)},qs=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.join("@")},Hs=JSON.stringify,Vs=JSON.parse,zs="AES-GCM",Ks={},Ys=(ys=(0,m.default)((function(e){var t,r,n;return(0,V.__generator)(this,(function(i){switch(i.label){case 0:return Ks[e]?[2,Ks[e]]:(r=Array.from,n=Uint8Array.bind,[4,crypto.subtle.digest("SHA-1",Fs(e))]);case 1:return t=r.apply(Array,[new(n.apply(Uint8Array,[void 0,i.sent()]))]).map((function(e){return e.toString(36)})).join(""),[2,(Ks[e]=t,t)]}}))})),function(e){return ys.apply(this,arguments)}),Gs=function(){var e=(0,m.default)((function(e,t){var r,n,i,o,a,s;return(0,V.__generator)(this,(function(u){switch(u.label){case 0:return r=crypto.getRandomValues(new Uint8Array(16)),i=r.join(",")+"$",a=(o=crypto.subtle).encrypt,s=[{name:zs,iv:r}],[4,e];case 1:return[4,a.apply(o,s.concat([u.sent(),Fs(t)]))];case 2:return[2,i+(n=u.sent(),btoa(String.fromCharCode.apply(null,new Uint8Array(n))))]}}))}));return function(t,r){return e.apply(this,arguments)}}(),Qs=function(){var e=(0,m.default)((function(e,t){var r,n,i,o,a,s;return(0,V.__generator)(this,(function(u){switch(u.label){case 0:return r=(0,j.default)(t.split("$"),2),n=r[0],i=r[1],a=(o=crypto.subtle).decrypt,s=[{name:zs,iv:new Uint8Array(n.split(","))}],[4,e];case 1:return[4,a.apply(o,s.concat([u.sent(),function(e){var t=atob(e);return new Uint8Array(t.length).map((function(e,r){return t.charCodeAt(r)})).buffer}(i)]))];case 2:return[2,Ws.apply(void 0,[u.sent()])]}}))}));return function(t,r){return e.apply(this,arguments)}}();function Js(e){return e&&e.__esModule&&{}.hasOwnProperty.call(e,"default")?e.default:e}var Xs,$s,Zs,eu,tu,ru={exports:{}};Zs=ru,(eu=ru.exports).formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Zs.exports.humanize(this.diff),this.useColors){var t="color: "+this.color;e.splice(1,0,t,"color: inherit");var r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(r++,"%c"===e&&(n=r))})),e.splice(n,0,t)}},eu.save=function(e){try{e?eu.storage.setItem("debug",e):eu.storage.removeItem("debug")}catch(e){}},eu.load=function(){var e;try{e=eu.storage.getItem("debug")}catch(e){}return!e&&void 0!==z&&"env"in z&&(e=void 0),e},eu.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},eu.storage=function(){try{return localStorage}catch(e){}}(),eu.destroy=(tu=!1,function(){tu||(tu=!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`."))}),eu.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"],eu.log=console.debug||console.log||function(){},Zs.exports=function(e){function t(e){var n,i,o,a=null;function s(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];if(s.enabled){var o=s,a=Number(new Date),u=a-(n||a);o.diff=u,o.prev=n,o.curr=a,n=a,r[0]=t.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var l=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(e,n){if("%%"===e)return"%";l++;var i=t.formatters[n];if("function"==typeof i){var a=r[l];e=i.call(o,a),r.splice(l,1),l--}return e})),t.formatArgs.call(o,r),(o.log||t.log).apply(o,r)}}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:function(){return null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o)},set:function(e){a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,r){var n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){var e=(0,D.default)(t.names.map(n)).concat((0,D.default)(t.skips.map(n).map((function(e){return"-"+e})))).join(",");return t.enable(""),e},t.enable=function(e){var r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(RegExp("^"+e.slice(1)+"$")):t.names.push(RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=function(){if($s)return Xs;$s=1;var e=1e3,t=60*e,r=60*t,n=24*r;function i(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}return Xs=function(o,a){a=a||{};var s=void 0===o?"undefined":(0,F.default)(o);if("string"===s&&o.length>0)return function(i){if(!((i+="").length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(o){var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(o);if("number"===s&&isFinite(o))return a.long?function(o){var a=Math.abs(o);return a>=n?i(o,a,n,"day"):a>=r?i(o,a,r,"hour"):a>=t?i(o,a,t,"minute"):a>=e?i(o,a,e,"second"):o+" ms"}(o):function(i){var o=Math.abs(i);return o>=n?Math.round(i/n)+"d":o>=r?Math.round(i/r)+"h":o>=t?Math.round(i/t)+"m":o>=e?Math.round(i/e)+"s":i+"ms"}(o);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))},Xs}(),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((function(r){t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}(eu),Zs.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}};var nu,iu=Js(ru.exports),ou="undefined"!=typeof window?window:self,au=ou.RTCPeerConnection||ou.mozRTCPeerConnection||ou.webkitRTCPeerConnection,su=ou.RTCSessionDescription||ou.mozRTCSessionDescription||ou.webkitRTCSessionDescription,uu=ou.RTCIceCandidate||ou.mozRTCIceCandidate||ou.webkitRTCIceCandidate,lu={exports:{}},cu="object"==typeof Reflect?Reflect:null,fu=cu&&"function"==typeof cu.apply?cu.apply:function(e,t,r){return function(){}.apply.call(e,t,r)};nu=cu&&"function"==typeof cu.ownKeys?cu.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var hu=Number.isNaN||function(e){return e!=e};function du(){du.init.call(this)}lu.exports=du,lu.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}Eu(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&Eu(e,"error",t,{once:!0})}(e,i)}))},du.EventEmitter=du,du.prototype._events=void 0,du.prototype._eventsCount=0,du.prototype._maxListeners=void 0;var pu=10;function vu(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+(void 0===e?"undefined":(0,F.default)(e)))}function gu(e){return void 0===e._maxListeners?du.defaultMaxListeners:e._maxListeners}function yu(e,t,r,n){var i,o,a,s;if(vu(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),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=gu(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function bu(){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 mu(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=bu.bind(n);return i.listener=r,n.wrapFn=i,i}function _u(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):ku(i,i.length)}function wu(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 ku(e,t){for(var r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Eu(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+(void 0===e?"undefined":(0,F.default)(e)));e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(du,"defaultMaxListeners",{enumerable:!0,get:function(){return pu},set:function(e){if("number"!=typeof e||e<0||hu(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");pu=e}}),du.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},du.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||hu(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},du.prototype.getMaxListeners=function(){return gu(this)},du.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)fu(s,this,t);else{var u=s.length,l=ku(s,u);for(r=0;r<u;++r)fu(l[r],this,t)}return!0},du.prototype.addListener=function(e,t){return yu(this,e,t,!1)},du.prototype.on=du.prototype.addListener,du.prototype.prependListener=function(e,t){return yu(this,e,t,!0)},du.prototype.once=function(e,t){return vu(t),this.on(e,mu(this,e,t)),this},du.prototype.prependOnceListener=function(e,t){return vu(t),this.prependListener(e,mu(this,e,t)),this},du.prototype.removeListener=function(e,t){var r,n,i,o,a;if(vu(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},du.prototype.off=du.prototype.removeListener,du.prototype.removeAllListeners=function(e){var t,r,n;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 i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);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(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},du.prototype.listeners=function(e){return _u(this,e,!0)},du.prototype.rawListeners=function(e){return _u(this,e,!1)},du.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):wu.call(e,t)},du.prototype.listenerCount=wu,du.prototype.eventNames=function(){return this._eventsCount>0?nu(this._events):[]};var Su=lu.exports,Au="function"==typeof queueMicrotask?queueMicrotask:function(e){return Promise.resolve().then(e)},Tu=function(){"use strict";function e(t){if((0,w.default)(this,e),!(t>0)||t-1&t)throw Error("Max size for a FixedFIFO should be a power of two");this.buffer=Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}return(0,x.default)(e,[{key:"clear",value:function(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0)}},{key:"push",value:function(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}},{key:"shift",value:function(){var e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}},{key:"peek",value:function(){return this.buffer[this.btm]}},{key:"isEmpty",value:function(){return void 0===this.buffer[this.btm]}}]),e}(),Cu=function(){"use strict";function e(t){(0,w.default)(this,e),this.decoder=new TextDecoder("utf16le"===t?"utf16-le":t)}return(0,x.default)(e,[{key:"decode",value:function(e){return this.decoder.decode(e,{stream:!0})}},{key:"flush",value:function(){return this.decoder.decode(new Uint8Array(0))}}]),e}(),Iu=Cu,Ru=Cu,xu=Su.EventEmitter,Ou=Error("Stream was destroyed"),Pu=Au,Mu=function(){"use strict";function e(t){(0,w.default)(this,e),this.hwm=t||16,this.head=new Tu(this.hwm),this.tail=this.head,this.length=0}return(0,x.default)(e,[{key:"clear",value:function(){this.head=this.tail,this.head.clear(),this.length=0}},{key:"push",value:function(e){if(this.length++,!this.head.push(e)){var t=this.head;this.head=t.next=new Tu(2*this.head.buffer.length),this.head.push(e)}}},{key:"shift",value:function(){0!==this.length&&this.length--;var e=this.tail.shift();if(void 0===e&&this.tail.next){var t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return e}},{key:"peek",value:function(){var e=this.tail.peek();return void 0===e&&this.tail.next?this.tail.next.peek():e}},{key:"isEmpty",value:function(){return 0===this.length}}]),e}(),Bu=function(){"use strict";function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"utf8";switch((0,w.default)(this,e),this.encoding=function(e){switch(e=e.toLowerCase()){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:throw Error("Unknown encoding: "+e)}}(t),this.encoding){case"utf8":this.decoder=new Ru;break;case"utf16le":case"base64":throw Error("Unsupported encoding: "+this.encoding);default:this.decoder=new Iu(this.encoding)}}return(0,x.default)(e,[{key:"push",value:function(e){return"string"==typeof e?e:this.decoder.decode(e)}},{key:"write",value:function(e){return this.push(e)}},{key:"end",value:function(e){var t="";return e&&(t=this.push(e)),t+this.decoder.flush()}}]),e}(),Lu=536870910,Nu=16384,Uu=32768,ju=131072,Du=536870143,Fu=536838143,Wu=536739839,qu=524288,Hu=1048576,Vu=2097152,zu=8388608,Ku=16777216,Yu=33554432,Gu=469499903,Qu=503316479,Ju=262160,Xu=8404992,$u=8405006,Zu=33587200,el=33587215,tl=270794767,rl=Symbol.asyncIterator||Symbol(),nl=function(){"use strict";function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.highWaterMark,i=void 0===n?16384:n,o=r.map,a=void 0===o?null:o,s=r.mapWritable,u=r.byteLength,l=r.byteLengthWritable;(0,w.default)(this,e),this.stream=t,this.queue=new Mu,this.highWaterMark=i,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=l||u||_l,this.map=s||a,this.afterWrite=ll.bind(this),this.afterUpdateNextTick=hl.bind(this)}return(0,x.default)(e,[{key:"ended",get:function(){return!!(this.stream._duplexState&zu)}},{key:"push",value:function(e){return null!==this.map&&(e=this.map(e)),this.buffered+=this.byteLength(e),this.queue.push(e),this.buffered<this.highWaterMark?(this.stream._duplexState|=Vu,!0):(this.stream._duplexState|=6291456,!1)}},{key:"shift",value:function(){var e=this.queue.shift();return this.buffered-=this.byteLength(e),0===this.buffered&&(this.stream._duplexState&=534773759),e}},{key:"end",value:function(e){"function"==typeof e?this.stream.once("finish",e):null!=e&&this.push(e),this.stream._duplexState=535822335&this.stream._duplexState|134217728}},{key:"autoBatch",value:function(e,t){var r=[],n=this.stream;for(r.push(e);2359296==(n._duplexState&tl);)r.push(n._writableState.shift());if(15&n._duplexState)return t(null);n._writev(r,t)}},{key:"update",value:function(){var e=this.stream;e._duplexState|=qu;do{for(;(e._duplexState&tl)===Vu;){var t=this.shift();e._duplexState|=67371008,e._write(t,this.afterWrite)}1310720&e._duplexState||this.updateNonPrimary()}while(!0===this.continueUpdate());e._duplexState&=536346623}},{key:"updateNonPrimary",value:function(){var e=this.stream;if(134217728==(144965647&e._duplexState))return e._duplexState=402653183&e._duplexState|262144,void e._final(sl.bind(this));4!=(14&e._duplexState)?1==(e._duplexState&el)&&(e._duplexState=(e._duplexState|Ju)&Lu,e._open(dl.bind(this))):e._duplexState&Zu||(e._duplexState|=Ju,e._destroy(ul.bind(this)))}},{key:"continueUpdate",value:function(){return!!(this.stream._duplexState&Yu)&&(this.stream._duplexState&=Qu,!0)}},{key:"updateCallback",value:function(){(35127311&this.stream._duplexState)===Hu?this.update():this.updateNextTick()}},{key:"updateNextTick",value:function(){this.stream._duplexState&Yu||(this.stream._duplexState|=Yu,this.stream._duplexState&qu||Pu(this.afterUpdateNextTick))}}]),e}(),il=function(){"use strict";function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.highWaterMark,i=void 0===n?16384:n,o=r.map,a=void 0===o?null:o,s=r.mapReadable,u=r.byteLength,l=r.byteLengthReadable;(0,w.default)(this,e),this.stream=t,this.queue=new Mu,this.highWaterMark=0===i?1:i,this.buffered=0,this.readAhead=i>0,this.error=null,this.pipeline=null,this.byteLength=l||u||_l,this.map=s||a,this.pipeTo=null,this.afterRead=cl.bind(this),this.afterUpdateNextTick=fl.bind(this)}return(0,x.default)(e,[{key:"ended",get:function(){return!!(this.stream._duplexState&Nu)}},{key:"pipe",value:function(e,t){if(null!==this.pipeTo)throw Error("Can only pipe to one destination");if("function"!=typeof t&&(t=null),this.stream._duplexState|=512,this.pipeTo=e,this.pipeline=new ol(this.stream,e,t),t&&this.stream.on("error",wl),ml(e))e._writableState.pipeline=this.pipeline,t&&e.on("error",wl),e.on("finish",this.pipeline.finished.bind(this.pipeline));else{var r=this.pipeline.done.bind(this.pipeline,e),n=this.pipeline.done.bind(this.pipeline,e,null);e.on("error",r),e.on("close",n),e.on("finish",this.pipeline.finished.bind(this.pipeline))}e.on("drain",al.bind(this)),this.stream.emit("piping",e),e.emit("pipe",this.stream)}},{key:"push",value:function(e){var t=this.stream;return null===e?(this.highWaterMark=0,t._duplexState=536805311&t._duplexState|1024,!1):(null!==this.map&&null===(e=this.map(e))||(this.buffered+=this.byteLength(e),this.queue.push(e),t._duplexState=536805375&t._duplexState|128),this.buffered<this.highWaterMark)}},{key:"shift",value:function(){var e=this.queue.shift();return this.buffered-=this.byteLength(e),0===this.buffered&&(this.stream._duplexState&=536862591),e}},{key:"unshift",value:function(e){for(var t=[null!==this.map?this.map(e):e];this.buffered>0;)t.push(this.shift());for(var r=0;r<t.length-1;r++){var n=t[r];this.buffered+=this.byteLength(n),this.queue.push(n)}this.push(t[t.length-1])}},{key:"read",value:function(){var e=this.stream;if(128==(16527&e._duplexState)){var t=this.shift();return null!==this.pipeTo&&!1===this.pipeTo.write(t)&&(e._duplexState&=Du),2048&e._duplexState&&e.emit("data",t),t}return!1===this.readAhead&&(e._duplexState|=ju,this.updateNextTick()),null}},{key:"drain",value:function(){for(var e=this.stream;128==(16527&e._duplexState)&&768&e._duplexState;){var t=this.shift();null!==this.pipeTo&&!1===this.pipeTo.write(t)&&(e._duplexState&=Du),2048&e._duplexState&&e.emit("data",t)}}},{key:"update",value:function(){var e=this.stream;e._duplexState|=32;do{for(this.drain();this.buffered<this.highWaterMark&&(214047&e._duplexState)===ju;)e._duplexState|=65552,e._read(this.afterRead),this.drain();4224==(12431&e._duplexState)&&(e._duplexState|=8192,e.emit("readable")),80&e._duplexState||this.updateNonPrimary()}while(!0===this.continueUpdate());e._duplexState&=536870879}},{key:"updateNonPrimary",value:function(){var e=this.stream;1024==(1167&e._duplexState)&&(e._duplexState=536869887&e._duplexState|16384,e.emit("end"),(e._duplexState&$u)===Xu&&(e._duplexState|=4),null!==this.pipeTo&&this.pipeTo.end()),4!=(14&e._duplexState)?1==(e._duplexState&el)&&(e._duplexState=(e._duplexState|Ju)&Lu,e._open(dl.bind(this))):e._duplexState&Zu||(e._duplexState|=Ju,e._destroy(ul.bind(this)))}},{key:"continueUpdate",value:function(){return!!(this.stream._duplexState&Uu)&&(this.stream._duplexState&=Fu,!0)}},{key:"updateCallback",value:function(){64==(32879&this.stream._duplexState)?this.update():this.updateNextTick()}},{key:"updateNextTick",value:function(){this.stream._duplexState&Uu||(this.stream._duplexState|=Uu,32&this.stream._duplexState||Pu(this.afterUpdateNextTick))}}]),e}(),ol=function(){"use strict";function e(t,r,n){(0,w.default)(this,e),this.from=t,this.to=r,this.afterPipe=n,this.error=null,this.pipeToFinished=!1}return(0,x.default)(e,[{key:"finished",value:function(){this.pipeToFinished=!0}},{key:"done",value:function(e,t){t&&(this.error=t),e!==this.to||(this.to=null,null===this.from)?e!==this.from||(this.from=null,null===this.to)?(null!==this.afterPipe&&this.afterPipe(this.error),this.to=this.from=this.afterPipe=null):e._duplexState&Nu||this.to.destroy(this.error||Error("Readable stream closed before ending")):this.from._duplexState&Nu&&this.pipeToFinished||this.from.destroy(this.error||Error("Writable stream closed prematurely"))}}]),e}();function al(){this.stream._duplexState|=512,this.updateCallback()}function sl(e){var t=this.stream;e&&t.destroy(e),14&t._duplexState||(t._duplexState|=zu,t.emit("finish")),(t._duplexState&$u)===Xu&&(t._duplexState|=4),t._duplexState&=Gu,t._duplexState&qu?this.updateNextTick():this.update()}function ul(e){var t=this.stream;e||this.error===Ou||(e=this.error),e&&t.emit("error",e),t._duplexState|=8,t.emit("close");var r=t._readableState,n=t._writableState;if(null!==r&&null!==r.pipeline&&r.pipeline.done(t,e),null!==n){for(;null!==n.drains&&n.drains.length>0;)n.drains.shift().resolve(!1);null!==n.pipeline&&n.pipeline.done(t,e)}}function ll(e){var t=this.stream;e&&t.destroy(e),t._duplexState&=Gu,null!==this.drains&&function(e){for(var t=0;t<e.length;t++)0==--e[t].writes&&(e.shift().resolve(!0),t--)}(this.drains),4194304==(6553615&t._duplexState)&&(t._duplexState&=532676607,(t._duplexState&Ku)===Ku&&t.emit("drain")),this.updateCallback()}function cl(e){e&&this.stream.destroy(e),this.stream._duplexState&=536870895,!1!==this.readAhead||256&this.stream._duplexState||(this.stream._duplexState&=Wu),this.updateCallback()}function fl(){32&this.stream._duplexState||(this.stream._duplexState&=Fu,this.update())}function hl(){this.stream._duplexState&qu||(this.stream._duplexState&=Qu,this.update())}function dl(e){var t=this.stream;e&&t.destroy(e),4&t._duplexState||(17423&t._duplexState||(t._duplexState|=64),142606351&t._duplexState||(t._duplexState|=Hu),t.emit("open")),t._duplexState&=536608751,null!==t._writableState&&t._writableState.updateCallback(),null!==t._readableState&&t._readableState.updateCallback()}function pl(e){null!==this._readableState&&("data"===e&&(this._duplexState|=133376,this._readableState.updateNextTick()),"readable"===e&&(this._duplexState|=4096,this._readableState.updateNextTick())),null!==this._writableState&&"drain"===e&&(this._duplexState|=Ku,this._writableState.updateNextTick())}var vl=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e){var n;return(0,w.default)(this,r),(n=t.call(this))._duplexState=0,n._readableState=null,n._writableState=null,e&&(e.open&&(n._open=e.open),e.destroy&&(n._destroy=e.destroy),e.predestroy&&(n._predestroy=e.predestroy),e.signal&&e.signal.addEventListener("abort",kl.bind((0,g.default)(n)))),n.on("newListener",pl),(0,U.default)(n)}return(0,x.default)(r,[{key:"_open",value:function(e){e(null)}},{key:"_destroy",value:function(e){e(null)}},{key:"_predestroy",value:function(){}},{key:"readable",get:function(){return null!==this._readableState||void 0}},{key:"writable",get:function(){return null!==this._writableState||void 0}},{key:"destroyed",get:function(){return!!(8&this._duplexState)}},{key:"destroying",get:function(){return!!(14&this._duplexState)}},{key:"destroy",value:function(e){14&this._duplexState||(e||(e=Ou),this._duplexState=535822271&this._duplexState|4,null!==this._readableState&&(this._readableState.highWaterMark=0,this._readableState.error=e),null!==this._writableState&&(this._writableState.highWaterMark=0,this._writableState.error=e),this._duplexState|=2,this._predestroy(),this._duplexState&=536870909,null!==this._readableState&&this._readableState.updateNextTick(),null!==this._writableState&&this._writableState.updateNextTick())}}]),r}(xu),gl=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e){var n;return(0,w.default)(this,r),(n=t.call(this,e))._duplexState|=8519681,n._readableState=new il((0,g.default)(n),e),e&&(!1===n._readableState.readAhead&&(n._duplexState&=Wu),e.read&&(n._read=e.read),e.eagerOpen&&n._readableState.updateNextTick(),e.encoding&&n.setEncoding(e.encoding)),(0,U.default)(n)}return(0,x.default)(r,[{key:"setEncoding",value:function(e){var t=new Bu(e),r=this._readableState.map||bl;return this._readableState.map=function(e){var n=t.push(e);return""===n?null:r(n)},this}},{key:"_read",value:function(e){e(null)}},{key:"pipe",value:function(e,t){return this._readableState.updateNextTick(),this._readableState.pipe(e,t),e}},{key:"read",value:function(){return this._readableState.updateNextTick(),this._readableState.read()}},{key:"push",value:function(e){return this._readableState.updateNextTick(),this._readableState.push(e)}},{key:"unshift",value:function(e){return this._readableState.updateNextTick(),this._readableState.unshift(e)}},{key:"resume",value:function(){return this._duplexState|=131328,this._readableState.updateNextTick(),this}},{key:"pause",value:function(){return this._duplexState&=!1===this._readableState.readAhead?536739583:536870655,this}},{key:rl,value:function(){var e,t=this,r=null,n=null,i=null;return this.on("error",(function(e){r=e})),this.on("readable",(function(){null!==n&&o(t.read())})),this.on("close",(function(){null!==n&&o(null)})),e={},(0,O.default)(e,rl,(function(){return this})),(0,O.default)(e,"next",(function(){return new Promise((function(e,r){n=e,i=r;var a=t.read();null!==a?o(a):8&t._duplexState&&o(null)}))})),(0,O.default)(e,"return",(function(){return a(null)})),(0,O.default)(e,"throw",(function(e){return a(e)})),e;function o(e){null!==i&&(r?i(r):null!==e||t._duplexState&Nu?n({value:e,done:null===e}):i(Ou),i=n=null)}function a(e){return t.destroy(e),new Promise((function(r,n){if(8&t._duplexState)return r({value:void 0,done:!0});t.once("close",(function(){e?n(e):r({value:void 0,done:!0})}))}))}}}],[{key:"_fromAsyncIterator",value:function(e,t){var n,i=new r((0,N.default)((0,L.default)({},t),{read:function(t){e.next().then(o).then(t.bind(null,null)).catch(t)},predestroy:function(){n=e.return()},destroy:function(e){if(!n)return e(null);n.then(e.bind(null,null)).catch(e)}}));return i;function o(e){e.done?i.push(null):i.push(e.value)}}},{key:"from",value:function(e,t){if(ml(n=e)&&n.readable)return e;var n;if(e[rl])return this._fromAsyncIterator(e[rl](),t);Array.isArray(e)||(e=void 0===e?[]:[e]);var i=0;return new r((0,N.default)((0,L.default)({},t),{read:function(t){this.push(i===e.length?null:e[i++]),t(null)}}))}},{key:"isBackpressured",value:function(e){return!!(17422&e._duplexState)||e._readableState.buffered>=e._readableState.highWaterMark}},{key:"isPaused",value:function(e){return!(256&e._duplexState)}}]),r}(vl),yl=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e){var n;return(0,w.default)(this,r),(n=t.call(this,e))._duplexState=1|n._duplexState&ju,n._writableState=new nl((0,g.default)(n),e),e&&(e.writev&&(n._writev=e.writev),e.write&&(n._write=e.write),e.final&&(n._final=e.final)),(0,U.default)(n)}return(0,x.default)(r,[{key:"cork",value:function(){this._duplexState|=268435456}},{key:"uncork",value:function(){this._duplexState&=268435455,this._writableState.updateNextTick()}},{key:"_writev",value:function(e,t){t(null)}},{key:"_write",value:function(e,t){this._writableState.autoBatch(e,t)}},{key:"_final",value:function(e){e(null)}},{key:"write",value:function(e){return this._writableState.updateNextTick(),this._writableState.push(e)}},{key:"end",value:function(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}}]),r}(gl);function bl(e){return e}function ml(e){return"number"==typeof e._duplexState&&function(e){return!!e._readableState||!!e._writableState}(e)}function _l(e){return function(e){return"object"==typeof e&&null!==e&&"number"==typeof e.byteLength}(e)?e.byteLength:1024}function wl(){}function kl(){this.destroy(Error("Stream aborted."))}var El=yl;function Sl(e,t){for(var r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}for(var Al=Js((function(e,t,r){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"==typeof t&&(r=t,t=""),t&&(r.code=t);try{return Sl(e,r)}catch(t){r.message=e.message,r.stack=e.stack;var n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(e)),Sl(new n,r)}})),Tl="0123456789abcdef",Cl=[],Il=0;Il<256;Il++)Cl[Il]=Tl[Il>>4&15]+Tl[15&Il];for(var Rl=function(e){for(var t=e.length,r="",n=0;n<t;)r+=Cl[e[n++]];return r},xl="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ol=0;Ol<64;Ol++)xl["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(Ol)]=Ol;new TextDecoder;var Pl=new TextEncoder,Ml="undefined"!=typeof window?window:self,Bl=Ml.crypto||Ml.msCrypto||{};Bl.subtle||Bl.webkitSubtle;var Ll=function(e){var t=new Uint8Array(e);return Bl.getRandomValues(t)},Nl=iu("simple-peer"),Ul=65536;function jl(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}var Dl=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(e){var n;if((0,w.default)(this,r),n=t.call(this,e=Object.assign({allowHalfOpen:!1},e)),(0,O.default)((0,g.default)(n),"_pc",void 0),n.__objectMode=!!e.objectMode,n._id=Rl(Ll(4)).slice(0,7),n._debug("new peer %o",e),n.channelName=e.initiator?e.channelName||Rl(Ll(20)):null,n.initiator=e.initiator||!1,n.channelConfig=e.channelConfig||r.channelConfig,n.channelNegotiated=n.channelConfig.negotiated,n.config=Object.assign({},r.config,e.config),n.offerOptions=e.offerOptions||{},n.answerOptions=e.answerOptions||{},n.sdpTransform=e.sdpTransform||function(e){return e},n.trickle=void 0===e.trickle||e.trickle,n.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,n.iceCompleteTimeout=e.iceCompleteTimeout||5e3,n._destroying=!1,n._connected=!1,n.remoteAddress=void 0,n.remoteFamily=void 0,n.remotePort=void 0,n.localAddress=void 0,n.localFamily=void 0,n.localPort=void 0,!au)throw"undefined"==typeof window?Al(Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):Al(Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");n._pcReady=!1,n._channelReady=!1,n._iceComplete=!1,n._iceCompleteTimer=null,n._channel=null,n._pendingCandidates=[],n._isNegotiating=!1,n._firstNegotiation=!0,n._batchedNegotiation=!1,n._queuedNegotiation=!1,n._sendersAwaitingStable=[],n._closingInterval=null,n._remoteTracks=[],n._remoteStreams=[],n._chunk=null,n._cb=null,n._interval=null;try{n._pc=new au(n.config)}catch(e){return(0,U.default)(n,void n.__destroy(Al(e,"ERR_PC_CONSTRUCTOR")))}return n._isReactNativeWebrtc="number"==typeof n._pc._peerConnectionId,n._pc.oniceconnectionstatechange=function(){n._onIceStateChange()},n._pc.onicegatheringstatechange=function(){n._onIceStateChange()},n._pc.onconnectionstatechange=function(){n._onConnectionStateChange()},n._pc.onsignalingstatechange=function(){n._onSignalingStateChange()},n._pc.onicecandidate=function(e){n._onIceCandidate(e)},"object"==typeof n._pc.peerIdentity&&n._pc.peerIdentity.catch((function(e){n.__destroy(Al(e,"ERR_PC_PEER_IDENTITY"))})),n.initiator||n.channelNegotiated?n._setupData({channel:n._pc.createDataChannel(n.channelName,n.channelConfig)}):n._pc.ondatachannel=function(e){n._setupData(e)},n._debug("initial negotiation"),n._needsNegotiation(),n._onFinishBound=function(){n._onFinish()},n.once("finish",n._onFinishBound),(0,U.default)(n)}return(0,x.default)(r,[{key:"bufferSize",get:function(){return this._channel&&this._channel.bufferedAmount||0}},{key:"connected",get:function(){return this._connected&&"open"===this._channel.readyState}},{key:"address",value:function(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}},{key:"signal",value:function(e){var t=this;if(!this._destroying){if(this.destroyed)throw Al(Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new su(e)).then((function(){t.destroyed||(t._pendingCandidates.forEach((function(e){t._addIceCandidate(e)})),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())})).catch((function(e){t.__destroy(Al(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.__destroy(Al(Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}},{key:"_addIceCandidate",value:function(e){var t=this,r=new uu(e);this._pc.addIceCandidate(r).catch((function(e){!r.address||r.address.endsWith(".local")?console.warn("Ignoring unsupported ICE candidate."):t.__destroy(Al(e,"ERR_ADD_ICE_CANDIDATE"))}))}},{key:"send",value:function(e){if(!this._destroying){if(this.destroyed)throw Al(Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}},{key:"_needsNegotiation",value:function(){var e=this;this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,queueMicrotask((function(){e._batchedNegotiation=!1,e.initiator||!e._firstNegotiation?(e._debug("starting batched negotiation"),e.negotiate()):e._debug("non-initiator initial negotiation request discarded"),e._firstNegotiation=!1})))}},{key:"negotiate",value:function(){var e=this;if(!this._destroying){if(this.destroyed)throw Al(Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout((function(){e._createOffer()}),0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}},{key:"_final",value:function(e){this._readableState.ended||this.push(null),e(null)}},{key:"__destroy",value:function(e){this.end(),this._destroy((function(){}),e)}},{key:"_destroy",value:function(e,t){var r=this;this.destroyed||this._destroying||(this._destroying=!0,this._debug("destroying (error: %s)",t&&(t.message||t)),setTimeout((function(){if(r._connected=!1,r._pcReady=!1,r._channelReady=!1,r._remoteTracks=null,r._remoteStreams=null,r._senderMap=null,clearInterval(r._closingInterval),r._closingInterval=null,clearInterval(r._interval),r._interval=null,r._chunk=null,r._cb=null,r._onFinishBound&&r.removeListener("finish",r._onFinishBound),r._onFinishBound=null,r._channel){try{r._channel.close()}catch(e){}r._channel.onmessage=null,r._channel.onopen=null,r._channel.onclose=null,r._channel.onerror=null}if(r._pc){try{r._pc.close()}catch(e){}r._pc.oniceconnectionstatechange=null,r._pc.onicegatheringstatechange=null,r._pc.onsignalingstatechange=null,r._pc.onicecandidate=null,r._pc.ontrack=null,r._pc.ondatachannel=null}r._pc=null,r._channel=null,t&&r.emit("error",t),e()}),0))}},{key:"_setupData",value:function(e){var t=this;if(!e.channel)return this.__destroy(Al(Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=Ul),this.channelName=this._channel.label,this._channel.onmessage=function(e){t._onChannelMessage(e)},this._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},this._channel.onopen=function(){t._onChannelOpen()},this._channel.onclose=function(){t._onChannelClose()},this._channel.onerror=function(e){var r=e.error instanceof Error?e.error:Error("Datachannel error: ".concat(e.message," ").concat(e.filename,":").concat(e.lineno,":").concat(e.colno));t.__destroy(Al(r,"ERR_DATA_CHANNEL"))};var r=!1;this._closingInterval=setInterval((function(){t._channel&&"closing"===t._channel.readyState?(r&&t._onChannelClose(),r=!0):r=!1}),5e3)}},{key:"_write",value:function(e,t){if(this.destroyed)return t(Al(Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.__destroy(Al(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>Ul?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=t):t(null)}else this._debug("write before connect"),this._chunk=e,this._cb=t}},{key:"_onFinish",value:function(){var e=this;if(!this.destroyed){var t=function(){setTimeout((function(){return e.__destroy()}),1e3)};this._connected?t():this.once("connect",t)}}},{key:"_startIceCompleteTimeout",value:function(){var e=this;this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout((function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))}),this.iceCompleteTimeout))}},{key:"_createOffer",value:function(){var e=this;this.destroyed||this._pc.createOffer(this.offerOptions).then((function(t){if(!e.destroyed){e.trickle||e.allowHalfTrickle||(t.sdp=jl(t.sdp)),t.sdp=e.sdpTransform(t.sdp);var r=function(){if(!e.destroyed){var r=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:r.type,sdp:r.sdp})}};e._pc.setLocalDescription(t).then((function(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?r():e.once("_iceComplete",r))})).catch((function(t){e.__destroy(Al(t,"ERR_SET_LOCAL_DESCRIPTION"))}))}})).catch((function(t){e.__destroy(Al(t,"ERR_CREATE_OFFER"))}))}},{key:"_createAnswer",value:function(){var e=this;this.destroyed||this._pc.createAnswer(this.answerOptions).then((function(t){if(!e.destroyed){e.trickle||e.allowHalfTrickle||(t.sdp=jl(t.sdp)),t.sdp=e.sdpTransform(t.sdp);var r=function(){var r,n;if(!e.destroyed){var i=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:i.type,sdp:i.sdp}),e.initiator||null===(n=(r=e)._requestMissingTransceivers)||void 0===n||n.call(r)}};e._pc.setLocalDescription(t).then((function(){e.destroyed||(e.trickle||e._iceComplete?r():e.once("_iceComplete",r))})).catch((function(t){e.__destroy(Al(t,"ERR_SET_LOCAL_DESCRIPTION"))}))}})).catch((function(t){e.__destroy(Al(t,"ERR_CREATE_ANSWER"))}))}},{key:"_onConnectionStateChange",value:function(){this.destroyed||this._destroying||"failed"===this._pc.connectionState&&this.__destroy(Al(Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}},{key:"_onIceStateChange",value:function(){if(!this.destroyed){var e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.__destroy(Al(Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.__destroy(Al(Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}}},{key:"getStats",value:function(e){var t=this,r=function(e){return"[object Array]"==={}.toString.call(e.values)&&e.values.forEach((function(t){Object.assign(e,t)})),e};0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((function(t){var n=[];t.forEach((function(e){n.push(r(e))})),e(null,n)}),(function(t){return e(t)})):this._pc.getStats.length>0?this._pc.getStats((function(n){if(!t.destroyed){var i=[];n.result().forEach((function(e){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i.push(r(t))})),e(null,i)}}),(function(t){return e(t)})):e(null,[])}},{key:"_maybeReady",value:function(){var e=this;if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),!this._connected&&!this._connecting&&this._pcReady&&this._channelReady){this._connecting=!0;var t=function(){e.destroyed||e._destroying||e.getStats((function(r,n){if(!e.destroyed&&!e._destroying){r&&(n=[]);var i={},o={},a={},s=!1;n.forEach((function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(a[e.id]=e)}));var u=function(t){s=!0;var r=o[t.localCandidateId];r&&(r.ip||r.address)?(e.localAddress=r.ip||r.address,e.localPort=Number(r.port)):r&&r.ipAddress?(e.localAddress=r.ipAddress,e.localPort=Number(r.portNumber)):"string"==typeof t.googLocalAddress&&(r=t.googLocalAddress.split(":"),e.localAddress=r[0],e.localPort=Number(r[1])),e.localAddress&&(e.localFamily=e.localAddress.includes(":")?"IPv6":"IPv4");var n=i[t.remoteCandidateId];n&&(n.ip||n.address)?(e.remoteAddress=n.ip||n.address,e.remotePort=Number(n.port)):n&&n.ipAddress?(e.remoteAddress=n.ipAddress,e.remotePort=Number(n.portNumber)):"string"==typeof t.googRemoteAddress&&(n=t.googRemoteAddress.split(":"),e.remoteAddress=n[0],e.remotePort=Number(n[1])),e.remoteAddress&&(e.remoteFamily=e.remoteAddress.includes(":")?"IPv6":"IPv4"),e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)};if(n.forEach((function(e){"transport"===e.type&&e.selectedCandidatePairId&&u(a[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&u(e)})),s||Object.keys(a).length&&!Object.keys(o).length){if(e._connecting=!1,e._connected=!0,e._chunk){try{e.send(e._chunk)}catch(r){return e.__destroy(Al(r,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var l=e._cb;e._cb=null,l(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval((function(){return e._onInterval()}),150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}}))};t()}}},{key:"_onInterval",value:function(){!this._cb||!this._channel||this._channel.bufferedAmount>Ul||this._onChannelBufferedAmountLow()}},{key:"_onSignalingStateChange",value:function(){var e=this;this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0})),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}},{key:"_onIceCandidate",value:function(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}},{key:"_onChannelMessage",value:function(e){if(!this.destroyed){var t,r=e.data;r instanceof ArrayBuffer?r=new Uint8Array(r):!1===this.__objectMode&&(t=r,r=Pl.encode(t)),this.push(r)}}},{key:"_onChannelBufferedAmountLow",value:function(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var e=this._cb;this._cb=null,e(null)}}},{key:"_onChannelOpen",value:function(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}},{key:"_onChannelClose",value:function(){this.destroyed||(this._debug("on channel close"),this.__destroy())}},{key:"_debug",value:function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],Nl.apply(null,e)}}]),r}(El);Dl.WEBRTC_SUPPORT=!!au,Dl.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},Dl.channelConfig={};var Fl=function(e){"use strict";(0,B.default)(r,e);var t=(0,H.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,w.default)(this,r),(e=t.call(this,n))._pc&&(e.streams=n.streams||(n.stream?[n.stream]:[]),e._senderMap=new Map,e.streams&&e.streams.forEach((function(t){e.addStream(t)})),e._pc.ontrack=function(t){e._onTrack(t)}),(0,U.default)(e)}return(0,x.default)(r,[{key:"addTransceiver",value:function(e,t){if(!this._destroying){if(this.destroyed)throw Al(Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.__destroy(Al(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:e,init:t}})}}},{key:"addStream",value:function(e){var t=this;if(!this._destroying){if(this.destroyed)throw Al(Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),e.getTracks().forEach((function(r){t.addTrack(r,e)}))}}},{key:"addTrack",value:function(e,t){if(!this._destroying){if(this.destroyed)throw Al(Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,n=r.get(t);if(n)throw n.removed?Al(Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):Al(Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");n=this._pc.addTrack(e,t),r.set(t,n),this._senderMap.set(e,r),this._needsNegotiation()}}},{key:"replaceTrack",value:function(e,t,r){if(!this._destroying){if(this.destroyed)throw Al(Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");var n=this._senderMap.get(e),i=n?n.get(r):null;if(!i)throw Al(Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,n),null!=i.replaceTrack?i.replaceTrack(t):this.__destroy(Al(Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}}},{key:"removeTrack",value:function(e,t){if(!this._destroying){if(this.destroyed)throw Al(Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");var r=this._senderMap.get(e),n=r?r.get(t):null;if(!n)throw Al(Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{n.removed=!0,this._pc.removeTrack(n)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(n):this.__destroy(Al(e,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}}},{key:"removeStream",value:function(e){var t=this;if(!this._destroying){if(this.destroyed)throw Al(Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),e.getTracks().forEach((function(r){t.removeTrack(r,e)}))}}},{key:"_requestMissingTransceivers",value:function(){var e=this;this._pc.getTransceivers&&this._pc.getTransceivers().forEach((function(t){t.mid||!t.sender.track||t.requested||(t.requested=!0,e.addTransceiver(t.sender.track.kind))}))}},{key:"_onTrack",value:function(e){var t=this;this.destroyed||e.streams.forEach((function(r){t._debug("on track"),t.emit("track",e.track,r),t._remoteTracks.push({track:e.track,stream:r}),t._remoteStreams.some((function(e){return e.id===r.id}))||(t._remoteStreams.push(r),queueMicrotask((function(){t._debug("on stream"),t.emit("stream",r)})))}))}}]),r}(Dl),Wl="data",ql="signal",Hl=function(e,t){var r=new Fl((0,N.default)((0,L.default)({iceServers:[{urls:Vl}]},t),{initiator:e,trickle:!1})),n=function(e){return i.push(e)},i=[];return r.on(Wl,n),{id:r._id,created:Date.now(),connection:r._pc,get channel(){return r._channel},get isDead(){return r.destroyed},signal:function(t){return new Promise((function(n){e||r.on(ql,n),r.signal(t)}))},sendData:function(e){return r.send(e)},destroy:function(){return r.destroy()},setHandlers:function(e){return Object.entries(e).forEach((function(e){var t=(0,j.default)(e,2),n=t[0],i=t[1];return r.on(n,i)}))},offerPromise:e?new Promise((function(e){return r.on(ql,e)})):Promise.resolve(),addStream:function(e){return r.addStream(e)},removeStream:function(e){return r.removeStream(e)},addTrack:function(e,t){return r.addTrack(e,t)},removeTrack:function(e,t){return r.removeTrack(e,t)},replaceTrack:function(e,t,n){return r.replaceTrack(e,t,n)},drainEarlyData:function(e){r.off(Wl,n),i.forEach(e),i=null}}},Vl=(0,D.default)(xs(5,(function(e,t){return"stun:stun".concat(t||"",".l.google.com:19302")}))).concat(["stun:global.stun.twilio.com:3478"]),zl=Object.getPrototypeOf(Uint8Array),Kl=16369,Yl=255,Gl="bufferedamountlow",Ql=function(e){return"@_"+e},Jl={},Xl={},$l=function(e){var t=e.options;return t.host+t.path},Zl=function(e){var t,r,n,i=e.init,v=e.subscribe,g=e.announce,y={},b=!1;return function(e,_,w){var k,E,S=e.appId;if(null===(E=y[S])||void 0===E?void 0:E[_])return y[S][_];var A={},T={},C=qs(Rs,S,_),I=Ys(C),R=Ys(qs(C,Os)),x=e.password&&function(){var e=(0,m.default)((function(e,t,r){var n,i,o;return(0,V.__generator)(this,(function(a){switch(a.label){case 0:return i=(n=crypto.subtle).importKey,o=["raw"],[4,crypto.subtle.digest({name:"SHA-256"},Fs("".concat(e,":").concat(t,":").concat(r)))];case 1:return[2,i.apply(n,o.concat([a.sent(),{name:zs},!1,["encrypt","decrypt"]]))]}}))}));return function(t,r,n){return e.apply(this,arguments)}}()(e.password,S,_),O=function(e){return function(){var t=(0,m.default)((function(t){var r,n;return(0,V.__generator)(this,(function(i){switch(i.label){case 0:return x?(n={type:t.type},[4,e(x,t.sdp)]):[3,2];case 1:return n.sdp=i.sent(),r=n,[3,3];case 2:r=t,i.label=3;case 3:return[2,r]}}))}));return function(e){return t.apply(this,arguments)}}()},P=O(Qs),M=O(Gs),B=function(){return Hl(!0,e.rtcConfig)},U=function(e,t,r){var n;T[t]?T[t]!==e&&e.destroy():(T[t]=e,J(e,t),null===(n=A[t])||void 0===n||n.forEach((function(e,t){t!==r&&e.destroy()})),delete A[t])},W=function(e,t){T[t]===e&&delete T[t]},q=function(e){return(k=r).push.apply(k,(0,D.default)(xs(e,B))),Ps(r.splice(0,e).map((function(e){return e.offerPromise.then(M).then((function(t){return{peer:e,offer:t}}))})))},H=function(t,r){return null==w?void 0:w({error:"incorrect password (".concat(e.password,") when decrypting ").concat(r),appId:S,peerId:t,roomId:_})},z=function(t){return function(){var r=(0,m.default)((function(r,n,i){var s,u,l,c,f,h,d,p,v,g,y,b,m,_,w,k,E,S,x,O,B,L,N,D,F,z;return(0,V.__generator)(this,(function(V){switch(V.label){case 0:return[4,Ps([I,R])];case 1:if(s=j.default.apply(void 0,[V.sent(),2]),u=s[0],l=s[1],r!==u&&r!==l)return[2];if(c="string"==typeof n?Vs(n):n,f=c.peerId,h=c.offer,d=c.answer,p=c.peer,f===Os||T[f])return[3,16];if(f&&!h&&!d)return[3,14];if(!h)return[3,8];if((null===(v=A[f])||void 0===v?void 0:v[t])&&Os>f)return[2];(g=Hl(!1,e.rtcConfig)).setHandlers({connect:function(){return U(g,f,t)},close:function(){return W(g,f)}}),V.label=2;case 2:return V.trys.push([2,4,,5]),[4,P(h)];case 3:return y=V.sent(),[3,5];case 4:return V.sent(),[2,void H(f,"offer")];case 5:return g.isDead?[2]:[4,Ps([Ys(qs(C,f)),g.signal(y)])];case 6:return b=j.default.apply(void 0,[V.sent(),2]),m=b[0],_=b[1],w=[m],k={peerId:Os},[4,M(_)];case 7:return i.apply(void 0,w.concat([Hs.apply(void 0,[(k.answer=V.sent(),k)])])),[3,13];case 8:if(!d)return[3,13];V.label=9;case 9:return V.trys.push([9,11,,12]),[4,P(d)];case 10:return E=V.sent(),[3,12];case 11:return V.sent(),[2,void H(f,"answer")];case 12:p?(p.setHandlers({connect:function(){return U(p,f,t)},close:function(){return W(p,f)}}),p.signal(E)):(x=null===(S=A[f])||void 0===S?void 0:S[t])&&!x.isDead&&x.signal(E),V.label=13;case 13:return[3,16];case 14:return(null===(O=A[f])||void 0===O?void 0:O[t])?[2]:[4,Ps([q(1),Ys(qs(C,f))])];case 15:B=j.default.apply(void 0,[V.sent(),2]),L=(0,j.default)(B[0],1),N=L[0],D=N.peer,F=N.offer,z=B[1],(o=A)[a=f]||(o[a]=[]),A[f][t]=D,setTimeout((function(){return function(e,t){var r;if(!T[e]){var n=null===(r=A[e])||void 0===r?void 0:r[t];n&&(delete A[e][t],n.destroy())}}(f,t)}),.9*Y[t]),D.setHandlers({connect:function(){return U(D,f,t)},close:function(){return W(D,f)}}),i(z,Hs({peerId:Os,offer:F})),V.label=16;case 16:return[2]}}))}));return function(e,t,n){return r.apply(this,arguments)}}()};if(!e)throw Us("requires a config map as the first argument");if(!S&&!e.firebaseApp)throw Us("config map is missing appId field");if(!_)throw Us("roomId argument required");if(!b){var K=i(e);r=xs(20,B),t=Array.isArray(K)?K:[K],b=!0,n=setInterval((function(){return r=r.filter((function(e){var t=Date.now()-e.created<57333;return t||e.destroy(),t}))}),59052.99)}var Y=t.map((function(){return 5333})),G=[],Q=t.map(function(){var e=(0,m.default)((function(e,t){var r;return(0,V.__generator)(this,(function(n){switch(n.label){case 0:return[4,e];case 1:return r=[n.sent()],[4,I];case 2:return r=r.concat(n.sent()),[4,R];case 3:return[2,v.apply(void 0,r.concat([n.sent(),z(t),q]))]}}))}));return function(t,r){return e.apply(this,arguments)}}());Ps([I,R]).then((function(e){var r=(0,j.default)(e,2),n=r[0],i=r[1],o=function(){var e=(0,m.default)((function(e,t){var r;return(0,V.__generator)(this,(function(a){switch(a.label){case 0:return[4,g(e,n,i)];case 1:return"number"==typeof(r=a.sent())&&(Y[t]=r),G[t]=setTimeout((function(){return o(e,t)}),Y[t]),[2]}}))}));return function(t,r){return e.apply(this,arguments)}}();Q.forEach(function(){var e=(0,m.default)((function(e,r){return(0,V.__generator)(this,(function(n){switch(n.label){case 0:return[4,e];case 1:return n.sent(),[4,t[r]];case 2:return o.apply(void 0,[n.sent(),r]),[2]}}))}));return function(t,r){return e.apply(this,arguments)}}())}));var J=Ns;return(s=y)[u=S]||(s[u]={}),y[S][_]=function(e,t,r){var n={},i={},o={},a={},s={},u={},v={onPeerJoin:Ns,onPeerLeave:Ns,onPeerStream:Ns,onPeerTrack:Ns},g=function(e,t){return(e?Array.isArray(e)?e:[e]:Ls(n)).flatMap((function(e){var r=n[e];return r?t(e,r):(console.warn("".concat(Rs,": no peer with id ").concat(e," found")),[])}))},y=function(e){n[e]&&(delete n[e],delete o[e],delete a[e],v.onPeerLeave(e),t(e))},b=function(e){if(i[e])return[i[e].send,i[e].setOnComplete,i[e].setOnProgress];if(!e)throw Us("action type argument is required");var t=Fs(e);if(t.byteLength>12)throw Us('action type string "'.concat(e,'" (').concat(t.byteLength,"b) exceeds byte limit (12). Hint: choose a shorter name."));var r=new Uint8Array(12);r.set(t);var o=0;return i[e]={onComplete:Ns,onProgress:Ns,setOnComplete:function(t){return i[e]=(0,N.default)((0,L.default)({},i[e]),{onComplete:t})},setOnProgress:function(t){return i[e]=(0,N.default)((0,L.default)({},i[e]),{onProgress:t})},send:function(e,t,i,a){return(0,m.default)((function(){var s,u,l,c,f,h,d,p,v,y,b;return(0,V.__generator)(this,(function(_){switch(_.label){case 0:if(i&&"object"!=typeof i)throw Us("action meta argument must be an object");if("undefined"===(s=void 0===e?"undefined":(0,F.default)(e)))throw Us("action data cannot be undefined");if(u="string"!==s,l=e instanceof Blob,c=l||e instanceof ArrayBuffer||e instanceof zl,i&&!c)throw Us("action meta argument can only be used with binary data");return c?(y=Uint8Array.bind,l?[4,e.arrayBuffer()]:[3,2]):[3,4];case 1:return b=_.sent(),[3,3];case 2:b=e,_.label=3;case 3:return v=new(y.apply(Uint8Array,[void 0,b])),[3,5];case 4:v=Fs(u?Hs(e):e),_.label=5;case 5:return f=v,h=i?Fs(Hs(i)):null,d=Math.ceil(f.byteLength/Kl)+(i?1:0)||1,p=xs(d,(function(e,t){var n=t===d-1,a=i&&0===t,s=new Uint8Array(15+(a?h.byteLength:n?f.byteLength-Kl*(d-(i?2:1)):Kl));return s.set(r),s.set([o],12),s.set([n|a<<1|c<<2|u<<3],13),s.set([Math.round((t+1)/d*Yl)],14),s.set(i?a?h:f.subarray((t-1)*Kl,t*Kl):f.subarray(t*Kl,(t+1)*Kl),15),s})),[2,(o=o+1&Yl,Ps(g(t,function(){var e=(0,m.default)((function(e,t){var r,o,s;return(0,V.__generator)(this,(function(u){switch(u.label){case 0:r=t.channel,o=0,u.label=1;case 1:return o<d?(s=p[o],r.bufferedAmount>r.bufferedAmountLowThreshold?[4,new Promise((function(e){var t=function(){r.removeEventListener(Gl,t),e()};r.addEventListener(Gl,t)}))]:[3,3]):[3,5];case 2:u.sent(),u.label=3;case 3:if(!n[e])return[3,5];t.sendData(s),o++,null==a||a(s[14]/Yl,e,i),u.label=4;case 4:return[3,1];case 5:return[2]}}))}));return function(t,r){return e.apply(this,arguments)}}())))]}}))}))()}},[i[e].send,i[e].setOnComplete,i[e].setOnProgress]},_=function(e,t){var r=new Uint8Array(t),n=Ws(r.subarray(0,12)).replaceAll("\0",""),a=(0,j.default)(r.subarray(12,13),1)[0],s=(0,j.default)(r.subarray(13,14),1)[0],u=(0,j.default)(r.subarray(14,15),1)[0],v=r.subarray(15),g=!!(1&s),y=!!(2&s),b=!!(4&s),m=!!(8&s);if(i[n]){(l=o)[c=e]||(l[c]={}),(f=o[e])[h=n]||(f[h]={});var _=(d=o[e][n])[p=a]||(d[p]={chunks:[]});if(y?_.meta=Vs(Ws(v)):_.chunks.push(v),i[n].onProgress(u/Yl,e,_.meta),g){var w=new Uint8Array(_.chunks.reduce((function(e,t){return e+t.byteLength}),0));if(_.chunks.reduce((function(e,t){return w.set(t,e),e+t.byteLength}),0),delete o[e][n][a],b)i[n].onComplete(w,e,_.meta);else{var k=Ws(w);i[n].onComplete(m?Vs(k):k,e)}}}else console.warn("".concat(Rs,": received message with unregistered type (").concat(n,")"))},w=(0,j.default)(b(Ql("ping")),2),k=w[0],E=w[1],S=(0,j.default)(b(Ql("pong")),2),A=S[0],T=S[1],C=(0,j.default)(b(Ql("signal")),2),I=C[0],R=C[1],x=(0,j.default)(b(Ql("stream")),2),O=x[0],P=x[1],M=(0,j.default)(b(Ql("track")),2),B=M[0],U=M[1],D=(0,j.default)(b(Ql("leave")),2),W=D[0],q=D[1];return J=function(e,t){var r;n[t]||(n[t]=e,e.setHandlers({data:function(e){return _(t,e)},stream:function(e){v.onPeerStream(e,t,s[t]),delete s[t]},track:function(e,r){v.onPeerTrack(e,r,t,u[t]),delete u[t]},signal:function(e){return I(e,t)},close:function(){return y(t)},error:function(){return y(t)}}),v.onPeerJoin(t),null===(r=e.drainEarlyData)||void 0===r||r.call(e,(function(e){return _(t,e)})))},E((function(e,t){return A("",t)})),T((function(e,t){var r;null===(r=a[t])||void 0===r||r.call(a),delete a[t]})),R((function(e,t){var r;return null===(r=n[t])||void 0===r?void 0:r.signal(e)})),P((function(e,t){return s[t]=e})),U((function(e,t){return u[t]=e})),q((function(e,t){return y(t)})),{makeAction:b,ping:function(e){return(0,m.default)((function(){var t;return(0,V.__generator)(this,(function(r){switch(r.label){case 0:if(!e)throw Us("ping() must be called with target peer ID");return t=Date.now(),k("",e),[4,new Promise((function(t){return a[e]=t}))];case 1:return[2,(r.sent(),Date.now()-t)]}}))}))()},leave:function(){return(0,m.default)((function(){return(0,V.__generator)(this,(function(e){switch(e.label){case 0:return[4,W("")];case 1:return e.sent(),[4,new Promise((function(e){return setTimeout(e,99)}))];case 2:return e.sent(),Ms(n).forEach((function(e){var t=(0,j.default)(e,2),r=t[0];t[1].destroy(),delete n[r]})),r(),[2]}}))}))()},getPeers:function(){return Bs(Ms(n).map((function(e){var t=(0,j.default)(e,2);return[t[0],t[1].connection]})))},addStream:function(e,t,r){return g(t,function(){var t=(0,m.default)((function(t,n){return(0,V.__generator)(this,(function(i){switch(i.label){case 0:return r?[4,O(r,t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return n.addStream(e),[2]}}))}));return function(e,r){return t.apply(this,arguments)}}())},removeStream:function(e,t){return g(t,(function(t,r){return r.removeStream(e)}))},addTrack:function(e,t,r,n){return g(r,function(){var r=(0,m.default)((function(r,i){return(0,V.__generator)(this,(function(o){switch(o.label){case 0:return n?[4,B(n,r)]:[3,2];case 1:o.sent(),o.label=2;case 2:return i.addTrack(e,t),[2]}}))}));return function(e,t){return r.apply(this,arguments)}}())},removeTrack:function(e,t,r){return g(r,(function(r,n){return n.removeTrack(e,t)}))},replaceTrack:function(e,t,r,n,i){return g(n,function(){var n=(0,m.default)((function(n,o){return(0,V.__generator)(this,(function(a){switch(a.label){case 0:return i?[4,B(i,n)]:[3,2];case 1:a.sent(),a.label=2;case 2:return o.replaceTrack(e,t,r),[2]}}))}));return function(e,t){return n.apply(this,arguments)}}())},onPeerJoin:function(e){return v.onPeerJoin=e},onPeerLeave:function(e){return v.onPeerLeave=e},onPeerStream:function(e){return v.onPeerStream=e},onPeerTrack:function(e){return v.onPeerTrack=e}}}(0,(function(e){return delete T[e]}),(function(){delete y[S][_],G.forEach(clearTimeout),Q.forEach(function(){var e=(0,m.default)((function(e){return(0,V.__generator)(this,(function(t){switch(t.label){case 0:return[4,e];case 1:return[2,t.sent()()]}}))}));return function(t){return e.apply(this,arguments)}}()),clearInterval(n)}))}}({init:function(e){return function(e,t,r){return(e.relayUrls||t).slice(0,e.relayUrls?e.relayUrls.length:e.relayRedundancy||5)}(e,ec).map((function(e){var t=Is.connect(e),r=$l(t);return Jl[r]=t.stream.socket,Xl[r]={},t.on("message",(function(e,t){var n,i;return null===(i=(n=Xl[r])[e])||void 0===i?void 0:i.call(n,e,t.toString())})),new Promise((function(e){return t.on("connect",(function(){return e(t)}))}))}))},subscribe:function(e,t,r,n){var i=$l(e);return Xl[i][t]=Xl[i][r]=function(t,r){return n(t,r,e.publish.bind(e))},e.subscribe(t),e.subscribe(r),function(){e.unsubscribe(t),e.unsubscribe(r),delete Xl[i][t],delete Xl[i][r]}},announce:function(e,t){return e.publish(t,Hs({peerId:Os}))}}),ec=["mqtt.eclipseprojects.io/mqtt","broker.hivemq.com:8884/mqtt","public.mqtthq.com:8084/mqtt","test.mosquitto.org:8081/mqtt","broker.emqx.io:8084/mqtt"].map((function(e){return"wss://"+e}))})),r.register("1PH9R",(function(e,r){function n(e,t){var r={},n=!1;function i(r,i){return n=!0,i=new Promise((function(t){t(e[r](i))})),{done:!1,value:t(i)}}return"function"==typeof Symbol&&Symbol.iterator&&(r[Symbol.iterator]=function(){return this}),r.next=function(e){return n?(n=!1,e):i("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(n)throw n=!1,e;return i("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return i("return",e)}),r}t(e.exports,"default",(function(){return n}))})),r.register("3u2tY",(function(e,r){function n(e){var t,r,n,o=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);o--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new i(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function i(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return i=function(e){this.s=e,this.n=e.next},i.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new i(e)}t(e.exports,"default",(function(){return n}))})),r.register("9yQwa",(function(e,n){t(e.exports,"default",(function(){return o}));var i=r("kRxx3");function o(e){return new(0,i.default)(e)}})),r.register("kRxx3",(function(e,r){function n(e){this.wrapped=e}t(e.exports,"default",(function(){return n}))})),r.register("8qpTe",(function(e,n){t(e.exports,"default",(function(){return a}));var i=r("k7SOi"),o=r("laD7J");function a(e,t){var r=(0,i.default)(e,t,"get");return(0,o.default)(e,r)}})),r.register("k7SOi",(function(e,r){function n(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 n}))})),r.register("laD7J",(function(e,r){function n(e,t){return t.get?t.get.call(e):t.value}t(e.exports,"default",(function(){return n}))})),r.register("gwSkA",(function(e,n){t(e.exports,"default",(function(){return o}));var i=r("hv1Iw");function o(e,t,r){(0,i.default)(e,t),t.set(e,r)}})),r.register("hv1Iw",(function(e,r){function n(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 n}))})),r.register("7ukXT",(function(e,n){t(e.exports,"default",(function(){return a}));var i=r("k7SOi"),o=r("c4HTA");function a(e,t,r){var n=(0,i.default)(e,t,"set");return(0,o.default)(e,n,r),r}})),r.register("c4HTA",(function(e,r){function n(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 n}))})),r.register("8TzS1",(function(e,n){t(e.exports,"default",(function(){return a}));var i=r("k7SOi"),o=r("Fzx8d");function a(e,t){var r=(0,i.default)(e,t,"update");return(0,o.default)(e,r)}})),r.register("Fzx8d",(function(e,r){function n(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 n}))})),r.register("aFAb1",(function(e,r){function n(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 n}))})),r.register("kw2NY",(function(e,n){t(e.exports,"default",(function(){return o}));var i=r("hv1Iw");function o(e,t){(0,i.default)(e,t),t.add(e)}})),r.register("lxHBR",(function(e,n){t(e.exports,"default",(function(){return s}));var i=r("a3i4E"),o=r("jX9Fw"),a=r("laD7J");function s(e,t,r){return(0,i.default)(e,t),(0,o.default)(r,"get"),(0,a.default)(e,r)}})),r.register("a3i4E",(function(e,r){function n(e,t){if(e!==t)throw new TypeError("Private static access of wrong provenance")}t(e.exports,"default",(function(){return n}))})),r.register("jX9Fw",(function(e,r){function n(e,t){if(void 0===e)throw new TypeError("attempted to "+t+" private static field before its declaration")}t(e.exports,"default",(function(){return n}))})),r.register("gJ3S3",(function(e,n){t(e.exports,"default",(function(){return s}));var i=r("a3i4E"),o=r("jX9Fw"),a=r("c4HTA");function s(e,t,r,n){return(0,i.default)(e,t),(0,o.default)(r,"set"),(0,a.default)(e,r,n),n}})),r.register("hXL9f",(function(e,n){t(e.exports,"default",(function(){return o}));var i=r("4pMaJ");function o(e){return function(){return new(0,i.default)(e.apply(this,arguments))}}})),r.register("4pMaJ",(function(e,n){t(e.exports,"default",(function(){return o}));var i=r("kRxx3");function o(e){var t,r;function n(t,r){try{var a=e[t](r),s=a.value,u=s instanceof i.default;Promise.resolve(u?s.wrapped:s).then((function(e){u?n("next",e):o(a.done?"return":"normal",e)}),(function(e){n("throw",e)}))}catch(e){o("throw",e)}}function o(e,i){switch(e){case"return":t.resolve({value:i,done:!0});break;case"throw":t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?n(t.key,t.arg):r=null}this._invoke=function(e,i){return new Promise((function(o,a){var s={key:e,arg:i,resolve:o,reject:a,next:null};r?r=r.next=s:(t=r=s,n(e,i))}))},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(o.prototype[Symbol.asyncIterator]=function(){return this}),o.prototype.next=function(e){return this._invoke("next",e)},o.prototype.throw=function(e){return this._invoke("throw",e)},o.prototype.return=function(e){return this._invoke("return",e)}}))}();