@voicenter-team/events-sdk 0.0.94 → 0.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/voicenter-events-sdk.cjs.js +9 -9
- package/dist/voicenter-events-sdk.cjs.js.map +1 -1
- package/dist/voicenter-events-sdk.d.ts +40 -23
- package/dist/voicenter-events-sdk.es.js +1450 -1438
- package/dist/voicenter-events-sdk.es.js.map +1 -1
- package/dist/voicenter-events-sdk.iife.js +8 -8
- package/dist/voicenter-events-sdk.iife.js.map +1 -1
- package/dist/voicenter-events-sdk.umd.js +8 -8
- package/dist/voicenter-events-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Hr=Object.defineProperty;var $r=(t,e,r)=>e in t?Hr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var J=(t,e,r)=>($r(t,typeof e!="symbol"?e+"":e,r),r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Vr=require("ws");function Kr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lr={exports:{}},fr={exports:{}};(function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(r,n){return r<<n|r>>>32-n},rotr:function(r,n){return r<<32-n|r>>>n},endian:function(r){if(r.constructor==Number)return e.rotl(r,8)&16711935|e.rotl(r,24)&4278255360;for(var n=0;n<r.length;n++)r[n]=e.endian(r[n]);return r},randomBytes:function(r){for(var n=[];r>0;r--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(r){for(var n=[],o=0,c=0;o<r.length;o++,c+=8)n[c>>>5]|=r[o]<<24-c%32;return n},wordsToBytes:function(r){for(var n=[],o=0;o<r.length*32;o+=8)n.push(r[o>>>5]>>>24-o%32&255);return n},bytesToHex:function(r){for(var n=[],o=0;o<r.length;o++)n.push((r[o]>>>4).toString(16)),n.push((r[o]&15).toString(16));return n.join("")},hexToBytes:function(r){for(var n=[],o=0;o<r.length;o+=2)n.push(parseInt(r.substr(o,2),16));return n},bytesToBase64:function(r){for(var n=[],o=0;o<r.length;o+=3)for(var c=r[o]<<16|r[o+1]<<8|r[o+2],l=0;l<4;l++)o*8+l*6<=r.length*8?n.push(t.charAt(c>>>6*(3-l)&63)):n.push("=");return n.join("")},base64ToBytes:function(r){r=r.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],o=0,c=0;o<r.length;c=++o%4)c!=0&&n.push((t.indexOf(r.charAt(o-1))&Math.pow(2,-2*c+8)-1)<<c*2|t.indexOf(r.charAt(o))>>>6-c*2);return n}};fr.exports=e})();var Yr=fr.exports,kt={utf8:{stringToBytes:function(t){return kt.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(kt.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(t.charCodeAt(r)&255);return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}},Yt=kt;/*!
|
|
2
2
|
* Determine if an object is a Buffer
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/var nn=function(t){return t!=null&&(kr(t)||on(t)||!!t._isBuffer)};function kr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function on(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&kr(t.slice(0,0))}(function(){var t=rn,e=Zt.utf8,r=nn,n=Zt.bin,o=function(a,l){a.constructor==String?l&&l.encoding==="binary"?a=n.stringToBytes(a):a=e.stringToBytes(a):r(a)?a=Array.prototype.slice.call(a,0):!Array.isArray(a)&&a.constructor!==Uint8Array&&(a=a.toString());for(var p=t.bytesToWords(a),f=a.length*8,i=1732584193,h=-271733879,u=-1732584194,c=271733878,s=0;s<p.length;s++)p[s]=(p[s]<<8|p[s]>>>24)&16711935|(p[s]<<24|p[s]>>>8)&4278255360;p[f>>>5]|=128<<f%32,p[(f+64>>>9<<4)+14]=f;for(var d=o._ff,g=o._gg,m=o._hh,v=o._ii,s=0;s<p.length;s+=16){var T=i,R=h,b=u,S=c;i=d(i,h,u,c,p[s+0],7,-680876936),c=d(c,i,h,u,p[s+1],12,-389564586),u=d(u,c,i,h,p[s+2],17,606105819),h=d(h,u,c,i,p[s+3],22,-1044525330),i=d(i,h,u,c,p[s+4],7,-176418897),c=d(c,i,h,u,p[s+5],12,1200080426),u=d(u,c,i,h,p[s+6],17,-1473231341),h=d(h,u,c,i,p[s+7],22,-45705983),i=d(i,h,u,c,p[s+8],7,1770035416),c=d(c,i,h,u,p[s+9],12,-1958414417),u=d(u,c,i,h,p[s+10],17,-42063),h=d(h,u,c,i,p[s+11],22,-1990404162),i=d(i,h,u,c,p[s+12],7,1804603682),c=d(c,i,h,u,p[s+13],12,-40341101),u=d(u,c,i,h,p[s+14],17,-1502002290),h=d(h,u,c,i,p[s+15],22,1236535329),i=g(i,h,u,c,p[s+1],5,-165796510),c=g(c,i,h,u,p[s+6],9,-1069501632),u=g(u,c,i,h,p[s+11],14,643717713),h=g(h,u,c,i,p[s+0],20,-373897302),i=g(i,h,u,c,p[s+5],5,-701558691),c=g(c,i,h,u,p[s+10],9,38016083),u=g(u,c,i,h,p[s+15],14,-660478335),h=g(h,u,c,i,p[s+4],20,-405537848),i=g(i,h,u,c,p[s+9],5,568446438),c=g(c,i,h,u,p[s+14],9,-1019803690),u=g(u,c,i,h,p[s+3],14,-187363961),h=g(h,u,c,i,p[s+8],20,1163531501),i=g(i,h,u,c,p[s+13],5,-1444681467),c=g(c,i,h,u,p[s+2],9,-51403784),u=g(u,c,i,h,p[s+7],14,1735328473),h=g(h,u,c,i,p[s+12],20,-1926607734),i=m(i,h,u,c,p[s+5],4,-378558),c=m(c,i,h,u,p[s+8],11,-2022574463),u=m(u,c,i,h,p[s+11],16,1839030562),h=m(h,u,c,i,p[s+14],23,-35309556),i=m(i,h,u,c,p[s+1],4,-1530992060),c=m(c,i,h,u,p[s+4],11,1272893353),u=m(u,c,i,h,p[s+7],16,-155497632),h=m(h,u,c,i,p[s+10],23,-1094730640),i=m(i,h,u,c,p[s+13],4,681279174),c=m(c,i,h,u,p[s+0],11,-358537222),u=m(u,c,i,h,p[s+3],16,-722521979),h=m(h,u,c,i,p[s+6],23,76029189),i=m(i,h,u,c,p[s+9],4,-640364487),c=m(c,i,h,u,p[s+12],11,-421815835),u=m(u,c,i,h,p[s+15],16,530742520),h=m(h,u,c,i,p[s+2],23,-995338651),i=v(i,h,u,c,p[s+0],6,-198630844),c=v(c,i,h,u,p[s+7],10,1126891415),u=v(u,c,i,h,p[s+14],15,-1416354905),h=v(h,u,c,i,p[s+5],21,-57434055),i=v(i,h,u,c,p[s+12],6,1700485571),c=v(c,i,h,u,p[s+3],10,-1894986606),u=v(u,c,i,h,p[s+10],15,-1051523),h=v(h,u,c,i,p[s+1],21,-2054922799),i=v(i,h,u,c,p[s+8],6,1873313359),c=v(c,i,h,u,p[s+15],10,-30611744),u=v(u,c,i,h,p[s+6],15,-1560198380),h=v(h,u,c,i,p[s+13],21,1309151649),i=v(i,h,u,c,p[s+4],6,-145523070),c=v(c,i,h,u,p[s+11],10,-1120210379),u=v(u,c,i,h,p[s+2],15,718787259),h=v(h,u,c,i,p[s+9],21,-343485551),i=i+T>>>0,h=h+R>>>0,u=u+b>>>0,c=c+S>>>0}return t.endian([i,h,u,c])};o._ff=function(a,l,p,f,i,h,u){var c=a+(l&p|~l&f)+(i>>>0)+u;return(c<<h|c>>>32-h)+l},o._gg=function(a,l,p,f,i,h,u){var c=a+(l&f|p&~f)+(i>>>0)+u;return(c<<h|c>>>32-h)+l},o._hh=function(a,l,p,f,i,h,u){var c=a+(l^p^f)+(i>>>0)+u;return(c<<h|c>>>32-h)+l},o._ii=function(a,l,p,f,i,h,u){var c=a+(p^(l|~f))+(i>>>0)+u;return(c<<h|c>>>32-h)+l},o._blocksize=16,o._digestsize=16,Cr.exports=function(a,l){if(a==null)throw new Error("Illegal argument "+a);var p=t.wordsToBytes(o(a,l));return l&&l.asBytes?p:l&&l.asString?n.bytesToString(p):t.bytesToHex(p)}})();var sn=Cr.exports;const an=tn(sn);var fe=(t=>(t.BOOTSTRAP="bootstrap",t.DEBUG_EXTENSIONS="debugExtensions",t.DEBUG_QUEUE="debugQueue",t.DEBUG_DIALER="debugDialer",t.FULL="full",t))(fe||{}),he=(t=>(t.MAIN="main",t.NEXT="next",t))(he||{}),ie=(t=>(t.USER="User",t.TOKEN="Token",t))(ie||{});class Re{static async getSessionStorageDataByKey(e,r=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const n=await chrome.storage.session.get(e);if(n[e])return r?JSON.parse(n[e]):n[e]}if(typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.getItem=="function"){const n=window.sessionStorage.getItem(e);if(n)return r?JSON.parse(n):n}}static async updateSessionStorageKey(e,r){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[e]:JSON.stringify(r)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(e,JSON.stringify(r))}static clearSessionStorage(){typeof chrome<"u"&&typeof chrome.storage<"u"&&chrome.storage.session.clear(),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.clear=="function"&&window.sessionStorage.clear()}}class cn{constructor(e){G(this,"delay",1e3);G(this,"lastLoginTimestamp");G(this,"token");G(this,"refreshToken");G(this,"tokenExpiry");G(this,"storageKey");this.eventsSdkClass=e,this.eventsSdkClass=e,this.storageKey=""}async login(){const e={token:this.eventsSdkClass.options.token&&this.eventsSdkClass.options.token,email:this.eventsSdkClass.options.email&&this.eventsSdkClass.options.email,password:this.eventsSdkClass.options.password&&this.eventsSdkClass.options.password};if(this.storageKey=an(JSON.stringify({...this.eventsSdkClass.options,loggerSocketConnection:null},this.eventsSdkClass.getCircularReplacer())),this.lastLoginTimestamp&&this.lastLoginTimestamp+this.delay>new Date().getTime())return;this.updateLastLoginTimestamp();const r=await this.checkLoginStatus(this.storageKey);return r||(Re.clearSessionStorage(),await this.userLoginFunction(e,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(e){const r=await Re.getSessionStorageDataByKey(e);if(r)return r}async userLoginFunction(e,r,n){let o,a,l;return this.eventsSdkClass.options.isNewStack?(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),a=await this.getSettings(o.Data.AccessToken),l={...o.Data,...a}):(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),l={...o.Data.Socket}),await Re.updateSessionStorageKey(r,l),l}onLoginResponse(e){if(!this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),e.MonitorList&&e.MonitorList.length&&(this.eventsSdkClass.servers=[...e.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length&&e.URLList&&(this.eventsSdkClass.URLList=e.URLList),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.URLList.length&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");if(this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");this.eventsSdkClass.server&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`),!this.eventsSdkClass.server&&this.eventsSdkClass.URLList.length&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${e.Version}`),e.IdentityCode&&(this.token=e.IdentityCode,this.eventsSdkClass.connect(he.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(he.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===ie.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===ie.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.TokenExpiry,this.handleTokenExpiry())}handleTokenExpiry(){if(!this.eventsSdkClass.options.refreshTokenUrl)throw new Error("refreshTokenUrl not provided");let e;if(this.tokenExpiry)e=new Date(this.tokenExpiry);else return;const r=e.getTime()-new Date().getTime()-5e3,n=Math.min(r,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let o,a;if(this.eventsSdkClass.options.isNewStack){const l=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);o=await this.getSettings(l.Data.AccessToken),a={...l.Data,...o}}else a={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(a),await Re.updateSessionStorageKey(this.storageKey,a)}},n)}async externalLogin(e,{password:r,token:n,email:o},a){if(!e)throw new Error("loginUrl not provided");let l;this.eventsSdkClass.options.isNewStack?a===ie.TOKEN?l=JSON.stringify({identityType:ie.TOKEN,token:n}):l=JSON.stringify({identityType:ie.USER,username:o,password:r}):this.eventsSdkClass.options.loginType===ie.TOKEN?(l=JSON.stringify({token:n}),e=`${e}/${ie.TOKEN}`):(l=JSON.stringify({email:o,pin:r}),e=`${e}/${ie.USER}`);let p;try{const f=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:l});if(!f.ok&&f.status===400)throw p=400,new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!f.ok&&f.status===401)throw p=401,new Error("Unauthorized. Invalid token provided");if(!f.ok&&f.status===403)throw p=403,new Error("Forbidden. Identity token not provided or not valid");const i=await f.json();if(i.error)throw new Error(i.error);return i}catch(f){throw this.eventsSdkClass.loggerClass.loginError(a,p,n,o),f}}async getSettings(e){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const r=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${e}`}});if(!r.ok&&r.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return r.json()}catch(r){throw this.eventsSdkClass.loggerClass.getSettingsError(e,r),r}}async externalRefreshToken(e,r){try{return(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}})).json()}catch(n){throw this.eventsSdkClass.loggerClass.refreshTokenError(r,e,n),n}}normalizeLoginType(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}}const un={isNewStack:!1,loginUrl:"https://loginapi.voicenter.co.il/monitorAPI/Login",refreshTokenUrl:"https://loginapi.voicenter.co.il/monitorAPI/RefreshIdentityToken",forceNew:!0,reconnectionDelay:1e4,timeout:1e4,keepAliveTimeout:6e4,protocol:"https",useLogger:!0,loggerServer:"https://socketlog.voicenter.co",loggerConfig:{logToConsole:!0,overloadGlobalConsole:!1,system:"events-sdk",socketEmitInterval:1e4},loggerConnectOptions:{reconnection:!1,reconnectionDelay:5e3,reconnectionAttempts:10,perMessageDeflate:void 0,upgrade:!1,transports:["websocket"],debug:!1}};function hn(){return typeof window<"u"&&(typeof window.navigator>"u"||typeof window.navigator.userAgent>"u")&&(window.navigator.userAgent="react-native"),typeof self>"u"&&typeof global=="object"&&(global.self=global,global.WebSocket=en,typeof self.navigator>"u"&&(self.navigator={userAgent:"node"})),function t(e,r,n){function o(p,f){if(!r[p]){if(!e[p]){var i=typeof require=="function"&&require;if(!f&&i)return i(p,!0);if(a)return a(p,!0);throw new Error("Cannot find module '"+p+"'")}var h=r[p]={exports:{}};e[p][0].call(h.exports,function(u){var c=e[p][1][u];return o(c||u)},h,h.exports,t,e,r,n)}return r[p].exports}for(var a=typeof require=="function"&&require,l=0;l<n.length;l++)o(n[l]);return o}({1:[function(t,e){e.exports=t("./lib/")},{"./lib/":2}],2:[function(t,e,r){function n(i,h){typeof i=="object"&&(h=i,i=void 0),h=h||{};var u,c=o(i),s=c.source,d=c.id;return h.forceNew||h["force new connection"]||h.multiplex===!1?(p("ignoring socket cache for %s",s),u=l(s,h)):(f[d]||(p("new io instance for %s",s),f[d]=l(s,h)),u=f[d]),u.socket(c.path)}var o=t("./url"),a=t("socket.io-parser"),l=t("./manager"),p=t("debug")("socket.io-client");e.exports=r=n;var f=r.managers={};r.protocol=a.protocol,r.connect=n,r.Manager=t("./manager"),r.Socket=t("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(t,e){function r(c,s){return this instanceof r?(c&&typeof c=="object"&&(s=c,c=void 0),s=s||{},s.path=s.path||"/socket.io",this.nsps={},this.subs=[],this.opts=s,this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor(s.randomizationFactor||.5),this.backoff=new u({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this.readyState="closed",this.uri=c,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new l.Encoder,this.decoder=new l.Decoder,this.autoConnect=s.autoConnect!==!1,void(this.autoConnect&&this.open())):new r(c,s)}var n=(t("./url"),t("engine.io-client")),o=t("./socket"),a=t("component-emitter"),l=t("socket.io-parser"),p=t("./on"),f=t("component-bind"),i=(t("object-component"),t("debug")("socket.io-client:manager")),h=t("indexof"),u=t("backo2");e.exports=r,r.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var c in this.nsps)this.nsps[c].emit.apply(this.nsps[c],arguments)},r.prototype.updateSocketIds=function(){for(var c in this.nsps)this.nsps[c].id=this.engine.id},a(r.prototype),r.prototype.reconnection=function(c){return arguments.length?(this._reconnection=!!c,this):this._reconnection},r.prototype.reconnectionAttempts=function(c){return arguments.length?(this._reconnectionAttempts=c,this):this._reconnectionAttempts},r.prototype.reconnectionDelay=function(c){return arguments.length?(this._reconnectionDelay=c,this.backoff&&this.backoff.setMin(c),this):this._reconnectionDelay},r.prototype.randomizationFactor=function(c){return arguments.length?(this._randomizationFactor=c,this.backoff&&this.backoff.setJitter(c),this):this._randomizationFactor},r.prototype.reconnectionDelayMax=function(c){return arguments.length?(this._reconnectionDelayMax=c,this.backoff&&this.backoff.setMax(c),this):this._reconnectionDelayMax},r.prototype.timeout=function(c){return arguments.length?(this._timeout=c,this):this._timeout},r.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},r.prototype.open=r.prototype.connect=function(c){if(i("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;i("opening %s",this.uri),this.engine=n(this.uri,this.opts);var s=this.engine,d=this;this.readyState="opening",this.skipReconnect=!1;var g=p(s,"open",function(){d.onopen(),c&&c()}),m=p(s,"error",function(R){if(i("connect_error"),d.cleanup(),d.readyState="closed",d.emitAll("connect_error",R),c){var b=new Error("Connection error");b.data=R,c(b)}else d.maybeReconnectOnOpen()});if(this._timeout!==!1){var v=this._timeout;i("connect attempt will timeout after %d",v);var T=setTimeout(function(){i("connect attempt timed out after %d",v),g.destroy(),s.close(),s.emit("error","timeout"),d.emitAll("connect_timeout",v)},v);this.subs.push({destroy:function(){clearTimeout(T)}})}return this.subs.push(g),this.subs.push(m),this},r.prototype.onopen=function(){i("open"),this.cleanup(),this.readyState="open",this.emit("open");var c=this.engine;this.subs.push(p(c,"data",f(this,"ondata"))),this.subs.push(p(this.decoder,"decoded",f(this,"ondecoded"))),this.subs.push(p(c,"error",f(this,"onerror"))),this.subs.push(p(c,"close",f(this,"onclose")))},r.prototype.ondata=function(c){this.decoder.add(c)},r.prototype.ondecoded=function(c){this.emit("packet",c)},r.prototype.onerror=function(c){i("error",c),this.emitAll("error",c)},r.prototype.socket=function(c){var s=this.nsps[c];if(!s){s=new o(this,c),this.nsps[c]=s;var d=this;s.on("connect",function(){s.id=d.engine.id,~h(d.connected,s)||d.connected.push(s)})}return s},r.prototype.destroy=function(c){var s=h(this.connected,c);~s&&this.connected.splice(s,1),this.connected.length||this.close()},r.prototype.packet=function(c){i("writing packet %j",c);var s=this;s.encoding?s.packetBuffer.push(c):(s.encoding=!0,this.encoder.encode(c,function(d){for(var g=0;g<d.length;g++)s.engine.write(d[g]);s.encoding=!1,s.processPacketQueue()}))},r.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var c=this.packetBuffer.shift();this.packet(c)}},r.prototype.cleanup=function(){for(var c;c=this.subs.shift();)c.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},r.prototype.close=r.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},r.prototype.onclose=function(c){i("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",c),this._reconnection&&!this.skipReconnect&&this.reconnect()},r.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var c=this;if(this.backoff.attempts>=this._reconnectionAttempts)i("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var s=this.backoff.duration();i("will wait %dms before reconnect attempt",s),this.reconnecting=!0;var d=setTimeout(function(){c.skipReconnect||(i("attempting reconnect"),c.emitAll("reconnect_attempt",c.backoff.attempts),c.emitAll("reconnecting",c.backoff.attempts),c.skipReconnect||c.open(function(g){g?(i("reconnect attempt error"),c.reconnecting=!1,c.reconnect(),c.emitAll("reconnect_error",g.data)):(i("reconnect success"),c.onreconnect())}))},s);this.subs.push({destroy:function(){clearTimeout(d)}})}},r.prototype.onreconnect=function(){var c=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",c)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:40,"object-component":41,"socket.io-parser":44}],4:[function(t,e){function r(n,o,a){return n.on(o,a),{destroy:function(){n.removeListener(o,a)}}}e.exports=r},{}],5:[function(t,e,r){function n(s,d){this.io=s,this.nsp=d,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var o=t("socket.io-parser"),a=t("component-emitter"),l=t("to-array"),p=t("./on"),f=t("component-bind"),i=t("debug")("socket.io-client:socket"),h=t("has-binary");e.exports=n;var u={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},c=a.prototype.emit;a(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var s=this.io;this.subs=[p(s,"open",f(this,"onopen")),p(s,"packet",f(this,"onpacket")),p(s,"close",f(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),this.io.readyState=="open"&&this.onopen(),this)},n.prototype.send=function(){var s=l(arguments);return s.unshift("message"),this.emit.apply(this,s),this},n.prototype.emit=function(s){if(u.hasOwnProperty(s))return c.apply(this,arguments),this;var d=l(arguments),g=o.EVENT;h(d)&&(g=o.BINARY_EVENT);var m={type:g,data:d};return typeof d[d.length-1]=="function"&&(i("emitting packet with ack id %d",this.ids),this.acks[this.ids]=d.pop(),m.id=this.ids++),this.connected?this.packet(m):this.sendBuffer.push(m),this},n.prototype.packet=function(s){s.nsp=this.nsp,this.io.packet(s)},n.prototype.onopen=function(){i("transport is open - connecting"),this.nsp!="/"&&this.packet({type:o.CONNECT})},n.prototype.onclose=function(s){i("close (%s)",s),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",s)},n.prototype.onpacket=function(s){if(s.nsp==this.nsp)switch(s.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(s);break;case o.BINARY_EVENT:this.onevent(s);break;case o.ACK:this.onack(s);break;case o.BINARY_ACK:this.onack(s);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",s.data)}},n.prototype.onevent=function(s){var d=s.data||[];i("emitting event %j",d),s.id!=null&&(i("attaching ack callback to event"),d.push(this.ack(s.id))),this.connected?c.apply(this,d):this.receiveBuffer.push(d)},n.prototype.ack=function(s){var d=this,g=!1;return function(){if(!g){g=!0;var m=l(arguments);i("sending ack %j",m);var v=h(m)?o.BINARY_ACK:o.ACK;d.packet({type:v,id:s,data:m})}}},n.prototype.onack=function(s){i("calling ack %s with %j",s.id,s.data);var d=this.acks[s.id];d.apply(this,s.data),delete this.acks[s.id]},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var s;for(s=0;s<this.receiveBuffer.length;s++)c.apply(this,this.receiveBuffer[s]);for(this.receiveBuffer=[],s=0;s<this.sendBuffer.length;s++)this.packet(this.sendBuffer[s]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){i("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var s=0;s<this.subs.length;s++)this.subs[s].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&(i("performing disconnect (%s)",this.nsp),this.packet({type:o.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}},{"./on":4,"component-bind":8,"component-emitter":9,debug:10,"has-binary":36,"socket.io-parser":44,"to-array":48}],6:[function(t,e){(function(r){function n(l,i){var f=l,i=i||r.location;return l==null&&(l=i.protocol+"//"+i.host),typeof l=="string"&&(l.charAt(0)=="/"&&(l=l.charAt(1)=="/"?i.protocol+l:i.hostname+l),/^(https?|wss?):\/\//.test(l)||(a("protocol-less url %s",l),l=typeof i<"u"?i.protocol+"//"+l:"https://"+l),a("parse %s",l),f=o(l)),f.port||(/^(http|ws)$/.test(f.protocol)?f.port="80":/^(http|ws)s$/.test(f.protocol)&&(f.port="443")),f.path=f.path||"/",f.id=f.protocol+"://"+f.host+":"+f.port,f.href=f.protocol+"://"+f.host+(i&&i.port==f.port?"":":"+f.port),f}var o=t("parseuri"),a=t("debug")("socket.io-client:url");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{debug:10,parseuri:42}],7:[function(t,e){function r(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}e.exports=r,r.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var o=Math.random(),a=Math.floor(o*this.jitter*n);n=1&Math.floor(10*o)?n+a:n-a}return 0|Math.min(n,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(n){this.ms=n},r.prototype.setMax=function(n){this.max=n},r.prototype.setJitter=function(n){this.jitter=n}},{}],8:[function(t,e){var r=[].slice;e.exports=function(n,o){if(typeof o=="string"&&(o=n[o]),typeof o!="function")throw new Error("bind() requires a function");var a=r.call(arguments,2);return function(){return o.apply(n,a.concat(r.call(arguments)))}}},{}],9:[function(t,e){function r(o){return o?n(o):void 0}function n(o){for(var a in r.prototype)o[a]=r.prototype[a];return o}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(o,a){return this._callbacks=this._callbacks||{},(this._callbacks[o]=this._callbacks[o]||[]).push(a),this},r.prototype.once=function(o,a){function l(){p.off(o,l),a.apply(this,arguments)}var p=this;return this._callbacks=this._callbacks||{},l.fn=a,this.on(o,l),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(o,a){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var l=this._callbacks[o];if(!l)return this;if(arguments.length==1)return delete this._callbacks[o],this;for(var p,f=0;f<l.length;f++)if(p=l[f],p===a||p.fn===a){l.splice(f,1);break}return this},r.prototype.emit=function(o){this._callbacks=this._callbacks||{};var a=[].slice.call(arguments,1),l=this._callbacks[o];if(l){l=l.slice(0);for(var p=0,f=l.length;f>p;++p)l[p].apply(this,a)}return this},r.prototype.listeners=function(o){return this._callbacks=this._callbacks||{},this._callbacks[o]||[]},r.prototype.hasListeners=function(o){return!!this.listeners(o).length}},{}],10:[function(t,e){function r(o){return r.enabled(o)?function(a){a=n(a);var l=new Date,p=l-(r[o]||l);r[o]=l,a=o+" "+a+" +"+r.humanize(p),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function n(o){return o instanceof Error?o.stack||o.message:o}e.exports=r,r.names=[],r.skips=[],r.enable=function(o){try{localStorage.debug=o}catch{}for(var a=(o||"").split(/[\s,]+/),l=a.length,p=0;l>p;p++)o=a[p].replace("*",".*?"),o[0]==="-"?r.skips.push(new RegExp("^"+o.substr(1)+"$")):r.names.push(new RegExp("^"+o+"$"))},r.disable=function(){r.enable("")},r.humanize=function(o){var a=1e3,l=6e4,p=60*l;return o>=p?(o/p).toFixed(1)+"h":o>=l?(o/l).toFixed(1)+"m":o>=a?(o/a|0)+"s":o+"ms"},r.enabled=function(o){for(var a=0,l=r.skips.length;l>a;a++)if(r.skips[a].test(o))return!1;for(var a=0,l=r.names.length;l>a;a++)if(r.names[a].test(o))return!0;return!1};try{window.localStorage&&r.enable(localStorage.debug)}catch{}},{}],11:[function(t,e){e.exports=t("./lib/")},{"./lib/":12}],12:[function(t,e){e.exports=t("./socket"),e.exports.parser=t("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(t,e){(function(r){function n(s,d){if(!(this instanceof n))return new n(s,d);if(d=d||{},s&&typeof s=="object"&&(d=s,s=null),s&&(s=h(s),d.host=s.host,d.secure=s.protocol=="https"||s.protocol=="wss",d.port=s.port,s.query&&(d.query=s.query)),this.secure=d.secure!=null?d.secure:r.location&&location.protocol=="https:",d.host){var g=d.host.split(":");d.hostname=g.shift(),g.length?d.port=g.pop():d.port||(d.port=this.secure?"443":"80")}this.agent=d.agent||!1,this.hostname=d.hostname||(r.location?location.hostname:"localhost"),this.port=d.port||(r.location&&location.port?location.port:this.secure?443:80),this.query=d.query||{},typeof this.query=="string"&&(this.query=c.decode(this.query)),this.upgrade=d.upgrade!==!1,this.path=(d.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!d.forceJSONP,this.jsonp=d.jsonp!==!1,this.forceBase64=!!d.forceBase64,this.enablesXDR=!!d.enablesXDR,this.timestampParam=d.timestampParam||"t",this.timestampRequests=d.timestampRequests,this.transports=d.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=d.policyPort||843,this.rememberUpgrade=d.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=d.onlyBinaryUpgrades,this.pfx=d.pfx||null,this.key=d.key||null,this.passphrase=d.passphrase||null,this.cert=d.cert||null,this.ca=d.ca||null,this.ciphers=d.ciphers||null,this.rejectUnauthorized=d.rejectUnauthorized||null,this.open()}function o(s){var d={};for(var g in s)s.hasOwnProperty(g)&&(d[g]=s[g]);return d}var a=t("./transports"),l=t("component-emitter"),p=t("debug")("engine.io-client:socket"),f=t("indexof"),i=t("engine.io-parser"),h=t("parseuri"),u=t("parsejson"),c=t("parseqs");e.exports=n,n.priorWebsocketSuccess=!1,l(n.prototype),n.protocol=i.protocol,n.Socket=n,n.Transport=t("./transport"),n.transports=t("./transports"),n.parser=t("engine.io-parser"),n.prototype.createTransport=function(s){p('creating transport "%s"',s);var d=o(this.query);d.EIO=i.protocol,d.transport=s,this.id&&(d.sid=this.id);var g=new a[s]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:d,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return g},n.prototype.open=function(){var d;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1)d="websocket";else{if(this.transports.length==0){var s=this;return void setTimeout(function(){s.emit("error","No transports available")},0)}d=this.transports[0]}this.readyState="opening";var d;try{d=this.createTransport(d)}catch{return this.transports.shift(),void this.open()}d.open(),this.setTransport(d)},n.prototype.setTransport=function(s){p("setting transport %s",s.name);var d=this;this.transport&&(p("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=s,s.on("drain",function(){d.onDrain()}).on("packet",function(g){d.onPacket(g)}).on("error",function(g){d.onError(g)}).on("close",function(){d.onClose("transport close")})},n.prototype.probe=function(s){function d(){if(w.onlyBinaryUpgrades){var E=!this.supportsBinary&&w.transport.supportsBinary;y=y||E}y||(p('probe transport "%s" opened',s),S.send([{type:"ping",data:"probe"}]),S.once("packet",function(C){if(!y)if(C.type=="pong"&&C.data=="probe"){if(p('probe transport "%s" pong',s),w.upgrading=!0,w.emit("upgrading",S),!S)return;n.priorWebsocketSuccess=S.name=="websocket",p('pausing current transport "%s"',w.transport.name),w.transport.pause(function(){y||w.readyState!="closed"&&(p("changing transport and sending upgrade packet"),b(),w.setTransport(S),S.send([{type:"upgrade"}]),w.emit("upgrade",S),S=null,w.upgrading=!1,w.flush())})}else{p('probe transport "%s" failed',s);var k=new Error("probe error");k.transport=S.name,w.emit("upgradeError",k)}}))}function g(){y||(y=!0,b(),S.close(),S=null)}function m(E){var C=new Error("probe error: "+E);C.transport=S.name,g(),p('probe transport "%s" failed because of error: %s',s,E),w.emit("upgradeError",C)}function v(){m("transport closed")}function T(){m("socket closed")}function R(E){S&&E.name!=S.name&&(p('"%s" works - aborting "%s"',E.name,S.name),g())}function b(){S.removeListener("open",d),S.removeListener("error",m),S.removeListener("close",v),w.removeListener("close",T),w.removeListener("upgrading",R)}p('probing transport "%s"',s);var S=this.createTransport(s,{probe:1}),y=!1,w=this;n.priorWebsocketSuccess=!1,S.once("open",d),S.once("error",m),S.once("close",v),this.once("close",T),this.once("upgrading",R),S.open()},n.prototype.onOpen=function(){if(p("socket open"),this.readyState="open",n.priorWebsocketSuccess=this.transport.name=="websocket",this.emit("open"),this.flush(),this.readyState=="open"&&this.upgrade&&this.transport.pause){p("starting upgrade probes");for(var s=0,d=this.upgrades.length;d>s;s++)this.probe(this.upgrades[s])}},n.prototype.onPacket=function(s){if(this.readyState=="opening"||this.readyState=="open")switch(p('socket receive: type "%s", data "%s"',s.type,s.data),this.emit("packet",s),this.emit("heartbeat"),s.type){case"open":this.onHandshake(u(s.data));break;case"pong":this.setPing();break;case"error":var d=new Error("server error");d.code=s.data,this.emit("error",d);break;case"message":this.emit("data",s.data),this.emit("message",s.data)}else p('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(s){this.emit("handshake",s),this.id=s.sid,this.transport.query.sid=s.sid,this.upgrades=this.filterUpgrades(s.upgrades),this.pingInterval=s.pingInterval,this.pingTimeout=s.pingTimeout,this.onOpen(),this.readyState!="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(s){clearTimeout(this.pingTimeoutTimer);var d=this;d.pingTimeoutTimer=setTimeout(function(){d.readyState!="closed"&&d.onClose("ping timeout")},s||d.pingInterval+d.pingTimeout)},n.prototype.setPing=function(){var s=this;clearTimeout(s.pingIntervalTimer),s.pingIntervalTimer=setTimeout(function(){p("writing ping packet - expecting pong within %sms",s.pingTimeout),s.ping(),s.onHeartbeat(s.pingTimeout)},s.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var s=0;s<this.prevBufferLen;s++)this.callbackBuffer[s]&&this.callbackBuffer[s]();this.writeBuffer.splice(0,this.prevBufferLen),this.callbackBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length==0?this.emit("drain"):this.flush()},n.prototype.flush=function(){this.readyState!="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(p("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(s,d){return this.sendPacket("message",s,d),this},n.prototype.sendPacket=function(s,d,g){if(this.readyState!="closing"&&this.readyState!="closed"){var m={type:s,data:d};this.emit("packetCreate",m),this.writeBuffer.push(m),this.callbackBuffer.push(g),this.flush()}},n.prototype.close=function(){function s(){m.onClose("forced close"),p("socket closing - telling transport to close"),m.transport.close()}function d(){m.removeListener("upgrade",d),m.removeListener("upgradeError",d),s()}function g(){m.once("upgrade",d),m.once("upgradeError",d)}if(this.readyState=="opening"||this.readyState=="open"){this.readyState="closing";var m=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?g():s()}):this.upgrading?g():s()}return this},n.prototype.onError=function(s){p("socket error %j",s),n.priorWebsocketSuccess=!1,this.emit("error",s),this.onClose("transport error",s)},n.prototype.onClose=function(s,d){if(this.readyState=="opening"||this.readyState=="open"||this.readyState=="closing"){p('socket close with reason: "%s"',s);var g=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){g.writeBuffer=[],g.callbackBuffer=[],g.prevBufferLen=0},0),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",s,d)}},n.prototype.filterUpgrades=function(s){for(var d=[],g=0,m=s.length;m>g;g++)~f(this.transports,s[g])&&d.push(s[g]);return d}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./transport":14,"./transports":15,"component-emitter":9,debug:22,"engine.io-parser":25,indexof:40,parsejson:32,parseqs:33,parseuri:34}],14:[function(t,e){function r(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}var n=t("engine.io-parser"),o=t("component-emitter");e.exports=r,o(r.prototype),r.timestamps=0,r.prototype.onError=function(a,l){var p=new Error(a);return p.type="TransportError",p.description=l,this.emit("error",p),this},r.prototype.open=function(){return(this.readyState=="closed"||this.readyState=="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState=="opening"||this.readyState=="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(a){if(this.readyState!="open")throw new Error("Transport not open");this.write(a)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(a){var l=n.decodePacket(a,this.socket.binaryType);this.onPacket(l)},r.prototype.onPacket=function(a){this.emit("packet",a)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(t,e,r){(function(n){function o(i){var h,u=!1,c=!1,s=i.jsonp!==!1;if(n.location){var d=location.protocol=="https:",g=location.port;g||(g=d?443:80),u=i.hostname!=location.hostname||g!=i.port,c=i.secure!=d}if(i.xdomain=u,i.xscheme=c,h=new a(i),"open"in h&&!i.forceJSONP)return new l(i);if(!s)throw new Error("JSONP disabled");return new p(i)}var a=t("xmlhttprequest"),l=t("./polling-xhr"),p=t("./polling-jsonp"),f=t("./websocket");r.polling=o,r.websocket=f}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(t,e){(function(r){function n(){}function o(h){a.call(this,h),this.query=this.query||{},p||(r.___eio||(r.___eio=[]),p=r.___eio),this.index=p.length;var u=this;p.push(function(c){u.onData(c)}),this.query.j=this.index,r.document&&r.addEventListener&&r.addEventListener("beforeunload",function(){u.script&&(u.script.onerror=n)},!1)}var a=t("./polling"),l=t("component-inherit");e.exports=o;var p,f=/\n/g,i=/\\n/g;l(o,a),o.prototype.supportsBinary=!1,o.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),a.prototype.doClose.call(this)},o.prototype.doPoll=function(){var h=this,u=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),u.async=!0,u.src=this.uri(),u.onerror=function(d){h.onError("jsonp poll error",d)};var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(u,c),this.script=u;var s=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);s&&setTimeout(function(){var d=document.createElement("iframe");document.body.appendChild(d),document.body.removeChild(d)},100)},o.prototype.doWrite=function(h,u){function c(){s(),u()}function s(){if(d.iframe)try{d.form.removeChild(d.iframe)}catch(b){d.onError("jsonp polling iframe removal error",b)}try{var R='<iframe src="javascript:0" name="'+d.iframeId+'">';g=document.createElement(R)}catch{g=document.createElement("iframe"),g.name=d.iframeId,g.src="javascript:0"}g.id=d.iframeId,d.form.appendChild(g),d.iframe=g}var d=this;if(!this.form){var g,m=document.createElement("form"),v=document.createElement("textarea"),T=this.iframeId="eio_iframe_"+this.index;m.className="socketio",m.style.position="absolute",m.style.top="-1000px",m.style.left="-1000px",m.target=T,m.method="POST",m.setAttribute("accept-charset","utf-8"),v.name="d",m.appendChild(v),document.body.appendChild(m),this.form=m,this.area=v}this.form.action=this.uri(),s(),h=h.replace(i,`\\
|
|
7
|
-
`),this.area.value=h.replace(f,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){d.iframe.readyState=="complete"&&c()}:this.iframe.onload=c}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(t,e){(function(r){function n(){}function o(c){if(f.call(this,c),r.location){var s=location.protocol=="https:",d=location.port;d||(d=s?443:80),this.xd=c.hostname!=r.location.hostname||d!=c.port,this.xs=c.secure!=s}}function a(c){this.method=c.method||"GET",this.uri=c.uri,this.xd=!!c.xd,this.xs=!!c.xs,this.async=c.async!==!1,this.data=c.data!=null?c.data:null,this.agent=c.agent,this.isBinary=c.isBinary,this.supportsBinary=c.supportsBinary,this.enablesXDR=c.enablesXDR,this.pfx=c.pfx,this.key=c.key,this.passphrase=c.passphrase,this.cert=c.cert,this.ca=c.ca,this.ciphers=c.ciphers,this.rejectUnauthorized=c.rejectUnauthorized,this.create()}function l(){for(var c in a.requests)a.requests.hasOwnProperty(c)&&a.requests[c].abort()}var p=t("xmlhttprequest"),f=t("./polling"),i=t("component-emitter"),h=t("component-inherit"),u=t("debug")("engine.io-client:polling-xhr");e.exports=o,e.exports.Request=a,h(o,f),o.prototype.supportsBinary=!0,o.prototype.request=function(c){return c=c||{},c.uri=this.uri(),c.xd=this.xd,c.xs=this.xs,c.agent=this.agent||!1,c.supportsBinary=this.supportsBinary,c.enablesXDR=this.enablesXDR,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,new a(c)},o.prototype.doWrite=function(c,s){var d=typeof c!="string"&&c!==void 0,g=this.request({method:"POST",data:c,isBinary:d}),m=this;g.on("success",s),g.on("error",function(v){m.onError("xhr post error",v)}),this.sendXhr=g},o.prototype.doPoll=function(){u("xhr poll");var c=this.request(),s=this;c.on("data",function(d){s.onData(d)}),c.on("error",function(d){s.onError("xhr poll error",d)}),this.pollXhr=c},i(a.prototype),a.prototype.create=function(){var c={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};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;var s=this.xhr=new p(c),d=this;try{if(u("xhr open %s: %s",this.method,this.uri),s.open(this.method,this.uri,this.async),this.supportsBinary&&(s.responseType="arraybuffer"),this.method=="POST")try{this.isBinary?s.setRequestHeader("Content-type","application/octet-stream"):s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}"withCredentials"in s&&(s.withCredentials=!0),this.hasXDR()?(s.onload=function(){d.onLoad()},s.onerror=function(){d.onError(s.responseText)}):s.onreadystatechange=function(){s.readyState==4&&(s.status==200||s.status==1223?d.onLoad():setTimeout(function(){d.onError(s.status)},0))},u("xhr data %s",this.data),s.send(this.data)}catch(g){return void setTimeout(function(){d.onError(g)},0)}r.document&&(this.index=a.requestsCount++,a.requests[this.index]=this)},a.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},a.prototype.onData=function(c){this.emit("data",c),this.onSuccess()},a.prototype.onError=function(c){this.emit("error",c),this.cleanup(!0)},a.prototype.cleanup=function(c){if(typeof this.xhr<"u"&&this.xhr!==null){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,c)try{this.xhr.abort()}catch{}r.document&&delete a.requests[this.index],this.xhr=null}},a.prototype.onLoad=function(){var c;try{var s;try{s=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch{}c=s==="application/octet-stream"?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(d){this.onError(d)}c!=null&&this.onData(c)},a.prototype.hasXDR=function(){return typeof r.XDomainRequest<"u"&&!this.xs&&this.enablesXDR},a.prototype.abort=function(){this.cleanup()},r.document&&(a.requestsCount=0,a.requests={},r.attachEvent?r.attachEvent("onunload",l):r.addEventListener&&r.addEventListener("beforeunload",l,!1))}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-emitter":9,"component-inherit":21,debug:22,xmlhttprequest:20}],18:[function(t,e){function r(i){var h=i&&i.forceBase64;(!f||h)&&(this.supportsBinary=!1),n.call(this,i)}var n=t("../transport"),o=t("parseqs"),a=t("engine.io-parser"),l=t("component-inherit"),p=t("debug")("engine.io-client:polling");e.exports=r;var f=function(){var i=t("xmlhttprequest"),h=new i({xdomain:!1});return h.responseType!=null}();l(r,n),r.prototype.name="polling",r.prototype.doOpen=function(){this.poll()},r.prototype.pause=function(i){function h(){p("paused"),u.readyState="paused",i()}var u=this;if(this.readyState="pausing",this.polling||!this.writable){var c=0;this.polling&&(p("we are currently polling - waiting to pause"),c++,this.once("pollComplete",function(){p("pre-pause polling complete"),--c||h()})),this.writable||(p("we are currently writing - waiting to pause"),c++,this.once("drain",function(){p("pre-pause writing complete"),--c||h()}))}else h()},r.prototype.poll=function(){p("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},r.prototype.onData=function(i){var h=this;p("polling got data %s",i);var u=function(c){return h.readyState=="opening"&&h.onOpen(),c.type=="close"?(h.onClose(),!1):void h.onPacket(c)};a.decodePayload(i,this.socket.binaryType,u),this.readyState!="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState=="open"?this.poll():p('ignoring poll - transport state "%s"',this.readyState))},r.prototype.doClose=function(){function i(){p("writing close packet"),h.write([{type:"close"}])}var h=this;this.readyState=="open"?(p("transport open - closing"),i()):(p("transport not open - deferring close"),this.once("open",i))},r.prototype.write=function(i){var u=this;this.writable=!1;var h=function(){u.writable=!0,u.emit("drain")},u=this;a.encodePayload(i,this.supportsBinary,function(c){u.doWrite(c,h)})},r.prototype.uri=function(){var i=this.query||{},h=this.secure?"https":"http",u="";return this.timestampRequests!==!1&&(i[this.timestampParam]=+new Date+"-"+n.timestamps++),this.supportsBinary||i.sid||(i.b64=1),i=o.encode(i),this.port&&(h=="https"&&this.port!=443||h=="http"&&this.port!=80)&&(u=":"+this.port),i.length&&(i="?"+i),h+"://"+this.hostname+u+this.path+i}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(t,e){function r(i){var h=i&&i.forceBase64;h&&(this.supportsBinary=!1),n.call(this,i)}var n=t("../transport"),o=t("engine.io-parser"),a=t("parseqs"),l=t("component-inherit"),p=t("debug")("engine.io-client:websocket"),f=t("ws");e.exports=r,l(r,n),r.prototype.name="websocket",r.prototype.supportsBinary=!0,r.prototype.doOpen=function(){if(this.check()){var i=this.uri(),h=void 0,u={agent:this.agent};u.pfx=this.pfx,u.key=this.key,u.passphrase=this.passphrase,u.cert=this.cert,u.ca=this.ca,u.ciphers=this.ciphers,u.rejectUnauthorized=this.rejectUnauthorized,this.ws=new f(i,h,u),this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},r.prototype.addEventListeners=function(){var i=this;this.ws.onopen=function(){i.onOpen()},this.ws.onclose=function(){i.onClose()},this.ws.onmessage=function(h){i.onData(h.data)},this.ws.onerror=function(h){i.onError("websocket error",h)}},typeof navigator<"u"&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(r.prototype.onData=function(i){var h=this;setTimeout(function(){n.prototype.onData.call(h,i)},0)}),r.prototype.write=function(i){function h(){u.writable=!0,u.emit("drain")}var u=this;this.writable=!1;for(var c=0,s=i.length;s>c;c++)o.encodePacket(i[c],this.supportsBinary,function(d){try{u.ws.send(d)}catch{p("websocket closed before onclose event")}});setTimeout(h,0)},r.prototype.onClose=function(){n.prototype.onClose.call(this)},r.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},r.prototype.uri=function(){var i=this.query||{},h=this.secure?"wss":"ws",u="";return this.port&&(h=="wss"&&this.port!=443||h=="ws"&&this.port!=80)&&(u=":"+this.port),this.timestampRequests&&(i[this.timestampParam]=+new Date),this.supportsBinary||(i.b64=1),i=a.encode(i),i.length&&(i="?"+i),h+"://"+this.hostname+u+this.path+i},r.prototype.check=function(){return!(!f||"__initialize"in f&&this.name===r.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(t,e){var r=t("has-cors");e.exports=function(n){var o=n.xdomain,a=n.xscheme,l=n.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!o||r))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!a&&l)return new XDomainRequest}catch{}if(!o)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}}},{"has-cors":38}],21:[function(t,e){e.exports=function(r,n){var o=function(){};o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r}},{}],22:[function(t,e,r){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var f=arguments,i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+r.humanize(this.diff),!i)return f;var h="color: "+this.color;f=[f[0],h,"color: inherit"].concat(Array.prototype.slice.call(f,1));var u=0,c=0;return f[0].replace(/%[a-z%]/g,function(s){s!=="%%"&&(u++,s==="%c"&&(c=u))}),f.splice(c,0,h),f}function a(){return typeof console=="object"&&typeof console.log=="function"&&Function.prototype.apply.call(console.log,console,arguments)}function l(f){try{f==null?localStorage.removeItem("debug"):localStorage.debug=f}catch{}}function p(){var f;try{f=localStorage.debug}catch{}return f}r=e.exports=t("./debug"),r.log=a,r.formatArgs=o,r.save=l,r.load=p,r.useColors=n,r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(f){return JSON.stringify(f)},r.enable(p())},{"./debug":23}],23:[function(t,e,r){function n(){return r.colors[h++%r.colors.length]}function o(u){function c(){}function s(){var g=s,m=+new Date,v=m-(i||m);g.diff=v,g.prev=i,g.curr=m,i=m,g.useColors==null&&(g.useColors=r.useColors()),g.color==null&&g.useColors&&(g.color=n());var T=Array.prototype.slice.call(arguments);T[0]=r.coerce(T[0]),typeof T[0]!="string"&&(T=["%o"].concat(T));var R=0;T[0]=T[0].replace(/%([a-z%])/g,function(S,y){if(S==="%%")return S;R++;var w=r.formatters[y];if(typeof w=="function"){var E=T[R];S=w.call(g,E),T.splice(R,1),R--}return S}),typeof r.formatArgs=="function"&&(T=r.formatArgs.apply(g,T));var b=s.log||r.log||console.log.bind(console);b.apply(g,T)}c.enabled=!1,s.enabled=!0;var d=r.enabled(u)?s:c;return d.namespace=u,d}function a(u){r.save(u);for(var c=(u||"").split(/[\s,]+/),s=c.length,d=0;s>d;d++)c[d]&&(u=c[d].replace(/\*/g,".*?"),u[0]==="-"?r.skips.push(new RegExp("^"+u.substr(1)+"$")):r.names.push(new RegExp("^"+u+"$")))}function l(){r.enable("")}function p(u){var c,s;for(c=0,s=r.skips.length;s>c;c++)if(r.skips[c].test(u))return!1;for(c=0,s=r.names.length;s>c;c++)if(r.names[c].test(u))return!0;return!1}function f(u){return u instanceof Error?u.stack||u.message:u}r=e.exports=o,r.coerce=f,r.disable=l,r.enable=a,r.enabled=p,r.humanize=t("ms"),r.names=[],r.skips=[],r.formatters={};var i,h=0},{ms:24}],24:[function(t,e){function r(u){var c=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(u);if(c){var s=parseFloat(c[1]),d=(c[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"y":return s*h;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"h":return s*f;case"minutes":case"minute":case"m":return s*p;case"seconds":case"second":case"s":return s*l;case"ms":return s}}}function n(u){return u>=i?Math.round(u/i)+"d":u>=f?Math.round(u/f)+"h":u>=p?Math.round(u/p)+"m":u>=l?Math.round(u/l)+"s":u+"ms"}function o(u){return a(u,i,"day")||a(u,f,"hour")||a(u,p,"minute")||a(u,l,"second")||u+" ms"}function a(u,c,s){return c>u?void 0:1.5*c>u?Math.floor(u/c)+" "+s:Math.ceil(u/c)+" "+s+"s"}var l=1e3,p=60*l,f=60*p,i=24*f,h=365.25*i;e.exports=function(u,c){return c=c||{},typeof u=="string"?r(u):c.long?o(u):n(u)}},{}],25:[function(t,e,r){(function(n){function o(y,w){var E="b"+r.packets[y.type]+y.data.data;return w(E)}function a(y,w,E){if(!w)return r.encodeBase64Packet(y,E);var C=y.data,k=new Uint8Array(C),N=new Uint8Array(1+C.byteLength);N[0]=T[y.type];for(var O=0;O<k.length;O++)N[O+1]=k[O];return E(N.buffer)}function l(y,w,E){if(!w)return r.encodeBase64Packet(y,E);var C=new FileReader;return C.onload=function(){y.data=C.result,r.encodePacket(y,w,!0,E)},C.readAsArrayBuffer(y.data)}function p(y,w,E){if(!w)return r.encodeBase64Packet(y,E);if(v)return l(y,w,E);var C=new Uint8Array(1);C[0]=T[y.type];var k=new S([C.buffer,y.data]);return E(k)}function f(y,w,E){for(var C=new Array(y.length),k=s(y.length,E),N=function(L,A,z){w(A,function(M,K){C[L]=K,z(M,C)})},O=0;O<y.length;O++)N(O,y[O],k)}var i=t("./keys"),h=t("has-binary"),u=t("arraybuffer.slice"),c=t("base64-arraybuffer"),s=t("after"),d=t("utf8"),g=navigator.userAgent.match(/Android/i),m=/PhantomJS/i.test(navigator.userAgent),v=g||m;r.protocol=3;var T=r.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},R=i(T),b={type:"error",data:"parser error"},S=t("blob");r.encodePacket=function(y,w,E,C){typeof w=="function"&&(C=w,w=!1),typeof E=="function"&&(C=E,E=null);var k=y.data===void 0?void 0:y.data.buffer||y.data;if(n.ArrayBuffer&&k instanceof ArrayBuffer)return a(y,w,C);if(S&&k instanceof n.Blob)return p(y,w,C);if(k&&k.base64)return o(y,C);var N=T[y.type];return y.data!==void 0&&(N+=E?d.encode(String(y.data)):String(y.data)),C(""+N)},r.encodeBase64Packet=function(y,w){var E="b"+r.packets[y.type];if(S&&y.data instanceof S){var C=new FileReader;return C.onload=function(){var A=C.result.split(",")[1];w(E+A)},C.readAsDataURL(y.data)}var k;try{k=String.fromCharCode.apply(null,new Uint8Array(y.data))}catch{for(var N=new Uint8Array(y.data),O=new Array(N.length),L=0;L<N.length;L++)O[L]=N[L];k=String.fromCharCode.apply(null,O)}return E+=n.btoa(k),w(E)},r.decodePacket=function(y,w,E){if(typeof y=="string"||y===void 0){if(y.charAt(0)=="b")return r.decodeBase64Packet(y.substr(1),w);if(E)try{y=d.decode(y)}catch{return b}var k=y.charAt(0);return Number(k)==k&&R[k]?y.length>1?{type:R[k],data:y.substring(1)}:{type:R[k]}:b}var C=new Uint8Array(y),k=C[0],N=u(y,1);return S&&w==="blob"&&(N=new S([N])),{type:R[k],data:N}},r.decodeBase64Packet=function(y,w){var E=R[y.charAt(0)];if(!n.ArrayBuffer)return{type:E,data:{base64:!0,data:y.substr(1)}};var C=c.decode(y.substr(1));return w==="blob"&&S&&(C=new S([C])),{type:E,data:C}},r.encodePayload=function(y,w,E){function C(O){return O.length+":"+O}function k(O,L){r.encodePacket(O,N?w:!1,!0,function(A){L(null,C(A))})}typeof w=="function"&&(E=w,w=null);var N=h(y);return w&&N?S&&!v?r.encodePayloadAsBlob(y,E):r.encodePayloadAsArrayBuffer(y,E):y.length?void f(y,k,function(O,L){return E(L.join(""))}):E("0:")},r.decodePayload=function(y,w,E){if(typeof y!="string")return r.decodePayloadAsBinary(y,w,E);typeof w=="function"&&(E=w,w=null);var C;if(y=="")return E(b,0,1);for(var k,N,O="",L=0,A=y.length;A>L;L++){var z=y.charAt(L);if(z!=":")O+=z;else{if(O==""||O!=(k=Number(O))||(N=y.substr(L+1,k),O!=N.length))return E(b,0,1);if(N.length){if(C=r.decodePacket(N,w,!0),b.type==C.type&&b.data==C.data)return E(b,0,1);var M=E(C,L+k,A);if(M===!1)return}L+=k,O=""}}return O!=""?E(b,0,1):void 0},r.encodePayloadAsArrayBuffer=function(y,w){function E(C,k){r.encodePacket(C,!0,!0,function(N){return k(null,N)})}return y.length?void f(y,E,function(C,k){var N=k.reduce(function(A,z){var M;return M=typeof z=="string"?z.length:z.byteLength,A+M.toString().length+M+2},0),O=new Uint8Array(N),L=0;return k.forEach(function(A){var z=typeof A=="string",M=A;if(z){for(var K=new Uint8Array(A.length),X=0;X<A.length;X++)K[X]=A.charCodeAt(X);M=K.buffer}O[L++]=z?0:1;for(var te=M.byteLength.toString(),X=0;X<te.length;X++)O[L++]=parseInt(te[X]);O[L++]=255;for(var K=new Uint8Array(M),X=0;X<K.length;X++)O[L++]=K[X]}),w(O.buffer)}):w(new ArrayBuffer(0))},r.encodePayloadAsBlob=function(y,w){function E(C,k){r.encodePacket(C,!0,!0,function(N){var O=new Uint8Array(1);if(O[0]=1,typeof N=="string"){for(var L=new Uint8Array(N.length),A=0;A<N.length;A++)L[A]=N.charCodeAt(A);N=L.buffer,O[0]=0}for(var z=N instanceof ArrayBuffer?N.byteLength:N.size,M=z.toString(),K=new Uint8Array(M.length+1),A=0;A<M.length;A++)K[A]=parseInt(M[A]);if(K[M.length]=255,S){var X=new S([O.buffer,K.buffer,N]);k(null,X)}})}f(y,E,function(C,k){return w(new S(k))})},r.decodePayloadAsBinary=function(y,w,E){typeof w=="function"&&(E=w,w=null);for(var C=y,k=[],N=!1;C.byteLength>0;){for(var O=new Uint8Array(C),L=O[0]===0,A="",z=1;O[z]!=255;z++){if(A.length>310){N=!0;break}A+=O[z]}if(N)return E(b,0,1);C=u(C,2+A.length),A=parseInt(A);var M=u(C,0,A);if(L)try{M=String.fromCharCode.apply(null,new Uint8Array(M))}catch{var K=new Uint8Array(M);M="";for(var z=0;z<K.length;z++)M+=String.fromCharCode(K[z])}k.push(M),C=u(C,A)}var X=k.length;k.forEach(function(te,Ne){E(r.decodePacket(te,w,!0),Ne,X)})}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./keys":26,after:27,"arraybuffer.slice":28,"base64-arraybuffer":29,blob:30,"has-binary":36,utf8:31}],26:[function(t,e){e.exports=Object.keys||function(r){var n=[],o=Object.prototype.hasOwnProperty;for(var a in r)o.call(r,a)&&n.push(a);return n}},{}],27:[function(t,e){function r(o,a,l){function p(i,h){if(p.count<=0)throw new Error("after called too many times");--p.count,i?(f=!0,a(i),a=l):p.count!==0||f||a(null,h)}var f=!1;return l=l||n,p.count=o,o===0?a():p}function n(){}e.exports=r},{}],28:[function(t,e){e.exports=function(r,n,o){var a=r.byteLength;if(n=n||0,o=o||a,r.slice)return r.slice(n,o);if(0>n&&(n+=a),0>o&&(o+=a),o>a&&(o=a),n>=a||n>=o||a===0)return new ArrayBuffer(0);for(var l=new Uint8Array(r),p=new Uint8Array(o-n),f=n,i=0;o>f;f++,i++)p[i]=l[f];return p.buffer}},{}],29:[function(t,e,r){(function(n){r.encode=function(o){var a,l=new Uint8Array(o),p=l.length,f="";for(a=0;p>a;a+=3)f+=n[l[a]>>2],f+=n[(3&l[a])<<4|l[a+1]>>4],f+=n[(15&l[a+1])<<2|l[a+2]>>6],f+=n[63&l[a+2]];return p%3===2?f=f.substring(0,f.length-1)+"=":p%3===1&&(f=f.substring(0,f.length-2)+"=="),f},r.decode=function(o){var a,l,p,f,i,h=.75*o.length,u=o.length,c=0;o[o.length-1]==="="&&(h--,o[o.length-2]==="="&&h--);var s=new ArrayBuffer(h),d=new Uint8Array(s);for(a=0;u>a;a+=4)l=n.indexOf(o[a]),p=n.indexOf(o[a+1]),f=n.indexOf(o[a+2]),i=n.indexOf(o[a+3]),d[c++]=l<<2|p>>4,d[c++]=(15&p)<<4|f>>2,d[c++]=(3&f)<<6|63&i;return s}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(t,e){(function(r){function n(h){for(var u=0;u<h.length;u++){var c=h[u];if(c.buffer instanceof ArrayBuffer){var s=c.buffer;if(c.byteLength!==s.byteLength){var d=new Uint8Array(c.byteLength);d.set(new Uint8Array(s,c.byteOffset,c.byteLength)),s=d.buffer}h[u]=s}}}function o(h,u){u=u||{};var c=new l;n(h);for(var s=0;s<h.length;s++)c.append(h[s]);return u.type?c.getBlob(u.type):c.getBlob()}function a(h,u){return n(h),new Blob(h,u||{})}var l=r.BlobBuilder||r.WebKitBlobBuilder||r.MSBlobBuilder||r.MozBlobBuilder,p=function(){try{var h=new Blob(["hi"]);return h.size===2}catch{return!1}}(),f=p&&function(){try{var h=new Blob([new Uint8Array([1,2])]);return h.size===2}catch{return!1}}(),i=l&&l.prototype.append&&l.prototype.getBlob;e.exports=function(){return p?f?r.Blob:a:i?o:void 0}()}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],31:[function(t,e,r){(function(n){(function(o){function a(C){for(var k,N,O=[],L=0,A=C.length;A>L;)k=C.charCodeAt(L++),k>=55296&&56319>=k&&A>L?(N=C.charCodeAt(L++),(64512&N)==56320?O.push(((1023&k)<<10)+(1023&N)+65536):(O.push(k),L--)):O.push(k);return O}function l(C){for(var k,N=C.length,O=-1,L="";++O<N;)k=C[O],k>65535&&(k-=65536,L+=b(k>>>10&1023|55296),k=56320|1023&k),L+=b(k);return L}function p(C){if(C>=55296&&57343>=C)throw Error("Lone surrogate U+"+C.toString(16).toUpperCase()+" is not a scalar value")}function f(C,k){return b(C>>k&63|128)}function i(C){if(!(4294967168&C))return b(C);var k="";return 4294965248&C?4294901760&C?!(4292870144&C)&&(k=b(C>>18&7|240),k+=f(C,12),k+=f(C,6)):(p(C),k=b(C>>12&15|224),k+=f(C,6)):k=b(C>>6&31|192),k+=b(63&C|128)}function h(C){for(var k,N=a(C),O=N.length,L=-1,A="";++L<O;)k=N[L],A+=i(k);return A}function u(){if(R>=T)throw Error("Invalid byte index");var C=255&v[R];if(R++,(192&C)==128)return 63&C;throw Error("Invalid continuation byte")}function c(){var C,k,N,O,L;if(R>T)throw Error("Invalid byte index");if(R==T)return!1;if(C=255&v[R],R++,(128&C)==0)return C;if((224&C)==192){var k=u();if(L=(31&C)<<6|k,L>=128)return L;throw Error("Invalid continuation byte")}if((240&C)==224){if(k=u(),N=u(),L=(15&C)<<12|k<<6|N,L>=2048)return p(L),L;throw Error("Invalid continuation byte")}if((248&C)==240&&(k=u(),N=u(),O=u(),L=(15&C)<<18|k<<12|N<<6|O,L>=65536&&1114111>=L))return L;throw Error("Invalid UTF-8 detected")}function s(C){v=a(C),T=v.length,R=0;for(var k,N=[];(k=c())!==!1;)N.push(k);return l(N)}var d=typeof r=="object"&&r,g=typeof e=="object"&&e&&e.exports==d&&e,m=typeof n=="object"&&n;(m.global===m||m.window===m)&&(o=m);var v,T,R,b=String.fromCharCode,S={version:"2.0.0",encode:h,decode:s};if(d&&!d.nodeType)if(g)g.exports=S;else{var y={},w=y.hasOwnProperty;for(var E in S)w.call(S,E)&&(d[E]=S[E])}else o.utf8=S})(this)}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],32:[function(t,e){(function(r){var n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,a=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,l=/(?:^|:|,)(?:\s*\[)+/g,p=/^\s+/,f=/\s+$/;e.exports=function(i){return typeof i=="string"&&i?(i=i.replace(p,"").replace(f,""),r.JSON&&JSON.parse?JSON.parse(i):n.test(i.replace(o,"@").replace(a,"]").replace(l,""))?new Function("return "+i)():void 0):null}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],33:[function(t,e,r){r.encode=function(n){var o="";for(var a in n)n.hasOwnProperty(a)&&(o.length&&(o+="&"),o+=encodeURIComponent(a)+"="+encodeURIComponent(n[a]));return o},r.decode=function(n){for(var o={},a=n.split("&"),l=0,p=a.length;p>l;l++){var f=a[l].split("=");o[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return o}},{}],34:[function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(o){var a=o,l=o.indexOf("["),p=o.indexOf("]");l!=-1&&p!=-1&&(o=o.substring(0,l)+o.substring(l,p).replace(/:/g,";")+o.substring(p,o.length));for(var f=r.exec(o||""),i={},h=14;h--;)i[n[h]]=f[h]||"";return l!=-1&&p!=-1&&(i.source=a,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i}},{}],35:[function(t,e){function r(a,l){return l?new o(a,l):new o(a)}var n=function(){return self}(),o=n.WebSocket||n.MozWebSocket;e.exports=o?r:null,o&&(r.prototype=o.prototype)},{}],36:[function(t,e){(function(r){function n(a){function l(p){if(!p)return!1;if(r.Buffer&&r.Buffer.isBuffer(p)||r.ArrayBuffer&&p instanceof ArrayBuffer||r.Blob&&p instanceof Blob||r.File&&p instanceof File)return!0;if(o(p)){for(var f=0;f<p.length;f++)if(l(p[f]))return!0}else if(p&&typeof p=="object"){p.toJSON&&(p=p.toJSON());for(var i in p)if(Object.prototype.hasOwnProperty.call(p,i)&&l(p[i]))return!0}return!1}return l(a)}var o=t("isarray");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{isarray:37}],37:[function(t,e){e.exports=Array.isArray||function(r){return Object.prototype.toString.call(r)=="[object Array]"}},{}],38:[function(t,e){var r=t("global");try{e.exports="XMLHttpRequest"in r&&"withCredentials"in new r.XMLHttpRequest}catch{e.exports=!1}},{global:39}],39:[function(t,e){e.exports=function(){return this}()},{}],40:[function(t,e){var r=[].indexOf;e.exports=function(n,o){if(r)return n.indexOf(o);for(var a=0;a<n.length;++a)if(n[a]===o)return a;return-1}},{}],41:[function(t,e,r){var n=Object.prototype.hasOwnProperty;r.keys=Object.keys||function(o){var a=[];for(var l in o)n.call(o,l)&&a.push(l);return a},r.values=function(o){var a=[];for(var l in o)n.call(o,l)&&a.push(o[l]);return a},r.merge=function(o,a){for(var l in a)n.call(a,l)&&(o[l]=a[l]);return o},r.length=function(o){return r.keys(o).length},r.isEmpty=function(o){return r.length(o)==0}},{}],42:[function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(o){for(var a=r.exec(o||""),l={},p=14;p--;)l[n[p]]=a[p]||"";return l}},{}],43:[function(t,e,r){(function(n){var o=t("isarray"),a=t("./is-buffer");r.deconstructPacket=function(l){function p(u){if(!u)return u;if(a(u)){var c={_placeholder:!0,num:f.length};return f.push(u),c}if(o(u)){for(var s=new Array(u.length),d=0;d<u.length;d++)s[d]=p(u[d]);return s}if(typeof u=="object"&&!(u instanceof Date)){var s={};for(var g in u)s[g]=p(u[g]);return s}return u}var f=[],i=l.data,h=l;return h.data=p(i),h.attachments=f.length,{packet:h,buffers:f}},r.reconstructPacket=function(l,p){function f(i){if(i&&i._placeholder){var h=p[i.num];return h}if(o(i)){for(var u=0;u<i.length;u++)i[u]=f(i[u]);return i}if(i&&typeof i=="object"){for(var c in i)i[c]=f(i[c]);return i}return i}return l.data=f(l.data),l.attachments=void 0,l},r.removeBlobs=function(l,p){function f(u,c,s){if(!u)return u;if(n.Blob&&u instanceof Blob||n.File&&u instanceof File){i++;var d=new FileReader;d.onload=function(){s?s[c]=this.result:h=this.result,--i||p(h)},d.readAsArrayBuffer(u)}else if(o(u))for(var g=0;g<u.length;g++)f(u[g],g,u);else if(u&&typeof u=="object"&&!a(u))for(var m in u)f(u[m],m,u)}var i=0,h=l;f(h),i||p(h)}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(t,e,r){function n(){}function o(g){var m="",v=!1;return m+=g.type,(r.BINARY_EVENT==g.type||r.BINARY_ACK==g.type)&&(m+=g.attachments,m+="-"),g.nsp&&g.nsp!="/"&&(v=!0,m+=g.nsp),g.id!=null&&(v&&(m+=",",v=!1),m+=g.id),g.data!=null&&(v&&(m+=","),m+=u.stringify(g.data)),h("encoded %j as %s",g,m),m}function a(g,m){function v(T){var R=s.deconstructPacket(T),b=o(R.packet),S=R.buffers;S.unshift(b),m(S)}s.removeBlobs(g,v)}function l(){this.reconstructor=null}function p(g){var m={},v=0;if(m.type=Number(g.charAt(0)),r.types[m.type]==null)return i();if(r.BINARY_EVENT==m.type||r.BINARY_ACK==m.type){for(var T="";g.charAt(++v)!="-"&&(T+=g.charAt(v),v!=g.length););if(T!=Number(T)||g.charAt(v)!="-")throw new Error("Illegal attachments");m.attachments=Number(T)}if(g.charAt(v+1)=="/")for(m.nsp="";++v;){var R=g.charAt(v);if(R==","||(m.nsp+=R,v==g.length))break}else m.nsp="/";var b=g.charAt(v+1);if(b!==""&&Number(b)==b){for(m.id="";++v;){var R=g.charAt(v);if(R==null||Number(R)!=R){--v;break}if(m.id+=g.charAt(v),v==g.length)break}m.id=Number(m.id)}if(g.charAt(++v))try{m.data=u.parse(g.substr(v))}catch{return i()}return h("decoded %s as %j",g,m),m}function f(g){this.reconPack=g,this.buffers=[]}function i(){return{type:r.ERROR,data:"parser error"}}var h=t("debug")("socket.io-parser"),u=t("json3"),c=(t("isarray"),t("component-emitter")),s=t("./binary"),d=t("./is-buffer");r.protocol=4,r.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],r.CONNECT=0,r.DISCONNECT=1,r.EVENT=2,r.ACK=3,r.ERROR=4,r.BINARY_EVENT=5,r.BINARY_ACK=6,r.Encoder=n,r.Decoder=l,n.prototype.encode=function(g,m){if(h("encoding packet %j",g),r.BINARY_EVENT==g.type||r.BINARY_ACK==g.type)a(g,m);else{var v=o(g);m([v])}},c(l.prototype),l.prototype.add=function(g){var m;if(typeof g=="string")m=p(g),r.BINARY_EVENT==m.type||r.BINARY_ACK==m.type?(this.reconstructor=new f(m),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",m)):this.emit("decoded",m);else{if(!d(g)&&!g.base64)throw new Error("Unknown type: "+g);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");m=this.reconstructor.takeBinaryData(g),m&&(this.reconstructor=null,this.emit("decoded",m))}},l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},f.prototype.takeBinaryData=function(g){if(this.buffers.push(g),this.buffers.length==this.reconPack.attachments){var m=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),m}return null},f.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},{"./binary":43,"./is-buffer":45,"component-emitter":9,debug:10,isarray:46,json3:47}],45:[function(t,e){(function(r){function n(o){return r.Buffer&&r.Buffer.isBuffer(o)||r.ArrayBuffer&&o instanceof ArrayBuffer}e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],46:[function(t,e){e.exports=t(37)},{}],47:[function(t,e,r){(function(n){function o(I){if(o[I]!==p)return o[I];var F;if(I=="bug-string-char-index")F=!1;else if(I=="json")F=o("json-stringify")&&o("json-parse");else{var _,P='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(I=="json-stringify"){var x=h.stringify,U=typeof x=="function"&&u;if(U){(_=function(){return 1}).toJSON=_;try{U=x(0)==="0"&&x(new Number)==="0"&&x(new String)=='""'&&x(f)===p&&x(p)===p&&x()===p&&x(_)==="1"&&x([_])=="[1]"&&x([p])=="[null]"&&x(null)=="null"&&x([p,f,null])=="[null,null,null]"&&x({a:[_,!0,!1,null,`\0\b
|
|
8
|
-
\f\r `]})==P&&
|
|
6
|
+
*/var Qr=function(t){return t!=null&&(dr(t)||Zr(t)||!!t._isBuffer)};function dr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Zr(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&dr(t.slice(0,0))}(function(){var t=Yr,e=Yt.utf8,r=Qr,n=Yt.bin,o=function(c,l){c.constructor==String?l&&l.encoding==="binary"?c=n.stringToBytes(c):c=e.stringToBytes(c):r(c)?c=Array.prototype.slice.call(c,0):!Array.isArray(c)&&c.constructor!==Uint8Array&&(c=c.toString());for(var p=t.bytesToWords(c),f=c.length*8,i=1732584193,u=-271733879,h=-1732584194,a=271733878,s=0;s<p.length;s++)p[s]=(p[s]<<8|p[s]>>>24)&16711935|(p[s]<<24|p[s]>>>8)&4278255360;p[f>>>5]|=128<<f%32,p[(f+64>>>9<<4)+14]=f;for(var d=o._ff,y=o._gg,m=o._hh,v=o._ii,s=0;s<p.length;s+=16){var T=i,R=u,b=h,S=a;i=d(i,u,h,a,p[s+0],7,-680876936),a=d(a,i,u,h,p[s+1],12,-389564586),h=d(h,a,i,u,p[s+2],17,606105819),u=d(u,h,a,i,p[s+3],22,-1044525330),i=d(i,u,h,a,p[s+4],7,-176418897),a=d(a,i,u,h,p[s+5],12,1200080426),h=d(h,a,i,u,p[s+6],17,-1473231341),u=d(u,h,a,i,p[s+7],22,-45705983),i=d(i,u,h,a,p[s+8],7,1770035416),a=d(a,i,u,h,p[s+9],12,-1958414417),h=d(h,a,i,u,p[s+10],17,-42063),u=d(u,h,a,i,p[s+11],22,-1990404162),i=d(i,u,h,a,p[s+12],7,1804603682),a=d(a,i,u,h,p[s+13],12,-40341101),h=d(h,a,i,u,p[s+14],17,-1502002290),u=d(u,h,a,i,p[s+15],22,1236535329),i=y(i,u,h,a,p[s+1],5,-165796510),a=y(a,i,u,h,p[s+6],9,-1069501632),h=y(h,a,i,u,p[s+11],14,643717713),u=y(u,h,a,i,p[s+0],20,-373897302),i=y(i,u,h,a,p[s+5],5,-701558691),a=y(a,i,u,h,p[s+10],9,38016083),h=y(h,a,i,u,p[s+15],14,-660478335),u=y(u,h,a,i,p[s+4],20,-405537848),i=y(i,u,h,a,p[s+9],5,568446438),a=y(a,i,u,h,p[s+14],9,-1019803690),h=y(h,a,i,u,p[s+3],14,-187363961),u=y(u,h,a,i,p[s+8],20,1163531501),i=y(i,u,h,a,p[s+13],5,-1444681467),a=y(a,i,u,h,p[s+2],9,-51403784),h=y(h,a,i,u,p[s+7],14,1735328473),u=y(u,h,a,i,p[s+12],20,-1926607734),i=m(i,u,h,a,p[s+5],4,-378558),a=m(a,i,u,h,p[s+8],11,-2022574463),h=m(h,a,i,u,p[s+11],16,1839030562),u=m(u,h,a,i,p[s+14],23,-35309556),i=m(i,u,h,a,p[s+1],4,-1530992060),a=m(a,i,u,h,p[s+4],11,1272893353),h=m(h,a,i,u,p[s+7],16,-155497632),u=m(u,h,a,i,p[s+10],23,-1094730640),i=m(i,u,h,a,p[s+13],4,681279174),a=m(a,i,u,h,p[s+0],11,-358537222),h=m(h,a,i,u,p[s+3],16,-722521979),u=m(u,h,a,i,p[s+6],23,76029189),i=m(i,u,h,a,p[s+9],4,-640364487),a=m(a,i,u,h,p[s+12],11,-421815835),h=m(h,a,i,u,p[s+15],16,530742520),u=m(u,h,a,i,p[s+2],23,-995338651),i=v(i,u,h,a,p[s+0],6,-198630844),a=v(a,i,u,h,p[s+7],10,1126891415),h=v(h,a,i,u,p[s+14],15,-1416354905),u=v(u,h,a,i,p[s+5],21,-57434055),i=v(i,u,h,a,p[s+12],6,1700485571),a=v(a,i,u,h,p[s+3],10,-1894986606),h=v(h,a,i,u,p[s+10],15,-1051523),u=v(u,h,a,i,p[s+1],21,-2054922799),i=v(i,u,h,a,p[s+8],6,1873313359),a=v(a,i,u,h,p[s+15],10,-30611744),h=v(h,a,i,u,p[s+6],15,-1560198380),u=v(u,h,a,i,p[s+13],21,1309151649),i=v(i,u,h,a,p[s+4],6,-145523070),a=v(a,i,u,h,p[s+11],10,-1120210379),h=v(h,a,i,u,p[s+2],15,718787259),u=v(u,h,a,i,p[s+9],21,-343485551),i=i+T>>>0,u=u+R>>>0,h=h+b>>>0,a=a+S>>>0}return t.endian([i,u,h,a])};o._ff=function(c,l,p,f,i,u,h){var a=c+(l&p|~l&f)+(i>>>0)+h;return(a<<u|a>>>32-u)+l},o._gg=function(c,l,p,f,i,u,h){var a=c+(l&f|p&~f)+(i>>>0)+h;return(a<<u|a>>>32-u)+l},o._hh=function(c,l,p,f,i,u,h){var a=c+(l^p^f)+(i>>>0)+h;return(a<<u|a>>>32-u)+l},o._ii=function(c,l,p,f,i,u,h){var a=c+(p^(l|~f))+(i>>>0)+h;return(a<<u|a>>>32-u)+l},o._blocksize=16,o._digestsize=16,lr.exports=function(c,l){if(c==null)throw new Error("Illegal argument "+c);var p=t.wordsToBytes(o(c,l));return l&&l.asBytes?p:l&&l.asString?n.bytesToString(p):t.bytesToHex(p)}})();var en=lr.exports;const tn=Kr(en);var fe=(t=>(t.BOOTSTRAP="bootstrap",t.DEBUG_EXTENSIONS="debugExtensions",t.DEBUG_QUEUE="debugQueue",t.DEBUG_DIALER="debugDialer",t.FULL="full",t))(fe||{}),ue=(t=>(t.MAIN="main",t.NEXT="next",t))(ue||{}),ie=(t=>(t.USER="User",t.TOKEN="Token",t))(ie||{});class Le{static async getSessionStorageDataByKey(e,r=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const n=await chrome.storage.session.get(e);if(n[e])return r?JSON.parse(n[e]):n[e]}if(typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.getItem=="function"){const n=window.sessionStorage.getItem(e);if(n)return r?JSON.parse(n):n}}static async updateSessionStorageKey(e,r){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[e]:JSON.stringify(r)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(e,JSON.stringify(r))}static clearSessionStorage(){typeof chrome<"u"&&typeof chrome.storage<"u"&&chrome.storage.session.clear(),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.clear=="function"&&window.sessionStorage.clear()}}class rn{constructor(e){J(this,"delay",1e3);J(this,"lastLoginTimestamp");J(this,"token");J(this,"refreshToken");J(this,"tokenExpiry");J(this,"storageKey");this.eventsSdkClass=e,this.eventsSdkClass=e,this.storageKey=""}async login(){const e={token:this.eventsSdkClass.options.token&&this.eventsSdkClass.options.token,email:this.eventsSdkClass.options.email&&this.eventsSdkClass.options.email,password:this.eventsSdkClass.options.password&&this.eventsSdkClass.options.password};if(this.storageKey=tn(JSON.stringify({...this.eventsSdkClass.options,loggerSocketConnection:null},this.eventsSdkClass.getCircularReplacer())),this.lastLoginTimestamp&&this.lastLoginTimestamp+this.delay>new Date().getTime())return;this.updateLastLoginTimestamp();const r=await this.checkLoginStatus(this.storageKey);return r||(Le.clearSessionStorage(),await this.userLoginFunction(e,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(e){const r=await Le.getSessionStorageDataByKey(e);if(r)return r}async userLoginFunction(e,r,n){let o,c,l;return this.eventsSdkClass.options.isNewStack?(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),c=await this.getSettings(o.Data.AccessToken),l={...o.Data,...c}):(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),l={...o.Data.Socket}),await Le.updateSessionStorageKey(r,l),l}onLoginResponse(e){if(!this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),e.MonitorList&&e.MonitorList.length&&(this.eventsSdkClass.servers=[...e.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length&&e.URLList&&(this.eventsSdkClass.URLList=e.URLList),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.URLList.length&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");if(this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");this.eventsSdkClass.server&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`),!this.eventsSdkClass.server&&this.eventsSdkClass.URLList.length&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${e.Version}`),e.IdentityCode&&(this.token=e.IdentityCode,this.eventsSdkClass.connect(ue.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(ue.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===ie.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===ie.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.TokenExpiry,this.handleTokenExpiry())}handleTokenExpiry(){if(!this.eventsSdkClass.options.refreshTokenUrl)throw new Error("refreshTokenUrl not provided");let e;if(this.tokenExpiry)e=new Date(this.tokenExpiry);else return;const r=e.getTime()-new Date().getTime()-5e3,n=Math.min(r,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let o,c;if(this.eventsSdkClass.options.isNewStack){const l=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);o=await this.getSettings(l.Data.AccessToken),c={...l.Data,...o}}else c={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(c),await Le.updateSessionStorageKey(this.storageKey,c)}},n)}async externalLogin(e,{password:r,token:n,email:o},c){if(!e)throw new Error("loginUrl not provided");let l;this.eventsSdkClass.options.isNewStack?c===ie.TOKEN?l=JSON.stringify({identityType:ie.TOKEN,token:n}):l=JSON.stringify({identityType:ie.USER,username:o,password:r}):this.eventsSdkClass.options.loginType===ie.TOKEN?(l=JSON.stringify({token:n}),e=`${e}/${ie.TOKEN}`):(l=JSON.stringify({email:o,pin:r}),e=`${e}/${ie.USER}`);let p;try{const f=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:l});if(!f.ok&&f.status===400)throw p=400,new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!f.ok&&f.status===401)throw p=401,new Error("Unauthorized. Invalid token provided");if(!f.ok&&f.status===403)throw p=403,new Error("Forbidden. Identity token not provided or not valid");const i=await f.json();if(i.error)throw new Error(i.error);return i}catch(f){throw this.eventsSdkClass.loggerClass.loginError(c,p,n,o),f}}async getSettings(e){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const r=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${e}`}});if(!r.ok&&r.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return r.json()}catch(r){throw this.eventsSdkClass.loggerClass.getSettingsError(e,r),r}}async externalRefreshToken(e,r){try{return(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}})).json()}catch(n){throw this.eventsSdkClass.loggerClass.refreshTokenError(r,e,n),n}}normalizeLoginType(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}}const nn={isNewStack:!1,loginUrl:"https://loginapi.voicenter.co.il/monitorAPI/Login",refreshTokenUrl:"https://loginapi.voicenter.co.il/monitorAPI/RefreshIdentityToken",forceNew:!0,reconnectionDelay:1e4,timeout:1e4,keepAliveTimeout:6e4,protocol:"https",useLogger:!0,loggerServer:"https://socketlog.voicenter.co",loggerConfig:{logToConsole:!0,overloadGlobalConsole:!1,system:"events-sdk",socketEmitInterval:1e4},loggerConnectOptions:{reconnection:!1,reconnectionDelay:5e3,reconnectionAttempts:10,perMessageDeflate:void 0,upgrade:!1,transports:["websocket"],debug:!1}};function on(){return typeof window<"u"&&(typeof window.navigator>"u"||typeof window.navigator.userAgent>"u")&&(window.navigator.userAgent="react-native"),typeof self>"u"&&typeof global=="object"&&(global.self=global,global.WebSocket=Vr,typeof self.navigator>"u"&&(self.navigator={userAgent:"node"})),function t(e,r,n){function o(p,f){if(!r[p]){if(!e[p]){var i=typeof require=="function"&&require;if(!f&&i)return i(p,!0);if(c)return c(p,!0);throw new Error("Cannot find module '"+p+"'")}var u=r[p]={exports:{}};e[p][0].call(u.exports,function(h){var a=e[p][1][h];return o(a||h)},u,u.exports,t,e,r,n)}return r[p].exports}for(var c=typeof require=="function"&&require,l=0;l<n.length;l++)o(n[l]);return o}({1:[function(t,e){e.exports=t("./lib/")},{"./lib/":2}],2:[function(t,e,r){function n(i,u){typeof i=="object"&&(u=i,i=void 0),u=u||{};var h,a=o(i),s=a.source,d=a.id;return u.forceNew||u["force new connection"]||u.multiplex===!1?(p("ignoring socket cache for %s",s),h=l(s,u)):(f[d]||(p("new io instance for %s",s),f[d]=l(s,u)),h=f[d]),h.socket(a.path)}var o=t("./url"),c=t("socket.io-parser"),l=t("./manager"),p=t("debug")("socket.io-client");e.exports=r=n;var f=r.managers={};r.protocol=c.protocol,r.connect=n,r.Manager=t("./manager"),r.Socket=t("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(t,e){function r(a,s){return this instanceof r?(a&&typeof a=="object"&&(s=a,a=void 0),s=s||{},s.path=s.path||"/socket.io",this.nsps={},this.subs=[],this.opts=s,this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor(s.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this.readyState="closed",this.uri=a,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new l.Encoder,this.decoder=new l.Decoder,this.autoConnect=s.autoConnect!==!1,void(this.autoConnect&&this.open())):new r(a,s)}var n=(t("./url"),t("engine.io-client")),o=t("./socket"),c=t("component-emitter"),l=t("socket.io-parser"),p=t("./on"),f=t("component-bind"),i=(t("object-component"),t("debug")("socket.io-client:manager")),u=t("indexof"),h=t("backo2");e.exports=r,r.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var a in this.nsps)this.nsps[a].emit.apply(this.nsps[a],arguments)},r.prototype.updateSocketIds=function(){for(var a in this.nsps)this.nsps[a].id=this.engine.id},c(r.prototype),r.prototype.reconnection=function(a){return arguments.length?(this._reconnection=!!a,this):this._reconnection},r.prototype.reconnectionAttempts=function(a){return arguments.length?(this._reconnectionAttempts=a,this):this._reconnectionAttempts},r.prototype.reconnectionDelay=function(a){return arguments.length?(this._reconnectionDelay=a,this.backoff&&this.backoff.setMin(a),this):this._reconnectionDelay},r.prototype.randomizationFactor=function(a){return arguments.length?(this._randomizationFactor=a,this.backoff&&this.backoff.setJitter(a),this):this._randomizationFactor},r.prototype.reconnectionDelayMax=function(a){return arguments.length?(this._reconnectionDelayMax=a,this.backoff&&this.backoff.setMax(a),this):this._reconnectionDelayMax},r.prototype.timeout=function(a){return arguments.length?(this._timeout=a,this):this._timeout},r.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},r.prototype.open=r.prototype.connect=function(a){if(i("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;i("opening %s",this.uri),this.engine=n(this.uri,this.opts);var s=this.engine,d=this;this.readyState="opening",this.skipReconnect=!1;var y=p(s,"open",function(){d.onopen(),a&&a()}),m=p(s,"error",function(R){if(i("connect_error"),d.cleanup(),d.readyState="closed",d.emitAll("connect_error",R),a){var b=new Error("Connection error");b.data=R,a(b)}else d.maybeReconnectOnOpen()});if(this._timeout!==!1){var v=this._timeout;i("connect attempt will timeout after %d",v);var T=setTimeout(function(){i("connect attempt timed out after %d",v),y.destroy(),s.close(),s.emit("error","timeout"),d.emitAll("connect_timeout",v)},v);this.subs.push({destroy:function(){clearTimeout(T)}})}return this.subs.push(y),this.subs.push(m),this},r.prototype.onopen=function(){i("open"),this.cleanup(),this.readyState="open",this.emit("open");var a=this.engine;this.subs.push(p(a,"data",f(this,"ondata"))),this.subs.push(p(this.decoder,"decoded",f(this,"ondecoded"))),this.subs.push(p(a,"error",f(this,"onerror"))),this.subs.push(p(a,"close",f(this,"onclose")))},r.prototype.ondata=function(a){this.decoder.add(a)},r.prototype.ondecoded=function(a){this.emit("packet",a)},r.prototype.onerror=function(a){i("error",a),this.emitAll("error",a)},r.prototype.socket=function(a){var s=this.nsps[a];if(!s){s=new o(this,a),this.nsps[a]=s;var d=this;s.on("connect",function(){s.id=d.engine.id,~u(d.connected,s)||d.connected.push(s)})}return s},r.prototype.destroy=function(a){var s=u(this.connected,a);~s&&this.connected.splice(s,1),this.connected.length||this.close()},r.prototype.packet=function(a){i("writing packet %j",a);var s=this;s.encoding?s.packetBuffer.push(a):(s.encoding=!0,this.encoder.encode(a,function(d){for(var y=0;y<d.length;y++)s.engine.write(d[y]);s.encoding=!1,s.processPacketQueue()}))},r.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var a=this.packetBuffer.shift();this.packet(a)}},r.prototype.cleanup=function(){for(var a;a=this.subs.shift();)a.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},r.prototype.close=r.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},r.prototype.onclose=function(a){i("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",a),this._reconnection&&!this.skipReconnect&&this.reconnect()},r.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var a=this;if(this.backoff.attempts>=this._reconnectionAttempts)i("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var s=this.backoff.duration();i("will wait %dms before reconnect attempt",s),this.reconnecting=!0;var d=setTimeout(function(){a.skipReconnect||(i("attempting reconnect"),a.emitAll("reconnect_attempt",a.backoff.attempts),a.emitAll("reconnecting",a.backoff.attempts),a.skipReconnect||a.open(function(y){y?(i("reconnect attempt error"),a.reconnecting=!1,a.reconnect(),a.emitAll("reconnect_error",y.data)):(i("reconnect success"),a.onreconnect())}))},s);this.subs.push({destroy:function(){clearTimeout(d)}})}},r.prototype.onreconnect=function(){var a=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",a)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:40,"object-component":41,"socket.io-parser":44}],4:[function(t,e){function r(n,o,c){return n.on(o,c),{destroy:function(){n.removeListener(o,c)}}}e.exports=r},{}],5:[function(t,e,r){function n(s,d){this.io=s,this.nsp=d,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var o=t("socket.io-parser"),c=t("component-emitter"),l=t("to-array"),p=t("./on"),f=t("component-bind"),i=t("debug")("socket.io-client:socket"),u=t("has-binary");e.exports=n;var h={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},a=c.prototype.emit;c(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var s=this.io;this.subs=[p(s,"open",f(this,"onopen")),p(s,"packet",f(this,"onpacket")),p(s,"close",f(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),this.io.readyState=="open"&&this.onopen(),this)},n.prototype.send=function(){var s=l(arguments);return s.unshift("message"),this.emit.apply(this,s),this},n.prototype.emit=function(s){if(h.hasOwnProperty(s))return a.apply(this,arguments),this;var d=l(arguments),y=o.EVENT;u(d)&&(y=o.BINARY_EVENT);var m={type:y,data:d};return typeof d[d.length-1]=="function"&&(i("emitting packet with ack id %d",this.ids),this.acks[this.ids]=d.pop(),m.id=this.ids++),this.connected?this.packet(m):this.sendBuffer.push(m),this},n.prototype.packet=function(s){s.nsp=this.nsp,this.io.packet(s)},n.prototype.onopen=function(){i("transport is open - connecting"),this.nsp!="/"&&this.packet({type:o.CONNECT})},n.prototype.onclose=function(s){i("close (%s)",s),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",s)},n.prototype.onpacket=function(s){if(s.nsp==this.nsp)switch(s.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(s);break;case o.BINARY_EVENT:this.onevent(s);break;case o.ACK:this.onack(s);break;case o.BINARY_ACK:this.onack(s);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",s.data)}},n.prototype.onevent=function(s){var d=s.data||[];i("emitting event %j",d),s.id!=null&&(i("attaching ack callback to event"),d.push(this.ack(s.id))),this.connected?a.apply(this,d):this.receiveBuffer.push(d)},n.prototype.ack=function(s){var d=this,y=!1;return function(){if(!y){y=!0;var m=l(arguments);i("sending ack %j",m);var v=u(m)?o.BINARY_ACK:o.ACK;d.packet({type:v,id:s,data:m})}}},n.prototype.onack=function(s){i("calling ack %s with %j",s.id,s.data);var d=this.acks[s.id];d.apply(this,s.data),delete this.acks[s.id]},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var s;for(s=0;s<this.receiveBuffer.length;s++)a.apply(this,this.receiveBuffer[s]);for(this.receiveBuffer=[],s=0;s<this.sendBuffer.length;s++)this.packet(this.sendBuffer[s]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){i("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var s=0;s<this.subs.length;s++)this.subs[s].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&(i("performing disconnect (%s)",this.nsp),this.packet({type:o.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}},{"./on":4,"component-bind":8,"component-emitter":9,debug:10,"has-binary":36,"socket.io-parser":44,"to-array":48}],6:[function(t,e){(function(r){function n(l,i){var f=l,i=i||r.location;return l==null&&(l=i.protocol+"//"+i.host),typeof l=="string"&&(l.charAt(0)=="/"&&(l=l.charAt(1)=="/"?i.protocol+l:i.hostname+l),/^(https?|wss?):\/\//.test(l)||(c("protocol-less url %s",l),l=typeof i<"u"?i.protocol+"//"+l:"https://"+l),c("parse %s",l),f=o(l)),f.port||(/^(http|ws)$/.test(f.protocol)?f.port="80":/^(http|ws)s$/.test(f.protocol)&&(f.port="443")),f.path=f.path||"/",f.id=f.protocol+"://"+f.host+":"+f.port,f.href=f.protocol+"://"+f.host+(i&&i.port==f.port?"":":"+f.port),f}var o=t("parseuri"),c=t("debug")("socket.io-client:url");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{debug:10,parseuri:42}],7:[function(t,e){function r(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}e.exports=r,r.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var o=Math.random(),c=Math.floor(o*this.jitter*n);n=1&Math.floor(10*o)?n+c:n-c}return 0|Math.min(n,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(n){this.ms=n},r.prototype.setMax=function(n){this.max=n},r.prototype.setJitter=function(n){this.jitter=n}},{}],8:[function(t,e){var r=[].slice;e.exports=function(n,o){if(typeof o=="string"&&(o=n[o]),typeof o!="function")throw new Error("bind() requires a function");var c=r.call(arguments,2);return function(){return o.apply(n,c.concat(r.call(arguments)))}}},{}],9:[function(t,e){function r(o){return o?n(o):void 0}function n(o){for(var c in r.prototype)o[c]=r.prototype[c];return o}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(o,c){return this._callbacks=this._callbacks||{},(this._callbacks[o]=this._callbacks[o]||[]).push(c),this},r.prototype.once=function(o,c){function l(){p.off(o,l),c.apply(this,arguments)}var p=this;return this._callbacks=this._callbacks||{},l.fn=c,this.on(o,l),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(o,c){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var l=this._callbacks[o];if(!l)return this;if(arguments.length==1)return delete this._callbacks[o],this;for(var p,f=0;f<l.length;f++)if(p=l[f],p===c||p.fn===c){l.splice(f,1);break}return this},r.prototype.emit=function(o){this._callbacks=this._callbacks||{};var c=[].slice.call(arguments,1),l=this._callbacks[o];if(l){l=l.slice(0);for(var p=0,f=l.length;f>p;++p)l[p].apply(this,c)}return this},r.prototype.listeners=function(o){return this._callbacks=this._callbacks||{},this._callbacks[o]||[]},r.prototype.hasListeners=function(o){return!!this.listeners(o).length}},{}],10:[function(t,e){function r(o){return r.enabled(o)?function(c){c=n(c);var l=new Date,p=l-(r[o]||l);r[o]=l,c=o+" "+c+" +"+r.humanize(p),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function n(o){return o instanceof Error?o.stack||o.message:o}e.exports=r,r.names=[],r.skips=[],r.enable=function(o){try{localStorage.debug=o}catch{}for(var c=(o||"").split(/[\s,]+/),l=c.length,p=0;l>p;p++)o=c[p].replace("*",".*?"),o[0]==="-"?r.skips.push(new RegExp("^"+o.substr(1)+"$")):r.names.push(new RegExp("^"+o+"$"))},r.disable=function(){r.enable("")},r.humanize=function(o){var c=1e3,l=6e4,p=60*l;return o>=p?(o/p).toFixed(1)+"h":o>=l?(o/l).toFixed(1)+"m":o>=c?(o/c|0)+"s":o+"ms"},r.enabled=function(o){for(var c=0,l=r.skips.length;l>c;c++)if(r.skips[c].test(o))return!1;for(var c=0,l=r.names.length;l>c;c++)if(r.names[c].test(o))return!0;return!1};try{window.localStorage&&r.enable(localStorage.debug)}catch{}},{}],11:[function(t,e){e.exports=t("./lib/")},{"./lib/":12}],12:[function(t,e){e.exports=t("./socket"),e.exports.parser=t("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(t,e){(function(r){function n(s,d){if(!(this instanceof n))return new n(s,d);if(d=d||{},s&&typeof s=="object"&&(d=s,s=null),s&&(s=u(s),d.host=s.host,d.secure=s.protocol=="https"||s.protocol=="wss",d.port=s.port,s.query&&(d.query=s.query)),this.secure=d.secure!=null?d.secure:r.location&&location.protocol=="https:",d.host){var y=d.host.split(":");d.hostname=y.shift(),y.length?d.port=y.pop():d.port||(d.port=this.secure?"443":"80")}this.agent=d.agent||!1,this.hostname=d.hostname||(r.location?location.hostname:"localhost"),this.port=d.port||(r.location&&location.port?location.port:this.secure?443:80),this.query=d.query||{},typeof this.query=="string"&&(this.query=a.decode(this.query)),this.upgrade=d.upgrade!==!1,this.path=(d.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!d.forceJSONP,this.jsonp=d.jsonp!==!1,this.forceBase64=!!d.forceBase64,this.enablesXDR=!!d.enablesXDR,this.timestampParam=d.timestampParam||"t",this.timestampRequests=d.timestampRequests,this.transports=d.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=d.policyPort||843,this.rememberUpgrade=d.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=d.onlyBinaryUpgrades,this.pfx=d.pfx||null,this.key=d.key||null,this.passphrase=d.passphrase||null,this.cert=d.cert||null,this.ca=d.ca||null,this.ciphers=d.ciphers||null,this.rejectUnauthorized=d.rejectUnauthorized||null,this.open()}function o(s){var d={};for(var y in s)s.hasOwnProperty(y)&&(d[y]=s[y]);return d}var c=t("./transports"),l=t("component-emitter"),p=t("debug")("engine.io-client:socket"),f=t("indexof"),i=t("engine.io-parser"),u=t("parseuri"),h=t("parsejson"),a=t("parseqs");e.exports=n,n.priorWebsocketSuccess=!1,l(n.prototype),n.protocol=i.protocol,n.Socket=n,n.Transport=t("./transport"),n.transports=t("./transports"),n.parser=t("engine.io-parser"),n.prototype.createTransport=function(s){p('creating transport "%s"',s);var d=o(this.query);d.EIO=i.protocol,d.transport=s,this.id&&(d.sid=this.id);var y=new c[s]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:d,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return y},n.prototype.open=function(){var d;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1)d="websocket";else{if(this.transports.length==0){var s=this;return void setTimeout(function(){s.emit("error","No transports available")},0)}d=this.transports[0]}this.readyState="opening";var d;try{d=this.createTransport(d)}catch{return this.transports.shift(),void this.open()}d.open(),this.setTransport(d)},n.prototype.setTransport=function(s){p("setting transport %s",s.name);var d=this;this.transport&&(p("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=s,s.on("drain",function(){d.onDrain()}).on("packet",function(y){d.onPacket(y)}).on("error",function(y){d.onError(y)}).on("close",function(){d.onClose("transport close")})},n.prototype.probe=function(s){function d(){if(w.onlyBinaryUpgrades){var E=!this.supportsBinary&&w.transport.supportsBinary;g=g||E}g||(p('probe transport "%s" opened',s),S.send([{type:"ping",data:"probe"}]),S.once("packet",function(C){if(!g)if(C.type=="pong"&&C.data=="probe"){if(p('probe transport "%s" pong',s),w.upgrading=!0,w.emit("upgrading",S),!S)return;n.priorWebsocketSuccess=S.name=="websocket",p('pausing current transport "%s"',w.transport.name),w.transport.pause(function(){g||w.readyState!="closed"&&(p("changing transport and sending upgrade packet"),b(),w.setTransport(S),S.send([{type:"upgrade"}]),w.emit("upgrade",S),S=null,w.upgrading=!1,w.flush())})}else{p('probe transport "%s" failed',s);var k=new Error("probe error");k.transport=S.name,w.emit("upgradeError",k)}}))}function y(){g||(g=!0,b(),S.close(),S=null)}function m(E){var C=new Error("probe error: "+E);C.transport=S.name,y(),p('probe transport "%s" failed because of error: %s',s,E),w.emit("upgradeError",C)}function v(){m("transport closed")}function T(){m("socket closed")}function R(E){S&&E.name!=S.name&&(p('"%s" works - aborting "%s"',E.name,S.name),y())}function b(){S.removeListener("open",d),S.removeListener("error",m),S.removeListener("close",v),w.removeListener("close",T),w.removeListener("upgrading",R)}p('probing transport "%s"',s);var S=this.createTransport(s,{probe:1}),g=!1,w=this;n.priorWebsocketSuccess=!1,S.once("open",d),S.once("error",m),S.once("close",v),this.once("close",T),this.once("upgrading",R),S.open()},n.prototype.onOpen=function(){if(p("socket open"),this.readyState="open",n.priorWebsocketSuccess=this.transport.name=="websocket",this.emit("open"),this.flush(),this.readyState=="open"&&this.upgrade&&this.transport.pause){p("starting upgrade probes");for(var s=0,d=this.upgrades.length;d>s;s++)this.probe(this.upgrades[s])}},n.prototype.onPacket=function(s){if(this.readyState=="opening"||this.readyState=="open")switch(p('socket receive: type "%s", data "%s"',s.type,s.data),this.emit("packet",s),this.emit("heartbeat"),s.type){case"open":this.onHandshake(h(s.data));break;case"pong":this.setPing();break;case"error":var d=new Error("server error");d.code=s.data,this.emit("error",d);break;case"message":this.emit("data",s.data),this.emit("message",s.data)}else p('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(s){this.emit("handshake",s),this.id=s.sid,this.transport.query.sid=s.sid,this.upgrades=this.filterUpgrades(s.upgrades),this.pingInterval=s.pingInterval,this.pingTimeout=s.pingTimeout,this.onOpen(),this.readyState!="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(s){clearTimeout(this.pingTimeoutTimer);var d=this;d.pingTimeoutTimer=setTimeout(function(){d.readyState!="closed"&&d.onClose("ping timeout")},s||d.pingInterval+d.pingTimeout)},n.prototype.setPing=function(){var s=this;clearTimeout(s.pingIntervalTimer),s.pingIntervalTimer=setTimeout(function(){p("writing ping packet - expecting pong within %sms",s.pingTimeout),s.ping(),s.onHeartbeat(s.pingTimeout)},s.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var s=0;s<this.prevBufferLen;s++)this.callbackBuffer[s]&&this.callbackBuffer[s]();this.writeBuffer.splice(0,this.prevBufferLen),this.callbackBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length==0?this.emit("drain"):this.flush()},n.prototype.flush=function(){this.readyState!="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(p("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(s,d){return this.sendPacket("message",s,d),this},n.prototype.sendPacket=function(s,d,y){if(this.readyState!="closing"&&this.readyState!="closed"){var m={type:s,data:d};this.emit("packetCreate",m),this.writeBuffer.push(m),this.callbackBuffer.push(y),this.flush()}},n.prototype.close=function(){function s(){m.onClose("forced close"),p("socket closing - telling transport to close"),m.transport.close()}function d(){m.removeListener("upgrade",d),m.removeListener("upgradeError",d),s()}function y(){m.once("upgrade",d),m.once("upgradeError",d)}if(this.readyState=="opening"||this.readyState=="open"){this.readyState="closing";var m=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?y():s()}):this.upgrading?y():s()}return this},n.prototype.onError=function(s){p("socket error %j",s),n.priorWebsocketSuccess=!1,this.emit("error",s),this.onClose("transport error",s)},n.prototype.onClose=function(s,d){if(this.readyState=="opening"||this.readyState=="open"||this.readyState=="closing"){p('socket close with reason: "%s"',s);var y=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){y.writeBuffer=[],y.callbackBuffer=[],y.prevBufferLen=0},0),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",s,d)}},n.prototype.filterUpgrades=function(s){for(var d=[],y=0,m=s.length;m>y;y++)~f(this.transports,s[y])&&d.push(s[y]);return d}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./transport":14,"./transports":15,"component-emitter":9,debug:22,"engine.io-parser":25,indexof:40,parsejson:32,parseqs:33,parseuri:34}],14:[function(t,e){function r(c){this.path=c.path,this.hostname=c.hostname,this.port=c.port,this.secure=c.secure,this.query=c.query,this.timestampParam=c.timestampParam,this.timestampRequests=c.timestampRequests,this.readyState="",this.agent=c.agent||!1,this.socket=c.socket,this.enablesXDR=c.enablesXDR,this.pfx=c.pfx,this.key=c.key,this.passphrase=c.passphrase,this.cert=c.cert,this.ca=c.ca,this.ciphers=c.ciphers,this.rejectUnauthorized=c.rejectUnauthorized}var n=t("engine.io-parser"),o=t("component-emitter");e.exports=r,o(r.prototype),r.timestamps=0,r.prototype.onError=function(c,l){var p=new Error(c);return p.type="TransportError",p.description=l,this.emit("error",p),this},r.prototype.open=function(){return(this.readyState=="closed"||this.readyState=="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState=="opening"||this.readyState=="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(c){if(this.readyState!="open")throw new Error("Transport not open");this.write(c)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(c){var l=n.decodePacket(c,this.socket.binaryType);this.onPacket(l)},r.prototype.onPacket=function(c){this.emit("packet",c)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(t,e,r){(function(n){function o(i){var u,h=!1,a=!1,s=i.jsonp!==!1;if(n.location){var d=location.protocol=="https:",y=location.port;y||(y=d?443:80),h=i.hostname!=location.hostname||y!=i.port,a=i.secure!=d}if(i.xdomain=h,i.xscheme=a,u=new c(i),"open"in u&&!i.forceJSONP)return new l(i);if(!s)throw new Error("JSONP disabled");return new p(i)}var c=t("xmlhttprequest"),l=t("./polling-xhr"),p=t("./polling-jsonp"),f=t("./websocket");r.polling=o,r.websocket=f}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(t,e){(function(r){function n(){}function o(u){c.call(this,u),this.query=this.query||{},p||(r.___eio||(r.___eio=[]),p=r.___eio),this.index=p.length;var h=this;p.push(function(a){h.onData(a)}),this.query.j=this.index,r.document&&r.addEventListener&&r.addEventListener("beforeunload",function(){h.script&&(h.script.onerror=n)},!1)}var c=t("./polling"),l=t("component-inherit");e.exports=o;var p,f=/\n/g,i=/\\n/g;l(o,c),o.prototype.supportsBinary=!1,o.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),c.prototype.doClose.call(this)},o.prototype.doPoll=function(){var u=this,h=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),h.async=!0,h.src=this.uri(),h.onerror=function(d){u.onError("jsonp poll error",d)};var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(h,a),this.script=h;var s=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);s&&setTimeout(function(){var d=document.createElement("iframe");document.body.appendChild(d),document.body.removeChild(d)},100)},o.prototype.doWrite=function(u,h){function a(){s(),h()}function s(){if(d.iframe)try{d.form.removeChild(d.iframe)}catch(b){d.onError("jsonp polling iframe removal error",b)}try{var R='<iframe src="javascript:0" name="'+d.iframeId+'">';y=document.createElement(R)}catch{y=document.createElement("iframe"),y.name=d.iframeId,y.src="javascript:0"}y.id=d.iframeId,d.form.appendChild(y),d.iframe=y}var d=this;if(!this.form){var y,m=document.createElement("form"),v=document.createElement("textarea"),T=this.iframeId="eio_iframe_"+this.index;m.className="socketio",m.style.position="absolute",m.style.top="-1000px",m.style.left="-1000px",m.target=T,m.method="POST",m.setAttribute("accept-charset","utf-8"),v.name="d",m.appendChild(v),document.body.appendChild(m),this.form=m,this.area=v}this.form.action=this.uri(),s(),u=u.replace(i,`\\
|
|
7
|
+
`),this.area.value=u.replace(f,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){d.iframe.readyState=="complete"&&a()}:this.iframe.onload=a}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(t,e){(function(r){function n(){}function o(a){if(f.call(this,a),r.location){var s=location.protocol=="https:",d=location.port;d||(d=s?443:80),this.xd=a.hostname!=r.location.hostname||d!=a.port,this.xs=a.secure!=s}}function c(a){this.method=a.method||"GET",this.uri=a.uri,this.xd=!!a.xd,this.xs=!!a.xs,this.async=a.async!==!1,this.data=a.data!=null?a.data:null,this.agent=a.agent,this.isBinary=a.isBinary,this.supportsBinary=a.supportsBinary,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.create()}function l(){for(var a in c.requests)c.requests.hasOwnProperty(a)&&c.requests[a].abort()}var p=t("xmlhttprequest"),f=t("./polling"),i=t("component-emitter"),u=t("component-inherit"),h=t("debug")("engine.io-client:polling-xhr");e.exports=o,e.exports.Request=c,u(o,f),o.prototype.supportsBinary=!0,o.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,new c(a)},o.prototype.doWrite=function(a,s){var d=typeof a!="string"&&a!==void 0,y=this.request({method:"POST",data:a,isBinary:d}),m=this;y.on("success",s),y.on("error",function(v){m.onError("xhr post error",v)}),this.sendXhr=y},o.prototype.doPoll=function(){h("xhr poll");var a=this.request(),s=this;a.on("data",function(d){s.onData(d)}),a.on("error",function(d){s.onError("xhr poll error",d)}),this.pollXhr=a},i(c.prototype),c.prototype.create=function(){var a={agent:this.agent,xdomain:this.xd,xscheme:this.xs,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;var s=this.xhr=new p(a),d=this;try{if(h("xhr open %s: %s",this.method,this.uri),s.open(this.method,this.uri,this.async),this.supportsBinary&&(s.responseType="arraybuffer"),this.method=="POST")try{this.isBinary?s.setRequestHeader("Content-type","application/octet-stream"):s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}"withCredentials"in s&&(s.withCredentials=!0),this.hasXDR()?(s.onload=function(){d.onLoad()},s.onerror=function(){d.onError(s.responseText)}):s.onreadystatechange=function(){s.readyState==4&&(s.status==200||s.status==1223?d.onLoad():setTimeout(function(){d.onError(s.status)},0))},h("xhr data %s",this.data),s.send(this.data)}catch(y){return void setTimeout(function(){d.onError(y)},0)}r.document&&(this.index=c.requestsCount++,c.requests[this.index]=this)},c.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},c.prototype.onData=function(a){this.emit("data",a),this.onSuccess()},c.prototype.onError=function(a){this.emit("error",a),this.cleanup(!0)},c.prototype.cleanup=function(a){if(typeof this.xhr<"u"&&this.xhr!==null){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,a)try{this.xhr.abort()}catch{}r.document&&delete c.requests[this.index],this.xhr=null}},c.prototype.onLoad=function(){var a;try{var s;try{s=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch{}a=s==="application/octet-stream"?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(d){this.onError(d)}a!=null&&this.onData(a)},c.prototype.hasXDR=function(){return typeof r.XDomainRequest<"u"&&!this.xs&&this.enablesXDR},c.prototype.abort=function(){this.cleanup()},r.document&&(c.requestsCount=0,c.requests={},r.attachEvent?r.attachEvent("onunload",l):r.addEventListener&&r.addEventListener("beforeunload",l,!1))}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-emitter":9,"component-inherit":21,debug:22,xmlhttprequest:20}],18:[function(t,e){function r(i){var u=i&&i.forceBase64;(!f||u)&&(this.supportsBinary=!1),n.call(this,i)}var n=t("../transport"),o=t("parseqs"),c=t("engine.io-parser"),l=t("component-inherit"),p=t("debug")("engine.io-client:polling");e.exports=r;var f=function(){var i=t("xmlhttprequest"),u=new i({xdomain:!1});return u.responseType!=null}();l(r,n),r.prototype.name="polling",r.prototype.doOpen=function(){this.poll()},r.prototype.pause=function(i){function u(){p("paused"),h.readyState="paused",i()}var h=this;if(this.readyState="pausing",this.polling||!this.writable){var a=0;this.polling&&(p("we are currently polling - waiting to pause"),a++,this.once("pollComplete",function(){p("pre-pause polling complete"),--a||u()})),this.writable||(p("we are currently writing - waiting to pause"),a++,this.once("drain",function(){p("pre-pause writing complete"),--a||u()}))}else u()},r.prototype.poll=function(){p("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},r.prototype.onData=function(i){var u=this;p("polling got data %s",i);var h=function(a){return u.readyState=="opening"&&u.onOpen(),a.type=="close"?(u.onClose(),!1):void u.onPacket(a)};c.decodePayload(i,this.socket.binaryType,h),this.readyState!="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState=="open"?this.poll():p('ignoring poll - transport state "%s"',this.readyState))},r.prototype.doClose=function(){function i(){p("writing close packet"),u.write([{type:"close"}])}var u=this;this.readyState=="open"?(p("transport open - closing"),i()):(p("transport not open - deferring close"),this.once("open",i))},r.prototype.write=function(i){var h=this;this.writable=!1;var u=function(){h.writable=!0,h.emit("drain")},h=this;c.encodePayload(i,this.supportsBinary,function(a){h.doWrite(a,u)})},r.prototype.uri=function(){var i=this.query||{},u=this.secure?"https":"http",h="";return this.timestampRequests!==!1&&(i[this.timestampParam]=+new Date+"-"+n.timestamps++),this.supportsBinary||i.sid||(i.b64=1),i=o.encode(i),this.port&&(u=="https"&&this.port!=443||u=="http"&&this.port!=80)&&(h=":"+this.port),i.length&&(i="?"+i),u+"://"+this.hostname+h+this.path+i}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(t,e){function r(i){var u=i&&i.forceBase64;u&&(this.supportsBinary=!1),n.call(this,i)}var n=t("../transport"),o=t("engine.io-parser"),c=t("parseqs"),l=t("component-inherit"),p=t("debug")("engine.io-client:websocket"),f=t("ws");e.exports=r,l(r,n),r.prototype.name="websocket",r.prototype.supportsBinary=!0,r.prototype.doOpen=function(){if(this.check()){var i=this.uri(),u=void 0,h={agent:this.agent};h.pfx=this.pfx,h.key=this.key,h.passphrase=this.passphrase,h.cert=this.cert,h.ca=this.ca,h.ciphers=this.ciphers,h.rejectUnauthorized=this.rejectUnauthorized,this.ws=new f(i,u,h),this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},r.prototype.addEventListeners=function(){var i=this;this.ws.onopen=function(){i.onOpen()},this.ws.onclose=function(){i.onClose()},this.ws.onmessage=function(u){i.onData(u.data)},this.ws.onerror=function(u){i.onError("websocket error",u)}},typeof navigator<"u"&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(r.prototype.onData=function(i){var u=this;setTimeout(function(){n.prototype.onData.call(u,i)},0)}),r.prototype.write=function(i){function u(){h.writable=!0,h.emit("drain")}var h=this;this.writable=!1;for(var a=0,s=i.length;s>a;a++)o.encodePacket(i[a],this.supportsBinary,function(d){try{h.ws.send(d)}catch{p("websocket closed before onclose event")}});setTimeout(u,0)},r.prototype.onClose=function(){n.prototype.onClose.call(this)},r.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},r.prototype.uri=function(){var i=this.query||{},u=this.secure?"wss":"ws",h="";return this.port&&(u=="wss"&&this.port!=443||u=="ws"&&this.port!=80)&&(h=":"+this.port),this.timestampRequests&&(i[this.timestampParam]=+new Date),this.supportsBinary||(i.b64=1),i=c.encode(i),i.length&&(i="?"+i),u+"://"+this.hostname+h+this.path+i},r.prototype.check=function(){return!(!f||"__initialize"in f&&this.name===r.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(t,e){var r=t("has-cors");e.exports=function(n){var o=n.xdomain,c=n.xscheme,l=n.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!o||r))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!c&&l)return new XDomainRequest}catch{}if(!o)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}}},{"has-cors":38}],21:[function(t,e){e.exports=function(r,n){var o=function(){};o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r}},{}],22:[function(t,e,r){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var f=arguments,i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+r.humanize(this.diff),!i)return f;var u="color: "+this.color;f=[f[0],u,"color: inherit"].concat(Array.prototype.slice.call(f,1));var h=0,a=0;return f[0].replace(/%[a-z%]/g,function(s){s!=="%%"&&(h++,s==="%c"&&(a=h))}),f.splice(a,0,u),f}function c(){return typeof console=="object"&&typeof console.log=="function"&&Function.prototype.apply.call(console.log,console,arguments)}function l(f){try{f==null?localStorage.removeItem("debug"):localStorage.debug=f}catch{}}function p(){var f;try{f=localStorage.debug}catch{}return f}r=e.exports=t("./debug"),r.log=c,r.formatArgs=o,r.save=l,r.load=p,r.useColors=n,r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(f){return JSON.stringify(f)},r.enable(p())},{"./debug":23}],23:[function(t,e,r){function n(){return r.colors[u++%r.colors.length]}function o(h){function a(){}function s(){var y=s,m=+new Date,v=m-(i||m);y.diff=v,y.prev=i,y.curr=m,i=m,y.useColors==null&&(y.useColors=r.useColors()),y.color==null&&y.useColors&&(y.color=n());var T=Array.prototype.slice.call(arguments);T[0]=r.coerce(T[0]),typeof T[0]!="string"&&(T=["%o"].concat(T));var R=0;T[0]=T[0].replace(/%([a-z%])/g,function(S,g){if(S==="%%")return S;R++;var w=r.formatters[g];if(typeof w=="function"){var E=T[R];S=w.call(y,E),T.splice(R,1),R--}return S}),typeof r.formatArgs=="function"&&(T=r.formatArgs.apply(y,T));var b=s.log||r.log||console.log.bind(console);b.apply(y,T)}a.enabled=!1,s.enabled=!0;var d=r.enabled(h)?s:a;return d.namespace=h,d}function c(h){r.save(h);for(var a=(h||"").split(/[\s,]+/),s=a.length,d=0;s>d;d++)a[d]&&(h=a[d].replace(/\*/g,".*?"),h[0]==="-"?r.skips.push(new RegExp("^"+h.substr(1)+"$")):r.names.push(new RegExp("^"+h+"$")))}function l(){r.enable("")}function p(h){var a,s;for(a=0,s=r.skips.length;s>a;a++)if(r.skips[a].test(h))return!1;for(a=0,s=r.names.length;s>a;a++)if(r.names[a].test(h))return!0;return!1}function f(h){return h instanceof Error?h.stack||h.message:h}r=e.exports=o,r.coerce=f,r.disable=l,r.enable=c,r.enabled=p,r.humanize=t("ms"),r.names=[],r.skips=[],r.formatters={};var i,u=0},{ms:24}],24:[function(t,e){function r(h){var a=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(h);if(a){var s=parseFloat(a[1]),d=(a[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"y":return s*u;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"h":return s*f;case"minutes":case"minute":case"m":return s*p;case"seconds":case"second":case"s":return s*l;case"ms":return s}}}function n(h){return h>=i?Math.round(h/i)+"d":h>=f?Math.round(h/f)+"h":h>=p?Math.round(h/p)+"m":h>=l?Math.round(h/l)+"s":h+"ms"}function o(h){return c(h,i,"day")||c(h,f,"hour")||c(h,p,"minute")||c(h,l,"second")||h+" ms"}function c(h,a,s){return a>h?void 0:1.5*a>h?Math.floor(h/a)+" "+s:Math.ceil(h/a)+" "+s+"s"}var l=1e3,p=60*l,f=60*p,i=24*f,u=365.25*i;e.exports=function(h,a){return a=a||{},typeof h=="string"?r(h):a.long?o(h):n(h)}},{}],25:[function(t,e,r){(function(n){function o(g,w){var E="b"+r.packets[g.type]+g.data.data;return w(E)}function c(g,w,E){if(!w)return r.encodeBase64Packet(g,E);var C=g.data,k=new Uint8Array(C),N=new Uint8Array(1+C.byteLength);N[0]=T[g.type];for(var x=0;x<k.length;x++)N[x+1]=k[x];return E(N.buffer)}function l(g,w,E){if(!w)return r.encodeBase64Packet(g,E);var C=new FileReader;return C.onload=function(){g.data=C.result,r.encodePacket(g,w,!0,E)},C.readAsArrayBuffer(g.data)}function p(g,w,E){if(!w)return r.encodeBase64Packet(g,E);if(v)return l(g,w,E);var C=new Uint8Array(1);C[0]=T[g.type];var k=new S([C.buffer,g.data]);return E(k)}function f(g,w,E){for(var C=new Array(g.length),k=s(g.length,E),N=function(L,A,z){w(A,function(M,K){C[L]=K,z(M,C)})},x=0;x<g.length;x++)N(x,g[x],k)}var i=t("./keys"),u=t("has-binary"),h=t("arraybuffer.slice"),a=t("base64-arraybuffer"),s=t("after"),d=t("utf8"),y=navigator.userAgent.match(/Android/i),m=/PhantomJS/i.test(navigator.userAgent),v=y||m;r.protocol=3;var T=r.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},R=i(T),b={type:"error",data:"parser error"},S=t("blob");r.encodePacket=function(g,w,E,C){typeof w=="function"&&(C=w,w=!1),typeof E=="function"&&(C=E,E=null);var k=g.data===void 0?void 0:g.data.buffer||g.data;if(n.ArrayBuffer&&k instanceof ArrayBuffer)return c(g,w,C);if(S&&k instanceof n.Blob)return p(g,w,C);if(k&&k.base64)return o(g,C);var N=T[g.type];return g.data!==void 0&&(N+=E?d.encode(String(g.data)):String(g.data)),C(""+N)},r.encodeBase64Packet=function(g,w){var E="b"+r.packets[g.type];if(S&&g.data instanceof S){var C=new FileReader;return C.onload=function(){var A=C.result.split(",")[1];w(E+A)},C.readAsDataURL(g.data)}var k;try{k=String.fromCharCode.apply(null,new Uint8Array(g.data))}catch{for(var N=new Uint8Array(g.data),x=new Array(N.length),L=0;L<N.length;L++)x[L]=N[L];k=String.fromCharCode.apply(null,x)}return E+=n.btoa(k),w(E)},r.decodePacket=function(g,w,E){if(typeof g=="string"||g===void 0){if(g.charAt(0)=="b")return r.decodeBase64Packet(g.substr(1),w);if(E)try{g=d.decode(g)}catch{return b}var k=g.charAt(0);return Number(k)==k&&R[k]?g.length>1?{type:R[k],data:g.substring(1)}:{type:R[k]}:b}var C=new Uint8Array(g),k=C[0],N=h(g,1);return S&&w==="blob"&&(N=new S([N])),{type:R[k],data:N}},r.decodeBase64Packet=function(g,w){var E=R[g.charAt(0)];if(!n.ArrayBuffer)return{type:E,data:{base64:!0,data:g.substr(1)}};var C=a.decode(g.substr(1));return w==="blob"&&S&&(C=new S([C])),{type:E,data:C}},r.encodePayload=function(g,w,E){function C(x){return x.length+":"+x}function k(x,L){r.encodePacket(x,N?w:!1,!0,function(A){L(null,C(A))})}typeof w=="function"&&(E=w,w=null);var N=u(g);return w&&N?S&&!v?r.encodePayloadAsBlob(g,E):r.encodePayloadAsArrayBuffer(g,E):g.length?void f(g,k,function(x,L){return E(L.join(""))}):E("0:")},r.decodePayload=function(g,w,E){if(typeof g!="string")return r.decodePayloadAsBinary(g,w,E);typeof w=="function"&&(E=w,w=null);var C;if(g=="")return E(b,0,1);for(var k,N,x="",L=0,A=g.length;A>L;L++){var z=g.charAt(L);if(z!=":")x+=z;else{if(x==""||x!=(k=Number(x))||(N=g.substr(L+1,k),x!=N.length))return E(b,0,1);if(N.length){if(C=r.decodePacket(N,w,!0),b.type==C.type&&b.data==C.data)return E(b,0,1);var M=E(C,L+k,A);if(M===!1)return}L+=k,x=""}}return x!=""?E(b,0,1):void 0},r.encodePayloadAsArrayBuffer=function(g,w){function E(C,k){r.encodePacket(C,!0,!0,function(N){return k(null,N)})}return g.length?void f(g,E,function(C,k){var N=k.reduce(function(A,z){var M;return M=typeof z=="string"?z.length:z.byteLength,A+M.toString().length+M+2},0),x=new Uint8Array(N),L=0;return k.forEach(function(A){var z=typeof A=="string",M=A;if(z){for(var K=new Uint8Array(A.length),X=0;X<A.length;X++)K[X]=A.charCodeAt(X);M=K.buffer}x[L++]=z?0:1;for(var te=M.byteLength.toString(),X=0;X<te.length;X++)x[L++]=parseInt(te[X]);x[L++]=255;for(var K=new Uint8Array(M),X=0;X<K.length;X++)x[L++]=K[X]}),w(x.buffer)}):w(new ArrayBuffer(0))},r.encodePayloadAsBlob=function(g,w){function E(C,k){r.encodePacket(C,!0,!0,function(N){var x=new Uint8Array(1);if(x[0]=1,typeof N=="string"){for(var L=new Uint8Array(N.length),A=0;A<N.length;A++)L[A]=N.charCodeAt(A);N=L.buffer,x[0]=0}for(var z=N instanceof ArrayBuffer?N.byteLength:N.size,M=z.toString(),K=new Uint8Array(M.length+1),A=0;A<M.length;A++)K[A]=parseInt(M[A]);if(K[M.length]=255,S){var X=new S([x.buffer,K.buffer,N]);k(null,X)}})}f(g,E,function(C,k){return w(new S(k))})},r.decodePayloadAsBinary=function(g,w,E){typeof w=="function"&&(E=w,w=null);for(var C=g,k=[],N=!1;C.byteLength>0;){for(var x=new Uint8Array(C),L=x[0]===0,A="",z=1;x[z]!=255;z++){if(A.length>310){N=!0;break}A+=x[z]}if(N)return E(b,0,1);C=h(C,2+A.length),A=parseInt(A);var M=h(C,0,A);if(L)try{M=String.fromCharCode.apply(null,new Uint8Array(M))}catch{var K=new Uint8Array(M);M="";for(var z=0;z<K.length;z++)M+=String.fromCharCode(K[z])}k.push(M),C=h(C,A)}var X=k.length;k.forEach(function(te,Oe){E(r.decodePacket(te,w,!0),Oe,X)})}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./keys":26,after:27,"arraybuffer.slice":28,"base64-arraybuffer":29,blob:30,"has-binary":36,utf8:31}],26:[function(t,e){e.exports=Object.keys||function(r){var n=[],o=Object.prototype.hasOwnProperty;for(var c in r)o.call(r,c)&&n.push(c);return n}},{}],27:[function(t,e){function r(o,c,l){function p(i,u){if(p.count<=0)throw new Error("after called too many times");--p.count,i?(f=!0,c(i),c=l):p.count!==0||f||c(null,u)}var f=!1;return l=l||n,p.count=o,o===0?c():p}function n(){}e.exports=r},{}],28:[function(t,e){e.exports=function(r,n,o){var c=r.byteLength;if(n=n||0,o=o||c,r.slice)return r.slice(n,o);if(0>n&&(n+=c),0>o&&(o+=c),o>c&&(o=c),n>=c||n>=o||c===0)return new ArrayBuffer(0);for(var l=new Uint8Array(r),p=new Uint8Array(o-n),f=n,i=0;o>f;f++,i++)p[i]=l[f];return p.buffer}},{}],29:[function(t,e,r){(function(n){r.encode=function(o){var c,l=new Uint8Array(o),p=l.length,f="";for(c=0;p>c;c+=3)f+=n[l[c]>>2],f+=n[(3&l[c])<<4|l[c+1]>>4],f+=n[(15&l[c+1])<<2|l[c+2]>>6],f+=n[63&l[c+2]];return p%3===2?f=f.substring(0,f.length-1)+"=":p%3===1&&(f=f.substring(0,f.length-2)+"=="),f},r.decode=function(o){var c,l,p,f,i,u=.75*o.length,h=o.length,a=0;o[o.length-1]==="="&&(u--,o[o.length-2]==="="&&u--);var s=new ArrayBuffer(u),d=new Uint8Array(s);for(c=0;h>c;c+=4)l=n.indexOf(o[c]),p=n.indexOf(o[c+1]),f=n.indexOf(o[c+2]),i=n.indexOf(o[c+3]),d[a++]=l<<2|p>>4,d[a++]=(15&p)<<4|f>>2,d[a++]=(3&f)<<6|63&i;return s}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(t,e){(function(r){function n(u){for(var h=0;h<u.length;h++){var a=u[h];if(a.buffer instanceof ArrayBuffer){var s=a.buffer;if(a.byteLength!==s.byteLength){var d=new Uint8Array(a.byteLength);d.set(new Uint8Array(s,a.byteOffset,a.byteLength)),s=d.buffer}u[h]=s}}}function o(u,h){h=h||{};var a=new l;n(u);for(var s=0;s<u.length;s++)a.append(u[s]);return h.type?a.getBlob(h.type):a.getBlob()}function c(u,h){return n(u),new Blob(u,h||{})}var l=r.BlobBuilder||r.WebKitBlobBuilder||r.MSBlobBuilder||r.MozBlobBuilder,p=function(){try{var u=new Blob(["hi"]);return u.size===2}catch{return!1}}(),f=p&&function(){try{var u=new Blob([new Uint8Array([1,2])]);return u.size===2}catch{return!1}}(),i=l&&l.prototype.append&&l.prototype.getBlob;e.exports=function(){return p?f?r.Blob:c:i?o:void 0}()}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],31:[function(t,e,r){(function(n){(function(o){function c(C){for(var k,N,x=[],L=0,A=C.length;A>L;)k=C.charCodeAt(L++),k>=55296&&56319>=k&&A>L?(N=C.charCodeAt(L++),(64512&N)==56320?x.push(((1023&k)<<10)+(1023&N)+65536):(x.push(k),L--)):x.push(k);return x}function l(C){for(var k,N=C.length,x=-1,L="";++x<N;)k=C[x],k>65535&&(k-=65536,L+=b(k>>>10&1023|55296),k=56320|1023&k),L+=b(k);return L}function p(C){if(C>=55296&&57343>=C)throw Error("Lone surrogate U+"+C.toString(16).toUpperCase()+" is not a scalar value")}function f(C,k){return b(C>>k&63|128)}function i(C){if(!(4294967168&C))return b(C);var k="";return 4294965248&C?4294901760&C?!(4292870144&C)&&(k=b(C>>18&7|240),k+=f(C,12),k+=f(C,6)):(p(C),k=b(C>>12&15|224),k+=f(C,6)):k=b(C>>6&31|192),k+=b(63&C|128)}function u(C){for(var k,N=c(C),x=N.length,L=-1,A="";++L<x;)k=N[L],A+=i(k);return A}function h(){if(R>=T)throw Error("Invalid byte index");var C=255&v[R];if(R++,(192&C)==128)return 63&C;throw Error("Invalid continuation byte")}function a(){var C,k,N,x,L;if(R>T)throw Error("Invalid byte index");if(R==T)return!1;if(C=255&v[R],R++,(128&C)==0)return C;if((224&C)==192){var k=h();if(L=(31&C)<<6|k,L>=128)return L;throw Error("Invalid continuation byte")}if((240&C)==224){if(k=h(),N=h(),L=(15&C)<<12|k<<6|N,L>=2048)return p(L),L;throw Error("Invalid continuation byte")}if((248&C)==240&&(k=h(),N=h(),x=h(),L=(15&C)<<18|k<<12|N<<6|x,L>=65536&&1114111>=L))return L;throw Error("Invalid UTF-8 detected")}function s(C){v=c(C),T=v.length,R=0;for(var k,N=[];(k=a())!==!1;)N.push(k);return l(N)}var d=typeof r=="object"&&r,y=typeof e=="object"&&e&&e.exports==d&&e,m=typeof n=="object"&&n;(m.global===m||m.window===m)&&(o=m);var v,T,R,b=String.fromCharCode,S={version:"2.0.0",encode:u,decode:s};if(d&&!d.nodeType)if(y)y.exports=S;else{var g={},w=g.hasOwnProperty;for(var E in S)w.call(S,E)&&(d[E]=S[E])}else o.utf8=S})(this)}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],32:[function(t,e){(function(r){var n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,c=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,l=/(?:^|:|,)(?:\s*\[)+/g,p=/^\s+/,f=/\s+$/;e.exports=function(i){return typeof i=="string"&&i?(i=i.replace(p,"").replace(f,""),r.JSON&&JSON.parse?JSON.parse(i):n.test(i.replace(o,"@").replace(c,"]").replace(l,""))?new Function("return "+i)():void 0):null}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],33:[function(t,e,r){r.encode=function(n){var o="";for(var c in n)n.hasOwnProperty(c)&&(o.length&&(o+="&"),o+=encodeURIComponent(c)+"="+encodeURIComponent(n[c]));return o},r.decode=function(n){for(var o={},c=n.split("&"),l=0,p=c.length;p>l;l++){var f=c[l].split("=");o[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return o}},{}],34:[function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(o){var c=o,l=o.indexOf("["),p=o.indexOf("]");l!=-1&&p!=-1&&(o=o.substring(0,l)+o.substring(l,p).replace(/:/g,";")+o.substring(p,o.length));for(var f=r.exec(o||""),i={},u=14;u--;)i[n[u]]=f[u]||"";return l!=-1&&p!=-1&&(i.source=c,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i}},{}],35:[function(t,e){function r(c,l){return l?new o(c,l):new o(c)}var n=function(){return self}(),o=n.WebSocket||n.MozWebSocket;e.exports=o?r:null,o&&(r.prototype=o.prototype)},{}],36:[function(t,e){(function(r){function n(c){function l(p){if(!p)return!1;if(r.Buffer&&r.Buffer.isBuffer(p)||r.ArrayBuffer&&p instanceof ArrayBuffer||r.Blob&&p instanceof Blob||r.File&&p instanceof File)return!0;if(o(p)){for(var f=0;f<p.length;f++)if(l(p[f]))return!0}else if(p&&typeof p=="object"){p.toJSON&&(p=p.toJSON());for(var i in p)if(Object.prototype.hasOwnProperty.call(p,i)&&l(p[i]))return!0}return!1}return l(c)}var o=t("isarray");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{isarray:37}],37:[function(t,e){e.exports=Array.isArray||function(r){return Object.prototype.toString.call(r)=="[object Array]"}},{}],38:[function(t,e){var r=t("global");try{e.exports="XMLHttpRequest"in r&&"withCredentials"in new r.XMLHttpRequest}catch{e.exports=!1}},{global:39}],39:[function(t,e){e.exports=function(){return this}()},{}],40:[function(t,e){var r=[].indexOf;e.exports=function(n,o){if(r)return n.indexOf(o);for(var c=0;c<n.length;++c)if(n[c]===o)return c;return-1}},{}],41:[function(t,e,r){var n=Object.prototype.hasOwnProperty;r.keys=Object.keys||function(o){var c=[];for(var l in o)n.call(o,l)&&c.push(l);return c},r.values=function(o){var c=[];for(var l in o)n.call(o,l)&&c.push(o[l]);return c},r.merge=function(o,c){for(var l in c)n.call(c,l)&&(o[l]=c[l]);return o},r.length=function(o){return r.keys(o).length},r.isEmpty=function(o){return r.length(o)==0}},{}],42:[function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(o){for(var c=r.exec(o||""),l={},p=14;p--;)l[n[p]]=c[p]||"";return l}},{}],43:[function(t,e,r){(function(n){var o=t("isarray"),c=t("./is-buffer");r.deconstructPacket=function(l){function p(h){if(!h)return h;if(c(h)){var a={_placeholder:!0,num:f.length};return f.push(h),a}if(o(h)){for(var s=new Array(h.length),d=0;d<h.length;d++)s[d]=p(h[d]);return s}if(typeof h=="object"&&!(h instanceof Date)){var s={};for(var y in h)s[y]=p(h[y]);return s}return h}var f=[],i=l.data,u=l;return u.data=p(i),u.attachments=f.length,{packet:u,buffers:f}},r.reconstructPacket=function(l,p){function f(i){if(i&&i._placeholder){var u=p[i.num];return u}if(o(i)){for(var h=0;h<i.length;h++)i[h]=f(i[h]);return i}if(i&&typeof i=="object"){for(var a in i)i[a]=f(i[a]);return i}return i}return l.data=f(l.data),l.attachments=void 0,l},r.removeBlobs=function(l,p){function f(h,a,s){if(!h)return h;if(n.Blob&&h instanceof Blob||n.File&&h instanceof File){i++;var d=new FileReader;d.onload=function(){s?s[a]=this.result:u=this.result,--i||p(u)},d.readAsArrayBuffer(h)}else if(o(h))for(var y=0;y<h.length;y++)f(h[y],y,h);else if(h&&typeof h=="object"&&!c(h))for(var m in h)f(h[m],m,h)}var i=0,u=l;f(u),i||p(u)}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(t,e,r){function n(){}function o(y){var m="",v=!1;return m+=y.type,(r.BINARY_EVENT==y.type||r.BINARY_ACK==y.type)&&(m+=y.attachments,m+="-"),y.nsp&&y.nsp!="/"&&(v=!0,m+=y.nsp),y.id!=null&&(v&&(m+=",",v=!1),m+=y.id),y.data!=null&&(v&&(m+=","),m+=h.stringify(y.data)),u("encoded %j as %s",y,m),m}function c(y,m){function v(T){var R=s.deconstructPacket(T),b=o(R.packet),S=R.buffers;S.unshift(b),m(S)}s.removeBlobs(y,v)}function l(){this.reconstructor=null}function p(y){var m={},v=0;if(m.type=Number(y.charAt(0)),r.types[m.type]==null)return i();if(r.BINARY_EVENT==m.type||r.BINARY_ACK==m.type){for(var T="";y.charAt(++v)!="-"&&(T+=y.charAt(v),v!=y.length););if(T!=Number(T)||y.charAt(v)!="-")throw new Error("Illegal attachments");m.attachments=Number(T)}if(y.charAt(v+1)=="/")for(m.nsp="";++v;){var R=y.charAt(v);if(R==","||(m.nsp+=R,v==y.length))break}else m.nsp="/";var b=y.charAt(v+1);if(b!==""&&Number(b)==b){for(m.id="";++v;){var R=y.charAt(v);if(R==null||Number(R)!=R){--v;break}if(m.id+=y.charAt(v),v==y.length)break}m.id=Number(m.id)}if(y.charAt(++v))try{m.data=h.parse(y.substr(v))}catch{return i()}return u("decoded %s as %j",y,m),m}function f(y){this.reconPack=y,this.buffers=[]}function i(){return{type:r.ERROR,data:"parser error"}}var u=t("debug")("socket.io-parser"),h=t("json3"),a=(t("isarray"),t("component-emitter")),s=t("./binary"),d=t("./is-buffer");r.protocol=4,r.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],r.CONNECT=0,r.DISCONNECT=1,r.EVENT=2,r.ACK=3,r.ERROR=4,r.BINARY_EVENT=5,r.BINARY_ACK=6,r.Encoder=n,r.Decoder=l,n.prototype.encode=function(y,m){if(u("encoding packet %j",y),r.BINARY_EVENT==y.type||r.BINARY_ACK==y.type)c(y,m);else{var v=o(y);m([v])}},a(l.prototype),l.prototype.add=function(y){var m;if(typeof y=="string")m=p(y),r.BINARY_EVENT==m.type||r.BINARY_ACK==m.type?(this.reconstructor=new f(m),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",m)):this.emit("decoded",m);else{if(!d(y)&&!y.base64)throw new Error("Unknown type: "+y);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");m=this.reconstructor.takeBinaryData(y),m&&(this.reconstructor=null,this.emit("decoded",m))}},l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},f.prototype.takeBinaryData=function(y){if(this.buffers.push(y),this.buffers.length==this.reconPack.attachments){var m=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),m}return null},f.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},{"./binary":43,"./is-buffer":45,"component-emitter":9,debug:10,isarray:46,json3:47}],45:[function(t,e){(function(r){function n(o){return r.Buffer&&r.Buffer.isBuffer(o)||r.ArrayBuffer&&o instanceof ArrayBuffer}e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],46:[function(t,e){e.exports=t(37)},{}],47:[function(t,e,r){(function(n){function o(I){if(o[I]!==p)return o[I];var F;if(I=="bug-string-char-index")F=!1;else if(I=="json")F=o("json-stringify")&&o("json-parse");else{var B,P='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(I=="json-stringify"){var O=u.stringify,U=typeof O=="function"&&h;if(U){(B=function(){return 1}).toJSON=B;try{U=O(0)==="0"&&O(new Number)==="0"&&O(new String)=='""'&&O(f)===p&&O(p)===p&&O()===p&&O(B)==="1"&&O([B])=="[1]"&&O([p])=="[null]"&&O(null)=="null"&&O([p,f,null])=="[null,null,null]"&&O({a:[B,!0,!1,null,`\0\b
|
|
8
|
+
\f\r `]})==P&&O(null,B)==="1"&&O([1,2],null,1)==`[
|
|
9
9
|
1,
|
|
10
10
|
2
|
|
11
|
-
]`&&
|
|
11
|
+
]`&&O(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&O(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&O(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&O(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch{U=!1}}F=U}if(I=="json-parse"){var D=u.parse;if(typeof D=="function")try{if(D("0")===0&&!D(!1)){B=D(P);var _=B.a.length==5&&B.a[0]===1;if(_){try{_=!D('" "')}catch{}if(_)try{_=D("01")!==1}catch{}if(_)try{_=D("1.")!==1}catch{}}}}catch{_=!1}F=_}}return o[I]=!!F}var c,l,p,f={}.toString,i=typeof JSON=="object"&&JSON,u=typeof r=="object"&&r&&!r.nodeType&&r;u&&i?(u.stringify=i.stringify,u.parse=i.parse):u=n.JSON=i||{};var h=new Date(-0xc782b5b800cec);try{h=h.getUTCFullYear()==-109252&&h.getUTCMonth()===0&&h.getUTCDate()===1&&h.getUTCHours()==10&&h.getUTCMinutes()==37&&h.getUTCSeconds()==6&&h.getUTCMilliseconds()==708}catch{}if(!o("json")){var a="[object Function]",s="[object Date]",d="[object Number]",y="[object String]",m="[object Array]",v="[object Boolean]",T=o("bug-string-char-index");if(!h)var R=Math.floor,b=[0,31,59,90,120,151,181,212,243,273,304,334],S=function(I,F){return b[F]+365*(I-1970)+R((I-1969+(F=+(F>1)))/4)-R((I-1901+F)/100)+R((I-1601+F)/400)};(c={}.hasOwnProperty)||(c=function(I){var F,B={};return(B.__proto__=null,B.__proto__={toString:1},B).toString!=f?c=function(P){var O=this.__proto__,U=P in(this.__proto__=null,this);return this.__proto__=O,U}:(F=B.constructor,c=function(P){var O=(this.constructor||F).prototype;return P in this&&!(P in O&&this[P]===O[P])}),B=null,c.call(this,I)});var g={boolean:1,number:1,string:1,undefined:1},w=function(I,F){var B=typeof I[F];return B=="object"?!!I[F]:!g[B]};if(l=function(I,F){var B,P,O,U=0;(B=function(){this.valueOf=0}).prototype.valueOf=0,P=new B;for(O in P)c.call(P,O)&&U++;return B=P=null,U?l=U==2?function(D,_){var q,V={},ne=f.call(D)==a;for(q in D)ne&&q=="prototype"||c.call(V,q)||!(V[q]=1)||!c.call(D,q)||_(q)}:function(D,_){var q,V,ne=f.call(D)==a;for(q in D)ne&&q=="prototype"||!c.call(D,q)||(V=q==="constructor")||_(q);(V||c.call(D,q="constructor"))&&_(q)}:(P=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],l=function(D,_){var q,V,ne=f.call(D)==a,oe=!ne&&typeof D.constructor!="function"&&w(D,"hasOwnProperty")?D.hasOwnProperty:c;for(q in D)ne&&q=="prototype"||!oe.call(D,q)||_(q);for(V=P.length;q=P[--V];oe.call(D,q)&&_(q));}),l(I,F)},!o("json-stringify")){var E={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},C="000000",k=function(I,F){return(C+(F||0)).slice(-I)},N="\\u00",x=function(I){var F,B='"',P=0,O=I.length,U=O>10&&T;for(U&&(F=I.split(""));O>P;P++){var D=I.charCodeAt(P);switch(D){case 8:case 9:case 10:case 12:case 13:case 34:case 92:B+=E[D];break;default:if(32>D){B+=N+k(2,D.toString(16));break}B+=U?F[P]:T?I.charAt(P):I[P]}}return B+'"'},L=function(I,F,B,P,O,U,D){var _,q,V,ne,oe,xe,ct,ht,ut,pt,le,lt,We,Re,ft,dt;try{_=F[I]}catch{}if(typeof _=="object"&&_)if(q=f.call(_),q!=s||c.call(_,"toJSON"))typeof _.toJSON=="function"&&(q!=d&&q!=y&&q!=m||c.call(_,"toJSON"))&&(_=_.toJSON(I));else if(_>-1/0&&1/0>_){if(S){for(oe=R(_/864e5),V=R(oe/365.2425)+1970-1;S(V+1,0)<=oe;V++);for(ne=R((oe-S(V,0))/30.42);S(V,ne+1)<=oe;ne++);oe=1+oe-S(V,ne),xe=(_%864e5+864e5)%864e5,ct=R(xe/36e5)%24,ht=R(xe/6e4)%60,ut=R(xe/1e3)%60,pt=xe%1e3}else V=_.getUTCFullYear(),ne=_.getUTCMonth(),oe=_.getUTCDate(),ct=_.getUTCHours(),ht=_.getUTCMinutes(),ut=_.getUTCSeconds(),pt=_.getUTCMilliseconds();_=(0>=V||V>=1e4?(0>V?"-":"+")+k(6,0>V?-V:V):k(4,V))+"-"+k(2,ne+1)+"-"+k(2,oe)+"T"+k(2,ct)+":"+k(2,ht)+":"+k(2,ut)+"."+k(3,pt)+"Z"}else _=null;if(B&&(_=B.call(F,I,_)),_===null)return"null";if(q=f.call(_),q==v)return""+_;if(q==d)return _>-1/0&&1/0>_?""+_:"null";if(q==y)return x(""+_);if(typeof _=="object"){for(Re=D.length;Re--;)if(D[Re]===_)throw TypeError();if(D.push(_),le=[],ft=U,U+=O,q==m){for(We=0,Re=_.length;Re>We;We++)lt=L(We,_,B,P,O,U,D),le.push(lt===p?"null":lt);dt=le.length?O?`[
|
|
12
12
|
`+U+le.join(`,
|
|
13
13
|
`+U)+`
|
|
14
|
-
`+
|
|
14
|
+
`+ft+"]":"["+le.join(",")+"]":"[]"}else l(P||_,function(yt){var Kt=L(yt,_,B,P,O,U,D);Kt!==p&&le.push(x(yt)+":"+(O?" ":"")+Kt)}),dt=le.length?O?`{
|
|
15
15
|
`+U+le.join(`,
|
|
16
16
|
`+U)+`
|
|
17
|
-
`+
|
|
18
|
-
`,102:"\f",114:"\r"},X=function(){throw A=z=null,SyntaxError()},te=function(){for(var I,F,_,P,x,U=z,D=U.length;D>A;)switch(x=U.charCodeAt(A)){case 9:case 10:case 13:case 32:A++;break;case 123:case 125:case 91:case 93:case 58:case 44:return I=T?U.charAt(A):U[A],A++,I;case 34:for(I="@",A++;D>A;)if(x=U.charCodeAt(A),32>x)X();else if(x==92)switch(x=U.charCodeAt(++A)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:I+=K[x],A++;break;case 117:for(F=++A,_=A+4;_>A;A++)x=U.charCodeAt(A),x>=48&&57>=x||x>=97&&102>=x||x>=65&&70>=x||X();I+=M("0x"+U.slice(F,A));break;default:X()}else{if(x==34)break;for(x=U.charCodeAt(A),F=A;x>=32&&x!=92&&x!=34;)x=U.charCodeAt(++A);I+=U.slice(F,A)}if(U.charCodeAt(A)==34)return A++,I;X();default:if(F=A,x==45&&(P=!0,x=U.charCodeAt(++A)),x>=48&&57>=x){for(x==48&&(x=U.charCodeAt(A+1),x>=48&&57>=x)&&X(),P=!1;D>A&&(x=U.charCodeAt(A),x>=48&&57>=x);A++);if(U.charCodeAt(A)==46){for(_=++A;D>_&&(x=U.charCodeAt(_),x>=48&&57>=x);_++);_==A&&X(),A=_}if(x=U.charCodeAt(A),x==101||x==69){for(x=U.charCodeAt(++A),(x==43||x==45)&&A++,_=A;D>_&&(x=U.charCodeAt(_),x>=48&&57>=x);_++);_==A&&X(),A=_}return+U.slice(F,A)}if(P&&X(),U.slice(A,A+4)=="true")return A+=4,!0;if(U.slice(A,A+5)=="false")return A+=5,!1;if(U.slice(A,A+4)=="null")return A+=4,null;X()}return"$"},Ne=function(I){var F,_;if(I=="$"&&X(),typeof I=="string"){if((T?I.charAt(0):I[0])=="@")return I.slice(1);if(I=="["){for(F=[];I=te(),I!="]";_||(_=!0))_&&(I==","?(I=te(),I=="]"&&X()):X()),I==","&&X(),F.push(Ne(I));return F}if(I=="{"){for(F={};I=te(),I!="}";_||(_=!0))_&&(I==","?(I=te(),I=="}"&&X()):X()),(I==","||typeof I!="string"||(T?I.charAt(0):I[0])!="@"||te()!=":")&&X(),F[I.slice(1)]=Ne(te());return F}X()}return I},Kt=function(I,F,_){var P=Yt(I,F,_);P===p?delete I[F]:I[F]=P},Yt=function(I,F,_){var P,x=I[F];if(typeof x=="object"&&x)if(f.call(x)==m)for(P=x.length;P--;)Kt(x,P,_);else l(x,function(U){Kt(x,U,_)});return _.call(I,F,x)};h.parse=function(I,F){var _,P;return A=0,z=""+I,_=Ne(te()),te()!="$"&&X(),A=z=null,F&&f.call(F)==c?Yt((P={},P[""]=_,P),"",F):_}}}})(this)},{}],48:[function(t,e){function r(n,o){var a=[];o=o||0;for(var l=o||0;l<n.length;l++)a[l-o]=n[l];return a}e.exports=r},{}]},{},[1])(1)}const pn=Object.freeze(Object.defineProperty({__proto__:null,default:hn},Symbol.toStringTag,{value:"Module"})),ln=Object.assign({"./v1_3_7.js":pn}),fn=/v\d+_\d+_\d+/;function dn(t){return typeof t=="function"}const Et=Object.entries(ln).reduce((t,e)=>{var o;const r=e[1].default,n=(o=e[0].match(fn))==null?void 0:o[0];return dn(r)&&n&&(t[n]=r()),t},{}),wr=t=>{if(t in Et)return Et[t];throw new Error(`Socket version ${t} not found`)},gn=(t,...e)=>wr(t)(...e),yn={...Et,getSocketVersion:wr,makeSocketVersion:gn};var Sr=(t=>(t.RINGING="Ringing",t.TALKING="Talking",t.DIALING="Dialing",t.HOLD="Hold",t))(Sr||{}),Er=(t=>(t.INCOMING="Incoming",t.OUTGOING="Outgoing",t))(Er||{}),de=(t=>(t.CONNECTED="connected",t.DISCONNECTED="disconnected",t.TRYING_TO_CONNECT="tryingToConnect",t))(de||{}),Ar=(t=>(t.AUTOMATIC="Automatic",t.IVR="IVR",t))(Ar||{}),Tr=(t=>(t.INCOMINC="Incoming",t.OUTGOING="Outgoing",t.SPY="Spy",t.CLICK2CALL="Click2Call",t))(Tr||{}),Nr=(t=>(t.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",t.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",t))(Nr||{}),j=(t=>(t.ALL_DIALER_STATUS="AllDialersStatus",t.ALL_EXTENSION_STATUS="AllExtensionsStatus",t.ALL_USERS_STATUS="AllUsersStatus",t.CONNECT="connect",t.DISCONNECT="disconnect",t.CONNECT_ERROR_EVENT="connect_error",t.EXTENSION_EVENT="ExtensionEvent",t.KEEP_ALIVE="keepalive",t.KEEP_ALIVE_RESPONSE="keepaliveResponse",t.LOGIN_STATUS="loginStatus",t.LOGIN_SUCCESS="loginSuccess",t.QUEUE_EVENT="QueueEvent",t.ONLINE_STATUS_EVENT="onlineStatusEvent",t.DIALER_EVENT="DialerEvent",t.EXTENSIONS_UPDATED="ExtensionsUpdated",t))(j||{}),Dt=(t=>(t.NEWCALL="NEWCALL",t.ANSWER="ANSWER",t.HOLD="HOLD",t.UNHOLD="UNHOLD",t.HANGUP="HANGUP",t.USER_STATUS_UPDATE="userStatusUpdate",t))(Dt||{}),xr=(t=>(t.NORMAL_HANGUP="Normal hangup",t.USER_BUSY="User busy",t.CALL_REJECTED="Call Rejected",t.UNALLOCATED_NUMBER="Unallocated (unassigned) number",t.UNKNOWN="Unknown",t.NO_USER_RESPONDING="No user responding",t.USER_ALERTING="User alerting, no answer",t.ANSWERED_ELSEWHERE="Answered elsewhere",t))(xr||{}),Or=(t=>(t.ANSWER="ANSWER",t.ABANDONED="ABANDONED",t.EXIT="EXIT",t.JOIN="JOIN",t))(Or||{});class We{static mapExtensionEvent(e){var l,p;const r=e.reason;let n,o;e.data.currentCall&&(o=this.mapExtensionCall(e,e.data.currentCall));const a=this.mapExtensionData(e,e.data);return r===Dt.HANGUP?n={...e,reason:r,data:{...a,currentCall:o?{...o,duration:o.callAnswered_UTC_CLIENT?Date.now()-o.callAnswered_UTC_CLIENT:0}:void 0,calls:(l=e.data.calls)==null?void 0:l.map(f=>{const i=this.mapExtensionCall(e,f);return{...i,duration:i.callAnswered_UTC_CLIENT?Date.now()-i.callAnswered_UTC_CLIENT:0}})}}:n={...e,data:{...a,currentCall:o,calls:(p=e.data.calls)==null?void 0:p.map(f=>this.mapExtensionCall(e,f))},reason:r},n}static mapAllExtensionStatus(e){return{...e,extensions:e.extensions.map(r=>{var n;return{...this.mapExtensionData(e,r),currentCall:r.currentCall?this.mapExtensionCall(e,r.currentCall):void 0,calls:(n=r.calls)==null?void 0:n.map(o=>this.mapExtensionCall(e,o))}})}}static mapExtensionData(e,r){return this.configureUTCForObject(r,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],e.servertime,e.servertimeoffset)}static mapExtensionCall(e,r){return this.configureUTCForObject(r,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],e.servertime,e.servertimeoffset)}static mapQueueCall(e,r){return this.configureUTCForObject(r,[{key:"JoinTimeStamp",format:"sec"},{key:"VHJoinTimeStamp",format:"sec"}],e.servertime,e.servertimeoffset)}static mapLoginStatusEvent(e){return{...e,queues:e.queues.map(r=>({...r,Calls:r.Calls.map(n=>this.mapQueueCall(e,n))}))}}static mapQueueEvent(e){return{...e,data:{...e.data,Calls:e.data.Calls.map(r=>this.mapQueueCall(e,r))}}}static assignProperty(e,r,n){e[r]=n}static configureUTCForObject(e,r,n,o){const a=(n-o*60)*1e3,l=Date.now()-a,p={};return r.forEach(f=>{const i=e[f.key],h=f.key;if(i!==0&&typeof i=="number"&&!isNaN(i)){let u=i;f.format==="ms"&&(u=Math.floor(u/1e3));const c=(u-o*60)*1e3;this.assignProperty(p,`${h}_UTC`,c),this.assignProperty(p,`${h}_UTC_CLIENT`,c+l)}else this.assignProperty(p,`${h}_UTC`,0),this.assignProperty(p,`${h}_UTC_CLIENT`,0)}),{...e,...p}}}var Pt=(t=>(t.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",t.KEEP_ALIVE="keepalive",t))(Pt||{});class mn{constructor(e){G(this,"io");G(this,"ioFunction");G(this,"lastEventTimestamp",new Date().getTime());G(this,"doReconnect",!0);G(this,"keepAliveInterval");G(this,"keepReconnectInterval");G(this,"keepReconnectTimeout");G(this,"connected",!1);G(this,"reconnectionTime",20);this.eventsSdkClass=e,this.eventsSdkClass=e,typeof window<"u"&&(window.addEventListener("offline",()=>{this.closeAllConnections()}),window.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(he.NEXT)},5e3)})),typeof self<"u"&&typeof window>"u"&&typeof global>"u"&&(self.addEventListener("offline",()=>{this.closeAllConnections()}),self.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(he.NEXT)},5e3)}))}getSocketIoFunction(e){const r=e.split("v="),n="v".concat(r[r.length-1]).replaceAll(".","_");this.ioFunction=yn.getSocketVersion(n)}initSocketConnection(){const e=this.eventsSdkClass.authClass.token,r=this.eventsSdkClass.options.protocol,n=this.eventsSdkClass.server;try{const o=n?n.Domain:this.eventsSdkClass.URL,a=n?`${r}://${o}`:this.eventsSdkClass.URL,l={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:e},timeout:this.eventsSdkClass.options.timeout};if(this.ioFunction&&a)this.io=this.ioFunction(a,l),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{attemptToConnect:a,connectionStatus:de.TRYING_TO_CONNECT}),this.eventsSdkClass.loggerClass.sdkAttemptToConnect(o);else throw new Error("Socket server url no defined")}catch(o){this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(o)}}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io&&this.eventsSdkClass.authClass.token){this.eventsSdkClass.emit(Pt.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.keepAliveEmit();return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var e;this.io&&(this.io.close(),(e=this.io)==null||e.disconnect(),this.io=void 0),this.eventsSdkClass.loggerClass.stop(),Re.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(j.LOGIN_SUCCESS,e=>this.onLoginSuccessEvent(e,j.LOGIN_SUCCESS)).on(j.QUEUE_EVENT,e=>this.onQueueEvent(e,j.QUEUE_EVENT)).on(j.EXTENSION_EVENT,e=>this.onExtensionEvent(e,j.EXTENSION_EVENT)).on(j.DIALER_EVENT,e=>this.onDialerEvent(e,j.DIALER_EVENT)).on(j.LOGIN_STATUS,e=>this.onLoginStatusEvent(e,j.LOGIN_STATUS)).on(j.ALL_EXTENSION_STATUS,e=>this.onAllExtensionStatus(e,j.ALL_EXTENSION_STATUS)).on(j.ALL_DIALER_STATUS,e=>this.onAllDialerStatus(e,j.ALL_DIALER_STATUS)).on(j.KEEP_ALIVE_RESPONSE,e=>this.onKeepAliveResponse(e)).on(j.EXTENSIONS_UPDATED,e=>this.onExtensionsUpdatedEvent(e,j.EXTENSIONS_UPDATED)).on(j.CONNECT,()=>this.onConnect()).on(j.DISCONNECT,e=>this.onDisconnect(e)).on(j.CONNECT_ERROR_EVENT,e=>this.onConnectError(e))}onLoginSuccessEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onQueueEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,We.mapQueueEvent(e))}onExtensionEvent(e,r){const n=We.mapExtensionEvent(e);n&&(this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,n))}onDialerEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onLoginStatusEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,We.mapLoginStatusEvent(e))}onAllExtensionStatus(e,r){const n=We.mapAllExtensionStatus(e);this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,n)}onAllDialerStatus(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onKeepAliveResponse(e){if(this.eventsSdkClass.loggerClass.keepAliveResponse(e),e.errorCode){this.initSocketConnection();return}this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onExtensionsUpdatedEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onConnect(){this.connected=!0,this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:de.CONNECTED}),this.eventsSdkClass.loggerClass.start().then(()=>{this.eventsSdkClass.loggerClass.sdkConnectionSuccess()})}onDisconnect(e){this.connected=!1,this.doReconnect&&(this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?de.TRYING_TO_CONNECT:de.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkDisconnect([e]),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(he.NEXT)},this.reconnectionTime*1e3))}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?de.TRYING_TO_CONNECT:de.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(e),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(he.NEXT)},this.reconnectionTime*1e3)}}var vn=Object.defineProperty,Cn=(t,e,r)=>e in t?vn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$=(t,e,r)=>(Cn(t,typeof e!="symbol"?e+"":e,r),r);function bn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function kn(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}),r}var At={exports:{}},wn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Sn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Rr=function(t){var e=t,r=t.indexOf("["),n=t.indexOf("]");r!=-1&&n!=-1&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));for(var o=wn.exec(t||""),a={},l=14;l--;)a[Sn[l]]=o[l]||"";return r!=-1&&n!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=En(a,a.path),a.queryKey=An(a,a.query),a};function En(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&n.splice(0,1),e.substr(e.length-1,1)=="/"&&n.splice(n.length-1,1),n}function An(t,e){var r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,o,a){o&&(r[o]=a)}),r}var Tt={exports:{}},Nt={exports:{}},Le=1e3,Ie=Le*60,_e=Ie*60,Be=_e*24,Tn=Be*365.25,Nn=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return xn(t);if(r==="number"&&isNaN(t)===!1)return e.long?Rn(t):On(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function xn(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Tn;case"days":case"day":case"d":return r*Be;case"hours":case"hour":case"hrs":case"hr":case"h":return r*_e;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ie;case"seconds":case"second":case"secs":case"sec":case"s":return r*Le;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function On(t){return t>=Be?Math.round(t/Be)+"d":t>=_e?Math.round(t/_e)+"h":t>=Ie?Math.round(t/Ie)+"m":t>=Le?Math.round(t/Le)+"s":t+"ms"}function Rn(t){return Je(t,Be,"day")||Je(t,_e,"hour")||Je(t,Ie,"minute")||Je(t,Le,"second")||t+" ms"}function Je(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=a,e.enabled=p,e.humanize=Nn,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var h=0,u;for(u in i)h=(h<<5)-h+i.charCodeAt(u),h|=0;return e.colors[Math.abs(h)%e.colors.length]}function n(i){var h;function u(){if(u.enabled){var c=u,s=+new Date,d=s-(h||s);c.diff=d,c.prev=h,c.curr=s,h=s;for(var g=new Array(arguments.length),m=0;m<g.length;m++)g[m]=arguments[m];g[0]=e.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");var v=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var y=g[v];R=S.call(c,y),g.splice(v,1),v--}return R}),e.formatArgs.call(c,g);var T=u.log||e.log||console.log.bind(console);T.apply(c,g)}}return u.namespace=i,u.enabled=e.enabled(i),u.useColors=e.useColors(),u.color=r(i),u.destroy=o,typeof e.init=="function"&&e.init(u),e.instances.push(u),u}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function a(i){e.save(i),e.names=[],e.skips=[];var h,u=(typeof i=="string"?i:"").split(/[\s,]+/),c=u.length;for(h=0;h<c;h++)u[h]&&(i=u[h].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(h=0;h<e.instances.length;h++){var s=e.instances[h];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var h,u;for(h=0,u=e.skips.length;h<u;h++)if(e.skips[h].test(i))return!1;for(h=0,u=e.names.length;h<u;h++)if(e.names[h].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(Nt,Nt.exports);var Ln=Nt.exports;(function(t,e){e=t.exports=Ln,e.log=o,e.formatArgs=n,e.save=a,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.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"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var h="color: "+this.color;f.splice(1,0,h,"color: inherit");var u=0,c=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(u++,s==="%c"&&(c=u))}),f.splice(c,0,h)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(Tt,Tt.exports);var et=Tt.exports,In=Rr,er=et("socket.io-client:url"),_n=Bn;function Bn(t,e){var r=t;e=e||typeof location<"u"&&location,t==null&&(t=e.protocol+"//"+e.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=e.protocol+t:t=e.host+t),/^(https?|wss?):\/\//.test(t)||(er("protocol-less url %s",t),typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),er("parse %s",t),r=In(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var n=r.host.indexOf(":")!==-1,o=n?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port,r.href=r.protocol+"://"+o+(e&&e.port===r.port?"":":"+r.port),r}var tt={},xt={exports:{}},Ot={exports:{}},Fe=1e3,Ue=Fe*60,De=Ue*60,Pe=De*24,Fn=Pe*365.25,Un=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Dn(t);if(r==="number"&&isNaN(t)===!1)return e.long?jn(t):Pn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Dn(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Fn;case"days":case"day":case"d":return r*Pe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*De;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ue;case"seconds":case"second":case"secs":case"sec":case"s":return r*Fe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Pn(t){return t>=Pe?Math.round(t/Pe)+"d":t>=De?Math.round(t/De)+"h":t>=Ue?Math.round(t/Ue)+"m":t>=Fe?Math.round(t/Fe)+"s":t+"ms"}function jn(t){return Ge(t,Pe,"day")||Ge(t,De,"hour")||Ge(t,Ue,"minute")||Ge(t,Fe,"second")||t+" ms"}function Ge(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=a,e.enabled=p,e.humanize=Un,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var h=0,u;for(u in i)h=(h<<5)-h+i.charCodeAt(u),h|=0;return e.colors[Math.abs(h)%e.colors.length]}function n(i){var h;function u(){if(u.enabled){var c=u,s=+new Date,d=s-(h||s);c.diff=d,c.prev=h,c.curr=s,h=s;for(var g=new Array(arguments.length),m=0;m<g.length;m++)g[m]=arguments[m];g[0]=e.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");var v=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var y=g[v];R=S.call(c,y),g.splice(v,1),v--}return R}),e.formatArgs.call(c,g);var T=u.log||e.log||console.log.bind(console);T.apply(c,g)}}return u.namespace=i,u.enabled=e.enabled(i),u.useColors=e.useColors(),u.color=r(i),u.destroy=o,typeof e.init=="function"&&e.init(u),e.instances.push(u),u}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function a(i){e.save(i),e.names=[],e.skips=[];var h,u=(typeof i=="string"?i:"").split(/[\s,]+/),c=u.length;for(h=0;h<c;h++)u[h]&&(i=u[h].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(h=0;h<e.instances.length;h++){var s=e.instances[h];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var h,u;for(h=0,u=e.skips.length;h<u;h++)if(e.skips[h].test(i))return!1;for(h=0,u=e.names.length;h<u;h++)if(e.names[h].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(Ot,Ot.exports);var Mn=Ot.exports;(function(t,e){e=t.exports=Mn,e.log=o,e.formatArgs=n,e.save=a,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.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"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var h="color: "+this.color;f.splice(1,0,h,"color: inherit");var u=0,c=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(u++,s==="%c"&&(c=u))}),f.splice(c,0,h)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(xt,xt.exports);var qn=xt.exports,Lr={exports:{}};(function(t){t.exports=e;function e(n){if(n)return r(n)}function r(n){for(var o in e.prototype)n[o]=e.prototype[o];return n}e.prototype.on=e.prototype.addEventListener=function(n,o){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(o),this},e.prototype.once=function(n,o){function a(){this.off(n,a),o.apply(this,arguments)}return a.fn=o,this.on(n,a),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(n,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var a=this._callbacks["$"+n];if(!a)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var l,p=0;p<a.length;p++)if(l=a[p],l===o||l.fn===o){a.splice(p,1);break}return a.length===0&&delete this._callbacks["$"+n],this},e.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var o=new Array(arguments.length-1),a=this._callbacks["$"+n],l=1;l<arguments.length;l++)o[l-1]=arguments[l];if(a){a=a.slice(0);for(var l=0,p=a.length;l<p;++l)a[l].apply(this,o)}return this},e.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},e.prototype.hasListeners=function(n){return!!this.listeners(n).length}})(Lr);var Se=Lr.exports,rt={},zn={}.toString,jt=Array.isArray||function(t){return zn.call(t)=="[object Array]"},Ir=Gn,Xn=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",Wn=typeof ArrayBuffer=="function",Jn=function(t){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer};function Gn(t){return Xn&&Buffer.isBuffer(t)||Wn&&(t instanceof ArrayBuffer||Jn(t))}var Mt=jt,_r=Ir,Br=Object.prototype.toString,Hn=typeof Blob=="function"||typeof Blob<"u"&&Br.call(Blob)==="[object BlobConstructor]",$n=typeof File=="function"||typeof File<"u"&&Br.call(File)==="[object FileConstructor]";rt.deconstructPacket=function(t){var e=[],r=t.data,n=t;return n.data=Rt(r,e),n.attachments=e.length,{packet:n,buffers:e}};function Rt(t,e){if(!t)return t;if(_r(t)){var r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Mt(t)){for(var n=new Array(t.length),o=0;o<t.length;o++)n[o]=Rt(t[o],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){var n={};for(var a in t)n[a]=Rt(t[a],e);return n}return t}rt.reconstructPacket=function(t,e){return t.data=Lt(t.data,e),t.attachments=void 0,t};function Lt(t,e){if(!t)return t;if(t&&t._placeholder===!0){var r=typeof t.num=="number"&&t.num>=0&&t.num<e.length;if(r)return e[t.num];throw new Error("illegal attachments")}else if(Mt(t))for(var n=0;n<t.length;n++)t[n]=Lt(t[n],e);else if(typeof t=="object")for(var o in t)t[o]=Lt(t[o],e);return t}rt.removeBlobs=function(t,e){function r(a,l,p){if(!a)return a;if(Hn&&a instanceof Blob||$n&&a instanceof File){n++;var f=new FileReader;f.onload=function(){p?p[l]=this.result:o=this.result,--n||e(o)},f.readAsArrayBuffer(a)}else if(Mt(a))for(var i=0;i<a.length;i++)r(a[i],i,a);else if(typeof a=="object"&&!_r(a))for(var h in a)r(a[h],h,a)}var n=0,o=t;r(o),n||e(o)};(function(t){var e=qn("socket.io-parser"),r=Se,n=rt,o=jt,a=Ir;t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=l,t.Decoder=u;function l(){}var p=t.ERROR+'"encode error"';l.prototype.encode=function(v,T){if(e("encoding packet %j",v),t.BINARY_EVENT===v.type||t.BINARY_ACK===v.type)h(v,T);else{var R=f(v);T([R])}};function f(v){var T=""+v.type;if((t.BINARY_EVENT===v.type||t.BINARY_ACK===v.type)&&(T+=v.attachments+"-"),v.nsp&&v.nsp!=="/"&&(T+=v.nsp+","),v.id!=null&&(T+=v.id),v.data!=null){var R=i(v.data);if(R!==!1)T+=R;else return p}return e("encoded %j as %s",v,T),T}function i(v){try{return JSON.stringify(v)}catch{return!1}}function h(v,T){function R(b){var S=n.deconstructPacket(b),y=f(S.packet),w=S.buffers;w.unshift(y),T(w)}n.removeBlobs(v,R)}function u(){this.reconstructor=null}r(u.prototype),u.prototype.add=function(v){var T;if(typeof v=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");T=s(v),t.BINARY_EVENT===T.type||t.BINARY_ACK===T.type?(this.reconstructor=new g(T),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",T)):this.emit("decoded",T)}else if(a(v)||v.base64)if(this.reconstructor)T=this.reconstructor.takeBinaryData(v),T&&(this.reconstructor=null,this.emit("decoded",T));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+v)};function c(v,T){switch(v){case 0:return typeof T=="object";case 1:return T===void 0;case 4:return typeof T=="string"||typeof T=="object";case 2:case 5:return o(T)&&(typeof T[0]=="string"||typeof T[0]=="number");case 3:case 6:return o(T)}}function s(v){var T=0,R={type:Number(v.charAt(0))};if(t.types[R.type]==null)return m("unknown packet type "+R.type);if(t.BINARY_EVENT===R.type||t.BINARY_ACK===R.type){for(var b=T+1;v.charAt(++T)!=="-"&&T!=v.length;);var S=v.substring(b,T);if(S!=Number(S)||v.charAt(T)!=="-")throw new Error("Illegal attachments");R.attachments=Number(S)}if(v.charAt(T+1)==="/"){for(var b=T+1;++T;){var y=v.charAt(T);if(y===","||T===v.length)break}R.nsp=v.substring(b,T)}else R.nsp="/";var w=v.charAt(T+1);if(w!==""&&Number(w)==w){for(var b=T+1;++T;){var y=v.charAt(T);if(y==null||Number(y)!=y){--T;break}if(T===v.length)break}R.id=Number(v.substring(b,T+1))}if(v.charAt(++T)){var E=d(v.substr(T));if(c(R.type,E))R.data=E;else throw new Error("invalid payload")}return e("decoded %s as %j",v,R),R}function d(v){try{return JSON.parse(v)}catch{return!1}}u.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function g(v){this.reconPack=v,this.buffers=[]}g.prototype.takeBinaryData=function(v){if(this.buffers.push(v),this.buffers.length===this.reconPack.attachments){var T=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),T}return null},g.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function m(v){return{type:t.ERROR,data:"parser error: "+v}}})(tt);var qt={exports:{}},nt={},It={exports:{}};try{It.exports=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{It.exports=!1}var Vn=It.exports,zt=function(){return typeof self<"u"?self:typeof window<"u"?window:Function("return this")()}(),Kn=Vn,Yn=zt,Xt=function(t){var e=t.xdomain,r=t.xscheme,n=t.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!e||Kn))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!r&&n)return new XDomainRequest}catch{}if(!e)try{return new Yn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}},Wt={exports:{}},Ce={},Qn=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e},gt,tr;function Fr(){if(tr)return gt;tr=1;var t=jt,e=Object.prototype.toString,r=typeof Blob=="function"||typeof Blob<"u"&&e.call(Blob)==="[object BlobConstructor]",n=typeof File=="function"||typeof File<"u"&&e.call(File)==="[object FileConstructor]";gt=o;function o(a){if(!a||typeof a!="object")return!1;if(t(a)){for(var l=0,p=a.length;l<p;l++)if(o(a[l]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(a)||typeof ArrayBuffer=="function"&&a instanceof ArrayBuffer||r&&a instanceof Blob||n&&a instanceof File)return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return o(a.toJSON(),!0);for(var f in a)if(Object.prototype.hasOwnProperty.call(a,f)&&o(a[f]))return!0;return!1}return gt}var Zn=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||n===0)return new ArrayBuffer(0);for(var o=new Uint8Array(t),a=new Uint8Array(r-e),l=e,p=0;l<r;l++,p++)a[p]=o[l];return a.buffer},eo=to;function to(t,e,r){var n=!1;return r=r||ro,o.count=t,t===0?e():o;function o(a,l){if(o.count<=0)throw new Error("after called too many times");--o.count,a?(n=!0,e(a),e=r):o.count===0&&!n&&e(null,l)}}function ro(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var ye=String.fromCharCode;function Ur(t){for(var e=[],r=0,n=t.length,o,a;r<n;)o=t.charCodeAt(r++),o>=55296&&o<=56319&&r<n?(a=t.charCodeAt(r++),(a&64512)==56320?e.push(((o&1023)<<10)+(a&1023)+65536):(e.push(o),r--)):e.push(o);return e}function no(t){for(var e=t.length,r=-1,n,o="";++r<e;)n=t[r],n>65535&&(n-=65536,o+=ye(n>>>10&1023|55296),n=56320|n&1023),o+=ye(n);return o}function Dr(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function yt(t,e){return ye(t>>e&63|128)}function oo(t,e){if(!(t&4294967168))return ye(t);var r="";return t&4294965248?t&4294901760?t&4292870144||(r=ye(t>>18&7|240),r+=yt(t,12),r+=yt(t,6)):(Dr(t,e)||(t=65533),r=ye(t>>12&15|224),r+=yt(t,6)):r=ye(t>>6&31|192),r+=ye(t&63|128),r}function so(t,e){e=e||{};for(var r=e.strict!==!1,n=Ur(t),o=n.length,a=-1,l,p="";++a<o;)l=n[a],p+=oo(l,r);return p}function be(){if(me>=Ye)throw Error("Invalid byte index");var t=Ke[me]&255;if(me++,(t&192)==128)return t&63;throw Error("Invalid continuation byte")}function io(t){var e,r,n,o,a;if(me>Ye)throw Error("Invalid byte index");if(me==Ye)return!1;if(e=Ke[me]&255,me++,!(e&128))return e;if((e&224)==192){if(r=be(),a=(e&31)<<6|r,a>=128)return a;throw Error("Invalid continuation byte")}if((e&240)==224){if(r=be(),n=be(),a=(e&15)<<12|r<<6|n,a>=2048)return Dr(a,t)?a:65533;throw Error("Invalid continuation byte")}if((e&248)==240&&(r=be(),n=be(),o=be(),a=(e&7)<<18|r<<12|n<<6|o,a>=65536&&a<=1114111))return a;throw Error("Invalid UTF-8 detected")}var Ke,Ye,me;function ao(t,e){e=e||{};var r=e.strict!==!1;Ke=Ur(t),Ye=Ke.length,me=0;for(var n=[],o;(o=io(r))!==!1;)n.push(o);return no(n)}var co={version:"2.1.2",encode:so,decode:ao},mt={},rr;function uo(){return rr||(rr=1,function(t){mt.encode=function(e){var r=new Uint8Array(e),n,o=r.length,a="";for(n=0;n<o;n+=3)a+=t[r[n]>>2],a+=t[(r[n]&3)<<4|r[n+1]>>4],a+=t[(r[n+1]&15)<<2|r[n+2]>>6],a+=t[r[n+2]&63];return o%3===2?a=a.substring(0,a.length-1)+"=":o%3===1&&(a=a.substring(0,a.length-2)+"=="),a},mt.decode=function(e){var r=e.length*.75,n=e.length,o,a=0,l,p,f,i;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var h=new ArrayBuffer(r),u=new Uint8Array(h);for(o=0;o<n;o+=4)l=t.indexOf(e[o]),p=t.indexOf(e[o+1]),f=t.indexOf(e[o+2]),i=t.indexOf(e[o+3]),u[a++]=l<<2|p>>4,u[a++]=(p&15)<<4|f>>2,u[a++]=(f&3)<<6|i&63;return h}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),mt}var vt,nr;function ho(){if(nr)return vt;nr=1;var t=typeof t<"u"?t:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:!1,e=function(){try{var p=new Blob(["hi"]);return p.size===2}catch{return!1}}(),r=e&&function(){try{var p=new Blob([new Uint8Array([1,2])]);return p.size===2}catch{return!1}}(),n=t&&t.prototype.append&&t.prototype.getBlob;function o(p){return p.map(function(f){if(f.buffer instanceof ArrayBuffer){var i=f.buffer;if(f.byteLength!==i.byteLength){var h=new Uint8Array(f.byteLength);h.set(new Uint8Array(i,f.byteOffset,f.byteLength)),i=h.buffer}return i}return f})}function a(p,f){f=f||{};var i=new t;return o(p).forEach(function(h){i.append(h)}),f.type?i.getBlob(f.type):i.getBlob()}function l(p,f){return new Blob(o(p),f||{})}return typeof Blob<"u"&&(a.prototype=Blob.prototype,l.prototype=Blob.prototype),vt=function(){return e?r?Blob:l:n?a:void 0}(),vt}(function(t){var e=Qn,r=Fr(),n=Zn,o=eo,a=co,l;typeof ArrayBuffer<"u"&&(l=uo());var p=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),f=typeof navigator<"u"&&/PhantomJS/i.test(navigator.userAgent),i=p||f;t.protocol=3;var h=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},u=e(h),c={type:"error",data:"parser error"},s=ho();t.encodePacket=function(b,S,y,w){typeof S=="function"&&(w=S,S=!1),typeof y=="function"&&(w=y,y=null);var E=b.data===void 0?void 0:b.data.buffer||b.data;if(typeof ArrayBuffer<"u"&&E instanceof ArrayBuffer)return g(b,S,w);if(typeof s<"u"&&E instanceof s)return v(b,S,w);if(E&&E.base64)return d(b,w);var C=h[b.type];return b.data!==void 0&&(C+=y?a.encode(String(b.data),{strict:!1}):String(b.data)),w(""+C)};function d(b,S){var y="b"+t.packets[b.type]+b.data.data;return S(y)}function g(b,S,y){if(!S)return t.encodeBase64Packet(b,y);var w=b.data,E=new Uint8Array(w),C=new Uint8Array(1+w.byteLength);C[0]=h[b.type];for(var k=0;k<E.length;k++)C[k+1]=E[k];return y(C.buffer)}function m(b,S,y){if(!S)return t.encodeBase64Packet(b,y);var w=new FileReader;return w.onload=function(){t.encodePacket({type:b.type,data:w.result},S,!0,y)},w.readAsArrayBuffer(b.data)}function v(b,S,y){if(!S)return t.encodeBase64Packet(b,y);if(i)return m(b,S,y);var w=new Uint8Array(1);w[0]=h[b.type];var E=new s([w.buffer,b.data]);return y(E)}t.encodeBase64Packet=function(b,S){var y="b"+t.packets[b.type];if(typeof s<"u"&&b.data instanceof s){var w=new FileReader;return w.onload=function(){var O=w.result.split(",")[1];S(y+O)},w.readAsDataURL(b.data)}var E;try{E=String.fromCharCode.apply(null,new Uint8Array(b.data))}catch{for(var C=new Uint8Array(b.data),k=new Array(C.length),N=0;N<C.length;N++)k[N]=C[N];E=String.fromCharCode.apply(null,k)}return y+=btoa(E),S(y)},t.decodePacket=function(b,S,y){if(b===void 0)return c;if(typeof b=="string"){if(b.charAt(0)==="b")return t.decodeBase64Packet(b.substr(1),S);if(y&&(b=T(b),b===!1))return c;var E=b.charAt(0);return Number(E)!=E||!u[E]?c:b.length>1?{type:u[E],data:b.substring(1)}:{type:u[E]}}var w=new Uint8Array(b),E=w[0],C=n(b,1);return s&&S==="blob"&&(C=new s([C])),{type:u[E],data:C}};function T(b){try{b=a.decode(b,{strict:!1})}catch{return!1}return b}t.decodeBase64Packet=function(b,S){var y=u[b.charAt(0)];if(!l)return{type:y,data:{base64:!0,data:b.substr(1)}};var w=l.decode(b.substr(1));return S==="blob"&&s&&(w=new s([w])),{type:y,data:w}},t.encodePayload=function(b,S,y){typeof S=="function"&&(y=S,S=null);var w=r(b);if(S&&w)return s&&!i?t.encodePayloadAsBlob(b,y):t.encodePayloadAsArrayBuffer(b,y);if(!b.length)return y("0:");function E(k){return k.length+":"+k}function C(k,N){t.encodePacket(k,w?S:!1,!1,function(O){N(null,E(O))})}R(b,C,function(k,N){return y(N.join(""))})};function R(b,S,y){for(var w=new Array(b.length),E=o(b.length,y),C=function(N,O,L){S(O,function(A,z){w[N]=z,L(A,w)})},k=0;k<b.length;k++)C(k,b[k],E)}t.decodePayload=function(b,S,y){if(typeof b!="string")return t.decodePayloadAsBinary(b,S,y);typeof S=="function"&&(y=S,S=null);var w;if(b==="")return y(c,0,1);for(var E="",C,k,N=0,O=b.length;N<O;N++){var L=b.charAt(N);if(L!==":"){E+=L;continue}if(E===""||E!=(C=Number(E))||(k=b.substr(N+1,C),E!=k.length))return y(c,0,1);if(k.length){if(w=t.decodePacket(k,S,!1),c.type===w.type&&c.data===w.data)return y(c,0,1);var A=y(w,N+C,O);if(A===!1)return}N+=C,E=""}if(E!=="")return y(c,0,1)},t.encodePayloadAsArrayBuffer=function(b,S){if(!b.length)return S(new ArrayBuffer(0));function y(w,E){t.encodePacket(w,!0,!0,function(C){return E(null,C)})}R(b,y,function(w,E){var C=E.reduce(function(O,L){var A;return typeof L=="string"?A=L.length:A=L.byteLength,O+A.toString().length+A+2},0),k=new Uint8Array(C),N=0;return E.forEach(function(O){var L=typeof O=="string",A=O;if(L){for(var z=new Uint8Array(O.length),M=0;M<O.length;M++)z[M]=O.charCodeAt(M);A=z.buffer}L?k[N++]=0:k[N++]=1;for(var K=A.byteLength.toString(),M=0;M<K.length;M++)k[N++]=parseInt(K[M]);k[N++]=255;for(var z=new Uint8Array(A),M=0;M<z.length;M++)k[N++]=z[M]}),S(k.buffer)})},t.encodePayloadAsBlob=function(b,S){function y(w,E){t.encodePacket(w,!0,!0,function(C){var k=new Uint8Array(1);if(k[0]=1,typeof C=="string"){for(var N=new Uint8Array(C.length),O=0;O<C.length;O++)N[O]=C.charCodeAt(O);C=N.buffer,k[0]=0}for(var L=C instanceof ArrayBuffer?C.byteLength:C.size,A=L.toString(),z=new Uint8Array(A.length+1),O=0;O<A.length;O++)z[O]=parseInt(A[O]);if(z[A.length]=255,s){var M=new s([k.buffer,z.buffer,C]);E(null,M)}})}R(b,y,function(w,E){return S(new s(E))})},t.decodePayloadAsBinary=function(b,S,y){typeof S=="function"&&(y=S,S=null);for(var w=b,E=[];w.byteLength>0;){for(var C=new Uint8Array(w),k=C[0]===0,N="",O=1;C[O]!==255;O++){if(N.length>310)return y(c,0,1);N+=C[O]}w=n(w,2+N.length),N=parseInt(N);var L=n(w,0,N);if(k)try{L=String.fromCharCode.apply(null,new Uint8Array(L))}catch{var A=new Uint8Array(L);L="";for(var O=0;O<A.length;O++)L+=String.fromCharCode(A[O])}E.push(L),w=n(w,N)}var z=E.length;E.forEach(function(M,K){y(t.decodePacket(M,S,!0),K,z)})}})(Ce);var Ct,or;function Jt(){if(or)return Ct;or=1;var t=Ce,e=Se;Ct=r;function r(n){this.path=n.path,this.hostname=n.hostname,this.port=n.port,this.secure=n.secure,this.query=n.query,this.timestampParam=n.timestampParam,this.timestampRequests=n.timestampRequests,this.readyState="",this.agent=n.agent||!1,this.socket=n.socket,this.enablesXDR=n.enablesXDR,this.withCredentials=n.withCredentials,this.pfx=n.pfx,this.key=n.key,this.passphrase=n.passphrase,this.cert=n.cert,this.ca=n.ca,this.ciphers=n.ciphers,this.rejectUnauthorized=n.rejectUnauthorized,this.forceNode=n.forceNode,this.isReactNative=n.isReactNative,this.extraHeaders=n.extraHeaders,this.localAddress=n.localAddress}return e(r.prototype),r.prototype.onError=function(n,o){var a=new Error(n);return a.type="TransportError",a.description=o,this.emit("error",a),this},r.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(n){if(this.readyState==="open")this.write(n);else throw new Error("Transport not open")},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(n){var o=t.decodePacket(n,this.socket.binaryType);this.onPacket(o)},r.prototype.onPacket=function(n){this.emit("packet",n)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")},Ct}var bt={},sr;function ot(){return sr||(sr=1,bt.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},bt.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var a=r[n].split("=");e[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return e}),bt}var st=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},Pr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Qe=64,jr={},ir=0,ve=0,ar;function _t(t){var e="";do e=Pr[t%Qe]+e,t=Math.floor(t/Qe);while(t>0);return e}function po(t){var e=0;for(ve=0;ve<t.length;ve++)e=e*Qe+jr[t.charAt(ve)];return e}function Gt(){var t=_t(+new Date);return t!==ar?(ir=0,ar=t):t+"."+_t(ir++)}for(;ve<Qe;ve++)jr[Pr[ve]]=ve;Gt.encode=_t;Gt.decode=po;var Mr=Gt,Bt={exports:{}},Ft={exports:{}},je=1e3,Me=je*60,qe=Me*60,ze=qe*24,lo=ze*365.25,fo=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return go(t);if(r==="number"&&isNaN(t)===!1)return e.long?mo(t):yo(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function go(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*lo;case"days":case"day":case"d":return r*ze;case"hours":case"hour":case"hrs":case"hr":case"h":return r*qe;case"minutes":case"minute":case"mins":case"min":case"m":return r*Me;case"seconds":case"second":case"secs":case"sec":case"s":return r*je;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function yo(t){return t>=ze?Math.round(t/ze)+"d":t>=qe?Math.round(t/qe)+"h":t>=Me?Math.round(t/Me)+"m":t>=je?Math.round(t/je)+"s":t+"ms"}function mo(t){return He(t,ze,"day")||He(t,qe,"hour")||He(t,Me,"minute")||He(t,je,"second")||t+" ms"}function He(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=a,e.enabled=p,e.humanize=fo,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var h=0,u;for(u in i)h=(h<<5)-h+i.charCodeAt(u),h|=0;return e.colors[Math.abs(h)%e.colors.length]}function n(i){var h;function u(){if(u.enabled){var c=u,s=+new Date,d=s-(h||s);c.diff=d,c.prev=h,c.curr=s,h=s;for(var g=new Array(arguments.length),m=0;m<g.length;m++)g[m]=arguments[m];g[0]=e.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");var v=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var y=g[v];R=S.call(c,y),g.splice(v,1),v--}return R}),e.formatArgs.call(c,g);var T=u.log||e.log||console.log.bind(console);T.apply(c,g)}}return u.namespace=i,u.enabled=e.enabled(i),u.useColors=e.useColors(),u.color=r(i),u.destroy=o,typeof e.init=="function"&&e.init(u),e.instances.push(u),u}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function a(i){e.save(i),e.names=[],e.skips=[];var h,u=(typeof i=="string"?i:"").split(/[\s,]+/),c=u.length;for(h=0;h<c;h++)u[h]&&(i=u[h].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(h=0;h<e.instances.length;h++){var s=e.instances[h];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var h,u;for(h=0,u=e.skips.length;h<u;h++)if(e.skips[h].test(i))return!1;for(h=0,u=e.names.length;h<u;h++)if(e.names[h].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(Ft,Ft.exports);var vo=Ft.exports;(function(t,e){e=t.exports=vo,e.log=o,e.formatArgs=n,e.save=a,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.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"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var h="color: "+this.color;f.splice(1,0,h,"color: inherit");var u=0,c=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(u++,s==="%c"&&(c=u))}),f.splice(c,0,h)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(Bt,Bt.exports);var it=Bt.exports,qr=Jt(),Co=ot(),zr=Ce,bo=st,ko=Mr,ae=it("engine.io-client:polling"),Xr=pe,wo=function(){var t=Xt,e=new t({xdomain:!1});return e.responseType!=null}();function pe(t){var e=t&&t.forceBase64;(!wo||e)&&(this.supportsBinary=!1),qr.call(this,t)}bo(pe,qr);pe.prototype.name="polling";pe.prototype.doOpen=function(){this.poll()};pe.prototype.pause=function(t){var e=this;this.readyState="pausing";function r(){ae("paused"),e.readyState="paused",t()}if(this.polling||!this.writable){var n=0;this.polling&&(ae("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){ae("pre-pause polling complete"),--n||r()})),this.writable||(ae("we are currently writing - waiting to pause"),n++,this.once("drain",function(){ae("pre-pause writing complete"),--n||r()}))}else r()};pe.prototype.poll=function(){ae("polling"),this.polling=!0,this.doPoll(),this.emit("poll")};pe.prototype.onData=function(t){var e=this;ae("polling got data %s",t);var r=function(n,o,a){if(e.readyState==="opening"&&n.type==="open"&&e.onOpen(),n.type==="close")return e.onClose(),!1;e.onPacket(n)};zr.decodePayload(t,this.socket.binaryType,r),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():ae('ignoring poll - transport state "%s"',this.readyState))};pe.prototype.doClose=function(){var t=this;function e(){ae("writing close packet"),t.write([{type:"close"}])}this.readyState==="open"?(ae("transport open - closing"),e()):(ae("transport not open - deferring close"),this.once("open",e))};pe.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};zr.encodePayload(t,this.supportsBinary,function(n){e.doWrite(n,r)})};pe.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";this.timestampRequests!==!1&&(t[this.timestampParam]=ko()),!this.supportsBinary&&!t.sid&&(t.b64=1),t=Co.encode(t),this.port&&(e==="https"&&Number(this.port)!==443||e==="http"&&Number(this.port)!==80)&&(r=":"+this.port),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t};var So=Xt,Wr=Xr,Eo=Se,Ao=st,Ut=it("engine.io-client:polling-xhr"),To=zt;Wt.exports=Ee;Wt.exports.Request=Q;function cr(){}function Ee(t){if(Wr.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,typeof location<"u"){var e=location.protocol==="https:",r=location.port;r||(r=e?443:80),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port,this.xs=t.secure!==e}}Ao(Ee,Wr);Ee.prototype.supportsBinary=!0;Ee.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new Q(t)};Ee.prototype.doWrite=function(t,e){var r=typeof t!="string"&&t!==void 0,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(a){o.onError("xhr post error",a)}),this.sendXhr=n};Ee.prototype.doPoll=function(){Ut("xhr poll");var t=this.request(),e=this;t.on("data",function(r){e.onData(r)}),t.on("error",function(r){e.onError("xhr poll error",r)}),this.pollXhr=t};function Q(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}Eo(Q.prototype);Q.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new So(t),r=this;try{Ut("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var n in this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&e.setRequestHeader(n,this.extraHeaders[n])}}catch{}if(this.method==="POST")try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{e.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in e&&(e.withCredentials=this.withCredentials),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){r.onLoad()},e.onerror=function(){r.onError(e.responseText)}):e.onreadystatechange=function(){if(e.readyState===2)try{var o=e.getResponseHeader("Content-Type");(r.supportsBinary&&o==="application/octet-stream"||o==="application/octet-stream; charset=UTF-8")&&(e.responseType="arraybuffer")}catch{}e.readyState===4&&(e.status===200||e.status===1223?r.onLoad():setTimeout(function(){r.onError(typeof e.status=="number"?e.status:0)},0))},Ut("xhr data %s",this.data),e.send(this.data)}catch(o){setTimeout(function(){r.onError(o)},0);return}typeof document<"u"&&(this.index=Q.requestsCount++,Q.requests[this.index]=this)};Q.prototype.onSuccess=function(){this.emit("success"),this.cleanup()};Q.prototype.onData=function(t){this.emit("data",t),this.onSuccess()};Q.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)};Q.prototype.cleanup=function(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=cr:this.xhr.onreadystatechange=cr,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Q.requests[this.index],this.xhr=null}};Q.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch{}e==="application/octet-stream"||e==="application/octet-stream; charset=UTF-8"?t=this.xhr.response||this.xhr.responseText:t=this.xhr.responseText}catch(r){this.onError(r)}t!=null&&this.onData(t)};Q.prototype.hasXDR=function(){return typeof XDomainRequest<"u"&&!this.xs&&this.enablesXDR};Q.prototype.abort=function(){this.cleanup()};Q.requestsCount=0;Q.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ur);else if(typeof addEventListener=="function"){var No="onpagehide"in To?"pagehide":"unload";addEventListener(No,ur,!1)}}function ur(){for(var t in Q.requests)Q.requests.hasOwnProperty(t)&&Q.requests[t].abort()}var xo=Wt.exports,Ht=Xr,Oo=st,hr=zt,Ro=Ae,Lo=/\n/g,Io=/\\n/g,$e;function _o(){}function Ae(t){Ht.call(this,t),this.query=this.query||{},$e||($e=hr.___eio=hr.___eio||[]),this.index=$e.length;var e=this;$e.push(function(r){e.onData(r)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){e.script&&(e.script.onerror=_o)},!1)}Oo(Ae,Ht);Ae.prototype.supportsBinary=!1;Ae.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),Ht.prototype.doClose.call(this)};Ae.prototype.doPoll=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(o){t.onError("jsonp poll error",o)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e;var n=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var o=document.createElement("iframe");document.body.appendChild(o),document.body.removeChild(o)},100)};Ae.prototype.doWrite=function(t,e){var r=this;if(!this.form){var n=document.createElement("form"),o=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index,l;n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=a,n.method="POST",n.setAttribute("accept-charset","utf-8"),o.name="d",n.appendChild(o),document.body.appendChild(n),this.form=n,this.area=o}this.form.action=this.uri();function p(){f(),e()}function f(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(h){r.onError("jsonp polling iframe removal error",h)}try{var i='<iframe src="javascript:0" name="'+r.iframeId+'">';l=document.createElement(i)}catch{l=document.createElement("iframe"),l.name=r.iframeId,l.src="javascript:0"}l.id=r.iframeId,r.form.appendChild(l),r.iframe=l}f(),t=t.replace(Io,`\\
|
|
19
|
-
`),this.area.value=t.replace(Lo,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&p()}:this.iframe.onload=p};const Bo={},Fo=Object.freeze(Object.defineProperty({__proto__:null,default:Bo},Symbol.toStringTag,{value:"Module"})),Uo=kn(Fo);var $t=Jt(),Do=Ce,Po=ot(),jo=st,Mo=Mr,qo=it("engine.io-client:websocket"),Ze,Vt;typeof WebSocket<"u"?Ze=WebSocket:typeof self<"u"&&(Ze=self.WebSocket||self.MozWebSocket);if(typeof window>"u")try{Vt=Uo}catch{}var we=Ze||Vt,zo=se;function se(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=Ze&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(we=Vt),$t.call(this,t)}jo(se,$t);se.prototype.name="websocket";se.prototype.supportsBinary=!0;se.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new we(t,e):new we(t):new we(t,e,r)}catch(n){return this.emit("error",n)}this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}};se.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}};se.prototype.write=function(t){var e=this;this.writable=!1;for(var r=t.length,n=0,o=r;n<o;n++)(function(l){Do.encodePacket(l,e.supportsBinary,function(p){if(!e.usingBrowserWebSocket){var f={};if(l.options&&(f.compress=l.options.compress),e.perMessageDeflate){var i=typeof p=="string"?Buffer.byteLength(p):p.length;i<e.perMessageDeflate.threshold&&(f.compress=!1)}}try{e.usingBrowserWebSocket?e.ws.send(p):e.ws.send(p,f)}catch{qo("websocket closed before onclose event")}--r||a()})})(t[n]);function a(){e.emit("flush"),setTimeout(function(){e.writable=!0,e.emit("drain")},0)}};se.prototype.onClose=function(){$t.prototype.onClose.call(this)};se.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()};se.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";this.port&&(e==="wss"&&Number(this.port)!==443||e==="ws"&&Number(this.port)!==80)&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=Mo()),this.supportsBinary||(t.b64=1),t=Po.encode(t),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t};se.prototype.check=function(){return!!we&&!("__initialize"in we&&this.name===se.prototype.name)};var Xo=Xt,Wo=xo,Jo=Ro,Go=zo;nt.polling=Ho;nt.websocket=Go;function Ho(t){var e,r=!1,n=!1,o=t.jsonp!==!1;if(typeof location<"u"){var a=location.protocol==="https:",l=location.port;l||(l=a?443:80),r=t.hostname!==location.hostname||l!==t.port,n=t.secure!==a}if(t.xdomain=r,t.xscheme=n,e=new Xo(t),"open"in e&&!t.forceJSONP)return new Wo(t);if(!o)throw new Error("JSONP disabled");return new Jo(t)}var $o=[].indexOf,Jr=function(t,e){if($o)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1},Vo=nt,Ko=Se,Y=it("engine.io-client:socket"),Yo=Jr,Gr=Ce,pr=Rr,Qo=ot(),Zo=W;function W(t,e){if(!(this instanceof W))return new W(t,e);e=e||{},t&&typeof t=="object"&&(e=t,t=null),t?(t=pr(t),e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=pr(e.host).host),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?443:80),this.query=e.query||{},typeof this.query=="string"&&(this.query=Qo.decode(this.query)),this.upgrade=e.upgrade!==!1,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=e.jsonp!==!1,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=e.withCredentials!==!1,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=e.perMessageDeflate!==!1?e.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||void 0,this.key=e.key||void 0,this.passphrase=e.passphrase||void 0,this.cert=e.cert||void 0,this.ca=e.ca||void 0,this.ciphers=e.ciphers||void 0,this.rejectUnauthorized=e.rejectUnauthorized===void 0?!0:e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self>"u"||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}W.priorWebsocketSuccess=!1;Ko(W.prototype);W.protocol=Gr.protocol;W.Socket=W;W.Transport=Jt();W.transports=nt;W.parser=Ce;W.prototype.createTransport=function(t){Y('creating transport "%s"',t);var e=es(this.query);e.EIO=Gr.protocol,e.transport=t;var r=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var n=new Vo[t]({query:e,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,withCredentials:r.withCredentials||this.withCredentials,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative});return n};function es(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}W.prototype.open=function(){var t;if(this.rememberUpgrade&&W.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){var e=this;setTimeout(function(){e.emit("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)};W.prototype.setTransport=function(t){Y("setting transport %s",t.name);var e=this;this.transport&&(Y("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(r){e.onPacket(r)}).on("error",function(r){e.onError(r)}).on("close",function(){e.onClose("transport close")})};W.prototype.probe=function(t){Y('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),r=!1,n=this;W.priorWebsocketSuccess=!1;function o(){if(n.onlyBinaryUpgrades){var u=!this.supportsBinary&&n.transport.supportsBinary;r=r||u}r||(Y('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",function(c){if(!r)if(c.type==="pong"&&c.data==="probe"){if(Y('probe transport "%s" pong',t),n.upgrading=!0,n.emit("upgrading",e),!e)return;W.priorWebsocketSuccess=e.name==="websocket",Y('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(Y("changing transport and sending upgrade packet"),h(),n.setTransport(e),e.send([{type:"upgrade"}]),n.emit("upgrade",e),e=null,n.upgrading=!1,n.flush())})}else{Y('probe transport "%s" failed',t);var s=new Error("probe error");s.transport=e.name,n.emit("upgradeError",s)}}))}function a(){r||(r=!0,h(),e.close(),e=null)}function l(u){var c=new Error("probe error: "+u);c.transport=e.name,a(),Y('probe transport "%s" failed because of error: %s',t,u),n.emit("upgradeError",c)}function p(){l("transport closed")}function f(){l("socket closed")}function i(u){e&&u.name!==e.name&&(Y('"%s" works - aborting "%s"',u.name,e.name),a())}function h(){e.removeListener("open",o),e.removeListener("error",l),e.removeListener("close",p),n.removeListener("close",f),n.removeListener("upgrading",i)}e.once("open",o),e.once("error",l),e.once("close",p),this.once("close",f),this.once("upgrading",i),e.open()};W.prototype.onOpen=function(){if(Y("socket open"),this.readyState="open",W.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){Y("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}};W.prototype.onPacket=function(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(Y('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),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);break}else Y('packet received with socket readyState "%s"',this.readyState)};W.prototype.onHandshake=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(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))};W.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){e.readyState!=="closed"&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)};W.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){Y("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)};W.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})};W.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()};W.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(Y("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))};W.prototype.write=W.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this};W.prototype.sendPacket=function(t,e,r,n){if(typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=null),!(this.readyState==="closing"||this.readyState==="closed")){r=r||{},r.compress=r.compress!==!1;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}};W.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():e()}):this.upgrading?n():e()}function e(){t.onClose("forced close"),Y("socket closing - telling transport to close"),t.transport.close()}function r(){t.removeListener("upgrade",r),t.removeListener("upgradeError",r),e()}function n(){t.once("upgrade",r),t.once("upgradeError",r)}return this};W.prototype.onError=function(t){Y("socket error %j",t),W.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)};W.prototype.onClose=function(t,e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){Y('socket close with reason: "%s"',t);var r=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",t,e),r.writeBuffer=[],r.prevBufferLen=0}};W.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~Yo(this.transports,t[r])&&e.push(t[r]);return e};qt.exports=Zo;qt.exports.parser=Ce;var ts=qt.exports,lr={exports:{}},kt,fr;function rs(){if(fr)return kt;fr=1,kt=t;function t(e,r){var n=[];r=r||0;for(var o=r||0;o<e.length;o++)n[o-r]=e[o];return n}return kt}var Hr=ns;function ns(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}var dr=[].slice,$r=function(t,e){if(typeof e=="string"&&(e=t[e]),typeof e!="function")throw new Error("bind() requires a function");var r=dr.call(arguments,2);return function(){return e.apply(t,r.concat(dr.call(arguments)))}},gr;function Vr(){return gr||(gr=1,function(t,e){var r=tt,n=Se,o=rs(),a=Hr,l=$r,p=et("socket.io-client:socket"),f=ot(),i=Fr();t.exports=c;var h={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},u=n.prototype.emit;function c(s,d,g){this.io=s,this.nsp=d,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},g&&g.query&&(this.query=g.query),this.io.autoConnect&&this.open()}n(c.prototype),c.prototype.subEvents=function(){if(!this.subs){var s=this.io;this.subs=[a(s,"open",l(this,"onopen")),a(s,"packet",l(this,"onpacket")),a(s,"close",l(this,"onclose"))]}},c.prototype.open=c.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.reconnecting||this.io.open(),this.io.readyState==="open"&&this.onopen(),this.emit("connecting"),this)},c.prototype.send=function(){var s=o(arguments);return s.unshift("message"),this.emit.apply(this,s),this},c.prototype.emit=function(s){if(h.hasOwnProperty(s))return u.apply(this,arguments),this;var d=o(arguments),g={type:(this.flags.binary!==void 0?this.flags.binary:i(d))?r.BINARY_EVENT:r.EVENT,data:d};return g.options={},g.options.compress=!this.flags||this.flags.compress!==!1,typeof d[d.length-1]=="function"&&(p("emitting packet with ack id %d",this.ids),this.acks[this.ids]=d.pop(),g.id=this.ids++),this.connected?this.packet(g):this.sendBuffer.push(g),this.flags={},this},c.prototype.packet=function(s){s.nsp=this.nsp,this.io.packet(s)},c.prototype.onopen=function(){if(p("transport is open - connecting"),this.nsp!=="/")if(this.query){var s=typeof this.query=="object"?f.encode(this.query):this.query;p("sending connect packet with query %s",s),this.packet({type:r.CONNECT,query:s})}else this.packet({type:r.CONNECT})},c.prototype.onclose=function(s){p("close (%s)",s),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",s)},c.prototype.onpacket=function(s){var d=s.nsp===this.nsp,g=s.type===r.ERROR&&s.nsp==="/";if(!(!d&&!g))switch(s.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(s);break;case r.BINARY_EVENT:this.onevent(s);break;case r.ACK:this.onack(s);break;case r.BINARY_ACK:this.onack(s);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",s.data);break}},c.prototype.onevent=function(s){var d=s.data||[];p("emitting event %j",d),s.id!=null&&(p("attaching ack callback to event"),d.push(this.ack(s.id))),this.connected?u.apply(this,d):this.receiveBuffer.push(d)},c.prototype.ack=function(s){var d=this,g=!1;return function(){if(!g){g=!0;var m=o(arguments);p("sending ack %j",m),d.packet({type:i(m)?r.BINARY_ACK:r.ACK,id:s,data:m})}}},c.prototype.onack=function(s){var d=this.acks[s.id];typeof d=="function"?(p("calling ack %s with %j",s.id,s.data),d.apply(this,s.data),delete this.acks[s.id]):p("bad ack %s",s.id)},c.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},c.prototype.emitBuffered=function(){var s;for(s=0;s<this.receiveBuffer.length;s++)u.apply(this,this.receiveBuffer[s]);for(this.receiveBuffer=[],s=0;s<this.sendBuffer.length;s++)this.packet(this.sendBuffer[s]);this.sendBuffer=[]},c.prototype.ondisconnect=function(){p("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},c.prototype.destroy=function(){if(this.subs){for(var s=0;s<this.subs.length;s++)this.subs[s].destroy();this.subs=null}this.io.destroy(this)},c.prototype.close=c.prototype.disconnect=function(){return this.connected&&(p("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},c.prototype.compress=function(s){return this.flags.compress=s,this},c.prototype.binary=function(s){return this.flags.binary=s,this}}(lr)),lr.exports}var os=Te;function Te(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Te.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+r:t-r}return Math.min(t,this.max)|0};Te.prototype.reset=function(){this.attempts=0};Te.prototype.setMin=function(t){this.ms=t};Te.prototype.setMax=function(t){this.max=t};Te.prototype.setJitter=function(t){this.jitter=t};var ss=ts,is=Vr(),as=Se,cs=tt,ge=Hr,ke=$r,ee=et("socket.io-client:manager"),Kr=Jr,us=os,Yr=Object.prototype.hasOwnProperty,yr=H;function H(t,e){if(!(this instanceof H))return new H(t,e);t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new us({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||cs;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}H.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)Yr.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)};H.prototype.updateSocketIds=function(){for(var t in this.nsps)Yr.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))};H.prototype.generateId=function(t){return(t==="/"?"":t+"#")+this.engine.id};as(H.prototype);H.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection};H.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts};H.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay};H.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor};H.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax};H.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout};H.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()};H.prototype.open=H.prototype.connect=function(t,e){if(ee("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;ee("opening %s",this.uri),this.engine=ss(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var o=ge(r,"open",function(){n.onopen(),t&&t()}),a=ge(r,"error",function(f){if(ee("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",f),t){var i=new Error("Connection error");i.data=f,t(i)}else n.maybeReconnectOnOpen()});if(this._timeout!==!1){var l=this._timeout;ee("connect attempt will timeout after %d",l),l===0&&o.destroy();var p=setTimeout(function(){ee("connect attempt timed out after %d",l),o.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",l)},l);this.subs.push({destroy:function(){clearTimeout(p)}})}return this.subs.push(o),this.subs.push(a),this};H.prototype.onopen=function(){ee("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(ge(t,"data",ke(this,"ondata"))),this.subs.push(ge(t,"ping",ke(this,"onping"))),this.subs.push(ge(t,"pong",ke(this,"onpong"))),this.subs.push(ge(t,"error",ke(this,"onerror"))),this.subs.push(ge(t,"close",ke(this,"onclose"))),this.subs.push(ge(this.decoder,"decoded",ke(this,"ondecoded")))};H.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")};H.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};H.prototype.ondata=function(t){this.decoder.add(t)};H.prototype.ondecoded=function(t){this.emit("packet",t)};H.prototype.onerror=function(t){ee("error",t),this.emitAll("error",t)};H.prototype.socket=function(t,e){var r=this.nsps[t];if(!r){r=new is(this,t,e),this.nsps[t]=r;var n=this;r.on("connecting",o),r.on("connect",function(){r.id=n.generateId(t)}),this.autoConnect&&o()}function o(){~Kr(n.connecting,r)||n.connecting.push(r)}return r};H.prototype.destroy=function(t){var e=Kr(this.connecting,t);~e&&this.connecting.splice(e,1),!this.connecting.length&&this.close()};H.prototype.packet=function(t){ee("writing packet %j",t);var e=this;t.query&&t.type===0&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))};H.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}};H.prototype.cleanup=function(){ee("cleanup");for(var t=this.subs.length,e=0;e<t;e++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()};H.prototype.close=H.prototype.disconnect=function(){ee("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()};H.prototype.onclose=function(t){ee("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()};H.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)ee("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();ee("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(ee("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),!t.skipReconnect&&t.open(function(n){n?(ee("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",n.data)):(ee("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}};H.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)};(function(t,e){var r=_n,n=tt,o=yr,a=et("socket.io-client");t.exports=e=p;var l=e.managers={};function p(f,i){typeof f=="object"&&(i=f,f=void 0),i=i||{};var h=r(f),u=h.source,c=h.id,s=h.path,d=l[c]&&s in l[c].nsps,g=i.forceNew||i["force new connection"]||i.multiplex===!1||d,m;return g?(a("ignoring socket cache for %s",u),m=o(u,i)):(l[c]||(a("new io instance for %s",u),l[c]=o(u,i)),m=l[c]),h.query&&!i.query&&(i.query=h.query),m.socket(h.path,i)}e.protocol=n.protocol,e.connect=p,e.Manager=yr,e.Socket=Vr()})(At,At.exports);var hs=At.exports;const ps=bn(hs);let Ve;const ls=new Uint8Array(16);function fs(){if(!Ve&&(Ve=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ve))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ve(ls)}const Z=[];for(let t=0;t<256;++t)Z.push((t+256).toString(16).slice(1));function ds(t,e=0){return Z[t[e+0]]+Z[t[e+1]]+Z[t[e+2]]+Z[t[e+3]]+"-"+Z[t[e+4]]+Z[t[e+5]]+"-"+Z[t[e+6]]+Z[t[e+7]]+"-"+Z[t[e+8]]+Z[t[e+9]]+"-"+Z[t[e+10]]+Z[t[e+11]]+Z[t[e+12]]+Z[t[e+13]]+Z[t[e+14]]+Z[t[e+15]]}const gs=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),mr={randomUUID:gs};function ys(t,e,r){if(mr.randomUUID&&!t)return mr.randomUUID();t=t||{};const n=t.random||(t.rng||fs)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,ds(n)}function ms(t,e){const r=e.map(o=>JSON.stringify(o)).join(" "),n=new Date().toISOString();return JSON.stringify({level:t,time:n,message:r})}function vs(t,e){const r=JSON.parse(t);return e.forEach(n=>delete r[n]),r}function Cs(t){if(typeof t=="object"&&t!==null)return t;try{return JSON.parse(t)}catch{return{extraData:t}}}function bs(t){const e=/\(([^)]+)\)/,r=t.match(e);if(r&&r[1]){const n=r[1].split(";");for(let o of n)if(o=o.trim(),o.startsWith("Windows")||o.startsWith("Macintosh")||o.startsWith("Linux"))return o}return"Unknown"}function vr(t){return(...e)=>new Promise((r,n)=>{try{const o=t(...e);r(o)}catch(o){n(o)}})}const ks={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},wt={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},ce={CREATE:"Create",READ:"Read",UPDATE:"Update",DELETE:"Delete",CONVERT:"Convert",DOWNLOAD:"Download",UPLOAD:"Upload",ENCRYPT:"Encrypt",DECRYPT:"Decrypt",FILTER:"Filter",INPUT:"Input",OUTPUT:"Output",PLUGIN:"Plugin",LOGIN:"Login",LOGOUT:"Logout",REFRESH:"Refresh",CHECK:"Check",WEBHOOK:"Webhook",WSCONNECT:"WSConnect"},ws={Create:1,Read:2,Update:3,Delete:4,Convert:5,Download:6,Upload:7,Encrypt:8,Decrypt:9,Filter:10,Input:11,Output:12,Plugin:13,Login:14,Logout:15,Refresh:16,Check:17,Webhook:18,WSConnect:19},ue={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},J={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let re=console;class Ss{constructor(e){$(this,"logToConsole"),$(this,"overloadGlobalConsole"),$(this,"system"),$(this,"socketEmitInterval"),$(this,"storageId"),$(this,"loggerLevel",J.DEBUG),$(this,"loggerLevelMap",{[J.DEBUG]:[J.DEBUG,J.INFO,J.WARNING,J.ERROR],[J.INFO]:[J.INFO,J.WARNING,J.ERROR],[J.WARNING]:[J.WARNING,J.ERROR],[J.ERROR]:[J.ERROR]}),$(this,"emitInProgress"),$(this,"queue"),$(this,"processing"),$(this,"storageInitialized"),$(this,"interval"),$(this,"logIndex"),$(this,"socket"),$(this,"requestUrl"),$(this,"staticObject",{}),$(this,"localObject",{}),$(this,"isGetItemAsync"),$(this,"isSetItemAsync"),$(this,"getItem"),$(this,"setItem"),$(this,"parseLog"),$(this,"_logMethod"),$(this,"_warnMethod"),$(this,"_errorMethod"),$(this,"_debugMethod");const{loggerOptions:r}=e;if(!r.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=r.isGetItemAsync||!1,this.isSetItemAsync=r.isSetItemAsync||!1,this.setupStorageFunctions(r.getItem,r.setItem,r.parseLog),this.system=r.system,r.loggerLevel&&(this.loggerLevel=r.loggerLevel),this.socketEmitInterval=r.socketEmitInterval||wt.socketEmitInterval,this.logToConsole=r.logToConsole!==void 0?r.logToConsole:wt.logToConsole,this.overloadGlobalConsole=r.overloadGlobalConsole!==void 0?r.overloadGlobalConsole:wt.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.storageInitialized=!1,this.emitInProgress=!1,this.logIndex=0,this.init(e)}get currentLoggerLevelLogLevels(){return this.loggerLevelMap[this.loggerLevel]}isLogLevelAllowed(e){return this.currentLoggerLevelLogLevels.includes(e)}setupStorageFunctions(e,r,n){this.getItem=e&&typeof e=="function"?this.isGetItemAsync?e:vr(e):this.defaultGetItemFunction,this.setItem=r&&typeof r=="function"?this.isSetItemAsync?r:vr(r):this.defaultSetItemFunction,this.parseLog=n&&typeof n=="function"?n:ms}sendHttpRequest(e){if(!this.requestUrl)throw new Error("requestUrl is not provided");const r={Data:e};return fetch(this.requestUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}init(e){const{socket:r,url:n,requestUrl:o,socketOptions:a={}}=e;this._logMethod=re.log.bind(re),this._warnMethod=re.warn.bind(re),this._errorMethod=re.error.bind(re),this._debugMethod=re.debug.bind(re),this.initStorage().then(()=>{if(r)this.socket=r;else if(n)this.socket=this.createConnection(n,a);else if(o)this.requestUrl=o;else throw new Error("Must provide either a 'socket', 'requestUrl' or a 'url' for logger requests");this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval),this.overloadGlobalConsole&&this._overloadConsole()})}createConnection(e,r){let n={...ks};return r&&(n={...n,...r}),ps(e,n)}async emitLogs(){if(!this.emitInProgress)try{const e=await this.getItem(this.storageId),r=JSON.parse(e||"{}"),n={...this.localObject,...r};if(!Object.keys(n).length)return;const o=[];this.emitInProgress=!0;const a=Object.keys(n);if(!a.length)return;if((!this.socket||!this.socket.connected)&&!this.requestUrl)throw new Error("Log request can't be sent. Socket is disconnected or requestUrl is not provided");const l=[];for(const i of a){const h=Cs(n[i]),u={...this.staticObject,...h},c=this.populateSendingLog(u);c.Body&&typeof c.Body=="string"&&(c.Body=JSON.parse(c.Body)),this.socket?this.socket.emit("Log",c):this.requestUrl&&l.push(c),o.push(i)}l.length&&await this.sendHttpRequest(l);const p=await this.getItem(this.storageId);if(!p)return;const f=vs(p,o);this.localObject={},await this.setItem(this.storageId,JSON.stringify(f))}catch(e){this._errorMethod(e)}finally{this.emitInProgress=!1}}populateSendingLog(e){const r={...e},n=r.ActionName;return n&&(r.ActionID=ws[n]),r}setupStaticFields(e){this.staticObject={...e}}populateMetaData(){const e=new Date;let r;typeof window<"u"&&typeof window.document<"u"?r=window==null?void 0:window.navigator.userAgent:typeof self<"u"&&self.navigator&&(r=self.navigator.userAgent);let n;return r&&(n=bs(r)),{System:this.system,DateTime:e,UserAgent:r,OSVersion:n}}async stop(){!this.socket||!this.socket.connected||(clearInterval(this.interval),await this.emitLogs(),this.socket.disconnect())}async start(){var e;this.socket&&this.socket.connected||((e=this.socket)==null||e.connect(),this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval))}_overloadConsole(){re=Object.assign(re,{log:e=>{this.log(e)},warn:e=>{this.warn(e)},error:e=>{this.error(e)},debug:e=>{this.debug(e)}})}async initStorage(){const e=await this.getItem(this.storageId);(!e||typeof e!="string")&&(await this.setItem(this.storageId,JSON.stringify({})),this.storageInitialized=!0)}async resetStorage(){await this.setItem(this.storageId,JSON.stringify({}))}getStorageName(){const e=ys();return this.system.toString().toUpperCase()+e+Date.now()}async processLog(...e){try{if(e.length<2)return;const r=e[0],n=e[1],o=this.formItemKey(r);if(!this.storageInitialized){this.localObject={...this.localObject,[o]:n};return}const a=await this.getItem(this.storageId);if(!a)return;const l=JSON.parse(a);l[o]=JSON.stringify(n),await this.setItem(this.storageId,JSON.stringify(l))}catch(r){this._errorMethod(r)}}async processQueue(){if(this.processing||this.queue.length===0)return;const e=this.queue.shift();e&&(this.processing=!0,await this.processLog(...e).finally(()=>{this.processing=!1,this.processQueue()}))}log(e){if(!this.isLogLevelAllowed(J.INFO))return;const r={...this.populateMetaData(),...e},n=["INFO",r];this.queue.push(n),this.logToConsole&&this._logMethod.apply(re,[r]),this.processQueue()}warn(e){if(!this.isLogLevelAllowed(J.WARNING))return;const r=["WARN",e];this.queue.push(r),this.logToConsole&&this._warnMethod.apply(re,[e]),this.processQueue()}error(e){if(!this.isLogLevelAllowed(J.ERROR))return;const r=["ERROR",e];this.queue.push(r),this.logToConsole&&this._errorMethod.apply(re,[e]),this.processQueue()}debug(e){if(!this.isLogLevelAllowed(J.DEBUG))return;const r=["DEBUG",e];this.queue.push(r),this.logToConsole&&this._debugMethod.apply(re,[e]),this.processQueue()}async defaultGetItemFunction(e){return localStorage.getItem(e)}async defaultSetItemFunction(e,r){try{localStorage.setItem(e,r)}catch(n){this._errorMethod(n)}}formItemKey(e){const r=new Date().toISOString();return this.logIndex++,`${e}-${this.system}-${r}-${this.logIndex}`}}class Es{constructor(e){G(this,"storageLogger");this.eventsSdkClass=e,this.eventsSdkClass=e}init(){if(!this.eventsSdkClass.options.useLogger)return;if(this.eventsSdkClass.options.storageLoggerInstance){this.storageLogger=this.eventsSdkClass.options.storageLoggerInstance;return}let e;this.eventsSdkClass.options.loggerSocketConnection&&(e=this.eventsSdkClass.options.loggerSocketConnection),this.eventsSdkClass.socketIoClass.ioFunction&&!e&&(e=this.eventsSdkClass.socketIoClass.ioFunction(this.eventsSdkClass.options.loggerServer,this.eventsSdkClass.options.loggerConnectOptions)),e&&(this.storageLogger=new Ss({socket:e,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}async start(){this.storageLogger&&await this.storageLogger.start()}stop(){this.storageLogger&&this.storageLogger.stop()}log(e){this.eventsSdkClass.options.useLogger&&(this.storageLogger?e.Level===J.INFO?this.storageLogger.log(e):e.Level===J.ERROR&&this.storageLogger.error(e):e.Level===J.INFO?console.log(e):e.Level===J.ERROR&&console.error(e))}sdkConnectionSuccess(){const e={...this.eventsSdkClass.options,token:"CENSORED",password:"CENSORED"};this.log({Message:`Sdk connected to the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL}`,Body:JSON.stringify(e,this.eventsSdkClass.getCircularReplacer()),ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:J.INFO,LogType:ue.INFO})}sdkDisconnect(e){this.log({Message:`Sdk disconnected from the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL} (${e})`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:J.INFO,LogType:ue.INFO})}sdkAttemptToConnect(e){this.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${e}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:J.INFO,LogType:ue.INFO})}sdkAttemptToConnectError(e){this.log({Message:`${e}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:J.ERROR,LogType:ue.ERROR})}loginError(e,r,n,o){this.log({Message:`External login request error with the login type ${e} ${e===ie.TOKEN?n:o}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:r||400,Level:J.ERROR,LogType:ue.ERROR})}getSettingsError(e,r){this.log({Message:`Get settings error with token ${e}, error: ${r}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:J.ERROR,LogType:ue.ERROR})}refreshTokenError(e,r,n){this.log({Message:`Refresh token error with old refresh token ${e}, url: ${r}, error: ${n}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:J.ERROR,LogType:ue.ERROR})}keepAliveEmit(){this.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:ce.WSCONNECT,isShowClient:!1,Level:J.INFO,LogType:ue.INFO})}keepAliveResponse(e){this.log({Message:`Keep alive response: ${JSON.stringify(e)}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:J.INFO,LogType:ue.INFO})}eventLog(e,r){const n={[fe.FULL]:[],[fe.BOOTSTRAP]:[j.LOGIN_STATUS,j.LOGIN_SUCCESS,j.ALL_EXTENSION_STATUS,j.ALL_DIALER_STATUS],[fe.DEBUG_EXTENSIONS]:[j.ALL_EXTENSION_STATUS,j.EXTENSION_EVENT,j.EXTENSIONS_UPDATED],[fe.DEBUG_DIALER]:[j.ALL_DIALER_STATUS,j.DIALER_EVENT],[fe.DEBUG_QUEUE]:[j.QUEUE_EVENT]};this.eventsSdkClass.options.debugOption&&(n[this.eventsSdkClass.options.debugOption].includes(e)||this.eventsSdkClass.options.debugOption===fe.FULL)&&this.log({Message:`Event name: ${e}`,Body:r,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Successful",Level:J.DEBUG,LogType:ue.INFO})}}class As{constructor(e){G(this,"listeners",{[j.ALL_EXTENSION_STATUS]:[],[j.ALL_DIALER_STATUS]:[],[j.ALL_USERS_STATUS]:[],[j.QUEUE_EVENT]:[],[j.EXTENSION_EVENT]:[],[j.DIALER_EVENT]:[],[j.LOGIN_SUCCESS]:[],[j.LOGIN_STATUS]:[],[j.KEEP_ALIVE_RESPONSE]:[],[j.ONLINE_STATUS_EVENT]:[],[j.EXTENSIONS_UPDATED]:[]});G(this,"allListeners",[]);this.eventsSdkClass=e,this.eventsSdkClass=e}on(e,r){e==="*"?this.allListeners.push(r):this.listeners[e].push(r)}off(e,r){if(e==="*")this.allListeners=this.allListeners.filter(n=>n!==r);else{const o=this.listeners[e].filter(a=>a!==r);this.listeners={...this.listeners,[e]:o}}}emit(e,r){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[e].forEach(o=>o({name:e,data:r}));const n={name:e,data:r};this.allListeners.forEach(o=>o(n))}}class Ts{constructor(e){G(this,"options");G(this,"servers",[]);G(this,"URLList",[]);G(this,"server");G(this,"URL");G(this,"socket");G(this,"mainServer");G(this,"alreadyAttemptedOtherServers",[]);G(this,"authClass",new cn(this));G(this,"socketIoClass",new mn(this));G(this,"loggerClass",new Es(this));G(this,"eventEmitterClass",new As(this));G(this,"getCircularReplacer",()=>{const e=new WeakSet;return(r,n)=>{if(!(r==="socket"||r==="io"||r==="nsps")){if(typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}}});this.options={...un,...e}}on(e,r){this.eventEmitterClass.on(e,r)}emit(e,...r){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...r)}connect(e){e===he.MAIN&&this.findMainServer(),e===he.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.init()}catch(r){console.error(r)}this.socketIoClass.initSocketConnection(),this.socketIoClass.initSocketEvents(),this.socketIoClass.initKeepAlive()}disconnect(){this.socketIoClass.doReconnect=!1,this.socketIoClass.closeAllConnections(),this.loggerClass.stop()}clearKeepAliveInterval(){this.socketIoClass.clearKeepAliveInterval()}findMainServer(){this.servers.length?(this.mainServer=this.servers.reduce((e,r)=>r.Priority>e.Priority?r:e),this.server=this.mainServer):this.URLList.length&&(this.URL=this.URLList[0])}findNextServer(){if(this.servers.length&&this.server)if(this.server.Priority===this.mainServer.Priority){let e=this.servers.filter(r=>r.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(r.Priority)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.servers.filter(r=>r.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(r.Priority)+1===0)),e.length&&(this.server=e.reduce((r,n)=>n.Priority>r.Priority?n:r),this.alreadyAttemptedOtherServers.push(this.server.Priority))}else this.server=this.mainServer;else if(this.URLList.length)if(this.URL===this.URLList[0]){let e=this.URLList.filter(r=>r!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(r)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.URLList.filter(r=>r!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(r)+1===0)),e.length&&(this.URL=e[0],this.alreadyAttemptedOtherServers.push(this.URL))}else this.URL=this.URLList[0]}async init(){const e=await this.authClass.login();return e&&this.authClass.onLoginResponse(e),!0}getCurrentMonitorServer(){return this.server}}exports.CallStatusEnum=Sr;exports.CallTypeEnum=Er;exports.ConnectionStatusEnum=de;exports.DebugOption=fe;exports.DialerTypeEnum=Ar;exports.DirectionEnum=Tr;exports.DoNotCallMeStatusCodeEnum=Nr;exports.EventsEnum=j;exports.ExtensionEventReasonEnum=Dt;exports.ExtensionHangupCauseEnum=xr;exports.LoginType=ie;exports.QueueEventReasonEnum=Or;exports.ServerListenerEventsEnum=Pt;exports.ServerParameter=he;exports.default=Ts;
|
|
17
|
+
`+ft+"}":"{"+le.join(",")+"}":"{}";return D.pop(),dt}};u.stringify=function(I,F,B){var P,O,U,D;if(typeof F=="function"||typeof F=="object"&&F){if((D=f.call(F))==a)O=F;else if(D==m){U={};for(var _,q=0,V=F.length;V>q;_=F[q++],D=f.call(_),(D==y||D==d)&&(U[_]=1));}}if(B)if((D=f.call(B))==d){if((B-=B%1)>0)for(P="",B>10&&(B=10);P.length<B;P+=" ");}else D==y&&(P=B.length<=10?B:B.slice(0,10));return L("",(_={},_[""]=I,_),O,U,P,"",[])}}if(!o("json-parse")){var A,z,M=String.fromCharCode,K={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
|
|
18
|
+
`,102:"\f",114:"\r"},X=function(){throw A=z=null,SyntaxError()},te=function(){for(var I,F,B,P,O,U=z,D=U.length;D>A;)switch(O=U.charCodeAt(A)){case 9:case 10:case 13:case 32:A++;break;case 123:case 125:case 91:case 93:case 58:case 44:return I=T?U.charAt(A):U[A],A++,I;case 34:for(I="@",A++;D>A;)if(O=U.charCodeAt(A),32>O)X();else if(O==92)switch(O=U.charCodeAt(++A)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:I+=K[O],A++;break;case 117:for(F=++A,B=A+4;B>A;A++)O=U.charCodeAt(A),O>=48&&57>=O||O>=97&&102>=O||O>=65&&70>=O||X();I+=M("0x"+U.slice(F,A));break;default:X()}else{if(O==34)break;for(O=U.charCodeAt(A),F=A;O>=32&&O!=92&&O!=34;)O=U.charCodeAt(++A);I+=U.slice(F,A)}if(U.charCodeAt(A)==34)return A++,I;X();default:if(F=A,O==45&&(P=!0,O=U.charCodeAt(++A)),O>=48&&57>=O){for(O==48&&(O=U.charCodeAt(A+1),O>=48&&57>=O)&&X(),P=!1;D>A&&(O=U.charCodeAt(A),O>=48&&57>=O);A++);if(U.charCodeAt(A)==46){for(B=++A;D>B&&(O=U.charCodeAt(B),O>=48&&57>=O);B++);B==A&&X(),A=B}if(O=U.charCodeAt(A),O==101||O==69){for(O=U.charCodeAt(++A),(O==43||O==45)&&A++,B=A;D>B&&(O=U.charCodeAt(B),O>=48&&57>=O);B++);B==A&&X(),A=B}return+U.slice(F,A)}if(P&&X(),U.slice(A,A+4)=="true")return A+=4,!0;if(U.slice(A,A+5)=="false")return A+=5,!1;if(U.slice(A,A+4)=="null")return A+=4,null;X()}return"$"},Oe=function(I){var F,B;if(I=="$"&&X(),typeof I=="string"){if((T?I.charAt(0):I[0])=="@")return I.slice(1);if(I=="["){for(F=[];I=te(),I!="]";B||(B=!0))B&&(I==","?(I=te(),I=="]"&&X()):X()),I==","&&X(),F.push(Oe(I));return F}if(I=="{"){for(F={};I=te(),I!="}";B||(B=!0))B&&(I==","?(I=te(),I=="}"&&X()):X()),(I==","||typeof I!="string"||(T?I.charAt(0):I[0])!="@"||te()!=":")&&X(),F[I.slice(1)]=Oe(te());return F}X()}return I},$t=function(I,F,B){var P=Vt(I,F,B);P===p?delete I[F]:I[F]=P},Vt=function(I,F,B){var P,O=I[F];if(typeof O=="object"&&O)if(f.call(O)==m)for(P=O.length;P--;)$t(O,P,B);else l(O,function(U){$t(O,U,B)});return B.call(I,F,O)};u.parse=function(I,F){var B,P;return A=0,z=""+I,B=Oe(te()),te()!="$"&&X(),A=z=null,F&&f.call(F)==a?Vt((P={},P[""]=B,P),"",F):B}}}})(this)},{}],48:[function(t,e){function r(n,o){var c=[];o=o||0;for(var l=o||0;l<n.length;l++)c[l-o]=n[l];return c}e.exports=r},{}]},{},[1])(1)}const sn=Object.freeze(Object.defineProperty({__proto__:null,default:on},Symbol.toStringTag,{value:"Module"})),an=Object.assign({"./v1_3_7.js":sn}),cn=/v\d+_\d+_\d+/;function hn(t){return typeof t=="function"}const wt=Object.entries(an).reduce((t,e)=>{var o;const r=e[1].default,n=(o=e[0].match(cn))==null?void 0:o[0];return hn(r)&&n&&(t[n]=r()),t},{}),yr=t=>{if(t in wt)return wt[t];throw new Error(`Socket version ${t} not found`)},un=(t,...e)=>yr(t)(...e),pn={...wt,getSocketVersion:yr,makeSocketVersion:un};var gr=(t=>(t.RINGING="Ringing",t.TALKING="Talking",t.DIALING="Dialing",t.HOLD="Hold",t))(gr||{}),mr=(t=>(t.INCOMING="Incoming",t.OUTGOING="Outgoing",t))(mr||{}),de=(t=>(t.CONNECTED="connected",t.DISCONNECTED="disconnected",t.TRYING_TO_CONNECT="tryingToConnect",t))(de||{}),vr=(t=>(t.AUTOMATIC="Automatic",t.IVR="IVR",t))(vr||{}),Cr=(t=>(t.INCOMINC="Incoming",t.OUTGOING="Outgoing",t.SPY="Spy",t.CLICK2CALL="Click2Call",t))(Cr||{}),br=(t=>(t.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",t.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",t))(br||{}),j=(t=>(t.ALL_DIALER_STATUS="AllDialersStatus",t.ALL_EXTENSION_STATUS="AllExtensionsStatus",t.ALL_USERS_STATUS="AllUsersStatus",t.CONNECT="connect",t.DISCONNECT="disconnect",t.CONNECT_ERROR_EVENT="connect_error",t.EXTENSION_EVENT="ExtensionEvent",t.KEEP_ALIVE="keepalive",t.KEEP_ALIVE_RESPONSE="keepaliveResponse",t.LOGIN_STATUS="loginStatus",t.LOGIN_SUCCESS="loginSuccess",t.QUEUE_EVENT="QueueEvent",t.ONLINE_STATUS_EVENT="onlineStatusEvent",t.DIALER_EVENT="DialerEvent",t.EXTENSIONS_UPDATED="ExtensionsUpdated",t))(j||{}),Ft=(t=>(t.NEWCALL="NEWCALL",t.ANSWER="ANSWER",t.HOLD="HOLD",t.UNHOLD="UNHOLD",t.HANGUP="HANGUP",t.USER_STATUS_UPDATE="userStatusUpdate",t))(Ft||{}),kr=(t=>(t.NORMAL_HANGUP="Normal hangup",t.USER_BUSY="User busy",t.CALL_REJECTED="Call Rejected",t.UNALLOCATED_NUMBER="Unallocated (unassigned) number",t.UNKNOWN="Unknown",t.NO_USER_RESPONDING="No user responding",t.USER_ALERTING="User alerting, no answer",t.ANSWERED_ELSEWHERE="Answered elsewhere",t))(kr||{}),wr=(t=>(t.ANSWER="ANSWER",t.ABANDONED="ABANDONED",t.EXIT="EXIT",t.JOIN="JOIN",t))(wr||{});class Ge{static mapExtensionEvent(e){var l,p;const r=e.reason;let n,o;e.data.currentCall&&(o=this.mapExtensionCall(e,e.data.currentCall));const c=this.mapExtensionData(e,e.data);return r===Ft.HANGUP?n={...e,reason:r,data:{...c,currentCall:o?{...o,duration:o.callAnswered_UTC_CLIENT?Date.now()-o.callAnswered_UTC_CLIENT:0}:void 0,calls:(l=e.data.calls)==null?void 0:l.map(f=>{const i=this.mapExtensionCall(e,f);return{...i,duration:i.callAnswered_UTC_CLIENT?Date.now()-i.callAnswered_UTC_CLIENT:0}})}}:n={...e,data:{...c,currentCall:o,calls:(p=e.data.calls)==null?void 0:p.map(f=>this.mapExtensionCall(e,f))},reason:r},n}static mapAllExtensionStatus(e){return{...e,extensions:e.extensions.map(r=>{var n;return{...this.mapExtensionData(e,r),currentCall:r.currentCall?this.mapExtensionCall(e,r.currentCall):void 0,calls:(n=r.calls)==null?void 0:n.map(o=>this.mapExtensionCall(e,o))}})}}static mapExtensionData(e,r){return this.configureUTCForObject(r,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],e.servertime,e.servertimeoffset)}static mapExtensionCall(e,r){return this.configureUTCForObject(r,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],e.servertime,e.servertimeoffset)}static mapQueueCall(e,r){return this.configureUTCForObject(r,[{key:"JoinTimeStamp",format:"sec"},{key:"VHJoinTimeStamp",format:"sec"}],e.servertime,e.servertimeoffset)}static mapLoginStatusEvent(e){return{...e,queues:e.queues.map(r=>({...r,Calls:r.Calls.map(n=>this.mapQueueCall(e,n))}))}}static mapQueueEvent(e){return{...e,data:{...e.data,Calls:e.data.Calls.map(r=>this.mapQueueCall(e,r))}}}static assignProperty(e,r,n){e[r]=n}static configureUTCForObject(e,r,n,o){const c=(n-o*60)*1e3,l=Date.now()-c,p={};return r.forEach(f=>{const i=e[f.key],u=f.key;if(i!==0&&typeof i=="number"&&!isNaN(i)){let h=i;f.format==="ms"&&(h=Math.floor(h/1e3));const a=(h-o*60)*1e3;this.assignProperty(p,`${u}_UTC`,a),this.assignProperty(p,`${u}_UTC_CLIENT`,a+l)}else this.assignProperty(p,`${u}_UTC`,0),this.assignProperty(p,`${u}_UTC_CLIENT`,0)}),{...e,...p}}}var Ut=(t=>(t.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",t.KEEP_ALIVE="keepalive",t))(Ut||{});class ln{constructor(e){J(this,"io");J(this,"ioFunction");J(this,"lastEventTimestamp",new Date().getTime());J(this,"doReconnect",!0);J(this,"keepAliveInterval");J(this,"keepReconnectInterval");J(this,"keepReconnectTimeout");J(this,"connected",!1);J(this,"reconnectionTime",20);this.eventsSdkClass=e,this.eventsSdkClass=e,typeof window<"u"&&(window.addEventListener("offline",()=>{this.closeAllConnections()}),window.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(ue.NEXT)},5e3)})),typeof self<"u"&&typeof window>"u"&&typeof global>"u"&&(self.addEventListener("offline",()=>{this.closeAllConnections()}),self.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(ue.NEXT)},5e3)}))}getSocketIoFunction(e){const r=e.split("v="),n="v".concat(r[r.length-1]).replaceAll(".","_");this.ioFunction=pn.getSocketVersion(n)}initSocketConnection(){const e=this.eventsSdkClass.authClass.token,r=this.eventsSdkClass.options.protocol,n=this.eventsSdkClass.server;try{const o=n?n.Domain:this.eventsSdkClass.URL,c=n?`${r}://${o}`:this.eventsSdkClass.URL,l={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:e},timeout:this.eventsSdkClass.options.timeout};if(this.ioFunction&&c)this.io=this.ioFunction(c,l),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{attemptToConnect:c,connectionStatus:de.TRYING_TO_CONNECT}),this.eventsSdkClass.loggerClass.sdkAttemptToConnect(o);else throw new Error("Socket server url no defined")}catch(o){this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(o)}}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io&&this.eventsSdkClass.authClass.token){this.eventsSdkClass.emit(Ut.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.keepAliveEmit();return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var e;this.io&&(this.io.close(),(e=this.io)==null||e.disconnect(),this.io=void 0),this.eventsSdkClass.loggerClass.stop(),Le.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(j.LOGIN_SUCCESS,e=>this.onLoginSuccessEvent(e,j.LOGIN_SUCCESS)).on(j.QUEUE_EVENT,e=>this.onQueueEvent(e,j.QUEUE_EVENT)).on(j.EXTENSION_EVENT,e=>this.onExtensionEvent(e,j.EXTENSION_EVENT)).on(j.DIALER_EVENT,e=>this.onDialerEvent(e,j.DIALER_EVENT)).on(j.LOGIN_STATUS,e=>this.onLoginStatusEvent(e,j.LOGIN_STATUS)).on(j.ALL_EXTENSION_STATUS,e=>this.onAllExtensionStatus(e,j.ALL_EXTENSION_STATUS)).on(j.ALL_DIALER_STATUS,e=>this.onAllDialerStatus(e,j.ALL_DIALER_STATUS)).on(j.KEEP_ALIVE_RESPONSE,e=>this.onKeepAliveResponse(e)).on(j.EXTENSIONS_UPDATED,e=>this.onExtensionsUpdatedEvent(e,j.EXTENSIONS_UPDATED)).on(j.CONNECT,()=>this.onConnect()).on(j.DISCONNECT,e=>this.onDisconnect(e)).on(j.CONNECT_ERROR_EVENT,e=>this.onConnectError(e))}onLoginSuccessEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onQueueEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,Ge.mapQueueEvent(e))}onExtensionEvent(e,r){const n=Ge.mapExtensionEvent(e);n&&(this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,n))}onDialerEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onLoginStatusEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,Ge.mapLoginStatusEvent(e))}onAllExtensionStatus(e,r){const n=Ge.mapAllExtensionStatus(e);this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,n)}onAllDialerStatus(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onKeepAliveResponse(e){if(this.eventsSdkClass.loggerClass.keepAliveResponse(e),e.errorCode){this.initSocketConnection();return}this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onExtensionsUpdatedEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onConnect(){this.connected=!0,this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:de.CONNECTED}),this.eventsSdkClass.loggerClass.start().then(()=>{this.eventsSdkClass.loggerClass.sdkConnectionSuccess()})}onDisconnect(e){this.connected=!1,this.doReconnect&&(this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?de.TRYING_TO_CONNECT:de.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkDisconnect([e]),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(ue.NEXT)},this.reconnectionTime*1e3))}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?de.TRYING_TO_CONNECT:de.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(e),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(ue.NEXT)},this.reconnectionTime*1e3)}}var fn=Object.defineProperty,dn=(t,e,r)=>e in t?fn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$=(t,e,r)=>(dn(t,typeof e!="symbol"?e+"":e,r),r);function yn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function gn(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}),r}var St={exports:{}},mn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Sr=function(t){var e=t,r=t.indexOf("["),n=t.indexOf("]");r!=-1&&n!=-1&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));for(var o=mn.exec(t||""),c={},l=14;l--;)c[vn[l]]=o[l]||"";return r!=-1&&n!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=Cn(c,c.path),c.queryKey=bn(c,c.query),c};function Cn(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&n.splice(0,1),e.substr(e.length-1,1)=="/"&&n.splice(n.length-1,1),n}function bn(t,e){var r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,o,c){o&&(r[o]=c)}),r}var Et={exports:{}},At={exports:{}},Ie=1e3,Be=Ie*60,_e=Be*60,Fe=_e*24,kn=Fe*365.25,wn=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Sn(t);if(r==="number"&&isNaN(t)===!1)return e.long?An(t):En(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Sn(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*kn;case"days":case"day":case"d":return r*Fe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*_e;case"minutes":case"minute":case"mins":case"min":case"m":return r*Be;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ie;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function En(t){return t>=Fe?Math.round(t/Fe)+"d":t>=_e?Math.round(t/_e)+"h":t>=Be?Math.round(t/Be)+"m":t>=Ie?Math.round(t/Ie)+"s":t+"ms"}function An(t){return Je(t,Fe,"day")||Je(t,_e,"hour")||Je(t,Be,"minute")||Je(t,Ie,"second")||t+" ms"}function Je(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=c,e.enabled=p,e.humanize=wn,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var u=0,h;for(h in i)u=(u<<5)-u+i.charCodeAt(h),u|=0;return e.colors[Math.abs(u)%e.colors.length]}function n(i){var u;function h(){if(h.enabled){var a=h,s=+new Date,d=s-(u||s);a.diff=d,a.prev=u,a.curr=s,u=s;for(var y=new Array(arguments.length),m=0;m<y.length;m++)y[m]=arguments[m];y[0]=e.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");var v=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var g=y[v];R=S.call(a,g),y.splice(v,1),v--}return R}),e.formatArgs.call(a,y);var T=h.log||e.log||console.log.bind(console);T.apply(a,y)}}return h.namespace=i,h.enabled=e.enabled(i),h.useColors=e.useColors(),h.color=r(i),h.destroy=o,typeof e.init=="function"&&e.init(h),e.instances.push(h),h}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function c(i){e.save(i),e.names=[],e.skips=[];var u,h=(typeof i=="string"?i:"").split(/[\s,]+/),a=h.length;for(u=0;u<a;u++)h[u]&&(i=h[u].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(u=0;u<e.instances.length;u++){var s=e.instances[u];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var u,h;for(u=0,h=e.skips.length;u<h;u++)if(e.skips[u].test(i))return!1;for(u=0,h=e.names.length;u<h;u++)if(e.names[u].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(At,At.exports);var Tn=At.exports;(function(t,e){e=t.exports=Tn,e.log=o,e.formatArgs=n,e.save=c,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.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"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var u="color: "+this.color;f.splice(1,0,u,"color: inherit");var h=0,a=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(h++,s==="%c"&&(a=h))}),f.splice(a,0,u)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function c(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(Et,Et.exports);var rt=Et.exports,Nn=Sr,Qt=rt("socket.io-client:url"),On=xn;function xn(t,e){var r=t;e=e||typeof location<"u"&&location,t==null&&(t=e.protocol+"//"+e.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=e.protocol+t:t=e.host+t),/^(https?|wss?):\/\//.test(t)||(Qt("protocol-less url %s",t),typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),Qt("parse %s",t),r=Nn(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var n=r.host.indexOf(":")!==-1,o=n?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port,r.href=r.protocol+"://"+o+(e&&e.port===r.port?"":":"+r.port),r}var nt={},Tt={exports:{}},Nt={exports:{}},Ue=1e3,De=Ue*60,Pe=De*60,je=Pe*24,Rn=je*365.25,Ln=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return In(t);if(r==="number"&&isNaN(t)===!1)return e.long?_n(t):Bn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function In(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Rn;case"days":case"day":case"d":return r*je;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Pe;case"minutes":case"minute":case"mins":case"min":case"m":return r*De;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ue;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Bn(t){return t>=je?Math.round(t/je)+"d":t>=Pe?Math.round(t/Pe)+"h":t>=De?Math.round(t/De)+"m":t>=Ue?Math.round(t/Ue)+"s":t+"ms"}function _n(t){return He(t,je,"day")||He(t,Pe,"hour")||He(t,De,"minute")||He(t,Ue,"second")||t+" ms"}function He(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=c,e.enabled=p,e.humanize=Ln,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var u=0,h;for(h in i)u=(u<<5)-u+i.charCodeAt(h),u|=0;return e.colors[Math.abs(u)%e.colors.length]}function n(i){var u;function h(){if(h.enabled){var a=h,s=+new Date,d=s-(u||s);a.diff=d,a.prev=u,a.curr=s,u=s;for(var y=new Array(arguments.length),m=0;m<y.length;m++)y[m]=arguments[m];y[0]=e.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");var v=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var g=y[v];R=S.call(a,g),y.splice(v,1),v--}return R}),e.formatArgs.call(a,y);var T=h.log||e.log||console.log.bind(console);T.apply(a,y)}}return h.namespace=i,h.enabled=e.enabled(i),h.useColors=e.useColors(),h.color=r(i),h.destroy=o,typeof e.init=="function"&&e.init(h),e.instances.push(h),h}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function c(i){e.save(i),e.names=[],e.skips=[];var u,h=(typeof i=="string"?i:"").split(/[\s,]+/),a=h.length;for(u=0;u<a;u++)h[u]&&(i=h[u].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(u=0;u<e.instances.length;u++){var s=e.instances[u];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var u,h;for(u=0,h=e.skips.length;u<h;u++)if(e.skips[u].test(i))return!1;for(u=0,h=e.names.length;u<h;u++)if(e.names[u].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(Nt,Nt.exports);var Fn=Nt.exports;(function(t,e){e=t.exports=Fn,e.log=o,e.formatArgs=n,e.save=c,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.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"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var u="color: "+this.color;f.splice(1,0,u,"color: inherit");var h=0,a=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(h++,s==="%c"&&(a=h))}),f.splice(a,0,u)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function c(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(Tt,Tt.exports);var Un=Tt.exports,Er={exports:{}};(function(t){t.exports=e;function e(n){if(n)return r(n)}function r(n){for(var o in e.prototype)n[o]=e.prototype[o];return n}e.prototype.on=e.prototype.addEventListener=function(n,o){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(o),this},e.prototype.once=function(n,o){function c(){this.off(n,c),o.apply(this,arguments)}return c.fn=o,this.on(n,c),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(n,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var c=this._callbacks["$"+n];if(!c)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var l,p=0;p<c.length;p++)if(l=c[p],l===o||l.fn===o){c.splice(p,1);break}return c.length===0&&delete this._callbacks["$"+n],this},e.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var o=new Array(arguments.length-1),c=this._callbacks["$"+n],l=1;l<arguments.length;l++)o[l-1]=arguments[l];if(c){c=c.slice(0);for(var l=0,p=c.length;l<p;++l)c[l].apply(this,o)}return this},e.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},e.prototype.hasListeners=function(n){return!!this.listeners(n).length}})(Er);var Se=Er.exports,ot={},Dn={}.toString,Dt=Array.isArray||function(t){return Dn.call(t)=="[object Array]"},Ar=qn,Pn=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",jn=typeof ArrayBuffer=="function",Mn=function(t){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer};function qn(t){return Pn&&Buffer.isBuffer(t)||jn&&(t instanceof ArrayBuffer||Mn(t))}var Pt=Dt,Tr=Ar,Nr=Object.prototype.toString,zn=typeof Blob=="function"||typeof Blob<"u"&&Nr.call(Blob)==="[object BlobConstructor]",Xn=typeof File=="function"||typeof File<"u"&&Nr.call(File)==="[object FileConstructor]";ot.deconstructPacket=function(t){var e=[],r=t.data,n=t;return n.data=Ot(r,e),n.attachments=e.length,{packet:n,buffers:e}};function Ot(t,e){if(!t)return t;if(Tr(t)){var r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Pt(t)){for(var n=new Array(t.length),o=0;o<t.length;o++)n[o]=Ot(t[o],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){var n={};for(var c in t)n[c]=Ot(t[c],e);return n}return t}ot.reconstructPacket=function(t,e){return t.data=xt(t.data,e),t.attachments=void 0,t};function xt(t,e){if(!t)return t;if(t&&t._placeholder===!0){var r=typeof t.num=="number"&&t.num>=0&&t.num<e.length;if(r)return e[t.num];throw new Error("illegal attachments")}else if(Pt(t))for(var n=0;n<t.length;n++)t[n]=xt(t[n],e);else if(typeof t=="object")for(var o in t)t[o]=xt(t[o],e);return t}ot.removeBlobs=function(t,e){function r(c,l,p){if(!c)return c;if(zn&&c instanceof Blob||Xn&&c instanceof File){n++;var f=new FileReader;f.onload=function(){p?p[l]=this.result:o=this.result,--n||e(o)},f.readAsArrayBuffer(c)}else if(Pt(c))for(var i=0;i<c.length;i++)r(c[i],i,c);else if(typeof c=="object"&&!Tr(c))for(var u in c)r(c[u],u,c)}var n=0,o=t;r(o),n||e(o)};(function(t){var e=Un("socket.io-parser"),r=Se,n=ot,o=Dt,c=Ar;t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=l,t.Decoder=h;function l(){}var p=t.ERROR+'"encode error"';l.prototype.encode=function(v,T){if(e("encoding packet %j",v),t.BINARY_EVENT===v.type||t.BINARY_ACK===v.type)u(v,T);else{var R=f(v);T([R])}};function f(v){var T=""+v.type;if((t.BINARY_EVENT===v.type||t.BINARY_ACK===v.type)&&(T+=v.attachments+"-"),v.nsp&&v.nsp!=="/"&&(T+=v.nsp+","),v.id!=null&&(T+=v.id),v.data!=null){var R=i(v.data);if(R!==!1)T+=R;else return p}return e("encoded %j as %s",v,T),T}function i(v){try{return JSON.stringify(v)}catch{return!1}}function u(v,T){function R(b){var S=n.deconstructPacket(b),g=f(S.packet),w=S.buffers;w.unshift(g),T(w)}n.removeBlobs(v,R)}function h(){this.reconstructor=null}r(h.prototype),h.prototype.add=function(v){var T;if(typeof v=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");T=s(v),t.BINARY_EVENT===T.type||t.BINARY_ACK===T.type?(this.reconstructor=new y(T),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",T)):this.emit("decoded",T)}else if(c(v)||v.base64)if(this.reconstructor)T=this.reconstructor.takeBinaryData(v),T&&(this.reconstructor=null,this.emit("decoded",T));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+v)};function a(v,T){switch(v){case 0:return typeof T=="object";case 1:return T===void 0;case 4:return typeof T=="string"||typeof T=="object";case 2:case 5:return o(T)&&(typeof T[0]=="string"||typeof T[0]=="number");case 3:case 6:return o(T)}}function s(v){var T=0,R={type:Number(v.charAt(0))};if(t.types[R.type]==null)return m("unknown packet type "+R.type);if(t.BINARY_EVENT===R.type||t.BINARY_ACK===R.type){for(var b=T+1;v.charAt(++T)!=="-"&&T!=v.length;);var S=v.substring(b,T);if(S!=Number(S)||v.charAt(T)!=="-")throw new Error("Illegal attachments");R.attachments=Number(S)}if(v.charAt(T+1)==="/"){for(var b=T+1;++T;){var g=v.charAt(T);if(g===","||T===v.length)break}R.nsp=v.substring(b,T)}else R.nsp="/";var w=v.charAt(T+1);if(w!==""&&Number(w)==w){for(var b=T+1;++T;){var g=v.charAt(T);if(g==null||Number(g)!=g){--T;break}if(T===v.length)break}R.id=Number(v.substring(b,T+1))}if(v.charAt(++T)){var E=d(v.substr(T));if(a(R.type,E))R.data=E;else throw new Error("invalid payload")}return e("decoded %s as %j",v,R),R}function d(v){try{return JSON.parse(v)}catch{return!1}}h.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function y(v){this.reconPack=v,this.buffers=[]}y.prototype.takeBinaryData=function(v){if(this.buffers.push(v),this.buffers.length===this.reconPack.attachments){var T=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),T}return null},y.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function m(v){return{type:t.ERROR,data:"parser error: "+v}}})(nt);var jt={exports:{}},st={},Rt={exports:{}};try{Rt.exports=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{Rt.exports=!1}var Wn=Rt.exports,Mt=function(){return typeof self<"u"?self:typeof window<"u"?window:Function("return this")()}(),Gn=Wn,Jn=Mt,qt=function(t){var e=t.xdomain,r=t.xscheme,n=t.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!e||Gn))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!r&&n)return new XDomainRequest}catch{}if(!e)try{return new Jn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}},zt={exports:{}},Ce={},Hn=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e},$n=Dt,Or=Object.prototype.toString,Vn=typeof Blob=="function"||typeof Blob<"u"&&Or.call(Blob)==="[object BlobConstructor]",Kn=typeof File=="function"||typeof File<"u"&&Or.call(File)==="[object FileConstructor]",xr=Ye;function Ye(t){if(!t||typeof t!="object")return!1;if($n(t)){for(var e=0,r=t.length;e<r;e++)if(Ye(t[e]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(t)||typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Vn&&t instanceof Blob||Kn&&t instanceof File)return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Ye(t.toJSON(),!0);for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Ye(t[n]))return!0;return!1}var Yn=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||n===0)return new ArrayBuffer(0);for(var o=new Uint8Array(t),c=new Uint8Array(r-e),l=e,p=0;l<r;l++,p++)c[p]=o[l];return c.buffer},Qn=Zn;function Zn(t,e,r){var n=!1;return r=r||eo,o.count=t,t===0?e():o;function o(c,l){if(o.count<=0)throw new Error("after called too many times");--o.count,c?(n=!0,e(c),e=r):o.count===0&&!n&&e(null,l)}}function eo(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var ge=String.fromCharCode;function Rr(t){for(var e=[],r=0,n=t.length,o,c;r<n;)o=t.charCodeAt(r++),o>=55296&&o<=56319&&r<n?(c=t.charCodeAt(r++),(c&64512)==56320?e.push(((o&1023)<<10)+(c&1023)+65536):(e.push(o),r--)):e.push(o);return e}function to(t){for(var e=t.length,r=-1,n,o="";++r<e;)n=t[r],n>65535&&(n-=65536,o+=ge(n>>>10&1023|55296),n=56320|n&1023),o+=ge(n);return o}function Lr(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function gt(t,e){return ge(t>>e&63|128)}function ro(t,e){if(!(t&4294967168))return ge(t);var r="";return t&4294965248?t&4294901760?t&4292870144||(r=ge(t>>18&7|240),r+=gt(t,12),r+=gt(t,6)):(Lr(t,e)||(t=65533),r=ge(t>>12&15|224),r+=gt(t,6)):r=ge(t>>6&31|192),r+=ge(t&63|128),r}function no(t,e){e=e||{};for(var r=e.strict!==!1,n=Rr(t),o=n.length,c=-1,l,p="";++c<o;)l=n[c],p+=ro(l,r);return p}function be(){if(me>=Ze)throw Error("Invalid byte index");var t=Qe[me]&255;if(me++,(t&192)==128)return t&63;throw Error("Invalid continuation byte")}function oo(t){var e,r,n,o,c;if(me>Ze)throw Error("Invalid byte index");if(me==Ze)return!1;if(e=Qe[me]&255,me++,!(e&128))return e;if((e&224)==192){if(r=be(),c=(e&31)<<6|r,c>=128)return c;throw Error("Invalid continuation byte")}if((e&240)==224){if(r=be(),n=be(),c=(e&15)<<12|r<<6|n,c>=2048)return Lr(c,t)?c:65533;throw Error("Invalid continuation byte")}if((e&248)==240&&(r=be(),n=be(),o=be(),c=(e&7)<<18|r<<12|n<<6|o,c>=65536&&c<=1114111))return c;throw Error("Invalid UTF-8 detected")}var Qe,Ze,me;function so(t,e){e=e||{};var r=e.strict!==!1;Qe=Rr(t),Ze=Qe.length,me=0;for(var n=[],o;(o=oo(r))!==!1;)n.push(o);return to(n)}var io={version:"2.1.2",encode:no,decode:so},mt={},Zt;function ao(){return Zt||(Zt=1,function(t){mt.encode=function(e){var r=new Uint8Array(e),n,o=r.length,c="";for(n=0;n<o;n+=3)c+=t[r[n]>>2],c+=t[(r[n]&3)<<4|r[n+1]>>4],c+=t[(r[n+1]&15)<<2|r[n+2]>>6],c+=t[r[n+2]&63];return o%3===2?c=c.substring(0,c.length-1)+"=":o%3===1&&(c=c.substring(0,c.length-2)+"=="),c},mt.decode=function(e){var r=e.length*.75,n=e.length,o,c=0,l,p,f,i;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var u=new ArrayBuffer(r),h=new Uint8Array(u);for(o=0;o<n;o+=4)l=t.indexOf(e[o]),p=t.indexOf(e[o+1]),f=t.indexOf(e[o+2]),i=t.indexOf(e[o+3]),h[c++]=l<<2|p>>4,h[c++]=(p&15)<<4|f>>2,h[c++]=(f&3)<<6|i&63;return u}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),mt}var vt,er;function co(){if(er)return vt;er=1;var t=typeof t<"u"?t:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:!1,e=function(){try{var p=new Blob(["hi"]);return p.size===2}catch{return!1}}(),r=e&&function(){try{var p=new Blob([new Uint8Array([1,2])]);return p.size===2}catch{return!1}}(),n=t&&t.prototype.append&&t.prototype.getBlob;function o(p){return p.map(function(f){if(f.buffer instanceof ArrayBuffer){var i=f.buffer;if(f.byteLength!==i.byteLength){var u=new Uint8Array(f.byteLength);u.set(new Uint8Array(i,f.byteOffset,f.byteLength)),i=u.buffer}return i}return f})}function c(p,f){f=f||{};var i=new t;return o(p).forEach(function(u){i.append(u)}),f.type?i.getBlob(f.type):i.getBlob()}function l(p,f){return new Blob(o(p),f||{})}return typeof Blob<"u"&&(c.prototype=Blob.prototype,l.prototype=Blob.prototype),vt=function(){return e?r?Blob:l:n?c:void 0}(),vt}(function(t){var e=Hn,r=xr,n=Yn,o=Qn,c=io,l;typeof ArrayBuffer<"u"&&(l=ao());var p=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),f=typeof navigator<"u"&&/PhantomJS/i.test(navigator.userAgent),i=p||f;t.protocol=3;var u=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},h=e(u),a={type:"error",data:"parser error"},s=co();t.encodePacket=function(b,S,g,w){typeof S=="function"&&(w=S,S=!1),typeof g=="function"&&(w=g,g=null);var E=b.data===void 0?void 0:b.data.buffer||b.data;if(typeof ArrayBuffer<"u"&&E instanceof ArrayBuffer)return y(b,S,w);if(typeof s<"u"&&E instanceof s)return v(b,S,w);if(E&&E.base64)return d(b,w);var C=u[b.type];return b.data!==void 0&&(C+=g?c.encode(String(b.data),{strict:!1}):String(b.data)),w(""+C)};function d(b,S){var g="b"+t.packets[b.type]+b.data.data;return S(g)}function y(b,S,g){if(!S)return t.encodeBase64Packet(b,g);var w=b.data,E=new Uint8Array(w),C=new Uint8Array(1+w.byteLength);C[0]=u[b.type];for(var k=0;k<E.length;k++)C[k+1]=E[k];return g(C.buffer)}function m(b,S,g){if(!S)return t.encodeBase64Packet(b,g);var w=new FileReader;return w.onload=function(){t.encodePacket({type:b.type,data:w.result},S,!0,g)},w.readAsArrayBuffer(b.data)}function v(b,S,g){if(!S)return t.encodeBase64Packet(b,g);if(i)return m(b,S,g);var w=new Uint8Array(1);w[0]=u[b.type];var E=new s([w.buffer,b.data]);return g(E)}t.encodeBase64Packet=function(b,S){var g="b"+t.packets[b.type];if(typeof s<"u"&&b.data instanceof s){var w=new FileReader;return w.onload=function(){var x=w.result.split(",")[1];S(g+x)},w.readAsDataURL(b.data)}var E;try{E=String.fromCharCode.apply(null,new Uint8Array(b.data))}catch{for(var C=new Uint8Array(b.data),k=new Array(C.length),N=0;N<C.length;N++)k[N]=C[N];E=String.fromCharCode.apply(null,k)}return g+=btoa(E),S(g)},t.decodePacket=function(b,S,g){if(b===void 0)return a;if(typeof b=="string"){if(b.charAt(0)==="b")return t.decodeBase64Packet(b.substr(1),S);if(g&&(b=T(b),b===!1))return a;var E=b.charAt(0);return Number(E)!=E||!h[E]?a:b.length>1?{type:h[E],data:b.substring(1)}:{type:h[E]}}var w=new Uint8Array(b),E=w[0],C=n(b,1);return s&&S==="blob"&&(C=new s([C])),{type:h[E],data:C}};function T(b){try{b=c.decode(b,{strict:!1})}catch{return!1}return b}t.decodeBase64Packet=function(b,S){var g=h[b.charAt(0)];if(!l)return{type:g,data:{base64:!0,data:b.substr(1)}};var w=l.decode(b.substr(1));return S==="blob"&&s&&(w=new s([w])),{type:g,data:w}},t.encodePayload=function(b,S,g){typeof S=="function"&&(g=S,S=null);var w=r(b);if(S&&w)return s&&!i?t.encodePayloadAsBlob(b,g):t.encodePayloadAsArrayBuffer(b,g);if(!b.length)return g("0:");function E(k){return k.length+":"+k}function C(k,N){t.encodePacket(k,w?S:!1,!1,function(x){N(null,E(x))})}R(b,C,function(k,N){return g(N.join(""))})};function R(b,S,g){for(var w=new Array(b.length),E=o(b.length,g),C=function(N,x,L){S(x,function(A,z){w[N]=z,L(A,w)})},k=0;k<b.length;k++)C(k,b[k],E)}t.decodePayload=function(b,S,g){if(typeof b!="string")return t.decodePayloadAsBinary(b,S,g);typeof S=="function"&&(g=S,S=null);var w;if(b==="")return g(a,0,1);for(var E="",C,k,N=0,x=b.length;N<x;N++){var L=b.charAt(N);if(L!==":"){E+=L;continue}if(E===""||E!=(C=Number(E))||(k=b.substr(N+1,C),E!=k.length))return g(a,0,1);if(k.length){if(w=t.decodePacket(k,S,!1),a.type===w.type&&a.data===w.data)return g(a,0,1);var A=g(w,N+C,x);if(A===!1)return}N+=C,E=""}if(E!=="")return g(a,0,1)},t.encodePayloadAsArrayBuffer=function(b,S){if(!b.length)return S(new ArrayBuffer(0));function g(w,E){t.encodePacket(w,!0,!0,function(C){return E(null,C)})}R(b,g,function(w,E){var C=E.reduce(function(x,L){var A;return typeof L=="string"?A=L.length:A=L.byteLength,x+A.toString().length+A+2},0),k=new Uint8Array(C),N=0;return E.forEach(function(x){var L=typeof x=="string",A=x;if(L){for(var z=new Uint8Array(x.length),M=0;M<x.length;M++)z[M]=x.charCodeAt(M);A=z.buffer}L?k[N++]=0:k[N++]=1;for(var K=A.byteLength.toString(),M=0;M<K.length;M++)k[N++]=parseInt(K[M]);k[N++]=255;for(var z=new Uint8Array(A),M=0;M<z.length;M++)k[N++]=z[M]}),S(k.buffer)})},t.encodePayloadAsBlob=function(b,S){function g(w,E){t.encodePacket(w,!0,!0,function(C){var k=new Uint8Array(1);if(k[0]=1,typeof C=="string"){for(var N=new Uint8Array(C.length),x=0;x<C.length;x++)N[x]=C.charCodeAt(x);C=N.buffer,k[0]=0}for(var L=C instanceof ArrayBuffer?C.byteLength:C.size,A=L.toString(),z=new Uint8Array(A.length+1),x=0;x<A.length;x++)z[x]=parseInt(A[x]);if(z[A.length]=255,s){var M=new s([k.buffer,z.buffer,C]);E(null,M)}})}R(b,g,function(w,E){return S(new s(E))})},t.decodePayloadAsBinary=function(b,S,g){typeof S=="function"&&(g=S,S=null);for(var w=b,E=[];w.byteLength>0;){for(var C=new Uint8Array(w),k=C[0]===0,N="",x=1;C[x]!==255;x++){if(N.length>310)return g(a,0,1);N+=C[x]}w=n(w,2+N.length),N=parseInt(N);var L=n(w,0,N);if(k)try{L=String.fromCharCode.apply(null,new Uint8Array(L))}catch{var A=new Uint8Array(L);L="";for(var x=0;x<A.length;x++)L+=String.fromCharCode(A[x])}E.push(L),w=n(w,N)}var z=E.length;E.forEach(function(M,K){g(t.decodePacket(M,S,!0),K,z)})}})(Ce);var Ct,tr;function Xt(){if(tr)return Ct;tr=1;var t=Ce,e=Se;Ct=r;function r(n){this.path=n.path,this.hostname=n.hostname,this.port=n.port,this.secure=n.secure,this.query=n.query,this.timestampParam=n.timestampParam,this.timestampRequests=n.timestampRequests,this.readyState="",this.agent=n.agent||!1,this.socket=n.socket,this.enablesXDR=n.enablesXDR,this.withCredentials=n.withCredentials,this.pfx=n.pfx,this.key=n.key,this.passphrase=n.passphrase,this.cert=n.cert,this.ca=n.ca,this.ciphers=n.ciphers,this.rejectUnauthorized=n.rejectUnauthorized,this.forceNode=n.forceNode,this.isReactNative=n.isReactNative,this.extraHeaders=n.extraHeaders,this.localAddress=n.localAddress}return e(r.prototype),r.prototype.onError=function(n,o){var c=new Error(n);return c.type="TransportError",c.description=o,this.emit("error",c),this},r.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(n){if(this.readyState==="open")this.write(n);else throw new Error("Transport not open")},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(n){var o=t.decodePacket(n,this.socket.binaryType);this.onPacket(o)},r.prototype.onPacket=function(n){this.emit("packet",n)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")},Ct}var Ee={};Ee.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e};Ee.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var c=r[n].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e};var it=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},Ir="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),et=64,Br={},rr=0,ve=0,nr;function Lt(t){var e="";do e=Ir[t%et]+e,t=Math.floor(t/et);while(t>0);return e}function ho(t){var e=0;for(ve=0;ve<t.length;ve++)e=e*et+Br[t.charAt(ve)];return e}function Wt(){var t=Lt(+new Date);return t!==nr?(rr=0,nr=t):t+"."+Lt(rr++)}for(;ve<et;ve++)Br[Ir[ve]]=ve;Wt.encode=Lt;Wt.decode=ho;var _r=Wt,It={exports:{}},Bt={exports:{}},Me=1e3,qe=Me*60,ze=qe*60,Xe=ze*24,uo=Xe*365.25,po=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return lo(t);if(r==="number"&&isNaN(t)===!1)return e.long?yo(t):fo(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function lo(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*uo;case"days":case"day":case"d":return r*Xe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ze;case"minutes":case"minute":case"mins":case"min":case"m":return r*qe;case"seconds":case"second":case"secs":case"sec":case"s":return r*Me;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function fo(t){return t>=Xe?Math.round(t/Xe)+"d":t>=ze?Math.round(t/ze)+"h":t>=qe?Math.round(t/qe)+"m":t>=Me?Math.round(t/Me)+"s":t+"ms"}function yo(t){return $e(t,Xe,"day")||$e(t,ze,"hour")||$e(t,qe,"minute")||$e(t,Me,"second")||t+" ms"}function $e(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=c,e.enabled=p,e.humanize=po,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var u=0,h;for(h in i)u=(u<<5)-u+i.charCodeAt(h),u|=0;return e.colors[Math.abs(u)%e.colors.length]}function n(i){var u;function h(){if(h.enabled){var a=h,s=+new Date,d=s-(u||s);a.diff=d,a.prev=u,a.curr=s,u=s;for(var y=new Array(arguments.length),m=0;m<y.length;m++)y[m]=arguments[m];y[0]=e.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");var v=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var g=y[v];R=S.call(a,g),y.splice(v,1),v--}return R}),e.formatArgs.call(a,y);var T=h.log||e.log||console.log.bind(console);T.apply(a,y)}}return h.namespace=i,h.enabled=e.enabled(i),h.useColors=e.useColors(),h.color=r(i),h.destroy=o,typeof e.init=="function"&&e.init(h),e.instances.push(h),h}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function c(i){e.save(i),e.names=[],e.skips=[];var u,h=(typeof i=="string"?i:"").split(/[\s,]+/),a=h.length;for(u=0;u<a;u++)h[u]&&(i=h[u].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(u=0;u<e.instances.length;u++){var s=e.instances[u];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var u,h;for(u=0,h=e.skips.length;u<h;u++)if(e.skips[u].test(i))return!1;for(u=0,h=e.names.length;u<h;u++)if(e.names[u].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(Bt,Bt.exports);var go=Bt.exports;(function(t,e){e=t.exports=go,e.log=o,e.formatArgs=n,e.save=c,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.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"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var u="color: "+this.color;f.splice(1,0,u,"color: inherit");var h=0,a=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(h++,s==="%c"&&(a=h))}),f.splice(a,0,u)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function c(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(It,It.exports);var at=It.exports,Fr=Xt(),mo=Ee,Ur=Ce,vo=it,Co=_r,ae=at("engine.io-client:polling"),Dr=pe,bo=function(){var t=qt,e=new t({xdomain:!1});return e.responseType!=null}();function pe(t){var e=t&&t.forceBase64;(!bo||e)&&(this.supportsBinary=!1),Fr.call(this,t)}vo(pe,Fr);pe.prototype.name="polling";pe.prototype.doOpen=function(){this.poll()};pe.prototype.pause=function(t){var e=this;this.readyState="pausing";function r(){ae("paused"),e.readyState="paused",t()}if(this.polling||!this.writable){var n=0;this.polling&&(ae("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){ae("pre-pause polling complete"),--n||r()})),this.writable||(ae("we are currently writing - waiting to pause"),n++,this.once("drain",function(){ae("pre-pause writing complete"),--n||r()}))}else r()};pe.prototype.poll=function(){ae("polling"),this.polling=!0,this.doPoll(),this.emit("poll")};pe.prototype.onData=function(t){var e=this;ae("polling got data %s",t);var r=function(n,o,c){if(e.readyState==="opening"&&n.type==="open"&&e.onOpen(),n.type==="close")return e.onClose(),!1;e.onPacket(n)};Ur.decodePayload(t,this.socket.binaryType,r),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():ae('ignoring poll - transport state "%s"',this.readyState))};pe.prototype.doClose=function(){var t=this;function e(){ae("writing close packet"),t.write([{type:"close"}])}this.readyState==="open"?(ae("transport open - closing"),e()):(ae("transport not open - deferring close"),this.once("open",e))};pe.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};Ur.encodePayload(t,this.supportsBinary,function(n){e.doWrite(n,r)})};pe.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";this.timestampRequests!==!1&&(t[this.timestampParam]=Co()),!this.supportsBinary&&!t.sid&&(t.b64=1),t=mo.encode(t),this.port&&(e==="https"&&Number(this.port)!==443||e==="http"&&Number(this.port)!==80)&&(r=":"+this.port),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t};var ko=qt,Pr=Dr,wo=Se,So=it,_t=at("engine.io-client:polling-xhr"),Eo=Mt;zt.exports=Ae;zt.exports.Request=Q;function or(){}function Ae(t){if(Pr.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,typeof location<"u"){var e=location.protocol==="https:",r=location.port;r||(r=e?443:80),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port,this.xs=t.secure!==e}}So(Ae,Pr);Ae.prototype.supportsBinary=!0;Ae.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new Q(t)};Ae.prototype.doWrite=function(t,e){var r=typeof t!="string"&&t!==void 0,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(c){o.onError("xhr post error",c)}),this.sendXhr=n};Ae.prototype.doPoll=function(){_t("xhr poll");var t=this.request(),e=this;t.on("data",function(r){e.onData(r)}),t.on("error",function(r){e.onError("xhr poll error",r)}),this.pollXhr=t};function Q(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}wo(Q.prototype);Q.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new ko(t),r=this;try{_t("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var n in this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&e.setRequestHeader(n,this.extraHeaders[n])}}catch{}if(this.method==="POST")try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{e.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in e&&(e.withCredentials=this.withCredentials),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){r.onLoad()},e.onerror=function(){r.onError(e.responseText)}):e.onreadystatechange=function(){if(e.readyState===2)try{var o=e.getResponseHeader("Content-Type");(r.supportsBinary&&o==="application/octet-stream"||o==="application/octet-stream; charset=UTF-8")&&(e.responseType="arraybuffer")}catch{}e.readyState===4&&(e.status===200||e.status===1223?r.onLoad():setTimeout(function(){r.onError(typeof e.status=="number"?e.status:0)},0))},_t("xhr data %s",this.data),e.send(this.data)}catch(o){setTimeout(function(){r.onError(o)},0);return}typeof document<"u"&&(this.index=Q.requestsCount++,Q.requests[this.index]=this)};Q.prototype.onSuccess=function(){this.emit("success"),this.cleanup()};Q.prototype.onData=function(t){this.emit("data",t),this.onSuccess()};Q.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)};Q.prototype.cleanup=function(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=or:this.xhr.onreadystatechange=or,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Q.requests[this.index],this.xhr=null}};Q.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch{}e==="application/octet-stream"||e==="application/octet-stream; charset=UTF-8"?t=this.xhr.response||this.xhr.responseText:t=this.xhr.responseText}catch(r){this.onError(r)}t!=null&&this.onData(t)};Q.prototype.hasXDR=function(){return typeof XDomainRequest<"u"&&!this.xs&&this.enablesXDR};Q.prototype.abort=function(){this.cleanup()};Q.requestsCount=0;Q.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",sr);else if(typeof addEventListener=="function"){var Ao="onpagehide"in Eo?"pagehide":"unload";addEventListener(Ao,sr,!1)}}function sr(){for(var t in Q.requests)Q.requests.hasOwnProperty(t)&&Q.requests[t].abort()}var To=zt.exports,Gt=Dr,No=it,ir=Mt,Oo=Te,xo=/\n/g,Ro=/\\n/g,Ve;function Lo(){}function Te(t){Gt.call(this,t),this.query=this.query||{},Ve||(Ve=ir.___eio=ir.___eio||[]),this.index=Ve.length;var e=this;Ve.push(function(r){e.onData(r)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){e.script&&(e.script.onerror=Lo)},!1)}No(Te,Gt);Te.prototype.supportsBinary=!1;Te.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),Gt.prototype.doClose.call(this)};Te.prototype.doPoll=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(o){t.onError("jsonp poll error",o)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e;var n=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var o=document.createElement("iframe");document.body.appendChild(o),document.body.removeChild(o)},100)};Te.prototype.doWrite=function(t,e){var r=this;if(!this.form){var n=document.createElement("form"),o=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index,l;n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=c,n.method="POST",n.setAttribute("accept-charset","utf-8"),o.name="d",n.appendChild(o),document.body.appendChild(n),this.form=n,this.area=o}this.form.action=this.uri();function p(){f(),e()}function f(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(u){r.onError("jsonp polling iframe removal error",u)}try{var i='<iframe src="javascript:0" name="'+r.iframeId+'">';l=document.createElement(i)}catch{l=document.createElement("iframe"),l.name=r.iframeId,l.src="javascript:0"}l.id=r.iframeId,r.form.appendChild(l),r.iframe=l}f(),t=t.replace(Ro,`\\
|
|
19
|
+
`),this.area.value=t.replace(xo,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&p()}:this.iframe.onload=p};const Io={},Bo=Object.freeze(Object.defineProperty({__proto__:null,default:Io},Symbol.toStringTag,{value:"Module"})),_o=gn(Bo);var Jt=Xt(),Fo=Ce,Uo=Ee,Do=it,Po=_r,jo=at("engine.io-client:websocket"),tt,Ht;typeof WebSocket<"u"?tt=WebSocket:typeof self<"u"&&(tt=self.WebSocket||self.MozWebSocket);if(typeof window>"u")try{Ht=_o}catch{}var we=tt||Ht,Mo=se;function se(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=tt&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(we=Ht),Jt.call(this,t)}Do(se,Jt);se.prototype.name="websocket";se.prototype.supportsBinary=!0;se.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new we(t,e):new we(t):new we(t,e,r)}catch(n){return this.emit("error",n)}this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}};se.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}};se.prototype.write=function(t){var e=this;this.writable=!1;for(var r=t.length,n=0,o=r;n<o;n++)(function(l){Fo.encodePacket(l,e.supportsBinary,function(p){if(!e.usingBrowserWebSocket){var f={};if(l.options&&(f.compress=l.options.compress),e.perMessageDeflate){var i=typeof p=="string"?Buffer.byteLength(p):p.length;i<e.perMessageDeflate.threshold&&(f.compress=!1)}}try{e.usingBrowserWebSocket?e.ws.send(p):e.ws.send(p,f)}catch{jo("websocket closed before onclose event")}--r||c()})})(t[n]);function c(){e.emit("flush"),setTimeout(function(){e.writable=!0,e.emit("drain")},0)}};se.prototype.onClose=function(){Jt.prototype.onClose.call(this)};se.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()};se.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";this.port&&(e==="wss"&&Number(this.port)!==443||e==="ws"&&Number(this.port)!==80)&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=Po()),this.supportsBinary||(t.b64=1),t=Uo.encode(t),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t};se.prototype.check=function(){return!!we&&!("__initialize"in we&&this.name===se.prototype.name)};var qo=qt,zo=To,Xo=Oo,Wo=Mo;st.polling=Go;st.websocket=Wo;function Go(t){var e,r=!1,n=!1,o=t.jsonp!==!1;if(typeof location<"u"){var c=location.protocol==="https:",l=location.port;l||(l=c?443:80),r=t.hostname!==location.hostname||l!==t.port,n=t.secure!==c}if(t.xdomain=r,t.xscheme=n,e=new qo(t),"open"in e&&!t.forceJSONP)return new zo(t);if(!o)throw new Error("JSONP disabled");return new Xo(t)}var Jo=[].indexOf,jr=function(t,e){if(Jo)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1},Ho=st,$o=Se,Y=at("engine.io-client:socket"),Vo=jr,Mr=Ce,ar=Sr,Ko=Ee,Yo=G;function G(t,e){if(!(this instanceof G))return new G(t,e);e=e||{},t&&typeof t=="object"&&(e=t,t=null),t?(t=ar(t),e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=ar(e.host).host),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?443:80),this.query=e.query||{},typeof this.query=="string"&&(this.query=Ko.decode(this.query)),this.upgrade=e.upgrade!==!1,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=e.jsonp!==!1,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=e.withCredentials!==!1,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=e.perMessageDeflate!==!1?e.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||void 0,this.key=e.key||void 0,this.passphrase=e.passphrase||void 0,this.cert=e.cert||void 0,this.ca=e.ca||void 0,this.ciphers=e.ciphers||void 0,this.rejectUnauthorized=e.rejectUnauthorized===void 0?!0:e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self>"u"||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}G.priorWebsocketSuccess=!1;$o(G.prototype);G.protocol=Mr.protocol;G.Socket=G;G.Transport=Xt();G.transports=st;G.parser=Ce;G.prototype.createTransport=function(t){Y('creating transport "%s"',t);var e=Qo(this.query);e.EIO=Mr.protocol,e.transport=t;var r=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var n=new Ho[t]({query:e,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,withCredentials:r.withCredentials||this.withCredentials,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative});return n};function Qo(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}G.prototype.open=function(){var t;if(this.rememberUpgrade&&G.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){var e=this;setTimeout(function(){e.emit("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)};G.prototype.setTransport=function(t){Y("setting transport %s",t.name);var e=this;this.transport&&(Y("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(r){e.onPacket(r)}).on("error",function(r){e.onError(r)}).on("close",function(){e.onClose("transport close")})};G.prototype.probe=function(t){Y('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),r=!1,n=this;G.priorWebsocketSuccess=!1;function o(){if(n.onlyBinaryUpgrades){var h=!this.supportsBinary&&n.transport.supportsBinary;r=r||h}r||(Y('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",function(a){if(!r)if(a.type==="pong"&&a.data==="probe"){if(Y('probe transport "%s" pong',t),n.upgrading=!0,n.emit("upgrading",e),!e)return;G.priorWebsocketSuccess=e.name==="websocket",Y('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(Y("changing transport and sending upgrade packet"),u(),n.setTransport(e),e.send([{type:"upgrade"}]),n.emit("upgrade",e),e=null,n.upgrading=!1,n.flush())})}else{Y('probe transport "%s" failed',t);var s=new Error("probe error");s.transport=e.name,n.emit("upgradeError",s)}}))}function c(){r||(r=!0,u(),e.close(),e=null)}function l(h){var a=new Error("probe error: "+h);a.transport=e.name,c(),Y('probe transport "%s" failed because of error: %s',t,h),n.emit("upgradeError",a)}function p(){l("transport closed")}function f(){l("socket closed")}function i(h){e&&h.name!==e.name&&(Y('"%s" works - aborting "%s"',h.name,e.name),c())}function u(){e.removeListener("open",o),e.removeListener("error",l),e.removeListener("close",p),n.removeListener("close",f),n.removeListener("upgrading",i)}e.once("open",o),e.once("error",l),e.once("close",p),this.once("close",f),this.once("upgrading",i),e.open()};G.prototype.onOpen=function(){if(Y("socket open"),this.readyState="open",G.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){Y("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}};G.prototype.onPacket=function(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(Y('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),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);break}else Y('packet received with socket readyState "%s"',this.readyState)};G.prototype.onHandshake=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(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))};G.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){e.readyState!=="closed"&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)};G.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){Y("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)};G.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})};G.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()};G.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(Y("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(t,e,r){return this.sendPacket("message",t,e,r),this};G.prototype.sendPacket=function(t,e,r,n){if(typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=null),!(this.readyState==="closing"||this.readyState==="closed")){r=r||{},r.compress=r.compress!==!1;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}};G.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():e()}):this.upgrading?n():e()}function e(){t.onClose("forced close"),Y("socket closing - telling transport to close"),t.transport.close()}function r(){t.removeListener("upgrade",r),t.removeListener("upgradeError",r),e()}function n(){t.once("upgrade",r),t.once("upgradeError",r)}return this};G.prototype.onError=function(t){Y("socket error %j",t),G.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)};G.prototype.onClose=function(t,e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){Y('socket close with reason: "%s"',t);var r=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",t,e),r.writeBuffer=[],r.prevBufferLen=0}};G.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~Vo(this.transports,t[r])&&e.push(t[r]);return e};jt.exports=Yo;jt.exports.parser=Ce;var Zo=jt.exports,qr={exports:{}},es=ts;function ts(t,e){var r=[];e=e||0;for(var n=e||0;n<t.length;n++)r[n-e]=t[n];return r}var zr=rs;function rs(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}var cr=[].slice,Xr=function(t,e){if(typeof e=="string"&&(e=t[e]),typeof e!="function")throw new Error("bind() requires a function");var r=cr.call(arguments,2);return function(){return e.apply(t,r.concat(cr.call(arguments)))}};(function(t,e){var r=nt,n=Se,o=es,c=zr,l=Xr,p=rt("socket.io-client:socket"),f=Ee,i=xr;t.exports=a;var u={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},h=n.prototype.emit;function a(s,d,y){this.io=s,this.nsp=d,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},y&&y.query&&(this.query=y.query),this.io.autoConnect&&this.open()}n(a.prototype),a.prototype.subEvents=function(){if(!this.subs){var s=this.io;this.subs=[c(s,"open",l(this,"onopen")),c(s,"packet",l(this,"onpacket")),c(s,"close",l(this,"onclose"))]}},a.prototype.open=a.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.reconnecting||this.io.open(),this.io.readyState==="open"&&this.onopen(),this.emit("connecting"),this)},a.prototype.send=function(){var s=o(arguments);return s.unshift("message"),this.emit.apply(this,s),this},a.prototype.emit=function(s){if(u.hasOwnProperty(s))return h.apply(this,arguments),this;var d=o(arguments),y={type:(this.flags.binary!==void 0?this.flags.binary:i(d))?r.BINARY_EVENT:r.EVENT,data:d};return y.options={},y.options.compress=!this.flags||this.flags.compress!==!1,typeof d[d.length-1]=="function"&&(p("emitting packet with ack id %d",this.ids),this.acks[this.ids]=d.pop(),y.id=this.ids++),this.connected?this.packet(y):this.sendBuffer.push(y),this.flags={},this},a.prototype.packet=function(s){s.nsp=this.nsp,this.io.packet(s)},a.prototype.onopen=function(){if(p("transport is open - connecting"),this.nsp!=="/")if(this.query){var s=typeof this.query=="object"?f.encode(this.query):this.query;p("sending connect packet with query %s",s),this.packet({type:r.CONNECT,query:s})}else this.packet({type:r.CONNECT})},a.prototype.onclose=function(s){p("close (%s)",s),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",s)},a.prototype.onpacket=function(s){var d=s.nsp===this.nsp,y=s.type===r.ERROR&&s.nsp==="/";if(!(!d&&!y))switch(s.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(s);break;case r.BINARY_EVENT:this.onevent(s);break;case r.ACK:this.onack(s);break;case r.BINARY_ACK:this.onack(s);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",s.data);break}},a.prototype.onevent=function(s){var d=s.data||[];p("emitting event %j",d),s.id!=null&&(p("attaching ack callback to event"),d.push(this.ack(s.id))),this.connected?h.apply(this,d):this.receiveBuffer.push(d)},a.prototype.ack=function(s){var d=this,y=!1;return function(){if(!y){y=!0;var m=o(arguments);p("sending ack %j",m),d.packet({type:i(m)?r.BINARY_ACK:r.ACK,id:s,data:m})}}},a.prototype.onack=function(s){var d=this.acks[s.id];typeof d=="function"?(p("calling ack %s with %j",s.id,s.data),d.apply(this,s.data),delete this.acks[s.id]):p("bad ack %s",s.id)},a.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},a.prototype.emitBuffered=function(){var s;for(s=0;s<this.receiveBuffer.length;s++)h.apply(this,this.receiveBuffer[s]);for(this.receiveBuffer=[],s=0;s<this.sendBuffer.length;s++)this.packet(this.sendBuffer[s]);this.sendBuffer=[]},a.prototype.ondisconnect=function(){p("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},a.prototype.destroy=function(){if(this.subs){for(var s=0;s<this.subs.length;s++)this.subs[s].destroy();this.subs=null}this.io.destroy(this)},a.prototype.close=a.prototype.disconnect=function(){return this.connected&&(p("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},a.prototype.compress=function(s){return this.flags.compress=s,this},a.prototype.binary=function(s){return this.flags.binary=s,this}})(qr);var Wr=qr.exports,ns=Ne;function Ne(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Ne.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+r:t-r}return Math.min(t,this.max)|0};Ne.prototype.reset=function(){this.attempts=0};Ne.prototype.setMin=function(t){this.ms=t};Ne.prototype.setMax=function(t){this.max=t};Ne.prototype.setJitter=function(t){this.jitter=t};var os=Zo,ss=Wr,is=Se,as=nt,ye=zr,ke=Xr,ee=rt("socket.io-client:manager"),Gr=jr,cs=ns,Jr=Object.prototype.hasOwnProperty,hr=H;function H(t,e){if(!(this instanceof H))return new H(t,e);t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new cs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||as;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}H.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)Jr.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)};H.prototype.updateSocketIds=function(){for(var t in this.nsps)Jr.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))};H.prototype.generateId=function(t){return(t==="/"?"":t+"#")+this.engine.id};is(H.prototype);H.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection};H.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts};H.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay};H.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor};H.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax};H.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout};H.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()};H.prototype.open=H.prototype.connect=function(t,e){if(ee("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;ee("opening %s",this.uri),this.engine=os(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var o=ye(r,"open",function(){n.onopen(),t&&t()}),c=ye(r,"error",function(f){if(ee("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",f),t){var i=new Error("Connection error");i.data=f,t(i)}else n.maybeReconnectOnOpen()});if(this._timeout!==!1){var l=this._timeout;ee("connect attempt will timeout after %d",l),l===0&&o.destroy();var p=setTimeout(function(){ee("connect attempt timed out after %d",l),o.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",l)},l);this.subs.push({destroy:function(){clearTimeout(p)}})}return this.subs.push(o),this.subs.push(c),this};H.prototype.onopen=function(){ee("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(ye(t,"data",ke(this,"ondata"))),this.subs.push(ye(t,"ping",ke(this,"onping"))),this.subs.push(ye(t,"pong",ke(this,"onpong"))),this.subs.push(ye(t,"error",ke(this,"onerror"))),this.subs.push(ye(t,"close",ke(this,"onclose"))),this.subs.push(ye(this.decoder,"decoded",ke(this,"ondecoded")))};H.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")};H.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};H.prototype.ondata=function(t){this.decoder.add(t)};H.prototype.ondecoded=function(t){this.emit("packet",t)};H.prototype.onerror=function(t){ee("error",t),this.emitAll("error",t)};H.prototype.socket=function(t,e){var r=this.nsps[t];if(!r){r=new ss(this,t,e),this.nsps[t]=r;var n=this;r.on("connecting",o),r.on("connect",function(){r.id=n.generateId(t)}),this.autoConnect&&o()}function o(){~Gr(n.connecting,r)||n.connecting.push(r)}return r};H.prototype.destroy=function(t){var e=Gr(this.connecting,t);~e&&this.connecting.splice(e,1),!this.connecting.length&&this.close()};H.prototype.packet=function(t){ee("writing packet %j",t);var e=this;t.query&&t.type===0&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))};H.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}};H.prototype.cleanup=function(){ee("cleanup");for(var t=this.subs.length,e=0;e<t;e++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()};H.prototype.close=H.prototype.disconnect=function(){ee("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()};H.prototype.onclose=function(t){ee("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()};H.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)ee("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();ee("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(ee("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),!t.skipReconnect&&t.open(function(n){n?(ee("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",n.data)):(ee("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}};H.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)};(function(t,e){var r=On,n=nt,o=hr,c=rt("socket.io-client");t.exports=e=p;var l=e.managers={};function p(f,i){typeof f=="object"&&(i=f,f=void 0),i=i||{};var u=r(f),h=u.source,a=u.id,s=u.path,d=l[a]&&s in l[a].nsps,y=i.forceNew||i["force new connection"]||i.multiplex===!1||d,m;return y?(c("ignoring socket cache for %s",h),m=o(h,i)):(l[a]||(c("new io instance for %s",h),l[a]=o(h,i)),m=l[a]),u.query&&!i.query&&(i.query=u.query),m.socket(u.path,i)}e.protocol=n.protocol,e.connect=p,e.Manager=hr,e.Socket=Wr})(St,St.exports);var hs=St.exports;const us=yn(hs);let Ke;const ps=new Uint8Array(16);function ls(){if(!Ke&&(Ke=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ke))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ke(ps)}const Z=[];for(let t=0;t<256;++t)Z.push((t+256).toString(16).slice(1));function fs(t,e=0){return Z[t[e+0]]+Z[t[e+1]]+Z[t[e+2]]+Z[t[e+3]]+"-"+Z[t[e+4]]+Z[t[e+5]]+"-"+Z[t[e+6]]+Z[t[e+7]]+"-"+Z[t[e+8]]+Z[t[e+9]]+"-"+Z[t[e+10]]+Z[t[e+11]]+Z[t[e+12]]+Z[t[e+13]]+Z[t[e+14]]+Z[t[e+15]]}const ds=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ur={randomUUID:ds};function ys(t,e,r){if(ur.randomUUID&&!t)return ur.randomUUID();t=t||{};const n=t.random||(t.rng||ls)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,fs(n)}function gs(t,e){const r=e.map(o=>JSON.stringify(o)).join(" "),n=new Date().toISOString();return JSON.stringify({level:t,time:n,message:r})}function ms(t,e){const r=JSON.parse(t);return e.forEach(n=>delete r[n]),r}function vs(t){if(typeof t=="object"&&t!==null)return t;try{return JSON.parse(t)}catch{return{extraData:t}}}function Cs(t){const e=/\(([^)]+)\)/,r=t.match(e);if(r&&r[1]){const n=r[1].split(";");for(let o of n)if(o=o.trim(),o.startsWith("Windows")||o.startsWith("Macintosh")||o.startsWith("Linux"))return o}return"Unknown"}function pr(t){return(...e)=>new Promise((r,n)=>{try{const o=t(...e);r(o)}catch(o){n(o)}})}const bs={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},bt={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},ce={CREATE:"Create",READ:"Read",UPDATE:"Update",DELETE:"Delete",CONVERT:"Convert",DOWNLOAD:"Download",UPLOAD:"Upload",ENCRYPT:"Encrypt",DECRYPT:"Decrypt",FILTER:"Filter",INPUT:"Input",OUTPUT:"Output",PLUGIN:"Plugin",LOGIN:"Login",LOGOUT:"Logout",REFRESH:"Refresh",CHECK:"Check",WEBHOOK:"Webhook",WSCONNECT:"WSConnect"},ks={Create:1,Read:2,Update:3,Delete:4,Convert:5,Download:6,Upload:7,Encrypt:8,Decrypt:9,Filter:10,Input:11,Output:12,Plugin:13,Login:14,Logout:15,Refresh:16,Check:17,Webhook:18,WSConnect:19},he={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},W={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let re=console;class ws{constructor(e){$(this,"logToConsole"),$(this,"overloadGlobalConsole"),$(this,"system"),$(this,"socketEmitInterval"),$(this,"storageId"),$(this,"loggerLevel",W.DEBUG),$(this,"loggerLevelMap",{[W.DEBUG]:[W.DEBUG,W.INFO,W.WARNING,W.ERROR],[W.INFO]:[W.INFO,W.WARNING,W.ERROR],[W.WARNING]:[W.WARNING,W.ERROR],[W.ERROR]:[W.ERROR]}),$(this,"emitInProgress"),$(this,"queue"),$(this,"processing"),$(this,"storageInitialized"),$(this,"interval"),$(this,"logIndex"),$(this,"socket"),$(this,"requestUrl"),$(this,"staticObject",{}),$(this,"localObject",{}),$(this,"isGetItemAsync"),$(this,"isSetItemAsync"),$(this,"getItem"),$(this,"setItem"),$(this,"parseLog"),$(this,"_logMethod"),$(this,"_warnMethod"),$(this,"_errorMethod"),$(this,"_debugMethod");const{loggerOptions:r}=e;if(!r.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=r.isGetItemAsync||!1,this.isSetItemAsync=r.isSetItemAsync||!1,this.setupStorageFunctions(r.getItem,r.setItem,r.parseLog),this.system=r.system,r.loggerLevel&&(this.loggerLevel=r.loggerLevel),this.socketEmitInterval=r.socketEmitInterval||bt.socketEmitInterval,this.logToConsole=r.logToConsole!==void 0?r.logToConsole:bt.logToConsole,this.overloadGlobalConsole=r.overloadGlobalConsole!==void 0?r.overloadGlobalConsole:bt.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.storageInitialized=!1,this.emitInProgress=!1,this.logIndex=0,this.staticObject=r.staticObject??{},this.init(e)}get currentLoggerLevelLogLevels(){return this.loggerLevelMap[this.loggerLevel]}changeLogLevel(e){this.loggerLevel=e}isLogLevelAllowed(e){return this.currentLoggerLevelLogLevels.includes(e)}setupStorageFunctions(e,r,n){this.getItem=e&&typeof e=="function"?this.isGetItemAsync?e:pr(e):this.defaultGetItemFunction,this.setItem=r&&typeof r=="function"?this.isSetItemAsync?r:pr(r):this.defaultSetItemFunction,this.parseLog=n&&typeof n=="function"?n:gs}sendHttpRequest(e){if(!this.requestUrl)throw new Error("requestUrl is not provided");const r={Data:e};return fetch(this.requestUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}init(e){const{socket:r,url:n,requestUrl:o,socketOptions:c={}}=e;this._logMethod=re.log.bind(re),this._warnMethod=re.warn.bind(re),this._errorMethod=re.error.bind(re),this._debugMethod=re.debug.bind(re),this.initStorage().then(()=>{if(r)this.socket=r;else if(n)this.socket=this.createConnection(n,c);else if(o)this.requestUrl=o;else throw new Error("Must provide either a 'socket', 'requestUrl' or a 'url' for logger requests");this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval),this.overloadGlobalConsole&&this._overloadConsole()})}createConnection(e,r){let n={...bs};return r&&(n={...n,...r}),us(e,n)}async emitLogs(){if(!this.emitInProgress)try{const e=await this.getItem(this.storageId),r=JSON.parse(e||"{}"),n={...this.localObject,...r};if(!Object.keys(n).length)return;const o=[];this.emitInProgress=!0;const c=Object.keys(n);if(!c.length)return;if((!this.socket||!this.socket.connected)&&!this.requestUrl)throw new Error("Log request can't be sent. Socket is disconnected or requestUrl is not provided");const l=[];for(const i of c){const u=vs(n[i]),h={...this.staticObject,...u},a=this.populateSendingLog(h);a.Body&&typeof a.Body=="string"&&(a.Body=JSON.parse(a.Body)),this.socket?this.socket.emit("Log",a):this.requestUrl&&l.push(a),o.push(i)}l.length&&await this.sendHttpRequest(l);const p=await this.getItem(this.storageId);if(!p)return;const f=ms(p,o);this.localObject={},await this.setItem(this.storageId,JSON.stringify(f))}catch(e){this._errorMethod(e)}finally{this.emitInProgress=!1}}populateSendingLog(e){const r={...e},n=r.ActionName;return n&&(r.ActionID=ks[n]),r}setupStaticFields(e){this.staticObject={...e}}populateMetaData(){const e=new Date;let r;typeof window<"u"&&typeof window.document<"u"?r=window==null?void 0:window.navigator.userAgent:typeof self<"u"&&self.navigator&&(r=self.navigator.userAgent);let n;return r&&(n=Cs(r)),{System:this.system,DateTime:e,UserAgent:r,OSVersion:n}}async stop(){!this.socket||!this.socket.connected||(clearInterval(this.interval),await this.emitLogs(),this.socket.disconnect())}async start(){var e;this.socket&&this.socket.connected||((e=this.socket)==null||e.connect(),this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval))}_overloadConsole(){re=Object.assign(re,{log:e=>{this.log(e)},warn:e=>{this.warn(e)},error:e=>{this.error(e)},debug:e=>{this.debug(e)}})}async initStorage(){const e=await this.getItem(this.storageId);(!e||typeof e!="string")&&(await this.setItem(this.storageId,JSON.stringify({})),this.storageInitialized=!0)}async resetStorage(){await this.setItem(this.storageId,JSON.stringify({}))}getStorageName(){const e=ys();return this.system.toString().toUpperCase()+e+Date.now()}async processLog(...e){try{if(e.length<2)return;const r=e[0],n=e[1],o=this.formItemKey(r);if(!this.storageInitialized){this.localObject={...this.localObject,[o]:n};return}const c=await this.getItem(this.storageId);if(!c)return;const l=JSON.parse(c);l[o]=JSON.stringify(n),await this.setItem(this.storageId,JSON.stringify(l))}catch(r){this._errorMethod(r)}}async processQueue(){if(this.processing||this.queue.length===0)return;const e=this.queue.shift();e&&(this.processing=!0,await this.processLog(...e).finally(()=>{this.processing=!1,this.processQueue()}))}log(e){if(!this.isLogLevelAllowed(W.INFO))return;const r={...this.populateMetaData(),...e},n=["INFO",r];this.queue.push(n),this.logToConsole&&this._logMethod.apply(re,[r]),this.processQueue()}warn(e){if(!this.isLogLevelAllowed(W.WARNING))return;const r=["WARN",e];this.queue.push(r),this.logToConsole&&this._warnMethod.apply(re,[e]),this.processQueue()}error(e){if(!this.isLogLevelAllowed(W.ERROR))return;const r=["ERROR",e];this.queue.push(r),this.logToConsole&&this._errorMethod.apply(re,[e]),this.processQueue()}debug(e){if(!this.isLogLevelAllowed(W.DEBUG))return;const r=["DEBUG",e];this.queue.push(r),this.logToConsole&&this._debugMethod.apply(re,[e]),this.processQueue()}async defaultGetItemFunction(e){return localStorage.getItem(e)}async defaultSetItemFunction(e,r){try{localStorage.setItem(e,r)}catch(n){this._errorMethod(n)}}formItemKey(e){const r=new Date().toISOString();return this.logIndex++,`${e}-${this.system}-${r}-${this.logIndex}`}}class Ss{constructor(e){J(this,"storageLogger");this.eventsSdkClass=e,this.eventsSdkClass=e}init(){if(!this.eventsSdkClass.options.useLogger)return;if(this.eventsSdkClass.options.storageLoggerInstance){this.storageLogger=this.eventsSdkClass.options.storageLoggerInstance;return}let e;this.eventsSdkClass.options.loggerSocketConnection&&(e=this.eventsSdkClass.options.loggerSocketConnection),this.eventsSdkClass.socketIoClass.ioFunction&&!e&&(e=this.eventsSdkClass.socketIoClass.ioFunction(this.eventsSdkClass.options.loggerServer,this.eventsSdkClass.options.loggerConnectOptions)),e&&(this.storageLogger=new ws({socket:e,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}async start(){this.storageLogger&&await this.storageLogger.start()}stop(){this.storageLogger&&this.storageLogger.stop()}log(e){if(this.eventsSdkClass.options.useLogger)if(this.storageLogger)switch(e.Level){case W.INFO:this.storageLogger.log(e);break;case W.DEBUG:this.storageLogger.debug(e);break;case W.WARNING:this.storageLogger.warn(e);break;case W.ERROR:this.storageLogger.error(e)}else e.Level===W.INFO?console.log(e):e.Level===W.ERROR&&console.error(e)}sdkConnectionSuccess(){const e={...this.eventsSdkClass.options,token:"CENSORED",password:"CENSORED"};this.log({Message:`Sdk connected to the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL}`,Body:JSON.stringify(e,this.eventsSdkClass.getCircularReplacer()),ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:W.INFO,LogType:he.INFO})}sdkDisconnect(e){this.log({Message:`Sdk disconnected from the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL} (${e})`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:W.INFO,LogType:he.INFO})}sdkAttemptToConnect(e){this.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${e}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:W.INFO,LogType:he.INFO})}sdkAttemptToConnectError(e){this.log({Message:`${e}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:W.ERROR,LogType:he.ERROR})}loginError(e,r,n,o){this.log({Message:`External login request error with the login type ${e} ${e===ie.TOKEN?n:o}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:r||400,Level:W.ERROR,LogType:he.ERROR})}getSettingsError(e,r){this.log({Message:`Get settings error with token ${e}, error: ${r}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:W.ERROR,LogType:he.ERROR})}refreshTokenError(e,r,n){this.log({Message:`Refresh token error with old refresh token ${e}, url: ${r}, error: ${n}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:W.ERROR,LogType:he.ERROR})}keepAliveEmit(){this.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:ce.WSCONNECT,isShowClient:!1,Level:W.INFO,LogType:he.INFO})}keepAliveResponse(e){this.log({Message:`Keep alive response: ${JSON.stringify(e)}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:W.INFO,LogType:he.INFO})}eventLog(e,r){const n={[fe.FULL]:[],[fe.BOOTSTRAP]:[j.LOGIN_STATUS,j.LOGIN_SUCCESS,j.ALL_EXTENSION_STATUS,j.ALL_DIALER_STATUS],[fe.DEBUG_EXTENSIONS]:[j.ALL_EXTENSION_STATUS,j.EXTENSION_EVENT,j.EXTENSIONS_UPDATED],[fe.DEBUG_DIALER]:[j.ALL_DIALER_STATUS,j.DIALER_EVENT],[fe.DEBUG_QUEUE]:[j.QUEUE_EVENT]};this.eventsSdkClass.options.debugOption&&(n[this.eventsSdkClass.options.debugOption].includes(e)||this.eventsSdkClass.options.debugOption===fe.FULL)&&this.log({Message:`Event name: ${e}`,Body:r,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Successful",Level:W.DEBUG,LogType:he.INFO})}}class Es{constructor(e){J(this,"listeners",{[j.ALL_EXTENSION_STATUS]:[],[j.ALL_DIALER_STATUS]:[],[j.ALL_USERS_STATUS]:[],[j.QUEUE_EVENT]:[],[j.EXTENSION_EVENT]:[],[j.DIALER_EVENT]:[],[j.LOGIN_SUCCESS]:[],[j.LOGIN_STATUS]:[],[j.KEEP_ALIVE_RESPONSE]:[],[j.ONLINE_STATUS_EVENT]:[],[j.EXTENSIONS_UPDATED]:[]});J(this,"allListeners",[]);this.eventsSdkClass=e,this.eventsSdkClass=e}on(e,r){e==="*"?this.allListeners.push(r):this.listeners[e].push(r)}off(e,r){if(e==="*")this.allListeners=this.allListeners.filter(n=>n!==r);else{const o=this.listeners[e].filter(c=>c!==r);this.listeners={...this.listeners,[e]:o}}}emit(e,r){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[e].forEach(o=>o({name:e,data:r}));const n={name:e,data:r};this.allListeners.forEach(o=>o(n))}}class As{constructor(e){J(this,"options");J(this,"servers",[]);J(this,"URLList",[]);J(this,"server");J(this,"URL");J(this,"socket");J(this,"mainServer");J(this,"alreadyAttemptedOtherServers",[]);J(this,"authClass",new rn(this));J(this,"socketIoClass",new ln(this));J(this,"loggerClass",new Ss(this));J(this,"eventEmitterClass",new Es(this));J(this,"getCircularReplacer",()=>{const e=new WeakSet;return(r,n)=>{if(!(r==="socket"||r==="io"||r==="nsps")){if(typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}}});this.options={...nn,...e}}on(e,r){this.eventEmitterClass.on(e,r)}emit(e,...r){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...r)}connect(e){e===ue.MAIN&&this.findMainServer(),e===ue.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.init()}catch(r){console.error(r)}this.socketIoClass.initSocketConnection(),this.socketIoClass.initSocketEvents(),this.socketIoClass.initKeepAlive()}disconnect(){this.socketIoClass.doReconnect=!1,this.socketIoClass.closeAllConnections(),this.loggerClass.stop()}clearKeepAliveInterval(){this.socketIoClass.clearKeepAliveInterval()}findMainServer(){this.servers.length?(this.mainServer=this.servers.reduce((e,r)=>r.Priority>e.Priority?r:e),this.server=this.mainServer):this.URLList.length&&(this.URL=this.URLList[0])}findNextServer(){if(this.servers.length&&this.server)if(this.server.Priority===this.mainServer.Priority){let e=this.servers.filter(r=>r.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(r.Priority)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.servers.filter(r=>r.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(r.Priority)+1===0)),e.length&&(this.server=e.reduce((r,n)=>n.Priority>r.Priority?n:r),this.alreadyAttemptedOtherServers.push(this.server.Priority))}else this.server=this.mainServer;else if(this.URLList.length)if(this.URL===this.URLList[0]){let e=this.URLList.filter(r=>r!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(r)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.URLList.filter(r=>r!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(r)+1===0)),e.length&&(this.URL=e[0],this.alreadyAttemptedOtherServers.push(this.URL))}else this.URL=this.URLList[0]}async init(){const e=await this.authClass.login();return e&&this.authClass.onLoginResponse(e),!0}getCurrentMonitorServer(){return this.server}}exports.CallStatusEnum=gr;exports.CallTypeEnum=mr;exports.ConnectionStatusEnum=de;exports.DebugOption=fe;exports.DialerTypeEnum=vr;exports.DirectionEnum=Cr;exports.DoNotCallMeStatusCodeEnum=br;exports.EventsEnum=j;exports.ExtensionEventReasonEnum=Ft;exports.ExtensionHangupCauseEnum=kr;exports.LoginType=ie;exports.QueueEventReasonEnum=wr;exports.ServerListenerEventsEnum=Ut;exports.ServerParameter=ue;exports.default=As;
|
|
20
20
|
//# sourceMappingURL=voicenter-events-sdk.cjs.js.map
|