| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/elite-events-storybook/ |
Upload File : |
"use strict";(self.webpackChunkelite_events_nextjs=self.webpackChunkelite_events_nextjs||[]).push([[7661],{"./node_modules/socket.io-client/build/esm/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{io:()=>esm_lookup});var socket_io_parser_build_esm_namespaceObject={};__webpack_require__.r(socket_io_parser_build_esm_namespaceObject),__webpack_require__.d(socket_io_parser_build_esm_namespaceObject,{Decoder:()=>Decoder,Encoder:()=>Encoder,PacketType:()=>PacketType,protocol:()=>build_esm_protocol});const PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0",PACKET_TYPES.close="1",PACKET_TYPES.ping="2",PACKET_TYPES.pong="3",PACKET_TYPES.message="4",PACKET_TYPES.upgrade="5",PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(key=>{PACKET_TYPES_REVERSE[PACKET_TYPES[key]]=key});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),withNativeArrayBuffer="function"==typeof ArrayBuffer,isView=obj=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(obj):obj&&obj.buffer instanceof ArrayBuffer,encodePacket=({type,data},supportsBinary,callback)=>withNativeBlob&&data instanceof Blob?supportsBinary?callback(data):encodeBlobAsBase64(data,callback):withNativeArrayBuffer&&(data instanceof ArrayBuffer||isView(data))?supportsBinary?callback(data):encodeBlobAsBase64(new Blob([data]),callback):callback(PACKET_TYPES[type]+(data||"")),encodeBlobAsBase64=(data,callback)=>{const fileReader=new FileReader;return fileReader.onload=function(){const content=fileReader.result.split(",")[1];callback("b"+(content||""))},fileReader.readAsDataURL(data)};function toArray(data){return data instanceof Uint8Array?data:data instanceof ArrayBuffer?new Uint8Array(data):new Uint8Array(data.buffer,data.byteOffset,data.byteLength)}let TEXT_ENCODER;const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let i=0;i<64;i++)lookup[chars.charCodeAt(i)]=i;const decodePacket_browser_withNativeArrayBuffer="function"==typeof ArrayBuffer,decodePacket=(encodedPacket,binaryType)=>{if("string"!=typeof encodedPacket)return{type:"message",data:mapBinary(encodedPacket,binaryType)};const type=encodedPacket.charAt(0);if("b"===type)return{type:"message",data:decodeBase64Packet(encodedPacket.substring(1),binaryType)};return PACKET_TYPES_REVERSE[type]?encodedPacket.length>1?{type:PACKET_TYPES_REVERSE[type],data:encodedPacket.substring(1)}:{type:PACKET_TYPES_REVERSE[type]}:ERROR_PACKET},decodeBase64Packet=(data,binaryType)=>{if(decodePacket_browser_withNativeArrayBuffer){const decoded=(base64=>{let i,encoded1,encoded2,encoded3,encoded4,bufferLength=.75*base64.length,len=base64.length,p=0;"="===base64[base64.length-1]&&(bufferLength--,"="===base64[base64.length-2]&&bufferLength--);const arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer);for(i=0;i<len;i+=4)encoded1=lookup[base64.charCodeAt(i)],encoded2=lookup[base64.charCodeAt(i+1)],encoded3=lookup[base64.charCodeAt(i+2)],encoded4=lookup[base64.charCodeAt(i+3)],bytes[p++]=encoded1<<2|encoded2>>4,bytes[p++]=(15&encoded2)<<4|encoded3>>2,bytes[p++]=(3&encoded3)<<6|63&encoded4;return arraybuffer})(data);return mapBinary(decoded,binaryType)}return{base64:!0,data}},mapBinary=(data,binaryType)=>"blob"===binaryType?data instanceof Blob?data:new Blob([data]):data instanceof ArrayBuffer?data:data.buffer,SEPARATOR=String.fromCharCode(30);function createPacketEncoderStream(){return new TransformStream({transform(packet,controller){!function encodePacketToBinary(packet,callback){return withNativeBlob&&packet.data instanceof Blob?packet.data.arrayBuffer().then(toArray).then(callback):withNativeArrayBuffer&&(packet.data instanceof ArrayBuffer||isView(packet.data))?callback(toArray(packet.data)):void encodePacket(packet,!1,encoded=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),callback(TEXT_ENCODER.encode(encoded))})}(packet,encodedPacket=>{const payloadLength=encodedPacket.length;let header;if(payloadLength<126)header=new Uint8Array(1),new DataView(header.buffer).setUint8(0,payloadLength);else if(payloadLength<65536){header=new Uint8Array(3);const view=new DataView(header.buffer);view.setUint8(0,126),view.setUint16(1,payloadLength)}else{header=new Uint8Array(9);const view=new DataView(header.buffer);view.setUint8(0,127),view.setBigUint64(1,BigInt(payloadLength))}packet.data&&"string"!=typeof packet.data&&(header[0]|=128),controller.enqueue(header),controller.enqueue(encodedPacket)})}})}let TEXT_DECODER;function totalLength(chunks){return chunks.reduce((acc,chunk)=>acc+chunk.length,0)}function concatChunks(chunks,size){if(chunks[0].length===size)return chunks.shift();const buffer=new Uint8Array(size);let j=0;for(let i=0;i<size;i++)buffer[i]=chunks[0][j++],j===chunks[0].length&&(chunks.shift(),j=0);return chunks.length&&j<chunks[0].length&&(chunks[0]=chunks[0].slice(j)),buffer}function Emitter(obj){if(obj)return function mixin(obj){for(var key in Emitter.prototype)obj[key]=Emitter.prototype[key];return obj}(obj)}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){return this._callbacks=this._callbacks||{},(this._callbacks["$"+event]=this._callbacks["$"+event]||[]).push(fn),this},Emitter.prototype.once=function(event,fn){function on(){this.off(event,on),fn.apply(this,arguments)}return on.fn=fn,this.on(event,on),this},Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var cb,callbacks=this._callbacks["$"+event];if(!callbacks)return this;if(1==arguments.length)return delete this._callbacks["$"+event],this;for(var i=0;i<callbacks.length;i++)if((cb=callbacks[i])===fn||cb.fn===fn){callbacks.splice(i,1);break}return 0===callbacks.length&&delete this._callbacks["$"+event],this},Emitter.prototype.emit=function(event){this._callbacks=this._callbacks||{};for(var args=new Array(arguments.length-1),callbacks=this._callbacks["$"+event],i=1;i<arguments.length;i++)args[i-1]=arguments[i];if(callbacks){i=0;for(var len=(callbacks=callbacks.slice(0)).length;i<len;++i)callbacks[i].apply(this,args)}return this},Emitter.prototype.emitReserved=Emitter.prototype.emit,Emitter.prototype.listeners=function(event){return this._callbacks=this._callbacks||{},this._callbacks["$"+event]||[]},Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length};const nextTick="function"==typeof Promise&&"function"==typeof Promise.resolve?cb=>Promise.resolve().then(cb):(cb,setTimeoutFn)=>setTimeoutFn(cb,0),globalThisShim="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function pick(obj,...attr){return attr.reduce((acc,k)=>(obj.hasOwnProperty(k)&&(acc[k]=obj[k]),acc),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(obj,opts){opts.useNativeTimers?(obj.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),obj.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(obj.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),obj.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}function byteLength(obj){return"string"==typeof obj?function utf8Length(str){let c=0,length=0;for(let i=0,l=str.length;i<l;i++)c=str.charCodeAt(i),c<128?length+=1:c<2048?length+=2:c<55296||c>=57344?length+=3:(i++,length+=4);return length}(obj):Math.ceil(1.33*(obj.byteLength||obj.size))}function randomString(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class TransportError extends Error{constructor(reason,description,context){super(reason),this.description=description,this.context=context,this.type="TransportError"}}class Transport extends Emitter{constructor(opts){super(),this.writable=!1,installTimerFunctions(this,opts),this.opts=opts,this.query=opts.query,this.socket=opts.socket,this.supportsBinary=!opts.forceBase64}onError(reason,description,context){return super.emitReserved("error",new TransportError(reason,description,context)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(packets){"open"===this.readyState&&this.write(packets)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(data){const packet=decodePacket(data,this.socket.binaryType);this.onPacket(packet)}onPacket(packet){super.emitReserved("packet",packet)}onClose(details){this.readyState="closed",super.emitReserved("close",details)}pause(onPause){}createUri(schema,query={}){return schema+"://"+this._hostname()+this._port()+this.opts.path+this._query(query)}_hostname(){const hostname=this.opts.hostname;return-1===hostname.indexOf(":")?hostname:"["+hostname+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(query){const encodedQuery=function parseqs_encode(obj){let str="";for(let i in obj)obj.hasOwnProperty(i)&&(str.length&&(str+="&"),str+=encodeURIComponent(i)+"="+encodeURIComponent(obj[i]));return str}(query);return encodedQuery.length?"?"+encodedQuery:""}}class polling_Polling extends Transport{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(onPause){this.readyState="pausing";const pause=()=>{this.readyState="paused",onPause()};if(this._polling||!this.writable){let total=0;this._polling&&(total++,this.once("pollComplete",function(){--total||pause()})),this.writable||(total++,this.once("drain",function(){--total||pause()}))}else pause()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(data){((encodedPayload,binaryType)=>{const encodedPackets=encodedPayload.split(SEPARATOR),packets=[];for(let i=0;i<encodedPackets.length;i++){const decodedPacket=decodePacket(encodedPackets[i],binaryType);if(packets.push(decodedPacket),"error"===decodedPacket.type)break}return packets})(data,this.socket.binaryType).forEach(packet=>{if("opening"===this.readyState&&"open"===packet.type&&this.onOpen(),"close"===packet.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(packet)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const close=()=>{this.write([{type:"close"}])};"open"===this.readyState?close():this.once("open",close)}write(packets){this.writable=!1,((packets,callback)=>{const length=packets.length,encodedPackets=new Array(length);let count=0;packets.forEach((packet,i)=>{encodePacket(packet,!1,encodedPacket=>{encodedPackets[i]=encodedPacket,++count===length&&callback(encodedPackets.join(SEPARATOR))})})})(packets,data=>{this.doWrite(data,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const schema=this.opts.secure?"https":"http",query=this.query||{};return!1!==this.opts.timestampRequests&&(query[this.opts.timestampParam]=randomString()),this.supportsBinary||query.sid||(query.b64=1),this.createUri(schema,query)}}let value=!1;try{value="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(err){}const hasCORS=value;function empty(){}class BaseXHR extends polling_Polling{constructor(opts){if(super(opts),"undefined"!=typeof location){const isSSL="https:"===location.protocol;let port=location.port;port||(port=isSSL?"443":"80"),this.xd="undefined"!=typeof location&&opts.hostname!==location.hostname||port!==opts.port}}doWrite(data,fn){const req=this.request({method:"POST",data});req.on("success",fn),req.on("error",(xhrStatus,context)=>{this.onError("xhr post error",xhrStatus,context)})}doPoll(){const req=this.request();req.on("data",this.onData.bind(this)),req.on("error",(xhrStatus,context)=>{this.onError("xhr poll error",xhrStatus,context)}),this.pollXhr=req}}class Request extends Emitter{constructor(createRequest,uri,opts){super(),this.createRequest=createRequest,installTimerFunctions(this,opts),this._opts=opts,this._method=opts.method||"GET",this._uri=uri,this._data=void 0!==opts.data?opts.data:null,this._create()}_create(){var _a;const opts=pick(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");opts.xdomain=!!this._opts.xd;const xhr=this._xhr=this.createRequest(opts);try{xhr.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){xhr.setDisableHeaderCheck&&xhr.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&xhr.setRequestHeader(i,this._opts.extraHeaders[i])}}catch(e){}if("POST"===this._method)try{xhr.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{xhr.setRequestHeader("Accept","*/*")}catch(e){}null===(_a=this._opts.cookieJar)||void 0===_a||_a.addCookies(xhr),"withCredentials"in xhr&&(xhr.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(xhr.timeout=this._opts.requestTimeout),xhr.onreadystatechange=()=>{var _a;3===xhr.readyState&&(null===(_a=this._opts.cookieJar)||void 0===_a||_a.parseCookies(xhr.getResponseHeader("set-cookie"))),4===xhr.readyState&&(200===xhr.status||1223===xhr.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof xhr.status?xhr.status:0)},0))},xhr.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=Request.requestsCount++,Request.requests[this._index]=this)}_onError(err){this.emitReserved("error",err,this._xhr),this._cleanup(!0)}_cleanup(fromError){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=empty,fromError)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Request.requests[this._index],this._xhr=null}}_onLoad(){const data=this._xhr.responseText;null!==data&&(this.emitReserved("data",data),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Request.requestsCount=0,Request.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",unloadHandler);else if("function"==typeof addEventListener){addEventListener("onpagehide"in globalThisShim?"pagehide":"unload",unloadHandler,!1)}function unloadHandler(){for(let i in Request.requests)Request.requests.hasOwnProperty(i)&&Request.requests[i].abort()}const hasXHR2=function(){const xhr=newRequest({xdomain:!1});return xhr&&null!==xhr.responseType}();function newRequest(opts){const xdomain=opts.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!xdomain||hasCORS))return new XMLHttpRequest}catch(e){}if(!xdomain)try{return new(globalThisShim[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class BaseWS extends Transport{get name(){return"websocket"}doOpen(){const uri=this.uri(),protocols=this.opts.protocols,opts=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(opts.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(uri,protocols,opts)}catch(err){return this.emitReserved("error",err)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=closeEvent=>this.onClose({description:"websocket connection closed",context:closeEvent}),this.ws.onmessage=ev=>this.onData(ev.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(packets){this.writable=!1;for(let i=0;i<packets.length;i++){const packet=packets[i],lastPacket=i===packets.length-1;encodePacket(packet,this.supportsBinary,data=>{try{this.doWrite(packet,data)}catch(e){}lastPacket&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const schema=this.opts.secure?"wss":"ws",query=this.query||{};return this.opts.timestampRequests&&(query[this.opts.timestampParam]=randomString()),this.supportsBinary||(query.b64=1),this.createUri(schema,query)}}const WebSocketCtor=globalThisShim.WebSocket||globalThisShim.MozWebSocket;const transports={websocket:class WS extends BaseWS{createSocket(uri,protocols,opts){return isReactNative?new WebSocketCtor(uri,protocols,opts):protocols?new WebSocketCtor(uri,protocols):new WebSocketCtor(uri)}doWrite(_packet,data){this.ws.send(data)}},webtransport:class WT extends Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(err){return this.emitReserved("error",err)}this._transport.closed.then(()=>{this.onClose()}).catch(err=>{this.onError("webtransport error",err)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(stream=>{const decoderStream=function createPacketDecoderStream(maxPayload,binaryType){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const chunks=[];let state=0,expectedLength=-1,isBinary=!1;return new TransformStream({transform(chunk,controller){for(chunks.push(chunk);;){if(0===state){if(totalLength(chunks)<1)break;const header=concatChunks(chunks,1);isBinary=!(128&~header[0]),expectedLength=127&header[0],state=expectedLength<126?3:126===expectedLength?1:2}else if(1===state){if(totalLength(chunks)<2)break;const headerArray=concatChunks(chunks,2);expectedLength=new DataView(headerArray.buffer,headerArray.byteOffset,headerArray.length).getUint16(0),state=3}else if(2===state){if(totalLength(chunks)<8)break;const headerArray=concatChunks(chunks,8),view=new DataView(headerArray.buffer,headerArray.byteOffset,headerArray.length),n=view.getUint32(0);if(n>Math.pow(2,21)-1){controller.enqueue(ERROR_PACKET);break}expectedLength=n*Math.pow(2,32)+view.getUint32(4),state=3}else{if(totalLength(chunks)<expectedLength)break;const data=concatChunks(chunks,expectedLength);controller.enqueue(decodePacket(isBinary?data:TEXT_DECODER.decode(data),binaryType)),state=0}if(0===expectedLength||expectedLength>maxPayload){controller.enqueue(ERROR_PACKET);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),reader=stream.readable.pipeThrough(decoderStream).getReader(),encoderStream=createPacketEncoderStream();encoderStream.readable.pipeTo(stream.writable),this._writer=encoderStream.writable.getWriter();const read=()=>{reader.read().then(({done,value})=>{done||(this.onPacket(value),read())}).catch(err=>{})};read();const packet={type:"open"};this.query.sid&&(packet.data=`{"sid":"${this.query.sid}"}`),this._writer.write(packet).then(()=>this.onOpen())})})}write(packets){this.writable=!1;for(let i=0;i<packets.length;i++){const packet=packets[i],lastPacket=i===packets.length-1;this._writer.write(packet).then(()=>{lastPacket&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var _a;null===(_a=this._transport)||void 0===_a||_a.close()}},polling:class XHR extends BaseXHR{constructor(opts){super(opts);const forceBase64=opts&&opts.forceBase64;this.supportsBinary=hasXHR2&&!forceBase64}request(opts={}){return Object.assign(opts,{xd:this.xd},this.opts),new Request(newRequest,this.uri(),opts)}}},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse(str){if(str.length>8e3)throw"URI too long";const src=str,b=str.indexOf("["),e=str.indexOf("]");-1!=b&&-1!=e&&(str=str.substring(0,b)+str.substring(b,e).replace(/:/g,";")+str.substring(e,str.length));let m=re.exec(str||""),uri={},i=14;for(;i--;)uri[parts[i]]=m[i]||"";return-1!=b&&-1!=e&&(uri.source=src,uri.host=uri.host.substring(1,uri.host.length-1).replace(/;/g,":"),uri.authority=uri.authority.replace("[","").replace("]","").replace(/;/g,":"),uri.ipv6uri=!0),uri.pathNames=function pathNames(obj,path){const regx=/\/{2,9}/g,names=path.replace(regx,"/").split("/");"/"!=path.slice(0,1)&&0!==path.length||names.splice(0,1);"/"==path.slice(-1)&&names.splice(names.length-1,1);return names}(0,uri.path),uri.queryKey=function queryKey(uri,query){const data={};return query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function($0,$1,$2){$1&&(data[$1]=$2)}),data}(0,uri.query),uri}const withEventListeners="function"==typeof addEventListener&&"function"==typeof removeEventListener,OFFLINE_EVENT_LISTENERS=[];withEventListeners&&addEventListener("offline",()=>{OFFLINE_EVENT_LISTENERS.forEach(listener=>listener())},!1);class SocketWithoutUpgrade extends Emitter{constructor(uri,opts){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,uri&&"object"==typeof uri&&(opts=uri,uri=null),uri){const parsedUri=parse(uri);opts.hostname=parsedUri.host,opts.secure="https"===parsedUri.protocol||"wss"===parsedUri.protocol,opts.port=parsedUri.port,parsedUri.query&&(opts.query=parsedUri.query)}else opts.host&&(opts.hostname=parse(opts.host).host);installTimerFunctions(this,opts),this.secure=null!=opts.secure?opts.secure:"undefined"!=typeof location&&"https:"===location.protocol,opts.hostname&&!opts.port&&(opts.port=this.secure?"443":"80"),this.hostname=opts.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=opts.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},opts.transports.forEach(t=>{const transportName=t.prototype.name;this.transports.push(transportName),this._transportsByName[transportName]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},opts),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function parseqs_decode(qs){let qry={},pairs=qs.split("&");for(let i=0,l=pairs.length;i<l;i++){let pair=pairs[i].split("=");qry[decodeURIComponent(pair[0])]=decodeURIComponent(pair[1])}return qry}(this.opts.query)),withEventListeners&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},OFFLINE_EVENT_LISTENERS.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(name){const query=Object.assign({},this.opts.query);query.EIO=4,query.transport=name,this.id&&(query.sid=this.id);const opts=Object.assign({},this.opts,{query,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[name]);return new this._transportsByName[name](opts)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const transportName=this.opts.rememberUpgrade&&SocketWithoutUpgrade.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const transport=this.createTransport(transportName);transport.open(),this.setTransport(transport)}setTransport(transport){this.transport&&this.transport.removeAllListeners(),this.transport=transport,transport.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",reason=>this._onClose("transport close",reason))}onOpen(){this.readyState="open",SocketWithoutUpgrade.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(packet){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",packet),this.emitReserved("heartbeat"),packet.type){case"open":this.onHandshake(JSON.parse(packet.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const err=new Error("server error");err.code=packet.data,this._onError(err);break;case"message":this.emitReserved("data",packet.data),this.emitReserved("message",packet.data)}}onHandshake(data){this.emitReserved("handshake",data),this.id=data.sid,this.transport.query.sid=data.sid,this._pingInterval=data.pingInterval,this._pingTimeout=data.pingTimeout,this._maxPayload=data.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const delay=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+delay,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},delay),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const packets=this._getWritablePackets();this.transport.send(packets),this._prevBufferLen=packets.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let payloadSize=1;for(let i=0;i<this.writeBuffer.length;i++){const data=this.writeBuffer[i].data;if(data&&(payloadSize+=byteLength(data)),i>0&&payloadSize>this._maxPayload)return this.writeBuffer.slice(0,i);payloadSize+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const hasExpired=Date.now()>this._pingTimeoutTime;return hasExpired&&(this._pingTimeoutTime=0,nextTick(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),hasExpired}write(msg,options,fn){return this._sendPacket("message",msg,options,fn),this}send(msg,options,fn){return this._sendPacket("message",msg,options,fn),this}_sendPacket(type,data,options,fn){if("function"==typeof data&&(fn=data,data=void 0),"function"==typeof options&&(fn=options,options=null),"closing"===this.readyState||"closed"===this.readyState)return;(options=options||{}).compress=!1!==options.compress;const packet={type,data,options};this.emitReserved("packetCreate",packet),this.writeBuffer.push(packet),fn&&this.once("flush",fn),this.flush()}close(){const close=()=>{this._onClose("forced close"),this.transport.close()},cleanupAndClose=()=>{this.off("upgrade",cleanupAndClose),this.off("upgradeError",cleanupAndClose),close()},waitForUpgrade=()=>{this.once("upgrade",cleanupAndClose),this.once("upgradeError",cleanupAndClose)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?waitForUpgrade():close()}):this.upgrading?waitForUpgrade():close()),this}_onError(err){if(SocketWithoutUpgrade.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",err),this._onClose("transport error",err)}_onClose(reason,description){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),withEventListeners&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=OFFLINE_EVENT_LISTENERS.indexOf(this._offlineEventListener);-1!==i&&OFFLINE_EVENT_LISTENERS.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",reason,description),this.writeBuffer=[],this._prevBufferLen=0}}}SocketWithoutUpgrade.protocol=4;class SocketWithUpgrade extends SocketWithoutUpgrade{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let i=0;i<this._upgrades.length;i++)this._probe(this._upgrades[i])}_probe(name){let transport=this.createTransport(name),failed=!1;SocketWithoutUpgrade.priorWebsocketSuccess=!1;const onTransportOpen=()=>{failed||(transport.send([{type:"ping",data:"probe"}]),transport.once("packet",msg=>{if(!failed)if("pong"===msg.type&&"probe"===msg.data){if(this.upgrading=!0,this.emitReserved("upgrading",transport),!transport)return;SocketWithoutUpgrade.priorWebsocketSuccess="websocket"===transport.name,this.transport.pause(()=>{failed||"closed"!==this.readyState&&(cleanup(),this.setTransport(transport),transport.send([{type:"upgrade"}]),this.emitReserved("upgrade",transport),transport=null,this.upgrading=!1,this.flush())})}else{const err=new Error("probe error");err.transport=transport.name,this.emitReserved("upgradeError",err)}}))};function freezeTransport(){failed||(failed=!0,cleanup(),transport.close(),transport=null)}const onerror=err=>{const error=new Error("probe error: "+err);error.transport=transport.name,freezeTransport(),this.emitReserved("upgradeError",error)};function onTransportClose(){onerror("transport closed")}function onclose(){onerror("socket closed")}function onupgrade(to){transport&&to.name!==transport.name&&freezeTransport()}const cleanup=()=>{transport.removeListener("open",onTransportOpen),transport.removeListener("error",onerror),transport.removeListener("close",onTransportClose),this.off("close",onclose),this.off("upgrading",onupgrade)};transport.once("open",onTransportOpen),transport.once("error",onerror),transport.once("close",onTransportClose),this.once("close",onclose),this.once("upgrading",onupgrade),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==name?this.setTimeoutFn(()=>{failed||transport.open()},200):transport.open()}onHandshake(data){this._upgrades=this._filterUpgrades(data.upgrades),super.onHandshake(data)}_filterUpgrades(upgrades){const filteredUpgrades=[];for(let i=0;i<upgrades.length;i++)~this.transports.indexOf(upgrades[i])&&filteredUpgrades.push(upgrades[i]);return filteredUpgrades}}class Socket extends SocketWithUpgrade{constructor(uri,opts={}){const o="object"==typeof uri?uri:opts;(!o.transports||o.transports&&"string"==typeof o.transports[0])&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(transportName=>transports[transportName]).filter(t=>!!t)),super(uri,o)}}const is_binary_withNativeArrayBuffer="function"==typeof ArrayBuffer,is_binary_toString=Object.prototype.toString,is_binary_withNativeBlob="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===is_binary_toString.call(Blob),withNativeFile="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===is_binary_toString.call(File);function isBinary(obj){return is_binary_withNativeArrayBuffer&&(obj instanceof ArrayBuffer||(obj=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(obj):obj.buffer instanceof ArrayBuffer)(obj))||is_binary_withNativeBlob&&obj instanceof Blob||withNativeFile&&obj instanceof File}function hasBinary(obj,toJSON){if(!obj||"object"!=typeof obj)return!1;if(Array.isArray(obj)){for(let i=0,l=obj.length;i<l;i++)if(hasBinary(obj[i]))return!0;return!1}if(isBinary(obj))return!0;if(obj.toJSON&&"function"==typeof obj.toJSON&&1===arguments.length)return hasBinary(obj.toJSON(),!0);for(const key in obj)if(Object.prototype.hasOwnProperty.call(obj,key)&&hasBinary(obj[key]))return!0;return!1}function deconstructPacket(packet){const buffers=[],packetData=packet.data,pack=packet;return pack.data=_deconstructPacket(packetData,buffers),pack.attachments=buffers.length,{packet:pack,buffers}}function _deconstructPacket(data,buffers){if(!data)return data;if(isBinary(data)){const placeholder={_placeholder:!0,num:buffers.length};return buffers.push(data),placeholder}if(Array.isArray(data)){const newData=new Array(data.length);for(let i=0;i<data.length;i++)newData[i]=_deconstructPacket(data[i],buffers);return newData}if("object"==typeof data&&!(data instanceof Date)){const newData={};for(const key in data)Object.prototype.hasOwnProperty.call(data,key)&&(newData[key]=_deconstructPacket(data[key],buffers));return newData}return data}function reconstructPacket(packet,buffers){return packet.data=_reconstructPacket(packet.data,buffers),delete packet.attachments,packet}function _reconstructPacket(data,buffers){if(!data)return data;if(data&&!0===data._placeholder){if("number"==typeof data.num&&data.num>=0&&data.num<buffers.length)return buffers[data.num];throw new Error("illegal attachments")}if(Array.isArray(data))for(let i=0;i<data.length;i++)data[i]=_reconstructPacket(data[i],buffers);else if("object"==typeof data)for(const key in data)Object.prototype.hasOwnProperty.call(data,key)&&(data[key]=_reconstructPacket(data[key],buffers));return data}const RESERVED_EVENTS=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],build_esm_protocol=5;var PacketType;!function(PacketType){PacketType[PacketType.CONNECT=0]="CONNECT",PacketType[PacketType.DISCONNECT=1]="DISCONNECT",PacketType[PacketType.EVENT=2]="EVENT",PacketType[PacketType.ACK=3]="ACK",PacketType[PacketType.CONNECT_ERROR=4]="CONNECT_ERROR",PacketType[PacketType.BINARY_EVENT=5]="BINARY_EVENT",PacketType[PacketType.BINARY_ACK=6]="BINARY_ACK"}(PacketType||(PacketType={}));class Encoder{constructor(replacer){this.replacer=replacer}encode(obj){return obj.type!==PacketType.EVENT&&obj.type!==PacketType.ACK||!hasBinary(obj)?[this.encodeAsString(obj)]:this.encodeAsBinary({type:obj.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:obj.nsp,data:obj.data,id:obj.id})}encodeAsString(obj){let str=""+obj.type;return obj.type!==PacketType.BINARY_EVENT&&obj.type!==PacketType.BINARY_ACK||(str+=obj.attachments+"-"),obj.nsp&&"/"!==obj.nsp&&(str+=obj.nsp+","),null!=obj.id&&(str+=obj.id),null!=obj.data&&(str+=JSON.stringify(obj.data,this.replacer)),str}encodeAsBinary(obj){const deconstruction=deconstructPacket(obj),pack=this.encodeAsString(deconstruction.packet),buffers=deconstruction.buffers;return buffers.unshift(pack),buffers}}function isObject(value){return"[object Object]"===Object.prototype.toString.call(value)}class Decoder extends Emitter{constructor(reviver){super(),this.reviver=reviver}add(obj){let packet;if("string"==typeof obj){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");packet=this.decodeString(obj);const isBinaryEvent=packet.type===PacketType.BINARY_EVENT;isBinaryEvent||packet.type===PacketType.BINARY_ACK?(packet.type=isBinaryEvent?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(packet),0===packet.attachments&&super.emitReserved("decoded",packet)):super.emitReserved("decoded",packet)}else{if(!isBinary(obj)&&!obj.base64)throw new Error("Unknown type: "+obj);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");packet=this.reconstructor.takeBinaryData(obj),packet&&(this.reconstructor=null,super.emitReserved("decoded",packet))}}decodeString(str){let i=0;const p={type:Number(str.charAt(0))};if(void 0===PacketType[p.type])throw new Error("unknown packet type "+p.type);if(p.type===PacketType.BINARY_EVENT||p.type===PacketType.BINARY_ACK){const start=i+1;for(;"-"!==str.charAt(++i)&&i!=str.length;);const buf=str.substring(start,i);if(buf!=Number(buf)||"-"!==str.charAt(i))throw new Error("Illegal attachments");p.attachments=Number(buf)}if("/"===str.charAt(i+1)){const start=i+1;for(;++i;){if(","===str.charAt(i))break;if(i===str.length)break}p.nsp=str.substring(start,i)}else p.nsp="/";const next=str.charAt(i+1);if(""!==next&&Number(next)==next){const start=i+1;for(;++i;){const c=str.charAt(i);if(null==c||Number(c)!=c){--i;break}if(i===str.length)break}p.id=Number(str.substring(start,i+1))}if(str.charAt(++i)){const payload=this.tryParse(str.substr(i));if(!Decoder.isPayloadValid(p.type,payload))throw new Error("invalid payload");p.data=payload}return p}tryParse(str){try{return JSON.parse(str,this.reviver)}catch(e){return!1}}static isPayloadValid(type,payload){switch(type){case PacketType.CONNECT:return isObject(payload);case PacketType.DISCONNECT:return void 0===payload;case PacketType.CONNECT_ERROR:return"string"==typeof payload||isObject(payload);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(payload)&&("number"==typeof payload[0]||"string"==typeof payload[0]&&-1===RESERVED_EVENTS.indexOf(payload[0]));case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(payload)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(packet){this.packet=packet,this.buffers=[],this.reconPack=packet}takeBinaryData(binData){if(this.buffers.push(binData),this.buffers.length===this.reconPack.attachments){const packet=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),packet}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function on(obj,ev,fn){return obj.on(ev,fn),function subDestroy(){obj.off(ev,fn)}}const socket_RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class socket_Socket extends Emitter{constructor(io,nsp,opts){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=io,this.nsp=nsp,opts&&opts.auth&&(this.auth=opts.auth),this._opts=Object.assign({},opts),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const io=this.io;this.subs=[on(io,"open",this.onopen.bind(this)),on(io,"packet",this.onpacket.bind(this)),on(io,"error",this.onerror.bind(this)),on(io,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...args){return args.unshift("message"),this.emit.apply(this,args),this}emit(ev,...args){var _a,_b,_c;if(socket_RESERVED_EVENTS.hasOwnProperty(ev))throw new Error('"'+ev.toString()+'" is a reserved event name');if(args.unshift(ev),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(args),this;const packet={type:PacketType.EVENT,data:args,options:{}};if(packet.options.compress=!1!==this.flags.compress,"function"==typeof args[args.length-1]){const id=this.ids++,ack=args.pop();this._registerAckCallback(id,ack),packet.id=id}const isTransportWritable=null===(_b=null===(_a=this.io.engine)||void 0===_a?void 0:_a.transport)||void 0===_b?void 0:_b.writable,isConnected=this.connected&&!(null===(_c=this.io.engine)||void 0===_c?void 0:_c._hasPingExpired());return this.flags.volatile&&!isTransportWritable||(isConnected?(this.notifyOutgoingListeners(packet),this.packet(packet)):this.sendBuffer.push(packet)),this.flags={},this}_registerAckCallback(id,ack){var _a;const timeout=null!==(_a=this.flags.timeout)&&void 0!==_a?_a:this._opts.ackTimeout;if(void 0===timeout)return void(this.acks[id]=ack);const timer=this.io.setTimeoutFn(()=>{delete this.acks[id];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===id&&this.sendBuffer.splice(i,1);ack.call(this,new Error("operation has timed out"))},timeout),fn=(...args)=>{this.io.clearTimeoutFn(timer),ack.apply(this,args)};fn.withError=!0,this.acks[id]=fn}emitWithAck(ev,...args){return new Promise((resolve,reject)=>{const fn=(arg1,arg2)=>arg1?reject(arg1):resolve(arg2);fn.withError=!0,args.push(fn),this.emit(ev,...args)})}_addToQueue(args){let ack;"function"==typeof args[args.length-1]&&(ack=args.pop());const packet={id:this._queueSeq++,tryCount:0,pending:!1,args,flags:Object.assign({fromQueue:!0},this.flags)};args.push((err,...responseArgs)=>{if(packet!==this._queue[0])return;return null!==err?packet.tryCount>this._opts.retries&&(this._queue.shift(),ack&&ack(err)):(this._queue.shift(),ack&&ack(null,...responseArgs)),packet.pending=!1,this._drainQueue()}),this._queue.push(packet),this._drainQueue()}_drainQueue(force=!1){if(!this.connected||0===this._queue.length)return;const packet=this._queue[0];packet.pending&&!force||(packet.pending=!0,packet.tryCount++,this.flags=packet.flags,this.emit.apply(this,packet.args))}packet(packet){packet.nsp=this.nsp,this.io._packet(packet)}onopen(){"function"==typeof this.auth?this.auth(data=>{this._sendConnectPacket(data)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(data){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},data):data})}onerror(err){this.connected||this.emitReserved("connect_error",err)}onclose(reason,description){this.connected=!1,delete this.id,this.emitReserved("disconnect",reason,description),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(id=>{if(!this.sendBuffer.some(packet=>String(packet.id)===id)){const ack=this.acks[id];delete this.acks[id],ack.withError&&ack.call(this,new Error("socket has been disconnected"))}})}onpacket(packet){if(packet.nsp===this.nsp)switch(packet.type){case PacketType.CONNECT:packet.data&&packet.data.sid?this.onconnect(packet.data.sid,packet.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(packet);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(packet);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const err=new Error(packet.data.message);err.data=packet.data.data,this.emitReserved("connect_error",err)}}onevent(packet){const args=packet.data||[];null!=packet.id&&args.push(this.ack(packet.id)),this.connected?this.emitEvent(args):this.receiveBuffer.push(Object.freeze(args))}emitEvent(args){if(this._anyListeners&&this._anyListeners.length){const listeners=this._anyListeners.slice();for(const listener of listeners)listener.apply(this,args)}super.emit.apply(this,args),this._pid&&args.length&&"string"==typeof args[args.length-1]&&(this._lastOffset=args[args.length-1])}ack(id){const self=this;let sent=!1;return function(...args){sent||(sent=!0,self.packet({type:PacketType.ACK,id,data:args}))}}onack(packet){const ack=this.acks[packet.id];"function"==typeof ack&&(delete this.acks[packet.id],ack.withError&&packet.data.unshift(null),ack.apply(this,packet.data))}onconnect(id,pid){this.id=id,this.recovered=pid&&this._pid===pid,this._pid=pid,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(args=>this.emitEvent(args)),this.receiveBuffer=[],this.sendBuffer.forEach(packet=>{this.notifyOutgoingListeners(packet),this.packet(packet)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(subDestroy=>subDestroy()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(compress){return this.flags.compress=compress,this}get volatile(){return this.flags.volatile=!0,this}timeout(timeout){return this.flags.timeout=timeout,this}onAny(listener){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(listener),this}prependAny(listener){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(listener),this}offAny(listener){if(!this._anyListeners)return this;if(listener){const listeners=this._anyListeners;for(let i=0;i<listeners.length;i++)if(listener===listeners[i])return listeners.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(listener){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(listener),this}prependAnyOutgoing(listener){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(listener),this}offAnyOutgoing(listener){if(!this._anyOutgoingListeners)return this;if(listener){const listeners=this._anyOutgoingListeners;for(let i=0;i<listeners.length;i++)if(listener===listeners[i])return listeners.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(packet){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const listeners=this._anyOutgoingListeners.slice();for(const listener of listeners)listener.apply(this,packet.data)}}}function Backoff(opts){opts=opts||{},this.ms=opts.min||100,this.max=opts.max||1e4,this.factor=opts.factor||2,this.jitter=opts.jitter>0&&opts.jitter<=1?opts.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var ms=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var rand=Math.random(),deviation=Math.floor(rand*this.jitter*ms);ms=1&Math.floor(10*rand)?ms+deviation:ms-deviation}return 0|Math.min(ms,this.max)},Backoff.prototype.reset=function(){this.attempts=0},Backoff.prototype.setMin=function(min){this.ms=min},Backoff.prototype.setMax=function(max){this.max=max},Backoff.prototype.setJitter=function(jitter){this.jitter=jitter};class Manager extends Emitter{constructor(uri,opts){var _a;super(),this.nsps={},this.subs=[],uri&&"object"==typeof uri&&(opts=uri,uri=void 0),(opts=opts||{}).path=opts.path||"/socket.io",this.opts=opts,installTimerFunctions(this,opts),this.reconnection(!1!==opts.reconnection),this.reconnectionAttempts(opts.reconnectionAttempts||1/0),this.reconnectionDelay(opts.reconnectionDelay||1e3),this.reconnectionDelayMax(opts.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(_a=opts.randomizationFactor)&&void 0!==_a?_a:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==opts.timeout?2e4:opts.timeout),this._readyState="closed",this.uri=uri;const _parser=opts.parser||socket_io_parser_build_esm_namespaceObject;this.encoder=new _parser.Encoder,this.decoder=new _parser.Decoder,this._autoConnect=!1!==opts.autoConnect,this._autoConnect&&this.open()}reconnection(v){return arguments.length?(this._reconnection=!!v,v||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(v){return void 0===v?this._reconnectionAttempts:(this._reconnectionAttempts=v,this)}reconnectionDelay(v){var _a;return void 0===v?this._reconnectionDelay:(this._reconnectionDelay=v,null===(_a=this.backoff)||void 0===_a||_a.setMin(v),this)}randomizationFactor(v){var _a;return void 0===v?this._randomizationFactor:(this._randomizationFactor=v,null===(_a=this.backoff)||void 0===_a||_a.setJitter(v),this)}reconnectionDelayMax(v){var _a;return void 0===v?this._reconnectionDelayMax:(this._reconnectionDelayMax=v,null===(_a=this.backoff)||void 0===_a||_a.setMax(v),this)}timeout(v){return arguments.length?(this._timeout=v,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(fn){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket(this.uri,this.opts);const socket=this.engine,self=this;this._readyState="opening",this.skipReconnect=!1;const openSubDestroy=on(socket,"open",function(){self.onopen(),fn&&fn()}),onError=err=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",err),fn?fn(err):this.maybeReconnectOnOpen()},errorSub=on(socket,"error",onError);if(!1!==this._timeout){const timeout=this._timeout,timer=this.setTimeoutFn(()=>{openSubDestroy(),onError(new Error("timeout")),socket.close()},timeout);this.opts.autoUnref&&timer.unref(),this.subs.push(()=>{this.clearTimeoutFn(timer)})}return this.subs.push(openSubDestroy),this.subs.push(errorSub),this}connect(fn){return this.open(fn)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const socket=this.engine;this.subs.push(on(socket,"ping",this.onping.bind(this)),on(socket,"data",this.ondata.bind(this)),on(socket,"error",this.onerror.bind(this)),on(socket,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(data){try{this.decoder.add(data)}catch(e){this.onclose("parse error",e)}}ondecoded(packet){nextTick(()=>{this.emitReserved("packet",packet)},this.setTimeoutFn)}onerror(err){this.emitReserved("error",err)}socket(nsp,opts){let socket=this.nsps[nsp];return socket?this._autoConnect&&!socket.active&&socket.connect():(socket=new socket_Socket(this,nsp,opts),this.nsps[nsp]=socket),socket}_destroy(socket){const nsps=Object.keys(this.nsps);for(const nsp of nsps){if(this.nsps[nsp].active)return}this._close()}_packet(packet){const encodedPackets=this.encoder.encode(packet);for(let i=0;i<encodedPackets.length;i++)this.engine.write(encodedPackets[i],packet.options)}cleanup(){this.subs.forEach(subDestroy=>subDestroy()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(reason,description){var _a;this.cleanup(),null===(_a=this.engine)||void 0===_a||_a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",reason,description),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const self=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const delay=this.backoff.duration();this._reconnecting=!0;const timer=this.setTimeoutFn(()=>{self.skipReconnect||(this.emitReserved("reconnect_attempt",self.backoff.attempts),self.skipReconnect||self.open(err=>{err?(self._reconnecting=!1,self.reconnect(),this.emitReserved("reconnect_error",err)):self.onreconnect()}))},delay);this.opts.autoUnref&&timer.unref(),this.subs.push(()=>{this.clearTimeoutFn(timer)})}}onreconnect(){const attempt=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",attempt)}}const cache={};function esm_lookup(uri,opts){"object"==typeof uri&&(opts=uri,uri=void 0);const parsed=function url(uri,path="",loc){let obj=uri;loc=loc||"undefined"!=typeof location&&location,null==uri&&(uri=loc.protocol+"//"+loc.host),"string"==typeof uri&&("/"===uri.charAt(0)&&(uri="/"===uri.charAt(1)?loc.protocol+uri:loc.host+uri),/^(https?|wss?):\/\//.test(uri)||(uri=void 0!==loc?loc.protocol+"//"+uri:"https://"+uri),obj=parse(uri)),obj.port||(/^(http|ws)$/.test(obj.protocol)?obj.port="80":/^(http|ws)s$/.test(obj.protocol)&&(obj.port="443")),obj.path=obj.path||"/";const host=-1!==obj.host.indexOf(":")?"["+obj.host+"]":obj.host;return obj.id=obj.protocol+"://"+host+":"+obj.port+path,obj.href=obj.protocol+"://"+host+(loc&&loc.port===obj.port?"":":"+obj.port),obj}(uri,(opts=opts||{}).path||"/socket.io"),source=parsed.source,id=parsed.id,path=parsed.path,sameNamespace=cache[id]&&path in cache[id].nsps;let io;return opts.forceNew||opts["force new connection"]||!1===opts.multiplex||sameNamespace?io=new Manager(source,opts):(cache[id]||(cache[id]=new Manager(source,opts)),io=cache[id]),parsed.query&&!opts.query&&(opts.query=parsed.queryKey),io.socket(parsed.path,opts)}Object.assign(esm_lookup,{Manager,Socket:socket_Socket,io:esm_lookup,connect:esm_lookup})}}]);