import { h as Gt, ak as Dr, a2 as Yn, $ as Zt } from "./index-BpgHIKBe.mjs";
import { i as qn, b as Zn, d as Qn, e as ti, f as ei, g as ri, h as ni, j as ii, k as si, l as oi, m as ai, w as $r, r as Kr, c as fi } from "./index-DCDfhwO6.mjs";
import { e as ci } from "./events-DdSBahX7.mjs";
function Ur(t = 0) {
  return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t);
}
function ui(t, r) {
  r || (r = t.reduce((o, h) => o + h.length, 0));
  const n = Ur(r);
  let c = 0;
  for (const o of t)
    n.set(o, c), c += o.length;
  return n;
}
const mr = {
  ...qn,
  ...Zn,
  ...Qn,
  ...ti,
  ...ei,
  ...ri,
  ...ni,
  ...ii,
  ...si,
  ...oi
};
function Hr(t, r, n, c) {
  return {
    name: t,
    prefix: r,
    encoder: {
      name: t,
      prefix: r,
      encode: n
    },
    decoder: { decode: c }
  };
}
const xr = Hr("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), qe = Hr("ascii", "a", (t) => {
  let r = "a";
  for (let n = 0; n < t.length; n++)
    r += String.fromCharCode(t[n]);
  return r;
}, (t) => {
  t = t.substring(1);
  const r = Ur(t.length);
  for (let n = 0; n < t.length; n++)
    r[n] = t.charCodeAt(n);
  return r;
}), Fr = {
  utf8: xr,
  "utf-8": xr,
  hex: mr.base16,
  latin1: qe,
  ascii: qe,
  binary: qe,
  ...mr
};
function me(t, r = "utf8") {
  const n = Fr[r];
  if (!n)
    throw new Error(`Unsupported encoding "${r}"`);
  return (r === "utf8" || r === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : n.decoder.decode(`${n.prefix}${t}`);
}
function We(t, r = "utf8") {
  const n = Fr[r];
  if (!n)
    throw new Error(`Unsupported encoding "${r}"`);
  return (r === "utf8" || r === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : n.encoder.encode(t).substring(1);
}
const jo = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, li = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, hi = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, di = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
function bi(t, r) {
  if (t === "__proto__" || t === "constructor" && r && typeof r == "object" && "prototype" in r) {
    gi(t);
    return;
  }
  return r;
}
function gi(t) {
  console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`);
}
function Be(t, r = {}) {
  if (typeof t != "string")
    return t;
  const n = t.trim();
  if (
    // eslint-disable-next-line unicorn/prefer-at
    t[0] === '"' && t.endsWith('"') && !t.includes("\\")
  )
    return n.slice(1, -1);
  if (n.length <= 9) {
    const c = n.toLowerCase();
    if (c === "true")
      return !0;
    if (c === "false")
      return !1;
    if (c === "undefined")
      return;
    if (c === "null")
      return null;
    if (c === "nan")
      return Number.NaN;
    if (c === "infinity")
      return Number.POSITIVE_INFINITY;
    if (c === "-infinity")
      return Number.NEGATIVE_INFINITY;
  }
  if (!di.test(t)) {
    if (r.strict)
      throw new SyntaxError("[destr] Invalid JSON");
    return t;
  }
  try {
    if (li.test(t) || hi.test(t)) {
      if (r.strict)
        throw new Error("[destr] Possible prototype pollution");
      return JSON.parse(t, bi);
    }
    return JSON.parse(t);
  } catch (c) {
    if (r.strict)
      throw c;
    return t;
  }
}
function yi(t) {
  return !t || typeof t.then != "function" ? Promise.resolve(t) : t;
}
function Ot(t, ...r) {
  try {
    return yi(t(...r));
  } catch (n) {
    return Promise.reject(n);
  }
}
function pi(t) {
  const r = typeof t;
  return t === null || r !== "object" && r !== "function";
}
function _i(t) {
  const r = Object.getPrototypeOf(t);
  return !r || r.isPrototypeOf(Object);
}
function Ke(t) {
  if (pi(t))
    return String(t);
  if (_i(t) || Array.isArray(t))
    return JSON.stringify(t);
  if (typeof t.toJSON == "function")
    return Ke(t.toJSON());
  throw new Error("[unstorage] Cannot stringify value!");
}
function Gr() {
  if (typeof Gt.Buffer > "u")
    throw new TypeError("[unstorage] Buffer is not supported!");
}
const er = "base64:";
function mi(t) {
  if (typeof t == "string")
    return t;
  Gr();
  const r = Gt.Buffer.from(t).toString("base64");
  return er + r;
}
function xi(t) {
  return typeof t != "string" || !t.startsWith(er) ? t : (Gr(), Gt.Buffer.from(t.slice(er.length), "base64"));
}
function Dt(t) {
  return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : "";
}
function wi(...t) {
  return Dt(t.join(":"));
}
function De(t) {
  return t = Dt(t), t ? t + ":" : "";
}
const vi = "memory", Si = () => {
  const t = /* @__PURE__ */ new Map();
  return {
    name: vi,
    getInstance: () => t,
    hasItem(r) {
      return t.has(r);
    },
    getItem(r) {
      return t.get(r) ?? null;
    },
    getItemRaw(r) {
      return t.get(r) ?? null;
    },
    setItem(r, n) {
      t.set(r, n);
    },
    setItemRaw(r, n) {
      t.set(r, n);
    },
    removeItem(r) {
      t.delete(r);
    },
    getKeys() {
      return [...t.keys()];
    },
    clear() {
      t.clear();
    },
    dispose() {
      t.clear();
    }
  };
};
function Ei(t = {}) {
  const r = {
    mounts: { "": t.driver || Si() },
    mountpoints: [""],
    watching: !1,
    watchListeners: [],
    unwatch: {}
  }, n = (s) => {
    for (const u of r.mountpoints)
      if (s.startsWith(u))
        return {
          base: u,
          relativeKey: s.slice(u.length),
          driver: r.mounts[u]
        };
    return {
      base: "",
      relativeKey: s,
      driver: r.mounts[""]
    };
  }, c = (s, u) => r.mountpoints.filter(
    (y) => y.startsWith(s) || u && s.startsWith(y)
  ).map((y) => ({
    relativeBase: s.length > y.length ? s.slice(y.length) : void 0,
    mountpoint: y,
    driver: r.mounts[y]
  })), o = (s, u) => {
    if (r.watching) {
      u = Dt(u);
      for (const y of r.watchListeners)
        y(s, u);
    }
  }, h = async () => {
    if (!r.watching) {
      r.watching = !0;
      for (const s in r.mounts)
        r.unwatch[s] = await wr(
          r.mounts[s],
          o,
          s
        );
    }
  }, E = async () => {
    if (r.watching) {
      for (const s in r.unwatch)
        await r.unwatch[s]();
      r.unwatch = {}, r.watching = !1;
    }
  }, S = (s, u, y) => {
    const v = /* @__PURE__ */ new Map(), w = (x) => {
      let N = v.get(x.base);
      return N || (N = {
        driver: x.driver,
        base: x.base,
        items: []
      }, v.set(x.base, N)), N;
    };
    for (const x of s) {
      const N = typeof x == "string", H = Dt(N ? x : x.key), ct = N ? void 0 : x.value, M = N || !x.options ? u : { ...u, ...x.options }, Tt = n(H);
      w(Tt).items.push({
        key: H,
        value: ct,
        relativeKey: Tt.relativeKey,
        options: M
      });
    }
    return Promise.all([...v.values()].map((x) => y(x))).then(
      (x) => x.flat()
    );
  }, g = {
    // Item
    hasItem(s, u = {}) {
      s = Dt(s);
      const { relativeKey: y, driver: v } = n(s);
      return Ot(v.hasItem, y, u);
    },
    getItem(s, u = {}) {
      s = Dt(s);
      const { relativeKey: y, driver: v } = n(s);
      return Ot(v.getItem, y, u).then(
        (w) => Be(w)
      );
    },
    getItems(s, u) {
      return S(s, u, (y) => y.driver.getItems ? Ot(
        y.driver.getItems,
        y.items.map((v) => ({
          key: v.relativeKey,
          options: v.options
        })),
        u
      ).then(
        (v) => v.map((w) => ({
          key: wi(y.base, w.key),
          value: Be(w.value)
        }))
      ) : Promise.all(
        y.items.map((v) => Ot(
          y.driver.getItem,
          v.relativeKey,
          v.options
        ).then((w) => ({
          key: v.key,
          value: Be(w)
        })))
      ));
    },
    getItemRaw(s, u = {}) {
      s = Dt(s);
      const { relativeKey: y, driver: v } = n(s);
      return v.getItemRaw ? Ot(v.getItemRaw, y, u) : Ot(v.getItem, y, u).then(
        (w) => xi(w)
      );
    },
    async setItem(s, u, y = {}) {
      if (u === void 0)
        return g.removeItem(s);
      s = Dt(s);
      const { relativeKey: v, driver: w } = n(s);
      w.setItem && (await Ot(w.setItem, v, Ke(u), y), w.watch || o("update", s));
    },
    async setItems(s, u) {
      await S(s, u, async (y) => {
        if (y.driver.setItems)
          return Ot(
            y.driver.setItems,
            y.items.map((v) => ({
              key: v.relativeKey,
              value: Ke(v.value),
              options: v.options
            })),
            u
          );
        y.driver.setItem && await Promise.all(
          y.items.map((v) => Ot(
            y.driver.setItem,
            v.relativeKey,
            Ke(v.value),
            v.options
          ))
        );
      });
    },
    async setItemRaw(s, u, y = {}) {
      if (u === void 0)
        return g.removeItem(s, y);
      s = Dt(s);
      const { relativeKey: v, driver: w } = n(s);
      if (w.setItemRaw)
        await Ot(w.setItemRaw, v, u, y);
      else if (w.setItem)
        await Ot(w.setItem, v, mi(u), y);
      else
        return;
      w.watch || o("update", s);
    },
    async removeItem(s, u = {}) {
      typeof u == "boolean" && (u = { removeMeta: u }), s = Dt(s);
      const { relativeKey: y, driver: v } = n(s);
      v.removeItem && (await Ot(v.removeItem, y, u), (u.removeMeta || u.removeMata) && await Ot(v.removeItem, y + "$", u), v.watch || o("remove", s));
    },
    // Meta
    async getMeta(s, u = {}) {
      typeof u == "boolean" && (u = { nativeOnly: u }), s = Dt(s);
      const { relativeKey: y, driver: v } = n(s), w = /* @__PURE__ */ Object.create(null);
      if (v.getMeta && Object.assign(w, await Ot(v.getMeta, y, u)), !u.nativeOnly) {
        const x = await Ot(
          v.getItem,
          y + "$",
          u
        ).then((N) => Be(N));
        x && typeof x == "object" && (typeof x.atime == "string" && (x.atime = new Date(x.atime)), typeof x.mtime == "string" && (x.mtime = new Date(x.mtime)), Object.assign(w, x));
      }
      return w;
    },
    setMeta(s, u, y = {}) {
      return this.setItem(s + "$", u, y);
    },
    removeMeta(s, u = {}) {
      return this.removeItem(s + "$", u);
    },
    // Keys
    async getKeys(s, u = {}) {
      s = De(s);
      const y = c(s, !0);
      let v = [];
      const w = [];
      for (const x of y) {
        const N = await Ot(
          x.driver.getKeys,
          x.relativeBase,
          u
        );
        for (const H of N) {
          const ct = x.mountpoint + Dt(H);
          v.some((M) => ct.startsWith(M)) || w.push(ct);
        }
        v = [
          x.mountpoint,
          ...v.filter((H) => !H.startsWith(x.mountpoint))
        ];
      }
      return s ? w.filter(
        (x) => x.startsWith(s) && x[x.length - 1] !== "$"
      ) : w.filter((x) => x[x.length - 1] !== "$");
    },
    // Utils
    async clear(s, u = {}) {
      s = De(s), await Promise.all(
        c(s, !1).map(async (y) => {
          if (y.driver.clear)
            return Ot(y.driver.clear, y.relativeBase, u);
          if (y.driver.removeItem) {
            const v = await y.driver.getKeys(y.relativeBase || "", u);
            return Promise.all(
              v.map((w) => y.driver.removeItem(w, u))
            );
          }
        })
      );
    },
    async dispose() {
      await Promise.all(
        Object.values(r.mounts).map((s) => vr(s))
      );
    },
    async watch(s) {
      return await h(), r.watchListeners.push(s), async () => {
        r.watchListeners = r.watchListeners.filter(
          (u) => u !== s
        ), r.watchListeners.length === 0 && await E();
      };
    },
    async unwatch() {
      r.watchListeners = [], await E();
    },
    // Mount
    mount(s, u) {
      if (s = De(s), s && r.mounts[s])
        throw new Error(`already mounted at ${s}`);
      return s && (r.mountpoints.push(s), r.mountpoints.sort((y, v) => v.length - y.length)), r.mounts[s] = u, r.watching && Promise.resolve(wr(u, o, s)).then((y) => {
        r.unwatch[s] = y;
      }).catch(console.error), g;
    },
    async unmount(s, u = !0) {
      s = De(s), !(!s || !r.mounts[s]) && (r.watching && s in r.unwatch && (r.unwatch[s](), delete r.unwatch[s]), u && await vr(r.mounts[s]), r.mountpoints = r.mountpoints.filter((y) => y !== s), delete r.mounts[s]);
    },
    getMount(s = "") {
      s = Dt(s) + ":";
      const u = n(s);
      return {
        driver: u.driver,
        base: u.base
      };
    },
    getMounts(s = "", u = {}) {
      return s = Dt(s), c(s, u.parents).map((v) => ({
        driver: v.driver,
        base: v.mountpoint
      }));
    },
    // Aliases
    keys: (s, u = {}) => g.getKeys(s, u),
    get: (s, u = {}) => g.getItem(s, u),
    set: (s, u, y = {}) => g.setItem(s, u, y),
    has: (s, u = {}) => g.hasItem(s, u),
    del: (s, u = {}) => g.removeItem(s, u),
    remove: (s, u = {}) => g.removeItem(s, u)
  };
  return g;
}
function wr(t, r, n) {
  return t.watch ? t.watch((c, o) => r(c, n + o)) : () => {
  };
}
async function vr(t) {
  typeof t.dispose == "function" && await Ot(t.dispose);
}
function de(t) {
  return new Promise((r, n) => {
    t.oncomplete = t.onsuccess = () => r(t.result), t.onabort = t.onerror = () => n(t.error);
  });
}
function Jr(t, r) {
  const n = indexedDB.open(t);
  n.onupgradeneeded = () => n.result.createObjectStore(r);
  const c = de(n);
  return (o, h) => c.then((E) => h(E.transaction(r, o).objectStore(r)));
}
let Ze;
function Le() {
  return Ze || (Ze = Jr("keyval-store", "keyval")), Ze;
}
function Sr(t, r = Le()) {
  return r("readonly", (n) => de(n.get(t)));
}
function Ii(t, r, n = Le()) {
  return n("readwrite", (c) => (c.put(r, t), de(c.transaction)));
}
function Oi(t, r = Le()) {
  return r("readwrite", (n) => (n.delete(t), de(n.transaction)));
}
function Ti(t = Le()) {
  return t("readwrite", (r) => (r.clear(), de(r.transaction)));
}
function Li(t, r) {
  return t.openCursor().onsuccess = function() {
    this.result && (r(this.result), this.result.continue());
  }, de(t.transaction);
}
function Ai(t = Le()) {
  return t("readonly", (r) => {
    if (r.getAllKeys)
      return de(r.getAllKeys());
    const n = [];
    return Li(r, (c) => n.push(c.key)).then(() => n);
  });
}
const Ri = (t) => JSON.stringify(t, (r, n) => typeof n == "bigint" ? n.toString() + "n" : n), Pi = (t) => {
  const r = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, n = t.replace(r, '$1"$2n"$3');
  return JSON.parse(n, (c, o) => typeof o == "string" && o.match(/^\d+n$/) ? BigInt(o.substring(0, o.length - 1)) : o);
};
function kr(t) {
  if (typeof t != "string")
    throw new Error(`Cannot safe json parse value of type ${typeof t}`);
  try {
    return Pi(t);
  } catch {
    return t;
  }
}
function Wr(t) {
  return typeof t == "string" ? t : Ri(t) || "";
}
const Ci = "idb-keyval";
var ji = (t = {}) => {
  const r = t.base && t.base.length > 0 ? `${t.base}:` : "", n = (o) => r + o;
  let c;
  return t.dbName && t.storeName && (c = Jr(t.dbName, t.storeName)), { name: Ci, options: t, async hasItem(o) {
    return !(typeof await Sr(n(o), c) > "u");
  }, async getItem(o) {
    return await Sr(n(o), c) ?? null;
  }, setItem(o, h) {
    return Ii(n(o), h, c);
  }, removeItem(o) {
    return Oi(n(o), c);
  }, getKeys() {
    return Ai(c);
  }, clear() {
    return Ti(c);
  } };
};
const Ni = "WALLET_CONNECT_V2_INDEXED_DB", Mi = "keyvaluestorage";
let zi = class {
  constructor() {
    this.indexedDb = Ei({ driver: ji({ dbName: Ni, storeName: Mi }) });
  }
  async getKeys() {
    return this.indexedDb.getKeys();
  }
  async getEntries() {
    return (await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((r) => [r.key, r.value]);
  }
  async getItem(r) {
    const n = await this.indexedDb.getItem(r);
    if (n !== null) return n;
  }
  async setItem(r, n) {
    await this.indexedDb.setItem(r, Wr(n));
  }
  async removeItem(r) {
    await this.indexedDb.removeItem(r);
  }
};
var Qe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof Gt.global < "u" ? Gt.global : typeof self < "u" ? self : {}, Ue = { exports: {} };
(function() {
  let t;
  function r() {
  }
  t = r, t.prototype.getItem = function(n) {
    return this.hasOwnProperty(n) ? String(this[n]) : null;
  }, t.prototype.setItem = function(n, c) {
    this[n] = String(c);
  }, t.prototype.removeItem = function(n) {
    delete this[n];
  }, t.prototype.clear = function() {
    const n = this;
    Object.keys(n).forEach(function(c) {
      n[c] = void 0, delete n[c];
    });
  }, t.prototype.key = function(n) {
    return n = n || 0, Object.keys(this)[n];
  }, t.prototype.__defineGetter__("length", function() {
    return Object.keys(this).length;
  }), typeof Qe < "u" && Qe.localStorage ? Ue.exports = Qe.localStorage : typeof window < "u" && window.localStorage ? Ue.exports = window.localStorage : Ue.exports = new r();
})();
function Bi(t) {
  var r;
  return [t[0], kr((r = t[1]) != null ? r : "")];
}
class Di {
  constructor() {
    this.localStorage = Ue.exports;
  }
  async getKeys() {
    return Object.keys(this.localStorage);
  }
  async getEntries() {
    return Object.entries(this.localStorage).map(Bi);
  }
  async getItem(r) {
    const n = this.localStorage.getItem(r);
    if (n !== null) return kr(n);
  }
  async setItem(r, n) {
    this.localStorage.setItem(r, Wr(n));
  }
  async removeItem(r) {
    this.localStorage.removeItem(r);
  }
}
const $i = "wc_storage_version", Er = 1, Ki = async (t, r, n) => {
  const c = $i, o = await r.getItem(c);
  if (o && o >= Er) {
    n(r);
    return;
  }
  const h = await t.getKeys();
  if (!h.length) {
    n(r);
    return;
  }
  const E = [];
  for (; h.length; ) {
    const S = h.shift();
    if (!S) continue;
    const g = S.toLowerCase();
    if (g.includes("wc@") || g.includes("walletconnect") || g.includes("wc_") || g.includes("wallet_connect")) {
      const s = await t.getItem(S);
      await r.setItem(S, s), E.push(S);
    }
  }
  await r.setItem(c, Er), n(r), Ui(t, E);
}, Ui = async (t, r) => {
  r.length && r.forEach(async (n) => {
    await t.removeItem(n);
  });
};
let Mo = class {
  constructor() {
    this.initialized = !1, this.setInitialized = (n) => {
      this.storage = n, this.initialized = !0;
    };
    const r = new Di();
    this.storage = r;
    try {
      const n = new zi();
      Ki(r, n, this.setInitialized);
    } catch {
      this.initialized = !0;
    }
  }
  async getKeys() {
    return await this.initialize(), this.storage.getKeys();
  }
  async getEntries() {
    return await this.initialize(), this.storage.getEntries();
  }
  async getItem(r) {
    return await this.initialize(), this.storage.getItem(r);
  }
  async setItem(r, n) {
    return await this.initialize(), this.storage.setItem(r, n);
  }
  async removeItem(r) {
    return await this.initialize(), this.storage.removeItem(r);
  }
  async initialize() {
    this.initialized || await new Promise((r) => {
      const n = setInterval(() => {
        this.initialized && (clearInterval(n), r());
      }, 20);
    });
  }
};
class Bo {
}
function Hi(t) {
  try {
    return JSON.stringify(t);
  } catch {
    return '"[Circular]"';
  }
}
var Fi = Gi;
function Gi(t, r, n) {
  var c = n && n.stringify || Hi, o = 1;
  if (typeof t == "object" && t !== null) {
    var h = r.length + o;
    if (h === 1) return t;
    var E = new Array(h);
    E[0] = c(t);
    for (var S = 1; S < h; S++)
      E[S] = c(r[S]);
    return E.join(" ");
  }
  if (typeof t != "string")
    return t;
  var g = r.length;
  if (g === 0) return t;
  for (var s = "", u = 1 - o, y = -1, v = t && t.length || 0, w = 0; w < v; ) {
    if (t.charCodeAt(w) === 37 && w + 1 < v) {
      switch (y = y > -1 ? y : 0, t.charCodeAt(w + 1)) {
        case 100:
        case 102:
          if (u >= g || r[u] == null) break;
          y < w && (s += t.slice(y, w)), s += Number(r[u]), y = w + 2, w++;
          break;
        case 105:
          if (u >= g || r[u] == null) break;
          y < w && (s += t.slice(y, w)), s += Math.floor(Number(r[u])), y = w + 2, w++;
          break;
        case 79:
        case 111:
        case 106:
          if (u >= g || r[u] === void 0) break;
          y < w && (s += t.slice(y, w));
          var x = typeof r[u];
          if (x === "string") {
            s += "'" + r[u] + "'", y = w + 2, w++;
            break;
          }
          if (x === "function") {
            s += r[u].name || "<anonymous>", y = w + 2, w++;
            break;
          }
          s += c(r[u]), y = w + 2, w++;
          break;
        case 115:
          if (u >= g)
            break;
          y < w && (s += t.slice(y, w)), s += String(r[u]), y = w + 2, w++;
          break;
        case 37:
          y < w && (s += t.slice(y, w)), s += "%", y = w + 2, w++, u--;
          break;
      }
      ++u;
    }
    ++w;
  }
  return y === -1 ? t : (y < v && (s += t.slice(y)), s);
}
const Ir = Fi;
var _e = Qt;
const Ie = ts().console || {}, Ji = {
  mapHttpRequest: $e,
  mapHttpResponse: $e,
  wrapRequestSerializer: tr,
  wrapResponseSerializer: tr,
  wrapErrorSerializer: tr,
  req: $e,
  res: $e,
  err: Yi
};
function ki(t, r) {
  return Array.isArray(t) ? t.filter(function(c) {
    return c !== "!stdSerializers.err";
  }) : t === !0 ? Object.keys(r) : !1;
}
function Qt(t) {
  t = t || {}, t.browser = t.browser || {};
  const r = t.browser.transmit;
  if (r && typeof r.send != "function")
    throw Error("pino: transmit option must have a send function");
  const n = t.browser.write || Ie;
  t.browser.write && (t.browser.asObject = !0);
  const c = t.serializers || {}, o = ki(t.browser.serialize, c);
  let h = t.browser.serialize;
  Array.isArray(t.browser.serialize) && t.browser.serialize.indexOf("!stdSerializers.err") > -1 && (h = !1);
  const E = ["error", "fatal", "warn", "info", "debug", "trace"];
  typeof n == "function" && (n.error = n.fatal = n.warn = n.info = n.debug = n.trace = n), t.enabled === !1 && (t.level = "silent");
  const S = t.level || "info", g = Object.create(n);
  g.log || (g.log = Oe), Object.defineProperty(g, "levelVal", {
    get: u
  }), Object.defineProperty(g, "level", {
    get: y,
    set: v
  });
  const s = {
    transmit: r,
    serialize: o,
    asObject: t.browser.asObject,
    levels: E,
    timestamp: qi(t)
  };
  g.levels = Qt.levels, g.level = S, g.setMaxListeners = g.getMaxListeners = g.emit = g.addListener = g.on = g.prependListener = g.once = g.prependOnceListener = g.removeListener = g.removeAllListeners = g.listeners = g.listenerCount = g.eventNames = g.write = g.flush = Oe, g.serializers = c, g._serialize = o, g._stdErrSerialize = h, g.child = w, r && (g._logEvent = rr());
  function u() {
    return this.level === "silent" ? 1 / 0 : this.levels.values[this.level];
  }
  function y() {
    return this._level;
  }
  function v(x) {
    if (x !== "silent" && !this.levels.values[x])
      throw Error("unknown level " + x);
    this._level = x, ye(s, g, "error", "log"), ye(s, g, "fatal", "error"), ye(s, g, "warn", "error"), ye(s, g, "info", "log"), ye(s, g, "debug", "log"), ye(s, g, "trace", "log");
  }
  function w(x, N) {
    if (!x)
      throw new Error("missing bindings for child Pino");
    N = N || {}, o && x.serializers && (N.serializers = x.serializers);
    const H = N.serializers;
    if (o && H) {
      var ct = Object.assign({}, c, H), M = t.browser.serialize === !0 ? Object.keys(ct) : o;
      delete x.serializers, Ve([x], M, ct, this._stdErrSerialize);
    }
    function Tt(bt) {
      this._childLevel = (bt._childLevel | 0) + 1, this.error = pe(bt, x, "error"), this.fatal = pe(bt, x, "fatal"), this.warn = pe(bt, x, "warn"), this.info = pe(bt, x, "info"), this.debug = pe(bt, x, "debug"), this.trace = pe(bt, x, "trace"), ct && (this.serializers = ct, this._serialize = M), r && (this._logEvent = rr(
        [].concat(bt._logEvent.bindings, x)
      ));
    }
    return Tt.prototype = this, new Tt(this);
  }
  return g;
}
Qt.levels = {
  values: {
    fatal: 60,
    error: 50,
    warn: 40,
    info: 30,
    debug: 20,
    trace: 10
  },
  labels: {
    10: "trace",
    20: "debug",
    30: "info",
    40: "warn",
    50: "error",
    60: "fatal"
  }
};
Qt.stdSerializers = Ji;
Qt.stdTimeFunctions = Object.assign({}, { nullTime: Vr, epochTime: Xr, unixTime: Zi, isoTime: Qi });
function ye(t, r, n, c) {
  const o = Object.getPrototypeOf(r);
  r[n] = r.levelVal > r.levels.values[n] ? Oe : o[n] ? o[n] : Ie[n] || Ie[c] || Oe, Wi(t, r, n);
}
function Wi(t, r, n) {
  !t.transmit && r[n] === Oe || (r[n] = /* @__PURE__ */ function(c) {
    return function() {
      const h = t.timestamp(), E = new Array(arguments.length), S = Object.getPrototypeOf && Object.getPrototypeOf(this) === Ie ? Ie : this;
      for (var g = 0; g < E.length; g++) E[g] = arguments[g];
      if (t.serialize && !t.asObject && Ve(E, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? c.call(S, Vi(this, n, E, h)) : c.apply(S, E), t.transmit) {
        const s = t.transmit.level || r.level, u = Qt.levels.values[s], y = Qt.levels.values[n];
        if (y < u) return;
        Xi(this, {
          ts: h,
          methodLevel: n,
          methodValue: y,
          transmitLevel: s,
          transmitValue: Qt.levels.values[t.transmit.level || r.level],
          send: t.transmit.send,
          val: r.levelVal
        }, E);
      }
    };
  }(r[n]));
}
function Vi(t, r, n, c) {
  t._serialize && Ve(n, t._serialize, t.serializers, t._stdErrSerialize);
  const o = n.slice();
  let h = o[0];
  const E = {};
  c && (E.time = c), E.level = Qt.levels.values[r];
  let S = (t._childLevel | 0) + 1;
  if (S < 1 && (S = 1), h !== null && typeof h == "object") {
    for (; S-- && typeof o[0] == "object"; )
      Object.assign(E, o.shift());
    h = o.length ? Ir(o.shift(), o) : void 0;
  } else typeof h == "string" && (h = Ir(o.shift(), o));
  return h !== void 0 && (E.msg = h), E;
}
function Ve(t, r, n, c) {
  for (const o in t)
    if (c && t[o] instanceof Error)
      t[o] = Qt.stdSerializers.err(t[o]);
    else if (typeof t[o] == "object" && !Array.isArray(t[o]))
      for (const h in t[o])
        r && r.indexOf(h) > -1 && h in n && (t[o][h] = n[h](t[o][h]));
}
function pe(t, r, n) {
  return function() {
    const c = new Array(1 + arguments.length);
    c[0] = r;
    for (var o = 1; o < c.length; o++)
      c[o] = arguments[o - 1];
    return t[n].apply(this, c);
  };
}
function Xi(t, r, n) {
  const c = r.send, o = r.ts, h = r.methodLevel, E = r.methodValue, S = r.val, g = t._logEvent.bindings;
  Ve(
    n,
    t._serialize || Object.keys(t.serializers),
    t.serializers,
    t._stdErrSerialize === void 0 ? !0 : t._stdErrSerialize
  ), t._logEvent.ts = o, t._logEvent.messages = n.filter(function(s) {
    return g.indexOf(s) === -1;
  }), t._logEvent.level.label = h, t._logEvent.level.value = E, c(h, t._logEvent, S), t._logEvent = rr(g);
}
function rr(t) {
  return {
    ts: 0,
    messages: [],
    bindings: t || [],
    level: { label: "", value: 0 }
  };
}
function Yi(t) {
  const r = {
    type: t.constructor.name,
    msg: t.message,
    stack: t.stack
  };
  for (const n in t)
    r[n] === void 0 && (r[n] = t[n]);
  return r;
}
function qi(t) {
  return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? Vr : Xr;
}
function $e() {
  return {};
}
function tr(t) {
  return t;
}
function Oe() {
}
function Vr() {
  return !1;
}
function Xr() {
  return Date.now();
}
function Zi() {
  return Math.round(Date.now() / 1e3);
}
function Qi() {
  return new Date(Date.now()).toISOString();
}
function ts() {
  function t(r) {
    return typeof r < "u" && r;
  }
  try {
    return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", {
      get: function() {
        return delete Object.prototype.globalThis, this.globalThis = this;
      },
      configurable: !0
    }), globalThis;
  } catch {
    return t(self) || t(window) || t(this) || {};
  }
}
const Yr = /* @__PURE__ */ Dr(_e), es = (t) => JSON.stringify(t, (r, n) => typeof n == "bigint" ? n.toString() + "n" : n);
function Or(t) {
  return typeof t == "string" ? t : es(t) || "";
}
const rs = { level: "info" }, Ae = "custom_context", or = 1e3 * 1024;
class ns {
  constructor(r) {
    this.nodeValue = r, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null;
  }
  get value() {
    return this.nodeValue;
  }
  get size() {
    return this.sizeInBytes;
  }
}
class Tr {
  constructor(r) {
    this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = r, this.sizeInBytes = 0;
  }
  append(r) {
    const n = new ns(r);
    if (n.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${r} with size ${n.size}`);
    for (; this.size + n.size > this.maxSizeInBytes; ) this.shift();
    this.head ? (this.tail && (this.tail.next = n), this.tail = n) : (this.head = n, this.tail = n), this.lengthInNodes++, this.sizeInBytes += n.size;
  }
  shift() {
    if (!this.head) return;
    const r = this.head;
    this.head = this.head.next, this.head || (this.tail = null), this.lengthInNodes--, this.sizeInBytes -= r.size;
  }
  toArray() {
    const r = [];
    let n = this.head;
    for (; n !== null; ) r.push(n.value), n = n.next;
    return r;
  }
  get length() {
    return this.lengthInNodes;
  }
  get size() {
    return this.sizeInBytes;
  }
  toOrderedArray() {
    return Array.from(this);
  }
  [Symbol.iterator]() {
    let r = this.head;
    return { next: () => {
      if (!r) return { done: !0, value: null };
      const n = r.value;
      return r = r.next, { done: !1, value: n };
    } };
  }
}
class qr {
  constructor(r, n = or) {
    this.level = r ?? "error", this.levelValue = _e.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = n, this.logs = new Tr(this.MAX_LOG_SIZE_IN_BYTES);
  }
  forwardToConsole(r, n) {
    n === _e.levels.values.error ? console.error(r) : n === _e.levels.values.warn ? console.warn(r) : n === _e.levels.values.debug ? console.debug(r) : n === _e.levels.values.trace ? console.trace(r) : console.log(r);
  }
  appendToLogs(r) {
    this.logs.append(Or({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: r }));
    const n = typeof r == "string" ? JSON.parse(r).level : r.level;
    n >= this.levelValue && this.forwardToConsole(r, n);
  }
  getLogs() {
    return this.logs;
  }
  clearLogs() {
    this.logs = new Tr(this.MAX_LOG_SIZE_IN_BYTES);
  }
  getLogArray() {
    return Array.from(this.logs);
  }
  logsToBlob(r) {
    const n = this.getLogArray();
    return n.push(Or({ extraMetadata: r })), new Blob(n, { type: "application/json" });
  }
}
class is {
  constructor(r, n = or) {
    this.baseChunkLogger = new qr(r, n);
  }
  write(r) {
    this.baseChunkLogger.appendToLogs(r);
  }
  getLogs() {
    return this.baseChunkLogger.getLogs();
  }
  clearLogs() {
    this.baseChunkLogger.clearLogs();
  }
  getLogArray() {
    return this.baseChunkLogger.getLogArray();
  }
  logsToBlob(r) {
    return this.baseChunkLogger.logsToBlob(r);
  }
  downloadLogsBlobInBrowser(r) {
    const n = URL.createObjectURL(this.logsToBlob(r)), c = document.createElement("a");
    c.href = n, c.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(n);
  }
}
class ss {
  constructor(r, n = or) {
    this.baseChunkLogger = new qr(r, n);
  }
  write(r) {
    this.baseChunkLogger.appendToLogs(r);
  }
  getLogs() {
    return this.baseChunkLogger.getLogs();
  }
  clearLogs() {
    this.baseChunkLogger.clearLogs();
  }
  getLogArray() {
    return this.baseChunkLogger.getLogArray();
  }
  logsToBlob(r) {
    return this.baseChunkLogger.logsToBlob(r);
  }
}
var os = Object.defineProperty, as = Object.defineProperties, fs = Object.getOwnPropertyDescriptors, Lr = Object.getOwnPropertySymbols, cs = Object.prototype.hasOwnProperty, us = Object.prototype.propertyIsEnumerable, Ar = (t, r, n) => r in t ? os(t, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[r] = n, He = (t, r) => {
  for (var n in r || (r = {})) cs.call(r, n) && Ar(t, n, r[n]);
  if (Lr) for (var n of Lr(r)) us.call(r, n) && Ar(t, n, r[n]);
  return t;
}, Fe = (t, r) => as(t, fs(r));
function Do(t) {
  return Fe(He({}, t), { level: (t == null ? void 0 : t.level) || rs.level });
}
function ls(t, r = Ae) {
  return t[r] || "";
}
function hs(t, r, n = Ae) {
  return t[n] = r, t;
}
function ds(t, r = Ae) {
  let n = "";
  return typeof t.bindings > "u" ? n = ls(t, r) : n = t.bindings().context || "", n;
}
function bs(t, r, n = Ae) {
  const c = ds(t, n);
  return c.trim() ? `${c}/${r}` : r;
}
function $o(t, r, n = Ae) {
  const c = bs(t, r, n), o = t.child({ context: c });
  return hs(o, c, n);
}
function gs(t) {
  var r, n;
  const c = new is((r = t.opts) == null ? void 0 : r.level, t.maxSizeInBytes);
  return { logger: Yr(Fe(He({}, t.opts), { level: "trace", browser: Fe(He({}, (n = t.opts) == null ? void 0 : n.browser), { write: (o) => c.write(o) }) })), chunkLoggerController: c };
}
function ys(t) {
  var r;
  const n = new ss((r = t.opts) == null ? void 0 : r.level, t.maxSizeInBytes);
  return { logger: Yr(Fe(He({}, t.opts), { level: "trace" }), n), chunkLoggerController: n };
}
function Ko(t) {
  return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? gs(t) : ys(t);
}
var ar = {}, Zr = {};
(function(t) {
  Object.defineProperty(t, "__esModule", { value: !0 });
  var r = ai, n = $r;
  t.DIGEST_LENGTH = 64, t.BLOCK_SIZE = 128;
  var c = (
    /** @class */
    function() {
      function S() {
        this.digestLength = t.DIGEST_LENGTH, this.blockSize = t.BLOCK_SIZE, this._stateHi = new Int32Array(8), this._stateLo = new Int32Array(8), this._tempHi = new Int32Array(16), this._tempLo = new Int32Array(16), this._buffer = new Uint8Array(256), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this.reset();
      }
      return S.prototype._initState = function() {
        this._stateHi[0] = 1779033703, this._stateHi[1] = 3144134277, this._stateHi[2] = 1013904242, this._stateHi[3] = 2773480762, this._stateHi[4] = 1359893119, this._stateHi[5] = 2600822924, this._stateHi[6] = 528734635, this._stateHi[7] = 1541459225, this._stateLo[0] = 4089235720, this._stateLo[1] = 2227873595, this._stateLo[2] = 4271175723, this._stateLo[3] = 1595750129, this._stateLo[4] = 2917565137, this._stateLo[5] = 725511199, this._stateLo[6] = 4215389547, this._stateLo[7] = 327033209;
      }, S.prototype.reset = function() {
        return this._initState(), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this;
      }, S.prototype.clean = function() {
        n.wipe(this._buffer), n.wipe(this._tempHi), n.wipe(this._tempLo), this.reset();
      }, S.prototype.update = function(g, s) {
        if (s === void 0 && (s = g.length), this._finished)
          throw new Error("SHA512: can't update because hash was finished.");
        var u = 0;
        if (this._bytesHashed += s, this._bufferLength > 0) {
          for (; this._bufferLength < t.BLOCK_SIZE && s > 0; )
            this._buffer[this._bufferLength++] = g[u++], s--;
          this._bufferLength === this.blockSize && (h(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, this.blockSize), this._bufferLength = 0);
        }
        for (s >= this.blockSize && (u = h(this._tempHi, this._tempLo, this._stateHi, this._stateLo, g, u, s), s %= this.blockSize); s > 0; )
          this._buffer[this._bufferLength++] = g[u++], s--;
        return this;
      }, S.prototype.finish = function(g) {
        if (!this._finished) {
          var s = this._bytesHashed, u = this._bufferLength, y = s / 536870912 | 0, v = s << 3, w = s % 128 < 112 ? 128 : 256;
          this._buffer[u] = 128;
          for (var x = u + 1; x < w - 8; x++)
            this._buffer[x] = 0;
          r.writeUint32BE(y, this._buffer, w - 8), r.writeUint32BE(v, this._buffer, w - 4), h(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, w), this._finished = !0;
        }
        for (var x = 0; x < this.digestLength / 8; x++)
          r.writeUint32BE(this._stateHi[x], g, x * 8), r.writeUint32BE(this._stateLo[x], g, x * 8 + 4);
        return this;
      }, S.prototype.digest = function() {
        var g = new Uint8Array(this.digestLength);
        return this.finish(g), g;
      }, S.prototype.saveState = function() {
        if (this._finished)
          throw new Error("SHA256: cannot save finished state");
        return {
          stateHi: new Int32Array(this._stateHi),
          stateLo: new Int32Array(this._stateLo),
          buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : void 0,
          bufferLength: this._bufferLength,
          bytesHashed: this._bytesHashed
        };
      }, S.prototype.restoreState = function(g) {
        return this._stateHi.set(g.stateHi), this._stateLo.set(g.stateLo), this._bufferLength = g.bufferLength, g.buffer && this._buffer.set(g.buffer), this._bytesHashed = g.bytesHashed, this._finished = !1, this;
      }, S.prototype.cleanSavedState = function(g) {
        n.wipe(g.stateHi), n.wipe(g.stateLo), g.buffer && n.wipe(g.buffer), g.bufferLength = 0, g.bytesHashed = 0;
      }, S;
    }()
  );
  t.SHA512 = c;
  var o = new Int32Array([
    1116352408,
    3609767458,
    1899447441,
    602891725,
    3049323471,
    3964484399,
    3921009573,
    2173295548,
    961987163,
    4081628472,
    1508970993,
    3053834265,
    2453635748,
    2937671579,
    2870763221,
    3664609560,
    3624381080,
    2734883394,
    310598401,
    1164996542,
    607225278,
    1323610764,
    1426881987,
    3590304994,
    1925078388,
    4068182383,
    2162078206,
    991336113,
    2614888103,
    633803317,
    3248222580,
    3479774868,
    3835390401,
    2666613458,
    4022224774,
    944711139,
    264347078,
    2341262773,
    604807628,
    2007800933,
    770255983,
    1495990901,
    1249150122,
    1856431235,
    1555081692,
    3175218132,
    1996064986,
    2198950837,
    2554220882,
    3999719339,
    2821834349,
    766784016,
    2952996808,
    2566594879,
    3210313671,
    3203337956,
    3336571891,
    1034457026,
    3584528711,
    2466948901,
    113926993,
    3758326383,
    338241895,
    168717936,
    666307205,
    1188179964,
    773529912,
    1546045734,
    1294757372,
    1522805485,
    1396182291,
    2643833823,
    1695183700,
    2343527390,
    1986661051,
    1014477480,
    2177026350,
    1206759142,
    2456956037,
    344077627,
    2730485921,
    1290863460,
    2820302411,
    3158454273,
    3259730800,
    3505952657,
    3345764771,
    106217008,
    3516065817,
    3606008344,
    3600352804,
    1432725776,
    4094571909,
    1467031594,
    275423344,
    851169720,
    430227734,
    3100823752,
    506948616,
    1363258195,
    659060556,
    3750685593,
    883997877,
    3785050280,
    958139571,
    3318307427,
    1322822218,
    3812723403,
    1537002063,
    2003034995,
    1747873779,
    3602036899,
    1955562222,
    1575990012,
    2024104815,
    1125592928,
    2227730452,
    2716904306,
    2361852424,
    442776044,
    2428436474,
    593698344,
    2756734187,
    3733110249,
    3204031479,
    2999351573,
    3329325298,
    3815920427,
    3391569614,
    3928383900,
    3515267271,
    566280711,
    3940187606,
    3454069534,
    4118630271,
    4000239992,
    116418474,
    1914138554,
    174292421,
    2731055270,
    289380356,
    3203993006,
    460393269,
    320620315,
    685471733,
    587496836,
    852142971,
    1086792851,
    1017036298,
    365543100,
    1126000580,
    2618297676,
    1288033470,
    3409855158,
    1501505948,
    4234509866,
    1607167915,
    987167468,
    1816402316,
    1246189591
  ]);
  function h(S, g, s, u, y, v, w) {
    for (var x = s[0], N = s[1], H = s[2], ct = s[3], M = s[4], Tt = s[5], bt = s[6], Ct = s[7], F = u[0], j = u[1], jt = u[2], te = u[3], gt = u[4], Jt = u[5], $t = u[6], Vt = u[7], m, _, X, ut, A, I, O, L; w >= 128; ) {
      for (var Lt = 0; Lt < 16; Lt++) {
        var et = 8 * Lt + v;
        S[Lt] = r.readUint32BE(y, et), g[Lt] = r.readUint32BE(y, et + 4);
      }
      for (var Lt = 0; Lt < 80; Lt++) {
        var xe = x, z = N, be = H, b = ct, d = M, l = Tt, e = bt, a = Ct, R = F, P = j, D = jt, $ = te, B = gt, K = Jt, At = $t, lt = Vt;
        if (m = Ct, _ = Vt, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = (M >>> 14 | gt << 18) ^ (M >>> 18 | gt << 14) ^ (gt >>> 9 | M << 23), _ = (gt >>> 14 | M << 18) ^ (gt >>> 18 | M << 14) ^ (M >>> 9 | gt << 23), A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, m = M & Tt ^ ~M & bt, _ = gt & Jt ^ ~gt & $t, A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, m = o[Lt * 2], _ = o[Lt * 2 + 1], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, m = S[Lt % 16], _ = g[Lt % 16], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, X = O & 65535 | L << 16, ut = A & 65535 | I << 16, m = X, _ = ut, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = (x >>> 28 | F << 4) ^ (F >>> 2 | x << 30) ^ (F >>> 7 | x << 25), _ = (F >>> 28 | x << 4) ^ (x >>> 2 | F << 30) ^ (x >>> 7 | F << 25), A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, m = x & N ^ x & H ^ N & H, _ = F & j ^ F & jt ^ j & jt, A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, a = O & 65535 | L << 16, lt = A & 65535 | I << 16, m = b, _ = $, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = X, _ = ut, A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, b = O & 65535 | L << 16, $ = A & 65535 | I << 16, N = xe, H = z, ct = be, M = b, Tt = d, bt = l, Ct = e, x = a, j = R, jt = P, te = D, gt = $, Jt = B, $t = K, Vt = At, F = lt, Lt % 16 === 15)
          for (var et = 0; et < 16; et++)
            m = S[et], _ = g[et], A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = S[(et + 9) % 16], _ = g[(et + 9) % 16], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, X = S[(et + 1) % 16], ut = g[(et + 1) % 16], m = (X >>> 1 | ut << 31) ^ (X >>> 8 | ut << 24) ^ X >>> 7, _ = (ut >>> 1 | X << 31) ^ (ut >>> 8 | X << 24) ^ (ut >>> 7 | X << 25), A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, X = S[(et + 14) % 16], ut = g[(et + 14) % 16], m = (X >>> 19 | ut << 13) ^ (ut >>> 29 | X << 3) ^ X >>> 6, _ = (ut >>> 19 | X << 13) ^ (X >>> 29 | ut << 3) ^ (ut >>> 6 | X << 26), A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, S[et] = O & 65535 | L << 16, g[et] = A & 65535 | I << 16;
      }
      m = x, _ = F, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = s[0], _ = u[0], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, s[0] = x = O & 65535 | L << 16, u[0] = F = A & 65535 | I << 16, m = N, _ = j, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = s[1], _ = u[1], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, s[1] = N = O & 65535 | L << 16, u[1] = j = A & 65535 | I << 16, m = H, _ = jt, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = s[2], _ = u[2], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, s[2] = H = O & 65535 | L << 16, u[2] = jt = A & 65535 | I << 16, m = ct, _ = te, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = s[3], _ = u[3], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, s[3] = ct = O & 65535 | L << 16, u[3] = te = A & 65535 | I << 16, m = M, _ = gt, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = s[4], _ = u[4], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, s[4] = M = O & 65535 | L << 16, u[4] = gt = A & 65535 | I << 16, m = Tt, _ = Jt, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = s[5], _ = u[5], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, s[5] = Tt = O & 65535 | L << 16, u[5] = Jt = A & 65535 | I << 16, m = bt, _ = $t, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = s[6], _ = u[6], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, s[6] = bt = O & 65535 | L << 16, u[6] = $t = A & 65535 | I << 16, m = Ct, _ = Vt, A = _ & 65535, I = _ >>> 16, O = m & 65535, L = m >>> 16, m = s[7], _ = u[7], A += _ & 65535, I += _ >>> 16, O += m & 65535, L += m >>> 16, I += A >>> 16, O += I >>> 16, L += O >>> 16, s[7] = Ct = O & 65535 | L << 16, u[7] = Vt = A & 65535 | I << 16, v += 128, w -= 128;
    }
    return v;
  }
  function E(S) {
    var g = new c();
    g.update(S);
    var s = g.digest();
    return g.clean(), s;
  }
  t.hash = E;
})(Zr);
(function(t) {
  Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0;
  const r = Kr, n = Zr, c = $r;
  t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32;
  function o(b) {
    const d = new Float64Array(16);
    if (b)
      for (let l = 0; l < b.length; l++)
        d[l] = b[l];
    return d;
  }
  const h = new Uint8Array(32);
  h[0] = 9;
  const E = o(), S = o([1]), g = o([
    30883,
    4953,
    19914,
    30187,
    55467,
    16705,
    2637,
    112,
    59544,
    30585,
    16505,
    36039,
    65139,
    11119,
    27886,
    20995
  ]), s = o([
    61785,
    9906,
    39828,
    60374,
    45398,
    33411,
    5274,
    224,
    53552,
    61171,
    33010,
    6542,
    64743,
    22239,
    55772,
    9222
  ]), u = o([
    54554,
    36645,
    11616,
    51542,
    42930,
    38181,
    51040,
    26924,
    56412,
    64982,
    57905,
    49316,
    21502,
    52590,
    14035,
    8553
  ]), y = o([
    26200,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214,
    26214
  ]), v = o([
    41136,
    18958,
    6951,
    50414,
    58488,
    44335,
    6150,
    12099,
    55207,
    15867,
    153,
    11085,
    57099,
    20417,
    9344,
    11139
  ]);
  function w(b, d) {
    for (let l = 0; l < 16; l++)
      b[l] = d[l] | 0;
  }
  function x(b) {
    let d = 1;
    for (let l = 0; l < 16; l++) {
      let e = b[l] + d + 65535;
      d = Math.floor(e / 65536), b[l] = e - d * 65536;
    }
    b[0] += d - 1 + 37 * (d - 1);
  }
  function N(b, d, l) {
    const e = ~(l - 1);
    for (let a = 0; a < 16; a++) {
      const R = e & (b[a] ^ d[a]);
      b[a] ^= R, d[a] ^= R;
    }
  }
  function H(b, d) {
    const l = o(), e = o();
    for (let a = 0; a < 16; a++)
      e[a] = d[a];
    x(e), x(e), x(e);
    for (let a = 0; a < 2; a++) {
      l[0] = e[0] - 65517;
      for (let P = 1; P < 15; P++)
        l[P] = e[P] - 65535 - (l[P - 1] >> 16 & 1), l[P - 1] &= 65535;
      l[15] = e[15] - 32767 - (l[14] >> 16 & 1);
      const R = l[15] >> 16 & 1;
      l[14] &= 65535, N(e, l, 1 - R);
    }
    for (let a = 0; a < 16; a++)
      b[2 * a] = e[a] & 255, b[2 * a + 1] = e[a] >> 8;
  }
  function ct(b, d) {
    let l = 0;
    for (let e = 0; e < 32; e++)
      l |= b[e] ^ d[e];
    return (1 & l - 1 >>> 8) - 1;
  }
  function M(b, d) {
    const l = new Uint8Array(32), e = new Uint8Array(32);
    return H(l, b), H(e, d), ct(l, e);
  }
  function Tt(b) {
    const d = new Uint8Array(32);
    return H(d, b), d[0] & 1;
  }
  function bt(b, d) {
    for (let l = 0; l < 16; l++)
      b[l] = d[2 * l] + (d[2 * l + 1] << 8);
    b[15] &= 32767;
  }
  function Ct(b, d, l) {
    for (let e = 0; e < 16; e++)
      b[e] = d[e] + l[e];
  }
  function F(b, d, l) {
    for (let e = 0; e < 16; e++)
      b[e] = d[e] - l[e];
  }
  function j(b, d, l) {
    let e, a, R = 0, P = 0, D = 0, $ = 0, B = 0, K = 0, At = 0, lt = 0, Rt = 0, yt = 0, ht = 0, rt = 0, tt = 0, Y = 0, W = 0, U = 0, nt = 0, pt = 0, G = 0, Nt = 0, zt = 0, Kt = 0, Ut = 0, Bt = 0, Xt = 0, qt = 0, se = 0, Ht = 0, ce = 0, we = 0, Re = 0, it = l[0], q = l[1], st = l[2], ot = l[3], at = l[4], Z = l[5], _t = l[6], mt = l[7], xt = l[8], wt = l[9], vt = l[10], dt = l[11], ft = l[12], k = l[13], St = l[14], Et = l[15];
    e = d[0], R += e * it, P += e * q, D += e * st, $ += e * ot, B += e * at, K += e * Z, At += e * _t, lt += e * mt, Rt += e * xt, yt += e * wt, ht += e * vt, rt += e * dt, tt += e * ft, Y += e * k, W += e * St, U += e * Et, e = d[1], P += e * it, D += e * q, $ += e * st, B += e * ot, K += e * at, At += e * Z, lt += e * _t, Rt += e * mt, yt += e * xt, ht += e * wt, rt += e * vt, tt += e * dt, Y += e * ft, W += e * k, U += e * St, nt += e * Et, e = d[2], D += e * it, $ += e * q, B += e * st, K += e * ot, At += e * at, lt += e * Z, Rt += e * _t, yt += e * mt, ht += e * xt, rt += e * wt, tt += e * vt, Y += e * dt, W += e * ft, U += e * k, nt += e * St, pt += e * Et, e = d[3], $ += e * it, B += e * q, K += e * st, At += e * ot, lt += e * at, Rt += e * Z, yt += e * _t, ht += e * mt, rt += e * xt, tt += e * wt, Y += e * vt, W += e * dt, U += e * ft, nt += e * k, pt += e * St, G += e * Et, e = d[4], B += e * it, K += e * q, At += e * st, lt += e * ot, Rt += e * at, yt += e * Z, ht += e * _t, rt += e * mt, tt += e * xt, Y += e * wt, W += e * vt, U += e * dt, nt += e * ft, pt += e * k, G += e * St, Nt += e * Et, e = d[5], K += e * it, At += e * q, lt += e * st, Rt += e * ot, yt += e * at, ht += e * Z, rt += e * _t, tt += e * mt, Y += e * xt, W += e * wt, U += e * vt, nt += e * dt, pt += e * ft, G += e * k, Nt += e * St, zt += e * Et, e = d[6], At += e * it, lt += e * q, Rt += e * st, yt += e * ot, ht += e * at, rt += e * Z, tt += e * _t, Y += e * mt, W += e * xt, U += e * wt, nt += e * vt, pt += e * dt, G += e * ft, Nt += e * k, zt += e * St, Kt += e * Et, e = d[7], lt += e * it, Rt += e * q, yt += e * st, ht += e * ot, rt += e * at, tt += e * Z, Y += e * _t, W += e * mt, U += e * xt, nt += e * wt, pt += e * vt, G += e * dt, Nt += e * ft, zt += e * k, Kt += e * St, Ut += e * Et, e = d[8], Rt += e * it, yt += e * q, ht += e * st, rt += e * ot, tt += e * at, Y += e * Z, W += e * _t, U += e * mt, nt += e * xt, pt += e * wt, G += e * vt, Nt += e * dt, zt += e * ft, Kt += e * k, Ut += e * St, Bt += e * Et, e = d[9], yt += e * it, ht += e * q, rt += e * st, tt += e * ot, Y += e * at, W += e * Z, U += e * _t, nt += e * mt, pt += e * xt, G += e * wt, Nt += e * vt, zt += e * dt, Kt += e * ft, Ut += e * k, Bt += e * St, Xt += e * Et, e = d[10], ht += e * it, rt += e * q, tt += e * st, Y += e * ot, W += e * at, U += e * Z, nt += e * _t, pt += e * mt, G += e * xt, Nt += e * wt, zt += e * vt, Kt += e * dt, Ut += e * ft, Bt += e * k, Xt += e * St, qt += e * Et, e = d[11], rt += e * it, tt += e * q, Y += e * st, W += e * ot, U += e * at, nt += e * Z, pt += e * _t, G += e * mt, Nt += e * xt, zt += e * wt, Kt += e * vt, Ut += e * dt, Bt += e * ft, Xt += e * k, qt += e * St, se += e * Et, e = d[12], tt += e * it, Y += e * q, W += e * st, U += e * ot, nt += e * at, pt += e * Z, G += e * _t, Nt += e * mt, zt += e * xt, Kt += e * wt, Ut += e * vt, Bt += e * dt, Xt += e * ft, qt += e * k, se += e * St, Ht += e * Et, e = d[13], Y += e * it, W += e * q, U += e * st, nt += e * ot, pt += e * at, G += e * Z, Nt += e * _t, zt += e * mt, Kt += e * xt, Ut += e * wt, Bt += e * vt, Xt += e * dt, qt += e * ft, se += e * k, Ht += e * St, ce += e * Et, e = d[14], W += e * it, U += e * q, nt += e * st, pt += e * ot, G += e * at, Nt += e * Z, zt += e * _t, Kt += e * mt, Ut += e * xt, Bt += e * wt, Xt += e * vt, qt += e * dt, se += e * ft, Ht += e * k, ce += e * St, we += e * Et, e = d[15], U += e * it, nt += e * q, pt += e * st, G += e * ot, Nt += e * at, zt += e * Z, Kt += e * _t, Ut += e * mt, Bt += e * xt, Xt += e * wt, qt += e * vt, se += e * dt, Ht += e * ft, ce += e * k, we += e * St, Re += e * Et, R += 38 * nt, P += 38 * pt, D += 38 * G, $ += 38 * Nt, B += 38 * zt, K += 38 * Kt, At += 38 * Ut, lt += 38 * Bt, Rt += 38 * Xt, yt += 38 * qt, ht += 38 * se, rt += 38 * Ht, tt += 38 * ce, Y += 38 * we, W += 38 * Re, a = 1, e = R + a + 65535, a = Math.floor(e / 65536), R = e - a * 65536, e = P + a + 65535, a = Math.floor(e / 65536), P = e - a * 65536, e = D + a + 65535, a = Math.floor(e / 65536), D = e - a * 65536, e = $ + a + 65535, a = Math.floor(e / 65536), $ = e - a * 65536, e = B + a + 65535, a = Math.floor(e / 65536), B = e - a * 65536, e = K + a + 65535, a = Math.floor(e / 65536), K = e - a * 65536, e = At + a + 65535, a = Math.floor(e / 65536), At = e - a * 65536, e = lt + a + 65535, a = Math.floor(e / 65536), lt = e - a * 65536, e = Rt + a + 65535, a = Math.floor(e / 65536), Rt = e - a * 65536, e = yt + a + 65535, a = Math.floor(e / 65536), yt = e - a * 65536, e = ht + a + 65535, a = Math.floor(e / 65536), ht = e - a * 65536, e = rt + a + 65535, a = Math.floor(e / 65536), rt = e - a * 65536, e = tt + a + 65535, a = Math.floor(e / 65536), tt = e - a * 65536, e = Y + a + 65535, a = Math.floor(e / 65536), Y = e - a * 65536, e = W + a + 65535, a = Math.floor(e / 65536), W = e - a * 65536, e = U + a + 65535, a = Math.floor(e / 65536), U = e - a * 65536, R += a - 1 + 37 * (a - 1), a = 1, e = R + a + 65535, a = Math.floor(e / 65536), R = e - a * 65536, e = P + a + 65535, a = Math.floor(e / 65536), P = e - a * 65536, e = D + a + 65535, a = Math.floor(e / 65536), D = e - a * 65536, e = $ + a + 65535, a = Math.floor(e / 65536), $ = e - a * 65536, e = B + a + 65535, a = Math.floor(e / 65536), B = e - a * 65536, e = K + a + 65535, a = Math.floor(e / 65536), K = e - a * 65536, e = At + a + 65535, a = Math.floor(e / 65536), At = e - a * 65536, e = lt + a + 65535, a = Math.floor(e / 65536), lt = e - a * 65536, e = Rt + a + 65535, a = Math.floor(e / 65536), Rt = e - a * 65536, e = yt + a + 65535, a = Math.floor(e / 65536), yt = e - a * 65536, e = ht + a + 65535, a = Math.floor(e / 65536), ht = e - a * 65536, e = rt + a + 65535, a = Math.floor(e / 65536), rt = e - a * 65536, e = tt + a + 65535, a = Math.floor(e / 65536), tt = e - a * 65536, e = Y + a + 65535, a = Math.floor(e / 65536), Y = e - a * 65536, e = W + a + 65535, a = Math.floor(e / 65536), W = e - a * 65536, e = U + a + 65535, a = Math.floor(e / 65536), U = e - a * 65536, R += a - 1 + 37 * (a - 1), b[0] = R, b[1] = P, b[2] = D, b[3] = $, b[4] = B, b[5] = K, b[6] = At, b[7] = lt, b[8] = Rt, b[9] = yt, b[10] = ht, b[11] = rt, b[12] = tt, b[13] = Y, b[14] = W, b[15] = U;
  }
  function jt(b, d) {
    j(b, d, d);
  }
  function te(b, d) {
    const l = o();
    let e;
    for (e = 0; e < 16; e++)
      l[e] = d[e];
    for (e = 253; e >= 0; e--)
      jt(l, l), e !== 2 && e !== 4 && j(l, l, d);
    for (e = 0; e < 16; e++)
      b[e] = l[e];
  }
  function gt(b, d) {
    const l = o();
    let e;
    for (e = 0; e < 16; e++)
      l[e] = d[e];
    for (e = 250; e >= 0; e--)
      jt(l, l), e !== 1 && j(l, l, d);
    for (e = 0; e < 16; e++)
      b[e] = l[e];
  }
  function Jt(b, d) {
    const l = o(), e = o(), a = o(), R = o(), P = o(), D = o(), $ = o(), B = o(), K = o();
    F(l, b[1], b[0]), F(K, d[1], d[0]), j(l, l, K), Ct(e, b[0], b[1]), Ct(K, d[0], d[1]), j(e, e, K), j(a, b[3], d[3]), j(a, a, s), j(R, b[2], d[2]), Ct(R, R, R), F(P, e, l), F(D, R, a), Ct($, R, a), Ct(B, e, l), j(b[0], P, D), j(b[1], B, $), j(b[2], $, D), j(b[3], P, B);
  }
  function $t(b, d, l) {
    for (let e = 0; e < 4; e++)
      N(b[e], d[e], l);
  }
  function Vt(b, d) {
    const l = o(), e = o(), a = o();
    te(a, d[2]), j(l, d[0], a), j(e, d[1], a), H(b, e), b[31] ^= Tt(l) << 7;
  }
  function m(b, d, l) {
    w(b[0], E), w(b[1], S), w(b[2], S), w(b[3], E);
    for (let e = 255; e >= 0; --e) {
      const a = l[e / 8 | 0] >> (e & 7) & 1;
      $t(b, d, a), Jt(d, b), Jt(b, b), $t(b, d, a);
    }
  }
  function _(b, d) {
    const l = [o(), o(), o(), o()];
    w(l[0], u), w(l[1], y), w(l[2], S), j(l[3], u, y), m(b, l, d);
  }
  function X(b) {
    if (b.length !== t.SEED_LENGTH)
      throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);
    const d = (0, n.hash)(b);
    d[0] &= 248, d[31] &= 127, d[31] |= 64;
    const l = new Uint8Array(32), e = [o(), o(), o(), o()];
    _(e, d), Vt(l, e);
    const a = new Uint8Array(64);
    return a.set(b), a.set(l, 32), {
      publicKey: l,
      secretKey: a
    };
  }
  t.generateKeyPairFromSeed = X;
  function ut(b) {
    const d = (0, r.randomBytes)(32, b), l = X(d);
    return (0, c.wipe)(d), l;
  }
  t.generateKeyPair = ut;
  function A(b) {
    if (b.length !== t.SECRET_KEY_LENGTH)
      throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);
    return new Uint8Array(b.subarray(32));
  }
  t.extractPublicKeyFromSecretKey = A;
  const I = new Float64Array([
    237,
    211,
    245,
    92,
    26,
    99,
    18,
    88,
    214,
    156,
    247,
    162,
    222,
    249,
    222,
    20,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    16
  ]);
  function O(b, d) {
    let l, e, a, R;
    for (e = 63; e >= 32; --e) {
      for (l = 0, a = e - 32, R = e - 12; a < R; ++a)
        d[a] += l - 16 * d[e] * I[a - (e - 32)], l = Math.floor((d[a] + 128) / 256), d[a] -= l * 256;
      d[a] += l, d[e] = 0;
    }
    for (l = 0, a = 0; a < 32; a++)
      d[a] += l - (d[31] >> 4) * I[a], l = d[a] >> 8, d[a] &= 255;
    for (a = 0; a < 32; a++)
      d[a] -= l * I[a];
    for (e = 0; e < 32; e++)
      d[e + 1] += d[e] >> 8, b[e] = d[e] & 255;
  }
  function L(b) {
    const d = new Float64Array(64);
    for (let l = 0; l < 64; l++)
      d[l] = b[l];
    for (let l = 0; l < 64; l++)
      b[l] = 0;
    O(b, d);
  }
  function Lt(b, d) {
    const l = new Float64Array(64), e = [o(), o(), o(), o()], a = (0, n.hash)(b.subarray(0, 32));
    a[0] &= 248, a[31] &= 127, a[31] |= 64;
    const R = new Uint8Array(64);
    R.set(a.subarray(32), 32);
    const P = new n.SHA512();
    P.update(R.subarray(32)), P.update(d);
    const D = P.digest();
    P.clean(), L(D), _(e, D), Vt(R, e), P.reset(), P.update(R.subarray(0, 32)), P.update(b.subarray(32)), P.update(d);
    const $ = P.digest();
    L($);
    for (let B = 0; B < 32; B++)
      l[B] = D[B];
    for (let B = 0; B < 32; B++)
      for (let K = 0; K < 32; K++)
        l[B + K] += $[B] * a[K];
    return O(R.subarray(32), l), R;
  }
  t.sign = Lt;
  function et(b, d) {
    const l = o(), e = o(), a = o(), R = o(), P = o(), D = o(), $ = o();
    return w(b[2], S), bt(b[1], d), jt(a, b[1]), j(R, a, g), F(a, a, b[2]), Ct(R, b[2], R), jt(P, R), jt(D, P), j($, D, P), j(l, $, a), j(l, l, R), gt(l, l), j(l, l, a), j(l, l, R), j(l, l, R), j(b[0], l, R), jt(e, b[0]), j(e, e, R), M(e, a) && j(b[0], b[0], v), jt(e, b[0]), j(e, e, R), M(e, a) ? -1 : (Tt(b[0]) === d[31] >> 7 && F(b[0], E, b[0]), j(b[3], b[0], b[1]), 0);
  }
  function xe(b, d, l) {
    const e = new Uint8Array(32), a = [o(), o(), o(), o()], R = [o(), o(), o(), o()];
    if (l.length !== t.SIGNATURE_LENGTH)
      throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);
    if (et(R, b))
      return !1;
    const P = new n.SHA512();
    P.update(l.subarray(0, 32)), P.update(b), P.update(d);
    const D = P.digest();
    return L(D), m(a, R, D), _(R, l.subarray(32)), Jt(a, R), Vt(e, a), !ct(l, e);
  }
  t.verify = xe;
  function z(b) {
    let d = [o(), o(), o(), o()];
    if (et(d, b))
      throw new Error("Ed25519: invalid public key");
    let l = o(), e = o(), a = d[1];
    Ct(l, S, a), F(e, S, a), te(e, e), j(l, l, e);
    let R = new Uint8Array(32);
    return H(R, l), R;
  }
  t.convertPublicKeyToX25519 = z;
  function be(b) {
    const d = (0, n.hash)(b.subarray(0, 32));
    d[0] &= 248, d[31] &= 127, d[31] |= 64;
    const l = new Uint8Array(d.subarray(0, 32));
    return (0, c.wipe)(d), l;
  }
  t.convertSecretKeyToX25519 = be;
})(ar);
const ps = "EdDSA", _s = "JWT", Ge = ".", Xe = "base64url", Qr = "utf8", tn = "utf8", ms = ":", xs = "did", ws = "key", Rr = "base58btc", vs = "z", Ss = "K36", Es = 32, Is = (t) => JSON.stringify(t, (r, n) => typeof n == "bigint" ? n.toString() + "n" : n), Os = (t) => {
  const r = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, n = t.replace(r, '$1"$2n"$3');
  return JSON.parse(n, (c, o) => typeof o == "string" && o.match(/^\d+n$/) ? BigInt(o.substring(0, o.length - 1)) : o);
};
function Ts(t) {
  if (typeof t != "string")
    throw new Error(`Cannot safe json parse value of type ${typeof t}`);
  try {
    return Os(t);
  } catch {
    return t;
  }
}
function Ls(t) {
  return typeof t == "string" ? t : Is(t) || "";
}
function Pr(t) {
  return Ts(We(me(t, Xe), Qr));
}
function Je(t) {
  return We(me(Ls(t), Qr), Xe);
}
function As(t) {
  const r = me(Ss, Rr), n = vs + We(ui([r, t]), Rr);
  return [xs, ws, n].join(ms);
}
function Rs(t) {
  return We(t, Xe);
}
function Ps(t) {
  return me(t, Xe);
}
function Cs(t) {
  return me([Je(t.header), Je(t.payload)].join(Ge), tn);
}
function js(t) {
  return [
    Je(t.header),
    Je(t.payload),
    Rs(t.signature)
  ].join(Ge);
}
function Uo(t) {
  const r = t.split(Ge), n = Pr(r[0]), c = Pr(r[1]), o = Ps(r[2]), h = me(r.slice(0, 2).join(Ge), tn);
  return { header: n, payload: c, signature: o, data: h };
}
function Ho(t = Kr.randomBytes(Es)) {
  return ar.generateKeyPairFromSeed(t);
}
async function Fo(t, r, n, c, o = fi.fromMiliseconds(Date.now())) {
  const h = { alg: ps, typ: _s }, E = As(c.publicKey), S = o + n, g = { iss: E, sub: t, aud: r, iat: o, exp: S }, s = Cs({ header: h, payload: g }), u = ar.sign(c.secretKey, s);
  return js({ header: h, payload: g, signature: u });
}
const Ns = "PARSE_ERROR", Ms = "INVALID_REQUEST", zs = "METHOD_NOT_FOUND", Bs = "INVALID_PARAMS", en = "INTERNAL_ERROR", fr = "SERVER_ERROR", Ds = [-32700, -32600, -32601, -32602, -32603], Ee = {
  [Ns]: { code: -32700, message: "Parse error" },
  [Ms]: { code: -32600, message: "Invalid Request" },
  [zs]: { code: -32601, message: "Method not found" },
  [Bs]: { code: -32602, message: "Invalid params" },
  [en]: { code: -32603, message: "Internal error" },
  [fr]: { code: -32e3, message: "Server error" }
}, rn = fr;
function $s(t) {
  return Ds.includes(t);
}
function Cr(t) {
  return Object.keys(Ee).includes(t) ? Ee[t] : Ee[rn];
}
function Ks(t) {
  const r = Object.values(Ee).find((n) => n.code === t);
  return r || Ee[rn];
}
function Us(t, r, n) {
  return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${n} RPC url at ${r}`) : t;
}
var nn = {};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var nr = function(t, r) {
  return nr = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, c) {
    n.__proto__ = c;
  } || function(n, c) {
    for (var o in c) c.hasOwnProperty(o) && (n[o] = c[o]);
  }, nr(t, r);
};
function Hs(t, r) {
  nr(t, r);
  function n() {
    this.constructor = t;
  }
  t.prototype = r === null ? Object.create(r) : (n.prototype = r.prototype, new n());
}
var ir = function() {
  return ir = Object.assign || function(r) {
    for (var n, c = 1, o = arguments.length; c < o; c++) {
      n = arguments[c];
      for (var h in n) Object.prototype.hasOwnProperty.call(n, h) && (r[h] = n[h]);
    }
    return r;
  }, ir.apply(this, arguments);
};
function Fs(t, r) {
  var n = {};
  for (var c in t) Object.prototype.hasOwnProperty.call(t, c) && r.indexOf(c) < 0 && (n[c] = t[c]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
    for (var o = 0, c = Object.getOwnPropertySymbols(t); o < c.length; o++)
      r.indexOf(c[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, c[o]) && (n[c[o]] = t[c[o]]);
  return n;
}
function Gs(t, r, n, c) {
  var o = arguments.length, h = o < 3 ? r : c === null ? c = Object.getOwnPropertyDescriptor(r, n) : c, E;
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function") h = Reflect.decorate(t, r, n, c);
  else for (var S = t.length - 1; S >= 0; S--) (E = t[S]) && (h = (o < 3 ? E(h) : o > 3 ? E(r, n, h) : E(r, n)) || h);
  return o > 3 && h && Object.defineProperty(r, n, h), h;
}
function Js(t, r) {
  return function(n, c) {
    r(n, c, t);
  };
}
function ks(t, r) {
  if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, r);
}
function Ws(t, r, n, c) {
  function o(h) {
    return h instanceof n ? h : new n(function(E) {
      E(h);
    });
  }
  return new (n || (n = Promise))(function(h, E) {
    function S(u) {
      try {
        s(c.next(u));
      } catch (y) {
        E(y);
      }
    }
    function g(u) {
      try {
        s(c.throw(u));
      } catch (y) {
        E(y);
      }
    }
    function s(u) {
      u.done ? h(u.value) : o(u.value).then(S, g);
    }
    s((c = c.apply(t, r || [])).next());
  });
}
function Vs(t, r) {
  var n = { label: 0, sent: function() {
    if (h[0] & 1) throw h[1];
    return h[1];
  }, trys: [], ops: [] }, c, o, h, E;
  return E = { next: S(0), throw: S(1), return: S(2) }, typeof Symbol == "function" && (E[Symbol.iterator] = function() {
    return this;
  }), E;
  function S(s) {
    return function(u) {
      return g([s, u]);
    };
  }
  function g(s) {
    if (c) throw new TypeError("Generator is already executing.");
    for (; n; ) try {
      if (c = 1, o && (h = s[0] & 2 ? o.return : s[0] ? o.throw || ((h = o.return) && h.call(o), 0) : o.next) && !(h = h.call(o, s[1])).done) return h;
      switch (o = 0, h && (s = [s[0] & 2, h.value]), s[0]) {
        case 0:
        case 1:
          h = s;
          break;
        case 4:
          return n.label++, { value: s[1], done: !1 };
        case 5:
          n.label++, o = s[1], s = [0];
          continue;
        case 7:
          s = n.ops.pop(), n.trys.pop();
          continue;
        default:
          if (h = n.trys, !(h = h.length > 0 && h[h.length - 1]) && (s[0] === 6 || s[0] === 2)) {
            n = 0;
            continue;
          }
          if (s[0] === 3 && (!h || s[1] > h[0] && s[1] < h[3])) {
            n.label = s[1];
            break;
          }
          if (s[0] === 6 && n.label < h[1]) {
            n.label = h[1], h = s;
            break;
          }
          if (h && n.label < h[2]) {
            n.label = h[2], n.ops.push(s);
            break;
          }
          h[2] && n.ops.pop(), n.trys.pop();
          continue;
      }
      s = r.call(t, n);
    } catch (u) {
      s = [6, u], o = 0;
    } finally {
      c = h = 0;
    }
    if (s[0] & 5) throw s[1];
    return { value: s[0] ? s[1] : void 0, done: !0 };
  }
}
function Xs(t, r, n, c) {
  c === void 0 && (c = n), t[c] = r[n];
}
function Ys(t, r) {
  for (var n in t) n !== "default" && !r.hasOwnProperty(n) && (r[n] = t[n]);
}
function sr(t) {
  var r = typeof Symbol == "function" && Symbol.iterator, n = r && t[r], c = 0;
  if (n) return n.call(t);
  if (t && typeof t.length == "number") return {
    next: function() {
      return t && c >= t.length && (t = void 0), { value: t && t[c++], done: !t };
    }
  };
  throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function sn(t, r) {
  var n = typeof Symbol == "function" && t[Symbol.iterator];
  if (!n) return t;
  var c = n.call(t), o, h = [], E;
  try {
    for (; (r === void 0 || r-- > 0) && !(o = c.next()).done; ) h.push(o.value);
  } catch (S) {
    E = { error: S };
  } finally {
    try {
      o && !o.done && (n = c.return) && n.call(c);
    } finally {
      if (E) throw E.error;
    }
  }
  return h;
}
function qs() {
  for (var t = [], r = 0; r < arguments.length; r++)
    t = t.concat(sn(arguments[r]));
  return t;
}
function Zs() {
  for (var t = 0, r = 0, n = arguments.length; r < n; r++) t += arguments[r].length;
  for (var c = Array(t), o = 0, r = 0; r < n; r++)
    for (var h = arguments[r], E = 0, S = h.length; E < S; E++, o++)
      c[o] = h[E];
  return c;
}
function Te(t) {
  return this instanceof Te ? (this.v = t, this) : new Te(t);
}
function Qs(t, r, n) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var c = n.apply(t, r || []), o, h = [];
  return o = {}, E("next"), E("throw"), E("return"), o[Symbol.asyncIterator] = function() {
    return this;
  }, o;
  function E(v) {
    c[v] && (o[v] = function(w) {
      return new Promise(function(x, N) {
        h.push([v, w, x, N]) > 1 || S(v, w);
      });
    });
  }
  function S(v, w) {
    try {
      g(c[v](w));
    } catch (x) {
      y(h[0][3], x);
    }
  }
  function g(v) {
    v.value instanceof Te ? Promise.resolve(v.value.v).then(s, u) : y(h[0][2], v);
  }
  function s(v) {
    S("next", v);
  }
  function u(v) {
    S("throw", v);
  }
  function y(v, w) {
    v(w), h.shift(), h.length && S(h[0][0], h[0][1]);
  }
}
function to(t) {
  var r, n;
  return r = {}, c("next"), c("throw", function(o) {
    throw o;
  }), c("return"), r[Symbol.iterator] = function() {
    return this;
  }, r;
  function c(o, h) {
    r[o] = t[o] ? function(E) {
      return (n = !n) ? { value: Te(t[o](E)), done: o === "return" } : h ? h(E) : E;
    } : h;
  }
}
function eo(t) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var r = t[Symbol.asyncIterator], n;
  return r ? r.call(t) : (t = typeof sr == "function" ? sr(t) : t[Symbol.iterator](), n = {}, c("next"), c("throw"), c("return"), n[Symbol.asyncIterator] = function() {
    return this;
  }, n);
  function c(h) {
    n[h] = t[h] && function(E) {
      return new Promise(function(S, g) {
        E = t[h](E), o(S, g, E.done, E.value);
      });
    };
  }
  function o(h, E, S, g) {
    Promise.resolve(g).then(function(s) {
      h({ value: s, done: S });
    }, E);
  }
}
function ro(t, r) {
  return Object.defineProperty ? Object.defineProperty(t, "raw", { value: r }) : t.raw = r, t;
}
function no(t) {
  if (t && t.__esModule) return t;
  var r = {};
  if (t != null) for (var n in t) Object.hasOwnProperty.call(t, n) && (r[n] = t[n]);
  return r.default = t, r;
}
function io(t) {
  return t && t.__esModule ? t : { default: t };
}
function so(t, r) {
  if (!r.has(t))
    throw new TypeError("attempted to get private field on non-instance");
  return r.get(t);
}
function oo(t, r, n) {
  if (!r.has(t))
    throw new TypeError("attempted to set private field on non-instance");
  return r.set(t, n), n;
}
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  get __assign() {
    return ir;
  },
  __asyncDelegator: to,
  __asyncGenerator: Qs,
  __asyncValues: eo,
  __await: Te,
  __awaiter: Ws,
  __classPrivateFieldGet: so,
  __classPrivateFieldSet: oo,
  __createBinding: Xs,
  __decorate: Gs,
  __exportStar: Ys,
  __extends: Hs,
  __generator: Vs,
  __importDefault: io,
  __importStar: no,
  __makeTemplateObject: ro,
  __metadata: ks,
  __param: Js,
  __read: sn,
  __rest: Fs,
  __spread: qs,
  __spreadArrays: Zs,
  __values: sr
}, Symbol.toStringTag, { value: "Module" })), fo = /* @__PURE__ */ Yn(ao);
var ne = {}, jr;
function co() {
  if (jr) return ne;
  jr = 1, Object.defineProperty(ne, "__esModule", { value: !0 }), ne.isBrowserCryptoAvailable = ne.getSubtleCrypto = ne.getBrowerCrypto = void 0;
  function t() {
    return (Zt === null || Zt === void 0 ? void 0 : Zt.crypto) || (Zt === null || Zt === void 0 ? void 0 : Zt.msCrypto) || {};
  }
  ne.getBrowerCrypto = t;
  function r() {
    const c = t();
    return c.subtle || c.webkitSubtle;
  }
  ne.getSubtleCrypto = r;
  function n() {
    return !!t() && !!r();
  }
  return ne.isBrowserCryptoAvailable = n, ne;
}
var ie = {}, Nr;
function uo() {
  if (Nr) return ie;
  Nr = 1, Object.defineProperty(ie, "__esModule", { value: !0 }), ie.isBrowser = ie.isNode = ie.isReactNative = void 0;
  function t() {
    return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative";
  }
  ie.isReactNative = t;
  function r() {
    return typeof Gt.process < "u" && typeof Gt.process.versions < "u" && typeof Gt.process.versions.node < "u";
  }
  ie.isNode = r;
  function n() {
    return !t() && !r();
  }
  return ie.isBrowser = n, ie;
}
(function(t) {
  Object.defineProperty(t, "__esModule", { value: !0 });
  const r = fo;
  r.__exportStar(co(), t), r.__exportStar(uo(), t);
})(nn);
function on(t = 3) {
  const r = Date.now() * Math.pow(10, t), n = Math.floor(Math.random() * Math.pow(10, t));
  return r + n;
}
function Go(t = 6) {
  return BigInt(on(t));
}
function Jo(t, r, n) {
  return {
    id: n || on(),
    jsonrpc: "2.0",
    method: t,
    params: r
  };
}
function ko(t, r) {
  return {
    id: t,
    jsonrpc: "2.0",
    result: r
  };
}
function lo(t, r, n) {
  return {
    id: t,
    jsonrpc: "2.0",
    error: ho(r)
  };
}
function ho(t, r) {
  return typeof t > "u" ? Cr(en) : (typeof t == "string" && (t = Object.assign(Object.assign({}, Cr(fr)), { message: t })), $s(t.code) && (t = Ks(t.code)), t);
}
class bo {
}
class go extends bo {
  constructor() {
    super();
  }
}
class Wo extends go {
  constructor(r) {
    super();
  }
}
const yo = "^https?:", po = "^wss?:";
function _o(t) {
  const r = t.match(new RegExp(/^\w+:/, "gi"));
  if (!(!r || !r.length))
    return r[0];
}
function an(t, r) {
  const n = _o(t);
  return typeof n > "u" ? !1 : new RegExp(r).test(n);
}
function Vo(t) {
  return an(t, yo);
}
function Mr(t) {
  return an(t, po);
}
function mo(t) {
  return new RegExp("wss?://localhost(:d{2,5})?").test(t);
}
function fn(t) {
  return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0";
}
function Xo(t) {
  return fn(t) && "method" in t;
}
function Yo(t) {
  return fn(t) && (xo(t) || wo(t));
}
function xo(t) {
  return "result" in t;
}
function wo(t) {
  return "error" in t;
}
const vo = (t) => JSON.stringify(t, (r, n) => typeof n == "bigint" ? n.toString() + "n" : n), So = (t) => {
  const r = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, n = t.replace(r, '$1"$2n"$3');
  return JSON.parse(n, (c, o) => typeof o == "string" && o.match(/^\d+n$/) ? BigInt(o.substring(0, o.length - 1)) : o);
};
function Eo(t) {
  if (typeof t != "string")
    throw new Error(`Cannot safe json parse value of type ${typeof t}`);
  try {
    return So(t);
  } catch {
    return t;
  }
}
function Io(t) {
  return typeof t == "string" ? t : vo(t) || "";
}
const Oo = () => typeof WebSocket < "u" ? WebSocket : typeof Gt.global < "u" && typeof Gt.global.WebSocket < "u" ? Gt.global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), To = () => typeof WebSocket < "u" || typeof Gt.global < "u" && typeof Gt.global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", zr = (t) => t.split("?")[0], Br = 10, Lo = Oo();
class qo {
  constructor(r) {
    if (this.url = r, this.events = new ci.EventEmitter(), this.registering = !1, !Mr(r)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${r}`);
    this.url = r;
  }
  get connected() {
    return typeof this.socket < "u";
  }
  get connecting() {
    return this.registering;
  }
  on(r, n) {
    this.events.on(r, n);
  }
  once(r, n) {
    this.events.once(r, n);
  }
  off(r, n) {
    this.events.off(r, n);
  }
  removeListener(r, n) {
    this.events.removeListener(r, n);
  }
  async open(r = this.url) {
    await this.register(r);
  }
  async close() {
    return new Promise((r, n) => {
      if (typeof this.socket > "u") {
        n(new Error("Connection already closed"));
        return;
      }
      this.socket.onclose = (c) => {
        this.onClose(c), r();
      }, this.socket.close();
    });
  }
  async send(r) {
    typeof this.socket > "u" && (this.socket = await this.register());
    try {
      this.socket.send(Io(r));
    } catch (n) {
      this.onError(r.id, n);
    }
  }
  register(r = this.url) {
    if (!Mr(r)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${r}`);
    if (this.registering) {
      const n = this.events.getMaxListeners();
      return (this.events.listenerCount("register_error") >= n || this.events.listenerCount("open") >= n) && this.events.setMaxListeners(n + 1), new Promise((c, o) => {
        this.events.once("register_error", (h) => {
          this.resetMaxListeners(), o(h);
        }), this.events.once("open", () => {
          if (this.resetMaxListeners(), typeof this.socket > "u") return o(new Error("WebSocket connection is missing or invalid"));
          c(this.socket);
        });
      });
    }
    return this.url = r, this.registering = !0, new Promise((n, c) => {
      const o = new URLSearchParams(r).get("origin"), h = nn.isReactNative() ? { headers: { origin: o } } : { rejectUnauthorized: !mo(r) }, E = new Lo(r, [], h);
      To() ? E.onerror = (S) => {
        const g = S;
        c(this.emitError(g.error));
      } : E.on("error", (S) => {
        c(this.emitError(S));
      }), E.onopen = () => {
        this.onOpen(E), n(E);
      };
    });
  }
  onOpen(r) {
    r.onmessage = (n) => this.onPayload(n), r.onclose = (n) => this.onClose(n), this.socket = r, this.registering = !1, this.events.emit("open");
  }
  onClose(r) {
    this.socket = void 0, this.registering = !1, this.events.emit("close", r);
  }
  onPayload(r) {
    if (typeof r.data > "u") return;
    const n = typeof r.data == "string" ? Eo(r.data) : r.data;
    this.events.emit("payload", n);
  }
  onError(r, n) {
    const c = this.parseError(n), o = c.message || c.toString(), h = lo(r, o);
    this.events.emit("payload", h);
  }
  parseError(r, n = this.url) {
    return Us(r, zr(n), "WS");
  }
  resetMaxListeners() {
    this.events.getMaxListeners() > Br && this.events.setMaxListeners(Br);
  }
  emitError(r) {
    const n = this.parseError(new Error((r == null ? void 0 : r.message) || `WebSocket connection failed for host: ${zr(this.url)}`));
    return this.events.emit("register_error", n), n;
  }
}
var ke = { exports: {} };
ke.exports;
(function(t, r) {
  var n = 200, c = "__lodash_hash_undefined__", o = 1, h = 2, E = 9007199254740991, S = "[object Arguments]", g = "[object Array]", s = "[object AsyncFunction]", u = "[object Boolean]", y = "[object Date]", v = "[object Error]", w = "[object Function]", x = "[object GeneratorFunction]", N = "[object Map]", H = "[object Number]", ct = "[object Null]", M = "[object Object]", Tt = "[object Promise]", bt = "[object Proxy]", Ct = "[object RegExp]", F = "[object Set]", j = "[object String]", jt = "[object Symbol]", te = "[object Undefined]", gt = "[object WeakMap]", Jt = "[object ArrayBuffer]", $t = "[object DataView]", Vt = "[object Float32Array]", m = "[object Float64Array]", _ = "[object Int8Array]", X = "[object Int16Array]", ut = "[object Int32Array]", A = "[object Uint8Array]", I = "[object Uint8ClampedArray]", O = "[object Uint16Array]", L = "[object Uint32Array]", Lt = /[\\^$.*+?()[\]{}|]/g, et = /^\[object .+?Constructor\]$/, xe = /^(?:0|[1-9]\d*)$/, z = {};
  z[Vt] = z[m] = z[_] = z[X] = z[ut] = z[A] = z[I] = z[O] = z[L] = !0, z[S] = z[g] = z[Jt] = z[u] = z[$t] = z[y] = z[v] = z[w] = z[N] = z[H] = z[M] = z[Ct] = z[F] = z[j] = z[gt] = !1;
  var be = typeof Zt == "object" && Zt && Zt.Object === Object && Zt, b = typeof self == "object" && self && self.Object === Object && self, d = be || b || Function("return this")(), l = r && !r.nodeType && r, e = l && !0 && t && !t.nodeType && t, a = e && e.exports === l, R = a && be.process, P = function() {
    try {
      return R && R.binding && R.binding("util");
    } catch {
    }
  }(), D = P && P.isTypedArray;
  function $(i, f) {
    for (var p = -1, T = i == null ? 0 : i.length, J = 0, C = []; ++p < T; ) {
      var Q = i[p];
      f(Q, p, i) && (C[J++] = Q);
    }
    return C;
  }
  function B(i, f) {
    for (var p = -1, T = f.length, J = i.length; ++p < T; )
      i[J + p] = f[p];
    return i;
  }
  function K(i, f) {
    for (var p = -1, T = i == null ? 0 : i.length; ++p < T; )
      if (f(i[p], p, i))
        return !0;
    return !1;
  }
  function At(i, f) {
    for (var p = -1, T = Array(i); ++p < i; )
      T[p] = f(p);
    return T;
  }
  function lt(i) {
    return function(f) {
      return i(f);
    };
  }
  function Rt(i, f) {
    return i.has(f);
  }
  function yt(i, f) {
    return i == null ? void 0 : i[f];
  }
  function ht(i) {
    var f = -1, p = Array(i.size);
    return i.forEach(function(T, J) {
      p[++f] = [J, T];
    }), p;
  }
  function rt(i, f) {
    return function(p) {
      return i(f(p));
    };
  }
  function tt(i) {
    var f = -1, p = Array(i.size);
    return i.forEach(function(T) {
      p[++f] = T;
    }), p;
  }
  var Y = Array.prototype, W = Function.prototype, U = Object.prototype, nt = d["__core-js_shared__"], pt = W.toString, G = U.hasOwnProperty, Nt = function() {
    var i = /[^.]+$/.exec(nt && nt.keys && nt.keys.IE_PROTO || "");
    return i ? "Symbol(src)_1." + i : "";
  }(), zt = U.toString, Kt = RegExp(
    "^" + pt.call(G).replace(Lt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  ), Ut = a ? d.Buffer : void 0, Bt = d.Symbol, Xt = d.Uint8Array, qt = U.propertyIsEnumerable, se = Y.splice, Ht = Bt ? Bt.toStringTag : void 0, ce = Object.getOwnPropertySymbols, we = Ut ? Ut.isBuffer : void 0, Re = rt(Object.keys, Object), it = ge(d, "DataView"), q = ge(d, "Map"), st = ge(d, "Promise"), ot = ge(d, "Set"), at = ge(d, "WeakMap"), Z = ge(Object, "create"), _t = le(it), mt = le(q), xt = le(st), wt = le(ot), vt = le(at), dt = Bt ? Bt.prototype : void 0, ft = dt ? dt.valueOf : void 0;
  function k(i) {
    var f = -1, p = i == null ? 0 : i.length;
    for (this.clear(); ++f < p; ) {
      var T = i[f];
      this.set(T[0], T[1]);
    }
  }
  function St() {
    this.__data__ = Z ? Z(null) : {}, this.size = 0;
  }
  function Et(i) {
    var f = this.has(i) && delete this.__data__[i];
    return this.size -= f ? 1 : 0, f;
  }
  function cn(i) {
    var f = this.__data__;
    if (Z) {
      var p = f[i];
      return p === c ? void 0 : p;
    }
    return G.call(f, i) ? f[i] : void 0;
  }
  function un(i) {
    var f = this.__data__;
    return Z ? f[i] !== void 0 : G.call(f, i);
  }
  function ln(i, f) {
    var p = this.__data__;
    return this.size += this.has(i) ? 0 : 1, p[i] = Z && f === void 0 ? c : f, this;
  }
  k.prototype.clear = St, k.prototype.delete = Et, k.prototype.get = cn, k.prototype.has = un, k.prototype.set = ln;
  function ee(i) {
    var f = -1, p = i == null ? 0 : i.length;
    for (this.clear(); ++f < p; ) {
      var T = i[f];
      this.set(T[0], T[1]);
    }
  }
  function hn() {
    this.__data__ = [], this.size = 0;
  }
  function dn(i) {
    var f = this.__data__, p = Ce(f, i);
    if (p < 0)
      return !1;
    var T = f.length - 1;
    return p == T ? f.pop() : se.call(f, p, 1), --this.size, !0;
  }
  function bn(i) {
    var f = this.__data__, p = Ce(f, i);
    return p < 0 ? void 0 : f[p][1];
  }
  function gn(i) {
    return Ce(this.__data__, i) > -1;
  }
  function yn(i, f) {
    var p = this.__data__, T = Ce(p, i);
    return T < 0 ? (++this.size, p.push([i, f])) : p[T][1] = f, this;
  }
  ee.prototype.clear = hn, ee.prototype.delete = dn, ee.prototype.get = bn, ee.prototype.has = gn, ee.prototype.set = yn;
  function ue(i) {
    var f = -1, p = i == null ? 0 : i.length;
    for (this.clear(); ++f < p; ) {
      var T = i[f];
      this.set(T[0], T[1]);
    }
  }
  function pn() {
    this.size = 0, this.__data__ = {
      hash: new k(),
      map: new (q || ee)(),
      string: new k()
    };
  }
  function _n(i) {
    var f = je(this, i).delete(i);
    return this.size -= f ? 1 : 0, f;
  }
  function mn(i) {
    return je(this, i).get(i);
  }
  function xn(i) {
    return je(this, i).has(i);
  }
  function wn(i, f) {
    var p = je(this, i), T = p.size;
    return p.set(i, f), this.size += p.size == T ? 0 : 1, this;
  }
  ue.prototype.clear = pn, ue.prototype.delete = _n, ue.prototype.get = mn, ue.prototype.has = xn, ue.prototype.set = wn;
  function Pe(i) {
    var f = -1, p = i == null ? 0 : i.length;
    for (this.__data__ = new ue(); ++f < p; )
      this.add(i[f]);
  }
  function vn(i) {
    return this.__data__.set(i, c), this;
  }
  function Sn(i) {
    return this.__data__.has(i);
  }
  Pe.prototype.add = Pe.prototype.push = vn, Pe.prototype.has = Sn;
  function oe(i) {
    var f = this.__data__ = new ee(i);
    this.size = f.size;
  }
  function En() {
    this.__data__ = new ee(), this.size = 0;
  }
  function In(i) {
    var f = this.__data__, p = f.delete(i);
    return this.size = f.size, p;
  }
  function On(i) {
    return this.__data__.get(i);
  }
  function Tn(i) {
    return this.__data__.has(i);
  }
  function Ln(i, f) {
    var p = this.__data__;
    if (p instanceof ee) {
      var T = p.__data__;
      if (!q || T.length < n - 1)
        return T.push([i, f]), this.size = ++p.size, this;
      p = this.__data__ = new ue(T);
    }
    return p.set(i, f), this.size = p.size, this;
  }
  oe.prototype.clear = En, oe.prototype.delete = In, oe.prototype.get = On, oe.prototype.has = Tn, oe.prototype.set = Ln;
  function An(i, f) {
    var p = Ne(i), T = !p && Gn(i), J = !p && !T && Ye(i), C = !p && !T && !J && pr(i), Q = p || T || J || C, It = Q ? At(i.length, String) : [], Pt = It.length;
    for (var V in i)
      G.call(i, V) && !(Q && // Safari 9 has enumerable `arguments.length` in strict mode.
      (V == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
      J && (V == "offset" || V == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
      C && (V == "buffer" || V == "byteLength" || V == "byteOffset") || // Skip index properties.
      $n(V, Pt))) && It.push(V);
    return It;
  }
  function Ce(i, f) {
    for (var p = i.length; p--; )
      if (dr(i[p][0], f))
        return p;
    return -1;
  }
  function Rn(i, f, p) {
    var T = f(i);
    return Ne(i) ? T : B(T, p(i));
  }
  function ve(i) {
    return i == null ? i === void 0 ? te : ct : Ht && Ht in Object(i) ? Bn(i) : Fn(i);
  }
  function cr(i) {
    return Se(i) && ve(i) == S;
  }
  function ur(i, f, p, T, J) {
    return i === f ? !0 : i == null || f == null || !Se(i) && !Se(f) ? i !== i && f !== f : Pn(i, f, p, T, ur, J);
  }
  function Pn(i, f, p, T, J, C) {
    var Q = Ne(i), It = Ne(f), Pt = Q ? g : ae(i), V = It ? g : ae(f);
    Pt = Pt == S ? M : Pt, V = V == S ? M : V;
    var Ft = Pt == M, Yt = V == M, Mt = Pt == V;
    if (Mt && Ye(i)) {
      if (!Ye(f))
        return !1;
      Q = !0, Ft = !1;
    }
    if (Mt && !Ft)
      return C || (C = new oe()), Q || pr(i) ? lr(i, f, p, T, J, C) : Mn(i, f, Pt, p, T, J, C);
    if (!(p & o)) {
      var kt = Ft && G.call(i, "__wrapped__"), Wt = Yt && G.call(f, "__wrapped__");
      if (kt || Wt) {
        var fe = kt ? i.value() : i, re = Wt ? f.value() : f;
        return C || (C = new oe()), J(fe, re, p, T, C);
      }
    }
    return Mt ? (C || (C = new oe()), zn(i, f, p, T, J, C)) : !1;
  }
  function Cn(i) {
    if (!yr(i) || Un(i))
      return !1;
    var f = br(i) ? Kt : et;
    return f.test(le(i));
  }
  function jn(i) {
    return Se(i) && gr(i.length) && !!z[ve(i)];
  }
  function Nn(i) {
    if (!Hn(i))
      return Re(i);
    var f = [];
    for (var p in Object(i))
      G.call(i, p) && p != "constructor" && f.push(p);
    return f;
  }
  function lr(i, f, p, T, J, C) {
    var Q = p & o, It = i.length, Pt = f.length;
    if (It != Pt && !(Q && Pt > It))
      return !1;
    var V = C.get(i);
    if (V && C.get(f))
      return V == f;
    var Ft = -1, Yt = !0, Mt = p & h ? new Pe() : void 0;
    for (C.set(i, f), C.set(f, i); ++Ft < It; ) {
      var kt = i[Ft], Wt = f[Ft];
      if (T)
        var fe = Q ? T(Wt, kt, Ft, f, i, C) : T(kt, Wt, Ft, i, f, C);
      if (fe !== void 0) {
        if (fe)
          continue;
        Yt = !1;
        break;
      }
      if (Mt) {
        if (!K(f, function(re, he) {
          if (!Rt(Mt, he) && (kt === re || J(kt, re, p, T, C)))
            return Mt.push(he);
        })) {
          Yt = !1;
          break;
        }
      } else if (!(kt === Wt || J(kt, Wt, p, T, C))) {
        Yt = !1;
        break;
      }
    }
    return C.delete(i), C.delete(f), Yt;
  }
  function Mn(i, f, p, T, J, C, Q) {
    switch (p) {
      case $t:
        if (i.byteLength != f.byteLength || i.byteOffset != f.byteOffset)
          return !1;
        i = i.buffer, f = f.buffer;
      case Jt:
        return !(i.byteLength != f.byteLength || !C(new Xt(i), new Xt(f)));
      case u:
      case y:
      case H:
        return dr(+i, +f);
      case v:
        return i.name == f.name && i.message == f.message;
      case Ct:
      case j:
        return i == f + "";
      case N:
        var It = ht;
      case F:
        var Pt = T & o;
        if (It || (It = tt), i.size != f.size && !Pt)
          return !1;
        var V = Q.get(i);
        if (V)
          return V == f;
        T |= h, Q.set(i, f);
        var Ft = lr(It(i), It(f), T, J, C, Q);
        return Q.delete(i), Ft;
      case jt:
        if (ft)
          return ft.call(i) == ft.call(f);
    }
    return !1;
  }
  function zn(i, f, p, T, J, C) {
    var Q = p & o, It = hr(i), Pt = It.length, V = hr(f), Ft = V.length;
    if (Pt != Ft && !Q)
      return !1;
    for (var Yt = Pt; Yt--; ) {
      var Mt = It[Yt];
      if (!(Q ? Mt in f : G.call(f, Mt)))
        return !1;
    }
    var kt = C.get(i);
    if (kt && C.get(f))
      return kt == f;
    var Wt = !0;
    C.set(i, f), C.set(f, i);
    for (var fe = Q; ++Yt < Pt; ) {
      Mt = It[Yt];
      var re = i[Mt], he = f[Mt];
      if (T)
        var _r = Q ? T(he, re, Mt, f, i, C) : T(re, he, Mt, i, f, C);
      if (!(_r === void 0 ? re === he || J(re, he, p, T, C) : _r)) {
        Wt = !1;
        break;
      }
      fe || (fe = Mt == "constructor");
    }
    if (Wt && !fe) {
      var Me = i.constructor, ze = f.constructor;
      Me != ze && "constructor" in i && "constructor" in f && !(typeof Me == "function" && Me instanceof Me && typeof ze == "function" && ze instanceof ze) && (Wt = !1);
    }
    return C.delete(i), C.delete(f), Wt;
  }
  function hr(i) {
    return Rn(i, Wn, Dn);
  }
  function je(i, f) {
    var p = i.__data__;
    return Kn(f) ? p[typeof f == "string" ? "string" : "hash"] : p.map;
  }
  function ge(i, f) {
    var p = yt(i, f);
    return Cn(p) ? p : void 0;
  }
  function Bn(i) {
    var f = G.call(i, Ht), p = i[Ht];
    try {
      i[Ht] = void 0;
      var T = !0;
    } catch {
    }
    var J = zt.call(i);
    return T && (f ? i[Ht] = p : delete i[Ht]), J;
  }
  var Dn = ce ? function(i) {
    return i == null ? [] : (i = Object(i), $(ce(i), function(f) {
      return qt.call(i, f);
    }));
  } : Vn, ae = ve;
  (it && ae(new it(new ArrayBuffer(1))) != $t || q && ae(new q()) != N || st && ae(st.resolve()) != Tt || ot && ae(new ot()) != F || at && ae(new at()) != gt) && (ae = function(i) {
    var f = ve(i), p = f == M ? i.constructor : void 0, T = p ? le(p) : "";
    if (T)
      switch (T) {
        case _t:
          return $t;
        case mt:
          return N;
        case xt:
          return Tt;
        case wt:
          return F;
        case vt:
          return gt;
      }
    return f;
  });
  function $n(i, f) {
    return f = f ?? E, !!f && (typeof i == "number" || xe.test(i)) && i > -1 && i % 1 == 0 && i < f;
  }
  function Kn(i) {
    var f = typeof i;
    return f == "string" || f == "number" || f == "symbol" || f == "boolean" ? i !== "__proto__" : i === null;
  }
  function Un(i) {
    return !!Nt && Nt in i;
  }
  function Hn(i) {
    var f = i && i.constructor, p = typeof f == "function" && f.prototype || U;
    return i === p;
  }
  function Fn(i) {
    return zt.call(i);
  }
  function le(i) {
    if (i != null) {
      try {
        return pt.call(i);
      } catch {
      }
      try {
        return i + "";
      } catch {
      }
    }
    return "";
  }
  function dr(i, f) {
    return i === f || i !== i && f !== f;
  }
  var Gn = cr(/* @__PURE__ */ function() {
    return arguments;
  }()) ? cr : function(i) {
    return Se(i) && G.call(i, "callee") && !qt.call(i, "callee");
  }, Ne = Array.isArray;
  function Jn(i) {
    return i != null && gr(i.length) && !br(i);
  }
  var Ye = we || Xn;
  function kn(i, f) {
    return ur(i, f);
  }
  function br(i) {
    if (!yr(i))
      return !1;
    var f = ve(i);
    return f == w || f == x || f == s || f == bt;
  }
  function gr(i) {
    return typeof i == "number" && i > -1 && i % 1 == 0 && i <= E;
  }
  function yr(i) {
    var f = typeof i;
    return i != null && (f == "object" || f == "function");
  }
  function Se(i) {
    return i != null && typeof i == "object";
  }
  var pr = D ? lt(D) : jn;
  function Wn(i) {
    return Jn(i) ? An(i) : Nn(i);
  }
  function Vn() {
    return [];
  }
  function Xn() {
    return !1;
  }
  t.exports = kn;
})(ke, ke.exports);
var Ao = ke.exports;
const Zo = /* @__PURE__ */ Dr(Ao);
export {
  Ko as A,
  jo as C,
  $o as E,
  Bo as I,
  Jo as a,
  Yo as b,
  ui as c,
  Zo as d,
  Ho as e,
  me as f,
  Go as g,
  Mo as h,
  wo as i,
  As as j,
  Do as k,
  qo as l,
  Xo as m,
  ko as n,
  lo as o,
  xo as p,
  Yr as q,
  Wo as r,
  Fo as s,
  We as t,
  on as u,
  Vo as v,
  Us as w,
  Uo as x,
  ds as y
};
