vue-socket-cluster
Version:
Socket cluster vuejs wrapper
8 lines • 73.6 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["vue-socket-cluster"]=e():t["vue-socket-cluster"]=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=31)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(26),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 l(t){this.name="InvalidOptionsError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function f(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 b(t){this.name="ResourceLimitError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function m(t){this.name="TimeoutError",this.message=t,Error.captureStackTrace&&!o?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function v(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 T(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),l.prototype=Object.create(Error.prototype),f.prototype=Object.create(Error.prototype),d.prototype=Object.create(Error.prototype),y.prototype=Object.create(Error.prototype),g.prototype=Object.create(Error.prototype),b.prototype=Object.create(Error.prototype),m.prototype=Object.create(Error.prototype),v.prototype=Object.create(Error.prototype),E.prototype=Object.create(Error.prototype),S.prototype=Object.create(Error.prototype),T.prototype=Object.create(Error.prototype),t.exports={AuthTokenExpiredError:i,AuthTokenInvalidError:s,AuthTokenNotBeforeError:a,AuthTokenError:c,SilentMiddlewareBlockedError:u,InvalidActionError:h,InvalidArgumentsError:p,InvalidOptionsError:l,InvalidMessageError:f,SocketProtocolError:d,ServerProtocolError:y,HTTPServerError:g,ResourceLimitError:b,TimeoutError:m,BadConnectionError:v,BrokerError:E,ProcessExitError:S,UnknownError:T},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",4008:"Server rejected handshake from client"},t.exports.socketProtocolIgnoreStatuses={1000:"Socket closed normally",1001:"Socket hung up"};var w={domain:1,domainEmitter:1,domainThrown:1};t.exports.dehydrateError=function(t,e){var n;if(t&&"object"==typeof t)for(var o in n={message:t.message},e&&(n.stack=t.stack),t)w[o]||(n[o]=t[o]);else n="function"==typeof t?"[function "+(t.name||"anonymous")+"]":t;return r(n)},t.exports.hydrateError=function(t){var e=null;if(null!=t)if("object"==typeof t)for(var n in e=new Error(t.message),t)t.hasOwnProperty(n)&&(e[n]=t[n]);else e=t;return e},t.exports.decycle=r},function(t,e,n){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 n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),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 n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((n=r[o])===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),n=this._callbacks["$"+t];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].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){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e,n){"use strict";e.decode=e.parse=n(22),e.encode=e.stringify=n(21)},function(t,e,n){var r=n(1),o=r.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 n=r.dehydrateError(t),o={rid:this.id,error:n};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,n){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var r=n(30),o=n(29),i=n(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,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,n);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,n)}function u(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=l(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(e,n),o=(t=a(t,r)).write(e,n);o!==r&&(t=t.slice(0,o));return t}(t,e,n):function(t,e){if(c.isBuffer(e)){var n=0|f(e.length);return 0===(t=a(t,n)).length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):l(t,e);if("Buffer"===e.type&&i(e.data))return l(t,e.data)}var r;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|f(e)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function l(t,e){var n=e.length<0?0:0|f(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function f(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 n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Y(t).length;default:if(r)return F(t).length;e=(""+e).toLowerCase(),r=!0}}function y(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:b(t,e,n,r,o);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):b(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,n,r,o){var i,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var h=-1;for(i=n;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(n+c>a&&(n=a-c),i=n;i>=0;i--){for(var p=!0,l=0;l<c;l++)if(u(t,i+l)!==u(e,l)){p=!1;break}if(p)return i}return-1}function m(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function v(t,e,n,r){return q(F(e,t.length-n),t,n,r)}function E(t,e,n,r){return q(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function S(t,e,n,r){return E(t,e,n,r)}function T(t,e,n,r){return q(Y(e),t,n,r)}function w(t,e,n,r){return q(function(t,e){for(var n,r,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function k(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function _(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i,s,a,c,u=t[o],h=null,p=u>239?4:u>223?3:u>191?2:1;if(o+p<=n)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,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),o+=p}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=A));return n}(r)}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,n){return u(null,t,e,n)},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,n){return function(t,e,n,r){return h(e),e<=0?a(t,e):void 0!==n?"string"==typeof r?a(t,e).fill(n,r):a(t,e).fill(n):a(t,e)}(null,t,e,n)},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 n=t.length,r=e.length,o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?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 n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=c.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var s=t[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,o),o+=s.length}return r},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?_(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return _(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return k(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!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="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,n,r,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,o>>>=0,this===t)return 0;for(var i=o-r,s=n-e,a=Math.min(i,s),u=this.slice(r,o),h=t.slice(e,n),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,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return m(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":return E(this,t,e,n);case"latin1":case"binary":return S(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).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,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function O(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function R(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=e;i<n;++i)o+=M(t[i]);return o}function P(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function B(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,n,r,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(n+r>t.length)throw new RangeError("Index out of range")}function N(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);o<i;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function x(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);o<i;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function U(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(t,e,n,r,i){return i||U(t,0,n,4),o.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,i){return i||U(t,0,n,8),o.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){var n,r=this.length;if(t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=c.prototype;else{var o=e-t;n=new c(o,void 0);for(var i=0;i<o;++i)n[i]=this[i+t]}return n},c.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||B(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},c.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||B(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},c.prototype.readUInt8=function(t,e){return e||B(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||B(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||B(t,2,this.length),this[t]<<8|this[t+1]},c.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]},c.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])},c.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||B(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||B(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},c.prototype.readInt8=function(t,e){return e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||B(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){e||B(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.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},c.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]},c.prototype.readFloatLE=function(t,e){return e||B(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||B(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||B(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||B(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||I(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||I(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||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,n){return t=+t,e|=0,n||I(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||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,n){return t=+t,e|=0,n||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,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);I(this,t,e,n,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<n&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);I(this,t,e,n,o-1,-o)}var i=n-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+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||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,n){return t=+t,e|=0,n||I(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||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,n){return t=+t,e|=0,n||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,n){return D(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o,i=r-n;if(this===t&&n<e&&e<r)for(o=i-1;o>=0;--o)t[o+e]=this[o+n];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+i),e);return i},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var s=c.isBuffer(t)?t:F(new c(t,r).toString()),a=s.length;for(i=0;i<n-e;++i)this[i+e]=s[i%a]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function M(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Y(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}}).call(this,n(0))},function(t,e,n){(function(e,r){var o=n(2),i=n(27).SCChannel,s=(n(6).Response,n(25).AuthEngine),a=n(24),c=n(23).SCTransport,u=n(5),h=n(19),p=n(17),l=n(15),f=n(1),d=f.InvalidArgumentsError,y=f.InvalidMessageError,g=f.InvalidActionError,b=f.SocketProtocolError,m=f.TimeoutError,v=f.BadConnectionError,E="undefined"!=typeof window,S=function(t){var n=this;o.call(this),this.id=null,this.state=this.CLOSED,this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null,this.pendingReconnect=!1,this.pendingReconnectTimeout=null,this.preparingPendingSubscriptions=!1,this.clientId=t.clientId,this.connectTimeout=t.connectTimeout,this.ackTimeout=t.ackTimeout,this.channelPrefix=t.channelPrefix||null,this.disconnectOnUnload=null==t.disconnectOnUnload||t.disconnectOnUnload,this.authTokenName=t.authTokenName,this.pingTimeout=this.ackTimeout,this.pingTimeoutDisabled=!!t.pingTimeoutDisabled,this.active=!0,this._clientMap=t.clientMap||{};var r=Math.pow(2,31)-1,i=function(t){if(n[t]>r)throw new d("The "+t+" value provided exceeded the maximum amount allowed")};if(i("connectTimeout"),i("ackTimeout"),this._localEvents={connect:1,connectAbort:1,close:1,disconnect:1,message:1,error:1,raw:1,kickOut:1,subscribe:1,unsubscribe:1,subscribeStateChange:1,authStateChange:1,authenticate:1,deauthenticate:1,removeAuthToken:1,subscribeRequest:1},this.connectAttempts=0,this._emitBuffer=new h,this.channels={},this.options=t,this._cid=1,this.options.callIdGenerator=function(){return n._cid++},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)}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._channelEmitter=new o,this._unloadHandler=function(){n.disconnect()},E&&this.disconnectOnUnload&&e.addEventListener&&e.addEventListener("beforeunload",this._unloadHandler,!1),this._clientMap[this.clientId]=this,this.options.autoConnect&&this.connect()};S.prototype=Object.create(o.prototype),S.CONNECTING=S.prototype.CONNECTING=c.prototype.CONNECTING,S.OPEN=S.prototype.OPEN=c.prototype.OPEN,S.CLOSED=S.prototype.CLOSED=c.prototype.CLOSED,S.AUTHENTICATED=S.prototype.AUTHENTICATED="authenticated",S.UNAUTHENTICATED=S.prototype.UNAUTHENTICATED="unauthenticated",S.PENDING=S.prototype.PENDING="pending",S.ignoreStatuses=f.socketProtocolIgnoreStatuses,S.errorStatuses=f.socketProtocolErrorStatuses,S.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),n=this.channels[e];n&&(o.prototype.emit.call(this,"kickOut",t.message,e),n.emit("kickOut",t.message,e),this._triggerChannelUnsubscribe(n))},"#setAuthToken":function(t,e){var n=this;if(t){this.auth.saveToken(this.authTokenName,t.token,{},function(r){r?(e.error(r),n._onSCError(r)):(n._changeToAuthenticatedState(t.token),e.end())})}else e.error(new y("No token data provided by #setAuthToken event"))},"#removeAuthToken":function(t,e){var n=this;this.auth.removeToken(this.authTokenName,function(t,r){t?(e.error(t),n._onSCError(t)):(o.prototype.emit.call(n,"removeAuthToken",r),n._changeToUnauthenticatedStateAndClearTokens(),e.end())})},"#disconnect":function(t){this.transport.close(t.code,t.data)}},S.prototype.getState=function(){return this.state},S.prototype.getBytesReceived=function(){return this.transport.getBytesReceived()},S.prototype.deauthenticate=function(t){var e=this;this.auth.removeToken(this.authTokenName,function(n,r){n?e._onSCError(n):(o.prototype.emit.call(e,"removeAuthToken",r),e.state!=e.CLOSED&&e.emit("#removeAuthToken"),e._changeToUnauthenticatedStateAndClearTokens()),t&&t(n)})},S.prototype.connect=S.prototype.open=function(){var t=this;if(this.active)this.state==this.CLOSED&&(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this.state=this.CONNECTING,o.prototype.emit.call(this,"connecting"),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,n){t.state=t.CLOSED,t._onSCClose(e,n)}),this.transport.on("openAbort",function(e,n){t.state=t.CLOSED,t._onSCClose(e,n,!0)}),this.transport.on("event",function(e,n,r){t._onSCEvent(e,n,r)}));else{var e=new g("Cannot connect a destroyed client");this._onSCError(e)}},S.prototype.reconnect=function(t,e){this.disconnect(t,e),this.connect()},S.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))},S.prototype.destroy=function(t,n){E&&e.removeEventListener&&e.removeEventListener("beforeunload",this._unloadHandler,!1),this.active=!1,this.disconnect(t,n),delete this._clientMap[this.clientId]},S.prototype._changeToUnauthenticatedStateAndClearTokens=function(){if(this.authState!=this.UNAUTHENTICATED){var t=this.authState,e=this.signedAuthToken;this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null;var n={oldState:t,newState:this.authState};o.prototype.emit.call(this,"authStateChange",n),o.prototype.emit.call(this,"deauthenticate",e)}},S.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 n={oldState:e,newState:this.authState,signedAuthToken:t,authToken:this.authToken};this.preparingPendingSubscriptions||this.processPendingSubscriptions(),o.prototype.emit.call(this,"authStateChange",n)}o.prototype.emit.call(this,"authenticate",t)},S.prototype.decodeBase64=function(t){var n;void 0===r?n=e.atob?e.atob(t):p.decode(t):n=new r(t,"base64").toString("utf8");return n},S.prototype.encodeBase64=function(t){var n;void 0===r?n=e.btoa?e.btoa(t):p.encode(t):n=new r(t,"utf8").toString("base64");return n},S.prototype._extractAuthTokenData=function(t){var e=(t||"").split(".")[1];if(null!=e){var n=e;try{return n=this.decodeBase64(n),JSON.parse(n)}catch(t){return n}}return null},S.prototype.getAuthToken=function(){return this.authToken},S.prototype.getSignedAuthToken=function(){return this.signedAuthToken},S.prototype.authenticate=function(t,e){var n=this;this.emit("#authenticate",t,function(r,o){o&&null!=o.isAuthenticated?o.authError&&(o.authError=f.hydrateError(o.authError)):o={isAuthenticated:n.authState,authError:null},r?("BadConnectionError"!=r.name&&"TimeoutError"!=r.name&&n._changeToUnauthenticatedStateAndClearTokens(),e&&e(r,o)):n.auth.saveToken(n.authTokenName,t,{},function(r){r&&n._onSCError(r),o.isAuthenticated?n._changeToAuthenticatedState(t):n._changeToUnauthenticatedStateAndClearTokens(),e&&e(r,o)})})},S.prototype._tryReconnect=function(t){var e,n=this,r=this.connectAttempts++,o=this.options.autoReconnectOptions;if(null==t||r>0){var i=Math.round(o.initialDelay+(o.randomness||0)*Math.random());e=Math.round(i*Math.pow(o.multiplier,r))}else e=t;e>o.maxDelay&&(e=o.maxDelay),clearTimeout(this._reconnectTimeoutRef),this.pendingReconnect=!0,this.pendingReconnectTimeout=e,this._reconnectTimeoutRef=setTimeout(function(){n.connect()},e)},S.prototype._onSCOpen=function(t){var e=this;this.preparingPendingSubscriptions=!0,t?(this.id=t.id,this.pingTimeout=t.pingTimeout,this.transport.pingTimeout=this.pingTimeout,t.isAuthenticated?this._changeToAuthenticatedState(t.authToken):this._changeToUnauthenticatedStateAndClearTokens()):this._changeToUnauthenticatedStateAndClearTokens(),this.connectAttempts=0,this.options.autoSubscribeOnConnect&&this.processPendingSubscriptions(),o.prototype.emit.call(this,"connect",t,function(){e.processPendingSubscriptions()}),this.state==this.OPEN&&this._flushEmitBuffer()},S.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)},S.prototype._suspendSubscriptions=function(){var t,e;for(var n in this.channels)this.channels.hasOwnProperty(n)&&(e=(t=this.channels[n]).state==t.SUBSCRIBED||t.state==t.PENDING?t.PENDING:t.UNSUBSCRIBED,this._triggerChannelUnsubscribe(t,e))},S.prototype._abortAllPendingEventsDueToBadConnection=function(t){for(var e,n=this._emitBuffer.head;n;){e=n.next;var r=n.data;clearTimeout(r.timeout),delete r.timeout,n.detach(),n=e;var o=r.callback;if(o){delete r.callback;var i="Event '"+r.event+"' was aborted due to a bad connection",s=new v(i,t);o.call(r,s,r)}r.cid&&this.transport.cancelPendingResponse(r.cid)}},S.prototype._onSCClose=function(t,e,n){if(this.id=null,this.transport&&this.transport.off(),this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this._suspendSubscriptions(),this._abortAllPendingEventsDueToBadConnection(n?"connectAbort":"disconnect"),this.options.autoReconnect&&(4e3==t||4001==t||1005==t?this._tryReconnect(0):1e3!=t&&t<4500&&this._tryReconnect()),n?o.prototype.emit.call(this,"connectAbort",t,e):o.prototype.emit.call(this,"disconnect",t,e),o.prototype.emit.call(this,"close",t,e),!S.ignoreStatuses[t]){var r;r=e?"Socket connection closed with status code "+t+" and reason: "+e:"Socket connection closed with status code "+t;var i=new b(S.errorStatuses[t]||r,t);this._onSCError(i)}},S.prototype._onSCEvent=function(t,e,n){var r=this._privateEventHandlerMap[t];r?r.call(this,e,n):o.prototype.emit.call(this,t,e,function(){n&&n.callback.apply(n,arguments)})},S.prototype.decode=function(t){return this.transport.decode(t)},S.prototype.encode=function(t){return this.transport.encode(t)},S.prototype._flushEmitBuffer=function(){for(var t,e=this._emitBuffer.head;e;){t=e.next;var n=e.data;e.detach(),this.transport.emitObject(n),e=t}},S.prototype._handleEventAckTimeout=function(t,e){e&&e.detach(),delete t.timeout;var n=t.callback;if(n){delete t.callback;var r=new m("Event response for '"+t.event+"' timed out");n.call(t,r,t)}t.cid&&this.transport.cancelPendingResponse(t.cid)},S.prototype._emit=function(t,e,n){var r=this;this.state==this.CLOSED&&this.connect();var o={event:t,callback:n},i=new h.Item;this.options.cloneData?o.data=l(e):o.data=e,i.data=o,o.timeout=setTimeout(function(){r._handleEventAckTimeout(o,i)},this.ackTimeout),this._emitBuffer.append(i),this.state==this.OPEN&&this._flushEmitBuffer()},S.prototype.send=function(t){this.transport.send(t)},S.prototype.emit=function(t,e,n){if(null==this._localEvents[t])this._emit(t,e,n);else if("error"==t)o.prototype.emit.call(this,t,e);else{var r=new g('The "'+t+'" event is reserved and cannot be emitted on a client socket');this._onSCError(r)}},S.prototype.publish=function(t,e,n){var r={channel:this._decorateChannelName(t),data:e};this.emit("#publish",r,n)},S.prototype._triggerChannelSubscribe=function(t,e){var n=t.name;if(t.state!=t.SUBSCRIBED){var r=t.state;t.state=t.SUBSCRIBED;var i={channel:n,oldState:r,newState:t.state,subscriptionOptions:e};t.emit("subscribeStateChange",i),t.emit("subscribe",n,e),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"subscribe",n,e)}},S.prototype._triggerChannelSubscribeFail=function(t,e,n){var r=e.name,i=!e.waitForAuth||this.authState==this.AUTHENTICATED;e.state!=e.UNSUBSCRIBED&&i&&(e.state=e.UNSUBSCRIBED,e.emit("subscribeFail",t,r,n),o.prototype.emit.call(this,"subscribeFail",t,r,n))},S.prototype._cancelPendingSubscribeCallback=function(t){null!=t._pendingSubscriptionCid&&(this.transport.cancelPendingResponse(t._pendingSubscriptionCid),delete t._pendingSubscriptionCid)},S.prototype._decorateChannelName=function(t){return this.channelPrefix&&(t=this.channelPrefix+t),t},S.prototype._undecorateChannelName=function(t){return this.channelPrefix&&0==t.indexOf(this.channelPrefix)?t.replace(this.channelPrefix,""):t},S.prototype._trySubscribe=function(t){var e=this,n=!t.waitForAuth||this.authState==this.AUTHENTICATED;if(this.state==this.OPEN&&!this.preparingPendingSubscriptions&&null==t._pendingSubscriptionCid&&n){var r={noTimeout:!0},i={channel:this._decorateChannelName(t.name)};t.waitForAuth&&(r.waitForAuth=!0,i.waitForAuth=r.waitForAuth),t.data&&(i.data=t.data),t.batch&&(r.batch=!0,i.batch=!0),t._pendingSubscriptionCid=this.transport.emit("#subscribe",i,r,function(n){delete t._pendingSubscriptionCid,n?e._triggerChannelSubscribeFail(n,t,i):e._triggerChannelSubscribe(t,i)}),o.prototype.emit.call(this,"subscribeRequest",t.name,i)}},S.prototype.subscribe=function(t,e){var n=this.channels[t];return n?e&&n.setOptions(e):(n=new i(t,this,e),this.channels[t]=n),n.state==n.UNSUBSCRIBED&&(n.state=n.PENDING,this._trySubscribe(n)),n},S.prototype._triggerChannelUnsubscribe=function(t,e){var n=t.name,r=t.state;if(t.state=e||t.UNSUBSCRIBED,this._cancelPendingSubscribeCallback(t),r==t.SUBSCRIBED){var i={channel:n,oldState:r,newState:t.state};t.emit("subscribeStateChange",i),t.emit("unsubscribe",n),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"unsubscribe",n)}},S.prototype._tryUnsubscribe=function(t){if(this.state==this.OPEN){var e={noTimeout:!0};t.batch&&(e.batch=!0),this._cancelPendingSubscribeCallback(t);var n=this._decorateChannelName(t.name);this.transport.emit("#unsubscribe",n,e)}},S.prototype.unsubscribe=function(t){var e=this.channels[t];e&&e.state!=e.UNSUBSCRIBED&&(this._triggerChannelUnsubscribe(e),this._tryUnsubscribe(e))},S.prototype.channel=function(t,e){var n=this.channels[t];return n||(n=new i(t,this,e),this.channels[t]=n),n},S.prototype.destroyChannel=function(t){var e=this.channels[t];e&&(e.unwatch(),e.unsubscribe(),delete this.channels[t])},S.prototype.subscriptions=function(t){var e,n=[];for(var r in this.channels)this.channels.hasOwnProperty(r)&&(e=this.channels[r],(t?e&&(e.state==e.SUBSCRIBED||e.state==e.PENDING):e&&e.state==e.SUBSCRIBED)&&n.push(r));return n},S.prototype.isSubscribed=function(t,e){var n=this.channels[t];return e?!!n&&(n.state==n.SUBSCRIBED||n.state==n.PENDING):!!n&&n.state==n.SUBSCRIBED},S.prototype.processPendingSubscriptions=function(){var t=this;this.preparingPendingSubscriptions=!1;var e=[];for(var n in this.channels)if(this.channels.hasOwnProperty(n)){var r=this.channels[n];r.state==r.PENDING&&e.push(r)}e.sort(function(t,e){var n=t.priority||0,r=e.priority||0;return n>r?-1:n<r?1:0}),e.forEach(function(e){t._trySubscribe(e)})},S.prototype.watch=function(t,e){if("function"!=typeof e)throw new d("No handler function was provided");this._channelEmitter.on(t,e)},S.prototype.unwatch=function(t,e){e?this._channelEmitter.removeListener(t,e):this._channelEmitter.removeAllListeners(t)},S.prototype.watchers=function(t){return this._channelEmitter.listeners(t)},t.exports=S}).call(this,n(0),n(7).Buffer)},function(t,e,n){var r=n(8),o=n(14);t.exports.factory=o,t.exports.SCClientSocket=r,t.exports.Emitter=n(2),t.exports.create=function(t){return o.create(t)},t.exports.connect=t.exports.create,t.exports.destroy=function(t){return o.destroy(t)},t.exports.clients=o.clients,t.exports.version="13.0.0"},function(t,e,n){"use strict";n.r(e);var r=n(9),o=n.n(r);function i(t){return t.name+"Client"}function s(t){return t.name+"Events"}function a(t){return t.name+"Hooks"}var c=["error","connect","disconnect","connectAbort","connecting","raw","kickOut","subscribe","subscribeFail","unsubscribe","authStateChange","authTokenChange","subscribeStateChange","subscribeRequest","authenticate","deauthenticate","message"];var u=new class{constructor(){this.connections=new Map}addEventSource(t){this.connections.set(a(t),new Map)}addListener(t,e,n,r){return"function"==typeof n&&(this.connections.get(a(t)).set(e,{callback:n,vm:r}),!0)}removeListener(t,e,n,r){let o=a(t);return!!this.connections.has(o)&&!this.connections.get(o).has(e)&&(this.connections.get(o).delete(e),!0)}emit(t,e,...n){let r=a(t),o=!1;if(!this.connections.has(r))return!1;if(o=this.connections.get(r).has(e)){let t=this.connections.get(r).get(e);return t.callback.call(t.vm,...n),!0}return!1}};var h=class{constructor(t){this.connection=o.a.connect(t),c.map(e=>{this.connection.on(e,n=>{u.emit(t,e,n)})}),this.connection.on("message",e=>{if("#1"!==e){let n=JSON.parse(e);u.emit(t,n.event?n.event.replace(/(\-\w)/g,function(t){return t[1].toUpperCase()}):"message",n.data)}})}},p=function(){var t=this.$createElement;return(this._self._c||t)("div")};p._withStripped=!0;var l=function(t,e,n,r,o,i,s,a){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),s?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=c):o&&(c=a?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var h=u.render;u.render=function(t,e){return c.call(e),h(t,e)}}else{var p=u.beforeCreate;u.beforeCreate=p?[].concat(p,c):[c]}return{exports:t,options:u}}({name:"socket-component",props:{event:{type:String,required:!1},channel:{type:String,required:!1},onMessage:{type:Function,required:!1},onDeauthenticate:{type:Function,required:!1},onAuthenticate:{type:Function,required:!1},onSubscribeRequest:{type:Function,required:!1},onSubscribeStateChange:{type:Function,required:!1},onAuthTokenChange:{type:Function,required:!1},onAuthStateChange:{type:Function,required:!1},onUnsubscribe:{type:Function,required:!1},onSubscribeFail:{type:Function,required:!1},onSubscribe:{type:Function,required:!1},onKickOut:{type:Function,required:!1},onRaw:{type:Function,required:!1},onConnectAbort:{type:Function,required:!1},onDisconnect:{type:Function,required:!1},onConnect:{type:Function,required:!1},onConnecting:{type:Function,required:!1},onError:{type:Function,required:!1},onDropOut:{type:Function,required:!1},onData:{type:Function,required:!1},data:{type:[String,Array,Object,Boolean,Number],required:!1}},__setSocketClientName__(t){this.socketClientName=t},mounted(){if(this.socket=this[this.constructor.options.socketClientName],!this.event&&!this.channel)throw new Error("The event or channel attribute must be set. Set the event attribute to listen for a socket event. Set the channel attribute to subscribe to a socket channel");"function"==typeof this.onConnect&&this.socket.on(this.event,this.onConnect),"function"==typeof this.onDisconnect&&this.socket.on(this.event,this.onDisconnect),"function"==typeof this.onConnectAbort&&this.socket.on(this.event,this.onConnectAbort),"function"==typeof this.onConnecting&&this.socket.on(this.event,this.onConnecting),"function"==typeof this.onRaw&&this.socket.on(this.event,this.onRaw),"function"==typeof this.onKickOut&&this.socket.on(this.event,this.onKickOut),"function"==typeof this.onSubscribe&&this.socket.on(this.event,this.onSubscribe),"function"==typeof this.onSubscribeFail&&this.socket.on(this.event,this.onSubscribeFail),"function"==typeof this.onUnsubscribe&&this.socket.on(this.event,this.onUnsubscribe),"function"==typeof this.onAuthStateChange&&this.socket.on(this.event,this.onAuthStateChange),"function"==typeof this.onAuthTokenChange&&this.socket.on(this.event,this.onAuthTokenChange),"function"==typeof this.onSubscribeStateChange&&this.socket.on(this.event,this.onSubscribeStateChange),"function"==typeof this.onSubscribeRequest&&this.socket.on(this.event,this.onSubscribeRequest),"function"==typeof this.onAuthenticate&&this.socket.on(this.event,this.onAuthenticate),"function"==typeof this.onDeauthenticate&&this.socket.on(this.event,this.onDeauthenticate),"function"==typeof this.onMessage&&this.socket.on(this.event,this.onMessage),"function"==typeof this.onData&&this.socket.on(this.event,this.onData),this.channel&&(this.socket.subscribe(this.channel),this.socket.watch(this.channel,this.onData))},meth