Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

engine.io-client

Package Overview
Dependencies
Maintainers
2
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io-client - npm Package Compare versions

Comparing version 6.0.0 to 6.0.1

build/cjs/transports/xmlhttprequest.browser.js

2

build/cjs/package.json

@@ -5,3 +5,3 @@ {

"ws": false,
"xmlhttprequest-ssl": "./xmlhttprequest.js",
"./transports/xmlhttprequest.js": "./transports/xmlhttprequest.browser.js",
"./transports/websocket-constructor.js": "./transports/websocket-constructor.browser.js",

@@ -8,0 +8,0 @@ "./globalThis.js": "./globalThis.browser.js"

@@ -12,6 +12,6 @@ "use strict";

const debug_1 = __importDefault(require("debug")); // debug()
const component_emitter_1 = __importDefault(require("@socket.io/component-emitter"));
const component_emitter_1 = require("@socket.io/component-emitter");
const engine_io_parser_1 = require("engine.io-parser");
const debug = (0, debug_1.default)("engine.io-client:socket"); // debug()
class Socket extends component_emitter_1.default {
class Socket extends component_emitter_1.Emitter {
/**

@@ -153,3 +153,3 @@ * Socket constructor.

this.setTimeoutFn(() => {
this.emit("error", "No transports available");
this.emitReserved("error", "No transports available");
}, 0);

@@ -219,3 +219,3 @@ return;

this.upgrading = true;
this.emit("upgrading", transport);
this.emitReserved("upgrading", transport);
if (!transport)

@@ -234,3 +234,3 @@ return;

transport.send([{ type: "upgrade" }]);
this.emit("upgrade", transport);
this.emitReserved("upgrade", transport);
transport = null;

@@ -246,3 +246,3 @@ this.upgrading = false;

err.transport = transport.name;
this.emit("upgradeError", err);
this.emitReserved("upgradeError", err);
}

@@ -267,3 +267,3 @@ });

debug('probe transport "%s" failed because of error: %s', name, err);
this.emit("upgradeError", error);
this.emitReserved("upgradeError", error);
};

@@ -308,3 +308,3 @@ function onTransportClose() {

Socket.priorWebsocketSuccess = "websocket" === this.transport.name;
this.emit("open");
this.emitReserved("open");
this.flush();

@@ -334,5 +334,5 @@ // we check for `readyState` in case an `open`

debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
this.emit("packet", packet);
this.emitReserved("packet", packet);
// Socket is live - any packet counts
this.emit("heartbeat");
this.emitReserved("heartbeat");
switch (packet.type) {

@@ -345,4 +345,4 @@ case "open":

this.sendPacket("pong");
this.emit("ping");
this.emit("pong");
this.emitReserved("ping");
this.emitReserved("pong");
break;

@@ -356,4 +356,4 @@ case "error":

case "message":
this.emit("data", packet.data);
this.emit("message", packet.data);
this.emitReserved("data", packet.data);
this.emitReserved("message", packet.data);
break;

@@ -373,3 +373,3 @@ }

onHandshake(data) {
this.emit("handshake", data);
this.emitReserved("handshake", data);
this.id = data.sid;

@@ -412,3 +412,3 @@ this.transport.query.sid = data.sid;

if (0 === this.writeBuffer.length) {
this.emit("drain");
this.emitReserved("drain");
}

@@ -434,3 +434,3 @@ else {

this.prevBufferLen = this.writeBuffer.length;
this.emit("flush");
this.emitReserved("flush");
}

@@ -483,3 +483,3 @@ }

};
this.emit("packetCreate", packet);
this.emitReserved("packetCreate", packet);
this.writeBuffer.push(packet);

@@ -540,3 +540,3 @@ if (fn)

Socket.priorWebsocketSuccess = false;
this.emit("error", err);
this.emitReserved("error", err);
this.onClose("transport error", err);

@@ -570,3 +570,3 @@ }

// emit close event
this.emit("close", reason, desc);
this.emitReserved("close", reason, desc);
// clean buffers after, so users can still

@@ -573,0 +573,0 @@ // grab the buffers on `close` event

@@ -8,7 +8,7 @@ "use strict";

const engine_io_parser_1 = require("engine.io-parser");
const component_emitter_1 = __importDefault(require("@socket.io/component-emitter"));
const component_emitter_1 = require("@socket.io/component-emitter");
const util_js_1 = require("./util.js");
const debug_1 = __importDefault(require("debug")); // debug()
const debug = (0, debug_1.default)("engine.io-client:transport"); // debug()
class Transport extends component_emitter_1.default {
class Transport extends component_emitter_1.Emitter {
/**

@@ -15,0 +15,0 @@ * Transport abstract constructor.

"use strict";
/* global attachEvent */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -27,10 +8,9 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

exports.Request = exports.XHR = void 0;
const XMLHttpRequestModule = __importStar(require("xmlhttprequest-ssl"));
const xmlhttprequest_js_1 = __importDefault(require("./xmlhttprequest.js"));
const debug_1 = __importDefault(require("debug")); // debug()
const globalThis_js_1 = __importDefault(require("../globalThis.js"));
const util_js_1 = require("../util.js");
const component_emitter_1 = __importDefault(require("@socket.io/component-emitter"));
const component_emitter_1 = require("@socket.io/component-emitter");
const polling_js_1 = require("./polling.js");
const debug = (0, debug_1.default)("engine.io-client:polling-xhr"); // debug()
const XMLHttpRequest = XMLHttpRequestModule.default || XMLHttpRequestModule;
/**

@@ -41,3 +21,3 @@ * Empty function

const hasXHR2 = (function () {
const xhr = new XMLHttpRequest({
const xhr = new xmlhttprequest_js_1.default({
xdomain: false

@@ -118,3 +98,3 @@ });

exports.XHR = XHR;
class Request extends component_emitter_1.default {
class Request extends component_emitter_1.Emitter {
/**

@@ -145,3 +125,3 @@ * Request constructor

opts.xscheme = !!this.opts.xs;
const xhr = (this.xhr = new XMLHttpRequest(opts));
const xhr = (this.xhr = new xmlhttprequest_js_1.default(opts));
try {

@@ -148,0 +128,0 @@ debug("xhr open %s: %s", this.method, this.uri);

@@ -5,3 +5,3 @@ {

"ws": false,
"xmlhttprequest-ssl": "./xmlhttprequest.js",
"./transports/xmlhttprequest.js": "./transports/xmlhttprequest.browser.js",
"./transports/websocket-constructor.js": "./transports/websocket-constructor.browser.js",

@@ -8,0 +8,0 @@ "./globalThis.js": "./globalThis.browser.js"

@@ -1,2 +0,2 @@

import Emitter from "@socket.io/component-emitter";
import { Emitter } from "@socket.io/component-emitter";
export interface SocketOptions {

@@ -183,3 +183,21 @@ /**

}
export declare class Socket extends Emitter {
interface SocketReservedEvents {
open: () => void;
handshake: (data: any) => void;
packet: (packet: any) => void;
packetCreate: (packet: any) => void;
data: (data: any) => void;
message: (data: any) => void;
drain: () => void;
flush: () => void;
heartbeat: () => void;
ping: () => void;
pong: () => void;
error: (err: string | Error) => void;
upgrading: (transport: any) => void;
upgrade: (transport: any) => void;
upgradeError: (err: Error) => void;
close: (reason: string, desc?: Error) => void;
}
export declare class Socket extends Emitter<{}, {}, SocketReservedEvents> {
id: string;

@@ -326,1 +344,2 @@ transport: any;

}
export {};

@@ -6,3 +6,3 @@ import { transports } from "./transports/index.js";

import debugModule from "debug"; // debug()
import Emitter from "@socket.io/component-emitter";
import { Emitter } from "@socket.io/component-emitter";
import { protocol } from "engine.io-parser";

@@ -147,3 +147,3 @@ const debug = debugModule("engine.io-client:socket"); // debug()

this.setTimeoutFn(() => {
this.emit("error", "No transports available");
this.emitReserved("error", "No transports available");
}, 0);

@@ -213,3 +213,3 @@ return;

this.upgrading = true;
this.emit("upgrading", transport);
this.emitReserved("upgrading", transport);
if (!transport)

@@ -228,3 +228,3 @@ return;

transport.send([{ type: "upgrade" }]);
this.emit("upgrade", transport);
this.emitReserved("upgrade", transport);
transport = null;

@@ -240,3 +240,3 @@ this.upgrading = false;

err.transport = transport.name;
this.emit("upgradeError", err);
this.emitReserved("upgradeError", err);
}

@@ -261,3 +261,3 @@ });

debug('probe transport "%s" failed because of error: %s', name, err);
this.emit("upgradeError", error);
this.emitReserved("upgradeError", error);
};

@@ -302,3 +302,3 @@ function onTransportClose() {

Socket.priorWebsocketSuccess = "websocket" === this.transport.name;
this.emit("open");
this.emitReserved("open");
this.flush();

@@ -328,5 +328,5 @@ // we check for `readyState` in case an `open`

debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
this.emit("packet", packet);
this.emitReserved("packet", packet);
// Socket is live - any packet counts
this.emit("heartbeat");
this.emitReserved("heartbeat");
switch (packet.type) {

@@ -339,4 +339,4 @@ case "open":

this.sendPacket("pong");
this.emit("ping");
this.emit("pong");
this.emitReserved("ping");
this.emitReserved("pong");
break;

@@ -350,4 +350,4 @@ case "error":

case "message":
this.emit("data", packet.data);
this.emit("message", packet.data);
this.emitReserved("data", packet.data);
this.emitReserved("message", packet.data);
break;

@@ -367,3 +367,3 @@ }

onHandshake(data) {
this.emit("handshake", data);
this.emitReserved("handshake", data);
this.id = data.sid;

@@ -406,3 +406,3 @@ this.transport.query.sid = data.sid;

if (0 === this.writeBuffer.length) {
this.emit("drain");
this.emitReserved("drain");
}

@@ -428,3 +428,3 @@ else {

this.prevBufferLen = this.writeBuffer.length;
this.emit("flush");
this.emitReserved("flush");
}

@@ -477,3 +477,3 @@ }

};
this.emit("packetCreate", packet);
this.emitReserved("packetCreate", packet);
this.writeBuffer.push(packet);

@@ -534,3 +534,3 @@ if (fn)

Socket.priorWebsocketSuccess = false;
this.emit("error", err);
this.emitReserved("error", err);
this.onClose("transport error", err);

@@ -564,3 +564,3 @@ }

// emit close event
this.emit("close", reason, desc);
this.emitReserved("close", reason, desc);
// clean buffers after, so users can still

@@ -567,0 +567,0 @@ // grab the buffers on `close` event

@@ -1,4 +0,4 @@

import Emitter from "@socket.io/component-emitter";
import { DefaultEventsMap, Emitter } from "@socket.io/component-emitter";
import { SocketOptions } from "./socket.js";
export declare abstract class Transport extends Emitter {
export declare abstract class Transport extends Emitter<DefaultEventsMap, DefaultEventsMap> {
protected opts: SocketOptions;

@@ -5,0 +5,0 @@ protected supportsBinary: boolean;

import { decodePacket } from "engine.io-parser";
import Emitter from "@socket.io/component-emitter";
import { Emitter } from "@socket.io/component-emitter";
import { installTimerFunctions } from "./util.js";

@@ -4,0 +4,0 @@ import debugModule from "debug"; // debug()

@@ -1,2 +0,2 @@

import Emitter from "@socket.io/component-emitter";
import { DefaultEventsMap, Emitter } from "@socket.io/component-emitter";
import { Polling } from "./polling.js";

@@ -36,3 +36,3 @@ export declare class XHR extends Polling {

}
export declare class Request extends Emitter {
export declare class Request extends Emitter<DefaultEventsMap, DefaultEventsMap> {
private readonly opts;

@@ -39,0 +39,0 @@ private readonly method;

/* global attachEvent */
import * as XMLHttpRequestModule from "xmlhttprequest-ssl";
import XMLHttpRequest from "./xmlhttprequest.js";
import debugModule from "debug"; // debug()
import globalThis from "../globalThis.js";
import { installTimerFunctions, pick } from "../util.js";
import Emitter from "@socket.io/component-emitter";
import { Emitter } from "@socket.io/component-emitter";
import { Polling } from "./polling.js";
const debug = debugModule("engine.io-client:polling-xhr"); // debug()
const XMLHttpRequest = XMLHttpRequestModule.default || XMLHttpRequestModule;
/**

@@ -11,0 +10,0 @@ * Empty function

@@ -22,3 +22,3 @@ import { Transport } from "../transport.js";

*/
doOpen(): import("@socket.io/component-emitter").default<string>;
doOpen(): this;
/**

@@ -25,0 +25,0 @@ * Adds event listeners to the socket

@@ -5,3 +5,3 @@ {

"ws": false,
"xmlhttprequest-ssl": "./xmlhttprequest.js",
"./transports/xmlhttprequest.js": "./transports/xmlhttprequest.browser.js",
"./transports/websocket-constructor.js": "./transports/websocket-constructor.browser.js",

@@ -8,0 +8,0 @@ "./globalThis.js": "./globalThis.browser.js"

@@ -1,2 +0,2 @@

import Emitter from "@socket.io/component-emitter";
import { Emitter } from "@socket.io/component-emitter";
export interface SocketOptions {

@@ -183,3 +183,21 @@ /**

}
export declare class Socket extends Emitter {
interface SocketReservedEvents {
open: () => void;
handshake: (data: any) => void;
packet: (packet: any) => void;
packetCreate: (packet: any) => void;
data: (data: any) => void;
message: (data: any) => void;
drain: () => void;
flush: () => void;
heartbeat: () => void;
ping: () => void;
pong: () => void;
error: (err: string | Error) => void;
upgrading: (transport: any) => void;
upgrade: (transport: any) => void;
upgradeError: (err: Error) => void;
close: (reason: string, desc?: Error) => void;
}
export declare class Socket extends Emitter<{}, {}, SocketReservedEvents> {
id: string;

@@ -326,1 +344,2 @@ transport: any;

}
export {};

@@ -5,3 +5,3 @@ import { transports } from "./transports/index.js";

import parseuri from "parseuri";
import Emitter from "@socket.io/component-emitter";
import { Emitter } from "@socket.io/component-emitter";
import { protocol } from "engine.io-parser";

@@ -143,3 +143,3 @@ export class Socket extends Emitter {

this.setTimeoutFn(() => {
this.emit("error", "No transports available");
this.emitReserved("error", "No transports available");
}, 0);

@@ -203,3 +203,3 @@ return;

this.upgrading = true;
this.emit("upgrading", transport);
this.emitReserved("upgrading", transport);
if (!transport)

@@ -216,3 +216,3 @@ return;

transport.send([{ type: "upgrade" }]);
this.emit("upgrade", transport);
this.emitReserved("upgrade", transport);
transport = null;

@@ -227,3 +227,3 @@ this.upgrading = false;

err.transport = transport.name;
this.emit("upgradeError", err);
this.emitReserved("upgradeError", err);
}

@@ -247,3 +247,3 @@ });

freezeTransport();
this.emit("upgradeError", error);
this.emitReserved("upgradeError", error);
};

@@ -286,3 +286,3 @@ function onTransportClose() {

Socket.priorWebsocketSuccess = "websocket" === this.transport.name;
this.emit("open");
this.emitReserved("open");
this.flush();

@@ -310,5 +310,5 @@ // we check for `readyState` in case an `open`

"closing" === this.readyState) {
this.emit("packet", packet);
this.emitReserved("packet", packet);
// Socket is live - any packet counts
this.emit("heartbeat");
this.emitReserved("heartbeat");
switch (packet.type) {

@@ -321,4 +321,4 @@ case "open":

this.sendPacket("pong");
this.emit("ping");
this.emit("pong");
this.emitReserved("ping");
this.emitReserved("pong");
break;

@@ -332,4 +332,4 @@ case "error":

case "message":
this.emit("data", packet.data);
this.emit("message", packet.data);
this.emitReserved("data", packet.data);
this.emitReserved("message", packet.data);
break;

@@ -348,3 +348,3 @@ }

onHandshake(data) {
this.emit("handshake", data);
this.emitReserved("handshake", data);
this.id = data.sid;

@@ -387,3 +387,3 @@ this.transport.query.sid = data.sid;

if (0 === this.writeBuffer.length) {
this.emit("drain");
this.emitReserved("drain");
}

@@ -408,3 +408,3 @@ else {

this.prevBufferLen = this.writeBuffer.length;
this.emit("flush");
this.emitReserved("flush");
}

@@ -457,3 +457,3 @@ }

};
this.emit("packetCreate", packet);
this.emitReserved("packetCreate", packet);
this.writeBuffer.push(packet);

@@ -512,3 +512,3 @@ if (fn)

Socket.priorWebsocketSuccess = false;
this.emit("error", err);
this.emitReserved("error", err);
this.onClose("transport error", err);

@@ -541,3 +541,3 @@ }

// emit close event
this.emit("close", reason, desc);
this.emitReserved("close", reason, desc);
// clean buffers after, so users can still

@@ -544,0 +544,0 @@ // grab the buffers on `close` event

@@ -1,4 +0,4 @@

import Emitter from "@socket.io/component-emitter";
import { DefaultEventsMap, Emitter } from "@socket.io/component-emitter";
import { SocketOptions } from "./socket.js";
export declare abstract class Transport extends Emitter {
export declare abstract class Transport extends Emitter<DefaultEventsMap, DefaultEventsMap> {
protected opts: SocketOptions;

@@ -5,0 +5,0 @@ protected supportsBinary: boolean;

import { decodePacket } from "engine.io-parser";
import Emitter from "@socket.io/component-emitter";
import { Emitter } from "@socket.io/component-emitter";
import { installTimerFunctions } from "./util.js";

@@ -4,0 +4,0 @@ export class Transport extends Emitter {

@@ -1,2 +0,2 @@

import Emitter from "@socket.io/component-emitter";
import { DefaultEventsMap, Emitter } from "@socket.io/component-emitter";
import { Polling } from "./polling.js";

@@ -36,3 +36,3 @@ export declare class XHR extends Polling {

}
export declare class Request extends Emitter {
export declare class Request extends Emitter<DefaultEventsMap, DefaultEventsMap> {
private readonly opts;

@@ -39,0 +39,0 @@ private readonly method;

/* global attachEvent */
import * as XMLHttpRequestModule from "xmlhttprequest-ssl";
import XMLHttpRequest from "./xmlhttprequest.js";
import globalThis from "../globalThis.js";
import { installTimerFunctions, pick } from "../util.js";
import Emitter from "@socket.io/component-emitter";
import { Emitter } from "@socket.io/component-emitter";
import { Polling } from "./polling.js";
const XMLHttpRequest = XMLHttpRequestModule.default || XMLHttpRequestModule;
/**

@@ -9,0 +8,0 @@ * Empty function

@@ -22,3 +22,3 @@ import { Transport } from "../transport.js";

*/
doOpen(): import("@socket.io/component-emitter").default<string>;
doOpen(): this;
/**

@@ -25,0 +25,0 @@ * Adds event listeners to the socket

@@ -0,1 +1,9 @@

## [6.0.1](https://github.com/socketio/engine.io-client/compare/6.0.0...6.0.1) (2021-10-14)
### Bug Fixes
* fix usage with vite ([4971914](https://github.com/socketio/engine.io-client/commit/49719142f65e23efa65fca4f66765ded5d955972))
# [6.0.0](https://github.com/socketio/engine.io-client/compare/5.2.0...6.0.0) (2021-10-08)

@@ -2,0 +10,0 @@

/*!
* Engine.IO v6.0.0
* Engine.IO v6.0.1
* (c) 2014-2021 Guillermo Rauch
* Released under the MIT License.
*/
var t={exports:{}};try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}var e=t.exports,s="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function r(t){const r=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!r||e))return new XMLHttpRequest}catch(t){}if(!r)try{return new(s[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}var o=Object.freeze({__proto__:null,default:r});function i(t,...e){return e.reduce(((e,s)=>(t.hasOwnProperty(s)&&(e[s]=t[s]),e)),{})}const n=setTimeout,a=clearTimeout;function h(t,e){e.useNativeTimers?(t.setTimeoutFn=n.bind(s),t.clearTimeoutFn=a.bind(s)):(t.setTimeoutFn=setTimeout.bind(s),t.clearTimeoutFn=clearTimeout.bind(s))}var p={exports:{}};!function(t){function e(t){if(t)return function(t){for(var s in e.prototype)t[s]=e.prototype[s];return t}(t)}p.exports=e,e.default=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((s=r[o])===e||s.fn===e){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(s){r=0;for(var o=(s=s.slice(0)).length;r<o;++r)s[r].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}();var c=p.exports;const u=Object.create(null);u.open="0",u.close="1",u.ping="2",u.pong="3",u.message="4",u.upgrade="5",u.noop="6";const l=Object.create(null);Object.keys(u).forEach((t=>{l[u[t]]=t}));const d={type:"error",data:"parser error"},f="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),y="function"==typeof ArrayBuffer,m=({type:t,data:e},s,r)=>{return f&&e instanceof Blob?s?r(e):g(e,r):y&&(e instanceof ArrayBuffer||(o=e,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(o):o&&o.buffer instanceof ArrayBuffer))?s?r(e):g(new Blob([e]),r):r(u[t]+(e||""));var o},g=(t,e)=>{const s=new FileReader;return s.onload=function(){const t=s.result.split(",")[1];e("b"+t)},s.readAsDataURL(t)};for(var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w="undefined"==typeof Uint8Array?[]:new Uint8Array(256),v=0;v<b.length;v++)w[b.charCodeAt(v)]=v;const k="function"==typeof ArrayBuffer,x=(t,e)=>{if("string"!=typeof t)return{type:"message",data:S(t,e)};const s=t.charAt(0);if("b"===s)return{type:"message",data:T(t.substring(1),e)};return l[s]?t.length>1?{type:l[s],data:t.substring(1)}:{type:l[s]}:d},T=(t,e)=>{if(k){const s=function(t){var e,s,r,o,i,n=.75*t.length,a=t.length,h=0;"="===t[t.length-1]&&(n--,"="===t[t.length-2]&&n--);var p=new ArrayBuffer(n),c=new Uint8Array(p);for(e=0;e<a;e+=4)s=w[t.charCodeAt(e)],r=w[t.charCodeAt(e+1)],o=w[t.charCodeAt(e+2)],i=w[t.charCodeAt(e+3)],c[h++]=s<<2|r>>4,c[h++]=(15&r)<<4|o>>2,c[h++]=(3&o)<<6|63&i;return p}(t);return S(s,e)}return{base64:!0,data:t}},S=(t,e)=>"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t,E=String.fromCharCode(30);class C extends c{constructor(t){super(),this.writable=!1,h(this,t),this.opts=t,this.query=t.query,this.readyState="",this.socket=t.socket}onError(t,e){const s=new Error(t);return s.type="TransportError",s.description=e,super.emit("error",s),this}open(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emit("open")}onData(t){const e=x(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emit("packet",t)}onClose(){this.readyState="closed",super.emit("close")}}var q,B="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),L={},O=0,A=0;function P(t){var e="";do{e=B[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function _(){var t=P(+new Date);return t!==q?(O=0,q=t):t+"."+P(O++)}for(;A<64;A++)L[B[A]]=A;_.encode=P,_.decode=function(t){var e=0;for(A=0;A<t.length;A++)e=64*e+L[t.charAt(A)];return e};var U=_,H={encode:function(t){var e="";for(var s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e},decode:function(t){for(var e={},s=t.split("&"),r=0,o=s.length;r<o;r++){var i=s[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}};class j extends C{constructor(){super(...arguments),this.polling=!1}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let t=0;this.polling&&(t++,this.once("pollComplete",(function(){--t||e()}))),this.writable||(t++,this.once("drain",(function(){--t||e()})))}else e()}poll(){this.polling=!0,this.doPoll(),this.emit("poll")}onData(t){((t,e)=>{const s=t.split(E),r=[];for(let t=0;t<s.length;t++){const o=x(s[t],e);if(r.push(o),"error"===o.type)break}return r})(t,this.socket.binaryType).forEach((t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose(),!1;this.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const s=t.length,r=new Array(s);let o=0;t.forEach(((t,i)=>{m(t,!1,(t=>{r[i]=t,++o===s&&e(r.join(E))}))}))})(t,(t=>{this.doWrite(t,(()=>{this.writable=!0,this.emit("drain")}))}))}uri(){let t=this.query||{};const e=this.opts.secure?"https":"http";let s="";!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=U()),this.supportsBinary||t.sid||(t.b64=1),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(s=":"+this.opts.port);const r=H.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+s+this.opts.path+(r.length?"?"+r:"")}}const R=r||o;function D(){}const F=null!=new R({xdomain:!1}).responseType;class I extends c{constructor(t,e){super(),h(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.create()}create(){const t=i(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;const e=this.xhr=new R(t);try{e.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(let t in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(t)&&e.setRequestHeader(t,this.opts.extraHeaders[t])}}catch(t){}if("POST"===this.method)try{e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{e.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in e&&(e.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(e.timeout=this.opts.requestTimeout),e.onreadystatechange=()=>{4===e.readyState&&(200===e.status||1223===e.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof e.status?e.status:0)}),0))},e.send(this.data)}catch(t){return void this.setTimeoutFn((()=>{this.onError(t)}),0)}"undefined"!=typeof document&&(this.index=I.requestsCount++,I.requests[this.index]=this)}onSuccess(){this.emit("success"),this.cleanup()}onData(t){this.emit("data",t),this.onSuccess()}onError(t){this.emit("error",t),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=D,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete I.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;null!==t&&this.onData(t)}abort(){this.cleanup()}}if(I.requestsCount=0,I.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",M);else if("function"==typeof addEventListener){addEventListener("onpagehide"in s?"pagehide":"unload",M,!1)}function M(){for(let t in I.requests)I.requests.hasOwnProperty(t)&&I.requests[t].abort()}const W="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),N=s.WebSocket||s.MozWebSocket,X="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class $ extends C{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,s=X?{}:i(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=X?new N(t,e,s):e?new N(t,e):new N(t)}catch(t){return this.emit("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=this.onClose.bind(this),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const s=t[e],r=e===t.length-1;m(s,this.supportsBinary,(t=>{try{this.ws.send(t)}catch(t){}r&&W((()=>{this.writable=!0,this.emit("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let t=this.query||{};const e=this.opts.secure?"wss":"ws";let s="";this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(s=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=U()),this.supportsBinary||(t.b64=1);const r=H.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+s+this.opts.path+(r.length?"?"+r:"")}check(){return!(!N||"__initialize"in N&&this.name===$.prototype.name)}}const z={websocket:$,polling:class extends j{constructor(t){if(super(t),"undefined"!=typeof location){const e="https:"===location.protocol;let s=location.port;s||(s=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||s!==t.port,this.xs=t.secure!==e}const e=t&&t.forceBase64;this.supportsBinary=F&&!e}request(t={}){return Object.assign(t,{xd:this.xd,xs:this.xs},this.opts),new I(this.uri(),t)}doWrite(t,e){const s=this.request({method:"POST",data:t});s.on("success",e),s.on("error",(t=>{this.onError("xhr post error",t)}))}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(t=>{this.onError("xhr poll error",t)})),this.pollXhr=t}}};var V=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,G=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],J=function(t){var e=t,s=t.indexOf("["),r=t.indexOf("]");-1!=s&&-1!=r&&(t=t.substring(0,s)+t.substring(s,r).replace(/:/g,";")+t.substring(r,t.length));for(var o,i,n=V.exec(t||""),a={},h=14;h--;)a[G[h]]=n[h]||"";return-1!=s&&-1!=r&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(t,e){var s=/\/{2,9}/g,r=e.replace(s,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||r.splice(0,1);"/"==e.substr(e.length-1,1)&&r.splice(r.length-1,1);return r}(0,a.path),a.queryKey=(o=a.query,i={},o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,s){e&&(i[e]=s)})),i),a};class K extends c{constructor(t,e={}){super(),t&&"object"==typeof t&&(e=t,t=null),t?(t=J(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=J(e.host).host),h(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},e),this.opts.path=this.opts.path.replace(/\/$/,"")+"/","string"==typeof this.opts.query&&(this.opts.query=H.decode(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&addEventListener("beforeunload",(()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())}),!1),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close")},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=function(t){const e={};for(let s in t)t.hasOwnProperty(s)&&(e[s]=t[s]);return e}(this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const s=Object.assign({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new z[t](s)}open(){let t;if(this.opts.rememberUpgrade&&K.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emit("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(()=>{this.onClose("transport close")}))}probe(t){let e=this.createTransport(t),s=!1;K.priorWebsocketSuccess=!1;const r=()=>{s||(e.send([{type:"ping",data:"probe"}]),e.once("packet",(t=>{if(!s)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emit("upgrading",e),!e)return;K.priorWebsocketSuccess="websocket"===e.name,this.transport.pause((()=>{s||"closed"!==this.readyState&&(p(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emit("upgrade",e),e=null,this.upgrading=!1,this.flush())}))}else{const t=new Error("probe error");t.transport=e.name,this.emit("upgradeError",t)}})))};function o(){s||(s=!0,p(),e.close(),e=null)}const i=t=>{const s=new Error("probe error: "+t);s.transport=e.name,o(),this.emit("upgradeError",s)};function n(){i("transport closed")}function a(){i("socket closed")}function h(t){e&&t.name!==e.name&&o()}const p=()=>{e.removeListener("open",r),e.removeListener("error",i),e.removeListener("close",n),this.off("close",a),this.off("upgrading",h)};e.once("open",r),e.once("error",i),e.once("close",n),this.once("close",a),this.once("upgrading",h),e.open()}onOpen(){if(this.readyState="open",K.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emit("ping"),this.emit("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}}onHandshake(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()}flush(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))}write(t,e,s){return this.sendPacket("message",t,e,s),this}send(t,e,s){return this.sendPacket("message",t,e,s),this}sendPacket(t,e,s,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof s&&(r=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;const o={type:t,data:e,options:s};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},s=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?s():t()})):this.upgrading?s():t()),this}onError(t){K.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)}onClose(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emit("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let s=0;const r=t.length;for(;s<r;s++)~this.transports.indexOf(t[s])&&e.push(t[s]);return e}}K.protocol=4;const Q=K.protocol;export{K as Socket,C as Transport,h as installTimerFunctions,Q as protocol,z as transports};
var t={exports:{}};try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}var e=t.exports,s="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function r(t){const r=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!r||e))return new XMLHttpRequest}catch(t){}if(!r)try{return new(s[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function o(t,...e){return e.reduce(((e,s)=>(t.hasOwnProperty(s)&&(e[s]=t[s]),e)),{})}const i=setTimeout,n=clearTimeout;function a(t,e){e.useNativeTimers?(t.setTimeoutFn=i.bind(s),t.clearTimeoutFn=n.bind(s)):(t.setTimeoutFn=setTimeout.bind(s),t.clearTimeoutFn=clearTimeout.bind(s))}var h=p;function p(t){if(t)return function(t){for(var e in p.prototype)t[e]=p.prototype[e];return t}(t)}p.prototype.on=p.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},p.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this},p.prototype.off=p.prototype.removeListener=p.prototype.removeAllListeners=p.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((s=r[o])===e||s.fn===e){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},p.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(s){r=0;for(var o=(s=s.slice(0)).length;r<o;++r)s[r].apply(this,e)}return this},p.prototype.emitReserved=p.prototype.emit,p.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},p.prototype.hasListeners=function(t){return!!this.listeners(t).length};const c=Object.create(null);c.open="0",c.close="1",c.ping="2",c.pong="3",c.message="4",c.upgrade="5",c.noop="6";const u=Object.create(null);Object.keys(c).forEach((t=>{u[c[t]]=t}));const l={type:"error",data:"parser error"},d="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),f="function"==typeof ArrayBuffer,y=({type:t,data:e},s,r)=>{return d&&e instanceof Blob?s?r(e):m(e,r):f&&(e instanceof ArrayBuffer||(o=e,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(o):o&&o.buffer instanceof ArrayBuffer))?s?r(e):m(new Blob([e]),r):r(c[t]+(e||""));var o},m=(t,e)=>{const s=new FileReader;return s.onload=function(){const t=s.result.split(",")[1];e("b"+t)},s.readAsDataURL(t)};for(var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b="undefined"==typeof Uint8Array?[]:new Uint8Array(256),v=0;v<g.length;v++)b[g.charCodeAt(v)]=v;const w="function"==typeof ArrayBuffer,k=(t,e)=>{if("string"!=typeof t)return{type:"message",data:x(t,e)};const s=t.charAt(0);if("b"===s)return{type:"message",data:T(t.substring(1),e)};return u[s]?t.length>1?{type:u[s],data:t.substring(1)}:{type:u[s]}:l},T=(t,e)=>{if(w){const s=function(t){var e,s,r,o,i,n=.75*t.length,a=t.length,h=0;"="===t[t.length-1]&&(n--,"="===t[t.length-2]&&n--);var p=new ArrayBuffer(n),c=new Uint8Array(p);for(e=0;e<a;e+=4)s=b[t.charCodeAt(e)],r=b[t.charCodeAt(e+1)],o=b[t.charCodeAt(e+2)],i=b[t.charCodeAt(e+3)],c[h++]=s<<2|r>>4,c[h++]=(15&r)<<4|o>>2,c[h++]=(3&o)<<6|63&i;return p}(t);return x(s,e)}return{base64:!0,data:t}},x=(t,e)=>"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t,S=String.fromCharCode(30);class E extends h{constructor(t){super(),this.writable=!1,a(this,t),this.opts=t,this.query=t.query,this.readyState="",this.socket=t.socket}onError(t,e){const s=new Error(t);return s.type="TransportError",s.description=e,super.emit("error",s),this}open(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emit("open")}onData(t){const e=k(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emit("packet",t)}onClose(){this.readyState="closed",super.emit("close")}}var C,q="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),B={},L=0,O=0;function R(t){var e="";do{e=q[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function A(){var t=R(+new Date);return t!==C?(L=0,C=t):t+"."+R(L++)}for(;O<64;O++)B[q[O]]=O;A.encode=R,A.decode=function(t){var e=0;for(O=0;O<t.length;O++)e=64*e+B[t.charAt(O)];return e};var P=A,U={encode:function(t){var e="";for(var s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e},decode:function(t){for(var e={},s=t.split("&"),r=0,o=s.length;r<o;r++){var i=s[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}};class H extends E{constructor(){super(...arguments),this.polling=!1}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let t=0;this.polling&&(t++,this.once("pollComplete",(function(){--t||e()}))),this.writable||(t++,this.once("drain",(function(){--t||e()})))}else e()}poll(){this.polling=!0,this.doPoll(),this.emit("poll")}onData(t){((t,e)=>{const s=t.split(S),r=[];for(let t=0;t<s.length;t++){const o=k(s[t],e);if(r.push(o),"error"===o.type)break}return r})(t,this.socket.binaryType).forEach((t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose(),!1;this.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const s=t.length,r=new Array(s);let o=0;t.forEach(((t,i)=>{y(t,!1,(t=>{r[i]=t,++o===s&&e(r.join(S))}))}))})(t,(t=>{this.doWrite(t,(()=>{this.writable=!0,this.emit("drain")}))}))}uri(){let t=this.query||{};const e=this.opts.secure?"https":"http";let s="";!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=P()),this.supportsBinary||t.sid||(t.b64=1),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(s=":"+this.opts.port);const r=U.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+s+this.opts.path+(r.length?"?"+r:"")}}function _(){}const j=null!=new r({xdomain:!1}).responseType;class D extends h{constructor(t,e){super(),a(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.create()}create(){const t=o(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;const e=this.xhr=new r(t);try{e.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(let t in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(t)&&e.setRequestHeader(t,this.opts.extraHeaders[t])}}catch(t){}if("POST"===this.method)try{e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{e.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in e&&(e.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(e.timeout=this.opts.requestTimeout),e.onreadystatechange=()=>{4===e.readyState&&(200===e.status||1223===e.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof e.status?e.status:0)}),0))},e.send(this.data)}catch(t){return void this.setTimeoutFn((()=>{this.onError(t)}),0)}"undefined"!=typeof document&&(this.index=D.requestsCount++,D.requests[this.index]=this)}onSuccess(){this.emit("success"),this.cleanup()}onData(t){this.emit("data",t),this.onSuccess()}onError(t){this.emit("error",t),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=_,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete D.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;null!==t&&this.onData(t)}abort(){this.cleanup()}}if(D.requestsCount=0,D.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",F);else if("function"==typeof addEventListener){addEventListener("onpagehide"in s?"pagehide":"unload",F,!1)}function F(){for(let t in D.requests)D.requests.hasOwnProperty(t)&&D.requests[t].abort()}const I="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),M=s.WebSocket||s.MozWebSocket,W="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class N extends E{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,s=W?{}:o(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=W?new M(t,e,s):e?new M(t,e):new M(t)}catch(t){return this.emit("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=this.onClose.bind(this),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const s=t[e],r=e===t.length-1;y(s,this.supportsBinary,(t=>{try{this.ws.send(t)}catch(t){}r&&I((()=>{this.writable=!0,this.emit("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let t=this.query||{};const e=this.opts.secure?"wss":"ws";let s="";this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(s=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=P()),this.supportsBinary||(t.b64=1);const r=U.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+s+this.opts.path+(r.length?"?"+r:"")}check(){return!(!M||"__initialize"in M&&this.name===N.prototype.name)}}const X={websocket:N,polling:class extends H{constructor(t){if(super(t),"undefined"!=typeof location){const e="https:"===location.protocol;let s=location.port;s||(s=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||s!==t.port,this.xs=t.secure!==e}const e=t&&t.forceBase64;this.supportsBinary=j&&!e}request(t={}){return Object.assign(t,{xd:this.xd,xs:this.xs},this.opts),new D(this.uri(),t)}doWrite(t,e){const s=this.request({method:"POST",data:t});s.on("success",e),s.on("error",(t=>{this.onError("xhr post error",t)}))}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(t=>{this.onError("xhr poll error",t)})),this.pollXhr=t}}};var $=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,z=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],V=function(t){var e=t,s=t.indexOf("["),r=t.indexOf("]");-1!=s&&-1!=r&&(t=t.substring(0,s)+t.substring(s,r).replace(/:/g,";")+t.substring(r,t.length));for(var o,i,n=$.exec(t||""),a={},h=14;h--;)a[z[h]]=n[h]||"";return-1!=s&&-1!=r&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(t,e){var s=/\/{2,9}/g,r=e.replace(s,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||r.splice(0,1);"/"==e.substr(e.length-1,1)&&r.splice(r.length-1,1);return r}(0,a.path),a.queryKey=(o=a.query,i={},o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,s){e&&(i[e]=s)})),i),a};class G extends h{constructor(t,e={}){super(),t&&"object"==typeof t&&(e=t,t=null),t?(t=V(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=V(e.host).host),a(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},e),this.opts.path=this.opts.path.replace(/\/$/,"")+"/","string"==typeof this.opts.query&&(this.opts.query=U.decode(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&addEventListener("beforeunload",(()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())}),!1),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close")},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=function(t){const e={};for(let s in t)t.hasOwnProperty(s)&&(e[s]=t[s]);return e}(this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const s=Object.assign({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new X[t](s)}open(){let t;if(this.opts.rememberUpgrade&&G.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(()=>{this.onClose("transport close")}))}probe(t){let e=this.createTransport(t),s=!1;G.priorWebsocketSuccess=!1;const r=()=>{s||(e.send([{type:"ping",data:"probe"}]),e.once("packet",(t=>{if(!s)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;G.priorWebsocketSuccess="websocket"===e.name,this.transport.pause((()=>{s||"closed"!==this.readyState&&(p(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())}))}else{const t=new Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}})))};function o(){s||(s=!0,p(),e.close(),e=null)}const i=t=>{const s=new Error("probe error: "+t);s.transport=e.name,o(),this.emitReserved("upgradeError",s)};function n(){i("transport closed")}function a(){i("socket closed")}function h(t){e&&t.name!==e.name&&o()}const p=()=>{e.removeListener("open",r),e.removeListener("error",i),e.removeListener("close",n),this.off("close",a),this.off("upgrading",h)};e.once("open",r),e.once("error",i),e.once("close",n),this.once("close",a),this.once("upgrading",h),e.open()}onOpen(){if(this.readyState="open",G.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),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(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emitReserved("flush"))}write(t,e,s){return this.sendPacket("message",t,e,s),this}send(t,e,s){return this.sendPacket("message",t,e,s),this}sendPacket(t,e,s,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof s&&(r=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;const o={type:t,data:e,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},s=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?s():t()})):this.upgrading?s():t()),this}onError(t){G.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let s=0;const r=t.length;for(;s<r;s++)~this.transports.indexOf(t[s])&&e.push(t[s]);return e}}G.protocol=4;const J=G.protocol;export{G as Socket,E as Transport,a as installTimerFunctions,J as protocol,X as transports};
//# sourceMappingURL=engine.io.esm.min.js.map
/*!
* Engine.IO v6.0.0
* Engine.IO v6.0.1
* (c) 2014-2021 Guillermo Rauch

@@ -208,3 +208,3 @@ * Released under the MIT License.

// browser shim for xmlhttprequest module
function xmlhttprequest (opts) {
function XMLHttpRequest$1 (opts) {
var xdomain = opts.xdomain; // XMLHttpRequest can be disabled on IE

@@ -225,7 +225,2 @@

var XMLHttpRequestModule = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': xmlhttprequest
});
function pick(obj) {

@@ -257,179 +252,172 @@ for (var _len = arguments.length, attr = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

var componentEmitter = {exports: {}};
/**
* Expose `Emitter`.
*/
(function (module) {
/**
* Expose `Emitter`.
*/
{
module.exports = Emitter;
}
/**
* Initialize a new `Emitter`.
*
* @api public
*/
var Emitter_1 = Emitter;
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
}
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function Emitter(obj) {
if (obj) return mixin(obj);
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
Emitter["default"] = Emitter;
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
this._callbacks = this._callbacks || {};
(this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function (event, fn) {
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
this._callbacks = this._callbacks || {};
(this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
this._callbacks = this._callbacks || {}; // all
Emitter.prototype.once = function (event, fn) {
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
if (0 == arguments.length) {
this._callbacks = {};
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
} // specific event
Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
this._callbacks = this._callbacks || {}; // all
var callbacks = this._callbacks['$' + event];
if (!callbacks) return this; // remove all handlers
if (0 == arguments.length) {
this._callbacks = {};
return this;
} // specific event
if (1 == arguments.length) {
delete this._callbacks['$' + event];
return this;
} // remove specific handler
var callbacks = this._callbacks['$' + event];
if (!callbacks) return this; // remove all handlers
var cb;
if (1 == arguments.length) {
delete this._callbacks['$' + event];
return this;
} // remove specific handler
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
} // Remove event specific arrays for event types that no
// one is subscribed for to avoid memory leak.
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (callbacks.length === 0) {
delete this._callbacks['$' + event];
}
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
} // Remove event specific arrays for event types that no
// one is subscribed for to avoid memory leak.
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
if (callbacks.length === 0) {
delete this._callbacks['$' + event];
}
Emitter.prototype.emit = function (event) {
this._callbacks = this._callbacks || {};
var args = new Array(arguments.length - 1),
callbacks = this._callbacks['$' + event];
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
if (callbacks) {
callbacks = callbacks.slice(0);
Emitter.prototype.emit = function (event) {
this._callbacks = this._callbacks || {};
var args = new Array(arguments.length - 1),
callbacks = this._callbacks['$' + event];
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
if (callbacks) {
callbacks = callbacks.slice(0);
return this;
}; // alias used for reserved events (protected method)
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.emitReserved = Emitter.prototype.emit;
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function (event) {
this._callbacks = this._callbacks || {};
return this._callbacks['$' + event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.listeners = function (event) {
this._callbacks = this._callbacks || {};
return this._callbacks['$' + event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function (event) {
return !!this.listeners(event).length;
};
Emitter.prototype.hasListeners = function (event) {
return !!this.listeners(event).length;
};
})(componentEmitter);
var Emitter = componentEmitter.exports;
var PACKET_TYPES = Object.create(null); // no Map = no polyfill

@@ -781,3 +769,3 @@

return Transport;
}(Emitter);
}(Emitter_1);

@@ -1107,3 +1095,2 @@ var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split(''),

var XMLHttpRequest$1 = xmlhttprequest || XMLHttpRequestModule;
/**

@@ -1425,3 +1412,3 @@ * Empty function

return Request;
}(Emitter);
}(Emitter_1);
Request.requestsCount = 0;

@@ -1897,3 +1884,3 @@ Request.requests = {};

this.setTimeoutFn(function () {
_this2.emit("error", "No transports available");
_this2.emitReserved("error", "No transports available");
}, 0);

@@ -1968,3 +1955,3 @@ return;

_this4.emit("upgrading", transport);
_this4.emitReserved("upgrading", transport);

@@ -1985,3 +1972,3 @@ if (!transport) return;

_this4.emit("upgrade", transport);
_this4.emitReserved("upgrade", transport);

@@ -1998,3 +1985,3 @@ transport = null;

_this4.emit("upgradeError", err);
_this4.emitReserved("upgradeError", err);
}

@@ -2020,3 +2007,3 @@ });

_this4.emit("upgradeError", error);
_this4.emitReserved("upgradeError", error);
};

@@ -2069,3 +2056,3 @@

Socket.priorWebsocketSuccess = "websocket" === this.transport.name;
this.emit("open");
this.emitReserved("open");
this.flush(); // we check for `readyState` in case an `open`

@@ -2093,5 +2080,5 @@ // listener already closed the socket

if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) {
this.emit("packet", packet); // Socket is live - any packet counts
this.emitReserved("packet", packet); // Socket is live - any packet counts
this.emit("heartbeat");
this.emitReserved("heartbeat");

@@ -2106,4 +2093,4 @@ switch (packet.type) {

this.sendPacket("pong");
this.emit("ping");
this.emit("pong");
this.emitReserved("ping");
this.emitReserved("pong");
break;

@@ -2119,4 +2106,4 @@

case "message":
this.emit("data", packet.data);
this.emit("message", packet.data);
this.emitReserved("data", packet.data);
this.emitReserved("message", packet.data);
break;

@@ -2136,3 +2123,3 @@ }

value: function onHandshake(data) {
this.emit("handshake", data);
this.emitReserved("handshake", data);
this.id = data.sid;

@@ -2184,3 +2171,3 @@ this.transport.query.sid = data.sid;

if (0 === this.writeBuffer.length) {
this.emit("drain");
this.emitReserved("drain");
} else {

@@ -2204,3 +2191,3 @@ this.flush();

this.prevBufferLen = this.writeBuffer.length;
this.emit("flush");
this.emitReserved("flush");
}

@@ -2264,3 +2251,3 @@ }

};
this.emit("packetCreate", packet);
this.emitReserved("packetCreate", packet);
this.writeBuffer.push(packet);

@@ -2332,3 +2319,3 @@ if (fn) this.once("flush", fn);

Socket.priorWebsocketSuccess = false;
this.emit("error", err);
this.emitReserved("error", err);
this.onClose("transport error", err);

@@ -2364,3 +2351,3 @@ }

this.emit("close", reason, desc); // clean buffers after, so users can still
this.emitReserved("close", reason, desc); // clean buffers after, so users can still
// grab the buffers on `close` event

@@ -2396,3 +2383,3 @@

return Socket;
}(Emitter);
}(Emitter_1);
Socket.protocol = protocol;

@@ -2399,0 +2386,0 @@

/*!
* Engine.IO v6.0.0
* Engine.IO v6.0.1
* (c) 2014-2021 Guillermo Rauch
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).eio=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function o(){return o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o.apply(this,arguments)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?u(t):e}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function p(t,e,r){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}},p(t,e,r||t)}var l={exports:{}};try{l.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){l.exports=!1}var f=l.exports,d="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function y(t){var e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||f))return new XMLHttpRequest}catch(t){}if(!e)try{return new(d[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}var v=Object.freeze({__proto__:null,default:y});function m(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return r.reduce((function(e,r){return t.hasOwnProperty(r)&&(e[r]=t[r]),e}),{})}var g=setTimeout,b=clearTimeout;function k(t,e){e.useNativeTimers?(t.setTimeoutFn=g.bind(d),t.clearTimeoutFn=b.bind(d)):(t.setTimeoutFn=setTimeout.bind(d),t.clearTimeoutFn=clearTimeout.bind(d))}var w={exports:{}};!function(t){function e(t){if(t)return function(t){for(var r in e.prototype)t[r]=e.prototype[r];return t}(t)}t.exports=e,e.default=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}(w);var T=w.exports,S=Object.create(null);S.open="0",S.close="1",S.ping="2",S.pong="3",S.message="4",S.upgrade="5",S.noop="6";var x=Object.create(null);Object.keys(S).forEach((function(t){x[S[t]]=t}));for(var O={type:"error",data:"parser error"},E="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),C="function"==typeof ArrayBuffer,q=function(t,e,r){var n,o=t.type,i=t.data;return E&&i instanceof Blob?e?r(i):B(i,r):C&&(i instanceof ArrayBuffer||(n=i,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer))?e?r(i):B(new Blob([i]),r):r(S[o]+(i||""))},B=function(t,e){var r=new FileReader;return r.onload=function(){var t=r.result.split(",")[1];e("b"+t)},r.readAsDataURL(t)},L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P="undefined"==typeof Uint8Array?[]:new Uint8Array(256),A=0;A<L.length;A++)P[L.charCodeAt(A)]=A;var _,j="function"==typeof ArrayBuffer,R=function(t,e){if("string"!=typeof t)return{type:"message",data:H(t,e)};var r=t.charAt(0);return"b"===r?{type:"message",data:U(t.substring(1),e)}:x[r]?t.length>1?{type:x[r],data:t.substring(1)}:{type:x[r]}:O},U=function(t,e){if(j){var r=function(t){var e,r,n,o,i,s=.75*t.length,a=t.length,u=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var c=new ArrayBuffer(s),h=new Uint8Array(c);for(e=0;e<a;e+=4)r=P[t.charCodeAt(e)],n=P[t.charCodeAt(e+1)],o=P[t.charCodeAt(e+2)],i=P[t.charCodeAt(e+3)],h[u++]=r<<2|n>>4,h[u++]=(15&n)<<4|o>>2,h[u++]=(3&o)<<6|63&i;return c}(t);return H(r,e)}return{base64:!0,data:t}},H=function(t,e){return"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t},D=String.fromCharCode(30),F=function(t){i(o,t);var r=h(o);function o(t){var n;return e(this,o),(n=r.call(this)).writable=!1,k(u(n),t),n.opts=t,n.query=t.query,n.readyState="",n.socket=t.socket,n}return n(o,[{key:"onError",value:function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,p(s(o.prototype),"emit",this).call(this,"error",r),this}},{key:"open",value:function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}},{key:"close",value:function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}},{key:"send",value:function(t){"open"===this.readyState&&this.write(t)}},{key:"onOpen",value:function(){this.readyState="open",this.writable=!0,p(s(o.prototype),"emit",this).call(this,"open")}},{key:"onData",value:function(t){var e=R(t,this.socket.binaryType);this.onPacket(e)}},{key:"onPacket",value:function(t){p(s(o.prototype),"emit",this).call(this,"packet",t)}},{key:"onClose",value:function(){this.readyState="closed",p(s(o.prototype),"emit",this).call(this,"close")}}]),o}(T),I="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),M={},W=0,N=0;function X(t){var e="";do{e=I[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function $(){var t=X(+new Date);return t!==_?(W=0,_=t):t+"."+X(W++)}for(;N<64;N++)M[I[N]]=N;$.encode=X,$.decode=function(t){var e=0;for(N=0;N<t.length;N++)e=64*e+M[t.charAt(N)];return e};var z=$,V={encode:function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},decode:function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},G=function(t){i(o,t);var r=h(o);function o(){var t;return e(this,o),(t=r.apply(this,arguments)).polling=!1,t}return n(o,[{key:"doOpen",value:function(){this.poll()}},{key:"pause",value:function(t){var e=this;this.readyState="pausing";var r=function(){e.readyState="paused",t()};if(this.polling||!this.writable){var n=0;this.polling&&(n++,this.once("pollComplete",(function(){--n||r()}))),this.writable||(n++,this.once("drain",(function(){--n||r()})))}else r()}},{key:"poll",value:function(){this.polling=!0,this.doPoll(),this.emit("poll")}},{key:"onData",value:function(t){var e=this;(function(t,e){for(var r=t.split(D),n=[],o=0;o<r.length;o++){var i=R(r[o],e);if(n.push(i),"error"===i.type)break}return n})(t,this.socket.binaryType).forEach((function(t){if("opening"===e.readyState&&"open"===t.type&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())}},{key:"doClose",value:function(){var t=this,e=function(){t.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}},{key:"write",value:function(t){var e=this;this.writable=!1,function(t,e){var r=t.length,n=new Array(r),o=0;t.forEach((function(t,i){q(t,!1,(function(t){n[i]=t,++o===r&&e(n.join(D))}))}))}(t,(function(t){e.doWrite(t,(function(){e.writable=!0,e.emit("drain")}))}))}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"https":"http",r="";!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||t.sid||(t.b64=1),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port);var n=V.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}},{key:"name",get:function(){return"polling"}}]),o}(F),J=y||v;function K(){}var Q=null!=new J({xdomain:!1}).responseType,Y=function(t){i(s,t);var r=h(s);function s(t){var n;if(e(this,s),n=r.call(this,t),"undefined"!=typeof location){var o="https:"===location.protocol,i=location.port;i||(i=o?"443":"80"),n.xd="undefined"!=typeof location&&t.hostname!==location.hostname||i!==t.port,n.xs=t.secure!==o}var a=t&&t.forceBase64;return n.supportsBinary=Q&&!a,n}return n(s,[{key:"request",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{xd:this.xd,xs:this.xs},this.opts),new Z(this.uri(),t)}},{key:"doWrite",value:function(t,e){var r=this,n=this.request({method:"POST",data:t});n.on("success",e),n.on("error",(function(t){r.onError("xhr post error",t)}))}},{key:"doPoll",value:function(){var t=this,e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e}}]),s}(G),Z=function(t){i(o,t);var r=h(o);function o(t,n){var i;return e(this,o),k(u(i=r.call(this)),n),i.opts=n,i.method=n.method||"GET",i.uri=t,i.async=!1!==n.async,i.data=void 0!==n.data?n.data:null,i.create(),i}return n(o,[{key:"create",value:function(){var t=this,e=m(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;var r=this.xhr=new J(e);try{r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var n in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this.opts.extraHeaders[n])}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=function(){4===r.readyState&&(200===r.status||1223===r.status?t.onLoad():t.setTimeoutFn((function(){t.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(e){return void this.setTimeoutFn((function(){t.onError(e)}),0)}"undefined"!=typeof document&&(this.index=o.requestsCount++,o.requests[this.index]=this)}},{key:"onSuccess",value:function(){this.emit("success"),this.cleanup()}},{key:"onData",value:function(t){this.emit("data",t),this.onSuccess()}},{key:"onError",value:function(t){this.emit("error",t),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=K,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete o.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&this.onData(t)}},{key:"abort",value:function(){this.cleanup()}}]),o}(T);if(Z.requestsCount=0,Z.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",tt);else if("function"==typeof addEventListener){addEventListener("onpagehide"in d?"pagehide":"unload",tt,!1)}function tt(){for(var t in Z.requests)Z.requests.hasOwnProperty(t)&&Z.requests[t].abort()}var et="function"==typeof Promise&&"function"==typeof Promise.resolve?function(t){return Promise.resolve().then(t)}:function(t,e){return e(t,0)},rt=d.WebSocket||d.MozWebSocket,nt="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),ot=function(t){i(o,t);var r=h(o);function o(t){var n;return e(this,o),(n=r.call(this,t)).supportsBinary=!t.forceBase64,n}return n(o,[{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,r=nt?{}:m(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=nt?new rt(t,e,r):e?new rt(t,e):new rt(t)}catch(t){return this.emit("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.opts.autoUnref&&t.ws._socket.unref(),t.onOpen()},this.ws.onclose=this.onClose.bind(this),this.ws.onmessage=function(e){return t.onData(e.data)},this.ws.onerror=function(e){return t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var r=function(r){var n=t[r],o=r===t.length-1;q(n,e.supportsBinary,(function(t){try{e.ws.send(t)}catch(t){}o&&et((function(){e.writable=!0,e.emit("drain")}),e.setTimeoutFn)}))},n=0;n<t.length;n++)r(n)}},{key:"doClose",value:function(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"wss":"ws",r="";this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||(t.b64=1);var n=V.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}},{key:"check",value:function(){return!(!rt||"__initialize"in rt&&this.name===o.prototype.name)}},{key:"name",get:function(){return"websocket"}}]),o}(F),it={websocket:ot,polling:Y},st=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,at=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],ut=function(t){var e=t,r=t.indexOf("["),n=t.indexOf("]");-1!=r&&-1!=n&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));for(var o,i,s=st.exec(t||""),a={},u=14;u--;)a[at[u]]=s[u]||"";return-1!=r&&-1!=n&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||n.splice(0,1);"/"==e.substr(e.length-1,1)&&n.splice(n.length-1,1);return n}(0,a.path),a.queryKey=(o=a.query,i={},o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,r){e&&(i[e]=r)})),i),a};var ct=function(r){i(a,r);var s=h(a);function a(r){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e(this,a),n=s.call(this),r&&"object"===t(r)&&(i=r,r=null),r?(r=ut(r),i.hostname=r.host,i.secure="https"===r.protocol||"wss"===r.protocol,i.port=r.port,r.query&&(i.query=r.query)):i.host&&(i.hostname=ut(i.host).host),k(u(n),i),n.secure=null!=i.secure?i.secure:"undefined"!=typeof location&&"https:"===location.protocol,i.hostname&&!i.port&&(i.port=n.secure?"443":"80"),n.hostname=i.hostname||("undefined"!=typeof location?location.hostname:"localhost"),n.port=i.port||("undefined"!=typeof location&&location.port?location.port:n.secure?"443":"80"),n.transports=i.transports||["polling","websocket"],n.readyState="",n.writeBuffer=[],n.prevBufferLen=0,n.opts=o({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},i),n.opts.path=n.opts.path.replace(/\/$/,"")+"/","string"==typeof n.opts.query&&(n.opts.query=V.decode(n.opts.query)),n.id=null,n.upgrades=null,n.pingInterval=null,n.pingTimeout=null,n.pingTimeoutTimer=null,"function"==typeof addEventListener&&(n.opts.closeOnBeforeunload&&addEventListener("beforeunload",(function(){n.transport&&(n.transport.removeAllListeners(),n.transport.close())}),!1),"localhost"!==n.hostname&&(n.offlineEventListener=function(){n.onClose("transport close")},addEventListener("offline",n.offlineEventListener,!1))),n.open(),n}return n(a,[{key:"createTransport",value:function(t){var e=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}(this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);var r=o({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new it[t](r)}},{key:"open",value:function(){var t,e=this;if(this.opts.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((function(){e.emit("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(function(){e.onClose("transport close")}))}},{key:"probe",value:function(t){var e=this,r=this.createTransport(t),n=!1;a.priorWebsocketSuccess=!1;var o=function(){n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(function(t){if(!n)if("pong"===t.type&&"probe"===t.data){if(e.upgrading=!0,e.emit("upgrading",r),!r)return;a.priorWebsocketSuccess="websocket"===r.name,e.transport.pause((function(){n||"closed"!==e.readyState&&(p(),e.setTransport(r),r.send([{type:"upgrade"}]),e.emit("upgrade",r),r=null,e.upgrading=!1,e.flush())}))}else{var o=new Error("probe error");o.transport=r.name,e.emit("upgradeError",o)}})))};function i(){n||(n=!0,p(),r.close(),r=null)}var s=function(t){var n=new Error("probe error: "+t);n.transport=r.name,i(),e.emit("upgradeError",n)};function u(){s("transport closed")}function c(){s("socket closed")}function h(t){r&&t.name!==r.name&&i()}var p=function(){r.removeListener("open",o),r.removeListener("error",s),r.removeListener("close",u),e.off("close",c),e.off("upgrading",h)};r.once("open",o),r.once("error",s),r.once("close",u),this.once("close",c),this.once("upgrading",h),r.open()}},{key:"onOpen",value:function(){if(this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},{key:"onPacket",value:function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emit("ping"),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}}},{key:"onHandshake",value:function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}},{key:"resetPingTimeout",value:function(){var t=this;this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((function(){t.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}},{key:"onDrain",value:function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()}},{key:"flush",value:function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))}},{key:"write",value:function(t,e,r){return this.sendPacket("message",t,e,r),this}},{key:"send",value:function(t,e,r){return this.sendPacket("message",t,e,r),this}},{key:"sendPacket",value:function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}}},{key:"close",value:function(){var t=this,e=function(){t.onClose("forced close"),t.transport.close()},r=function r(){t.off("upgrade",r),t.off("upgradeError",r),e()},n=function(){t.once("upgrade",r),t.once("upgradeError",r)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){t.upgrading?n():e()})):this.upgrading?n():e()),this}},{key:"onError",value:function(t){a.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emit("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}}]),a}(T);ct.protocol=4;return function(t,e){return new ct(t,e)}}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).eio=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function o(){return o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o.apply(this,arguments)}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?u(t):e}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=i(t);if(e){var o=i(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function p(t,e,r){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=i(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}},p(t,e,r||t)}var l={exports:{}};try{l.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){l.exports=!1}var f=l.exports,d="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function y(t){var e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||f))return new XMLHttpRequest}catch(t){}if(!e)try{return new(d[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function v(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return r.reduce((function(e,r){return t.hasOwnProperty(r)&&(e[r]=t[r]),e}),{})}var m=setTimeout,g=clearTimeout;function b(t,e){e.useNativeTimers?(t.setTimeoutFn=m.bind(d),t.clearTimeoutFn=g.bind(d)):(t.setTimeoutFn=setTimeout.bind(d),t.clearTimeoutFn=clearTimeout.bind(d))}var k=w;function w(t){if(t)return function(t){for(var e in w.prototype)t[e]=w.prototype[e];return t}(t)}w.prototype.on=w.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},w.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},w.prototype.off=w.prototype.removeListener=w.prototype.removeAllListeners=w.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},w.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},w.prototype.emitReserved=w.prototype.emit,w.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},w.prototype.hasListeners=function(t){return!!this.listeners(t).length};var T=Object.create(null);T.open="0",T.close="1",T.ping="2",T.pong="3",T.message="4",T.upgrade="5",T.noop="6";var S=Object.create(null);Object.keys(T).forEach((function(t){S[T[t]]=t}));for(var x={type:"error",data:"parser error"},O="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),E="function"==typeof ArrayBuffer,R=function(t,e,r){var n,o=t.type,s=t.data;return O&&s instanceof Blob?e?r(s):C(s,r):E&&(s instanceof ArrayBuffer||(n=s,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer))?e?r(s):C(new Blob([s]),r):r(T[o]+(s||""))},C=function(t,e){var r=new FileReader;return r.onload=function(){var t=r.result.split(",")[1];e("b"+t)},r.readAsDataURL(t)},q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B="undefined"==typeof Uint8Array?[]:new Uint8Array(256),L=0;L<q.length;L++)B[q.charCodeAt(L)]=L;var P,A="function"==typeof ArrayBuffer,_=function(t,e){if("string"!=typeof t)return{type:"message",data:U(t,e)};var r=t.charAt(0);return"b"===r?{type:"message",data:j(t.substring(1),e)}:S[r]?t.length>1?{type:S[r],data:t.substring(1)}:{type:S[r]}:x},j=function(t,e){if(A){var r=function(t){var e,r,n,o,s,i=.75*t.length,a=t.length,u=0;"="===t[t.length-1]&&(i--,"="===t[t.length-2]&&i--);var c=new ArrayBuffer(i),h=new Uint8Array(c);for(e=0;e<a;e+=4)r=B[t.charCodeAt(e)],n=B[t.charCodeAt(e+1)],o=B[t.charCodeAt(e+2)],s=B[t.charCodeAt(e+3)],h[u++]=r<<2|n>>4,h[u++]=(15&n)<<4|o>>2,h[u++]=(3&o)<<6|63&s;return c}(t);return U(r,e)}return{base64:!0,data:t}},U=function(t,e){return"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t},H=String.fromCharCode(30),D=function(t){s(o,t);var r=h(o);function o(t){var n;return e(this,o),(n=r.call(this)).writable=!1,b(u(n),t),n.opts=t,n.query=t.query,n.readyState="",n.socket=t.socket,n}return n(o,[{key:"onError",value:function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,p(i(o.prototype),"emit",this).call(this,"error",r),this}},{key:"open",value:function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}},{key:"close",value:function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}},{key:"send",value:function(t){"open"===this.readyState&&this.write(t)}},{key:"onOpen",value:function(){this.readyState="open",this.writable=!0,p(i(o.prototype),"emit",this).call(this,"open")}},{key:"onData",value:function(t){var e=_(t,this.socket.binaryType);this.onPacket(e)}},{key:"onPacket",value:function(t){p(i(o.prototype),"emit",this).call(this,"packet",t)}},{key:"onClose",value:function(){this.readyState="closed",p(i(o.prototype),"emit",this).call(this,"close")}}]),o}(k),F="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),I={},M=0,W=0;function N(t){var e="";do{e=F[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function X(){var t=N(+new Date);return t!==P?(M=0,P=t):t+"."+N(M++)}for(;W<64;W++)I[F[W]]=W;X.encode=N,X.decode=function(t){var e=0;for(W=0;W<t.length;W++)e=64*e+I[t.charAt(W)];return e};var $=X,z={encode:function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},decode:function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var s=r[n].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}},V=function(t){s(o,t);var r=h(o);function o(){var t;return e(this,o),(t=r.apply(this,arguments)).polling=!1,t}return n(o,[{key:"doOpen",value:function(){this.poll()}},{key:"pause",value:function(t){var e=this;this.readyState="pausing";var r=function(){e.readyState="paused",t()};if(this.polling||!this.writable){var n=0;this.polling&&(n++,this.once("pollComplete",(function(){--n||r()}))),this.writable||(n++,this.once("drain",(function(){--n||r()})))}else r()}},{key:"poll",value:function(){this.polling=!0,this.doPoll(),this.emit("poll")}},{key:"onData",value:function(t){var e=this;(function(t,e){for(var r=t.split(H),n=[],o=0;o<r.length;o++){var s=_(r[o],e);if(n.push(s),"error"===s.type)break}return n})(t,this.socket.binaryType).forEach((function(t){if("opening"===e.readyState&&"open"===t.type&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())}},{key:"doClose",value:function(){var t=this,e=function(){t.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}},{key:"write",value:function(t){var e=this;this.writable=!1,function(t,e){var r=t.length,n=new Array(r),o=0;t.forEach((function(t,s){R(t,!1,(function(t){n[s]=t,++o===r&&e(n.join(H))}))}))}(t,(function(t){e.doWrite(t,(function(){e.writable=!0,e.emit("drain")}))}))}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"https":"http",r="";!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=$()),this.supportsBinary||t.sid||(t.b64=1),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port);var n=z.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}},{key:"name",get:function(){return"polling"}}]),o}(D);function G(){}var J=null!=new y({xdomain:!1}).responseType,K=function(t){s(i,t);var r=h(i);function i(t){var n;if(e(this,i),n=r.call(this,t),"undefined"!=typeof location){var o="https:"===location.protocol,s=location.port;s||(s=o?"443":"80"),n.xd="undefined"!=typeof location&&t.hostname!==location.hostname||s!==t.port,n.xs=t.secure!==o}var a=t&&t.forceBase64;return n.supportsBinary=J&&!a,n}return n(i,[{key:"request",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{xd:this.xd,xs:this.xs},this.opts),new Q(this.uri(),t)}},{key:"doWrite",value:function(t,e){var r=this,n=this.request({method:"POST",data:t});n.on("success",e),n.on("error",(function(t){r.onError("xhr post error",t)}))}},{key:"doPoll",value:function(){var t=this,e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e}}]),i}(V),Q=function(t){s(o,t);var r=h(o);function o(t,n){var s;return e(this,o),b(u(s=r.call(this)),n),s.opts=n,s.method=n.method||"GET",s.uri=t,s.async=!1!==n.async,s.data=void 0!==n.data?n.data:null,s.create(),s}return n(o,[{key:"create",value:function(){var t=this,e=v(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;var r=this.xhr=new y(e);try{r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var n in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this.opts.extraHeaders[n])}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=function(){4===r.readyState&&(200===r.status||1223===r.status?t.onLoad():t.setTimeoutFn((function(){t.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(e){return void this.setTimeoutFn((function(){t.onError(e)}),0)}"undefined"!=typeof document&&(this.index=o.requestsCount++,o.requests[this.index]=this)}},{key:"onSuccess",value:function(){this.emit("success"),this.cleanup()}},{key:"onData",value:function(t){this.emit("data",t),this.onSuccess()}},{key:"onError",value:function(t){this.emit("error",t),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=G,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete o.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&this.onData(t)}},{key:"abort",value:function(){this.cleanup()}}]),o}(k);if(Q.requestsCount=0,Q.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Y);else if("function"==typeof addEventListener){addEventListener("onpagehide"in d?"pagehide":"unload",Y,!1)}function Y(){for(var t in Q.requests)Q.requests.hasOwnProperty(t)&&Q.requests[t].abort()}var Z="function"==typeof Promise&&"function"==typeof Promise.resolve?function(t){return Promise.resolve().then(t)}:function(t,e){return e(t,0)},tt=d.WebSocket||d.MozWebSocket,et="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),rt=function(t){s(o,t);var r=h(o);function o(t){var n;return e(this,o),(n=r.call(this,t)).supportsBinary=!t.forceBase64,n}return n(o,[{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,r=et?{}:v(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=et?new tt(t,e,r):e?new tt(t,e):new tt(t)}catch(t){return this.emit("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.opts.autoUnref&&t.ws._socket.unref(),t.onOpen()},this.ws.onclose=this.onClose.bind(this),this.ws.onmessage=function(e){return t.onData(e.data)},this.ws.onerror=function(e){return t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var r=function(r){var n=t[r],o=r===t.length-1;R(n,e.supportsBinary,(function(t){try{e.ws.send(t)}catch(t){}o&&Z((function(){e.writable=!0,e.emit("drain")}),e.setTimeoutFn)}))},n=0;n<t.length;n++)r(n)}},{key:"doClose",value:function(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}},{key:"uri",value:function(){var t=this.query||{},e=this.opts.secure?"wss":"ws",r="";this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=$()),this.supportsBinary||(t.b64=1);var n=z.encode(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}},{key:"check",value:function(){return!(!tt||"__initialize"in tt&&this.name===o.prototype.name)}},{key:"name",get:function(){return"websocket"}}]),o}(D),nt={websocket:rt,polling:K},ot=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,st=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],it=function(t){var e=t,r=t.indexOf("["),n=t.indexOf("]");-1!=r&&-1!=n&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));for(var o,s,i=ot.exec(t||""),a={},u=14;u--;)a[st[u]]=i[u]||"";return-1!=r&&-1!=n&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||n.splice(0,1);"/"==e.substr(e.length-1,1)&&n.splice(n.length-1,1);return n}(0,a.path),a.queryKey=(o=a.query,s={},o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,r){e&&(s[e]=r)})),s),a};var at=function(r){s(a,r);var i=h(a);function a(r){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e(this,a),n=i.call(this),r&&"object"===t(r)&&(s=r,r=null),r?(r=it(r),s.hostname=r.host,s.secure="https"===r.protocol||"wss"===r.protocol,s.port=r.port,r.query&&(s.query=r.query)):s.host&&(s.hostname=it(s.host).host),b(u(n),s),n.secure=null!=s.secure?s.secure:"undefined"!=typeof location&&"https:"===location.protocol,s.hostname&&!s.port&&(s.port=n.secure?"443":"80"),n.hostname=s.hostname||("undefined"!=typeof location?location.hostname:"localhost"),n.port=s.port||("undefined"!=typeof location&&location.port?location.port:n.secure?"443":"80"),n.transports=s.transports||["polling","websocket"],n.readyState="",n.writeBuffer=[],n.prevBufferLen=0,n.opts=o({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},s),n.opts.path=n.opts.path.replace(/\/$/,"")+"/","string"==typeof n.opts.query&&(n.opts.query=z.decode(n.opts.query)),n.id=null,n.upgrades=null,n.pingInterval=null,n.pingTimeout=null,n.pingTimeoutTimer=null,"function"==typeof addEventListener&&(n.opts.closeOnBeforeunload&&addEventListener("beforeunload",(function(){n.transport&&(n.transport.removeAllListeners(),n.transport.close())}),!1),"localhost"!==n.hostname&&(n.offlineEventListener=function(){n.onClose("transport close")},addEventListener("offline",n.offlineEventListener,!1))),n.open(),n}return n(a,[{key:"createTransport",value:function(t){var e=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}(this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);var r=o({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new nt[t](r)}},{key:"open",value:function(){var t,e=this;if(this.opts.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((function(){e.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(function(){e.onClose("transport close")}))}},{key:"probe",value:function(t){var e=this,r=this.createTransport(t),n=!1;a.priorWebsocketSuccess=!1;var o=function(){n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(function(t){if(!n)if("pong"===t.type&&"probe"===t.data){if(e.upgrading=!0,e.emitReserved("upgrading",r),!r)return;a.priorWebsocketSuccess="websocket"===r.name,e.transport.pause((function(){n||"closed"!==e.readyState&&(p(),e.setTransport(r),r.send([{type:"upgrade"}]),e.emitReserved("upgrade",r),r=null,e.upgrading=!1,e.flush())}))}else{var o=new Error("probe error");o.transport=r.name,e.emitReserved("upgradeError",o)}})))};function s(){n||(n=!0,p(),r.close(),r=null)}var i=function(t){var n=new Error("probe error: "+t);n.transport=r.name,s(),e.emitReserved("upgradeError",n)};function u(){i("transport closed")}function c(){i("socket closed")}function h(t){r&&t.name!==r.name&&s()}var p=function(){r.removeListener("open",o),r.removeListener("error",i),r.removeListener("close",u),e.off("close",c),e.off("upgrading",h)};r.once("open",o),r.once("error",i),r.once("close",u),this.once("close",c),this.once("upgrading",h),r.open()}},{key:"onOpen",value:function(){if(this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},{key:"onPacket",value:function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}},{key:"onHandshake",value:function(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}},{key:"resetPingTimeout",value:function(){var t=this;this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((function(){t.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}},{key:"onDrain",value:function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}},{key:"flush",value:function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emitReserved("flush"))}},{key:"write",value:function(t,e,r){return this.sendPacket("message",t,e,r),this}},{key:"send",value:function(t,e,r){return this.sendPacket("message",t,e,r),this}},{key:"sendPacket",value:function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}}},{key:"close",value:function(){var t=this,e=function(){t.onClose("forced close"),t.transport.close()},r=function r(){t.off("upgrade",r),t.off("upgradeError",r),e()},n=function(){t.once("upgrade",r),t.once("upgradeError",r)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){t.upgrading?n():e()})):this.upgrading?n():e()),this}},{key:"onError",value:function(t){a.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}}]),a}(k);at.protocol=4;return function(t,e){return new at(t,e)}}));
//# sourceMappingURL=engine.io.min.js.map

@@ -5,11 +5,14 @@ {

"license": "MIT",
"version": "6.0.0",
"version": "6.0.1",
"main": "./build/cjs/index.js",
"module": "./build/esm/index.js",
"exports": {
"import": {
"node": "./build/esm-debug/index.js",
"default": "./build/esm/index.js"
},
"require": "./build/cjs/index.js"
"./package.json": "./package.json",
".": {
"import": {
"node": "./build/esm-debug/index.js",
"default": "./build/esm/index.js"
},
"require": "./build/cjs/index.js"
}
},

@@ -37,3 +40,3 @@ "types": "build/esm/index.d.ts",

"dependencies": {
"@socket.io/component-emitter": "~2.0.0",
"@socket.io/component-emitter": "~3.0.0",
"debug": "~4.3.1",

@@ -40,0 +43,0 @@ "engine.io-parser": "~5.0.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc