Skip to content

Instantly share code, notes, and snippets.

@utkarshkukreti
Created March 24, 2018 08:50
Show Gist options
  • Save utkarshkukreti/0a2d5ca577df88b66f4227c8b5eeb20e to your computer and use it in GitHub Desktop.
Save utkarshkukreti/0a2d5ca577df88b66f4227c8b5eeb20e to your computer and use it in GitHub Desktop.
var ElmRemoteDev=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=36)}([function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){var n=r(24),o=function(){return!this}();function i(t,e){this.name="AuthTokenExpiredError",this.message=t,this.expiry=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function s(t){this.name="AuthTokenInvalidError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function a(t,e){this.name="AuthTokenNotBeforeError",this.message=t,this.date=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function c(t){this.name="AuthTokenError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function u(t,e){this.name="SilentMiddlewareBlockedError",this.message=t,this.type=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function h(t){this.name="InvalidActionError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function p(t){this.name="InvalidArgumentsError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function f(t){this.name="InvalidOptionsError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function l(t){this.name="InvalidMessageError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function d(t,e){this.name="SocketProtocolError",this.message=t,this.code=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function y(t){this.name="ServerProtocolError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function g(t){this.name="HTTPServerError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function m(t){this.name="ResourceLimitError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function v(t){this.name="TimeoutError",this.message=t,Error.captureStackTrace&&!o?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&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function E(t){this.name="BrokerError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function S(t,e){this.name="ProcessExitError",this.message=t,this.code=e,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function w(t){this.name="UnknownError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}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),f.prototype=Object.create(Error.prototype),l.prototype=Object.create(Error.prototype),d.prototype=Object.create(Error.prototype),y.prototype=Object.create(Error.prototype),g.prototype=Object.create(Error.prototype),m.prototype=Object.create(Error.prototype),v.prototype=Object.create(Error.prototype),b.prototype=Object.create(Error.prototype),E.prototype=Object.create(Error.prototype),S.prototype=Object.create(Error.prototype),w.prototype=Object.create(Error.prototype),t.exports={AuthTokenExpiredError:i,AuthTokenInvalidError:s,AuthTokenNotBeforeError:a,AuthTokenError:c,SilentMiddlewareBlockedError:u,InvalidActionError:h,InvalidArgumentsError:p,InvalidOptionsError:f,InvalidMessageError:l,SocketProtocolError:d,ServerProtocolError:y,HTTPServerError:g,ResourceLimitError:m,TimeoutError:v,BadConnectionError:b,BrokerError:E,ProcessExitError:S,UnknownError:w},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",4000:"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={1000:"Socket closed normally",1001:"Socket hung up"};var T={domain:1,domainEmitter:1,domainThrown:1};t.exports.dehydrateError=function(t,e){var r;if(t&&"object"==typeof t)for(var o in r={message:t.message},e&&(r.stack=t.stack),t)T[o]||(r[o]=t[o]);else r="function"==typeof t?"[function "+(t.name||"anonymous")+"]":t;return n(r)},t.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},t.exports.decycle=n},function(t,e,r){var n=r(27);Object.create||(Object.create=r(26));var o=function(){n.call(this)};(o.prototype=Object.create(n.prototype)).emit=function(t){if("error"==t){var e=["__domainError"];if(void 0!==arguments[1]&&e.push(arguments[1]),n.prototype.emit.apply(this,e),this.domain){var r=arguments[1];r||(r=new Error('Uncaught, unspecified "error" event.')),r.domainEmitter=this,r.domain=this.domain,r.domainThrown=!1,this.domain.emit("error",r)}}n.prototype.emit.apply(this,arguments)},t.exports.SCEmitter=o},function(t,e,r){"use strict";e.decode=e.parse=r(20),e.encode=e.stringify=r(19)},function(t,e,r){var n=r(1),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.encode(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){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <[email protected]> <http://feross.org>
* @license MIT
*/
var n=r(30),o=r(29),i=r(28);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return p(this,t)}return u(this,t,e,r)}function u(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=f(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!c.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=a(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(c.isBuffer(e)){var r=0|l(e.length);return 0===(t=a(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):f(t,e);if("Buffer"===e.type&&i(e.data))return f(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function p(t,e){if(h(e),t=a(t,e<0?0:0|l(e)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|l(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function l(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(n)return Y(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(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=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(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;s=2,a/=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(r+c>a&&(r=a-c),i=r;i>=0;i--){for(var p=!0,f=0;f<c;f++)if(u(t,i+f)!==u(e,f)){p=!1;break}if(p)return i}return-1}function v(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function b(t,e,r,n){return F(Y(e,t.length-r),t,r,n)}function E(t,e,r,n){return F(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function S(t,e,r,n){return E(t,e,r,n)}function w(t,e,r,n){return F($(e),t,r,n)}function T(t,e,r,n){return F(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}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function k(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=u>239?4:u>223?3:u>191?2:1;if(o+p<=r)switch(p){case 1:u<128&&(h=u);break;case 2:128==(192&(i=t[o+1]))&&(c=(31&u)<<6|63&i)>127&&(h=c);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(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)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(h=c)}null===h?(h=65533,p=1):h>65535&&(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<=A)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=A));return r}(n)}e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,r){return u(null,t,e,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},c.allocUnsafe=function(t){return p(null,t)},c.allocUnsafeSlow=function(t){return p(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");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},c.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}},c.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=c.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},c.byteLength=d,c.prototype._isBuffer=!0,c.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)y(this,e,e+1);return this},c.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)y(this,e,e+3),y(this,e+1,e+2);return this},c.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)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?k(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 R(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.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+">"},c.prototype.compare=function(t,e,r,n,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");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(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,s=r-e,a=Math.min(i,s),u=this.slice(n,o),h=t.slice(e,r),p=0;p<a;++p)if(u[p]!==h[p]){i=u[p],s=h[p];break}return i<s?-1:s<i?1:0},c.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},c.prototype.indexOf=function(t,e,r){return g(this,t,e,r,!0)},c.prototype.lastIndexOf=function(t,e,r){return g(this,t,e,r,!1)},c.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||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return w(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function C(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 O(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 R(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=L(t[i]);return o}function P(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 N(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,r,n,o,i){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function B(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function x(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function j(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(t,e,r,n,i){return i||j(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return i||j(t,0,r,8),o.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=c.prototype;else{var o=e-t;r=new c(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},c.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},c.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},c.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},c.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(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},c.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,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},c.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):x(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);I(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},c.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);I(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):x(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");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,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},c.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),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}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=c.isBuffer(t)?t:Y(new c(t,n).toString()),a=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&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 $(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(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}}).call(this,r(0))},function(t,e,r){(function(e,n){var o=r(2).SCEmitter,i=r(25).SCChannel,s=(r(4).Response,r(23).AuthEngine),a=r(22),c=r(21).SCTransport,u=r(3),h=r(17),p=r(15),f=r(13),l=r(1),d=l.InvalidArgumentsError,y=l.InvalidMessageError,g=l.SocketProtocolError,m=l.TimeoutError,v="undefined"!=typeof window,b=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.disconnectOnUnload=null==t.disconnectOnUnload||t.disconnectOnUnload,this.pingTimeout=this.ackTimeout;var n=Math.pow(2,31)-1,i=function(t){if(r[t]>n)throw new d("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 h,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 c=this.options.autoReconnectOptions;null==c.initialDelay&&(c.initialDelay=1e4),null==c.randomness&&(c.randomness=1e4),null==c.multiplier&&(c.multiplier=1.5),null==c.maxDelay&&(c.maxDelay=6e4)}if(null==this.options.subscriptionRetryOptions&&(this.options.subscriptionRetryOptions={}),this.options.authEngine?this.auth=this.options.authEngine:this.auth=new s,this.options.codecEngine?this.codec=this.options.codecEngine:this.codec=a,this.options.path=this.options.path.replace(/\/$/,"")+"/",this.options.query=t.query||{},"string"==typeof this.options.query&&(this.options.query=u.parse(this.options.query)),this.options.autoConnect&&this.connect(),this._channelEmitter=new o,v&&this.disconnectOnUnload){var p=function(){r.disconnect()};e.attachEvent?e.attachEvent("onunload",p):e.addEventListener&&e.addEventListener("beforeunload",p,!1)}};b.prototype=Object.create(o.prototype),b.CONNECTING=b.prototype.CONNECTING=c.prototype.CONNECTING,b.OPEN=b.prototype.OPEN=c.prototype.OPEN,b.CLOSED=b.prototype.CLOSED=c.prototype.CLOSED,b.AUTHENTICATED=b.prototype.AUTHENTICATED="authenticated",b.UNAUTHENTICATED=b.prototype.UNAUTHENTICATED="unauthenticated",b.PENDING=b.prototype.PENDING="pending",b.ignoreStatuses=l.socketProtocolIgnoreStatuses,b.errorStatuses=l.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&&(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){this.auth.saveToken(this.options.authTokenName,t.token,{},function(n){n?(e.error(n),r._onSCError(n)):(r._changeToAuthenticatedState(t.token),e.end())})}else e.error(new y("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)}},b.prototype._callIdGenerator=function(){return this._cid++},b.prototype.getState=function(){return this.state},b.prototype.getBytesReceived=function(){return this.transport.getBytesReceived()},b.prototype.deauthenticate=function(t){var e=this;this.auth.removeToken(this.options.authTokenName,function(r,n){r?e._onSCError(r):(e.emit("#removeAuthToken"),o.prototype.emit.call(e,"removeAuthToken",n),e._changeToUnauthenticatedState()),t&&t(r)})},b.prototype.connect=b.prototype.open=function(){var t=this;this.state==this.CLOSED&&(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this.state=this.CONNECTING,o.prototype.emit.call(this,"connecting"),this._changeToPendingAuthState(),this.transport&&this.transport.off(),this.transport=new c(this.auth,this.codec,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)}))},b.prototype.reconnect=function(){this.disconnect(),this.connect()},b.prototype.disconnect=function(t,e){if("number"!=typeof(t=t||1e3))throw new d("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._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)}},b.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)}},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.processPendingSubscriptions(),o.prototype.emit.call(this,"authStateChange",r),o.prototype.emit.call(this,"authenticate",t)}o.prototype.emit.call(this,"authTokenChange",t)},b.prototype.decodeBase64=function(t){var r;void 0===n?r=e.atob?e.atob(t):p.decode(t):r=new n(t,"base64").toString("utf8");return r},b.prototype.encodeBase64=function(t){var r;void 0===n?r=e.btoa?e.btoa(t):p.encode(t):r=new n(t,"utf8").toString("base64");return r},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(t,e){var r=this;this._changeToPendingAuthState(),this.emit("#authenticate",t,function(n,o){o&&o.authError&&(o.authError=l.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()})})},b.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)},b.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()},b.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)},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._onSCClose=function(t,e,r){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&&t<4500&&this._tryReconnect()),r?o.prototype.emit.call(this,"connectAbort",t,e):o.prototype.emit.call(this,"disconnect",t,e),!b.ignoreStatuses[t]){var n;n=e?"Socket connection failed: "+e:"Socket connection failed for unknown reasons";var i=new g(b.errorStatuses[t]||n,t);this._onSCError(i)}},b.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)})},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();var r=t.callback;if(r){delete t.callback;var n=new m("Event response for '"+t.event+"' timed out");r.call(t,n,t)}},b.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 h.Item;this.options.cloneData?i.data=f(o):i.data=o,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){null==this._localEvents[t]?this._emit(t,e,r):o.prototype.emit.call(this,t,e)},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 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)}},b.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))},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(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)}},b.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},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 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)}},b.prototype._tryUnsubscribe=function(t){if(this.state==this.OPEN){this._cancelPendingSubscribeCallback(t);var e=this._decorateChannelName(t.name);this.transport.emit("#unsubscribe",e,{noTimeout:!0})}},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 i(t,this,e),this._channels[t]=r),r},b.prototype.destroyChannel=function(t){var e=this._channels[t];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 t,e=this;for(var r in this.pendingConnectCallback=!1,this._channels)this._channels.hasOwnProperty(r)&&(t=this._channels[r]).state==t.PENDING&&e._trySubscribe(t)},b.prototype.watch=function(t,e){if("function"!=typeof e)throw new d("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)},t.exports=b}).call(this,r(0),r(5).Buffer)},function(t,e){t.exports=function(t,e){if("$"!==e)for(var r=function(t){var e,r=/(?:\.(\w+))|(?:\[(\d+)\])|(?:\["((?:[^\\"]|\\.)*)"\])/g,n=[];for(;e=r.exec(t);)n.push(e[1]||e[2]||e[3]);return n}(e),n=0;n<r.length;n++)e=r[n].toString().replace(/\\"/g,'"'),void 0===t[e]&&n!==r.length-1||(t=t[e]);return t}},function(t,e,r){var n=r(33);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(t){}var i=o||!1;"boolean"==typeof i&&(i={date:i,function:i,regex:i,undefined:i,error:i,symbol:i,map:i,set:i,nan:i,infinity:i});var s=n.decycle(t,i,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){"use strict";t.exports=r(35)},function(t,e,r){"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&&("AndroidConstants"===t[0]||"PlatformConstants"===t[0])}t.exports=function(t){if("object"!=typeof __fbBatchedBridge||"localhost"!==t&&"127.0.0.1"!==t)return t;t=function(t){var e="undefined"!=typeof window&&window.__fbBatchedBridgeConfig&&window.__fbBatchedBridgeConfig.remoteModuleConfig;if(!Array.isArray(e)||"localhost"!==t&&"127.0.0.1"!==t)return t;var r=(e.find(n)||[])[1];return r?(r.ServerHost||t).split(":")[0]:t}(t);var e,r,o,i=console.warn;return console.warn=function(){if(!(arguments[0]&&arguments[0].indexOf("Requiring module 'NativeModules' by name")>-1))return i.apply(console,arguments)},"undefined"!=typeof window&&window.__DEV__&&"function"==typeof window.require?(e=window.require("NativeModules"),console.warn=i,e&&(e.PlatformConstants||e.AndroidConstants)?(r=e.PlatformConstants,o=e.AndroidConstants,((r?r.ServerHost:o.ServerHost)||t).split(":")[0]):t):t}},function(t,e,r){(function(e){var n=r(6),o=r(1).InvalidArgumentsError,i={};function s(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}function a(){return e.location&&"https:"==location.protocol}function c(t,r){var n=null==t.secure?r:t.secure;return t.port||(e.location&&location.port?location.port:n?443:80)}t.exports={connect:function(t){if((t=t||{}).host&&t.port)throw new o("The host option should already include the port number in the format hostname:port - Because of this, the host and port options cannot be specified together; use the hostname option instead");var r=a(),u={port:c(t,r),hostname:e.location&&location.hostname,path:"/socketcluster/",secure:r,autoConnect:!0,autoReconnect:!0,autoProcessSubscriptions:!0,connectTimeout:2e4,ackTimeout:1e4,timestampRequests:!1,timestampParam:"t",authEngine:null,authTokenName:"socketCluster.authToken",binaryType:"arraybuffer",multiplex:!0,cloneData:!1};for(var h in t)t.hasOwnProperty(h)&&(u[h]=t[h]);var p=s(u);return!1===u.multiplex?new n(u):(i[p]?i[p].connect():i[p]=new n(u),i[p])},destroy:function(t){t=t||{};var r=a(),n={port:c(t,r),hostname:e.location&&location.hostname,path:"/socketcluster/",secure:r};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);var u=s(n),h=i[u];h&&h.disconnect(),delete i[u]},connections:i}}).call(this,r(0))},function(t,e,r){(function(e){var r=function(){"use strict";function t(t,e){return null!=e&&t instanceof e}var r,n,o;try{r=Map}catch(t){r=function(){}}try{n=Set}catch(t){n=function(){}}try{o=Promise}catch(t){o=function(){}}function i(s,c,u,h,p){"object"==typeof c&&(u=c.depth,h=c.prototype,p=c.includeNonEnumerable,c=c.circular);var f=[],l=[],d=void 0!==e;return void 0===c&&(c=!0),void 0===u&&(u=1/0),function s(u,y){if(null===u)return null;if(0===y)return u;var g,m;if("object"!=typeof u)return u;if(t(u,r))g=new r;else if(t(u,n))g=new n;else if(t(u,o))g=new o(function(t,e){u.then(function(e){t(s(e,y-1))},function(t){e(s(t,y-1))})});else if(i.__isArray(u))g=[];else if(i.__isRegExp(u))g=new RegExp(u.source,a(u)),u.lastIndex&&(g.lastIndex=u.lastIndex);else if(i.__isDate(u))g=new Date(u.getTime());else{if(d&&e.isBuffer(u))return g=new e(u.length),u.copy(g),g;t(u,Error)?g=Object.create(u):void 0===h?(m=Object.getPrototypeOf(u),g=Object.create(m)):(g=Object.create(h),m=h)}if(c){var v=f.indexOf(u);if(-1!=v)return l[v];f.push(u),l.push(g)}for(var b in t(u,r)&&u.forEach(function(t,e){var r=s(e,y-1),n=s(t,y-1);g.set(r,n)}),t(u,n)&&u.forEach(function(t){var e=s(t,y-1);g.add(e)}),u){var E;m&&(E=Object.getOwnPropertyDescriptor(m,b)),E&&null==E.set||(g[b]=s(u[b],y-1))}if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(u);for(b=0;b<S.length;b++){var w=S[b];(!(_=Object.getOwnPropertyDescriptor(u,w))||_.enumerable||p)&&(g[w]=s(u[w],y-1),_.enumerable||Object.defineProperty(g,w,{enumerable:!1}))}}if(p){var T=Object.getOwnPropertyNames(u);for(b=0;b<T.length;b++){var _,k=T[b];(_=Object.getOwnPropertyDescriptor(u,k))&&_.enumerable||(g[k]=s(u[k],y-1),Object.defineProperty(g,k,{enumerable:!1}))}}return g}(s,u)}function s(t){return Object.prototype.toString.call(t)}function a(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return i.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},i.__objToStr=s,i.__isDate=function(t){return"object"==typeof t&&"[object Date]"===s(t)},i.__isArray=function(t){return"object"==typeof t&&"[object Array]"===s(t)},i.__isRegExp=function(t){return"object"==typeof t&&"[object RegExp]"===s(t)},i.__getRegExpFlags=a,i}();"object"==typeof t&&t.exports&&(t.exports=r)}).call(this,r(5).Buffer)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){(function(t,n){var o;/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */!function(i){var s="object"==typeof e&&e,a=("object"==typeof t&&t&&t.exports,"object"==typeof n&&n);a.global!==a&&a.window;var c=function(t){this.message=t};(c.prototype=new Error).name="InvalidCharacterError";var u=function(t){throw new c(t)},h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=/[\t\n\f\r ]/g,f={encode: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,s="",a=-1,c=t.length-i;++a<c;)e=t.charCodeAt(a)<<16,r=t.charCodeAt(++a)<<8,n=t.charCodeAt(++a),s+=h.charAt((o=e+r+n)>>18&63)+h.charAt(o>>12&63)+h.charAt(o>>6&63)+h.charAt(63&o);return 2==i?(e=t.charCodeAt(a)<<8,r=t.charCodeAt(++a),s+=h.charAt((o=e+r)>>10)+h.charAt(o>>4&63)+h.charAt(o<<2&63)+"="):1==i&&(o=t.charCodeAt(a),s+=h.charAt(o>>2)+h.charAt(o<<4&63)+"=="),s},decode:function(t){var e=(t=String(t).replace(p,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).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="",s=-1;++s<e;)n=h.indexOf(t.charAt(s)),r=o%4?64*r+n:n,o++%4&&(i+=String.fromCharCode(255&r>>(-2*o&6)));return i},version:"0.1.0"};void 0===(o=function(){return f}.call(e,r,e,t))||(t.exports=o)}()}).call(this,r(14)(t),r(0))},function(t,e,r){"use strict";var n,o;function i(){if(arguments.length)return i.from(arguments)}function s(){}n="An argument without append, prepend, or detach methods was given to `List",o=i.prototype,i.of=function(){return i.from.call(this,arguments)},i.from=function(t){var e,r,n,o=new this;if(t&&(e=t.length))for(r=-1;++r<e;)null!==(n=t[r])&&void 0!==n&&o.append(n);return o},o.head=null,o.tail=null,o.toArray=function(){for(var t=this.head,e=[];t;)e.push(t),t=t.next;return e},o.prepend=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(n+"#prepend`.");var e;return this,(e=this.head)?e.prepend(t):(t.detach(),t.list=this,this.head=t,t)},o.append=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(n+"#append`.");var e,r;return this,(r=this.tail)?r.append(t):(e=this.head)?e.append(t):(t.detach(),t.list=this,this.head=t,t)},i.Item=s;var a=s.prototype;a.next=null,a.prev=null,a.list=null,a.detach=function(){var t=this.list,e=this.prev,r=this.next;return t?(t.tail===this&&(t.tail=e),t.head===this&&(t.head=r),t.tail===t.head&&(t.tail=null),e&&(e.next=r),r&&(r.prev=e),this.prev=this.next=this.list=null,this):this},a.prepend=function(t){if(!(t&&t.append&&t.prepend&&t.detach))throw new Error(n+"Item#prepend`.");var e=this.list,r=this.prev;return!!e&&(t.detach(),r&&(t.prev=r,r.next=t),t.next=this,t.list=e,this.prev=t,this===e.head&&(e.head=t),e.tail||(e.tail=this),t)},a.append=function(t){if(!(t&&t.append&&t.prepend&&t.detach))throw new Error(n+"Item#append`.");var e=this.list,r=this.next;return!!e&&(t.detach(),r&&(t.next=r,r.prev=t),t.prev=this,t.list=e,this.next=t,this!==e.tail&&e.tail||(e.tail=t),t)},t.exports=i},function(t,e,r){"use strict";t.exports=r(16)},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,r){return e?new n(t,e):new n(t)}n&&(o.prototype=n.prototype),t.exports=n?o:null},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?i(s(t),function(s){var a=encodeURIComponent(n(s))+r;return o(t[s])?i(t[s],function(t){return a+encodeURIComponent(n(t))}).join(e):a+encodeURIComponent(n(t[s]))}).join(e):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(t)):""};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var s=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,i){e=e||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var c=1e3;i&&"number"==typeof i.maxKeys&&(c=i.maxKeys);var u=t.length;c>0&&u>c&&(u=c);for(var h=0;h<u;++h){var p,f,l,d,y=t[h].replace(a,"%20"),g=y.indexOf(r);g>=0?(p=y.substr(0,g),f=y.substr(g+1)):(p=y,f=""),l=decodeURIComponent(p),d=decodeURIComponent(f),n(s,l)?o(s[l])?s[l].push(d):s[l]=[s[l],d]:s[l]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){(function(e){var n,o,i=r(2).SCEmitter,s=r(4).Response,a=r(3);e.WebSocket?(n=e.WebSocket,o=function(t,e){return new n(t)}):(n=r(18),o=function(t,e){return new n(t,null,e)});var c=r(1),u=c.TimeoutError,h=function(t,e,r){this.state=this.CLOSED,this.auth=t,this.codec=e,this.options=r,this.connectTimeout=r.connectTimeout,this.pingTimeout=r.ackTimeout,this.callIdGenerator=r.callIdGenerator,this._pingTimeoutTicker=null,this._callbackMap={},this.open()};h.prototype=Object.create(i.prototype),h.CONNECTING=h.prototype.CONNECTING="connecting",h.OPEN=h.prototype.OPEN="open",h.CLOSED=h.prototype.CLOSED="closed",h.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=a.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},h.prototype.open=function(){var t=this;this.state=this.CONNECTING;var e=this.uri(),r=o(e,this.options);r.binaryType=this.options.binaryType,this.socket=r,r.onopen=function(){t._onOpen()},r.onclose=function(e){var r;r=null==e.code?1005:e.code,t._onClose(r,e.reason)},r.onmessage=function(e,r){t._onMessage(e.data)},r.onerror=function(e){t.state===t.CONNECTING&&t._onClose(1006)},this._connectTimeoutRef=setTimeout(function(){t._onClose(4007),t.socket.close(4007)},this.connectTimeout)},h.prototype._onOpen=function(){var t=this;clearTimeout(this._connectTimeoutRef),this._resetPingTimeout(),this._handshake(function(e,r){e?(t._onError(e),t._onClose(4003),t.socket.close(4003)):(t.state=t.OPEN,i.prototype.emit.call(t,"open",r),t._resetPingTimeout())})},h.prototype._handshake=function(t){var e=this;this.auth.loadToken(this.options.authTokenName,function(r,n){if(r)t(r);else{e.emit("#handshake",{authToken:n},{force:!0},function(e,r){r&&(r.authToken=n,r.authError&&(r.authError=c.hydrateError(r.authError))),t(e,r)})}})},h.prototype._onClose=function(t,e){delete this.socket.onopen,delete this.socket.onclose,delete this.socket.onmessage,delete this.socket.onerror,clearTimeout(this._connectTimeoutRef),this.state==this.OPEN?(this.state=this.CLOSED,i.prototype.emit.call(this,"close",t,e)):this.state==this.CONNECTING&&(this.state=this.CLOSED,i.prototype.emit.call(this,"openAbort",t,e))},h.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{var r=e.event;if(r){var n=new s(this,e.cid);i.prototype.emit.call(this,"event",r,e.data,n)}else if(null!=e.rid){var o=this._callbackMap[e.rid];if(o&&(clearTimeout(o.timeout),delete this._callbackMap[e.rid],o.callback)){var a=c.hydrateError(e.error);o.callback(a,e.data)}}else i.prototype.emit.call(this,"event","raw",e)}},h.prototype._onError=function(t){i.prototype.emit.call(this,"error",t)},h.prototype._resetPingTimeout=function(){var t=this;(new Date).getTime();clearTimeout(this._pingTimeoutTicker),this._pingTimeoutTicker=setTimeout(function(){t._onClose(4e3),t.socket.close(4e3)},this.pingTimeout)},h.prototype.getBytesReceived=function(){return this.socket.bytesReceived},h.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))},h.prototype.emitObject=function(t){var e={event:t.event,data:t.data};return t.callback&&(e.cid=t.cid=this.callIdGenerator(),this._callbackMap[t.cid]=t),this.sendObject(e),t.cid||null},h.prototype._handleEventAckTimeout=function(t){var e="Event response for '"+t.event+"' timed out",r=new u(e);t.cid&&delete this._callbackMap[t.cid];var n=t.callback;delete t.callback,n.call(t,r,t)},h.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)),c},h.prototype.cancelPendingResponse=function(t){delete this._callbackMap[t]},h.prototype.decode=function(t){return this.codec.decode(t)},h.prototype.encode=function(t){return this.codec.encode(t)},h.prototype.send=function(t){this.socket.readyState!=this.socket.OPEN?this._onClose(1005):this.socket.send(t)},h.prototype.serializeObject=function(t){var e,r;try{e=this.encode(t)}catch(t){r=t,this._onError(r)}return r?null:e},h.prototype.sendObject=function(t){var e=this.serializeObject(t);null!=e&&this.send(e)},t.exports.SCTransport=h}).call(this,r(0))},function(t,e,r){(function(e){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=/^[ \n\r\t]*[{\[]/,o=function(t,n){if(e.ArrayBuffer&&n instanceof e.ArrayBuffer)return{base64:!0,data:function(t){for(var e=new Uint8Array(t),n=e.length,o="",i=0;i<n;i+=3)o+=r[e[i]>>2],o+=r[(3&e[i])<<4|e[i+1]>>4],o+=r[(15&e[i+1])<<2|e[i+2]>>6],o+=r[63&e[i+2]];return n%3==2?o=o.substring(0,o.length-1)+"=":n%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(n)};if(e.Buffer){if(n instanceof e.Buffer)return{base64:!0,data:n.toString("base64")};if(n&&"Buffer"===n.type&&Array.isArray(n.data))return{base64:!0,data:(e.Buffer.from?e.Buffer.from(n.data):new e.Buffer(n.data)).toString("base64")}}return n};t.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},t.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,o)}}).call(this,r(0))},function(t,e,r){(function(e){var r=function(){this._internalStorage={}};r.prototype._isLocalStorageEnabled=function(){var t;try{e.localStorage,e.localStorage.setItem("__scLocalStorageTest",1),e.localStorage.removeItem("__scLocalStorageTest")}catch(e){t=e}return!t},r.prototype.saveToken=function(t,r,n,o){this._isLocalStorageEnabled()&&e.localStorage?e.localStorage.setItem(t,r):this._internalStorage[t]=r,o&&o(null,r)},r.prototype.removeToken=function(t,r){var n;this.loadToken(t,function(t,e){n=e}),this._isLocalStorageEnabled()&&e.localStorage&&e.localStorage.removeItem(t),delete this._internalStorage[t],r&&r(null,n)},r.prototype.loadToken=function(t,r){r(null,this._isLocalStorageEnabled()&&e.localStorage?e.localStorage.getItem(t):this._internalStorage[t]||null)},t.exports.AuthEngine=r}).call(this,r(0))},function(t,e){t.exports=function(t){var e=[],r=[];return function t(n,o){var i,s,a;if(!("object"!=typeof n||null===n||n instanceof Boolean||n instanceof Date||n instanceof Number||n instanceof RegExp||n instanceof String)){for(i=0;i<e.length;i+=1)if(e[i]===n)return{$ref:r[i]};if(e.push(n),r.push(o),"[object Array]"===Object.prototype.toString.apply(n))for(a=[],i=0;i<n.length;i+=1)a[i]=t(n[i],o+"["+i+"]");else for(s in a={},n)Object.prototype.hasOwnProperty.call(n,s)&&(a[s]=t(n[s],o+"["+JSON.stringify(s)+"]"));return a}return n}(t,"$")}},function(t,e,r){var n=r(2).SCEmitter,o=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)};(o.prototype=Object.create(n.prototype)).setOptions=function(t){t||(t={}),this.waitForAuth=t.waitForAuth||!1,void 0!==t.data&&(this.data=t.data)},o.prototype.getState=function(){return this.state},o.prototype.subscribe=function(t){this.client.subscribe(this.name,t)},o.prototype.unsubscribe=function(){this.client.unsubscribe(this.name)},o.prototype.isSubscribed=function(t){return this.client.isSubscribed(this.name,t)},o.prototype.publish=function(t,e){this.client.publish(this.name,t,e)},o.prototype.watch=function(t){this.client.watch(this.name,t)},o.prototype.unwatch=function(t){this.client.unwatch(this.name,t)},o.prototype.watchers=function(){return this.client.watchers(this.name)},o.prototype.destroy=function(){this.client.destroyChannel(this.name)},t.exports.SCChannel=o},function(t,e){t.exports.create=function(){function t(){}return function(e){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return t.prototype=e,new t}}()},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)}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,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}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){e.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,f=r?-1:1,l=t[e+p];for(p+=f,i=l&(1<<-h)-1,l>>=-h,h+=a;h>0;i=256*i+t[e+p],p+=f,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+p],p+=f,h-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),i-=u}return(l?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<<u)-1,p=h>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=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),(e+=s+p>=1?f/c:f*Math.pow(2,1-p))*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(e*c-1)*Math.pow(2,o),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;t[r+l]=255&a,l+=d,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;t[r+l]=255&s,l+=d,s/=256,u-=8);t[r+l-d]|=128*y}},function(t,e,r){"use strict";e.byteLength=function(t){return 3*t.length/4-u(t)},e.toByteArray=function(t){var e,r,n,s,a,c=t.length;s=u(t),a=new i(3*c/4-s),r=s>0?c-4:c;var h=0;for(e=0;e<r;e+=4)n=o[t.charCodeAt(e)]<<18|o[t.charCodeAt(e+1)]<<12|o[t.charCodeAt(e+2)]<<6|o[t.charCodeAt(e+3)],a[h++]=n>>16&255,a[h++]=n>>8&255,a[h++]=255&n;2===s?(n=o[t.charCodeAt(e)]<<2|o[t.charCodeAt(e+1)]>>4,a[h++]=255&n):1===s&&(n=o[t.charCodeAt(e)]<<10|o[t.charCodeAt(e+1)]<<4|o[t.charCodeAt(e+2)]>>2,a[h++]=n>>8&255,a[h++]=255&n);return a},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i="",s=[],a=0,c=r-o;a<c;a+=16383)s.push(h(t,a,a+16383>c?c:a+16383));1===o?(e=t[r-1],i+=n[e>>2],i+=n[e<<4&63],i+="=="):2===o&&(e=(t[r-2]<<8)+t[r-1],i+=n[e>>10],i+=n[e>>4&63],i+=n[e<<2&63],i+="=");return s.push(i),s.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function h(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e,r){var n=r(6),o=r(12);t.exports.SCSocketCreator=o,t.exports.SCSocket=n,t.exports.SCEmitter=r(2).SCEmitter,t.exports.connect=function(t){return o.connect(t)},t.exports.destroy=function(t){return o.destroy(t)},t.exports.connections=o.connections,t.exports.version="5.5.2"},function(t,e,r){var n=r(7),o=r(8);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],i=t.slice(1);switch(r){case"$":return n(e,t);case"r":var s=i.indexOf(","),a=i.slice(0,s),c=i.slice(s+1);return RegExp(c,a);case"d":return new Date(+i);case"f":var u=function(){throw new Error("can't run jsan parsed function")};return u.toString=function(){return i},u;case"u":return;case"e":var h=new Error(i);return h.stack="Stack is unavailable for jsan parsed errors",h;case"s":return Symbol(i);case"g":return Symbol.for(i);case"m":return new Map(o.parse(i));case"l":return new Set(o.parse(i));case"n":return NaN;case"i":return 1/0;case"y":return-1/0;default:return console.warn("unknown type",t),t}}},function(t,e,r){r(7);var n=r(32),o="undefined"!=typeof WeakMap?WeakMap:function(){var t=[],e=[];return{set:function(r,n){t.push(r),e.push(n)},get:function(r){for(var n=0;n<t.length;n++)if(t[n]===r)return e[n]}}};e.decycle=function t(e,r,i){"use strict";var s=new o,a=Object.prototype.hasOwnProperty.call(r,"circular");return function e(o,c,u){var h,p,f,l=i?i(u||"",o):o;if(r.date&&l instanceof Date)return{$jsan:"d"+l.getTime()};if(r.regex&&l instanceof RegExp)return{$jsan:"r"+n.getRegexFlags(l)+","+l.source};if(r.function&&"function"==typeof l)return{$jsan:"f"+n.stringifyFunction(l,r.function)};if(r.nan&&"number"==typeof l&&isNaN(l))return{$jsan:"n"};if(r.infinity){if(Number.POSITIVE_INFINITY===l)return{$jsan:"i"};if(Number.NEGATIVE_INFINITY===l)return{$jsan:"y"}}if(r[void 0]&&void 0===l)return{$jsan:"u"};if(r.error&&l instanceof Error)return{$jsan:"e"+l.message};if(r.symbol&&"symbol"==typeof l){var d=Symbol.keyFor(l);return void 0!==d?{$jsan:"g"+d}:{$jsan:"s"+l.toString().slice(7,-1)}}if(r.map&&"function"==typeof Map&&l instanceof Map&&"function"==typeof Array.from)return{$jsan:"m"+JSON.stringify(t(Array.from(l),r,i))};if(r.set&&"function"==typeof Set&&l instanceof Set&&"function"==typeof Array.from)return{$jsan:"l"+JSON.stringify(t(Array.from(l),r,i))};if(l&&"function"==typeof l.toJSON&&(l=l.toJSON(u)),!("object"!=typeof l||null===l||l instanceof Boolean||l instanceof Date||l instanceof Number||l instanceof RegExp||l instanceof String||"symbol"==typeof l||l instanceof Error)){if("object"==typeof l&&null!==l){var y=s.get(l);if(y)return a&&0===c.indexOf(y)?"function"==typeof r.circular?r.circular(l,c,y):r.circular:{$jsan:y};s.set(l,c)}if("[object Array]"===Object.prototype.toString.apply(l))for(f=[],h=0;h<l.length;h+=1)f[h]=e(l[h],c+"["+h+"]",h);else for(p in f={},l)if(Object.prototype.hasOwnProperty.call(l,p)){var g=/^\w+$/.test(p)?"."+p:"["+JSON.stringify(p)+"]";f[p]="$jsan"===p?[e(l[p],c+g)]:e(l[p],c+g,p)}return f}return l}(e,"$")},e.retrocycle=function(t){"use strict";return function e(r){var o,i,s;if(r&&"object"==typeof r)if("[object Array]"===Object.prototype.toString.apply(r))for(o=0;o<r.length;o+=1)(i=r[o])&&"object"==typeof i&&(i.$jsan?r[o]=n.restore(i.$jsan,t):e(i));else for(s in r){if("string"==typeof r[s]&&"$jsan"===s)return n.restore(r.$jsan,t);"$jsan"===s&&(r[s]=r[s][0]),"object"==typeof r[s]&&(i=r[s])&&"object"==typeof i&&(i.$jsan?r[s]=n.restore(i.$jsan,t):e(i))}return r}(t)}},function(t,e,r){t.exports=r(8)},function(t,e,r){"use strict";e.__esModule=!0,e.send=void 0,e.extractState=p,e.generateId=f,e.start=y,e.connect=m,e.connectViaExtension=v;var n=r(34),o=a(r(31)),i=a(r(11)),s=r(10);function a(t){return t&&t.__esModule?t:{default:t}}var c=void 0,u=void 0,h={};function p(t){if(t&&t.state)return"string"==typeof t.state?(0,n.parse)(t.state):t.state}function f(){return Math.random().toString(36).substr(2)}function l(t){t.payload||(t.payload=t.action),Object.keys(h).forEach(function(e){t.instanceId&&e!==t.instanceId||("function"==typeof h[e]?h[e](t):h[e].forEach(function(e){e(t)}))})}function d(t){if(!c){var e=void 0;e=t.port?{port:t.port,hostname:(0,i.default)(t.hostname||"localhost"),secure:!!t.secure}:s.defaultSocketOptions,c=o.default.connect(e),u||c.emit("login","master",function(t,e){t?console.log(t):((u=c.subscribe(e)).watch(l),c.on(e,l))})}}function y(t){t&&t.port&&!t.hostname&&(t.hostname="localhost"),d(t)}function g(t,e,r,o,i){y(r),setTimeout(function(){var s={payload:e?(0,n.stringify)(e):"",action:"ACTION"===o?(0,n.stringify)(function(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}(t,r)):t,type:o||"ACTION",id:c.id,instanceId:i,name:r.name};c.emit(c.id?"log":"log-noid",s)},0)}function m(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=f(t.instanceId);return y(t),{init:function(r,n){g(n||{},r,t,"INIT",e)},subscribe:function(t){if(t)return h[e]||(h[e]=[]),h[e].push(t),function(){var r=h[e].indexOf(t);h[e].splice(r,1)}},unsubscribe:function(){delete h[e]},send:function(r,n){r?g(r,n,t,"ACTION",e):g(void 0,n,t,"STATE",e)},error:function(t){c.emit({type:"ERROR",payload:t,id:c.id,instanceId:e})}}}function v(t){return t&&t.remote||"undefined"==typeof window||!window.devToolsExtension?m(t):window.devToolsExtension.connect(t)}e.send=g,e.default={connect:m,connectViaExtension:v,send:g,extractState:p,generateId:f}},function(t,e,r){"use strict";r.r(e),r.d(e,"send",function(){return s});var n=r(9);const o=r.n(n).a.connectViaExtension(),i=t=>{if(t&&"object"==typeof t)switch(t.ctor){case"[]":return[];case"::":const e=[];let r=t;for(;"::"===r.ctor;)e.push(i(r._0)),r=r._1;return e;default:if("_0"in t&&"ctor"in t&&2==Object.keys(t).length&&"object"==typeof t._0&&!("ctor"in t._0))return{$$:t.ctor,...i(t._0)};const n={};for(const e in t)n["ctor"===e?"$":e]=i(t[e]);return n}return t},s=(t,e)=>{const r=(t=>{const e=t=>t&&t.ctor?`${t.ctor}:${e(t._0)}`:"";return{type:e(t).slice(0,-1),...i(t)}})(t),n=i(e);o.send(r,n)}}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment