import { V as Ye, X as Kn, co as Vr, ay as Ze } from "./index-CTdUTRp6.mjs";
import { i as Xr, d as Yr, f as qr, g as Zr, j as Qr, k as ei, l as ti, m as ni, n as ri, o as ii, p as si, w as Un, r as $n, c as oi } from "./index-B4hte2VB.mjs";
function Hn(e = 0) {
  return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(e) : new Uint8Array(e);
}
function ai(e, n) {
  n || (n = e.reduce((o, d) => o + d.length, 0));
  const r = Hn(n);
  let f = 0;
  for (const o of e)
    r.set(o, f), f += o.length;
  return r;
}
const xn = {
  ...Xr,
  ...Yr,
  ...qr,
  ...Zr,
  ...Qr,
  ...ei,
  ...ti,
  ...ni,
  ...ri,
  ...ii
};
function Gn(e, n, r, f) {
  return {
    name: e,
    prefix: n,
    encoder: {
      name: e,
      prefix: n,
      encode: r
    },
    decoder: { decode: f }
  };
}
const wn = Gn("utf8", "u", (e) => "u" + new TextDecoder("utf8").decode(e), (e) => new TextEncoder().encode(e.substring(1))), qt = Gn("ascii", "a", (e) => {
  let n = "a";
  for (let r = 0; r < e.length; r++)
    n += String.fromCharCode(e[r]);
  return n;
}, (e) => {
  e = e.substring(1);
  const n = Hn(e.length);
  for (let r = 0; r < e.length; r++)
    n[r] = e.charCodeAt(r);
  return n;
}), Fn = {
  utf8: wn,
  "utf-8": wn,
  hex: xn.base16,
  latin1: qt,
  ascii: qt,
  binary: qt,
  ...xn
};
function mt(e, n = "utf8") {
  const r = Fn[n];
  if (!r)
    throw new Error(`Unsupported encoding "${n}"`);
  return (n === "utf8" || n === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(e, "utf8") : r.decoder.decode(`${r.prefix}${e}`);
}
function kt(e, n = "utf8") {
  const r = Fn[n];
  if (!r)
    throw new Error(`Unsupported encoding "${n}"`);
  return (n === "utf8" || n === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("utf8") : r.encoder.encode(e).substring(1);
}
var vn = function(e, n, r) {
  if (r || arguments.length === 2) for (var f = 0, o = n.length, d; f < o; f++)
    (d || !(f in n)) && (d || (d = Array.prototype.slice.call(n, 0, f)), d[f] = n[f]);
  return e.concat(d || Array.prototype.slice.call(n));
}, fi = (
  /** @class */
  /* @__PURE__ */ function() {
    function e(n, r, f) {
      this.name = n, this.version = r, this.os = f, this.type = "browser";
    }
    return e;
  }()
), ci = (
  /** @class */
  /* @__PURE__ */ function() {
    function e(n) {
      this.version = n, this.type = "node", this.name = "node", this.os = Ye.process.platform;
    }
    return e;
  }()
), ui = (
  /** @class */
  /* @__PURE__ */ function() {
    function e(n, r, f, o) {
      this.name = n, this.version = r, this.os = f, this.bot = o, this.type = "bot-device";
    }
    return e;
  }()
), li = (
  /** @class */
  /* @__PURE__ */ function() {
    function e() {
      this.type = "bot", this.bot = !0, this.name = "bot", this.version = null, this.os = null;
    }
    return e;
  }()
), di = (
  /** @class */
  /* @__PURE__ */ function() {
    function e() {
      this.type = "react-native", this.name = "react-native", this.version = null, this.os = null;
    }
    return e;
  }()
), hi = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, bi = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, Sn = 3, gi = [
  ["aol", /AOLShield\/([0-9\._]+)/],
  ["edge", /Edge\/([0-9\._]+)/],
  ["edge-ios", /EdgiOS\/([0-9\._]+)/],
  ["yandexbrowser", /YaBrowser\/([0-9\._]+)/],
  ["kakaotalk", /KAKAOTALK\s([0-9\.]+)/],
  ["samsung", /SamsungBrowser\/([0-9\.]+)/],
  ["silk", /\bSilk\/([0-9._-]+)\b/],
  ["miui", /MiuiBrowser\/([0-9\.]+)$/],
  ["beaker", /BeakerBrowser\/([0-9\.]+)/],
  ["edge-chromium", /EdgA?\/([0-9\.]+)/],
  [
    "chromium-webview",
    /(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/
  ],
  ["chrome", /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],
  ["phantomjs", /PhantomJS\/([0-9\.]+)(:?\s|$)/],
  ["crios", /CriOS\/([0-9\.]+)(:?\s|$)/],
  ["firefox", /Firefox\/([0-9\.]+)(?:\s|$)/],
  ["fxios", /FxiOS\/([0-9\.]+)/],
  ["opera-mini", /Opera Mini.*Version\/([0-9\.]+)/],
  ["opera", /Opera\/([0-9\.]+)(?:\s|$)/],
  ["opera", /OPR\/([0-9\.]+)(:?\s|$)/],
  ["pie", /^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],
  ["pie", /^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],
  ["netfront", /^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],
  ["ie", /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],
  ["ie", /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],
  ["ie", /MSIE\s(7\.0)/],
  ["bb10", /BB10;\sTouch.*Version\/([0-9\.]+)/],
  ["android", /Android\s([0-9\.]+)/],
  ["ios", /Version\/([0-9\._]+).*Mobile.*Safari.*/],
  ["safari", /Version\/([0-9\._]+).*Safari/],
  ["facebook", /FB[AS]V\/([0-9\.]+)/],
  ["instagram", /Instagram\s([0-9\.]+)/],
  ["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/],
  ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/],
  ["curl", /^curl\/([0-9\.]+)$/],
  ["searchbot", hi]
], En = [
  ["iOS", /iP(hone|od|ad)/],
  ["Android OS", /Android/],
  ["BlackBerry OS", /BlackBerry|BB10/],
  ["Windows Mobile", /IEMobile/],
  ["Amazon OS", /Kindle/],
  ["Windows 3.11", /Win16/],
  ["Windows 95", /(Windows 95)|(Win95)|(Windows_95)/],
  ["Windows 98", /(Windows 98)|(Win98)/],
  ["Windows 2000", /(Windows NT 5.0)|(Windows 2000)/],
  ["Windows XP", /(Windows NT 5.1)|(Windows XP)/],
  ["Windows Server 2003", /(Windows NT 5.2)/],
  ["Windows Vista", /(Windows NT 6.0)/],
  ["Windows 7", /(Windows NT 6.1)/],
  ["Windows 8", /(Windows NT 6.2)/],
  ["Windows 8.1", /(Windows NT 6.3)/],
  ["Windows 10", /(Windows NT 10.0)/],
  ["Windows ME", /Windows ME/],
  ["Windows CE", /Windows CE|WinCE|Microsoft Pocket Internet Explorer/],
  ["Open BSD", /OpenBSD/],
  ["Sun OS", /SunOS/],
  ["Chrome OS", /CrOS/],
  ["Linux", /(Linux)|(X11)/],
  ["Mac OS", /(Mac_PowerPC)|(Macintosh)/],
  ["QNX", /QNX/],
  ["BeOS", /BeOS/],
  ["OS/2", /OS\/2/]
];
function Bo(e) {
  return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new di() : typeof navigator < "u" ? pi(navigator.userAgent) : mi();
}
function yi(e) {
  return e !== "" && gi.reduce(function(n, r) {
    var f = r[0], o = r[1];
    if (n)
      return n;
    var d = o.exec(e);
    return !!d && [f, d];
  }, !1);
}
function pi(e) {
  var n = yi(e);
  if (!n)
    return null;
  var r = n[0], f = n[1];
  if (r === "searchbot")
    return new li();
  var o = f[1] && f[1].split(".").join("_").split("_").slice(0, 3);
  o ? o.length < Sn && (o = vn(vn([], o, !0), xi(Sn - o.length), !0)) : o = [];
  var d = o.join("."), E = _i(e), S = bi.exec(e);
  return S && S[1] ? new ui(r, d, E, S[1]) : new fi(r, d, E);
}
function _i(e) {
  for (var n = 0, r = En.length; n < r; n++) {
    var f = En[n], o = f[0], d = f[1], E = d.exec(e);
    if (E)
      return o;
  }
  return null;
}
function mi() {
  var e = typeof Ye.process < "u" && Ye.process.version;
  return e ? new ci(Ye.process.version.slice(1)) : null;
}
function xi(e) {
  for (var n = [], r = 0; r < e; r++)
    n.push("0");
  return n;
}
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" } }, wi = /"(?:_|\\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*:/, vi = /"(?: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*:/, Si = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
function Ei(e, n) {
  if (e === "__proto__" || e === "constructor" && n && typeof n == "object" && "prototype" in n) {
    Ii(e);
    return;
  }
  return n;
}
function Ii(e) {
  console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);
}
function zt(e, n = {}) {
  if (typeof e != "string")
    return e;
  const r = e.trim();
  if (
    // eslint-disable-next-line unicorn/prefer-at
    e[0] === '"' && e.endsWith('"') && !e.includes("\\")
  )
    return r.slice(1, -1);
  if (r.length <= 9) {
    const f = r.toLowerCase();
    if (f === "true")
      return !0;
    if (f === "false")
      return !1;
    if (f === "undefined")
      return;
    if (f === "null")
      return null;
    if (f === "nan")
      return Number.NaN;
    if (f === "infinity")
      return Number.POSITIVE_INFINITY;
    if (f === "-infinity")
      return Number.NEGATIVE_INFINITY;
  }
  if (!Si.test(e)) {
    if (n.strict)
      throw new SyntaxError("[destr] Invalid JSON");
    return e;
  }
  try {
    if (wi.test(e) || vi.test(e)) {
      if (n.strict)
        throw new Error("[destr] Possible prototype pollution");
      return JSON.parse(e, Ei);
    }
    return JSON.parse(e);
  } catch (f) {
    if (n.strict)
      throw f;
    return e;
  }
}
function Oi(e) {
  return !e || typeof e.then != "function" ? Promise.resolve(e) : e;
}
function Oe(e, ...n) {
  try {
    return Oi(e(...n));
  } catch (r) {
    return Promise.reject(r);
  }
}
function Ti(e) {
  const n = typeof e;
  return e === null || n !== "object" && n !== "function";
}
function Ai(e) {
  const n = Object.getPrototypeOf(e);
  return !n || n.isPrototypeOf(Object);
}
function Ut(e) {
  if (Ti(e))
    return String(e);
  if (Ai(e) || Array.isArray(e))
    return JSON.stringify(e);
  if (typeof e.toJSON == "function")
    return Ut(e.toJSON());
  throw new Error("[unstorage] Cannot stringify value!");
}
const tn = "base64:";
function Li(e) {
  return typeof e == "string" ? e : tn + Ni(e);
}
function Ri(e) {
  return typeof e != "string" || !e.startsWith(tn) ? e : Pi(e.slice(tn.length));
}
function Pi(e) {
  return globalThis.Buffer ? Ye.Buffer.from(e, "base64") : Uint8Array.from(
    globalThis.atob(e),
    (n) => n.codePointAt(0)
  );
}
function Ni(e) {
  return globalThis.Buffer ? Ye.Buffer.from(e).toString("base64") : globalThis.btoa(String.fromCodePoint(...e));
}
function De(e) {
  var n;
  return e && ((n = e.split("?")[0]) == null ? void 0 : n.replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "")) || "";
}
function Ci(...e) {
  return De(e.join(":"));
}
function Dt(e) {
  return e = De(e), e ? e + ":" : "";
}
const Mi = "memory", Bi = () => {
  const e = /* @__PURE__ */ new Map();
  return {
    name: Mi,
    getInstance: () => e,
    hasItem(n) {
      return e.has(n);
    },
    getItem(n) {
      return e.get(n) ?? null;
    },
    getItemRaw(n) {
      return e.get(n) ?? null;
    },
    setItem(n, r) {
      e.set(n, r);
    },
    setItemRaw(n, r) {
      e.set(n, r);
    },
    removeItem(n) {
      e.delete(n);
    },
    getKeys() {
      return [...e.keys()];
    },
    clear() {
      e.clear();
    },
    dispose() {
      e.clear();
    }
  };
};
function ji(e = {}) {
  const n = {
    mounts: { "": e.driver || Bi() },
    mountpoints: [""],
    watching: !1,
    watchListeners: [],
    unwatch: {}
  }, r = (s) => {
    for (const u of n.mountpoints)
      if (s.startsWith(u))
        return {
          base: u,
          relativeKey: s.slice(u.length),
          driver: n.mounts[u]
        };
    return {
      base: "",
      relativeKey: s,
      driver: n.mounts[""]
    };
  }, f = (s, u) => n.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: n.mounts[y]
  })), o = (s, u) => {
    if (n.watching) {
      u = De(u);
      for (const y of n.watchListeners)
        y(s, u);
    }
  }, d = async () => {
    if (!n.watching) {
      n.watching = !0;
      for (const s in n.mounts)
        n.unwatch[s] = await In(
          n.mounts[s],
          o,
          s
        );
    }
  }, E = async () => {
    if (n.watching) {
      for (const s in n.unwatch)
        await n.unwatch[s]();
      n.unwatch = {}, n.watching = !1;
    }
  }, S = (s, u, y) => {
    const v = /* @__PURE__ */ new Map(), w = (x) => {
      let M = v.get(x.base);
      return M || (M = {
        driver: x.driver,
        base: x.base,
        items: []
      }, v.set(x.base, M)), M;
    };
    for (const x of s) {
      const M = typeof x == "string", H = De(M ? x : x.key), ce = M ? void 0 : x.value, B = M || !x.options ? u : { ...u, ...x.options }, Te = r(H);
      w(Te).items.push({
        key: H,
        value: ce,
        relativeKey: Te.relativeKey,
        options: B
      });
    }
    return Promise.all([...v.values()].map((x) => y(x))).then(
      (x) => x.flat()
    );
  }, g = {
    // Item
    hasItem(s, u = {}) {
      s = De(s);
      const { relativeKey: y, driver: v } = r(s);
      return Oe(v.hasItem, y, u);
    },
    getItem(s, u = {}) {
      s = De(s);
      const { relativeKey: y, driver: v } = r(s);
      return Oe(v.getItem, y, u).then(
        (w) => zt(w)
      );
    },
    getItems(s, u = {}) {
      return S(s, u, (y) => y.driver.getItems ? Oe(
        y.driver.getItems,
        y.items.map((v) => ({
          key: v.relativeKey,
          options: v.options
        })),
        u
      ).then(
        (v) => v.map((w) => ({
          key: Ci(y.base, w.key),
          value: zt(w.value)
        }))
      ) : Promise.all(
        y.items.map((v) => Oe(
          y.driver.getItem,
          v.relativeKey,
          v.options
        ).then((w) => ({
          key: v.key,
          value: zt(w)
        })))
      ));
    },
    getItemRaw(s, u = {}) {
      s = De(s);
      const { relativeKey: y, driver: v } = r(s);
      return v.getItemRaw ? Oe(v.getItemRaw, y, u) : Oe(v.getItem, y, u).then(
        (w) => Ri(w)
      );
    },
    async setItem(s, u, y = {}) {
      if (u === void 0)
        return g.removeItem(s);
      s = De(s);
      const { relativeKey: v, driver: w } = r(s);
      w.setItem && (await Oe(w.setItem, v, Ut(u), y), w.watch || o("update", s));
    },
    async setItems(s, u) {
      await S(s, u, async (y) => {
        if (y.driver.setItems)
          return Oe(
            y.driver.setItems,
            y.items.map((v) => ({
              key: v.relativeKey,
              value: Ut(v.value),
              options: v.options
            })),
            u
          );
        y.driver.setItem && await Promise.all(
          y.items.map((v) => Oe(
            y.driver.setItem,
            v.relativeKey,
            Ut(v.value),
            v.options
          ))
        );
      });
    },
    async setItemRaw(s, u, y = {}) {
      if (u === void 0)
        return g.removeItem(s, y);
      s = De(s);
      const { relativeKey: v, driver: w } = r(s);
      if (w.setItemRaw)
        await Oe(w.setItemRaw, v, u, y);
      else if (w.setItem)
        await Oe(w.setItem, v, Li(u), y);
      else
        return;
      w.watch || o("update", s);
    },
    async removeItem(s, u = {}) {
      typeof u == "boolean" && (u = { removeMeta: u }), s = De(s);
      const { relativeKey: y, driver: v } = r(s);
      v.removeItem && (await Oe(v.removeItem, y, u), (u.removeMeta || u.removeMata) && await Oe(v.removeItem, y + "$", u), v.watch || o("remove", s));
    },
    // Meta
    async getMeta(s, u = {}) {
      typeof u == "boolean" && (u = { nativeOnly: u }), s = De(s);
      const { relativeKey: y, driver: v } = r(s), w = /* @__PURE__ */ Object.create(null);
      if (v.getMeta && Object.assign(w, await Oe(v.getMeta, y, u)), !u.nativeOnly) {
        const x = await Oe(
          v.getItem,
          y + "$",
          u
        ).then((M) => zt(M));
        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 = Dt(s);
      const y = f(s, !0);
      let v = [];
      const w = [];
      for (const x of y) {
        const M = await Oe(
          x.driver.getKeys,
          x.relativeBase,
          u
        );
        for (const H of M) {
          const ce = x.mountpoint + De(H);
          v.some((B) => ce.startsWith(B)) || w.push(ce);
        }
        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 = Dt(s), await Promise.all(
        f(s, !1).map(async (y) => {
          if (y.driver.clear)
            return Oe(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(n.mounts).map((s) => On(s))
      );
    },
    async watch(s) {
      return await d(), n.watchListeners.push(s), async () => {
        n.watchListeners = n.watchListeners.filter(
          (u) => u !== s
        ), n.watchListeners.length === 0 && await E();
      };
    },
    async unwatch() {
      n.watchListeners = [], await E();
    },
    // Mount
    mount(s, u) {
      if (s = Dt(s), s && n.mounts[s])
        throw new Error(`already mounted at ${s}`);
      return s && (n.mountpoints.push(s), n.mountpoints.sort((y, v) => v.length - y.length)), n.mounts[s] = u, n.watching && Promise.resolve(In(u, o, s)).then((y) => {
        n.unwatch[s] = y;
      }).catch(console.error), g;
    },
    async unmount(s, u = !0) {
      var y, v;
      s = Dt(s), !(!s || !n.mounts[s]) && (n.watching && s in n.unwatch && ((v = (y = n.unwatch)[s]) == null || v.call(y), delete n.unwatch[s]), u && await On(n.mounts[s]), n.mountpoints = n.mountpoints.filter((w) => w !== s), delete n.mounts[s]);
    },
    getMount(s = "") {
      s = De(s) + ":";
      const u = r(s);
      return {
        driver: u.driver,
        base: u.base
      };
    },
    getMounts(s = "", u = {}) {
      return s = De(s), f(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 In(e, n, r) {
  return e.watch ? e.watch((f, o) => n(f, r + o)) : () => {
  };
}
async function On(e) {
  typeof e.dispose == "function" && await Oe(e.dispose);
}
function ht(e) {
  return new Promise((n, r) => {
    e.oncomplete = e.onsuccess = () => n(e.result), e.onabort = e.onerror = () => r(e.error);
  });
}
function Wn(e, n) {
  const r = indexedDB.open(e);
  r.onupgradeneeded = () => r.result.createObjectStore(n);
  const f = ht(r);
  return (o, d) => f.then((E) => d(E.transaction(n, o).objectStore(n)));
}
let Zt;
function At() {
  return Zt || (Zt = Wn("keyval-store", "keyval")), Zt;
}
function Tn(e, n = At()) {
  return n("readonly", (r) => ht(r.get(e)));
}
function zi(e, n, r = At()) {
  return r("readwrite", (f) => (f.put(n, e), ht(f.transaction)));
}
function Di(e, n = At()) {
  return n("readwrite", (r) => (r.delete(e), ht(r.transaction)));
}
function Ki(e = At()) {
  return e("readwrite", (n) => (n.clear(), ht(n.transaction)));
}
function Ui(e, n) {
  return e.openCursor().onsuccess = function() {
    this.result && (n(this.result), this.result.continue());
  }, ht(e.transaction);
}
function $i(e = At()) {
  return e("readonly", (n) => {
    if (n.getAllKeys)
      return ht(n.getAllKeys());
    const r = [];
    return Ui(n, (f) => r.push(f.key)).then(() => r);
  });
}
const Hi = (e) => JSON.stringify(e, (n, r) => typeof r == "bigint" ? r.toString() + "n" : r), Gi = (e) => {
  const n = /([\[:])?(\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, r = e.replace(n, '$1"$2n"$3');
  return JSON.parse(r, (f, o) => typeof o == "string" && o.match(/^\d+n$/) ? BigInt(o.substring(0, o.length - 1)) : o);
};
function Jn(e) {
  if (typeof e != "string")
    throw new Error(`Cannot safe json parse value of type ${typeof e}`);
  try {
    return Gi(e);
  } catch {
    return e;
  }
}
function kn(e) {
  return typeof e == "string" ? e : Hi(e) || "";
}
const Fi = "idb-keyval";
var Wi = (e = {}) => {
  const n = e.base && e.base.length > 0 ? `${e.base}:` : "", r = (o) => n + o;
  let f;
  return e.dbName && e.storeName && (f = Wn(e.dbName, e.storeName)), { name: Fi, options: e, async hasItem(o) {
    return !(typeof await Tn(r(o), f) > "u");
  }, async getItem(o) {
    return await Tn(r(o), f) ?? null;
  }, setItem(o, d) {
    return zi(r(o), d, f);
  }, removeItem(o) {
    return Di(r(o), f);
  }, getKeys() {
    return $i(f);
  }, clear() {
    return Ki(f);
  } };
};
const Ji = "WALLET_CONNECT_V2_INDEXED_DB", ki = "keyvaluestorage";
let Vi = class {
  constructor() {
    this.indexedDb = ji({ driver: Wi({ dbName: Ji, storeName: ki }) });
  }
  async getKeys() {
    return this.indexedDb.getKeys();
  }
  async getEntries() {
    return (await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((n) => [n.key, n.value]);
  }
  async getItem(n) {
    const r = await this.indexedDb.getItem(n);
    if (r !== null) return r;
  }
  async setItem(n, r) {
    await this.indexedDb.setItem(n, kn(r));
  }
  async removeItem(n) {
    await this.indexedDb.removeItem(n);
  }
};
var Qt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof Ye.global < "u" ? Ye.global : typeof self < "u" ? self : {}, $t = { exports: {} };
(function() {
  let e;
  function n() {
  }
  e = n, e.prototype.getItem = function(r) {
    return this.hasOwnProperty(r) ? String(this[r]) : null;
  }, e.prototype.setItem = function(r, f) {
    this[r] = String(f);
  }, e.prototype.removeItem = function(r) {
    delete this[r];
  }, e.prototype.clear = function() {
    const r = this;
    Object.keys(r).forEach(function(f) {
      r[f] = void 0, delete r[f];
    });
  }, e.prototype.key = function(r) {
    return r = r || 0, Object.keys(this)[r];
  }, e.prototype.__defineGetter__("length", function() {
    return Object.keys(this).length;
  }), typeof Qt < "u" && Qt.localStorage ? $t.exports = Qt.localStorage : typeof window < "u" && window.localStorage ? $t.exports = window.localStorage : $t.exports = new n();
})();
function Xi(e) {
  var n;
  return [e[0], Jn((n = e[1]) != null ? n : "")];
}
class Yi {
  constructor() {
    this.localStorage = $t.exports;
  }
  async getKeys() {
    return Object.keys(this.localStorage);
  }
  async getEntries() {
    return Object.entries(this.localStorage).map(Xi);
  }
  async getItem(n) {
    const r = this.localStorage.getItem(n);
    if (r !== null) return Jn(r);
  }
  async setItem(n, r) {
    this.localStorage.setItem(n, kn(r));
  }
  async removeItem(n) {
    this.localStorage.removeItem(n);
  }
}
const qi = "wc_storage_version", An = 1, Zi = async (e, n, r) => {
  const f = qi, o = await n.getItem(f);
  if (o && o >= An) {
    r(n);
    return;
  }
  const d = await e.getKeys();
  if (!d.length) {
    r(n);
    return;
  }
  const E = [];
  for (; d.length; ) {
    const S = d.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 e.getItem(S);
      await n.setItem(S, s), E.push(S);
    }
  }
  await n.setItem(f, An), r(n), Qi(e, E);
}, Qi = async (e, n) => {
  n.length && n.forEach(async (r) => {
    await e.removeItem(r);
  });
};
class Do {
  constructor() {
    this.initialized = !1, this.setInitialized = (r) => {
      this.storage = r, this.initialized = !0;
    };
    const n = new Yi();
    this.storage = n;
    try {
      const r = new Vi();
      Zi(n, r, 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(n) {
    return await this.initialize(), this.storage.getItem(n);
  }
  async setItem(n, r) {
    return await this.initialize(), this.storage.setItem(n, r);
  }
  async removeItem(n) {
    return await this.initialize(), this.storage.removeItem(n);
  }
  async initialize() {
    this.initialized || await new Promise((n) => {
      const r = setInterval(() => {
        this.initialized && (clearInterval(r), n());
      }, 20);
    });
  }
}
class Ko {
}
function es(e) {
  try {
    return JSON.stringify(e);
  } catch {
    return '"[Circular]"';
  }
}
var ts = ns;
function ns(e, n, r) {
  var f = r && r.stringify || es, o = 1;
  if (typeof e == "object" && e !== null) {
    var d = n.length + o;
    if (d === 1) return e;
    var E = new Array(d);
    E[0] = f(e);
    for (var S = 1; S < d; S++)
      E[S] = f(n[S]);
    return E.join(" ");
  }
  if (typeof e != "string")
    return e;
  var g = n.length;
  if (g === 0) return e;
  for (var s = "", u = 1 - o, y = -1, v = e && e.length || 0, w = 0; w < v; ) {
    if (e.charCodeAt(w) === 37 && w + 1 < v) {
      switch (y = y > -1 ? y : 0, e.charCodeAt(w + 1)) {
        case 100:
        case 102:
          if (u >= g || n[u] == null) break;
          y < w && (s += e.slice(y, w)), s += Number(n[u]), y = w + 2, w++;
          break;
        case 105:
          if (u >= g || n[u] == null) break;
          y < w && (s += e.slice(y, w)), s += Math.floor(Number(n[u])), y = w + 2, w++;
          break;
        case 79:
        case 111:
        case 106:
          if (u >= g || n[u] === void 0) break;
          y < w && (s += e.slice(y, w));
          var x = typeof n[u];
          if (x === "string") {
            s += "'" + n[u] + "'", y = w + 2, w++;
            break;
          }
          if (x === "function") {
            s += n[u].name || "<anonymous>", y = w + 2, w++;
            break;
          }
          s += f(n[u]), y = w + 2, w++;
          break;
        case 115:
          if (u >= g)
            break;
          y < w && (s += e.slice(y, w)), s += String(n[u]), y = w + 2, w++;
          break;
        case 37:
          y < w && (s += e.slice(y, w)), s += "%", y = w + 2, w++, u--;
          break;
      }
      ++u;
    }
    ++w;
  }
  return y === -1 ? e : (y < v && (s += e.slice(y)), s);
}
const Ln = ts;
var _t = Qe;
const It = ds().console || {}, rs = {
  mapHttpRequest: Kt,
  mapHttpResponse: Kt,
  wrapRequestSerializer: en,
  wrapResponseSerializer: en,
  wrapErrorSerializer: en,
  req: Kt,
  res: Kt,
  err: fs
};
function is(e, n) {
  return Array.isArray(e) ? e.filter(function(f) {
    return f !== "!stdSerializers.err";
  }) : e === !0 ? Object.keys(n) : !1;
}
function Qe(e) {
  e = e || {}, e.browser = e.browser || {};
  const n = e.browser.transmit;
  if (n && typeof n.send != "function")
    throw Error("pino: transmit option must have a send function");
  const r = e.browser.write || It;
  e.browser.write && (e.browser.asObject = !0);
  const f = e.serializers || {}, o = is(e.browser.serialize, f);
  let d = e.browser.serialize;
  Array.isArray(e.browser.serialize) && e.browser.serialize.indexOf("!stdSerializers.err") > -1 && (d = !1);
  const E = ["error", "fatal", "warn", "info", "debug", "trace"];
  typeof r == "function" && (r.error = r.fatal = r.warn = r.info = r.debug = r.trace = r), e.enabled === !1 && (e.level = "silent");
  const S = e.level || "info", g = Object.create(r);
  g.log || (g.log = Ot), Object.defineProperty(g, "levelVal", {
    get: u
  }), Object.defineProperty(g, "level", {
    get: y,
    set: v
  });
  const s = {
    transmit: n,
    serialize: o,
    asObject: e.browser.asObject,
    levels: E,
    timestamp: cs(e)
  };
  g.levels = Qe.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 = Ot, g.serializers = f, g._serialize = o, g._stdErrSerialize = d, g.child = w, n && (g._logEvent = nn());
  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, yt(s, g, "error", "log"), yt(s, g, "fatal", "error"), yt(s, g, "warn", "error"), yt(s, g, "info", "log"), yt(s, g, "debug", "log"), yt(s, g, "trace", "log");
  }
  function w(x, M) {
    if (!x)
      throw new Error("missing bindings for child Pino");
    M = M || {}, o && x.serializers && (M.serializers = x.serializers);
    const H = M.serializers;
    if (o && H) {
      var ce = Object.assign({}, f, H), B = e.browser.serialize === !0 ? Object.keys(ce) : o;
      delete x.serializers, Vt([x], B, ce, this._stdErrSerialize);
    }
    function Te(be) {
      this._childLevel = (be._childLevel | 0) + 1, this.error = pt(be, x, "error"), this.fatal = pt(be, x, "fatal"), this.warn = pt(be, x, "warn"), this.info = pt(be, x, "info"), this.debug = pt(be, x, "debug"), this.trace = pt(be, x, "trace"), ce && (this.serializers = ce, this._serialize = B), n && (this._logEvent = nn(
        [].concat(be._logEvent.bindings, x)
      ));
    }
    return Te.prototype = this, new Te(this);
  }
  return g;
}
Qe.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"
  }
};
Qe.stdSerializers = rs;
Qe.stdTimeFunctions = Object.assign({}, { nullTime: Vn, epochTime: Xn, unixTime: us, isoTime: ls });
function yt(e, n, r, f) {
  const o = Object.getPrototypeOf(n);
  n[r] = n.levelVal > n.levels.values[r] ? Ot : o[r] ? o[r] : It[r] || It[f] || Ot, ss(e, n, r);
}
function ss(e, n, r) {
  !e.transmit && n[r] === Ot || (n[r] = /* @__PURE__ */ function(f) {
    return function() {
      const d = e.timestamp(), E = new Array(arguments.length), S = Object.getPrototypeOf && Object.getPrototypeOf(this) === It ? It : this;
      for (var g = 0; g < E.length; g++) E[g] = arguments[g];
      if (e.serialize && !e.asObject && Vt(E, this._serialize, this.serializers, this._stdErrSerialize), e.asObject ? f.call(S, os(this, r, E, d)) : f.apply(S, E), e.transmit) {
        const s = e.transmit.level || n.level, u = Qe.levels.values[s], y = Qe.levels.values[r];
        if (y < u) return;
        as(this, {
          ts: d,
          methodLevel: r,
          methodValue: y,
          transmitLevel: s,
          transmitValue: Qe.levels.values[e.transmit.level || n.level],
          send: e.transmit.send,
          val: n.levelVal
        }, E);
      }
    };
  }(n[r]));
}
function os(e, n, r, f) {
  e._serialize && Vt(r, e._serialize, e.serializers, e._stdErrSerialize);
  const o = r.slice();
  let d = o[0];
  const E = {};
  f && (E.time = f), E.level = Qe.levels.values[n];
  let S = (e._childLevel | 0) + 1;
  if (S < 1 && (S = 1), d !== null && typeof d == "object") {
    for (; S-- && typeof o[0] == "object"; )
      Object.assign(E, o.shift());
    d = o.length ? Ln(o.shift(), o) : void 0;
  } else typeof d == "string" && (d = Ln(o.shift(), o));
  return d !== void 0 && (E.msg = d), E;
}
function Vt(e, n, r, f) {
  for (const o in e)
    if (f && e[o] instanceof Error)
      e[o] = Qe.stdSerializers.err(e[o]);
    else if (typeof e[o] == "object" && !Array.isArray(e[o]))
      for (const d in e[o])
        n && n.indexOf(d) > -1 && d in r && (e[o][d] = r[d](e[o][d]));
}
function pt(e, n, r) {
  return function() {
    const f = new Array(1 + arguments.length);
    f[0] = n;
    for (var o = 1; o < f.length; o++)
      f[o] = arguments[o - 1];
    return e[r].apply(this, f);
  };
}
function as(e, n, r) {
  const f = n.send, o = n.ts, d = n.methodLevel, E = n.methodValue, S = n.val, g = e._logEvent.bindings;
  Vt(
    r,
    e._serialize || Object.keys(e.serializers),
    e.serializers,
    e._stdErrSerialize === void 0 ? !0 : e._stdErrSerialize
  ), e._logEvent.ts = o, e._logEvent.messages = r.filter(function(s) {
    return g.indexOf(s) === -1;
  }), e._logEvent.level.label = d, e._logEvent.level.value = E, f(d, e._logEvent, S), e._logEvent = nn(g);
}
function nn(e) {
  return {
    ts: 0,
    messages: [],
    bindings: e || [],
    level: { label: "", value: 0 }
  };
}
function fs(e) {
  const n = {
    type: e.constructor.name,
    msg: e.message,
    stack: e.stack
  };
  for (const r in e)
    n[r] === void 0 && (n[r] = e[r]);
  return n;
}
function cs(e) {
  return typeof e.timestamp == "function" ? e.timestamp : e.timestamp === !1 ? Vn : Xn;
}
function Kt() {
  return {};
}
function en(e) {
  return e;
}
function Ot() {
}
function Vn() {
  return !1;
}
function Xn() {
  return Date.now();
}
function us() {
  return Math.round(Date.now() / 1e3);
}
function ls() {
  return new Date(Date.now()).toISOString();
}
function ds() {
  function e(n) {
    return typeof n < "u" && n;
  }
  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 e(self) || e(window) || e(this) || {};
  }
}
const Yn = /* @__PURE__ */ Kn(_t), hs = (e) => JSON.stringify(e, (n, r) => typeof r == "bigint" ? r.toString() + "n" : r);
function Rn(e) {
  return typeof e == "string" ? e : hs(e) || "";
}
const bs = { level: "info" }, Lt = "custom_context", an = 1e3 * 1024;
class gs {
  constructor(n) {
    this.nodeValue = n, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null;
  }
  get value() {
    return this.nodeValue;
  }
  get size() {
    return this.sizeInBytes;
  }
}
class Pn {
  constructor(n) {
    this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = n, this.sizeInBytes = 0;
  }
  append(n) {
    const r = new gs(n);
    if (r.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${n} with size ${r.size}`);
    for (; this.size + r.size > this.maxSizeInBytes; ) this.shift();
    this.head ? (this.tail && (this.tail.next = r), this.tail = r) : (this.head = r, this.tail = r), this.lengthInNodes++, this.sizeInBytes += r.size;
  }
  shift() {
    if (!this.head) return;
    const n = this.head;
    this.head = this.head.next, this.head || (this.tail = null), this.lengthInNodes--, this.sizeInBytes -= n.size;
  }
  toArray() {
    const n = [];
    let r = this.head;
    for (; r !== null; ) n.push(r.value), r = r.next;
    return n;
  }
  get length() {
    return this.lengthInNodes;
  }
  get size() {
    return this.sizeInBytes;
  }
  toOrderedArray() {
    return Array.from(this);
  }
  [Symbol.iterator]() {
    let n = this.head;
    return { next: () => {
      if (!n) return { done: !0, value: null };
      const r = n.value;
      return n = n.next, { done: !1, value: r };
    } };
  }
}
class qn {
  constructor(n, r = an) {
    this.level = n ?? "error", this.levelValue = _t.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new Pn(this.MAX_LOG_SIZE_IN_BYTES);
  }
  forwardToConsole(n, r) {
    r === _t.levels.values.error ? console.error(n) : r === _t.levels.values.warn ? console.warn(n) : r === _t.levels.values.debug ? console.debug(n) : r === _t.levels.values.trace ? console.trace(n) : console.log(n);
  }
  appendToLogs(n) {
    this.logs.append(Rn({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: n }));
    const r = typeof n == "string" ? JSON.parse(n).level : n.level;
    r >= this.levelValue && this.forwardToConsole(n, r);
  }
  getLogs() {
    return this.logs;
  }
  clearLogs() {
    this.logs = new Pn(this.MAX_LOG_SIZE_IN_BYTES);
  }
  getLogArray() {
    return Array.from(this.logs);
  }
  logsToBlob(n) {
    const r = this.getLogArray();
    return r.push(Rn({ extraMetadata: n })), new Blob(r, { type: "application/json" });
  }
}
class ys {
  constructor(n, r = an) {
    this.baseChunkLogger = new qn(n, r);
  }
  write(n) {
    this.baseChunkLogger.appendToLogs(n);
  }
  getLogs() {
    return this.baseChunkLogger.getLogs();
  }
  clearLogs() {
    this.baseChunkLogger.clearLogs();
  }
  getLogArray() {
    return this.baseChunkLogger.getLogArray();
  }
  logsToBlob(n) {
    return this.baseChunkLogger.logsToBlob(n);
  }
  downloadLogsBlobInBrowser(n) {
    const r = URL.createObjectURL(this.logsToBlob(n)), f = document.createElement("a");
    f.href = r, f.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(f), f.click(), document.body.removeChild(f), URL.revokeObjectURL(r);
  }
}
class ps {
  constructor(n, r = an) {
    this.baseChunkLogger = new qn(n, r);
  }
  write(n) {
    this.baseChunkLogger.appendToLogs(n);
  }
  getLogs() {
    return this.baseChunkLogger.getLogs();
  }
  clearLogs() {
    this.baseChunkLogger.clearLogs();
  }
  getLogArray() {
    return this.baseChunkLogger.getLogArray();
  }
  logsToBlob(n) {
    return this.baseChunkLogger.logsToBlob(n);
  }
}
var _s = Object.defineProperty, ms = Object.defineProperties, xs = Object.getOwnPropertyDescriptors, Nn = Object.getOwnPropertySymbols, ws = Object.prototype.hasOwnProperty, vs = Object.prototype.propertyIsEnumerable, Cn = (e, n, r) => n in e ? _s(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r, Ht = (e, n) => {
  for (var r in n || (n = {})) ws.call(n, r) && Cn(e, r, n[r]);
  if (Nn) for (var r of Nn(n)) vs.call(n, r) && Cn(e, r, n[r]);
  return e;
}, Gt = (e, n) => ms(e, xs(n));
function Uo(e) {
  return Gt(Ht({}, e), { level: (e == null ? void 0 : e.level) || bs.level });
}
function Ss(e, n = Lt) {
  return e[n] || "";
}
function Es(e, n, r = Lt) {
  return e[r] = n, e;
}
function Is(e, n = Lt) {
  let r = "";
  return typeof e.bindings > "u" ? r = Ss(e, n) : r = e.bindings().context || "", r;
}
function Os(e, n, r = Lt) {
  const f = Is(e, r);
  return f.trim() ? `${f}/${n}` : n;
}
function $o(e, n, r = Lt) {
  const f = Os(e, n, r), o = e.child({ context: f });
  return Es(o, f, r);
}
function Ts(e) {
  var n, r;
  const f = new ys((n = e.opts) == null ? void 0 : n.level, e.maxSizeInBytes);
  return { logger: Yn(Gt(Ht({}, e.opts), { level: "trace", browser: Gt(Ht({}, (r = e.opts) == null ? void 0 : r.browser), { write: (o) => f.write(o) }) })), chunkLoggerController: f };
}
function As(e) {
  var n;
  const r = new ps((n = e.opts) == null ? void 0 : n.level, e.maxSizeInBytes);
  return { logger: Yn(Gt(Ht({}, e.opts), { level: "trace" }), r), chunkLoggerController: r };
}
function Ho(e) {
  return typeof e.loggerOverride < "u" && typeof e.loggerOverride != "string" ? { logger: e.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? Ts(e) : As(e);
}
var fn = {}, Zn = {};
(function(e) {
  Object.defineProperty(e, "__esModule", { value: !0 });
  var n = si, r = Un;
  e.DIGEST_LENGTH = 64, e.BLOCK_SIZE = 128;
  var f = (
    /** @class */
    function() {
      function S() {
        this.digestLength = e.DIGEST_LENGTH, this.blockSize = e.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() {
        r.wipe(this._buffer), r.wipe(this._tempHi), r.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 < e.BLOCK_SIZE && s > 0; )
            this._buffer[this._bufferLength++] = g[u++], s--;
          this._bufferLength === this.blockSize && (d(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, this.blockSize), this._bufferLength = 0);
        }
        for (s >= this.blockSize && (u = d(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;
          n.writeUint32BE(y, this._buffer, w - 8), n.writeUint32BE(v, this._buffer, w - 4), d(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, w), this._finished = !0;
        }
        for (var x = 0; x < this.digestLength / 8; x++)
          n.writeUint32BE(this._stateHi[x], g, x * 8), n.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) {
        r.wipe(g.stateHi), r.wipe(g.stateLo), g.buffer && r.wipe(g.buffer), g.bufferLength = 0, g.bytesHashed = 0;
      }, S;
    }()
  );
  e.SHA512 = f;
  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 d(S, g, s, u, y, v, w) {
    for (var x = s[0], M = s[1], H = s[2], ce = s[3], B = s[4], Te = s[5], be = s[6], Ne = s[7], G = u[0], C = u[1], Ce = u[2], et = u[3], ge = u[4], Fe = u[5], Ke = u[6], ke = u[7], m, _, X, ue, L, I, O, A; w >= 128; ) {
      for (var Ae = 0; Ae < 16; Ae++) {
        var te = 8 * Ae + v;
        S[Ae] = n.readUint32BE(y, te), g[Ae] = n.readUint32BE(y, te + 4);
      }
      for (var Ae = 0; Ae < 80; Ae++) {
        var xt = x, j = M, bt = H, b = ce, h = B, l = Te, t = be, a = Ne, R = G, P = C, D = Ce, K = et, z = ge, U = Fe, Le = Ke, le = ke;
        if (m = Ne, _ = ke, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = (B >>> 14 | ge << 18) ^ (B >>> 18 | ge << 14) ^ (ge >>> 9 | B << 23), _ = (ge >>> 14 | B << 18) ^ (ge >>> 18 | B << 14) ^ (B >>> 9 | ge << 23), L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, m = B & Te ^ ~B & be, _ = ge & Fe ^ ~ge & Ke, L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, m = o[Ae * 2], _ = o[Ae * 2 + 1], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, m = S[Ae % 16], _ = g[Ae % 16], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, X = O & 65535 | A << 16, ue = L & 65535 | I << 16, m = X, _ = ue, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = (x >>> 28 | G << 4) ^ (G >>> 2 | x << 30) ^ (G >>> 7 | x << 25), _ = (G >>> 28 | x << 4) ^ (x >>> 2 | G << 30) ^ (x >>> 7 | G << 25), L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, m = x & M ^ x & H ^ M & H, _ = G & C ^ G & Ce ^ C & Ce, L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, a = O & 65535 | A << 16, le = L & 65535 | I << 16, m = b, _ = K, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = X, _ = ue, L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, b = O & 65535 | A << 16, K = L & 65535 | I << 16, M = xt, H = j, ce = bt, B = b, Te = h, be = l, Ne = t, x = a, C = R, Ce = P, et = D, ge = K, Fe = z, Ke = U, ke = Le, G = le, Ae % 16 === 15)
          for (var te = 0; te < 16; te++)
            m = S[te], _ = g[te], L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = S[(te + 9) % 16], _ = g[(te + 9) % 16], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, X = S[(te + 1) % 16], ue = g[(te + 1) % 16], m = (X >>> 1 | ue << 31) ^ (X >>> 8 | ue << 24) ^ X >>> 7, _ = (ue >>> 1 | X << 31) ^ (ue >>> 8 | X << 24) ^ (ue >>> 7 | X << 25), L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, X = S[(te + 14) % 16], ue = g[(te + 14) % 16], m = (X >>> 19 | ue << 13) ^ (ue >>> 29 | X << 3) ^ X >>> 6, _ = (ue >>> 19 | X << 13) ^ (X >>> 29 | ue << 3) ^ (ue >>> 6 | X << 26), L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, S[te] = O & 65535 | A << 16, g[te] = L & 65535 | I << 16;
      }
      m = x, _ = G, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = s[0], _ = u[0], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, s[0] = x = O & 65535 | A << 16, u[0] = G = L & 65535 | I << 16, m = M, _ = C, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = s[1], _ = u[1], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, s[1] = M = O & 65535 | A << 16, u[1] = C = L & 65535 | I << 16, m = H, _ = Ce, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = s[2], _ = u[2], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, s[2] = H = O & 65535 | A << 16, u[2] = Ce = L & 65535 | I << 16, m = ce, _ = et, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = s[3], _ = u[3], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, s[3] = ce = O & 65535 | A << 16, u[3] = et = L & 65535 | I << 16, m = B, _ = ge, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = s[4], _ = u[4], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, s[4] = B = O & 65535 | A << 16, u[4] = ge = L & 65535 | I << 16, m = Te, _ = Fe, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = s[5], _ = u[5], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, s[5] = Te = O & 65535 | A << 16, u[5] = Fe = L & 65535 | I << 16, m = be, _ = Ke, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = s[6], _ = u[6], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, s[6] = be = O & 65535 | A << 16, u[6] = Ke = L & 65535 | I << 16, m = Ne, _ = ke, L = _ & 65535, I = _ >>> 16, O = m & 65535, A = m >>> 16, m = s[7], _ = u[7], L += _ & 65535, I += _ >>> 16, O += m & 65535, A += m >>> 16, I += L >>> 16, O += I >>> 16, A += O >>> 16, s[7] = Ne = O & 65535 | A << 16, u[7] = ke = L & 65535 | I << 16, v += 128, w -= 128;
    }
    return v;
  }
  function E(S) {
    var g = new f();
    g.update(S);
    var s = g.digest();
    return g.clean(), s;
  }
  e.hash = E;
})(Zn);
(function(e) {
  Object.defineProperty(e, "__esModule", { value: !0 }), e.convertSecretKeyToX25519 = e.convertPublicKeyToX25519 = e.verify = e.sign = e.extractPublicKeyFromSecretKey = e.generateKeyPair = e.generateKeyPairFromSeed = e.SEED_LENGTH = e.SECRET_KEY_LENGTH = e.PUBLIC_KEY_LENGTH = e.SIGNATURE_LENGTH = void 0;
  const n = $n, r = Zn, f = Un;
  e.SIGNATURE_LENGTH = 64, e.PUBLIC_KEY_LENGTH = 32, e.SECRET_KEY_LENGTH = 64, e.SEED_LENGTH = 32;
  function o(b) {
    const h = new Float64Array(16);
    if (b)
      for (let l = 0; l < b.length; l++)
        h[l] = b[l];
    return h;
  }
  const d = new Uint8Array(32);
  d[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, h) {
    for (let l = 0; l < 16; l++)
      b[l] = h[l] | 0;
  }
  function x(b) {
    let h = 1;
    for (let l = 0; l < 16; l++) {
      let t = b[l] + h + 65535;
      h = Math.floor(t / 65536), b[l] = t - h * 65536;
    }
    b[0] += h - 1 + 37 * (h - 1);
  }
  function M(b, h, l) {
    const t = ~(l - 1);
    for (let a = 0; a < 16; a++) {
      const R = t & (b[a] ^ h[a]);
      b[a] ^= R, h[a] ^= R;
    }
  }
  function H(b, h) {
    const l = o(), t = o();
    for (let a = 0; a < 16; a++)
      t[a] = h[a];
    x(t), x(t), x(t);
    for (let a = 0; a < 2; a++) {
      l[0] = t[0] - 65517;
      for (let P = 1; P < 15; P++)
        l[P] = t[P] - 65535 - (l[P - 1] >> 16 & 1), l[P - 1] &= 65535;
      l[15] = t[15] - 32767 - (l[14] >> 16 & 1);
      const R = l[15] >> 16 & 1;
      l[14] &= 65535, M(t, l, 1 - R);
    }
    for (let a = 0; a < 16; a++)
      b[2 * a] = t[a] & 255, b[2 * a + 1] = t[a] >> 8;
  }
  function ce(b, h) {
    let l = 0;
    for (let t = 0; t < 32; t++)
      l |= b[t] ^ h[t];
    return (1 & l - 1 >>> 8) - 1;
  }
  function B(b, h) {
    const l = new Uint8Array(32), t = new Uint8Array(32);
    return H(l, b), H(t, h), ce(l, t);
  }
  function Te(b) {
    const h = new Uint8Array(32);
    return H(h, b), h[0] & 1;
  }
  function be(b, h) {
    for (let l = 0; l < 16; l++)
      b[l] = h[2 * l] + (h[2 * l + 1] << 8);
    b[15] &= 32767;
  }
  function Ne(b, h, l) {
    for (let t = 0; t < 16; t++)
      b[t] = h[t] + l[t];
  }
  function G(b, h, l) {
    for (let t = 0; t < 16; t++)
      b[t] = h[t] - l[t];
  }
  function C(b, h, l) {
    let t, a, R = 0, P = 0, D = 0, K = 0, z = 0, U = 0, Le = 0, le = 0, Re = 0, ye = 0, de = 0, ne = 0, ee = 0, Y = 0, k = 0, $ = 0, re = 0, pe = 0, F = 0, Me = 0, je = 0, Ue = 0, $e = 0, ze = 0, Ve = 0, qe = 0, st = 0, He = 0, ct = 0, wt = 0, Rt = 0, ie = l[0], q = l[1], se = l[2], oe = l[3], ae = l[4], Z = l[5], _e = l[6], me = l[7], xe = l[8], we = l[9], ve = l[10], he = l[11], fe = l[12], J = l[13], Se = l[14], Ee = l[15];
    t = h[0], R += t * ie, P += t * q, D += t * se, K += t * oe, z += t * ae, U += t * Z, Le += t * _e, le += t * me, Re += t * xe, ye += t * we, de += t * ve, ne += t * he, ee += t * fe, Y += t * J, k += t * Se, $ += t * Ee, t = h[1], P += t * ie, D += t * q, K += t * se, z += t * oe, U += t * ae, Le += t * Z, le += t * _e, Re += t * me, ye += t * xe, de += t * we, ne += t * ve, ee += t * he, Y += t * fe, k += t * J, $ += t * Se, re += t * Ee, t = h[2], D += t * ie, K += t * q, z += t * se, U += t * oe, Le += t * ae, le += t * Z, Re += t * _e, ye += t * me, de += t * xe, ne += t * we, ee += t * ve, Y += t * he, k += t * fe, $ += t * J, re += t * Se, pe += t * Ee, t = h[3], K += t * ie, z += t * q, U += t * se, Le += t * oe, le += t * ae, Re += t * Z, ye += t * _e, de += t * me, ne += t * xe, ee += t * we, Y += t * ve, k += t * he, $ += t * fe, re += t * J, pe += t * Se, F += t * Ee, t = h[4], z += t * ie, U += t * q, Le += t * se, le += t * oe, Re += t * ae, ye += t * Z, de += t * _e, ne += t * me, ee += t * xe, Y += t * we, k += t * ve, $ += t * he, re += t * fe, pe += t * J, F += t * Se, Me += t * Ee, t = h[5], U += t * ie, Le += t * q, le += t * se, Re += t * oe, ye += t * ae, de += t * Z, ne += t * _e, ee += t * me, Y += t * xe, k += t * we, $ += t * ve, re += t * he, pe += t * fe, F += t * J, Me += t * Se, je += t * Ee, t = h[6], Le += t * ie, le += t * q, Re += t * se, ye += t * oe, de += t * ae, ne += t * Z, ee += t * _e, Y += t * me, k += t * xe, $ += t * we, re += t * ve, pe += t * he, F += t * fe, Me += t * J, je += t * Se, Ue += t * Ee, t = h[7], le += t * ie, Re += t * q, ye += t * se, de += t * oe, ne += t * ae, ee += t * Z, Y += t * _e, k += t * me, $ += t * xe, re += t * we, pe += t * ve, F += t * he, Me += t * fe, je += t * J, Ue += t * Se, $e += t * Ee, t = h[8], Re += t * ie, ye += t * q, de += t * se, ne += t * oe, ee += t * ae, Y += t * Z, k += t * _e, $ += t * me, re += t * xe, pe += t * we, F += t * ve, Me += t * he, je += t * fe, Ue += t * J, $e += t * Se, ze += t * Ee, t = h[9], ye += t * ie, de += t * q, ne += t * se, ee += t * oe, Y += t * ae, k += t * Z, $ += t * _e, re += t * me, pe += t * xe, F += t * we, Me += t * ve, je += t * he, Ue += t * fe, $e += t * J, ze += t * Se, Ve += t * Ee, t = h[10], de += t * ie, ne += t * q, ee += t * se, Y += t * oe, k += t * ae, $ += t * Z, re += t * _e, pe += t * me, F += t * xe, Me += t * we, je += t * ve, Ue += t * he, $e += t * fe, ze += t * J, Ve += t * Se, qe += t * Ee, t = h[11], ne += t * ie, ee += t * q, Y += t * se, k += t * oe, $ += t * ae, re += t * Z, pe += t * _e, F += t * me, Me += t * xe, je += t * we, Ue += t * ve, $e += t * he, ze += t * fe, Ve += t * J, qe += t * Se, st += t * Ee, t = h[12], ee += t * ie, Y += t * q, k += t * se, $ += t * oe, re += t * ae, pe += t * Z, F += t * _e, Me += t * me, je += t * xe, Ue += t * we, $e += t * ve, ze += t * he, Ve += t * fe, qe += t * J, st += t * Se, He += t * Ee, t = h[13], Y += t * ie, k += t * q, $ += t * se, re += t * oe, pe += t * ae, F += t * Z, Me += t * _e, je += t * me, Ue += t * xe, $e += t * we, ze += t * ve, Ve += t * he, qe += t * fe, st += t * J, He += t * Se, ct += t * Ee, t = h[14], k += t * ie, $ += t * q, re += t * se, pe += t * oe, F += t * ae, Me += t * Z, je += t * _e, Ue += t * me, $e += t * xe, ze += t * we, Ve += t * ve, qe += t * he, st += t * fe, He += t * J, ct += t * Se, wt += t * Ee, t = h[15], $ += t * ie, re += t * q, pe += t * se, F += t * oe, Me += t * ae, je += t * Z, Ue += t * _e, $e += t * me, ze += t * xe, Ve += t * we, qe += t * ve, st += t * he, He += t * fe, ct += t * J, wt += t * Se, Rt += t * Ee, R += 38 * re, P += 38 * pe, D += 38 * F, K += 38 * Me, z += 38 * je, U += 38 * Ue, Le += 38 * $e, le += 38 * ze, Re += 38 * Ve, ye += 38 * qe, de += 38 * st, ne += 38 * He, ee += 38 * ct, Y += 38 * wt, k += 38 * Rt, a = 1, t = R + a + 65535, a = Math.floor(t / 65536), R = t - a * 65536, t = P + a + 65535, a = Math.floor(t / 65536), P = t - a * 65536, t = D + a + 65535, a = Math.floor(t / 65536), D = t - a * 65536, t = K + a + 65535, a = Math.floor(t / 65536), K = t - a * 65536, t = z + a + 65535, a = Math.floor(t / 65536), z = t - a * 65536, t = U + a + 65535, a = Math.floor(t / 65536), U = t - a * 65536, t = Le + a + 65535, a = Math.floor(t / 65536), Le = t - a * 65536, t = le + a + 65535, a = Math.floor(t / 65536), le = t - a * 65536, t = Re + a + 65535, a = Math.floor(t / 65536), Re = t - a * 65536, t = ye + a + 65535, a = Math.floor(t / 65536), ye = t - a * 65536, t = de + a + 65535, a = Math.floor(t / 65536), de = t - a * 65536, t = ne + a + 65535, a = Math.floor(t / 65536), ne = t - a * 65536, t = ee + a + 65535, a = Math.floor(t / 65536), ee = t - a * 65536, t = Y + a + 65535, a = Math.floor(t / 65536), Y = t - a * 65536, t = k + a + 65535, a = Math.floor(t / 65536), k = t - a * 65536, t = $ + a + 65535, a = Math.floor(t / 65536), $ = t - a * 65536, R += a - 1 + 37 * (a - 1), a = 1, t = R + a + 65535, a = Math.floor(t / 65536), R = t - a * 65536, t = P + a + 65535, a = Math.floor(t / 65536), P = t - a * 65536, t = D + a + 65535, a = Math.floor(t / 65536), D = t - a * 65536, t = K + a + 65535, a = Math.floor(t / 65536), K = t - a * 65536, t = z + a + 65535, a = Math.floor(t / 65536), z = t - a * 65536, t = U + a + 65535, a = Math.floor(t / 65536), U = t - a * 65536, t = Le + a + 65535, a = Math.floor(t / 65536), Le = t - a * 65536, t = le + a + 65535, a = Math.floor(t / 65536), le = t - a * 65536, t = Re + a + 65535, a = Math.floor(t / 65536), Re = t - a * 65536, t = ye + a + 65535, a = Math.floor(t / 65536), ye = t - a * 65536, t = de + a + 65535, a = Math.floor(t / 65536), de = t - a * 65536, t = ne + a + 65535, a = Math.floor(t / 65536), ne = t - a * 65536, t = ee + a + 65535, a = Math.floor(t / 65536), ee = t - a * 65536, t = Y + a + 65535, a = Math.floor(t / 65536), Y = t - a * 65536, t = k + a + 65535, a = Math.floor(t / 65536), k = t - a * 65536, t = $ + a + 65535, a = Math.floor(t / 65536), $ = t - a * 65536, R += a - 1 + 37 * (a - 1), b[0] = R, b[1] = P, b[2] = D, b[3] = K, b[4] = z, b[5] = U, b[6] = Le, b[7] = le, b[8] = Re, b[9] = ye, b[10] = de, b[11] = ne, b[12] = ee, b[13] = Y, b[14] = k, b[15] = $;
  }
  function Ce(b, h) {
    C(b, h, h);
  }
  function et(b, h) {
    const l = o();
    let t;
    for (t = 0; t < 16; t++)
      l[t] = h[t];
    for (t = 253; t >= 0; t--)
      Ce(l, l), t !== 2 && t !== 4 && C(l, l, h);
    for (t = 0; t < 16; t++)
      b[t] = l[t];
  }
  function ge(b, h) {
    const l = o();
    let t;
    for (t = 0; t < 16; t++)
      l[t] = h[t];
    for (t = 250; t >= 0; t--)
      Ce(l, l), t !== 1 && C(l, l, h);
    for (t = 0; t < 16; t++)
      b[t] = l[t];
  }
  function Fe(b, h) {
    const l = o(), t = o(), a = o(), R = o(), P = o(), D = o(), K = o(), z = o(), U = o();
    G(l, b[1], b[0]), G(U, h[1], h[0]), C(l, l, U), Ne(t, b[0], b[1]), Ne(U, h[0], h[1]), C(t, t, U), C(a, b[3], h[3]), C(a, a, s), C(R, b[2], h[2]), Ne(R, R, R), G(P, t, l), G(D, R, a), Ne(K, R, a), Ne(z, t, l), C(b[0], P, D), C(b[1], z, K), C(b[2], K, D), C(b[3], P, z);
  }
  function Ke(b, h, l) {
    for (let t = 0; t < 4; t++)
      M(b[t], h[t], l);
  }
  function ke(b, h) {
    const l = o(), t = o(), a = o();
    et(a, h[2]), C(l, h[0], a), C(t, h[1], a), H(b, t), b[31] ^= Te(l) << 7;
  }
  function m(b, h, l) {
    w(b[0], E), w(b[1], S), w(b[2], S), w(b[3], E);
    for (let t = 255; t >= 0; --t) {
      const a = l[t / 8 | 0] >> (t & 7) & 1;
      Ke(b, h, a), Fe(h, b), Fe(b, b), Ke(b, h, a);
    }
  }
  function _(b, h) {
    const l = [o(), o(), o(), o()];
    w(l[0], u), w(l[1], y), w(l[2], S), C(l[3], u, y), m(b, l, h);
  }
  function X(b) {
    if (b.length !== e.SEED_LENGTH)
      throw new Error(`ed25519: seed must be ${e.SEED_LENGTH} bytes`);
    const h = (0, r.hash)(b);
    h[0] &= 248, h[31] &= 127, h[31] |= 64;
    const l = new Uint8Array(32), t = [o(), o(), o(), o()];
    _(t, h), ke(l, t);
    const a = new Uint8Array(64);
    return a.set(b), a.set(l, 32), {
      publicKey: l,
      secretKey: a
    };
  }
  e.generateKeyPairFromSeed = X;
  function ue(b) {
    const h = (0, n.randomBytes)(32, b), l = X(h);
    return (0, f.wipe)(h), l;
  }
  e.generateKeyPair = ue;
  function L(b) {
    if (b.length !== e.SECRET_KEY_LENGTH)
      throw new Error(`ed25519: secret key must be ${e.SECRET_KEY_LENGTH} bytes`);
    return new Uint8Array(b.subarray(32));
  }
  e.extractPublicKeyFromSecretKey = L;
  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, h) {
    let l, t, a, R;
    for (t = 63; t >= 32; --t) {
      for (l = 0, a = t - 32, R = t - 12; a < R; ++a)
        h[a] += l - 16 * h[t] * I[a - (t - 32)], l = Math.floor((h[a] + 128) / 256), h[a] -= l * 256;
      h[a] += l, h[t] = 0;
    }
    for (l = 0, a = 0; a < 32; a++)
      h[a] += l - (h[31] >> 4) * I[a], l = h[a] >> 8, h[a] &= 255;
    for (a = 0; a < 32; a++)
      h[a] -= l * I[a];
    for (t = 0; t < 32; t++)
      h[t + 1] += h[t] >> 8, b[t] = h[t] & 255;
  }
  function A(b) {
    const h = new Float64Array(64);
    for (let l = 0; l < 64; l++)
      h[l] = b[l];
    for (let l = 0; l < 64; l++)
      b[l] = 0;
    O(b, h);
  }
  function Ae(b, h) {
    const l = new Float64Array(64), t = [o(), o(), o(), o()], a = (0, r.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 r.SHA512();
    P.update(R.subarray(32)), P.update(h);
    const D = P.digest();
    P.clean(), A(D), _(t, D), ke(R, t), P.reset(), P.update(R.subarray(0, 32)), P.update(b.subarray(32)), P.update(h);
    const K = P.digest();
    A(K);
    for (let z = 0; z < 32; z++)
      l[z] = D[z];
    for (let z = 0; z < 32; z++)
      for (let U = 0; U < 32; U++)
        l[z + U] += K[z] * a[U];
    return O(R.subarray(32), l), R;
  }
  e.sign = Ae;
  function te(b, h) {
    const l = o(), t = o(), a = o(), R = o(), P = o(), D = o(), K = o();
    return w(b[2], S), be(b[1], h), Ce(a, b[1]), C(R, a, g), G(a, a, b[2]), Ne(R, b[2], R), Ce(P, R), Ce(D, P), C(K, D, P), C(l, K, a), C(l, l, R), ge(l, l), C(l, l, a), C(l, l, R), C(l, l, R), C(b[0], l, R), Ce(t, b[0]), C(t, t, R), B(t, a) && C(b[0], b[0], v), Ce(t, b[0]), C(t, t, R), B(t, a) ? -1 : (Te(b[0]) === h[31] >> 7 && G(b[0], E, b[0]), C(b[3], b[0], b[1]), 0);
  }
  function xt(b, h, l) {
    const t = new Uint8Array(32), a = [o(), o(), o(), o()], R = [o(), o(), o(), o()];
    if (l.length !== e.SIGNATURE_LENGTH)
      throw new Error(`ed25519: signature must be ${e.SIGNATURE_LENGTH} bytes`);
    if (te(R, b))
      return !1;
    const P = new r.SHA512();
    P.update(l.subarray(0, 32)), P.update(b), P.update(h);
    const D = P.digest();
    return A(D), m(a, R, D), _(R, l.subarray(32)), Fe(a, R), ke(t, a), !ce(l, t);
  }
  e.verify = xt;
  function j(b) {
    let h = [o(), o(), o(), o()];
    if (te(h, b))
      throw new Error("Ed25519: invalid public key");
    let l = o(), t = o(), a = h[1];
    Ne(l, S, a), G(t, S, a), et(t, t), C(l, l, t);
    let R = new Uint8Array(32);
    return H(R, l), R;
  }
  e.convertPublicKeyToX25519 = j;
  function bt(b) {
    const h = (0, r.hash)(b.subarray(0, 32));
    h[0] &= 248, h[31] &= 127, h[31] |= 64;
    const l = new Uint8Array(h.subarray(0, 32));
    return (0, f.wipe)(h), l;
  }
  e.convertSecretKeyToX25519 = bt;
})(fn);
const Ls = "EdDSA", Rs = "JWT", Ft = ".", Xt = "base64url", Qn = "utf8", er = "utf8", Ps = ":", Ns = "did", Cs = "key", Mn = "base58btc", Ms = "z", Bs = "K36", js = 32, zs = (e) => JSON.stringify(e, (n, r) => typeof r == "bigint" ? r.toString() + "n" : r), Ds = (e) => {
  const n = /([\[:])?(\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, r = e.replace(n, '$1"$2n"$3');
  return JSON.parse(r, (f, o) => typeof o == "string" && o.match(/^\d+n$/) ? BigInt(o.substring(0, o.length - 1)) : o);
};
function Ks(e) {
  if (typeof e != "string")
    throw new Error(`Cannot safe json parse value of type ${typeof e}`);
  try {
    return Ds(e);
  } catch {
    return e;
  }
}
function Us(e) {
  return typeof e == "string" ? e : zs(e) || "";
}
function Bn(e) {
  return Ks(kt(mt(e, Xt), Qn));
}
function Wt(e) {
  return kt(mt(Us(e), Qn), Xt);
}
function $s(e) {
  const n = mt(Bs, Mn), r = Ms + kt(ai([n, e]), Mn);
  return [Ns, Cs, r].join(Ps);
}
function Hs(e) {
  return kt(e, Xt);
}
function Gs(e) {
  return mt(e, Xt);
}
function Fs(e) {
  return mt([Wt(e.header), Wt(e.payload)].join(Ft), er);
}
function Ws(e) {
  return [
    Wt(e.header),
    Wt(e.payload),
    Hs(e.signature)
  ].join(Ft);
}
function Go(e) {
  const n = e.split(Ft), r = Bn(n[0]), f = Bn(n[1]), o = Gs(n[2]), d = mt(n.slice(0, 2).join(Ft), er);
  return { header: r, payload: f, signature: o, data: d };
}
function Fo(e = $n.randomBytes(js)) {
  return fn.generateKeyPairFromSeed(e);
}
async function Wo(e, n, r, f, o = oi.fromMiliseconds(Date.now())) {
  const d = { alg: Ls, typ: Rs }, E = $s(f.publicKey), S = o + r, g = { iss: E, sub: e, aud: n, iat: o, exp: S }, s = Fs({ header: d, payload: g }), u = fn.sign(f.secretKey, s);
  return Ws({ header: d, payload: g, signature: u });
}
const Js = "PARSE_ERROR", ks = "INVALID_REQUEST", Vs = "METHOD_NOT_FOUND", Xs = "INVALID_PARAMS", tr = "INTERNAL_ERROR", cn = "SERVER_ERROR", Ys = [-32700, -32600, -32601, -32602, -32603], Et = {
  [Js]: { code: -32700, message: "Parse error" },
  [ks]: { code: -32600, message: "Invalid Request" },
  [Vs]: { code: -32601, message: "Method not found" },
  [Xs]: { code: -32602, message: "Invalid params" },
  [tr]: { code: -32603, message: "Internal error" },
  [cn]: { code: -32e3, message: "Server error" }
}, nr = cn;
function qs(e) {
  return Ys.includes(e);
}
function jn(e) {
  return Object.keys(Et).includes(e) ? Et[e] : Et[nr];
}
function Zs(e) {
  const n = Object.values(Et).find((r) => r.code === e);
  return n || Et[nr];
}
function Jo(e, n, r) {
  return e.message.includes("getaddrinfo ENOTFOUND") || e.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${n}`) : e;
}
var Qs = {};
/*! *****************************************************************************
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 rn = function(e, n) {
  return rn = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, f) {
    r.__proto__ = f;
  } || function(r, f) {
    for (var o in f) f.hasOwnProperty(o) && (r[o] = f[o]);
  }, rn(e, n);
};
function eo(e, n) {
  rn(e, n);
  function r() {
    this.constructor = e;
  }
  e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
}
var sn = function() {
  return sn = Object.assign || function(n) {
    for (var r, f = 1, o = arguments.length; f < o; f++) {
      r = arguments[f];
      for (var d in r) Object.prototype.hasOwnProperty.call(r, d) && (n[d] = r[d]);
    }
    return n;
  }, sn.apply(this, arguments);
};
function to(e, n) {
  var r = {};
  for (var f in e) Object.prototype.hasOwnProperty.call(e, f) && n.indexOf(f) < 0 && (r[f] = e[f]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var o = 0, f = Object.getOwnPropertySymbols(e); o < f.length; o++)
      n.indexOf(f[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, f[o]) && (r[f[o]] = e[f[o]]);
  return r;
}
function no(e, n, r, f) {
  var o = arguments.length, d = o < 3 ? n : f === null ? f = Object.getOwnPropertyDescriptor(n, r) : f, E;
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function") d = Reflect.decorate(e, n, r, f);
  else for (var S = e.length - 1; S >= 0; S--) (E = e[S]) && (d = (o < 3 ? E(d) : o > 3 ? E(n, r, d) : E(n, r)) || d);
  return o > 3 && d && Object.defineProperty(n, r, d), d;
}
function ro(e, n) {
  return function(r, f) {
    n(r, f, e);
  };
}
function io(e, n) {
  if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, n);
}
function so(e, n, r, f) {
  function o(d) {
    return d instanceof r ? d : new r(function(E) {
      E(d);
    });
  }
  return new (r || (r = Promise))(function(d, E) {
    function S(u) {
      try {
        s(f.next(u));
      } catch (y) {
        E(y);
      }
    }
    function g(u) {
      try {
        s(f.throw(u));
      } catch (y) {
        E(y);
      }
    }
    function s(u) {
      u.done ? d(u.value) : o(u.value).then(S, g);
    }
    s((f = f.apply(e, n || [])).next());
  });
}
function oo(e, n) {
  var r = { label: 0, sent: function() {
    if (d[0] & 1) throw d[1];
    return d[1];
  }, trys: [], ops: [] }, f, o, d, 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 (f) throw new TypeError("Generator is already executing.");
    for (; r; ) try {
      if (f = 1, o && (d = s[0] & 2 ? o.return : s[0] ? o.throw || ((d = o.return) && d.call(o), 0) : o.next) && !(d = d.call(o, s[1])).done) return d;
      switch (o = 0, d && (s = [s[0] & 2, d.value]), s[0]) {
        case 0:
        case 1:
          d = s;
          break;
        case 4:
          return r.label++, { value: s[1], done: !1 };
        case 5:
          r.label++, o = s[1], s = [0];
          continue;
        case 7:
          s = r.ops.pop(), r.trys.pop();
          continue;
        default:
          if (d = r.trys, !(d = d.length > 0 && d[d.length - 1]) && (s[0] === 6 || s[0] === 2)) {
            r = 0;
            continue;
          }
          if (s[0] === 3 && (!d || s[1] > d[0] && s[1] < d[3])) {
            r.label = s[1];
            break;
          }
          if (s[0] === 6 && r.label < d[1]) {
            r.label = d[1], d = s;
            break;
          }
          if (d && r.label < d[2]) {
            r.label = d[2], r.ops.push(s);
            break;
          }
          d[2] && r.ops.pop(), r.trys.pop();
          continue;
      }
      s = n.call(e, r);
    } catch (u) {
      s = [6, u], o = 0;
    } finally {
      f = d = 0;
    }
    if (s[0] & 5) throw s[1];
    return { value: s[0] ? s[1] : void 0, done: !0 };
  }
}
function ao(e, n, r, f) {
  f === void 0 && (f = r), e[f] = n[r];
}
function fo(e, n) {
  for (var r in e) r !== "default" && !n.hasOwnProperty(r) && (n[r] = e[r]);
}
function on(e) {
  var n = typeof Symbol == "function" && Symbol.iterator, r = n && e[n], f = 0;
  if (r) return r.call(e);
  if (e && typeof e.length == "number") return {
    next: function() {
      return e && f >= e.length && (e = void 0), { value: e && e[f++], done: !e };
    }
  };
  throw new TypeError(n ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function rr(e, n) {
  var r = typeof Symbol == "function" && e[Symbol.iterator];
  if (!r) return e;
  var f = r.call(e), o, d = [], E;
  try {
    for (; (n === void 0 || n-- > 0) && !(o = f.next()).done; ) d.push(o.value);
  } catch (S) {
    E = { error: S };
  } finally {
    try {
      o && !o.done && (r = f.return) && r.call(f);
    } finally {
      if (E) throw E.error;
    }
  }
  return d;
}
function co() {
  for (var e = [], n = 0; n < arguments.length; n++)
    e = e.concat(rr(arguments[n]));
  return e;
}
function uo() {
  for (var e = 0, n = 0, r = arguments.length; n < r; n++) e += arguments[n].length;
  for (var f = Array(e), o = 0, n = 0; n < r; n++)
    for (var d = arguments[n], E = 0, S = d.length; E < S; E++, o++)
      f[o] = d[E];
  return f;
}
function Tt(e) {
  return this instanceof Tt ? (this.v = e, this) : new Tt(e);
}
function lo(e, n, r) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var f = r.apply(e, n || []), o, d = [];
  return o = {}, E("next"), E("throw"), E("return"), o[Symbol.asyncIterator] = function() {
    return this;
  }, o;
  function E(v) {
    f[v] && (o[v] = function(w) {
      return new Promise(function(x, M) {
        d.push([v, w, x, M]) > 1 || S(v, w);
      });
    });
  }
  function S(v, w) {
    try {
      g(f[v](w));
    } catch (x) {
      y(d[0][3], x);
    }
  }
  function g(v) {
    v.value instanceof Tt ? Promise.resolve(v.value.v).then(s, u) : y(d[0][2], v);
  }
  function s(v) {
    S("next", v);
  }
  function u(v) {
    S("throw", v);
  }
  function y(v, w) {
    v(w), d.shift(), d.length && S(d[0][0], d[0][1]);
  }
}
function ho(e) {
  var n, r;
  return n = {}, f("next"), f("throw", function(o) {
    throw o;
  }), f("return"), n[Symbol.iterator] = function() {
    return this;
  }, n;
  function f(o, d) {
    n[o] = e[o] ? function(E) {
      return (r = !r) ? { value: Tt(e[o](E)), done: o === "return" } : d ? d(E) : E;
    } : d;
  }
}
function bo(e) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var n = e[Symbol.asyncIterator], r;
  return n ? n.call(e) : (e = typeof on == "function" ? on(e) : e[Symbol.iterator](), r = {}, f("next"), f("throw"), f("return"), r[Symbol.asyncIterator] = function() {
    return this;
  }, r);
  function f(d) {
    r[d] = e[d] && function(E) {
      return new Promise(function(S, g) {
        E = e[d](E), o(S, g, E.done, E.value);
      });
    };
  }
  function o(d, E, S, g) {
    Promise.resolve(g).then(function(s) {
      d({ value: s, done: S });
    }, E);
  }
}
function go(e, n) {
  return Object.defineProperty ? Object.defineProperty(e, "raw", { value: n }) : e.raw = n, e;
}
function yo(e) {
  if (e && e.__esModule) return e;
  var n = {};
  if (e != null) for (var r in e) Object.hasOwnProperty.call(e, r) && (n[r] = e[r]);
  return n.default = e, n;
}
function po(e) {
  return e && e.__esModule ? e : { default: e };
}
function _o(e, n) {
  if (!n.has(e))
    throw new TypeError("attempted to get private field on non-instance");
  return n.get(e);
}
function mo(e, n, r) {
  if (!n.has(e))
    throw new TypeError("attempted to set private field on non-instance");
  return n.set(e, r), r;
}
const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  get __assign() {
    return sn;
  },
  __asyncDelegator: ho,
  __asyncGenerator: lo,
  __asyncValues: bo,
  __await: Tt,
  __awaiter: so,
  __classPrivateFieldGet: _o,
  __classPrivateFieldSet: mo,
  __createBinding: ao,
  __decorate: no,
  __exportStar: fo,
  __extends: eo,
  __generator: oo,
  __importDefault: po,
  __importStar: yo,
  __makeTemplateObject: go,
  __metadata: io,
  __param: ro,
  __read: rr,
  __rest: to,
  __spread: co,
  __spreadArrays: uo,
  __values: on
}, Symbol.toStringTag, { value: "Module" })), wo = /* @__PURE__ */ Vr(xo);
var rt = {}, zn;
function vo() {
  if (zn) return rt;
  zn = 1, Object.defineProperty(rt, "__esModule", { value: !0 }), rt.isBrowserCryptoAvailable = rt.getSubtleCrypto = rt.getBrowerCrypto = void 0;
  function e() {
    return (Ze === null || Ze === void 0 ? void 0 : Ze.crypto) || (Ze === null || Ze === void 0 ? void 0 : Ze.msCrypto) || {};
  }
  rt.getBrowerCrypto = e;
  function n() {
    const f = e();
    return f.subtle || f.webkitSubtle;
  }
  rt.getSubtleCrypto = n;
  function r() {
    return !!e() && !!n();
  }
  return rt.isBrowserCryptoAvailable = r, rt;
}
var it = {}, Dn;
function So() {
  if (Dn) return it;
  Dn = 1, Object.defineProperty(it, "__esModule", { value: !0 }), it.isBrowser = it.isNode = it.isReactNative = void 0;
  function e() {
    return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative";
  }
  it.isReactNative = e;
  function n() {
    return typeof Ye.process < "u" && typeof Ye.process.versions < "u" && typeof Ye.process.versions.node < "u";
  }
  it.isNode = n;
  function r() {
    return !e() && !n();
  }
  return it.isBrowser = r, it;
}
(function(e) {
  Object.defineProperty(e, "__esModule", { value: !0 });
  const n = wo;
  n.__exportStar(vo(), e), n.__exportStar(So(), e);
})(Qs);
function ir(e = 3) {
  const n = Date.now() * Math.pow(10, e), r = Math.floor(Math.random() * Math.pow(10, e));
  return n + r;
}
function ko(e = 6) {
  return BigInt(ir(e));
}
function Vo(e, n, r) {
  return {
    id: r || ir(),
    jsonrpc: "2.0",
    method: e,
    params: n
  };
}
function Xo(e, n) {
  return {
    id: e,
    jsonrpc: "2.0",
    result: n
  };
}
function Yo(e, n, r) {
  return {
    id: e,
    jsonrpc: "2.0",
    error: Eo(n)
  };
}
function Eo(e, n) {
  return typeof e > "u" ? jn(tr) : (typeof e == "string" && (e = Object.assign(Object.assign({}, jn(cn)), { message: e })), qs(e.code) && (e = Zs(e.code)), e);
}
class Io {
}
class Oo extends Io {
  constructor() {
    super();
  }
}
class qo extends Oo {
  constructor(n) {
    super();
  }
}
const To = "^https?:", Ao = "^wss?:";
function Lo(e) {
  const n = e.match(new RegExp(/^\w+:/, "gi"));
  if (!(!n || !n.length))
    return n[0];
}
function sr(e, n) {
  const r = Lo(e);
  return typeof r > "u" ? !1 : new RegExp(n).test(r);
}
function Zo(e) {
  return sr(e, To);
}
function Qo(e) {
  return sr(e, Ao);
}
function ea(e) {
  return new RegExp("wss?://localhost(:d{2,5})?").test(e);
}
function or(e) {
  return typeof e == "object" && "id" in e && "jsonrpc" in e && e.jsonrpc === "2.0";
}
function ta(e) {
  return or(e) && "method" in e;
}
function na(e) {
  return or(e) && (Ro(e) || Po(e));
}
function Ro(e) {
  return "result" in e;
}
function Po(e) {
  return "error" in e;
}
var Jt = { exports: {} };
Jt.exports;
(function(e, n) {
  var r = 200, f = "__lodash_hash_undefined__", o = 1, d = 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]", M = "[object Map]", H = "[object Number]", ce = "[object Null]", B = "[object Object]", Te = "[object Promise]", be = "[object Proxy]", Ne = "[object RegExp]", G = "[object Set]", C = "[object String]", Ce = "[object Symbol]", et = "[object Undefined]", ge = "[object WeakMap]", Fe = "[object ArrayBuffer]", Ke = "[object DataView]", ke = "[object Float32Array]", m = "[object Float64Array]", _ = "[object Int8Array]", X = "[object Int16Array]", ue = "[object Int32Array]", L = "[object Uint8Array]", I = "[object Uint8ClampedArray]", O = "[object Uint16Array]", A = "[object Uint32Array]", Ae = /[\\^$.*+?()[\]{}|]/g, te = /^\[object .+?Constructor\]$/, xt = /^(?:0|[1-9]\d*)$/, j = {};
  j[ke] = j[m] = j[_] = j[X] = j[ue] = j[L] = j[I] = j[O] = j[A] = !0, j[S] = j[g] = j[Fe] = j[u] = j[Ke] = j[y] = j[v] = j[w] = j[M] = j[H] = j[B] = j[Ne] = j[G] = j[C] = j[ge] = !1;
  var bt = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, b = typeof self == "object" && self && self.Object === Object && self, h = bt || b || Function("return this")(), l = n && !n.nodeType && n, t = l && !0 && e && !e.nodeType && e, a = t && t.exports === l, R = a && bt.process, P = function() {
    try {
      return R && R.binding && R.binding("util");
    } catch {
    }
  }(), D = P && P.isTypedArray;
  function K(i, c) {
    for (var p = -1, T = i == null ? 0 : i.length, W = 0, N = []; ++p < T; ) {
      var Q = i[p];
      c(Q, p, i) && (N[W++] = Q);
    }
    return N;
  }
  function z(i, c) {
    for (var p = -1, T = c.length, W = i.length; ++p < T; )
      i[W + p] = c[p];
    return i;
  }
  function U(i, c) {
    for (var p = -1, T = i == null ? 0 : i.length; ++p < T; )
      if (c(i[p], p, i))
        return !0;
    return !1;
  }
  function Le(i, c) {
    for (var p = -1, T = Array(i); ++p < i; )
      T[p] = c(p);
    return T;
  }
  function le(i) {
    return function(c) {
      return i(c);
    };
  }
  function Re(i, c) {
    return i.has(c);
  }
  function ye(i, c) {
    return i == null ? void 0 : i[c];
  }
  function de(i) {
    var c = -1, p = Array(i.size);
    return i.forEach(function(T, W) {
      p[++c] = [W, T];
    }), p;
  }
  function ne(i, c) {
    return function(p) {
      return i(c(p));
    };
  }
  function ee(i) {
    var c = -1, p = Array(i.size);
    return i.forEach(function(T) {
      p[++c] = T;
    }), p;
  }
  var Y = Array.prototype, k = Function.prototype, $ = Object.prototype, re = h["__core-js_shared__"], pe = k.toString, F = $.hasOwnProperty, Me = function() {
    var i = /[^.]+$/.exec(re && re.keys && re.keys.IE_PROTO || "");
    return i ? "Symbol(src)_1." + i : "";
  }(), je = $.toString, Ue = RegExp(
    "^" + pe.call(F).replace(Ae, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  ), $e = a ? h.Buffer : void 0, ze = h.Symbol, Ve = h.Uint8Array, qe = $.propertyIsEnumerable, st = Y.splice, He = ze ? ze.toStringTag : void 0, ct = Object.getOwnPropertySymbols, wt = $e ? $e.isBuffer : void 0, Rt = ne(Object.keys, Object), ie = gt(h, "DataView"), q = gt(h, "Map"), se = gt(h, "Promise"), oe = gt(h, "Set"), ae = gt(h, "WeakMap"), Z = gt(Object, "create"), _e = lt(ie), me = lt(q), xe = lt(se), we = lt(oe), ve = lt(ae), he = ze ? ze.prototype : void 0, fe = he ? he.valueOf : void 0;
  function J(i) {
    var c = -1, p = i == null ? 0 : i.length;
    for (this.clear(); ++c < p; ) {
      var T = i[c];
      this.set(T[0], T[1]);
    }
  }
  function Se() {
    this.__data__ = Z ? Z(null) : {}, this.size = 0;
  }
  function Ee(i) {
    var c = this.has(i) && delete this.__data__[i];
    return this.size -= c ? 1 : 0, c;
  }
  function ar(i) {
    var c = this.__data__;
    if (Z) {
      var p = c[i];
      return p === f ? void 0 : p;
    }
    return F.call(c, i) ? c[i] : void 0;
  }
  function fr(i) {
    var c = this.__data__;
    return Z ? c[i] !== void 0 : F.call(c, i);
  }
  function cr(i, c) {
    var p = this.__data__;
    return this.size += this.has(i) ? 0 : 1, p[i] = Z && c === void 0 ? f : c, this;
  }
  J.prototype.clear = Se, J.prototype.delete = Ee, J.prototype.get = ar, J.prototype.has = fr, J.prototype.set = cr;
  function tt(i) {
    var c = -1, p = i == null ? 0 : i.length;
    for (this.clear(); ++c < p; ) {
      var T = i[c];
      this.set(T[0], T[1]);
    }
  }
  function ur() {
    this.__data__ = [], this.size = 0;
  }
  function lr(i) {
    var c = this.__data__, p = Nt(c, i);
    if (p < 0)
      return !1;
    var T = c.length - 1;
    return p == T ? c.pop() : st.call(c, p, 1), --this.size, !0;
  }
  function dr(i) {
    var c = this.__data__, p = Nt(c, i);
    return p < 0 ? void 0 : c[p][1];
  }
  function hr(i) {
    return Nt(this.__data__, i) > -1;
  }
  function br(i, c) {
    var p = this.__data__, T = Nt(p, i);
    return T < 0 ? (++this.size, p.push([i, c])) : p[T][1] = c, this;
  }
  tt.prototype.clear = ur, tt.prototype.delete = lr, tt.prototype.get = dr, tt.prototype.has = hr, tt.prototype.set = br;
  function ut(i) {
    var c = -1, p = i == null ? 0 : i.length;
    for (this.clear(); ++c < p; ) {
      var T = i[c];
      this.set(T[0], T[1]);
    }
  }
  function gr() {
    this.size = 0, this.__data__ = {
      hash: new J(),
      map: new (q || tt)(),
      string: new J()
    };
  }
  function yr(i) {
    var c = Ct(this, i).delete(i);
    return this.size -= c ? 1 : 0, c;
  }
  function pr(i) {
    return Ct(this, i).get(i);
  }
  function _r(i) {
    return Ct(this, i).has(i);
  }
  function mr(i, c) {
    var p = Ct(this, i), T = p.size;
    return p.set(i, c), this.size += p.size == T ? 0 : 1, this;
  }
  ut.prototype.clear = gr, ut.prototype.delete = yr, ut.prototype.get = pr, ut.prototype.has = _r, ut.prototype.set = mr;
  function Pt(i) {
    var c = -1, p = i == null ? 0 : i.length;
    for (this.__data__ = new ut(); ++c < p; )
      this.add(i[c]);
  }
  function xr(i) {
    return this.__data__.set(i, f), this;
  }
  function wr(i) {
    return this.__data__.has(i);
  }
  Pt.prototype.add = Pt.prototype.push = xr, Pt.prototype.has = wr;
  function ot(i) {
    var c = this.__data__ = new tt(i);
    this.size = c.size;
  }
  function vr() {
    this.__data__ = new tt(), this.size = 0;
  }
  function Sr(i) {
    var c = this.__data__, p = c.delete(i);
    return this.size = c.size, p;
  }
  function Er(i) {
    return this.__data__.get(i);
  }
  function Ir(i) {
    return this.__data__.has(i);
  }
  function Or(i, c) {
    var p = this.__data__;
    if (p instanceof tt) {
      var T = p.__data__;
      if (!q || T.length < r - 1)
        return T.push([i, c]), this.size = ++p.size, this;
      p = this.__data__ = new ut(T);
    }
    return p.set(i, c), this.size = p.size, this;
  }
  ot.prototype.clear = vr, ot.prototype.delete = Sr, ot.prototype.get = Er, ot.prototype.has = Ir, ot.prototype.set = Or;
  function Tr(i, c) {
    var p = Mt(i), T = !p && Hr(i), W = !p && !T && Yt(i), N = !p && !T && !W && _n(i), Q = p || T || W || N, Ie = Q ? Le(i.length, String) : [], Pe = Ie.length;
    for (var V in i)
      F.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.
      W && (V == "offset" || V == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
      N && (V == "buffer" || V == "byteLength" || V == "byteOffset") || // Skip index properties.
      zr(V, Pe))) && Ie.push(V);
    return Ie;
  }
  function Nt(i, c) {
    for (var p = i.length; p--; )
      if (bn(i[p][0], c))
        return p;
    return -1;
  }
  function Ar(i, c, p) {
    var T = c(i);
    return Mt(i) ? T : z(T, p(i));
  }
  function vt(i) {
    return i == null ? i === void 0 ? et : ce : He && He in Object(i) ? Br(i) : $r(i);
  }
  function un(i) {
    return St(i) && vt(i) == S;
  }
  function ln(i, c, p, T, W) {
    return i === c ? !0 : i == null || c == null || !St(i) && !St(c) ? i !== i && c !== c : Lr(i, c, p, T, ln, W);
  }
  function Lr(i, c, p, T, W, N) {
    var Q = Mt(i), Ie = Mt(c), Pe = Q ? g : at(i), V = Ie ? g : at(c);
    Pe = Pe == S ? B : Pe, V = V == S ? B : V;
    var Ge = Pe == B, Xe = V == B, Be = Pe == V;
    if (Be && Yt(i)) {
      if (!Yt(c))
        return !1;
      Q = !0, Ge = !1;
    }
    if (Be && !Ge)
      return N || (N = new ot()), Q || _n(i) ? dn(i, c, p, T, W, N) : Cr(i, c, Pe, p, T, W, N);
    if (!(p & o)) {
      var We = Ge && F.call(i, "__wrapped__"), Je = Xe && F.call(c, "__wrapped__");
      if (We || Je) {
        var ft = We ? i.value() : i, nt = Je ? c.value() : c;
        return N || (N = new ot()), W(ft, nt, p, T, N);
      }
    }
    return Be ? (N || (N = new ot()), Mr(i, c, p, T, W, N)) : !1;
  }
  function Rr(i) {
    if (!pn(i) || Kr(i))
      return !1;
    var c = gn(i) ? Ue : te;
    return c.test(lt(i));
  }
  function Pr(i) {
    return St(i) && yn(i.length) && !!j[vt(i)];
  }
  function Nr(i) {
    if (!Ur(i))
      return Rt(i);
    var c = [];
    for (var p in Object(i))
      F.call(i, p) && p != "constructor" && c.push(p);
    return c;
  }
  function dn(i, c, p, T, W, N) {
    var Q = p & o, Ie = i.length, Pe = c.length;
    if (Ie != Pe && !(Q && Pe > Ie))
      return !1;
    var V = N.get(i);
    if (V && N.get(c))
      return V == c;
    var Ge = -1, Xe = !0, Be = p & d ? new Pt() : void 0;
    for (N.set(i, c), N.set(c, i); ++Ge < Ie; ) {
      var We = i[Ge], Je = c[Ge];
      if (T)
        var ft = Q ? T(Je, We, Ge, c, i, N) : T(We, Je, Ge, i, c, N);
      if (ft !== void 0) {
        if (ft)
          continue;
        Xe = !1;
        break;
      }
      if (Be) {
        if (!U(c, function(nt, dt) {
          if (!Re(Be, dt) && (We === nt || W(We, nt, p, T, N)))
            return Be.push(dt);
        })) {
          Xe = !1;
          break;
        }
      } else if (!(We === Je || W(We, Je, p, T, N))) {
        Xe = !1;
        break;
      }
    }
    return N.delete(i), N.delete(c), Xe;
  }
  function Cr(i, c, p, T, W, N, Q) {
    switch (p) {
      case Ke:
        if (i.byteLength != c.byteLength || i.byteOffset != c.byteOffset)
          return !1;
        i = i.buffer, c = c.buffer;
      case Fe:
        return !(i.byteLength != c.byteLength || !N(new Ve(i), new Ve(c)));
      case u:
      case y:
      case H:
        return bn(+i, +c);
      case v:
        return i.name == c.name && i.message == c.message;
      case Ne:
      case C:
        return i == c + "";
      case M:
        var Ie = de;
      case G:
        var Pe = T & o;
        if (Ie || (Ie = ee), i.size != c.size && !Pe)
          return !1;
        var V = Q.get(i);
        if (V)
          return V == c;
        T |= d, Q.set(i, c);
        var Ge = dn(Ie(i), Ie(c), T, W, N, Q);
        return Q.delete(i), Ge;
      case Ce:
        if (fe)
          return fe.call(i) == fe.call(c);
    }
    return !1;
  }
  function Mr(i, c, p, T, W, N) {
    var Q = p & o, Ie = hn(i), Pe = Ie.length, V = hn(c), Ge = V.length;
    if (Pe != Ge && !Q)
      return !1;
    for (var Xe = Pe; Xe--; ) {
      var Be = Ie[Xe];
      if (!(Q ? Be in c : F.call(c, Be)))
        return !1;
    }
    var We = N.get(i);
    if (We && N.get(c))
      return We == c;
    var Je = !0;
    N.set(i, c), N.set(c, i);
    for (var ft = Q; ++Xe < Pe; ) {
      Be = Ie[Xe];
      var nt = i[Be], dt = c[Be];
      if (T)
        var mn = Q ? T(dt, nt, Be, c, i, N) : T(nt, dt, Be, i, c, N);
      if (!(mn === void 0 ? nt === dt || W(nt, dt, p, T, N) : mn)) {
        Je = !1;
        break;
      }
      ft || (ft = Be == "constructor");
    }
    if (Je && !ft) {
      var Bt = i.constructor, jt = c.constructor;
      Bt != jt && "constructor" in i && "constructor" in c && !(typeof Bt == "function" && Bt instanceof Bt && typeof jt == "function" && jt instanceof jt) && (Je = !1);
    }
    return N.delete(i), N.delete(c), Je;
  }
  function hn(i) {
    return Ar(i, Wr, jr);
  }
  function Ct(i, c) {
    var p = i.__data__;
    return Dr(c) ? p[typeof c == "string" ? "string" : "hash"] : p.map;
  }
  function gt(i, c) {
    var p = ye(i, c);
    return Rr(p) ? p : void 0;
  }
  function Br(i) {
    var c = F.call(i, He), p = i[He];
    try {
      i[He] = void 0;
      var T = !0;
    } catch {
    }
    var W = je.call(i);
    return T && (c ? i[He] = p : delete i[He]), W;
  }
  var jr = ct ? function(i) {
    return i == null ? [] : (i = Object(i), K(ct(i), function(c) {
      return qe.call(i, c);
    }));
  } : Jr, at = vt;
  (ie && at(new ie(new ArrayBuffer(1))) != Ke || q && at(new q()) != M || se && at(se.resolve()) != Te || oe && at(new oe()) != G || ae && at(new ae()) != ge) && (at = function(i) {
    var c = vt(i), p = c == B ? i.constructor : void 0, T = p ? lt(p) : "";
    if (T)
      switch (T) {
        case _e:
          return Ke;
        case me:
          return M;
        case xe:
          return Te;
        case we:
          return G;
        case ve:
          return ge;
      }
    return c;
  });
  function zr(i, c) {
    return c = c ?? E, !!c && (typeof i == "number" || xt.test(i)) && i > -1 && i % 1 == 0 && i < c;
  }
  function Dr(i) {
    var c = typeof i;
    return c == "string" || c == "number" || c == "symbol" || c == "boolean" ? i !== "__proto__" : i === null;
  }
  function Kr(i) {
    return !!Me && Me in i;
  }
  function Ur(i) {
    var c = i && i.constructor, p = typeof c == "function" && c.prototype || $;
    return i === p;
  }
  function $r(i) {
    return je.call(i);
  }
  function lt(i) {
    if (i != null) {
      try {
        return pe.call(i);
      } catch {
      }
      try {
        return i + "";
      } catch {
      }
    }
    return "";
  }
  function bn(i, c) {
    return i === c || i !== i && c !== c;
  }
  var Hr = un(/* @__PURE__ */ function() {
    return arguments;
  }()) ? un : function(i) {
    return St(i) && F.call(i, "callee") && !qe.call(i, "callee");
  }, Mt = Array.isArray;
  function Gr(i) {
    return i != null && yn(i.length) && !gn(i);
  }
  var Yt = wt || kr;
  function Fr(i, c) {
    return ln(i, c);
  }
  function gn(i) {
    if (!pn(i))
      return !1;
    var c = vt(i);
    return c == w || c == x || c == s || c == be;
  }
  function yn(i) {
    return typeof i == "number" && i > -1 && i % 1 == 0 && i <= E;
  }
  function pn(i) {
    var c = typeof i;
    return i != null && (c == "object" || c == "function");
  }
  function St(i) {
    return i != null && typeof i == "object";
  }
  var _n = D ? le(D) : Pr;
  function Wr(i) {
    return Gr(i) ? Tr(i) : Nr(i);
  }
  function Jr() {
    return [];
  }
  function kr() {
    return !1;
  }
  e.exports = Fr;
})(Jt, Jt.exports);
var No = Jt.exports;
const ra = /* @__PURE__ */ Kn(No);
export {
  Ho as A,
  jo as C,
  $o as E,
  Ko as I,
  Yn as T,
  ra as _,
  Vo as a,
  na as b,
  ai as c,
  Bo as d,
  Qo as e,
  mt as f,
  ko as g,
  Qs as h,
  Po as i,
  ea as j,
  Yo as k,
  Uo as l,
  Do as m,
  Fo as n,
  $s as o,
  Jo as p,
  ta as q,
  qo as r,
  Wo as s,
  kt as t,
  Xo as u,
  Ro as v,
  ir as w,
  Zo as x,
  Is as y,
  Go as z
};
