Skip to content

Instantly share code, notes, and snippets.

@jajoosam
Last active May 15, 2019 11:34
Show Gist options
  • Save jajoosam/68deeda5e07402d0e73e3bb63a70ad0c to your computer and use it in GitHub Desktop.
Save jajoosam/68deeda5e07402d0e73e3bb63a70ad0c to your computer and use it in GitHub Desktop.
!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?exports.io=b():a.io=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(b,d,f){"use strict";function g(b,d){"object"===("undefined"==typeof b?"undefined":j(b))&&(d=b,b=void 0),d=d||{};var g,m=k(b),o=m.source,p=m.id,q=m.path,h=c[p]&&q in c[p].nsps,f=d.forceNew||d["force new connection"]||!1===d.multiplex||h;return f?(a("ignoring socket cache for %s",o),g=i(o,d)):(c[p]||(a("new io instance for %s",o),c[p]=i(o,d)),g=c[p]),m.query&&!d.query&&(d.query=m.query),g.socket(m.path,d)}var j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},k=f(1),h=f(7),i=f(12),a=f(3)("socket.io-client");b.exports=d=g;var c=d.managers={};d.protocol=h.protocol,d.connect=g,d.Manager=f(12),d.Socket=f(36)},function(a,b,c){"use strict";function d(a,b){var c=a;b=b||"undefined"!=typeof location&&location,null==a&&(a=b.protocol+"//"+b.host),"string"==typeof a&&("/"===a.charAt(0)&&(a="/"===a.charAt(1)?b.protocol+a:b.host+a),/^(https?|wss?):\/\//.test(a)||(g("protocol-less url %s",a),a="undefined"==typeof b?"https://"+a:b.protocol+"//"+a),g("parse %s",a),c=f(a)),c.port||(/^(http|ws)$/.test(c.protocol)?c.port="80":/^(http|ws)s$/.test(c.protocol)&&(c.port="443")),c.path=c.path||"/";var d=-1!==c.host.indexOf(":"),h=d?"["+c.host+"]":c.host;return c.id=c.protocol+"://"+h+":"+c.port,c.href=c.protocol+"://"+h+(b&&b.port===c.port?"":":"+c.port),c}var f=c(2),g=c(3)("socket.io-client:url");a.exports=d},function(a){var b=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,d=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];a.exports=function(f){var g=f,e=f.indexOf("["),h=f.indexOf("]");-1!=e&&-1!=h&&(f=f.substring(0,e)+f.substring(e,h).replace(/:/g,";")+f.substring(h,f.length));for(var i=b.exec(f||""),j={},a=14;a--;)j[d[a]]=i[a]||"";return-1!=e&&-1!=h&&(j.source=g,j.host=j.host.substring(1,j.host.length-1).replace(/;/g,":"),j.authority=j.authority.replace("[","").replace("]","").replace(/;/g,":"),j.ipv6uri=!0),j}},function(b,d,f){(function(e){function g(a){var b=this.useColors;if(a[0]=(b?"%c":"")+this.namespace+(b?" %c":" ")+a[0]+(b?"%c ":" ")+"+"+d.humanize(this.diff),b){var c="color: "+this.color;a.splice(1,0,c,"color: inherit");var e=0,f=0;a[0].replace(/%[a-zA-Z%]/g,function(a){"%%"!==a&&(e++,"%c"===a&&(f=e))}),a.splice(f,0,c)}}function h(a){try{null==a?d.storage.removeItem("debug"):d.storage.debug=a}catch(a){}}function a(){var a;try{a=d.storage.debug}catch(a){}return!a&&"undefined"!=typeof e&&"env"in e&&(a=e.env.DEBUG),a}d=b.exports=f(5),d.log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},d.formatArgs=g,d.save=h,d.load=a,d.useColors=function(){return"undefined"!=typeof window&&window.process&&"renderer"===window.process.type||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},d.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(a){}}(),d.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],d.formatters.j=function(a){try{return JSON.stringify(a)}catch(a){return"[UnexpectedJSONParseError]: "+a.message}},d.enable(a())}).call(d,f(4))},function(b){function e(){throw new Error("setTimeout has not been defined")}function g(){throw new Error("clearTimeout has not been defined")}function j(a){if(n===setTimeout)return setTimeout(a,0);if((n===e||!n)&&setTimeout)return n=setTimeout,setTimeout(a,0);try{return n(a,0)}catch(b){try{return n.call(null,a,0)}catch(b){return n.call(this,a,0)}}}function k(a){if(p===clearTimeout)return clearTimeout(a);if((p===g||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(a);try{return p(a)}catch(b){try{return p.call(null,a)}catch(b){return p.call(this,a)}}}function i(){s&&f&&(s=!1,f.length?r=f.concat(r):t=-1,r.length&&o())}function o(){if(!s){var a=j(i);s=!0;for(var b=r.length;b;){for(f=r,r=[];++t<b;)f&&f[t].run();t=-1,b=r.length}f=null,s=!1,k(a)}}function a(a,b){this.fun=a,this.array=b}function c(){}var n,p,q=b.exports={};!function(){try{n="function"==typeof setTimeout?setTimeout:e}catch(a){n=e}try{p="function"==typeof clearTimeout?clearTimeout:g}catch(a){p=g}}();var f,r=[],s=!1,t=-1;q.nextTick=function(b){var c=Array(arguments.length-1);if(1<arguments.length)for(var d=1;d<arguments.length;d++)c[d-1]=arguments[d];r.push(new a(b,c)),1!==r.length||s||j(o)},a.prototype.run=function(){this.fun.apply(null,this.array)},q.title="browser",q.browser=!0,q.env={},q.argv=[],q.version="",q.versions={},q.on=c,q.addListener=c,q.once=c,q.off=c,q.removeListener=c,q.removeAllListeners=c,q.emit=c,q.prependListener=c,q.prependOnceListener=c,q.listeners=function(){return[]},q.binding=function(){throw new Error("process.binding is not supported")},q.cwd=function(){return"/"},q.chdir=function(){throw new Error("process.chdir is not supported")},q.umask=function(){return 0}},function(b,d,f){function g(a){var b,c=0;for(b in a)c=(c<<5)-c+a.charCodeAt(b),c|=0;return d.colors[Math.abs(c)%d.colors.length]}function h(a){function b(){if(b.enabled){var f=b,g=+new Date,h=g-(e||g);f.diff=h,f.prev=e,f.curr=g,e=g;for(var j=Array(arguments.length),i=0;i<j.length;i++)j[i]=arguments[i];j[0]=d.coerce(j[0]),"string"!=typeof j[0]&&j.unshift("%O");var k=0;j[0]=j[0].replace(/%([a-zA-Z%])/g,function(a,b){if("%%"===a)return a;k++;var c=d.formatters[b];if("function"==typeof c){var e=j[k];a=c.call(f,e),j.splice(k,1),k--}return a}),d.formatArgs.call(f,j);var l=b.log||d.log||console.log.bind(console);l.apply(f,j)}}var e;return b.namespace=a,b.enabled=d.enabled(a),b.useColors=d.useColors(),b.color=g(a),b.destroy=j,"function"==typeof d.init&&d.init(b),d.instances.push(b),b}function j(){var a=d.instances.indexOf(this);return-1!==a&&(d.instances.splice(a,1),!0)}function i(a){d.save(a),d.names=[],d.skips=[];var b,c=("string"==typeof a?a:"").split(/[\s,]+/),e=c.length;for(b=0;b<e;b++)c[b]&&(a=c[b].replace(/\*/g,".*?"),"-"===a[0]?d.skips.push(new RegExp("^"+a.substr(1)+"$")):d.names.push(new RegExp("^"+a+"$")));for(b=0;b<d.instances.length;b++){var f=d.instances[b];f.enabled=d.enabled(f.namespace)}}function k(){d.enable("")}function a(a){if("*"===a[a.length-1])return!0;var b,c;for(b=0,c=d.skips.length;b<c;b++)if(d.skips[b].test(a))return!1;for(b=0,c=d.names.length;b<c;b++)if(d.names[b].test(a))return!0;return!1}d=b.exports=h.debug=h["default"]=h,d.coerce=function(a){return a instanceof Error?a.stack||a.message:a},d.disable=k,d.enable=i,d.enabled=a,d.humanize=f(6),d.instances=[],d.names=[],d.skips=[],d.formatters={}},function(b){function d(b){if(b=b+"",!(100<b.length)){var d=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(b);if(d){var e=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();return"years"===f||"year"===f||"yrs"===f||"yr"===f||"y"===f?e*j:"days"===f||"day"===f||"d"===f?e*c:"hours"===f||"hour"===f||"hrs"===f||"hr"===f||"h"===f?e*a:"minutes"===f||"minute"===f||"mins"===f||"min"===f||"m"===f?e*i:"seconds"===f||"second"===f||"secs"===f||"sec"===f||"s"===f?e*h:"milliseconds"===f||"millisecond"===f||"msecs"===f||"msec"===f||"ms"===f?e:void 0}}}function f(b){return b>=c?Math.round(b/c)+"d":b>=a?Math.round(b/a)+"h":b>=i?Math.round(b/i)+"m":b>=h?Math.round(b/h)+"s":b+"ms"}function g(b){return e(b,c,"day")||e(b,a,"hour")||e(b,i,"minute")||e(b,h,"second")||b+" ms"}function e(a,b,c){if(!(a<b))return a<1.5*b?Math.floor(a/b)+" "+c:Math.ceil(a/b)+" "+c+"s"}var h=1e3,i=60000,a=3600000,c=86400000,j=31557600000;b.exports=function(a,b){b=b||{};var c=typeof a;if("string"==c&&0<a.length)return d(a);if("number"==c&&!1===isNaN(a))return b.long?g(a):f(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}},function(b,j,e){function k(){}function q(a){var b=""+a.type;if(j.BINARY_EVENT!==a.type&&j.BINARY_ACK!==a.type||(b+=a.attachments+"-"),a.nsp&&"/"!==a.nsp&&(b+=a.nsp+","),null!=a.id&&(b+=a.id),null!=a.data){var c=n(a.data);if(!1===c)return m;b+=c}return h("encoded %j as %s",a,b),b}function n(a){try{return JSON.stringify(a)}catch(a){return!1}}function i(a,b){function c(a){var c=l.deconstructPacket(a),d=q(c.packet),e=c.buffers;e.unshift(d),b(e)}l.removeBlobs(a,c)}function o(){this.reconstructor=null}function a(b){var e=0,f={type:+b.charAt(0)};if(null==j.types[f.type])return p("unknown packet type "+f.type);if(j.BINARY_EVENT===f.type||j.BINARY_ACK===f.type){for(var g="";"-"!==b.charAt(++e)&&(g+=b.charAt(e),e!=b.length););if(g!=+g||"-"!==b.charAt(e))throw new Error("Illegal attachments");f.attachments=+g}if("/"===b.charAt(e+1))for(f.nsp="";++e;){var k=b.charAt(e);if(","===k)break;if(f.nsp+=k,e===b.length)break}else f.nsp="/";var l=b.charAt(e+1);if(""!==l&&+l==l){for(f.id="";++e;){var k=b.charAt(e);if(null==k||+k!=k){--e;break}if(f.id+=b.charAt(e),e===b.length)break}f.id=+f.id}if(b.charAt(++e)){var m=s(b.substr(e)),a=!1!==m&&(f.type===j.ERROR||d(m));if(!a)return p("invalid payload");f.data=m}return h("decoded %s as %j",b,f),f}function s(a){try{return JSON.parse(a)}catch(a){return!1}}function c(a){this.reconPack=a,this.buffers=[]}function p(a){return{type:j.ERROR,data:"parser error: "+a}}var h=e(3)("socket.io-parser"),f=e(8),l=e(9),d=e(10),r=e(11);j.protocol=4,j.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],j.CONNECT=0,j.DISCONNECT=1,j.EVENT=2,j.ACK=3,j.ERROR=4,j.BINARY_EVENT=5,j.BINARY_ACK=6,j.Encoder=k,j.Decoder=o;var m=j.ERROR+"\"encode error\"";k.prototype.encode=function(a,b){if(h("encoding packet %j",a),j.BINARY_EVENT===a.type||j.BINARY_ACK===a.type)i(a,b);else{var c=q(a);b([c])}},f(o.prototype),o.prototype.add=function(b){var d;if("string"==typeof b)d=a(b),j.BINARY_EVENT===d.type||j.BINARY_ACK===d.type?(this.reconstructor=new c(d),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",d)):this.emit("decoded",d);else{if(!r(b)&&!b.base64)throw new Error("Unknown type: "+b);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");d=this.reconstructor.takeBinaryData(b),d&&(this.reconstructor=null,this.emit("decoded",d))}},o.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},c.prototype.takeBinaryData=function(a){if(this.buffers.push(a),this.buffers.length===this.reconPack.attachments){var b=l.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),b}return null},c.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(a){function b(a){if(a)return c(a)}function c(a){for(var c in b.prototype)a[c]=b.prototype[c];return a}a.exports=b,b.prototype.on=b.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(b),this},b.prototype.once=function(a,b){function c(){this.off(a,c),b.apply(this,arguments)}return c.fn=b,this.on(a,c),this},b.prototype.off=b.prototype.removeListener=b.prototype.removeAllListeners=b.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks["$"+a];if(!c)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var d,e=0;e<c.length;e++)if(d=c[e],d===b||d.fn===b){c.splice(e,1);break}return this},b.prototype.emit=function(a){this._callbacks=this._callbacks||{};var b=[].slice.call(arguments,1),c=this._callbacks["$"+a];if(c){c=c.slice(0);for(var d=0,e=c.length;d<e;++d)c[d].apply(this,b)}return this},b.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]},b.prototype.hasListeners=function(a){return!!this.listeners(a).length}},function(b,d,e){function f(b,d){if(!b)return b;if(i(b)){var e={_placeholder:!0,num:d.length};return d.push(b),e}if(j(b)){for(var g=Array(b.length),h=0;h<b.length;h++)g[h]=f(b[h],d);return g}if("object"==typeof b&&!(b instanceof Date)){var g={};for(var k in b)g[k]=f(b[k],d);return g}return b}function g(a,b){if(!a)return a;if(a&&a._placeholder)return b[a.num];if(j(a))for(var c=0;c<a.length;c++)a[c]=g(a[c],b);else if("object"==typeof a)for(var d in a)a[d]=g(a[d],b);return a}var j=e(10),i=e(11),h=Object.prototype.toString,k="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===h.call(Blob),c="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===h.call(File);d.deconstructPacket=function(a){var b=[],c=a.data,d=a;return d.data=f(c,b),d.attachments=b.length,{packet:d,buffers:b}},d.reconstructPacket=function(a,b){return a.data=g(a.data,b),a.attachments=void 0,a},d.removeBlobs=function(a,b){function d(g,m,a){if(!g)return g;if(k&&g instanceof Blob||c&&g instanceof File){e++;var n=new FileReader;n.onload=function(){a?a[m]=this.result:f=this.result,--e||b(f)},n.readAsArrayBuffer(g)}else if(j(g))for(var h=0;h<g.length;h++)d(g[h],h,g);else if("object"==typeof g&&!i(g))for(var o in g)d(g[o],o,g)}var e=0,f=a;d(f),e||b(f)}},function(a){var b={}.toString;a.exports=Array.isArray||function(a){return"[object Array]"==b.call(a)}},function(a){a.exports=function(a){return b&&Buffer.isBuffer(a)||c&&(a instanceof ArrayBuffer||d(a))};var b="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,c="function"==typeof ArrayBuffer,d=function(a){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer}},function(b,g,e){"use strict";function j(b,c){if(!(this instanceof j))return new j(b,c);b&&"object"===("undefined"==typeof b?"undefined":k(b))&&(c=b,b=void 0),c=c||{},c.path=c.path||"/socket.io",this.nsps={},this.subs=[],this.opts=c,this.reconnection(!1!==c.reconnection),this.reconnectionAttempts(c.reconnectionAttempts||1/0),this.reconnectionDelay(c.reconnectionDelay||1e3),this.reconnectionDelayMax(c.reconnectionDelayMax||5e3),this.randomizationFactor(c.randomizationFactor||.5),this.backoff=new f({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==c.timeout?2e4:c.timeout),this.readyState="closed",this.uri=b,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var d=c.parser||a;this.encoder=new d.Encoder,this.decoder=new d.Decoder,this.autoConnect=!1!==c.autoConnect,this.autoConnect&&this.open()}var k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},m=e(13),i=e(36),n=e(8),a=e(7),q=e(38),c=e(39),p=e(3)("socket.io-client:manager"),h=e(35),f=e(40),l=Object.prototype.hasOwnProperty;b.exports=j,j.prototype.emitAll=function(){for(var a in this.emit.apply(this,arguments),this.nsps)l.call(this.nsps,a)&&this.nsps[a].emit.apply(this.nsps[a],arguments)},j.prototype.updateSocketIds=function(){for(var a in this.nsps)l.call(this.nsps,a)&&(this.nsps[a].id=this.generateId(a))},j.prototype.generateId=function(a){return("/"===a?"":a+"#")+this.engine.id},n(j.prototype),j.prototype.reconnection=function(a){return arguments.length?(this._reconnection=!!a,this):this._reconnection},j.prototype.reconnectionAttempts=function(a){return arguments.length?(this._reconnectionAttempts=a,this):this._reconnectionAttempts},j.prototype.reconnectionDelay=function(a){return arguments.length?(this._reconnectionDelay=a,this.backoff&&this.backoff.setMin(a),this):this._reconnectionDelay},j.prototype.randomizationFactor=function(a){return arguments.length?(this._randomizationFactor=a,this.backoff&&this.backoff.setJitter(a),this):this._randomizationFactor},j.prototype.reconnectionDelayMax=function(a){return arguments.length?(this._reconnectionDelayMax=a,this.backoff&&this.backoff.setMax(a),this):this._reconnectionDelayMax},j.prototype.timeout=function(a){return arguments.length?(this._timeout=a,this):this._timeout},j.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},j.prototype.open=j.prototype.connect=function(b){if(p("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;p("opening %s",this.uri),this.engine=m(this.uri,this.opts);var d=this.engine,f=this;this.readyState="opening",this.skipReconnect=!1;var e=q(d,"open",function(){f.onopen(),b&&b()}),g=q(d,"error",function(a){if(p("connect_error"),f.cleanup(),f.readyState="closed",f.emitAll("connect_error",a),b){var c=new Error("Connection error");c.data=a,b(c)}else f.maybeReconnectOnOpen()});if(!1!==this._timeout){var h=this._timeout;p("connect attempt will timeout after %d",h);var a=setTimeout(function(){p("connect attempt timed out after %d",h),e.destroy(),d.close(),d.emit("error","timeout"),f.emitAll("connect_timeout",h)},h);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(e),this.subs.push(g),this},j.prototype.onopen=function(){p("open"),this.cleanup(),this.readyState="open",this.emit("open");var a=this.engine;this.subs.push(q(a,"data",c(this,"ondata"))),this.subs.push(q(a,"ping",c(this,"onping"))),this.subs.push(q(a,"pong",c(this,"onpong"))),this.subs.push(q(a,"error",c(this,"onerror"))),this.subs.push(q(a,"close",c(this,"onclose"))),this.subs.push(q(this.decoder,"decoded",c(this,"ondecoded")))},j.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},j.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},j.prototype.ondata=function(a){this.decoder.add(a)},j.prototype.ondecoded=function(a){this.emit("packet",a)},j.prototype.onerror=function(a){p("error",a),this.emitAll("error",a)},j.prototype.socket=function(a,b){function c(){~h(e.connecting,d)||e.connecting.push(d)}var d=this.nsps[a];if(!d){d=new i(this,a,b),this.nsps[a]=d;var e=this;d.on("connecting",c),d.on("connect",function(){d.id=e.generateId(a)}),this.autoConnect&&c()}return d},j.prototype.destroy=function(a){var b=h(this.connecting,a);~b&&this.connecting.splice(b,1),this.connecting.length||this.close()},j.prototype.packet=function(a){p("writing packet %j",a);var b=this;a.query&&0===a.type&&(a.nsp+="?"+a.query),b.encoding?b.packetBuffer.push(a):(b.encoding=!0,this.encoder.encode(a,function(c){for(var d=0;d<c.length;d++)b.engine.write(c[d],a.options);b.encoding=!1,b.processPacketQueue()}))},j.prototype.processPacketQueue=function(){if(0<this.packetBuffer.length&&!this.encoding){var a=this.packetBuffer.shift();this.packet(a)}},j.prototype.cleanup=function(){p("cleanup");for(var a,b=this.subs.length,c=0;c<b;c++)a=this.subs.shift(),a.destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},j.prototype.close=j.prototype.disconnect=function(){p("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},j.prototype.onclose=function(a){p("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",a),this._reconnection&&!this.skipReconnect&&this.reconnect()},j.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var a=this;if(this.backoff.attempts>=this._reconnectionAttempts)p("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var b=this.backoff.duration();p("will wait %dms before reconnect attempt",b),this.reconnecting=!0;var c=setTimeout(function(){a.skipReconnect||(p("attempting reconnect"),a.emitAll("reconnect_attempt",a.backoff.attempts),a.emitAll("reconnecting",a.backoff.attempts),a.skipReconnect||a.open(function(b){b?(p("reconnect attempt error"),a.reconnecting=!1,a.reconnect(),a.emitAll("reconnect_error",b.data)):(p("reconnect success"),a.onreconnect())}))},b);this.subs.push({destroy:function(){clearTimeout(c)}})}},j.prototype.onreconnect=function(){var a=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",a)}},function(a,b,c){a.exports=c(14),a.exports.parser=c(21)},function(b,d,e){function g(a,b){return this instanceof g?(b=b||{},a&&"object"==typeof a&&(b=a,a=null),a?(a=l(a),b.hostname=a.host,b.secure="https"===a.protocol||"wss"===a.protocol,b.port=a.port,a.query&&(b.query=a.query)):b.host&&(b.hostname=l(b.host).host),this.secure=null==b.secure?"undefined"!=typeof location&&"https:"===location.protocol:b.secure,b.hostname&&!b.port&&(b.port=this.secure?"443":"80"),this.agent=b.agent||!1,this.hostname=b.hostname||("undefined"==typeof location?"localhost":location.hostname),this.port=b.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=b.query||{},"string"==typeof this.query&&(this.query=m.decode(this.query)),this.upgrade=!1!==b.upgrade,this.path=(b.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!b.forceJSONP,this.jsonp=!1!==b.jsonp,this.forceBase64=!!b.forceBase64,this.enablesXDR=!!b.enablesXDR,this.timestampParam=b.timestampParam||"t",this.timestampRequests=b.timestampRequests,this.transports=b.transports||["polling","websocket"],this.transportOptions=b.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=b.policyPort||843,this.rememberUpgrade=b.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=b.onlyBinaryUpgrades,this.perMessageDeflate=!1!==b.perMessageDeflate&&(b.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=b.pfx||null,this.key=b.key||null,this.passphrase=b.passphrase||null,this.cert=b.cert||null,this.ca=b.ca||null,this.ciphers=b.ciphers||null,this.rejectUnauthorized=void 0===b.rejectUnauthorized||b.rejectUnauthorized,this.forceNode=!!b.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(b.extraHeaders&&0<Object.keys(b.extraHeaders).length&&(this.extraHeaders=b.extraHeaders),b.localAddress&&(this.localAddress=b.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,void this.open()):new g(a,b)}function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}var j=e(15),i=e(8),k=e(3)("engine.io-client:socket"),a=e(35),c=e(21),l=e(2),m=e(29);b.exports=g,g.priorWebsocketSuccess=!1,i(g.prototype),g.protocol=c.protocol,g.Socket=g,g.Transport=e(20),g.transports=e(15),g.parser=e(21),g.prototype.createTransport=function(a){k("creating transport \"%s\"",a);var b=f(this.query);b.EIO=c.protocol,b.transport=a;var d=this.transportOptions[a]||{};this.id&&(b.sid=this.id);var e=new j[a]({query:b,socket:this,agent:d.agent||this.agent,hostname:d.hostname||this.hostname,port:d.port||this.port,secure:d.secure||this.secure,path:d.path||this.path,forceJSONP:d.forceJSONP||this.forceJSONP,jsonp:d.jsonp||this.jsonp,forceBase64:d.forceBase64||this.forceBase64,enablesXDR:d.enablesXDR||this.enablesXDR,timestampRequests:d.timestampRequests||this.timestampRequests,timestampParam:d.timestampParam||this.timestampParam,policyPort:d.policyPort||this.policyPort,pfx:d.pfx||this.pfx,key:d.key||this.key,passphrase:d.passphrase||this.passphrase,cert:d.cert||this.cert,ca:d.ca||this.ca,ciphers:d.ciphers||this.ciphers,rejectUnauthorized:d.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:d.perMessageDeflate||this.perMessageDeflate,extraHeaders:d.extraHeaders||this.extraHeaders,forceNode:d.forceNode||this.forceNode,localAddress:d.localAddress||this.localAddress,requestTimeout:d.requestTimeout||this.requestTimeout,protocols:d.protocols||void 0,isReactNative:this.isReactNative});return e},g.prototype.open=function(){var a;if(this.rememberUpgrade&&g.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))a="websocket";else{if(0===this.transports.length){var b=this;return void setTimeout(function(){b.emit("error","No transports available")},0)}a=this.transports[0]}this.readyState="opening";try{a=this.createTransport(a)}catch(a){return this.transports.shift(),void this.open()}a.open(),this.setTransport(a)},g.prototype.setTransport=function(a){k("setting transport %s",a.name);var b=this;this.transport&&(k("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=a,a.on("drain",function(){b.onDrain()}).on("packet",function(a){b.onPacket(a)}).on("error",function(a){b.onError(a)}).on("close",function(){b.onClose("transport close")})},g.prototype.probe=function(a){function b(){if(p.onlyBinaryUpgrades){var b=!this.supportsBinary&&p.transport.supportsBinary;o=o||b}o||(k("probe transport \"%s\" opened",a),m.send([{type:"ping",data:"probe"}]),m.once("packet",function(b){if(!o)if("pong"===b.type&&"probe"===b.data){if(k("probe transport \"%s\" pong",a),p.upgrading=!0,p.emit("upgrading",m),!m)return;g.priorWebsocketSuccess="websocket"===m.name,k("pausing current transport \"%s\"",p.transport.name),p.transport.pause(function(){o||"closed"!==p.readyState&&(k("changing transport and sending upgrade packet"),c(),p.setTransport(m),m.send([{type:"upgrade"}]),p.emit("upgrade",m),m=null,p.upgrading=!1,p.flush())})}else{k("probe transport \"%s\" failed",a);var d=new Error("probe error");d.transport=m.name,p.emit("upgradeError",d)}}))}function d(){o||(o=!0,c(),m.close(),m=null)}function e(b){var c=new Error("probe error: "+b);c.transport=m.name,d(),k("probe transport \"%s\" failed because of error: %s",a,b),p.emit("upgradeError",c)}function j(){e("transport closed")}function i(){e("socket closed")}function l(a){m&&a.name!==m.name&&(k("\"%s\" works - aborting \"%s\"",a.name,m.name),d())}function c(){m.removeListener("open",b),m.removeListener("error",e),m.removeListener("close",j),p.removeListener("close",i),p.removeListener("upgrading",l)}k("probing transport \"%s\"",a);var m=this.createTransport(a,{probe:1}),o=!1,p=this;g.priorWebsocketSuccess=!1,m.once("open",b),m.once("error",e),m.once("close",j),this.once("close",i),this.once("upgrading",l),m.open()},g.prototype.onOpen=function(){if(k("socket open"),this.readyState="open",g.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){k("starting upgrade probes");for(var a=0,b=this.upgrades.length;a<b;a++)this.probe(this.upgrades[a])}},g.prototype.onPacket=function(a){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(k("socket receive: type \"%s\", data \"%s\"",a.type,a.data),this.emit("packet",a),this.emit("heartbeat"),a.type){case"open":this.onHandshake(JSON.parse(a.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var b=new Error("server error");b.code=a.data,this.onError(b);break;case"message":this.emit("data",a.data),this.emit("message",a.data);}else k("packet received with socket readyState \"%s\"",this.readyState)},g.prototype.onHandshake=function(a){this.emit("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this.upgrades=this.filterUpgrades(a.upgrades),this.pingInterval=a.pingInterval,this.pingTimeout=a.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},g.prototype.onHeartbeat=function(a){clearTimeout(this.pingTimeoutTimer);var b=this;b.pingTimeoutTimer=setTimeout(function(){"closed"!==b.readyState&&b.onClose("ping timeout")},a||b.pingInterval+b.pingTimeout)},g.prototype.setPing=function(){var a=this;clearTimeout(a.pingIntervalTimer),a.pingIntervalTimer=setTimeout(function(){k("writing ping packet - expecting pong within %sms",a.pingTimeout),a.ping(),a.onHeartbeat(a.pingTimeout)},a.pingInterval)},g.prototype.ping=function(){var a=this;this.sendPacket("ping",function(){a.emit("ping")})},g.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},g.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(k("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},g.prototype.write=g.prototype.send=function(a,b,c){return this.sendPacket("message",a,b,c),this},g.prototype.sendPacket=function(a,b,c,d){if("function"==typeof b&&(d=b,b=void 0),"function"==typeof c&&(d=c,c=null),"closing"!==this.readyState&&"closed"!==this.readyState){c=c||{},c.compress=!1!==c.compress;var f={type:a,data:b,options:c};this.emit("packetCreate",f),this.writeBuffer.push(f),d&&this.once("flush",d),this.flush()}},g.prototype.close=function(){function a(){d.onClose("forced close"),k("socket closing - telling transport to close"),d.transport.close()}function b(){d.removeListener("upgrade",b),d.removeListener("upgradeError",b),a()}function c(){d.once("upgrade",b),d.once("upgradeError",b)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var d=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?c():a()}):this.upgrading?c():a()}return this},g.prototype.onError=function(a){k("socket error %j",a),g.priorWebsocketSuccess=!1,this.emit("error",a),this.onClose("transport error",a)},g.prototype.onClose=function(a,b){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){k("socket close with reason: \"%s\"",a);var c=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",a,b),c.writeBuffer=[],c.prevBufferLen=0}},g.prototype.filterUpgrades=function(b){for(var c=[],d=0,e=b.length;d<e;d++)~a(this.transports,b[d])&&c.push(b[d]);return c}},function(b,c,d){function e(b){var d,i=!1,j=!1,k=!1!==b.jsonp;if("undefined"!=typeof location){var a="https:"===location.protocol,c=location.port;c||(c=a?443:80),i=b.hostname!==location.hostname||c!==b.port,j=b.secure!==a}if(b.xdomain=i,b.xscheme=j,d=new f(b),"open"in d&&!b.forceJSONP)return new g(b);if(!k)throw new Error("JSONP disabled");return new h(b)}var f=d(16),g=d(18),h=d(32),i=d(33);c.polling=e,c.websocket=i},function(a,b,c){var d=c(17);a.exports=function(a){var b=a.xdomain,c=a.xscheme,e=a.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!b||d))return new XMLHttpRequest}catch(a){}try{if("undefined"!=typeof XDomainRequest&&!c&&e)return new XDomainRequest}catch(a){}if(!b)try{return new self[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(a){}}},function(a){try{a.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(b){a.exports=!1}},function(b,d,e){function g(){}function j(b){if(a.call(this,b),this.requestTimeout=b.requestTimeout,this.extraHeaders=b.extraHeaders,"undefined"!=typeof location){var c="https:"===location.protocol,d=location.port;d||(d=c?443:80),this.xd="undefined"!=typeof location&&b.hostname!==location.hostname||d!==b.port,this.xs=b.secure!==c}}function k(a){this.method=a.method||"GET",this.uri=a.uri,this.xd=!!a.xd,this.xs=!!a.xs,this.async=!1!==a.async,this.data=void 0===a.data?null:a.data,this.agent=a.agent,this.isBinary=a.isBinary,this.supportsBinary=a.supportsBinary,this.enablesXDR=a.enablesXDR,this.requestTimeout=a.requestTimeout,this.pfx=a.pfx,this.key=a.key,this.passphrase=a.passphrase,this.cert=a.cert,this.ca=a.ca,this.ciphers=a.ciphers,this.rejectUnauthorized=a.rejectUnauthorized,this.extraHeaders=a.extraHeaders,this.create()}function i(){for(var a in k.requests)k.requests.hasOwnProperty(a)&&k.requests[a].abort()}var l=e(16),a=e(19),c=e(8),m=e(30),o=e(3)("engine.io-client:polling-xhr");if(b.exports=j,b.exports.Request=k,m(j,a),j.prototype.supportsBinary=!0,j.prototype.request=function(a){return a=a||{},a.uri=this.uri(),a.xd=this.xd,a.xs=this.xs,a.agent=this.agent||!1,a.supportsBinary=this.supportsBinary,a.enablesXDR=this.enablesXDR,a.pfx=this.pfx,a.key=this.key,a.passphrase=this.passphrase,a.cert=this.cert,a.ca=this.ca,a.ciphers=this.ciphers,a.rejectUnauthorized=this.rejectUnauthorized,a.requestTimeout=this.requestTimeout,a.extraHeaders=this.extraHeaders,new k(a)},j.prototype.doWrite=function(a,b){var c=this.request({method:"POST",data:a,isBinary:"string"!=typeof a&&void 0!==a}),d=this;c.on("success",b),c.on("error",function(a){d.onError("xhr post error",a)}),this.sendXhr=c},j.prototype.doPoll=function(){o("xhr poll");var a=this.request(),b=this;a.on("data",function(a){b.onData(a)}),a.on("error",function(a){b.onError("xhr poll error",a)}),this.pollXhr=a},c(k.prototype),k.prototype.create=function(){var a={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized},b=this.xhr=new l(a),c=this;try{o("xhr open %s: %s",this.method,this.uri),b.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var d in b.setDisableHeaderCheck&&b.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(d)&&b.setRequestHeader(d,this.extraHeaders[d])}catch(a){}if("POST"===this.method)try{this.isBinary?b.setRequestHeader("Content-type","application/octet-stream"):b.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(a){}try{b.setRequestHeader("Accept","*/*")}catch(a){}"withCredentials"in b&&(b.withCredentials=!0),this.requestTimeout&&(b.timeout=this.requestTimeout),this.hasXDR()?(b.onload=function(){c.onLoad()},b.onerror=function(){c.onError(b.responseText)}):b.onreadystatechange=function(){if(2===b.readyState)try{var a=b.getResponseHeader("Content-Type");c.supportsBinary&&"application/octet-stream"===a&&(b.responseType="arraybuffer")}catch(a){}4===b.readyState&&(200===b.status||1223===b.status?c.onLoad():setTimeout(function(){c.onError(b.status)},0))},o("xhr data %s",this.data),b.send(this.data)}catch(a){return void setTimeout(function(){c.onError(a)},0)}"undefined"!=typeof document&&(this.index=k.requestsCount++,k.requests[this.index]=this)},k.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},k.prototype.onData=function(a){this.emit("data",a),this.onSuccess()},k.prototype.onError=function(a){this.emit("error",a),this.cleanup(!0)},k.prototype.cleanup=function(a){if("undefined"!=typeof this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=g:this.xhr.onreadystatechange=g,a)try{this.xhr.abort()}catch(a){}"undefined"!=typeof document&&delete k.requests[this.index],this.xhr=null}},k.prototype.onLoad=function(){var a;try{var b;try{b=this.xhr.getResponseHeader("Content-Type")}catch(a){}a="application/octet-stream"===b?this.xhr.response||this.xhr.responseText:this.xhr.responseText}catch(a){this.onError(a)}null!=a&&this.onData(a)},k.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},k.prototype.abort=function(){this.cleanup()},k.requestsCount=0,k.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",i);else if("function"==typeof addEventListener){var h="onpagehide"in self?"pagehide":"unload";addEventListener(h,i,!1)}},function(b,d,f){function e(a){var b=a&&a.forceBase64;k&&!b||(this.supportsBinary=!1),g.call(this,a)}var g=f(20),h=f(29),i=f(21),j=f(30),a=f(31),c=f(3)("engine.io-client:polling");b.exports=e;var k=function(){var a=f(16),b=new a({xdomain:!1});return null!=b.responseType}();j(e,g),e.prototype.name="polling",e.prototype.doOpen=function(){this.poll()},e.prototype.pause=function(a){function b(){c("paused"),d.readyState="paused",a()}var d=this;if(this.readyState="pausing",this.polling||!this.writable){var e=0;this.polling&&(c("we are currently polling - waiting to pause"),e++,this.once("pollComplete",function(){c("pre-pause polling complete"),--e||b()})),this.writable||(c("we are currently writing - waiting to pause"),e++,this.once("drain",function(){c("pre-pause writing complete"),--e||b()}))}else b()},e.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},e.prototype.onData=function(a){var b=this;c("polling got data %s",a);i.decodePayload(a,this.socket.binaryType,function(a){return"opening"===b.readyState&&b.onOpen(),"close"===a.type?(b.onClose(),!1):void b.onPacket(a)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():c("ignoring poll - transport state \"%s\"",this.readyState))},e.prototype.doClose=function(){function a(){c("writing close packet"),b.write([{type:"close"}])}var b=this;"open"===this.readyState?(c("transport open - closing"),a()):(c("transport not open - deferring close"),this.once("open",a))},e.prototype.write=function(a){var b=this;this.writable=!1;var c=function(){b.writable=!0,b.emit("drain")};i.encodePayload(a,this.supportsBinary,function(a){b.doWrite(a,c)})},e.prototype.uri=function(){var b=this.query||{},c=this.secure?"https":"http",d="";!1!==this.timestampRequests&&(b[this.timestampParam]=a()),this.supportsBinary||b.sid||(b.b64=1),b=h.encode(b),this.port&&("https"==c&&443!==+this.port||"http"==c&&80!==+this.port)&&(d=":"+this.port),b.length&&(b="?"+b);var e=-1!==this.hostname.indexOf(":");return c+"://"+(e?"["+this.hostname+"]":this.hostname)+d+this.path+b}},function(a,b,c){function d(a){this.path=a.path,this.hostname=a.hostname,this.port=a.port,this.secure=a.secure,this.query=a.query,this.timestampParam=a.timestampParam,this.timestampRequests=a.timestampRequests,this.readyState="",this.agent=a.agent||!1,this.socket=a.socket,this.enablesXDR=a.enablesXDR,this.pfx=a.pfx,this.key=a.key,this.passphrase=a.passphrase,this.cert=a.cert,this.ca=a.ca,this.ciphers=a.ciphers,this.rejectUnauthorized=a.rejectUnauthorized,this.forceNode=a.forceNode,this.isReactNative=a.isReactNative,this.extraHeaders=a.extraHeaders,this.localAddress=a.localAddress}var f=c(21),e=c(8);a.exports=d,e(d.prototype),d.prototype.onError=function(a,b){var c=new Error(a);return c.type="TransportError",c.description=b,this.emit("error",c),this},d.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},d.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},d.prototype.send=function(a){if("open"!==this.readyState)throw new Error("Transport not open");this.write(a)},d.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},d.prototype.onData=function(a){var b=f.decodePacket(a,this.socket.binaryType);this.onPacket(b)},d.prototype.onPacket=function(a){this.emit("packet",a)},d.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(j,q,e){function x(a,b){var c="b"+q.packets[a.type]+a.data.data;return b(c)}function r(b,c,d){if(!c)return q.encodeBase64Packet(b,d);var e=b.data,f=new Uint8Array(e),h=new Uint8Array(1+e.byteLength);h[0]=g[b.type];for(var i=0;i<f.length;i++)h[i+1]=f[i];return d(h.buffer)}function z(a,b,c){if(!b)return q.encodeBase64Packet(a,c);var d=new FileReader;return d.onload=function(){q.encodePacket({type:a.type,data:d.result},b,!0,c)},d.readAsArrayBuffer(a.data)}function o(a,b,c){if(!b)return q.encodeBase64Packet(a,c);if(m)return z(a,b,c);var d=new Uint8Array(1);d[0]=g[a.type];var e=new w([d.buffer,a.data]);return c(e)}function i(a){try{a=l.decode(a,{strict:!1})}catch(a){return!1}return a}function a(a,b,c){for(var d=Array(a.length),e=f(a.length,c),g=function(a,c,f){b(c,function(b,c){d[a]=c,f(b,d)})},h=0;h<a.length;h++)g(h,a[h],e)}var c,n=e(22),u=e(23),h=e(24),f=e(25),l=e(26);"undefined"!=typeof ArrayBuffer&&(c=e(27));var d="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),s="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),m=d||s;q.protocol=3;var g=q.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},v=n(g),b={type:"error",data:"parser error"},w=e(28);q.encodePacket=function(b,d,f,h){"function"==typeof d&&(h=d,d=!1),"function"==typeof f&&(h=f,f=null);var j=void 0===b.data?void 0:b.data.buffer||b.data;if("undefined"!=typeof ArrayBuffer&&j instanceof ArrayBuffer)return r(b,d,h);if("undefined"!=typeof w&&j instanceof w)return o(b,d,h);if(j&&j.base64)return x(b,h);var a=g[b.type];return void 0!==b.data&&(a+=f?l.encode(b.data+"",{strict:!1}):b.data+""),h(""+a)},q.encodeBase64Packet=function(b,d){var e="b"+q.packets[b.type];if("undefined"!=typeof w&&b.data instanceof w){var f=new FileReader;return f.onload=function(){var a=f.result.split(",")[1];d(e+a)},f.readAsDataURL(b.data)}var g;try{g=String.fromCharCode.apply(null,new Uint8Array(b.data))}catch(d){for(var h=new Uint8Array(b.data),a=Array(h.length),c=0;c<h.length;c++)a[c]=h[c];g=String.fromCharCode.apply(null,a)}return e+=btoa(g),d(e)},q.decodePacket=function(a,c,d){if(void 0===a)return b;if("string"==typeof a){if("b"===a.charAt(0))return q.decodeBase64Packet(a.substr(1),c);if(d&&(a=i(a),!1===a))return b;var e=a.charAt(0);return+e==e&&v[e]?1<a.length?{type:v[e],data:a.substring(1)}:{type:v[e]}:b}var f=new Uint8Array(a),e=f[0],g=h(a,1);return w&&"blob"===c&&(g=new w([g])),{type:v[e],data:g}},q.decodeBase64Packet=function(a,b){var d=v[a.charAt(0)];if(!c)return{type:d,data:{base64:!0,data:a.substr(1)}};var e=c.decode(a.substr(1));return"blob"===b&&w&&(e=new w([e])),{type:d,data:e}},q.encodePayload=function(b,c,d){function e(a){return a.length+":"+a}function f(a,b){q.encodePacket(a,!!g&&c,!1,function(a){b(null,e(a))})}"function"==typeof c&&(d=c,c=null);var g=u(b);return c&&g?w&&!m?q.encodePayloadAsBlob(b,d):q.encodePayloadAsArrayBuffer(b,d):b.length?void a(b,f,function(a,b){return d(b.join(""))}):d("0:")},q.decodePayload=function(d,e,f){if("string"!=typeof d)return q.decodePayloadAsBinary(d,e,f);"function"==typeof e&&(f=e,e=null);var g;if(""===d)return f(b,0,1);for(var j,k,l,m="",t=0,v=d.length;t<v;t++)if(l=d.charAt(t),":"===l){if(""===m||m!=(j=+m))return f(b,0,1);if(k=d.substr(t+1,j),m!=k.length)return f(b,0,1);if(k.length){if(g=q.decodePacket(k,e,!1),b.type===g.type&&b.data===g.data)return f(b,0,1);var p=f(g,t+j,v);if(!1===p)return}t+=j,m=""}else m+=l;return""===m?void 0:f(b,0,1)},q.encodePayloadAsArrayBuffer=function(b,c){return b.length?void a(b,function(a,b){q.encodePacket(a,!0,!0,function(a){return b(null,a)})},function(a,b){var d=b.reduce(function(a,b){var c;return c="string"==typeof b?b.length:b.byteLength,a+c.toString().length+c+2},0),f=new Uint8Array(d),g=0;return b.forEach(function(b){var c="string"==typeof b,d=b;if(c){for(var e=new Uint8Array(b.length),h=0;h<b.length;h++)e[h]=b.charCodeAt(h);d=e.buffer}f[g++]=c?0:1;for(var i=d.byteLength.toString(),h=0;h<i.length;h++)f[g++]=parseInt(i[h]);f[g++]=255;for(var e=new Uint8Array(d),h=0;h<e.length;h++)f[g++]=e[h]}),c(f.buffer)}):c(new ArrayBuffer(0))},q.encodePayloadAsBlob=function(b,c){a(b,function(a,b){q.encodePacket(a,!0,!0,function(d){var f=new Uint8Array(1);if(f[0]=1,"string"==typeof d){for(var e=new Uint8Array(d.length),g=0;g<d.length;g++)e[g]=d.charCodeAt(g);d=e.buffer,f[0]=0}for(var h=d instanceof ArrayBuffer?d.byteLength:d.size,i=h.toString(),j=new Uint8Array(i.length+1),g=0;g<i.length;g++)j[g]=parseInt(i[g]);if(j[i.length]=255,w){var a=new w([f.buffer,j.buffer,d]);b(null,a)}})},function(a,b){return c(new w(b))})},q.decodePayloadAsBinary=function(e,f,g){"function"==typeof f&&(g=f,f=null);for(var j=e,k=[];0<j.byteLength;){for(var i=new Uint8Array(j),m=0===i[0],a="",s=1;255!==i[s];s++){if(310<a.length)return g(b,0,1);a+=i[s]}j=h(j,2+a.length),a=parseInt(a);var t=h(j,0,a);if(m)try{t=String.fromCharCode.apply(null,new Uint8Array(t))}catch(a){var v=new Uint8Array(t);t="";for(var s=0;s<v.length;s++)t+=String.fromCharCode(v[s])}k.push(t),j=h(j,a)}var l=k.length;k.forEach(function(a,b){g(q.decodePacket(a,f,!0),b,l)})}},function(a){a.exports=Object.keys||function(a){var b=[],c=Object.prototype.hasOwnProperty;for(var d in a)c.call(a,d)&&b.push(d);return b}},function(b,c,d){function f(a){if(!a||"object"!=typeof a)return!1;if(g(a)){for(var b=0,c=a.length;b<c;b++)if(f(a[b]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(a)||"function"==typeof ArrayBuffer&&a instanceof ArrayBuffer||h&&a instanceof Blob||j&&a instanceof File)return!0;if(a.toJSON&&"function"==typeof a.toJSON&&1===arguments.length)return f(a.toJSON(),!0);for(var d in a)if(Object.prototype.hasOwnProperty.call(a,d)&&f(a[d]))return!0;return!1}var g=d(10),e=Object.prototype.toString,h="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===e.call(Blob),j="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===e.call(File);b.exports=f},function(a){a.exports=function(b,c,d){var f=b.byteLength;if(c=c||0,d=d||f,b.slice)return b.slice(c,d);if(0>c&&(c+=f),0>d&&(d+=f),d>f&&(d=f),c>=f||c>=d||0===f)return new ArrayBuffer(0);for(var g=new Uint8Array(b),h=new Uint8Array(d-c),i=c,j=0;i<d;i++,j++)h[j]=g[i];return h.buffer}},function(a){function b(a,b,d){function f(a,c){if(0>=f.count)throw new Error("after called too many times");--f.count,a?(g=!0,b(a),b=d):0!==f.count||g||b(null,c)}var g=!1;return d=d||c,f.count=a,0===a?b():f}function c(){}a.exports=b},function(b){function g(a){for(var b,c,d=[],f=0,g=a.length;f<g;)b=a.charCodeAt(f++),55296<=b&&56319>=b&&f<g?(c=a.charCodeAt(f++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),f--)):d.push(b);return d}function j(a){for(var b,c=a.length,d=-1,f="";++d<c;)b=a[d],65535<b&&(b-=65536,f+=o(55296|1023&b>>>10),b=56320|1023&b),f+=o(b);return f}function k(a,b){if(55296<=a&&57343>=a){if(b)throw Error("Lone surrogate U+"+a.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function m(a,b){return o(128|63&a>>b)}function n(a,b){if(0==(4294967168&a))return o(a);var c="";return 0==(4294965248&a)?c=o(192|31&a>>6):0==(4294901760&a)?(k(a,b)||(a=65533),c=o(224|15&a>>12),c+=m(a,6)):0==(4292870144&a)&&(c=o(240|7&a>>18),c+=m(a,12),c+=m(a,6)),c+=o(128|63&a)}function e(b,d){d=d||{};for(var f,h=!1!==d.strict,j=g(b),i=j.length,a=-1,k="";++a<i;)f=j[a],k+=n(f,h);return k}function a(){if(u>=q)throw Error("Invalid byte index");var a=255&p[u];if(u++,128==(192&a))return 63&a;throw Error("Invalid continuation byte")}function c(b){var c,d,f,g,h;if(u>q)throw Error("Invalid byte index");if(u==q)return!1;if(c=255&p[u],u++,0==(128&c))return c;if(192==(224&c)){if(d=a(),h=(31&c)<<6|d,128<=h)return h;throw Error("Invalid continuation byte")}if(224==(240&c)){if(d=a(),f=a(),h=(15&c)<<12|d<<6|f,2048<=h)return k(h,b)?h:65533;throw Error("Invalid continuation byte")}if(240==(248&c)&&(d=a(),f=a(),g=a(),h=(7&c)<<18|d<<12|f<<6|g,65536<=h&&1114111>=h))return h;throw Error("Invalid UTF-8 detected")}function i(a,b){b=b||{};var d=!1!==b.strict;p=g(a),q=p.length,u=0;for(var f,h=[];!1!==(f=c(d));)h.push(f);return j(h)}var p,q,u,o=String.fromCharCode;b.exports={version:"2.1.2",encode:e,decode:i}},function(a,b){!function(){"use strict";for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=new Uint8Array(256),c=0;c<a.length;c++)d[a.charCodeAt(c)]=c;b.encode=function(b){var c,d=new Uint8Array(b),e=d.length,f="";for(c=0;c<e;c+=3)f+=a[d[c]>>2],f+=a[(3&d[c])<<4|d[c+1]>>4],f+=a[(15&d[c+1])<<2|d[c+2]>>6],f+=a[63&d[c+2]];return 2==e%3?f=f.substring(0,f.length-1)+"=":1==e%3&&(f=f.substring(0,f.length-2)+"=="),f},b.decode=function(b){var f,g,j,k,l,m=.75*b.length,n=b.length,c=0;"="===b[b.length-1]&&(m--,"="===b[b.length-2]&&m--);var q=new ArrayBuffer(m),t=new Uint8Array(q);for(f=0;f<n;f+=4)g=d[b.charCodeAt(f)],j=d[b.charCodeAt(f+1)],k=d[b.charCodeAt(f+2)],l=d[b.charCodeAt(f+3)],t[c++]=g<<2|j>>4,t[c++]=(15&j)<<4|k>>2,t[c++]=(3&k)<<6|63&l;return q}}()},function(b){function d(a){return a.map(function(a){if(a.buffer instanceof ArrayBuffer){var b=a.buffer;if(a.byteLength!==b.byteLength){var c=new Uint8Array(a.byteLength);c.set(new Uint8Array(b,a.byteOffset,a.byteLength)),b=c.buffer}return b}return a})}function e(a,b){b=b||{};var c=new g;return d(a).forEach(function(a){c.append(a)}),b.type?c.getBlob(b.type):c.getBlob()}function f(a,b){return new Blob(d(a),b||{})}var g="undefined"==typeof g?"undefined"==typeof WebKitBlobBuilder?"undefined"==typeof MSBlobBuilder?"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder:MSBlobBuilder:WebKitBlobBuilder:g,h=function(){try{var a=new Blob(["hi"]);return 2===a.size}catch(a){return!1}}(),i=h&&function(){try{var a=new Blob([new Uint8Array([1,2])]);return 2===a.size}catch(a){return!1}}(),a=g&&g.prototype.append&&g.prototype.getBlob;"undefined"!=typeof Blob&&(e.prototype=Blob.prototype,f.prototype=Blob.prototype),b.exports=function(){return h?i?Blob:f:a?e:void 0}()},function(a,b){b.encode=function(a){var b="";for(var c in a)a.hasOwnProperty(c)&&(b.length&&(b+="&"),b+=encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b},b.decode=function(a){for(var b,c={},d=a.split("&"),e=0,f=d.length;e<f;e++)b=d[e].split("="),c[decodeURIComponent(b[0])]=decodeURIComponent(b[1]);return c}},function(a){a.exports=function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},function(b){"use strict";function d(a){var b="";do b=h[a%j]+b,a=Math.floor(a/j);while(0<a);return b}function e(b){var c=0;for(k=0;k<b.length;k++)c=c*j+a[b.charAt(k)];return c}function f(){var a=d(+new Date);return a===g?a+"."+d(c++):(c=0,g=a)}for(var g,h=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","-","_"],j=64,a={},c=0,k=0;k<j;k++)a[h[k]]=k;f.encode=d,f.decode=e,b.exports=f},function(b,a,d){(function(f){function e(){}function g(){return"undefined"==typeof self?"undefined"==typeof window?"undefined"==typeof f?{}:f:window:self}function h(b){if(i.call(this,b),this.query=this.query||{},!a){var c=g();a=c.___eio=c.___eio||[]}this.index=a.length;var d=this;a.push(function(a){d.onData(a)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){d.script&&(d.script.onerror=e)},!1)}var i=d(19),j=d(30);b.exports=h;var a,k=/\n/g,l=/\\n/g;j(h,i),h.prototype.supportsBinary=!1,h.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),i.prototype.doClose.call(this)},h.prototype.doPoll=function(){var a=this,b=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),b.async=!0,b.src=this.uri(),b.onerror=function(b){a.onError("jsonp poll error",b)};var c=document.getElementsByTagName("script")[0];c?c.parentNode.insertBefore(b,c):(document.head||document.body).appendChild(b),this.script=b;var d="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);d&&setTimeout(function(){var a=document.createElement("iframe");document.body.appendChild(a),document.body.removeChild(a)},100)},h.prototype.doWrite=function(b,d){function e(){f(),d()}function f(){if(g.iframe)try{g.form.removeChild(g.iframe)}catch(a){g.onError("jsonp polling iframe removal error",a)}try{var a="<iframe src=\"javascript:0\" name=\""+g.iframeId+"\">";h=document.createElement(a)}catch(a){h=document.createElement("iframe"),h.name=g.iframeId,h.src="javascript:0"}h.id=g.iframeId,g.form.appendChild(h),g.iframe=h}var g=this;if(!this.form){var h,j=document.createElement("form"),m=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index;j.className="socketio",j.style.position="absolute",j.style.top="-1000px",j.style.left="-1000px",j.target=a,j.method="POST",j.setAttribute("accept-charset","utf-8"),m.name="d",j.appendChild(m),document.body.appendChild(j),this.form=j,this.area=m}this.form.action=this.uri(),f(),b=b.replace(l,"\\\n"),this.area.value=b.replace(k,"\\n");try{this.form.submit()}catch(a){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===g.iframe.readyState&&e()}:this.iframe.onload=e}}).call(a,function(){return this}())},function(b,d,e){function f(a){var b=a&&a.forceBase64;b&&(this.supportsBinary=!1),this.perMessageDeflate=a.perMessageDeflate,this.usingBrowserWebSocket=g&&!a.forceNode,this.protocols=a.protocols,this.usingBrowserWebSocket||(h=j),k.call(this,a)}var g,j,k=e(20),m=e(21),a=e(29),c=e(30),p=e(31),n=e(3)("engine.io-client:websocket");if("undefined"==typeof self)try{j=e(34)}catch(a){}else g=self.WebSocket||self.MozWebSocket;var h=g||j;b.exports=f,c(f,k),f.prototype.name="websocket",f.prototype.supportsBinary=!0,f.prototype.doOpen=function(){if(this.check()){var a=this.uri(),b=this.protocols,c={agent:this.agent,perMessageDeflate:this.perMessageDeflate};c.pfx=this.pfx,c.key=this.key,c.passphrase=this.passphrase,c.cert=this.cert,c.ca=this.ca,c.ciphers=this.ciphers,c.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(c.headers=this.extraHeaders),this.localAddress&&(c.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?b?new h(a,b):new h(a):new h(a,b,c)}catch(a){return this.emit("error",a)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},f.prototype.addEventListeners=function(){var a=this;this.ws.onopen=function(){a.onOpen()},this.ws.onclose=function(){a.onClose()},this.ws.onmessage=function(b){a.onData(b.data)},this.ws.onerror=function(b){a.onError("websocket error",b)}},f.prototype.write=function(a){function b(){c.emit("flush"),setTimeout(function(){c.writable=!0,c.emit("drain")},0)}var c=this;this.writable=!1;for(var d=a.length,e=0,f=d;e<f;e++)!function(a){m.encodePacket(a,c.supportsBinary,function(e){if(!c.usingBrowserWebSocket){var f={};if(a.options&&(f.compress=a.options.compress),c.perMessageDeflate){var g="string"==typeof e?Buffer.byteLength(e):e.length;g<c.perMessageDeflate.threshold&&(f.compress=!1)}}try{c.usingBrowserWebSocket?c.ws.send(e):c.ws.send(e,f)}catch(b){n("websocket closed before onclose event")}--d||b()})}(a[e])},f.prototype.onClose=function(){k.prototype.onClose.call(this)},f.prototype.doClose=function(){"undefined"!=typeof this.ws&&this.ws.close()},f.prototype.uri=function(){var b=this.query||{},c=this.secure?"wss":"ws",d="";this.port&&("wss"==c&&443!==+this.port||"ws"==c&&80!==+this.port)&&(d=":"+this.port),this.timestampRequests&&(b[this.timestampParam]=p()),this.supportsBinary||(b.b64=1),b=a.encode(b),b.length&&(b="?"+b);var e=-1!==this.hostname.indexOf(":");return c+"://"+(e?"["+this.hostname+"]":this.hostname)+d+this.path+b},f.prototype.check=function(){return h&&(!("__initialize"in h)||this.name!==f.prototype.name)}},function(){},function(a){var b=[].indexOf;a.exports=function(a,c){if(b)return a.indexOf(c);for(var d=0;d<a.length;++d)if(a[d]===c)return d;return-1}},function(b,g,j){"use strict";function k(a,b,c){this.io=a,this.nsp=b,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},c&&c.query&&(this.query=c.query),this.io.autoConnect&&this.open()}var m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},o=j(7),i=j(8),q=j(37),a=j(38),c=j(39),p=j(3)("socket.io-client:socket"),n=j(29),h=j(23);b.exports=g=k;var f={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},l=i.prototype.emit;i(k.prototype),k.prototype.subEvents=function(){if(!this.subs){var b=this.io;this.subs=[a(b,"open",c(this,"onopen")),a(b,"packet",c(this,"onpacket")),a(b,"close",c(this,"onclose"))]}},k.prototype.open=k.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},k.prototype.send=function(){var a=q(arguments);return a.unshift("message"),this.emit.apply(this,a),this},k.prototype.emit=function(a){if(f.hasOwnProperty(a))return l.apply(this,arguments),this;var b=q(arguments),c={type:(void 0===this.flags.binary?h(b):this.flags.binary)?o.BINARY_EVENT:o.EVENT,data:b};return c.options={},c.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof b[b.length-1]&&(p("emitting packet with ack id %d",this.ids),this.acks[this.ids]=b.pop(),c.id=this.ids++),this.connected?this.packet(c):this.sendBuffer.push(c),this.flags={},this},k.prototype.packet=function(a){a.nsp=this.nsp,this.io.packet(a)},k.prototype.onopen=function(){if(p("transport is open - connecting"),"/"!==this.nsp)if(this.query){var a="object"===m(this.query)?n.encode(this.query):this.query;p("sending connect packet with query %s",a),this.packet({type:o.CONNECT,query:a})}else this.packet({type:o.CONNECT})},k.prototype.onclose=function(a){p("close (%s)",a),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",a)},k.prototype.onpacket=function(a){var b=a.nsp===this.nsp,c=a.type===o.ERROR&&"/"===a.nsp;if(b||c)switch(a.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(a);break;case o.BINARY_EVENT:this.onevent(a);break;case o.ACK:this.onack(a);break;case o.BINARY_ACK:this.onack(a);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",a.data);}},k.prototype.onevent=function(a){var b=a.data||[];p("emitting event %j",b),null!=a.id&&(p("attaching ack callback to event"),b.push(this.ack(a.id))),this.connected?l.apply(this,b):this.receiveBuffer.push(b)},k.prototype.ack=function(a){var b=this,c=!1;return function(){if(!c){c=!0;var d=q(arguments);p("sending ack %j",d),b.packet({type:h(d)?o.BINARY_ACK:o.ACK,id:a,data:d})}}},k.prototype.onack=function(a){var b=this.acks[a.id];"function"==typeof b?(p("calling ack %s with %j",a.id,a.data),b.apply(this,a.data),delete this.acks[a.id]):p("bad ack %s",a.id)},k.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},k.prototype.emitBuffered=function(){var a;for(a=0;a<this.receiveBuffer.length;a++)l.apply(this,this.receiveBuffer[a]);for(this.receiveBuffer=[],a=0;a<this.sendBuffer.length;a++)this.packet(this.sendBuffer[a]);this.sendBuffer=[]},k.prototype.ondisconnect=function(){p("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},k.prototype.destroy=function(){if(this.subs){for(var a=0;a<this.subs.length;a++)this.subs[a].destroy();this.subs=null}this.io.destroy(this)},k.prototype.close=k.prototype.disconnect=function(){return this.connected&&(p("performing disconnect (%s)",this.nsp),this.packet({type:o.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},k.prototype.compress=function(a){return this.flags.compress=a,this},k.prototype.binary=function(a){return this.flags.binary=a,this}},function(a){function b(a,b){var c=[];b=b||0;for(var d=b||0;d<a.length;d++)c[d-b]=a[d];return c}a.exports=b},function(a){"use strict";function b(a,b,c){return a.on(b,c),{destroy:function(){a.removeListener(b,c)}}}a.exports=b},function(a){var b=[].slice;a.exports=function(a,c){if("string"==typeof c&&(c=a[c]),"function"!=typeof c)throw new Error("bind() requires a function");var d=b.call(arguments,2);return function(){return c.apply(a,d.concat(b.call(arguments)))}}},function(a){function b(a){a=a||{},this.ms=a.min||100,this.max=a.max||1e4,this.factor=a.factor||2,this.jitter=0<a.jitter&&1>=a.jitter?a.jitter:0,this.attempts=0}a.exports=b,b.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var b=Math.random(),c=Math.floor(b*this.jitter*a);a=0==(1&Math.floor(10*b))?a-c:a+c}return 0|Math.min(a,this.max)},b.prototype.reset=function(){this.attempts=0},b.prototype.setMin=function(a){this.ms=a},b.prototype.setMax=function(a){this.max=a},b.prototype.setJitter=function(a){this.jitter=a}}])});var store={get:function(a,b){b=arguments[arguments.length-1],1==arguments.length&&(a=void 0);var c="";a&&(c=`?key=${a}`),fetch(`https://store.jajoosam.repl.co/get${c}`).then(a=>a.json()).then(a=>a.error?console.error(a.error):b(a))},set:function(a,b,c){1==arguments.length&&(b=arguments[0],a=void 0),"object"!=typeof b&&(b={thisisawierdasskey:b});var d="";a&&(d=`?key=${a}`),fetch(`https://store.jajoosam.repl.co/post${d}`,{method:"POST",headers:{"Content-Type":"application/json","X-Replit-User":username},body:JSON.stringify(b)}).then(a=>a.json()).then(a=>a.error?console.error(a.error):void(arguments[2]&&c()))},push:function(a,b,c){1==arguments.length&&(count=arguments[0],a=void 0);var d="";a&&(d=`?key=${a}`),fetch(`https://store.jajoosam.repl.co/push${d}`,{method:"POST",headers:{"Content-Type":"application/json","X-Replit-User":username},body:JSON.stringify({thisisawierdasskey:b})}).then(a=>a.json()).then(a=>a.error?console.error(a.error):void(arguments[2]&&c())).catch(function(a){console.error(a)})},setup:function(a,b){fetch(`https://store.jajoosam.repl.co/setup`,{method:"POST",headers:{"Content-Type":"application/json","X-Replit-User":username},body:JSON.stringify(a)}).then(a=>a.json()).then(a=>a.error?console.error(a.error):void(arguments[1]&&b())).catch(function(a){console.error(a)})},realtime:function(a){var b=io.connect("https://store.jajoosam.repl.co");b.emit("join",{id:window.location.hostname.replace(`--`,`.`)}),b.on("change",function(b){a(b)})},increment:function(a,b,c){1==arguments.length&&(b=arguments[0],a=void 0);var d="";a&&(d=`?key=${a}`),fetch(`https://store.jajoosam.repl.co/increment${d}`,{method:"POST",headers:{"Content-Type":"application/json","X-Replit-User":username},body:JSON.stringify({thisisawierdasskey:b})}).then(a=>a.json()).then(a=>a.error?console.error(a.error):void(arguments[2]&&c())).catch(function(a){console.error(a)})},delete:function(a,b){("string"!=typeof a||"undefined"!=typeof a)&&(b=a,a=void 0);var c="";a&&(c=`?key=${a}`),fetch(`https://store.jajoosam.repl.co/delete${c}`,{headers:{"X-Replit-User":username}}).then(a=>a.json()).then(a=>a.error?console.error(a.error):arguments[1]?b():void 0)}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment