Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/socket.io/client-dist/socket.io.js

    r59329aa re29cc2e  
    11/*!
    2  * Socket.IO v3.1.2
     2 * Socket.IO v4.4.0
    33 * (c) 2014-2021 Guillermo Rauch
    44 * Released under the MIT License.
    55 */
    6 (function webpackUniversalModuleDefinition(root, factory) {
    7         if(typeof exports === 'object' && typeof module === 'object')
    8                 module.exports = factory();
    9         else if(typeof define === 'function' && define.amd)
    10                 define([], factory);
    11         else if(typeof exports === 'object')
    12                 exports["io"] = factory();
    13         else
    14                 root["io"] = factory();
    15 })(this, function() {
    16 return /******/ (function(modules) { // webpackBootstrap
    17 /******/        // The module cache
    18 /******/        var installedModules = {};
    19 /******/
    20 /******/        // The require function
    21 /******/        function __webpack_require__(moduleId) {
    22 /******/
    23 /******/                // Check if module is in cache
    24 /******/                if(installedModules[moduleId]) {
    25 /******/                        return installedModules[moduleId].exports;
    26 /******/                }
    27 /******/                // Create a new module (and put it into the cache)
    28 /******/                var module = installedModules[moduleId] = {
    29 /******/                        i: moduleId,
    30 /******/                        l: false,
    31 /******/                        exports: {}
    32 /******/                };
    33 /******/
    34 /******/                // Execute the module function
    35 /******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
    36 /******/
    37 /******/                // Flag the module as loaded
    38 /******/                module.l = true;
    39 /******/
    40 /******/                // Return the exports of the module
    41 /******/                return module.exports;
    42 /******/        }
    43 /******/
    44 /******/
    45 /******/        // expose the modules object (__webpack_modules__)
    46 /******/        __webpack_require__.m = modules;
    47 /******/
    48 /******/        // expose the module cache
    49 /******/        __webpack_require__.c = installedModules;
    50 /******/
    51 /******/        // define getter function for harmony exports
    52 /******/        __webpack_require__.d = function(exports, name, getter) {
    53 /******/                if(!__webpack_require__.o(exports, name)) {
    54 /******/                        Object.defineProperty(exports, name, { enumerable: true, get: getter });
    55 /******/                }
    56 /******/        };
    57 /******/
    58 /******/        // define __esModule on exports
    59 /******/        __webpack_require__.r = function(exports) {
    60 /******/                if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    61 /******/                        Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    62 /******/                }
    63 /******/                Object.defineProperty(exports, '__esModule', { value: true });
    64 /******/        };
    65 /******/
    66 /******/        // create a fake namespace object
    67 /******/        // mode & 1: value is a module id, require it
    68 /******/        // mode & 2: merge all properties of value into the ns
    69 /******/        // mode & 4: return value when already ns object
    70 /******/        // mode & 8|1: behave like require
    71 /******/        __webpack_require__.t = function(value, mode) {
    72 /******/                if(mode & 1) value = __webpack_require__(value);
    73 /******/                if(mode & 8) return value;
    74 /******/                if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
    75 /******/                var ns = Object.create(null);
    76 /******/                __webpack_require__.r(ns);
    77 /******/                Object.defineProperty(ns, 'default', { enumerable: true, value: value });
    78 /******/                if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
    79 /******/                return ns;
    80 /******/        };
    81 /******/
    82 /******/        // getDefaultExport function for compatibility with non-harmony modules
    83 /******/        __webpack_require__.n = function(module) {
    84 /******/                var getter = module && module.__esModule ?
    85 /******/                        function getDefault() { return module['default']; } :
    86 /******/                        function getModuleExports() { return module; };
    87 /******/                __webpack_require__.d(getter, 'a', getter);
    88 /******/                return getter;
    89 /******/        };
    90 /******/
    91 /******/        // Object.prototype.hasOwnProperty.call
    92 /******/        __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
    93 /******/
    94 /******/        // __webpack_public_path__
    95 /******/        __webpack_require__.p = "";
    96 /******/
    97 /******/
    98 /******/        // Load entry module and return exports
    99 /******/        return __webpack_require__(__webpack_require__.s = "./build/index.js");
    100 /******/ })
    101 /************************************************************************/
    102 /******/ ({
    103 
    104 /***/ "./build/index.js":
    105 /*!************************!*\
    106   !*** ./build/index.js ***!
    107   \************************/
    108 /*! no static exports found */
    109 /***/ (function(module, exports, __webpack_require__) {
    110 
    111 "use strict";
    112 
    113 
    114 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    115 
    116 Object.defineProperty(exports, "__esModule", {
    117   value: true
    118 });
    119 exports.Socket = exports.io = exports.Manager = exports.protocol = void 0;
    120 
    121 var url_1 = __webpack_require__(/*! ./url */ "./build/url.js");
    122 
    123 var manager_1 = __webpack_require__(/*! ./manager */ "./build/manager.js");
    124 
    125 var socket_1 = __webpack_require__(/*! ./socket */ "./build/socket.js");
    126 
    127 Object.defineProperty(exports, "Socket", {
    128   enumerable: true,
    129   get: function get() {
    130     return socket_1.Socket;
     6(function (global, factory) {
     7  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
     8  typeof define === 'function' && define.amd ? define(factory) :
     9  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.io = factory());
     10})(this, (function () { 'use strict';
     11
     12  function _typeof(obj) {
     13    "@babel/helpers - typeof";
     14
     15    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
     16      _typeof = function (obj) {
     17        return typeof obj;
     18      };
     19    } else {
     20      _typeof = function (obj) {
     21        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
     22      };
     23    }
     24
     25    return _typeof(obj);
    13126  }
    132 });
    133 
    134 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("socket.io-client");
    135 /**
    136  * Module exports.
    137  */
    138 
    139 
    140 module.exports = exports = lookup;
    141 /**
    142  * Managers cache.
    143  */
    144 
    145 var cache = exports.managers = {};
    146 
    147 function lookup(uri, opts) {
    148   if (_typeof(uri) === "object") {
    149     opts = uri;
    150     uri = undefined;
     27
     28  function _classCallCheck(instance, Constructor) {
     29    if (!(instance instanceof Constructor)) {
     30      throw new TypeError("Cannot call a class as a function");
     31    }
    15132  }
    15233
    153   opts = opts || {};
    154   var parsed = url_1.url(uri, opts.path);
    155   var source = parsed.source;
    156   var id = parsed.id;
    157   var path = parsed.path;
    158   var sameNamespace = cache[id] && path in cache[id]["nsps"];
    159   var newConnection = opts.forceNew || opts["force new connection"] || false === opts.multiplex || sameNamespace;
    160   var io;
    161 
    162   if (newConnection) {
    163     debug("ignoring socket cache for %s", source);
    164     io = new manager_1.Manager(source, opts);
    165   } else {
    166     if (!cache[id]) {
    167       debug("new io instance for %s", source);
    168       cache[id] = new manager_1.Manager(source, opts);
    169     }
    170 
    171     io = cache[id];
     34  function _defineProperties(target, props) {
     35    for (var i = 0; i < props.length; i++) {
     36      var descriptor = props[i];
     37      descriptor.enumerable = descriptor.enumerable || false;
     38      descriptor.configurable = true;
     39      if ("value" in descriptor) descriptor.writable = true;
     40      Object.defineProperty(target, descriptor.key, descriptor);
     41    }
    17242  }
    17343
    174   if (parsed.query && !opts.query) {
    175     opts.query = parsed.queryKey;
     44  function _createClass(Constructor, protoProps, staticProps) {
     45    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
     46    if (staticProps) _defineProperties(Constructor, staticProps);
     47    return Constructor;
    17648  }
    17749
    178   return io.socket(parsed.path, opts);
    179 }
    180 
    181 exports.io = lookup;
    182 /**
    183  * Protocol version.
    184  *
    185  * @public
    186  */
    187 
    188 var socket_io_parser_1 = __webpack_require__(/*! socket.io-parser */ "./node_modules/socket.io-parser/dist/index.js");
    189 
    190 Object.defineProperty(exports, "protocol", {
    191   enumerable: true,
    192   get: function get() {
    193     return socket_io_parser_1.protocol;
     50  function _extends() {
     51    _extends = Object.assign || function (target) {
     52      for (var i = 1; i < arguments.length; i++) {
     53        var source = arguments[i];
     54
     55        for (var key in source) {
     56          if (Object.prototype.hasOwnProperty.call(source, key)) {
     57            target[key] = source[key];
     58          }
     59        }
     60      }
     61
     62      return target;
     63    };
     64
     65    return _extends.apply(this, arguments);
    19466  }
    195 });
    196 /**
    197  * `connect`.
    198  *
    199  * @param {String} uri
    200  * @public
    201  */
    202 
    203 exports.connect = lookup;
    204 /**
    205  * Expose constructors for standalone build.
    206  *
    207  * @public
    208  */
    209 
    210 var manager_2 = __webpack_require__(/*! ./manager */ "./build/manager.js");
    211 
    212 Object.defineProperty(exports, "Manager", {
    213   enumerable: true,
    214   get: function get() {
    215     return manager_2.Manager;
     67
     68  function _inherits(subClass, superClass) {
     69    if (typeof superClass !== "function" && superClass !== null) {
     70      throw new TypeError("Super expression must either be null or a function");
     71    }
     72
     73    subClass.prototype = Object.create(superClass && superClass.prototype, {
     74      constructor: {
     75        value: subClass,
     76        writable: true,
     77        configurable: true
     78      }
     79    });
     80    if (superClass) _setPrototypeOf(subClass, superClass);
    21681  }
    217 });
    218 
    219 /***/ }),
    220 
    221 /***/ "./build/manager.js":
    222 /*!**************************!*\
    223   !*** ./build/manager.js ***!
    224   \**************************/
    225 /*! no static exports found */
    226 /***/ (function(module, exports, __webpack_require__) {
    227 
    228 "use strict";
    229 
    230 
    231 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    232 
    233 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    234 
    235 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    236 
    237 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    238 
    239 function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
    240 
    241 function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
    242 
    243 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    244 
    245 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    246 
    247 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    248 
    249 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    250 
    251 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    252 
    253 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    254 
    255 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    256 
    257 Object.defineProperty(exports, "__esModule", {
    258   value: true
    259 });
    260 exports.Manager = void 0;
    261 
    262 var eio = __webpack_require__(/*! engine.io-client */ "./node_modules/engine.io-client/lib/index.js");
    263 
    264 var socket_1 = __webpack_require__(/*! ./socket */ "./build/socket.js");
    265 
    266 var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
    267 
    268 var parser = __webpack_require__(/*! socket.io-parser */ "./node_modules/socket.io-parser/dist/index.js");
    269 
    270 var on_1 = __webpack_require__(/*! ./on */ "./build/on.js");
    271 
    272 var Backoff = __webpack_require__(/*! backo2 */ "./node_modules/backo2/index.js");
    273 
    274 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("socket.io-client:manager");
    275 
    276 var Manager = /*#__PURE__*/function (_Emitter) {
    277   _inherits(Manager, _Emitter);
    278 
    279   var _super = _createSuper(Manager);
    280 
    281   function Manager(uri, opts) {
    282     var _this;
    283 
    284     _classCallCheck(this, Manager);
    285 
    286     _this = _super.call(this);
    287     _this.nsps = {};
    288     _this.subs = [];
    289 
    290     if (uri && "object" === _typeof(uri)) {
    291       opts = uri;
    292       uri = undefined;
    293     }
    294 
    295     opts = opts || {};
    296     opts.path = opts.path || "/socket.io";
    297     _this.opts = opts;
    298 
    299     _this.reconnection(opts.reconnection !== false);
    300 
    301     _this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
    302 
    303     _this.reconnectionDelay(opts.reconnectionDelay || 1000);
    304 
    305     _this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
    306 
    307     _this.randomizationFactor(opts.randomizationFactor || 0.5);
    308 
    309     _this.backoff = new Backoff({
    310       min: _this.reconnectionDelay(),
    311       max: _this.reconnectionDelayMax(),
    312       jitter: _this.randomizationFactor()
     82
     83  function _getPrototypeOf(o) {
     84    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
     85      return o.__proto__ || Object.getPrototypeOf(o);
     86    };
     87    return _getPrototypeOf(o);
     88  }
     89
     90  function _setPrototypeOf(o, p) {
     91    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
     92      o.__proto__ = p;
     93      return o;
     94    };
     95
     96    return _setPrototypeOf(o, p);
     97  }
     98
     99  function _isNativeReflectConstruct() {
     100    if (typeof Reflect === "undefined" || !Reflect.construct) return false;
     101    if (Reflect.construct.sham) return false;
     102    if (typeof Proxy === "function") return true;
     103
     104    try {
     105      Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
     106      return true;
     107    } catch (e) {
     108      return false;
     109    }
     110  }
     111
     112  function _assertThisInitialized(self) {
     113    if (self === void 0) {
     114      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
     115    }
     116
     117    return self;
     118  }
     119
     120  function _possibleConstructorReturn(self, call) {
     121    if (call && (typeof call === "object" || typeof call === "function")) {
     122      return call;
     123    } else if (call !== void 0) {
     124      throw new TypeError("Derived constructors may only return object or undefined");
     125    }
     126
     127    return _assertThisInitialized(self);
     128  }
     129
     130  function _createSuper(Derived) {
     131    var hasNativeReflectConstruct = _isNativeReflectConstruct();
     132
     133    return function _createSuperInternal() {
     134      var Super = _getPrototypeOf(Derived),
     135          result;
     136
     137      if (hasNativeReflectConstruct) {
     138        var NewTarget = _getPrototypeOf(this).constructor;
     139
     140        result = Reflect.construct(Super, arguments, NewTarget);
     141      } else {
     142        result = Super.apply(this, arguments);
     143      }
     144
     145      return _possibleConstructorReturn(this, result);
     146    };
     147  }
     148
     149  function _superPropBase(object, property) {
     150    while (!Object.prototype.hasOwnProperty.call(object, property)) {
     151      object = _getPrototypeOf(object);
     152      if (object === null) break;
     153    }
     154
     155    return object;
     156  }
     157
     158  function _get(target, property, receiver) {
     159    if (typeof Reflect !== "undefined" && Reflect.get) {
     160      _get = Reflect.get;
     161    } else {
     162      _get = function _get(target, property, receiver) {
     163        var base = _superPropBase(target, property);
     164
     165        if (!base) return;
     166        var desc = Object.getOwnPropertyDescriptor(base, property);
     167
     168        if (desc.get) {
     169          return desc.get.call(receiver);
     170        }
     171
     172        return desc.value;
     173      };
     174    }
     175
     176    return _get(target, property, receiver || target);
     177  }
     178
     179  function _unsupportedIterableToArray(o, minLen) {
     180    if (!o) return;
     181    if (typeof o === "string") return _arrayLikeToArray(o, minLen);
     182    var n = Object.prototype.toString.call(o).slice(8, -1);
     183    if (n === "Object" && o.constructor) n = o.constructor.name;
     184    if (n === "Map" || n === "Set") return Array.from(o);
     185    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
     186  }
     187
     188  function _arrayLikeToArray(arr, len) {
     189    if (len == null || len > arr.length) len = arr.length;
     190
     191    for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
     192
     193    return arr2;
     194  }
     195
     196  function _createForOfIteratorHelper(o, allowArrayLike) {
     197    var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
     198
     199    if (!it) {
     200      if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
     201        if (it) o = it;
     202        var i = 0;
     203
     204        var F = function () {};
     205
     206        return {
     207          s: F,
     208          n: function () {
     209            if (i >= o.length) return {
     210              done: true
     211            };
     212            return {
     213              done: false,
     214              value: o[i++]
     215            };
     216          },
     217          e: function (e) {
     218            throw e;
     219          },
     220          f: F
     221        };
     222      }
     223
     224      throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
     225    }
     226
     227    var normalCompletion = true,
     228        didErr = false,
     229        err;
     230    return {
     231      s: function () {
     232        it = it.call(o);
     233      },
     234      n: function () {
     235        var step = it.next();
     236        normalCompletion = step.done;
     237        return step;
     238      },
     239      e: function (e) {
     240        didErr = true;
     241        err = e;
     242      },
     243      f: function () {
     244        try {
     245          if (!normalCompletion && it.return != null) it.return();
     246        } finally {
     247          if (didErr) throw err;
     248        }
     249      }
     250    };
     251  }
     252
     253  /**
     254   * Parses an URI
     255   *
     256   * @author Steven Levithan <stevenlevithan.com> (MIT license)
     257   * @api private
     258   */
     259  var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
     260  var parts = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'];
     261
     262  var parseuri = function parseuri(str) {
     263    var src = str,
     264        b = str.indexOf('['),
     265        e = str.indexOf(']');
     266
     267    if (b != -1 && e != -1) {
     268      str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);
     269    }
     270
     271    var m = re.exec(str || ''),
     272        uri = {},
     273        i = 14;
     274
     275    while (i--) {
     276      uri[parts[i]] = m[i] || '';
     277    }
     278
     279    if (b != -1 && e != -1) {
     280      uri.source = src;
     281      uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');
     282      uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');
     283      uri.ipv6uri = true;
     284    }
     285
     286    uri.pathNames = pathNames(uri, uri['path']);
     287    uri.queryKey = queryKey(uri, uri['query']);
     288    return uri;
     289  };
     290
     291  function pathNames(obj, path) {
     292    var regx = /\/{2,9}/g,
     293        names = path.replace(regx, "/").split("/");
     294
     295    if (path.substr(0, 1) == '/' || path.length === 0) {
     296      names.splice(0, 1);
     297    }
     298
     299    if (path.substr(path.length - 1, 1) == '/') {
     300      names.splice(names.length - 1, 1);
     301    }
     302
     303    return names;
     304  }
     305
     306  function queryKey(uri, query) {
     307    var data = {};
     308    query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, $1, $2) {
     309      if ($1) {
     310        data[$1] = $2;
     311      }
    313312    });
    314 
    315     _this.timeout(null == opts.timeout ? 20000 : opts.timeout);
    316 
    317     _this._readyState = "closed";
    318     _this.uri = uri;
    319 
    320     var _parser = opts.parser || parser;
    321 
    322     _this.encoder = new _parser.Encoder();
    323     _this.decoder = new _parser.Decoder();
    324     _this._autoConnect = opts.autoConnect !== false;
    325     if (_this._autoConnect) _this.open();
    326     return _this;
     313    return data;
    327314  }
    328315
    329   _createClass(Manager, [{
    330     key: "reconnection",
    331     value: function reconnection(v) {
    332       if (!arguments.length) return this._reconnection;
    333       this._reconnection = !!v;
    334       return this;
    335     }
    336   }, {
    337     key: "reconnectionAttempts",
    338     value: function reconnectionAttempts(v) {
    339       if (v === undefined) return this._reconnectionAttempts;
    340       this._reconnectionAttempts = v;
    341       return this;
    342     }
    343   }, {
    344     key: "reconnectionDelay",
    345     value: function reconnectionDelay(v) {
    346       var _a;
    347 
    348       if (v === undefined) return this._reconnectionDelay;
    349       this._reconnectionDelay = v;
    350       (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMin(v);
    351       return this;
    352     }
    353   }, {
    354     key: "randomizationFactor",
    355     value: function randomizationFactor(v) {
    356       var _a;
    357 
    358       if (v === undefined) return this._randomizationFactor;
    359       this._randomizationFactor = v;
    360       (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setJitter(v);
    361       return this;
    362     }
    363   }, {
    364     key: "reconnectionDelayMax",
    365     value: function reconnectionDelayMax(v) {
    366       var _a;
    367 
    368       if (v === undefined) return this._reconnectionDelayMax;
    369       this._reconnectionDelayMax = v;
    370       (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMax(v);
    371       return this;
    372     }
    373   }, {
    374     key: "timeout",
    375     value: function timeout(v) {
    376       if (!arguments.length) return this._timeout;
    377       this._timeout = v;
    378       return this;
    379     }
    380     /**
    381      * Starts trying to reconnect if reconnection is enabled and we have not
    382      * started reconnecting yet
    383      *
    384      * @private
    385      */
    386 
    387   }, {
    388     key: "maybeReconnectOnOpen",
    389     value: function maybeReconnectOnOpen() {
    390       // Only try to reconnect if it's the first time we're connecting
    391       if (!this._reconnecting && this._reconnection && this.backoff.attempts === 0) {
    392         // keeps reconnection from firing twice for the same reconnection loop
    393         this.reconnect();
    394       }
    395     }
    396     /**
    397      * Sets the current transport `socket`.
    398      *
    399      * @param {Function} fn - optional, callback
    400      * @return self
    401      * @public
    402      */
    403 
    404   }, {
    405     key: "open",
    406     value: function open(fn) {
    407       var _this2 = this;
    408 
    409       debug("readyState %s", this._readyState);
    410       if (~this._readyState.indexOf("open")) return this;
    411       debug("opening %s", this.uri);
    412       this.engine = eio(this.uri, this.opts);
    413       var socket = this.engine;
    414       var self = this;
    415       this._readyState = "opening";
    416       this.skipReconnect = false; // emit `open`
    417 
    418       var openSubDestroy = on_1.on(socket, "open", function () {
    419         self.onopen();
    420         fn && fn();
    421       }); // emit `error`
    422 
    423       var errorSub = on_1.on(socket, "error", function (err) {
    424         debug("error");
    425         self.cleanup();
    426         self._readyState = "closed";
    427 
    428         _get(_getPrototypeOf(Manager.prototype), "emit", _this2).call(_this2, "error", err);
    429 
    430         if (fn) {
    431           fn(err);
    432         } else {
    433           // Only do this if there is no fn to handle the error
    434           self.maybeReconnectOnOpen();
    435         }
    436       });
    437 
    438       if (false !== this._timeout) {
    439         var timeout = this._timeout;
    440         debug("connect attempt will timeout after %d", timeout);
    441 
    442         if (timeout === 0) {
    443           openSubDestroy(); // prevents a race condition with the 'open' event
    444         } // set timer
    445 
    446 
    447         var timer = setTimeout(function () {
    448           debug("connect attempt timed out after %d", timeout);
    449           openSubDestroy();
    450           socket.close();
    451           socket.emit("error", new Error("timeout"));
    452         }, timeout);
    453         this.subs.push(function subDestroy() {
    454           clearTimeout(timer);
    455         });
    456       }
    457 
    458       this.subs.push(openSubDestroy);
    459       this.subs.push(errorSub);
    460       return this;
    461     }
    462     /**
    463      * Alias for open()
    464      *
    465      * @return self
    466      * @public
    467      */
    468 
    469   }, {
    470     key: "connect",
    471     value: function connect(fn) {
    472       return this.open(fn);
    473     }
    474     /**
    475      * Called upon transport open.
    476      *
    477      * @private
    478      */
    479 
    480   }, {
    481     key: "onopen",
    482     value: function onopen() {
    483       debug("open"); // clear old subs
    484 
    485       this.cleanup(); // mark as open
    486 
    487       this._readyState = "open";
    488 
    489       _get(_getPrototypeOf(Manager.prototype), "emit", this).call(this, "open"); // add new subs
    490 
    491 
    492       var socket = this.engine;
    493       this.subs.push(on_1.on(socket, "ping", this.onping.bind(this)), on_1.on(socket, "data", this.ondata.bind(this)), on_1.on(socket, "error", this.onerror.bind(this)), on_1.on(socket, "close", this.onclose.bind(this)), on_1.on(this.decoder, "decoded", this.ondecoded.bind(this)));
    494     }
    495     /**
    496      * Called upon a ping.
    497      *
    498      * @private
    499      */
    500 
    501   }, {
    502     key: "onping",
    503     value: function onping() {
    504       _get(_getPrototypeOf(Manager.prototype), "emit", this).call(this, "ping");
    505     }
    506     /**
    507      * Called with data.
    508      *
    509      * @private
    510      */
    511 
    512   }, {
    513     key: "ondata",
    514     value: function ondata(data) {
    515       this.decoder.add(data);
    516     }
    517     /**
    518      * Called when parser fully decodes a packet.
    519      *
    520      * @private
    521      */
    522 
    523   }, {
    524     key: "ondecoded",
    525     value: function ondecoded(packet) {
    526       _get(_getPrototypeOf(Manager.prototype), "emit", this).call(this, "packet", packet);
    527     }
    528     /**
    529      * Called upon socket error.
    530      *
    531      * @private
    532      */
    533 
    534   }, {
    535     key: "onerror",
    536     value: function onerror(err) {
    537       debug("error", err);
    538 
    539       _get(_getPrototypeOf(Manager.prototype), "emit", this).call(this, "error", err);
    540     }
    541     /**
    542      * Creates a new socket for the given `nsp`.
    543      *
    544      * @return {Socket}
    545      * @public
    546      */
    547 
    548   }, {
    549     key: "socket",
    550     value: function socket(nsp, opts) {
    551       var socket = this.nsps[nsp];
    552 
    553       if (!socket) {
    554         socket = new socket_1.Socket(this, nsp, opts);
    555         this.nsps[nsp] = socket;
    556       }
    557 
    558       return socket;
    559     }
    560     /**
    561      * Called upon a socket close.
    562      *
    563      * @param socket
    564      * @private
    565      */
    566 
    567   }, {
    568     key: "_destroy",
    569     value: function _destroy(socket) {
    570       var nsps = Object.keys(this.nsps);
    571 
    572       for (var _i = 0, _nsps = nsps; _i < _nsps.length; _i++) {
    573         var nsp = _nsps[_i];
    574         var _socket = this.nsps[nsp];
    575 
    576         if (_socket.active) {
    577           debug("socket %s is still active, skipping close", nsp);
    578           return;
    579         }
    580       }
    581 
    582       this._close();
    583     }
    584     /**
    585      * Writes a packet.
    586      *
    587      * @param packet
    588      * @private
    589      */
    590 
    591   }, {
    592     key: "_packet",
    593     value: function _packet(packet) {
    594       debug("writing packet %j", packet);
    595       var encodedPackets = this.encoder.encode(packet);
    596 
    597       for (var i = 0; i < encodedPackets.length; i++) {
    598         this.engine.write(encodedPackets[i], packet.options);
    599       }
    600     }
    601     /**
    602      * Clean up transport subscriptions and packet buffer.
    603      *
    604      * @private
    605      */
    606 
    607   }, {
    608     key: "cleanup",
    609     value: function cleanup() {
    610       debug("cleanup");
    611       this.subs.forEach(function (subDestroy) {
    612         return subDestroy();
    613       });
    614       this.subs.length = 0;
    615       this.decoder.destroy();
    616     }
    617     /**
    618      * Close the current socket.
    619      *
    620      * @private
    621      */
    622 
    623   }, {
    624     key: "_close",
    625     value: function _close() {
    626       debug("disconnect");
    627       this.skipReconnect = true;
    628       this._reconnecting = false;
    629 
    630       if ("opening" === this._readyState) {
    631         // `onclose` will not fire because
    632         // an open event never happened
    633         this.cleanup();
    634       }
    635 
    636       this.backoff.reset();
    637       this._readyState = "closed";
    638       if (this.engine) this.engine.close();
    639     }
    640     /**
    641      * Alias for close()
    642      *
    643      * @private
    644      */
    645 
    646   }, {
    647     key: "disconnect",
    648     value: function disconnect() {
    649       return this._close();
    650     }
    651     /**
    652      * Called upon engine close.
    653      *
    654      * @private
    655      */
    656 
    657   }, {
    658     key: "onclose",
    659     value: function onclose(reason) {
    660       debug("onclose");
    661       this.cleanup();
    662       this.backoff.reset();
    663       this._readyState = "closed";
    664 
    665       _get(_getPrototypeOf(Manager.prototype), "emit", this).call(this, "close", reason);
    666 
    667       if (this._reconnection && !this.skipReconnect) {
    668         this.reconnect();
    669       }
    670     }
    671     /**
    672      * Attempt a reconnection.
    673      *
    674      * @private
    675      */
    676 
    677   }, {
    678     key: "reconnect",
    679     value: function reconnect() {
    680       var _this3 = this;
    681 
    682       if (this._reconnecting || this.skipReconnect) return this;
    683       var self = this;
    684 
    685       if (this.backoff.attempts >= this._reconnectionAttempts) {
    686         debug("reconnect failed");
    687         this.backoff.reset();
    688 
    689         _get(_getPrototypeOf(Manager.prototype), "emit", this).call(this, "reconnect_failed");
    690 
    691         this._reconnecting = false;
    692       } else {
    693         var delay = this.backoff.duration();
    694         debug("will wait %dms before reconnect attempt", delay);
    695         this._reconnecting = true;
    696         var timer = setTimeout(function () {
    697           if (self.skipReconnect) return;
    698           debug("attempting reconnect");
    699 
    700           _get(_getPrototypeOf(Manager.prototype), "emit", _this3).call(_this3, "reconnect_attempt", self.backoff.attempts); // check again for the case socket closed in above events
    701 
    702 
    703           if (self.skipReconnect) return;
    704           self.open(function (err) {
    705             if (err) {
    706               debug("reconnect attempt error");
    707               self._reconnecting = false;
    708               self.reconnect();
    709 
    710               _get(_getPrototypeOf(Manager.prototype), "emit", _this3).call(_this3, "reconnect_error", err);
    711             } else {
    712               debug("reconnect success");
    713               self.onreconnect();
    714             }
    715           });
    716         }, delay);
    717         this.subs.push(function subDestroy() {
    718           clearTimeout(timer);
    719         });
    720       }
    721     }
    722     /**
    723      * Called upon successful reconnect.
    724      *
    725      * @private
    726      */
    727 
    728   }, {
    729     key: "onreconnect",
    730     value: function onreconnect() {
    731       var attempt = this.backoff.attempts;
    732       this._reconnecting = false;
    733       this.backoff.reset();
    734 
    735       _get(_getPrototypeOf(Manager.prototype), "emit", this).call(this, "reconnect", attempt);
    736     }
    737   }]);
    738 
    739   return Manager;
    740 }(Emitter);
    741 
    742 exports.Manager = Manager;
    743 
    744 /***/ }),
    745 
    746 /***/ "./build/on.js":
    747 /*!*********************!*\
    748   !*** ./build/on.js ***!
    749   \*********************/
    750 /*! no static exports found */
    751 /***/ (function(module, exports, __webpack_require__) {
    752 
    753 "use strict";
    754 
    755 
    756 Object.defineProperty(exports, "__esModule", {
    757   value: true
    758 });
    759 exports.on = void 0;
    760 
    761 function on(obj, ev, fn) {
    762   obj.on(ev, fn);
    763   return function subDestroy() {
    764     obj.off(ev, fn);
    765   };
    766 }
    767 
    768 exports.on = on;
    769 
    770 /***/ }),
    771 
    772 /***/ "./build/socket.js":
    773 /*!*************************!*\
    774   !*** ./build/socket.js ***!
    775   \*************************/
    776 /*! no static exports found */
    777 /***/ (function(module, exports, __webpack_require__) {
    778 
    779 "use strict";
    780 
    781 
    782 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    783 
    784 function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
    785 
    786 function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
    787 
    788 function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
    789 
    790 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    791 
    792 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    793 
    794 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    795 
    796 function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
    797 
    798 function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
    799 
    800 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    801 
    802 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    803 
    804 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    805 
    806 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    807 
    808 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    809 
    810 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    811 
    812 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    813 
    814 Object.defineProperty(exports, "__esModule", {
    815   value: true
    816 });
    817 exports.Socket = void 0;
    818 
    819 var socket_io_parser_1 = __webpack_require__(/*! socket.io-parser */ "./node_modules/socket.io-parser/dist/index.js");
    820 
    821 var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
    822 
    823 var on_1 = __webpack_require__(/*! ./on */ "./build/on.js");
    824 
    825 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("socket.io-client:socket");
    826 /**
    827  * Internal events.
    828  * These events can't be emitted by the user.
    829  */
    830 
    831 
    832 var RESERVED_EVENTS = Object.freeze({
    833   connect: 1,
    834   connect_error: 1,
    835   disconnect: 1,
    836   disconnecting: 1,
    837   // EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener
    838   newListener: 1,
    839   removeListener: 1
    840 });
    841 
    842 var Socket = /*#__PURE__*/function (_Emitter) {
    843   _inherits(Socket, _Emitter);
    844 
    845   var _super = _createSuper(Socket);
    846 
    847316  /**
    848    * `Socket` constructor.
     317   * URL parser.
    849318   *
     319   * @param uri - url
     320   * @param path - the request path of the connection
     321   * @param loc - An object meant to mimic window.location.
     322   *        Defaults to window.location.
    850323   * @public
    851324   */
    852   function Socket(io, nsp, opts) {
    853     var _this;
    854 
    855     _classCallCheck(this, Socket);
    856 
    857     _this = _super.call(this);
    858     _this.receiveBuffer = [];
    859     _this.sendBuffer = [];
    860     _this.ids = 0;
    861     _this.acks = {};
    862     _this.flags = {};
    863     _this.io = io;
    864     _this.nsp = nsp;
    865     _this.ids = 0;
    866     _this.acks = {};
    867     _this.receiveBuffer = [];
    868     _this.sendBuffer = [];
    869     _this.connected = false;
    870     _this.disconnected = true;
    871     _this.flags = {};
    872 
    873     if (opts && opts.auth) {
    874       _this.auth = opts.auth;
    875     }
    876 
    877     if (_this.io._autoConnect) _this.open();
    878     return _this;
     325
     326  function url(uri) {
     327    var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
     328    var loc = arguments.length > 2 ? arguments[2] : undefined;
     329    var obj = uri; // default to window.location
     330
     331    loc = loc || typeof location !== "undefined" && location;
     332    if (null == uri) uri = loc.protocol + "//" + loc.host; // relative path support
     333
     334    if (typeof uri === "string") {
     335      if ("/" === uri.charAt(0)) {
     336        if ("/" === uri.charAt(1)) {
     337          uri = loc.protocol + uri;
     338        } else {
     339          uri = loc.host + uri;
     340        }
     341      }
     342
     343      if (!/^(https?|wss?):\/\//.test(uri)) {
     344        if ("undefined" !== typeof loc) {
     345          uri = loc.protocol + "//" + uri;
     346        } else {
     347          uri = "https://" + uri;
     348        }
     349      } // parse
     350
     351
     352      obj = parseuri(uri);
     353    } // make sure we treat `localhost:80` and `localhost` equally
     354
     355
     356    if (!obj.port) {
     357      if (/^(http|ws)$/.test(obj.protocol)) {
     358        obj.port = "80";
     359      } else if (/^(http|ws)s$/.test(obj.protocol)) {
     360        obj.port = "443";
     361      }
     362    }
     363
     364    obj.path = obj.path || "/";
     365    var ipv6 = obj.host.indexOf(":") !== -1;
     366    var host = ipv6 ? "[" + obj.host + "]" : obj.host; // define unique id
     367
     368    obj.id = obj.protocol + "://" + host + ":" + obj.port + path; // define href
     369
     370    obj.href = obj.protocol + "://" + host + (loc && loc.port === obj.port ? "" : ":" + obj.port);
     371    return obj;
    879372  }
     373
     374  var hasCors = {exports: {}};
     375
    880376  /**
    881    * Subscribe to open, close and packet events
     377   * Module exports.
    882378   *
    883    * @private
     379   * Logic borrowed from Modernizr:
     380   *
     381   *   - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
    884382   */
    885383
    886 
    887   _createClass(Socket, [{
    888     key: "subEvents",
    889     value: function subEvents() {
    890       if (this.subs) return;
    891       var io = this.io;
    892       this.subs = [on_1.on(io, "open", this.onopen.bind(this)), on_1.on(io, "packet", this.onpacket.bind(this)), on_1.on(io, "error", this.onerror.bind(this)), on_1.on(io, "close", this.onclose.bind(this))];
    893     }
    894     /**
    895      * Whether the Socket will try to reconnect when its Manager connects or reconnects
    896      */
    897 
    898   }, {
    899     key: "connect",
    900 
    901     /**
    902      * "Opens" the socket.
    903      *
    904      * @public
    905      */
    906     value: function connect() {
    907       if (this.connected) return this;
    908       this.subEvents();
    909       if (!this.io["_reconnecting"]) this.io.open(); // ensure open
    910 
    911       if ("open" === this.io._readyState) this.onopen();
    912       return this;
    913     }
    914     /**
    915      * Alias for connect()
    916      */
    917 
    918   }, {
    919     key: "open",
    920     value: function open() {
    921       return this.connect();
    922     }
    923     /**
    924      * Sends a `message` event.
    925      *
    926      * @return self
    927      * @public
    928      */
    929 
    930   }, {
    931     key: "send",
    932     value: function send() {
    933       for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    934         args[_key] = arguments[_key];
    935       }
    936 
    937       args.unshift("message");
    938       this.emit.apply(this, args);
    939       return this;
    940     }
    941     /**
    942      * Override `emit`.
    943      * If the event is in `events`, it's emitted normally.
    944      *
    945      * @param ev - event name
    946      * @return self
    947      * @public
    948      */
    949 
    950   }, {
    951     key: "emit",
    952     value: function emit(ev) {
    953       if (RESERVED_EVENTS.hasOwnProperty(ev)) {
    954         throw new Error('"' + ev + '" is a reserved event name');
    955       }
    956 
    957       for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
    958         args[_key2 - 1] = arguments[_key2];
    959       }
    960 
    961       args.unshift(ev);
    962       var packet = {
    963         type: socket_io_parser_1.PacketType.EVENT,
    964         data: args
    965       };
    966       packet.options = {};
    967       packet.options.compress = this.flags.compress !== false; // event ack callback
    968 
    969       if ("function" === typeof args[args.length - 1]) {
    970         debug("emitting packet with ack id %d", this.ids);
    971         this.acks[this.ids] = args.pop();
    972         packet.id = this.ids++;
    973       }
    974 
    975       var isTransportWritable = this.io.engine && this.io.engine.transport && this.io.engine.transport.writable;
    976       var discardPacket = this.flags["volatile"] && (!isTransportWritable || !this.connected);
    977 
    978       if (discardPacket) {
    979         debug("discard packet as the transport is not currently writable");
    980       } else if (this.connected) {
    981         this.packet(packet);
    982       } else {
    983         this.sendBuffer.push(packet);
    984       }
    985 
    986       this.flags = {};
    987       return this;
    988     }
    989     /**
    990      * Sends a packet.
    991      *
    992      * @param packet
    993      * @private
    994      */
    995 
    996   }, {
    997     key: "packet",
    998     value: function packet(_packet) {
    999       _packet.nsp = this.nsp;
    1000 
    1001       this.io._packet(_packet);
    1002     }
    1003     /**
    1004      * Called upon engine `open`.
    1005      *
    1006      * @private
    1007      */
    1008 
    1009   }, {
    1010     key: "onopen",
    1011     value: function onopen() {
    1012       var _this2 = this;
    1013 
    1014       debug("transport is open - connecting");
    1015 
    1016       if (typeof this.auth == "function") {
    1017         this.auth(function (data) {
    1018           _this2.packet({
    1019             type: socket_io_parser_1.PacketType.CONNECT,
    1020             data: data
    1021           });
    1022         });
    1023       } else {
    1024         this.packet({
    1025           type: socket_io_parser_1.PacketType.CONNECT,
    1026           data: this.auth
    1027         });
    1028       }
    1029     }
    1030     /**
    1031      * Called upon engine or manager `error`.
    1032      *
    1033      * @param err
    1034      * @private
    1035      */
    1036 
    1037   }, {
    1038     key: "onerror",
    1039     value: function onerror(err) {
    1040       if (!this.connected) {
    1041         _get(_getPrototypeOf(Socket.prototype), "emit", this).call(this, "connect_error", err);
    1042       }
    1043     }
    1044     /**
    1045      * Called upon engine `close`.
    1046      *
    1047      * @param reason
    1048      * @private
    1049      */
    1050 
    1051   }, {
    1052     key: "onclose",
    1053     value: function onclose(reason) {
    1054       debug("close (%s)", reason);
    1055       this.connected = false;
    1056       this.disconnected = true;
    1057       delete this.id;
    1058 
    1059       _get(_getPrototypeOf(Socket.prototype), "emit", this).call(this, "disconnect", reason);
    1060     }
    1061     /**
    1062      * Called with socket packet.
    1063      *
    1064      * @param packet
    1065      * @private
    1066      */
    1067 
    1068   }, {
    1069     key: "onpacket",
    1070     value: function onpacket(packet) {
    1071       var sameNamespace = packet.nsp === this.nsp;
    1072       if (!sameNamespace) return;
    1073 
    1074       switch (packet.type) {
    1075         case socket_io_parser_1.PacketType.CONNECT:
    1076           if (packet.data && packet.data.sid) {
    1077             var id = packet.data.sid;
    1078             this.onconnect(id);
    1079           } else {
    1080             _get(_getPrototypeOf(Socket.prototype), "emit", this).call(this, "connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
    1081           }
    1082 
    1083           break;
    1084 
    1085         case socket_io_parser_1.PacketType.EVENT:
    1086           this.onevent(packet);
    1087           break;
    1088 
    1089         case socket_io_parser_1.PacketType.BINARY_EVENT:
    1090           this.onevent(packet);
    1091           break;
    1092 
    1093         case socket_io_parser_1.PacketType.ACK:
    1094           this.onack(packet);
    1095           break;
    1096 
    1097         case socket_io_parser_1.PacketType.BINARY_ACK:
    1098           this.onack(packet);
    1099           break;
    1100 
    1101         case socket_io_parser_1.PacketType.DISCONNECT:
    1102           this.ondisconnect();
    1103           break;
    1104 
    1105         case socket_io_parser_1.PacketType.CONNECT_ERROR:
    1106           var err = new Error(packet.data.message); // @ts-ignore
    1107 
    1108           err.data = packet.data.data;
    1109 
    1110           _get(_getPrototypeOf(Socket.prototype), "emit", this).call(this, "connect_error", err);
    1111 
    1112           break;
    1113       }
    1114     }
    1115     /**
    1116      * Called upon a server event.
    1117      *
    1118      * @param packet
    1119      * @private
    1120      */
    1121 
    1122   }, {
    1123     key: "onevent",
    1124     value: function onevent(packet) {
    1125       var args = packet.data || [];
    1126       debug("emitting event %j", args);
    1127 
    1128       if (null != packet.id) {
    1129         debug("attaching ack callback to event");
    1130         args.push(this.ack(packet.id));
    1131       }
    1132 
    1133       if (this.connected) {
    1134         this.emitEvent(args);
    1135       } else {
    1136         this.receiveBuffer.push(Object.freeze(args));
    1137       }
    1138     }
    1139   }, {
    1140     key: "emitEvent",
    1141     value: function emitEvent(args) {
    1142       if (this._anyListeners && this._anyListeners.length) {
    1143         var listeners = this._anyListeners.slice();
    1144 
    1145         var _iterator = _createForOfIteratorHelper(listeners),
    1146             _step;
    1147 
    1148         try {
    1149           for (_iterator.s(); !(_step = _iterator.n()).done;) {
    1150             var listener = _step.value;
    1151             listener.apply(this, args);
    1152           }
    1153         } catch (err) {
    1154           _iterator.e(err);
    1155         } finally {
    1156           _iterator.f();
    1157         }
    1158       }
    1159 
    1160       _get(_getPrototypeOf(Socket.prototype), "emit", this).apply(this, args);
    1161     }
    1162     /**
    1163      * Produces an ack callback to emit with an event.
    1164      *
    1165      * @private
    1166      */
    1167 
    1168   }, {
    1169     key: "ack",
    1170     value: function ack(id) {
    1171       var self = this;
    1172       var sent = false;
    1173       return function () {
    1174         // prevent double callbacks
    1175         if (sent) return;
    1176         sent = true;
    1177 
    1178         for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
    1179           args[_key3] = arguments[_key3];
    1180         }
    1181 
    1182         debug("sending ack %j", args);
    1183         self.packet({
    1184           type: socket_io_parser_1.PacketType.ACK,
    1185           id: id,
    1186           data: args
    1187         });
    1188       };
    1189     }
    1190     /**
    1191      * Called upon a server acknowlegement.
    1192      *
    1193      * @param packet
    1194      * @private
    1195      */
    1196 
    1197   }, {
    1198     key: "onack",
    1199     value: function onack(packet) {
    1200       var ack = this.acks[packet.id];
    1201 
    1202       if ("function" === typeof ack) {
    1203         debug("calling ack %s with %j", packet.id, packet.data);
    1204         ack.apply(this, packet.data);
    1205         delete this.acks[packet.id];
    1206       } else {
    1207         debug("bad ack %s", packet.id);
    1208       }
    1209     }
    1210     /**
    1211      * Called upon server connect.
    1212      *
    1213      * @private
    1214      */
    1215 
    1216   }, {
    1217     key: "onconnect",
    1218     value: function onconnect(id) {
    1219       debug("socket connected with id %s", id);
    1220       this.id = id;
    1221       this.connected = true;
    1222       this.disconnected = false;
    1223 
    1224       _get(_getPrototypeOf(Socket.prototype), "emit", this).call(this, "connect");
    1225 
    1226       this.emitBuffered();
    1227     }
    1228     /**
    1229      * Emit buffered events (received and emitted).
    1230      *
    1231      * @private
    1232      */
    1233 
    1234   }, {
    1235     key: "emitBuffered",
    1236     value: function emitBuffered() {
    1237       var _this3 = this;
    1238 
    1239       this.receiveBuffer.forEach(function (args) {
    1240         return _this3.emitEvent(args);
    1241       });
    1242       this.receiveBuffer = [];
    1243       this.sendBuffer.forEach(function (packet) {
    1244         return _this3.packet(packet);
    1245       });
    1246       this.sendBuffer = [];
    1247     }
    1248     /**
    1249      * Called upon server disconnect.
    1250      *
    1251      * @private
    1252      */
    1253 
    1254   }, {
    1255     key: "ondisconnect",
    1256     value: function ondisconnect() {
    1257       debug("server disconnect (%s)", this.nsp);
    1258       this.destroy();
    1259       this.onclose("io server disconnect");
    1260     }
    1261     /**
    1262      * Called upon forced client/server side disconnections,
    1263      * this method ensures the manager stops tracking us and
    1264      * that reconnections don't get triggered for this.
    1265      *
    1266      * @private
    1267      */
    1268 
    1269   }, {
    1270     key: "destroy",
    1271     value: function destroy() {
    1272       if (this.subs) {
    1273         // clean subscriptions to avoid reconnections
    1274         this.subs.forEach(function (subDestroy) {
    1275           return subDestroy();
    1276         });
    1277         this.subs = undefined;
    1278       }
    1279 
    1280       this.io["_destroy"](this);
    1281     }
    1282     /**
    1283      * Disconnects the socket manually.
    1284      *
    1285      * @return self
    1286      * @public
    1287      */
    1288 
    1289   }, {
    1290     key: "disconnect",
    1291     value: function disconnect() {
    1292       if (this.connected) {
    1293         debug("performing disconnect (%s)", this.nsp);
    1294         this.packet({
    1295           type: socket_io_parser_1.PacketType.DISCONNECT
    1296         });
    1297       } // remove socket from pool
    1298 
    1299 
    1300       this.destroy();
    1301 
    1302       if (this.connected) {
    1303         // fire events
    1304         this.onclose("io client disconnect");
    1305       }
    1306 
    1307       return this;
    1308     }
    1309     /**
    1310      * Alias for disconnect()
    1311      *
    1312      * @return self
    1313      * @public
    1314      */
    1315 
    1316   }, {
    1317     key: "close",
    1318     value: function close() {
    1319       return this.disconnect();
    1320     }
    1321     /**
    1322      * Sets the compress flag.
    1323      *
    1324      * @param compress - if `true`, compresses the sending data
    1325      * @return self
    1326      * @public
    1327      */
    1328 
    1329   }, {
    1330     key: "compress",
    1331     value: function compress(_compress) {
    1332       this.flags.compress = _compress;
    1333       return this;
    1334     }
    1335     /**
    1336      * Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not
    1337      * ready to send messages.
    1338      *
    1339      * @returns self
    1340      * @public
    1341      */
    1342 
    1343   }, {
    1344     key: "onAny",
    1345 
    1346     /**
    1347      * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
    1348      * callback.
    1349      *
    1350      * @param listener
    1351      * @public
    1352      */
    1353     value: function onAny(listener) {
    1354       this._anyListeners = this._anyListeners || [];
    1355 
    1356       this._anyListeners.push(listener);
    1357 
    1358       return this;
    1359     }
    1360     /**
    1361      * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
    1362      * callback. The listener is added to the beginning of the listeners array.
    1363      *
    1364      * @param listener
    1365      * @public
    1366      */
    1367 
    1368   }, {
    1369     key: "prependAny",
    1370     value: function prependAny(listener) {
    1371       this._anyListeners = this._anyListeners || [];
    1372 
    1373       this._anyListeners.unshift(listener);
    1374 
    1375       return this;
    1376     }
    1377     /**
    1378      * Removes the listener that will be fired when any event is emitted.
    1379      *
    1380      * @param listener
    1381      * @public
    1382      */
    1383 
    1384   }, {
    1385     key: "offAny",
    1386     value: function offAny(listener) {
    1387       if (!this._anyListeners) {
    1388         return this;
    1389       }
    1390 
    1391       if (listener) {
    1392         var listeners = this._anyListeners;
    1393 
    1394         for (var i = 0; i < listeners.length; i++) {
    1395           if (listener === listeners[i]) {
    1396             listeners.splice(i, 1);
    1397             return this;
    1398           }
    1399         }
    1400       } else {
    1401         this._anyListeners = [];
    1402       }
    1403 
    1404       return this;
    1405     }
    1406     /**
    1407      * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
    1408      * e.g. to remove listeners.
    1409      *
    1410      * @public
    1411      */
    1412 
    1413   }, {
    1414     key: "listenersAny",
    1415     value: function listenersAny() {
    1416       return this._anyListeners || [];
    1417     }
    1418   }, {
    1419     key: "active",
    1420     get: function get() {
    1421       return !!this.subs;
    1422     }
    1423   }, {
    1424     key: "volatile",
    1425     get: function get() {
    1426       this.flags["volatile"] = true;
    1427       return this;
    1428     }
    1429   }]);
    1430 
    1431   return Socket;
    1432 }(Emitter);
    1433 
    1434 exports.Socket = Socket;
    1435 
    1436 /***/ }),
    1437 
    1438 /***/ "./build/url.js":
    1439 /*!**********************!*\
    1440   !*** ./build/url.js ***!
    1441   \**********************/
    1442 /*! no static exports found */
    1443 /***/ (function(module, exports, __webpack_require__) {
    1444 
    1445 "use strict";
    1446 
    1447 
    1448 Object.defineProperty(exports, "__esModule", {
    1449   value: true
    1450 });
    1451 exports.url = void 0;
    1452 
    1453 var parseuri = __webpack_require__(/*! parseuri */ "./node_modules/parseuri/index.js");
    1454 
    1455 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("socket.io-client:url");
    1456 /**
    1457  * URL parser.
    1458  *
    1459  * @param uri - url
    1460  * @param path - the request path of the connection
    1461  * @param loc - An object meant to mimic window.location.
    1462  *        Defaults to window.location.
    1463  * @public
    1464  */
    1465 
    1466 
    1467 function url(uri) {
    1468   var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
    1469   var loc = arguments.length > 2 ? arguments[2] : undefined;
    1470   var obj = uri; // default to window.location
    1471 
    1472   loc = loc || typeof location !== "undefined" && location;
    1473   if (null == uri) uri = loc.protocol + "//" + loc.host; // relative path support
    1474 
    1475   if (typeof uri === "string") {
    1476     if ("/" === uri.charAt(0)) {
    1477       if ("/" === uri.charAt(1)) {
    1478         uri = loc.protocol + uri;
    1479       } else {
    1480         uri = loc.host + uri;
    1481       }
    1482     }
    1483 
    1484     if (!/^(https?|wss?):\/\//.test(uri)) {
    1485       debug("protocol-less url %s", uri);
    1486 
    1487       if ("undefined" !== typeof loc) {
    1488         uri = loc.protocol + "//" + uri;
    1489       } else {
    1490         uri = "https://" + uri;
    1491       }
    1492     } // parse
    1493 
    1494 
    1495     debug("parse %s", uri);
    1496     obj = parseuri(uri);
    1497   } // make sure we treat `localhost:80` and `localhost` equally
    1498 
    1499 
    1500   if (!obj.port) {
    1501     if (/^(http|ws)$/.test(obj.protocol)) {
    1502       obj.port = "80";
    1503     } else if (/^(http|ws)s$/.test(obj.protocol)) {
    1504       obj.port = "443";
    1505     }
     384  try {
     385    hasCors.exports = typeof XMLHttpRequest !== 'undefined' && 'withCredentials' in new XMLHttpRequest();
     386  } catch (err) {
     387    // if XMLHttp support is disabled in IE then it will throw
     388    // when trying to create
     389    hasCors.exports = false;
    1506390  }
    1507391
    1508   obj.path = obj.path || "/";
    1509   var ipv6 = obj.host.indexOf(":") !== -1;
    1510   var host = ipv6 ? "[" + obj.host + "]" : obj.host; // define unique id
    1511 
    1512   obj.id = obj.protocol + "://" + host + ":" + obj.port + path; // define href
    1513 
    1514   obj.href = obj.protocol + "://" + host + (loc && loc.port === obj.port ? "" : ":" + obj.port);
    1515   return obj;
    1516 }
    1517 
    1518 exports.url = url;
    1519 
    1520 /***/ }),
    1521 
    1522 /***/ "./node_modules/backo2/index.js":
    1523 /*!**************************************!*\
    1524   !*** ./node_modules/backo2/index.js ***!
    1525   \**************************************/
    1526 /*! no static exports found */
    1527 /***/ (function(module, exports) {
    1528 
    1529 /**
    1530  * Expose `Backoff`.
    1531  */
    1532 module.exports = Backoff;
    1533 /**
    1534  * Initialize backoff timer with `opts`.
    1535  *
    1536  * - `min` initial timeout in milliseconds [100]
    1537  * - `max` max timeout [10000]
    1538  * - `jitter` [0]
    1539  * - `factor` [2]
    1540  *
    1541  * @param {Object} opts
    1542  * @api public
    1543  */
    1544 
    1545 function Backoff(opts) {
    1546   opts = opts || {};
    1547   this.ms = opts.min || 100;
    1548   this.max = opts.max || 10000;
    1549   this.factor = opts.factor || 2;
    1550   this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
    1551   this.attempts = 0;
    1552 }
    1553 /**
    1554  * Return the backoff duration.
    1555  *
    1556  * @return {Number}
    1557  * @api public
    1558  */
    1559 
    1560 
    1561 Backoff.prototype.duration = function () {
    1562   var ms = this.ms * Math.pow(this.factor, this.attempts++);
    1563 
    1564   if (this.jitter) {
    1565     var rand = Math.random();
    1566     var deviation = Math.floor(rand * this.jitter * ms);
    1567     ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
     392  var hasCORS = hasCors.exports;
     393
     394  var globalThis = (function () {
     395    if (typeof self !== "undefined") {
     396      return self;
     397    } else if (typeof window !== "undefined") {
     398      return window;
     399    } else {
     400      return Function("return this")();
     401    }
     402  })();
     403
     404  // browser shim for xmlhttprequest module
     405  function XMLHttpRequest$1 (opts) {
     406    var xdomain = opts.xdomain; // XMLHttpRequest can be disabled on IE
     407
     408    try {
     409      if ("undefined" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
     410        return new XMLHttpRequest();
     411      }
     412    } catch (e) {}
     413
     414    if (!xdomain) {
     415      try {
     416        return new globalThis[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
     417      } catch (e) {}
     418    }
    1568419  }
    1569420
    1570   return Math.min(ms, this.max) | 0;
    1571 };
    1572 /**
    1573  * Reset the number of attempts.
    1574  *
    1575  * @api public
    1576  */
    1577 
    1578 
    1579 Backoff.prototype.reset = function () {
    1580   this.attempts = 0;
    1581 };
    1582 /**
    1583  * Set the minimum duration
    1584  *
    1585  * @api public
    1586  */
    1587 
    1588 
    1589 Backoff.prototype.setMin = function (min) {
    1590   this.ms = min;
    1591 };
    1592 /**
    1593  * Set the maximum duration
    1594  *
    1595  * @api public
    1596  */
    1597 
    1598 
    1599 Backoff.prototype.setMax = function (max) {
    1600   this.max = max;
    1601 };
    1602 /**
    1603  * Set the jitter
    1604  *
    1605  * @api public
    1606  */
    1607 
    1608 
    1609 Backoff.prototype.setJitter = function (jitter) {
    1610   this.jitter = jitter;
    1611 };
    1612 
    1613 /***/ }),
    1614 
    1615 /***/ "./node_modules/component-emitter/index.js":
    1616 /*!*************************************************!*\
    1617   !*** ./node_modules/component-emitter/index.js ***!
    1618   \*************************************************/
    1619 /*! no static exports found */
    1620 /***/ (function(module, exports, __webpack_require__) {
    1621 
    1622 /**
    1623  * Expose `Emitter`.
    1624  */
    1625 if (true) {
    1626   module.exports = Emitter;
    1627 }
    1628 /**
    1629  * Initialize a new `Emitter`.
    1630  *
    1631  * @api public
    1632  */
    1633 
    1634 
    1635 function Emitter(obj) {
    1636   if (obj) return mixin(obj);
    1637 }
    1638 
    1639 ;
    1640 /**
    1641  * Mixin the emitter properties.
    1642  *
    1643  * @param {Object} obj
    1644  * @return {Object}
    1645  * @api private
    1646  */
    1647 
    1648 function mixin(obj) {
    1649   for (var key in Emitter.prototype) {
    1650     obj[key] = Emitter.prototype[key];
     421  function pick(obj) {
     422    for (var _len = arguments.length, attr = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
     423      attr[_key - 1] = arguments[_key];
     424    }
     425
     426    return attr.reduce(function (acc, k) {
     427      if (obj.hasOwnProperty(k)) {
     428        acc[k] = obj[k];
     429      }
     430
     431      return acc;
     432    }, {});
     433  } // Keep a reference to the real timeout functions so they can be used when overridden
     434
     435  var NATIVE_SET_TIMEOUT = setTimeout;
     436  var NATIVE_CLEAR_TIMEOUT = clearTimeout;
     437  function installTimerFunctions(obj, opts) {
     438    if (opts.useNativeTimers) {
     439      obj.setTimeoutFn = NATIVE_SET_TIMEOUT.bind(globalThis);
     440      obj.clearTimeoutFn = NATIVE_CLEAR_TIMEOUT.bind(globalThis);
     441    } else {
     442      obj.setTimeoutFn = setTimeout.bind(globalThis);
     443      obj.clearTimeoutFn = clearTimeout.bind(globalThis);
     444    }
    1651445  }
    1652446
    1653   return obj;
    1654 }
    1655 /**
    1656  * Listen on the given `event` with `fn`.
    1657  *
    1658  * @param {String} event
    1659  * @param {Function} fn
    1660  * @return {Emitter}
    1661  * @api public
    1662  */
    1663 
    1664 
    1665 Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
    1666   this._callbacks = this._callbacks || {};
    1667   (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
    1668   return this;
    1669 };
    1670 /**
    1671  * Adds an `event` listener that will be invoked a single
    1672  * time then automatically removed.
    1673  *
    1674  * @param {String} event
    1675  * @param {Function} fn
    1676  * @return {Emitter}
    1677  * @api public
    1678  */
    1679 
    1680 
    1681 Emitter.prototype.once = function (event, fn) {
    1682   function on() {
    1683     this.off(event, on);
    1684     fn.apply(this, arguments);
    1685   }
    1686 
    1687   on.fn = fn;
    1688   this.on(event, on);
    1689   return this;
    1690 };
    1691 /**
    1692  * Remove the given callback for `event` or all
    1693  * registered callbacks.
    1694  *
    1695  * @param {String} event
    1696  * @param {Function} fn
    1697  * @return {Emitter}
    1698  * @api public
    1699  */
    1700 
    1701 
    1702 Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
    1703   this._callbacks = this._callbacks || {}; // all
    1704 
    1705   if (0 == arguments.length) {
    1706     this._callbacks = {};
    1707     return this;
    1708   } // specific event
    1709 
    1710 
    1711   var callbacks = this._callbacks['$' + event];
    1712   if (!callbacks) return this; // remove all handlers
    1713 
    1714   if (1 == arguments.length) {
    1715     delete this._callbacks['$' + event];
    1716     return this;
    1717   } // remove specific handler
    1718 
    1719 
    1720   var cb;
    1721 
    1722   for (var i = 0; i < callbacks.length; i++) {
    1723     cb = callbacks[i];
    1724 
    1725     if (cb === fn || cb.fn === fn) {
    1726       callbacks.splice(i, 1);
    1727       break;
    1728     }
    1729   } // Remove event specific arrays for event types that no
    1730   // one is subscribed for to avoid memory leak.
    1731 
    1732 
    1733   if (callbacks.length === 0) {
    1734     delete this._callbacks['$' + event];
    1735   }
    1736 
    1737   return this;
    1738 };
    1739 /**
    1740  * Emit `event` with the given args.
    1741  *
    1742  * @param {String} event
    1743  * @param {Mixed} ...
    1744  * @return {Emitter}
    1745  */
    1746 
    1747 
    1748 Emitter.prototype.emit = function (event) {
    1749   this._callbacks = this._callbacks || {};
    1750   var args = new Array(arguments.length - 1),
    1751       callbacks = this._callbacks['$' + event];
    1752 
    1753   for (var i = 1; i < arguments.length; i++) {
    1754     args[i - 1] = arguments[i];
    1755   }
    1756 
    1757   if (callbacks) {
    1758     callbacks = callbacks.slice(0);
    1759 
    1760     for (var i = 0, len = callbacks.length; i < len; ++i) {
    1761       callbacks[i].apply(this, args);
    1762     }
    1763   }
    1764 
    1765   return this;
    1766 };
    1767 /**
    1768  * Return array of callbacks for `event`.
    1769  *
    1770  * @param {String} event
    1771  * @return {Array}
    1772  * @api public
    1773  */
    1774 
    1775 
    1776 Emitter.prototype.listeners = function (event) {
    1777   this._callbacks = this._callbacks || {};
    1778   return this._callbacks['$' + event] || [];
    1779 };
    1780 /**
    1781  * Check if this emitter has `event` handlers.
    1782  *
    1783  * @param {String} event
    1784  * @return {Boolean}
    1785  * @api public
    1786  */
    1787 
    1788 
    1789 Emitter.prototype.hasListeners = function (event) {
    1790   return !!this.listeners(event).length;
    1791 };
    1792 
    1793 /***/ }),
    1794 
    1795 /***/ "./node_modules/debug/src/browser.js":
    1796 /*!*******************************************!*\
    1797   !*** ./node_modules/debug/src/browser.js ***!
    1798   \*******************************************/
    1799 /*! no static exports found */
    1800 /***/ (function(module, exports, __webpack_require__) {
    1801 
    1802 /* eslint-env browser */
    1803 
    1804 /**
    1805  * This is the web browser implementation of `debug()`.
    1806  */
    1807 exports.formatArgs = formatArgs;
    1808 exports.save = save;
    1809 exports.load = load;
    1810 exports.useColors = useColors;
    1811 exports.storage = localstorage();
    1812 
    1813 exports.destroy = function () {
    1814   var warned = false;
    1815   return function () {
    1816     if (!warned) {
    1817       warned = true;
    1818       console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
    1819     }
    1820   };
    1821 }();
    1822 /**
    1823  * Colors.
    1824  */
    1825 
    1826 
    1827 exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
    1828 /**
    1829  * Currently only WebKit-based Web Inspectors, Firefox >= v31,
    1830  * and the Firebug extension (any Firefox version) are known
    1831  * to support "%c" CSS customizations.
    1832  *
    1833  * TODO: add a `localStorage` variable to explicitly enable/disable colors
    1834  */
    1835 // eslint-disable-next-line complexity
    1836 
    1837 function useColors() {
    1838   // NB: In an Electron preload script, document will be defined but not fully
    1839   // initialized. Since we know we're in Chrome, we'll just detect this case
    1840   // explicitly
    1841   if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
    1842     return true;
    1843   } // Internet Explorer and Edge do not support colors.
    1844 
    1845 
    1846   if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
    1847     return false;
    1848   } // Is webkit? http://stackoverflow.com/a/16459606/376773
    1849   // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
    1850 
    1851 
    1852   return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
    1853   typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
    1854   // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
    1855   typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
    1856   typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
    1857 }
    1858 /**
    1859  * Colorize log arguments if enabled.
    1860  *
    1861  * @api public
    1862  */
    1863 
    1864 
    1865 function formatArgs(args) {
    1866   args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
    1867 
    1868   if (!this.useColors) {
    1869     return;
    1870   }
    1871 
    1872   var c = 'color: ' + this.color;
    1873   args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
    1874   // arguments passed either before or after the %c, so we need to
    1875   // figure out the correct index to insert the CSS into
    1876 
    1877   var index = 0;
    1878   var lastC = 0;
    1879   args[0].replace(/%[a-zA-Z%]/g, function (match) {
    1880     if (match === '%%') {
    1881       return;
    1882     }
    1883 
    1884     index++;
    1885 
    1886     if (match === '%c') {
    1887       // We only are interested in the *last* %c
    1888       // (the user may have provided their own)
    1889       lastC = index;
    1890     }
    1891   });
    1892   args.splice(lastC, 0, c);
    1893 }
    1894 /**
    1895  * Invokes `console.debug()` when available.
    1896  * No-op when `console.debug` is not a "function".
    1897  * If `console.debug` is not available, falls back
    1898  * to `console.log`.
    1899  *
    1900  * @api public
    1901  */
    1902 
    1903 
    1904 exports.log = console.debug || console.log || function () {};
    1905 /**
    1906  * Save `namespaces`.
    1907  *
    1908  * @param {String} namespaces
    1909  * @api private
    1910  */
    1911 
    1912 
    1913 function save(namespaces) {
    1914   try {
    1915     if (namespaces) {
    1916       exports.storage.setItem('debug', namespaces);
    1917     } else {
    1918       exports.storage.removeItem('debug');
    1919     }
    1920   } catch (error) {// Swallow
    1921     // XXX (@Qix-) should we be logging these?
    1922   }
    1923 }
    1924 /**
    1925  * Load `namespaces`.
    1926  *
    1927  * @return {String} returns the previously persisted debug modes
    1928  * @api private
    1929  */
    1930 
    1931 
    1932 function load() {
    1933   var r;
    1934 
    1935   try {
    1936     r = exports.storage.getItem('debug');
    1937   } catch (error) {// Swallow
    1938     // XXX (@Qix-) should we be logging these?
    1939   } // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
    1940 
    1941 
    1942   if (!r && typeof process !== 'undefined' && 'env' in process) {
    1943     r = process.env.DEBUG;
    1944   }
    1945 
    1946   return r;
    1947 }
    1948 /**
    1949  * Localstorage attempts to return the localstorage.
    1950  *
    1951  * This is necessary because safari throws
    1952  * when a user disables cookies/localstorage
    1953  * and you attempt to access it.
    1954  *
    1955  * @return {LocalStorage}
    1956  * @api private
    1957  */
    1958 
    1959 
    1960 function localstorage() {
    1961   try {
    1962     // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
    1963     // The Browser also has localStorage in the global context.
    1964     return localStorage;
    1965   } catch (error) {// Swallow
    1966     // XXX (@Qix-) should we be logging these?
    1967   }
    1968 }
    1969 
    1970 module.exports = __webpack_require__(/*! ./common */ "./node_modules/debug/src/common.js")(exports);
    1971 var formatters = module.exports.formatters;
    1972 /**
    1973  * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
    1974  */
    1975 
    1976 formatters.j = function (v) {
    1977   try {
    1978     return JSON.stringify(v);
    1979   } catch (error) {
    1980     return '[UnexpectedJSONParseError]: ' + error.message;
    1981   }
    1982 };
    1983 
    1984 /***/ }),
    1985 
    1986 /***/ "./node_modules/debug/src/common.js":
    1987 /*!******************************************!*\
    1988   !*** ./node_modules/debug/src/common.js ***!
    1989   \******************************************/
    1990 /*! no static exports found */
    1991 /***/ (function(module, exports, __webpack_require__) {
    1992 
    1993 function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
    1994 
    1995 function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
    1996 
    1997 function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
    1998 
    1999 function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
    2000 
    2001 function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
    2002 
    2003 function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
    2004 
    2005 /**
    2006  * This is the common logic for both the Node.js and web browser
    2007  * implementations of `debug()`.
    2008  */
    2009 function setup(env) {
    2010   createDebug.debug = createDebug;
    2011   createDebug["default"] = createDebug;
    2012   createDebug.coerce = coerce;
    2013   createDebug.disable = disable;
    2014   createDebug.enable = enable;
    2015   createDebug.enabled = enabled;
    2016   createDebug.humanize = __webpack_require__(/*! ms */ "./node_modules/ms/index.js");
    2017   createDebug.destroy = destroy;
    2018   Object.keys(env).forEach(function (key) {
    2019     createDebug[key] = env[key];
    2020   });
    2021447  /**
    2022   * The currently active debug mode names, and names to skip.
    2023   */
    2024 
    2025   createDebug.names = [];
    2026   createDebug.skips = [];
     448   * Expose `Emitter`.
     449   */
     450
     451  var Emitter_1 = Emitter;
    2027452  /**
    2028   * Map of special "%n" handling functions, for the debug "format" argument.
    2029   *
    2030   * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
    2031   */
    2032 
    2033   createDebug.formatters = {};
    2034   /**
    2035   * Selects a color for a debug namespace
    2036   * @param {String} namespace The namespace string for the for the debug instance to be colored
    2037   * @return {Number|String} An ANSI color code for the given namespace
    2038   * @api private
    2039   */
    2040 
    2041   function selectColor(namespace) {
    2042     var hash = 0;
    2043 
    2044     for (var i = 0; i < namespace.length; i++) {
    2045       hash = (hash << 5) - hash + namespace.charCodeAt(i);
    2046       hash |= 0; // Convert to 32bit integer
    2047     }
    2048 
    2049     return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
    2050   }
    2051 
    2052   createDebug.selectColor = selectColor;
    2053   /**
    2054   * Create a debugger with the given `namespace`.
    2055   *
    2056   * @param {String} namespace
    2057   * @return {Function}
    2058   * @api public
    2059   */
    2060 
    2061   function createDebug(namespace) {
    2062     var prevTime;
    2063     var enableOverride = null;
    2064 
    2065     function debug() {
    2066       for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    2067         args[_key] = arguments[_key];
    2068       }
    2069 
    2070       // Disabled?
    2071       if (!debug.enabled) {
    2072         return;
    2073       }
    2074 
    2075       var self = debug; // Set `diff` timestamp
    2076 
    2077       var curr = Number(new Date());
    2078       var ms = curr - (prevTime || curr);
    2079       self.diff = ms;
    2080       self.prev = prevTime;
    2081       self.curr = curr;
    2082       prevTime = curr;
    2083       args[0] = createDebug.coerce(args[0]);
    2084 
    2085       if (typeof args[0] !== 'string') {
    2086         // Anything else let's inspect with %O
    2087         args.unshift('%O');
    2088       } // Apply any `formatters` transformations
    2089 
    2090 
    2091       var index = 0;
    2092       args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
    2093         // If we encounter an escaped % then don't increase the array index
    2094         if (match === '%%') {
    2095           return '%';
    2096         }
    2097 
    2098         index++;
    2099         var formatter = createDebug.formatters[format];
    2100 
    2101         if (typeof formatter === 'function') {
    2102           var val = args[index];
    2103           match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
    2104 
    2105           args.splice(index, 1);
    2106           index--;
    2107         }
    2108 
    2109         return match;
    2110       }); // Apply env-specific formatting (colors, etc.)
    2111 
    2112       createDebug.formatArgs.call(self, args);
    2113       var logFn = self.log || createDebug.log;
    2114       logFn.apply(self, args);
    2115     }
    2116 
    2117     debug.namespace = namespace;
    2118     debug.useColors = createDebug.useColors();
    2119     debug.color = createDebug.selectColor(namespace);
    2120     debug.extend = extend;
    2121     debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
    2122 
    2123     Object.defineProperty(debug, 'enabled', {
    2124       enumerable: true,
    2125       configurable: false,
    2126       get: function get() {
    2127         return enableOverride === null ? createDebug.enabled(namespace) : enableOverride;
    2128       },
    2129       set: function set(v) {
    2130         enableOverride = v;
    2131       }
    2132     }); // Env-specific initialization logic for debug instances
    2133 
    2134     if (typeof createDebug.init === 'function') {
    2135       createDebug.init(debug);
    2136     }
    2137 
    2138     return debug;
    2139   }
    2140 
    2141   function extend(namespace, delimiter) {
    2142     var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
    2143     newDebug.log = this.log;
    2144     return newDebug;
    2145   }
    2146   /**
    2147   * Enables a debug mode by namespaces. This can include modes
    2148   * separated by a colon and wildcards.
    2149   *
    2150   * @param {String} namespaces
    2151   * @api public
    2152   */
    2153 
    2154 
    2155   function enable(namespaces) {
    2156     createDebug.save(namespaces);
    2157     createDebug.names = [];
    2158     createDebug.skips = [];
    2159     var i;
    2160     var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
    2161     var len = split.length;
    2162 
    2163     for (i = 0; i < len; i++) {
    2164       if (!split[i]) {
    2165         // ignore empty strings
    2166         continue;
    2167       }
    2168 
    2169       namespaces = split[i].replace(/\*/g, '.*?');
    2170 
    2171       if (namespaces[0] === '-') {
    2172         createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
    2173       } else {
    2174         createDebug.names.push(new RegExp('^' + namespaces + '$'));
    2175       }
    2176     }
    2177   }
    2178   /**
    2179   * Disable debug output.
    2180   *
    2181   * @return {String} namespaces
    2182   * @api public
    2183   */
    2184 
    2185 
    2186   function disable() {
    2187     var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {
    2188       return '-' + namespace;
    2189     }))).join(',');
    2190     createDebug.enable('');
    2191     return namespaces;
    2192   }
    2193   /**
    2194   * Returns true if the given mode name is enabled, false otherwise.
    2195   *
    2196   * @param {String} name
    2197   * @return {Boolean}
    2198   * @api public
    2199   */
    2200 
    2201 
    2202   function enabled(name) {
    2203     if (name[name.length - 1] === '*') {
    2204       return true;
    2205     }
    2206 
    2207     var i;
    2208     var len;
    2209 
    2210     for (i = 0, len = createDebug.skips.length; i < len; i++) {
    2211       if (createDebug.skips[i].test(name)) {
    2212         return false;
    2213       }
    2214     }
    2215 
    2216     for (i = 0, len = createDebug.names.length; i < len; i++) {
    2217       if (createDebug.names[i].test(name)) {
    2218         return true;
    2219       }
    2220     }
    2221 
    2222     return false;
    2223   }
    2224   /**
    2225   * Convert regexp to namespace
    2226   *
    2227   * @param {RegExp} regxep
    2228   * @return {String} namespace
    2229   * @api private
    2230   */
    2231 
    2232 
    2233   function toNamespace(regexp) {
    2234     return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
    2235   }
    2236   /**
    2237   * Coerce `val`.
    2238   *
    2239   * @param {Mixed} val
    2240   * @return {Mixed}
    2241   * @api private
    2242   */
    2243 
    2244 
    2245   function coerce(val) {
    2246     if (val instanceof Error) {
    2247       return val.stack || val.message;
    2248     }
    2249 
    2250     return val;
    2251   }
    2252   /**
    2253   * XXX DO NOT USE. This is a temporary stub function.
    2254   * XXX It WILL be removed in the next major release.
    2255   */
    2256 
    2257 
    2258   function destroy() {
    2259     console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
    2260   }
    2261 
    2262   createDebug.enable(createDebug.load());
    2263   return createDebug;
    2264 }
    2265 
    2266 module.exports = setup;
    2267 
    2268 /***/ }),
    2269 
    2270 /***/ "./node_modules/engine.io-client/lib/globalThis.browser.js":
    2271 /*!*****************************************************************!*\
    2272   !*** ./node_modules/engine.io-client/lib/globalThis.browser.js ***!
    2273   \*****************************************************************/
    2274 /*! no static exports found */
    2275 /***/ (function(module, exports) {
    2276 
    2277 module.exports = function () {
    2278   if (typeof self !== "undefined") {
    2279     return self;
    2280   } else if (typeof window !== "undefined") {
    2281     return window;
    2282   } else {
    2283     return Function("return this")();
    2284   }
    2285 }();
    2286 
    2287 /***/ }),
    2288 
    2289 /***/ "./node_modules/engine.io-client/lib/index.js":
    2290 /*!****************************************************!*\
    2291   !*** ./node_modules/engine.io-client/lib/index.js ***!
    2292   \****************************************************/
    2293 /*! no static exports found */
    2294 /***/ (function(module, exports, __webpack_require__) {
    2295 
    2296 var Socket = __webpack_require__(/*! ./socket */ "./node_modules/engine.io-client/lib/socket.js");
    2297 
    2298 module.exports = function (uri, opts) {
    2299   return new Socket(uri, opts);
    2300 };
    2301 /**
    2302  * Expose deps for legacy compatibility
    2303  * and standalone browser access.
    2304  */
    2305 
    2306 
    2307 module.exports.Socket = Socket;
    2308 module.exports.protocol = Socket.protocol; // this is an int
    2309 
    2310 module.exports.Transport = __webpack_require__(/*! ./transport */ "./node_modules/engine.io-client/lib/transport.js");
    2311 module.exports.transports = __webpack_require__(/*! ./transports/index */ "./node_modules/engine.io-client/lib/transports/index.js");
    2312 module.exports.parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/index.js");
    2313 
    2314 /***/ }),
    2315 
    2316 /***/ "./node_modules/engine.io-client/lib/socket.js":
    2317 /*!*****************************************************!*\
    2318   !*** ./node_modules/engine.io-client/lib/socket.js ***!
    2319   \*****************************************************/
    2320 /*! no static exports found */
    2321 /***/ (function(module, exports, __webpack_require__) {
    2322 
    2323 function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
    2324 
    2325 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    2326 
    2327 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    2328 
    2329 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    2330 
    2331 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    2332 
    2333 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    2334 
    2335 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    2336 
    2337 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    2338 
    2339 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    2340 
    2341 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    2342 
    2343 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    2344 
    2345 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    2346 
    2347 var transports = __webpack_require__(/*! ./transports/index */ "./node_modules/engine.io-client/lib/transports/index.js");
    2348 
    2349 var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
    2350 
    2351 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("engine.io-client:socket");
    2352 
    2353 var parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/index.js");
    2354 
    2355 var parseuri = __webpack_require__(/*! parseuri */ "./node_modules/parseuri/index.js");
    2356 
    2357 var parseqs = __webpack_require__(/*! parseqs */ "./node_modules/parseqs/index.js");
    2358 
    2359 var Socket = /*#__PURE__*/function (_Emitter) {
    2360   _inherits(Socket, _Emitter);
    2361 
    2362   var _super = _createSuper(Socket);
    2363 
    2364   /**
    2365    * Socket constructor.
    2366    *
    2367    * @param {String|Object} uri or options
    2368    * @param {Object} options
    2369    * @api public
    2370    */
    2371   function Socket(uri) {
    2372     var _this;
    2373 
    2374     var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    2375 
    2376     _classCallCheck(this, Socket);
    2377 
    2378     _this = _super.call(this);
    2379 
    2380     if (uri && "object" === _typeof(uri)) {
    2381       opts = uri;
    2382       uri = null;
    2383     }
    2384 
    2385     if (uri) {
    2386       uri = parseuri(uri);
    2387       opts.hostname = uri.host;
    2388       opts.secure = uri.protocol === "https" || uri.protocol === "wss";
    2389       opts.port = uri.port;
    2390       if (uri.query) opts.query = uri.query;
    2391     } else if (opts.host) {
    2392       opts.hostname = parseuri(opts.host).host;
    2393     }
    2394 
    2395     _this.secure = null != opts.secure ? opts.secure : typeof location !== "undefined" && "https:" === location.protocol;
    2396 
    2397     if (opts.hostname && !opts.port) {
    2398       // if no port is specified manually, use the protocol default
    2399       opts.port = _this.secure ? "443" : "80";
    2400     }
    2401 
    2402     _this.hostname = opts.hostname || (typeof location !== "undefined" ? location.hostname : "localhost");
    2403     _this.port = opts.port || (typeof location !== "undefined" && location.port ? location.port : _this.secure ? 443 : 80);
    2404     _this.transports = opts.transports || ["polling", "websocket"];
    2405     _this.readyState = "";
    2406     _this.writeBuffer = [];
    2407     _this.prevBufferLen = 0;
    2408     _this.opts = _extends({
    2409       path: "/engine.io",
    2410       agent: false,
    2411       withCredentials: false,
    2412       upgrade: true,
    2413       jsonp: true,
    2414       timestampParam: "t",
    2415       rememberUpgrade: false,
    2416       rejectUnauthorized: true,
    2417       perMessageDeflate: {
    2418         threshold: 1024
    2419       },
    2420       transportOptions: {}
    2421     }, opts);
    2422     _this.opts.path = _this.opts.path.replace(/\/$/, "") + "/";
    2423 
    2424     if (typeof _this.opts.query === "string") {
    2425       _this.opts.query = parseqs.decode(_this.opts.query);
    2426     } // set on handshake
    2427 
    2428 
    2429     _this.id = null;
    2430     _this.upgrades = null;
    2431     _this.pingInterval = null;
    2432     _this.pingTimeout = null; // set on heartbeat
    2433 
    2434     _this.pingTimeoutTimer = null;
    2435 
    2436     if (typeof addEventListener === "function") {
    2437       addEventListener("beforeunload", function () {
    2438         if (_this.transport) {
    2439           // silently close the transport
    2440           _this.transport.removeAllListeners();
    2441 
    2442           _this.transport.close();
    2443         }
    2444       }, false);
    2445     }
    2446 
    2447     _this.open();
    2448 
    2449     return _this;
    2450   }
    2451   /**
    2452    * Creates transport of the given type.
    2453    *
    2454    * @param {String} transport name
    2455    * @return {Transport}
    2456    * @api private
    2457    */
    2458 
    2459 
    2460   _createClass(Socket, [{
    2461     key: "createTransport",
    2462     value: function createTransport(name) {
    2463       debug('creating transport "%s"', name);
    2464       var query = clone(this.opts.query); // append engine.io protocol identifier
    2465 
    2466       query.EIO = parser.protocol; // transport name
    2467 
    2468       query.transport = name; // session id if we already have one
    2469 
    2470       if (this.id) query.sid = this.id;
    2471 
    2472       var opts = _extends({}, this.opts.transportOptions[name], this.opts, {
    2473         query: query,
    2474         socket: this,
    2475         hostname: this.hostname,
    2476         secure: this.secure,
    2477         port: this.port
    2478       });
    2479 
    2480       debug("options: %j", opts);
    2481       return new transports[name](opts);
    2482     }
    2483     /**
    2484      * Initializes transport to use and starts probe.
    2485      *
    2486      * @api private
    2487      */
    2488 
    2489   }, {
    2490     key: "open",
    2491     value: function open() {
    2492       var transport;
    2493 
    2494       if (this.opts.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1) {
    2495         transport = "websocket";
    2496       } else if (0 === this.transports.length) {
    2497         // Emit error on next tick so it can be listened to
    2498         var self = this;
    2499         setTimeout(function () {
    2500           self.emit("error", "No transports available");
    2501         }, 0);
    2502         return;
    2503       } else {
    2504         transport = this.transports[0];
    2505       }
    2506 
    2507       this.readyState = "opening"; // Retry with the next transport if the transport is disabled (jsonp: false)
    2508 
    2509       try {
    2510         transport = this.createTransport(transport);
    2511       } catch (e) {
    2512         debug("error while creating transport: %s", e);
    2513         this.transports.shift();
    2514         this.open();
    2515         return;
    2516       }
    2517 
    2518       transport.open();
    2519       this.setTransport(transport);
    2520     }
    2521     /**
    2522      * Sets the current transport. Disables the existing one (if any).
    2523      *
    2524      * @api private
    2525      */
    2526 
    2527   }, {
    2528     key: "setTransport",
    2529     value: function setTransport(transport) {
    2530       debug("setting transport %s", transport.name);
    2531       var self = this;
    2532 
    2533       if (this.transport) {
    2534         debug("clearing existing transport %s", this.transport.name);
    2535         this.transport.removeAllListeners();
    2536       } // set up transport
    2537 
    2538 
    2539       this.transport = transport; // set up transport listeners
    2540 
    2541       transport.on("drain", function () {
    2542         self.onDrain();
    2543       }).on("packet", function (packet) {
    2544         self.onPacket(packet);
    2545       }).on("error", function (e) {
    2546         self.onError(e);
    2547       }).on("close", function () {
    2548         self.onClose("transport close");
    2549       });
    2550     }
    2551     /**
    2552      * Probes a transport.
    2553      *
    2554      * @param {String} transport name
    2555      * @api private
    2556      */
    2557 
    2558   }, {
    2559     key: "probe",
    2560     value: function probe(name) {
    2561       debug('probing transport "%s"', name);
    2562       var transport = this.createTransport(name, {
    2563         probe: 1
    2564       });
    2565       var failed = false;
    2566       var self = this;
    2567       Socket.priorWebsocketSuccess = false;
    2568 
    2569       function onTransportOpen() {
    2570         if (self.onlyBinaryUpgrades) {
    2571           var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;
    2572           failed = failed || upgradeLosesBinary;
    2573         }
    2574 
    2575         if (failed) return;
    2576         debug('probe transport "%s" opened', name);
    2577         transport.send([{
    2578           type: "ping",
    2579           data: "probe"
    2580         }]);
    2581         transport.once("packet", function (msg) {
    2582           if (failed) return;
    2583 
    2584           if ("pong" === msg.type && "probe" === msg.data) {
    2585             debug('probe transport "%s" pong', name);
    2586             self.upgrading = true;
    2587             self.emit("upgrading", transport);
    2588             if (!transport) return;
    2589             Socket.priorWebsocketSuccess = "websocket" === transport.name;
    2590             debug('pausing current transport "%s"', self.transport.name);
    2591             self.transport.pause(function () {
    2592               if (failed) return;
    2593               if ("closed" === self.readyState) return;
    2594               debug("changing transport and sending upgrade packet");
    2595               cleanup();
    2596               self.setTransport(transport);
    2597               transport.send([{
    2598                 type: "upgrade"
    2599               }]);
    2600               self.emit("upgrade", transport);
    2601               transport = null;
    2602               self.upgrading = false;
    2603               self.flush();
    2604             });
    2605           } else {
    2606             debug('probe transport "%s" failed', name);
    2607             var err = new Error("probe error");
    2608             err.transport = transport.name;
    2609             self.emit("upgradeError", err);
    2610           }
    2611         });
    2612       }
    2613 
    2614       function freezeTransport() {
    2615         if (failed) return; // Any callback called by transport should be ignored since now
    2616 
    2617         failed = true;
    2618         cleanup();
    2619         transport.close();
    2620         transport = null;
    2621       } // Handle any error that happens while probing
    2622 
    2623 
    2624       function onerror(err) {
    2625         var error = new Error("probe error: " + err);
    2626         error.transport = transport.name;
    2627         freezeTransport();
    2628         debug('probe transport "%s" failed because of error: %s', name, err);
    2629         self.emit("upgradeError", error);
    2630       }
    2631 
    2632       function onTransportClose() {
    2633         onerror("transport closed");
    2634       } // When the socket is closed while we're probing
    2635 
    2636 
    2637       function onclose() {
    2638         onerror("socket closed");
    2639       } // When the socket is upgraded while we're probing
    2640 
    2641 
    2642       function onupgrade(to) {
    2643         if (transport && to.name !== transport.name) {
    2644           debug('"%s" works - aborting "%s"', to.name, transport.name);
    2645           freezeTransport();
    2646         }
    2647       } // Remove all listeners on the transport and on self
    2648 
    2649 
    2650       function cleanup() {
    2651         transport.removeListener("open", onTransportOpen);
    2652         transport.removeListener("error", onerror);
    2653         transport.removeListener("close", onTransportClose);
    2654         self.removeListener("close", onclose);
    2655         self.removeListener("upgrading", onupgrade);
    2656       }
    2657 
    2658       transport.once("open", onTransportOpen);
    2659       transport.once("error", onerror);
    2660       transport.once("close", onTransportClose);
    2661       this.once("close", onclose);
    2662       this.once("upgrading", onupgrade);
    2663       transport.open();
    2664     }
    2665     /**
    2666      * Called when connection is deemed open.
    2667      *
    2668      * @api public
    2669      */
    2670 
    2671   }, {
    2672     key: "onOpen",
    2673     value: function onOpen() {
    2674       debug("socket open");
    2675       this.readyState = "open";
    2676       Socket.priorWebsocketSuccess = "websocket" === this.transport.name;
    2677       this.emit("open");
    2678       this.flush(); // we check for `readyState` in case an `open`
    2679       // listener already closed the socket
    2680 
    2681       if ("open" === this.readyState && this.opts.upgrade && this.transport.pause) {
    2682         debug("starting upgrade probes");
    2683         var i = 0;
    2684         var l = this.upgrades.length;
    2685 
    2686         for (; i < l; i++) {
    2687           this.probe(this.upgrades[i]);
    2688         }
    2689       }
    2690     }
    2691     /**
    2692      * Handles a packet.
    2693      *
    2694      * @api private
    2695      */
    2696 
    2697   }, {
    2698     key: "onPacket",
    2699     value: function onPacket(packet) {
    2700       if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) {
    2701         debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
    2702         this.emit("packet", packet); // Socket is live - any packet counts
    2703 
    2704         this.emit("heartbeat");
    2705 
    2706         switch (packet.type) {
    2707           case "open":
    2708             this.onHandshake(JSON.parse(packet.data));
    2709             break;
    2710 
    2711           case "ping":
    2712             this.resetPingTimeout();
    2713             this.sendPacket("pong");
    2714             this.emit("pong");
    2715             break;
    2716 
    2717           case "error":
    2718             var err = new Error("server error");
    2719             err.code = packet.data;
    2720             this.onError(err);
    2721             break;
    2722 
    2723           case "message":
    2724             this.emit("data", packet.data);
    2725             this.emit("message", packet.data);
    2726             break;
    2727         }
    2728       } else {
    2729         debug('packet received with socket readyState "%s"', this.readyState);
    2730       }
    2731     }
    2732     /**
    2733      * Called upon handshake completion.
    2734      *
    2735      * @param {Object} handshake obj
    2736      * @api private
    2737      */
    2738 
    2739   }, {
    2740     key: "onHandshake",
    2741     value: function onHandshake(data) {
    2742       this.emit("handshake", data);
    2743       this.id = data.sid;
    2744       this.transport.query.sid = data.sid;
    2745       this.upgrades = this.filterUpgrades(data.upgrades);
    2746       this.pingInterval = data.pingInterval;
    2747       this.pingTimeout = data.pingTimeout;
    2748       this.onOpen(); // In case open handler closes socket
    2749 
    2750       if ("closed" === this.readyState) return;
    2751       this.resetPingTimeout();
    2752     }
    2753     /**
    2754      * Sets and resets ping timeout timer based on server pings.
    2755      *
    2756      * @api private
    2757      */
    2758 
    2759   }, {
    2760     key: "resetPingTimeout",
    2761     value: function resetPingTimeout() {
    2762       var _this2 = this;
    2763 
    2764       clearTimeout(this.pingTimeoutTimer);
    2765       this.pingTimeoutTimer = setTimeout(function () {
    2766         _this2.onClose("ping timeout");
    2767       }, this.pingInterval + this.pingTimeout);
    2768     }
    2769     /**
    2770      * Called on `drain` event
    2771      *
    2772      * @api private
    2773      */
    2774 
    2775   }, {
    2776     key: "onDrain",
    2777     value: function onDrain() {
    2778       this.writeBuffer.splice(0, this.prevBufferLen); // setting prevBufferLen = 0 is very important
    2779       // for example, when upgrading, upgrade packet is sent over,
    2780       // and a nonzero prevBufferLen could cause problems on `drain`
    2781 
    2782       this.prevBufferLen = 0;
    2783 
    2784       if (0 === this.writeBuffer.length) {
    2785         this.emit("drain");
    2786       } else {
    2787         this.flush();
    2788       }
    2789     }
    2790     /**
    2791      * Flush write buffers.
    2792      *
    2793      * @api private
    2794      */
    2795 
    2796   }, {
    2797     key: "flush",
    2798     value: function flush() {
    2799       if ("closed" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) {
    2800         debug("flushing %d packets in socket", this.writeBuffer.length);
    2801         this.transport.send(this.writeBuffer); // keep track of current length of writeBuffer
    2802         // splice writeBuffer and callbackBuffer on `drain`
    2803 
    2804         this.prevBufferLen = this.writeBuffer.length;
    2805         this.emit("flush");
    2806       }
    2807     }
    2808     /**
    2809      * Sends a message.
    2810      *
    2811      * @param {String} message.
    2812      * @param {Function} callback function.
    2813      * @param {Object} options.
    2814      * @return {Socket} for chaining.
    2815      * @api public
    2816      */
    2817 
    2818   }, {
    2819     key: "write",
    2820     value: function write(msg, options, fn) {
    2821       this.sendPacket("message", msg, options, fn);
    2822       return this;
    2823     }
    2824   }, {
    2825     key: "send",
    2826     value: function send(msg, options, fn) {
    2827       this.sendPacket("message", msg, options, fn);
    2828       return this;
    2829     }
    2830     /**
    2831      * Sends a packet.
    2832      *
    2833      * @param {String} packet type.
    2834      * @param {String} data.
    2835      * @param {Object} options.
    2836      * @param {Function} callback function.
    2837      * @api private
    2838      */
    2839 
    2840   }, {
    2841     key: "sendPacket",
    2842     value: function sendPacket(type, data, options, fn) {
    2843       if ("function" === typeof data) {
    2844         fn = data;
    2845         data = undefined;
    2846       }
    2847 
    2848       if ("function" === typeof options) {
    2849         fn = options;
    2850         options = null;
    2851       }
    2852 
    2853       if ("closing" === this.readyState || "closed" === this.readyState) {
    2854         return;
    2855       }
    2856 
    2857       options = options || {};
    2858       options.compress = false !== options.compress;
    2859       var packet = {
    2860         type: type,
    2861         data: data,
    2862         options: options
    2863       };
    2864       this.emit("packetCreate", packet);
    2865       this.writeBuffer.push(packet);
    2866       if (fn) this.once("flush", fn);
    2867       this.flush();
    2868     }
    2869     /**
    2870      * Closes the connection.
    2871      *
    2872      * @api private
    2873      */
    2874 
    2875   }, {
    2876     key: "close",
    2877     value: function close() {
    2878       var self = this;
    2879 
    2880       if ("opening" === this.readyState || "open" === this.readyState) {
    2881         this.readyState = "closing";
    2882 
    2883         if (this.writeBuffer.length) {
    2884           this.once("drain", function () {
    2885             if (this.upgrading) {
    2886               waitForUpgrade();
    2887             } else {
    2888               close();
    2889             }
    2890           });
    2891         } else if (this.upgrading) {
    2892           waitForUpgrade();
    2893         } else {
    2894           close();
    2895         }
    2896       }
    2897 
    2898       function close() {
    2899         self.onClose("forced close");
    2900         debug("socket closing - telling transport to close");
    2901         self.transport.close();
    2902       }
    2903 
    2904       function cleanupAndClose() {
    2905         self.removeListener("upgrade", cleanupAndClose);
    2906         self.removeListener("upgradeError", cleanupAndClose);
    2907         close();
    2908       }
    2909 
    2910       function waitForUpgrade() {
    2911         // wait for upgrade to finish since we can't send packets while pausing a transport
    2912         self.once("upgrade", cleanupAndClose);
    2913         self.once("upgradeError", cleanupAndClose);
    2914       }
    2915 
    2916       return this;
    2917     }
    2918     /**
    2919      * Called upon transport error
    2920      *
    2921      * @api private
    2922      */
    2923 
    2924   }, {
    2925     key: "onError",
    2926     value: function onError(err) {
    2927       debug("socket error %j", err);
    2928       Socket.priorWebsocketSuccess = false;
    2929       this.emit("error", err);
    2930       this.onClose("transport error", err);
    2931     }
    2932     /**
    2933      * Called upon transport close.
    2934      *
    2935      * @api private
    2936      */
    2937 
    2938   }, {
    2939     key: "onClose",
    2940     value: function onClose(reason, desc) {
    2941       if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) {
    2942         debug('socket close with reason: "%s"', reason);
    2943         var self = this; // clear timers
    2944 
    2945         clearTimeout(this.pingIntervalTimer);
    2946         clearTimeout(this.pingTimeoutTimer); // stop event from firing again for transport
    2947 
    2948         this.transport.removeAllListeners("close"); // ensure transport won't stay open
    2949 
    2950         this.transport.close(); // ignore further transport communication
    2951 
    2952         this.transport.removeAllListeners(); // set ready state
    2953 
    2954         this.readyState = "closed"; // clear session id
    2955 
    2956         this.id = null; // emit close event
    2957 
    2958         this.emit("close", reason, desc); // clean buffers after, so users can still
    2959         // grab the buffers on `close` event
    2960 
    2961         self.writeBuffer = [];
    2962         self.prevBufferLen = 0;
    2963       }
    2964     }
    2965     /**
    2966      * Filters upgrades, returning only those matching client transports.
    2967      *
    2968      * @param {Array} server upgrades
    2969      * @api private
    2970      *
    2971      */
    2972 
    2973   }, {
    2974     key: "filterUpgrades",
    2975     value: function filterUpgrades(upgrades) {
    2976       var filteredUpgrades = [];
    2977       var i = 0;
    2978       var j = upgrades.length;
    2979 
    2980       for (; i < j; i++) {
    2981         if (~this.transports.indexOf(upgrades[i])) filteredUpgrades.push(upgrades[i]);
    2982       }
    2983 
    2984       return filteredUpgrades;
    2985     }
    2986   }]);
    2987 
    2988   return Socket;
    2989 }(Emitter);
    2990 
    2991 Socket.priorWebsocketSuccess = false;
    2992 /**
    2993  * Protocol version.
    2994  *
    2995  * @api public
    2996  */
    2997 
    2998 Socket.protocol = parser.protocol; // this is an int
    2999 
    3000 function clone(obj) {
    3001   var o = {};
    3002 
    3003   for (var i in obj) {
    3004     if (obj.hasOwnProperty(i)) {
    3005       o[i] = obj[i];
    3006     }
    3007   }
    3008 
    3009   return o;
    3010 }
    3011 
    3012 module.exports = Socket;
    3013 
    3014 /***/ }),
    3015 
    3016 /***/ "./node_modules/engine.io-client/lib/transport.js":
    3017 /*!********************************************************!*\
    3018   !*** ./node_modules/engine.io-client/lib/transport.js ***!
    3019   \********************************************************/
    3020 /*! no static exports found */
    3021 /***/ (function(module, exports, __webpack_require__) {
    3022 
    3023 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    3024 
    3025 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    3026 
    3027 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    3028 
    3029 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    3030 
    3031 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    3032 
    3033 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    3034 
    3035 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    3036 
    3037 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    3038 
    3039 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    3040 
    3041 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    3042 
    3043 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    3044 
    3045 var parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/index.js");
    3046 
    3047 var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
    3048 
    3049 var Transport = /*#__PURE__*/function (_Emitter) {
    3050   _inherits(Transport, _Emitter);
    3051 
    3052   var _super = _createSuper(Transport);
    3053 
    3054   /**
    3055    * Transport abstract constructor.
    3056    *
    3057    * @param {Object} options.
    3058    * @api private
    3059    */
    3060   function Transport(opts) {
    3061     var _this;
    3062 
    3063     _classCallCheck(this, Transport);
    3064 
    3065     _this = _super.call(this);
    3066     _this.opts = opts;
    3067     _this.query = opts.query;
    3068     _this.readyState = "";
    3069     _this.socket = opts.socket;
    3070     return _this;
    3071   }
    3072   /**
    3073    * Emits an error.
    3074    *
    3075    * @param {String} str
    3076    * @return {Transport} for chaining
    3077    * @api public
    3078    */
    3079 
    3080 
    3081   _createClass(Transport, [{
    3082     key: "onError",
    3083     value: function onError(msg, desc) {
    3084       var err = new Error(msg);
    3085       err.type = "TransportError";
    3086       err.description = desc;
    3087       this.emit("error", err);
    3088       return this;
    3089     }
    3090     /**
    3091      * Opens the transport.
    3092      *
    3093      * @api public
    3094      */
    3095 
    3096   }, {
    3097     key: "open",
    3098     value: function open() {
    3099       if ("closed" === this.readyState || "" === this.readyState) {
    3100         this.readyState = "opening";
    3101         this.doOpen();
    3102       }
    3103 
    3104       return this;
    3105     }
    3106     /**
    3107      * Closes the transport.
    3108      *
    3109      * @api private
    3110      */
    3111 
    3112   }, {
    3113     key: "close",
    3114     value: function close() {
    3115       if ("opening" === this.readyState || "open" === this.readyState) {
    3116         this.doClose();
    3117         this.onClose();
    3118       }
    3119 
    3120       return this;
    3121     }
    3122     /**
    3123      * Sends multiple packets.
    3124      *
    3125      * @param {Array} packets
    3126      * @api private
    3127      */
    3128 
    3129   }, {
    3130     key: "send",
    3131     value: function send(packets) {
    3132       if ("open" === this.readyState) {
    3133         this.write(packets);
    3134       } else {
    3135         throw new Error("Transport not open");
    3136       }
    3137     }
    3138     /**
    3139      * Called upon open
    3140      *
    3141      * @api private
    3142      */
    3143 
    3144   }, {
    3145     key: "onOpen",
    3146     value: function onOpen() {
    3147       this.readyState = "open";
    3148       this.writable = true;
    3149       this.emit("open");
    3150     }
    3151     /**
    3152      * Called with data.
    3153      *
    3154      * @param {String} data
    3155      * @api private
    3156      */
    3157 
    3158   }, {
    3159     key: "onData",
    3160     value: function onData(data) {
    3161       var packet = parser.decodePacket(data, this.socket.binaryType);
    3162       this.onPacket(packet);
    3163     }
    3164     /**
    3165      * Called with a decoded packet.
    3166      */
    3167 
    3168   }, {
    3169     key: "onPacket",
    3170     value: function onPacket(packet) {
    3171       this.emit("packet", packet);
    3172     }
    3173     /**
    3174      * Called upon close.
    3175      *
    3176      * @api private
    3177      */
    3178 
    3179   }, {
    3180     key: "onClose",
    3181     value: function onClose() {
    3182       this.readyState = "closed";
    3183       this.emit("close");
    3184     }
    3185   }]);
    3186 
    3187   return Transport;
    3188 }(Emitter);
    3189 
    3190 module.exports = Transport;
    3191 
    3192 /***/ }),
    3193 
    3194 /***/ "./node_modules/engine.io-client/lib/transports/index.js":
    3195 /*!***************************************************************!*\
    3196   !*** ./node_modules/engine.io-client/lib/transports/index.js ***!
    3197   \***************************************************************/
    3198 /*! no static exports found */
    3199 /***/ (function(module, exports, __webpack_require__) {
    3200 
    3201 var XMLHttpRequest = __webpack_require__(/*! xmlhttprequest-ssl */ "./node_modules/engine.io-client/lib/xmlhttprequest.js");
    3202 
    3203 var XHR = __webpack_require__(/*! ./polling-xhr */ "./node_modules/engine.io-client/lib/transports/polling-xhr.js");
    3204 
    3205 var JSONP = __webpack_require__(/*! ./polling-jsonp */ "./node_modules/engine.io-client/lib/transports/polling-jsonp.js");
    3206 
    3207 var websocket = __webpack_require__(/*! ./websocket */ "./node_modules/engine.io-client/lib/transports/websocket.js");
    3208 
    3209 exports.polling = polling;
    3210 exports.websocket = websocket;
    3211 /**
    3212  * Polling transport polymorphic constructor.
    3213  * Decides on xhr vs jsonp based on feature detection.
    3214  *
    3215  * @api private
    3216  */
    3217 
    3218 function polling(opts) {
    3219   var xhr;
    3220   var xd = false;
    3221   var xs = false;
    3222   var jsonp = false !== opts.jsonp;
    3223 
    3224   if (typeof location !== "undefined") {
    3225     var isSSL = "https:" === location.protocol;
    3226     var port = location.port; // some user agents have empty `location.port`
    3227 
    3228     if (!port) {
    3229       port = isSSL ? 443 : 80;
    3230     }
    3231 
    3232     xd = opts.hostname !== location.hostname || port !== opts.port;
    3233     xs = opts.secure !== isSSL;
    3234   }
    3235 
    3236   opts.xdomain = xd;
    3237   opts.xscheme = xs;
    3238   xhr = new XMLHttpRequest(opts);
    3239 
    3240   if ("open" in xhr && !opts.forceJSONP) {
    3241     return new XHR(opts);
    3242   } else {
    3243     if (!jsonp) throw new Error("JSONP disabled");
    3244     return new JSONP(opts);
    3245   }
    3246 }
    3247 
    3248 /***/ }),
    3249 
    3250 /***/ "./node_modules/engine.io-client/lib/transports/polling-jsonp.js":
    3251 /*!***********************************************************************!*\
    3252   !*** ./node_modules/engine.io-client/lib/transports/polling-jsonp.js ***!
    3253   \***********************************************************************/
    3254 /*! no static exports found */
    3255 /***/ (function(module, exports, __webpack_require__) {
    3256 
    3257 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    3258 
    3259 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    3260 
    3261 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    3262 
    3263 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    3264 
    3265 function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
    3266 
    3267 function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
    3268 
    3269 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    3270 
    3271 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    3272 
    3273 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    3274 
    3275 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    3276 
    3277 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    3278 
    3279 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    3280 
    3281 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    3282 
    3283 var Polling = __webpack_require__(/*! ./polling */ "./node_modules/engine.io-client/lib/transports/polling.js");
    3284 
    3285 var globalThis = __webpack_require__(/*! ../globalThis */ "./node_modules/engine.io-client/lib/globalThis.browser.js");
    3286 
    3287 var rNewline = /\n/g;
    3288 var rEscapedNewline = /\\n/g;
    3289 /**
    3290  * Global JSONP callbacks.
    3291  */
    3292 
    3293 var callbacks;
    3294 
    3295 var JSONPPolling = /*#__PURE__*/function (_Polling) {
    3296   _inherits(JSONPPolling, _Polling);
    3297 
    3298   var _super = _createSuper(JSONPPolling);
    3299 
    3300   /**
    3301    * JSONP Polling constructor.
    3302    *
    3303    * @param {Object} opts.
    3304    * @api public
    3305    */
    3306   function JSONPPolling(opts) {
    3307     var _this;
    3308 
    3309     _classCallCheck(this, JSONPPolling);
    3310 
    3311     _this = _super.call(this, opts);
    3312     _this.query = _this.query || {}; // define global callbacks array if not present
    3313     // we do this here (lazily) to avoid unneeded global pollution
    3314 
    3315     if (!callbacks) {
    3316       // we need to consider multiple engines in the same page
    3317       callbacks = globalThis.___eio = globalThis.___eio || [];
    3318     } // callback identifier
    3319 
    3320 
    3321     _this.index = callbacks.length; // add callback to jsonp global
    3322 
    3323     var self = _assertThisInitialized(_this);
    3324 
    3325     callbacks.push(function (msg) {
    3326       self.onData(msg);
    3327     }); // append to query string
    3328 
    3329     _this.query.j = _this.index;
    3330     return _this;
    3331   }
    3332   /**
    3333    * JSONP only supports binary as base64 encoded strings
    3334    */
    3335 
    3336 
    3337   _createClass(JSONPPolling, [{
    3338     key: "doClose",
    3339 
    3340     /**
    3341      * Closes the socket.
    3342      *
    3343      * @api private
    3344      */
    3345     value: function doClose() {
    3346       if (this.script) {
    3347         // prevent spurious errors from being emitted when the window is unloaded
    3348         this.script.onerror = function () {};
    3349 
    3350         this.script.parentNode.removeChild(this.script);
    3351         this.script = null;
    3352       }
    3353 
    3354       if (this.form) {
    3355         this.form.parentNode.removeChild(this.form);
    3356         this.form = null;
    3357         this.iframe = null;
    3358       }
    3359 
    3360       _get(_getPrototypeOf(JSONPPolling.prototype), "doClose", this).call(this);
    3361     }
    3362     /**
    3363      * Starts a poll cycle.
    3364      *
    3365      * @api private
    3366      */
    3367 
    3368   }, {
    3369     key: "doPoll",
    3370     value: function doPoll() {
    3371       var self = this;
    3372       var script = document.createElement("script");
    3373 
    3374       if (this.script) {
    3375         this.script.parentNode.removeChild(this.script);
    3376         this.script = null;
    3377       }
    3378 
    3379       script.async = true;
    3380       script.src = this.uri();
    3381 
    3382       script.onerror = function (e) {
    3383         self.onError("jsonp poll error", e);
    3384       };
    3385 
    3386       var insertAt = document.getElementsByTagName("script")[0];
    3387 
    3388       if (insertAt) {
    3389         insertAt.parentNode.insertBefore(script, insertAt);
    3390       } else {
    3391         (document.head || document.body).appendChild(script);
    3392       }
    3393 
    3394       this.script = script;
    3395       var isUAgecko = "undefined" !== typeof navigator && /gecko/i.test(navigator.userAgent);
    3396 
    3397       if (isUAgecko) {
    3398         setTimeout(function () {
    3399           var iframe = document.createElement("iframe");
    3400           document.body.appendChild(iframe);
    3401           document.body.removeChild(iframe);
    3402         }, 100);
    3403       }
    3404     }
    3405     /**
    3406      * Writes with a hidden iframe.
    3407      *
    3408      * @param {String} data to send
    3409      * @param {Function} called upon flush.
    3410      * @api private
    3411      */
    3412 
    3413   }, {
    3414     key: "doWrite",
    3415     value: function doWrite(data, fn) {
    3416       var self = this;
    3417       var iframe;
    3418 
    3419       if (!this.form) {
    3420         var form = document.createElement("form");
    3421         var area = document.createElement("textarea");
    3422         var id = this.iframeId = "eio_iframe_" + this.index;
    3423         form.className = "socketio";
    3424         form.style.position = "absolute";
    3425         form.style.top = "-1000px";
    3426         form.style.left = "-1000px";
    3427         form.target = id;
    3428         form.method = "POST";
    3429         form.setAttribute("accept-charset", "utf-8");
    3430         area.name = "d";
    3431         form.appendChild(area);
    3432         document.body.appendChild(form);
    3433         this.form = form;
    3434         this.area = area;
    3435       }
    3436 
    3437       this.form.action = this.uri();
    3438 
    3439       function complete() {
    3440         initIframe();
    3441         fn();
    3442       }
    3443 
    3444       function initIframe() {
    3445         if (self.iframe) {
    3446           try {
    3447             self.form.removeChild(self.iframe);
    3448           } catch (e) {
    3449             self.onError("jsonp polling iframe removal error", e);
    3450           }
    3451         }
    3452 
    3453         try {
    3454           // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
    3455           var html = '<iframe src="javascript:0" name="' + self.iframeId + '">';
    3456           iframe = document.createElement(html);
    3457         } catch (e) {
    3458           iframe = document.createElement("iframe");
    3459           iframe.name = self.iframeId;
    3460           iframe.src = "javascript:0";
    3461         }
    3462 
    3463         iframe.id = self.iframeId;
    3464         self.form.appendChild(iframe);
    3465         self.iframe = iframe;
    3466       }
    3467 
    3468       initIframe(); // escape \n to prevent it from being converted into \r\n by some UAs
    3469       // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side
    3470 
    3471       data = data.replace(rEscapedNewline, "\\\n");
    3472       this.area.value = data.replace(rNewline, "\\n");
    3473 
    3474       try {
    3475         this.form.submit();
    3476       } catch (e) {}
    3477 
    3478       if (this.iframe.attachEvent) {
    3479         this.iframe.onreadystatechange = function () {
    3480           if (self.iframe.readyState === "complete") {
    3481             complete();
    3482           }
    3483         };
    3484       } else {
    3485         this.iframe.onload = complete;
    3486       }
    3487     }
    3488   }, {
    3489     key: "supportsBinary",
    3490     get: function get() {
    3491       return false;
    3492     }
    3493   }]);
    3494 
    3495   return JSONPPolling;
    3496 }(Polling);
    3497 
    3498 module.exports = JSONPPolling;
    3499 
    3500 /***/ }),
    3501 
    3502 /***/ "./node_modules/engine.io-client/lib/transports/polling-xhr.js":
    3503 /*!*********************************************************************!*\
    3504   !*** ./node_modules/engine.io-client/lib/transports/polling-xhr.js ***!
    3505   \*********************************************************************/
    3506 /*! no static exports found */
    3507 /***/ (function(module, exports, __webpack_require__) {
    3508 
    3509 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    3510 
    3511 function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
    3512 
    3513 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    3514 
    3515 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    3516 
    3517 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    3518 
    3519 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    3520 
    3521 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    3522 
    3523 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    3524 
    3525 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    3526 
    3527 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    3528 
    3529 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    3530 
    3531 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    3532 
    3533 /* global attachEvent */
    3534 var XMLHttpRequest = __webpack_require__(/*! xmlhttprequest-ssl */ "./node_modules/engine.io-client/lib/xmlhttprequest.js");
    3535 
    3536 var Polling = __webpack_require__(/*! ./polling */ "./node_modules/engine.io-client/lib/transports/polling.js");
    3537 
    3538 var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
    3539 
    3540 var _require = __webpack_require__(/*! ../util */ "./node_modules/engine.io-client/lib/util.js"),
    3541     pick = _require.pick;
    3542 
    3543 var globalThis = __webpack_require__(/*! ../globalThis */ "./node_modules/engine.io-client/lib/globalThis.browser.js");
    3544 
    3545 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("engine.io-client:polling-xhr");
    3546 /**
    3547  * Empty function
    3548  */
    3549 
    3550 
    3551 function empty() {}
    3552 
    3553 var hasXHR2 = function () {
    3554   var xhr = new XMLHttpRequest({
    3555     xdomain: false
    3556   });
    3557   return null != xhr.responseType;
    3558 }();
    3559 
    3560 var XHR = /*#__PURE__*/function (_Polling) {
    3561   _inherits(XHR, _Polling);
    3562 
    3563   var _super = _createSuper(XHR);
    3564 
    3565   /**
    3566    * XHR Polling constructor.
    3567    *
    3568    * @param {Object} opts
    3569    * @api public
    3570    */
    3571   function XHR(opts) {
    3572     var _this;
    3573 
    3574     _classCallCheck(this, XHR);
    3575 
    3576     _this = _super.call(this, opts);
    3577 
    3578     if (typeof location !== "undefined") {
    3579       var isSSL = "https:" === location.protocol;
    3580       var port = location.port; // some user agents have empty `location.port`
    3581 
    3582       if (!port) {
    3583         port = isSSL ? 443 : 80;
    3584       }
    3585 
    3586       _this.xd = typeof location !== "undefined" && opts.hostname !== location.hostname || port !== opts.port;
    3587       _this.xs = opts.secure !== isSSL;
    3588     }
    3589     /**
    3590      * XHR supports binary
    3591      */
    3592 
    3593 
    3594     var forceBase64 = opts && opts.forceBase64;
    3595     _this.supportsBinary = hasXHR2 && !forceBase64;
    3596     return _this;
    3597   }
    3598   /**
    3599    * Creates a request.
    3600    *
    3601    * @param {String} method
    3602    * @api private
    3603    */
    3604 
    3605 
    3606   _createClass(XHR, [{
    3607     key: "request",
    3608     value: function request() {
    3609       var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    3610 
    3611       _extends(opts, {
    3612         xd: this.xd,
    3613         xs: this.xs
    3614       }, this.opts);
    3615 
    3616       return new Request(this.uri(), opts);
    3617     }
    3618     /**
    3619      * Sends data.
    3620      *
    3621      * @param {String} data to send.
    3622      * @param {Function} called upon flush.
    3623      * @api private
    3624      */
    3625 
    3626   }, {
    3627     key: "doWrite",
    3628     value: function doWrite(data, fn) {
    3629       var req = this.request({
    3630         method: "POST",
    3631         data: data
    3632       });
    3633       var self = this;
    3634       req.on("success", fn);
    3635       req.on("error", function (err) {
    3636         self.onError("xhr post error", err);
    3637       });
    3638     }
    3639     /**
    3640      * Starts a poll cycle.
    3641      *
    3642      * @api private
    3643      */
    3644 
    3645   }, {
    3646     key: "doPoll",
    3647     value: function doPoll() {
    3648       debug("xhr poll");
    3649       var req = this.request();
    3650       var self = this;
    3651       req.on("data", function (data) {
    3652         self.onData(data);
    3653       });
    3654       req.on("error", function (err) {
    3655         self.onError("xhr poll error", err);
    3656       });
    3657       this.pollXhr = req;
    3658     }
    3659   }]);
    3660 
    3661   return XHR;
    3662 }(Polling);
    3663 
    3664 var Request = /*#__PURE__*/function (_Emitter) {
    3665   _inherits(Request, _Emitter);
    3666 
    3667   var _super2 = _createSuper(Request);
    3668 
    3669   /**
    3670    * Request constructor
    3671    *
    3672    * @param {Object} options
    3673    * @api public
    3674    */
    3675   function Request(uri, opts) {
    3676     var _this2;
    3677 
    3678     _classCallCheck(this, Request);
    3679 
    3680     _this2 = _super2.call(this);
    3681     _this2.opts = opts;
    3682     _this2.method = opts.method || "GET";
    3683     _this2.uri = uri;
    3684     _this2.async = false !== opts.async;
    3685     _this2.data = undefined !== opts.data ? opts.data : null;
    3686 
    3687     _this2.create();
    3688 
    3689     return _this2;
    3690   }
    3691   /**
    3692    * Creates the XHR object and sends the request.
    3693    *
    3694    * @api private
    3695    */
    3696 
    3697 
    3698   _createClass(Request, [{
    3699     key: "create",
    3700     value: function create() {
    3701       var opts = pick(this.opts, "agent", "enablesXDR", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized");
    3702       opts.xdomain = !!this.opts.xd;
    3703       opts.xscheme = !!this.opts.xs;
    3704       var xhr = this.xhr = new XMLHttpRequest(opts);
    3705       var self = this;
    3706 
    3707       try {
    3708         debug("xhr open %s: %s", this.method, this.uri);
    3709         xhr.open(this.method, this.uri, this.async);
    3710 
    3711         try {
    3712           if (this.opts.extraHeaders) {
    3713             xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);
    3714 
    3715             for (var i in this.opts.extraHeaders) {
    3716               if (this.opts.extraHeaders.hasOwnProperty(i)) {
    3717                 xhr.setRequestHeader(i, this.opts.extraHeaders[i]);
    3718               }
    3719             }
    3720           }
    3721         } catch (e) {}
    3722 
    3723         if ("POST" === this.method) {
    3724           try {
    3725             xhr.setRequestHeader("Content-type", "text/plain;charset=UTF-8");
    3726           } catch (e) {}
    3727         }
    3728 
    3729         try {
    3730           xhr.setRequestHeader("Accept", "*/*");
    3731         } catch (e) {} // ie6 check
    3732 
    3733 
    3734         if ("withCredentials" in xhr) {
    3735           xhr.withCredentials = this.opts.withCredentials;
    3736         }
    3737 
    3738         if (this.opts.requestTimeout) {
    3739           xhr.timeout = this.opts.requestTimeout;
    3740         }
    3741 
    3742         if (this.hasXDR()) {
    3743           xhr.onload = function () {
    3744             self.onLoad();
    3745           };
    3746 
    3747           xhr.onerror = function () {
    3748             self.onError(xhr.responseText);
    3749           };
    3750         } else {
    3751           xhr.onreadystatechange = function () {
    3752             if (4 !== xhr.readyState) return;
    3753 
    3754             if (200 === xhr.status || 1223 === xhr.status) {
    3755               self.onLoad();
    3756             } else {
    3757               // make sure the `error` event handler that's user-set
    3758               // does not throw in the same tick and gets caught here
    3759               setTimeout(function () {
    3760                 self.onError(typeof xhr.status === "number" ? xhr.status : 0);
    3761               }, 0);
    3762             }
    3763           };
    3764         }
    3765 
    3766         debug("xhr data %s", this.data);
    3767         xhr.send(this.data);
    3768       } catch (e) {
    3769         // Need to defer since .create() is called directly from the constructor
    3770         // and thus the 'error' event can only be only bound *after* this exception
    3771         // occurs.  Therefore, also, we cannot throw here at all.
    3772         setTimeout(function () {
    3773           self.onError(e);
    3774         }, 0);
    3775         return;
    3776       }
    3777 
    3778       if (typeof document !== "undefined") {
    3779         this.index = Request.requestsCount++;
    3780         Request.requests[this.index] = this;
    3781       }
    3782     }
    3783     /**
    3784      * Called upon successful response.
    3785      *
    3786      * @api private
    3787      */
    3788 
    3789   }, {
    3790     key: "onSuccess",
    3791     value: function onSuccess() {
    3792       this.emit("success");
    3793       this.cleanup();
    3794     }
    3795     /**
    3796      * Called if we have data.
    3797      *
    3798      * @api private
    3799      */
    3800 
    3801   }, {
    3802     key: "onData",
    3803     value: function onData(data) {
    3804       this.emit("data", data);
    3805       this.onSuccess();
    3806     }
    3807     /**
    3808      * Called upon error.
    3809      *
    3810      * @api private
    3811      */
    3812 
    3813   }, {
    3814     key: "onError",
    3815     value: function onError(err) {
    3816       this.emit("error", err);
    3817       this.cleanup(true);
    3818     }
    3819     /**
    3820      * Cleans up house.
    3821      *
    3822      * @api private
    3823      */
    3824 
    3825   }, {
    3826     key: "cleanup",
    3827     value: function cleanup(fromError) {
    3828       if ("undefined" === typeof this.xhr || null === this.xhr) {
    3829         return;
    3830       } // xmlhttprequest
    3831 
    3832 
    3833       if (this.hasXDR()) {
    3834         this.xhr.onload = this.xhr.onerror = empty;
    3835       } else {
    3836         this.xhr.onreadystatechange = empty;
    3837       }
    3838 
    3839       if (fromError) {
    3840         try {
    3841           this.xhr.abort();
    3842         } catch (e) {}
    3843       }
    3844 
    3845       if (typeof document !== "undefined") {
    3846         delete Request.requests[this.index];
    3847       }
    3848 
    3849       this.xhr = null;
    3850     }
    3851     /**
    3852      * Called upon load.
    3853      *
    3854      * @api private
    3855      */
    3856 
    3857   }, {
    3858     key: "onLoad",
    3859     value: function onLoad() {
    3860       var data = this.xhr.responseText;
    3861 
    3862       if (data !== null) {
    3863         this.onData(data);
    3864       }
    3865     }
    3866     /**
    3867      * Check if it has XDomainRequest.
    3868      *
    3869      * @api private
    3870      */
    3871 
    3872   }, {
    3873     key: "hasXDR",
    3874     value: function hasXDR() {
    3875       return typeof XDomainRequest !== "undefined" && !this.xs && this.enablesXDR;
    3876     }
    3877     /**
    3878      * Aborts the request.
    3879      *
    3880      * @api public
    3881      */
    3882 
    3883   }, {
    3884     key: "abort",
    3885     value: function abort() {
    3886       this.cleanup();
    3887     }
    3888   }]);
    3889 
    3890   return Request;
    3891 }(Emitter);
    3892 /**
    3893  * Aborts pending requests when unloading the window. This is needed to prevent
    3894  * memory leaks (e.g. when using IE) and to ensure that no spurious error is
    3895  * emitted.
    3896  */
    3897 
    3898 
    3899 Request.requestsCount = 0;
    3900 Request.requests = {};
    3901 
    3902 if (typeof document !== "undefined") {
    3903   if (typeof attachEvent === "function") {
    3904     attachEvent("onunload", unloadHandler);
    3905   } else if (typeof addEventListener === "function") {
    3906     var terminationEvent = "onpagehide" in globalThis ? "pagehide" : "unload";
    3907     addEventListener(terminationEvent, unloadHandler, false);
    3908   }
    3909 }
    3910 
    3911 function unloadHandler() {
    3912   for (var i in Request.requests) {
    3913     if (Request.requests.hasOwnProperty(i)) {
    3914       Request.requests[i].abort();
    3915     }
    3916   }
    3917 }
    3918 
    3919 module.exports = XHR;
    3920 module.exports.Request = Request;
    3921 
    3922 /***/ }),
    3923 
    3924 /***/ "./node_modules/engine.io-client/lib/transports/polling.js":
    3925 /*!*****************************************************************!*\
    3926   !*** ./node_modules/engine.io-client/lib/transports/polling.js ***!
    3927   \*****************************************************************/
    3928 /*! no static exports found */
    3929 /***/ (function(module, exports, __webpack_require__) {
    3930 
    3931 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    3932 
    3933 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    3934 
    3935 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    3936 
    3937 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    3938 
    3939 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    3940 
    3941 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    3942 
    3943 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    3944 
    3945 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    3946 
    3947 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    3948 
    3949 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    3950 
    3951 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    3952 
    3953 var Transport = __webpack_require__(/*! ../transport */ "./node_modules/engine.io-client/lib/transport.js");
    3954 
    3955 var parseqs = __webpack_require__(/*! parseqs */ "./node_modules/parseqs/index.js");
    3956 
    3957 var parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/index.js");
    3958 
    3959 var yeast = __webpack_require__(/*! yeast */ "./node_modules/yeast/index.js");
    3960 
    3961 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("engine.io-client:polling");
    3962 
    3963 var Polling = /*#__PURE__*/function (_Transport) {
    3964   _inherits(Polling, _Transport);
    3965 
    3966   var _super = _createSuper(Polling);
    3967 
    3968   function Polling() {
    3969     _classCallCheck(this, Polling);
    3970 
    3971     return _super.apply(this, arguments);
    3972   }
    3973 
    3974   _createClass(Polling, [{
    3975     key: "doOpen",
    3976 
    3977     /**
    3978      * Opens the socket (triggers polling). We write a PING message to determine
    3979      * when the transport is open.
    3980      *
    3981      * @api private
    3982      */
    3983     value: function doOpen() {
    3984       this.poll();
    3985     }
    3986     /**
    3987      * Pauses polling.
    3988      *
    3989      * @param {Function} callback upon buffers are flushed and transport is paused
    3990      * @api private
    3991      */
    3992 
    3993   }, {
    3994     key: "pause",
    3995     value: function pause(onPause) {
    3996       var self = this;
    3997       this.readyState = "pausing";
    3998 
    3999       function pause() {
    4000         debug("paused");
    4001         self.readyState = "paused";
    4002         onPause();
    4003       }
    4004 
    4005       if (this.polling || !this.writable) {
    4006         var total = 0;
    4007 
    4008         if (this.polling) {
    4009           debug("we are currently polling - waiting to pause");
    4010           total++;
    4011           this.once("pollComplete", function () {
    4012             debug("pre-pause polling complete");
    4013             --total || pause();
    4014           });
    4015         }
    4016 
    4017         if (!this.writable) {
    4018           debug("we are currently writing - waiting to pause");
    4019           total++;
    4020           this.once("drain", function () {
    4021             debug("pre-pause writing complete");
    4022             --total || pause();
    4023           });
    4024         }
    4025       } else {
    4026         pause();
    4027       }
    4028     }
    4029     /**
    4030      * Starts polling cycle.
    4031      *
    4032      * @api public
    4033      */
    4034 
    4035   }, {
    4036     key: "poll",
    4037     value: function poll() {
    4038       debug("polling");
    4039       this.polling = true;
    4040       this.doPoll();
    4041       this.emit("poll");
    4042     }
    4043     /**
    4044      * Overloads onData to detect payloads.
    4045      *
    4046      * @api private
    4047      */
    4048 
    4049   }, {
    4050     key: "onData",
    4051     value: function onData(data) {
    4052       var self = this;
    4053       debug("polling got data %s", data);
    4054 
    4055       var callback = function callback(packet, index, total) {
    4056         // if its the first message we consider the transport open
    4057         if ("opening" === self.readyState && packet.type === "open") {
    4058           self.onOpen();
    4059         } // if its a close packet, we close the ongoing requests
    4060 
    4061 
    4062         if ("close" === packet.type) {
    4063           self.onClose();
    4064           return false;
    4065         } // otherwise bypass onData and handle the message
    4066 
    4067 
    4068         self.onPacket(packet);
    4069       }; // decode payload
    4070 
    4071 
    4072       parser.decodePayload(data, this.socket.binaryType).forEach(callback); // if an event did not trigger closing
    4073 
    4074       if ("closed" !== this.readyState) {
    4075         // if we got data we're not polling
    4076         this.polling = false;
    4077         this.emit("pollComplete");
    4078 
    4079         if ("open" === this.readyState) {
    4080           this.poll();
    4081         } else {
    4082           debug('ignoring poll - transport state "%s"', this.readyState);
    4083         }
    4084       }
    4085     }
    4086     /**
    4087      * For polling, send a close packet.
    4088      *
    4089      * @api private
    4090      */
    4091 
    4092   }, {
    4093     key: "doClose",
    4094     value: function doClose() {
    4095       var self = this;
    4096 
    4097       function close() {
    4098         debug("writing close packet");
    4099         self.write([{
    4100           type: "close"
    4101         }]);
    4102       }
    4103 
    4104       if ("open" === this.readyState) {
    4105         debug("transport open - closing");
    4106         close();
    4107       } else {
    4108         // in case we're trying to close while
    4109         // handshaking is in progress (GH-164)
    4110         debug("transport not open - deferring close");
    4111         this.once("open", close);
    4112       }
    4113     }
    4114     /**
    4115      * Writes a packets payload.
    4116      *
    4117      * @param {Array} data packets
    4118      * @param {Function} drain callback
    4119      * @api private
    4120      */
    4121 
    4122   }, {
    4123     key: "write",
    4124     value: function write(packets) {
    4125       var _this = this;
    4126 
    4127       this.writable = false;
    4128       parser.encodePayload(packets, function (data) {
    4129         _this.doWrite(data, function () {
    4130           _this.writable = true;
    4131 
    4132           _this.emit("drain");
    4133         });
    4134       });
    4135     }
    4136     /**
    4137      * Generates uri for connection.
    4138      *
    4139      * @api private
    4140      */
    4141 
    4142   }, {
    4143     key: "uri",
    4144     value: function uri() {
    4145       var query = this.query || {};
    4146       var schema = this.opts.secure ? "https" : "http";
    4147       var port = ""; // cache busting is forced
    4148 
    4149       if (false !== this.opts.timestampRequests) {
    4150         query[this.opts.timestampParam] = yeast();
    4151       }
    4152 
    4153       if (!this.supportsBinary && !query.sid) {
    4154         query.b64 = 1;
    4155       }
    4156 
    4157       query = parseqs.encode(query); // avoid port if default for schema
    4158 
    4159       if (this.opts.port && ("https" === schema && Number(this.opts.port) !== 443 || "http" === schema && Number(this.opts.port) !== 80)) {
    4160         port = ":" + this.opts.port;
    4161       } // prepend ? to query
    4162 
    4163 
    4164       if (query.length) {
    4165         query = "?" + query;
    4166       }
    4167 
    4168       var ipv6 = this.opts.hostname.indexOf(":") !== -1;
    4169       return schema + "://" + (ipv6 ? "[" + this.opts.hostname + "]" : this.opts.hostname) + port + this.opts.path + query;
    4170     }
    4171   }, {
    4172     key: "name",
    4173 
    4174     /**
    4175      * Transport name.
    4176      */
    4177     get: function get() {
    4178       return "polling";
    4179     }
    4180   }]);
    4181 
    4182   return Polling;
    4183 }(Transport);
    4184 
    4185 module.exports = Polling;
    4186 
    4187 /***/ }),
    4188 
    4189 /***/ "./node_modules/engine.io-client/lib/transports/websocket-constructor.browser.js":
    4190 /*!***************************************************************************************!*\
    4191   !*** ./node_modules/engine.io-client/lib/transports/websocket-constructor.browser.js ***!
    4192   \***************************************************************************************/
    4193 /*! no static exports found */
    4194 /***/ (function(module, exports, __webpack_require__) {
    4195 
    4196 var globalThis = __webpack_require__(/*! ../globalThis */ "./node_modules/engine.io-client/lib/globalThis.browser.js");
    4197 
    4198 module.exports = {
    4199   WebSocket: globalThis.WebSocket || globalThis.MozWebSocket,
    4200   usingBrowserWebSocket: true,
    4201   defaultBinaryType: "arraybuffer"
    4202 };
    4203 
    4204 /***/ }),
    4205 
    4206 /***/ "./node_modules/engine.io-client/lib/transports/websocket.js":
    4207 /*!*******************************************************************!*\
    4208   !*** ./node_modules/engine.io-client/lib/transports/websocket.js ***!
    4209   \*******************************************************************/
    4210 /*! no static exports found */
    4211 /***/ (function(module, exports, __webpack_require__) {
    4212 
    4213 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    4214 
    4215 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    4216 
    4217 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    4218 
    4219 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    4220 
    4221 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    4222 
    4223 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    4224 
    4225 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    4226 
    4227 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    4228 
    4229 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    4230 
    4231 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    4232 
    4233 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    4234 
    4235 var Transport = __webpack_require__(/*! ../transport */ "./node_modules/engine.io-client/lib/transport.js");
    4236 
    4237 var parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/index.js");
    4238 
    4239 var parseqs = __webpack_require__(/*! parseqs */ "./node_modules/parseqs/index.js");
    4240 
    4241 var yeast = __webpack_require__(/*! yeast */ "./node_modules/yeast/index.js");
    4242 
    4243 var _require = __webpack_require__(/*! ../util */ "./node_modules/engine.io-client/lib/util.js"),
    4244     pick = _require.pick;
    4245 
    4246 var _require2 = __webpack_require__(/*! ./websocket-constructor */ "./node_modules/engine.io-client/lib/transports/websocket-constructor.browser.js"),
    4247     WebSocket = _require2.WebSocket,
    4248     usingBrowserWebSocket = _require2.usingBrowserWebSocket,
    4249     defaultBinaryType = _require2.defaultBinaryType;
    4250 
    4251 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("engine.io-client:websocket"); // detect ReactNative environment
    4252 
    4253 
    4254 var isReactNative = typeof navigator !== "undefined" && typeof navigator.product === "string" && navigator.product.toLowerCase() === "reactnative";
    4255 
    4256 var WS = /*#__PURE__*/function (_Transport) {
    4257   _inherits(WS, _Transport);
    4258 
    4259   var _super = _createSuper(WS);
    4260 
    4261   /**
    4262    * WebSocket transport constructor.
    4263    *
    4264    * @api {Object} connection options
    4265    * @api public
    4266    */
    4267   function WS(opts) {
    4268     var _this;
    4269 
    4270     _classCallCheck(this, WS);
    4271 
    4272     _this = _super.call(this, opts);
    4273     _this.supportsBinary = !opts.forceBase64;
    4274     return _this;
    4275   }
    4276   /**
    4277    * Transport name.
     453   * Initialize a new `Emitter`.
    4278454   *
    4279455   * @api public
    4280456   */
    4281457
    4282 
    4283   _createClass(WS, [{
    4284     key: "doOpen",
    4285 
    4286     /**
    4287      * Opens socket.
    4288      *
    4289      * @api private
    4290      */
    4291     value: function doOpen() {
    4292       if (!this.check()) {
    4293         // let probe timeout
    4294         return;
    4295       }
    4296 
    4297       var uri = this.uri();
    4298       var protocols = this.opts.protocols; // React Native only supports the 'headers' option, and will print a warning if anything else is passed
    4299 
    4300       var opts = isReactNative ? {} : pick(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
    4301 
    4302       if (this.opts.extraHeaders) {
    4303         opts.headers = this.opts.extraHeaders;
    4304       }
    4305 
    4306       try {
    4307         this.ws = usingBrowserWebSocket && !isReactNative ? protocols ? new WebSocket(uri, protocols) : new WebSocket(uri) : new WebSocket(uri, protocols, opts);
    4308       } catch (err) {
    4309         return this.emit("error", err);
    4310       }
    4311 
    4312       this.ws.binaryType = this.socket.binaryType || defaultBinaryType;
    4313       this.addEventListeners();
    4314     }
    4315     /**
    4316      * Adds event listeners to the socket
    4317      *
    4318      * @api private
    4319      */
    4320 
    4321   }, {
    4322     key: "addEventListeners",
    4323     value: function addEventListeners() {
    4324       var self = this;
    4325 
    4326       this.ws.onopen = function () {
    4327         self.onOpen();
    4328       };
    4329 
    4330       this.ws.onclose = function () {
    4331         self.onClose();
    4332       };
    4333 
    4334       this.ws.onmessage = function (ev) {
    4335         self.onData(ev.data);
    4336       };
    4337 
    4338       this.ws.onerror = function (e) {
    4339         self.onError("websocket error", e);
    4340       };
    4341     }
    4342     /**
    4343      * Writes data to socket.
    4344      *
    4345      * @param {Array} array of packets.
    4346      * @api private
    4347      */
    4348 
    4349   }, {
    4350     key: "write",
    4351     value: function write(packets) {
    4352       var self = this;
    4353       this.writable = false; // encodePacket efficient as it uses WS framing
    4354       // no need for encodePayload
    4355 
    4356       var total = packets.length;
    4357       var i = 0;
    4358       var l = total;
    4359 
    4360       for (; i < l; i++) {
    4361         (function (packet) {
    4362           parser.encodePacket(packet, self.supportsBinary, function (data) {
    4363             // always create a new object (GH-437)
    4364             var opts = {};
    4365 
    4366             if (!usingBrowserWebSocket) {
    4367               if (packet.options) {
    4368                 opts.compress = packet.options.compress;
    4369               }
    4370 
    4371               if (self.opts.perMessageDeflate) {
    4372                 var len = "string" === typeof data ? Buffer.byteLength(data) : data.length;
    4373 
    4374                 if (len < self.opts.perMessageDeflate.threshold) {
    4375                   opts.compress = false;
    4376                 }
    4377               }
    4378             } // Sometimes the websocket has already been closed but the browser didn't
    4379             // have a chance of informing us about it yet, in that case send will
    4380             // throw an error
    4381 
    4382 
    4383             try {
    4384               if (usingBrowserWebSocket) {
    4385                 // TypeError is thrown when passing the second argument on Safari
    4386                 self.ws.send(data);
    4387               } else {
    4388                 self.ws.send(data, opts);
    4389               }
    4390             } catch (e) {
    4391               debug("websocket closed before onclose event");
    4392             }
    4393 
    4394             --total || done();
    4395           });
    4396         })(packets[i]);
    4397       }
    4398 
    4399       function done() {
    4400         self.emit("flush"); // fake drain
    4401         // defer to next tick to allow Socket to clear writeBuffer
    4402 
    4403         setTimeout(function () {
    4404           self.writable = true;
    4405           self.emit("drain");
    4406         }, 0);
    4407       }
    4408     }
    4409     /**
    4410      * Called upon close
    4411      *
    4412      * @api private
    4413      */
    4414 
    4415   }, {
    4416     key: "onClose",
    4417     value: function onClose() {
    4418       Transport.prototype.onClose.call(this);
    4419     }
    4420     /**
    4421      * Closes socket.
    4422      *
    4423      * @api private
    4424      */
    4425 
    4426   }, {
    4427     key: "doClose",
    4428     value: function doClose() {
    4429       if (typeof this.ws !== "undefined") {
    4430         this.ws.close();
    4431         this.ws = null;
    4432       }
    4433     }
    4434     /**
    4435      * Generates uri for connection.
    4436      *
    4437      * @api private
    4438      */
    4439 
    4440   }, {
    4441     key: "uri",
    4442     value: function uri() {
    4443       var query = this.query || {};
    4444       var schema = this.opts.secure ? "wss" : "ws";
    4445       var port = ""; // avoid port if default for schema
    4446 
    4447       if (this.opts.port && ("wss" === schema && Number(this.opts.port) !== 443 || "ws" === schema && Number(this.opts.port) !== 80)) {
    4448         port = ":" + this.opts.port;
    4449       } // append timestamp to URI
    4450 
    4451 
    4452       if (this.opts.timestampRequests) {
    4453         query[this.opts.timestampParam] = yeast();
    4454       } // communicate binary support capabilities
    4455 
    4456 
    4457       if (!this.supportsBinary) {
    4458         query.b64 = 1;
    4459       }
    4460 
    4461       query = parseqs.encode(query); // prepend ? to query
    4462 
    4463       if (query.length) {
    4464         query = "?" + query;
    4465       }
    4466 
    4467       var ipv6 = this.opts.hostname.indexOf(":") !== -1;
    4468       return schema + "://" + (ipv6 ? "[" + this.opts.hostname + "]" : this.opts.hostname) + port + this.opts.path + query;
    4469     }
    4470     /**
    4471      * Feature detection for WebSocket.
    4472      *
    4473      * @return {Boolean} whether this transport is available.
    4474      * @api public
    4475      */
    4476 
    4477   }, {
    4478     key: "check",
    4479     value: function check() {
    4480       return !!WebSocket && !("__initialize" in WebSocket && this.name === WS.prototype.name);
    4481     }
    4482   }, {
    4483     key: "name",
    4484     get: function get() {
    4485       return "websocket";
    4486     }
    4487   }]);
    4488 
    4489   return WS;
    4490 }(Transport);
    4491 
    4492 module.exports = WS;
    4493 
    4494 /***/ }),
    4495 
    4496 /***/ "./node_modules/engine.io-client/lib/util.js":
    4497 /*!***************************************************!*\
    4498   !*** ./node_modules/engine.io-client/lib/util.js ***!
    4499   \***************************************************/
    4500 /*! no static exports found */
    4501 /***/ (function(module, exports) {
    4502 
    4503 module.exports.pick = function (obj) {
    4504   for (var _len = arguments.length, attr = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    4505     attr[_key - 1] = arguments[_key];
     458  function Emitter(obj) {
     459    if (obj) return mixin(obj);
    4506460  }
    4507 
    4508   return attr.reduce(function (acc, k) {
    4509     if (obj.hasOwnProperty(k)) {
    4510       acc[k] = obj[k];
    4511     }
    4512 
    4513     return acc;
    4514   }, {});
    4515 };
    4516 
    4517 /***/ }),
    4518 
    4519 /***/ "./node_modules/engine.io-client/lib/xmlhttprequest.js":
    4520 /*!*************************************************************!*\
    4521   !*** ./node_modules/engine.io-client/lib/xmlhttprequest.js ***!
    4522   \*************************************************************/
    4523 /*! no static exports found */
    4524 /***/ (function(module, exports, __webpack_require__) {
    4525 
    4526 // browser shim for xmlhttprequest module
    4527 var hasCORS = __webpack_require__(/*! has-cors */ "./node_modules/has-cors/index.js");
    4528 
    4529 var globalThis = __webpack_require__(/*! ./globalThis */ "./node_modules/engine.io-client/lib/globalThis.browser.js");
    4530 
    4531 module.exports = function (opts) {
    4532   var xdomain = opts.xdomain; // scheme must be same when usign XDomainRequest
    4533   // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
    4534 
    4535   var xscheme = opts.xscheme; // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.
    4536   // https://github.com/Automattic/engine.io-client/pull/217
    4537 
    4538   var enablesXDR = opts.enablesXDR; // XMLHttpRequest can be disabled on IE
    4539 
    4540   try {
    4541     if ("undefined" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
    4542       return new XMLHttpRequest();
    4543     }
    4544   } catch (e) {} // Use XDomainRequest for IE8 if enablesXDR is true
    4545   // because loading bar keeps flashing when using jsonp-polling
    4546   // https://github.com/yujiosaka/socke.io-ie8-loading-example
    4547 
    4548 
    4549   try {
    4550     if ("undefined" !== typeof XDomainRequest && !xscheme && enablesXDR) {
    4551       return new XDomainRequest();
    4552     }
    4553   } catch (e) {}
    4554 
    4555   if (!xdomain) {
    4556     try {
    4557       return new globalThis[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
    4558     } catch (e) {}
     461  /**
     462   * Mixin the emitter properties.
     463   *
     464   * @param {Object} obj
     465   * @return {Object}
     466   * @api private
     467   */
     468
     469
     470  function mixin(obj) {
     471    for (var key in Emitter.prototype) {
     472      obj[key] = Emitter.prototype[key];
     473    }
     474
     475    return obj;
    4559476  }
    4560 };
    4561 
    4562 /***/ }),
    4563 
    4564 /***/ "./node_modules/engine.io-parser/lib/commons.js":
    4565 /*!******************************************************!*\
    4566   !*** ./node_modules/engine.io-parser/lib/commons.js ***!
    4567   \******************************************************/
    4568 /*! no static exports found */
    4569 /***/ (function(module, exports) {
    4570 
    4571 var PACKET_TYPES = Object.create(null); // no Map = no polyfill
    4572 
    4573 PACKET_TYPES["open"] = "0";
    4574 PACKET_TYPES["close"] = "1";
    4575 PACKET_TYPES["ping"] = "2";
    4576 PACKET_TYPES["pong"] = "3";
    4577 PACKET_TYPES["message"] = "4";
    4578 PACKET_TYPES["upgrade"] = "5";
    4579 PACKET_TYPES["noop"] = "6";
    4580 var PACKET_TYPES_REVERSE = Object.create(null);
    4581 Object.keys(PACKET_TYPES).forEach(function (key) {
    4582   PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;
    4583 });
    4584 var ERROR_PACKET = {
    4585   type: "error",
    4586   data: "parser error"
    4587 };
    4588 module.exports = {
    4589   PACKET_TYPES: PACKET_TYPES,
    4590   PACKET_TYPES_REVERSE: PACKET_TYPES_REVERSE,
    4591   ERROR_PACKET: ERROR_PACKET
    4592 };
    4593 
    4594 /***/ }),
    4595 
    4596 /***/ "./node_modules/engine.io-parser/lib/decodePacket.browser.js":
    4597 /*!*******************************************************************!*\
    4598   !*** ./node_modules/engine.io-parser/lib/decodePacket.browser.js ***!
    4599   \*******************************************************************/
    4600 /*! no static exports found */
    4601 /***/ (function(module, exports, __webpack_require__) {
    4602 
    4603 var _require = __webpack_require__(/*! ./commons */ "./node_modules/engine.io-parser/lib/commons.js"),
    4604     PACKET_TYPES_REVERSE = _require.PACKET_TYPES_REVERSE,
    4605     ERROR_PACKET = _require.ERROR_PACKET;
    4606 
    4607 var withNativeArrayBuffer = typeof ArrayBuffer === "function";
    4608 var base64decoder;
    4609 
    4610 if (withNativeArrayBuffer) {
    4611   base64decoder = __webpack_require__(/*! base64-arraybuffer */ "./node_modules/engine.io-parser/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js");
    4612 }
    4613 
    4614 var decodePacket = function decodePacket(encodedPacket, binaryType) {
    4615   if (typeof encodedPacket !== "string") {
    4616     return {
    4617       type: "message",
    4618       data: mapBinary(encodedPacket, binaryType)
     477  /**
     478   * Listen on the given `event` with `fn`.
     479   *
     480   * @param {String} event
     481   * @param {Function} fn
     482   * @return {Emitter}
     483   * @api public
     484   */
     485
     486
     487  Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
     488    this._callbacks = this._callbacks || {};
     489    (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
     490    return this;
     491  };
     492  /**
     493   * Adds an `event` listener that will be invoked a single
     494   * time then automatically removed.
     495   *
     496   * @param {String} event
     497   * @param {Function} fn
     498   * @return {Emitter}
     499   * @api public
     500   */
     501
     502
     503  Emitter.prototype.once = function (event, fn) {
     504    function on() {
     505      this.off(event, on);
     506      fn.apply(this, arguments);
     507    }
     508
     509    on.fn = fn;
     510    this.on(event, on);
     511    return this;
     512  };
     513  /**
     514   * Remove the given callback for `event` or all
     515   * registered callbacks.
     516   *
     517   * @param {String} event
     518   * @param {Function} fn
     519   * @return {Emitter}
     520   * @api public
     521   */
     522
     523
     524  Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
     525    this._callbacks = this._callbacks || {}; // all
     526
     527    if (0 == arguments.length) {
     528      this._callbacks = {};
     529      return this;
     530    } // specific event
     531
     532
     533    var callbacks = this._callbacks['$' + event];
     534    if (!callbacks) return this; // remove all handlers
     535
     536    if (1 == arguments.length) {
     537      delete this._callbacks['$' + event];
     538      return this;
     539    } // remove specific handler
     540
     541
     542    var cb;
     543
     544    for (var i = 0; i < callbacks.length; i++) {
     545      cb = callbacks[i];
     546
     547      if (cb === fn || cb.fn === fn) {
     548        callbacks.splice(i, 1);
     549        break;
     550      }
     551    } // Remove event specific arrays for event types that no
     552    // one is subscribed for to avoid memory leak.
     553
     554
     555    if (callbacks.length === 0) {
     556      delete this._callbacks['$' + event];
     557    }
     558
     559    return this;
     560  };
     561  /**
     562   * Emit `event` with the given args.
     563   *
     564   * @param {String} event
     565   * @param {Mixed} ...
     566   * @return {Emitter}
     567   */
     568
     569
     570  Emitter.prototype.emit = function (event) {
     571    this._callbacks = this._callbacks || {};
     572    var args = new Array(arguments.length - 1),
     573        callbacks = this._callbacks['$' + event];
     574
     575    for (var i = 1; i < arguments.length; i++) {
     576      args[i - 1] = arguments[i];
     577    }
     578
     579    if (callbacks) {
     580      callbacks = callbacks.slice(0);
     581
     582      for (var i = 0, len = callbacks.length; i < len; ++i) {
     583        callbacks[i].apply(this, args);
     584      }
     585    }
     586
     587    return this;
     588  }; // alias used for reserved events (protected method)
     589
     590
     591  Emitter.prototype.emitReserved = Emitter.prototype.emit;
     592  /**
     593   * Return array of callbacks for `event`.
     594   *
     595   * @param {String} event
     596   * @return {Array}
     597   * @api public
     598   */
     599
     600  Emitter.prototype.listeners = function (event) {
     601    this._callbacks = this._callbacks || {};
     602    return this._callbacks['$' + event] || [];
     603  };
     604  /**
     605   * Check if this emitter has `event` handlers.
     606   *
     607   * @param {String} event
     608   * @return {Boolean}
     609   * @api public
     610   */
     611
     612
     613  Emitter.prototype.hasListeners = function (event) {
     614    return !!this.listeners(event).length;
     615  };
     616
     617  var PACKET_TYPES = Object.create(null); // no Map = no polyfill
     618
     619  PACKET_TYPES["open"] = "0";
     620  PACKET_TYPES["close"] = "1";
     621  PACKET_TYPES["ping"] = "2";
     622  PACKET_TYPES["pong"] = "3";
     623  PACKET_TYPES["message"] = "4";
     624  PACKET_TYPES["upgrade"] = "5";
     625  PACKET_TYPES["noop"] = "6";
     626  var PACKET_TYPES_REVERSE = Object.create(null);
     627  Object.keys(PACKET_TYPES).forEach(function (key) {
     628    PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;
     629  });
     630  var ERROR_PACKET = {
     631    type: "error",
     632    data: "parser error"
     633  };
     634
     635  var withNativeBlob$1 = typeof Blob === "function" || typeof Blob !== "undefined" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]";
     636  var withNativeArrayBuffer$2 = typeof ArrayBuffer === "function"; // ArrayBuffer.isView method is not defined in IE10
     637
     638  var isView$1 = function isView(obj) {
     639    return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj && obj.buffer instanceof ArrayBuffer;
     640  };
     641
     642  var encodePacket = function encodePacket(_ref, supportsBinary, callback) {
     643    var type = _ref.type,
     644        data = _ref.data;
     645
     646    if (withNativeBlob$1 && data instanceof Blob) {
     647      if (supportsBinary) {
     648        return callback(data);
     649      } else {
     650        return encodeBlobAsBase64(data, callback);
     651      }
     652    } else if (withNativeArrayBuffer$2 && (data instanceof ArrayBuffer || isView$1(data))) {
     653      if (supportsBinary) {
     654        return callback(data);
     655      } else {
     656        return encodeBlobAsBase64(new Blob([data]), callback);
     657      }
     658    } // plain string
     659
     660
     661    return callback(PACKET_TYPES[type] + (data || ""));
     662  };
     663
     664  var encodeBlobAsBase64 = function encodeBlobAsBase64(data, callback) {
     665    var fileReader = new FileReader();
     666
     667    fileReader.onload = function () {
     668      var content = fileReader.result.split(",")[1];
     669      callback("b" + content);
    4619670    };
     671
     672    return fileReader.readAsDataURL(data);
     673  };
     674
     675  /*
     676   * base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
     677   * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
     678   * Released under MIT License
     679   */
     680  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; // Use a lookup table to find the index.
     681
     682  var lookup$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
     683
     684  for (var i$1 = 0; i$1 < chars.length; i$1++) {
     685    lookup$1[chars.charCodeAt(i$1)] = i$1;
    4620686  }
    4621687
    4622   var type = encodedPacket.charAt(0);
    4623 
    4624   if (type === "b") {
    4625     return {
    4626       type: "message",
    4627       data: decodeBase64Packet(encodedPacket.substring(1), binaryType)
    4628     };
    4629   }
    4630 
    4631   var packetType = PACKET_TYPES_REVERSE[type];
    4632 
    4633   if (!packetType) {
    4634     return ERROR_PACKET;
    4635   }
    4636 
    4637   return encodedPacket.length > 1 ? {
    4638     type: PACKET_TYPES_REVERSE[type],
    4639     data: encodedPacket.substring(1)
    4640   } : {
    4641     type: PACKET_TYPES_REVERSE[type]
    4642   };
    4643 };
    4644 
    4645 var decodeBase64Packet = function decodeBase64Packet(data, binaryType) {
    4646   if (base64decoder) {
    4647     var decoded = base64decoder.decode(data);
    4648     return mapBinary(decoded, binaryType);
    4649   } else {
    4650     return {
    4651       base64: true,
    4652       data: data
    4653     }; // fallback for old browsers
    4654   }
    4655 };
    4656 
    4657 var mapBinary = function mapBinary(data, binaryType) {
    4658   switch (binaryType) {
    4659     case "blob":
    4660       return data instanceof ArrayBuffer ? new Blob([data]) : data;
    4661 
    4662     case "arraybuffer":
    4663     default:
    4664       return data;
    4665     // assuming the data is already an ArrayBuffer
    4666   }
    4667 };
    4668 
    4669 module.exports = decodePacket;
    4670 
    4671 /***/ }),
    4672 
    4673 /***/ "./node_modules/engine.io-parser/lib/encodePacket.browser.js":
    4674 /*!*******************************************************************!*\
    4675   !*** ./node_modules/engine.io-parser/lib/encodePacket.browser.js ***!
    4676   \*******************************************************************/
    4677 /*! no static exports found */
    4678 /***/ (function(module, exports, __webpack_require__) {
    4679 
    4680 var _require = __webpack_require__(/*! ./commons */ "./node_modules/engine.io-parser/lib/commons.js"),
    4681     PACKET_TYPES = _require.PACKET_TYPES;
    4682 
    4683 var withNativeBlob = typeof Blob === "function" || typeof Blob !== "undefined" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]";
    4684 var withNativeArrayBuffer = typeof ArrayBuffer === "function"; // ArrayBuffer.isView method is not defined in IE10
    4685 
    4686 var isView = function isView(obj) {
    4687   return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj && obj.buffer instanceof ArrayBuffer;
    4688 };
    4689 
    4690 var encodePacket = function encodePacket(_ref, supportsBinary, callback) {
    4691   var type = _ref.type,
    4692       data = _ref.data;
    4693 
    4694   if (withNativeBlob && data instanceof Blob) {
    4695     if (supportsBinary) {
    4696       return callback(data);
    4697     } else {
    4698       return encodeBlobAsBase64(data, callback);
    4699     }
    4700   } else if (withNativeArrayBuffer && (data instanceof ArrayBuffer || isView(data))) {
    4701     if (supportsBinary) {
    4702       return callback(data instanceof ArrayBuffer ? data : data.buffer);
    4703     } else {
    4704       return encodeBlobAsBase64(new Blob([data]), callback);
    4705     }
    4706   } // plain string
    4707 
    4708 
    4709   return callback(PACKET_TYPES[type] + (data || ""));
    4710 };
    4711 
    4712 var encodeBlobAsBase64 = function encodeBlobAsBase64(data, callback) {
    4713   var fileReader = new FileReader();
    4714 
    4715   fileReader.onload = function () {
    4716     var content = fileReader.result.split(",")[1];
    4717     callback("b" + content);
    4718   };
    4719 
    4720   return fileReader.readAsDataURL(data);
    4721 };
    4722 
    4723 module.exports = encodePacket;
    4724 
    4725 /***/ }),
    4726 
    4727 /***/ "./node_modules/engine.io-parser/lib/index.js":
    4728 /*!****************************************************!*\
    4729   !*** ./node_modules/engine.io-parser/lib/index.js ***!
    4730   \****************************************************/
    4731 /*! no static exports found */
    4732 /***/ (function(module, exports, __webpack_require__) {
    4733 
    4734 var encodePacket = __webpack_require__(/*! ./encodePacket */ "./node_modules/engine.io-parser/lib/encodePacket.browser.js");
    4735 
    4736 var decodePacket = __webpack_require__(/*! ./decodePacket */ "./node_modules/engine.io-parser/lib/decodePacket.browser.js");
    4737 
    4738 var SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text
    4739 
    4740 var encodePayload = function encodePayload(packets, callback) {
    4741   // some packets may be added to the array while encoding, so the initial length must be saved
    4742   var length = packets.length;
    4743   var encodedPackets = new Array(length);
    4744   var count = 0;
    4745   packets.forEach(function (packet, i) {
    4746     // force base64 encoding for binary packets
    4747     encodePacket(packet, false, function (encodedPacket) {
    4748       encodedPackets[i] = encodedPacket;
    4749 
    4750       if (++count === length) {
    4751         callback(encodedPackets.join(SEPARATOR));
    4752       }
    4753     });
    4754   });
    4755 };
    4756 
    4757 var decodePayload = function decodePayload(encodedPayload, binaryType) {
    4758   var encodedPackets = encodedPayload.split(SEPARATOR);
    4759   var packets = [];
    4760 
    4761   for (var i = 0; i < encodedPackets.length; i++) {
    4762     var decodedPacket = decodePacket(encodedPackets[i], binaryType);
    4763     packets.push(decodedPacket);
    4764 
    4765     if (decodedPacket.type === "error") {
    4766       break;
    4767     }
    4768   }
    4769 
    4770   return packets;
    4771 };
    4772 
    4773 module.exports = {
    4774   protocol: 4,
    4775   encodePacket: encodePacket,
    4776   encodePayload: encodePayload,
    4777   decodePacket: decodePacket,
    4778   decodePayload: decodePayload
    4779 };
    4780 
    4781 /***/ }),
    4782 
    4783 /***/ "./node_modules/engine.io-parser/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js":
    4784 /*!*************************************************************************************************!*\
    4785   !*** ./node_modules/engine.io-parser/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js ***!
    4786   \*************************************************************************************************/
    4787 /*! no static exports found */
    4788 /***/ (function(module, exports) {
    4789 
    4790 /*
    4791  * base64-arraybuffer
    4792  * https://github.com/niklasvh/base64-arraybuffer
    4793  *
    4794  * Copyright (c) 2012 Niklas von Hertzen
    4795  * Licensed under the MIT license.
    4796  */
    4797 (function (chars) {
    4798   "use strict";
    4799 
    4800   exports.encode = function (arraybuffer) {
    4801     var bytes = new Uint8Array(arraybuffer),
    4802         i,
    4803         len = bytes.length,
    4804         base64 = "";
    4805 
    4806     for (i = 0; i < len; i += 3) {
    4807       base64 += chars[bytes[i] >> 2];
    4808       base64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];
    4809       base64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];
    4810       base64 += chars[bytes[i + 2] & 63];
    4811     }
    4812 
    4813     if (len % 3 === 2) {
    4814       base64 = base64.substring(0, base64.length - 1) + "=";
    4815     } else if (len % 3 === 1) {
    4816       base64 = base64.substring(0, base64.length - 2) + "==";
    4817     }
    4818 
    4819     return base64;
    4820   };
    4821 
    4822   exports.decode = function (base64) {
     688  var decode$1 = function decode(base64) {
    4823689    var bufferLength = base64.length * 0.75,
    4824690        len = base64.length,
     
    4830696        encoded4;
    4831697
    4832     if (base64[base64.length - 1] === "=") {
     698    if (base64[base64.length - 1] === '=') {
    4833699      bufferLength--;
    4834700
    4835       if (base64[base64.length - 2] === "=") {
     701      if (base64[base64.length - 2] === '=') {
    4836702        bufferLength--;
    4837703      }
     
    4842708
    4843709    for (i = 0; i < len; i += 4) {
    4844       encoded1 = chars.indexOf(base64[i]);
    4845       encoded2 = chars.indexOf(base64[i + 1]);
    4846       encoded3 = chars.indexOf(base64[i + 2]);
    4847       encoded4 = chars.indexOf(base64[i + 3]);
     710      encoded1 = lookup$1[base64.charCodeAt(i)];
     711      encoded2 = lookup$1[base64.charCodeAt(i + 1)];
     712      encoded3 = lookup$1[base64.charCodeAt(i + 2)];
     713      encoded4 = lookup$1[base64.charCodeAt(i + 3)];
    4848714      bytes[p++] = encoded1 << 2 | encoded2 >> 4;
    4849715      bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
     
    4853719    return arraybuffer;
    4854720  };
    4855 })("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
    4856 
    4857 /***/ }),
    4858 
    4859 /***/ "./node_modules/has-cors/index.js":
    4860 /*!****************************************!*\
    4861   !*** ./node_modules/has-cors/index.js ***!
    4862   \****************************************/
    4863 /*! no static exports found */
    4864 /***/ (function(module, exports) {
    4865 
    4866 /**
    4867  * Module exports.
    4868  *
    4869  * Logic borrowed from Modernizr:
    4870  *
    4871  *   - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
    4872  */
    4873 try {
    4874   module.exports = typeof XMLHttpRequest !== 'undefined' && 'withCredentials' in new XMLHttpRequest();
    4875 } catch (err) {
    4876   // if XMLHttp support is disabled in IE then it will throw
    4877   // when trying to create
    4878   module.exports = false;
    4879 }
    4880 
    4881 /***/ }),
    4882 
    4883 /***/ "./node_modules/ms/index.js":
    4884 /*!**********************************!*\
    4885   !*** ./node_modules/ms/index.js ***!
    4886   \**********************************/
    4887 /*! no static exports found */
    4888 /***/ (function(module, exports) {
    4889 
    4890 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    4891 
    4892 /**
    4893  * Helpers.
    4894  */
    4895 var s = 1000;
    4896 var m = s * 60;
    4897 var h = m * 60;
    4898 var d = h * 24;
    4899 var w = d * 7;
    4900 var y = d * 365.25;
    4901 /**
    4902  * Parse or format the given `val`.
    4903  *
    4904  * Options:
    4905  *
    4906  *  - `long` verbose formatting [false]
    4907  *
    4908  * @param {String|Number} val
    4909  * @param {Object} [options]
    4910  * @throws {Error} throw an error if val is not a non-empty string or a number
    4911  * @return {String|Number}
    4912  * @api public
    4913  */
    4914 
    4915 module.exports = function (val, options) {
    4916   options = options || {};
    4917 
    4918   var type = _typeof(val);
    4919 
    4920   if (type === 'string' && val.length > 0) {
    4921     return parse(val);
    4922   } else if (type === 'number' && isFinite(val)) {
    4923     return options["long"] ? fmtLong(val) : fmtShort(val);
    4924   }
    4925 
    4926   throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
    4927 };
    4928 /**
    4929  * Parse the given `str` and return milliseconds.
    4930  *
    4931  * @param {String} str
    4932  * @return {Number}
    4933  * @api private
    4934  */
    4935 
    4936 
    4937 function parse(str) {
    4938   str = String(str);
    4939 
    4940   if (str.length > 100) {
    4941     return;
    4942   }
    4943 
    4944   var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
    4945 
    4946   if (!match) {
    4947     return;
    4948   }
    4949 
    4950   var n = parseFloat(match[1]);
    4951   var type = (match[2] || 'ms').toLowerCase();
    4952 
    4953   switch (type) {
    4954     case 'years':
    4955     case 'year':
    4956     case 'yrs':
    4957     case 'yr':
    4958     case 'y':
    4959       return n * y;
    4960 
    4961     case 'weeks':
    4962     case 'week':
    4963     case 'w':
    4964       return n * w;
    4965 
    4966     case 'days':
    4967     case 'day':
    4968     case 'd':
    4969       return n * d;
    4970 
    4971     case 'hours':
    4972     case 'hour':
    4973     case 'hrs':
    4974     case 'hr':
    4975     case 'h':
    4976       return n * h;
    4977 
    4978     case 'minutes':
    4979     case 'minute':
    4980     case 'mins':
    4981     case 'min':
    4982     case 'm':
    4983       return n * m;
    4984 
    4985     case 'seconds':
    4986     case 'second':
    4987     case 'secs':
    4988     case 'sec':
    4989     case 's':
    4990       return n * s;
    4991 
    4992     case 'milliseconds':
    4993     case 'millisecond':
    4994     case 'msecs':
    4995     case 'msec':
    4996     case 'ms':
    4997       return n;
    4998 
    4999     default:
    5000       return undefined;
    5001   }
    5002 }
    5003 /**
    5004  * Short format for `ms`.
    5005  *
    5006  * @param {Number} ms
    5007  * @return {String}
    5008  * @api private
    5009  */
    5010 
    5011 
    5012 function fmtShort(ms) {
    5013   var msAbs = Math.abs(ms);
    5014 
    5015   if (msAbs >= d) {
    5016     return Math.round(ms / d) + 'd';
    5017   }
    5018 
    5019   if (msAbs >= h) {
    5020     return Math.round(ms / h) + 'h';
    5021   }
    5022 
    5023   if (msAbs >= m) {
    5024     return Math.round(ms / m) + 'm';
    5025   }
    5026 
    5027   if (msAbs >= s) {
    5028     return Math.round(ms / s) + 's';
    5029   }
    5030 
    5031   return ms + 'ms';
    5032 }
    5033 /**
    5034  * Long format for `ms`.
    5035  *
    5036  * @param {Number} ms
    5037  * @return {String}
    5038  * @api private
    5039  */
    5040 
    5041 
    5042 function fmtLong(ms) {
    5043   var msAbs = Math.abs(ms);
    5044 
    5045   if (msAbs >= d) {
    5046     return plural(ms, msAbs, d, 'day');
    5047   }
    5048 
    5049   if (msAbs >= h) {
    5050     return plural(ms, msAbs, h, 'hour');
    5051   }
    5052 
    5053   if (msAbs >= m) {
    5054     return plural(ms, msAbs, m, 'minute');
    5055   }
    5056 
    5057   if (msAbs >= s) {
    5058     return plural(ms, msAbs, s, 'second');
    5059   }
    5060 
    5061   return ms + ' ms';
    5062 }
    5063 /**
    5064  * Pluralization helper.
    5065  */
    5066 
    5067 
    5068 function plural(ms, msAbs, n, name) {
    5069   var isPlural = msAbs >= n * 1.5;
    5070   return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
    5071 }
    5072 
    5073 /***/ }),
    5074 
    5075 /***/ "./node_modules/parseqs/index.js":
    5076 /*!***************************************!*\
    5077   !*** ./node_modules/parseqs/index.js ***!
    5078   \***************************************/
    5079 /*! no static exports found */
    5080 /***/ (function(module, exports) {
    5081 
    5082 /**
    5083  * Compiles a querystring
    5084  * Returns string representation of the object
    5085  *
    5086  * @param {Object}
    5087  * @api private
    5088  */
    5089 exports.encode = function (obj) {
    5090   var str = '';
    5091 
    5092   for (var i in obj) {
    5093     if (obj.hasOwnProperty(i)) {
    5094       if (str.length) str += '&';
    5095       str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);
    5096     }
    5097   }
    5098 
    5099   return str;
    5100 };
    5101 /**
    5102  * Parses a simple querystring into an object
    5103  *
    5104  * @param {String} qs
    5105  * @api private
    5106  */
    5107 
    5108 
    5109 exports.decode = function (qs) {
    5110   var qry = {};
    5111   var pairs = qs.split('&');
    5112 
    5113   for (var i = 0, l = pairs.length; i < l; i++) {
    5114     var pair = pairs[i].split('=');
    5115     qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
    5116   }
    5117 
    5118   return qry;
    5119 };
    5120 
    5121 /***/ }),
    5122 
    5123 /***/ "./node_modules/parseuri/index.js":
    5124 /*!****************************************!*\
    5125   !*** ./node_modules/parseuri/index.js ***!
    5126   \****************************************/
    5127 /*! no static exports found */
    5128 /***/ (function(module, exports) {
    5129 
    5130 /**
    5131  * Parses an URI
    5132  *
    5133  * @author Steven Levithan <stevenlevithan.com> (MIT license)
    5134  * @api private
    5135  */
    5136 var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
    5137 var parts = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'];
    5138 
    5139 module.exports = function parseuri(str) {
    5140   var src = str,
    5141       b = str.indexOf('['),
    5142       e = str.indexOf(']');
    5143 
    5144   if (b != -1 && e != -1) {
    5145     str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);
    5146   }
    5147 
    5148   var m = re.exec(str || ''),
    5149       uri = {},
    5150       i = 14;
    5151 
    5152   while (i--) {
    5153     uri[parts[i]] = m[i] || '';
    5154   }
    5155 
    5156   if (b != -1 && e != -1) {
    5157     uri.source = src;
    5158     uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');
    5159     uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');
    5160     uri.ipv6uri = true;
    5161   }
    5162 
    5163   uri.pathNames = pathNames(uri, uri['path']);
    5164   uri.queryKey = queryKey(uri, uri['query']);
    5165   return uri;
    5166 };
    5167 
    5168 function pathNames(obj, path) {
    5169   var regx = /\/{2,9}/g,
    5170       names = path.replace(regx, "/").split("/");
    5171 
    5172   if (path.substr(0, 1) == '/' || path.length === 0) {
    5173     names.splice(0, 1);
    5174   }
    5175 
    5176   if (path.substr(path.length - 1, 1) == '/') {
    5177     names.splice(names.length - 1, 1);
    5178   }
    5179 
    5180   return names;
    5181 }
    5182 
    5183 function queryKey(uri, query) {
    5184   var data = {};
    5185   query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, $1, $2) {
    5186     if ($1) {
    5187       data[$1] = $2;
    5188     }
    5189   });
    5190   return data;
    5191 }
    5192 
    5193 /***/ }),
    5194 
    5195 /***/ "./node_modules/socket.io-parser/dist/binary.js":
    5196 /*!******************************************************!*\
    5197   !*** ./node_modules/socket.io-parser/dist/binary.js ***!
    5198   \******************************************************/
    5199 /*! no static exports found */
    5200 /***/ (function(module, exports, __webpack_require__) {
    5201 
    5202 "use strict";
    5203 
    5204 
    5205 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    5206 
    5207 Object.defineProperty(exports, "__esModule", {
    5208   value: true
    5209 });
    5210 exports.reconstructPacket = exports.deconstructPacket = void 0;
    5211 
    5212 var is_binary_1 = __webpack_require__(/*! ./is-binary */ "./node_modules/socket.io-parser/dist/is-binary.js");
    5213 /**
    5214  * Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.
    5215  *
    5216  * @param {Object} packet - socket.io event packet
    5217  * @return {Object} with deconstructed packet and list of buffers
    5218  * @public
    5219  */
    5220 
    5221 
    5222 function deconstructPacket(packet) {
    5223   var buffers = [];
    5224   var packetData = packet.data;
    5225   var pack = packet;
    5226   pack.data = _deconstructPacket(packetData, buffers);
    5227   pack.attachments = buffers.length; // number of binary 'attachments'
    5228 
    5229   return {
    5230     packet: pack,
    5231     buffers: buffers
     721
     722  var withNativeArrayBuffer$1 = typeof ArrayBuffer === "function";
     723
     724  var decodePacket = function decodePacket(encodedPacket, binaryType) {
     725    if (typeof encodedPacket !== "string") {
     726      return {
     727        type: "message",
     728        data: mapBinary(encodedPacket, binaryType)
     729      };
     730    }
     731
     732    var type = encodedPacket.charAt(0);
     733
     734    if (type === "b") {
     735      return {
     736        type: "message",
     737        data: decodeBase64Packet(encodedPacket.substring(1), binaryType)
     738      };
     739    }
     740
     741    var packetType = PACKET_TYPES_REVERSE[type];
     742
     743    if (!packetType) {
     744      return ERROR_PACKET;
     745    }
     746
     747    return encodedPacket.length > 1 ? {
     748      type: PACKET_TYPES_REVERSE[type],
     749      data: encodedPacket.substring(1)
     750    } : {
     751      type: PACKET_TYPES_REVERSE[type]
     752    };
    5232753  };
    5233 }
    5234 
    5235 exports.deconstructPacket = deconstructPacket;
    5236 
    5237 function _deconstructPacket(data, buffers) {
    5238   if (!data) return data;
    5239 
    5240   if (is_binary_1.isBinary(data)) {
    5241     var placeholder = {
    5242       _placeholder: true,
    5243       num: buffers.length
    5244     };
    5245     buffers.push(data);
    5246     return placeholder;
    5247   } else if (Array.isArray(data)) {
    5248     var newData = new Array(data.length);
    5249 
    5250     for (var i = 0; i < data.length; i++) {
    5251       newData[i] = _deconstructPacket(data[i], buffers);
    5252     }
    5253 
    5254     return newData;
    5255   } else if (_typeof(data) === "object" && !(data instanceof Date)) {
    5256     var _newData = {};
    5257 
    5258     for (var key in data) {
    5259       if (data.hasOwnProperty(key)) {
    5260         _newData[key] = _deconstructPacket(data[key], buffers);
    5261       }
    5262     }
    5263 
    5264     return _newData;
    5265   }
    5266 
    5267   return data;
    5268 }
    5269 /**
    5270  * Reconstructs a binary packet from its placeholder packet and buffers
    5271  *
    5272  * @param {Object} packet - event packet with placeholders
    5273  * @param {Array} buffers - binary buffers to put in placeholder positions
    5274  * @return {Object} reconstructed packet
    5275  * @public
    5276  */
    5277 
    5278 
    5279 function reconstructPacket(packet, buffers) {
    5280   packet.data = _reconstructPacket(packet.data, buffers);
    5281   packet.attachments = undefined; // no longer useful
    5282 
    5283   return packet;
    5284 }
    5285 
    5286 exports.reconstructPacket = reconstructPacket;
    5287 
    5288 function _reconstructPacket(data, buffers) {
    5289   if (!data) return data;
    5290 
    5291   if (data && data._placeholder) {
    5292     return buffers[data.num]; // appropriate buffer (should be natural order anyway)
    5293   } else if (Array.isArray(data)) {
    5294     for (var i = 0; i < data.length; i++) {
    5295       data[i] = _reconstructPacket(data[i], buffers);
    5296     }
    5297   } else if (_typeof(data) === "object") {
    5298     for (var key in data) {
    5299       if (data.hasOwnProperty(key)) {
    5300         data[key] = _reconstructPacket(data[key], buffers);
    5301       }
    5302     }
    5303   }
    5304 
    5305   return data;
    5306 }
    5307 
    5308 /***/ }),
    5309 
    5310 /***/ "./node_modules/socket.io-parser/dist/index.js":
    5311 /*!*****************************************************!*\
    5312   !*** ./node_modules/socket.io-parser/dist/index.js ***!
    5313   \*****************************************************/
    5314 /*! no static exports found */
    5315 /***/ (function(module, exports, __webpack_require__) {
    5316 
    5317 "use strict";
    5318 
    5319 
    5320 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    5321 
    5322 function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
    5323 
    5324 function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
    5325 
    5326 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
    5327 
    5328 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    5329 
    5330 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
    5331 
    5332 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
    5333 
    5334 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
    5335 
    5336 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
    5337 
    5338 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
    5339 
    5340 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    5341 
    5342 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
    5343 
    5344 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    5345 
    5346 Object.defineProperty(exports, "__esModule", {
    5347   value: true
    5348 });
    5349 exports.Decoder = exports.Encoder = exports.PacketType = exports.protocol = void 0;
    5350 
    5351 var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
    5352 
    5353 var binary_1 = __webpack_require__(/*! ./binary */ "./node_modules/socket.io-parser/dist/binary.js");
    5354 
    5355 var is_binary_1 = __webpack_require__(/*! ./is-binary */ "./node_modules/socket.io-parser/dist/is-binary.js");
    5356 
    5357 var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("socket.io-parser");
    5358 /**
    5359  * Protocol version.
    5360  *
    5361  * @public
    5362  */
    5363 
    5364 
    5365 exports.protocol = 5;
    5366 var PacketType;
    5367 
    5368 (function (PacketType) {
    5369   PacketType[PacketType["CONNECT"] = 0] = "CONNECT";
    5370   PacketType[PacketType["DISCONNECT"] = 1] = "DISCONNECT";
    5371   PacketType[PacketType["EVENT"] = 2] = "EVENT";
    5372   PacketType[PacketType["ACK"] = 3] = "ACK";
    5373   PacketType[PacketType["CONNECT_ERROR"] = 4] = "CONNECT_ERROR";
    5374   PacketType[PacketType["BINARY_EVENT"] = 5] = "BINARY_EVENT";
    5375   PacketType[PacketType["BINARY_ACK"] = 6] = "BINARY_ACK";
    5376 })(PacketType = exports.PacketType || (exports.PacketType = {}));
    5377 /**
    5378  * A socket.io Encoder instance
    5379  */
    5380 
    5381 
    5382 var Encoder = /*#__PURE__*/function () {
    5383   function Encoder() {
    5384     _classCallCheck(this, Encoder);
    5385   }
    5386 
    5387   _createClass(Encoder, [{
    5388     key: "encode",
     754
     755  var decodeBase64Packet = function decodeBase64Packet(data, binaryType) {
     756    if (withNativeArrayBuffer$1) {
     757      var decoded = decode$1(data);
     758      return mapBinary(decoded, binaryType);
     759    } else {
     760      return {
     761        base64: true,
     762        data: data
     763      }; // fallback for old browsers
     764    }
     765  };
     766
     767  var mapBinary = function mapBinary(data, binaryType) {
     768    switch (binaryType) {
     769      case "blob":
     770        return data instanceof ArrayBuffer ? new Blob([data]) : data;
     771
     772      case "arraybuffer":
     773      default:
     774        return data;
     775      // assuming the data is already an ArrayBuffer
     776    }
     777  };
     778
     779  var SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text
     780
     781  var encodePayload = function encodePayload(packets, callback) {
     782    // some packets may be added to the array while encoding, so the initial length must be saved
     783    var length = packets.length;
     784    var encodedPackets = new Array(length);
     785    var count = 0;
     786    packets.forEach(function (packet, i) {
     787      // force base64 encoding for binary packets
     788      encodePacket(packet, false, function (encodedPacket) {
     789        encodedPackets[i] = encodedPacket;
     790
     791        if (++count === length) {
     792          callback(encodedPackets.join(SEPARATOR));
     793        }
     794      });
     795    });
     796  };
     797
     798  var decodePayload = function decodePayload(encodedPayload, binaryType) {
     799    var encodedPackets = encodedPayload.split(SEPARATOR);
     800    var packets = [];
     801
     802    for (var i = 0; i < encodedPackets.length; i++) {
     803      var decodedPacket = decodePacket(encodedPackets[i], binaryType);
     804      packets.push(decodedPacket);
     805
     806      if (decodedPacket.type === "error") {
     807        break;
     808      }
     809    }
     810
     811    return packets;
     812  };
     813
     814  var protocol$1 = 4;
     815
     816  var Transport = /*#__PURE__*/function (_Emitter) {
     817    _inherits(Transport, _Emitter);
     818
     819    var _super = _createSuper(Transport);
    5389820
    5390821    /**
    5391      * Encode a packet as a single string if non-binary, or as a
    5392      * buffer sequence, depending on packet type.
     822     * Transport abstract constructor.
    5393823     *
    5394      * @param {Object} obj - packet object
     824     * @param {Object} options.
     825     * @api private
    5395826     */
    5396     value: function encode(obj) {
    5397       debug("encoding packet %j", obj);
    5398 
    5399       if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {
    5400         if (is_binary_1.hasBinary(obj)) {
    5401           obj.type = obj.type === PacketType.EVENT ? PacketType.BINARY_EVENT : PacketType.BINARY_ACK;
    5402           return this.encodeAsBinary(obj);
    5403         }
    5404       }
    5405 
    5406       return [this.encodeAsString(obj)];
     827    function Transport(opts) {
     828      var _this;
     829
     830      _classCallCheck(this, Transport);
     831
     832      _this = _super.call(this);
     833      _this.writable = false;
     834      installTimerFunctions(_assertThisInitialized(_this), opts);
     835      _this.opts = opts;
     836      _this.query = opts.query;
     837      _this.readyState = "";
     838      _this.socket = opts.socket;
     839      return _this;
    5407840    }
    5408841    /**
    5409      * Encode packet as string.
     842     * Emits an error.
     843     *
     844     * @param {String} str
     845     * @return {Transport} for chaining
     846     * @api protected
    5410847     */
    5411848
    5412   }, {
    5413     key: "encodeAsString",
    5414     value: function encodeAsString(obj) {
    5415       // first is type
    5416       var str = "" + obj.type; // attachments if we have them
    5417 
    5418       if (obj.type === PacketType.BINARY_EVENT || obj.type === PacketType.BINARY_ACK) {
    5419         str += obj.attachments + "-";
    5420       } // if we have a namespace other than `/`
    5421       // we append it followed by a comma `,`
    5422 
    5423 
    5424       if (obj.nsp && "/" !== obj.nsp) {
    5425         str += obj.nsp + ",";
    5426       } // immediately followed by the id
    5427 
    5428 
    5429       if (null != obj.id) {
    5430         str += obj.id;
    5431       } // json data
    5432 
    5433 
    5434       if (null != obj.data) {
    5435         str += JSON.stringify(obj.data);
    5436       }
    5437 
    5438       debug("encoded %j as %s", obj, str);
    5439       return str;
    5440     }
    5441     /**
    5442      * Encode packet as 'buffer sequence' by removing blobs, and
    5443      * deconstructing packet into object with placeholders and
    5444      * a list of buffers.
    5445      */
    5446 
    5447   }, {
    5448     key: "encodeAsBinary",
    5449     value: function encodeAsBinary(obj) {
    5450       var deconstruction = binary_1.deconstructPacket(obj);
    5451       var pack = this.encodeAsString(deconstruction.packet);
    5452       var buffers = deconstruction.buffers;
    5453       buffers.unshift(pack); // add packet info to beginning of data list
    5454 
    5455       return buffers; // write all the buffers
    5456     }
    5457   }]);
    5458 
    5459   return Encoder;
    5460 }();
    5461 
    5462 exports.Encoder = Encoder;
    5463 /**
    5464  * A socket.io Decoder instance
    5465  *
    5466  * @return {Object} decoder
    5467  */
    5468 
    5469 var Decoder = /*#__PURE__*/function (_Emitter) {
    5470   _inherits(Decoder, _Emitter);
    5471 
    5472   var _super = _createSuper(Decoder);
    5473 
    5474   function Decoder() {
    5475     _classCallCheck(this, Decoder);
    5476 
    5477     return _super.call(this);
     849
     850    _createClass(Transport, [{
     851      key: "onError",
     852      value: function onError(msg, desc) {
     853        var err = new Error(msg); // @ts-ignore
     854
     855        err.type = "TransportError"; // @ts-ignore
     856
     857        err.description = desc;
     858
     859        _get(_getPrototypeOf(Transport.prototype), "emit", this).call(this, "error", err);
     860
     861        return this;
     862      }
     863      /**
     864       * Opens the transport.
     865       *
     866       * @api public
     867       */
     868
     869    }, {
     870      key: "open",
     871      value: function open() {
     872        if ("closed" === this.readyState || "" === this.readyState) {
     873          this.readyState = "opening";
     874          this.doOpen();
     875        }
     876
     877        return this;
     878      }
     879      /**
     880       * Closes the transport.
     881       *
     882       * @api public
     883       */
     884
     885    }, {
     886      key: "close",
     887      value: function close() {
     888        if ("opening" === this.readyState || "open" === this.readyState) {
     889          this.doClose();
     890          this.onClose();
     891        }
     892
     893        return this;
     894      }
     895      /**
     896       * Sends multiple packets.
     897       *
     898       * @param {Array} packets
     899       * @api public
     900       */
     901
     902    }, {
     903      key: "send",
     904      value: function send(packets) {
     905        if ("open" === this.readyState) {
     906          this.write(packets);
     907        }
     908      }
     909      /**
     910       * Called upon open
     911       *
     912       * @api protected
     913       */
     914
     915    }, {
     916      key: "onOpen",
     917      value: function onOpen() {
     918        this.readyState = "open";
     919        this.writable = true;
     920
     921        _get(_getPrototypeOf(Transport.prototype), "emit", this).call(this, "open");
     922      }
     923      /**
     924       * Called with data.
     925       *
     926       * @param {String} data
     927       * @api protected
     928       */
     929
     930    }, {
     931      key: "onData",
     932      value: function onData(data) {
     933        var packet = decodePacket(data, this.socket.binaryType);
     934        this.onPacket(packet);
     935      }
     936      /**
     937       * Called with a decoded packet.
     938       *
     939       * @api protected
     940       */
     941
     942    }, {
     943      key: "onPacket",
     944      value: function onPacket(packet) {
     945        _get(_getPrototypeOf(Transport.prototype), "emit", this).call(this, "packet", packet);
     946      }
     947      /**
     948       * Called upon close.
     949       *
     950       * @api protected
     951       */
     952
     953    }, {
     954      key: "onClose",
     955      value: function onClose() {
     956        this.readyState = "closed";
     957
     958        _get(_getPrototypeOf(Transport.prototype), "emit", this).call(this, "close");
     959      }
     960    }]);
     961
     962    return Transport;
     963  }(Emitter_1);
     964
     965  var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split(''),
     966      length = 64,
     967      map = {},
     968      seed = 0,
     969      i = 0,
     970      prev;
     971  /**
     972   * Return a string representing the specified number.
     973   *
     974   * @param {Number} num The number to convert.
     975   * @returns {String} The string representation of the number.
     976   * @api public
     977   */
     978
     979  function encode(num) {
     980    var encoded = '';
     981
     982    do {
     983      encoded = alphabet[num % length] + encoded;
     984      num = Math.floor(num / length);
     985    } while (num > 0);
     986
     987    return encoded;
    5478988  }
    5479989  /**
    5480    * Decodes an encoded packet string into packet JSON.
     990   * Return the integer value specified by the given string.
    5481991   *
    5482    * @param {String} obj - encoded packet
     992   * @param {String} str The string to convert.
     993   * @returns {Number} The integer value represented by the string.
     994   * @api public
    5483995   */
    5484996
    5485997
    5486   _createClass(Decoder, [{
    5487     key: "add",
    5488     value: function add(obj) {
    5489       var packet;
    5490 
    5491       if (typeof obj === "string") {
    5492         packet = this.decodeString(obj);
    5493 
    5494         if (packet.type === PacketType.BINARY_EVENT || packet.type === PacketType.BINARY_ACK) {
    5495           // binary packet's json
    5496           this.reconstructor = new BinaryReconstructor(packet); // no attachments, labeled binary but no binary data to follow
    5497 
    5498           if (packet.attachments === 0) {
    5499             _get(_getPrototypeOf(Decoder.prototype), "emit", this).call(this, "decoded", packet);
     998  function decode(str) {
     999    var decoded = 0;
     1000
     1001    for (i = 0; i < str.length; i++) {
     1002      decoded = decoded * length + map[str.charAt(i)];
     1003    }
     1004
     1005    return decoded;
     1006  }
     1007  /**
     1008   * Yeast: A tiny growing id generator.
     1009   *
     1010   * @returns {String} A unique id.
     1011   * @api public
     1012   */
     1013
     1014
     1015  function yeast() {
     1016    var now = encode(+new Date());
     1017    if (now !== prev) return seed = 0, prev = now;
     1018    return now + '.' + encode(seed++);
     1019  } //
     1020  // Map each character to its index.
     1021  //
     1022
     1023
     1024  for (; i < length; i++) {
     1025    map[alphabet[i]] = i;
     1026  } //
     1027  // Expose the `yeast`, `encode` and `decode` functions.
     1028  //
     1029
     1030
     1031  yeast.encode = encode;
     1032  yeast.decode = decode;
     1033  var yeast_1 = yeast;
     1034
     1035  var parseqs = {};
     1036
     1037  /**
     1038   * Compiles a querystring
     1039   * Returns string representation of the object
     1040   *
     1041   * @param {Object}
     1042   * @api private
     1043   */
     1044
     1045  parseqs.encode = function (obj) {
     1046    var str = '';
     1047
     1048    for (var i in obj) {
     1049      if (obj.hasOwnProperty(i)) {
     1050        if (str.length) str += '&';
     1051        str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);
     1052      }
     1053    }
     1054
     1055    return str;
     1056  };
     1057  /**
     1058   * Parses a simple querystring into an object
     1059   *
     1060   * @param {String} qs
     1061   * @api private
     1062   */
     1063
     1064
     1065  parseqs.decode = function (qs) {
     1066    var qry = {};
     1067    var pairs = qs.split('&');
     1068
     1069    for (var i = 0, l = pairs.length; i < l; i++) {
     1070      var pair = pairs[i].split('=');
     1071      qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
     1072    }
     1073
     1074    return qry;
     1075  };
     1076
     1077  var Polling = /*#__PURE__*/function (_Transport) {
     1078    _inherits(Polling, _Transport);
     1079
     1080    var _super = _createSuper(Polling);
     1081
     1082    function Polling() {
     1083      var _this;
     1084
     1085      _classCallCheck(this, Polling);
     1086
     1087      _this = _super.apply(this, arguments);
     1088      _this.polling = false;
     1089      return _this;
     1090    }
     1091    /**
     1092     * Transport name.
     1093     */
     1094
     1095
     1096    _createClass(Polling, [{
     1097      key: "name",
     1098      get: function get() {
     1099        return "polling";
     1100      }
     1101      /**
     1102       * Opens the socket (triggers polling). We write a PING message to determine
     1103       * when the transport is open.
     1104       *
     1105       * @api private
     1106       */
     1107
     1108    }, {
     1109      key: "doOpen",
     1110      value: function doOpen() {
     1111        this.poll();
     1112      }
     1113      /**
     1114       * Pauses polling.
     1115       *
     1116       * @param {Function} callback upon buffers are flushed and transport is paused
     1117       * @api private
     1118       */
     1119
     1120    }, {
     1121      key: "pause",
     1122      value: function pause(onPause) {
     1123        var _this2 = this;
     1124
     1125        this.readyState = "pausing";
     1126
     1127        var pause = function pause() {
     1128          _this2.readyState = "paused";
     1129          onPause();
     1130        };
     1131
     1132        if (this.polling || !this.writable) {
     1133          var total = 0;
     1134
     1135          if (this.polling) {
     1136            total++;
     1137            this.once("pollComplete", function () {
     1138              --total || pause();
     1139            });
     1140          }
     1141
     1142          if (!this.writable) {
     1143            total++;
     1144            this.once("drain", function () {
     1145              --total || pause();
     1146            });
    55001147          }
    55011148        } else {
    5502           // non-binary full packet
    5503           _get(_getPrototypeOf(Decoder.prototype), "emit", this).call(this, "decoded", packet);
    5504         }
    5505       } else if (is_binary_1.isBinary(obj) || obj.base64) {
    5506         // raw binary data
    5507         if (!this.reconstructor) {
    5508           throw new Error("got binary data when not reconstructing a packet");
     1149          pause();
     1150        }
     1151      }
     1152      /**
     1153       * Starts polling cycle.
     1154       *
     1155       * @api public
     1156       */
     1157
     1158    }, {
     1159      key: "poll",
     1160      value: function poll() {
     1161        this.polling = true;
     1162        this.doPoll();
     1163        this.emit("poll");
     1164      }
     1165      /**
     1166       * Overloads onData to detect payloads.
     1167       *
     1168       * @api private
     1169       */
     1170
     1171    }, {
     1172      key: "onData",
     1173      value: function onData(data) {
     1174        var _this3 = this;
     1175
     1176        var callback = function callback(packet) {
     1177          // if its the first message we consider the transport open
     1178          if ("opening" === _this3.readyState && packet.type === "open") {
     1179            _this3.onOpen();
     1180          } // if its a close packet, we close the ongoing requests
     1181
     1182
     1183          if ("close" === packet.type) {
     1184            _this3.onClose();
     1185
     1186            return false;
     1187          } // otherwise bypass onData and handle the message
     1188
     1189
     1190          _this3.onPacket(packet);
     1191        }; // decode payload
     1192
     1193
     1194        decodePayload(data, this.socket.binaryType).forEach(callback); // if an event did not trigger closing
     1195
     1196        if ("closed" !== this.readyState) {
     1197          // if we got data we're not polling
     1198          this.polling = false;
     1199          this.emit("pollComplete");
     1200
     1201          if ("open" === this.readyState) {
     1202            this.poll();
     1203          }
     1204        }
     1205      }
     1206      /**
     1207       * For polling, send a close packet.
     1208       *
     1209       * @api private
     1210       */
     1211
     1212    }, {
     1213      key: "doClose",
     1214      value: function doClose() {
     1215        var _this4 = this;
     1216
     1217        var close = function close() {
     1218          _this4.write([{
     1219            type: "close"
     1220          }]);
     1221        };
     1222
     1223        if ("open" === this.readyState) {
     1224          close();
    55091225        } else {
    5510           packet = this.reconstructor.takeBinaryData(obj);
    5511 
    5512           if (packet) {
    5513             // received final buffer
    5514             this.reconstructor = null;
    5515 
    5516             _get(_getPrototypeOf(Decoder.prototype), "emit", this).call(this, "decoded", packet);
     1226          // in case we're trying to close while
     1227          // handshaking is in progress (GH-164)
     1228          this.once("open", close);
     1229        }
     1230      }
     1231      /**
     1232       * Writes a packets payload.
     1233       *
     1234       * @param {Array} data packets
     1235       * @param {Function} drain callback
     1236       * @api private
     1237       */
     1238
     1239    }, {
     1240      key: "write",
     1241      value: function write(packets) {
     1242        var _this5 = this;
     1243
     1244        this.writable = false;
     1245        encodePayload(packets, function (data) {
     1246          _this5.doWrite(data, function () {
     1247            _this5.writable = true;
     1248
     1249            _this5.emit("drain");
     1250          });
     1251        });
     1252      }
     1253      /**
     1254       * Generates uri for connection.
     1255       *
     1256       * @api private
     1257       */
     1258
     1259    }, {
     1260      key: "uri",
     1261      value: function uri() {
     1262        var query = this.query || {};
     1263        var schema = this.opts.secure ? "https" : "http";
     1264        var port = ""; // cache busting is forced
     1265
     1266        if (false !== this.opts.timestampRequests) {
     1267          query[this.opts.timestampParam] = yeast_1();
     1268        }
     1269
     1270        if (!this.supportsBinary && !query.sid) {
     1271          query.b64 = 1;
     1272        } // avoid port if default for schema
     1273
     1274
     1275        if (this.opts.port && ("https" === schema && Number(this.opts.port) !== 443 || "http" === schema && Number(this.opts.port) !== 80)) {
     1276          port = ":" + this.opts.port;
     1277        }
     1278
     1279        var encodedQuery = parseqs.encode(query);
     1280        var ipv6 = this.opts.hostname.indexOf(":") !== -1;
     1281        return schema + "://" + (ipv6 ? "[" + this.opts.hostname + "]" : this.opts.hostname) + port + this.opts.path + (encodedQuery.length ? "?" + encodedQuery : "");
     1282      }
     1283    }]);
     1284
     1285    return Polling;
     1286  }(Transport);
     1287
     1288  /**
     1289   * Empty function
     1290   */
     1291
     1292  function empty() {}
     1293
     1294  var hasXHR2 = function () {
     1295    var xhr = new XMLHttpRequest$1({
     1296      xdomain: false
     1297    });
     1298    return null != xhr.responseType;
     1299  }();
     1300
     1301  var XHR = /*#__PURE__*/function (_Polling) {
     1302    _inherits(XHR, _Polling);
     1303
     1304    var _super = _createSuper(XHR);
     1305
     1306    /**
     1307     * XHR Polling constructor.
     1308     *
     1309     * @param {Object} opts
     1310     * @api public
     1311     */
     1312    function XHR(opts) {
     1313      var _this;
     1314
     1315      _classCallCheck(this, XHR);
     1316
     1317      _this = _super.call(this, opts);
     1318
     1319      if (typeof location !== "undefined") {
     1320        var isSSL = "https:" === location.protocol;
     1321        var port = location.port; // some user agents have empty `location.port`
     1322
     1323        if (!port) {
     1324          port = isSSL ? "443" : "80";
     1325        }
     1326
     1327        _this.xd = typeof location !== "undefined" && opts.hostname !== location.hostname || port !== opts.port;
     1328        _this.xs = opts.secure !== isSSL;
     1329      }
     1330      /**
     1331       * XHR supports binary
     1332       */
     1333
     1334
     1335      var forceBase64 = opts && opts.forceBase64;
     1336      _this.supportsBinary = hasXHR2 && !forceBase64;
     1337      return _this;
     1338    }
     1339    /**
     1340     * Creates a request.
     1341     *
     1342     * @param {String} method
     1343     * @api private
     1344     */
     1345
     1346
     1347    _createClass(XHR, [{
     1348      key: "request",
     1349      value: function request() {
     1350        var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
     1351
     1352        _extends(opts, {
     1353          xd: this.xd,
     1354          xs: this.xs
     1355        }, this.opts);
     1356
     1357        return new Request(this.uri(), opts);
     1358      }
     1359      /**
     1360       * Sends data.
     1361       *
     1362       * @param {String} data to send.
     1363       * @param {Function} called upon flush.
     1364       * @api private
     1365       */
     1366
     1367    }, {
     1368      key: "doWrite",
     1369      value: function doWrite(data, fn) {
     1370        var _this2 = this;
     1371
     1372        var req = this.request({
     1373          method: "POST",
     1374          data: data
     1375        });
     1376        req.on("success", fn);
     1377        req.on("error", function (err) {
     1378          _this2.onError("xhr post error", err);
     1379        });
     1380      }
     1381      /**
     1382       * Starts a poll cycle.
     1383       *
     1384       * @api private
     1385       */
     1386
     1387    }, {
     1388      key: "doPoll",
     1389      value: function doPoll() {
     1390        var _this3 = this;
     1391
     1392        var req = this.request();
     1393        req.on("data", this.onData.bind(this));
     1394        req.on("error", function (err) {
     1395          _this3.onError("xhr poll error", err);
     1396        });
     1397        this.pollXhr = req;
     1398      }
     1399    }]);
     1400
     1401    return XHR;
     1402  }(Polling);
     1403  var Request = /*#__PURE__*/function (_Emitter) {
     1404    _inherits(Request, _Emitter);
     1405
     1406    var _super2 = _createSuper(Request);
     1407
     1408    /**
     1409     * Request constructor
     1410     *
     1411     * @param {Object} options
     1412     * @api public
     1413     */
     1414    function Request(uri, opts) {
     1415      var _this4;
     1416
     1417      _classCallCheck(this, Request);
     1418
     1419      _this4 = _super2.call(this);
     1420      installTimerFunctions(_assertThisInitialized(_this4), opts);
     1421      _this4.opts = opts;
     1422      _this4.method = opts.method || "GET";
     1423      _this4.uri = uri;
     1424      _this4.async = false !== opts.async;
     1425      _this4.data = undefined !== opts.data ? opts.data : null;
     1426
     1427      _this4.create();
     1428
     1429      return _this4;
     1430    }
     1431    /**
     1432     * Creates the XHR object and sends the request.
     1433     *
     1434     * @api private
     1435     */
     1436
     1437
     1438    _createClass(Request, [{
     1439      key: "create",
     1440      value: function create() {
     1441        var _this5 = this;
     1442
     1443        var opts = pick(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
     1444        opts.xdomain = !!this.opts.xd;
     1445        opts.xscheme = !!this.opts.xs;
     1446        var xhr = this.xhr = new XMLHttpRequest$1(opts);
     1447
     1448        try {
     1449          xhr.open(this.method, this.uri, this.async);
     1450
     1451          try {
     1452            if (this.opts.extraHeaders) {
     1453              xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);
     1454
     1455              for (var i in this.opts.extraHeaders) {
     1456                if (this.opts.extraHeaders.hasOwnProperty(i)) {
     1457                  xhr.setRequestHeader(i, this.opts.extraHeaders[i]);
     1458                }
     1459              }
     1460            }
     1461          } catch (e) {}
     1462
     1463          if ("POST" === this.method) {
     1464            try {
     1465              xhr.setRequestHeader("Content-type", "text/plain;charset=UTF-8");
     1466            } catch (e) {}
    55171467          }
    5518         }
    5519       } else {
    5520         throw new Error("Unknown type: " + obj);
    5521       }
    5522     }
     1468
     1469          try {
     1470            xhr.setRequestHeader("Accept", "*/*");
     1471          } catch (e) {} // ie6 check
     1472
     1473
     1474          if ("withCredentials" in xhr) {
     1475            xhr.withCredentials = this.opts.withCredentials;
     1476          }
     1477
     1478          if (this.opts.requestTimeout) {
     1479            xhr.timeout = this.opts.requestTimeout;
     1480          }
     1481
     1482          xhr.onreadystatechange = function () {
     1483            if (4 !== xhr.readyState) return;
     1484
     1485            if (200 === xhr.status || 1223 === xhr.status) {
     1486              _this5.onLoad();
     1487            } else {
     1488              // make sure the `error` event handler that's user-set
     1489              // does not throw in the same tick and gets caught here
     1490              _this5.setTimeoutFn(function () {
     1491                _this5.onError(typeof xhr.status === "number" ? xhr.status : 0);
     1492              }, 0);
     1493            }
     1494          };
     1495
     1496          xhr.send(this.data);
     1497        } catch (e) {
     1498          // Need to defer since .create() is called directly from the constructor
     1499          // and thus the 'error' event can only be only bound *after* this exception
     1500          // occurs.  Therefore, also, we cannot throw here at all.
     1501          this.setTimeoutFn(function () {
     1502            _this5.onError(e);
     1503          }, 0);
     1504          return;
     1505        }
     1506
     1507        if (typeof document !== "undefined") {
     1508          this.index = Request.requestsCount++;
     1509          Request.requests[this.index] = this;
     1510        }
     1511      }
     1512      /**
     1513       * Called upon successful response.
     1514       *
     1515       * @api private
     1516       */
     1517
     1518    }, {
     1519      key: "onSuccess",
     1520      value: function onSuccess() {
     1521        this.emit("success");
     1522        this.cleanup();
     1523      }
     1524      /**
     1525       * Called if we have data.
     1526       *
     1527       * @api private
     1528       */
     1529
     1530    }, {
     1531      key: "onData",
     1532      value: function onData(data) {
     1533        this.emit("data", data);
     1534        this.onSuccess();
     1535      }
     1536      /**
     1537       * Called upon error.
     1538       *
     1539       * @api private
     1540       */
     1541
     1542    }, {
     1543      key: "onError",
     1544      value: function onError(err) {
     1545        this.emit("error", err);
     1546        this.cleanup(true);
     1547      }
     1548      /**
     1549       * Cleans up house.
     1550       *
     1551       * @api private
     1552       */
     1553
     1554    }, {
     1555      key: "cleanup",
     1556      value: function cleanup(fromError) {
     1557        if ("undefined" === typeof this.xhr || null === this.xhr) {
     1558          return;
     1559        }
     1560
     1561        this.xhr.onreadystatechange = empty;
     1562
     1563        if (fromError) {
     1564          try {
     1565            this.xhr.abort();
     1566          } catch (e) {}
     1567        }
     1568
     1569        if (typeof document !== "undefined") {
     1570          delete Request.requests[this.index];
     1571        }
     1572
     1573        this.xhr = null;
     1574      }
     1575      /**
     1576       * Called upon load.
     1577       *
     1578       * @api private
     1579       */
     1580
     1581    }, {
     1582      key: "onLoad",
     1583      value: function onLoad() {
     1584        var data = this.xhr.responseText;
     1585
     1586        if (data !== null) {
     1587          this.onData(data);
     1588        }
     1589      }
     1590      /**
     1591       * Aborts the request.
     1592       *
     1593       * @api public
     1594       */
     1595
     1596    }, {
     1597      key: "abort",
     1598      value: function abort() {
     1599        this.cleanup();
     1600      }
     1601    }]);
     1602
     1603    return Request;
     1604  }(Emitter_1);
     1605  Request.requestsCount = 0;
     1606  Request.requests = {};
     1607  /**
     1608   * Aborts pending requests when unloading the window. This is needed to prevent
     1609   * memory leaks (e.g. when using IE) and to ensure that no spurious error is
     1610   * emitted.
     1611   */
     1612
     1613  if (typeof document !== "undefined") {
     1614    // @ts-ignore
     1615    if (typeof attachEvent === "function") {
     1616      // @ts-ignore
     1617      attachEvent("onunload", unloadHandler);
     1618    } else if (typeof addEventListener === "function") {
     1619      var terminationEvent = "onpagehide" in globalThis ? "pagehide" : "unload";
     1620      addEventListener(terminationEvent, unloadHandler, false);
     1621    }
     1622  }
     1623
     1624  function unloadHandler() {
     1625    for (var i in Request.requests) {
     1626      if (Request.requests.hasOwnProperty(i)) {
     1627        Request.requests[i].abort();
     1628      }
     1629    }
     1630  }
     1631
     1632  var nextTick = function () {
     1633    var isPromiseAvailable = typeof Promise === "function" && typeof Promise.resolve === "function";
     1634
     1635    if (isPromiseAvailable) {
     1636      return function (cb) {
     1637        return Promise.resolve().then(cb);
     1638      };
     1639    } else {
     1640      return function (cb, setTimeoutFn) {
     1641        return setTimeoutFn(cb, 0);
     1642      };
     1643    }
     1644  }();
     1645  var WebSocket = globalThis.WebSocket || globalThis.MozWebSocket;
     1646  var usingBrowserWebSocket = true;
     1647  var defaultBinaryType = "arraybuffer";
     1648
     1649  var isReactNative = typeof navigator !== "undefined" && typeof navigator.product === "string" && navigator.product.toLowerCase() === "reactnative";
     1650  var WS = /*#__PURE__*/function (_Transport) {
     1651    _inherits(WS, _Transport);
     1652
     1653    var _super = _createSuper(WS);
     1654
    55231655    /**
    5524      * Decode a packet String (JSON data)
     1656     * WebSocket transport constructor.
    55251657     *
    5526      * @param {String} str
    5527      * @return {Object} packet
     1658     * @api {Object} connection options
     1659     * @api public
    55281660     */
    5529 
    5530   }, {
    5531     key: "decodeString",
    5532     value: function decodeString(str) {
    5533       var i = 0; // look up type
    5534 
    5535       var p = {
    5536         type: Number(str.charAt(0))
    5537       };
    5538 
    5539       if (PacketType[p.type] === undefined) {
    5540         throw new Error("unknown packet type " + p.type);
    5541       } // look up attachments if type binary
    5542 
    5543 
    5544       if (p.type === PacketType.BINARY_EVENT || p.type === PacketType.BINARY_ACK) {
    5545         var start = i + 1;
    5546 
    5547         while (str.charAt(++i) !== "-" && i != str.length) {}
    5548 
    5549         var buf = str.substring(start, i);
    5550 
    5551         if (buf != Number(buf) || str.charAt(i) !== "-") {
    5552           throw new Error("Illegal attachments");
    5553         }
    5554 
    5555         p.attachments = Number(buf);
    5556       } // look up namespace (if any)
    5557 
    5558 
    5559       if ("/" === str.charAt(i + 1)) {
    5560         var _start = i + 1;
    5561 
    5562         while (++i) {
    5563           var c = str.charAt(i);
    5564           if ("," === c) break;
    5565           if (i === str.length) break;
    5566         }
    5567 
    5568         p.nsp = str.substring(_start, i);
    5569       } else {
    5570         p.nsp = "/";
    5571       } // look up id
    5572 
    5573 
    5574       var next = str.charAt(i + 1);
    5575 
    5576       if ("" !== next && Number(next) == next) {
    5577         var _start2 = i + 1;
    5578 
    5579         while (++i) {
    5580           var _c = str.charAt(i);
    5581 
    5582           if (null == _c || Number(_c) != _c) {
    5583             --i;
    5584             break;
     1661    function WS(opts) {
     1662      var _this;
     1663
     1664      _classCallCheck(this, WS);
     1665
     1666      _this = _super.call(this, opts);
     1667      _this.supportsBinary = !opts.forceBase64;
     1668      return _this;
     1669    }
     1670    /**
     1671     * Transport name.
     1672     *
     1673     * @api public
     1674     */
     1675
     1676
     1677    _createClass(WS, [{
     1678      key: "name",
     1679      get: function get() {
     1680        return "websocket";
     1681      }
     1682      /**
     1683       * Opens socket.
     1684       *
     1685       * @api private
     1686       */
     1687
     1688    }, {
     1689      key: "doOpen",
     1690      value: function doOpen() {
     1691        if (!this.check()) {
     1692          // let probe timeout
     1693          return;
     1694        }
     1695
     1696        var uri = this.uri();
     1697        var protocols = this.opts.protocols; // React Native only supports the 'headers' option, and will print a warning if anything else is passed
     1698
     1699        var opts = isReactNative ? {} : pick(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
     1700
     1701        if (this.opts.extraHeaders) {
     1702          opts.headers = this.opts.extraHeaders;
     1703        }
     1704
     1705        try {
     1706          this.ws = usingBrowserWebSocket && !isReactNative ? protocols ? new WebSocket(uri, protocols) : new WebSocket(uri) : new WebSocket(uri, protocols, opts);
     1707        } catch (err) {
     1708          return this.emit("error", err);
     1709        }
     1710
     1711        this.ws.binaryType = this.socket.binaryType || defaultBinaryType;
     1712        this.addEventListeners();
     1713      }
     1714      /**
     1715       * Adds event listeners to the socket
     1716       *
     1717       * @api private
     1718       */
     1719
     1720    }, {
     1721      key: "addEventListeners",
     1722      value: function addEventListeners() {
     1723        var _this2 = this;
     1724
     1725        this.ws.onopen = function () {
     1726          if (_this2.opts.autoUnref) {
     1727            _this2.ws._socket.unref();
    55851728          }
    55861729
    5587           if (i === str.length) break;
    5588         }
    5589 
    5590         p.id = Number(str.substring(_start2, i + 1));
    5591       } // look up json data
    5592 
    5593 
    5594       if (str.charAt(++i)) {
    5595         var payload = tryParse(str.substr(i));
    5596 
    5597         if (Decoder.isPayloadValid(p.type, payload)) {
    5598           p.data = payload;
     1730          _this2.onOpen();
     1731        };
     1732
     1733        this.ws.onclose = this.onClose.bind(this);
     1734
     1735        this.ws.onmessage = function (ev) {
     1736          return _this2.onData(ev.data);
     1737        };
     1738
     1739        this.ws.onerror = function (e) {
     1740          return _this2.onError("websocket error", e);
     1741        };
     1742      }
     1743      /**
     1744       * Writes data to socket.
     1745       *
     1746       * @param {Array} array of packets.
     1747       * @api private
     1748       */
     1749
     1750    }, {
     1751      key: "write",
     1752      value: function write(packets) {
     1753        var _this3 = this;
     1754
     1755        this.writable = false; // encodePacket efficient as it uses WS framing
     1756        // no need for encodePayload
     1757
     1758        var _loop = function _loop(i) {
     1759          var packet = packets[i];
     1760          var lastPacket = i === packets.length - 1;
     1761          encodePacket(packet, _this3.supportsBinary, function (data) {
     1762            // always create a new object (GH-437)
     1763            var opts = {};
     1764            // have a chance of informing us about it yet, in that case send will
     1765            // throw an error
     1766
     1767
     1768            try {
     1769              if (usingBrowserWebSocket) {
     1770                // TypeError is thrown when passing the second argument on Safari
     1771                _this3.ws.send(data);
     1772              }
     1773            } catch (e) {}
     1774
     1775            if (lastPacket) {
     1776              // fake drain
     1777              // defer to next tick to allow Socket to clear writeBuffer
     1778              nextTick(function () {
     1779                _this3.writable = true;
     1780
     1781                _this3.emit("drain");
     1782              }, _this3.setTimeoutFn);
     1783            }
     1784          });
     1785        };
     1786
     1787        for (var i = 0; i < packets.length; i++) {
     1788          _loop(i);
     1789        }
     1790      }
     1791      /**
     1792       * Closes socket.
     1793       *
     1794       * @api private
     1795       */
     1796
     1797    }, {
     1798      key: "doClose",
     1799      value: function doClose() {
     1800        if (typeof this.ws !== "undefined") {
     1801          this.ws.close();
     1802          this.ws = null;
     1803        }
     1804      }
     1805      /**
     1806       * Generates uri for connection.
     1807       *
     1808       * @api private
     1809       */
     1810
     1811    }, {
     1812      key: "uri",
     1813      value: function uri() {
     1814        var query = this.query || {};
     1815        var schema = this.opts.secure ? "wss" : "ws";
     1816        var port = ""; // avoid port if default for schema
     1817
     1818        if (this.opts.port && ("wss" === schema && Number(this.opts.port) !== 443 || "ws" === schema && Number(this.opts.port) !== 80)) {
     1819          port = ":" + this.opts.port;
     1820        } // append timestamp to URI
     1821
     1822
     1823        if (this.opts.timestampRequests) {
     1824          query[this.opts.timestampParam] = yeast_1();
     1825        } // communicate binary support capabilities
     1826
     1827
     1828        if (!this.supportsBinary) {
     1829          query.b64 = 1;
     1830        }
     1831
     1832        var encodedQuery = parseqs.encode(query);
     1833        var ipv6 = this.opts.hostname.indexOf(":") !== -1;
     1834        return schema + "://" + (ipv6 ? "[" + this.opts.hostname + "]" : this.opts.hostname) + port + this.opts.path + (encodedQuery.length ? "?" + encodedQuery : "");
     1835      }
     1836      /**
     1837       * Feature detection for WebSocket.
     1838       *
     1839       * @return {Boolean} whether this transport is available.
     1840       * @api public
     1841       */
     1842
     1843    }, {
     1844      key: "check",
     1845      value: function check() {
     1846        return !!WebSocket && !("__initialize" in WebSocket && this.name === WS.prototype.name);
     1847      }
     1848    }]);
     1849
     1850    return WS;
     1851  }(Transport);
     1852
     1853  var transports = {
     1854    websocket: WS,
     1855    polling: XHR
     1856  };
     1857
     1858  var Socket$1 = /*#__PURE__*/function (_Emitter) {
     1859    _inherits(Socket, _Emitter);
     1860
     1861    var _super = _createSuper(Socket);
     1862
     1863    /**
     1864     * Socket constructor.
     1865     *
     1866     * @param {String|Object} uri or options
     1867     * @param {Object} opts - options
     1868     * @api public
     1869     */
     1870    function Socket(uri) {
     1871      var _this;
     1872
     1873      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
     1874
     1875      _classCallCheck(this, Socket);
     1876
     1877      _this = _super.call(this);
     1878
     1879      if (uri && "object" === _typeof(uri)) {
     1880        opts = uri;
     1881        uri = null;
     1882      }
     1883
     1884      if (uri) {
     1885        uri = parseuri(uri);
     1886        opts.hostname = uri.host;
     1887        opts.secure = uri.protocol === "https" || uri.protocol === "wss";
     1888        opts.port = uri.port;
     1889        if (uri.query) opts.query = uri.query;
     1890      } else if (opts.host) {
     1891        opts.hostname = parseuri(opts.host).host;
     1892      }
     1893
     1894      installTimerFunctions(_assertThisInitialized(_this), opts);
     1895      _this.secure = null != opts.secure ? opts.secure : typeof location !== "undefined" && "https:" === location.protocol;
     1896
     1897      if (opts.hostname && !opts.port) {
     1898        // if no port is specified manually, use the protocol default
     1899        opts.port = _this.secure ? "443" : "80";
     1900      }
     1901
     1902      _this.hostname = opts.hostname || (typeof location !== "undefined" ? location.hostname : "localhost");
     1903      _this.port = opts.port || (typeof location !== "undefined" && location.port ? location.port : _this.secure ? "443" : "80");
     1904      _this.transports = opts.transports || ["polling", "websocket"];
     1905      _this.readyState = "";
     1906      _this.writeBuffer = [];
     1907      _this.prevBufferLen = 0;
     1908      _this.opts = _extends({
     1909        path: "/engine.io",
     1910        agent: false,
     1911        withCredentials: false,
     1912        upgrade: true,
     1913        timestampParam: "t",
     1914        rememberUpgrade: false,
     1915        rejectUnauthorized: true,
     1916        perMessageDeflate: {
     1917          threshold: 1024
     1918        },
     1919        transportOptions: {},
     1920        closeOnBeforeunload: true
     1921      }, opts);
     1922      _this.opts.path = _this.opts.path.replace(/\/$/, "") + "/";
     1923
     1924      if (typeof _this.opts.query === "string") {
     1925        _this.opts.query = parseqs.decode(_this.opts.query);
     1926      } // set on handshake
     1927
     1928
     1929      _this.id = null;
     1930      _this.upgrades = null;
     1931      _this.pingInterval = null;
     1932      _this.pingTimeout = null; // set on heartbeat
     1933
     1934      _this.pingTimeoutTimer = null;
     1935
     1936      if (typeof addEventListener === "function") {
     1937        if (_this.opts.closeOnBeforeunload) {
     1938          // Firefox closes the connection when the "beforeunload" event is emitted but not Chrome. This event listener
     1939          // ensures every browser behaves the same (no "disconnect" event at the Socket.IO level when the page is
     1940          // closed/reloaded)
     1941          addEventListener("beforeunload", function () {
     1942            if (_this.transport) {
     1943              // silently close the transport
     1944              _this.transport.removeAllListeners();
     1945
     1946              _this.transport.close();
     1947            }
     1948          }, false);
     1949        }
     1950
     1951        if (_this.hostname !== "localhost") {
     1952          _this.offlineEventListener = function () {
     1953            _this.onClose("transport close");
     1954          };
     1955
     1956          addEventListener("offline", _this.offlineEventListener, false);
     1957        }
     1958      }
     1959
     1960      _this.open();
     1961
     1962      return _this;
     1963    }
     1964    /**
     1965     * Creates transport of the given type.
     1966     *
     1967     * @param {String} transport name
     1968     * @return {Transport}
     1969     * @api private
     1970     */
     1971
     1972
     1973    _createClass(Socket, [{
     1974      key: "createTransport",
     1975      value: function createTransport(name) {
     1976        var query = clone(this.opts.query); // append engine.io protocol identifier
     1977
     1978        query.EIO = protocol$1; // transport name
     1979
     1980        query.transport = name; // session id if we already have one
     1981
     1982        if (this.id) query.sid = this.id;
     1983
     1984        var opts = _extends({}, this.opts.transportOptions[name], this.opts, {
     1985          query: query,
     1986          socket: this,
     1987          hostname: this.hostname,
     1988          secure: this.secure,
     1989          port: this.port
     1990        });
     1991
     1992        return new transports[name](opts);
     1993      }
     1994      /**
     1995       * Initializes transport to use and starts probe.
     1996       *
     1997       * @api private
     1998       */
     1999
     2000    }, {
     2001      key: "open",
     2002      value: function open() {
     2003        var _this2 = this;
     2004
     2005        var transport;
     2006
     2007        if (this.opts.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1) {
     2008          transport = "websocket";
     2009        } else if (0 === this.transports.length) {
     2010          // Emit error on next tick so it can be listened to
     2011          this.setTimeoutFn(function () {
     2012            _this2.emitReserved("error", "No transports available");
     2013          }, 0);
     2014          return;
    55992015        } else {
    5600           throw new Error("invalid payload");
    5601         }
    5602       }
    5603 
    5604       debug("decoded %s as %j", str, p);
    5605       return p;
    5606     }
    5607   }, {
    5608     key: "destroy",
    5609 
    5610     /**
    5611      * Deallocates a parser's resources
    5612      */
    5613     value: function destroy() {
    5614       if (this.reconstructor) {
    5615         this.reconstructor.finishedReconstruction();
    5616       }
    5617     }
    5618   }], [{
    5619     key: "isPayloadValid",
    5620     value: function isPayloadValid(type, payload) {
    5621       switch (type) {
    5622         case PacketType.CONNECT:
    5623           return _typeof(payload) === "object";
    5624 
    5625         case PacketType.DISCONNECT:
    5626           return payload === undefined;
    5627 
    5628         case PacketType.CONNECT_ERROR:
    5629           return typeof payload === "string" || _typeof(payload) === "object";
    5630 
    5631         case PacketType.EVENT:
    5632         case PacketType.BINARY_EVENT:
    5633           return Array.isArray(payload) && payload.length > 0;
    5634 
    5635         case PacketType.ACK:
    5636         case PacketType.BINARY_ACK:
    5637           return Array.isArray(payload);
    5638       }
    5639     }
    5640   }]);
    5641 
    5642   return Decoder;
    5643 }(Emitter);
    5644 
    5645 exports.Decoder = Decoder;
    5646 
    5647 function tryParse(str) {
    5648   try {
    5649     return JSON.parse(str);
    5650   } catch (e) {
     2016          transport = this.transports[0];
     2017        }
     2018
     2019        this.readyState = "opening"; // Retry with the next transport if the transport is disabled (jsonp: false)
     2020
     2021        try {
     2022          transport = this.createTransport(transport);
     2023        } catch (e) {
     2024          this.transports.shift();
     2025          this.open();
     2026          return;
     2027        }
     2028
     2029        transport.open();
     2030        this.setTransport(transport);
     2031      }
     2032      /**
     2033       * Sets the current transport. Disables the existing one (if any).
     2034       *
     2035       * @api private
     2036       */
     2037
     2038    }, {
     2039      key: "setTransport",
     2040      value: function setTransport(transport) {
     2041        var _this3 = this;
     2042
     2043        if (this.transport) {
     2044          this.transport.removeAllListeners();
     2045        } // set up transport
     2046
     2047
     2048        this.transport = transport; // set up transport listeners
     2049
     2050        transport.on("drain", this.onDrain.bind(this)).on("packet", this.onPacket.bind(this)).on("error", this.onError.bind(this)).on("close", function () {
     2051          _this3.onClose("transport close");
     2052        });
     2053      }
     2054      /**
     2055       * Probes a transport.
     2056       *
     2057       * @param {String} transport name
     2058       * @api private
     2059       */
     2060
     2061    }, {
     2062      key: "probe",
     2063      value: function probe(name) {
     2064        var _this4 = this;
     2065
     2066        var transport = this.createTransport(name);
     2067        var failed = false;
     2068        Socket.priorWebsocketSuccess = false;
     2069
     2070        var onTransportOpen = function onTransportOpen() {
     2071          if (failed) return;
     2072          transport.send([{
     2073            type: "ping",
     2074            data: "probe"
     2075          }]);
     2076          transport.once("packet", function (msg) {
     2077            if (failed) return;
     2078
     2079            if ("pong" === msg.type && "probe" === msg.data) {
     2080              _this4.upgrading = true;
     2081
     2082              _this4.emitReserved("upgrading", transport);
     2083
     2084              if (!transport) return;
     2085              Socket.priorWebsocketSuccess = "websocket" === transport.name;
     2086
     2087              _this4.transport.pause(function () {
     2088                if (failed) return;
     2089                if ("closed" === _this4.readyState) return;
     2090                cleanup();
     2091
     2092                _this4.setTransport(transport);
     2093
     2094                transport.send([{
     2095                  type: "upgrade"
     2096                }]);
     2097
     2098                _this4.emitReserved("upgrade", transport);
     2099
     2100                transport = null;
     2101                _this4.upgrading = false;
     2102
     2103                _this4.flush();
     2104              });
     2105            } else {
     2106              var err = new Error("probe error"); // @ts-ignore
     2107
     2108              err.transport = transport.name;
     2109
     2110              _this4.emitReserved("upgradeError", err);
     2111            }
     2112          });
     2113        };
     2114
     2115        function freezeTransport() {
     2116          if (failed) return; // Any callback called by transport should be ignored since now
     2117
     2118          failed = true;
     2119          cleanup();
     2120          transport.close();
     2121          transport = null;
     2122        } // Handle any error that happens while probing
     2123
     2124
     2125        var onerror = function onerror(err) {
     2126          var error = new Error("probe error: " + err); // @ts-ignore
     2127
     2128          error.transport = transport.name;
     2129          freezeTransport();
     2130
     2131          _this4.emitReserved("upgradeError", error);
     2132        };
     2133
     2134        function onTransportClose() {
     2135          onerror("transport closed");
     2136        } // When the socket is closed while we're probing
     2137
     2138
     2139        function onclose() {
     2140          onerror("socket closed");
     2141        } // When the socket is upgraded while we're probing
     2142
     2143
     2144        function onupgrade(to) {
     2145          if (transport && to.name !== transport.name) {
     2146            freezeTransport();
     2147          }
     2148        } // Remove all listeners on the transport and on self
     2149
     2150
     2151        var cleanup = function cleanup() {
     2152          transport.removeListener("open", onTransportOpen);
     2153          transport.removeListener("error", onerror);
     2154          transport.removeListener("close", onTransportClose);
     2155
     2156          _this4.off("close", onclose);
     2157
     2158          _this4.off("upgrading", onupgrade);
     2159        };
     2160
     2161        transport.once("open", onTransportOpen);
     2162        transport.once("error", onerror);
     2163        transport.once("close", onTransportClose);
     2164        this.once("close", onclose);
     2165        this.once("upgrading", onupgrade);
     2166        transport.open();
     2167      }
     2168      /**
     2169       * Called when connection is deemed open.
     2170       *
     2171       * @api private
     2172       */
     2173
     2174    }, {
     2175      key: "onOpen",
     2176      value: function onOpen() {
     2177        this.readyState = "open";
     2178        Socket.priorWebsocketSuccess = "websocket" === this.transport.name;
     2179        this.emitReserved("open");
     2180        this.flush(); // we check for `readyState` in case an `open`
     2181        // listener already closed the socket
     2182
     2183        if ("open" === this.readyState && this.opts.upgrade && this.transport.pause) {
     2184          var i = 0;
     2185          var l = this.upgrades.length;
     2186
     2187          for (; i < l; i++) {
     2188            this.probe(this.upgrades[i]);
     2189          }
     2190        }
     2191      }
     2192      /**
     2193       * Handles a packet.
     2194       *
     2195       * @api private
     2196       */
     2197
     2198    }, {
     2199      key: "onPacket",
     2200      value: function onPacket(packet) {
     2201        if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) {
     2202          this.emitReserved("packet", packet); // Socket is live - any packet counts
     2203
     2204          this.emitReserved("heartbeat");
     2205
     2206          switch (packet.type) {
     2207            case "open":
     2208              this.onHandshake(JSON.parse(packet.data));
     2209              break;
     2210
     2211            case "ping":
     2212              this.resetPingTimeout();
     2213              this.sendPacket("pong");
     2214              this.emitReserved("ping");
     2215              this.emitReserved("pong");
     2216              break;
     2217
     2218            case "error":
     2219              var err = new Error("server error"); // @ts-ignore
     2220
     2221              err.code = packet.data;
     2222              this.onError(err);
     2223              break;
     2224
     2225            case "message":
     2226              this.emitReserved("data", packet.data);
     2227              this.emitReserved("message", packet.data);
     2228              break;
     2229          }
     2230        }
     2231      }
     2232      /**
     2233       * Called upon handshake completion.
     2234       *
     2235       * @param {Object} data - handshake obj
     2236       * @api private
     2237       */
     2238
     2239    }, {
     2240      key: "onHandshake",
     2241      value: function onHandshake(data) {
     2242        this.emitReserved("handshake", data);
     2243        this.id = data.sid;
     2244        this.transport.query.sid = data.sid;
     2245        this.upgrades = this.filterUpgrades(data.upgrades);
     2246        this.pingInterval = data.pingInterval;
     2247        this.pingTimeout = data.pingTimeout;
     2248        this.onOpen(); // In case open handler closes socket
     2249
     2250        if ("closed" === this.readyState) return;
     2251        this.resetPingTimeout();
     2252      }
     2253      /**
     2254       * Sets and resets ping timeout timer based on server pings.
     2255       *
     2256       * @api private
     2257       */
     2258
     2259    }, {
     2260      key: "resetPingTimeout",
     2261      value: function resetPingTimeout() {
     2262        var _this5 = this;
     2263
     2264        this.clearTimeoutFn(this.pingTimeoutTimer);
     2265        this.pingTimeoutTimer = this.setTimeoutFn(function () {
     2266          _this5.onClose("ping timeout");
     2267        }, this.pingInterval + this.pingTimeout);
     2268
     2269        if (this.opts.autoUnref) {
     2270          this.pingTimeoutTimer.unref();
     2271        }
     2272      }
     2273      /**
     2274       * Called on `drain` event
     2275       *
     2276       * @api private
     2277       */
     2278
     2279    }, {
     2280      key: "onDrain",
     2281      value: function onDrain() {
     2282        this.writeBuffer.splice(0, this.prevBufferLen); // setting prevBufferLen = 0 is very important
     2283        // for example, when upgrading, upgrade packet is sent over,
     2284        // and a nonzero prevBufferLen could cause problems on `drain`
     2285
     2286        this.prevBufferLen = 0;
     2287
     2288        if (0 === this.writeBuffer.length) {
     2289          this.emitReserved("drain");
     2290        } else {
     2291          this.flush();
     2292        }
     2293      }
     2294      /**
     2295       * Flush write buffers.
     2296       *
     2297       * @api private
     2298       */
     2299
     2300    }, {
     2301      key: "flush",
     2302      value: function flush() {
     2303        if ("closed" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) {
     2304          this.transport.send(this.writeBuffer); // keep track of current length of writeBuffer
     2305          // splice writeBuffer and callbackBuffer on `drain`
     2306
     2307          this.prevBufferLen = this.writeBuffer.length;
     2308          this.emitReserved("flush");
     2309        }
     2310      }
     2311      /**
     2312       * Sends a message.
     2313       *
     2314       * @param {String} message.
     2315       * @param {Function} callback function.
     2316       * @param {Object} options.
     2317       * @return {Socket} for chaining.
     2318       * @api public
     2319       */
     2320
     2321    }, {
     2322      key: "write",
     2323      value: function write(msg, options, fn) {
     2324        this.sendPacket("message", msg, options, fn);
     2325        return this;
     2326      }
     2327    }, {
     2328      key: "send",
     2329      value: function send(msg, options, fn) {
     2330        this.sendPacket("message", msg, options, fn);
     2331        return this;
     2332      }
     2333      /**
     2334       * Sends a packet.
     2335       *
     2336       * @param {String} packet type.
     2337       * @param {String} data.
     2338       * @param {Object} options.
     2339       * @param {Function} callback function.
     2340       * @api private
     2341       */
     2342
     2343    }, {
     2344      key: "sendPacket",
     2345      value: function sendPacket(type, data, options, fn) {
     2346        if ("function" === typeof data) {
     2347          fn = data;
     2348          data = undefined;
     2349        }
     2350
     2351        if ("function" === typeof options) {
     2352          fn = options;
     2353          options = null;
     2354        }
     2355
     2356        if ("closing" === this.readyState || "closed" === this.readyState) {
     2357          return;
     2358        }
     2359
     2360        options = options || {};
     2361        options.compress = false !== options.compress;
     2362        var packet = {
     2363          type: type,
     2364          data: data,
     2365          options: options
     2366        };
     2367        this.emitReserved("packetCreate", packet);
     2368        this.writeBuffer.push(packet);
     2369        if (fn) this.once("flush", fn);
     2370        this.flush();
     2371      }
     2372      /**
     2373       * Closes the connection.
     2374       *
     2375       * @api public
     2376       */
     2377
     2378    }, {
     2379      key: "close",
     2380      value: function close() {
     2381        var _this6 = this;
     2382
     2383        var close = function close() {
     2384          _this6.onClose("forced close");
     2385
     2386          _this6.transport.close();
     2387        };
     2388
     2389        var cleanupAndClose = function cleanupAndClose() {
     2390          _this6.off("upgrade", cleanupAndClose);
     2391
     2392          _this6.off("upgradeError", cleanupAndClose);
     2393
     2394          close();
     2395        };
     2396
     2397        var waitForUpgrade = function waitForUpgrade() {
     2398          // wait for upgrade to finish since we can't send packets while pausing a transport
     2399          _this6.once("upgrade", cleanupAndClose);
     2400
     2401          _this6.once("upgradeError", cleanupAndClose);
     2402        };
     2403
     2404        if ("opening" === this.readyState || "open" === this.readyState) {
     2405          this.readyState = "closing";
     2406
     2407          if (this.writeBuffer.length) {
     2408            this.once("drain", function () {
     2409              if (_this6.upgrading) {
     2410                waitForUpgrade();
     2411              } else {
     2412                close();
     2413              }
     2414            });
     2415          } else if (this.upgrading) {
     2416            waitForUpgrade();
     2417          } else {
     2418            close();
     2419          }
     2420        }
     2421
     2422        return this;
     2423      }
     2424      /**
     2425       * Called upon transport error
     2426       *
     2427       * @api private
     2428       */
     2429
     2430    }, {
     2431      key: "onError",
     2432      value: function onError(err) {
     2433        Socket.priorWebsocketSuccess = false;
     2434        this.emitReserved("error", err);
     2435        this.onClose("transport error", err);
     2436      }
     2437      /**
     2438       * Called upon transport close.
     2439       *
     2440       * @api private
     2441       */
     2442
     2443    }, {
     2444      key: "onClose",
     2445      value: function onClose(reason, desc) {
     2446        if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) {
     2447          // clear timers
     2448          this.clearTimeoutFn(this.pingTimeoutTimer); // stop event from firing again for transport
     2449
     2450          this.transport.removeAllListeners("close"); // ensure transport won't stay open
     2451
     2452          this.transport.close(); // ignore further transport communication
     2453
     2454          this.transport.removeAllListeners();
     2455
     2456          if (typeof removeEventListener === "function") {
     2457            removeEventListener("offline", this.offlineEventListener, false);
     2458          } // set ready state
     2459
     2460
     2461          this.readyState = "closed"; // clear session id
     2462
     2463          this.id = null; // emit close event
     2464
     2465          this.emitReserved("close", reason, desc); // clean buffers after, so users can still
     2466          // grab the buffers on `close` event
     2467
     2468          this.writeBuffer = [];
     2469          this.prevBufferLen = 0;
     2470        }
     2471      }
     2472      /**
     2473       * Filters upgrades, returning only those matching client transports.
     2474       *
     2475       * @param {Array} server upgrades
     2476       * @api private
     2477       *
     2478       */
     2479
     2480    }, {
     2481      key: "filterUpgrades",
     2482      value: function filterUpgrades(upgrades) {
     2483        var filteredUpgrades = [];
     2484        var i = 0;
     2485        var j = upgrades.length;
     2486
     2487        for (; i < j; i++) {
     2488          if (~this.transports.indexOf(upgrades[i])) filteredUpgrades.push(upgrades[i]);
     2489        }
     2490
     2491        return filteredUpgrades;
     2492      }
     2493    }]);
     2494
     2495    return Socket;
     2496  }(Emitter_1);
     2497  Socket$1.protocol = protocol$1;
     2498
     2499  function clone(obj) {
     2500    var o = {};
     2501
     2502    for (var i in obj) {
     2503      if (obj.hasOwnProperty(i)) {
     2504        o[i] = obj[i];
     2505      }
     2506    }
     2507
     2508    return o;
     2509  }
     2510
     2511  var withNativeArrayBuffer = typeof ArrayBuffer === "function";
     2512
     2513  var isView = function isView(obj) {
     2514    return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj.buffer instanceof ArrayBuffer;
     2515  };
     2516
     2517  var toString = Object.prototype.toString;
     2518  var withNativeBlob = typeof Blob === "function" || typeof Blob !== "undefined" && toString.call(Blob) === "[object BlobConstructor]";
     2519  var withNativeFile = typeof File === "function" || typeof File !== "undefined" && toString.call(File) === "[object FileConstructor]";
     2520  /**
     2521   * Returns true if obj is a Buffer, an ArrayBuffer, a Blob or a File.
     2522   *
     2523   * @private
     2524   */
     2525
     2526  function isBinary(obj) {
     2527    return withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)) || withNativeBlob && obj instanceof Blob || withNativeFile && obj instanceof File;
     2528  }
     2529  function hasBinary(obj, toJSON) {
     2530    if (!obj || _typeof(obj) !== "object") {
     2531      return false;
     2532    }
     2533
     2534    if (Array.isArray(obj)) {
     2535      for (var i = 0, l = obj.length; i < l; i++) {
     2536        if (hasBinary(obj[i])) {
     2537          return true;
     2538        }
     2539      }
     2540
     2541      return false;
     2542    }
     2543
     2544    if (isBinary(obj)) {
     2545      return true;
     2546    }
     2547
     2548    if (obj.toJSON && typeof obj.toJSON === "function" && arguments.length === 1) {
     2549      return hasBinary(obj.toJSON(), true);
     2550    }
     2551
     2552    for (var key in obj) {
     2553      if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {
     2554        return true;
     2555      }
     2556    }
     2557
    56512558    return false;
    56522559  }
    5653 }
    5654 /**
    5655  * A manager of a binary event's 'buffer sequence'. Should
    5656  * be constructed whenever a packet of type BINARY_EVENT is
    5657  * decoded.
    5658  *
    5659  * @param {Object} packet
    5660  * @return {BinaryReconstructor} initialized reconstructor
    5661  */
    5662 
    5663 
    5664 var BinaryReconstructor = /*#__PURE__*/function () {
    5665   function BinaryReconstructor(packet) {
    5666     _classCallCheck(this, BinaryReconstructor);
    5667 
    5668     this.packet = packet;
    5669     this.buffers = [];
    5670     this.reconPack = packet;
     2560
     2561  /**
     2562   * Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.
     2563   *
     2564   * @param {Object} packet - socket.io event packet
     2565   * @return {Object} with deconstructed packet and list of buffers
     2566   * @public
     2567   */
     2568
     2569  function deconstructPacket(packet) {
     2570    var buffers = [];
     2571    var packetData = packet.data;
     2572    var pack = packet;
     2573    pack.data = _deconstructPacket(packetData, buffers);
     2574    pack.attachments = buffers.length; // number of binary 'attachments'
     2575
     2576    return {
     2577      packet: pack,
     2578      buffers: buffers
     2579    };
     2580  }
     2581
     2582  function _deconstructPacket(data, buffers) {
     2583    if (!data) return data;
     2584
     2585    if (isBinary(data)) {
     2586      var placeholder = {
     2587        _placeholder: true,
     2588        num: buffers.length
     2589      };
     2590      buffers.push(data);
     2591      return placeholder;
     2592    } else if (Array.isArray(data)) {
     2593      var newData = new Array(data.length);
     2594
     2595      for (var i = 0; i < data.length; i++) {
     2596        newData[i] = _deconstructPacket(data[i], buffers);
     2597      }
     2598
     2599      return newData;
     2600    } else if (_typeof(data) === "object" && !(data instanceof Date)) {
     2601      var _newData = {};
     2602
     2603      for (var key in data) {
     2604        if (data.hasOwnProperty(key)) {
     2605          _newData[key] = _deconstructPacket(data[key], buffers);
     2606        }
     2607      }
     2608
     2609      return _newData;
     2610    }
     2611
     2612    return data;
    56712613  }
    56722614  /**
    5673    * Method to be called when binary data received from connection
    5674    * after a BINARY_EVENT packet.
     2615   * Reconstructs a binary packet from its placeholder packet and buffers
    56752616   *
    5676    * @param {Buffer | ArrayBuffer} binData - the raw binary data received
    5677    * @return {null | Object} returns null if more binary data is expected or
    5678    *   a reconstructed packet object if all buffers have been received.
     2617   * @param {Object} packet - event packet with placeholders
     2618   * @param {Array} buffers - binary buffers to put in placeholder positions
     2619   * @return {Object} reconstructed packet
     2620   * @public
    56792621   */
    56802622
    56812623
    5682   _createClass(BinaryReconstructor, [{
    5683     key: "takeBinaryData",
    5684     value: function takeBinaryData(binData) {
    5685       this.buffers.push(binData);
    5686 
    5687       if (this.buffers.length === this.reconPack.attachments) {
    5688         // done with buffer list
    5689         var packet = binary_1.reconstructPacket(this.reconPack, this.buffers);
    5690         this.finishedReconstruction();
    5691         return packet;
    5692       }
    5693 
    5694       return null;
     2624  function reconstructPacket(packet, buffers) {
     2625    packet.data = _reconstructPacket(packet.data, buffers);
     2626    packet.attachments = undefined; // no longer useful
     2627
     2628    return packet;
     2629  }
     2630
     2631  function _reconstructPacket(data, buffers) {
     2632    if (!data) return data;
     2633
     2634    if (data && data._placeholder) {
     2635      return buffers[data.num]; // appropriate buffer (should be natural order anyway)
     2636    } else if (Array.isArray(data)) {
     2637      for (var i = 0; i < data.length; i++) {
     2638        data[i] = _reconstructPacket(data[i], buffers);
     2639      }
     2640    } else if (_typeof(data) === "object") {
     2641      for (var key in data) {
     2642        if (data.hasOwnProperty(key)) {
     2643          data[key] = _reconstructPacket(data[key], buffers);
     2644        }
     2645      }
     2646    }
     2647
     2648    return data;
     2649  }
     2650
     2651  /**
     2652   * Protocol version.
     2653   *
     2654   * @public
     2655   */
     2656
     2657  var protocol = 5;
     2658  var PacketType;
     2659
     2660  (function (PacketType) {
     2661    PacketType[PacketType["CONNECT"] = 0] = "CONNECT";
     2662    PacketType[PacketType["DISCONNECT"] = 1] = "DISCONNECT";
     2663    PacketType[PacketType["EVENT"] = 2] = "EVENT";
     2664    PacketType[PacketType["ACK"] = 3] = "ACK";
     2665    PacketType[PacketType["CONNECT_ERROR"] = 4] = "CONNECT_ERROR";
     2666    PacketType[PacketType["BINARY_EVENT"] = 5] = "BINARY_EVENT";
     2667    PacketType[PacketType["BINARY_ACK"] = 6] = "BINARY_ACK";
     2668  })(PacketType || (PacketType = {}));
     2669  /**
     2670   * A socket.io Encoder instance
     2671   */
     2672
     2673
     2674  var Encoder = /*#__PURE__*/function () {
     2675    function Encoder() {
     2676      _classCallCheck(this, Encoder);
     2677    }
     2678
     2679    _createClass(Encoder, [{
     2680      key: "encode",
     2681      value:
     2682      /**
     2683       * Encode a packet as a single string if non-binary, or as a
     2684       * buffer sequence, depending on packet type.
     2685       *
     2686       * @param {Object} obj - packet object
     2687       */
     2688      function encode(obj) {
     2689        if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {
     2690          if (hasBinary(obj)) {
     2691            obj.type = obj.type === PacketType.EVENT ? PacketType.BINARY_EVENT : PacketType.BINARY_ACK;
     2692            return this.encodeAsBinary(obj);
     2693          }
     2694        }
     2695
     2696        return [this.encodeAsString(obj)];
     2697      }
     2698      /**
     2699       * Encode packet as string.
     2700       */
     2701
     2702    }, {
     2703      key: "encodeAsString",
     2704      value: function encodeAsString(obj) {
     2705        // first is type
     2706        var str = "" + obj.type; // attachments if we have them
     2707
     2708        if (obj.type === PacketType.BINARY_EVENT || obj.type === PacketType.BINARY_ACK) {
     2709          str += obj.attachments + "-";
     2710        } // if we have a namespace other than `/`
     2711        // we append it followed by a comma `,`
     2712
     2713
     2714        if (obj.nsp && "/" !== obj.nsp) {
     2715          str += obj.nsp + ",";
     2716        } // immediately followed by the id
     2717
     2718
     2719        if (null != obj.id) {
     2720          str += obj.id;
     2721        } // json data
     2722
     2723
     2724        if (null != obj.data) {
     2725          str += JSON.stringify(obj.data);
     2726        }
     2727
     2728        return str;
     2729      }
     2730      /**
     2731       * Encode packet as 'buffer sequence' by removing blobs, and
     2732       * deconstructing packet into object with placeholders and
     2733       * a list of buffers.
     2734       */
     2735
     2736    }, {
     2737      key: "encodeAsBinary",
     2738      value: function encodeAsBinary(obj) {
     2739        var deconstruction = deconstructPacket(obj);
     2740        var pack = this.encodeAsString(deconstruction.packet);
     2741        var buffers = deconstruction.buffers;
     2742        buffers.unshift(pack); // add packet info to beginning of data list
     2743
     2744        return buffers; // write all the buffers
     2745      }
     2746    }]);
     2747
     2748    return Encoder;
     2749  }();
     2750  /**
     2751   * A socket.io Decoder instance
     2752   *
     2753   * @return {Object} decoder
     2754   */
     2755
     2756  var Decoder = /*#__PURE__*/function (_Emitter) {
     2757    _inherits(Decoder, _Emitter);
     2758
     2759    var _super = _createSuper(Decoder);
     2760
     2761    function Decoder() {
     2762      _classCallCheck(this, Decoder);
     2763
     2764      return _super.call(this);
    56952765    }
    56962766    /**
    5697      * Cleans up binary packet reconstruction variables.
     2767     * Decodes an encoded packet string into packet JSON.
     2768     *
     2769     * @param {String} obj - encoded packet
    56982770     */
    56992771
    5700   }, {
    5701     key: "finishedReconstruction",
    5702     value: function finishedReconstruction() {
    5703       this.reconPack = null;
     2772
     2773    _createClass(Decoder, [{
     2774      key: "add",
     2775      value: function add(obj) {
     2776        var packet;
     2777
     2778        if (typeof obj === "string") {
     2779          packet = this.decodeString(obj);
     2780
     2781          if (packet.type === PacketType.BINARY_EVENT || packet.type === PacketType.BINARY_ACK) {
     2782            // binary packet's json
     2783            this.reconstructor = new BinaryReconstructor(packet); // no attachments, labeled binary but no binary data to follow
     2784
     2785            if (packet.attachments === 0) {
     2786              _get(_getPrototypeOf(Decoder.prototype), "emitReserved", this).call(this, "decoded", packet);
     2787            }
     2788          } else {
     2789            // non-binary full packet
     2790            _get(_getPrototypeOf(Decoder.prototype), "emitReserved", this).call(this, "decoded", packet);
     2791          }
     2792        } else if (isBinary(obj) || obj.base64) {
     2793          // raw binary data
     2794          if (!this.reconstructor) {
     2795            throw new Error("got binary data when not reconstructing a packet");
     2796          } else {
     2797            packet = this.reconstructor.takeBinaryData(obj);
     2798
     2799            if (packet) {
     2800              // received final buffer
     2801              this.reconstructor = null;
     2802
     2803              _get(_getPrototypeOf(Decoder.prototype), "emitReserved", this).call(this, "decoded", packet);
     2804            }
     2805          }
     2806        } else {
     2807          throw new Error("Unknown type: " + obj);
     2808        }
     2809      }
     2810      /**
     2811       * Decode a packet String (JSON data)
     2812       *
     2813       * @param {String} str
     2814       * @return {Object} packet
     2815       */
     2816
     2817    }, {
     2818      key: "decodeString",
     2819      value: function decodeString(str) {
     2820        var i = 0; // look up type
     2821
     2822        var p = {
     2823          type: Number(str.charAt(0))
     2824        };
     2825
     2826        if (PacketType[p.type] === undefined) {
     2827          throw new Error("unknown packet type " + p.type);
     2828        } // look up attachments if type binary
     2829
     2830
     2831        if (p.type === PacketType.BINARY_EVENT || p.type === PacketType.BINARY_ACK) {
     2832          var start = i + 1;
     2833
     2834          while (str.charAt(++i) !== "-" && i != str.length) {}
     2835
     2836          var buf = str.substring(start, i);
     2837
     2838          if (buf != Number(buf) || str.charAt(i) !== "-") {
     2839            throw new Error("Illegal attachments");
     2840          }
     2841
     2842          p.attachments = Number(buf);
     2843        } // look up namespace (if any)
     2844
     2845
     2846        if ("/" === str.charAt(i + 1)) {
     2847          var _start = i + 1;
     2848
     2849          while (++i) {
     2850            var c = str.charAt(i);
     2851            if ("," === c) break;
     2852            if (i === str.length) break;
     2853          }
     2854
     2855          p.nsp = str.substring(_start, i);
     2856        } else {
     2857          p.nsp = "/";
     2858        } // look up id
     2859
     2860
     2861        var next = str.charAt(i + 1);
     2862
     2863        if ("" !== next && Number(next) == next) {
     2864          var _start2 = i + 1;
     2865
     2866          while (++i) {
     2867            var _c = str.charAt(i);
     2868
     2869            if (null == _c || Number(_c) != _c) {
     2870              --i;
     2871              break;
     2872            }
     2873
     2874            if (i === str.length) break;
     2875          }
     2876
     2877          p.id = Number(str.substring(_start2, i + 1));
     2878        } // look up json data
     2879
     2880
     2881        if (str.charAt(++i)) {
     2882          var payload = tryParse(str.substr(i));
     2883
     2884          if (Decoder.isPayloadValid(p.type, payload)) {
     2885            p.data = payload;
     2886          } else {
     2887            throw new Error("invalid payload");
     2888          }
     2889        }
     2890
     2891        return p;
     2892      }
     2893    }, {
     2894      key: "destroy",
     2895      value:
     2896      /**
     2897       * Deallocates a parser's resources
     2898       */
     2899      function destroy() {
     2900        if (this.reconstructor) {
     2901          this.reconstructor.finishedReconstruction();
     2902        }
     2903      }
     2904    }], [{
     2905      key: "isPayloadValid",
     2906      value: function isPayloadValid(type, payload) {
     2907        switch (type) {
     2908          case PacketType.CONNECT:
     2909            return _typeof(payload) === "object";
     2910
     2911          case PacketType.DISCONNECT:
     2912            return payload === undefined;
     2913
     2914          case PacketType.CONNECT_ERROR:
     2915            return typeof payload === "string" || _typeof(payload) === "object";
     2916
     2917          case PacketType.EVENT:
     2918          case PacketType.BINARY_EVENT:
     2919            return Array.isArray(payload) && payload.length > 0;
     2920
     2921          case PacketType.ACK:
     2922          case PacketType.BINARY_ACK:
     2923            return Array.isArray(payload);
     2924        }
     2925      }
     2926    }]);
     2927
     2928    return Decoder;
     2929  }(Emitter_1);
     2930
     2931  function tryParse(str) {
     2932    try {
     2933      return JSON.parse(str);
     2934    } catch (e) {
     2935      return false;
     2936    }
     2937  }
     2938  /**
     2939   * A manager of a binary event's 'buffer sequence'. Should
     2940   * be constructed whenever a packet of type BINARY_EVENT is
     2941   * decoded.
     2942   *
     2943   * @param {Object} packet
     2944   * @return {BinaryReconstructor} initialized reconstructor
     2945   */
     2946
     2947
     2948  var BinaryReconstructor = /*#__PURE__*/function () {
     2949    function BinaryReconstructor(packet) {
     2950      _classCallCheck(this, BinaryReconstructor);
     2951
     2952      this.packet = packet;
    57042953      this.buffers = [];
    5705     }
    5706   }]);
    5707 
    5708   return BinaryReconstructor;
    5709 }();
    5710 
    5711 /***/ }),
    5712 
    5713 /***/ "./node_modules/socket.io-parser/dist/is-binary.js":
    5714 /*!*********************************************************!*\
    5715   !*** ./node_modules/socket.io-parser/dist/is-binary.js ***!
    5716   \*********************************************************/
    5717 /*! no static exports found */
    5718 /***/ (function(module, exports, __webpack_require__) {
    5719 
    5720 "use strict";
    5721 
    5722 
    5723 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    5724 
    5725 Object.defineProperty(exports, "__esModule", {
    5726   value: true
    5727 });
    5728 exports.hasBinary = exports.isBinary = void 0;
    5729 var withNativeArrayBuffer = typeof ArrayBuffer === "function";
    5730 
    5731 var isView = function isView(obj) {
    5732   return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj.buffer instanceof ArrayBuffer;
    5733 };
    5734 
    5735 var toString = Object.prototype.toString;
    5736 var withNativeBlob = typeof Blob === "function" || typeof Blob !== "undefined" && toString.call(Blob) === "[object BlobConstructor]";
    5737 var withNativeFile = typeof File === "function" || typeof File !== "undefined" && toString.call(File) === "[object FileConstructor]";
    5738 /**
    5739  * Returns true if obj is a Buffer, an ArrayBuffer, a Blob or a File.
    5740  *
    5741  * @private
    5742  */
    5743 
    5744 function isBinary(obj) {
    5745   return withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)) || withNativeBlob && obj instanceof Blob || withNativeFile && obj instanceof File;
    5746 }
    5747 
    5748 exports.isBinary = isBinary;
    5749 
    5750 function hasBinary(obj, toJSON) {
    5751   if (!obj || _typeof(obj) !== "object") {
    5752     return false;
     2954      this.reconPack = packet;
     2955    }
     2956    /**
     2957     * Method to be called when binary data received from connection
     2958     * after a BINARY_EVENT packet.
     2959     *
     2960     * @param {Buffer | ArrayBuffer} binData - the raw binary data received
     2961     * @return {null | Object} returns null if more binary data is expected or
     2962     *   a reconstructed packet object if all buffers have been received.
     2963     */
     2964
     2965
     2966    _createClass(BinaryReconstructor, [{
     2967      key: "takeBinaryData",
     2968      value: function takeBinaryData(binData) {
     2969        this.buffers.push(binData);
     2970
     2971        if (this.buffers.length === this.reconPack.attachments) {
     2972          // done with buffer list
     2973          var packet = reconstructPacket(this.reconPack, this.buffers);
     2974          this.finishedReconstruction();
     2975          return packet;
     2976        }
     2977
     2978        return null;
     2979      }
     2980      /**
     2981       * Cleans up binary packet reconstruction variables.
     2982       */
     2983
     2984    }, {
     2985      key: "finishedReconstruction",
     2986      value: function finishedReconstruction() {
     2987        this.reconPack = null;
     2988        this.buffers = [];
     2989      }
     2990    }]);
     2991
     2992    return BinaryReconstructor;
     2993  }();
     2994
     2995  var parser = /*#__PURE__*/Object.freeze({
     2996    __proto__: null,
     2997    protocol: protocol,
     2998    get PacketType () { return PacketType; },
     2999    Encoder: Encoder,
     3000    Decoder: Decoder
     3001  });
     3002
     3003  function on(obj, ev, fn) {
     3004    obj.on(ev, fn);
     3005    return function subDestroy() {
     3006      obj.off(ev, fn);
     3007    };
    57533008  }
    57543009
    5755   if (Array.isArray(obj)) {
    5756     for (var i = 0, l = obj.length; i < l; i++) {
    5757       if (hasBinary(obj[i])) {
    5758         return true;
    5759       }
    5760     }
    5761 
    5762     return false;
     3010  /**
     3011   * Internal events.
     3012   * These events can't be emitted by the user.
     3013   */
     3014
     3015  var RESERVED_EVENTS = Object.freeze({
     3016    connect: 1,
     3017    connect_error: 1,
     3018    disconnect: 1,
     3019    disconnecting: 1,
     3020    // EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener
     3021    newListener: 1,
     3022    removeListener: 1
     3023  });
     3024  var Socket = /*#__PURE__*/function (_Emitter) {
     3025    _inherits(Socket, _Emitter);
     3026
     3027    var _super = _createSuper(Socket);
     3028
     3029    /**
     3030     * `Socket` constructor.
     3031     *
     3032     * @public
     3033     */
     3034    function Socket(io, nsp, opts) {
     3035      var _this;
     3036
     3037      _classCallCheck(this, Socket);
     3038
     3039      _this = _super.call(this);
     3040      _this.connected = false;
     3041      _this.disconnected = true;
     3042      _this.receiveBuffer = [];
     3043      _this.sendBuffer = [];
     3044      _this.ids = 0;
     3045      _this.acks = {};
     3046      _this.flags = {};
     3047      _this.io = io;
     3048      _this.nsp = nsp;
     3049
     3050      if (opts && opts.auth) {
     3051        _this.auth = opts.auth;
     3052      }
     3053
     3054      if (_this.io._autoConnect) _this.open();
     3055      return _this;
     3056    }
     3057    /**
     3058     * Subscribe to open, close and packet events
     3059     *
     3060     * @private
     3061     */
     3062
     3063
     3064    _createClass(Socket, [{
     3065      key: "subEvents",
     3066      value: function subEvents() {
     3067        if (this.subs) return;
     3068        var io = this.io;
     3069        this.subs = [on(io, "open", this.onopen.bind(this)), on(io, "packet", this.onpacket.bind(this)), on(io, "error", this.onerror.bind(this)), on(io, "close", this.onclose.bind(this))];
     3070      }
     3071      /**
     3072       * Whether the Socket will try to reconnect when its Manager connects or reconnects
     3073       */
     3074
     3075    }, {
     3076      key: "active",
     3077      get: function get() {
     3078        return !!this.subs;
     3079      }
     3080      /**
     3081       * "Opens" the socket.
     3082       *
     3083       * @public
     3084       */
     3085
     3086    }, {
     3087      key: "connect",
     3088      value: function connect() {
     3089        if (this.connected) return this;
     3090        this.subEvents();
     3091        if (!this.io["_reconnecting"]) this.io.open(); // ensure open
     3092
     3093        if ("open" === this.io._readyState) this.onopen();
     3094        return this;
     3095      }
     3096      /**
     3097       * Alias for connect()
     3098       */
     3099
     3100    }, {
     3101      key: "open",
     3102      value: function open() {
     3103        return this.connect();
     3104      }
     3105      /**
     3106       * Sends a `message` event.
     3107       *
     3108       * @return self
     3109       * @public
     3110       */
     3111
     3112    }, {
     3113      key: "send",
     3114      value: function send() {
     3115        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
     3116          args[_key] = arguments[_key];
     3117        }
     3118
     3119        args.unshift("message");
     3120        this.emit.apply(this, args);
     3121        return this;
     3122      }
     3123      /**
     3124       * Override `emit`.
     3125       * If the event is in `events`, it's emitted normally.
     3126       *
     3127       * @return self
     3128       * @public
     3129       */
     3130
     3131    }, {
     3132      key: "emit",
     3133      value: function emit(ev) {
     3134        if (RESERVED_EVENTS.hasOwnProperty(ev)) {
     3135          throw new Error('"' + ev + '" is a reserved event name');
     3136        }
     3137
     3138        for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
     3139          args[_key2 - 1] = arguments[_key2];
     3140        }
     3141
     3142        args.unshift(ev);
     3143        var packet = {
     3144          type: PacketType.EVENT,
     3145          data: args
     3146        };
     3147        packet.options = {};
     3148        packet.options.compress = this.flags.compress !== false; // event ack callback
     3149
     3150        if ("function" === typeof args[args.length - 1]) {
     3151          var id = this.ids++;
     3152          var ack = args.pop();
     3153
     3154          this._registerAckCallback(id, ack);
     3155
     3156          packet.id = id;
     3157        }
     3158
     3159        var isTransportWritable = this.io.engine && this.io.engine.transport && this.io.engine.transport.writable;
     3160        var discardPacket = this.flags["volatile"] && (!isTransportWritable || !this.connected);
     3161
     3162        if (discardPacket) ; else if (this.connected) {
     3163          this.packet(packet);
     3164        } else {
     3165          this.sendBuffer.push(packet);
     3166        }
     3167
     3168        this.flags = {};
     3169        return this;
     3170      }
     3171      /**
     3172       * @private
     3173       */
     3174
     3175    }, {
     3176      key: "_registerAckCallback",
     3177      value: function _registerAckCallback(id, ack) {
     3178        var _this2 = this;
     3179
     3180        var timeout = this.flags.timeout;
     3181
     3182        if (timeout === undefined) {
     3183          this.acks[id] = ack;
     3184          return;
     3185        } // @ts-ignore
     3186
     3187
     3188        var timer = this.io.setTimeoutFn(function () {
     3189          delete _this2.acks[id];
     3190
     3191          for (var i = 0; i < _this2.sendBuffer.length; i++) {
     3192            if (_this2.sendBuffer[i].id === id) {
     3193              _this2.sendBuffer.splice(i, 1);
     3194            }
     3195          }
     3196
     3197          ack.call(_this2, new Error("operation has timed out"));
     3198        }, timeout);
     3199
     3200        this.acks[id] = function () {
     3201          // @ts-ignore
     3202          _this2.io.clearTimeoutFn(timer);
     3203
     3204          for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
     3205            args[_key3] = arguments[_key3];
     3206          }
     3207
     3208          ack.apply(_this2, [null].concat(args));
     3209        };
     3210      }
     3211      /**
     3212       * Sends a packet.
     3213       *
     3214       * @param packet
     3215       * @private
     3216       */
     3217
     3218    }, {
     3219      key: "packet",
     3220      value: function packet(_packet) {
     3221        _packet.nsp = this.nsp;
     3222
     3223        this.io._packet(_packet);
     3224      }
     3225      /**
     3226       * Called upon engine `open`.
     3227       *
     3228       * @private
     3229       */
     3230
     3231    }, {
     3232      key: "onopen",
     3233      value: function onopen() {
     3234        var _this3 = this;
     3235
     3236        if (typeof this.auth == "function") {
     3237          this.auth(function (data) {
     3238            _this3.packet({
     3239              type: PacketType.CONNECT,
     3240              data: data
     3241            });
     3242          });
     3243        } else {
     3244          this.packet({
     3245            type: PacketType.CONNECT,
     3246            data: this.auth
     3247          });
     3248        }
     3249      }
     3250      /**
     3251       * Called upon engine or manager `error`.
     3252       *
     3253       * @param err
     3254       * @private
     3255       */
     3256
     3257    }, {
     3258      key: "onerror",
     3259      value: function onerror(err) {
     3260        if (!this.connected) {
     3261          this.emitReserved("connect_error", err);
     3262        }
     3263      }
     3264      /**
     3265       * Called upon engine `close`.
     3266       *
     3267       * @param reason
     3268       * @private
     3269       */
     3270
     3271    }, {
     3272      key: "onclose",
     3273      value: function onclose(reason) {
     3274        this.connected = false;
     3275        this.disconnected = true;
     3276        delete this.id;
     3277        this.emitReserved("disconnect", reason);
     3278      }
     3279      /**
     3280       * Called with socket packet.
     3281       *
     3282       * @param packet
     3283       * @private
     3284       */
     3285
     3286    }, {
     3287      key: "onpacket",
     3288      value: function onpacket(packet) {
     3289        var sameNamespace = packet.nsp === this.nsp;
     3290        if (!sameNamespace) return;
     3291
     3292        switch (packet.type) {
     3293          case PacketType.CONNECT:
     3294            if (packet.data && packet.data.sid) {
     3295              var id = packet.data.sid;
     3296              this.onconnect(id);
     3297            } else {
     3298              this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
     3299            }
     3300
     3301            break;
     3302
     3303          case PacketType.EVENT:
     3304            this.onevent(packet);
     3305            break;
     3306
     3307          case PacketType.BINARY_EVENT:
     3308            this.onevent(packet);
     3309            break;
     3310
     3311          case PacketType.ACK:
     3312            this.onack(packet);
     3313            break;
     3314
     3315          case PacketType.BINARY_ACK:
     3316            this.onack(packet);
     3317            break;
     3318
     3319          case PacketType.DISCONNECT:
     3320            this.ondisconnect();
     3321            break;
     3322
     3323          case PacketType.CONNECT_ERROR:
     3324            this.destroy();
     3325            var err = new Error(packet.data.message); // @ts-ignore
     3326
     3327            err.data = packet.data.data;
     3328            this.emitReserved("connect_error", err);
     3329            break;
     3330        }
     3331      }
     3332      /**
     3333       * Called upon a server event.
     3334       *
     3335       * @param packet
     3336       * @private
     3337       */
     3338
     3339    }, {
     3340      key: "onevent",
     3341      value: function onevent(packet) {
     3342        var args = packet.data || [];
     3343
     3344        if (null != packet.id) {
     3345          args.push(this.ack(packet.id));
     3346        }
     3347
     3348        if (this.connected) {
     3349          this.emitEvent(args);
     3350        } else {
     3351          this.receiveBuffer.push(Object.freeze(args));
     3352        }
     3353      }
     3354    }, {
     3355      key: "emitEvent",
     3356      value: function emitEvent(args) {
     3357        if (this._anyListeners && this._anyListeners.length) {
     3358          var listeners = this._anyListeners.slice();
     3359
     3360          var _iterator = _createForOfIteratorHelper(listeners),
     3361              _step;
     3362
     3363          try {
     3364            for (_iterator.s(); !(_step = _iterator.n()).done;) {
     3365              var listener = _step.value;
     3366              listener.apply(this, args);
     3367            }
     3368          } catch (err) {
     3369            _iterator.e(err);
     3370          } finally {
     3371            _iterator.f();
     3372          }
     3373        }
     3374
     3375        _get(_getPrototypeOf(Socket.prototype), "emit", this).apply(this, args);
     3376      }
     3377      /**
     3378       * Produces an ack callback to emit with an event.
     3379       *
     3380       * @private
     3381       */
     3382
     3383    }, {
     3384      key: "ack",
     3385      value: function ack(id) {
     3386        var self = this;
     3387        var sent = false;
     3388        return function () {
     3389          // prevent double callbacks
     3390          if (sent) return;
     3391          sent = true;
     3392
     3393          for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
     3394            args[_key4] = arguments[_key4];
     3395          }
     3396
     3397          self.packet({
     3398            type: PacketType.ACK,
     3399            id: id,
     3400            data: args
     3401          });
     3402        };
     3403      }
     3404      /**
     3405       * Called upon a server acknowlegement.
     3406       *
     3407       * @param packet
     3408       * @private
     3409       */
     3410
     3411    }, {
     3412      key: "onack",
     3413      value: function onack(packet) {
     3414        var ack = this.acks[packet.id];
     3415
     3416        if ("function" === typeof ack) {
     3417          ack.apply(this, packet.data);
     3418          delete this.acks[packet.id];
     3419        }
     3420      }
     3421      /**
     3422       * Called upon server connect.
     3423       *
     3424       * @private
     3425       */
     3426
     3427    }, {
     3428      key: "onconnect",
     3429      value: function onconnect(id) {
     3430        this.id = id;
     3431        this.connected = true;
     3432        this.disconnected = false;
     3433        this.emitBuffered();
     3434        this.emitReserved("connect");
     3435      }
     3436      /**
     3437       * Emit buffered events (received and emitted).
     3438       *
     3439       * @private
     3440       */
     3441
     3442    }, {
     3443      key: "emitBuffered",
     3444      value: function emitBuffered() {
     3445        var _this4 = this;
     3446
     3447        this.receiveBuffer.forEach(function (args) {
     3448          return _this4.emitEvent(args);
     3449        });
     3450        this.receiveBuffer = [];
     3451        this.sendBuffer.forEach(function (packet) {
     3452          return _this4.packet(packet);
     3453        });
     3454        this.sendBuffer = [];
     3455      }
     3456      /**
     3457       * Called upon server disconnect.
     3458       *
     3459       * @private
     3460       */
     3461
     3462    }, {
     3463      key: "ondisconnect",
     3464      value: function ondisconnect() {
     3465        this.destroy();
     3466        this.onclose("io server disconnect");
     3467      }
     3468      /**
     3469       * Called upon forced client/server side disconnections,
     3470       * this method ensures the manager stops tracking us and
     3471       * that reconnections don't get triggered for this.
     3472       *
     3473       * @private
     3474       */
     3475
     3476    }, {
     3477      key: "destroy",
     3478      value: function destroy() {
     3479        if (this.subs) {
     3480          // clean subscriptions to avoid reconnections
     3481          this.subs.forEach(function (subDestroy) {
     3482            return subDestroy();
     3483          });
     3484          this.subs = undefined;
     3485        }
     3486
     3487        this.io["_destroy"](this);
     3488      }
     3489      /**
     3490       * Disconnects the socket manually.
     3491       *
     3492       * @return self
     3493       * @public
     3494       */
     3495
     3496    }, {
     3497      key: "disconnect",
     3498      value: function disconnect() {
     3499        if (this.connected) {
     3500          this.packet({
     3501            type: PacketType.DISCONNECT
     3502          });
     3503        } // remove socket from pool
     3504
     3505
     3506        this.destroy();
     3507
     3508        if (this.connected) {
     3509          // fire events
     3510          this.onclose("io client disconnect");
     3511        }
     3512
     3513        return this;
     3514      }
     3515      /**
     3516       * Alias for disconnect()
     3517       *
     3518       * @return self
     3519       * @public
     3520       */
     3521
     3522    }, {
     3523      key: "close",
     3524      value: function close() {
     3525        return this.disconnect();
     3526      }
     3527      /**
     3528       * Sets the compress flag.
     3529       *
     3530       * @param compress - if `true`, compresses the sending data
     3531       * @return self
     3532       * @public
     3533       */
     3534
     3535    }, {
     3536      key: "compress",
     3537      value: function compress(_compress) {
     3538        this.flags.compress = _compress;
     3539        return this;
     3540      }
     3541      /**
     3542       * Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not
     3543       * ready to send messages.
     3544       *
     3545       * @returns self
     3546       * @public
     3547       */
     3548
     3549    }, {
     3550      key: "volatile",
     3551      get: function get() {
     3552        this.flags["volatile"] = true;
     3553        return this;
     3554      }
     3555      /**
     3556       * Sets a modifier for a subsequent event emission that the callback will be called with an error when the
     3557       * given number of milliseconds have elapsed without an acknowledgement from the server:
     3558       *
     3559       * ```
     3560       * socket.timeout(5000).emit("my-event", (err) => {
     3561       *   if (err) {
     3562       *     // the server did not acknowledge the event in the given delay
     3563       *   }
     3564       * });
     3565       * ```
     3566       *
     3567       * @returns self
     3568       * @public
     3569       */
     3570
     3571    }, {
     3572      key: "timeout",
     3573      value: function timeout(_timeout) {
     3574        this.flags.timeout = _timeout;
     3575        return this;
     3576      }
     3577      /**
     3578       * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
     3579       * callback.
     3580       *
     3581       * @param listener
     3582       * @public
     3583       */
     3584
     3585    }, {
     3586      key: "onAny",
     3587      value: function onAny(listener) {
     3588        this._anyListeners = this._anyListeners || [];
     3589
     3590        this._anyListeners.push(listener);
     3591
     3592        return this;
     3593      }
     3594      /**
     3595       * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
     3596       * callback. The listener is added to the beginning of the listeners array.
     3597       *
     3598       * @param listener
     3599       * @public
     3600       */
     3601
     3602    }, {
     3603      key: "prependAny",
     3604      value: function prependAny(listener) {
     3605        this._anyListeners = this._anyListeners || [];
     3606
     3607        this._anyListeners.unshift(listener);
     3608
     3609        return this;
     3610      }
     3611      /**
     3612       * Removes the listener that will be fired when any event is emitted.
     3613       *
     3614       * @param listener
     3615       * @public
     3616       */
     3617
     3618    }, {
     3619      key: "offAny",
     3620      value: function offAny(listener) {
     3621        if (!this._anyListeners) {
     3622          return this;
     3623        }
     3624
     3625        if (listener) {
     3626          var listeners = this._anyListeners;
     3627
     3628          for (var i = 0; i < listeners.length; i++) {
     3629            if (listener === listeners[i]) {
     3630              listeners.splice(i, 1);
     3631              return this;
     3632            }
     3633          }
     3634        } else {
     3635          this._anyListeners = [];
     3636        }
     3637
     3638        return this;
     3639      }
     3640      /**
     3641       * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
     3642       * e.g. to remove listeners.
     3643       *
     3644       * @public
     3645       */
     3646
     3647    }, {
     3648      key: "listenersAny",
     3649      value: function listenersAny() {
     3650        return this._anyListeners || [];
     3651      }
     3652    }]);
     3653
     3654    return Socket;
     3655  }(Emitter_1);
     3656
     3657  /**
     3658   * Expose `Backoff`.
     3659   */
     3660
     3661  var backo2 = Backoff;
     3662  /**
     3663   * Initialize backoff timer with `opts`.
     3664   *
     3665   * - `min` initial timeout in milliseconds [100]
     3666   * - `max` max timeout [10000]
     3667   * - `jitter` [0]
     3668   * - `factor` [2]
     3669   *
     3670   * @param {Object} opts
     3671   * @api public
     3672   */
     3673
     3674  function Backoff(opts) {
     3675    opts = opts || {};
     3676    this.ms = opts.min || 100;
     3677    this.max = opts.max || 10000;
     3678    this.factor = opts.factor || 2;
     3679    this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
     3680    this.attempts = 0;
    57633681  }
    5764 
    5765   if (isBinary(obj)) {
    5766     return true;
    5767   }
    5768 
    5769   if (obj.toJSON && typeof obj.toJSON === "function" && arguments.length === 1) {
    5770     return hasBinary(obj.toJSON(), true);
    5771   }
    5772 
    5773   for (var key in obj) {
    5774     if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {
    5775       return true;
    5776     }
    5777   }
    5778 
    5779   return false;
    5780 }
    5781 
    5782 exports.hasBinary = hasBinary;
    5783 
    5784 /***/ }),
    5785 
    5786 /***/ "./node_modules/yeast/index.js":
    5787 /*!*************************************!*\
    5788   !*** ./node_modules/yeast/index.js ***!
    5789   \*************************************/
    5790 /*! no static exports found */
    5791 /***/ (function(module, exports, __webpack_require__) {
    5792 
    5793 "use strict";
    5794 
    5795 
    5796 var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split(''),
    5797     length = 64,
    5798     map = {},
    5799     seed = 0,
    5800     i = 0,
    5801     prev;
    5802 /**
    5803  * Return a string representing the specified number.
    5804  *
    5805  * @param {Number} num The number to convert.
    5806  * @returns {String} The string representation of the number.
    5807  * @api public
    5808  */
    5809 
    5810 function encode(num) {
    5811   var encoded = '';
    5812 
    5813   do {
    5814     encoded = alphabet[num % length] + encoded;
    5815     num = Math.floor(num / length);
    5816   } while (num > 0);
    5817 
    5818   return encoded;
    5819 }
    5820 /**
    5821  * Return the integer value specified by the given string.
    5822  *
    5823  * @param {String} str The string to convert.
    5824  * @returns {Number} The integer value represented by the string.
    5825  * @api public
    5826  */
    5827 
    5828 
    5829 function decode(str) {
    5830   var decoded = 0;
    5831 
    5832   for (i = 0; i < str.length; i++) {
    5833     decoded = decoded * length + map[str.charAt(i)];
    5834   }
    5835 
    5836   return decoded;
    5837 }
    5838 /**
    5839  * Yeast: A tiny growing id generator.
    5840  *
    5841  * @returns {String} A unique id.
    5842  * @api public
    5843  */
    5844 
    5845 
    5846 function yeast() {
    5847   var now = encode(+new Date());
    5848   if (now !== prev) return seed = 0, prev = now;
    5849   return now + '.' + encode(seed++);
    5850 } //
    5851 // Map each character to its index.
    5852 //
    5853 
    5854 
    5855 for (; i < length; i++) {
    5856   map[alphabet[i]] = i;
    5857 } //
    5858 // Expose the `yeast`, `encode` and `decode` functions.
    5859 //
    5860 
    5861 
    5862 yeast.encode = encode;
    5863 yeast.decode = decode;
    5864 module.exports = yeast;
    5865 
    5866 /***/ })
    5867 
    5868 /******/ });
    5869 });
     3682  /**
     3683   * Return the backoff duration.
     3684   *
     3685   * @return {Number}
     3686   * @api public
     3687   */
     3688
     3689
     3690  Backoff.prototype.duration = function () {
     3691    var ms = this.ms * Math.pow(this.factor, this.attempts++);
     3692
     3693    if (this.jitter) {
     3694      var rand = Math.random();
     3695      var deviation = Math.floor(rand * this.jitter * ms);
     3696      ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
     3697    }
     3698
     3699    return Math.min(ms, this.max) | 0;
     3700  };
     3701  /**
     3702   * Reset the number of attempts.
     3703   *
     3704   * @api public
     3705   */
     3706
     3707
     3708  Backoff.prototype.reset = function () {
     3709    this.attempts = 0;
     3710  };
     3711  /**
     3712   * Set the minimum duration
     3713   *
     3714   * @api public
     3715   */
     3716
     3717
     3718  Backoff.prototype.setMin = function (min) {
     3719    this.ms = min;
     3720  };
     3721  /**
     3722   * Set the maximum duration
     3723   *
     3724   * @api public
     3725   */
     3726
     3727
     3728  Backoff.prototype.setMax = function (max) {
     3729    this.max = max;
     3730  };
     3731  /**
     3732   * Set the jitter
     3733   *
     3734   * @api public
     3735   */
     3736
     3737
     3738  Backoff.prototype.setJitter = function (jitter) {
     3739    this.jitter = jitter;
     3740  };
     3741
     3742  var Manager = /*#__PURE__*/function (_Emitter) {
     3743    _inherits(Manager, _Emitter);
     3744
     3745    var _super = _createSuper(Manager);
     3746
     3747    function Manager(uri, opts) {
     3748      var _this;
     3749
     3750      _classCallCheck(this, Manager);
     3751
     3752      var _a;
     3753
     3754      _this = _super.call(this);
     3755      _this.nsps = {};
     3756      _this.subs = [];
     3757
     3758      if (uri && "object" === _typeof(uri)) {
     3759        opts = uri;
     3760        uri = undefined;
     3761      }
     3762
     3763      opts = opts || {};
     3764      opts.path = opts.path || "/socket.io";
     3765      _this.opts = opts;
     3766      installTimerFunctions(_assertThisInitialized(_this), opts);
     3767
     3768      _this.reconnection(opts.reconnection !== false);
     3769
     3770      _this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
     3771
     3772      _this.reconnectionDelay(opts.reconnectionDelay || 1000);
     3773
     3774      _this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
     3775
     3776      _this.randomizationFactor((_a = opts.randomizationFactor) !== null && _a !== void 0 ? _a : 0.5);
     3777
     3778      _this.backoff = new backo2({
     3779        min: _this.reconnectionDelay(),
     3780        max: _this.reconnectionDelayMax(),
     3781        jitter: _this.randomizationFactor()
     3782      });
     3783
     3784      _this.timeout(null == opts.timeout ? 20000 : opts.timeout);
     3785
     3786      _this._readyState = "closed";
     3787      _this.uri = uri;
     3788
     3789      var _parser = opts.parser || parser;
     3790
     3791      _this.encoder = new _parser.Encoder();
     3792      _this.decoder = new _parser.Decoder();
     3793      _this._autoConnect = opts.autoConnect !== false;
     3794      if (_this._autoConnect) _this.open();
     3795      return _this;
     3796    }
     3797
     3798    _createClass(Manager, [{
     3799      key: "reconnection",
     3800      value: function reconnection(v) {
     3801        if (!arguments.length) return this._reconnection;
     3802        this._reconnection = !!v;
     3803        return this;
     3804      }
     3805    }, {
     3806      key: "reconnectionAttempts",
     3807      value: function reconnectionAttempts(v) {
     3808        if (v === undefined) return this._reconnectionAttempts;
     3809        this._reconnectionAttempts = v;
     3810        return this;
     3811      }
     3812    }, {
     3813      key: "reconnectionDelay",
     3814      value: function reconnectionDelay(v) {
     3815        var _a;
     3816
     3817        if (v === undefined) return this._reconnectionDelay;
     3818        this._reconnectionDelay = v;
     3819        (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMin(v);
     3820        return this;
     3821      }
     3822    }, {
     3823      key: "randomizationFactor",
     3824      value: function randomizationFactor(v) {
     3825        var _a;
     3826
     3827        if (v === undefined) return this._randomizationFactor;
     3828        this._randomizationFactor = v;
     3829        (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setJitter(v);
     3830        return this;
     3831      }
     3832    }, {
     3833      key: "reconnectionDelayMax",
     3834      value: function reconnectionDelayMax(v) {
     3835        var _a;
     3836
     3837        if (v === undefined) return this._reconnectionDelayMax;
     3838        this._reconnectionDelayMax = v;
     3839        (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMax(v);
     3840        return this;
     3841      }
     3842    }, {
     3843      key: "timeout",
     3844      value: function timeout(v) {
     3845        if (!arguments.length) return this._timeout;
     3846        this._timeout = v;
     3847        return this;
     3848      }
     3849      /**
     3850       * Starts trying to reconnect if reconnection is enabled and we have not
     3851       * started reconnecting yet
     3852       *
     3853       * @private
     3854       */
     3855
     3856    }, {
     3857      key: "maybeReconnectOnOpen",
     3858      value: function maybeReconnectOnOpen() {
     3859        // Only try to reconnect if it's the first time we're connecting
     3860        if (!this._reconnecting && this._reconnection && this.backoff.attempts === 0) {
     3861          // keeps reconnection from firing twice for the same reconnection loop
     3862          this.reconnect();
     3863        }
     3864      }
     3865      /**
     3866       * Sets the current transport `socket`.
     3867       *
     3868       * @param {Function} fn - optional, callback
     3869       * @return self
     3870       * @public
     3871       */
     3872
     3873    }, {
     3874      key: "open",
     3875      value: function open(fn) {
     3876        var _this2 = this;
     3877
     3878        if (~this._readyState.indexOf("open")) return this;
     3879        this.engine = new Socket$1(this.uri, this.opts);
     3880        var socket = this.engine;
     3881        var self = this;
     3882        this._readyState = "opening";
     3883        this.skipReconnect = false; // emit `open`
     3884
     3885        var openSubDestroy = on(socket, "open", function () {
     3886          self.onopen();
     3887          fn && fn();
     3888        }); // emit `error`
     3889
     3890        var errorSub = on(socket, "error", function (err) {
     3891          self.cleanup();
     3892          self._readyState = "closed";
     3893
     3894          _this2.emitReserved("error", err);
     3895
     3896          if (fn) {
     3897            fn(err);
     3898          } else {
     3899            // Only do this if there is no fn to handle the error
     3900            self.maybeReconnectOnOpen();
     3901          }
     3902        });
     3903
     3904        if (false !== this._timeout) {
     3905          var timeout = this._timeout;
     3906
     3907          if (timeout === 0) {
     3908            openSubDestroy(); // prevents a race condition with the 'open' event
     3909          } // set timer
     3910
     3911
     3912          var timer = this.setTimeoutFn(function () {
     3913            openSubDestroy();
     3914            socket.close(); // @ts-ignore
     3915
     3916            socket.emit("error", new Error("timeout"));
     3917          }, timeout);
     3918
     3919          if (this.opts.autoUnref) {
     3920            timer.unref();
     3921          }
     3922
     3923          this.subs.push(function subDestroy() {
     3924            clearTimeout(timer);
     3925          });
     3926        }
     3927
     3928        this.subs.push(openSubDestroy);
     3929        this.subs.push(errorSub);
     3930        return this;
     3931      }
     3932      /**
     3933       * Alias for open()
     3934       *
     3935       * @return self
     3936       * @public
     3937       */
     3938
     3939    }, {
     3940      key: "connect",
     3941      value: function connect(fn) {
     3942        return this.open(fn);
     3943      }
     3944      /**
     3945       * Called upon transport open.
     3946       *
     3947       * @private
     3948       */
     3949
     3950    }, {
     3951      key: "onopen",
     3952      value: function onopen() {
     3953        // clear old subs
     3954        this.cleanup(); // mark as open
     3955
     3956        this._readyState = "open";
     3957        this.emitReserved("open"); // add new subs
     3958
     3959        var socket = this.engine;
     3960        this.subs.push(on(socket, "ping", this.onping.bind(this)), on(socket, "data", this.ondata.bind(this)), on(socket, "error", this.onerror.bind(this)), on(socket, "close", this.onclose.bind(this)), on(this.decoder, "decoded", this.ondecoded.bind(this)));
     3961      }
     3962      /**
     3963       * Called upon a ping.
     3964       *
     3965       * @private
     3966       */
     3967
     3968    }, {
     3969      key: "onping",
     3970      value: function onping() {
     3971        this.emitReserved("ping");
     3972      }
     3973      /**
     3974       * Called with data.
     3975       *
     3976       * @private
     3977       */
     3978
     3979    }, {
     3980      key: "ondata",
     3981      value: function ondata(data) {
     3982        this.decoder.add(data);
     3983      }
     3984      /**
     3985       * Called when parser fully decodes a packet.
     3986       *
     3987       * @private
     3988       */
     3989
     3990    }, {
     3991      key: "ondecoded",
     3992      value: function ondecoded(packet) {
     3993        this.emitReserved("packet", packet);
     3994      }
     3995      /**
     3996       * Called upon socket error.
     3997       *
     3998       * @private
     3999       */
     4000
     4001    }, {
     4002      key: "onerror",
     4003      value: function onerror(err) {
     4004        this.emitReserved("error", err);
     4005      }
     4006      /**
     4007       * Creates a new socket for the given `nsp`.
     4008       *
     4009       * @return {Socket}
     4010       * @public
     4011       */
     4012
     4013    }, {
     4014      key: "socket",
     4015      value: function socket(nsp, opts) {
     4016        var socket = this.nsps[nsp];
     4017
     4018        if (!socket) {
     4019          socket = new Socket(this, nsp, opts);
     4020          this.nsps[nsp] = socket;
     4021        }
     4022
     4023        return socket;
     4024      }
     4025      /**
     4026       * Called upon a socket close.
     4027       *
     4028       * @param socket
     4029       * @private
     4030       */
     4031
     4032    }, {
     4033      key: "_destroy",
     4034      value: function _destroy(socket) {
     4035        var nsps = Object.keys(this.nsps);
     4036
     4037        for (var _i = 0, _nsps = nsps; _i < _nsps.length; _i++) {
     4038          var nsp = _nsps[_i];
     4039          var _socket = this.nsps[nsp];
     4040
     4041          if (_socket.active) {
     4042            return;
     4043          }
     4044        }
     4045
     4046        this._close();
     4047      }
     4048      /**
     4049       * Writes a packet.
     4050       *
     4051       * @param packet
     4052       * @private
     4053       */
     4054
     4055    }, {
     4056      key: "_packet",
     4057      value: function _packet(packet) {
     4058        var encodedPackets = this.encoder.encode(packet);
     4059
     4060        for (var i = 0; i < encodedPackets.length; i++) {
     4061          this.engine.write(encodedPackets[i], packet.options);
     4062        }
     4063      }
     4064      /**
     4065       * Clean up transport subscriptions and packet buffer.
     4066       *
     4067       * @private
     4068       */
     4069
     4070    }, {
     4071      key: "cleanup",
     4072      value: function cleanup() {
     4073        this.subs.forEach(function (subDestroy) {
     4074          return subDestroy();
     4075        });
     4076        this.subs.length = 0;
     4077        this.decoder.destroy();
     4078      }
     4079      /**
     4080       * Close the current socket.
     4081       *
     4082       * @private
     4083       */
     4084
     4085    }, {
     4086      key: "_close",
     4087      value: function _close() {
     4088        this.skipReconnect = true;
     4089        this._reconnecting = false;
     4090        this.onclose("forced close");
     4091        if (this.engine) this.engine.close();
     4092      }
     4093      /**
     4094       * Alias for close()
     4095       *
     4096       * @private
     4097       */
     4098
     4099    }, {
     4100      key: "disconnect",
     4101      value: function disconnect() {
     4102        return this._close();
     4103      }
     4104      /**
     4105       * Called upon engine close.
     4106       *
     4107       * @private
     4108       */
     4109
     4110    }, {
     4111      key: "onclose",
     4112      value: function onclose(reason) {
     4113        this.cleanup();
     4114        this.backoff.reset();
     4115        this._readyState = "closed";
     4116        this.emitReserved("close", reason);
     4117
     4118        if (this._reconnection && !this.skipReconnect) {
     4119          this.reconnect();
     4120        }
     4121      }
     4122      /**
     4123       * Attempt a reconnection.
     4124       *
     4125       * @private
     4126       */
     4127
     4128    }, {
     4129      key: "reconnect",
     4130      value: function reconnect() {
     4131        var _this3 = this;
     4132
     4133        if (this._reconnecting || this.skipReconnect) return this;
     4134        var self = this;
     4135
     4136        if (this.backoff.attempts >= this._reconnectionAttempts) {
     4137          this.backoff.reset();
     4138          this.emitReserved("reconnect_failed");
     4139          this._reconnecting = false;
     4140        } else {
     4141          var delay = this.backoff.duration();
     4142          this._reconnecting = true;
     4143          var timer = this.setTimeoutFn(function () {
     4144            if (self.skipReconnect) return;
     4145
     4146            _this3.emitReserved("reconnect_attempt", self.backoff.attempts); // check again for the case socket closed in above events
     4147
     4148
     4149            if (self.skipReconnect) return;
     4150            self.open(function (err) {
     4151              if (err) {
     4152                self._reconnecting = false;
     4153                self.reconnect();
     4154
     4155                _this3.emitReserved("reconnect_error", err);
     4156              } else {
     4157                self.onreconnect();
     4158              }
     4159            });
     4160          }, delay);
     4161
     4162          if (this.opts.autoUnref) {
     4163            timer.unref();
     4164          }
     4165
     4166          this.subs.push(function subDestroy() {
     4167            clearTimeout(timer);
     4168          });
     4169        }
     4170      }
     4171      /**
     4172       * Called upon successful reconnect.
     4173       *
     4174       * @private
     4175       */
     4176
     4177    }, {
     4178      key: "onreconnect",
     4179      value: function onreconnect() {
     4180        var attempt = this.backoff.attempts;
     4181        this._reconnecting = false;
     4182        this.backoff.reset();
     4183        this.emitReserved("reconnect", attempt);
     4184      }
     4185    }]);
     4186
     4187    return Manager;
     4188  }(Emitter_1);
     4189
     4190  /**
     4191   * Managers cache.
     4192   */
     4193
     4194  var cache = {};
     4195
     4196  function lookup(uri, opts) {
     4197    if (_typeof(uri) === "object") {
     4198      opts = uri;
     4199      uri = undefined;
     4200    }
     4201
     4202    opts = opts || {};
     4203    var parsed = url(uri, opts.path || "/socket.io");
     4204    var source = parsed.source;
     4205    var id = parsed.id;
     4206    var path = parsed.path;
     4207    var sameNamespace = cache[id] && path in cache[id]["nsps"];
     4208    var newConnection = opts.forceNew || opts["force new connection"] || false === opts.multiplex || sameNamespace;
     4209    var io;
     4210
     4211    if (newConnection) {
     4212      io = new Manager(source, opts);
     4213    } else {
     4214      if (!cache[id]) {
     4215        cache[id] = new Manager(source, opts);
     4216      }
     4217
     4218      io = cache[id];
     4219    }
     4220
     4221    if (parsed.query && !opts.query) {
     4222      opts.query = parsed.queryKey;
     4223    }
     4224
     4225    return io.socket(parsed.path, opts);
     4226  } // so that "lookup" can be used both as a function (e.g. `io(...)`) and as a
     4227  // namespace (e.g. `io.connect(...)`), for backward compatibility
     4228
     4229
     4230  _extends(lookup, {
     4231    Manager: Manager,
     4232    Socket: Socket,
     4233    io: lookup,
     4234    connect: lookup
     4235  });
     4236
     4237  return lookup;
     4238
     4239}));
    58704240//# sourceMappingURL=socket.io.js.map
Note: See TracChangeset for help on using the changeset viewer.