UNPKG

remotedev

Version:

Remote debugging for any flux implementation.

7 lines 63.5 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.RemoteDev=e():t.RemoteDev=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";t.exports=r(9)},function(t,e,r){var n=r(11);Object.create||(Object.create=r(23));var o=function(){n.call(this)};o.prototype=Object.create(n.prototype),o.prototype.emit=function(t){if("error"==t&&this.domain){var e=arguments[1];e||(e=new Error('Uncaught, unspecified "error" event.')),e.domainEmitter=this,e.domain=this.domain,e.domainThrown=!1,this.domain.emit("error",e)}n.prototype.emit.apply(this,arguments)},t.exports.SCEmitter=o},function(t,e,r){function n(t,e){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="AuthTokenExpiredError",this.message=t,this.expiry=e}function o(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="AuthTokenInvalidError",this.message=t}function i(t,e){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="SilentMiddlewareBlockedError",this.message=t,this.type=e}function a(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="InvalidActionError",this.message=t}function s(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="InvalidArgumentsError",this.message=t}function c(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="InvalidOptionsError",this.message=t}function u(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="InvalidMessageError",this.message=t}function h(t,e){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="SocketProtocolError",this.message=t,this.code=e}function p(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="ServerProtocolError",this.message=t}function l(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="HTTPServerError",this.message=t}function f(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="ResourceLimitError",this.message=t}function d(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="TimeoutError",this.message=t}function g(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="BrokerError",this.message=t}function y(t,e){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="ProcessExitError",this.message=t,this.code=e}function m(t){Error.captureStackTrace&&!v?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack,this.name="UnknownError",this.message=t}var E=r(12),v=function(){return!this}();n.prototype=Object.create(Error.prototype),o.prototype=Object.create(Error.prototype),i.prototype=Object.create(Error.prototype),a.prototype=Object.create(Error.prototype),s.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),g.prototype=Object.create(Error.prototype),y.prototype=Object.create(Error.prototype),m.prototype=Object.create(Error.prototype),t.exports={AuthTokenExpiredError:n,AuthTokenInvalidError:o,SilentMiddlewareBlockedError:i,InvalidActionError:a,InvalidArgumentsError:s,InvalidOptionsError:c,InvalidMessageError:u,SocketProtocolError:h,ServerProtocolError:p,HTTPServerError:l,ResourceLimitError:f,TimeoutError:d,BrokerError:g,ProcessExitError:y,UnknownError:m},t.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"},t.exports.socketProtocolIgnoreStatuses={1e3:"Socket closed normally",1001:"Socket hung up"};var b={domain:1,domainEmitter:1,domainThrown:1};t.exports.dehydrateError=function(t,e){var r;if("string"==typeof t)r=t;else{r={message:t.message},e&&(r.stack=t.stack);for(var n in t)b[n]||(r[n]=t[n])}return E.decycle(r)},t.exports.hydrateError=function(t){var e=null;if(null!=t)if("string"==typeof t)e=t;else{e=new Error(t.message);for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}return e}},function(t,e){function r(t,e){if("$"!==e)for(var r=n(e),o=0;o<r.length;o++)e=r[o].toString().replace(/\\"/g,'"'),t=t[e];return t}function n(t){for(var e,r=/(?:\.(\w+))|(?:\[(\d+)\])|(?:\["((?:[^\\"]|\\.)*)"\])/g,n=[];e=r.exec(t);)n.push(e[1]||e[2]||e[3]);return n}t.exports=r},function(t,e,r){"use strict";e.decode=e.parse=r(19),e.encode=e.stringify=r(20)},function(t,e,r){var n=r(2),o=n.InvalidActionError,i=function(t,e){this.socket=t,this.id=e,this.sent=!1};i.prototype._respond=function(t){if(this.sent)throw new o("Response "+this.id+" has already been sent");this.sent=!0,this.socket.send(this.socket.stringify(t))},i.prototype.end=function(t){if(this.id){var e={rid:this.id};void 0!==t&&(e.data=t),this._respond(e)}},i.prototype.error=function(t,e){if(this.id){var r=n.dehydrateError(t),o={rid:this.id,error:r};void 0!==e&&(o.data=e),this._respond(o)}},i.prototype.callback=function(t,e){t?this.error(t,e):this.end(e)},t.exports.Response=i},function(t,e,r){(function(e,n){var o=r(1).SCEmitter,i=r(22).SCChannel,a=(r(5).Response,r(26).AuthEngine),s=r(28).SCTransport,c=r(4),u=r(18),h=r(10),p=r(2),l=p.InvalidArgumentsError,f=p.InvalidMessageError,d=p.SocketProtocolError,g=p.TimeoutError,y="undefined"!=typeof window,m=function(t){var r=this;o.call(this),this.id=null,this.state=this.CLOSED,this.authState=this.PENDING,this.signedAuthToken=null,this.authToken=null,this.pendingReconnect=!1,this.pendingReconnectTimeout=null,this.pendingConnectCallback=!1,this.connectTimeout=t.connectTimeout,this.ackTimeout=t.ackTimeout,this.channelPrefix=t.channelPrefix||null,this.pingTimeout=this.ackTimeout;var n=Math.pow(2,31)-1,i=function(t){if(r[t]>n)throw new l("The "+t+" value provided exceeded the maximum amount allowed")};if(i("connectTimeout"),i("ackTimeout"),i("pingTimeout"),this._localEvents={connect:1,connectAbort:1,disconnect:1,message:1,error:1,raw:1,fail: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 u,this._channels={},this.options=t,this._cid=1,this.options.callIdGenerator=function(){return r._callIdGenerator()},this.options.autoReconnect){null==this.options.autoReconnectOptions&&(this.options.autoReconnectOptions={});var s=this.options.autoReconnectOptions;null==s.initialDelay&&(s.initialDelay=1e4),null==s.randomness&&(s.randomness=1e4),null==s.multiplier&&(s.multiplier=1.5),null==s.maxDelay&&(s.maxDelay=6e4)}if(null==this.options.subscriptionRetryOptions&&(this.options.subscriptionRetryOptions={}),this.options.authEngine?this.auth=this.options.authEngine:this.auth=new a,this.options.path=this.options.path.replace(/\/$/,"")+"/",this.options.query=t.query||{},"string"==typeof this.options.query&&(this.options.query=c.parse(this.options.query)),this.connect(),this._channelEmitter=new o,y){var h=function(){r.disconnect()};e.attachEvent?e.attachEvent("onunload",h):e.addEventListener&&e.addEventListener("beforeunload",h,!1)}};m.prototype=Object.create(o.prototype),m.CONNECTING=m.prototype.CONNECTING=s.prototype.CONNECTING,m.OPEN=m.prototype.OPEN=s.prototype.OPEN,m.CLOSED=m.prototype.CLOSED=s.prototype.CLOSED,m.AUTHENTICATED=m.prototype.AUTHENTICATED="authenticated",m.UNAUTHENTICATED=m.prototype.UNAUTHENTICATED="unauthenticated",m.PENDING=m.prototype.PENDING="pending",m.ignoreStatuses=p.socketProtocolIgnoreStatuses,m.errorStatuses=p.socketProtocolErrorStatuses,m.prototype._privateEventHandlerMap={"#publish":function(t){var e=this._undecorateChannelName(t.channel),r=this.isSubscribed(e,!0);r&&this._channelEmitter.emit(e,t.data)},"#kickOut":function(t){var e=this._undecorateChannelName(t.channel),r=this._channels[e];r&&(o.prototype.emit.call(this,"kickOut",t.message,e),r.emit("kickOut",t.message,e),this._triggerChannelUnsubscribe(r))},"#setAuthToken":function(t,e){var r=this;if(t){var n=function(n){n?(e.error(n),r._onSCError(n)):(r._changeToAuthenticatedState(t.token),e.end())};this.auth.saveToken(this.options.authTokenName,t.token,{},n)}else e.error(new f("No token data provided by #setAuthToken event"))},"#removeAuthToken":function(t,e){var r=this;this.auth.removeToken(this.options.authTokenName,function(t,n){t?(e.error(t),r._onSCError(t)):(o.prototype.emit.call(r,"removeAuthToken",n),r._changeToUnauthenticatedState(),e.end())})},"#disconnect":function(t){this.transport.close(t.code,t.data)}},m.prototype._callIdGenerator=function(){return this._cid++},m.prototype.getState=function(){return this.state},m.prototype.getBytesReceived=function(){return this.transport.getBytesReceived()},m.prototype.deauthenticate=function(t){var e=this;this.auth.removeToken(this.options.authTokenName,function(r,n){e.emit("#removeAuthToken"),t&&t(r),r?e._onSCError(r):(o.prototype.emit.call(e,"removeAuthToken",n),e._changeToUnauthenticatedState())})},m.prototype.connect=m.prototype.open=function(){var t=this;this.state==this.CLOSED&&(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this.state=this.CONNECTING,this._changeToPendingAuthState(),this.transport&&this.transport.off(),this.transport=new s(this.auth,this.options),this.transport.on("open",function(e){t.state=t.OPEN,t._onSCOpen(e)}),this.transport.on("error",function(e){t._onSCError(e)}),this.transport.on("close",function(e,r){t.state=t.CLOSED,t._onSCClose(e,r)}),this.transport.on("openAbort",function(e,r){t.state=t.CLOSED,t._onSCClose(e,r,!0)}),this.transport.on("event",function(e,r,n){t._onSCEvent(e,r,n)}))},m.prototype.reconnect=function(){this.disconnect(),this.connect()},m.prototype.disconnect=function(t,e){if(t=t||1e3,this.state==this.OPEN){var r={code:t,data:e};this.transport.emit("#disconnect",r),this.transport.close(t,e)}else this.state==this.CONNECTING?this.transport.close(t,e):(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef))},m.prototype._changeToPendingAuthState=function(){if(this.authState!=this.PENDING){var t=this.authState;this.authState=this.PENDING;var e={oldState:t,newState:this.authState};o.prototype.emit.call(this,"authStateChange",e)}},m.prototype._changeToUnauthenticatedState=function(){if(this.authState!=this.UNAUTHENTICATED){var t=this.authState;this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null;var e={oldState:t,newState:this.authState};o.prototype.emit.call(this,"authStateChange",e),t==this.AUTHENTICATED&&o.prototype.emit.call(this,"deauthenticate"),o.prototype.emit.call(this,"authTokenChange",this.signedAuthToken)}},m.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.processPendingSubscriptions(),o.prototype.emit.call(this,"authStateChange",r),o.prototype.emit.call(this,"authenticate",t)}o.prototype.emit.call(this,"authTokenChange",t)},m.prototype.decodeBase64=function(t){var r;if("undefined"==typeof n)r=e.atob?e.atob(t):h.decode(t);else{var o=new n(t,"base64");r=o.toString("utf8")}return r},m.prototype.encodeBase64=function(t){var r;if("undefined"==typeof n)r=e.btoa?e.btoa(t):h.encode(t);else{var o=new n(t,"utf8");r=o.toString("base64")}return r},m.prototype._extractAuthTokenData=function(t){var e=(t||"").split("."),r=e[1];if(null!=r){var n=r;try{return n=this.decodeBase64(n),JSON.parse(n)}catch(o){return n}}return null},m.prototype.getAuthToken=function(){return this.authToken},m.prototype.getSignedAuthToken=function(){return this.signedAuthToken},m.prototype.authenticate=function(t,e){var r=this;this._changeToPendingAuthState(),this.emit("#authenticate",t,function(n,o){o&&o.authError&&(o.authError=p.hydrateError(o.authError)),n?(r._changeToUnauthenticatedState(),e&&e(n,o)):r.auth.saveToken(r.options.authTokenName,t,{},function(n){e&&e(n,o),n?(r._changeToUnauthenticatedState(),r._onSCError(n)):o.isAuthenticated?r._changeToAuthenticatedState(t):r._changeToUnauthenticatedState()})})},m.prototype._tryReconnect=function(t){var e,r=this,n=this.connectAttempts++,o=this.options.autoReconnectOptions;if(null==t||n>0){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)},m.prototype._onSCOpen=function(t){var e=this;t?(this.id=t.id,this.pingTimeout=t.pingTimeout,this.transport.pingTimeout=this.pingTimeout,t.isAuthenticated?this._changeToAuthenticatedState(t.authToken):this._changeToUnauthenticatedState()):this._changeToUnauthenticatedState(),this.connectAttempts=0,this.options.autoProcessSubscriptions?this.processPendingSubscriptions():this.pendingConnectCallback=!0,o.prototype.emit.call(this,"connect",t,function(){e.processPendingSubscriptions()}),this._flushEmitBuffer()},m.prototype._onSCError=function(t){var e=this;setTimeout(function(){if(e.listeners("error").length<1)throw t;o.prototype.emit.call(e,"error",t)},0)},m.prototype._suspendSubscriptions=function(){var t,e;for(var r in this._channels)this._channels.hasOwnProperty(r)&&(t=this._channels[r],e=t.state==t.SUBSCRIBED||t.state==t.PENDING?t.PENDING:t.UNSUBSCRIBED,this._triggerChannelUnsubscribe(t,e))},m.prototype._onSCClose=function(t,e,r){var n=this;if(this.id=null,this.transport&&this.transport.off(),this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this._changeToPendingAuthState(),this._suspendSubscriptions(),this.options.autoReconnect&&(4e3==t||4001==t||1005==t?this._tryReconnect(0):1e3!=t&&4500>t&&this._tryReconnect()),r?o.prototype.emit.call(n,"connectAbort",t,e):o.prototype.emit.call(n,"disconnect",t,e),!m.ignoreStatuses[t]){var i;i=e?"Socket connection failed: "+e:"Socket connection failed for unknown reasons";var a=new d(m.errorStatuses[t]||i,t);this._onSCError(a)}},m.prototype._onSCEvent=function(t,e,r){var n=this._privateEventHandlerMap[t];n?n.call(this,e,r):o.prototype.emit.call(this,t,e,function(){r&&r.callback.apply(r,arguments)})},m.prototype.parse=function(t){return this.transport.parse(t)},m.prototype.stringify=function(t){return this.transport.stringify(t)},m.prototype._flushEmitBuffer=function(){for(var t,e=this._emitBuffer.head;e;){t=e.next;var r=e.data;e.detach(),this.transport.emitRaw(r),e=t}},m.prototype._handleEventAckTimeout=function(t,e){e&&e.detach();var r=new g("Event response for '"+t.event+"' timed out"),n=t.callback;n&&(delete t.callback,n.call(t,r,t))},m.prototype._emit=function(t,e,r){var n=this;this.state==this.CLOSED&&this.connect();var o={event:t,data:e,callback:r},i=new u.Item;i.data=o,o.timeout=setTimeout(function(){n._handleEventAckTimeout(o,i)},this.ackTimeout),this._emitBuffer.append(i),this.state==this.OPEN&&this._flushEmitBuffer()},m.prototype.send=function(t){this.transport.send(t)},m.prototype.emit=function(t,e,r){null==this._localEvents[t]?this._emit(t,e,r):o.prototype.emit.call(this,t,e)},m.prototype.publish=function(t,e,r){var n={channel:this._decorateChannelName(t),data:e};this.emit("#publish",n,r)},m.prototype._triggerChannelSubscribe=function(t,e){var r=t.name;if(t.state!=t.SUBSCRIBED){var n=t.state;t.state=t.SUBSCRIBED;var i={channel:r,oldState:n,newState:t.state,subscriptionOptions:e};t.emit("subscribeStateChange",i),t.emit("subscribe",r,e),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"subscribe",r,e)}},m.prototype._triggerChannelSubscribeFail=function(t,e,r){var n=e.name,i=!e.waitForAuth||this.authState==this.AUTHENTICATED;e.state!=e.UNSUBSCRIBED&&i&&(e.state=e.UNSUBSCRIBED,e.emit("subscribeFail",t,n,r),o.prototype.emit.call(this,"subscribeFail",t,n,r))},m.prototype._cancelPendingSubscribeCallback=function(t){null!=t._pendingSubscriptionCid&&(this.transport.cancelPendingResponse(t._pendingSubscriptionCid),delete t._pendingSubscriptionCid)},m.prototype._decorateChannelName=function(t){return this.channelPrefix&&(t=this.channelPrefix+t),t},m.prototype._undecorateChannelName=function(t){return this.channelPrefix&&0==t.indexOf(this.channelPrefix)?t.replace(this.channelPrefix,""):t},m.prototype._trySubscribe=function(t){var e=this,r=!t.waitForAuth||this.authState==this.AUTHENTICATED;if(this.state==this.OPEN&&!this.pendingConnectCallback&&null==t._pendingSubscriptionCid&&r){var n={noTimeout:!0},i={channel:this._decorateChannelName(t.name)};t.waitForAuth&&(n.waitForAuth=!0,i.waitForAuth=n.waitForAuth),t.data&&(i.data=t.data),t._pendingSubscriptionCid=this.transport.emit("#subscribe",i,n,function(r){delete t._pendingSubscriptionCid,r?e._triggerChannelSubscribeFail(r,t,i):e._triggerChannelSubscribe(t,i)}),o.prototype.emit.call(this,"subscribeRequest",t.name,i)}},m.prototype.subscribe=function(t,e){var r=this._channels[t];return r?e&&r.setOptions(e):(r=new i(t,this,e),this._channels[t]=r),r.state==r.UNSUBSCRIBED&&(r.state=r.PENDING,this._trySubscribe(r)),r},m.prototype._triggerChannelUnsubscribe=function(t,e){var r=t.name,n=t.state;if(e?t.state=e:t.state=t.UNSUBSCRIBED,this._cancelPendingSubscribeCallback(t),n==t.SUBSCRIBED){var i={channel:r,oldState:n,newState:t.state};t.emit("subscribeStateChange",i),t.emit("unsubscribe",r),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"unsubscribe",r)}},m.prototype._tryUnsubscribe=function(t){if(this.state==this.OPEN){var e={noTimeout:!0};this._cancelPendingSubscribeCallback(t);var r=this._decorateChannelName(t.name);this.transport.emit("#unsubscribe",r,e)}},m.prototype.unsubscribe=function(t){var e=this._channels[t];e&&e.state!=e.UNSUBSCRIBED&&(this._triggerChannelUnsubscribe(e),this._tryUnsubscribe(e))},m.prototype.channel=function(t,e){var r=this._channels[t];return r||(r=new i(t,this,e),this._channels[t]=r),r},m.prototype.destroyChannel=function(t){var e=this._channels[t];e.unwatch(),e.unsubscribe(),delete this._channels[t]},m.prototype.subscriptions=function(t){var e,r,n=[];for(var o in this._channels)this._channels.hasOwnProperty(o)&&(e=this._channels[o],r=t?e&&(e.state==e.SUBSCRIBED||e.state==e.PENDING):e&&e.state==e.SUBSCRIBED,r&&n.push(o));return n},m.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},m.prototype.processPendingSubscriptions=function(){var t=this;this.pendingConnectCallback=!1;for(var e in this._channels)this._channels.hasOwnProperty(e)&&!function(e){e.state==e.PENDING&&t._trySubscribe(e)}(this._channels[e])},m.prototype.watch=function(t,e){if("function"!=typeof e)throw new l("No handler function was provided");this._channelEmitter.on(t,e)},m.prototype.unwatch=function(t,e){e?this._channelEmitter.removeListener(t,e):this._channelEmitter.removeAllListeners(t)},m.prototype.watchers=function(t){return this._channelEmitter.listeners(t)},t.exports=m}).call(e,function(){return this}(),r(7).Buffer)},function(t,e,r){(function(t,n){/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> * @license MIT */ "use strict";function o(){function t(){}try{var e=new Uint8Array(1);return e.foo=function(){return 42},e.constructor=t,42===e.foo()&&e.constructor===t&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(r){return!1}}function i(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function t(e){return this instanceof t?(t.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof e?a(this,e):"string"==typeof e?s(this,e,arguments.length>1?arguments[1]:"utf8"):c(this,e)):arguments.length>1?new t(e,arguments[1]):new t(e)}function a(e,r){if(e=g(e,0>r?0:0|y(r)),!t.TYPED_ARRAY_SUPPORT)for(var n=0;r>n;n++)e[n]=0;return e}function s(t,e,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|E(e,r);return t=g(t,n),t.write(e,r),t}function c(e,r){if(t.isBuffer(r))return u(e,r);if(W(r))return h(e,r);if(null==r)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(r.buffer instanceof ArrayBuffer)return p(e,r);if(r instanceof ArrayBuffer)return l(e,r)}return r.length?f(e,r):d(e,r)}function u(t,e){var r=0|y(e.length);return t=g(t,r),e.copy(t,0,0,r),t}function h(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function p(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function l(e,r){return t.TYPED_ARRAY_SUPPORT?(r.byteLength,e=t._augment(new Uint8Array(r))):e=p(e,new Uint8Array(r)),e}function f(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function d(t,e){var r,n=0;"Buffer"===e.type&&W(e.data)&&(r=e.data,n=0|y(r.length)),t=g(t,n);for(var o=0;n>o;o+=1)t[o]=255&r[o];return t}function g(e,r){t.TYPED_ARRAY_SUPPORT?(e=t._augment(new Uint8Array(r)),e.__proto__=t.prototype):(e.length=r,e._isBuffer=!0);var n=0!==r&&r<=t.poolSize>>>1;return n&&(e.parent=Z),e}function y(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function m(e,r){if(!(this instanceof m))return new m(e,r);var n=new t(e,r);return delete n.parent,n}function E(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function v(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return R(this,e,r);case"binary":return O(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var i=e.length;if(i%2!==0)throw new Error("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;n>a;a++){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");t[r+a]=s}return a}function S(t,e,r,n){return z(G(e,t.length-r),t,r,n)}function w(t,e,r,n){return z(q(e),t,r,n)}function T(t,e,r,n){return w(t,e,r,n)}function _(t,e,r,n){return z(H(e),t,r,n)}function k(t,e,r,n){return z(J(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?X.fromByteArray(t):X.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;r>o;){var i=t[o],a=null,s=i>239?4:i>223?3:i>191?2:1;if(r>=o+s){var c,u,h,p;switch(s){case 1:128>i&&(a=i);break;case 2:c=t[o+1],128===(192&c)&&(p=(31&i)<<6|63&c,p>127&&(a=p));break;case 3:c=t[o+1],u=t[o+2],128===(192&c)&&128===(192&u)&&(p=(15&i)<<12|(63&c)<<6|63&u,p>2047&&(55296>p||p>57343)&&(a=p));break;case 4:c=t[o+1],u=t[o+2],h=t[o+3],128===(192&c)&&128===(192&u)&&128===(192&h)&&(p=(15&i)<<18|(63&c)<<12|(63&u)<<6|63&h,p>65535&&1114112>p&&(a=p))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),o+=s}return I(n)}function I(t){var e=t.length;if(K>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=K));return r}function R(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;r>o;o++)n+=String.fromCharCode(127&t[o]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;r>o;o++)n+=String.fromCharCode(t[o]);return n}function P(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var o="",i=e;r>i;i++)o+=$(t[i]);return o}function N(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 B(t,e,r){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function U(e,r,n,o,i,a){if(!t.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(r>i||a>r)throw new RangeError("value is out of bounds");if(n+o>e.length)throw new RangeError("index out of range")}function x(t,e,r,n){0>e&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);i>o;o++)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function D(t,e,r,n){0>e&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);i>o;o++)t[r+o]=e>>>8*(n?o:3-o)&255}function L(t,e,r,n,o,i){if(e>o||i>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function j(t,e,r,n,o){return o||L(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),V.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,o){return o||L(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),V.write(t,e,r,n,52,8),r+8}function Y(t){if(t=F(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function F(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function $(t){return 16>t?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],a=0;n>a;a++){if(r=t.charCodeAt(a),r>55295&&57344>r){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(56320>r){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,128>r){if((e-=1)<0)break;i.push(r)}else if(2048>r){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))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 q(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e}function J(t,e){for(var r,n,o,i=[],a=0;a<t.length&&!((e-=2)<0);a++)r=t.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function H(t){return X.toByteArray(Y(t))}function z(t,e,r,n){for(var o=0;n>o&&!(o+r>=e.length||o>=t.length);o++)e[o+r]=t[o];return o}var X=r(31),V=r(32),W=r(33);e.Buffer=t,e.SlowBuffer=m,e.INSPECT_MAX_BYTES=50,t.poolSize=8192;var Z={};t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:o(),t.TYPED_ARRAY_SUPPORT?(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array):(t.prototype.length=void 0,t.prototype.parent=void 0),t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,o=r.length,i=0,a=Math.min(n,o);a>i&&e[i]===r[i];)++i;return i!==a&&(n=e[i],o=r[i]),o>n?-1:n>o?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,r){if(!W(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new t(0);var n;if(void 0===r)for(r=0,n=0;n<e.length;n++)r+=e[n].length;var o=new t(r),i=0;for(n=0;n<e.length;n++){var a=e[n];a.copy(o,i),i+=a.length}return o},t.byteLength=E,t.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?C(this,0,t):v.apply(this,arguments)},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===t.compare(this,e)},t.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},t.prototype.compare=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:t.compare(this,e)},t.prototype.indexOf=function(e,r){function n(t,e,r){for(var n=-1,o=0;r+o<t.length;o++)if(t[r+o]===e[-1===n?0:o-n]){if(-1===n&&(n=o),o-n+1===e.length)return r+n}else n=-1;return-1}if(r>2147483647?r=2147483647:-2147483648>r&&(r=-2147483648),r>>=0,0===this.length)return-1;if(r>=this.length)return-1;if(0>r&&(r=Math.max(this.length+r,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,r);if(t.isBuffer(e))return n(this,e,r);if("number"==typeof e)return t.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,r):n(this,[e],r);throw new TypeError("val must be string, number or Buffer")},t.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},t.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},t.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))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var o=n;n=e,e=0|r,r=o}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return S(this,t,e,r);case"ascii":return w(this,t,e,r);case"binary":return T(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var K=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),e>r&&(r=e);var o;if(t.TYPED_ARRAY_SUPPORT)o=t._augment(this.subarray(e,r));else{var i=r-e;o=new t(i,void 0);for(var a=0;i>a;a++)o[a]=this[a+e]}return o.length&&(o.parent=this.parent||this),o},t.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||B(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},t.prototype.readUIntBE=function(t,e,r){t=0|t,e=0|e,r||B(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},t.prototype.readUInt8=function(t,e){return e||B(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||B(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||B(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||B(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>=o&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||B(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},t.prototype.readInt8=function(t,e){return e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},t.prototype.readInt16LE=function(t,e){e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||B(t,4,this.length),V.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||B(t,4,this.length),V.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||B(t,8,this.length),V.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||B(t,8,this.length),V.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||U(this,t,e,r,Math.pow(2,8*r),0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},t.prototype.writeUIntBE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||U(this,t,e,r,Math.pow(2,8*r),0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):x(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):x(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):D(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):D(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var o=Math.pow(2,8*r-1);U(this,t,e,r,o-1,-o)}var i=0,a=1,s=0>t?1:0;for(this[e]=255&t;++i<r&&(a*=256);)this[e+i]=(t/a>>0)-s&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var o=Math.pow(2,8*r-1);U(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0>t?1:0;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=(t/a>>0)-s&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):x(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):x(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):D(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r=0|r,n||U(this,e,r,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):D(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},t.prototype.copy=function(e,r,n,o){if(n||(n=0),o||0===o||(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&n>o&&(o=n),o===n)return 0;if(0===e.length||0===this.length)return 0;if(0>r)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>o)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);var i,a=o-n;if(this===e&&r>n&&o>r)for(i=a-1;i>=0;i--)e[i+r]=this[i+n];else if(1e3>a||!t.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)e[i+r]=this[i+n];else e._set(this.subarray(n,n+a),r);return a},t.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var o=G(t.toString()),i=o.length;for(n=e;r>n;n++)this[n]=o[n%i]}return this}},t.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(t.TYPED_ARRAY_SUPPORT)return new t(this).buffer;for(var e=new Uint8Array(this.length),r=0,n=e.length;n>r;r+=1)e[r]=this[r];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Q=t.prototype;t._augment=function(e){return e.constructor=t,e._isBuffer=!0,e._set=e.set,e.get=Q.get,e.set=Q.set,e.write=Q.write,e.toString=Q.toString,e.toLocaleString=Q.toString,e.toJSON=Q.toJSON,e.equals=Q.equals,e.compare=Q.compare,e.indexOf=Q.indexOf,e.copy=Q.copy,e.slice=Q.slice,e.readUIntLE=Q.readUIntLE,e.readUIntBE=Q.readUIntBE,e.readUInt8=Q.readUInt8,e.readUInt16LE=Q.readUInt16LE,e.readUInt16BE=Q.readUInt16BE,e.readUInt32LE=Q.readUInt32LE,e.readUInt32BE=Q.readUInt32BE,e.readIntLE=Q.readIntLE,e.readIntBE=Q.readIntBE,e.readInt8=Q.readInt8,e.readInt16LE=Q.readInt16LE,e.readInt16BE=Q.readInt16BE,e.readInt32LE=Q.readInt32LE,e.readInt32BE=Q.readInt32BE,e.readFloatLE=Q.readFloatLE,e.readFloatBE=Q.readFloatBE,e.readDoubleLE=Q.readDoubleLE,e.readDoubleBE=Q.readDoubleBE,e.writeUInt8=Q.writeUInt8,e.writeUIntLE=Q.writeUIntLE,e.writeUIntBE=Q.writeUIntBE,e.writeUInt16LE=Q.writeUInt16LE,e.writeUInt16BE=Q.writeUInt16BE,e.writeUInt32LE=Q.writeUInt32LE,e.writeUInt32BE=Q.writeUInt32BE,e.writeIntLE=Q.writeIntLE,e.writeIntBE=Q.writeIntBE,e.writeInt8=Q.writeInt8,e.writeInt16LE=Q.writeInt16LE,e.writeInt16BE=Q.writeInt16BE,e.writeInt32LE=Q.writeInt32LE,e.writeInt32BE=Q.writeInt32BE,e.writeFloatLE=Q.writeFloatLE,e.writeFloatBE=Q.writeFloatBE,e.writeDoubleLE=Q.writeDoubleLE,e.writeDoubleBE=Q.writeDoubleBE,e.fill=Q.fill,e.inspect=Q.inspect,e.toArrayBuffer=Q.toArrayBuffer,e};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,r(7).Buffer,function(){return this}())},function(t,e){"use strict";e.__esModule=!0;e.defaultSocketOptions={secure:!0,hostname:"remotedev.io",port:443,autoReconnect:!0,autoReconnectOptions:{randomness:6e4}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){return t&&t.state?"string"==typeof t.state?(0,d.parse)(t.state):t.state:void 0}function i(){return Math.random().toString(36).substr(2)}function a(t){t.payload||(t.payload=t.action),Object.keys(w).forEach(function(e){t.instanceId&&e!==t.instanceId||("function"==typeof w[e]?w[e](t):w[e].forEach(function(e){e(t)}))})}function s(){S||b.emit("login","master",function(t,e){return t?void console.log(t):(S=b.subscribe(e),S.watch(a),void b.on(e,a))})}function c(t){if(!b){var e=void 0;e=t.port?{port:t.port,hostname:(0,E.default)(t.hostname||"localhost"),secure:!!t.secure}:v.defaultSocketOptions,b=y.default.create(e),s()}}function u(t){t&&t.port&&!t.hostname&&(t.hostname="localhost"),c(t)}function h(t,e){if(t.action)return t;var r={timestamp:Date.now()};return t?e.getActionType?r.action=e.getActionType(t):"string"==typeof t?r.action={type:t}:t.type?r.action=t:r.action={type:"update"}:r.action={type:t},r}function p(t,e,r,n,o){u(r),setTimeout(function(){var i={payload:e?(0,d.stringify)(e):"",action:"ACTION"===n?(0,d.stringify)(h(t,r)):t,type:n||"ACTION",id:b.id,instanceId:o,name:r.name};b.emit(b.id?"log":"log-noid",i)},0)}function l(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=i(t.instanceId);return u(t),{init:function(r,n){p(n||{},r,t,"INIT",e)},subscribe:function(t){return t?(w[e]||(w[e]=[]),w[e].push(t),function(){var r=w[e].indexOf(t);w[e].splice(r,1)}):void 0},unsubscribe:function(){delete w[e]},send:function(r,n){r?p(r,n,t,"ACTION",e):p(void 0,n,t,"STATE",e)},error:function(t){b.emit({type:"ERROR",payload:t,id:b.id,instanceId:e})}}}function f(t){return t&&t.remote||"undefined"==typeof window||!window.__REDUX_DEVTOOLS_EXTENSION__?l(t):window.__REDUX_DEVTOOLS_EXTENSION__.connect(t)}e.__esModule=!0,e.send=void 0,e.extractState=o,e.generateId=i,e.start=u,e.connect=l,e.connectViaExtension=f;var d=r(13),g=r(25),y=n(g),m=r(21),E=n(m),v=r(8),b=void 0,S=void 0,w={};e.send=p,e.default={connect:l,connectViaExtension:f,send:p,extractState:o,generateId:i}},function(t,e,r){var n;(function(t,o){!function(i){var a="object"==typeof e&&e,s=("object"==typeof t&&t&&t.exports==a&&t,"object"==typeof o&&o);(s.global===s||s.window===s)&&(i=s);var c=function(t){this.message=t};c.prototype=new Error,c.prototype.name="InvalidCharacterError";var u=function(t){throw new c(t)},h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=/[\t\n\f\r ]/g,l=function(t){t=String(t).replace(p,"");var e=t.length;e%4==0&&(t=t.replace(/==?$/,""),e=t.length),(e%4==1||/[^+a-zA-Z0-9\/]/.test(t))&&u("Invalid character: the string to be decoded is not correctly encoded.");for(var r,n,o=0,i="",a=-1;++a<e;)n=h.indexOf(t.charAt(a)),r=o%4?64*r+n:n,o++%4&&(i+=String.fromCharCode(255&r>>(-2*o&6)));return i},f=function(t){t=String(t),/[^\0-\xFF]/.test(t)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var e,r,n,o,i=t.length%3,a="",s=-1,c=t.length-i;++s<c;)e=t.charCodeAt(s)<<16,r=t.charCodeAt(++s)<<8,n=t.charCodeAt(++s),o=e+r+n,a+=h.charAt(o>>18&63)+h.charAt(o>>12&63)+h.charAt(o>>6&63)+h.charAt(63&o);return 2==i?(e=t.charCodeAt(s)<<8,r=t.charCodeAt(++s),o=e+r,a+=h.charAt(o>>10)+h.charAt(o>>4&63)+h.charAt(o<<2&63)+"="):1==i&&(o=t.charCodeAt(s),a+=h.charAt(o>>2)+h.charAt(o<<4&63)+"=="),a},d={encode:f,decode:l,version:"0.1.0"};n=function(){return d}.call(e,r,e,t),!(void 0!==n&&(t.exports=n))}(this)}).call(e,r(30)(t),function(){return this}())},function(t,e){function r(t){return t?n(t):void 0}function n(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.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=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.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){r=r.slice(0);for(var n=0,o=r.length;o>n;++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}},function(module,exports){var cycle=exports;cycle.decycle=function(t){"use strict";var e=[],r=[];return function n(t,o){var i,a,s;if(!("object"!=typeof t||null===t||t instanceof Boolean||t instanceof Date||t instanceof Number||t instanceof RegExp||t instanceof String)){for(i=0;i<e.length;i+=1)if(e[i]===t)return{$ref:r[i]};if(e.push(t),r.push(o),"[object Array]"===Object.prototype.toString.apply(t))for(s=[],i=0;i<t.length;i+=1)s[i]=n(t[i],o+"["+i+"]");else{s={};for(a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=n(t[a],o+"["+JSON.stringify(a)+"]"))}return s}return t}(t,"$")},cycle.retrocycle=function retrocycle($){"use strict";var px=/^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/;return function rez(value){var i,item,name,path;if(value&&"object"==typeof value)if("[object Array]"===Object.prototype.toString.apply(value))for(i=0;i<value.length;i+=1)item=value[i],item&&"object"==typeof item&&(path=item.$ref,"string"==typeof path&&px.test(path)?value[i]=eval(path):rez(item));else for(name in value)"object"==typeof value[name]&&(item=value[name],item&&(path=item.$ref,"string"==typeof path&&px.test(path)?value[name]=eval(path):rez(item)))}($),$}},function(t,e,r){t.exports=r(15)},function(t,e,r){var n=(r(3),r(16));e.decycle=function(t,e,r){"use strict";var o=[],i=[];return function a(t,s,c){var u,h,p,l=r?r(c||"",t):t;if(e.date&&l instanceof Date)return{$jsan:"d"+l.getTime()};if(e.regex&&l instanceof RegExp)return{$jsan:"r"+n.getRegexFlags(l)+","+l.source};if(e.function&&"function"==typeof l)return{$jsan:"f"+n.stringifyFunction(l,e.function)};if(e.undefined&&void 0===l)return{$jsan:"u"};if(e.error&&l instanceof Error)return{$jsan:"e"+l.message};if(l&&"function"==typeof l.toJSON&&(l=l.toJSON()),!("object"!=typeof l||null===l||l instanceof Boolean||l instanceof Date||l instanceof Number||l instanceof RegExp||l instanceof String||l instanceof Error)){for(u=0;u<o.length;u+=1)if(o[u]===l)return{$jsan:i[u]};if(o.push(l),i.push(s),"[object Array]"===Object.prototype.toString.apply(l))for(p=[],u=0;u<l.length;u+=1)p[u]=a(l[u],s+"["+u+"]",u);else{p={};for(h in l)if(Object.prototype.hasOwnProperty.call(l,h)){var f=/^\w+$/.test(h)?"."+h:"["+JSON.stringify(h)+"]";p[h]="$jsan"===h?[a(l[h],s+f)]:a(l[h],s+f,h)}}return p}return l}(t,"$")},e.retrocycle=function(t){"use strict";return function e(r){var o,i,a;if(r&&"object"==typeof r)if("[object Array]"===Object.prototype.toString.apply(r))for(o=0;o<r.length;o+=1)i=r[o],i&&"object"==typeof i&&(i.$jsan?r[o]=n.restore(i.$jsan,t):e(i));else for(a in r)"$jsan"===a&&(r[a]=r[a][0]),"object"==typeof r[a]&&(i=r[a],i&&"object"==typeof i&&(i.$jsan?r[a]=n.restore(i.$jsan,t):e(i)))}(t),t}},function(t,e,r){var n=r(14);e.stringify=function(t,e,r,o){if(arguments.length<4)try{return 1===arguments.length?JSON.stringify(t):JSON.stringify.apply(JSON,arguments)}catch(i){}var a=o||!1;"boolean"==typeof a&&(a={date:a,"function":a,regex:a,undefined:a,error:a});var s=n.decycle(t,a,e);return 1===arguments.length?JSON.stringify(s):JSON.stringify(s,e,r)},e.parse=function(t,e){var r,o=/"\$jsan"/.test(t);return r=1===arguments.length?JSON.parse(t):JSON.parse(t,e),o&&(r=n.retrocycle(r)),r}},function(t,e,r){var n=r(3);e.getRegexFlags=function(t){var e="";return t.ignoreCase&&(e+="i"),t.global&&(e+="g"),t.multiline&&(e+="m"),e},e.stringifyFunction=function(t,e){if("function"==typeof e)return e(t);var r=t.toString(),n=r.match(/^[^{]*{|^[^=]*=>/),o=n?n[0]:"<function> ",i="}"===r[r.length-1]?"}":"";return o.replace(/\r\n|\n/g," ").replace(/\s+/g," ")+" /* ... */ "+i},e.restore=function(t,e){var r=t[0],o=t.slice(1);switch(r){case"$":return n(e,t);case"r":var i=o.indexOf(","),a=o.slice(0,i),s=o.slice(i+1);return RegExp(s,a);case"d":return new Date(+o);case"f":var c=function(){throw new Error("can't run jsan parsed function")};return c.toString=function(){return o},c;case"u":return;case"e":var u=new Error(o);return u.stack="Stack is unavailable for jsan parsed errors",u;default:return console.warn("unknown type",t),t}}},function(t,e){"use strict";function r(){return arguments.length?r.from(arguments):void 0}function n(){}var o;o="An argument without append, prepend, or detach methods was given to `List";var i;i=r.prototype,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;)n=t[r],null!==n&&void 0!==n&&o.append(n);return o},i.head=null,i.tail=null,i.toArray=function(){for(var t=this.head,e=[];t;)e.push(t),t=t.next;return e},i.prepend=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(o+"#prepend`.");var e,r;return e=this,(r=e.head)?r.prepend(t):(t.detach(),t.list=e,e.head=t,t)},i.append=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(o+"#append`.");var e,r,n;return e=this,(n=e.tail)?n.append(t):(r=e.head)?r.append(t):(t.detach(),t.list=e,e.head=t,t)},r.Item=n;var a=n.prototype;a.next=null,a.prev=null,a.list=null,a.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):t},a.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,n.next=t),t.next=e,t.list=r,e.prev=t,e===r.head&&(r.head=t),r.tail||(r.tail=e),t):!1},a.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&