import {
  r as nn,
  g as sn,
  a as b,
  R as rn,
} from "./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a52.js";
var Nt = { exports: {} },
  F = {};
var le;
function on() {
  if (le) return F;
  le = 1;
  var e = nn();
  function t(a) {
    var c = "https://react.dev/errors/" + a;
    if (1 < arguments.length) {
      c += "?args[]=" + encodeURIComponent(arguments[1]);
      for (var f = 2; f < arguments.length; f++)
        c += "&args[]=" + encodeURIComponent(arguments[f]);
    }
    return (
      "Minified React error #" +
      a +
      "; visit " +
      c +
      " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
    );
  }
  function n() {}
  var s = {
      d: {
        f: n,
        r: function () {
          throw Error(t(522));
        },
        D: n,
        C: n,
        L: n,
        m: n,
        X: n,
        S: n,
        M: n,
      },
      p: 0,
      findDOMNode: null,
    },
    r = Symbol.for("react.portal");
  function i(a, c, f) {
    var h =
      3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
    return {
      $$typeof: r,
      key: h == null ? null : "" + h,
      children: a,
      containerInfo: c,
      implementation: f,
    };
  }
  var o = e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
  function l(a, c) {
    if (a === "font") return "";
    if (typeof c == "string") return c === "use-credentials" ? c : "";
  }
  return (
    (F.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = s),
    (F.createPortal = function (a, c) {
      var f =
        2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
      if (!c || (c.nodeType !== 1 && c.nodeType !== 9 && c.nodeType !== 11))
        throw Error(t(299));
      return i(a, c, null, f);
    }),
    (F.flushSync = function (a) {
      var c = o.T,
        f = s.p;
      try {
        if (((o.T = null), (s.p = 2), a)) return a();
      } finally {
        ((o.T = c), (s.p = f), s.d.f());
      }
    }),
    (F.preconnect = function (a, c) {
      typeof a == "string" &&
        (c
          ? ((c = c.crossOrigin),
            (c =
              typeof c == "string"
                ? c === "use-credentials"
                  ? c
                  : ""
                : void 0))
          : (c = null),
        s.d.C(a, c));
    }),
    (F.prefetchDNS = function (a) {
      typeof a == "string" && s.d.D(a);
    }),
    (F.preinit = function (a, c) {
      if (typeof a == "string" && c && typeof c.as == "string") {
        var f = c.as,
          h = l(f, c.crossOrigin),
          p = typeof c.integrity == "string" ? c.integrity : void 0,
          u = typeof c.fetchPriority == "string" ? c.fetchPriority : void 0;
        f === "style"
          ? s.d.S(a, typeof c.precedence == "string" ? c.precedence : void 0, {
              crossOrigin: h,
              integrity: p,
              fetchPriority: u,
            })
          : f === "script" &&
            s.d.X(a, {
              crossOrigin: h,
              integrity: p,
              fetchPriority: u,
              nonce: typeof c.nonce == "string" ? c.nonce : void 0,
            });
      }
    }),
    (F.preinitModule = function (a, c) {
      if (typeof a == "string")
        if (typeof c == "object" && c !== null) {
          if (c.as == null || c.as === "script") {
            var f = l(c.as, c.crossOrigin);
            s.d.M(a, {
              crossOrigin: f,
              integrity: typeof c.integrity == "string" ? c.integrity : void 0,
              nonce: typeof c.nonce == "string" ? c.nonce : void 0,
            });
          }
        } else c == null && s.d.M(a);
    }),
    (F.preload = function (a, c) {
      if (
        typeof a == "string" &&
        typeof c == "object" &&
        c !== null &&
        typeof c.as == "string"
      ) {
        var f = c.as,
          h = l(f, c.crossOrigin);
        s.d.L(a, f, {
          crossOrigin: h,
          integrity: typeof c.integrity == "string" ? c.integrity : void 0,
          nonce: typeof c.nonce == "string" ? c.nonce : void 0,
          type: typeof c.type == "string" ? c.type : void 0,
          fetchPriority:
            typeof c.fetchPriority == "string" ? c.fetchPriority : void 0,
          referrerPolicy:
            typeof c.referrerPolicy == "string" ? c.referrerPolicy : void 0,
          imageSrcSet:
            typeof c.imageSrcSet == "string" ? c.imageSrcSet : void 0,
          imageSizes: typeof c.imageSizes == "string" ? c.imageSizes : void 0,
          media: typeof c.media == "string" ? c.media : void 0,
        });
      }
    }),
    (F.preloadModule = function (a, c) {
      if (typeof a == "string")
        if (c) {
          var f = l(c.as, c.crossOrigin);
          s.d.m(a, {
            as: typeof c.as == "string" && c.as !== "script" ? c.as : void 0,
            crossOrigin: f,
            integrity: typeof c.integrity == "string" ? c.integrity : void 0,
          });
        } else s.d.m(a);
    }),
    (F.requestFormReset = function (a) {
      s.d.r(a);
    }),
    (F.unstable_batchedUpdates = function (a, c) {
      return a(c);
    }),
    (F.useFormState = function (a, c, f) {
      return o.H.useFormState(a, c, f);
    }),
    (F.useFormStatus = function () {
      return o.H.useHostTransitionStatus();
    }),
    (F.version = "19.2.5"),
    F
  );
}
var fe;
function cn() {
  if (fe) return Nt.exports;
  fe = 1;
  function e() {
    if (
      !(
        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ > "u" ||
        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE != "function"
      )
    )
      try {
        __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e);
      } catch (t) {
        console.error(t);
      }
  }
  return (e(), (Nt.exports = on()), Nt.exports);
}
var Te = cn();
const dr = sn(Te),
  j = Object.create(null);
j.open = "0";
j.close = "1";
j.ping = "2";
j.pong = "3";
j.message = "4";
j.upgrade = "5";
j.noop = "6";
const vt = Object.create(null);
Object.keys(j).forEach((e) => {
  vt[j[e]] = e;
});
const Ht = { type: "error", data: "parser error" },
  ke =
    typeof Blob == "function" ||
    (typeof Blob < "u" &&
      Object.prototype.toString.call(Blob) === "[object BlobConstructor]"),
  Le = typeof ArrayBuffer == "function",
  Pe = (e) =>
    typeof ArrayBuffer.isView == "function"
      ? ArrayBuffer.isView(e)
      : e && e.buffer instanceof ArrayBuffer,
  Gt = ({ type: e, data: t }, n, s) =>
    ke && t instanceof Blob
      ? n
        ? s(t)
        : ue(t, s)
      : Le && (t instanceof ArrayBuffer || Pe(t))
        ? n
          ? s(t)
          : ue(new Blob([t]), s)
        : s(j[e] + (t || "")),
  ue = (e, t) => {
    const n = new FileReader();
    return (
      (n.onload = function () {
        const s = n.result.split(",")[1];
        t("b" + (s || ""));
      }),
      n.readAsDataURL(e)
    );
  };
function he(e) {
  return e instanceof Uint8Array
    ? e
    : e instanceof ArrayBuffer
      ? new Uint8Array(e)
      : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
}
let Dt;
function an(e, t) {
  if (ke && e.data instanceof Blob)
    return e.data.arrayBuffer().then(he).then(t);
  if (Le && (e.data instanceof ArrayBuffer || Pe(e.data))) return t(he(e.data));
  Gt(e, !1, (n) => {
    (Dt || (Dt = new TextEncoder()), t(Dt.encode(n)));
  });
}
const de = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
  dt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (let e = 0; e < de.length; e++) dt[de.charCodeAt(e)] = e;
const ln = (e) => {
    let t = e.length * 0.75,
      n = e.length,
      s,
      r = 0,
      i,
      o,
      l,
      a;
    e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
    const c = new ArrayBuffer(t),
      f = new Uint8Array(c);
    for (s = 0; s < n; s += 4)
      ((i = dt[e.charCodeAt(s)]),
        (o = dt[e.charCodeAt(s + 1)]),
        (l = dt[e.charCodeAt(s + 2)]),
        (a = dt[e.charCodeAt(s + 3)]),
        (f[r++] = (i << 2) | (o >> 4)),
        (f[r++] = ((o & 15) << 4) | (l >> 2)),
        (f[r++] = ((l & 3) << 6) | (a & 63)));
    return c;
  },
  fn = typeof ArrayBuffer == "function",
  Zt = (e, t) => {
    if (typeof e != "string") return { type: "message", data: Be(e, t) };
    const n = e.charAt(0);
    return n === "b"
      ? { type: "message", data: un(e.substring(1), t) }
      : vt[n]
        ? e.length > 1
          ? { type: vt[n], data: e.substring(1) }
          : { type: vt[n] }
        : Ht;
  },
  un = (e, t) => {
    if (fn) {
      const n = ln(e);
      return Be(n, t);
    } else return { base64: !0, data: e };
  },
  Be = (e, t) =>
    t === "blob"
      ? e instanceof Blob
        ? e
        : new Blob([e])
      : e instanceof ArrayBuffer
        ? e
        : e.buffer,
  Ne = "",
  hn = (e, t) => {
    const n = e.length,
      s = new Array(n);
    let r = 0;
    e.forEach((i, o) => {
      Gt(i, !1, (l) => {
        ((s[o] = l), ++r === n && t(s.join(Ne)));
      });
    });
  },
  dn = (e, t) => {
    const n = e.split(Ne),
      s = [];
    for (let r = 0; r < n.length; r++) {
      const i = Zt(n[r], t);
      if ((s.push(i), i.type === "error")) break;
    }
    return s;
  };
function pn() {
  return new TransformStream({
    transform(e, t) {
      an(e, (n) => {
        const s = n.length;
        let r;
        if (s < 126)
          ((r = new Uint8Array(1)), new DataView(r.buffer).setUint8(0, s));
        else if (s < 65536) {
          r = new Uint8Array(3);
          const i = new DataView(r.buffer);
          (i.setUint8(0, 126), i.setUint16(1, s));
        } else {
          r = new Uint8Array(9);
          const i = new DataView(r.buffer);
          (i.setUint8(0, 127), i.setBigUint64(1, BigInt(s)));
        }
        (e.data && typeof e.data != "string" && (r[0] |= 128),
          t.enqueue(r),
          t.enqueue(n));
      });
    },
  });
}
let Mt;
function gt(e) {
  return e.reduce((t, n) => t + n.length, 0);
}
function yt(e, t) {
  if (e[0].length === t) return e.shift();
  const n = new Uint8Array(t);
  let s = 0;
  for (let r = 0; r < t; r++)
    ((n[r] = e[0][s++]), s === e[0].length && (e.shift(), (s = 0)));
  return (e.length && s < e[0].length && (e[0] = e[0].slice(s)), n);
}
function mn(e, t) {
  Mt || (Mt = new TextDecoder());
  const n = [];
  let s = 0,
    r = -1,
    i = !1;
  return new TransformStream({
    transform(o, l) {
      for (n.push(o); ; ) {
        if (s === 0) {
          if (gt(n) < 1) break;
          const a = yt(n, 1);
          ((i = (a[0] & 128) === 128),
            (r = a[0] & 127),
            r < 126 ? (s = 3) : r === 126 ? (s = 1) : (s = 2));
        } else if (s === 1) {
          if (gt(n) < 2) break;
          const a = yt(n, 2);
          ((r = new DataView(a.buffer, a.byteOffset, a.length).getUint16(0)),
            (s = 3));
        } else if (s === 2) {
          if (gt(n) < 8) break;
          const a = yt(n, 8),
            c = new DataView(a.buffer, a.byteOffset, a.length),
            f = c.getUint32(0);
          if (f > Math.pow(2, 21) - 1) {
            l.enqueue(Ht);
            break;
          }
          ((r = f * Math.pow(2, 32) + c.getUint32(4)), (s = 3));
        } else {
          if (gt(n) < r) break;
          const a = yt(n, r);
          (l.enqueue(Zt(i ? a : Mt.decode(a), t)), (s = 0));
        }
        if (r === 0 || r > e) {
          l.enqueue(Ht);
          break;
        }
      }
    },
  });
}
const De = 4;
function L(e) {
  if (e) return gn(e);
}
function gn(e) {
  for (var t in L.prototype) e[t] = L.prototype[t];
  return e;
}
L.prototype.on = L.prototype.addEventListener = function (e, t) {
  return (
    (this._callbacks = this._callbacks || {}),
    (this._callbacks["$" + e] = this._callbacks["$" + e] || []).push(t),
    this
  );
};
L.prototype.once = function (e, t) {
  function n() {
    (this.off(e, n), t.apply(this, arguments));
  }
  return ((n.fn = t), this.on(e, n), this);
};
L.prototype.off =
  L.prototype.removeListener =
  L.prototype.removeAllListeners =
  L.prototype.removeEventListener =
    function (e, t) {
      if (((this._callbacks = this._callbacks || {}), arguments.length == 0))
        return ((this._callbacks = {}), this);
      var n = this._callbacks["$" + e];
      if (!n) return this;
      if (arguments.length == 1) return (delete this._callbacks["$" + e], this);
      for (var s, r = 0; r < n.length; r++)
        if (((s = n[r]), s === t || s.fn === t)) {
          n.splice(r, 1);
          break;
        }
      return (n.length === 0 && delete this._callbacks["$" + e], this);
    };
L.prototype.emit = function (e) {
  this._callbacks = this._callbacks || {};
  for (
    var t = new Array(arguments.length - 1),
      n = this._callbacks["$" + e],
      s = 1;
    s < arguments.length;
    s++
  )
    t[s - 1] = arguments[s];
  if (n) {
    n = n.slice(0);
    for (var s = 0, r = n.length; s < r; ++s) n[s].apply(this, t);
  }
  return this;
};
L.prototype.emitReserved = L.prototype.emit;
L.prototype.listeners = function (e) {
  return (
    (this._callbacks = this._callbacks || {}),
    this._callbacks["$" + e] || []
  );
};
L.prototype.hasListeners = function (e) {
  return !!this.listeners(e).length;
};
const St =
    typeof Promise == "function" && typeof Promise.resolve == "function"
      ? (t) => Promise.resolve().then(t)
      : (t, n) => n(t, 0),
  $ =
    typeof self < "u"
      ? self
      : typeof window < "u"
        ? window
        : Function("return this")(),
  yn = "arraybuffer";
function Me(e, ...t) {
  return t.reduce((n, s) => (e.hasOwnProperty(s) && (n[s] = e[s]), n), {});
}
const wn = $.setTimeout,
  vn = $.clearTimeout;
