(self.webpackChunknotion_next=self.webpackChunknotion_next||[]).push([[9053],{469053:(t,e,n)=>{"use strict";n.r(e),n.d(e,{createClient:()=>a,generateNewClientSessionId:()=>s,getCurrentClientSessionId:()=>c});var r=n(471924),o=n(95477);let i=r.Il();function s(){i=r.Il()}function c(){return i}function a(t){const e=n(952183),{maxReconnectDelayMs:r,minReconnectDelayMs:s}=t;return new e(`${o.default.audioProcessor.url}?sessionId=${encodeURIComponent(i)}`,{reconnect:{max:r,min:s,"reconnect timeout":2500,retries:1e20},timeout:2500,credentials:!0,transport:{withCredentials:!0},transportOverrides:{transports:["websocket"]}})}},952183:function(t,e,n){var r;!function(o,i,s,c){i[o]=s.call(i);for(var a=0;a<c.length;a++)c[a](i[o]);t.exports?t.exports=i[o]:void 0===(r=function(){return i[o]}.call(e,n,e,t))||(t.exports=r)}("Primus",this||{},(function(){var t=function t(e,n,r){function o(s,c){if(!n[s]){if(!e[s]){if(i)return i(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var u=n[s]={exports:{}};e[s][0].call(u.exports,(function(t){return o(e[s][1][t]||t)}),u,u.exports,t,e,n,r)}return n[s].exports}for(var i=void 0,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(t,e,n){"use strict";e.exports=function(t,e){var n=/[, ]+/;function r(t,r){if(e[t]){if("string"==typeof e[t]&&(e[t]=e[t].split(n)),"function"==typeof e[t])return e[t].call(r);for(var o,i,s=0;s<e[t].length;s++)"function"===(o=typeof(i=e[t][s]))?i.call(r):"string"===o&&"function"==typeof r[i]&&r[i]()}}return e=e||{},"string"==typeof(t=t||[])&&(t=t.split(n)),function(){var e,n=this,o=0;if(null===n[t[0]])return!1;for(r("before",n);o<t.length;o++)n[e=t[o]]&&("function"==typeof n[e].destroy&&n[e].destroy(),n[e]=null);return n.emit&&n.emit("destroy"),r("after",n),!0}}},{}],2:[function(t,e,n){"use strict";e.exports=function(){for(var t,e=this,n=0,r=arguments.length,o=new Array(r);n<r;n++)o[n]=arguments[n];return"function"!=typeof o[o.length-1]?function(){for(var t=0,n=arguments.length,r=new Array(n);t<n;t++)r[t]=arguments[t];return e.emit.apply(e,o.concat(r))}:(t=o.pop(),function(){for(var n=0,r=arguments.length,i=new Array(r+1);n<r;n++)i[n+1]=arguments[n];return i[0]=function(t,n){if(t)return e.emit("error",t);i=void 0===n?i.slice(1):null===n?[]:n,e.emit.apply(e,o.concat(i))},t.apply(e,i),!0})}},{}],3:[function(t,e,n){"use strict";var r=Object.prototype.hasOwnProperty,o="~";function i(){}function s(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function c(t,e,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var c=new s(n,r||t,i),a=o?o+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],c]:t._events[a].push(c):(t._events[a]=c,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function u(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),u.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)r.call(t,e)&&n.push(o?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},u.prototype.listeners=function(t){var e=o?o+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,s=new Array(i);r<i;r++)s[r]=n[r].fn;return s},u.prototype.listenerCount=function(t){var e=o?o+t:t,n=this._events[e];return n?n.fn?1:n.length:0},u.prototype.emit=function(t,e,n,r,i,s){var c=o?o+t:t;if(!this._events[c])return!1;var a,u,f=this._events[c],p=arguments.length;if(f.fn){switch(f.once&&this.removeListener(t,f.fn,void 0,!0),p){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,e),!0;case 3:return f.fn.call(f.context,e,n),!0;case 4:return f.fn.call(f.context,e,n,r),!0;case 5:return f.fn.call(f.context,e,n,r,i),!0;case 6:return f.fn.call(f.context,e,n,r,i,s),!0}for(u=1,a=new Array(p-1);u<p;u++)a[u-1]=arguments[u];f.fn.apply(f.context,a)}else{var l,h=f.length;for(u=0;u<h;u++)switch(f[u].once&&this.removeListener(t,f[u].fn,void 0,!0),p){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,e);break;case 3:f[u].fn.call(f[u].context,e,n);break;case 4:f[u].fn.call(f[u].context,e,n,r);break;default:if(!a)for(l=1,a=new Array(p-1);l<p;l++)a[l-1]=arguments[l];f[u].fn.apply(f[u].context,a)}}return!0},u.prototype.on=function(t,e,n){return c(this,t,e,n,!1)},u.prototype.once=function(t,e,n){return c(this,t,e,n,!0)},u.prototype.removeListener=function(t,e,n,r){var i=o?o+t:t;if(!this._events[i])return this;if(!e)return a(this,i),this;var s=this._events[i];if(s.fn)s.fn!==e||r&&!s.once||n&&s.context!==n||a(this,i);else{for(var c=0,u=[],f=s.length;c<f;c++)(s[c].fn!==e||r&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[i]=1===u.length?u[0]:u:a(this,i)}return this},u.prototype.removeAllListeners=function(t){var e;return t?(e=o?o+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=o,u.EventEmitter=u,void 0!==e&&(e.exports=u)},{}],4:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},{}],5:[function(t,e,n){"use strict";var r=new RegExp("^((?:\\d+)?\\.?\\d+) *("+["milliseconds?","msecs?","ms","seconds?","secs?","s","minutes?","mins?","m","hours?","hrs?","h","days?","d","weeks?","wks?","w","years?","yrs?","y"].join("|")+")?$","i"),o=36e5,i=24*o;e.exports=function(t){var e,n,s=typeof t;if("number"===s)return t;if("string"!==s||"0"===t||!t)return 0;if(+t)return+t;if(t.length>1e4||!(n=r.exec(t)))return 0;switch(e=parseFloat(n[1]),n[2].toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 31536e6*e;case"weeks":case"week":case"wks":case"wk":case"w":return 6048e5*e;case"days":case"day":case"d":return e*i;case"hours":case"hour":case"hrs":case"hr":case"h":return e*o;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*e;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*e;default:return e}}},{}],6:[function(t,e,n){"use strict";e.exports=function(t){var e,n=0;function r(){return n||(n=1,e=t.apply(this,arguments),t=null),e}return r.displayName=t.displayName||t.name||r.displayName||r.name,r}},{}],7:[function(t,e,n){var r,o,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(t){r=s}try{o="function"==typeof clearTimeout?clearTimeout:c}catch(t){o=c}}();var u,f=[],p=!1,l=-1;function h(){p&&u&&(p=!1,u.length?f=u.concat(f):l=-1,f.length&&y())}function y(){if(!p){var t=a(h);p=!0;for(var e=f.length;e;){for(u=f,f=[];++l<e;)u&&u[l].run();l=-1,e=f.length}u=null,p=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===c||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{return o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new d(t,e)),1!==f.length||p||a(y)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],8:[function(t,e,n){"use strict";var r=Object.prototype.hasOwnProperty;function o(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return null}}function i(t){try{return encodeURIComponent(t)}catch(e){return null}}n.stringify=function(t,e){e=e||"";var n,o,s=[];for(o in"string"!=typeof e&&(e="?"),t)if(r.call(t,o)){if((n=t[o])||null!=n&&!isNaN(n)||(n=""),o=i(o),n=i(n),null===o||null===n)continue;s.push(o+"="+n)}return s.length?e+s.join("&"):""},n.parse=function(t){for(var e,n=/([^=?#&]+)=?([^&]*)/g,r={};e=n.exec(t);){var i=o(e[1]),s=o(e[2]);null===i||null===s||i in r||(r[i]=s)}return r}},{}],9:[function(t,e,n){"use strict";var r=t("eventemitter3"),o=t("millisecond"),i=t("demolish"),s=t("tick-tock"),c=t("one-time");function a(t,e,n){return o(t in n?n[t]:t in e?e[t]:u[t])}function u(t){var e=this;if(!(e instanceof u))return new u(t);t=t||{},e.attempt=null,e._fn=null,e["reconnect timeout"]=a("reconnect timeout",e,t),e.retries=a("retries",e,t),e.factor=a("factor",e,t),e.max=a("max",e,t),e.min=a("min",e,t),e.timers=new s(e)}u.prototype=new r,u.prototype.constructor=u,u["reconnect timeout"]="30 seconds",u.max=1/0,u.min="500 ms",u.retries=10,u.factor=2,u.prototype.reconnect=function(){var t=this;return t.backoff((function(e,n){if(n.duration=+new Date-n.start,e)return t.emit("reconnect failed",e,n);t.emit("reconnected",n)}),t.attempt)},u.prototype.backoff=function(t,e){var n=this;return(e=e||n.attempt||{}).backoff?n:(e["reconnect timeout"]=a("reconnect timeout",n,e),e.retries=a("retries",n,e),e.factor=a("factor",n,e),e.max=a("max",n,e),e.min=a("min",n,e),e.start=+e.start||+new Date,e.duration=+e.duration||0,e.attempt=+e.attempt||0,e.attempt===e.retries?(t.call(n,new Error("Unable to recover"),e),n):(e.backoff=!0,e.attempt++,n.attempt=e,e.scheduled=1!==e.attempt?Math.min(Math.round((Math.random()+1)*e.min*Math.pow(e.factor,e.attempt-1)),e.max):e.min,n.timers.setTimeout("reconnect",(function(){e.duration=+new Date-e.start,e.backoff=!1,n.timers.clear("reconnect, timeout");var r=n._fn=c((function(r){if(n.reset(),r)return n.backoff(t,e);t.call(n,void 0,e)}));n.emit("reconnect",e,r),n.timers.setTimeout("timeout",(function(){var t=new Error("Failed to reconnect in a timely manner");e.duration=+new Date-e.start,n.emit("reconnect timeout",t,e),r(t)}),e["reconnect timeout"])}),e.scheduled),n.emit("reconnect scheduled",e),n))},u.prototype.reconnecting=function(){return!!this.attempt},u.prototype.reconnected=function(t){return this._fn&&this._fn(t),this},u.prototype.reset=function(){return this._fn=this.attempt=null,this.timers.clear("reconnect, timeout"),this},u.prototype.destroy=i("timers attempt _fn"),e.exports=u},{demolish:1,eventemitter3:10,millisecond:5,"one-time":6,"tick-tock":12}],10:[function(t,e,n){"use strict";var r="function"!=typeof Object.create&&"~";function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(){}i.prototype._events=void 0,i.prototype.listeners=function(t,e){var n=r?r+t:t,o=this._events&&this._events[n];if(e)return!!o;if(!o)return[];if(o.fn)return[o.fn];for(var i=0,s=o.length,c=new Array(s);i<s;i++)c[i]=o[i].fn;return c},i.prototype.emit=function(t,e,n,o,i,s){var c=r?r+t:t;if(!this._events||!this._events[c])return!1;var a,u,f=this._events[c],p=arguments.length;if("function"==typeof f.fn){switch(f.once&&this.removeListener(t,f.fn,void 0,!0),p){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,e),!0;case 3:return f.fn.call(f.context,e,n),!0;case 4:return f.fn.call(f.context,e,n,o),!0;case 5:return f.fn.call(f.context,e,n,o,i),!0;case 6:return f.fn.call(f.context,e,n,o,i,s),!0}for(u=1,a=new Array(p-1);u<p;u++)a[u-1]=arguments[u];f.fn.apply(f.context,a)}else{var l,h=f.length;for(u=0;u<h;u++)switch(f[u].once&&this.removeListener(t,f[u].fn,void 0,!0),p){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,e);break;case 3:f[u].fn.call(f[u].context,e,n);break;default:if(!a)for(l=1,a=new Array(p-1);l<p;l++)a[l-1]=arguments[l];f[u].fn.apply(f[u].context,a)}}return!0},i.prototype.on=function(t,e,n){var i=new o(e,n||this),s=r?r+t:t;return this._events||(this._events=r?{}:Object.create(null)),this._events[s]?this._events[s].fn?this._events[s]=[this._events[s],i]:this._events[s].push(i):this._events[s]=i,this},i.prototype.once=function(t,e,n){var i=new o(e,n||this,!0),s=r?r+t:t;return this._events||(this._events=r?{}:Object.create(null)),this._events[s]?this._events[s].fn?this._events[s]=[this._events[s],i]:this._events[s].push(i):this._events[s]=i,this},i.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events||!this._events[i])return this;var s=this._events[i],c=[];if(e)if(s.fn)(s.fn!==e||o&&!s.once||n&&s.context!==n)&&c.push(s);else for(var a=0,u=s.length;a<u;a++)(s[a].fn!==e||o&&!s[a].once||n&&s[a].context!==n)&&c.push(s[a]);return c.length?this._events[i]=1===c.length?c[0]:c:delete this._events[i],this},i.prototype.removeAllListeners=function(t){return this._events?(t?delete this._events[r?r+t:t]:this._events=r?{}:Object.create(null),this):this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prototype.setMaxListeners=function(){return this},i.prefixed=r,void 0!==e&&(e.exports=i)},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],12:[function(t,e,n){(function(n,r){(function(){"use strict";var o=Object.prototype.hasOwnProperty,i=t("millisecond");function s(t,e,n,r){this.start=+new Date,this.duration=n,this.clear=e,this.timer=t,this.fns=[r]}function c(t){clearTimeout(t)}function a(t){clearInterval(t)}function u(t){r(t)}function f(t){if(!(this instanceof f))return new f(t);this.timers={},this.context=t||this}s.prototype.remaining=function(){return this.duration-this.taken()},s.prototype.taken=function(){return+new Date-this.start},f.prototype.tock=function(t,e){var n=this;return function(){if(t in n.timers){var r=n.timers[t].fns.slice(),o=r.length,i=0;for(e?n.clear(t):n.start=+new Date;i<o;i++)r[i].call(n.context)}}},f.prototype.setTimeout=function(t,e,n){var r,o=this;return o.timers[t]?(o.timers[t].fns.push(e),o):(r=i(n),o.timers[t]=new s(setTimeout(o.tock(t,!0),i(n)),c,r,e),o)},f.prototype.setInterval=function(t,e,n){var r,o=this;return o.timers[t]?(o.timers[t].fns.push(e),o):(r=i(n),o.timers[t]=new s(setInterval(o.tock(t),i(n)),a,r,e),o)},f.prototype.setImmediate=function(t,e){var r=this;return"function"!=typeof n?r.setTimeout(t,e,0):r.timers[t]?(r.timers[t].fns.push(e),r):(r.timers[t]=new s(n(r.tock(t,!0)),u,0,e),r)},f.prototype.active=function(t){return t in this.timers},f.prototype.clear=function(){var t,e,n,r=arguments.length?arguments:[],i=this;if(1===r.length&&"string"==typeof r[0]&&(r=r[0].split(/[, ]+/)),!r.length)for(t in i.timers)o.call(i.timers,t)&&r.push(t);for(e=0,n=r.length;e<n;e++)(t=i.timers[r[e]])&&(t.clear(t.timer),t.fns=t.timer=t.clear=null,delete i.timers[r[e]]);return i},f.prototype.adjust=function(t,e){var n,r=this,o=i(e),s=r.timers[t];return s?(n=s.clear===a,s.clear(s.timer),s.start=+new Date,s.duration=o,s.timer=(n?setInterval:setTimeout)(r.tock(t,!n),o),r):r},f.prototype.end=f.prototype.destroy=function(){return!!this.context&&(this.clear(),this.context=this.timers=null,!0)},f.Timer=s,e.exports=f}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{millisecond:5,timers:13}],13:[function(t,e,n){(function(e,r){(function(){var o=t("process/browser.js").nextTick,i=Function.prototype.apply,s=Array.prototype.slice,c={},a=0;function u(t,e){this._id=t,this._clearFn=e}n.setTimeout=function(){return new u(i.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new u(i.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(t){t.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},n.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},n._unrefActive=n.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n.setImmediate="function"==typeof e?e:function(t){var e=a++,r=!(arguments.length<2)&&s.call(arguments,1);return c[e]=!0,o((function(){c[e]&&(r?t.apply(null,r):t.call(null),n.clearImmediate(e))})),e},n.clearImmediate="function"==typeof r?r:function(t){delete c[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":7,timers:13}],14:[function(t,e,r){(function(n){(function(){"use strict";var r=t("requires-port"),o=t("querystringify"),i=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,s=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,c=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function a(t){return(t||"").toString().replace(c,"")}var u=[["#","hash"],["?","query"],function(t){return t.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],f={hash:1,query:1};function p(t){var e,r=("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(t=t||r);if("blob:"===t.protocol)o=new h(unescape(t.pathname),{});else if("string"===s)for(e in o=new h(t,{}),f)delete o[e];else if("object"===s){for(e in t)e in f||(o[e]=t[e]);void 0===o.slashes&&(o.slashes=i.test(t.href))}return o}function l(t){t=a(t);var e=s.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!(e[2]&&e[2].length>=2),rest:e[2]&&1===e[2].length?"/"+e[3]:e[3]}}function h(t,e,n){if(t=a(t),!(this instanceof h))return new h(t,e,n);var i,s,c,f,y,d,m=u.slice(),v=typeof e,g=this,b=0;for("object"!==v&&"string"!==v&&(n=e,e=null),n&&"function"!=typeof n&&(n=o.parse),e=p(e),i=!(s=l(t||"")).protocol&&!s.slashes,g.slashes=s.slashes||i&&e.slashes,g.protocol=s.protocol||e.protocol||"",t=s.rest,s.slashes||(m[3]=[/(.*)/,"pathname"]);b<m.length;b++)"function"!=typeof(f=m[b])?(c=f[0],d=f[1],c!=c?g[d]=t:"string"==typeof c?~(y=t.indexOf(c))&&("number"==typeof f[2]?(g[d]=t.slice(0,y),t=t.slice(y+f[2])):(g[d]=t.slice(y),t=t.slice(0,y))):(y=c.exec(t))&&(g[d]=y[1],t=t.slice(0,y.index)),g[d]=g[d]||i&&f[3]&&e[d]||"",f[4]&&(g[d]=g[d].toLowerCase())):t=f(t);n&&(g.query=n(g.query)),i&&e.slashes&&"/"!==g.pathname.charAt(0)&&(""!==g.pathname||""!==e.pathname)&&(g.pathname=function(t,e){if(""===t)return e;for(var n=(e||"/").split("/").slice(0,-1).concat(t.split("/")),r=n.length,o=n[r-1],i=!1,s=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),s++):s&&(0===r&&(i=!0),n.splice(r,1),s--);return i&&n.unshift(""),"."!==o&&".."!==o||n.push(""),n.join("/")}(g.pathname,e.pathname)),"/"!==g.pathname.charAt(0)&&g.hostname&&(g.pathname="/"+g.pathname),r(g.port,g.protocol)||(g.host=g.hostname,g.port=""),g.username=g.password="",g.auth&&(f=g.auth.split(":"),g.username=f[0]||"",g.password=f[1]||""),g.origin=g.protocol&&g.host&&"file:"!==g.protocol?g.protocol+"//"+g.host:"null",g.href=g.toString()}h.prototype={set:function(t,e,n){var i=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(n||o.parse)(e)),i[t]=e;break;case"port":i[t]=e,r(e,i.protocol)?e&&(i.host=i.hostname+":"+e):(i.host=i.hostname,i[t]="");break;case"hostname":i[t]=e,i.port&&(e+=":"+i.port),i.host=e;break;case"host":i[t]=e,/:\d+$/.test(e)?(e=e.split(":"),i.port=e.pop(),i.hostname=e.join(":")):(i.hostname=e,i.port="");break;case"protocol":i.protocol=e.toLowerCase(),i.slashes=!n;break;case"pathname":case"hash":if(e){var s="pathname"===t?"/":"#";i[t]=e.charAt(0)!==s?s+e:e}else i[t]=e;break;default:i[t]=e}for(var c=0;c<u.length;c++){var a=u[c];a[4]&&(i[a[1]]=i[a[1]].toLowerCase())}return i.origin=i.protocol&&i.host&&"file:"!==i.protocol?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(t){t&&"function"==typeof t||(t=o.stringify);var e,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var i=r+(n.slashes?"//":"");return n.username&&(i+=n.username,n.password&&(i+=":"+n.password),i+="@"),i+=n.host+n.pathname,(e="object"==typeof n.query?t(n.query):n.query)&&(i+="?"!==e.charAt(0)?"?"+e:e),n.hash&&(i+=n.hash),i}},h.extractProtocol=l,h.location=p,h.trimLeft=a,h.qs=o,e.exports=h}).call(this)}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:8,"requires-port":11}],15:[function(t,e,n){"use strict";var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,s={},c=0,a=0;function u(t){var e="";do{e=o[t%i]+e,t=Math.floor(t/i)}while(t>0);return e}function f(){var t=u(+new Date);return t!==r?(c=0,r=t):t+"."+u(c++)}for(;a<i;a++)s[o[a]]=a;f.encode=u,f.decode=function(t){var e=0;for(a=0;a<t.length;a++)e=e*i+s[t.charAt(a)];return e},e.exports=f},{}],16:[function(t,e,n){"use strict";var r,o=t("eventemitter3"),i=t("tick-tock"),s=t("recovery"),c=t("querystringify"),a=t("inherits"),u=t("demolish"),f=t("yeast"),p=/\u2028/g,l=/\u2029/g;function h(t,e){if(!(t instanceof y)){var n=new Error("Primus#"+e+"'s context should called with a Primus instance");if("function"!=typeof t.listeners||!t.listeners("error").length)throw n;t.emit("error",n)}}try{r=location.origin?location.origin:location.protocol+"//"+location.host}catch(d){r="http://127.0.0.1"}function y(t,e){if(!(this instanceof y))return new y(t,e);if(y.Stream.call(this),"function"!=typeof this.client)return this.critical(new Error("The client library has not been compiled correctly, see https://github.com/primus/primus#client-library for more details"));if("object"==typeof t?t=(e=t).url||e.uri||r:e=e||{},"ping"in e||"pong"in e)return this.critical(new Error("The `ping` and `pong` options have been removed"));var n=this;e.queueSize="queueSize"in e?e.queueSize:1/0,e.timeout="timeout"in e?e.timeout:1e4,e.reconnect="reconnect"in e?e.reconnect:{},e.pingTimeout="pingTimeout"in e?e.pingTimeout:45e3,e.strategy="strategy"in e?e.strategy:[],e.transport="transport"in e?e.transport:{},e.transportOverrides="transportOverrides"in e?e.transportOverrides:{},n.buffer=[],n.writable=!0,n.readable=!0,n.url=n.parse(t||r),n.readyState=y.CLOSED,n.options=e,n.timers=new i(this),n.socket=null,n.disconnect=!1,n.transport=e.transport,n.transportOverrides=e.transportOverrides,n.transformers={outgoing:[],incoming:[]},n.recovery=new s(e.reconnect),"string"==typeof e.strategy&&(e.strategy=e.strategy.split(/\s?,\s?/g)),!1===e.strategy?e.strategy=[]:e.strategy.length||(e.strategy.push("disconnect","online"),this.authorization||e.strategy.push("timeout")),e.strategy=e.strategy.join(",").toLowerCase(),"websockets"in e&&(n.AVOID_WEBSOCKETS=!e.websockets),"network"in e&&(n.NETWORK_EVENTS=e.network),e.manual||n.timers.setTimeout("open",(function(){n.timers.clear("open"),n.open()}),0),n.initialise(e)}y.requires=y.require=function(e){if("function"==typeof t)return t(e)};try{y.Stream=y.requires("stream")}catch(d){}y.Stream||(y.Stream=o),a(y,y.Stream),y.OPENING=1,y.CLOSED=2,y.OPEN=3,y.prototype.AVOID_WEBSOCKETS=!1,y.prototype.NETWORK_EVENTS=!1,y.prototype.online=!0;try{(y.prototype.NETWORK_EVENTS="onLine"in navigator&&(window.addEventListener||document.body.attachEvent))&&(navigator.onLine||(y.prototype.online=!1))}catch(d){}y.prototype.ark={},y.prototype.emits=t("emits"),y.prototype.plugin=function(t){if(h(this,"plugin"),t)return this.ark[t];var e={};for(t in this.ark)e[t]=this.ark[t];return e},y.prototype.reserved=function(t){return/^(incoming|outgoing)::/.test(t)||t in this.reserved.events},y.prototype.reserved.events={"reconnect scheduled":1,"reconnect timeout":1,readyStateChange:1,"reconnect failed":1,reconnected:1,reconnect:1,offline:1,timeout:1,destroy:1,online:1,error:1,close:1,open:1,data:1,end:1},y.prototype.initialise=function(t){var e=this;for(var n in e.recovery.on("reconnected",e.emits("reconnected")).on("reconnect failed",e.emits("reconnect failed",(function(t){e.emit("end"),t()}))).on("reconnect timeout",e.emits("reconnect timeout")).on("reconnect scheduled",e.emits("reconnect scheduled")).on("reconnect",e.emits("reconnect",(function(t){e.emit("outgoing::reconnect"),t()}))),e.on("outgoing::open",(function(){var t=e.readyState;e.readyState=y.OPENING,t!==e.readyState&&e.emit("readyStateChange","opening")})),e.on("incoming::open",(function(){var t=e.readyState;if(e.recovery.reconnecting()&&e.recovery.reconnected(),e.writable=!0,e.readable=!0,e.online||(e.online=!0,e.emit("online")),e.readyState=y.OPEN,t!==e.readyState&&e.emit("readyStateChange","open"),e.heartbeat(),e.buffer.length){var n=e.buffer.slice(),r=n.length,o=0;for(e.buffer.length=0;o<r;o++)e._write(n[o])}e.emit("open")})),e.on("incoming::ping",(function(t){e.online=!0,e.heartbeat(),e.emit("outgoing::pong",t),e._write("primus::pong::"+t)})),e.on("incoming::error",(function(t){var n=e.timers.active("connect"),r=t;if("string"==typeof t)r=new Error(t);else if(!(t instanceof Error)&&"object"==typeof t)for(var o in r=new Error(t.message||t.reason),t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);if(e.recovery.reconnecting())return e.recovery.reconnected(r);e.listeners("error").length&&e.emit("error",r),n&&(~e.options.strategy.indexOf("timeout")?e.recovery.reconnect():e.end())})),e.on("incoming::data",(function(t){e.decoder(t,(function(n,r){if(n)return e.listeners("error").length&&e.emit("error",n);e.protocol(r)||e.transforms(e,e,"incoming",r,t)}))})),e.on("incoming::end",(function(){var t=e.readyState;return e.disconnect?(e.disconnect=!1,e.end()):(e.readyState=y.CLOSED,t!==e.readyState&&e.emit("readyStateChange","end"),e.timers.active("connect")&&e.end(),t!==y.OPEN?!!e.recovery.reconnecting()&&e.recovery.reconnect():(this.writable=!1,this.readable=!1,this.timers.clear(),e.emit("close"),~e.options.strategy.indexOf("disconnect")?e.recovery.reconnect():(e.emit("outgoing::end"),void e.emit("end"))))})),e.client(),e.ark)e.ark[n].call(e,e,t);return e.NETWORK_EVENTS?(e.offlineHandler=function(){e.online&&(e.online=!1,e.emit("offline"),e.end(),e.recovery.reset())},e.onlineHandler=function(){e.online||(e.online=!0,e.emit("online"),~e.options.strategy.indexOf("online")&&e.recovery.reconnect())},window.addEventListener?(window.addEventListener("offline",e.offlineHandler,!1),window.addEventListener("online",e.onlineHandler,!1)):document.body.attachEvent&&(document.body.attachEvent("onoffline",e.offlineHandler),document.body.attachEvent("ononline",e.onlineHandler)),e):e},y.prototype.protocol=function(t){if("string"!=typeof t||0!==t.indexOf("primus::"))return!1;var e=t.indexOf(":",8),n=t.slice(e+2);switch(t.slice(8,e)){case"ping":this.emit("incoming::ping",+n);break;case"server":"close"===n&&(this.disconnect=!0);break;case"id":this.emit("incoming::id",n);break;default:return!1}return!0},y.prototype.transforms=function(t,e,n,r,o){var i={data:r},s=t.transformers[n];return function t(n,r){var o=s[n++];if(!o)return r();if(1===o.length){if(!1===o.call(e,i))return;return t(n,r)}o.call(e,i,(function(o,i){if(o)return e.emit("error",o);!1!==i&&t(n,r)}))}(0,(function(){if("incoming"===n)return e.emit("data",i.data,o);e._write(i.data)})),this},y.prototype.id=function(t){return this.socket&&this.socket.id?t(this.socket.id):(this._write("primus::id::"),this.once("incoming::id",t))},y.prototype.open=function(){return h(this,"open"),!this.recovery.reconnecting()&&this.options.timeout&&this.timeout(),this.emit("outgoing::open"),this},y.prototype.write=function(t){return h(this,"write"),this.transforms(this,this,"outgoing",t),!0},y.prototype._write=function(t){var e=this;return y.OPEN!==e.readyState?(this.buffer.length===this.options.queueSize&&this.buffer.splice(0,1),this.buffer.push(t),!1):(e.encoder(t,(function(t,n){if(t)return e.listeners("error").length&&e.emit("error",t);"string"==typeof n&&(~n.indexOf("\u2028")&&(n=n.replace(p,"\\u2028")),~n.indexOf("\u2029")&&(n=n.replace(l,"\\u2029"))),e.emit("outgoing::data",n)})),!0)},y.prototype.heartbeat=function(){return this.options.pingTimeout?(this.timers.clear("heartbeat"),this.timers.setTimeout("heartbeat",(function(){this.online&&(this.online=!1,this.emit("offline"),this.emit("incoming::end"))}),this.options.pingTimeout),this):this},y.prototype.timeout=function(){var t=this;function e(){t.removeListener("error",e).removeListener("open",e).removeListener("end",e).timers.clear("connect")}return t.timers.setTimeout("connect",(function(){e(),t.readyState===y.OPEN||t.recovery.reconnecting()||(t.emit("timeout"),~t.options.strategy.indexOf("timeout")?t.recovery.reconnect():t.end())}),t.options.timeout),t.on("error",e).on("open",e).on("end",e)},y.prototype.end=function(t){if(h(this,"end"),this.readyState===y.CLOSED&&!this.timers.active("connect")&&!this.timers.active("open"))return this.recovery.reconnecting()&&(this.recovery.reset(),this.emit("end")),this;void 0!==t&&this.write(t),this.writable=!1,this.readable=!1;var e=this.readyState;return this.readyState=y.CLOSED,e!==this.readyState&&this.emit("readyStateChange","end"),this.timers.clear(),this.emit("outgoing::end"),this.emit("close"),this.emit("end"),this},y.prototype.destroy=u("url timers options recovery socket transport transformers",{before:"end",after:["removeAllListeners",function(){this.NETWORK_EVENTS&&(window.addEventListener?(window.removeEventListener("offline",this.offlineHandler),window.removeEventListener("online",this.onlineHandler)):document.body.attachEvent&&(document.body.detachEvent("onoffline",this.offlineHandler),document.body.detachEvent("ononline",this.onlineHandler)))}]}),y.prototype.clone=function(t){return this.merge({},t)},y.prototype.merge=function(t){for(var e,n,r=1;r<arguments.length;r++)for(e in n=arguments[r])Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t},y.prototype.parse=t("url-parse"),y.prototype.querystring=c.parse,y.prototype.querystringify=c.stringify,y.prototype.uri=function(t){var e=this.url,n=[],r=!1;t.query&&(r=!0),(t=t||{}).protocol="protocol"in t?t.protocol:"http:",t.query=!(!e.query||!r)&&e.query.slice(1),t.secure="secure"in t?t.secure:"https:"===e.protocol||"wss:"===e.protocol,t.auth="auth"in t?t.auth:e.auth,t.pathname="pathname"in t?t.pathname:this.pathname,t.port="port"in t?+t.port:+e.port||(t.secure?443:80);var o=this.querystring(t.query||"");return o._primuscb=f(),t.query=this.querystringify(o),this.emit("outgoing::url",t),n.push(t.secure?t.protocol.replace(":","s:"):t.protocol,""),n.push(t.auth?t.auth+"@"+e.host:e.host),t.pathname&&n.push(t.pathname.slice(1)),r?n[n.length-1]+="?"+t.query:delete t.query,t.object?t:n.join("/")},y.prototype.transform=function(t,e){return h(this,"transform"),t in this.transformers?(this.transformers[t].push(e),this):this.critical(new Error("Invalid transformer type"))},y.prototype.critical=function(t){if(this.emit("error",t))return this;throw t},y.connect=function(t,e){return new y(t,e)},y.EventEmitter=o,y.prototype.client=function(){var t,e=this.emits("incoming::data"),n=this.emits("incoming::error"),r=this.emits("incoming::open"),o=this.emits("incoming::end"),i=this,s=function(){if("undefined"!=typeof eio)return eio;try{return y.requires("engine.io-client")}catch(d){}}();if(!s)return i.critical(new Error("Missing required `engine.io-client` module. Please run `npm install --save engine.io-client`"));i.on("outgoing::open",(function(){i.emit("outgoing::end"),i.socket=t=s(i.merge(i.transport,i.url,i.uri({protocol:"http:",query:!0,object:!0}),{rememberUpgrade:!1,forceBase64:!0,enablesXDR:!1,timestampRequests:!0,path:this.pathname,transports:i.AVOID_WEBSOCKETS?["polling"]:["polling","websocket"]},i.transportOverrides)),s.sockets&&s.sockets.length&&(s.sockets.length=0),t.on("message",e),t.on("error",n),t.on("close",o),t.on("open",r)})),i.on("outgoing::data",(function(e){t&&t.send(e)})),i.on("outgoing::reconnect",(function(){i.emit("outgoing::open")})),i.on("outgoing::end",(function(){t&&(t.removeListener("message",e),t.removeListener("error",n),t.removeListener("close",o),t.removeListener("open",r),t.close(),t=null)}))},y.prototype.authorization=!1,y.prototype.pathname="/primus-v8",y.prototype.encoder=function(t,e){var n;try{t=JSON.stringify(t)}catch(d){n=d}e(n,t)},y.prototype.decoder=function(t,e){var n;if("string"!=typeof t)return e(n,t);try{t=JSON.parse(t)}catch(d){n=d}e(n,t)},y.prototype.version="8.0.4",e.exports=y},{demolish:1,emits:2,eventemitter3:3,inherits:4,querystringify:8,recovery:9,"tick-tock":12,"url-parse":14,yeast:15}]},{},[16])(16);return t}),[function(t){var e;"undefined"!=typeof window?e=window:"undefined"!=typeof self&&(e=self),e.eio=function(){function t(e,n,r){function o(s,c){if(!n[s]){if(!e[s]){if(i)return i(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var u=n[s]={exports:{}};e[s][0].call(u.exports,(function(t){return o(e[s][1][t]||t)}),u,u.exports,t,e,n,r)}return n[s].exports}for(var i=void 0,s=0;s<r.length;s++)o(r[s]);return o}return t}()({1:[function(t,e,n){},{}],2:[function(t,e,n){"use strict";e.exports="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")()},{}],3:[function(t,e,n){"use strict";function r(){return r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},r.apply(this,arguments)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function f(t){var e=h();return function(){var n,r=y(t);if(e){var o=y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?l(t):e}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}var d=t("./transports/index"),m=t("component-emitter"),v=t("engine.io-parser"),g=t("parseuri"),b=t("parseqs"),w=function(t){a(n,t);var e=f(n);function n(t){var s,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i(this,n),s=e.call(this),t&&"object"===o(t)&&(c=t,t=null),t?(t=g(t),c.hostname=t.host,c.secure="https"===t.protocol||"wss"===t.protocol,c.port=t.port,t.query&&(c.query=t.query)):c.host&&(c.hostname=g(c.host).host),s.secure=null!=c.secure?c.secure:"undefined"!=typeof location&&"https:"===location.protocol,c.hostname&&!c.port&&(c.port=s.secure?"443":"80"),s.hostname=c.hostname||("undefined"!=typeof location?location.hostname:"localhost"),s.port=c.port||("undefined"!=typeof location&&location.port?location.port:s.secure?443:80),s.transports=c.transports||["polling","websocket"],s.readyState="",s.writeBuffer=[],s.prevBufferLen=0,s.opts=r({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,jsonp:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},c),s.opts.path=s.opts.path.replace(/\/$/,"")+"/","string"==typeof s.opts.query&&(s.opts.query=b.decode(s.opts.query)),s.id=null,s.upgrades=null,s.pingInterval=null,s.pingTimeout=null,s.pingTimeoutTimer=null,"function"==typeof addEventListener&&(s.opts.closeOnBeforeunload&&addEventListener("beforeunload",(function(){s.transport&&(s.transport.removeAllListeners(),s.transport.close())}),!1),"localhost"!==s.hostname&&(s.offlineEventListener=function(){s.onClose("transport close")},addEventListener("offline",s.offlineEventListener,!1))),s.open(),s}return c(n,[{key:"createTransport",value:function(t){var e=k(this.opts.query);e.EIO=v.protocol,e.transport=t,this.id&&(e.sid=this.id);var n=r({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new d[t](n)}},{key:"open",value:function(){var t,e=this;if(this.opts.rememberUpgrade&&n.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void setTimeout((function(){e.emit("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(r){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(function(){e.onClose("transport close")}))}},{key:"probe",value:function(t){var e=this,r=this.createTransport(t,{probe:1}),o=!1;n.priorWebsocketSuccess=!1;var i=function(){o||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(function(t){if(!o)if("pong"===t.type&&"probe"===t.data){if(e.upgrading=!0,e.emit("upgrading",r),!r)return;n.priorWebsocketSuccess="websocket"===r.name,e.transport.pause((function(){o||"closed"!==e.readyState&&(p(),e.setTransport(r),r.send([{type:"upgrade"}]),e.emit("upgrade",r),r=null,e.upgrading=!1,e.flush())}))}else{var i=new Error("probe error");i.transport=r.name,e.emit("upgradeError",i)}})))};function s(){o||(o=!0,p(),r.close(),r=null)}var c=function(t){var n=new Error("probe error: "+t);n.transport=r.name,s(),e.emit("upgradeError",n)};function a(){c("transport closed")}function u(){c("socket closed")}function f(t){r&&t.name!==r.name&&s()}var p=function(){r.removeListener("open",i),r.removeListener("error",c),r.removeListener("close",a),e.removeListener("close",u),e.removeListener("upgrading",f)};r.once("open",i),r.once("error",c),r.once("close",a),this.once("close",u),this.once("upgrading",f),r.open()}},{key:"onOpen",value:function(){if(this.readyState="open",n.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},{key:"onPacket",value:function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emit("ping"),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}}},{key:"onHandshake",value:function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}},{key:"resetPingTimeout",value:function(){var t=this;clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=setTimeout((function(){t.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}},{key:"onDrain",value:function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()}},{key:"flush",value:function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))}},{key:"write",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"send",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"sendPacket",value:function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:t,data:e,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}}},{key:"close",value:function(){var t=this,e=function(){t.onClose("forced close"),t.transport.close()},n=function n(){t.removeListener("upgrade",n),t.removeListener("upgradeError",n),e()},r=function(){t.once("upgrade",n),t.once("upgradeError",n)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){t.upgrading?r():e()})):this.upgrading?r():e()),this}},{key:"onError",value:function(t){n.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emit("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++)~this.transports.indexOf(t[n])&&e.push(t[n]);return e}}]),n}(m);function k(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}w.priorWebsocketSuccess=!1,w.protocol=v.protocol,e.exports=w},{"./transports/index":5,"component-emitter":14,"engine.io-parser":18,parseqs:20,parseuri:21}],4:[function(t,e,n){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function u(t){var e=l();return function(){var n,r=h(t);if(e){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?p(t):e}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}var y=t("engine.io-parser"),d=function(t){c(n,t);var e=u(n);function n(t){var r;return o(this,n),(r=e.call(this)).opts=t,r.query=t.query,r.readyState="",r.socket=t.socket,r}return s(n,[{key:"onError",value:function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this}},{key:"open",value:function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}},{key:"close",value:function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}},{key:"send",value:function(t){"open"===this.readyState&&this.write(t)}},{key:"onOpen",value:function(){this.readyState="open",this.writable=!0,this.emit("open")}},{key:"onData",value:function(t){var e=y.decodePacket(t,this.socket.binaryType);this.onPacket(e)}},{key:"onPacket",value:function(t){this.emit("packet",t)}},{key:"onClose",value:function(){this.readyState="closed",this.emit("close")}}]),n}(t("component-emitter"));e.exports=d},{"component-emitter":14,"engine.io-parser":18}],5:[function(t,e,n){"use strict";var r=t("../../contrib/xmlhttprequest-ssl/XMLHttpRequest"),o=t("./polling-xhr"),i=t("./polling-jsonp"),s=t("./websocket");function c(t){var e=!1,n=!1,s=!1!==t.jsonp;if("undefined"!=typeof location){var c="https:"===location.protocol,a=location.port;a||(a=c?443:80),e=t.hostname!==location.hostname||a!==t.port,n=t.secure!==c}if(t.xdomain=e,t.xscheme=n,"open"in new r(t)&&!t.forceJSONP)return new o(t);if(!s)throw new Error("JSONP disabled");return new i(t)}n.polling=c,n.websocket=s},{"../../contrib/xmlhttprequest-ssl/XMLHttpRequest":12,"./polling-jsonp":6,"./polling-xhr":7,"./websocket":10}],6:[function(t,e,n){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function c(t,e,n){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=a(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}},c(t,e,n||t)}function a(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=d(t)););return t}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}function f(t,e){return f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},f(t,e)}function p(t){var e=y();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?h(t):e}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}var m,v=t("./polling"),g=t("../globalThis"),b=/\n/g,w=/\\n/g,k=function(t){u(n,t);var e=p(n);function n(t){var r;return o(this,n),(r=e.call(this,t)).query=r.query||{},m||(m=g.___eio=g.___eio||[]),r.index=m.length,m.push(r.onData.bind(h(r))),r.query.j=r.index,r}return s(n,[{key:"supportsBinary",get:function(){return!1}},{key:"doClose",value:function(){this.script&&(this.script.onerror=function(){},this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),c(d(n.prototype),"doClose",this).call(this)}},{key:"doPoll",value:function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)}),100)}},{key:"doWrite",value:function(t,e){var n,r=this;if(!this.form){var o=document.createElement("form"),i=document.createElement("textarea"),s=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=s,o.method="POST",o.setAttribute("accept-charset","utf-8"),i.name="d",o.appendChild(i),document.body.appendChild(o),this.form=o,this.area=i}function c(){a(),e()}this.form.action=this.uri();var a=function(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(e){r.onError("jsonp polling iframe removal error",e)}try{var t='<iframe src="javascript:0" name="'+r.iframeId+'">';n=document.createElement(t)}catch(e){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n};a(),t=t.replace(w,"\\\n"),this.area.value=t.replace(b,"\\n");try{this.form.submit()}catch(u){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&c()}:this.iframe.onload=c}}]),n}(v);e.exports=k},{"../globalThis":2,"./polling":8}],7:[function(t,e,n){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){return o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o.apply(this,arguments)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function f(t){var e=h();return function(){var n,r=y(t);if(e){var o=y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?l(t):e}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}var d=t("../../contrib/xmlhttprequest-ssl/XMLHttpRequest"),m=t("./polling"),v=t("component-emitter"),g=t("../util").pick,b=t("../globalThis");function w(){}var k=null!=new d({xdomain:!1}).responseType,x=function(t){a(n,t);var e=f(n);function n(t){var r;if(i(this,n),r=e.call(this,t),"undefined"!=typeof location){var o="https:"===location.protocol,s=location.port;s||(s=o?443:80),r.xd="undefined"!=typeof location&&t.hostname!==location.hostname||s!==t.port,r.xs=t.secure!==o}var c=t&&t.forceBase64;return r.supportsBinary=k&&!c,r}return c(n,[{key:"request",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{xd:this.xd,xs:this.xs},this.opts),new O(this.uri(),t)}},{key:"doWrite",value:function(t,e){var n=this,r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",(function(t){n.onError("xhr post error",t)}))}},{key:"doPoll",value:function(){var t=this,e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e}}]),n}(m),O=function(t){a(n,t);var e=f(n);function n(t,r){var o;return i(this,n),(o=e.call(this)).opts=r,o.method=r.method||"GET",o.uri=t,o.async=!1!==r.async,o.data=void 0!==r.data?r.data:null,o.create(),o}return c(n,[{key:"create",value:function(){var t=this,e=g(this.opts,"agent","enablesXDR","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;var r=this.xhr=new d(e);try{r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var o in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.opts.extraHeaders[o])}catch(i){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(i){}try{r.setRequestHeader("Accept","*/*")}catch(i){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),this.hasXDR()?(r.onload=function(){t.onLoad()},r.onerror=function(){t.onError(r.responseText)}):r.onreadystatechange=function(){4===r.readyState&&(200===r.status||1223===r.status?t.onLoad():setTimeout((function(){t.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(i){return void setTimeout((function(){t.onError(i)}),0)}"undefined"!=typeof document&&(this.index=n.requestsCount++,n.requests[this.index]=this)}},{key:"onSuccess",value:function(){this.emit("success"),this.cleanup()}},{key:"onData",value:function(t){this.emit("data",t),this.onSuccess()}},{key:"onError",value:function(t){this.emit("error",t),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=w:this.xhr.onreadystatechange=w,t)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete n.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&this.onData(t)}},{key:"hasXDR",value:function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR}},{key:"abort",value:function(){this.cleanup()}}]),n}(v);function _(){for(var t in O.requests)O.requests.hasOwnProperty(t)&&O.requests[t].abort()}O.requestsCount=0,O.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",_):"function"==typeof addEventListener&&addEventListener("onpagehide"in b?"pagehide":"unload",_,!1)),e.exports=x,e.exports.Request=O},{"../../contrib/xmlhttprequest-ssl/XMLHttpRequest":12,"../globalThis":2,"../util":11,"./polling":8,"component-emitter":14}],8:[function(t,e,n){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function u(t){var e=l();return function(){var n,r=h(t);if(e){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?p(t):e}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}var y=t("../transport"),d=t("parseqs"),m=t("engine.io-parser"),v=t("yeast"),g=function(t){c(n,t);var e=u(n);function n(){return o(this,n),e.apply(this,arguments)}return s(n,[{key:"name",get:function(){return"polling"}},{key:"doOpen",value:function(){this.poll()}},{key:"pause",value:function(t){var e=this;this.readyState="pausing";var n=function(){e.readyState="paused",t()};if(this.polling||!this.writable){var r=0;this.polling&&(r++,this.once("pollComplete",(function(){--r||n()}))),this.writable||(r++,this.once("drain",(function(){--r||n()})))}else n()}},{key:"poll",value:function(){this.polling=!0,this.doPoll(),this.emit("poll")}},{key:"onData",value:function(t){var e=this,n=function(t){if("opening"===e.readyState&&"open"===t.type&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)};m.decodePayload(t,this.socket.binaryType).forEach(n),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())}},{key:"doClose",value:function(){var t=this,e=function(){t.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}},{key:"write",value:function(t){var e=this;this.writable=!1,m.encodePayload(t,(function(t){e.doWrite(t,(function(){e.writable=!0,e.emit("drain")}))}))}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"https":"http",n="";return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=v()),this.supportsBinary||t.sid||(t.b64=1),t=d.encode(t),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),t.length&&(t="?"+t),e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+t}}]),n}(y);e.exports=g},{"../transport":4,"engine.io-parser":18,parseqs:20,yeast:22}],9:[function(t,e,n){"use strict";var r=t("../globalThis"),o="function"==typeof Promise&&"function"==typeof Promise.resolve?function(t){return Promise.resolve().then(t)}:function(t){return setTimeout(t,0)};e.exports={WebSocket:r.WebSocket||r.MozWebSocket,usingBrowserWebSocket:!0,defaultBinaryType:"arraybuffer",nextTick:o}},{"../globalThis":2}],10:[function(t,e,n){(function(n){(function(){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function u(t){var e=l();return function(){var n,r=h(t);if(e){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?p(t):e}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}var y=t("../transport"),d=t("engine.io-parser"),m=t("parseqs"),v=t("yeast"),g=t("../util").pick,b=t("./websocket-constructor"),w=b.WebSocket,k=b.usingBrowserWebSocket,x=b.defaultBinaryType,O=b.nextTick,_="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),E=function(t){c(r,t);var e=u(r);function r(t){var n;return o(this,r),(n=e.call(this,t)).supportsBinary=!t.forceBase64,n}return s(r,[{key:"name",get:function(){return"websocket"}},{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,n=_?{}:g(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=k&&!_?e?new w(t,e):new w(t):new w(t,e,n)}catch(r){return this.emit("error",r)}this.ws.binaryType=this.socket.binaryType||x,this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.opts.autoUnref&&t.ws._socket.unref(),t.onOpen()},this.ws.onclose=this.onClose.bind(this),this.ws.onmessage=function(e){return t.onData(e.data)},this.ws.onerror=function(e){return t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var r=function(r){var o=t[r],i=r===t.length-1;d.encodePacket(o,e.supportsBinary,(function(t){var r={};k||(o.options&&(r.compress=o.options.compress),e.opts.perMessageDeflate&&("string"==typeof t?n.byteLength(t):t.length)<e.opts.perMessageDeflate.threshold&&(r.compress=!1));try{k?e.ws.send(t):e.ws.send(t,r)}catch(s){}i&&O((function(){e.writable=!0,e.emit("drain")}))}))},o=0;o<t.length;o++)r(o)}},{key:"onClose",value:function(){y.prototype.onClose.call(this)}},{key:"doClose",value:function(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"wss":"ws",n="";return this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=v()),this.supportsBinary||(t.b64=1),(t=m.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+t}},{key:"check",value:function(){return!(!w||"__initialize"in w&&this.name===r.prototype.name)}}]),r}(y);e.exports=E}).call(this)}).call(this,t("buffer").Buffer)},{"../transport":4,"../util":11,"./websocket-constructor":9,buffer:1,"engine.io-parser":18,parseqs:20,yeast:22}],11:[function(t,e,n){"use strict";e.exports.pick=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.reduce((function(e,n){return t.hasOwnProperty(n)&&(e[n]=t[n]),e}),{})}},{}],12:[function(t,e,n){"use strict";var r=t("has-cors"),o=t("./globalThis");e.exports=function(t){var e=t.xdomain,n=t.xscheme,i=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||r))return new XMLHttpRequest}catch(s){}try{if("undefined"!=typeof XDomainRequest&&!n&&i)return new XDomainRequest}catch(s){}if(!e)try{return new(o[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(s){}}},{"./globalThis":2,"has-cors":19}],13:[function(t,e,n){!function(t){"use strict";n.encode=function(e){var n,r=new Uint8Array(e),o=r.length,i="";for(n=0;n<o;n+=3)i+=t[r[n]>>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},n.decode=function(e){var n,r,o,i,s,c=.75*e.length,a=e.length,u=0;"="===e[e.length-1]&&(c--,"="===e[e.length-2]&&c--);var f=new ArrayBuffer(c),p=new Uint8Array(f);for(n=0;n<a;n+=4)r=t.indexOf(e[n]),o=t.indexOf(e[n+1]),i=t.indexOf(e[n+2]),s=t.indexOf(e[n+3]),p[u++]=r<<2|o>>4,p[u++]=(15&o)<<4|i>>2,p[u++]=(3&i)<<6|63&s;return f}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],14:[function(t,e,n){function r(t){if(t)return o(t)}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}void 0!==e&&(e.exports=r),r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],15:[function(t,e,n){const r=Object.create(null);r.open="0",r.close="1",r.ping="2",r.pong="3",r.message="4",r.upgrade="5",r.noop="6";const o=Object.create(null);Object.keys(r).forEach((t=>{o[r[t]]=t}));const i={type:"error",data:"parser error"};e.exports={PACKET_TYPES:r,PACKET_TYPES_REVERSE:o,ERROR_PACKET:i}},{}],16:[function(t,e,n){const{PACKET_TYPES_REVERSE:r,ERROR_PACKET:o}=t("./commons");let i;"function"==typeof ArrayBuffer&&(i=t("base64-arraybuffer"));const s=(t,e)=>{if("string"!=typeof t)return{type:"message",data:a(t,e)};const n=t.charAt(0);return"b"===n?{type:"message",data:c(t.substring(1),e)}:r[n]?t.length>1?{type:r[n],data:t.substring(1)}:{type:r[n]}:o},c=(t,e)=>{if(i){const n=i.decode(t);return a(n,e)}return{base64:!0,data:t}},a=(t,e)=>"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t;e.exports=s},{"./commons":15,"base64-arraybuffer":13}],17:[function(t,e,n){const{PACKET_TYPES:r}=t("./commons"),o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),i="function"==typeof ArrayBuffer,s=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,c=({type:t,data:e},n,c)=>o&&e instanceof Blob?n?c(e):a(e,c):i&&(e instanceof ArrayBuffer||s(e))?n?c(e instanceof ArrayBuffer?e:e.buffer):a(new Blob([e]),c):c(r[t]+(e||"")),a=(t,e)=>{const n=new FileReader;return n.onload=function(){const t=n.result.split(",")[1];e("b"+t)},n.readAsDataURL(t)};e.exports=c},{"./commons":15}],18:[function(t,e,n){const r=t("./encodePacket"),o=t("./decodePacket"),i=String.fromCharCode(30),s=(t,e)=>{const n=t.length,o=new Array(n);let s=0;t.forEach(((t,c)=>{r(t,!1,(t=>{o[c]=t,++s===n&&e(o.join(i))}))}))},c=(t,e)=>{const n=t.split(i),r=[];for(let i=0;i<n.length;i++){const t=o(n[i],e);if(r.push(t),"error"===t.type)break}return r};e.exports={protocol:4,encodePacket:r,encodePayload:s,decodePacket:o,decodePayload:c}},{"./decodePacket":16,"./encodePacket":17}],19:[function(t,e,n){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(r){e.exports=!1}},{}],20:[function(t,e,n){n.encode=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},n.decode=function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},{}],21:[function(t,e,n){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,o=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function i(t,e){var n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return"/"!=e.substr(0,1)&&0!==e.length||r.splice(0,1),"/"==e.substr(e.length-1,1)&&r.splice(r.length-1,1),r}function s(t,e){var n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,r){e&&(n[e]=r)})),n}e.exports=function(t){var e=t,n=t.indexOf("["),c=t.indexOf("]");-1!=n&&-1!=c&&(t=t.substring(0,n)+t.substring(n,c).replace(/:/g,";")+t.substring(c,t.length));for(var a=r.exec(t||""),u={},f=14;f--;)u[o[f]]=a[f]||"";return-1!=n&&-1!=c&&(u.source=e,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=i(u,u.path),u.queryKey=s(u,u.query),u}},{}],22:[function(t,e,n){"use strict";var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,s={},c=0,a=0;function u(t){var e="";do{e=o[t%i]+e,t=Math.floor(t/i)}while(t>0);return e}function f(t){var e=0;for(a=0;a<t.length;a++)e=e*i+s[t.charAt(a)];return e}function p(){var t=u(+new Date);return t!==r?(c=0,r=t):t+"."+u(c++)}for(;a<i;a++)s[o[a]]=a;p.encode=u,p.decode=f,e.exports=p},{}],23:[function(t,e,n){"use strict";var r=t("./socket");e.exports=function(t,e){return new r(t,e)},e.exports.Socket=r,e.exports.protocol=r.protocol,e.exports.Transport=t("./transport"),e.exports.transports=t("./transports/index"),e.exports.parser=t("engine.io-parser")},{"./socket":3,"./transport":4,"./transports/index":5,"engine.io-parser":18}]},{},[23])(23)}])}}]);