@voicenter-team/events-sdk 0.0.37 → 0.0.38

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.
@@ -41,6 +41,6 @@ function print() { __p += __j.call(arguments, '') }
41
41
  `+et+Qt.join(`,
42
42
  `+et)+`
43
43
  `+nr+"}":"{"+Qt.join(",")+"}":"{}";return nt.pop(),He}};_.stringify=function($,Q,X){var rt,K,et,nt;if(typeof Q=="function"||typeof Q=="object"&&Q){if((nt=b.call(Q))==l)K=Q;else if(nt==k){et={};for(var Z,at=0,kt=Q.length;kt>at;Z=Q[at++],nt=b.call(Z),(nt==A||nt==w)&&(et[Z]=1));}}if(X)if((nt=b.call(X))==w){if((X-=X%1)>0)for(rt="",X>10&&(X=10);rt.length<X;rt+=" ");}else nt==A&&(rt=X.length<=10?X:X.slice(0,10));return G("",(Z={},Z[""]=$,Z),K,et,rt,"",[])}}if(!c("json-parse")){var F,pt,ct=String.fromCharCode,xt={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
44
- `,102:"\f",114:"\r"},ut=function(){throw F=pt=null,SyntaxError()},jt=function(){for(var $,Q,X,rt,K,et=pt,nt=et.length;nt>F;)switch(K=et.charCodeAt(F)){case 9:case 10:case 13:case 32:F++;break;case 123:case 125:case 91:case 93:case 58:case 44:return $=Y?et.charAt(F):et[F],F++,$;case 34:for($="@",F++;nt>F;)if(K=et.charCodeAt(F),32>K)ut();else if(K==92)switch(K=et.charCodeAt(++F)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:$+=xt[K],F++;break;case 117:for(Q=++F,X=F+4;X>F;F++)K=et.charCodeAt(F),K>=48&&57>=K||K>=97&&102>=K||K>=65&&70>=K||ut();$+=ct("0x"+et.slice(Q,F));break;default:ut()}else{if(K==34)break;for(K=et.charCodeAt(F),Q=F;K>=32&&K!=92&&K!=34;)K=et.charCodeAt(++F);$+=et.slice(Q,F)}if(et.charCodeAt(F)==34)return F++,$;ut();default:if(Q=F,K==45&&(rt=!0,K=et.charCodeAt(++F)),K>=48&&57>=K){for(K==48&&(K=et.charCodeAt(F+1),K>=48&&57>=K)&&ut(),rt=!1;nt>F&&(K=et.charCodeAt(F),K>=48&&57>=K);F++);if(et.charCodeAt(F)==46){for(X=++F;nt>X&&(K=et.charCodeAt(X),K>=48&&57>=K);X++);X==F&&ut(),F=X}if(K=et.charCodeAt(F),K==101||K==69){for(K=et.charCodeAt(++F),(K==43||K==45)&&F++,X=F;nt>X&&(K=et.charCodeAt(X),K>=48&&57>=K);X++);X==F&&ut(),F=X}return+et.slice(Q,F)}if(rt&&ut(),et.slice(F,F+4)=="true")return F+=4,!0;if(et.slice(F,F+5)=="false")return F+=5,!1;if(et.slice(F,F+4)=="null")return F+=4,null;ut()}return"$"},Le=function($){var Q,X;if($=="$"&&ut(),typeof $=="string"){if((Y?$.charAt(0):$[0])=="@")return $.slice(1);if($=="["){for(Q=[];$=jt(),$!="]";X||(X=!0))X&&($==","?($=jt(),$=="]"&&ut()):ut()),$==","&&ut(),Q.push(Le($));return Q}if($=="{"){for(Q={};$=jt(),$!="}";X||(X=!0))X&&($==","?($=jt(),$=="}"&&ut()):ut()),($==","||typeof $!="string"||(Y?$.charAt(0):$[0])!="@"||jt()!=":")&&ut(),Q[$.slice(1)]=Le(jt());return Q}ut()}return $},fe=function($,Q,X){var rt=Nr($,Q,X);rt===d?delete $[Q]:$[Q]=rt},Nr=function($,Q,X){var rt,K=$[Q];if(typeof K=="object"&&K)if(b.call(K)==k)for(rt=K.length;rt--;)fe(K,rt,X);else v(K,function(et){fe(K,et,X)});return X.call($,Q,K)};_.parse=function($,Q){var X,rt;return F=0,pt=""+$,X=Le(jt()),jt()!="$"&&ut(),F=pt=null,Q&&b.call(Q)==l?Nr((rt={},rt[""]=X,rt),"",Q):X}}}})(this)},{}],48:[function(r,o){function n(a,c){var f=[];c=c||0;for(var v=c||0;v<a.length;v++)f[v-c]=a[v];return f}o.exports=n},{}]},{},[1])(1)}const Yu=Object.assign({"./v1_3_7.js":Object.freeze(Object.defineProperty({__proto__:null,default:ju},Symbol.toStringTag,{value:"Module"}))}),Vu=/v\d+_\d+_\d+/;function Zu(r){return typeof r=="function"}const Ci=Object.entries(Yu).reduce((r,o)=>{var c;const n=o[1].default,a=(c=o[0].match(Vu))==null?void 0:c[0];return Zu(n)&&a&&(r[a]=n()),r},{}),_s=r=>{if(r in Ci)return Ci[r];throw new Error(`Socket version ${r} not found`)},Qu={...Ci,getSocketVersion:_s,makeSocketVersion:(r,...o)=>_s(r)(...o)};var ws=(r=>(r.RINGING="Ringing",r.TALKING="Talking",r.DIALING="Dialing",r.HOLD="Hold",r))(ws||{}),bs=(r=>(r.INCOMING="Incoming",r.OUTGOING="Outgoing",r))(bs||{}),Cs=(r=>(r.AUTOMATIC="Automatic",r.IVR="IVR",r))(Cs||{}),Ss=(r=>(r.INCOMINC="Incoming",r.OUTGOING="Outgoing",r.SPY="Spy",r.CLICK2CALL="Click2Call",r))(Ss||{}),ks=(r=>(r.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",r.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",r))(ks||{}),ht=(r=>(r.ALL_DIALER_STATUS="AllDialersStatus",r.ALL_EXTENSION_STATUS="AllExtensionsStatus",r.ALL_USERS_STATUS="AllUsersStatus",r.CONNECT="connect",r.DISCONNECT="disconnect",r.CONNECT_ERROR_EVENT="connect_error",r.EXTENSION_EVENT="ExtensionEvent",r.KEEP_ALIVE="keepalive",r.KEEP_ALIVE_RESPONSE="keepaliveResponse",r.LOGIN_STATUS="loginStatus",r.LOGIN_SUCCESS="loginSuccess",r.QUEUE_EVENT="QueueEvent",r.ONLINE_STATUS_EVENT="onlineStatusEvent",r.DIALER_EVENT="DialerEvent",r.EXTENSIONS_UPDATED="ExtensionsUpdated",r))(ht||{}),As=(r=>(r.NEWCALL="NEWCALL",r.ANSWER="ANSWER",r.HOLD="HOLD",r.UNHOLD="UNHOLD",r.HANGUP="HANGUP",r.USER_STATUS_UPDATE="userStatusUpdate",r))(As||{}),xs=(r=>(r.NORMAL_HANGUP="Normal hangup",r.USER_BUSY="User busy",r.CALL_REJECTED="Call Rejected",r.UNALLOCATED_NUMBER="Unallocated (unassigned) number",r.UNKNOWN="Unknown",r.NO_USER_RESPONDING="No user responding",r.USER_ALERTING="User alerting, no answer",r.ANSWERED_ELSEWHERE="Answered elsewhere",r))(xs||{}),Es=(r=>(r.ANSWER="ANSWER",r.ABANDONED="ABANDONED",r.EXIT="EXIT",r.JOIN="JOIN",r))(Es||{});class tf{constructor(o){St(this,"io");St(this,"ioFunction");St(this,"lastEventTimestamp",new Date().getTime());St(this,"doReconnect",!0);St(this,"keepAliveInterval");St(this,"keepReconnectInterval");St(this,"connected",!1);this.eventsSdkClass=o,this.eventsSdkClass=o}getSocketIoFunction(o){const n=o.split("v="),a="v".concat(n[n.length-1]).replaceAll(".","_");this.ioFunction=Qu.getSocketVersion(a)}initSocketConnection(){const o=this.eventsSdkClass.authClass.token,n=this.eventsSdkClass.options.protocol,a=this.eventsSdkClass.server;try{const c=a?a.Domain:this.eventsSdkClass.URL,f=a?`${n}://${c}`:this.eventsSdkClass.URL;this.eventsSdkClass.loggerClass.log($t.INFO,"Connecting to..",f),this.eventsSdkClass.eventEmitterClass.emit(ht.ONLINE_STATUS_EVENT,{isSocketConnected:!1,attemptToConnect:f});const v={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:o},timeout:this.eventsSdkClass.options.timeout};if(o&&(v.query={token:o}),this.ioFunction&&f)this.io=this.ioFunction(f,v);else throw new Error("Socket server url no defined")}catch(c){this.eventsSdkClass.loggerClass.log($t.ERROR,"init socket connection error",c)}}initSocketEvents(){this.io&&this.io.on(ht.LOGIN_SUCCESS,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.LOGIN_SUCCESS,o)).on(ht.QUEUE_EVENT,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.QUEUE_EVENT,o)).on(ht.EXTENSION_EVENT,o=>{o.data.currentCall&&(o.data.currentCall=this.configureUTCForObject(o.data.currentCall,["callAnswered"],o.servertime,o.servertimeoffset)),this.eventsSdkClass.eventEmitterClass.emit(ht.EXTENSION_EVENT,o)}).on(ht.DIALER_EVENT,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.DIALER_EVENT,o)).on(ht.LOGIN_STATUS,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.LOGIN_STATUS,o)).on(ht.ALL_EXTENSION_STATUS,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.ALL_EXTENSION_STATUS,o)).on(ht.ALL_DIALER_STATUS,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.ALL_DIALER_STATUS,o)).on(ht.KEEP_ALIVE_RESPONSE,o=>this.onKeepAliveResponse(o)).on(ht.CONNECT,()=>this.onConnect()).on(ht.DISCONNECT,o=>this.onDisconnect(o)).on(ht.CONNECT_ERROR_EVENT,o=>this.onConnectError(o)).on(ht.EXTENSIONS_UPDATED,o=>{this.eventsSdkClass.eventEmitterClass.emit(ht.EXTENSIONS_UPDATED,o)})}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.clearKeepAliveInterval(),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io){this.eventsSdkClass.emit(ht.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.log($t.INFO,`EMIT -> ${ht.KEEP_ALIVE}`,this.eventsSdkClass.authClass.token);return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var o;this.io&&(this.io.close(),(o=this.io)==null||o.disconnect(),this.io=void 0),jn.clearSessionStorage()}onKeepAliveResponse(o){if(this.eventsSdkClass.loggerClass.log($t.INFO,ht.KEEP_ALIVE_RESPONSE),o.errorCode){this.initSocketConnection();return}this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onConnect(){this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.connected=!0,this.eventsSdkClass.loggerClass.log($t.INFO,ht.CONNECT,this.eventsSdkClass.reconnectOptions),this.eventsSdkClass.eventEmitterClass.emit(ht.ONLINE_STATUS_EVENT,{isSocketConnected:!0})}onDisconnect(o){this.connected=!1,this.eventsSdkClass.loggerClass.log($t.INFO,ht.DISCONNECT,o),this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(ht.ONLINE_STATUS_EVENT,{isSocketConnected:!1}),this.doReconnect&&(console.log("attempt to connect..."),this.eventsSdkClass.connect(dn.NEXT))}onConnectError(o){this.eventsSdkClass.eventEmitterClass.emit(ht.ONLINE_STATUS_EVENT,{isSocketConnected:!1}),this.eventsSdkClass.loggerClass.log($t.ERROR,ht.CONNECT_ERROR_EVENT,o),setTimeout(()=>{this.eventsSdkClass.connect(dn.NEXT)},this.eventsSdkClass.options.reconnectionDelay)}configureUTCForObject(o,n,a,c){if(new Set(n).size!==n.length)throw new Error("Duplicate keys are not allowed in properties array");const f=(a-c*60)*1e3,v=Date.now()-f,d={...o};return n.forEach(b=>{d[`${String(b)}UTC`]=(o[String(b)]-c*60)*1e3,d[`${String(b)}UTCClient`]=(o[String(b)]-c*60)*1e3+v}),d}}var ef=Object.defineProperty,nf=(r,o,n)=>o in r?ef(r,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[o]=n,Ht=(r,o,n)=>(nf(r,typeof o!="symbol"?o+"":o,n),n);function rf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function of(r){if(r.__esModule)return r;var o=r.default;if(typeof o=="function"){var n=function a(){return this instanceof a?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};n.prototype=o.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(r).forEach(function(a){var c=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(n,a,c.get?c:{enumerable:!0,get:function(){return r[a]}})}),n}var Si={exports:{}},sf=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,af=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Ts=function(r){var o=r,n=r.indexOf("["),a=r.indexOf("]");n!=-1&&a!=-1&&(r=r.substring(0,n)+r.substring(n,a).replace(/:/g,";")+r.substring(a,r.length));for(var c=sf.exec(r||""),f={},v=14;v--;)f[af[v]]=c[v]||"";return n!=-1&&a!=-1&&(f.source=o,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=cf(f,f.path),f.queryKey=uf(f,f.query),f};function cf(r,o){var n=/\/{2,9}/g,a=o.replace(n,"/").split("/");return(o.substr(0,1)=="/"||o.length===0)&&a.splice(0,1),o.substr(o.length-1,1)=="/"&&a.splice(a.length-1,1),a}function uf(r,o){var n={};return o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,c,f){c&&(n[c]=f)}),n}var ki={exports:{}},Ai={exports:{}},Yn=1e3,Vn=Yn*60,Zn=Vn*60,Qn=Zn*24,ff=Qn*365.25,hf=function(r,o){o=o||{};var n=typeof r;if(n==="string"&&r.length>0)return lf(r);if(n==="number"&&isNaN(r)===!1)return o.long?df(r):pf(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function lf(r){if(r=String(r),!(r.length>100)){var o=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(r);if(o){var n=parseFloat(o[1]),a=(o[2]||"ms").toLowerCase();switch(a){case"years":case"year":case"yrs":case"yr":case"y":return n*ff;case"days":case"day":case"d":return n*Qn;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Zn;case"minutes":case"minute":case"mins":case"min":case"m":return n*Vn;case"seconds":case"second":case"secs":case"sec":case"s":return n*Yn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function pf(r){return r>=Qn?Math.round(r/Qn)+"d":r>=Zn?Math.round(r/Zn)+"h":r>=Vn?Math.round(r/Vn)+"m":r>=Yn?Math.round(r/Yn)+"s":r+"ms"}function df(r){return wr(r,Qn,"day")||wr(r,Zn,"hour")||wr(r,Vn,"minute")||wr(r,Yn,"second")||r+" ms"}function wr(r,o,n){if(!(r<o))return r<o*1.5?Math.floor(r/o)+" "+n:Math.ceil(r/o)+" "+n+"s"}(function(r,o){o=r.exports=a.debug=a.default=a,o.coerce=b,o.disable=v,o.enable=f,o.enabled=d,o.humanize=hf,o.instances=[],o.names=[],o.skips=[],o.formatters={};function n(p){var _=0,g;for(g in p)_=(_<<5)-_+p.charCodeAt(g),_|=0;return o.colors[Math.abs(_)%o.colors.length]}function a(p){var _;function g(){if(g.enabled){var l=g,u=+new Date,w=u-(_||u);l.diff=w,l.prev=_,l.curr=u,_=u;for(var A=new Array(arguments.length),k=0;k<A.length;k++)A[k]=arguments[k];A[0]=o.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");var L=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,function(J,N){if(J==="%%")return J;L++;var U=o.formatters[N];if(typeof U=="function"){var T=A[L];J=U.call(l,T),A.splice(L,1),L--}return J}),o.formatArgs.call(l,A);var Y=g.log||o.log||console.log.bind(console);Y.apply(l,A)}}return g.namespace=p,g.enabled=o.enabled(p),g.useColors=o.useColors(),g.color=n(p),g.destroy=c,typeof o.init=="function"&&o.init(g),o.instances.push(g),g}function c(){var p=o.instances.indexOf(this);return p!==-1?(o.instances.splice(p,1),!0):!1}function f(p){o.save(p),o.names=[],o.skips=[];var _,g=(typeof p=="string"?p:"").split(/[\s,]+/),l=g.length;for(_=0;_<l;_++)g[_]&&(p=g[_].replace(/\*/g,".*?"),p[0]==="-"?o.skips.push(new RegExp("^"+p.substr(1)+"$")):o.names.push(new RegExp("^"+p+"$")));for(_=0;_<o.instances.length;_++){var u=o.instances[_];u.enabled=o.enabled(u.namespace)}}function v(){o.enable("")}function d(p){if(p[p.length-1]==="*")return!0;var _,g;for(_=0,g=o.skips.length;_<g;_++)if(o.skips[_].test(p))return!1;for(_=0,g=o.names.length;_<g;_++)if(o.names[_].test(p))return!0;return!1}function b(p){return p instanceof Error?p.stack||p.message:p}})(Ai,Ai.exports);var gf=Ai.exports;(function(r,o){o=r.exports=gf,o.log=c,o.formatArgs=a,o.save=f,o.load=v,o.useColors=n,o.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:d(),o.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 n(){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+)/)}o.formatters.j=function(b){try{return JSON.stringify(b)}catch(p){return"[UnexpectedJSONParseError]: "+p.message}};function a(b){var p=this.useColors;if(b[0]=(p?"%c":"")+this.namespace+(p?" %c":" ")+b[0]+(p?"%c ":" ")+"+"+o.humanize(this.diff),!!p){var _="color: "+this.color;b.splice(1,0,_,"color: inherit");var g=0,l=0;b[0].replace(/%[a-zA-Z%]/g,function(u){u!=="%%"&&(g++,u==="%c"&&(l=g))}),b.splice(l,0,_)}}function c(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function f(b){try{b==null?o.storage.removeItem("debug"):o.storage.debug=b}catch{}}function v(){var b;try{b=o.storage.debug}catch{}return!b&&typeof process<"u"&&"env"in process&&(b=process.env.DEBUG),b}o.enable(v());function d(){try{return window.localStorage}catch{}}})(ki,ki.exports);var We=ki.exports,yf=Ts,Rs=We("socket.io-client:url"),vf=mf;function mf(r,o){var n=r;o=o||typeof location<"u"&&location,r==null&&(r=o.protocol+"//"+o.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=o.protocol+r:r=o.host+r),/^(https?|wss?):\/\//.test(r)||(Rs("protocol-less url %s",r),typeof o<"u"?r=o.protocol+"//"+r:r="https://"+r),Rs("parse %s",r),n=yf(r)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var a=n.host.indexOf(":")!==-1,c=a?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+c+":"+n.port,n.href=n.protocol+"://"+c+(o&&o.port===n.port?"":":"+n.port),n}var br={},Os={exports:{}};(function(r){r.exports=o;function o(a){if(a)return n(a)}function n(a){for(var c in o.prototype)a[c]=o.prototype[c];return a}o.prototype.on=o.prototype.addEventListener=function(a,c){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(c),this},o.prototype.once=function(a,c){function f(){this.off(a,f),c.apply(this,arguments)}return f.fn=c,this.on(a,f),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(a,c){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var f=this._callbacks["$"+a];if(!f)return this;if(arguments.length==1)return delete this._callbacks["$"+a],this;for(var v,d=0;d<f.length;d++)if(v=f[d],v===c||v.fn===c){f.splice(d,1);break}return f.length===0&&delete this._callbacks["$"+a],this},o.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var c=new Array(arguments.length-1),f=this._callbacks["$"+a],v=1;v<arguments.length;v++)c[v-1]=arguments[v];if(f){f=f.slice(0);for(var v=0,d=f.length;v<d;++v)f[v].apply(this,c)}return this},o.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]},o.prototype.hasListeners=function(a){return!!this.listeners(a).length}})(Os);var An=Os.exports,Cr={},_f={}.toString,xi=Array.isArray||function(r){return _f.call(r)=="[object Array]"},Is=Sf,wf=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",bf=typeof ArrayBuffer=="function",Cf=function(r){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer};function Sf(r){return wf&&Buffer.isBuffer(r)||bf&&(r instanceof ArrayBuffer||Cf(r))}var Ei=xi,Ns=Is,Bs=Object.prototype.toString,kf=typeof Blob=="function"||typeof Blob<"u"&&Bs.call(Blob)==="[object BlobConstructor]",Af=typeof File=="function"||typeof File<"u"&&Bs.call(File)==="[object FileConstructor]";Cr.deconstructPacket=function(r){var o=[],n=r.data,a=r;return a.data=Ti(n,o),a.attachments=o.length,{packet:a,buffers:o}};function Ti(r,o){if(!r)return r;if(Ns(r)){var n={_placeholder:!0,num:o.length};return o.push(r),n}else if(Ei(r)){for(var a=new Array(r.length),c=0;c<r.length;c++)a[c]=Ti(r[c],o);return a}else if(typeof r=="object"&&!(r instanceof Date)){var a={};for(var f in r)a[f]=Ti(r[f],o);return a}return r}Cr.reconstructPacket=function(r,o){return r.data=Ri(r.data,o),r.attachments=void 0,r};function Ri(r,o){if(!r)return r;if(r&&r._placeholder===!0){var n=typeof r.num=="number"&&r.num>=0&&r.num<o.length;if(n)return o[r.num];throw new Error("illegal attachments")}else if(Ei(r))for(var a=0;a<r.length;a++)r[a]=Ri(r[a],o);else if(typeof r=="object")for(var c in r)r[c]=Ri(r[c],o);return r}Cr.removeBlobs=function(r,o){function n(f,v,d){if(!f)return f;if(kf&&f instanceof Blob||Af&&f instanceof File){a++;var b=new FileReader;b.onload=function(){d?d[v]=this.result:c=this.result,--a||o(c)},b.readAsArrayBuffer(f)}else if(Ei(f))for(var p=0;p<f.length;p++)n(f[p],p,f);else if(typeof f=="object"&&!Ns(f))for(var _ in f)n(f[_],_,f)}var a=0,c=r;n(c),a||o(c)},function(r){var o=We("socket.io-parser"),n=An,a=Cr,c=xi,f=Is;r.protocol=4,r.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],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=v,r.Decoder=g;function v(){}var d=r.ERROR+'"encode error"';v.prototype.encode=function(k,L){if(o("encoding packet %j",k),r.BINARY_EVENT===k.type||r.BINARY_ACK===k.type)_(k,L);else{var Y=b(k);L([Y])}};function b(k){var L=""+k.type;if((r.BINARY_EVENT===k.type||r.BINARY_ACK===k.type)&&(L+=k.attachments+"-"),k.nsp&&k.nsp!=="/"&&(L+=k.nsp+","),k.id!=null&&(L+=k.id),k.data!=null){var Y=p(k.data);if(Y!==!1)L+=Y;else return d}return o("encoded %j as %s",k,L),L}function p(k){try{return JSON.stringify(k)}catch{return!1}}function _(k,L){function Y(J){var N=a.deconstructPacket(J),U=b(N.packet),T=N.buffers;T.unshift(U),L(T)}a.removeBlobs(k,Y)}function g(){this.reconstructor=null}n(g.prototype),g.prototype.add=function(k){var L;if(typeof k=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");L=l(k),r.BINARY_EVENT===L.type||r.BINARY_ACK===L.type?(this.reconstructor=new w(L),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",L)):this.emit("decoded",L)}else if(f(k)||k.base64)if(this.reconstructor)L=this.reconstructor.takeBinaryData(k),L&&(this.reconstructor=null,this.emit("decoded",L));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+k)};function l(k){var L=0,Y={type:Number(k.charAt(0))};if(r.types[Y.type]==null)return A("unknown packet type "+Y.type);if(r.BINARY_EVENT===Y.type||r.BINARY_ACK===Y.type){for(var J=L+1;k.charAt(++L)!=="-"&&L!=k.length;);var N=k.substring(J,L);if(N!=Number(N)||k.charAt(L)!=="-")throw new Error("Illegal attachments");Y.attachments=Number(N)}if(k.charAt(L+1)==="/"){for(var J=L+1;++L;){var U=k.charAt(L);if(U===","||L===k.length)break}Y.nsp=k.substring(J,L)}else Y.nsp="/";var T=k.charAt(L+1);if(T!==""&&Number(T)==T){for(var J=L+1;++L;){var U=k.charAt(L);if(U==null||Number(U)!=U){--L;break}if(L===k.length)break}Y.id=Number(k.substring(J,L+1))}if(k.charAt(++L)){var I=u(k.substr(L)),P=I!==!1&&(Y.type===r.ERROR||c(I));if(P)Y.data=I;else return A("invalid payload")}return o("decoded %s as %j",k,Y),Y}function u(k){try{return JSON.parse(k)}catch{return!1}}g.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function w(k){this.reconPack=k,this.buffers=[]}w.prototype.takeBinaryData=function(k){if(this.buffers.push(k),this.buffers.length===this.reconPack.attachments){var L=a.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),L}return null},w.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function A(k){return{type:r.ERROR,data:"parser error: "+k}}}(br);var Oi={exports:{}},Sr={},Ii={exports:{}};try{Ii.exports=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{Ii.exports=!1}var xf=Ii.exports,Ni=function(){return typeof self<"u"?self:typeof window<"u"?window:Function("return this")()}(),Ef=xf,Tf=Ni,Bi=function(r){var o=r.xdomain,n=r.xscheme,a=r.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!o||Ef))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!n&&a)return new XDomainRequest}catch{}if(!o)try{return new Tf[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}},Li={exports:{}},gn={},Rf=Object.keys||function(r){var o=[],n=Object.prototype.hasOwnProperty;for(var a in r)n.call(r,a)&&o.push(a);return o},Of=xi,Ls=Object.prototype.toString,If=typeof Blob=="function"||typeof Blob<"u"&&Ls.call(Blob)==="[object BlobConstructor]",Nf=typeof File=="function"||typeof File<"u"&&Ls.call(File)==="[object FileConstructor]",Us=kr;function kr(r){if(!r||typeof r!="object")return!1;if(Of(r)){for(var o=0,n=r.length;o<n;o++)if(kr(r[o]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(r)||typeof ArrayBuffer=="function"&&r instanceof ArrayBuffer||If&&r instanceof Blob||Nf&&r instanceof File)return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return kr(r.toJSON(),!0);for(var a in r)if(Object.prototype.hasOwnProperty.call(r,a)&&kr(r[a]))return!0;return!1}var Bf=function(r,o,n){var a=r.byteLength;if(o=o||0,n=n||a,r.slice)return r.slice(o,n);if(o<0&&(o+=a),n<0&&(n+=a),n>a&&(n=a),o>=a||o>=n||a===0)return new ArrayBuffer(0);for(var c=new Uint8Array(r),f=new Uint8Array(n-o),v=o,d=0;v<n;v++,d++)f[d]=c[v];return f.buffer},Lf=Uf;function Uf(r,o,n){var a=!1;return n=n||Df,c.count=r,r===0?o():c;function c(f,v){if(c.count<=0)throw new Error("after called too many times");--c.count,f?(a=!0,o(f),o=n):c.count===0&&!a&&o(null,v)}}function Df(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var Ze=String.fromCharCode;function Ds(r){for(var o=[],n=0,a=r.length,c,f;n<a;)c=r.charCodeAt(n++),c>=55296&&c<=56319&&n<a?(f=r.charCodeAt(n++),(f&64512)==56320?o.push(((c&1023)<<10)+(f&1023)+65536):(o.push(c),n--)):o.push(c);return o}function Pf(r){for(var o=r.length,n=-1,a,c="";++n<o;)a=r[n],a>65535&&(a-=65536,c+=Ze(a>>>10&1023|55296),a=56320|a&1023),c+=Ze(a);return c}function Ps(r,o){if(r>=55296&&r<=57343){if(o)throw Error("Lone surrogate U+"+r.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Ui(r,o){return Ze(r>>o&63|128)}function Ff(r,o){if(!(r&4294967168))return Ze(r);var n="";return r&4294965248?r&4294901760?r&4292870144||(n=Ze(r>>18&7|240),n+=Ui(r,12),n+=Ui(r,6)):(Ps(r,o)||(r=65533),n=Ze(r>>12&15|224),n+=Ui(r,6)):n=Ze(r>>6&31|192),n+=Ze(r&63|128),n}function Mf(r,o){o=o||{};for(var n=o.strict!==!1,a=Ds(r),c=a.length,f=-1,v,d="";++f<c;)v=a[f],d+=Ff(v,n);return d}function xn(){if(Qe>=xr)throw Error("Invalid byte index");var r=Ar[Qe]&255;if(Qe++,(r&192)==128)return r&63;throw Error("Invalid continuation byte")}function qf(r){var o,n,a,c,f;if(Qe>xr)throw Error("Invalid byte index");if(Qe==xr)return!1;if(o=Ar[Qe]&255,Qe++,!(o&128))return o;if((o&224)==192){if(n=xn(),f=(o&31)<<6|n,f>=128)return f;throw Error("Invalid continuation byte")}if((o&240)==224){if(n=xn(),a=xn(),f=(o&15)<<12|n<<6|a,f>=2048)return Ps(f,r)?f:65533;throw Error("Invalid continuation byte")}if((o&248)==240&&(n=xn(),a=xn(),c=xn(),f=(o&7)<<18|n<<12|a<<6|c,f>=65536&&f<=1114111))return f;throw Error("Invalid UTF-8 detected")}var Ar,xr,Qe;function Wf(r,o){o=o||{};var n=o.strict!==!1;Ar=Ds(r),xr=Ar.length,Qe=0;for(var a=[],c;(c=qf(n))!==!1;)a.push(c);return Pf(a)}var Hf={version:"2.1.2",encode:Mf,decode:Wf},Di={},Fs;function Kf(){return Fs||(Fs=1,function(r){Di.encode=function(o){var n=new Uint8Array(o),a,c=n.length,f="";for(a=0;a<c;a+=3)f+=r[n[a]>>2],f+=r[(n[a]&3)<<4|n[a+1]>>4],f+=r[(n[a+1]&15)<<2|n[a+2]>>6],f+=r[n[a+2]&63];return c%3===2?f=f.substring(0,f.length-1)+"=":c%3===1&&(f=f.substring(0,f.length-2)+"=="),f},Di.decode=function(o){var n=o.length*.75,a=o.length,c,f=0,v,d,b,p;o[o.length-1]==="="&&(n--,o[o.length-2]==="="&&n--);var _=new ArrayBuffer(n),g=new Uint8Array(_);for(c=0;c<a;c+=4)v=r.indexOf(o[c]),d=r.indexOf(o[c+1]),b=r.indexOf(o[c+2]),p=r.indexOf(o[c+3]),g[f++]=v<<2|d>>4,g[f++]=(d&15)<<4|b>>2,g[f++]=(b&3)<<6|p&63;return _}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),Di}var Pi,Ms;function zf(){if(Ms)return Pi;Ms=1;var r=typeof r<"u"?r:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:!1,o=function(){try{var d=new Blob(["hi"]);return d.size===2}catch{return!1}}(),n=o&&function(){try{var d=new Blob([new Uint8Array([1,2])]);return d.size===2}catch{return!1}}(),a=r&&r.prototype.append&&r.prototype.getBlob;function c(d){return d.map(function(b){if(b.buffer instanceof ArrayBuffer){var p=b.buffer;if(b.byteLength!==p.byteLength){var _=new Uint8Array(b.byteLength);_.set(new Uint8Array(p,b.byteOffset,b.byteLength)),p=_.buffer}return p}return b})}function f(d,b){b=b||{};var p=new r;return c(d).forEach(function(_){p.append(_)}),b.type?p.getBlob(b.type):p.getBlob()}function v(d,b){return new Blob(c(d),b||{})}return typeof Blob<"u"&&(f.prototype=Blob.prototype,v.prototype=Blob.prototype),Pi=function(){return o?n?Blob:v:a?f:void 0}(),Pi}(function(r){var o=Rf,n=Us,a=Bf,c=Lf,f=Hf,v;typeof ArrayBuffer<"u"&&(v=Kf());var d=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),b=typeof navigator<"u"&&/PhantomJS/i.test(navigator.userAgent),p=d||b;r.protocol=3;var _=r.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},g=o(_),l={type:"error",data:"parser error"},u=zf();r.encodePacket=function(N,U,T,I){typeof U=="function"&&(I=U,U=!1),typeof T=="function"&&(I=T,T=null);var P=N.data===void 0?void 0:N.data.buffer||N.data;if(typeof ArrayBuffer<"u"&&P instanceof ArrayBuffer)return A(N,U,I);if(typeof u<"u"&&P instanceof u)return L(N,U,I);if(P&&P.base64)return w(N,I);var R=_[N.type];return N.data!==void 0&&(R+=T?f.encode(String(N.data),{strict:!1}):String(N.data)),I(""+R)};function w(N,U){var T="b"+r.packets[N.type]+N.data.data;return U(T)}function A(N,U,T){if(!U)return r.encodeBase64Packet(N,T);var I=N.data,P=new Uint8Array(I),R=new Uint8Array(1+I.byteLength);R[0]=_[N.type];for(var B=0;B<P.length;B++)R[B+1]=P[B];return T(R.buffer)}function k(N,U,T){if(!U)return r.encodeBase64Packet(N,T);var I=new FileReader;return I.onload=function(){r.encodePacket({type:N.type,data:I.result},U,!0,T)},I.readAsArrayBuffer(N.data)}function L(N,U,T){if(!U)return r.encodeBase64Packet(N,T);if(p)return k(N,U,T);var I=new Uint8Array(1);I[0]=_[N.type];var P=new u([I.buffer,N.data]);return T(P)}r.encodeBase64Packet=function(N,U){var T="b"+r.packets[N.type];if(typeof u<"u"&&N.data instanceof u){var I=new FileReader;return I.onload=function(){var z=I.result.split(",")[1];U(T+z)},I.readAsDataURL(N.data)}var P;try{P=String.fromCharCode.apply(null,new Uint8Array(N.data))}catch{for(var R=new Uint8Array(N.data),B=new Array(R.length),H=0;H<R.length;H++)B[H]=R[H];P=String.fromCharCode.apply(null,B)}return T+=btoa(P),U(T)},r.decodePacket=function(N,U,T){if(N===void 0)return l;if(typeof N=="string"){if(N.charAt(0)==="b")return r.decodeBase64Packet(N.substr(1),U);if(T&&(N=Y(N),N===!1))return l;var P=N.charAt(0);return Number(P)!=P||!g[P]?l:N.length>1?{type:g[P],data:N.substring(1)}:{type:g[P]}}var I=new Uint8Array(N),P=I[0],R=a(N,1);return u&&U==="blob"&&(R=new u([R])),{type:g[P],data:R}};function Y(N){try{N=f.decode(N,{strict:!1})}catch{return!1}return N}r.decodeBase64Packet=function(N,U){var T=g[N.charAt(0)];if(!v)return{type:T,data:{base64:!0,data:N.substr(1)}};var I=v.decode(N.substr(1));return U==="blob"&&u&&(I=new u([I])),{type:T,data:I}},r.encodePayload=function(N,U,T){typeof U=="function"&&(T=U,U=null);var I=n(N);if(U&&I)return u&&!p?r.encodePayloadAsBlob(N,T):r.encodePayloadAsArrayBuffer(N,T);if(!N.length)return T("0:");function P(B){return B.length+":"+B}function R(B,H){r.encodePacket(B,I?U:!1,!1,function(z){H(null,P(z))})}J(N,R,function(B,H){return T(H.join(""))})};function J(N,U,T){for(var I=new Array(N.length),P=c(N.length,T),R=function(H,z,G){U(z,function(F,pt){I[H]=pt,G(F,I)})},B=0;B<N.length;B++)R(B,N[B],P)}r.decodePayload=function(N,U,T){if(typeof N!="string")return r.decodePayloadAsBinary(N,U,T);typeof U=="function"&&(T=U,U=null);var I;if(N==="")return T(l,0,1);for(var P="",R,B,H=0,z=N.length;H<z;H++){var G=N.charAt(H);if(G!==":"){P+=G;continue}if(P===""||P!=(R=Number(P))||(B=N.substr(H+1,R),P!=B.length))return T(l,0,1);if(B.length){if(I=r.decodePacket(B,U,!1),l.type===I.type&&l.data===I.data)return T(l,0,1);var F=T(I,H+R,z);if(F===!1)return}H+=R,P=""}if(P!=="")return T(l,0,1)},r.encodePayloadAsArrayBuffer=function(N,U){if(!N.length)return U(new ArrayBuffer(0));function T(I,P){r.encodePacket(I,!0,!0,function(R){return P(null,R)})}J(N,T,function(I,P){var R=P.reduce(function(z,G){var F;return typeof G=="string"?F=G.length:F=G.byteLength,z+F.toString().length+F+2},0),B=new Uint8Array(R),H=0;return P.forEach(function(z){var G=typeof z=="string",F=z;if(G){for(var pt=new Uint8Array(z.length),ct=0;ct<z.length;ct++)pt[ct]=z.charCodeAt(ct);F=pt.buffer}G?B[H++]=0:B[H++]=1;for(var xt=F.byteLength.toString(),ct=0;ct<xt.length;ct++)B[H++]=parseInt(xt[ct]);B[H++]=255;for(var pt=new Uint8Array(F),ct=0;ct<pt.length;ct++)B[H++]=pt[ct]}),U(B.buffer)})},r.encodePayloadAsBlob=function(N,U){function T(I,P){r.encodePacket(I,!0,!0,function(R){var B=new Uint8Array(1);if(B[0]=1,typeof R=="string"){for(var H=new Uint8Array(R.length),z=0;z<R.length;z++)H[z]=R.charCodeAt(z);R=H.buffer,B[0]=0}for(var G=R instanceof ArrayBuffer?R.byteLength:R.size,F=G.toString(),pt=new Uint8Array(F.length+1),z=0;z<F.length;z++)pt[z]=parseInt(F[z]);if(pt[F.length]=255,u){var ct=new u([B.buffer,pt.buffer,R]);P(null,ct)}})}J(N,T,function(I,P){return U(new u(P))})},r.decodePayloadAsBinary=function(N,U,T){typeof U=="function"&&(T=U,U=null);for(var I=N,P=[];I.byteLength>0;){for(var R=new Uint8Array(I),B=R[0]===0,H="",z=1;R[z]!==255;z++){if(H.length>310)return T(l,0,1);H+=R[z]}I=a(I,2+H.length),H=parseInt(H);var G=a(I,0,H);if(B)try{G=String.fromCharCode.apply(null,new Uint8Array(G))}catch{var F=new Uint8Array(G);G="";for(var z=0;z<F.length;z++)G+=String.fromCharCode(F[z])}P.push(G),I=a(I,H)}var pt=P.length;P.forEach(function(ct,xt){T(r.decodePacket(ct,U,!0),xt,pt)})}})(gn);var Fi,qs;function Mi(){if(qs)return Fi;qs=1;var r=gn,o=An;Fi=n;function n(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.withCredentials=a.withCredentials,this.pfx=a.pfx,this.key=a.key,this.passphrase=a.passphrase,this.cert=a.cert,this.ca=a.ca,this.ciphers=a.ciphers,this.rejectUnauthorized=a.rejectUnauthorized,this.forceNode=a.forceNode,this.isReactNative=a.isReactNative,this.extraHeaders=a.extraHeaders,this.localAddress=a.localAddress}return o(n.prototype),n.prototype.onError=function(a,c){var f=new Error(a);return f.type="TransportError",f.description=c,this.emit("error",f),this},n.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},n.prototype.send=function(a){if(this.readyState==="open")this.write(a);else throw new Error("Transport not open")},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(a){var c=r.decodePacket(a,this.socket.binaryType);this.onPacket(c)},n.prototype.onPacket=function(a){this.emit("packet",a)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")},Fi}var En={};En.encode=function(r){var o="";for(var n in r)r.hasOwnProperty(n)&&(o.length&&(o+="&"),o+=encodeURIComponent(n)+"="+encodeURIComponent(r[n]));return o},En.decode=function(r){for(var o={},n=r.split("&"),a=0,c=n.length;a<c;a++){var f=n[a].split("=");o[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return o};var Er=function(r,o){var n=function(){};n.prototype=o.prototype,r.prototype=new n,r.prototype.constructor=r},Ws="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Tr=64,Hs={},Ks=0,tn=0,zs;function qi(r){var o="";do o=Ws[r%Tr]+o,r=Math.floor(r/Tr);while(r>0);return o}function Xf(r){var o=0;for(tn=0;tn<r.length;tn++)o=o*Tr+Hs[r.charAt(tn)];return o}function Wi(){var r=qi(+new Date);return r!==zs?(Ks=0,zs=r):r+"."+qi(Ks++)}for(;tn<Tr;tn++)Hs[Ws[tn]]=tn;Wi.encode=qi,Wi.decode=Xf;var Xs=Wi,Gs=Mi(),Gf=En,$s=gn,$f=Er,Jf=Xs,Ee=We("engine.io-client:polling"),Js=Be,jf=function(){var r=Bi,o=new r({xdomain:!1});return o.responseType!=null}();function Be(r){var o=r&&r.forceBase64;(!jf||o)&&(this.supportsBinary=!1),Gs.call(this,r)}$f(Be,Gs),Be.prototype.name="polling",Be.prototype.doOpen=function(){this.poll()},Be.prototype.pause=function(r){var o=this;this.readyState="pausing";function n(){Ee("paused"),o.readyState="paused",r()}if(this.polling||!this.writable){var a=0;this.polling&&(Ee("we are currently polling - waiting to pause"),a++,this.once("pollComplete",function(){Ee("pre-pause polling complete"),--a||n()})),this.writable||(Ee("we are currently writing - waiting to pause"),a++,this.once("drain",function(){Ee("pre-pause writing complete"),--a||n()}))}else n()},Be.prototype.poll=function(){Ee("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},Be.prototype.onData=function(r){var o=this;Ee("polling got data %s",r);var n=function(a,c,f){if(o.readyState==="opening"&&a.type==="open"&&o.onOpen(),a.type==="close")return o.onClose(),!1;o.onPacket(a)};$s.decodePayload(r,this.socket.binaryType,n),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():Ee('ignoring poll - transport state "%s"',this.readyState))},Be.prototype.doClose=function(){var r=this;function o(){Ee("writing close packet"),r.write([{type:"close"}])}this.readyState==="open"?(Ee("transport open - closing"),o()):(Ee("transport not open - deferring close"),this.once("open",o))},Be.prototype.write=function(r){var o=this;this.writable=!1;var n=function(){o.writable=!0,o.emit("drain")};$s.encodePayload(r,this.supportsBinary,function(a){o.doWrite(a,n)})},Be.prototype.uri=function(){var r=this.query||{},o=this.secure?"https":"http",n="";this.timestampRequests!==!1&&(r[this.timestampParam]=Jf()),!this.supportsBinary&&!r.sid&&(r.b64=1),r=Gf.encode(r),this.port&&(o==="https"&&Number(this.port)!==443||o==="http"&&Number(this.port)!==80)&&(n=":"+this.port),r.length&&(r="?"+r);var a=this.hostname.indexOf(":")!==-1;return o+"://"+(a?"["+this.hostname+"]":this.hostname)+n+this.path+r};var Yf=Bi,js=Js,Vf=An,Zf=Er,Hi=We("engine.io-client:polling-xhr"),Qf=Ni;Li.exports=Tn,Li.exports.Request=Ft;function Ys(){}function Tn(r){if(js.call(this,r),this.requestTimeout=r.requestTimeout,this.extraHeaders=r.extraHeaders,typeof location<"u"){var o=location.protocol==="https:",n=location.port;n||(n=o?443:80),this.xd=typeof location<"u"&&r.hostname!==location.hostname||n!==r.port,this.xs=r.secure!==o}}Zf(Tn,js),Tn.prototype.supportsBinary=!0,Tn.prototype.request=function(r){return r=r||{},r.uri=this.uri(),r.xd=this.xd,r.xs=this.xs,r.agent=this.agent||!1,r.supportsBinary=this.supportsBinary,r.enablesXDR=this.enablesXDR,r.withCredentials=this.withCredentials,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,r.requestTimeout=this.requestTimeout,r.extraHeaders=this.extraHeaders,new Ft(r)},Tn.prototype.doWrite=function(r,o){var n=typeof r!="string"&&r!==void 0,a=this.request({method:"POST",data:r,isBinary:n}),c=this;a.on("success",o),a.on("error",function(f){c.onError("xhr post error",f)}),this.sendXhr=a},Tn.prototype.doPoll=function(){Hi("xhr poll");var r=this.request(),o=this;r.on("data",function(n){o.onData(n)}),r.on("error",function(n){o.onError("xhr poll error",n)}),this.pollXhr=r};function Ft(r){this.method=r.method||"GET",this.uri=r.uri,this.xd=!!r.xd,this.xs=!!r.xs,this.async=r.async!==!1,this.data=r.data!==void 0?r.data:null,this.agent=r.agent,this.isBinary=r.isBinary,this.supportsBinary=r.supportsBinary,this.enablesXDR=r.enablesXDR,this.withCredentials=r.withCredentials,this.requestTimeout=r.requestTimeout,this.pfx=r.pfx,this.key=r.key,this.passphrase=r.passphrase,this.cert=r.cert,this.ca=r.ca,this.ciphers=r.ciphers,this.rejectUnauthorized=r.rejectUnauthorized,this.extraHeaders=r.extraHeaders,this.create()}if(Vf(Ft.prototype),Ft.prototype.create=function(){var r={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};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;var o=this.xhr=new Yf(r),n=this;try{Hi("xhr open %s: %s",this.method,this.uri),o.open(this.method,this.uri,this.async);try{if(this.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(var a in this.extraHeaders)this.extraHeaders.hasOwnProperty(a)&&o.setRequestHeader(a,this.extraHeaders[a])}}catch{}if(this.method==="POST")try{this.isBinary?o.setRequestHeader("Content-type","application/octet-stream"):o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in o&&(o.withCredentials=this.withCredentials),this.requestTimeout&&(o.timeout=this.requestTimeout),this.hasXDR()?(o.onload=function(){n.onLoad()},o.onerror=function(){n.onError(o.responseText)}):o.onreadystatechange=function(){if(o.readyState===2)try{var c=o.getResponseHeader("Content-Type");(n.supportsBinary&&c==="application/octet-stream"||c==="application/octet-stream; charset=UTF-8")&&(o.responseType="arraybuffer")}catch{}o.readyState===4&&(o.status===200||o.status===1223?n.onLoad():setTimeout(function(){n.onError(typeof o.status=="number"?o.status:0)},0))},Hi("xhr data %s",this.data),o.send(this.data)}catch(c){setTimeout(function(){n.onError(c)},0);return}typeof document<"u"&&(this.index=Ft.requestsCount++,Ft.requests[this.index]=this)},Ft.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},Ft.prototype.onData=function(r){this.emit("data",r),this.onSuccess()},Ft.prototype.onError=function(r){this.emit("error",r),this.cleanup(!0)},Ft.prototype.cleanup=function(r){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=Ys:this.xhr.onreadystatechange=Ys,r)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Ft.requests[this.index],this.xhr=null}},Ft.prototype.onLoad=function(){var r;try{var o;try{o=this.xhr.getResponseHeader("Content-Type")}catch{}o==="application/octet-stream"||o==="application/octet-stream; charset=UTF-8"?r=this.xhr.response||this.xhr.responseText:r=this.xhr.responseText}catch(n){this.onError(n)}r!=null&&this.onData(r)},Ft.prototype.hasXDR=function(){return typeof XDomainRequest<"u"&&!this.xs&&this.enablesXDR},Ft.prototype.abort=function(){this.cleanup()},Ft.requestsCount=0,Ft.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Vs);else if(typeof addEventListener=="function"){var th="onpagehide"in Qf?"pagehide":"unload";addEventListener(th,Vs,!1)}}function Vs(){for(var r in Ft.requests)Ft.requests.hasOwnProperty(r)&&Ft.requests[r].abort()}var eh=Li.exports,Ki=Js,nh=Er,Zs=Ni,rh=Rn,ih=/\n/g,oh=/\\n/g,Rr;function sh(){}function Rn(r){Ki.call(this,r),this.query=this.query||{},Rr||(Rr=Zs.___eio=Zs.___eio||[]),this.index=Rr.length;var o=this;Rr.push(function(n){o.onData(n)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){o.script&&(o.script.onerror=sh)},!1)}nh(Rn,Ki),Rn.prototype.supportsBinary=!1,Rn.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),Ki.prototype.doClose.call(this)},Rn.prototype.doPoll=function(){var r=this,o=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),o.async=!0,o.src=this.uri(),o.onerror=function(c){r.onError("jsonp poll error",c)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(o,n):(document.head||document.body).appendChild(o),this.script=o;var a=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);a&&setTimeout(function(){var c=document.createElement("iframe");document.body.appendChild(c),document.body.removeChild(c)},100)},Rn.prototype.doWrite=function(r,o){var n=this;if(!this.form){var a=document.createElement("form"),c=document.createElement("textarea"),f=this.iframeId="eio_iframe_"+this.index,v;a.className="socketio",a.style.position="absolute",a.style.top="-1000px",a.style.left="-1000px",a.target=f,a.method="POST",a.setAttribute("accept-charset","utf-8"),c.name="d",a.appendChild(c),document.body.appendChild(a),this.form=a,this.area=c}this.form.action=this.uri();function d(){b(),o()}function b(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(_){n.onError("jsonp polling iframe removal error",_)}try{var p='<iframe src="javascript:0" name="'+n.iframeId+'">';v=document.createElement(p)}catch{v=document.createElement("iframe"),v.name=n.iframeId,v.src="javascript:0"}v.id=n.iframeId,n.form.appendChild(v),n.iframe=v}b(),r=r.replace(oh,`\\
44
+ `,102:"\f",114:"\r"},ut=function(){throw F=pt=null,SyntaxError()},jt=function(){for(var $,Q,X,rt,K,et=pt,nt=et.length;nt>F;)switch(K=et.charCodeAt(F)){case 9:case 10:case 13:case 32:F++;break;case 123:case 125:case 91:case 93:case 58:case 44:return $=Y?et.charAt(F):et[F],F++,$;case 34:for($="@",F++;nt>F;)if(K=et.charCodeAt(F),32>K)ut();else if(K==92)switch(K=et.charCodeAt(++F)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:$+=xt[K],F++;break;case 117:for(Q=++F,X=F+4;X>F;F++)K=et.charCodeAt(F),K>=48&&57>=K||K>=97&&102>=K||K>=65&&70>=K||ut();$+=ct("0x"+et.slice(Q,F));break;default:ut()}else{if(K==34)break;for(K=et.charCodeAt(F),Q=F;K>=32&&K!=92&&K!=34;)K=et.charCodeAt(++F);$+=et.slice(Q,F)}if(et.charCodeAt(F)==34)return F++,$;ut();default:if(Q=F,K==45&&(rt=!0,K=et.charCodeAt(++F)),K>=48&&57>=K){for(K==48&&(K=et.charCodeAt(F+1),K>=48&&57>=K)&&ut(),rt=!1;nt>F&&(K=et.charCodeAt(F),K>=48&&57>=K);F++);if(et.charCodeAt(F)==46){for(X=++F;nt>X&&(K=et.charCodeAt(X),K>=48&&57>=K);X++);X==F&&ut(),F=X}if(K=et.charCodeAt(F),K==101||K==69){for(K=et.charCodeAt(++F),(K==43||K==45)&&F++,X=F;nt>X&&(K=et.charCodeAt(X),K>=48&&57>=K);X++);X==F&&ut(),F=X}return+et.slice(Q,F)}if(rt&&ut(),et.slice(F,F+4)=="true")return F+=4,!0;if(et.slice(F,F+5)=="false")return F+=5,!1;if(et.slice(F,F+4)=="null")return F+=4,null;ut()}return"$"},Le=function($){var Q,X;if($=="$"&&ut(),typeof $=="string"){if((Y?$.charAt(0):$[0])=="@")return $.slice(1);if($=="["){for(Q=[];$=jt(),$!="]";X||(X=!0))X&&($==","?($=jt(),$=="]"&&ut()):ut()),$==","&&ut(),Q.push(Le($));return Q}if($=="{"){for(Q={};$=jt(),$!="}";X||(X=!0))X&&($==","?($=jt(),$=="}"&&ut()):ut()),($==","||typeof $!="string"||(Y?$.charAt(0):$[0])!="@"||jt()!=":")&&ut(),Q[$.slice(1)]=Le(jt());return Q}ut()}return $},fe=function($,Q,X){var rt=Nr($,Q,X);rt===d?delete $[Q]:$[Q]=rt},Nr=function($,Q,X){var rt,K=$[Q];if(typeof K=="object"&&K)if(b.call(K)==k)for(rt=K.length;rt--;)fe(K,rt,X);else v(K,function(et){fe(K,et,X)});return X.call($,Q,K)};_.parse=function($,Q){var X,rt;return F=0,pt=""+$,X=Le(jt()),jt()!="$"&&ut(),F=pt=null,Q&&b.call(Q)==l?Nr((rt={},rt[""]=X,rt),"",Q):X}}}})(this)},{}],48:[function(r,o){function n(a,c){var f=[];c=c||0;for(var v=c||0;v<a.length;v++)f[v-c]=a[v];return f}o.exports=n},{}]},{},[1])(1)}const Yu=Object.assign({"./v1_3_7.js":Object.freeze(Object.defineProperty({__proto__:null,default:ju},Symbol.toStringTag,{value:"Module"}))}),Vu=/v\d+_\d+_\d+/;function Zu(r){return typeof r=="function"}const Ci=Object.entries(Yu).reduce((r,o)=>{var c;const n=o[1].default,a=(c=o[0].match(Vu))==null?void 0:c[0];return Zu(n)&&a&&(r[a]=n()),r},{}),_s=r=>{if(r in Ci)return Ci[r];throw new Error(`Socket version ${r} not found`)},Qu={...Ci,getSocketVersion:_s,makeSocketVersion:(r,...o)=>_s(r)(...o)};var ws=(r=>(r.RINGING="Ringing",r.TALKING="Talking",r.DIALING="Dialing",r.HOLD="Hold",r))(ws||{}),bs=(r=>(r.INCOMING="Incoming",r.OUTGOING="Outgoing",r))(bs||{}),Cs=(r=>(r.AUTOMATIC="Automatic",r.IVR="IVR",r))(Cs||{}),Ss=(r=>(r.INCOMINC="Incoming",r.OUTGOING="Outgoing",r.SPY="Spy",r.CLICK2CALL="Click2Call",r))(Ss||{}),ks=(r=>(r.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",r.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",r))(ks||{}),ht=(r=>(r.ALL_DIALER_STATUS="AllDialersStatus",r.ALL_EXTENSION_STATUS="AllExtensionsStatus",r.ALL_USERS_STATUS="AllUsersStatus",r.CONNECT="connect",r.DISCONNECT="disconnect",r.CONNECT_ERROR_EVENT="connect_error",r.EXTENSION_EVENT="ExtensionEvent",r.KEEP_ALIVE="keepalive",r.KEEP_ALIVE_RESPONSE="keepaliveResponse",r.LOGIN_STATUS="loginStatus",r.LOGIN_SUCCESS="loginSuccess",r.QUEUE_EVENT="QueueEvent",r.ONLINE_STATUS_EVENT="onlineStatusEvent",r.DIALER_EVENT="DialerEvent",r.EXTENSIONS_UPDATED="ExtensionsUpdated",r))(ht||{}),As=(r=>(r.NEWCALL="NEWCALL",r.ANSWER="ANSWER",r.HOLD="HOLD",r.UNHOLD="UNHOLD",r.HANGUP="HANGUP",r.USER_STATUS_UPDATE="userStatusUpdate",r))(As||{}),xs=(r=>(r.NORMAL_HANGUP="Normal hangup",r.USER_BUSY="User busy",r.CALL_REJECTED="Call Rejected",r.UNALLOCATED_NUMBER="Unallocated (unassigned) number",r.UNKNOWN="Unknown",r.NO_USER_RESPONDING="No user responding",r.USER_ALERTING="User alerting, no answer",r.ANSWERED_ELSEWHERE="Answered elsewhere",r))(xs||{}),Es=(r=>(r.ANSWER="ANSWER",r.ABANDONED="ABANDONED",r.EXIT="EXIT",r.JOIN="JOIN",r))(Es||{});class tf{constructor(o){St(this,"io");St(this,"ioFunction");St(this,"lastEventTimestamp",new Date().getTime());St(this,"doReconnect",!0);St(this,"keepAliveInterval");St(this,"keepReconnectInterval");St(this,"connected",!1);this.eventsSdkClass=o,this.eventsSdkClass=o}getSocketIoFunction(o){const n=o.split("v="),a="v".concat(n[n.length-1]).replaceAll(".","_");this.ioFunction=Qu.getSocketVersion(a)}initSocketConnection(){const o=this.eventsSdkClass.authClass.token,n=this.eventsSdkClass.options.protocol,a=this.eventsSdkClass.server;try{const c=a?a.Domain:this.eventsSdkClass.URL,f=a?`${n}://${c}`:this.eventsSdkClass.URL;this.eventsSdkClass.loggerClass.log($t.INFO,"Connecting to..",f),this.eventsSdkClass.eventEmitterClass.emit(ht.ONLINE_STATUS_EVENT,{isSocketConnected:!1,attemptToConnect:f});const v={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:o},timeout:this.eventsSdkClass.options.timeout};if(o&&(v.query={token:o}),this.ioFunction&&f)this.io=this.ioFunction(f,v);else throw new Error("Socket server url no defined")}catch(c){this.eventsSdkClass.loggerClass.log($t.ERROR,"init socket connection error",c)}}initSocketEvents(){this.io&&this.io.on(ht.LOGIN_SUCCESS,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.LOGIN_SUCCESS,o)).on(ht.QUEUE_EVENT,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.QUEUE_EVENT,o)).on(ht.EXTENSION_EVENT,o=>{o.data.currentCall&&(o.data.currentCall=this.configureUTCForObject(o.data.currentCall,["callAnswered","callStarted"],o.servertime,o.servertimeoffset)),this.eventsSdkClass.eventEmitterClass.emit(ht.EXTENSION_EVENT,o)}).on(ht.DIALER_EVENT,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.DIALER_EVENT,o)).on(ht.LOGIN_STATUS,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.LOGIN_STATUS,o)).on(ht.ALL_EXTENSION_STATUS,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.ALL_EXTENSION_STATUS,o)).on(ht.ALL_DIALER_STATUS,o=>this.eventsSdkClass.eventEmitterClass.emit(ht.ALL_DIALER_STATUS,o)).on(ht.KEEP_ALIVE_RESPONSE,o=>this.onKeepAliveResponse(o)).on(ht.CONNECT,()=>this.onConnect()).on(ht.DISCONNECT,o=>this.onDisconnect(o)).on(ht.CONNECT_ERROR_EVENT,o=>this.onConnectError(o)).on(ht.EXTENSIONS_UPDATED,o=>{this.eventsSdkClass.eventEmitterClass.emit(ht.EXTENSIONS_UPDATED,o)})}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.clearKeepAliveInterval(),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io){this.eventsSdkClass.emit(ht.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.log($t.INFO,`EMIT -> ${ht.KEEP_ALIVE}`,this.eventsSdkClass.authClass.token);return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var o;this.io&&(this.io.close(),(o=this.io)==null||o.disconnect(),this.io=void 0),jn.clearSessionStorage()}onKeepAliveResponse(o){if(this.eventsSdkClass.loggerClass.log($t.INFO,ht.KEEP_ALIVE_RESPONSE),o.errorCode){this.initSocketConnection();return}this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onConnect(){this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.connected=!0,this.eventsSdkClass.loggerClass.log($t.INFO,ht.CONNECT,this.eventsSdkClass.reconnectOptions),this.eventsSdkClass.eventEmitterClass.emit(ht.ONLINE_STATUS_EVENT,{isSocketConnected:!0})}onDisconnect(o){this.connected=!1,this.eventsSdkClass.loggerClass.log($t.INFO,ht.DISCONNECT,o),this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(ht.ONLINE_STATUS_EVENT,{isSocketConnected:!1}),this.doReconnect&&(console.log("attempt to connect..."),this.eventsSdkClass.connect(dn.NEXT))}onConnectError(o){this.eventsSdkClass.eventEmitterClass.emit(ht.ONLINE_STATUS_EVENT,{isSocketConnected:!1}),this.eventsSdkClass.loggerClass.log($t.ERROR,ht.CONNECT_ERROR_EVENT,o),setTimeout(()=>{this.eventsSdkClass.connect(dn.NEXT)},this.eventsSdkClass.options.reconnectionDelay)}configureUTCForObject(o,n,a,c){if(new Set(n).size!==n.length)throw new Error("Duplicate keys are not allowed in properties array");const f=(a-c*60)*1e3,v=Date.now()-f,d={...o};return n.forEach(b=>{d[`${String(b)}UTC`]=(o[String(b)]-c*60)*1e3,d[`${String(b)}UTCClient`]=(o[String(b)]-c*60)*1e3+v}),d}}var ef=Object.defineProperty,nf=(r,o,n)=>o in r?ef(r,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[o]=n,Ht=(r,o,n)=>(nf(r,typeof o!="symbol"?o+"":o,n),n);function rf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function of(r){if(r.__esModule)return r;var o=r.default;if(typeof o=="function"){var n=function a(){return this instanceof a?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};n.prototype=o.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(r).forEach(function(a){var c=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(n,a,c.get?c:{enumerable:!0,get:function(){return r[a]}})}),n}var Si={exports:{}},sf=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,af=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Ts=function(r){var o=r,n=r.indexOf("["),a=r.indexOf("]");n!=-1&&a!=-1&&(r=r.substring(0,n)+r.substring(n,a).replace(/:/g,";")+r.substring(a,r.length));for(var c=sf.exec(r||""),f={},v=14;v--;)f[af[v]]=c[v]||"";return n!=-1&&a!=-1&&(f.source=o,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=cf(f,f.path),f.queryKey=uf(f,f.query),f};function cf(r,o){var n=/\/{2,9}/g,a=o.replace(n,"/").split("/");return(o.substr(0,1)=="/"||o.length===0)&&a.splice(0,1),o.substr(o.length-1,1)=="/"&&a.splice(a.length-1,1),a}function uf(r,o){var n={};return o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,c,f){c&&(n[c]=f)}),n}var ki={exports:{}},Ai={exports:{}},Yn=1e3,Vn=Yn*60,Zn=Vn*60,Qn=Zn*24,ff=Qn*365.25,hf=function(r,o){o=o||{};var n=typeof r;if(n==="string"&&r.length>0)return lf(r);if(n==="number"&&isNaN(r)===!1)return o.long?df(r):pf(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function lf(r){if(r=String(r),!(r.length>100)){var o=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(r);if(o){var n=parseFloat(o[1]),a=(o[2]||"ms").toLowerCase();switch(a){case"years":case"year":case"yrs":case"yr":case"y":return n*ff;case"days":case"day":case"d":return n*Qn;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Zn;case"minutes":case"minute":case"mins":case"min":case"m":return n*Vn;case"seconds":case"second":case"secs":case"sec":case"s":return n*Yn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function pf(r){return r>=Qn?Math.round(r/Qn)+"d":r>=Zn?Math.round(r/Zn)+"h":r>=Vn?Math.round(r/Vn)+"m":r>=Yn?Math.round(r/Yn)+"s":r+"ms"}function df(r){return wr(r,Qn,"day")||wr(r,Zn,"hour")||wr(r,Vn,"minute")||wr(r,Yn,"second")||r+" ms"}function wr(r,o,n){if(!(r<o))return r<o*1.5?Math.floor(r/o)+" "+n:Math.ceil(r/o)+" "+n+"s"}(function(r,o){o=r.exports=a.debug=a.default=a,o.coerce=b,o.disable=v,o.enable=f,o.enabled=d,o.humanize=hf,o.instances=[],o.names=[],o.skips=[],o.formatters={};function n(p){var _=0,g;for(g in p)_=(_<<5)-_+p.charCodeAt(g),_|=0;return o.colors[Math.abs(_)%o.colors.length]}function a(p){var _;function g(){if(g.enabled){var l=g,u=+new Date,w=u-(_||u);l.diff=w,l.prev=_,l.curr=u,_=u;for(var A=new Array(arguments.length),k=0;k<A.length;k++)A[k]=arguments[k];A[0]=o.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");var L=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,function(J,N){if(J==="%%")return J;L++;var U=o.formatters[N];if(typeof U=="function"){var T=A[L];J=U.call(l,T),A.splice(L,1),L--}return J}),o.formatArgs.call(l,A);var Y=g.log||o.log||console.log.bind(console);Y.apply(l,A)}}return g.namespace=p,g.enabled=o.enabled(p),g.useColors=o.useColors(),g.color=n(p),g.destroy=c,typeof o.init=="function"&&o.init(g),o.instances.push(g),g}function c(){var p=o.instances.indexOf(this);return p!==-1?(o.instances.splice(p,1),!0):!1}function f(p){o.save(p),o.names=[],o.skips=[];var _,g=(typeof p=="string"?p:"").split(/[\s,]+/),l=g.length;for(_=0;_<l;_++)g[_]&&(p=g[_].replace(/\*/g,".*?"),p[0]==="-"?o.skips.push(new RegExp("^"+p.substr(1)+"$")):o.names.push(new RegExp("^"+p+"$")));for(_=0;_<o.instances.length;_++){var u=o.instances[_];u.enabled=o.enabled(u.namespace)}}function v(){o.enable("")}function d(p){if(p[p.length-1]==="*")return!0;var _,g;for(_=0,g=o.skips.length;_<g;_++)if(o.skips[_].test(p))return!1;for(_=0,g=o.names.length;_<g;_++)if(o.names[_].test(p))return!0;return!1}function b(p){return p instanceof Error?p.stack||p.message:p}})(Ai,Ai.exports);var gf=Ai.exports;(function(r,o){o=r.exports=gf,o.log=c,o.formatArgs=a,o.save=f,o.load=v,o.useColors=n,o.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:d(),o.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 n(){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+)/)}o.formatters.j=function(b){try{return JSON.stringify(b)}catch(p){return"[UnexpectedJSONParseError]: "+p.message}};function a(b){var p=this.useColors;if(b[0]=(p?"%c":"")+this.namespace+(p?" %c":" ")+b[0]+(p?"%c ":" ")+"+"+o.humanize(this.diff),!!p){var _="color: "+this.color;b.splice(1,0,_,"color: inherit");var g=0,l=0;b[0].replace(/%[a-zA-Z%]/g,function(u){u!=="%%"&&(g++,u==="%c"&&(l=g))}),b.splice(l,0,_)}}function c(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function f(b){try{b==null?o.storage.removeItem("debug"):o.storage.debug=b}catch{}}function v(){var b;try{b=o.storage.debug}catch{}return!b&&typeof process<"u"&&"env"in process&&(b=process.env.DEBUG),b}o.enable(v());function d(){try{return window.localStorage}catch{}}})(ki,ki.exports);var We=ki.exports,yf=Ts,Rs=We("socket.io-client:url"),vf=mf;function mf(r,o){var n=r;o=o||typeof location<"u"&&location,r==null&&(r=o.protocol+"//"+o.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=o.protocol+r:r=o.host+r),/^(https?|wss?):\/\//.test(r)||(Rs("protocol-less url %s",r),typeof o<"u"?r=o.protocol+"//"+r:r="https://"+r),Rs("parse %s",r),n=yf(r)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var a=n.host.indexOf(":")!==-1,c=a?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+c+":"+n.port,n.href=n.protocol+"://"+c+(o&&o.port===n.port?"":":"+n.port),n}var br={},Os={exports:{}};(function(r){r.exports=o;function o(a){if(a)return n(a)}function n(a){for(var c in o.prototype)a[c]=o.prototype[c];return a}o.prototype.on=o.prototype.addEventListener=function(a,c){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(c),this},o.prototype.once=function(a,c){function f(){this.off(a,f),c.apply(this,arguments)}return f.fn=c,this.on(a,f),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(a,c){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var f=this._callbacks["$"+a];if(!f)return this;if(arguments.length==1)return delete this._callbacks["$"+a],this;for(var v,d=0;d<f.length;d++)if(v=f[d],v===c||v.fn===c){f.splice(d,1);break}return f.length===0&&delete this._callbacks["$"+a],this},o.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var c=new Array(arguments.length-1),f=this._callbacks["$"+a],v=1;v<arguments.length;v++)c[v-1]=arguments[v];if(f){f=f.slice(0);for(var v=0,d=f.length;v<d;++v)f[v].apply(this,c)}return this},o.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]},o.prototype.hasListeners=function(a){return!!this.listeners(a).length}})(Os);var An=Os.exports,Cr={},_f={}.toString,xi=Array.isArray||function(r){return _f.call(r)=="[object Array]"},Is=Sf,wf=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",bf=typeof ArrayBuffer=="function",Cf=function(r){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer};function Sf(r){return wf&&Buffer.isBuffer(r)||bf&&(r instanceof ArrayBuffer||Cf(r))}var Ei=xi,Ns=Is,Bs=Object.prototype.toString,kf=typeof Blob=="function"||typeof Blob<"u"&&Bs.call(Blob)==="[object BlobConstructor]",Af=typeof File=="function"||typeof File<"u"&&Bs.call(File)==="[object FileConstructor]";Cr.deconstructPacket=function(r){var o=[],n=r.data,a=r;return a.data=Ti(n,o),a.attachments=o.length,{packet:a,buffers:o}};function Ti(r,o){if(!r)return r;if(Ns(r)){var n={_placeholder:!0,num:o.length};return o.push(r),n}else if(Ei(r)){for(var a=new Array(r.length),c=0;c<r.length;c++)a[c]=Ti(r[c],o);return a}else if(typeof r=="object"&&!(r instanceof Date)){var a={};for(var f in r)a[f]=Ti(r[f],o);return a}return r}Cr.reconstructPacket=function(r,o){return r.data=Ri(r.data,o),r.attachments=void 0,r};function Ri(r,o){if(!r)return r;if(r&&r._placeholder===!0){var n=typeof r.num=="number"&&r.num>=0&&r.num<o.length;if(n)return o[r.num];throw new Error("illegal attachments")}else if(Ei(r))for(var a=0;a<r.length;a++)r[a]=Ri(r[a],o);else if(typeof r=="object")for(var c in r)r[c]=Ri(r[c],o);return r}Cr.removeBlobs=function(r,o){function n(f,v,d){if(!f)return f;if(kf&&f instanceof Blob||Af&&f instanceof File){a++;var b=new FileReader;b.onload=function(){d?d[v]=this.result:c=this.result,--a||o(c)},b.readAsArrayBuffer(f)}else if(Ei(f))for(var p=0;p<f.length;p++)n(f[p],p,f);else if(typeof f=="object"&&!Ns(f))for(var _ in f)n(f[_],_,f)}var a=0,c=r;n(c),a||o(c)},function(r){var o=We("socket.io-parser"),n=An,a=Cr,c=xi,f=Is;r.protocol=4,r.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],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=v,r.Decoder=g;function v(){}var d=r.ERROR+'"encode error"';v.prototype.encode=function(k,L){if(o("encoding packet %j",k),r.BINARY_EVENT===k.type||r.BINARY_ACK===k.type)_(k,L);else{var Y=b(k);L([Y])}};function b(k){var L=""+k.type;if((r.BINARY_EVENT===k.type||r.BINARY_ACK===k.type)&&(L+=k.attachments+"-"),k.nsp&&k.nsp!=="/"&&(L+=k.nsp+","),k.id!=null&&(L+=k.id),k.data!=null){var Y=p(k.data);if(Y!==!1)L+=Y;else return d}return o("encoded %j as %s",k,L),L}function p(k){try{return JSON.stringify(k)}catch{return!1}}function _(k,L){function Y(J){var N=a.deconstructPacket(J),U=b(N.packet),T=N.buffers;T.unshift(U),L(T)}a.removeBlobs(k,Y)}function g(){this.reconstructor=null}n(g.prototype),g.prototype.add=function(k){var L;if(typeof k=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");L=l(k),r.BINARY_EVENT===L.type||r.BINARY_ACK===L.type?(this.reconstructor=new w(L),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",L)):this.emit("decoded",L)}else if(f(k)||k.base64)if(this.reconstructor)L=this.reconstructor.takeBinaryData(k),L&&(this.reconstructor=null,this.emit("decoded",L));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+k)};function l(k){var L=0,Y={type:Number(k.charAt(0))};if(r.types[Y.type]==null)return A("unknown packet type "+Y.type);if(r.BINARY_EVENT===Y.type||r.BINARY_ACK===Y.type){for(var J=L+1;k.charAt(++L)!=="-"&&L!=k.length;);var N=k.substring(J,L);if(N!=Number(N)||k.charAt(L)!=="-")throw new Error("Illegal attachments");Y.attachments=Number(N)}if(k.charAt(L+1)==="/"){for(var J=L+1;++L;){var U=k.charAt(L);if(U===","||L===k.length)break}Y.nsp=k.substring(J,L)}else Y.nsp="/";var T=k.charAt(L+1);if(T!==""&&Number(T)==T){for(var J=L+1;++L;){var U=k.charAt(L);if(U==null||Number(U)!=U){--L;break}if(L===k.length)break}Y.id=Number(k.substring(J,L+1))}if(k.charAt(++L)){var I=u(k.substr(L)),P=I!==!1&&(Y.type===r.ERROR||c(I));if(P)Y.data=I;else return A("invalid payload")}return o("decoded %s as %j",k,Y),Y}function u(k){try{return JSON.parse(k)}catch{return!1}}g.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function w(k){this.reconPack=k,this.buffers=[]}w.prototype.takeBinaryData=function(k){if(this.buffers.push(k),this.buffers.length===this.reconPack.attachments){var L=a.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),L}return null},w.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function A(k){return{type:r.ERROR,data:"parser error: "+k}}}(br);var Oi={exports:{}},Sr={},Ii={exports:{}};try{Ii.exports=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{Ii.exports=!1}var xf=Ii.exports,Ni=function(){return typeof self<"u"?self:typeof window<"u"?window:Function("return this")()}(),Ef=xf,Tf=Ni,Bi=function(r){var o=r.xdomain,n=r.xscheme,a=r.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!o||Ef))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!n&&a)return new XDomainRequest}catch{}if(!o)try{return new Tf[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}},Li={exports:{}},gn={},Rf=Object.keys||function(r){var o=[],n=Object.prototype.hasOwnProperty;for(var a in r)n.call(r,a)&&o.push(a);return o},Of=xi,Ls=Object.prototype.toString,If=typeof Blob=="function"||typeof Blob<"u"&&Ls.call(Blob)==="[object BlobConstructor]",Nf=typeof File=="function"||typeof File<"u"&&Ls.call(File)==="[object FileConstructor]",Us=kr;function kr(r){if(!r||typeof r!="object")return!1;if(Of(r)){for(var o=0,n=r.length;o<n;o++)if(kr(r[o]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(r)||typeof ArrayBuffer=="function"&&r instanceof ArrayBuffer||If&&r instanceof Blob||Nf&&r instanceof File)return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return kr(r.toJSON(),!0);for(var a in r)if(Object.prototype.hasOwnProperty.call(r,a)&&kr(r[a]))return!0;return!1}var Bf=function(r,o,n){var a=r.byteLength;if(o=o||0,n=n||a,r.slice)return r.slice(o,n);if(o<0&&(o+=a),n<0&&(n+=a),n>a&&(n=a),o>=a||o>=n||a===0)return new ArrayBuffer(0);for(var c=new Uint8Array(r),f=new Uint8Array(n-o),v=o,d=0;v<n;v++,d++)f[d]=c[v];return f.buffer},Lf=Uf;function Uf(r,o,n){var a=!1;return n=n||Df,c.count=r,r===0?o():c;function c(f,v){if(c.count<=0)throw new Error("after called too many times");--c.count,f?(a=!0,o(f),o=n):c.count===0&&!a&&o(null,v)}}function Df(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var Ze=String.fromCharCode;function Ds(r){for(var o=[],n=0,a=r.length,c,f;n<a;)c=r.charCodeAt(n++),c>=55296&&c<=56319&&n<a?(f=r.charCodeAt(n++),(f&64512)==56320?o.push(((c&1023)<<10)+(f&1023)+65536):(o.push(c),n--)):o.push(c);return o}function Pf(r){for(var o=r.length,n=-1,a,c="";++n<o;)a=r[n],a>65535&&(a-=65536,c+=Ze(a>>>10&1023|55296),a=56320|a&1023),c+=Ze(a);return c}function Ps(r,o){if(r>=55296&&r<=57343){if(o)throw Error("Lone surrogate U+"+r.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Ui(r,o){return Ze(r>>o&63|128)}function Ff(r,o){if(!(r&4294967168))return Ze(r);var n="";return r&4294965248?r&4294901760?r&4292870144||(n=Ze(r>>18&7|240),n+=Ui(r,12),n+=Ui(r,6)):(Ps(r,o)||(r=65533),n=Ze(r>>12&15|224),n+=Ui(r,6)):n=Ze(r>>6&31|192),n+=Ze(r&63|128),n}function Mf(r,o){o=o||{};for(var n=o.strict!==!1,a=Ds(r),c=a.length,f=-1,v,d="";++f<c;)v=a[f],d+=Ff(v,n);return d}function xn(){if(Qe>=xr)throw Error("Invalid byte index");var r=Ar[Qe]&255;if(Qe++,(r&192)==128)return r&63;throw Error("Invalid continuation byte")}function qf(r){var o,n,a,c,f;if(Qe>xr)throw Error("Invalid byte index");if(Qe==xr)return!1;if(o=Ar[Qe]&255,Qe++,!(o&128))return o;if((o&224)==192){if(n=xn(),f=(o&31)<<6|n,f>=128)return f;throw Error("Invalid continuation byte")}if((o&240)==224){if(n=xn(),a=xn(),f=(o&15)<<12|n<<6|a,f>=2048)return Ps(f,r)?f:65533;throw Error("Invalid continuation byte")}if((o&248)==240&&(n=xn(),a=xn(),c=xn(),f=(o&7)<<18|n<<12|a<<6|c,f>=65536&&f<=1114111))return f;throw Error("Invalid UTF-8 detected")}var Ar,xr,Qe;function Wf(r,o){o=o||{};var n=o.strict!==!1;Ar=Ds(r),xr=Ar.length,Qe=0;for(var a=[],c;(c=qf(n))!==!1;)a.push(c);return Pf(a)}var Hf={version:"2.1.2",encode:Mf,decode:Wf},Di={},Fs;function Kf(){return Fs||(Fs=1,function(r){Di.encode=function(o){var n=new Uint8Array(o),a,c=n.length,f="";for(a=0;a<c;a+=3)f+=r[n[a]>>2],f+=r[(n[a]&3)<<4|n[a+1]>>4],f+=r[(n[a+1]&15)<<2|n[a+2]>>6],f+=r[n[a+2]&63];return c%3===2?f=f.substring(0,f.length-1)+"=":c%3===1&&(f=f.substring(0,f.length-2)+"=="),f},Di.decode=function(o){var n=o.length*.75,a=o.length,c,f=0,v,d,b,p;o[o.length-1]==="="&&(n--,o[o.length-2]==="="&&n--);var _=new ArrayBuffer(n),g=new Uint8Array(_);for(c=0;c<a;c+=4)v=r.indexOf(o[c]),d=r.indexOf(o[c+1]),b=r.indexOf(o[c+2]),p=r.indexOf(o[c+3]),g[f++]=v<<2|d>>4,g[f++]=(d&15)<<4|b>>2,g[f++]=(b&3)<<6|p&63;return _}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),Di}var Pi,Ms;function zf(){if(Ms)return Pi;Ms=1;var r=typeof r<"u"?r:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:!1,o=function(){try{var d=new Blob(["hi"]);return d.size===2}catch{return!1}}(),n=o&&function(){try{var d=new Blob([new Uint8Array([1,2])]);return d.size===2}catch{return!1}}(),a=r&&r.prototype.append&&r.prototype.getBlob;function c(d){return d.map(function(b){if(b.buffer instanceof ArrayBuffer){var p=b.buffer;if(b.byteLength!==p.byteLength){var _=new Uint8Array(b.byteLength);_.set(new Uint8Array(p,b.byteOffset,b.byteLength)),p=_.buffer}return p}return b})}function f(d,b){b=b||{};var p=new r;return c(d).forEach(function(_){p.append(_)}),b.type?p.getBlob(b.type):p.getBlob()}function v(d,b){return new Blob(c(d),b||{})}return typeof Blob<"u"&&(f.prototype=Blob.prototype,v.prototype=Blob.prototype),Pi=function(){return o?n?Blob:v:a?f:void 0}(),Pi}(function(r){var o=Rf,n=Us,a=Bf,c=Lf,f=Hf,v;typeof ArrayBuffer<"u"&&(v=Kf());var d=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),b=typeof navigator<"u"&&/PhantomJS/i.test(navigator.userAgent),p=d||b;r.protocol=3;var _=r.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},g=o(_),l={type:"error",data:"parser error"},u=zf();r.encodePacket=function(N,U,T,I){typeof U=="function"&&(I=U,U=!1),typeof T=="function"&&(I=T,T=null);var P=N.data===void 0?void 0:N.data.buffer||N.data;if(typeof ArrayBuffer<"u"&&P instanceof ArrayBuffer)return A(N,U,I);if(typeof u<"u"&&P instanceof u)return L(N,U,I);if(P&&P.base64)return w(N,I);var R=_[N.type];return N.data!==void 0&&(R+=T?f.encode(String(N.data),{strict:!1}):String(N.data)),I(""+R)};function w(N,U){var T="b"+r.packets[N.type]+N.data.data;return U(T)}function A(N,U,T){if(!U)return r.encodeBase64Packet(N,T);var I=N.data,P=new Uint8Array(I),R=new Uint8Array(1+I.byteLength);R[0]=_[N.type];for(var B=0;B<P.length;B++)R[B+1]=P[B];return T(R.buffer)}function k(N,U,T){if(!U)return r.encodeBase64Packet(N,T);var I=new FileReader;return I.onload=function(){r.encodePacket({type:N.type,data:I.result},U,!0,T)},I.readAsArrayBuffer(N.data)}function L(N,U,T){if(!U)return r.encodeBase64Packet(N,T);if(p)return k(N,U,T);var I=new Uint8Array(1);I[0]=_[N.type];var P=new u([I.buffer,N.data]);return T(P)}r.encodeBase64Packet=function(N,U){var T="b"+r.packets[N.type];if(typeof u<"u"&&N.data instanceof u){var I=new FileReader;return I.onload=function(){var z=I.result.split(",")[1];U(T+z)},I.readAsDataURL(N.data)}var P;try{P=String.fromCharCode.apply(null,new Uint8Array(N.data))}catch{for(var R=new Uint8Array(N.data),B=new Array(R.length),H=0;H<R.length;H++)B[H]=R[H];P=String.fromCharCode.apply(null,B)}return T+=btoa(P),U(T)},r.decodePacket=function(N,U,T){if(N===void 0)return l;if(typeof N=="string"){if(N.charAt(0)==="b")return r.decodeBase64Packet(N.substr(1),U);if(T&&(N=Y(N),N===!1))return l;var P=N.charAt(0);return Number(P)!=P||!g[P]?l:N.length>1?{type:g[P],data:N.substring(1)}:{type:g[P]}}var I=new Uint8Array(N),P=I[0],R=a(N,1);return u&&U==="blob"&&(R=new u([R])),{type:g[P],data:R}};function Y(N){try{N=f.decode(N,{strict:!1})}catch{return!1}return N}r.decodeBase64Packet=function(N,U){var T=g[N.charAt(0)];if(!v)return{type:T,data:{base64:!0,data:N.substr(1)}};var I=v.decode(N.substr(1));return U==="blob"&&u&&(I=new u([I])),{type:T,data:I}},r.encodePayload=function(N,U,T){typeof U=="function"&&(T=U,U=null);var I=n(N);if(U&&I)return u&&!p?r.encodePayloadAsBlob(N,T):r.encodePayloadAsArrayBuffer(N,T);if(!N.length)return T("0:");function P(B){return B.length+":"+B}function R(B,H){r.encodePacket(B,I?U:!1,!1,function(z){H(null,P(z))})}J(N,R,function(B,H){return T(H.join(""))})};function J(N,U,T){for(var I=new Array(N.length),P=c(N.length,T),R=function(H,z,G){U(z,function(F,pt){I[H]=pt,G(F,I)})},B=0;B<N.length;B++)R(B,N[B],P)}r.decodePayload=function(N,U,T){if(typeof N!="string")return r.decodePayloadAsBinary(N,U,T);typeof U=="function"&&(T=U,U=null);var I;if(N==="")return T(l,0,1);for(var P="",R,B,H=0,z=N.length;H<z;H++){var G=N.charAt(H);if(G!==":"){P+=G;continue}if(P===""||P!=(R=Number(P))||(B=N.substr(H+1,R),P!=B.length))return T(l,0,1);if(B.length){if(I=r.decodePacket(B,U,!1),l.type===I.type&&l.data===I.data)return T(l,0,1);var F=T(I,H+R,z);if(F===!1)return}H+=R,P=""}if(P!=="")return T(l,0,1)},r.encodePayloadAsArrayBuffer=function(N,U){if(!N.length)return U(new ArrayBuffer(0));function T(I,P){r.encodePacket(I,!0,!0,function(R){return P(null,R)})}J(N,T,function(I,P){var R=P.reduce(function(z,G){var F;return typeof G=="string"?F=G.length:F=G.byteLength,z+F.toString().length+F+2},0),B=new Uint8Array(R),H=0;return P.forEach(function(z){var G=typeof z=="string",F=z;if(G){for(var pt=new Uint8Array(z.length),ct=0;ct<z.length;ct++)pt[ct]=z.charCodeAt(ct);F=pt.buffer}G?B[H++]=0:B[H++]=1;for(var xt=F.byteLength.toString(),ct=0;ct<xt.length;ct++)B[H++]=parseInt(xt[ct]);B[H++]=255;for(var pt=new Uint8Array(F),ct=0;ct<pt.length;ct++)B[H++]=pt[ct]}),U(B.buffer)})},r.encodePayloadAsBlob=function(N,U){function T(I,P){r.encodePacket(I,!0,!0,function(R){var B=new Uint8Array(1);if(B[0]=1,typeof R=="string"){for(var H=new Uint8Array(R.length),z=0;z<R.length;z++)H[z]=R.charCodeAt(z);R=H.buffer,B[0]=0}for(var G=R instanceof ArrayBuffer?R.byteLength:R.size,F=G.toString(),pt=new Uint8Array(F.length+1),z=0;z<F.length;z++)pt[z]=parseInt(F[z]);if(pt[F.length]=255,u){var ct=new u([B.buffer,pt.buffer,R]);P(null,ct)}})}J(N,T,function(I,P){return U(new u(P))})},r.decodePayloadAsBinary=function(N,U,T){typeof U=="function"&&(T=U,U=null);for(var I=N,P=[];I.byteLength>0;){for(var R=new Uint8Array(I),B=R[0]===0,H="",z=1;R[z]!==255;z++){if(H.length>310)return T(l,0,1);H+=R[z]}I=a(I,2+H.length),H=parseInt(H);var G=a(I,0,H);if(B)try{G=String.fromCharCode.apply(null,new Uint8Array(G))}catch{var F=new Uint8Array(G);G="";for(var z=0;z<F.length;z++)G+=String.fromCharCode(F[z])}P.push(G),I=a(I,H)}var pt=P.length;P.forEach(function(ct,xt){T(r.decodePacket(ct,U,!0),xt,pt)})}})(gn);var Fi,qs;function Mi(){if(qs)return Fi;qs=1;var r=gn,o=An;Fi=n;function n(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.withCredentials=a.withCredentials,this.pfx=a.pfx,this.key=a.key,this.passphrase=a.passphrase,this.cert=a.cert,this.ca=a.ca,this.ciphers=a.ciphers,this.rejectUnauthorized=a.rejectUnauthorized,this.forceNode=a.forceNode,this.isReactNative=a.isReactNative,this.extraHeaders=a.extraHeaders,this.localAddress=a.localAddress}return o(n.prototype),n.prototype.onError=function(a,c){var f=new Error(a);return f.type="TransportError",f.description=c,this.emit("error",f),this},n.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},n.prototype.send=function(a){if(this.readyState==="open")this.write(a);else throw new Error("Transport not open")},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(a){var c=r.decodePacket(a,this.socket.binaryType);this.onPacket(c)},n.prototype.onPacket=function(a){this.emit("packet",a)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")},Fi}var En={};En.encode=function(r){var o="";for(var n in r)r.hasOwnProperty(n)&&(o.length&&(o+="&"),o+=encodeURIComponent(n)+"="+encodeURIComponent(r[n]));return o},En.decode=function(r){for(var o={},n=r.split("&"),a=0,c=n.length;a<c;a++){var f=n[a].split("=");o[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return o};var Er=function(r,o){var n=function(){};n.prototype=o.prototype,r.prototype=new n,r.prototype.constructor=r},Ws="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Tr=64,Hs={},Ks=0,tn=0,zs;function qi(r){var o="";do o=Ws[r%Tr]+o,r=Math.floor(r/Tr);while(r>0);return o}function Xf(r){var o=0;for(tn=0;tn<r.length;tn++)o=o*Tr+Hs[r.charAt(tn)];return o}function Wi(){var r=qi(+new Date);return r!==zs?(Ks=0,zs=r):r+"."+qi(Ks++)}for(;tn<Tr;tn++)Hs[Ws[tn]]=tn;Wi.encode=qi,Wi.decode=Xf;var Xs=Wi,Gs=Mi(),Gf=En,$s=gn,$f=Er,Jf=Xs,Ee=We("engine.io-client:polling"),Js=Be,jf=function(){var r=Bi,o=new r({xdomain:!1});return o.responseType!=null}();function Be(r){var o=r&&r.forceBase64;(!jf||o)&&(this.supportsBinary=!1),Gs.call(this,r)}$f(Be,Gs),Be.prototype.name="polling",Be.prototype.doOpen=function(){this.poll()},Be.prototype.pause=function(r){var o=this;this.readyState="pausing";function n(){Ee("paused"),o.readyState="paused",r()}if(this.polling||!this.writable){var a=0;this.polling&&(Ee("we are currently polling - waiting to pause"),a++,this.once("pollComplete",function(){Ee("pre-pause polling complete"),--a||n()})),this.writable||(Ee("we are currently writing - waiting to pause"),a++,this.once("drain",function(){Ee("pre-pause writing complete"),--a||n()}))}else n()},Be.prototype.poll=function(){Ee("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},Be.prototype.onData=function(r){var o=this;Ee("polling got data %s",r);var n=function(a,c,f){if(o.readyState==="opening"&&a.type==="open"&&o.onOpen(),a.type==="close")return o.onClose(),!1;o.onPacket(a)};$s.decodePayload(r,this.socket.binaryType,n),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():Ee('ignoring poll - transport state "%s"',this.readyState))},Be.prototype.doClose=function(){var r=this;function o(){Ee("writing close packet"),r.write([{type:"close"}])}this.readyState==="open"?(Ee("transport open - closing"),o()):(Ee("transport not open - deferring close"),this.once("open",o))},Be.prototype.write=function(r){var o=this;this.writable=!1;var n=function(){o.writable=!0,o.emit("drain")};$s.encodePayload(r,this.supportsBinary,function(a){o.doWrite(a,n)})},Be.prototype.uri=function(){var r=this.query||{},o=this.secure?"https":"http",n="";this.timestampRequests!==!1&&(r[this.timestampParam]=Jf()),!this.supportsBinary&&!r.sid&&(r.b64=1),r=Gf.encode(r),this.port&&(o==="https"&&Number(this.port)!==443||o==="http"&&Number(this.port)!==80)&&(n=":"+this.port),r.length&&(r="?"+r);var a=this.hostname.indexOf(":")!==-1;return o+"://"+(a?"["+this.hostname+"]":this.hostname)+n+this.path+r};var Yf=Bi,js=Js,Vf=An,Zf=Er,Hi=We("engine.io-client:polling-xhr"),Qf=Ni;Li.exports=Tn,Li.exports.Request=Ft;function Ys(){}function Tn(r){if(js.call(this,r),this.requestTimeout=r.requestTimeout,this.extraHeaders=r.extraHeaders,typeof location<"u"){var o=location.protocol==="https:",n=location.port;n||(n=o?443:80),this.xd=typeof location<"u"&&r.hostname!==location.hostname||n!==r.port,this.xs=r.secure!==o}}Zf(Tn,js),Tn.prototype.supportsBinary=!0,Tn.prototype.request=function(r){return r=r||{},r.uri=this.uri(),r.xd=this.xd,r.xs=this.xs,r.agent=this.agent||!1,r.supportsBinary=this.supportsBinary,r.enablesXDR=this.enablesXDR,r.withCredentials=this.withCredentials,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,r.requestTimeout=this.requestTimeout,r.extraHeaders=this.extraHeaders,new Ft(r)},Tn.prototype.doWrite=function(r,o){var n=typeof r!="string"&&r!==void 0,a=this.request({method:"POST",data:r,isBinary:n}),c=this;a.on("success",o),a.on("error",function(f){c.onError("xhr post error",f)}),this.sendXhr=a},Tn.prototype.doPoll=function(){Hi("xhr poll");var r=this.request(),o=this;r.on("data",function(n){o.onData(n)}),r.on("error",function(n){o.onError("xhr poll error",n)}),this.pollXhr=r};function Ft(r){this.method=r.method||"GET",this.uri=r.uri,this.xd=!!r.xd,this.xs=!!r.xs,this.async=r.async!==!1,this.data=r.data!==void 0?r.data:null,this.agent=r.agent,this.isBinary=r.isBinary,this.supportsBinary=r.supportsBinary,this.enablesXDR=r.enablesXDR,this.withCredentials=r.withCredentials,this.requestTimeout=r.requestTimeout,this.pfx=r.pfx,this.key=r.key,this.passphrase=r.passphrase,this.cert=r.cert,this.ca=r.ca,this.ciphers=r.ciphers,this.rejectUnauthorized=r.rejectUnauthorized,this.extraHeaders=r.extraHeaders,this.create()}if(Vf(Ft.prototype),Ft.prototype.create=function(){var r={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};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;var o=this.xhr=new Yf(r),n=this;try{Hi("xhr open %s: %s",this.method,this.uri),o.open(this.method,this.uri,this.async);try{if(this.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(var a in this.extraHeaders)this.extraHeaders.hasOwnProperty(a)&&o.setRequestHeader(a,this.extraHeaders[a])}}catch{}if(this.method==="POST")try{this.isBinary?o.setRequestHeader("Content-type","application/octet-stream"):o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in o&&(o.withCredentials=this.withCredentials),this.requestTimeout&&(o.timeout=this.requestTimeout),this.hasXDR()?(o.onload=function(){n.onLoad()},o.onerror=function(){n.onError(o.responseText)}):o.onreadystatechange=function(){if(o.readyState===2)try{var c=o.getResponseHeader("Content-Type");(n.supportsBinary&&c==="application/octet-stream"||c==="application/octet-stream; charset=UTF-8")&&(o.responseType="arraybuffer")}catch{}o.readyState===4&&(o.status===200||o.status===1223?n.onLoad():setTimeout(function(){n.onError(typeof o.status=="number"?o.status:0)},0))},Hi("xhr data %s",this.data),o.send(this.data)}catch(c){setTimeout(function(){n.onError(c)},0);return}typeof document<"u"&&(this.index=Ft.requestsCount++,Ft.requests[this.index]=this)},Ft.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},Ft.prototype.onData=function(r){this.emit("data",r),this.onSuccess()},Ft.prototype.onError=function(r){this.emit("error",r),this.cleanup(!0)},Ft.prototype.cleanup=function(r){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=Ys:this.xhr.onreadystatechange=Ys,r)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Ft.requests[this.index],this.xhr=null}},Ft.prototype.onLoad=function(){var r;try{var o;try{o=this.xhr.getResponseHeader("Content-Type")}catch{}o==="application/octet-stream"||o==="application/octet-stream; charset=UTF-8"?r=this.xhr.response||this.xhr.responseText:r=this.xhr.responseText}catch(n){this.onError(n)}r!=null&&this.onData(r)},Ft.prototype.hasXDR=function(){return typeof XDomainRequest<"u"&&!this.xs&&this.enablesXDR},Ft.prototype.abort=function(){this.cleanup()},Ft.requestsCount=0,Ft.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Vs);else if(typeof addEventListener=="function"){var th="onpagehide"in Qf?"pagehide":"unload";addEventListener(th,Vs,!1)}}function Vs(){for(var r in Ft.requests)Ft.requests.hasOwnProperty(r)&&Ft.requests[r].abort()}var eh=Li.exports,Ki=Js,nh=Er,Zs=Ni,rh=Rn,ih=/\n/g,oh=/\\n/g,Rr;function sh(){}function Rn(r){Ki.call(this,r),this.query=this.query||{},Rr||(Rr=Zs.___eio=Zs.___eio||[]),this.index=Rr.length;var o=this;Rr.push(function(n){o.onData(n)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){o.script&&(o.script.onerror=sh)},!1)}nh(Rn,Ki),Rn.prototype.supportsBinary=!1,Rn.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),Ki.prototype.doClose.call(this)},Rn.prototype.doPoll=function(){var r=this,o=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),o.async=!0,o.src=this.uri(),o.onerror=function(c){r.onError("jsonp poll error",c)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(o,n):(document.head||document.body).appendChild(o),this.script=o;var a=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);a&&setTimeout(function(){var c=document.createElement("iframe");document.body.appendChild(c),document.body.removeChild(c)},100)},Rn.prototype.doWrite=function(r,o){var n=this;if(!this.form){var a=document.createElement("form"),c=document.createElement("textarea"),f=this.iframeId="eio_iframe_"+this.index,v;a.className="socketio",a.style.position="absolute",a.style.top="-1000px",a.style.left="-1000px",a.target=f,a.method="POST",a.setAttribute("accept-charset","utf-8"),c.name="d",a.appendChild(c),document.body.appendChild(a),this.form=a,this.area=c}this.form.action=this.uri();function d(){b(),o()}function b(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(_){n.onError("jsonp polling iframe removal error",_)}try{var p='<iframe src="javascript:0" name="'+n.iframeId+'">';v=document.createElement(p)}catch{v=document.createElement("iframe"),v.name=n.iframeId,v.src="javascript:0"}v.id=n.iframeId,n.form.appendChild(v),n.iframe=v}b(),r=r.replace(oh,`\\
45
45
  `),this.area.value=r.replace(ih,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){n.iframe.readyState==="complete"&&d()}:this.iframe.onload=d};const ah={},ch=Object.freeze(Object.defineProperty({__proto__:null,default:ah},Symbol.toStringTag,{value:"Module"})),uh=of(ch);var zi=Mi(),fh=gn,hh=En,lh=Er,ph=Xs,dh=We("engine.io-client:websocket"),Or,Xi;if(typeof WebSocket<"u"?Or=WebSocket:typeof self<"u"&&(Or=self.WebSocket||self.MozWebSocket),typeof window>"u")try{Xi=uh}catch{}var On=Or||Xi,gh=me;function me(r){var o=r&&r.forceBase64;o&&(this.supportsBinary=!1),this.perMessageDeflate=r.perMessageDeflate,this.usingBrowserWebSocket=Or&&!r.forceNode,this.protocols=r.protocols,this.usingBrowserWebSocket||(On=Xi),zi.call(this,r)}lh(me,zi),me.prototype.name="websocket",me.prototype.supportsBinary=!0,me.prototype.doOpen=function(){if(this.check()){var r=this.uri(),o=this.protocols,n={};this.isReactNative||(n.agent=this.agent,n.perMessageDeflate=this.perMessageDeflate,n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?o?new On(r,o):new On(r):new On(r,o,n)}catch(a){return this.emit("error",a)}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()}},me.prototype.addEventListeners=function(){var r=this;this.ws.onopen=function(){r.onOpen()},this.ws.onclose=function(){r.onClose()},this.ws.onmessage=function(o){r.onData(o.data)},this.ws.onerror=function(o){r.onError("websocket error",o)}},me.prototype.write=function(r){var o=this;this.writable=!1;for(var n=r.length,a=0,c=n;a<c;a++)(function(v){fh.encodePacket(v,o.supportsBinary,function(d){if(!o.usingBrowserWebSocket){var b={};if(v.options&&(b.compress=v.options.compress),o.perMessageDeflate){var p=typeof d=="string"?Buffer.byteLength(d):d.length;p<o.perMessageDeflate.threshold&&(b.compress=!1)}}try{o.usingBrowserWebSocket?o.ws.send(d):o.ws.send(d,b)}catch{dh("websocket closed before onclose event")}--n||f()})})(r[a]);function f(){o.emit("flush"),setTimeout(function(){o.writable=!0,o.emit("drain")},0)}},me.prototype.onClose=function(){zi.prototype.onClose.call(this)},me.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},me.prototype.uri=function(){var r=this.query||{},o=this.secure?"wss":"ws",n="";this.port&&(o==="wss"&&Number(this.port)!==443||o==="ws"&&Number(this.port)!==80)&&(n=":"+this.port),this.timestampRequests&&(r[this.timestampParam]=ph()),this.supportsBinary||(r.b64=1),r=hh.encode(r),r.length&&(r="?"+r);var a=this.hostname.indexOf(":")!==-1;return o+"://"+(a?"["+this.hostname+"]":this.hostname)+n+this.path+r},me.prototype.check=function(){return!!On&&!("__initialize"in On&&this.name===me.prototype.name)};var yh=Bi,vh=eh,mh=rh,_h=gh;Sr.polling=wh,Sr.websocket=_h;function wh(r){var o,n=!1,a=!1,c=r.jsonp!==!1;if(typeof location<"u"){var f=location.protocol==="https:",v=location.port;v||(v=f?443:80),n=r.hostname!==location.hostname||v!==r.port,a=r.secure!==f}if(r.xdomain=n,r.xscheme=a,o=new yh(r),"open"in o&&!r.forceJSONP)return new vh(r);if(!c)throw new Error("JSONP disabled");return new mh(r)}var bh=[].indexOf,Qs=function(r,o){if(bh)return r.indexOf(o);for(var n=0;n<r.length;++n)if(r[n]===o)return n;return-1},Ch=Sr,Sh=An,Pt=We("engine.io-client:socket"),kh=Qs,ta=gn,ea=Ts,Ah=En,xh=_t;function _t(r,o){if(!(this instanceof _t))return new _t(r,o);o=o||{},r&&typeof r=="object"&&(o=r,r=null),r?(r=ea(r),o.hostname=r.host,o.secure=r.protocol==="https"||r.protocol==="wss",o.port=r.port,r.query&&(o.query=r.query)):o.host&&(o.hostname=ea(o.host).host),this.secure=o.secure!=null?o.secure:typeof location<"u"&&location.protocol==="https:",o.hostname&&!o.port&&(o.port=this.secure?"443":"80"),this.agent=o.agent||!1,this.hostname=o.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=o.port||(typeof location<"u"&&location.port?location.port:this.secure?443:80),this.query=o.query||{},typeof this.query=="string"&&(this.query=Ah.decode(this.query)),this.upgrade=o.upgrade!==!1,this.path=(o.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!o.forceJSONP,this.jsonp=o.jsonp!==!1,this.forceBase64=!!o.forceBase64,this.enablesXDR=!!o.enablesXDR,this.withCredentials=o.withCredentials!==!1,this.timestampParam=o.timestampParam||"t",this.timestampRequests=o.timestampRequests,this.transports=o.transports||["polling","websocket"],this.transportOptions=o.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=o.policyPort||843,this.rememberUpgrade=o.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=o.onlyBinaryUpgrades,this.perMessageDeflate=o.perMessageDeflate!==!1?o.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=o.pfx||void 0,this.key=o.key||void 0,this.passphrase=o.passphrase||void 0,this.cert=o.cert||void 0,this.ca=o.ca||void 0,this.ciphers=o.ciphers||void 0,this.rejectUnauthorized=o.rejectUnauthorized===void 0?!0:o.rejectUnauthorized,this.forceNode=!!o.forceNode,this.isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self>"u"||this.isReactNative)&&(o.extraHeaders&&Object.keys(o.extraHeaders).length>0&&(this.extraHeaders=o.extraHeaders),o.localAddress&&(this.localAddress=o.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}_t.priorWebsocketSuccess=!1,Sh(_t.prototype),_t.protocol=ta.protocol,_t.Socket=_t,_t.Transport=Mi(),_t.transports=Sr,_t.parser=gn,_t.prototype.createTransport=function(r){Pt('creating transport "%s"',r);var o=Eh(this.query);o.EIO=ta.protocol,o.transport=r;var n=this.transportOptions[r]||{};this.id&&(o.sid=this.id);var a=new Ch[r]({query:o,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,withCredentials:n.withCredentials||this.withCredentials,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative});return a};function Eh(r){var o={};for(var n in r)r.hasOwnProperty(n)&&(o[n]=r[n]);return o}_t.prototype.open=function(){var r;if(this.rememberUpgrade&&_t.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)r="websocket";else if(this.transports.length===0){var o=this;setTimeout(function(){o.emit("error","No transports available")},0);return}else r=this.transports[0];this.readyState="opening";try{r=this.createTransport(r)}catch{this.transports.shift(),this.open();return}r.open(),this.setTransport(r)},_t.prototype.setTransport=function(r){Pt("setting transport %s",r.name);var o=this;this.transport&&(Pt("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=r,r.on("drain",function(){o.onDrain()}).on("packet",function(n){o.onPacket(n)}).on("error",function(n){o.onError(n)}).on("close",function(){o.onClose("transport close")})},_t.prototype.probe=function(r){Pt('probing transport "%s"',r);var o=this.createTransport(r,{probe:1}),n=!1,a=this;_t.priorWebsocketSuccess=!1;function c(){if(a.onlyBinaryUpgrades){var g=!this.supportsBinary&&a.transport.supportsBinary;n=n||g}n||(Pt('probe transport "%s" opened',r),o.send([{type:"ping",data:"probe"}]),o.once("packet",function(l){if(!n)if(l.type==="pong"&&l.data==="probe"){if(Pt('probe transport "%s" pong',r),a.upgrading=!0,a.emit("upgrading",o),!o)return;_t.priorWebsocketSuccess=o.name==="websocket",Pt('pausing current transport "%s"',a.transport.name),a.transport.pause(function(){n||a.readyState!=="closed"&&(Pt("changing transport and sending upgrade packet"),_(),a.setTransport(o),o.send([{type:"upgrade"}]),a.emit("upgrade",o),o=null,a.upgrading=!1,a.flush())})}else{Pt('probe transport "%s" failed',r);var u=new Error("probe error");u.transport=o.name,a.emit("upgradeError",u)}}))}function f(){n||(n=!0,_(),o.close(),o=null)}function v(g){var l=new Error("probe error: "+g);l.transport=o.name,f(),Pt('probe transport "%s" failed because of error: %s',r,g),a.emit("upgradeError",l)}function d(){v("transport closed")}function b(){v("socket closed")}function p(g){o&&g.name!==o.name&&(Pt('"%s" works - aborting "%s"',g.name,o.name),f())}function _(){o.removeListener("open",c),o.removeListener("error",v),o.removeListener("close",d),a.removeListener("close",b),a.removeListener("upgrading",p)}o.once("open",c),o.once("error",v),o.once("close",d),this.once("close",b),this.once("upgrading",p),o.open()},_t.prototype.onOpen=function(){if(Pt("socket open"),this.readyState="open",_t.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){Pt("starting upgrade probes");for(var r=0,o=this.upgrades.length;r<o;r++)this.probe(this.upgrades[r])}},_t.prototype.onPacket=function(r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(Pt('socket receive: type "%s", data "%s"',r.type,r.data),this.emit("packet",r),this.emit("heartbeat"),r.type){case"open":this.onHandshake(JSON.parse(r.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var o=new Error("server error");o.code=r.data,this.onError(o);break;case"message":this.emit("data",r.data),this.emit("message",r.data);break}else Pt('packet received with socket readyState "%s"',this.readyState)},_t.prototype.onHandshake=function(r){this.emit("handshake",r),this.id=r.sid,this.transport.query.sid=r.sid,this.upgrades=this.filterUpgrades(r.upgrades),this.pingInterval=r.pingInterval,this.pingTimeout=r.pingTimeout,this.onOpen(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},_t.prototype.onHeartbeat=function(r){clearTimeout(this.pingTimeoutTimer);var o=this;o.pingTimeoutTimer=setTimeout(function(){o.readyState!=="closed"&&o.onClose("ping timeout")},r||o.pingInterval+o.pingTimeout)},_t.prototype.setPing=function(){var r=this;clearTimeout(r.pingIntervalTimer),r.pingIntervalTimer=setTimeout(function(){Pt("writing ping packet - expecting pong within %sms",r.pingTimeout),r.ping(),r.onHeartbeat(r.pingTimeout)},r.pingInterval)},_t.prototype.ping=function(){var r=this;this.sendPacket("ping",function(){r.emit("ping")})},_t.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()},_t.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(Pt("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},_t.prototype.write=_t.prototype.send=function(r,o,n){return this.sendPacket("message",r,o,n),this},_t.prototype.sendPacket=function(r,o,n,a){if(typeof o=="function"&&(a=o,o=void 0),typeof n=="function"&&(a=n,n=null),!(this.readyState==="closing"||this.readyState==="closed")){n=n||{},n.compress=n.compress!==!1;var c={type:r,data:o,options:n};this.emit("packetCreate",c),this.writeBuffer.push(c),a&&this.once("flush",a),this.flush()}},_t.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var r=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?a():o()}):this.upgrading?a():o()}function o(){r.onClose("forced close"),Pt("socket closing - telling transport to close"),r.transport.close()}function n(){r.removeListener("upgrade",n),r.removeListener("upgradeError",n),o()}function a(){r.once("upgrade",n),r.once("upgradeError",n)}return this},_t.prototype.onError=function(r){Pt("socket error %j",r),_t.priorWebsocketSuccess=!1,this.emit("error",r),this.onClose("transport error",r)},_t.prototype.onClose=function(r,o){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){Pt('socket close with reason: "%s"',r);var n=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",r,o),n.writeBuffer=[],n.prevBufferLen=0}},_t.prototype.filterUpgrades=function(r){for(var o=[],n=0,a=r.length;n<a;n++)~kh(this.transports,r[n])&&o.push(r[n]);return o},Oi.exports=xh,Oi.exports.parser=gn;var Th=Oi.exports,na={exports:{}},Rh=Oh;function Oh(r,o){var n=[];o=o||0;for(var a=o||0;a<r.length;a++)n[a-o]=r[a];return n}var ra=Ih;function Ih(r,o,n){return r.on(o,n),{destroy:function(){r.removeListener(o,n)}}}var ia=[].slice,oa=function(r,o){if(typeof o=="string"&&(o=r[o]),typeof o!="function")throw new Error("bind() requires a function");var n=ia.call(arguments,2);return function(){return o.apply(r,n.concat(ia.call(arguments)))}};(function(r,o){var n=br,a=An,c=Rh,f=ra,v=oa,d=We("socket.io-client:socket"),b=En,p=Us;r.exports=l;var _={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},g=a.prototype.emit;function l(u,w,A){this.io=u,this.nsp=w,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},A&&A.query&&(this.query=A.query),this.io.autoConnect&&this.open()}a(l.prototype),l.prototype.subEvents=function(){if(!this.subs){var u=this.io;this.subs=[f(u,"open",v(this,"onopen")),f(u,"packet",v(this,"onpacket")),f(u,"close",v(this,"onclose"))]}},l.prototype.open=l.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)},l.prototype.send=function(){var u=c(arguments);return u.unshift("message"),this.emit.apply(this,u),this},l.prototype.emit=function(u){if(_.hasOwnProperty(u))return g.apply(this,arguments),this;var w=c(arguments),A={type:(this.flags.binary!==void 0?this.flags.binary:p(w))?n.BINARY_EVENT:n.EVENT,data:w};return A.options={},A.options.compress=!this.flags||this.flags.compress!==!1,typeof w[w.length-1]=="function"&&(d("emitting packet with ack id %d",this.ids),this.acks[this.ids]=w.pop(),A.id=this.ids++),this.connected?this.packet(A):this.sendBuffer.push(A),this.flags={},this},l.prototype.packet=function(u){u.nsp=this.nsp,this.io.packet(u)},l.prototype.onopen=function(){if(d("transport is open - connecting"),this.nsp!=="/")if(this.query){var u=typeof this.query=="object"?b.encode(this.query):this.query;d("sending connect packet with query %s",u),this.packet({type:n.CONNECT,query:u})}else this.packet({type:n.CONNECT})},l.prototype.onclose=function(u){d("close (%s)",u),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",u)},l.prototype.onpacket=function(u){var w=u.nsp===this.nsp,A=u.type===n.ERROR&&u.nsp==="/";if(!(!w&&!A))switch(u.type){case n.CONNECT:this.onconnect();break;case n.EVENT:this.onevent(u);break;case n.BINARY_EVENT:this.onevent(u);break;case n.ACK:this.onack(u);break;case n.BINARY_ACK:this.onack(u);break;case n.DISCONNECT:this.ondisconnect();break;case n.ERROR:this.emit("error",u.data);break}},l.prototype.onevent=function(u){var w=u.data||[];d("emitting event %j",w),u.id!=null&&(d("attaching ack callback to event"),w.push(this.ack(u.id))),this.connected?g.apply(this,w):this.receiveBuffer.push(w)},l.prototype.ack=function(u){var w=this,A=!1;return function(){if(!A){A=!0;var k=c(arguments);d("sending ack %j",k),w.packet({type:p(k)?n.BINARY_ACK:n.ACK,id:u,data:k})}}},l.prototype.onack=function(u){var w=this.acks[u.id];typeof w=="function"?(d("calling ack %s with %j",u.id,u.data),w.apply(this,u.data),delete this.acks[u.id]):d("bad ack %s",u.id)},l.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},l.prototype.emitBuffered=function(){var u;for(u=0;u<this.receiveBuffer.length;u++)g.apply(this,this.receiveBuffer[u]);for(this.receiveBuffer=[],u=0;u<this.sendBuffer.length;u++)this.packet(this.sendBuffer[u]);this.sendBuffer=[]},l.prototype.ondisconnect=function(){d("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},l.prototype.destroy=function(){if(this.subs){for(var u=0;u<this.subs.length;u++)this.subs[u].destroy();this.subs=null}this.io.destroy(this)},l.prototype.close=l.prototype.disconnect=function(){return this.connected&&(d("performing disconnect (%s)",this.nsp),this.packet({type:n.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},l.prototype.compress=function(u){return this.flags.compress=u,this},l.prototype.binary=function(u){return this.flags.binary=u,this}})(na);var sa=na.exports,Nh=In;function In(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}In.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var o=Math.random(),n=Math.floor(o*this.jitter*r);r=Math.floor(o*10)&1?r+n:r-n}return Math.min(r,this.max)|0},In.prototype.reset=function(){this.attempts=0},In.prototype.setMin=function(r){this.ms=r},In.prototype.setMax=function(r){this.max=r},In.prototype.setJitter=function(r){this.jitter=r};var Bh=Th,Lh=sa,Uh=An,Dh=br,en=ra,Nn=oa,Jt=We("socket.io-client:manager"),aa=Qs,Ph=Nh,ca=Object.prototype.hasOwnProperty,ua=bt;function bt(r,o){if(!(this instanceof bt))return new bt(r,o);r&&typeof r=="object"&&(o=r,r=void 0),o=o||{},o.path=o.path||"/socket.io",this.nsps={},this.subs=[],this.opts=o,this.reconnection(o.reconnection!==!1),this.reconnectionAttempts(o.reconnectionAttempts||1/0),this.reconnectionDelay(o.reconnectionDelay||1e3),this.reconnectionDelayMax(o.reconnectionDelayMax||5e3),this.randomizationFactor(o.randomizationFactor||.5),this.backoff=new Ph({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(o.timeout==null?2e4:o.timeout),this.readyState="closed",this.uri=r,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=o.parser||Dh;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=o.autoConnect!==!1,this.autoConnect&&this.open()}bt.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var r in this.nsps)ca.call(this.nsps,r)&&this.nsps[r].emit.apply(this.nsps[r],arguments)},bt.prototype.updateSocketIds=function(){for(var r in this.nsps)ca.call(this.nsps,r)&&(this.nsps[r].id=this.generateId(r))},bt.prototype.generateId=function(r){return(r==="/"?"":r+"#")+this.engine.id},Uh(bt.prototype),bt.prototype.reconnection=function(r){return arguments.length?(this._reconnection=!!r,this):this._reconnection},bt.prototype.reconnectionAttempts=function(r){return arguments.length?(this._reconnectionAttempts=r,this):this._reconnectionAttempts},bt.prototype.reconnectionDelay=function(r){return arguments.length?(this._reconnectionDelay=r,this.backoff&&this.backoff.setMin(r),this):this._reconnectionDelay},bt.prototype.randomizationFactor=function(r){return arguments.length?(this._randomizationFactor=r,this.backoff&&this.backoff.setJitter(r),this):this._randomizationFactor},bt.prototype.reconnectionDelayMax=function(r){return arguments.length?(this._reconnectionDelayMax=r,this.backoff&&this.backoff.setMax(r),this):this._reconnectionDelayMax},bt.prototype.timeout=function(r){return arguments.length?(this._timeout=r,this):this._timeout},bt.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},bt.prototype.open=bt.prototype.connect=function(r,o){if(Jt("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Jt("opening %s",this.uri),this.engine=Bh(this.uri,this.opts);var n=this.engine,a=this;this.readyState="opening",this.skipReconnect=!1;var c=en(n,"open",function(){a.onopen(),r&&r()}),f=en(n,"error",function(b){if(Jt("connect_error"),a.cleanup(),a.readyState="closed",a.emitAll("connect_error",b),r){var p=new Error("Connection error");p.data=b,r(p)}else a.maybeReconnectOnOpen()});if(this._timeout!==!1){var v=this._timeout;Jt("connect attempt will timeout after %d",v),v===0&&c.destroy();var d=setTimeout(function(){Jt("connect attempt timed out after %d",v),c.destroy(),n.close(),n.emit("error","timeout"),a.emitAll("connect_timeout",v)},v);this.subs.push({destroy:function(){clearTimeout(d)}})}return this.subs.push(c),this.subs.push(f),this},bt.prototype.onopen=function(){Jt("open"),this.cleanup(),this.readyState="open",this.emit("open");var r=this.engine;this.subs.push(en(r,"data",Nn(this,"ondata"))),this.subs.push(en(r,"ping",Nn(this,"onping"))),this.subs.push(en(r,"pong",Nn(this,"onpong"))),this.subs.push(en(r,"error",Nn(this,"onerror"))),this.subs.push(en(r,"close",Nn(this,"onclose"))),this.subs.push(en(this.decoder,"decoded",Nn(this,"ondecoded")))},bt.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},bt.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},bt.prototype.ondata=function(r){this.decoder.add(r)},bt.prototype.ondecoded=function(r){this.emit("packet",r)},bt.prototype.onerror=function(r){Jt("error",r),this.emitAll("error",r)},bt.prototype.socket=function(r,o){var n=this.nsps[r];if(!n){n=new Lh(this,r,o),this.nsps[r]=n;var a=this;n.on("connecting",c),n.on("connect",function(){n.id=a.generateId(r)}),this.autoConnect&&c()}function c(){~aa(a.connecting,n)||a.connecting.push(n)}return n},bt.prototype.destroy=function(r){var o=aa(this.connecting,r);~o&&this.connecting.splice(o,1),!this.connecting.length&&this.close()},bt.prototype.packet=function(r){Jt("writing packet %j",r);var o=this;r.query&&r.type===0&&(r.nsp+="?"+r.query),o.encoding?o.packetBuffer.push(r):(o.encoding=!0,this.encoder.encode(r,function(n){for(var a=0;a<n.length;a++)o.engine.write(n[a],r.options);o.encoding=!1,o.processPacketQueue()}))},bt.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var r=this.packetBuffer.shift();this.packet(r)}},bt.prototype.cleanup=function(){Jt("cleanup");for(var r=this.subs.length,o=0;o<r;o++){var n=this.subs.shift();n.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},bt.prototype.close=bt.prototype.disconnect=function(){Jt("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},bt.prototype.onclose=function(r){Jt("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",r),this._reconnection&&!this.skipReconnect&&this.reconnect()},bt.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var r=this;if(this.backoff.attempts>=this._reconnectionAttempts)Jt("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var o=this.backoff.duration();Jt("will wait %dms before reconnect attempt",o),this.reconnecting=!0;var n=setTimeout(function(){r.skipReconnect||(Jt("attempting reconnect"),r.emitAll("reconnect_attempt",r.backoff.attempts),r.emitAll("reconnecting",r.backoff.attempts),!r.skipReconnect&&r.open(function(a){a?(Jt("reconnect attempt error"),r.reconnecting=!1,r.reconnect(),r.emitAll("reconnect_error",a.data)):(Jt("reconnect success"),r.onreconnect())}))},o);this.subs.push({destroy:function(){clearTimeout(n)}})}},bt.prototype.onreconnect=function(){var r=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",r)},function(r,o){var n=vf,a=br,c=ua,f=We("socket.io-client");r.exports=o=d;var v=o.managers={};function d(b,p){typeof b=="object"&&(p=b,b=void 0),p=p||{};var _=n(b),g=_.source,l=_.id,u=_.path,w=v[l]&&u in v[l].nsps,A=p.forceNew||p["force new connection"]||p.multiplex===!1||w,k;return A?(f("ignoring socket cache for %s",g),k=c(g,p)):(v[l]||(f("new io instance for %s",g),v[l]=c(g,p)),k=v[l]),_.query&&!p.query&&(p.query=_.query),k.socket(_.path,p)}o.protocol=a.protocol,o.connect=d,o.Manager=ua,o.Socket=sa}(Si,Si.exports);var Fh=Si.exports;const Mh=rf(Fh);let Ir;const qh=new Uint8Array(16);function Wh(){if(!Ir&&(Ir=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ir))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ir(qh)}const zt=[];for(let r=0;r<256;++r)zt.push((r+256).toString(16).slice(1));function Hh(r,o=0){return zt[r[o+0]]+zt[r[o+1]]+zt[r[o+2]]+zt[r[o+3]]+"-"+zt[r[o+4]]+zt[r[o+5]]+"-"+zt[r[o+6]]+zt[r[o+7]]+"-"+zt[r[o+8]]+zt[r[o+9]]+"-"+zt[r[o+10]]+zt[r[o+11]]+zt[r[o+12]]+zt[r[o+13]]+zt[r[o+14]]+zt[r[o+15]]}const Kh=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),fa={randomUUID:Kh};function zh(r,o,n){if(fa.randomUUID&&!o&&!r)return fa.randomUUID();r=r||{};const a=r.random||(r.rng||Wh)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,o){n=n||0;for(let c=0;c<16;++c)o[n+c]=a[c];return o}return Hh(a)}function Xh(r){return!!r&&(typeof r=="object"||typeof r=="function")&&typeof r.then=="function"}function Gh(r,o){const n=o.map(c=>JSON.stringify(c)).join(" "),a=new Date().toISOString();return JSON.stringify({level:r,time:a,message:n})}function $h(r){const o=r[0],n=r.slice(1);return{level:o,logs:n}}function Jh(r,o){const n=JSON.parse(r);return o.forEach(a=>delete n[a]),n}const jh={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},Gi={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4};let ie=console;class ha{constructor(o){Ht(this,"logToConsole"),Ht(this,"overloadGlobalConsole"),Ht(this,"namespace"),Ht(this,"socketEmitInterval"),Ht(this,"storageId"),Ht(this,"emitInProgress"),Ht(this,"queue"),Ht(this,"processing"),Ht(this,"interval"),Ht(this,"logIndex"),Ht(this,"socket"),Ht(this,"getItem"),Ht(this,"setItem"),Ht(this,"parseLog"),Ht(this,"_logMethod"),Ht(this,"_warnMethod"),Ht(this,"_errorMethod"),Ht(this,"_debugMethod");const{loggerOptions:n}=o;if(!n.namespace)throw new Error("Config property 'namespace' should be provided!");this.setupStorageFunctions(n.getItem,n.setItem,n.parseLog),this.namespace=n.namespace,this.socketEmitInterval=n.socketEmitInterval||Gi.socketEmitInterval,this.logToConsole=n.logToConsole!==void 0?n.logToConsole:Gi.logToConsole,this.overloadGlobalConsole=n.overloadGlobalConsole!==void 0?n.overloadGlobalConsole:Gi.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.emitInProgress=!1,this.logIndex=0,this.init(o)}setupStorageFunctions(o,n,a){this.getItem=o&&typeof o=="function"?this.promisifyStorageFunction(o):this.defaultGetItemFunction,this.setItem=n&&typeof n=="function"?this.promisifyStorageFunction(n):this.defaultSetItemFunction,this.parseLog=a&&typeof a=="function"?a:Gh}promisifyStorageFunction(o){const n=o("");return Xh(n)?o:async(...a)=>new Promise((c,f)=>{try{const v=o(...a);c(v)}catch(v){f(v)}})}init(o){const{socket:n,url:a,socketOptions:c={}}=o;this._logMethod=ie.log.bind(ie),this._warnMethod=ie.warn.bind(ie),this._errorMethod=ie.error.bind(ie),this._debugMethod=ie.debug.bind(ie),this.initStorage().then(()=>{if(n)this.socket=n;else if(a)this.socket=this.createConnection(a,c);else throw new Error("Must provide either a 'socket' or a 'url' for socket connection");this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval),this.overloadGlobalConsole&&this._overloadConsole()})}createConnection(o,n={}){const a={...jh,...n};return Mh(o,a)}async emitLogs(){if(!this.emitInProgress)try{const o=await this.getItem(this.storageId);if(!o)return;let n=[];this.emitInProgress=!0;const a=JSON.parse(o);let c=Object.keys(a);if(!c.length)return;if(!this.socket||!this.socket.connected)throw new Error("Socket is disconnected");for(const d of c)await this.socket.emit("Log",a[d]),n.push(d);const f=await this.getItem(this.storageId);if(!f)return;const v=Jh(f,n);await this.setItem(this.storageId,JSON.stringify(v))}catch(o){this._errorMethod(o)}finally{this.emitInProgress=!1}}disconnectSocket(){!this.socket||!this.interval||(this.socket.disconnect(),clearInterval(this.interval))}_overloadConsole(){const o=this;ie=Object.assign(ie,{log:function(){o.log(...arguments)},warn:function(){o.warn(...arguments)},error:function(){o.error(...arguments)},debug:function(){o.debug(...arguments)}})}async initStorage(){const o=await this.getItem(this.storageId);(!o||typeof o!="string")&&await this.setItem(this.storageId,JSON.stringify({}))}async resetStorage(){await this.setItem(this.storageId,JSON.stringify({}))}getStorageName(){const o=zh();return this.namespace.toString().toUpperCase()+o+Date.now()}async processLog(...o){try{if(o.length<2)return;const n=await this.getItem(this.storageId);if(!n)return;const{level:a,logs:c}=$h(o),f=JSON.parse(n),v=this.formItemKey(a);f[v]=this.parseLog(a,c),await this.setItem(this.storageId,JSON.stringify(f))}catch(n){this._errorMethod(n)}}async processQueue(){if(this.processing||this.queue.length===0)return;this.processing=!0;const o=this.queue.shift();await this.processLog(...o).finally(()=>{this.processing=!1,this.processQueue()})}log(...o){const n=["INFO",...o];this.queue.push(n),this.logToConsole&&this._logMethod.apply(ie,o),this.processQueue()}warn(...o){const n=["WARN",...o];this.queue.push(n),this.logToConsole&&this._warnMethod.apply(ie,o),this.processQueue()}error(...o){const n=["ERROR",...o];this.queue.push(n),this.logToConsole&&this._errorMethod.apply(ie,o),this.processQueue()}debug(...o){const n=["DEBUG",...o];this.queue.push(n),this.logToConsole&&this._debugMethod.apply(ie,o),this.processQueue()}async defaultGetItemFunction(o){return localStorage.getItem(o)}async defaultSetItemFunction(o,n){try{localStorage.setItem(o,n)}catch(a){this._errorMethod(a)}}formItemKey(o){const n=new Date().toISOString();return this.logIndex++,`${o}-${this.namespace}-${n}-${this.logIndex}`}}class Yh{constructor(o){St(this,"io");St(this,"storageLogger");this.eventsSdkClass=o,this.eventsSdkClass=o}init(){this.eventsSdkClass.options.useLogger&&(this.eventsSdkClass.options.loggerSocketConnection?this.io=this.eventsSdkClass.options.loggerSocketConnection:this.eventsSdkClass.socketIoClass.ioFunction&&(this.io=this.eventsSdkClass.socketIoClass.ioFunction(this.eventsSdkClass.options.loggerServer,this.eventsSdkClass.options.loggerConnectOptions)),this.io?this.storageLogger=new ha({socket:this.io,loggerOptions:this.eventsSdkClass.options.loggerConfig}):this.storageLogger=new ha({url:this.eventsSdkClass.options.loggerServer,socketOptions:this.eventsSdkClass.options.loggerConnectOptions,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}log(o,n,...a){const c=[n,...a];this.storageLogger?o===$t.INFO?this.storageLogger.log(c):o===$t.ERROR&&this.storageLogger.error(c):o===$t.INFO?console.log(c):o===$t.ERROR&&console.error(c)}}class Vh{constructor(o){St(this,"listeners",{[ht.ALL_EXTENSION_STATUS]:[],[ht.ALL_DIALER_STATUS]:[],[ht.ALL_USERS_STATUS]:[],[ht.QUEUE_EVENT]:[],[ht.EXTENSION_EVENT]:[],[ht.DIALER_EVENT]:[],[ht.LOGIN_SUCCESS]:[],[ht.LOGIN_STATUS]:[],[ht.KEEP_ALIVE_RESPONSE]:[],[ht.ONLINE_STATUS_EVENT]:[],[ht.EXTENSIONS_UPDATED]:[]});St(this,"allListeners",[]);this.eventsSdkClass=o,this.eventsSdkClass=o}on(o,n){o==="*"?this.allListeners.push(n):this.listeners[o].push(n)}off(o,n){if(o==="*")this.allListeners=this.allListeners.filter(a=>a!==n);else{const c=this.listeners[o].filter(f=>f!==n);this.listeners={...this.listeners,[o]:c}}}emit(o,n){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[o].forEach(c=>c({name:o,data:n}));const a={name:o,data:n};this.allListeners.forEach(c=>c(a))}}class Zh{constructor(o){St(this,"argumentOptions");St(this,"options");St(this,"servers",[]);St(this,"URLList",[]);St(this,"server");St(this,"URL");St(this,"socket");St(this,"mainServer");St(this,"alreadyAttemptedOtherServers",[]);St(this,"authClass",new Gu(this));St(this,"socketIoClass",new tf(this));St(this,"loggerClass",new Yh(this));St(this,"eventEmitterClass",new Vh(this));St(this,"reconnectOptions");St(this,"retryConnection");this.options={...Ju,...o},this.reconnectOptions={retryCount:1,maxReconnectAttempts:this.options.maxReconnectAttempts,reconnectionDelay:this.options.reconnectionDelay,minReconnectionDelay:this.options.reconnectionDelay,maxReconnectionDelay:3e5},this.server=this.options.fallbackServer,this.retryConnection=$u.debounce(this.connect.bind(this),this.reconnectOptions.reconnectionDelay,{leading:!0,trailing:!1}),this.argumentOptions={...o}}on(o,n){this.eventEmitterClass.on(o,n)}emit(o,n){this.socketIoClass.io&&this.socketIoClass.io.emit(o,n)}connect(o){o===dn.MAIN&&this.findMainServer(),o===dn.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0,this.socketIoClass.initSocketConnection(),this.socketIoClass.initSocketEvents(),this.socketIoClass.initKeepAlive(),this.loggerClass.init()}disconnect(){this.socketIoClass.doReconnect=!1,this.socketIoClass.closeAllConnections()}clearKeepAliveInterval(){this.socketIoClass.clearKeepAliveInterval()}findMainServer(){this.servers.length?(this.mainServer=this.servers.reduce((o,n)=>n.Priority>o.Priority?n:o),this.server=this.mainServer):this.URLList.length&&(this.URL=this.URLList[0])}findNextServer(){if(this.servers.length)if(this.server.Priority===this.mainServer.Priority){let o=this.servers.filter(n=>n.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(n.Priority)+1===0);o.length||(this.alreadyAttemptedOtherServers=[],o=this.servers.filter(n=>n.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(n.Priority)+1===0)),o.length&&(this.server=o.reduce((n,a)=>a.Priority>n.Priority?a:n),this.alreadyAttemptedOtherServers.push(this.server.Priority))}else this.server=this.mainServer;else if(this.URLList.length)if(this.URL===this.URLList[0]){let o=this.URLList.filter(n=>n!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(n)+1===0);o.length||(this.alreadyAttemptedOtherServers=[],o=this.URLList.filter(n=>n!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(n)+1===0)),o.length&&(this.URL=o[0],this.alreadyAttemptedOtherServers.push(this.URL))}else this.URL=this.URLList[0]}async init(){return this.socket,await this.authClass.login(this.options),this.getServers(),!0}getServers(){this.options.serverFetchStrategy==="static"&&this.argumentOptions.servers&&Array.isArray(this.argumentOptions.servers)&&this.argumentOptions.servers.length>1&&(this.servers=this.argumentOptions.servers)}}return Wt.CallStatusEnum=ws,Wt.CallTypeEnum=bs,Wt.DialerTypeEnum=Cs,Wt.DirectionEnum=Ss,Wt.DoNotCallMeStatusCodeEnum=ks,Wt.EventsEnum=ht,Wt.ExtensionEventReasonEnum=As,Wt.ExtensionHangupCauseEnum=xs,Wt.QueueEventReasonEnum=Es,Wt.default=Zh,Object.defineProperties(Wt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),Wt}({});
46
46
  //# sourceMappingURL=voicenter-events-sdk.iife.js.map