import{$ as Rt,$a as ct,A as We,C as Ve,Ca as tt,Ga as rt,Ia as nt,La as ot,O as sr,P as ar,Pa as st,S as lr,Sa as at,T as ur,U as cr,Ua as lt,V as He,Xa as ut,_ as qe,aa as Ke,bb as ft,ca as Qe,da as fr,db as ht,e as Ue,fa as hr,fb as pt,ga as pr,ha as dr,hb as dt,ia as gr,j as ir,ja as mr,jb as gt,ka as yr,kb as kt,la as Ye,n as nr,pa as Ge,ra as $e,ta as Je,u as je,ua as Xe,v as ze,wa as Ze,ya as et,z as or}from"./chunk-WD6SV3WH.js";import{Ab as Ct,Bb as xt,Cb as It,Db as Tt,Eb as we,Fb as Se,Fe as Mt,Gb as At,Ge as Ne,He as Ot,I as Yt,J as Gt,Jb as Ee,K as $t,Ka as pe,Le as De,Nf as it,Oa as be,Ta as Ae,Va as _e,X as Jt,Y as Xt,Za as vt,a as bt,b as wt,c as _t,cc as Pt,dc as rr,f as Zr,gb as ge,h as Vt,ha as Zt,hb as de,hf as Le,ib as Ie,ja as Dt,k as Re,ka as Lt,l as Ht,lf as Fe,m as qt,mb as er,n as Kt,na as ve,nc as Be,o as Nt,p as Qt,qb as Te,sa as Ft,sb as ke,ta as Ut,tb as Et,ub as St,vb as tr}from"./chunk-VDRVUQCF.js";var zt=Zr((Jr,jt)=>{"use strict";(function(se){if(typeof Jr=="object"&&typeof jt<"u")jt.exports=se();else if(typeof define=="function"&&define.amd)define([],se);else{var ae;typeof window<"u"?ae=window:typeof global<"u"?ae=global:typeof self<"u"?ae=self:ae=this,ae.mqtt=se()}})(function(){var se,ae,me;return function(){function m(T,v,h){function p(o,i){if(!v[o]){if(!T[o]){var r=typeof _t=="function"&&_t;if(!i&&r)return r(o,!0);if(y)return y(o,!0);var e=new Error("Cannot find module '"+o+"'");throw e.code="MODULE_NOT_FOUND",e}var t=v[o]={exports:{}};T[o][0].call(t.exports,function(s){var u=T[o][1][s];return p(u||s)},t,t.exports,m,T,v,h)}return v[o].exports}for(var y=typeof _t=="function"&&_t,c=0;c0)throw new Error("Invalid string. Length must be a multiple of 4");var E=_.indexOf("=");E===-1&&(E=f);var M=E===f?0:4-E%4;return[E,M]}function e(_){var f=r(_),E=f[0],M=f[1];return(E+M)*3/4-M}function t(_,f,E){return(f+E)*3/4-E}function s(_){var f,E=r(_),M=E[0],A=E[1],z=new y(t(_,M,A)),j=0,x=A>0?M-4:M,O;for(O=0;O>16&255,z[j++]=f>>8&255,z[j++]=f&255;return A===2&&(f=p[_.charCodeAt(O)]<<2|p[_.charCodeAt(O+1)]>>4,z[j++]=f&255),A===1&&(f=p[_.charCodeAt(O)]<<10|p[_.charCodeAt(O+1)]<<4|p[_.charCodeAt(O+2)]>>2,z[j++]=f>>8&255,z[j++]=f&255),z}function u(_){return h[_>>18&63]+h[_>>12&63]+h[_>>6&63]+h[_&63]}function d(_,f,E){for(var M,A=[],z=f;zx?x:j+z));return M===1?(f=_[E-1],A.push(h[f>>2]+h[f<<4&63]+"==")):M===2&&(f=(_[E-2]<<8)+_[E-1],A.push(h[f>>10]+h[f>>4&63]+h[f<<2&63]+"=")),A.join("")}},{}],2:[function(m,T,v){},{}],3:[function(m,T,v){(function(h){(function(){"use strict";var p=m("base64-js"),y=m("ieee754");v.Buffer=r,v.SlowBuffer=M,v.INSPECT_MAX_BYTES=50;var c=2147483647;v.kMaxLength=c,r.TYPED_ARRAY_SUPPORT=o(),!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 o(){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>c)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(Y(l,ArrayBuffer)||l&&Y(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 D=f(l);if(D)return D;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 s(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 s(l,n,a)};function u(l){return t(l),i(l<0?0:E(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),D=w.write(l,n);return D!==a&&(w=w.slice(0,D)),w}function g(l){for(var n=l.length<0?0:E(l.length)|0,a=i(n),w=0;w=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return l|0}function M(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(Y(n,Uint8Array)&&(n=r.from(n,n.offset,n.byteLength)),Y(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,D=a.length,K=0,J=Math.min(w,D);K2&&arguments[2]===!0;if(!w&&a===0)return 0;for(var D=!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(D)return w?-1:te(l).length;n=(""+n).toLowerCase(),D=!0}}r.byteLength=A;function z(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 S(this,n,a);case"ascii":return H(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 W(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;aa&&(n+=" ... "),""},r.prototype.compare=function(n,a,w,D,K){if(Y(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),D===void 0&&(D=0),K===void 0&&(K=this.length),a<0||w>n.length||D<0||K>this.length)throw new RangeError("out of range index");if(D>=K&&a>=w)return 0;if(D>=K)return-1;if(a>=w)return 1;if(a>>>=0,w>>>=0,D>>>=0,K>>>=0,this===n)return 0;for(var J=K-D,ue=w-a,ce=Math.min(J,ue),fe=this.slice(D,K),ye=n.slice(a,w),he=0;he2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,b(a)&&(a=D?0:l.length-1),a<0&&(a=l.length+a),a>=l.length){if(D)return-1;a=l.length-1}else if(a<0)if(D)a=0;else return-1;if(typeof n=="string"&&(n=r.from(n,w)),r.isBuffer(n))return n.length===0?-1:O(l,n,a,w,D);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(l,n,a):Uint8Array.prototype.lastIndexOf.call(l,n,a):O(l,[n],a,w,D);throw new TypeError("val must be string, number or Buffer")}function O(l,n,a,w,D){var K=1,J=l.length,ue=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,ue/=2,a/=2}function ce(Pe,xe){return K===1?Pe[xe]:Pe.readUInt16BE(xe*K)}var fe;if(D){var ye=-1;for(fe=a;feJ&&(a=J-ue),fe=a;fe>=0;fe--){for(var he=!0,Ce=0;CeD&&(w=D)):w=D;var K=n.length;w>K/2&&(w=K/2);for(var J=0;J>>0,isFinite(w)?(w=w>>>0,D===void 0&&(D="utf8")):(D=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");D||(D="utf8");for(var J=!1;;)switch(D){case"hex":return C(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 oe(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: "+D);D=(""+D).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?p.fromByteArray(l):p.fromByteArray(l.slice(n,a))}function S(l,n,a){a=Math.min(l.length,a);for(var w=[],D=n;D239?4:K>223?3:K>191?2:1;if(D+ue<=a){var ce,fe,ye,he;switch(ue){case 1:K<128&&(J=K);break;case 2:ce=l[D+1],(ce&192)===128&&(he=(K&31)<<6|ce&63,he>127&&(J=he));break;case 3:ce=l[D+1],fe=l[D+2],(ce&192)===128&&(fe&192)===128&&(he=(K&15)<<12|(ce&63)<<6|fe&63,he>2047&&(he<55296||he>57343)&&(J=he));break;case 4:ce=l[D+1],fe=l[D+2],ye=l[D+3],(ce&192)===128&&(fe&192)===128&&(ye&192)===128&&(he=(K&15)<<18|(ce&63)<<12|(fe&63)<<6|ye&63,he>65535&&he<1114112&&(J=he))}}J===null?(J=65533,ue=1):J>65535&&(J-=65536,w.push(J>>>10&1023|55296),J=56320|J&1023),w.push(J),D+=ue}return L(w)}var P=4096;function L(l){var n=l.length;if(n<=P)return String.fromCharCode.apply(String,l);for(var a="",w=0;ww)&&(a=w);for(var D="",K=n;Kw&&(n=w),a<0?(a+=w,a<0&&(a=0)):a>w&&(a=w),aa)throw new RangeError("Trying to access beyond buffer length")}r.prototype.readUIntLE=function(n,a,w){n=n>>>0,a=a>>>0,w||U(n,a,this.length);for(var D=this[n],K=1,J=0;++J>>0,a=a>>>0,w||U(n,a,this.length);for(var D=this[n+--a],K=1;a>0&&(K*=256);)D+=this[n+--a]*K;return D},r.prototype.readUInt8=function(n,a){return n=n>>>0,a||U(n,1,this.length),this[n]},r.prototype.readUInt16LE=function(n,a){return n=n>>>0,a||U(n,2,this.length),this[n]|this[n+1]<<8},r.prototype.readUInt16BE=function(n,a){return n=n>>>0,a||U(n,2,this.length),this[n]<<8|this[n+1]},r.prototype.readUInt32LE=function(n,a){return n=n>>>0,a||U(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||U(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||U(n,a,this.length);for(var D=this[n],K=1,J=0;++J=K&&(D-=Math.pow(2,8*a)),D},r.prototype.readIntBE=function(n,a,w){n=n>>>0,a=a>>>0,w||U(n,a,this.length);for(var D=a,K=1,J=this[n+--D];D>0&&(K*=256);)J+=this[n+--D]*K;return K*=128,J>=K&&(J-=Math.pow(2,8*a)),J},r.prototype.readInt8=function(n,a){return n=n>>>0,a||U(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},r.prototype.readInt16LE=function(n,a){n=n>>>0,a||U(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||U(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||U(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||U(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||U(n,4,this.length),y.read(this,n,!0,23,4)},r.prototype.readFloatBE=function(n,a){return n=n>>>0,a||U(n,4,this.length),y.read(this,n,!1,23,4)},r.prototype.readDoubleLE=function(n,a){return n=n>>>0,a||U(n,8,this.length),y.read(this,n,!0,52,8)},r.prototype.readDoubleBE=function(n,a){return n=n>>>0,a||U(n,8,this.length),y.read(this,n,!1,52,8)};function X(l,n,a,w,D,K){if(!r.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>D||nl.length)throw new RangeError("Index out of range")}r.prototype.writeUIntLE=function(n,a,w,D){if(n=+n,a=a>>>0,w=w>>>0,!D){var K=Math.pow(2,8*w)-1;X(this,n,a,w,K,0)}var J=1,ue=0;for(this[a]=n&255;++ue>>0,w=w>>>0,!D){var K=Math.pow(2,8*w)-1;X(this,n,a,w,K,0)}var J=w-1,ue=1;for(this[a+J]=n&255;--J>=0&&(ue*=256);)this[a+J]=n/ue&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,D){if(n=+n,a=a>>>0,!D){var K=Math.pow(2,8*w-1);X(this,n,a,w,K-1,-K)}var J=0,ue=1,ce=0;for(this[a]=n&255;++J>0)-ce&255;return a+w},r.prototype.writeIntBE=function(n,a,w,D){if(n=+n,a=a>>>0,!D){var K=Math.pow(2,8*w-1);X(this,n,a,w,K-1,-K)}var J=w-1,ue=1,ce=0;for(this[a+J]=n&255;--J>=0&&(ue*=256);)n<0&&ce===0&&this[a+J+1]!==0&&(ce=1),this[a+J]=(n/ue>>0)-ce&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,D,K){if(a+w>l.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function le(l,n,a,w,D){return n=+n,a=a>>>0,D||$(l,n,a,4,34028234663852886e22,-34028234663852886e22),y.write(l,n,a,w,23,4),a+4}r.prototype.writeFloatLE=function(n,a,w){return le(this,n,a,!0,w)},r.prototype.writeFloatBE=function(n,a,w){return le(this,n,a,!1,w)};function Z(l,n,a,w,D){return n=+n,a=a>>>0,D||$(l,n,a,8,17976931348623157e292,-17976931348623157e292),y.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,D){if(!r.isBuffer(n))throw new TypeError("argument should be a Buffer");if(w||(w=0),!D&&D!==0&&(D=this.length),a>=n.length&&(a=n.length),a||(a=0),D>0&&D=this.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("sourceEnd out of bounds");D>this.length&&(D=this.length),n.length-a=0;--J)n[J+a]=this[J+w];else Uint8Array.prototype.set.call(n,this.subarray(w,D),a);return K},r.prototype.fill=function(n,a,w,D){if(typeof n=="string"){if(typeof a=="string"?(D=a,a=0,w=this.length):typeof w=="string"&&(D=w,w=this.length),D!==void 0&&typeof D!="string")throw new TypeError("encoding must be a string");if(typeof D=="string"&&!r.isEncoding(D))throw new TypeError("Unknown encoding: "+D);if(n.length===1){var K=n.charCodeAt(0);(D==="utf8"&&K<128||D==="latin1")&&(n=K)}}else typeof n=="number"&&(n=n&255);if(a<0||this.length>>0,w=w===void 0?this.length:w>>>0,n||(n=0);var J;if(typeof n=="number")for(J=a;J55295&&a<57344){if(!D){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}D=a;continue}if(a<56320){(n-=3)>-1&&K.push(239,191,189),D=a;continue}a=(D-55296<<10|a-56320)+65536}else D&&(n-=3)>-1&&K.push(239,191,189);if(D=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 R(l){for(var n=[],a=0;a>8,D=a%256,K.push(D),K.push(w);return K}function N(l){return p.toByteArray(k(l))}function q(l,n,a,w){for(var D=0;D=n.length||D>=l.length);++D)n[D+a]=l[D];return D}function Y(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,m("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:5}],4:[function(m,T,v){"use strict";var h=typeof Reflect=="object"?Reflect:null,p=h&&typeof h.apply=="function"?h.apply:function(O,C,V){return Function.prototype.apply.call(O,C,V)},y;h&&typeof h.ownKeys=="function"?y=h.ownKeys:Object.getOwnPropertySymbols?y=function(O){return Object.getOwnPropertyNames(O).concat(Object.getOwnPropertySymbols(O))}:y=function(O){return Object.getOwnPropertyNames(O)};function c(x){console&&console.warn&&console.warn(x)}var o=Number.isNaN||function(O){return O!==O};function i(){i.init.call(this)}T.exports=i,T.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(x){if(typeof x!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return r},set:function(x){if(typeof x!="number"||x<0||o(x))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+x+".");r=x}}),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(O){if(typeof O!="number"||O<0||o(O))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+O+".");return this._maxListeners=O,this};function t(x){return x._maxListeners===void 0?i.defaultMaxListeners:x._maxListeners}i.prototype.getMaxListeners=function(){return t(this)},i.prototype.emit=function(O){for(var C=[],V=1;V0&&(oe=C[0]),oe instanceof Error)throw oe;var ie=new Error("Unhandled error."+(oe?" ("+oe.message+")":""));throw ie.context=oe,ie}var G=ne[O];if(G===void 0)return!1;if(typeof G=="function")p(G,this,C);else for(var S=G.length,P=f(G,S),V=0;V0&&oe.length>B&&!oe.warned){oe.warned=!0;var ie=new Error("Possible EventEmitter memory leak detected. "+oe.length+" "+String(O)+" listeners added. Use emitter.setMaxListeners() to increase limit");ie.name="MaxListenersExceededWarning",ie.emitter=x,ie.type=O,ie.count=oe.length,c(ie)}return x}i.prototype.addListener=function(O,C){return s(this,O,C,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(O,C){return s(this,O,C,!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(x,O,C){var V={fired:!1,wrapFn:void 0,target:x,type:O,listener:C},B=u.bind(V);return B.listener=C,V.wrapFn=B,B}i.prototype.once=function(O,C){return e(C),this.on(O,d(this,O,C)),this},i.prototype.prependOnceListener=function(O,C){return e(C),this.prependListener(O,d(this,O,C)),this},i.prototype.removeListener=function(O,C){var V,B,ne,oe,ie;if(e(C),B=this._events,B===void 0)return this;if(V=B[O],V===void 0)return this;if(V===C||V.listener===C)--this._eventsCount===0?this._events=Object.create(null):(delete B[O],B.removeListener&&this.emit("removeListener",O,V.listener||C));else if(typeof V!="function"){for(ne=-1,oe=V.length-1;oe>=0;oe--)if(V[oe]===C||V[oe].listener===C){ie=V[oe].listener,ne=oe;break}if(ne<0)return this;ne===0?V.shift():E(V,ne),V.length===1&&(B[O]=V[0]),B.removeListener!==void 0&&this.emit("removeListener",O,ie||C)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(O){var C,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[O]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete V[O]),this;if(arguments.length===0){var ne=Object.keys(V),oe;for(B=0;B=0;B--)this.removeListener(O,C[B]);return this};function g(x,O,C){var V=x._events;if(V===void 0)return[];var B=V[O];return B===void 0?[]:typeof B=="function"?C?[B.listener||B]:[B]:C?M(B):f(B,B.length)}i.prototype.listeners=function(O){return g(this,O,!0)},i.prototype.rawListeners=function(O){return g(this,O,!1)},i.listenerCount=function(x,O){return typeof x.listenerCount=="function"?x.listenerCount(O):_.call(x,O)},i.prototype.listenerCount=_;function _(x){var O=this._events;if(O!==void 0){var C=O[x];if(typeof C=="function")return 1;if(C!==void 0)return C.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?y(this._events):[]};function f(x,O){for(var C=new Array(O),V=0;V>1,u=-7,d=y?o-1:0,g=y?-1:1,_=h[p+d];for(d+=g,i=_&(1<<-u)-1,_>>=-u,u+=e;u>0;i=i*256+h[p+d],d+=g,u-=8);for(r=i&(1<<-u)-1,i>>=-u,u+=c;u>0;r=r*256+h[p+d],d+=g,u-=8);if(i===0)i=1-s;else{if(i===t)return r?NaN:(_?-1:1)*(1/0);r=r+Math.pow(2,c),i=i-s}return(_?-1:1)*r*Math.pow(2,i-c)},v.write=function(h,p,y,c,o,i){var r,e,t,s=i*8-o-1,u=(1<>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=c?0:i-1,f=c?1:-1,E=p<0||p===0&&1/p<0?1:0;for(p=Math.abs(p),isNaN(p)||p===1/0?(e=isNaN(p)?1:0,r=u):(r=Math.floor(Math.log(p)/Math.LN2),p*(t=Math.pow(2,-r))<1&&(r--,t*=2),r+d>=1?p+=g/t:p+=g*Math.pow(2,1-d),p*t>=2&&(r++,t/=2),r+d>=u?(e=0,r=u):r+d>=1?(e=(p*t-1)*Math.pow(2,o),r=r+d):(e=p*Math.pow(2,d-1)*Math.pow(2,o),r=0));o>=8;h[y+_]=e&255,_+=f,e/=256,o-=8);for(r=r<0;h[y+_]=r&255,_+=f,r/=256,s-=8);h[y+_-f]|=E*128}},{}],6:[function(m,T,v){(function(h,p){(function(){"use strict";let y=m("events").EventEmitter,c=m("./store"),o=m("./topic-alias-recv"),i=m("./topic-alias-send"),r=m("mqtt-packet"),e=m("./default-message-id-provider"),t=m("readable-stream").Writable,s=m("inherits"),u=m("reinterval"),d=m("rfdc/default"),g=m("./validations"),_=m("xtend"),f=m("debug")("mqttjs:client"),E=h?h.nextTick:function(S){setTimeout(S,0)},M=p.setImmediate||function(S){E(S)},A={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},z=["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 x(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function O(S,P){if(S.options.protocolVersion===5&&P.cmd==="publish"){let L;P.properties&&(L=P.properties.topicAlias);let H=P.topic.toString();if(S.topicAliasSend)if(L){if(H.length!==0&&(f("applyTopicAlias :: register topic: %s - alias: %d",H,L),!S.topicAliasSend.put(H,L)))return f("applyTopicAlias :: error out of range. topic: %s - alias: %d",H,L),new Error("Sending Topic Alias out of range")}else H.length!==0&&(S.options.autoAssignTopicAlias?(L=S.topicAliasSend.getAliasByTopic(H),L?(P.topic="",P.properties=wt(bt({},P.properties),{topicAlias:L}),f("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",H,L)):(L=S.topicAliasSend.getLruAlias(),S.topicAliasSend.put(H,L),P.properties=wt(bt({},P.properties),{topicAlias:L}),f("applyTopicAlias :: auto assign topic: %s - alias: %d",H,L))):S.options.autoUseTopicAlias&&(L=S.topicAliasSend.getAliasByTopic(H),L&&(P.topic="",P.properties=wt(bt({},P.properties),{topicAlias:L}),f("applyTopicAlias :: auto use topic: %s - alias: %d",H,L))));else if(L)return f("applyTopicAlias :: error out of range. topic: %s - alias: %d",H,L),new Error("Sending Topic Alias out of range")}}function C(S,P){let L;P.properties&&(L=P.properties.topicAlias);let H=P.topic.toString();if(H.length===0){if(typeof L>"u")return new Error("Unregistered Topic Alias");if(H=S.topicAliasSend.getTopicByAlias(L),typeof H>"u")return new Error("Unregistered Topic Alias");P.topic=H}L&&delete P.properties.topicAlias}function V(S,P,L){f("sendPacket :: packet: %O",P),f("sendPacket :: emitting `packetsend`"),S.emit("packetsend",P),f("sendPacket :: writing to stream");let H=r.writeToStream(P,S.stream,S.options);f("sendPacket :: writeToStream result %s",H),!H&&L&&L!==ie?(f("sendPacket :: handle events on `drain` once through callback."),S.stream.once("drain",L)):L&&(f("sendPacket :: invoking cb"),L())}function B(S){S&&(f("flush: queue exists? %b",!!S),Object.keys(S).forEach(function(P){typeof S[P].cb=="function"&&(S[P].cb(new Error("Connection closed")),delete S[P])}))}function ne(S){S&&(f("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(S).forEach(function(P){S[P].volatile&&typeof S[P].cb=="function"&&(S[P].cb(new Error("Connection closed")),delete S[P])}))}function oe(S,P,L,H){f("storeAndSend :: store packet with cmd %s to outgoingStore",P.cmd);let re=P,ee;if(re.cmd==="publish"&&(re=d(P),ee=C(S,re),ee))return L&&L(ee);S.outgoingStore.put(re,function(U){if(U)return L&&L(U);H(),V(S,P,L)})}function ie(S){f("nop ::",S)}function G(S,P){let L,H=this;if(!(this instanceof G))return new G(S,P);this.options=P||{};for(L in A)typeof this.options[L]>"u"?this.options[L]=A[L]:this.options[L]=P[L];f("MqttClient :: options.protocol",P.protocol),f("MqttClient :: options.protocolVersion",P.protocolVersion),f("MqttClient :: options.username",P.username),f("MqttClient :: options.keepalive",P.keepalive),f("MqttClient :: options.reconnectPeriod",P.reconnectPeriod),f("MqttClient :: options.rejectUnauthorized",P.rejectUnauthorized),f("MqttClient :: options.topicAliasMaximum",P.topicAliasMaximum),this.options.clientId=typeof P.clientId=="string"?P.clientId:x(),f("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=P.protocolVersion===5&&P.customHandleAcks?P.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=S,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new e:this.options.messageIdProvider,this.outgoingStore=P.outgoingStore||new c,this.incomingStore=P.incomingStore||new c,this.queueQoSZero=P.queueQoSZero===void 0?!0:P.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,P.topicAliasMaximum>0&&(P.topicAliasMaximum>65535?f("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new o(P.topicAliasMaximum)),this.on("connect",function(){let re=this.queue;function ee(){let W=re.shift();f("deliver :: entry %o",W);let U=null;if(!W){H._resubscribe();return}U=W.packet,f("deliver :: call _sendPacket for %o",U);let X=!0;U.messageId&&U.messageId!==0&&(H.messageIdProvider.register(U.messageId)||(X=!1)),X?H._sendPacket(U,function($){W.cb&&W.cb($),ee()}):(f("messageId: %d has already used. The message is skipped and removed.",U.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"),H.pingTimer!==null&&(H.pingTimer.clear(),H.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),f("close :: calling _setupReconnect"),this._setupReconnect()}),y.call(this),f("MqttClient :: setting up stream"),this._setupStream()}s(G,y),G.prototype._setupStream=function(){let S=this,P=new t,L=r.parser(this.options),H=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),L.on("packet",function($){f("parser :: on packet push to packets array."),re.push($)});function ee(){if(re.length)E(W);else{let $=H;H=null,$()}}function W(){f("work :: getting next packet in queue");let $=re.shift();if($)f("work :: packet pulled from queue"),S._handlePacket($,ee);else{f("work :: no packets in queue");let le=H;H=null,f("work :: done flag is %s",!!le),le&&le()}}P._write=function($,le,Z){H=Z,f("writable stream :: parsing buffer"),L.parse($),W()};function U($){f("streamErrorHandler :: error",$.message),z.includes($.code)?(f("streamErrorHandler :: emitting error"),S.emit("error",$)):ie($)}f("_setupStream :: pipe stream to writable stream"),this.stream.pipe(P),this.stream.on("error",U),this.stream.on("close",function(){f("(%s)stream :: on close",S.options.clientId),ne(S.outgoing),f("stream: emit close to MqttClient"),S.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),L.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return S.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`"),S._cleanUp(!0)},this.options.connectTimeout)},G.prototype._handlePacket=function(S,P){let L=this.options;if(L.protocolVersion===5&&L.properties&&L.properties.maximumPacketSize&&L.properties.maximumPacketSize0||!U())&&this._storeProcessingQueue.push({invoke:U,cbStorePut:L.cbStorePut,callback:H}),this},G.prototype.subscribe=function(){let S=this,P=new Array(arguments.length);for(let Z=0;Z0){let te={qos:Q.qos};U===5&&(te.nl=Q.nl||!1,te.rap=Q.rap||!1,te.rh=Q.rh||0,te.properties=Q.properties),S._resubscribeTopics[Q.topic]=te,k.push(Q.topic)}}),S.messageIdToTopic[F.messageId]=k}return S.outgoing[F.messageId]={volatile:!0,cb:function(k,Q){if(!k){let te=Q.granted;for(let R=0;R0||!le())&&this._storeProcessingQueue.push({invoke:le,callback:ee}),this},G.prototype.unsubscribe=function(){let S=this,P=new Array(arguments.length);for(let U=0;U0||!W())&&this._storeProcessingQueue.push({invoke:W,callback:H}),this},G.prototype.end=function(S,P,L){let H=this;f("end :: (%s)",this.options.clientId),(S==null||typeof S!="boolean")&&(L=P||ie,P=S,S=!1,typeof P!="object"&&(L=P,P=null,typeof L!="function"&&(L=ie))),typeof P!="object"&&(L=P,P=null),f("end :: cb? %s",!!L),L=L||ie;function re(){f("end :: closeStores: closing incoming and outgoing stores"),H.disconnected=!0,H.incomingStore.close(function(W){H.outgoingStore.close(function(U){if(f("end :: closeStores: emitting end"),H.emit("end"),L){let X=W||U;f("end :: closeStores: invoking callback with args"),L(X)}})}),H._deferredReconnect&&H._deferredReconnect()}function ee(){f("end :: (%s) :: finish :: calling _cleanUp with force %s",H.options.clientId,S),H._cleanUp(S,()=>{f("end :: finish :: calling process.nextTick on closeStores"),E(re.bind(H))},P)}return this.disconnecting?(L(),this):(this._clearReconnect(),this.disconnecting=!0,!S&&Object.keys(this.outgoing).length>0?(f("end :: (%s) :: calling finish in 10ms once outgoing is empty",H.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,ee,10))):(f("end :: (%s) :: immediately calling finish",H.options.clientId),ee()),this)},G.prototype.removeOutgoingMessage=function(S){let P=this.outgoing[S]?this.outgoing[S].cb:null;return delete this.outgoing[S],this.outgoingStore.del({messageId:S},function(){P(new Error("Message removed"))}),this},G.prototype.reconnect=function(S){f("client reconnect");let P=this,L=function(){S?(P.options.incomingStore=S.incomingStore,P.options.outgoingStore=S.outgoingStore):(P.options.incomingStore=null,P.options.outgoingStore=null),P.incomingStore=P.options.incomingStore||new c,P.outgoingStore=P.options.outgoingStore||new c,P.disconnecting=!1,P.disconnected=!1,P._deferredReconnect=null,P._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=L:L(),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 S=this;!S.disconnecting&&!S.reconnectTimer&&S.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",S.options.reconnectPeriod),S.reconnectTimer=setInterval(function(){f("reconnectTimer :: reconnect triggered!"),S._reconnect()},S.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(S,P){let L=arguments[2];if(P&&(f("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",P)),f("_cleanUp :: forced? %s",S),S)this.options.reconnectPeriod===0&&this.options.clean&&B(this.outgoing),f("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let H=_({cmd:"disconnect"},L);f("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(H,M.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),P&&!this.connected&&(f("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",P),P())},G.prototype._sendPacket=function(S,P,L){f("_sendPacket :: (%s) :: start",this.options.clientId),L=L||ie,P=P||ie;let H=O(this,S);if(H){P(H);return}if(!this.connected){if(S.cmd==="auth"){this._shiftPingInterval(),V(this,S,P);return}f("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(S,P,L);return}switch(this._shiftPingInterval(),S.cmd){case"publish":break;case"pubrel":oe(this,S,P,L);return;default:V(this,S,P);return}switch(S.qos){case 2:case 1:oe(this,S,P,L);break;case 0:default:V(this,S,P);break}f("_sendPacket :: (%s) :: end",this.options.clientId)},G.prototype._storePacket=function(S,P,L){f("_storePacket :: packet: %o",S),f("_storePacket :: cb? %s",!!P),L=L||ie;let H=S;if(H.cmd==="publish"){H=d(S);let re=C(this,H);if(re)return P&&P(re)}(H.qos||0)===0&&this.queueQoSZero||H.cmd!=="publish"?this.queue.push({packet:H,cb:P}):H.qos>0?(P=this.outgoing[H.messageId]?this.outgoing[H.messageId].cb:null,this.outgoingStore.put(H,function(re){if(re)return P&&P(re);L()})):P&&P(new Error("No connection to broker"))},G.prototype._setupPingTimer=function(){f("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);let S=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=u(function(){S._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(S){f("_handleConnack");let P=this.options,H=P.protocolVersion===5?S.reasonCode:S.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,S.properties){if(S.properties.topicAliasMaximum){if(S.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}S.properties.topicAliasMaximum>0&&(this.topicAliasSend=new i(S.properties.topicAliasMaximum))}S.properties.serverKeepAlive&&P.keepalive&&(P.keepalive=S.properties.serverKeepAlive,this._shiftPingInterval()),S.properties.maximumPacketSize&&(P.properties||(P.properties={}),P.properties.maximumPacketSize=S.properties.maximumPacketSize)}if(H===0)this.reconnecting=!1,this._onConnect(S);else if(H>0){let re=new Error("Connection refused: "+j[H]);re.code=H,this.emit("error",re)}},G.prototype._handleAuth=function(S){let L=this.options.protocolVersion,H=L===5?S.reasonCode:S.returnCode;if(L!==5){let ee=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+L);ee.code=H,this.emit("error",ee);return}let re=this;this.handleAuth(S,function(ee,W){if(ee){re.emit("error",ee);return}if(H===24)re.reconnecting=!1,re._sendPacket(W);else{let U=new Error("Connection refused: "+j[H]);ee.code=H,re.emit("error",U)}})},G.prototype.handleAuth=function(S,P){P()},G.prototype._handlePublish=function(S,P){f("_handlePublish: packet %o",S),P=typeof P<"u"?P:ie;let L=S.topic.toString(),H=S.payload,re=S.qos,ee=S.messageId,W=this,U=this.options,X=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let $;if(S.properties&&($=S.properties.topicAlias),typeof $<"u")if(L.length===0)if($>0&&$<=65535){let le=this.topicAliasRecv.getTopicByAlias($);if(le)L=le,f("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",L,$);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(L,$))f("_handlePublish :: registered topic: %s - alias: %d",L,$);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:{U.customHandleAcks(L,H,S,function($,le){if($ instanceof Error||(le=$,$=null),$)return W.emit("error",$);if(X.indexOf(le)===-1)return W.emit("error",new Error("Wrong reason code for pubrec"));le?W._sendPacket({cmd:"pubrec",messageId:ee,reasonCode:le},P):W.incomingStore.put(S,function(){W._sendPacket({cmd:"pubrec",messageId:ee},P)})});break}case 1:{U.customHandleAcks(L,H,S,function($,le){if($ instanceof Error||(le=$,$=null),$)return W.emit("error",$);if(X.indexOf(le)===-1)return W.emit("error",new Error("Wrong reason code for puback"));le||W.emit("message",L,H,S),W.handleMessage(S,function(Z){if(Z)return P&&P(Z);W._sendPacket({cmd:"puback",messageId:ee,reasonCode:le},P)})});break}case 0:this.emit("message",L,H,S),this.handleMessage(S,P);break;default:f("_handlePublish: unknown QoS. Doing nothing.");break}},G.prototype.handleMessage=function(S,P){P()},G.prototype._handleAck=function(S){let P=S.messageId,L=S.cmd,H=null,re=this.outgoing[P]?this.outgoing[P].cb:null,ee=this,W;if(!re){f("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(f("_handleAck :: packet type",L),L){case"pubcomp":case"puback":{let U=S.reasonCode;U&&U>0&&U!==16&&(W=new Error("Publish error: "+j[U]),W.code=U,re(W,S)),delete this.outgoing[P],this.outgoingStore.del(S,re),this.messageIdProvider.deallocate(P),this._invokeStoreProcessingQueue();break}case"pubrec":{H={cmd:"pubrel",qos:2,messageId:P};let U=S.reasonCode;U&&U>0&&U!==16?(W=new Error("Publish error: "+j[U]),W.code=U,re(W,S)):this._sendPacket(H);break}case"suback":{delete this.outgoing[P],this.messageIdProvider.deallocate(P);for(let U=0;U0)if(this.options.resubscribe)if(this.options.protocolVersion===5){f("_resubscribe: protocolVersion 5");for(let P=0;P0){let S=this._storeProcessingQueue[0];if(S&&S.invoke())return this._storeProcessingQueue.shift(),!0}return!1},G.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},G.prototype._flushStoreProcessingQueue=function(){for(let S of this._storeProcessingQueue)S.cbStorePut&&S.cbStorePut(new Error("Connection closed")),S.callback&&S.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},T.exports=G}).call(this)}).call(this,m("_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(m,T,v){"use strict";let{Buffer:h}=m("buffer"),p=m("readable-stream").Transform,y=m("duplexify"),c,o,i,r=!1;function e(){let g=new p;return g._write=function(_,f,E){c.sendSocketMessage({data:_.buffer,success:function(){E()},fail:function(){E(new Error)}})},g._flush=function(f){c.closeSocket({success:function(){f()}})},g}function t(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})}function s(g,_){let f=g.protocol==="alis"?"wss":"ws",E=f+"://"+g.hostname+g.path;return g.port&&g.port!==80&&g.port!==443&&(E=f+"://"+g.hostname+":"+g.port+g.path),typeof g.transformWsUrl=="function"&&(E=g.transformWsUrl(E,g,_)),E}function u(){r||(r=!0,c.onSocketOpen(function(){i.setReadable(o),i.setWritable(o),i.emit("connect")}),c.onSocketMessage(function(g){if(typeof g.data=="string"){let _=h.from(g.data,"base64");o.push(_)}else{let _=new FileReader;_.addEventListener("load",function(){let f=_.result;f instanceof ArrayBuffer?f=h.from(f):f=h.from(f,"utf8"),o.push(f)}),_.readAsArrayBuffer(g.data)}}),c.onSocketClose(function(){i.end(),i.destroy()}),c.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 E=s(_,g);return c=_.my,c.connectSocket({url:E,protocols:f}),o=e(),i=y.obj(),u(),i}T.exports=d},{buffer:3,duplexify:22,"readable-stream":72}],8:[function(m,T,v){"use strict";let h=m("net"),p=m("debug")("mqttjs:tcp");function y(c,o){o.port=o.port||1883,o.hostname=o.hostname||o.host||"localhost";let i=o.port,r=o.hostname;return p("port %d and host %s",i,r),h.createConnection(i,r)}T.exports=y},{debug:20,net:2}],9:[function(m,T,v){"use strict";let h=m("tls"),p=m("net"),y=m("debug")("mqttjs:tls");function c(o,i){i.port=i.port||8883,i.host=i.hostname||i.host||"localhost",p.isIP(i.host)===0&&(i.servername=i.host),i.rejectUnauthorized=i.rejectUnauthorized!==!1,delete i.path,y("port %d host %s rejectUnauthorized %b",i.port,i.host,i.rejectUnauthorized);let r=h.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&&o.emit("error",t),r.end()}return r.on("error",e),r}T.exports=c},{debug:20,net:2,tls:2}],10:[function(m,T,v){(function(h){(function(){"use strict";let{Buffer:p}=m("buffer"),y=m("ws"),c=m("debug")("mqttjs:ws"),o=m("duplexify"),i=m("readable-stream").Transform,r=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],e=typeof h<"u"&&h.title==="browser"||typeof __webpack_require__=="function";function t(E,M){let A=E.protocol+"://"+E.hostname+":"+E.port+E.path;return typeof E.transformWsUrl=="function"&&(A=E.transformWsUrl(A,E,M)),A}function s(E){let M=E;return E.hostname||(M.hostname="localhost"),E.port||(E.protocol==="wss"?M.port=443:M.port=80),E.path||(M.path="/"),E.wsOptions||(M.wsOptions={}),!e&&E.protocol==="wss"&&r.forEach(function(A){Object.prototype.hasOwnProperty.call(E,A)&&!Object.prototype.hasOwnProperty.call(E.wsOptions,A)&&(M.wsOptions[A]=E[A])}),M}function u(E){let M=s(E);if(M.hostname||(M.hostname=M.host),!M.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let A=new URL(document.URL);M.hostname=A.hostname,M.port||(M.port=A.port)}return M.objectMode===void 0&&(M.objectMode=!(M.binary===!0||M.binary===void 0)),M}function d(E,M,A){c("createWebSocket"),c("protocol: "+A.protocolId+" "+A.protocolVersion);let z=A.protocolId==="MQIsdp"&&A.protocolVersion===3?"mqttv3.1":"mqtt";return c("creating new Websocket for url: "+M+" and protocol: "+z),new y(M,[z],A.wsOptions)}function g(E,M){let A=M.protocolId==="MQIsdp"&&M.protocolVersion===3?"mqttv3.1":"mqtt",z=t(M,E),j=new WebSocket(z,[A]);return j.binaryType="arraybuffer",j}function _(E,M){c("streamBuilder");let A=s(M),z=t(A,E),j=d(E,z,A),x=y.createWebSocketStream(j,A.wsOptions);return x.url=z,j.on("close",()=>{x.destroy()}),x}function f(E,M){c("browserStreamBuilder");let A,j=u(M).browserBufferSize||1024*512,x=M.browserBufferTimeout||1e3,O=!M.objectMode,C=g(E,M),V=ne(M,L,H);M.objectMode||(V._writev=P),V.on("close",()=>{C.close()});let B=typeof C.addEventListener<"u";C.readyState===C.OPEN?A=V:(A=A=o(void 0,void 0,M),M.objectMode||(A._writev=P),B?C.addEventListener("open",oe):C.onopen=oe),A.socket=C,B?(C.addEventListener("close",ie),C.addEventListener("error",G),C.addEventListener("message",S)):(C.onclose=ie,C.onerror=G,C.onmessage=S);function ne(re,ee,W){let U=new i({objectModeMode:re.objectMode});return U._write=ee,U._flush=W,U}function oe(){A.setReadable(V),A.setWritable(V),A.emit("connect")}function ie(){A.end(),A.destroy()}function G(re){A.destroy(re)}function S(re){let ee=re.data;ee instanceof ArrayBuffer?ee=p.from(ee):ee=p.from(ee,"utf8"),V.push(ee)}function P(re,ee){let W=new Array(re.length);for(let U=0;Uj&&setTimeout(L,x,re,ee,W),O&&typeof re=="string"&&(re=p.from(re,"utf8"));try{C.send(re)}catch(U){return W(U)}W()}function H(re){C.close(),re()}return A}e?T.exports=f:T.exports=_}).call(this)}).call(this,m("_process"))},{_process:85,buffer:3,debug:20,duplexify:22,"readable-stream":72,ws:81}],11:[function(m,T,v){"use strict";let{Buffer:h}=m("buffer"),p=m("readable-stream").Transform,y=m("duplexify"),c,o,i;function r(){let d=new p;return d._write=function(g,_,f){c.send({data:g.buffer,success:function(){f()},fail:function(E){f(new Error(E))}})},d._flush=function(_){c.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 s(){c.onOpen(function(){i.setReadable(o),i.setWritable(o),i.emit("connect")}),c.onMessage(function(d){let g=d.data;g instanceof ArrayBuffer?g=h.from(g):g=h.from(g,"utf8"),o.push(g)}),c.onClose(function(){i.end(),i.destroy()}),c.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);c=wx.connectSocket({url:f,protocols:[_]}),o=r(),i=y.obj(),i._destroy=function(M,A){c.close({success:function(){A&&A(M)}})};let E=i.destroy;return i.destroy=(function(){i.destroy=E;let M=this;setTimeout(function(){c.close({fail:function(){M._destroy(new Error)}})},0)}).bind(i),s(),i}T.exports=u},{buffer:3,duplexify:22,"readable-stream":72}],12:[function(m,T,v){"use strict";function h(){if(!(this instanceof h))return new h;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}h.prototype.allocate=function(){let p=this.nextId++;return this.nextId===65536&&(this.nextId=1),p},h.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},h.prototype.register=function(p){return!0},h.prototype.deallocate=function(p){},h.prototype.clear=function(){},T.exports=h},{}],13:[function(m,T,v){"use strict";let h=m("xtend"),p=m("readable-stream").Readable,y={objectMode:!0},c={clean:!0};function o(i){if(!(this instanceof o))return new o(i);this.options=i||{},this.options=h(c,i),this._inflights=new Map}o.prototype.put=function(i,r){return this._inflights.set(i.messageId,i),r&&r(),this},o.prototype.createStream=function(){let i=new p(y),r=[],e=!1,t=0;return this._inflights.forEach(function(s,u){r.push(s)}),i._read=function(){!e&&tthis.max?!1:(this.aliasToTopic[y]=p,this.length=Object.keys(this.aliasToTopic).length,!0)},h.prototype.getTopicByAlias=function(p){return this.aliasToTopic[p]},h.prototype.clear=function(){this.aliasToTopic={}},T.exports=h},{}],15:[function(m,T,v){"use strict";let h=m("lru-cache"),p=m("number-allocator").NumberAllocator;function y(c){if(!(this instanceof y))return new y(c);c>0&&(this.aliasToTopic=new h({max:c}),this.topicToAlias={},this.numberAllocator=new p(1,c),this.max=c,this.length=0)}y.prototype.put=function(c,o){if(o===0||o>this.max)return!1;let i=this.aliasToTopic.get(o);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(o,c),this.topicToAlias[c]=o,this.numberAllocator.use(o),this.length=this.aliasToTopic.length,!0},y.prototype.getTopicByAlias=function(c){return this.aliasToTopic.get(c)},y.prototype.getAliasByTopic=function(c){let o=this.topicToAlias[c];return typeof o<"u"&&this.aliasToTopic.get(o),o},y.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},y.prototype.getLruAlias=function(){let c=this.numberAllocator.firstVacant();return c||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},T.exports=y},{"lru-cache":45,"number-allocator":54}],16:[function(m,T,v){"use strict";function h(y){let c=y.split("/");for(let o=0;othis.length||o<0)return;let i=this._offset(o);return this._bufs[i[0]][i[1]]},y.prototype.slice=function(o,i){return typeof o=="number"&&o<0&&(o+=this.length),typeof i=="number"&&i<0&&(i+=this.length),this.copy(null,0,o,i)},y.prototype.copy=function(o,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 o||h.alloc(0);let t=!!o,s=this._offset(r),u=e-r,d=u,g=t&&i||0,_=s[1];if(r===0&&e===this.length){if(!t)return this._bufs.length===1?this._bufs[0]:h.concat(this._bufs,this.length);for(let f=0;fE)this._bufs[f].copy(o,g,_),g+=E;else{this._bufs[f].copy(o,g,_,_+d),g+=E;break}d-=E,_&&(_=0)}return o.length>g?o.slice(0,g):o},y.prototype.shallowSlice=function(o,i){if(o=o||0,i=typeof i!="number"?this.length:i,o<0&&(o+=this.length),i<0&&(i+=this.length),o===i)return this._new();let r=this._offset(o),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)},y.prototype.toString=function(o,i,r){return this.slice(i,r).toString(o)},y.prototype.consume=function(o){if(o=Math.trunc(o),Number.isNaN(o)||o<=0)return this;for(;this._bufs.length;)if(o>=this._bufs[0].length)o-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(o),this.length-=o;break}return this},y.prototype.duplicate=function(){let o=this._new();for(let i=0;ithis.length?this.length:o;let r=this._offset(o),e=r[0],t=r[1];for(;e=c.length){let d=s.indexOf(c,t);if(d!==-1)return this._reverseOffset([e,d]);t=s.length-c.length+1}else{let d=this._reverseOffset([e,t]);if(this._match(d,c))return d;t++}t=0}return-1},y.prototype._match=function(c,o){if(this.length-c{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`."))}})(),v.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 p(){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 y(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+T.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let s=0,u=0;e[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(s++,d==="%c"&&(u=s))}),e.splice(u,0,t)}v.log=console.debug||console.log||(()=>{});function c(e){try{e?v.storage.setItem("debug",e):v.storage.removeItem("debug")}catch{}}function o(){let e;try{e=v.storage.getItem("debug")}catch{}return!e&&typeof h<"u"&&"env"in h&&(e=h.env.DEBUG),e}function i(){try{return localStorage}catch{}}T.exports=m("./common")(v);let{formatters:r}=T.exports;r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this)}).call(this,m("_process"))},{"./common":21,_process:85}],21:[function(m,T,v){function h(p){c.debug=c,c.default=c,c.coerce=s,c.disable=r,c.enable=i,c.enabled=e,c.humanize=m("ms"),c.destroy=u,Object.keys(p).forEach(d=>{c[d]=p[d]}),c.names=[],c.skips=[],c.formatters={};function y(d){let g=0;for(let _=0;_{if(V==="%%")return"%";O++;let ne=c.formatters[B];if(typeof ne=="function"){let oe=A[O];V=ne.call(z,oe),A.splice(O,1),O--}return V}),c.formatArgs.call(z,A),(z.log||c.log).apply(z,A)}return M.namespace=d,M.useColors=c.useColors(),M.color=c.selectColor(d),M.extend=o,M.destroy=c.destroy,Object.defineProperty(M,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(f!==c.namespaces&&(f=c.namespaces,E=c.enabled(d)),E),set:A=>{_=A}}),typeof c.init=="function"&&c.init(M),M}function o(d,g){let _=c(this.namespace+(typeof g>"u"?":":g)+d);return _.log=this.log,_}function i(d){c.save(d),c.namespaces=d,c.names=[],c.skips=[];let g,_=(typeof d=="string"?d:"").split(/[\s,]+/),f=_.length;for(g=0;g"-"+g)].join(",");return c.enable(""),d}function e(d){if(d[d.length-1]==="*")return!0;let g,_;for(g=0,_=c.skips.length;g<_;g++)if(c.skips[g].test(d))return!1;for(g=0,_=c.names.length;g<_;g++)if(c.names[g].test(d))return!0;return!1}function t(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}function s(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 c.enable(c.load()),c}T.exports=h},{ms:53}],22:[function(m,T,v){(function(h,p){(function(){var y=m("readable-stream"),c=m("end-of-stream"),o=m("inherits"),i=m("stream-shift"),r=p.from&&p.from!==Uint8Array.from?p.from([0]):new p([0]),e=function(f,E){f._corked?f.once("uncork",E):E()},t=function(f,E){f._autoDestroy&&f.destroy(E)},s=function(f,E){return function(M){M?t(f,M.message==="premature close"?null:M):E&&!f._ended&&f.end()}},u=function(f,E){if(!f||f._writableState&&f._writableState.finished)return E();if(f._writableState)return f.end(E);f.end(),E()},d=function(){},g=function(f){return new y.Readable({objectMode:!0,highWaterMark:16}).wrap(f)},_=function(f,E,M){if(!(this instanceof _))return new _(f,E,M);y.Duplex.call(this,M),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!M||M.autoDestroy!==!1,this._forwardDestroy=!M||M.destroy!==!1,this._forwardEnd=!M||M.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),E&&this.setReadable(E)};o(_,y.Duplex),_.obj=function(f,E,M){return M||(M={}),M.objectMode=!0,M.highWaterMark=16,new _(f,E,M)},_.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 E=this,M=c(f,{writable:!0,readable:!1},s(this,this._forwardEnd)),A=function(){var j=E._ondrain;E._ondrain=null,j&&j()},z=function(){E._writable.removeListener("drain",A),M()};this._unwrite&&h.nextTick(A),this._writable=f,this._writable.on("drain",A),this._unwrite=z,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 E=this,M=c(f,{writable:!1,readable:!0},s(this)),A=function(){E._forward()},z=function(){E.push(null)},j=function(){E._readable2.removeListener("readable",A),E._readable2.removeListener("end",z),M()};this._drained=!0,this._readable=f,this._readable2=f._readableState?f:g(f),this._readable2.on("readable",A),this._readable2.on("end",z),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,E){if(E||(E=d),this.destroyed)return E(null);this.destroyed=!0;var M=this;h.nextTick(function(){M._destroy(f),E(null)})},_.prototype._destroy=function(f){if(f){var E=this._ondrain;this._ondrain=null,E?E(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,E,M){if(!this.destroyed){if(this._corked)return e(this,this._write.bind(this,f,E,M));if(f===r)return this._finish(M);if(!this._writable)return M();this._writable.write(f)===!1?this._ondrain=M:this.destroyed||M()}},_.prototype._finish=function(f){var E=this;this.emit("preend"),e(this,function(){u(E._forwardEnd&&E._writable,function(){E._writableState.prefinished===!1&&(E._writableState.prefinished=!0),E.emit("prefinish"),e(E,f)})})},_.prototype.end=function(f,E,M){return typeof f=="function"?this.end(null,null,f):typeof E=="function"?this.end(f,null,E):(this._ended=!0,f&&this.write(f),!this._writableState.ending&&!this._writableState.destroyed&&this.write(r),y.Writable.prototype.end.call(this,M))},T.exports=_}).call(this)}).call(this,m("_process"),m("buffer").Buffer)},{_process:85,buffer:3,"end-of-stream":23,inherits:24,"readable-stream":72,"stream-shift":77}],23:[function(m,T,v){(function(h){(function(){var p=m("once"),y=function(){},c=function(r){return r.setHeader&&typeof r.abort=="function"},o=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=p(t||y);var s=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||E()},E=function(){g=!1,d||t.call(r)},M=function(){d=!1,g||t.call(r)},A=function(C){t.call(r,C?new Error("exited with error code: "+C):null)},z=function(C){t.call(r,C)},j=function(){h.nextTick(x)},x=function(){if(!_){if(d&&!(u&&u.ended&&!u.destroyed))return t.call(r,new Error("premature close"));if(g&&!(s&&s.ended&&!s.destroyed))return t.call(r,new Error("premature close"))}},O=function(){r.req.on("finish",E)};return c(r)?(r.on("complete",E),r.on("abort",j),r.req?O():r.on("request",O)):g&&!s&&(r.on("end",f),r.on("close",f)),o(r)&&r.on("exit",A),r.on("end",M),r.on("finish",E),e.error!==!1&&r.on("error",z),r.on("close",j),function(){_=!0,r.removeListener("complete",E),r.removeListener("abort",j),r.removeListener("request",O),r.req&&r.req.removeListener("finish",E),r.removeListener("end",f),r.removeListener("close",f),r.removeListener("finish",E),r.removeListener("exit",A),r.removeListener("end",M),r.removeListener("error",z),r.removeListener("close",j)}};T.exports=i}).call(this)}).call(this,m("_process"))},{_process:85,once:56}],24:[function(m,T,v){typeof Object.create=="function"?T.exports=function(p,y){y&&(p.super_=y,p.prototype=Object.create(y.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}))}:T.exports=function(p,y){if(y){p.super_=y;var c=function(){};c.prototype=y.prototype,p.prototype=new c,p.prototype.constructor=p}}},{}],25:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.ContainerIterator=v.Container=v.Base=void 0;class h{constructor(o=0){this.iteratorType=o}equals(o){return this.o===o.o}}v.ContainerIterator=h;class p{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}}v.Base=p;class y extends p{}v.Container=y},{}],26:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.HashContainerIterator=v.HashContainer=void 0;var h=m("../../ContainerBase"),p=c(m("../../../utils/checkObject")),y=m("../../../utils/throwError");function c(r){return r&&r.t?r:{default:r}}class o extends h.ContainerIterator{constructor(e,t,s){super(s),this.o=e,this.h=t,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.L,this})}}v.HashContainerIterator=o;class i extends h.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:s}=e;t.B=s,s.L=t,e===this.p&&(this.p=s),e===this._&&(this._=t),this.i-=1}M(e,t,s){s===void 0&&(s=(0,p.default)(e));let u;if(s){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,p.default)(e)),t){let s=e[this.HASH_TAG];return s===void 0?this.h:this.H[s]}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 s;if(t===void 0&&(t=(0,p.default)(e)),t){let u=e[this.HASH_TAG];if(u===void 0)return!1;delete e[this.HASH_TAG],s=this.H[u],delete this.H[u]}else{if(s=this.g[e],s===void 0)return!1;delete this.g[e]}return this.V(s),!0}eraseElementByIterator(e){let t=e.o;return t===this.h&&(0,y.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}}v.HashContainer=i},{"../../../utils/checkObject":43,"../../../utils/throwError":44,"../../ContainerBase":25}],27:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("./Base"),p=c(m("../../utils/checkObject")),y=m("../../utils/throwError");function c(e){return e&&e.t?e:{default:e}}class o extends h.HashContainerIterator{constructor(t,s,u,d){super(t,s,d),this.container=u}get pointer(){this.o===this.h&&(0,y.throwIteratorAccessError)();let t=this;return new Proxy([],{get(s,u){if(u==="0")return t.o.u;if(u==="1")return t.o.l},set(s,u,d){if(u!=="1")throw new TypeError("props must be 1");return t.o.l=d,!0}})}copy(){return new o(this.o,this.h,this.container,this.iteratorType)}}class i extends h.HashContainer{constructor(t=[]){super();let s=this;t.forEach(function(u){s.setElement(u[0],u[1])})}begin(){return new o(this.p,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this._,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(t,s,u){return this.M(t,s,u)}getElementByKey(t,s){if(s===void 0&&(s=(0,p.default)(t)),s){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 s=this.p;for(;t--;)s=s.B;return[s.u,s.l]}find(t,s){let u=this.I(t,s);return new o(u,this.h,this)}forEach(t){let s=0,u=this.p;for(;u!==this.h;)t([u.u,u.l],s++,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;v.default=r},{"../../utils/checkObject":43,"../../utils/throwError":44,"./Base":26}],28:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("./Base"),p=m("../../utils/throwError");class y extends h.HashContainerIterator{constructor(r,e,t,s){super(r,e,s),this.container=t}get pointer(){return this.o===this.h&&(0,p.throwIteratorAccessError)(),this.o.u}copy(){return new y(this.o,this.h,this.container,this.iteratorType)}}class c extends h.HashContainer{constructor(r=[]){super();let e=this;r.forEach(function(t){e.insert(t)})}begin(){return new y(this.p,this.h,this)}end(){return new y(this.h,this.h,this)}rBegin(){return new y(this._,this.h,this,1)}rEnd(){return new y(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 y(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 o=c;v.default=o},{"../../utils/throwError":44,"./Base":26}],29:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("../ContainerBase");class p extends h.Base{constructor(o=[],i=function(e,t){return e>t?-1:e>1;for(let t=this.i-1>>1;t>=0;--t)this.k(t,e)}m(o){let i=this.C[o];for(;o>0;){let r=o-1>>1,e=this.C[r];if(this.v(e,i)<=0)break;this.C[o]=e,o=r}this.C[o]=i}k(o,i){let r=this.C[o];for(;o0&&(e=t,s=this.C[t]),this.v(s,r)>=0)break;this.C[o]=s,o=e}this.C[o]=r}clear(){this.i=0,this.C.length=0}push(o){this.C.push(o),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let o=this.C[0],i=this.C.pop();return this.i-=1,this.i&&(this.C[0]=i,this.k(0,this.i>>1)),o}top(){return this.C[0]}find(o){return this.C.indexOf(o)>=0}remove(o){let i=this.C.indexOf(o);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(o){let i=this.C.indexOf(o);return i<0?!1:(this.m(i),this.k(i,this.i>>1),!0)}toArray(){return[...this.C]}}var y=p;v.default=y},{"../ContainerBase":25}],30:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("../ContainerBase");class p extends h.Base{constructor(o=[]){super(),this.j=0,this.q=[];let i=this;o.forEach(function(r){i.push(r)})}clear(){this.q=[],this.i=this.j=0}push(o){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{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(s/this.F),1);for(let g=0;g>1)-(u>>1),this.D=this.N=this.F-s%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 s=0;s>1}begin(){return new c(0,this)}end(){return new c(this.i,this)}rBegin(){return new c(this.i-1,this,1)}rEnd(){return new c(-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.N0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,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.Dthis.i-1)throw new RangeError;let{curNodeBucketIndex:t,curNodePointerIndex:s}=this.O(e);return this.A[t][s]}setElementByPos(e,t){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:s,curNodePointerIndex:u}=this.O(e);this.A[s][u]=t}insert(e,t,s=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;s--;)this.pushFront(t);else if(e===this.i)for(;s--;)this.pushBack(t);else{let u=[];for(let d=e;dthis.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;ue;)this.popBack();return this.i}sort(e){let t=[];for(let s=0;sthis.i-1)throw new RangeError;let s=this.p;for(;t--;)s=s.B;return s.l}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let s=this.p;for(;t--;)s=s.B;return this.V(s),this.i}eraseElementByValue(t){let s=this.p;for(;s!==this.h;)s.l===t&&this.V(s),s=s.B;return this.i}eraseElementByIterator(t){let s=t.o;return s===this.h&&(0,y.throwIteratorAccessError)(),t=t.next(),this.V(s),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,s){if(t<0||t>this.i-1)throw new RangeError;let u=this.p;for(;t--;)u=u.B;u.l=s}insert(t,s,u=1){if(t<0||t>this.i)throw new RangeError;if(u<=0)return this.i;if(t===0)for(;u--;)this.pushFront(s);else if(t===this.i)for(;u--;)this.pushBack(s);else{let d=this.p;for(let _=1;_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 s=0;sthis.i-1)throw new RangeError;this.J[e]=t}insert(e,t,s=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(s).fill(t)),this.i+=s,this.i}find(e){for(let t=0;ts?1:0},e=!1){super(),this.Y=void 0,this.v=r,e?(this.re=h.TreeNodeEnableIndex,this.M=function(t,s,u){let d=this.ne(t,s,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:E,curNode:M}=_;f.ie(),E.ie(),M.ie()}}return this.i},this.V=function(t){let s=this.fe(t);for(;s!==this.h;)s.rt-=1,s=s.tt}):(this.re=h.TreeNode,this.M=function(t,s,u){let d=this.ne(t,s,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 s=this.v(r.u,e);if(s<0)r=r.W;else if(s>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 s=this.v(r.u,e);if(s<0)t=r,r=r.W;else if(s>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 s=t.W;if(s&&s.ee===1){if(s.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 s=t.U;if(s&&s.ee===1){if(s.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 s,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,s=u.U,this.h.U=s;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,s=g.W,this.h.W=s;else{if(t!==void 0){let f=t.o;if(f!==this.h){let E=this.v(f.u,r);if(E===0){f.l=e;return}else if(E>0){let M=f.L(),A=this.v(M.u,r);if(A===0){M.l=e;return}else A<0&&(s=new this.re(r,e),M.W===void 0?(M.W=s,s.tt=M):(f.U=s,s.tt=f))}}}if(s===void 0)for(s=this.Y;;){let f=this.v(s.u,r);if(f>0){if(s.U===void 0){s.U=new this.re(r,e),s.U.tt=s,s=s.U;break}s=s.U}else if(f<0){if(s.W===void 0){s.W=new this.re(r,e),s.W.tt=s,s=s.W;break}s=s.W}else{s.l=e;return}}}}return this.i+=1,s}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,y.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 s=t.L().u;if(this.v(s,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(s){return r===e?(t.V(s),!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,y.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 s of this){if(t===r){e=s;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 o=c;v.default=o},{"../../../utils/throwError":44,"../../ContainerBase":25,"./TreeNode":38}],40:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=c(m("./Base")),p=c(m("./Base/TreeIterator")),y=m("../../utils/throwError");function c(e){return e&&e.t?e:{default:e}}class o extends p.default{constructor(t,s,u,d){super(t,s,d),this.container=u}get pointer(){this.o===this.h&&(0,y.throwIteratorAccessError)();let t=this;return new Proxy([],{get(s,u){if(u==="0")return t.o.u;if(u==="1")return t.o.l},set(s,u,d){if(u!=="1")throw new TypeError("props must be 1");return t.o.l=d,!0}})}copy(){return new o(this.o,this.h,this.container,this.iteratorType)}}class i extends h.default{constructor(t=[],s,u){super(s,u);let d=this;t.forEach(function(g){d.setElement(g[0],g[1])})}*K(t){t!==void 0&&(yield*Re(this.K(t.U)),yield[t.u,t.l],yield*Re(this.K(t.W)))}begin(){return new o(this.h.U||this.h,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this.h.W||this.h,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){if(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 s=this.X(this.Y,t);return new o(s,this.h,this)}upperBound(t){let s=this.Z(this.Y,t);return new o(s,this.h,this)}reverseLowerBound(t){let s=this.$(this.Y,t);return new o(s,this.h,this)}reverseUpperBound(t){let s=this.rr(this.Y,t);return new o(s,this.h,this)}setElement(t,s,u){return this.M(t,s,u)}find(t){let s=this.I(this.Y,t);return new o(s,this.h,this)}getElementByKey(t){return this.I(this.Y,t).l}union(t){let s=this;return t.forEach(function(u){s.setElement(u[0],u[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}}var r=i;v.default=r},{"../../utils/throwError":44,"./Base":39,"./Base/TreeIterator":37}],41:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=c(m("./Base")),p=c(m("./Base/TreeIterator")),y=m("../../utils/throwError");function c(e){return e&&e.t?e:{default:e}}class o extends p.default{constructor(t,s,u,d){super(t,s,d),this.container=u}get pointer(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o.u}copy(){return new o(this.o,this.h,this.container,this.iteratorType)}}class i extends h.default{constructor(t=[],s,u){super(s,u);let d=this;t.forEach(function(g){d.insert(g)})}*K(t){t!==void 0&&(yield*Re(this.K(t.U)),yield t.u,yield*Re(this.K(t.W)))}begin(){return new o(this.h.U||this.h,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this.h.W||this.h,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(t,s){return this.M(t,void 0,s)}find(t){let s=this.I(this.Y,t);return new o(s,this.h,this)}lowerBound(t){let s=this.X(this.Y,t);return new o(s,this.h,this)}upperBound(t){let s=this.Z(this.Y,t);return new o(s,this.h,this)}reverseLowerBound(t){let s=this.$(this.Y,t);return new o(s,this.h,this)}reverseUpperBound(t){let s=this.rr(this.Y,t);return new o(s,this.h,this)}union(t){let s=this;return t.forEach(function(u){s.insert(u)}),this.i}[Symbol.iterator](){return this.K(this.Y)}}var r=i;v.default=r},{"../../utils/throwError":44,"./Base":39,"./Base/TreeIterator":37}],42:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),Object.defineProperty(v,"Deque",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(v,"HashMap",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(v,"HashSet",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(v,"LinkList",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(v,"OrderedMap",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(v,"OrderedSet",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(v,"PriorityQueue",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(v,"Queue",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(v,"Stack",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(v,"Vector",{enumerable:!0,get:function(){return c.default}});var h=u(m("./container/OtherContainer/Stack")),p=u(m("./container/OtherContainer/Queue")),y=u(m("./container/OtherContainer/PriorityQueue")),c=u(m("./container/SequentialContainer/Vector")),o=u(m("./container/SequentialContainer/LinkList")),i=u(m("./container/SequentialContainer/Deque")),r=u(m("./container/TreeContainer/OrderedSet")),e=u(m("./container/TreeContainer/OrderedMap")),t=u(m("./container/HashContainer/HashSet")),s=u(m("./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(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=h;function h(p){let y=typeof p;return y==="object"&&p!==null||y==="function"}},{}],44:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.throwIteratorAccessError=h;function h(){throw new RangeError("Iterator access denied!")}},{}],45:[function(m,T,v){"use strict";let h=m("yallist"),p=Symbol("max"),y=Symbol("length"),c=Symbol("lengthCalculator"),o=Symbol("allowStale"),i=Symbol("maxAge"),r=Symbol("dispose"),e=Symbol("noDisposeOnSet"),t=Symbol("lruList"),s=Symbol("cache"),u=Symbol("updateAgeOnGet"),d=()=>1;class g{constructor(x){if(typeof x=="number"&&(x={max:x}),x||(x={}),x.max&&(typeof x.max!="number"||x.max<0))throw new TypeError("max must be a non-negative number");let O=this[p]=x.max||1/0,C=x.length||d;if(this[c]=typeof C!="function"?d:C,this[o]=x.stale||!1,x.maxAge&&typeof x.maxAge!="number")throw new TypeError("maxAge must be a number");this[i]=x.maxAge||0,this[r]=x.dispose,this[e]=x.noDisposeOnSet||!1,this[u]=x.updateAgeOnGet||!1,this.reset()}set max(x){if(typeof x!="number"||x<0)throw new TypeError("max must be a non-negative number");this[p]=x||1/0,E(this)}get max(){return this[p]}set allowStale(x){this[o]=!!x}get allowStale(){return this[o]}set maxAge(x){if(typeof x!="number")throw new TypeError("maxAge must be a non-negative number");this[i]=x,E(this)}get maxAge(){return this[i]}set lengthCalculator(x){typeof x!="function"&&(x=d),x!==this[c]&&(this[c]=x,this[y]=0,this[t].forEach(O=>{O.length=this[c](O.value,O.key),this[y]+=O.length})),E(this)}get lengthCalculator(){return this[c]}get length(){return this[y]}get itemCount(){return this[t].length}rforEach(x,O){O=O||this;for(let C=this[t].tail;C!==null;){let V=C.prev;z(this,x,C,O),C=V}}forEach(x,O){O=O||this;for(let C=this[t].head;C!==null;){let V=C.next;z(this,x,C,O),C=V}}keys(){return this[t].toArray().map(x=>x.key)}values(){return this[t].toArray().map(x=>x.value)}reset(){this[r]&&this[t]&&this[t].length&&this[t].forEach(x=>this[r](x.key,x.value)),this[s]=new Map,this[t]=new h,this[y]=0}dump(){return this[t].map(x=>f(this,x)?!1:{k:x.key,v:x.value,e:x.now+(x.maxAge||0)}).toArray().filter(x=>x)}dumpLru(){return this[t]}set(x,O,C){if(C=C||this[i],C&&typeof C!="number")throw new TypeError("maxAge must be a number");let V=C?Date.now():0,B=this[c](O,x);if(this[s].has(x)){if(B>this[p])return M(this,this[s].get(x)),!1;let ie=this[s].get(x).value;return this[r]&&(this[e]||this[r](x,ie.value)),ie.now=V,ie.maxAge=C,ie.value=O,this[y]+=B-ie.length,ie.length=B,this.get(x),E(this),!0}let ne=new A(x,O,B,V,C);return ne.length>this[p]?(this[r]&&this[r](x,O),!1):(this[y]+=ne.length,this[t].unshift(ne),this[s].set(x,this[t].head),E(this),!0)}has(x){if(!this[s].has(x))return!1;let O=this[s].get(x).value;return!f(this,O)}get(x){return _(this,x,!0)}peek(x){return _(this,x,!1)}pop(){let x=this[t].tail;return x?(M(this,x),x.value):null}del(x){M(this,this[s].get(x))}load(x){this.reset();let O=Date.now();for(let C=x.length-1;C>=0;C--){let V=x[C],B=V.e||0;if(B===0)this.set(V.k,V.v);else{let ne=B-O;ne>0&&this.set(V.k,V.v,ne)}}}prune(){this[s].forEach((x,O)=>_(this,O,!1))}}let _=(j,x,O)=>{let C=j[s].get(x);if(C){let V=C.value;if(f(j,V)){if(M(j,C),!j[o])return}else O&&(j[u]&&(C.value.now=Date.now()),j[t].unshiftNode(C));return V.value}},f=(j,x)=>{if(!x||!x.maxAge&&!j[i])return!1;let O=Date.now()-x.now;return x.maxAge?O>x.maxAge:j[i]&&O>j[i]},E=j=>{if(j[y]>j[p])for(let x=j[t].tail;j[y]>j[p]&&x!==null;){let O=x.prev;M(j,x),x=O}},M=(j,x)=>{if(x){let O=x.value;j[r]&&j[r](O.key,O.value),j[y]-=O.length,j[s].delete(O.key),j[t].removeNode(x)}};class A{constructor(x,O,C,V,B){this.key=x,this.value=O,this.length=C,this.now=V,this.maxAge=B||0}}let z=(j,x,O,C)=>{let V=O.value;f(j,V)&&(M(j,O),j[o]||(V=void 0)),V&&x.call(C,V.value,V.key,j)};T.exports=g},{yallist:84}],46:[function(m,T,v){(function(h){(function(){let p=T.exports;p.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"},p.codes={};for(let c in p.types){let o=p.types[c];p.codes[o]=c}p.CMD_SHIFT=4,p.CMD_MASK=240,p.DUP_MASK=8,p.QOS_MASK=3,p.QOS_SHIFT=1,p.RETAIN_MASK=1,p.VARBYTEINT_MASK=127,p.VARBYTEINT_FIN_MASK=128,p.VARBYTEINT_MAX=268435455,p.SESSIONPRESENT_MASK=1,p.SESSIONPRESENT_HEADER=h.from([p.SESSIONPRESENT_MASK]),p.CONNACK_HEADER=h.from([p.codes.connack<[0,1].map(i=>[0,1].map(r=>{let e=h.alloc(1);return e.writeUInt8(p.codes[c]<h.from([c])),p.EMPTY={pingreq:h.from([p.codes.pingreq<<4,0]),pingresp:h.from([p.codes.pingresp<<4,0]),disconnect:h.from([p.codes.disconnect<<4,0])}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:3}],47:[function(m,T,v){(function(h){(function(){let p=m("./writeToStream"),y=m("events");function c(i,r){let e=new o;return p(i,e,r),e.concat()}class o extends y{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,s=0,u;for(u=0;u>8,0),s.writeUInt8(t&255,1),s}function i(){for(let t=0;t<65536;t++)y[t]=o(t)}function r(t){let u=0,d=0,g=h.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),c?g.subarray(0,d):g.slice(0,d)}function e(t){let s=h.allocUnsafe(4);return s.writeUInt32BE(t,0),s}T.exports={cache:y,generateCache:i,generateNumber:o,genBufVariableByteInt:r,generate4ByteBuffer:e}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:3}],50:[function(m,T,v){class h{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}T.exports=h},{}],51:[function(m,T,v){let h=m("bl"),p=m("events"),y=m("./packet"),c=m("./constants"),o=m("debug")("mqtt-packet:parser");class i extends p{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(){o("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new y,this.error=null,this._list=h(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),o("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,o("parse: state complete. _stateCounter is now: %d",this._stateCounter),o("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return o("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0);return this.packet.cmd=c.types[e>>c.CMD_SHIFT],this.packet.retain=(e&c.RETAIN_MASK)!==0,this.packet.qos=e>>c.QOS_SHIFT&c.QOS_MASK,this.packet.dup=(e&c.DUP_MASK)!==0,o("_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)),o("_parseLength %d",e.value),!!e}_parsePayload(){o("_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 o("_parsePayload complete result: %s",e),e}_parseConnect(){o("_parseConnect");let e,t,s,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)&c.USERNAME_MASK,d.password=this._list.readUInt8(this._pos)&c.PASSWORD_MASK,d.will=this._list.readUInt8(this._pos)&c.WILL_FLAG_MASK,d.will&&(g.will={},g.will.retain=(this._list.readUInt8(this._pos)&c.WILL_RETAIN_MASK)!==0,g.will.qos=(this._list.readUInt8(this._pos)&c.WILL_QOS_MASK)>>c.WILL_QOS_SHIFT),g.clean=(this._list.readUInt8(this._pos)&c.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 E=this._parseProperties();Object.getOwnPropertyNames(E).length&&(g.properties=E)}let f=this._parseString();if(f===null)return this._emitError(new Error("Packet too short"));if(g.clientId=f,o("_parseConnect: packet.clientId: %s",g.clientId),d.will){if(g.protocolVersion===5){let E=this._parseProperties();Object.getOwnPropertyNames(E).length&&(g.will.properties=E)}if(e=this._parseString(),e===null)return this._emitError(new Error("Cannot parse will topic"));if(g.will.topic=e,o("_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,o("_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,o("_parseConnect: packet.username: %s",g.username)}if(d.password){if(s=this._parseBuffer(),s===null)return this._emitError(new Error("Cannot parse password"));g.password=s}return this.settings=g,o("_parseConnect: complete"),g}_parseConnack(){o("_parseConnack");let e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&c.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)}o("_parseConnack: complete")}_parsePublish(){o("_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),o("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){o("_parseSubscribe");let e=this.packet,t,s,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 E=this._parseProperties();Object.getOwnPropertyNames(E).length&&(e.properties=E)}for(;this._pos=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));s=this._parseByte(),u=s&c.SUBSCRIBE_OPTIONS_QOS_MASK,_=(s>>c.SUBSCRIBE_OPTIONS_NL_SHIFT&c.SUBSCRIBE_OPTIONS_NL_MASK)!==0,g=(s>>c.SUBSCRIBE_OPTIONS_RAP_SHIFT&c.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,d=s>>c.SUBSCRIBE_OPTIONS_RH_SHIFT&c.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),o("_parseSubscribe: push subscription `%s` to subscription",f),e.subscriptions.push(f)}}}_parseSuback(){o("_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._pos2?(e.reasonCode=this._parseByte(),o("_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(o("_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 o("_parseDisconnect result: true"),!0}_parseAuth(){o("_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),o("_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):(o("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let t=this._parseNum(),s=t+this._pos;if(t===-1||s>this._list.length||s>this.packet.length)return null;let u=this._list.toString("utf8",this._pos,s);return this._pos+=t,o("_parseString: result: %s",u),u}_parseStringPair(){return o("_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 s=this._list.slice(this._pos,t);return this._pos+=e,o("_parseBuffer: result: %o",s),s}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,o("_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,o("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){o("_parseVarByteNum");let t=4,s=0,u=1,d=0,g=!1,_,f=this._pos?this._pos:0;for(;s=s&&this._emitError(new Error("Invalid variable byte integer")),f&&(this._pos+=s),g=g?e?{bytes:s,value:d}:d:!1,o("_parseVarByteNum: result: %o",g),g}_parseByte(){let e;return this._pos=4)&&(b||q))w+=h.byteLength(b)+2;else{if(I<4)return k.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(q*1===0)return k.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof Y!="number"||Y<0||Y>65535||Y%1!==0)return k.emit("error",new Error("Invalid keepalive")),!1;if(w+=2,w+=1,I===5){var D=W(k,a);if(!D)return!1;w+=D.length}if(N){if(typeof N!="object")return k.emit("error",new Error("Invalid will")),!1;if(!N.topic||typeof N.topic!="string")return k.emit("error",new Error("Invalid will topic")),!1;if(w+=h.byteLength(N.topic)+2,w+=2,N.payload)if(N.payload.length>=0)typeof N.payload=="string"?w+=h.byteLength(N.payload):w+=N.payload.length;else return k.emit("error",new Error("Invalid will payload")),!1;var K={};if(I===5){if(K=W(k,N.properties),!K)return!1;w+=K.length}}let J=!1;if(l!=null)if(Z(l))J=!0,w+=h.byteLength(l)+2;else return k.emit("error",new Error("Invalid username")),!1;if(n!=null){if(!J)return k.emit("error",new Error("Username is required to use password")),!1;if(Z(n))w+=le(n)+2;else return k.emit("error",new Error("Invalid password")),!1}k.write(p.CONNECT_HEADER),G(k,w),ee(k,R),te.bridgeMode&&(I+=128),k.write(I===131?p.VERSION131:I===132?p.VERSION132:I===4?p.VERSION4:I===5?p.VERSION5:p.VERSION3);let ue=0;return ue|=l!=null?p.USERNAME_MASK:0,ue|=n!=null?p.PASSWORD_MASK:0,ue|=N&&N.retain?p.WILL_RETAIN_MASK:0,ue|=N&&N.qos?N.qos<0&&g(k,b),a?.write(),r("publish: payload: %o",Y),k.write(Y)}function j(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=R.cmd||"puback",N=R.messageId,q=R.dup&&I==="pubrel"?p.DUP_MASK:0,Y=0,b=R.reasonCode,l=R.properties,n=te===5?3:2;if(I==="pubrel"&&(Y=1),typeof N!="number")return k.emit("error",new Error("Invalid messageId")),!1;let a=null;if(te===5&&typeof l=="object"){if(a=U(k,l,Q,n),!a)return!1;n+=a.length}return k.write(p.ACKS[I][Y][q][0]),G(k,n),g(k,N),te===5&&k.write(h.from([b])),a!==null&&a.write(),!0}function x(F,k,Q){r("subscribe: packet: ");let te=Q?Q.protocolVersion:4,R=F||{},I=R.dup?p.DUP_MASK:0,N=R.messageId,q=R.subscriptions,Y=R.properties,b=0;if(typeof N!="number")return k.emit("error",new Error("Invalid messageId")),!1;b+=2;let l=null;if(te===5){if(l=W(k,Y),!l)return!1;b+=l.length}if(typeof q=="object"&&q.length)for(let a=0;a2)return k.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}b+=h.byteLength(w)+2+1}else return k.emit("error",new Error("Invalid subscriptions")),!1;r("subscribe: writing to stream: %o",p.SUBSCRIBE_HEADER),k.write(p.SUBSCRIBE_HEADER[1][I?1:0][0]),G(k,b),g(k,N),l!==null&&l.write();let n=!0;for(let a of q){let w=a.topic,D=a.qos,K=+a.nl,J=+a.rap,ue=a.rh,ce;S(k,w),ce=p.SUBSCRIBE_OPTIONS_QOS[D],te===5&&(ce|=K?p.SUBSCRIBE_OPTIONS_NL:0,ce|=J?p.SUBSCRIBE_OPTIONS_RAP:0,ce|=ue?p.SUBSCRIBE_OPTIONS_RH[ue]:0),n=k.write(h.from([ce]))}return n}function O(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=R.messageId,N=R.granted,q=R.properties,Y=0;if(typeof I!="number")return k.emit("error",new Error("Invalid messageId")),!1;if(Y+=2,typeof N=="object"&&N.length)for(let l=0;lp.VARBYTEINT_MAX)return F.emit("error",new Error(`Invalid variable byte integer: ${k}`)),!1;let Q=ie[k];return Q||(Q=u(k),k<16384&&(ie[k]=Q)),r("writeVarByteInt: writing to stream: %o",Q),F.write(Q)}function S(F,k){let Q=h.byteLength(k);return g(F,Q),r("writeString: %s",k),F.write(k,"utf8")}function P(F,k,Q){S(F,k),S(F,Q)}function L(F,k){return r("writeNumberCached: number: %d",k),r("writeNumberCached: %o",e[k]),F.write(e[k])}function H(F,k){let Q=t(k);return r("writeNumberGenerated: %o",Q),F.write(Q)}function re(F,k){let Q=d(k);return r("write4ByteNumber: %o",Q),F.write(Q)}function ee(F,k){typeof k=="string"?S(F,k):k?(g(F,k.length),F.write(k)):g(F,0)}function W(F,k){if(typeof k!="object"||k.length!=null)return{length:1,write(){$(F,{},0)}};let Q=0;function te(I,N){let q=p.propertiesTypes[I],Y=0;switch(q){case"byte":{if(typeof N!="boolean")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=2;break}case"int8":{if(typeof N!="number"||N<0||N>255)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=2;break}case"binary":{if(N&&N===null)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=1+h.byteLength(N)+2;break}case"int16":{if(typeof N!="number"||N<0||N>65535)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=3;break}case"int32":{if(typeof N!="number"||N<0||N>4294967295)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=5;break}case"var":{if(typeof N!="number"||N<0||N>268435455)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=1+h.byteLength(u(N));break}case"string":{if(typeof N!="string")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=3+h.byteLength(N.toString());break}case"pair":{if(typeof N!="object")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=Object.getOwnPropertyNames(N).reduce((b,l)=>{let n=N[l];return Array.isArray(n)?b+=n.reduce((a,w)=>(a+=3+h.byteLength(l.toString())+2+h.byteLength(w.toString()),a),0):b+=3+h.byteLength(l.toString())+2+h.byteLength(N[l].toString()),b},0);break}default:return F.emit("error",new Error(`Invalid property ${I}: ${N}`)),!1}return Y}if(k)for(let I in k){let N=0,q=0,Y=k[I];if(Array.isArray(Y))for(let b=0;bI;){let q=R.shift();if(q&&k[q])delete k[q],N=W(F,k);else return!1}return N}function X(F,k,Q){switch(p.propertiesTypes[k]){case"byte":{F.write(h.from([p.properties[k]])),F.write(h.from([+Q]));break}case"int8":{F.write(h.from([p.properties[k]])),F.write(h.from([Q]));break}case"binary":{F.write(h.from([p.properties[k]])),ee(F,Q);break}case"int16":{F.write(h.from([p.properties[k]])),g(F,Q);break}case"int32":{F.write(h.from([p.properties[k]])),re(F,Q);break}case"var":{F.write(h.from([p.properties[k]])),G(F,Q);break}case"string":{F.write(h.from([p.properties[k]])),S(F,Q);break}case"pair":{Object.getOwnPropertyNames(Q).forEach(R=>{let I=Q[R];Array.isArray(I)?I.forEach(N=>{F.write(h.from([p.properties[k]])),P(F,R.toString(),N.toString())}):(F.write(h.from([p.properties[k]])),P(F,R.toString(),I.toString()))});break}default:return F.emit("error",new Error(`Invalid property ${k} value: ${Q}`)),!1}}function $(F,k,Q){G(F,Q);for(let te in k)if(Object.prototype.hasOwnProperty.call(k,te)&&k[te]!==null){let R=k[te];if(Array.isArray(R))for(let I=0;I0)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*o;case"days":case"day":case"d":return g*c;case"hours":case"hour":case"hrs":case"hr":case"h":return g*y;case"minutes":case"minute":case"mins":case"min":case"m":return g*p;case"seconds":case"second":case"secs":case"sec":case"s":return g*h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function e(u){var d=Math.abs(u);return d>=c?Math.round(u/c)+"d":d>=y?Math.round(u/y)+"h":d>=p?Math.round(u/p)+"m":d>=h?Math.round(u/h)+"s":u+"ms"}function t(u){var d=Math.abs(u);return d>=c?s(u,d,c,"day"):d>=y?s(u,d,y,"hour"):d>=p?s(u,d,p,"minute"):d>=h?s(u,d,h,"second"):u+" ms"}function s(u,d,g,_){var f=d>=g*1.5;return Math.round(u/g)+" "+_+(f?"s":"")}},{}],54:[function(m,T,v){let h=m("./lib/number-allocator.js");T.exports.NumberAllocator=h},{"./lib/number-allocator.js":55}],55:[function(m,T,v){"use strict";let h=m("js-sdsl").OrderedSet,p=m("debug")("number-allocator:trace"),y=m("debug")("number-allocator:error");function c(i,r){this.low=i,this.high=r}c.prototype.equals=function(i){return this.low===i.low&&this.high===i.high},c.prototype.compare=function(i){return this.lowe.compare(t)),p("Create"),this.clear()}o.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},o.prototype.alloc=function(){if(this.ss.size()===0)return p("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 c(r+1,e)):this.ss.eraseElementByPos(0),p("alloc():"+t),t},o.prototype.use=function(i){let r=new c(i,i),e=this.ss.lowerBound(r);if(!e.equals(this.ss.end())){let t=e.pointer.low,s=e.pointer.high;return e.pointer.equals(r)?(this.ss.eraseElementByIterator(e),p("use():"+i),!0):t>i?!1:t===i?(this.ss.updateKeyByIterator(e,new c(t+1,s)),p("use():"+i),!0):s===i?(this.ss.updateKeyByIterator(e,new c(t,s-1)),p("use():"+i),!0):(this.ss.updateKeyByIterator(e,new c(i+1,s)),this.ss.insert(new c(t,i-1)),p("use():"+i),!0)}return p("use():failed"),!1},o.prototype.free=function(i){if(ithis.max){y("free():"+i+" is out of range");return}let r=new c(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 c(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 c(i,t))}else this.ss.insert(r);else{let t=e.pointer.low,s=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 c(u,s))):this.ss.updateKeyByIterator(e,new c(u,i)):i+1===t?(this.ss.eraseElementByIterator(e.next()),this.ss.insert(new c(i,s))):this.ss.insert(r)}p("free():"+i)},o.prototype.clear=function(){p("clear()"),this.ss.clear(),this.ss.insert(new c(this.min,this.max))},o.prototype.intervalCount=function(){return this.ss.size()},o.prototype.dump=function(){console.log("length:"+this.ss.size());for(let i of this.ss)console.log(i)},T.exports=o},{debug:20,"js-sdsl":42}],56:[function(m,T,v){var h=m("wrappy");T.exports=h(p),T.exports.strict=h(y),p.proto=p(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return p(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return y(this)},configurable:!0})});function p(c){var o=function(){return o.called?o.value:(o.called=!0,o.value=c.apply(this,arguments))};return o.called=!1,o}function y(c){var o=function(){if(o.called)throw new Error(o.onceError);return o.called=!0,o.value=c.apply(this,arguments)},i=c.name||"Function wrapped with `once`";return o.onceError=i+" shouldn't be called more than once",o.called=!1,o}},{wrappy:80}],57:[function(m,T,v){(function(h){(function(){"use strict";typeof h>"u"||!h.version||h.version.indexOf("v0.")===0||h.version.indexOf("v1.")===0&&h.version.indexOf("v1.8.")!==0?T.exports={nextTick:p}:T.exports=h;function p(y,c,o,i){if(typeof y!="function")throw new TypeError('"callback" argument must be a function');var r=arguments.length,e,t;switch(r){case 0:case 1:return h.nextTick(y);case 2:return h.nextTick(function(){y.call(null,c)});case 3:return h.nextTick(function(){y.call(null,c,o)});case 4:return h.nextTick(function(){y.call(null,c,o,i)});default:for(e=new Array(r-1),t=0;t2?"one of ".concat(t," ").concat(e.slice(0,s-1).join(", "),", or ")+e[s-1]:s===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 o(e,t,s){return e.substr(!s||s<0?0:+s,t.length)===t}function i(e,t,s){return(s===void 0||s>e.length)&&(s=e.length),e.substring(s-t.length,s)===t}function r(e,t,s){return typeof s!="number"&&(s=0),s+t.length>e.length?!1:e.indexOf(t,s)!==-1}y("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),y("ERR_INVALID_ARG_TYPE",function(e,t,s){var u;typeof t=="string"&&o(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(c(t,"type"));else{var g=r(e,".")?"property":"argument";d='The "'.concat(e,'" ').concat(g," ").concat(u," ").concat(c(t,"type"))}return d+=". Received type ".concat(typeof s),d},TypeError),y("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),y("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),y("ERR_STREAM_PREMATURE_CLOSE","Premature close"),y("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),y("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),y("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),y("ERR_STREAM_WRITE_AFTER_END","write after end"),y("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),y("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),y("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),T.exports.codes=p},{}],59:[function(m,T,v){(function(h){(function(){"use strict";var p=Object.keys||function(u){var d=[];for(var g in u)d.push(g);return d};T.exports=e;var y=m("./_stream_readable"),c=m("./_stream_writable");m("inherits")(e,y);for(var o=p(c.prototype),i=0;i0)if(typeof l!="string"&&!D.objectMode&&Object.getPrototypeOf(l)!==r.prototype&&(l=t(l)),a)D.endEmitted?B(b,new x):P(b,D,l,!0);else if(D.ended)B(b,new z);else{if(D.destroyed)return!1;D.reading=!1,D.decoder&&!n?(l=D.decoder.write(l),D.objectMode||l.length!==0?P(b,D,l,!1):$(b,D)):P(b,D,l,!1)}else a||(D.reading=!1,$(b,D))}return!D.ended&&(D.length=H?b=H:(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):U(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-b0?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 W(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?U(b):(l.needReadable=!1,l.emittedReadable||(l.emittedReadable=!0,X(b)))}}function U(b){var l=b._readableState;d("emitReadable",l.needReadable,l.emittedReadable),l.needReadable=!1,l.emittedReadable||(d("emitReadable",l.flowing),l.emittedReadable=!0,h.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,R(b)}function $(b,l){l.readingMore||(l.readingMore=!0,h.nextTick(le,b,l))}function le(b,l){for(;!l.reading&&!l.ended&&(l.length1&&Y(a.pipes,b)!==-1)&&!ce&&(d("false write response, pause",a.awaitDrain),a.awaitDrain++),n.pause())}function he(Me){d("onerror",Me),xe(),b.removeListener("error",he),o(b,"error")===0&&B(b,Me)}oe(b,"error",he);function Ce(){b.removeListener("finish",Pe),xe()}b.once("close",Ce);function Pe(){d("onfinish"),b.removeListener("close",Ce),xe()}b.once("finish",Pe);function xe(){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&&o(b,"data")&&(n.flowing=!0,R(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 D=0;D0,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?U(this):a.reading||h.nextTick(k,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"&&h.nextTick(F,this),n},G.prototype.removeAllListeners=function(b){var l=i.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&h.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 k(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,Q(this,b)),b.paused=!1,this};function Q(b,l){l.resumeScheduled||(l.resumeScheduled=!0,h.nextTick(te,b,l))}function te(b,l){d("resume",l.reading),l.reading||b.read(0),l.resumeScheduled=!1,b.emit("resume"),R(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 R(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 D=0;D=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,h.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=m("./internal/streams/from")),V(G,b,l)});function Y(b,l){for(var n=0,a=b.length;n-1))throw new C(I);return this._writableState.defaultEncoding=I,this},Object.defineProperty(ie.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function P(R,I,N){return!R.objectMode&&R.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 L(R,I,N,q,Y,b){if(!N){var l=P(I,q,Y);q!==l&&(N=!0,Y="buffer",q=l)}var n=I.objectMode?1:q.length;I.length+=n;var a=I.length0?this.tail.next=E:this.head=E,this.tail=E,++this.length}},{key:"unshift",value:function(f){var E={data:f,next:this.head};this.length===0&&(this.tail=E),this.head=E,++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 E=this.head,M=""+E.data;E=E.next;)M+=f+E.data;return M}},{key:"concat",value:function(f){if(this.length===0)return e.alloc(0);for(var E=e.allocUnsafe(f>>>0),M=this.head,A=0;M;)d(M.data,E,A),A+=M.data.length,M=M.next;return E}},{key:"consume",value:function(f,E){var M;return fz.length?z.length:f;if(j===z.length?A+=z:A+=z.slice(0,f),f-=j,f===0){j===z.length?(++M,E.next?this.head=E.next:this.head=this.tail=null):(this.head=E,E.data=z.slice(j));break}++M}return this.length-=M,A}},{key:"_getBuffer",value:function(f){var E=e.allocUnsafe(f),M=this.head,A=1;for(M.data.copy(E),f-=M.data.length;M=M.next;){var z=M.data,j=f>z.length?z.length:f;if(z.copy(E,E.length-f,0,j),f-=j,f===0){j===z.length?(++A,M.next?this.head=M.next:this.head=this.tail=null):(this.head=M,M.data=z.slice(j));break}++A}return this.length-=A,E}},{key:u,value:function(f,E){return s(this,p({},E,{depth:0,customInspect:!1}))}}]),g}()},{buffer:3,util:2}],66:[function(m,T,v){(function(h){(function(){"use strict";function p(e,t){var s=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,h.nextTick(i,this,e)):h.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?s._writableState?s._writableState.errorEmitted?h.nextTick(c,s):(s._writableState.errorEmitted=!0,h.nextTick(y,s,g)):h.nextTick(y,s,g):t?(h.nextTick(c,s),t(g)):h.nextTick(c,s)}),this)}function y(e,t){i(e,t),c(e)}function c(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(){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 s=e._readableState,u=e._writableState;s&&s.autoDestroy||u&&u.autoDestroy?e.destroy(t):e.emit("error",t)}T.exports={destroy:p,undestroy:o,errorOrDestroy:r}}).call(this)}).call(this,m("_process"))},{_process:85}],67:[function(m,T,v){"use strict";var h=m("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function p(i){var r=!1;return function(){if(!r){r=!0;for(var e=arguments.length,t=new Array(e),s=0;s0;return e(z,x,O,function(C){M||(M=C),C&&A.forEach(t),!x&&(A.forEach(t),E(M))})});return _.reduce(s)}T.exports=d},{"../../../errors":58,"./end-of-stream":67}],70:[function(m,T,v){"use strict";var h=m("../../../errors").codes.ERR_INVALID_OPT_VALUE;function p(c,o,i){return c.highWaterMark!=null?c.highWaterMark:o?c[i]:null}function y(c,o,i,r){var e=p(o,r,i);if(e!=null){if(!(isFinite(e)&&Math.floor(e)===e)||e<0){var t=r?i:"highWaterMark";throw new h(t,e)}return Math.floor(e)}return c.objectMode?16:16*1024}T.exports={getHighWaterMark:y}},{"../../../errors":58}],71:[function(m,T,v){T.exports=m("events").EventEmitter},{events:4}],72:[function(m,T,v){v=T.exports=m("./lib/_stream_readable.js"),v.Stream=v,v.Readable=v,v.Writable=m("./lib/_stream_writable.js"),v.Duplex=m("./lib/_stream_duplex.js"),v.Transform=m("./lib/_stream_transform.js"),v.PassThrough=m("./lib/_stream_passthrough.js"),v.finished=m("./lib/internal/streams/end-of-stream.js"),v.pipeline=m("./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(m,T,v){"use strict";function h(y,c,o){var i=this;this._callback=y,this._args=o,this._interval=setInterval(y,c,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 p(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var y;if(arguments.length>0){y=new Array(arguments.length-2);for(var c=0;c>5===6?2:A>>4===14?3:A>>3===30?4:A>>6===2?-1:-2}function r(A,z,j){var x=z.length-1;if(x=0?(O>0&&(A.lastNeed=O-1),O):--x=0?(O>0&&(A.lastNeed=O-2),O):--x=0?(O>0&&(O===2?O=0:A.lastNeed=O-3),O):0))}function e(A,z,j){if((z[0]&192)!==128)return A.lastNeed=0,"\uFFFD";if(A.lastNeed>1&&z.length>1){if((z[1]&192)!==128)return A.lastNeed=1,"\uFFFD";if(A.lastNeed>2&&z.length>2&&(z[2]&192)!==128)return A.lastNeed=2,"\uFFFD"}}function t(A){var z=this.lastTotal-this.lastNeed,j=e(this,A,z);if(j!==void 0)return j;if(this.lastNeed<=A.length)return A.copy(this.lastChar,z,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);A.copy(this.lastChar,z,0,A.length),this.lastNeed-=A.length}function s(A,z){var j=r(this,A,z);if(!this.lastNeed)return A.toString("utf8",z);this.lastTotal=j;var x=A.length-(j-this.lastNeed);return A.copy(this.lastChar,0,x),A.toString("utf8",z,x)}function u(A){var z=A&&A.length?this.write(A):"";return this.lastNeed?z+"\uFFFD":z}function d(A,z){if((A.length-z)%2===0){var j=A.toString("utf16le",z);if(j){var x=j.charCodeAt(j.length-1);if(x>=55296&&x<=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",z,A.length-1)}function g(A){var z=A&&A.length?this.write(A):"";if(this.lastNeed){var j=this.lastTotal-this.lastNeed;return z+this.lastChar.toString("utf16le",0,j)}return z}function _(A,z){var j=(A.length-z)%3;return j===0?A.toString("base64",z):(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",z,A.length-j))}function f(A){var z=A&&A.length?this.write(A):"";return this.lastNeed?z+this.lastChar.toString("base64",0,3-this.lastNeed):z}function E(A){return A.toString(this.encoding)}function M(A){return A&&A.length?this.write(A):""}},{"safe-buffer":76}],79:[function(m,T,v){(function(h){(function(){T.exports=p;function p(c,o){if(y("noDeprecation"))return c;var i=!1;function r(){if(!i){if(y("throwDeprecation"))throw new Error(o);y("traceDeprecation")?console.trace(o):console.warn(o),i=!0}return c.apply(this,arguments)}return r}function y(c){try{if(!h.localStorage)return!1}catch{return!1}var o=h.localStorage[c];return o==null?!1:String(o).toLowerCase()==="true"}}).call(this)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],80:[function(m,T,v){T.exports=h;function h(p,y){if(p&&y)return h(p)(y);if(typeof p!="function")throw new TypeError("need wrapper function");return Object.keys(p).forEach(function(o){c[o]=p[o]}),c;function c(){for(var o=new Array(arguments.length),i=0;i0)for(var e=0,t=arguments.length;e1)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 s=0;t!==null;s++)e=i(e,t.value,s),t=t.next;return e},h.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 s=this.length-1;t!==null;s--)e=i(e,t.value,s),t=t.prev;return e},h.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},h.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},h.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 h;if(rthis.length&&(r=this.length);for(var t=0,s=this.head;s!==null&&tthis.length&&(r=this.length);for(var t=this.length,s=this.tail;s!==null&&t>r;t--)s=s.prev;for(;s!==null&&t>i;t--,s=s.prev)e.push(s.value);return e},h.prototype.splice=function(i,r,...e){i>this.length&&(i=this.length-1),i<0&&(i=this.length+i);for(var t=0,s=this.head;s!==null&&t1)for(var A=1;A= 0x80 (not a basic code point)","invalid-input":"Invalid input"},j=e-t,x=Math.floor,O=String.fromCharCode,C;function V(W){throw new RangeError(z[W])}function B(W,U){for(var X=W.length,$=[];X--;)$[X]=U(W[X]);return $}function ne(W,U){var X=W.split("@"),$="";X.length>1&&($=X[0]+"@",W=X[1]),W=W.replace(A,".");var le=W.split("."),Z=B(le,U).join(".");return $+Z}function oe(W){for(var U=[],X=0,$=W.length,le,Z;X<$;)le=W.charCodeAt(X++),le>=55296&&le<=56319&&X<$?(Z=W.charCodeAt(X++),(Z&64512)==56320?U.push(((le&1023)<<10)+(Z&1023)+65536):(U.push(le),X--)):U.push(le);return U}function ie(W){return B(W,function(U){var X="";return U>65535&&(U-=65536,X+=O(U>>>10&1023|55296),U=56320|U&1023),X+=O(U),X}).join("")}function G(W){return W-48<10?W-22:W-65<26?W-65:W-97<26?W-97:e}function S(W,U){return W+22+75*(W<26)-((U!=0)<<5)}function P(W,U,X){var $=0;for(W=X?x(W/d):W>>1,W+=x(W/U);W>j*s>>1;$+=e)W=x(W/j);return x($+(j+1)*W/(W+u))}function L(W){var U=[],X=W.length,$,le=0,Z=_,F=g,k,Q,te,R,I,N,q,Y,b;for(k=W.lastIndexOf(f),k<0&&(k=0),Q=0;Q=128&&V("not-basic"),U.push(W.charCodeAt(Q));for(te=k>0?k+1:0;te=X&&V("invalid-input"),q=G(W.charCodeAt(te++)),(q>=e||q>x((r-le)/I))&&V("overflow"),le+=q*I,Y=N<=F?t:N>=F+s?s:N-F,!(qx(r/b)&&V("overflow"),I*=b;$=U.length+1,F=P(le-R,$,R==0),x(le/$)>r-Z&&V("overflow"),Z+=x(le/$),le%=$,U.splice(le++,0,Z)}return ie(U)}function H(W){var U,X,$,le,Z,F,k,Q,te,R,I,N=[],q,Y,b,l;for(W=oe(W),q=W.length,U=_,X=0,Z=g,F=0;F=U&&Ix((r-X)/Y)&&V("overflow"),X+=(k-U)*Y,U=k,F=0;Fr&&V("overflow"),I==U){for(Q=X,te=e;R=te<=Z?t:te>=Z+s?s:te-Z,!(Q0&&s>t&&(s=t);for(var u=0;u=0?(_=d.substr(0,g),f=d.substr(g+1)):(_=d,f=""),E=decodeURIComponent(_),M=decodeURIComponent(f),h(r,E)?p(r[E])?r[E].push(M):r[E]=[r[E],M]:r[E]=M}return r};var p=Array.isArray||function(y){return Object.prototype.toString.call(y)==="[object Array]"}},{}],88:[function(m,T,v){"use strict";var h=function(o){switch(typeof o){case"string":return o;case"boolean":return o?"true":"false";case"number":return isFinite(o)?o:"";default:return""}};T.exports=function(o,i,r,e){return i=i||"&",r=r||"=",o===null&&(o=void 0),typeof o=="object"?y(c(o),function(t){var s=encodeURIComponent(h(t))+r;return p(o[t])?y(o[t],function(u){return s+encodeURIComponent(h(u))}).join(i):s+encodeURIComponent(h(o[t]))}).join(i):e?encodeURIComponent(h(e))+r+encodeURIComponent(h(o)):""};var p=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"};function y(o,i){if(o.map)return o.map(i);for(var r=[],e=0;e",'"',"`"," ","\r",` `," "],e=["{","}","|","\\","^","`"].concat(r),t=["'"].concat(e),s=["%","/","?",";","#"].concat(t),u=["/","?","#"],d=255,g=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=m("querystring");function z(C,V,B){if(C&&p.isObject(C)&&C instanceof y)return C;var ne=new y;return ne.parse(C,V,B),ne}y.prototype.parse=function(C,V,B){if(!p.isString(C))throw new TypeError("Parameter 'url' must be a string, not "+typeof C);var ne=C.indexOf("?"),oe=ne!==-1&&ne127?Q+="x":Q+=k[te];if(!Q.match(g)){var I=Z.slice(0,W),N=Z.slice(W+1),q=k.match(_);q&&(I.push(q[1]),N.unshift(q[2])),N.length&&(S="/"+N.join(".")+S),this.hostname=I.join(".");break}}}this.hostname.length>d?this.hostname="":this.hostname=this.hostname.toLowerCase(),le||(this.hostname=h.toASCII(this.hostname));var Y=this.port?":"+this.port:"",b=this.hostname||"";this.host=b+Y,this.href+=this.host,le&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),S[0]!=="/"&&(S="/"+S))}if(!f[H])for(var W=0,F=t.length;W0?B.host.split("@"):!1;Q&&(B.auth=Q.shift(),B.host=B.hostname=Q.shift())}return B.search=C.search,B.query=C.query,(!p.isNull(B.pathname)||!p.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],R=(B.host||C.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(!$&&!le)for(;I--;I)Z.unshift("..");$&&Z[0]!==""&&(!Z[0]||Z[0].charAt(0)!=="/")&&Z.unshift(""),R&&Z.join("/").substr(-1)!=="/"&&Z.push("");var q=Z[0]===""||Z[0]&&Z[0].charAt(0)==="/";if(k){B.hostname=B.host=q?"":Z.length?Z.shift():"";var Q=B.host&&B.host.indexOf("@")>0?B.host.split("@"):!1;Q&&(B.auth=Q.shift(),B.host=B.hostname=Q.shift())}return $=$||B.host&&Z.length,$&&!q&&Z.unshift(""),Z.length?B.pathname=Z.join("/"):(B.pathname=null,B.path=null),(!p.isNull(B.pathname)||!p.isNull(B.search))&&(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.auth=C.auth||B.auth,B.slashes=B.slashes||C.slashes,B.href=B.format(),B},y.prototype.parseHost=function(){var C=this.host,V=o.exec(C);V&&(V=V[0],V!==":"&&(this.port=V.substr(1)),C=C.substr(0,C.length-V.length)),C&&(this.hostname=C)}},{"./util":91,punycode:86,querystring:89}],91:[function(m,T,v){"use strict";T.exports={isString:function(h){return typeof h=="string"},isObject:function(h){return typeof h=="object"&&h!==null},isNull:function(h){return h===null},isNullOrUndefined:function(h){return h==null}}},{}]},{},[17])(17)})});function ri(se,ae){if(se&1&&(ge(0,"th",5),we(1),de()),se&2){let me=ae.$implicit;pe(),Se(me.title)}}function ii(se,ae){if(se&1&&(ge(0,"td",7),we(1),de()),se&2){let me=ae.$implicit,m=ke().$implicit;pe(),Se(m[me.key])}}function ni(se,ae){if(se&1&&(ge(0,"tr"),Ae(1,ii,2,1,"td",6),de()),se&2){let me=ke();pe(),_e("ngForOf",me.columns)}}var bi=(()=>{let ae=class ae{constructor(){this.columns=[],this.data=[]}ngOnInit(){console.log(this.data)}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["app-data-v-lj-table"]],inputs:{columns:"columns",data:"data"},standalone:!0,features:[Ee],decls:7,vars:4,consts:[["nzBordered","","nzSize","small",3,"nzData","nzPageSize"],["dynamicTable",""],["style",` background: rgb(8 22 48); /* color: #bfceff !important; */ color: #75f9fd; text-align: center; border: 0.5px solid #ffffff !important; `,"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",`*/ 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(T,v){if(T&1&&(ge(0,"nz-table",0,1)(2,"thead")(3,"tr"),Ae(4,ri,2,1,"th",2),de()(),ge(5,"tbody",3),Ae(6,ni,2,1,"tr",4),de()()),T&2){let h=Tt(1);_e("nzData",v.data)("nzPageSize",5),pe(4),_e("ngForOf",v.columns),pe(2),_e("ngForOf",h.data)}},dependencies:[je,ze,at,et,ut,ct,lt,ot,Ue,Je,Ze,gt,nt,rt,tt,De,Ge,$e,ft,dt,qe,ht,it,He,Xe,Ye,dr,hr,fr,pr,yr,gr,mr,pt,Fe,Le,st,Ve,Ne,We,Qe,Be,Pt,Ke],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 se=ae;return se})();var si=["myGrid"],Si=(()=>{let ae=class ae{constructor(){this.defaultColDef={width:130,editable:!1},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz"}ngOnInit(){console.log("-----\u8868\u683C\u521D\u59CB\u5316-----"),this.pageSize=10,this.pageIndex=1,this.pageRowTotal=this.rowData.length}nzPageSizeChange(m){this.pageSize=m}nzPageIndexChange(m){console.log(`nzPageIndexChange${m}`),this.grid.api&&(m==1?this.grid.api.paginationGoToFirstPage():this.grid.api.paginationGoToPage(m))}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["app-ag-grid-component"]],viewQuery:function(T,v){if(T&1&&Ct(si,5),T&2){let h;xt(h=It())&&(v.grid=h.first)}},inputs:{defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Ee],decls:7,vars:15,consts:[[3,"pagination","suppressPaginationPanel","suppressScrollOnNewData","paginationPageSize","defaultColDef","rowData","columnDefs"],["myGrid",""],[1,"grid-pagination"],[1,"page-total-style"],["nzShowSizeChanger","",3,"nzPageIndex","nzPageSize","nzTotal","className","nzPageSizeChange","nzPageIndexChange"]],template:function(T,v){T&1&&(Ie(0,"ag-grid-angular",0,1)(2,"br"),ge(3,"div",2)(4,"div",3),we(5),de(),ge(6,"nz-pagination",4),Te("nzPageSizeChange",function(p){return v.nzPageSizeChange(p)})("nzPageIndexChange",function(p){return v.nzPageIndexChange(p)}),de()()),T&2&&(vt(v.gridThemeClass),_e("pagination",!0)("suppressPaginationPanel",!0)("suppressPaginationPanel",!0)("suppressScrollOnNewData",!0)("paginationPageSize",v.pageSize)("defaultColDef",v.defaultColDef)("rowData",v.rowData)("columnDefs",v.columnDefs),pe(5),At("\u5171 ",v.pageRowTotal," \u9879\u6570\u636E"),pe(),_e("nzPageIndex",v.pageIndex)("nzPageSize",v.pageSize)("nzTotal",v.pageRowTotal)("className",v.paginationThemeClass))},dependencies:[kt,Ke,Rt],styles:[".grid-pagination[_ngcontent-%COMP%]{display:flex;justify-content:space-between;height:32px}.grid-pagination[_ngcontent-%COMP%] .ant-select-selection-item, .ant-select-selector[_ngcontent-%COMP%]{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .page-total-style{font-size:medium;font-weight:700;color:#00eff8} .ant-select-item-option{color:#00eff8!important} .ant-select-item-option-active div{font-weight:800!important;color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .anticon{color:#00eff8}.grid-pagination[_ngcontent-%COMP%] .ant-select-selector{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-prev .ant-pagination-item-link{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item a{color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active a{color:#000!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-next button, .ant-pagination-prev[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active:focus-visible, .ant-pagination-item-active[_ngcontent-%COMP%]:hover, .ant-pagination-next[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%], .ant-pagination-prev[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%]{border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active{font-weight:500;background-color:#00eff8;border-color:#00eff8;border-width:2px}"]});let se=ae;return se})();var xi=(()=>{let ae=class ae{agInit(m){this.cellValue=this.getValueToDisplay(m)}refresh(m){return this.cellValue=this.getValueToDisplay(m),!0}buttonClicked(){alert(`\u70B9\u51FB\u4E86 ${this.cellValue}`)}getValueToDisplay(m){return m.valueFormatted?m.valueFormatted:m.value}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["ng-component"]],standalone:!0,features:[Ee],decls:3,vars:1,consts:[[2,"display","flex","justify-content","center","align-items","center","height","100%"],[1,"ag-grid-button-style",3,"click"]],template:function(T,v){T&1&&(ge(0,"span",0)(1,"button",1),Te("click",function(){return v.buttonClicked()}),we(2),de()()),T&2&&(pe(2),Se(v.cellValue))},styles:[".ag-grid-button-style[_ngcontent-%COMP%]{cursor:pointer;display:inline-block;width:90px;margin:4px;padding:8px 12px;font-weight:800;color:#e0e0e0;text-align:center;text-decoration:none;background-color:#1e4d6b;border:none;transition:background-color .3s,color .3s}.ag-grid-button-style[_ngcontent-%COMP%]:hover{color:#fff;text-decoration:underline;background-color:#3a6d8c}"]});let se=ae;return se})();var li=["*"],$r=(()=>{let ae=class ae{constructor(){this.showSetting=!1,this.optionsList=[],this.onCheckedItemsChange=new be,this.title=""}getCheckedItems(){return this.optionsList.filter(m=>m.checked)}onCheckChange(){let m=this.getCheckedItems();this.onCheckedItemsChange.emit(m)}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["lj-data-v-card"]],inputs:{showSetting:"showSetting",optionsList:"optionsList",title:"title"},outputs:{onCheckedItemsChange:"onCheckedItemsChange"},standalone:!0,features:[Ee],ngContentSelectors:li,decls:7,vars:1,consts:[[1,"card-content"],[1,"card-top-content"],[1,"card-content-title"],[1,"card-content-l"],["nz-icon","","nzType","setting","nzTheme","outline"]],template:function(T,v){T&1&&(Et(),ge(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),we(4),de()(),Ie(5,"span",4),de(),St(6),de()),T&2&&(pe(4),Se(v.title))},dependencies:[Ne,Mt,Be,He,je,ze,at,et,ut,ct,lt,ot,Ue,Je,Ze,gt,nt,rt,tt,De,Ot,Ge,$e,ft,dt,qe,ht,it,Xe,Ye,pt,Fe,Le,st,Ve,We,Qe],styles:['.card-content-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;width:fit-content;height:fit-content;padding:5px 20px 0;font-size:16px;color:#29b6f6;text-align:center;background-color:#19426e;border:1px solid #1f6f97;border-radius:10px 10px 0 0;box-shadow:inset 0 0 10px #1f6f97}.card-top-content[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto auto;align-items:center;justify-content:space-between}.card-content[_ngcontent-%COMP%]{overflow:hidden;margin-bottom:.5rem;padding:1rem 1.5rem;background-image:url("./media/dashboard_card_bg-2QFDBQFD.jpg");background-repeat:no-repeat;background-position:center;background-size:100% 100%}.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%]{flex:1;align-self:flex-start}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-r[_ngcontent-%COMP%]{align-self:flex-end}']});let se=ae;return se})();var ui=["myGrid"],Wi=(()=>{let ae=class ae{constructor(){this.title="",this.showSetting=!0,this.defaultColDef={width:130,editable:!1,headerClass:"ag-header-center",cellStyle:{"font-weight":"bold",textAlign:"center","justify-content":"center","line-height":"38px"}},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz",this.tableColumns=[{key:"sort",title:"\u5E8F\u53F7"},{key:"time",title:"\u65F6\u95F4"},{key:"option",title:"\u64CD\u4F5C"},{key:"optionDesc",title:"\u64CD\u4F5C\u63CF\u8FF0"},{key:"optionMan",title:"\u64CD\u4F5C\u4EBA\u5458"},{key:"mark",title:"\u5907\u6CE8"},{key:"edit",title:"\u7F16\u8F91"}],this.tableData=[{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"}]}ngOnInit(){this.title?console.log("Title has been passed:",this.title):console.log("Title has not been passed"),console.log("-----\u8868\u683C\u521D\u59CB\u5316-----"),this.pageSize=10,this.pageIndex=1,this.pageRowTotal=this.rowData.length}nzPageSizeChange(m){this.pageSize=m}nzPageIndexChange(m){console.log(`nzPageIndexChange${m}`),this.grid.api&&(m==1?this.grid.api.paginationGoToFirstPage():this.grid.api.paginationGoToPage(m))}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["lj-app-ag-grid-component"]],viewQuery:function(T,v){if(T&1&&Ct(ui,5),T&2){let h;xt(h=It())&&(v.grid=h.first)}},inputs:{title:"title",defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Ee],decls:8,vars:17,consts:[["nz-col","","nzSpan","24","nzXs","24","nzSm","24","nzMd","12","nzLg","12","nzXl","12","nzXXl","12",3,"title"],[3,"pagination","suppressPaginationPanel","suppressScrollOnNewData","paginationPageSize","defaultColDef","rowData","columnDefs","rowHeight"],["myGrid",""],[1,"grid-pagination"],[1,"page-total-style"],["nzShowSizeChanger","",3,"nzPageIndex","nzPageSize","nzTotal","className","nzPageSizeChange","nzPageIndexChange"]],template:function(T,v){T&1&&(ge(0,"lj-data-v-card",0),Ie(1,"ag-grid-angular",1,2)(3,"br"),ge(4,"div",3)(5,"div",4),we(6),de(),ge(7,"nz-pagination",5),Te("nzPageSizeChange",function(p){return v.nzPageSizeChange(p)})("nzPageIndexChange",function(p){return v.nzPageIndexChange(p)}),de()()()),T&2&&(tr("title",v.title),pe(),vt(v.gridThemeClass),_e("pagination",!0)("suppressPaginationPanel",!0)("suppressPaginationPanel",!0)("suppressScrollOnNewData",!0)("paginationPageSize",v.pageSize)("defaultColDef",v.defaultColDef)("rowData",v.rowData)("columnDefs",v.columnDefs)("rowHeight",38),pe(5),At("\u5171 ",v.pageRowTotal," \u9879\u6570\u636E"),pe(),_e("nzPageIndex",v.pageIndex)("nzPageSize",v.pageSize)("nzTotal",v.pageRowTotal)("className",v.paginationThemeClass))},dependencies:[kt,Ke,Rt,$r],styles:[".grid-pagination[_ngcontent-%COMP%]{display:flex;justify-content:space-between;height:32px}.grid-pagination[_ngcontent-%COMP%] .ant-select-selection-item, .ant-select-selector[_ngcontent-%COMP%]{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .page-total-style{font-size:medium;font-weight:700;color:#00eff8} .ant-select-item-option{color:#00eff8!important} .ant-select-item-option-active div{font-weight:800!important;color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .anticon{color:#00eff8}.grid-pagination[_ngcontent-%COMP%] .ant-select-selector{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-prev .ant-pagination-item-link{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item a{color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active a{color:#000!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-next button, .ant-pagination-prev[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active:focus-visible, .ant-pagination-item-active[_ngcontent-%COMP%]:hover, .ant-pagination-next[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%], .ant-pagination-prev[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%]{border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active{font-weight:500;background-color:#00eff8;border-color:#00eff8;border-width:2px}"]});let se=ae;return se})();function ci(se,ae){if(se&1){let me=er();ge(0,"li",9)(1,"label",10),Te("ngModelChange",function(T){let h=Ft(me).$implicit;return Ut(h.checked=T)})("ngModelChange",function(){Ft(me);let T=ke(2);return Ut(T.onCheckChange())}),we(2),de()()}if(se&2){let me=ae.$implicit;pe(),_e("ngModel",me.checked),pe(),Se(me.label)}}function fi(se,ae){if(se&1&&(ge(0,"div",4),Ie(1,"a",5),ge(2,"nz-dropdown-menu",null,6)(4,"ul",7),Ae(5,ci,3,2,"li",8),de()()()),se&2){let me=Tt(3),m=ke();pe(),_e("nzDropdownMenu",me),pe(4),_e("ngForOf",m.optionsList)}}var hi=["*"],en=(()=>{let ae=class ae{constructor(){this.showSetting=!1,this.optionsList=[],this.onCheckedItemsChange=new be,this.title=""}getCheckedItems(){return this.optionsList.filter(m=>m.checked)}onCheckChange(){let m=this.getCheckedItems();this.onCheckedItemsChange.emit(m)}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["data-v-card"]],inputs:{showSetting:"showSetting",optionsList:"optionsList",title:"title"},outputs:{onCheckedItemsChange:"onCheckedItemsChange"},standalone:!0,features:[Ee],ngContentSelectors:hi,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(T,v){T&1&&(Et(),ge(0,"div",0)(1,"div",1)(2,"div",2),we(3),de(),Ae(4,fi,6,2,"div",3),de(),St(5),de()),T&2&&(pe(3),Se(v.title),pe(),_e("ngIf",v.showSetting))},dependencies:[Ne,Mt,Be,Pt,rr,He,ar,sr,lr,ur,cr,je,ir,nr,ze,at,et,ut,ct,lt,ot,Ue,Je,Ze,gt,nt,rt,tt,De,Ot,Ge,$e,ft,dt,qe,ht,it,Xe,Ye,pt,Fe,Le,st,Ve,We,or,Qe],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 se=ae;return se})();var fn=Vt(zt(),1),Xr=Vt(zt(),1);var yt=function(se){return se[se.CLOSED=0]="CLOSED",se[se.CONNECTING=1]="CONNECTING",se[se.CONNECTED=2]="CONNECTED",se}(yt||{});var pi=new Dt("NgxMqttServiceConfig"),di=new Dt("NgxMqttClientService");function Bt(se,...ae){if(!ae.length)return se;let me=ae.shift();if(Wt(se)&&Wt(me))for(let m in me)Wt(me[m])?(se[m]||Object.assign(se,{[m]:{}}),Bt(se[m],me[m])):Object.assign(se,{[m]:me[m]});return Bt(se,...ae)}function Wt(se){return se&&typeof se=="object"&&!Array.isArray(se)}var dn=(()=>{let ae=class ae{constructor(m,T){this.options=m,this.observables={},this.state=new Qt(yt.CLOSED),this.messages=new Nt,this._clientId=this._generateClientId(),this._connectTimeout=1e4,this._reconnectPeriod=1e4,this._onConnect=new be,this._onReconnect=new be,this._onClose=new be,this._onOffline=new be,this._onError=new be,this._onEnd=new be,this._onMessage=new be,this._onSuback=new be,this._onPacketsend=new be,this._onPacketreceive=new be,this._handleOnConnect=v=>{this.options.connectOnCreate===!0&&Object.keys(this.observables).forEach(h=>{this.client.subscribe(h)}),this.state.next(yt.CONNECTED),this._onConnect.emit(v)},this._handleOnReconnect=()=>{this.options.connectOnCreate===!0&&Object.keys(this.observables).forEach(v=>{this.client.subscribe(v)}),this.state.next(yt.CONNECTING),this._onReconnect.emit()},this._handleOnClose=()=>{this.state.next(yt.CLOSED),this._onClose.emit()},this._handleOnOffline=()=>{this._onOffline.emit()},this._handleOnError=v=>{this._onError.emit(v),console.error(v)},this._handleOnEnd=()=>{this._onEnd.emit()},this._handleOnMessage=(v,h,p)=>{this._onMessage.emit(p),p.cmd==="publish"&&this.messages.next(p)},this._handleOnPacketsend=v=>{this._onPacketsend.emit(v)},this._handleOnPacketreceive=v=>{this._onPacketreceive.emit(v)},m.connectOnCreate!==!1&&this.connect({},T),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(m,T){if(m[0]==="#"&&T[0]==="$")return!1;let v=(m||"").split("/").reverse(),h=(T||"").split("/").reverse(),p=()=>{let y=v.pop(),c=h.pop();switch(y){case"#":return!0;case"+":return c?p():!1;default:return y===c&&(y===void 0?!0:p())}};return p()}connect(m,T){let v=Bt(this.options||{},m),h=v.protocol||"ws",p=v.hostname||"localhost";v.url?this._url=v.url:(this._url=`${h}://${p}`,this._url+=v.port?`:${v.port}`:"",this._url+=v.path?`${v.path}`:""),this.state.next(yt.CONNECTING);let y=Bt({clientId:this._clientId,reconnectPeriod:this._reconnectPeriod,connectTimeout:this._connectTimeout},v);this.client&&this.client.end(!0),T?this.client=T:this.client=(0,Xr.connect)(this._url,y),this._clientId=y.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(m=!0){if(!this.client)throw new Error("mqtt client not connected");this.client.end(m)}observeRetained(m,T={qos:1}){return this._generalObserve(m,()=>Xt(1),T)}observe(m,T={qos:1}){return this._generalObserve(m,()=>Jt(),T)}_generalObserve(m,T,v){if(!this.client)throw new Error("mqtt client not connected");if(!this.observables[m]){let h=new Nt;this.observables[m]=$t(()=>{let p=new Ht;return this.client.subscribe(m,v,(y,c)=>{c&&c.forEach(o=>{o.qos===128&&(delete this.observables[o.topic],this.client.unsubscribe(o.topic),h.error(`subscription for '${o.topic}' rejected!`)),this._onSuback.emit({filter:m,granted:o.qos!==128})})}),p.add(()=>{delete this.observables[m],this.client.unsubscribe(m)}),p},p=>Yt(h,this.messages)).pipe(Gt(p=>ae.filterMatchesTopic(m,p.topic)),T(),Kt())}return this.observables[m]}publish(m,T,v={}){if(!this.client)throw new Error("mqtt client not connected");return qt.create(h=>{this.client.publish(m,T,v,p=>{p?h.error(p):(h.next(),h.complete())})})}unsafePublish(m,T,v={}){if(!this.client)throw new Error("mqtt client not connected");this.client.publish(m,T,v,h=>{if(h)throw h})}_generateClientId(){return"client-"+Math.random().toString(36).substr(2,19)}};ae.\u0275fac=function(T){return new(T||ae)(Lt(pi),Lt(di))},ae.\u0275prov=Zt({token:ae,factory:ae.\u0275fac,providedIn:"root"});let se=ae;return se})();export{Si as a,xi as b,bi as c,Wi as d,en as e,dn as f};