function Tt(e, t) {
  t.useNativeTimers
    ? ((e.setTimeoutFn = wn.bind($)), (e.clearTimeoutFn = vn.bind($)))
    : ((e.setTimeoutFn = $.setTimeout.bind($)),
      (e.clearTimeoutFn = $.clearTimeout.bind($)));
}
const _n = 1.33;
function bn(e) {
  return typeof e == "string"
    ? xn(e)
    : Math.ceil((e.byteLength || e.size) * _n);
}
function xn(e) {
  let t = 0,
    n = 0;
  for (let s = 0, r = e.length; s < r; s++)
    ((t = e.charCodeAt(s)),
      t < 128
        ? (n += 1)
        : t < 2048
          ? (n += 2)
          : t < 55296 || t >= 57344
            ? (n += 3)
            : (s++, (n += 4)));
  return n;
}
function Fe() {
  return (
    Date.now().toString(36).substring(3) +
    Math.random().toString(36).substring(2, 5)
  );
}
function Rn(e) {
  let t = "";
  for (let n in e)
    e.hasOwnProperty(n) &&
      (t.length && (t += "&"),
      (t += encodeURIComponent(n) + "=" + encodeURIComponent(e[n])));
  return t;
}
function En(e) {
  let t = {},
    n = e.split("&");
  for (let s = 0, r = n.length; s < r; s++) {
    let i = n[s].split("=");
    t[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
  }
  return t;
}
class An extends Error {
  constructor(t, n, s) {
    (super(t),
      (this.description = n),
      (this.context = s),
      (this.type = "TransportError"));
  }
}
class te extends L {
  constructor(t) {
    (super(),
      (this.writable = !1),
      Tt(this, t),
      (this.opts = t),
      (this.query = t.query),
      (this.socket = t.socket),
      (this.supportsBinary = !t.forceBase64));
  }
  onError(t, n, s) {
    return (super.emitReserved("error", new An(t, n, s)), this);
  }
  open() {
    return ((this.readyState = "opening"), this.doOpen(), this);
  }
  close() {
    return (
      (this.readyState === "opening" || this.readyState === "open") &&
        (this.doClose(), this.onClose()),
      this
    );
  }
  send(t) {
    this.readyState === "open" && this.write(t);
  }
  onOpen() {
    ((this.readyState = "open"),
      (this.writable = !0),
      super.emitReserved("open"));
  }
  onData(t) {
    const n = Zt(t, this.socket.binaryType);
    this.onPacket(n);
  }
  onPacket(t) {
    super.emitReserved("packet", t);
  }
  onClose(t) {
    ((this.readyState = "closed"), super.emitReserved("close", t));
  }
  pause(t) {}
  createUri(t, n = {}) {
    return (
      t +
      "://" +
      this._hostname() +
      this._port() +
      this.opts.path +
      this._query(n)
    );
  }
  _hostname() {
    const t = this.opts.hostname;
    return t.indexOf(":") === -1 ? t : "[" + t + "]";
  }
  _port() {
    return this.opts.port &&
      ((this.opts.secure && Number(this.opts.port) !== 443) ||
        (!this.opts.secure && Number(this.opts.port) !== 80))
      ? ":" + this.opts.port
      : "";
  }
  _query(t) {
    const n = Rn(t);
    return n.length ? "?" + n : "";
  }
}
class On extends te {
  constructor() {
    (super(...arguments), (this._polling = !1));
  }
  get name() {
    return "polling";
  }
  doOpen() {
    this._poll();
  }
  pause(t) {
    this.readyState = "pausing";
    const n = () => {
      ((this.readyState = "paused"), t());
    };
    if (this._polling || !this.writable) {
      let s = 0;
      (this._polling &&
        (s++,
        this.once("pollComplete", function () {
          --s || n();
        })),
        this.writable ||
          (s++,
          this.once("drain", function () {
            --s || n();
          })));
    } else n();
  }
  _poll() {
    ((this._polling = !0), this.doPoll(), this.emitReserved("poll"));
  }
  onData(t) {
    const n = (s) => {
      if (
        (this.readyState === "opening" && s.type === "open" && this.onOpen(),
        s.type === "close")
      )
        return (
          this.onClose({ description: "transport closed by the server" }),
          !1
        );
      this.onPacket(s);
    };
    (dn(t, this.socket.binaryType).forEach(n),
      this.readyState !== "closed" &&
        ((this._polling = !1),
        this.emitReserved("pollComplete"),
        this.readyState === "open" && this._poll()));
  }
  doClose() {
    const t = () => {
      this.write([{ type: "close" }]);
    };
    this.readyState === "open" ? t() : this.once("open", t);
  }
  write(t) {
    ((this.writable = !1),
      hn(t, (n) => {
        this.doWrite(n, () => {
          ((this.writable = !0), this.emitReserved("drain"));
        });
      }));
  }
  uri() {
    const t = this.opts.secure ? "https" : "http",
      n = this.query || {};
    return (
      this.opts.timestampRequests !== !1 &&
        (n[this.opts.timestampParam] = Fe()),
      !this.supportsBinary && !n.sid && (n.b64 = 1),
      this.createUri(t, n)
    );
  }
}
let qe = !1;
try {
  qe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
} catch {}
const Cn = qe;
function Sn() {}
class Tn extends On {
  constructor(t) {
    if ((super(t), typeof location < "u")) {
      const n = location.protocol === "https:";
      let s = location.port;
      (s || (s = n ? "443" : "80"),
        (this.xd =
          (typeof location < "u" && t.hostname !== location.hostname) ||
          s !== t.port));
    }
  }
  doWrite(t, n) {
    const s = this.request({ method: "POST", data: t });
    (s.on("success", n),
      s.on("error", (r, i) => {
        this.onError("xhr post error", r, i);
      }));
  }
  doPoll() {
    const t = this.request();
    (t.on("data", this.onData.bind(this)),
      t.on("error", (n, s) => {
        this.onError("xhr poll error", n, s);
      }),
      (this.pollXhr = t));
  }
}
class K extends L {
  constructor(t, n, s) {
    (super(),
      (this.createRequest = t),
      Tt(this, s),
      (this._opts = s),
      (this._method = s.method || "GET"),
      (this._uri = n),
      (this._data = s.data !== void 0 ? s.data : null),
      this._create());
  }
  _create() {
    var t;
    const n = Me(
      this._opts,
      "agent",
      "pfx",
      "key",
      "passphrase",
      "cert",
      "ca",
      "ciphers",
      "rejectUnauthorized",
      "autoUnref",
    );
    n.xdomain = !!this._opts.xd;
    const s = (this._xhr = this.createRequest(n));
    try {
      s.open(this._method, this._uri, !0);
      try {
        if (this._opts.extraHeaders) {
          s.setDisableHeaderCheck && s.setDisableHeaderCheck(!0);
          for (let r in this._opts.extraHeaders)
            this._opts.extraHeaders.hasOwnProperty(r) &&
              s.setRequestHeader(r, this._opts.extraHeaders[r]);
        }
      } catch {}
      if (this._method === "POST")
        try {
          s.setRequestHeader("Content-type", "text/plain;charset=UTF-8");
        } catch {}
      try {
        s.setRequestHeader("Accept", "*/*");
      } catch {}
      ((t = this._opts.cookieJar) === null || t === void 0 || t.addCookies(s),
        "withCredentials" in s &&
          (s.withCredentials = this._opts.withCredentials),
        this._opts.requestTimeout && (s.timeout = this._opts.requestTimeout),
        (s.onreadystatechange = () => {
          var r;
          (s.readyState === 3 &&
            ((r = this._opts.cookieJar) === null ||
              r === void 0 ||
              r.parseCookies(s.getResponseHeader("set-cookie"))),
            s.readyState === 4 &&
              (s.status === 200 || s.status === 1223
                ? this._onLoad()
                : this.setTimeoutFn(() => {
                    this._onError(typeof s.status == "number" ? s.status : 0);
                  }, 0)));
        }),
        s.send(this._data));
    } catch (r) {
      this.setTimeoutFn(() => {
        this._onError(r);
      }, 0);
      return;
    }
    typeof document < "u" &&
      ((this._index = K.requestsCount++), (K.requests[this._index] = this));
  }
  _onError(t) {
    (this.emitReserved("error", t, this._xhr), this._cleanup(!0));
  }
  _cleanup(t) {
    if (!(typeof this._xhr > "u" || this._xhr === null)) {
      if (((this._xhr.onreadystatechange = Sn), t))
        try {
          this._xhr.abort();
        } catch {}
      (typeof document < "u" && delete K.requests[this._index],
        (this._xhr = null));
    }
  }
  _onLoad() {
    const t = this._xhr.responseText;
    t !== null &&
      (this.emitReserved("data", t),
      this.emitReserved("success"),
      this._cleanup());
  }
  abort() {
    this._cleanup();
  }
}
K.requestsCount = 0;
K.requests = {};
if (typeof document < "u") {
  if (typeof attachEvent == "function") attachEvent("onunload", pe);
  else if (typeof addEventListener == "function") {
    const e = "onpagehide" in $ ? "pagehide" : "unload";
    addEventListener(e, pe, !1);
  }
}
function pe() {
  for (let e in K.requests)
    K.requests.hasOwnProperty(e) && K.requests[e].abort();
}
const kn = (function () {
  const e = Ie({ xdomain: !1 });
  return e && e.responseType !== null;
})();
class Ln extends Tn {
  constructor(t) {
    super(t);
    const n = t && t.forceBase64;
    this.supportsBinary = kn && !n;
  }
  request(t = {}) {
    return (
      Object.assign(t, { xd: this.xd }, this.opts),
      new K(Ie, this.uri(), t)
    );
  }
}
function Ie(e) {
  const t = e.xdomain;
  try {
    if (typeof XMLHttpRequest < "u" && (!t || Cn)) return new XMLHttpRequest();
  } catch {}
  if (!t)
    try {
      return new $[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
    } catch {}
}
const Ve =
  typeof navigator < "u" &&
  typeof navigator.product == "string" &&
  navigator.product.toLowerCase() === "reactnative";
class Pn extends te {
  get name() {
    return "websocket";
  }
  doOpen() {
    const t = this.uri(),
      n = this.opts.protocols,
      s = Ve
        ? {}
        : Me(
            this.opts,
            "agent",
            "perMessageDeflate",
            "pfx",
            "key",
            "passphrase",
            "cert",
            "ca",
            "ciphers",
            "rejectUnauthorized",
            "localAddress",
            "protocolVersion",
            "origin",
            "maxPayload",
            "family",
            "checkServerIdentity",
          );
    this.opts.extraHeaders && (s.headers = this.opts.extraHeaders);
    try {
      this.ws = this.createSocket(t, n, s);
    } catch (r) {
      return this.emitReserved("error", r);
    }
    ((this.ws.binaryType = this.socket.binaryType), this.addEventListeners());
  }
  addEventListeners() {
    ((this.ws.onopen = () => {
      (this.opts.autoUnref && this.ws._socket.unref(), this.onOpen());
    }),
      (this.ws.onclose = (t) =>
        this.onClose({
          description: "websocket connection closed",
          context: t,
        })),
      (this.ws.onmessage = (t) => this.onData(t.data)),
      (this.ws.onerror = (t) => this.onError("websocket error", t)));
  }
  write(t) {
    this.writable = !1;
    for (let n = 0; n < t.length; n++) {
      const s = t[n],
        r = n === t.length - 1;
      Gt(s, this.supportsBinary, (i) => {
        try {
          this.doWrite(s, i);
        } catch {}
        r &&
          St(() => {
            ((this.writable = !0), this.emitReserved("drain"));
          }, this.setTimeoutFn);
      });
    }
  }
  doClose() {
    typeof this.ws < "u" &&
      ((this.ws.onerror = () => {}), this.ws.close(), (this.ws = null));
  }
  uri() {
    const t = this.opts.secure ? "wss" : "ws",
      n = this.query || {};
    return (
      this.opts.timestampRequests && (n[this.opts.timestampParam] = Fe()),
      this.supportsBinary || (n.b64 = 1),
      this.createUri(t, n)
    );
  }
}
const Ft = $.WebSocket || $.MozWebSocket;
class Bn extends Pn {
  createSocket(t, n, s) {
    return Ve ? new Ft(t, n, s) : n ? new Ft(t, n) : new Ft(t);
  }
  doWrite(t, n) {
    this.ws.send(n);
  }
}
class Nn extends te {
  get name() {
    return "webtransport";
  }
  doOpen() {
    try {
      this._transport = new WebTransport(
        this.createUri("https"),
        this.opts.transportOptions[this.name],
      );
    } catch (t) {
      return this.emitReserved("error", t);
    }
    (this._transport.closed
      .then(() => {
        this.onClose();
      })
      .catch((t) => {
        this.onError("webtransport error", t);
      }),
      this._transport.ready.then(() => {
        this._transport.createBidirectionalStream().then((t) => {
          const n = mn(Number.MAX_SAFE_INTEGER, this.socket.binaryType),
            s = t.readable.pipeThrough(n).getReader(),
            r = pn();
          (r.readable.pipeTo(t.writable),
            (this._writer = r.writable.getWriter()));
          const i = () => {
            s.read()
              .then(({ done: l, value: a }) => {
                l || (this.onPacket(a), i());
              })
              .catch((l) => {});
          };
          i();
          const o = { type: "open" };
          (this.query.sid && (o.data = `{"sid":"${this.query.sid}"}`),
            this._writer.write(o).then(() => this.onOpen()));
        });
      }));
  }
  write(t) {
    this.writable = !1;
    for (let n = 0; n < t.length; n++) {
      const s = t[n],
        r = n === t.length - 1;
      this._writer.write(s).then(() => {
        r &&
          St(() => {
            ((this.writable = !0), this.emitReserved("drain"));
          }, this.setTimeoutFn);
      });
    }
  }
  doClose() {
    var t;
    (t = this._transport) === null || t === void 0 || t.close();
  }
}
const Dn = { websocket: Bn, webtransport: Nn, polling: Ln },
  Mn =
    /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
  Fn = [
    "source",
    "protocol",
    "authority",
    "userInfo",
    "user",
    "password",
    "host",
    "port",
    "relative",
    "path",
    "directory",
    "file",
    "query",
    "anchor",
  ];
function $t(e) {
  if (e.length > 8e3) throw "URI too long";
  const t = e,
    n = e.indexOf("["),
    s = e.indexOf("]");
  n != -1 &&
    s != -1 &&
    (e =
      e.substring(0, n) +
      e.substring(n, s).replace(/:/g, ";") +
      e.substring(s, e.length));
  let r = Mn.exec(e || ""),
    i = {},
    o = 14;
  for (; o--; ) i[Fn[o]] = r[o] || "";
  return (
    n != -1 &&
      s != -1 &&
      ((i.source = t),
      (i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":")),
      (i.authority = i.authority
        .replace("[", "")
        .replace("]", "")
        .replace(/;/g, ":")),
      (i.ipv6uri = !0)),
    (i.pathNames = qn(i, i.path)),
    (i.queryKey = In(i, i.query)),
    i
  );
}
function qn(e, t) {
  const n = /\/{2,9}/g,
    s = t.replace(n, "/").split("/");
  return (
    (t.slice(0, 1) == "/" || t.length === 0) && s.splice(0, 1),
    t.slice(-1) == "/" && s.splice(s.length - 1, 1),
    s
  );
}
function In(e, t) {
  const n = {};
  return (
    t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function (s, r, i) {
      r && (n[r] = i);
    }),
    n
  );
}
const Wt =
    typeof addEventListener == "function" &&
    typeof removeEventListener == "function",
  _t = [];
Wt &&
  addEventListener(
    "offline",
    () => {
      _t.forEach((e) => e());
    },
    !1,
  );
