diff --git a/dist/colyseus.js b/dist/colyseus.js index 5bd668f..92a7991 100644 --- a/dist/colyseus.js +++ b/dist/colyseus.js @@ -1,4 +1,3 @@ -var Colyseus=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,e,r){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=62)}([function(t,e,r){"use strict";(function(t,n){function i(){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}}function o(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,r){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function v(e){return+e!=e&&(e=0),t.alloc(+e)}function g(e,r){if(t.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(i)return G(e).length;r=(""+r).toLowerCase(),i=!0}}function b(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(e,r,n,i,o){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=t.from(r,i)),t.isBuffer(r))return 0===r.length?-1:E(e,r,n,i,o);if("number"==typeof r)return r=255&r,t.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):E(e,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,u=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}var f;if(i){var c=-1;for(f=r;fa&&(r=a-u),f=r;f>=0;f--){for(var h=!0,l=0;li&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var u,f,c,h;switch(a){case 1:o<128&&(s=o);break;case 2:u=t[i+1],128===(192&u)&&(h=(31&o)<<6|63&u,h>127&&(s=h));break;case 3:u=t[i+1],f=t[i+2],128===(192&u)&&128===(192&f)&&(h=(15&o)<<12|(63&u)<<6|63&f,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:u=t[i+1],f=t[i+2],c=t[i+3],128===(192&u)&&128===(192&f)&&128===(192&c)&&(h=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&c,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return I(n)}function I(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function L(e,r,n,i,o,s){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||re.length)throw new RangeError("Index out of range")}function N(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function M(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y(t,e,r,n,i){return i||M(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,i){return i||M(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,r,n,52,8),r+8}function z(t){if(t=J(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function J(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function q(t){return X.toByteArray(z(t))}function Q(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function $(t){return t!==t}var X=r(47),Z=r(16),K=r(6);e.Buffer=t,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50,t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:i(),e.kMaxLength=o(),t.poolSize=8192,t._augment=function(e){return e.__proto__=t.prototype,e},t.from=function(t,e,r){return a(null,t,e,r)},t.TYPED_ARRAY_SUPPORT&&(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0})),t.alloc=function(t,e,r){return f(null,t,e,r)},t.allocUnsafe=function(t){return c(null,t)},t.allocUnsafeSlow=function(t){return c(null,t)},t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},t.prototype.compare=function(e,r,n,i,o){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,a=n-r,u=Math.min(s,a),f=this.slice(i,o),c=e.slice(r,n),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return k(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return P(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r0&&(i*=256);)n+=this[t+--e]*i;return n},t.prototype.readUInt8=function(t,e){return e||D(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||D(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||D(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||D(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||D(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return e||D(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||D(t,4,this.length),Z.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||D(t,4,this.length),Z.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||D(t,8,this.length),Z.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||D(t,8,this.length),Z.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e=0|e,r=0|r,!n){var i=Math.pow(2,8*r)-1;L(this,t,e,r,i,0)}var o=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+o]=t/s&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):N(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):N(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):j(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):j(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):N(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):N(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):j(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r=0|r,n||L(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):j(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return Y(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return Y(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},t.prototype.copy=function(e,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r=0;--o)e[o+r]=this[o+n];else if(s<1e3||!t.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var s;if("number"==typeof e)for(s=r;s=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&e._extend(n,r),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),u(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function s(t,e){return t}function a(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function u(t,r,n){if(t.customInspect&&r&&P(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return w(i)||(i=u(t,i,n)),i}var o=f(t,r);if(o)return o;var s=Object.keys(r),y=a(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),x(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return c(r);if(0===s.length){if(P(r)){var v=r.name?": "+r.name:"";return t.stylize("[Function"+v+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(k(r))return t.stylize(Date.prototype.toString.call(r),"date");if(x(r))return c(r)}var g="",b=!1,m=["{","}"];if(d(r)&&(b=!0,m=["[","]"]),P(r)){var E=r.name?": "+r.name:"";g=" [Function"+E+"]"}if(_(r)&&(g=" "+RegExp.prototype.toString.call(r)),k(r)&&(g=" "+Date.prototype.toUTCString.call(r)),x(r)&&(g=" "+c(r)),0===s.length&&(!b||0==r.length))return m[0]+g+m[1];if(n<0)return _(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var A;return A=b?h(t,r,n,y,s):s.map(function(e){return l(t,r,n,y,e,b)}),t.seen.pop(),p(A,g,m)}function f(t,e){if(E(e))return t.stylize("undefined","undefined");if(w(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return b(e)?t.stylize(""+e,"number"):y(e)?t.stylize(""+e,"boolean"):v(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var o=[],s=0,a=e.length;s-1&&(a=o?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function p(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function d(t){return Array.isArray(t)}function y(t){return"boolean"==typeof t}function v(t){return null===t}function g(t){return null==t}function b(t){return"number"==typeof t}function w(t){return"string"==typeof t}function m(t){return"symbol"==typeof t}function E(t){return void 0===t}function _(t){return A(t)&&"[object RegExp]"===S(t)}function A(t){return"object"==typeof t&&null!==t}function k(t){return A(t)&&"[object Date]"===S(t)}function x(t){return A(t)&&("[object Error]"===S(t)||t instanceof Error)}function P(t){return"function"==typeof t}function O(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function R(t){return t<10?"0"+t.toString(10):t.toString(10)}function I(){var t=new Date,e=[R(t.getHours()),R(t.getMinutes()),R(t.getSeconds())].join(":");return[t.getDate(),D[t.getMonth()],e].join(" ")}function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var B=/%[sdj%]/g;e.format=function(t){if(!w(t)){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),a=n[r];r0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,i,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,i=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e); -return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],n(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){(function(t){var r,n,i,o;!function(e){function s(t,r,n){function i(t,e,r,n){return this instanceof i?s(this,t,e,r,n):new i(t,e,r,n)}function o(t){return!(!t||!t[Y])}function s(t,e,r,n,i){if(E&&_&&(e instanceof _&&(e=new E(e)),n instanceof _&&(n=new E(n))),!(e||r||n||b))return void(t.buffer=l(A,0));if(!c(e,r)){var o=b||Array;i=r,n=e,r=0,e=new o(8)}t.buffer=e,t.offset=r|=0,w!==typeof n&&("string"==typeof n?g(e,r,n,i||10):c(n,i)?h(e,r,n,i):"number"==typeof i?(S(e,r+I,n),S(e,r+T,i)):n>0?L(e,r,n):n<0?N(e,r,n):h(e,r,A,0))}function g(t,e,r,n){var i=0,o=r.length,s=0,a=0;"-"===r[0]&&i++;for(var u=i;i=0))break;a=a*n+f,s=s*n+Math.floor(a/x),a%=x}u&&(s=~s,a?a=x-a:s++),S(t,e+I,s),S(t,e+T,a)}function k(){var t=this.buffer,e=this.offset,r=R(t,e+I),i=R(t,e+T);return n||(r|=0),r?r*x+i:i}function O(t){var e=this.buffer,r=this.offset,i=R(e,r+I),o=R(e,r+T),s="",a=!n&&2147483648&i;for(a&&(i=~i,o=x-o),t=t||10;;){var u=i%t*x+o;if(i=Math.floor(i/t),o=Math.floor(u/t),s=(u%t).toString(t)+s,!i&&!o)break}return a&&(s="-"+s),s}function S(t,e,r){t[e+D]=255&r,r>>=8,t[e+C]=255&r,r>>=8,t[e+U]=255&r,r>>=8,t[e+B]=255&r}function R(t,e){return t[e+B]*P+(t[e+U]<<16)+(t[e+C]<<8)+t[e+D]}var I=r?0:4,T=r?4:0,B=r?0:3,U=r?1:2,C=r?2:1,D=r?3:0,L=r?p:y,N=r?d:v,j=i.prototype,M="is"+t,Y="_"+M;return j.buffer=void 0,j.offset=0,j[Y]=!0,j.toNumber=k,j.toString=O,j.toJSON=k,j.toArray=a,m&&(j.toBuffer=u),E&&(j.toArrayBuffer=f),i[M]=o,e[t]=i,i}function a(t){var e=this.buffer,r=this.offset;return b=null,t!==!1&&0===r&&8===e.length&&k(e)?e:l(e,r)}function u(e){var r=this.buffer,n=this.offset;if(b=m,e!==!1&&0===n&&8===r.length&&t.isBuffer(r))return r;var i=new m(8);return h(i,0,r,n),i}function f(t){var e=this.buffer,r=this.offset,n=e.buffer;if(b=E,t!==!1&&0===r&&n instanceof _&&8===n.byteLength)return n;var i=new E(8);return h(i,0,e,r),i.buffer}function c(t,e){var r=t&&t.length;return e|=0,r&&e+8<=r&&"string"!=typeof t[e]}function h(t,e,r,n){e|=0,n|=0;for(var i=0;i<8;i++)t[e++]=255&r[n++]}function l(t,e){return Array.prototype.slice.call(t,e,e+8)}function p(t,e,r){for(var n=e+8;n>e;)t[--n]=255&r,r/=256}function d(t,e,r){var n=e+8;for(r++;n>e;)t[--n]=255&-r^255,r/=256}function y(t,e,r){for(var n=e+8;e>6,r[n++]=128|63&s):(r[n++]=224|s>>12,r[n++]=128|s>>6&63,r[n++]=128|63&s)}return n-e}function i(t,e){var r=this,n=t-0||0;e||(e=r.length);var i=e-t;i>l&&(i=l);for(var o=[];n1?o.join(""):o.length?o.shift():""}function o(t){var e=0;return Array.prototype.forEach.call(t,function(t){var r=t.charCodeAt(0);e+=r<128?1:r<2048?2:3}),e}function s(t,e,r,n){var i;r||(r=0),n||0===n||(n=this.length),e||(e=0);var o=n-r;if(t===this&&r=0;i--)t[i+e]=this[i+r];else for(i=0;i."+this._valueClasses[e])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=n.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e is not an instance of <"+this._valueClasses[i]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new i.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!=e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();e.OnceSignal=o},function(t,e,r){"use strict";var n=r(27),i=r(36),o=r(37),s=r(17),a=r(38),u=r(3),f=function(){function t(t,e){var r=this;this.onJoin=new n.Signal,this.onPatch=new n.Signal,this.onUpdate=new n.Signal,this.onData=new n.Signal,this.onError=new n.Signal,this.onLeave=new n.Signal,this.removeAllListeners=function(){r.onJoin.removeAll(),r.onPatch.removeAll(),r.onUpdate.removeAll(),r.onData.removeAll(),r.onError.removeAll(),r.onLeave.removeAll()},this.id=null,this.client=t,this.name=e,this.state={},this.clock=new i,this.remoteClock=new i,this.lastPatchTime=null,this.ping=null,this.onLeave.add(this.removeAllListeners)}return t.prototype.setState=function(t,e,r){this.state=t,this._previousState=s.encode(this.state),e&&r&&(this.remoteClock.currentTime=e,this.remoteClock.elapsedTime=r),this.clock.start(),this.onUpdate.dispatch(t)},t.prototype.patch=function(t){var e=Date.now();this.lastPatchTime&&(this.ping=e-this.lastPatchTime),this.lastPatchTime=e,this.clock.tick(),this._previousState=a.apply(this._previousState,t);var r=s.decode(this._previousState),n=o.compare(this.state,r);this.onPatch.dispatch(n),this.state=r,this.onUpdate.dispatch(this.state,n)},t.prototype.leave=function(){this.id>=0&&this.client.send([u.Protocol.LEAVE_ROOM,this.id])},t.prototype.send=function(t){this.client.send([u.Protocol.ROOM_DATA,this.id,t])},t}();e.Room=f},function(t,e,r){function n(t){i.EventEmitter.call(this),this.backoffStrategy_=t,this.maxNumberOfRetry_=-1,this.backoffNumber_=0,this.backoffDelay_=0,this.timeoutID_=-1,this.handlers={backoff:this.onBackoff_.bind(this)}}var i=r(4),o=r(9),s=r(1);s.inherits(n,i.EventEmitter),n.prototype.failAfter=function(t){o.checkArgument(t>0,"Expected a maximum number of retry greater than 0 but got %s.",t),this.maxNumberOfRetry_=t},n.prototype.backoff=function(t){o.checkState(this.timeoutID_===-1,"Backoff in progress."),this.backoffNumber_===this.maxNumberOfRetry_?(this.emit("fail",t),this.reset()):(this.backoffDelay_=this.backoffStrategy_.next(),this.timeoutID_=setTimeout(this.handlers.backoff,this.backoffDelay_),this.emit("backoff",this.backoffNumber_,this.backoffDelay_,t))},n.prototype.onBackoff_=function(){this.timeoutID_=-1,this.emit("ready",this.backoffNumber_,this.backoffDelay_),this.backoffNumber_++},n.prototype.reset=function(){this.backoffNumber_=0,this.backoffStrategy_.reset(),clearTimeout(this.timeoutID_),this.timeoutID_=-1},t.exports=n},function(t,e,r){function n(t){o.call(this,t),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()}var i=r(1),o=r(14);i.inherits(n,o),n.prototype.next_=function(){var t=Math.min(this.nextBackoffDelay_,this.getMaxDelay());return this.nextBackoffDelay_+=this.backoffDelay_,this.backoffDelay_=t,t},n.prototype.reset_=function(){this.nextBackoffDelay_=this.getInitialDelay(),this.backoffDelay_=0},t.exports=n},function(t,e,r){function n(t){return void 0!==t&&null!==t}function i(t){if(t=t||{},n(t.initialDelay)&&t.initialDelay<1)throw new Error("The initial timeout must be greater than 0.");if(n(t.maxDelay)&&t.maxDelay<1)throw new Error("The maximal timeout must be greater than 0.");if(this.initialDelay_=t.initialDelay||100,this.maxDelay_=t.maxDelay||1e4,this.maxDelay_<=this.initialDelay_)throw new Error("The maximal backoff delay must be greater than the initial backoff delay.");if(n(t.randomisationFactor)&&(t.randomisationFactor<0||t.randomisationFactor>1))throw new Error("The randomisation factor must be between 0 and 1.");this.randomisationFactor_=t.randomisationFactor||0}r(4),r(1);i.prototype.getMaxDelay=function(){return this.maxDelay_},i.prototype.getInitialDelay=function(){return this.initialDelay_},i.prototype.next=function(){var t=this.next_(),e=1+Math.random()*this.randomisationFactor_,r=Math.round(t*e);return r},i.prototype.next_=function(){throw new Error("BackoffStrategy.next_() unimplemented.")},i.prototype.reset=function(){this.reset_()},i.prototype.reset_=function(){throw new Error("BackoffStrategy.reset_() unimplemented.")},t.exports=i},function(t,e,r){function n(){if(!(this instanceof n))return new n}!function(e){function r(t){for(var e in f)t[e]=f[e];return t}function n(t,e){return a(this,t).push(e),this}function i(t,e){function r(){o.call(n,t,r),e.apply(this,arguments)}var n=this;return r.originalListener=e,a(n,t).push(r),n}function o(t,e){function r(t){return t!==e&&t.originalListener!==e}var n,i=this;if(arguments.length){if(e){if(n=a(i,t,!0)){if(n=n.filter(r),!n.length)return o.call(i,t);i[u][t]=n}}else if(n=i[u],n&&(delete n[t],!Object.keys(n).length))return o.call(i)}else delete i[u];return i}function s(t,e){function r(t){t.call(o)}function n(t){t.call(o,e)}function i(t){t.apply(o,f)}var o=this,s=a(o,t,!0);if(!s)return!1;var u=arguments.length;if(1===u)s.forEach(r);else if(2===u)s.forEach(n);else{var f=Array.prototype.slice.call(arguments,1);s.forEach(i)}return!!s.length}function a(t,e,r){if(!r||t[u]){var n=t[u]||(t[u]={});return n[e]||(n[e]=[])}}t.exports=e;var u="listeners",f={on:n,once:i,off:o,emit:s};r(e.prototype),e.mixin=r}(n)},function(t,e){e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,c=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+t[e+h],h+=l,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=l,c-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:(p?-1:1)*(1/0);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,f=8*o-i-1,c=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-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=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),e+=s+h>=1?l/u:l*Math.pow(2,1-h),e*u>=2&&(s++,u/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=d,s/=256,f-=8);t[r+p-d]|=128*y}},function(t,e,r){e.encode=r(22).encode,e.decode=r(20).decode,e.Encoder=r(40).Encoder,e.Decoder=r(39).Decoder,e.createCodec=r(24).createCodec,e.codec=r(8).codec},function(t,e){function r(){}e.BufferShortageError=r,r.prototype=Error.prototype},function(t,e,r){(function(t){function n(t){return this instanceof n?void(t&&(this.options=t,t.codec&&(this.codec=t.codec))):new n(t)}e.DecodeBuffer=n;var i=r(8).codec.preset,o=r(18).BufferShortageError;n.prototype.offset=0,n.prototype.push=function(t){var e=this.buffers||(this.buffers=[]);e.push(t)},n.prototype.codec=i,n.prototype.write=function(e){var r=this.offset?this.buffer.slice(this.offset):this.buffer;this.buffer=r?e?t.concat([r,e]):r:e,this.offset=0},n.prototype.read=function(){var t=this.buffers&&this.buffers.length;return t?(this.flush(),this.pull()):this.fetch()},n.prototype.pull=function(){var t=this.buffers||(this.buffers=[]);return t.shift()},n.prototype.fetch=function(){return this.codec.decode(this)},n.prototype.flush=function(){for(;this.offset1?t.concat(e):e[0];return e.length=0,r},n.prototype.fetch=function(){var t=this.start;if(to?e:o,this.buffer=new t(e),this.start=0,this.offset=0},n.prototype.send=function(t){var e=this.offset+t.length;this.buffer&&eo.length)throw new k;return x||!t.isBuffer(o)?A.readString.call(o,n,i):o.toString("utf-8",n,i)}function a(t,e){var r=t.offset,n=t.offset=r+e;if(n>t.buffer.length)throw new k;return b.call(t.buffer,r,n)}function u(t,e){var r=t.offset,n=t.offset=r+e+1;if(n>t.buffer.length)throw new k;var i=t.buffer[r],o=t.codec.getExtUnpacker(i);if(!o)throw new Error("Invalid ext type: "+(i?"0x"+i.toString(16):i));var s=b.call(t.buffer,r+1,n);return o(s)}function f(t){var e=t.buffer;if(t.offset>=e.length)throw new k;return e[t.offset++]}function c(t){var e=t.buffer;if(t.offset+2>e.length)throw new k;return e[t.offset++]<<8|e[t.offset++]}function h(t,e){return function(r){var n=r.offset,i=r.offset=n+t;if(i>r.buffer.length)throw new k;return e.call(r.buffer,n,P)}}function l(t){return new E(this,t).toNumber()}function p(t){return new _(this,t).toNumber()}function d(t){return new E(this,t)}function y(t){return new _(this,t)}function v(t){return this.readFloatBE?this.readFloatBE(t):w.read(this,t,!1,23,4)}function g(t){return this.readDoubleBE?this.readDoubleBE(t):w.read(this,t,!1,52,8)}function b(e,r){var n=this.slice||Array.prototype.slice,i=n.call(this,e,r);return t.isBuffer(i)||(i=t(i)),i}var w=r(16),m=r(5),E=m.Uint64BE,_=m.Int64BE;e.getReadFormat=n,e.readUint8=f;var A=r(7),k=r(18).BufferShortageError,x="TYPED_ARRAY_SUPPORT"in t,P=!0}).call(e,r(0).Buffer)},function(t,e){function r(t){return function(e){e.reserve(1),e.buffer[e.offset++]=t}}for(var n=e.uint8=new Array(256),i=0;i<=255;i++)n[i]=r(i)},function(t,e,r){"use strict";var n=r(51);e.DeluxeSignal=n.DeluxeSignal;var i=r(58);e.GenericEvent=i.GenericEvent;var o=r(52);e.IOnceSignal=o.IOnceSignal;var s=r(53);e.IPrioritySignal=s.IPrioritySignal;var a=r(54);e.ISignal=a.ISignal;var u=r(55);e.ISlot=u.ISlot;var f=r(56);e.MonoSignal=f.MonoSignal;var c=r(10);e.OnceSignal=c.OnceSignal;var h=r(28);e.PrioritySignal=h.PrioritySignal;var l=r(57);e.Promise=l.Promise;var p=r(29);e.Signal=p.Signal;var d=r(2);e.Slot=d.Slot;var y=r(30);e.SlotList=y.SlotList},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(29),o=r(2),s=function(t){function e(){for(var e=[],r=0;rthis.head.priority)return this.prepend(e);for(var n=new t(this.head),i=n,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return i.tail=o.prepend(e),n;i=i.tail=new t(o.head),o=o.tail}return i.tail=new t(e),n},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e==this.head.listener)return this.tail;for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;){if(i.head.listener==e)return n.tail=i.tail,r;n=n.tail=new t(i.head),i=i.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener==t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener==t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return t+="NIL","[List "+t+"]"},t}();r.NIL=new r(null,null),e.SlotList=r},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){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(61),o=r(17),s=r(3),a=r(11),u=r(27),f=function(t){function e(e,r,n){void 0===r&&(r=null),void 0===n&&(n={}),t.call(this,e,r,n),this.rooms={},this.onOpen=new u.Signal,this.onMessage=new u.Signal,this.onClose=new u.Signal,this.onError=new u.Signal,this._enqueuedCalls=[],this.binaryType="arraybuffer"}return n(e,t),e.prototype.onOpenCallback=function(t){if(this._enqueuedCalls.length>0)for(var e=0;e0&&this.backoff_.failAfter(this.failAfter_),this.state_=n.State_.RUNNING,this.doCall_(!1)},n.prototype.doCall_=function(t){t&&this.numRetries_++;var e=["call"].concat(this.arguments_);i.EventEmitter.prototype.emit.apply(this,e);var r=this.handleFunctionCallback_.bind(this);this.function_.apply(null,this.arguments_.concat(r))},n.prototype.doCallback_=function(){this.callback_.apply(null,this.lastResult_)},n.prototype.handleFunctionCallback_=function(){if(!this.isAborted()){var t=Array.prototype.slice.call(arguments);this.lastResult_=t,i.EventEmitter.prototype.emit.apply(this,["callback"].concat(t));var e=t[0];e&&this.retryPredicate_(e)?this.backoff_.backoff(e):(this.state_=n.State_.COMPLETED,this.doCallback_())}},n.prototype.handleBackoff_=function(t,e,r){this.emit("backoff",t,e,r)},t.exports=n},function(t,e,r){function n(t){s.call(this,t),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay(),this.factor_=n.DEFAULT_FACTOR,t&&void 0!==t.factor&&(o.checkArgument(t.factor>1,"Exponential factor should be greater than 1 but got %s.",t.factor),this.factor_=t.factor)}var i=r(1),o=r(9),s=r(14);i.inherits(n,s),n.DEFAULT_FACTOR=2,n.prototype.next_=function(){return this.backoffDelay_=Math.min(this.nextBackoffDelay_,this.getMaxDelay()),this.nextBackoffDelay_=this.backoffDelay_*this.factor_,this.backoffDelay_},n.prototype.reset_=function(){this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()},t.exports=n},function(t,e){"use strict";var r=function(){function t(t){void 0===t&&(t=!1),this.running=!1,this.deltaTime=0,this.currentTime=0,this.elapsedTime=0,this.now="undefined"!=typeof window&&window.performance&&window.performance.now.bind(window.performance)||Date.now,this.start(),t&&setInterval(this.tick.bind(this),1e3/60)}return t.prototype.start=function(){this.deltaTime=0,this.currentTime=this.now(),this.elapsedTime=0,this.running=!0},t.prototype.stop=function(){this.running=!1},t.prototype.tick=function(t){void 0===t&&(t=this.now()),this.deltaTime=t-this.currentTime,this.currentTime=t,this.elapsedTime+=this.deltaTime},t}();t.exports=r},function(t,e,r){var n;!function(t){function e(t,r){switch(typeof t){case"undefined":case"boolean":case"string":case"number":return t===r;case"object":if(null===t)return null===r;if(x(t)){if(!x(r)||t.length!==r.length)return!1;for(var n=0,i=t.length;n0&&(t.patches=[],t.callback&&t.callback(i)),i}function c(t,e,n,i){for(var o=b(e),s=b(t),u=!1,f=!1,h=s.length-1;h>=0;h--){var l=s[h],p=t[l];if(!e.hasOwnProperty(l)||void 0===e[l]&&x(e)===!1)n.push({op:"remove",path:i+"/"+r(l)}),f=!0;else{var d=e[l];"object"==typeof p&&null!=p&&"object"==typeof d&&null!=d?c(p,d,n,i+"/"+r(l)):p!=d&&(u=!0,n.push({op:"replace",path:i+"/"+r(l),value:a(d)}))}}if(f||o.length!=s.length)for(var h=0;h=48&&e<=57))return!1;r++}}return!0}function l(t,e,r){for(var n,i,o=[],s=0,a=e.length;s=p){o.push(E[n.op].call(n,c,i,t));break}if(x(c)){if("-"===i)i=c.length;else{if(r&&!h(i))throw new P("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s-1,n.path,n);i=parseInt(i,10)}if(l>=p){if(r&&"add"===n.op&&i>c.length)throw new P("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s-1,n.path,n);o.push(m[n.op].call(n,c,i,t));break}}else if(i&&i.indexOf("~")!=-1&&(i=i.replace(/~1/g,"/").replace(/~0/g,"~")),l>=p){o.push(w[n.op].call(n,c,i,t));break}c=c[i]}}return o}function p(t,e){var r=[];return c(t,e,r,""),r}function d(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function y(t){if(void 0===t)return!0;if("array"==typeof t||"object"==typeof t)for(var e in t)if(y(t[e]))return!0;return!1}function v(e,r,n,i){if("object"!=typeof e||null===e||x(e))throw new P("Operation is not an object","OPERATION_NOT_AN_OBJECT",r,e,n);if(!w[e.op])throw new P("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",r,e,n);if("string"!=typeof e.path)throw new P("Operation `path` property is not a string","OPERATION_PATH_INVALID",r,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new P('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",r,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new P("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",r,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new P("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",r,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&y(e.value))throw new P("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",r,e,n);if(n)if("add"==e.op){var o=e.path.split("/").length,s=i.split("/").length;if(o!==s+1&&o!==s)throw new P("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",r,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==i)throw new P("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",r,e,n)}else if("move"===e.op||"copy"===e.op){var a={op:"_get",path:e.from,value:void 0},u=t.validate([a],n);if(u&&"OPERATION_PATH_UNRESOLVABLE"===u.name)throw new P("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",r,e,n)}}function g(t,e){try{if(!x(t))throw new P("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)e=JSON.parse(JSON.stringify(e)),l.call(this,e,t,!0);else for(var r=0;r=r;e++,r<<=6);return e}function i(t){for(var e=0,r=0,n=0,i=0,o=0,s=t.length;s>=16;)e=e+t[o+0]|0,r=r+t[o+1]|0,n=n+t[o+2]|0,i=i+t[o+3]|0,e=e+t[o+4]|0,r=r+t[o+5]|0,n=n+t[o+6]|0,i=i+t[o+7]|0,e=e+t[o+8]|0,r=r+t[o+9]|0,n=n+t[o+10]|0,i=i+t[o+11]|0,e=e+t[o+12]|0,r=r+t[o+13]|0,n=n+t[o+14]|0,i=i+t[o+15]|0,o+=16,s-=16;for(;s>=4;)e=e+t[o+0]|0,r=r+t[o+1]|0,n=n+t[o+2]|0,i=i+t[o+3]|0,o+=4,s-=4;switch(i=((i+(n<<8)|0)+(r<<16)|0)+(e<<24)|0,s){case 3:i=i+(t[o+2]<<8)|0;case 2:i=i+(t[o+1]<<16)|0;case 1:i=i+(t[o+0]<<24)|0}return i>>>0}var o={},s=16;t.prototype.init=function(t,e){var r,n,i=0,o=0;for(r=0;r>>0};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~".split("").map(function(t){return t.charCodeAt(0)}),u=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];return e.prototype.haveBytes=function(){return this.posthis.a.length)throw new RangeError("out of bounds");return t},e.prototype.getChar=function(){return String.fromCharCode(this.getByte())},e.prototype.getInt=function(){for(var t,e=0;this.haveBytes()&&(t=u[127&this.getByte()])>=0;)e=(e<<6)+t;return this.pos--,e>>>0},r.prototype.toArray=function(){return this.a},r.prototype.putByte=function(t){this.a.push(255&t)},r.prototype.putChar=function(t){this.putByte(t.charCodeAt(0))},r.prototype.putInt=function(t){var e,r,n=[];if(0===t)return void this.putChar("0");for(e=0;t>0;e++,t>>>=6)n.push(a[63&t]);for(r=e-1;r>=0;r--)this.putByte(n[r])},r.prototype.putArray=function(t,e,r){for(var n=e;n=0&&A-- >0;){var k,x,P,O,S,R,I,T;for(g=b*s,O=0,R=g,I=_+a;R=T&&k>w&&(w=k,m=g-S,E=P),b=p[b]}if(w>0){E>0&&(u.putInt(E),u.putChar(":"),u.putArray(o,_,_+E),_+=E),_+=w,u.putInt(w),u.putChar("@"),u.putInt(m),u.putChar(","),m+w-1>h&&(h=m+w-1),w=0;break}if(_+a+s>=f){u.putInt(f-_),u.putChar(":"),u.putArray(o,_,_+f-_),_=f;break}v.next(o[_+a+s]),a++}return _o)throw new Error("copy exceeds output file size");if(l+h>u)throw new Error("copy extends past end of input");c.putArray(t,l,l+h);break;case":":if(s+=h,s>o)throw new Error("insert command gives an output larger than predicted");if(h>f)throw new Error("insert count exceeds size of delta");c.putArray(a.a,a.pos,a.pos+h),a.pos+=h;break;case";":var p=c.toArray();if(h!==i(p))throw new Error("bad checksum");if(s!==o)throw new Error("generated size does not match predicted size");return p;default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")},o})},function(t,e,r){function n(t){return this instanceof n?void o.call(this,t):new n(t)}e.Decoder=n;var i=r(15),o=r(19).DecodeBuffer;n.prototype=new o,i.mixin(n.prototype),n.prototype.decode=function(t){arguments.length&&this.write(t),this.flush()},n.prototype.push=function(t){this.emit("data",t)},n.prototype.end=function(t){this.decode(t),this.emit("end")}},function(t,e,r){function n(t){return this instanceof n?void o.call(this,t):new n(t)}e.Encoder=n;var i=r(15),o=r(21).EncodeBuffer;n.prototype=new o,i.mixin(n.prototype),n.prototype.encode=function(t){this.write(t),this.emit("data",this.read())},n.prototype.end=function(t){arguments.length&&this.encode(t),this.flush(),this.emit("end")}},function(t,e,r){(function(t){function n(t){i(t),o(t)}function i(t){t.addExtPacker(14,Error,[l,s]),t.addExtPacker(1,EvalError,[l,s]),t.addExtPacker(2,RangeError,[l,s]),t.addExtPacker(3,ReferenceError,[l,s]),t.addExtPacker(4,SyntaxError,[l,s]),t.addExtPacker(5,TypeError,[l,s]),t.addExtPacker(6,URIError,[l,s]),t.addExtPacker(10,RegExp,[c,s]),t.addExtPacker(11,Boolean,[f,s]),t.addExtPacker(12,String,[f,s]),t.addExtPacker(13,Date,[Number,s]),t.addExtPacker(15,Number,[f,s]),m&&(t.addExtPacker(17,Int8Array,u),t.addExtPacker(18,Uint8Array,u),t.addExtPacker(19,Int16Array,y),t.addExtPacker(20,Uint16Array,y),t.addExtPacker(21,Int32Array,y),t.addExtPacker(22,Uint32Array,y),t.addExtPacker(23,Float32Array,y),E&&t.addExtPacker(24,Float64Array,y),_&&(t.addExtPacker(25,Uint8ClampedArray,u),t.addExtUnpacker(25,d(Uint8ClampedArray))),t.addExtPacker(26,ArrayBuffer,v),t.addExtPacker(29,DataView,y),t.addExtUnpacker(26,g),t.addExtUnpacker(29,[g,d(DataView)]))}function o(t){t.addExtPacker(14,Error,[l,s]),t.addExtPacker(1,EvalError,[l,s]),t.addExtPacker(2,RangeError,[l,s]),t.addExtPacker(3,ReferenceError,[l,s]),t.addExtPacker(4,SyntaxError,[l,s]),t.addExtPacker(5,TypeError,[l,s]),t.addExtPacker(6,URIError,[l,s]),t.addExtUnpacker(14,[a,p(Error)]),t.addExtUnpacker(1,[a,p(EvalError)]),t.addExtUnpacker(2,[a,p(RangeError)]),t.addExtUnpacker(3,[a,p(ReferenceError)]),t.addExtUnpacker(4,[a,p(SyntaxError)]),t.addExtUnpacker(5,[a,p(TypeError)]),t.addExtUnpacker(6,[a,p(URIError)]),t.addExtPacker(10,RegExp,[c,s]),t.addExtPacker(11,Boolean,[f,s]),t.addExtPacker(12,String,[f,s]),t.addExtPacker(13,Date,[Number,s]),t.addExtPacker(15,Number,[f,s]),t.addExtUnpacker(10,[a,h]),t.addExtUnpacker(11,[a,d(Boolean)]),t.addExtUnpacker(12,[a,d(String)]),t.addExtUnpacker(13,[a,d(Date)]),t.addExtUnpacker(15,[a,d(Number)]),m&&(t.addExtPacker(17,Int8Array,u),t.addExtPacker(18,Uint8Array,u),t.addExtPacker(19,Int16Array,y),t.addExtPacker(20,Uint16Array,y),t.addExtPacker(21,Int32Array,y),t.addExtPacker(22,Uint32Array,y),t.addExtPacker(23,Float32Array,y),t.addExtUnpacker(17,d(Int8Array)),t.addExtUnpacker(18,d(Uint8Array)),t.addExtUnpacker(19,[g,d(Int16Array)]),t.addExtUnpacker(20,[g,d(Uint16Array)]),t.addExtUnpacker(21,[g,d(Int32Array)]),t.addExtUnpacker(22,[g,d(Uint32Array)]),t.addExtUnpacker(23,[g,d(Float32Array)]),E&&(t.addExtPacker(24,Float64Array,y),t.addExtUnpacker(24,[g,d(Float64Array)])),_&&(t.addExtPacker(25,Uint8ClampedArray,u),t.addExtUnpacker(25,d(Uint8ClampedArray))),t.addExtPacker(26,ArrayBuffer,v),t.addExtPacker(29,DataView,y),t.addExtUnpacker(26,g),t.addExtUnpacker(29,[g,d(DataView)]))}function s(t){return b||(b=r(22).encode),b(t)}function a(t){return w||(w=r(20).decode),w(t)}function u(e){return new t(e)}function f(t){return t.valueOf()}function c(t){t=RegExp.prototype.toString.call(t).split("/"),t.shift();var e=[t.pop()];return e.unshift(t.join("/")),e}function h(t){return RegExp.apply(null,t)}function l(t){var e={};for(var r in A)e[r]=t[r];return e}function p(t){return function(e){var r=new t;for(var n in A)r[n]=e[n];return r}}function d(t){return function(e){return new t(e)}}function y(e){return new t(new Uint8Array(e.buffer))}function v(e){return new t(new Uint8Array(e))}function g(t){return new Uint8Array(t).buffer}e.setExtPreset=n;var b,w,m="undefined"!=typeof Uint8Array,E="undefined"!=typeof Float64Array,_="undefined"!=typeof Uint8ClampedArray,A={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1}}).call(e,r(0).Buffer)},function(t,e,r){function n(t){function e(t){var e=i(t),n=r[e];if(!n)throw new Error("Invalid type: "+(e?"0x"+e.toString(16):e));return n(t)}var r=o.getReadToken(t);return e}e.getDecoder=n;var i=r(25).readUint8,o=r(43)},function(t,e,r){function n(t){var e=f.getReadFormat(t);return t&&t.useraw?o(e):i(e)}function i(t){var e,r=new Array(256);for(e=0;e<=127;e++)r[e]=s(e);for(e=128;e<=143;e++)r[e]=u(e-128,t.map);for(e=144;e<=159;e++)r[e]=u(e-144,t.array);for(e=160;e<=191;e++)r[e]=u(e-160,t.str);for(r[192]=s(null),r[193]=null,r[194]=s(!1),r[195]=s(!0),r[196]=a(t.uint8,t.bin),r[197]=a(t.uint16,t.bin),r[198]=a(t.uint32,t.bin),r[199]=a(t.uint8,t.ext),r[200]=a(t.uint16,t.ext),r[201]=a(t.uint32,t.ext),r[202]=t.float32,r[203]=t.float64,r[204]=t.uint8,r[205]=t.uint16,r[206]=t.uint32,r[207]=t.uint64,r[208]=t.int8,r[209]=t.int16,r[210]=t.int32,r[211]=t.int64,r[212]=u(1,t.ext),r[213]=u(2,t.ext),r[214]=u(4,t.ext),r[215]=u(8,t.ext),r[216]=u(16,t.ext),r[217]=a(t.uint8,t.str),r[218]=a(t.uint16,t.str),r[219]=a(t.uint32,t.str),r[220]=a(t.uint16,t.array),r[221]=a(t.uint32,t.array),r[222]=a(t.uint16,t.map),r[223]=a(t.uint32,t.map),e=224;e<=255;e++)r[e]=s(e-256);return r}function o(t){var e,r=n(t).slice();for(r[217]=r[196],r[218]=r[197],r[219]=r[198],e=160;e<=191;e++)r[e]=u(e-160,t.bin);return r}function s(t){return function(){return t}}function a(t,e){return function(r){var n=t(r);return e(r,n)}}function u(t,e){return function(r){return e(r,t)}}var f=r(25);e.getReadToken=n},function(t,e,r){function n(t){function e(t,e){var n=r[typeof e];if(!n)throw new Error('Unsupported type "'+typeof e+'": '+e);n(t,e)}var r=i.getWriteType(t);return e}e.getEncoder=n;var i=r(46)},function(t,e,r){(function(t){function n(t){return p||t&&t.safe?o():i()}function i(){var e=h.slice();return e[196]=s(196),e[197]=a(197),e[198]=u(198),e[199]=s(199),e[200]=a(200),e[201]=u(201),e[202]=f(202,4,t.prototype.writeFloatBE,!0),e[203]=f(203,8,t.prototype.writeDoubleBE,!0),e[204]=s(204),e[205]=a(205),e[206]=u(206),e[207]=f(207,8,c.writeUint64BE),e[208]=s(208),e[209]=a(209),e[210]=u(210),e[211]=f(211,8,c.writeUint64BE),e[217]=s(217),e[218]=a(218),e[219]=u(219),e[220]=a(220),e[221]=u(221),e[222]=a(222),e[223]=u(223),e}function o(){var e=h.slice();return e[196]=f(196,1,t.prototype.writeUInt8),e[197]=f(197,2,t.prototype.writeUInt16BE),e[198]=f(198,4,t.prototype.writeUInt32BE),e[199]=f(199,1,t.prototype.writeUInt8),e[200]=f(200,2,t.prototype.writeUInt16BE),e[201]=f(201,4,t.prototype.writeUInt32BE),e[202]=f(202,4,t.prototype.writeFloatBE),e[203]=f(203,8,t.prototype.writeDoubleBE),e[204]=f(204,1,t.prototype.writeUInt8),e[205]=f(205,2,t.prototype.writeUInt16BE),e[206]=f(206,4,t.prototype.writeUInt32BE),e[207]=f(207,8,c.writeUint64BE),e[208]=f(208,1,t.prototype.writeInt8),e[209]=f(209,2,t.prototype.writeInt16BE),e[210]=f(210,4,t.prototype.writeInt32BE),e[211]=f(211,8,c.writeUint64BE),e[217]=f(217,1,t.prototype.writeUInt8),e[218]=f(218,2,t.prototype.writeUInt16BE),e[219]=f(219,4,t.prototype.writeUInt32BE),e[220]=f(220,2,t.prototype.writeUInt16BE),e[221]=f(221,4,t.prototype.writeUInt32BE),e[222]=f(222,2,t.prototype.writeUInt16BE),e[223]=f(223,4,t.prototype.writeUInt32BE),e}function s(t){return function(e,r){e.reserve(2);var n=e.buffer,i=e.offset;n[i++]=t,n[i++]=r,e.offset=i}}function a(t){return function(e,r){e.reserve(3);var n=e.buffer,i=e.offset;n[i++]=t,n[i++]=r>>>8,n[i++]=r,e.offset=i}}function u(t){return function(e,r){e.reserve(5);var n=e.buffer,i=e.offset;n[i++]=t,n[i++]=r>>>24,n[i++]=r>>>16,n[i++]=r>>>8,n[i++]=r,e.offset=i}}function f(t,e,r,n){return function(i,o){i.reserve(e+1),i.buffer[i.offset++]=t,r.call(i.buffer,o,i.offset,n),i.offset+=e}}var c=r(7),h=r(26).uint8,l="TYPED_ARRAY_SUPPORT"in t,p=l&&!t.TYPED_ARRAY_SUPPORT;e.getWriteToken=n}).call(e,r(0).Buffer)},function(t,e,r){(function(t){function n(e){function r(t,e){var r=e?195:194;k[r](t,e)}function n(t,e){var r,n=0|e;return e!==n?(r=203,void k[r](t,e)):(r=-32<=n&&n<=127?255&n:0<=n?n<=255?204:n<=65535?205:206:-128<=n?208:-32768<=n?209:210,void k[r](t,n))}function s(t,e){var r=207;k[r](t,e.toArray())}function p(t,e){var r=211;k[r](t,e.toArray())}function y(t,e){var r=e.length,n=5+3*r;t.reserve(n);var o=r<32?1:r<=255?2:r<=65535?3:5,s=t.offset+o;r=f.writeString.call(t.buffer,e,s);var a=r<32?1:r<=255?2:r<=65535?3:5;o!==a&&i(t,s,r,a-o);var u=1===a?160+r:a<=3?215+a:219;k[u](t,r),t.offset+=r}function v(e,r){if(null===r)return g(e,r);if(t.isBuffer(r))return w(e,r);if(o(r))return b(e,r);if(a.isUint64BE(r))return s(e,r);if(u.isInt64BE(r))return p(e,r);var n=e.codec.getExtPacker(r);return n&&(r=n(r)),r instanceof l?m(e,r):void E(e,r)}function g(t,e){var r=192;k[r](t,e)}function b(t,e){var r=e.length,n=r<16?144+r:r<=65535?220:221;k[n](t,r);for(var i=t.codec.encode,o=0;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-r(t)}function i(t){var e,n,i,o,s,a,u=t.length;s=r(t),a=new c(3*u/4-s),i=s>0?u-4:u;var h=0;for(e=0,n=0;e>16&255,a[h++]=o>>8&255,a[h++]=255&o;return 2===s?(o=f[t.charCodeAt(e)]<<2|f[t.charCodeAt(e+1)]>>4,a[h++]=255&o):1===s&&(o=f[t.charCodeAt(e)]<<10|f[t.charCodeAt(e+1)]<<4|f[t.charCodeAt(e+2)]>>2,a[h++]=o>>8&255,a[h++]=255&o),a}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],s=e;sc?c:f+a));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=n,e.toByteArray=i,e.fromByteArray=a;for(var u=[],f=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=h.length;l1)for(var r=1;r is not an instance of <"+this._valueClasses[i]+">.");var o=t[0];o&&(o.target&&(o=o.clone(),t[0]=o),o.target=this.target,o.currentTarget=this.target,o.signal=this);for(var s=this.slots;s.nonEmpty;)s.head.execute(t),s=s.tail;if(o&&o.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(a=a.parent)&&(void 0===a.onEventBubbled||(o.currentTarget=a,!a.onEventBubbled(o))););},e}(i.PrioritySignal);e.DeluxeSignal=o},function(t,e){"use strict";e.IOnceSignal=Symbol("IOnceSignal")},function(t,e){"use strict";e.IPrioritySignal=Symbol("IPrioritySignal")},function(t,e){"use strict";e.ISignal=Symbol("ISignal")},function(t,e){"use strict";e.ISlot=Symbol("ISlot")},function(t,e,r){"use strict";var n=r(2),i=function(){function t(){for(var t=[],e=0;e."+this._valueClasses[e])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),t.prototype.add=function(t){return this.registerListener(t)},t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){if(this.slot&&this.slot.listener==t){var e=this.slot;return this.slot=null,e}return null},t.prototype.removeAll=function(){this.slot&&this.slot.remove()},t.prototype.dispatch=function(){for(var t=[],e=0;e is not an instance of <"+this._valueClasses[i]+">.");this.slot&&this.slot.execute(t)},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new n.Slot(t,this,e)},t}();e.MonoSignal=i},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(10),o=function(t){function e(){return t.apply(this,arguments)||this}return n(e,t),e.prototype.addOnce=function(e){var r=t.prototype.addOnce.call(this,e);return this.isDispatched&&(r.execute(this.valueObjects),r.remove()),r},e.prototype.dispatch=function(){for(var e=[],r=0;r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&e._extend(n,r),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),u(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function s(t,e){return t}function a(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function u(t,r,n){if(t.customInspect&&r&&S(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return m(i)||(i=u(t,i,n)),i}var o=f(t,r);if(o)return o;var s=Object.keys(r),d=a(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),k(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return c(r);if(0===s.length){if(S(r)){var v=r.name?": "+r.name:"";return t.stylize("[Function"+v+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(x(r))return t.stylize(Date.prototype.toString.call(r),"date");if(k(r))return c(r)}var g="",b=!1,w=["{","}"];if(y(r)&&(b=!0,w=["[","]"]),S(r)){var E=r.name?": "+r.name:"";g=" [Function"+E+"]"}if(_(r)&&(g=" "+RegExp.prototype.toString.call(r)),x(r)&&(g=" "+Date.prototype.toUTCString.call(r)),k(r)&&(g=" "+c(r)),0===s.length&&(!b||0==r.length))return w[0]+g+w[1];if(n<0)return _(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var A;return A=b?h(t,r,n,d,s):s.map(function(e){return l(t,r,n,d,e,b)}),t.seen.pop(),p(A,g,w)}function f(t,e){if(E(e))return t.stylize("undefined","undefined");if(m(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return b(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):v(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var o=[],s=0,a=e.length;s-1&&(a=o?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function p(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function y(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function v(t){return null===t}function g(t){return null==t}function b(t){return"number"==typeof t}function m(t){return"string"==typeof t}function w(t){return"symbol"==typeof t}function E(t){return void 0===t}function _(t){return A(t)&&"[object RegExp]"===B(t)}function A(t){return"object"==typeof t&&null!==t}function x(t){return A(t)&&"[object Date]"===B(t)}function k(t){return A(t)&&("[object Error]"===B(t)||t instanceof Error)}function S(t){return"function"==typeof t}function P(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function B(t){return Object.prototype.toString.call(t)}function O(t){return t<10?"0"+t.toString(10):t.toString(10)}function R(){var t=new Date,e=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":");return[t.getDate(),D[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var T=/%[sdj%]/g;e.format=function(t){if(!m(t)){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),a=n[r];r=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function v(e){return+e!=e&&(e=0),t.alloc(+e)}function g(e,r){if(t.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return $(e).length;default:if(i)return V(e).length;r=(""+r).toLowerCase(),i=!0}}function b(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(e,r,n,i,o){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=t.from(r,i)),t.isBuffer(r))return 0===r.length?-1:E(e,r,n,i,o);if("number"==typeof r)return r&=255,t.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):E(e,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,u=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}var f;if(i){var c=-1;for(f=r;fa&&(r=a-u),f=r;f>=0;f--){for(var h=!0,l=0;li&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var u,f,c,h;switch(a){case 1:o<128&&(s=o);break;case 2:u=t[i+1],128===(192&u)&&(h=(31&o)<<6|63&u,h>127&&(s=h));break;case 3:u=t[i+1],f=t[i+2],128===(192&u)&&128===(192&f)&&(h=(15&o)<<12|(63&u)<<6|63&f,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:u=t[i+1],f=t[i+2],c=t[i+3],128===(192&u)&&128===(192&f)&&128===(192&c)&&(h=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&c,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return R(n)}function R(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function L(e,r,n,i,o,s){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||re.length)throw new RangeError("Index out of range")}function N(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function M(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function j(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y(t,e,r,n,i){return i||j(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,i){return i||j(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(t,e,r,n,52,8),r+8}function z(t){if(t=J(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function J(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function G(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function $(t){return Q.toByteArray(z(t))}function q(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Z(t){return t!==t}var Q=r(38),X=r(8),K=r(2);e.Buffer=t,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50,t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:i(),e.kMaxLength=o(),t.poolSize=8192,t._augment=function(e){return e.__proto__=t.prototype,e},t.from=function(t,e,r){return a(null,t,e,r)},t.TYPED_ARRAY_SUPPORT&&(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0})),t.alloc=function(t,e,r){return f(null,t,e,r)},t.allocUnsafe=function(t){return c(null,t)},t.allocUnsafeSlow=function(t){return c(null,t)},t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},t.prototype.compare=function(e,r,n,i,o){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,a=n-r,u=Math.min(s,a),f=this.slice(i,o),c=e.slice(r,n),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r0&&(i*=256);)n+=this[t+--e]*i;return n},t.prototype.readUInt8=function(t,e){return e||D(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||D(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||D(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||D(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||D(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return e||D(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||D(t,4,this.length),X.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||D(t,4,this.length),X.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||D(t,8,this.length),X.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||D(t,8,this.length),X.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;L(this,t,e,r,i,0)}var o=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+o]=t/s&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):N(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):N(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):M(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):M(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):N(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):N(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):M(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r|=0,n||L(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):M(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return Y(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return Y(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},t.prototype.copy=function(e,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r=0;--o)e[o+r]=this[o+n];else if(s<1e3||!t.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var s;if("number"==typeof e)for(s=r;s0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,i,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,i=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],n(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e){e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,c=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+t[e+h],h+=l,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=l,c-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:(p?-1:1)*(1/0);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,f=8*o-i-1,c=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,d=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=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),e+=s+h>=1?l/u:l*Math.pow(2,1-h),e*u>=2&&(s++,u/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=y,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=y,s/=256,f-=8);t[r+p-y]|=128*d}},function(t,e,r){(function(t){var r,n,i,o;!function(e){function s(t,r,n){function i(t,e,r,n){return this instanceof i?s(this,t,e,r,n):new i(t,e,r,n)}function o(t){return!(!t||!t[Y])}function s(t,e,r,n,i){if(E&&_&&(e instanceof _&&(e=new E(e)),n instanceof _&&(n=new E(n))),!(e||r||n||b))return void(t.buffer=l(A,0));if(!c(e,r)){var o=b||Array;i=r,n=e,r=0,e=new o(8)}t.buffer=e,t.offset=r|=0,m!==typeof n&&("string"==typeof n?g(e,r,n,i||10):c(n,i)?h(e,r,n,i):"number"==typeof i?(B(e,r+R,n),B(e,r+I,i)):n>0?L(e,r,n):n<0?N(e,r,n):h(e,r,A,0))}function g(t,e,r,n){var i=0,o=r.length,s=0,a=0;"-"===r[0]&&i++;for(var u=i;i=0))break;a=a*n+f,s=s*n+Math.floor(a/k),a%=k}u&&(s=~s,a?a=k-a:s++),B(t,e+R,s),B(t,e+I,a)}function x(){var t=this.buffer,e=this.offset,r=O(t,e+R),i=O(t,e+I);return n||(r|=0),r?r*k+i:i}function P(t){var e=this.buffer,r=this.offset,i=O(e,r+R),o=O(e,r+I),s="",a=!n&&2147483648&i;for(a&&(i=~i,o=k-o),t=t||10;;){var u=i%t*k+o;if(i=Math.floor(i/t),o=Math.floor(u/t),s=(u%t).toString(t)+s,!i&&!o)break}return a&&(s="-"+s),s}function B(t,e,r){t[e+D]=255&r,r>>=8,t[e+C]=255&r,r>>=8,t[e+U]=255&r,r>>=8,t[e+T]=255&r}function O(t,e){return t[e+T]*S+(t[e+U]<<16)+(t[e+C]<<8)+t[e+D]}var R=r?0:4,I=r?4:0,T=r?0:3,U=r?1:2,C=r?2:1,D=r?3:0,L=r?p:d,N=r?y:v,M=i.prototype,j="is"+t,Y="_"+j;return M.buffer=void 0,M.offset=0,M[Y]=!0,M.toNumber=x,M.toString=P,M.toJSON=x,M.toArray=a,w&&(M.toBuffer=u),E&&(M.toArrayBuffer=f),i[j]=o,e[t]=i,i}function a(t){var e=this.buffer,r=this.offset;return b=null,t!==!1&&0===r&&8===e.length&&x(e)?e:l(e,r)}function u(e){var r=this.buffer,n=this.offset;if(b=w,e!==!1&&0===n&&8===r.length&&t.isBuffer(r))return r;var i=new w(8);return h(i,0,r,n),i}function f(t){var e=this.buffer,r=this.offset,n=e.buffer;if(b=E,t!==!1&&0===r&&n instanceof _&&8===n.byteLength)return n;var i=new E(8);return h(i,0,e,r),i.buffer}function c(t,e){var r=t&&t.length;return e|=0,r&&e+8<=r&&"string"!=typeof t[e]}function h(t,e,r,n){e|=0,n|=0;for(var i=0;i<8;i++)t[e++]=255&r[n++]}function l(t,e){return Array.prototype.slice.call(t,e,e+8)}function p(t,e,r){for(var n=e+8;n>e;)t[--n]=255&r,r/=256}function y(t,e,r){var n=e+8;for(r++;n>e;)t[--n]=255&-r^255,r/=256}function d(t,e,r){for(var n=e+8;e."+this._valueClasses[e])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=n.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e is not an instance of <"+this._valueClasses[i]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new i.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!=e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();e.OnceSignal=o},function(t,e,r){"use strict";var n=r(29),i=r(39),o=r(42),s=r(21),a=r(43),u=r(5),f=function(){function t(t,e){var r=this;this.state=new o.DeltaContainer({}),this.clock=new i,this.remoteClock=new i,this.onJoin=new n.Signal,this.onUpdate=new n.Signal,this.onData=new n.Signal,this.onError=new n.Signal,this.onLeave=new n.Signal,this.removeAllListeners=function(){r.onJoin.removeAll(),r.onUpdate.removeAll(),r.onData.removeAll(),r.onError.removeAll(),r.onLeave.removeAll(),r.state.removeAllListeners()},this.id=null,this.client=t,this.name=e,this.onLeave.add(this.removeAllListeners)}return t.prototype.setState=function(t,e,r){this.state.set(t),this._previousState=s.encode(t),e&&r&&(this.remoteClock.currentTime=e,this.remoteClock.elapsedTime=r),this.clock.start(),this.onUpdate.dispatch(t)},t.prototype.patch=function(t){var e=Date.now();this.lastPatchTime&&(this.ping=e-this.lastPatchTime),this.lastPatchTime=e,this.clock.tick(),this._previousState=a.apply(this._previousState,t),this.state.set(s.decode(this._previousState)),this.onUpdate.dispatch(this.state.data)},t.prototype.leave=function(){this.id>=0&&this.client.send([u.Protocol.LEAVE_ROOM,this.id])},t.prototype.send=function(t){this.client.send([u.Protocol.ROOM_DATA,this.id,t])},t}();e.Room=f},function(t,e,r){function n(t){i.EventEmitter.call(this),this.backoffStrategy_=t,this.maxNumberOfRetry_=-1,this.backoffNumber_=0,this.backoffDelay_=0,this.timeoutID_=-1,this.handlers={backoff:this.onBackoff_.bind(this)}}var i=r(7),o=r(14),s=r(1);s.inherits(n,i.EventEmitter),n.prototype.failAfter=function(t){o.checkArgument(t>0,"Expected a maximum number of retry greater than 0 but got %s.",t),this.maxNumberOfRetry_=t},n.prototype.backoff=function(t){o.checkState(this.timeoutID_===-1,"Backoff in progress."),this.backoffNumber_===this.maxNumberOfRetry_?(this.emit("fail",t),this.reset()):(this.backoffDelay_=this.backoffStrategy_.next(),this.timeoutID_=setTimeout(this.handlers.backoff,this.backoffDelay_),this.emit("backoff",this.backoffNumber_,this.backoffDelay_,t))},n.prototype.onBackoff_=function(){this.timeoutID_=-1,this.emit("ready",this.backoffNumber_,this.backoffDelay_),this.backoffNumber_++},n.prototype.reset=function(){this.backoffNumber_=0,this.backoffStrategy_.reset(),clearTimeout(this.timeoutID_),this.timeoutID_=-1},t.exports=n},function(t,e,r){function n(t){o.call(this,t),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()}var i=r(1),o=r(19);i.inherits(n,o),n.prototype.next_=function(){var t=Math.min(this.nextBackoffDelay_,this.getMaxDelay());return this.nextBackoffDelay_+=this.backoffDelay_,this.backoffDelay_=t,t},n.prototype.reset_=function(){this.nextBackoffDelay_=this.getInitialDelay(),this.backoffDelay_=0},t.exports=n},function(t,e,r){function n(t){return void 0!==t&&null!==t}function i(t){if(t=t||{},n(t.initialDelay)&&t.initialDelay<1)throw new Error("The initial timeout must be greater than 0.");if(n(t.maxDelay)&&t.maxDelay<1)throw new Error("The maximal timeout must be greater than 0.");if(this.initialDelay_=t.initialDelay||100,this.maxDelay_=t.maxDelay||1e4,this.maxDelay_<=this.initialDelay_)throw new Error("The maximal backoff delay must be greater than the initial backoff delay.");if(n(t.randomisationFactor)&&(t.randomisationFactor<0||t.randomisationFactor>1))throw new Error("The randomisation factor must be between 0 and 1.");this.randomisationFactor_=t.randomisationFactor||0}r(7),r(1);i.prototype.getMaxDelay=function(){return this.maxDelay_},i.prototype.getInitialDelay=function(){return this.initialDelay_},i.prototype.next=function(){var t=this.next_(),e=1+Math.random()*this.randomisationFactor_,r=Math.round(t*e);return r},i.prototype.next_=function(){throw new Error("BackoffStrategy.next_() unimplemented.")},i.prototype.reset=function(){this.reset_()},i.prototype.reset_=function(){throw new Error("BackoffStrategy.reset_() unimplemented.")},t.exports=i},function(t,e,r){function n(){if(!(this instanceof n))return new n}!function(e){function r(t){for(var e in f)t[e]=f[e];return t}function n(t,e){return a(this,t).push(e),this}function i(t,e){function r(){o.call(n,t,r),e.apply(this,arguments)}var n=this;return r.originalListener=e,a(n,t).push(r),n}function o(t,e){function r(t){return t!==e&&t.originalListener!==e}var n,i=this;if(arguments.length){if(e){if(n=a(i,t,!0)){if(n=n.filter(r),!n.length)return o.call(i,t);i[u][t]=n}}else if(n=i[u],n&&(delete n[t],!Object.keys(n).length))return o.call(i)}else delete i[u];return i}function s(t,e){function r(t){t.call(o)}function n(t){t.call(o,e)}function i(t){t.apply(o,f)}var o=this,s=a(o,t,!0);if(!s)return!1;var u=arguments.length;if(1===u)s.forEach(r);else if(2===u)s.forEach(n);else{var f=Array.prototype.slice.call(arguments,1);s.forEach(i)}return!!s.length}function a(t,e,r){if(!r||t[u]){var n=t[u]||(t[u]={});return n[e]||(n[e]=[])}}t.exports=e;var u="listeners",f={on:n,once:i,off:o,emit:s};r(e.prototype),e.mixin=r}(n)},function(t,e,r){e.encode=r(25).encode,e.decode=r(23).decode,e.Encoder=r(52).Encoder,e.Decoder=r(51).Decoder,e.createCodec=r(55).createCodec,e.codec=r(50).codec},function(t,e,r){function n(t){if(!(this instanceof n))return new n(t);if(t&&(this.options=t,t.codec)){var e=this.codec=t.codec;e.bufferish&&(this.bufferish=e.bufferish)}}e.DecodeBuffer=n;var i=r(12).preset,o=r(26).FlexDecoder;o.mixin(n.prototype),n.prototype.codec=i,n.prototype.fetch=function(){return this.codec.decode(this)}},function(t,e,r){function n(t,e){var r=new i(e);return r.write(t),r.read()}e.decode=n;var i=r(22).DecodeBuffer},function(t,e,r){function n(t){if(!(this instanceof n))return new n(t);if(t&&(this.options=t,t.codec)){var e=this.codec=t.codec;e.bufferish&&(this.bufferish=e.bufferish)}}e.EncodeBuffer=n;var i=r(13).preset,o=r(26).FlexEncoder;o.mixin(n.prototype),n.prototype.codec=i,n.prototype.write=function(t){this.codec.encode(this,t)}},function(t,e,r){function n(t,e){var r=new i(e);return r.write(t),r.read()}e.encode=n;var i=r(24).EncodeBuffer},function(t,e,r){function n(){if(!(this instanceof n))return new n}function i(){if(!(this instanceof i))return new i}function o(){function t(t){var e=this.offset?p.prototype.slice.call(this.buffer,this.offset):this.buffer;this.buffer=e?t?this.bufferish.concat([e,t]):e:t,this.offset=0}function e(){for(;this.offsetthis.buffer.length)throw new Error(v);return this.offset=r,e}return{bufferish:p,write:t,fetch:u,flush:e,push:c,pull:h,read:f,reserve:r,offset:0}}function s(){function t(){var t=this.start;if(t1?this.bufferish.concat(t):t[0];return t.length=0,e}function n(t){var e=0|t;if(this.buffer){var r=this.buffer.length,n=0|this.offset,i=n+e;if(ithis.minBufferSize)this.flush(),this.push(t);else{var r=this.reserve(e);p.prototype.copy.call(t,this.buffer,r)}}return{bufferish:p,write:a,fetch:t,flush:e,push:c,pull:r,read:f,reserve:n,send:i,maxBufferSize:d,minBufferSize:y,offset:0,start:0}}function a(){throw new Error("method not implemented: write()")}function u(){throw new Error("method not implemented: fetch()")}function f(){var t=this.buffers&&this.buffers.length;return t?(this.flush(),this.pull()):this.fetch()}function c(t){var e=this.buffers||(this.buffers=[]);e.push(t)}function h(){var t=this.buffers||(this.buffers=[]);return t.shift()}function l(t){function e(e){for(var r in t)e[r]=t[r];return e}return e}e.FlexDecoder=n,e.FlexEncoder=i;var p=r(0),y=2048,d=65536,v="BUFFER_SHORTAGE";n.mixin=l(o()),n.mixin(n.prototype),i.mixin=l(s()),i.mixin(i.prototype)},function(t,e,r){function n(t){var e=B.hasArrayBuffer&&t&&t.binarraybuffer,r=t&&t.int64,n=R&&t&&t.usemap,x={map:n?o:i,array:s,str:a,bin:e?f:u,ext:c,uint8:h,uint16:p,uint32:d,uint64:g(8,r?w:b),int8:l,int16:y,int32:v,int64:g(8,r?E:m),float32:g(4,_),float64:g(8,A)};return x}function i(t,e){var r,n={},i=new Array(e),o=new Array(e),s=t.codec.decode;for(r=0;rthis.head.priority)return this.prepend(e);for(var n=new t(this.head),i=n,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return i.tail=o.prepend(e),n;i=i.tail=new t(o.head),o=o.tail}return i.tail=new t(e),n},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e==this.head.listener)return this.tail;for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;){if(i.head.listener==e)return n.tail=i.tail,r;n=n.tail=new t(i.head),i=i.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener==t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener==t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return t+="NIL","[List "+t+"]"},t}();e.SlotList=r,r.NIL=new r(null,null)},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){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(71),o=r(21),s=r(5),a=r(16),u=r(29),f=function(t){function e(e,r,n){void 0===r&&(r=null),void 0===n&&(n={});var i=t.call(this,e,r,n)||this;return i.rooms={},i.onOpen=new u.Signal,i.onMessage=new u.Signal,i.onClose=new u.Signal,i.onError=new u.Signal,i._enqueuedCalls=[],i.binaryType="arraybuffer",i}return n(e,t),e.prototype.onOpenCallback=function(t){if(this._enqueuedCalls.length>0)for(var e=0;e0&&this.backoff_.failAfter(this.failAfter_),this.state_=n.State_.RUNNING,this.doCall_(!1)},n.prototype.doCall_=function(t){t&&this.numRetries_++;var e=["call"].concat(this.arguments_);i.EventEmitter.prototype.emit.apply(this,e);var r=this.handleFunctionCallback_.bind(this);this.function_.apply(null,this.arguments_.concat(r))},n.prototype.doCallback_=function(){this.callback_.apply(null,this.lastResult_)},n.prototype.handleFunctionCallback_=function(){if(!this.isAborted()){var t=Array.prototype.slice.call(arguments);this.lastResult_=t,i.EventEmitter.prototype.emit.apply(this,["callback"].concat(t));var e=t[0];e&&this.retryPredicate_(e)?this.backoff_.backoff(e):(this.state_=n.State_.COMPLETED,this.doCallback_())}},n.prototype.handleBackoff_=function(t,e,r){this.emit("backoff",t,e,r)},t.exports=n},function(t,e,r){function n(t){s.call(this,t),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay(),this.factor_=n.DEFAULT_FACTOR,t&&void 0!==t.factor&&(o.checkArgument(t.factor>1,"Exponential factor should be greater than 1 but got %s.",t.factor),this.factor_=t.factor)}var i=r(1),o=r(14),s=r(19);i.inherits(n,s),n.DEFAULT_FACTOR=2,n.prototype.next_=function(){return this.backoffDelay_=Math.min(this.nextBackoffDelay_,this.getMaxDelay()),this.nextBackoffDelay_=this.backoffDelay_*this.factor_,this.backoffDelay_},n.prototype.reset_=function(){this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()},t.exports=n},function(t,e){"use strict";function r(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 n(t){return 3*t.length/4-r(t)}function i(t){var e,n,i,o,s,a,u=t.length;s=r(t),a=new c(3*u/4-s),i=s>0?u-4:u;var h=0;for(e=0,n=0;e>16&255,a[h++]=o>>8&255,a[h++]=255&o;return 2===s?(o=f[t.charCodeAt(e)]<<2|f[t.charCodeAt(e+1)]>>4,a[h++]=255&o):1===s&&(o=f[t.charCodeAt(e)]<<10|f[t.charCodeAt(e+1)]<<4|f[t.charCodeAt(e+2)]>>2,a[h++]=o>>8&255,a[h++]=255&o),a}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],s=e;sc?c:f+a));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=n,e.toByteArray=i,e.fromByteArray=a;for(var u=[],f=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=h.length;l=0;e--)this.listeners[t.operation][e]===t&&this.listeners[t.operation].splice(e,1)},t.prototype.removeAllListeners=function(){this.reset()},t.prototype.checkPatches=function(t){for(var e=t.length-1;e>=0;e--)for(var r=t[e].op,n=0,i=this.listeners[r].length;n2)return!1;r=r.concat(o.slice(1))}return r},t.prototype.reset=function(){this.listeners={add:[],remove:[],replace:[]}},t}();e.DeltaContainer=o},function(t,e){"use strict";function r(t,e){var r=[];return o(t,e,r,[]),r}function n(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function i(t){if(Array.isArray(t)){for(var e=new Array(t.length),r=0;r=0;h--){var l=u[h],p=t[l];if(!e.hasOwnProperty(l)||void 0===e[l]&&void 0!==p&&Array.isArray(e)===!1)r.push({op:"remove",path:s.concat(l)}),c=!0;else{var y=e[l];"object"==typeof p&&null!=p&&"object"==typeof y&&null!=y?o(p,y,r,s.concat(l)):p!==y&&(f=!0,r.push({op:"replace",path:s.concat(l),value:n(y)}))}}if(c||a.length!=u.length)for(var h=0;h=r;e++,r<<=6);return e}function i(t){for(var e=0,r=0,n=0,i=0,o=0,s=t.length;s>=16;)e=e+t[o+0]|0,r=r+t[o+1]|0,n=n+t[o+2]|0,i=i+t[o+3]|0,e=e+t[o+4]|0,r=r+t[o+5]|0,n=n+t[o+6]|0,i=i+t[o+7]|0,e=e+t[o+8]|0,r=r+t[o+9]|0,n=n+t[o+10]|0,i=i+t[o+11]|0,e=e+t[o+12]|0,r=r+t[o+13]|0,n=n+t[o+14]|0,i=i+t[o+15]|0,o+=16,s-=16;for(;s>=4;)e=e+t[o+0]|0,r=r+t[o+1]|0,n=n+t[o+2]|0,i=i+t[o+3]|0,o+=4,s-=4;switch(i=((i+(n<<8)|0)+(r<<16)|0)+(e<<24)|0,s){case 3:i=i+(t[o+2]<<8)|0;case 2:i=i+(t[o+1]<<16)|0;case 1:i=i+(t[o+0]<<24)|0}return i>>>0}var o={},s=16;t.prototype.init=function(t,e){var r,n,i=0,o=0;for(r=0;r>>0};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~".split("").map(function(t){return t.charCodeAt(0)}),u=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];return e.prototype.haveBytes=function(){return this.posthis.a.length)throw new RangeError("out of bounds");return t},e.prototype.getChar=function(){return String.fromCharCode(this.getByte())},e.prototype.getInt=function(){for(var t,e=0;this.haveBytes()&&(t=u[127&this.getByte()])>=0;)e=(e<<6)+t;return this.pos--,e>>>0},r.prototype.toArray=function(){return this.a},r.prototype.putByte=function(t){this.a.push(255&t)},r.prototype.putChar=function(t){this.putByte(t.charCodeAt(0))},r.prototype.putInt=function(t){var e,r,n=[];if(0===t)return void this.putChar("0");for(e=0;t>0;e++,t>>>=6)n.push(a[63&t]);for(r=e-1;r>=0;r--)this.putByte(n[r])},r.prototype.putArray=function(t,e,r){for(var n=e;n=0&&A-- >0;){var x,k,S,P,B,O,R,I;for(g=b*s,P=0,O=g,R=_+a;O=I&&x>m&&(m=x,w=g-B,E=S),b=p[b]}if(m>0){E>0&&(u.putInt(E),u.putChar(":"),u.putArray(o,_,_+E),_+=E),_+=m,u.putInt(m),u.putChar("@"),u.putInt(w),u.putChar(","),w+m-1>h&&(h=w+m-1),m=0;break}if(_+a+s>=f){u.putInt(f-_),u.putChar(":"),u.putArray(o,_,_+f-_),_=f;break}v.next(o[_+a+s]),a++}return _o)throw new Error("copy exceeds output file size");if(l+h>u)throw new Error("copy extends past end of input");c.putArray(t,l,l+h);break;case":":if(s+=h,s>o)throw new Error("insert command gives an output larger than predicted");if(h>f)throw new Error("insert count exceeds size of delta");c.putArray(a.a,a.pos,a.pos+h),a.pos+=h;break;case";":var p=c.toArray();if(h!==i(p))throw new Error("bad checksum");if(s!==o)throw new Error("generated size does not match predicted size");return p;default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")},o})},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e,r){(function(e){function r(t){return t&&t.isBuffer&&t}t.exports=r("undefined"!=typeof e&&e)||r(this.Buffer)||r("undefined"!=typeof window&&window.Buffer)||this.Buffer}).call(e,r(6).Buffer)},function(t,e){function r(t,e){for(var r=this,n=e||(e|=0),i=t.length,o=0,s=0;s>>6,r[n++]=128|63&o):o<55296||o>57343?(r[n++]=224|o>>>12,r[n++]=128|o>>>6&63,r[n++]=128|63&o):(o=(o-55296<<10|t.charCodeAt(s++)-56320)+65536,r[n++]=240|o>>>18,r[n++]=128|o>>>12&63,r[n++]=128|o>>>6&63,r[n++]=128|63&o);return n-e}function n(t,e,r){var n=this,i=0|e;r||(r=n.length);for(var o="",s=0;i=65536?(s-=65536,o+=String.fromCharCode((s>>>10)+55296,(1023&s)+56320)):o+=String.fromCharCode(s));return o}function i(t,e,r,n){var i;r||(r=0),n||0===n||(n=this.length),e||(e=0);var o=n-r;if(t===this&&r=0;i--)t[i+e]=this[i+r];else for(i=0;i>>8,i[n]=r}}function f(t){return function(e,r){var n=e.reserve(5),i=e.buffer;i[n++]=t,i[n++]=r>>>24,i[n++]=r>>>16,i[n++]=r>>>8,i[n]=r}}function c(t,e,r,n){return function(i,o){var s=i.reserve(e+1);i.buffer[s++]=t,r.call(i.buffer,o,s,n)}}function h(t,e){new g(this,e,t)}function l(t,e){new b(this,e,t)}function p(t,e){d.write(this,t,e,!1,23,4)}function y(t,e){d.write(this,t,e,!1,52,8)}var d=r(8),v=r(9),g=v.Uint64BE,b=v.Int64BE,m=r(28).uint8,w=r(0),E=w.global,_=w.hasBuffer&&"TYPED_ARRAY_SUPPORT"in E,A=_&&!E.TYPED_ARRAY_SUPPORT,x=w.hasBuffer&&E.prototype||{};e.getWriteToken=n},function(t,e,r){function n(t){function e(t,e){var r=e?195:194;O[r](t,e)}function r(t,e){var r,n=0|e;return e!==n?(r=203,void O[r](t,e)):(r=-32<=n&&n<=127?255&n:0<=n?n<=255?204:n<=65535?205:206:-128<=n?208:-32768<=n?209:210,void O[r](t,n))}function n(t,e){var r=207;O[r](t,e.toArray())}function o(t,e){var r=211;O[r](t,e.toArray())}function v(t){return t<32?1:t<=255?2:t<=65535?3:5}function g(t){return t<32?1:t<=65535?3:5}function b(t){function e(e,r){var n=r.length,i=5+3*n;e.offset=e.reserve(i);var o=e.buffer,s=t(n),a=e.offset+s;n=f.write.call(o,r,a);var u=t(n);if(s!==u){var c=a+u-s,h=a+n;f.copy.call(o,o,c,a,h)}var l=1===u?160+n:u<=3?215+u:219;O[l](e,n),e.offset+=n}return e}function m(t,e){if(null===e)return E(t,e);if(T(e))return U(t,e);if(i(e))return _(t,e);if(s.isUint64BE(e))return n(t,e);if(a.isInt64BE(e))return o(t,e);var r=t.codec.getExtPacker(e);return r&&(e=r(e)),e instanceof l?k(t,e):void D(t,e)}function w(t,e){return T(e)?B(t,e):void m(t,e)}function E(t,e){var r=192;O[r](t,e)}function _(t,e){var r=e.length,n=r<16?144+r:r<=65535?220:221;O[n](t,r);for(var i=t.codec.encode,o=0;o1)for(var r=1;r is not an instance of <"+this._valueClasses[i]+">.");var o=t[0];o&&(o.target&&(o=o.clone(),t[0]=o),o.target=this.target,o.currentTarget=this.target,o.signal=this);for(var s=this.slots;s.nonEmpty;)s.head.execute(t),s=s.tail;if(o&&o.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(a=a.parent)&&(void 0===a.onEventBubbled||(o.currentTarget=a,!a.onEventBubbled(o))););},e}(i.PrioritySignal);e.DeluxeSignal=o},function(t,e){"use strict";e.IOnceSignal=Symbol("IOnceSignal")},function(t,e){"use strict";e.IPrioritySignal=Symbol("IPrioritySignal")},function(t,e){"use strict";e.ISignal=Symbol("ISignal")},function(t,e){"use strict";e.ISlot=Symbol("ISlot")},function(t,e,r){"use strict";var n=r(4),i=function(){function t(){for(var t=[],e=0;e."+this._valueClasses[e])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),t.prototype.add=function(t){return this.registerListener(t)},t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){if(this.slot&&this.slot.listener==t){var e=this.slot;return this.slot=null,e}return null},t.prototype.removeAll=function(){this.slot&&this.slot.remove()},t.prototype.dispatch=function(){for(var t=[],e=0;e is not an instance of <"+this._valueClasses[i]+">.");this.slot&&this.slot.execute(t)},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new n.Slot(t,this,e)},t}();e.MonoSignal=i},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(15),o=function(t){function e(){return t.apply(this,arguments)||this}return n(e,t),e.prototype.addOnce=function(e){var r=t.prototype.addOnce.call(this,e);return this.isDispatched&&(r.execute(this.valueObjects),r.remove()),r},e.prototype.dispatch=function(){for(var e=[],r=0;r2&&void 0!==arguments[2]?arguments[2]:{};n(this,t),this.url=e,this._protocols=r,this.reconnectEnabled=!0,this.listeners={},this.backoff=o[i.backoff||"fibonacci"](i),this.backoff.on("backoff",this.onBackoffStart.bind(this)),this.backoff.on("ready",this.onBackoffReady.bind(this)),this.backoff.on("fail",this.onBackoffFail.bind(this)),this.open()}return i(t,[{key:"open",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isReconnect=t,this.ws=new WebSocket(this.url,this._protocols),this.ws.onclose=this.onCloseCallback.bind(this),this.ws.onerror=this.onErrorCallback.bind(this),this.ws.onmessage=this.onMessageCallback.bind(this),this.ws.onopen=this.onOpenCallback.bind(this)}},{key:"onBackoffStart",value:function(t,e){}},{key:"onBackoffReady",value:function(t,e){this.open(!0)}},{key:"onBackoffFail",value:function(){}},{key:"onCloseCallback",value:function(){!this.isReconnect&&this.listeners.onclose&&this.listeners.onclose.apply(null,arguments),this.reconnectEnabled&&this.backoff.backoff()}},{key:"onErrorCallback",value:function(){this.listeners.onerror&&this.listeners.onerror.apply(null,arguments)}},{key:"onMessageCallback",value:function(){this.listeners.onmessage&&this.listeners.onmessage.apply(null,arguments)}},{key:"onOpenCallback",value:function(){this.listeners.onopen&&this.listeners.onopen.apply(null,arguments),this.isReconnect&&this.listeners.onreconnect&&this.listeners.onreconnect.apply(null,arguments),this.isReconnect=!1}},{key:"close",value:function(t,e){"undefined"==typeof t&&(t=1e3),this.reconnectEnabled=!1,this.ws.close(t,e)}},{key:"send",value:function(t){this.ws.send(t)}},{key:"bufferedAmount",get:function(){return this.ws.bufferedAmount}},{key:"readyState",get:function(){return this.ws.readyState}},{key:"binaryType",get:function(){return this.ws.binaryType},set:function(t){this.ws.binaryType=t}},{key:"extensions",get:function(){return this.ws.extensions},set:function(t){this.ws.extensions=t}},{key:"protocol",get:function(){return this.ws.protocol},set:function(t){this.ws.protocol=t}},{key:"onclose",set:function(t){this.listeners.onclose=t},get:function(){return this.listeners.onclose}},{key:"onerror",set:function(t){this.listeners.onerror=t},get:function(){return this.listeners.onerror}},{key:"onmessage",set:function(t){this.listeners.onmessage=t},get:function(){return this.listeners.onmessage}},{key:"onopen",set:function(t){this.listeners.onopen=t},get:function(){return this.listeners.onopen}},{key:"onreconnect",set:function(t){this.listeners.onreconnect=t},get:function(){return this.listeners.onreconnect}}]),t}();s.CONNECTING=WebSocket.CONNECTING,s.OPEN=WebSocket.OPEN,s.CLOSING=WebSocket.CLOSING,s.CLOSED=WebSocket.CLOSED,e.default=s},function(t,e,r){"use strict";var n=r(34);e.Client=n.Client;var i=r(5);e.Protocol=i.Protocol;var o=r(16);e.Room=o.Room}]); \ No newline at end of file diff --git a/package.json b/package.json index 207f2d2..d639b18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "colyseus.js", - "version": "0.6.0-alpha.0", + "version": "0.6.0-alpha.1", "description": "Multiplayer Game Client for the Browser", "keywords": [ "multiplayer", diff --git a/src/Client.ts b/src/Client.ts index e5ccad6..162b695 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -117,10 +117,11 @@ export class Client extends WebSocketClient { this.onMessage.dispatch(message[2]); } else { - this.onMessage.dispatch(message); + + this.onMessage.dispatch(message); + } - - + } }