数据可视化大屏
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

10 Zeilen
227KB

  1. import{$a as pt,A as Ke,C as Ye,Ca as nt,Ga as st,Ia as at,La as lt,O as $t,P as Jt,Pa as ut,S as Xt,Sa as ht,T as Zt,U as er,Ua as ft,V as Qe,Xa as ct,_ as Ge,aa as tr,bb as dt,ca as $e,da as rr,db as gt,e as Ve,fa as ir,fb as mt,ga as nr,ha as sr,hb as yt,ia as or,j as Yt,ja as ar,jb as _t,ka as lr,la as Je,n as Qt,pa as Xe,ra as Ze,ta as et,u as ze,ua as tt,v as qe,wa as rt,ya as it,z as Gt}from"./chunk-WD6SV3WH.js";import{Db as Ne,Eb as Te,Fb as Re,Fe as qt,Ge as De,He as Kt,I as Bt,J as kt,Jb as Le,K as Nt,Ka as ge,Le as je,Nf as ot,Oa as me,Ta as Ee,Va as be,X as Lt,Y as Ut,a as Me,b as Be,c as Oe,cc as Ue,dc as zt,f as cr,gb as _e,h as Tt,ha as Ft,hb as ye,hf as We,ib as Dt,ja as vt,k as Ie,ka as Et,l as Rt,lf as He,m as Pt,mb as jt,n as Ot,na as ke,nc as Fe,o as wt,p as Mt,qb as Wt,sa as St,sb as Ae,ta as xt,tb as Ht,ub as Vt}from"./chunk-VDRVUQCF.js";var It=cr((hr,Ct)=>{"use strict";(function(ae){if(typeof hr=="object"&&typeof Ct<"u")Ct.exports=ae();else if(typeof define=="function"&&define.amd)define([],ae);else{var ue;typeof window<"u"?ue=window:typeof global<"u"?ue=global:typeof self<"u"?ue=self:ue=this,ue.mqtt=ae()}})(function(){var ae,ue,pe;return function(){function y(k,x,p){function c(s,i){if(!x[s]){if(!k[s]){var r=typeof Oe=="function"&&Oe;if(!i&&r)return r(s,!0);if(m)return m(s,!0);var e=new Error("Cannot find module '"+s+"'");throw e.code="MODULE_NOT_FOUND",e}var t=x[s]={exports:{}};k[s][0].call(t.exports,function(o){var u=k[s][1][o];return c(u||o)},t,t.exports,y,k,x,p)}return x[s].exports}for(var m=typeof Oe=="function"&&Oe,h=0;h<p.length;h++)c(p[h]);return c}return y}()({1:[function(y,k,x){"use strict";x.byteLength=e,x.toByteArray=o,x.fromByteArray=g;for(var p=[],c=[],m=typeof Uint8Array<"u"?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=h.length;s<i;++s)p[s]=h[s],c[h.charCodeAt(s)]=s;c[45]=62,c[95]=63;function r(_){var f=_.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var v=_.indexOf("=");v===-1&&(v=f);var R=v===f?0:4-v%4;return[v,R]}function e(_){var f=r(_),v=f[0],R=f[1];return(v+R)*3/4-R}function t(_,f,v){return(f+v)*3/4-v}function o(_){var f,v=r(_),R=v[0],A=v[1],W=new m(t(_,R,A)),j=0,C=A>0?R-4:R,P;for(P=0;P<C;P+=4)f=c[_.charCodeAt(P)]<<18|c[_.charCodeAt(P+1)]<<12|c[_.charCodeAt(P+2)]<<6|c[_.charCodeAt(P+3)],W[j++]=f>>16&255,W[j++]=f>>8&255,W[j++]=f&255;return A===2&&(f=c[_.charCodeAt(P)]<<2|c[_.charCodeAt(P+1)]>>4,W[j++]=f&255),A===1&&(f=c[_.charCodeAt(P)]<<10|c[_.charCodeAt(P+1)]<<4|c[_.charCodeAt(P+2)]>>2,W[j++]=f>>8&255,W[j++]=f&255),W}function u(_){return p[_>>18&63]+p[_>>12&63]+p[_>>6&63]+p[_&63]}function d(_,f,v){for(var R,A=[],W=f;W<v;W+=3)R=(_[W]<<16&16711680)+(_[W+1]<<8&65280)+(_[W+2]&255),A.push(u(R));return A.join("")}function g(_){for(var f,v=_.length,R=v%3,A=[],W=16383,j=0,C=v-R;j<C;j+=W)A.push(d(_,j,j+W>C?C:j+W));return R===1?(f=_[v-1],A.push(p[f>>2]+p[f<<4&63]+"==")):R===2&&(f=(_[v-2]<<8)+_[v-1],A.push(p[f>>10]+p[f>>4&63]+p[f<<2&63]+"=")),A.join("")}},{}],2:[function(y,k,x){},{}],3:[function(y,k,x){(function(p){(function(){"use strict";var c=y("base64-js"),m=y("ieee754");x.Buffer=r,x.SlowBuffer=R,x.INSPECT_MAX_BYTES=50;var h=2147483647;x.kMaxLength=h,r.TYPED_ARRAY_SUPPORT=s(),!r.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{var l=new Uint8Array(1);return l.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},l.foo()===42}catch{return!1}}Object.defineProperty(r.prototype,"parent",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.buffer}}),Object.defineProperty(r.prototype,"offset",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.byteOffset}});function i(l){if(l>h)throw new RangeError('The value "'+l+'" is invalid for option "size"');var n=new Uint8Array(l);return n.__proto__=r.prototype,n}function r(l,n,a){if(typeof l=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(l)}return e(l,n,a)}typeof Symbol<"u"&&Symbol.species!=null&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),r.poolSize=8192;function e(l,n,a){if(typeof l=="string")return d(l,n);if(ArrayBuffer.isView(l))return g(l);if(l==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(Q(l,ArrayBuffer)||l&&Q(l.buffer,ArrayBuffer))return _(l,n,a);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var w=l.valueOf&&l.valueOf();if(w!=null&&w!==l)return r.from(w,n,a);var L=f(l);if(L)return L;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return r.from(l[Symbol.toPrimitive]("string"),n,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}r.from=function(l,n,a){return e(l,n,a)},r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array;function t(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function o(l,n,a){return t(l),l<=0?i(l):n!==void 0?typeof a=="string"?i(l).fill(n,a):i(l).fill(n):i(l)}r.alloc=function(l,n,a){return o(l,n,a)};function u(l){return t(l),i(l<0?0:v(l)|0)}r.allocUnsafe=function(l){return u(l)},r.allocUnsafeSlow=function(l){return u(l)};function d(l,n){if((typeof n!="string"||n==="")&&(n="utf8"),!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var a=A(l,n)|0,w=i(a),L=w.write(l,n);return L!==a&&(w=w.slice(0,L)),w}function g(l){for(var n=l.length<0?0:v(l.length)|0,a=i(n),w=0;w<n;w+=1)a[w]=l[w]&255;return a}function _(l,n,a){if(n<0||l.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<n+(a||0))throw new RangeError('"length" is outside of buffer bounds');var w;return n===void 0&&a===void 0?w=new Uint8Array(l):a===void 0?w=new Uint8Array(l,n):w=new Uint8Array(l,n,a),w.__proto__=r.prototype,w}function f(l){if(r.isBuffer(l)){var n=v(l.length)|0,a=i(n);return a.length===0||l.copy(a,0,0,n),a}if(l.length!==void 0)return typeof l.length!="number"||b(l.length)?i(0):g(l);if(l.type==="Buffer"&&Array.isArray(l.data))return g(l.data)}function v(l){if(l>=h)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+h.toString(16)+" bytes");return l|0}function R(l){return+l!=l&&(l=0),r.alloc(+l)}r.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==r.prototype},r.compare=function(n,a){if(Q(n,Uint8Array)&&(n=r.from(n,n.offset,n.byteLength)),Q(a,Uint8Array)&&(a=r.from(a,a.offset,a.byteLength)),!r.isBuffer(n)||!r.isBuffer(a))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===a)return 0;for(var w=n.length,L=a.length,K=0,J=Math.min(w,L);K<J;++K)if(n[K]!==a[K]){w=n[K],L=a[K];break}return w<L?-1:L<w?1:0},r.isEncoding=function(n){switch(String(n).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}},r.concat=function(n,a){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return r.alloc(0);var w;if(a===void 0)for(a=0,w=0;w<n.length;++w)a+=n[w].length;var L=r.allocUnsafe(a),K=0;for(w=0;w<n.length;++w){var J=n[w];if(Q(J,Uint8Array)&&(J=r.from(J)),!r.isBuffer(J))throw new TypeError('"list" argument must be an Array of Buffers');J.copy(L,K),K+=J.length}return L};function A(l,n){if(r.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||Q(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);var a=l.length,w=arguments.length>2&&arguments[2]===!0;if(!w&&a===0)return 0;for(var L=!1;;)switch(n){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return te(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a*2;case"hex":return a>>>1;case"base64":return N(l).length;default:if(L)return w?-1:te(l).length;n=(""+n).toLowerCase(),L=!0}}r.byteLength=A;function W(l,n,a){var w=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((a===void 0||a>this.length)&&(a=this.length),a<=0)||(a>>>=0,n>>>=0,a<=n))return"";for(l||(l="utf8");;)switch(l){case"hex":return ee(this,n,a);case"utf8":case"utf-8":return E(this,n,a);case"ascii":return z(this,n,a);case"latin1":case"binary":return re(this,n,a);case"base64":return G(this,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,n,a);default:if(w)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),w=!0}}r.prototype._isBuffer=!0;function j(l,n,a){var w=l[n];l[n]=l[a],l[a]=w}r.prototype.swap16=function(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var a=0;a<n;a+=2)j(this,a,a+1);return this},r.prototype.swap32=function(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var a=0;a<n;a+=4)j(this,a,a+3),j(this,a+1,a+2);return this},r.prototype.swap64=function(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var a=0;a<n;a+=8)j(this,a,a+7),j(this,a+1,a+6),j(this,a+2,a+5),j(this,a+3,a+4);return this},r.prototype.toString=function(){var n=this.length;return n===0?"":arguments.length===0?E(this,0,n):W.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(n){if(!r.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:r.compare(this,n)===0},r.prototype.inspect=function(){var n="",a=x.INSPECT_MAX_BYTES;return n=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(n+=" ... "),"<Buffer "+n+">"},r.prototype.compare=function(n,a,w,L,K){if(Q(n,Uint8Array)&&(n=r.from(n,n.offset,n.byteLength)),!r.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(a===void 0&&(a=0),w===void 0&&(w=n?n.length:0),L===void 0&&(L=0),K===void 0&&(K=this.length),a<0||w>n.length||L<0||K>this.length)throw new RangeError("out of range index");if(L>=K&&a>=w)return 0;if(L>=K)return-1;if(a>=w)return 1;if(a>>>=0,w>>>=0,L>>>=0,K>>>=0,this===n)return 0;for(var J=K-L,le=w-a,he=Math.min(J,le),fe=this.slice(L,K),de=n.slice(a,w),ce=0;ce<he;++ce)if(fe[ce]!==de[ce]){J=fe[ce],le=de[ce];break}return J<le?-1:le<J?1:0};function C(l,n,a,w,L){if(l.length===0)return-1;if(typeof a=="string"?(w=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,b(a)&&(a=L?0:l.length-1),a<0&&(a=l.length+a),a>=l.length){if(L)return-1;a=l.length-1}else if(a<0)if(L)a=0;else return-1;if(typeof n=="string"&&(n=r.from(n,w)),r.isBuffer(n))return n.length===0?-1:P(l,n,a,w,L);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?L?Uint8Array.prototype.indexOf.call(l,n,a):Uint8Array.prototype.lastIndexOf.call(l,n,a):P(l,[n],a,w,L);throw new TypeError("val must be string, number or Buffer")}function P(l,n,a,w,L){var K=1,J=l.length,le=n.length;if(w!==void 0&&(w=String(w).toLowerCase(),w==="ucs2"||w==="ucs-2"||w==="utf16le"||w==="utf-16le")){if(l.length<2||n.length<2)return-1;K=2,J/=2,le/=2,a/=2}function he(Se,ve){return K===1?Se[ve]:Se.readUInt16BE(ve*K)}var fe;if(L){var de=-1;for(fe=a;fe<J;fe++)if(he(l,fe)===he(n,de===-1?0:fe-de)){if(de===-1&&(de=fe),fe-de+1===le)return de*K}else de!==-1&&(fe-=fe-de),de=-1}else for(a+le>J&&(a=J-le),fe=a;fe>=0;fe--){for(var ce=!0,we=0;we<le;we++)if(he(l,fe+we)!==he(n,we)){ce=!1;break}if(ce)return fe}return-1}r.prototype.includes=function(n,a,w){return this.indexOf(n,a,w)!==-1},r.prototype.indexOf=function(n,a,w){return C(this,n,a,w,!0)},r.prototype.lastIndexOf=function(n,a,w){return C(this,n,a,w,!1)};function S(l,n,a,w){a=Number(a)||0;var L=l.length-a;w?(w=Number(w),w>L&&(w=L)):w=L;var K=n.length;w>K/2&&(w=K/2);for(var J=0;J<w;++J){var le=parseInt(n.substr(J*2,2),16);if(b(le))return J;l[a+J]=le}return J}function V(l,n,a,w){return q(te(n,l.length-a),l,a,w)}function B(l,n,a,w){return q(O(n),l,a,w)}function ne(l,n,a,w){return B(l,n,a,w)}function se(l,n,a,w){return q(N(n),l,a,w)}function ie(l,n,a,w){return q(I(n,l.length-a),l,a,w)}r.prototype.write=function(n,a,w,L){if(a===void 0)L="utf8",w=this.length,a=0;else if(w===void 0&&typeof a=="string")L=a,w=this.length,a=0;else if(isFinite(a))a=a>>>0,isFinite(w)?(w=w>>>0,L===void 0&&(L="utf8")):(L=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var K=this.length-a;if((w===void 0||w>K)&&(w=K),n.length>0&&(w<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");L||(L="utf8");for(var J=!1;;)switch(L){case"hex":return S(this,n,a,w);case"utf8":case"utf-8":return V(this,n,a,w);case"ascii":return B(this,n,a,w);case"latin1":case"binary":return ne(this,n,a,w);case"base64":return se(this,n,a,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,n,a,w);default:if(J)throw new TypeError("Unknown encoding: "+L);L=(""+L).toLowerCase(),J=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function G(l,n,a){return n===0&&a===l.length?c.fromByteArray(l):c.fromByteArray(l.slice(n,a))}function E(l,n,a){a=Math.min(l.length,a);for(var w=[],L=n;L<a;){var K=l[L],J=null,le=K>239?4:K>223?3:K>191?2:1;if(L+le<=a){var he,fe,de,ce;switch(le){case 1:K<128&&(J=K);break;case 2:he=l[L+1],(he&192)===128&&(ce=(K&31)<<6|he&63,ce>127&&(J=ce));break;case 3:he=l[L+1],fe=l[L+2],(he&192)===128&&(fe&192)===128&&(ce=(K&15)<<12|(he&63)<<6|fe&63,ce>2047&&(ce<55296||ce>57343)&&(J=ce));break;case 4:he=l[L+1],fe=l[L+2],de=l[L+3],(he&192)===128&&(fe&192)===128&&(de&192)===128&&(ce=(K&15)<<18|(he&63)<<12|(fe&63)<<6|de&63,ce>65535&&ce<1114112&&(J=ce))}}J===null?(J=65533,le=1):J>65535&&(J-=65536,w.push(J>>>10&1023|55296),J=56320|J&1023),w.push(J),L+=le}return U(w)}var T=4096;function U(l){var n=l.length;if(n<=T)return String.fromCharCode.apply(String,l);for(var a="",w=0;w<n;)a+=String.fromCharCode.apply(String,l.slice(w,w+=T));return a}function z(l,n,a){var w="";a=Math.min(l.length,a);for(var L=n;L<a;++L)w+=String.fromCharCode(l[L]&127);return w}function re(l,n,a){var w="";a=Math.min(l.length,a);for(var L=n;L<a;++L)w+=String.fromCharCode(l[L]);return w}function ee(l,n,a){var w=l.length;(!n||n<0)&&(n=0),(!a||a<0||a>w)&&(a=w);for(var L="",K=n;K<a;++K)L+=Y(l[K]);return L}function H(l,n,a){for(var w=l.slice(n,a),L="",K=0;K<w.length;K+=2)L+=String.fromCharCode(w[K]+w[K+1]*256);return L}r.prototype.slice=function(n,a){var w=this.length;n=~~n,a=a===void 0?w:~~a,n<0?(n+=w,n<0&&(n=0)):n>w&&(n=w),a<0?(a+=w,a<0&&(a=0)):a>w&&(a=w),a<n&&(a=n);var L=this.subarray(n,a);return L.__proto__=r.prototype,L};function D(l,n,a){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+n>a)throw new RangeError("Trying to access beyond buffer length")}r.prototype.readUIntLE=function(n,a,w){n=n>>>0,a=a>>>0,w||D(n,a,this.length);for(var L=this[n],K=1,J=0;++J<a&&(K*=256);)L+=this[n+J]*K;return L},r.prototype.readUIntBE=function(n,a,w){n=n>>>0,a=a>>>0,w||D(n,a,this.length);for(var L=this[n+--a],K=1;a>0&&(K*=256);)L+=this[n+--a]*K;return L},r.prototype.readUInt8=function(n,a){return n=n>>>0,a||D(n,1,this.length),this[n]},r.prototype.readUInt16LE=function(n,a){return n=n>>>0,a||D(n,2,this.length),this[n]|this[n+1]<<8},r.prototype.readUInt16BE=function(n,a){return n=n>>>0,a||D(n,2,this.length),this[n]<<8|this[n+1]},r.prototype.readUInt32LE=function(n,a){return n=n>>>0,a||D(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},r.prototype.readUInt32BE=function(n,a){return n=n>>>0,a||D(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},r.prototype.readIntLE=function(n,a,w){n=n>>>0,a=a>>>0,w||D(n,a,this.length);for(var L=this[n],K=1,J=0;++J<a&&(K*=256);)L+=this[n+J]*K;return K*=128,L>=K&&(L-=Math.pow(2,8*a)),L},r.prototype.readIntBE=function(n,a,w){n=n>>>0,a=a>>>0,w||D(n,a,this.length);for(var L=a,K=1,J=this[n+--L];L>0&&(K*=256);)J+=this[n+--L]*K;return K*=128,J>=K&&(J-=Math.pow(2,8*a)),J},r.prototype.readInt8=function(n,a){return n=n>>>0,a||D(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},r.prototype.readInt16LE=function(n,a){n=n>>>0,a||D(n,2,this.length);var w=this[n]|this[n+1]<<8;return w&32768?w|4294901760:w},r.prototype.readInt16BE=function(n,a){n=n>>>0,a||D(n,2,this.length);var w=this[n+1]|this[n]<<8;return w&32768?w|4294901760:w},r.prototype.readInt32LE=function(n,a){return n=n>>>0,a||D(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},r.prototype.readInt32BE=function(n,a){return n=n>>>0,a||D(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},r.prototype.readFloatLE=function(n,a){return n=n>>>0,a||D(n,4,this.length),m.read(this,n,!0,23,4)},r.prototype.readFloatBE=function(n,a){return n=n>>>0,a||D(n,4,this.length),m.read(this,n,!1,23,4)},r.prototype.readDoubleLE=function(n,a){return n=n>>>0,a||D(n,8,this.length),m.read(this,n,!0,52,8)},r.prototype.readDoubleBE=function(n,a){return n=n>>>0,a||D(n,8,this.length),m.read(this,n,!1,52,8)};function X(l,n,a,w,L,K){if(!r.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>L||n<K)throw new RangeError('"value" argument is out of bounds');if(a+w>l.length)throw new RangeError("Index out of range")}r.prototype.writeUIntLE=function(n,a,w,L){if(n=+n,a=a>>>0,w=w>>>0,!L){var K=Math.pow(2,8*w)-1;X(this,n,a,w,K,0)}var J=1,le=0;for(this[a]=n&255;++le<w&&(J*=256);)this[a+le]=n/J&255;return a+w},r.prototype.writeUIntBE=function(n,a,w,L){if(n=+n,a=a>>>0,w=w>>>0,!L){var K=Math.pow(2,8*w)-1;X(this,n,a,w,K,0)}var J=w-1,le=1;for(this[a+J]=n&255;--J>=0&&(le*=256);)this[a+J]=n/le&255;return a+w},r.prototype.writeUInt8=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,1,255,0),this[a]=n&255,a+1},r.prototype.writeUInt16LE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,2,65535,0),this[a]=n&255,this[a+1]=n>>>8,a+2},r.prototype.writeUInt16BE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,2,65535,0),this[a]=n>>>8,this[a+1]=n&255,a+2},r.prototype.writeUInt32LE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,4,4294967295,0),this[a+3]=n>>>24,this[a+2]=n>>>16,this[a+1]=n>>>8,this[a]=n&255,a+4},r.prototype.writeUInt32BE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,4,4294967295,0),this[a]=n>>>24,this[a+1]=n>>>16,this[a+2]=n>>>8,this[a+3]=n&255,a+4},r.prototype.writeIntLE=function(n,a,w,L){if(n=+n,a=a>>>0,!L){var K=Math.pow(2,8*w-1);X(this,n,a,w,K-1,-K)}var J=0,le=1,he=0;for(this[a]=n&255;++J<w&&(le*=256);)n<0&&he===0&&this[a+J-1]!==0&&(he=1),this[a+J]=(n/le>>0)-he&255;return a+w},r.prototype.writeIntBE=function(n,a,w,L){if(n=+n,a=a>>>0,!L){var K=Math.pow(2,8*w-1);X(this,n,a,w,K-1,-K)}var J=w-1,le=1,he=0;for(this[a+J]=n&255;--J>=0&&(le*=256);)n<0&&he===0&&this[a+J+1]!==0&&(he=1),this[a+J]=(n/le>>0)-he&255;return a+w},r.prototype.writeInt8=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,1,127,-128),n<0&&(n=255+n+1),this[a]=n&255,a+1},r.prototype.writeInt16LE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,2,32767,-32768),this[a]=n&255,this[a+1]=n>>>8,a+2},r.prototype.writeInt16BE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,2,32767,-32768),this[a]=n>>>8,this[a+1]=n&255,a+2},r.prototype.writeInt32LE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,4,2147483647,-2147483648),this[a]=n&255,this[a+1]=n>>>8,this[a+2]=n>>>16,this[a+3]=n>>>24,a+4},r.prototype.writeInt32BE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[a]=n>>>24,this[a+1]=n>>>16,this[a+2]=n>>>8,this[a+3]=n&255,a+4};function $(l,n,a,w,L,K){if(a+w>l.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function oe(l,n,a,w,L){return n=+n,a=a>>>0,L||$(l,n,a,4,34028234663852886e22,-34028234663852886e22),m.write(l,n,a,w,23,4),a+4}r.prototype.writeFloatLE=function(n,a,w){return oe(this,n,a,!0,w)},r.prototype.writeFloatBE=function(n,a,w){return oe(this,n,a,!1,w)};function Z(l,n,a,w,L){return n=+n,a=a>>>0,L||$(l,n,a,8,17976931348623157e292,-17976931348623157e292),m.write(l,n,a,w,52,8),a+8}r.prototype.writeDoubleLE=function(n,a,w){return Z(this,n,a,!0,w)},r.prototype.writeDoubleBE=function(n,a,w){return Z(this,n,a,!1,w)},r.prototype.copy=function(n,a,w,L){if(!r.isBuffer(n))throw new TypeError("argument should be a Buffer");if(w||(w=0),!L&&L!==0&&(L=this.length),a>=n.length&&(a=n.length),a||(a=0),L>0&&L<w&&(L=w),L===w||n.length===0||this.length===0)return 0;if(a<0)throw new RangeError("targetStart out of bounds");if(w<0||w>=this.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("sourceEnd out of bounds");L>this.length&&(L=this.length),n.length-a<L-w&&(L=n.length-a+w);var K=L-w;if(this===n&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(a,w,L);else if(this===n&&w<a&&a<L)for(var J=K-1;J>=0;--J)n[J+a]=this[J+w];else Uint8Array.prototype.set.call(n,this.subarray(w,L),a);return K},r.prototype.fill=function(n,a,w,L){if(typeof n=="string"){if(typeof a=="string"?(L=a,a=0,w=this.length):typeof w=="string"&&(L=w,w=this.length),L!==void 0&&typeof L!="string")throw new TypeError("encoding must be a string");if(typeof L=="string"&&!r.isEncoding(L))throw new TypeError("Unknown encoding: "+L);if(n.length===1){var K=n.charCodeAt(0);(L==="utf8"&&K<128||L==="latin1")&&(n=K)}}else typeof n=="number"&&(n=n&255);if(a<0||this.length<a||this.length<w)throw new RangeError("Out of range index");if(w<=a)return this;a=a>>>0,w=w===void 0?this.length:w>>>0,n||(n=0);var J;if(typeof n=="number")for(J=a;J<w;++J)this[J]=n;else{var le=r.isBuffer(n)?n:r.from(n,L),he=le.length;if(he===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(J=0;J<w-a;++J)this[J+a]=le[J%he]}return this};var F=/[^+/0-9A-Za-z-_]/g;function M(l){if(l=l.split("=")[0],l=l.trim().replace(F,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function Y(l){return l<16?"0"+l.toString(16):l.toString(16)}function te(l,n){n=n||1/0;for(var a,w=l.length,L=null,K=[],J=0;J<w;++J){if(a=l.charCodeAt(J),a>55295&&a<57344){if(!L){if(a>56319){(n-=3)>-1&&K.push(239,191,189);continue}else if(J+1===w){(n-=3)>-1&&K.push(239,191,189);continue}L=a;continue}if(a<56320){(n-=3)>-1&&K.push(239,191,189),L=a;continue}a=(L-55296<<10|a-56320)+65536}else L&&(n-=3)>-1&&K.push(239,191,189);if(L=null,a<128){if((n-=1)<0)break;K.push(a)}else if(a<2048){if((n-=2)<0)break;K.push(a>>6|192,a&63|128)}else if(a<65536){if((n-=3)<0)break;K.push(a>>12|224,a>>6&63|128,a&63|128)}else if(a<1114112){if((n-=4)<0)break;K.push(a>>18|240,a>>12&63|128,a>>6&63|128,a&63|128)}else throw new Error("Invalid code point")}return K}function O(l){for(var n=[],a=0;a<l.length;++a)n.push(l.charCodeAt(a)&255);return n}function I(l,n){for(var a,w,L,K=[],J=0;J<l.length&&!((n-=2)<0);++J)a=l.charCodeAt(J),w=a>>8,L=a%256,K.push(L),K.push(w);return K}function N(l){return c.toByteArray(M(l))}function q(l,n,a,w){for(var L=0;L<w&&!(L+a>=n.length||L>=l.length);++L)n[L+a]=l[L];return L}function Q(l,n){return l instanceof n||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===n.name}function b(l){return l!==l}}).call(this)}).call(this,y("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:5}],4:[function(y,k,x){"use strict";var p=typeof Reflect=="object"?Reflect:null,c=p&&typeof p.apply=="function"?p.apply:function(P,S,V){return Function.prototype.apply.call(P,S,V)},m;p&&typeof p.ownKeys=="function"?m=p.ownKeys:Object.getOwnPropertySymbols?m=function(P){return Object.getOwnPropertyNames(P).concat(Object.getOwnPropertySymbols(P))}:m=function(P){return Object.getOwnPropertyNames(P)};function h(C){console&&console.warn&&console.warn(C)}var s=Number.isNaN||function(P){return P!==P};function i(){i.init.call(this)}k.exports=i,k.exports.once=A,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var r=10;function e(C){if(typeof C!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof C)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return r},set:function(C){if(typeof C!="number"||C<0||s(C))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+C+".");r=C}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(P){if(typeof P!="number"||P<0||s(P))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+P+".");return this._maxListeners=P,this};function t(C){return C._maxListeners===void 0?i.defaultMaxListeners:C._maxListeners}i.prototype.getMaxListeners=function(){return t(this)},i.prototype.emit=function(P){for(var S=[],V=1;V<arguments.length;V++)S.push(arguments[V]);var B=P==="error",ne=this._events;if(ne!==void 0)B=B&&ne.error===void 0;else if(!B)return!1;if(B){var se;if(S.length>0&&(se=S[0]),se instanceof Error)throw se;var ie=new Error("Unhandled error."+(se?" ("+se.message+")":""));throw ie.context=se,ie}var G=ne[P];if(G===void 0)return!1;if(typeof G=="function")c(G,this,S);else for(var E=G.length,T=f(G,E),V=0;V<E;++V)c(T[V],this,S);return!0};function o(C,P,S,V){var B,ne,se;if(e(S),ne=C._events,ne===void 0?(ne=C._events=Object.create(null),C._eventsCount=0):(ne.newListener!==void 0&&(C.emit("newListener",P,S.listener?S.listener:S),ne=C._events),se=ne[P]),se===void 0)se=ne[P]=S,++C._eventsCount;else if(typeof se=="function"?se=ne[P]=V?[S,se]:[se,S]:V?se.unshift(S):se.push(S),B=t(C),B>0&&se.length>B&&!se.warned){se.warned=!0;var ie=new Error("Possible EventEmitter memory leak detected. "+se.length+" "+String(P)+" listeners added. Use emitter.setMaxListeners() to increase limit");ie.name="MaxListenersExceededWarning",ie.emitter=C,ie.type=P,ie.count=se.length,h(ie)}return C}i.prototype.addListener=function(P,S){return o(this,P,S,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(P,S){return o(this,P,S,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(C,P,S){var V={fired:!1,wrapFn:void 0,target:C,type:P,listener:S},B=u.bind(V);return B.listener=S,V.wrapFn=B,B}i.prototype.once=function(P,S){return e(S),this.on(P,d(this,P,S)),this},i.prototype.prependOnceListener=function(P,S){return e(S),this.prependListener(P,d(this,P,S)),this},i.prototype.removeListener=function(P,S){var V,B,ne,se,ie;if(e(S),B=this._events,B===void 0)return this;if(V=B[P],V===void 0)return this;if(V===S||V.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete B[P],B.removeListener&&this.emit("removeListener",P,V.listener||S));else if(typeof V!="function"){for(ne=-1,se=V.length-1;se>=0;se--)if(V[se]===S||V[se].listener===S){ie=V[se].listener,ne=se;break}if(ne<0)return this;ne===0?V.shift():v(V,ne),V.length===1&&(B[P]=V[0]),B.removeListener!==void 0&&this.emit("removeListener",P,ie||S)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(P){var S,V,B;if(V=this._events,V===void 0)return this;if(V.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):V[P]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete V[P]),this;if(arguments.length===0){var ne=Object.keys(V),se;for(B=0;B<ne.length;++B)se=ne[B],se!=="removeListener"&&this.removeAllListeners(se);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=V[P],typeof S=="function")this.removeListener(P,S);else if(S!==void 0)for(B=S.length-1;B>=0;B--)this.removeListener(P,S[B]);return this};function g(C,P,S){var V=C._events;if(V===void 0)return[];var B=V[P];return B===void 0?[]:typeof B=="function"?S?[B.listener||B]:[B]:S?R(B):f(B,B.length)}i.prototype.listeners=function(P){return g(this,P,!0)},i.prototype.rawListeners=function(P){return g(this,P,!1)},i.listenerCount=function(C,P){return typeof C.listenerCount=="function"?C.listenerCount(P):_.call(C,P)},i.prototype.listenerCount=_;function _(C){var P=this._events;if(P!==void 0){var S=P[C];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?m(this._events):[]};function f(C,P){for(var S=new Array(P),V=0;V<P;++V)S[V]=C[V];return S}function v(C,P){for(;P+1<C.length;P++)C[P]=C[P+1];C.pop()}function R(C){for(var P=new Array(C.length),S=0;S<P.length;++S)P[S]=C[S].listener||C[S];return P}function A(C,P){return new Promise(function(S,V){function B(se){C.removeListener(P,ne),V(se)}function ne(){typeof C.removeListener=="function"&&C.removeListener("error",B),S([].slice.call(arguments))}j(C,P,ne,{once:!0}),P!=="error"&&W(C,B,{once:!0})})}function W(C,P,S){typeof C.on=="function"&&j(C,"error",P,S)}function j(C,P,S,V){if(typeof C.on=="function")V.once?C.once(P,S):C.on(P,S);else if(typeof C.addEventListener=="function")C.addEventListener(P,function B(ne){V.once&&C.removeEventListener(P,B),S(ne)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof C)}},{}],5:[function(y,k,x){x.read=function(p,c,m,h,s){var i,r,e=s*8-h-1,t=(1<<e)-1,o=t>>1,u=-7,d=m?s-1:0,g=m?-1:1,_=p[c+d];for(d+=g,i=_&(1<<-u)-1,_>>=-u,u+=e;u>0;i=i*256+p[c+d],d+=g,u-=8);for(r=i&(1<<-u)-1,i>>=-u,u+=h;u>0;r=r*256+p[c+d],d+=g,u-=8);if(i===0)i=1-o;else{if(i===t)return r?NaN:(_?-1:1)*(1/0);r=r+Math.pow(2,h),i=i-o}return(_?-1:1)*r*Math.pow(2,i-h)},x.write=function(p,c,m,h,s,i){var r,e,t,o=i*8-s-1,u=(1<<o)-1,d=u>>1,g=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=h?0:i-1,f=h?1:-1,v=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(e=isNaN(c)?1:0,r=u):(r=Math.floor(Math.log(c)/Math.LN2),c*(t=Math.pow(2,-r))<1&&(r--,t*=2),r+d>=1?c+=g/t:c+=g*Math.pow(2,1-d),c*t>=2&&(r++,t/=2),r+d>=u?(e=0,r=u):r+d>=1?(e=(c*t-1)*Math.pow(2,s),r=r+d):(e=c*Math.pow(2,d-1)*Math.pow(2,s),r=0));s>=8;p[m+_]=e&255,_+=f,e/=256,s-=8);for(r=r<<s|e,o+=s;o>0;p[m+_]=r&255,_+=f,r/=256,o-=8);p[m+_-f]|=v*128}},{}],6:[function(y,k,x){(function(p,c){(function(){"use strict";let m=y("events").EventEmitter,h=y("./store"),s=y("./topic-alias-recv"),i=y("./topic-alias-send"),r=y("mqtt-packet"),e=y("./default-message-id-provider"),t=y("readable-stream").Writable,o=y("inherits"),u=y("reinterval"),d=y("rfdc/default"),g=y("./validations"),_=y("xtend"),f=y("debug")("mqttjs:client"),v=p?p.nextTick:function(E){setTimeout(E,0)},R=c.setImmediate||function(E){v(E)},A={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},W=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],j={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"};function C(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function P(E,T){if(E.options.protocolVersion===5&&T.cmd==="publish"){let U;T.properties&&(U=T.properties.topicAlias);let z=T.topic.toString();if(E.topicAliasSend)if(U){if(z.length!==0&&(f("applyTopicAlias :: register topic: %s - alias: %d",z,U),!E.topicAliasSend.put(z,U)))return f("applyTopicAlias :: error out of range. topic: %s - alias: %d",z,U),new Error("Sending Topic Alias out of range")}else z.length!==0&&(E.options.autoAssignTopicAlias?(U=E.topicAliasSend.getAliasByTopic(z),U?(T.topic="",T.properties=Be(Me({},T.properties),{topicAlias:U}),f("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",z,U)):(U=E.topicAliasSend.getLruAlias(),E.topicAliasSend.put(z,U),T.properties=Be(Me({},T.properties),{topicAlias:U}),f("applyTopicAlias :: auto assign topic: %s - alias: %d",z,U))):E.options.autoUseTopicAlias&&(U=E.topicAliasSend.getAliasByTopic(z),U&&(T.topic="",T.properties=Be(Me({},T.properties),{topicAlias:U}),f("applyTopicAlias :: auto use topic: %s - alias: %d",z,U))));else if(U)return f("applyTopicAlias :: error out of range. topic: %s - alias: %d",z,U),new Error("Sending Topic Alias out of range")}}function S(E,T){let U;T.properties&&(U=T.properties.topicAlias);let z=T.topic.toString();if(z.length===0){if(typeof U>"u")return new Error("Unregistered Topic Alias");if(z=E.topicAliasSend.getTopicByAlias(U),typeof z>"u")return new Error("Unregistered Topic Alias");T.topic=z}U&&delete T.properties.topicAlias}function V(E,T,U){f("sendPacket :: packet: %O",T),f("sendPacket :: emitting `packetsend`"),E.emit("packetsend",T),f("sendPacket :: writing to stream");let z=r.writeToStream(T,E.stream,E.options);f("sendPacket :: writeToStream result %s",z),!z&&U&&U!==ie?(f("sendPacket :: handle events on `drain` once through callback."),E.stream.once("drain",U)):U&&(f("sendPacket :: invoking cb"),U())}function B(E){E&&(f("flush: queue exists? %b",!!E),Object.keys(E).forEach(function(T){typeof E[T].cb=="function"&&(E[T].cb(new Error("Connection closed")),delete E[T])}))}function ne(E){E&&(f("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(E).forEach(function(T){E[T].volatile&&typeof E[T].cb=="function"&&(E[T].cb(new Error("Connection closed")),delete E[T])}))}function se(E,T,U,z){f("storeAndSend :: store packet with cmd %s to outgoingStore",T.cmd);let re=T,ee;if(re.cmd==="publish"&&(re=d(T),ee=S(E,re),ee))return U&&U(ee);E.outgoingStore.put(re,function(D){if(D)return U&&U(D);z(),V(E,T,U)})}function ie(E){f("nop ::",E)}function G(E,T){let U,z=this;if(!(this instanceof G))return new G(E,T);this.options=T||{};for(U in A)typeof this.options[U]>"u"?this.options[U]=A[U]:this.options[U]=T[U];f("MqttClient :: options.protocol",T.protocol),f("MqttClient :: options.protocolVersion",T.protocolVersion),f("MqttClient :: options.username",T.username),f("MqttClient :: options.keepalive",T.keepalive),f("MqttClient :: options.reconnectPeriod",T.reconnectPeriod),f("MqttClient :: options.rejectUnauthorized",T.rejectUnauthorized),f("MqttClient :: options.topicAliasMaximum",T.topicAliasMaximum),this.options.clientId=typeof T.clientId=="string"?T.clientId:C(),f("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=T.protocolVersion===5&&T.customHandleAcks?T.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=E,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new e:this.options.messageIdProvider,this.outgoingStore=T.outgoingStore||new h,this.incomingStore=T.incomingStore||new h,this.queueQoSZero=T.queueQoSZero===void 0?!0:T.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,T.topicAliasMaximum>0&&(T.topicAliasMaximum>65535?f("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new s(T.topicAliasMaximum)),this.on("connect",function(){let re=this.queue;function ee(){let H=re.shift();f("deliver :: entry %o",H);let D=null;if(!H){z._resubscribe();return}D=H.packet,f("deliver :: call _sendPacket for %o",D);let X=!0;D.messageId&&D.messageId!==0&&(z.messageIdProvider.register(D.messageId)||(X=!1)),X?z._sendPacket(D,function($){H.cb&&H.cb($),ee()}):(f("messageId: %d has already used. The message is skipped and removed.",D.messageId),ee())}f("connect :: sending queued packets"),ee()}),this.on("close",function(){f("close :: connected set to `false`"),this.connected=!1,f("close :: clearing connackTimer"),clearTimeout(this.connackTimer),f("close :: clearing ping timer"),z.pingTimer!==null&&(z.pingTimer.clear(),z.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),f("close :: calling _setupReconnect"),this._setupReconnect()}),m.call(this),f("MqttClient :: setting up stream"),this._setupStream()}o(G,m),G.prototype._setupStream=function(){let E=this,T=new t,U=r.parser(this.options),z=null,re=[];f("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),f("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),U.on("packet",function($){f("parser :: on packet push to packets array."),re.push($)});function ee(){if(re.length)v(H);else{let $=z;z=null,$()}}function H(){f("work :: getting next packet in queue");let $=re.shift();if($)f("work :: packet pulled from queue"),E._handlePacket($,ee);else{f("work :: no packets in queue");let oe=z;z=null,f("work :: done flag is %s",!!oe),oe&&oe()}}T._write=function($,oe,Z){z=Z,f("writable stream :: parsing buffer"),U.parse($),H()};function D($){f("streamErrorHandler :: error",$.message),W.includes($.code)?(f("streamErrorHandler :: emitting error"),E.emit("error",$)):ie($)}f("_setupStream :: pipe stream to writable stream"),this.stream.pipe(T),this.stream.on("error",D),this.stream.on("close",function(){f("(%s)stream :: on close",E.options.clientId),ne(E.outgoing),f("stream: emit close to MqttClient"),E.emit("close")}),f("_setupStream: sending packet `connect`");let X=Object.create(this.options);if(X.cmd="connect",this.topicAliasRecv&&(X.properties||(X.properties={}),this.topicAliasRecv&&(X.properties.topicAliasMaximum=this.topicAliasRecv.max)),V(this,X),U.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return E.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let $=_({cmd:"auth",reasonCode:0},this.options.authPacket);V(this,$)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){f("!!connectTimeout hit!! Calling _cleanUp with force `true`"),E._cleanUp(!0)},this.options.connectTimeout)},G.prototype._handlePacket=function(E,T){let U=this.options;if(U.protocolVersion===5&&U.properties&&U.properties.maximumPacketSize&&U.properties.maximumPacketSize<E.length)return this.emit("error",new Error("exceeding packets size "+E.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(f("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",E),E.cmd){case"publish":this._handlePublish(E,T);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(E),T();break;case"pubrel":this._handlePubrel(E,T);break;case"connack":this._handleConnack(E),T();break;case"auth":this._handleAuth(E),T();break;case"pingresp":this._handlePingresp(E),T();break;case"disconnect":this._handleDisconnect(E),T();break;default:break}},G.prototype._checkDisconnecting=function(E){return this.disconnecting&&(E&&E!==ie?E(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},G.prototype.publish=function(E,T,U,z){f("publish :: message `%s` to topic `%s`",T,E);let re=this.options;if(typeof U=="function"&&(z=U,U=null),U=_({qos:0,retain:!1,dup:!1},U),this._checkDisconnecting(z))return this;let H=this,D=function(){let X=0;if((U.qos===1||U.qos===2)&&(X=H._nextId(),X===null))return f("No messageId left"),!1;let $={cmd:"publish",topic:E,payload:T,qos:U.qos,retain:U.retain,messageId:X,dup:U.dup};switch(re.protocolVersion===5&&($.properties=U.properties),f("publish :: qos",U.qos),U.qos){case 1:case 2:H.outgoing[$.messageId]={volatile:!1,cb:z||ie},f("MqttClient:publish: packet cmd: %s",$.cmd),H._sendPacket($,void 0,U.cbStorePut);break;default:f("MqttClient:publish: packet cmd: %s",$.cmd),H._sendPacket($,z,U.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!D())&&this._storeProcessingQueue.push({invoke:D,cbStorePut:U.cbStorePut,callback:z}),this},G.prototype.subscribe=function(){let E=this,T=new Array(arguments.length);for(let Z=0;Z<arguments.length;Z++)T[Z]=arguments[Z];let U=[],z=T.shift(),re=z.resubscribe,ee=T.pop()||ie,H=T.pop(),D=this.options.protocolVersion;delete z.resubscribe,typeof z=="string"&&(z=[z]),typeof ee!="function"&&(H=ee,ee=ie);let X=g.validateTopics(z);if(X!==null)return R(ee,new Error("Invalid topic "+X)),this;if(this._checkDisconnecting(ee))return f("subscribe: discconecting true"),this;let $={qos:0};if(D===5&&($.nl=!1,$.rap=!1,$.rh=0),H=_($,H),Array.isArray(z)?z.forEach(function(Z){if(f("subscribe: array topic %s",Z),!Object.prototype.hasOwnProperty.call(E._resubscribeTopics,Z)||E._resubscribeTopics[Z].qos<H.qos||re){let F={topic:Z,qos:H.qos};D===5&&(F.nl=H.nl,F.rap=H.rap,F.rh=H.rh,F.properties=H.properties),f("subscribe: pushing topic `%s` and qos `%s` to subs list",F.topic,F.qos),U.push(F)}}):Object.keys(z).forEach(function(Z){if(f("subscribe: object topic %s",Z),!Object.prototype.hasOwnProperty.call(E._resubscribeTopics,Z)||E._resubscribeTopics[Z].qos<z[Z].qos||re){let F={topic:Z,qos:z[Z].qos};D===5&&(F.nl=z[Z].nl,F.rap=z[Z].rap,F.rh=z[Z].rh,F.properties=H.properties),f("subscribe: pushing `%s` to subs list",F),U.push(F)}}),!U.length)return ee(null,[]),this;let oe=function(){let Z=E._nextId();if(Z===null)return f("No messageId left"),!1;let F={cmd:"subscribe",subscriptions:U,qos:1,retain:!1,dup:!1,messageId:Z};if(H.properties&&(F.properties=H.properties),E.options.resubscribe){f("subscribe :: resubscribe true");let M=[];U.forEach(function(Y){if(E.options.reconnectPeriod>0){let te={qos:Y.qos};D===5&&(te.nl=Y.nl||!1,te.rap=Y.rap||!1,te.rh=Y.rh||0,te.properties=Y.properties),E._resubscribeTopics[Y.topic]=te,M.push(Y.topic)}}),E.messageIdToTopic[F.messageId]=M}return E.outgoing[F.messageId]={volatile:!0,cb:function(M,Y){if(!M){let te=Y.granted;for(let O=0;O<te.length;O+=1)U[O].qos=te[O]}ee(M,U)}},f("subscribe :: call _sendPacket"),E._sendPacket(F),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!oe())&&this._storeProcessingQueue.push({invoke:oe,callback:ee}),this},G.prototype.unsubscribe=function(){let E=this,T=new Array(arguments.length);for(let D=0;D<arguments.length;D++)T[D]=arguments[D];let U=T.shift(),z=T.pop()||ie,re=T.pop();typeof U=="string"&&(U=[U]),typeof z!="function"&&(re=z,z=ie);let ee=g.validateTopics(U);if(ee!==null)return R(z,new Error("Invalid topic "+ee)),this;if(E._checkDisconnecting(z))return this;let H=function(){let D=E._nextId();if(D===null)return f("No messageId left"),!1;let X={cmd:"unsubscribe",qos:1,messageId:D};return typeof U=="string"?X.unsubscriptions=[U]:Array.isArray(U)&&(X.unsubscriptions=U),E.options.resubscribe&&X.unsubscriptions.forEach(function($){delete E._resubscribeTopics[$]}),typeof re=="object"&&re.properties&&(X.properties=re.properties),E.outgoing[X.messageId]={volatile:!0,cb:z},f("unsubscribe: call _sendPacket"),E._sendPacket(X),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!H())&&this._storeProcessingQueue.push({invoke:H,callback:z}),this},G.prototype.end=function(E,T,U){let z=this;f("end :: (%s)",this.options.clientId),(E==null||typeof E!="boolean")&&(U=T||ie,T=E,E=!1,typeof T!="object"&&(U=T,T=null,typeof U!="function"&&(U=ie))),typeof T!="object"&&(U=T,T=null),f("end :: cb? %s",!!U),U=U||ie;function re(){f("end :: closeStores: closing incoming and outgoing stores"),z.disconnected=!0,z.incomingStore.close(function(H){z.outgoingStore.close(function(D){if(f("end :: closeStores: emitting end"),z.emit("end"),U){let X=H||D;f("end :: closeStores: invoking callback with args"),U(X)}})}),z._deferredReconnect&&z._deferredReconnect()}function ee(){f("end :: (%s) :: finish :: calling _cleanUp with force %s",z.options.clientId,E),z._cleanUp(E,()=>{f("end :: finish :: calling process.nextTick on closeStores"),v(re.bind(z))},T)}return this.disconnecting?(U(),this):(this._clearReconnect(),this.disconnecting=!0,!E&&Object.keys(this.outgoing).length>0?(f("end :: (%s) :: calling finish in 10ms once outgoing is empty",z.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,ee,10))):(f("end :: (%s) :: immediately calling finish",z.options.clientId),ee()),this)},G.prototype.removeOutgoingMessage=function(E){let T=this.outgoing[E]?this.outgoing[E].cb:null;return delete this.outgoing[E],this.outgoingStore.del({messageId:E},function(){T(new Error("Message removed"))}),this},G.prototype.reconnect=function(E){f("client reconnect");let T=this,U=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,T.outgoingStore=T.options.outgoingStore||new h,T.disconnecting=!1,T.disconnected=!1,T._deferredReconnect=null,T._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=U:U(),this},G.prototype._reconnect=function(){f("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),f("client already connected. disconnecting first.")):(f("_reconnect: calling _setupStream"),this._setupStream())},G.prototype._setupReconnect=function(){let E=this;!E.disconnecting&&!E.reconnectTimer&&E.options.reconnectPeriod>0?(this.reconnecting||(f("_setupReconnect :: emit `offline` state"),this.emit("offline"),f("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),f("_setupReconnect :: setting reconnectTimer for %d ms",E.options.reconnectPeriod),E.reconnectTimer=setInterval(function(){f("reconnectTimer :: reconnect triggered!"),E._reconnect()},E.options.reconnectPeriod)):f("_setupReconnect :: doing nothing...")},G.prototype._clearReconnect=function(){f("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},G.prototype._cleanUp=function(E,T){let U=arguments[2];if(T&&(f("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",T)),f("_cleanUp :: forced? %s",E),E)this.options.reconnectPeriod===0&&this.options.clean&&B(this.outgoing),f("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let z=_({cmd:"disconnect"},U);f("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(z,R.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(f("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(f("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),T&&!this.connected&&(f("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",T),T())},G.prototype._sendPacket=function(E,T,U){f("_sendPacket :: (%s) :: start",this.options.clientId),U=U||ie,T=T||ie;let z=P(this,E);if(z){T(z);return}if(!this.connected){if(E.cmd==="auth"){this._shiftPingInterval(),V(this,E,T);return}f("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(E,T,U);return}switch(this._shiftPingInterval(),E.cmd){case"publish":break;case"pubrel":se(this,E,T,U);return;default:V(this,E,T);return}switch(E.qos){case 2:case 1:se(this,E,T,U);break;case 0:default:V(this,E,T);break}f("_sendPacket :: (%s) :: end",this.options.clientId)},G.prototype._storePacket=function(E,T,U){f("_storePacket :: packet: %o",E),f("_storePacket :: cb? %s",!!T),U=U||ie;let z=E;if(z.cmd==="publish"){z=d(E);let re=S(this,z);if(re)return T&&T(re)}(z.qos||0)===0&&this.queueQoSZero||z.cmd!=="publish"?this.queue.push({packet:z,cb:T}):z.qos>0?(T=this.outgoing[z.messageId]?this.outgoing[z.messageId].cb:null,this.outgoingStore.put(z,function(re){if(re)return T&&T(re);U()})):T&&T(new Error("No connection to broker"))},G.prototype._setupPingTimer=function(){f("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);let E=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=u(function(){E._checkPing()},this.options.keepalive*1e3))},G.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)},G.prototype._checkPing=function(){f("_checkPing :: checking ping..."),this.pingResp?(f("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(f("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},G.prototype._handlePingresp=function(){this.pingResp=!0},G.prototype._handleConnack=function(E){f("_handleConnack");let T=this.options,z=T.protocolVersion===5?E.reasonCode:E.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,E.properties){if(E.properties.topicAliasMaximum){if(E.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}E.properties.topicAliasMaximum>0&&(this.topicAliasSend=new i(E.properties.topicAliasMaximum))}E.properties.serverKeepAlive&&T.keepalive&&(T.keepalive=E.properties.serverKeepAlive,this._shiftPingInterval()),E.properties.maximumPacketSize&&(T.properties||(T.properties={}),T.properties.maximumPacketSize=E.properties.maximumPacketSize)}if(z===0)this.reconnecting=!1,this._onConnect(E);else if(z>0){let re=new Error("Connection refused: "+j[z]);re.code=z,this.emit("error",re)}},G.prototype._handleAuth=function(E){let U=this.options.protocolVersion,z=U===5?E.reasonCode:E.returnCode;if(U!==5){let ee=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+U);ee.code=z,this.emit("error",ee);return}let re=this;this.handleAuth(E,function(ee,H){if(ee){re.emit("error",ee);return}if(z===24)re.reconnecting=!1,re._sendPacket(H);else{let D=new Error("Connection refused: "+j[z]);ee.code=z,re.emit("error",D)}})},G.prototype.handleAuth=function(E,T){T()},G.prototype._handlePublish=function(E,T){f("_handlePublish: packet %o",E),T=typeof T<"u"?T:ie;let U=E.topic.toString(),z=E.payload,re=E.qos,ee=E.messageId,H=this,D=this.options,X=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let $;if(E.properties&&($=E.properties.topicAlias),typeof $<"u")if(U.length===0)if($>0&&$<=65535){let oe=this.topicAliasRecv.getTopicByAlias($);if(oe)U=oe,f("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",U,$);else{f("_handlePublish :: unregistered topic alias. alias: %d",$),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{f("_handlePublish :: topic alias out of range. alias: %d",$),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(U,$))f("_handlePublish :: registered topic: %s - alias: %d",U,$);else{f("_handlePublish :: topic alias out of range. alias: %d",$),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(f("_handlePublish: qos %d",re),re){case 2:{D.customHandleAcks(U,z,E,function($,oe){if($ instanceof Error||(oe=$,$=null),$)return H.emit("error",$);if(X.indexOf(oe)===-1)return H.emit("error",new Error("Wrong reason code for pubrec"));oe?H._sendPacket({cmd:"pubrec",messageId:ee,reasonCode:oe},T):H.incomingStore.put(E,function(){H._sendPacket({cmd:"pubrec",messageId:ee},T)})});break}case 1:{D.customHandleAcks(U,z,E,function($,oe){if($ instanceof Error||(oe=$,$=null),$)return H.emit("error",$);if(X.indexOf(oe)===-1)return H.emit("error",new Error("Wrong reason code for puback"));oe||H.emit("message",U,z,E),H.handleMessage(E,function(Z){if(Z)return T&&T(Z);H._sendPacket({cmd:"puback",messageId:ee,reasonCode:oe},T)})});break}case 0:this.emit("message",U,z,E),this.handleMessage(E,T);break;default:f("_handlePublish: unknown QoS. Doing nothing.");break}},G.prototype.handleMessage=function(E,T){T()},G.prototype._handleAck=function(E){let T=E.messageId,U=E.cmd,z=null,re=this.outgoing[T]?this.outgoing[T].cb:null,ee=this,H;if(!re){f("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(f("_handleAck :: packet type",U),U){case"pubcomp":case"puback":{let D=E.reasonCode;D&&D>0&&D!==16&&(H=new Error("Publish error: "+j[D]),H.code=D,re(H,E)),delete this.outgoing[T],this.outgoingStore.del(E,re),this.messageIdProvider.deallocate(T),this._invokeStoreProcessingQueue();break}case"pubrec":{z={cmd:"pubrel",qos:2,messageId:T};let D=E.reasonCode;D&&D>0&&D!==16?(H=new Error("Publish error: "+j[D]),H.code=D,re(H,E)):this._sendPacket(z);break}case"suback":{delete this.outgoing[T],this.messageIdProvider.deallocate(T);for(let D=0;D<E.granted.length;D++)if(E.granted[D]&128){let X=this.messageIdToTopic[T];X&&X.forEach(function($){delete ee._resubscribeTopics[$]})}this._invokeStoreProcessingQueue(),re(null,E);break}case"unsuback":{delete this.outgoing[T],this.messageIdProvider.deallocate(T),this._invokeStoreProcessingQueue(),re(null);break}default:ee.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},G.prototype._handlePubrel=function(E,T){f("handling pubrel packet"),T=typeof T<"u"?T:ie;let U=E.messageId,z=this,re={cmd:"pubcomp",messageId:U};z.incomingStore.get(E,function(ee,H){ee?z._sendPacket(re,T):(z.emit("message",H.topic,H.payload,H),z.handleMessage(H,function(D){if(D)return T(D);z.incomingStore.del(H,ie),z._sendPacket(re,T)}))})},G.prototype._handleDisconnect=function(E){this.emit("disconnect",E)},G.prototype._nextId=function(){return this.messageIdProvider.allocate()},G.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},G.prototype._resubscribe=function(){f("_resubscribe");let E=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&E.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){f("_resubscribe: protocolVersion 5");for(let T=0;T<E.length;T++){let U={};U[E[T]]=this._resubscribeTopics[E[T]],U.resubscribe=!0,this.subscribe(U,{properties:U[E[T]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},G.prototype._onConnect=function(E){if(this.disconnected){this.emit("connect",E);return}let T=this;this.connackPacket=E,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function U(){let z=T.outgoingStore.createStream();function re(){T._storeProcessing=!1,T._packetIdsDuringStoreProcessing={}}T.once("close",ee),z.on("error",function(D){re(),T._flushStoreProcessingQueue(),T.removeListener("close",ee),T.emit("error",D)});function ee(){z.destroy(),z=null,T._flushStoreProcessingQueue(),re()}function H(){if(!z)return;T._storeProcessing=!0;let D=z.read(1),X;if(!D){z.once("readable",H);return}if(T._packetIdsDuringStoreProcessing[D.messageId]){H();return}!T.disconnecting&&!T.reconnectTimer?(X=T.outgoing[D.messageId]?T.outgoing[D.messageId].cb:null,T.outgoing[D.messageId]={volatile:!1,cb:function($,oe){X&&X($,oe),H()}},T._packetIdsDuringStoreProcessing[D.messageId]=!0,T.messageIdProvider.register(D.messageId)?T._sendPacket(D):f("messageId: %d has already used.",D.messageId)):z.destroy&&z.destroy()}z.on("end",function(){let D=!0;for(let X in T._packetIdsDuringStoreProcessing)if(!T._packetIdsDuringStoreProcessing[X]){D=!1;break}D?(re(),T.removeListener("close",ee),T._invokeAllStoreProcessingQueue(),T.emit("connect",E)):U()}),H()}U()},G.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){let E=this._storeProcessingQueue[0];if(E&&E.invoke())return this._storeProcessingQueue.shift(),!0}return!1},G.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},G.prototype._flushStoreProcessingQueue=function(){for(let E of this._storeProcessingQueue)E.cbStorePut&&E.cbStorePut(new Error("Connection closed")),E.callback&&E.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},k.exports=G}).call(this)}).call(this,y("_process"),typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{"./default-message-id-provider":12,"./store":13,"./topic-alias-recv":14,"./topic-alias-send":15,"./validations":16,_process:85,debug:20,events:4,inherits:24,"mqtt-packet":48,"readable-stream":72,reinterval:73,"rfdc/default":74,xtend:82}],7:[function(y,k,x){"use strict";let{Buffer:p}=y("buffer"),c=y("readable-stream").Transform,m=y("duplexify"),h,s,i,r=!1;function e(){let g=new c;return g._write=function(_,f,v){h.sendSocketMessage({data:_.buffer,success:function(){v()},fail:function(){v(new Error)}})},g._flush=function(f){h.closeSocket({success:function(){f()}})},g}function t(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})}function o(g,_){let f=g.protocol==="alis"?"wss":"ws",v=f+"://"+g.hostname+g.path;return g.port&&g.port!==80&&g.port!==443&&(v=f+"://"+g.hostname+":"+g.port+g.path),typeof g.transformWsUrl=="function"&&(v=g.transformWsUrl(v,g,_)),v}function u(){r||(r=!0,h.onSocketOpen(function(){i.setReadable(s),i.setWritable(s),i.emit("connect")}),h.onSocketMessage(function(g){if(typeof g.data=="string"){let _=p.from(g.data,"base64");s.push(_)}else{let _=new FileReader;_.addEventListener("load",function(){let f=_.result;f instanceof ArrayBuffer?f=p.from(f):f=p.from(f,"utf8"),s.push(f)}),_.readAsArrayBuffer(g.data)}}),h.onSocketClose(function(){i.end(),i.destroy()}),h.onSocketError(function(g){i.destroy(g)}))}function d(g,_){if(_.hostname=_.hostname||_.host,!_.hostname)throw new Error("Could not determine host. Specify host manually.");let f=_.protocolId==="MQIsdp"&&_.protocolVersion===3?"mqttv3.1":"mqtt";t(_);let v=o(_,g);return h=_.my,h.connectSocket({url:v,protocols:f}),s=e(),i=m.obj(),u(),i}k.exports=d},{buffer:3,duplexify:22,"readable-stream":72}],8:[function(y,k,x){"use strict";let p=y("net"),c=y("debug")("mqttjs:tcp");function m(h,s){s.port=s.port||1883,s.hostname=s.hostname||s.host||"localhost";let i=s.port,r=s.hostname;return c("port %d and host %s",i,r),p.createConnection(i,r)}k.exports=m},{debug:20,net:2}],9:[function(y,k,x){"use strict";let p=y("tls"),c=y("net"),m=y("debug")("mqttjs:tls");function h(s,i){i.port=i.port||8883,i.host=i.hostname||i.host||"localhost",c.isIP(i.host)===0&&(i.servername=i.host),i.rejectUnauthorized=i.rejectUnauthorized!==!1,delete i.path,m("port %d host %s rejectUnauthorized %b",i.port,i.host,i.rejectUnauthorized);let r=p.connect(i);r.on("secureConnect",function(){i.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",e)});function e(t){i.rejectUnauthorized&&s.emit("error",t),r.end()}return r.on("error",e),r}k.exports=h},{debug:20,net:2,tls:2}],10:[function(y,k,x){(function(p){(function(){"use strict";let{Buffer:c}=y("buffer"),m=y("ws"),h=y("debug")("mqttjs:ws"),s=y("duplexify"),i=y("readable-stream").Transform,r=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],e=typeof p<"u"&&p.title==="browser"||typeof __webpack_require__=="function";function t(v,R){let A=v.protocol+"://"+v.hostname+":"+v.port+v.path;return typeof v.transformWsUrl=="function"&&(A=v.transformWsUrl(A,v,R)),A}function o(v){let R=v;return v.hostname||(R.hostname="localhost"),v.port||(v.protocol==="wss"?R.port=443:R.port=80),v.path||(R.path="/"),v.wsOptions||(R.wsOptions={}),!e&&v.protocol==="wss"&&r.forEach(function(A){Object.prototype.hasOwnProperty.call(v,A)&&!Object.prototype.hasOwnProperty.call(v.wsOptions,A)&&(R.wsOptions[A]=v[A])}),R}function u(v){let R=o(v);if(R.hostname||(R.hostname=R.host),!R.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let A=new URL(document.URL);R.hostname=A.hostname,R.port||(R.port=A.port)}return R.objectMode===void 0&&(R.objectMode=!(R.binary===!0||R.binary===void 0)),R}function d(v,R,A){h("createWebSocket"),h("protocol: "+A.protocolId+" "+A.protocolVersion);let W=A.protocolId==="MQIsdp"&&A.protocolVersion===3?"mqttv3.1":"mqtt";return h("creating new Websocket for url: "+R+" and protocol: "+W),new m(R,[W],A.wsOptions)}function g(v,R){let A=R.protocolId==="MQIsdp"&&R.protocolVersion===3?"mqttv3.1":"mqtt",W=t(R,v),j=new WebSocket(W,[A]);return j.binaryType="arraybuffer",j}function _(v,R){h("streamBuilder");let A=o(R),W=t(A,v),j=d(v,W,A),C=m.createWebSocketStream(j,A.wsOptions);return C.url=W,j.on("close",()=>{C.destroy()}),C}function f(v,R){h("browserStreamBuilder");let A,j=u(R).browserBufferSize||1024*512,C=R.browserBufferTimeout||1e3,P=!R.objectMode,S=g(v,R),V=ne(R,U,z);R.objectMode||(V._writev=T),V.on("close",()=>{S.close()});let B=typeof S.addEventListener<"u";S.readyState===S.OPEN?A=V:(A=A=s(void 0,void 0,R),R.objectMode||(A._writev=T),B?S.addEventListener("open",se):S.onopen=se),A.socket=S,B?(S.addEventListener("close",ie),S.addEventListener("error",G),S.addEventListener("message",E)):(S.onclose=ie,S.onerror=G,S.onmessage=E);function ne(re,ee,H){let D=new i({objectModeMode:re.objectMode});return D._write=ee,D._flush=H,D}function se(){A.setReadable(V),A.setWritable(V),A.emit("connect")}function ie(){A.end(),A.destroy()}function G(re){A.destroy(re)}function E(re){let ee=re.data;ee instanceof ArrayBuffer?ee=c.from(ee):ee=c.from(ee,"utf8"),V.push(ee)}function T(re,ee){let H=new Array(re.length);for(let D=0;D<re.length;D++)typeof re[D].chunk=="string"?H[D]=c.from(re[D],"utf8"):H[D]=re[D].chunk;this._write(c.concat(H),"binary",ee)}function U(re,ee,H){S.bufferedAmount>j&&setTimeout(U,C,re,ee,H),P&&typeof re=="string"&&(re=c.from(re,"utf8"));try{S.send(re)}catch(D){return H(D)}H()}function z(re){S.close(),re()}return A}e?k.exports=f:k.exports=_}).call(this)}).call(this,y("_process"))},{_process:85,buffer:3,debug:20,duplexify:22,"readable-stream":72,ws:81}],11:[function(y,k,x){"use strict";let{Buffer:p}=y("buffer"),c=y("readable-stream").Transform,m=y("duplexify"),h,s,i;function r(){let d=new c;return d._write=function(g,_,f){h.send({data:g.buffer,success:function(){f()},fail:function(v){f(new Error(v))}})},d._flush=function(_){h.close({success:function(){_()}})},d}function e(d){d.hostname||(d.hostname="localhost"),d.path||(d.path="/"),d.wsOptions||(d.wsOptions={})}function t(d,g){let _=d.protocol==="wxs"?"wss":"ws",f=_+"://"+d.hostname+d.path;return d.port&&d.port!==80&&d.port!==443&&(f=_+"://"+d.hostname+":"+d.port+d.path),typeof d.transformWsUrl=="function"&&(f=d.transformWsUrl(f,d,g)),f}function o(){h.onOpen(function(){i.setReadable(s),i.setWritable(s),i.emit("connect")}),h.onMessage(function(d){let g=d.data;g instanceof ArrayBuffer?g=p.from(g):g=p.from(g,"utf8"),s.push(g)}),h.onClose(function(){i.end(),i.destroy()}),h.onError(function(d){i.destroy(new Error(d.errMsg))})}function u(d,g){if(g.hostname=g.hostname||g.host,!g.hostname)throw new Error("Could not determine host. Specify host manually.");let _=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt";e(g);let f=t(g,d);h=wx.connectSocket({url:f,protocols:[_]}),s=r(),i=m.obj(),i._destroy=function(R,A){h.close({success:function(){A&&A(R)}})};let v=i.destroy;return i.destroy=(function(){i.destroy=v;let R=this;setTimeout(function(){h.close({fail:function(){R._destroy(new Error)}})},0)}).bind(i),o(),i}k.exports=u},{buffer:3,duplexify:22,"readable-stream":72}],12:[function(y,k,x){"use strict";function p(){if(!(this instanceof p))return new p;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}p.prototype.allocate=function(){let c=this.nextId++;return this.nextId===65536&&(this.nextId=1),c},p.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},p.prototype.register=function(c){return!0},p.prototype.deallocate=function(c){},p.prototype.clear=function(){},k.exports=p},{}],13:[function(y,k,x){"use strict";let p=y("xtend"),c=y("readable-stream").Readable,m={objectMode:!0},h={clean:!0};function s(i){if(!(this instanceof s))return new s(i);this.options=i||{},this.options=p(h,i),this._inflights=new Map}s.prototype.put=function(i,r){return this._inflights.set(i.messageId,i),r&&r(),this},s.prototype.createStream=function(){let i=new c(m),r=[],e=!1,t=0;return this._inflights.forEach(function(o,u){r.push(o)}),i._read=function(){!e&&t<r.length?this.push(r[t++]):this.push(null)},i.destroy=function(){if(e)return;let o=this;e=!0,setTimeout(function(){o.emit("close")},0)},i},s.prototype.del=function(i,r){return i=this._inflights.get(i.messageId),i?(this._inflights.delete(i.messageId),r(null,i)):r&&r(new Error("missing packet")),this},s.prototype.get=function(i,r){return i=this._inflights.get(i.messageId),i?r(null,i):r&&r(new Error("missing packet")),this},s.prototype.close=function(i){this.options.clean&&(this._inflights=null),i&&i()},k.exports=s},{"readable-stream":72,xtend:82}],14:[function(y,k,x){"use strict";function p(c){if(!(this instanceof p))return new p(c);this.aliasToTopic={},this.max=c}p.prototype.put=function(c,m){return m===0||m>this.max?!1:(this.aliasToTopic[m]=c,this.length=Object.keys(this.aliasToTopic).length,!0)},p.prototype.getTopicByAlias=function(c){return this.aliasToTopic[c]},p.prototype.clear=function(){this.aliasToTopic={}},k.exports=p},{}],15:[function(y,k,x){"use strict";let p=y("lru-cache"),c=y("number-allocator").NumberAllocator;function m(h){if(!(this instanceof m))return new m(h);h>0&&(this.aliasToTopic=new p({max:h}),this.topicToAlias={},this.numberAllocator=new c(1,h),this.max=h,this.length=0)}m.prototype.put=function(h,s){if(s===0||s>this.max)return!1;let i=this.aliasToTopic.get(s);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(s,h),this.topicToAlias[h]=s,this.numberAllocator.use(s),this.length=this.aliasToTopic.length,!0},m.prototype.getTopicByAlias=function(h){return this.aliasToTopic.get(h)},m.prototype.getAliasByTopic=function(h){let s=this.topicToAlias[h];return typeof s<"u"&&this.aliasToTopic.get(s),s},m.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},m.prototype.getLruAlias=function(){let h=this.numberAllocator.firstVacant();return h||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},k.exports=m},{"lru-cache":45,"number-allocator":54}],16:[function(y,k,x){"use strict";function p(m){let h=m.split("/");for(let s=0;s<h.length;s++)if(h[s]!=="+"){if(h[s]==="#")return s===h.length-1;if(h[s].indexOf("+")!==-1||h[s].indexOf("#")!==-1)return!1}return!0}function c(m){if(m.length===0)return"empty_topic_list";for(let h=0;h<m.length;h++)if(!p(m[h]))return m[h];return null}k.exports={validateTopics:c}},{}],17:[function(y,k,x){(function(p){(function(){"use strict";let c=y("../client"),m=y("../store"),h=y("url"),s=y("xtend"),i=y("debug")("mqttjs"),r={};typeof p<"u"&&p.title!=="browser"||typeof __webpack_require__!="function"?(r.mqtt=y("./tcp"),r.tcp=y("./tcp"),r.ssl=y("./tls"),r.tls=y("./tls"),r.mqtts=y("./tls")):(r.wx=y("./wx"),r.wxs=y("./wx"),r.ali=y("./ali"),r.alis=y("./ali")),r.ws=y("./ws"),r.wss=y("./ws");function e(o){let u;o.auth&&(u=o.auth.match(/^(.+):(.+)$/),u?(o.username=u[1],o.password=u[2]):o.username=o.auth)}function t(o,u){if(i("connecting to an MQTT broker..."),typeof o=="object"&&!u&&(u=o,o=null),u=u||{},o){let _=h.parse(o,!0);if(_.port!=null&&(_.port=Number(_.port)),u=s(_,u),u.protocol===null)throw new Error("Missing protocol");u.protocol=u.protocol.replace(/:$/,"")}if(e(u),u.query&&typeof u.query.clientId=="string"&&(u.clientId=u.query.clientId),u.cert&&u.key)if(u.protocol){if(["mqtts","wss","wxs","alis"].indexOf(u.protocol)===-1)switch(u.protocol){case"mqtt":u.protocol="mqtts";break;case"ws":u.protocol="wss";break;case"wx":u.protocol="wxs";break;case"ali":u.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+u.protocol+'"!')}}else throw new Error("Missing secure protocol key");if(!r[u.protocol]){let _=["mqtts","wss"].indexOf(u.protocol)!==-1;u.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(f,v){return _&&v%2===0?!1:typeof r[f]=="function"})[0]}if(u.clean===!1&&!u.clientId)throw new Error("Missing clientId for unclean clients");u.protocol&&(u.defaultProtocol=u.protocol);function d(_){return u.servers&&((!_._reconnectCount||_._reconnectCount===u.servers.length)&&(_._reconnectCount=0),u.host=u.servers[_._reconnectCount].host,u.port=u.servers[_._reconnectCount].port,u.protocol=u.servers[_._reconnectCount].protocol?u.servers[_._reconnectCount].protocol:u.defaultProtocol,u.hostname=u.host,_._reconnectCount++),i("calling streambuilder for",u.protocol),r[u.protocol](_,u)}let g=new c(d,u);return g.on("error",function(){}),g}k.exports=t,k.exports.connect=t,k.exports.MqttClient=c,k.exports.Store=m}).call(this)}).call(this,y("_process"))},{"../client":6,"../store":13,"./ali":7,"./tcp":8,"./tls":9,"./ws":10,"./wx":11,_process:85,debug:20,url:90,xtend:82}],18:[function(y,k,x){"use strict";let{Buffer:p}=y("buffer"),c=Symbol.for("BufferList");function m(h){if(!(this instanceof m))return new m(h);m._init.call(this,h)}m._init=function(s){Object.defineProperty(this,c,{value:!0}),this._bufs=[],this.length=0,s&&this.append(s)},m.prototype._new=function(s){return new m(s)},m.prototype._offset=function(s){if(s===0)return[0,0];let i=0;for(let r=0;r<this._bufs.length;r++){let e=i+this._bufs[r].length;if(s<e||r===this._bufs.length-1)return[r,s-i];i=e}},m.prototype._reverseOffset=function(h){let s=h[0],i=h[1];for(let r=0;r<s;r++)i+=this._bufs[r].length;return i},m.prototype.get=function(s){if(s>this.length||s<0)return;let i=this._offset(s);return this._bufs[i[0]][i[1]]},m.prototype.slice=function(s,i){return typeof s=="number"&&s<0&&(s+=this.length),typeof i=="number"&&i<0&&(i+=this.length),this.copy(null,0,s,i)},m.prototype.copy=function(s,i,r,e){if((typeof r!="number"||r<0)&&(r=0),(typeof e!="number"||e>this.length)&&(e=this.length),r>=this.length||e<=0)return s||p.alloc(0);let t=!!s,o=this._offset(r),u=e-r,d=u,g=t&&i||0,_=o[1];if(r===0&&e===this.length){if(!t)return this._bufs.length===1?this._bufs[0]:p.concat(this._bufs,this.length);for(let f=0;f<this._bufs.length;f++)this._bufs[f].copy(s,g),g+=this._bufs[f].length;return s}if(d<=this._bufs[o[0]].length-_)return t?this._bufs[o[0]].copy(s,i,_,_+d):this._bufs[o[0]].slice(_,_+d);t||(s=p.allocUnsafe(u));for(let f=o[0];f<this._bufs.length;f++){let v=this._bufs[f].length-_;if(d>v)this._bufs[f].copy(s,g,_),g+=v;else{this._bufs[f].copy(s,g,_,_+d),g+=v;break}d-=v,_&&(_=0)}return s.length>g?s.slice(0,g):s},m.prototype.shallowSlice=function(s,i){if(s=s||0,i=typeof i!="number"?this.length:i,s<0&&(s+=this.length),i<0&&(i+=this.length),s===i)return this._new();let r=this._offset(s),e=this._offset(i),t=this._bufs.slice(r[0],e[0]+1);return e[1]===0?t.pop():t[t.length-1]=t[t.length-1].slice(0,e[1]),r[1]!==0&&(t[0]=t[0].slice(r[1])),this._new(t)},m.prototype.toString=function(s,i,r){return this.slice(i,r).toString(s)},m.prototype.consume=function(s){if(s=Math.trunc(s),Number.isNaN(s)||s<=0)return this;for(;this._bufs.length;)if(s>=this._bufs[0].length)s-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(s),this.length-=s;break}return this},m.prototype.duplicate=function(){let s=this._new();for(let i=0;i<this._bufs.length;i++)s.append(this._bufs[i]);return s},m.prototype.append=function(s){if(s==null)return this;if(s.buffer)this._appendBuffer(p.from(s.buffer,s.byteOffset,s.byteLength));else if(Array.isArray(s))for(let i=0;i<s.length;i++)this.append(s[i]);else if(this._isBufferList(s))for(let i=0;i<s._bufs.length;i++)this.append(s._bufs[i]);else typeof s=="number"&&(s=s.toString()),this._appendBuffer(p.from(s));return this},m.prototype._appendBuffer=function(s){this._bufs.push(s),this.length+=s.length},m.prototype.indexOf=function(h,s,i){if(i===void 0&&typeof s=="string"&&(i=s,s=void 0),typeof h=="function"||Array.isArray(h))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof h=="number"?h=p.from([h]):typeof h=="string"?h=p.from(h,i):this._isBufferList(h)?h=h.slice():Array.isArray(h.buffer)?h=p.from(h.buffer,h.byteOffset,h.byteLength):p.isBuffer(h)||(h=p.from(h)),s=Number(s||0),isNaN(s)&&(s=0),s<0&&(s=this.length+s),s<0&&(s=0),h.length===0)return s>this.length?this.length:s;let r=this._offset(s),e=r[0],t=r[1];for(;e<this._bufs.length;e++){let o=this._bufs[e];for(;t<o.length;)if(o.length-t>=h.length){let d=o.indexOf(h,t);if(d!==-1)return this._reverseOffset([e,d]);t=o.length-h.length+1}else{let d=this._reverseOffset([e,t]);if(this._match(d,h))return d;t++}t=0}return-1},m.prototype._match=function(h,s){if(this.length-h<s.length)return!1;for(let i=0;i<s.length;i++)if(this.get(h+i)!==s[i])return!1;return!0},function(){let h={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let s in h)(function(i){h[i]===null?m.prototype[i]=function(r,e){return this.slice(r,r+e)[i](0,e)}:m.prototype[i]=function(r=0){return this.slice(r,r+h[i])[i](0)}})(s)}(),m.prototype._isBufferList=function(s){return s instanceof m||m.isBufferList(s)},m.isBufferList=function(s){return s!=null&&s[c]},k.exports=m},{buffer:3}],19:[function(y,k,x){"use strict";let p=y("readable-stream").Duplex,c=y("inherits"),m=y("./BufferList");function h(s){if(!(this instanceof h))return new h(s);if(typeof s=="function"){this._callback=s;let i=(function(e){this._callback&&(this._callback(e),this._callback=null)}).bind(this);this.on("pipe",function(e){e.on("error",i)}),this.on("unpipe",function(e){e.removeListener("error",i)}),s=null}m._init.call(this,s),p.call(this)}c(h,p),Object.assign(h.prototype,m.prototype),h.prototype._new=function(i){return new h(i)},h.prototype._write=function(i,r,e){this._appendBuffer(i),typeof e=="function"&&e()},h.prototype._read=function(i){if(!this.length)return this.push(null);i=Math.min(i,this.length),this.push(this.slice(0,i)),this.consume(i)},h.prototype.end=function(i){p.prototype.end.call(this,i),this._callback&&(this._callback(null,this.slice()),this._callback=null)},h.prototype._destroy=function(i,r){this._bufs.length=0,this.length=0,r(i)},h.prototype._isBufferList=function(i){return i instanceof h||i instanceof m||h.isBufferList(i)},h.isBufferList=m.isBufferList,k.exports=h,k.exports.BufferListStream=h,k.exports.BufferList=m},{"./BufferList":18,inherits:24,"readable-stream":72}],20:[function(y,k,x){(function(p){(function(){x.formatArgs=m,x.save=h,x.load=s,x.useColors=c,x.storage=i(),x.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),x.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function c(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function m(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+k.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let o=0,u=0;e[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(o++,d==="%c"&&(u=o))}),e.splice(u,0,t)}x.log=console.debug||console.log||(()=>{});function h(e){try{e?x.storage.setItem("debug",e):x.storage.removeItem("debug")}catch{}}function s(){let e;try{e=x.storage.getItem("debug")}catch{}return!e&&typeof p<"u"&&"env"in p&&(e=p.env.DEBUG),e}function i(){try{return localStorage}catch{}}k.exports=y("./common")(x);let{formatters:r}=k.exports;r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this)}).call(this,y("_process"))},{"./common":21,_process:85}],21:[function(y,k,x){function p(c){h.debug=h,h.default=h,h.coerce=o,h.disable=r,h.enable=i,h.enabled=e,h.humanize=y("ms"),h.destroy=u,Object.keys(c).forEach(d=>{h[d]=c[d]}),h.names=[],h.skips=[],h.formatters={};function m(d){let g=0;for(let _=0;_<d.length;_++)g=(g<<5)-g+d.charCodeAt(_),g|=0;return h.colors[Math.abs(g)%h.colors.length]}h.selectColor=m;function h(d){let g,_=null,f,v;function R(...A){if(!R.enabled)return;let W=R,j=Number(new Date),C=j-(g||j);W.diff=C,W.prev=g,W.curr=j,g=j,A[0]=h.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");let P=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(V,B)=>{if(V==="%%")return"%";P++;let ne=h.formatters[B];if(typeof ne=="function"){let se=A[P];V=ne.call(W,se),A.splice(P,1),P--}return V}),h.formatArgs.call(W,A),(W.log||h.log).apply(W,A)}return R.namespace=d,R.useColors=h.useColors(),R.color=h.selectColor(d),R.extend=s,R.destroy=h.destroy,Object.defineProperty(R,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(f!==h.namespaces&&(f=h.namespaces,v=h.enabled(d)),v),set:A=>{_=A}}),typeof h.init=="function"&&h.init(R),R}function s(d,g){let _=h(this.namespace+(typeof g>"u"?":":g)+d);return _.log=this.log,_}function i(d){h.save(d),h.namespaces=d,h.names=[],h.skips=[];let g,_=(typeof d=="string"?d:"").split(/[\s,]+/),f=_.length;for(g=0;g<f;g++)_[g]&&(d=_[g].replace(/\*/g,".*?"),d[0]==="-"?h.skips.push(new RegExp("^"+d.slice(1)+"$")):h.names.push(new RegExp("^"+d+"$")))}function r(){let d=[...h.names.map(t),...h.skips.map(t).map(g=>"-"+g)].join(",");return h.enable(""),d}function e(d){if(d[d.length-1]==="*")return!0;let g,_;for(g=0,_=h.skips.length;g<_;g++)if(h.skips[g].test(d))return!1;for(g=0,_=h.names.length;g<_;g++)if(h.names[g].test(d))return!0;return!1}function t(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}function o(d){return d instanceof Error?d.stack||d.message:d}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return h.enable(h.load()),h}k.exports=p},{ms:53}],22:[function(y,k,x){(function(p,c){(function(){var m=y("readable-stream"),h=y("end-of-stream"),s=y("inherits"),i=y("stream-shift"),r=c.from&&c.from!==Uint8Array.from?c.from([0]):new c([0]),e=function(f,v){f._corked?f.once("uncork",v):v()},t=function(f,v){f._autoDestroy&&f.destroy(v)},o=function(f,v){return function(R){R?t(f,R.message==="premature close"?null:R):v&&!f._ended&&f.end()}},u=function(f,v){if(!f||f._writableState&&f._writableState.finished)return v();if(f._writableState)return f.end(v);f.end(),v()},d=function(){},g=function(f){return new m.Readable({objectMode:!0,highWaterMark:16}).wrap(f)},_=function(f,v,R){if(!(this instanceof _))return new _(f,v,R);m.Duplex.call(this,R),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!R||R.autoDestroy!==!1,this._forwardDestroy=!R||R.destroy!==!1,this._forwardEnd=!R||R.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,f&&this.setWritable(f),v&&this.setReadable(v)};s(_,m.Duplex),_.obj=function(f,v,R){return R||(R={}),R.objectMode=!0,R.highWaterMark=16,new _(f,v,R)},_.prototype.cork=function(){++this._corked===1&&this.emit("cork")},_.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},_.prototype.setWritable=function(f){if(this._unwrite&&this._unwrite(),this.destroyed){f&&f.destroy&&f.destroy();return}if(f===null||f===!1){this.end();return}var v=this,R=h(f,{writable:!0,readable:!1},o(this,this._forwardEnd)),A=function(){var j=v._ondrain;v._ondrain=null,j&&j()},W=function(){v._writable.removeListener("drain",A),R()};this._unwrite&&p.nextTick(A),this._writable=f,this._writable.on("drain",A),this._unwrite=W,this.uncork()},_.prototype.setReadable=function(f){if(this._unread&&this._unread(),this.destroyed){f&&f.destroy&&f.destroy();return}if(f===null||f===!1){this.push(null),this.resume();return}var v=this,R=h(f,{writable:!1,readable:!0},o(this)),A=function(){v._forward()},W=function(){v.push(null)},j=function(){v._readable2.removeListener("readable",A),v._readable2.removeListener("end",W),R()};this._drained=!0,this._readable=f,this._readable2=f._readableState?f:g(f),this._readable2.on("readable",A),this._readable2.on("end",W),this._unread=j,this._forward()},_.prototype._read=function(){this._drained=!0,this._forward()},_.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var f;this._drained&&(f=i(this._readable2))!==null;)this.destroyed||(this._drained=this.push(f));this._forwarding=!1}},_.prototype.destroy=function(f,v){if(v||(v=d),this.destroyed)return v(null);this.destroyed=!0;var R=this;p.nextTick(function(){R._destroy(f),v(null)})},_.prototype._destroy=function(f){if(f){var v=this._ondrain;this._ondrain=null,v?v(f):this.emit("error",f)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},_.prototype._write=function(f,v,R){if(!this.destroyed){if(this._corked)return e(this,this._write.bind(this,f,v,R));if(f===r)return this._finish(R);if(!this._writable)return R();this._writable.write(f)===!1?this._ondrain=R:this.destroyed||R()}},_.prototype._finish=function(f){var v=this;this.emit("preend"),e(this,function(){u(v._forwardEnd&&v._writable,function(){v._writableState.prefinished===!1&&(v._writableState.prefinished=!0),v.emit("prefinish"),e(v,f)})})},_.prototype.end=function(f,v,R){return typeof f=="function"?this.end(null,null,f):typeof v=="function"?this.end(f,null,v):(this._ended=!0,f&&this.write(f),!this._writableState.ending&&!this._writableState.destroyed&&this.write(r),m.Writable.prototype.end.call(this,R))},k.exports=_}).call(this)}).call(this,y("_process"),y("buffer").Buffer)},{_process:85,buffer:3,"end-of-stream":23,inherits:24,"readable-stream":72,"stream-shift":77}],23:[function(y,k,x){(function(p){(function(){var c=y("once"),m=function(){},h=function(r){return r.setHeader&&typeof r.abort=="function"},s=function(r){return r.stdio&&Array.isArray(r.stdio)&&r.stdio.length===3},i=function(r,e,t){if(typeof e=="function")return i(r,null,e);e||(e={}),t=c(t||m);var o=r._writableState,u=r._readableState,d=e.readable||e.readable!==!1&&r.readable,g=e.writable||e.writable!==!1&&r.writable,_=!1,f=function(){r.writable||v()},v=function(){g=!1,d||t.call(r)},R=function(){d=!1,g||t.call(r)},A=function(S){t.call(r,S?new Error("exited with error code: "+S):null)},W=function(S){t.call(r,S)},j=function(){p.nextTick(C)},C=function(){if(!_){if(d&&!(u&&u.ended&&!u.destroyed))return t.call(r,new Error("premature close"));if(g&&!(o&&o.ended&&!o.destroyed))return t.call(r,new Error("premature close"))}},P=function(){r.req.on("finish",v)};return h(r)?(r.on("complete",v),r.on("abort",j),r.req?P():r.on("request",P)):g&&!o&&(r.on("end",f),r.on("close",f)),s(r)&&r.on("exit",A),r.on("end",R),r.on("finish",v),e.error!==!1&&r.on("error",W),r.on("close",j),function(){_=!0,r.removeListener("complete",v),r.removeListener("abort",j),r.removeListener("request",P),r.req&&r.req.removeListener("finish",v),r.removeListener("end",f),r.removeListener("close",f),r.removeListener("finish",v),r.removeListener("exit",A),r.removeListener("end",R),r.removeListener("error",W),r.removeListener("close",j)}};k.exports=i}).call(this)}).call(this,y("_process"))},{_process:85,once:56}],24:[function(y,k,x){typeof Object.create=="function"?k.exports=function(c,m){m&&(c.super_=m,c.prototype=Object.create(m.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}))}:k.exports=function(c,m){if(m){c.super_=m;var h=function(){};h.prototype=m.prototype,c.prototype=new h,c.prototype.constructor=c}}},{}],25:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.ContainerIterator=x.Container=x.Base=void 0;class p{constructor(s=0){this.iteratorType=s}equals(s){return this.o===s.o}}x.ContainerIterator=p;class c{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}}x.Base=c;class m extends c{}x.Container=m},{}],26:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.HashContainerIterator=x.HashContainer=void 0;var p=y("../../ContainerBase"),c=h(y("../../../utils/checkObject")),m=y("../../../utils/throwError");function h(r){return r&&r.t?r:{default:r}}class s extends p.ContainerIterator{constructor(e,t,o){super(o),this.o=e,this.h=t,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,m.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,m.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,m.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,m.throwIteratorAccessError)(),this.o=this.o.L,this})}}x.HashContainerIterator=s;class i extends p.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(e){let{L:t,B:o}=e;t.B=o,o.L=t,e===this.p&&(this.p=o),e===this._&&(this._=t),this.i-=1}M(e,t,o){o===void 0&&(o=(0,c.default)(e));let u;if(o){let d=e[this.HASH_TAG];if(d!==void 0)return this.H[d].l=t,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),u={u:e,l:t,L:this._,B:this.h},this.H.push(u)}else{let d=this.g[e];if(d)return d.l=t,this.i;u={u:e,l:t,L:this._,B:this.h},this.g[e]=u}return this.i===0?(this.p=u,this.h.B=u):this._.B=u,this._=u,this.h.L=u,++this.i}I(e,t){if(t===void 0&&(t=(0,c.default)(e)),t){let o=e[this.HASH_TAG];return o===void 0?this.h:this.H[o]}else return this.g[e]||this.h}clear(){let 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}eraseElementByKey(e,t){let o;if(t===void 0&&(t=(0,c.default)(e)),t){let u=e[this.HASH_TAG];if(u===void 0)return!1;delete e[this.HASH_TAG],o=this.H[u],delete this.H[u]}else{if(o=this.g[e],o===void 0)return!1;delete this.g[e]}return this.V(o),!0}eraseElementByIterator(e){let t=e.o;return t===this.h&&(0,m.throwIteratorAccessError)(),this.V(t),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let t=this.p;for(;e--;)t=t.B;return this.V(t),this.i}}x.HashContainer=i},{"../../../utils/checkObject":43,"../../../utils/throwError":44,"../../ContainerBase":25}],27:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=y("./Base"),c=h(y("../../utils/checkObject")),m=y("../../utils/throwError");function h(e){return e&&e.t?e:{default:e}}class s extends p.HashContainerIterator{constructor(t,o,u,d){super(t,o,d),this.container=u}get pointer(){this.o===this.h&&(0,m.throwIteratorAccessError)();let t=this;return new Proxy([],{get(o,u){if(u==="0")return t.o.u;if(u==="1")return t.o.l},set(o,u,d){if(u!=="1")throw new TypeError("props must be 1");return t.o.l=d,!0}})}copy(){return new s(this.o,this.h,this.container,this.iteratorType)}}class i extends p.HashContainer{constructor(t=[]){super();let o=this;t.forEach(function(u){o.setElement(u[0],u[1])})}begin(){return new s(this.p,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this._,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(t,o,u){return this.M(t,o,u)}getElementByKey(t,o){if(o===void 0&&(o=(0,c.default)(t)),o){let d=t[this.HASH_TAG];return d!==void 0?this.H[d].l:void 0}let u=this.g[t];return u?u.l:void 0}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let o=this.p;for(;t--;)o=o.B;return[o.u,o.l]}find(t,o){let u=this.I(t,o);return new s(u,this.h,this)}forEach(t){let o=0,u=this.p;for(;u!==this.h;)t([u.u,u.l],o++,this),u=u.B}[Symbol.iterator](){return(function*(){let t=this.p;for(;t!==this.h;)yield[t.u,t.l],t=t.B}).bind(this)()}}var r=i;x.default=r},{"../../utils/checkObject":43,"../../utils/throwError":44,"./Base":26}],28:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=y("./Base"),c=y("../../utils/throwError");class m extends p.HashContainerIterator{constructor(r,e,t,o){super(r,e,o),this.container=t}get pointer(){return this.o===this.h&&(0,c.throwIteratorAccessError)(),this.o.u}copy(){return new m(this.o,this.h,this.container,this.iteratorType)}}class h extends p.HashContainer{constructor(r=[]){super();let e=this;r.forEach(function(t){e.insert(t)})}begin(){return new m(this.p,this.h,this)}end(){return new m(this.h,this.h,this)}rBegin(){return new m(this._,this.h,this,1)}rEnd(){return new m(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(r,e){return this.M(r,void 0,e)}getElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let e=this.p;for(;r--;)e=e.B;return e.u}find(r,e){let t=this.I(r,e);return new m(t,this.h,this)}forEach(r){let e=0,t=this.p;for(;t!==this.h;)r(t.u,e++,this),t=t.B}[Symbol.iterator](){return(function*(){let r=this.p;for(;r!==this.h;)yield r.u,r=r.B}).bind(this)()}}var s=h;x.default=s},{"../../utils/throwError":44,"./Base":26}],29:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=y("../ContainerBase");class c extends p.Base{constructor(s=[],i=function(e,t){return e>t?-1:e<t?1:0},r=!0){if(super(),this.v=i,Array.isArray(s))this.C=r?[...s]:s;else{this.C=[];let t=this;s.forEach(function(o){t.C.push(o)})}this.i=this.C.length;let e=this.i>>1;for(let t=this.i-1>>1;t>=0;--t)this.k(t,e)}m(s){let i=this.C[s];for(;s>0;){let r=s-1>>1,e=this.C[r];if(this.v(e,i)<=0)break;this.C[s]=e,s=r}this.C[s]=i}k(s,i){let r=this.C[s];for(;s<i;){let e=s<<1|1,t=e+1,o=this.C[e];if(t<this.i&&this.v(o,this.C[t])>0&&(e=t,o=this.C[t]),this.v(o,r)>=0)break;this.C[s]=o,s=e}this.C[s]=r}clear(){this.i=0,this.C.length=0}push(s){this.C.push(s),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let s=this.C[0],i=this.C.pop();return this.i-=1,this.i&&(this.C[0]=i,this.k(0,this.i>>1)),s}top(){return this.C[0]}find(s){return this.C.indexOf(s)>=0}remove(s){let i=this.C.indexOf(s);return i<0?!1:(i===0?this.pop():i===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(i,1,this.C.pop()),this.i-=1,this.m(i),this.k(i,this.i>>1)),!0)}updateItem(s){let i=this.C.indexOf(s);return i<0?!1:(this.m(i),this.k(i,this.i>>1),!0)}toArray(){return[...this.C]}}var m=c;x.default=m},{"../ContainerBase":25}],30:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=y("../ContainerBase");class c extends p.Base{constructor(s=[]){super(),this.j=0,this.q=[];let i=this;s.forEach(function(r){i.push(r)})}clear(){this.q=[],this.i=this.j=0}push(s){let i=this.q.length;if(this.j/i>.5&&this.j+this.i>=i&&i>4096){let r=this.i;for(let e=0;e<r;++e)this.q[e]=this.q[this.j+e];this.j=0,this.q[this.i]=s}else this.q[this.j+this.i]=s;return++this.i}pop(){if(this.i===0)return;let s=this.q[this.j++];return this.i-=1,s}front(){if(this.i!==0)return this.q[this.j]}}var m=c;x.default=m},{"../ContainerBase":25}],31:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=y("../ContainerBase");class c extends p.Base{constructor(s=[]){super(),this.S=[];let i=this;s.forEach(function(r){i.push(r)})}clear(){this.i=0,this.S=[]}push(s){return this.S.push(s),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}}var m=c;x.default=m},{"../ContainerBase":25}],32:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.RandomIterator=void 0;var p=y("../../ContainerBase"),c=y("../../../utils/throwError");class m extends p.ContainerIterator{constructor(s,i){super(i),this.o=s,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,c.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,c.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,c.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,c.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(s){this.container.setElementByPos(this.o,s)}}x.RandomIterator=m},{"../../../utils/throwError":44,"../../ContainerBase":25}],33:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=y("../../ContainerBase");class c extends p.Container{}var m=c;x.default=m},{"../../ContainerBase":25}],34:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=m(y("./Base")),c=y("./Base/RandomIterator");function m(r){return r&&r.t?r:{default:r}}class h extends c.RandomIterator{constructor(e,t,o){super(e,o),this.container=t}copy(){return new h(this.o,this.container,this.iteratorType)}}class s extends p.default{constructor(e=[],t=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let o=(()=>{if(typeof e.length=="number")return e.length;if(typeof e.size=="number")return e.size;if(typeof e.size=="function")return e.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=t,this.P=Math.max(Math.ceil(o/this.F),1);for(let g=0;g<this.P;++g)this.A.push(new Array(this.F));let u=Math.ceil(o/this.F);this.j=this.R=(this.P>>1)-(u>>1),this.D=this.N=this.F-o%this.F>>1;let d=this;e.forEach(function(g){d.pushBack(g)})}T(){let e=[],t=Math.max(this.P>>1,1);for(let o=0;o<t;++o)e[o]=new Array(this.F);for(let o=this.j;o<this.P;++o)e[e.length]=this.A[o];for(let o=0;o<this.R;++o)e[e.length]=this.A[o];e[e.length]=[...this.A[this.R]],this.j=t,this.R=e.length-1;for(let o=0;o<t;++o)e[e.length]=new Array(this.F);this.A=e,this.P=e.length}O(e){let t=this.D+e+1,o=t%this.F,u=o-1,d=this.j+(t-o)/this.F;return o===0&&(d-=1),d%=this.P,u<0&&(u+=this.F),{curNodeBucketIndex:d,curNodePointerIndex:u}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new h(0,this)}end(){return new h(this.i,this)}rBegin(){return new h(this.i-1,this,1)}rEnd(){return new h(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(e){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=e,this.i}popBack(){if(this.i===0)return;let e=this.A[this.R][this.N];return this.i!==1&&(this.N>0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,e}pushFront(e){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=e,this.i}popFront(){if(this.i===0)return;let e=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,e}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:t,curNodePointerIndex:o}=this.O(e);return this.A[t][o]}setElementByPos(e,t){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:o,curNodePointerIndex:u}=this.O(e);this.A[o][u]=t}insert(e,t,o=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;o--;)this.pushFront(t);else if(e===this.i)for(;o--;)this.pushBack(t);else{let u=[];for(let d=e;d<this.i;++d)u.push(this.getElementByPos(d));this.cut(e-1);for(let d=0;d<o;++d)this.pushBack(t);for(let d=0;d<u.length;++d)this.pushBack(u[d])}return this.i}cut(e){if(e<0)return this.clear(),0;let{curNodeBucketIndex:t,curNodePointerIndex:o}=this.O(e);return this.R=t,this.N=o,this.i=e+1,this.i}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;if(e===0)this.popFront();else if(e===this.i-1)this.popBack();else{let t=[];for(let u=e+1;u<this.i;++u)t.push(this.getElementByPos(u));this.cut(e),this.popBack();let o=this;t.forEach(function(u){o.pushBack(u)})}return this.i}eraseElementByValue(e){if(this.i===0)return 0;let t=[];for(let u=0;u<this.i;++u){let d=this.getElementByPos(u);d!==e&&t.push(d)}let o=t.length;for(let u=0;u<o;++u)this.setElementByPos(u,t[u]);return this.cut(o-1)}eraseElementByIterator(e){let t=e.o;return this.eraseElementByPos(t),e=e.next(),e}find(e){for(let t=0;t<this.i;++t)if(this.getElementByPos(t)===e)return new h(t,this);return this.end()}reverse(){let e=0,t=this.i-1;for(;e<t;){let o=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,o),e+=1,t-=1}}unique(){if(this.i<=1)return this.i;let e=1,t=this.getElementByPos(0);for(let o=1;o<this.i;++o){let u=this.getElementByPos(o);u!==t&&(t=u,this.setElementByPos(e++,u))}for(;this.i>e;)this.popBack();return this.i}sort(e){let t=[];for(let o=0;o<this.i;++o)t.push(this.getElementByPos(o));t.sort(e);for(let o=0;o<this.i;++o)this.setElementByPos(o,t[o])}shrinkToFit(){if(this.i===0)return;let 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(let t=0;t<this.P;++t)this.A.push(new Array(this.F));for(let t=0;t<e.length;++t)this.pushBack(e[t])}forEach(e){for(let t=0;t<this.i;++t)e(this.getElementByPos(t),t,this)}[Symbol.iterator](){return(function*(){for(let e=0;e<this.i;++e)yield this.getElementByPos(e)}).bind(this)()}}var i=s;x.default=i},{"./Base":33,"./Base/RandomIterator":32}],35:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=h(y("./Base")),c=y("../ContainerBase"),m=y("../../utils/throwError");function h(e){return e&&e.t?e:{default:e}}class s extends c.ContainerIterator{constructor(t,o,u,d){super(d),this.o=t,this.h=o,this.container=u,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,m.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,m.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,m.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,m.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,m.throwIteratorAccessError)(),this.o.l}set pointer(t){this.o===this.h&&(0,m.throwIteratorAccessError)(),this.o.l=t}copy(){return new s(this.o,this.h,this.container,this.iteratorType)}}class i extends p.default{constructor(t=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let o=this;t.forEach(function(u){o.pushBack(u)})}V(t){let{L:o,B:u}=t;o.B=u,u.L=o,t===this.p&&(this.p=u),t===this._&&(this._=o),this.i-=1}G(t,o){let u=o.B,d={l:t,L:o,B:u};o.B=d,u.L=d,o===this.h&&(this.p=d),u===this.h&&(this._=d),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new s(this.p,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this._,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let o=this.p;for(;t--;)o=o.B;return o.l}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let o=this.p;for(;t--;)o=o.B;return this.V(o),this.i}eraseElementByValue(t){let o=this.p;for(;o!==this.h;)o.l===t&&this.V(o),o=o.B;return this.i}eraseElementByIterator(t){let o=t.o;return o===this.h&&(0,m.throwIteratorAccessError)(),t=t.next(),this.V(o),t}pushBack(t){return this.G(t,this._),this.i}popBack(){if(this.i===0)return;let t=this._.l;return this.V(this._),t}pushFront(t){return this.G(t,this.h),this.i}popFront(){if(this.i===0)return;let t=this.p.l;return this.V(this.p),t}setElementByPos(t,o){if(t<0||t>this.i-1)throw new RangeError;let u=this.p;for(;t--;)u=u.B;u.l=o}insert(t,o,u=1){if(t<0||t>this.i)throw new RangeError;if(u<=0)return this.i;if(t===0)for(;u--;)this.pushFront(o);else if(t===this.i)for(;u--;)this.pushBack(o);else{let d=this.p;for(let _=1;_<t;++_)d=d.B;let g=d.B;for(this.i+=u;u--;)d.B={l:o,L:d},d.B.L=d,d=d.B;d.B=g,g.L=d}return this.i}find(t){let o=this.p;for(;o!==this.h;){if(o.l===t)return new s(o,this.h,this);o=o.B}return this.end()}reverse(){if(this.i<=1)return;let t=this.p,o=this._,u=0;for(;u<<1<this.i;){let d=t.l;t.l=o.l,o.l=d,t=t.B,o=o.L,u+=1}}unique(){if(this.i<=1)return this.i;let t=this.p;for(;t!==this.h;){let o=t;for(;o.B!==this.h&&o.l===o.B.l;)o=o.B,this.i-=1;t.B=o.B,t.B.L=t,t=t.B}return this.i}sort(t){if(this.i<=1)return;let o=[];this.forEach(function(d){o.push(d)}),o.sort(t);let u=this.p;o.forEach(function(d){u.l=d,u=u.B})}merge(t){let o=this;if(this.i===0)t.forEach(function(u){o.pushBack(u)});else{let u=this.p;t.forEach(function(d){for(;u!==o.h&&u.l<=d;)u=u.B;o.G(d,u.L)})}return this.i}forEach(t){let o=this.p,u=0;for(;o!==this.h;)t(o.l,u++,this),o=o.B}[Symbol.iterator](){return(function*(){if(this.i===0)return;let t=this.p;for(;t!==this.h;)yield t.l,t=t.B}).bind(this)()}}var r=i;x.default=r},{"../../utils/throwError":44,"../ContainerBase":25,"./Base":33}],36:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=m(y("./Base")),c=y("./Base/RandomIterator");function m(r){return r&&r.t?r:{default:r}}class h extends c.RandomIterator{constructor(e,t,o){super(e,o),this.container=t}copy(){return new h(this.o,this.container,this.iteratorType)}}class s extends p.default{constructor(e=[],t=!0){if(super(),Array.isArray(e))this.J=t?[...e]:e,this.i=e.length;else{this.J=[];let o=this;e.forEach(function(u){o.pushBack(u)})}}clear(){this.i=0,this.J.length=0}begin(){return new h(0,this)}end(){return new h(this.i,this)}rBegin(){return new h(this.i-1,this,1)}rEnd(){return new h(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let t=0;for(let o=0;o<this.i;++o)this.J[o]!==e&&(this.J[t++]=this.J[o]);return this.i=this.J.length=t,this.i}eraseElementByIterator(e){let t=e.o;return e=e.next(),this.eraseElementByPos(t),e}pushBack(e){return this.J.push(e),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(e,t){if(e<0||e>this.i-1)throw new RangeError;this.J[e]=t}insert(e,t,o=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(o).fill(t)),this.i+=o,this.i}find(e){for(let t=0;t<this.i;++t)if(this.J[t]===e)return new h(t,this);return this.end()}reverse(){this.J.reverse()}unique(){let e=1;for(let t=1;t<this.i;++t)this.J[t]!==this.J[t-1]&&(this.J[e++]=this.J[t]);return this.i=this.J.length=e,this.i}sort(e){this.J.sort(e)}forEach(e){for(let t=0;t<this.i;++t)e(this.J[t],t,this)}[Symbol.iterator](){return(function*(){yield*Ie(this.J)}).bind(this)()}}var i=s;x.default=i},{"./Base":33,"./Base/RandomIterator":32}],37:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=y("../../ContainerBase"),c=y("../../../utils/throwError");class m extends p.ContainerIterator{constructor(i,r,e){super(e),this.o=i,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,c.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,c.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,c.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,c.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let i=this.o,r=this.h.tt;if(i===this.h)return r?r.rt-1:0;let e=0;for(i.U&&(e+=i.U.rt);i!==r;){let t=i.tt;i===t.W&&(e+=1,t.U&&(e+=t.U.rt)),i=t}return e}}var h=m;x.default=h},{"../../../utils/throwError":44,"../../ContainerBase":25}],38:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.TreeNodeEnableIndex=x.TreeNode=void 0;class p{constructor(h,s){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=h,this.l=s}L(){let h=this;if(h.ee===1&&h.tt.tt===h)h=h.W;else if(h.U)for(h=h.U;h.W;)h=h.W;else{let s=h.tt;for(;s.U===h;)h=s,s=h.tt;h=s}return h}B(){let h=this;if(h.W){for(h=h.W;h.U;)h=h.U;return h}else{let s=h.tt;for(;s.W===h;)h=s,s=h.tt;return h.W!==s?s:h}}te(){let h=this.tt,s=this.W,i=s.U;return h.tt===this?h.tt=s:h.U===this?h.U=s:h.W=s,s.tt=h,s.U=this,this.tt=s,this.W=i,i&&(i.tt=this),s}se(){let h=this.tt,s=this.U,i=s.W;return h.tt===this?h.tt=s:h.U===this?h.U=s:h.W=s,s.tt=h,s.W=this,this.tt=s,this.U=i,i&&(i.tt=this),s}}x.TreeNode=p;class c extends p{constructor(){super(...arguments),this.rt=1}te(){let h=super.te();return this.ie(),h.ie(),h}se(){let h=super.se();return this.ie(),h.ie(),h}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}}x.TreeNodeEnableIndex=c},{}],39:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=y("./TreeNode"),c=y("../../ContainerBase"),m=y("../../../utils/throwError");class h extends c.Container{constructor(r=function(t,o){return t<o?-1:t>o?1:0},e=!1){super(),this.Y=void 0,this.v=r,e?(this.re=p.TreeNodeEnableIndex,this.M=function(t,o,u){let d=this.ne(t,o,u);if(d){let g=d.tt;for(;g!==this.h;)g.rt+=1,g=g.tt;let _=this.he(d);if(_){let{parentNode:f,grandParent:v,curNode:R}=_;f.ie(),v.ie(),R.ie()}}return this.i},this.V=function(t){let o=this.fe(t);for(;o!==this.h;)o.rt-=1,o=o.tt}):(this.re=p.TreeNode,this.M=function(t,o,u){let d=this.ne(t,o,u);return d&&this.he(d),this.i},this.V=this.fe),this.h=new this.re}X(r,e){let t=this.h;for(;r;){let o=this.v(r.u,e);if(o<0)r=r.W;else if(o>0)t=r,r=r.U;else return r}return t}Z(r,e){let t=this.h;for(;r;)this.v(r.u,e)<=0?r=r.W:(t=r,r=r.U);return t}$(r,e){let t=this.h;for(;r;){let o=this.v(r.u,e);if(o<0)t=r,r=r.W;else if(o>0)r=r.U;else return r}return t}rr(r,e){let t=this.h;for(;r;)this.v(r.u,e)<0?(t=r,r=r.W):r=r.U;return t}ue(r){for(;;){let e=r.tt;if(e===this.h)return;if(r.ee===1){r.ee=0;return}if(r===e.U){let t=e.W;if(t.ee===1)t.ee=0,e.ee=1,e===this.Y?this.Y=e.te():e.te();else if(t.W&&t.W.ee===1){t.ee=e.ee,e.ee=0,t.W.ee=0,e===this.Y?this.Y=e.te():e.te();return}else t.U&&t.U.ee===1?(t.ee=1,t.U.ee=0,t.se()):(t.ee=1,r=e)}else{let t=e.U;if(t.ee===1)t.ee=0,e.ee=1,e===this.Y?this.Y=e.se():e.se();else if(t.U&&t.U.ee===1){t.ee=e.ee,e.ee=0,t.U.ee=0,e===this.Y?this.Y=e.se():e.se();return}else t.W&&t.W.ee===1?(t.ee=1,t.W.ee=0,t.te()):(t.ee=1,r=e)}}}fe(r){if(this.i===1)return this.clear(),this.h;let e=r;for(;e.U||e.W;){if(e.W)for(e=e.W;e.U;)e=e.U;else e=e.U;[r.u,e.u]=[e.u,r.u],[r.l,e.l]=[e.l,r.l],r=e}this.h.U===e?this.h.U=e.tt:this.h.W===e&&(this.h.W=e.tt),this.ue(e);let t=e.tt;return e===t.U?t.U=void 0:t.W=void 0,this.i-=1,this.Y.ee=0,t}oe(r,e){return r===void 0?!1:this.oe(r.U,e)||e(r)?!0:this.oe(r.W,e)}he(r){for(;;){let e=r.tt;if(e.ee===0)return;let t=e.tt;if(e===t.U){let o=t.W;if(o&&o.ee===1){if(o.ee=e.ee=0,t===this.Y)return;t.ee=1,r=t;continue}else if(r===e.W){if(r.ee=0,r.U&&(r.U.tt=e),r.W&&(r.W.tt=t),e.W=r.U,t.U=r.W,r.U=e,r.W=t,t===this.Y)this.Y=r,this.h.tt=r;else{let u=t.tt;u.U===t?u.U=r:u.W=r}return r.tt=t.tt,e.tt=r,t.tt=r,t.ee=1,{parentNode:e,grandParent:t,curNode:r}}else e.ee=0,t===this.Y?this.Y=t.se():t.se(),t.ee=1}else{let o=t.U;if(o&&o.ee===1){if(o.ee=e.ee=0,t===this.Y)return;t.ee=1,r=t;continue}else if(r===e.U){if(r.ee=0,r.U&&(r.U.tt=t),r.W&&(r.W.tt=e),t.W=r.U,e.U=r.W,r.U=t,r.W=e,t===this.Y)this.Y=r,this.h.tt=r;else{let u=t.tt;u.U===t?u.U=r:u.W=r}return r.tt=t.tt,e.tt=r,t.tt=r,t.ee=1,{parentNode:e,grandParent:t,curNode:r}}else e.ee=0,t===this.Y?this.Y=t.te():t.te(),t.ee=1}return}}ne(r,e,t){if(this.Y===void 0){this.i+=1,this.Y=new this.re(r,e),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let o,u=this.h.U,d=this.v(u.u,r);if(d===0){u.l=e;return}else if(d>0)u.U=new this.re(r,e),u.U.tt=u,o=u.U,this.h.U=o;else{let g=this.h.W,_=this.v(g.u,r);if(_===0){g.l=e;return}else if(_<0)g.W=new this.re(r,e),g.W.tt=g,o=g.W,this.h.W=o;else{if(t!==void 0){let f=t.o;if(f!==this.h){let v=this.v(f.u,r);if(v===0){f.l=e;return}else if(v>0){let R=f.L(),A=this.v(R.u,r);if(A===0){R.l=e;return}else A<0&&(o=new this.re(r,e),R.W===void 0?(R.W=o,o.tt=R):(f.U=o,o.tt=f))}}}if(o===void 0)for(o=this.Y;;){let f=this.v(o.u,r);if(f>0){if(o.U===void 0){o.U=new this.re(r,e),o.U.tt=o,o=o.U;break}o=o.U}else if(f<0){if(o.W===void 0){o.W=new this.re(r,e),o.W.tt=o,o=o.W;break}o=o.W}else{o.l=e;return}}}}return this.i+=1,o}I(r,e){for(;r;){let t=this.v(r.u,e);if(t<0)r=r.W;else if(t>0)r=r.U;else return r}return r||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(r,e){let t=r.o;if(t===this.h&&(0,m.throwIteratorAccessError)(),this.i===1)return t.u=e,!0;if(t===this.h.U)return this.v(t.B().u,e)>0?(t.u=e,!0):!1;if(t===this.h.W)return this.v(t.L().u,e)<0?(t.u=e,!0):!1;let o=t.L().u;if(this.v(o,e)>=0)return!1;let u=t.B().u;return this.v(u,e)<=0?!1:(t.u=e,!0)}eraseElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let e=0,t=this;return this.oe(this.Y,function(o){return r===e?(t.V(o),!0):(e+=1,!1)}),this.i}eraseElementByKey(r){if(this.i===0)return!1;let e=this.I(this.Y,r);return e===this.h?!1:(this.V(e),!0)}eraseElementByIterator(r){let e=r.o;e===this.h&&(0,m.throwIteratorAccessError)();let t=e.W===void 0;return r.iteratorType===0?t&&r.next():(!t||e.U===void 0)&&r.next(),this.V(e),r}forEach(r){let e=0;for(let t of this)r(t,e++,this)}getElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let e,t=0;for(let o of this){if(t===r){e=o;break}t+=1}return e}getHeight(){if(this.i===0)return 0;let r=function(e){return e?Math.max(r(e.U),r(e.W))+1:0};return r(this.Y)}}var s=h;x.default=s},{"../../../utils/throwError":44,"../../ContainerBase":25,"./TreeNode":38}],40:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=h(y("./Base")),c=h(y("./Base/TreeIterator")),m=y("../../utils/throwError");function h(e){return e&&e.t?e:{default:e}}class s extends c.default{constructor(t,o,u,d){super(t,o,d),this.container=u}get pointer(){this.o===this.h&&(0,m.throwIteratorAccessError)();let t=this;return new Proxy([],{get(o,u){if(u==="0")return t.o.u;if(u==="1")return t.o.l},set(o,u,d){if(u!=="1")throw new TypeError("props must be 1");return t.o.l=d,!0}})}copy(){return new s(this.o,this.h,this.container,this.iteratorType)}}class i extends p.default{constructor(t=[],o,u){super(o,u);let d=this;t.forEach(function(g){d.setElement(g[0],g[1])})}*K(t){t!==void 0&&(yield*Ie(this.K(t.U)),yield[t.u,t.l],yield*Ie(this.K(t.W)))}begin(){return new s(this.h.U||this.h,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this.h.W||this.h,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){if(this.i===0)return;let t=this.h.U;return[t.u,t.l]}back(){if(this.i===0)return;let t=this.h.W;return[t.u,t.l]}lowerBound(t){let o=this.X(this.Y,t);return new s(o,this.h,this)}upperBound(t){let o=this.Z(this.Y,t);return new s(o,this.h,this)}reverseLowerBound(t){let o=this.$(this.Y,t);return new s(o,this.h,this)}reverseUpperBound(t){let o=this.rr(this.Y,t);return new s(o,this.h,this)}setElement(t,o,u){return this.M(t,o,u)}find(t){let o=this.I(this.Y,t);return new s(o,this.h,this)}getElementByKey(t){return this.I(this.Y,t).l}union(t){let o=this;return t.forEach(function(u){o.setElement(u[0],u[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}}var r=i;x.default=r},{"../../utils/throwError":44,"./Base":39,"./Base/TreeIterator":37}],41:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=void 0;var p=h(y("./Base")),c=h(y("./Base/TreeIterator")),m=y("../../utils/throwError");function h(e){return e&&e.t?e:{default:e}}class s extends c.default{constructor(t,o,u,d){super(t,o,d),this.container=u}get pointer(){return this.o===this.h&&(0,m.throwIteratorAccessError)(),this.o.u}copy(){return new s(this.o,this.h,this.container,this.iteratorType)}}class i extends p.default{constructor(t=[],o,u){super(o,u);let d=this;t.forEach(function(g){d.insert(g)})}*K(t){t!==void 0&&(yield*Ie(this.K(t.U)),yield t.u,yield*Ie(this.K(t.W)))}begin(){return new s(this.h.U||this.h,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this.h.W||this.h,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(t,o){return this.M(t,void 0,o)}find(t){let o=this.I(this.Y,t);return new s(o,this.h,this)}lowerBound(t){let o=this.X(this.Y,t);return new s(o,this.h,this)}upperBound(t){let o=this.Z(this.Y,t);return new s(o,this.h,this)}reverseLowerBound(t){let o=this.$(this.Y,t);return new s(o,this.h,this)}reverseUpperBound(t){let o=this.rr(this.Y,t);return new s(o,this.h,this)}union(t){let o=this;return t.forEach(function(u){o.insert(u)}),this.i}[Symbol.iterator](){return this.K(this.Y)}}var r=i;x.default=r},{"../../utils/throwError":44,"./Base":39,"./Base/TreeIterator":37}],42:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),Object.defineProperty(x,"Deque",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(x,"HashMap",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(x,"HashSet",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(x,"LinkList",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(x,"OrderedMap",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(x,"OrderedSet",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(x,"PriorityQueue",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(x,"Queue",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(x,"Stack",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(x,"Vector",{enumerable:!0,get:function(){return h.default}});var p=u(y("./container/OtherContainer/Stack")),c=u(y("./container/OtherContainer/Queue")),m=u(y("./container/OtherContainer/PriorityQueue")),h=u(y("./container/SequentialContainer/Vector")),s=u(y("./container/SequentialContainer/LinkList")),i=u(y("./container/SequentialContainer/Deque")),r=u(y("./container/TreeContainer/OrderedSet")),e=u(y("./container/TreeContainer/OrderedMap")),t=u(y("./container/HashContainer/HashSet")),o=u(y("./container/HashContainer/HashMap"));function u(d){return d&&d.t?d:{default:d}}},{"./container/HashContainer/HashMap":27,"./container/HashContainer/HashSet":28,"./container/OtherContainer/PriorityQueue":29,"./container/OtherContainer/Queue":30,"./container/OtherContainer/Stack":31,"./container/SequentialContainer/Deque":34,"./container/SequentialContainer/LinkList":35,"./container/SequentialContainer/Vector":36,"./container/TreeContainer/OrderedMap":40,"./container/TreeContainer/OrderedSet":41}],43:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.default=p;function p(c){let m=typeof c;return m==="object"&&c!==null||m==="function"}},{}],44:[function(y,k,x){"use strict";Object.defineProperty(x,"t",{value:!0}),x.throwIteratorAccessError=p;function p(){throw new RangeError("Iterator access denied!")}},{}],45:[function(y,k,x){"use strict";let p=y("yallist"),c=Symbol("max"),m=Symbol("length"),h=Symbol("lengthCalculator"),s=Symbol("allowStale"),i=Symbol("maxAge"),r=Symbol("dispose"),e=Symbol("noDisposeOnSet"),t=Symbol("lruList"),o=Symbol("cache"),u=Symbol("updateAgeOnGet"),d=()=>1;class g{constructor(C){if(typeof C=="number"&&(C={max:C}),C||(C={}),C.max&&(typeof C.max!="number"||C.max<0))throw new TypeError("max must be a non-negative number");let P=this[c]=C.max||1/0,S=C.length||d;if(this[h]=typeof S!="function"?d:S,this[s]=C.stale||!1,C.maxAge&&typeof C.maxAge!="number")throw new TypeError("maxAge must be a number");this[i]=C.maxAge||0,this[r]=C.dispose,this[e]=C.noDisposeOnSet||!1,this[u]=C.updateAgeOnGet||!1,this.reset()}set max(C){if(typeof C!="number"||C<0)throw new TypeError("max must be a non-negative number");this[c]=C||1/0,v(this)}get max(){return this[c]}set allowStale(C){this[s]=!!C}get allowStale(){return this[s]}set maxAge(C){if(typeof C!="number")throw new TypeError("maxAge must be a non-negative number");this[i]=C,v(this)}get maxAge(){return this[i]}set lengthCalculator(C){typeof C!="function"&&(C=d),C!==this[h]&&(this[h]=C,this[m]=0,this[t].forEach(P=>{P.length=this[h](P.value,P.key),this[m]+=P.length})),v(this)}get lengthCalculator(){return this[h]}get length(){return this[m]}get itemCount(){return this[t].length}rforEach(C,P){P=P||this;for(let S=this[t].tail;S!==null;){let V=S.prev;W(this,C,S,P),S=V}}forEach(C,P){P=P||this;for(let S=this[t].head;S!==null;){let V=S.next;W(this,C,S,P),S=V}}keys(){return this[t].toArray().map(C=>C.key)}values(){return this[t].toArray().map(C=>C.value)}reset(){this[r]&&this[t]&&this[t].length&&this[t].forEach(C=>this[r](C.key,C.value)),this[o]=new Map,this[t]=new p,this[m]=0}dump(){return this[t].map(C=>f(this,C)?!1:{k:C.key,v:C.value,e:C.now+(C.maxAge||0)}).toArray().filter(C=>C)}dumpLru(){return this[t]}set(C,P,S){if(S=S||this[i],S&&typeof S!="number")throw new TypeError("maxAge must be a number");let V=S?Date.now():0,B=this[h](P,C);if(this[o].has(C)){if(B>this[c])return R(this,this[o].get(C)),!1;let ie=this[o].get(C).value;return this[r]&&(this[e]||this[r](C,ie.value)),ie.now=V,ie.maxAge=S,ie.value=P,this[m]+=B-ie.length,ie.length=B,this.get(C),v(this),!0}let ne=new A(C,P,B,V,S);return ne.length>this[c]?(this[r]&&this[r](C,P),!1):(this[m]+=ne.length,this[t].unshift(ne),this[o].set(C,this[t].head),v(this),!0)}has(C){if(!this[o].has(C))return!1;let P=this[o].get(C).value;return!f(this,P)}get(C){return _(this,C,!0)}peek(C){return _(this,C,!1)}pop(){let C=this[t].tail;return C?(R(this,C),C.value):null}del(C){R(this,this[o].get(C))}load(C){this.reset();let P=Date.now();for(let S=C.length-1;S>=0;S--){let V=C[S],B=V.e||0;if(B===0)this.set(V.k,V.v);else{let ne=B-P;ne>0&&this.set(V.k,V.v,ne)}}}prune(){this[o].forEach((C,P)=>_(this,P,!1))}}let _=(j,C,P)=>{let S=j[o].get(C);if(S){let V=S.value;if(f(j,V)){if(R(j,S),!j[s])return}else P&&(j[u]&&(S.value.now=Date.now()),j[t].unshiftNode(S));return V.value}},f=(j,C)=>{if(!C||!C.maxAge&&!j[i])return!1;let P=Date.now()-C.now;return C.maxAge?P>C.maxAge:j[i]&&P>j[i]},v=j=>{if(j[m]>j[c])for(let C=j[t].tail;j[m]>j[c]&&C!==null;){let P=C.prev;R(j,C),C=P}},R=(j,C)=>{if(C){let P=C.value;j[r]&&j[r](P.key,P.value),j[m]-=P.length,j[o].delete(P.key),j[t].removeNode(C)}};class A{constructor(C,P,S,V,B){this.key=C,this.value=P,this.length=S,this.now=V,this.maxAge=B||0}}let W=(j,C,P,S)=>{let V=P.value;f(j,V)&&(R(j,P),j[s]||(V=void 0)),V&&C.call(S,V.value,V.key,j)};k.exports=g},{yallist:84}],46:[function(y,k,x){(function(p){(function(){let c=k.exports;c.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"},c.codes={};for(let h in c.types){let s=c.types[h];c.codes[s]=h}c.CMD_SHIFT=4,c.CMD_MASK=240,c.DUP_MASK=8,c.QOS_MASK=3,c.QOS_SHIFT=1,c.RETAIN_MASK=1,c.VARBYTEINT_MASK=127,c.VARBYTEINT_FIN_MASK=128,c.VARBYTEINT_MAX=268435455,c.SESSIONPRESENT_MASK=1,c.SESSIONPRESENT_HEADER=p.from([c.SESSIONPRESENT_MASK]),c.CONNACK_HEADER=p.from([c.codes.connack<<c.CMD_SHIFT]),c.USERNAME_MASK=128,c.PASSWORD_MASK=64,c.WILL_RETAIN_MASK=32,c.WILL_QOS_MASK=24,c.WILL_QOS_SHIFT=3,c.WILL_FLAG_MASK=4,c.CLEAN_SESSION_MASK=2,c.CONNECT_HEADER=p.from([c.codes.connect<<c.CMD_SHIFT]),c.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},c.propertiesCodes={};for(let h in c.properties){let s=c.properties[h];c.propertiesCodes[s]=h}c.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function m(h){return[0,1,2].map(s=>[0,1].map(i=>[0,1].map(r=>{let e=p.alloc(1);return e.writeUInt8(c.codes[h]<<c.CMD_SHIFT|(i?c.DUP_MASK:0)|s<<c.QOS_SHIFT|r,0,!0),e})))}c.PUBLISH_HEADER=m("publish"),c.SUBSCRIBE_HEADER=m("subscribe"),c.SUBSCRIBE_OPTIONS_QOS_MASK=3,c.SUBSCRIBE_OPTIONS_NL_MASK=1,c.SUBSCRIBE_OPTIONS_NL_SHIFT=2,c.SUBSCRIBE_OPTIONS_RAP_MASK=1,c.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,c.SUBSCRIBE_OPTIONS_RH_MASK=3,c.SUBSCRIBE_OPTIONS_RH_SHIFT=4,c.SUBSCRIBE_OPTIONS_RH=[0,16,32],c.SUBSCRIBE_OPTIONS_NL=4,c.SUBSCRIBE_OPTIONS_RAP=8,c.SUBSCRIBE_OPTIONS_QOS=[0,1,2],c.UNSUBSCRIBE_HEADER=m("unsubscribe"),c.ACKS={unsuback:m("unsuback"),puback:m("puback"),pubcomp:m("pubcomp"),pubrel:m("pubrel"),pubrec:m("pubrec")},c.SUBACK_HEADER=p.from([c.codes.suback<<c.CMD_SHIFT]),c.VERSION3=p.from([3]),c.VERSION4=p.from([4]),c.VERSION5=p.from([5]),c.VERSION131=p.from([131]),c.VERSION132=p.from([132]),c.QOS=[0,1,2].map(h=>p.from([h])),c.EMPTY={pingreq:p.from([c.codes.pingreq<<4,0]),pingresp:p.from([c.codes.pingresp<<4,0]),disconnect:p.from([c.codes.disconnect<<4,0])}}).call(this)}).call(this,y("buffer").Buffer)},{buffer:3}],47:[function(y,k,x){(function(p){(function(){let c=y("./writeToStream"),m=y("events");function h(i,r){let e=new s;return c(i,e,r),e.concat()}class s extends m{constructor(){super(),this._array=new Array(20),this._i=0}write(r){return this._array[this._i++]=r,!0}concat(){let r=0,e=new Array(this._array.length),t=this._array,o=0,u;for(u=0;u<t.length&&t[u]!==void 0;u++)typeof t[u]!="string"?e[u]=t[u].length:e[u]=p.byteLength(t[u]),r+=e[u];let d=p.allocUnsafe(r);for(u=0;u<t.length&&t[u]!==void 0;u++)typeof t[u]!="string"?(t[u].copy(d,o),o+=e[u]):(d.write(t[u],o),o+=e[u]);return d}}k.exports=h}).call(this)}).call(this,y("buffer").Buffer)},{"./writeToStream":52,buffer:3,events:4}],48:[function(y,k,x){x.parser=y("./parser").parser,x.generate=y("./generate"),x.writeToStream=y("./writeToStream")},{"./generate":47,"./parser":51,"./writeToStream":52}],49:[function(y,k,x){(function(p){(function(){let m={},h=p.isBuffer(p.from([1,2]).subarray(0,1));function s(t){let o=p.allocUnsafe(2);return o.writeUInt8(t>>8,0),o.writeUInt8(t&255,1),o}function i(){for(let t=0;t<65536;t++)m[t]=s(t)}function r(t){let u=0,d=0,g=p.allocUnsafe(4);do u=t%128|0,t=t/128|0,t>0&&(u=u|128),g.writeUInt8(u,d++);while(t>0&&d<4);return t>0&&(d=0),h?g.subarray(0,d):g.slice(0,d)}function e(t){let o=p.allocUnsafe(4);return o.writeUInt32BE(t,0),o}k.exports={cache:m,generateCache:i,generateNumber:s,genBufVariableByteInt:r,generate4ByteBuffer:e}}).call(this)}).call(this,y("buffer").Buffer)},{buffer:3}],50:[function(y,k,x){class p{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}k.exports=p},{}],51:[function(y,k,x){let p=y("bl"),c=y("events"),m=y("./packet"),h=y("./constants"),s=y("debug")("mqtt-packet:parser");class i extends c{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof i?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new i().parser(e)}_resetState(){s("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new m,this.error=null,this._list=p(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),s("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,s("parse: state complete. _stateCounter is now: %d",this._stateCounter),s("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return s("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0);return this.packet.cmd=h.types[e>>h.CMD_SHIFT],this.packet.retain=(e&h.RETAIN_MASK)!==0,this.packet.qos=e>>h.QOS_SHIFT&h.QOS_MASK,this.packet.dup=(e&h.DUP_MASK)!==0,s("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),s("_parseLength %d",e.value),!!e}_parsePayload(){s("_parsePayload: payload %O",this._list);let e=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return s("_parsePayload complete result: %s",e),e}_parseConnect(){s("_parseConnect");let e,t,o,u,d={},g=this.packet,_=this._parseString();if(_===null)return this._emitError(new Error("Cannot parse protocolId"));if(_!=="MQTT"&&_!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(g.protocolId=_,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(g.protocolVersion=this._list.readUInt8(this._pos),g.protocolVersion>=128&&(g.bridgeMode=!0,g.protocolVersion=g.protocolVersion-128),g.protocolVersion!==3&&g.protocolVersion!==4&&g.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(d.username=this._list.readUInt8(this._pos)&h.USERNAME_MASK,d.password=this._list.readUInt8(this._pos)&h.PASSWORD_MASK,d.will=this._list.readUInt8(this._pos)&h.WILL_FLAG_MASK,d.will&&(g.will={},g.will.retain=(this._list.readUInt8(this._pos)&h.WILL_RETAIN_MASK)!==0,g.will.qos=(this._list.readUInt8(this._pos)&h.WILL_QOS_MASK)>>h.WILL_QOS_SHIFT),g.clean=(this._list.readUInt8(this._pos)&h.CLEAN_SESSION_MASK)!==0,this._pos++,g.keepalive=this._parseNum(),g.keepalive===-1)return this._emitError(new Error("Packet too short"));if(g.protocolVersion===5){let v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}let f=this._parseString();if(f===null)return this._emitError(new Error("Packet too short"));if(g.clientId=f,s("_parseConnect: packet.clientId: %s",g.clientId),d.will){if(g.protocolVersion===5){let v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.will.properties=v)}if(e=this._parseString(),e===null)return this._emitError(new Error("Cannot parse will topic"));if(g.will.topic=e,s("_parseConnect: packet.will.topic: %s",g.will.topic),t=this._parseBuffer(),t===null)return this._emitError(new Error("Cannot parse will payload"));g.will.payload=t,s("_parseConnect: packet.will.paylaod: %s",g.will.payload)}if(d.username){if(u=this._parseString(),u===null)return this._emitError(new Error("Cannot parse username"));g.username=u,s("_parseConnect: packet.username: %s",g.username)}if(d.password){if(o=this._parseBuffer(),o===null)return this._emitError(new Error("Cannot parse password"));g.password=o}return this.settings=g,s("_parseConnect: complete"),g}_parseConnack(){s("_parseConnack");let e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&h.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)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(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}s("_parseConnack: complete")}_parsePublish(){s("_parsePublish");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),s("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){s("_parseSubscribe");let e=this.packet,t,o,u,d,g,_,f;if(e.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(e.properties=v)}for(;this._pos<e.length;){if(t=this._parseString(),t===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));o=this._parseByte(),u=o&h.SUBSCRIBE_OPTIONS_QOS_MASK,_=(o>>h.SUBSCRIBE_OPTIONS_NL_SHIFT&h.SUBSCRIBE_OPTIONS_NL_MASK)!==0,g=(o>>h.SUBSCRIBE_OPTIONS_RAP_SHIFT&h.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,d=o>>h.SUBSCRIBE_OPTIONS_RH_SHIFT&h.SUBSCRIBE_OPTIONS_RH_MASK,f={topic:t,qos:u},this.settings.protocolVersion===5?(f.nl=_,f.rap=g,f.rh=d):this.settings.bridgeMode&&(f.rh=0,f.rap=!0,f.nl=!0),s("_parseSubscribe: push subscription `%s` to subscription",f),e.subscriptions.push(f)}}}_parseSuback(){s("_parseSuback");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){s("_parseUnsubscribe");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){let t=this._parseString();if(t===null)return this._emitError(new Error("Cannot parse topic"));s("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){s("_parseUnsuback");let e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){let t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){s("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let e=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(e.length>2?(e.reasonCode=this._parseByte(),s("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){let e=this.packet;if(s("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return s("_parseDisconnect result: true"),!0}_parseAuth(){s("_parseAuth");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();let t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),s("_parseAuth: result: true"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(s("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let t=this._parseNum(),o=t+this._pos;if(t===-1||o>this._list.length||o>this.packet.length)return null;let u=this._list.toString("utf8",this._pos,o);return this._pos+=t,s("_parseString: result: %s",u),u}_parseStringPair(){return s("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),t=e+this._pos;if(e===-1||t>this._list.length||t>this.packet.length)return null;let o=this._list.slice(this._pos,t);return this._pos+=e,s("_parseBuffer: result: %o",o),o}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,s("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,s("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){s("_parseVarByteNum");let t=4,o=0,u=1,d=0,g=!1,_,f=this._pos?this._pos:0;for(;o<t&&f+o<this._list.length;){if(_=this._list.readUInt8(f+o++),d+=u*(_&h.VARBYTEINT_MASK),u*=128,!(_&h.VARBYTEINT_FIN_MASK)){g=!0;break}if(this._list.length<=o)break}return!g&&o===t&&this._list.length>=o&&this._emitError(new Error("Invalid variable byte integer")),f&&(this._pos+=o),g=g?e?{bytes:o,value:d}:d:!1,s("_parseVarByteNum: result: %o",g),g}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),s("_parseByte: result: %o",e),e}_parseByType(e){switch(s("_parseByType: type: %s",e),e){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){s("_parseProperties");let e=this._parseVarByteNum(),o=this._pos+e,u={};for(;this._pos<o;){let d=this._parseByte();if(!d)return this._emitError(new Error("Cannot parse property code type")),!1;let g=h.propertiesCodes[d];if(!g)return this._emitError(new Error("Unknown property")),!1;if(g==="userProperties"){u[g]||(u[g]=Object.create(null));let _=this._parseByType(h.propertiesTypes[g]);if(u[g][_.name])if(Array.isArray(u[g][_.name]))u[g][_.name].push(_.value);else{let f=u[g][_.name];u[g][_.name]=[f],u[g][_.name].push(_.value)}else u[g][_.name]=_.value;continue}u[g]?Array.isArray(u[g])?u[g].push(this._parseByType(h.propertiesTypes[g])):(u[g]=[u[g]],u[g].push(this._parseByType(h.propertiesTypes[g]))):u[g]=this._parseByType(h.propertiesTypes[g])}return u}_newPacket(){return s("_newPacket"),this.packet&&(this._list.consume(this.packet.length),s("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),s("_newPacket: new packet"),this.packet=new m,this._pos=0,!0}_emitError(e){s("_emitError"),this.error=e,this.emit("error",e)}}k.exports=i},{"./constants":46,"./packet":50,bl:19,debug:20,events:4}],52:[function(y,k,x){(function(p){(function(){let c=y("./constants"),m=p.allocUnsafe(0),h=p.from([0]),s=y("./numbers"),i=y("process-nextick-args").nextTick,r=y("debug")("mqtt-packet:writeToStream"),e=s.cache,t=s.generateNumber,o=s.generateCache,u=s.genBufVariableByteInt,d=s.generate4ByteBuffer,g=U,_=!0;function f(F,M,Y){switch(r("generate called"),M.cork&&(M.cork(),i(v,M)),_&&(_=!1,o()),r("generate: packet.cmd: %s",F.cmd),F.cmd){case"connect":return R(F,M,Y);case"connack":return A(F,M,Y);case"publish":return W(F,M,Y);case"puback":case"pubrec":case"pubrel":case"pubcomp":return j(F,M,Y);case"subscribe":return C(F,M,Y);case"suback":return P(F,M,Y);case"unsubscribe":return S(F,M,Y);case"unsuback":return V(F,M,Y);case"pingreq":case"pingresp":return B(F,M,Y);case"disconnect":return ne(F,M,Y);case"auth":return se(F,M,Y);default:return M.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(f,"cacheNumbers",{get(){return g===U},set(F){F?((!e||Object.keys(e).length===0)&&(_=!0),g=U):(_=!1,g=z)}});function v(F){F.uncork()}function R(F,M,Y){let te=F||{},O=te.protocolId||"MQTT",I=te.protocolVersion||4,N=te.will,q=te.clean,Q=te.keepalive||0,b=te.clientId||"",l=te.username,n=te.password,a=te.properties;q===void 0&&(q=!0);let w=0;if(!O||typeof O!="string"&&!p.isBuffer(O))return M.emit("error",new Error("Invalid protocolId")),!1;if(w+=O.length+2,I!==3&&I!==4&&I!==5)return M.emit("error",new Error("Invalid protocol version")),!1;if(w+=1,(typeof b=="string"||p.isBuffer(b))&&(b||I>=4)&&(b||q))w+=p.byteLength(b)+2;else{if(I<4)return M.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(q*1===0)return M.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof Q!="number"||Q<0||Q>65535||Q%1!==0)return M.emit("error",new Error("Invalid keepalive")),!1;if(w+=2,w+=1,I===5){var L=H(M,a);if(!L)return!1;w+=L.length}if(N){if(typeof N!="object")return M.emit("error",new Error("Invalid will")),!1;if(!N.topic||typeof N.topic!="string")return M.emit("error",new Error("Invalid will topic")),!1;if(w+=p.byteLength(N.topic)+2,w+=2,N.payload)if(N.payload.length>=0)typeof N.payload=="string"?w+=p.byteLength(N.payload):w+=N.payload.length;else return M.emit("error",new Error("Invalid will payload")),!1;var K={};if(I===5){if(K=H(M,N.properties),!K)return!1;w+=K.length}}let J=!1;if(l!=null)if(Z(l))J=!0,w+=p.byteLength(l)+2;else return M.emit("error",new Error("Invalid username")),!1;if(n!=null){if(!J)return M.emit("error",new Error("Username is required to use password")),!1;if(Z(n))w+=oe(n)+2;else return M.emit("error",new Error("Invalid password")),!1}M.write(c.CONNECT_HEADER),G(M,w),ee(M,O),te.bridgeMode&&(I+=128),M.write(I===131?c.VERSION131:I===132?c.VERSION132:I===4?c.VERSION4:I===5?c.VERSION5:c.VERSION3);let le=0;return le|=l!=null?c.USERNAME_MASK:0,le|=n!=null?c.PASSWORD_MASK:0,le|=N&&N.retain?c.WILL_RETAIN_MASK:0,le|=N&&N.qos?N.qos<<c.WILL_QOS_SHIFT:0,le|=N?c.WILL_FLAG_MASK:0,le|=q?c.CLEAN_SESSION_MASK:0,M.write(p.from([le])),g(M,Q),I===5&&L.write(),ee(M,b),N&&(I===5&&K.write(),E(M,N.topic),ee(M,N.payload)),l!=null&&ee(M,l),n!=null&&ee(M,n),!0}function A(F,M,Y){let te=Y?Y.protocolVersion:4,O=F||{},I=te===5?O.reasonCode:O.returnCode,N=O.properties,q=2;if(typeof I!="number")return M.emit("error",new Error("Invalid return code")),!1;let Q=null;if(te===5){if(Q=H(M,N),!Q)return!1;q+=Q.length}return M.write(c.CONNACK_HEADER),G(M,q),M.write(O.sessionPresent?c.SESSIONPRESENT_HEADER:h),M.write(p.from([I])),Q?.write(),!0}function W(F,M,Y){r("publish: packet: %o",F);let te=Y?Y.protocolVersion:4,O=F||{},I=O.qos||0,N=O.retain?c.RETAIN_MASK:0,q=O.topic,Q=O.payload||m,b=O.messageId,l=O.properties,n=0;if(typeof q=="string")n+=p.byteLength(q)+2;else if(p.isBuffer(q))n+=q.length+2;else return M.emit("error",new Error("Invalid topic")),!1;if(p.isBuffer(Q)?n+=Q.length:n+=p.byteLength(Q),I&&typeof b!="number")return M.emit("error",new Error("Invalid messageId")),!1;I&&(n+=2);let a=null;if(te===5){if(a=H(M,l),!a)return!1;n+=a.length}return M.write(c.PUBLISH_HEADER[I][O.dup?1:0][N?1:0]),G(M,n),g(M,oe(q)),M.write(q),I>0&&g(M,b),a?.write(),r("publish: payload: %o",Q),M.write(Q)}function j(F,M,Y){let te=Y?Y.protocolVersion:4,O=F||{},I=O.cmd||"puback",N=O.messageId,q=O.dup&&I==="pubrel"?c.DUP_MASK:0,Q=0,b=O.reasonCode,l=O.properties,n=te===5?3:2;if(I==="pubrel"&&(Q=1),typeof N!="number")return M.emit("error",new Error("Invalid messageId")),!1;let a=null;if(te===5&&typeof l=="object"){if(a=D(M,l,Y,n),!a)return!1;n+=a.length}return M.write(c.ACKS[I][Q][q][0]),G(M,n),g(M,N),te===5&&M.write(p.from([b])),a!==null&&a.write(),!0}function C(F,M,Y){r("subscribe: packet: ");let te=Y?Y.protocolVersion:4,O=F||{},I=O.dup?c.DUP_MASK:0,N=O.messageId,q=O.subscriptions,Q=O.properties,b=0;if(typeof N!="number")return M.emit("error",new Error("Invalid messageId")),!1;b+=2;let l=null;if(te===5){if(l=H(M,Q),!l)return!1;b+=l.length}if(typeof q=="object"&&q.length)for(let a=0;a<q.length;a+=1){let w=q[a].topic,L=q[a].qos;if(typeof w!="string")return M.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof L!="number")return M.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(te===5){if(typeof(q[a].nl||!1)!="boolean")return M.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(q[a].rap||!1)!="boolean")return M.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;let le=q[a].rh||0;if(typeof le!="number"||le>2)return M.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}b+=p.byteLength(w)+2+1}else return M.emit("error",new Error("Invalid subscriptions")),!1;r("subscribe: writing to stream: %o",c.SUBSCRIBE_HEADER),M.write(c.SUBSCRIBE_HEADER[1][I?1:0][0]),G(M,b),g(M,N),l!==null&&l.write();let n=!0;for(let a of q){let w=a.topic,L=a.qos,K=+a.nl,J=+a.rap,le=a.rh,he;E(M,w),he=c.SUBSCRIBE_OPTIONS_QOS[L],te===5&&(he|=K?c.SUBSCRIBE_OPTIONS_NL:0,he|=J?c.SUBSCRIBE_OPTIONS_RAP:0,he|=le?c.SUBSCRIBE_OPTIONS_RH[le]:0),n=M.write(p.from([he]))}return n}function P(F,M,Y){let te=Y?Y.protocolVersion:4,O=F||{},I=O.messageId,N=O.granted,q=O.properties,Q=0;if(typeof I!="number")return M.emit("error",new Error("Invalid messageId")),!1;if(Q+=2,typeof N=="object"&&N.length)for(let l=0;l<N.length;l+=1){if(typeof N[l]!="number")return M.emit("error",new Error("Invalid qos vector")),!1;Q+=1}else return M.emit("error",new Error("Invalid qos vector")),!1;let b=null;if(te===5){if(b=D(M,q,Y,Q),!b)return!1;Q+=b.length}return M.write(c.SUBACK_HEADER),G(M,Q),g(M,I),b!==null&&b.write(),M.write(p.from(N))}function S(F,M,Y){let te=Y?Y.protocolVersion:4,O=F||{},I=O.messageId,N=O.dup?c.DUP_MASK:0,q=O.unsubscriptions,Q=O.properties,b=0;if(typeof I!="number")return M.emit("error",new Error("Invalid messageId")),!1;if(b+=2,typeof q=="object"&&q.length)for(let a=0;a<q.length;a+=1){if(typeof q[a]!="string")return M.emit("error",new Error("Invalid unsubscriptions")),!1;b+=p.byteLength(q[a])+2}else return M.emit("error",new Error("Invalid unsubscriptions")),!1;let l=null;if(te===5){if(l=H(M,Q),!l)return!1;b+=l.length}M.write(c.UNSUBSCRIBE_HEADER[1][N?1:0][0]),G(M,b),g(M,I),l!==null&&l.write();let n=!0;for(let a=0;a<q.length;a++)n=E(M,q[a]);return n}function V(F,M,Y){let te=Y?Y.protocolVersion:4,O=F||{},I=O.messageId,N=O.dup?c.DUP_MASK:0,q=O.granted,Q=O.properties,b=O.cmd,l=0,n=2;if(typeof I!="number")return M.emit("error",new Error("Invalid messageId")),!1;if(te===5)if(typeof q=="object"&&q.length)for(let w=0;w<q.length;w+=1){if(typeof q[w]!="number")return M.emit("error",new Error("Invalid qos vector")),!1;n+=1}else return M.emit("error",new Error("Invalid qos vector")),!1;let a=null;if(te===5){if(a=D(M,Q,Y,n),!a)return!1;n+=a.length}return M.write(c.ACKS[b][l][N][0]),G(M,n),g(M,I),a!==null&&a.write(),te===5&&M.write(p.from(q)),!0}function B(F,M,Y){return M.write(c.EMPTY[F.cmd])}function ne(F,M,Y){let te=Y?Y.protocolVersion:4,O=F||{},I=O.reasonCode,N=O.properties,q=te===5?1:0,Q=null;if(te===5){if(Q=D(M,N,Y,q),!Q)return!1;q+=Q.length}return M.write(p.from([c.codes.disconnect<<4])),G(M,q),te===5&&M.write(p.from([I])),Q!==null&&Q.write(),!0}function se(F,M,Y){let te=Y?Y.protocolVersion:4,O=F||{},I=O.reasonCode,N=O.properties,q=te===5?1:0;te!==5&&M.emit("error",new Error("Invalid mqtt version for auth packet"));let Q=D(M,N,Y,q);return Q?(q+=Q.length,M.write(p.from([c.codes.auth<<4])),G(M,q),M.write(p.from([I])),Q!==null&&Q.write(),!0):!1}let ie={};function G(F,M){if(M>c.VARBYTEINT_MAX)return F.emit("error",new Error(`Invalid variable byte integer: ${M}`)),!1;let Y=ie[M];return Y||(Y=u(M),M<16384&&(ie[M]=Y)),r("writeVarByteInt: writing to stream: %o",Y),F.write(Y)}function E(F,M){let Y=p.byteLength(M);return g(F,Y),r("writeString: %s",M),F.write(M,"utf8")}function T(F,M,Y){E(F,M),E(F,Y)}function U(F,M){return r("writeNumberCached: number: %d",M),r("writeNumberCached: %o",e[M]),F.write(e[M])}function z(F,M){let Y=t(M);return r("writeNumberGenerated: %o",Y),F.write(Y)}function re(F,M){let Y=d(M);return r("write4ByteNumber: %o",Y),F.write(Y)}function ee(F,M){typeof M=="string"?E(F,M):M?(g(F,M.length),F.write(M)):g(F,0)}function H(F,M){if(typeof M!="object"||M.length!=null)return{length:1,write(){$(F,{},0)}};let Y=0;function te(I,N){let q=c.propertiesTypes[I],Q=0;switch(q){case"byte":{if(typeof N!="boolean")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Q+=2;break}case"int8":{if(typeof N!="number"||N<0||N>255)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Q+=2;break}case"binary":{if(N&&N===null)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Q+=1+p.byteLength(N)+2;break}case"int16":{if(typeof N!="number"||N<0||N>65535)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Q+=3;break}case"int32":{if(typeof N!="number"||N<0||N>4294967295)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Q+=5;break}case"var":{if(typeof N!="number"||N<0||N>268435455)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Q+=1+p.byteLength(u(N));break}case"string":{if(typeof N!="string")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Q+=3+p.byteLength(N.toString());break}case"pair":{if(typeof N!="object")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Q+=Object.getOwnPropertyNames(N).reduce((b,l)=>{let n=N[l];return Array.isArray(n)?b+=n.reduce((a,w)=>(a+=3+p.byteLength(l.toString())+2+p.byteLength(w.toString()),a),0):b+=3+p.byteLength(l.toString())+2+p.byteLength(N[l].toString()),b},0);break}default:return F.emit("error",new Error(`Invalid property ${I}: ${N}`)),!1}return Q}if(M)for(let I in M){let N=0,q=0,Q=M[I];if(Array.isArray(Q))for(let b=0;b<Q.length;b++){if(q=te(I,Q[b]),!q)return!1;N+=q}else{if(q=te(I,Q),!q)return!1;N=q}if(!N)return!1;Y+=N}return{length:p.byteLength(u(Y))+Y,write(){$(F,M,Y)}}}function D(F,M,Y,te){let O=["reasonString","userProperties"],I=Y&&Y.properties&&Y.properties.maximumPacketSize?Y.properties.maximumPacketSize:0,N=H(F,M);if(I)for(;te+N.length>I;){let q=O.shift();if(q&&M[q])delete M[q],N=H(F,M);else return!1}return N}function X(F,M,Y){switch(c.propertiesTypes[M]){case"byte":{F.write(p.from([c.properties[M]])),F.write(p.from([+Y]));break}case"int8":{F.write(p.from([c.properties[M]])),F.write(p.from([Y]));break}case"binary":{F.write(p.from([c.properties[M]])),ee(F,Y);break}case"int16":{F.write(p.from([c.properties[M]])),g(F,Y);break}case"int32":{F.write(p.from([c.properties[M]])),re(F,Y);break}case"var":{F.write(p.from([c.properties[M]])),G(F,Y);break}case"string":{F.write(p.from([c.properties[M]])),E(F,Y);break}case"pair":{Object.getOwnPropertyNames(Y).forEach(O=>{let I=Y[O];Array.isArray(I)?I.forEach(N=>{F.write(p.from([c.properties[M]])),T(F,O.toString(),N.toString())}):(F.write(p.from([c.properties[M]])),T(F,O.toString(),I.toString()))});break}default:return F.emit("error",new Error(`Invalid property ${M} value: ${Y}`)),!1}}function $(F,M,Y){G(F,Y);for(let te in M)if(Object.prototype.hasOwnProperty.call(M,te)&&M[te]!==null){let O=M[te];if(Array.isArray(O))for(let I=0;I<O.length;I++)X(F,te,O[I]);else X(F,te,O)}}function oe(F){return F?F instanceof p?F.length:p.byteLength(F):0}function Z(F){return typeof F=="string"||F instanceof p}k.exports=f}).call(this)}).call(this,y("buffer").Buffer)},{"./constants":46,"./numbers":49,buffer:3,debug:20,"process-nextick-args":57}],53:[function(y,k,x){var p=1e3,c=p*60,m=c*60,h=m*24,s=h*7,i=h*365.25;k.exports=function(u,d){d=d||{};var g=typeof u;if(g==="string"&&u.length>0)return r(u);if(g==="number"&&isFinite(u))return d.long?t(u):e(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function r(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var g=parseFloat(d[1]),_=(d[2]||"ms").toLowerCase();switch(_){case"years":case"year":case"yrs":case"yr":case"y":return g*i;case"weeks":case"week":case"w":return g*s;case"days":case"day":case"d":return g*h;case"hours":case"hour":case"hrs":case"hr":case"h":return g*m;case"minutes":case"minute":case"mins":case"min":case"m":return g*c;case"seconds":case"second":case"secs":case"sec":case"s":return g*p;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function e(u){var d=Math.abs(u);return d>=h?Math.round(u/h)+"d":d>=m?Math.round(u/m)+"h":d>=c?Math.round(u/c)+"m":d>=p?Math.round(u/p)+"s":u+"ms"}function t(u){var d=Math.abs(u);return d>=h?o(u,d,h,"day"):d>=m?o(u,d,m,"hour"):d>=c?o(u,d,c,"minute"):d>=p?o(u,d,p,"second"):u+" ms"}function o(u,d,g,_){var f=d>=g*1.5;return Math.round(u/g)+" "+_+(f?"s":"")}},{}],54:[function(y,k,x){let p=y("./lib/number-allocator.js");k.exports.NumberAllocator=p},{"./lib/number-allocator.js":55}],55:[function(y,k,x){"use strict";let p=y("js-sdsl").OrderedSet,c=y("debug")("number-allocator:trace"),m=y("debug")("number-allocator:error");function h(i,r){this.low=i,this.high=r}h.prototype.equals=function(i){return this.low===i.low&&this.high===i.high},h.prototype.compare=function(i){return this.low<i.low&&this.high<i.low?-1:i.low<this.low&&i.high<this.low?1:0};function s(i,r){if(!(this instanceof s))return new s(i,r);this.min=i,this.max=r,this.ss=new p([],(e,t)=>e.compare(t)),c("Create"),this.clear()}s.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},s.prototype.alloc=function(){if(this.ss.size()===0)return c("alloc():empty"),null;let i=this.ss.begin(),r=i.pointer.low,e=i.pointer.high,t=r;return t+1<=e?this.ss.updateKeyByIterator(i,new h(r+1,e)):this.ss.eraseElementByPos(0),c("alloc():"+t),t},s.prototype.use=function(i){let r=new h(i,i),e=this.ss.lowerBound(r);if(!e.equals(this.ss.end())){let t=e.pointer.low,o=e.pointer.high;return e.pointer.equals(r)?(this.ss.eraseElementByIterator(e),c("use():"+i),!0):t>i?!1:t===i?(this.ss.updateKeyByIterator(e,new h(t+1,o)),c("use():"+i),!0):o===i?(this.ss.updateKeyByIterator(e,new h(t,o-1)),c("use():"+i),!0):(this.ss.updateKeyByIterator(e,new h(i+1,o)),this.ss.insert(new h(t,i-1)),c("use():"+i),!0)}return c("use():failed"),!1},s.prototype.free=function(i){if(i<this.min||i>this.max){m("free():"+i+" is out of range");return}let r=new h(i,i),e=this.ss.upperBound(r);if(e.equals(this.ss.end())){if(e.equals(this.ss.begin())){this.ss.insert(r);return}e.pre();let t=e.pointer.high;e.pointer.high+1===i?this.ss.updateKeyByIterator(e,new h(t,i)):this.ss.insert(r)}else if(e.equals(this.ss.begin()))if(i+1===e.pointer.low){let t=e.pointer.high;this.ss.updateKeyByIterator(e,new h(i,t))}else this.ss.insert(r);else{let t=e.pointer.low,o=e.pointer.high;e.pre();let u=e.pointer.low;e.pointer.high+1===i?i+1===t?(this.ss.eraseElementByIterator(e),this.ss.updateKeyByIterator(e,new h(u,o))):this.ss.updateKeyByIterator(e,new h(u,i)):i+1===t?(this.ss.eraseElementByIterator(e.next()),this.ss.insert(new h(i,o))):this.ss.insert(r)}c("free():"+i)},s.prototype.clear=function(){c("clear()"),this.ss.clear(),this.ss.insert(new h(this.min,this.max))},s.prototype.intervalCount=function(){return this.ss.size()},s.prototype.dump=function(){console.log("length:"+this.ss.size());for(let i of this.ss)console.log(i)},k.exports=s},{debug:20,"js-sdsl":42}],56:[function(y,k,x){var p=y("wrappy");k.exports=p(c),k.exports.strict=p(m),c.proto=c(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return c(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return m(this)},configurable:!0})});function c(h){var s=function(){return s.called?s.value:(s.called=!0,s.value=h.apply(this,arguments))};return s.called=!1,s}function m(h){var s=function(){if(s.called)throw new Error(s.onceError);return s.called=!0,s.value=h.apply(this,arguments)},i=h.name||"Function wrapped with `once`";return s.onceError=i+" shouldn't be called more than once",s.called=!1,s}},{wrappy:80}],57:[function(y,k,x){(function(p){(function(){"use strict";typeof p>"u"||!p.version||p.version.indexOf("v0.")===0||p.version.indexOf("v1.")===0&&p.version.indexOf("v1.8.")!==0?k.exports={nextTick:c}:k.exports=p;function c(m,h,s,i){if(typeof m!="function")throw new TypeError('"callback" argument must be a function');var r=arguments.length,e,t;switch(r){case 0:case 1:return p.nextTick(m);case 2:return p.nextTick(function(){m.call(null,h)});case 3:return p.nextTick(function(){m.call(null,h,s)});case 4:return p.nextTick(function(){m.call(null,h,s,i)});default:for(e=new Array(r-1),t=0;t<e.length;)e[t++]=arguments[t];return p.nextTick(function(){m.apply(null,e)})}}}).call(this)}).call(this,y("_process"))},{_process:85}],58:[function(y,k,x){"use strict";function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var c={};function m(e,t,o){o||(o=Error);function u(g,_,f){return typeof t=="string"?t:t(g,_,f)}var d=function(g){p(_,g);function _(f,v,R){return g.call(this,u(f,v,R))||this}return _}(o);d.prototype.name=o.name,d.prototype.code=e,c[e]=d}function h(e,t){if(Array.isArray(e)){var o=e.length;return e=e.map(function(u){return String(u)}),o>2?"one of ".concat(t," ").concat(e.slice(0,o-1).join(", "),", or ")+e[o-1]:o===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function s(e,t,o){return e.substr(!o||o<0?0:+o,t.length)===t}function i(e,t,o){return(o===void 0||o>e.length)&&(o=e.length),e.substring(o-t.length,o)===t}function r(e,t,o){return typeof o!="number"&&(o=0),o+t.length>e.length?!1:e.indexOf(t,o)!==-1}m("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),m("ERR_INVALID_ARG_TYPE",function(e,t,o){var u;typeof t=="string"&&s(t,"not ")?(u="must not be",t=t.replace(/^not /,"")):u="must be";var d;if(i(e," argument"))d="The ".concat(e," ").concat(u," ").concat(h(t,"type"));else{var g=r(e,".")?"property":"argument";d='The "'.concat(e,'" ').concat(g," ").concat(u," ").concat(h(t,"type"))}return d+=". Received type ".concat(typeof o),d},TypeError),m("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),m("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),m("ERR_STREAM_PREMATURE_CLOSE","Premature close"),m("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),m("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),m("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),m("ERR_STREAM_WRITE_AFTER_END","write after end"),m("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),m("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),m("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),k.exports.codes=c},{}],59:[function(y,k,x){(function(p){(function(){"use strict";var c=Object.keys||function(u){var d=[];for(var g in u)d.push(g);return d};k.exports=e;var m=y("./_stream_readable"),h=y("./_stream_writable");y("inherits")(e,m);for(var s=c(h.prototype),i=0;i<s.length;i++){var r=s[i];e.prototype[r]||(e.prototype[r]=h.prototype[r])}function e(u){if(!(this instanceof e))return new e(u);m.call(this,u),h.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",t)))}Object.defineProperty(e.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(e.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(e.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function t(){this._writableState.ended||p.nextTick(o,this)}function o(u){u.end()}Object.defineProperty(e.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}})}).call(this)}).call(this,y("_process"))},{"./_stream_readable":61,"./_stream_writable":63,_process:85,inherits:24}],60:[function(y,k,x){"use strict";k.exports=c;var p=y("./_stream_transform");y("inherits")(c,p);function c(m){if(!(this instanceof c))return new c(m);p.call(this,m)}c.prototype._transform=function(m,h,s){s(null,m)}},{"./_stream_transform":62,inherits:24}],61:[function(y,k,x){(function(p,c){(function(){"use strict";k.exports=G;var m;G.ReadableState=ie;var h=y("events").EventEmitter,s=function(l,n){return l.listeners(n).length},i=y("./internal/streams/stream"),r=y("buffer").Buffer,e=c.Uint8Array||function(){};function t(b){return r.from(b)}function o(b){return r.isBuffer(b)||b instanceof e}var u=y("util"),d;u&&u.debuglog?d=u.debuglog("stream"):d=function(){};var g=y("./internal/streams/buffer_list"),_=y("./internal/streams/destroy"),f=y("./internal/streams/state"),v=f.getHighWaterMark,R=y("../errors").codes,A=R.ERR_INVALID_ARG_TYPE,W=R.ERR_STREAM_PUSH_AFTER_EOF,j=R.ERR_METHOD_NOT_IMPLEMENTED,C=R.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,P,S,V;y("inherits")(G,i);var B=_.errorOrDestroy,ne=["error","close","destroy","pause","resume"];function se(b,l,n){if(typeof b.prependListener=="function")return b.prependListener(l,n);!b._events||!b._events[l]?b.on(l,n):Array.isArray(b._events[l])?b._events[l].unshift(n):b._events[l]=[n,b._events[l]]}function ie(b,l,n){m=m||y("./_stream_duplex"),b=b||{},typeof n!="boolean"&&(n=l instanceof m),this.objectMode=!!b.objectMode,n&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=v(this,b,"readableHighWaterMark",n),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(P||(P=y("string_decoder/").StringDecoder),this.decoder=new P(b.encoding),this.encoding=b.encoding)}function G(b){if(m=m||y("./_stream_duplex"),!(this instanceof G))return new G(b);var l=this instanceof m;this._readableState=new ie(b,this,l),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),i.call(this)}Object.defineProperty(G.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(l){this._readableState&&(this._readableState.destroyed=l)}}),G.prototype.destroy=_.destroy,G.prototype._undestroy=_.undestroy,G.prototype._destroy=function(b,l){l(b)},G.prototype.push=function(b,l){var n=this._readableState,a;return n.objectMode?a=!0:typeof b=="string"&&(l=l||n.defaultEncoding,l!==n.encoding&&(b=r.from(b,l),l=""),a=!0),E(this,b,l,!1,a)},G.prototype.unshift=function(b){return E(this,b,null,!0,!1)};function E(b,l,n,a,w){d("readableAddChunk",l);var L=b._readableState;if(l===null)L.reading=!1,H(b,L);else{var K;if(w||(K=U(L,l)),K)B(b,K);else if(L.objectMode||l&&l.length>0)if(typeof l!="string"&&!L.objectMode&&Object.getPrototypeOf(l)!==r.prototype&&(l=t(l)),a)L.endEmitted?B(b,new C):T(b,L,l,!0);else if(L.ended)B(b,new W);else{if(L.destroyed)return!1;L.reading=!1,L.decoder&&!n?(l=L.decoder.write(l),L.objectMode||l.length!==0?T(b,L,l,!1):$(b,L)):T(b,L,l,!1)}else a||(L.reading=!1,$(b,L))}return!L.ended&&(L.length<L.highWaterMark||L.length===0)}function T(b,l,n,a){l.flowing&&l.length===0&&!l.sync?(l.awaitDrain=0,b.emit("data",n)):(l.length+=l.objectMode?1:n.length,a?l.buffer.unshift(n):l.buffer.push(n),l.needReadable&&D(b)),$(b,l)}function U(b,l){var n;return!o(l)&&typeof l!="string"&&l!==void 0&&!b.objectMode&&(n=new A("chunk",["string","Buffer","Uint8Array"],l)),n}G.prototype.isPaused=function(){return this._readableState.flowing===!1},G.prototype.setEncoding=function(b){P||(P=y("string_decoder/").StringDecoder);var l=new P(b);this._readableState.decoder=l,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,a="";n!==null;)a+=l.write(n.data),n=n.next;return this._readableState.buffer.clear(),a!==""&&this._readableState.buffer.push(a),this._readableState.length=a.length,this};var z=1073741824;function re(b){return b>=z?b=z:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function ee(b,l){return b<=0||l.length===0&&l.ended?0:l.objectMode?1:b!==b?l.flowing&&l.length?l.buffer.head.data.length:l.length:(b>l.highWaterMark&&(l.highWaterMark=re(b)),b<=l.length?b:l.ended?l.length:(l.needReadable=!0,0))}G.prototype.read=function(b){d("read",b),b=parseInt(b,10);var l=this._readableState,n=b;if(b!==0&&(l.emittedReadable=!1),b===0&&l.needReadable&&((l.highWaterMark!==0?l.length>=l.highWaterMark:l.length>0)||l.ended))return d("read: emitReadable",l.length,l.ended),l.length===0&&l.ended?N(this):D(this),null;if(b=ee(b,l),b===0&&l.ended)return l.length===0&&N(this),null;var a=l.needReadable;d("need readable",a),(l.length===0||l.length-b<l.highWaterMark)&&(a=!0,d("length less than watermark",a)),l.ended||l.reading?(a=!1,d("reading or ended",a)):a&&(d("do read"),l.reading=!0,l.sync=!0,l.length===0&&(l.needReadable=!0),this._read(l.highWaterMark),l.sync=!1,l.reading||(b=ee(n,l)));var w;return b>0?w=I(b,l):w=null,w===null?(l.needReadable=l.length<=l.highWaterMark,b=0):(l.length-=b,l.awaitDrain=0),l.length===0&&(l.ended||(l.needReadable=!0),n!==b&&l.ended&&N(this)),w!==null&&this.emit("data",w),w};function H(b,l){if(d("onEofChunk"),!l.ended){if(l.decoder){var n=l.decoder.end();n&&n.length&&(l.buffer.push(n),l.length+=l.objectMode?1:n.length)}l.ended=!0,l.sync?D(b):(l.needReadable=!1,l.emittedReadable||(l.emittedReadable=!0,X(b)))}}function D(b){var l=b._readableState;d("emitReadable",l.needReadable,l.emittedReadable),l.needReadable=!1,l.emittedReadable||(d("emitReadable",l.flowing),l.emittedReadable=!0,p.nextTick(X,b))}function X(b){var l=b._readableState;d("emitReadable_",l.destroyed,l.length,l.ended),!l.destroyed&&(l.length||l.ended)&&(b.emit("readable"),l.emittedReadable=!1),l.needReadable=!l.flowing&&!l.ended&&l.length<=l.highWaterMark,O(b)}function $(b,l){l.readingMore||(l.readingMore=!0,p.nextTick(oe,b,l))}function oe(b,l){for(;!l.reading&&!l.ended&&(l.length<l.highWaterMark||l.flowing&&l.length===0);){var n=l.length;if(d("maybeReadMore read 0"),b.read(0),n===l.length)break}l.readingMore=!1}G.prototype._read=function(b){B(this,new j("_read()"))},G.prototype.pipe=function(b,l){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=b;break;case 1:a.pipes=[a.pipes,b];break;default:a.pipes.push(b);break}a.pipesCount+=1,d("pipe count=%d opts=%j",a.pipesCount,l);var w=(!l||l.end!==!1)&&b!==p.stdout&&b!==p.stderr,L=w?J:ve;a.endEmitted?p.nextTick(L):n.once("end",L),b.on("unpipe",K);function K(xe,Ce){d("onunpipe"),xe===n&&Ce&&Ce.hasUnpiped===!1&&(Ce.hasUnpiped=!0,fe())}function J(){d("onend"),b.end()}var le=Z(n);b.on("drain",le);var he=!1;function fe(){d("cleanup"),b.removeListener("close",we),b.removeListener("finish",Se),b.removeListener("drain",le),b.removeListener("error",ce),b.removeListener("unpipe",K),n.removeListener("end",J),n.removeListener("end",ve),n.removeListener("data",de),he=!0,a.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&le()}n.on("data",de);function de(xe){d("ondata");var Ce=b.write(xe);d("dest.write",Ce),Ce===!1&&((a.pipesCount===1&&a.pipes===b||a.pipesCount>1&&Q(a.pipes,b)!==-1)&&!he&&(d("false write response, pause",a.awaitDrain),a.awaitDrain++),n.pause())}function ce(xe){d("onerror",xe),ve(),b.removeListener("error",ce),s(b,"error")===0&&B(b,xe)}se(b,"error",ce);function we(){b.removeListener("finish",Se),ve()}b.once("close",we);function Se(){d("onfinish"),b.removeListener("close",we),ve()}b.once("finish",Se);function ve(){d("unpipe"),n.unpipe(b)}return b.emit("pipe",n),a.flowing||(d("pipe resume"),n.resume()),b};function Z(b){return function(){var n=b._readableState;d("pipeOnDrain",n.awaitDrain),n.awaitDrain&&n.awaitDrain--,n.awaitDrain===0&&s(b,"data")&&(n.flowing=!0,O(b))}}G.prototype.unpipe=function(b){var l=this._readableState,n={hasUnpiped:!1};if(l.pipesCount===0)return this;if(l.pipesCount===1)return b&&b!==l.pipes?this:(b||(b=l.pipes),l.pipes=null,l.pipesCount=0,l.flowing=!1,b&&b.emit("unpipe",this,n),this);if(!b){var a=l.pipes,w=l.pipesCount;l.pipes=null,l.pipesCount=0,l.flowing=!1;for(var L=0;L<w;L++)a[L].emit("unpipe",this,{hasUnpiped:!1});return this}var K=Q(l.pipes,b);return K===-1?this:(l.pipes.splice(K,1),l.pipesCount-=1,l.pipesCount===1&&(l.pipes=l.pipes[0]),b.emit("unpipe",this,n),this)},G.prototype.on=function(b,l){var n=i.prototype.on.call(this,b,l),a=this._readableState;return b==="data"?(a.readableListening=this.listenerCount("readable")>0,a.flowing!==!1&&this.resume()):b==="readable"&&!a.endEmitted&&!a.readableListening&&(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,d("on readable",a.length,a.reading),a.length?D(this):a.reading||p.nextTick(M,this)),n},G.prototype.addListener=G.prototype.on,G.prototype.removeListener=function(b,l){var n=i.prototype.removeListener.call(this,b,l);return b==="readable"&&p.nextTick(F,this),n},G.prototype.removeAllListeners=function(b){var l=i.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&p.nextTick(F,this),l};function F(b){var l=b._readableState;l.readableListening=b.listenerCount("readable")>0,l.resumeScheduled&&!l.paused?l.flowing=!0:b.listenerCount("data")>0&&b.resume()}function M(b){d("readable nexttick read 0"),b.read(0)}G.prototype.resume=function(){var b=this._readableState;return b.flowing||(d("resume"),b.flowing=!b.readableListening,Y(this,b)),b.paused=!1,this};function Y(b,l){l.resumeScheduled||(l.resumeScheduled=!0,p.nextTick(te,b,l))}function te(b,l){d("resume",l.reading),l.reading||b.read(0),l.resumeScheduled=!1,b.emit("resume"),O(b),l.flowing&&!l.reading&&b.read(0)}G.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function O(b){var l=b._readableState;for(d("flow",l.flowing);l.flowing&&b.read()!==null;);}G.prototype.wrap=function(b){var l=this,n=this._readableState,a=!1;b.on("end",function(){if(d("wrapped end"),n.decoder&&!n.ended){var K=n.decoder.end();K&&K.length&&l.push(K)}l.push(null)}),b.on("data",function(K){if(d("wrapped data"),n.decoder&&(K=n.decoder.write(K)),!(n.objectMode&&K==null)&&!(!n.objectMode&&(!K||!K.length))){var J=l.push(K);J||(a=!0,b.pause())}});for(var w in b)this[w]===void 0&&typeof b[w]=="function"&&(this[w]=function(J){return function(){return b[J].apply(b,arguments)}}(w));for(var L=0;L<ne.length;L++)b.on(ne[L],this.emit.bind(this,ne[L]));return this._read=function(K){d("wrapped _read",K),a&&(a=!1,b.resume())},this},typeof Symbol=="function"&&(G.prototype[Symbol.asyncIterator]=function(){return S===void 0&&(S=y("./internal/streams/async_iterator")),S(this)}),Object.defineProperty(G.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(G.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(G.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(l){this._readableState&&(this._readableState.flowing=l)}}),G._fromList=I,Object.defineProperty(G.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function I(b,l){if(l.length===0)return null;var n;return l.objectMode?n=l.buffer.shift():!b||b>=l.length?(l.decoder?n=l.buffer.join(""):l.buffer.length===1?n=l.buffer.first():n=l.buffer.concat(l.length),l.buffer.clear()):n=l.buffer.consume(b,l.decoder),n}function N(b){var l=b._readableState;d("endReadable",l.endEmitted),l.endEmitted||(l.ended=!0,p.nextTick(q,l,b))}function q(b,l){if(d("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,l.readable=!1,l.emit("end"),b.autoDestroy)){var n=l._writableState;(!n||n.autoDestroy&&n.finished)&&l.destroy()}}typeof Symbol=="function"&&(G.from=function(b,l){return V===void 0&&(V=y("./internal/streams/from")),V(G,b,l)});function Q(b,l){for(var n=0,a=b.length;n<a;n++)if(b[n]===l)return n;return-1}}).call(this)}).call(this,y("_process"),typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":58,"./_stream_duplex":59,"./internal/streams/async_iterator":64,"./internal/streams/buffer_list":65,"./internal/streams/destroy":66,"./internal/streams/from":68,"./internal/streams/state":70,"./internal/streams/stream":71,_process:85,buffer:3,events:4,inherits:24,"string_decoder/":78,util:2}],62:[function(y,k,x){"use strict";k.exports=e;var p=y("../errors").codes,c=p.ERR_METHOD_NOT_IMPLEMENTED,m=p.ERR_MULTIPLE_CALLBACK,h=p.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=p.ERR_TRANSFORM_WITH_LENGTH_0,i=y("./_stream_duplex");y("inherits")(e,i);function r(u,d){var g=this._transformState;g.transforming=!1;var _=g.writecb;if(_===null)return this.emit("error",new m);g.writechunk=null,g.writecb=null,d!=null&&this.push(d),_(u);var f=this._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&this._read(f.highWaterMark)}function e(u){if(!(this instanceof e))return new e(u);i.call(this,u),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,u&&(typeof u.transform=="function"&&(this._transform=u.transform),typeof u.flush=="function"&&(this._flush=u.flush)),this.on("prefinish",t)}function t(){var u=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(d,g){o(u,d,g)}):o(this,null,null)}e.prototype.push=function(u,d){return this._transformState.needTransform=!1,i.prototype.push.call(this,u,d)},e.prototype._transform=function(u,d,g){g(new c("_transform()"))},e.prototype._write=function(u,d,g){var _=this._transformState;if(_.writecb=g,_.writechunk=u,_.writeencoding=d,!_.transforming){var f=this._readableState;(_.needTransform||f.needReadable||f.length<f.highWaterMark)&&this._read(f.highWaterMark)}},e.prototype._read=function(u){var d=this._transformState;d.writechunk!==null&&!d.transforming?(d.transforming=!0,this._transform(d.writechunk,d.writeencoding,d.afterTransform)):d.needTransform=!0},e.prototype._destroy=function(u,d){i.prototype._destroy.call(this,u,function(g){d(g)})};function o(u,d,g){if(d)return u.emit("error",d);if(g!=null&&u.push(g),u._writableState.length)throw new s;if(u._transformState.transforming)throw new h;return u.push(null)}},{"../errors":58,"./_stream_duplex":59,inherits:24}],63:[function(y,k,x){(function(p,c){(function(){"use strict";k.exports=ie;function m(O,I,N){this.chunk=O,this.encoding=I,this.callback=N,this.next=null}function h(O){var I=this;this.next=null,this.entry=null,this.finish=function(){te(I,O)}}var s;ie.WritableState=ne;var i={deprecate:y("util-deprecate")},r=y("./internal/streams/stream"),e=y("buffer").Buffer,t=c.Uint8Array||function(){};function o(O){return e.from(O)}function u(O){return e.isBuffer(O)||O instanceof t}var d=y("./internal/streams/destroy"),g=y("./internal/streams/state"),_=g.getHighWaterMark,f=y("../errors").codes,v=f.ERR_INVALID_ARG_TYPE,R=f.ERR_METHOD_NOT_IMPLEMENTED,A=f.ERR_MULTIPLE_CALLBACK,W=f.ERR_STREAM_CANNOT_PIPE,j=f.ERR_STREAM_DESTROYED,C=f.ERR_STREAM_NULL_VALUES,P=f.ERR_STREAM_WRITE_AFTER_END,S=f.ERR_UNKNOWN_ENCODING,V=d.errorOrDestroy;y("inherits")(ie,r);function B(){}function ne(O,I,N){s=s||y("./_stream_duplex"),O=O||{},typeof N!="boolean"&&(N=I instanceof s),this.objectMode=!!O.objectMode,N&&(this.objectMode=this.objectMode||!!O.writableObjectMode),this.highWaterMark=_(this,O,"writableHighWaterMark",N),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var q=O.decodeStrings===!1;this.decodeStrings=!q,this.defaultEncoding=O.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Q){H(I,Q)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=O.emitClose!==!1,this.autoDestroy=!!O.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new h(this)}ne.prototype.getBuffer=function(){for(var I=this.bufferedRequest,N=[];I;)N.push(I),I=I.next;return N},function(){try{Object.defineProperty(ne.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var se;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(se=Function.prototype[Symbol.hasInstance],Object.defineProperty(ie,Symbol.hasInstance,{value:function(I){return se.call(this,I)?!0:this!==ie?!1:I&&I._writableState instanceof ne}})):se=function(I){return I instanceof this};function ie(O){s=s||y("./_stream_duplex");var I=this instanceof s;if(!I&&!se.call(ie,this))return new ie(O);this._writableState=new ne(O,this,I),this.writable=!0,O&&(typeof O.write=="function"&&(this._write=O.write),typeof O.writev=="function"&&(this._writev=O.writev),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.final=="function"&&(this._final=O.final)),r.call(this)}ie.prototype.pipe=function(){V(this,new W)};function G(O,I){var N=new P;V(O,N),p.nextTick(I,N)}function E(O,I,N,q){var Q;return N===null?Q=new C:typeof N!="string"&&!I.objectMode&&(Q=new v("chunk",["string","Buffer"],N)),Q?(V(O,Q),p.nextTick(q,Q),!1):!0}ie.prototype.write=function(O,I,N){var q=this._writableState,Q=!1,b=!q.objectMode&&u(O);return b&&!e.isBuffer(O)&&(O=o(O)),typeof I=="function"&&(N=I,I=null),b?I="buffer":I||(I=q.defaultEncoding),typeof N!="function"&&(N=B),q.ending?G(this,N):(b||E(this,q,O,N))&&(q.pendingcb++,Q=U(this,q,b,O,I,N)),Q},ie.prototype.cork=function(){this._writableState.corked++},ie.prototype.uncork=function(){var O=this._writableState;O.corked&&(O.corked--,!O.writing&&!O.corked&&!O.bufferProcessing&&O.bufferedRequest&&$(this,O))},ie.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new S(I);return this._writableState.defaultEncoding=I,this},Object.defineProperty(ie.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function T(O,I,N){return!O.objectMode&&O.decodeStrings!==!1&&typeof I=="string"&&(I=e.from(I,N)),I}Object.defineProperty(ie.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function U(O,I,N,q,Q,b){if(!N){var l=T(I,q,Q);q!==l&&(N=!0,Q="buffer",q=l)}var n=I.objectMode?1:q.length;I.length+=n;var a=I.length<I.highWaterMark;if(a||(I.needDrain=!0),I.writing||I.corked){var w=I.lastBufferedRequest;I.lastBufferedRequest={chunk:q,encoding:Q,isBuf:N,callback:b,next:null},w?w.next=I.lastBufferedRequest:I.bufferedRequest=I.lastBufferedRequest,I.bufferedRequestCount+=1}else z(O,I,!1,n,q,Q,b);return a}function z(O,I,N,q,Q,b,l){I.writelen=q,I.writecb=l,I.writing=!0,I.sync=!0,I.destroyed?I.onwrite(new j("write")):N?O._writev(Q,I.onwrite):O._write(Q,b,I.onwrite),I.sync=!1}function re(O,I,N,q,Q){--I.pendingcb,N?(p.nextTick(Q,q),p.nextTick(M,O,I),O._writableState.errorEmitted=!0,V(O,q)):(Q(q),O._writableState.errorEmitted=!0,V(O,q),M(O,I))}function ee(O){O.writing=!1,O.writecb=null,O.length-=O.writelen,O.writelen=0}function H(O,I){var N=O._writableState,q=N.sync,Q=N.writecb;if(typeof Q!="function")throw new A;if(ee(N),I)re(O,N,q,I,Q);else{var b=oe(N)||O.destroyed;!b&&!N.corked&&!N.bufferProcessing&&N.bufferedRequest&&$(O,N),q?p.nextTick(D,O,N,b,Q):D(O,N,b,Q)}}function D(O,I,N,q){N||X(O,I),I.pendingcb--,q(),M(O,I)}function X(O,I){I.length===0&&I.needDrain&&(I.needDrain=!1,O.emit("drain"))}function $(O,I){I.bufferProcessing=!0;var N=I.bufferedRequest;if(O._writev&&N&&N.next){var q=I.bufferedRequestCount,Q=new Array(q),b=I.corkedRequestsFree;b.entry=N;for(var l=0,n=!0;N;)Q[l]=N,N.isBuf||(n=!1),N=N.next,l+=1;Q.allBuffers=n,z(O,I,!0,I.length,Q,"",b.finish),I.pendingcb++,I.lastBufferedRequest=null,b.next?(I.corkedRequestsFree=b.next,b.next=null):I.corkedRequestsFree=new h(I),I.bufferedRequestCount=0}else{for(;N;){var a=N.chunk,w=N.encoding,L=N.callback,K=I.objectMode?1:a.length;if(z(O,I,!1,K,a,w,L),N=N.next,I.bufferedRequestCount--,I.writing)break}N===null&&(I.lastBufferedRequest=null)}I.bufferedRequest=N,I.bufferProcessing=!1}ie.prototype._write=function(O,I,N){N(new R("_write()"))},ie.prototype._writev=null,ie.prototype.end=function(O,I,N){var q=this._writableState;return typeof O=="function"?(N=O,O=null,I=null):typeof I=="function"&&(N=I,I=null),O!=null&&this.write(O,I),q.corked&&(q.corked=1,this.uncork()),q.ending||Y(this,q,N),this},Object.defineProperty(ie.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function oe(O){return O.ending&&O.length===0&&O.bufferedRequest===null&&!O.finished&&!O.writing}function Z(O,I){O._final(function(N){I.pendingcb--,N&&V(O,N),I.prefinished=!0,O.emit("prefinish"),M(O,I)})}function F(O,I){!I.prefinished&&!I.finalCalled&&(typeof O._final=="function"&&!I.destroyed?(I.pendingcb++,I.finalCalled=!0,p.nextTick(Z,O,I)):(I.prefinished=!0,O.emit("prefinish")))}function M(O,I){var N=oe(I);if(N&&(F(O,I),I.pendingcb===0&&(I.finished=!0,O.emit("finish"),I.autoDestroy))){var q=O._readableState;(!q||q.autoDestroy&&q.endEmitted)&&O.destroy()}return N}function Y(O,I,N){I.ending=!0,M(O,I),N&&(I.finished?p.nextTick(N):O.once("finish",N)),I.ended=!0,O.writable=!1}function te(O,I,N){var q=O.entry;for(O.entry=null;q;){var Q=q.callback;I.pendingcb--,Q(N),q=q.next}I.corkedRequestsFree.next=O}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(I){this._writableState&&(this._writableState.destroyed=I)}}),ie.prototype.destroy=d.destroy,ie.prototype._undestroy=d.undestroy,ie.prototype._destroy=function(O,I){I(O)}}).call(this)}).call(this,y("_process"),typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":58,"./_stream_duplex":59,"./internal/streams/destroy":66,"./internal/streams/state":70,"./internal/streams/stream":71,_process:85,buffer:3,inherits:24,"util-deprecate":79}],64:[function(y,k,x){(function(p){(function(){"use strict";var c;function m(W,j,C){return j in W?Object.defineProperty(W,j,{value:C,enumerable:!0,configurable:!0,writable:!0}):W[j]=C,W}var h=y("./end-of-stream"),s=Symbol("lastResolve"),i=Symbol("lastReject"),r=Symbol("error"),e=Symbol("ended"),t=Symbol("lastPromise"),o=Symbol("handlePromise"),u=Symbol("stream");function d(W,j){return{value:W,done:j}}function g(W){var j=W[s];if(j!==null){var C=W[u].read();C!==null&&(W[t]=null,W[s]=null,W[i]=null,j(d(C,!1)))}}function _(W){p.nextTick(g,W)}function f(W,j){return function(C,P){W.then(function(){if(j[e]){C(d(void 0,!0));return}j[o](C,P)},P)}}var v=Object.getPrototypeOf(function(){}),R=Object.setPrototypeOf((c={get stream(){return this[u]},next:function(){var j=this,C=this[r];if(C!==null)return Promise.reject(C);if(this[e])return Promise.resolve(d(void 0,!0));if(this[u].destroyed)return new Promise(function(B,ne){p.nextTick(function(){j[r]?ne(j[r]):B(d(void 0,!0))})});var P=this[t],S;if(P)S=new Promise(f(P,this));else{var V=this[u].read();if(V!==null)return Promise.resolve(d(V,!1));S=new Promise(this[o])}return this[t]=S,S}},m(c,Symbol.asyncIterator,function(){return this}),m(c,"return",function(){var j=this;return new Promise(function(C,P){j[u].destroy(null,function(S){if(S){P(S);return}C(d(void 0,!0))})})}),c),v),A=function(j){var C,P=Object.create(R,(C={},m(C,u,{value:j,writable:!0}),m(C,s,{value:null,writable:!0}),m(C,i,{value:null,writable:!0}),m(C,r,{value:null,writable:!0}),m(C,e,{value:j._readableState.endEmitted,writable:!0}),m(C,o,{value:function(V,B){var ne=P[u].read();ne?(P[t]=null,P[s]=null,P[i]=null,V(d(ne,!1))):(P[s]=V,P[i]=B)},writable:!0}),C));return P[t]=null,h(j,function(S){if(S&&S.code!=="ERR_STREAM_PREMATURE_CLOSE"){var V=P[i];V!==null&&(P[t]=null,P[s]=null,P[i]=null,V(S)),P[r]=S;return}var B=P[s];B!==null&&(P[t]=null,P[s]=null,P[i]=null,B(d(void 0,!0))),P[e]=!0}),j.on("readable",_.bind(null,P)),P};k.exports=A}).call(this)}).call(this,y("_process"))},{"./end-of-stream":67,_process:85}],65:[function(y,k,x){"use strict";function p(g,_){var f=Object.keys(g);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(g);_&&(v=v.filter(function(R){return Object.getOwnPropertyDescriptor(g,R).enumerable})),f.push.apply(f,v)}return f}function c(g){for(var _=1;_<arguments.length;_++){var f=arguments[_]!=null?arguments[_]:{};_%2?p(Object(f),!0).forEach(function(v){m(g,v,f[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(f)):p(Object(f)).forEach(function(v){Object.defineProperty(g,v,Object.getOwnPropertyDescriptor(f,v))})}return g}function m(g,_,f){return _ in g?Object.defineProperty(g,_,{value:f,enumerable:!0,configurable:!0,writable:!0}):g[_]=f,g}function h(g,_){if(!(g instanceof _))throw new TypeError("Cannot call a class as a function")}function s(g,_){for(var f=0;f<_.length;f++){var v=_[f];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(g,v.key,v)}}function i(g,_,f){return _&&s(g.prototype,_),f&&s(g,f),g}var r=y("buffer"),e=r.Buffer,t=y("util"),o=t.inspect,u=o&&o.custom||"inspect";function d(g,_,f){e.prototype.copy.call(g,_,f)}k.exports=function(){function g(){h(this,g),this.head=null,this.tail=null,this.length=0}return i(g,[{key:"push",value:function(f){var v={data:f,next:null};this.length>0?this.tail.next=v:this.head=v,this.tail=v,++this.length}},{key:"unshift",value:function(f){var v={data:f,next:this.head};this.length===0&&(this.tail=v),this.head=v,++this.length}},{key:"shift",value:function(){if(this.length!==0){var f=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,f}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(f){if(this.length===0)return"";for(var v=this.head,R=""+v.data;v=v.next;)R+=f+v.data;return R}},{key:"concat",value:function(f){if(this.length===0)return e.alloc(0);for(var v=e.allocUnsafe(f>>>0),R=this.head,A=0;R;)d(R.data,v,A),A+=R.data.length,R=R.next;return v}},{key:"consume",value:function(f,v){var R;return f<this.head.data.length?(R=this.head.data.slice(0,f),this.head.data=this.head.data.slice(f)):f===this.head.data.length?R=this.shift():R=v?this._getString(f):this._getBuffer(f),R}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(f){var v=this.head,R=1,A=v.data;for(f-=A.length;v=v.next;){var W=v.data,j=f>W.length?W.length:f;if(j===W.length?A+=W:A+=W.slice(0,f),f-=j,f===0){j===W.length?(++R,v.next?this.head=v.next:this.head=this.tail=null):(this.head=v,v.data=W.slice(j));break}++R}return this.length-=R,A}},{key:"_getBuffer",value:function(f){var v=e.allocUnsafe(f),R=this.head,A=1;for(R.data.copy(v),f-=R.data.length;R=R.next;){var W=R.data,j=f>W.length?W.length:f;if(W.copy(v,v.length-f,0,j),f-=j,f===0){j===W.length?(++A,R.next?this.head=R.next:this.head=this.tail=null):(this.head=R,R.data=W.slice(j));break}++A}return this.length-=A,v}},{key:u,value:function(f,v){return o(this,c({},v,{depth:0,customInspect:!1}))}}]),g}()},{buffer:3,util:2}],66:[function(y,k,x){(function(p){(function(){"use strict";function c(e,t){var o=this,u=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return u||d?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.nextTick(i,this,e)):p.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(g){!t&&g?o._writableState?o._writableState.errorEmitted?p.nextTick(h,o):(o._writableState.errorEmitted=!0,p.nextTick(m,o,g)):p.nextTick(m,o,g):t?(p.nextTick(h,o),t(g)):p.nextTick(h,o)}),this)}function m(e,t){i(e,t),h(e)}function h(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function s(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function i(e,t){e.emit("error",t)}function r(e,t){var o=e._readableState,u=e._writableState;o&&o.autoDestroy||u&&u.autoDestroy?e.destroy(t):e.emit("error",t)}k.exports={destroy:c,undestroy:s,errorOrDestroy:r}}).call(this)}).call(this,y("_process"))},{_process:85}],67:[function(y,k,x){"use strict";var p=y("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function c(i){var r=!1;return function(){if(!r){r=!0;for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];i.apply(this,t)}}}function m(){}function h(i){return i.setHeader&&typeof i.abort=="function"}function s(i,r,e){if(typeof r=="function")return s(i,null,r);r||(r={}),e=c(e||m);var t=r.readable||r.readable!==!1&&i.readable,o=r.writable||r.writable!==!1&&i.writable,u=function(){i.writable||g()},d=i._writableState&&i._writableState.finished,g=function(){o=!1,d=!0,t||e.call(i)},_=i._readableState&&i._readableState.endEmitted,f=function(){t=!1,_=!0,o||e.call(i)},v=function(j){e.call(i,j)},R=function(){var j;if(t&&!_)return(!i._readableState||!i._readableState.ended)&&(j=new p),e.call(i,j);if(o&&!d)return(!i._writableState||!i._writableState.ended)&&(j=new p),e.call(i,j)},A=function(){i.req.on("finish",g)};return h(i)?(i.on("complete",g),i.on("abort",R),i.req?A():i.on("request",A)):o&&!i._writableState&&(i.on("end",u),i.on("close",u)),i.on("end",f),i.on("finish",g),r.error!==!1&&i.on("error",v),i.on("close",R),function(){i.removeListener("complete",g),i.removeListener("abort",R),i.removeListener("request",A),i.req&&i.req.removeListener("finish",g),i.removeListener("end",u),i.removeListener("close",u),i.removeListener("finish",g),i.removeListener("end",f),i.removeListener("error",v),i.removeListener("close",R)}}k.exports=s},{"../../../errors":58}],68:[function(y,k,x){k.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],69:[function(y,k,x){"use strict";var p;function c(g){var _=!1;return function(){_||(_=!0,g.apply(void 0,arguments))}}var m=y("../../../errors").codes,h=m.ERR_MISSING_ARGS,s=m.ERR_STREAM_DESTROYED;function i(g){if(g)throw g}function r(g){return g.setHeader&&typeof g.abort=="function"}function e(g,_,f,v){v=c(v);var R=!1;g.on("close",function(){R=!0}),p===void 0&&(p=y("./end-of-stream")),p(g,{readable:_,writable:f},function(W){if(W)return v(W);R=!0,v()});var A=!1;return function(W){if(!R&&!A){if(A=!0,r(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();v(W||new s("pipe"))}}}function t(g){g()}function o(g,_){return g.pipe(_)}function u(g){return!g.length||typeof g[g.length-1]!="function"?i:g.pop()}function d(){for(var g=arguments.length,_=new Array(g),f=0;f<g;f++)_[f]=arguments[f];var v=u(_);if(Array.isArray(_[0])&&(_=_[0]),_.length<2)throw new h("streams");var R,A=_.map(function(W,j){var C=j<_.length-1,P=j>0;return e(W,C,P,function(S){R||(R=S),S&&A.forEach(t),!C&&(A.forEach(t),v(R))})});return _.reduce(o)}k.exports=d},{"../../../errors":58,"./end-of-stream":67}],70:[function(y,k,x){"use strict";var p=y("../../../errors").codes.ERR_INVALID_OPT_VALUE;function c(h,s,i){return h.highWaterMark!=null?h.highWaterMark:s?h[i]:null}function m(h,s,i,r){var e=c(s,r,i);if(e!=null){if(!(isFinite(e)&&Math.floor(e)===e)||e<0){var t=r?i:"highWaterMark";throw new p(t,e)}return Math.floor(e)}return h.objectMode?16:16*1024}k.exports={getHighWaterMark:m}},{"../../../errors":58}],71:[function(y,k,x){k.exports=y("events").EventEmitter},{events:4}],72:[function(y,k,x){x=k.exports=y("./lib/_stream_readable.js"),x.Stream=x,x.Readable=x,x.Writable=y("./lib/_stream_writable.js"),x.Duplex=y("./lib/_stream_duplex.js"),x.Transform=y("./lib/_stream_transform.js"),x.PassThrough=y("./lib/_stream_passthrough.js"),x.finished=y("./lib/internal/streams/end-of-stream.js"),x.pipeline=y("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":59,"./lib/_stream_passthrough.js":60,"./lib/_stream_readable.js":61,"./lib/_stream_transform.js":62,"./lib/_stream_writable.js":63,"./lib/internal/streams/end-of-stream.js":67,"./lib/internal/streams/pipeline.js":69}],73:[function(y,k,x){"use strict";function p(m,h,s){var i=this;this._callback=m,this._args=s,this._interval=setInterval(m,h,this._args),this.reschedule=function(r){r||(r=i._interval),i._interval&&clearInterval(i._interval),i._interval=setInterval(i._callback,r,i._args)},this.clear=function(){i._interval&&(clearInterval(i._interval),i._interval=void 0)},this.destroy=function(){i._interval&&clearInterval(i._interval),i._callback=void 0,i._interval=void 0,i._args=void 0}}function c(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var m;if(arguments.length>0){m=new Array(arguments.length-2);for(var h=0;h<m.length;h++)m[h]=arguments[h+2]}return new p(arguments[0],arguments[1],m)}k.exports=c},{}],74:[function(y,k,x){"use strict";k.exports=y("./index.js")()},{"./index.js":75}],75:[function(y,k,x){(function(p){(function(){"use strict";k.exports=m;function c(s){return s instanceof p?p.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function m(s){if(s=s||{},s.circles)return h(s);return s.proto?e:r;function i(t,o){for(var u=Object.keys(t),d=new Array(u.length),g=0;g<u.length;g++){var _=u[g],f=t[_];typeof f!="object"||f===null?d[_]=f:f instanceof Date?d[_]=new Date(f):ArrayBuffer.isView(f)?d[_]=c(f):d[_]=o(f)}return d}function r(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,r);if(t instanceof Map)return new Map(i(Array.from(t),r));if(t instanceof Set)return new Set(i(Array.from(t),r));var o={};for(var u in t)if(Object.hasOwnProperty.call(t,u)!==!1){var d=t[u];typeof d!="object"||d===null?o[u]=d:d instanceof Date?o[u]=new Date(d):d instanceof Map?o[u]=new Map(i(Array.from(d),r)):d instanceof Set?o[u]=new Set(i(Array.from(d),r)):ArrayBuffer.isView(d)?o[u]=c(d):o[u]=r(d)}return o}function e(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,e);if(t instanceof Map)return new Map(i(Array.from(t),e));if(t instanceof Set)return new Set(i(Array.from(t),e));var o={};for(var u in t){var d=t[u];typeof d!="object"||d===null?o[u]=d:d instanceof Date?o[u]=new Date(d):d instanceof Map?o[u]=new Map(i(Array.from(d),e)):d instanceof Set?o[u]=new Set(i(Array.from(d),e)):ArrayBuffer.isView(d)?o[u]=c(d):o[u]=e(d)}return o}}function h(s){var i=[],r=[];return s.proto?o:t;function e(u,d){for(var g=Object.keys(u),_=new Array(g.length),f=0;f<g.length;f++){var v=g[f],R=u[v];if(typeof R!="object"||R===null)_[v]=R;else if(R instanceof Date)_[v]=new Date(R);else if(ArrayBuffer.isView(R))_[v]=c(R);else{var A=i.indexOf(R);A!==-1?_[v]=r[A]:_[v]=d(R)}}return _}function t(u){if(typeof u!="object"||u===null)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return e(u,t);if(u instanceof Map)return new Map(e(Array.from(u),t));if(u instanceof Set)return new Set(e(Array.from(u),t));var d={};i.push(u),r.push(d);for(var g in u)if(Object.hasOwnProperty.call(u,g)!==!1){var _=u[g];if(typeof _!="object"||_===null)d[g]=_;else if(_ instanceof Date)d[g]=new Date(_);else if(_ instanceof Map)d[g]=new Map(e(Array.from(_),t));else if(_ instanceof Set)d[g]=new Set(e(Array.from(_),t));else if(ArrayBuffer.isView(_))d[g]=c(_);else{var f=i.indexOf(_);f!==-1?d[g]=r[f]:d[g]=t(_)}}return i.pop(),r.pop(),d}function o(u){if(typeof u!="object"||u===null)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return e(u,o);if(u instanceof Map)return new Map(e(Array.from(u),o));if(u instanceof Set)return new Set(e(Array.from(u),o));var d={};i.push(u),r.push(d);for(var g in u){var _=u[g];if(typeof _!="object"||_===null)d[g]=_;else if(_ instanceof Date)d[g]=new Date(_);else if(_ instanceof Map)d[g]=new Map(e(Array.from(_),o));else if(_ instanceof Set)d[g]=new Set(e(Array.from(_),o));else if(ArrayBuffer.isView(_))d[g]=c(_);else{var f=i.indexOf(_);f!==-1?d[g]=r[f]:d[g]=o(_)}}return i.pop(),r.pop(),d}}}).call(this)}).call(this,y("buffer").Buffer)},{buffer:3}],76:[function(y,k,x){var p=y("buffer"),c=p.Buffer;function m(s,i){for(var r in s)i[r]=s[r]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?k.exports=p:(m(p,x),x.Buffer=h);function h(s,i,r){return c(s,i,r)}h.prototype=Object.create(c.prototype),m(c,h),h.from=function(s,i,r){if(typeof s=="number")throw new TypeError("Argument must not be a number");return c(s,i,r)},h.alloc=function(s,i,r){if(typeof s!="number")throw new TypeError("Argument must be a number");var e=c(s);return i!==void 0?typeof r=="string"?e.fill(i,r):e.fill(i):e.fill(0),e},h.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return c(s)},h.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return p.SlowBuffer(s)}},{buffer:3}],77:[function(y,k,x){k.exports=p;function p(m){var h=m._readableState;return h?h.objectMode||typeof m._duplexState=="number"?m.read():m.read(c(h)):null}function c(m){return m.buffer.length?m.buffer.head?m.buffer.head.data.length:m.buffer[0].length:m.length}},{}],78:[function(y,k,x){"use strict";var p=y("safe-buffer").Buffer,c=p.isEncoding||function(A){switch(A=""+A,A&&A.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function m(A){if(!A)return"utf8";for(var W;;)switch(A){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return A;default:if(W)return;A=(""+A).toLowerCase(),W=!0}}function h(A){var W=m(A);if(typeof W!="string"&&(p.isEncoding===c||!c(A)))throw new Error("Unknown encoding: "+A);return W||A}x.StringDecoder=s;function s(A){this.encoding=h(A);var W;switch(this.encoding){case"utf16le":this.text=d,this.end=g,W=4;break;case"utf8":this.fillLast=t,W=4;break;case"base64":this.text=_,this.end=f,W=3;break;default:this.write=v,this.end=R;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=p.allocUnsafe(W)}s.prototype.write=function(A){if(A.length===0)return"";var W,j;if(this.lastNeed){if(W=this.fillLast(A),W===void 0)return"";j=this.lastNeed,this.lastNeed=0}else j=0;return j<A.length?W?W+this.text(A,j):this.text(A,j):W||""},s.prototype.end=u,s.prototype.text=o,s.prototype.fillLast=function(A){if(this.lastNeed<=A.length)return A.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);A.copy(this.lastChar,this.lastTotal-this.lastNeed,0,A.length),this.lastNeed-=A.length};function i(A){return A<=127?0:A>>5===6?2:A>>4===14?3:A>>3===30?4:A>>6===2?-1:-2}function r(A,W,j){var C=W.length-1;if(C<j)return 0;var P=i(W[C]);return P>=0?(P>0&&(A.lastNeed=P-1),P):--C<j||P===-2?0:(P=i(W[C]),P>=0?(P>0&&(A.lastNeed=P-2),P):--C<j||P===-2?0:(P=i(W[C]),P>=0?(P>0&&(P===2?P=0:A.lastNeed=P-3),P):0))}function e(A,W,j){if((W[0]&192)!==128)return A.lastNeed=0,"\uFFFD";if(A.lastNeed>1&&W.length>1){if((W[1]&192)!==128)return A.lastNeed=1,"\uFFFD";if(A.lastNeed>2&&W.length>2&&(W[2]&192)!==128)return A.lastNeed=2,"\uFFFD"}}function t(A){var W=this.lastTotal-this.lastNeed,j=e(this,A,W);if(j!==void 0)return j;if(this.lastNeed<=A.length)return A.copy(this.lastChar,W,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);A.copy(this.lastChar,W,0,A.length),this.lastNeed-=A.length}function o(A,W){var j=r(this,A,W);if(!this.lastNeed)return A.toString("utf8",W);this.lastTotal=j;var C=A.length-(j-this.lastNeed);return A.copy(this.lastChar,0,C),A.toString("utf8",W,C)}function u(A){var W=A&&A.length?this.write(A):"";return this.lastNeed?W+"\uFFFD":W}function d(A,W){if((A.length-W)%2===0){var j=A.toString("utf16le",W);if(j){var C=j.charCodeAt(j.length-1);if(C>=55296&&C<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=A[A.length-2],this.lastChar[1]=A[A.length-1],j.slice(0,-1)}return j}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=A[A.length-1],A.toString("utf16le",W,A.length-1)}function g(A){var W=A&&A.length?this.write(A):"";if(this.lastNeed){var j=this.lastTotal-this.lastNeed;return W+this.lastChar.toString("utf16le",0,j)}return W}function _(A,W){var j=(A.length-W)%3;return j===0?A.toString("base64",W):(this.lastNeed=3-j,this.lastTotal=3,j===1?this.lastChar[0]=A[A.length-1]:(this.lastChar[0]=A[A.length-2],this.lastChar[1]=A[A.length-1]),A.toString("base64",W,A.length-j))}function f(A){var W=A&&A.length?this.write(A):"";return this.lastNeed?W+this.lastChar.toString("base64",0,3-this.lastNeed):W}function v(A){return A.toString(this.encoding)}function R(A){return A&&A.length?this.write(A):""}},{"safe-buffer":76}],79:[function(y,k,x){(function(p){(function(){k.exports=c;function c(h,s){if(m("noDeprecation"))return h;var i=!1;function r(){if(!i){if(m("throwDeprecation"))throw new Error(s);m("traceDeprecation")?console.trace(s):console.warn(s),i=!0}return h.apply(this,arguments)}return r}function m(h){try{if(!p.localStorage)return!1}catch{return!1}var s=p.localStorage[h];return s==null?!1:String(s).toLowerCase()==="true"}}).call(this)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],80:[function(y,k,x){k.exports=p;function p(c,m){if(c&&m)return p(c)(m);if(typeof c!="function")throw new TypeError("need wrapper function");return Object.keys(c).forEach(function(s){h[s]=c[s]}),h;function h(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];var r=c.apply(this,s),e=s[s.length-1];return typeof r=="function"&&r!==e&&Object.keys(e).forEach(function(t){r[t]=e[t]}),r}}},{}],81:[function(y,k,x){"use strict";k.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],82:[function(y,k,x){k.exports=c;var p=Object.prototype.hasOwnProperty;function c(){for(var m={},h=0;h<arguments.length;h++){var s=arguments[h];for(var i in s)p.call(s,i)&&(m[i]=s[i])}return m}},{}],83:[function(y,k,x){"use strict";k.exports=function(p){p.prototype[Symbol.iterator]=function*(){for(let c=this.head;c;c=c.next)yield c.value}}},{}],84:[function(y,k,x){"use strict";k.exports=p,p.Node=s,p.create=p;function p(i){var r=this;if(r instanceof p||(r=new p),r.tail=null,r.head=null,r.length=0,i&&typeof i.forEach=="function")i.forEach(function(o){r.push(o)});else if(arguments.length>0)for(var e=0,t=arguments.length;e<t;e++)r.push(arguments[e]);return r}p.prototype.removeNode=function(i){if(i.list!==this)throw new Error("removing node which does not belong to this list");var r=i.next,e=i.prev;return r&&(r.prev=e),e&&(e.next=r),i===this.head&&(this.head=r),i===this.tail&&(this.tail=e),i.list.length--,i.next=null,i.prev=null,i.list=null,r},p.prototype.unshiftNode=function(i){if(i!==this.head){i.list&&i.list.removeNode(i);var r=this.head;i.list=this,i.next=r,r&&(r.prev=i),this.head=i,this.tail||(this.tail=i),this.length++}},p.prototype.pushNode=function(i){if(i!==this.tail){i.list&&i.list.removeNode(i);var r=this.tail;i.list=this,i.prev=r,r&&(r.next=i),this.tail=i,this.head||(this.head=i),this.length++}},p.prototype.push=function(){for(var i=0,r=arguments.length;i<r;i++)m(this,arguments[i]);return this.length},p.prototype.unshift=function(){for(var i=0,r=arguments.length;i<r;i++)h(this,arguments[i]);return this.length},p.prototype.pop=function(){if(this.tail){var i=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,i}},p.prototype.shift=function(){if(this.head){var i=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,i}},p.prototype.forEach=function(i,r){r=r||this;for(var e=this.head,t=0;e!==null;t++)i.call(r,e.value,t,this),e=e.next},p.prototype.forEachReverse=function(i,r){r=r||this;for(var e=this.tail,t=this.length-1;e!==null;t--)i.call(r,e.value,t,this),e=e.prev},p.prototype.get=function(i){for(var r=0,e=this.head;e!==null&&r<i;r++)e=e.next;if(r===i&&e!==null)return e.value},p.prototype.getReverse=function(i){for(var r=0,e=this.tail;e!==null&&r<i;r++)e=e.prev;if(r===i&&e!==null)return e.value},p.prototype.map=function(i,r){r=r||this;for(var e=new p,t=this.head;t!==null;)e.push(i.call(r,t.value,this)),t=t.next;return e},p.prototype.mapReverse=function(i,r){r=r||this;for(var e=new p,t=this.tail;t!==null;)e.push(i.call(r,t.value,this)),t=t.prev;return e},p.prototype.reduce=function(i,r){var e,t=this.head;if(arguments.length>1)e=r;else if(this.head)t=this.head.next,e=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;t!==null;o++)e=i(e,t.value,o),t=t.next;return e},p.prototype.reduceReverse=function(i,r){var e,t=this.tail;if(arguments.length>1)e=r;else if(this.tail)t=this.tail.prev,e=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;t!==null;o--)e=i(e,t.value,o),t=t.prev;return e},p.prototype.toArray=function(){for(var i=new Array(this.length),r=0,e=this.head;e!==null;r++)i[r]=e.value,e=e.next;return i},p.prototype.toArrayReverse=function(){for(var i=new Array(this.length),r=0,e=this.tail;e!==null;r++)i[r]=e.value,e=e.prev;return i},p.prototype.slice=function(i,r){r=r||this.length,r<0&&(r+=this.length),i=i||0,i<0&&(i+=this.length);var e=new p;if(r<i||r<0)return e;i<0&&(i=0),r>this.length&&(r=this.length);for(var t=0,o=this.head;o!==null&&t<i;t++)o=o.next;for(;o!==null&&t<r;t++,o=o.next)e.push(o.value);return e},p.prototype.sliceReverse=function(i,r){r=r||this.length,r<0&&(r+=this.length),i=i||0,i<0&&(i+=this.length);var e=new p;if(r<i||r<0)return e;i<0&&(i=0),r>this.length&&(r=this.length);for(var t=this.length,o=this.tail;o!==null&&t>r;t--)o=o.prev;for(;o!==null&&t>i;t--,o=o.prev)e.push(o.value);return e},p.prototype.splice=function(i,r,...e){i>this.length&&(i=this.length-1),i<0&&(i=this.length+i);for(var t=0,o=this.head;o!==null&&t<i;t++)o=o.next;for(var u=[],t=0;o&&t<r;t++)u.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var t=0;t<e.length;t++)o=c(this,o,e[t]);return u},p.prototype.reverse=function(){for(var i=this.head,r=this.tail,e=i;e!==null;e=e.prev){var t=e.prev;e.prev=e.next,e.next=t}return this.head=r,this.tail=i,this};function c(i,r,e){var t=r===i.head?new s(e,null,r,i):new s(e,r,r.next,i);return t.next===null&&(i.tail=t),t.prev===null&&(i.head=t),i.length++,t}function m(i,r){i.tail=new s(r,i.tail,null,i),i.head||(i.head=i.tail),i.length++}function h(i,r){i.head=new s(r,null,i.head,i),i.tail||(i.tail=i.head),i.length++}function s(i,r,e,t){if(!(this instanceof s))return new s(i,r,e,t);this.list=t,this.value=i,r?(r.next=this,this.prev=r):this.prev=null,e?(e.prev=this,this.next=e):this.next=null}try{y("./iterator.js")(p)}catch{}},{"./iterator.js":83}],85:[function(y,k,x){var p=k.exports={},c,m;function h(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?c=setTimeout:c=h}catch{c=h}try{typeof clearTimeout=="function"?m=clearTimeout:m=s}catch{m=s}})();function i(v){if(c===setTimeout)return setTimeout(v,0);if((c===h||!c)&&setTimeout)return c=setTimeout,setTimeout(v,0);try{return c(v,0)}catch{try{return c.call(null,v,0)}catch{return c.call(this,v,0)}}}function r(v){if(m===clearTimeout)return clearTimeout(v);if((m===s||!m)&&clearTimeout)return m=clearTimeout,clearTimeout(v);try{return m(v)}catch{try{return m.call(null,v)}catch{return m.call(this,v)}}}var e=[],t=!1,o,u=-1;function d(){!t||!o||(t=!1,o.length?e=o.concat(e):u=-1,e.length&&g())}function g(){if(!t){var v=i(d);t=!0;for(var R=e.length;R;){for(o=e,e=[];++u<R;)o&&o[u].run();u=-1,R=e.length}o=null,t=!1,r(v)}}p.nextTick=function(v){var R=new Array(arguments.length-1);if(arguments.length>1)for(var A=1;A<arguments.length;A++)R[A-1]=arguments[A];e.push(new _(v,R)),e.length===1&&!t&&i(g)};function _(v,R){this.fun=v,this.array=R}_.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={};function f(){}p.on=f,p.addListener=f,p.once=f,p.off=f,p.removeListener=f,p.removeAllListeners=f,p.emit=f,p.prependListener=f,p.prependOnceListener=f,p.listeners=function(v){return[]},p.binding=function(v){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(v){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}],86:[function(y,k,x){(function(p){(function(){(function(c){var m=typeof x=="object"&&x&&!x.nodeType&&x,h=typeof k=="object"&&k&&!k.nodeType&&k,s=typeof p=="object"&&p;(s.global===s||s.window===s||s.self===s)&&(c=s);var i,r=2147483647,e=36,t=1,o=26,u=38,d=700,g=72,_=128,f="-",v=/^xn--/,R=/[^\x20-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,W={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},j=e-t,C=Math.floor,P=String.fromCharCode,S;function V(H){throw new RangeError(W[H])}function B(H,D){for(var X=H.length,$=[];X--;)$[X]=D(H[X]);return $}function ne(H,D){var X=H.split("@"),$="";X.length>1&&($=X[0]+"@",H=X[1]),H=H.replace(A,".");var oe=H.split("."),Z=B(oe,D).join(".");return $+Z}function se(H){for(var D=[],X=0,$=H.length,oe,Z;X<$;)oe=H.charCodeAt(X++),oe>=55296&&oe<=56319&&X<$?(Z=H.charCodeAt(X++),(Z&64512)==56320?D.push(((oe&1023)<<10)+(Z&1023)+65536):(D.push(oe),X--)):D.push(oe);return D}function ie(H){return B(H,function(D){var X="";return D>65535&&(D-=65536,X+=P(D>>>10&1023|55296),D=56320|D&1023),X+=P(D),X}).join("")}function G(H){return H-48<10?H-22:H-65<26?H-65:H-97<26?H-97:e}function E(H,D){return H+22+75*(H<26)-((D!=0)<<5)}function T(H,D,X){var $=0;for(H=X?C(H/d):H>>1,H+=C(H/D);H>j*o>>1;$+=e)H=C(H/j);return C($+(j+1)*H/(H+u))}function U(H){var D=[],X=H.length,$,oe=0,Z=_,F=g,M,Y,te,O,I,N,q,Q,b;for(M=H.lastIndexOf(f),M<0&&(M=0),Y=0;Y<M;++Y)H.charCodeAt(Y)>=128&&V("not-basic"),D.push(H.charCodeAt(Y));for(te=M>0?M+1:0;te<X;){for(O=oe,I=1,N=e;te>=X&&V("invalid-input"),q=G(H.charCodeAt(te++)),(q>=e||q>C((r-oe)/I))&&V("overflow"),oe+=q*I,Q=N<=F?t:N>=F+o?o:N-F,!(q<Q);N+=e)b=e-Q,I>C(r/b)&&V("overflow"),I*=b;$=D.length+1,F=T(oe-O,$,O==0),C(oe/$)>r-Z&&V("overflow"),Z+=C(oe/$),oe%=$,D.splice(oe++,0,Z)}return ie(D)}function z(H){var D,X,$,oe,Z,F,M,Y,te,O,I,N=[],q,Q,b,l;for(H=se(H),q=H.length,D=_,X=0,Z=g,F=0;F<q;++F)I=H[F],I<128&&N.push(P(I));for($=oe=N.length,oe&&N.push(f);$<q;){for(M=r,F=0;F<q;++F)I=H[F],I>=D&&I<M&&(M=I);for(Q=$+1,M-D>C((r-X)/Q)&&V("overflow"),X+=(M-D)*Q,D=M,F=0;F<q;++F)if(I=H[F],I<D&&++X>r&&V("overflow"),I==D){for(Y=X,te=e;O=te<=Z?t:te>=Z+o?o:te-Z,!(Y<O);te+=e)l=Y-O,b=e-O,N.push(P(E(O+l%b,0))),Y=C(l/b);N.push(P(E(Y,0))),Z=T(X,Q,$==oe),X=0,++$}++X,++D}return N.join("")}function re(H){return ne(H,function(D){return v.test(D)?U(D.slice(4).toLowerCase()):D})}function ee(H){return ne(H,function(D){return R.test(D)?"xn--"+z(D):D})}if(i={version:"1.4.1",ucs2:{decode:se,encode:ie},decode:U,encode:z,toASCII:ee,toUnicode:re},typeof ae=="function"&&typeof ae.amd=="object"&&ae.amd)ae("punycode",function(){return i});else if(m&&h)if(k.exports==m)h.exports=i;else for(S in i)i.hasOwnProperty(S)&&(m[S]=i[S]);else c.punycode=i})(this)}).call(this)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],87:[function(y,k,x){"use strict";function p(m,h){return Object.prototype.hasOwnProperty.call(m,h)}k.exports=function(m,h,s,i){h=h||"&",s=s||"=";var r={};if(typeof m!="string"||m.length===0)return r;var e=/\+/g;m=m.split(h);var t=1e3;i&&typeof i.maxKeys=="number"&&(t=i.maxKeys);var o=m.length;t>0&&o>t&&(o=t);for(var u=0;u<o;++u){var d=m[u].replace(e,"%20"),g=d.indexOf(s),_,f,v,R;g>=0?(_=d.substr(0,g),f=d.substr(g+1)):(_=d,f=""),v=decodeURIComponent(_),R=decodeURIComponent(f),p(r,v)?c(r[v])?r[v].push(R):r[v]=[r[v],R]:r[v]=R}return r};var c=Array.isArray||function(m){return Object.prototype.toString.call(m)==="[object Array]"}},{}],88:[function(y,k,x){"use strict";var p=function(s){switch(typeof s){case"string":return s;case"boolean":return s?"true":"false";case"number":return isFinite(s)?s:"";default:return""}};k.exports=function(s,i,r,e){return i=i||"&",r=r||"=",s===null&&(s=void 0),typeof s=="object"?m(h(s),function(t){var o=encodeURIComponent(p(t))+r;return c(s[t])?m(s[t],function(u){return o+encodeURIComponent(p(u))}).join(i):o+encodeURIComponent(p(s[t]))}).join(i):e?encodeURIComponent(p(e))+r+encodeURIComponent(p(s)):""};var c=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"};function m(s,i){if(s.map)return s.map(i);for(var r=[],e=0;e<s.length;e++)r.push(i(s[e],e));return r}var h=Object.keys||function(s){var i=[];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&i.push(r);return i}},{}],89:[function(y,k,x){"use strict";x.decode=x.parse=y("./decode"),x.encode=x.stringify=y("./encode")},{"./decode":87,"./encode":88}],90:[function(y,k,x){"use strict";var p=y("punycode"),c=y("./util");x.parse=W,x.resolve=C,x.resolveObject=P,x.format=j,x.Url=m;function m(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var h=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,i=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,r=["<",">",'"',"`"," ","\r",`
  2. `," "],e=["{","}","|","\\","^","`"].concat(r),t=["'"].concat(e),o=["%","/","?",";","#"].concat(t),u=["/","?","#"],d=255,g=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},R={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=y("querystring");function W(S,V,B){if(S&&c.isObject(S)&&S instanceof m)return S;var ne=new m;return ne.parse(S,V,B),ne}m.prototype.parse=function(S,V,B){if(!c.isString(S))throw new TypeError("Parameter 'url' must be a string, not "+typeof S);var ne=S.indexOf("?"),se=ne!==-1&&ne<S.indexOf("#")?"?":"#",ie=S.split(se),G=/\\/g;ie[0]=ie[0].replace(G,"/"),S=ie.join(se);var E=S;if(E=E.trim(),!B&&S.split("#").length===1){var T=i.exec(E);if(T)return this.path=E,this.href=E,this.pathname=T[1],T[2]?(this.search=T[2],V?this.query=A.parse(this.search.substr(1)):this.query=this.search.substr(1)):V&&(this.search="",this.query={}),this}var U=h.exec(E);if(U){U=U[0];var z=U.toLowerCase();this.protocol=z,E=E.substr(U.length)}if(B||U||E.match(/^\/\/[^@\/]+@[^@\/]+/)){var re=E.substr(0,2)==="//";re&&!(U&&v[U])&&(E=E.substr(2),this.slashes=!0)}if(!v[U]&&(re||U&&!R[U])){for(var ee=-1,H=0;H<u.length;H++){var D=E.indexOf(u[H]);D!==-1&&(ee===-1||D<ee)&&(ee=D)}var X,$;ee===-1?$=E.lastIndexOf("@"):$=E.lastIndexOf("@",ee),$!==-1&&(X=E.slice(0,$),E=E.slice($+1),this.auth=decodeURIComponent(X)),ee=-1;for(var H=0;H<o.length;H++){var D=E.indexOf(o[H]);D!==-1&&(ee===-1||D<ee)&&(ee=D)}ee===-1&&(ee=E.length),this.host=E.slice(0,ee),E=E.slice(ee),this.parseHost(),this.hostname=this.hostname||"";var oe=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!oe)for(var Z=this.hostname.split(/\./),H=0,F=Z.length;H<F;H++){var M=Z[H];if(M&&!M.match(g)){for(var Y="",te=0,O=M.length;te<O;te++)M.charCodeAt(te)>127?Y+="x":Y+=M[te];if(!Y.match(g)){var I=Z.slice(0,H),N=Z.slice(H+1),q=M.match(_);q&&(I.push(q[1]),N.unshift(q[2])),N.length&&(E="/"+N.join(".")+E),this.hostname=I.join(".");break}}}this.hostname.length>d?this.hostname="":this.hostname=this.hostname.toLowerCase(),oe||(this.hostname=p.toASCII(this.hostname));var Q=this.port?":"+this.port:"",b=this.hostname||"";this.host=b+Q,this.href+=this.host,oe&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),E[0]!=="/"&&(E="/"+E))}if(!f[z])for(var H=0,F=t.length;H<F;H++){var l=t[H];if(E.indexOf(l)!==-1){var n=encodeURIComponent(l);n===l&&(n=escape(l)),E=E.split(l).join(n)}}var a=E.indexOf("#");a!==-1&&(this.hash=E.substr(a),E=E.slice(0,a));var w=E.indexOf("?");if(w!==-1?(this.search=E.substr(w),this.query=E.substr(w+1),V&&(this.query=A.parse(this.query)),E=E.slice(0,w)):V&&(this.search="",this.query={}),E&&(this.pathname=E),R[z]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Q=this.pathname||"",L=this.search||"";this.path=Q+L}return this.href=this.format(),this};function j(S){return c.isString(S)&&(S=W(S)),S instanceof m?S.format():m.prototype.format.call(S)}m.prototype.format=function(){var S=this.auth||"";S&&(S=encodeURIComponent(S),S=S.replace(/%3A/i,":"),S+="@");var V=this.protocol||"",B=this.pathname||"",ne=this.hash||"",se=!1,ie="";this.host?se=S+this.host:this.hostname&&(se=S+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(se+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(ie=A.stringify(this.query));var G=this.search||ie&&"?"+ie||"";return V&&V.substr(-1)!==":"&&(V+=":"),this.slashes||(!V||R[V])&&se!==!1?(se="//"+(se||""),B&&B.charAt(0)!=="/"&&(B="/"+B)):se||(se=""),ne&&ne.charAt(0)!=="#"&&(ne="#"+ne),G&&G.charAt(0)!=="?"&&(G="?"+G),B=B.replace(/[?#]/g,function(E){return encodeURIComponent(E)}),G=G.replace("#","%23"),V+se+B+G+ne};function C(S,V){return W(S,!1,!0).resolve(V)}m.prototype.resolve=function(S){return this.resolveObject(W(S,!1,!0)).format()};function P(S,V){return S?W(S,!1,!0).resolveObject(V):V}m.prototype.resolveObject=function(S){if(c.isString(S)){var V=new m;V.parse(S,!1,!0),S=V}for(var B=new m,ne=Object.keys(this),se=0;se<ne.length;se++){var ie=ne[se];B[ie]=this[ie]}if(B.hash=S.hash,S.href==="")return B.href=B.format(),B;if(S.slashes&&!S.protocol){for(var G=Object.keys(S),E=0;E<G.length;E++){var T=G[E];T!=="protocol"&&(B[T]=S[T])}return R[B.protocol]&&B.hostname&&!B.pathname&&(B.path=B.pathname="/"),B.href=B.format(),B}if(S.protocol&&S.protocol!==B.protocol){if(!R[S.protocol]){for(var U=Object.keys(S),z=0;z<U.length;z++){var re=U[z];B[re]=S[re]}return B.href=B.format(),B}if(B.protocol=S.protocol,!S.host&&!v[S.protocol]){for(var F=(S.pathname||"").split("/");F.length&&!(S.host=F.shift()););S.host||(S.host=""),S.hostname||(S.hostname=""),F[0]!==""&&F.unshift(""),F.length<2&&F.unshift(""),B.pathname=F.join("/")}else B.pathname=S.pathname;if(B.search=S.search,B.query=S.query,B.host=S.host||"",B.auth=S.auth,B.hostname=S.hostname||S.host,B.port=S.port,B.pathname||B.search){var ee=B.pathname||"",H=B.search||"";B.path=ee+H}return B.slashes=B.slashes||S.slashes,B.href=B.format(),B}var D=B.pathname&&B.pathname.charAt(0)==="/",X=S.host||S.pathname&&S.pathname.charAt(0)==="/",$=X||D||B.host&&S.pathname,oe=$,Z=B.pathname&&B.pathname.split("/")||[],F=S.pathname&&S.pathname.split("/")||[],M=B.protocol&&!R[B.protocol];if(M&&(B.hostname="",B.port=null,B.host&&(Z[0]===""?Z[0]=B.host:Z.unshift(B.host)),B.host="",S.protocol&&(S.hostname=null,S.port=null,S.host&&(F[0]===""?F[0]=S.host:F.unshift(S.host)),S.host=null),$=$&&(F[0]===""||Z[0]==="")),X)B.host=S.host||S.host===""?S.host:B.host,B.hostname=S.hostname||S.hostname===""?S.hostname:B.hostname,B.search=S.search,B.query=S.query,Z=F;else if(F.length)Z||(Z=[]),Z.pop(),Z=Z.concat(F),B.search=S.search,B.query=S.query;else if(!c.isNullOrUndefined(S.search)){if(M){B.hostname=B.host=Z.shift();var Y=B.host&&B.host.indexOf("@")>0?B.host.split("@"):!1;Y&&(B.auth=Y.shift(),B.host=B.hostname=Y.shift())}return B.search=S.search,B.query=S.query,(!c.isNull(B.pathname)||!c.isNull(B.search))&&(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.href=B.format(),B}if(!Z.length)return B.pathname=null,B.search?B.path="/"+B.search:B.path=null,B.href=B.format(),B;for(var te=Z.slice(-1)[0],O=(B.host||S.host||Z.length>1)&&(te==="."||te==="..")||te==="",I=0,N=Z.length;N>=0;N--)te=Z[N],te==="."?Z.splice(N,1):te===".."?(Z.splice(N,1),I++):I&&(Z.splice(N,1),I--);if(!$&&!oe)for(;I--;I)Z.unshift("..");$&&Z[0]!==""&&(!Z[0]||Z[0].charAt(0)!=="/")&&Z.unshift(""),O&&Z.join("/").substr(-1)!=="/"&&Z.push("");var q=Z[0]===""||Z[0]&&Z[0].charAt(0)==="/";if(M){B.hostname=B.host=q?"":Z.length?Z.shift():"";var Y=B.host&&B.host.indexOf("@")>0?B.host.split("@"):!1;Y&&(B.auth=Y.shift(),B.host=B.hostname=Y.shift())}return $=$||B.host&&Z.length,$&&!q&&Z.unshift(""),Z.length?B.pathname=Z.join("/"):(B.pathname=null,B.path=null),(!c.isNull(B.pathname)||!c.isNull(B.search))&&(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.auth=S.auth||B.auth,B.slashes=B.slashes||S.slashes,B.href=B.format(),B},m.prototype.parseHost=function(){var S=this.host,V=s.exec(S);V&&(V=V[0],V!==":"&&(this.port=V.substr(1)),S=S.substr(0,S.length-V.length)),S&&(this.hostname=S)}},{"./util":91,punycode:86,querystring:89}],91:[function(y,k,x){"use strict";k.exports={isString:function(p){return typeof p=="string"},isObject:function(p){return typeof p=="object"&&p!==null},isNull:function(p){return p===null},isNullOrUndefined:function(p){return p==null}}},{}]},{},[17])(17)})});function Yr(ae,ue){if(ae&1&&(_e(0,"th",5),Te(1),ye()),ae&2){let pe=ue.$implicit;ge(),Re(pe.title)}}function Qr(ae,ue){if(ae&1&&(_e(0,"td",7),Te(1),ye()),ae&2){let pe=ue.$implicit,y=Ae().$implicit;ge(),Re(y[pe.key])}}function Gr(ae,ue){if(ae&1&&(_e(0,"tr"),Ee(1,Qr,2,1,"td",6),ye()),ae&2){let pe=Ae();ge(),be("ngForOf",pe.columns)}}var si=(()=>{let ue=class ue{constructor(){this.columns=[],this.data=[]}ngOnInit(){console.log(this.data)}};ue.\u0275fac=function(k){return new(k||ue)},ue.\u0275cmp=ke({type:ue,selectors:[["app-data-v-lj-table"]],inputs:{columns:"columns",data:"data"},standalone:!0,features:[Le],decls:7,vars:4,consts:[["nzBordered","","nzSize","small",3,"nzData","nzPageSize"],["dynamicTable",""],["style",`
  3. background: rgb(8 22 48);
  4. /* color: #bfceff !important; */
  5. color: #75f9fd;
  6. text-align: center;
  7. border: 0.5px solid #ffffff !important;
  8. `,"nzShowSort","true",4,"ngFor","ngForOf"],[2,"background","rgb(8 22 48)"],[4,"ngFor","ngForOf"],["nzShowSort","true",2,"background","rgb(8 22 48)","/* color","#bfceff !important",`*/
  9. color`,"#75f9fd","text-align","center","border","0.5px solid #ffffff !important"],["style","text-align: center; color: #75f9fd; border: 0.5px solid #ffffff !important; transition: background 0.3s",4,"ngFor","ngForOf"],[2,"text-align","center","color","#75f9fd","border","0.5px solid #ffffff !important","transition","background 0.3s"]],template:function(k,x){if(k&1&&(_e(0,"nz-table",0,1)(2,"thead")(3,"tr"),Ee(4,Yr,2,1,"th",2),ye()(),_e(5,"tbody",3),Ee(6,Gr,2,1,"tr",4),ye()()),k&2){let p=Ne(1);be("nzData",x.data)("nzPageSize",5),ge(4),be("ngForOf",x.columns),ge(2),be("ngForOf",p.data)}},dependencies:[ze,qe,ht,it,ct,pt,ft,lt,Ve,et,rt,_t,at,st,nt,je,Xe,Ze,dt,yt,Ge,gt,ot,Qe,tt,Je,sr,ir,rr,nr,lr,or,ar,mt,He,We,ut,Ye,De,Ke,$e,Fe,Ue,tr],styles:[".ant-table-bordered[_ngcontent-%COMP%] .ant-table-thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%], .ant-table-bordered[_ngcontent-%COMP%] .ant-table-tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{border-color:#fff!important}.tableColor[_ngcontent-%COMP%] .ant-table-tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{border-right:3px solid #2b3e71!important;border-bottom:1px solid #334474!important;transition:background .3s}.tableColor[_ngcontent-%COMP%] .ant-table-thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%]{color:#bfceff!important;background-color:transparent!important;border-right:3px solid #2b3e71!important;border-bottom:1px solid #334474!important}"]});let ae=ue;return ae})();function $r(ae,ue){if(ae&1){let pe=jt();_e(0,"li",9)(1,"label",10),Wt("ngModelChange",function(k){let p=St(pe).$implicit;return xt(p.checked=k)})("ngModelChange",function(){St(pe);let k=Ae(2);return xt(k.onCheckChange())}),Te(2),ye()()}if(ae&2){let pe=ue.$implicit;ge(),be("ngModel",pe.checked),ge(),Re(pe.label)}}function Jr(ae,ue){if(ae&1&&(_e(0,"div",4),Dt(1,"a",5),_e(2,"nz-dropdown-menu",null,6)(4,"ul",7),Ee(5,$r,3,2,"li",8),ye()()()),ae&2){let pe=Ne(3),y=Ae();ge(),be("nzDropdownMenu",pe),ge(4),be("ngForOf",y.optionsList)}}var Xr=["*"],_i=(()=>{let ue=class ue{constructor(){this.showSetting=!1,this.optionsList=[],this.onCheckedItemsChange=new me,this.title=""}getCheckedItems(){return this.optionsList.filter(y=>y.checked)}onCheckChange(){let y=this.getCheckedItems();this.onCheckedItemsChange.emit(y)}};ue.\u0275fac=function(k){return new(k||ue)},ue.\u0275cmp=ke({type:ue,selectors:[["data-v-card"]],inputs:{showSetting:"showSetting",optionsList:"optionsList",title:"title"},outputs:{onCheckedItemsChange:"onCheckedItemsChange"},standalone:!0,features:[Le],ngContentSelectors:Xr,decls:6,vars:2,consts:[[1,"card-content"],[1,"card-content-title"],[1,"card-content-l"],["class","card-content-r",4,"ngIf"],[1,"card-content-r"],["nz-dropdown","","nz-icon","","nzType","setting","nzTrigger","click","nzTheme","outline",3,"nzDropdownMenu"],["menu","nzDropdownMenu"],["nz-menu","","nzSelectable",""],["nz-menu-item","",4,"ngFor","ngForOf"],["nz-menu-item",""],["nz-checkbox","",3,"ngModel","ngModelChange"]],template:function(k,x){k&1&&(Ht(),_e(0,"div",0)(1,"div",1)(2,"div",2),Te(3),ye(),Ee(4,Jr,6,2,"div",3),ye(),Vt(5),ye()),k&2&&(ge(3),Re(x.title),ge(),be("ngIf",x.showSetting))},dependencies:[De,qt,Fe,Ue,zt,Qe,Jt,$t,Xt,Zt,er,ze,Yt,Qt,qe,ht,it,ct,pt,ft,lt,Ve,et,rt,_t,at,st,nt,je,Kt,Xe,Ze,dt,yt,Ge,gt,ot,tt,Je,mt,He,We,ut,Ye,Ke,Gt,$e],styles:['.card-content[_ngcontent-%COMP%]{overflow:hidden;padding:1rem 1.5rem;background-image:url("./media/dashboard_card_bg-2QFDBQFD.jpg");background-position:top;background-size:cover;margin-bottom:.5rem}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%]{display:flex;margin-bottom:.5rem;font-size:18px;font-weight:600;color:#74fafb}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-l[_ngcontent-%COMP%]{align-self:flex-start;flex:1}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-r[_ngcontent-%COMP%]{align-self:flex-end}']});let ae=ue;return ae})();var Ti=Tt(It(),1),fr=Tt(It(),1);var Pe=function(ae){return ae[ae.CLOSED=0]="CLOSED",ae[ae.CONNECTING=1]="CONNECTING",ae[ae.CONNECTED=2]="CONNECTED",ae}(Pe||{});var Zr=new vt("NgxMqttServiceConfig"),ei=new vt("NgxMqttClientService");function bt(ae,...ue){if(!ue.length)return ae;let pe=ue.shift();if(At(ae)&&At(pe))for(let y in pe)At(pe[y])?(ae[y]||Object.assign(ae,{[y]:{}}),bt(ae[y],pe[y])):Object.assign(ae,{[y]:pe[y]});return bt(ae,...ue)}function At(ae){return ae&&typeof ae=="object"&&!Array.isArray(ae)}var Oi=(()=>{let ue=class ue{constructor(y,k){this.options=y,this.observables={},this.state=new Mt(Pe.CLOSED),this.messages=new wt,this._clientId=this._generateClientId(),this._connectTimeout=1e4,this._reconnectPeriod=1e4,this._onConnect=new me,this._onReconnect=new me,this._onClose=new me,this._onOffline=new me,this._onError=new me,this._onEnd=new me,this._onMessage=new me,this._onSuback=new me,this._onPacketsend=new me,this._onPacketreceive=new me,this._handleOnConnect=x=>{this.options.connectOnCreate===!0&&Object.keys(this.observables).forEach(p=>{this.client.subscribe(p)}),this.state.next(Pe.CONNECTED),this._onConnect.emit(x)},this._handleOnReconnect=()=>{this.options.connectOnCreate===!0&&Object.keys(this.observables).forEach(x=>{this.client.subscribe(x)}),this.state.next(Pe.CONNECTING),this._onReconnect.emit()},this._handleOnClose=()=>{this.state.next(Pe.CLOSED),this._onClose.emit()},this._handleOnOffline=()=>{this._onOffline.emit()},this._handleOnError=x=>{this._onError.emit(x),console.error(x)},this._handleOnEnd=()=>{this._onEnd.emit()},this._handleOnMessage=(x,p,c)=>{this._onMessage.emit(c),c.cmd==="publish"&&this.messages.next(c)},this._handleOnPacketsend=x=>{this._onPacketsend.emit(x)},this._handleOnPacketreceive=x=>{this._onPacketreceive.emit(x)},y.connectOnCreate!==!1&&this.connect({},k),this.state.subscribe()}get clientId(){return this._clientId}get onConnect(){return this._onConnect}get onReconnect(){return this._onReconnect}get onClose(){return this._onClose}get onOffline(){return this._onOffline}get onError(){return this._onError}get onEnd(){return this._onEnd}get onMessage(){return this._onMessage}get onPacketsend(){return this._onPacketsend}get onPacketreceive(){return this._onPacketreceive}get onSuback(){return this._onSuback}static filterMatchesTopic(y,k){if(y[0]==="#"&&k[0]==="$")return!1;let x=(y||"").split("/").reverse(),p=(k||"").split("/").reverse(),c=()=>{let m=x.pop(),h=p.pop();switch(m){case"#":return!0;case"+":return h?c():!1;default:return m===h&&(m===void 0?!0:c())}};return c()}connect(y,k){let x=bt(this.options||{},y),p=x.protocol||"ws",c=x.hostname||"localhost";x.url?this._url=x.url:(this._url=`${p}://${c}`,this._url+=x.port?`:${x.port}`:"",this._url+=x.path?`${x.path}`:""),this.state.next(Pe.CONNECTING);let m=bt({clientId:this._clientId,reconnectPeriod:this._reconnectPeriod,connectTimeout:this._connectTimeout},x);this.client&&this.client.end(!0),k?this.client=k:this.client=(0,fr.connect)(this._url,m),this._clientId=m.clientId,this.client.on("connect",this._handleOnConnect),this.client.on("reconnect",this._handleOnReconnect),this.client.on("close",this._handleOnClose),this.client.on("offline",this._handleOnOffline),this.client.on("error",this._handleOnError),this.client.stream.on("error",this._handleOnError),this.client.on("end",this._handleOnEnd),this.client.on("message",this._handleOnMessage),this.client.on("packetsend",this._handleOnPacketsend),this.client.on("packetreceive",this._handleOnPacketreceive)}disconnect(y=!0){if(!this.client)throw new Error("mqtt client not connected");this.client.end(y)}observeRetained(y,k={qos:1}){return this._generalObserve(y,()=>Ut(1),k)}observe(y,k={qos:1}){return this._generalObserve(y,()=>Lt(),k)}_generalObserve(y,k,x){if(!this.client)throw new Error("mqtt client not connected");if(!this.observables[y]){let p=new wt;this.observables[y]=Nt(()=>{let c=new Rt;return this.client.subscribe(y,x,(m,h)=>{h&&h.forEach(s=>{s.qos===128&&(delete this.observables[s.topic],this.client.unsubscribe(s.topic),p.error(`subscription for '${s.topic}' rejected!`)),this._onSuback.emit({filter:y,granted:s.qos!==128})})}),c.add(()=>{delete this.observables[y],this.client.unsubscribe(y)}),c},c=>Bt(p,this.messages)).pipe(kt(c=>ue.filterMatchesTopic(y,c.topic)),k(),Ot())}return this.observables[y]}publish(y,k,x={}){if(!this.client)throw new Error("mqtt client not connected");return Pt.create(p=>{this.client.publish(y,k,x,c=>{c?p.error(c):(p.next(),p.complete())})})}unsafePublish(y,k,x={}){if(!this.client)throw new Error("mqtt client not connected");this.client.publish(y,k,x,p=>{if(p)throw p})}_generateClientId(){return"client-"+Math.random().toString(36).substr(2,19)}};ue.\u0275fac=function(k){return new(k||ue)(Et(Zr),Et(ei))},ue.\u0275prov=Ft({token:ue,factory:ue.\u0275fac,providedIn:"root"});let ae=ue;return ae})();export{si as a,_i as b,Oi as c};