class nt extends L {
  constructor(t, n) {
    if (
      (super(),
      (this.binaryType = yn),
      (this.writeBuffer = []),
      (this._prevBufferLen = 0),
      (this._pingInterval = -1),
      (this._pingTimeout = -1),
      (this._maxPayload = -1),
      (this._pingTimeoutTime = 1 / 0),
      t && typeof t == "object" && ((n = t), (t = null)),
      t)
    ) {
      const s = $t(t);
      ((n.hostname = s.host),
        (n.secure = s.protocol === "https" || s.protocol === "wss"),
        (n.port = s.port),
        s.query && (n.query = s.query));
    } else n.host && (n.hostname = $t(n.host).host);
    (Tt(this, n),
      (this.secure =
        n.secure != null
          ? n.secure
          : typeof location < "u" && location.protocol === "https:"),
      n.hostname && !n.port && (n.port = this.secure ? "443" : "80"),
      (this.hostname =
        n.hostname ||
        (typeof location < "u" ? location.hostname : "localhost")),
      (this.port =
        n.port ||
        (typeof location < "u" && location.port
          ? location.port
          : this.secure
            ? "443"
            : "80")),
      (this.transports = []),
      (this._transportsByName = {}),
      n.transports.forEach((s) => {
        const r = s.prototype.name;
        (this.transports.push(r), (this._transportsByName[r] = s));
      }),
      (this.opts = Object.assign(
        {
          path: "/engine.io",
          agent: !1,
          withCredentials: !1,
          upgrade: !0,
          timestampParam: "t",
          rememberUpgrade: !1,
          addTrailingSlash: !0,
          rejectUnauthorized: !0,
          perMessageDeflate: { threshold: 1024 },
          transportOptions: {},
          closeOnBeforeunload: !1,
        },
        n,
      )),
      (this.opts.path =
        this.opts.path.replace(/\/$/, "") +
        (this.opts.addTrailingSlash ? "/" : "")),
      typeof this.opts.query == "string" &&
        (this.opts.query = En(this.opts.query)),
      Wt &&
        (this.opts.closeOnBeforeunload &&
          ((this._beforeunloadEventListener = () => {
            this.transport &&
              (this.transport.removeAllListeners(), this.transport.close());
          }),
          addEventListener(
            "beforeunload",
            this._beforeunloadEventListener,
            !1,
          )),
        this.hostname !== "localhost" &&
          ((this._offlineEventListener = () => {
            this._onClose("transport close", {
              description: "network connection lost",
            });
          }),
          _t.push(this._offlineEventListener))),
      this.opts.withCredentials && (this._cookieJar = void 0),
      this._open());
  }
  createTransport(t) {
    const n = Object.assign({}, this.opts.query);
    ((n.EIO = De), (n.transport = t), this.id && (n.sid = this.id));
    const s = Object.assign(
      {},
      this.opts,
      {
        query: n,
        socket: this,
        hostname: this.hostname,
        secure: this.secure,
        port: this.port,
      },
      this.opts.transportOptions[t],
    );
    return new this._transportsByName[t](s);
  }
  _open() {
    if (this.transports.length === 0) {
      this.setTimeoutFn(() => {
        this.emitReserved("error", "No transports available");
      }, 0);
      return;
    }
    const t =
      this.opts.rememberUpgrade &&
      nt.priorWebsocketSuccess &&
      this.transports.indexOf("websocket") !== -1
        ? "websocket"
        : this.transports[0];
    this.readyState = "opening";
    const n = this.createTransport(t);
    (n.open(), this.setTransport(n));
  }
  setTransport(t) {
    (this.transport && this.transport.removeAllListeners(),
      (this.transport = t),
      t
        .on("drain", this._onDrain.bind(this))
        .on("packet", this._onPacket.bind(this))
        .on("error", this._onError.bind(this))
        .on("close", (n) => this._onClose("transport close", n)));
  }
  onOpen() {
    ((this.readyState = "open"),
      (nt.priorWebsocketSuccess = this.transport.name === "websocket"),
      this.emitReserved("open"),
      this.flush());
  }
  _onPacket(t) {
    if (
      this.readyState === "opening" ||
      this.readyState === "open" ||
      this.readyState === "closing"
    )
      switch (
        (this.emitReserved("packet", t), this.emitReserved("heartbeat"), t.type)
      ) {
        case "open":
          this.onHandshake(JSON.parse(t.data));
          break;
        case "ping":
          (this._sendPacket("pong"),
            this.emitReserved("ping"),
            this.emitReserved("pong"),
            this._resetPingTimeout());
          break;
        case "error":
          const n = new Error("server error");
          ((n.code = t.data), this._onError(n));
          break;
        case "message":
          (this.emitReserved("data", t.data),
            this.emitReserved("message", t.data));
          break;
      }
  }
  onHandshake(t) {
    (this.emitReserved("handshake", t),
      (this.id = t.sid),
      (this.transport.query.sid = t.sid),
      (this._pingInterval = t.pingInterval),
      (this._pingTimeout = t.pingTimeout),
      (this._maxPayload = t.maxPayload),
      this.onOpen(),
      this.readyState !== "closed" && this._resetPingTimeout());
  }
  _resetPingTimeout() {
    this.clearTimeoutFn(this._pingTimeoutTimer);
    const t = this._pingInterval + this._pingTimeout;
    ((this._pingTimeoutTime = Date.now() + t),
      (this._pingTimeoutTimer = this.setTimeoutFn(() => {
        this._onClose("ping timeout");
      }, t)),
      this.opts.autoUnref && this._pingTimeoutTimer.unref());
  }
  _onDrain() {
    (this.writeBuffer.splice(0, this._prevBufferLen),
      (this._prevBufferLen = 0),
      this.writeBuffer.length === 0
        ? this.emitReserved("drain")
        : this.flush());
  }
  flush() {
    if (
      this.readyState !== "closed" &&
      this.transport.writable &&
      !this.upgrading &&
      this.writeBuffer.length
    ) {
      const t = this._getWritablePackets();
      (this.transport.send(t),
        (this._prevBufferLen = t.length),
        this.emitReserved("flush"));
    }
  }
  _getWritablePackets() {
    if (
      !(
        this._maxPayload &&
        this.transport.name === "polling" &&
        this.writeBuffer.length > 1
      )
    )
      return this.writeBuffer;
    let n = 1;
    for (let s = 0; s < this.writeBuffer.length; s++) {
      const r = this.writeBuffer[s].data;
      if ((r && (n += bn(r)), s > 0 && n > this._maxPayload))
        return this.writeBuffer.slice(0, s);
      n += 2;
    }
    return this.writeBuffer;
  }
  _hasPingExpired() {
    if (!this._pingTimeoutTime) return !0;
    const t = Date.now() > this._pingTimeoutTime;
    return (
      t &&
        ((this._pingTimeoutTime = 0),
        St(() => {
          this._onClose("ping timeout");
        }, this.setTimeoutFn)),
      t
    );
  }
  write(t, n, s) {
    return (this._sendPacket("message", t, n, s), this);
  }
  send(t, n, s) {
    return (this._sendPacket("message", t, n, s), this);
  }
  _sendPacket(t, n, s, r) {
    if (
      (typeof n == "function" && ((r = n), (n = void 0)),
      typeof s == "function" && ((r = s), (s = null)),
      this.readyState === "closing" || this.readyState === "closed")
    )
      return;
    ((s = s || {}), (s.compress = s.compress !== !1));
    const i = { type: t, data: n, options: s };
    (this.emitReserved("packetCreate", i),
      this.writeBuffer.push(i),
      r && this.once("flush", r),
      this.flush());
  }
  close() {
    const t = () => {
        (this._onClose("forced close"), this.transport.close());
      },
      n = () => {
        (this.off("upgrade", n), this.off("upgradeError", n), t());
      },
      s = () => {
        (this.once("upgrade", n), this.once("upgradeError", n));
      };
    return (
      (this.readyState === "opening" || this.readyState === "open") &&
        ((this.readyState = "closing"),
        this.writeBuffer.length
          ? this.once("drain", () => {
              this.upgrading ? s() : t();
            })
          : this.upgrading
            ? s()
            : t()),
      this
    );
  }
  _onError(t) {
    if (
      ((nt.priorWebsocketSuccess = !1),
      this.opts.tryAllTransports &&
        this.transports.length > 1 &&
        this.readyState === "opening")
    )
      return (this.transports.shift(), this._open());
    (this.emitReserved("error", t), this._onClose("transport error", t));
  }
  _onClose(t, n) {
    if (
      this.readyState === "opening" ||
      this.readyState === "open" ||
      this.readyState === "closing"
    ) {
      if (
        (this.clearTimeoutFn(this._pingTimeoutTimer),
        this.transport.removeAllListeners("close"),
        this.transport.close(),
        this.transport.removeAllListeners(),
        Wt &&
          (this._beforeunloadEventListener &&
            removeEventListener(
              "beforeunload",
              this._beforeunloadEventListener,
              !1,
            ),
          this._offlineEventListener))
      ) {
        const s = _t.indexOf(this._offlineEventListener);
        s !== -1 && _t.splice(s, 1);
      }
      ((this.readyState = "closed"),
        (this.id = null),
        this.emitReserved("close", t, n),
        (this.writeBuffer = []),
        (this._prevBufferLen = 0));
    }
  }
}
nt.protocol = De;
class Vn extends nt {
  constructor() {
    (super(...arguments), (this._upgrades = []));
  }
  onOpen() {
    if ((super.onOpen(), this.readyState === "open" && this.opts.upgrade))
      for (let t = 0; t < this._upgrades.length; t++)
        this._probe(this._upgrades[t]);
  }
  _probe(t) {
    let n = this.createTransport(t),
      s = !1;
    nt.priorWebsocketSuccess = !1;
    const r = () => {
      s ||
        (n.send([{ type: "ping", data: "probe" }]),
        n.once("packet", (h) => {
          if (!s)
            if (h.type === "pong" && h.data === "probe") {
              if (
                ((this.upgrading = !0), this.emitReserved("upgrading", n), !n)
              )
                return;
              ((nt.priorWebsocketSuccess = n.name === "websocket"),
                this.transport.pause(() => {
                  s ||
                    (this.readyState !== "closed" &&
                      (f(),
                      this.setTransport(n),
                      n.send([{ type: "upgrade" }]),
                      this.emitReserved("upgrade", n),
                      (n = null),
                      (this.upgrading = !1),
                      this.flush()));
                }));
            } else {
              const p = new Error("probe error");
              ((p.transport = n.name), this.emitReserved("upgradeError", p));
            }
        }));
    };
    function i() {
      s || ((s = !0), f(), n.close(), (n = null));
    }
    const o = (h) => {
      const p = new Error("probe error: " + h);
      ((p.transport = n.name), i(), this.emitReserved("upgradeError", p));
    };
    function l() {
      o("transport closed");
    }
    function a() {
      o("socket closed");
    }
    function c(h) {
      n && h.name !== n.name && i();
    }
    const f = () => {
      (n.removeListener("open", r),
        n.removeListener("error", o),
        n.removeListener("close", l),
        this.off("close", a),
        this.off("upgrading", c));
    };
    (n.once("open", r),
      n.once("error", o),
      n.once("close", l),
      this.once("close", a),
      this.once("upgrading", c),
      this._upgrades.indexOf("webtransport") !== -1 && t !== "webtransport"
        ? this.setTimeoutFn(() => {
            s || n.open();
          }, 200)
        : n.open());
  }
  onHandshake(t) {
    ((this._upgrades = this._filterUpgrades(t.upgrades)), super.onHandshake(t));
  }
  _filterUpgrades(t) {
    const n = [];
    for (let s = 0; s < t.length; s++)
      ~this.transports.indexOf(t[s]) && n.push(t[s]);
    return n;
  }
}
let Un = class extends Vn {
  constructor(t, n = {}) {
    const s = typeof t == "object" ? t : n;
    ((!s.transports || (s.transports && typeof s.transports[0] == "string")) &&
      (s.transports = (s.transports || ["polling", "websocket", "webtransport"])
        .map((r) => Dn[r])
        .filter((r) => !!r)),
      super(t, s));
  }
};
function Hn(e, t = "", n) {
  let s = e;
  ((n = n || (typeof location < "u" && location)),
    e == null && (e = n.protocol + "//" + n.host),
    typeof e == "string" &&
      (e.charAt(0) === "/" &&
        (e.charAt(1) === "/" ? (e = n.protocol + e) : (e = n.host + e)),
      /^(https?|wss?):\/\//.test(e) ||
        (typeof n < "u" ? (e = n.protocol + "//" + e) : (e = "https://" + e)),
      (s = $t(e))),
    s.port ||
      (/^(http|ws)$/.test(s.protocol)
        ? (s.port = "80")
        : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")),
    (s.path = s.path || "/"));
  const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
  return (
    (s.id = s.protocol + "://" + i + ":" + s.port + t),
    (s.href =
      s.protocol + "://" + i + (n && n.port === s.port ? "" : ":" + s.port)),
    s
  );
}
const $n = typeof ArrayBuffer == "function",
  Wn = (e) =>
    typeof ArrayBuffer.isView == "function"
      ? ArrayBuffer.isView(e)
      : e.buffer instanceof ArrayBuffer,
  Ue = Object.prototype.toString,
  zn =
    typeof Blob == "function" ||
    (typeof Blob < "u" && Ue.call(Blob) === "[object BlobConstructor]"),
  Yn =
    typeof File == "function" ||
    (typeof File < "u" && Ue.call(File) === "[object FileConstructor]");
function ee(e) {
  return (
    ($n && (e instanceof ArrayBuffer || Wn(e))) ||
    (zn && e instanceof Blob) ||
    (Yn && e instanceof File)
  );
}
function bt(e, t) {
  if (!e || typeof e != "object") return !1;
  if (Array.isArray(e)) {
    for (let n = 0, s = e.length; n < s; n++) if (bt(e[n])) return !0;
    return !1;
  }
  if (ee(e)) return !0;
  if (e.toJSON && typeof e.toJSON == "function" && arguments.length === 1)
    return bt(e.toJSON(), !0);
  for (const n in e)
    if (Object.prototype.hasOwnProperty.call(e, n) && bt(e[n])) return !0;
  return !1;
}
function Kn(e) {
  const t = [],
    n = e.data,
    s = e;
  return (
    (s.data = zt(n, t)),
    (s.attachments = t.length),
    { packet: s, buffers: t }
  );
}
function zt(e, t) {
  if (!e) return e;
  if (ee(e)) {
    const n = { _placeholder: !0, num: t.length };
    return (t.push(e), n);
  } else if (Array.isArray(e)) {
    const n = new Array(e.length);
    for (let s = 0; s < e.length; s++) n[s] = zt(e[s], t);
    return n;
  } else if (typeof e == "object" && !(e instanceof Date)) {
    const n = {};
    for (const s in e)
      Object.prototype.hasOwnProperty.call(e, s) && (n[s] = zt(e[s], t));
    return n;
  }
  return e;
}
function Xn(e, t) {
  return ((e.data = Yt(e.data, t)), delete e.attachments, e);
}
function Yt(e, t) {
  if (!e) return e;
  if (e && e._placeholder === !0) {
    if (typeof e.num == "number" && e.num >= 0 && e.num < t.length)
      return t[e.num];
    throw new Error("illegal attachments");
  } else if (Array.isArray(e))
    for (let n = 0; n < e.length; n++) e[n] = Yt(e[n], t);
  else if (typeof e == "object")
    for (const n in e)
      Object.prototype.hasOwnProperty.call(e, n) && (e[n] = Yt(e[n], t));
  return e;
}
const jn = [
  "connect",
  "connect_error",
  "disconnect",
  "disconnecting",
  "newListener",
  "removeListener",
];
var E;
(function (e) {
  ((e[(e.CONNECT = 0)] = "CONNECT"),
    (e[(e.DISCONNECT = 1)] = "DISCONNECT"),
    (e[(e.EVENT = 2)] = "EVENT"),
    (e[(e.ACK = 3)] = "ACK"),
    (e[(e.CONNECT_ERROR = 4)] = "CONNECT_ERROR"),
    (e[(e.BINARY_EVENT = 5)] = "BINARY_EVENT"),
    (e[(e.BINARY_ACK = 6)] = "BINARY_ACK"));
})(E || (E = {}));
class Jn {
  constructor(t) {
    this.replacer = t;
  }
  encode(t) {
    return (t.type === E.EVENT || t.type === E.ACK) && bt(t)
      ? this.encodeAsBinary({
          type: t.type === E.EVENT ? E.BINARY_EVENT : E.BINARY_ACK,
          nsp: t.nsp,
          data: t.data,
          id: t.id,
        })
      : [this.encodeAsString(t)];
  }
  encodeAsString(t) {
    let n = "" + t.type;
    return (
      (t.type === E.BINARY_EVENT || t.type === E.BINARY_ACK) &&
        (n += t.attachments + "-"),
      t.nsp && t.nsp !== "/" && (n += t.nsp + ","),
      t.id != null && (n += t.id),
      t.data != null && (n += JSON.stringify(t.data, this.replacer)),
      n
    );
  }
  encodeAsBinary(t) {
    const n = Kn(t),
      s = this.encodeAsString(n.packet),
      r = n.buffers;
    return (r.unshift(s), r);
  }
}
class ne extends L {
  constructor(t) {
    (super(),
      (this.opts = Object.assign(
        { reviver: void 0, maxAttachments: 10 },
        typeof t == "function" ? { reviver: t } : t,
      )));
  }
  add(t) {
    let n;
    if (typeof t == "string") {
      if (this.reconstructor)
        throw new Error("got plaintext data when reconstructing a packet");
      n = this.decodeString(t);
      const s = n.type === E.BINARY_EVENT;
      s || n.type === E.BINARY_ACK
        ? ((n.type = s ? E.EVENT : E.ACK),
          (this.reconstructor = new Qn(n)),
          n.attachments === 0 && super.emitReserved("decoded", n))
        : super.emitReserved("decoded", n);
    } else if (ee(t) || t.base64)
      if (this.reconstructor)
        ((n = this.reconstructor.takeBinaryData(t)),
          n && ((this.reconstructor = null), super.emitReserved("decoded", n)));
      else throw new Error("got binary data when not reconstructing a packet");
    else throw new Error("Unknown type: " + t);
  }
  decodeString(t) {
    let n = 0;
    const s = { type: Number(t.charAt(0)) };
    if (E[s.type] === void 0) throw new Error("unknown packet type " + s.type);
    if (s.type === E.BINARY_EVENT || s.type === E.BINARY_ACK) {
      const i = n + 1;
      for (; t.charAt(++n) !== "-" && n != t.length; );
      const o = t.substring(i, n);
      if (o != Number(o) || t.charAt(n) !== "-")
        throw new Error("Illegal attachments");
      const l = Number(o);
      if (!Gn(l) || l < 0) throw new Error("Illegal attachments");
      if (l > this.opts.maxAttachments) throw new Error("too many attachments");
      s.attachments = l;
    }
    if (t.charAt(n + 1) === "/") {
      const i = n + 1;
      for (; ++n && !(t.charAt(n) === "," || n === t.length); );
      s.nsp = t.substring(i, n);
    } else s.nsp = "/";
    const r = t.charAt(n + 1);
    if (r !== "" && Number(r) == r) {
      const i = n + 1;
      for (; ++n; ) {
        const o = t.charAt(n);
        if (o == null || Number(o) != o) {
          --n;
          break;
        }
        if (n === t.length) break;
      }
      s.id = Number(t.substring(i, n + 1));
    }
    if (t.charAt(++n)) {
      const i = this.tryParse(t.substr(n));
      if (ne.isPayloadValid(s.type, i)) s.data = i;
      else throw new Error("invalid payload");
    }
    return s;
  }
  tryParse(t) {
    try {
      return JSON.parse(t, this.opts.reviver);
    } catch {
      return !1;
    }
  }
  static isPayloadValid(t, n) {
    switch (t) {
      case E.CONNECT:
        return me(n);
      case E.DISCONNECT:
        return n === void 0;
      case E.CONNECT_ERROR:
        return typeof n == "string" || me(n);
      case E.EVENT:
      case E.BINARY_EVENT:
        return (
          Array.isArray(n) &&
          (typeof n[0] == "number" ||
            (typeof n[0] == "string" && jn.indexOf(n[0]) === -1))
        );
      case E.ACK:
      case E.BINARY_ACK:
        return Array.isArray(n);
    }
  }
  destroy() {
    this.reconstructor &&
      (this.reconstructor.finishedReconstruction(),
      (this.reconstructor = null));
  }
}
class Qn {
  constructor(t) {
    ((this.packet = t), (this.buffers = []), (this.reconPack = t));
  }
  takeBinaryData(t) {
    if (
      (this.buffers.push(t), this.buffers.length === this.reconPack.attachments)
    ) {
      const n = Xn(this.reconPack, this.buffers);
      return (this.finishedReconstruction(), n);
    }
    return null;
  }
  finishedReconstruction() {
    ((this.reconPack = null), (this.buffers = []));
  }
}
const Gn =
  Number.isInteger ||
  function (e) {
    return typeof e == "number" && isFinite(e) && Math.floor(e) === e;
  };
function me(e) {
  return Object.prototype.toString.call(e) === "[object Object]";
}
const Zn = Object.freeze(
  Object.defineProperty(
    {
      __proto__: null,
      Decoder: ne,
      Encoder: Jn,
      get PacketType() {
        return E;
      },
    },
    Symbol.toStringTag,
    { value: "Module" },
  ),
);
function z(e, t, n) {
  return (
    e.on(t, n),
    function () {
      e.off(t, n);
    }
  );
}
const ts = Object.freeze({
  connect: 1,
  connect_error: 1,
  disconnect: 1,
  disconnecting: 1,
  newListener: 1,
  removeListener: 1,
});
class He extends L {
  constructor(t, n, s) {
    (super(),
      (this.connected = !1),
      (this.recovered = !1),
      (this.receiveBuffer = []),
      (this.sendBuffer = []),
      (this._queue = []),
      (this._queueSeq = 0),
      (this.ids = 0),
      (this.acks = {}),
      (this.flags = {}),
      (this.io = t),
      (this.nsp = n),
      s && s.auth && (this.auth = s.auth),
      (this._opts = Object.assign({}, s)),
      this.io._autoConnect && this.open());
  }
  get disconnected() {
    return !this.connected;
  }
  subEvents() {
    if (this.subs) return;
    const t = this.io;
    this.subs = [
      z(t, "open", this.onopen.bind(this)),
      z(t, "packet", this.onpacket.bind(this)),
      z(t, "error", this.onerror.bind(this)),
      z(t, "close", this.onclose.bind(this)),
    ];
  }
  get active() {
    return !!this.subs;
  }
  connect() {
    return this.connected
      ? this
      : (this.subEvents(),
        this.io._reconnecting || this.io.open(),
        this.io._readyState === "open" && this.onopen(),
        this);
  }
  open() {
    return this.connect();
  }
  send(...t) {
    return (t.unshift("message"), this.emit.apply(this, t), this);
  }
  emit(t, ...n) {
    var s, r, i;
    if (ts.hasOwnProperty(t))
      throw new Error('"' + t.toString() + '" is a reserved event name');
    if (
      (n.unshift(t),
      this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
    )
      return (this._addToQueue(n), this);
    const o = { type: E.EVENT, data: n };
    if (
      ((o.options = {}),
      (o.options.compress = this.flags.compress !== !1),
      typeof n[n.length - 1] == "function")
    ) {
      const f = this.ids++,
        h = n.pop();
      (this._registerAckCallback(f, h), (o.id = f));
    }
    const l =
        (r =
          (s = this.io.engine) === null || s === void 0
            ? void 0
            : s.transport) === null || r === void 0
          ? void 0
          : r.writable,
      a =
        this.connected &&
        !(
          !((i = this.io.engine) === null || i === void 0) &&
          i._hasPingExpired()
        );
    return (
      (this.flags.volatile && !l) ||
        (a
          ? (this.notifyOutgoingListeners(o), this.packet(o))
          : this.sendBuffer.push(o)),
      (this.flags = {}),
      this
    );
  }
  _registerAckCallback(t, n) {
    var s;
    const r =
      (s = this.flags.timeout) !== null && s !== void 0
        ? s
        : this._opts.ackTimeout;
    if (r === void 0) {
      this.acks[t] = n;
      return;
    }
    const i = this.io.setTimeoutFn(() => {
        delete this.acks[t];
        for (let l = 0; l < this.sendBuffer.length; l++)
          this.sendBuffer[l].id === t && this.sendBuffer.splice(l, 1);
        n.call(this, new Error("operation has timed out"));
      }, r),
      o = (...l) => {
        (this.io.clearTimeoutFn(i), n.apply(this, l));
      };
    ((o.withError = !0), (this.acks[t] = o));
  }
  emitWithAck(t, ...n) {
    return new Promise((s, r) => {
      const i = (o, l) => (o ? r(o) : s(l));
      ((i.withError = !0), n.push(i), this.emit(t, ...n));
    });
  }
  _addToQueue(t) {
    let n;
    typeof t[t.length - 1] == "function" && (n = t.pop());
    const s = {
      id: this._queueSeq++,
      tryCount: 0,
      pending: !1,
      args: t,
      flags: Object.assign({ fromQueue: !0 }, this.flags),
    };
    (t.push(
      (r, ...i) => (
        this._queue[0],
        r !== null
          ? s.tryCount > this._opts.retries && (this._queue.shift(), n && n(r))
          : (this._queue.shift(), n && n(null, ...i)),
        (s.pending = !1),
        this._drainQueue()
      ),
    ),
      this._queue.push(s),
      this._drainQueue());
  }
  _drainQueue(t = !1) {
    if (!this.connected || this._queue.length === 0) return;
    const n = this._queue[0];
    (n.pending && !t) ||
      ((n.pending = !0),
      n.tryCount++,
      (this.flags = n.flags),
      this.emit.apply(this, n.args));
  }
  packet(t) {
    ((t.nsp = this.nsp), this.io._packet(t));
  }
  onopen() {
    typeof this.auth == "function"
      ? this.auth((t) => {
          this._sendConnectPacket(t);
        })
      : this._sendConnectPacket(this.auth);
  }
  _sendConnectPacket(t) {
    this.packet({
      type: E.CONNECT,
      data: this._pid
        ? Object.assign({ pid: this._pid, offset: this._lastOffset }, t)
        : t,
    });
  }
  onerror(t) {
    this.connected || this.emitReserved("connect_error", t);
  }
  onclose(t, n) {
    ((this.connected = !1),
      delete this.id,
      this.emitReserved("disconnect", t, n),
      this._clearAcks());
  }
  _clearAcks() {
    Object.keys(this.acks).forEach((t) => {
      if (!this.sendBuffer.some((s) => String(s.id) === t)) {
        const s = this.acks[t];
        (delete this.acks[t],
          s.withError &&
            s.call(this, new Error("socket has been disconnected")));
      }
    });
  }
  onpacket(t) {
    if (t.nsp === this.nsp)
      switch (t.type) {
        case E.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 E.EVENT:
        case E.BINARY_EVENT:
          this.onevent(t);
          break;
        case E.ACK:
        case E.BINARY_ACK:
          this.onack(t);
          break;
        case E.DISCONNECT:
          this.ondisconnect();
          break;
        case E.CONNECT_ERROR:
          this.destroy();
          const s = new Error(t.data.message);
          ((s.data = t.data.data), this.emitReserved("connect_error", s));
          break;
      }
  }
  onevent(t) {
    const n = t.data || [];
    (t.id != null && n.push(this.ack(t.id)),
      this.connected
        ? this.emitEvent(n)
        : this.receiveBuffer.push(Object.freeze(n)));
  }
  emitEvent(t) {
    if (this._anyListeners && this._anyListeners.length) {
      const n = this._anyListeners.slice();
      for (const s of n) s.apply(this, t);
    }
    (super.emit.apply(this, t),
      this._pid &&
        t.length &&
        typeof t[t.length - 1] == "string" &&
        (this._lastOffset = t[t.length - 1]));
  }
  ack(t) {
    const n = this;
    let s = !1;
    return function (...r) {
      s || ((s = !0), n.packet({ type: E.ACK, id: t, data: r }));
    };
  }
  onack(t) {
    const n = this.acks[t.id];
    typeof n == "function" &&
      (delete this.acks[t.id],
      n.withError && t.data.unshift(null),
      n.apply(this, t.data));
  }
  onconnect(t, n) {
    ((this.id = t),
      (this.recovered = n && this._pid === n),
      (this._pid = n),
      (this.connected = !0),
      this.emitBuffered(),
      this._drainQueue(!0),
      this.emitReserved("connect"));
  }
  emitBuffered() {
    (this.receiveBuffer.forEach((t) => this.emitEvent(t)),
      (this.receiveBuffer = []),
      this.sendBuffer.forEach((t) => {
        (this.notifyOutgoingListeners(t), this.packet(t));
      }),
      (this.sendBuffer = []));
  }
  ondisconnect() {
    (this.destroy(), this.onclose("io server disconnect"));
  }
  destroy() {
    (this.subs && (this.subs.forEach((t) => t()), (this.subs = void 0)),
      this.io._destroy(this));
  }
  disconnect() {
    return (
      this.connected && this.packet({ type: E.DISCONNECT }),
      this.destroy(),
      this.connected && this.onclose("io client disconnect"),
      this
    );
  }
  close() {
    return this.disconnect();
  }
  compress(t) {
    return ((this.flags.compress = t), this);
  }
  get volatile() {
    return ((this.flags.volatile = !0), this);
  }
  timeout(t) {
    return ((this.flags.timeout = t), this);
  }
  onAny(t) {
    return (
      (this._anyListeners = this._anyListeners || []),
      this._anyListeners.push(t),
      this
    );
  }
  prependAny(t) {
    return (
      (this._anyListeners = this._anyListeners || []),
      this._anyListeners.unshift(t),
      this
    );
  }
  offAny(t) {
    if (!this._anyListeners) return this;
    if (t) {
      const n = this._anyListeners;
      for (let s = 0; s < n.length; s++)
        if (t === n[s]) return (n.splice(s, 1), this);
    } else this._anyListeners = [];
    return this;
  }
  listenersAny() {
    return this._anyListeners || [];
  }
  onAnyOutgoing(t) {
    return (
      (this._anyOutgoingListeners = this._anyOutgoingListeners || []),
      this._anyOutgoingListeners.push(t),
      this
    );
  }
  prependAnyOutgoing(t) {
    return (
      (this._anyOutgoingListeners = this._anyOutgoingListeners || []),
      this._anyOutgoingListeners.unshift(t),
      this
    );
  }
  offAnyOutgoing(t) {
    if (!this._anyOutgoingListeners) return this;
    if (t) {
      const n = this._anyOutgoingListeners;
      for (let s = 0; s < n.length; s++)
        if (t === n[s]) return (n.splice(s, 1), this);
    } else this._anyOutgoingListeners = [];
    return this;
  }
  listenersAnyOutgoing() {
    return this._anyOutgoingListeners || [];
  }
  notifyOutgoingListeners(t) {
    if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) {
      const n = this._anyOutgoingListeners.slice();
      for (const s of n) s.apply(this, t.data);
    }
  }
}
function lt(e) {
  ((e = e || {}),
    (this.ms = e.min || 100),
    (this.max = e.max || 1e4),
    (this.factor = e.factor || 2),
    (this.jitter = e.jitter > 0 && e.jitter <= 1 ? e.jitter : 0),
    (this.attempts = 0));
}
lt.prototype.duration = function () {
  var e = this.ms * Math.pow(this.factor, this.attempts++);
  if (this.jitter) {
    var t = Math.random(),
      n = Math.floor(t * this.jitter * e);
    e = (Math.floor(t * 10) & 1) == 0 ? e - n : e + n;
  }
  return Math.min(e, this.max) | 0;
};
lt.prototype.reset = function () {
  this.attempts = 0;
};
lt.prototype.setMin = function (e) {
  this.ms = e;
};
lt.prototype.setMax = function (e) {
  this.max = e;
};
lt.prototype.setJitter = function (e) {
  this.jitter = e;
};
class Kt extends L {
  constructor(t, n) {
    var s;
    (super(),
      (this.nsps = {}),
      (this.subs = []),
      t && typeof t == "object" && ((n = t), (t = void 0)),
      (n = n || {}),
      (n.path = n.path || "/socket.io"),
      (this.opts = n),
      Tt(this, n),
      this.reconnection(n.reconnection !== !1),
      this.reconnectionAttempts(n.reconnectionAttempts || 1 / 0),
      this.reconnectionDelay(n.reconnectionDelay || 1e3),
      this.reconnectionDelayMax(n.reconnectionDelayMax || 5e3),
      this.randomizationFactor(
        (s = n.randomizationFactor) !== null && s !== void 0 ? s : 0.5,
      ),
      (this.backoff = new lt({
        min: this.reconnectionDelay(),
        max: this.reconnectionDelayMax(),
        jitter: this.randomizationFactor(),
      })),
      this.timeout(n.timeout == null ? 2e4 : n.timeout),
      (this._readyState = "closed"),
      (this.uri = t));
    const r = n.parser || Zn;
    ((this.encoder = new r.Encoder()),
      (this.decoder = new r.Decoder()),
      (this._autoConnect = n.autoConnect !== !1),
      this._autoConnect && this.open());
  }
  reconnection(t) {
    return arguments.length
      ? ((this._reconnection = !!t), t || (this.skipReconnect = !0), this)
      : this._reconnection;
  }
  reconnectionAttempts(t) {
    return t === void 0
      ? this._reconnectionAttempts
      : ((this._reconnectionAttempts = t), this);
  }
  reconnectionDelay(t) {
    var n;
    return t === void 0
      ? this._reconnectionDelay
      : ((this._reconnectionDelay = t),
        (n = this.backoff) === null || n === void 0 || n.setMin(t),
        this);
  }
  randomizationFactor(t) {
    var n;
    return t === void 0
      ? this._randomizationFactor
      : ((this._randomizationFactor = t),
        (n = this.backoff) === null || n === void 0 || n.setJitter(t),
        this);
  }
  reconnectionDelayMax(t) {
    var n;
    return t === void 0
      ? this._reconnectionDelayMax
      : ((this._reconnectionDelayMax = t),
        (n = this.backoff) === null || n === void 0 || n.setMax(t),
        this);
  }
  timeout(t) {
    return arguments.length ? ((this._timeout = t), this) : this._timeout;
  }
  maybeReconnectOnOpen() {
    !this._reconnecting &&
      this._reconnection &&
      this.backoff.attempts === 0 &&
      this.reconnect();
  }
  open(t) {
    if (~this._readyState.indexOf("open")) return this;
    this.engine = new Un(this.uri, this.opts);
    const n = this.engine,
      s = this;
    ((this._readyState = "opening"), (this.skipReconnect = !1));
    const r = z(n, "open", function () {
        (s.onopen(), t && t());
      }),
      i = (l) => {
        (this.cleanup(),
          (this._readyState = "closed"),
          this.emitReserved("error", l),
          t ? t(l) : this.maybeReconnectOnOpen());
      },
      o = z(n, "error", i);
    if (this._timeout !== !1) {
      const l = this._timeout,
        a = this.setTimeoutFn(() => {
          (r(), i(new Error("timeout")), n.close());
        }, l);
      (this.opts.autoUnref && a.unref(),
        this.subs.push(() => {
          this.clearTimeoutFn(a);
        }));
    }
    return (this.subs.push(r), this.subs.push(o), this);
  }
  connect(t) {
    return this.open(t);
  }
  onopen() {
    (this.cleanup(), (this._readyState = "open"), this.emitReserved("open"));
    const t = this.engine;
    this.subs.push(
      z(t, "ping", this.onping.bind(this)),
      z(t, "data", this.ondata.bind(this)),
      z(t, "error", this.onerror.bind(this)),
      z(t, "close", this.onclose.bind(this)),
      z(this.decoder, "decoded", this.ondecoded.bind(this)),
    );
  }
  onping() {
    this.emitReserved("ping");
  }
  ondata(t) {
    try {
      this.decoder.add(t);
    } catch (n) {
      this.onclose("parse error", n);
    }
  }
  ondecoded(t) {
    St(() => {
      this.emitReserved("packet", t);
    }, this.setTimeoutFn);
  }
  onerror(t) {
    this.emitReserved("error", t);
  }
  socket(t, n) {
    let s = this.nsps[t];
    return (
      s
        ? this._autoConnect && !s.active && s.connect()
        : ((s = new He(this, t, n)), (this.nsps[t] = s)),
      s
    );
  }
  _destroy(t) {
    const n = Object.keys(this.nsps);
    for (const s of n) if (this.nsps[s].active) return;
    this._close();
  }
  _packet(t) {
    const n = this.encoder.encode(t);
    for (let s = 0; s < n.length; s++) this.engine.write(n[s], t.options);
  }
  cleanup() {
    (this.subs.forEach((t) => t()),
      (this.subs.length = 0),
      this.decoder.destroy());
  }
  _close() {
    ((this.skipReconnect = !0),
      (this._reconnecting = !1),
      this.onclose("forced close"));
  }
  disconnect() {
    return this._close();
  }
  onclose(t, n) {
    var s;
    (this.cleanup(),
      (s = this.engine) === null || s === void 0 || s.close(),
      this.backoff.reset(),
      (this._readyState = "closed"),
      this.emitReserved("close", t, n),
      this._reconnection && !this.skipReconnect && this.reconnect());
  }
  reconnect() {
    if (this._reconnecting || this.skipReconnect) return this;
    const t = this;
    if (this.backoff.attempts >= this._reconnectionAttempts)
      (this.backoff.reset(),
        this.emitReserved("reconnect_failed"),
        (this._reconnecting = !1));
    else {
      const n = this.backoff.duration();
      this._reconnecting = !0;
      const s = this.setTimeoutFn(() => {
        t.skipReconnect ||
          (this.emitReserved("reconnect_attempt", t.backoff.attempts),
          !t.skipReconnect &&
            t.open((r) => {
              r
                ? ((t._reconnecting = !1),
                  t.reconnect(),
                  this.emitReserved("reconnect_error", r))
                : t.onreconnect();
            }));
      }, n);
      (this.opts.autoUnref && s.unref(),
        this.subs.push(() => {
          this.clearTimeoutFn(s);
        }));
    }
  }
  onreconnect() {
    const t = this.backoff.attempts;
    ((this._reconnecting = !1),
      this.backoff.reset(),
      this.emitReserved("reconnect", t));
  }
}
const ht = {};
function qt(e, t) {
  (typeof e == "object" && ((t = e), (e = void 0)), (t = t || {}));
  const n = Hn(e, t.path || "/socket.io"),
    s = n.source,
    r = n.id,
    i = n.path,
    o = ht[r] && i in ht[r].nsps,
    l = t.forceNew || t["force new connection"] || t.multiplex === !1 || o;
  let a;
  return (
    l ? (a = new Kt(s, t)) : (ht[r] || (ht[r] = new Kt(s, t)), (a = ht[r])),
    n.query && !t.query && (t.query = n.queryKey),
    a.socket(n.path, t)
  );
}
Object.assign(qt, { Manager: Kt, Socket: He, io: qt, connect: qt });
const Q = new Uint32Array(65536),
  es = (e, t) => {
    const n = e.length,
      s = t.length,
      r = 1 << (n - 1);
    let i = -1,
      o = 0,
      l = n,
      a = n;
    for (; a--; ) Q[e.charCodeAt(a)] |= 1 << a;
    for (a = 0; a < s; a++) {
      let c = Q[t.charCodeAt(a)];
      const f = c | o;
      ((c |= ((c & i) + i) ^ i),
        (o |= ~(c | i)),
        (i &= c),
        o & r && l++,
        i & r && l--,
        (o = (o << 1) | 1),
        (i = (i << 1) | ~(f | o)),
        (o &= f));
    }
    for (a = n; a--; ) Q[e.charCodeAt(a)] = 0;
    return l;
  },
  ns = (e, t) => {
    const n = t.length,
      s = e.length,
      r = [],
      i = [],
      o = Math.ceil(n / 32),
      l = Math.ceil(s / 32);
    for (let d = 0; d < o; d++) ((i[d] = -1), (r[d] = 0));
    let a = 0;
    for (; a < l - 1; a++) {
      let d = 0,
        g = -1;
      const _ = a * 32,
        v = Math.min(32, s) + _;
      for (let m = _; m < v; m++) Q[e.charCodeAt(m)] |= 1 << m;
      for (let m = 0; m < n; m++) {
        const y = Q[t.charCodeAt(m)],
          w = (i[(m / 32) | 0] >>> m) & 1,
          x = (r[(m / 32) | 0] >>> m) & 1,
          R = y | d,
          A = ((((y | x) & g) + g) ^ g) | y | x;
        let C = d | ~(A | g),
          k = g & A;
        ((C >>> 31) ^ w && (i[(m / 32) | 0] ^= 1 << m),
          (k >>> 31) ^ x && (r[(m / 32) | 0] ^= 1 << m),
          (C = (C << 1) | w),
          (k = (k << 1) | x),
          (g = k | ~(R | C)),
          (d = C & R));
      }
      for (let m = _; m < v; m++) Q[e.charCodeAt(m)] = 0;
    }
    let c = 0,
      f = -1;
    const h = a * 32,
      p = Math.min(32, s - h) + h;
    for (let d = h; d < p; d++) Q[e.charCodeAt(d)] |= 1 << d;
    let u = s;
    for (let d = 0; d < n; d++) {
      const g = Q[t.charCodeAt(d)],
        _ = (i[(d / 32) | 0] >>> d) & 1,
        v = (r[(d / 32) | 0] >>> d) & 1,
        m = g | c,
        y = ((((g | v) & f) + f) ^ f) | g | v;
      let w = c | ~(y | f),
        x = f & y;
      ((u += (w >>> (s - 1)) & 1),
        (u -= (x >>> (s - 1)) & 1),
        (w >>> 31) ^ _ && (i[(d / 32) | 0] ^= 1 << d),
        (x >>> 31) ^ v && (r[(d / 32) | 0] ^= 1 << d),
        (w = (w << 1) | _),
        (x = (x << 1) | v),
        (f = x | ~(m | w)),
        (c = w & m));
    }
    for (let d = h; d < p; d++) Q[e.charCodeAt(d)] = 0;
    return u;
  },
  mr = (e, t) => {
    if (e.length < t.length) {
      const n = t;
      ((t = e), (e = n));
    }
    return t.length === 0 ? e.length : e.length <= 32 ? es(e, t) : ns(e, t);
  };
function kt() {
  return typeof window < "u";
}
function ft(e) {
  return $e(e) ? (e.nodeName || "").toLowerCase() : "#document";
}
function U(e) {
  var t;
  return (
    (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) ||
    window
  );
}
function J(e) {
  var t;
  return (t = ($e(e) ? e.ownerDocument : e.document) || window.document) == null
    ? void 0
    : t.documentElement;
}
function $e(e) {
  return kt() ? e instanceof Node || e instanceof U(e).Node : !1;
}
function I(e) {
  return kt() ? e instanceof Element || e instanceof U(e).Element : !1;
}
function tt(e) {
  return kt() ? e instanceof HTMLElement || e instanceof U(e).HTMLElement : !1;
}
function ge(e) {
  return !kt() || typeof ShadowRoot > "u"
    ? !1
    : e instanceof ShadowRoot || e instanceof U(e).ShadowRoot;
}
function mt(e) {
  const { overflow: t, overflowX: n, overflowY: s, display: r } = W(e);
  return (
    /auto|scroll|overlay|hidden|clip/.test(t + s + n) &&
    r !== "inline" &&
    r !== "contents"
  );
}
function ss(e) {
  return /^(table|td|th)$/.test(ft(e));
}
function Lt(e) {
  try {
    if (e.matches(":popover-open")) return !0;
  } catch {}
  try {
    return e.matches(":modal");
  } catch {
    return !1;
  }
}
const rs = /transform|translate|scale|rotate|perspective|filter/,
  is = /paint|layout|strict|content/,
  it = (e) => !!e && e !== "none";
let It;
function se(e) {
  const t = I(e) ? W(e) : e;
  return (
    it(t.transform) ||
    it(t.translate) ||
    it(t.scale) ||
    it(t.rotate) ||
    it(t.perspective) ||
    (!re() && (it(t.backdropFilter) || it(t.filter))) ||
    rs.test(t.willChange || "") ||
    is.test(t.contain || "")
  );
}
function os(e) {
  let t = st(e);
  for (; tt(t) && !at(t); ) {
    if (se(t)) return t;
    if (Lt(t)) return null;
    t = st(t);
  }
  return null;
}
function re() {
  return (
    It == null &&
      (It =
        typeof CSS < "u" &&
        CSS.supports &&
        CSS.supports("-webkit-backdrop-filter", "none")),
    It
  );
}
function at(e) {
  return /^(html|body|#document)$/.test(ft(e));
}
function W(e) {
  return U(e).getComputedStyle(e);
}
function Pt(e) {
  return I(e)
    ? { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop }
    : { scrollLeft: e.scrollX, scrollTop: e.scrollY };
}
function st(e) {
  if (ft(e) === "html") return e;
  const t = e.assignedSlot || e.parentNode || (ge(e) && e.host) || J(e);
  return ge(t) ? t.host : t;
}
function We(e) {
  const t = st(e);
  return at(t)
    ? e.ownerDocument
      ? e.ownerDocument.body
      : e.body
    : tt(t) && mt(t)
      ? t
      : We(t);
}
function pt(e, t, n) {
  var s;
  (t === void 0 && (t = []), n === void 0 && (n = !0));
  const r = We(e),
    i = r === ((s = e.ownerDocument) == null ? void 0 : s.body),
    o = U(r);
  if (i) {
    const l = Xt(o);
    return t.concat(
      o,
      o.visualViewport || [],
      mt(r) ? r : [],
      l && n ? pt(l) : [],
    );
  } else return t.concat(r, pt(r, [], n));
}
function Xt(e) {
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
}
const cs = ["top", "right", "bottom", "left"],
  rt = Math.min,
  V = Math.max,
  Rt = Math.round,
  wt = Math.floor,
  X = (e) => ({ x: e, y: e }),
  as = { left: "right", right: "left", bottom: "top", top: "bottom" };
function jt(e, t, n) {
  return V(e, rt(t, n));
}
function G(e, t) {
  return typeof e == "function" ? e(t) : e;
}
function Z(e) {
  return e.split("-")[0];
}
function ut(e) {
  return e.split("-")[1];
}
function ie(e) {
  return e === "x" ? "y" : "x";
}
function oe(e) {
  return e === "y" ? "height" : "width";
}
function Y(e) {
  const t = e[0];
  return t === "t" || t === "b" ? "y" : "x";
}
function ce(e) {
  return ie(Y(e));
}
function ls(e, t, n) {
  n === void 0 && (n = !1);
  const s = ut(e),
    r = ce(e),
    i = oe(r);
  let o =
    r === "x"
      ? s === (n ? "end" : "start")
        ? "right"
        : "left"
      : s === "start"
        ? "bottom"
        : "top";
  return (t.reference[i] > t.floating[i] && (o = Et(o)), [o, Et(o)]);
}
function fs(e) {
  const t = Et(e);
  return [Jt(e), t, Jt(t)];
}
function Jt(e) {
  return e.includes("start")
    ? e.replace("start", "end")
    : e.replace("end", "start");
}
const ye = ["left", "right"],
  we = ["right", "left"],
  us = ["top", "bottom"],
  hs = ["bottom", "top"];
function ds(e, t, n) {
  switch (e) {
    case "top":
    case "bottom":
      return n ? (t ? we : ye) : t ? ye : we;
    case "left":
    case "right":
      return t ? us : hs;
    default:
      return [];
  }
}
function ps(e, t, n, s) {
  const r = ut(e);
  let i = ds(Z(e), n === "start", s);
  return (
    r && ((i = i.map((o) => o + "-" + r)), t && (i = i.concat(i.map(Jt)))),
    i
  );
}
function Et(e) {
  const t = Z(e);
  return as[t] + e.slice(t.length);
}
function ms(e) {
  return { top: 0, right: 0, bottom: 0, left: 0, ...e };
}
function ze(e) {
  return typeof e != "number"
    ? ms(e)
    : { top: e, right: e, bottom: e, left: e };
}
function At(e) {
  const { x: t, y: n, width: s, height: r } = e;
  return {
    width: s,
    height: r,
    top: n,
    left: t,
    right: t + s,
    bottom: n + r,
    x: t,
    y: n,
  };
}
function ve(e, t, n) {
  let { reference: s, floating: r } = e;
  const i = Y(t),
    o = ce(t),
    l = oe(o),
    a = Z(t),
    c = i === "y",
    f = s.x + s.width / 2 - r.width / 2,
    h = s.y + s.height / 2 - r.height / 2,
    p = s[l] / 2 - r[l] / 2;
  let u;
  switch (a) {
    case "top":
      u = { x: f, y: s.y - r.height };
      break;
    case "bottom":
      u = { x: f, y: s.y + s.height };
      break;
    case "right":
      u = { x: s.x + s.width, y: h };
      break;
    case "left":
      u = { x: s.x - r.width, y: h };
      break;
    default:
      u = { x: s.x, y: s.y };
  }
  switch (ut(t)) {
    case "start":
      u[o] -= p * (n && c ? -1 : 1);
      break;
    case "end":
      u[o] += p * (n && c ? -1 : 1);
      break;
  }
  return u;
}
async function gs(e, t) {
  var n;
  t === void 0 && (t = {});
  const { x: s, y: r, platform: i, rects: o, elements: l, strategy: a } = e,
    {
      boundary: c = "clippingAncestors",
      rootBoundary: f = "viewport",
      elementContext: h = "floating",
      altBoundary: p = !1,
      padding: u = 0,
    } = G(t, e),
    d = ze(u),
    _ = l[p ? (h === "floating" ? "reference" : "floating") : h],
    v = At(
      await i.getClippingRect({
        element:
          (n = await (i.isElement == null ? void 0 : i.isElement(_))) == null ||
          n
            ? _
            : _.contextElement ||
              (await (i.getDocumentElement == null
                ? void 0
                : i.getDocumentElement(l.floating))),
        boundary: c,
        rootBoundary: f,
        strategy: a,
      }),
    ),
    m =
      h === "floating"
        ? { x: s, y: r, width: o.floating.width, height: o.floating.height }
        : o.reference,
    y = await (i.getOffsetParent == null
      ? void 0
      : i.getOffsetParent(l.floating)),
    w = (await (i.isElement == null ? void 0 : i.isElement(y)))
      ? (await (i.getScale == null ? void 0 : i.getScale(y))) || { x: 1, y: 1 }
      : { x: 1, y: 1 },
    x = At(
      i.convertOffsetParentRelativeRectToViewportRelativeRect
        ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
            elements: l,
            rect: m,
            offsetParent: y,
            strategy: a,
          })
        : m,
    );
  return {
    top: (v.top - x.top + d.top) / w.y,
    bottom: (x.bottom - v.bottom + d.bottom) / w.y,
    left: (v.left - x.left + d.left) / w.x,
    right: (x.right - v.right + d.right) / w.x,
  };
}
const ys = 50,
  ws = async (e, t, n) => {
    const {
        placement: s = "bottom",
        strategy: r = "absolute",
        middleware: i = [],
        platform: o,
      } = n,
      l = o.detectOverflow ? o : { ...o, detectOverflow: gs },
      a = await (o.isRTL == null ? void 0 : o.isRTL(t));
    let c = await o.getElementRects({ reference: e, floating: t, strategy: r }),
      { x: f, y: h } = ve(c, s, a),
      p = s,
      u = 0;
    const d = {};
    for (let g = 0; g < i.length; g++) {
      const _ = i[g];
      if (!_) continue;
      const { name: v, fn: m } = _,
        {
          x: y,
          y: w,
          data: x,
          reset: R,
        } = await m({
          x: f,
          y: h,
          initialPlacement: s,
          placement: p,
          strategy: r,
          middlewareData: d,
          rects: c,
          platform: l,
          elements: { reference: e, floating: t },
        });
      ((f = y ?? f),
        (h = w ?? h),
        (d[v] = { ...d[v], ...x }),
        R &&
          u < ys &&
          (u++,
          typeof R == "object" &&
            (R.placement && (p = R.placement),
            R.rects &&
              (c =
                R.rects === !0
                  ? await o.getElementRects({
                      reference: e,
                      floating: t,
                      strategy: r,
                    })
                  : R.rects),
            ({ x: f, y: h } = ve(c, p, a))),
          (g = -1)));
    }
    return { x: f, y: h, placement: p, strategy: r, middlewareData: d };
  },
  vs = (e) => ({
    name: "arrow",
    options: e,
    async fn(t) {
      const {
          x: n,
          y: s,
          placement: r,
          rects: i,
          platform: o,
          elements: l,
          middlewareData: a,
        } = t,
        { element: c, padding: f = 0 } = G(e, t) || {};
      if (c == null) return {};
      const h = ze(f),
        p = { x: n, y: s },
        u = ce(r),
        d = oe(u),
        g = await o.getDimensions(c),
        _ = u === "y",
        v = _ ? "top" : "left",
        m = _ ? "bottom" : "right",
        y = _ ? "clientHeight" : "clientWidth",
        w = i.reference[d] + i.reference[u] - p[u] - i.floating[d],
        x = p[u] - i.reference[u],
        R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c));
      let A = R ? R[y] : 0;
      (!A || !(await (o.isElement == null ? void 0 : o.isElement(R)))) &&
        (A = l.floating[y] || i.floating[d]);
      const C = w / 2 - x / 2,
        k = A / 2 - g[d] / 2 - 1,
        P = rt(h[v], k),
        q = rt(h[m], k),
        T = P,
        D = A - g[d] - q,
        S = A / 2 - g[d] / 2 + C,
        H = jt(T, S, D),
        B =
          !a.arrow &&
          ut(r) != null &&
          S !== H &&
          i.reference[d] / 2 - (S < T ? P : q) - g[d] / 2 < 0,
        N = B ? (S < T ? S - T : S - D) : 0;
      return {
        [u]: p[u] + N,
        data: {
          [u]: H,
          centerOffset: S - H - N,
          ...(B && { alignmentOffset: N }),
        },
        reset: B,
      };
    },
  }),
  _s = function (e) {
    return (
      e === void 0 && (e = {}),
      {
        name: "flip",
        options: e,
        async fn(t) {
          var n, s;
          const {
              placement: r,
              middlewareData: i,
              rects: o,
              initialPlacement: l,
              platform: a,
              elements: c,
            } = t,
            {
              mainAxis: f = !0,
              crossAxis: h = !0,
              fallbackPlacements: p,
              fallbackStrategy: u = "bestFit",
              fallbackAxisSideDirection: d = "none",
              flipAlignment: g = !0,
              ..._
            } = G(e, t);
          if ((n = i.arrow) != null && n.alignmentOffset) return {};
          const v = Z(r),
            m = Y(l),
            y = Z(l) === l,
            w = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)),
            x = p || (y || !g ? [Et(l)] : fs(l)),
            R = d !== "none";
          !p && R && x.push(...ps(l, g, d, w));
          const A = [l, ...x],
            C = await a.detectOverflow(t, _),
            k = [];
          let P = ((s = i.flip) == null ? void 0 : s.overflows) || [];
          if ((f && k.push(C[v]), h)) {
            const S = ls(r, o, w);
            k.push(C[S[0]], C[S[1]]);
          }
          if (
            ((P = [...P, { placement: r, overflows: k }]),
            !k.every((S) => S <= 0))
          ) {
            var q, T;
            const S = (((q = i.flip) == null ? void 0 : q.index) || 0) + 1,
              H = A[S];
            if (
              H &&
              (!(h === "alignment" ? m !== Y(H) : !1) ||
                P.every((O) =>
                  Y(O.placement) === m ? O.overflows[0] > 0 : !0,
                ))
            )
              return {
                data: { index: S, overflows: P },
                reset: { placement: H },
              };
            let B =
              (T = P.filter((N) => N.overflows[0] <= 0).sort(
                (N, O) => N.overflows[1] - O.overflows[1],
              )[0]) == null
                ? void 0
                : T.placement;
            if (!B)
              switch (u) {
                case "bestFit": {
                  var D;
                  const N =
                    (D = P.filter((O) => {
                      if (R) {
                        const M = Y(O.placement);
                        return M === m || M === "y";
                      }
                      return !0;
                    })
                      .map((O) => [
                        O.placement,
                        O.overflows
                          .filter((M) => M > 0)
                          .reduce((M, et) => M + et, 0),
                      ])
                      .sort((O, M) => O[1] - M[1])[0]) == null
                      ? void 0
                      : D[0];
                  N && (B = N);
                  break;
                }
                case "initialPlacement":
                  B = l;
                  break;
              }
            if (r !== B) return { reset: { placement: B } };
          }
          return {};
        },
      }
    );
  };
