socket.io.min.js 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060
  1. /*!
  2. * Socket.IO v4.4.1
  3. * (c) 2014-2022 Guillermo Rauch
  4. * Released under the MIT License.
  5. */
  6. !(function (t, e) {
  7. 'object' == typeof exports && 'undefined' != typeof module
  8. ? (module.exports = e())
  9. : 'function' == typeof define && define.amd
  10. ? define(e)
  11. : ((t = 'undefined' != typeof globalThis ? globalThis : t || self).io = e())
  12. })(this, function () {
  13. 'use strict'
  14. function t(e) {
  15. return (
  16. (t =
  17. 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
  18. ? function (t) {
  19. return typeof t
  20. }
  21. : function (t) {
  22. return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? 'symbol' : typeof t
  23. }),
  24. t(e)
  25. )
  26. }
  27. function e(t, e) {
  28. if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
  29. }
  30. function n(t, e) {
  31. for (var n = 0; n < e.length; n++) {
  32. var r = e[n]
  33. ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r)
  34. }
  35. }
  36. function r(t, e, r) {
  37. return e && n(t.prototype, e), r && n(t, r), t
  38. }
  39. function o() {
  40. return (
  41. (o =
  42. Object.assign ||
  43. function (t) {
  44. for (var e = 1; e < arguments.length; e++) {
  45. var n = arguments[e]
  46. for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r])
  47. }
  48. return t
  49. }),
  50. o.apply(this, arguments)
  51. )
  52. }
  53. function i(t, e) {
  54. if ('function' != typeof e && null !== e) throw new TypeError('Super expression must either be null or a function')
  55. ;(t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } })), e && a(t, e)
  56. }
  57. function s(t) {
  58. return (
  59. (s = Object.setPrototypeOf
  60. ? Object.getPrototypeOf
  61. : function (t) {
  62. return t.__proto__ || Object.getPrototypeOf(t)
  63. }),
  64. s(t)
  65. )
  66. }
  67. function a(t, e) {
  68. return (
  69. (a =
  70. Object.setPrototypeOf ||
  71. function (t, e) {
  72. return (t.__proto__ = e), t
  73. }),
  74. a(t, e)
  75. )
  76. }
  77. function c(t) {
  78. if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
  79. return t
  80. }
  81. function u(t, e) {
  82. if (e && ('object' == typeof e || 'function' == typeof e)) return e
  83. if (void 0 !== e) throw new TypeError('Derived constructors may only return object or undefined')
  84. return c(t)
  85. }
  86. function h(t) {
  87. var e = (function () {
  88. if ('undefined' == typeof Reflect || !Reflect.construct) return !1
  89. if (Reflect.construct.sham) return !1
  90. if ('function' == typeof Proxy) return !0
  91. try {
  92. return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0
  93. } catch (t) {
  94. return !1
  95. }
  96. })()
  97. return function () {
  98. var n,
  99. r = s(t)
  100. if (e) {
  101. var o = s(this).constructor
  102. n = Reflect.construct(r, arguments, o)
  103. } else n = r.apply(this, arguments)
  104. return u(this, n)
  105. }
  106. }
  107. function f(t, e, n) {
  108. return (
  109. (f =
  110. 'undefined' != typeof Reflect && Reflect.get
  111. ? Reflect.get
  112. : function (t, e, n) {
  113. var r = (function (t, e) {
  114. for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = s(t)); );
  115. return t
  116. })(t, e)
  117. if (r) {
  118. var o = Object.getOwnPropertyDescriptor(r, e)
  119. return o.get ? o.get.call(n) : o.value
  120. }
  121. }),
  122. f(t, e, n || t)
  123. )
  124. }
  125. function l(t, e) {
  126. ;(null == e || e > t.length) && (e = t.length)
  127. for (var n = 0, r = new Array(e); n < e; n++) r[n] = t[n]
  128. return r
  129. }
  130. function p(t, e) {
  131. var n = ('undefined' != typeof Symbol && t[Symbol.iterator]) || t['@@iterator']
  132. if (!n) {
  133. if (
  134. Array.isArray(t) ||
  135. (n = (function (t, e) {
  136. if (t) {
  137. if ('string' == typeof t) return l(t, e)
  138. var n = Object.prototype.toString.call(t).slice(8, -1)
  139. return (
  140. 'Object' === n && t.constructor && (n = t.constructor.name),
  141. 'Map' === n || 'Set' === n ? Array.from(t) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? l(t, e) : void 0
  142. )
  143. }
  144. })(t)) ||
  145. (e && t && 'number' == typeof t.length)
  146. ) {
  147. n && (t = n)
  148. var r = 0,
  149. o = function () {}
  150. return {
  151. s: o,
  152. n: function () {
  153. return r >= t.length ? { done: !0 } : { done: !1, value: t[r++] }
  154. },
  155. e: function (t) {
  156. throw t
  157. },
  158. f: o,
  159. }
  160. }
  161. throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
  162. }
  163. var i,
  164. s = !0,
  165. a = !1
  166. return {
  167. s: function () {
  168. n = n.call(t)
  169. },
  170. n: function () {
  171. var t = n.next()
  172. return (s = t.done), t
  173. },
  174. e: function (t) {
  175. ;(a = !0), (i = t)
  176. },
  177. f: function () {
  178. try {
  179. s || null == n.return || n.return()
  180. } finally {
  181. if (a) throw i
  182. }
  183. },
  184. }
  185. }
  186. var d =
  187. /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
  188. y = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],
  189. v = function (t) {
  190. var e = t,
  191. n = t.indexOf('['),
  192. r = t.indexOf(']')
  193. ;-1 != n && -1 != r && (t = t.substring(0, n) + t.substring(n, r).replace(/:/g, ';') + t.substring(r, t.length))
  194. for (var o, i, s = d.exec(t || ''), a = {}, c = 14; c--; ) a[y[c]] = s[c] || ''
  195. return (
  196. -1 != n &&
  197. -1 != r &&
  198. ((a.source = e),
  199. (a.host = a.host.substring(1, a.host.length - 1).replace(/;/g, ':')),
  200. (a.authority = a.authority.replace('[', '').replace(']', '').replace(/;/g, ':')),
  201. (a.ipv6uri = !0)),
  202. (a.pathNames = (function (t, e) {
  203. var n = /\/{2,9}/g,
  204. r = e.replace(n, '/').split('/')
  205. ;('/' != e.substr(0, 1) && 0 !== e.length) || r.splice(0, 1)
  206. '/' == e.substr(e.length - 1, 1) && r.splice(r.length - 1, 1)
  207. return r
  208. })(0, a.path)),
  209. (a.queryKey =
  210. ((o = a.query),
  211. (i = {}),
  212. o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function (t, e, n) {
  213. e && (i[e] = n)
  214. }),
  215. i)),
  216. a
  217. )
  218. }
  219. var m = { exports: {} }
  220. try {
  221. m.exports = 'undefined' != typeof XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()
  222. } catch (t) {
  223. m.exports = !1
  224. }
  225. var g = m.exports,
  226. k = 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : Function('return this')()
  227. function b(t) {
  228. var e = t.xdomain
  229. try {
  230. if ('undefined' != typeof XMLHttpRequest && (!e || g)) return new XMLHttpRequest()
  231. } catch (t) {}
  232. if (!e)
  233. try {
  234. return new k[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP')
  235. } catch (t) {}
  236. }
  237. function w(t) {
  238. for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r]
  239. return n.reduce(function (e, n) {
  240. return t.hasOwnProperty(n) && (e[n] = t[n]), e
  241. }, {})
  242. }
  243. var _ = setTimeout,
  244. E = clearTimeout
  245. function A(t, e) {
  246. e.useNativeTimers ? ((t.setTimeoutFn = _.bind(k)), (t.clearTimeoutFn = E.bind(k))) : ((t.setTimeoutFn = setTimeout.bind(k)), (t.clearTimeoutFn = clearTimeout.bind(k)))
  247. }
  248. var R = T
  249. function T(t) {
  250. if (t)
  251. return (function (t) {
  252. for (var e in T.prototype) t[e] = T.prototype[e]
  253. return t
  254. })(t)
  255. }
  256. ;(T.prototype.on = T.prototype.addEventListener =
  257. function (t, e) {
  258. return (this._callbacks = this._callbacks || {}), (this._callbacks['$' + t] = this._callbacks['$' + t] || []).push(e), this
  259. }),
  260. (T.prototype.once = function (t, e) {
  261. function n() {
  262. this.off(t, n), e.apply(this, arguments)
  263. }
  264. return (n.fn = e), this.on(t, n), this
  265. }),
  266. (T.prototype.off =
  267. T.prototype.removeListener =
  268. T.prototype.removeAllListeners =
  269. T.prototype.removeEventListener =
  270. function (t, e) {
  271. if (((this._callbacks = this._callbacks || {}), 0 == arguments.length)) return (this._callbacks = {}), this
  272. var n,
  273. r = this._callbacks['$' + t]
  274. if (!r) return this
  275. if (1 == arguments.length) return delete this._callbacks['$' + t], this
  276. for (var o = 0; o < r.length; o++)
  277. if ((n = r[o]) === e || n.fn === e) {
  278. r.splice(o, 1)
  279. break
  280. }
  281. return 0 === r.length && delete this._callbacks['$' + t], this
  282. }),
  283. (T.prototype.emit = function (t) {
  284. this._callbacks = this._callbacks || {}
  285. for (var e = new Array(arguments.length - 1), n = this._callbacks['$' + t], r = 1; r < arguments.length; r++) e[r - 1] = arguments[r]
  286. if (n) {
  287. r = 0
  288. for (var o = (n = n.slice(0)).length; r < o; ++r) n[r].apply(this, e)
  289. }
  290. return this
  291. }),
  292. (T.prototype.emitReserved = T.prototype.emit),
  293. (T.prototype.listeners = function (t) {
  294. return (this._callbacks = this._callbacks || {}), this._callbacks['$' + t] || []
  295. }),
  296. (T.prototype.hasListeners = function (t) {
  297. return !!this.listeners(t).length
  298. })
  299. var C = Object.create(null)
  300. ;(C.open = '0'), (C.close = '1'), (C.ping = '2'), (C.pong = '3'), (C.message = '4'), (C.upgrade = '5'), (C.noop = '6')
  301. var O = Object.create(null)
  302. Object.keys(C).forEach(function (t) {
  303. O[C[t]] = t
  304. })
  305. for (
  306. var S = { type: 'error', data: 'parser error' },
  307. B = 'function' == typeof Blob || ('undefined' != typeof Blob && '[object BlobConstructor]' === Object.prototype.toString.call(Blob)),
  308. N = 'function' == typeof ArrayBuffer,
  309. x = function (t, e, n) {
  310. var r,
  311. o = t.type,
  312. i = t.data
  313. return B && i instanceof Blob
  314. ? e
  315. ? n(i)
  316. : L(i, n)
  317. : N && (i instanceof ArrayBuffer || ((r = i), 'function' == typeof ArrayBuffer.isView ? ArrayBuffer.isView(r) : r && r.buffer instanceof ArrayBuffer))
  318. ? e
  319. ? n(i)
  320. : L(new Blob([i]), n)
  321. : n(C[o] + (i || ''))
  322. },
  323. L = function (t, e) {
  324. var n = new FileReader()
  325. return (
  326. (n.onload = function () {
  327. var t = n.result.split(',')[1]
  328. e('b' + t)
  329. }),
  330. n.readAsDataURL(t)
  331. )
  332. },
  333. j = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
  334. P = 'undefined' == typeof Uint8Array ? [] : new Uint8Array(256),
  335. q = 0;
  336. q < j.length;
  337. q++
  338. )
  339. P[j.charCodeAt(q)] = q
  340. var D,
  341. I = 'function' == typeof ArrayBuffer,
  342. F = function (t, e) {
  343. if ('string' != typeof t) return { type: 'message', data: U(t, e) }
  344. var n = t.charAt(0)
  345. return 'b' === n ? { type: 'message', data: M(t.substring(1), e) } : O[n] ? (t.length > 1 ? { type: O[n], data: t.substring(1) } : { type: O[n] }) : S
  346. },
  347. M = function (t, e) {
  348. if (I) {
  349. var n = (function (t) {
  350. var e,
  351. n,
  352. r,
  353. o,
  354. i,
  355. s = 0.75 * t.length,
  356. a = t.length,
  357. c = 0
  358. '=' === t[t.length - 1] && (s--, '=' === t[t.length - 2] && s--)
  359. var u = new ArrayBuffer(s),
  360. h = new Uint8Array(u)
  361. for (e = 0; e < a; e += 4)
  362. (n = P[t.charCodeAt(e)]),
  363. (r = P[t.charCodeAt(e + 1)]),
  364. (o = P[t.charCodeAt(e + 2)]),
  365. (i = P[t.charCodeAt(e + 3)]),
  366. (h[c++] = (n << 2) | (r >> 4)),
  367. (h[c++] = ((15 & r) << 4) | (o >> 2)),
  368. (h[c++] = ((3 & o) << 6) | (63 & i))
  369. return u
  370. })(t)
  371. return U(n, e)
  372. }
  373. return { base64: !0, data: t }
  374. },
  375. U = function (t, e) {
  376. return 'blob' === e && t instanceof ArrayBuffer ? new Blob([t]) : t
  377. },
  378. V = String.fromCharCode(30),
  379. H = (function (t) {
  380. i(o, t)
  381. var n = h(o)
  382. function o(t) {
  383. var r
  384. return e(this, o), ((r = n.call(this)).writable = !1), A(c(r), t), (r.opts = t), (r.query = t.query), (r.readyState = ''), (r.socket = t.socket), r
  385. }
  386. return (
  387. r(o, [
  388. {
  389. key: 'onError',
  390. value: function (t, e) {
  391. var n = new Error(t)
  392. return (n.type = 'TransportError'), (n.description = e), f(s(o.prototype), 'emit', this).call(this, 'error', n), this
  393. },
  394. },
  395. {
  396. key: 'open',
  397. value: function () {
  398. return ('closed' !== this.readyState && '' !== this.readyState) || ((this.readyState = 'opening'), this.doOpen()), this
  399. },
  400. },
  401. {
  402. key: 'close',
  403. value: function () {
  404. return ('opening' !== this.readyState && 'open' !== this.readyState) || (this.doClose(), this.onClose()), this
  405. },
  406. },
  407. {
  408. key: 'send',
  409. value: function (t) {
  410. 'open' === this.readyState && this.write(t)
  411. },
  412. },
  413. {
  414. key: 'onOpen',
  415. value: function () {
  416. ;(this.readyState = 'open'), (this.writable = !0), f(s(o.prototype), 'emit', this).call(this, 'open')
  417. },
  418. },
  419. {
  420. key: 'onData',
  421. value: function (t) {
  422. var e = F(t, this.socket.binaryType)
  423. this.onPacket(e)
  424. },
  425. },
  426. {
  427. key: 'onPacket',
  428. value: function (t) {
  429. f(s(o.prototype), 'emit', this).call(this, 'packet', t)
  430. },
  431. },
  432. {
  433. key: 'onClose',
  434. value: function () {
  435. ;(this.readyState = 'closed'), f(s(o.prototype), 'emit', this).call(this, 'close')
  436. },
  437. },
  438. ]),
  439. o
  440. )
  441. })(R),
  442. K = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split(''),
  443. Y = {},
  444. z = 0,
  445. $ = 0
  446. function W(t) {
  447. var e = ''
  448. do {
  449. ;(e = K[t % 64] + e), (t = Math.floor(t / 64))
  450. } while (t > 0)
  451. return e
  452. }
  453. function J() {
  454. var t = W(+new Date())
  455. return t !== D ? ((z = 0), (D = t)) : t + '.' + W(z++)
  456. }
  457. for (; $ < 64; $++) Y[K[$]] = $
  458. ;(J.encode = W),
  459. (J.decode = function (t) {
  460. var e = 0
  461. for ($ = 0; $ < t.length; $++) e = 64 * e + Y[t.charAt($)]
  462. return e
  463. })
  464. var X = J,
  465. G = {
  466. encode: function (t) {
  467. var e = ''
  468. for (var n in t) t.hasOwnProperty(n) && (e.length && (e += '&'), (e += encodeURIComponent(n) + '=' + encodeURIComponent(t[n])))
  469. return e
  470. },
  471. decode: function (t) {
  472. for (var e = {}, n = t.split('&'), r = 0, o = n.length; r < o; r++) {
  473. var i = n[r].split('=')
  474. e[decodeURIComponent(i[0])] = decodeURIComponent(i[1])
  475. }
  476. return e
  477. },
  478. },
  479. Q = (function (t) {
  480. i(o, t)
  481. var n = h(o)
  482. function o() {
  483. var t
  484. return e(this, o), ((t = n.apply(this, arguments)).polling = !1), t
  485. }
  486. return (
  487. r(o, [
  488. {
  489. key: 'name',
  490. get: function () {
  491. return 'polling'
  492. },
  493. },
  494. {
  495. key: 'doOpen',
  496. value: function () {
  497. this.poll()
  498. },
  499. },
  500. {
  501. key: 'pause',
  502. value: function (t) {
  503. var e = this
  504. this.readyState = 'pausing'
  505. var n = function () {
  506. ;(e.readyState = 'paused'), t()
  507. }
  508. if (this.polling || !this.writable) {
  509. var r = 0
  510. this.polling &&
  511. (r++,
  512. this.once('pollComplete', function () {
  513. --r || n()
  514. })),
  515. this.writable ||
  516. (r++,
  517. this.once('drain', function () {
  518. --r || n()
  519. }))
  520. } else n()
  521. },
  522. },
  523. {
  524. key: 'poll',
  525. value: function () {
  526. ;(this.polling = !0), this.doPoll(), this.emit('poll')
  527. },
  528. },
  529. {
  530. key: 'onData',
  531. value: function (t) {
  532. var e = this
  533. ;(function (t, e) {
  534. for (var n = t.split(V), r = [], o = 0; o < n.length; o++) {
  535. var i = F(n[o], e)
  536. if ((r.push(i), 'error' === i.type)) break
  537. }
  538. return r
  539. })(t, this.socket.binaryType).forEach(function (t) {
  540. if (('opening' === e.readyState && 'open' === t.type && e.onOpen(), 'close' === t.type)) return e.onClose(), !1
  541. e.onPacket(t)
  542. }),
  543. 'closed' !== this.readyState && ((this.polling = !1), this.emit('pollComplete'), 'open' === this.readyState && this.poll())
  544. },
  545. },
  546. {
  547. key: 'doClose',
  548. value: function () {
  549. var t = this,
  550. e = function () {
  551. t.write([{ type: 'close' }])
  552. }
  553. 'open' === this.readyState ? e() : this.once('open', e)
  554. },
  555. },
  556. {
  557. key: 'write',
  558. value: function (t) {
  559. var e = this
  560. ;(this.writable = !1),
  561. (function (t, e) {
  562. var n = t.length,
  563. r = new Array(n),
  564. o = 0
  565. t.forEach(function (t, i) {
  566. x(t, !1, function (t) {
  567. ;(r[i] = t), ++o === n && e(r.join(V))
  568. })
  569. })
  570. })(t, function (t) {
  571. e.doWrite(t, function () {
  572. ;(e.writable = !0), e.emit('drain')
  573. })
  574. })
  575. },
  576. },
  577. {
  578. key: 'uri',
  579. value: function () {
  580. var t = this.query || {},
  581. e = this.opts.secure ? 'https' : 'http',
  582. n = ''
  583. !1 !== this.opts.timestampRequests && (t[this.opts.timestampParam] = X()),
  584. this.supportsBinary || t.sid || (t.b64 = 1),
  585. this.opts.port && (('https' === e && 443 !== Number(this.opts.port)) || ('http' === e && 80 !== Number(this.opts.port))) && (n = ':' + this.opts.port)
  586. var r = G.encode(t)
  587. return e + '://' + (-1 !== this.opts.hostname.indexOf(':') ? '[' + this.opts.hostname + ']' : this.opts.hostname) + n + this.opts.path + (r.length ? '?' + r : '')
  588. },
  589. },
  590. ]),
  591. o
  592. )
  593. })(H)
  594. function Z() {}
  595. var tt = null != new b({ xdomain: !1 }).responseType,
  596. et = (function (t) {
  597. i(s, t)
  598. var n = h(s)
  599. function s(t) {
  600. var r
  601. if ((e(this, s), (r = n.call(this, t)), 'undefined' != typeof location)) {
  602. var o = 'https:' === location.protocol,
  603. i = location.port
  604. i || (i = o ? '443' : '80'), (r.xd = ('undefined' != typeof location && t.hostname !== location.hostname) || i !== t.port), (r.xs = t.secure !== o)
  605. }
  606. var a = t && t.forceBase64
  607. return (r.supportsBinary = tt && !a), r
  608. }
  609. return (
  610. r(s, [
  611. {
  612. key: 'request',
  613. value: function () {
  614. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
  615. return o(t, { xd: this.xd, xs: this.xs }, this.opts), new nt(this.uri(), t)
  616. },
  617. },
  618. {
  619. key: 'doWrite',
  620. value: function (t, e) {
  621. var n = this,
  622. r = this.request({ method: 'POST', data: t })
  623. r.on('success', e),
  624. r.on('error', function (t) {
  625. n.onError('xhr post error', t)
  626. })
  627. },
  628. },
  629. {
  630. key: 'doPoll',
  631. value: function () {
  632. var t = this,
  633. e = this.request()
  634. e.on('data', this.onData.bind(this)),
  635. e.on('error', function (e) {
  636. t.onError('xhr poll error', e)
  637. }),
  638. (this.pollXhr = e)
  639. },
  640. },
  641. ]),
  642. s
  643. )
  644. })(Q),
  645. nt = (function (t) {
  646. i(o, t)
  647. var n = h(o)
  648. function o(t, r) {
  649. var i
  650. return (
  651. e(this, o),
  652. A(c((i = n.call(this))), r),
  653. (i.opts = r),
  654. (i.method = r.method || 'GET'),
  655. (i.uri = t),
  656. (i.async = !1 !== r.async),
  657. (i.data = void 0 !== r.data ? r.data : null),
  658. i.create(),
  659. i
  660. )
  661. }
  662. return (
  663. r(o, [
  664. {
  665. key: 'create',
  666. value: function () {
  667. var t = this,
  668. e = w(this.opts, 'agent', 'pfx', 'key', 'passphrase', 'cert', 'ca', 'ciphers', 'rejectUnauthorized', 'autoUnref')
  669. ;(e.xdomain = !!this.opts.xd), (e.xscheme = !!this.opts.xs)
  670. var n = (this.xhr = new b(e))
  671. try {
  672. n.open(this.method, this.uri, this.async)
  673. try {
  674. if (this.opts.extraHeaders)
  675. for (var r in (n.setDisableHeaderCheck && n.setDisableHeaderCheck(!0), this.opts.extraHeaders))
  676. this.opts.extraHeaders.hasOwnProperty(r) && n.setRequestHeader(r, this.opts.extraHeaders[r])
  677. } catch (t) {}
  678. if ('POST' === this.method)
  679. try {
  680. n.setRequestHeader('Content-type', 'text/plain;charset=UTF-8')
  681. } catch (t) {}
  682. try {
  683. n.setRequestHeader('Accept', '*/*')
  684. } catch (t) {}
  685. 'withCredentials' in n && (n.withCredentials = this.opts.withCredentials),
  686. this.opts.requestTimeout && (n.timeout = this.opts.requestTimeout),
  687. (n.onreadystatechange = function () {
  688. 4 === n.readyState &&
  689. (200 === n.status || 1223 === n.status
  690. ? t.onLoad()
  691. : t.setTimeoutFn(function () {
  692. t.onError('number' == typeof n.status ? n.status : 0)
  693. }, 0))
  694. }),
  695. n.send(this.data)
  696. } catch (e) {
  697. return void this.setTimeoutFn(function () {
  698. t.onError(e)
  699. }, 0)
  700. }
  701. 'undefined' != typeof document && ((this.index = o.requestsCount++), (o.requests[this.index] = this))
  702. },
  703. },
  704. {
  705. key: 'onSuccess',
  706. value: function () {
  707. this.emit('success'), this.cleanup()
  708. },
  709. },
  710. {
  711. key: 'onData',
  712. value: function (t) {
  713. this.emit('data', t), this.onSuccess()
  714. },
  715. },
  716. {
  717. key: 'onError',
  718. value: function (t) {
  719. this.emit('error', t), this.cleanup(!0)
  720. },
  721. },
  722. {
  723. key: 'cleanup',
  724. value: function (t) {
  725. if (void 0 !== this.xhr && null !== this.xhr) {
  726. if (((this.xhr.onreadystatechange = Z), t))
  727. try {
  728. this.xhr.abort()
  729. } catch (t) {}
  730. 'undefined' != typeof document && delete o.requests[this.index], (this.xhr = null)
  731. }
  732. },
  733. },
  734. {
  735. key: 'onLoad',
  736. value: function () {
  737. var t = this.xhr.responseText
  738. null !== t && this.onData(t)
  739. },
  740. },
  741. {
  742. key: 'abort',
  743. value: function () {
  744. this.cleanup()
  745. },
  746. },
  747. ]),
  748. o
  749. )
  750. })(R)
  751. if (((nt.requestsCount = 0), (nt.requests = {}), 'undefined' != typeof document))
  752. if ('function' == typeof attachEvent) attachEvent('onunload', rt)
  753. else if ('function' == typeof addEventListener) {
  754. addEventListener('onpagehide' in k ? 'pagehide' : 'unload', rt, !1)
  755. }
  756. function rt() {
  757. for (var t in nt.requests) nt.requests.hasOwnProperty(t) && nt.requests[t].abort()
  758. }
  759. var ot =
  760. 'function' == typeof Promise && 'function' == typeof Promise.resolve
  761. ? function (t) {
  762. return Promise.resolve().then(t)
  763. }
  764. : function (t, e) {
  765. return e(t, 0)
  766. },
  767. it = k.WebSocket || k.MozWebSocket,
  768. st = 'undefined' != typeof navigator && 'string' == typeof navigator.product && 'reactnative' === navigator.product.toLowerCase(),
  769. at = (function (t) {
  770. i(o, t)
  771. var n = h(o)
  772. function o(t) {
  773. var r
  774. return e(this, o), ((r = n.call(this, t)).supportsBinary = !t.forceBase64), r
  775. }
  776. return (
  777. r(o, [
  778. {
  779. key: 'name',
  780. get: function () {
  781. return 'websocket'
  782. },
  783. },
  784. {
  785. key: 'doOpen',
  786. value: function () {
  787. if (this.check()) {
  788. var t = this.uri(),
  789. e = this.opts.protocols,
  790. n = st
  791. ? {}
  792. : w(
  793. this.opts,
  794. 'agent',
  795. 'perMessageDeflate',
  796. 'pfx',
  797. 'key',
  798. 'passphrase',
  799. 'cert',
  800. 'ca',
  801. 'ciphers',
  802. 'rejectUnauthorized',
  803. 'localAddress',
  804. 'protocolVersion',
  805. 'origin',
  806. 'maxPayload',
  807. 'family',
  808. 'checkServerIdentity'
  809. )
  810. this.opts.extraHeaders && (n.headers = this.opts.extraHeaders)
  811. try {
  812. this.ws = st ? new it(t, e, n) : e ? new it(t, e) : new it(t)
  813. } catch (t) {
  814. return this.emit('error', t)
  815. }
  816. ;(this.ws.binaryType = this.socket.binaryType || 'arraybuffer'), this.addEventListeners()
  817. }
  818. },
  819. },
  820. {
  821. key: 'addEventListeners',
  822. value: function () {
  823. var t = this
  824. ;(this.ws.onopen = function () {
  825. t.opts.autoUnref && t.ws._socket.unref(), t.onOpen()
  826. }),
  827. (this.ws.onclose = this.onClose.bind(this)),
  828. (this.ws.onmessage = function (e) {
  829. return t.onData(e.data)
  830. }),
  831. (this.ws.onerror = function (e) {
  832. return t.onError('websocket error', e)
  833. })
  834. },
  835. },
  836. {
  837. key: 'write',
  838. value: function (t) {
  839. var e = this
  840. this.writable = !1
  841. for (
  842. var n = function (n) {
  843. var r = t[n],
  844. o = n === t.length - 1
  845. x(r, e.supportsBinary, function (t) {
  846. try {
  847. e.ws.send(t)
  848. } catch (t) {}
  849. o &&
  850. ot(function () {
  851. ;(e.writable = !0), e.emit('drain')
  852. }, e.setTimeoutFn)
  853. })
  854. },
  855. r = 0;
  856. r < t.length;
  857. r++
  858. )
  859. n(r)
  860. },
  861. },
  862. {
  863. key: 'doClose',
  864. value: function () {
  865. void 0 !== this.ws && (this.ws.close(), (this.ws = null))
  866. },
  867. },
  868. {
  869. key: 'uri',
  870. value: function () {
  871. var t = this.query || {},
  872. e = this.opts.secure ? 'wss' : 'ws',
  873. n = ''
  874. this.opts.port && (('wss' === e && 443 !== Number(this.opts.port)) || ('ws' === e && 80 !== Number(this.opts.port))) && (n = ':' + this.opts.port),
  875. this.opts.timestampRequests && (t[this.opts.timestampParam] = X()),
  876. this.supportsBinary || (t.b64 = 1)
  877. var r = G.encode(t)
  878. return e + '://' + (-1 !== this.opts.hostname.indexOf(':') ? '[' + this.opts.hostname + ']' : this.opts.hostname) + n + this.opts.path + (r.length ? '?' + r : '')
  879. },
  880. },
  881. {
  882. key: 'check',
  883. value: function () {
  884. return !(!it || ('__initialize' in it && this.name === o.prototype.name))
  885. },
  886. },
  887. ]),
  888. o
  889. )
  890. })(H),
  891. ct = { websocket: at, polling: et },
  892. ut = (function (n) {
  893. i(a, n)
  894. var s = h(a)
  895. function a(n) {
  896. var r,
  897. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}
  898. return (
  899. e(this, a),
  900. (r = s.call(this)),
  901. n && 'object' === t(n) && ((i = n), (n = null)),
  902. n
  903. ? ((n = v(n)), (i.hostname = n.host), (i.secure = 'https' === n.protocol || 'wss' === n.protocol), (i.port = n.port), n.query && (i.query = n.query))
  904. : i.host && (i.hostname = v(i.host).host),
  905. A(c(r), i),
  906. (r.secure = null != i.secure ? i.secure : 'undefined' != typeof location && 'https:' === location.protocol),
  907. i.hostname && !i.port && (i.port = r.secure ? '443' : '80'),
  908. (r.hostname = i.hostname || ('undefined' != typeof location ? location.hostname : 'localhost')),
  909. (r.port = i.port || ('undefined' != typeof location && location.port ? location.port : r.secure ? '443' : '80')),
  910. (r.transports = i.transports || ['polling', 'websocket']),
  911. (r.readyState = ''),
  912. (r.writeBuffer = []),
  913. (r.prevBufferLen = 0),
  914. (r.opts = o(
  915. {
  916. path: '/engine.io',
  917. agent: !1,
  918. withCredentials: !1,
  919. upgrade: !0,
  920. timestampParam: 't',
  921. rememberUpgrade: !1,
  922. rejectUnauthorized: !0,
  923. perMessageDeflate: { threshold: 1024 },
  924. transportOptions: {},
  925. closeOnBeforeunload: !0,
  926. },
  927. i
  928. )),
  929. (r.opts.path = r.opts.path.replace(/\/$/, '') + '/'),
  930. 'string' == typeof r.opts.query && (r.opts.query = G.decode(r.opts.query)),
  931. (r.id = null),
  932. (r.upgrades = null),
  933. (r.pingInterval = null),
  934. (r.pingTimeout = null),
  935. (r.pingTimeoutTimer = null),
  936. 'function' == typeof addEventListener &&
  937. (r.opts.closeOnBeforeunload &&
  938. addEventListener(
  939. 'beforeunload',
  940. function () {
  941. r.transport && (r.transport.removeAllListeners(), r.transport.close())
  942. },
  943. !1
  944. ),
  945. 'localhost' !== r.hostname &&
  946. ((r.offlineEventListener = function () {
  947. r.onClose('transport close')
  948. }),
  949. addEventListener('offline', r.offlineEventListener, !1))),
  950. r.open(),
  951. r
  952. )
  953. }
  954. return (
  955. r(a, [
  956. {
  957. key: 'createTransport',
  958. value: function (t) {
  959. var e = (function (t) {
  960. var e = {}
  961. for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n])
  962. return e
  963. })(this.opts.query)
  964. ;(e.EIO = 4), (e.transport = t), this.id && (e.sid = this.id)
  965. var n = o({}, this.opts.transportOptions[t], this.opts, { query: e, socket: this, hostname: this.hostname, secure: this.secure, port: this.port })
  966. return new ct[t](n)
  967. },
  968. },
  969. {
  970. key: 'open',
  971. value: function () {
  972. var t,
  973. e = this
  974. if (this.opts.rememberUpgrade && a.priorWebsocketSuccess && -1 !== this.transports.indexOf('websocket')) t = 'websocket'
  975. else {
  976. if (0 === this.transports.length)
  977. return void this.setTimeoutFn(function () {
  978. e.emitReserved('error', 'No transports available')
  979. }, 0)
  980. t = this.transports[0]
  981. }
  982. this.readyState = 'opening'
  983. try {
  984. t = this.createTransport(t)
  985. } catch (t) {
  986. return this.transports.shift(), void this.open()
  987. }
  988. t.open(), this.setTransport(t)
  989. },
  990. },
  991. {
  992. key: 'setTransport',
  993. value: function (t) {
  994. var e = this
  995. this.transport && this.transport.removeAllListeners(),
  996. (this.transport = t),
  997. t
  998. .on('drain', this.onDrain.bind(this))
  999. .on('packet', this.onPacket.bind(this))
  1000. .on('error', this.onError.bind(this))
  1001. .on('close', function () {
  1002. e.onClose('transport close')
  1003. })
  1004. },
  1005. },
  1006. {
  1007. key: 'probe',
  1008. value: function (t) {
  1009. var e = this,
  1010. n = this.createTransport(t),
  1011. r = !1
  1012. a.priorWebsocketSuccess = !1
  1013. var o = function () {
  1014. r ||
  1015. (n.send([{ type: 'ping', data: 'probe' }]),
  1016. n.once('packet', function (t) {
  1017. if (!r)
  1018. if ('pong' === t.type && 'probe' === t.data) {
  1019. if (((e.upgrading = !0), e.emitReserved('upgrading', n), !n)) return
  1020. ;(a.priorWebsocketSuccess = 'websocket' === n.name),
  1021. e.transport.pause(function () {
  1022. r ||
  1023. ('closed' !== e.readyState &&
  1024. (f(), e.setTransport(n), n.send([{ type: 'upgrade' }]), e.emitReserved('upgrade', n), (n = null), (e.upgrading = !1), e.flush()))
  1025. })
  1026. } else {
  1027. var o = new Error('probe error')
  1028. ;(o.transport = n.name), e.emitReserved('upgradeError', o)
  1029. }
  1030. }))
  1031. }
  1032. function i() {
  1033. r || ((r = !0), f(), n.close(), (n = null))
  1034. }
  1035. var s = function (t) {
  1036. var r = new Error('probe error: ' + t)
  1037. ;(r.transport = n.name), i(), e.emitReserved('upgradeError', r)
  1038. }
  1039. function c() {
  1040. s('transport closed')
  1041. }
  1042. function u() {
  1043. s('socket closed')
  1044. }
  1045. function h(t) {
  1046. n && t.name !== n.name && i()
  1047. }
  1048. var f = function () {
  1049. n.removeListener('open', o), n.removeListener('error', s), n.removeListener('close', c), e.off('close', u), e.off('upgrading', h)
  1050. }
  1051. n.once('open', o), n.once('error', s), n.once('close', c), this.once('close', u), this.once('upgrading', h), n.open()
  1052. },
  1053. },
  1054. {
  1055. key: 'onOpen',
  1056. value: function () {
  1057. if (
  1058. ((this.readyState = 'open'),
  1059. (a.priorWebsocketSuccess = 'websocket' === this.transport.name),
  1060. this.emitReserved('open'),
  1061. this.flush(),
  1062. 'open' === this.readyState && this.opts.upgrade && this.transport.pause)
  1063. )
  1064. for (var t = 0, e = this.upgrades.length; t < e; t++) this.probe(this.upgrades[t])
  1065. },
  1066. },
  1067. {
  1068. key: 'onPacket',
  1069. value: function (t) {
  1070. if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState)
  1071. switch ((this.emitReserved('packet', t), this.emitReserved('heartbeat'), t.type)) {
  1072. case 'open':
  1073. this.onHandshake(JSON.parse(t.data))
  1074. break
  1075. case 'ping':
  1076. this.resetPingTimeout(), this.sendPacket('pong'), this.emitReserved('ping'), this.emitReserved('pong')
  1077. break
  1078. case 'error':
  1079. var e = new Error('server error')
  1080. ;(e.code = t.data), this.onError(e)
  1081. break
  1082. case 'message':
  1083. this.emitReserved('data', t.data), this.emitReserved('message', t.data)
  1084. }
  1085. },
  1086. },
  1087. {
  1088. key: 'onHandshake',
  1089. value: function (t) {
  1090. this.emitReserved('handshake', t),
  1091. (this.id = t.sid),
  1092. (this.transport.query.sid = t.sid),
  1093. (this.upgrades = this.filterUpgrades(t.upgrades)),
  1094. (this.pingInterval = t.pingInterval),
  1095. (this.pingTimeout = t.pingTimeout),
  1096. this.onOpen(),
  1097. 'closed' !== this.readyState && this.resetPingTimeout()
  1098. },
  1099. },
  1100. {
  1101. key: 'resetPingTimeout',
  1102. value: function () {
  1103. var t = this
  1104. this.clearTimeoutFn(this.pingTimeoutTimer),
  1105. (this.pingTimeoutTimer = this.setTimeoutFn(function () {
  1106. t.onClose('ping timeout')
  1107. }, this.pingInterval + this.pingTimeout)),
  1108. this.opts.autoUnref && this.pingTimeoutTimer.unref()
  1109. },
  1110. },
  1111. {
  1112. key: 'onDrain',
  1113. value: function () {
  1114. this.writeBuffer.splice(0, this.prevBufferLen), (this.prevBufferLen = 0), 0 === this.writeBuffer.length ? this.emitReserved('drain') : this.flush()
  1115. },
  1116. },
  1117. {
  1118. key: 'flush',
  1119. value: function () {
  1120. 'closed' !== this.readyState &&
  1121. this.transport.writable &&
  1122. !this.upgrading &&
  1123. this.writeBuffer.length &&
  1124. (this.transport.send(this.writeBuffer), (this.prevBufferLen = this.writeBuffer.length), this.emitReserved('flush'))
  1125. },
  1126. },
  1127. {
  1128. key: 'write',
  1129. value: function (t, e, n) {
  1130. return this.sendPacket('message', t, e, n), this
  1131. },
  1132. },
  1133. {
  1134. key: 'send',
  1135. value: function (t, e, n) {
  1136. return this.sendPacket('message', t, e, n), this
  1137. },
  1138. },
  1139. {
  1140. key: 'sendPacket',
  1141. value: function (t, e, n, r) {
  1142. if (('function' == typeof e && ((r = e), (e = void 0)), 'function' == typeof n && ((r = n), (n = null)), 'closing' !== this.readyState && 'closed' !== this.readyState)) {
  1143. ;(n = n || {}).compress = !1 !== n.compress
  1144. var o = { type: t, data: e, options: n }
  1145. this.emitReserved('packetCreate', o), this.writeBuffer.push(o), r && this.once('flush', r), this.flush()
  1146. }
  1147. },
  1148. },
  1149. {
  1150. key: 'close',
  1151. value: function () {
  1152. var t = this,
  1153. e = function () {
  1154. t.onClose('forced close'), t.transport.close()
  1155. },
  1156. n = function n() {
  1157. t.off('upgrade', n), t.off('upgradeError', n), e()
  1158. },
  1159. r = function () {
  1160. t.once('upgrade', n), t.once('upgradeError', n)
  1161. }
  1162. return (
  1163. ('opening' !== this.readyState && 'open' !== this.readyState) ||
  1164. ((this.readyState = 'closing'),
  1165. this.writeBuffer.length
  1166. ? this.once('drain', function () {
  1167. t.upgrading ? r() : e()
  1168. })
  1169. : this.upgrading
  1170. ? r()
  1171. : e()),
  1172. this
  1173. )
  1174. },
  1175. },
  1176. {
  1177. key: 'onError',
  1178. value: function (t) {
  1179. ;(a.priorWebsocketSuccess = !1), this.emitReserved('error', t), this.onClose('transport error', t)
  1180. },
  1181. },
  1182. {
  1183. key: 'onClose',
  1184. value: function (t, e) {
  1185. ;('opening' !== this.readyState && 'open' !== this.readyState && 'closing' !== this.readyState) ||
  1186. (this.clearTimeoutFn(this.pingTimeoutTimer),
  1187. this.transport.removeAllListeners('close'),
  1188. this.transport.close(),
  1189. this.transport.removeAllListeners(),
  1190. 'function' == typeof removeEventListener && removeEventListener('offline', this.offlineEventListener, !1),
  1191. (this.readyState = 'closed'),
  1192. (this.id = null),
  1193. this.emitReserved('close', t, e),
  1194. (this.writeBuffer = []),
  1195. (this.prevBufferLen = 0))
  1196. },
  1197. },
  1198. {
  1199. key: 'filterUpgrades',
  1200. value: function (t) {
  1201. for (var e = [], n = 0, r = t.length; n < r; n++) ~this.transports.indexOf(t[n]) && e.push(t[n])
  1202. return e
  1203. },
  1204. },
  1205. ]),
  1206. a
  1207. )
  1208. })(R)
  1209. ut.protocol = 4
  1210. var ht = 'function' == typeof ArrayBuffer,
  1211. ft = Object.prototype.toString,
  1212. lt = 'function' == typeof Blob || ('undefined' != typeof Blob && '[object BlobConstructor]' === ft.call(Blob)),
  1213. pt = 'function' == typeof File || ('undefined' != typeof File && '[object FileConstructor]' === ft.call(File))
  1214. function dt(t) {
  1215. return (
  1216. (ht &&
  1217. (t instanceof ArrayBuffer ||
  1218. (function (t) {
  1219. return 'function' == typeof ArrayBuffer.isView ? ArrayBuffer.isView(t) : t.buffer instanceof ArrayBuffer
  1220. })(t))) ||
  1221. (lt && t instanceof Blob) ||
  1222. (pt && t instanceof File)
  1223. )
  1224. }
  1225. function yt(e, n) {
  1226. if (!e || 'object' !== t(e)) return !1
  1227. if (Array.isArray(e)) {
  1228. for (var r = 0, o = e.length; r < o; r++) if (yt(e[r])) return !0
  1229. return !1
  1230. }
  1231. if (dt(e)) return !0
  1232. if (e.toJSON && 'function' == typeof e.toJSON && 1 === arguments.length) return yt(e.toJSON(), !0)
  1233. for (var i in e) if (Object.prototype.hasOwnProperty.call(e, i) && yt(e[i])) return !0
  1234. return !1
  1235. }
  1236. function vt(t) {
  1237. var e = [],
  1238. n = t.data,
  1239. r = t
  1240. return (r.data = mt(n, e)), (r.attachments = e.length), { packet: r, buffers: e }
  1241. }
  1242. function mt(e, n) {
  1243. if (!e) return e
  1244. if (dt(e)) {
  1245. var r = { _placeholder: !0, num: n.length }
  1246. return n.push(e), r
  1247. }
  1248. if (Array.isArray(e)) {
  1249. for (var o = new Array(e.length), i = 0; i < e.length; i++) o[i] = mt(e[i], n)
  1250. return o
  1251. }
  1252. if ('object' === t(e) && !(e instanceof Date)) {
  1253. var s = {}
  1254. for (var a in e) e.hasOwnProperty(a) && (s[a] = mt(e[a], n))
  1255. return s
  1256. }
  1257. return e
  1258. }
  1259. function gt(t, e) {
  1260. return (t.data = kt(t.data, e)), (t.attachments = void 0), t
  1261. }
  1262. function kt(e, n) {
  1263. if (!e) return e
  1264. if (e && e._placeholder) return n[e.num]
  1265. if (Array.isArray(e)) for (var r = 0; r < e.length; r++) e[r] = kt(e[r], n)
  1266. else if ('object' === t(e)) for (var o in e) e.hasOwnProperty(o) && (e[o] = kt(e[o], n))
  1267. return e
  1268. }
  1269. var bt
  1270. !(function (t) {
  1271. ;(t[(t.CONNECT = 0)] = 'CONNECT'),
  1272. (t[(t.DISCONNECT = 1)] = 'DISCONNECT'),
  1273. (t[(t.EVENT = 2)] = 'EVENT'),
  1274. (t[(t.ACK = 3)] = 'ACK'),
  1275. (t[(t.CONNECT_ERROR = 4)] = 'CONNECT_ERROR'),
  1276. (t[(t.BINARY_EVENT = 5)] = 'BINARY_EVENT'),
  1277. (t[(t.BINARY_ACK = 6)] = 'BINARY_ACK')
  1278. })(bt || (bt = {}))
  1279. var wt = (function () {
  1280. function t() {
  1281. e(this, t)
  1282. }
  1283. return (
  1284. r(t, [
  1285. {
  1286. key: 'encode',
  1287. value: function (t) {
  1288. return (t.type !== bt.EVENT && t.type !== bt.ACK) || !yt(t)
  1289. ? [this.encodeAsString(t)]
  1290. : ((t.type = t.type === bt.EVENT ? bt.BINARY_EVENT : bt.BINARY_ACK), this.encodeAsBinary(t))
  1291. },
  1292. },
  1293. {
  1294. key: 'encodeAsString',
  1295. value: function (t) {
  1296. var e = '' + t.type
  1297. return (
  1298. (t.type !== bt.BINARY_EVENT && t.type !== bt.BINARY_ACK) || (e += t.attachments + '-'),
  1299. t.nsp && '/' !== t.nsp && (e += t.nsp + ','),
  1300. null != t.id && (e += t.id),
  1301. null != t.data && (e += JSON.stringify(t.data)),
  1302. e
  1303. )
  1304. },
  1305. },
  1306. {
  1307. key: 'encodeAsBinary',
  1308. value: function (t) {
  1309. var e = vt(t),
  1310. n = this.encodeAsString(e.packet),
  1311. r = e.buffers
  1312. return r.unshift(n), r
  1313. },
  1314. },
  1315. ]),
  1316. t
  1317. )
  1318. })(),
  1319. _t = (function (n) {
  1320. i(a, n)
  1321. var o = h(a)
  1322. function a() {
  1323. return e(this, a), o.call(this)
  1324. }
  1325. return (
  1326. r(
  1327. a,
  1328. [
  1329. {
  1330. key: 'add',
  1331. value: function (t) {
  1332. var e
  1333. if ('string' == typeof t)
  1334. (e = this.decodeString(t)).type === bt.BINARY_EVENT || e.type === bt.BINARY_ACK
  1335. ? ((this.reconstructor = new Et(e)), 0 === e.attachments && f(s(a.prototype), 'emitReserved', this).call(this, 'decoded', e))
  1336. : f(s(a.prototype), 'emitReserved', this).call(this, 'decoded', e)
  1337. else {
  1338. if (!dt(t) && !t.base64) throw new Error('Unknown type: ' + t)
  1339. if (!this.reconstructor) throw new Error('got binary data when not reconstructing a packet')
  1340. ;(e = this.reconstructor.takeBinaryData(t)) && ((this.reconstructor = null), f(s(a.prototype), 'emitReserved', this).call(this, 'decoded', e))
  1341. }
  1342. },
  1343. },
  1344. {
  1345. key: 'decodeString',
  1346. value: function (t) {
  1347. var e = 0,
  1348. n = { type: Number(t.charAt(0)) }
  1349. if (void 0 === bt[n.type]) throw new Error('unknown packet type ' + n.type)
  1350. if (n.type === bt.BINARY_EVENT || n.type === bt.BINARY_ACK) {
  1351. for (var r = e + 1; '-' !== t.charAt(++e) && e != t.length; );
  1352. var o = t.substring(r, e)
  1353. if (o != Number(o) || '-' !== t.charAt(e)) throw new Error('Illegal attachments')
  1354. n.attachments = Number(o)
  1355. }
  1356. if ('/' === t.charAt(e + 1)) {
  1357. for (var i = e + 1; ++e; ) {
  1358. if (',' === t.charAt(e)) break
  1359. if (e === t.length) break
  1360. }
  1361. n.nsp = t.substring(i, e)
  1362. } else n.nsp = '/'
  1363. var s = t.charAt(e + 1)
  1364. if ('' !== s && Number(s) == s) {
  1365. for (var c = e + 1; ++e; ) {
  1366. var u = t.charAt(e)
  1367. if (null == u || Number(u) != u) {
  1368. --e
  1369. break
  1370. }
  1371. if (e === t.length) break
  1372. }
  1373. n.id = Number(t.substring(c, e + 1))
  1374. }
  1375. if (t.charAt(++e)) {
  1376. var h = (function (t) {
  1377. try {
  1378. return JSON.parse(t)
  1379. } catch (t) {
  1380. return !1
  1381. }
  1382. })(t.substr(e))
  1383. if (!a.isPayloadValid(n.type, h)) throw new Error('invalid payload')
  1384. n.data = h
  1385. }
  1386. return n
  1387. },
  1388. },
  1389. {
  1390. key: 'destroy',
  1391. value: function () {
  1392. this.reconstructor && this.reconstructor.finishedReconstruction()
  1393. },
  1394. },
  1395. ],
  1396. [
  1397. {
  1398. key: 'isPayloadValid',
  1399. value: function (e, n) {
  1400. switch (e) {
  1401. case bt.CONNECT:
  1402. return 'object' === t(n)
  1403. case bt.DISCONNECT:
  1404. return void 0 === n
  1405. case bt.CONNECT_ERROR:
  1406. return 'string' == typeof n || 'object' === t(n)
  1407. case bt.EVENT:
  1408. case bt.BINARY_EVENT:
  1409. return Array.isArray(n) && n.length > 0
  1410. case bt.ACK:
  1411. case bt.BINARY_ACK:
  1412. return Array.isArray(n)
  1413. }
  1414. },
  1415. },
  1416. ]
  1417. ),
  1418. a
  1419. )
  1420. })(R)
  1421. var Et = (function () {
  1422. function t(n) {
  1423. e(this, t), (this.packet = n), (this.buffers = []), (this.reconPack = n)
  1424. }
  1425. return (
  1426. r(t, [
  1427. {
  1428. key: 'takeBinaryData',
  1429. value: function (t) {
  1430. if ((this.buffers.push(t), this.buffers.length === this.reconPack.attachments)) {
  1431. var e = gt(this.reconPack, this.buffers)
  1432. return this.finishedReconstruction(), e
  1433. }
  1434. return null
  1435. },
  1436. },
  1437. {
  1438. key: 'finishedReconstruction',
  1439. value: function () {
  1440. ;(this.reconPack = null), (this.buffers = [])
  1441. },
  1442. },
  1443. ]),
  1444. t
  1445. )
  1446. })(),
  1447. At = Object.freeze({
  1448. __proto__: null,
  1449. protocol: 5,
  1450. get PacketType() {
  1451. return bt
  1452. },
  1453. Encoder: wt,
  1454. Decoder: _t,
  1455. })
  1456. function Rt(t, e, n) {
  1457. return (
  1458. t.on(e, n),
  1459. function () {
  1460. t.off(e, n)
  1461. }
  1462. )
  1463. }
  1464. var Tt = Object.freeze({ connect: 1, connect_error: 1, disconnect: 1, disconnecting: 1, newListener: 1, removeListener: 1 }),
  1465. Ct = (function (t) {
  1466. i(o, t)
  1467. var n = h(o)
  1468. function o(t, r, i) {
  1469. var s
  1470. return (
  1471. e(this, o),
  1472. ((s = n.call(this)).connected = !1),
  1473. (s.disconnected = !0),
  1474. (s.receiveBuffer = []),
  1475. (s.sendBuffer = []),
  1476. (s.ids = 0),
  1477. (s.acks = {}),
  1478. (s.flags = {}),
  1479. (s.io = t),
  1480. (s.nsp = r),
  1481. i && i.auth && (s.auth = i.auth),
  1482. s.io._autoConnect && s.open(),
  1483. s
  1484. )
  1485. }
  1486. return (
  1487. r(o, [
  1488. {
  1489. key: 'subEvents',
  1490. value: function () {
  1491. if (!this.subs) {
  1492. var t = this.io
  1493. this.subs = [
  1494. Rt(t, 'open', this.onopen.bind(this)),
  1495. Rt(t, 'packet', this.onpacket.bind(this)),
  1496. Rt(t, 'error', this.onerror.bind(this)),
  1497. Rt(t, 'close', this.onclose.bind(this)),
  1498. ]
  1499. }
  1500. },
  1501. },
  1502. {
  1503. key: 'active',
  1504. get: function () {
  1505. return !!this.subs
  1506. },
  1507. },
  1508. {
  1509. key: 'connect',
  1510. value: function () {
  1511. return this.connected || (this.subEvents(), this.io._reconnecting || this.io.open(), 'open' === this.io._readyState && this.onopen()), this
  1512. },
  1513. },
  1514. {
  1515. key: 'open',
  1516. value: function () {
  1517. return this.connect()
  1518. },
  1519. },
  1520. {
  1521. key: 'send',
  1522. value: function () {
  1523. for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++) e[n] = arguments[n]
  1524. return e.unshift('message'), this.emit.apply(this, e), this
  1525. },
  1526. },
  1527. {
  1528. key: 'emit',
  1529. value: function (t) {
  1530. if (Tt.hasOwnProperty(t)) throw new Error('"' + t + '" is a reserved event name')
  1531. for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r]
  1532. n.unshift(t)
  1533. var o = { type: bt.EVENT, data: n, options: {} }
  1534. if (((o.options.compress = !1 !== this.flags.compress), 'function' == typeof n[n.length - 1])) {
  1535. var i = this.ids++,
  1536. s = n.pop()
  1537. this._registerAckCallback(i, s), (o.id = i)
  1538. }
  1539. var a = this.io.engine && this.io.engine.transport && this.io.engine.transport.writable,
  1540. c = this.flags.volatile && (!a || !this.connected)
  1541. return c || (this.connected ? this.packet(o) : this.sendBuffer.push(o)), (this.flags = {}), this
  1542. },
  1543. },
  1544. {
  1545. key: '_registerAckCallback',
  1546. value: function (t, e) {
  1547. var n = this,
  1548. r = this.flags.timeout
  1549. if (void 0 !== r) {
  1550. var o = this.io.setTimeoutFn(function () {
  1551. delete n.acks[t]
  1552. for (var r = 0; r < n.sendBuffer.length; r++) n.sendBuffer[r].id === t && n.sendBuffer.splice(r, 1)
  1553. e.call(n, new Error('operation has timed out'))
  1554. }, r)
  1555. this.acks[t] = function () {
  1556. n.io.clearTimeoutFn(o)
  1557. for (var t = arguments.length, r = new Array(t), i = 0; i < t; i++) r[i] = arguments[i]
  1558. e.apply(n, [null].concat(r))
  1559. }
  1560. } else this.acks[t] = e
  1561. },
  1562. },
  1563. {
  1564. key: 'packet',
  1565. value: function (t) {
  1566. ;(t.nsp = this.nsp), this.io._packet(t)
  1567. },
  1568. },
  1569. {
  1570. key: 'onopen',
  1571. value: function () {
  1572. var t = this
  1573. 'function' == typeof this.auth
  1574. ? this.auth(function (e) {
  1575. t.packet({ type: bt.CONNECT, data: e })
  1576. })
  1577. : this.packet({ type: bt.CONNECT, data: this.auth })
  1578. },
  1579. },
  1580. {
  1581. key: 'onerror',
  1582. value: function (t) {
  1583. this.connected || this.emitReserved('connect_error', t)
  1584. },
  1585. },
  1586. {
  1587. key: 'onclose',
  1588. value: function (t) {
  1589. ;(this.connected = !1), (this.disconnected = !0), delete this.id, this.emitReserved('disconnect', t)
  1590. },
  1591. },
  1592. {
  1593. key: 'onpacket',
  1594. value: function (t) {
  1595. if (t.nsp === this.nsp)
  1596. switch (t.type) {
  1597. case bt.CONNECT:
  1598. if (t.data && t.data.sid) {
  1599. var e = t.data.sid
  1600. this.onconnect(e)
  1601. } else
  1602. this.emitReserved(
  1603. 'connect_error',
  1604. new Error(
  1605. '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/)'
  1606. )
  1607. )
  1608. break
  1609. case bt.EVENT:
  1610. case bt.BINARY_EVENT:
  1611. this.onevent(t)
  1612. break
  1613. case bt.ACK:
  1614. case bt.BINARY_ACK:
  1615. this.onack(t)
  1616. break
  1617. case bt.DISCONNECT:
  1618. this.ondisconnect()
  1619. break
  1620. case bt.CONNECT_ERROR:
  1621. this.destroy()
  1622. var n = new Error(t.data.message)
  1623. ;(n.data = t.data.data), this.emitReserved('connect_error', n)
  1624. }
  1625. },
  1626. },
  1627. {
  1628. key: 'onevent',
  1629. value: function (t) {
  1630. var e = t.data || []
  1631. null != t.id && e.push(this.ack(t.id)), this.connected ? this.emitEvent(e) : this.receiveBuffer.push(Object.freeze(e))
  1632. },
  1633. },
  1634. {
  1635. key: 'emitEvent',
  1636. value: function (t) {
  1637. if (this._anyListeners && this._anyListeners.length) {
  1638. var e,
  1639. n = p(this._anyListeners.slice())
  1640. try {
  1641. for (n.s(); !(e = n.n()).done; ) {
  1642. e.value.apply(this, t)
  1643. }
  1644. } catch (t) {
  1645. n.e(t)
  1646. } finally {
  1647. n.f()
  1648. }
  1649. }
  1650. f(s(o.prototype), 'emit', this).apply(this, t)
  1651. },
  1652. },
  1653. {
  1654. key: 'ack',
  1655. value: function (t) {
  1656. var e = this,
  1657. n = !1
  1658. return function () {
  1659. if (!n) {
  1660. n = !0
  1661. for (var r = arguments.length, o = new Array(r), i = 0; i < r; i++) o[i] = arguments[i]
  1662. e.packet({ type: bt.ACK, id: t, data: o })
  1663. }
  1664. }
  1665. },
  1666. },
  1667. {
  1668. key: 'onack',
  1669. value: function (t) {
  1670. var e = this.acks[t.id]
  1671. 'function' == typeof e && (e.apply(this, t.data), delete this.acks[t.id])
  1672. },
  1673. },
  1674. {
  1675. key: 'onconnect',
  1676. value: function (t) {
  1677. ;(this.id = t), (this.connected = !0), (this.disconnected = !1), this.emitBuffered(), this.emitReserved('connect')
  1678. },
  1679. },
  1680. {
  1681. key: 'emitBuffered',
  1682. value: function () {
  1683. var t = this
  1684. this.receiveBuffer.forEach(function (e) {
  1685. return t.emitEvent(e)
  1686. }),
  1687. (this.receiveBuffer = []),
  1688. this.sendBuffer.forEach(function (e) {
  1689. return t.packet(e)
  1690. }),
  1691. (this.sendBuffer = [])
  1692. },
  1693. },
  1694. {
  1695. key: 'ondisconnect',
  1696. value: function () {
  1697. this.destroy(), this.onclose('io server disconnect')
  1698. },
  1699. },
  1700. {
  1701. key: 'destroy',
  1702. value: function () {
  1703. this.subs &&
  1704. (this.subs.forEach(function (t) {
  1705. return t()
  1706. }),
  1707. (this.subs = void 0)),
  1708. this.io._destroy(this)
  1709. },
  1710. },
  1711. {
  1712. key: 'disconnect',
  1713. value: function () {
  1714. return this.connected && this.packet({ type: bt.DISCONNECT }), this.destroy(), this.connected && this.onclose('io client disconnect'), this
  1715. },
  1716. },
  1717. {
  1718. key: 'close',
  1719. value: function () {
  1720. return this.disconnect()
  1721. },
  1722. },
  1723. {
  1724. key: 'compress',
  1725. value: function (t) {
  1726. return (this.flags.compress = t), this
  1727. },
  1728. },
  1729. {
  1730. key: 'volatile',
  1731. get: function () {
  1732. return (this.flags.volatile = !0), this
  1733. },
  1734. },
  1735. {
  1736. key: 'timeout',
  1737. value: function (t) {
  1738. return (this.flags.timeout = t), this
  1739. },
  1740. },
  1741. {
  1742. key: 'onAny',
  1743. value: function (t) {
  1744. return (this._anyListeners = this._anyListeners || []), this._anyListeners.push(t), this
  1745. },
  1746. },
  1747. {
  1748. key: 'prependAny',
  1749. value: function (t) {
  1750. return (this._anyListeners = this._anyListeners || []), this._anyListeners.unshift(t), this
  1751. },
  1752. },
  1753. {
  1754. key: 'offAny',
  1755. value: function (t) {
  1756. if (!this._anyListeners) return this
  1757. if (t) {
  1758. for (var e = this._anyListeners, n = 0; n < e.length; n++) if (t === e[n]) return e.splice(n, 1), this
  1759. } else this._anyListeners = []
  1760. return this
  1761. },
  1762. },
  1763. {
  1764. key: 'listenersAny',
  1765. value: function () {
  1766. return this._anyListeners || []
  1767. },
  1768. },
  1769. ]),
  1770. o
  1771. )
  1772. })(R),
  1773. Ot = St
  1774. function St(t) {
  1775. ;(t = t || {}), (this.ms = t.min || 100), (this.max = t.max || 1e4), (this.factor = t.factor || 2), (this.jitter = t.jitter > 0 && t.jitter <= 1 ? t.jitter : 0), (this.attempts = 0)
  1776. }
  1777. ;(St.prototype.duration = function () {
  1778. var t = this.ms * Math.pow(this.factor, this.attempts++)
  1779. if (this.jitter) {
  1780. var e = Math.random(),
  1781. n = Math.floor(e * this.jitter * t)
  1782. t = 0 == (1 & Math.floor(10 * e)) ? t - n : t + n
  1783. }
  1784. return 0 | Math.min(t, this.max)
  1785. }),
  1786. (St.prototype.reset = function () {
  1787. this.attempts = 0
  1788. }),
  1789. (St.prototype.setMin = function (t) {
  1790. this.ms = t
  1791. }),
  1792. (St.prototype.setMax = function (t) {
  1793. this.max = t
  1794. }),
  1795. (St.prototype.setJitter = function (t) {
  1796. this.jitter = t
  1797. })
  1798. var Bt = (function (n) {
  1799. i(s, n)
  1800. var o = h(s)
  1801. function s(n, r) {
  1802. var i, a
  1803. e(this, s),
  1804. ((i = o.call(this)).nsps = {}),
  1805. (i.subs = []),
  1806. n && 'object' === t(n) && ((r = n), (n = void 0)),
  1807. ((r = r || {}).path = r.path || '/socket.io'),
  1808. (i.opts = r),
  1809. A(c(i), r),
  1810. i.reconnection(!1 !== r.reconnection),
  1811. i.reconnectionAttempts(r.reconnectionAttempts || 1 / 0),
  1812. i.reconnectionDelay(r.reconnectionDelay || 1e3),
  1813. i.reconnectionDelayMax(r.reconnectionDelayMax || 5e3),
  1814. i.randomizationFactor(null !== (a = r.randomizationFactor) && void 0 !== a ? a : 0.5),
  1815. (i.backoff = new Ot({ min: i.reconnectionDelay(), max: i.reconnectionDelayMax(), jitter: i.randomizationFactor() })),
  1816. i.timeout(null == r.timeout ? 2e4 : r.timeout),
  1817. (i._readyState = 'closed'),
  1818. (i.uri = n)
  1819. var u = r.parser || At
  1820. return (i.encoder = new u.Encoder()), (i.decoder = new u.Decoder()), (i._autoConnect = !1 !== r.autoConnect), i._autoConnect && i.open(), i
  1821. }
  1822. return (
  1823. r(s, [
  1824. {
  1825. key: 'reconnection',
  1826. value: function (t) {
  1827. return arguments.length ? ((this._reconnection = !!t), this) : this._reconnection
  1828. },
  1829. },
  1830. {
  1831. key: 'reconnectionAttempts',
  1832. value: function (t) {
  1833. return void 0 === t ? this._reconnectionAttempts : ((this._reconnectionAttempts = t), this)
  1834. },
  1835. },
  1836. {
  1837. key: 'reconnectionDelay',
  1838. value: function (t) {
  1839. var e
  1840. return void 0 === t ? this._reconnectionDelay : ((this._reconnectionDelay = t), null === (e = this.backoff) || void 0 === e || e.setMin(t), this)
  1841. },
  1842. },
  1843. {
  1844. key: 'randomizationFactor',
  1845. value: function (t) {
  1846. var e
  1847. return void 0 === t ? this._randomizationFactor : ((this._randomizationFactor = t), null === (e = this.backoff) || void 0 === e || e.setJitter(t), this)
  1848. },
  1849. },
  1850. {
  1851. key: 'reconnectionDelayMax',
  1852. value: function (t) {
  1853. var e
  1854. return void 0 === t ? this._reconnectionDelayMax : ((this._reconnectionDelayMax = t), null === (e = this.backoff) || void 0 === e || e.setMax(t), this)
  1855. },
  1856. },
  1857. {
  1858. key: 'timeout',
  1859. value: function (t) {
  1860. return arguments.length ? ((this._timeout = t), this) : this._timeout
  1861. },
  1862. },
  1863. {
  1864. key: 'maybeReconnectOnOpen',
  1865. value: function () {
  1866. !this._reconnecting && this._reconnection && 0 === this.backoff.attempts && this.reconnect()
  1867. },
  1868. },
  1869. {
  1870. key: 'open',
  1871. value: function (t) {
  1872. var e = this
  1873. if (~this._readyState.indexOf('open')) return this
  1874. this.engine = new ut(this.uri, this.opts)
  1875. var n = this.engine,
  1876. r = this
  1877. ;(this._readyState = 'opening'), (this.skipReconnect = !1)
  1878. var o = Rt(n, 'open', function () {
  1879. r.onopen(), t && t()
  1880. }),
  1881. i = Rt(n, 'error', function (n) {
  1882. r.cleanup(), (r._readyState = 'closed'), e.emitReserved('error', n), t ? t(n) : r.maybeReconnectOnOpen()
  1883. })
  1884. if (!1 !== this._timeout) {
  1885. var s = this._timeout
  1886. 0 === s && o()
  1887. var a = this.setTimeoutFn(function () {
  1888. o(), n.close(), n.emit('error', new Error('timeout'))
  1889. }, s)
  1890. this.opts.autoUnref && a.unref(),
  1891. this.subs.push(function () {
  1892. clearTimeout(a)
  1893. })
  1894. }
  1895. return this.subs.push(o), this.subs.push(i), this
  1896. },
  1897. },
  1898. {
  1899. key: 'connect',
  1900. value: function (t) {
  1901. return this.open(t)
  1902. },
  1903. },
  1904. {
  1905. key: 'onopen',
  1906. value: function () {
  1907. this.cleanup(), (this._readyState = 'open'), this.emitReserved('open')
  1908. var t = this.engine
  1909. this.subs.push(
  1910. Rt(t, 'ping', this.onping.bind(this)),
  1911. Rt(t, 'data', this.ondata.bind(this)),
  1912. Rt(t, 'error', this.onerror.bind(this)),
  1913. Rt(t, 'close', this.onclose.bind(this)),
  1914. Rt(this.decoder, 'decoded', this.ondecoded.bind(this))
  1915. )
  1916. },
  1917. },
  1918. {
  1919. key: 'onping',
  1920. value: function () {
  1921. this.emitReserved('ping')
  1922. },
  1923. },
  1924. {
  1925. key: 'ondata',
  1926. value: function (t) {
  1927. this.decoder.add(t)
  1928. },
  1929. },
  1930. {
  1931. key: 'ondecoded',
  1932. value: function (t) {
  1933. this.emitReserved('packet', t)
  1934. },
  1935. },
  1936. {
  1937. key: 'onerror',
  1938. value: function (t) {
  1939. this.emitReserved('error', t)
  1940. },
  1941. },
  1942. {
  1943. key: 'socket',
  1944. value: function (t, e) {
  1945. var n = this.nsps[t]
  1946. return n || ((n = new Ct(this, t, e)), (this.nsps[t] = n)), n
  1947. },
  1948. },
  1949. {
  1950. key: '_destroy',
  1951. value: function (t) {
  1952. for (var e = 0, n = Object.keys(this.nsps); e < n.length; e++) {
  1953. var r = n[e]
  1954. if (this.nsps[r].active) return
  1955. }
  1956. this._close()
  1957. },
  1958. },
  1959. {
  1960. key: '_packet',
  1961. value: function (t) {
  1962. for (var e = this.encoder.encode(t), n = 0; n < e.length; n++) this.engine.write(e[n], t.options)
  1963. },
  1964. },
  1965. {
  1966. key: 'cleanup',
  1967. value: function () {
  1968. this.subs.forEach(function (t) {
  1969. return t()
  1970. }),
  1971. (this.subs.length = 0),
  1972. this.decoder.destroy()
  1973. },
  1974. },
  1975. {
  1976. key: '_close',
  1977. value: function () {
  1978. ;(this.skipReconnect = !0), (this._reconnecting = !1), this.onclose('forced close'), this.engine && this.engine.close()
  1979. },
  1980. },
  1981. {
  1982. key: 'disconnect',
  1983. value: function () {
  1984. return this._close()
  1985. },
  1986. },
  1987. {
  1988. key: 'onclose',
  1989. value: function (t) {
  1990. this.cleanup(), this.backoff.reset(), (this._readyState = 'closed'), this.emitReserved('close', t), this._reconnection && !this.skipReconnect && this.reconnect()
  1991. },
  1992. },
  1993. {
  1994. key: 'reconnect',
  1995. value: function () {
  1996. var t = this
  1997. if (this._reconnecting || this.skipReconnect) return this
  1998. var e = this
  1999. if (this.backoff.attempts >= this._reconnectionAttempts) this.backoff.reset(), this.emitReserved('reconnect_failed'), (this._reconnecting = !1)
  2000. else {
  2001. var n = this.backoff.duration()
  2002. this._reconnecting = !0
  2003. var r = this.setTimeoutFn(function () {
  2004. e.skipReconnect ||
  2005. (t.emitReserved('reconnect_attempt', e.backoff.attempts),
  2006. e.skipReconnect ||
  2007. e.open(function (n) {
  2008. n ? ((e._reconnecting = !1), e.reconnect(), t.emitReserved('reconnect_error', n)) : e.onreconnect()
  2009. }))
  2010. }, n)
  2011. this.opts.autoUnref && r.unref(),
  2012. this.subs.push(function () {
  2013. clearTimeout(r)
  2014. })
  2015. }
  2016. },
  2017. },
  2018. {
  2019. key: 'onreconnect',
  2020. value: function () {
  2021. var t = this.backoff.attempts
  2022. ;(this._reconnecting = !1), this.backoff.reset(), this.emitReserved('reconnect', t)
  2023. },
  2024. },
  2025. ]),
  2026. s
  2027. )
  2028. })(R),
  2029. Nt = {}
  2030. function xt(e, n) {
  2031. 'object' === t(e) && ((n = e), (e = void 0))
  2032. var r,
  2033. o = (function (t) {
  2034. var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : '',
  2035. n = arguments.length > 2 ? arguments[2] : void 0,
  2036. r = t
  2037. ;(n = n || ('undefined' != typeof location && location)),
  2038. null == t && (t = n.protocol + '//' + n.host),
  2039. 'string' == typeof t &&
  2040. ('/' === t.charAt(0) && (t = '/' === t.charAt(1) ? n.protocol + t : n.host + t),
  2041. /^(https?|wss?):\/\//.test(t) || (t = void 0 !== n ? n.protocol + '//' + t : 'https://' + t),
  2042. (r = v(t))),
  2043. r.port || (/^(http|ws)$/.test(r.protocol) ? (r.port = '80') : /^(http|ws)s$/.test(r.protocol) && (r.port = '443')),
  2044. (r.path = r.path || '/')
  2045. var o = -1 !== r.host.indexOf(':') ? '[' + r.host + ']' : r.host
  2046. return (r.id = r.protocol + '://' + o + ':' + r.port + e), (r.href = r.protocol + '://' + o + (n && n.port === r.port ? '' : ':' + r.port)), r
  2047. })(e, (n = n || {}).path || '/socket.io'),
  2048. i = o.source,
  2049. s = o.id,
  2050. a = o.path,
  2051. c = Nt[s] && a in Nt[s].nsps
  2052. return (
  2053. n.forceNew || n['force new connection'] || !1 === n.multiplex || c ? (r = new Bt(i, n)) : (Nt[s] || (Nt[s] = new Bt(i, n)), (r = Nt[s])),
  2054. o.query && !n.query && (n.query = o.queryKey),
  2055. r.socket(o.path, n)
  2056. )
  2057. }
  2058. return o(xt, { Manager: Bt, Socket: Ct, io: xt, connect: xt }), xt
  2059. })
  2060. //# sourceMappingURL=socket.io.min.js.map