From 0a7270ccfd4b7a743893827418515edbbc32cd26 Mon Sep 17 00:00:00 2001 From: dido Date: Mon, 20 Oct 2025 20:01:16 +0200 Subject: [PATCH 1/6] fix: update wsServerURL to use dynamic protocol and hostname --- Taskfile.yaml | 28 +++++++++++-------- .../src/extensions/scratch3_arduino/index.js | 3 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index a5d0e9a..9b310b9 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -7,31 +7,35 @@ tasks: - git clone --depth 1 --branch {{ .SCRATCH_EDITOR_VERSION }} https://github.com/scratchfoundation/scratch-editor.git scratch:install: - dir: scratch-editor - cmds: - - npm install - - npm run build --workspace @scratch/scratch-svg-renderer - - npm run build --workspace @scratch/scratch-vm - - npm run build:dev --workspace @scratch/scratch-gui + dir: scratch-editor + cmds: + - npm install + - npm run build --workspace @scratch/scratch-svg-renderer + - npm run build --workspace @scratch/scratch-vm + - npm run build:dev --workspace @scratch/scratch-gui scratch:patch: - cd scratch-editor/packages/scratch-gui && node ../../../scratch-arduino-extensions/scripts/patch-gui.js scratch:start: - dir: scratch-editor - cmds: - - npm start --workspace @scratch/scratch-gui + dir: scratch-editor + - npm start --workspace @scratch/scratch-gui scratch:clean: - rm -rf scratch-editor - board:upload: + scratch:build: # buiild scratch-gui index.html and gui.js + dir: scratch-editor/packages/scratch-gui + - npm run build:dev + + app:upload: - adb push ./python/main.py /home/arduino/ArduinoApps/scratch-arduino-app/python/main.py - adb push ./sketch/sketch.ino /home/arduino/ArduinoApps/scratch-arduino-app/sketch/sketch.ino - adb push ./sketch/sketch.yaml /home/arduino/ArduinoApps/scratch-arduino-app/sketch/sketch.yaml - adb push ./sketch/Arduino_Modulino /home/arduino/ArduinoApps/scratch-arduino-app/sketch/Arduino_Modulino - - adb push ./app.yaml /home/arduino/ArduinoApps/scratch-arduino-app/app.yaml - # - adb shell arduino-app-cli app restart user:scratch-arduino-app + - adb push ./app.yaml /home/arduino/ArduinoApps/scratch-arduino-app/app.yaml + - adb push ./scratch-editor/packages/scratch-gui/build/index.html /home/arduino/ArduinoApps/scratch-arduino-app/assets/index.html + - adb push ./scratch-editor/packages/scratch-gui/build/gui.js /home/arduino/ArduinoApps/scratch-arduino-app/assets/gui.js modulino:patch: # See https://github.com/arduino-libraries/Arduino_Modulino/pull/42 diff --git a/scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/index.js b/scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/index.js index 569199c..2d44efc 100644 --- a/scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/index.js +++ b/scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/index.js @@ -17,7 +17,8 @@ const iconURI = ''; // eslint-disable-next-line max-len const menuIconURI = '' -const wsServerURL = 'http://192.168.1.39:7000'; +// Use the same origin as the HTML page, but with port 7000 +const wsServerURL = `${window.location.protocol}//${window.location.hostname}:7000`; class Scratch3Arduino { constructor (runtime) { From 1cf4a8d9f96e8164036c2fcdc852bfdf2e7abcfd Mon Sep 17 00:00:00 2001 From: dido Date: Mon, 20 Oct 2025 20:57:03 +0200 Subject: [PATCH 2/6] add assets --- Taskfile.yaml | 23 +- assets/gui.js | 470680 +++++++++++++++++++++++++++++++++++++++++++ assets/index.html | 14 + 3 files changed, 470707 insertions(+), 10 deletions(-) create mode 100644 assets/gui.js create mode 100644 assets/index.html diff --git a/Taskfile.yaml b/Taskfile.yaml index 9b310b9..1d4c2d7 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -7,12 +7,12 @@ tasks: - git clone --depth 1 --branch {{ .SCRATCH_EDITOR_VERSION }} https://github.com/scratchfoundation/scratch-editor.git scratch:install: - dir: scratch-editor - cmds: - - npm install - - npm run build --workspace @scratch/scratch-svg-renderer - - npm run build --workspace @scratch/scratch-vm - - npm run build:dev --workspace @scratch/scratch-gui + dir: scratch-editor + cmds: + - npm install + - npm run build --workspace @scratch/scratch-svg-renderer + - npm run build --workspace @scratch/scratch-vm + - npm run build:dev --workspace @scratch/scratch-gui scratch:patch: - cd scratch-editor/packages/scratch-gui && node ../../../scratch-arduino-extensions/scripts/patch-gui.js @@ -25,8 +25,11 @@ tasks: - rm -rf scratch-editor scratch:build: # buiild scratch-gui index.html and gui.js - dir: scratch-editor/packages/scratch-gui - - npm run build:dev + dir: scratch-editor/packages/scratch-gui + cmds: + # - npm run build:dev + - cp build/index.html ../../../assets/index.html + - cp build/gui.js ../../../assets/gui.js app:upload: - adb push ./python/main.py /home/arduino/ArduinoApps/scratch-arduino-app/python/main.py @@ -34,8 +37,8 @@ tasks: - adb push ./sketch/sketch.yaml /home/arduino/ArduinoApps/scratch-arduino-app/sketch/sketch.yaml - adb push ./sketch/Arduino_Modulino /home/arduino/ArduinoApps/scratch-arduino-app/sketch/Arduino_Modulino - adb push ./app.yaml /home/arduino/ArduinoApps/scratch-arduino-app/app.yaml - - adb push ./scratch-editor/packages/scratch-gui/build/index.html /home/arduino/ArduinoApps/scratch-arduino-app/assets/index.html - - adb push ./scratch-editor/packages/scratch-gui/build/gui.js /home/arduino/ArduinoApps/scratch-arduino-app/assets/gui.js + - adb push ./assets/index.html /home/arduino/ArduinoApps/scratch-arduino-app/assets/index.html + - adb push ./assets/gui.js /home/arduino/ArduinoApps/scratch-arduino-app/assets/gui.js modulino:patch: # See https://github.com/arduino-libraries/Arduino_Modulino/pull/42 diff --git a/assets/gui.js b/assets/gui.js new file mode 100644 index 0000000..db56208 --- /dev/null +++ b/assets/gui.js @@ -0,0 +1,470680 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["GUI"] = factory(); + else + root["GUI"] = factory(); +})(self, () => { +return /******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "../../../scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/index.js": +/*!********************************************************************************************************!*\ + !*** ../../../scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/index.js ***! + \********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// const formatMessage = require('../../../../../../scratch-editor/node_modules/format-message'); +const BlockType = __webpack_require__(/*! ../../../../../../scratch-editor/packages/scratch-vm/src/extension-support/block-type */ "../scratch-vm/src/extension-support/block-type.js"); +const ArgumentType = __webpack_require__(/*! ../../../../../../scratch-editor/packages/scratch-vm/src/extension-support/argument-type */ "../scratch-vm/src/extension-support/argument-type.js"); +const io = __webpack_require__(/*! ./socket.io.min.js */ "../../../scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/socket.io.min.js"); + +/** + * Url of icon to be displayed at the left edge of each extension block. + * @type {string} + */ +// eslint-disable-next-line max-len +const iconURI = ''; + +/** + * Url of icon to be displayed in the toolbox menu for the extension category. + * @type {string} + */ +// eslint-disable-next-line max-len +const menuIconURI = ''; +const wsServerURL = 'http://192.168.1.39:7000'; +class Scratch3Arduino { + constructor(runtime) { + this.runtime = runtime; + this.io = io(wsServerURL, { + path: '/socket.io', + transports: ['polling', 'websocket'], + autoConnect: true + }); + + // TODO: move to ModulinoPeripheral + this._button_a_pressed = false; + this._button_b_pressed = false; + this._button_c_pressed = false; + this.io.on('modulino_buttons_pressed', data => { + console.log("Modulino button pressed event received: ".concat(data.btn)); + if (data.btn.toUpperCase() == 'A') { + this._button_a_pressed = true; + this._button_b_pressed = false; + this._button_c_pressed = false; + return; + } + if (data.btn.toUpperCase() == 'B') { + this._button_a_pressed = false; + this._button_b_pressed = true; + this._button_c_pressed = false; + return; + } + if (data.btn.toUpperCase() == 'C') { + this._button_a_pressed = false; + this._button_b_pressed = false; + this._button_c_pressed = true; + return; + } + return; + }); + } +} +; +Scratch3Arduino.prototype.getInfo = function () { + return { + id: 'arduino', + name: "Arduino", + menuIconURI: menuIconURI, + blockIconURI: iconURI, + blocks: [{ + opcode: 'matrixDraw', + blockType: BlockType.COMMAND, + text: 'draw [FRAME] on matrix', + func: 'matrixDraw', + arguments: { + FRAME: { + type: ArgumentType.MATRIX, + defaultValue: '0101010101100010101000100' + } + } + }, { + opcode: 'whenModulinoButtonsPressed', + blockType: BlockType.HAT, + text: 'when modulino button [BTN] pressed', + func: 'whenModulinoButtonsPressed', + arguments: { + BTN: { + type: ArgumentType.STRING, + menu: 'modulinoButtons', + defaultValue: "A" + } + } + }], + menus: { + modulinoButtons: ["A", "B", "C"] + } + }; +}; +Scratch3Arduino.prototype.matrixDraw = function (args) { + console.log("Drawing frame on matrix: ".concat(args)); + this.io.emit("matrix_draw", { + frame: args.FRAME + }); +}; +Scratch3Arduino.prototype.whenModulinoButtonsPressed = function (args) { + if (args.BTN === 'A') { + return this._button_a_pressed; + } else if (args.BTN === 'B') { + return this._button_b_pressed; + } else if (args.BTN === 'C') { + return this._button_c_pressed; + } + return false; +}; +module.exports = Scratch3Arduino; + +/***/ }), + +/***/ "../../../scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/socket.io.min.js": +/*!****************************************************************************************************************!*\ + !*** ../../../scratch-arduino-extensions/packages/scratch-vm/src/extensions/scratch3_arduino/socket.io.min.js ***! + \****************************************************************************************************************/ +/***/ (function(module) { + +/*! + * Socket.IO v4.8.1 + * (c) 2014-2024 Guillermo Rauch + * Released under the MIT License. + */ +!function (t, n) { + true ? module.exports = n() : 0; +}(this, function () { + "use strict"; + + function t(t, n) { + (null == n || n > t.length) && (n = t.length); + for (var i = 0, r = Array(n); i < n; i++) r[i] = t[i]; + return r; + } + function n(t, n) { + for (var i = 0; i < n.length; i++) { + var r = n[i]; + r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, f(r.key), r); + } + } + function i(t, i, r) { + return i && n(t.prototype, i), r && n(t, r), Object.defineProperty(t, "prototype", { + writable: !1 + }), t; + } + function r(_n, i) { + var r = "undefined" != typeof Symbol && _n[Symbol.iterator] || _n["@@iterator"]; + if (!r) { + if (Array.isArray(_n) || (r = function (n, i) { + if (n) { + if ("string" == typeof n) return t(n, i); + var r = {}.toString.call(n).slice(8, -1); + return "Object" === r && n.constructor && (r = n.constructor.name), "Map" === r || "Set" === r ? Array.from(n) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? t(n, i) : void 0; + } + }(_n)) || i && _n && "number" == typeof _n.length) { + r && (_n = r); + var e = 0, + o = function o() {}; + return { + s: o, + n: function n() { + return e >= _n.length ? { + done: !0 + } : { + done: !1, + value: _n[e++] + }; + }, + e: function e(t) { + throw t; + }, + f: o + }; + } + 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 s, + u = !0, + h = !1; + return { + s: function s() { + r = r.call(_n); + }, + n: function n() { + var t = r.next(); + return u = t.done, t; + }, + e: function e(t) { + h = !0, s = t; + }, + f: function f() { + try { + u || null == r.return || r.return(); + } finally { + if (h) throw s; + } + } + }; + } + function e() { + return e = Object.assign ? Object.assign.bind() : function (t) { + for (var n = 1; n < arguments.length; n++) { + var i = arguments[n]; + for (var r in i) ({}).hasOwnProperty.call(i, r) && (t[r] = i[r]); + } + return t; + }, e.apply(null, arguments); + } + function o(t) { + return o = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, o(t); + } + function s(t, n) { + t.prototype = Object.create(n.prototype), t.prototype.constructor = t, h(t, n); + } + function u() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (u = function u() { + return !!t; + })(); + } + function h(t, n) { + return h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, n) { + return t.__proto__ = n, t; + }, h(t, n); + } + function f(t) { + var n = function (t, n) { + if ("object" != typeof t || !t) return t; + var i = t[Symbol.toPrimitive]; + if (void 0 !== i) { + var r = i.call(t, n || "default"); + if ("object" != typeof r) return r; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === n ? String : Number)(t); + }(t, "string"); + return "symbol" == typeof n ? n : n + ""; + } + function c(t) { + return c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { + return typeof t; + } : function (t) { + return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; + }, c(t); + } + function a(t) { + var n = "function" == typeof Map ? new Map() : void 0; + return a = function a(t) { + if (null === t || !function (t) { + try { + return -1 !== Function.toString.call(t).indexOf("[native code]"); + } catch (n) { + return "function" == typeof t; + } + }(t)) return t; + if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== n) { + if (n.has(t)) return n.get(t); + n.set(t, i); + } + function i() { + return function (t, n, i) { + if (u()) return Reflect.construct.apply(null, arguments); + var r = [null]; + r.push.apply(r, n); + var e = new (t.bind.apply(t, r))(); + return i && h(e, i.prototype), e; + }(t, arguments, o(this).constructor); + } + return i.prototype = Object.create(t.prototype, { + constructor: { + value: i, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), h(i, t); + }, a(t); + } + var v = Object.create(null); + v.open = "0", v.close = "1", v.ping = "2", v.pong = "3", v.message = "4", v.upgrade = "5", v.noop = "6"; + var l = Object.create(null); + Object.keys(v).forEach(function (t) { + l[v[t]] = t; + }); + var p, + d = { + type: "error", + data: "parser error" + }, + y = "function" == typeof Blob || "undefined" != typeof Blob && "[object BlobConstructor]" === Object.prototype.toString.call(Blob), + b = "function" == typeof ArrayBuffer, + w = function w(t) { + return "function" == typeof ArrayBuffer.isView ? ArrayBuffer.isView(t) : t && t.buffer instanceof ArrayBuffer; + }, + g = function g(t, n, i) { + var r = t.type, + e = t.data; + return y && e instanceof Blob ? n ? i(e) : m(e, i) : b && (e instanceof ArrayBuffer || w(e)) ? n ? i(e) : m(new Blob([e]), i) : i(v[r] + (e || "")); + }, + m = function m(t, n) { + var i = new FileReader(); + return i.onload = function () { + var t = i.result.split(",")[1]; + n("b" + (t || "")); + }, i.readAsDataURL(t); + }; + function k(t) { + return t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : new Uint8Array(t.buffer, t.byteOffset, t.byteLength); + } + for (var A = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", j = "undefined" == typeof Uint8Array ? [] : new Uint8Array(256), E = 0; E < 64; E++) j[A.charCodeAt(E)] = E; + var O, + B = "function" == typeof ArrayBuffer, + S = function S(t, n) { + if ("string" != typeof t) return { + type: "message", + data: C(t, n) + }; + var i = t.charAt(0); + return "b" === i ? { + type: "message", + data: N(t.substring(1), n) + } : l[i] ? t.length > 1 ? { + type: l[i], + data: t.substring(1) + } : { + type: l[i] + } : d; + }, + N = function N(t, n) { + if (B) { + var i = function (t) { + var n, + i, + r, + e, + o, + s = .75 * t.length, + u = t.length, + h = 0; + "=" === t[t.length - 1] && (s--, "=" === t[t.length - 2] && s--); + var f = new ArrayBuffer(s), + c = new Uint8Array(f); + for (n = 0; n < u; n += 4) i = j[t.charCodeAt(n)], r = j[t.charCodeAt(n + 1)], e = j[t.charCodeAt(n + 2)], o = j[t.charCodeAt(n + 3)], c[h++] = i << 2 | r >> 4, c[h++] = (15 & r) << 4 | e >> 2, c[h++] = (3 & e) << 6 | 63 & o; + return f; + }(t); + return C(i, n); + } + return { + base64: !0, + data: t + }; + }, + C = function C(t, n) { + return "blob" === n ? t instanceof Blob ? t : new Blob([t]) : t instanceof ArrayBuffer ? t : t.buffer; + }, + T = String.fromCharCode(30); + function U() { + return new TransformStream({ + transform: function transform(t, n) { + !function (t, n) { + y && t.data instanceof Blob ? t.data.arrayBuffer().then(k).then(n) : b && (t.data instanceof ArrayBuffer || w(t.data)) ? n(k(t.data)) : g(t, !1, function (t) { + p || (p = new TextEncoder()), n(p.encode(t)); + }); + }(t, function (i) { + var r, + e = i.length; + if (e < 126) r = new Uint8Array(1), new DataView(r.buffer).setUint8(0, e);else if (e < 65536) { + r = new Uint8Array(3); + var o = new DataView(r.buffer); + o.setUint8(0, 126), o.setUint16(1, e); + } else { + r = new Uint8Array(9); + var s = new DataView(r.buffer); + s.setUint8(0, 127), s.setBigUint64(1, BigInt(e)); + } + t.data && "string" != typeof t.data && (r[0] |= 128), n.enqueue(r), n.enqueue(i); + }); + } + }); + } + function M(t) { + return t.reduce(function (t, n) { + return t + n.length; + }, 0); + } + function x(t, n) { + if (t[0].length === n) return t.shift(); + for (var i = new Uint8Array(n), r = 0, e = 0; e < n; e++) i[e] = t[0][r++], r === t[0].length && (t.shift(), r = 0); + return t.length && r < t[0].length && (t[0] = t[0].slice(r)), i; + } + function I(t) { + if (t) return function (t) { + for (var n in I.prototype) t[n] = I.prototype[n]; + return t; + }(t); + } + I.prototype.on = I.prototype.addEventListener = function (t, n) { + return this.t = this.t || {}, (this.t["$" + t] = this.t["$" + t] || []).push(n), this; + }, I.prototype.once = function (t, n) { + function i() { + this.off(t, i), n.apply(this, arguments); + } + return i.fn = n, this.on(t, i), this; + }, I.prototype.off = I.prototype.removeListener = I.prototype.removeAllListeners = I.prototype.removeEventListener = function (t, n) { + if (this.t = this.t || {}, 0 == arguments.length) return this.t = {}, this; + var i, + r = this.t["$" + t]; + if (!r) return this; + if (1 == arguments.length) return delete this.t["$" + t], this; + for (var e = 0; e < r.length; e++) if ((i = r[e]) === n || i.fn === n) { + r.splice(e, 1); + break; + } + return 0 === r.length && delete this.t["$" + t], this; + }, I.prototype.emit = function (t) { + this.t = this.t || {}; + for (var n = new Array(arguments.length - 1), i = this.t["$" + t], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r]; + if (i) { + r = 0; + for (var e = (i = i.slice(0)).length; r < e; ++r) i[r].apply(this, n); + } + return this; + }, I.prototype.emitReserved = I.prototype.emit, I.prototype.listeners = function (t) { + return this.t = this.t || {}, this.t["$" + t] || []; + }, I.prototype.hasListeners = function (t) { + return !!this.listeners(t).length; + }; + var R = "function" == typeof Promise && "function" == typeof Promise.resolve ? function (t) { + return Promise.resolve().then(t); + } : function (t, n) { + return n(t, 0); + }, + L = "undefined" != typeof self ? self : "undefined" != typeof window ? window : Function("return this")(); + function _(t) { + for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) i[r - 1] = arguments[r]; + return i.reduce(function (n, i) { + return t.hasOwnProperty(i) && (n[i] = t[i]), n; + }, {}); + } + var D = L.setTimeout, + P = L.clearTimeout; + function $(t, n) { + n.useNativeTimers ? (t.setTimeoutFn = D.bind(L), t.clearTimeoutFn = P.bind(L)) : (t.setTimeoutFn = L.setTimeout.bind(L), t.clearTimeoutFn = L.clearTimeout.bind(L)); + } + function F() { + return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5); + } + var V = function (t) { + function n(n, i, r) { + var e; + return (e = t.call(this, n) || this).description = i, e.context = r, e.type = "TransportError", e; + } + return s(n, t), n; + }(a(Error)), + q = function (t) { + function n(n) { + var i; + return (i = t.call(this) || this).writable = !1, $(i, n), i.opts = n, i.query = n.query, i.socket = n.socket, i.supportsBinary = !n.forceBase64, i; + } + s(n, t); + var i = n.prototype; + return i.onError = function (n, i, r) { + return t.prototype.emitReserved.call(this, "error", new V(n, i, r)), this; + }, i.open = function () { + return this.readyState = "opening", this.doOpen(), this; + }, i.close = function () { + return "opening" !== this.readyState && "open" !== this.readyState || (this.doClose(), this.onClose()), this; + }, i.send = function (t) { + "open" === this.readyState && this.write(t); + }, i.onOpen = function () { + this.readyState = "open", this.writable = !0, t.prototype.emitReserved.call(this, "open"); + }, i.onData = function (t) { + var n = S(t, this.socket.binaryType); + this.onPacket(n); + }, i.onPacket = function (n) { + t.prototype.emitReserved.call(this, "packet", n); + }, i.onClose = function (n) { + this.readyState = "closed", t.prototype.emitReserved.call(this, "close", n); + }, i.pause = function (t) {}, i.createUri = function (t) { + var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + return t + "://" + this.i() + this.o() + this.opts.path + this.u(n); + }, i.i = function () { + var t = this.opts.hostname; + return -1 === t.indexOf(":") ? t : "[" + t + "]"; + }, i.o = function () { + return this.opts.port && (this.opts.secure && Number(443 !== this.opts.port) || !this.opts.secure && 80 !== Number(this.opts.port)) ? ":" + this.opts.port : ""; + }, i.u = function (t) { + var n = function (t) { + var n = ""; + for (var i in t) t.hasOwnProperty(i) && (n.length && (n += "&"), n += encodeURIComponent(i) + "=" + encodeURIComponent(t[i])); + return n; + }(t); + return n.length ? "?" + n : ""; + }, n; + }(I), + X = function (t) { + function n() { + var n; + return (n = t.apply(this, arguments) || this).h = !1, n; + } + s(n, t); + var r = n.prototype; + return r.doOpen = function () { + this.v(); + }, r.pause = function (t) { + var n = this; + this.readyState = "pausing"; + var i = function i() { + n.readyState = "paused", t(); + }; + if (this.h || !this.writable) { + var r = 0; + this.h && (r++, this.once("pollComplete", function () { + --r || i(); + })), this.writable || (r++, this.once("drain", function () { + --r || i(); + })); + } else i(); + }, r.v = function () { + this.h = !0, this.doPoll(), this.emitReserved("poll"); + }, r.onData = function (t) { + var n = this; + (function (t, n) { + for (var i = t.split(T), r = [], e = 0; e < i.length; e++) { + var o = S(i[e], n); + if (r.push(o), "error" === o.type) break; + } + return r; + })(t, this.socket.binaryType).forEach(function (t) { + if ("opening" === n.readyState && "open" === t.type && n.onOpen(), "close" === t.type) return n.onClose({ + description: "transport closed by the server" + }), !1; + n.onPacket(t); + }), "closed" !== this.readyState && (this.h = !1, this.emitReserved("pollComplete"), "open" === this.readyState && this.v()); + }, r.doClose = function () { + var t = this, + n = function n() { + t.write([{ + type: "close" + }]); + }; + "open" === this.readyState ? n() : this.once("open", n); + }, r.write = function (t) { + var n = this; + this.writable = !1, function (t, n) { + var i = t.length, + r = new Array(i), + e = 0; + t.forEach(function (t, o) { + g(t, !1, function (t) { + r[o] = t, ++e === i && n(r.join(T)); + }); + }); + }(t, function (t) { + n.doWrite(t, function () { + n.writable = !0, n.emitReserved("drain"); + }); + }); + }, r.uri = function () { + var t = this.opts.secure ? "https" : "http", + n = this.query || {}; + return !1 !== this.opts.timestampRequests && (n[this.opts.timestampParam] = F()), this.supportsBinary || n.sid || (n.b64 = 1), this.createUri(t, n); + }, i(n, [{ + key: "name", + get: function get() { + return "polling"; + } + }]); + }(q), + H = !1; + try { + H = "undefined" != typeof XMLHttpRequest && "withCredentials" in new XMLHttpRequest(); + } catch (t) {} + var z = H; + function J() {} + var K = function (t) { + function n(n) { + var i; + if (i = t.call(this, n) || this, "undefined" != typeof location) { + var r = "https:" === location.protocol, + e = location.port; + e || (e = r ? "443" : "80"), i.xd = "undefined" != typeof location && n.hostname !== location.hostname || e !== n.port; + } + return i; + } + s(n, t); + var i = n.prototype; + return i.doWrite = function (t, n) { + var i = this, + r = this.request({ + method: "POST", + data: t + }); + r.on("success", n), r.on("error", function (t, n) { + i.onError("xhr post error", t, n); + }); + }, i.doPoll = function () { + var t = this, + n = this.request(); + n.on("data", this.onData.bind(this)), n.on("error", function (n, i) { + t.onError("xhr poll error", n, i); + }), this.pollXhr = n; + }, n; + }(X), + Y = function (t) { + function n(n, i, r) { + var e; + return (e = t.call(this) || this).createRequest = n, $(e, r), e.l = r, e.p = r.method || "GET", e.m = i, e.k = void 0 !== r.data ? r.data : null, e.A(), e; + } + s(n, t); + var i = n.prototype; + return i.A = function () { + var t, + i = this, + r = _(this.l, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref"); + r.xdomain = !!this.l.xd; + var e = this.j = this.createRequest(r); + try { + e.open(this.p, this.m, !0); + try { + if (this.l.extraHeaders) for (var o in e.setDisableHeaderCheck && e.setDisableHeaderCheck(!0), this.l.extraHeaders) this.l.extraHeaders.hasOwnProperty(o) && e.setRequestHeader(o, this.l.extraHeaders[o]); + } catch (t) {} + if ("POST" === this.p) try { + e.setRequestHeader("Content-type", "text/plain;charset=UTF-8"); + } catch (t) {} + try { + e.setRequestHeader("Accept", "*/*"); + } catch (t) {} + null === (t = this.l.cookieJar) || void 0 === t || t.addCookies(e), "withCredentials" in e && (e.withCredentials = this.l.withCredentials), this.l.requestTimeout && (e.timeout = this.l.requestTimeout), e.onreadystatechange = function () { + var t; + 3 === e.readyState && (null === (t = i.l.cookieJar) || void 0 === t || t.parseCookies(e.getResponseHeader("set-cookie"))), 4 === e.readyState && (200 === e.status || 1223 === e.status ? i.O() : i.setTimeoutFn(function () { + i.B("number" == typeof e.status ? e.status : 0); + }, 0)); + }, e.send(this.k); + } catch (t) { + return void this.setTimeoutFn(function () { + i.B(t); + }, 0); + } + "undefined" != typeof document && (this.S = n.requestsCount++, n.requests[this.S] = this); + }, i.B = function (t) { + this.emitReserved("error", t, this.j), this.N(!0); + }, i.N = function (t) { + if (void 0 !== this.j && null !== this.j) { + if (this.j.onreadystatechange = J, t) try { + this.j.abort(); + } catch (t) {} + "undefined" != typeof document && delete n.requests[this.S], this.j = null; + } + }, i.O = function () { + var t = this.j.responseText; + null !== t && (this.emitReserved("data", t), this.emitReserved("success"), this.N()); + }, i.abort = function () { + this.N(); + }, n; + }(I); + if (Y.requestsCount = 0, Y.requests = {}, "undefined" != typeof document) if ("function" == typeof attachEvent) attachEvent("onunload", G);else if ("function" == typeof addEventListener) { + addEventListener("onpagehide" in L ? "pagehide" : "unload", G, !1); + } + function G() { + for (var t in Y.requests) Y.requests.hasOwnProperty(t) && Y.requests[t].abort(); + } + var Q, + W = (Q = tt({ + xdomain: !1 + })) && null !== Q.responseType, + Z = function (t) { + function n(n) { + var i; + i = t.call(this, n) || this; + var r = n && n.forceBase64; + return i.supportsBinary = W && !r, i; + } + return s(n, t), n.prototype.request = function () { + var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return e(t, { + xd: this.xd + }, this.opts), new Y(tt, this.uri(), t); + }, n; + }(K); + function tt(t) { + var n = t.xdomain; + try { + if ("undefined" != typeof XMLHttpRequest && (!n || z)) return new XMLHttpRequest(); + } catch (t) {} + if (!n) try { + return new L[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP"); + } catch (t) {} + } + var nt = "undefined" != typeof navigator && "string" == typeof navigator.product && "reactnative" === navigator.product.toLowerCase(), + it = function (t) { + function n() { + return t.apply(this, arguments) || this; + } + s(n, t); + var r = n.prototype; + return r.doOpen = function () { + var t = this.uri(), + n = this.opts.protocols, + i = nt ? {} : _(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity"); + this.opts.extraHeaders && (i.headers = this.opts.extraHeaders); + try { + this.ws = this.createSocket(t, n, i); + } catch (t) { + return this.emitReserved("error", t); + } + this.ws.binaryType = this.socket.binaryType, this.addEventListeners(); + }, r.addEventListeners = function () { + var t = this; + this.ws.onopen = function () { + t.opts.autoUnref && t.ws.C.unref(), t.onOpen(); + }, this.ws.onclose = function (n) { + return t.onClose({ + description: "websocket connection closed", + context: n + }); + }, this.ws.onmessage = function (n) { + return t.onData(n.data); + }, this.ws.onerror = function (n) { + return t.onError("websocket error", n); + }; + }, r.write = function (t) { + var n = this; + this.writable = !1; + for (var i = function i() { + var i = t[r], + e = r === t.length - 1; + g(i, n.supportsBinary, function (t) { + try { + n.doWrite(i, t); + } catch (t) {} + e && R(function () { + n.writable = !0, n.emitReserved("drain"); + }, n.setTimeoutFn); + }); + }, r = 0; r < t.length; r++) i(); + }, r.doClose = function () { + void 0 !== this.ws && (this.ws.onerror = function () {}, this.ws.close(), this.ws = null); + }, r.uri = function () { + var t = this.opts.secure ? "wss" : "ws", + n = this.query || {}; + return this.opts.timestampRequests && (n[this.opts.timestampParam] = F()), this.supportsBinary || (n.b64 = 1), this.createUri(t, n); + }, i(n, [{ + key: "name", + get: function get() { + return "websocket"; + } + }]); + }(q), + rt = L.WebSocket || L.MozWebSocket, + et = function (t) { + function n() { + return t.apply(this, arguments) || this; + } + s(n, t); + var i = n.prototype; + return i.createSocket = function (t, n, i) { + return nt ? new rt(t, n, i) : n ? new rt(t, n) : new rt(t); + }, i.doWrite = function (t, n) { + this.ws.send(n); + }, n; + }(it), + ot = function (t) { + function n() { + return t.apply(this, arguments) || this; + } + s(n, t); + var r = n.prototype; + return r.doOpen = function () { + var t = this; + try { + this.T = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]); + } catch (t) { + return this.emitReserved("error", t); + } + this.T.closed.then(function () { + t.onClose(); + }).catch(function (n) { + t.onError("webtransport error", n); + }), this.T.ready.then(function () { + t.T.createBidirectionalStream().then(function (n) { + var i = function (t, n) { + O || (O = new TextDecoder()); + var i = [], + r = 0, + e = -1, + o = !1; + return new TransformStream({ + transform: function transform(s, u) { + for (i.push(s);;) { + if (0 === r) { + if (M(i) < 1) break; + var h = x(i, 1); + o = !(128 & ~h[0]), e = 127 & h[0], r = e < 126 ? 3 : 126 === e ? 1 : 2; + } else if (1 === r) { + if (M(i) < 2) break; + var f = x(i, 2); + e = new DataView(f.buffer, f.byteOffset, f.length).getUint16(0), r = 3; + } else if (2 === r) { + if (M(i) < 8) break; + var c = x(i, 8), + a = new DataView(c.buffer, c.byteOffset, c.length), + v = a.getUint32(0); + if (v > Math.pow(2, 21) - 1) { + u.enqueue(d); + break; + } + e = v * Math.pow(2, 32) + a.getUint32(4), r = 3; + } else { + if (M(i) < e) break; + var l = x(i, e); + u.enqueue(S(o ? l : O.decode(l), n)), r = 0; + } + if (0 === e || e > t) { + u.enqueue(d); + break; + } + } + } + }); + }(Number.MAX_SAFE_INTEGER, t.socket.binaryType), + r = n.readable.pipeThrough(i).getReader(), + e = U(); + e.readable.pipeTo(n.writable), t.U = e.writable.getWriter(); + !function n() { + r.read().then(function (i) { + var r = i.done, + e = i.value; + r || (t.onPacket(e), n()); + }).catch(function (t) {}); + }(); + var o = { + type: "open" + }; + t.query.sid && (o.data = '{"sid":"'.concat(t.query.sid, '"}')), t.U.write(o).then(function () { + return t.onOpen(); + }); + }); + }); + }, r.write = function (t) { + var n = this; + this.writable = !1; + for (var i = function i() { + var i = t[r], + e = r === t.length - 1; + n.U.write(i).then(function () { + e && R(function () { + n.writable = !0, n.emitReserved("drain"); + }, n.setTimeoutFn); + }); + }, r = 0; r < t.length; r++) i(); + }, r.doClose = function () { + var t; + null === (t = this.T) || void 0 === t || t.close(); + }, i(n, [{ + key: "name", + get: function get() { + return "webtransport"; + } + }]); + }(q), + st = { + websocket: et, + webtransport: ot, + polling: Z + }, + ut = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, + ht = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"]; + function ft(t) { + if (t.length > 8e3) throw "URI too long"; + var n = t, + i = t.indexOf("["), + r = t.indexOf("]"); + -1 != i && -1 != r && (t = t.substring(0, i) + t.substring(i, r).replace(/:/g, ";") + t.substring(r, t.length)); + for (var e, o, s = ut.exec(t || ""), u = {}, h = 14; h--;) u[ht[h]] = s[h] || ""; + return -1 != i && -1 != r && (u.source = n, u.host = u.host.substring(1, u.host.length - 1).replace(/;/g, ":"), u.authority = u.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), u.ipv6uri = !0), u.pathNames = function (t, n) { + var i = /\/{2,9}/g, + r = n.replace(i, "/").split("/"); + "/" != n.slice(0, 1) && 0 !== n.length || r.splice(0, 1); + "/" == n.slice(-1) && r.splice(r.length - 1, 1); + return r; + }(0, u.path), u.queryKey = (e = u.query, o = {}, e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function (t, n, i) { + n && (o[n] = i); + }), o), u; + } + var ct = "function" == typeof addEventListener && "function" == typeof removeEventListener, + at = []; + ct && addEventListener("offline", function () { + at.forEach(function (t) { + return t(); + }); + }, !1); + var vt = function (t) { + function n(n, i) { + var r; + if ((r = t.call(this) || this).binaryType = "arraybuffer", r.writeBuffer = [], r.M = 0, r.I = -1, r.R = -1, r.L = -1, r._ = 1 / 0, n && "object" === c(n) && (i = n, n = null), n) { + var o = ft(n); + i.hostname = o.host, i.secure = "https" === o.protocol || "wss" === o.protocol, i.port = o.port, o.query && (i.query = o.query); + } else i.host && (i.hostname = ft(i.host).host); + return $(r, i), r.secure = null != i.secure ? i.secure : "undefined" != typeof location && "https:" === location.protocol, i.hostname && !i.port && (i.port = r.secure ? "443" : "80"), r.hostname = i.hostname || ("undefined" != typeof location ? location.hostname : "localhost"), r.port = i.port || ("undefined" != typeof location && location.port ? location.port : r.secure ? "443" : "80"), r.transports = [], r.D = {}, i.transports.forEach(function (t) { + var n = t.prototype.name; + r.transports.push(n), r.D[n] = t; + }), r.opts = e({ + path: "/engine.io", + agent: !1, + withCredentials: !1, + upgrade: !0, + timestampParam: "t", + rememberUpgrade: !1, + addTrailingSlash: !0, + rejectUnauthorized: !0, + perMessageDeflate: { + threshold: 1024 + }, + transportOptions: {}, + closeOnBeforeunload: !1 + }, i), r.opts.path = r.opts.path.replace(/\/$/, "") + (r.opts.addTrailingSlash ? "/" : ""), "string" == typeof r.opts.query && (r.opts.query = function (t) { + for (var n = {}, i = t.split("&"), r = 0, e = i.length; r < e; r++) { + var o = i[r].split("="); + n[decodeURIComponent(o[0])] = decodeURIComponent(o[1]); + } + return n; + }(r.opts.query)), ct && (r.opts.closeOnBeforeunload && (r.P = function () { + r.transport && (r.transport.removeAllListeners(), r.transport.close()); + }, addEventListener("beforeunload", r.P, !1)), "localhost" !== r.hostname && (r.$ = function () { + r.F("transport close", { + description: "network connection lost" + }); + }, at.push(r.$))), r.opts.withCredentials && (r.V = void 0), r.q(), r; + } + s(n, t); + var i = n.prototype; + return i.createTransport = function (t) { + var n = e({}, this.opts.query); + n.EIO = 4, n.transport = t, this.id && (n.sid = this.id); + var i = e({}, this.opts, { + query: n, + socket: this, + hostname: this.hostname, + secure: this.secure, + port: this.port + }, this.opts.transportOptions[t]); + return new this.D[t](i); + }, i.q = function () { + var t = this; + if (0 !== this.transports.length) { + var i = this.opts.rememberUpgrade && n.priorWebsocketSuccess && -1 !== this.transports.indexOf("websocket") ? "websocket" : this.transports[0]; + this.readyState = "opening"; + var r = this.createTransport(i); + r.open(), this.setTransport(r); + } else this.setTimeoutFn(function () { + t.emitReserved("error", "No transports available"); + }, 0); + }, i.setTransport = function (t) { + var n = this; + this.transport && this.transport.removeAllListeners(), this.transport = t, t.on("drain", this.X.bind(this)).on("packet", this.H.bind(this)).on("error", this.B.bind(this)).on("close", function (t) { + return n.F("transport close", t); + }); + }, i.onOpen = function () { + this.readyState = "open", n.priorWebsocketSuccess = "websocket" === this.transport.name, this.emitReserved("open"), this.flush(); + }, i.H = function (t) { + if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) switch (this.emitReserved("packet", t), this.emitReserved("heartbeat"), t.type) { + case "open": + this.onHandshake(JSON.parse(t.data)); + break; + case "ping": + this.J("pong"), this.emitReserved("ping"), this.emitReserved("pong"), this.K(); + break; + case "error": + var n = new Error("server error"); + n.code = t.data, this.B(n); + break; + case "message": + this.emitReserved("data", t.data), this.emitReserved("message", t.data); + } + }, i.onHandshake = function (t) { + this.emitReserved("handshake", t), this.id = t.sid, this.transport.query.sid = t.sid, this.I = t.pingInterval, this.R = t.pingTimeout, this.L = t.maxPayload, this.onOpen(), "closed" !== this.readyState && this.K(); + }, i.K = function () { + var t = this; + this.clearTimeoutFn(this.Y); + var n = this.I + this.R; + this._ = Date.now() + n, this.Y = this.setTimeoutFn(function () { + t.F("ping timeout"); + }, n), this.opts.autoUnref && this.Y.unref(); + }, i.X = function () { + this.writeBuffer.splice(0, this.M), this.M = 0, 0 === this.writeBuffer.length ? this.emitReserved("drain") : this.flush(); + }, i.flush = function () { + if ("closed" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) { + var t = this.G(); + this.transport.send(t), this.M = t.length, this.emitReserved("flush"); + } + }, i.G = function () { + if (!(this.L && "polling" === this.transport.name && this.writeBuffer.length > 1)) return this.writeBuffer; + for (var t, n = 1, i = 0; i < this.writeBuffer.length; i++) { + var r = this.writeBuffer[i].data; + if (r && (n += "string" == typeof (t = r) ? function (t) { + for (var n = 0, i = 0, r = 0, e = t.length; r < e; r++) (n = t.charCodeAt(r)) < 128 ? i += 1 : n < 2048 ? i += 2 : n < 55296 || n >= 57344 ? i += 3 : (r++, i += 4); + return i; + }(t) : Math.ceil(1.33 * (t.byteLength || t.size))), i > 0 && n > this.L) return this.writeBuffer.slice(0, i); + n += 2; + } + return this.writeBuffer; + }, i.W = function () { + var t = this; + if (!this._) return !0; + var n = Date.now() > this._; + return n && (this._ = 0, R(function () { + t.F("ping timeout"); + }, this.setTimeoutFn)), n; + }, i.write = function (t, n, i) { + return this.J("message", t, n, i), this; + }, i.send = function (t, n, i) { + return this.J("message", t, n, i), this; + }, i.J = function (t, n, i, r) { + if ("function" == typeof n && (r = n, n = void 0), "function" == typeof i && (r = i, i = null), "closing" !== this.readyState && "closed" !== this.readyState) { + (i = i || {}).compress = !1 !== i.compress; + var e = { + type: t, + data: n, + options: i + }; + this.emitReserved("packetCreate", e), this.writeBuffer.push(e), r && this.once("flush", r), this.flush(); + } + }, i.close = function () { + var t = this, + n = function n() { + t.F("forced close"), t.transport.close(); + }, + i = function i() { + t.off("upgrade", i), t.off("upgradeError", i), n(); + }, + r = function r() { + t.once("upgrade", i), t.once("upgradeError", i); + }; + return "opening" !== this.readyState && "open" !== this.readyState || (this.readyState = "closing", this.writeBuffer.length ? this.once("drain", function () { + t.upgrading ? r() : n(); + }) : this.upgrading ? r() : n()), this; + }, i.B = function (t) { + if (n.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && "opening" === this.readyState) return this.transports.shift(), this.q(); + this.emitReserved("error", t), this.F("transport error", t); + }, i.F = function (t, n) { + if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) { + if (this.clearTimeoutFn(this.Y), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), ct && (this.P && removeEventListener("beforeunload", this.P, !1), this.$)) { + var i = at.indexOf(this.$); + -1 !== i && at.splice(i, 1); + } + this.readyState = "closed", this.id = null, this.emitReserved("close", t, n), this.writeBuffer = [], this.M = 0; + } + }, n; + }(I); + vt.protocol = 4; + var lt = function (t) { + function n() { + var n; + return (n = t.apply(this, arguments) || this).Z = [], n; + } + s(n, t); + var i = n.prototype; + return i.onOpen = function () { + if (t.prototype.onOpen.call(this), "open" === this.readyState && this.opts.upgrade) for (var n = 0; n < this.Z.length; n++) this.tt(this.Z[n]); + }, i.tt = function (t) { + var n = this, + i = this.createTransport(t), + r = !1; + vt.priorWebsocketSuccess = !1; + var e = function e() { + r || (i.send([{ + type: "ping", + data: "probe" + }]), i.once("packet", function (t) { + if (!r) if ("pong" === t.type && "probe" === t.data) { + if (n.upgrading = !0, n.emitReserved("upgrading", i), !i) return; + vt.priorWebsocketSuccess = "websocket" === i.name, n.transport.pause(function () { + r || "closed" !== n.readyState && (c(), n.setTransport(i), i.send([{ + type: "upgrade" + }]), n.emitReserved("upgrade", i), i = null, n.upgrading = !1, n.flush()); + }); + } else { + var e = new Error("probe error"); + e.transport = i.name, n.emitReserved("upgradeError", e); + } + })); + }; + function o() { + r || (r = !0, c(), i.close(), i = null); + } + var s = function s(t) { + var r = new Error("probe error: " + t); + r.transport = i.name, o(), n.emitReserved("upgradeError", r); + }; + function u() { + s("transport closed"); + } + function h() { + s("socket closed"); + } + function f(t) { + i && t.name !== i.name && o(); + } + var c = function c() { + i.removeListener("open", e), i.removeListener("error", s), i.removeListener("close", u), n.off("close", h), n.off("upgrading", f); + }; + i.once("open", e), i.once("error", s), i.once("close", u), this.once("close", h), this.once("upgrading", f), -1 !== this.Z.indexOf("webtransport") && "webtransport" !== t ? this.setTimeoutFn(function () { + r || i.open(); + }, 200) : i.open(); + }, i.onHandshake = function (n) { + this.Z = this.nt(n.upgrades), t.prototype.onHandshake.call(this, n); + }, i.nt = function (t) { + for (var n = [], i = 0; i < t.length; i++) ~this.transports.indexOf(t[i]) && n.push(t[i]); + return n; + }, n; + }(vt), + pt = function (t) { + function n(n) { + var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, + r = "object" === c(n) ? n : i; + return (!r.transports || r.transports && "string" == typeof r.transports[0]) && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map(function (t) { + return st[t]; + }).filter(function (t) { + return !!t; + })), t.call(this, n, r) || this; + } + return s(n, t), n; + }(lt); + pt.protocol; + var dt = "function" == typeof ArrayBuffer, + yt = function yt(t) { + return "function" == typeof ArrayBuffer.isView ? ArrayBuffer.isView(t) : t.buffer instanceof ArrayBuffer; + }, + bt = Object.prototype.toString, + wt = "function" == typeof Blob || "undefined" != typeof Blob && "[object BlobConstructor]" === bt.call(Blob), + gt = "function" == typeof File || "undefined" != typeof File && "[object FileConstructor]" === bt.call(File); + function mt(t) { + return dt && (t instanceof ArrayBuffer || yt(t)) || wt && t instanceof Blob || gt && t instanceof File; + } + function kt(t, n) { + if (!t || "object" !== c(t)) return !1; + if (Array.isArray(t)) { + for (var i = 0, r = t.length; i < r; i++) if (kt(t[i])) return !0; + return !1; + } + if (mt(t)) return !0; + if (t.toJSON && "function" == typeof t.toJSON && 1 === arguments.length) return kt(t.toJSON(), !0); + for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e) && kt(t[e])) return !0; + return !1; + } + function At(t) { + var n = [], + i = t.data, + r = t; + return r.data = jt(i, n), r.attachments = n.length, { + packet: r, + buffers: n + }; + } + function jt(t, n) { + if (!t) return t; + if (mt(t)) { + var i = { + _placeholder: !0, + num: n.length + }; + return n.push(t), i; + } + if (Array.isArray(t)) { + for (var r = new Array(t.length), e = 0; e < t.length; e++) r[e] = jt(t[e], n); + return r; + } + if ("object" === c(t) && !(t instanceof Date)) { + var o = {}; + for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (o[s] = jt(t[s], n)); + return o; + } + return t; + } + function Et(t, n) { + return t.data = Ot(t.data, n), delete t.attachments, t; + } + function Ot(t, n) { + if (!t) return t; + if (t && !0 === t._placeholder) { + if ("number" == typeof t.num && t.num >= 0 && t.num < n.length) return n[t.num]; + throw new Error("illegal attachments"); + } + if (Array.isArray(t)) for (var i = 0; i < t.length; i++) t[i] = Ot(t[i], n);else if ("object" === c(t)) for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (t[r] = Ot(t[r], n)); + return t; + } + var Bt, + St = ["connect", "connect_error", "disconnect", "disconnecting", "newListener", "removeListener"]; + !function (t) { + t[t.CONNECT = 0] = "CONNECT", t[t.DISCONNECT = 1] = "DISCONNECT", t[t.EVENT = 2] = "EVENT", t[t.ACK = 3] = "ACK", t[t.CONNECT_ERROR = 4] = "CONNECT_ERROR", t[t.BINARY_EVENT = 5] = "BINARY_EVENT", t[t.BINARY_ACK = 6] = "BINARY_ACK"; + }(Bt || (Bt = {})); + var Nt = function () { + function t(t) { + this.replacer = t; + } + var n = t.prototype; + return n.encode = function (t) { + return t.type !== Bt.EVENT && t.type !== Bt.ACK || !kt(t) ? [this.encodeAsString(t)] : this.encodeAsBinary({ + type: t.type === Bt.EVENT ? Bt.BINARY_EVENT : Bt.BINARY_ACK, + nsp: t.nsp, + data: t.data, + id: t.id + }); + }, n.encodeAsString = function (t) { + var n = "" + t.type; + return t.type !== Bt.BINARY_EVENT && t.type !== Bt.BINARY_ACK || (n += t.attachments + "-"), t.nsp && "/" !== t.nsp && (n += t.nsp + ","), null != t.id && (n += t.id), null != t.data && (n += JSON.stringify(t.data, this.replacer)), n; + }, n.encodeAsBinary = function (t) { + var n = At(t), + i = this.encodeAsString(n.packet), + r = n.buffers; + return r.unshift(i), r; + }, t; + }(), + Ct = function (t) { + function n(n) { + var i; + return (i = t.call(this) || this).reviver = n, i; + } + s(n, t); + var i = n.prototype; + return i.add = function (n) { + var i; + if ("string" == typeof n) { + if (this.reconstructor) throw new Error("got plaintext data when reconstructing a packet"); + var r = (i = this.decodeString(n)).type === Bt.BINARY_EVENT; + r || i.type === Bt.BINARY_ACK ? (i.type = r ? Bt.EVENT : Bt.ACK, this.reconstructor = new Tt(i), 0 === i.attachments && t.prototype.emitReserved.call(this, "decoded", i)) : t.prototype.emitReserved.call(this, "decoded", i); + } else { + if (!mt(n) && !n.base64) throw new Error("Unknown type: " + n); + if (!this.reconstructor) throw new Error("got binary data when not reconstructing a packet"); + (i = this.reconstructor.takeBinaryData(n)) && (this.reconstructor = null, t.prototype.emitReserved.call(this, "decoded", i)); + } + }, i.decodeString = function (t) { + var i = 0, + r = { + type: Number(t.charAt(0)) + }; + if (void 0 === Bt[r.type]) throw new Error("unknown packet type " + r.type); + if (r.type === Bt.BINARY_EVENT || r.type === Bt.BINARY_ACK) { + for (var e = i + 1; "-" !== t.charAt(++i) && i != t.length;); + var o = t.substring(e, i); + if (o != Number(o) || "-" !== t.charAt(i)) throw new Error("Illegal attachments"); + r.attachments = Number(o); + } + if ("/" === t.charAt(i + 1)) { + for (var s = i + 1; ++i;) { + if ("," === t.charAt(i)) break; + if (i === t.length) break; + } + r.nsp = t.substring(s, i); + } else r.nsp = "/"; + var u = t.charAt(i + 1); + if ("" !== u && Number(u) == u) { + for (var h = i + 1; ++i;) { + var f = t.charAt(i); + if (null == f || Number(f) != f) { + --i; + break; + } + if (i === t.length) break; + } + r.id = Number(t.substring(h, i + 1)); + } + if (t.charAt(++i)) { + var c = this.tryParse(t.substr(i)); + if (!n.isPayloadValid(r.type, c)) throw new Error("invalid payload"); + r.data = c; + } + return r; + }, i.tryParse = function (t) { + try { + return JSON.parse(t, this.reviver); + } catch (t) { + return !1; + } + }, n.isPayloadValid = function (t, n) { + switch (t) { + case Bt.CONNECT: + return Mt(n); + case Bt.DISCONNECT: + return void 0 === n; + case Bt.CONNECT_ERROR: + return "string" == typeof n || Mt(n); + case Bt.EVENT: + case Bt.BINARY_EVENT: + return Array.isArray(n) && ("number" == typeof n[0] || "string" == typeof n[0] && -1 === St.indexOf(n[0])); + case Bt.ACK: + case Bt.BINARY_ACK: + return Array.isArray(n); + } + }, i.destroy = function () { + this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null); + }, n; + }(I), + Tt = function () { + function t(t) { + this.packet = t, this.buffers = [], this.reconPack = t; + } + var n = t.prototype; + return n.takeBinaryData = function (t) { + if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) { + var n = Et(this.reconPack, this.buffers); + return this.finishedReconstruction(), n; + } + return null; + }, n.finishedReconstruction = function () { + this.reconPack = null, this.buffers = []; + }, t; + }(); + var Ut = Number.isInteger || function (t) { + return "number" == typeof t && isFinite(t) && Math.floor(t) === t; + }; + function Mt(t) { + return "[object Object]" === Object.prototype.toString.call(t); + } + var xt = Object.freeze({ + __proto__: null, + protocol: 5, + get PacketType() { + return Bt; + }, + Encoder: Nt, + Decoder: Ct, + isPacketValid: function isPacketValid(t) { + return "string" == typeof t.nsp && (void 0 === (n = t.id) || Ut(n)) && function (t, n) { + switch (t) { + case Bt.CONNECT: + return void 0 === n || Mt(n); + case Bt.DISCONNECT: + return void 0 === n; + case Bt.EVENT: + return Array.isArray(n) && ("number" == typeof n[0] || "string" == typeof n[0] && -1 === St.indexOf(n[0])); + case Bt.ACK: + return Array.isArray(n); + case Bt.CONNECT_ERROR: + return "string" == typeof n || Mt(n); + default: + return !1; + } + }(t.type, t.data); + // removed by dead control flow +{ var n; } + } + }); + function It(t, n, i) { + return t.on(n, i), function () { + t.off(n, i); + }; + } + var Rt = Object.freeze({ + connect: 1, + connect_error: 1, + disconnect: 1, + disconnecting: 1, + newListener: 1, + removeListener: 1 + }), + Lt = function (t) { + function n(n, i, r) { + var o; + return (o = t.call(this) || this).connected = !1, o.recovered = !1, o.receiveBuffer = [], o.sendBuffer = [], o.it = [], o.rt = 0, o.ids = 0, o.acks = {}, o.flags = {}, o.io = n, o.nsp = i, r && r.auth && (o.auth = r.auth), o.l = e({}, r), o.io.et && o.open(), o; + } + s(n, t); + var o = n.prototype; + return o.subEvents = function () { + if (!this.subs) { + var t = this.io; + this.subs = [It(t, "open", this.onopen.bind(this)), It(t, "packet", this.onpacket.bind(this)), It(t, "error", this.onerror.bind(this)), It(t, "close", this.onclose.bind(this))]; + } + }, o.connect = function () { + return this.connected || (this.subEvents(), this.io.ot || this.io.open(), "open" === this.io.st && this.onopen()), this; + }, o.open = function () { + return this.connect(); + }, o.send = function () { + for (var t = arguments.length, n = new Array(t), i = 0; i < t; i++) n[i] = arguments[i]; + return n.unshift("message"), this.emit.apply(this, n), this; + }, o.emit = function (t) { + var n, i, r; + if (Rt.hasOwnProperty(t)) throw new Error('"' + t.toString() + '" is a reserved event name'); + for (var e = arguments.length, o = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++) o[s - 1] = arguments[s]; + if (o.unshift(t), this.l.retries && !this.flags.fromQueue && !this.flags.volatile) return this.ut(o), this; + var u = { + type: Bt.EVENT, + data: o, + options: {} + }; + if (u.options.compress = !1 !== this.flags.compress, "function" == typeof o[o.length - 1]) { + var h = this.ids++, + f = o.pop(); + this.ht(h, f), u.id = h; + } + var c = null === (i = null === (n = this.io.engine) || void 0 === n ? void 0 : n.transport) || void 0 === i ? void 0 : i.writable, + a = this.connected && !(null === (r = this.io.engine) || void 0 === r ? void 0 : r.W()); + return this.flags.volatile && !c || (a ? (this.notifyOutgoingListeners(u), this.packet(u)) : this.sendBuffer.push(u)), this.flags = {}, this; + }, o.ht = function (t, n) { + var i, + r = this, + e = null !== (i = this.flags.timeout) && void 0 !== i ? i : this.l.ackTimeout; + if (void 0 !== e) { + var o = this.io.setTimeoutFn(function () { + delete r.acks[t]; + for (var i = 0; i < r.sendBuffer.length; i++) r.sendBuffer[i].id === t && r.sendBuffer.splice(i, 1); + n.call(r, new Error("operation has timed out")); + }, e), + s = function s() { + r.io.clearTimeoutFn(o); + for (var t = arguments.length, i = new Array(t), e = 0; e < t; e++) i[e] = arguments[e]; + n.apply(r, i); + }; + s.withError = !0, this.acks[t] = s; + } else this.acks[t] = n; + }, o.emitWithAck = function (t) { + for (var n = this, i = arguments.length, r = new Array(i > 1 ? i - 1 : 0), e = 1; e < i; e++) r[e - 1] = arguments[e]; + return new Promise(function (i, e) { + var o = function o(t, n) { + return t ? e(t) : i(n); + }; + o.withError = !0, r.push(o), n.emit.apply(n, [t].concat(r)); + }); + }, o.ut = function (t) { + var n, + i = this; + "function" == typeof t[t.length - 1] && (n = t.pop()); + var r = { + id: this.rt++, + tryCount: 0, + pending: !1, + args: t, + flags: e({ + fromQueue: !0 + }, this.flags) + }; + t.push(function (t) { + if (r === i.it[0]) { + if (null !== t) r.tryCount > i.l.retries && (i.it.shift(), n && n(t));else if (i.it.shift(), n) { + for (var e = arguments.length, o = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++) o[s - 1] = arguments[s]; + n.apply(void 0, [null].concat(o)); + } + return r.pending = !1, i.ft(); + } + }), this.it.push(r), this.ft(); + }, o.ft = function () { + var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; + if (this.connected && 0 !== this.it.length) { + var n = this.it[0]; + n.pending && !t || (n.pending = !0, n.tryCount++, this.flags = n.flags, this.emit.apply(this, n.args)); + } + }, o.packet = function (t) { + t.nsp = this.nsp, this.io.ct(t); + }, o.onopen = function () { + var t = this; + "function" == typeof this.auth ? this.auth(function (n) { + t.vt(n); + }) : this.vt(this.auth); + }, o.vt = function (t) { + this.packet({ + type: Bt.CONNECT, + data: this.lt ? e({ + pid: this.lt, + offset: this.dt + }, t) : t + }); + }, o.onerror = function (t) { + this.connected || this.emitReserved("connect_error", t); + }, o.onclose = function (t, n) { + this.connected = !1, delete this.id, this.emitReserved("disconnect", t, n), this.yt(); + }, o.yt = function () { + var t = this; + Object.keys(this.acks).forEach(function (n) { + if (!t.sendBuffer.some(function (t) { + return String(t.id) === n; + })) { + var i = t.acks[n]; + delete t.acks[n], i.withError && i.call(t, new Error("socket has been disconnected")); + } + }); + }, o.onpacket = function (t) { + if (t.nsp === this.nsp) switch (t.type) { + case Bt.CONNECT: + t.data && t.data.sid ? this.onconnect(t.data.sid, t.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)")); + break; + case Bt.EVENT: + case Bt.BINARY_EVENT: + this.onevent(t); + break; + case Bt.ACK: + case Bt.BINARY_ACK: + this.onack(t); + break; + case Bt.DISCONNECT: + this.ondisconnect(); + break; + case Bt.CONNECT_ERROR: + this.destroy(); + var n = new Error(t.data.message); + n.data = t.data.data, this.emitReserved("connect_error", n); + } + }, o.onevent = function (t) { + var n = t.data || []; + null != t.id && n.push(this.ack(t.id)), this.connected ? this.emitEvent(n) : this.receiveBuffer.push(Object.freeze(n)); + }, o.emitEvent = function (n) { + if (this.bt && this.bt.length) { + var i, + e = r(this.bt.slice()); + try { + for (e.s(); !(i = e.n()).done;) { + i.value.apply(this, n); + } + } catch (t) { + e.e(t); + } finally { + e.f(); + } + } + t.prototype.emit.apply(this, n), this.lt && n.length && "string" == typeof n[n.length - 1] && (this.dt = n[n.length - 1]); + }, o.ack = function (t) { + var n = this, + i = !1; + return function () { + if (!i) { + i = !0; + for (var r = arguments.length, e = new Array(r), o = 0; o < r; o++) e[o] = arguments[o]; + n.packet({ + type: Bt.ACK, + id: t, + data: e + }); + } + }; + }, o.onack = function (t) { + var n = this.acks[t.id]; + "function" == typeof n && (delete this.acks[t.id], n.withError && t.data.unshift(null), n.apply(this, t.data)); + }, o.onconnect = function (t, n) { + this.id = t, this.recovered = n && this.lt === n, this.lt = n, this.connected = !0, this.emitBuffered(), this.emitReserved("connect"), this.ft(!0); + }, o.emitBuffered = function () { + var t = this; + this.receiveBuffer.forEach(function (n) { + return t.emitEvent(n); + }), this.receiveBuffer = [], this.sendBuffer.forEach(function (n) { + t.notifyOutgoingListeners(n), t.packet(n); + }), this.sendBuffer = []; + }, o.ondisconnect = function () { + this.destroy(), this.onclose("io server disconnect"); + }, o.destroy = function () { + this.subs && (this.subs.forEach(function (t) { + return t(); + }), this.subs = void 0), this.io.wt(this); + }, o.disconnect = function () { + return this.connected && this.packet({ + type: Bt.DISCONNECT + }), this.destroy(), this.connected && this.onclose("io client disconnect"), this; + }, o.close = function () { + return this.disconnect(); + }, o.compress = function (t) { + return this.flags.compress = t, this; + }, o.timeout = function (t) { + return this.flags.timeout = t, this; + }, o.onAny = function (t) { + return this.bt = this.bt || [], this.bt.push(t), this; + }, o.prependAny = function (t) { + return this.bt = this.bt || [], this.bt.unshift(t), this; + }, o.offAny = function (t) { + if (!this.bt) return this; + if (t) { + for (var n = this.bt, i = 0; i < n.length; i++) if (t === n[i]) return n.splice(i, 1), this; + } else this.bt = []; + return this; + }, o.listenersAny = function () { + return this.bt || []; + }, o.onAnyOutgoing = function (t) { + return this.gt = this.gt || [], this.gt.push(t), this; + }, o.prependAnyOutgoing = function (t) { + return this.gt = this.gt || [], this.gt.unshift(t), this; + }, o.offAnyOutgoing = function (t) { + if (!this.gt) return this; + if (t) { + for (var n = this.gt, i = 0; i < n.length; i++) if (t === n[i]) return n.splice(i, 1), this; + } else this.gt = []; + return this; + }, o.listenersAnyOutgoing = function () { + return this.gt || []; + }, o.notifyOutgoingListeners = function (t) { + if (this.gt && this.gt.length) { + var n, + i = r(this.gt.slice()); + try { + for (i.s(); !(n = i.n()).done;) { + n.value.apply(this, t.data); + } + } catch (t) { + i.e(t); + } finally { + i.f(); + } + } + }, i(n, [{ + key: "disconnected", + get: function get() { + return !this.connected; + } + }, { + key: "active", + get: function get() { + return !!this.subs; + } + }, { + key: "volatile", + get: function get() { + return this.flags.volatile = !0, this; + } + }]); + }(I); + function _t(t) { + 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; + } + _t.prototype.duration = function () { + var t = this.ms * Math.pow(this.factor, this.attempts++); + if (this.jitter) { + var n = Math.random(), + i = Math.floor(n * this.jitter * t); + t = 1 & Math.floor(10 * n) ? t + i : t - i; + } + return 0 | Math.min(t, this.max); + }, _t.prototype.reset = function () { + this.attempts = 0; + }, _t.prototype.setMin = function (t) { + this.ms = t; + }, _t.prototype.setMax = function (t) { + this.max = t; + }, _t.prototype.setJitter = function (t) { + this.jitter = t; + }; + var Dt = function (t) { + function n(n, i) { + var r, e; + (r = t.call(this) || this).nsps = {}, r.subs = [], n && "object" === c(n) && (i = n, n = void 0), (i = i || {}).path = i.path || "/socket.io", r.opts = i, $(r, i), r.reconnection(!1 !== i.reconnection), r.reconnectionAttempts(i.reconnectionAttempts || 1 / 0), r.reconnectionDelay(i.reconnectionDelay || 1e3), r.reconnectionDelayMax(i.reconnectionDelayMax || 5e3), r.randomizationFactor(null !== (e = i.randomizationFactor) && void 0 !== e ? e : .5), r.backoff = new _t({ + min: r.reconnectionDelay(), + max: r.reconnectionDelayMax(), + jitter: r.randomizationFactor() + }), r.timeout(null == i.timeout ? 2e4 : i.timeout), r.st = "closed", r.uri = n; + var o = i.parser || xt; + return r.encoder = new o.Encoder(), r.decoder = new o.Decoder(), r.et = !1 !== i.autoConnect, r.et && r.open(), r; + } + s(n, t); + var i = n.prototype; + return i.reconnection = function (t) { + return arguments.length ? (this.kt = !!t, t || (this.skipReconnect = !0), this) : this.kt; + }, i.reconnectionAttempts = function (t) { + return void 0 === t ? this.At : (this.At = t, this); + }, i.reconnectionDelay = function (t) { + var n; + return void 0 === t ? this.jt : (this.jt = t, null === (n = this.backoff) || void 0 === n || n.setMin(t), this); + }, i.randomizationFactor = function (t) { + var n; + return void 0 === t ? this.Et : (this.Et = t, null === (n = this.backoff) || void 0 === n || n.setJitter(t), this); + }, i.reconnectionDelayMax = function (t) { + var n; + return void 0 === t ? this.Ot : (this.Ot = t, null === (n = this.backoff) || void 0 === n || n.setMax(t), this); + }, i.timeout = function (t) { + return arguments.length ? (this.Bt = t, this) : this.Bt; + }, i.maybeReconnectOnOpen = function () { + !this.ot && this.kt && 0 === this.backoff.attempts && this.reconnect(); + }, i.open = function (t) { + var n = this; + if (~this.st.indexOf("open")) return this; + this.engine = new pt(this.uri, this.opts); + var i = this.engine, + r = this; + this.st = "opening", this.skipReconnect = !1; + var e = It(i, "open", function () { + r.onopen(), t && t(); + }), + o = function o(i) { + n.cleanup(), n.st = "closed", n.emitReserved("error", i), t ? t(i) : n.maybeReconnectOnOpen(); + }, + s = It(i, "error", o); + if (!1 !== this.Bt) { + var u = this.Bt, + h = this.setTimeoutFn(function () { + e(), o(new Error("timeout")), i.close(); + }, u); + this.opts.autoUnref && h.unref(), this.subs.push(function () { + n.clearTimeoutFn(h); + }); + } + return this.subs.push(e), this.subs.push(s), this; + }, i.connect = function (t) { + return this.open(t); + }, i.onopen = function () { + this.cleanup(), this.st = "open", this.emitReserved("open"); + var t = this.engine; + this.subs.push(It(t, "ping", this.onping.bind(this)), It(t, "data", this.ondata.bind(this)), It(t, "error", this.onerror.bind(this)), It(t, "close", this.onclose.bind(this)), It(this.decoder, "decoded", this.ondecoded.bind(this))); + }, i.onping = function () { + this.emitReserved("ping"); + }, i.ondata = function (t) { + try { + this.decoder.add(t); + } catch (t) { + this.onclose("parse error", t); + } + }, i.ondecoded = function (t) { + var n = this; + R(function () { + n.emitReserved("packet", t); + }, this.setTimeoutFn); + }, i.onerror = function (t) { + this.emitReserved("error", t); + }, i.socket = function (t, n) { + var i = this.nsps[t]; + return i ? this.et && !i.active && i.connect() : (i = new Lt(this, t, n), this.nsps[t] = i), i; + }, i.wt = function (t) { + for (var n = 0, i = Object.keys(this.nsps); n < i.length; n++) { + var r = i[n]; + if (this.nsps[r].active) return; + } + this.St(); + }, i.ct = function (t) { + for (var n = this.encoder.encode(t), i = 0; i < n.length; i++) this.engine.write(n[i], t.options); + }, i.cleanup = function () { + this.subs.forEach(function (t) { + return t(); + }), this.subs.length = 0, this.decoder.destroy(); + }, i.St = function () { + this.skipReconnect = !0, this.ot = !1, this.onclose("forced close"); + }, i.disconnect = function () { + return this.St(); + }, i.onclose = function (t, n) { + var i; + this.cleanup(), null === (i = this.engine) || void 0 === i || i.close(), this.backoff.reset(), this.st = "closed", this.emitReserved("close", t, n), this.kt && !this.skipReconnect && this.reconnect(); + }, i.reconnect = function () { + var t = this; + if (this.ot || this.skipReconnect) return this; + var n = this; + if (this.backoff.attempts >= this.At) this.backoff.reset(), this.emitReserved("reconnect_failed"), this.ot = !1;else { + var i = this.backoff.duration(); + this.ot = !0; + var r = this.setTimeoutFn(function () { + n.skipReconnect || (t.emitReserved("reconnect_attempt", n.backoff.attempts), n.skipReconnect || n.open(function (i) { + i ? (n.ot = !1, n.reconnect(), t.emitReserved("reconnect_error", i)) : n.onreconnect(); + })); + }, i); + this.opts.autoUnref && r.unref(), this.subs.push(function () { + t.clearTimeoutFn(r); + }); + } + }, i.onreconnect = function () { + var t = this.backoff.attempts; + this.ot = !1, this.backoff.reset(), this.emitReserved("reconnect", t); + }, n; + }(I), + Pt = {}; + function $t(t, n) { + "object" === c(t) && (n = t, t = void 0); + var i, + r = function (t) { + var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "", + i = arguments.length > 2 ? arguments[2] : void 0, + r = t; + i = i || "undefined" != typeof location && location, null == t && (t = i.protocol + "//" + i.host), "string" == typeof t && ("/" === t.charAt(0) && (t = "/" === t.charAt(1) ? i.protocol + t : i.host + t), /^(https?|wss?):\/\//.test(t) || (t = void 0 !== i ? i.protocol + "//" + t : "https://" + t), r = ft(t)), r.port || (/^(http|ws)$/.test(r.protocol) ? r.port = "80" : /^(http|ws)s$/.test(r.protocol) && (r.port = "443")), r.path = r.path || "/"; + var e = -1 !== r.host.indexOf(":") ? "[" + r.host + "]" : r.host; + return r.id = r.protocol + "://" + e + ":" + r.port + n, r.href = r.protocol + "://" + e + (i && i.port === r.port ? "" : ":" + r.port), r; + }(t, (n = n || {}).path || "/socket.io"), + e = r.source, + o = r.id, + s = r.path, + u = Pt[o] && s in Pt[o].nsps; + return n.forceNew || n["force new connection"] || !1 === n.multiplex || u ? i = new Dt(e, n) : (Pt[o] || (Pt[o] = new Dt(e, n)), i = Pt[o]), r.query && !n.query && (n.query = r.queryKey), i.socket(r.path, n); + } + return e($t, { + Manager: Dt, + Socket: Lt, + io: $t, + connect: $t + }), $t; +}); + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js": +/*!*************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _arrayLikeToArray) +/* harmony export */ }); +function _arrayLikeToArray(r, a) { + (null == a || a > r.length) && (a = r.length); + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; + return n; +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js": +/*!***********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _arrayWithHoles) +/* harmony export */ }); +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js": +/*!**************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _arrayWithoutHoles) +/* harmony export */ }); +/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js"); + +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js": +/*!******************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _assertThisInitialized) +/* harmony export */ }); +function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js": +/*!***********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _classCallCheck) +/* harmony export */ }); +function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/createClass.js": +/*!********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/createClass.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _createClass) +/* harmony export */ }); +/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"); + +function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(o.key), o); + } +} +function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js": +/*!***********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _defineProperty) +/* harmony export */ }); +/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"); + +function _defineProperty(e, r, t) { + return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/extends.js": +/*!****************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/extends.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _extends) +/* harmony export */ }); +function _extends() { + return _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); + } + return n; + }, _extends.apply(null, arguments); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js": +/*!***********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _getPrototypeOf) +/* harmony export */ }); +function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/inherits.js": +/*!*****************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/inherits.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _inherits) +/* harmony export */ }); +/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); + +function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t, e); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js": +/*!************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _iterableToArray) +/* harmony export */ }); +function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js": +/*!*****************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _iterableToArrayLimit) +/* harmony export */ }); +function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js": +/*!************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _nonIterableRest) +/* harmony export */ }); +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js": +/*!**************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _nonIterableSpread) +/* harmony export */ }); +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."); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js": +/*!*********************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _objectDestructuringEmpty) +/* harmony export */ }); +function _objectDestructuringEmpty(t) { + if (null == t) throw new TypeError("Cannot destructure " + t); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js": +/*!********************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _objectWithoutProperties) +/* harmony export */ }); +/* harmony import */ var _objectWithoutPropertiesLoose_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./objectWithoutPropertiesLoose.js */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js"); + +function _objectWithoutProperties(e, t) { + if (null == e) return {}; + var o, + r, + i = (0,_objectWithoutPropertiesLoose_js__WEBPACK_IMPORTED_MODULE_0__["default"])(e, t); + if (Object.getOwnPropertySymbols) { + var n = Object.getOwnPropertySymbols(e); + for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); + } + return i; +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js": +/*!*************************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _objectWithoutPropertiesLoose) +/* harmony export */ }); +function _objectWithoutPropertiesLoose(r, e) { + if (null == r) return {}; + var t = {}; + for (var n in r) if ({}.hasOwnProperty.call(r, n)) { + if (-1 !== e.indexOf(n)) continue; + t[n] = r[n]; + } + return t; +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js": +/*!**********************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _possibleConstructorReturn) +/* harmony export */ }); +/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "../../node_modules/@babel/runtime/helpers/esm/typeof.js"); +/* harmony import */ var _assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized.js */ "../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js"); + + +function _possibleConstructorReturn(t, e) { + if (e && ("object" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(e) || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return (0,_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js": +/*!***********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _setPrototypeOf) +/* harmony export */ }); +function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js": +/*!**********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _slicedToArray) +/* harmony export */ }); +/* harmony import */ var _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithHoles.js */ "../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js"); +/* harmony import */ var _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArrayLimit.js */ "../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js"); +/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js"); +/* harmony import */ var _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableRest.js */ "../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js"); + + + + +function _slicedToArray(r, e) { + return (0,_arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r, e) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r, e) || (0,_nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__["default"])(); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js": +/*!**************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _toConsumableArray) +/* harmony export */ }); +/* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithoutHoles.js */ "../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js"); +/* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArray.js */ "../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js"); +/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js"); +/* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableSpread.js */ "../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js"); + + + + +function _toConsumableArray(r) { + return (0,_arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r) || (0,_nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__["default"])(); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js": +/*!********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ toPrimitive) +/* harmony export */ }); +/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "../../node_modules/@babel/runtime/helpers/esm/typeof.js"); + +function toPrimitive(t, r) { + if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js": +/*!**********************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ toPropertyKey) +/* harmony export */ }); +/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "../../node_modules/@babel/runtime/helpers/esm/typeof.js"); +/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js"); + + +function toPropertyKey(t) { + var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string"); + return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + ""; +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/typeof.js": +/*!***************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/typeof.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _typeof) +/* harmony export */ }); +function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); +} + + +/***/ }), + +/***/ "../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js": +/*!***********************************************************************************!*\ + !*** ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _unsupportedIterableToArray) +/* harmony export */ }); +/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js"); + +function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a); + var t = {}.toString.call(r).slice(8, -1); + return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a) : void 0; + } +} + + +/***/ }), + +/***/ "../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs": +/*!**********************************************************************!*\ + !*** ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ arrow: () => (/* binding */ arrow), +/* harmony export */ autoPlacement: () => (/* binding */ autoPlacement), +/* harmony export */ computePosition: () => (/* binding */ computePosition), +/* harmony export */ detectOverflow: () => (/* binding */ detectOverflow), +/* harmony export */ flip: () => (/* binding */ flip), +/* harmony export */ hide: () => (/* binding */ hide), +/* harmony export */ inline: () => (/* binding */ inline), +/* harmony export */ limitShift: () => (/* binding */ limitShift), +/* harmony export */ offset: () => (/* binding */ offset), +/* harmony export */ rectToClientRect: () => (/* reexport safe */ _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect), +/* harmony export */ shift: () => (/* binding */ shift), +/* harmony export */ size: () => (/* binding */ size) +/* harmony export */ }); +/* harmony import */ var _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @floating-ui/utils */ "../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs"); + + + +function computeCoordsFromPlacement(_ref, placement, rtl) { + let { + reference, + floating + } = _ref; + const sideAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement); + const alignmentAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignmentAxis)(placement); + const alignLength = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAxisLength)(alignmentAxis); + const side = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement); + const isVertical = sideAxis === 'y'; + const commonX = reference.x + reference.width / 2 - floating.width / 2; + const commonY = reference.y + reference.height / 2 - floating.height / 2; + const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; + let coords; + switch (side) { + case 'top': + coords = { + x: commonX, + y: reference.y - floating.height + }; + break; + case 'bottom': + coords = { + x: commonX, + y: reference.y + reference.height + }; + break; + case 'right': + coords = { + x: reference.x + reference.width, + y: commonY + }; + break; + case 'left': + coords = { + x: reference.x - floating.width, + y: commonY + }; + break; + default: + coords = { + x: reference.x, + y: reference.y + }; + } + switch ((0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement)) { + case 'start': + coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); + break; + case 'end': + coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); + break; + } + return coords; +} + +/** + * Computes the `x` and `y` coordinates that will place the floating element + * next to a given reference element. + * + * This export does not have any `platform` interface logic. You will need to + * write one for the platform you are using Floating UI with. + */ +const computePosition = async (reference, floating, config) => { + const { + placement = 'bottom', + strategy = 'absolute', + middleware = [], + platform + } = config; + const validMiddleware = middleware.filter(Boolean); + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); + let rects = await platform.getElementRects({ + reference, + floating, + strategy + }); + let { + x, + y + } = computeCoordsFromPlacement(rects, placement, rtl); + let statefulPlacement = placement; + let middlewareData = {}; + let resetCount = 0; + for (let i = 0; i < validMiddleware.length; i++) { + const { + name, + fn + } = validMiddleware[i]; + const { + x: nextX, + y: nextY, + data, + reset + } = await fn({ + x, + y, + initialPlacement: placement, + placement: statefulPlacement, + strategy, + middlewareData, + rects, + platform, + elements: { + reference, + floating + } + }); + x = nextX != null ? nextX : x; + y = nextY != null ? nextY : y; + middlewareData = { + ...middlewareData, + [name]: { + ...middlewareData[name], + ...data + } + }; + if (reset && resetCount <= 50) { + resetCount++; + if (typeof reset === 'object') { + if (reset.placement) { + statefulPlacement = reset.placement; + } + if (reset.rects) { + rects = reset.rects === true ? await platform.getElementRects({ + reference, + floating, + strategy + }) : reset.rects; + } + ({ + x, + y + } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); + } + i = -1; + } + } + return { + x, + y, + placement: statefulPlacement, + strategy, + middlewareData + }; +}; + +/** + * Resolves with an object of overflow side offsets that determine how much the + * element is overflowing a given clipping boundary on each side. + * - positive = overflowing the boundary by that number of pixels + * - negative = how many pixels left before it will overflow + * - 0 = lies flush with the boundary + * @see https://floating-ui.com/docs/detectOverflow + */ +async function detectOverflow(state, options) { + var _await$platform$isEle; + if (options === void 0) { + options = {}; + } + const { + x, + y, + platform, + rects, + elements, + strategy + } = state; + const { + boundary = 'clippingAncestors', + rootBoundary = 'viewport', + elementContext = 'floating', + altBoundary = false, + padding = 0 + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + const paddingObject = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getPaddingObject)(padding); + const altContext = elementContext === 'floating' ? 'reference' : 'floating'; + const element = elements[altBoundary ? altContext : elementContext]; + const clippingClientRect = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(await platform.getClippingRect({ + element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))), + boundary, + rootBoundary, + strategy + })); + const rect = elementContext === 'floating' ? { + x, + y, + width: rects.floating.width, + height: rects.floating.height + } : rects.reference; + const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)); + const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || { + x: 1, + y: 1 + } : { + x: 1, + y: 1 + }; + const elementClientRect = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({ + elements, + rect, + offsetParent, + strategy + }) : rect); + return { + top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, + bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, + left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, + right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x + }; +} + +/** + * Provides data to position an inner element of the floating element so that it + * appears centered to the reference element. + * @see https://floating-ui.com/docs/arrow + */ +const arrow = options => ({ + name: 'arrow', + options, + async fn(state) { + const { + x, + y, + placement, + rects, + platform, + elements, + middlewareData + } = state; + // Since `element` is required, we don't Partial<> the type. + const { + element, + padding = 0 + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state) || {}; + if (element == null) { + return {}; + } + const paddingObject = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getPaddingObject)(padding); + const coords = { + x, + y + }; + const axis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignmentAxis)(placement); + const length = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAxisLength)(axis); + const arrowDimensions = await platform.getDimensions(element); + const isYAxis = axis === 'y'; + const minProp = isYAxis ? 'top' : 'left'; + const maxProp = isYAxis ? 'bottom' : 'right'; + const clientProp = isYAxis ? 'clientHeight' : 'clientWidth'; + const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; + const startDiff = coords[axis] - rects.reference[axis]; + const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); + let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; + + // DOM platform can return `window` as the `offsetParent`. + if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) { + clientSize = elements.floating[clientProp] || rects.floating[length]; + } + const centerToReference = endDiff / 2 - startDiff / 2; + + // If the padding is large enough that it causes the arrow to no longer be + // centered, modify the padding so that it is centered. + const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; + const minPadding = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(paddingObject[minProp], largestPossiblePadding); + const maxPadding = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(paddingObject[maxProp], largestPossiblePadding); + + // Make sure the arrow doesn't overflow the floating element if the center + // point is outside the floating element's bounds. + const min$1 = minPadding; + const max = clientSize - arrowDimensions[length] - maxPadding; + const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; + const offset = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.clamp)(min$1, center, max); + + // If the reference is small enough that the arrow's padding causes it to + // to point to nothing for an aligned placement, adjust the offset of the + // floating element itself. To ensure `shift()` continues to take action, + // a single reset is performed when this is true. + const shouldAddOffset = !middlewareData.arrow && (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; + const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0; + return { + [axis]: coords[axis] + alignmentOffset, + data: { + [axis]: offset, + centerOffset: center - offset - alignmentOffset, + ...(shouldAddOffset && { + alignmentOffset + }) + }, + reset: shouldAddOffset + }; + } +}); + +function getPlacementList(alignment, autoAlignment, allowedPlacements) { + const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement) === alignment), ...allowedPlacements.filter(placement => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement) !== alignment)] : allowedPlacements.filter(placement => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement) === placement); + return allowedPlacementsSortedByAlignment.filter(placement => { + if (alignment) { + return (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement) === alignment || (autoAlignment ? (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositeAlignmentPlacement)(placement) !== placement : false); + } + return true; + }); +} +/** + * Optimizes the visibility of the floating element by choosing the placement + * that has the most space available automatically, without needing to specify a + * preferred placement. Alternative to `flip`. + * @see https://floating-ui.com/docs/autoPlacement + */ +const autoPlacement = function (options) { + if (options === void 0) { + options = {}; + } + return { + name: 'autoPlacement', + options, + async fn(state) { + var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE; + const { + rects, + middlewareData, + placement, + platform, + elements + } = state; + const { + crossAxis = false, + alignment, + allowedPlacements = _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.placements, + autoAlignment = true, + ...detectOverflowOptions + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + const placements$1 = alignment !== undefined || allowedPlacements === _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements; + const overflow = await detectOverflow(state, detectOverflowOptions); + const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0; + const currentPlacement = placements$1[currentIndex]; + if (currentPlacement == null) { + return {}; + } + const alignmentSides = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignmentSides)(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); + + // Make `computeCoords` start from the right place. + if (placement !== currentPlacement) { + return { + reset: { + placement: placements$1[0] + } + }; + } + const currentOverflows = [overflow[(0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]]; + const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), { + placement: currentPlacement, + overflows: currentOverflows + }]; + const nextPlacement = placements$1[currentIndex + 1]; + + // There are more placements to check. + if (nextPlacement) { + return { + data: { + index: currentIndex + 1, + overflows: allOverflows + }, + reset: { + placement: nextPlacement + } + }; + } + const placementsSortedByMostSpace = allOverflows.map(d => { + const alignment = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(d.placement); + return [d.placement, alignment && crossAxis ? + // Check along the mainAxis and main crossAxis side. + d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) : + // Check only the mainAxis. + d.overflows[0], d.overflows]; + }).sort((a, b) => a[1] - b[1]); + const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0, + // Aligned placements should not check their opposite crossAxis + // side. + (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(d[0]) ? 2 : 3).every(v => v <= 0)); + const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0]; + if (resetPlacement !== placement) { + return { + data: { + index: currentIndex + 1, + overflows: allOverflows + }, + reset: { + placement: resetPlacement + } + }; + } + return {}; + } + }; +}; + +/** + * Optimizes the visibility of the floating element by flipping the `placement` + * in order to keep it in view when the preferred placement(s) will overflow the + * clipping boundary. Alternative to `autoPlacement`. + * @see https://floating-ui.com/docs/flip + */ +const flip = function (options) { + if (options === void 0) { + options = {}; + } + return { + name: 'flip', + options, + async fn(state) { + var _middlewareData$arrow, _middlewareData$flip; + const { + placement, + middlewareData, + rects, + initialPlacement, + platform, + elements + } = state; + const { + mainAxis: checkMainAxis = true, + crossAxis: checkCrossAxis = true, + fallbackPlacements: specifiedFallbackPlacements, + fallbackStrategy = 'bestFit', + fallbackAxisSideDirection = 'none', + flipAlignment = true, + ...detectOverflowOptions + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + + // If a reset by the arrow was caused due to an alignment offset being + // added, we should skip any logic now since `flip()` has already done its + // work. + // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643 + if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { + return {}; + } + const side = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement); + const initialSideAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(initialPlacement); + const isBasePlacement = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(initialPlacement) === initialPlacement; + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); + const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [(0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositePlacement)(initialPlacement)] : (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getExpandedPlacements)(initialPlacement)); + const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none'; + if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { + fallbackPlacements.push(...(0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositeAxisPlacements)(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); + } + const placements = [initialPlacement, ...fallbackPlacements]; + const overflow = await detectOverflow(state, detectOverflowOptions); + const overflows = []; + let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; + if (checkMainAxis) { + overflows.push(overflow[side]); + } + if (checkCrossAxis) { + const sides = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignmentSides)(placement, rects, rtl); + overflows.push(overflow[sides[0]], overflow[sides[1]]); + } + overflowsData = [...overflowsData, { + placement, + overflows + }]; + + // One or more sides is overflowing. + if (!overflows.every(side => side <= 0)) { + var _middlewareData$flip2, _overflowsData$filter; + const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; + const nextPlacement = placements[nextIndex]; + if (nextPlacement) { + // Try next placement and re-run the lifecycle. + return { + data: { + index: nextIndex, + overflows: overflowsData + }, + reset: { + placement: nextPlacement + } + }; + } + + // First, find the candidates that fit on the mainAxis side of overflow, + // then find the placement that fits the best on the main crossAxis side. + let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; + + // Otherwise fallback. + if (!resetPlacement) { + switch (fallbackStrategy) { + case 'bestFit': + { + var _overflowsData$filter2; + const placement = (_overflowsData$filter2 = overflowsData.filter(d => { + if (hasFallbackAxisSideDirection) { + const currentSideAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(d.placement); + return currentSideAxis === initialSideAxis || + // Create a bias to the `y` side axis due to horizontal + // reading directions favoring greater width. + currentSideAxis === 'y'; + } + return true; + }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; + if (placement) { + resetPlacement = placement; + } + break; + } + case 'initialPlacement': + resetPlacement = initialPlacement; + break; + } + } + if (placement !== resetPlacement) { + return { + reset: { + placement: resetPlacement + } + }; + } + } + return {}; + } + }; +}; + +function getSideOffsets(overflow, rect) { + return { + top: overflow.top - rect.height, + right: overflow.right - rect.width, + bottom: overflow.bottom - rect.height, + left: overflow.left - rect.width + }; +} +function isAnySideFullyClipped(overflow) { + return _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.sides.some(side => overflow[side] >= 0); +} +/** + * Provides data to hide the floating element in applicable situations, such as + * when it is not in the same clipping context as the reference element. + * @see https://floating-ui.com/docs/hide + */ +const hide = function (options) { + if (options === void 0) { + options = {}; + } + return { + name: 'hide', + options, + async fn(state) { + const { + rects + } = state; + const { + strategy = 'referenceHidden', + ...detectOverflowOptions + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + switch (strategy) { + case 'referenceHidden': + { + const overflow = await detectOverflow(state, { + ...detectOverflowOptions, + elementContext: 'reference' + }); + const offsets = getSideOffsets(overflow, rects.reference); + return { + data: { + referenceHiddenOffsets: offsets, + referenceHidden: isAnySideFullyClipped(offsets) + } + }; + } + case 'escaped': + { + const overflow = await detectOverflow(state, { + ...detectOverflowOptions, + altBoundary: true + }); + const offsets = getSideOffsets(overflow, rects.floating); + return { + data: { + escapedOffsets: offsets, + escaped: isAnySideFullyClipped(offsets) + } + }; + } + default: + { + return {}; + } + } + } + }; +}; + +function getBoundingRect(rects) { + const minX = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(...rects.map(rect => rect.left)); + const minY = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(...rects.map(rect => rect.top)); + const maxX = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(...rects.map(rect => rect.right)); + const maxY = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(...rects.map(rect => rect.bottom)); + return { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY + }; +} +function getRectsByLine(rects) { + const sortedRects = rects.slice().sort((a, b) => a.y - b.y); + const groups = []; + let prevRect = null; + for (let i = 0; i < sortedRects.length; i++) { + const rect = sortedRects[i]; + if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) { + groups.push([rect]); + } else { + groups[groups.length - 1].push(rect); + } + prevRect = rect; + } + return groups.map(rect => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(getBoundingRect(rect))); +} +/** + * Provides improved positioning for inline reference elements that can span + * over multiple lines, such as hyperlinks or range selections. + * @see https://floating-ui.com/docs/inline + */ +const inline = function (options) { + if (options === void 0) { + options = {}; + } + return { + name: 'inline', + options, + async fn(state) { + const { + placement, + elements, + rects, + platform, + strategy + } = state; + // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a + // ClientRect's bounds, despite the event listener being triggered. A + // padding of 2 seems to handle this issue. + const { + padding = 2, + x, + y + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []); + const clientRects = getRectsByLine(nativeClientRects); + const fallback = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(getBoundingRect(nativeClientRects)); + const paddingObject = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getPaddingObject)(padding); + function getBoundingClientRect() { + // There are two rects and they are disjoined. + if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) { + // Find the first rect in which the point is fully inside. + return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback; + } + + // There are 2 or more connected rects. + if (clientRects.length >= 2) { + if ((0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement) === 'y') { + const firstRect = clientRects[0]; + const lastRect = clientRects[clientRects.length - 1]; + const isTop = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement) === 'top'; + const top = firstRect.top; + const bottom = lastRect.bottom; + const left = isTop ? firstRect.left : lastRect.left; + const right = isTop ? firstRect.right : lastRect.right; + const width = right - left; + const height = bottom - top; + return { + top, + bottom, + left, + right, + width, + height, + x: left, + y: top + }; + } + const isLeftSide = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement) === 'left'; + const maxRight = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(...clientRects.map(rect => rect.right)); + const minLeft = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(...clientRects.map(rect => rect.left)); + const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight); + const top = measureRects[0].top; + const bottom = measureRects[measureRects.length - 1].bottom; + const left = minLeft; + const right = maxRight; + const width = right - left; + const height = bottom - top; + return { + top, + bottom, + left, + right, + width, + height, + x: left, + y: top + }; + } + return fallback; + } + const resetRects = await platform.getElementRects({ + reference: { + getBoundingClientRect + }, + floating: elements.floating, + strategy + }); + if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) { + return { + reset: { + rects: resetRects + } + }; + } + return {}; + } + }; +}; + +// For type backwards-compatibility, the `OffsetOptions` type was also +// Derivable. + +async function convertValueToCoords(state, options) { + const { + placement, + platform, + elements + } = state; + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); + const side = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement); + const alignment = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement); + const isVertical = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement) === 'y'; + const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1; + const crossAxisMulti = rtl && isVertical ? -1 : 1; + const rawValue = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + + // eslint-disable-next-line prefer-const + let { + mainAxis, + crossAxis, + alignmentAxis + } = typeof rawValue === 'number' ? { + mainAxis: rawValue, + crossAxis: 0, + alignmentAxis: null + } : { + mainAxis: rawValue.mainAxis || 0, + crossAxis: rawValue.crossAxis || 0, + alignmentAxis: rawValue.alignmentAxis + }; + if (alignment && typeof alignmentAxis === 'number') { + crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis; + } + return isVertical ? { + x: crossAxis * crossAxisMulti, + y: mainAxis * mainAxisMulti + } : { + x: mainAxis * mainAxisMulti, + y: crossAxis * crossAxisMulti + }; +} + +/** + * Modifies the placement by translating the floating element along the + * specified axes. + * A number (shorthand for `mainAxis` or distance), or an axes configuration + * object may be passed. + * @see https://floating-ui.com/docs/offset + */ +const offset = function (options) { + if (options === void 0) { + options = 0; + } + return { + name: 'offset', + options, + async fn(state) { + var _middlewareData$offse, _middlewareData$arrow; + const { + x, + y, + placement, + middlewareData + } = state; + const diffCoords = await convertValueToCoords(state, options); + + // If the placement is the same and the arrow caused an alignment offset + // then we don't need to change the positioning coordinates. + if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { + return {}; + } + return { + x: x + diffCoords.x, + y: y + diffCoords.y, + data: { + ...diffCoords, + placement + } + }; + } + }; +}; + +/** + * Optimizes the visibility of the floating element by shifting it in order to + * keep it in view when it will overflow the clipping boundary. + * @see https://floating-ui.com/docs/shift + */ +const shift = function (options) { + if (options === void 0) { + options = {}; + } + return { + name: 'shift', + options, + async fn(state) { + const { + x, + y, + placement + } = state; + const { + mainAxis: checkMainAxis = true, + crossAxis: checkCrossAxis = false, + limiter = { + fn: _ref => { + let { + x, + y + } = _ref; + return { + x, + y + }; + } + }, + ...detectOverflowOptions + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + const coords = { + x, + y + }; + const overflow = await detectOverflow(state, detectOverflowOptions); + const crossAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)((0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement)); + const mainAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositeAxis)(crossAxis); + let mainAxisCoord = coords[mainAxis]; + let crossAxisCoord = coords[crossAxis]; + if (checkMainAxis) { + const minSide = mainAxis === 'y' ? 'top' : 'left'; + const maxSide = mainAxis === 'y' ? 'bottom' : 'right'; + const min = mainAxisCoord + overflow[minSide]; + const max = mainAxisCoord - overflow[maxSide]; + mainAxisCoord = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.clamp)(min, mainAxisCoord, max); + } + if (checkCrossAxis) { + const minSide = crossAxis === 'y' ? 'top' : 'left'; + const maxSide = crossAxis === 'y' ? 'bottom' : 'right'; + const min = crossAxisCoord + overflow[minSide]; + const max = crossAxisCoord - overflow[maxSide]; + crossAxisCoord = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.clamp)(min, crossAxisCoord, max); + } + const limitedCoords = limiter.fn({ + ...state, + [mainAxis]: mainAxisCoord, + [crossAxis]: crossAxisCoord + }); + return { + ...limitedCoords, + data: { + x: limitedCoords.x - x, + y: limitedCoords.y - y, + enabled: { + [mainAxis]: checkMainAxis, + [crossAxis]: checkCrossAxis + } + } + }; + } + }; +}; +/** + * Built-in `limiter` that will stop `shift()` at a certain point. + */ +const limitShift = function (options) { + if (options === void 0) { + options = {}; + } + return { + options, + fn(state) { + const { + x, + y, + placement, + rects, + middlewareData + } = state; + const { + offset = 0, + mainAxis: checkMainAxis = true, + crossAxis: checkCrossAxis = true + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + const coords = { + x, + y + }; + const crossAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement); + const mainAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositeAxis)(crossAxis); + let mainAxisCoord = coords[mainAxis]; + let crossAxisCoord = coords[crossAxis]; + const rawOffset = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(offset, state); + const computedOffset = typeof rawOffset === 'number' ? { + mainAxis: rawOffset, + crossAxis: 0 + } : { + mainAxis: 0, + crossAxis: 0, + ...rawOffset + }; + if (checkMainAxis) { + const len = mainAxis === 'y' ? 'height' : 'width'; + const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; + const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; + if (mainAxisCoord < limitMin) { + mainAxisCoord = limitMin; + } else if (mainAxisCoord > limitMax) { + mainAxisCoord = limitMax; + } + } + if (checkCrossAxis) { + var _middlewareData$offse, _middlewareData$offse2; + const len = mainAxis === 'y' ? 'width' : 'height'; + const isOriginSide = ['top', 'left'].includes((0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement)); + const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); + const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); + if (crossAxisCoord < limitMin) { + crossAxisCoord = limitMin; + } else if (crossAxisCoord > limitMax) { + crossAxisCoord = limitMax; + } + } + return { + [mainAxis]: mainAxisCoord, + [crossAxis]: crossAxisCoord + }; + } + }; +}; + +/** + * Provides data that allows you to change the size of the floating element — + * for instance, prevent it from overflowing the clipping boundary or match the + * width of the reference element. + * @see https://floating-ui.com/docs/size + */ +const size = function (options) { + if (options === void 0) { + options = {}; + } + return { + name: 'size', + options, + async fn(state) { + var _state$middlewareData, _state$middlewareData2; + const { + placement, + rects, + platform, + elements + } = state; + const { + apply = () => {}, + ...detectOverflowOptions + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); + const overflow = await detectOverflow(state, detectOverflowOptions); + const side = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement); + const alignment = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement); + const isYAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement) === 'y'; + const { + width, + height + } = rects.floating; + let heightSide; + let widthSide; + if (side === 'top' || side === 'bottom') { + heightSide = side; + widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right'; + } else { + widthSide = side; + heightSide = alignment === 'end' ? 'top' : 'bottom'; + } + const maximumClippingHeight = height - overflow.top - overflow.bottom; + const maximumClippingWidth = width - overflow.left - overflow.right; + const overflowAvailableHeight = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(height - overflow[heightSide], maximumClippingHeight); + const overflowAvailableWidth = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(width - overflow[widthSide], maximumClippingWidth); + const noShift = !state.middlewareData.shift; + let availableHeight = overflowAvailableHeight; + let availableWidth = overflowAvailableWidth; + if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { + availableWidth = maximumClippingWidth; + } + if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { + availableHeight = maximumClippingHeight; + } + if (noShift && !alignment) { + const xMin = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.left, 0); + const xMax = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.right, 0); + const yMin = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.top, 0); + const yMax = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.bottom, 0); + if (isYAxis) { + availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.left, overflow.right)); + } else { + availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.top, overflow.bottom)); + } + } + await apply({ + ...state, + availableWidth, + availableHeight + }); + const nextDimensions = await platform.getDimensions(elements.floating); + if (width !== nextDimensions.width || height !== nextDimensions.height) { + return { + reset: { + rects: true + } + }; + } + return {}; + } + }; +}; + + + + +/***/ }), + +/***/ "../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs": +/*!********************************************************************!*\ + !*** ../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ arrow: () => (/* binding */ arrow), +/* harmony export */ autoPlacement: () => (/* binding */ autoPlacement), +/* harmony export */ autoUpdate: () => (/* binding */ autoUpdate), +/* harmony export */ computePosition: () => (/* binding */ computePosition), +/* harmony export */ detectOverflow: () => (/* binding */ detectOverflow), +/* harmony export */ flip: () => (/* binding */ flip), +/* harmony export */ getOverflowAncestors: () => (/* reexport safe */ _floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getOverflowAncestors), +/* harmony export */ hide: () => (/* binding */ hide), +/* harmony export */ inline: () => (/* binding */ inline), +/* harmony export */ limitShift: () => (/* binding */ limitShift), +/* harmony export */ offset: () => (/* binding */ offset), +/* harmony export */ platform: () => (/* binding */ platform), +/* harmony export */ shift: () => (/* binding */ shift), +/* harmony export */ size: () => (/* binding */ size) +/* harmony export */ }); +/* harmony import */ var _floating_ui_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @floating-ui/utils */ "../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs"); +/* harmony import */ var _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @floating-ui/core */ "../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs"); +/* harmony import */ var _floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @floating-ui/utils/dom */ "../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs"); + + + + + +function getCssDimensions(element) { + const css = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element); + // In testing environments, the `width` and `height` properties are empty + // strings for SVG elements, returning NaN. Fallback to `0` in this case. + let width = parseFloat(css.width) || 0; + let height = parseFloat(css.height) || 0; + const hasOffset = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element); + const offsetWidth = hasOffset ? element.offsetWidth : width; + const offsetHeight = hasOffset ? element.offsetHeight : height; + const shouldFallback = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.round)(width) !== offsetWidth || (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.round)(height) !== offsetHeight; + if (shouldFallback) { + width = offsetWidth; + height = offsetHeight; + } + return { + width, + height, + $: shouldFallback + }; +} + +function unwrapElement(element) { + return !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(element) ? element.contextElement : element; +} + +function getScale(element) { + const domElement = unwrapElement(element); + if (!(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(domElement)) { + return (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(1); + } + const rect = domElement.getBoundingClientRect(); + const { + width, + height, + $ + } = getCssDimensions(domElement); + let x = ($ ? (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.round)(rect.width) : rect.width) / width; + let y = ($ ? (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.round)(rect.height) : rect.height) / height; + + // 0, NaN, or Infinity should always fallback to 1. + + if (!x || !Number.isFinite(x)) { + x = 1; + } + if (!y || !Number.isFinite(y)) { + y = 1; + } + return { + x, + y + }; +} + +const noOffsets = /*#__PURE__*/(0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); +function getVisualOffsets(element) { + const win = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element); + if (!(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isWebKit)() || !win.visualViewport) { + return noOffsets; + } + return { + x: win.visualViewport.offsetLeft, + y: win.visualViewport.offsetTop + }; +} +function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { + if (isFixed === void 0) { + isFixed = false; + } + if (!floatingOffsetParent || isFixed && floatingOffsetParent !== (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element)) { + return false; + } + return isFixed; +} + +function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { + if (includeScale === void 0) { + includeScale = false; + } + if (isFixedStrategy === void 0) { + isFixedStrategy = false; + } + const clientRect = element.getBoundingClientRect(); + const domElement = unwrapElement(element); + let scale = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(1); + if (includeScale) { + if (offsetParent) { + if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(offsetParent)) { + scale = getScale(offsetParent); + } + } else { + scale = getScale(element); + } + } + const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); + let x = (clientRect.left + visualOffsets.x) / scale.x; + let y = (clientRect.top + visualOffsets.y) / scale.y; + let width = clientRect.width / scale.x; + let height = clientRect.height / scale.y; + if (domElement) { + const win = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(domElement); + const offsetWin = offsetParent && (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(offsetParent) ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(offsetParent) : offsetParent; + let currentWin = win; + let currentIFrame = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getFrameElement)(currentWin); + while (currentIFrame && offsetParent && offsetWin !== currentWin) { + const iframeScale = getScale(currentIFrame); + const iframeRect = currentIFrame.getBoundingClientRect(); + const css = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(currentIFrame); + const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; + const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; + x *= iframeScale.x; + y *= iframeScale.y; + width *= iframeScale.x; + height *= iframeScale.y; + x += left; + y += top; + currentWin = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(currentIFrame); + currentIFrame = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getFrameElement)(currentWin); + } + } + return (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)({ + width, + height, + x, + y + }); +} + +// If has a CSS width greater than the viewport, then this will be +// incorrect for RTL. +function getWindowScrollBarX(element, rect) { + const leftScroll = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeScroll)(element).scrollLeft; + if (!rect) { + return getBoundingClientRect((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element)).left + leftScroll; + } + return rect.left + leftScroll; +} + +function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) { + if (ignoreScrollbarX === void 0) { + ignoreScrollbarX = false; + } + const htmlRect = documentElement.getBoundingClientRect(); + const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : + // RTL scrollbar. + getWindowScrollBarX(documentElement, htmlRect)); + const y = htmlRect.top + scroll.scrollTop; + return { + x, + y + }; +} + +function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { + let { + elements, + rect, + offsetParent, + strategy + } = _ref; + const isFixed = strategy === 'fixed'; + const documentElement = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(offsetParent); + const topLayer = elements ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isTopLayer)(elements.floating) : false; + if (offsetParent === documentElement || topLayer && isFixed) { + return rect; + } + let scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + let scale = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(1); + const offsets = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); + const isOffsetParentAnElement = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(offsetParent); + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeName)(offsetParent) !== 'body' || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isOverflowElement)(documentElement)) { + scroll = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeScroll)(offsetParent); + } + if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(offsetParent)) { + const offsetRect = getBoundingClientRect(offsetParent); + scale = getScale(offsetParent); + offsets.x = offsetRect.x + offsetParent.clientLeft; + offsets.y = offsetRect.y + offsetParent.clientTop; + } + } + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); + return { + width: rect.width * scale.x, + height: rect.height * scale.y, + x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, + y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y + }; +} + +function getClientRects(element) { + return Array.from(element.getClientRects()); +} + +// Gets the entire size of the scrollable document area, even extending outside +// of the `` and `` rect bounds if horizontally scrollable. +function getDocumentRect(element) { + const html = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element); + const scroll = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeScroll)(element); + const body = element.ownerDocument.body; + const width = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); + const height = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); + let x = -scroll.scrollLeft + getWindowScrollBarX(element); + const y = -scroll.scrollTop; + if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(body).direction === 'rtl') { + x += (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(html.clientWidth, body.clientWidth) - width; + } + return { + width, + height, + x, + y + }; +} + +function getViewportRect(element, strategy) { + const win = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element); + const html = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element); + const visualViewport = win.visualViewport; + let width = html.clientWidth; + let height = html.clientHeight; + let x = 0; + let y = 0; + if (visualViewport) { + width = visualViewport.width; + height = visualViewport.height; + const visualViewportBased = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isWebKit)(); + if (!visualViewportBased || visualViewportBased && strategy === 'fixed') { + x = visualViewport.offsetLeft; + y = visualViewport.offsetTop; + } + } + return { + width, + height, + x, + y + }; +} + +// Returns the inner client rect, subtracting scrollbars if present. +function getInnerBoundingClientRect(element, strategy) { + const clientRect = getBoundingClientRect(element, true, strategy === 'fixed'); + const top = clientRect.top + element.clientTop; + const left = clientRect.left + element.clientLeft; + const scale = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element) ? getScale(element) : (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(1); + const width = element.clientWidth * scale.x; + const height = element.clientHeight * scale.y; + const x = left * scale.x; + const y = top * scale.y; + return { + width, + height, + x, + y + }; +} +function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { + let rect; + if (clippingAncestor === 'viewport') { + rect = getViewportRect(element, strategy); + } else if (clippingAncestor === 'document') { + rect = getDocumentRect((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element)); + } else if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(clippingAncestor)) { + rect = getInnerBoundingClientRect(clippingAncestor, strategy); + } else { + const visualOffsets = getVisualOffsets(element); + rect = { + x: clippingAncestor.x - visualOffsets.x, + y: clippingAncestor.y - visualOffsets.y, + width: clippingAncestor.width, + height: clippingAncestor.height + }; + } + return (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(rect); +} +function hasFixedPositionAncestor(element, stopNode) { + const parentNode = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(element); + if (parentNode === stopNode || !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(parentNode) || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isLastTraversableNode)(parentNode)) { + return false; + } + return (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode); +} + +// A "clipping ancestor" is an `overflow` element with the characteristic of +// clipping (or hiding) child elements. This returns all clipping ancestors +// of the given element up the tree. +function getClippingElementAncestors(element, cache) { + const cachedResult = cache.get(element); + if (cachedResult) { + return cachedResult; + } + let result = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getOverflowAncestors)(element, [], false).filter(el => (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(el) && (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeName)(el) !== 'body'); + let currentContainingBlockComputedStyle = null; + const elementIsFixed = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element).position === 'fixed'; + let currentNode = elementIsFixed ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(element) : element; + + // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block + while ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(currentNode) && !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isLastTraversableNode)(currentNode)) { + const computedStyle = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(currentNode); + const currentNodeIsContaining = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isContainingBlock)(currentNode); + if (!currentNodeIsContaining && computedStyle.position === 'fixed') { + currentContainingBlockComputedStyle = null; + } + const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isOverflowElement)(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); + if (shouldDropCurrentNode) { + // Drop non-containing blocks. + result = result.filter(ancestor => ancestor !== currentNode); + } else { + // Record last containing block for next iteration. + currentContainingBlockComputedStyle = computedStyle; + } + currentNode = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(currentNode); + } + cache.set(element, result); + return result; +} + +// Gets the maximum area that the element is visible in due to any number of +// clipping ancestors. +function getClippingRect(_ref) { + let { + element, + boundary, + rootBoundary, + strategy + } = _ref; + const elementClippingAncestors = boundary === 'clippingAncestors' ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isTopLayer)(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); + const clippingAncestors = [...elementClippingAncestors, rootBoundary]; + const firstClippingAncestor = clippingAncestors[0]; + const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { + const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); + accRect.top = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(rect.top, accRect.top); + accRect.right = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.min)(rect.right, accRect.right); + accRect.bottom = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.min)(rect.bottom, accRect.bottom); + accRect.left = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(rect.left, accRect.left); + return accRect; + }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); + return { + width: clippingRect.right - clippingRect.left, + height: clippingRect.bottom - clippingRect.top, + x: clippingRect.left, + y: clippingRect.top + }; +} + +function getDimensions(element) { + const { + width, + height + } = getCssDimensions(element); + return { + width, + height + }; +} + +function getRectRelativeToOffsetParent(element, offsetParent, strategy) { + const isOffsetParentAnElement = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(offsetParent); + const documentElement = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(offsetParent); + const isFixed = strategy === 'fixed'; + const rect = getBoundingClientRect(element, true, isFixed, offsetParent); + let scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + const offsets = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeName)(offsetParent) !== 'body' || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isOverflowElement)(documentElement)) { + scroll = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeScroll)(offsetParent); + } + if (isOffsetParentAnElement) { + const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); + offsets.x = offsetRect.x + offsetParent.clientLeft; + offsets.y = offsetRect.y + offsetParent.clientTop; + } else if (documentElement) { + // If the scrollbar appears on the left (e.g. RTL systems). Use + // Firefox with layout.scrollbar.side = 3 in about:config to test this. + offsets.x = getWindowScrollBarX(documentElement); + } + } + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); + const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; + const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; + return { + x, + y, + width: rect.width, + height: rect.height + }; +} + +function isStaticPositioned(element) { + return (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element).position === 'static'; +} + +function getTrueOffsetParent(element, polyfill) { + if (!(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element) || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element).position === 'fixed') { + return null; + } + if (polyfill) { + return polyfill(element); + } + let rawOffsetParent = element.offsetParent; + + // Firefox returns the element as the offsetParent if it's non-static, + // while Chrome and Safari return the element. The element must + // be used to perform the correct calculations even if the element is + // non-static. + if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element) === rawOffsetParent) { + rawOffsetParent = rawOffsetParent.ownerDocument.body; + } + return rawOffsetParent; +} + +// Gets the closest ancestor positioned element. Handles some edge cases, +// such as table ancestors and cross browser bugs. +function getOffsetParent(element, polyfill) { + const win = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element); + if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isTopLayer)(element)) { + return win; + } + if (!(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element)) { + let svgOffsetParent = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(element); + while (svgOffsetParent && !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isLastTraversableNode)(svgOffsetParent)) { + if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { + return svgOffsetParent; + } + svgOffsetParent = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(svgOffsetParent); + } + return win; + } + let offsetParent = getTrueOffsetParent(element, polyfill); + while (offsetParent && (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isTableElement)(offsetParent) && isStaticPositioned(offsetParent)) { + offsetParent = getTrueOffsetParent(offsetParent, polyfill); + } + if (offsetParent && (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isLastTraversableNode)(offsetParent) && isStaticPositioned(offsetParent) && !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isContainingBlock)(offsetParent)) { + return win; + } + return offsetParent || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getContainingBlock)(element) || win; +} + +const getElementRects = async function (data) { + const getOffsetParentFn = this.getOffsetParent || getOffsetParent; + const getDimensionsFn = this.getDimensions; + const floatingDimensions = await getDimensionsFn(data.floating); + return { + reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), + floating: { + x: 0, + y: 0, + width: floatingDimensions.width, + height: floatingDimensions.height + } + }; +}; + +function isRTL(element) { + return (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element).direction === 'rtl'; +} + +const platform = { + convertOffsetParentRelativeRectToViewportRelativeRect, + getDocumentElement: _floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement, + getClippingRect, + getOffsetParent, + getElementRects, + getClientRects, + getDimensions, + getScale, + isElement: _floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement, + isRTL +}; + +function rectsAreEqual(a, b) { + return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; +} + +// https://samthor.au/2021/observing-dom/ +function observeMove(element, onMove) { + let io = null; + let timeoutId; + const root = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element); + function cleanup() { + var _io; + clearTimeout(timeoutId); + (_io = io) == null || _io.disconnect(); + io = null; + } + function refresh(skip, threshold) { + if (skip === void 0) { + skip = false; + } + if (threshold === void 0) { + threshold = 1; + } + cleanup(); + const elementRectForRootMargin = element.getBoundingClientRect(); + const { + left, + top, + width, + height + } = elementRectForRootMargin; + if (!skip) { + onMove(); + } + if (!width || !height) { + return; + } + const insetTop = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.floor)(top); + const insetRight = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.floor)(root.clientWidth - (left + width)); + const insetBottom = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.floor)(root.clientHeight - (top + height)); + const insetLeft = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.floor)(left); + const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; + const options = { + rootMargin, + threshold: (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(0, (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.min)(1, threshold)) || 1 + }; + let isFirstUpdate = true; + function handleObserve(entries) { + const ratio = entries[0].intersectionRatio; + if (ratio !== threshold) { + if (!isFirstUpdate) { + return refresh(); + } + if (!ratio) { + // If the reference is clipped, the ratio is 0. Throttle the refresh + // to prevent an infinite loop of updates. + timeoutId = setTimeout(() => { + refresh(false, 1e-7); + }, 1000); + } else { + refresh(false, ratio); + } + } + if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { + // It's possible that even though the ratio is reported as 1, the + // element is not actually fully within the IntersectionObserver's root + // area anymore. This can happen under performance constraints. This may + // be a bug in the browser's IntersectionObserver implementation. To + // work around this, we compare the element's bounding rect now with + // what it was at the time we created the IntersectionObserver. If they + // are not equal then the element moved, so we refresh. + refresh(); + } + isFirstUpdate = false; + } + + // Older browsers don't support a `document` as the root and will throw an + // error. + try { + io = new IntersectionObserver(handleObserve, { + ...options, + // Handle