function _e(e, t) {
  return {
    top: e.top - t.height,
    right: e.right - t.width,
    bottom: e.bottom - t.height,
    left: e.left - t.width,
  };
}
function be(e) {
  return cs.some((t) => e[t] >= 0);
}
const bs = function (e) {
    return (
      e === void 0 && (e = {}),
      {
        name: "hide",
        options: e,
        async fn(t) {
          const { rects: n, platform: s } = t,
            { strategy: r = "referenceHidden", ...i } = G(e, t);
          switch (r) {
            case "referenceHidden": {
              const o = await s.detectOverflow(t, {
                  ...i,
                  elementContext: "reference",
                }),
                l = _e(o, n.reference);
              return {
                data: { referenceHiddenOffsets: l, referenceHidden: be(l) },
              };
            }
            case "escaped": {
              const o = await s.detectOverflow(t, { ...i, altBoundary: !0 }),
                l = _e(o, n.floating);
              return { data: { escapedOffsets: l, escaped: be(l) } };
            }
            default:
              return {};
          }
        },
      }
    );
  },
  Ye = new Set(["left", "top"]);
async function xs(e, t) {
  const { placement: n, platform: s, elements: r } = e,
    i = await (s.isRTL == null ? void 0 : s.isRTL(r.floating)),
    o = Z(n),
    l = ut(n),
    a = Y(n) === "y",
    c = Ye.has(o) ? -1 : 1,
    f = i && a ? -1 : 1,
    h = G(t, e);
  let {
    mainAxis: p,
    crossAxis: u,
    alignmentAxis: d,
  } = typeof h == "number"
    ? { mainAxis: h, crossAxis: 0, alignmentAxis: null }
    : {
        mainAxis: h.mainAxis || 0,
        crossAxis: h.crossAxis || 0,
        alignmentAxis: h.alignmentAxis,
      };
  return (
    l && typeof d == "number" && (u = l === "end" ? d * -1 : d),
    a ? { x: u * f, y: p * c } : { x: p * c, y: u * f }
  );
}
const Rs = function (e) {
    return (
      e === void 0 && (e = 0),
      {
        name: "offset",
        options: e,
        async fn(t) {
          var n, s;
          const { x: r, y: i, placement: o, middlewareData: l } = t,
            a = await xs(t, e);
          return o === ((n = l.offset) == null ? void 0 : n.placement) &&
            (s = l.arrow) != null &&
            s.alignmentOffset
            ? {}
            : { x: r + a.x, y: i + a.y, data: { ...a, placement: o } };
        },
      }
    );
  },
  Es = function (e) {
    return (
      e === void 0 && (e = {}),
      {
        name: "shift",
        options: e,
        async fn(t) {
          const { x: n, y: s, placement: r, platform: i } = t,
            {
              mainAxis: o = !0,
              crossAxis: l = !1,
              limiter: a = {
                fn: (v) => {
                  let { x: m, y } = v;
                  return { x: m, y };
                },
              },
              ...c
            } = G(e, t),
            f = { x: n, y: s },
            h = await i.detectOverflow(t, c),
            p = Y(Z(r)),
            u = ie(p);
          let d = f[u],
            g = f[p];
          if (o) {
            const v = u === "y" ? "top" : "left",
              m = u === "y" ? "bottom" : "right",
              y = d + h[v],
              w = d - h[m];
            d = jt(y, d, w);
          }
          if (l) {
            const v = p === "y" ? "top" : "left",
              m = p === "y" ? "bottom" : "right",
              y = g + h[v],
              w = g - h[m];
            g = jt(y, g, w);
          }
          const _ = a.fn({ ...t, [u]: d, [p]: g });
          return {
            ..._,
            data: { x: _.x - n, y: _.y - s, enabled: { [u]: o, [p]: l } },
          };
        },
      }
    );
  },
  As = function (e) {
    return (
      e === void 0 && (e = {}),
      {
        options: e,
        fn(t) {
          const { x: n, y: s, placement: r, rects: i, middlewareData: o } = t,
            { offset: l = 0, mainAxis: a = !0, crossAxis: c = !0 } = G(e, t),
            f = { x: n, y: s },
            h = Y(r),
            p = ie(h);
          let u = f[p],
            d = f[h];
          const g = G(l, t),
            _ =
              typeof g == "number"
                ? { mainAxis: g, crossAxis: 0 }
                : { mainAxis: 0, crossAxis: 0, ...g };
          if (a) {
            const y = p === "y" ? "height" : "width",
              w = i.reference[p] - i.floating[y] + _.mainAxis,
              x = i.reference[p] + i.reference[y] - _.mainAxis;
            u < w ? (u = w) : u > x && (u = x);
          }
          if (c) {
            var v, m;
            const y = p === "y" ? "width" : "height",
              w = Ye.has(Z(r)),
              x =
                i.reference[h] -
                i.floating[y] +
                ((w && ((v = o.offset) == null ? void 0 : v[h])) || 0) +
                (w ? 0 : _.crossAxis),
              R =
                i.reference[h] +
                i.reference[y] +
                (w ? 0 : ((m = o.offset) == null ? void 0 : m[h]) || 0) -
                (w ? _.crossAxis : 0);
            d < x ? (d = x) : d > R && (d = R);
          }
          return { [p]: u, [h]: d };
        },
      }
    );
  },
  Os = function (e) {
    return (
      e === void 0 && (e = {}),
      {
        name: "size",
        options: e,
        async fn(t) {
          var n, s;
          const { placement: r, rects: i, platform: o, elements: l } = t,
            { apply: a = () => {}, ...c } = G(e, t),
            f = await o.detectOverflow(t, c),
            h = Z(r),
            p = ut(r),
            u = Y(r) === "y",
            { width: d, height: g } = i.floating;
          let _, v;
          h === "top" || h === "bottom"
            ? ((_ = h),
              (v =
                p ===
                ((await (o.isRTL == null ? void 0 : o.isRTL(l.floating)))
                  ? "start"
                  : "end")
                  ? "left"
                  : "right"))
            : ((v = h), (_ = p === "end" ? "top" : "bottom"));
          const m = g - f.top - f.bottom,
            y = d - f.left - f.right,
            w = rt(g - f[_], m),
            x = rt(d - f[v], y),
            R = !t.middlewareData.shift;
          let A = w,
            C = x;
          if (
            ((n = t.middlewareData.shift) != null && n.enabled.x && (C = y),
            (s = t.middlewareData.shift) != null && s.enabled.y && (A = m),
            R && !p)
          ) {
            const P = V(f.left, 0),
              q = V(f.right, 0),
              T = V(f.top, 0),
              D = V(f.bottom, 0);
            u
              ? (C = d - 2 * (P !== 0 || q !== 0 ? P + q : V(f.left, f.right)))
              : (A = g - 2 * (T !== 0 || D !== 0 ? T + D : V(f.top, f.bottom)));
          }
          await a({ ...t, availableWidth: C, availableHeight: A });
          const k = await o.getDimensions(l.floating);
          return d !== k.width || g !== k.height
            ? { reset: { rects: !0 } }
            : {};
        },
      }
    );
  };
