mqtt 4.3.0 → 4.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -62
- package/dist/mqtt.js +9485 -12901
- package/dist/mqtt.min.js +1 -1
- package/lib/client.js +1884 -1890
- package/lib/topic-alias-send.js +91 -93
- package/package.json +122 -124
package/dist/mqtt.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).mqtt=t()}}(function(){return function(){return function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[s]={exports:{}};e[s][0].call(h.exports,function(t){return i(e[s][1][t]||t)},h,h.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}}()({1:[function(t,e,r){(function(r,n){(function(){"use strict";const i=t("events").EventEmitter,o=t("./store"),s=t("./topic-alias-recv"),a=t("./topic-alias-send"),c=t("mqtt-packet"),u=t("./default-message-id-provider"),h=t("readable-stream").Writable,l=t("inherits"),p=t("reinterval"),f=t("rfdc/default"),d=t("./validations"),g=t("xtend"),y=t("debug")("mqttjs:client"),b=r?r.nextTick:function(t){setTimeout(t,0)},m=n.setImmediate||function(t){b(t)},v={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},_=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],w={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 E(t,e){let r;e.properties&&(r=e.properties.topicAlias);let n=e.topic.toString();if(0===n.length){if(void 0===r)return new Error("Unregistered Topic Alias");if(void 0===(n=t.topicAliasSend.getTopicByAlias(r)))return new Error("Unregistered Topic Alias");e.topic=n}r&&delete e.properties.topicAlias}function C(t,e,r){y("sendPacket :: packet: %O",e),y("sendPacket :: emitting `packetsend`"),t.emit("packetsend",e),y("sendPacket :: writing to stream");const n=c.writeToStream(e,t.stream,t.options);y("sendPacket :: writeToStream result %s",n),!n&&r?(y("sendPacket :: handle events on `drain` once through callback."),t.stream.once("drain",r)):r&&(y("sendPacket :: invoking cb"),r())}function O(t,e,r,n){y("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let i,o=e;if("publish"===o.cmd&&(o=f(e),i=E(t,o)))return r&&r(i);t.outgoingStore.put(o,function(i){if(i)return r&&r(i);n(),C(t,e,r)})}function S(t){y("nop ::",t)}function k(t,e){let r;const n=this;if(!(this instanceof k))return new k(t,e);for(r in this.options=e||{},v)void 0===this.options[r]?this.options[r]=v[r]:this.options[r]=e[r];y("MqttClient :: options.protocol",e.protocol),y("MqttClient :: options.protocolVersion",e.protocolVersion),y("MqttClient :: options.username",e.username),y("MqttClient :: options.keepalive",e.keepalive),y("MqttClient :: options.reconnectPeriod",e.reconnectPeriod),y("MqttClient :: options.rejectUnauthorized",e.rejectUnauthorized),y("MqttClient :: options.topicAliasMaximum",e.topicAliasMaximum),this.options.clientId="string"==typeof e.clientId?e.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),y("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===e.protocolVersion&&e.customHandleAcks?e.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=t,this.messageIdProvider=void 0===this.options.messageIdProvider?new u:this.options.messageIdProvider,this.outgoingStore=e.outgoingStore||new o,this.incomingStore=e.incomingStore||new o,this.queueQoSZero=void 0===e.queueQoSZero||e.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,e.topicAliasMaximum>0&&(e.topicAliasMaximum>65535?y("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new s(e.topicAliasMaximum)),this.on("connect",function(){const t=this.queue;y("connect :: sending queued packets"),function e(){const r=t.shift();y("deliver :: entry %o",r);let i=null;if(!r)return void n._resubscribe();i=r.packet,y("deliver :: call _sendPacket for %o",i);let o=!0;i.messageId&&0!==i.messageId&&(n.messageIdProvider.register(i.messageId)||(o=!1)),o?n._sendPacket(i,function(t){r.cb&&r.cb(t),e()}):(y("messageId: %d has already used. The message is skipped and removed.",i.messageId),e())}()}),this.on("close",function(){y("close :: connected set to `false`"),this.connected=!1,y("close :: clearing connackTimer"),clearTimeout(this.connackTimer),y("close :: clearing ping timer"),null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),y("close :: calling _setupReconnect"),this._setupReconnect()}),i.call(this),y("MqttClient :: setting up stream"),this._setupStream()}l(k,i),k.prototype._setupStream=function(){const t=this,e=new h,r=c.parser(this.options);let n=null;const i=[];function o(){if(i.length)b(s);else{const t=n;n=null,t()}}function s(){y("work :: getting next packet in queue");const e=i.shift();if(e)y("work :: packet pulled from queue"),t._handlePacket(e,o);else{y("work :: no packets in queue");const t=n;n=null,y("work :: done flag is %s",!!t),t&&t()}}y("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),y("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",function(t){y("parser :: on packet push to packets array."),i.push(t)}),e._write=function(t,e,i){n=i,y("writable stream :: parsing buffer"),r.parse(t),s()},y("_setupStream :: pipe stream to writable stream"),this.stream.pipe(e),this.stream.on("error",function(e){y("streamErrorHandler :: error",e.message),_.includes(e.code)?(y("streamErrorHandler :: emitting error"),t.emit("error",e)):S(e)}),this.stream.on("close",function(){var e;y("(%s)stream :: on close",t.options.clientId),(e=t.outgoing)&&(y("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(e).forEach(function(t){e[t].volatile&&"function"==typeof e[t].cb&&(e[t].cb(new Error("Connection closed")),delete e[t])})),y("stream: emit close to MqttClient"),t.emit("close")}),y("_setupStream: sending packet `connect`");const a=Object.create(this.options);if(a.cmd="connect",this.topicAliasRecv&&(a.properties||(a.properties={}),this.topicAliasRecv&&(a.properties.topicAliasMaximum=this.topicAliasRecv.max)),C(this,a),r.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return t.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket){C(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){y("!!connectTimeout hit!! Calling _cleanUp with force `true`"),t._cleanUp(!0)},this.options.connectTimeout)},k.prototype._handlePacket=function(t,e){const r=this.options;if(5===r.protocolVersion&&r.properties&&r.properties.maximumPacketSize&&r.properties.maximumPacketSize<t.length)return this.emit("error",new Error("exceeding packets size "+t.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(y("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",t),t.cmd){case"publish":this._handlePublish(t,e);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(t),e();break;case"pubrel":this._handlePubrel(t,e);break;case"connack":this._handleConnack(t),e();break;case"auth":this._handleAuth(t),e();break;case"pingresp":this._handlePingresp(t),e();break;case"disconnect":this._handleDisconnect(t),e()}},k.prototype._checkDisconnecting=function(t){return this.disconnecting&&(t?t(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},k.prototype.publish=function(t,e,r,n){y("publish :: message `%s` to topic `%s`",e,t);const i=this.options;"function"==typeof r&&(n=r,r=null);if(r=g({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;const o=this,s=function(){let s=0;if((1===r.qos||2===r.qos)&&null===(s=o._nextId()))return y("No messageId left"),!1;const a={cmd:"publish",topic:t,payload:e,qos:r.qos,retain:r.retain,messageId:s,dup:r.dup};switch(5===i.protocolVersion&&(a.properties=r.properties),y("publish :: qos",r.qos),r.qos){case 1:case 2:o.outgoing[a.messageId]={volatile:!1,cb:n||S},y("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,void 0,r.cbStorePut);break;default:y("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,n,r.cbStorePut)}return!0};return this._storeProcessing||this._storeProcessingQueue.length>0?this._storeProcessingQueue.push({invoke:s,cbStorePut:r.cbStorePut,callback:n}):s(),this},k.prototype.subscribe=function(){const t=this,e=new Array(arguments.length);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];const r=[];let n=e.shift();const i=n.resubscribe;let o=e.pop()||S,s=e.pop();const a=this.options.protocolVersion;delete n.resubscribe,"string"==typeof n&&(n=[n]),"function"!=typeof o&&(s=o,o=S);const c=d.validateTopics(n);if(null!==c)return m(o,new Error("Invalid topic "+c)),this;if(this._checkDisconnecting(o))return y("subscribe: discconecting true"),this;const u={qos:0};if(5===a&&(u.nl=!1,u.rap=!1,u.rh=0),s=g(u,s),Array.isArray(n)?n.forEach(function(e){if(y("subscribe: array topic %s",e),!Object.prototype.hasOwnProperty.call(t._resubscribeTopics,e)||t._resubscribeTopics[e].qos<s.qos||i){const t={topic:e,qos:s.qos};5===a&&(t.nl=s.nl,t.rap=s.rap,t.rh=s.rh,t.properties=s.properties),y("subscribe: pushing topic `%s` and qos `%s` to subs list",t.topic,t.qos),r.push(t)}}):Object.keys(n).forEach(function(e){if(y("subscribe: object topic %s",e),!Object.prototype.hasOwnProperty.call(t._resubscribeTopics,e)||t._resubscribeTopics[e].qos<n[e].qos||i){const t={topic:e,qos:n[e].qos};5===a&&(t.nl=n[e].nl,t.rap=n[e].rap,t.rh=n[e].rh,t.properties=s.properties),y("subscribe: pushing `%s` to subs list",t),r.push(t)}}),!r.length)return o(null,[]),this;const h=function(){const e=t._nextId();if(null===e)return y("No messageId left"),!1;const n={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:e};if(s.properties&&(n.properties=s.properties),t.options.resubscribe){y("subscribe :: resubscribe true");const e=[];r.forEach(function(r){if(t.options.reconnectPeriod>0){const n={qos:r.qos};5===a&&(n.nl=r.nl||!1,n.rap=r.rap||!1,n.rh=r.rh||0,n.properties=r.properties),t._resubscribeTopics[r.topic]=n,e.push(r.topic)}}),t.messageIdToTopic[n.messageId]=e}return t.outgoing[n.messageId]={volatile:!0,cb:function(t,e){if(!t){const t=e.granted;for(let e=0;e<t.length;e+=1)r[e].qos=t[e]}o(t,r)}},y("subscribe :: call _sendPacket"),t._sendPacket(n),!0};return this._storeProcessing||this._storeProcessingQueue.length>0?this._storeProcessingQueue.push({invoke:h,callback:o}):h(),this},k.prototype.unsubscribe=function(){const t=this,e=new Array(arguments.length);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];let r=e.shift(),n=e.pop()||S,i=e.pop();"string"==typeof r&&(r=[r]),"function"!=typeof n&&(i=n,n=S);const o=d.validateTopics(r);if(null!==o)return m(n,new Error("Invalid topic "+o)),this;if(t._checkDisconnecting(n))return this;const s=function(){const e=t._nextId();if(null===e)return y("No messageId left"),!1;const o={cmd:"unsubscribe",qos:1,messageId:e};return"string"==typeof r?o.unsubscriptions=[r]:Array.isArray(r)&&(o.unsubscriptions=r),t.options.resubscribe&&o.unsubscriptions.forEach(function(e){delete t._resubscribeTopics[e]}),"object"==typeof i&&i.properties&&(o.properties=i.properties),t.outgoing[o.messageId]={volatile:!0,cb:n},y("unsubscribe: call _sendPacket"),t._sendPacket(o),!0};return this._storeProcessing||this._storeProcessingQueue.length>0?this._storeProcessingQueue.push({invoke:s,callback:n}):s(),this},k.prototype.end=function(t,e,r){const n=this;function i(){y("end :: (%s) :: finish :: calling _cleanUp with force %s",n.options.clientId,t),n._cleanUp(t,()=>{y("end :: finish :: calling process.nextTick on closeStores"),b(function(){y("end :: closeStores: closing incoming and outgoing stores"),n.disconnected=!0,n.incomingStore.close(function(t){n.outgoingStore.close(function(e){if(y("end :: closeStores: emitting end"),n.emit("end"),r){const n=t||e;y("end :: closeStores: invoking callback with args"),r(n)}})}),n._deferredReconnect&&n._deferredReconnect()}.bind(n))},e)}return y("end :: (%s)",this.options.clientId),null!=t&&"boolean"==typeof t||(r=e||S,e=t,t=!1,"object"!=typeof e&&(r=e,e=null,"function"!=typeof r&&(r=S))),"object"!=typeof e&&(r=e,e=null),y("end :: cb? %s",!!r),r=r||S,this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!t&&Object.keys(this.outgoing).length>0?(y("end :: (%s) :: calling finish in 10ms once outgoing is empty",n.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,i,10))):(y("end :: (%s) :: immediately calling finish",n.options.clientId),i()),this)},k.prototype.removeOutgoingMessage=function(t){const e=this.outgoing[t]?this.outgoing[t].cb:null;return delete this.outgoing[t],this.outgoingStore.del({messageId:t},function(){e(new Error("Message removed"))}),this},k.prototype.reconnect=function(t){y("client reconnect");const e=this,r=function(){t?(e.options.incomingStore=t.incomingStore,e.options.outgoingStore=t.outgoingStore):(e.options.incomingStore=null,e.options.outgoingStore=null),e.incomingStore=e.options.incomingStore||new o,e.outgoingStore=e.options.outgoingStore||new o,e.disconnecting=!1,e.disconnected=!1,e._deferredReconnect=null,e._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},k.prototype._reconnect=function(){y("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),y("client already connected. disconnecting first.")):(y("_reconnect: calling _setupStream"),this._setupStream())},k.prototype._setupReconnect=function(){const t=this;!t.disconnecting&&!t.reconnectTimer&&t.options.reconnectPeriod>0?(this.reconnecting||(y("_setupReconnect :: emit `offline` state"),this.emit("offline"),y("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),y("_setupReconnect :: setting reconnectTimer for %d ms",t.options.reconnectPeriod),t.reconnectTimer=setInterval(function(){y("reconnectTimer :: reconnect triggered!"),t._reconnect()},t.options.reconnectPeriod)):y("_setupReconnect :: doing nothing...")},k.prototype._clearReconnect=function(){y("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},k.prototype._cleanUp=function(t,e){const r=arguments[2];if(e&&(y("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",e)),y("_cleanUp :: forced? %s",t),t)0===this.options.reconnectPeriod&&this.options.clean&&(n=this.outgoing)&&(y("flush: queue exists? %b",!!n),Object.keys(n).forEach(function(t){"function"==typeof n[t].cb&&(n[t].cb(new Error("Connection closed")),delete n[t])})),y("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const t=g({cmd:"disconnect"},r);y("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(t,m.bind(null,this.stream.end.bind(this.stream)))}var n;this.disconnecting||(y("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(y("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),e&&!this.connected&&(y("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",e),e())},k.prototype._sendPacket=function(t,e,r){y("_sendPacket :: (%s) :: start",this.options.clientId),r=r||S,e=e||S;const n=function(t,e){if(5===t.options.protocolVersion&&"publish"===e.cmd){let r;e.properties&&(r=e.properties.topicAlias);const n=e.topic.toString();if(t.topicAliasSend)if(r){if(0!==n.length&&(y("applyTopicAlias :: register topic: %s - alias: %d",n,r),!t.topicAliasSend.put(n,r)))return y("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}else 0!==n.length&&(t.options.autoAssignTopicAlias?(r=t.topicAliasSend.getAliasByTopic(n))?(e.topic="",e.properties={...e.properties,topicAlias:r},y("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",n,r)):(r=t.topicAliasSend.getLruAlias(),t.topicAliasSend.put(n,r),e.properties={...e.properties,topicAlias:r},y("applyTopicAlias :: auto assign topic: %s - alias: %d",n,r)):t.options.autoUseTopicAlias&&(r=t.topicAliasSend.getAliasByTopic(n))&&(e.topic="",e.properties={...e.properties,topicAlias:r},y("applyTopicAlias :: auto use topic: %s - alias: %d",n,r)));else if(r)return y("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}}(this,t);if(n)e(n);else{if(!this.connected)return"auth"===t.cmd?(this._shiftPingInterval(),void C(this,t,e)):(y("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(t,e,r));switch(this._shiftPingInterval(),t.cmd){case"publish":break;case"pubrel":return void O(this,t,e,r);default:return void C(this,t,e)}switch(t.qos){case 2:case 1:O(this,t,e,r);break;case 0:default:C(this,t,e)}y("_sendPacket :: (%s) :: end",this.options.clientId)}},k.prototype._storePacket=function(t,e,r){y("_storePacket :: packet: %o",t),y("_storePacket :: cb? %s",!!e),r=r||S;let n=t;if("publish"===n.cmd){const r=E(this,n=f(t));if(r)return e&&e(r)}0===(n.qos||0)&&this.queueQoSZero||"publish"!==n.cmd?this.queue.push({packet:n,cb:e}):n.qos>0?(e=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,function(t){if(t)return e&&e(t);r()})):e&&e(new Error("No connection to broker"))},k.prototype._setupPingTimer=function(){y("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const t=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=p(function(){t._checkPing()},1e3*this.options.keepalive))},k.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},k.prototype._checkPing=function(){y("_checkPing :: checking ping..."),this.pingResp?(y("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(y("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},k.prototype._handlePingresp=function(){this.pingResp=!0},k.prototype._handleConnack=function(t){y("_handleConnack");const e=this.options,r=5===e.protocolVersion?t.reasonCode:t.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,t.properties){if(t.properties.topicAliasMaximum){if(t.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));t.properties.topicAliasMaximum>0&&(this.topicAliasSend=new a(t.properties.topicAliasMaximum))}t.properties.serverKeepAlive&&e.keepalive&&(e.keepalive=t.properties.serverKeepAlive,this._shiftPingInterval()),t.properties.maximumPacketSize&&(e.properties||(e.properties={}),e.properties.maximumPacketSize=t.properties.maximumPacketSize)}if(0===r)this.reconnecting=!1,this._onConnect(t);else if(r>0){const t=new Error("Connection refused: "+w[r]);t.code=r,this.emit("error",t)}},k.prototype._handleAuth=function(t){const e=this.options.protocolVersion,r=5===e?t.reasonCode:t.returnCode;if(5!==e){const t=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+e);return t.code=r,void this.emit("error",t)}const n=this;this.handleAuth(t,function(t,e){if(t)n.emit("error",t);else if(24===r)n.reconnecting=!1,n._sendPacket(e);else{const e=new Error("Connection refused: "+w[r]);t.code=r,n.emit("error",e)}})},k.prototype.handleAuth=function(t,e){e()},k.prototype._handlePublish=function(t,e){y("_handlePublish: packet %o",t),e=void 0!==e?e:S;let r=t.topic.toString();const n=t.payload,i=t.qos,o=t.messageId,s=this,a=this.options,c=[0,16,128,131,135,144,145,151,153];if(5===this.options.protocolVersion){let e;if(t.properties&&(e=t.properties.topicAlias),void 0!==e)if(0===r.length){if(!(e>0&&e<=65535))return y("_handlePublish :: topic alias out of range. alias: %d",e),void this.emit("error",new Error("Received Topic Alias is out of range"));{const t=this.topicAliasRecv.getTopicByAlias(e);if(!t)return y("_handlePublish :: unregistered topic alias. alias: %d",e),void this.emit("error",new Error("Received unregistered Topic Alias"));y("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",r=t,e)}}else{if(!this.topicAliasRecv.put(r,e))return y("_handlePublish :: topic alias out of range. alias: %d",e),void this.emit("error",new Error("Received Topic Alias is out of range"));y("_handlePublish :: registered topic: %s - alias: %d",r,e)}}switch(y("_handlePublish: qos %d",i),i){case 2:a.customHandleAcks(r,n,t,function(r,n){return r instanceof Error||(n=r,r=null),r?s.emit("error",r):-1===c.indexOf(n)?s.emit("error",new Error("Wrong reason code for pubrec")):void(n?s._sendPacket({cmd:"pubrec",messageId:o,reasonCode:n},e):s.incomingStore.put(t,function(){s._sendPacket({cmd:"pubrec",messageId:o},e)}))});break;case 1:a.customHandleAcks(r,n,t,function(i,a){return i instanceof Error||(a=i,i=null),i?s.emit("error",i):-1===c.indexOf(a)?s.emit("error",new Error("Wrong reason code for puback")):(a||s.emit("message",r,n,t),void s.handleMessage(t,function(t){if(t)return e&&e(t);s._sendPacket({cmd:"puback",messageId:o,reasonCode:a},e)}))});break;case 0:this.emit("message",r,n,t),this.handleMessage(t,e);break;default:y("_handlePublish: unknown QoS. Doing nothing.")}},k.prototype.handleMessage=function(t,e){e()},k.prototype._handleAck=function(t){const e=t.messageId,r=t.cmd;let n=null;const i=this.outgoing[e]?this.outgoing[e].cb:null,o=this;let s;if(i){switch(y("_handleAck :: packet type",r),r){case"pubcomp":case"puback":{const r=t.reasonCode;r&&r>0&&16!==r&&((s=new Error("Publish error: "+w[r])).code=r,i(s,t)),delete this.outgoing[e],this.outgoingStore.del(t,i),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue();break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:e};const r=t.reasonCode;r&&r>0&&16!==r?((s=new Error("Publish error: "+w[r])).code=r,i(s,t)):this._sendPacket(n);break}case"suback":delete this.outgoing[e],this.messageIdProvider.deallocate(e);for(let r=0;r<t.granted.length;r++)if(0!=(128&t.granted[r])){const t=this.messageIdToTopic[e];t&&t.forEach(function(t){delete o._resubscribeTopics[t]})}this._invokeStoreProcessingQueue(),i(null,t);break;case"unsuback":delete this.outgoing[e],this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue(),i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else y("_handleAck :: Server sent an ack in error. Ignoring.")},k.prototype._handlePubrel=function(t,e){y("handling pubrel packet"),e=void 0!==e?e:S;const r=this,n={cmd:"pubcomp",messageId:t.messageId};r.incomingStore.get(t,function(t,i){t?r._sendPacket(n,e):(r.emit("message",i.topic,i.payload,i),r.handleMessage(i,function(t){if(t)return e(t);r.incomingStore.del(i,S),r._sendPacket(n,e)}))})},k.prototype._handleDisconnect=function(t){this.emit("disconnect",t)},k.prototype._nextId=function(){return this.messageIdProvider.allocate()},k.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},k.prototype._resubscribe=function(){y("_resubscribe");const t=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!this.connackPacket.sessionPresent)&&t.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){y("_resubscribe: protocolVersion 5");for(let e=0;e<t.length;e++){const r={};r[t[e]]=this._resubscribeTopics[t[e]],r.resubscribe=!0,this.subscribe(r,{properties:r[t[e]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},k.prototype._onConnect=function(t){if(this.disconnected)return void this.emit("connect",t);const e=this;this.connackPacket=t,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function r(){let n=e.outgoingStore.createStream();function i(){e._storeProcessing=!1,e._packetIdsDuringStoreProcessing={}}function o(){n.destroy(),n=null,e._flushStoreProcessingQueue(),i()}e.once("close",o),n.on("error",function(t){i(),e._flushStoreProcessingQueue(),e.removeListener("close",o),e.emit("error",t)}),n.on("end",function(){let n=!0;for(const t in e._packetIdsDuringStoreProcessing)if(!e._packetIdsDuringStoreProcessing[t]){n=!1;break}n?(i(),e.removeListener("close",o),e._invokeAllStoreProcessingQueue(),e.emit("connect",t)):r()}),function t(){if(!n)return;e._storeProcessing=!0;const r=n.read(1);let i;r?e._packetIdsDuringStoreProcessing[r.messageId]?t():e.disconnecting||e.reconnectTimer?n.destroy&&n.destroy():(i=e.outgoing[r.messageId]?e.outgoing[r.messageId].cb:null,e.outgoing[r.messageId]={volatile:!1,cb:function(e,r){i&&i(e,r),t()}},e._packetIdsDuringStoreProcessing[r.messageId]=!0,e.messageIdProvider.register(r.messageId)?e._sendPacket(r):y("messageId: %d has already used.",r.messageId)):n.once("readable",t)}()}()},k.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const t=this._storeProcessingQueue[0];if(t&&t.invoke())return this._storeProcessingQueue.shift(),!0}return!1},k.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},k.prototype._flushStoreProcessingQueue=function(){for(const t of this._storeProcessingQueue)t.cbStorePut&&t.cbStorePut(new Error("Connection closed")),t.callback&&t.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},e.exports=k}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:64,debug:45,events:49,inherits:51,"mqtt-packet":54,"readable-stream":83,reinterval:84,"rfdc/default":85,xtend:96}],2:[function(t,e,r){(function(r){(function(){"use strict";const n=t("readable-stream").Transform,i=t("duplexify");let o,s,a,c=!1;e.exports=function(t,e){if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");const u="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt";!function(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}(e);const h=function(t,e){const r="alis"===t.protocol?"wss":"ws";let n=r+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(n=r+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(n=t.transformWsUrl(n,t,e)),n}(e,t);return(o=e.my).connectSocket({url:h,protocols:u}),s=function(){const t=new n;return t._write=function(t,e,r){o.sendSocketMessage({data:t.buffer,success:function(){r()},fail:function(){r(new Error)}})},t._flush=function(t){o.closeSocket({success:function(){t()}})},t}(),a=i.obj(),c||(c=!0,o.onSocketOpen(function(){a.setReadable(s),a.setWritable(s),a.emit("connect")}),o.onSocketMessage(function(t){if("string"==typeof t.data){const e=r.from(t.data,"base64");s.push(e)}else{const e=new FileReader;e.addEventListener("load",function(){let t=e.result;t=t instanceof ArrayBuffer?r.from(t):r.from(t,"utf8"),s.push(t)}),e.readAsArrayBuffer(t.data)}}),o.onSocketClose(function(){a.end(),a.destroy()}),o.onSocketError(function(t){a.destroy(t)})),a}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:17,duplexify:47,"readable-stream":83}],3:[function(t,e,r){"use strict";const n=t("net"),i=t("debug")("mqttjs:tcp");e.exports=function(t,e){e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost";const r=e.port,o=e.hostname;return i("port %d and host %s",r,o),n.createConnection(r,o)}},{debug:45,net:16}],4:[function(t,e,r){"use strict";const n=t("tls"),i=t("net"),o=t("debug")("mqttjs:tls");e.exports=function(t,e){e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",0===i.isIP(e.host)&&(e.servername=e.host),e.rejectUnauthorized=!1!==e.rejectUnauthorized,delete e.path,o("port %d host %s rejectUnauthorized %b",e.port,e.host,e.rejectUnauthorized);const r=n.connect(e);function s(n){e.rejectUnauthorized&&t.emit("error",n),r.end()}return r.on("secureConnect",function(){e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",s)}),r.on("error",s),r}},{debug:45,net:16,tls:16}],5:[function(t,e,r){(function(r,n){(function(){"use strict";const i=t("ws"),o=t("debug")("mqttjs:ws"),s=t("duplexify"),a=t("readable-stream").Transform,c=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],u=void 0!==r&&"browser"===r.title||"function"==typeof __webpack_require__;function h(t,e){let r=t.protocol+"://"+t.hostname+":"+t.port+t.path;return"function"==typeof t.transformWsUrl&&(r=t.transformWsUrl(r,t,e)),r}function l(t){const e=t;return t.hostname||(e.hostname="localhost"),t.port||("wss"===t.protocol?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),u||"wss"!==t.protocol||c.forEach(function(r){Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])}),e}e.exports=u?function(t,e){let r;o("browserStreamBuilder");const i=function(t){const e=l(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const t=new URL(document.URL);e.hostname=t.hostname,e.port||(e.port=t.port)}return void 0===e.objectMode&&(e.objectMode=!(!0===e.binary||void 0===e.binary)),e}(e).browserBufferSize||524288,c=e.browserBufferTimeout||1e3,u=!e.objectMode,p=function(t,e){const r="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt",n=h(e,t),i=new WebSocket(n,[r]);return i.binaryType="arraybuffer",i}(t,e),f=function(t,e,r){const n=new a({objectModeMode:t.objectMode});return n._write=e,n._flush=r,n}(e,function t(e,r,o){p.bufferedAmount>i&&setTimeout(t,c,e,r,o),u&&"string"==typeof e&&(e=n.from(e,"utf8"));try{p.send(e)}catch(t){return o(t)}o()},function(t){p.close(),t()});e.objectMode||(f._writev=v),f.on("close",()=>{p.close()});const d=void 0!==p.addEventListener;function g(){r.setReadable(f),r.setWritable(f),r.emit("connect")}function y(){r.end(),r.destroy()}function b(t){r.destroy(t)}function m(t){let e=t.data;e=e instanceof ArrayBuffer?n.from(e):n.from(e,"utf8"),f.push(e)}function v(t,e){const r=new Array(t.length);for(let e=0;e<t.length;e++)"string"==typeof t[e].chunk?r[e]=n.from(t[e],"utf8"):r[e]=t[e].chunk;this._write(n.concat(r),"binary",e)}return p.readyState===p.OPEN?r=f:(r=r=s(void 0,void 0,e),e.objectMode||(r._writev=v),d?p.addEventListener("open",g):p.onopen=g),r.socket=p,d?(p.addEventListener("close",y),p.addEventListener("error",b),p.addEventListener("message",m)):(p.onclose=y,p.onerror=b,p.onmessage=m),r}:function(t,e){o("streamBuilder");const r=l(e),n=h(r,t),s=function(t,e,r){o("createWebSocket"),o("protocol: "+r.protocolId+" "+r.protocolVersion);const n="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return o("creating new Websocket for url: "+e+" and protocol: "+n),new i(e,[n],r.wsOptions)}(0,n,r),a=i.createWebSocketStream(s,r.wsOptions);return a.url=n,s.on("close",()=>{a.destroy()}),a}}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:64,buffer:17,debug:45,duplexify:47,"readable-stream":83,ws:95}],6:[function(t,e,r){(function(r){(function(){"use strict";const n=t("readable-stream").Transform,i=t("duplexify");let o,s,a;e.exports=function(t,e){if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");const c="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt";!function(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}(e);const u=function(t,e){const r="wxs"===t.protocol?"wss":"ws";let n=r+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(n=r+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(n=t.transformWsUrl(n,t,e)),n}(e,t);o=wx.connectSocket({url:u,protocols:[c]}),s=function(){const t=new n;return t._write=function(t,e,r){o.send({data:t.buffer,success:function(){r()},fail:function(t){r(new Error(t))}})},t._flush=function(t){o.close({success:function(){t()}})},t}(),(a=i.obj())._destroy=function(t,e){o.close({success:function(){e&&e(t)}})};const h=a.destroy;return a.destroy=function(){a.destroy=h;const t=this;setTimeout(function(){o.close({fail:function(){t._destroy(new Error)}})},0)}.bind(a),o.onOpen(function(){a.setReadable(s),a.setWritable(s),a.emit("connect")}),o.onMessage(function(t){let e=t.data;e=e instanceof ArrayBuffer?r.from(e):r.from(e,"utf8"),s.push(e)}),o.onClose(function(){a.end(),a.destroy()}),o.onError(function(t){a.destroy(new Error(t.errMsg))}),a}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:17,duplexify:47,"readable-stream":83}],7:[function(t,e,r){"use strict";function n(){if(!(this instanceof n))return new n;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}n.prototype.allocate=function(){const t=this.nextId++;return 65536===this.nextId&&(this.nextId=1),t},n.prototype.getLastAllocated=function(){return 1===this.nextId?65535:this.nextId-1},n.prototype.register=function(t){return!0},n.prototype.deallocate=function(t){},n.prototype.clear=function(){},e.exports=n},{}],8:[function(t,e,r){"use strict";const n=t("xtend"),i=t("readable-stream").Readable,o={objectMode:!0},s={clean:!0};function a(t){if(!(this instanceof a))return new a(t);this.options=t||{},this.options=n(s,t),this._inflights=new Map}a.prototype.put=function(t,e){return this._inflights.set(t.messageId,t),e&&e(),this},a.prototype.createStream=function(){const t=new i(o),e=[];let r=!1,n=0;return this._inflights.forEach(function(t,r){e.push(t)}),t._read=function(){!r&&n<e.length?this.push(e[n++]):this.push(null)},t.destroy=function(){if(r)return;const t=this;r=!0,setTimeout(function(){t.emit("close")},0)},t},a.prototype.del=function(t,e){return(t=this._inflights.get(t.messageId))?(this._inflights.delete(t.messageId),e(null,t)):e&&e(new Error("missing packet")),this},a.prototype.get=function(t,e){return(t=this._inflights.get(t.messageId))?e(null,t):e&&e(new Error("missing packet")),this},a.prototype.close=function(t){this.options.clean&&(this._inflights=null),t&&t()},e.exports=a},{"readable-stream":83,xtend:96}],9:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.aliasToTopic={},this.max=t}n.prototype.put=function(t,e){return!(0===e||e>this.max)&&(this.aliasToTopic[e]=t,this.length=Object.keys(this.aliasToTopic).length,!0)},n.prototype.getTopicByAlias=function(t){return this.aliasToTopic[t]},n.prototype.clear=function(){this.aliasToTopic={}},e.exports=n},{}],10:[function(t,e,r){"use strict";const n=t("collections/lru-map"),i=t("number-allocator").NumberAllocator;function o(t){if(!(this instanceof o))return new o(t);t>0&&(this.aliasToTopic=new n,this.topicToAlias={},this.numberAllocator=new i(1,t),this.max=t,this.length=0)}o.prototype.put=function(t,e){if(0===e||e>this.max)return!1;const r=this.aliasToTopic.get(e);return r&&delete this.topicToAlias[r.topic],this.aliasToTopic.set(e,{topic:t,alias:e}),this.topicToAlias[t]=e,this.numberAllocator.use(e),this.length=this.aliasToTopic.length,!0},o.prototype.getTopicByAlias=function(t){const e=this.aliasToTopic.get(t);return void 0===e?e:e.topic},o.prototype.getAliasByTopic=function(t){const e=this.topicToAlias[t];return void 0!==e&&this.aliasToTopic.get(e),e},o.prototype.clear=function(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},o.prototype.getLruAlias=function(){const t=this.numberAllocator.firstVacant();return t||this.aliasToTopic.min().alias},e.exports=o},{"collections/lru-map":34,"number-allocator":60}],11:[function(t,e,r){"use strict";function n(t){const e=t.split("/");for(let t=0;t<e.length;t++)if("+"!==e[t]){if("#"===e[t])return t===e.length-1;if(-1!==e[t].indexOf("+")||-1!==e[t].indexOf("#"))return!1}return!0}e.exports={validateTopics:function(t){if(0===t.length)return"empty_topic_list";for(let e=0;e<t.length;e++)if(!n(t[e]))return t[e];return null}}},{}],12:[function(t,e,r){(function(r){(function(){"use strict";const n=t("../client"),i=t("../store"),o=t("url"),s=t("xtend"),a=t("debug")("mqttjs"),c={};function u(t,e){if(a("connecting to an MQTT broker..."),"object"!=typeof t||e||(e=t,t=null),e=e||{},t){const r=o.parse(t,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(e=s(r,e)).protocol)throw new Error("Missing protocol");e.protocol=e.protocol.replace(/:$/,"")}if(function(t){let e;t.auth&&((e=t.auth.match(/^(.+):(.+)$/))?(t.username=e[1],t.password=e[2]):t.username=t.auth)}(e),e.query&&"string"==typeof e.query.clientId&&(e.clientId=e.query.clientId),e.cert&&e.key){if(!e.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(e.protocol))switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;case"ali":e.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+e.protocol+'"!')}}if(!c[e.protocol]){const t=-1!==["mqtts","wss"].indexOf(e.protocol);e.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(e,r){return(!t||r%2!=0)&&"function"==typeof c[e]})[0]}if(!1===e.clean&&!e.clientId)throw new Error("Missing clientId for unclean clients");e.protocol&&(e.defaultProtocol=e.protocol);const r=new n(function(t){return e.servers&&(t._reconnectCount&&t._reconnectCount!==e.servers.length||(t._reconnectCount=0),e.host=e.servers[t._reconnectCount].host,e.port=e.servers[t._reconnectCount].port,e.protocol=e.servers[t._reconnectCount].protocol?e.servers[t._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,t._reconnectCount++),a("calling streambuilder for",e.protocol),c[e.protocol](t,e)},e);return r.on("error",function(){}),r}void 0!==r&&"browser"!==r.title||"function"!=typeof __webpack_require__?(c.mqtt=t("./tcp"),c.tcp=t("./tcp"),c.ssl=t("./tls"),c.tls=t("./tls"),c.mqtts=t("./tls")):(c.wx=t("./wx"),c.wxs=t("./wx"),c.ali=t("./ali"),c.alis=t("./ali")),c.ws=t("./ws"),c.wss=t("./ws"),e.exports=u,e.exports.connect=u,e.exports.MqttClient=n,e.exports.Store=i}).call(this)}).call(this,t("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:64,debug:45,url:90,xtend:96}],13:[function(t,e,r){"use strict";r.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=u(t),s=n[0],a=n[1],c=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,c[h++]=255&e);1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e);return c},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(h(t,s,s+16383>a?a:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],14:[function(t,e,r){"use strict";const{Buffer:n}=t("buffer"),i=Symbol.for("BufferList");function o(t){if(!(this instanceof o))return new o(t);o._init.call(this,t)}o._init=function(t){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},o.prototype._new=function(t){return new o(t)},o.prototype._offset=function(t){if(0===t)return[0,0];let e=0;for(let r=0;r<this._bufs.length;r++){const n=e+this._bufs[r].length;if(t<n||r===this._bufs.length-1)return[r,t-e];e=n}},o.prototype._reverseOffset=function(t){const e=t[0];let r=t[1];for(let t=0;t<e;t++)r+=this._bufs[t].length;return r},o.prototype.get=function(t){if(t>this.length||t<0)return;const e=this._offset(t);return this._bufs[e[0]][e[1]]},o.prototype.slice=function(t,e){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof e&&e<0&&(e+=this.length),this.copy(null,0,t,e)},o.prototype.copy=function(t,e,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return t||n.alloc(0);if(i<=0)return t||n.alloc(0);const o=!!t,s=this._offset(r),a=i-r;let c=a,u=o&&e||0,h=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let e=0;e<this._bufs.length;e++)this._bufs[e].copy(t,u),u+=this._bufs[e].length;return t}if(c<=this._bufs[s[0]].length-h)return o?this._bufs[s[0]].copy(t,e,h,h+c):this._bufs[s[0]].slice(h,h+c);o||(t=n.allocUnsafe(a));for(let e=s[0];e<this._bufs.length;e++){const r=this._bufs[e].length-h;if(!(c>r)){this._bufs[e].copy(t,u,h,h+c),u+=r;break}this._bufs[e].copy(t,u,h),u+=r,c-=r,h&&(h=0)}return t.length>u?t.slice(0,u):t},o.prototype.shallowSlice=function(t,e){if(t=t||0,e="number"!=typeof e?this.length:e,t<0&&(t+=this.length),e<0&&(e+=this.length),t===e)return this._new();const r=this._offset(t),n=this._offset(e),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(t,e,r){return this.slice(e,r).toString(t)},o.prototype.consume=function(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const t=this._new();for(let e=0;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},o.prototype.append=function(t){if(null==t)return this;if(t.buffer)this._appendBuffer(n.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let e=0;e<t.length;e++)this.append(t[e]);else if(this._isBufferList(t))for(let e=0;e<t._bufs.length;e++)this.append(t._bufs[e]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(n.from(t));return this},o.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length},o.prototype.indexOf=function(t,e,r){if(void 0===r&&"string"==typeof e&&(r=e,e=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=n.from([t]):"string"==typeof t?t=n.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=n.from(t.buffer,t.byteOffset,t.byteLength):n.isBuffer(t)||(t=n.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),0===t.length)return e>this.length?this.length:e;const i=this._offset(e);let o=i[0],s=i[1];for(;o<this._bufs.length;o++){const e=this._bufs[o];for(;s<e.length;){if(e.length-s>=t.length){const r=e.indexOf(t,s);if(-1!==r)return this._reverseOffset([o,r]);s=e.length-t.length+1}else{const e=this._reverseOffset([o,s]);if(this._match(e,t))return e;s++}}s=0}return-1},o.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0},function(){const t={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 e in t)!function(e){o.prototype[e]=null===t[e]?function(t,r){return this.slice(t,t+r)[e](0,r)}:function(r=0){return this.slice(r,r+t[e])[e](0)}}(e)}(),o.prototype._isBufferList=function(t){return t instanceof o||o.isBufferList(t)},o.isBufferList=function(t){return null!=t&&t[i]},e.exports=o},{buffer:17}],15:[function(t,e,r){"use strict";const n=t("readable-stream").Duplex,i=t("inherits"),o=t("./BufferList");function s(t){if(!(this instanceof s))return new s(t);if("function"==typeof t){this._callback=t;const e=function(t){this._callback&&(this._callback(t),this._callback=null)}.bind(this);this.on("pipe",function(t){t.on("error",e)}),this.on("unpipe",function(t){t.removeListener("error",e)}),t=null}o._init.call(this,t),n.call(this)}i(s,n),Object.assign(s.prototype,o.prototype),s.prototype._new=function(t){return new s(t)},s.prototype._write=function(t,e,r){this._appendBuffer(t),"function"==typeof r&&r()},s.prototype._read=function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},s.prototype.end=function(t){n.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype._destroy=function(t,e){this._bufs.length=0,this.length=0,e(t)},s.prototype._isBufferList=function(t){return t instanceof s||t instanceof o||s.isBufferList(t)},s.isBufferList=o.isBufferList,e.exports=s,e.exports.BufferListStream=s,e.exports.BufferList=o},{"./BufferList":14,inherits:51,"readable-stream":83}],16:[function(t,e,r){},{}],17:[function(t,e,r){(function(e){(function(){"use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return a(t,e,r)}function a(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|p(t,e),n=o(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return h(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(U(t,ArrayBuffer)||t&&U(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=s.prototype,n}(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return s.from(n,e,r);var i=function(t){if(s.isBuffer(t)){var e=0|l(t.length),r=o(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(void 0!==t.length)return"number"!=typeof t.length||D(t.length)?o(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return c(t),o(t<0?0:0|l(t))}function h(t){for(var e=t.length<0?0:0|l(t.length),r=o(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function l(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||U(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return N(t).length;default:if(i)return n?-1:B(t).length;e=(""+e).toLowerCase(),i=!0}}function f(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),D(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:g(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,i){var o,s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===c)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var l=!0,p=0;p<c;p++)if(u(t,o+p)!==u(e,p)){l=!1;break}if(l)return o}return-1}function y(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(D(a))return s;t[r+s]=a}return s}function b(t,e,r,n){return q(B(e,t.length-r),t,r,n)}function m(t,e,r,n){return q(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function v(t,e,r,n){return m(t,e,r,n)}function _(t,e,r,n){return q(N(e),t,r,n)}function w(t,e,r,n){return q(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function C(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,c,u=t[i],h=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l<=r)switch(l){case 1:u<128&&(h=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(h=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(h=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(h=c)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}r.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(t,e,r){return a(t,e,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},s.allocUnsafe=function(t){return u(t)},s.allocUnsafeSlow=function(t){return u(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(U(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),U(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=s.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(U(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)f(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)f(this,e,e+3),f(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)f(this,e,e+7),f(this,e+1,e+6),f(this,e+2,e+5),f(this,e+3,e+4);return this},s.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?C(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},s.prototype.compare=function(t,e,r,n,i){if(U(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,c=Math.min(o,a),u=this.slice(n,i),h=t.slice(e,r),l=0;l<c;++l)if(u[l]!==h[l]){o=u[l],a=h[l];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return m(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function A(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=L(t[o]);return i}function j(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function x(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function I(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,i,o){return e=+e,r>>>=0,o||I(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function T(t,e,r,i,o){return e=+e,r>>>=0,o||I(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||x(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||x(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||x(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return T(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return T(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var o=i-1;o>=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=s.isBuffer(t)?t:s.from(t,n),c=a.length;if(0===c)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=a[o%c]}return this};var M=/[^+/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function N(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function U(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function D(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:50}],18:[function(t,e,r){"use strict";t("./shim");var n=t("./generic-collection"),i=t("./generic-map");function o(t,e){if(!(this instanceof o))return new o(t,e);e=e||Function.noop,this.getDefault=e,this.store=Object.create(null),this.length=0,this.addEach(t)}e.exports=o,o.Dict=o,Object.addEach(o.prototype,n.prototype),Object.addEach(o.prototype,i.prototype),o.from=n.from,o.prototype.constructClone=function(t){return new this.constructor(t,this.getDefault)},o.prototype.assertString=function(t){if("string"!=typeof t)throw new TypeError("key must be a string but Got "+t)},Object.defineProperty(o.prototype,"$__proto__",{writable:!0}),Object.defineProperty(o.prototype,"_hasProto",{get:function(){return this.hasOwnProperty("$__proto__")&&void 0!==this._protoValue}}),Object.defineProperty(o.prototype,"_protoValue",{get:function(){return this.$__proto__},set:function(t){this.$__proto__=t}}),Object.defineProperty(o.prototype,"size",n._sizePropertyDescriptor),o.prototype.get=function(t,e){return this.assertString(t),"__proto__"===t?this._hasProto?this._protoValue:arguments.length>1?e:this.getDefault(t):t in this.store?this.store[t]:arguments.length>1?e:this.getDefault(t)},o.prototype.set=function(t,e){this.assertString(t);var r="__proto__"===t;return(r?this._hasProto:t in this.store)?(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,r?this._protoValue:this.store[t]),r?this._protoValue=e:this.store[t]=e,this.dispatchesMapChanges&&this.dispatchMapChange(t,e),!1):(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,void 0),this.length++,r?this._protoValue=e:this.store[t]=e,this.dispatchesMapChanges&&this.dispatchMapChange(t,e),!0)},o.prototype.has=function(t){return this.assertString(t),"__proto__"===t?this._hasProto:t in this.store},o.prototype.delete=function(t){return this.assertString(t),"__proto__"===t?!!this._hasProto&&(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,this._protoValue),this._protoValue=void 0,this.length--,this.dispatchesMapChanges&&this.dispatchMapChange(t,void 0),!0):t in this.store&&(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,this.store[t]),delete this.store[t],this.length--,this.dispatchesMapChanges&&this.dispatchMapChange(t,void 0),!0)},o.prototype.clear=function(){var t;for(t in this._hasProto&&(this.dispatchesMapChanges&&this.dispatchBeforeMapChange("__proto__",this._protoValue),this._protoValue=void 0,this.dispatchesMapChanges&&this.dispatchMapChange("__proto__",void 0)),this.store)this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,this.store[t]),delete this.store[t],this.dispatchesMapChanges&&this.dispatchMapChange(t,void 0);this.length=0},o.prototype.reduce=function(t,e,r){this._hasProto&&(e=t.call(r,e,"$__proto__","__proto__",this));var n=this.store;for(var i in this.store)e=t.call(r,e,n[i],i,this);return e},o.prototype.reduceRight=function(t,e,r){var n=this,i=this.store;return e=Object.keys(this.store).reduceRight(function(e,o){return t.call(r,e,i[o],o,n)},e),this._hasProto?t.call(r,e,this._protoValue,"__proto__",n):e},o.prototype.one=function(){var t;for(t in this.store)return this.store[t];return this._protoValue},o.prototype.toJSON=function(){return this.toObject()}},{"./generic-collection":24,"./generic-map":25,"./shim":41}],19:[function(t,e,r){"use strict";t("./shim");var n=t("./_dict"),i=t("./_list"),o=t("./generic-collection"),s=t("./generic-set"),a=t("./tree-log");Object.prototype.hasOwnProperty;function c(t,e,r,n){if(!(this instanceof c))return new c(t,e,r,n);e=e||Object.equals,r=r||Object.hash,n=n||Function.noop,this.contentEquals=e,this.contentHash=r,this.getDefault=n;var i=this;this.buckets=new this.Buckets(null,function(){return new i.Bucket}),this.length=0,this.addEach(t)}e.exports=c,c.FastSet=c,Object.addEach(c.prototype,o.prototype),Object.addEach(c.prototype,s.prototype),c.from=o.from,c.prototype.Buckets=n,c.prototype.Bucket=i,c.prototype.constructClone=function(t){return new this.constructor(t,this.contentEquals,this.contentHash,this.getDefault)},c.prototype.has=function(t){var e=this.contentHash(t);return this.buckets.get(e).has(t)},c.prototype.get=function(t,e){if(e)throw new Error("FastSet#get does not support second argument: equals");var r=this.contentHash(t),n=this.buckets;return n.has(r)?n.get(r).get(t):this.getDefault(t)},c.prototype.delete=function(t,e){if(e)throw new Error("FastSet#delete does not support second argument: equals");var r=this.contentHash(t),n=this.buckets;if(n.has(r)){var i=n.get(r);if(i.delete(t))return this.length--,0===i.length&&n.delete(r),!0}return!1},c.prototype.clear=function(){this.buckets.clear(),this.length=0},c.prototype.add=function(t){var e=this.contentHash(t),r=this.buckets;return r.has(e)||r.set(e,new this.Bucket(null,this.contentEquals)),!r.get(e).has(t)&&(r.get(e).add(t),this.length++,!0)},c.prototype.reduce=function(t,e){var r=arguments[2],n=0;return this.buckets.reduce(function(e,i){return i.reduce(function(e,i){return t.call(r,e,i,n++,this)},e,this)},e,this)},c.prototype.one=function(){if(this.length>0)return this.buckets.one().one()},c.prototype.iterate=function(){return this.buckets.valuesArray().flatten().iterate()},c.prototype.log=function(t,e,r,n){t=t||a.unicodeSharp,e=e||this.logNode,r||(r=console.log,n=console),r=r.bind(n);for(var i,o,s,c,u=this.buckets,h=u.size,l=u.keys(),p=0;i=l.next().value;)p===h-1?(o=t.fromAbove,s=" "):0===p?(o=t.branchDown,s=t.strafe):(o=t.fromBoth,s=t.strafe),c=u.get(i),r.call(n,o+t.through+t.branchDown+" "+i),c.forEach(function(i,o){var a,u,h;o===c.head.prev?(a=t.fromAbove,u=" "):(a=t.fromBoth,u=t.strafe),e(o,function(e){h?r.call(n,s+" "+u+" "+e):(r.call(n,s+" "+a+t.through+t.through+e),h=!0)},function(e){r.call(n,s+" "+t.strafe+" "+e)})}),p++},c.prototype.logNode=function(t,e){var r=t.value;Object(r)===r?JSON.stringify(r,null,4).split("\n").forEach(function(t){e(" "+t)}):e(" "+r)}},{"./_dict":18,"./_list":20,"./generic-collection":24,"./generic-set":27,"./shim":41,"./tree-log":43}],20:[function(t,e,r){"use strict";e.exports=o;t("./shim");var n=t("./generic-collection"),i=t("./generic-order");function o(t,e,r){return o._init(o,this,t,e,r)}function s(t){this.head=t,this.at=t.next}function a(t){this.value=t,this.prev=null,this.next=null}o._init=function(t,e,r,n,i){if(!(e instanceof t))return new t(r,n,i);var o=e.head=new e.Node;o.next=o,o.prev=o,e.contentEquals=n||Object.equals,e.getDefault=i||Function.noop,e.length=0,e.addEach(r)},o.List=o,Object.addEach(o.prototype,n.prototype),Object.addEach(o.prototype,i.prototype),o.from=n.from,o.prototype.constructClone=function(t){return new this.constructor(t,this.contentEquals,this.getDefault)},o.prototype.find=function(t,e,r){e=e||this.contentEquals;for(var n=this.head,i=this.scan(r,n.next);i!==n;){if(e(i.value,t))return i;i=i.next}},o.prototype.findLast=function(t,e,r){e=e||this.contentEquals;for(var n=this.head,i=this.scan(r,n.prev);i!==n;){if(e(i.value,t))return i;i=i.prev}},o.prototype.has=function(t,e){return!!this.find(t,e)},o.prototype.get=function(t,e){var r=this.find(t,e);return r?r.value:this.getDefault(t)},o.prototype.delete=function(t,e){var r=this.findLast(t,e);return!!r&&(r.delete(),this.length--,!0)},o.prototype.deleteAll=function(t,e){e=e||this.contentEquals;for(var r=this.head,n=r.next,i=0;n!==r;)e(t,n.value)&&(n.delete(),i++),n=n.next;return this.length-=i,i},o.prototype.clear=function(){this.head.next=this.head.prev=this.head,this.length=0},o.prototype.add=function(t){var e=new this.Node(t);return this._addNode(e)},o.prototype._addNode=function(t){return this.head.addBefore(t),this.length++,!0},o.prototype.push=function(){for(var t=this.head,e=0;e<arguments.length;e++){var r=arguments[e],n=new this.Node(r);t.addBefore(n)}this.length+=arguments.length},o.prototype.unshift=function(){for(var t=this.head,e=0;e<arguments.length;e++){var r=arguments[e],n=new this.Node(r);t.addAfter(n),t=n}this.length+=arguments.length},o.prototype._shouldPop=function(){var t,e=this.head;return e.prev!==e&&(t=e.prev.value),t},o.prototype.pop=function(t,e){var r,n=this.head;if(n.prev!==n){r=n.prev.value;var i=this.length-1,o=t?t.call(this,r,i):void 0;n.prev.delete(),this.length--,e&&e.call(this,r,i,o)}return r},o.prototype.shift=function(t,e){var r,n=this.head;if(n.prev!==n){r=n.next.value;var i=t?t.call(this,r,0):void 0;n.next.delete(),this.length--,e&&e.call(this,r,0,i)}return r},o.prototype.peek=function(){if(this.head!==this.head.next)return this.head.next.value},o.prototype.poke=function(t){this.head!==this.head.next?this.head.next.value=t:this.push(t)},o.prototype.one=function(){return this.peek()},o.prototype.scan=function(t,e){var r=this.head;if("number"==typeof t){var n=t;if(n>=0)for(t=r.next;n&&(n--,(t=t.next)!=r););else for(t=r;n<0&&(n++,(t=t.prev)!=r););return t}return t||e},o.prototype.slice=function(t,e){var r=[],n=this.head;for(t=this.scan(t,n.next),e=this.scan(e,n);t!==e&&t!==n;)r.push(t.value),t=t.next;return r},o.prototype.splice=function(t,e){return this.swap(t,e,Array.prototype.slice.call(arguments,2))},o.prototype.swap=function(t,e,r,n,i){var o=t;t=this.scan(t,this.head),null==e&&(e=1/0),r=Array.from(r);for(var s=[],a=t;e--&&e>=0&&a!==this.head;)s.push(a.value),a=a.next;n&&n.call(this,t,r,s);a=t;var c=0;for(a=t;c<s.length;c++,a=a.next)a.delete();null==o&&a===this.head&&(a=this.head.next);for(c=0;c<r.length;c++){var u=new this.Node(r[c]);a.addBefore(u)}return this.length+=r.length-s.length,i&&i.call(this,t,r,s),s},o.prototype.reverse=function(){var t=this.head;do{var e=t.next;t.next=t.prev,t.prev=e,t=t.next}while(t!==this.head);return this},o.prototype.sort=function(){this.swap(0,this.length,this.sorted.apply(this,arguments))},o.prototype.reduce=function(t,e){for(var r=arguments[2],n=this.head,i=n.next;i!==n;)e=t.call(r,e,i.value,i,this),i=i.next;return e},o.prototype.reduceRight=function(t,e){for(var r=arguments[2],n=this.head,i=n.prev;i!==n;)e=t.call(r,e,i.value,i,this),i=i.prev;return e},o.prototype.updateIndexes=function(t,e){for(;t!==this.head;)t.index=e++,t=t.next},o.prototype.iterate=function(){return new s(this.head)},s.prototype.__iterationObject=null,Object.defineProperty(s.prototype,"_iterationObject",{get:function(){return this.__iterationObject||(this.__iterationObject={done:!1,value:null})}}),s.prototype.next=function(){if(this.at===this.head)this._iterationObject.done=!0,this._iterationObject.value=void 0;else{var t=this.at.value;this.at=this.at.next,this._iterationObject.value=t}return this._iterationObject},o.prototype.Node=a,a.prototype.delete=function(){this.prev.next=this.next,this.next.prev=this.prev},a.prototype.addBefore=function(t){var e=this.prev;this.prev=t,t.prev=e,e.next=t,t.next=this},a.prototype.addAfter=function(t){var e=this.next;this.next=t,t.next=e,e.prev=t,t.prev=this}},{"./generic-collection":24,"./generic-order":26,"./shim":41}],21:[function(t,e,r){(function(r){(function(){"use strict";t("./shim");var n,i,o,s=t("./generic-collection");if(void 0!==r.Map&&"function"==typeof r.Set.prototype.values){var a;i=n=e.exports=r.Map,n.Map=n,a={}.__proto__===Object.prototype?function(){this.__proto__=g}:function(){Object.defineProperties(this,observableSetProperties)},Object.defineProperty(n.prototype,"makeObservable",{value:a,writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(n.prototype,"makePropertyObservable",{value:function(){},writable:!0,configurable:!0,enumerable:!1}),n.prototype.constructClone=function(t){return new this.constructor(t)},n.prototype.isMap=!0,n.prototype.addEach=function(t){if(t&&Object(t)===t)if("function"==typeof t.forEach)!0===t.isMap?t.forEach(function(t,e){this.set(e,t)},this):t.forEach(function(t){this.set(t[0],t[1])},this);else if("number"==typeof t.length)for(var e=0;e<t.length;e++)this.add(t[e],e);else Object.keys(t).forEach(function(e){this.set(e,t[e])},this);else if(t&&"number"==typeof t.length)for(e=0;e<t.length;e++)this.add(t[e],e);return this},n.prototype.add=function(t,e){return this.set(e,t)},n.prototype.reduce=function(t,e){var r=arguments[2];return this.forEach(function(n,i,o){e=t.call(r,e,n,i,this)}),e},n.prototype.reduceRight=function(t,e){for(var r,n=arguments[2],i=this.keys(),o=this.size,s=new Array(this.size),a=0;r=i.next().value;)s[--o]=r;for(;a++<o;)e=t.call(n,e,this.get(s[a]),s[a],this);return e},n.prototype.equals=function(t,e){return e=e||Object.equals,this===t||(t&&"function"==typeof t.every?t.size===this.size&&t.every(function(t,r){return e(this.get(r),t)},this):Object.keys(t).length===this.size&&Object.keys(t).every(function(r){return e(this.get(r),t[r])},this))};var c=function(t,e){return e};n.prototype.keysArray=function(){return this.map(c)};var u=function(t,e){return t};n.prototype.valuesArray=function(){return this.map(u)};var h=function(t,e){return[e,t]};n.prototype.entriesArray=function(){return this.map(h)},n.prototype.toJSON=function(){return this.entriesArray()},n.prototype.items=function(){return this.entriesArray()},n.from=function(t){var e=new this;return e.addEach(t),e},Object.defineProperty(n.prototype,"length",{get:function(){return this.size},enumerable:!0,configurable:!0});var l=n.prototype.clear,p=n.prototype.set,f=n.prototype.delete,d={clear:{value:function(){var t;this.dispatchesMapChanges&&(this.forEach(function(t,e){this.dispatchBeforeMapChange(e,t)},this),t=this.keysArray()),l.call(this),this.dispatchesMapChanges&&t.forEach(function(t){this.dispatchMapChange(t)},this)},writable:!0,configurable:!0},set:{value:function(t,e){var r=this.get(t);return r?(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,r),p.call(this,t,e),this.dispatchesMapChanges&&this.dispatchMapChange(t,e)):(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,void 0),p.call(this,t,e),this.dispatchesMapChanges&&this.dispatchMapChange(t,e)),this},writable:!0,configurable:!0},delete:{value:function(t){return!!this.has(t)&&(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,this.get(t)),f.call(this,t),this.dispatchesMapChanges&&this.dispatchMapChange(t,void 0),!0)}}};Object.addEach(n.prototype,s.prototype,!1);var g=Object.create(n.prototype,d)}var y=t("./_set").CollectionsSet,b=t("./generic-map");o=n=function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);r=r||Object.equals,n=n||Object.hash,i=i||Function.noop,this.contentEquals=r,this.contentHash=n,this.getDefault=i,this.store=new y(void 0,function(t,e){return r(t.key,e.key)},function(t){return n(t.key)}),this.length=0,this.addEach(e)},n.Map=n,Object.addEach(n.prototype,s.prototype),Object.addEach(n.prototype,b.prototype),Object.defineProperty(n.prototype,"size",s._sizePropertyDescriptor),n.from=s.from,n.prototype.constructClone=function(t){return new this.constructor(t,this.contentEquals,this.contentHash,this.getDefault)},n.prototype.log=function(t,e,r,n){e=e||this.logNode,this.store.log(t,function(t,r,n){e(t.value.value,r,n)},r,n)},n.prototype.logNode=function(t,e){e(" key: "+t.key),e(" value: "+t.value)},i?(e.exports=i,i.CollectionsMap=o):e.exports=o}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_set":22,"./generic-collection":24,"./generic-map":25,"./shim":41}],22:[function(t,e,r){(function(r){(function(){"use strict";t("./shim");var n,i,o=t("./generic-collection"),s=t("./generic-set");void 0!==r.Set&&"function"==typeof r.Set.prototype.values&&((n=e.exports=r.Set).Set=n,n.prototype.reduce=function(t,e){var r=arguments[2];return this.forEach(function(n){e=t.call(r,e,n,this)}),e},n.prototype.reduceRight=function(t,e){for(var r,n=arguments[2],i=this.values(),o=this.size,s=new Array(this.size),a=o;r=i.next().value;)s[--a]=r;for(;a<o;)e=t.call(n,e,s[a++],this);return e},n.prototype.equals=function(t,e){var r=this;return t&&"function"==typeof t.reduce&&this.size===(t.size||t.length)&&t.reduce(function(t,n){return t&&r.has(n,e)},!0)},n.prototype.constructClone=function(t){return new this.constructor(t,this.contentEquals,this.contentHash,this.getDefault)},n.prototype.toJSON=function(){return this.entriesArray()},n.prototype.one=function(){if(this.size>0)return this.values().next().value},n.prototype.pop=function(){if(this.size){for(var t,e,r=this.values();t=r.next().value;)e=t;return this.delete(e,this.size-1),e}},n.prototype.shift=function(){if(this.size){var t=this.values().next().value;return this.delete(t,0),t}},Object.defineProperty(n.prototype,"length",{get:function(){return this.size},enumerable:!0,configurable:!0}),n.from=function(t){var e=new this;return e.addEach(t),e},Object.addEach(n.prototype,o.prototype,!1),Object.addEach(n.prototype,s.prototype,!1));var a=t("./_list"),c=t("./_fast-set"),u=t("./iterator");(i=function t(e,r,n,i){return t._init(t,this,e,r,n,i)})._init=function(t,e,r,n,i,o){if(!(e instanceof t))return new t(r,n,i,o);n=n||Object.equals,i=i||Object.hash,o=o||Function.noop,e.contentEquals=n,e.contentHash=i,e.getDefault=o,e.order=new e.Order(void 0,n),e.store=new e.Store(void 0,function(t,e){return n(t.value,e.value)},function(t){return i(t.value)}),e.length=0,e.addEach(r)},i.Set=i,i.CollectionsSet=i,Object.addEach(i.prototype,o.prototype),Object.addEach(i.prototype,s.prototype),i.from=o.from,Object.defineProperty(i.prototype,"size",o._sizePropertyDescriptor),i.prototype.Order=a,i.prototype.Store=c,i.prototype.constructClone=function(t){return new this.constructor(t,this.contentEquals,this.contentHash,this.getDefault)},i.prototype.has=function(t){var e=new this.order.Node(t);return this.store.has(e)},i.prototype.get=function(t,e){if(e)throw new Error("Set#get does not support second argument: equals");var r=new this.order.Node(t);return(r=this.store.get(r))?r.value:this.getDefault(t)},i.prototype.add=function(t){var e=new this.order.Node(t);if(!this.store.has(e)){this.length;return this.order.add(t),e=this.order.head.prev,this.store.add(e),this.length++,!0}return!1},i.prototype.delete=function(t,e){if(e)throw new Error("Set#delete does not support second argument: equals");var r=new this.order.Node(t);return!!this.store.has(r)&&(r=this.store.get(r),this.store.delete(r),this.order.splice(r,1),this.length--,!0)},i.prototype.pop=function(){if(this.length){var t=this.order.head.prev.value;return this.delete(t),t}},i.prototype.shift=function(){if(this.length){var t=this.order.head.next.value;return this.delete(t),t}},i.prototype.one=function(){if(this.length>0)return this.store.one().value},i.prototype.clear=function(){this.store.clear(),this.order.clear(),this.length=0},Object.defineProperty(i.prototype,"_clear",{value:i.prototype.clear}),i.prototype.reduce=function(t,e){var r=arguments[2],n=0;return this.order.reduce(function(e,i){return t.call(r,e,i,n++,this)},e,this)},i.prototype.reduceRight=function(t,e){var r=arguments[2],n=this.order,i=this.length-1;return n.reduceRight(function(e,n){return t.call(r,e,n,i--,this)},e,this)},i.prototype.iterate=function(){return this.order.iterate()},i.prototype.values=function(){return new u(this.valuesArray(),!0)},i.prototype.log=function(){var t=this.store;return t.log.apply(t,arguments)},n?(n.prototype.valuesArray=s.prototype.valuesArray,n.prototype.entriesArray=s.prototype.entriesArray,e.exports=n,n.CollectionsSet=i):e.exports=i}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_fast-set":19,"./_list":20,"./generic-collection":24,"./generic-set":27,"./iterator":28,"./shim":41}],23:[function(t,e,r){"use strict";t("./shim");var n=t("./_fast-set"),i=t("./listen/property-changes");e.exports=n,Object.addEach(n.prototype,i.prototype)},{"./_fast-set":19,"./listen/property-changes":32,"./shim":41}],24:[function(t,e,r){(function(r){(function(){"use strict";function n(){throw new Error("Can't construct. GenericCollection is a mixin.")}e.exports=n;var i=r.DOMTokenList||function(){};n.EmptyArray=Object.freeze([]),n.prototype.addEach=function(t,e,r){if(t&&(t instanceof Array||t instanceof i||t instanceof String))if(e)for(var n=0;n<t.length;n++)this.add(e.call(r,t[n]),n);else for(n=0;n<t.length;n++)this.add(t[n],n);else if(t&&Object(t)===t)if("function"==typeof t.forEach)e?t.map(e,r).forEach(this.add,this):t.forEach(this.add,this);else if("function"==typeof t.next){var o;n=0;if(e)for(;o=t.next().value;)this.add(e.call(r,o),n++);else for(;o=t.next().value;)this.add(o,n++)}else if("number"==typeof t.length)if(e)for(n=0;n<t.length;n++)this.add(e.call(r,t[n]),n);else for(n=0;n<t.length;n++)this.add(t[n],n);else e?Object.keys(t).forEach(function(n){this.add(e.call(r,t[n]),n)},this):Object.keys(t).forEach(function(e){this.add(t[e],e)},this);return this},n.prototype.deleteEach=function(t,e){return t.forEach(function(t){this.delete(t,e)},this),this},n.prototype.forEach=function(t){var e=arguments[1];return this.reduce(function(r,n,i,o,s){t.call(e,n,i,o,s)},void 0)},n.prototype.map=function(t){var e=arguments[1],r=[];return this.reduce(function(n,i,o,s,a){r.push(t.call(e,i,o,s,a))},void 0),r},n.prototype.enumerate=function(t){null==t&&(t=0);var e=[];return this.reduce(function(r,n){e.push([t++,n])},void 0),e},n.prototype.group=function(t,e,r){r=r||Object.equals;var n=[],i=[];return this.forEach(function(o,s,a){s=t.call(e,o,s,a);var c,u=i.indexOf(s,r);-1===u?(c=[],n.push([s,c]),i.push(s)):c=n[u][1],c.push(o)}),n},n.prototype.toArray=function(){return this.map(Function.identity)},n.prototype.toObject=function(){var t={};return this.reduce(function(e,r,n){t[n]=r},void 0),t},n.from=function(){return this.apply(this,arguments)},n.prototype.filter=function(t){var e=arguments[1],r=this.constructClone();return this.reduce(function(n,i,o,s,a){t.call(e,i,o,s,a)&&r.add(i,o)},void 0),r},n.prototype.every=function(t){var e=arguments[1];return this.reduce(function(r,n,i,o,s){return r&&t.call(e,n,i,o,s)},!0)},n.prototype.some=function(t){var e=arguments[1];return this.reduce(function(r,n,i,o,s){return r||t.call(e,n,i,o,s)},!1)},n.prototype.all=function(){return this.every(Boolean)},n.prototype.any=function(){return this.some(Boolean)},n.prototype.min=function(t){t=t||this.contentCompare||Object.compare;var e=!0;return this.reduce(function(r,n){return e?(e=!1,n):t(n,r)<0?n:r},void 0)},n.prototype.max=function(t){t=t||this.contentCompare||Object.compare;var e=!0;return this.reduce(function(r,n){return e?(e=!1,n):t(n,r)>0?n:r},void 0)},n.prototype.sum=function(t){return t=void 0===t?0:t,this.reduce(function(t,e){return t+e},t)},n.prototype.average=function(t){var e=void 0===t?0:t,r=void 0===t?0:t;return this.reduce(function(t,n){e+=n,r+=1},void 0),e/r},n.prototype.concat=function(){for(var t=this.constructClone(this),e=0;e<arguments.length;e++)t.addEach(arguments[e]);return t},n.prototype.flatten=function(){var t=this;return this.reduce(function(e,r){return r.forEach(function(t){this.push(t)},e,t),e},[])},n.prototype.zip=function(){var t=Array.prototype.slice.call(arguments);return t.unshift(this),Array.unzip(t)},n.prototype.join=function(t){return this.reduce(function(e,r){return void 0===e?r:e+t+r},void 0)},n.prototype.sorted=function(t,e,r){return(t=t||this.contentCompare||Object.compare).by?(e=t.by,t=t.compare||this.contentCompare||Object.compare):e=e||Function.identity,void 0===r&&(r=1),this.map(function(t){return{by:e(t),value:t}}).sort(function(e,n){return t(e.by,n.by)*r}).map(function(t){return t.value})},n.prototype.reversed=function(){return this.constructClone(this).reverse()},n.prototype.clone=function(t,e){if(void 0===t)t=1/0;else if(0===t)return this;var r=this.constructClone();return this.forEach(function(n,i){r.add(Object.clone(n,t-1,e),i)},this),r},n.prototype.only=function(){if(1===this.length)return this.one()},n.prototype.iterator=function(){return this.iterate.apply(this,arguments)},n._sizePropertyDescriptor={get:function(){return this.length},enumerable:!1,configurable:!0},Object.defineProperty(n.prototype,"size",n._sizePropertyDescriptor),t("./shim-array")}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./shim-array":37}],25:[function(t,e,r){"use strict";var n=t("./shim-object"),i=t("./iterator");function o(){throw new Error("Can't construct. GenericMap is a mixin.")}function s(t,e){this.key=t,this.value=e}e.exports=o,o.prototype.isMap=!0,o.prototype.addEach=function(t){var e;if(t&&n(t)===t)if("function"==typeof t.forEach)!0===t.isMap?t.forEach(function(t,e){this.set(e,t)},this):t.forEach(function(t){this.set(t[0],t[1])},this);else if("number"==typeof t.length)for(e=0;e<t.length;e++)this.add(t[e],e);else n.keys(t).forEach(function(e){this.set(e,t[e])},this);else if(t&&"number"==typeof t.length)for(e=0;e<t.length;e++)this.add(t[e],e);return this},o.prototype.get=function(t,e){var r=this.store.get(new this.Item(t));return r?r.value:arguments.length>1?(console.log("Use of a second argument as default value is deprecated to match standards"),e):this.getDefault(t)},o.prototype.set=function(t,e){var r=new this.Item(t,e),n=this.store.get(r);return n?(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,n.value),n.value=e,this.dispatchesMapChanges&&this.dispatchMapChange(t,e)):(this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,void 0),this.store.add(r)&&(this.length++,!0),this.dispatchesMapChanges&&this.dispatchMapChange(t,e)),this},o.prototype.add=function(t,e){return this.set(e,t)},o.prototype.has=function(t){return this.store.has(new this.Item(t))},o.prototype.delete=function(t){var e=new this.Item(t);if(this.store.has(e)){var r=this.store.get(e).value;return this.dispatchesMapChanges&&this.dispatchBeforeMapChange(t,r),this.store.delete(e),this.length--,this.dispatchesMapChanges&&this.dispatchMapChange(t,void 0),!0}return!1},o.prototype.clear=function(){var t,e;if(this.dispatchesMapChanges&&(this.forEach(function(t,e){this.dispatchBeforeMapChange(e,t)},this),t=this.keysArray()),this.store.clear(),this.length=0,this.dispatchesMapChanges)for(var r=0;e=t[r];r++)this.dispatchMapChange(e)},o.prototype.reduce=function(t,e,r){return this.store.reduce(function(e,n){return t.call(r,e,n.value,n.key,this)},e,this)},o.prototype.reduceRight=function(t,e,r){return this.store.reduceRight(function(e,n){return t.call(r,e,n.value,n.key,this)},e,this)},o.prototype.keysArray=function(){return this.map(function(t,e){return e})},o.prototype.keys=function(){return new i(this.keysArray(),!0)},o.prototype.valuesArray=function(){return this.map(Function.identity)},o.prototype.values=function(){return new i(this.valuesArray(),!0)},o.prototype.entriesArray=function(){return this.map(function(t,e){return[e,t]})},o.prototype.entries=function(){return new i(this.entriesArray(),!0)},o.prototype.items=function(){return this.entriesArray()},o.prototype.equals=function(t,e){return e=e||n.equals,this===t||(t&&"function"==typeof t.every?t.length===this.length&&t.every(function(t,r){return e(this.get(r),t)},this):n.keys(t).length===this.length&&n.keys(t).every(function(r){return e(this.get(r),t[r])},this))},o.prototype.toJSON=function(){return this.entriesArray()},o.prototype.Item=s,s.prototype.equals=function(t){return n.equals(this.key,t.key)&&n.equals(this.value,t.value)},s.prototype.compare=function(t){return n.compare(this.key,t.key)}},{"./iterator":28,"./shim-object":39}],26:[function(t,e,r){var n=t("./shim-object");function i(){throw new Error("Can't construct. GenericOrder is a mixin.")}e.exports=i,i.prototype.equals=function(t,e){if(e=e||this.contentEquals||n.equals,this===t)return!0;if(!t)return!1;return this.length===t.length&&this.zip(t).every(function(t){return e(t[0],t[1])})},i.prototype.compare=function(t,e){if(e=e||this.contentCompare||n.compare,this===t)return 0;if(!t)return 1;var r=Math.min(this.length,t.length),i=this.zip(t).reduce(function(t,n,i){return 0===t?i>=r?t:e(n[0],n[1]):t},0);return 0===i?this.length-t.length:i},i.prototype.toJSON=function(){return this.toArray()}},{"./shim-object":39}],27:[function(t,e,r){function n(){throw new Error("Can't construct. GenericSet is a mixin.")}e.exports=n,n.prototype.isSet=!0,n.prototype.union=function(t){var e=this.constructClone(this);return e.addEach(t),e},n.prototype.intersection=function(t){return this.constructClone(this.filter(function(e){return t.has(e)}))},n.prototype.difference=function(t){var e=this.constructClone(this);return e.deleteEach(t),e},n.prototype.symmetricDifference=function(t){var e=this.union(t),r=this.intersection(t);return e.difference(r)},n.prototype.deleteAll=function(t){return+this.delete(t)},n.prototype.equals=function(t,e){var r=this;return t&&"function"==typeof t.reduce&&this.length===t.length&&t.reduce(function(t,n){return t&&r.has(n,e)},!0)},n.prototype.forEach=function(t){var e=arguments[1];return this.reduce(function(r,n,i,o,s){t.call(e,n,n,o,s)},void 0)},n.prototype.toJSON=function(){return this.toArray()},n.prototype.contains=function(t){return this.has(t)},n.prototype.remove=function(t){return this.delete(t)},n.prototype.toggle=function(t){this.has(t)?this.delete(t):this.add(t)};var i=function(t,e){return t};n.prototype.valuesArray=function(){return this.map(i)};var o=function(t,e){return[e,t]};n.prototype.entriesArray=function(){return this.map(o)}},{}],28:[function(t,e,r){"use strict";e.exports=o;var n=t("./shim-object"),i=t("./generic-collection");function o(t,e){var r=e&&t&&t.values&&t.values();if(r&&"function"==typeof r.next)return r;if(!(this instanceof o))return new o(t);if(Array.isArray(t)||"string"==typeof t)return o.iterate(t);if((t=n(t))instanceof o)return t;if(t.next)this.next=function(){return t.next()};else if(t.iterate){var i=t.iterate();this.next=function(){return i.next()}}else{if("[object Function]"!==n.prototype.toString.call(t))throw new TypeError("Can't iterate "+t);this.next=t}}o.prototype.forEach=i.prototype.forEach,o.prototype.map=i.prototype.map,o.prototype.filter=i.prototype.filter,o.prototype.every=i.prototype.every,o.prototype.some=i.prototype.some,o.prototype.any=i.prototype.any,o.prototype.all=i.prototype.all,o.prototype.min=i.prototype.min,o.prototype.max=i.prototype.max,o.prototype.sum=i.prototype.sum,o.prototype.average=i.prototype.average,o.prototype.flatten=i.prototype.flatten,o.prototype.zip=i.prototype.zip,o.prototype.enumerate=i.prototype.enumerate,o.prototype.sorted=i.prototype.sorted,o.prototype.group=i.prototype.group,o.prototype.reversed=i.prototype.reversed,o.prototype.toArray=i.prototype.toArray,o.prototype.toObject=i.prototype.toObject,o.prototype.iterator=i.prototype.iterator,o.prototype.__iterationObject=null,n.defineProperty(o.prototype,"_iterationObject",{get:function(){return this.__iterationObject||(this.__iterationObject={done:!1,value:void 0})}}),o.prototype.constructClone=function(t){var e=[];return e.addEach(t),e},o.prototype.mapIterator=function(t){var e=o(this),r=arguments[1],i=0;if("[object Function]"!=n.prototype.toString.call(t))throw new TypeError;return new e.constructor(function(){if(!0!==e._iterationObject.done){var n=t.call(r,e.next().value,i++,e);e._iterationObject.value=n}return e._iterationObject})},o.prototype.filterIterator=function(t){var e=o(this),r=arguments[1],i=0;if("[object Function]"!=n.prototype.toString.call(t))throw new TypeError;return new e.constructor(function(){for(var n;;){if(!0===(n=e.next()).done)return n;if(t.call(r,n.value,i++,e))return n}})},o.prototype.reduce=function(t){var e,r=o(this),i=arguments[1],s=arguments[2],a=0;if("[object Function]"!=n.prototype.toString.call(t))throw new TypeError;if(!0===(e=r.next()).done){if(arguments.length>1)return arguments[1];throw TypeError("cannot reduce a value from an empty iterator with no initial value")}for(i=arguments.length>1?t.call(s,i,e.value,a,r):e.value,a++;;){if(!0===(e=r.next()).done)return i;i=t.call(s,i,e.value,a,r),a++}},o.prototype.concat=function(){return o.concat(Array.prototype.concat.apply(this,arguments))},o.prototype.dropWhile=function(t){var e,r,i=o(this),s=arguments[1],a=!1,c=0;if("[object Function]"!=n.prototype.toString.call(t))throw new TypeError;for(;!0!==(r=i.next()).done;){if(!t.call(s,r.value,c,i)){a=!0,e=r.value;break}c++}return a?i.constructor([e]).concat(i):i.constructor([])},o.prototype.takeWhile=function(t){var e=o(this),r=arguments[1],i=0;if("[object Function]"!=n.prototype.toString.call(t))throw new TypeError;return new e.constructor(function(){if(!0!==e._iterationObject.done){var n=e.next().value;t.call(r,n,i++,e)?e._iterationObject.value=n:(e._iterationObject.done=!0,e._iterationObject.value=void 0)}return e._iterationObject})},o.prototype.zipIterator=function(){return o.unzip(Array.prototype.concat.apply(this,arguments))},o.prototype.enumerateIterator=function(t){return o.count(t).zipIterator(this)},o.iterate=function(t){var e;return e=0,new o(function(){if("object"==typeof t)for(;!(e in t);){if(e>=t.length){this._iterationObject.done=!0,this._iterationObject.value=void 0;break}e+=1}else e>=t.length&&(this._iterationObject.done=!0,this._iterationObject.value=void 0);return this._iterationObject.done||(this._iterationObject.value=t[e],e+=1),this._iterationObject})},o.cycle=function(t,e){var r;return arguments.length<2&&(e=1/0),new o(function(){var n,i;return r&&(i=r()),r&&!0!==i.done||(e>0?(e--,n=o.iterate(t),i=(r=n.next.bind(n))()):(this._iterationObject.done=!0,i=this._iterationObject)),i})},o.concat=function(t){var e;return t=o(t),new o(function(){var r,n;return e&&(n=e()),n&&!0!==n.done?n:!1===(n=t.next()).done?(r=o(n.value),(e=r.next.bind(r))()):n})},o.unzip=function(t){return 0===(t=o(t).map(o)).length?new o([]):new o(function(){var e,r,n=t.map(function(t){return!0===(r=t.next()).done&&(e=!0),r.value});return e?(this._iterationObject.done=!0,this._iterationObject.value=void 0):this._iterationObject.value=n,this._iterationObject})},o.zip=function(){return o.unzip(Array.prototype.slice.call(arguments))},o.chain=function(){return o.concat(Array.prototype.slice.call(arguments))},o.range=function(t,e,r){return arguments.length<3&&(r=1),arguments.length<2&&(e=t,t=0),t=t||0,r=r||1,new o(function(){t>=e&&(this._iterationObject.done=!0,this._iterationObject.value=void 0);var n=t;return t+=r,this._iterationObject.value=n,this._iterationObject})},o.count=function(t,e){return o.range(t,1/0,e)},o.repeat=function(t,e){return new o.range(e).mapIterator(function(){return t})}},{"./generic-collection":24,"./shim-object":39}],29:[function(t,e,r){"use strict";var n=t("./_list"),i=t("./listen/property-changes"),o=t("./listen/range-changes");function s(t,e,r){return n._init(s,this,t,e,r)}e.exports=s,s.prototype=new n,s.prototype.constructor=s,s.List=s,s.from=n.from,Object.addEach(s.prototype,i.prototype),Object.addEach(s.prototype,o.prototype),s.prototype.makeObservable=function(){this.head.index=-1,this.updateIndexes(this.head.next,0),this.dispatchesRangeChanges=!0},Object.defineProperties(s.prototype,{_dispatchEmptyArray:{value:[]}}),s.prototype.delete=function(t,e){var r=this.findLast(t,e);if(r){if(this.dispatchesRangeChanges){var n=[],i=[t];this.dispatchBeforeRangeChange(n,i,r.index)}return r.delete(),this.length--,this.dispatchesRangeChanges&&(this.updateIndexes(r.next,r.index),this.dispatchRangeChange(n,i,r.index)),!0}return!1},Object.defineProperty(s.prototype,"superClear",{value:n.prototype.clear,enumerable:!1,configurable:!0,writable:!0}),s.prototype.clear=function(){var t,e;this.dispatchesRangeChanges&&(e=this.toArray(),t=[],this.dispatchBeforeRangeChange(t,e,0)),this.superClear(),this.dispatchesRangeChanges&&this.dispatchRangeChange(t,e,0)},s.prototype.add=function(t){var e=new this.Node(t);return this.dispatchesRangeChanges&&(e.index=this.length,this.dispatchBeforeRangeChange([t],[],e.index)),this._addNode(e),this.dispatchesRangeChanges&&this.dispatchRangeChange([t],[],e.index),!0},Object.defineProperty(s.prototype,"superPush",{value:n.prototype.push,enumerable:!1,configurable:!0,writable:!0}),s.prototype.push=function(){if(this.dispatchesRangeChanges){var t=Array.prototype.slice.call(arguments),e=[],r=this.length;this.dispatchBeforeRangeChange(t,e,r);var n=this.head.prev}1===arguments.length?this.superPush.call(this,arguments[0]):2===arguments.length?this.superPush.call(this,arguments[0],arguments[1]):this.superPush.apply(this,arguments),this.dispatchesRangeChanges&&(this.updateIndexes(n.next,void 0===n.index?0:n.index+1),this.dispatchRangeChange(t,e,r))},Object.defineProperty(s.prototype,"superUnshift",{value:n.prototype.unshift,enumerable:!1,configurable:!0,writable:!0}),s.prototype.unshift=function(){if(this.dispatchesRangeChanges){var t=Array.prototype.slice.call(arguments),e=[];this.dispatchBeforeRangeChange(t,e,0)}1===arguments.length?this.superUnshift.call(this,arguments[0]):2===arguments.length?this.superUnshift.call(this,arguments[0],arguments[1]):this.superUnshift.apply(this,arguments),this.dispatchesRangeChanges&&(this.updateIndexes(this.head.next,0),this.dispatchRangeChange(t,e,0))},Object.defineProperty(s.prototype,"_beforePop",{value:function(t,e){var r;return this.dispatchesRangeChanges&&(r=[t],this.dispatchBeforeRangeChange(this._dispatchEmptyArray,r,e)),r},enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(s.prototype,"_afterPop",{value:function(t,e,r){this.dispatchesRangeChanges&&this.dispatchRangeChange(this._dispatchEmptyArray,r,e)},enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(s.prototype,"superPop",{value:n.prototype.pop,enumerable:!1,configurable:!0,writable:!0}),s.prototype.pop=function(){return this.superPop(this._beforePop,this._afterPop)},Object.defineProperty(s.prototype,"_beforeShift",{value:function(t,e){var r;return this.dispatchesRangeChanges&&(r=[t],this.dispatchBeforeRangeChange(this._dispatchEmptyArray,r,e)),r},enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(s.prototype,"_afterShift",{value:function(t,e,r){this.dispatchesRangeChanges&&(this.updateIndexes(this.head.next,e),this.dispatchRangeChange(this._dispatchEmptyArray,r,e))},enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(s.prototype,"superShift",{value:n.prototype.shift,enumerable:!1,configurable:!0,writable:!0}),s.prototype.shift=function(){return this.superShift(this._beforeShift,this._afterShift)},Object.defineProperty(s.prototype,"superSwap",{value:n.prototype.swap,enumerable:!1,configurable:!0,writable:!0}),s.prototype.swap=function(t,e,r){var n,i;return this.superSwap(t,e,r,function(t,e,r){this.dispatchesRangeChanges&&(n=t===this.head?this.length:t.prev===this.head?0:t.index,i=t.prev,this.dispatchBeforeRangeChange(e,r,n))},function(t,e,r){this.dispatchesRangeChanges&&(t===this.head?this.updateIndexes(this.head.next,0):this.updateIndexes(i.next,i.index+1),this.dispatchRangeChange(e,r,n))})},Object.defineProperty(s.prototype,"superReverse",{value:n.prototype.reverse,enumerable:!1,configurable:!0,writable:!0}),s.prototype.reverse=function(){if(this.dispatchesRangeChanges){var t=this.toArray(),e=t.reversed();this.dispatchBeforeRangeChange(e,t,0)}return this.superReverse(),this.dispatchesRangeChanges&&this.dispatchRangeChange(e,t,0),this}},{"./_list":20,"./listen/property-changes":32,"./listen/range-changes":33}],30:[function(t,e,r){var n=t("../_map"),i=e.exports.ObjectChangeDescriptor=function(t){return this.name=t,this.isActive=!1,this._willChangeListeners=null,this._changeListeners=null,this};Object.defineProperties(i.prototype,{name:{value:null,writable:!0},isActive:{value:!1,writable:!0},_willChangeListeners:{value:null,writable:!0},willChangeListeners:{get:function(){return this._willChangeListeners||(this._willChangeListeners=new this.willChangeListenersRecordConstructor(this.name))}},_changeListeners:{value:null,writable:!0},changeListeners:{get:function(){return this._changeListeners||(this._changeListeners=new this.changeListenersRecordConstructor(this.name))}},changeListenersRecordConstructor:{value:a,writable:!0},willChangeListenersRecordConstructor:{value:u,writable:!0}});var o=e.exports.ListenerGhost=Object.create(null),s=new n;function a(t){var e=s.get(t);return e||(e="handle",e+=t,e+="Change",s.set(t,e)),this._current=null,this._current=null,this.specificHandlerMethodName=e,this}e.exports.ChangeListenersRecord=a,Object.defineProperties(a.prototype,{_current:{value:null,writable:!0},current:{get:function(){return this._current},set:function(t){this._current=t}},ListenerGhost:{value:o,writable:!0},ghostCount:{value:0,writable:!0},maxListenerGhostRatio:{value:.3,writable:!0},listenerGhostFilter:{value:function(t){return t!==this.ListenerGhost}},removeCurrentGostListenersIfNeeded:{value:function(){return this._current&&this.ghostCount/this._current.length>this.maxListenerGhostRatio&&(this.ghostCount=0,this._current=this._current.filter(this.listenerGhostFilter,this)),this._current}},dispatchBeforeChange:{value:!1,writable:!0},genericHandlerMethodName:{value:"handlePropertyChange",writable:!0}}),e.exports.WillChangeListenersRecord=u;var c=new n;function u(t){var e=c.get(t);return e||(e="handle",e+=t,e+="WillChange",c.set(t,e)),this.specificHandlerMethodName=e,this}u.prototype=new a,u.prototype.constructor=u,u.prototype.genericHandlerMethodName="handlePropertyWillChange"},{"../_map":21}],31:[function(t,e,r){"use strict";var n=t("../weak-map"),i=t("../_map"),o=t("./change-descriptor"),s=o.ObjectChangeDescriptor,a=o.ChangeListenersRecord,c=o.ListenerGhost;function u(){throw new Error("Can't construct. MapChanges is a mixin.")}e.exports=u;Object.prototype.hasOwnProperty;var h=new n;function l(t){this.name=t,this.isActive=!1,this._willChangeListeners=null,this._changeListeners=null}l.prototype=new s,l.prototype.constructor=l,l.prototype.changeListenersRecordConstructor=f,l.prototype.willChangeListenersRecordConstructor=g;var p=new i;function f(t){var e=p.get(t);return e||(e="handle",e+=t.slice(0,1).toUpperCase(),e+=t.slice(1),e+="MapChange",p.set(t,e)),this.specificHandlerMethodName=e,this}f.prototype=new a,f.prototype.constructor=f,f.prototype.genericHandlerMethodName="handleMapChange";var d=new i;function g(t){var e=d.get(t);return e||(e="handle",e+=t.slice(0,1).toUpperCase(),e+=t.slice(1),e+="MapWillChange",d.set(t,e)),this.specificHandlerMethodName=e,this}g.prototype=new a,g.prototype.constructor=g,g.prototype.genericHandlerMethodName="handleMapWillChange",u.prototype.getAllMapChangeDescriptors=function(){return h.has(this)||h.set(this,new i),h.get(this)},u.prototype.getMapChangeDescriptor=function(t){var e=this.getAllMapChangeDescriptors();return t=t||"",e.has(t)||e.set(t,new l(t)),e.get(t)};var y=new n,b={get:function(){return y.get(this)},set:function(t){return y.set(this,t)},configurable:!0,enumerable:!1};u.prototype.addMapChangeListener=function(t,e,r){!this.isObservable&&this.makeObservable&&this.makeObservable();var n,i=this.getMapChangeDescriptor(e);(n=r?i.willChangeListeners:i.changeListeners)._current?Array.isArray(n._current)?n._current.push(t):n._current=[n._current,t]:n._current=t,void 0===Object.getOwnPropertyDescriptor(this.__proto__||Object.getPrototypeOf(this),"dispatchesMapChanges")&&Object.defineProperty(this.__proto__||Object.getPrototypeOf(this),"dispatchesMapChanges",b),this.dispatchesMapChanges=!0;var o=this;return function(){o&&(o.removeMapChangeListener(t,e,r),o=null)}},u.prototype.removeMapChangeListener=function(t,e,r){var n,i=this.getMapChangeDescriptor(e);if((n=r?i.willChangeListeners:i.changeListeners)._current)if(n._current===t)n._current=null;else{var o=n._current.lastIndexOf(t);if(-1===o)throw new Error("Can't remove map change listener: does not exist: token "+JSON.stringify(e));i.isActive?(n.ghostCount=n.ghostCount+1,n._current[o]=c):n._current.spliceOne(o)}},u.prototype.dispatchMapChange=function(t,e,r){var n=this.getAllMapChangeDescriptors(),i=c;n.forEach(function(n,o){if(!n.isActive){var s=r?n.willChangeListeners:n.changeListeners;if(s&&s._current){var a=s.specificHandlerMethodName;if(Array.isArray(s._current)){if(s._current.length){var c,u,h,l=s.removeCurrentGostListenersIfNeeded();n.isActive=!0;try{for(c=0,u=l.length;c<u;c++)if((h=l[c])!==i)if(h[a])h[a](e,t,this);else{if(!h.call)throw new Error("Handler "+h+" has no method "+a+" and is not callable");h.call(h,e,t,this)}}finally{n.isActive=!1}}}else{n.isActive=!0;try{if((h=s._current)[a])h[a](e,t,this);else{if(!h.call)throw new Error("Handler "+h+" has no method "+a+" and is not callable");h.call(h,e,t,this)}}finally{n.isActive=!1}}}}},this)},u.prototype.addBeforeMapChangeListener=function(t,e){return this.addMapChangeListener(t,e,!0)},u.prototype.removeBeforeMapChangeListener=function(t,e){return this.removeMapChangeListener(t,e,!0)},u.prototype.dispatchBeforeMapChange=function(t,e){return this.dispatchMapChange(t,e,!0)}},{"../_map":21,"../weak-map":44,"./change-descriptor":30}],32:[function(t,e,r){Object.prototype.hasOwnProperty;function n(){throw new Error("This is an abstract interface. Mix it. Don't construct it")}e.exports=n,t("../shim");var i=t("../_map"),o=t("../weak-map"),s=t("./change-descriptor"),a=s.ObjectChangeDescriptor,c=s.ListenerGhost;n.debug=!0;var u=new o,h=new i;function l(t,e,r,n){if(t&&t._current){var i,o,s,a,u,h=t.specificHandlerMethodName,l=t.genericHandlerMethodName,p=c;if(Array.isArray(t._current)){for(s=0,a=(i=t.removeCurrentGostListenersIfNeeded()).length;s<a;s++)if((u=i[s])!==p){if(!(o=u[h]||u[l]||u).call)throw new Error("No event listener for "+t.specificHandlerName+" or "+t.genericHandlerName+" or call on "+o);o.call(u,r,e,n)}}else{if(!(o=(u=t._current)[h]||u[l]||u).call)throw new Error("No event listener for "+t.specificHandlerName+" or "+t.genericHandlerName+" or call on "+o);o.call(u,r,e,n)}}}n.ObjectChangeDescriptor=function(){},n.prototype.getOwnPropertyChangeDescriptor=function(t){var e,r=u.get(this);if(r||(r=Object.create(null),u.set(this,r)),void 0===(e=r[t])){var n=h.get(t);return n||(n=(n=String(t))&&n[0].toUpperCase()+n.slice(1),h.set(t,n)),r[t]=new a(n)}return e},n.prototype.hasOwnPropertyChangeDescriptor=function(t){var e=u.get(this);return!!e&&(!t||void 0!==e[t])},n.prototype.addOwnPropertyChangeListener=function(t,e,r){this.makeObservable&&!this.isObservable&&this.makeObservable();var i=n.getOwnPropertyChangeDescriptor(this,t),o=r?i.willChangeListeners:i.changeListeners;n.makePropertyObservable(this,t),o._current?Array.isArray(o._current)?o._current.push(e):o._current=[o._current,e]:o._current=e;var s=this;return function(){n.removeOwnPropertyChangeListener(s,t,e,r),s=null}},n.prototype.addBeforeOwnPropertyChangeListener=function(t,e){return n.addOwnPropertyChangeListener(this,t,e,!0)},n.prototype.removeOwnPropertyChangeListener=function t(e,r,i){var o,s=n.getOwnPropertyChangeDescriptor(this,e);if((o=i?s._willChangeListeners:s._changeListeners)&&o._current)if(o._current===r)o._current=null;else{var a=o._current.lastIndexOf(r);if(-1===a)throw new Error("Can't remove property change listener: does not exist: property name"+JSON.stringify(e));s.isActive?(o.ghostCount=o.ghostCount+1,o._current[a]=t.ListenerGhost):o._current.spliceOne(a)}},n.prototype.removeOwnPropertyChangeListener.ListenerGhost=c,n.prototype.removeBeforeOwnPropertyChangeListener=function(t,e){return n.removeOwnPropertyChangeListener(this,t,e,!0)},n.prototype.dispatchOwnPropertyChange=function t(e,r,i){var o,s=n.getOwnPropertyChangeDescriptor(this,e);if(!s.isActive){s.isActive=!0,o=i?s._willChangeListeners:s._changeListeners;try{t.dispatchEach(o,e,r,this)}finally{s.isActive=!1}}},n.prototype.dispatchOwnPropertyChange.dispatchEach=l,l.ListenerGhost=c,n.prototype.dispatchBeforeOwnPropertyChange=function(t,e){return n.dispatchOwnPropertyChange(this,t,e,!0)};var p=new o,f=(new o,{get:void 0,set:void 0,configurable:!0,enumerable:!1});n.prototype.makePropertyObservable=function(t){var e=p.get(this);if(!e||void 0===e.get(t)){if(!e){if(Array.isArray(this))return;if(!Object.isExtensible(this))throw new Error("Can't make property "+JSON.stringify(t)+" observable on "+this+" because object is not extensible");e=new i,p.set(this,e)}var r,n=this;do{if(r=Object.getOwnPropertyDescriptor(n,t))break;n=Object.getPrototypeOf(n)}while(n);if(r){if(!r.configurable)return;if(!r.writable&&!r.set)return}else r={value:void 0,enumerable:!0,writable:!0,configurable:!0};e.set(t,r),"value"in r?(f.get=function t(){return t.overriddenDescriptor.value},f.set=function t(e){var r,n,i=t.overriddenDescriptor;if(e!==i.value){if(!(n=(r=t.descriptor).isActive)){r.isActive=!0;try{t.dispatchEach(r._willChangeListeners,t.key,i.value,this)}finally{}}if(i.value=e,!n)try{t.dispatchEach(r._changeListeners,t.key,e,this)}finally{r.isActive=!1}}},f.set.dispatchEach=l,f.set.key=t,f.get.overriddenDescriptor=f.set.overriddenDescriptor=r,f.set.descriptor=u.get(this)[t],f.enumerable=r.enumerable,f.configurable=!0):(f.get=r.get,f.set=function e(){var r,n,i,o=e.overriddenGetter.call(this);if(1===arguments.length?e.overriddenSetter.call(this,arguments[0]):2===arguments.length?e.overriddenSetter.call(this,arguments[0],arguments[1]):e.overriddenSetter.apply(this,arguments),(i=e.overriddenGetter.call(this))!==o){if(!(n=(r=e.descriptor).isActive)){r.isActive=!0;try{e.dispatchEach(r._willChangeListeners,t,o,this)}finally{}}if(!n)try{e.dispatchEach(r._changeListeners,t,i,this)}finally{r.isActive=!1}}},f.enumerable=r.enumerable,f.configurable=!0,f.set.dispatchEach=l,f.set.overriddenSetter=r.set,f.set.overriddenGetter=r.get,f.set.descriptor=u.get(this)[t]),Object.defineProperty(this,t,f)}},n.getOwnPropertyChangeDescriptor=function(t,e){return t.getOwnPropertyChangeDescriptor?t.getOwnPropertyChangeDescriptor(e):n.prototype.getOwnPropertyChangeDescriptor.call(t,e)},n.hasOwnPropertyChangeDescriptor=function(t,e){return t.hasOwnPropertyChangeDescriptor?t.hasOwnPropertyChangeDescriptor(e):n.prototype.hasOwnPropertyChangeDescriptor.call(t,e)},n.addOwnPropertyChangeListener=function(t,e,r,n){if(Object.isObject(t))return t.addOwnPropertyChangeListener?t.addOwnPropertyChangeListener(e,r,n):this.prototype.addOwnPropertyChangeListener.call(t,e,r,n)},n.removeOwnPropertyChangeListener=function(t,e,r,i){if(Object.isObject(t))return t.removeOwnPropertyChangeListener?t.removeOwnPropertyChangeListener(e,r,i):n.prototype.removeOwnPropertyChangeListener.call(t,e,r,i)},n.dispatchOwnPropertyChange=function(t,e,r,i){if(Object.isObject(t))return t.dispatchOwnPropertyChange?t.dispatchOwnPropertyChange(e,r,i):n.prototype.dispatchOwnPropertyChange.call(t,e,r,i)},n.addBeforeOwnPropertyChangeListener=function(t,e,r){return n.addOwnPropertyChangeListener(t,e,r,!0)},n.removeBeforeOwnPropertyChangeListener=function(t,e,r){return n.removeOwnPropertyChangeListener(t,e,r,!0)},n.dispatchBeforeOwnPropertyChange=function(t,e,r){return n.dispatchOwnPropertyChange(t,e,r,!0)},n.makePropertyObservable=function(t,e){return t.makePropertyObservable?t.makePropertyObservable(e):n.prototype.makePropertyObservable.call(t,e)}},{"../_map":21,"../shim":41,"../weak-map":44,"./change-descriptor":30}],33:[function(t,e,r){"use strict";var n=t("../weak-map"),i=t("../_map"),o=t("./change-descriptor"),s=o.ObjectChangeDescriptor,a=o.ChangeListenersRecord,c=o.ListenerGhost,u=new n;function h(t){this.name=t,this.isActive=!1,this._willChangeListeners=null,this._changeListeners=null}h.prototype=new s,h.prototype.constructor=h,h.prototype.changeListenersRecordConstructor=p,h.prototype.willChangeListenersRecordConstructor=d,Object.defineProperty(h.prototype,"active",{get:function(){return this._active||(this._active=this._current?this._current.slice():[])}});var l=new i;function p(t){var e=l.get(t);return e||(e="handle",e+=t.slice(0,1).toUpperCase(),e+=t.slice(1),e+="RangeChange",l.set(t,e)),this.specificHandlerMethodName=e,this}p.prototype=new a,p.prototype.constructor=p;var f=new i;function d(t){var e=f.get(t);return e||(e="handle",e+=t.slice(0,1).toUpperCase(),e+=t.slice(1),e+="RangeWillChange",f.set(t,e)),this.specificHandlerMethodName=e,this}function g(){throw new Error("Can't construct. RangeChanges is a mixin.")}d.prototype=new a,d.prototype.constructor=d,e.exports=g,g.prototype.getAllRangeChangeDescriptors=function(){return u.has(this)||u.set(this,new i),u.get(this)},g.prototype.getRangeChangeDescriptor=function(t){var e=this.getAllRangeChangeDescriptors();return t=t||"",e.has(t)||e.set(t,new h(t)),e.get(t)};var y=new n,b={get:function(){return y.get(this)},set:function(t){return y.set(this,t)},configurable:!0,enumerable:!1};g.prototype.addRangeChangeListener=function(t,e,r){!this.isObservable&&this.makeObservable&&this.makeObservable();var n,i=this.getRangeChangeDescriptor(e);(n=r?i.willChangeListeners:i.changeListeners)._current?Array.isArray(n._current)?n._current.push(t):n._current=[n._current,t]:n._current=t,void 0===Object.getOwnPropertyDescriptor(this.__proto__||Object.getPrototypeOf(this),"dispatchesRangeChanges")&&Object.defineProperty(this.__proto__||Object.getPrototypeOf(this),"dispatchesRangeChanges",b),this.dispatchesRangeChanges=!0;var o=this;return function(){o&&(o.removeRangeChangeListener(t,e,r),o=null)}},g.prototype.removeRangeChangeListener=function(t,e,r){var n,i=this.getRangeChangeDescriptor(e);if((n=r?i._willChangeListeners:i._changeListeners)._current)if(n._current===t)n._current=null;else{var o=n._current.lastIndexOf(t);if(-1===o)throw new Error("Can't remove range change listener: does not exist: token "+JSON.stringify(e));i.isActive?(n.ghostCount=n.ghostCount+1,n._current[o]=c):n._current.spliceOne(o)}},g.prototype.dispatchRangeChange=function(t,e,r,n){var i,o,s,a,u,h,l,p,f=this.getAllRangeChangeDescriptors(),d=f.values();for(f.dispatchBeforeChange=n;i=d.next().value;){if(i.isActive)return;if((o=n?i._willChangeListeners:i._changeListeners)&&o._current)if(s=o.specificHandlerMethodName,Array.isArray(o._current)){if(o._current.length){i.isActive=!0;try{for(l=o.removeCurrentGostListenersIfNeeded(),p=c,a=0,u=l.length;a<u;a++)if((h=l[a])!==p)if(h[s])h[s](t,e,r,this,n);else{if(!h.call)throw new Error("Handler "+h+" has no method "+s+" and is not callable");h.call(this,t,e,r,this,n)}}finally{i.isActive=!1}}}else{i.isActive=!0;try{if((h=o._current)[s])h[s](t,e,r,this,n);else{if(!h.call)throw new Error("Handler "+h+" has no method "+s+" and is not callable");h.call(this,t,e,r,this,n)}}finally{i.isActive=!1}}}},g.prototype.addBeforeRangeChangeListener=function(t,e){return this.addRangeChangeListener(t,e,!0)},g.prototype.removeBeforeRangeChangeListener=function(t,e){return this.removeRangeChangeListener(t,e,!0)},g.prototype.dispatchBeforeRangeChange=function(t,e,r){return this.dispatchRangeChange(t,e,r,!0)}},{"../_map":21,"../weak-map":44,"./change-descriptor":30}],34:[function(t,e,r){"use strict";t("./shim");var n=t("./lru-set"),i=t("./generic-collection"),o=t("./generic-map"),s=t("./listen/property-changes"),a=t("./listen/map-changes");function c(t,e,r,i,o){if(!(this instanceof c))return new c(t,e,r,i,o);r=r||Object.equals,i=i||Object.hash,o=o||Function.noop,this.contentEquals=r,this.contentHash=i,this.getDefault=o,this.store=new n(void 0,e,function(t,e){return r(t.key,e.key)},function(t){return i(t.key)}),this.length=0,this.addEach(t)}e.exports=c,c.LruMap=c,Object.addEach(c.prototype,i.prototype),Object.addEach(c.prototype,o.prototype),Object.addEach(c.prototype,s.prototype),Object.addEach(c.prototype,a.prototype),Object.defineProperty(c.prototype,"size",i._sizePropertyDescriptor),c.from=i.from,c.prototype.constructClone=function(t){return new this.constructor(t,this.maxLength,this.contentEquals,this.contentHash,this.getDefault)},c.prototype.log=function(t,e){e=e||this.stringify,this.store.log(t,e)},c.prototype.stringify=function(t,e){return e+JSON.stringify(t.key)+": "+JSON.stringify(t.value)},c.prototype.addMapChangeListener=function(){if(!this.dispatchesMapChanges){var t=this;this.store.addBeforeRangeChangeListener(function(e,r){e.length&&r.length&&t.dispatchBeforeMapChange(r[0].key,void 0)}),this.store.addRangeChangeListener(function(e,r){e.length&&r.length&&t.dispatchMapChange(r[0].key,void 0)})}a.prototype.addMapChangeListener.apply(this,arguments)}},{"./generic-collection":24,"./generic-map":25,"./listen/map-changes":31,"./listen/property-changes":32,"./lru-set":35,"./shim":41}],35:[function(t,e,r){"use strict";t("./shim");var n=t("./set").CollectionsSet,i=t("./generic-collection"),o=t("./generic-set"),s=t("./listen/property-changes"),a=t("./listen/range-changes");function c(t,e,r,i,o){if(!(this instanceof c))return new c(t,e,r,i,o);e=e||1/0,r=r||Object.equals,i=i||Object.hash,o=o||Function.noop,this.store=new n(void 0,r,i),this.contentEquals=r,this.contentHash=i,this.getDefault=o,this.capacity=e,this.length=0,this.addEach(t)}e.exports=c,c.LruSet=c,Object.addEach(c.prototype,i.prototype),Object.addEach(c.prototype,o.prototype),Object.addEach(c.prototype,s.prototype),Object.addEach(c.prototype,a.prototype),Object.defineProperty(c.prototype,"size",i._sizePropertyDescriptor),c.from=i.from,c.prototype.constructClone=function(t){return new this.constructor(t,this.capacity,this.contentEquals,this.contentHash,this.getDefault)},c.prototype.has=function(t){return this.store.has(t)},c.prototype.get=function(t,e){if(e)throw new Error("LruSet#get does not support second argument: equals");return void 0!==(t=this.store.get(t))?(this.store.delete(t),this.store.add(t)):t=this.getDefault(t),t},c.prototype.add=function(t){var e,r=[],n=[];return this.store.has(t)?(this.store.delete(t),this.store.add(t)):this.capacity>0&&(r.push(t),this.length>=this.capacity&&(e=this.store.order.head.next,n.push(e.value)),this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange(r,n,0),this.store.add(t),n.length>0&&this.store.delete(e.value),this.length=this.length+r.length-n.length,this.dispatchesRangeChanges&&this.dispatchRangeChange(r,n,0)),r.length!==n.length},c.prototype.delete=function(t,e){if(e)throw new Error("LruSet#delete does not support second argument: equals");var r=this.store.has(t);return r&&(this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange([],[t],0),this.store.delete(t),this.length--,this.dispatchesRangeChanges&&this.dispatchRangeChange([],[t],0)),r},c.prototype.one=function(){if(this.length>0)return this.store.one()},c.prototype.clear=function(){this.store.clear(),this.length=0},c.prototype.reduce=function(t,e){var r=arguments[2],n=0;return this.store.reduce(function(e,i){return t.call(r,e,i,n++,this)},e,this)},c.prototype.reduceRight=function(t,e){var r=arguments[2],n=this.store,i=this.length-1;return n.reduceRight(function(e,n){return t.call(r,e,n,i--,this)},e,this)},c.prototype.iterate=function(){return this.store.iterate()}},{"./generic-collection":24,"./generic-set":27,"./listen/property-changes":32,"./listen/range-changes":33,"./set":36,"./shim":41}],36:[function(t,e,r){(function(r){(function(){"use strict";var n,i=t("./_set"),o=t("./listen/property-changes"),s=t("./listen/range-changes"),a=t("./listen/map-changes"),c="size";if(void 0!==r.Set&&"function"==typeof r.Set.prototype.values){var u;n=r.Set,e.exports=i,u={}.__proto__===Object.prototype?function(){this.__proto__=d}:function(){Object.defineProperties(this,f)},Object.defineProperty(n.prototype,"makeObservable",{value:u,writable:!0,configurable:!0,enumerable:!1});var h=n.prototype.clear,l=n.prototype.add,p=n.prototype.delete,f={_dispatchEmptyArray:{value:[]},clear:{value:function(){var t,e=this.size;e&&this.dispatchBeforeOwnPropertyChange(c,e),this.dispatchesRangeChanges&&(t=this.toArray(),this.dispatchBeforeRangeChange(this._dispatchEmptyArray,t,0)),h.call(this),this.dispatchesRangeChanges&&this.dispatchRangeChange(this._dispatchEmptyArray,t,0),e&&this.dispatchOwnPropertyChange(c,0)},writable:!0,configurable:!0},add:{value:function(t){if(!this.has(t)){var e=this.size,r=[t];return this.dispatchBeforeOwnPropertyChange(c,e),this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange(r,this._dispatchEmptyArray,e),l.call(this,t),this.dispatchesRangeChanges&&this.dispatchRangeChange(r,this._dispatchEmptyArray,e),this.dispatchOwnPropertyChange(c,e+1),!0}return!1},writable:!0,configurable:!0},delete:{value:function(t,e){if(this.has(t)){var r=this.size;if(void 0===e){var n=this.values();for(e=0;n.next().value!==t;)e++}this.dispatchBeforeOwnPropertyChange(c,r);var i=[t];return this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange(this._dispatchEmptyArray,i,e),p.call(this,t),this.dispatchesRangeChanges&&this.dispatchRangeChange(this._dispatchEmptyArray,i,e),this.dispatchOwnPropertyChange(c,r-1),!0}return!1}}},d=Object.create(n.prototype,f);Object.defineEach(i.prototype,o.prototype,!1,!0,!1,!0),Object.defineProperty(i.prototype,"makePropertyObservable",{value:function(){},writable:!0,configurable:!0,enumerable:!1}),Object.defineEach(i.prototype,s.prototype,!1,!0,!1,!0),Object.defineEach(i.prototype,a.prototype,!1,!0,!1,!0),Object.defineProperty(i,"_setupCollectionSet",{value:g,writable:!0,configurable:!0,enumerable:!1})}else g();function g(){var r=i.CollectionsSet,n=function t(e,n,i,o){return r._init(t,this,e,n,i,o)};n.Set=n,n.from=r.from,i.CollectionsSet=n,(n.prototype=new r).constructor=n;var a=t("./list"),u=t("./fast-set");n.prototype.Order=a,n.prototype.Store=u,Object.defineProperty(n.prototype,"_dispatchEmptyArray",{value:[]}),n.prototype.add=function(t){var e=new this.order.Node(t);if(!this.store.has(e)){var r=this.length,n=[t];return this.dispatchBeforeOwnPropertyChange(c,r),this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange(n,this._dispatchEmptyArray,r),this.order.add(t),e=this.order.head.prev,this.store.add(e),this.length++,this.dispatchesRangeChanges&&this.dispatchRangeChange(n,this._dispatchEmptyArray,r),this.dispatchOwnPropertyChange(c,r+1),!0}return!1},n.prototype.delete=function(t,e){if(e)throw new Error("Set#delete does not support second argument: equals");var r=new this.order.Node(t);if(this.store.has(r)){r=this.store.get(r);var n=[t];return this.dispatchBeforeOwnPropertyChange(c,this.length),this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange(this._dispatchEmptyArray,n,r.index),this.store.delete(r),this.order.splice(r,1),this.length--,this.dispatchesRangeChanges&&this.dispatchRangeChange(this._dispatchEmptyArray,n,r.index),this.dispatchOwnPropertyChange(c,this.length),!0}return!1},n.prototype.clear=function(){var t,e=this.length;e&&this.dispatchBeforeOwnPropertyChange(c,e),this.dispatchesRangeChanges&&(t=this.toArray(),this.dispatchBeforeRangeChange(this._dispatchEmptyArray,t,0)),this._clear(),this.dispatchesRangeChanges&&this.dispatchRangeChange(this._dispatchEmptyArray,t,0),e&&this.dispatchOwnPropertyChange(c,0)},Object.addEach(i.CollectionsSet.prototype,o.prototype),Object.addEach(i.CollectionsSet.prototype,s.prototype),i.CollectionsSet.prototype.makeObservable=function(){this.order.makeObservable()},e.exports=n}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_set":22,"./fast-set":23,"./list":29,"./listen/map-changes":31,"./listen/property-changes":32,"./listen/range-changes":33}],37:[function(t,e,r){"use strict";t("./shim-function");var n=t("./generic-collection"),i=t("./generic-order"),o=t("./weak-map");e.exports=Array;var s=Array.prototype.splice,a=Array.prototype.slice;Array.empty=[],Object.freeze&&Object.freeze(Array.empty),Array.nativeFrom=Array.from;var c="undefined"!=typeof Symbol;function u(t,e){Object.defineProperty(Array.prototype,t,{value:e,writable:!0,configurable:!0,enumerable:!1})}Array.from=function(t,e,r){if(c&&t&&("function"==typeof t[Symbol.iterator]||"function"==typeof e))return Array.nativeFrom(t,e,r);var n=[];return n.addEach(t),n},Array.unzip=function(t){for(var e=[],r=1/0,n=0;n<t.length;n++){var i=t[n];t[n]=i.toArray(),i.length<r&&(r=i.length)}for(n=0;n<t.length;n++){i=t[n];for(var o=0;o<i.length;o++)o<r&&o in i&&(e[o]=e[o]||[],e[o][n]=i[o])}return e},u("addEach",n.prototype.addEach),u("deleteEach",n.prototype.deleteEach),u("toArray",n.prototype.toArray),u("toObject",n.prototype.toObject),u("all",n.prototype.all),u("any",n.prototype.any),u("min",n.prototype.min),u("max",n.prototype.max),u("sum",n.prototype.sum),u("average",n.prototype.average),u("only",n.prototype.only),u("flatten",n.prototype.flatten),u("zip",n.prototype.zip),u("enumerate",n.prototype.enumerate),u("group",n.prototype.group),u("sorted",n.prototype.sorted),u("reversed",n.prototype.reversed),u("constructClone",function(t){var e=new this.constructor;return e.addEach(t),e}),u("has",function(t,e){return-1!==this.findValue(t,e)}),u("get",function(t,e){if(+t!==t)throw new Error("Indicies must be numbers");return!t in this?e:this[t]}),u("set",function(t,e){return this[t]=e,!0}),u("add",function(t){return this.push(t),!0}),u("delete",function(t,e){var r=this.findValue(t,e);return-1!==r&&(this.spliceOne(r),!0)}),u("deleteAll",function(t,e){e=e||this.contentEquals||Object.equals;for(var r=0,n=0;n<this.length;)e(t,this[n])?(this.swap(n,1),r++):n++;return r}),Array.prototype.find||u("find",function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),r=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],i=0;i<r;){var o=e[i];if(t.call(n,o,i,e))return o;i++}});var h={};function l(t,e){"undefined"!=typeof console&&"function"==typeof console.warn&&!0!==e&&!1===h.hasOwnProperty(t)&&(console.warn(t),h[t]++)}var p=Object.getOwnPropertyDescriptor(Array.prototype,"find").value;function f(t,e,r){this.array=t,this.start=null==e?0:e,this.end=r}u("find",function(t,e,r){return"function"==typeof arguments[0]&&this instanceof Array?p.apply(this,arguments):(l("Array#find usage is deprecated please use Array#findValue"),this.findValue.apply(this,arguments))}),u("findValue",function(t,e,r){if(r)throw new Error("Array#findValue does not support third argument: index");e=e||this.contentEquals||Object.equals;for(r=0;r<this.length;r++)if(r in this&&e(t,this[r]))return r;return-1}),u("findLast",function(t,e){return l("Array#findLast function is deprecated please use Array#findLastValue instead."),this.findLastValue.apply(this,arguments)}),u("findLastValue",function(t,e){e=e||this.contentEquals||Object.equals;var r=this.length;do{if(--r in this&&e(this[r],t))return r}while(r>0);return-1}),u("swap",function(t,e,r){var n,i,o,c,u;if(t>this.length&&(this.length=t),void 0!==r){if(n=[t,e],Array.isArray(r)||(r=a.call(r)),o=0,(i=r.length)<1e3){for(;o<i;o++)n[o+2]=r[o];return s.apply(this,n)}for(u=s.apply(this,n);o<i;){for(n=[t+o,0],c=2;c<1002&&o<i;c++,o++)n[c]=r[o];s.apply(this,n)}return u}return void 0!==e?s.call(this,t,e):void 0!==t?s.call(this,t):[]}),u("peek",function(){return this[0]}),u("poke",function(t){this.length>0&&(this[0]=t)}),u("peekBack",function(){if(this.length>0)return this[this.length-1]}),u("pokeBack",function(t){this.length>0&&(this[this.length-1]=t)}),u("one",function(){for(var t in this)if(Object.owns(this,t))return this[t]}),Array.prototype.clear||u("clear",function(){return this.length=0,this}),u("compare",function(t,e){var r,n,o;if(e=e||Object.compare,this===t)return 0;if(!t||!Array.isArray(t))return i.prototype.compare.call(this,t,e);for(n=this.length<t.length?this.length:t.length,r=0;r<n;r++)if(r in this){if(!(r in t))return-1;if(o=e(this[r],t[r]))return o}else if(r in t)return 1;return this.length-t.length}),u("equals",function(t,e){e=e||Object.equals;var r=0,n=this.length;if(this===t)return!0;if(!t||!Array.isArray(t))return i.prototype.equals.call(this,t);if(n!==t.length)return!1;for(;r<n;++r)if(r in this){if(!(r in t))return!1;if(!e(this[r],t[r]))return!1}else if(r in t)return!1;return!0}),u("clone",function(t,e){if(null==t)t=1/0;else if(0===t)return this;if((e=e||new o).has(this))return e.get(this);var r=new Array(this.length);for(var n in e.set(this,r),this)r[n]=Object.clone(this[n],t-1,e);return r}),u("iterate",function(t,e){return new f(this,t,e)}),void 0===Array.prototype.spliceOne&&u("spliceOne",function(t,e){var r=this.length;if(r)if(1===arguments.length){for(;t<r;)this[t]=this[t+1],t++;this.length--}else this[t]=e}),u("Iterator",f),f.prototype.__iterationObject=null,Object.defineProperty(f.prototype,"_iterationObject",{get:function(){return this.__iterationObject||(this.__iterationObject={done:!1,value:null})}}),f.prototype.next=function(){return this.start===(null==this.end?this.array.length:this.end)?(this._iterationObject.done=!0,this._iterationObject.value=void 0):this._iterationObject.value=this.array[this.start++],this._iterationObject}},{"./generic-collection":24,"./generic-order":26,"./shim-function":38,"./weak-map":44}],38:[function(t,e,r){e.exports=Function,Function.noop=function(){},Function.identity=function(t){return t},Function.by=function(t,e){e=e||Object.compare,t=t||Function.identity;var r=function(r,n){return e(t(r),t(n))};return r.compare=e,r.by=t,r},Function.get=function(t){return function(e){return Object.get(e,t)}}},{}],39:[function(t,e,r){"use strict";var n=t("./weak-map");t("./shim-function"),e.exports=Object,Object.empty=Object.freeze(Object.create(null)),Object.isObject=function(t){return Object(t)===t},Object.getValueOf=function(t){return t&&"function"==typeof t.valueOf&&(t=t.valueOf()),t};var i=new n;Object.hash=function(t){return t&&"function"==typeof t.hash?""+t.hash():Object(t)===t?(i.has(t)||i.set(t,Math.random().toString(36).slice(2)),i.get(t)):""+t};var o=Object.prototype.hasOwnProperty;Object.owns=function(t,e){return o.call(t,e)},Object.has=function(t,e){if("object"!=typeof t)throw new Error("Object.has can't accept non-object: "+typeof t);if(t&&"function"==typeof t.has)return t.has(e);if("string"==typeof e)return e in t&&t[e]!==Object.prototype[e];throw new Error("Key must be a string for Object.has on plain objects")},Object.get=function(t,e,r){if("object"!=typeof t)throw new Error("Object.get can't accept non-object: "+typeof t);return t&&"function"==typeof t.get?t.get(e,r):Object.has(t,e)?t[e]:r},Object.set=function(t,e,r){t&&"function"==typeof t.set?t.set(e,r):t[e]=r},Object.addEach=function(t,e,r){var n=3!==arguments.length||r;if(e)if("function"!=typeof e.forEach||e.hasOwnProperty("forEach"))if("number"==typeof e.length)for(var i=0;i<e.length;i++)t[i]=e[i];else for(var o,s=Object.keys(e),a=0;o=s[a];a++)!n&&Object.owns(t,o)||(t[o]=e[o]);else!0===e.isMap?e.forEach(function(e,r){t[r]=e}):e.forEach(function(e){t[e[0]]=e[1]});else;return t},Object.defineEach=function(t,e,r,n,i,o){var s=3!==arguments.length||r;if(e)if("function"!=typeof e.forEach||e.hasOwnProperty("forEach"))if("number"==typeof e.length)for(var a=0;a<e.length;a++)Object.defineProperty(t,a,{value:e[a],writable:o,configurable:n,enumerable:i});else for(var c,u=Object.keys(e),h=0;c=u[h];h++)!s&&Object.owns(t,c)||Object.defineProperty(t,c,{value:e[c],writable:o,configurable:n,enumerable:i});else!0===e.isMap?e.forEach(function(e,r){Object.defineProperty(t,r,{value:e,writable:o,configurable:n,enumerable:i})}):e.forEach(function(e){Object.defineProperty(t,e[0],{value:e[1],writable:o,configurable:n,enumerable:i})});else;return t},Object.forEach=function(t,e,r){for(var n,i=Object.keys(t),o=0;n=i[o];o++)e.call(r,t[n],n,t)},Object.map=function(t,e,r){for(var n,i=Object.keys(t),o=0,s=[];n=i[o];o++)s.push(e.call(r,t[n],n,t));return s},Object.values=function(t){return Object.map(t,Function.identity)},Object.concat=function(){for(var t={},e=0;e<arguments.length;e++)Object.addEach(t,arguments[e]);return t},Object.from=Object.concat,Object.is=function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e},Object.equals=function(t,e,r,i){if(r=r||Object.equals,(t=Object.getValueOf(t))===(e=Object.getValueOf(e)))return!0;if(Object.isObject(t)){if((i=i||new n).has(t))return!0;i.set(t,!0)}if(Object.isObject(t)&&"function"==typeof t.equals)return t.equals(e,r,i);if(Object.isObject(e)&&"function"==typeof e.equals)return e.equals(t,r,i);if(Object.isObject(t)&&Object.isObject(e)&&Object.getPrototypeOf(t)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){for(var o in t)if(!r(t[o],e[o],r,i))return!1;for(var o in e)if(!(o in t&&r(e[o],t[o],r,i)))return!1;return!0}return t!=t&&e!=e||(!t||!e)&&t===e},Object.compare=function(t,e){if((t=Object.getValueOf(t))===(e=Object.getValueOf(e)))return 0;var r=typeof t,n=typeof e;return"number"===r&&"number"===n?t-e:"string"===r&&"string"===n?t<e?-1/0:1/0:t&&"function"==typeof t.compare?t.compare(e):e&&"function"==typeof e.compare?-e.compare(t):0},Object.clone=function(t,e,r){if(t=Object.getValueOf(t),r=r||new n,void 0===e)e=1/0;else if(0===e)return t;if(Object.isObject(t)){if(!r.has(t))if(t&&"function"==typeof t.clone)r.set(t,t.clone(e,r));else{var i=Object.getPrototypeOf(t);if(null!==i&&i!==Object.prototype)throw new Error("Can't clone "+t);var o=Object.create(i);for(var s in r.set(t,o),t)o[s]=Object.clone(t[s],e-1,r)}return r.get(t)}return t},Object.clear=function(t){if(t&&"function"==typeof t.clear)t.clear();else for(var e=Object.keys(t),r=e.length;r;)delete t[e[--r]];return t}},{"./shim-function":38,"./weak-map":44}],40:[function(t,e,r){if(!RegExp.escape){var n=/[-[\]{}()*+?.\\^$|,#\s]/g;RegExp.escape=function(t){return t.replace(n,"\\$&")}}},{}],41:[function(t,e,r){t("./shim-array"),t("./shim-object"),t("./shim-function"),t("./shim-regexp")},{"./shim-array":37,"./shim-function":38,"./shim-object":39,"./shim-regexp":40}],42:[function(t,e,r){"use strict";e.exports=c;t("./shim");var n=t("./generic-collection"),i=t("./generic-set"),o=t("./listen/property-changes"),s=t("./listen/range-changes"),a=t("./tree-log");function c(t,e,r,n){if(!(this instanceof c))return new c(t,e,r,n);this.contentEquals=e||Object.equals,this.contentCompare=r||Object.compare,this.getDefault=n||Function.noop,this.root=null,this.length=0,this.addEach(t)}function u(t){this.value=t,this.left=null,this.right=null,this.length=1}function h(t,e,r){if(this.set=t,this.prev=null,this.end=r,e){var n=this.set.findLeastGreaterThanOrEqual(e);n&&(this.set.splay(n.value),this.prev=n.getPrevious())}}c.SortedSet=c,Object.addEach(c.prototype,n.prototype),Object.addEach(c.prototype,i.prototype),Object.addEach(c.prototype,o.prototype),Object.addEach(c.prototype,s.prototype),Object.defineProperty(c.prototype,"size",n._sizePropertyDescriptor),c.from=n.from,c.prototype.isSorted=!0,c.prototype.constructClone=function(t){return new this.constructor(t,this.contentEquals,this.contentCompare,this.getDefault)},c.prototype.has=function(t,e){if(e)throw new Error("SortedSet#has does not support second argument: equals");return!!this.root&&(this.splay(t),this.contentEquals(t,this.root.value))},c.prototype.get=function(t,e){if(e)throw new Error("SortedSet#get does not support second argument: equals");return this.root&&(this.splay(t),this.contentEquals(t,this.root.value))?this.root.value:this.getDefault(t)},c.prototype.add=function(t){var e=new this.Node(t);if(!this.root)return this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange([t],[],0),this.root=e,this.length++,this.dispatchesRangeChanges&&this.dispatchRangeChange([t],[],0),!0;if(this.splay(t),!this.contentEquals(t,this.root.value)){var r=this.contentCompare(t,this.root.value);if(0===r)throw new Error("SortedSet cannot contain incomparable but inequal values: "+t+" and "+this.root.value);return this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange([t],[],this.root.index),r<0?(e.right=this.root,e.left=this.root.left,this.root.left=null,this.root.touch()):(e.left=this.root,e.right=this.root.right,this.root.right=null,this.root.touch()),e.touch(),this.root=e,this.length++,this.dispatchesRangeChanges&&this.dispatchRangeChange([t],[],this.root.index),!0}return!1},c.prototype.delete=function(t,e){if(e)throw new Error("SortedSet#delete does not support second argument: equals");if(this.root&&(this.splay(t),this.contentEquals(t,this.root.value))){var r=this.root.index;if(this.dispatchesRangeChanges&&this.dispatchBeforeRangeChange([],[t],r),this.root.left){var n=this.root.right;this.root=this.root.left,this.splay(t),this.root.right=n}else this.root=this.root.right;return this.length--,this.root&&this.root.touch(),this.dispatchesRangeChanges&&this.dispatchRangeChange([],[t],r),!0}return!1},c.prototype.indexOf=function(t,e){if(e)throw new Error("SortedSet#indexOf does not support second argument: startIndex");return this.root&&(this.splay(t),this.contentEquals(t,this.root.value))?this.root.index:-1},c.prototype.find=function(t,e,r){if(e)throw new Error("SortedSet#find does not support second argument: equals");if(r)throw new Error("SortedSet#find does not support third argument: index");if(this.root&&(this.splay(t),this.contentEquals(t,this.root.value)))return this.root},c.prototype.findGreatest=function(t){if(this.root){for(t=t||this.root;t.right;)t=t.right;return t}},c.prototype.findLeast=function(t){if(this.root){for(t=t||this.root;t.left;)t=t.left;return t}},c.prototype.findGreatestLessThanOrEqual=function(t){if(this.root)return this.splay(t),this.contentCompare(this.root.value,t)>0?this.root.getPrevious():this.root},c.prototype.findGreatestLessThan=function(t){if(this.root)return this.splay(t),this.contentCompare(this.root.value,t)>=0?this.root.getPrevious():this.root},c.prototype.findLeastGreaterThanOrEqual=function(t){if(this.root)return this.splay(t),this.contentCompare(this.root.value,t)>=0?this.root:this.root.getNext()},c.prototype.findLeastGreaterThan=function(t){if(this.root)return this.splay(t),this.contentCompare(this.root.value,t)<=0?this.root.getNext():this.root},c.prototype.pop=function(){if(this.root){var t=this.findGreatest();return this.delete(t.value),t.value}},c.prototype.shift=function(){if(this.root){var t=this.findLeast();return this.delete(t.value),t.value}},c.prototype.push=function(){this.addEach(arguments)},c.prototype.unshift=function(){this.addEach(arguments)},c.prototype.slice=function(t,e){t=t||0,e=e||this.length,t<0&&(t+=this.length),e<0&&(e+=this.length);var r=[];if(this.root)for(this.splayIndex(t);this.root.index<e&&(r.push(this.root.value),this.root.right);)this.splay(this.root.getNext().value);return r},c.prototype.splice=function(t,e){return this.swap(t,e,Array.prototype.slice.call(arguments,2))},c.prototype.swap=function(t,e,r){if(void 0===t&&void 0===e)return[];(t=t||0)<0&&(t+=this.length),void 0===e&&(e=1/0);var n=[];if(this.root){this.splayIndex(t);for(var i=0;i<e;i++){n.push(this.root.value);var o=this.root.getNext();if(this.delete(this.root.value),!o)break;this.splay(o.value)}}return this.addEach(r),n},c.prototype.splay=function(t){var e,r,n,i,o,s;if(this.root){for(e=r=n=new this.Node,s=new this.Node,o=this.root;;){var a=this.contentCompare(t,o.value);if(a<0){if(!o.left)break;if(this.contentCompare(t,o.left.value)<0&&(i=o.left,o.left=i.right,o.touch(),i.right=o,i.touch(),!(o=i).left))break;(i=new u).right=o,i.left=s.left,s.left=i,n.left=o,n.touch(),n=o,o=o.left}else{if(!(a>0))break;if(!o.right)break;if(this.contentCompare(t,o.right.value)>0&&(i=o.right,o.right=i.left,o.touch(),i.left=o,i.touch(),!(o=i).right))break;(i=new u).left=o,i.right=s.right,s.right=i,r.right=o,r.touch(),r=o,o=o.right}}for(r.right=o.left,r.touch(),n.left=o.right,n.touch(),o.left=e.right,o.right=e.left;s.left;)s.left.right.touch(),s.left=s.left.left;for(;s.right;)s.right.left.touch(),s.right=s.right.right;o.touch(),this.root=o}},c.prototype.splayIndex=function(t){if(this.root){for(var e=this.root,r=this.root.index;r!==t;)if(r>t&&e.left)r-=1+((e=e.left).right?e.right.length:0);else{if(!(r<t&&e.right))break;r+=1+((e=e.right).left?e.left.length:0)}return this.splay(e.value),this.root.index===t}return!1},c.prototype.reduce=function(t,e,r){return this.root&&(e=this.root.reduce(t,e,0,r,this)),e},c.prototype.reduceRight=function(t,e,r){return this.root&&(e=this.root.reduceRight(t,e,this.length-1,r,this)),e},c.prototype.min=function(t){var e=this.findLeast(t);if(e)return e.value},c.prototype.max=function(t){var e=this.findGreatest(t);if(e)return e.value},c.prototype.one=function(){return this.min()},c.prototype.clear=function(){var t;this.dispatchesRangeChanges&&(t=this.toArray(),this.dispatchBeforeRangeChange([],t,0)),this.root=null,this.length=0,this.dispatchesRangeChanges&&this.dispatchRangeChange([],t,0)},c.prototype.iterate=function(t,e){return new this.Iterator(this,t,e)},c.prototype.Iterator=h,c.prototype.summary=function(){return this.root?this.root.summary():"()"},c.prototype.log=function(t,e,r,n){t=t||a.unicodeRound,e=e||this.logNode,r||(r=console.log,n=console),r=r.bind(n),this.root&&this.root.log(t,e,r,r)},c.prototype.logNode=function(t,e,r){e(" "+t.value)},c.logCharsets=a,c.prototype.Node=u,u.prototype.reduce=function(t,e,r,n,i,o){if(o=o||0,this.left){var s=this.left.length;e=this.left.reduce(t,e,r,n,i,o+1),r+=s}return e=t.call(n,e,this.value,r,i,this,o),r+=1,this.right&&(e=this.right.reduce(t,e,r,n,i,o+1)),e},u.prototype.reduceRight=function(t,e,r,n,i,o){return o=o||0,this.right&&(e=this.right.reduceRight(t,e,r,n,i,o+1),r-=this.right.length),e=t.call(n,e,this.value,this.value,i,this,o),r-=1,this.left&&(e=this.left.reduceRight(t,e,r,n,i,o+1)),e},u.prototype.touch=function(){this.length=1+(this.left?this.left.length:0)+(this.right?this.right.length:0),this.index=this.left?this.left.length:0},u.prototype.checkIntegrity=function(){var t=1;if(t+=this.left?this.left.checkIntegrity():0,t+=this.right?this.right.checkIntegrity():0,this.length!==t)throw new Error("Integrity check failed: "+this.summary());return t},u.prototype.getNext=function(){var t=this;if(t.right){for(t=t.right;t.left;)t=t.left;return t}},u.prototype.getPrevious=function(){var t=this;if(t.left){for(t=t.left;t.right;)t=t.right;return t}},u.prototype.summary=function(){var t=this.value||"-";return t+=" <"+this.length,this.left||this.right?"("+t+" "+(this.left?this.left.summary():"()")+", "+(this.right?this.right.summary():"()")+")":"("+t+")"},u.prototype.log=function(t,e,r,n){var i,o,s,a,c=this;i=this.left&&this.right?t.intersection:this.left?t.branchUp:this.right?t.branchDown:t.through,this.left&&this.left.log(t,e,function(e){o?n(t.strafe+" "+e):(o=!0,n(t.fromBelow+t.through+e))},function(t){n(" "+t)}),e(this,function(e){s?r((c.right?t.strafe:" ")+e):(s=!0,r(i+e))},function(e){n((c.left?t.strafe:" ")+e)}),this.right&&this.right.log(t,e,function(e){a?r(" "+e):(a=!0,r(t.fromAbove+t.through+e))},function(e){r(t.strafe+" "+e)})},h.prototype.__iterationObject=null,Object.defineProperty(h.prototype,"_iterationObject",{get:function(){return this.__iterationObject||(this.__iterationObject={done:!1,value:null})}}),h.prototype.next=function(){var t;return(t=this.prev?this.set.findLeastGreaterThan(this.prev.value):this.set.findLeast())?void 0!==this.end&&this.set.contentCompare(t.value,this.end)>=0?(this._iterationObject.done=!0,this._iterationObject.value=void 0):(this.prev=t,this._iterationObject.value=t.value):(this._iterationObject.done=!0,this._iterationObject.value=void 0),this._iterationObject}},{"./generic-collection":24,"./generic-set":27,"./listen/property-changes":32,"./listen/range-changes":33,"./shim":41,"./tree-log":43}],43:[function(t,e,r){"use strict";function n(){}e.exports=n,n.ascii={intersection:"+",through:"-",branchUp:"+",branchDown:"+",fromBelow:".",fromAbove:"'",fromBoth:"+",strafe:"|"},n.unicodeRound={intersection:"╋",through:"━",branchUp:"┻",branchDown:"┳",fromBelow:"╭",fromAbove:"╰",fromBoth:"┣",strafe:"┃"},n.unicodeSharp={intersection:"╋",through:"━",branchUp:"┻",branchDown:"┳",fromBelow:"┏",fromAbove:"┗",fromBoth:"┣",strafe:"┃"}},{}],44:[function(t,e,r){e.exports="undefined"!=typeof WeakMap?WeakMap:t("weak-map")},{"weak-map":93}],45:[function(t,e,r){(function(n){(function(){r.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&"%c"===t&&(i=++n)}),t.splice(i,0,r)},r.save=function(t){try{t?r.storage.setItem("debug",t):r.storage.removeItem("debug")}catch(t){}},r.load=function(){let t;try{t=r.storage.getItem("debug")}catch(t){}!t&&void 0!==n&&"env"in n&&(t=n.env.DEBUG);return t},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function(){try{return localStorage}catch(t){}}(),r.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})(),r.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"],r.log=console.debug||console.log||(()=>{}),e.exports=t("./common")(r);const{formatters:i}=e.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this)}).call(this,t("_process"))},{"./common":46,_process:64}],46:[function(t,e,r){e.exports=function(e){function r(t){let e,i,o,s=null;function a(...t){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(e||i);n.diff=o,n.prev=e,n.curr=i,e=i,t[0]=r.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(e,i)=>{if("%%"===e)return"%";s++;const o=r.formatters[i];if("function"==typeof o){const r=t[s];e=o.call(n,r),t.splice(s,1),s--}return e}),r.formatArgs.call(n,t),(n.log||r.log).apply(n,t)}return a.namespace=t,a.useColors=r.useColors(),a.color=r.selectColor(t),a.extend=n,a.destroy=r.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==r.namespaces&&(i=r.namespaces,o=r.enabled(t)),o),set:t=>{s=t}}),"function"==typeof r.init&&r.init(a),a}function n(t,e){const n=r(this.namespace+(void 0===e?":":e)+t);return n.log=this.log,n}function i(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(t){return t instanceof Error?t.stack||t.message:t},r.disable=function(){const t=[...r.names.map(i),...r.skips.map(i).map(t=>"-"+t)].join(",");return r.enable(""),t},r.enable=function(t){let e;r.save(t),r.namespaces=t,r.names=[],r.skips=[];const n=("string"==typeof t?t:"").split(/[\s,]+/),i=n.length;for(e=0;e<i;e++)n[e]&&("-"===(t=n[e].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+t.substr(1)+"$")):r.names.push(new RegExp("^"+t+"$")))},r.enabled=function(t){if("*"===t[t.length-1])return!0;let e,n;for(e=0,n=r.skips.length;e<n;e++)if(r.skips[e].test(t))return!1;for(e=0,n=r.names.length;e<n;e++)if(r.names[e].test(t))return!0;return!1},r.humanize=t("ms"),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(t=>{r[t]=e[t]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return r.colors[Math.abs(e)%r.colors.length]},r.enable(r.load()),r}},{ms:59}],47:[function(t,e,r){(function(r,n){(function(){var i=t("readable-stream"),o=t("end-of-stream"),s=t("inherits"),a=t("stream-shift"),c=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),u=function(t,e){t._corked?t.once("uncork",e):e()},h=function(t,e){return function(r){r?function(t,e){t._autoDestroy&&t.destroy(e)}(t,"premature close"===r.message?null:r):e&&!t._ended&&t.end()}},l=function(){},p=function(t,e,r){if(!(this instanceof p))return new p(t,e,r);i.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),e&&this.setReadable(e)};s(p,i.Duplex),p.obj=function(t,e,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new p(t,e,r)},p.prototype.cork=function(){1==++this._corked&&this.emit("cork")},p.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},p.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var e=this,n=o(t,{writable:!0,readable:!1},h(this,this._forwardEnd)),i=function(){var t=e._ondrain;e._ondrain=null,t&&t()};this._unwrite&&r.nextTick(i),this._writable=t,this._writable.on("drain",i),this._unwrite=function(){e._writable.removeListener("drain",i),n()},this.uncork()}else this.end()},p.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var e,r=this,n=o(t,{writable:!1,readable:!0},h(this)),s=function(){r._forward()},a=function(){r.push(null)};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:(e=t,new i.Readable({objectMode:!0,highWaterMark:16}).wrap(e)),this._readable2.on("readable",s),this._readable2.on("end",a),this._unread=function(){r._readable2.removeListener("readable",s),r._readable2.removeListener("end",a),n()},this._forward()}},p.prototype._read=function(){this._drained=!0,this._forward()},p.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=a(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},p.prototype.destroy=function(t,e){if(e||(e=l),this.destroyed)return e(null);this.destroyed=!0;var n=this;r.nextTick(function(){n._destroy(t),e(null)})},p.prototype._destroy=function(t){if(t){var e=this._ondrain;this._ondrain=null,e?e(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},p.prototype._write=function(t,e,r){if(!this.destroyed)return this._corked?u(this,this._write.bind(this,t,e,r)):t===c?this._finish(r):this._writable?void(!1===this._writable.write(t)?this._ondrain=r:this.destroyed||r()):r()},p.prototype._finish=function(t){var e=this;this.emit("preend"),u(this,function(){var r,n;r=e._forwardEnd&&e._writable,n=function(){!1===e._writableState.prefinished&&(e._writableState.prefinished=!0),e.emit("prefinish"),u(e,t)},r?r._writableState&&r._writableState.finished?n():r._writableState?r.end(n):(r.end(),n()):n()})},p.prototype.end=function(t,e,r){return"function"==typeof t?this.end(null,null,t):"function"==typeof e?this.end(t,null,e):(this._ended=!0,t&&this.write(t),this._writableState.ending||this._writableState.destroyed||this.write(c),i.Writable.prototype.end.call(this,r))},e.exports=p}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:64,buffer:17,"end-of-stream":48,inherits:51,"readable-stream":83,"stream-shift":88}],48:[function(t,e,r){(function(r){(function(){var n=t("once"),i=function(){},o=function(t,e,s){if("function"==typeof e)return o(t,null,e);e||(e={}),s=n(s||i);var a=t._writableState,c=t._readableState,u=e.readable||!1!==e.readable&&t.readable,h=e.writable||!1!==e.writable&&t.writable,l=!1,p=function(){t.writable||f()},f=function(){h=!1,u||s.call(t)},d=function(){u=!1,h||s.call(t)},g=function(e){s.call(t,e?new Error("exited with error code: "+e):null)},y=function(e){s.call(t,e)},b=function(){r.nextTick(m)},m=function(){if(!l)return(!u||c&&c.ended&&!c.destroyed)&&(!h||a&&a.ended&&!a.destroyed)?void 0:s.call(t,new Error("premature close"))},v=function(){t.req.on("finish",f)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(t)?h&&!a&&(t.on("end",p),t.on("close",p)):(t.on("complete",f),t.on("abort",b),t.req?v():t.on("request",v)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on("exit",g),t.on("end",d),t.on("finish",f),!1!==e.error&&t.on("error",y),t.on("close",b),function(){l=!0,t.removeListener("complete",f),t.removeListener("abort",b),t.removeListener("request",v),t.req&&t.req.removeListener("finish",f),t.removeListener("end",p),t.removeListener("close",p),t.removeListener("finish",f),t.removeListener("exit",g),t.removeListener("end",d),t.removeListener("error",y),t.removeListener("close",b)}};e.exports=o}).call(this)}).call(this,t("_process"))},{_process:64,once:62}],49:[function(t,e,r){var n=Object.create||function(t){var e=function(){};return e.prototype=t,new e},i=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},o=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var a,c=10;try{var u={};Object.defineProperty&&Object.defineProperty(u,"x",{value:0}),a=0===u.x}catch(t){a=!1}function h(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var o,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=t._events)?(s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),a=s[e]):(s=t._events=n(null),t._eventsCount=0),a){if("function"==typeof a?a=s[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(o=h(t))&&o>0&&a.length>o){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else a=s[e]=r,++t._eventsCount;return t}function p(){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 t=new Array(arguments.length),e=0;e<t.length;++e)t[e]=arguments[e];this.listener.apply(this.target,t)}}function f(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=o.call(p,n);return i.listener=r,n.wrapFn=i,i}function d(t,e,r){var n=t._events;if(!n)return[];var i=n[e];return i?"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):y(i,i.length):[]}function g(t){var e=this._events;if(e){var r=e[t];if("function"==typeof r)return 1;if(r)return r.length}return 0}function y(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}a?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||t!=t)throw new TypeError('"defaultMaxListeners" must be a positive number');c=t}}):s.defaultMaxListeners=c,s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(t){var e,r,n,i,o,s,a="error"===t;if(s=this._events)a=a&&null==s.error;else if(!a)return!1;if(a){if(arguments.length>1&&(e=arguments[1]),e instanceof Error)throw e;var c=new Error('Unhandled "error" event. ('+e+")");throw c.context=e,c}if(!(r=s[t]))return!1;var u="function"==typeof r;switch(n=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var n=t.length,i=y(t,n),o=0;o<n;++o)i[o].call(r)}(r,u,this);break;case 2:!function(t,e,r,n){if(e)t.call(r,n);else for(var i=t.length,o=y(t,i),s=0;s<i;++s)o[s].call(r,n)}(r,u,this,arguments[1]);break;case 3:!function(t,e,r,n,i){if(e)t.call(r,n,i);else for(var o=t.length,s=y(t,o),a=0;a<o;++a)s[a].call(r,n,i)}(r,u,this,arguments[1],arguments[2]);break;case 4:!function(t,e,r,n,i,o){if(e)t.call(r,n,i,o);else for(var s=t.length,a=y(t,s),c=0;c<s;++c)a[c].call(r,n,i,o)}(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];!function(t,e,r,n){if(e)t.apply(r,n);else for(var i=t.length,o=y(t,i),s=0;s<i;++s)o[s].apply(r,n)}(r,u,this,i)}return!0},s.prototype.addListener=function(t,e){return l(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return l(this,t,e,!0)},s.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,f(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,f(this,t,e)),this},s.prototype.removeListener=function(t,e){var r,i,o,s,a;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(r=i[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=n(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===e||r[s].listener===e){a=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n<i;r+=1,n+=1)t[r]=t[n];t.pop()}(r,o),1===r.length&&(i[t]=r[0]),i.removeListener&&this.emit("removeListener",t,a||e)}return this},s.prototype.removeAllListeners=function(t){var e,r,o;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=n(null),this._eventsCount=0):r[t]&&(0==--this._eventsCount?this._events=n(null):delete r[t]),this;if(0===arguments.length){var s,a=i(r);for(o=0;o<a.length;++o)"removeListener"!==(s=a[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=n(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(e)for(o=e.length-1;o>=0;o--)this.removeListener(t,e[o]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],50:[function(t,e,r){r.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,h=-7,l=r?i-1:0,p=r?-1:1,f=t[e+l];for(l+=p,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=p,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,h=(1<<u)-1,l=h>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*g}},{}],51:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],52:[function(t,e,r){(function(t){(function(){const r=e.exports;r.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},r.codes={};for(const t in r.types){const e=r.types[t];r.codes[e]=t}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=t.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=t.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=t.from([r.codes.connect<<r.CMD_SHIFT]),r.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},r.propertiesCodes={};for(const t in r.properties){const e=r.properties[t];r.propertiesCodes[e]=t}function n(e){return[0,1,2].map(n=>[0,1].map(i=>[0,1].map(o=>{const s=t.alloc(1);return s.writeUInt8(r.codes[e]<<r.CMD_SHIFT|(i?r.DUP_MASK:0)|n<<r.QOS_SHIFT|o,0,!0),s})))}r.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},r.PUBLISH_HEADER=n("publish"),r.SUBSCRIBE_HEADER=n("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=n("unsubscribe"),r.ACKS={unsuback:n("unsuback"),puback:n("puback"),pubcomp:n("pubcomp"),pubrel:n("pubrel"),pubrec:n("pubrec")},r.SUBACK_HEADER=t.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=t.from([3]),r.VERSION4=t.from([4]),r.VERSION5=t.from([5]),r.VERSION131=t.from([131]),r.VERSION132=t.from([132]),r.QOS=[0,1,2].map(e=>t.from([e])),r.EMPTY={pingreq:t.from([r.codes.pingreq<<4,0]),pingresp:t.from([r.codes.pingresp<<4,0]),disconnect:t.from([r.codes.disconnect<<4,0])}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:17}],53:[function(t,e,r){(function(r){(function(){const n=t("./writeToStream"),i=t("events");class o extends i{constructor(){super(),this._array=new Array(20),this._i=0}write(t){return this._array[this._i++]=t,!0}concat(){let t=0;const e=new Array(this._array.length),n=this._array;let i,o=0;for(i=0;i<n.length&&void 0!==n[i];i++)"string"!=typeof n[i]?e[i]=n[i].length:e[i]=r.byteLength(n[i]),t+=e[i];const s=r.allocUnsafe(t);for(i=0;i<n.length&&void 0!==n[i];i++)"string"!=typeof n[i]?(n[i].copy(s,o),o+=e[i]):(s.write(n[i],o),o+=e[i]);return s}}e.exports=function(t,e){const r=new o;return n(t,r,e),r.concat()}}).call(this)}).call(this,t("buffer").Buffer)},{"./writeToStream":58,buffer:17,events:49}],54:[function(t,e,r){r.parser=t("./parser").parser,r.generate=t("./generate"),r.writeToStream=t("./writeToStream")},{"./generate":53,"./parser":57,"./writeToStream":58}],55:[function(t,e,r){(function(t){(function(){const r=65536,n={},i=t.isBuffer(t.from([1,2]).subarray(0,1));function o(e){const r=t.allocUnsafe(2);return r.writeUInt8(e>>8,0),r.writeUInt8(255&e,1),r}e.exports={cache:n,generateCache:function(){for(let t=0;t<r;t++)n[t]=o(t)},generateNumber:o,genBufVariableByteInt:function(e){let r=0,n=0;const o=t.allocUnsafe(4);do{r=e%128|0,(e=e/128|0)>0&&(r|=128),o.writeUInt8(r,n++)}while(e>0&&n<4);return e>0&&(n=0),i?o.subarray(0,n):o.slice(0,n)},generate4ByteBuffer:function(e){const r=t.allocUnsafe(4);return r.writeUInt32BE(e,0),r}}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:17}],56:[function(t,e,r){e.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},{}],57:[function(t,e,r){const n=t("bl"),i=t("events"),o=t("./packet"),s=t("./constants"),a=t("debug")("mqtt-packet:parser");class c extends i{constructor(){super(),this.parser=this.constructor.parser}static parser(t){return this instanceof c?(this.settings=t||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new c).parser(t)}_resetState(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=n(),this._stateCounter=0}parse(t){for(this.error&&this._resetState(),this._list.append(t),a("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const t=this._list.readUInt8(0);return this.packet.cmd=s.types[t>>s.CMD_SHIFT],this.packet.retain=0!=(t&s.RETAIN_MASK),this.packet.qos=t>>s.QOS_SHIFT&s.QOS_MASK,this.packet.dup=0!=(t&s.DUP_MASK),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const t=this._parseVarByteNum(!0);return t&&(this.packet.length=t.value,this._list.consume(t.bytes)),a("_parseLength %d",t.value),!!t}_parsePayload(){a("_parsePayload: payload %O",this._list);let t=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}t=!0}return a("_parsePayload complete result: %s",t),t}_parseConnect(){let t,e,r,n;a("_parseConnect");const i={},o=this.packet,c=this._parseString();if(null===c)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==c&&"MQIsdp"!==c)return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=c,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.protocolVersion=this._list.readUInt8(this._pos),o.protocolVersion>=128&&(o.bridgeMode=!0,o.protocolVersion=o.protocolVersion-128),3!==o.protocolVersion&&4!==o.protocolVersion&&5!==o.protocolVersion)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(i.username=this._list.readUInt8(this._pos)&s.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK,i.will&&(o.will={},o.will.retain=0!=(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),o.will.qos=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT),o.clean=0!=(this._list.readUInt8(this._pos)&s.CLEAN_SESSION_MASK),this._pos++,o.keepalive=this._parseNum(),-1===o.keepalive)return this._emitError(new Error("Packet too short"));if(5===o.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(o.properties=t)}const u=this._parseString();if(null===u)return this._emitError(new Error("Packet too short"));if(o.clientId=u,a("_parseConnect: packet.clientId: %s",o.clientId),i.will){if(5===o.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(o.will.properties=t)}if(null===(t=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(o.will.topic=t,a("_parseConnect: packet.will.topic: %s",o.will.topic),null===(e=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));o.will.payload=e,a("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(i.username){if(null===(n=this._parseString()))return this._emitError(new Error("Cannot parse username"));o.username=n,a("_parseConnect: packet.username: %s",o.username)}if(i.password){if(null===(r=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));o.password=r}return this.settings=o,a("_parseConnect: complete"),o}_parseConnack(){a("_parseConnack");const t=this.packet;if(this._list.length<1)return null;if(t.sessionPresent=!!(this._list.readUInt8(this._pos++)&s.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?t.reasonCode=this._list.readUInt8(this._pos++):t.reasonCode=0;else{if(this._list.length<2)return null;t.returnCode=this._list.readUInt8(this._pos++)}if(-1===t.returnCode||-1===t.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}a("_parseConnack: complete")}_parsePublish(){a("_parsePublish");const t=this.packet;if(t.topic=this._parseString(),null===t.topic)return this._emitError(new Error("Cannot parse topic"));if(!(t.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}t.payload=this._list.slice(this._pos,t.length),a("_parsePublish: payload from buffer list: %o",t.payload)}}_parseSubscribe(){a("_parseSubscribe");const t=this.packet;let e,r,n,i,o,c,u;if(1!==t.qos)return this._emitError(new Error("Wrong subscribe header"));if(t.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<t.length;){if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse topic"));if(this._pos>=t.length)return this._emitError(new Error("Malformed Subscribe Payload"));n=(r=this._parseByte())&s.SUBSCRIBE_OPTIONS_QOS_MASK,c=0!=(r>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK),o=0!=(r>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK),i=r>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,u={topic:e,qos:n},5===this.settings.protocolVersion?(u.nl=c,u.rap=o,u.rh=i):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",u),t.subscriptions.push(u)}}}_parseSuback(){a("_parseSuback");const t=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){a("_parseUnsubscribe");const t=this.packet;if(t.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<t.length;){const e=this._parseString();if(null===e)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",e),t.unsubscriptions.push(e)}}}_parseUnsuback(){a("_parseUnsuback");const t=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const e=this._parseProperties();for(Object.getOwnPropertyNames(e).length&&(t.properties=e),t.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const t=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(t.length>2?(t.reasonCode=this._parseByte(),a("_parseConfirmation: packet.reasonCode `%d`",t.reasonCode)):t.reasonCode=0,t.length>3)){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}return!0}_parseDisconnect(){const t=this.packet;if(a("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?t.reasonCode=this._parseByte():t.reasonCode=0;const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}return a("_parseDisconnect result: true"),!0}_parseAuth(){a("_parseAuth");const t=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));t.reasonCode=this._parseByte();const e=this._parseProperties();return Object.getOwnPropertyNames(e).length&&(t.properties=e),a("_parseAuth: result: true"),!0}_parseMessageId(){const t=this.packet;return t.messageId=this._parseNum(),null===t.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",t.messageId),!0)}_parseString(t){const e=this._parseNum(),r=e+this._pos;if(-1===e||r>this._list.length||r>this.packet.length)return null;const n=this._list.toString("utf8",this._pos,r);return this._pos+=e,a("_parseString: result: %s",n),n}_parseStringPair(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const t=this._parseNum(),e=t+this._pos;if(-1===t||e>this._list.length||e>this.packet.length)return null;const r=this._list.slice(this._pos,e);return this._pos+=t,a("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;const t=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",t),t}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const t=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",t),t}_parseVarByteNum(t){a("_parseVarByteNum");let e,r=0,n=1,i=0,o=!1;const c=this._pos?this._pos:0;for(;r<4&&c+r<this._list.length;){if(i+=n*((e=this._list.readUInt8(c+r++))&s.VARBYTEINT_MASK),n*=128,0==(e&s.VARBYTEINT_FIN_MASK)){o=!0;break}if(this._list.length<=r)break}return!o&&4===r&&this._list.length>=r&&this._emitError(new Error("Invalid variable byte integer")),c&&(this._pos+=r),a("_parseVarByteNum: result: %o",o=!!o&&(t?{bytes:r,value:i}:i)),o}_parseByte(){let t;return this._pos<this._list.length&&(t=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",t),t}_parseByType(t){switch(a("_parseByType: type: %s",t),t){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){a("_parseProperties");const t=this._parseVarByteNum(),e=this._pos+t,r={};for(;this._pos<e;){const t=this._parseByte();if(!t)return this._emitError(new Error("Cannot parse property code type")),!1;const e=s.propertiesCodes[t];if(!e)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==e)r[e]?Array.isArray(r[e])?r[e].push(this._parseByType(s.propertiesTypes[e])):(r[e]=[r[e]],r[e].push(this._parseByType(s.propertiesTypes[e]))):r[e]=this._parseByType(s.propertiesTypes[e]);else{r[e]||(r[e]=Object.create(null));const t=this._parseByType(s.propertiesTypes[e]);if(r[e][t.name])if(Array.isArray(r[e][t.name]))r[e][t.name].push(t.value);else{const n=r[e][t.name];r[e][t.name]=[n],r[e][t.name].push(t.value)}else r[e][t.name]=t.value}}return r}_newPacket(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),a("_newPacket: new packet"),this.packet=new o,this._pos=0,!0}_emitError(t){a("_emitError"),this.error=t,this.emit("error",t)}}e.exports=c},{"./constants":52,"./packet":56,bl:15,debug:45,events:49}],58:[function(t,e,r){(function(r){(function(){const n=t("./constants"),i=r.allocUnsafe(0),o=r.from([0]),s=t("./numbers"),a=t("process-nextick-args").nextTick,c=t("debug")("mqtt-packet:writeToStream"),u=s.cache,h=s.generateNumber,l=s.generateCache,p=s.genBufVariableByteInt,f=s.generate4ByteBuffer;let d=E,g=!0;function y(t,e,s){switch(c("generate called"),e.cork&&(e.cork(),a(b,e)),g&&(g=!1,l()),c("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return function(t,e,i){const o=t||{},s=o.protocolId||"MQTT";let a=o.protocolVersion||4;const c=o.will;let u=o.clean;const h=o.keepalive||0,l=o.clientId||"",p=o.username,f=o.password,g=o.properties;void 0===u&&(u=!0);let y=0;if(!s||"string"!=typeof s&&!r.isBuffer(s))return e.emit("error",new Error("Invalid protocolId")),!1;y+=s.length+2;if(3!==a&&4!==a&&5!==a)return e.emit("error",new Error("Invalid protocol version")),!1;y+=1;if(("string"==typeof l||r.isBuffer(l))&&(l||a>=4)&&(l||u))y+=r.byteLength(l)+2;else{if(a<4)return e.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*u==0)return e.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof h||h<0||h>65535||h%1!=0)return e.emit("error",new Error("Invalid keepalive")),!1;y+=2;if(y+=1,5===a){var b=S(e,g);if(!b)return!1;y+=b.length}if(c){if("object"!=typeof c)return e.emit("error",new Error("Invalid will")),!1;if(!c.topic||"string"!=typeof c.topic)return e.emit("error",new Error("Invalid will topic")),!1;if(y+=r.byteLength(c.topic)+2,y+=2,c.payload){if(!(c.payload.length>=0))return e.emit("error",new Error("Invalid will payload")),!1;"string"==typeof c.payload?y+=r.byteLength(c.payload):y+=c.payload.length}var m={};if(5===a){if(!(m=S(e,c.properties)))return!1;y+=m.length}}let w=!1;if(null!=p){if(!P(p))return e.emit("error",new Error("Invalid username")),!1;w=!0,y+=r.byteLength(p)+2}if(null!=f){if(!w)return e.emit("error",new Error("Username is required to use password")),!1;if(!P(f))return e.emit("error",new Error("Invalid password")),!1;y+=x(f)+2}e.write(n.CONNECT_HEADER),v(e,y),O(e,s),o.bridgeMode&&(a+=128);e.write(131===a?n.VERSION131:132===a?n.VERSION132:4===a?n.VERSION4:5===a?n.VERSION5:n.VERSION3);let E=0;E|=null!=p?n.USERNAME_MASK:0,E|=null!=f?n.PASSWORD_MASK:0,E|=c&&c.retain?n.WILL_RETAIN_MASK:0,E|=c&&c.qos?c.qos<<n.WILL_QOS_SHIFT:0,E|=c?n.WILL_FLAG_MASK:0,E|=u?n.CLEAN_SESSION_MASK:0,e.write(r.from([E])),d(e,h),5===a&&b.write();O(e,l),c&&(5===a&&m.write(),_(e,c.topic),O(e,c.payload));null!=p&&O(e,p);null!=f&&O(e,f);return!0}(t,e);case"connack":return function(t,e,i){const s=i?i.protocolVersion:4,a=t||{},c=5===s?a.reasonCode:a.returnCode,u=a.properties;let h=2;if("number"!=typeof c)return e.emit("error",new Error("Invalid return code")),!1;let l=null;if(5===s){if(!(l=S(e,u)))return!1;h+=l.length}e.write(n.CONNACK_HEADER),v(e,h),e.write(a.sessionPresent?n.SESSIONPRESENT_HEADER:o),e.write(r.from([c])),null!=l&&l.write();return!0}(t,e,s);case"publish":return function(t,e,o){c("publish: packet: %o",t);const s=o?o.protocolVersion:4,a=t||{},u=a.qos||0,h=a.retain?n.RETAIN_MASK:0,l=a.topic,p=a.payload||i,f=a.messageId,g=a.properties;let y=0;if("string"==typeof l)y+=r.byteLength(l)+2;else{if(!r.isBuffer(l))return e.emit("error",new Error("Invalid topic")),!1;y+=l.length+2}r.isBuffer(p)?y+=p.length:y+=r.byteLength(p);if(u&&"number"!=typeof f)return e.emit("error",new Error("Invalid messageId")),!1;u&&(y+=2);let b=null;if(5===s){if(!(b=S(e,g)))return!1;y+=b.length}e.write(n.PUBLISH_HEADER[u][a.dup?1:0][h?1:0]),v(e,y),d(e,x(l)),e.write(l),u>0&&d(e,f);null!=b&&b.write();return c("publish: payload: %o",p),e.write(p)}(t,e,s);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(t,e,i){const o=i?i.protocolVersion:4,s=t||{},a=s.cmd||"puback",c=s.messageId,u=s.dup&&"pubrel"===a?n.DUP_MASK:0;let h=0;const l=s.reasonCode,p=s.properties;let f=5===o?3:2;"pubrel"===a&&(h=1);if("number"!=typeof c)return e.emit("error",new Error("Invalid messageId")),!1;let g=null;if(5===o&&"object"==typeof p){if(!(g=k(e,p,i,f)))return!1;f+=g.length}e.write(n.ACKS[a][h][u][0]),v(e,f),d(e,c),5===o&&e.write(r.from([l]));null!==g&&g.write();return!0}(t,e,s);case"subscribe":return function(t,e,i){c("subscribe: packet: ");const o=i?i.protocolVersion:4,s=t||{},a=s.dup?n.DUP_MASK:0,u=s.messageId,h=s.subscriptions,l=s.properties;let p=0;if("number"!=typeof u)return e.emit("error",new Error("Invalid messageId")),!1;p+=2;let f=null;if(5===o){if(!(f=S(e,l)))return!1;p+=f.length}if("object"!=typeof h||!h.length)return e.emit("error",new Error("Invalid subscriptions")),!1;for(let t=0;t<h.length;t+=1){const n=h[t].topic,i=h[t].qos;if("string"!=typeof n)return e.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof i)return e.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===o){const r=h[t].nl||!1;if("boolean"!=typeof r)return e.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;const n=h[t].rap||!1;if("boolean"!=typeof n)return e.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const i=h[t].rh||0;if("number"!=typeof i||i>2)return e.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}p+=r.byteLength(n)+2+1}c("subscribe: writing to stream: %o",n.SUBSCRIBE_HEADER),e.write(n.SUBSCRIBE_HEADER[1][a?1:0][0]),v(e,p),d(e,u),null!==f&&f.write();let g=!0;for(const t of h){const i=t.topic,s=t.qos,a=+t.nl,c=+t.rap,u=t.rh;let h;_(e,i),h=n.SUBSCRIBE_OPTIONS_QOS[s],5===o&&(h|=a?n.SUBSCRIBE_OPTIONS_NL:0,h|=c?n.SUBSCRIBE_OPTIONS_RAP:0,h|=u?n.SUBSCRIBE_OPTIONS_RH[u]:0),g=e.write(r.from([h]))}return g}(t,e,s);case"suback":return function(t,e,i){const o=i?i.protocolVersion:4,s=t||{},a=s.messageId,c=s.granted,u=s.properties;let h=0;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;h+=2;if("object"!=typeof c||!c.length)return e.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<c.length;t+=1){if("number"!=typeof c[t])return e.emit("error",new Error("Invalid qos vector")),!1;h+=1}let l=null;if(5===o){if(!(l=k(e,u,i,h)))return!1;h+=l.length}e.write(n.SUBACK_HEADER),v(e,h),d(e,a),null!==l&&l.write();return e.write(r.from(c))}(t,e,s);case"unsubscribe":return function(t,e,i){const o=i?i.protocolVersion:4,s=t||{},a=s.messageId,c=s.dup?n.DUP_MASK:0,u=s.unsubscriptions,h=s.properties;let l=0;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;l+=2;if("object"!=typeof u||!u.length)return e.emit("error",new Error("Invalid unsubscriptions")),!1;for(let t=0;t<u.length;t+=1){if("string"!=typeof u[t])return e.emit("error",new Error("Invalid unsubscriptions")),!1;l+=r.byteLength(u[t])+2}let p=null;if(5===o){if(!(p=S(e,h)))return!1;l+=p.length}e.write(n.UNSUBSCRIBE_HEADER[1][c?1:0][0]),v(e,l),d(e,a),null!==p&&p.write();let f=!0;for(let t=0;t<u.length;t++)f=_(e,u[t]);return f}(t,e,s);case"unsuback":return function(t,e,i){const o=i?i.protocolVersion:4,s=t||{},a=s.messageId,c=s.dup?n.DUP_MASK:0,u=s.granted,h=s.properties,l=s.cmd;let p=2;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;if(5===o){if("object"!=typeof u||!u.length)return e.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<u.length;t+=1){if("number"!=typeof u[t])return e.emit("error",new Error("Invalid qos vector")),!1;p+=1}}let f=null;if(5===o){if(!(f=k(e,h,i,p)))return!1;p+=f.length}e.write(n.ACKS[l][0][c][0]),v(e,p),d(e,a),null!==f&&f.write();5===o&&e.write(r.from(u));return!0}(t,e,s);case"pingreq":case"pingresp":return function(t,e,r){return e.write(n.EMPTY[t.cmd])}(t,e);case"disconnect":return function(t,e,i){const o=i?i.protocolVersion:4,s=t||{},a=s.reasonCode,c=s.properties;let u=5===o?1:0,h=null;if(5===o){if(!(h=k(e,c,i,u)))return!1;u+=h.length}e.write(r.from([n.codes.disconnect<<4])),v(e,u),5===o&&e.write(r.from([a]));null!==h&&h.write();return!0}(t,e,s);case"auth":return function(t,e,i){const o=i?i.protocolVersion:4,s=t||{},a=s.reasonCode,c=s.properties;let u=5===o?1:0;5!==o&&e.emit("error",new Error("Invalid mqtt version for auth packet"));const h=k(e,c,i,u);if(!h)return!1;u+=h.length,e.write(r.from([n.codes.auth<<4])),v(e,u),e.write(r.from([a])),null!==h&&h.write();return!0}(t,e,s);default:return e.emit("error",new Error("Unknown command")),!1}}function b(t){t.uncork()}Object.defineProperty(y,"cacheNumbers",{get:()=>d===E,set(t){t?(u&&0!==Object.keys(u).length||(g=!0),d=E):(g=!1,d=C)}});const m={};function v(t,e){if(e>n.VARBYTEINT_MAX)return t.emit("error",new Error(`Invalid variable byte integer: ${e}`)),!1;let r=m[e];return r||(r=p(e),e<16384&&(m[e]=r)),c("writeVarByteInt: writing to stream: %o",r),t.write(r)}function _(t,e){const n=r.byteLength(e);return d(t,n),c("writeString: %s",e),t.write(e,"utf8")}function w(t,e,r){_(t,e),_(t,r)}function E(t,e){return c("writeNumberCached: number: %d",e),c("writeNumberCached: %o",u[e]),t.write(u[e])}function C(t,e){const r=h(e);return c("writeNumberGenerated: %o",r),t.write(r)}function O(t,e){"string"==typeof e?_(t,e):e?(d(t,e.length),t.write(e)):d(t,0)}function S(t,e){if("object"!=typeof e||null!=e.length)return{length:1,write(){j(t,{},0)}};let i=0;function o(e,i){let o=0;switch(n.propertiesTypes[e]){case"byte":if("boolean"!=typeof i)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;o+=2;break;case"int8":if("number"!=typeof i||i<0||i>255)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;o+=2;break;case"binary":if(i&&null===i)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;o+=1+r.byteLength(i)+2;break;case"int16":if("number"!=typeof i||i<0||i>65535)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;o+=3;break;case"int32":if("number"!=typeof i||i<0||i>4294967295)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;o+=5;break;case"var":if("number"!=typeof i||i<0||i>268435455)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;o+=1+r.byteLength(p(i));break;case"string":if("string"!=typeof i)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;o+=3+r.byteLength(i.toString());break;case"pair":if("object"!=typeof i)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;o+=Object.getOwnPropertyNames(i).reduce((t,e)=>{const n=i[e];return Array.isArray(n)?t+=n.reduce((t,n)=>t+=3+r.byteLength(e.toString())+2+r.byteLength(n.toString()),0):t+=3+r.byteLength(e.toString())+2+r.byteLength(i[e].toString()),t},0);break;default:return t.emit("error",new Error(`Invalid property ${e}: ${i}`)),!1}return o}if(e)for(const t in e){let r=0,n=0;const s=e[t];if(Array.isArray(s))for(let e=0;e<s.length;e++){if(!(n=o(t,s[e])))return!1;r+=n}else{if(!(n=o(t,s)))return!1;r=n}if(!r)return!1;i+=r}return{length:r.byteLength(p(i))+i,write(){j(t,e,i)}}}function k(t,e,r,n){const i=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0;let s=S(t,e);if(o)for(;n+s.length>o;){const r=i.shift();if(!r||!e[r])return!1;delete e[r],s=S(t,e)}return s}function A(t,e,i){switch(n.propertiesTypes[e]){case"byte":t.write(r.from([n.properties[e]])),t.write(r.from([+i]));break;case"int8":t.write(r.from([n.properties[e]])),t.write(r.from([i]));break;case"binary":t.write(r.from([n.properties[e]])),O(t,i);break;case"int16":t.write(r.from([n.properties[e]])),d(t,i);break;case"int32":t.write(r.from([n.properties[e]])),function(t,e){const r=f(e);c("write4ByteNumber: %o",r),t.write(r)}(t,i);break;case"var":t.write(r.from([n.properties[e]])),v(t,i);break;case"string":t.write(r.from([n.properties[e]])),_(t,i);break;case"pair":Object.getOwnPropertyNames(i).forEach(o=>{const s=i[o];Array.isArray(s)?s.forEach(i=>{t.write(r.from([n.properties[e]])),w(t,o.toString(),i.toString())}):(t.write(r.from([n.properties[e]])),w(t,o.toString(),s.toString()))});break;default:return t.emit("error",new Error(`Invalid property ${e} value: ${i}`)),!1}}function j(t,e,r){v(t,r);for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&null!==e[r]){const n=e[r];if(Array.isArray(n))for(let e=0;e<n.length;e++)A(t,r,n[e]);else A(t,r,n)}}function x(t){return t?t instanceof r?t.length:r.byteLength(t):0}function P(t){return"string"==typeof t||t instanceof r}e.exports=y}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":52,"./numbers":55,buffer:17,debug:45,"process-nextick-args":63}],59:[function(t,e,r){var n=1e3,i=60*n,o=60*i,s=24*o,a=7*s,c=365.25*s;function u(t,e,r,n){var i=e>=1.5*r;return Math.round(t/r)+" "+n+(i?"s":"")}e.exports=function(t,e){e=e||{};var r=typeof t;if("string"===r&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*o;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(t);if("number"===r&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=s)return u(t,e,s,"day");if(e>=o)return u(t,e,o,"hour");if(e>=i)return u(t,e,i,"minute");if(e>=n)return u(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=s)return Math.round(t/s)+"d";if(e>=o)return Math.round(t/o)+"h";if(e>=i)return Math.round(t/i)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},{}],60:[function(t,e,r){const n=t("./lib/number-allocator.js");e.exports.NumberAllocator=n},{"./lib/number-allocator.js":61}],61:[function(t,e,r){"use strict";const n=t("collections/sorted-set"),i=t("debug")("number-allocator:trace"),o=t("debug")("number-allocator:error");function s(t,e){this.low=t,this.high=e}function a(t,e){if(!(this instanceof a))return new a(t,e);this.min=t,this.max=e,this.ss=new n,i("Create"),this.clear()}s.prototype.equals=function(t){return this.low===t.low&&this.high===t.high},s.prototype.compare=function(t){return this.low<t.low&&this.high<t.low?-1:t.low<this.low&&t.high<this.low?1:0},a.prototype.firstVacant=function(){return 0===this.ss.length?null:this.ss.min().low},a.prototype.alloc=function(){if(0===this.ss.length)return i("alloc():empty"),null;const t=this.ss.min(),e=t.low;return e+1<=t.high?++t.low:this.ss.shift(),i("alloc():"+e),e},a.prototype.use=function(t){const e=new s(t,t),r=this.ss.findLeastGreaterThanOrEqual(e);if(r){if(r.value.equals(e))return this.ss.delete(r.value),i("use():"+t),!0;if(r.value.low>t)return!1;if(r.value.low===t)return++r.value.low,i("use():"+t),!0;if(r.value.high===t)return--r.value.high,i("use():"+t),!0;const n=r.value.low;return r.value.low=t+1,this.ss.push(new s(n,t-1)),i("use():"+t),!0}return i("use():failed"),!1},a.prototype.free=function(t){if(t<this.min||t>this.max)return void o("free():"+t+" is out of range");const e=new s(t,t),r=this.ss.findLeastGreaterThanOrEqual(e);if(r){if(r.value.low<=t&&t<=r.value.high)return void o("free():"+t+" has already been vacant");if(r===this.ss.findLeast())t+1===r.value.low?--r.value.low:this.ss.push(e);else{const n=this.ss.findGreatestLessThan(e);n.value.high+1===t?t+1===r.value.low?(this.ss.delete(n.value),r.value.low=n.value.low):n.value.high=t:t+1===r.value.low?r.value.low=t:this.ss.push(e)}}else{if(r===this.ss.findLeast())return void this.ss.push(e);const n=this.ss.findGreatestLessThan(e);n.value.high+1===t?n.value.high=t:this.ss.push(e)}i("free():"+t)},a.prototype.clear=function(){i("clear()"),this.ss.clear(),this.ss.push(new s(this.min,this.max))},a.prototype.intervalCount=function(){return this.ss.length},a.prototype.dump=function(){console.log("length:"+this.ss.length);const t=this.ss.iterator();let e=t.next();for(;e.value;)console.log(e.value),e=t.next()},e.exports=a},{"collections/sorted-set":42,debug:45}],62:[function(t,e,r){var n=t("wrappy");function i(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function o(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}e.exports=n(i),e.exports.strict=n(o),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},{wrappy:94}],63:[function(t,e,r){(function(t){(function(){"use strict";void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return t.nextTick(function(){e.apply(null,o)})}}}:e.exports=t}).call(this)}).call(this,t("_process"))},{_process:64}],64:[function(t,e,r){var n,i,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var u,h=[],l=!1,p=-1;function f(){l&&u&&(l=!1,u.length?h=u.concat(h):p=-1,h.length&&d())}function d(){if(!l){var t=c(f);l=!0;for(var e=h.length;e;){for(u=h,h=[];++p<e;)u&&u[p].run();p=-1,e=h.length}u=null,l=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];h.push(new g(t,e)),1!==h.length||l||c(d)},g.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],65:[function(t,e,r){(function(t){(function(){!function(n){var i="object"==typeof r&&r&&!r.nodeType&&r,o="object"==typeof e&&e&&!e.nodeType&&e,s="object"==typeof t&&t;s.global!==s&&s.window!==s&&s.self!==s||(n=s);var a,c,u=2147483647,h=36,l=1,p=26,f=38,d=700,g=72,y=128,b="-",m=/^xn--/,v=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=h-l,C=Math.floor,O=String.fromCharCode;function S(t){throw new RangeError(w[t])}function k(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function A(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+k((t=t.replace(_,".")).split("."),e).join(".")}function j(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function x(t){return k(t,function(t){var e="";return t>65535&&(e+=O((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=O(t)}).join("")}function P(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function I(t,e,r){var n=0;for(t=r?C(t/d):t>>1,t+=C(t/e);t>E*p>>1;n+=h)t=C(t/E);return C(n+(E+1)*t/(t+f))}function R(t){var e,r,n,i,o,s,a,c,f,d,m,v=[],_=t.length,w=0,E=y,O=g;for((r=t.lastIndexOf(b))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&S("not-basic"),v.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<_;){for(o=w,s=1,a=h;i>=_&&S("invalid-input"),((c=(m=t.charCodeAt(i++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:h)>=h||c>C((u-w)/s))&&S("overflow"),w+=c*s,!(c<(f=a<=O?l:a>=O+p?p:a-O));a+=h)s>C(u/(d=h-f))&&S("overflow"),s*=d;O=I(w-o,e=v.length+1,0==o),C(w/e)>u-E&&S("overflow"),E+=C(w/e),w%=e,v.splice(w++,0,E)}return x(v)}function T(t){var e,r,n,i,o,s,a,c,f,d,m,v,_,w,E,k=[];for(v=(t=j(t)).length,e=y,r=0,o=g,s=0;s<v;++s)(m=t[s])<128&&k.push(O(m));for(n=i=k.length,i&&k.push(b);n<v;){for(a=u,s=0;s<v;++s)(m=t[s])>=e&&m<a&&(a=m);for(a-e>C((u-r)/(_=n+1))&&S("overflow"),r+=(a-e)*_,e=a,s=0;s<v;++s)if((m=t[s])<e&&++r>u&&S("overflow"),m==e){for(c=r,f=h;!(c<(d=f<=o?l:f>=o+p?p:f-o));f+=h)E=c-d,w=h-d,k.push(O(P(d+E%w,0))),c=C(E/w);k.push(O(P(c,0))),o=I(r,_,n==i),r=0,++n}++r,++e}return k.join("")}if(a={version:"1.4.1",ucs2:{decode:j,encode:x},decode:R,encode:T,toASCII:function(t){return A(t,function(t){return v.test(t)?"xn--"+T(t):t})},toUnicode:function(t){return A(t,function(t){return m.test(t)?R(t.slice(4).toLowerCase()):t})}},i&&o)if(e.exports==i)o.exports=a;else for(c in a)a.hasOwnProperty(c)&&(i[c]=a[c]);else n.punycode=a}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],66:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,o){e=e||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var u=t.length;c>0&&u>c&&(u=c);for(var h=0;h<u;++h){var l,p,f,d,g=t[h].replace(a,"%20"),y=g.indexOf(r);y>=0?(l=g.substr(0,y),p=g.substr(y+1)):(l=g,p=""),f=decodeURIComponent(l),d=decodeURIComponent(p),n(s,f)?i(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],67:[function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?o(s(t),function(s){var a=encodeURIComponent(n(s))+r;return i(t[s])?o(t[s],function(t){return a+encodeURIComponent(n(t))}).join(e):a+encodeURIComponent(n(t[s]))}).join(e):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var s=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},{}],68:[function(t,e,r){"use strict";r.decode=r.parse=t("./decode"),r.encode=r.stringify=t("./encode")},{"./decode":66,"./encode":67}],69:[function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(t){return String(t)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(t,e,r){var n,i,s,a;if("string"==typeof e&&(i="not ",e.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var c=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(c," ").concat(n," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},{}],70:[function(t,e,r){(function(r){(function(){"use strict";var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=u;var i=t("./_stream_readable"),o=t("./_stream_writable");t("inherits")(u,i);for(var s=n(o.prototype),a=0;a<s.length;a++){var c=s[a];u.prototype[c]||(u.prototype[c]=o.prototype[c])}function u(t){if(!(this instanceof u))return new u(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||r.nextTick(l,this)}function l(t){t.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this)}).call(this,t("_process"))},{"./_stream_readable":72,"./_stream_writable":74,_process:64,inherits:51}],71:[function(t,e,r){"use strict";e.exports=i;var n=t("./_stream_transform");function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}t("inherits")(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},{"./_stream_transform":73,inherits:51}],72:[function(t,e,r){(function(r,n){(function(){"use strict";var i;e.exports=S,S.ReadableState=O;t("events").EventEmitter;var o=function(t,e){return t.listeners(e).length},s=t("./internal/streams/stream"),a=t("buffer").Buffer,c=n.Uint8Array||function(){};var u,h=t("util");u=h&&h.debuglog?h.debuglog("stream"):function(){};var l,p,f,d=t("./internal/streams/buffer_list"),g=t("./internal/streams/destroy"),y=t("./internal/streams/state").getHighWaterMark,b=t("../errors").codes,m=b.ERR_INVALID_ARG_TYPE,v=b.ERR_STREAM_PUSH_AFTER_EOF,_=b.ERR_METHOD_NOT_IMPLEMENTED,w=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;t("inherits")(S,s);var E=g.errorOrDestroy,C=["error","close","destroy","pause","resume"];function O(e,r,n){i=i||t("./_stream_duplex"),e=e||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=y(this,e,"readableHighWaterMark",n),this.buffer=new d,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=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=t("string_decoder/").StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function S(e){if(i=i||t("./_stream_duplex"),!(this instanceof S))return new S(e);var r=this instanceof i;this._readableState=new O(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function k(t,e,r,n,i){u("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(u("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?P(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,I(t)))}(t,s);else if(i||(o=function(t,e){var r;n=e,a.isBuffer(n)||n instanceof c||"string"==typeof e||void 0===e||t.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(s,e)),o)E(t,o);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),n)s.endEmitted?E(t,new w):A(t,s,e,!0);else if(s.ended)E(t,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?A(t,s,e,!1):R(t,s)):A(t,s,e,!1)}else n||(s.reading=!1,R(t,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function A(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&P(t)),R(t,e)}Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),S.prototype.destroy=g.destroy,S.prototype._undestroy=g.undestroy,S.prototype._destroy=function(t,e){e(t)},S.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=a.from(t,e),e=""),r=!0),k(this,t,e,!1,r)},S.prototype.unshift=function(t){return k(this,t,null,!0,!1)},S.prototype.isPaused=function(){return!1===this._readableState.flowing},S.prototype.setEncoding=function(e){l||(l=t("string_decoder/").StringDecoder);var r=new l(e);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var j=1073741824;function x(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=j?t=j:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function P(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(I,t))}function I(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function R(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(T,t,e))}function T(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(u("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function M(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){u("readable nexttick read 0"),t.read(0)}function B(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function q(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function U(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(D,e,t))}function D(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function F(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}S.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):P(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&U(this),null;var n,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",i=!0),e.ended||e.reading?u("reading or ended",i=!1):i&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=x(r,e))),null===(n=t>0?q(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&U(this)),null!==n&&this.emit("data",n),n},S.prototype._read=function(t){E(this,new _("_read()"))},S.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var s=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:y;function a(e,r){u("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",d),t.removeListener("finish",g),t.removeListener("drain",h),t.removeListener("error",f),t.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",y),n.removeListener("data",p),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function c(){u("onend"),t.end()}i.endEmitted?r.nextTick(s):n.once("end",s),t.on("unpipe",a);var h=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",h);var l=!1;function p(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!l&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function f(e){u("onerror",e),y(),t.removeListener("error",f),0===o(t,"error")&&E(t,e)}function d(){t.removeListener("finish",g),y()}function g(){u("onfinish"),t.removeListener("close",d),y()}function y(){u("unpipe"),n.unpipe(t)}return n.on("data",p),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",f),t.once("close",d),t.once("finish",g),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=F(e.pipes,t);return-1===s?this:(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)},S.prototype.on=function(t,e){var n=s.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?P(this):i.reading||r.nextTick(L,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=s.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(M,this),n},S.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(M,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(B,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),!r.objectMode||null!==i&&void 0!==i)&&((r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause())))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<C.length;o++)t.on(C[o],this.emit.bind(this,C[o]));return this._read=function(e){u("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(S.prototype[Symbol.asyncIterator]=function(){return void 0===p&&(p=t("./internal/streams/async_iterator")),p(this)}),Object.defineProperty(S.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(S.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(S.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),S._fromList=q,Object.defineProperty(S.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(S.from=function(e,r){return void 0===f&&(f=t("./internal/streams/from")),f(S,e,r)})}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":69,"./_stream_duplex":70,"./internal/streams/async_iterator":75,"./internal/streams/buffer_list":76,"./internal/streams/destroy":77,"./internal/streams/from":79,"./internal/streams/state":81,"./internal/streams/stream":82,_process:64,buffer:17,events:49,inherits:51,"string_decoder/":89,util:16}],73:[function(t,e,r){"use strict";e.exports=u;var n=t("../errors").codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,c=t("./_stream_duplex");function u(t){if(!(this instanceof u))return new u(t);c.call(this,t),this._transformState={afterTransform:function(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush(function(e,r){l(t,e,r)})}function l(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new a;if(t._transformState.transforming)throw new s;return t.push(null)}t("inherits")(u,c),u.prototype.push=function(t,e){return this._transformState.needTransform=!1,c.prototype.push.call(this,t,e)},u.prototype._transform=function(t,e,r){r(new i("_transform()"))},u.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},u.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},u.prototype._destroy=function(t,e){c.prototype._destroy.call(this,t,function(t){e(t)})}},{"../errors":69,"./_stream_duplex":70,inherits:51}],74:[function(t,e,r){(function(r,n){(function(){"use strict";function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;e.exports=S,S.WritableState=O;var s={deprecate:t("util-deprecate")},a=t("./internal/streams/stream"),c=t("buffer").Buffer,u=n.Uint8Array||function(){};var h,l=t("./internal/streams/destroy"),p=t("./internal/streams/state").getHighWaterMark,f=t("../errors").codes,d=f.ERR_INVALID_ARG_TYPE,g=f.ERR_METHOD_NOT_IMPLEMENTED,y=f.ERR_MULTIPLE_CALLBACK,b=f.ERR_STREAM_CANNOT_PIPE,m=f.ERR_STREAM_DESTROYED,v=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,w=f.ERR_UNKNOWN_ENCODING,E=l.errorOrDestroy;function C(){}function O(e,n,s){o=o||t("./_stream_duplex"),e=e||{},"boolean"!=typeof s&&(s=n instanceof o),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=p(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new y;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(I,t,e),t._writableState.errorEmitted=!0,E(t,i)):(o(i),t._writableState.errorEmitted=!0,E(t,i),I(t,e))}(t,n,i,e,o);else{var s=x(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||j(t,n),i?r.nextTick(A,t,n,s,o):A(t,n,s,o)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function S(e){var r=this instanceof(o=o||t("./_stream_duplex"));if(!r&&!h.call(S,this))return new S(e);this._writableState=new O(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),a.call(this)}function k(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new m("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function A(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),I(t,e)}function j(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)o[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;o.allBuffers=c,k(t,e,!0,e.length,o,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,h=r.encoding,l=r.callback;if(k(t,e,!1,e.objectMode?1:u.length,u,h,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function x(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final(function(r){e.pendingcb--,r&&E(t,r),e.prefinished=!0,t.emit("prefinish"),I(t,e)})}function I(t,e){var n=x(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}t("inherits")(S,a),O.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(O.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===S&&(t&&t._writableState instanceof O)}})):h=function(t){return t instanceof this},S.prototype.pipe=function(){E(this,new b)},S.prototype.write=function(t,e,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=t,c.isBuffer(i)||i instanceof u);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=C),o.ending?function(t,e){var n=new _;E(t,n),r.nextTick(e,n)}(this,n):(a||function(t,e,n,i){var o;return null===n?o=new v:"string"==typeof n||e.objectMode||(o=new d("chunk",["string","Buffer"],n)),!o||(E(t,o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else k(t,e,!1,a,n,i,o);return u}(this,o,a,t,e,n)),s},S.prototype.cork=function(){this._writableState.corked++},S.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||j(this,t))},S.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,r){r(new g("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,I(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":69,"./_stream_duplex":70,"./internal/streams/destroy":77,"./internal/streams/state":81,"./internal/streams/stream":82,_process:64,buffer:17,inherits:51,"util-deprecate":92}],75:[function(t,e,r){(function(r){(function(){"use strict";var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("./end-of-stream"),s=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),h=Symbol("lastPromise"),l=Symbol("handlePromise"),p=Symbol("stream");function f(t,e){return{value:t,done:e}}function d(t){var e=t[s];if(null!==e){var r=t[p].read();null!==r&&(t[h]=null,t[s]=null,t[a]=null,e(f(r,!1)))}}var g=Object.getPrototypeOf(function(){}),y=Object.setPrototypeOf((i(n={get stream(){return this[p]},next:function(){var t=this,e=this[c];if(null!==e)return Promise.reject(e);if(this[u])return Promise.resolve(f(void 0,!0));if(this[p].destroyed)return new Promise(function(e,n){r.nextTick(function(){t[c]?n(t[c]):e(f(void 0,!0))})});var n,i=this[h];if(i)n=new Promise(function(t,e){return function(r,n){t.then(function(){e[u]?r(f(void 0,!0)):e[l](r,n)},n)}}(i,this));else{var o=this[p].read();if(null!==o)return Promise.resolve(f(o,!1));n=new Promise(this[l])}return this[h]=n,n}},Symbol.asyncIterator,function(){return this}),i(n,"return",function(){var t=this;return new Promise(function(e,r){t[p].destroy(null,function(t){t?r(t):e(f(void 0,!0))})})}),n),g);e.exports=function(t){var e,n=Object.create(y,(i(e={},p,{value:t,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,c,{value:null,writable:!0}),i(e,u,{value:t._readableState.endEmitted,writable:!0}),i(e,l,{value:function(t,e){var r=n[p].read();r?(n[h]=null,n[s]=null,n[a]=null,t(f(r,!1))):(n[s]=t,n[a]=e)},writable:!0}),e));return n[h]=null,o(t,function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[a];return null!==e&&(n[h]=null,n[s]=null,n[a]=null,e(t)),void(n[c]=t)}var r=n[s];null!==r&&(n[h]=null,n[s]=null,n[a]=null,r(f(void 0,!0))),n[u]=!0}),t.on("readable",function(t){r.nextTick(d,t)}.bind(null,n)),n}}).call(this)}).call(this,t("_process"))},{"./end-of-stream":78,_process:64}],76:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=t("buffer").Buffer,a=t("util").inspect,c=a&&a.custom||"inspect";e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r,u;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,s.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0===(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0===(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:c,value:function(t,e){return a(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),u&&o(e,u),t}()},{buffer:17,util:16}],77:[function(t,e,r){(function(t){(function(){"use strict";function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}e.exports={destroy:function(e,o){var s=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(o?o(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(i,this,e)):t.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!o&&e?s._writableState?s._writableState.errorEmitted?t.nextTick(n,s):(s._writableState.errorEmitted=!0,t.nextTick(r,s,e)):t.nextTick(r,s,e):o?(t.nextTick(n,s),o(e)):t.nextTick(n,s)}),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(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this)}).call(this,t("_process"))},{_process:64}],78:[function(t,e,r){"use strict";var n=t("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&e.readable,a=r.writable||!1!==r.writable&&e.writable,c=function(){e.writable||h()},u=e._writableState&&e._writableState.finished,h=function(){a=!1,u=!0,s||o.call(e)},l=e._readableState&&e._readableState.endEmitted,p=function(){s=!1,l=!0,a||o.call(e)},f=function(t){o.call(e,t)},d=function(){var t;return s&&!l?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):a&&!u?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},g=function(){e.req.on("finish",h)};return function(t){return t.setHeader&&"function"==typeof t.abort}(e)?(e.on("complete",h),e.on("abort",d),e.req?g():e.on("request",g)):a&&!e._writableState&&(e.on("end",c),e.on("close",c)),e.on("end",p),e.on("finish",h),!1!==r.error&&e.on("error",f),e.on("close",d),function(){e.removeListener("complete",h),e.removeListener("abort",d),e.removeListener("request",g),e.req&&e.req.removeListener("finish",h),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",h),e.removeListener("end",p),e.removeListener("error",f),e.removeListener("close",d)}}},{"../../../errors":69}],79:[function(t,e,r){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],80:[function(t,e,r){"use strict";var n;var i=t("../../../errors").codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function c(t){t()}function u(t,e){return t.pipe(e)}e.exports=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var h,l=function(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}(r);if(Array.isArray(r[0])&&(r=r[0]),r.length<2)throw new o("streams");var p=r.map(function(e,i){var o=i<r.length-1;return function(e,r,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;e.on("close",function(){a=!0}),void 0===n&&(n=t("./end-of-stream")),n(e,{readable:r,writable:i},function(t){if(t)return o(t);a=!0,o()});var c=!1;return function(t){if(!a&&!c)return c=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new s("pipe"))}}(e,o,i>0,function(t){h||(h=t),t&&p.forEach(c),o||(p.forEach(c),l(h))})});return r.reduce(u)}},{"../../../errors":69,"./end-of-stream":78}],81:[function(t,e,r){"use strict";var n=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},{"../../../errors":69}],82:[function(t,e,r){e.exports=t("events").EventEmitter},{events:49}],83:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js"),r.finished=t("./lib/internal/streams/end-of-stream.js"),r.pipeline=t("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":70,"./lib/_stream_passthrough.js":71,"./lib/_stream_readable.js":72,"./lib/_stream_transform.js":73,"./lib/_stream_writable.js":74,"./lib/internal/streams/end-of-stream.js":78,"./lib/internal/streams/pipeline.js":80}],84:[function(t,e,r){"use strict";e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e<t.length;e++)t[e]=arguments[e+2]}return new function(t,e,r){var n=this;this._callback=t,this._args=r,this._interval=setInterval(t,e,this._args),this.reschedule=function(t){t||(t=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,t,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}(arguments[0],arguments[1],t)}},{}],85:[function(t,e,r){"use strict";e.exports=t("./index.js")()},{"./index.js":86}],86:[function(t,e,r){(function(t){(function(){"use strict";function r(e){return e instanceof t?t.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}e.exports=function(t){return(t=t||{}).circles?function(t){var e=[],n=[];return t.proto?function t(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return i(o,t);if(o instanceof Map)return new Map(i(Array.from(o),t));if(o instanceof Set)return new Set(i(Array.from(o),t));var s={};for(var a in e.push(o),n.push(s),o){var c=o[a];if("object"!=typeof c||null===c)s[a]=c;else if(c instanceof Date)s[a]=new Date(c);else if(c instanceof Map)s[a]=new Map(i(Array.from(c),t));else if(c instanceof Set)s[a]=new Set(i(Array.from(c),t));else if(ArrayBuffer.isView(c))s[a]=r(c);else{var u=e.indexOf(c);s[a]=-1!==u?n[u]:t(c)}}return e.pop(),n.pop(),s}:function t(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return i(o,t);if(o instanceof Map)return new Map(i(Array.from(o),t));if(o instanceof Set)return new Set(i(Array.from(o),t));var s={};for(var a in e.push(o),n.push(s),o)if(!1!==Object.hasOwnProperty.call(o,a)){var c=o[a];if("object"!=typeof c||null===c)s[a]=c;else if(c instanceof Date)s[a]=new Date(c);else if(c instanceof Map)s[a]=new Map(i(Array.from(c),t));else if(c instanceof Set)s[a]=new Set(i(Array.from(c),t));else if(ArrayBuffer.isView(c))s[a]=r(c);else{var u=e.indexOf(c);s[a]=-1!==u?n[u]:t(c)}}return e.pop(),n.pop(),s};function i(t,i){for(var o=Object.keys(t),s=new Array(o.length),a=0;a<o.length;a++){var c=o[a],u=t[c];if("object"!=typeof u||null===u)s[c]=u;else if(u instanceof Date)s[c]=new Date(u);else if(ArrayBuffer.isView(u))s[c]=r(u);else{var h=e.indexOf(u);s[c]=-1!==h?n[h]:i(u)}}return s}}(t):t.proto?function t(n){if("object"!=typeof n||null===n)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return e(n,t);if(n instanceof Map)return new Map(e(Array.from(n),t));if(n instanceof Set)return new Set(e(Array.from(n),t));var i={};for(var o in n){var s=n[o];"object"!=typeof s||null===s?i[o]=s:s instanceof Date?i[o]=new Date(s):s instanceof Map?i[o]=new Map(e(Array.from(s),t)):s instanceof Set?i[o]=new Set(e(Array.from(s),t)):ArrayBuffer.isView(s)?i[o]=r(s):i[o]=t(s)}return i}:function t(n){if("object"!=typeof n||null===n)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return e(n,t);if(n instanceof Map)return new Map(e(Array.from(n),t));if(n instanceof Set)return new Set(e(Array.from(n),t));var i={};for(var o in n)if(!1!==Object.hasOwnProperty.call(n,o)){var s=n[o];"object"!=typeof s||null===s?i[o]=s:s instanceof Date?i[o]=new Date(s):s instanceof Map?i[o]=new Map(e(Array.from(s),t)):s instanceof Set?i[o]=new Set(e(Array.from(s),t)):ArrayBuffer.isView(s)?i[o]=r(s):i[o]=t(s)}return i};function e(t,e){for(var n=Object.keys(t),i=new Array(n.length),o=0;o<n.length;o++){var s=n[o],a=t[s];"object"!=typeof a||null===a?i[s]=a:a instanceof Date?i[s]=new Date(a):ArrayBuffer.isView(a)?i[s]=r(a):i[s]=e(a)}return i}}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:17}],87:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,r),r.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:17}],88:[function(t,e,r){e.exports=function(t){var e=t._readableState;return e?e.objectMode||"number"==typeof t._duplexState?t.read():t.read((r=e,r.buffer.length?r.buffer.head?r.buffer.head.data.length:r.buffer[0].length:r.length)):null;var r}},{}],89:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=l,e=3;break;default:return this.write=p,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function p(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}r.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=s(e[n]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=s(e[n]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=s(e[n]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":87}],90:[function(t,e,r){"use strict";var n=t("punycode"),i=t("./util");function o(){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}r.parse=v,r.resolve=function(t,e){return v(t,!1,!0).resolve(e)},r.resolveObject=function(t,e){return t?v(t,!1,!0).resolveObject(e):e},r.format=function(t){i.isString(t)&&(t=v(t));return t instanceof o?t.format():o.prototype.format.call(t)},r.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),h=["'"].concat(u),l=["%","/","?",";","#"].concat(h),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=t("querystring");function v(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),a=-1!==o&&o<t.indexOf("#")?"?":"#",u=t.split(a);u[0]=u[0].replace(/\\/g,"/");var v=t=u.join(a);if(v=v.trim(),!r&&1===t.split("#").length){var _=c.exec(v);if(_)return this.path=v,this.href=v,this.pathname=_[1],_[2]?(this.search=_[2],this.query=e?m.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var w=s.exec(v);if(w){var E=(w=w[0]).toLowerCase();this.protocol=E,v=v.substr(w.length)}if(r||w||v.match(/^\/\/[^@\/]+@[^@\/]+/)){var C="//"===v.substr(0,2);!C||w&&y[w]||(v=v.substr(2),this.slashes=!0)}if(!y[w]&&(C||w&&!b[w])){for(var O,S,k=-1,A=0;A<p.length;A++){-1!==(j=v.indexOf(p[A]))&&(-1===k||j<k)&&(k=j)}-1!==(S=-1===k?v.lastIndexOf("@"):v.lastIndexOf("@",k))&&(O=v.slice(0,S),v=v.slice(S+1),this.auth=decodeURIComponent(O)),k=-1;for(A=0;A<l.length;A++){var j;-1!==(j=v.indexOf(l[A]))&&(-1===k||j<k)&&(k=j)}-1===k&&(k=v.length),this.host=v.slice(0,k),v=v.slice(k),this.parseHost(),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x)for(var P=this.hostname.split(/\./),I=(A=0,P.length);A<I;A++){var R=P[A];if(R&&!R.match(f)){for(var T="",M=0,L=R.length;M<L;M++)R.charCodeAt(M)>127?T+="x":T+=R[M];if(!T.match(f)){var B=P.slice(0,A),N=P.slice(A+1),q=R.match(d);q&&(B.push(q[1]),N.unshift(q[2])),N.length&&(v="/"+N.join(".")+v),this.hostname=B.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",D=this.hostname||"";this.host=D+U,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!g[E])for(A=0,I=h.length;A<I;A++){var F=h[A];if(-1!==v.indexOf(F)){var V=encodeURIComponent(F);V===F&&(V=escape(F)),v=v.split(F).join(V)}}var H=v.indexOf("#");-1!==H&&(this.hash=v.substr(H),v=v.slice(0,H));var z=v.indexOf("?");if(-1!==z?(this.search=v.substr(z),this.query=v.substr(z+1),e&&(this.query=m.parse(this.query)),v=v.slice(0,z)):e&&(this.search="",this.query={}),v&&(this.pathname=v),b[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){U=this.pathname||"";var W=this.search||"";this.path=U+W}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=m.stringify(this.query));var a=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||b[e])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),e+o+(r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(a=a.replace("#","%23"))+n},o.prototype.resolve=function(t){return this.resolveObject(v(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(i.isString(t)){var e=new o;e.parse(t,!1,!0),t=e}for(var r=new o,n=Object.keys(this),s=0;s<n.length;s++){var a=n[s];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var c=Object.keys(t),u=0;u<c.length;u++){var h=c[u];"protocol"!==h&&(r[h]=t[h])}return b[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!b[t.protocol]){for(var l=Object.keys(t),p=0;p<l.length;p++){var f=l[p];r[f]=t[f]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||y[t.protocol])r.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var g=r.pathname||"",m=r.search||"";r.path=g+m}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),_=t.host||t.pathname&&"/"===t.pathname.charAt(0),w=_||v||r.host&&t.pathname,E=w,C=r.pathname&&r.pathname.split("/")||[],O=(d=t.pathname&&t.pathname.split("/")||[],r.protocol&&!b[r.protocol]);if(O&&(r.hostname="",r.port=null,r.host&&(""===C[0]?C[0]=r.host:C.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),w=w&&(""===d[0]||""===C[0])),_)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,C=d;else if(d.length)C||(C=[]),C.pop(),C=C.concat(d),r.search=t.search,r.query=t.query;else if(!i.isNullOrUndefined(t.search)){if(O)r.hostname=r.host=C.shift(),(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!C.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=C.slice(-1)[0],k=(r.host||t.host||C.length>1)&&("."===S||".."===S)||""===S,A=0,j=C.length;j>=0;j--)"."===(S=C[j])?C.splice(j,1):".."===S?(C.splice(j,1),A++):A&&(C.splice(j,1),A--);if(!w&&!E)for(;A--;A)C.unshift("..");!w||""===C[0]||C[0]&&"/"===C[0].charAt(0)||C.unshift(""),k&&"/"!==C.join("/").substr(-1)&&C.push("");var x,P=""===C[0]||C[0]&&"/"===C[0].charAt(0);O&&(r.hostname=r.host=P?"":C.length?C.shift():"",(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift()));return(w=w||r.host&&C.length)&&!P&&C.unshift(""),C.length?r.pathname=C.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":91,punycode:65,querystring:68}],91:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],92:[function(t,e,r){(function(t){(function(){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],93:[function(t,e,r){!function(){"use strict";if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=y);var t=!1;if("function"==typeof WeakMap){var r=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var n=new r,i=Object.freeze({});if(n.set(i,1),1===n.get(i))return void(e.exports=WeakMap);t=!0}}Object.prototype.hasOwnProperty;var o=Object.getOwnPropertyNames,s=Object.defineProperty,a=Object.isExtensible,c="weakmap:",u=c+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var h=new ArrayBuffer(25),l=new Uint8Array(h);crypto.getRandomValues(l),u=c+"rand:"+Array.prototype.map.call(l,function(t){return(t%36).toString(36)}).join("")+"___"}if(s(Object,"getOwnPropertyNames",{value:function(t){return o(t).filter(b)}}),"getPropertyNames"in Object){var p=Object.getPropertyNames;s(Object,"getPropertyNames",{value:function(t){return p(t).filter(b)}})}!function(){var t=Object.freeze;s(Object,"freeze",{value:function(e){return m(e),t(e)}});var e=Object.seal;s(Object,"seal",{value:function(t){return m(t),e(t)}});var r=Object.preventExtensions;s(Object,"preventExtensions",{value:function(t){return m(t),r(t)}})}();var f=!1,d=0,g=function(){this instanceof g||_();var t=[],e=[],r=d++;return Object.create(g.prototype,{get___:{value:v(function(n,i){var o,s=m(n);return s?r in s?s[r]:i:(o=t.indexOf(n))>=0?e[o]:i})},has___:{value:v(function(e){var n=m(e);return n?r in n:t.indexOf(e)>=0})},set___:{value:v(function(n,i){var o,s=m(n);return s?s[r]=i:(o=t.indexOf(n))>=0?e[o]=i:(o=t.length,e[o]=i,t[o]=n),this})},delete___:{value:v(function(n){var i,o,s=m(n);return s?r in s&&delete s[r]:!((i=t.indexOf(n))<0||(o=t.length-1,t[i]=void 0,e[i]=e[o],t[i]=t[o],t.length=o,e.length=o,0))})}})};g.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof r?function(){function n(){this instanceof g||_();var e,n=new r,i=void 0,o=!1;return e=t?function(t,e){return n.set(t,e),n.has(t)||(i||(i=new g),i.set(t,e)),this}:function(t,e){if(o)try{n.set(t,e)}catch(r){i||(i=new g),i.set___(t,e)}else n.set(t,e);return this},Object.create(g.prototype,{get___:{value:v(function(t,e){return i?n.has(t)?n.get(t):i.get___(t,e):n.get(t,e)})},has___:{value:v(function(t){return n.has(t)||!!i&&i.has___(t)})},set___:{value:v(e)},delete___:{value:v(function(t){var e=!!n.delete(t);return i&&i.delete___(t)||e})},permitHostObjects___:{value:v(function(t){if(t!==y)throw new Error("bogus call to permitHostObjects___");o=!0})}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=g.prototype,e.exports=n,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=g)}function y(t){t.permitHostObjects___&&t.permitHostObjects___(y)}function b(t){return!(t.substr(0,c.length)==c&&"___"===t.substr(t.length-3))}function m(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[u];if(e&&e.key===t)return e;if(a(t)){e={key:t};try{return s(t,u,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function v(t){return t.prototype=null,Object.freeze(t)}function _(){f||"undefined"==typeof console||(f=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},{}],94:[function(t,e,r){e.exports=function t(e,r){if(e&&r)return t(e)(r);if("function"!=typeof e)throw new TypeError("need wrapper function");Object.keys(e).forEach(function(t){n[t]=e[t]});return n;function n(){for(var t=new Array(arguments.length),r=0;r<t.length;r++)t[r]=arguments[r];var n=e.apply(this,t),i=t[t.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach(function(t){n[t]=i[t]}),n}}},{}],95:[function(t,e,r){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],96:[function(t,e,r){e.exports=function(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var i in r)n.call(r,i)&&(t[i]=r[i])}return t};var n=Object.prototype.hasOwnProperty},{}]},{},[12])(12)});
|
|
1
|
+
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).mqtt=e()}}(function(){return function(){return function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[s]={exports:{}};t[s][0].call(c.exports,function(e){return i(t[s][1][e]||e)},c,c.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}}()({1:[function(e,t,r){(function(r,n){(function(){"use strict";const i=e("events").EventEmitter,o=e("./store"),s=e("./topic-alias-recv"),a=e("./topic-alias-send"),l=e("mqtt-packet"),u=e("./default-message-id-provider"),c=e("readable-stream").Writable,h=e("inherits"),f=e("reinterval"),p=e("rfdc/default"),d=e("./validations"),g=e("xtend"),y=e("debug")("mqttjs:client"),b=r?r.nextTick:function(e){setTimeout(e,0)},m=n.setImmediate||function(e){b(e)},v={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},w=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],_={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 k(e,t){let r;t.properties&&(r=t.properties.topicAlias);let n=t.topic.toString();if(0===n.length){if(void 0===r)return new Error("Unregistered Topic Alias");if(void 0===(n=e.topicAliasSend.getTopicByAlias(r)))return new Error("Unregistered Topic Alias");t.topic=n}r&&delete t.properties.topicAlias}function S(e,t,r){y("sendPacket :: packet: %O",t),y("sendPacket :: emitting `packetsend`"),e.emit("packetsend",t),y("sendPacket :: writing to stream");const n=l.writeToStream(t,e.stream,e.options);y("sendPacket :: writeToStream result %s",n),!n&&r?(y("sendPacket :: handle events on `drain` once through callback."),e.stream.once("drain",r)):r&&(y("sendPacket :: invoking cb"),r())}function E(e,t,r,n){y("storeAndSend :: store packet with cmd %s to outgoingStore",t.cmd);let i,o=t;if("publish"===o.cmd&&(o=p(t),i=k(e,o)))return r&&r(i);e.outgoingStore.put(o,function(i){if(i)return r&&r(i);n(),S(e,t,r)})}function C(e){y("nop ::",e)}function T(e,t){let r;const n=this;if(!(this instanceof T))return new T(e,t);for(r in this.options=t||{},v)void 0===this.options[r]?this.options[r]=v[r]:this.options[r]=t[r];y("MqttClient :: options.protocol",t.protocol),y("MqttClient :: options.protocolVersion",t.protocolVersion),y("MqttClient :: options.username",t.username),y("MqttClient :: options.keepalive",t.keepalive),y("MqttClient :: options.reconnectPeriod",t.reconnectPeriod),y("MqttClient :: options.rejectUnauthorized",t.rejectUnauthorized),y("MqttClient :: options.topicAliasMaximum",t.topicAliasMaximum),this.options.clientId="string"==typeof t.clientId?t.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),y("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===t.protocolVersion&&t.customHandleAcks?t.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=e,this.messageIdProvider=void 0===this.options.messageIdProvider?new u:this.options.messageIdProvider,this.outgoingStore=t.outgoingStore||new o,this.incomingStore=t.incomingStore||new o,this.queueQoSZero=void 0===t.queueQoSZero||t.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,t.topicAliasMaximum>0&&(t.topicAliasMaximum>65535?y("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new s(t.topicAliasMaximum)),this.on("connect",function(){const e=this.queue;y("connect :: sending queued packets"),function t(){const r=e.shift();y("deliver :: entry %o",r);let i=null;if(!r)return void n._resubscribe();i=r.packet,y("deliver :: call _sendPacket for %o",i);let o=!0;i.messageId&&0!==i.messageId&&(n.messageIdProvider.register(i.messageId)||(o=!1)),o?n._sendPacket(i,function(e){r.cb&&r.cb(e),t()}):(y("messageId: %d has already used. The message is skipped and removed.",i.messageId),t())}()}),this.on("close",function(){y("close :: connected set to `false`"),this.connected=!1,y("close :: clearing connackTimer"),clearTimeout(this.connackTimer),y("close :: clearing ping timer"),null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),y("close :: calling _setupReconnect"),this._setupReconnect()}),i.call(this),y("MqttClient :: setting up stream"),this._setupStream()}h(T,i),T.prototype._setupStream=function(){const e=this,t=new c,r=l.parser(this.options);let n=null;const i=[];function o(){if(i.length)b(s);else{const e=n;n=null,e()}}function s(){y("work :: getting next packet in queue");const t=i.shift();if(t)y("work :: packet pulled from queue"),e._handlePacket(t,o);else{y("work :: no packets in queue");const e=n;n=null,y("work :: done flag is %s",!!e),e&&e()}}y("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),y("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",function(e){y("parser :: on packet push to packets array."),i.push(e)}),t._write=function(e,t,i){n=i,y("writable stream :: parsing buffer"),r.parse(e),s()},y("_setupStream :: pipe stream to writable stream"),this.stream.pipe(t),this.stream.on("error",function(t){y("streamErrorHandler :: error",t.message),w.includes(t.code)?(y("streamErrorHandler :: emitting error"),e.emit("error",t)):C(t)}),this.stream.on("close",function(){var t;y("(%s)stream :: on close",e.options.clientId),(t=e.outgoing)&&(y("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(t).forEach(function(e){t[e].volatile&&"function"==typeof t[e].cb&&(t[e].cb(new Error("Connection closed")),delete t[e])})),y("stream: emit close to MqttClient"),e.emit("close")}),y("_setupStream: sending packet `connect`");const a=Object.create(this.options);if(a.cmd="connect",this.topicAliasRecv&&(a.properties||(a.properties={}),this.topicAliasRecv&&(a.properties.topicAliasMaximum=this.topicAliasRecv.max)),S(this,a),r.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return e.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket){S(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){y("!!connectTimeout hit!! Calling _cleanUp with force `true`"),e._cleanUp(!0)},this.options.connectTimeout)},T.prototype._handlePacket=function(e,t){const r=this.options;if(5===r.protocolVersion&&r.properties&&r.properties.maximumPacketSize&&r.properties.maximumPacketSize<e.length)return this.emit("error",new Error("exceeding packets size "+e.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(y("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"auth":this._handleAuth(e),t();break;case"pingresp":this._handlePingresp(e),t();break;case"disconnect":this._handleDisconnect(e),t()}},T.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},T.prototype.publish=function(e,t,r,n){y("publish :: message `%s` to topic `%s`",t,e);const i=this.options;"function"==typeof r&&(n=r,r=null);if(r=g({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;const o=this,s=function(){let s=0;if((1===r.qos||2===r.qos)&&null===(s=o._nextId()))return y("No messageId left"),!1;const a={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:s,dup:r.dup};switch(5===i.protocolVersion&&(a.properties=r.properties),y("publish :: qos",r.qos),r.qos){case 1:case 2:o.outgoing[a.messageId]={volatile:!1,cb:n||C},y("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,void 0,r.cbStorePut);break;default:y("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,n,r.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,cbStorePut:r.cbStorePut,callback:n}),this},T.prototype.subscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];const r=[];let n=t.shift();const i=n.resubscribe;let o=t.pop()||C,s=t.pop();const a=this.options.protocolVersion;delete n.resubscribe,"string"==typeof n&&(n=[n]),"function"!=typeof o&&(s=o,o=C);const l=d.validateTopics(n);if(null!==l)return m(o,new Error("Invalid topic "+l)),this;if(this._checkDisconnecting(o))return y("subscribe: discconecting true"),this;const u={qos:0};if(5===a&&(u.nl=!1,u.rap=!1,u.rh=0),s=g(u,s),Array.isArray(n)?n.forEach(function(t){if(y("subscribe: array topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<s.qos||i){const e={topic:t,qos:s.qos};5===a&&(e.nl=s.nl,e.rap=s.rap,e.rh=s.rh,e.properties=s.properties),y("subscribe: pushing topic `%s` and qos `%s` to subs list",e.topic,e.qos),r.push(e)}}):Object.keys(n).forEach(function(t){if(y("subscribe: object topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<n[t].qos||i){const e={topic:t,qos:n[t].qos};5===a&&(e.nl=n[t].nl,e.rap=n[t].rap,e.rh=n[t].rh,e.properties=s.properties),y("subscribe: pushing `%s` to subs list",e),r.push(e)}}),!r.length)return o(null,[]),this;const c=function(){const t=e._nextId();if(null===t)return y("No messageId left"),!1;const n={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:t};if(s.properties&&(n.properties=s.properties),e.options.resubscribe){y("subscribe :: resubscribe true");const t=[];r.forEach(function(r){if(e.options.reconnectPeriod>0){const n={qos:r.qos};5===a&&(n.nl=r.nl||!1,n.rap=r.rap||!1,n.rh=r.rh||0,n.properties=r.properties),e._resubscribeTopics[r.topic]=n,t.push(r.topic)}}),e.messageIdToTopic[n.messageId]=t}return e.outgoing[n.messageId]={volatile:!0,cb:function(e,t){if(!e){const e=t.granted;for(let t=0;t<e.length;t+=1)r[t].qos=e[t]}o(e,r)}},y("subscribe :: call _sendPacket"),e._sendPacket(n),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!c())&&this._storeProcessingQueue.push({invoke:c,callback:o}),this},T.prototype.unsubscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];let r=t.shift(),n=t.pop()||C,i=t.pop();"string"==typeof r&&(r=[r]),"function"!=typeof n&&(i=n,n=C);const o=d.validateTopics(r);if(null!==o)return m(n,new Error("Invalid topic "+o)),this;if(e._checkDisconnecting(n))return this;const s=function(){const t=e._nextId();if(null===t)return y("No messageId left"),!1;const o={cmd:"unsubscribe",qos:1,messageId:t};return"string"==typeof r?o.unsubscriptions=[r]:Array.isArray(r)&&(o.unsubscriptions=r),e.options.resubscribe&&o.unsubscriptions.forEach(function(t){delete e._resubscribeTopics[t]}),"object"==typeof i&&i.properties&&(o.properties=i.properties),e.outgoing[o.messageId]={volatile:!0,cb:n},y("unsubscribe: call _sendPacket"),e._sendPacket(o),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,callback:n}),this},T.prototype.end=function(e,t,r){const n=this;function i(){y("end :: (%s) :: finish :: calling _cleanUp with force %s",n.options.clientId,e),n._cleanUp(e,()=>{y("end :: finish :: calling process.nextTick on closeStores"),b(function(){y("end :: closeStores: closing incoming and outgoing stores"),n.disconnected=!0,n.incomingStore.close(function(e){n.outgoingStore.close(function(t){if(y("end :: closeStores: emitting end"),n.emit("end"),r){const n=e||t;y("end :: closeStores: invoking callback with args"),r(n)}})}),n._deferredReconnect&&n._deferredReconnect()}.bind(n))},t)}return y("end :: (%s)",this.options.clientId),null!=e&&"boolean"==typeof e||(r=t||C,t=e,e=!1,"object"!=typeof t&&(r=t,t=null,"function"!=typeof r&&(r=C))),"object"!=typeof t&&(r=t,t=null),y("end :: cb? %s",!!r),r=r||C,this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(y("end :: (%s) :: calling finish in 10ms once outgoing is empty",n.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,i,10))):(y("end :: (%s) :: immediately calling finish",n.options.clientId),i()),this)},T.prototype.removeOutgoingMessage=function(e){const t=this.outgoing[e]?this.outgoing[e].cb:null;return delete this.outgoing[e],this.outgoingStore.del({messageId:e},function(){t(new Error("Message removed"))}),this},T.prototype.reconnect=function(e){y("client reconnect");const t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},T.prototype._reconnect=function(){y("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),y("client already connected. disconnecting first.")):(y("_reconnect: calling _setupStream"),this._setupStream())},T.prototype._setupReconnect=function(){const e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0?(this.reconnecting||(y("_setupReconnect :: emit `offline` state"),this.emit("offline"),y("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),y("_setupReconnect :: setting reconnectTimer for %d ms",e.options.reconnectPeriod),e.reconnectTimer=setInterval(function(){y("reconnectTimer :: reconnect triggered!"),e._reconnect()},e.options.reconnectPeriod)):y("_setupReconnect :: doing nothing...")},T.prototype._clearReconnect=function(){y("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},T.prototype._cleanUp=function(e,t){const r=arguments[2];if(t&&(y("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),y("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&(n=this.outgoing)&&(y("flush: queue exists? %b",!!n),Object.keys(n).forEach(function(e){"function"==typeof n[e].cb&&(n[e].cb(new Error("Connection closed")),delete n[e])})),y("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const e=g({cmd:"disconnect"},r);y("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(e,m.bind(null,this.stream.end.bind(this.stream)))}var n;this.disconnecting||(y("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(y("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(y("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())},T.prototype._sendPacket=function(e,t,r){y("_sendPacket :: (%s) :: start",this.options.clientId),r=r||C,t=t||C;const n=function(e,t){if(5===e.options.protocolVersion&&"publish"===t.cmd){let r;t.properties&&(r=t.properties.topicAlias);const n=t.topic.toString();if(e.topicAliasSend)if(r){if(0!==n.length&&(y("applyTopicAlias :: register topic: %s - alias: %d",n,r),!e.topicAliasSend.put(n,r)))return y("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}else 0!==n.length&&(e.options.autoAssignTopicAlias?(r=e.topicAliasSend.getAliasByTopic(n))?(t.topic="",t.properties={...t.properties,topicAlias:r},y("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",n,r)):(r=e.topicAliasSend.getLruAlias(),e.topicAliasSend.put(n,r),t.properties={...t.properties,topicAlias:r},y("applyTopicAlias :: auto assign topic: %s - alias: %d",n,r)):e.options.autoUseTopicAlias&&(r=e.topicAliasSend.getAliasByTopic(n))&&(t.topic="",t.properties={...t.properties,topicAlias:r},y("applyTopicAlias :: auto use topic: %s - alias: %d",n,r)));else if(r)return y("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}}(this,e);if(n)t(n);else{if(!this.connected)return"auth"===e.cmd?(this._shiftPingInterval(),void S(this,e,t)):(y("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,r));switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void E(this,e,t,r);default:return void S(this,e,t)}switch(e.qos){case 2:case 1:E(this,e,t,r);break;case 0:default:S(this,e,t)}y("_sendPacket :: (%s) :: end",this.options.clientId)}},T.prototype._storePacket=function(e,t,r){y("_storePacket :: packet: %o",e),y("_storePacket :: cb? %s",!!t),r=r||C;let n=e;if("publish"===n.cmd){const r=k(this,n=p(e));if(r)return t&&t(r)}0===(n.qos||0)&&this.queueQoSZero||"publish"!==n.cmd?this.queue.push({packet:n,cb:t}):n.qos>0?(t=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,function(e){if(e)return t&&t(e);r()})):t&&t(new Error("No connection to broker"))},T.prototype._setupPingTimer=function(){y("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=f(function(){e._checkPing()},1e3*this.options.keepalive))},T.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},T.prototype._checkPing=function(){y("_checkPing :: checking ping..."),this.pingResp?(y("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(y("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},T.prototype._handlePingresp=function(){this.pingResp=!0},T.prototype._handleConnack=function(e){y("_handleConnack");const t=this.options,r=5===t.protocolVersion?e.reasonCode:e.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));e.properties.topicAliasMaximum>0&&(this.topicAliasSend=new a(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=e.properties.serverKeepAlive,this._shiftPingInterval()),e.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(0===r)this.reconnecting=!1,this._onConnect(e);else if(r>0){const e=new Error("Connection refused: "+_[r]);e.code=r,this.emit("error",e)}},T.prototype._handleAuth=function(e){const t=this.options.protocolVersion,r=5===t?e.reasonCode:e.returnCode;if(5!==t){const e=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+t);return e.code=r,void this.emit("error",e)}const n=this;this.handleAuth(e,function(e,t){if(e)n.emit("error",e);else if(24===r)n.reconnecting=!1,n._sendPacket(t);else{const t=new Error("Connection refused: "+_[r]);e.code=r,n.emit("error",t)}})},T.prototype.handleAuth=function(e,t){t()},T.prototype._handlePublish=function(e,t){y("_handlePublish: packet %o",e),t=void 0!==t?t:C;let r=e.topic.toString();const n=e.payload,i=e.qos,o=e.messageId,s=this,a=this.options,l=[0,16,128,131,135,144,145,151,153];if(5===this.options.protocolVersion){let t;if(e.properties&&(t=e.properties.topicAlias),void 0!==t)if(0===r.length){if(!(t>0&&t<=65535))return y("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));{const e=this.topicAliasRecv.getTopicByAlias(t);if(!e)return y("_handlePublish :: unregistered topic alias. alias: %d",t),void this.emit("error",new Error("Received unregistered Topic Alias"));y("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",r=e,t)}}else{if(!this.topicAliasRecv.put(r,t))return y("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));y("_handlePublish :: registered topic: %s - alias: %d",r,t)}}switch(y("_handlePublish: qos %d",i),i){case 2:a.customHandleAcks(r,n,e,function(r,n){return r instanceof Error||(n=r,r=null),r?s.emit("error",r):-1===l.indexOf(n)?s.emit("error",new Error("Wrong reason code for pubrec")):void(n?s._sendPacket({cmd:"pubrec",messageId:o,reasonCode:n},t):s.incomingStore.put(e,function(){s._sendPacket({cmd:"pubrec",messageId:o},t)}))});break;case 1:a.customHandleAcks(r,n,e,function(i,a){return i instanceof Error||(a=i,i=null),i?s.emit("error",i):-1===l.indexOf(a)?s.emit("error",new Error("Wrong reason code for puback")):(a||s.emit("message",r,n,e),void s.handleMessage(e,function(e){if(e)return t&&t(e);s._sendPacket({cmd:"puback",messageId:o,reasonCode:a},t)}))});break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t);break;default:y("_handlePublish: unknown QoS. Doing nothing.")}},T.prototype.handleMessage=function(e,t){t()},T.prototype._handleAck=function(e){const t=e.messageId,r=e.cmd;let n=null;const i=this.outgoing[t]?this.outgoing[t].cb:null,o=this;let s;if(i){switch(y("_handleAck :: packet type",r),r){case"pubcomp":case"puback":{const r=e.reasonCode;r&&r>0&&16!==r&&((s=new Error("Publish error: "+_[r])).code=r,i(s,e)),delete this.outgoing[t],this.outgoingStore.del(e,i),this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue();break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:t};const r=e.reasonCode;r&&r>0&&16!==r?((s=new Error("Publish error: "+_[r])).code=r,i(s,e)):this._sendPacket(n);break}case"suback":delete this.outgoing[t],this.messageIdProvider.deallocate(t);for(let r=0;r<e.granted.length;r++)if(0!=(128&e.granted[r])){const e=this.messageIdToTopic[t];e&&e.forEach(function(e){delete o._resubscribeTopics[e]})}this._invokeStoreProcessingQueue(),i(null,e);break;case"unsuback":delete this.outgoing[t],this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue(),i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else y("_handleAck :: Server sent an ack in error. Ignoring.")},T.prototype._handlePubrel=function(e,t){y("handling pubrel packet"),t=void 0!==t?t:C;const r=this,n={cmd:"pubcomp",messageId:e.messageId};r.incomingStore.get(e,function(e,i){e?r._sendPacket(n,t):(r.emit("message",i.topic,i.payload,i),r.handleMessage(i,function(e){if(e)return t(e);r.incomingStore.del(i,C),r._sendPacket(n,t)}))})},T.prototype._handleDisconnect=function(e){this.emit("disconnect",e)},T.prototype._nextId=function(){return this.messageIdProvider.allocate()},T.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},T.prototype._resubscribe=function(){y("_resubscribe");const e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){y("_resubscribe: protocolVersion 5");for(let t=0;t<e.length;t++){const r={};r[e[t]]=this._resubscribeTopics[e[t]],r.resubscribe=!0,this.subscribe(r,{properties:r[e[t]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},T.prototype._onConnect=function(e){if(this.disconnected)return void this.emit("connect",e);const t=this;this.connackPacket=e,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function r(){let n=t.outgoingStore.createStream();function i(){t._storeProcessing=!1,t._packetIdsDuringStoreProcessing={}}function o(){n.destroy(),n=null,t._flushStoreProcessingQueue(),i()}t.once("close",o),n.on("error",function(e){i(),t._flushStoreProcessingQueue(),t.removeListener("close",o),t.emit("error",e)}),n.on("end",function(){let n=!0;for(const e in t._packetIdsDuringStoreProcessing)if(!t._packetIdsDuringStoreProcessing[e]){n=!1;break}n?(i(),t.removeListener("close",o),t._invokeAllStoreProcessingQueue(),t.emit("connect",e)):r()}),function e(){if(!n)return;t._storeProcessing=!0;const r=n.read(1);let i;r?t._packetIdsDuringStoreProcessing[r.messageId]?e():t.disconnecting||t.reconnectTimer?n.destroy&&n.destroy():(i=t.outgoing[r.messageId]?t.outgoing[r.messageId].cb:null,t.outgoing[r.messageId]={volatile:!1,cb:function(t,r){i&&i(t,r),e()}},t._packetIdsDuringStoreProcessing[r.messageId]=!0,t.messageIdProvider.register(r.messageId)?t._sendPacket(r):y("messageId: %d has already used.",r.messageId)):n.once("readable",e)}()}()},T.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1},T.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},T.prototype._flushStoreProcessingQueue=function(){for(const e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},t.exports=T}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?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(e,t,r){(function(r){(function(){"use strict";const n=e("readable-stream").Transform,i=e("duplexify");let o,s,a,l=!1;t.exports=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const u="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);const c=function(e,t){const r="alis"===e.protocol?"wss":"ws";let n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return(o=t.my).connectSocket({url:c,protocols:u}),s=function(){const e=new n;return e._write=function(e,t,r){o.sendSocketMessage({data:e.buffer,success:function(){r()},fail:function(){r(new Error)}})},e._flush=function(e){o.closeSocket({success:function(){e()}})},e}(),a=i.obj(),l||(l=!0,o.onSocketOpen(function(){a.setReadable(s),a.setWritable(s),a.emit("connect")}),o.onSocketMessage(function(e){if("string"==typeof e.data){const t=r.from(e.data,"base64");s.push(t)}else{const t=new FileReader;t.addEventListener("load",function(){let e=t.result;e=e instanceof ArrayBuffer?r.from(e):r.from(e,"utf8"),s.push(e)}),t.readAsArrayBuffer(e.data)}}),o.onSocketClose(function(){a.end(),a.destroy()}),o.onSocketError(function(e){a.destroy(e)})),a}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(e,t,r){"use strict";const n=e("net"),i=e("debug")("mqttjs:tcp");t.exports=function(e,t){t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost";const r=t.port,o=t.hostname;return i("port %d and host %s",r,o),n.createConnection(r,o)}},{debug:18,net:16}],4:[function(e,t,r){"use strict";const n=e("tls"),i=e("net"),o=e("debug")("mqttjs:tls");t.exports=function(e,t){t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",0===i.isIP(t.host)&&(t.servername=t.host),t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,o("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized);const r=n.connect(t);function s(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return r.on("secureConnect",function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",s)}),r.on("error",s),r}},{debug:18,net:16,tls:16}],5:[function(e,t,r){(function(r,n){(function(){"use strict";const i=e("ws"),o=e("debug")("mqttjs:ws"),s=e("duplexify"),a=e("readable-stream").Transform,l=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],u=void 0!==r&&"browser"===r.title||"function"==typeof __webpack_require__;function c(e,t){let r=e.protocol+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function h(e){const t=e;return e.hostname||(t.hostname="localhost"),e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),u||"wss"!==e.protocol||l.forEach(function(r){Object.prototype.hasOwnProperty.call(e,r)&&!Object.prototype.hasOwnProperty.call(e.wsOptions,r)&&(t.wsOptions[r]=e[r])}),t}t.exports=u?function(e,t){let r;o("browserStreamBuilder");const i=function(e){const t=h(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const e=new URL(document.URL);t.hostname=e.hostname,t.port||(t.port=e.port)}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}(t).browserBufferSize||524288,l=t.browserBufferTimeout||1e3,u=!t.objectMode,f=function(e,t){const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt",n=c(t,e),i=new WebSocket(n,[r]);return i.binaryType="arraybuffer",i}(e,t),p=function(e,t,r){const n=new a({objectModeMode:e.objectMode});return n._write=t,n._flush=r,n}(t,function e(t,r,o){f.bufferedAmount>i&&setTimeout(e,l,t,r,o),u&&"string"==typeof t&&(t=n.from(t,"utf8"));try{f.send(t)}catch(e){return o(e)}o()},function(e){f.close(),e()});t.objectMode||(p._writev=v),p.on("close",()=>{f.close()});const d=void 0!==f.addEventListener;function g(){r.setReadable(p),r.setWritable(p),r.emit("connect")}function y(){r.end(),r.destroy()}function b(e){r.destroy(e)}function m(e){let t=e.data;t=t instanceof ArrayBuffer?n.from(t):n.from(t,"utf8"),p.push(t)}function v(e,t){const r=new Array(e.length);for(let t=0;t<e.length;t++)"string"==typeof e[t].chunk?r[t]=n.from(e[t],"utf8"):r[t]=e[t].chunk;this._write(n.concat(r),"binary",t)}return f.readyState===f.OPEN?r=p:(r=r=s(void 0,void 0,t),t.objectMode||(r._writev=v),d?f.addEventListener("open",g):f.onopen=g),r.socket=f,d?(f.addEventListener("close",y),f.addEventListener("error",b),f.addEventListener("message",m)):(f.onclose=y,f.onerror=b,f.onmessage=m),r}:function(e,t){o("streamBuilder");const r=h(t),n=c(r,e),s=function(e,t,r){o("createWebSocket"),o("protocol: "+r.protocolId+" "+r.protocolVersion);const n="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return o("creating new Websocket for url: "+t+" and protocol: "+n),new i(t,[n],r.wsOptions)}(0,n,r),a=i.createWebSocketStream(s,r.wsOptions);return a.url=n,s.on("close",()=>{a.destroy()}),a}}).call(this)}).call(this,e("_process"),e("buffer").Buffer)},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(e,t,r){(function(r){(function(){"use strict";const n=e("readable-stream").Transform,i=e("duplexify");let o,s,a;t.exports=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const l="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);const u=function(e,t){const r="wxs"===e.protocol?"wss":"ws";let n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);o=wx.connectSocket({url:u,protocols:[l]}),s=function(){const e=new n;return e._write=function(e,t,r){o.send({data:e.buffer,success:function(){r()},fail:function(e){r(new Error(e))}})},e._flush=function(e){o.close({success:function(){e()}})},e}(),(a=i.obj())._destroy=function(e,t){o.close({success:function(){t&&t(e)}})};const c=a.destroy;return a.destroy=function(){a.destroy=c;const e=this;setTimeout(function(){o.close({fail:function(){e._destroy(new Error)}})},0)}.bind(a),o.onOpen(function(){a.setReadable(s),a.setWritable(s),a.emit("connect")}),o.onMessage(function(e){let t=e.data;t=t instanceof ArrayBuffer?r.from(t):r.from(t,"utf8"),s.push(t)}),o.onClose(function(){a.end(),a.destroy()}),o.onError(function(e){a.destroy(new Error(e.errMsg))}),a}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}n.prototype.allocate=function(){const e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},n.prototype.getLastAllocated=function(){return 1===this.nextId?65535:this.nextId-1},n.prototype.register=function(e){return!0},n.prototype.deallocate=function(e){},n.prototype.clear=function(){},t.exports=n},{}],8:[function(e,t,r){"use strict";const n=e("xtend"),i=e("readable-stream").Readable,o={objectMode:!0},s={clean:!0};function a(e){if(!(this instanceof a))return new a(e);this.options=e||{},this.options=n(s,e),this._inflights=new Map}a.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},a.prototype.createStream=function(){const e=new i(o),t=[];let r=!1,n=0;return this._inflights.forEach(function(e,r){t.push(e)}),e._read=function(){!r&&n<t.length?this.push(t[n++]):this.push(null)},e.destroy=function(){if(r)return;const e=this;r=!0,setTimeout(function(){e.emit("close")},0)},e},a.prototype.del=function(e,t){return(e=this._inflights.get(e.messageId))?(this._inflights.delete(e.messageId),t(null,e)):t&&t(new Error("missing packet")),this},a.prototype.get=function(e,t){return(e=this._inflights.get(e.messageId))?t(null,e):t&&t(new Error("missing packet")),this},a.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},t.exports=a},{"readable-stream":69,xtend:81}],9:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);this.aliasToTopic={},this.max=e}n.prototype.put=function(e,t){return!(0===t||t>this.max)&&(this.aliasToTopic[t]=e,this.length=Object.keys(this.aliasToTopic).length,!0)},n.prototype.getTopicByAlias=function(e){return this.aliasToTopic[e]},n.prototype.clear=function(){this.aliasToTopic={}},t.exports=n},{}],10:[function(e,t,r){"use strict";const n=e("lru-cache"),i=e("number-allocator").NumberAllocator;function o(e){if(!(this instanceof o))return new o(e);e>0&&(this.aliasToTopic=new n({max:e}),this.topicToAlias={},this.numberAllocator=new i(1,e),this.max=e,this.length=0)}o.prototype.put=function(e,t){if(0===t||t>this.max)return!1;const r=this.aliasToTopic.get(t);return r&&delete this.topicToAlias[r],this.aliasToTopic.set(t,e),this.topicToAlias[e]=t,this.numberAllocator.use(t),this.length=this.aliasToTopic.length,!0},o.prototype.getTopicByAlias=function(e){return this.aliasToTopic.get(e)},o.prototype.getAliasByTopic=function(e){const t=this.topicToAlias[e];return void 0!==t&&this.aliasToTopic.get(t),t},o.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},o.prototype.getLruAlias=function(){const e=this.numberAllocator.firstVacant();return e||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},t.exports=o},{"lru-cache":37,"number-allocator":46}],11:[function(e,t,r){"use strict";function n(e){const t=e.split("/");for(let e=0;e<t.length;e++)if("+"!==t[e]){if("#"===t[e])return e===t.length-1;if(-1!==t[e].indexOf("+")||-1!==t[e].indexOf("#"))return!1}return!0}t.exports={validateTopics:function(e){if(0===e.length)return"empty_topic_list";for(let t=0;t<e.length;t++)if(!n(e[t]))return e[t];return null}}},{}],12:[function(e,t,r){(function(r){(function(){"use strict";const n=e("../client"),i=e("../store"),o=e("url"),s=e("xtend"),a=e("debug")("mqttjs"),l={};function u(e,t){if(a("connecting to an MQTT broker..."),"object"!=typeof e||t||(t=e,e=null),t=t||{},e){const r=o.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=s(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){let t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;case"ali":t.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!l[t.protocol]){const e=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(t,r){return(!e||r%2!=0)&&"function"==typeof l[t]})[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");t.protocol&&(t.defaultProtocol=t.protocol);const r=new n(function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),a("calling streambuilder for",t.protocol),l[t.protocol](e,t)},t);return r.on("error",function(){}),r}void 0!==r&&"browser"!==r.title||"function"!=typeof __webpack_require__?(l.mqtt=e("./tcp"),l.tcp=e("./tcp"),l.ssl=e("./tls"),l.tls=e("./tls"),l.mqtts=e("./tls")):(l.wx=e("./wx"),l.wxs=e("./wx"),l.ali=e("./ali"),l.alis=e("./ali")),l.ws=e("./ws"),l.wss=e("./ws"),t.exports=u,t.exports.connect=u,t.exports.MqttClient=n,t.exports.Store=i}).call(this)}).call(this,e("_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(e,t,r){"use strict";r.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=u(e),s=n[0],a=n[1],l=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),c=0,h=a>0?s-4:s;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[c++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t);return l},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(c(e,s,s+16383>a?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a<l;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var i,o,s=[],a=t;a<r;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],14:[function(e,t,r){"use strict";const{Buffer:n}=e("buffer"),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},o.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let e=0;e<t;e++)r+=this._bufs[e].length;return r},o.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let l=a,u=o&&t||0,c=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(l<=this._bufs[s[0]].length-c)return o?this._bufs[s[0]].copy(e,t,c,c+l):this._bufs[s[0]].slice(c,c+l);o||(e=n.allocUnsafe(a));for(let t=s[0];t<this._bufs.length;t++){const r=this._bufs[t].length-c;if(!(l>r)){this._bufs[t].copy(e,u,c,c+l),u+=r;break}this._bufs[t].copy(e,u,c),u+=r,l-=r,c&&(c=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},o.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},o.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},o.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"==typeof t&&(r=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o<this._bufs.length;o++){const t=this._bufs[o];for(;s<t.length;){if(t.length-s>=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={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 t in e)!function(t){o.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(r=0){return this.slice(r,r+e[t])[t](0)}}(t)}(),o.prototype._isBufferList=function(e){return e instanceof o||o.isBufferList(e)},o.isBufferList=function(e){return null!=e&&e[i]},t.exports=o},{buffer:17}],15:[function(e,t,r){"use strict";const n=e("readable-stream").Duplex,i=e("inherits"),o=e("./BufferList");function s(e){if(!(this instanceof s))return new s(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)}),e=null}o._init.call(this,e),n.call(this)}i(s,n),Object.assign(s.prototype,o.prototype),s.prototype._new=function(e){return new s(e)},s.prototype._write=function(e,t,r){this._appendBuffer(e),"function"==typeof r&&r()},s.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},s.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},s.prototype._isBufferList=function(e){return e instanceof s||e instanceof o||s.isBufferList(e)},s.isBufferList=o.isBufferList,t.exports=s,t.exports.BufferListStream=s,t.exports.BufferList=o},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(e,t,r){},{}],17:[function(e,t,r){(function(t){(function(){"use strict";var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,r)}function a(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|f(e,t),n=o(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r);return n.__proto__=s.prototype,n}(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var i=function(e){if(s.isBuffer(e)){var t=0|h(e.length),r=o(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}if(void 0!==e.length)return"number"!=typeof e.length||D(e.length)?o(0):c(e);if("Buffer"===e.type&&Array.isArray(e.data))return c(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return l(e),o(e<0?0:0|h(e))}function c(e){for(var t=e.length<0?0:0|h(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:L(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function d(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),D(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(r+l>a&&(r=a-l),o=r;o>=0;o--){for(var h=!0,f=0;f<l;f++)if(u(e,o+f)!==u(t,f)){h=!1;break}if(h)return o}return-1}function y(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(D(a))return s;e[r+s]=a}return s}function b(e,t,r,n){return U(L(t,e.length-r),e,r,n)}function m(e,t,r,n){return U(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return m(e,t,r,n)}function w(e,t,r,n){return U(j(t),e,r,n)}function _(e,t,r,n){return U(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function k(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function S(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,l,u=e[i],c=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=E));return r}(n)}r.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return a(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)}(e,t,r)},s.allocUnsafe=function(e){return u(e)},s.allocUnsafeSlow=function(e){return u(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(q(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)p(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?S(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,a=r-t,l=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),h=0;h<l;++h)if(u[h]!==c[h]){o=u[h],a=c[h];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return d(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return d(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return m(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function T(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function x(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=N(e[o]);return i}function A(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function I(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,i,o){return t=+t,r>>>=0,o||O(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function R(e,t,r,i,o){return t=+t,r>>>=0,o||O(e,0,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||I(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||I(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||I(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||I(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var a=s.isBuffer(e)?e:s.from(e,n),l=a.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=a[o%l]}return this};var M=/[^+/0-9A-Za-z-_]/g;function N(e){return e<16?"0"+e.toString(16):e.toString(16)}function L(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function j(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function D(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(e,t,r){(function(n){(function(){r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&"%c"===e&&(i=++n)}),e.splice(i,0,r)},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")}catch(e){}!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG);return e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function(){try{return localStorage}catch(e){}}(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.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"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":19,_process:50}],19:[function(e,t,r){t.exports=function(t){function r(e){let t,i,o,s=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(t||i);n.diff=o,n.prev=t,n.curr=i,t=i,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if("%%"===t)return"%";s++;const o=r.formatters[i];if("function"==typeof o){const r=e[s];t=o.call(n,r),e.splice(s,1),s--}return t}),r.formatArgs.call(n,e),(n.log||r.log).apply(n,e)}return a.namespace=e,a.useColors=r.useColors(),a.color=r.selectColor(e),a.extend=n,a.destroy=r.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==r.namespaces&&(i=r.namespaces,o=r.enabled(e)),o),set:e=>{s=e}}),"function"==typeof r.init&&r.init(a),a}function n(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(i),...r.skips.map(i).map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.namespaces=e,r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t<i;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.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(t).forEach(e=>{r[e]=t[e]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]},r.enable(r.load()),r}},{ms:45}],20:[function(e,t,r){(function(r,n){(function(){var i=e("readable-stream"),o=e("end-of-stream"),s=e("inherits"),a=e("stream-shift"),l=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),u=function(e,t){e._corked?e.once("uncork",t):t()},c=function(e,t){return function(r){r?function(e,t){e._autoDestroy&&e.destroy(t)}(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},h=function(){},f=function(e,t,r){if(!(this instanceof f))return new f(e,t,r);i.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};s(f,i.Duplex),f.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new f(e,t,r)},f.prototype.cork=function(){1==++this._corked&&this.emit("cork")},f.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},f.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,n=o(e,{writable:!0,readable:!1},c(this,this._forwardEnd)),i=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&r.nextTick(i),this._writable=e,this._writable.on("drain",i),this._unwrite=function(){t._writable.removeListener("drain",i),n()},this.uncork()}else this.end()},f.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t,r=this,n=o(e,{writable:!1,readable:!0},c(this)),s=function(){r._forward()},a=function(){r.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:(t=e,new i.Readable({objectMode:!0,highWaterMark:16}).wrap(t)),this._readable2.on("readable",s),this._readable2.on("end",a),this._unread=function(){r._readable2.removeListener("readable",s),r._readable2.removeListener("end",a),n()},this._forward()}},f.prototype._read=function(){this._drained=!0,this._forward()},f.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=a(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},f.prototype.destroy=function(e,t){if(t||(t=h),this.destroyed)return t(null);this.destroyed=!0;var n=this;r.nextTick(function(){n._destroy(e),t(null)})},f.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}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(e,t,r){if(!this.destroyed)return this._corked?u(this,this._write.bind(this,e,t,r)):e===l?this._finish(r):this._writable?void(!1===this._writable.write(e)?this._ondrain=r:this.destroyed||r()):r()},f.prototype._finish=function(e){var t=this;this.emit("preend"),u(this,function(){var r,n;r=t._forwardEnd&&t._writable,n=function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),u(t,e)},r?r._writableState&&r._writableState.finished?n():r._writableState?r.end(n):(r.end(),n()):n()})},f.prototype.end=function(e,t,r){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this._writableState.destroyed||this.write(l),i.Writable.prototype.end.call(this,r))},t.exports=f}).call(this)}).call(this,e("_process"),e("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(e,t,r){(function(r){(function(){var n=e("once"),i=function(){},o=function(e,t,s){if("function"==typeof t)return o(e,null,t);t||(t={}),s=n(s||i);var a=e._writableState,l=e._readableState,u=t.readable||!1!==t.readable&&e.readable,c=t.writable||!1!==t.writable&&e.writable,h=!1,f=function(){e.writable||p()},p=function(){c=!1,u||s.call(e)},d=function(){u=!1,c||s.call(e)},g=function(t){s.call(e,t?new Error("exited with error code: "+t):null)},y=function(t){s.call(e,t)},b=function(){r.nextTick(m)},m=function(){if(!h)return(!u||l&&l.ended&&!l.destroyed)&&(!c||a&&a.ended&&!a.destroyed)?void 0:s.call(e,new Error("premature close"))},v=function(){e.req.on("finish",p)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?c&&!a&&(e.on("end",f),e.on("close",f)):(e.on("complete",p),e.on("abort",b),e.req?v():e.on("request",v)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",g),e.on("end",d),e.on("finish",p),!1!==t.error&&e.on("error",y),e.on("close",b),function(){h=!0,e.removeListener("complete",p),e.removeListener("abort",b),e.removeListener("request",v),e.req&&e.req.removeListener("finish",p),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("exit",g),e.removeListener("end",d),e.removeListener("error",y),e.removeListener("close",b)}};t.exports=o}).call(this)}).call(this,e("_process"))},{_process:50,once:48}],22:[function(e,t,r){var n=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var a,l=10;try{var u={};Object.defineProperty&&Object.defineProperty(u,"x",{value:0}),a=0===u.x}catch(e){a=!1}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function h(e,t,r,i){var o,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),a=s[t]):(s=e._events=n(null),e._eventsCount=0),a){if("function"==typeof a?a=s[t]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(o=c(e))&&o>0&&a.length>o){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else a=s[t]=r,++e._eventsCount;return e}function f(){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 e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=o.call(f,n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(!n)return[];var i=n[t];return i?"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):y(i,i.length):[]}function g(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function y(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}a?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');l=e}}):s.defaultMaxListeners=l,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){var t,r,n,i,o,s,a="error"===e;if(s=this._events)a=a&&null==s.error;else if(!a)return!1;if(a){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var l=new Error('Unhandled "error" event. ('+t+")");throw l.context=t,l}if(!(r=s[e]))return!1;var u="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=y(e,n),o=0;o<n;++o)i[o].call(r)}(r,u,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=y(e,i),s=0;s<i;++s)o[s].call(r,n)}(r,u,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,s=y(e,o),a=0;a<o;++a)s[a].call(r,n,i)}(r,u,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var s=e.length,a=y(e,s),l=0;l<s;++l)a[l].call(r,n,i,o)}(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=y(e,i),s=0;s<i;++s)o[s].apply(r,n)}(r,u,this,i)}return!0},s.prototype.addListener=function(e,t){return h(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return h(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,o,s,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=n(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){a=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,o),1===r.length&&(i[e]=r[0]),i.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.removeAllListeners=function(e){var t,r,o;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=n(null),this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=n(null):delete r[e]),this;if(0===arguments.length){var s,a=i(r);for(o=0;o<a.length;++o)"removeListener"!==(s=a[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=n(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?i-1:0,f=r?-1:1,p=e[t+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+h],h+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+e[t+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var s,a,l,u=8*o-i-1,c=(1<<u)-1,h=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+p]=255&s,p+=d,s/=256,u-=8);e[r+p-d]|=128*g}},{}],24:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],25:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){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=e,this.value=t}return e.prototype.rotateLeft=function(){var e=this.parent,t=this.brother,r=this.leftChild,n=this.rightChild;if(!n)throw new Error("unknown error");var i=n.leftChild,o=n.rightChild;return e&&(e.leftChild===this?e.leftChild=n:e.rightChild===this&&(e.rightChild=n)),n.parent=e,n.brother=t,n.leftChild=this,n.rightChild=o,t&&(t.brother=n),this.parent=n,this.brother=o,this.leftChild=r,this.rightChild=i,o&&(o.parent=n,o.brother=this),r&&(r.parent=this,r.brother=i),i&&(i.parent=this,i.brother=r),n},e.prototype.rotateRight=function(){var e=this.parent,t=this.brother,r=this.leftChild;if(!r)throw new Error("unknown error");var n=this.rightChild,i=r.leftChild,o=r.rightChild;return e&&(e.leftChild===this?e.leftChild=r:e.rightChild===this&&(e.rightChild=r)),r.parent=e,r.brother=t,r.leftChild=i,r.rightChild=this,t&&(t.brother=r),i&&(i.parent=r,i.brother=this),this.parent=r,this.brother=i,this.leftChild=o,this.rightChild=n,o&&(o.parent=this,o.brother=n),n&&(n.parent=this,n.brother=o),r},e.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},e.TreeNodeColorType={red:!0,black:!1},e}();Object.freeze(n),r.default=n},{}],26:[function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function i(e){var t=this;void 0===e&&(e=[]);var r=[],o=0,s=0,a=0,l=0,u=0,c=0;this.size=function(){return c},this.empty=function(){return 0===c},this.clear=function(){o=a=s=l=u=c=0,f.call(this,i.bucketSize),c=0},this.front=function(){return r[o][s]},this.back=function(){return r[a][l]},this.forEach=function(e){if(!this.empty()){var t=0;if(o!==a){for(u=s;u<i.bucketSize;++u)e(r[o][u],t++);for(u=o+1;u<a;++u)for(var n=0;n<i.bucketSize;++n)e(r[u][n],t++);for(u=0;u<=l;++u)e(r[a][u],t++)}else for(var u=s;u<=l;++u)e(r[o][u],t++)}};var h=function(e){var t=o*i.bucketSize+s,r=t+e,n=a*i.bucketSize+l;if(r<t||r>n)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(r/i.bucketSize),curNodePointerIndex:r%i.bucketSize}};this.getElementByPos=function(e){var t=h(e),n=t.curNodeBucketIndex,i=t.curNodePointerIndex;return r[n][i]},this.eraseElementByPos=function(e){var t=this;if(e<0||e>c)throw new Error("pos should more than 0 and less than queue's size");if(0===e)this.popFront();else if(e===this.size())this.popBack();else{for(var r=[],n=e+1;n<c;++n)r.push(this.getElementByPos(n));this.cut(e),this.popBack(),r.forEach(function(e){return t.pushBack(e)})}},this.eraseElementByValue=function(e){if(!this.empty()){var t=[];this.forEach(function(r){r!==e&&t.push(r)});for(var r=t.length,n=0;n<r;++n)this.setElementByPos(n,t[n]);this.cut(r-1)}};var f=function(e){for(var t=[],n=e*i.sigma,h=Math.max(Math.ceil(n/i.bucketSize),2),f=0;f<h;++f)t.push(new Array(i.bucketSize));var p=Math.ceil(e/i.bucketSize),d=Math.floor(h/2)-Math.floor(p/2),g=d,y=0;if(this.size())for(f=0;f<p;++f){for(var b=0;b<i.bucketSize;++b)if(t[d+f][b]=this.front(),this.popFront(),this.empty()){g=d+f,y=b;break}if(this.empty())break}r=t,o=d,s=0,a=g,l=y,u=h,c=e};this.pushBack=function(e){this.empty()||(a===u-1&&l===i.bucketSize-1&&f.call(this,this.size()),l<i.bucketSize-1?++l:a<u-1&&(++a,l=0)),++c,r[a][l]=e},this.popBack=function(){this.empty()||(1!==this.size()&&(l>0?--l:o<a&&(--a,l=i.bucketSize-1)),c>0&&--c)},this.setElementByPos=function(e,t){var n=h(e),i=n.curNodeBucketIndex,o=n.curNodePointerIndex;r[i][o]=t},this.insert=function(e,t,r){var n=this;if(void 0===r&&(r=1),0===e)for(;r--;)this.pushFront(t);else if(e===this.size())for(;r--;)this.pushBack(t);else{for(var i=[],o=e;o<c;++o)i.push(this.getElementByPos(o));this.cut(e-1);for(o=0;o<r;++o)this.pushBack(t);i.forEach(function(e){return n.pushBack(e)})}},this.find=function(e){if(o===a){for(var t=s;t<=l;++t)if(r[o][t]===e)return!0;return!1}for(t=s;t<i.bucketSize;++t)if(r[o][t]===e)return!0;for(t=o+1;t<a;++t)for(var n=0;n<i.bucketSize;++n)if(r[t][n]===e)return!0;for(t=0;t<=l;++t)if(r[a][t]===e)return!0;return!1},this.reverse=function(){for(var e=0,t=c-1;e<t;){var r=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,r),++e,--t}},this.unique=function(){if(!this.empty()){var e=[],t=this.front();this.forEach(function(r,n){0!==n&&r===t||(e.push(r),t=r)});for(var r=0;r<c;++r)this.setElementByPos(r,e[r]);this.cut(e.length-1)}},this.sort=function(e){var t=[];this.forEach(function(e){t.push(e)}),t.sort(e);for(var r=0;r<c;++r)this.setElementByPos(r,t[r])},this.pushFront=function(e){this.empty()||(0===o&&0===s&&f.call(this,this.size()),s>0?--s:o>0&&(--o,s=i.bucketSize-1)),++c,r[o][s]=e},this.popFront=function(){this.empty()||(1!==this.size()&&(s<i.bucketSize-1?++s:o<a&&(++o,s=0)),c>0&&--c)},this.shrinkToFit=function(){var e=this,t=[];this.forEach(function(e){t.push(e)});var n=t.length;r=[];for(var o=Math.ceil(n/i.bucketSize),s=0;s<o;++s)r.push(new Array(i.bucketSize));this.clear(),t.forEach(function(t){return e.pushBack(t)})},this.cut=function(e){if(e<0)this.clear();else{var t=h(e),r=t.curNodeBucketIndex,n=t.curNodePointerIndex;a=r,l=n,c=e+1}},this[Symbol.iterator]=function(){return function(){var e,t;return n(this,function(n){switch(n.label){case 0:if(0===c)return[2];if(o!==a)return[3,5];t=s,n.label=1;case 1:return t<=l?[4,r[o][t]]:[3,4];case 2:n.sent(),n.label=3;case 3:return++t,[3,1];case 4:return[2];case 5:t=s,n.label=6;case 6:return t<i.bucketSize?[4,r[o][t]]:[3,9];case 7:n.sent(),n.label=8;case 8:return++t,[3,6];case 9:t=o+1,n.label=10;case 10:if(!(t<a))return[3,15];e=0,n.label=11;case 11:return e<i.bucketSize?[4,r[t][e]]:[3,14];case 12:n.sent(),n.label=13;case 13:return++e,[3,11];case 14:return++t,[3,10];case 15:t=0,n.label=16;case 16:return t<=l?[4,r[a][t]]:[3,19];case 17:n.sent(),n.label=18;case 18:return++t,[3,16];case 19:return[2]}})}()},function(){var n=i.bucketSize;e.size?n=e.size():e.length&&(n=e.length);var s=n*i.sigma;u=Math.ceil(s/i.bucketSize),u=Math.max(u,3);for(var l=0;l<u;++l)r.push(new Array(i.bucketSize));var c=Math.ceil(n/i.bucketSize);o=Math.floor(u/2)-Math.floor(c/2),a=o,e.forEach(function(e){return t.pushBack(e)})}(),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),i.sigma=3,i.bucketSize=5e3,Object.freeze(i),r.default=i},{}],27:[function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var o=e("../LinkList/LinkList"),s=e("../Map/Map");function a(e,t,r){var l=this;if(void 0===e&&(e=[]),void 0===t&&(t=a.initSize),r=r||function(e){var t,r,n=0,o="";if("number"==typeof e)n=((n=Math.floor(e))<<5)-n,n&=n;else{o="string"!=typeof e?JSON.stringify(e):e;try{for(var s=i(o),a=s.next();!a.done;a=s.next()){n=(n<<5)-n+a.value.charCodeAt(0),n&=n}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}return n^=n>>>16},0!=(t&t-1))throw new Error("initBucketNum must be 2 to the power of n");var u=0,c=[],h=Math.max(a.initSize,Math.min(a.maxSize,t));this.size=function(){return u},this.empty=function(){return 0===u},this.clear=function(){u=0,h=t,c=[]},this.forEach=function(e){var t=0;c.forEach(function(r){r.forEach(function(r){e(r,t++)})})};this.setElement=function(e,t){var n,l;if(null===e||void 0===e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!==t&&void 0!==t){var f=r(e)&h-1;if(c[f]){var p=c[f].size();if(c[f]instanceof o.default){try{for(var d=i(c[f]),g=d.next();!g.done;g=d.next()){var y=g.value;if(y.key===e)return void(y.value=t)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(l=d.return)&&l.call(d)}finally{if(n)throw n.error}}c[f].pushBack({key:e,value:t}),c[f].size()>=a.treeifyThreshold&&(c[f]=new s.default(c[f]))}else c[f].setElement(e,t);var b=c[f].size();u+=b-p}else++u,c[f]=new o.default([{key:e,value:t}]);u>h*a.sigma&&function(e){if(!(e>=a.maxSize)){h=2*e;var t=[];c.forEach(function(n,i){if(!n.empty()){if(n instanceof o.default&&1===n.size()){var l=n.front(),u=l.key,f=l.value;t[r(u)&h-1]=new o.default([{key:u,value:f}])}else if(n instanceof s.default){var p=new o.default,d=new o.default;n.forEach(function(t){0==(r(t.key)&e)?p.pushBack(t):d.pushBack(t)}),p.size()>a.untreeifyThreshold?t[i]=new s.default(p):p.size()&&(t[i]=p),d.size()>a.untreeifyThreshold?t[i+e]=new s.default(d):d.size()&&(t[i+e]=d)}else{var g=new o.default,y=new o.default;n.forEach(function(t){0==(r(t.key)&e)?g.pushBack(t):y.pushBack(t)}),g.size()&&(t[i]=g),y.size()&&(t[i+e]=y)}c[i].clear()}}),c=t}}.call(this,h)}else this.eraseElementByKey(e)},this.getElementByKey=function(e){var t,n,o=r(e)&h-1;if(c[o]){if(c[o]instanceof s.default)return c[o].getElementByKey(e);try{for(var a=i(c[o]),l=a.next();!l.done;l=a.next()){var u=l.value;if(u.key===e)return u.value}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}},this.eraseElementByKey=function(e){var t,n,l=r(e)&h-1;if(c[l]){var f=c[l].size();if(c[l]instanceof s.default)c[l].eraseElementByKey(e),c[l].size()<=a.untreeifyThreshold&&(c[l]=new o.default(c[l]));else{var p=-1;try{for(var d=i(c[l]),g=d.next();!g.done;g=d.next()){if(++p,g.value.key===e){c[l].eraseElementByPos(p);break}}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}}var y=c[l].size();u+=y-f}},this.find=function(e){var t,n,o=r(e)&h-1;if(!c[o])return!1;if(c[o]instanceof s.default)return c[o].find(e);try{for(var a=i(c[o]),l=a.next();!l.done;l=a.next()){if(l.value.key===e)return!0}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return!1},this[Symbol.iterator]=function(){return function(){var e,t,r,o,s,a;return n(this,function(n){switch(n.label){case 0:e=0,n.label=1;case 1:if(!(e<h))return[3,10];for(;e<h&&!c[e];)++e;if(e>=h)return[3,10];n.label=2;case 2:n.trys.push([2,7,8,9]),s=void 0,t=i(c[e]),r=t.next(),n.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:n.sent(),n.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return o=n.sent(),s={error:o},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(s)throw s.error}return[7];case 9:return++e,[3,1];case 10:return[2]}})}()},e.forEach(function(e){var t=e.key,r=e.value;return l.setElement(t,r)}),Object.freeze(this)}a.initSize=16,a.maxSize=1<<30,a.sigma=.75,a.treeifyThreshold=8,a.untreeifyThreshold=6,a.minTreeifySize=64,Object.freeze(a),r.default=a},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Set/Set"),s=e("../LinkList/LinkList");function a(e,t,r){var l=this;if(void 0===e&&(e=[]),void 0===t&&(t=a.initSize),r=r||function(e){var t=0,r="";if("number"==typeof e)t=((t=Math.floor(e))<<5)-t,t&=t;else{r="string"!=typeof e?JSON.stringify(e):e;for(var n=0;n<r.length;n++){t=(t<<5)-t+r.charCodeAt(n),t&=t}}return t^=t>>>16},0!=(t&t-1))throw new Error("initBucketNum must be 2 to the power of n");var u=0,c=[],h=Math.max(a.initSize,Math.min(a.maxSize,t));this.size=function(){return u},this.empty=function(){return 0===u},this.clear=function(){u=0,h=t,c=[]},this.forEach=function(e){var t=0;c.forEach(function(r){r.forEach(function(r){e(r,t++)})})};this.insert=function(e){if(null===e||void 0===e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var t=r(e)&h-1;if(c[t]){var n=c[t].size();if(c[t]instanceof s.default){if(c[t].find(e))return;c[t].pushBack(e),c[t].size()>=a.treeifyThreshold&&(c[t]=new o.default(c[t]))}else c[t].insert(e);var i=c[t].size();u+=i-n}else c[t]=new s.default([e]),++u;u>h*a.sigma&&function(e){if(!(e>=a.maxSize)){h=2*e;var t=[];c.forEach(function(n,i){if(!n.empty()){if(n instanceof s.default&&1===n.size()){var l=n.front();if(void 0===l)throw new Error("unknown error");t[r(l)&h-1]=new s.default([l])}else if(n instanceof o.default){var u=new s.default,f=new s.default;n.forEach(function(t){0==(r(t)&e)?u.pushBack(t):f.pushBack(t)}),u.size()>a.untreeifyThreshold?t[i]=new o.default(u):u.size()&&(t[i]=u),f.size()>a.untreeifyThreshold?t[i+e]=new o.default(f):f.size()&&(t[i+e]=f)}else{var p=new s.default,d=new s.default;n.forEach(function(t){0==(r(t)&e)?p.pushBack(t):d.pushBack(t)}),p.size()&&(t[i]=p),d.size()&&(t[i+e]=d)}c[i].clear()}}),c=t}}.call(this,h)},this.eraseElementByValue=function(e){var t=r(e)&h-1;if(c[t]){var n=c[t].size();c[t].eraseElementByValue(e),c[t]instanceof o.default&&c[t].size()<=a.untreeifyThreshold&&(c[t]=new s.default(c[t]));var i=c[t].size();u+=i-n}},this.find=function(e){var t=r(e)&h-1;return!!c[t]&&c[t].find(e)},this[Symbol.iterator]=function(){return function(){var e,t,r,o,s,a;return n(this,function(n){switch(n.label){case 0:e=0,n.label=1;case 1:if(!(e<h))return[3,10];for(;e<h&&!c[e];)++e;if(e>=h)return[3,10];n.label=2;case 2:n.trys.push([2,7,8,9]),s=void 0,t=i(c[e]),r=t.next(),n.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:n.sent(),n.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return o=n.sent(),s={error:o},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(s)throw s.error}return[7];case 9:return++e,[3,1];case 10:return[2]}})}()},e.forEach(function(e){return l.insert(e)}),Object.freeze(this)}a.initSize=16,a.maxSize=1<<30,a.sigma=.75,a.treeifyThreshold=8,a.untreeifyThreshold=6,a.minTreeifySize=64,Object.freeze(a),r.default=a},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(r,"__esModule",{value:!0});var i=function(){return function(e){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=e}}();function o(e){var t=this;void 0===e&&(e=[]);var r=0,o=void 0,s=void 0;this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){o=s=void 0,r=0},this.front=function(){return null===o||void 0===o?void 0:o.value},this.back=function(){return null===s||void 0===s?void 0:s.value},this.forEach=function(e){for(var t=o,r=0;t;){if(void 0===t.value)throw new Error("unknown error");e(t.value,r++),t=t.next}},this.getElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more then 0 and less then the list length");for(var t=o;e--&&t;)t=t.next;if(!t||void 0===t.value)throw new Error("unknown error");return t.value},this.eraseElementByPos=function(e){if(e<0||e>=r)throw new Error("erase pos must more then 0 and less then the list length");if(0===e)this.popFront();else if(e===r-1)this.popBack();else{for(var t=o;e--;){if(!(null===t||void 0===t?void 0:t.next))throw new Error("unknown error");t=t.next}if(!t||!t.pre||!t.next)throw new Error("unknown error");var n=t.pre,i=t.next;i.pre=n,n.next=i,r>0&&--r}},this.eraseElementByValue=function(e){for(;o&&o.value===e;)this.popFront();for(;s&&s.value===e;)this.popBack();if(o)for(var t=o;t;){if(t.value===e){var n=t.pre,i=t.next;i&&(i.pre=n),n&&(n.next=i),r>0&&--r}t=t.next}},this.pushBack=function(e){if(null===e||void 0===e)throw new Error("you can't push null or undefined here");++r;var t=new i(e);s?(s.next=t,t.pre=s,s=t):o=s=t},this.popBack=function(){s&&(r>0&&--r,s&&(o===s?o=s=void 0:(s=s.pre)&&(s.next=void 0)))},this.setElementByPos=function(e,t){if(null===t||void 0===t)throw new Error("you can't set null or undefined here");if(e<0||e>=r)throw new Error("pos must more then 0 and less then the list length");for(var n=o;e--;){if(!n)throw new Error("unknown error");n=n.next}n&&(n.value=t)},this.insert=function(e,t,n){if(void 0===n&&(n=1),null===t||void 0===t)throw new Error("you can't insert null or undefined here");if(e<0||e>r)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(n<0)throw new Error("insert size must more than 0");if(0===e)for(;n--;)this.pushFront(t);else if(e===r)for(;n--;)this.pushBack(t);else{for(var s=o,a=1;a<e;++a){if(!(null===s||void 0===s?void 0:s.next))throw new Error("unknown error");s=null===s||void 0===s?void 0:s.next}if(!s)throw new Error("unknown error");var l=s.next;for(r+=n;n--;)s.next=new i(t),s.next.pre=s,s=s.next;s.next=l,l&&(l.pre=s)}},this.find=function(e){for(var t=o;t;){if(t.value===e)return!0;t=t.next}return!1},this.reverse=function(){for(var e=o,t=s,n=0;e&&t&&2*n<r;){var i=e.value;e.value=t.value,t.value=i,e=e.next,t=t.pre,++n}},this.unique=function(){for(var e=o;e;){for(var t=e;t&&t.next&&t.value===t.next.value;)t=t.next,r>0&&--r;e.next=t.next,e.next&&(e.next.pre=e),e=e.next}},this.sort=function(e){var t=[];this.forEach(function(e){t.push(e)}),t.sort(e);var r=o;t.forEach(function(e){r&&(r.value=e,r=r.next)})},this.pushFront=function(e){if(null===e||void 0===e)throw new Error("you can't push null or undefined here");++r;var t=new i(e);o?(t.next=o,o.pre=t,o=t):o=s=t},this.popFront=function(){o&&(r>0&&--r,o&&(o===s?o=s=void 0:(o=o.next)&&(o.pre=void 0)))},this.merge=function(e){var t=this,n=o;e.forEach(function(e){for(;n&&void 0!==n.value&&n.value<=e;)n=n.next;if(void 0===n)t.pushBack(e),n=s;else if(n===o)t.pushFront(e),n=o;else{++r;var a=n.pre;a&&(a.next=new i(e),a.next.pre=a,a.next.next=n,n&&(n.pre=a.next))}})},this[Symbol.iterator]=function(){return function(){var e;return n(this,function(t){switch(t.label){case 0:e=o,t.label=1;case 1:if(void 0===e)return[3,3];if(!e.value)throw new Error("unknown error");return[4,e.value];case 2:return t.sent(),e=e.next,[3,1];case 3:return[2]}})}()},e.forEach(function(e){return t.pushBack(e)}),Object.freeze(this)}Object.freeze(o),r.default=o},{}],30:[function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Base/TreeNode");function s(e,t){var r=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var s=0,a=new o.default;a.color=o.default.TreeNodeColorType.black,this.size=function(){return s},this.empty=function(){return 0===s},this.clear=function(){s=0,a.key=a.value=void 0,a.leftChild=a.rightChild=a.brother=void 0};var l=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?l(e.leftChild):e},u=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?u(e.rightChild):e};this.front=function(){if(!this.empty()){var e=l(a);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.back=function(){if(!this.empty()){var e=u(a);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.forEach=function(e){var t,r,n=0;try{for(var o=i(this),s=o.next();!s.done;s=o.next()){e(s.value,n++)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,r;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var n=0;try{for(var o=i(this),s=o.next();!s.done;s=o.next()){var a=s.value;if(n===e)return a;++n}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}throw new Error("unknown Error")};var c=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value){var n=t(e.key,r);return 0===n?{key:e.key,value:e.value}:n<0?c(e.rightChild,r):c(e.leftChild,r)||{key:e.key,value:e.value}}};this.lowerBound=function(e){return c(a,e)};var h=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,r)<=0?h(e.rightChild,r):h(e.leftChild,r)||{key:e.key,value:e.value}};this.upperBound=function(e){return h(a,e)};var f=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value){var n=t(e.key,r);return 0===n?{key:e.key,value:e.value}:n>0?f(e.leftChild,r):f(e.rightChild,r)||{key:e.key,value:e.value}}};this.reverseLowerBound=function(e){return f(a,e)};var p=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,r)>=0?p(e.leftChild,r):p(e.rightChild,r)||{key:e.key,value:e.value}};this.reverseUpperBound=function(e){return p(a,e)};var d=function(e){var t=e.parent;if(!t){if(e===a)return;throw new Error("unknown error")}if(e.color!==o.default.TreeNodeColorType.red){var r=e.brother;if(!r)throw new Error("unknown error");if(e===t.leftChild){if(r.color===o.default.TreeNodeColorType.red){r.color=o.default.TreeNodeColorType.black,t.color=o.default.TreeNodeColorType.red;var n=t.rotateLeft();a===t&&(a=n),d(e)}else if(r.color===o.default.TreeNodeColorType.black)if(r.rightChild&&r.rightChild.color===o.default.TreeNodeColorType.red){r.color=t.color,t.color=o.default.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=o.default.TreeNodeColorType.black);n=t.rotateLeft();a===t&&(a=n),e.color=o.default.TreeNodeColorType.black}else if(r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==o.default.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||(r.color=o.default.TreeNodeColorType.red,d(t));else{r.color=o.default.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=o.default.TreeNodeColorType.black);n=r.rotateRight();a===r&&(a=n),d(e)}}else if(e===t.rightChild)if(r.color===o.default.TreeNodeColorType.red){r.color=o.default.TreeNodeColorType.black,t.color=o.default.TreeNodeColorType.red;n=t.rotateRight();a===t&&(a=n),d(e)}else if(r.color===o.default.TreeNodeColorType.black)if(r.leftChild&&r.leftChild.color===o.default.TreeNodeColorType.red){r.color=t.color,t.color=o.default.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=o.default.TreeNodeColorType.black);n=t.rotateRight();a===t&&(a=n),e.color=o.default.TreeNodeColorType.black}else if(r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==o.default.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||(r.color=o.default.TreeNodeColorType.red,d(t));else{r.color=o.default.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=o.default.TreeNodeColorType.black);n=r.rotateLeft();a===r&&(a=n),d(e)}}else e.color=o.default.TreeNodeColorType.black},g=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=l(t.rightChild);var r=e.key;e.key=t.key,t.key=r;var n=e.value;e.value=t.value,t.value=n,e=t}if(t.leftChild){t=u(t.leftChild);r=e.key;e.key=t.key,t.key=r;n=e.value;e.value=t.value,t.value=n,e=t}}d(t),t&&t.remove(),--s,a.color=o.default.TreeNodeColorType.black},y=function(e,t){return!(!e||void 0===e.key)&&(!!y(e.leftChild,t)||(!!t(e)||y(e.rightChild,t)))};this.eraseElementByPos=function(e){if(e<0||e>=s)throw new Error("pos must more than 0 and less than set's size");var t=0;y(a,function(r){return e===t?(g(r),!0):(++t,!1)})},this.eraseElementByKey=function(e){if(!this.empty()){var r=v(a,e);void 0!==r&&void 0!==r.key&&0===t(r.key,e)&&g(r)}};var b=function(e,r){if(!e||void 0===e.key)throw new Error("unknown error");var n=t(r,e.key);return n<0?e.leftChild?b(e.leftChild,r):(e.leftChild=new o.default,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):n>0?e.rightChild?b(e.rightChild,r):(e.rightChild=new o.default,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},m=function(e){var t=e.parent;if(!t){if(e===a)return;throw new Error("unknown error")}if(t.color!==o.default.TreeNodeColorType.black&&t.color===o.default.TreeNodeColorType.red){var r=t.brother,n=t.parent;if(!n)throw new Error("unknown error");if(r&&r.color===o.default.TreeNodeColorType.red)r.color=t.color=o.default.TreeNodeColorType.black,n.color=o.default.TreeNodeColorType.red,m(n);else if(!r||r.color===o.default.TreeNodeColorType.black)if(t===n.leftChild){if(e===t.leftChild){t.color=o.default.TreeNodeColorType.black,n.color=o.default.TreeNodeColorType.red;var i=n.rotateRight();n===a&&(a=i)}else if(e===t.rightChild){i=t.rotateLeft();n===a&&(a=i),m(t)}}else if(t===n.rightChild)if(e===t.leftChild){i=t.rotateRight();n===a&&(a=i),m(t)}else if(e===t.rightChild){t.color=o.default.TreeNodeColorType.black,n.color=o.default.TreeNodeColorType.red;i=n.rotateLeft();n===a&&(a=i)}}};this.setElement=function(e,r){if(null===e||void 0===e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!==r&&void 0!==r){if(this.empty())return++s,a.key=e,a.value=r,void(a.color=o.default.TreeNodeColorType.black);var n=b(a,e);void 0===n.key||0!==t(n.key,e)?(++s,n.key=e,n.value=r,m(n),a.color=o.default.TreeNodeColorType.black):n.value=r}else this.eraseElementByKey(e)};var v=function(e,r){if(e&&void 0!==e.key){var n=t(r,e.key);return n<0?v(e.leftChild,r):n>0?v(e.rightChild,r):e}};this.find=function(e){return!!v(a,e)},this.getElementByKey=function(e){var t=v(a,e);if(void 0===(null===t||void 0===t?void 0:t.key)||void 0===(null===t||void 0===t?void 0:t.value))throw new Error("unknown error");return t.value},this.union=function(e){var t=this;e.forEach(function(e){var r=e.key,n=e.value;return t.setElement(r,n)})},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(a)};var w=function(e){return n(this,function(t){switch(t.label){case 0:return e&&void 0!==e.key&&void 0!==e.value?[5,i(w(e.leftChild))]:[2];case 1:return t.sent(),[4,{key:e.key,value:e.value}];case 2:return t.sent(),[5,i(w(e.rightChild))];case 3:return t.sent(),[2]}})};this[Symbol.iterator]=function(){return w(a)},e.forEach(function(e){var t=e.key,n=e.value;return r.setElement(t,n)}),Object.freeze(this)}Object.freeze(s),r.default=s},{"../Base/TreeNode":25}],31:[function(e,t,r){"use strict";function n(e,t){void 0===e&&(e=[]),t=t||function(e,t){return e>t?-1:e<t?1:0};var r=[];e.forEach(function(e){return r.push(e)});var n=r.length,i=function(e,t){if(e<0||e>=n)throw new Error("unknown error");if(t<0||t>=n)throw new Error("unknown error");var i=r[e];r[e]=r[t],r[t]=i},o=function(e){if(e<0||e>=n)throw new Error("unknown error");var o=2*e+1,s=2*e+2;o<n&&t(r[e],r[o])>0&&i(e,o),s<n&&t(r[e],r[s])>0&&i(e,s)};!function(){for(var e=Math.floor((n-1)/2);e>=0;--e)for(var o=e,s=2*o+1;s<n;){var a=s+1,l=s;if(a<n&&t(r[s],r[a])>0&&(l=a),t(r[o],r[l])<=0)break;i(o,l),s=2*(o=l)+1}}(),this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,r.length=0},this.push=function(e){if(r.push(e),1!==++n)for(var i=n-1;i>0;){var s=Math.floor((i-1)/2);if(t(r[s],e)<=0)break;o(s),i=s}},this.pop=function(){if(!this.empty())if(1!==this.size()){var e=r[n-1];--n;for(var i=0;i<this.size();){var o=2*i+1,s=2*i+2;if(o>=this.size())break;var a=o;if(s<this.size()&&t(r[o],r[s])>0&&(a=s),t(r[a],e)>=0)break;r[i]=r[a],i=a}r[i]=e}else--n},this.top=function(){return r[0]},Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(n),r.default=n},{}],32:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../LinkList/LinkList");function i(e){void 0===e&&(e=[]);var t=new n.default(e);this.size=function(){return t.size()},this.empty=function(){return t.empty()},this.clear=function(){t.clear()},this.push=function(e){t.pushBack(e)},this.pop=function(){t.popFront()},this.front=function(){return t.front()},Object.freeze(this)}Object.freeze(i),r.default=i},{"../LinkList/LinkList":29}],33:[function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Base/TreeNode");function s(e,t){var r=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var s=0,a=new o.default;a.color=o.default.TreeNodeColorType.black,this.size=function(){return s},this.empty=function(){return 0===s},this.clear=function(){s=0,a.key=void 0,a.leftChild=a.rightChild=a.brother=a.parent=void 0,a.color=o.default.TreeNodeColorType.black};var l=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?l(e.leftChild):e},u=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?u(e.rightChild):e};this.front=function(){if(!this.empty())return l(a).key},this.back=function(){if(!this.empty())return u(a).key},this.forEach=function(e){var t,r,n=0;try{for(var o=i(this),s=o.next();!s.done;s=o.next()){e(s.value,n++)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,r;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var n=0;try{for(var o=i(this),s=o.next();!s.done;s=o.next()){var a=s.value;if(n===e)return a;++n}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}throw new Error("unknown error")};var c=function(e){var t=e.parent;if(!t){if(e===a)return;throw new Error("unknown error")}if(e.color!==o.default.TreeNodeColorType.red){var r=e.brother;if(!r)throw new Error("unknown error");if(e===t.leftChild){if(r.color===o.default.TreeNodeColorType.red){r.color=o.default.TreeNodeColorType.black,t.color=o.default.TreeNodeColorType.red;var n=t.rotateLeft();a===t&&(a=n),c(e)}else if(r.color===o.default.TreeNodeColorType.black)if(r.rightChild&&r.rightChild.color===o.default.TreeNodeColorType.red){r.color=t.color,t.color=o.default.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=o.default.TreeNodeColorType.black);n=t.rotateLeft();a===t&&(a=n),e.color=o.default.TreeNodeColorType.black}else if(r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==o.default.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||(r.color=o.default.TreeNodeColorType.red,c(t));else{r.color=o.default.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=o.default.TreeNodeColorType.black);n=r.rotateRight();a===r&&(a=n),c(e)}}else if(e===t.rightChild)if(r.color===o.default.TreeNodeColorType.red){r.color=o.default.TreeNodeColorType.black,t.color=o.default.TreeNodeColorType.red;n=t.rotateRight();a===t&&(a=n),c(e)}else if(r.color===o.default.TreeNodeColorType.black)if(r.leftChild&&r.leftChild.color===o.default.TreeNodeColorType.red){r.color=t.color,t.color=o.default.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=o.default.TreeNodeColorType.black);n=t.rotateRight();a===t&&(a=n),e.color=o.default.TreeNodeColorType.black}else if(r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==o.default.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==o.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==o.default.TreeNodeColorType.black||(r.color=o.default.TreeNodeColorType.red,c(t));else{r.color=o.default.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=o.default.TreeNodeColorType.black);n=r.rotateLeft();a===r&&(a=n),c(e)}}else e.color=o.default.TreeNodeColorType.black},h=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=l(t.rightChild);var r=e.key;e.key=t.key,t.key=r,e=t}if(t.leftChild){t=u(t.leftChild);r=e.key;e.key=t.key,t.key=r,e=t}}c(t),t&&t.remove(),--s,a.color=o.default.TreeNodeColorType.black},f=function(e,t){return!(!e||void 0===e.key)&&(!!f(e.leftChild,t)||(!!t(e)||f(e.rightChild,t)))};this.eraseElementByPos=function(e){if(e<0||e>=s)throw new Error("pos must more than 0 and less than set's size");var t=0;f(a,function(r){return e===t?(h(r),!0):(++t,!1)})},this.eraseElementByValue=function(e){if(!this.empty()){var r=g(a,e);void 0!==r&&void 0!==r.key&&0===t(r.key,e)&&h(r)}};var p=function(e,r){if(!e||void 0===e.key)throw new Error("unknown error");var n=t(r,e.key);return n<0?e.leftChild?p(e.leftChild,r):(e.leftChild=new o.default,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):n>0?e.rightChild?p(e.rightChild,r):(e.rightChild=new o.default,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},d=function(e){var t=e.parent;if(!t){if(e===a)return;throw new Error("unknown error")}if(t.color!==o.default.TreeNodeColorType.black&&t.color===o.default.TreeNodeColorType.red){var r=t.brother,n=t.parent;if(!n)throw new Error("unknown error");if(r&&r.color===o.default.TreeNodeColorType.red)r.color=t.color=o.default.TreeNodeColorType.black,n.color=o.default.TreeNodeColorType.red,d(n);else if(!r||r.color===o.default.TreeNodeColorType.black)if(t===n.leftChild){if(e===t.leftChild){t.color=o.default.TreeNodeColorType.black,n.color=o.default.TreeNodeColorType.red;var i=n.rotateRight();n===a&&(a=i)}else if(e===t.rightChild){i=t.rotateLeft();n===a&&(a=i),d(t)}}else if(t===n.rightChild)if(e===t.leftChild){i=t.rotateRight();n===a&&(a=i),d(t)}else if(e===t.rightChild){t.color=o.default.TreeNodeColorType.black,n.color=o.default.TreeNodeColorType.red;i=n.rotateLeft();n===a&&(a=i)}}};this.insert=function(e){if(null===e||void 0===e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++s,a.key=e,void(a.color=o.default.TreeNodeColorType.black);var r=p(a,e);void 0!==r.key&&0===t(r.key,e)||(++s,r.key=e,d(r),a.color=o.default.TreeNodeColorType.black)};var g=function(e,r){if(e&&void 0!==e.key){var n=t(r,e.key);return n<0?g(e.leftChild,r):n>0?g(e.rightChild,r):e}};this.find=function(e){var r=g(a,e);return void 0!==r&&void 0!==r.key&&0===t(r.key,e)};var y=function(e,r){if(e&&void 0!==e.key){var n=t(e.key,r);return 0===n?e.key:n<0?y(e.rightChild,r):y(e.leftChild,r)||e.key}};this.lowerBound=function(e){return y(a,e)};var b=function(e,r){if(e&&void 0!==e.key)return t(e.key,r)<=0?b(e.rightChild,r):b(e.leftChild,r)||e.key};this.upperBound=function(e){return b(a,e)};var m=function(e,r){if(e&&void 0!==e.key){var n=t(e.key,r);return 0===n?e.key:n>0?m(e.leftChild,r):m(e.rightChild,r)||e.key}};this.reverseLowerBound=function(e){return m(a,e)};var v=function(e,r){if(e&&void 0!==e.key)return t(e.key,r)>=0?v(e.leftChild,r):v(e.rightChild,r)||e.key};this.reverseUpperBound=function(e){return v(a,e)},this.union=function(e){var t=this;e.forEach(function(e){return t.insert(e)})},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(a)};var w=function(e){return n(this,function(t){switch(t.label){case 0:return e&&void 0!==e.key?[5,i(w(e.leftChild))]:[2];case 1:return t.sent(),[4,e.key];case 2:return t.sent(),[5,i(w(e.rightChild))];case 3:return t.sent(),[2]}})};this[Symbol.iterator]=function(){return w(a)},e.forEach(function(e){return r.insert(e)}),Object.freeze(this)}Object.freeze(s),r.default=s},{"../Base/TreeNode":25}],34:[function(e,t,r){"use strict";function n(e){var t=this;void 0===e&&(e=[]);var r=0,n=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,n.length=0},this.push=function(e){n.push(e),++r},this.pop=function(){n.pop(),r>0&&--r},this.top=function(){return n[r-1]},e.forEach(function(e){return t.push(e)}),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(n),r.default=n},{}],35:[function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function a(e){var t=this;void 0===e&&(e=[]);var r=0,a=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,a.length=0},this.front=function(){if(!this.empty())return a[0]},this.back=function(){if(!this.empty())return a[r-1]},this.forEach=function(e){a.forEach(e)},this.getElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");return a[e]},this.eraseElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");for(var t=e;t<r-1;++t)a[t]=a[t+1];this.popBack()},this.eraseElementByValue=function(e){var t=[];this.forEach(function(r){r!==e&&t.push(r)}),t.forEach(function(e,t){a[t]=e});for(var n=t.length;r>n;)this.popBack()},this.pushBack=function(e){a.push(e),++r},this.popBack=function(){a.pop(),r>0&&--r},this.setElementByPos=function(e,t){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");a[e]=t},this.insert=function(e,t,n){if(void 0===n&&(n=1),e<0||e>r)throw new Error("pos must more than 0 and less than or equal to vector's size");a.splice.apply(a,o([e,0],i(new Array(n).fill(t)),!1)),r+=n},this.find=function(e){return a.includes(e)},this.reverse=function(){a.reverse()},this.unique=function(){var e,t=[];this.forEach(function(r,n){0!==n&&r===e||(t.push(r),e=r)}),t.forEach(function(e,t){a[t]=e});for(var n=t.length;r>n;)this.popBack()},this.sort=function(e){a.sort(e)},this[Symbol.iterator]=function(){return function(){return n(this,function(e){switch(e.label){case 0:return[5,s(a)];case 1:return[2,e.sent()]}})}()},e.forEach(function(e){return t.pushBack(e)}),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(a),r.default=a},{}],36:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.HashMap=r.HashSet=r.Map=r.Set=r.PriorityQueue=r.Deque=r.LinkList=r.Queue=r.Stack=r.Vector=void 0;var n=e("./Vector/Vector");r.Vector=n.default;var i=e("./Stack/Stack");r.Stack=i.default;var o=e("./Queue/Queue");r.Queue=o.default;var s=e("./LinkList/LinkList");r.LinkList=s.default;var a=e("./Deque/Deque");r.Deque=a.default;var l=e("./PriorityQueue/PriorityQueue");r.PriorityQueue=l.default;var u=e("./Set/Set");r.Set=u.default;var c=e("./Map/Map");r.Map=c.default;var h=e("./HashSet/HashSet");r.HashSet=h.default;var f=e("./HashMap/HashMap");r.HashMap=f.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(e,t,r){"use strict";const n=e("yallist"),i=Symbol("max"),o=Symbol("length"),s=Symbol("lengthCalculator"),a=Symbol("allowStale"),l=Symbol("maxAge"),u=Symbol("dispose"),c=Symbol("noDisposeOnSet"),h=Symbol("lruList"),f=Symbol("cache"),p=Symbol("updateAgeOnGet"),d=()=>1;const g=(e,t,r)=>{const n=e[f].get(t);if(n){const t=n.value;if(y(e,t)){if(m(e,n),!e[a])return}else r&&(e[p]&&(n.value.now=Date.now()),e[h].unshiftNode(n));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[l]&&r>e[l]},b=e=>{if(e[o]>e[i])for(let t=e[h].tail;e[o]>e[i]&&null!==t;){const r=t.prev;m(e,t),t=r}},m=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[o]-=r.length,e[f].delete(r.key),e[h].removeNode(t)}};class v{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const w=(e,t,r,n)=>{let i=r.value;y(e,i)&&(m(e,r),e[a]||(i=void 0)),i&&t.call(n,i.value,i.key,e)};t.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||d;if(this[s]="function"!=typeof t?d:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[u]=e.dispose,this[c]=e.noDisposeOnSet||!1,this[p]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,b(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,b(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[s]&&(this[s]=e,this[o]=0,this[h].forEach(e=>{e.length=this[s](e.value,e.key),this[o]+=e.length})),b(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let r=this[h].tail;null!==r;){const n=r.prev;w(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[h].head;null!==r;){const n=r.next;w(this,e,r,t),r=n}}keys(){return this[h].toArray().map(e=>e.key)}values(){return this[h].toArray().map(e=>e.value)}reset(){this[u]&&this[h]&&this[h].length&&this[h].forEach(e=>this[u](e.key,e.value)),this[f]=new Map,this[h]=new n,this[o]=0}dump(){return this[h].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[h]}set(e,t,r){if((r=r||this[l])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,a=this[s](t,e);if(this[f].has(e)){if(a>this[i])return m(this,this[f].get(e)),!1;const s=this[f].get(e).value;return this[u]&&(this[c]||this[u](e,s.value)),s.now=n,s.maxAge=r,s.value=t,this[o]+=a-s.length,s.length=a,this.get(e),b(this),!0}const p=new v(e,t,a,n,r);return p.length>this[i]?(this[u]&&this[u](e,t),!1):(this[o]+=p.length,this[h].unshift(p),this[f].set(e,this[h].head),b(this),!0)}has(e){if(!this[f].has(e))return!1;const t=this[f].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[h].tail;return e?(m(this,e),e.value):null}del(e){m(this,this[f].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[f].forEach((e,t)=>g(this,t,!1))}}},{yallist:83}],38:[function(e,t,r){(function(e){(function(){const r=t.exports;r.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},r.codes={};for(const e in r.types){const t=r.types[e];r.codes[t]=e}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=e.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=e.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=e.from([r.codes.connect<<r.CMD_SHIFT]),r.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},r.propertiesCodes={};for(const e in r.properties){const t=r.properties[e];r.propertiesCodes[t]=e}function n(t){return[0,1,2].map(n=>[0,1].map(i=>[0,1].map(o=>{const s=e.alloc(1);return s.writeUInt8(r.codes[t]<<r.CMD_SHIFT|(i?r.DUP_MASK:0)|n<<r.QOS_SHIFT|o,0,!0),s})))}r.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},r.PUBLISH_HEADER=n("publish"),r.SUBSCRIBE_HEADER=n("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=n("unsubscribe"),r.ACKS={unsuback:n("unsuback"),puback:n("puback"),pubcomp:n("pubcomp"),pubrel:n("pubrel"),pubrec:n("pubrec")},r.SUBACK_HEADER=e.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=e.from([3]),r.VERSION4=e.from([4]),r.VERSION5=e.from([5]),r.VERSION131=e.from([131]),r.VERSION132=e.from([132]),r.QOS=[0,1,2].map(t=>e.from([t])),r.EMPTY={pingreq:e.from([r.codes.pingreq<<4,0]),pingresp:e.from([r.codes.pingresp<<4,0]),disconnect:e.from([r.codes.disconnect<<4,0])}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],39:[function(e,t,r){(function(r){(function(){const n=e("./writeToStream"),i=e("events");class o extends i{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const t=new Array(this._array.length),n=this._array;let i,o=0;for(i=0;i<n.length&&void 0!==n[i];i++)"string"!=typeof n[i]?t[i]=n[i].length:t[i]=r.byteLength(n[i]),e+=t[i];const s=r.allocUnsafe(e);for(i=0;i<n.length&&void 0!==n[i];i++)"string"!=typeof n[i]?(n[i].copy(s,o),o+=t[i]):(s.write(n[i],o),o+=t[i]);return s}}t.exports=function(e,t){const r=new o;return n(e,r,t),r.concat()}}).call(this)}).call(this,e("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(e,t,r){r.parser=e("./parser").parser,r.generate=e("./generate"),r.writeToStream=e("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(e,t,r){(function(e){(function(){const r=65536,n={},i=e.isBuffer(e.from([1,2]).subarray(0,1));function o(t){const r=e.allocUnsafe(2);return r.writeUInt8(t>>8,0),r.writeUInt8(255&t,1),r}t.exports={cache:n,generateCache:function(){for(let e=0;e<r;e++)n[e]=o(e)},generateNumber:o,genBufVariableByteInt:function(t){let r=0,n=0;const o=e.allocUnsafe(4);do{r=t%128|0,(t=t/128|0)>0&&(r|=128),o.writeUInt8(r,n++)}while(t>0&&n<4);return t>0&&(n=0),i?o.subarray(0,n):o.slice(0,n)},generate4ByteBuffer:function(t){const r=e.allocUnsafe(4);return r.writeUInt32BE(t,0),r}}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],42:[function(e,t,r){t.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},{}],43:[function(e,t,r){const n=e("bl"),i=e("events"),o=e("./packet"),s=e("./constants"),a=e("debug")("mqtt-packet:parser");class l extends i{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof l?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new l).parser(e)}_resetState(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=n(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),a("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const e=this._list.readUInt8(0);return this.packet.cmd=s.types[e>>s.CMD_SHIFT],this.packet.retain=0!=(e&s.RETAIN_MASK),this.packet.qos=e>>s.QOS_SHIFT&s.QOS_MASK,this.packet.dup=0!=(e&s.DUP_MASK),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),a("_parseLength %d",e.value),!!e}_parsePayload(){a("_parsePayload: payload %O",this._list);let e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return a("_parsePayload complete result: %s",e),e}_parseConnect(){let e,t,r,n;a("_parseConnect");const i={},o=this.packet,l=this._parseString();if(null===l)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==l&&"MQIsdp"!==l)return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=l,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.protocolVersion=this._list.readUInt8(this._pos),o.protocolVersion>=128&&(o.bridgeMode=!0,o.protocolVersion=o.protocolVersion-128),3!==o.protocolVersion&&4!==o.protocolVersion&&5!==o.protocolVersion)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(i.username=this._list.readUInt8(this._pos)&s.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK,i.will&&(o.will={},o.will.retain=0!=(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),o.will.qos=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT),o.clean=0!=(this._list.readUInt8(this._pos)&s.CLEAN_SESSION_MASK),this._pos++,o.keepalive=this._parseNum(),-1===o.keepalive)return this._emitError(new Error("Packet too short"));if(5===o.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(o.properties=e)}const u=this._parseString();if(null===u)return this._emitError(new Error("Packet too short"));if(o.clientId=u,a("_parseConnect: packet.clientId: %s",o.clientId),i.will){if(5===o.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(o.will.properties=e)}if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(o.will.topic=e,a("_parseConnect: packet.will.topic: %s",o.will.topic),null===(t=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));o.will.payload=t,a("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(i.username){if(null===(n=this._parseString()))return this._emitError(new Error("Cannot parse username"));o.username=n,a("_parseConnect: packet.username: %s",o.username)}if(i.password){if(null===(r=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));o.password=r}return this.settings=o,a("_parseConnect: complete"),o}_parseConnack(){a("_parseConnack");const e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&s.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(-1===e.returnCode||-1===e.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}a("_parseConnack: complete")}_parsePublish(){a("_parsePublish");const e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),a("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){a("_parseSubscribe");const e=this.packet;let t,r,n,i,o,l,u;if(1!==e.qos)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){if(null===(t=this._parseString()))return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));n=(r=this._parseByte())&s.SUBSCRIBE_OPTIONS_QOS_MASK,l=0!=(r>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK),o=0!=(r>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK),i=r>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,u={topic:t,qos:n},5===this.settings.protocolVersion?(u.nl=l,u.rap=o,u.rh=i):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",u),e.subscriptions.push(u)}}}_parseSuback(){a("_parseSuback");const e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){a("_parseUnsubscribe");const e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){const t=this._parseString();if(null===t)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){a("_parseUnsuback");const e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(e.length>2?(e.reasonCode=this._parseByte(),a("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){const e=this.packet;if(a("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return a("_parseDisconnect result: true"),!0}_parseAuth(){a("_parseAuth");const e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();const t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),a("_parseAuth: result: true"),!0}_parseMessageId(){const e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){const t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;const n=this._list.toString("utf8",this._pos,r);return this._pos+=t,a("_parseString: result: %s",n),n}_parseStringPair(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;const r=this._list.slice(this._pos,t);return this._pos+=e,a("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;const e=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const e=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){a("_parseVarByteNum");let t,r=0,n=1,i=0,o=!1;const l=this._pos?this._pos:0;for(;r<4&&l+r<this._list.length;){if(i+=n*((t=this._list.readUInt8(l+r++))&s.VARBYTEINT_MASK),n*=128,0==(t&s.VARBYTEINT_FIN_MASK)){o=!0;break}if(this._list.length<=r)break}return!o&&4===r&&this._list.length>=r&&this._emitError(new Error("Invalid variable byte integer")),l&&(this._pos+=r),a("_parseVarByteNum: result: %o",o=!!o&&(e?{bytes:r,value:i}:i)),o}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",e),e}_parseByType(e){switch(a("_parseByType: type: %s",e),e){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){a("_parseProperties");const e=this._parseVarByteNum(),t=this._pos+e,r={};for(;this._pos<t;){const e=this._parseByte();if(!e)return this._emitError(new Error("Cannot parse property code type")),!1;const t=s.propertiesCodes[e];if(!t)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==t)r[t]?Array.isArray(r[t])?r[t].push(this._parseByType(s.propertiesTypes[t])):(r[t]=[r[t]],r[t].push(this._parseByType(s.propertiesTypes[t]))):r[t]=this._parseByType(s.propertiesTypes[t]);else{r[t]||(r[t]=Object.create(null));const e=this._parseByType(s.propertiesTypes[t]);if(r[t][e.name])if(Array.isArray(r[t][e.name]))r[t][e.name].push(e.value);else{const n=r[t][e.name];r[t][e.name]=[n],r[t][e.name].push(e.value)}else r[t][e.name]=e.value}}return r}_newPacket(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),a("_newPacket: new packet"),this.packet=new o,this._pos=0,!0}_emitError(e){a("_emitError"),this.error=e,this.emit("error",e)}}t.exports=l},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(e,t,r){(function(r){(function(){const n=e("./constants"),i=r.allocUnsafe(0),o=r.from([0]),s=e("./numbers"),a=e("process-nextick-args").nextTick,l=e("debug")("mqtt-packet:writeToStream"),u=s.cache,c=s.generateNumber,h=s.generateCache,f=s.genBufVariableByteInt,p=s.generate4ByteBuffer;let d=k,g=!0;function y(e,t,s){switch(l("generate called"),t.cork&&(t.cork(),a(b,t)),g&&(g=!1,h()),l("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return function(e,t,i){const o=e||{},s=o.protocolId||"MQTT";let a=o.protocolVersion||4;const l=o.will;let u=o.clean;const c=o.keepalive||0,h=o.clientId||"",f=o.username,p=o.password,g=o.properties;void 0===u&&(u=!0);let y=0;if(!s||"string"!=typeof s&&!r.isBuffer(s))return t.emit("error",new Error("Invalid protocolId")),!1;y+=s.length+2;if(3!==a&&4!==a&&5!==a)return t.emit("error",new Error("Invalid protocol version")),!1;y+=1;if(("string"==typeof h||r.isBuffer(h))&&(h||a>=4)&&(h||u))y+=r.byteLength(h)+2;else{if(a<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*u==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof c||c<0||c>65535||c%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;y+=2;if(y+=1,5===a){var b=C(t,g);if(!b)return!1;y+=b.length}if(l){if("object"!=typeof l)return t.emit("error",new Error("Invalid will")),!1;if(!l.topic||"string"!=typeof l.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(y+=r.byteLength(l.topic)+2,y+=2,l.payload){if(!(l.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof l.payload?y+=r.byteLength(l.payload):y+=l.payload.length}var m={};if(5===a){if(!(m=C(t,l.properties)))return!1;y+=m.length}}let _=!1;if(null!=f){if(!P(f))return t.emit("error",new Error("Invalid username")),!1;_=!0,y+=r.byteLength(f)+2}if(null!=p){if(!_)return t.emit("error",new Error("Username is required to use password")),!1;if(!P(p))return t.emit("error",new Error("Invalid password")),!1;y+=I(p)+2}t.write(n.CONNECT_HEADER),v(t,y),E(t,s),o.bridgeMode&&(a+=128);t.write(131===a?n.VERSION131:132===a?n.VERSION132:4===a?n.VERSION4:5===a?n.VERSION5:n.VERSION3);let k=0;k|=null!=f?n.USERNAME_MASK:0,k|=null!=p?n.PASSWORD_MASK:0,k|=l&&l.retain?n.WILL_RETAIN_MASK:0,k|=l&&l.qos?l.qos<<n.WILL_QOS_SHIFT:0,k|=l?n.WILL_FLAG_MASK:0,k|=u?n.CLEAN_SESSION_MASK:0,t.write(r.from([k])),d(t,c),5===a&&b.write();E(t,h),l&&(5===a&&m.write(),w(t,l.topic),E(t,l.payload));null!=f&&E(t,f);null!=p&&E(t,p);return!0}(e,t);case"connack":return function(e,t,i){const s=i?i.protocolVersion:4,a=e||{},l=5===s?a.reasonCode:a.returnCode,u=a.properties;let c=2;if("number"!=typeof l)return t.emit("error",new Error("Invalid return code")),!1;let h=null;if(5===s){if(!(h=C(t,u)))return!1;c+=h.length}t.write(n.CONNACK_HEADER),v(t,c),t.write(a.sessionPresent?n.SESSIONPRESENT_HEADER:o),t.write(r.from([l])),null!=h&&h.write();return!0}(e,t,s);case"publish":return function(e,t,o){l("publish: packet: %o",e);const s=o?o.protocolVersion:4,a=e||{},u=a.qos||0,c=a.retain?n.RETAIN_MASK:0,h=a.topic,f=a.payload||i,p=a.messageId,g=a.properties;let y=0;if("string"==typeof h)y+=r.byteLength(h)+2;else{if(!r.isBuffer(h))return t.emit("error",new Error("Invalid topic")),!1;y+=h.length+2}r.isBuffer(f)?y+=f.length:y+=r.byteLength(f);if(u&&"number"!=typeof p)return t.emit("error",new Error("Invalid messageId")),!1;u&&(y+=2);let b=null;if(5===s){if(!(b=C(t,g)))return!1;y+=b.length}t.write(n.PUBLISH_HEADER[u][a.dup?1:0][c?1:0]),v(t,y),d(t,I(h)),t.write(h),u>0&&d(t,p);null!=b&&b.write();return l("publish: payload: %o",f),t.write(f)}(e,t,s);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(e,t,i){const o=i?i.protocolVersion:4,s=e||{},a=s.cmd||"puback",l=s.messageId,u=s.dup&&"pubrel"===a?n.DUP_MASK:0;let c=0;const h=s.reasonCode,f=s.properties;let p=5===o?3:2;"pubrel"===a&&(c=1);if("number"!=typeof l)return t.emit("error",new Error("Invalid messageId")),!1;let g=null;if(5===o&&"object"==typeof f){if(!(g=T(t,f,i,p)))return!1;p+=g.length}t.write(n.ACKS[a][c][u][0]),v(t,p),d(t,l),5===o&&t.write(r.from([h]));null!==g&&g.write();return!0}(e,t,s);case"subscribe":return function(e,t,i){l("subscribe: packet: ");const o=i?i.protocolVersion:4,s=e||{},a=s.dup?n.DUP_MASK:0,u=s.messageId,c=s.subscriptions,h=s.properties;let f=0;if("number"!=typeof u)return t.emit("error",new Error("Invalid messageId")),!1;f+=2;let p=null;if(5===o){if(!(p=C(t,h)))return!1;f+=p.length}if("object"!=typeof c||!c.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(let e=0;e<c.length;e+=1){const n=c[e].topic,i=c[e].qos;if("string"!=typeof n)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof i)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===o){const r=c[e].nl||!1;if("boolean"!=typeof r)return t.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;const n=c[e].rap||!1;if("boolean"!=typeof n)return t.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const i=c[e].rh||0;if("number"!=typeof i||i>2)return t.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}f+=r.byteLength(n)+2+1}l("subscribe: writing to stream: %o",n.SUBSCRIBE_HEADER),t.write(n.SUBSCRIBE_HEADER[1][a?1:0][0]),v(t,f),d(t,u),null!==p&&p.write();let g=!0;for(const e of c){const i=e.topic,s=e.qos,a=+e.nl,l=+e.rap,u=e.rh;let c;w(t,i),c=n.SUBSCRIBE_OPTIONS_QOS[s],5===o&&(c|=a?n.SUBSCRIBE_OPTIONS_NL:0,c|=l?n.SUBSCRIBE_OPTIONS_RAP:0,c|=u?n.SUBSCRIBE_OPTIONS_RH[u]:0),g=t.write(r.from([c]))}return g}(e,t,s);case"suback":return function(e,t,i){const o=i?i.protocolVersion:4,s=e||{},a=s.messageId,l=s.granted,u=s.properties;let c=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;c+=2;if("object"!=typeof l||!l.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<l.length;e+=1){if("number"!=typeof l[e])return t.emit("error",new Error("Invalid qos vector")),!1;c+=1}let h=null;if(5===o){if(!(h=T(t,u,i,c)))return!1;c+=h.length}t.write(n.SUBACK_HEADER),v(t,c),d(t,a),null!==h&&h.write();return t.write(r.from(l))}(e,t,s);case"unsubscribe":return function(e,t,i){const o=i?i.protocolVersion:4,s=e||{},a=s.messageId,l=s.dup?n.DUP_MASK:0,u=s.unsubscriptions,c=s.properties;let h=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;h+=2;if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(let e=0;e<u.length;e+=1){if("string"!=typeof u[e])return t.emit("error",new Error("Invalid unsubscriptions")),!1;h+=r.byteLength(u[e])+2}let f=null;if(5===o){if(!(f=C(t,c)))return!1;h+=f.length}t.write(n.UNSUBSCRIBE_HEADER[1][l?1:0][0]),v(t,h),d(t,a),null!==f&&f.write();let p=!0;for(let e=0;e<u.length;e++)p=w(t,u[e]);return p}(e,t,s);case"unsuback":return function(e,t,i){const o=i?i.protocolVersion:4,s=e||{},a=s.messageId,l=s.dup?n.DUP_MASK:0,u=s.granted,c=s.properties,h=s.cmd;let f=2;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(5===o){if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<u.length;e+=1){if("number"!=typeof u[e])return t.emit("error",new Error("Invalid qos vector")),!1;f+=1}}let p=null;if(5===o){if(!(p=T(t,c,i,f)))return!1;f+=p.length}t.write(n.ACKS[h][0][l][0]),v(t,f),d(t,a),null!==p&&p.write();5===o&&t.write(r.from(u));return!0}(e,t,s);case"pingreq":case"pingresp":return function(e,t,r){return t.write(n.EMPTY[e.cmd])}(e,t);case"disconnect":return function(e,t,i){const o=i?i.protocolVersion:4,s=e||{},a=s.reasonCode,l=s.properties;let u=5===o?1:0,c=null;if(5===o){if(!(c=T(t,l,i,u)))return!1;u+=c.length}t.write(r.from([n.codes.disconnect<<4])),v(t,u),5===o&&t.write(r.from([a]));null!==c&&c.write();return!0}(e,t,s);case"auth":return function(e,t,i){const o=i?i.protocolVersion:4,s=e||{},a=s.reasonCode,l=s.properties;let u=5===o?1:0;5!==o&&t.emit("error",new Error("Invalid mqtt version for auth packet"));const c=T(t,l,i,u);if(!c)return!1;u+=c.length,t.write(r.from([n.codes.auth<<4])),v(t,u),t.write(r.from([a])),null!==c&&c.write();return!0}(e,t,s);default:return t.emit("error",new Error("Unknown command")),!1}}function b(e){e.uncork()}Object.defineProperty(y,"cacheNumbers",{get:()=>d===k,set(e){e?(u&&0!==Object.keys(u).length||(g=!0),d=k):(g=!1,d=S)}});const m={};function v(e,t){if(t>n.VARBYTEINT_MAX)return e.emit("error",new Error(`Invalid variable byte integer: ${t}`)),!1;let r=m[t];return r||(r=f(t),t<16384&&(m[t]=r)),l("writeVarByteInt: writing to stream: %o",r),e.write(r)}function w(e,t){const n=r.byteLength(t);return d(e,n),l("writeString: %s",t),e.write(t,"utf8")}function _(e,t,r){w(e,t),w(e,r)}function k(e,t){return l("writeNumberCached: number: %d",t),l("writeNumberCached: %o",u[t]),e.write(u[t])}function S(e,t){const r=c(t);return l("writeNumberGenerated: %o",r),e.write(r)}function E(e,t){"string"==typeof t?w(e,t):t?(d(e,t.length),e.write(t)):d(e,0)}function C(e,t){if("object"!=typeof t||null!=t.length)return{length:1,write(){A(e,{},0)}};let i=0;function o(t,i){let o=0;switch(n.propertiesTypes[t]){case"byte":if("boolean"!=typeof i)return e.emit("error",new Error(`Invalid ${t}: ${i}`)),!1;o+=2;break;case"int8":if("number"!=typeof i||i<0||i>255)return e.emit("error",new Error(`Invalid ${t}: ${i}`)),!1;o+=2;break;case"binary":if(i&&null===i)return e.emit("error",new Error(`Invalid ${t}: ${i}`)),!1;o+=1+r.byteLength(i)+2;break;case"int16":if("number"!=typeof i||i<0||i>65535)return e.emit("error",new Error(`Invalid ${t}: ${i}`)),!1;o+=3;break;case"int32":if("number"!=typeof i||i<0||i>4294967295)return e.emit("error",new Error(`Invalid ${t}: ${i}`)),!1;o+=5;break;case"var":if("number"!=typeof i||i<0||i>268435455)return e.emit("error",new Error(`Invalid ${t}: ${i}`)),!1;o+=1+r.byteLength(f(i));break;case"string":if("string"!=typeof i)return e.emit("error",new Error(`Invalid ${t}: ${i}`)),!1;o+=3+r.byteLength(i.toString());break;case"pair":if("object"!=typeof i)return e.emit("error",new Error(`Invalid ${t}: ${i}`)),!1;o+=Object.getOwnPropertyNames(i).reduce((e,t)=>{const n=i[t];return Array.isArray(n)?e+=n.reduce((e,n)=>e+=3+r.byteLength(t.toString())+2+r.byteLength(n.toString()),0):e+=3+r.byteLength(t.toString())+2+r.byteLength(i[t].toString()),e},0);break;default:return e.emit("error",new Error(`Invalid property ${t}: ${i}`)),!1}return o}if(t)for(const e in t){let r=0,n=0;const s=t[e];if(Array.isArray(s))for(let t=0;t<s.length;t++){if(!(n=o(e,s[t])))return!1;r+=n}else{if(!(n=o(e,s)))return!1;r=n}if(!r)return!1;i+=r}return{length:r.byteLength(f(i))+i,write(){A(e,t,i)}}}function T(e,t,r,n){const i=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0;let s=C(e,t);if(o)for(;n+s.length>o;){const r=i.shift();if(!r||!t[r])return!1;delete t[r],s=C(e,t)}return s}function x(e,t,i){switch(n.propertiesTypes[t]){case"byte":e.write(r.from([n.properties[t]])),e.write(r.from([+i]));break;case"int8":e.write(r.from([n.properties[t]])),e.write(r.from([i]));break;case"binary":e.write(r.from([n.properties[t]])),E(e,i);break;case"int16":e.write(r.from([n.properties[t]])),d(e,i);break;case"int32":e.write(r.from([n.properties[t]])),function(e,t){const r=p(t);l("write4ByteNumber: %o",r),e.write(r)}(e,i);break;case"var":e.write(r.from([n.properties[t]])),v(e,i);break;case"string":e.write(r.from([n.properties[t]])),w(e,i);break;case"pair":Object.getOwnPropertyNames(i).forEach(o=>{const s=i[o];Array.isArray(s)?s.forEach(i=>{e.write(r.from([n.properties[t]])),_(e,o.toString(),i.toString())}):(e.write(r.from([n.properties[t]])),_(e,o.toString(),s.toString()))});break;default:return e.emit("error",new Error(`Invalid property ${t} value: ${i}`)),!1}}function A(e,t,r){v(e,r);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&null!==t[r]){const n=t[r];if(Array.isArray(n))for(let t=0;t<n.length;t++)x(e,r,n[t]);else x(e,r,n)}}function I(e){return e?e instanceof r?e.length:r.byteLength(e):0}function P(e){return"string"==typeof e||e instanceof r}t.exports=y}).call(this)}).call(this,e("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(e,t,r){var n=1e3,i=60*n,o=60*i,s=24*o,a=7*s,l=365.25*s;function u(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*l;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*o;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=s)return u(e,t,s,"day");if(t>=o)return u(e,t,o,"hour");if(t>=i)return u(e,t,i,"minute");if(t>=n)return u(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=s)return Math.round(e/s)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],46:[function(e,t,r){const n=e("./lib/number-allocator.js");t.exports.NumberAllocator=n},{"./lib/number-allocator.js":47}],47:[function(e,t,r){"use strict";const n=e("js-sdsl").Set,i=e("debug")("number-allocator:trace"),o=e("debug")("number-allocator:error");function s(e,t){this.low=e,this.high=t}function a(e,t){if(!(this instanceof a))return new a(e,t);this.min=e,this.max=t,this.ss=new n([],(e,t)=>e.compare(t)),i("Create"),this.clear()}s.prototype.equals=function(e){return this.low===e.low&&this.high===e.high},s.prototype.compare=function(e){return this.low<e.low&&this.high<e.low?-1:e.low<this.low&&e.high<this.low?1:0},a.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},a.prototype.alloc=function(){if(0===this.ss.size())return i("alloc():empty"),null;const e=this.ss.front(),t=e.low;return t+1<=e.high?++e.low:this.ss.eraseElementByPos(0),i("alloc():"+t),t},a.prototype.use=function(e){const t=new s(e,e),r=this.ss.lowerBound(t);if(r){if(r.equals(t))return this.ss.eraseElementByValue(r),i("use():"+e),!0;if(r.low>e)return!1;if(r.low===e)return++r.low,i("use():"+e),!0;if(r.high===e)return--r.high,i("use():"+e),!0;const n=r.low;return r.low=e+1,this.ss.insert(new s(n,e-1)),i("use():"+e),!0}return i("use():failed"),!1},a.prototype.free=function(e){if(e<this.min||e>this.max)return void o("free():"+e+" is out of range");const t=new s(e,e),r=this.ss.lowerBound(t);if(r){if(r.low<=e&&e<=r.high)return void o("free():"+e+" has already been vacant");if(r===this.ss.front())e+1===r.low?--r.low:this.ss.insert(t);else{const n=this.ss.reverseLowerBound(t);n.high+1===e?e+1===r.low?(this.ss.eraseElementByValue(n),r.low=n.low):n.high=e:e+1===r.low?r.low=e:this.ss.insert(t)}}else{if(r===this.ss.front())return void this.ss.insert(t);const n=this.ss.reverseLowerBound(t);n.high+1===e?n.high=e:this.ss.insert(t)}i("free():"+e)},a.prototype.clear=function(){i("clear()"),this.ss.clear(),this.ss.insert(new s(this.min,this.max))},a.prototype.intervalCount=function(){return this.ss.size()},a.prototype.dump=function(){console.log("length:"+this.ss.size());for(const e of this.ss)console.log(e)},t.exports=a},{debug:18,"js-sdsl":36}],48:[function(e,t,r){var n=e("wrappy");function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}t.exports=n(i),t.exports.strict=n(o),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},{wrappy:79}],49:[function(e,t,r){(function(e){(function(){"use strict";void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,r)});case 3:return e.nextTick(function(){t.call(null,r,n)});case 4:return e.nextTick(function(){t.call(null,r,n,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick(function(){t.apply(null,o)})}}}:t.exports=e}).call(this)}).call(this,e("_process"))},{_process:50}],50:[function(e,t,r){var n,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,c=[],h=!1,f=-1;function p(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!h){var e=l(p);h=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,h=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function g(e,t){this.fun=e,this.array=t}function y(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new g(e,t)),1!==c.length||h||l(d)},g.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],51:[function(e,t,r){(function(e){(function(){!function(n){var i="object"==typeof r&&r&&!r.nodeType&&r,o="object"==typeof t&&t&&!t.nodeType&&t,s="object"==typeof e&&e;s.global!==s&&s.window!==s&&s.self!==s||(n=s);var a,l,u=2147483647,c=36,h=1,f=26,p=38,d=700,g=72,y=128,b="-",m=/^xn--/,v=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=c-h,S=Math.floor,E=String.fromCharCode;function C(e){throw new RangeError(_[e])}function T(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function x(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+T((e=e.replace(w,".")).split("."),t).join(".")}function A(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function I(e){return T(e,function(e){var t="";return e>65535&&(t+=E((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=E(e)}).join("")}function P(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function O(e,t,r){var n=0;for(e=r?S(e/d):e>>1,e+=S(e/t);e>k*f>>1;n+=c)e=S(e/k);return S(n+(k+1)*e/(e+p))}function B(e){var t,r,n,i,o,s,a,l,p,d,m,v=[],w=e.length,_=0,k=y,E=g;for((r=e.lastIndexOf(b))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&C("not-basic"),v.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<w;){for(o=_,s=1,a=c;i>=w&&C("invalid-input"),((l=(m=e.charCodeAt(i++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:c)>=c||l>S((u-_)/s))&&C("overflow"),_+=l*s,!(l<(p=a<=E?h:a>=E+f?f:a-E));a+=c)s>S(u/(d=c-p))&&C("overflow"),s*=d;E=O(_-o,t=v.length+1,0==o),S(_/t)>u-k&&C("overflow"),k+=S(_/t),_%=t,v.splice(_++,0,k)}return I(v)}function R(e){var t,r,n,i,o,s,a,l,p,d,m,v,w,_,k,T=[];for(v=(e=A(e)).length,t=y,r=0,o=g,s=0;s<v;++s)(m=e[s])<128&&T.push(E(m));for(n=i=T.length,i&&T.push(b);n<v;){for(a=u,s=0;s<v;++s)(m=e[s])>=t&&m<a&&(a=m);for(a-t>S((u-r)/(w=n+1))&&C("overflow"),r+=(a-t)*w,t=a,s=0;s<v;++s)if((m=e[s])<t&&++r>u&&C("overflow"),m==t){for(l=r,p=c;!(l<(d=p<=o?h:p>=o+f?f:p-o));p+=c)k=l-d,_=c-d,T.push(E(P(d+k%_,0))),l=S(k/_);T.push(E(P(l,0))),o=O(r,w,n==i),r=0,++n}++r,++t}return T.join("")}if(a={version:"1.4.1",ucs2:{decode:A,encode:I},decode:B,encode:R,toASCII:function(e){return x(e,function(e){return v.test(e)?"xn--"+R(e):e})},toUnicode:function(e){return x(e,function(e){return m.test(e)?B(e.slice(4).toLowerCase()):e})}},i&&o)if(t.exports==i)o.exports=a;else for(l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);else n.punycode=a}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],52:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c<u;++c){var h,f,p,d,g=e[c].replace(a,"%20"),y=g.indexOf(r);y>=0?(h=g.substr(0,y),f=g.substr(y+1)):(h=g,f=""),p=decodeURIComponent(h),d=decodeURIComponent(f),n(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],53:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(n(e))}).join(t):a+encodeURIComponent(n(e[s]))}).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var s=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},{}],54:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode"),r.encode=r.stringify=e("./encode")},{"./decode":52,"./encode":53}],55:[function(e,t,r){"use strict";var n={};function i(e,t,r){r||(r=Error);var i=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=e,n[e]=i}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(e){return String(e)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,r){var n,i,s,a;if("string"==typeof t&&(i="not ",t.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var l=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(l," ").concat(n," ").concat(o(t,"type"))}return a+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],56:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=u;var i=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(u,i);for(var s=n(o.prototype),a=0;a<s.length;a++){var l=s[a];u.prototype[l]||(u.prototype[l]=o.prototype[l])}function u(e){if(!(this instanceof u))return new u(e);i.call(this,e),o.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||r.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this)}).call(this,e("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(e,t,r){"use strict";t.exports=i;var n=e("./_stream_transform");function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}e("inherits")(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":59,inherits:24}],58:[function(e,t,r){(function(r,n){(function(){"use strict";var i;t.exports=C,C.ReadableState=E;e("events").EventEmitter;var o=function(e,t){return e.listeners(t).length},s=e("./internal/streams/stream"),a=e("buffer").Buffer,l=n.Uint8Array||function(){};var u,c=e("util");u=c&&c.debuglog?c.debuglog("stream"):function(){};var h,f,p,d=e("./internal/streams/buffer_list"),g=e("./internal/streams/destroy"),y=e("./internal/streams/state").getHighWaterMark,b=e("../errors").codes,m=b.ERR_INVALID_ARG_TYPE,v=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,_=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(C,s);var k=g.errorOrDestroy,S=["error","close","destroy","pause","resume"];function E(t,r,n){i=i||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=y(this,t,"readableHighWaterMark",n),this.buffer=new d,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=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=e("string_decoder/").StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function C(t){if(i=i||e("./_stream_duplex"),!(this instanceof C))return new C(t);var r=this instanceof i;this._readableState=new E(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function T(e,t,r,n,i){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?P(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,O(e)))}(e,s);else if(i||(o=function(e,t){var r;n=t,a.isBuffer(n)||n instanceof l||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(s,t)),o)k(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),n)s.endEmitted?k(e,new _):x(e,s,t,!0);else if(s.ended)k(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?x(e,s,t,!1):B(e,s)):x(e,s,t,!1)}else n||(s.reading=!1,B(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&P(e)),B(e,t)}Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),C.prototype.destroy=g.destroy,C.prototype._undestroy=g.undestroy,C.prototype._destroy=function(e,t){t(e)},C.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=a.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},C.prototype.unshift=function(e){return T(this,e,null,!0,!1)},C.prototype.isPaused=function(){return!1===this._readableState.flowing},C.prototype.setEncoding=function(t){h||(h=e("string_decoder/").StringDecoder);var r=new h(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var A=1073741824;function I(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=A?e=A:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function P(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(O,e))}function O(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,j(e)}function B(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(u("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function M(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function N(e){u("readable nexttick read 0"),e.read(0)}function L(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),j(e),t.flowing&&!t.reading&&e.read(0)}function j(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function U(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function q(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(D,t,e))}function D(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function z(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}C.prototype.read=function(e){u("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?q(this):P(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&q(this),null;var n,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",i=!0),t.ended||t.reading?u("reading or ended",i=!1):i&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=I(r,t))),null===(n=e>0?U(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&q(this)),null!==n&&this.emit("data",n),n},C.prototype._read=function(e){k(this,new w("_read()"))},C.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:y;function a(t,r){u("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),e.removeListener("close",d),e.removeListener("finish",g),e.removeListener("drain",c),e.removeListener("error",p),e.removeListener("unpipe",a),n.removeListener("end",l),n.removeListener("end",y),n.removeListener("data",f),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function l(){u("onend"),e.end()}i.endEmitted?r.nextTick(s):n.once("end",s),e.on("unpipe",a);var c=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,j(e))}}(n);e.on("drain",c);var h=!1;function f(t){u("ondata");var r=e.write(t);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==z(i.pipes,e))&&!h&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function p(t){u("onerror",t),y(),e.removeListener("error",p),0===o(e,"error")&&k(e,t)}function d(){e.removeListener("finish",g),y()}function g(){u("onfinish"),e.removeListener("close",d),y()}function y(){u("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",p),e.once("close",d),e.once("finish",g),e.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),e},C.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=z(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)},C.prototype.on=function(e,t){var n=s.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?P(this):i.reading||r.nextTick(N,this))),n},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(e,t){var n=s.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(M,this),n},C.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(M,this),t},C.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(L,e,t))}(this,e)),e.paused=!1,this},C.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),!r.objectMode||null!==i&&void 0!==i)&&((r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause())))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<S.length;o++)e.on(S[o],this.emit.bind(this,S[o]));return this._read=function(t){u("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(C.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=e("./internal/streams/async_iterator")),f(this)}),Object.defineProperty(C.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(C.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(C.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),C._fromList=U,Object.defineProperty(C.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(C.from=function(t,r){return void 0===p&&(p=e("./internal/streams/from")),p(C,t,r)})}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?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(e,t,r){"use strict";t.exports=u;var n=e("../errors").codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,l=e("./_stream_duplex");function u(e){if(!(this instanceof u))return new u(e);l.call(this,e),this._transformState={afterTransform:function(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",c)}function c(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush(function(t,r){h(e,t,r)})}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new s;return e.push(null)}e("inherits")(u,l),u.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},u.prototype._transform=function(e,t,r){r(new i("_transform()"))},u.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},u.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},u.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(e,t,r){(function(r,n){(function(){"use strict";function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var o;t.exports=C,C.WritableState=E;var s={deprecate:e("util-deprecate")},a=e("./internal/streams/stream"),l=e("buffer").Buffer,u=n.Uint8Array||function(){};var c,h=e("./internal/streams/destroy"),f=e("./internal/streams/state").getHighWaterMark,p=e("../errors").codes,d=p.ERR_INVALID_ARG_TYPE,g=p.ERR_METHOD_NOT_IMPLEMENTED,y=p.ERR_MULTIPLE_CALLBACK,b=p.ERR_STREAM_CANNOT_PIPE,m=p.ERR_STREAM_DESTROYED,v=p.ERR_STREAM_NULL_VALUES,w=p.ERR_STREAM_WRITE_AFTER_END,_=p.ERR_UNKNOWN_ENCODING,k=h.errorOrDestroy;function S(){}function E(t,n,s){o=o||e("./_stream_duplex"),t=t||{},"boolean"!=typeof s&&(s=n instanceof o),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new y;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,i,o){--t.pendingcb,n?(r.nextTick(o,i),r.nextTick(O,e,t),e._writableState.errorEmitted=!0,k(e,i)):(o(i),e._writableState.errorEmitted=!0,k(e,i),O(e,t))}(e,n,i,t,o);else{var s=I(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||A(e,n),i?r.nextTick(x,e,n,s,o):x(e,n,s,o)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function C(t){var r=this instanceof(o=o||e("./_stream_duplex"));if(!r&&!c.call(C,this))return new C(t);this._writableState=new E(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function T(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function x(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),O(e,t)}function A(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,o=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,l=!0;r;)o[a]=r,r.isBuf||(l=!1),r=r.next,a+=1;o.allBuffers=l,T(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,c=r.encoding,h=r.callback;if(T(e,t,!1,t.objectMode?1:u.length,u,c,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function P(e,t){e._final(function(r){t.pendingcb--,r&&k(e,r),t.prefinished=!0,e.emit("prefinish"),O(e,t)})}function O(e,t){var n=I(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,r.nextTick(P,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return n}e("inherits")(C,a),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(C,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===C&&(e&&e._writableState instanceof E)}})):c=function(e){return e instanceof this},C.prototype.pipe=function(){k(this,new b)},C.prototype.write=function(e,t,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,l.isBuffer(i)||i instanceof u);return a&&!l.isBuffer(e)&&(e=function(e){return l.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=S),o.ending?function(e,t){var n=new w;k(e,n),r.nextTick(t,n)}(this,n):(a||function(e,t,n,i){var o;return null===n?o=new v:"string"==typeof n||t.objectMode||(o=new d("chunk",["string","Buffer"],n)),!o||(k(e,o),r.nextTick(i,o),!1)}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,a,n,i,o);return u}(this,o,a,e,t,n)),s},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||A(this,e))},C.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(e,t,r){r(new g("_write()"))},C.prototype._writev=null,C.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,O(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),C.prototype.destroy=h.destroy,C.prototype._undestroy=h.undestroy,C.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?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(e,t,r){(function(r){(function(){"use strict";var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("./end-of-stream"),s=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),u=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function p(e,t){return{value:e,done:t}}function d(e){var t=e[s];if(null!==t){var r=e[f].read();null!==r&&(e[c]=null,e[s]=null,e[a]=null,t(p(r,!1)))}}var g=Object.getPrototypeOf(function(){}),y=Object.setPrototypeOf((i(n={get stream(){return this[f]},next:function(){var e=this,t=this[l];if(null!==t)return Promise.reject(t);if(this[u])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise(function(t,n){r.nextTick(function(){e[l]?n(e[l]):t(p(void 0,!0))})});var n,i=this[c];if(i)n=new Promise(function(e,t){return function(r,n){e.then(function(){t[u]?r(p(void 0,!0)):t[h](r,n)},n)}}(i,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[h])}return this[c]=n,n}},Symbol.asyncIterator,function(){return this}),i(n,"return",function(){var e=this;return new Promise(function(t,r){e[f].destroy(null,function(e){e?r(e):t(p(void 0,!0))})})}),n),g);t.exports=function(e){var t,n=Object.create(y,(i(t={},f,{value:e,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,l,{value:null,writable:!0}),i(t,u,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var r=n[f].read();r?(n[c]=null,n[s]=null,n[a]=null,e(p(r,!1))):(n[s]=e,n[a]=t)},writable:!0}),t));return n[c]=null,o(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[a];return null!==t&&(n[c]=null,n[s]=null,n[a]=null,t(e)),void(n[l]=e)}var r=n[s];null!==r&&(n[c]=null,n[s]=null,n[a]=null,r(p(void 0,!0))),n[u]=!0}),e.on("readable",function(e){r.nextTick(d,e)}.bind(null,n)),n}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":64,_process:50}],62:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=e("buffer").Buffer,a=e("util").inspect,l=a&&a.custom||"inspect";t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,u;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t,r,n,i=s.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,s.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:l,value:function(e,t){return a(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,{depth:0,customInspect:!1}))}}])&&o(t.prototype,r),u&&o(t,u),e}()},{buffer:17,util:16}],63:[function(e,t,r){(function(e){(function(){"use strict";function r(e,t){i(e,t),n(e)}function n(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function i(e,t){e.emit("error",t)}t.exports={destroy:function(t,o){var s=this,a=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return a||l?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!o&&t?s._writableState?s._writableState.errorEmitted?e.nextTick(n,s):(s._writableState.errorEmitted=!0,e.nextTick(r,s,t)):e.nextTick(r,s,t):o?(e.nextTick(n,s),o(t)):e.nextTick(n,s)}),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(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this)}).call(this,e("_process"))},{_process:50}],64:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,l=function(){t.writable||c()},u=t._writableState&&t._writableState.finished,c=function(){a=!1,u=!0,s||o.call(t)},h=t._readableState&&t._readableState.endEmitted,f=function(){s=!1,h=!0,a||o.call(t)},p=function(e){o.call(t,e)},d=function(){var e;return s&&!h?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):a&&!u?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},g=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",d),t.req?g():t.on("request",g)):a&&!t._writableState&&(t.on("end",l),t.on("close",l)),t.on("end",f),t.on("finish",c),!1!==r.error&&t.on("error",p),t.on("close",d),function(){t.removeListener("complete",c),t.removeListener("abort",d),t.removeListener("request",g),t.req&&t.req.removeListener("finish",c),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",c),t.removeListener("end",f),t.removeListener("error",p),t.removeListener("close",d)}}},{"../../../errors":55}],65:[function(e,t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(e,t,r){"use strict";var n;var i=e("../../../errors").codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function l(e){e()}function u(e,t){return e.pipe(t)}t.exports=function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var c,h=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(r);if(Array.isArray(r[0])&&(r=r[0]),r.length<2)throw new o("streams");var f=r.map(function(t,i){var o=i<r.length-1;return function(t,r,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var a=!1;t.on("close",function(){a=!0}),void 0===n&&(n=e("./end-of-stream")),n(t,{readable:r,writable:i},function(e){if(e)return o(e);a=!0,o()});var l=!1;return function(e){if(!a&&!l)return l=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}(t,o,i>0,function(e){c||(c=e),e&&f.forEach(l),o||(f.forEach(l),h(c))})});return r.reduce(u)}},{"../../../errors":55,"./end-of-stream":64}],67:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},{"../../../errors":55}],68:[function(e,t,r){t.exports=e("events").EventEmitter},{events:22}],69:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./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(e,t,r){"use strict";t.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new function(e,t,r){var n=this;this._callback=e,this._args=r,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,e,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}(arguments[0],arguments[1],e)}},{}],71:[function(e,t,r){"use strict";t.exports=e("./index.js")()},{"./index.js":72}],72:[function(e,t,r){(function(e){(function(){"use strict";function r(t){return t instanceof e?e.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}t.exports=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return i(o,e);if(o instanceof Map)return new Map(i(Array.from(o),e));if(o instanceof Set)return new Set(i(Array.from(o),e));var s={};for(var a in t.push(o),n.push(s),o){var l=o[a];if("object"!=typeof l||null===l)s[a]=l;else if(l instanceof Date)s[a]=new Date(l);else if(l instanceof Map)s[a]=new Map(i(Array.from(l),e));else if(l instanceof Set)s[a]=new Set(i(Array.from(l),e));else if(ArrayBuffer.isView(l))s[a]=r(l);else{var u=t.indexOf(l);s[a]=-1!==u?n[u]:e(l)}}return t.pop(),n.pop(),s}:function e(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return i(o,e);if(o instanceof Map)return new Map(i(Array.from(o),e));if(o instanceof Set)return new Set(i(Array.from(o),e));var s={};for(var a in t.push(o),n.push(s),o)if(!1!==Object.hasOwnProperty.call(o,a)){var l=o[a];if("object"!=typeof l||null===l)s[a]=l;else if(l instanceof Date)s[a]=new Date(l);else if(l instanceof Map)s[a]=new Map(i(Array.from(l),e));else if(l instanceof Set)s[a]=new Set(i(Array.from(l),e));else if(ArrayBuffer.isView(l))s[a]=r(l);else{var u=t.indexOf(l);s[a]=-1!==u?n[u]:e(l)}}return t.pop(),n.pop(),s};function i(e,i){for(var o=Object.keys(e),s=new Array(o.length),a=0;a<o.length;a++){var l=o[a],u=e[l];if("object"!=typeof u||null===u)s[l]=u;else if(u instanceof Date)s[l]=new Date(u);else if(ArrayBuffer.isView(u))s[l]=r(u);else{var c=t.indexOf(u);s[l]=-1!==c?n[c]:i(u)}}return s}}(e):e.proto?function e(n){if("object"!=typeof n||null===n)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return t(n,e);if(n instanceof Map)return new Map(t(Array.from(n),e));if(n instanceof Set)return new Set(t(Array.from(n),e));var i={};for(var o in n){var s=n[o];"object"!=typeof s||null===s?i[o]=s:s instanceof Date?i[o]=new Date(s):s instanceof Map?i[o]=new Map(t(Array.from(s),e)):s instanceof Set?i[o]=new Set(t(Array.from(s),e)):ArrayBuffer.isView(s)?i[o]=r(s):i[o]=e(s)}return i}:function e(n){if("object"!=typeof n||null===n)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return t(n,e);if(n instanceof Map)return new Map(t(Array.from(n),e));if(n instanceof Set)return new Set(t(Array.from(n),e));var i={};for(var o in n)if(!1!==Object.hasOwnProperty.call(n,o)){var s=n[o];"object"!=typeof s||null===s?i[o]=s:s instanceof Date?i[o]=new Date(s):s instanceof Map?i[o]=new Map(t(Array.from(s),e)):s instanceof Set?i[o]=new Set(t(Array.from(s),e)):ArrayBuffer.isView(s)?i[o]=r(s):i[o]=e(s)}return i};function t(e,t){for(var n=Object.keys(e),i=new Array(n.length),o=0;o<n.length;o++){var s=n[o],a=e[s];"object"!=typeof a||null===a?i[s]=a:a instanceof Date?i[s]=new Date(a):ArrayBuffer.isView(a)?i[s]=r(a):i[s]=t(a)}return i}}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],73:[function(e,t,r){var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:17}],74:[function(e,t,r){t.exports=function(e){var t=e._readableState;return t?t.objectMode||"number"==typeof e._duplexState?e.read():e.read((r=t,r.buffer.length?r.buffer.head?r.buffer.head.data.length:r.buffer[0].length:r.length)):null;var r}},{}],75:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=h,t=3;break;default:return this.write=f,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}r.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=s(t[n]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=s(t[n]))>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":73}],76:[function(e,t,r){"use strict";var n=e("punycode"),i=e("./util");function o(){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}r.parse=v,r.resolve=function(e,t){return v(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?v(e,!1,!0).resolveObject(t):t},r.format=function(e){i.isString(e)&&(e=v(e));return e instanceof o?e.format():o.prototype.format.call(e)},r.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),h=["%","/","?",";","#"].concat(c),f=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=e("querystring");function v(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",u=e.split(a);u[0]=u[0].replace(/\\/g,"/");var v=e=u.join(a);if(v=v.trim(),!r&&1===e.split("#").length){var w=l.exec(v);if(w)return this.path=v,this.href=v,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?m.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var _=s.exec(v);if(_){var k=(_=_[0]).toLowerCase();this.protocol=k,v=v.substr(_.length)}if(r||_||v.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===v.substr(0,2);!S||_&&y[_]||(v=v.substr(2),this.slashes=!0)}if(!y[_]&&(S||_&&!b[_])){for(var E,C,T=-1,x=0;x<f.length;x++){-1!==(A=v.indexOf(f[x]))&&(-1===T||A<T)&&(T=A)}-1!==(C=-1===T?v.lastIndexOf("@"):v.lastIndexOf("@",T))&&(E=v.slice(0,C),v=v.slice(C+1),this.auth=decodeURIComponent(E)),T=-1;for(x=0;x<h.length;x++){var A;-1!==(A=v.indexOf(h[x]))&&(-1===T||A<T)&&(T=A)}-1===T&&(T=v.length),this.host=v.slice(0,T),v=v.slice(T),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var P=this.hostname.split(/\./),O=(x=0,P.length);x<O;x++){var B=P[x];if(B&&!B.match(p)){for(var R="",M=0,N=B.length;M<N;M++)B.charCodeAt(M)>127?R+="x":R+=B[M];if(!R.match(p)){var L=P.slice(0,x),j=P.slice(x+1),U=B.match(d);U&&(L.push(U[1]),j.unshift(U[2])),j.length&&(v="/"+j.join(".")+v),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=n.toASCII(this.hostname));var q=this.port?":"+this.port:"",D=this.hostname||"";this.host=D+q,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!g[k])for(x=0,O=c.length;x<O;x++){var z=c[x];if(-1!==v.indexOf(z)){var F=encodeURIComponent(z);F===z&&(F=escape(z)),v=v.split(z).join(F)}}var V=v.indexOf("#");-1!==V&&(this.hash=v.substr(V),v=v.slice(0,V));var H=v.indexOf("?");if(-1!==H?(this.search=v.substr(H),this.query=v.substr(H+1),t&&(this.query=m.parse(this.query)),v=v.slice(0,H)):t&&(this.search="",this.query={}),v&&(this.pathname=v),b[k]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){q=this.pathname||"";var W=this.search||"";this.path=q+W}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=m.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||b[t])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}))+(a=a.replace("#","%23"))+n},o.prototype.resolve=function(e){return this.resolveObject(v(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var r=new o,n=Object.keys(this),s=0;s<n.length;s++){var a=n[s];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var l=Object.keys(e),u=0;u<l.length;u++){var c=l[u];"protocol"!==c&&(r[c]=e[c])}return b[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!b[e.protocol]){for(var h=Object.keys(e),f=0;f<h.length;f++){var p=h[f];r[p]=e[p]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||y[e.protocol])r.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var g=r.pathname||"",m=r.search||"";r.path=g+m}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),_=w||v||r.host&&e.pathname,k=_,S=r.pathname&&r.pathname.split("/")||[],E=(d=e.pathname&&e.pathname.split("/")||[],r.protocol&&!b[r.protocol]);if(E&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),_=_&&(""===d[0]||""===S[0])),w)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,S=d;else if(d.length)S||(S=[]),S.pop(),S=S.concat(d),r.search=e.search,r.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(E)r.hostname=r.host=S.shift(),(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var C=S.slice(-1)[0],T=(r.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,x=0,A=S.length;A>=0;A--)"."===(C=S[A])?S.splice(A,1):".."===C?(S.splice(A,1),x++):x&&(S.splice(A,1),x--);if(!_&&!k)for(;x--;x)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),T&&"/"!==S.join("/").substr(-1)&&S.push("");var I,P=""===S[0]||S[0]&&"/"===S[0].charAt(0);E&&(r.hostname=r.host=P?"":S.length?S.shift():"",(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift()));return(_=_||r.host&&S.length)&&!P&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.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(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],78:[function(e,t,r){(function(e){(function(){function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],79:[function(e,t,r){t.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");Object.keys(t).forEach(function(e){n[e]=t[e]});return n;function n(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var n=t.apply(this,e),i=e[e.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach(function(e){n[e]=i[e]}),n}}},{}],80:[function(e,t,r){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(e,t,r){t.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var i in r)n.call(r,i)&&(e[i]=r[i])}return e};var n=Object.prototype.hasOwnProperty},{}],82:[function(e,t,r){"use strict";t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},{}],83:[function(e,t,r){"use strict";function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}function i(e,t,r){var n=t===e.head?new a(r,null,t,e):new a(r,t,t.next,e);return null===n.next&&(e.tail=n),null===n.prev&&(e.head=n),e.length++,n}function o(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function s(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,r,n){if(!(this instanceof a))return new a(e,t,r,n);this.list=n,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}t.exports=n,n.Node=a,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},n.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}},n.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}},n.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;null!==r;n++)e.call(t,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;null!==r;n--)e.call(t,r.value,n,this),r=r.prev},n.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},n.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},n.prototype.map=function(e,t){t=t||this;for(var r=new n,i=this.head;null!==i;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,i=this.tail;null!==i;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=e(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=e(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&i<e;i++)o=o.next;for(;null!==o&&i<t;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,o=this.head;null!==o&&n<e;n++)o=o.next;var s=[];for(n=0;o&&n<t;n++)s.push(o.value),o=this.removeNode(o);null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(n=0;n<r.length;n++)o=i(this,o,r[n]);return s},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=t,this.tail=e,this};try{e("./iterator.js")(n)}catch(e){}},{"./iterator.js":82}]},{},[12])(12)});
|