vue-pure-admin/static/js/mqtt-client-ZGf0bolU.js

3 lines
237 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Re=Object.defineProperty,Be=Object.defineProperties;var Ne=Object.getOwnPropertyDescriptors;var me=Object.getOwnPropertySymbols;var Ee=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable;var Se=(ie,oe,I)=>oe in ie?Re(ie,oe,{enumerable:!0,configurable:!0,writable:!0,value:I}):ie[oe]=I,be=(ie,oe)=>{for(var I in oe||(oe={}))Ee.call(oe,I)&&Se(ie,I,oe[I]);if(me)for(var I of me(oe))Ce.call(oe,I)&&Se(ie,I,oe[I]);return ie},ve=(ie,oe)=>Be(ie,Ne(oe));var Te=(ie,oe)=>{var I={};for(var z in ie)Ee.call(ie,z)&&oe.indexOf(z)<0&&(I[z]=ie[z]);if(ie!=null&&me)for(var z of me(ie))oe.indexOf(z)<0&&Ce.call(ie,z)&&(I[z]=ie[z]);return I};import{c as fe,d as Le,r as je,a as he,o as Ue,b as _e,e as ge,w as ee,f as J,g as pe,h as ce,i as xe,u as de,j as ae,t as Ae,k as Ie,l as Pe,F as Oe}from"./index-DMqaFtX4.js";import{c as we}from"./_commonjs-dynamic-modules-TDtrdbi3.js";var ke={exports:{}},Me;function qe(){return Me||(Me=1,function(ie,oe){(function(I){ie.exports=I()})(function(){return function(){return function I(z,q,w){function p(i,e){if(!q[i]){if(!z[i]){var a=typeof we=="function"&&we;if(!e&&a)return a(i,!0);if(d)return d(i,!0);var n=new Error("Cannot find module '"+i+"'");throw n.code="MODULE_NOT_FOUND",n}var t=q[i]={exports:{}};z[i][0].call(t.exports,function(o){return p(z[i][1][o]||o)},t,t.exports,I,z,q,w)}return q[i].exports}for(var d=typeof we=="function"&&we,u=0;u<w.length;u++)p(w[u]);return p}}()({1:[function(I,z,q){(function(w,p){(function(){const d=I("events").EventEmitter,u=I("./store"),i=I("./topic-alias-recv"),e=I("./topic-alias-send"),a=I("mqtt-packet"),n=I("./default-message-id-provider"),t=I("readable-stream").Writable,o=I("inherits"),f=I("reinterval"),l=I("rfdc/default"),h=I("./validations"),g=I("xtend"),c=I("debug")("mqttjs:client"),v=w?w.nextTick:function(k){setTimeout(k,0)},_=p.setImmediate||function(k){v(k)},E={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},T=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],S={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 F(k,A){let N;A.properties&&(N=A.properties.topicAlias);let L=A.topic.toString();if(L.length===0){if(N===void 0)return new Error("Unregistered Topic Alias");if((L=k.topicAliasSend.getTopicByAlias(N))===void 0)return new Error("Unregistered Topic Alias");A.topic=L}N&&delete A.properties.topicAlias}function W(k,A,N){c("sendPacket :: packet: %O",A),c("sendPacket :: emitting `packetsend`"),k.emit("packetsend",A),c("sendPacket :: writing to stream");const L=a.writeToStream(A,k.stream,k.options);c("sendPacket :: writeToStream result %s",L),!L&&N&&N!==y?(c("sendPacket :: handle events on `drain` once through callback."),k.stream.once("drain",N)):N&&(c("sendPacket :: invoking cb"),N())}function m(k,A,N,L){c("storeAndSend :: store packet with cmd %s to outgoingStore",A.cmd);let B,P=A;if(P.cmd==="publish"&&(P=l(A),B=F(k,P)))return N&&N(B);k.outgoingStore.put(P,function(M){if(M)return N&&N(M);L(),W(k,A,N)})}function y(k){c("nop ::",k)}function C(k,A){let N;const L=this;if(!(this instanceof C))return new C(k,A);for(N in this.options=A||{},E)this.options[N]===void 0?this.options[N]=E[N]:this.options[N]=A[N];c("MqttClient :: options.protocol",A.protocol),c("MqttClient :: options.protocolVersion",A.protocolVersion),c("MqttClient :: options.username",A.username),c("MqttClient :: options.keepalive",A.keepalive),c("MqttClient :: options.reconnectPeriod",A.reconnectPeriod),c("MqttClient :: options.rejectUnauthorized",A.rejectUnauthorized),c("MqttClient :: options.topicAliasMaximum",A.topicAliasMaximum),this.options.clientId=typeof A.clientId=="string"?A.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),c("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=A.protocolVersion===5&&A.customHandleAcks?A.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=k,this.messageIdProvider=this.options.messageIdProvider===void 0?new n:this.options.messageIdProvider,this.outgoingStore=A.outgoingStore||new u,this.incomingStore=A.incomingStore||new u,this.queueQoSZero=A.queueQoSZero===void 0||A.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,A.topicAliasMaximum>0&&(A.topicAliasMaximum>65535?c("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new i(A.topicAliasMaximum)),this.on("connect",function(){const B=this.queue;c("connect :: sending queued packets"),function P(){const M=B.shift();c("deliver :: entry %o",M);let R=null;if(!M)return void L._resubscribe();R=M.packet,c("deliver :: call _sendPacket for %o",R);let O=!0;R.messageId&&R.messageId!==0&&(L.messageIdProvider.register(R.messageId)||(O=!1)),O?L._sendPacket(R,function(U){M.cb&&M.cb(U),P()}):(c("messageId: %d has already used. The message is skipped and removed.",R.messageId),P())}()}),this.on("close",function(){c("close :: connected set to `false`"),this.connected=!1,c("close :: clearing connackTimer"),clearTimeout(this.connackTimer),c("close :: clearing ping timer"),L.pingTimer!==null&&(L.pingTimer.clear(),L.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),c("close :: calling _setupReconnect"),this._setupReconnect()}),d.call(this),c("MqttClient :: setting up stream"),this._setupStream()}o(C,d),C.prototype._setupStream=function(){const k=this,A=new t,N=a.parser(this.options);let L=null;const B=[];function P(){if(B.length)v(M);else{const O=L;L=null,O()}}function M(){c("work :: getting next packet in queue");const O=B.shift();if(O)c("work :: packet pulled from queue"),k._handlePacket(O,P);else{c("work :: no packets in queue");const U=L;L=null,c("work :: done flag is %s",!!U),U&&U()}}c("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),c("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),N.on("packet",function(O){c("parser :: on packet push to packets array."),B.push(O)}),A._write=function(O,U,H){L=H,c("writable stream :: parsing buffer"),N.parse(O),M()},c("_setupStream :: pipe stream to writable stream"),this.stream.pipe(A),this.stream.on("error",function(O){c("streamErrorHandler :: error",O.message),T.includes(O.code)?(c("streamErrorHandler :: emitting error"),k.emit("error",O)):y(O)}),this.stream.on("close",function(){var O;c("(%s)stream :: on close",k.options.clientId),(O=k.outgoing)&&(c("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(O).forEach(function(U){O[U].volatile&&typeof O[U].cb=="function"&&(O[U].cb(new Error("Connection closed")),delete O[U])})),c("stream: emit close to MqttClient"),k.emit("close")}),c("_setupStream: sending packet `connect`");const R=Object.create(this.options);if(R.cmd="connect",this.topicAliasRecv&&(R.properties||(R.properties={}),this.topicAliasRecv&&(R.properties.topicAliasMaximum=this.topicAliasRecv.max)),W(this,R),N.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return k.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"&&W(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){c("!!connectTimeout hit!! Calling _cleanUp with force `true`"),k._cleanUp(!0)},this.options.connectTimeout)},C.prototype._handlePacket=function(k,A){const N=this.options;if(N.protocolVersion===5&&N.properties&&N.properties.maximumPacketSize&&N.properties.maximumPacketSize<k.length)return this.emit("error",new Error("exceeding packets size "+k.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(c("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",k),k.cmd){case"publish":this._handlePublish(k,A);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(k),A();break;case"pubrel":this._handlePubrel(k,A);break;case"connack":this._handleConnack(k),A();break;case"auth":this._handleAuth(k),A();break;case"pingresp":this._handlePingresp(k),A();break;case"disconnect":this._handleDisconnect(k),A()}},C.prototype._checkDisconnecting=function(k){return this.disconnecting&&(k&&k!==y?k(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},C.prototype.publish=function(k,A,N,L){c("publish :: message `%s` to topic `%s`",A,k);const B=this.options;if(typeof N=="function"&&(L=N,N=null),N=g({qos:0,retain:!1,dup:!1},N),this._checkDisconnecting(L))return this;const P=this,M=function(){let R=0;if((N.qos===1||N.qos===2)&&(R=P._nextId())===null)return c("No messageId left"),!1;const O={cmd:"publish",topic:k,payload:A,qos:N.qos,retain:N.retain,messageId:R,dup:N.dup};switch(B.protocolVersion===5&&(O.properties=N.properties),c("publish :: qos",N.qos),N.qos){case 1:case 2:P.outgoing[O.messageId]={volatile:!1,cb:L||y},c("MqttClient:publish: packet cmd: %s",O.cmd),P._sendPacket(O,void 0,N.cbStorePut);break;default:c("MqttClient:publish: packet cmd: %s",O.cmd),P._sendPacket(O,L,N.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!M())&&this._storeProcessingQueue.push({invoke:M,cbStorePut:N.cbStorePut,callback:L}),this},C.prototype.subscribe=function(){const k=this,A=new Array(arguments.length);for(let V=0;V<arguments.length;V++)A[V]=arguments[V];const N=[];let L=A.shift();const B=L.resubscribe;let P=A.pop()||y,M=A.pop();const R=this.options.protocolVersion;delete L.resubscribe,typeof L=="string"&&(L=[L]),typeof P!="function"&&(M=P,P=y);const O=h.validateTopics(L);if(O!==null)return _(P,new Error("Invalid topic "+O)),this;if(this._checkDisconnecting(P))return c("subscribe: discconecting true"),this;const U={qos:0};if(R===5&&(U.nl=!1,U.rap=!1,U.rh=0),M=g(U,M),Array.isArray(L)?L.forEach(function(V){if(c("subscribe: array topic %s",V),!Object.prototype.hasOwnProperty.call(k._resubscribeTopics,V)||k._resubscribeTopics[V].qos<M.qos||B){const K={topic:V,qos:M.qos};R===5&&(K.nl=M.nl,K.rap=M.rap,K.rh=M.rh,K.properties=M.properties),c("subscribe: pushing topic `%s` and qos `%s` to subs list",K.topic,K.qos),N.push(K)}}):Object.keys(L).forEach(function(V){if(c("subscribe: object topic %s",V),!Object.prototype.hasOwnProperty.call(k._resubscribeTopics,V)||k._resubscribeTopics[V].qos<L[V].qos||B){const K={topic:V,qos:L[V].qos};R===5&&(K.nl=L[V].nl,K.rap=L[V].rap,K.rh=L[V].rh,K.properties=M.properties),c("subscribe: pushing `%s` to subs list",K),N.push(K)}}),!N.length)return P(null,[]),this;const H=function(){const V=k._nextId();if(V===null)return c("No messageId left"),!1;const K={cmd:"subscribe",subscriptions:N,qos:1,retain:!1,dup:!1,messageId:V};if(M.properties&&(K.properties=M.properties),k.options.resubscribe){c("subscribe :: resubscribe true");const $=[];N.forEach(function(G){if(k.options.reconnectPeriod>0){const r={qos:G.qos};R===5&&(r.nl=G.nl||!1,r.rap=G.rap||!1,r.rh=G.rh||0,r.properties=G.properties),k._resubscribeTopics[G.topic]=r,$.push(G.topic)}}),k.messageIdToTopic[K.messageId]=$}return k.outgoing[K.messageId]={volatile:!0,cb:function($,G){if(!$){const r=G.granted;for(let s=0;s<r.length;s+=1)N[s].qos=r[s]}P($,N)}},c("subscribe :: call _sendPacket"),k._sendPacket(K),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!H())&&this._storeProcessingQueue.push({invoke:H,callback:P}),this},C.prototype.unsubscribe=function(){const k=this,A=new Array(arguments.length);for(let R=0;R<arguments.length;R++)A[R]=arguments[R];let N=A.shift(),L=A.pop()||y,B=A.pop();typeof N=="string"&&(N=[N]),typeof L!="function"&&(B=L,L=y);const P=h.validateTopics(N);if(P!==null)return _(L,new Error("Invalid topic "+P)),this;if(k._checkDisconnecting(L))return this;const M=function(){const R=k._nextId();if(R===null)return c("No messageId left"),!1;const O={cmd:"unsubscribe",qos:1,messageId:R};return typeof N=="string"?O.unsubscriptions=[N]:Array.isArray(N)&&(O.unsubscriptions=N),k.options.resubscribe&&O.unsubscriptions.forEach(function(U){delete k._resubscribeTopics[U]}),typeof B=="object"&&B.properties&&(O.properties=B.properties),k.outgoing[O.messageId]={volatile:!0,cb:L},c("unsubscribe: call _sendPacket"),k._sendPacket(O),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!M())&&this._storeProcessingQueue.push({invoke:M,callback:L}),this},C.prototype.end=function(k,A,N){const L=this;function B(){c("end :: (%s) :: finish :: calling _cleanUp with force %s",L.options.clientId,k),L._cleanUp(k,()=>{c("end :: finish :: calling process.nextTick on closeStores"),v(function(){c("end :: closeStores: closing incoming and outgoing stores"),L.disconnected=!0,L.incomingStore.close(function(P){L.outgoingStore.close(function(M){if(c("end :: closeStores: emitting end"),L.emit("end"),N){const R=P||M;c("end :: closeStores: invoking callback with args"),N(R)}})}),L._deferredReconnect&&L._deferredReconnect()}.bind(L))},A)}return c("end :: (%s)",this.options.clientId),k!=null&&typeof k=="boolean"||(N=A||y,A=k,k=!1,typeof A!="object"&&(N=A,A=null,typeof N!="function"&&(N=y))),typeof A!="object"&&(N=A,A=null),c("end :: cb? %s",!!N),N=N||y,this.disconnecting?(N(),this):(this._clearReconnect(),this.disconnecting=!0,!k&&Object.keys(this.outgoing).length>0?(c("end :: (%s) :: calling finish in 10ms once outgoing is empty",L.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,B,10))):(c("end :: (%s) :: immediately calling finish",L.options.clientId),B()),this)},C.prototype.removeOutgoingMessage=function(k){const A=this.outgoing[k]?this.outgoing[k].cb:null;return delete this.outgoing[k],this.outgoingStore.del({messageId:k},function(){A(new Error("Message removed"))}),this},C.prototype.reconnect=function(k){c("client reconnect");const A=this,N=function(){k?(A.options.incomingStore=k.incomingStore,A.options.outgoingStore=k.outgoingStore):(A.options.incomingStore=null,A.options.outgoingStore=null),A.incomingStore=A.options.incomingStore||new u,A.outgoingStore=A.options.outgoingStore||new u,A.disconnecting=!1,A.disconnected=!1,A._deferredReconnect=null,A._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=N:N(),this},C.prototype._reconnect=function(){c("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),c("client already connected. disconnecting first.")):(c("_reconnect: calling _setupStream"),this._setupStream())},C.prototype._setupReconnect=function(){const k=this;!k.disconnecting&&!k.reconnectTimer&&k.options.reconnectPeriod>0?(this.reconnecting||(c("_setupReconnect :: emit `offline` state"),this.emit("offline"),c("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),c("_setupReconnect :: setting reconnectTimer for %d ms",k.options.reconnectPeriod),k.reconnectTimer=setInterval(function(){c("reconnectTimer :: reconnect triggered!"),k._reconnect()},k.options.reconnectPeriod)):c("_setupReconnect :: doing nothing...")},C.prototype._clearReconnect=function(){c("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},C.prototype._cleanUp=function(k,A){const N=arguments[2];if(A&&(c("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",A)),c("_cleanUp :: forced? %s",k),k)this.options.reconnectPeriod===0&&this.options.clean&&(L=this.outgoing)&&(c("flush: queue exists? %b",!!L),Object.keys(L).forEach(function(B){typeof L[B].cb=="function"&&(L[B].cb(new Error("Connection closed")),delete L[B])})),c("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const B=g({cmd:"disconnect"},N);c("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(B,_.bind(null,this.stream.end.bind(this.stream)))}var L;this.disconnecting||(c("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(c("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),A&&!this.connected&&(c("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",A),A())},C.prototype._sendPacket=function(k,A,N){c("_sendPacket :: (%s) :: start",this.options.clientId),N=N||y,A=A||y;const L=function(B,P){if(B.options.protocolVersion===5&&P.cmd==="publish"){let M;P.properties&&(M=P.properties.topicAlias);const R=P.topic.toString();if(B.topicAliasSend)if(M){if(R.length!==0&&(c("applyTopicAlias :: register topic: %s - alias: %d",R,M),!B.topicAliasSend.put(R,M)))return c("applyTopicAlias :: error out of range. topic: %s - alias: %d",R,M),new Error("Sending Topic Alias out of range")}else R.length!==0&&(B.options.autoAssignTopicAlias?(M=B.topicAliasSend.getAliasByTopic(R))?(P.topic="",P.properties=ve(be({},P.properties),{topicAlias:M}),c("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",R,M)):(M=B.topicAliasSend.getLruAlias(),B.topicAliasSend.put(R,M),P.properties=ve(be({},P.properties),{topicAlias:M}),c("applyTopicAlias :: auto assign topic: %s - alias: %d",R,M)):B.options.autoUseTopicAlias&&(M=B.topicAliasSend.getAliasByTopic(R))&&(P.topic="",P.properties=ve(be({},P.properties),{topicAlias:M}),c("applyTopicAlias :: auto use topic: %s - alias: %d",R,M)));else if(M)return c("applyTopicAlias :: error out of range. topic: %s - alias: %d",R,M),new Error("Sending Topic Alias out of range")}}(this,k);if(L)A(L);else{if(!this.connected)return k.cmd==="auth"?(this._shiftPingInterval(),void W(this,k,A)):(c("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(k,A,N));switch(this._shiftPingInterval(),k.cmd){case"publish":break;case"pubrel":return void m(this,k,A,N);default:return void W(this,k,A)}switch(k.qos){case 2:case 1:m(this,k,A,N);break;case 0:default:W(this,k,A)}c("_sendPacket :: (%s) :: end",this.options.clientId)}},C.prototype._storePacket=function(k,A,N){c("_storePacket :: packet: %o",k),c("_storePacket :: cb? %s",!!A),N=N||y;let L=k;if(L.cmd==="publish"){const B=F(this,L=l(k));if(B)return A&&A(B)}(L.qos||0)===0&&this.queueQoSZero||L.cmd!=="publish"?this.queue.push({packet:L,cb:A}):L.qos>0?(A=this.outgoing[L.messageId]?this.outgoing[L.messageId].cb:null,this.outgoingStore.put(L,function(B){if(B)return A&&A(B);N()})):A&&A(new Error("No connection to broker"))},C.prototype._setupPingTimer=function(){c("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const k=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=f(function(){k._checkPing()},1e3*this.options.keepalive))},C.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},C.prototype._checkPing=function(){c("_checkPing :: checking ping..."),this.pingResp?(c("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(c("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},C.prototype._handlePingresp=function(){this.pingResp=!0},C.prototype._handleConnack=function(k){c("_handleConnack");const A=this.options,N=A.protocolVersion===5?k.reasonCode:k.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,k.properties){if(k.properties.topicAliasMaximum){if(k.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));k.properties.topicAliasMaximum>0&&(this.topicAliasSend=new e(k.properties.topicAliasMaximum))}k.properties.serverKeepAlive&&A.keepalive&&(A.keepalive=k.properties.serverKeepAlive,this._shiftPingInterval()),k.properties.maximumPacketSize&&(A.properties||(A.properties={}),A.properties.maximumPacketSize=k.properties.maximumPacketSize)}if(N===0)this.reconnecting=!1,this._onConnect(k);else if(N>0){const L=new Error("Connection refused: "+S[N]);L.code=N,this.emit("error",L)}},C.prototype._handleAuth=function(k){const A=this.options.protocolVersion,N=A===5?k.reasonCode:k.returnCode;if(A!==5){const B=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+A);return B.code=N,void this.emit("error",B)}const L=this;this.handleAuth(k,function(B,P){if(B)L.emit("error",B);else if(N===24)L.reconnecting=!1,L._sendPacket(P);else{const M=new Error("Connection refused: "+S[N]);B.code=N,L.emit("error",M)}})},C.prototype.handleAuth=function(k,A){A()},C.prototype._handlePublish=function(k,A){c("_handlePublish: packet %o",k),A=A!==void 0?A:y;let N=k.topic.toString();const L=k.payload,B=k.qos,P=k.messageId,M=this,R=this.options,O=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let U;if(k.properties&&(U=k.properties.topicAlias),U!==void 0)if(N.length===0){if(!(U>0&&U<=65535))return c("_handlePublish :: topic alias out of range. alias: %d",U),void this.emit("error",new Error("Received Topic Alias is out of range"));{const H=this.topicAliasRecv.getTopicByAlias(U);if(!H)return c("_handlePublish :: unregistered topic alias. alias: %d",U),void this.emit("error",new Error("Received unregistered Topic Alias"));c("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",N=H,U)}}else{if(!this.topicAliasRecv.put(N,U))return c("_handlePublish :: topic alias out of range. alias: %d",U),void this.emit("error",new Error("Received Topic Alias is out of range"));c("_handlePublish :: registered topic: %s - alias: %d",N,U)}}switch(c("_handlePublish: qos %d",B),B){case 2:R.customHandleAcks(N,L,k,function(U,H){return U instanceof Error||(H=U,U=null),U?M.emit("error",U):O.indexOf(H)===-1?M.emit("error",new Error("Wrong reason code for pubrec")):void(H?M._sendPacket({cmd:"pubrec",messageId:P,reasonCode:H},A):M.incomingStore.put(k,function(){M._sendPacket({cmd:"pubrec",messageId:P},A)}))});break;case 1:R.customHandleAcks(N,L,k,function(U,H){return U instanceof Error||(H=U,U=null),U?M.emit("error",U):O.indexOf(H)===-1?M.emit("error",new Error("Wrong reason code for puback")):(H||M.emit("message",N,L,k),void M.handleMessage(k,function(V){if(V)return A&&A(V);M._sendPacket({cmd:"puback",messageId:P,reasonCode:H},A)}))});break;case 0:this.emit("message",N,L,k),this.handleMessage(k,A);break;default:c("_handlePublish: unknown QoS. Doing nothing.")}},C.prototype.handleMessage=function(k,A){A()},C.prototype._handleAck=function(k){const A=k.messageId,N=k.cmd;let L=null;const B=this.outgoing[A]?this.outgoing[A].cb:null,P=this;let M;if(B){switch(c("_handleAck :: packet type",N),N){case"pubcomp":case"puback":{const R=k.reasonCode;R&&R>0&&R!==16&&((M=new Error("Publish error: "+S[R])).code=R,B(M,k)),delete this.outgoing[A],this.outgoingStore.del(k,B),this.messageIdProvider.deallocate(A),this._invokeStoreProcessingQueue();break}case"pubrec":{L={cmd:"pubrel",qos:2,messageId:A};const R=k.reasonCode;R&&R>0&&R!==16?((M=new Error("Publish error: "+S[R])).code=R,B(M,k)):this._sendPacket(L);break}case"suback":delete this.outgoing[A],this.messageIdProvider.deallocate(A);for(let R=0;R<k.granted.length;R++)if((128&k.granted[R])!=0){const O=this.messageIdToTopic[A];O&&O.forEach(function(U){delete P._resubscribeTopics[U]})}this._invokeStoreProcessingQueue(),B(null,k);break;case"unsuback":delete this.outgoing[A],this.messageIdProvider.deallocate(A),this._invokeStoreProcessingQueue(),B(null);break;default:P.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")}else c("_handleAck :: Server sent an ack in error. Ignoring.")},C.prototype._handlePubrel=function(k,A){c("handling pubrel packet"),A=A!==void 0?A:y;const N=this,L={cmd:"pubcomp",messageId:k.messageId};N.incomingStore.get(k,function(B,P){B?N._sendPacket(L,A):(N.emit("message",P.topic,P.payload,P),N.handleMessage(P,function(M){if(M)return A(M);N.incomingStore.del(P,y),N._sendPacket(L,A)}))})},C.prototype._handleDisconnect=function(k){this.emit("disconnect",k)},C.prototype._nextId=function(){return this.messageIdProvider.allocate()},C.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},C.prototype._resubscribe=function(){c("_resubscribe");const k=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&k.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){c("_resubscribe: protocolVersion 5");for(let A=0;A<k.length;A++){const N={};N[k[A]]=this._resubscribeTopics[k[A]],N.resubscribe=!0,this.subscribe(N,{properties:N[k[A]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},C.prototype._onConnect=function(k){if(this.disconnected)return void this.emit("connect",k);const A=this;this.connackPacket=k,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function N(){let L=A.outgoingStore.createStream();function B(){A._storeProcessing=!1,A._packetIdsDuringStoreProcessing={}}function P(){L.destroy(),L=null,A._flushStoreProcessingQueue(),B()}A.once("close",P),L.on("error",function(M){B(),A._flushStoreProcessingQueue(),A.removeListener("close",P),A.emit("error",M)}),L.on("end",function(){let M=!0;for(const R in A._packetIdsDuringStoreProcessing)if(!A._packetIdsDuringStoreProcessing[R]){M=!1;break}M?(B(),A.removeListener("close",P),A._invokeAllStoreProcessingQueue(),A.emit("connect",k)):N()}),function M(){if(!L)return;A._storeProcessing=!0;const R=L.read(1);let O;R?A._packetIdsDuringStoreProcessing[R.messageId]?M():A.disconnecting||A.reconnectTimer?L.destroy&&L.destroy():(O=A.outgoing[R.messageId]?A.outgoing[R.messageId].cb:null,A.outgoing[R.messageId]={volatile:!1,cb:function(U,H){O&&O(U,H),M()}},A._packetIdsDuringStoreProcessing[R.messageId]=!0,A.messageIdProvider.register(R.messageId)?A._sendPacket(R):c("messageId: %d has already used.",R.messageId)):L.once("readable",M)}()}()},C.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const k=this._storeProcessingQueue[0];if(k&&k.invoke())return this._storeProcessingQueue.shift(),!0}return!1},C.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},C.prototype._flushStoreProcessingQueue=function(){for(const k of this._storeProcessingQueue)k.cbStorePut&&k.cbStorePut(new Error("Connection closed")),k.callback&&k.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},z.exports=C}).call(this)}).call(this,I("_process"),typeof fe!="undefined"?fe:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(I,z,q){const{Buffer:w}=I("buffer"),p=I("readable-stream").Transform,d=I("duplexify");let u,i,e,a=!1;z.exports=function(n,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const o=t.protocolId==="MQIsdp"&&t.protocolVersion===3?"mqttv3.1":"mqtt";(function(l){l.hostname||(l.hostname="localhost"),l.path||(l.path="/"),l.wsOptions||(l.wsOptions={})})(t);const f=function(l,h){const g=l.protocol==="alis"?"wss":"ws";let c=g+"://"+l.hostname+l.path;return l.port&&l.port!==80&&l.port!==443&&(c=g+"://"+l.hostname+":"+l.port+l.path),typeof l.transformWsUrl=="function"&&(c=l.transformWsUrl(c,l,h)),c}(t,n);return(u=t.my).connectSocket({url:f,protocols:o}),i=function(){const l=new p;return l._write=function(h,g,c){u.sendSocketMessage({data:h.buffer,success:function(){c()},fail:function(){c(new Error)}})},l._flush=function(h){u.closeSocket({success:function(){h()}})},l}(),e=d.obj(),a||(a=!0,u.onSocketOpen(function(){e.setReadable(i),e.setWritable(i),e.emit("connect")}),u.onSocketMessage(function(l){if(typeof l.data=="string"){const h=w.from(l.data,"base64");i.push(h)}else{const h=new FileReader;h.addEventListener("load",function(){let g=h.result;g=g instanceof ArrayBuffer?w.from(g):w.from(g,"utf8"),i.push(g)}),h.readAsArrayBuffer(l.data)}}),u.onSocketClose(function(){e.end(),e.destroy()}),u.onSocketError(function(l){e.destroy(l)})),e}},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(I,z,q){const w=I("net"),p=I("debug")("mqttjs:tcp");z.exports=function(d,u){u.port=u.port||1883,u.hostname=u.hostname||u.host||"localhost";const i=u.port,e=u.hostname;return p("port %d and host %s",i,e),w.createConnection(i,e)}},{debug:18,net:16}],4:[function(I,z,q){const w=I("tls"),p=I("net"),d=I("debug")("mqttjs:tls");z.exports=function(u,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,d("port %d host %s rejectUnauthorized %b",i.port,i.host,i.rejectUnauthorized);const e=w.connect(i);function a(n){i.rejectUnauthorized&&u.emit("error",n),e.end()}return e.on("secureConnect",function(){i.rejectUnauthorized&&!e.authorized?e.emit("error",new Error("TLS not authorized")):e.removeListener("error",a)}),e.on("error",a),e}},{debug:18,net:16,tls:16}],5:[function(I,z,q){(function(w){(function(){const{Buffer:p}=I("buffer"),d=I("ws"),u=I("debug")("mqttjs:ws"),i=I("duplexify"),e=I("readable-stream").Transform,a=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],n=w!==void 0&&w.title==="browser"||typeof __webpack_require__=="function";function t(f,l){let h=f.protocol+"://"+f.hostname+":"+f.port+f.path;return typeof f.transformWsUrl=="function"&&(h=f.transformWsUrl(h,f,l)),h}function o(f){const l=f;return f.hostname||(l.hostname="localhost"),f.port||(f.protocol==="wss"?l.port=443:l.port=80),f.path||(l.path="/"),f.wsOptions||(l.wsOptions={}),n||f.protocol!=="wss"||a.forEach(function(h){Object.prototype.hasOwnProperty.call(f,h)&&!Object.prototype.hasOwnProperty.call(f.wsOptions,h)&&(l.wsOptions[h]=f[h])}),l}z.exports=n?function(f,l){let h;u("browserStreamBuilder");const g=function(C){const k=o(C);if(k.hostname||(k.hostname=k.host),!k.hostname){if(typeof document=="undefined")throw new Error("Could not determine host. Specify host manually.");const A=new URL(document.URL);k.hostname=A.hostname,k.port||(k.port=A.port)}return k.objectMode===void 0&&(k.objectMode=!(k.binary===!0||k.binary===void 0)),k}(l).browserBufferSize||524288,c=l.browserBufferTimeout||1e3,v=!l.objectMode,_=function(C,k){const A=k.protocolId==="MQIsdp"&&k.protocolVersion===3?"mqttv3.1":"mqtt",N=t(k,C),L=new WebSocket(N,[A]);return L.binaryType="arraybuffer",L}(f,l),E=function(C,k,A){const N=new e({objectModeMode:C.objectMode});return N._write=k,N._flush=A,N}(l,function C(k,A,N){_.bufferedAmount>g&&setTimeout(C,c,k,A,N),v&&typeof k=="string"&&(k=p.from(k,"utf8"));try{_.send(k)}catch(L){return N(L)}N()},function(C){_.close(),C()});l.objectMode||(E._writev=y),E.on("close",()=>{_.close()});const T=_.addEventListener!==void 0;function S(){h.setReadable(E),h.setWritable(E),h.emit("connect")}function F(){h.end(),h.destroy()}function W(C){h.destroy(C)}function m(C){let k=C.data;k=k instanceof ArrayBuffer?p.from(k):p.from(k,"utf8"),E.push(k)}function y(C,k){const A=new Array(C.length);for(let N=0;N<C.length;N++)typeof C[N].chunk=="string"?A[N]=p.from(C[N],"utf8"):A[N]=C[N].chunk;this._write(p.concat(A),"binary",k)}return _.readyState===_.OPEN?h=E:(h=h=i(void 0,void 0,l),l.objectMode||(h._writev=y),T?_.addEventListener("open",S):_.onopen=S),h.socket=_,T?(_.addEventListener("close",F),_.addEventListener("error",W),_.addEventListener("message",m)):(_.onclose=F,_.onerror=W,_.onmessage=m),h}:function(f,l){u("streamBuilder");const h=o(l),g=t(h,f),c=function(_,E,T){u("createWebSocket"),u("protocol: "+T.protocolId+" "+T.protocolVersion);const S=T.protocolId==="MQIsdp"&&T.protocolVersion===3?"mqttv3.1":"mqtt";return u("creating new Websocket for url: "+E+" and protocol: "+S),new d(E,[S],T.wsOptions)}(0,g,h),v=d.createWebSocketStream(c,h.wsOptions);return v.url=g,c.on("close",()=>{v.destroy()}),v}}).call(this)}).call(this,I("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(I,z,q){const{Buffer:w}=I("buffer"),p=I("readable-stream").Transform,d=I("duplexify");let u,i,e;z.exports=function(a,n){if(n.hostname=n.hostname||n.host,!n.hostname)throw new Error("Could not determine host. Specify host manually.");const t=n.protocolId==="MQIsdp"&&n.protocolVersion===3?"mqttv3.1":"mqtt";(function(l){l.hostname||(l.hostname="localhost"),l.path||(l.path="/"),l.wsOptions||(l.wsOptions={})})(n);const o=function(l,h){const g=l.protocol==="wxs"?"wss":"ws";let c=g+"://"+l.hostname+l.path;return l.port&&l.port!==80&&l.port!==443&&(c=g+"://"+l.hostname+":"+l.port+l.path),typeof l.transformWsUrl=="function"&&(c=l.transformWsUrl(c,l,h)),c}(n,a);u=wx.connectSocket({url:o,protocols:[t]}),i=function(){const l=new p;return l._write=function(h,g,c){u.send({data:h.buffer,success:function(){c()},fail:function(v){c(new Error(v))}})},l._flush=function(h){u.close({success:function(){h()}})},l}(),(e=d.obj())._destroy=function(l,h){u.close({success:function(){h&&h(l)}})};const f=e.destroy;return e.destroy=function(){e.destroy=f;const l=this;setTimeout(function(){u.close({fail:function(){l._destroy(new Error)}})},0)}.bind(e),u.onOpen(function(){e.setReadable(i),e.setWritable(i),e.emit("connect")}),u.onMessage(function(l){let h=l.data;h=h instanceof ArrayBuffer?w.from(h):w.from(h,"utf8"),i.push(h)}),u.onClose(function(){e.end(),e.destroy()}),u.onError(function(l){e.destroy(new Error(l.errMsg))}),e}},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(I,z,q){function w(){if(!(this instanceof w))return new w;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}w.prototype.allocate=function(){const p=this.nextId++;return this.nextId===65536&&(this.nextId=1),p},w.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},w.prototype.register=function(p){return!0},w.prototype.deallocate=function(p){},w.prototype.clear=function(){},z.exports=w},{}],8:[function(I,z,q){const w=I("xtend"),p=I("readable-stream").Readable,d={objectMode:!0},u={clean:!0};function i(e){if(!(this instanceof i))return new i(e);this.options=e||{},this.options=w(u,e),this._inflights=new Map}i.prototype.put=function(e,a){return this._inflights.set(e.messageId,e),a&&a(),this},i.prototype.createStream=function(){const e=new p(d),a=[];let n=!1,t=0;return this._inflights.forEach(function(o,f){a.push(o)}),e._read=function(){!n&&t<a.length?this.push(a[t++]):this.push(null)},e.destroy=function(){if(n)return;const o=this;n=!0,setTimeout(function(){o.emit("close")},0)},e},i.prototype.del=function(e,a){return(e=this._inflights.get(e.messageId))?(this._inflights.delete(e.messageId),a(null,e)):a&&a(new Error("missing packet")),this},i.prototype.get=function(e,a){return(e=this._inflights.get(e.messageId))?a(null,e):a&&a(new Error("missing packet")),this},i.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},z.exports=i},{"readable-stream":69,xtend:81}],9:[function(I,z,q){function w(p){if(!(this instanceof w))return new w(p);this.aliasToTopic={},this.max=p}w.prototype.put=function(p,d){return!(d===0||d>this.max)&&(this.aliasToTopic[d]=p,this.length=Object.keys(this.aliasToTopic).length,!0)},w.prototype.getTopicByAlias=function(p){return this.aliasToTopic[p]},w.prototype.clear=function(){this.aliasToTopic={}},z.exports=w},{}],10:[function(I,z,q){const w=I("lru-cache"),p=I("number-allocator").NumberAllocator;function d(u){if(!(this instanceof d))return new d(u);u>0&&(this.aliasToTopic=new w({max:u}),this.topicToAlias={},this.numberAllocator=new p(1,u),this.max=u,this.length=0)}d.prototype.put=function(u,i){if(i===0||i>this.max)return!1;const e=this.aliasToTopic.get(i);return e&&delete this.topicToAlias[e],this.aliasToTopic.set(i,u),this.topicToAlias[u]=i,this.numberAllocator.use(i),this.length=this.aliasToTopic.length,!0},d.prototype.getTopicByAlias=function(u){return this.aliasToTopic.get(u)},d.prototype.getAliasByTopic=function(u){const i=this.topicToAlias[u];return i!==void 0&&this.aliasToTopic.get(i),i},d.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},d.prototype.getLruAlias=function(){return this.numberAllocator.firstVacant()||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},z.exports=d},{"lru-cache":37,"number-allocator":46}],11:[function(I,z,q){function w(p){const d=p.split("/");for(let u=0;u<d.length;u++)if(d[u]!=="+"){if(d[u]==="#")return u===d.length-1;if(d[u].indexOf("+")!==-1||d[u].indexOf("#")!==-1)return!1}return!0}z.exports={validateTopics:function(p){if(p.length===0)return"empty_topic_list";for(let d=0;d<p.length;d++)if(!w(p[d]))return p[d];return null}}},{}],12:[function(I,z,q){(function(w){(function(){const p=I("../client"),d=I("../store"),u=I("url"),i=I("xtend"),e=I("debug")("mqttjs"),a={};function n(t,o){if(e("connecting to an MQTT broker..."),typeof t!="object"||o||(o=t,t=null),o=o||{},t){const l=u.parse(t,!0);if(l.port!=null&&(l.port=Number(l.port)),(o=i(l,o)).protocol===null)throw new Error("Missing protocol");o.protocol=o.protocol.replace(/:$/,"")}if(function(l){let h;l.auth&&((h=l.auth.match(/^(.+):(.+)$/))?(l.username=h[1],l.password=h[2]):l.username=l.auth)}(o),o.query&&typeof o.query.clientId=="string"&&(o.clientId=o.query.clientId),o.cert&&o.key){if(!o.protocol)throw new Error("Missing secure protocol key");if(["mqtts","wss","wxs","alis"].indexOf(o.protocol)===-1)switch(o.protocol){case"mqtt":o.protocol="mqtts";break;case"ws":o.protocol="wss";break;case"wx":o.protocol="wxs";break;case"ali":o.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+o.protocol+'"!')}}if(!a[o.protocol]){const l=["mqtts","wss"].indexOf(o.protocol)!==-1;o.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(h,g){return(!l||g%2!=0)&&typeof a[h]=="function"})[0]}if(o.clean===!1&&!o.clientId)throw new Error("Missing clientId for unclean clients");o.protocol&&(o.defaultProtocol=o.protocol);const f=new p(function(l){return o.servers&&(l._reconnectCount&&l._reconnectCount!==o.servers.length||(l._reconnectCount=0),o.host=o.servers[l._reconnectCount].host,o.port=o.servers[l._reconnectCount].port,o.protocol=o.servers[l._reconnectCount].protocol?o.servers[l._reconnectCount].protocol:o.defaultProtocol,o.hostname=o.host,l._reconnectCount++),e("calling streambuilder for",o.protocol),a[o.protocol](l,o)},o);return f.on("error",function(){}),f}w!==void 0&&w.title!=="browser"||typeof __webpack_require__!="function"?(a.mqtt=I("./tcp"),a.tcp=I("./tcp"),a.ssl=I("./tls"),a.tls=I("./tls"),a.mqtts=I("./tls")):(a.wx=I("./wx"),a.wxs=I("./wx"),a.ali=I("./ali"),a.alis=I("./ali")),a.ws=I("./ws"),a.wss=I("./ws"),z.exports=n,z.exports.connect=n,z.exports.MqttClient=p,z.exports.Store=d}).call(this)}).call(this,I("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(I,z,q){q.byteLength=function(t){var o=a(t),f=o[0],l=o[1];return 3*(f+l)/4-l},q.toByteArray=function(t){var o,f,l=a(t),h=l[0],g=l[1],c=new d(function(E,T,S){return 3*(T+S)/4-S}(0,h,g)),v=0,_=g>0?h-4:h;for(f=0;f<_;f+=4)o=p[t.charCodeAt(f)]<<18|p[t.charCodeAt(f+1)]<<12|p[t.charCodeAt(f+2)]<<6|p[t.charCodeAt(f+3)],c[v++]=o>>16&255,c[v++]=o>>8&255,c[v++]=255&o;return g===2&&(o=p[t.charCodeAt(f)]<<2|p[t.charCodeAt(f+1)]>>4,c[v++]=255&o),g===1&&(o=p[t.charCodeAt(f)]<<10|p[t.charCodeAt(f+1)]<<4|p[t.charCodeAt(f+2)]>>2,c[v++]=o>>8&255,c[v++]=255&o),c},q.fromByteArray=function(t){for(var o,f=t.length,l=f%3,h=[],g=0,c=f-l;g<c;g+=16383)h.push(n(t,g,g+16383>c?c:g+16383));return l===1?(o=t[f-1],h.push(w[o>>2]+w[o<<4&63]+"==")):l===2&&(o=(t[f-2]<<8)+t[f-1],h.push(w[o>>10]+w[o>>4&63]+w[o<<2&63]+"=")),h.join("")};for(var w=[],p=[],d=typeof Uint8Array!="undefined"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,e=u.length;i<e;++i)w[i]=u[i],p[u.charCodeAt(i)]=i;function a(t){var o=t.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=t.indexOf("=");return f===-1&&(f=o),[f,f===o?0:4-f%4]}function n(t,o,f){for(var l,h,g=[],c=o;c<f;c+=3)l=(t[c]<<16&16711680)+(t[c+1]<<8&65280)+(255&t[c+2]),g.push(w[(h=l)>>18&63]+w[h>>12&63]+w[h>>6&63]+w[63&h]);return g.join("")}p[45]=62,p[95]=63},{}],14:[function(I,z,q){const{Buffer:w}=I("buffer"),p=Symbol.for("BufferList");function d(u){if(!(this instanceof d))return new d(u);d._init.call(this,u)}d._init=function(u){Object.defineProperty(this,p,{value:!0}),this._bufs=[],this.length=0,u&&this.append(u)},d.prototype._new=function(u){return new d(u)},d.prototype._offset=function(u){if(u===0)return[0,0];let i=0;for(let e=0;e<this._bufs.length;e++){const a=i+this._bufs[e].length;if(u<a||e===this._bufs.length-1)return[e,u-i];i=a}},d.prototype._reverseOffset=function(u){const i=u[0];let e=u[1];for(let a=0;a<i;a++)e+=this._bufs[a].length;return e},d.prototype.get=function(u){if(u>this.length||u<0)return;const i=this._offset(u);return this._bufs[i[0]][i[1]]},d.prototype.slice=function(u,i){return typeof u=="number"&&u<0&&(u+=this.length),typeof i=="number"&&i<0&&(i+=this.length),this.copy(null,0,u,i)},d.prototype.copy=function(u,i,e,a){if((typeof e!="number"||e<0)&&(e=0),(typeof a!="number"||a>this.length)&&(a=this.length),e>=this.length||a<=0)return u||w.alloc(0);const n=!!u,t=this._offset(e),o=a-e;let f=o,l=n&&i||0,h=t[1];if(e===0&&a===this.length){if(!n)return this._bufs.length===1?this._bufs[0]:w.concat(this._bufs,this.length);for(let g=0;g<this._bufs.length;g++)this._bufs[g].copy(u,l),l+=this._bufs[g].length;return u}if(f<=this._bufs[t[0]].length-h)return n?this._bufs[t[0]].copy(u,i,h,h+f):this._bufs[t[0]].slice(h,h+f);n||(u=w.allocUnsafe(o));for(let g=t[0];g<this._bufs.length;g++){const c=this._bufs[g].length-h;if(!(f>c)){this._bufs[g].copy(u,l,h,h+f),l+=c;break}this._bufs[g].copy(u,l,h),l+=c,f-=c,h&&(h=0)}return u.length>l?u.slice(0,l):u},d.prototype.shallowSlice=function(u,i){if(u=u||0,i=typeof i!="number"?this.length:i,u<0&&(u+=this.length),i<0&&(i+=this.length),u===i)return this._new();const e=this._offset(u),a=this._offset(i),n=this._bufs.slice(e[0],a[0]+1);return a[1]===0?n.pop():n[n.length-1]=n[n.length-1].slice(0,a[1]),e[1]!==0&&(n[0]=n[0].slice(e[1])),this._new(n)},d.prototype.toString=function(u,i,e){return this.slice(i,e).toString(u)},d.prototype.consume=function(u){if(u=Math.trunc(u),Number.isNaN(u)||u<=0)return this;for(;this._bufs.length;){if(!(u>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(u),this.length-=u;break}u-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},d.prototype.duplicate=function(){const u=this._new();for(let i=0;i<this._bufs.length;i++)u.append(this._bufs[i]);return u},d.prototype.append=function(u){if(u==null)return this;if(u.buffer)this._appendBuffer(w.from(u.buffer,u.byteOffset,u.byteLength));else if(Array.isArray(u))for(let i=0;i<u.length;i++)this.append(u[i]);else if(this._isBufferList(u))for(let i=0;i<u._bufs.length;i++)this.append(u._bufs[i]);else typeof u=="number"&&(u=u.toString()),this._appendBuffer(w.from(u));return this},d.prototype._appendBuffer=function(u){this._bufs.push(u),this.length+=u.length},d.prototype.indexOf=function(u,i,e){if(e===void 0&&typeof i=="string"&&(e=i,i=void 0),typeof u=="function"||Array.isArray(u))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof u=="number"?u=w.from([u]):typeof u=="string"?u=w.from(u,e):this._isBufferList(u)?u=u.slice():Array.isArray(u.buffer)?u=w.from(u.buffer,u.byteOffset,u.byteLength):w.isBuffer(u)||(u=w.from(u)),i=Number(i||0),isNaN(i)&&(i=0),i<0&&(i=this.length+i),i<0&&(i=0),u.length===0)return i>this.length?this.length:i;const a=this._offset(i);let n=a[0],t=a[1];for(;n<this._bufs.length;n++){const o=this._bufs[n];for(;t<o.length;)if(o.length-t>=u.length){const f=o.indexOf(u,t);if(f!==-1)return this._reverseOffset([n,f]);t=o.length-u.length+1}else{const f=this._reverseOffset([n,t]);if(this._match(f,u))return f;t++}t=0}return-1},d.prototype._match=function(u,i){if(this.length-u<i.length)return!1;for(let e=0;e<i.length;e++)if(this.get(u+e)!==i[e])return!1;return!0},function(){const u={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const i in u)(function(e){d.prototype[e]=u[e]===null?function(a,n){return this.slice(a,a+n)[e](0,n)}:function(a=0){return this.slice(a,a+u[e])[e](0)}})(i)}(),d.prototype._isBufferList=function(u){return u instanceof d||d.isBufferList(u)},d.isBufferList=function(u){return u!=null&&u[p]},z.exports=d},{buffer:17}],15:[function(I,z,q){const w=I("readable-stream").Duplex,p=I("inherits"),d=I("./BufferList");function u(i){if(!(this instanceof u))return new u(i);if(typeof i=="function"){this._callback=i;const e=function(a){this._callback&&(this._callback(a),this._callback=null)}.bind(this);this.on("pipe",function(a){a.on("error",e)}),this.on("unpipe",function(a){a.removeListener("error",e)}),i=null}d._init.call(this,i),w.call(this)}p(u,w),Object.assign(u.prototype,d.prototype),u.prototype._new=function(i){return new u(i)},u.prototype._write=function(i,e,a){this._appendBuffer(i),typeof a=="function"&&a()},u.prototype._read=function(i){if(!this.length)return this.push(null);i=Math.min(i,this.length),this.push(this.slice(0,i)),this.consume(i)},u.prototype.end=function(i){w.prototype.end.call(this,i),this._callback&&(this._callback(null,this.slice()),this._callback=null)},u.prototype._destroy=function(i,e){this._bufs.length=0,this.length=0,e(i)},u.prototype._isBufferList=function(i){return i instanceof u||i instanceof d||u.isBufferList(i)},u.isBufferList=d.isBufferList,z.exports=u,z.exports.BufferListStream=u,z.exports.BufferList=d},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(I,z,q){},{}],17:[function(I,z,q){(function(w){(function(){var p=I("base64-js"),d=I("ieee754");q.Buffer=e,q.SlowBuffer=function(r){return+r!=r&&(r=0),e.alloc(+r)},q.INSPECT_MAX_BYTES=50;var u=2147483647;function i(r){if(r>u)throw new RangeError('The value "'+r+'" is invalid for option "size"');var s=new Uint8Array(r);return s.__proto__=e.prototype,s}function e(r,s,b){if(typeof r=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return t(r)}return a(r,s,b)}function a(r,s,b){if(typeof r=="string")return function(D,Q){if(typeof Q=="string"&&Q!==""||(Q="utf8"),!e.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);var Z=0|l(D,Q),Y=i(Z),X=Y.write(D,Q);return X!==Z&&(Y=Y.slice(0,X)),Y}(r,s);if(ArrayBuffer.isView(r))return o(r);if(r==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if($(r,ArrayBuffer)||r&&$(r.buffer,ArrayBuffer))return function(D,Q,Z){if(Q<0||D.byteLength<Q)throw new RangeError('"offset" is outside of buffer bounds');if(D.byteLength<Q+(Z||0))throw new RangeError('"length" is outside of buffer bounds');var Y;return Y=Q===void 0&&Z===void 0?new Uint8Array(D):Z===void 0?new Uint8Array(D,Q):new Uint8Array(D,Q,Z),Y.__proto__=e.prototype,Y}(r,s,b);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var x=r.valueOf&&r.valueOf();if(x!=null&&x!==r)return e.from(x,s,b);var j=function(D){if(e.isBuffer(D)){var Q=0|f(D.length),Z=i(Q);return Z.length===0||D.copy(Z,0,0,Q),Z}if(D.length!==void 0)return typeof D.length!="number"||G(D.length)?i(0):o(D);if(D.type==="Buffer"&&Array.isArray(D.data))return o(D.data)}(r);if(j)return j;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return e.from(r[Symbol.toPrimitive]("string"),s,b);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}function n(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function t(r){return n(r),i(r<0?0:0|f(r))}function o(r){for(var s=r.length<0?0:0|f(r.length),b=i(s),x=0;x<s;x+=1)b[x]=255&r[x];return b}function f(r){if(r>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return 0|r}function l(r,s){if(e.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||$(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var b=r.length,x=arguments.length>2&&arguments[2]===!0;if(!x&&b===0)return 0;for(var j=!1;;)switch(s){case"ascii":case"latin1":case"binary":return b;case"utf8":case"utf-8":return H(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*b;case"hex":return b>>>1;case"base64":return V(r).length;default:if(j)return x?-1:H(r).length;s=(""+s).toLowerCase(),j=!0}}function h(r,s,b){var x=r[s];r[s]=r[b],r[b]=x}function g(r,s,b,x,j){if(r.length===0)return-1;if(typeof b=="string"?(x=b,b=0):b>2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),G(b=+b)&&(b=j?0:r.length-1),b<0&&(b=r.length+b),b>=r.length){if(j)return-1;b=r.length-1}else if(b<0){if(!j)return-1;b=0}if(typeof s=="string"&&(s=e.from(s,x)),e.isBuffer(s))return s.length===0?-1:c(r,s,b,x,j);if(typeof s=="number")return s&=255,typeof Uint8Array.prototype.indexOf=="function"?j?Uint8Array.prototype.indexOf.call(r,s,b):Uint8Array.prototype.lastIndexOf.call(r,s,b):c(r,[s],b,x,j);throw new TypeError("val must be string, number or Buffer")}function c(r,s,b,x,j){var D,Q=1,Z=r.length,Y=s.length;if(x!==void 0&&((x=String(x).toLowerCase())==="ucs2"||x==="ucs-2"||x==="utf16le"||x==="utf-16le")){if(r.length<2||s.length<2)return-1;Q=2,Z/=2,Y/=2,b/=2}function X(ue,re){return Q===1?ue[re]:ue.readUInt16BE(re*Q)}if(j){var te=-1;for(D=b;D<Z;D++)if(X(r,D)===X(s,te===-1?0:D-te)){if(te===-1&&(te=D),D-te+1===Y)return te*Q}else te!==-1&&(D-=D-te),te=-1}else for(b+Y>Z&&(b=Z-Y),D=b;D>=0;D--){for(var le=!0,se=0;se<Y;se++)if(X(r,D+se)!==X(s,se)){le=!1;break}if(le)return D}return-1}function v(r,s,b,x){b=Number(b)||0;var j=r.length-b;x?(x=Number(x))>j&&(x=j):x=j;var D=s.length;x>D/2&&(x=D/2);for(var Q=0;Q<x;++Q){var Z=parseInt(s.substr(2*Q,2),16);if(G(Z))return Q;r[b+Q]=Z}return Q}function _(r,s,b,x){return K(H(s,r.length-b),r,b,x)}function E(r,s,b,x){return K(function(j){for(var D=[],Q=0;Q<j.length;++Q)D.push(255&j.charCodeAt(Q));return D}(s),r,b,x)}function T(r,s,b,x){return E(r,s,b,x)}function S(r,s,b,x){return K(V(s),r,b,x)}function F(r,s,b,x){return K(function(j,D){for(var Q,Z,Y,X=[],te=0;te<j.length&&!((D-=2)<0);++te)Q=j.charCodeAt(te),Z=Q>>8,Y=Q%256,X.push(Y),X.push(Z);return X}(s,r.length-b),r,b,x)}function W(r,s,b){return s===0&&b===r.length?p.fromByteArray(r):p.fromByteArray(r.slice(s,b))}function m(r,s,b){b=Math.min(r.length,b);for(var x=[],j=s;j<b;){var D,Q,Z,Y,X=r[j],te=null,le=X>239?4:X>223?3:X>191?2:1;if(j+le<=b)switch(le){case 1:X<128&&(te=X);break;case 2:(192&(D=r[j+1]))==128&&(Y=(31&X)<<6|63&D)>127&&(te=Y);break;case 3:D=r[j+1],Q=r[j+2],(192&D)==128&&(192&Q)==128&&(Y=(15&X)<<12|(63&D)<<6|63&Q)>2047&&(Y<55296||Y>57343)&&(te=Y);break;case 4:D=r[j+1],Q=r[j+2],Z=r[j+3],(192&D)==128&&(192&Q)==128&&(192&Z)==128&&(Y=(15&X)<<18|(63&D)<<12|(63&Q)<<6|63&Z)>65535&&Y<1114112&&(te=Y)}te===null?(te=65533,le=1):te>65535&&(te-=65536,x.push(te>>>10&1023|55296),te=56320|1023&te),x.push(te),j+=le}return function(se){var ue=se.length;if(ue<=y)return String.fromCharCode.apply(String,se);for(var re="",ne=0;ne<ue;)re+=String.fromCharCode.apply(String,se.slice(ne,ne+=y));return re}(x)}q.kMaxLength=u,e.TYPED_ARRAY_SUPPORT=function(){try{var r=new Uint8Array(1);return r.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},r.foo()===42}catch(s){return!1}}(),e.TYPED_ARRAY_SUPPORT||typeof console=="undefined"||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."),Object.defineProperty(e.prototype,"parent",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.buffer}}),Object.defineProperty(e.prototype,"offset",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.byteOffset}}),typeof Symbol!="undefined"&&Symbol.species!=null&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),e.poolSize=8192,e.from=function(r,s,b){return a(r,s,b)},e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array,e.alloc=function(r,s,b){return function(x,j,D){return n(x),x<=0?i(x):j!==void 0?typeof D=="string"?i(x).fill(j,D):i(x).fill(j):i(x)}(r,s,b)},e.allocUnsafe=function(r){return t(r)},e.allocUnsafeSlow=function(r){return t(r)},e.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==e.prototype},e.compare=function(r,s){if($(r,Uint8Array)&&(r=e.from(r,r.offset,r.byteLength)),$(s,Uint8Array)&&(s=e.from(s,s.offset,s.byteLength)),!e.isBuffer(r)||!e.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===s)return 0;for(var b=r.length,x=s.length,j=0,D=Math.min(b,x);j<D;++j)if(r[j]!==s[j]){b=r[j],x=s[j];break}return b<x?-1:x<b?1:0},e.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},e.concat=function(r,s){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return e.alloc(0);var b;if(s===void 0)for(s=0,b=0;b<r.length;++b)s+=r[b].length;var x=e.allocUnsafe(s),j=0;for(b=0;b<r.length;++b){var D=r[b];if($(D,Uint8Array)&&(D=e.from(D)),!e.isBuffer(D))throw new TypeError('"list" argument must be an Array of Buffers');D.copy(x,j),j+=D.length}return x},e.byteLength=l,e.prototype._isBuffer=!0,e.prototype.swap16=function(){var r=this.length;if(r%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var s=0;s<r;s+=2)h(this,s,s+1);return this},e.prototype.swap32=function(){var r=this.length;if(r%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var s=0;s<r;s+=4)h(this,s,s+3),h(this,s+1,s+2);return this},e.prototype.swap64=function(){var r=this.length;if(r%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var s=0;s<r;s+=8)h(this,s,s+7),h(this,s+1,s+6),h(this,s+2,s+5),h(this,s+3,s+4);return this},e.prototype.toString=function(){var r=this.length;return r===0?"":arguments.length===0?m(this,0,r):function(s,b,x){var j=!1;if((b===void 0||b<0)&&(b=0),b>this.length||((x===void 0||x>this.length)&&(x=this.length),x<=0)||(x>>>=0)<=(b>>>=0))return"";for(s||(s="utf8");;)switch(s){case"hex":return A(this,b,x);case"utf8":case"utf-8":return m(this,b,x);case"ascii":return C(this,b,x);case"latin1":case"binary":return k(this,b,x);case"base64":return W(this,b,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,b,x);default:if(j)throw new TypeError("Unknown encoding: "+s);s=(s+"").toLowerCase(),j=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(r){if(!e.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r||e.compare(this,r)===0},e.prototype.inspect=function(){var r="",s=q.INSPECT_MAX_BYTES;return r=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(r+=" ... "),"<Buffer "+r+">"},e.prototype.compare=function(r,s,b,x,j){if($(r,Uint8Array)&&(r=e.from(r,r.offset,r.byteLength)),!e.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(s===void 0&&(s=0),b===void 0&&(b=r?r.length:0),x===void 0&&(x=0),j===void 0&&(j=this.length),s<0||b>r.length||x<0||j>this.length)throw new RangeError("out of range index");if(x>=j&&s>=b)return 0;if(x>=j)return-1;if(s>=b)return 1;if(s>>>=0,b>>>=0,x>>>=0,j>>>=0,this===r)return 0;for(var D=j-x,Q=b-s,Z=Math.min(D,Q),Y=this.slice(x,j),X=r.slice(s,b),te=0;te<Z;++te)if(Y[te]!==X[te]){D=Y[te],Q=X[te];break}return D<Q?-1:Q<D?1:0},e.prototype.includes=function(r,s,b){return this.indexOf(r,s,b)!==-1},e.prototype.indexOf=function(r,s,b){return g(this,r,s,b,!0)},e.prototype.lastIndexOf=function(r,s,b){return g(this,r,s,b,!1)},e.prototype.write=function(r,s,b,x){if(s===void 0)x="utf8",b=this.length,s=0;else if(b===void 0&&typeof s=="string")x=s,b=this.length,s=0;else{if(!isFinite(s))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");s>>>=0,isFinite(b)?(b>>>=0,x===void 0&&(x="utf8")):(x=b,b=void 0)}var j=this.length-s;if((b===void 0||b>j)&&(b=j),r.length>0&&(b<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");for(var D=!1;;)switch(x){case"hex":return v(this,r,s,b);case"utf8":case"utf-8":return _(this,r,s,b);case"ascii":return E(this,r,s,b);case"latin1":case"binary":return T(this,r,s,b);case"base64":return S(this,r,s,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,r,s,b);default:if(D)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),D=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var y=4096;function C(r,s,b){var x="";b=Math.min(r.length,b);for(var j=s;j<b;++j)x+=String.fromCharCode(127&r[j]);return x}function k(r,s,b){var x="";b=Math.min(r.length,b);for(var j=s;j<b;++j)x+=String.fromCharCode(r[j]);return x}function A(r,s,b){var x=r.length;(!s||s<0)&&(s=0),(!b||b<0||b>x)&&(b=x);for(var j="",D=s;D<b;++D)j+=U(r[D]);return j}function N(r,s,b){for(var x=r.slice(s,b),j="",D=0;D<x.length;D+=2)j+=String.fromCharCode(x[D]+256*x[D+1]);return j}function L(r,s,b){if(r%1!=0||r<0)throw new RangeError("offset is not uint");if(r+s>b)throw new RangeError("Trying to access beyond buffer length")}function B(r,s,b,x,j,D){if(!e.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>j||s<D)throw new RangeError('"value" argument is out of bounds');if(b+x>r.length)throw new RangeError("Index out of range")}function P(r,s,b,x,j,D){if(b+x>r.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("Index out of range")}function M(r,s,b,x,j){return s=+s,b>>>=0,j||P(r,0,b,4),d.write(r,s,b,x,23,4),b+4}function R(r,s,b,x,j){return s=+s,b>>>=0,j||P(r,0,b,8),d.write(r,s,b,x,52,8),b+8}e.prototype.slice=function(r,s){var b=this.length;r=~~r,s=s===void 0?b:~~s,r<0?(r+=b)<0&&(r=0):r>b&&(r=b),s<0?(s+=b)<0&&(s=0):s>b&&(s=b),s<r&&(s=r);var x=this.subarray(r,s);return x.__proto__=e.prototype,x},e.prototype.readUIntLE=function(r,s,b){r>>>=0,s>>>=0,b||L(r,s,this.length);for(var x=this[r],j=1,D=0;++D<s&&(j*=256);)x+=this[r+D]*j;return x},e.prototype.readUIntBE=function(r,s,b){r>>>=0,s>>>=0,b||L(r,s,this.length);for(var x=this[r+--s],j=1;s>0&&(j*=256);)x+=this[r+--s]*j;return x},e.prototype.readUInt8=function(r,s){return r>>>=0,s||L(r,1,this.length),this[r]},e.prototype.readUInt16LE=function(r,s){return r>>>=0,s||L(r,2,this.length),this[r]|this[r+1]<<8},e.prototype.readUInt16BE=function(r,s){return r>>>=0,s||L(r,2,this.length),this[r]<<8|this[r+1]},e.prototype.readUInt32LE=function(r,s){return r>>>=0,s||L(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+16777216*this[r+3]},e.prototype.readUInt32BE=function(r,s){return r>>>=0,s||L(r,4,this.length),16777216*this[r]+(this[r+1]<<16|this[r+2]<<8|this[r+3])},e.prototype.readIntLE=function(r,s,b){r>>>=0,s>>>=0,b||L(r,s,this.length);for(var x=this[r],j=1,D=0;++D<s&&(j*=256);)x+=this[r+D]*j;return x>=(j*=128)&&(x-=Math.pow(2,8*s)),x},e.prototype.readIntBE=function(r,s,b){r>>>=0,s>>>=0,b||L(r,s,this.length);for(var x=s,j=1,D=this[r+--x];x>0&&(j*=256);)D+=this[r+--x]*j;return D>=(j*=128)&&(D-=Math.pow(2,8*s)),D},e.prototype.readInt8=function(r,s){return r>>>=0,s||L(r,1,this.length),128&this[r]?-1*(255-this[r]+1):this[r]},e.prototype.readInt16LE=function(r,s){r>>>=0,s||L(r,2,this.length);var b=this[r]|this[r+1]<<8;return 32768&b?4294901760|b:b},e.prototype.readInt16BE=function(r,s){r>>>=0,s||L(r,2,this.length);var b=this[r+1]|this[r]<<8;return 32768&b?4294901760|b:b},e.prototype.readInt32LE=function(r,s){return r>>>=0,s||L(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},e.prototype.readInt32BE=function(r,s){return r>>>=0,s||L(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},e.prototype.readFloatLE=function(r,s){return r>>>=0,s||L(r,4,this.length),d.read(this,r,!0,23,4)},e.prototype.readFloatBE=function(r,s){return r>>>=0,s||L(r,4,this.length),d.read(this,r,!1,23,4)},e.prototype.readDoubleLE=function(r,s){return r>>>=0,s||L(r,8,this.length),d.read(this,r,!0,52,8)},e.prototype.readDoubleBE=function(r,s){return r>>>=0,s||L(r,8,this.length),d.read(this,r,!1,52,8)},e.prototype.writeUIntLE=function(r,s,b,x){r=+r,s>>>=0,b>>>=0,x||B(this,r,s,b,Math.pow(2,8*b)-1,0);var j=1,D=0;for(this[s]=255&r;++D<b&&(j*=256);)this[s+D]=r/j&255;return s+b},e.prototype.writeUIntBE=function(r,s,b,x){r=+r,s>>>=0,b>>>=0,x||B(this,r,s,b,Math.pow(2,8*b)-1,0);var j=b-1,D=1;for(this[s+j]=255&r;--j>=0&&(D*=256);)this[s+j]=r/D&255;return s+b},e.prototype.writeUInt8=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,1,255,0),this[s]=255&r,s+1},e.prototype.writeUInt16LE=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,2,65535,0),this[s]=255&r,this[s+1]=r>>>8,s+2},e.prototype.writeUInt16BE=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,2,65535,0),this[s]=r>>>8,this[s+1]=255&r,s+2},e.prototype.writeUInt32LE=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,4,4294967295,0),this[s+3]=r>>>24,this[s+2]=r>>>16,this[s+1]=r>>>8,this[s]=255&r,s+4},e.prototype.writeUInt32BE=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,4,4294967295,0),this[s]=r>>>24,this[s+1]=r>>>16,this[s+2]=r>>>8,this[s+3]=255&r,s+4},e.prototype.writeIntLE=function(r,s,b,x){if(r=+r,s>>>=0,!x){var j=Math.pow(2,8*b-1);B(this,r,s,b,j-1,-j)}var D=0,Q=1,Z=0;for(this[s]=255&r;++D<b&&(Q*=256);)r<0&&Z===0&&this[s+D-1]!==0&&(Z=1),this[s+D]=(r/Q>>0)-Z&255;return s+b},e.prototype.writeIntBE=function(r,s,b,x){if(r=+r,s>>>=0,!x){var j=Math.pow(2,8*b-1);B(this,r,s,b,j-1,-j)}var D=b-1,Q=1,Z=0;for(this[s+D]=255&r;--D>=0&&(Q*=256);)r<0&&Z===0&&this[s+D+1]!==0&&(Z=1),this[s+D]=(r/Q>>0)-Z&255;return s+b},e.prototype.writeInt8=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,1,127,-128),r<0&&(r=255+r+1),this[s]=255&r,s+1},e.prototype.writeInt16LE=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,2,32767,-32768),this[s]=255&r,this[s+1]=r>>>8,s+2},e.prototype.writeInt16BE=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,2,32767,-32768),this[s]=r>>>8,this[s+1]=255&r,s+2},e.prototype.writeInt32LE=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,4,2147483647,-2147483648),this[s]=255&r,this[s+1]=r>>>8,this[s+2]=r>>>16,this[s+3]=r>>>24,s+4},e.prototype.writeInt32BE=function(r,s,b){return r=+r,s>>>=0,b||B(this,r,s,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[s]=r>>>24,this[s+1]=r>>>16,this[s+2]=r>>>8,this[s+3]=255&r,s+4},e.prototype.writeFloatLE=function(r,s,b){return M(this,r,s,!0,b)},e.prototype.writeFloatBE=function(r,s,b){return M(this,r,s,!1,b)},e.prototype.writeDoubleLE=function(r,s,b){return R(this,r,s,!0,b)},e.prototype.writeDoubleBE=function(r,s,b){return R(this,r,s,!1,b)},e.prototype.copy=function(r,s,b,x){if(!e.isBuffer(r))throw new TypeError("argument should be a Buffer");if(b||(b=0),x||x===0||(x=this.length),s>=r.length&&(s=r.length),s||(s=0),x>0&&x<b&&(x=b),x===b||r.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(b<0||b>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),r.length-s<x-b&&(x=r.length-s+b);var j=x-b;if(this===r&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(s,b,x);else if(this===r&&b<s&&s<x)for(var D=j-1;D>=0;--D)r[D+s]=this[D+b];else Uint8Array.prototype.set.call(r,this.subarray(b,x),s);return j},e.prototype.fill=function(r,s,b,x){if(typeof r=="string"){if(typeof s=="string"?(x=s,s=0,b=this.length):typeof b=="string"&&(x=b,b=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!e.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(r.length===1){var j=r.charCodeAt(0);(x==="utf8"&&j<128||x==="latin1")&&(r=j)}}else typeof r=="number"&&(r&=255);if(s<0||this.length<s||this.length<b)throw new RangeError("Out of range index");if(b<=s)return this;var D;if(s>>>=0,b=b===void 0?this.length:b>>>0,r||(r=0),typeof r=="number")for(D=s;D<b;++D)this[D]=r;else{var Q=e.isBuffer(r)?r:e.from(r,x),Z=Q.length;if(Z===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(D=0;D<b-s;++D)this[D+s]=Q[D%Z]}return this};var O=/[^+/0-9A-Za-z-_]/g;function U(r){return r<16?"0"+r.toString(16):r.toString(16)}function H(r,s){var b;s=s||1/0;for(var x=r.length,j=null,D=[],Q=0;Q<x;++Q){if((b=r.charCodeAt(Q))>55295&&b<57344){if(!j){if(b>56319){(s-=3)>-1&&D.push(239,191,189);continue}if(Q+1===x){(s-=3)>-1&&D.push(239,191,189);continue}j=b;continue}if(b<56320){(s-=3)>-1&&D.push(239,191,189),j=b;continue}b=65536+(j-55296<<10|b-56320)}else j&&(s-=3)>-1&&D.push(239,191,189);if(j=null,b<128){if((s-=1)<0)break;D.push(b)}else if(b<2048){if((s-=2)<0)break;D.push(b>>6|192,63&b|128)}else if(b<65536){if((s-=3)<0)break;D.push(b>>12|224,b>>6&63|128,63&b|128)}else{if(!(b<1114112))throw new Error("Invalid code point");if((s-=4)<0)break;D.push(b>>18|240,b>>12&63|128,b>>6&63|128,63&b|128)}}return D}function V(r){return p.toByteArray(function(s){if((s=(s=s.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;s.length%4!=0;)s+="=";return s}(r))}function K(r,s,b,x){for(var j=0;j<x&&!(j+b>=s.length||j>=r.length);++j)s[j+b]=r[j];return j}function $(r,s){return r instanceof s||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===s.name}function G(r){return r!=r}}).call(this)}).call(this,I("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(I,z,q){(function(w){(function(){q.formatArgs=function(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+z.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;d.splice(1,0,u,"color: inherit");let i=0,e=0;d[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&a==="%c"&&(e=++i)}),d.splice(e,0,u)},q.save=function(d){try{d?q.storage.setItem("debug",d):q.storage.removeItem("debug")}catch(u){}},q.load=function(){let d;try{d=q.storage.getItem("debug")}catch(u){}return!d&&w!==void 0&&"env"in w&&(d=w.env.DEBUG),d},q.useColors=function(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},q.storage=function(){try{return localStorage}catch(d){}}(),q.destroy=(()=>{let d=!1;return()=>{d||(d=!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`."))}})(),q.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"],q.log=console.debug||console.log||(()=>{}),z.exports=I("./common")(q);const{formatters:p}=z.exports;p.j=function(d){try{return JSON.stringify(d)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}).call(this)}).call(this,I("_process"))},{"./common":19,_process:50}],19:[function(I,z,q){z.exports=function(w){function p(i){let e,a,n,t=null;function o(...f){if(!o.enabled)return;const l=o,h=Number(new Date),g=h-(e||h);l.diff=g,l.prev=e,l.curr=h,e=h,f[0]=p.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let c=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(v,_)=>{if(v==="%%")return"%";c++;const E=p.formatters[_];if(typeof E=="function"){const T=f[c];v=E.call(l,T),f.splice(c,1),c--}return v}),p.formatArgs.call(l,f),(l.log||p.log).apply(l,f)}return o.namespace=i,o.useColors=p.useColors(),o.color=p.selectColor(i),o.extend=d,o.destroy=p.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>t!==null?t:(a!==p.namespaces&&(a=p.namespaces,n=p.enabled(i)),n),set:f=>{t=f}}),typeof p.init=="function"&&p.init(o),o}function d(i,e){const a=p(this.namespace+(e===void 0?":":e)+i);return a.log=this.log,a}function u(i){return i.toString().substring(2,i.toString().length-2).replace(/\.\*\?$/,"*")}return p.debug=p,p.default=p,p.coerce=function(i){return i instanceof Error?i.stack||i.message:i},p.disable=function(){const i=[...p.names.map(u),...p.skips.map(u).map(e=>"-"+e)].join(",");return p.enable(""),i},p.enable=function(i){let e;p.save(i),p.namespaces=i,p.names=[],p.skips=[];const a=(typeof i=="string"?i:"").split(/[\s,]+/),n=a.length;for(e=0;e<n;e++)a[e]&&((i=a[e].replace(/\*/g,".*?"))[0]==="-"?p.skips.push(new RegExp("^"+i.substr(1)+"$")):p.names.push(new RegExp("^"+i+"$")))},p.enabled=function(i){if(i[i.length-1]==="*")return!0;let e,a;for(e=0,a=p.skips.length;e<a;e++)if(p.skips[e].test(i))return!1;for(e=0,a=p.names.length;e<a;e++)if(p.names[e].test(i))return!0;return!1},p.humanize=I("ms"),p.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(w).forEach(i=>{p[i]=w[i]}),p.names=[],p.skips=[],p.formatters={},p.selectColor=function(i){let e=0;for(let a=0;a<i.length;a++)e=(e<<5)-e+i.charCodeAt(a),e|=0;return p.colors[Math.abs(e)%p.colors.length]},p.enable(p.load()),p}},{ms:45}],20:[function(I,z,q){(function(w,p){(function(){var d=I("readable-stream"),u=I("end-of-stream"),i=I("inherits"),e=I("stream-shift"),a=p.from&&p.from!==Uint8Array.from?p.from([0]):new p([0]),n=function(l,h){l._corked?l.once("uncork",h):h()},t=function(l,h){return function(g){g?function(c,v){c._autoDestroy&&c.destroy(v)}(l,g.message==="premature close"?null:g):h&&!l._ended&&l.end()}},o=function(){},f=function(l,h,g){if(!(this instanceof f))return new f(l,h,g);d.Duplex.call(this,g),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!g||g.autoDestroy!==!1,this._forwardDestroy=!g||g.destroy!==!1,this._forwardEnd=!g||g.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,l&&this.setWritable(l),h&&this.setReadable(h)};i(f,d.Duplex),f.obj=function(l,h,g){return g||(g={}),g.objectMode=!0,g.highWaterMark=16,new f(l,h,g)},f.prototype.cork=function(){++this._corked==1&&this.emit("cork")},f.prototype.uncork=function(){this._corked&&--this._corked==0&&this.emit("uncork")},f.prototype.setWritable=function(l){if(this._unwrite&&this._unwrite(),this.destroyed)l&&l.destroy&&l.destroy();else if(l!==null&&l!==!1){var h=this,g=u(l,{writable:!0,readable:!1},t(this,this._forwardEnd)),c=function(){var v=h._ondrain;h._ondrain=null,v&&v()};this._unwrite&&w.nextTick(c),this._writable=l,this._writable.on("drain",c),this._unwrite=function(){h._writable.removeListener("drain",c),g()},this.uncork()}else this.end()},f.prototype.setReadable=function(l){if(this._unread&&this._unread(),this.destroyed)l&&l.destroy&&l.destroy();else{if(l===null||l===!1)return this.push(null),void this.resume();var h,g=this,c=u(l,{writable:!1,readable:!0},t(this)),v=function(){g._forward()},_=function(){g.push(null)};this._drained=!0,this._readable=l,this._readable2=l._readableState?l:(h=l,new d.Readable({objectMode:!0,highWaterMark:16}).wrap(h)),this._readable2.on("readable",v),this._readable2.on("end",_),this._unread=function(){g._readable2.removeListener("readable",v),g._readable2.removeListener("end",_),c()},this._forward()}},f.prototype._read=function(){this._drained=!0,this._forward()},f.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var l;for(this._forwarding=!0;this._drained&&(l=e(this._readable2))!==null;)this.destroyed||(this._drained=this.push(l));this._forwarding=!1}},f.prototype.destroy=function(l,h){if(h||(h=o),this.destroyed)return h(null);this.destroyed=!0;var g=this;w.nextTick(function(){g._destroy(l),h(null)})},f.prototype._destroy=function(l){if(l){var h=this._ondrain;this._ondrain=null,h?h(l):this.emit("error",l)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},f.prototype._write=function(l,h,g){if(!this.destroyed)return this._corked?n(this,this._write.bind(this,l,h,g)):l===a?this._finish(g):this._writable?void(this._writable.write(l)===!1?this._ondrain=g:this.destroyed||g()):g()},f.prototype._finish=function(l){var h=this;this.emit("preend"),n(this,function(){var g,c;g=h._forwardEnd&&h._writable,c=function(){h._writableState.prefinished===!1&&(h._writableState.prefinished=!0),h.emit("prefinish"),n(h,l)},g?g._writableState&&g._writableState.finished?c():g._writableState?g.end(c):(g.end(),c()):c()})},f.prototype.end=function(l,h,g){return typeof l=="function"?this.end(null,null,l):typeof h=="function"?this.end(l,null,h):(this._ended=!0,l&&this.write(l),this._writableState.ending||this._writableState.destroyed||this.write(a),d.Writable.prototype.end.call(this,g))},z.exports=f}).call(this)}).call(this,I("_process"),I("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(I,z,q){(function(w){(function(){var p=I("once"),d=function(){},u=function(i,e,a){if(typeof e=="function")return u(i,null,e);e||(e={}),a=p(a||d);var n=i._writableState,t=i._readableState,o=e.readable||e.readable!==!1&&i.readable,f=e.writable||e.writable!==!1&&i.writable,l=!1,h=function(){i.writable||g()},g=function(){f=!1,o||a.call(i)},c=function(){o=!1,f||a.call(i)},v=function(F){a.call(i,F?new Error("exited with error code: "+F):null)},_=function(F){a.call(i,F)},E=function(){w.nextTick(T)},T=function(){if(!l)return(!o||t&&t.ended&&!t.destroyed)&&(!f||n&&n.ended&&!n.destroyed)?void 0:a.call(i,new Error("premature close"))},S=function(){i.req.on("finish",g)};return function(F){return F.setHeader&&typeof F.abort=="function"}(i)?(i.on("complete",g),i.on("abort",E),i.req?S():i.on("request",S)):f&&!n&&(i.on("end",h),i.on("close",h)),function(F){return F.stdio&&Array.isArray(F.stdio)&&F.stdio.length===3}(i)&&i.on("exit",v),i.on("end",c),i.on("finish",g),e.error!==!1&&i.on("error",_),i.on("close",E),function(){l=!0,i.removeListener("complete",g),i.removeListener("abort",E),i.removeListener("request",S),i.req&&i.req.removeListener("finish",g),i.removeListener("end",h),i.removeListener("close",h),i.removeListener("finish",g),i.removeListener("exit",v),i.removeListener("end",c),i.removeListener("error",_),i.removeListener("close",E)}};z.exports=u}).call(this)}).call(this,I("_process"))},{_process:50,once:48}],22:[function(I,z,q){var w=Object.create||function(c){var v=function(){};return v.prototype=c,new v},p=Object.keys||function(c){var v=[];for(var _ in c)Object.prototype.hasOwnProperty.call(c,_)&&v.push(_);return _},d=Function.prototype.bind||function(c){var v=this;return function(){return v.apply(c,arguments)}};function u(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=w(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}z.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._maxListeners=void 0;var i,e=10;try{var a={};Object.defineProperty&&Object.defineProperty(a,"x",{value:0}),i=a.x===0}catch(c){i=!1}function n(c){return c._maxListeners===void 0?u.defaultMaxListeners:c._maxListeners}function t(c,v,_,E){var T,S,F;if(typeof _!="function")throw new TypeError('"listener" argument must be a function');if((S=c._events)?(S.newListener&&(c.emit("newListener",v,_.listener?_.listener:_),S=c._events),F=S[v]):(S=c._events=w(null),c._eventsCount=0),F){if(typeof F=="function"?F=S[v]=E?[_,F]:[F,_]:E?F.unshift(_):F.push(_),!F.warned&&(T=n(c))&&T>0&&F.length>T){F.warned=!0;var W=new Error("Possible EventEmitter memory leak detected. "+F.length+' "'+String(v)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');W.name="MaxListenersExceededWarning",W.emitter=c,W.type=v,W.count=F.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",W.name,W.message)}}else F=S[v]=_,++c._eventsCount;return c}function o(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var c=new Array(arguments.length),v=0;v<c.length;++v)c[v]=arguments[v];this.listener.apply(this.target,c)}}function f(c,v,_){var E={fired:!1,wrapFn:void 0,target:c,type:v,listener:_},T=d.call(o,E);return T.listener=_,E.wrapFn=T,T}function l(c,v,_){var E=c._events;if(!E)return[];var T=E[v];return T?typeof T=="function"?_?[T.listener||T]:[T]:_?function(S){for(var F=new Array(S.length),W=0;W<F.length;++W)F[W]=S[W].listener||S[W];return F}(T):g(T,T.length):[]}function h(c){var v=this._events;if(v){var _=v[c];if(typeof _=="function")return 1;if(_)return _.length}return 0}function g(c,v){for(var _=new Array(v),E=0;E<v;++E)_[E]=c[E];return _}i?Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return e},set:function(c){if(typeof c!="number"||c<0||c!=c)throw new TypeError('"defaultMaxListeners" must be a positive number');e=c}}):u.defaultMaxListeners=e,u.prototype.setMaxListeners=function(c){if(typeof c!="number"||c<0||isNaN(c))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=c,this},u.prototype.getMaxListeners=function(){return n(this)},u.prototype.emit=function(c){var v,_,E,T,S,F,W=c==="error";if(F=this._events)W=W&&F.error==null;else if(!W)return!1;if(W){if(arguments.length>1&&(v=arguments[1]),v instanceof Error)throw v;var m=new Error('Unhandled "error" event. ('+v+")");throw m.context=v,m}if(!(_=F[c]))return!1;var y=typeof _=="function";switch(E=arguments.length){case 1:(function(C,k,A){if(k)C.call(A);else for(var N=C.length,L=g(C,N),B=0;B<N;++B)L[B].call(A)})(_,y,this);break;case 2:(function(C,k,A,N){if(k)C.call(A,N);else for(var L=C.length,B=g(C,L),P=0;P<L;++P)B[P].call(A,N)})(_,y,this,arguments[1]);break;case 3:(function(C,k,A,N,L){if(k)C.call(A,N,L);else for(var B=C.length,P=g(C,B),M=0;M<B;++M)P[M].call(A,N,L)})(_,y,this,arguments[1],arguments[2]);break;case 4:(function(C,k,A,N,L,B){if(k)C.call(A,N,L,B);else for(var P=C.length,M=g(C,P),R=0;R<P;++R)M[R].call(A,N,L,B)})(_,y,this,arguments[1],arguments[2],arguments[3]);break;default:for(T=new Array(E-1),S=1;S<E;S++)T[S-1]=arguments[S];(function(C,k,A,N){if(k)C.apply(A,N);else for(var L=C.length,B=g(C,L),P=0;P<L;++P)B[P].apply(A,N)})(_,y,this,T)}return!0},u.prototype.addListener=function(c,v){return t(this,c,v,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(c,v){return t(this,c,v,!0)},u.prototype.once=function(c,v){if(typeof v!="function")throw new TypeError('"listener" argument must be a function');return this.on(c,f(this,c,v)),this},u.prototype.prependOnceListener=function(c,v){if(typeof v!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(c,f(this,c,v)),this},u.prototype.removeListener=function(c,v){var _,E,T,S,F;if(typeof v!="function")throw new TypeError('"listener" argument must be a function');if(!(E=this._events))return this;if(!(_=E[c]))return this;if(_===v||_.listener===v)--this._eventsCount==0?this._events=w(null):(delete E[c],E.removeListener&&this.emit("removeListener",c,_.listener||v));else if(typeof _!="function"){for(T=-1,S=_.length-1;S>=0;S--)if(_[S]===v||_[S].listener===v){F=_[S].listener,T=S;break}if(T<0)return this;T===0?_.shift():function(W,m){for(var y=m,C=y+1,k=W.length;C<k;y+=1,C+=1)W[y]=W[C];W.pop()}(_,T),_.length===1&&(E[c]=_[0]),E.removeListener&&this.emit("removeListener",c,F||v)}return this},u.prototype.removeAllListeners=function(c){var v,_,E;if(!(_=this._events))return this;if(!_.removeListener)return arguments.length===0?(this._events=w(null),this._eventsCount=0):_[c]&&(--this._eventsCount==0?this._events=w(null):delete _[c]),this;if(arguments.length===0){var T,S=p(_);for(E=0;E<S.length;++E)(T=S[E])!=="removeListener"&&this.removeAllListeners(T);return this.removeAllListeners("removeListener"),this._events=w(null),this._eventsCount=0,this}if(typeof(v=_[c])=="function")this.removeListener(c,v);else if(v)for(E=v.length-1;E>=0;E--)this.removeListener(c,v[E]);return this},u.prototype.listeners=function(c){return l(this,c,!0)},u.prototype.rawListeners=function(c){return l(this,c,!1)},u.listenerCount=function(c,v){return typeof c.listenerCount=="function"?c.listenerCount(v):h.call(c,v)},u.prototype.listenerCount=h,u.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(I,z,q){q.read=function(w,p,d,u,i){var e,a,n=8*i-u-1,t=(1<<n)-1,o=t>>1,f=-7,l=d?i-1:0,h=d?-1:1,g=w[p+l];for(l+=h,e=g&(1<<-f)-1,g>>=-f,f+=n;f>0;e=256*e+w[p+l],l+=h,f-=8);for(a=e&(1<<-f)-1,e>>=-f,f+=u;f>0;a=256*a+w[p+l],l+=h,f-=8);if(e===0)e=1-o;else{if(e===t)return a?NaN:1/0*(g?-1:1);a+=Math.pow(2,u),e-=o}return(g?-1:1)*a*Math.pow(2,e-u)},q.write=function(w,p,d,u,i,e){var a,n,t,o=8*e-i-1,f=(1<<o)-1,l=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=u?0:e-1,c=u?1:-1,v=p<0||p===0&&1/p<0?1:0;for(p=Math.abs(p),isNaN(p)||p===1/0?(n=isNaN(p)?1:0,a=f):(a=Math.floor(Math.log(p)/Math.LN2),p*(t=Math.pow(2,-a))<1&&(a--,t*=2),(p+=a+l>=1?h/t:h*Math.pow(2,1-l))*t>=2&&(a++,t/=2),a+l>=f?(n=0,a=f):a+l>=1?(n=(p*t-1)*Math.pow(2,i),a+=l):(n=p*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;w[d+g]=255&n,g+=c,n/=256,i-=8);for(a=a<<i|n,o+=i;o>0;w[d+g]=255&a,g+=c,a/=256,o-=8);w[d+g-c]|=128*v}},{}],24:[function(I,z,q){typeof Object.create=="function"?z.exports=function(w,p){p&&(w.super_=p,w.prototype=Object.create(p.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}))}:z.exports=function(w,p){if(p){w.super_=p;var d=function(){};d.prototype=p.prototype,w.prototype=new d,w.prototype.constructor=w}}},{}],25:[function(I,z,q){Object.defineProperty(q,"__esModule",{value:!0});var w=function(){function p(d,u){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=d,this.value=u}return p.prototype.rotateLeft=function(){var d=this.parent,u=this.brother,i=this.leftChild,e=this.rightChild;if(!e)throw new Error("unknown error");var a=e.leftChild,n=e.rightChild;return d&&(d.leftChild===this?d.leftChild=e:d.rightChild===this&&(d.rightChild=e)),e.parent=d,e.brother=u,e.leftChild=this,e.rightChild=n,u&&(u.brother=e),this.parent=e,this.brother=n,this.leftChild=i,this.rightChild=a,n&&(n.parent=e,n.brother=this),i&&(i.parent=this,i.brother=a),a&&(a.parent=this,a.brother=i),e},p.prototype.rotateRight=function(){var d=this.parent,u=this.brother,i=this.leftChild;if(!i)throw new Error("unknown error");var e=this.rightChild,a=i.leftChild,n=i.rightChild;return d&&(d.leftChild===this?d.leftChild=i:d.rightChild===this&&(d.rightChild=i)),i.parent=d,i.brother=u,i.leftChild=a,i.rightChild=this,u&&(u.brother=i),a&&(a.parent=i,a.brother=this),this.parent=i,this.brother=a,this.leftChild=n,this.rightChild=e,n&&(n.parent=this,n.brother=e),e&&(e.parent=this,e.brother=n),i},p.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},p.TreeNodeColorType={red:!0,black:!1},p}();Object.freeze(w),q.default=w},{}],26:[function(I,z,q){var w=this&&this.__generator||function(d,u){var i,e,a,n,t={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return n={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function o(f){return function(l){return function(h){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,e&&(a=2&h[0]?e.return:h[0]?e.throw||((a=e.return)&&a.call(e),0):e.next)&&!(a=a.call(e,h[1])).done)return a;switch(e=0,a&&(h=[2&h[0],a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,e=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(!(a=(a=t.trys).length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=u.call(d,t)}catch(g){h=[6,g],e=0}finally{i=a=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([f,l])}}};function p(d){var u=this;d===void 0&&(d=[]);var i=[],e=0,a=0,n=0,t=0,o=0,f=0;this.size=function(){return f},this.empty=function(){return f===0},this.clear=function(){e=n=a=t=o=f=0,h.call(this,p.bucketSize),f=0},this.front=function(){return i[e][a]},this.back=function(){return i[n][t]},this.forEach=function(g){if(!this.empty()){var c=0;if(e!==n){for(_=a;_<p.bucketSize;++_)g(i[e][_],c++);for(_=e+1;_<n;++_)for(var v=0;v<p.bucketSize;++v)g(i[_][v],c++);for(_=0;_<=t;++_)g(i[n][_],c++)}else for(var _=a;_<=t;++_)g(i[e][_],c++)}};var l=function(g){var c=e*p.bucketSize+a,v=c+g,_=n*p.bucketSize+t;if(v<c||v>_)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(v/p.bucketSize),curNodePointerIndex:v%p.bucketSize}};this.getElementByPos=function(g){var c=l(g),v=c.curNodeBucketIndex,_=c.curNodePointerIndex;return i[v][_]},this.eraseElementByPos=function(g){var c=this;if(g<0||g>f)throw new Error("pos should more than 0 and less than queue's size");if(g===0)this.popFront();else if(g===this.size())this.popBack();else{for(var v=[],_=g+1;_<f;++_)v.push(this.getElementByPos(_));this.cut(g),this.popBack(),v.forEach(function(E){return c.pushBack(E)})}},this.eraseElementByValue=function(g){if(!this.empty()){var c=[];this.forEach(function(E){E!==g&&c.push(E)});for(var v=c.length,_=0;_<v;++_)this.setElementByPos(_,c[_]);this.cut(v-1)}};var h=function(g){for(var c=[],v=g*p.sigma,_=Math.max(Math.ceil(v/p.bucketSize),2),E=0;E<_;++E)c.push(new Array(p.bucketSize));var T=Math.ceil(g/p.bucketSize),S=Math.floor(_/2)-Math.floor(T/2),F=S,W=0;if(this.size())for(E=0;E<T;++E){for(var m=0;m<p.bucketSize;++m)if(c[S+E][m]=this.front(),this.popFront(),this.empty()){F=S+E,W=m;break}if(this.empty())break}i=c,e=S,a=0,n=F,t=W,o=_,f=g};this.pushBack=function(g){this.empty()||(n===o-1&&t===p.bucketSize-1&&h.call(this,this.size()),t<p.bucketSize-1?++t:n<o-1&&(++n,t=0)),++f,i[n][t]=g},this.popBack=function(){this.empty()||(this.size()!==1&&(t>0?--t:e<n&&(--n,t=p.bucketSize-1)),f>0&&--f)},this.setElementByPos=function(g,c){var v=l(g),_=v.curNodeBucketIndex,E=v.curNodePointerIndex;i[_][E]=c},this.insert=function(g,c,v){var _=this;if(v===void 0&&(v=1),g===0)for(;v--;)this.pushFront(c);else if(g===this.size())for(;v--;)this.pushBack(c);else{for(var E=[],T=g;T<f;++T)E.push(this.getElementByPos(T));for(this.cut(g-1),T=0;T<v;++T)this.pushBack(c);E.forEach(function(S){return _.pushBack(S)})}},this.find=function(g){if(e===n){for(var c=a;c<=t;++c)if(i[e][c]===g)return!0;return!1}for(c=a;c<p.bucketSize;++c)if(i[e][c]===g)return!0;for(c=e+1;c<n;++c)for(var v=0;v<p.bucketSize;++v)if(i[c][v]===g)return!0;for(c=0;c<=t;++c)if(i[n][c]===g)return!0;return!1},this.reverse=function(){for(var g=0,c=f-1;g<c;){var v=this.getElementByPos(g);this.setElementByPos(g,this.getElementByPos(c)),this.setElementByPos(c,v),++g,--c}},this.unique=function(){if(!this.empty()){var g=[],c=this.front();this.forEach(function(_,E){E!==0&&_===c||(g.push(_),c=_)});for(var v=0;v<f;++v)this.setElementByPos(v,g[v]);this.cut(g.length-1)}},this.sort=function(g){var c=[];this.forEach(function(_){c.push(_)}),c.sort(g);for(var v=0;v<f;++v)this.setElementByPos(v,c[v])},this.pushFront=function(g){this.empty()||(e===0&&a===0&&h.call(this,this.size()),a>0?--a:e>0&&(--e,a=p.bucketSize-1)),++f,i[e][a]=g},this.popFront=function(){this.empty()||(this.size()!==1&&(a<p.bucketSize-1?++a:e<n&&(++e,a=0)),f>0&&--f)},this.shrinkToFit=function(){var g=this,c=[];this.forEach(function(T){c.push(T)});var v=c.length;i=[];for(var _=Math.ceil(v/p.bucketSize),E=0;E<_;++E)i.push(new Array(p.bucketSize));this.clear(),c.forEach(function(T){return g.pushBack(T)})},this.cut=function(g){if(g<0)this.clear();else{var c=l(g),v=c.curNodeBucketIndex,_=c.curNodePointerIndex;n=v,t=_,f=g+1}},this[Symbol.iterator]=function(){return function(){var g,c;return w(this,function(v){switch(v.label){case 0:if(f===0)return[2];if(e!==n)return[3,5];c=a,v.label=1;case 1:return c<=t?[4,i[e][c]]:[3,4];case 2:v.sent(),v.label=3;case 3:return++c,[3,1];case 4:return[2];case 5:c=a,v.label=6;case 6:return c<p.bucketSize?[4,i[e][c]]:[3,9];case 7:v.sent(),v.label=8;case 8:return++c,[3,6];case 9:c=e+1,v.label=10;case 10:if(!(c<n))return[3,15];g=0,v.label=11;case 11:return g<p.bucketSize?[4,i[c][g]]:[3,14];case 12:v.sent(),v.label=13;case 13:return++g,[3,11];case 14:return++c,[3,10];case 15:c=0,v.label=16;case 16:return c<=t?[4,i[n][c]]:[3,19];case 17:v.sent(),v.label=18;case 18:return++c,[3,16];case 19:return[2]}})}()},function(){var g=p.bucketSize;d.size?g=d.size():d.length&&(g=d.length);var c=g*p.sigma;o=Math.ceil(c/p.bucketSize),o=Math.max(o,3);for(var v=0;v<o;++v)i.push(new Array(p.bucketSize));var _=Math.ceil(g/p.bucketSize);e=Math.floor(o/2)-Math.floor(_/2),n=e,d.forEach(function(E){return u.pushBack(E)})}(),Object.freeze(this)}Object.defineProperty(q,"__esModule",{value:!0}),p.sigma=3,p.bucketSize=5e3,Object.freeze(p),q.default=p},{}],27:[function(I,z,q){var w=this&&this.__generator||function(e,a){var n,t,o,f,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(c){return function(v){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,t&&(o=2&v[0]?t.return:v[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,v[1])).done)return o;switch(t=0,o&&(v=[2&v[0],o.value]),v[0]){case 0:case 1:o=v;break;case 4:return l.label++,{value:v[1],done:!1};case 5:l.label++,t=v[1],v=[0];continue;case 7:v=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(v[0]===6||v[0]===2)){l=0;continue}if(v[0]===3&&(!o||v[1]>o[0]&&v[1]<o[3])){l.label=v[1];break}if(v[0]===6&&l.label<o[1]){l.label=o[1],o=v;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(v);break}o[2]&&l.ops.pop(),l.trys.pop();continue}v=a.call(e,l)}catch(_){v=[6,_],t=0}finally{n=o=0}if(5&v[0])throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}([g,c])}}},p=this&&this.__values||function(e){var a=typeof Symbol=="function"&&Symbol.iterator,n=a&&e[a],t=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(q,"__esModule",{value:!0});var d=I("../LinkList/LinkList"),u=I("../Map/Map");function i(e,a,n){var t=this;if(e===void 0&&(e=[]),a===void 0&&(a=i.initSize),n=n||function(h){var g,c,v=0,_="";if(typeof h=="number")v=((v=Math.floor(h))<<5)-v,v&=v;else{_=typeof h!="string"?JSON.stringify(h):h;try{for(var E=p(_),T=E.next();!T.done;T=E.next())v=(v<<5)-v+T.value.charCodeAt(0),v&=v}catch(S){g={error:S}}finally{try{T&&!T.done&&(c=E.return)&&c.call(E)}finally{if(g)throw g.error}}}return v^=v>>>16},(a&a-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var o=0,f=[],l=Math.max(i.initSize,Math.min(i.maxSize,a));this.size=function(){return o},this.empty=function(){return o===0},this.clear=function(){o=0,l=a,f=[]},this.forEach=function(h){var g=0;f.forEach(function(c){c.forEach(function(v){h(v,g++)})})},this.setElement=function(h,g){var c,v;if(h==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(g!=null){var _=n(h)&l-1;if(f[_]){var E=f[_].size();if(f[_]instanceof d.default){try{for(var T=p(f[_]),S=T.next();!S.done;S=T.next()){var F=S.value;if(F.key===h)return void(F.value=g)}}catch(m){c={error:m}}finally{try{S&&!S.done&&(v=T.return)&&v.call(T)}finally{if(c)throw c.error}}f[_].pushBack({key:h,value:g}),f[_].size()>=i.treeifyThreshold&&(f[_]=new u.default(f[_]))}else f[_].setElement(h,g);var W=f[_].size();o+=W-E}else++o,f[_]=new d.default([{key:h,value:g}]);o>l*i.sigma&&function(m){if(!(m>=i.maxSize)){l=2*m;var y=[];f.forEach(function(C,k){if(!C.empty()){if(C instanceof d.default&&C.size()===1){var A=C.front(),N=A.key,L=A.value;y[n(N)&l-1]=new d.default([{key:N,value:L}])}else if(C instanceof u.default){var B=new d.default,P=new d.default;C.forEach(function(O){(n(O.key)&m)==0?B.pushBack(O):P.pushBack(O)}),B.size()>i.untreeifyThreshold?y[k]=new u.default(B):B.size()&&(y[k]=B),P.size()>i.untreeifyThreshold?y[k+m]=new u.default(P):P.size()&&(y[k+m]=P)}else{var M=new d.default,R=new d.default;C.forEach(function(O){(n(O.key)&m)==0?M.pushBack(O):R.pushBack(O)}),M.size()&&(y[k]=M),R.size()&&(y[k+m]=R)}f[k].clear()}}),f=y}}.call(this,l)}else this.eraseElementByKey(h)},this.getElementByKey=function(h){var g,c,v=n(h)&l-1;if(f[v]){if(f[v]instanceof u.default)return f[v].getElementByKey(h);try{for(var _=p(f[v]),E=_.next();!E.done;E=_.next()){var T=E.value;if(T.key===h)return T.value}}catch(S){g={error:S}}finally{try{E&&!E.done&&(c=_.return)&&c.call(_)}finally{if(g)throw g.error}}}},this.eraseElementByKey=function(h){var g,c,v=n(h)&l-1;if(f[v]){var _=f[v].size();if(f[v]instanceof u.default)f[v].eraseElementByKey(h),f[v].size()<=i.untreeifyThreshold&&(f[v]=new d.default(f[v]));else{var E=-1;try{for(var T=p(f[v]),S=T.next();!S.done;S=T.next())if(++E,S.value.key===h){f[v].eraseElementByPos(E);break}}catch(W){g={error:W}}finally{try{S&&!S.done&&(c=T.return)&&c.call(T)}finally{if(g)throw g.error}}}var F=f[v].size();o+=F-_}},this.find=function(h){var g,c,v=n(h)&l-1;if(!f[v])return!1;if(f[v]instanceof u.default)return f[v].find(h);try{for(var _=p(f[v]),E=_.next();!E.done;E=_.next())if(E.value.key===h)return!0}catch(T){g={error:T}}finally{try{E&&!E.done&&(c=_.return)&&c.call(_)}finally{if(g)throw g.error}}return!1},this[Symbol.iterator]=function(){return function(){var h,g,c,v,_,E;return w(this,function(T){switch(T.label){case 0:h=0,T.label=1;case 1:if(!(h<l))return[3,10];for(;h<l&&!f[h];)++h;if(h>=l)return[3,10];T.label=2;case 2:T.trys.push([2,7,8,9]),_=void 0,g=p(f[h]),c=g.next(),T.label=3;case 3:return c.done?[3,6]:[4,c.value];case 4:T.sent(),T.label=5;case 5:return c=g.next(),[3,3];case 6:return[3,9];case 7:return v=T.sent(),_={error:v},[3,9];case 8:try{c&&!c.done&&(E=g.return)&&E.call(g)}finally{if(_)throw _.error}return[7];case 9:return++h,[3,1];case 10:return[2]}})}()},e.forEach(function(h){var g=h.key,c=h.value;return t.setElement(g,c)}),Object.freeze(this)}i.initSize=16,i.maxSize=1<<30,i.sigma=.75,i.treeifyThreshold=8,i.untreeifyThreshold=6,i.minTreeifySize=64,Object.freeze(i),q.default=i},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(I,z,q){var w=this&&this.__generator||function(e,a){var n,t,o,f,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(c){return function(v){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,t&&(o=2&v[0]?t.return:v[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,v[1])).done)return o;switch(t=0,o&&(v=[2&v[0],o.value]),v[0]){case 0:case 1:o=v;break;case 4:return l.label++,{value:v[1],done:!1};case 5:l.label++,t=v[1],v=[0];continue;case 7:v=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(v[0]===6||v[0]===2)){l=0;continue}if(v[0]===3&&(!o||v[1]>o[0]&&v[1]<o[3])){l.label=v[1];break}if(v[0]===6&&l.label<o[1]){l.label=o[1],o=v;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(v);break}o[2]&&l.ops.pop(),l.trys.pop();continue}v=a.call(e,l)}catch(_){v=[6,_],t=0}finally{n=o=0}if(5&v[0])throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}([g,c])}}},p=this&&this.__values||function(e){var a=typeof Symbol=="function"&&Symbol.iterator,n=a&&e[a],t=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(q,"__esModule",{value:!0});var d=I("../Set/Set"),u=I("../LinkList/LinkList");function i(e,a,n){var t=this;if(e===void 0&&(e=[]),a===void 0&&(a=i.initSize),n=n||function(h){var g=0,c="";if(typeof h=="number")g=((g=Math.floor(h))<<5)-g,g&=g;else{c=typeof h!="string"?JSON.stringify(h):h;for(var v=0;v<c.length;v++)g=(g<<5)-g+c.charCodeAt(v),g&=g}return g^=g>>>16},(a&a-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var o=0,f=[],l=Math.max(i.initSize,Math.min(i.maxSize,a));this.size=function(){return o},this.empty=function(){return o===0},this.clear=function(){o=0,l=a,f=[]},this.forEach=function(h){var g=0;f.forEach(function(c){c.forEach(function(v){h(v,g++)})})},this.insert=function(h){if(h==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var g=n(h)&l-1;if(f[g]){var c=f[g].size();if(f[g]instanceof u.default){if(f[g].find(h))return;f[g].pushBack(h),f[g].size()>=i.treeifyThreshold&&(f[g]=new d.default(f[g]))}else f[g].insert(h);var v=f[g].size();o+=v-c}else f[g]=new u.default([h]),++o;o>l*i.sigma&&function(_){if(!(_>=i.maxSize)){l=2*_;var E=[];f.forEach(function(T,S){if(!T.empty()){if(T instanceof u.default&&T.size()===1){var F=T.front();if(F===void 0)throw new Error("unknown error");E[n(F)&l-1]=new u.default([F])}else if(T instanceof d.default){var W=new u.default,m=new u.default;T.forEach(function(k){(n(k)&_)==0?W.pushBack(k):m.pushBack(k)}),W.size()>i.untreeifyThreshold?E[S]=new d.default(W):W.size()&&(E[S]=W),m.size()>i.untreeifyThreshold?E[S+_]=new d.default(m):m.size()&&(E[S+_]=m)}else{var y=new u.default,C=new u.default;T.forEach(function(k){(n(k)&_)==0?y.pushBack(k):C.pushBack(k)}),y.size()&&(E[S]=y),C.size()&&(E[S+_]=C)}f[S].clear()}}),f=E}}.call(this,l)},this.eraseElementByValue=function(h){var g=n(h)&l-1;if(f[g]){var c=f[g].size();f[g].eraseElementByValue(h),f[g]instanceof d.default&&f[g].size()<=i.untreeifyThreshold&&(f[g]=new u.default(f[g]));var v=f[g].size();o+=v-c}},this.find=function(h){var g=n(h)&l-1;return!!f[g]&&f[g].find(h)},this[Symbol.iterator]=function(){return function(){var h,g,c,v,_,E;return w(this,function(T){switch(T.label){case 0:h=0,T.label=1;case 1:if(!(h<l))return[3,10];for(;h<l&&!f[h];)++h;if(h>=l)return[3,10];T.label=2;case 2:T.trys.push([2,7,8,9]),_=void 0,g=p(f[h]),c=g.next(),T.label=3;case 3:return c.done?[3,6]:[4,c.value];case 4:T.sent(),T.label=5;case 5:return c=g.next(),[3,3];case 6:return[3,9];case 7:return v=T.sent(),_={error:v},[3,9];case 8:try{c&&!c.done&&(E=g.return)&&E.call(g)}finally{if(_)throw _.error}return[7];case 9:return++h,[3,1];case 10:return[2]}})}()},e.forEach(function(h){return t.insert(h)}),Object.freeze(this)}i.initSize=16,i.maxSize=1<<30,i.sigma=.75,i.treeifyThreshold=8,i.untreeifyThreshold=6,i.minTreeifySize=64,Object.freeze(i),q.default=i},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(I,z,q){var w=this&&this.__generator||function(u,i){var e,a,n,t,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return t={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(t[Symbol.iterator]=function(){return this}),t;function f(l){return function(h){return function(g){if(e)throw new TypeError("Generator is already executing.");for(;o;)try{if(e=1,a&&(n=2&g[0]?a.return:g[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,g[1])).done)return n;switch(a=0,n&&(g=[2&g[0],n.value]),g[0]){case 0:case 1:n=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,a=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(g[0]===6||g[0]===2)){o=0;continue}if(g[0]===3&&(!n||g[1]>n[0]&&g[1]<n[3])){o.label=g[1];break}if(g[0]===6&&o.label<n[1]){o.label=n[1],n=g;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(g);break}n[2]&&o.ops.pop(),o.trys.pop();continue}g=i.call(u,o)}catch(c){g=[6,c],a=0}finally{e=n=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([l,h])}}};Object.defineProperty(q,"__esModule",{value:!0});var p=function(){return function(u){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=u}}();function d(u){var i=this;u===void 0&&(u=[]);var e=0,a=void 0,n=void 0;this.size=function(){return e},this.empty=function(){return e===0},this.clear=function(){a=n=void 0,e=0},this.front=function(){return a==null?void 0:a.value},this.back=function(){return n==null?void 0:n.value},this.forEach=function(t){for(var o=a,f=0;o;){if(o.value===void 0)throw new Error("unknown error");t(o.value,f++),o=o.next}},this.getElementByPos=function(t){if(t<0||t>=e)throw new Error("pos must more then 0 and less then the list length");for(var o=a;t--&&o;)o=o.next;if(!o||o.value===void 0)throw new Error("unknown error");return o.value},this.eraseElementByPos=function(t){if(t<0||t>=e)throw new Error("erase pos must more then 0 and less then the list length");if(t===0)this.popFront();else if(t===e-1)this.popBack();else{for(var o=a;t--;){if(!(o!=null&&o.next))throw new Error("unknown error");o=o.next}if(!o||!o.pre||!o.next)throw new Error("unknown error");var f=o.pre,l=o.next;l.pre=f,f.next=l,e>0&&--e}},this.eraseElementByValue=function(t){for(;a&&a.value===t;)this.popFront();for(;n&&n.value===t;)this.popBack();if(a)for(var o=a;o;){if(o.value===t){var f=o.pre,l=o.next;l&&(l.pre=f),f&&(f.next=l),e>0&&--e}o=o.next}},this.pushBack=function(t){if(t==null)throw new Error("you can't push null or undefined here");++e;var o=new p(t);n?(n.next=o,o.pre=n,n=o):a=n=o},this.popBack=function(){n&&(e>0&&--e,n&&(a===n?a=n=void 0:(n=n.pre)&&(n.next=void 0)))},this.setElementByPos=function(t,o){if(o==null)throw new Error("you can't set null or undefined here");if(t<0||t>=e)throw new Error("pos must more then 0 and less then the list length");for(var f=a;t--;){if(!f)throw new Error("unknown error");f=f.next}f&&(f.value=o)},this.insert=function(t,o,f){if(f===void 0&&(f=1),o==null)throw new Error("you can't insert null or undefined here");if(t<0||t>e)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(f<0)throw new Error("insert size must more than 0");if(t===0)for(;f--;)this.pushFront(o);else if(t===e)for(;f--;)this.pushBack(o);else{for(var l=a,h=1;h<t;++h){if(!(l!=null&&l.next))throw new Error("unknown error");l=l==null?void 0:l.next}if(!l)throw new Error("unknown error");var g=l.next;for(e+=f;f--;)l.next=new p(o),l.next.pre=l,l=l.next;l.next=g,g&&(g.pre=l)}},this.find=function(t){for(var o=a;o;){if(o.value===t)return!0;o=o.next}return!1},this.reverse=function(){for(var t=a,o=n,f=0;t&&o&&2*f<e;){var l=t.value;t.value=o.value,o.value=l,t=t.next,o=o.pre,++f}},this.unique=function(){for(var t=a;t;){for(var o=t;o&&o.next&&o.value===o.next.value;)o=o.next,e>0&&--e;t.next=o.next,t.next&&(t.next.pre=t),t=t.next}},this.sort=function(t){var o=[];this.forEach(function(l){o.push(l)}),o.sort(t);var f=a;o.forEach(function(l){f&&(f.value=l,f=f.next)})},this.pushFront=function(t){if(t==null)throw new Error("you can't push null or undefined here");++e;var o=new p(t);a?(o.next=a,a.pre=o,a=o):a=n=o},this.popFront=function(){a&&(e>0&&--e,a&&(a===n?a=n=void 0:(a=a.next)&&(a.pre=void 0)))},this.merge=function(t){var o=this,f=a;t.forEach(function(l){for(;f&&f.value!==void 0&&f.value<=l;)f=f.next;if(f===void 0)o.pushBack(l),f=n;else if(f===a)o.pushFront(l),f=a;else{++e;var h=f.pre;h&&(h.next=new p(l),h.next.pre=h,h.next.next=f,f&&(f.pre=h.next))}})},this[Symbol.iterator]=function(){return function(){var t;return w(this,function(o){switch(o.label){case 0:t=a,o.label=1;case 1:if(t===void 0)return[3,3];if(!t.value)throw new Error("unknown error");return[4,t.value];case 2:return o.sent(),t=t.next,[3,1];case 3:return[2]}})}()},u.forEach(function(t){return i.pushBack(t)}),Object.freeze(this)}Object.freeze(d),q.default=d},{}],30:[function(I,z,q){var w=this&&this.__generator||function(i,e){var a,n,t,o,f={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(h){return function(g){return function(c){if(a)throw new TypeError("Generator is already executing.");for(;f;)try{if(a=1,n&&(t=2&c[0]?n.return:c[0]?n.throw||((t=n.return)&&t.call(n),0):n.next)&&!(t=t.call(n,c[1])).done)return t;switch(n=0,t&&(c=[2&c[0],t.value]),c[0]){case 0:case 1:t=c;break;case 4:return f.label++,{value:c[1],done:!1};case 5:f.label++,n=c[1],c=[0];continue;case 7:c=f.ops.pop(),f.trys.pop();continue;default:if(!(t=(t=f.trys).length>0&&t[t.length-1])&&(c[0]===6||c[0]===2)){f=0;continue}if(c[0]===3&&(!t||c[1]>t[0]&&c[1]<t[3])){f.label=c[1];break}if(c[0]===6&&f.label<t[1]){f.label=t[1],t=c;break}if(t&&f.label<t[2]){f.label=t[2],f.ops.push(c);break}t[2]&&f.ops.pop(),f.trys.pop();continue}c=e.call(i,f)}catch(v){c=[6,v],n=0}finally{a=t=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([h,g])}}},p=this&&this.__values||function(i){var e=typeof Symbol=="function"&&Symbol.iterator,a=e&&i[e],n=0;if(a)return a.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(q,"__esModule",{value:!0});var d=I("../Base/TreeNode");function u(i,e){var a=this;i===void 0&&(i=[]),e=e||function(m,y){return m<y?-1:m>y?1:0};var n=0,t=new d.default;t.color=d.default.TreeNodeColorType.black,this.size=function(){return n},this.empty=function(){return n===0},this.clear=function(){n=0,t.key=t.value=void 0,t.leftChild=t.rightChild=t.brother=void 0};var o=function(m){if(!m||m.key===void 0)throw new Error("unknown error");return m.leftChild?o(m.leftChild):m},f=function(m){if(!m||m.key===void 0)throw new Error("unknown error");return m.rightChild?f(m.rightChild):m};this.front=function(){if(!this.empty()){var m=o(t);if(m.key===void 0||m.value===void 0)throw new Error("unknown error");return{key:m.key,value:m.value}}},this.back=function(){if(!this.empty()){var m=f(t);if(m.key===void 0||m.value===void 0)throw new Error("unknown error");return{key:m.key,value:m.value}}},this.forEach=function(m){var y,C,k=0;try{for(var A=p(this),N=A.next();!N.done;N=A.next())m(N.value,k++)}catch(L){y={error:L}}finally{try{N&&!N.done&&(C=A.return)&&C.call(A)}finally{if(y)throw y.error}}},this.getElementByPos=function(m){var y,C;if(m<0||m>=this.size())throw new Error("pos must more than 0 and less than set's size");var k=0;try{for(var A=p(this),N=A.next();!N.done;N=A.next()){var L=N.value;if(k===m)return L;++k}}catch(B){y={error:B}}finally{try{N&&!N.done&&(C=A.return)&&C.call(A)}finally{if(y)throw y.error}}throw new Error("unknown Error")};var l=function(m,y){if(m&&m.key!==void 0&&m.value!==void 0){var C=e(m.key,y);return C===0?{key:m.key,value:m.value}:C<0?l(m.rightChild,y):l(m.leftChild,y)||{key:m.key,value:m.value}}};this.lowerBound=function(m){return l(t,m)};var h=function(m,y){if(m&&m.key!==void 0&&m.value!==void 0)return e(m.key,y)<=0?h(m.rightChild,y):h(m.leftChild,y)||{key:m.key,value:m.value}};this.upperBound=function(m){return h(t,m)};var g=function(m,y){if(m&&m.key!==void 0&&m.value!==void 0){var C=e(m.key,y);return C===0?{key:m.key,value:m.value}:C>0?g(m.leftChild,y):g(m.rightChild,y)||{key:m.key,value:m.value}}};this.reverseLowerBound=function(m){return g(t,m)};var c=function(m,y){if(m&&m.key!==void 0&&m.value!==void 0)return e(m.key,y)>=0?c(m.leftChild,y):c(m.rightChild,y)||{key:m.key,value:m.value}};this.reverseUpperBound=function(m){return c(t,m)};var v=function(m){var y=m.parent;if(!y){if(m===t)return;throw new Error("unknown error")}if(m.color!==d.default.TreeNodeColorType.red){var C=m.brother;if(!C)throw new Error("unknown error");if(m===y.leftChild)if(C.color===d.default.TreeNodeColorType.red){C.color=d.default.TreeNodeColorType.black,y.color=d.default.TreeNodeColorType.red;var k=y.rotateLeft();t===y&&(t=k),v(m)}else C.color===d.default.TreeNodeColorType.black&&(C.rightChild&&C.rightChild.color===d.default.TreeNodeColorType.red?(C.color=y.color,y.color=d.default.TreeNodeColorType.black,C.rightChild&&(C.rightChild.color=d.default.TreeNodeColorType.black),k=y.rotateLeft(),t===y&&(t=k),m.color=d.default.TreeNodeColorType.black):C.rightChild&&C.rightChild.color!==d.default.TreeNodeColorType.black||!C.leftChild||C.leftChild.color!==d.default.TreeNodeColorType.red?C.leftChild&&C.leftChild.color!==d.default.TreeNodeColorType.black||C.rightChild&&C.rightChild.color!==d.default.TreeNodeColorType.black||(C.color=d.default.TreeNodeColorType.red,v(y)):(C.color=d.default.TreeNodeColorType.red,C.leftChild&&(C.leftChild.color=d.default.TreeNodeColorType.black),k=C.rotateRight(),t===C&&(t=k),v(m)));else m===y.rightChild&&(C.color===d.default.TreeNodeColorType.red?(C.color=d.default.TreeNodeColorType.black,y.color=d.default.TreeNodeColorType.red,k=y.rotateRight(),t===y&&(t=k),v(m)):C.color===d.default.TreeNodeColorType.black&&(C.leftChild&&C.leftChild.color===d.default.TreeNodeColorType.red?(C.color=y.color,y.color=d.default.TreeNodeColorType.black,C.leftChild&&(C.leftChild.color=d.default.TreeNodeColorType.black),k=y.rotateRight(),t===y&&(t=k),m.color=d.default.TreeNodeColorType.black):C.leftChild&&C.leftChild.color!==d.default.TreeNodeColorType.black||!C.rightChild||C.rightChild.color!==d.default.TreeNodeColorType.red?C.leftChild&&C.leftChild.color!==d.default.TreeNodeColorType.black||C.rightChild&&C.rightChild.color!==d.default.TreeNodeColorType.black||(C.color=d.default.TreeNodeColorType.red,v(y)):(C.color=d.default.TreeNodeColorType.red,C.rightChild&&(C.rightChild.color=d.default.TreeNodeColorType.black),k=C.rotateLeft(),t===C&&(t=k),v(m))))}else m.color=d.default.TreeNodeColorType.black},_=function(m){for(var y=m;y.leftChild||y.rightChild;){if(y.rightChild){y=o(y.rightChild);var C=m.key;m.key=y.key,y.key=C;var k=m.value;m.value=y.value,y.value=k,m=y}y.leftChild&&(y=f(y.leftChild),C=m.key,m.key=y.key,y.key=C,k=m.value,m.value=y.value,y.value=k,m=y)}v(y),y&&y.remove(),--n,t.color=d.default.TreeNodeColorType.black},E=function(m,y){return!(!m||m.key===void 0)&&(!!E(m.leftChild,y)||!!y(m)||E(m.rightChild,y))};this.eraseElementByPos=function(m){if(m<0||m>=n)throw new Error("pos must more than 0 and less than set's size");var y=0;E(t,function(C){return m===y?(_(C),!0):(++y,!1)})},this.eraseElementByKey=function(m){if(!this.empty()){var y=F(t,m);y!==void 0&&y.key!==void 0&&e(y.key,m)===0&&_(y)}};var T=function(m,y){if(!m||m.key===void 0)throw new Error("unknown error");var C=e(y,m.key);return C<0?m.leftChild?T(m.leftChild,y):(m.leftChild=new d.default,m.leftChild.parent=m,m.leftChild.brother=m.rightChild,m.rightChild&&(m.rightChild.brother=m.leftChild),m.leftChild):C>0?m.rightChild?T(m.rightChild,y):(m.rightChild=new d.default,m.rightChild.parent=m,m.rightChild.brother=m.leftChild,m.leftChild&&(m.leftChild.brother=m.rightChild),m.rightChild):m},S=function(m){var y=m.parent;if(!y){if(m===t)return;throw new Error("unknown error")}if(y.color!==d.default.TreeNodeColorType.black&&y.color===d.default.TreeNodeColorType.red){var C=y.brother,k=y.parent;if(!k)throw new Error("unknown error");if(C&&C.color===d.default.TreeNodeColorType.red)C.color=y.color=d.default.TreeNodeColorType.black,k.color=d.default.TreeNodeColorType.red,S(k);else if(!C||C.color===d.default.TreeNodeColorType.black)if(y===k.leftChild)if(m===y.leftChild){y.color=d.default.TreeNodeColorType.black,k.color=d.default.TreeNodeColorType.red;var A=k.rotateRight();k===t&&(t=A)}else m===y.rightChild&&(A=y.rotateLeft(),k===t&&(t=A),S(y));else y===k.rightChild&&(m===y.leftChild?(A=y.rotateRight(),k===t&&(t=A),S(y)):m===y.rightChild&&(y.color=d.default.TreeNodeColorType.black,k.color=d.default.TreeNodeColorType.red,A=k.rotateLeft(),k===t&&(t=A)))}};this.setElement=function(m,y){if(m==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(y!=null){if(this.empty())return++n,t.key=m,t.value=y,void(t.color=d.default.TreeNodeColorType.black);var C=T(t,m);C.key===void 0||e(C.key,m)!==0?(++n,C.key=m,C.value=y,S(C),t.color=d.default.TreeNodeColorType.black):C.value=y}else this.eraseElementByKey(m)};var F=function(m,y){if(m&&m.key!==void 0){var C=e(y,m.key);return C<0?F(m.leftChild,y):C>0?F(m.rightChild,y):m}};this.find=function(m){return!!F(t,m)},this.getElementByKey=function(m){var y=F(t,m);if((y==null?void 0:y.key)===void 0||(y==null?void 0:y.value)===void 0)throw new Error("unknown error");return y.value},this.union=function(m){var y=this;m.forEach(function(C){var k=C.key,A=C.value;return y.setElement(k,A)})},this.getHeight=function(){if(this.empty())return 0;var m=function(y){return y?Math.max(m(y.leftChild),m(y.rightChild))+1:1};return m(t)};var W=function(m){return w(this,function(y){switch(y.label){case 0:return m&&m.key!==void 0&&m.value!==void 0?[5,p(W(m.leftChild))]:[2];case 1:return y.sent(),[4,{key:m.key,value:m.value}];case 2:return y.sent(),[5,p(W(m.rightChild))];case 3:return y.sent(),[2]}})};this[Symbol.iterator]=function(){return W(t)},i.forEach(function(m){var y=m.key,C=m.value;return a.setElement(y,C)}),Object.freeze(this)}Object.freeze(u),q.default=u},{"../Base/TreeNode":25}],31:[function(I,z,q){function w(p,d){p===void 0&&(p=[]),d=d||function(n,t){return n>t?-1:n<t?1:0};var u=[];p.forEach(function(n){return u.push(n)});var i=u.length,e=function(n,t){if(n<0||n>=i)throw new Error("unknown error");if(t<0||t>=i)throw new Error("unknown error");var o=u[n];u[n]=u[t],u[t]=o},a=function(n){if(n<0||n>=i)throw new Error("unknown error");var t=2*n+1,o=2*n+2;t<i&&d(u[n],u[t])>0&&e(n,t),o<i&&d(u[n],u[o])>0&&e(n,o)};(function(){for(var n=Math.floor((i-1)/2);n>=0;--n)for(var t=n,o=2*t+1;o<i;){var f=o+1,l=o;if(f<i&&d(u[o],u[f])>0&&(l=f),d(u[t],u[l])<=0)break;e(t,l),o=2*(t=l)+1}})(),this.size=function(){return i},this.empty=function(){return i===0},this.clear=function(){i=0,u.length=0},this.push=function(n){if(u.push(n),++i!==1)for(var t=i-1;t>0;){var o=Math.floor((t-1)/2);if(d(u[o],n)<=0)break;a(o),t=o}},this.pop=function(){if(!this.empty())if(this.size()!==1){var n=u[i-1];--i;for(var t=0;t<this.size();){var o=2*t+1,f=2*t+2;if(o>=this.size())break;var l=o;if(f<this.size()&&d(u[o],u[f])>0&&(l=f),d(u[l],n)>=0)break;u[t]=u[l],t=l}u[t]=n}else--i},this.top=function(){return u[0]},Object.freeze(this)}Object.defineProperty(q,"__esModule",{value:!0}),Object.freeze(w),q.default=w},{}],32:[function(I,z,q){Object.defineProperty(q,"__esModule",{value:!0});var w=I("../LinkList/LinkList");function p(d){d===void 0&&(d=[]);var u=new w.default(d);this.size=function(){return u.size()},this.empty=function(){return u.empty()},this.clear=function(){u.clear()},this.push=function(i){u.pushBack(i)},this.pop=function(){u.popFront()},this.front=function(){return u.front()},Object.freeze(this)}Object.freeze(p),q.default=p},{"../LinkList/LinkList":29}],33:[function(I,z,q){var w=this&&this.__generator||function(i,e){var a,n,t,o,f={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(h){return function(g){return function(c){if(a)throw new TypeError("Generator is already executing.");for(;f;)try{if(a=1,n&&(t=2&c[0]?n.return:c[0]?n.throw||((t=n.return)&&t.call(n),0):n.next)&&!(t=t.call(n,c[1])).done)return t;switch(n=0,t&&(c=[2&c[0],t.value]),c[0]){case 0:case 1:t=c;break;case 4:return f.label++,{value:c[1],done:!1};case 5:f.label++,n=c[1],c=[0];continue;case 7:c=f.ops.pop(),f.trys.pop();continue;default:if(!(t=(t=f.trys).length>0&&t[t.length-1])&&(c[0]===6||c[0]===2)){f=0;continue}if(c[0]===3&&(!t||c[1]>t[0]&&c[1]<t[3])){f.label=c[1];break}if(c[0]===6&&f.label<t[1]){f.label=t[1],t=c;break}if(t&&f.label<t[2]){f.label=t[2],f.ops.push(c);break}t[2]&&f.ops.pop(),f.trys.pop();continue}c=e.call(i,f)}catch(v){c=[6,v],n=0}finally{a=t=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([h,g])}}},p=this&&this.__values||function(i){var e=typeof Symbol=="function"&&Symbol.iterator,a=e&&i[e],n=0;if(a)return a.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(q,"__esModule",{value:!0});var d=I("../Base/TreeNode");function u(i,e){var a=this;i===void 0&&(i=[]),e=e||function(m,y){return m<y?-1:m>y?1:0};var n=0,t=new d.default;t.color=d.default.TreeNodeColorType.black,this.size=function(){return n},this.empty=function(){return n===0},this.clear=function(){n=0,t.key=void 0,t.leftChild=t.rightChild=t.brother=t.parent=void 0,t.color=d.default.TreeNodeColorType.black};var o=function(m){if(!m||m.key===void 0)throw new Error("unknown error");return m.leftChild?o(m.leftChild):m},f=function(m){if(!m||m.key===void 0)throw new Error("unknown error");return m.rightChild?f(m.rightChild):m};this.front=function(){if(!this.empty())return o(t).key},this.back=function(){if(!this.empty())return f(t).key},this.forEach=function(m){var y,C,k=0;try{for(var A=p(this),N=A.next();!N.done;N=A.next())m(N.value,k++)}catch(L){y={error:L}}finally{try{N&&!N.done&&(C=A.return)&&C.call(A)}finally{if(y)throw y.error}}},this.getElementByPos=function(m){var y,C;if(m<0||m>=this.size())throw new Error("pos must more than 0 and less than set's size");var k=0;try{for(var A=p(this),N=A.next();!N.done;N=A.next()){var L=N.value;if(k===m)return L;++k}}catch(B){y={error:B}}finally{try{N&&!N.done&&(C=A.return)&&C.call(A)}finally{if(y)throw y.error}}throw new Error("unknown error")};var l=function(m){var y=m.parent;if(!y){if(m===t)return;throw new Error("unknown error")}if(m.color!==d.default.TreeNodeColorType.red){var C=m.brother;if(!C)throw new Error("unknown error");if(m===y.leftChild)if(C.color===d.default.TreeNodeColorType.red){C.color=d.default.TreeNodeColorType.black,y.color=d.default.TreeNodeColorType.red;var k=y.rotateLeft();t===y&&(t=k),l(m)}else C.color===d.default.TreeNodeColorType.black&&(C.rightChild&&C.rightChild.color===d.default.TreeNodeColorType.red?(C.color=y.color,y.color=d.default.TreeNodeColorType.black,C.rightChild&&(C.rightChild.color=d.default.TreeNodeColorType.black),k=y.rotateLeft(),t===y&&(t=k),m.color=d.default.TreeNodeColorType.black):C.rightChild&&C.rightChild.color!==d.default.TreeNodeColorType.black||!C.leftChild||C.leftChild.color!==d.default.TreeNodeColorType.red?C.leftChild&&C.leftChild.color!==d.default.TreeNodeColorType.black||C.rightChild&&C.rightChild.color!==d.default.TreeNodeColorType.black||(C.color=d.default.TreeNodeColorType.red,l(y)):(C.color=d.default.TreeNodeColorType.red,C.leftChild&&(C.leftChild.color=d.default.TreeNodeColorType.black),k=C.rotateRight(),t===C&&(t=k),l(m)));else m===y.rightChild&&(C.color===d.default.TreeNodeColorType.red?(C.color=d.default.TreeNodeColorType.black,y.color=d.default.TreeNodeColorType.red,k=y.rotateRight(),t===y&&(t=k),l(m)):C.color===d.default.TreeNodeColorType.black&&(C.leftChild&&C.leftChild.color===d.default.TreeNodeColorType.red?(C.color=y.color,y.color=d.default.TreeNodeColorType.black,C.leftChild&&(C.leftChild.color=d.default.TreeNodeColorType.black),k=y.rotateRight(),t===y&&(t=k),m.color=d.default.TreeNodeColorType.black):C.leftChild&&C.leftChild.color!==d.default.TreeNodeColorType.black||!C.rightChild||C.rightChild.color!==d.default.TreeNodeColorType.red?C.leftChild&&C.leftChild.color!==d.default.TreeNodeColorType.black||C.rightChild&&C.rightChild.color!==d.default.TreeNodeColorType.black||(C.color=d.default.TreeNodeColorType.red,l(y)):(C.color=d.default.TreeNodeColorType.red,C.rightChild&&(C.rightChild.color=d.default.TreeNodeColorType.black),k=C.rotateLeft(),t===C&&(t=k),l(m))))}else m.color=d.default.TreeNodeColorType.black},h=function(m){for(var y=m;y.leftChild||y.rightChild;){if(y.rightChild){y=o(y.rightChild);var C=m.key;m.key=y.key,y.key=C,m=y}y.leftChild&&(y=f(y.leftChild),C=m.key,m.key=y.key,y.key=C,m=y)}l(y),y&&y.remove(),--n,t.color=d.default.TreeNodeColorType.black},g=function(m,y){return!(!m||m.key===void 0)&&(!!g(m.leftChild,y)||!!y(m)||g(m.rightChild,y))};this.eraseElementByPos=function(m){if(m<0||m>=n)throw new Error("pos must more than 0 and less than set's size");var y=0;g(t,function(C){return m===y?(h(C),!0):(++y,!1)})},this.eraseElementByValue=function(m){if(!this.empty()){var y=_(t,m);y!==void 0&&y.key!==void 0&&e(y.key,m)===0&&h(y)}};var c=function(m,y){if(!m||m.key===void 0)throw new Error("unknown error");var C=e(y,m.key);return C<0?m.leftChild?c(m.leftChild,y):(m.leftChild=new d.default,m.leftChild.parent=m,m.leftChild.brother=m.rightChild,m.rightChild&&(m.rightChild.brother=m.leftChild),m.leftChild):C>0?m.rightChild?c(m.rightChild,y):(m.rightChild=new d.default,m.rightChild.parent=m,m.rightChild.brother=m.leftChild,m.leftChild&&(m.leftChild.brother=m.rightChild),m.rightChild):m},v=function(m){var y=m.parent;if(!y){if(m===t)return;throw new Error("unknown error")}if(y.color!==d.default.TreeNodeColorType.black&&y.color===d.default.TreeNodeColorType.red){var C=y.brother,k=y.parent;if(!k)throw new Error("unknown error");if(C&&C.color===d.default.TreeNodeColorType.red)C.color=y.color=d.default.TreeNodeColorType.black,k.color=d.default.TreeNodeColorType.red,v(k);else if(!C||C.color===d.default.TreeNodeColorType.black)if(y===k.leftChild)if(m===y.leftChild){y.color=d.default.TreeNodeColorType.black,k.color=d.default.TreeNodeColorType.red;var A=k.rotateRight();k===t&&(t=A)}else m===y.rightChild&&(A=y.rotateLeft(),k===t&&(t=A),v(y));else y===k.rightChild&&(m===y.leftChild?(A=y.rotateRight(),k===t&&(t=A),v(y)):m===y.rightChild&&(y.color=d.default.TreeNodeColorType.black,k.color=d.default.TreeNodeColorType.red,A=k.rotateLeft(),k===t&&(t=A)))}};this.insert=function(m){if(m==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++n,t.key=m,void(t.color=d.default.TreeNodeColorType.black);var y=c(t,m);y.key!==void 0&&e(y.key,m)===0||(++n,y.key=m,v(y),t.color=d.default.TreeNodeColorType.black)};var _=function(m,y){if(m&&m.key!==void 0){var C=e(y,m.key);return C<0?_(m.leftChild,y):C>0?_(m.rightChild,y):m}};this.find=function(m){var y=_(t,m);return y!==void 0&&y.key!==void 0&&e(y.key,m)===0};var E=function(m,y){if(m&&m.key!==void 0){var C=e(m.key,y);if(C===0)return m.key;if(C<0)return E(m.rightChild,y);var k=E(m.leftChild,y);return k!==void 0?k:m.key}};this.lowerBound=function(m){return E(t,m)};var T=function(m,y){if(m&&m.key!==void 0){if(e(m.key,y)<=0)return T(m.rightChild,y);var C=T(m.leftChild,y);return C!==void 0?C:m.key}};this.upperBound=function(m){return T(t,m)};var S=function(m,y){if(m&&m.key!==void 0){var C=e(m.key,y);if(C===0)return m.key;if(C>0)return S(m.leftChild,y);var k=S(m.rightChild,y);return k!==void 0?k:m.key}};this.reverseLowerBound=function(m){return S(t,m)};var F=function(m,y){if(m&&m.key!==void 0){if(e(m.key,y)>=0)return F(m.leftChild,y);var C=F(m.rightChild,y);return C!==void 0?C:m.key}};this.reverseUpperBound=function(m){return F(t,m)},this.union=function(m){var y=this;m.forEach(function(C){return y.insert(C)})},this.getHeight=function(){if(this.empty())return 0;var m=function(y){return y?Math.max(m(y.leftChild),m(y.rightChild))+1:1};return m(t)};var W=function(m){return w(this,function(y){switch(y.label){case 0:return m&&m.key!==void 0?[5,p(W(m.leftChild))]:[2];case 1:return y.sent(),[4,m.key];case 2:return y.sent(),[5,p(W(m.rightChild))];case 3:return y.sent(),[2]}})};this[Symbol.iterator]=function(){return W(t)},i.forEach(function(m){return a.insert(m)}),Object.freeze(this)}Object.freeze(u),q.default=u},{"../Base/TreeNode":25}],34:[function(I,z,q){function w(p){var d=this;p===void 0&&(p=[]);var u=0,i=[];this.size=function(){return u},this.empty=function(){return u===0},this.clear=function(){u=0,i.length=0},this.push=function(e){i.push(e),++u},this.pop=function(){i.pop(),u>0&&--u},this.top=function(){return i[u-1]},p.forEach(function(e){return d.push(e)}),Object.freeze(this)}Object.defineProperty(q,"__esModule",{value:!0}),Object.freeze(w),q.default=w},{}],35:[function(I,z,q){var w=this&&this.__generator||function(e,a){var n,t,o,f,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(c){return function(v){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,t&&(o=2&v[0]?t.return:v[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,v[1])).done)return o;switch(t=0,o&&(v=[2&v[0],o.value]),v[0]){case 0:case 1:o=v;break;case 4:return l.label++,{value:v[1],done:!1};case 5:l.label++,t=v[1],v=[0];continue;case 7:v=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(v[0]===6||v[0]===2)){l=0;continue}if(v[0]===3&&(!o||v[1]>o[0]&&v[1]<o[3])){l.label=v[1];break}if(v[0]===6&&l.label<o[1]){l.label=o[1],o=v;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(v);break}o[2]&&l.ops.pop(),l.trys.pop();continue}v=a.call(e,l)}catch(_){v=[6,_],t=0}finally{n=o=0}if(5&v[0])throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}([g,c])}}},p=this&&this.__read||function(e,a){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var t,o,f=n.call(e),l=[];try{for(;(a===void 0||a-- >0)&&!(t=f.next()).done;)l.push(t.value)}catch(h){o={error:h}}finally{try{t&&!t.done&&(n=f.return)&&n.call(f)}finally{if(o)throw o.error}}return l},d=this&&this.__spreadArray||function(e,a,n){if(n||arguments.length===2)for(var t,o=0,f=a.length;o<f;o++)!t&&o in a||(t||(t=Array.prototype.slice.call(a,0,o)),t[o]=a[o]);return e.concat(t||Array.prototype.slice.call(a))},u=this&&this.__values||function(e){var a=typeof Symbol=="function"&&Symbol.iterator,n=a&&e[a],t=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")};function i(e){var a=this;e===void 0&&(e=[]);var n=0,t=[];this.size=function(){return n},this.empty=function(){return n===0},this.clear=function(){n=0,t.length=0},this.front=function(){if(!this.empty())return t[0]},this.back=function(){if(!this.empty())return t[n-1]},this.forEach=function(o){t.forEach(o)},this.getElementByPos=function(o){if(o<0||o>=n)throw new Error("pos must more than 0 and less than vector's size");return t[o]},this.eraseElementByPos=function(o){if(o<0||o>=n)throw new Error("pos must more than 0 and less than vector's size");for(var f=o;f<n-1;++f)t[f]=t[f+1];this.popBack()},this.eraseElementByValue=function(o){var f=[];this.forEach(function(h){h!==o&&f.push(h)}),f.forEach(function(h,g){t[g]=h});for(var l=f.length;n>l;)this.popBack()},this.pushBack=function(o){t.push(o),++n},this.popBack=function(){t.pop(),n>0&&--n},this.setElementByPos=function(o,f){if(o<0||o>=n)throw new Error("pos must more than 0 and less than vector's size");t[o]=f},this.insert=function(o,f,l){if(l===void 0&&(l=1),o<0||o>n)throw new Error("pos must more than 0 and less than or equal to vector's size");t.splice.apply(t,d([o,0],p(new Array(l).fill(f)),!1)),n+=l},this.find=function(o){return t.includes(o)},this.reverse=function(){t.reverse()},this.unique=function(){var o,f=[];this.forEach(function(h,g){g!==0&&h===o||(f.push(h),o=h)}),f.forEach(function(h,g){t[g]=h});for(var l=f.length;n>l;)this.popBack()},this.sort=function(o){t.sort(o)},this[Symbol.iterator]=function(){return function(){return w(this,function(o){switch(o.label){case 0:return[5,u(t)];case 1:return[2,o.sent()]}})}()},e.forEach(function(o){return a.pushBack(o)}),Object.freeze(this)}Object.defineProperty(q,"__esModule",{value:!0}),Object.freeze(i),q.default=i},{}],36:[function(I,z,q){Object.defineProperty(q,"__esModule",{value:!0}),q.HashMap=q.HashSet=q.Map=q.Set=q.PriorityQueue=q.Deque=q.LinkList=q.Queue=q.Stack=q.Vector=void 0;var w=I("./Vector/Vector");q.Vector=w.default;var p=I("./Stack/Stack");q.Stack=p.default;var d=I("./Queue/Queue");q.Queue=d.default;var u=I("./LinkList/LinkList");q.LinkList=u.default;var i=I("./Deque/Deque");q.Deque=i.default;var e=I("./PriorityQueue/PriorityQueue");q.PriorityQueue=e.default;var a=I("./Set/Set");q.Set=a.default;var n=I("./Map/Map");q.Map=n.default;var t=I("./HashSet/HashSet");q.HashSet=t.default;var o=I("./HashMap/HashMap");q.HashMap=o.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(I,z,q){const w=I("yallist"),p=Symbol("max"),d=Symbol("length"),u=Symbol("lengthCalculator"),i=Symbol("allowStale"),e=Symbol("maxAge"),a=Symbol("dispose"),n=Symbol("noDisposeOnSet"),t=Symbol("lruList"),o=Symbol("cache"),f=Symbol("updateAgeOnGet"),l=()=>1,h=(T,S,F)=>{const W=T[o].get(S);if(W){const m=W.value;if(g(T,m)){if(v(T,W),!T[i])return}else F&&(T[f]&&(W.value.now=Date.now()),T[t].unshiftNode(W));return m.value}},g=(T,S)=>{if(!S||!S.maxAge&&!T[e])return!1;const F=Date.now()-S.now;return S.maxAge?F>S.maxAge:T[e]&&F>T[e]},c=T=>{if(T[d]>T[p])for(let S=T[t].tail;T[d]>T[p]&&S!==null;){const F=S.prev;v(T,S),S=F}},v=(T,S)=>{if(S){const F=S.value;T[a]&&T[a](F.key,F.value),T[d]-=F.length,T[o].delete(F.key),T[t].removeNode(S)}};class _{constructor(S,F,W,m,y){this.key=S,this.value=F,this.length=W,this.now=m,this.maxAge=y||0}}const E=(T,S,F,W)=>{let m=F.value;g(T,m)&&(v(T,F),T[i]||(m=void 0)),m&&S.call(W,m.value,m.key,T)};z.exports=class{constructor(T){if(typeof T=="number"&&(T={max:T}),T||(T={}),T.max&&(typeof T.max!="number"||T.max<0))throw new TypeError("max must be a non-negative number");this[p]=T.max||1/0;const S=T.length||l;if(this[u]=typeof S!="function"?l:S,this[i]=T.stale||!1,T.maxAge&&typeof T.maxAge!="number")throw new TypeError("maxAge must be a number");this[e]=T.maxAge||0,this[a]=T.dispose,this[n]=T.noDisposeOnSet||!1,this[f]=T.updateAgeOnGet||!1,this.reset()}set max(T){if(typeof T!="number"||T<0)throw new TypeError("max must be a non-negative number");this[p]=T||1/0,c(this)}get max(){return this[p]}set allowStale(T){this[i]=!!T}get allowStale(){return this[i]}set maxAge(T){if(typeof T!="number")throw new TypeError("maxAge must be a non-negative number");this[e]=T,c(this)}get maxAge(){return this[e]}set lengthCalculator(T){typeof T!="function"&&(T=l),T!==this[u]&&(this[u]=T,this[d]=0,this[t].forEach(S=>{S.length=this[u](S.value,S.key),this[d]+=S.length})),c(this)}get lengthCalculator(){return this[u]}get length(){return this[d]}get itemCount(){return this[t].length}rforEach(T,S){S=S||this;for(let F=this[t].tail;F!==null;){const W=F.prev;E(this,T,F,S),F=W}}forEach(T,S){S=S||this;for(let F=this[t].head;F!==null;){const W=F.next;E(this,T,F,S),F=W}}keys(){return this[t].toArray().map(T=>T.key)}values(){return this[t].toArray().map(T=>T.value)}reset(){this[a]&&this[t]&&this[t].length&&this[t].forEach(T=>this[a](T.key,T.value)),this[o]=new Map,this[t]=new w,this[d]=0}dump(){return this[t].map(T=>!g(this,T)&&{k:T.key,v:T.value,e:T.now+(T.maxAge||0)}).toArray().filter(T=>T)}dumpLru(){return this[t]}set(T,S,F){if((F=F||this[e])&&typeof F!="number")throw new TypeError("maxAge must be a number");const W=F?Date.now():0,m=this[u](S,T);if(this[o].has(T)){if(m>this[p])return v(this,this[o].get(T)),!1;const C=this[o].get(T).value;return this[a]&&(this[n]||this[a](T,C.value)),C.now=W,C.maxAge=F,C.value=S,this[d]+=m-C.length,C.length=m,this.get(T),c(this),!0}const y=new _(T,S,m,W,F);return y.length>this[p]?(this[a]&&this[a](T,S),!1):(this[d]+=y.length,this[t].unshift(y),this[o].set(T,this[t].head),c(this),!0)}has(T){if(!this[o].has(T))return!1;const S=this[o].get(T).value;return!g(this,S)}get(T){return h(this,T,!0)}peek(T){return h(this,T,!1)}pop(){const T=this[t].tail;return T?(v(this,T),T.value):null}del(T){v(this,this[o].get(T))}load(T){this.reset();const S=Date.now();for(let F=T.length-1;F>=0;F--){const W=T[F],m=W.e||0;if(m===0)this.set(W.k,W.v);else{const y=m-S;y>0&&this.set(W.k,W.v,y)}}}prune(){this[o].forEach((T,S)=>h(this,S,!1))}}},{yallist:83}],38:[function(I,z,q){(function(w){(function(){const p=z.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(const u in p.types){const i=p.types[u];p.codes[i]=u}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=w.from([p.SESSIONPRESENT_MASK]),p.CONNACK_HEADER=w.from([p.codes.connack<<p.CMD_SHIFT]),p.USERNAME_MASK=128,p.PASSWORD_MASK=64,p.WILL_RETAIN_MASK=32,p.WILL_QOS_MASK=24,p.WILL_QOS_SHIFT=3,p.WILL_FLAG_MASK=4,p.CLEAN_SESSION_MASK=2,p.CONNECT_HEADER=w.from([p.codes.connect<<p.CMD_SHIFT]),p.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},p.propertiesCodes={};for(const u in p.properties){const i=p.properties[u];p.propertiesCodes[i]=u}function d(u){return[0,1,2].map(i=>[0,1].map(e=>[0,1].map(a=>{const n=w.alloc(1);return n.writeUInt8(p.codes[u]<<p.CMD_SHIFT|(e?p.DUP_MASK:0)|i<<p.QOS_SHIFT|a,0,!0),n})))}p.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},p.PUBLISH_HEADER=d("publish"),p.SUBSCRIBE_HEADER=d("subscribe"),p.SUBSCRIBE_OPTIONS_QOS_MASK=3,p.SUBSCRIBE_OPTIONS_NL_MASK=1,p.SUBSCRIBE_OPTIONS_NL_SHIFT=2,p.SUBSCRIBE_OPTIONS_RAP_MASK=1,p.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,p.SUBSCRIBE_OPTIONS_RH_MASK=3,p.SUBSCRIBE_OPTIONS_RH_SHIFT=4,p.SUBSCRIBE_OPTIONS_RH=[0,16,32],p.SUBSCRIBE_OPTIONS_NL=4,p.SUBSCRIBE_OPTIONS_RAP=8,p.SUBSCRIBE_OPTIONS_QOS=[0,1,2],p.UNSUBSCRIBE_HEADER=d("unsubscribe"),p.ACKS={unsuback:d("unsuback"),puback:d("puback"),pubcomp:d("pubcomp"),pubrel:d("pubrel"),pubrec:d("pubrec")},p.SUBACK_HEADER=w.from([p.codes.suback<<p.CMD_SHIFT]),p.VERSION3=w.from([3]),p.VERSION4=w.from([4]),p.VERSION5=w.from([5]),p.VERSION131=w.from([131]),p.VERSION132=w.from([132]),p.QOS=[0,1,2].map(u=>w.from([u])),p.EMPTY={pingreq:w.from([p.codes.pingreq<<4,0]),pingresp:w.from([p.codes.pingresp<<4,0]),disconnect:w.from([p.codes.disconnect<<4,0])}}).call(this)}).call(this,I("buffer").Buffer)},{buffer:17}],39:[function(I,z,q){(function(w){(function(){const p=I("./writeToStream"),d=I("events");class u extends d{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const a=new Array(this._array.length),n=this._array;let t,o=0;for(t=0;t<n.length&&n[t]!==void 0;t++)typeof n[t]!="string"?a[t]=n[t].length:a[t]=w.byteLength(n[t]),e+=a[t];const f=w.allocUnsafe(e);for(t=0;t<n.length&&n[t]!==void 0;t++)typeof n[t]!="string"?(n[t].copy(f,o),o+=a[t]):(f.write(n[t],o),o+=a[t]);return f}}z.exports=function(i,e){const a=new u;return p(i,a,e),a.concat()}}).call(this)}).call(this,I("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(I,z,q){q.parser=I("./parser").parser,q.generate=I("./generate"),q.writeToStream=I("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(I,z,q){(function(w){(function(){const d={},u=w.isBuffer(w.from([1,2]).subarray(0,1));function i(e){const a=w.allocUnsafe(2);return a.writeUInt8(e>>8,0),a.writeUInt8(255&e,1),a}z.exports={cache:d,generateCache:function(){for(let e=0;e<65536;e++)d[e]=i(e)},generateNumber:i,genBufVariableByteInt:function(e){let a=0,n=0;const t=w.allocUnsafe(4);do a=e%128|0,(e=e/128|0)>0&&(a|=128),t.writeUInt8(a,n++);while(e>0&&n<4);return e>0&&(n=0),u?t.subarray(0,n):t.slice(0,n)},generate4ByteBuffer:function(e){const a=w.allocUnsafe(4);return a.writeUInt32BE(e,0),a}}}).call(this)}).call(this,I("buffer").Buffer)},{buffer:17}],42:[function(I,z,q){z.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},{}],43:[function(I,z,q){const w=I("bl"),p=I("events"),d=I("./packet"),u=I("./constants"),i=I("debug")("mqtt-packet:parser");class e extends p{constructor(){super(),this.parser=this.constructor.parser}static parser(n){return this instanceof e?(this.settings=n||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new e().parser(n)}_resetState(){i("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new d,this.error=null,this._list=w(),this._stateCounter=0}parse(n){for(this.error&&this._resetState(),this._list.append(n),i("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++,i("parse: state complete. _stateCounter is now: %d",this._stateCounter),i("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return i("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const n=this._list.readUInt8(0);return this.packet.cmd=u.types[n>>u.CMD_SHIFT],this.packet.retain=(n&u.RETAIN_MASK)!=0,this.packet.qos=n>>u.QOS_SHIFT&u.QOS_MASK,this.packet.dup=(n&u.DUP_MASK)!=0,i("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const n=this._parseVarByteNum(!0);return n&&(this.packet.length=n.value,this._list.consume(n.bytes)),i("_parseLength %d",n.value),!!n}_parsePayload(){i("_parsePayload: payload %O",this._list);let n=!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"))}n=!0}return i("_parsePayload complete result: %s",n),n}_parseConnect(){let n,t,o,f;i("_parseConnect");const l={},h=this.packet,g=this._parseString();if(g===null)return this._emitError(new Error("Cannot parse protocolId"));if(g!=="MQTT"&&g!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(h.protocolId=g,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(h.protocolVersion=this._list.readUInt8(this._pos),h.protocolVersion>=128&&(h.bridgeMode=!0,h.protocolVersion=h.protocolVersion-128),h.protocolVersion!==3&&h.protocolVersion!==4&&h.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(l.username=this._list.readUInt8(this._pos)&u.USERNAME_MASK,l.password=this._list.readUInt8(this._pos)&u.PASSWORD_MASK,l.will=this._list.readUInt8(this._pos)&u.WILL_FLAG_MASK,l.will&&(h.will={},h.will.retain=(this._list.readUInt8(this._pos)&u.WILL_RETAIN_MASK)!=0,h.will.qos=(this._list.readUInt8(this._pos)&u.WILL_QOS_MASK)>>u.WILL_QOS_SHIFT),h.clean=(this._list.readUInt8(this._pos)&u.CLEAN_SESSION_MASK)!=0,this._pos++,h.keepalive=this._parseNum(),h.keepalive===-1)return this._emitError(new Error("Packet too short"));if(h.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(h.properties=v)}const c=this._parseString();if(c===null)return this._emitError(new Error("Packet too short"));if(h.clientId=c,i("_parseConnect: packet.clientId: %s",h.clientId),l.will){if(h.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(h.will.properties=v)}if((n=this._parseString())===null)return this._emitError(new Error("Cannot parse will topic"));if(h.will.topic=n,i("_parseConnect: packet.will.topic: %s",h.will.topic),(t=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse will payload"));h.will.payload=t,i("_parseConnect: packet.will.paylaod: %s",h.will.payload)}if(l.username){if((f=this._parseString())===null)return this._emitError(new Error("Cannot parse username"));h.username=f,i("_parseConnect: packet.username: %s",h.username)}if(l.password){if((o=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse password"));h.password=o}return this.settings=h,i("_parseConnect: complete"),h}_parseConnack(){i("_parseConnack");const n=this.packet;if(this._list.length<1)return null;if(n.sessionPresent=!!(this._list.readUInt8(this._pos++)&u.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?n.reasonCode=this._list.readUInt8(this._pos++):n.reasonCode=0;else{if(this._list.length<2)return null;n.returnCode=this._list.readUInt8(this._pos++)}if(n.returnCode===-1||n.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(n.properties=t)}i("_parseConnack: complete")}_parsePublish(){i("_parsePublish");const n=this.packet;if(n.topic=this._parseString(),n.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(n.qos>0)||this._parseMessageId()){if(this.settings.protocolVersion===5){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(n.properties=t)}n.payload=this._list.slice(this._pos,n.length),i("_parsePublish: payload from buffer list: %o",n.payload)}}_parseSubscribe(){i("_parseSubscribe");const n=this.packet;let t,o,f,l,h,g,c;if(n.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(n.subscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(n.properties=v)}for(;this._pos<n.length;){if((t=this._parseString())===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=n.length)return this._emitError(new Error("Malformed Subscribe Payload"));f=(o=this._parseByte())&u.SUBSCRIBE_OPTIONS_QOS_MASK,g=(o>>u.SUBSCRIBE_OPTIONS_NL_SHIFT&u.SUBSCRIBE_OPTIONS_NL_MASK)!=0,h=(o>>u.SUBSCRIBE_OPTIONS_RAP_SHIFT&u.SUBSCRIBE_OPTIONS_RAP_MASK)!=0,l=o>>u.SUBSCRIBE_OPTIONS_RH_SHIFT&u.SUBSCRIBE_OPTIONS_RH_MASK,c={topic:t,qos:f},this.settings.protocolVersion===5?(c.nl=g,c.rap=h,c.rh=l):this.settings.bridgeMode&&(c.rh=0,c.rap=!0,c.nl=!0),i("_parseSubscribe: push subscription `%s` to subscription",c),n.subscriptions.push(c)}}}_parseSuback(){i("_parseSuback");const n=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(n.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){i("_parseUnsubscribe");const n=this.packet;if(n.unsubscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(n.properties=t)}for(;this._pos<n.length;){const t=this._parseString();if(t===null)return this._emitError(new Error("Cannot parse topic"));i("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),n.unsubscriptions.push(t)}}}_parseUnsuback(){i("_parseUnsuback");const n=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(n.properties=t),n.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){i("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const n=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(n.length>2?(n.reasonCode=this._parseByte(),i("_parseConfirmation: packet.reasonCode `%d`",n.reasonCode)):n.reasonCode=0,n.length>3)){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(n.properties=t)}return!0}_parseDisconnect(){const n=this.packet;if(i("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?n.reasonCode=this._parseByte():n.reasonCode=0;const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(n.properties=t)}return i("_parseDisconnect result: true"),!0}_parseAuth(){i("_parseAuth");const n=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));n.reasonCode=this._parseByte();const t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(n.properties=t),i("_parseAuth: result: true"),!0}_parseMessageId(){const n=this.packet;return n.messageId=this._parseNum(),n.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(i("_parseMessageId: packet.messageId %d",n.messageId),!0)}_parseString(n){const t=this._parseNum(),o=t+this._pos;if(t===-1||o>this._list.length||o>this.packet.length)return null;const f=this._list.toString("utf8",this._pos,o);return this._pos+=t,i("_parseString: result: %s",f),f}_parseStringPair(){return i("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const n=this._parseNum(),t=n+this._pos;if(n===-1||t>this._list.length||t>this.packet.length)return null;const o=this._list.slice(this._pos,t);return this._pos+=n,i("_parseBuffer: result: %o",o),o}_parseNum(){if(this._list.length-this._pos<2)return-1;const n=this._list.readUInt16BE(this._pos);return this._pos+=2,i("_parseNum: result: %s",n),n}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const n=this._list.readUInt32BE(this._pos);return this._pos+=4,i("_parse4ByteNum: result: %s",n),n}_parseVarByteNum(n){i("_parseVarByteNum");let t,o=0,f=1,l=0,h=!1;const g=this._pos?this._pos:0;for(;o<4&&g+o<this._list.length;){if(l+=f*((t=this._list.readUInt8(g+o++))&u.VARBYTEINT_MASK),f*=128,(t&u.VARBYTEINT_FIN_MASK)==0){h=!0;break}if(this._list.length<=o)break}return!h&&o===4&&this._list.length>=o&&this._emitError(new Error("Invalid variable byte integer")),g&&(this._pos+=o),i("_parseVarByteNum: result: %o",h=!!h&&(n?{bytes:o,value:l}:l)),h}_parseByte(){let n;return this._pos<this._list.length&&(n=this._list.readUInt8(this._pos),this._pos++),i("_parseByte: result: %o",n),n}_parseByType(n){switch(i("_parseByType: type: %s",n),n){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){i("_parseProperties");const n=this._parseVarByteNum(),t=this._pos+n,o={};for(;this._pos<t;){const f=this._parseByte();if(!f)return this._emitError(new Error("Cannot parse property code type")),!1;const l=u.propertiesCodes[f];if(!l)return this._emitError(new Error("Unknown property")),!1;if(l!=="userProperties")o[l]?Array.isArray(o[l])?o[l].push(this._parseByType(u.propertiesTypes[l])):(o[l]=[o[l]],o[l].push(this._parseByType(u.propertiesTypes[l]))):o[l]=this._parseByType(u.propertiesTypes[l]);else{o[l]||(o[l]=Object.create(null));const h=this._parseByType(u.propertiesTypes[l]);if(o[l][h.name])if(Array.isArray(o[l][h.name]))o[l][h.name].push(h.value);else{const g=o[l][h.name];o[l][h.name]=[g],o[l][h.name].push(h.value)}else o[l][h.name]=h.value}}return o}_newPacket(){return i("_newPacket"),this.packet&&(this._list.consume(this.packet.length),i("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),i("_newPacket: new packet"),this.packet=new d,this._pos=0,!0}_emitError(n){i("_emitError"),this.error=n,this.emit("error",n)}}z.exports=e},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(I,z,q){(function(w){(function(){const p=I("./constants"),d=w.allocUnsafe(0),u=w.from([0]),i=I("./numbers"),e=I("process-nextick-args").nextTick,a=I("debug")("mqtt-packet:writeToStream"),n=i.cache,t=i.generateNumber,o=i.generateCache,f=i.genBufVariableByteInt,l=i.generate4ByteBuffer;let h=F,g=!0;function c(B,P,M){switch(a("generate called"),P.cork&&(P.cork(),e(v,P)),g&&(g=!1,o()),a("generate: packet.cmd: %s",B.cmd),B.cmd){case"connect":return function(R,O,U){const H=R||{},V=H.protocolId||"MQTT";let K=H.protocolVersion||4;const $=H.will;let G=H.clean;const r=H.keepalive||0,s=H.clientId||"",b=H.username,x=H.password,j=H.properties;G===void 0&&(G=!0);let D=0;if(typeof V!="string"&&!w.isBuffer(V))return O.emit("error",new Error("Invalid protocolId")),!1;if(D+=V.length+2,K!==3&&K!==4&&K!==5)return O.emit("error",new Error("Invalid protocol version")),!1;if(D+=1,(typeof s=="string"||w.isBuffer(s))&&(s||K>=4)&&(s||G))D+=w.byteLength(s)+2;else{if(K<4)return O.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*G==0)return O.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof r!="number"||r<0||r>65535||r%1!=0)return O.emit("error",new Error("Invalid keepalive")),!1;if(D+=2,D+=1,K===5){var Q=y(O,j);if(!Q)return!1;D+=Q.length}if($){if(typeof $!="object")return O.emit("error",new Error("Invalid will")),!1;if(!$.topic||typeof $.topic!="string")return O.emit("error",new Error("Invalid will topic")),!1;if(D+=w.byteLength($.topic)+2,D+=2,$.payload){if(!($.payload.length>=0))return O.emit("error",new Error("Invalid will payload")),!1;typeof $.payload=="string"?D+=w.byteLength($.payload):D+=$.payload.length}var Z={};if(K===5){if(!(Z=y(O,$.properties)))return!1;D+=Z.length}}let Y=!1;if(b!=null){if(!L(b))return O.emit("error",new Error("Invalid username")),!1;Y=!0,D+=w.byteLength(b)+2}if(x!=null){if(!Y)return O.emit("error",new Error("Username is required to use password")),!1;if(!L(x))return O.emit("error",new Error("Invalid password")),!1;D+=N(x)+2}O.write(p.CONNECT_HEADER),E(O,D),m(O,V),H.bridgeMode&&(K+=128),O.write(K===131?p.VERSION131:K===132?p.VERSION132:K===4?p.VERSION4:K===5?p.VERSION5:p.VERSION3);let X=0;return X|=b!=null?p.USERNAME_MASK:0,X|=x!=null?p.PASSWORD_MASK:0,X|=$&&$.retain?p.WILL_RETAIN_MASK:0,X|=$&&$.qos?$.qos<<p.WILL_QOS_SHIFT:0,X|=$?p.WILL_FLAG_MASK:0,X|=G?p.CLEAN_SESSION_MASK:0,O.write(w.from([X])),h(O,r),K===5&&Q.write(),m(O,s),$&&(K===5&&Z.write(),T(O,$.topic),m(O,$.payload)),b!=null&&m(O,b),x!=null&&m(O,x),!0}(B,P);case"connack":return function(R,O,U){const H=U?U.protocolVersion:4,V=R||{},K=H===5?V.reasonCode:V.returnCode,$=V.properties;let G=2;if(typeof K!="number")return O.emit("error",new Error("Invalid return code")),!1;let r=null;if(H===5){if(!(r=y(O,$)))return!1;G+=r.length}return O.write(p.CONNACK_HEADER),E(O,G),O.write(V.sessionPresent?p.SESSIONPRESENT_HEADER:u),O.write(w.from([K])),r!=null&&r.write(),!0}(B,P,M);case"publish":return function(R,O,U){a("publish: packet: %o",R);const H=U?U.protocolVersion:4,V=R||{},K=V.qos||0,$=V.retain?p.RETAIN_MASK:0,G=V.topic,r=V.payload||d,s=V.messageId,b=V.properties;let x=0;if(typeof G=="string")x+=w.byteLength(G)+2;else{if(!w.isBuffer(G))return O.emit("error",new Error("Invalid topic")),!1;x+=G.length+2}if(w.isBuffer(r)?x+=r.length:x+=w.byteLength(r),K&&typeof s!="number")return O.emit("error",new Error("Invalid messageId")),!1;K&&(x+=2);let j=null;if(H===5){if(!(j=y(O,b)))return!1;x+=j.length}return O.write(p.PUBLISH_HEADER[K][V.dup?1:0][$?1:0]),E(O,x),h(O,N(G)),O.write(G),K>0&&h(O,s),j!=null&&j.write(),a("publish: payload: %o",r),O.write(r)}(B,P,M);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(R,O,U){const H=U?U.protocolVersion:4,V=R||{},K=V.cmd||"puback",$=V.messageId,G=V.dup&&K==="pubrel"?p.DUP_MASK:0;let r=0;const s=V.reasonCode,b=V.properties;let x=H===5?3:2;if(K==="pubrel"&&(r=1),typeof $!="number")return O.emit("error",new Error("Invalid messageId")),!1;let j=null;if(H===5&&typeof b=="object"){if(!(j=C(O,b,U,x)))return!1;x+=j.length}return O.write(p.ACKS[K][r][G][0]),E(O,x),h(O,$),H===5&&O.write(w.from([s])),j!==null&&j.write(),!0}(B,P,M);case"subscribe":return function(R,O,U){a("subscribe: packet: ");const H=U?U.protocolVersion:4,V=R||{},K=V.dup?p.DUP_MASK:0,$=V.messageId,G=V.subscriptions,r=V.properties;let s=0;if(typeof $!="number")return O.emit("error",new Error("Invalid messageId")),!1;s+=2;let b=null;if(H===5){if(!(b=y(O,r)))return!1;s+=b.length}if(typeof G!="object"||!G.length)return O.emit("error",new Error("Invalid subscriptions")),!1;for(let j=0;j<G.length;j+=1){const D=G[j].topic,Q=G[j].qos;if(typeof D!="string")return O.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof Q!="number")return O.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(H===5){if(typeof(G[j].nl||!1)!="boolean")return O.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(G[j].rap||!1)!="boolean")return O.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const X=G[j].rh||0;if(typeof X!="number"||X>2)return O.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}s+=w.byteLength(D)+2+1}a("subscribe: writing to stream: %o",p.SUBSCRIBE_HEADER),O.write(p.SUBSCRIBE_HEADER[1][K?1:0][0]),E(O,s),h(O,$),b!==null&&b.write();let x=!0;for(const j of G){const D=j.topic,Q=j.qos,Z=+j.nl,Y=+j.rap,X=j.rh;let te;T(O,D),te=p.SUBSCRIBE_OPTIONS_QOS[Q],H===5&&(te|=Z?p.SUBSCRIBE_OPTIONS_NL:0,te|=Y?p.SUBSCRIBE_OPTIONS_RAP:0,te|=X?p.SUBSCRIBE_OPTIONS_RH[X]:0),x=O.write(w.from([te]))}return x}(B,P,M);case"suback":return function(R,O,U){const H=U?U.protocolVersion:4,V=R||{},K=V.messageId,$=V.granted,G=V.properties;let r=0;if(typeof K!="number")return O.emit("error",new Error("Invalid messageId")),!1;if(r+=2,typeof $!="object"||!$.length)return O.emit("error",new Error("Invalid qos vector")),!1;for(let b=0;b<$.length;b+=1){if(typeof $[b]!="number")return O.emit("error",new Error("Invalid qos vector")),!1;r+=1}let s=null;if(H===5){if(!(s=C(O,G,U,r)))return!1;r+=s.length}return O.write(p.SUBACK_HEADER),E(O,r),h(O,K),s!==null&&s.write(),O.write(w.from($))}(B,P,M);case"unsubscribe":return function(R,O,U){const H=U?U.protocolVersion:4,V=R||{},K=V.messageId,$=V.dup?p.DUP_MASK:0,G=V.unsubscriptions,r=V.properties;let s=0;if(typeof K!="number")return O.emit("error",new Error("Invalid messageId")),!1;if(s+=2,typeof G!="object"||!G.length)return O.emit("error",new Error("Invalid unsubscriptions")),!1;for(let j=0;j<G.length;j+=1){if(typeof G[j]!="string")return O.emit("error",new Error("Invalid unsubscriptions")),!1;s+=w.byteLength(G[j])+2}let b=null;if(H===5){if(!(b=y(O,r)))return!1;s+=b.length}O.write(p.UNSUBSCRIBE_HEADER[1][$?1:0][0]),E(O,s),h(O,K),b!==null&&b.write();let x=!0;for(let j=0;j<G.length;j++)x=T(O,G[j]);return x}(B,P,M);case"unsuback":return function(R,O,U){const H=U?U.protocolVersion:4,V=R||{},K=V.messageId,$=V.dup?p.DUP_MASK:0,G=V.granted,r=V.properties,s=V.cmd;let b=2;if(typeof K!="number")return O.emit("error",new Error("Invalid messageId")),!1;if(H===5){if(typeof G!="object"||!G.length)return O.emit("error",new Error("Invalid qos vector")),!1;for(let j=0;j<G.length;j+=1){if(typeof G[j]!="number")return O.emit("error",new Error("Invalid qos vector")),!1;b+=1}}let x=null;if(H===5){if(!(x=C(O,r,U,b)))return!1;b+=x.length}return O.write(p.ACKS[s][0][$][0]),E(O,b),h(O,K),x!==null&&x.write(),H===5&&O.write(w.from(G)),!0}(B,P,M);case"pingreq":case"pingresp":return function(R,O,U){return O.write(p.EMPTY[R.cmd])}(B,P);case"disconnect":return function(R,O,U){const H=U?U.protocolVersion:4,V=R||{},K=V.reasonCode,$=V.properties;let G=H===5?1:0,r=null;if(H===5){if(!(r=C(O,$,U,G)))return!1;G+=r.length}return O.write(w.from([p.codes.disconnect<<4])),E(O,G),H===5&&O.write(w.from([K])),r!==null&&r.write(),!0}(B,P,M);case"auth":return function(R,O,U){const H=U?U.protocolVersion:4,V=R||{},K=V.reasonCode,$=V.properties;let G=H===5?1:0;H!==5&&O.emit("error",new Error("Invalid mqtt version for auth packet"));const r=C(O,$,U,G);return r?(G+=r.length,O.write(w.from([p.codes.auth<<4])),E(O,G),O.write(w.from([K])),r!==null&&r.write(),!0):!1}(B,P,M);default:return P.emit("error",new Error("Unknown command")),!1}}function v(B){B.uncork()}Object.defineProperty(c,"cacheNumbers",{get:()=>h===F,set(B){B?(n&&Object.keys(n).length!==0||(g=!0),h=F):(g=!1,h=W)}});const _={};function E(B,P){if(P>p.VARBYTEINT_MAX)return B.emit("error",new Error(`Invalid variable byte integer: ${P}`)),!1;let M=_[P];return M||(M=f(P),P<16384&&(_[P]=M)),a("writeVarByteInt: writing to stream: %o",M),B.write(M)}function T(B,P){const M=w.byteLength(P);return h(B,M),a("writeString: %s",P),B.write(P,"utf8")}function S(B,P,M){T(B,P),T(B,M)}function F(B,P){return a("writeNumberCached: number: %d",P),a("writeNumberCached: %o",n[P]),B.write(n[P])}function W(B,P){const M=t(P);return a("writeNumberGenerated: %o",M),B.write(M)}function m(B,P){typeof P=="string"?T(B,P):P?(h(B,P.length),B.write(P)):h(B,0)}function y(B,P){if(typeof P!="object"||P.length!=null)return{length:1,write(){A(B,{},0)}};let M=0;function R(O,U){let H=0;switch(p.propertiesTypes[O]){case"byte":if(typeof U!="boolean")return B.emit("error",new Error(`Invalid ${O}: ${U}`)),!1;H+=2;break;case"int8":if(typeof U!="number"||U<0||U>255)return B.emit("error",new Error(`Invalid ${O}: ${U}`)),!1;H+=2;break;case"binary":if(U&&U===null)return B.emit("error",new Error(`Invalid ${O}: ${U}`)),!1;H+=1+w.byteLength(U)+2;break;case"int16":if(typeof U!="number"||U<0||U>65535)return B.emit("error",new Error(`Invalid ${O}: ${U}`)),!1;H+=3;break;case"int32":if(typeof U!="number"||U<0||U>4294967295)return B.emit("error",new Error(`Invalid ${O}: ${U}`)),!1;H+=5;break;case"var":if(typeof U!="number"||U<0||U>268435455)return B.emit("error",new Error(`Invalid ${O}: ${U}`)),!1;H+=1+w.byteLength(f(U));break;case"string":if(typeof U!="string")return B.emit("error",new Error(`Invalid ${O}: ${U}`)),!1;H+=3+w.byteLength(U.toString());break;case"pair":if(typeof U!="object")return B.emit("error",new Error(`Invalid ${O}: ${U}`)),!1;H+=Object.getOwnPropertyNames(U).reduce((V,K)=>{const $=U[K];return Array.isArray($)?V+=$.reduce((G,r)=>G+=3+w.byteLength(K.toString())+2+w.byteLength(r.toString()),0):V+=3+w.byteLength(K.toString())+2+w.byteLength(U[K].toString()),V},0);break;default:return B.emit("error",new Error(`Invalid property ${O}: ${U}`)),!1}return H}if(P)for(const O in P){let U=0,H=0;const V=P[O];if(Array.isArray(V))for(let K=0;K<V.length;K++){if(!(H=R(O,V[K])))return!1;U+=H}else{if(!(H=R(O,V)))return!1;U=H}if(!U)return!1;M+=U}return{length:w.byteLength(f(M))+M,write(){A(B,P,M)}}}function C(B,P,M,R){const O=["reasonString","userProperties"],U=M&&M.properties&&M.properties.maximumPacketSize?M.properties.maximumPacketSize:0;let H=y(B,P);if(U)for(;R+H.length>U;){const V=O.shift();if(!V||!P[V])return!1;delete P[V],H=y(B,P)}return H}function k(B,P,M){switch(p.propertiesTypes[P]){case"byte":B.write(w.from([p.properties[P]])),B.write(w.from([+M]));break;case"int8":B.write(w.from([p.properties[P]])),B.write(w.from([M]));break;case"binary":B.write(w.from([p.properties[P]])),m(B,M);break;case"int16":B.write(w.from([p.properties[P]])),h(B,M);break;case"int32":B.write(w.from([p.properties[P]])),function(R,O){const U=l(O);a("write4ByteNumber: %o",U),R.write(U)}(B,M);break;case"var":B.write(w.from([p.properties[P]])),E(B,M);break;case"string":B.write(w.from([p.properties[P]])),T(B,M);break;case"pair":Object.getOwnPropertyNames(M).forEach(R=>{const O=M[R];Array.isArray(O)?O.forEach(U=>{B.write(w.from([p.properties[P]])),S(B,R.toString(),U.toString())}):(B.write(w.from([p.properties[P]])),S(B,R.toString(),O.toString()))});break;default:return B.emit("error",new Error(`Invalid property ${P} value: ${M}`)),!1}}function A(B,P,M){E(B,M);for(const R in P)if(Object.prototype.hasOwnProperty.call(P,R)&&P[R]!==null){const O=P[R];if(Array.isArray(O))for(let U=0;U<O.length;U++)k(B,R,O[U]);else k(B,R,O)}}function N(B){return B?B instanceof w?B.length:w.byteLength(B):0}function L(B){return typeof B=="string"||B instanceof w}z.exports=c}).call(this)}).call(this,I("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(I,z,q){var w=1e3,p=60*w,d=60*p,u=24*d,i=7*u,e=365.25*u;function a(n,t,o,f){var l=t>=1.5*o;return Math.round(n/o)+" "+f+(l?"s":"")}z.exports=function(n,t){t=t||{};var o=typeof n;if(o==="string"&&n.length>0)return function(f){if(!((f=String(f)).length>100)){var l=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(l){var h=parseFloat(l[1]);switch((l[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return h*e;case"weeks":case"week":case"w":return h*i;case"days":case"day":case"d":return h*u;case"hours":case"hour":case"hrs":case"hr":case"h":return h*d;case"minutes":case"minute":case"mins":case"min":case"m":return h*p;case"seconds":case"second":case"secs":case"sec":case"s":return h*w;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}(n);if(o==="number"&&isFinite(n))return t.long?function(f){var l=Math.abs(f);return l>=u?a(f,l,u,"day"):l>=d?a(f,l,d,"hour"):l>=p?a(f,l,p,"minute"):l>=w?a(f,l,w,"second"):f+" ms"}(n):function(f){var l=Math.abs(f);return l>=u?Math.round(f/u)+"d":l>=d?Math.round(f/d)+"h":l>=p?Math.round(f/p)+"m":l>=w?Math.round(f/w)+"s":f+"ms"}(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))}},{}],46:[function(I,z,q){const w=I("./lib/number-allocator.js");z.exports.NumberAllocator=w},{"./lib/number-allocator.js":47}],47:[function(I,z,q){const w=I("js-sdsl").Set,p=I("debug")("number-allocator:trace"),d=I("debug")("number-allocator:error");function u(e,a){this.low=e,this.high=a}function i(e,a){if(!(this instanceof i))return new i(e,a);this.min=e,this.max=a,this.ss=new w([],(n,t)=>n.compare(t)),p("Create"),this.clear()}u.prototype.equals=function(e){return this.low===e.low&&this.high===e.high},u.prototype.compare=function(e){return this.low<e.low&&this.high<e.low?-1:e.low<this.low&&e.high<this.low?1:0},i.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},i.prototype.alloc=function(){if(this.ss.size()===0)return p("alloc():empty"),null;const e=this.ss.front(),a=e.low;return a+1<=e.high?++e.low:this.ss.eraseElementByPos(0),p("alloc():"+a),a},i.prototype.use=function(e){const a=new u(e,e),n=this.ss.lowerBound(a);if(n){if(n.equals(a))return this.ss.eraseElementByValue(n),p("use():"+e),!0;if(n.low>e)return!1;if(n.low===e)return++n.low,p("use():"+e),!0;if(n.high===e)return--n.high,p("use():"+e),!0;const t=n.low;return n.low=e+1,this.ss.insert(new u(t,e-1)),p("use():"+e),!0}return p("use():failed"),!1},i.prototype.free=function(e){if(e<this.min||e>this.max)return void d("free():"+e+" is out of range");const a=new u(e,e),n=this.ss.lowerBound(a);if(n){if(n.low<=e&&e<=n.high)return void d("free():"+e+" has already been vacant");if(n===this.ss.front())e+1===n.low?--n.low:this.ss.insert(a);else{const t=this.ss.reverseLowerBound(a);t.high+1===e?e+1===n.low?(this.ss.eraseElementByValue(t),n.low=t.low):t.high=e:e+1===n.low?n.low=e:this.ss.insert(a)}}else{if(n===this.ss.front())return void this.ss.insert(a);const t=this.ss.reverseLowerBound(a);t.high+1===e?t.high=e:this.ss.insert(a)}p("free():"+e)},i.prototype.clear=function(){p("clear()"),this.ss.clear(),this.ss.insert(new u(this.min,this.max))},i.prototype.intervalCount=function(){return this.ss.size()},i.prototype.dump=function(){console.log("length:"+this.ss.size());for(const e of this.ss)console.log(e)},z.exports=i},{debug:18,"js-sdsl":36}],48:[function(I,z,q){var w=I("wrappy");function p(u){var i=function(){return i.called?i.value:(i.called=!0,i.value=u.apply(this,arguments))};return i.called=!1,i}function d(u){var i=function(){if(i.called)throw new Error(i.onceError);return i.called=!0,i.value=u.apply(this,arguments)},e=u.name||"Function wrapped with `once`";return i.onceError=e+" shouldn't be called more than once",i.called=!1,i}z.exports=w(p),z.exports.strict=w(d),p.proto=p(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return p(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return d(this)},configurable:!0})})},{wrappy:79}],49:[function(I,z,q){(function(w){(function(){w===void 0||!w.version||w.version.indexOf("v0.")===0||w.version.indexOf("v1.")===0&&w.version.indexOf("v1.8.")!==0?z.exports={nextTick:function(p,d,u,i){if(typeof p!="function")throw new TypeError('"callback" argument must be a function');var e,a,n=arguments.length;switch(n){case 0:case 1:return w.nextTick(p);case 2:return w.nextTick(function(){p.call(null,d)});case 3:return w.nextTick(function(){p.call(null,d,u)});case 4:return w.nextTick(function(){p.call(null,d,u,i)});default:for(e=new Array(n-1),a=0;a<e.length;)e[a++]=arguments[a];return w.nextTick(function(){p.apply(null,e)})}}}:z.exports=w}).call(this)}).call(this,I("_process"))},{_process:50}],50:[function(I,z,q){var w,p,d=z.exports={};function u(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function e(c){if(w===setTimeout)return setTimeout(c,0);if((w===u||!w)&&setTimeout)return w=setTimeout,setTimeout(c,0);try{return w(c,0)}catch(v){try{return w.call(null,c,0)}catch(_){return w.call(this,c,0)}}}(function(){try{w=typeof setTimeout=="function"?setTimeout:u}catch(c){w=u}try{p=typeof clearTimeout=="function"?clearTimeout:i}catch(c){p=i}})();var a,n=[],t=!1,o=-1;function f(){t&&a&&(t=!1,a.length?n=a.concat(n):o=-1,n.length&&l())}function l(){if(!t){var c=e(f);t=!0;for(var v=n.length;v;){for(a=n,n=[];++o<v;)a&&a[o].run();o=-1,v=n.length}a=null,t=!1,function(_){if(p===clearTimeout)return clearTimeout(_);if((p===i||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(_);try{p(_)}catch(E){try{return p.call(null,_)}catch(T){return p.call(this,_)}}}(c)}}function h(c,v){this.fun=c,this.array=v}function g(){}d.nextTick=function(c){var v=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)v[_-1]=arguments[_];n.push(new h(c,v)),n.length!==1||t||e(l)},h.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=g,d.addListener=g,d.once=g,d.off=g,d.removeListener=g,d.removeAllListeners=g,d.emit=g,d.prependListener=g,d.prependOnceListener=g,d.listeners=function(c){return[]},d.binding=function(c){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(c){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],51:[function(I,z,q){(function(w){(function(){(function(p){var d=typeof q=="object"&&q&&!q.nodeType&&q,u=typeof z=="object"&&z&&!z.nodeType&&z,i=typeof w=="object"&&w;i.global!==i&&i.window!==i&&i.self!==i||(p=i);var e,a,n=2147483647,t=36,o=1,f=26,l=38,h=700,g=72,c=128,v="-",_=/^xn--/,E=/[^\x20-\x7E]/,T=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},F=t-o,W=Math.floor,m=String.fromCharCode;function y(R){throw new RangeError(S[R])}function C(R,O){for(var U=R.length,H=[];U--;)H[U]=O(R[U]);return H}function k(R,O){var U=R.split("@"),H="";return U.length>1&&(H=U[0]+"@",R=U[1]),H+C((R=R.replace(T,".")).split("."),O).join(".")}function A(R){for(var O,U,H=[],V=0,K=R.length;V<K;)(O=R.charCodeAt(V++))>=55296&&O<=56319&&V<K?(64512&(U=R.charCodeAt(V++)))==56320?H.push(((1023&O)<<10)+(1023&U)+65536):(H.push(O),V--):H.push(O);return H}function N(R){return C(R,function(O){var U="";return O>65535&&(U+=m((O-=65536)>>>10&1023|55296),O=56320|1023&O),U+=m(O)}).join("")}function L(R,O){return R+22+75*(R<26)-((O!=0)<<5)}function B(R,O,U){var H=0;for(R=U?W(R/h):R>>1,R+=W(R/O);R>F*f>>1;H+=t)R=W(R/F);return W(H+(F+1)*R/(R+l))}function P(R){var O,U,H,V,K,$,G,r,s,b,x,j=[],D=R.length,Q=0,Z=c,Y=g;for((U=R.lastIndexOf(v))<0&&(U=0),H=0;H<U;++H)R.charCodeAt(H)>=128&&y("not-basic"),j.push(R.charCodeAt(H));for(V=U>0?U+1:0;V<D;){for(K=Q,$=1,G=t;V>=D&&y("invalid-input"),((r=(x=R.charCodeAt(V++))-48<10?x-22:x-65<26?x-65:x-97<26?x-97:t)>=t||r>W((n-Q)/$))&&y("overflow"),Q+=r*$,!(r<(s=G<=Y?o:G>=Y+f?f:G-Y));G+=t)$>W(n/(b=t-s))&&y("overflow"),$*=b;Y=B(Q-K,O=j.length+1,K==0),W(Q/O)>n-Z&&y("overflow"),Z+=W(Q/O),Q%=O,j.splice(Q++,0,Z)}return N(j)}function M(R){var O,U,H,V,K,$,G,r,s,b,x,j,D,Q,Z,Y=[];for(j=(R=A(R)).length,O=c,U=0,K=g,$=0;$<j;++$)(x=R[$])<128&&Y.push(m(x));for(H=V=Y.length,V&&Y.push(v);H<j;){for(G=n,$=0;$<j;++$)(x=R[$])>=O&&x<G&&(G=x);for(G-O>W((n-U)/(D=H+1))&&y("overflow"),U+=(G-O)*D,O=G,$=0;$<j;++$)if((x=R[$])<O&&++U>n&&y("overflow"),x==O){for(r=U,s=t;!(r<(b=s<=K?o:s>=K+f?f:s-K));s+=t)Z=r-b,Q=t-b,Y.push(m(L(b+Z%Q,0))),r=W(Z/Q);Y.push(m(L(r,0))),K=B(U,D,H==V),U=0,++H}++U,++O}return Y.join("")}if(e={version:"1.4.1",ucs2:{decode:A,encode:N},decode:P,encode:M,toASCII:function(R){return k(R,function(O){return E.test(O)?"xn--"+M(O):O})},toUnicode:function(R){return k(R,function(O){return _.test(O)?P(O.slice(4).toLowerCase()):O})}},d&&u)if(z.exports==d)u.exports=e;else for(a in e)e.hasOwnProperty(a)&&(d[a]=e[a]);else p.punycode=e})(this)}).call(this)}).call(this,typeof fe!="undefined"?fe:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],52:[function(I,z,q){function w(d,u){return Object.prototype.hasOwnProperty.call(d,u)}z.exports=function(d,u,i,e){u=u||"&",i=i||"=";var a={};if(typeof d!="string"||d.length===0)return a;var n=/\+/g;d=d.split(u);var t=1e3;e&&typeof e.maxKeys=="number"&&(t=e.maxKeys);var o=d.length;t>0&&o>t&&(o=t);for(var f=0;f<o;++f){var l,h,g,c,v=d[f].replace(n,"%20"),_=v.indexOf(i);_>=0?(l=v.substr(0,_),h=v.substr(_+1)):(l=v,h=""),g=decodeURIComponent(l),c=decodeURIComponent(h),w(a,g)?p(a[g])?a[g].push(c):a[g]=[a[g],c]:a[g]=c}return a};var p=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}},{}],53:[function(I,z,q){var w=function(i){switch(typeof i){case"string":return i;case"boolean":return i?"true":"false";case"number":return isFinite(i)?i:"";default:return""}};z.exports=function(i,e,a,n){return e=e||"&",a=a||"=",i===null&&(i=void 0),typeof i=="object"?d(u(i),function(t){var o=encodeURIComponent(w(t))+a;return p(i[t])?d(i[t],function(f){return o+encodeURIComponent(w(f))}).join(e):o+encodeURIComponent(w(i[t]))}).join(e):n?encodeURIComponent(w(n))+a+encodeURIComponent(w(i)):""};var p=Array.isArray||function(i){return Object.prototype.toString.call(i)==="[object Array]"};function d(i,e){if(i.map)return i.map(e);for(var a=[],n=0;n<i.length;n++)a.push(e(i[n],n));return a}var u=Object.keys||function(i){var e=[];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&e.push(a);return e}},{}],54:[function(I,z,q){q.decode=q.parse=I("./decode"),q.encode=q.stringify=I("./encode")},{"./decode":52,"./encode":53}],55:[function(I,z,q){var w={};function p(u,i,e){e||(e=Error);var a=function(n){var t,o;function f(l,h,g){return n.call(this,function(c,v,_){return typeof i=="string"?i:i(c,v,_)}(l,h,g))||this}return o=n,(t=f).prototype=Object.create(o.prototype),t.prototype.constructor=t,t.__proto__=o,f}(e);a.prototype.name=e.name,a.prototype.code=u,w[u]=a}function d(u,i){if(Array.isArray(u)){var e=u.length;return u=u.map(function(a){return String(a)}),e>2?"one of ".concat(i," ").concat(u.slice(0,e-1).join(", "),", or ")+u[e-1]:e===2?"one of ".concat(i," ").concat(u[0]," or ").concat(u[1]):"of ".concat(i," ").concat(u[0])}return"of ".concat(i," ").concat(String(u))}p("ERR_INVALID_OPT_VALUE",function(u,i){return'The value "'+i+'" is invalid for option "'+u+'"'},TypeError),p("ERR_INVALID_ARG_TYPE",function(u,i,e){var a,n,t;if(typeof i=="string"&&(n="not ",i.substr(0,n.length)===n)?(a="must not be",i=i.replace(/^not /,"")):a="must be",function(f,l,h){return(h===void 0||h>f.length)&&(h=f.length),f.substring(h-l.length,h)===l}(u," argument"))t="The ".concat(u," ").concat(a," ").concat(d(i,"type"));else{var o=function(f,l,h){return typeof h!="number"&&(h=0),!(h+l.length>f.length)&&f.indexOf(l,h)!==-1}(u,".")?"property":"argument";t='The "'.concat(u,'" ').concat(o," ").concat(a," ").concat(d(i,"type"))}return t+=". Received type ".concat(typeof e)},TypeError),p("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),p("ERR_METHOD_NOT_IMPLEMENTED",function(u){return"The "+u+" method is not implemented"}),p("ERR_STREAM_PREMATURE_CLOSE","Premature close"),p("ERR_STREAM_DESTROYED",function(u){return"Cannot call "+u+" after a stream was destroyed"}),p("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),p("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),p("ERR_STREAM_WRITE_AFTER_END","write after end"),p("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),p("ERR_UNKNOWN_ENCODING",function(u){return"Unknown encoding: "+u},TypeError),p("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),z.exports.codes=w},{}],56:[function(I,z,q){(function(w){(function(){var p=Object.keys||function(f){var l=[];for(var h in f)l.push(h);return l};z.exports=n;var d=I("./_stream_readable"),u=I("./_stream_writable");I("inherits")(n,d);for(var i=p(u.prototype),e=0;e<i.length;e++){var a=i[e];n.prototype[a]||(n.prototype[a]=u.prototype[a])}function n(f){if(!(this instanceof n))return new n(f);d.call(this,f),u.call(this,f),this.allowHalfOpen=!0,f&&(f.readable===!1&&(this.readable=!1),f.writable===!1&&(this.writable=!1),f.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",t)))}function t(){this._writableState.ended||w.nextTick(o,this)}function o(f){f.end()}Object.defineProperty(n.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(n.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(n.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(n.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(f){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=f,this._writableState.destroyed=f)}})}).call(this)}).call(this,I("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(I,z,q){z.exports=p;var w=I("./_stream_transform");function p(d){if(!(this instanceof p))return new p(d);w.call(this,d)}I("inherits")(p,w),p.prototype._transform=function(d,u,i){i(null,d)}},{"./_stream_transform":59,inherits:24}],58:[function(I,z,q){(function(w,p){(function(){var d;z.exports=y,y.ReadableState=m,I("events").EventEmitter;var u=function(r,s){return r.listeners(s).length},i=I("./internal/streams/stream"),e=I("buffer").Buffer,a=p.Uint8Array||function(){},n,t=I("util");n=t&&t.debuglog?t.debuglog("stream"):function(){};var o,f,l,h=I("./internal/streams/buffer_list"),g=I("./internal/streams/destroy"),c=I("./internal/streams/state").getHighWaterMark,v=I("../errors").codes,_=v.ERR_INVALID_ARG_TYPE,E=v.ERR_STREAM_PUSH_AFTER_EOF,T=v.ERR_METHOD_NOT_IMPLEMENTED,S=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;I("inherits")(y,i);var F=g.errorOrDestroy,W=["error","close","destroy","pause","resume"];function m(r,s,b){d=d||I("./_stream_duplex"),r=r||{},typeof b!="boolean"&&(b=s instanceof d),this.objectMode=!!r.objectMode,b&&(this.objectMode=this.objectMode||!!r.readableObjectMode),this.highWaterMark=c(this,r,"readableHighWaterMark",b),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=r.emitClose!==!1,this.autoDestroy=!!r.autoDestroy,this.destroyed=!1,this.defaultEncoding=r.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,r.encoding&&(o||(o=I("string_decoder/").StringDecoder),this.decoder=new o(r.encoding),this.encoding=r.encoding)}function y(r){if(d=d||I("./_stream_duplex"),!(this instanceof y))return new y(r);var s=this instanceof d;this._readableState=new m(r,this,s),this.readable=!0,r&&(typeof r.read=="function"&&(this._read=r.read),typeof r.destroy=="function"&&(this._destroy=r.destroy)),i.call(this)}function C(r,s,b,x,j){n("readableAddChunk",s);var D,Q=r._readableState;if(s===null)Q.reading=!1,function(Z,Y){if(n("onEofChunk"),!Y.ended){if(Y.decoder){var X=Y.decoder.end();X&&X.length&&(Y.buffer.push(X),Y.length+=Y.objectMode?1:X.length)}Y.ended=!0,Y.sync?L(Z):(Y.needReadable=!1,Y.emittedReadable||(Y.emittedReadable=!0,B(Z)))}}(r,Q);else if(j||(D=function(Z,Y){var X;te=Y,e.isBuffer(te)||te instanceof a||typeof Y=="string"||Y===void 0||Z.objectMode||(X=new _("chunk",["string","Buffer","Uint8Array"],Y));var te;return X}(Q,s)),D)F(r,D);else if(Q.objectMode||s&&s.length>0)if(typeof s=="string"||Q.objectMode||Object.getPrototypeOf(s)===e.prototype||(s=function(Z){return e.from(Z)}(s)),x)Q.endEmitted?F(r,new S):k(r,Q,s,!0);else if(Q.ended)F(r,new E);else{if(Q.destroyed)return!1;Q.reading=!1,Q.decoder&&!b?(s=Q.decoder.write(s),Q.objectMode||s.length!==0?k(r,Q,s,!1):P(r,Q)):k(r,Q,s,!1)}else x||(Q.reading=!1,P(r,Q));return!Q.ended&&(Q.length<Q.highWaterMark||Q.length===0)}function k(r,s,b,x){s.flowing&&s.length===0&&!s.sync?(s.awaitDrain=0,r.emit("data",b)):(s.length+=s.objectMode?1:b.length,x?s.buffer.unshift(b):s.buffer.push(b),s.needReadable&&L(r)),P(r,s)}Object.defineProperty(y.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(r){this._readableState&&(this._readableState.destroyed=r)}}),y.prototype.destroy=g.destroy,y.prototype._undestroy=g.undestroy,y.prototype._destroy=function(r,s){s(r)},y.prototype.push=function(r,s){var b,x=this._readableState;return x.objectMode?b=!0:typeof r=="string"&&((s=s||x.defaultEncoding)!==x.encoding&&(r=e.from(r,s),s=""),b=!0),C(this,r,s,!1,b)},y.prototype.unshift=function(r){return C(this,r,null,!0,!1)},y.prototype.isPaused=function(){return this._readableState.flowing===!1},y.prototype.setEncoding=function(r){o||(o=I("string_decoder/").StringDecoder);var s=new o(r);this._readableState.decoder=s,this._readableState.encoding=this._readableState.decoder.encoding;for(var b=this._readableState.buffer.head,x="";b!==null;)x+=s.write(b.data),b=b.next;return this._readableState.buffer.clear(),x!==""&&this._readableState.buffer.push(x),this._readableState.length=x.length,this};var A=1073741824;function N(r,s){return r<=0||s.length===0&&s.ended?0:s.objectMode?1:r!=r?s.flowing&&s.length?s.buffer.head.data.length:s.length:(r>s.highWaterMark&&(s.highWaterMark=function(b){return b>=A?b=A:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}(r)),r<=s.length?r:s.ended?s.length:(s.needReadable=!0,0))}function L(r){var s=r._readableState;n("emitReadable",s.needReadable,s.emittedReadable),s.needReadable=!1,s.emittedReadable||(n("emitReadable",s.flowing),s.emittedReadable=!0,w.nextTick(B,r))}function B(r){var s=r._readableState;n("emitReadable_",s.destroyed,s.length,s.ended),s.destroyed||!s.length&&!s.ended||(r.emit("readable"),s.emittedReadable=!1),s.needReadable=!s.flowing&&!s.ended&&s.length<=s.highWaterMark,H(r)}function P(r,s){s.readingMore||(s.readingMore=!0,w.nextTick(M,r,s))}function M(r,s){for(;!s.reading&&!s.ended&&(s.length<s.highWaterMark||s.flowing&&s.length===0);){var b=s.length;if(n("maybeReadMore read 0"),r.read(0),b===s.length)break}s.readingMore=!1}function R(r){var s=r._readableState;s.readableListening=r.listenerCount("readable")>0,s.resumeScheduled&&!s.paused?s.flowing=!0:r.listenerCount("data")>0&&r.resume()}function O(r){n("readable nexttick read 0"),r.read(0)}function U(r,s){n("resume",s.reading),s.reading||r.read(0),s.resumeScheduled=!1,r.emit("resume"),H(r),s.flowing&&!s.reading&&r.read(0)}function H(r){var s=r._readableState;for(n("flow",s.flowing);s.flowing&&r.read()!==null;);}function V(r,s){return s.length===0?null:(s.objectMode?b=s.buffer.shift():!r||r>=s.length?(b=s.decoder?s.buffer.join(""):s.buffer.length===1?s.buffer.first():s.buffer.concat(s.length),s.buffer.clear()):b=s.buffer.consume(r,s.decoder),b);var b}function K(r){var s=r._readableState;n("endReadable",s.endEmitted),s.endEmitted||(s.ended=!0,w.nextTick($,s,r))}function $(r,s){if(n("endReadableNT",r.endEmitted,r.length),!r.endEmitted&&r.length===0&&(r.endEmitted=!0,s.readable=!1,s.emit("end"),r.autoDestroy)){var b=s._writableState;(!b||b.autoDestroy&&b.finished)&&s.destroy()}}function G(r,s){for(var b=0,x=r.length;b<x;b++)if(r[b]===s)return b;return-1}y.prototype.read=function(r){n("read",r),r=parseInt(r,10);var s=this._readableState,b=r;if(r!==0&&(s.emittedReadable=!1),r===0&&s.needReadable&&((s.highWaterMark!==0?s.length>=s.highWaterMark:s.length>0)||s.ended))return n("read: emitReadable",s.length,s.ended),s.length===0&&s.ended?K(this):L(this),null;if((r=N(r,s))===0&&s.ended)return s.length===0&&K(this),null;var x,j=s.needReadable;return n("need readable",j),(s.length===0||s.length-r<s.highWaterMark)&&n("length less than watermark",j=!0),s.ended||s.reading?n("reading or ended",j=!1):j&&(n("do read"),s.reading=!0,s.sync=!0,s.length===0&&(s.needReadable=!0),this._read(s.highWaterMark),s.sync=!1,s.reading||(r=N(b,s))),(x=r>0?V(r,s):null)===null?(s.needReadable=s.length<=s.highWaterMark,r=0):(s.length-=r,s.awaitDrain=0),s.length===0&&(s.ended||(s.needReadable=!0),b!==r&&s.ended&&K(this)),x!==null&&this.emit("data",x),x},y.prototype._read=function(r){F(this,new T("_read()"))},y.prototype.pipe=function(r,s){var b=this,x=this._readableState;switch(x.pipesCount){case 0:x.pipes=r;break;case 1:x.pipes=[x.pipes,r];break;default:x.pipes.push(r)}x.pipesCount+=1,n("pipe count=%d opts=%j",x.pipesCount,s);var j=(!s||s.end!==!1)&&r!==w.stdout&&r!==w.stderr?Q:ue;function D(re,ne){n("onunpipe"),re===b&&ne&&ne.hasUnpiped===!1&&(ne.hasUnpiped=!0,n("cleanup"),r.removeListener("close",le),r.removeListener("finish",se),r.removeListener("drain",Z),r.removeListener("error",te),r.removeListener("unpipe",D),b.removeListener("end",Q),b.removeListener("end",ue),b.removeListener("data",X),Y=!0,!x.awaitDrain||r._writableState&&!r._writableState.needDrain||Z())}function Q(){n("onend"),r.end()}x.endEmitted?w.nextTick(j):b.once("end",j),r.on("unpipe",D);var Z=function(re){return function(){var ne=re._readableState;n("pipeOnDrain",ne.awaitDrain),ne.awaitDrain&&ne.awaitDrain--,ne.awaitDrain===0&&u(re,"data")&&(ne.flowing=!0,H(re))}}(b);r.on("drain",Z);var Y=!1;function X(re){n("ondata");var ne=r.write(re);n("dest.write",ne),ne===!1&&((x.pipesCount===1&&x.pipes===r||x.pipesCount>1&&G(x.pipes,r)!==-1)&&!Y&&(n("false write response, pause",x.awaitDrain),x.awaitDrain++),b.pause())}function te(re){n("onerror",re),ue(),r.removeListener("error",te),u(r,"error")===0&&F(r,re)}function le(){r.removeListener("finish",se),ue()}function se(){n("onfinish"),r.removeListener("close",le),ue()}function ue(){n("unpipe"),b.unpipe(r)}return b.on("data",X),function(re,ne,ye){if(typeof re.prependListener=="function")return re.prependListener(ne,ye);re._events&&re._events[ne]?Array.isArray(re._events[ne])?re._events[ne].unshift(ye):re._events[ne]=[ye,re._events[ne]]:re.on(ne,ye)}(r,"error",te),r.once("close",le),r.once("finish",se),r.emit("pipe",b),x.flowing||(n("pipe resume"),b.resume()),r},y.prototype.unpipe=function(r){var s=this._readableState,b={hasUnpiped:!1};if(s.pipesCount===0)return this;if(s.pipesCount===1)return r&&r!==s.pipes?this:(r||(r=s.pipes),s.pipes=null,s.pipesCount=0,s.flowing=!1,r&&r.emit("unpipe",this,b),this);if(!r){var x=s.pipes,j=s.pipesCount;s.pipes=null,s.pipesCount=0,s.flowing=!1;for(var D=0;D<j;D++)x[D].emit("unpipe",this,{hasUnpiped:!1});return this}var Q=G(s.pipes,r);return Q===-1?this:(s.pipes.splice(Q,1),s.pipesCount-=1,s.pipesCount===1&&(s.pipes=s.pipes[0]),r.emit("unpipe",this,b),this)},y.prototype.on=function(r,s){var b=i.prototype.on.call(this,r,s),x=this._readableState;return r==="data"?(x.readableListening=this.listenerCount("readable")>0,x.flowing!==!1&&this.resume()):r==="readable"&&(x.endEmitted||x.readableListening||(x.readableListening=x.needReadable=!0,x.flowing=!1,x.emittedReadable=!1,n("on readable",x.length,x.reading),x.length?L(this):x.reading||w.nextTick(O,this))),b},y.prototype.addListener=y.prototype.on,y.prototype.removeListener=function(r,s){var b=i.prototype.removeListener.call(this,r,s);return r==="readable"&&w.nextTick(R,this),b},y.prototype.removeAllListeners=function(r){var s=i.prototype.removeAllListeners.apply(this,arguments);return r!=="readable"&&r!==void 0||w.nextTick(R,this),s},y.prototype.resume=function(){var r=this._readableState;return r.flowing||(n("resume"),r.flowing=!r.readableListening,function(s,b){b.resumeScheduled||(b.resumeScheduled=!0,w.nextTick(U,s,b))}(this,r)),r.paused=!1,this},y.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},y.prototype.wrap=function(r){var s=this,b=this._readableState,x=!1;for(var j in r.on("end",function(){if(n("wrapped end"),b.decoder&&!b.ended){var Q=b.decoder.end();Q&&Q.length&&s.push(Q)}s.push(null)}),r.on("data",function(Q){n("wrapped data"),b.decoder&&(Q=b.decoder.write(Q)),(!b.objectMode||Q!=null)&&(b.objectMode||Q&&Q.length)&&(s.push(Q)||(x=!0,r.pause()))}),r)this[j]===void 0&&typeof r[j]=="function"&&(this[j]=function(Q){return function(){return r[Q].apply(r,arguments)}}(j));for(var D=0;D<W.length;D++)r.on(W[D],this.emit.bind(this,W[D]));return this._read=function(Q){n("wrapped _read",Q),x&&(x=!1,r.resume())},this},typeof Symbol=="function"&&(y.prototype[Symbol.asyncIterator]=function(){return f===void 0&&(f=I("./internal/streams/async_iterator")),f(this)}),Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(y.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(y.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(r){this._readableState&&(this._readableState.flowing=r)}}),y._fromList=V,Object.defineProperty(y.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(y.from=function(r,s){return l===void 0&&(l=I("./internal/streams/from")),l(y,r,s)})}).call(this)}).call(this,I("_process"),typeof fe!="undefined"?fe:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(I,z,q){z.exports=a;var w=I("../errors").codes,p=w.ERR_METHOD_NOT_IMPLEMENTED,d=w.ERR_MULTIPLE_CALLBACK,u=w.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=w.ERR_TRANSFORM_WITH_LENGTH_0,e=I("./_stream_duplex");function a(o){if(!(this instanceof a))return new a(o);e.call(this,o),this._transformState={afterTransform:function(f,l){var h=this._transformState;h.transforming=!1;var g=h.writecb;if(g===null)return this.emit("error",new d);h.writechunk=null,h.writecb=null,l!=null&&this.push(l),g(f);var c=this._readableState;c.reading=!1,(c.needReadable||c.length<c.highWaterMark)&&this._read(c.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,o&&(typeof o.transform=="function"&&(this._transform=o.transform),typeof o.flush=="function"&&(this._flush=o.flush)),this.on("prefinish",n)}function n(){var o=this;typeof this._flush!="function"||this._readableState.destroyed?t(this,null,null):this._flush(function(f,l){t(o,f,l)})}function t(o,f,l){if(f)return o.emit("error",f);if(l!=null&&o.push(l),o._writableState.length)throw new i;if(o._transformState.transforming)throw new u;return o.push(null)}I("inherits")(a,e),a.prototype.push=function(o,f){return this._transformState.needTransform=!1,e.prototype.push.call(this,o,f)},a.prototype._transform=function(o,f,l){l(new p("_transform()"))},a.prototype._write=function(o,f,l){var h=this._transformState;if(h.writecb=l,h.writechunk=o,h.writeencoding=f,!h.transforming){var g=this._readableState;(h.needTransform||g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}},a.prototype._read=function(o){var f=this._transformState;f.writechunk===null||f.transforming?f.needTransform=!0:(f.transforming=!0,this._transform(f.writechunk,f.writeencoding,f.afterTransform))},a.prototype._destroy=function(o,f){e.prototype._destroy.call(this,o,function(l){f(l)})}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(I,z,q){(function(w,p){(function(){function d(P){var M=this;this.next=null,this.entry=null,this.finish=function(){(function(R,O,U){var H=R.entry;for(R.entry=null;H;){var V=H.callback;O.pendingcb--,V(U),H=H.next}O.corkedRequestsFree.next=R})(M,P)}}var u;z.exports=y,y.WritableState=m;var i={deprecate:I("util-deprecate")},e=I("./internal/streams/stream"),a=I("buffer").Buffer,n=p.Uint8Array||function(){},t,o=I("./internal/streams/destroy"),f=I("./internal/streams/state").getHighWaterMark,l=I("../errors").codes,h=l.ERR_INVALID_ARG_TYPE,g=l.ERR_METHOD_NOT_IMPLEMENTED,c=l.ERR_MULTIPLE_CALLBACK,v=l.ERR_STREAM_CANNOT_PIPE,_=l.ERR_STREAM_DESTROYED,E=l.ERR_STREAM_NULL_VALUES,T=l.ERR_STREAM_WRITE_AFTER_END,S=l.ERR_UNKNOWN_ENCODING,F=o.errorOrDestroy;function W(){}function m(P,M,R){u=u||I("./_stream_duplex"),P=P||{},typeof R!="boolean"&&(R=M instanceof u),this.objectMode=!!P.objectMode,R&&(this.objectMode=this.objectMode||!!P.writableObjectMode),this.highWaterMark=f(this,P,"writableHighWaterMark",R),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var O=P.decodeStrings===!1;this.decodeStrings=!O,this.defaultEncoding=P.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(U){(function(H,V){var K=H._writableState,$=K.sync,G=K.writecb;if(typeof G!="function")throw new c;if(function(s){s.writing=!1,s.writecb=null,s.length-=s.writelen,s.writelen=0}(K),V)(function(s,b,x,j,D){--b.pendingcb,x?(w.nextTick(D,j),w.nextTick(B,s,b),s._writableState.errorEmitted=!0,F(s,j)):(D(j),s._writableState.errorEmitted=!0,F(s,j),B(s,b))})(H,K,$,V,G);else{var r=N(K)||H.destroyed;r||K.corked||K.bufferProcessing||!K.bufferedRequest||A(H,K),$?w.nextTick(k,H,K,r,G):k(H,K,r,G)}})(M,U)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=P.emitClose!==!1,this.autoDestroy=!!P.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new d(this)}function y(P){var M=this instanceof(u=u||I("./_stream_duplex"));if(!M&&!t.call(y,this))return new y(P);this._writableState=new m(P,this,M),this.writable=!0,P&&(typeof P.write=="function"&&(this._write=P.write),typeof P.writev=="function"&&(this._writev=P.writev),typeof P.destroy=="function"&&(this._destroy=P.destroy),typeof P.final=="function"&&(this._final=P.final)),e.call(this)}function C(P,M,R,O,U,H,V){M.writelen=O,M.writecb=V,M.writing=!0,M.sync=!0,M.destroyed?M.onwrite(new _("write")):R?P._writev(U,M.onwrite):P._write(U,H,M.onwrite),M.sync=!1}function k(P,M,R,O){R||function(U,H){H.length===0&&H.needDrain&&(H.needDrain=!1,U.emit("drain"))}(P,M),M.pendingcb--,O(),B(P,M)}function A(P,M){M.bufferProcessing=!0;var R=M.bufferedRequest;if(P._writev&&R&&R.next){var O=M.bufferedRequestCount,U=new Array(O),H=M.corkedRequestsFree;H.entry=R;for(var V=0,K=!0;R;)U[V]=R,R.isBuf||(K=!1),R=R.next,V+=1;U.allBuffers=K,C(P,M,!0,M.length,U,"",H.finish),M.pendingcb++,M.lastBufferedRequest=null,H.next?(M.corkedRequestsFree=H.next,H.next=null):M.corkedRequestsFree=new d(M),M.bufferedRequestCount=0}else{for(;R;){var $=R.chunk,G=R.encoding,r=R.callback;if(C(P,M,!1,M.objectMode?1:$.length,$,G,r),R=R.next,M.bufferedRequestCount--,M.writing)break}R===null&&(M.lastBufferedRequest=null)}M.bufferedRequest=R,M.bufferProcessing=!1}function N(P){return P.ending&&P.length===0&&P.bufferedRequest===null&&!P.finished&&!P.writing}function L(P,M){P._final(function(R){M.pendingcb--,R&&F(P,R),M.prefinished=!0,P.emit("prefinish"),B(P,M)})}function B(P,M){var R=N(M);if(R&&(function(U,H){H.prefinished||H.finalCalled||(typeof U._final!="function"||H.destroyed?(H.prefinished=!0,U.emit("prefinish")):(H.pendingcb++,H.finalCalled=!0,w.nextTick(L,U,H)))}(P,M),M.pendingcb===0&&(M.finished=!0,P.emit("finish"),M.autoDestroy))){var O=P._readableState;(!O||O.autoDestroy&&O.endEmitted)&&P.destroy()}return R}I("inherits")(y,e),m.prototype.getBuffer=function(){for(var P=this.bufferedRequest,M=[];P;)M.push(P),P=P.next;return M},function(){try{Object.defineProperty(m.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(P){}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(t=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(P){return!!t.call(this,P)||this===y&&P&&P._writableState instanceof m}})):t=function(P){return P instanceof this},y.prototype.pipe=function(){F(this,new v)},y.prototype.write=function(P,M,R){var O,U=this._writableState,H=!1,V=!U.objectMode&&(O=P,a.isBuffer(O)||O instanceof n);return V&&!a.isBuffer(P)&&(P=function(K){return a.from(K)}(P)),typeof M=="function"&&(R=M,M=null),V?M="buffer":M||(M=U.defaultEncoding),typeof R!="function"&&(R=W),U.ending?function(K,$){var G=new T;F(K,G),w.nextTick($,G)}(this,R):(V||function(K,$,G,r){var s;return G===null?s=new E:typeof G=="string"||$.objectMode||(s=new h("chunk",["string","Buffer"],G)),!s||(F(K,s),w.nextTick(r,s),!1)}(this,U,P,R))&&(U.pendingcb++,H=function(K,$,G,r,s,b){if(!G){var x=function(Z,Y,X){return Z.objectMode||Z.decodeStrings===!1||typeof Y!="string"||(Y=a.from(Y,X)),Y}($,r,s);r!==x&&(G=!0,s="buffer",r=x)}var j=$.objectMode?1:r.length;$.length+=j;var D=$.length<$.highWaterMark;if(D||($.needDrain=!0),$.writing||$.corked){var Q=$.lastBufferedRequest;$.lastBufferedRequest={chunk:r,encoding:s,isBuf:G,callback:b,next:null},Q?Q.next=$.lastBufferedRequest:$.bufferedRequest=$.lastBufferedRequest,$.bufferedRequestCount+=1}else C(K,$,!1,j,r,s,b);return D}(this,U,V,P,M,R)),H},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var P=this._writableState;P.corked&&(P.corked--,P.writing||P.corked||P.bufferProcessing||!P.bufferedRequest||A(this,P))},y.prototype.setDefaultEncoding=function(P){if(typeof P=="string"&&(P=P.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((P+"").toLowerCase())>-1))throw new S(P);return this._writableState.defaultEncoding=P,this},Object.defineProperty(y.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(P,M,R){R(new g("_write()"))},y.prototype._writev=null,y.prototype.end=function(P,M,R){var O=this._writableState;return typeof P=="function"?(R=P,P=null,M=null):typeof M=="function"&&(R=M,M=null),P!=null&&this.write(P,M),O.corked&&(O.corked=1,this.uncork()),O.ending||function(U,H,V){H.ending=!0,B(U,H),V&&(H.finished?w.nextTick(V):U.once("finish",V)),H.ended=!0,U.writable=!1}(this,O,R),this},Object.defineProperty(y.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(y.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(P){this._writableState&&(this._writableState.destroyed=P)}}),y.prototype.destroy=o.destroy,y.prototype._undestroy=o.undestroy,y.prototype._destroy=function(P,M){M(P)}}).call(this)}).call(this,I("_process"),typeof fe!="undefined"?fe:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(I,z,q){(function(w){(function(){var p;function d(v,_,E){return _ in v?Object.defineProperty(v,_,{value:E,enumerable:!0,configurable:!0,writable:!0}):v[_]=E,v}var u=I("./end-of-stream"),i=Symbol("lastResolve"),e=Symbol("lastReject"),a=Symbol("error"),n=Symbol("ended"),t=Symbol("lastPromise"),o=Symbol("handlePromise"),f=Symbol("stream");function l(v,_){return{value:v,done:_}}function h(v){var _=v[i];if(_!==null){var E=v[f].read();E!==null&&(v[t]=null,v[i]=null,v[e]=null,_(l(E,!1)))}}var g=Object.getPrototypeOf(function(){}),c=Object.setPrototypeOf((d(p={get stream(){return this[f]},next:function(){var v=this,_=this[a];if(_!==null)return Promise.reject(_);if(this[n])return Promise.resolve(l(void 0,!0));if(this[f].destroyed)return new Promise(function(F,W){w.nextTick(function(){v[a]?W(v[a]):F(l(void 0,!0))})});var E,T=this[t];if(T)E=new Promise(function(F,W){return function(m,y){F.then(function(){W[n]?m(l(void 0,!0)):W[o](m,y)},y)}}(T,this));else{var S=this[f].read();if(S!==null)return Promise.resolve(l(S,!1));E=new Promise(this[o])}return this[t]=E,E}},Symbol.asyncIterator,function(){return this}),d(p,"return",function(){var v=this;return new Promise(function(_,E){v[f].destroy(null,function(T){T?E(T):_(l(void 0,!0))})})}),p),g);z.exports=function(v){var _,E=Object.create(c,(d(_={},f,{value:v,writable:!0}),d(_,i,{value:null,writable:!0}),d(_,e,{value:null,writable:!0}),d(_,a,{value:null,writable:!0}),d(_,n,{value:v._readableState.endEmitted,writable:!0}),d(_,o,{value:function(T,S){var F=E[f].read();F?(E[t]=null,E[i]=null,E[e]=null,T(l(F,!1))):(E[i]=T,E[e]=S)},writable:!0}),_));return E[t]=null,u(v,function(T){if(T&&T.code!=="ERR_STREAM_PREMATURE_CLOSE"){var S=E[e];return S!==null&&(E[t]=null,E[i]=null,E[e]=null,S(T)),void(E[a]=T)}var F=E[i];F!==null&&(E[t]=null,E[i]=null,E[e]=null,F(l(void 0,!0))),E[n]=!0}),v.on("readable",function(T){w.nextTick(h,T)}.bind(null,E)),E}}).call(this)}).call(this,I("_process"))},{"./end-of-stream":64,_process:50}],62:[function(I,z,q){function w(a,n){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(a);n&&(o=o.filter(function(f){return Object.getOwnPropertyDescriptor(a,f).enumerable})),t.push.apply(t,o)}return t}function p(a,n,t){return n in a?Object.defineProperty(a,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[n]=t,a}function d(a,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(a,o.key,o)}}var u=I("buffer").Buffer,i=I("util").inspect,e=i&&i.custom||"inspect";z.exports=function(){function a(){(function(o,f){if(!(o instanceof f))throw new TypeError("Cannot call a class as a function")})(this,a),this.head=null,this.tail=null,this.length=0}var n,t;return n=a,(t=[{key:"push",value:function(o){var f={data:o,next:null};this.length>0?this.tail.next=f:this.head=f,this.tail=f,++this.length}},{key:"unshift",value:function(o){var f={data:o,next:this.head};this.length===0&&(this.tail=f),this.head=f,++this.length}},{key:"shift",value:function(){if(this.length!==0){var o=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,o}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(o){if(this.length===0)return"";for(var f=this.head,l=""+f.data;f=f.next;)l+=o+f.data;return l}},{key:"concat",value:function(o){if(this.length===0)return u.alloc(0);for(var f,l,h,g=u.allocUnsafe(o>>>0),c=this.head,v=0;c;)f=c.data,l=g,h=v,u.prototype.copy.call(f,l,h),v+=c.data.length,c=c.next;return g}},{key:"consume",value:function(o,f){var l;return o<this.head.data.length?(l=this.head.data.slice(0,o),this.head.data=this.head.data.slice(o)):l=o===this.head.data.length?this.shift():f?this._getString(o):this._getBuffer(o),l}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(o){var f=this.head,l=1,h=f.data;for(o-=h.length;f=f.next;){var g=f.data,c=o>g.length?g.length:o;if(c===g.length?h+=g:h+=g.slice(0,o),(o-=c)===0){c===g.length?(++l,f.next?this.head=f.next:this.head=this.tail=null):(this.head=f,f.data=g.slice(c));break}++l}return this.length-=l,h}},{key:"_getBuffer",value:function(o){var f=u.allocUnsafe(o),l=this.head,h=1;for(l.data.copy(f),o-=l.data.length;l=l.next;){var g=l.data,c=o>g.length?g.length:o;if(g.copy(f,f.length-o,0,c),(o-=c)===0){c===g.length?(++h,l.next?this.head=l.next:this.head=this.tail=null):(this.head=l,l.data=g.slice(c));break}++h}return this.length-=h,f}},{key:e,value:function(o,f){return i(this,function(l){for(var h=1;h<arguments.length;h++){var g=arguments[h]!=null?arguments[h]:{};h%2?w(Object(g),!0).forEach(function(c){p(l,c,g[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):w(Object(g)).forEach(function(c){Object.defineProperty(l,c,Object.getOwnPropertyDescriptor(g,c))})}return l}({},f,{depth:0,customInspect:!1}))}}])&&d(n.prototype,t),a}()},{buffer:17,util:16}],63:[function(I,z,q){(function(w){(function(){function p(i,e){u(i,e),d(i)}function d(i){i._writableState&&!i._writableState.emitClose||i._readableState&&!i._readableState.emitClose||i.emit("close")}function u(i,e){i.emit("error",e)}z.exports={destroy:function(i,e){var a=this,n=this._readableState&&this._readableState.destroyed,t=this._writableState&&this._writableState.destroyed;return n||t?(e?e(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,w.nextTick(u,this,i)):w.nextTick(u,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,function(o){!e&&o?a._writableState?a._writableState.errorEmitted?w.nextTick(d,a):(a._writableState.errorEmitted=!0,w.nextTick(p,a,o)):w.nextTick(p,a,o):e?(w.nextTick(d,a),e(o)):w.nextTick(d,a)}),this)},undestroy:function(){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)},errorOrDestroy:function(i,e){var a=i._readableState,n=i._writableState;a&&a.autoDestroy||n&&n.autoDestroy?i.destroy(e):i.emit("error",e)}}}).call(this)}).call(this,I("_process"))},{_process:50}],64:[function(I,z,q){var w=I("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function p(){}z.exports=function d(u,i,e){if(typeof i=="function")return d(u,null,i);i||(i={}),e=function(_){var E=!1;return function(){if(!E){E=!0;for(var T=arguments.length,S=new Array(T),F=0;F<T;F++)S[F]=arguments[F];_.apply(this,S)}}}(e||p);var a=i.readable||i.readable!==!1&&u.readable,n=i.writable||i.writable!==!1&&u.writable,t=function(){u.writable||f()},o=u._writableState&&u._writableState.finished,f=function(){n=!1,o=!0,a||e.call(u)},l=u._readableState&&u._readableState.endEmitted,h=function(){a=!1,l=!0,n||e.call(u)},g=function(_){e.call(u,_)},c=function(){var _;return a&&!l?(u._readableState&&u._readableState.ended||(_=new w),e.call(u,_)):n&&!o?(u._writableState&&u._writableState.ended||(_=new w),e.call(u,_)):void 0},v=function(){u.req.on("finish",f)};return function(_){return _.setHeader&&typeof _.abort=="function"}(u)?(u.on("complete",f),u.on("abort",c),u.req?v():u.on("request",v)):n&&!u._writableState&&(u.on("end",t),u.on("close",t)),u.on("end",h),u.on("finish",f),i.error!==!1&&u.on("error",g),u.on("close",c),function(){u.removeListener("complete",f),u.removeListener("abort",c),u.removeListener("request",v),u.req&&u.req.removeListener("finish",f),u.removeListener("end",t),u.removeListener("close",t),u.removeListener("finish",f),u.removeListener("end",h),u.removeListener("error",g),u.removeListener("close",c)}}},{"../../../errors":55}],65:[function(I,z,q){z.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(I,z,q){var w,p=I("../../../errors").codes,d=p.ERR_MISSING_ARGS,u=p.ERR_STREAM_DESTROYED;function i(n){if(n)throw n}function e(n){n()}function a(n,t){return n.pipe(t)}z.exports=function(){for(var n=arguments.length,t=new Array(n),o=0;o<n;o++)t[o]=arguments[o];var f,l=function(g){return g.length?typeof g[g.length-1]!="function"?i:g.pop():i}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new d("streams");var h=t.map(function(g,c){var v=c<t.length-1;return function(_,E,T,S){S=function(m){var y=!1;return function(){y||(y=!0,m.apply(void 0,arguments))}}(S);var F=!1;_.on("close",function(){F=!0}),w===void 0&&(w=I("./end-of-stream")),w(_,{readable:E,writable:T},function(m){if(m)return S(m);F=!0,S()});var W=!1;return function(m){if(!F&&!W)return W=!0,function(y){return y.setHeader&&typeof y.abort=="function"}(_)?_.abort():typeof _.destroy=="function"?_.destroy():void S(m||new u("pipe"))}}(g,v,c>0,function(_){f||(f=_),_&&h.forEach(e),v||(h.forEach(e),l(f))})});return t.reduce(a)}},{"../../../errors":55,"./end-of-stream":64}],67:[function(I,z,q){var w=I("../../../errors").codes.ERR_INVALID_OPT_VALUE;z.exports={getHighWaterMark:function(p,d,u,i){var e=function(a,n,t){return a.highWaterMark!=null?a.highWaterMark:n?a[t]:null}(d,i,u);if(e!=null){if(!isFinite(e)||Math.floor(e)!==e||e<0)throw new w(i?u:"highWaterMark",e);return Math.floor(e)}return p.objectMode?16:16384}}},{"../../../errors":55}],68:[function(I,z,q){z.exports=I("events").EventEmitter},{events:22}],69:[function(I,z,q){(q=z.exports=I("./lib/_stream_readable.js")).Stream=q,q.Readable=q,q.Writable=I("./lib/_stream_writable.js"),q.Duplex=I("./lib/_stream_duplex.js"),q.Transform=I("./lib/_stream_transform.js"),q.PassThrough=I("./lib/_stream_passthrough.js"),q.finished=I("./lib/internal/streams/end-of-stream.js"),q.pipeline=I("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(I,z,q){z.exports=function(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var w;if(arguments.length>0){w=new Array(arguments.length-2);for(var p=0;p<w.length;p++)w[p]=arguments[p+2]}return new function(d,u,i){var e=this;this._callback=d,this._args=i,this._interval=setInterval(d,u,this._args),this.reschedule=function(a){a||(a=e._interval),e._interval&&clearInterval(e._interval),e._interval=setInterval(e._callback,a,e._args)},this.clear=function(){e._interval&&(clearInterval(e._interval),e._interval=void 0)},this.destroy=function(){e._interval&&clearInterval(e._interval),e._callback=void 0,e._interval=void 0,e._args=void 0}}(arguments[0],arguments[1],w)}},{}],71:[function(I,z,q){z.exports=I("./index.js")()},{"./index.js":72}],72:[function(I,z,q){(function(w){(function(){function p(d){return d instanceof w?w.from(d):new d.constructor(d.buffer.slice(),d.byteOffset,d.length)}z.exports=function(d){return(d=d||{}).circles?function(i){var e=[],a=[];return i.proto?function t(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,t);if(o instanceof Map)return new Map(n(Array.from(o),t));if(o instanceof Set)return new Set(n(Array.from(o),t));var f={};for(var l in e.push(o),a.push(f),o){var h=o[l];if(typeof h!="object"||h===null)f[l]=h;else if(h instanceof Date)f[l]=new Date(h);else if(h instanceof Map)f[l]=new Map(n(Array.from(h),t));else if(h instanceof Set)f[l]=new Set(n(Array.from(h),t));else if(ArrayBuffer.isView(h))f[l]=p(h);else{var g=e.indexOf(h);f[l]=g!==-1?a[g]:t(h)}}return e.pop(),a.pop(),f}:function t(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,t);if(o instanceof Map)return new Map(n(Array.from(o),t));if(o instanceof Set)return new Set(n(Array.from(o),t));var f={};for(var l in e.push(o),a.push(f),o)if(Object.hasOwnProperty.call(o,l)!==!1){var h=o[l];if(typeof h!="object"||h===null)f[l]=h;else if(h instanceof Date)f[l]=new Date(h);else if(h instanceof Map)f[l]=new Map(n(Array.from(h),t));else if(h instanceof Set)f[l]=new Set(n(Array.from(h),t));else if(ArrayBuffer.isView(h))f[l]=p(h);else{var g=e.indexOf(h);f[l]=g!==-1?a[g]:t(h)}}return e.pop(),a.pop(),f};function n(t,o){for(var f=Object.keys(t),l=new Array(f.length),h=0;h<f.length;h++){var g=f[h],c=t[g];if(typeof c!="object"||c===null)l[g]=c;else if(c instanceof Date)l[g]=new Date(c);else if(ArrayBuffer.isView(c))l[g]=p(c);else{var v=e.indexOf(c);l[g]=v!==-1?a[v]:o(c)}}return l}}(d):d.proto?function i(e){if(typeof e!="object"||e===null)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return u(e,i);if(e instanceof Map)return new Map(u(Array.from(e),i));if(e instanceof Set)return new Set(u(Array.from(e),i));var a={};for(var n in e){var t=e[n];typeof t!="object"||t===null?a[n]=t:t instanceof Date?a[n]=new Date(t):t instanceof Map?a[n]=new Map(u(Array.from(t),i)):t instanceof Set?a[n]=new Set(u(Array.from(t),i)):ArrayBuffer.isView(t)?a[n]=p(t):a[n]=i(t)}return a}:function i(e){if(typeof e!="object"||e===null)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return u(e,i);if(e instanceof Map)return new Map(u(Array.from(e),i));if(e instanceof Set)return new Set(u(Array.from(e),i));var a={};for(var n in e)if(Object.hasOwnProperty.call(e,n)!==!1){var t=e[n];typeof t!="object"||t===null?a[n]=t:t instanceof Date?a[n]=new Date(t):t instanceof Map?a[n]=new Map(u(Array.from(t),i)):t instanceof Set?a[n]=new Set(u(Array.from(t),i)):ArrayBuffer.isView(t)?a[n]=p(t):a[n]=i(t)}return a};function u(i,e){for(var a=Object.keys(i),n=new Array(a.length),t=0;t<a.length;t++){var o=a[t],f=i[o];typeof f!="object"||f===null?n[o]=f:f instanceof Date?n[o]=new Date(f):ArrayBuffer.isView(f)?n[o]=p(f):n[o]=e(f)}return n}}}).call(this)}).call(this,I("buffer").Buffer)},{buffer:17}],73:[function(I,z,q){var w=I("buffer"),p=w.Buffer;function d(i,e){for(var a in i)e[a]=i[a]}function u(i,e,a){return p(i,e,a)}p.from&&p.alloc&&p.allocUnsafe&&p.allocUnsafeSlow?z.exports=w:(d(w,q),q.Buffer=u),u.prototype=Object.create(p.prototype),d(p,u),u.from=function(i,e,a){if(typeof i=="number")throw new TypeError("Argument must not be a number");return p(i,e,a)},u.alloc=function(i,e,a){if(typeof i!="number")throw new TypeError("Argument must be a number");var n=p(i);return e!==void 0?typeof a=="string"?n.fill(e,a):n.fill(e):n.fill(0),n},u.allocUnsafe=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return p(i)},u.allocUnsafeSlow=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return w.SlowBuffer(i)}},{buffer:17}],74:[function(I,z,q){z.exports=function(w){var p=w._readableState;return p?p.objectMode||typeof w._duplexState=="number"?w.read():w.read((d=p,d.buffer.length?d.buffer.head?d.buffer.head.data.length:d.buffer[0].length:d.length)):null;var d}},{}],75:[function(I,z,q){var w=I("safe-buffer").Buffer,p=w.isEncoding||function(l){switch((l=""+l)&&l.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function d(l){var h;switch(this.encoding=function(g){var c=function(v){if(!v)return"utf8";for(var _;;)switch(v){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return v;default:if(_)return;v=(""+v).toLowerCase(),_=!0}}(g);if(typeof c!="string"&&(w.isEncoding===p||!p(g)))throw new Error("Unknown encoding: "+g);return c||g}(l),this.encoding){case"utf16le":this.text=e,this.end=a,h=4;break;case"utf8":this.fillLast=i,h=4;break;case"base64":this.text=n,this.end=t,h=3;break;default:return this.write=o,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=w.allocUnsafe(h)}function u(l){return l<=127?0:l>>5==6?2:l>>4==14?3:l>>3==30?4:l>>6==2?-1:-2}function i(l){var h=this.lastTotal-this.lastNeed,g=function(c,v,_){if((192&v[0])!=128)return c.lastNeed=0,"<22>";if(c.lastNeed>1&&v.length>1){if((192&v[1])!=128)return c.lastNeed=1,"<22>";if(c.lastNeed>2&&v.length>2&&(192&v[2])!=128)return c.lastNeed=2,"<22>"}}(this,l);return g!==void 0?g:this.lastNeed<=l.length?(l.copy(this.lastChar,h,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(l.copy(this.lastChar,h,0,l.length),void(this.lastNeed-=l.length))}function e(l,h){if((l.length-h)%2==0){var g=l.toString("utf16le",h);if(g){var c=g.charCodeAt(g.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=l[l.length-2],this.lastChar[1]=l[l.length-1],g.slice(0,-1)}return g}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=l[l.length-1],l.toString("utf16le",h,l.length-1)}function a(l){var h=l&&l.length?this.write(l):"";if(this.lastNeed){var g=this.lastTotal-this.lastNeed;return h+this.lastChar.toString("utf16le",0,g)}return h}function n(l,h){var g=(l.length-h)%3;return g===0?l.toString("base64",h):(this.lastNeed=3-g,this.lastTotal=3,g===1?this.lastChar[0]=l[l.length-1]:(this.lastChar[0]=l[l.length-2],this.lastChar[1]=l[l.length-1]),l.toString("base64",h,l.length-g))}function t(l){var h=l&&l.length?this.write(l):"";return this.lastNeed?h+this.lastChar.toString("base64",0,3-this.lastNeed):h}function o(l){return l.toString(this.encoding)}function f(l){return l&&l.length?this.write(l):""}q.StringDecoder=d,d.prototype.write=function(l){if(l.length===0)return"";var h,g;if(this.lastNeed){if((h=this.fillLast(l))===void 0)return"";g=this.lastNeed,this.lastNeed=0}else g=0;return g<l.length?h?h+this.text(l,g):this.text(l,g):h||""},d.prototype.end=function(l){var h=l&&l.length?this.write(l):"";return this.lastNeed?h+"<22>":h},d.prototype.text=function(l,h){var g=function(v,_,E){var T=_.length-1;if(T<E)return 0;var S=u(_[T]);return S>=0?(S>0&&(v.lastNeed=S-1),S):--T<E||S===-2?0:(S=u(_[T]))>=0?(S>0&&(v.lastNeed=S-2),S):--T<E||S===-2?0:(S=u(_[T]))>=0?(S>0&&(S===2?S=0:v.lastNeed=S-3),S):0}(this,l,h);if(!this.lastNeed)return l.toString("utf8",h);this.lastTotal=g;var c=l.length-(g-this.lastNeed);return l.copy(this.lastChar,0,c),l.toString("utf8",h,c)},d.prototype.fillLast=function(l){if(this.lastNeed<=l.length)return l.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);l.copy(this.lastChar,this.lastTotal-this.lastNeed,0,l.length),this.lastNeed-=l.length}},{"safe-buffer":73}],76:[function(I,z,q){var w=I("punycode"),p=I("./util");function d(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}q.parse=_,q.resolve=function(E,T){return _(E,!1,!0).resolve(T)},q.resolveObject=function(E,T){return E?_(E,!1,!0).resolveObject(T):T},q.format=function(E){return p.isString(E)&&(E=_(E)),E instanceof d?E.format():d.prototype.format.call(E)},q.Url=d;var u=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,e=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,a=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
`," "]),n=["'"].concat(a),t=["%","/","?",";","#"].concat(n),o=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,l=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,h={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},c={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=I("querystring");function _(E,T,S){if(E&&p.isObject(E)&&E instanceof d)return E;var F=new d;return F.parse(E,T,S),F}d.prototype.parse=function(E,T,S){if(!p.isString(E))throw new TypeError("Parameter 'url' must be a string, not "+typeof E);var F=E.indexOf("?"),W=F!==-1&&F<E.indexOf("#")?"?":"#",m=E.split(W);m[0]=m[0].replace(/\\/g,"/");var y=E=m.join(W);if(y=y.trim(),!S&&E.split("#").length===1){var C=e.exec(y);if(C)return this.path=y,this.href=y,this.pathname=C[1],C[2]?(this.search=C[2],this.query=T?v.parse(this.search.substr(1)):this.search.substr(1)):T&&(this.search="",this.query={}),this}var k=u.exec(y);if(k){var A=(k=k[0]).toLowerCase();this.protocol=A,y=y.substr(k.length)}if(S||k||y.match(/^\/\/[^@\/]+@[^@\/]+/)){var N=y.substr(0,2)==="//";!N||k&&g[k]||(y=y.substr(2),this.slashes=!0)}if(!g[k]&&(N||k&&!c[k])){for(var L,B,P=-1,M=0;M<o.length;M++)(R=y.indexOf(o[M]))!==-1&&(P===-1||R<P)&&(P=R);for((B=P===-1?y.lastIndexOf("@"):y.lastIndexOf("@",P))!==-1&&(L=y.slice(0,B),y=y.slice(B+1),this.auth=decodeURIComponent(L)),P=-1,M=0;M<t.length;M++){var R;(R=y.indexOf(t[M]))!==-1&&(P===-1||R<P)&&(P=R)}P===-1&&(P=y.length),this.host=y.slice(0,P),y=y.slice(P),this.parseHost(),this.hostname=this.hostname||"";var O=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!O)for(var U=this.hostname.split(/\./),H=(M=0,U.length);M<H;M++){var V=U[M];if(V&&!V.match(f)){for(var K="",$=0,G=V.length;$<G;$++)V.charCodeAt($)>127?K+="x":K+=V[$];if(!K.match(f)){var r=U.slice(0,M),s=U.slice(M+1),b=V.match(l);b&&(r.push(b[1]),s.unshift(b[2])),s.length&&(y="/"+s.join(".")+y),this.hostname=r.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=w.toASCII(this.hostname));var x=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+x,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),y[0]!=="/"&&(y="/"+y))}if(!h[A])for(M=0,H=n.length;M<H;M++){var D=n[M];if(y.indexOf(D)!==-1){var Q=encodeURIComponent(D);Q===D&&(Q=escape(D)),y=y.split(D).join(Q)}}var Z=y.indexOf("#");Z!==-1&&(this.hash=y.substr(Z),y=y.slice(0,Z));var Y=y.indexOf("?");if(Y!==-1?(this.search=y.substr(Y),this.query=y.substr(Y+1),T&&(this.query=v.parse(this.query)),y=y.slice(0,Y)):T&&(this.search="",this.query={}),y&&(this.pathname=y),c[A]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){x=this.pathname||"";var X=this.search||"";this.path=x+X}return this.href=this.format(),this},d.prototype.format=function(){var E=this.auth||"";E&&(E=(E=encodeURIComponent(E)).replace(/%3A/i,":"),E+="@");var T=this.protocol||"",S=this.pathname||"",F=this.hash||"",W=!1,m="";this.host?W=E+this.host:this.hostname&&(W=E+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(W+=":"+this.port)),this.query&&p.isObject(this.query)&&Object.keys(this.query).length&&(m=v.stringify(this.query));var y=this.search||m&&"?"+m||"";return T&&T.substr(-1)!==":"&&(T+=":"),this.slashes||(!T||c[T])&&W!==!1?(W="//"+(W||""),S&&S.charAt(0)!=="/"&&(S="/"+S)):W||(W=""),F&&F.charAt(0)!=="#"&&(F="#"+F),y&&y.charAt(0)!=="?"&&(y="?"+y),T+W+(S=S.replace(/[?#]/g,function(C){return encodeURIComponent(C)}))+(y=y.replace("#","%23"))+F},d.prototype.resolve=function(E){return this.resolveObject(_(E,!1,!0)).format()},d.prototype.resolveObject=function(E){if(p.isString(E)){var T=new d;T.parse(E,!1,!0),E=T}for(var S=new d,F=Object.keys(this),W=0;W<F.length;W++){var m=F[W];S[m]=this[m]}if(S.hash=E.hash,E.href==="")return S.href=S.format(),S;if(E.slashes&&!E.protocol){for(var y=Object.keys(E),C=0;C<y.length;C++){var k=y[C];k!=="protocol"&&(S[k]=E[k])}return c[S.protocol]&&S.hostname&&!S.pathname&&(S.path=S.pathname="/"),S.href=S.format(),S}if(E.protocol&&E.protocol!==S.protocol){if(!c[E.protocol]){for(var A=Object.keys(E),N=0;N<A.length;N++){var L=A[N];S[L]=E[L]}return S.href=S.format(),S}if(S.protocol=E.protocol,E.host||g[E.protocol])S.pathname=E.pathname;else{for(var B=(E.pathname||"").split("/");B.length&&!(E.host=B.shift()););E.host||(E.host=""),E.hostname||(E.hostname=""),B[0]!==""&&B.unshift(""),B.length<2&&B.unshift(""),S.pathname=B.join("/")}if(S.search=E.search,S.query=E.query,S.host=E.host||"",S.auth=E.auth,S.hostname=E.hostname||E.host,S.port=E.port,S.pathname||S.search){var P=S.pathname||"",M=S.search||"";S.path=P+M}return S.slashes=S.slashes||E.slashes,S.href=S.format(),S}var R=S.pathname&&S.pathname.charAt(0)==="/",O=E.host||E.pathname&&E.pathname.charAt(0)==="/",U=O||R||S.host&&E.pathname,H=U,V=S.pathname&&S.pathname.split("/")||[],K=(B=E.pathname&&E.pathname.split("/")||[],S.protocol&&!c[S.protocol]);if(K&&(S.hostname="",S.port=null,S.host&&(V[0]===""?V[0]=S.host:V.unshift(S.host)),S.host="",E.protocol&&(E.hostname=null,E.port=null,E.host&&(B[0]===""?B[0]=E.host:B.unshift(E.host)),E.host=null),U=U&&(B[0]===""||V[0]==="")),O)S.host=E.host||E.host===""?E.host:S.host,S.hostname=E.hostname||E.hostname===""?E.hostname:S.hostname,S.search=E.search,S.query=E.query,V=B;else if(B.length)V||(V=[]),V.pop(),V=V.concat(B),S.search=E.search,S.query=E.query;else if(!p.isNullOrUndefined(E.search))return K&&(S.hostname=S.host=V.shift(),(b=!!(S.host&&S.host.indexOf("@")>0)&&S.host.split("@"))&&(S.auth=b.shift(),S.host=S.hostname=b.shift())),S.search=E.search,S.query=E.query,p.isNull(S.pathname)&&p.isNull(S.search)||(S.path=(S.pathname?S.pathname:"")+(S.search?S.search:"")),S.href=S.format(),S;if(!V.length)return S.pathname=null,S.search?S.path="/"+S.search:S.path=null,S.href=S.format(),S;for(var $=V.slice(-1)[0],G=(S.host||E.host||V.length>1)&&($==="."||$==="..")||$==="",r=0,s=V.length;s>=0;s--)($=V[s])==="."?V.splice(s,1):$===".."?(V.splice(s,1),r++):r&&(V.splice(s,1),r--);if(!U&&!H)for(;r--;r)V.unshift("..");!U||V[0]===""||V[0]&&V[0].charAt(0)==="/"||V.unshift(""),G&&V.join("/").substr(-1)!=="/"&&V.push("");var b,x=V[0]===""||V[0]&&V[0].charAt(0)==="/";return K&&(S.hostname=S.host=x?"":V.length?V.shift():"",(b=!!(S.host&&S.host.indexOf("@")>0)&&S.host.split("@"))&&(S.auth=b.shift(),S.host=S.hostname=b.shift())),(U=U||S.host&&V.length)&&!x&&V.unshift(""),V.length?S.pathname=V.join("/"):(S.pathname=null,S.path=null),p.isNull(S.pathname)&&p.isNull(S.search)||(S.path=(S.pathname?S.pathname:"")+(S.search?S.search:"")),S.auth=E.auth||S.auth,S.slashes=S.slashes||E.slashes,S.href=S.format(),S},d.prototype.parseHost=function(){var E=this.host,T=i.exec(E);T&&((T=T[0])!==":"&&(this.port=T.substr(1)),E=E.substr(0,E.length-T.length)),E&&(this.hostname=E)}},{"./util":77,punycode:51,querystring:54}],77:[function(I,z,q){z.exports={isString:function(w){return typeof w=="string"},isObject:function(w){return typeof w=="object"&&w!==null},isNull:function(w){return w===null},isNullOrUndefined:function(w){return w==null}}},{}],78:[function(I,z,q){(function(w){(function(){function p(d){try{if(!w.localStorage)return!1}catch(i){return!1}var u=w.localStorage[d];return u!=null&&String(u).toLowerCase()==="true"}z.exports=function(d,u){if(p("noDeprecation"))return d;var i=!1;return function(){if(!i){if(p("throwDeprecation"))throw new Error(u);p("traceDeprecation")?console.trace(u):console.warn(u),i=!0}return d.apply(this,arguments)}}}).call(this)}).call(this,typeof fe!="undefined"?fe:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],79:[function(I,z,q){z.exports=function w(p,d){if(p&&d)return w(p)(d);if(typeof p!="function")throw new TypeError("need wrapper function");return Object.keys(p).forEach(function(i){u[i]=p[i]}),u;function u(){for(var i=new Array(arguments.length),e=0;e<i.length;e++)i[e]=arguments[e];var a=p.apply(this,i),n=i[i.length-1];return typeof a=="function"&&a!==n&&Object.keys(n).forEach(function(t){a[t]=n[t]}),a}}},{}],80:[function(I,z,q){z.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(I,z,q){z.exports=function(){for(var p={},d=0;d<arguments.length;d++){var u=arguments[d];for(var i in u)w.call(u,i)&&(p[i]=u[i])}return p};var w=Object.prototype.hasOwnProperty},{}],82:[function(I,z,q){z.exports=function(w){w.prototype[Symbol.iterator]=function*(){for(let p=this.head;p;p=p.next)yield p.value}}},{}],83:[function(I,z,q){function w(e){var a=this;if(a instanceof w||(a=new w),a.tail=null,a.head=null,a.length=0,e&&typeof e.forEach=="function")e.forEach(function(o){a.push(o)});else if(arguments.length>0)for(var n=0,t=arguments.length;n<t;n++)a.push(arguments[n]);return a}function p(e,a,n){var t=a===e.head?new i(n,null,a,e):new i(n,a,a.next,e);return t.next===null&&(e.tail=t),t.prev===null&&(e.head=t),e.length++,t}function d(e,a){e.tail=new i(a,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function u(e,a){e.head=new i(a,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function i(e,a,n,t){if(!(this instanceof i))return new i(e,a,n,t);this.list=t,this.value=e,a?(a.next=this,this.prev=a):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}z.exports=w,w.Node=i,w.create=w,w.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var a=e.next,n=e.prev;return a&&(a.prev=n),n&&(n.next=a),e===this.head&&(this.head=a),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,a},w.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var a=this.head;e.list=this,e.next=a,a&&(a.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},w.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var a=this.tail;e.list=this,e.prev=a,a&&(a.next=e),this.tail=e,this.head||(this.head=e),this.length++}},w.prototype.push=function(){for(var e=0,a=arguments.length;e<a;e++)d(this,arguments[e]);return this.length},w.prototype.unshift=function(){for(var e=0,a=arguments.length;e<a;e++)u(this,arguments[e]);return this.length},w.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},w.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},w.prototype.forEach=function(e,a){a=a||this;for(var n=this.head,t=0;n!==null;t++)e.call(a,n.value,t,this),n=n.next},w.prototype.forEachReverse=function(e,a){a=a||this;for(var n=this.tail,t=this.length-1;n!==null;t--)e.call(a,n.value,t,this),n=n.prev},w.prototype.get=function(e){for(var a=0,n=this.head;n!==null&&a<e;a++)n=n.next;if(a===e&&n!==null)return n.value},w.prototype.getReverse=function(e){for(var a=0,n=this.tail;n!==null&&a<e;a++)n=n.prev;if(a===e&&n!==null)return n.value},w.prototype.map=function(e,a){a=a||this;for(var n=new w,t=this.head;t!==null;)n.push(e.call(a,t.value,this)),t=t.next;return n},w.prototype.mapReverse=function(e,a){a=a||this;for(var n=new w,t=this.tail;t!==null;)n.push(e.call(a,t.value,this)),t=t.prev;return n},w.prototype.reduce=function(e,a){var n,t=this.head;if(arguments.length>1)n=a;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");t=this.head.next,n=this.head.value}for(var o=0;t!==null;o++)n=e(n,t.value,o),t=t.next;return n},w.prototype.reduceReverse=function(e,a){var n,t=this.tail;if(arguments.length>1)n=a;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");t=this.tail.prev,n=this.tail.value}for(var o=this.length-1;t!==null;o--)n=e(n,t.value,o),t=t.prev;return n},w.prototype.toArray=function(){for(var e=new Array(this.length),a=0,n=this.head;n!==null;a++)e[a]=n.value,n=n.next;return e},w.prototype.toArrayReverse=function(){for(var e=new Array(this.length),a=0,n=this.tail;n!==null;a++)e[a]=n.value,n=n.prev;return e},w.prototype.slice=function(e,a){(a=a||this.length)<0&&(a+=this.length),(e=e||0)<0&&(e+=this.length);var n=new w;if(a<e||a<0)return n;e<0&&(e=0),a>this.length&&(a=this.length);for(var t=0,o=this.head;o!==null&&t<e;t++)o=o.next;for(;o!==null&&t<a;t++,o=o.next)n.push(o.value);return n},w.prototype.sliceReverse=function(e,a){(a=a||this.length)<0&&(a+=this.length),(e=e||0)<0&&(e+=this.length);var n=new w;if(a<e||a<0)return n;e<0&&(e=0),a>this.length&&(a=this.length);for(var t=this.length,o=this.tail;o!==null&&t>a;t--)o=o.prev;for(;o!==null&&t>e;t--,o=o.prev)n.push(o.value);return n},w.prototype.splice=function(e,a,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var t=0,o=this.head;o!==null&&t<e;t++)o=o.next;var f=[];for(t=0;o&&t<a;t++)f.push(o.value),o=this.removeNode(o);for(o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev),t=0;t<n.length;t++)o=p(this,o,n[t]);return f},w.prototype.reverse=function(){for(var e=this.head,a=this.tail,n=e;n!==null;n=n.prev){var t=n.prev;n.prev=n.next,n.next=t}return this.head=a,this.tail=e,this};try{I("./iterator.js")(w)}catch(e){}},{"./iterator.js":82}]},{},[12])(12)})}(ke)),ke.exports}var De=qe();const He=Le({__name:"mqtt-client",setup(ie){const oe=location.protocol==="https:"?"wss":"ws",I=oe==="wss"?8084:8083,z=[0,1,2],q=je({protocol:oe,host:"broker.emqx.io",port:I,clientId:"emqx_vue3_"+Math.random().toString(16).substring(2,8),username:"emqx_test",password:"emqx_test",clean:!0,connectTimeout:30*1e3,reconnectPeriod:4e3}),w=he({topic:"topic/mqttx",qos:0}),p=he({topic:"topic/browser",qos:0,payload:'{ "msg": "Hello, I am browser." }'});let d=he({connected:!1});const u=he(""),i=he(!1),e=he(""),a=he(0),n=()=>{d.value={connected:!1},a.value=0,e.value="",i.value=!1},t=()=>{if(a.value+=1,a.value>5)try{d.value.end(),n()}catch(v){}},o=()=>{try{e.value="connect";const v=q,{protocol:_,host:E,port:T}=v,S=Te(v,["protocol","host","port"]),F=`${_}://${E}:${T}/mqtt`;d.value=De.connect(F,S),d.value.on&&(d.value.on("connect",()=>{e.value=""}),d.value.on("reconnect",t),d.value.on("error",W=>{}),d.value.on("message",(W,m)=>{u.value=u.value.concat(m.toString())}))}catch(_){e.value=""}},f=()=>{e.value="subscribe";const{topic:v,qos:_}=w.value;d.value.subscribe(v,{qos:_},(E,T)=>{e.value="",!E&&(i.value=!0)})},l=()=>{e.value="unsubscribe";const{topic:v,qos:_}=w.value;d.value.unsubscribe(v,{qos:_},E=>{e.value="",i.value=!1})},h=()=>{e.value="publish";const{topic:v,qos:_,payload:E}=p.value;d.value.publish(v,E,{qos:_},T=>{e.value=""})},g=()=>{if(d.value.connected){e.value="disconnect";try{d.value.end(!1,()=>{n()})}catch(v){e.value=""}}},c=v=>{q.port=v==="wss"?8084:8083};return Ue(()=>{try{d.value.end&&d.value.end()}catch(v){}}),(v,_)=>{const E=ce("el-link"),T=ce("el-option"),S=ce("el-select"),F=ce("el-form-item"),W=ce("el-col"),m=ce("el-input"),y=ce("el-button"),C=ce("el-row"),k=ce("el-form"),A=ce("el-card"),N=ce("el-text");return ge(),_e(A,{shadow:"never","body-style":{padding:"20px"}},{header:ee(()=>[pe("div",null,[_[14]||(_[14]=ae(" 基于 ")),J(E,{type:"primary",underline:!1,href:"https://github.com/mqttjs/MQTT.js",target:"_blank"},{default:ee(()=>_[12]||(_[12]=[ae(" MQTT.js ")])),_:1}),_[15]||(_[15]=ae(" 和 免费的公共MQTT代理 ")),J(E,{type:"primary",underline:!1,href:"broker.emqx.io",target:"_blank"},{default:ee(()=>_[13]||(_[13]=[ae(" EMQX ")])),_:1}),_[16]||(_[16]=ae(" 实现的一套 MQTT 客户端 "))]),J(E,{class:"mt-2",href:"https://github.com/pure-admin/vue-pure-admin/blob/main/src/views/able/mqtt-client.vue",target:"_blank"},{default:ee(()=>_[17]||(_[17]=[ae(" 代码位置 src/views/able/mqtt-client.vue ")])),_:1})]),default:ee(()=>[J(A,{shadow:"never"},{default:ee(()=>[_[19]||(_[19]=pe("h1",null,"设置",-1)),J(k,{"label-position":"top",model:q},{default:ee(()=>[J(C,{gutter:20},{default:ee(()=>[J(W,{span:8},{default:ee(()=>[J(F,{prop:"protocol",label:"协议"},{default:ee(()=>[J(S,{modelValue:q.protocol,"onUpdate:modelValue":_[0]||(_[0]=L=>q.protocol=L),onChange:c},{default:ee(()=>[J(T,{label:"ws://",value:"ws"}),J(T,{label:"wss://",value:"wss"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),J(W,{span:8},{default:ee(()=>[J(F,{prop:"host",label:"主机"},{default:ee(()=>[J(m,{modelValue:q.host,"onUpdate:modelValue":_[1]||(_[1]=L=>q.host=L)},null,8,["modelValue"])]),_:1})]),_:1}),J(W,{span:8},{default:ee(()=>[J(F,{prop:"port",label:"端口"},{default:ee(()=>[J(m,{modelValue:q.port,"onUpdate:modelValue":_[2]||(_[2]=L=>q.port=L),modelModifiers:{number:!0},type:"number",placeholder:"8083/8084"},null,8,["modelValue"])]),_:1})]),_:1}),J(W,{span:8},{default:ee(()=>[J(F,{prop:"clientId",label:"客户端ID"},{default:ee(()=>[J(m,{modelValue:q.clientId,"onUpdate:modelValue":_[3]||(_[3]=L=>q.clientId=L)},null,8,["modelValue"])]),_:1})]),_:1}),J(W,{span:8},{default:ee(()=>[J(F,{prop:"username",label:"用户名"},{default:ee(()=>[J(m,{modelValue:q.username,"onUpdate:modelValue":_[4]||(_[4]=L=>q.username=L)},null,8,["modelValue"])]),_:1})]),_:1}),J(W,{span:8},{default:ee(()=>[J(F,{prop:"password",label:"密码"},{default:ee(()=>[J(m,{modelValue:q.password,"onUpdate:modelValue":_[5]||(_[5]=L=>q.password=L)},null,8,["modelValue"])]),_:1})]),_:1}),J(W,{span:24},{default:ee(()=>[J(y,{type:"primary",disabled:de(d).connected,loading:e.value==="connect",onClick:o},{default:ee(()=>[ae(Ae(de(d).connected?"已连接":"连接"),1)]),_:1},8,["disabled","loading"]),de(d).connected?(ge(),_e(y,{key:0,type:"danger",loading:e.value==="disconnect",onClick:g},{default:ee(()=>_[18]||(_[18]=[ae(" 断开连接 ")])),_:1},8,["loading"])):xe("",!0)]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),J(A,{shadow:"never",class:"mt-4"},{default:ee(()=>[_[21]||(_[21]=pe("h1",null,"订阅",-1)),J(k,{"label-position":"top",model:w.value},{default:ee(()=>[J(C,{gutter:20,align:"middle"},{default:ee(()=>[J(W,{span:8},{default:ee(()=>[J(F,{prop:"topic",label:"主题"},{default:ee(()=>[J(m,{modelValue:w.value.topic,"onUpdate:modelValue":_[6]||(_[6]=L=>w.value.topic=L),disabled:i.value},null,8,["modelValue","disabled"])]),_:1})]),_:1}),J(W,{span:8},{default:ee(()=>[J(F,{prop:"qos",label:"通信质量"},{default:ee(()=>[J(S,{modelValue:w.value.qos,"onUpdate:modelValue":_[7]||(_[7]=L=>w.value.qos=L),disabled:i.value},{default:ee(()=>[(ge(),Ie(Oe,null,Pe(z,L=>J(T,{key:L,label:L,value:L},null,8,["label","value"])),64))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1})]),_:1}),J(C,null,{default:ee(()=>[J(W,null,{default:ee(()=>[J(y,{type:"primary",class:"sub-btn",loading:e.value==="subscribe",disabled:!de(d).connected||i.value,onClick:f},{default:ee(()=>[ae(Ae(i.value?"已订阅":"订阅"),1)]),_:1},8,["loading","disabled"]),i.value?(ge(),_e(y,{key:0,type:"primary",class:"sub-btn",loading:e.value==="unsubscribe",disabled:!de(d).connected,onClick:l},{default:ee(()=>_[20]||(_[20]=[ae(" 取消订阅 ")])),_:1},8,["loading","disabled"])):xe("",!0)]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),J(A,{shadow:"never",class:"mt-4"},{default:ee(()=>[_[25]||(_[25]=pe("h1",null,"发布",-1)),J(k,{"label-position":"top",model:p.value},{default:ee(()=>[J(C,{gutter:20},{default:ee(()=>[J(W,{span:8},{default:ee(()=>[J(F,{prop:"topic"},{label:ee(()=>[_[23]||(_[23]=pe("span",null,"主题",-1)),J(N,{type:"info",size:"small"},{default:ee(()=>_[22]||(_[22]=[ae(" 可将订阅主题设置为topic/browser测试MQTT的自发自收。 ")])),_:1})]),default:ee(()=>[J(m,{modelValue:p.value.topic,"onUpdate:modelValue":_[8]||(_[8]=L=>p.value.topic=L)},null,8,["modelValue"])]),_:1})]),_:1}),J(W,{span:8},{default:ee(()=>[J(F,{prop:"payload",label:"有效载荷"},{default:ee(()=>[J(m,{modelValue:p.value.payload,"onUpdate:modelValue":_[9]||(_[9]=L=>p.value.payload=L)},null,8,["modelValue"])]),_:1})]),_:1}),J(W,{span:8},{default:ee(()=>[J(F,{prop:"qos",label:"通信质量"},{default:ee(()=>[J(S,{modelValue:p.value.qos,"onUpdate:modelValue":_[10]||(_[10]=L=>p.value.qos=L)},{default:ee(()=>[(ge(),Ie(Oe,null,Pe(z,L=>J(T,{key:L,label:L,value:L},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),J(W,{span:24},{default:ee(()=>[J(y,{type:"primary",loading:e.value==="publish",disabled:!de(d).connected,onClick:h},{default:ee(()=>_[24]||(_[24]=[ae(" 发布 ")])),_:1},8,["loading","disabled"])]),_:1})]),_:1}),J(A,{shadow:"never",class:"mt-4"},{default:ee(()=>[_[26]||(_[26]=pe("h1",null,"接收",-1)),J(W,{span:24},{default:ee(()=>[J(m,{modelValue:u.value,"onUpdate:modelValue":_[11]||(_[11]=L=>u.value=L),type:"textarea",rows:3,readonly:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})}}});export{He as default};