function Ke(e) {
  const t = W(e);
  let n = parseFloat(t.width) || 0,
    s = parseFloat(t.height) || 0;
  const r = tt(e),
    i = r ? e.offsetWidth : n,
    o = r ? e.offsetHeight : s,
    l = Rt(n) !== i || Rt(s) !== o;
  return (l && ((n = i), (s = o)), { width: n, height: s, $: l });
}
function ae(e) {
  return I(e) ? e : e.contextElement;
}
function ct(e) {
  const t = ae(e);
  if (!tt(t)) return X(1);
  const n = t.getBoundingClientRect(),
    { width: s, height: r, $: i } = Ke(t);
  let o = (i ? Rt(n.width) : n.width) / s,
    l = (i ? Rt(n.height) : n.height) / r;
  return (
    (!o || !Number.isFinite(o)) && (o = 1),
    (!l || !Number.isFinite(l)) && (l = 1),
    { x: o, y: l }
  );
}
const Cs = X(0);
function Xe(e) {
  const t = U(e);
  return !re() || !t.visualViewport
    ? Cs
    : { x: t.visualViewport.offsetLeft, y: t.visualViewport.offsetTop };
}
function Ss(e, t, n) {
  return (t === void 0 && (t = !1), !n || (t && n !== U(e)) ? !1 : t);
}
function ot(e, t, n, s) {
  (t === void 0 && (t = !1), n === void 0 && (n = !1));
  const r = e.getBoundingClientRect(),
    i = ae(e);
  let o = X(1);
  t && (s ? I(s) && (o = ct(s)) : (o = ct(e)));
  const l = Ss(i, n, s) ? Xe(i) : X(0);
  let a = (r.left + l.x) / o.x,
    c = (r.top + l.y) / o.y,
    f = r.width / o.x,
    h = r.height / o.y;
  if (i) {
    const p = U(i),
      u = s && I(s) ? U(s) : s;
    let d = p,
      g = Xt(d);
    for (; g && s && u !== d; ) {
      const _ = ct(g),
        v = g.getBoundingClientRect(),
        m = W(g),
        y = v.left + (g.clientLeft + parseFloat(m.paddingLeft)) * _.x,
        w = v.top + (g.clientTop + parseFloat(m.paddingTop)) * _.y;
      ((a *= _.x),
        (c *= _.y),
        (f *= _.x),
        (h *= _.y),
        (a += y),
        (c += w),
        (d = U(g)),
        (g = Xt(d)));
    }
  }
  return At({ width: f, height: h, x: a, y: c });
}
function Bt(e, t) {
  const n = Pt(e).scrollLeft;
  return t ? t.left + n : ot(J(e)).left + n;
}
function je(e, t) {
  const n = e.getBoundingClientRect(),
    s = n.left + t.scrollLeft - Bt(e, n),
    r = n.top + t.scrollTop;
  return { x: s, y: r };
}
function Ts(e) {
  let { elements: t, rect: n, offsetParent: s, strategy: r } = e;
  const i = r === "fixed",
    o = J(s),
    l = t ? Lt(t.floating) : !1;
  if (s === o || (l && i)) return n;
  let a = { scrollLeft: 0, scrollTop: 0 },
    c = X(1);
  const f = X(0),
    h = tt(s);
  if ((h || (!h && !i)) && ((ft(s) !== "body" || mt(o)) && (a = Pt(s)), h)) {
    const u = ot(s);
    ((c = ct(s)), (f.x = u.x + s.clientLeft), (f.y = u.y + s.clientTop));
  }
  const p = o && !h && !i ? je(o, a) : X(0);
  return {
    width: n.width * c.x,
    height: n.height * c.y,
    x: n.x * c.x - a.scrollLeft * c.x + f.x + p.x,
    y: n.y * c.y - a.scrollTop * c.y + f.y + p.y,
  };
}
function ks(e) {
  return Array.from(e.getClientRects());
}
function Ls(e) {
  const t = J(e),
    n = Pt(e),
    s = e.ownerDocument.body,
    r = V(t.scrollWidth, t.clientWidth, s.scrollWidth, s.clientWidth),
    i = V(t.scrollHeight, t.clientHeight, s.scrollHeight, s.clientHeight);
  let o = -n.scrollLeft + Bt(e);
  const l = -n.scrollTop;
  return (
    W(s).direction === "rtl" && (o += V(t.clientWidth, s.clientWidth) - r),
    { width: r, height: i, x: o, y: l }
  );
}
const xe = 25;
function Ps(e, t) {
  const n = U(e),
    s = J(e),
    r = n.visualViewport;
  let i = s.clientWidth,
    o = s.clientHeight,
    l = 0,
    a = 0;
  if (r) {
    ((i = r.width), (o = r.height));
    const f = re();
    (!f || (f && t === "fixed")) && ((l = r.offsetLeft), (a = r.offsetTop));
  }
  const c = Bt(s);
  if (c <= 0) {
    const f = s.ownerDocument,
      h = f.body,
      p = getComputedStyle(h),
      u =
        (f.compatMode === "CSS1Compat" &&
          parseFloat(p.marginLeft) + parseFloat(p.marginRight)) ||
        0,
      d = Math.abs(s.clientWidth - h.clientWidth - u);
    d <= xe && (i -= d);
  } else c <= xe && (i += c);
  return { width: i, height: o, x: l, y: a };
}
function Bs(e, t) {
  const n = ot(e, !0, t === "fixed"),
    s = n.top + e.clientTop,
    r = n.left + e.clientLeft,
    i = tt(e) ? ct(e) : X(1),
    o = e.clientWidth * i.x,
    l = e.clientHeight * i.y,
    a = r * i.x,
    c = s * i.y;
  return { width: o, height: l, x: a, y: c };
}
function Re(e, t, n) {
  let s;
  if (t === "viewport") s = Ps(e, n);
  else if (t === "document") s = Ls(J(e));
  else if (I(t)) s = Bs(t, n);
  else {
    const r = Xe(e);
    s = { x: t.x - r.x, y: t.y - r.y, width: t.width, height: t.height };
  }
  return At(s);
}
function Je(e, t) {
  const n = st(e);
  return n === t || !I(n) || at(n) ? !1 : W(n).position === "fixed" || Je(n, t);
}
function Ns(e, t) {
  const n = t.get(e);
  if (n) return n;
  let s = pt(e, [], !1).filter((l) => I(l) && ft(l) !== "body"),
    r = null;
  const i = W(e).position === "fixed";
  let o = i ? st(e) : e;
  for (; I(o) && !at(o); ) {
    const l = W(o),
      a = se(o);
    (!a && l.position === "fixed" && (r = null),
      (
        i
          ? !a && !r
          : (!a &&
              l.position === "static" &&
              !!r &&
              (r.position === "absolute" || r.position === "fixed")) ||
            (mt(o) && !a && Je(e, o))
      )
        ? (s = s.filter((f) => f !== o))
        : (r = l),
      (o = st(o)));
  }
  return (t.set(e, s), s);
}
function Ds(e) {
  let { element: t, boundary: n, rootBoundary: s, strategy: r } = e;
  const o = [
      ...(n === "clippingAncestors"
        ? Lt(t)
          ? []
          : Ns(t, this._c)
        : [].concat(n)),
      s,
    ],
    l = Re(t, o[0], r);
  let a = l.top,
    c = l.right,
    f = l.bottom,
    h = l.left;
  for (let p = 1; p < o.length; p++) {
    const u = Re(t, o[p], r);
    ((a = V(u.top, a)),
      (c = rt(u.right, c)),
      (f = rt(u.bottom, f)),
      (h = V(u.left, h)));
  }
  return { width: c - h, height: f - a, x: h, y: a };
}
function Ms(e) {
  const { width: t, height: n } = Ke(e);
  return { width: t, height: n };
}
function Fs(e, t, n) {
  const s = tt(t),
    r = J(t),
    i = n === "fixed",
    o = ot(e, !0, i, t);
  let l = { scrollLeft: 0, scrollTop: 0 };
  const a = X(0);
  function c() {
    a.x = Bt(r);
  }
  if (s || (!s && !i))
    if (((ft(t) !== "body" || mt(r)) && (l = Pt(t)), s)) {
      const u = ot(t, !0, i, t);
      ((a.x = u.x + t.clientLeft), (a.y = u.y + t.clientTop));
    } else r && c();
  i && !s && r && c();
  const f = r && !s && !i ? je(r, l) : X(0),
    h = o.left + l.scrollLeft - a.x - f.x,
    p = o.top + l.scrollTop - a.y - f.y;
  return { x: h, y: p, width: o.width, height: o.height };
}
function Vt(e) {
  return W(e).position === "static";
}
function Ee(e, t) {
  if (!tt(e) || W(e).position === "fixed") return null;
  if (t) return t(e);
  let n = e.offsetParent;
  return (J(e) === n && (n = n.ownerDocument.body), n);
}
function Qe(e, t) {
  const n = U(e);
  if (Lt(e)) return n;
  if (!tt(e)) {
    let r = st(e);
    for (; r && !at(r); ) {
      if (I(r) && !Vt(r)) return r;
      r = st(r);
    }
    return n;
  }
  let s = Ee(e, t);
  for (; s && ss(s) && Vt(s); ) s = Ee(s, t);
  return s && at(s) && Vt(s) && !se(s) ? n : s || os(e) || n;
}
const qs = async function (e) {
  const t = this.getOffsetParent || Qe,
    n = this.getDimensions,
    s = await n(e.floating);
  return {
    reference: Fs(e.reference, await t(e.floating), e.strategy),
    floating: { x: 0, y: 0, width: s.width, height: s.height },
  };
};
function Is(e) {
  return W(e).direction === "rtl";
}
const Vs = {
  convertOffsetParentRelativeRectToViewportRelativeRect: Ts,
  getDocumentElement: J,
  getClippingRect: Ds,
  getOffsetParent: Qe,
  getElementRects: qs,
  getClientRects: ks,
  getDimensions: Ms,
  getScale: ct,
  isElement: I,
  isRTL: Is,
};
function Ge(e, t) {
  return (
    e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height
  );
}
function Us(e, t) {
  let n = null,
    s;
  const r = J(e);
  function i() {
    var l;
    (clearTimeout(s), (l = n) == null || l.disconnect(), (n = null));
  }
  function o(l, a) {
    (l === void 0 && (l = !1), a === void 0 && (a = 1), i());
    const c = e.getBoundingClientRect(),
      { left: f, top: h, width: p, height: u } = c;
    if ((l || t(), !p || !u)) return;
    const d = wt(h),
      g = wt(r.clientWidth - (f + p)),
      _ = wt(r.clientHeight - (h + u)),
      v = wt(f),
      y = {
        rootMargin: -d + "px " + -g + "px " + -_ + "px " + -v + "px",
        threshold: V(0, rt(1, a)) || 1,
      };
    let w = !0;
    function x(R) {
      const A = R[0].intersectionRatio;
      if (A !== a) {
        if (!w) return o();
        A
          ? o(!1, A)
          : (s = setTimeout(() => {
              o(!1, 1e-7);
            }, 1e3));
      }
      (A === 1 && !Ge(c, e.getBoundingClientRect()) && o(), (w = !1));
    }
    try {
      n = new IntersectionObserver(x, { ...y, root: r.ownerDocument });
    } catch {
      n = new IntersectionObserver(x, y);
    }
    n.observe(e);
  }
  return (o(!0), i);
}
function gr(e, t, n, s) {
  s === void 0 && (s = {});
  const {
      ancestorScroll: r = !0,
      ancestorResize: i = !0,
      elementResize: o = typeof ResizeObserver == "function",
      layoutShift: l = typeof IntersectionObserver == "function",
      animationFrame: a = !1,
    } = s,
    c = ae(e),
    f = r || i ? [...(c ? pt(c) : []), ...(t ? pt(t) : [])] : [];
  f.forEach((v) => {
    (r && v.addEventListener("scroll", n, { passive: !0 }),
      i && v.addEventListener("resize", n));
  });
  const h = c && l ? Us(c, n) : null;
  let p = -1,
    u = null;
  o &&
    ((u = new ResizeObserver((v) => {
      let [m] = v;
      (m &&
        m.target === c &&
        u &&
        t &&
        (u.unobserve(t),
        cancelAnimationFrame(p),
        (p = requestAnimationFrame(() => {
          var y;
          (y = u) == null || y.observe(t);
        }))),
        n());
    })),
    c && !a && u.observe(c),
    t && u.observe(t));
  let d,
    g = a ? ot(e) : null;
  a && _();
  function _() {
    const v = ot(e);
    (g && !Ge(g, v) && n(), (g = v), (d = requestAnimationFrame(_)));
  }
  return (
    n(),
    () => {
      var v;
      (f.forEach((m) => {
        (r && m.removeEventListener("scroll", n),
          i && m.removeEventListener("resize", n));
      }),
        h?.(),
        (v = u) == null || v.disconnect(),
        (u = null),
        a && cancelAnimationFrame(d));
    }
  );
}
const Hs = Rs,
  $s = Es,
  Ws = _s,
  zs = Os,
  Ys = bs,
  Ae = vs,
  Ks = As,
  Xs = (e, t, n) => {
    const s = new Map(),
      r = { platform: Vs, ...n },
      i = { ...r.platform, _c: s };
    return ws(e, t, { ...r, platform: i });
  };
