text: /**
   * SocketCluster JavaScript client v14.2.2
   */
  !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).socketCluster=t()}}(function(){return function i(s,a,c){function u(e,t){if(!a[e]){if(!s[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(h)return h(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var o=a[e]={exports:{}};s[e][0].call(o.exports,function(t){return u(s[e][1][t]||t)},o,o.exports,i,s,a,c)}return a[e].exports}for(var h="function"==typeof require&&require,t=0;t<c.length;t++)u(c[t]);return u}({1:[function(t,e){var r=t("./lib/scclientsocket"),n=t("./lib/factory");e.exports.factory=n,e.exports.SCClientSocket=r,e.exports.Emitter=t("component-emitter"),e.exports.create=function(t){return n.create(t)},e.exports.connect=e.exports.create,e.exports.destroy=function(t){return n.destroy(t)},e.exports.clients=n.clients,e.exports.version="14.2.2"},{"./lib/factory":3,"./lib/scclientsocket":5,"component-emitter":11}],2:[function(t,e){(function(o){var t=function(){this._internalStorage={},this.isLocalStorageEnabled=this._checkLocalStorageEnabled()};t.prototype._checkLocalStorageEnabled=function(){var e;try{o.localStorage,o.localStorage.setItem("__scLocalStorageTest",1),o.localStorage.removeItem("__scLocalStorageTest")}catch(t){e=t}return!e},t.prototype.saveToken=function(t,e,r,n){this.isLocalStorageEnabled&&o.localStorage?o.localStorage.setItem(t,e):this._internalStorage[t]=e,n&&n(null,e)},t.prototype.removeToken=function(t,e){var r;this.loadToken(t,function(t,e){r=e}),this.isLocalStorageEnabled&&o.localStorage?o.localStorage.removeItem(t):delete this._internalStorage[t],e&&e(null,r)},t.prototype.loadToken=function(t,e){e(null,this.isLocalStorageEnabled&&o.localStorage?o.localStorage.getItem(t):this._internalStorage[t]||null)},e.exports.AuthEngine=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,r){(function(c){var u=e("./scclientsocket"),t=e("sc-errors"),h=e("uuid"),p=t.InvalidArgumentsError,l={};r.exports={create:function(t){if((t=t||{}).host&&!t.host.match(/[^:]+:\d{2,5}/))throw new p('The host option should include both the hostname and the port number in the format "hostname:port"');if(t.host&&t.hostname)throw new p('The host option should already include the hostname and the port number in the format "hostname:port" - Because of this, you should never use host and hostname options together');if(t.host&&t.port)throw new p('The host option should already include the hostname and the port number in the format "hostname:port" - Because of this, you should never use host and port options together');var e,r,n,o=c.location&&"https:"===location.protocol,i={port:(e=t,r=o,n=null==e.secure?r:e.secure,e.port||(c.location&&location.port?location.port:n?443:80)),hostname:c.location&&location.hostname||"localhost",path:"/socketcluster/",secure:o,autoConnect:!0,autoReconnect:!0,autoSubscribeOnConnect:!0,connectTimeout:2e4,ackTimeout:1e4,timestampRequests:!1,timestampParam:"t",authEngine:null,authTokenName:"socketCluster.authToken",binaryType:"arraybuffer",multiplex:!0,pubSubBatchDuration:null,cloneData:!1};for(var s in t)t.hasOwnProperty(s)&&(i[s]=t[s]);if(i.clientMap=l,!1!==i.multiplex)return i.clientId=function(t){var e=t.secure?"https://":"http://",r="";if(t.query)if("string"==typeof t.query)r=t.query;else{var n=[],o=t.query;for(var i in o)o.hasOwnProperty(i)&&n.push(i+"="+o[i]);n.length&&(r="?"+n.join("&"))}return e+(t.host?t.host:t.hostname+":"+t.port)+t.path+r}(i),l[i.clientId]?i.autoConnect&&l[i.clientId].connect():l[i.clientId]=new u(i),l[i.clientId];i.clientId=h.v4();var a=new u(i);return l[i.clientId]=a},destroy:function(t){t.destroy()},clients:l}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./scclientsocket":5,"sc-errors":20,uuid:22}],4:[function(t,e){var o=t("sc-errors"),r=o.InvalidActionError,n=function(t,e){this.socket=t,this.id=e,this.sent=!1};n.prototype._respond=function(t){if(this.sent)throw new r("Response "+this.id+" has already been sent");this.sent=!0,this.socket.send(this.socket.encode(t))},n.prototype.end=function(t){if(this.id){var e={rid:this.id};void 0!==t&&(e.data=t),this._respond(e)}},n.prototype.error=function(t,e){if(this.id){var r=o.dehydrateError(t),n={rid:this.id,error:r};void 0!==e&&(n.data=e),this._respond(n)}},n.prototype.callback=function(t,e){t?this.error(t,e):this.end(e)},e.exports.Response=n},{"sc-errors":20}],5:[function(v,E){(function(s){var a=v("component-emitter"),n=v("sc-channel").SCChannel;v("./response").Response;var c=v("./auth").AuthEngine,u=v("sc-formatter"),e=v("./sctransport").SCTransport,h=v("querystring"),p=v("linked-list"),r=v("buffer/").Buffer,l=v("clone"),i=v("sc-errors"),f=i.InvalidArgumentsError,t=i.InvalidMessageError,o=i.InvalidActionError,d=i.SocketProtocolError,y=i.TimeoutError,m=i.BadConnectionError,g="undefined"!=typeof window,b=function(t){var e=this;a.call(this),this.id=null,this.state=this.CLOSED,this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null,this.pendingReconnect=!1,this.pendingReconnectTimeout=null,this.preparingPendingSubscriptions=!1,this.clientId=t.clientId,this.connectTimeout=t.connectTimeout,this.ackTimeout=t.ackTimeout,this.channelPrefix=t.channelPrefix||null,this.disconnectOnUnload=null==t.disconnectOnUnload||t.disconnectOnUnload,this.authTokenName=t.authTokenName,this.pingTimeout=this.ackTimeout,this.pingTimeoutDisabled=!!t.pingTimeoutDisabled,this.active=!0,this._clientMap=t.clientMap||{};var r=Math.pow(2,31)-1,n=function(t){if(e[t]>r)throw new f("The "+t+" value provided exceeded the maximum amount allowed")};if(n("connectTimeout"),n("ackTimeout"),this._localEvents={connect:1,connectAbort:1,close:1,disconnect:1,message:1,error:1,raw:1,kickOut:1,subscribe:1,unsubscribe:1,subscribeStateChange:1,authStateChange:1,authenticate:1,deauthenticate:1,removeAuthToken:1,subscribeRequest:1},this.connectAttempts=0,this._emitBuffer=new p,this.channels={},this.options=t,this._cid=1,this.options.callIdGenerator=function(){return e._cid++},this.options.autoReconnect){null==this.options.autoReconnectOptions&&(this.options.autoReconnectOptions={});var o=this.options.autoReconnectOptions;null==o.initialDelay&&(o.initialDelay=1e4),null==o.randomness&&(o.randomness=1e4),null==o.multiplier&&(o.multiplier=1.5),null==o.maxDelay&&(o.maxDelay=6e4)}if(null==this.options.subscriptionRetryOptions&&(this.options.subscriptionRetryOptions={}),this.options.authEngine?this.auth=this.options.authEngine:this.auth=new c,this.options.codecEngine?this.codec=this.options.codecEngine:this.codec=u,this.options.protocol){var i=new f('The "protocol" option does not affect socketcluster-client. If you want to utilize SSL/TLS - use "secure" option instead');this._onSCError(i)}this.options.path=this.options.path.replace(/\/$/,"")+"/",this.options.query=t.query||{},"string"==typeof this.options.query&&(this.options.query=h.parse(this.options.query)),this._channelEmitter=new a,this._unloadHandler=function(){e.disconnect()},g&&this.disconnectOnUnload&&s.addEventListener&&s.addEventListener("beforeunload",this._unloadHandler,!1),(this._clientMap[this.clientId]=this).options.autoConnect&&this.connect()};b.prototype=Object.create(a.prototype),b.CONNECTING=b.prototype.CONNECTING=e.prototype.CONNECTING,b.OPEN=b.prototype.OPEN=e.prototype.OPEN,b.CLOSED=b.prototype.CLOSED=e.prototype.CLOSED,b.AUTHENTICATED=b.prototype.AUTHENTICATED="authenticated",b.UNAUTHENTICATED=b.prototype.UNAUTHENTICATED="unauthenticated",b.PENDING=b.prototype.PENDING="pending",b.ignoreStatuses=i.socketProtocolIgnoreStatuses,b.errorStatuses=i.socketProtocolErrorStatuses,b.prototype._privateEventHandlerMap={"#publish":function(t){var e=this._undecorateChannelName(t.channel);this.isSubscribed(e,!0)&&this._channelEmitter.emit(e,t.data)},"#kickOut":function(t){var e=this._undecorateChannelName(t.channel),r=this.channels[e];r&&(a.prototype.emit.call(this,"kickOut",t.message,e),r.emit("kickOut",t.message,e),this._triggerChannelUnsubscribe(r))},"#setAuthToken":function(e,r){var n=this;if(e){this.auth.saveToken(this.authTokenName,e.token,{},function(t){t?(r.error(t),n._onSCError(t)):(n._changeToAuthenticatedState(e.token),r.end())})}else r.error(new t("No token data provided by #setAuthToken event"))},"#removeAuthToken":function(t,r){var n=this;this.auth.removeToken(this.authTokenName,function(t,e){t?(r.error(t),n._onSCError(t)):(a.prototype.emit.call(n,"removeAuthToken",e),n._changeToUnauthenticatedStateAndClearTokens(),r.end())})},"#disconnect":function(t){this.transport.close(t.code,t.data)}},b.prototype.getState=function(){return this.state},b.prototype.getBytesReceived=function(){return this.transport.getBytesReceived()},b.prototype.deauthenticate=function(r){var n=this;this.auth.removeToken(this.authTokenName,function(t,e){t?n._onSCError(t):(a.prototype.emit.call(n,"removeAuthToken",e),n.state!==n.CLOSED&&n.emit("#removeAuthToken"),n._changeToUnauthenticatedStateAndClearTokens()),r&&r(t)})},b.prototype.connect=b.prototype.open=function(){var n=this;if(this.active)this.state===this.CLOSED&&(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this.state=this.CONNECTING,a.prototype.emit.call(this,"connecting"),this.transport&&this.transport.off(),this.transport=new e(this.auth,this.codec,this.options),this.transport.on("open",function(t){n.state=n.OPEN,n._onSCOpen(t)}),this.transport.on("error",function(t){n._onSCError(t)}),this.transport.on("close",function(t,e){n.state=n.CLOSED,n._onSCClose(t,e)}),this.transport.on("openAbort",function(t,e){n.state=n.CLOSED,n._onSCClose(t,e,!0)}),this.transport.on("event",function(t,e,r){n._onSCEvent(t,e,r)}));else{var t=new o("Cannot connect a destroyed client");this._onSCError(t)}},b.prototype.reconnect=function(t,e){this.disconnect(t,e),this.connect()},b.prototype.disconnect=function(t,e){if("number"!=typeof(t=t||1e3))throw new f("If specified, the code argument must be a number");this.state===this.OPEN||this.state===this.CONNECTING?this.transport.close(t,e):(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef))},b.prototype.destroy=function(t,e){g&&s.removeEventListener&&s.removeEventListener("beforeunload",this._unloadHandler,!1),this.active=!1,this.disconnect(t,e),delete this._clientMap[this.clientId]},b.prototype._changeToUnauthenticatedStateAndClearTokens=function(){if(this.authState!==this.UNAUTHENTICATED){var t=this.authState,e=this.signedAuthToken;this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null;var r={oldState:t,newState:this.authState};a.prototype.emit.call(this,"authStateChange",r),a.prototype.emit.call(this,"deauthenticate",e)}},b.prototype._changeToAuthenticatedState=function(t){if(this.signedAuthToken=t,this.authToken=this._extractAuthTokenData(t),this.authState!==this.AUTHENTICATED){var e=this.authState;this.authState=this.AUTHENTICATED;var r={oldState:e,newState:this.authState,signedAuthToken:t,authToken:this.authToken};this.preparingPendingSubscriptions||this.processPendingSubscriptions(),a.prototype.emit.call(this,"authStateChange",r)}a.prototype.emit.call(this,"authenticate",t)},b.prototype.decodeBase64=function(t){return r.from(t,"base64").toString("utf8")},b.prototype.encodeBase64=function(t){return r.from(t,"utf8").toString("base64")},b.prototype._extractAuthTokenData=function(t){var e=(t||"").split(".")[1];if(null!=e){var r=e;try{return r=this.decodeBase64(r),JSON.parse(r)}catch(t){return r}}return null},b.prototype.getAuthToken=function(){return this.authToken},b.prototype.getSignedAuthToken=function(){return this.signedAuthToken},b.prototype.authenticate=function(r,n){var o=this;this.emit("#authenticate",r,function(t,e){e&&null!=e.isAuthenticated?e.authError&&(e.authError=i.hydrateError(e.authError)):e={isAuthenticated:o.authState,authError:null},t?("BadConnectionError"!==t.name&&"TimeoutError"!==t.name&&o._changeToUnauthenticatedStateAndClearTokens(),n&&n(t,e)):o.auth.saveToken(o.authTokenName,r,{},function(t){t&&o._onSCError(t),e.isAuthenticated?o._changeToAuthenticatedState(r):o._changeToUnauthenticatedStateAndClearTokens(),n&&n(t,e)})})},b.prototype._tryReconnect=function(t){var e,r=this,n=this.connectAttempts++,o=this.options.autoReconnectOptions;if(null==t||0<n){var i=Math.round(o.initialDelay+(o.randomness||0)*Math.random());e=Math.round(i*Math.pow(o.multiplier,n))}else e=t;e>o.maxDelay&&(e=o.maxDelay),clearTimeout(this._reconnectTimeoutRef),this.pendingReconnect=!0,this.pendingReconnectTimeout=e,this._reconnectTimeoutRef=setTimeout(function(){r.connect()},e)},b.prototype._onSCOpen=function(t){var e=this;this.preparingPendingSubscriptions=!0,t?(this.id=t.id,this.pingTimeout=t.pingTimeout,this.transport.pingTimeout=this.pingTimeout,t.isAuthenticated?this._changeToAuthenticatedState(t.authToken):this._changeToUnauthenticatedStateAndClearTokens()):this._changeToUnauthenticatedStateAndClearTokens(),this.connectAttempts=0,this.options.autoSubscribeOnConnect&&this.processPendingSubscriptions(),a.prototype.emit.call(this,"connect",t,function(){e.processPendingSubscriptions()}),this.state===this.OPEN&&this._flushEmitBuffer()},b.prototype._onSCError=function(t){var e=this;setTimeout(function(){if(e.listeners("error").length<1)throw t;a.prototype.emit.call(e,"error",t)},0)},b.prototype._suspendSubscriptions=function(){var t,e;for(var r in this.channels)this.channels.hasOwnProperty(r)&&(e=(t=this.channels[r]).state===t.SUBSCRIBED||t.state===t.PENDING?t.PENDING:t.UNSUBSCRIBED,this._triggerChannelUnsubscribe(t,e))},b.prototype._abortAllPendingEventsDueToBadConnection=function(t){for(var e,r=this._emitBuffer.head;r;){e=r.next;var n=r.data;clearTimeout(n.timeout),delete n.timeout,r.detach(),r=e;var o=n.callback;if(o){delete n.callback;var i="Event '"+n.event+"' was aborted due to a bad connection",s=new m(i,t);o.call(n,s,n)}n.cid&&this.transport.cancelPendingResponse(n.cid)}},b.prototype._onSCClose=function(t,e,r){if(this.id=null,this.transport&&this.transport.off(),this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this._suspendSubscriptions(),this._abortAllPendingEventsDueToBadConnection(r?"connectAbort":"disconnect"),this.options.autoReconnect&&(4e3===t||4001===t||1005===t?this._tryReconnect(0):1e3!==t&&t<4500&&this._tryReconnect()),r?a.prototype.emit.call(this,"connectAbort",t,e):a.prototype.emit.call(this,"disconnect",t,e),a.prototype.emit.call(this,"close",t,e),!b.ignoreStatuses[t]){var n;n=e?"Socket connection closed with status code "+t+" and reason: "+e:"Socket connection closed with status code "+t;var o=new d(b.errorStatuses[t]||n,t);this._onSCError(o)}},b.prototype._onSCEvent=function(t,e,r){var n=this._privateEventHandlerMap[t];n?n.call(this,e,r):a.prototype.emit.call(this,t,e,function(){r&&r.callback.apply(r,arguments)})},b.prototype.decode=function(t){return this.transport.decode(t)},b.prototype.encode=function(t){return this.transport.encode(t)},b.prototype._flushEmitBuffer=function(){for(var t,e=this._emitBuffer.head;e;){t=e.next;var r=e.data;e.detach(),this.transport.emitObject(r),e=t}},b.prototype._handleEventAckTimeout=function(t,e){e&&e.detach(),delete t.timeout;var r=t.callback;if(r){delete t.callback;var n=new y("Event response for '"+t.event+"' timed out");r.call(t,n,t)}t.cid&&this.transport.cancelPendingResponse(t.cid)},b.prototype._emit=function(t,e,r){var n=this;this.state===this.CLOSED&&this.connect();var o={event:t,callback:r},i=new p.Item;this.options.cloneData?o.data=l(e):o.data=e,(i.data=o).timeout=setTimeout(function(){n._handleEventAckTimeout(o,i)},this.ackTimeout),this._emitBuffer.append(i),this.state===this.OPEN&&this._flushEmitBuffer()},b.prototype.send=function(t){this.transport.send(t)},b.prototype.emit=function(t,e,r){if(null==this._localEvents[t])this._emit(t,e,r);else if("error"===t)a.prototype.emit.call(this,t,e);else{var n=new o('The "'+t+'" event is reserved and cannot be emitted on a client socket');this._onSCError(n)}},b.prototype.publish=function(t,e,r){var n={channel:this._decorateChannelName(t),data:e};this.emit("#publish",n,r)},b.prototype._triggerChannelSubscribe=function(t,e){var r=t.name;if(t.state!==t.SUBSCRIBED){var n=t.state;t.state=t.SUBSCRIBED;var o={channel:r,oldState:n,newState:t.state,subscriptionOptions:e};t.emit("subscribeStateChange",o),t.emit("subscribe",r,e),a.prototype.emit.call(this,"subscribeStateChange",o),a.prototype.emit.call(this,"subscribe",r,e)}},b.prototype._triggerChannelSubscribeFail=function(t,e,r){var n=e.name,o=!e.waitForAuth||this.authState===this.AUTHENTICATED;e.state!==e.UNSUBSCRIBED&&o&&(e.state=e.UNSUBSCRIBED,e.emit("subscribeFail",t,n,r),a.prototype.emit.call(this,"subscribeFail",t,n,r))},b.prototype._cancelPendingSubscribeCallback=function(t){null!=t._pendingSubscriptionCid&&(this.transport.cancelPendingResponse(t._pendingSubscriptionCid),delete t._pendingSubscriptionCid)},b.prototype._decorateChannelName=function(t){return this.channelPrefix&&(t=this.channelPrefix+t),t},b.prototype._undecorateChannelName=function(t){return this.channelPrefix&&0===t.indexOf(this.channelPrefix)?t.replace(this.channelPrefix,""):t},b.prototype._trySubscribe=function(e){var r=this,t=!e.waitForAuth||this.authState===this.AUTHENTICATED;if(this.state===this.OPEN&&!this.preparingPendingSubscriptions&&null==e._pendingSubscriptionCid&&t){var n={noTimeout:!0},o={channel:this._decorateChannelName(e.name)};e.waitForAuth&&(n.waitForAuth=!0,o.waitForAuth=n.waitForAuth),e.data&&(o.data=e.data),e.batch&&(n.batch=!0,o.batch=!0),e._pendingSubscriptionCid=this.transport.emit("#subscribe",o,n,function(t){delete e._pendingSubscriptionCid,t?r._triggerChannelSubscribeFail(t,e,o):r._triggerChannelSubscribe(e,o)}),a.prototype.emit.call(this,"subscribeRequest",e.name,o)}},b.prototype.subscribe=function(t,e){var r=this.channels[t];return r?e&&r.setOptions(e):(r=new n(t,this,e),this.channels[t]=r),r.state===r.UNSUBSCRIBED&&(r.state=r.PENDING,this._trySubscribe(r)),r},b.prototype._triggerChannelUnsubscribe=function(t,e){var r=t.name,n=t.state;if(t.state=e||t.UNSUBSCRIBED,this._cancelPendingSubscribeCallback(t),n===t.SUBSCRIBED){var o={channel:r,oldState:n,newState:t.state};t.emit("subscribeStateChange",o),t.emit("unsubscribe",r),a.prototype.emit.call(this,"subscribeStateChange",o),a.prototype.emit.call(this,"unsubscribe",r)}},b.prototype._tryUnsubscribe=function(t){if(this.state===this.OPEN){var e={noTimeout:!0};t.batch&&(e.batch=!0),this._cancelPendingSubscribeCallback(t);var r=this._decorateChannelName(t.name);this.transport.emit("#unsubscribe",r,e)}},b.prototype.unsubscribe=function(t){var e=this.channels[t];e&&e.state!==e.UNSUBSCRIBED&&(this._triggerChannelUnsubscribe(e),this._tryUnsubscribe(e))},b.prototype.channel=function(t,e){var r=this.channels[t];return r||(r=new n(t,this,e),this.channels[t]=r),r},b.prototype.destroyChannel=function(t){var e=this.channels[t];e&&(e.unwatch(),e.unsubscribe(),delete this.channels[t])},b.prototype.subscriptions=function(t){var e,r=[];for(var n in this.channels)this.channels.hasOwnProperty(n)&&(e=this.channels[n],(t?e&&(e.state===e.SUBSCRIBED||e.state===e.PENDING):e&&e.state===e.SUBSCRIBED)&&r.push(n));return r},b.prototype.isSubscribed=function(t,e){var r=this.channels[t];return e?!!r&&(r.state===r.SUBSCRIBED||r.state===r.PENDING):!!r&&r.state===r.SUBSCRIBED},b.prototype.processPendingSubscriptions=function(){var e=this;this.preparingPendingSubscriptions=!1;var t=[];for(var r in this.channels)if(this.channels.hasOwnProperty(r)){var n=this.channels[r];n.state===n.PENDING&&t.push(n)}t.sort(function(t,e){var r=t.priority||0,n=e.priority||0;return n<r?-1:r<n?1:0}),t.forEach(function(t){e._trySubscribe(t)})},b.prototype.watch=function(t,e){if("function"!=typeof e)throw new f("No handler function was provided");this._channelEmitter.on(t,e)},b.prototype.unwatch=function(t,e){e?this._channelEmitter.removeListener(t,e):this._channelEmitter.removeAllListeners(t)},b.prototype.watchers=function(t){return this._channelEmitter.listeners(t)},E.exports=b}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./auth":2,"./response":4,"./sctransport":6,"buffer/":9,clone:10,"component-emitter":11,"linked-list":14,querystring:17,"sc-channel":18,"sc-errors":20,"sc-formatter":21}],6:[function(h,p){(function(t){var r,s,i=h("component-emitter"),a=h("./response").Response,o=h("querystring");s=t.WebSocket?(r=t.WebSocket,function(t){return new r(t)}):(r=h("ws"),function(t,e){return new r(t,null,e)});var c=h("sc-errors"),n=c.TimeoutError,u=c.BadConnectionError,e=function(t,e,r){var n=this;this.state=this.CLOSED,this.auth=t,this.codec=e,this.options=r,this.connectTimeout=r.connectTimeout,this.pingTimeout=r.ackTimeout,this.pingTimeoutDisabled=!!r.pingTimeoutDisabled,this.callIdGenerator=r.callIdGenerator,this.authTokenName=r.authTokenName,this._pingTimeoutTicker=null,this._callbackMap={},this._batchSendList=[],this.state=this.CONNECTING;var o=this.uri(),i=s(o,this.options);i.binaryType=this.options.binaryType,(this.socket=i).onopen=function(){n._onOpen()},i.onclose=function(t){var e;e=null==t.code?1005:t.code,n._onClose(e,t.reason)},i.onmessage=function(t){n._onMessage(t.data)},i.onerror=function(){n.state===n.CONNECTING&&n._onClose(1006)},this._connectTimeoutRef=setTimeout(function(){n._onClose(4007),n.socket.close(4007)},this.connectTimeout)};e.prototype=Object.create(i.prototype),e.CONNECTING=e.prototype.CONNECTING="connecting",e.OPEN=e.prototype.OPEN="open",e.CLOSED=e.prototype.CLOSED="closed",e.prototype.uri=function(){var t,e=this.options.query||{},r=this.options.secure?"wss":"ws";if(this.options.timestampRequests&&(e[this.options.timestampParam]=(new Date).getTime()),(e=o.encode(e)).length&&(e="?"+e),this.options.host)t=this.options.host;else{var n="";this.options.port&&("wss"===r&&443!==this.options.port||"ws"===r&&80!==this.options.port)&&(n=":"+this.options.port),t=this.options.hostname+n}return r+"://"+t+this.options.path+e},e.prototype._onOpen=function(){var n=this;clearTimeout(this._connectTimeoutRef),this._resetPingTimeout(),this._handshake(function(t,e){var r;t?(r=e&&e.code?e.code:4003,n._onError(t),n._onClose(r,t.toString()),n.socket.close(r)):(n.state=n.OPEN,i.prototype.emit.call(n,"open",e),n._resetPingTimeout())})},e.prototype._handshake=function(n){var e=this;this.auth.loadToken(this.authTokenName,function(t,r){t?n(t):e.emit("#handshake",{authToken:r},{force:!0},function(t,e){e&&(e.authToken=r,e.authError&&(e.authError=c.hydrateError(e.authError))),n(t,e)})})},e.prototype._abortAllPendingEventsDueToBadConnection=function(t){for(var e in this._callbackMap)if(this._callbackMap.hasOwnProperty(e)){var r=this._callbackMap[e];delete this._callbackMap[e],clearTimeout(r.timeout),delete r.timeout;var n="Event '"+r.event+"' was aborted due to a bad connection",o=new u(n,t),i=r.callback;delete r.callback,i.call(r,o,r)}},e.prototype._onClose=function(t,e){delete this.socket.onopen,delete this.socket.onclose,delete this.socket.onmessage,delete this.socket.onerror,clearTimeout(this._connectTimeoutRef),clearTimeout(this._pingTimeoutTicker),clearTimeout(this._batchTimeout),this.state===this.OPEN?(this.state=this.CLOSED,i.prototype.emit.call(this,"close",t,e),this._abortAllPendingEventsDueToBadConnection("disconnect")):this.state===this.CONNECTING&&(this.state=this.CLOSED,i.prototype.emit.call(this,"openAbort",t,e),this._abortAllPendingEventsDueToBadConnection("connectAbort"))},e.prototype._handleEventObject=function(t,e){if(t&&null!=t.event){var r=new a(this,t.cid);i.prototype.emit.call(this,"event",t.event,t.data,r)}else if(t&&null!=t.rid){var n=this._callbackMap[t.rid];if(n&&(clearTimeout(n.timeout),delete n.timeout,delete this._callbackMap[t.rid],n.callback)){var o=c.hydrateError(t.error);n.callback(o,t.data)}}else i.prototype.emit.call(this,"event","raw",e)},e.prototype._onMessage=function(t){i.prototype.emit.call(this,"event","message",t);var e=this.decode(t);if("#1"===e)this._resetPingTimeout(),this.socket.readyState===this.socket.OPEN&&this.sendObject("#2");else if(Array.isArray(e))for(var r=e.length,n=0;n<r;n++)this._handleEventObject(e[n],t);else this._handleEventObject(e,t)},e.prototype._onError=function(t){i.prototype.emit.call(this,"error",t)},e.prototype._resetPingTimeout=function(){if(!this.pingTimeoutDisabled){var t=this;(new Date).getTime(),clearTimeout(this._pingTimeoutTicker),this._pingTimeoutTicker=setTimeout(function(){t._onClose(4e3),t.socket.close(4e3)},this.pingTimeout)}},e.prototype.getBytesReceived=function(){return this.socket.bytesReceived},e.prototype.close=function(t,e){if(t=t||1e3,this.state===this.OPEN){var r={code:t,data:e};this.emit("#disconnect",r),this._onClose(t,e),this.socket.close(t)}else this.state===this.CONNECTING&&(this._onClose(t,e),this.socket.close(t))},e.prototype.emitObject=function(t,e){var r={event:t.event,data:t.data};return t.callback&&(r.cid=t.cid=this.callIdGenerator(),this._callbackMap[t.cid]=t),this.sendObject(r,e),t.cid||null},e.prototype._handleEventAckTimeout=function(t){t.cid&&delete this._callbackMap[t.cid],delete t.timeout;var e=t.callback;if(e){delete t.callback;var r=new n("Event response for '"+t.event+"' timed out");e.call(t,r,t)}},e.prototype.emit=function(t,e,r,n){var o,i,s=this;n?(i=r,o=n):r instanceof Function?(i={},o=r):i=r;var a={event:t,data:e,callback:o};o&&!i.noTimeout&&(a.timeout=setTimeout(function(){s._handleEventAckTimeout(a)},this.options.ackTimeout));var c=null;return(this.state===this.OPEN||i.force)&&(c=this.emitObject(a,i)),c},e.prototype.cancelPendingResponse=function(t){delete this._callbackMap[t]},e.prototype.decode=function(t){return this.codec.decode(t)},e.prototype.encode=function(t){return this.codec.encode(t)},e.prototype.send=function(t){this.socket.readyState!==this.socket.OPEN?this._onClose(1005):this.socket.send(t)},e.prototype.serializeObject=function(t){var e,r;try{e=this.encode(t)}catch(t){r=t,this._onError(r)}return r?null:e},e.prototype.sendObjectBatch=function(t){var e=this;this._batchSendList.push(t),this._batchTimeout||(this._batchTimeout=setTimeout(function(){if(delete e._batchTimeout,e._batchSendList.length){var t=e.serializeObject(e._batchSendList);null!=t&&e.send(t),e._batchSendList=[]}},this.options.pubSubBatchDuration||0))},e.prototype.sendObjectSingle=function(t){var e=this.serializeObject(t);null!=e&&this.send(e)},e.prototype.sendObject=function(t,e){e&&e.batch?this.sendObjectBatch(t):this.sendObjectSingle(t)},p.exports.SCTransport=e}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./response":4,"component-emitter":11,querystring:17,"sc-errors":20,ws:7}],7:[function(t,e){var r,n=(r="undefined"!=typeof WorkerGlobalScope?self:"undefined"!=typeof window&&window||function(){return this}()).WebSocket||r.MozWebSocket;function o(t,e){return e?new n(t,e):new n(t)}n&&(o.prototype=n.prototype),e.exports=n?o:null},{}],8:[function(t,e,r){"use strict";r.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){for(var e,r=f(t),n=r[0],o=r[1],i=new l((u=n,h=o,3*(u+h)/4-h)),s=0,a=0<o?n-4:n,c=0;c<a;c+=4)e=p[t.charCodeAt(c)]<<18|p[t.charCodeAt(c+1)]<<12|p[t.charCodeAt(c+2)]<<6|p[t.charCodeAt(c+3)],i[s++]=e>>16&255,i[s++]=e>>8&255,i[s++]=255&e;var u,h;2===o&&(e=p[t.charCodeAt(c)]<<2|p[t.charCodeAt(c+1)]>>4,i[s++]=255&e);1===o&&(e=p[t.charCodeAt(c)]<<10|p[t.charCodeAt(c+1)]<<4|p[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=255&e);return i},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,o=[],i=0,s=r-n;i<s;i+=16383)o.push(c(t,i,s<i+16383?s:i+16383));1===n?(e=t[r-1],o.push(a[e>>2]+a[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(a[e>>10]+a[e>>4&63]+a[e<<2&63]+"="));return o.join("")};for(var a=[],p=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=n.length;o<i;++o)a[o]=n[o],p[n.charCodeAt(o)]=o;function f(t){var e=t.length;if(0<e%4)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 c(t,e,r){for(var n,o,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),i.push(a[(o=n)>>18&63]+a[o>>12&63]+a[o>>6&63]+a[63&o]);return i.join("")}p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63},{}],9:[function(t,e,D){(function(p){"use strict";var n=t("base64-js"),i=t("ieee754");D.Buffer=p,D.SlowBuffer=function(t){+t!=t&&(t=0);return p.alloc(+t)},D.INSPECT_MAX_BYTES=50;var r=2147483647;function s(t){if(r<t)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=p.prototype,e}function p(t,e,r){if("number"!=typeof t)return o(t,e,r);if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|l(t,e),n=s(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return u(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(R(t,ArrayBuffer)||t&&R(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__=p.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 p.from(n,e,r);var o=function(t){if(p.isBuffer(t)){var e=0|h(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||P(t.length)?s(0):u(t);if("Buffer"===t.type&&Array.isArray(t.data))return u(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return p.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 a(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 c(t){return a(t),s(t<0?0:0|h(t))}function u(t){for(var e=t.length<0?0:0|h(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function h(t){if(r<=t)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function l(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||R(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=2<arguments.length&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(o)return n?-1:N(t).length;e=(""+e).toLowerCase(),o=!0}}function f(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=p.from(e,n)),p.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,o){var i,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;a/=s=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var h=-1;for(i=r;i<a;i++)if(u(t,i)===u(e,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===c)return h*s}else-1!==h&&(i-=i-h),h=-1}else for(a<r+c&&(r=a-c),i=r;0<=i;i--){for(var p=!0,l=0;l<c;l++)if(u(t,i+l)!==u(e,l)){p=!1;break}if(p)return i}return-1}function m(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?o<(n=Number(n))&&(n=o):n=o;var i=e.length;i/2<n&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(P(a))return s;t[r+s]=a}return s}function g(t,e,r,n){return x(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function b(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function v(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,c,u=t[o],h=null,p=239<u?4:223<u?3:191<u?2:1;if(o+p<=r)switch(p){case 1:u<128&&(h=u);break;case 2:128==(192&(i=t[o+1]))&&127<(c=(31&u)<<6|63&i)&&(h=c);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&2047<(c=(15&u)<<12|(63&i)<<6|63&s)&&(c<55296||57343<c)&&(h=c);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&65535<(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)&&c<1114112&&(h=c)}null===h?(h=65533,p=1):65535<h&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=p}return function(t){var e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=E));return r}(n)}D.kMaxLength=r,(p.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}}())||"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(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&p[Symbol.species]===p&&Object.defineProperty(p,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),p.poolSize=8192,p.from=function(t,e,r){return o(t,e,r)},p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,p.alloc=function(t,e,r){return o=e,i=r,a(n=t),n<=0?s(n):void 0!==o?"string"==typeof i?s(n).fill(o,i):s(n).fill(o):s(n);var n,o,i},p.allocUnsafe=function(t){return c(t)},p.allocUnsafeSlow=function(t){return c(t)},p.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==p.prototype},p.compare=function(t,e){if(R(t,Uint8Array)&&(t=p.from(t,t.offset,t.byteLength)),R(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(t)||!p.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,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},p.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}},p.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return p.alloc(0);var r;if(void 0===e)for(r=e=0;r<t.length;++r)e+=t[r].length;var n=p.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(R(i,Uint8Array)&&(i=p.from(i)),!p.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},p.byteLength=l,p.prototype._isBuffer=!0,p.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},p.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},p.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},p.prototype.toLocaleString=p.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?v(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 S(this,e,r);case"utf8":case"utf-8":return v(this,e,r);case"ascii":return w(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return b(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},p.prototype.equals=function(t){if(!p.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===p.compare(this,t)},p.prototype.inspect=function(){var t="",e=D.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},p.prototype.compare=function(t,e,r,n,o){if(R(t,Uint8Array)&&(t=p.from(t,t.offset,t.byteLength)),!p.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===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=e)return 0;if(o<=n)return-1;if(r<=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(i,s),c=this.slice(n,o),u=t.slice(e,r),h=0;h<a;++h)if(c[h]!==u[h]){i=c[h],s=u[h];break}return i<s?-1:s<i?1:0},p.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},p.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},p.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},p.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 o=this.length-e;if((void 0===r||o<r)&&(r=o),0<t.length&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i,s,a,c,u,h,p,l,f,d=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return l=e,f=r,x(N(t,(p=this).length-l),p,l,f);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return g(this,t,e,r);case"base64":return c=this,u=e,h=r,x(U(t),c,u,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=e,a=r,x(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(t,(i=this).length-s),i,s,a);default:if(d)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function w(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function S(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||n<r)&&(r=n);for(var o="",i=e;i<r;++i)o+=I(t[i]);return o}function k(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function _(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(r<t+e)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,r,n,o,i){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<e||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function A(t,e,r,n){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,n,o){return e=+e,r>>>=0,o||A(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function B(t,e,r,n,o){return e=+e,r>>>=0,o||A(t,0,r,8),i.write(t,e,r,n,52,8),r+8}p.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=p.prototype,n},p.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||_(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},p.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||_(t,e,this.length);for(var n=this[t+--e],o=1;0<e&&(o*=256);)n+=this[t+--e]*o;return n},p.prototype.readUInt8=function(t,e){return t>>>=0,e||_(t,1,this.length),this[t]},p.prototype.readUInt16LE=function(t,e){return t>>>=0,e||_(t,2,this.length),this[t]|this[t+1]<<8},p.prototype.readUInt16BE=function(t,e){return t>>>=0,e||_(t,2,this.length),this[t]<<8|this[t+1]},p.prototype.readUInt32LE=function(t,e){return t>>>=0,e||_(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},p.prototype.readUInt32BE=function(t,e){return t>>>=0,e||_(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},p.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||_(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return(o*=128)<=n&&(n-=Math.pow(2,8*e)),n},p.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||_(t,e,this.length);for(var n=e,o=1,i=this[t+--n];0<n&&(o*=256);)i+=this[t+--n]*o;return(o*=128)<=i&&(i-=Math.pow(2,8*e)),i},p.prototype.readInt8=function(t,e){return t>>>=0,e||_(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},p.prototype.readInt16LE=function(t,e){t>>>=0,e||_(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},p.prototype.readInt16BE=function(t,e){t>>>=0,e||_(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},p.prototype.readInt32LE=function(t,e){return t>>>=0,e||_(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},p.prototype.readInt32BE=function(t,e){return t>>>=0,e||_(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},p.prototype.readFloatLE=function(t,e){return t>>>=0,e||_(t,4,this.length),i.read(this,t,!0,23,4)},p.prototype.readFloatBE=function(t,e){return t>>>=0,e||_(t,4,this.length),i.read(this,t,!1,23,4)},p.prototype.readDoubleLE=function(t,e){return t>>>=0,e||_(t,8,this.length),i.read(this,t,!0,52,8)},p.prototype.readDoubleBE=function(t,e){return t>>>=0,e||_(t,8,this.length),i.read(this,t,!1,52,8)},p.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},p.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;0<=--o&&(i*=256);)this[e+o]=t/i&255;return e+r},p.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},p.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},p.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},p.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},p.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},p.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},p.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;0<=--i&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},p.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},p.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},p.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},p.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},p.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},p.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},p.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},p.prototype.writeDoubleLE=function(t,e,r){return B(this,t,e,!0,r)},p.prototype.writeDoubleBE=function(t,e,r){return B(this,t,e,!1,r)},p.prototype.copy=function(t,e,r,n){if(!p.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),0<n&&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 o=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 i=o-1;0<=i;--i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},p.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&&!p.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}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 i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=p.isBuffer(t)?t:p.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var e=/[^+/0-9A-Za-z-_]/g;function I(t){return t<16?"0"+t.toString(16):t.toString(16)}function N(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if(55295<(r=t.charCodeAt(s))&&r<57344){if(!o){if(56319<r){-1<(e-=3)&&i.push(239,191,189);continue}if(s+1===n){-1<(e-=3)&&i.push(239,191,189);continue}o=r;continue}if(r<56320){-1<(e-=3)&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&-1<(e-=3)&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function U(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(e,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function x(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function R(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":8,buffer:9,ieee754:12}],10:[function(t,e){(function(k){var t=function(){"use strict";function b(t,e){return null!=e&&t instanceof e}var v,E,w;try{v=Map}catch(t){v=function(){}}try{E=Set}catch(t){E=function(){}}try{w=Promise}catch(t){w=function(){}}function T(t,f,e,d,y){"object"==typeof f&&(e=f.depth,d=f.prototype,y=f.includeNonEnumerable,f=f.circular);var m=[],g=[];return void 0===f&&(f=!0),void 0===e&&(e=1/0),function o(t,i){if(null===t)return null;if(0===i)return t;var s,e;if("object"!=typeof t)return t;if(b(t,v))s=new v;else if(b(t,E))s=new E;else if(b(t,w))s=new w(function(e,r){t.then(function(t){e(o(t,i-1))},function(t){r(o(t,i-1))})});else if(T.__isArray(t))s=[];else if(T.__isRegExp(t))s=new RegExp(t.source,S(t)),t.lastIndex&&(s.lastIndex=t.lastIndex);else if(T.__isDate(t))s=new Date(t.getTime());else{if(void 0!==k&&k.isBuffer(t))return s=new k(t.length),t.copy(s),s;b(t,Error)?s=Object.create(t):void 0===d?(e=Object.getPrototypeOf(t),s=Object.create(e)):(s=Object.create(d),e=d)}if(f){var r=m.indexOf(t);if(-1!=r)return g[r];m.push(t),g.push(s)}for(var n in b(t,v)&&t.forEach(function(t,e){var r=o(e,i-1),n=o(t,i-1);s.set(r,n)}),b(t,E)&&t.forEach(function(t){var e=o(t,i-1);s.add(e)}),t){var a;e&&(a=Object.getOwnPropertyDescriptor(e,n)),a&&null==a.set||(s[n]=o(t[n],i-1))}if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);for(n=0;n<c.length;n++){var u=c[n];(!(p=Object.getOwnPropertyDescriptor(t,u))||p.enumerable||y)&&(s[u]=o(t[u],i-1),p.enumerable||Object.defineProperty(s,u,{enumerable:!1}))}}if(y){var h=Object.getOwnPropertyNames(t);for(n=0;n<h.length;n++){var p,l=h[n];(p=Object.getOwnPropertyDescriptor(t,l))&&p.enumerable||(s[l]=o(t[l],i-1),Object.defineProperty(s,l,{enumerable:!1}))}}return s}(t,e)}function e(t){return Object.prototype.toString.call(t)}function S(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return T.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},T.__objToStr=e,T.__isDate=function(t){return"object"==typeof t&&"[object Date]"===e(t)},T.__isArray=function(t){return"object"==typeof t&&"[object Array]"===e(t)},T.__isRegExp=function(t){return"object"==typeof t&&"[object RegExp]"===e(t)},T.__getRegExpFlags=S,T}();"object"==typeof e&&e.exports&&(e.exports=t)}).call(this,t("buffer").Buffer)},{buffer:9}],11:[function(t,e){function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}void 0!==e&&(e.exports=r),r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r)for(var n=0,o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],12:[function(t,e,r){r.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,h=-7,p=r?o-1:0,l=r?-1:1,f=t[e+p];for(p+=l,i=f&(1<<-h)-1,f>>=-h,h+=a;0<h;i=256*i+t[e+p],p+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;0<h;s=256*s+t[e+p],p+=l,h-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<<u)-1,p=h>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,d=n?1:-1,y=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),2<=(e+=1<=s+p?l/c:l*Math.pow(2,1-p))*c&&(s++,c/=2),h<=s+p?(a=0,s=h):1<=s+p?(a=(e*c-1)*Math.pow(2,o),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,o),s=0));8<=o;t[r+f]=255&a,f+=d,a/=256,o-=8);for(s=s<<o|a,u+=o;0<u;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y}},{}],13:[function(t,e){"use strict";var o="An argument without append, prepend, or detach methods was given to `List";function r(){if(arguments.length)return r.from(arguments)}var n=r.prototype;function i(){}r.of=function(){return r.from.call(this,arguments)},r.from=function(t){var e,r,n,o=new this;if(t&&(e=t.length))for(r=-1;++r<e;)null!=(n=t[r])&&o.append(n);return o},n.head=null,n.tail=null,n.toArray=function(){for(var t=this.head,e=[];t;)e.push(t),t=t.next;return e},n.prepend=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(o+"#prepend`.");var e;return(e=this.head)?e.prepend(t):(t.detach(),(t.list=this).head=t)},n.append=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(o+"#append`.");var e,r;return(r=this.tail)?r.append(t):(e=this.head)?e.append(t):(t.detach(),(t.list=this).head=t)};var s=(r.Item=i).prototype;s.next=null,s.prev=null,s.list=null,s.detach=function(){var t=this,e=t.list,r=t.prev,n=t.next;return e&&(e.tail===t&&(e.tail=r),e.head===t&&(e.head=n),e.tail===e.head&&(e.tail=null),r&&(r.next=n),n&&(n.prev=r),t.prev=t.next=t.list=null),t},s.prepend=function(t){if(!(t&&t.append&&t.prepend&&t.detach))throw new Error(o+"Item#prepend`.");var e=this,r=e.list,n=e.prev;return!!r&&(t.detach(),n&&((t.prev=n).next=t),t.next=e,t.list=r,e.prev=t,e===r.head&&(r.head=t),r.tail||(r.tail=e),t)},s.append=function(t){if(!(t&&t.append&&t.prepend&&t.detach))throw new Error(o+"Item#append`.");var e=this,r=e.list,n=e.next;return!!r&&(t.detach(),n&&((t.next=n).prev=t),t.prev=e,t.list=r,e.next=t,e!==r.tail&&r.tail||(r.tail=t),t)},e.exports=r},{}],14:[function(t,e){"use strict";e.exports=t("./_source/linked-list.js")},{"./_source/linked-list.js":13}],15:[function(t,e){"use strict";e.exports=function(t,e,r,n){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var i=/\+/g;t=t.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var a,c,u=t.length;0<s&&s<u&&(u=s);for(var h=0;h<u;++h){var p,l,f,d,y=t[h].replace(i,"%20"),m=y.indexOf(r);l=0<=m?(p=y.substr(0,m),y.substr(m+1)):(p=y,""),f=decodeURIComponent(p),d=decodeURIComponent(l),a=o,c=f,Object.prototype.hasOwnProperty.call(a,c)?g(o[f])?o[f].push(d):o[f]=[o[f],d]:o[f]=d}return o};var g=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],16:[function(t,e){"use strict";var i=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(r,n,o,t){return n=n||"&",o=o||"=",null===r&&(r=void 0),"object"==typeof r?a(c(r),function(t){var e=encodeURIComponent(i(t))+o;return s(r[t])?a(r[t],function(t){return e+encodeURIComponent(i(t))}).join(n):e+encodeURIComponent(i(r[t]))}).join(n):t?encodeURIComponent(i(t))+o+encodeURIComponent(i(r)):""};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function a(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 c=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},{}],17:[function(t,e,r){"use strict";r.decode=r.parse=t("./decode"),r.encode=r.stringify=t("./encode")},{"./decode":15,"./encode":16}],18:[function(t,e){var n=t("component-emitter"),r=function(t,e,r){n.call(this),this.PENDING="pending",this.SUBSCRIBED="subscribed",this.UNSUBSCRIBED="unsubscribed",this.name=t,this.state=this.UNSUBSCRIBED,this.client=e,this.options=r||{},this.setOptions(this.options)};(r.prototype=Object.create(n.prototype)).setOptions=function(t){t||(t={}),this.waitForAuth=t.waitForAuth||!1,this.batch=t.batch||!1,void 0!==t.data&&(this.data=t.data)},r.prototype.getState=function(){return this.state},r.prototype.subscribe=function(t){this.client.subscribe(this.name,t)},r.prototype.unsubscribe=function(){this.client.unsubscribe(this.name)},r.prototype.isSubscribed=function(t){return this.client.isSubscribed(this.name,t)},r.prototype.publish=function(t,e){this.client.publish(this.name,t,e)},r.prototype.watch=function(t){this.client.watch(this.name,t)},r.prototype.unwatch=function(t){this.client.unwatch(this.name,t)},r.prototype.watchers=function(){return this.client.watchers(this.name)},r.prototype.destroy=function(){this.client.destroyChannel(this.name)},e.exports.SCChannel=r},{"component-emitter":11}],19:[function(t,e){e.exports=function(t){var s=[],a=[];return function t(e,r){var n,o,i;if("object"!=typeof e||null===e||e instanceof Boolean||e instanceof Date||e instanceof Number||e instanceof RegExp||e instanceof String)return e;for(n=0;n<s.length;n+=1)if(s[n]===e)return{$ref:a[n]};if(s.push(e),a.push(r),"[object Array]"===Object.prototype.toString.apply(e))for(i=[],n=0;n<e.length;n+=1)i[n]=t(e[n],r+"["+n+"]");else for(o in i={},e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=t(e[o],r+"["+JSON.stringify(o)+"]"));return i}(t,"$")}},{}],20:[function(t,e){var o=t("./decycle"),r=function(){return!this}();function n(t,e){this.name="AuthTokenExpiredError",this.message=t,this.expiry=e,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function i(t){this.name="AuthTokenInvalidError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function s(t,e){this.name="AuthTokenNotBeforeError",this.message=t,this.date=e,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function a(t){this.name="AuthTokenError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function c(t,e){this.name="SilentMiddlewareBlockedError",this.message=t,this.type=e,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function u(t){this.name="InvalidActionError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function h(t){this.name="InvalidArgumentsError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function p(t){this.name="InvalidOptionsError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function l(t){this.name="InvalidMessageError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function f(t,e){this.name="SocketProtocolError",this.message=t,this.code=e,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function d(t){this.name="ServerProtocolError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function y(t){this.name="HTTPServerError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function m(t){this.name="ResourceLimitError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function g(t){this.name="TimeoutError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function b(t,e){this.name="BadConnectionError",this.message=t,this.type=e,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function v(t){this.name="BrokerError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function E(t,e){this.name="ProcessExitError",this.message=t,this.code=e,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function w(t){this.name="UnknownError",this.message=t,Error.captureStackTrace&&!r?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}n.prototype=Object.create(Error.prototype),i.prototype=Object.create(Error.prototype),s.prototype=Object.create(Error.prototype),a.prototype=Object.create(Error.prototype),c.prototype=Object.create(Error.prototype),u.prototype=Object.create(Error.prototype),h.prototype=Object.create(Error.prototype),p.prototype=Object.create(Error.prototype),l.prototype=Object.create(Error.prototype),f.prototype=Object.create(Error.prototype),d.prototype=Object.create(Error.prototype),y.prototype=Object.create(Error.prototype),m.prototype=Object.create(Error.prototype),g.prototype=Object.create(Error.prototype),b.prototype=Object.create(Error.prototype),v.prototype=Object.create(Error.prototype),E.prototype=Object.create(Error.prototype),w.prototype=Object.create(Error.prototype),e.exports={AuthTokenExpiredError:n,AuthTokenInvalidError:i,AuthTokenNotBeforeError:s,AuthTokenError:a,SilentMiddlewareBlockedError:c,InvalidActionError:u,InvalidArgumentsError:h,InvalidOptionsError:p,InvalidMessageError:l,SocketProtocolError:f,ServerProtocolError:d,HTTPServerError:y,ResourceLimitError:m,TimeoutError:g,BadConnectionError:b,BrokerError:v,ProcessExitError:E,UnknownError:w},e.exports.socketProtocolErrorStatuses={1001:"Socket was disconnected",1002:"A WebSocket protocol error was encountered",1003:"Server terminated socket because it received invalid data",1005:"Socket closed without status code",1006:"Socket hung up",1007:"Message format was incorrect",1008:"Encountered a policy violation",1009:"Message was too big to process",1010:"Client ended the connection because the server did not comply with extension requirements",1011:"Server encountered an unexpected fatal condition",4e3:"Server ping timed out",4001:"Client pong timed out",4002:"Server failed to sign auth token",4003:"Failed to complete handshake",4004:"Client failed to save auth token",4005:"Did not receive #handshake from client before timeout",4006:"Failed to bind socket to message broker",4007:"Client connection establishment timed out",4008:"Server rejected handshake from client"},e.exports.socketProtocolIgnoreStatuses={1e3:"Socket closed normally",1001:"Socket hung up"};var T={domain:1,domainEmitter:1,domainThrown:1};e.exports.dehydrateError=function(t,e){var r;if(t&&"object"==typeof t)for(var n in r={message:t.message},e&&(r.stack=t.stack),t)T[n]||(r[n]=t[n]);else r="function"==typeof t?"[function "+(t.name||"anonymous")+"]":t;return o(r)},e.exports.hydrateError=function(t){var e=null;if(null!=t)if("object"==typeof t)for(var r in e=new Error(t.message),t)t.hasOwnProperty(r)&&(e[r]=t[r]);else e=t;return e},e.exports.decycle=o},{"./decycle":19}],21:[function(t,o){(function(r){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=/^[ \n\r\t]*[{\[]/,e=function(t,e){if(r.ArrayBuffer&&e instanceof r.ArrayBuffer)return{base64:!0,data:function(t){for(var e=new Uint8Array(t),r=e.length,n="",o=0;o<r;o+=3)n+=i[e[o]>>2],n+=i[(3&e[o])<<4|e[o+1]>>4],n+=i[(15&e[o+1])<<2|e[o+2]>>6],n+=i[63&e[o+2]];return r%3==2?n=n.substring(0,n.length-1)+"=":r%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e)};if(r.Buffer){if(e instanceof r.Buffer)return{base64:!0,data:e.toString("base64")};if(e&&"Buffer"===e.type&&Array.isArray(e.data))return{base64:!0,data:(r.Buffer.from?r.Buffer.from(e.data):new r.Buffer(e.data)).toString("base64")}}return e};o.exports.decode=function(t){if(null==t)return null;if("#1"===t||"#2"===t)return t;var e=t.toString();if(!n.test(e))return e;try{return JSON.parse(e)}catch(t){}return e},o.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],22:[function(t,e){var r=t("./v1"),n=t("./v4"),o=n;o.v1=r,o.v4=n,e.exports=o},{"./v1":25,"./v4":26}],23:[function(t,e){for(var o=[],r=0;r<256;++r)o[r]=(r+256).toString(16).substr(1);e.exports=function(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}},{}],24:[function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);e.exports=function(){return r(n),n}}else{var o=new Array(16);e.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},{}],25:[function(t,e){var d,y,m=t("./lib/rng"),g=t("./lib/bytesToUuid"),b=0,v=0;e.exports=function(t,e,r){var n=e&&r||0,o=e||[],i=(t=t||{}).node||d,s=void 0!==t.clockseq?t.clockseq:y;if(null==i||null==s){var a=m();null==i&&(i=d=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=y=16383&(a[6]<<8|a[7]))}var c=void 0!==t.msecs?t.msecs:(new Date).getTime(),u=void 0!==t.nsecs?t.nsecs:v+1,h=c-b+(u-v)/1e4;if(h<0&&void 0===t.clockseq&&(s=s+1&16383),(h<0||b<c)&&void 0===t.nsecs&&(u=0),1e4<=u)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");b=c,y=s;var p=(1e4*(268435455&(c+=122192928e5))+(v=u))%4294967296;o[n++]=p>>>24&255,o[n++]=p>>>16&255,o[n++]=p>>>8&255,o[n++]=255&p;var l=c/4294967296*1e4&268435455;o[n++]=l>>>8&255,o[n++]=255&l,o[n++]=l>>>24&15|16,o[n++]=l>>>16&255,o[n++]=s>>>8|128,o[n++]=255&s;for(var f=0;f<6;++f)o[n+f]=i[f];return e||g(o)}},{"./lib/bytesToUuid":23,"./lib/rng":24}],26:[function(t,e){var s=t("./lib/rng"),a=t("./lib/bytesToUuid");e.exports=function(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var i=0;i<16;++i)e[n+i]=o[i];return e||a(o)}},{"./lib/bytesToUuid":23,"./lib/rng":24}]},{},[1])(1)});