var js = typeof document < "u",
  Js = function () {},
  xt = js ? b.useLayoutEffect : Js;
function Ot(e, t) {
  if (e === t) return !0;
  if (typeof e != typeof t) return !1;
  if (typeof e == "function" && e.toString() === t.toString()) return !0;
  let n, s, r;
  if (e && t && typeof e == "object") {
    if (Array.isArray(e)) {
      if (((n = e.length), n !== t.length)) return !1;
      for (s = n; s-- !== 0; ) if (!Ot(e[s], t[s])) return !1;
      return !0;
    }
    if (((r = Object.keys(e)), (n = r.length), n !== Object.keys(t).length))
      return !1;
    for (s = n; s-- !== 0; ) if (!{}.hasOwnProperty.call(t, r[s])) return !1;
    for (s = n; s-- !== 0; ) {
      const i = r[s];
      if (!(i === "_owner" && e.$$typeof) && !Ot(e[i], t[i])) return !1;
    }
    return !0;
  }
  return e !== e && t !== t;
}
function Ze(e) {
  return typeof window > "u"
    ? 1
    : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
}
function Oe(e, t) {
  const n = Ze(e);
  return Math.round(t * n) / n;
}
function Ut(e) {
  const t = b.useRef(e);
  return (
    xt(() => {
      t.current = e;
    }),
    t
  );
}
function Qs(e) {
  e === void 0 && (e = {});
  const {
      placement: t = "bottom",
      strategy: n = "absolute",
      middleware: s = [],
      platform: r,
      elements: { reference: i, floating: o } = {},
      transform: l = !0,
      whileElementsMounted: a,
      open: c,
    } = e,
    [f, h] = b.useState({
      x: 0,
      y: 0,
      strategy: n,
      placement: t,
      middlewareData: {},
      isPositioned: !1,
    }),
    [p, u] = b.useState(s);
  Ot(p, s) || u(s);
  const [d, g] = b.useState(null),
    [_, v] = b.useState(null),
    m = b.useCallback((O) => {
      O !== R.current && ((R.current = O), g(O));
    }, []),
    y = b.useCallback((O) => {
      O !== A.current && ((A.current = O), v(O));
    }, []),
    w = i || d,
    x = o || _,
    R = b.useRef(null),
    A = b.useRef(null),
    C = b.useRef(f),
    k = a != null,
    P = Ut(a),
    q = Ut(r),
    T = Ut(c),
    D = b.useCallback(() => {
      if (!R.current || !A.current) return;
      const O = { placement: t, strategy: n, middleware: p };
      (q.current && (O.platform = q.current),
        Xs(R.current, A.current, O).then((M) => {
          const et = { ...M, isPositioned: T.current !== !1 };
          S.current &&
            !Ot(C.current, et) &&
            ((C.current = et),
            Te.flushSync(() => {
              h(et);
            }));
        }));
    }, [p, t, n, q, T]);
  xt(() => {
    c === !1 &&
      C.current.isPositioned &&
      ((C.current.isPositioned = !1), h((O) => ({ ...O, isPositioned: !1 })));
  }, [c]);
  const S = b.useRef(!1);
  (xt(
    () => (
      (S.current = !0),
      () => {
        S.current = !1;
      }
    ),
    [],
  ),
    xt(() => {
      if ((w && (R.current = w), x && (A.current = x), w && x)) {
        if (P.current) return P.current(w, x, D);
        D();
      }
    }, [w, x, D, P, k]));
  const H = b.useMemo(
      () => ({ reference: R, floating: A, setReference: m, setFloating: y }),
      [m, y],
    ),
    B = b.useMemo(() => ({ reference: w, floating: x }), [w, x]),
    N = b.useMemo(() => {
      const O = { position: n, left: 0, top: 0 };
      if (!B.floating) return O;
      const M = Oe(B.floating, f.x),
        et = Oe(B.floating, f.y);
      return l
        ? {
            ...O,
            transform: "translate(" + M + "px, " + et + "px)",
            ...(Ze(B.floating) >= 1.5 && { willChange: "transform" }),
          }
        : { position: n, left: M, top: et };
    }, [n, l, B.floating, f.x, f.y]);
  return b.useMemo(
    () => ({ ...f, update: D, refs: H, elements: B, floatingStyles: N }),
    [f, D, H, B, N],
  );
}
const Gs = (e) => {
    function t(n) {
      return {}.hasOwnProperty.call(n, "current");
    }
    return {
      name: "arrow",
      options: e,
      fn(n) {
        const { element: s, padding: r } = typeof e == "function" ? e(n) : e;
        return s && t(s)
          ? s.current != null
            ? Ae({ element: s.current, padding: r }).fn(n)
            : {}
          : s
            ? Ae({ element: s, padding: r }).fn(n)
            : {};
      },
    };
  },
  yr = (e, t) => {
    const n = Hs(e);
    return { name: n.name, fn: n.fn, options: [e, t] };
  },
  wr = (e, t) => {
    const n = $s(e);
    return { name: n.name, fn: n.fn, options: [e, t] };
  },
  vr = (e, t) => ({ fn: Ks(e).fn, options: [e, t] }),
  _r = (e, t) => {
    const n = Ws(e);
    return { name: n.name, fn: n.fn, options: [e, t] };
  },
  br = (e, t) => {
    const n = zs(e);
    return { name: n.name, fn: n.fn, options: [e, t] };
  },
  xr = (e, t) => {
    const n = Ys(e);
    return { name: n.name, fn: n.fn, options: [e, t] };
  },
  Rr = (e, t) => {
    const n = Gs(e);
    return { name: n.name, fn: n.fn, options: [e, t] };
  },
  tn = { ...rn },
  Zs = tn.useInsertionEffect,
  tr = Zs || ((e) => e());
function er(e) {
  const t = b.useRef(() => {});
  return (
    tr(() => {
      t.current = e;
    }),
    b.useCallback(function () {
      for (var n = arguments.length, s = new Array(n), r = 0; r < n; r++)
        s[r] = arguments[r];
      return t.current == null ? void 0 : t.current(...s);
    }, [])
  );
}
var Ct = typeof document < "u" ? b.useLayoutEffect : b.useEffect;
function Qt() {
  return (
    (Qt = Object.assign
      ? Object.assign.bind()
      : function (e) {
          for (var t = 1; t < arguments.length; t++) {
            var n = arguments[t];
            for (var s in n)
              Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]);
          }
          return e;
        }),
    Qt.apply(this, arguments)
  );
}
let Ce = !1,
  nr = 0;
const Se = () => "floating-ui-" + Math.random().toString(36).slice(2, 6) + nr++;
function sr() {
  const [e, t] = b.useState(() => (Ce ? Se() : void 0));
  return (
    Ct(() => {
      e == null && t(Se());
    }, []),
    b.useEffect(() => {
      Ce = !0;
    }, []),
    e
  );
}
const rr = tn.useId,
  en = rr || sr,
  Er = b.forwardRef(function (t, n) {
    const {
        context: {
          placement: s,
          elements: { floating: r },
          middlewareData: { arrow: i, shift: o },
        },
        width: l = 14,
        height: a = 7,
        tipRadius: c = 0,
        strokeWidth: f = 0,
        staticOffset: h,
        stroke: p,
        d: u,
        style: { transform: d, ...g } = {},
        ..._
      } = t,
      v = en(),
      [m, y] = b.useState(!1);
    if (
      (Ct(() => {
        if (!r) return;
        W(r).direction === "rtl" && y(!0);
      }, [r]),
      !r)
    )
      return null;
    const [w, x] = s.split("-"),
      R = w === "top" || w === "bottom";
    let A = h;
    ((R && o != null && o.x) || (!R && o != null && o.y)) && (A = null);
    const C = f * 2,
      k = C / 2,
      P = (l / 2) * (c / -8 + 1),
      q = ((a / 2) * c) / 4,
      T = !!u,
      D = A && x === "end" ? "bottom" : "top";
    let S = A && x === "end" ? "right" : "left";
    A && m && (S = x === "end" ? "left" : "right");
    const H = i?.x != null ? A || i.x : "",
      B = i?.y != null ? A || i.y : "",
      N =
        u ||
        "M0,0" +
          (" H" + l) +
          (" L" + (l - P) + "," + (a - q)) +
          (" Q" + l / 2 + "," + a + " " + P + "," + (a - q)) +
          " Z",
      O = {
        top: T ? "rotate(180deg)" : "",
        left: T ? "rotate(90deg)" : "rotate(-90deg)",
        bottom: T ? "" : "rotate(180deg)",
        right: T ? "rotate(-90deg)" : "rotate(90deg)",
      }[w];
    return b.createElement(
      "svg",
      Qt({}, _, {
        "aria-hidden": !0,
        ref: n,
        width: T ? l : l + C,
        height: l,
        viewBox: "0 0 " + l + " " + (a > l ? a : l),
        style: {
          position: "absolute",
          pointerEvents: "none",
          [S]: H,
          [D]: B,
          [w]: R || T ? "100%" : "calc(100% - " + C / 2 + "px)",
          transform: [O, d].filter((M) => !!M).join(" "),
          ...g,
        },
      }),
      C > 0 &&
        b.createElement("path", {
          clipPath: "url(#" + v + ")",
          fill: "none",
          stroke: p,
          strokeWidth: C + (u ? 0 : 1),
          d: N,
        }),
      b.createElement("path", { stroke: C && !u ? _.fill : "none", d: N }),
      b.createElement(
        "clipPath",
        { id: v },
        b.createElement("rect", {
          x: -k,
          y: k * (T ? -1 : 1),
          width: l + C,
          height: l,
        }),
      ),
    );
  });
function ir() {
  const e = new Map();
  return {
    emit(t, n) {
      var s;
      (s = e.get(t)) == null || s.forEach((r) => r(n));
    },
    on(t, n) {
      e.set(t, [...(e.get(t) || []), n]);
    },
    off(t, n) {
      var s;
      e.set(
        t,
        ((s = e.get(t)) == null ? void 0 : s.filter((r) => r !== n)) || [],
      );
    },
  };
}
const or = b.createContext(null),
  cr = b.createContext(null),
  ar = () => {
    var e;
    return ((e = b.useContext(or)) == null ? void 0 : e.id) || null;
  },
  lr = () => b.useContext(cr);
function fr(e) {
  const { open: t = !1, onOpenChange: n, elements: s } = e,
    r = en(),
    i = b.useRef({}),
    [o] = b.useState(() => ir()),
    l = ar() != null,
    [a, c] = b.useState(s.reference),
    f = er((u, d, g) => {
      ((i.current.openEvent = u ? d : void 0),
        o.emit("openchange", { open: u, event: d, reason: g, nested: l }),
        n?.(u, d, g));
    }),
    h = b.useMemo(() => ({ setPositionReference: c }), []),
    p = b.useMemo(
      () => ({
        reference: a || s.reference || null,
        floating: s.floating || null,
        domReference: s.reference,
      }),
      [a, s.reference, s.floating],
    );
  return b.useMemo(
    () => ({
      dataRef: i,
      open: t,
      onOpenChange: f,
      elements: p,
      events: o,
      floatingId: r,
      refs: h,
    }),
    [t, f, p, o, r, h],
  );
}
function Ar(e) {
  e === void 0 && (e = {});
  const { nodeId: t } = e,
    n = fr({
      ...e,
      elements: { reference: null, floating: null, ...e.elements },
    }),
    s = e.rootContext || n,
    r = s.elements,
    [i, o] = b.useState(null),
    [l, a] = b.useState(null),
    f = r?.domReference || i,
    h = b.useRef(null),
    p = lr();
  Ct(() => {
    f && (h.current = f);
  }, [f]);
  const u = Qs({ ...e, elements: { ...r, ...(l && { reference: l }) } }),
    d = b.useCallback(
      (y) => {
        const w = I(y)
          ? {
              getBoundingClientRect: () => y.getBoundingClientRect(),
              contextElement: y,
            }
          : y;
        (a(w), u.refs.setReference(w));
      },
      [u.refs],
    ),
    g = b.useCallback(
      (y) => {
        ((I(y) || y === null) && ((h.current = y), o(y)),
          (I(u.refs.reference.current) ||
            u.refs.reference.current === null ||
            (y !== null && !I(y))) &&
            u.refs.setReference(y));
      },
      [u.refs],
    ),
    _ = b.useMemo(
      () => ({
        ...u.refs,
        setReference: g,
        setPositionReference: d,
        domReference: h,
      }),
      [u.refs, g, d],
    ),
    v = b.useMemo(() => ({ ...u.elements, domReference: f }), [u.elements, f]),
    m = b.useMemo(
      () => ({ ...u, ...s, refs: _, elements: v, nodeId: t }),
      [u, _, v, t, s],
    );
  return (
    Ct(() => {
      s.dataRef.current.floatingContext = m;
      const y = p?.nodesRef.current.find((w) => w.id === t);
      y && (y.context = m);
    }),
    b.useMemo(() => ({ ...u, context: m, refs: _, elements: v }), [u, _, v, m])
  );
}
var ur = "Invariant failed";
function Or(e, t) {
  if (!e) throw new Error(ur);
}
export {
  Er as F,
  dr as R,
  Rr as a,
  br as b,
  gr as c,
  cn as d,
  Qs as e,
  _r as f,
  vr as g,
  xr as h,
  Or as i,
  mr as j,
  qt as l,
  yr as o,
  Te as r,
  wr as s,
  Ar as u,
};
