UNPKG

zksync-easy-onramp

Version:

SDK package for ZKsync easy on ramp

11,940 lines 419 kB
var gb = Object.defineProperty;
var mb = (e, n, r) => n in e ? gb(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
var re = (e, n, r) => mb(e, typeof n != "symbol" ? n + "" : n, r);
import { formatUnits as Hf, parseAbi as nr, webSocket as Ab, http as wb, createClient as yb, fallback as bb, pad as Cl, toHex as Nl, keccak256 as Ks, toBytes as Qf, encodeAbiParameters as zf, parseAbiParameters as Wf, encodeFunctionData as Ua, parseSignature as xb, isAddress as Eb } from "viem";
var $f;
(function(e) {
  e.ETH = "eth", e.POL = "pol", e.BSC = "bsc", e.DAI = "dai", e.FTM = "ftm", e.AVA = "ava", e.ARB = "arb", e.OPT = "opt", e.ONE = "one", e.FSN = "fsn", e.MOR = "mor", e.CEL = "cel", e.FUS = "fus", e.TLO = "tlo", e.CRO = "cro", e.BOB = "bob", e.RSK = "rsk", e.VEL = "vel", e.MOO = "moo", e.MAM = "mam", e.AUR = "aur", e.EVM = "evm", e.ARN = "arn", e.ERA = "era", e.PZE = "pze", e.LNA = "lna", e.BAS = "bas", e.SCL = "scl", e.MOD = "mod", e.MNT = "mnt", e.BLS = "bls", e.SEI = "sei", e.FRA = "fra", e.TAI = "tai", e.GRA = "gra", e.IMX = "imx", e.KAI = "kai", e.XLY = "xly", e.OPB = "opb", e.WCC = "wcc", e.LSK = "lsk", e.ABS = "abs", e.BER = "ber", e.SON = "son", e.UNI = "uni", e.APE = "ape", e.SOE = "soe", e.INK = "ink", e.LNS = "lns", e.SWL = "swl", e.CRN = "crn", e.ETL = "etl", e.SUP = "sup", e.SOL = "sol", e.TER = "ter", e.OAS = "oas", e.SUI = "sui", e.BTC = "btc", e.BCH = "bch", e.LTC = "ltc", e.DGE = "dge";
})($f || ($f = {}));
var Mr;
(function(e) {
  e[e.ETH = 1] = "ETH", e[e.POL = 137] = "POL", e[e.BSC = 56] = "BSC", e[e.DAI = 100] = "DAI", e[e.FTM = 250] = "FTM", e[e.AVA = 43114] = "AVA", e[e.ARB = 42161] = "ARB", e[e.OPT = 10] = "OPT", e[e.ONE = 16666e5] = "ONE", e[e.FSN = 32659] = "FSN", e[e.MOR = 1285] = "MOR", e[e.CEL = 42220] = "CEL", e[e.FUS = 122] = "FUS", e[e.TLO = 40] = "TLO", e[e.CRO = 25] = "CRO", e[e.BOB = 288] = "BOB", e[e.RSK = 30] = "RSK", e[e.VEL = 106] = "VEL", e[e.MOO = 1284] = "MOO", e[e.MAM = 1088] = "MAM", e[e.AUR = 1313161554] = "AUR", e[e.EVM = 9001] = "EVM", e[e.ARN = 42170] = "ARN", e[e.ERA = 324] = "ERA", e[e.PZE = 1101] = "PZE", e[e.LNA = 59144] = "LNA", e[e.BAS = 8453] = "BAS", e[e.SCL = 534352] = "SCL", e[e.MOD = 34443] = "MOD", e[e.MNT = 5e3] = "MNT", e[e.BLS = 81457] = "BLS", e[e.SEI = 1329] = "SEI", e[e.FRA = 252] = "FRA", e[e.TAI = 167e3] = "TAI", e[e.GRA = 1625] = "GRA", e[e.IMX = 13371] = "IMX", e[e.KAI = 8217] = "KAI", e[e.XLY = 196] = "XLY", e[e.OPB = 204] = "OPB", e[e.WCC = 480] = "WCC", e[e.LSK = 1135] = "LSK", e[e.ABS = 2741] = "ABS", e[e.BER = 80094] = "BER", e[e.SON = 146] = "SON", e[e.UNI = 130] = "UNI", e[e.APE = 33139] = "APE", e[e.SOE = 1868] = "SOE", e[e.INK = 57073] = "INK", e[e.LNS = 232] = "LNS", e[e.SWL = 1923] = "SWL", e[e.CRN = 21e6] = "CRN", e[e.ETL = 42793] = "ETL", e[e.SUP = 55244] = "SUP", e[e.SOL = 1151111081099710] = "SOL", e[e.TER = 1161011141099710] = "TER", e[e.OAS = 111971151099710] = "OAS", e[e.SUI = 927e13] = "SUI", e[e.BTC = 20000000000001] = "BTC", e[e.BCH = 20000000000002] = "BCH", e[e.LTC = 20000000000003] = "LTC", e[e.DGE = 20000000000004] = "DGE";
})(Mr || (Mr = {}));
var Qt;
(function(e) {
  e.EVM = "EVM", e.SVM = "SVM", e.MVM = "MVM", e.UTXO = "UTXO";
})(Qt || (Qt = {}));
const ye = /* @__PURE__ */ (() => {
  const e = {
    integrator: "lifi-sdk",
    apiUrl: "https://li.quest/v1",
    rpcUrls: {},
    chains: [],
    providers: [],
    preloadChains: !0,
    debug: !1
  };
  let n;
  return {
    set loading(r) {
      n = r;
    },
    get() {
      return e;
    },
    set(r) {
      const { chains: i, providers: o, rpcUrls: u, ...c } = r;
      return Object.assign(e, c), i && this.setChains(i), o && this.setProviders(o), u && this.setRPCUrls(u), e;
    },
    getProvider(r) {
      return e.providers.find((i) => i.type === r);
    },
    setProviders(r) {
      const i = new Map(e.providers.map((o) => [o.type, o]));
      for (const o of r)
        i.set(o.type, o);
      e.providers = Array.from(i.values());
    },
    setChains(r) {
      const i = r.reduce((o, u) => {
        var c, l;
        return (l = (c = u.metamask) == null ? void 0 : c.rpcUrls) != null && l.length && (o[u.id] = u.metamask.rpcUrls), o;
      }, {});
      this.setRPCUrls(i, [Mr.SOL]), e.chains = r, n = void 0;
    },
    async getChains() {
      return n && await n, e.chains;
    },
    async getChainById(r) {
      var o;
      n && await n;
      const i = (o = e.chains) == null ? void 0 : o.find((u) => u.id === r);
      if (!i)
        throw new Error(`ChainId ${r} not found`);
      return i;
    },
    setRPCUrls(r, i) {
      var o;
      for (const u in r) {
        const c = Number(u), l = r[c];
        if (l != null && l.length) {
          if (!((o = e.rpcUrls[c]) != null && o.length))
            e.rpcUrls[c] = Array.from(l);
          else if (!(i != null && i.includes(c))) {
            const h = l.filter((m) => {
              var A;
              return !((A = e.rpcUrls[c]) != null && A.includes(m));
            });
            e.rpcUrls[c].push(...h);
          }
        }
      }
    },
    async getRPCUrls() {
      return n && await n, e.rpcUrls;
    }
  };
})(), Ol = "2.29.3";
let Rr = {
  getDocsUrl: ({ docsBaseUrl: e, docsPath: n = "", docsSlug: r }) => n ? `${e ?? "https://viem.sh"}${n}${r ? `#${r}` : ""}` : void 0,
  version: `viem@${Ol}`
}, O = class aa extends Error {
  constructor(n, r = {}) {
    var l;
    const i = (() => {
      var h;
      return r.cause instanceof aa ? r.cause.details : (h = r.cause) != null && h.message ? r.cause.message : r.details;
    })(), o = r.cause instanceof aa && r.cause.docsPath || r.docsPath, u = (l = Rr.getDocsUrl) == null ? void 0 : l.call(Rr, { ...r, docsPath: o }), c = [
      n || "An error occurred.",
      "",
      ...r.metaMessages ? [...r.metaMessages, ""] : [],
      ...u ? [`Docs: ${u}`] : [],
      ...i ? [`Details: ${i}`] : [],
      ...Rr.version ? [`Version: ${Rr.version}`] : []
    ].join(`
`);
    super(c, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docsPath", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "metaMessages", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "shortMessage", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "version", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "BaseError"
    }), this.details = i, this.docsPath = o, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = n, this.version = Ol;
  }
  walk(n) {
    return Ml(this, n);
  }
};
function Ml(e, n) {
  return n != null && n(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? Ml(e.cause, n) : n ? null : e;
}
let Ul = class extends O {
  constructor({ max: n, min: r, signed: i, size: o, value: u }) {
    super(`Number "${u}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${n ? `(${r} to ${n})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" });
  }
};
class vb extends O {
  constructor(n) {
    super(`Bytes value "${n}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
      name: "InvalidBytesBooleanError"
    });
  }
}
class Pb extends O {
  constructor({ givenSize: n, maxSize: r }) {
    super(`Size cannot exceed ${r} bytes. Given size: ${n} bytes.`, { name: "SizeOverflowError" });
  }
}
class Fl extends O {
  constructor({ offset: n, position: r, size: i }) {
    super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${n}" is out-of-bounds (size: ${i}).`, { name: "SliceOffsetOutOfBoundsError" });
  }
}
let kl = class extends O {
  constructor({ size: n, targetSize: r, type: i }) {
    super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${n}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" });
  }
};
class Vf extends O {
  constructor({ size: n, targetSize: r, type: i }) {
    super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} is expected to be ${r} ${i} long, but is ${n} ${i} long.`, { name: "InvalidBytesLengthError" });
  }
}
function rr(e, { dir: n, size: r = 32 } = {}) {
  return typeof e == "string" ? un(e, { dir: n, size: r }) : Tb(e, { dir: n, size: r });
}
function un(e, { dir: n, size: r = 32 } = {}) {
  if (r === null)
    return e;
  const i = e.replace("0x", "");
  if (i.length > r * 2)
    throw new kl({
      size: Math.ceil(i.length / 2),
      targetSize: r,
      type: "hex"
    });
  return `0x${i[n === "right" ? "padEnd" : "padStart"](r * 2, "0")}`;
}
function Tb(e, { dir: n, size: r = 32 } = {}) {
  if (r === null)
    return e;
  if (e.length > r)
    throw new kl({
      size: e.length,
      targetSize: r,
      type: "bytes"
    });
  const i = new Uint8Array(r);
  for (let o = 0; o < r; o++) {
    const u = n === "right";
    i[u ? o : r - o - 1] = e[u ? o : e.length - o - 1];
  }
  return i;
}
function Wt(e, { strict: n = !0 } = {}) {
  return !e || typeof e != "string" ? !1 : n ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
}
function Be(e) {
  return Wt(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
}
function ci(e, { dir: n = "left" } = {}) {
  let r = typeof e == "string" ? e.replace("0x", "") : e, i = 0;
  for (let o = 0; o < r.length - 1 && r[n === "left" ? o : r.length - o - 1].toString() === "0"; o++)
    i++;
  return r = n === "left" ? r.slice(i) : r.slice(0, r.length - i), typeof e == "string" ? (r.length === 1 && n === "right" && (r = `${r}0`), `0x${r.length % 2 === 1 ? `0${r}` : r}`) : r;
}
const Ib = /* @__PURE__ */ new TextEncoder();
function fi(e, n = {}) {
  return typeof e == "number" || typeof e == "bigint" ? Sb(e, n) : typeof e == "boolean" ? Bb(e, n) : Wt(e) ? $t(e, n) : Pn(e, n);
}
function Bb(e, n = {}) {
  const r = new Uint8Array(1);
  return r[0] = Number(e), typeof n.size == "number" ? (St(r, { size: n.size }), rr(r, { size: n.size })) : r;
}
const Gt = {
  zero: 48,
  nine: 57,
  A: 65,
  F: 70,
  a: 97,
  f: 102
};
function qf(e) {
  if (e >= Gt.zero && e <= Gt.nine)
    return e - Gt.zero;
  if (e >= Gt.A && e <= Gt.F)
    return e - (Gt.A - 10);
  if (e >= Gt.a && e <= Gt.f)
    return e - (Gt.a - 10);
}
function $t(e, n = {}) {
  let r = e;
  n.size && (St(r, { size: n.size }), r = rr(r, { dir: "right", size: n.size }));
  let i = r.slice(2);
  i.length % 2 && (i = `0${i}`);
  const o = i.length / 2, u = new Uint8Array(o);
  for (let c = 0, l = 0; c < o; c++) {
    const h = qf(i.charCodeAt(l++)), m = qf(i.charCodeAt(l++));
    if (h === void 0 || m === void 0)
      throw new O(`Invalid byte sequence ("${i[l - 2]}${i[l - 1]}" in "${i}").`);
    u[c] = h * 16 + m;
  }
  return u;
}
function Sb(e, n) {
  const r = X(e, n);
  return $t(r);
}
function Pn(e, n = {}) {
  const r = Ib.encode(e);
  return typeof n.size == "number" ? (St(r, { size: n.size }), rr(r, { dir: "right", size: n.size })) : r;
}
function St(e, { size: n }) {
  if (Be(e) > n)
    throw new Pb({
      givenSize: Be(e),
      maxSize: n
    });
}
function cn(e, n = {}) {
  const { signed: r } = n;
  n.size && St(e, { size: n.size });
  const i = BigInt(e);
  if (!r)
    return i;
  const o = (e.length - 2) / 2, u = (1n << BigInt(o) * 8n - 1n) - 1n;
  return i <= u ? i : i - BigInt(`0x${"f".padStart(o * 2, "f")}`) - 1n;
}
function fn(e, n = {}) {
  return Number(cn(e, n));
}
const Rb = /* @__PURE__ */ Array.from({ length: 256 }, (e, n) => n.toString(16).padStart(2, "0"));
function js(e, n = {}) {
  return typeof e == "number" || typeof e == "bigint" ? X(e, n) : typeof e == "string" ? Gl(e, n) : typeof e == "boolean" ? Ll(e, n) : Me(e, n);
}
function Ll(e, n = {}) {
  const r = `0x${Number(e)}`;
  return typeof n.size == "number" ? (St(r, { size: n.size }), rr(r, { size: n.size })) : r;
}
function Me(e, n = {}) {
  let r = "";
  for (let o = 0; o < e.length; o++)
    r += Rb[e[o]];
  const i = `0x${r}`;
  return typeof n.size == "number" ? (St(i, { size: n.size }), rr(i, { dir: "right", size: n.size })) : i;
}
function X(e, n = {}) {
  const { signed: r, size: i } = n, o = BigInt(e);
  let u;
  i ? r ? u = (1n << BigInt(i) * 8n - 1n) - 1n : u = 2n ** (BigInt(i) * 8n) - 1n : typeof e == "number" && (u = BigInt(Number.MAX_SAFE_INTEGER));
  const c = typeof u == "bigint" && r ? -u - 1n : 0;
  if (u && o > u || o < c) {
    const h = typeof e == "bigint" ? "n" : "";
    throw new Ul({
      max: u ? `${u}${h}` : void 0,
      min: `${c}${h}`,
      signed: r,
      size: i,
      value: `${e}${h}`
    });
  }
  const l = `0x${(r && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
  return i ? rr(l, { size: i }) : l;
}
const Db = /* @__PURE__ */ new TextEncoder();
function Gl(e, n = {}) {
  const r = Db.encode(e);
  return Me(r, n);
}
function ln(e, { includeName: n = !1 } = {}) {
  if (e.type !== "function" && e.type !== "event" && e.type !== "error")
    throw new zb(e.type);
  return `${e.name}(${Fa(e.inputs, { includeName: n })})`;
}
function Fa(e, { includeName: n = !1 } = {}) {
  return e ? e.map((r) => _b(r, { includeName: n })).join(n ? ", " : ",") : "";
}
function _b(e, { includeName: n }) {
  return e.type.startsWith("tuple") ? `(${Fa(e.components, { includeName: n })})${e.type.slice(5)}` : e.type + (n && e.name ? ` ${e.name}` : "");
}
class Cb extends O {
  constructor({ docsPath: n }) {
    super([
      "A constructor was not found on the ABI.",
      "Make sure you are using the correct ABI and that the constructor exists on it."
    ].join(`
`), {
      docsPath: n,
      name: "AbiConstructorNotFoundError"
    });
  }
}
class Jf extends O {
  constructor({ docsPath: n }) {
    super([
      "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
      "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
    ].join(`
`), {
      docsPath: n,
      name: "AbiConstructorParamsNotFoundError"
    });
  }
}
class Nb extends O {
  constructor({ data: n, params: r, size: i }) {
    super([`Data size of ${i} bytes is too small for given parameters.`].join(`
`), {
      metaMessages: [
        `Params: (${Fa(r, { includeName: !0 })})`,
        `Data:   ${n} (${i} bytes)`
      ],
      name: "AbiDecodingDataSizeTooSmallError"
    }), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "params", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "size", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.data = n, this.params = r, this.size = i;
  }
}
class li extends O {
  constructor() {
    super('Cannot decode zero data ("0x") with ABI parameters.', {
      name: "AbiDecodingZeroDataError"
    });
  }
}
class Ob extends O {
  constructor({ expectedLength: n, givenLength: r, type: i }) {
    super([
      `ABI encoding array length mismatch for type ${i}.`,
      `Expected length: ${n}`,
      `Given length: ${r}`
    ].join(`
`), { name: "AbiEncodingArrayLengthMismatchError" });
  }
}
class Mb extends O {
  constructor({ expectedSize: n, value: r }) {
    super(`Size of bytes "${r}" (bytes${Be(r)}) does not match expected size (bytes${n}).`, { name: "AbiEncodingBytesSizeMismatchError" });
  }
}
class Ub extends O {
  constructor({ expectedLength: n, givenLength: r }) {
    super([
      "ABI encoding params/values length mismatch.",
      `Expected length (params): ${n}`,
      `Given length (values): ${r}`
    ].join(`
`), { name: "AbiEncodingLengthMismatchError" });
  }
}
class Fb extends O {
  constructor(n, { docsPath: r }) {
    super([
      `Arguments (\`args\`) were provided to "${n}", but "${n}" on the ABI does not contain any parameters (\`inputs\`).`,
      "Cannot encode error result without knowing what the parameter types are.",
      "Make sure you are using the correct ABI and that the inputs exist on it."
    ].join(`
`), {
      docsPath: r,
      name: "AbiErrorInputsNotFoundError"
    });
  }
}
class Kf extends O {
  constructor(n, { docsPath: r } = {}) {
    super([
      `Error ${n ? `"${n}" ` : ""}not found on ABI.`,
      "Make sure you are using the correct ABI and that the error exists on it."
    ].join(`
`), {
      docsPath: r,
      name: "AbiErrorNotFoundError"
    });
  }
}
class Hl extends O {
  constructor(n, { docsPath: r }) {
    super([
      `Encoded error signature "${n}" not found on ABI.`,
      "Make sure you are using the correct ABI and that the error exists on it.",
      `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${n}.`
    ].join(`
`), {
      docsPath: r,
      name: "AbiErrorSignatureNotFoundError"
    }), Object.defineProperty(this, "signature", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.signature = n;
  }
}
class jn extends O {
  constructor(n, { docsPath: r } = {}) {
    super([
      `Function ${n ? `"${n}" ` : ""}not found on ABI.`,
      "Make sure you are using the correct ABI and that the function exists on it."
    ].join(`
`), {
      docsPath: r,
      name: "AbiFunctionNotFoundError"
    });
  }
}
class Ql extends O {
  constructor(n, { docsPath: r }) {
    super([
      `Function "${n}" does not contain any \`outputs\` on ABI.`,
      "Cannot decode function result without knowing what the parameter types are.",
      "Make sure you are using the correct ABI and that the function exists on it."
    ].join(`
`), {
      docsPath: r,
      name: "AbiFunctionOutputsNotFoundError"
    });
  }
}
class kb extends O {
  constructor(n, { docsPath: r }) {
    super([
      `Encoded function signature "${n}" not found on ABI.`,
      "Make sure you are using the correct ABI and that the function exists on it.",
      `You can look up the signature here: https://openchain.xyz/signatures?query=${n}.`
    ].join(`
`), {
      docsPath: r,
      name: "AbiFunctionSignatureNotFoundError"
    });
  }
}
class Lb extends O {
  constructor(n, r) {
    super("Found ambiguous types in overloaded ABI items.", {
      metaMessages: [
        `\`${n.type}\` in \`${ln(n.abiItem)}\`, and`,
        `\`${r.type}\` in \`${ln(r.abiItem)}\``,
        "",
        "These types encode differently and cannot be distinguished at runtime.",
        "Remove one of the ambiguous items in the ABI."
      ],
      name: "AbiItemAmbiguityError"
    });
  }
}
class Gb extends O {
  constructor({ expectedSize: n, givenSize: r }) {
    super(`Expected bytes${n}, got bytes${r}.`, {
      name: "BytesSizeMismatchError"
    });
  }
}
class Hb extends O {
  constructor(n, { docsPath: r }) {
    super([
      `Type "${n}" is not a valid encoding type.`,
      "Please provide a valid ABI type."
    ].join(`
`), { docsPath: r, name: "InvalidAbiEncodingType" });
  }
}
class Qb extends O {
  constructor(n, { docsPath: r }) {
    super([
      `Type "${n}" is not a valid decoding type.`,
      "Please provide a valid ABI type."
    ].join(`
`), { docsPath: r, name: "InvalidAbiDecodingType" });
  }
}
class zl extends O {
  constructor(n) {
    super([`Value "${n}" is not a valid array.`].join(`
`), {
      name: "InvalidArrayError"
    });
  }
}
class zb extends O {
  constructor(n) {
    super([
      `"${n}" is not a valid definition type.`,
      'Valid types: "function", "event", "error"'
    ].join(`
`), { name: "InvalidDefinitionTypeError" });
  }
}
function In(e) {
  return typeof e[0] == "string" ? $r(e) : Wb(e);
}
function Wb(e) {
  let n = 0;
  for (const o of e)
    n += o.length;
  const r = new Uint8Array(n);
  let i = 0;
  for (const o of e)
    r.set(o, i), i += o.length;
  return r;
}
function $r(e) {
  return `0x${e.reduce((n, r) => n + r.replace("0x", ""), "")}`;
}
class Ur extends O {
  constructor({ address: n }) {
    super(`Address "${n}" is invalid.`, {
      metaMessages: [
        "- Address must be a hex value of 20 bytes (40 hex characters).",
        "- Address must match its checksum counterpart."
      ],
      name: "InvalidAddressError"
    });
  }
}
let ka = class extends Map {
  constructor(n) {
    super(), Object.defineProperty(this, "maxSize", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.maxSize = n;
  }
  get(n) {
    const r = super.get(n);
    return super.has(n) && r !== void 0 && (this.delete(n), super.set(n, r)), r;
  }
  set(n, r) {
    if (super.set(n, r), this.maxSize && this.size > this.maxSize) {
      const i = this.keys().next().value;
      i && this.delete(i);
    }
    return this;
  }
};
function Zs(e) {
  if (!Number.isSafeInteger(e) || e < 0)
    throw new Error("positive integer expected, got " + e);
}
function $b(e) {
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
}
function di(e, ...n) {
  if (!$b(e))
    throw new Error("Uint8Array expected");
  if (n.length > 0 && !n.includes(e.length))
    throw new Error("Uint8Array expected of length " + n + ", got length=" + e.length);
}
function h2(e) {
  if (typeof e != "function" || typeof e.create != "function")
    throw new Error("Hash should be wrapped by utils.wrapConstructor");
  Zs(e.outputLen), Zs(e.blockLen);
}
function Xs(e, n = !0) {
  if (e.destroyed)
    throw new Error("Hash instance has been destroyed");
  if (n && e.finished)
    throw new Error("Hash#digest() has already been called");
}
function Wl(e, n) {
  di(e);
  const r = n.outputLen;
  if (e.length < r)
    throw new Error("digestInto() expects output buffer of length at least " + r);
}
const Ws = /* @__PURE__ */ BigInt(2 ** 32 - 1), Yf = /* @__PURE__ */ BigInt(32);
function Vb(e, n = !1) {
  return n ? { h: Number(e & Ws), l: Number(e >> Yf & Ws) } : { h: Number(e >> Yf & Ws) | 0, l: Number(e & Ws) | 0 };
}
function qb(e, n = !1) {
  let r = new Uint32Array(e.length), i = new Uint32Array(e.length);
  for (let o = 0; o < e.length; o++) {
    const { h: u, l: c } = Vb(e[o], n);
    [r[o], i[o]] = [u, c];
  }
  return [r, i];
}
const Jb = (e, n, r) => e << r | n >>> 32 - r, Kb = (e, n, r) => n << r | e >>> 32 - r, Yb = (e, n, r) => n << r - 32 | e >>> 64 - r, jb = (e, n, r) => e << r - 32 | n >>> 64 - r, $n = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function Zb(e) {
  return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
}
function $o(e) {
  return new DataView(e.buffer, e.byteOffset, e.byteLength);
}
function Pt(e, n) {
  return e << 32 - n | e >>> n;
}
const jf = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
function Xb(e) {
  return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
}
function Zf(e) {
  for (let n = 0; n < e.length; n++)
    e[n] = Xb(e[n]);
}
typeof Uint8Array.from([]).toHex == "function" && Uint8Array.fromHex;
function e1(e) {
  if (typeof e != "string")
    throw new Error("utf8ToBytes expected string, got " + typeof e);
  return new Uint8Array(new TextEncoder().encode(e));
}
function La(e) {
  return typeof e == "string" && (e = e1(e)), di(e), e;
}
function p2(...e) {
  let n = 0;
  for (let i = 0; i < e.length; i++) {
    const o = e[i];
    di(o), n += o.length;
  }
  const r = new Uint8Array(n);
  for (let i = 0, o = 0; i < e.length; i++) {
    const u = e[i];
    r.set(u, o), o += u.length;
  }
  return r;
}
class $l {
  // Safe version that clones internal state
  clone() {
    return this._cloneInto();
  }
}
function Vl(e) {
  const n = (i) => e().update(La(i)).digest(), r = e();
  return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.create = () => e(), n;
}
function g2(e = 32) {
  if ($n && typeof $n.getRandomValues == "function")
    return $n.getRandomValues(new Uint8Array(e));
  if ($n && typeof $n.randomBytes == "function")
    return Uint8Array.from($n.randomBytes(e));
  throw new Error("crypto.getRandomValues must be defined");
}
const ql = [], Jl = [], Kl = [], t1 = /* @__PURE__ */ BigInt(0), Dr = /* @__PURE__ */ BigInt(1), n1 = /* @__PURE__ */ BigInt(2), r1 = /* @__PURE__ */ BigInt(7), s1 = /* @__PURE__ */ BigInt(256), i1 = /* @__PURE__ */ BigInt(113);
for (let e = 0, n = Dr, r = 1, i = 0; e < 24; e++) {
  [r, i] = [i, (2 * r + 3 * i) % 5], ql.push(2 * (5 * i + r)), Jl.push((e + 1) * (e + 2) / 2 % 64);
  let o = t1;
  for (let u = 0; u < 7; u++)
    n = (n << Dr ^ (n >> r1) * i1) % s1, n & n1 && (o ^= Dr << (Dr << /* @__PURE__ */ BigInt(u)) - Dr);
  Kl.push(o);
}
const [o1, a1] = /* @__PURE__ */ qb(Kl, !0), Xf = (e, n, r) => r > 32 ? Yb(e, n, r) : Jb(e, n, r), el = (e, n, r) => r > 32 ? jb(e, n, r) : Kb(e, n, r);
function u1(e, n = 24) {
  const r = new Uint32Array(10);
  for (let i = 24 - n; i < 24; i++) {
    for (let c = 0; c < 10; c++)
      r[c] = e[c] ^ e[c + 10] ^ e[c + 20] ^ e[c + 30] ^ e[c + 40];
    for (let c = 0; c < 10; c += 2) {
      const l = (c + 8) % 10, h = (c + 2) % 10, m = r[h], A = r[h + 1], y = Xf(m, A, 1) ^ r[l], x = el(m, A, 1) ^ r[l + 1];
      for (let T = 0; T < 50; T += 10)
        e[c + T] ^= y, e[c + T + 1] ^= x;
    }
    let o = e[2], u = e[3];
    for (let c = 0; c < 24; c++) {
      const l = Jl[c], h = Xf(o, u, l), m = el(o, u, l), A = ql[c];
      o = e[A], u = e[A + 1], e[A] = h, e[A + 1] = m;
    }
    for (let c = 0; c < 50; c += 10) {
      for (let l = 0; l < 10; l++)
        r[l] = e[c + l];
      for (let l = 0; l < 10; l++)
        e[c + l] ^= ~r[(l + 2) % 10] & r[(l + 4) % 10];
    }
    e[0] ^= o1[i], e[1] ^= a1[i];
  }
  r.fill(0);
}
class Ga extends $l {
  // NOTE: we accept arguments in bytes instead of bits here.
  constructor(n, r, i, o = !1, u = 24) {
    if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = n, this.suffix = r, this.outputLen = i, this.enableXOF = o, this.rounds = u, Zs(i), 0 >= this.blockLen || this.blockLen >= 200)
      throw new Error("Sha3 supports only keccak-f1600 function");
    this.state = new Uint8Array(200), this.state32 = Zb(this.state);
  }
  keccak() {
    jf || Zf(this.state32), u1(this.state32, this.rounds), jf || Zf(this.state32), this.posOut = 0, this.pos = 0;
  }
  update(n) {
    Xs(this);
    const { blockLen: r, state: i } = this;
    n = La(n);
    const o = n.length;
    for (let u = 0; u < o; ) {
      const c = Math.min(r - this.pos, o - u);
      for (let l = 0; l < c; l++)
        i[this.pos++] ^= n[u++];
      this.pos === r && this.keccak();
    }
    return this;
  }
  finish() {
    if (this.finished)
      return;
    this.finished = !0;
    const { state: n, suffix: r, pos: i, blockLen: o } = this;
    n[i] ^= r, (r & 128) !== 0 && i === o - 1 && this.keccak(), n[o - 1] ^= 128, this.keccak();
  }
  writeInto(n) {
    Xs(this, !1), di(n), this.finish();
    const r = this.state, { blockLen: i } = this;
    for (let o = 0, u = n.length; o < u; ) {
      this.posOut >= i && this.keccak();
      const c = Math.min(i - this.posOut, u - o);
      n.set(r.subarray(this.posOut, this.posOut + c), o), this.posOut += c, o += c;
    }
    return n;
  }
  xofInto(n) {
    if (!this.enableXOF)
      throw new Error("XOF is not possible for this instance");
    return this.writeInto(n);
  }
  xof(n) {
    return Zs(n), this.xofInto(new Uint8Array(n));
  }
  digestInto(n) {
    if (Wl(n, this), this.finished)
      throw new Error("digest() was already called");
    return this.writeInto(n), this.destroy(), n;
  }
  digest() {
    return this.digestInto(new Uint8Array(this.outputLen));
  }
  destroy() {
    this.destroyed = !0, this.state.fill(0);
  }
  _cloneInto(n) {
    const { blockLen: r, suffix: i, outputLen: o, rounds: u, enableXOF: c } = this;
    return n || (n = new Ga(r, i, o, c, u)), n.state32.set(this.state32), n.pos = this.pos, n.posOut = this.posOut, n.finished = this.finished, n.rounds = u, n.suffix = i, n.outputLen = o, n.enableXOF = c, n.destroyed = this.destroyed, n;
  }
}
const c1 = (e, n, r) => Vl(() => new Ga(n, e, r)), f1 = /* @__PURE__ */ c1(1, 136, 256 / 8);
function Bn(e, n) {
  const r = n || "hex", i = f1(Wt(e, { strict: !1 }) ? fi(e) : e);
  return r === "bytes" ? i : js(i);
}
const Vo = /* @__PURE__ */ new ka(8192);
function hi(e, n) {
  if (Vo.has(`${e}.${n}`))
    return Vo.get(`${e}.${n}`);
  const r = e.substring(2).toLowerCase(), i = Bn(Pn(r), "bytes"), o = r.split("");
  for (let c = 0; c < 40; c += 2)
    i[c >> 1] >> 4 >= 8 && o[c] && (o[c] = o[c].toUpperCase()), (i[c >> 1] & 15) >= 8 && o[c + 1] && (o[c + 1] = o[c + 1].toUpperCase());
  const u = `0x${o.join("")}`;
  return Vo.set(`${e}.${n}`, u), u;
}
const l1 = /^0x[a-fA-F0-9]{40}$/, qo = /* @__PURE__ */ new ka(8192);
function dn(e, n) {
  const { strict: r = !0 } = n ?? {}, i = `${e}.${r}`;
  if (qo.has(i))
    return qo.get(i);
  const o = l1.test(e) ? e.toLowerCase() === e ? !0 : r ? hi(e) === e : !0 : !1;
  return qo.set(i, o), o;
}
function Zn(e, n, r, { strict: i } = {}) {
  return Wt(e, { strict: !1 }) ? d1(e, n, r, {
    strict: i
  }) : Zl(e, n, r, {
    strict: i
  });
}
function Yl(e, n) {
  if (typeof n == "number" && n > 0 && n > Be(e) - 1)
    throw new Fl({
      offset: n,
      position: "start",
      size: Be(e)
    });
}
function jl(e, n, r) {
  if (typeof n == "number" && typeof r == "number" && Be(e) !== r - n)
    throw new Fl({
      offset: r,
      position: "end",
      size: Be(e)
    });
}
function Zl(e, n, r, { strict: i } = {}) {
  Yl(e, n);
  const o = e.slice(n, r);
  return i && jl(o, n, r), o;
}
function d1(e, n, r, { strict: i } = {}) {
  Yl(e, n);
  const o = `0x${e.replace("0x", "").slice((n ?? 0) * 2, (r ?? e.length) * 2)}`;
  return i && jl(o, n, r), o;
}
const h1 = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, Xl = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
function pi(e, n) {
  if (e.length !== n.length)
    throw new Ub({
      expectedLength: e.length,
      givenLength: n.length
    });
  const r = p1({
    params: e,
    values: n
  }), i = Qa(r);
  return i.length === 0 ? "0x" : i;
}
function p1({ params: e, values: n }) {
  const r = [];
  for (let i = 0; i < e.length; i++)
    r.push(Ha({ param: e[i], value: n[i] }));
  return r;
}
function Ha({ param: e, value: n }) {
  const r = za(e.type);
  if (r) {
    const [i, o] = r;
    return m1(n, { length: i, param: { ...e, type: o } });
  }
  if (e.type === "tuple")
    return x1(n, {
      param: e
    });
  if (e.type === "address")
    return g1(n);
  if (e.type === "bool")
    return w1(n);
  if (e.type.startsWith("uint") || e.type.startsWith("int")) {
    const i = e.type.startsWith("int"), [, , o = "256"] = Xl.exec(e.type) ?? [];
    return y1(n, {
      signed: i,
      size: Number(o)
    });
  }
  if (e.type.startsWith("bytes"))
    return A1(n, { param: e });
  if (e.type === "string")
    return b1(n);
  throw new Hb(e.type, {
    docsPath: "/docs/contract/encodeAbiParameters"
  });
}
function Qa(e) {
  let n = 0;
  for (let u = 0; u < e.length; u++) {
    const { dynamic: c, encoded: l } = e[u];
    c ? n += 32 : n += Be(l);
  }
  const r = [], i = [];
  let o = 0;
  for (let u = 0; u < e.length; u++) {
    const { dynamic: c, encoded: l } = e[u];
    c ? (r.push(X(n + o, { size: 32 })), i.push(l), o += Be(l)) : r.push(l);
  }
  return In([...r, ...i]);
}
function g1(e) {
  if (!dn(e))
    throw new Ur({ address: e });
  return { dynamic: !1, encoded: un(e.toLowerCase()) };
}
function m1(e, { length: n, param: r }) {
  const i = n === null;
  if (!Array.isArray(e))
    throw new zl(e);
  if (!i && e.length !== n)
    throw new Ob({
      expectedLength: n,
      givenLength: e.length,
      type: `${r.type}[${n}]`
    });
  let o = !1;
  const u = [];
  for (let c = 0; c < e.length; c++) {
    const l = Ha({ param: r, value: e[c] });
    l.dynamic && (o = !0), u.push(l);
  }
  if (i || o) {
    const c = Qa(u);
    if (i) {
      const l = X(u.length, { size: 32 });
      return {
        dynamic: !0,
        encoded: u.length > 0 ? In([l, c]) : l
      };
    }
    if (o)
      return { dynamic: !0, encoded: c };
  }
  return {
    dynamic: !1,
    encoded: In(u.map(({ encoded: c }) => c))
  };
}
function A1(e, { param: n }) {
  const [, r] = n.type.split("bytes"), i = Be(e);
  if (!r) {
    let o = e;
    return i % 32 !== 0 && (o = un(o, {
      dir: "right",
      size: Math.ceil((e.length - 2) / 2 / 32) * 32
    })), {
      dynamic: !0,
      encoded: In([un(X(i, { size: 32 })), o])
    };
  }
  if (i !== Number.parseInt(r))
    throw new Mb({
      expectedSize: Number.parseInt(r),
      value: e
    });
  return { dynamic: !1, encoded: un(e, { dir: "right" }) };
}
function w1(e) {
  if (typeof e != "boolean")
    throw new O(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
  return { dynamic: !1, encoded: un(Ll(e)) };
}
function y1(e, { signed: n, size: r = 256 }) {
  if (typeof r == "number") {
    const i = 2n ** (BigInt(r) - (n ? 1n : 0n)) - 1n, o = n ? -i - 1n : 0n;
    if (e > i || e < o)
      throw new Ul({
        max: i.toString(),
        min: o.toString(),
        signed: n,
        size: r / 8,
        value: e.toString()
      });
  }
  return {
    dynamic: !1,
    encoded: X(e, {
      size: 32,
      signed: n
    })
  };
}
function b1(e) {
  const n = Gl(e), r = Math.ceil(Be(n) / 32), i = [];
  for (let o = 0; o < r; o++)
    i.push(un(Zn(n, o * 32, (o + 1) * 32), {
      dir: "right"
    }));
  return {
    dynamic: !0,
    encoded: In([
      un(X(Be(n), { size: 32 })),
      ...i
    ])
  };
}
function x1(e, { param: n }) {
  let r = !1;
  const i = [];
  for (let o = 0; o < n.components.length; o++) {
    const u = n.components[o], c = Array.isArray(e) ? o : u.name, l = Ha({
      param: u,
      value: e[c]
    });
    i.push(l), l.dynamic && (r = !0);
  }
  return {
    dynamic: r,
    encoded: r ? Qa(i) : In(i.map(({ encoded: o }) => o))
  };
}
function za(e) {
  const n = e.match(/^(.*)\[(\d+)?\]$/);
  return n ? (
    // Return `null` if the array is dynamic.
    [n[2] ? Number(n[2]) : null, n[1]]
  ) : void 0;
}
const Jo = "/docs/contract/encodeDeployData";
function ed(e) {
  const { abi: n, args: r, bytecode: i } = e;
  if (!r || r.length === 0)
    return i;
  const o = n.find((c) => "type" in c && c.type === "constructor");
  if (!o)
    throw new Cb({ docsPath: Jo });
  if (!("inputs" in o))
    throw new Jf({ docsPath: Jo });
  if (!o.inputs || o.inputs.length === 0)
    throw new Jf({ docsPath: Jo });
  const u = pi(o.inputs, r);
  return $r([i, u]);
}
function Jt(e) {
  return typeof e == "string" ? { address: e, type: "json-rpc" } : e;
}
class Wa extends O {
  constructor({ docsPath: n } = {}) {
    super([
      "Could not find an Account to execute with this Action.",
      "Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
    ].join(`
`), {
      docsPath: n,
      docsSlug: "account",
      name: "AccountNotFoundError"
    });
  }
}
class Ko extends O {
  constructor({ docsPath: n, metaMessages: r, type: i }) {
    super(`Account type "${i}" is not supported.`, {
      docsPath: n,
      metaMessages: r,
      name: "AccountTypeNotSupportedError"
    });
  }
}
function E1(e) {
  const n = Bn(`0x${e.substring(4)}`).substring(26);
  return hi(`0x${n}`);
}
async function v1({ hash: e, signature: n }) {
  const r = Wt(e) ? e : js(e), { secp256k1: i } = await import("./secp256k1-_ek5_UNz.js");
  return `0x${(() => {
    if (typeof n == "object" && "r" in n && "s" in n) {
      const { r: m, s: A, v: y, yParity: x } = n, T = Number(x ?? y), I = tl(T);
      return new i.Signature(cn(m), cn(A)).addRecoveryBit(I);
    }
    const c = Wt(n) ? n : js(n);
    if (Be(c) !== 65)
      throw new Error("invalid signature length");
    const l = fn(`0x${c.slice(130)}`), h = tl(l);
    return i.Signature.fromCompact(c.substring(2, 130)).addRecoveryBit(h);
  })().recoverPublicKey(r.substring(2)).toHex(!1)}`;
}
function tl(e) {
  if (e === 0 || e === 1)
    return e;
  if (e === 27)
    return 0;
  if (e === 28)
    return 1;
  throw new Error("Invalid yParityOrV value");
}
async function P1({ hash: e, signature: n }) {
  return E1(await v1({ hash: e, signature: n }));
}
class nl extends O {
  constructor({ offset: n }) {
    super(`Offset \`${n}\` cannot be negative.`, {
      name: "NegativeOffsetError"
    });
  }
}
class T1 extends O {
  constructor({ length: n, position: r }) {
    super(`Position \`${r}\` is out of bounds (\`0 < position < ${n}\`).`, { name: "PositionOutOfBoundsError" });
  }
}
class I1 extends O {
  constructor({ count: n, limit: r }) {
    super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${n}\`).`, { name: "RecursiveReadLimitExceededError" });
  }
}
const B1 = {
  bytes: new Uint8Array(),
  dataView: new DataView(new ArrayBuffer(0)),
  position: 0,
  positionReadCount: /* @__PURE__ */ new Map(),
  recursiveReadCount: 0,
  recursiveReadLimit: Number.POSITIVE_INFINITY,
  assertReadLimit() {
    if (this.recursiveReadCount >= this.recursiveReadLimit)
      throw new I1({
        count: this.recursiveReadCount + 1,
        limit: this.recursiveReadLimit
      });
  },
  assertPosition(e) {
    if (e < 0 || e > this.bytes.length - 1)
      throw new T1({
        length: this.bytes.length,
        position: e
      });
  },
  decrementPosition(e) {
    if (e < 0)
      throw new nl({ offset: e });
    const n = this.position - e;
    this.assertPosition(n), this.position = n;
  },
  getReadCount(e) {
    return this.positionReadCount.get(e || this.position) || 0;
  },
  incrementPosition(e) {
    if (e < 0)
      throw new nl({ offset: e });
    const n = this.position + e;
    this.assertPosition(n), this.position = n;
  },
  inspectByte(e) {
    const n = e ?? this.position;
    return this.assertPosition(n), this.bytes[n];
  },
  inspectBytes(e, n) {
    const r = n ?? this.position;
    return this.assertPosition(r + e - 1), this.bytes.subarray(r, r + e);
  },
  inspectUint8(e) {
    const n = e ?? this.position;
    return this.assertPosition(n), this.bytes[n];
  },
  inspectUint16(e) {
    const n = e ?? this.position;
    return this.assertPosition(n + 1), this.dataView.getUint16(n);
  },
  inspectUint24(e) {
    const n = e ?? this.position;
    return this.assertPosition(n + 2), (this.dataView.getUint16(n) << 8) + this.dataView.getUint8(n + 2);
  },
  inspectUint32(e) {
    const n = e ?? this.position;
    return this.assertPosition(n + 3), this.dataView.getUint32(n);
  },
  pushByte(e) {
    this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
  },
  pushBytes(e) {
    this.assertPosition(this.position + e.length - 1), this.bytes.set(e, this.position), this.position += e.length;
  },
  pushUint8(e) {
    this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
  },
  pushUint16(e) {
    this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, e), this.position += 2;
  },
  pushUint24(e) {
    this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, e >> 8), this.dataView.setUint8(this.position + 2, e & 255), this.position += 3;
  },
  pushUint32(e) {
    this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, e), this.position += 4;
  },
  readByte() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectByte();
    return this.position++, e;
  },
  readBytes(e, n) {
    this.assertReadLimit(), this._touch();
    const r = this.inspectBytes(e);
    return this.position += n ?? e, r;
  },
  readUint8() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint8();
    return this.position += 1, e;
  },
  readUint16() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint16();
    return this.position += 2, e;
  },
  readUint24() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint24();
    return this.position += 3, e;
  },
  readUint32() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint32();
    return this.position += 4, e;
  },
  get remaining() {
    return this.bytes.length - this.position;
  },
  setPosition(e) {
    const n = this.position;
    return this.assertPosition(e), this.position = e, () => this.position = n;
  },
  _touch() {
    if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
      return;
    const e = this.getReadCount();
    this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
  }
};
function $a(e, { recursiveReadLimit: n = 8192 } = {}) {
  const r = Object.create(B1);
  return r.bytes = e, r.dataView = new DataView(e.buffer, e.byteOffset, e.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = n, r;
}
function S1(e, n = "hex") {
  const r = td(e), i = $a(new Uint8Array(r.length));
  return r.encode(i), n === "hex" ? Me(i.bytes) : i.bytes;
}
function td(e) {
  return Array.isArray(e) ? R1(e.map((n) => td(n))) : D1(e);
}
function R1(e) {
  const n = e.reduce((o, u) => o + u.length, 0), r = nd(n);
  return {
    length: n <= 55 ? 1 + n : 1 + r + n,
    encode(o) {
      n <= 55 ? o.pushByte(192 + n) : (o.pushByte(247 + r), r === 1 ? o.pushUint8(n) : r === 2 ? o.pushUint16(n) : r === 3 ? o.pushUint24(n) : o.pushUint32(n));
      for (const { encode: u } of e)
        u(o);
    }
  };
}
function D1(e) {
  const n = typeof e == "string" ? $t(e) : e, r = nd(n.length);
  return {
    length: n.length === 1 && n[0] < 128 ? 1 : n.length <= 55 ? 1 + n.length : 1 + r + n.length,
    encode(o) {
      n.length === 1 && n[0] < 128 ? o.pushBytes(n) : n.length <= 55 ? (o.pushByte(128 + n.length), o.pushBytes(n)) : (o.pushByte(183 + r), r === 1 ? o.pushUint8(n.length) : r === 2 ? o.pushUint16(n.length) : r === 3 ? o.pushUint24(n.length) : o.pushUint32(n.length), o.pushBytes(n));
    }
  };
}
function nd(e) {
  if (e < 2 ** 8)
    return 1;
  if (e < 2 ** 16)
    return 2;
  if (e < 2 ** 24)
    return 3;
  if (e < 2 ** 32)
    return 4;
  throw new O("Length is too large.");
}
function _1(e) {
  const { chainId: n, nonce: r, to: i } = e, o = e.contractAddress ?? e.address, u = Bn($r([
    "0x05",
    S1([
      n ? X(n) : "0x",
      o,
      r ? X(r) : "0x"
    ])
  ]));
  return i === "bytes" ? $t(u) : u;
}
async function rd(e) {
  const { authorization: n, signature: r } = e;
  return P1({
    hash: _1(n),
    signature: r ?? n
  });
}
class ua extends O {
  constructor({ blockNumber: n, chain: r, contract: i }) {
    super(`Chain "${r.name}" does not support contract "${i.name}".`, {
      metaMessages: [
        "This could be due to any of the following:",
        ...n && i.blockCreated && i.blockCreated > n ? [
          `- The contract "${i.name}" was not deployed until block ${i.blockCreated} (current block ${n}).`
        ] : [
          `- The chain does not have the contract "${i.name}" configured.`
        ]
      ],
      name: "ChainDoesNotSupportContract"
    });
  }
}
class C1 extends O {
  constructor({ chain: n, currentChainId: r }) {
    super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${n.id} – ${n.name}).`, {
      metaMessages: [
        `Current Chain ID:  ${r}`,
        `Expected Chain ID: ${n.id} – ${n.name}`
      ],
      name: "ChainMismatchError"
    });
  }
}
class N1 extends O {
  constructor() {
    super([
      "No chain was provided to the request.",
      "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."
    ].join(`
`), {
      name: "ChainNotFoundError"
    });
  }
}
class sd extends O {
  constructor() {
    super("No chain was provided to the Client.", {
      name: "ClientChainNotConfiguredError"
    });
  }
}
function O1({ chain: e, currentChainId: n }) {
  if (!e)
    throw new N1();
  if (n !== e.id)
    throw new C1({ chain: e, currentChainId: n });
}
const M1 = {
  gwei: 9,
  wei: 18
}, U1 = {
  ether: -9,
  wei: 9
};
function id(e, n) {
  let r = e.toString();
  const i = r.startsWith("-");
  i && (r = r.slice(1)), r = r.padStart(n, "0");
  let [o, u] = [
    r.slice(0, r.length - n),
    r.slice(r.length - n)
  ];
  return u = u.replace(/(0+)$/, ""), `${i ? "-" : ""}${o || "0"}${u ? `.${u}` : ""}`;
}
function Ye(e, n = "wei") {
  return id(e, U1[n]);
}
class qn extends O {
  constructor({ cause: n, message: r } = {}) {
    var o;
    const i = (o = r == null ? void 0 : r.replace("execution reverted: ", "")) == null ? void 0 : o.replace("execution reverted", "");
    super(`Execution reverted ${i ? `with reason: ${i}` : "for an unknown reason"}.`, {
      cause: n,
      name: "ExecutionRevertedError"
    });
  }
}
Object.defineProperty(qn, "code", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: 3
});
Object.defineProperty(qn, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /execution reverted/
});
class ei extends O {
  constructor({ cause: n, maxFeePerGas: r } = {}) {
    super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Ye(r)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
      cause: n,
      name: "FeeCapTooHighError"
    });
  }
}
Object.defineProperty(ei, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
});
class ca extends O {
  constructor({ cause: n, maxFeePerGas: r } = {}) {
    super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Ye(r)}` : ""} gwei) cannot be lower than the block base fee.`, {
      cause: n,
      name: "FeeCapTooLowError"
    });
  }
}
Object.defineProperty(ca, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
});
class fa extends O {
  constructor({ cause: n, nonce: r } = {}) {
    super(`Nonce provided for the transaction ${r ? `(${r}) ` : ""}is higher than the next one expected.`, { cause: n, name: "NonceTooHighError" });
  }
}
Object.defineProperty(fa, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /nonce too high/
});
class la extends O {
  constructor({ cause: n, nonce: r } = {}) {
    super([
      `Nonce provided for the transaction ${r ? `(${r}) ` : ""}is lower than the current nonce of the account.`,
      "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
    ].join(`
`), { cause: n, name: "NonceTooLowError" });
  }
}
Object.defineProperty(la, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /nonce too low|transaction already imported|already known/
});
class da extends O {
  constructor({ cause: n, nonce: r } = {}) {
    super(`Nonce provided for the transaction ${r ? `(${r}) ` : ""}exceeds the maximum allowed nonce.`, { cause: n, name: "NonceMaxValueError" });
  }
}
Object.defineProperty(da, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /nonce has max value/
});
class ha extends O {
  constructor({ cause: n } = {}) {
    super([
      "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
    ].join(`
`), {
      cause: n,
      metaMessages: [
        "This error could arise when the account does not have enough funds to:",
        " - pay for the total gas fee,",
        " - pay for the value to send.",
        " ",
        "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
        " - `gas` is the amount of gas needed for transaction to execute,",
        " - `gas fee` is the gas fee,",
        " - `value` is the amount of ether to send to the recipient."
      ],
      name: "InsufficientFundsError"
    });
  }
}
Object.defineProperty(ha, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /insufficient funds|exceeds transaction sender account balance/
});
class pa extends O {
  constructor({ cause: n, gas: r } = {}) {
    super(`The amount of gas ${r ? `(${r}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
      cause: n,
      name: "IntrinsicGasTooHighError"
    });
  }
}
Object.defineProperty(pa, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /intrinsic gas too high|gas limit reached/
});
class ga extends O {
  constructor({ cause: n, gas: r } = {}) {
    super(`The amount of gas ${r ? `(${r}) ` : ""}provided for the transaction is too low.`, {
      cause: n,
      name: "IntrinsicGasTooLowError"
    });
  }
}
Object.defineProperty(ga, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /intrinsic gas too low/
});
class ma extends O {
  constructor({ cause: n }) {
    super("The transaction type is not supported for this chain.", {
      cause: n,
      name: "TransactionTypeNotSupportedError"
    });
  }
}
Object.defineProperty(ma, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /transaction type not valid/
});
class ti extends O {
  constructor({ cause: n, maxPriorityFeePerGas: r, maxFeePerGas: i } = {}) {
    super([
      `The provided tip (\`maxPriorityFeePerGas\`${r ? ` = ${Ye(r)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${i ? ` = ${Ye(i)} gwei` : ""}).`
    ].join(`
`), {
      cause: n,
      name: "TipAboveFeeCapError"
    });
  }
}
Object.defineProperty(ti, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
});
class gi extends O {
  constructor({ cause: n }) {
    super(`An error occurred while executing: ${n == null ? void 0 : n.shortMessage}`, {
      cause: n,
      name: "UnknownNodeError"
    });
  }
}
function Va(e, n = "wei") {
  return id(e, M1[n]);
}
function Vr(e) {
  const n = Object.entries(e).map(([i, o]) => o === void 0 || o === !1 ? null : [i, o]).filter(Boolean), r = n.reduce((i, [o]) => Math.max(i, o.length), 0);
  return n.map(([i, o]) => `  ${`${i}:`.padEnd(r + 1)}  ${o}`).join(`
`);
}
class F1 extends O {
  constructor() {
    super([
      "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
      "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
    ].join(`
`), { name: "FeeConflictError" });
  }
}
class k1 extends O {
  constructor({ transaction: n }) {
    super("Cannot infer a transaction type from provided transaction.", {
      metaMessages: [
        "Provided Transaction:",
        "{",
        Vr(n),
        "}",
        "",
        "To infer the type, either provide:",
        "- a `type` to the Transaction, or",
        "- an EIP-1559 Transaction with `maxFeePerGas`, or",
        "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
        "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
        "- an EIP-7702 Transaction with `authorizationList`, or",
        "- a Legacy Transaction with `gasPrice`"
      ],
      name: "InvalidSerializableTransactionError"
    });
  }
}
class L1 extends O {
  constructor(n, { account: r, docsPath: i, chain: o, data: u, gas: c, gasPrice: l, maxFeePerGas: h, maxPriorityFeePerGas: m, nonce: A, to: y, value: x }) {
    var I;
    const T = Vr({
      chain: o && `${o == null ? void 0 : o.name} (id: ${o == null ? void 0 : o.id})`,
      from: r == null ? void 0 : r.address,
      to: y,
      value: typeof x < "u" && `${Va(x)} ${((I = o == null ? void 0 : o.nativeCurrency) == null ? void 0 : I.symbol) || "ETH"}`,
      data: u,
      gas: c,
      gasPrice: typeof l < "u" && `${Ye(l)} gwei`,
      maxFeePerGas: typeof h < "u" && `${Ye(h)} gwei`,
      maxPriorityFeePerGas: typeof m < "u" && `${Ye(m)} gwei`,
      nonce: A
    });
    super(n.shortMessage, {
      cause: n,
      docsPath: i,
      metaMessages: [
        ...n.metaMessages ? [...n.metaMessages, " "] : [],
        "Request Arguments:",
        T
      ].filter(Boolean),
      name: "TransactionExecutionError"
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.cause = n;
  }
}
class od extends O {
  constructor({ blockHash: n, blockNumber: r, blockTag: i, hash: o, index: u }) {
    let c = "Transaction";
    i && u !== void 0 && (c = `Transaction at block time "${i}" at index "${u}"`), n && u !== void 0 && (c = `Transaction at block hash "${n}" at index "${u}"`), r && u !== void 0 && (c = `Transaction at block number "${r}" at index "${u}"`), o && (c = `Transaction with hash "${o}"`), super(`${c} could not be found.`, {
      name: "TransactionNotFoundError"
    });
  }
}
class ad extends O {
  constructor({ hash: n }) {
    super(`Transaction receipt with hash "${n}" could not be found. The Transaction may not be processed on a block yet.`, {
      name: "TransactionReceiptNotFoundError"
    });
  }
}
class G1 extends O {
  constructor({ hash: n }) {
    super(`Timed out while waiting for transaction with hash "${n}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
  }
}
const Vt = (e, n, r) => JSON.stringify(e, (i, o) => typeof o == "bigint" ? o.toString() : o, r), H1 = (e) => e, ud = (e) => e;
class m2 extends O {
  constructor({ body: n, cause: r, details: i, headers: o, status: u, url: c }) {
    super("HTTP request failed.", {
      cause: r,
      details: i,
      metaMessages: [
        u && `Status: ${u}`,
        `URL: ${ud(c)}`,
        n && `Request body: ${Vt(n)}`
      ].filter(Boolean),
      name: "HttpRequestError"
    }), Object.defineProperty(this, "body", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "headers", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "status", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "url", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.body = n, this.headers = o, this.status = u, this.url = c;
  }
}
class cd extends O {
  constructor({ body: n, error: r, url: i }) {
    super("RPC Request failed.", {
      cause: r,
      details: r.message,
      metaMessages: [`URL: ${ud(i)}`, `Request body: ${Vt(n)}`],
      name: "RpcRequestError"
    }), Object.defineProperty(this, "code", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.code = r.code, this.data = r.data;
  }
}
const Q1 = -1;
class z1 extends O {
  constructor(n, { code: r, docsPath: i, metaMessages: o, name: u, shortMessage: c }) {
    super(c, {
      cause: n,
      docsPath: i,
      metaMessages: o || (n == null ? void 0 : n.metaMessages),
      name: u || "RpcError"
    }), Object.defineProperty(this, "code", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.name = u || n.name, this.code = n instanceof cd ? n.code : r ?? Q1;
  }
}
class mi extends z1 {
  constructor(n) {
    super(n, {
      code: mi.code,
      name: "InternalRpcError",
      shortMessage: "An internal error was received."
    });
  }
}
Object.defineProperty(mi, "code", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: -32603
});
function qa(e, n) {
  const r = (e.details || "").toLowerCase(), i = e instanceof O ? e.walk((o) => (o == null ? void 0 : o.code) === qn.code) : e;
  return i instanceof O ? new qn({
    cause: e,
    message: i.details
  }) : qn.nodeMessage.test(r) ? new qn({
    cause: e,
    message: e.details
  }) : ei.nodeMessage.test(r) ? new ei({
    cause: e,
    maxFeePerGas: n == null ? void 0 : n.maxFeePerGas
  }) : ca.nodeMessage.test(r) ? new ca({
    cause: e,
    maxFeePerGas: n == null ? void 0 : n.maxFeePerGas
  }) : fa.nodeMessage.test(r) ? new fa({ cause: e, nonce: n == null ? void 0 : n.nonce }) : la.nodeMessage.test(r) ? new la({ cause: e, nonce: n == null ? void 0 : n.nonce }) : da.nodeMessage.test(r) ? new da({ cause: e, nonce: n == null ? void 0 : n.nonce }) : ha.nodeMessage.test(r) ? new ha({ cause: e }) : pa.nodeMessage.test(r) ? new pa({ cause: e, gas: n == null ? void 0 : n.gas }) : ga.nodeMessage.test(r) ? new ga({ cause: e, gas: n == null ? void 0 : n.gas }) : ma.nodeMessage.test(r) ? new ma({ cause: e }) : ti.nodeMessage.test(r) ? new ti({
    cause: e,
    maxFeePerGas: n == null ? void 0 : n.maxFeePerGas,
    maxPriorityFeePerGas: n == null ? void 0 : n.maxPriorityFeePerGas
  }) : new gi({
    cause: e
  });
}
function fd(e, { docsPath: n, ...r }) {
  const i = (() => {
    const o = qa(e, r);
    return o instanceof gi ? e : o;
  })();
  return new L1(i, {
    docsPath: n,
    ...r
  });
}
function Ja(e, { format: n }) {
  if (!n)
    return {};
  const r = {};
  function i(u) {
    const c = Object.keys(u);
    for (const l of c)
      l in e && (r[l] = e[l]), u[l] && typeof u[l] == "object" && !Array.isArray(u[l]) && i(u[l]);
  }
  const o = n(e || {});
  return i(o), r;
}
const W1 = {
  legacy: "0x0",
  eip2930: "0x1",
  eip1559: "0x2",
  eip4844: "0x3",
  eip7702: "0x4"
};
function Ka(e) {
  const n = {};
  return typeof e.authorizationList < "u" && (n.authorizationList = $1(e.authorizationList)), typeof e.accessList < "u" && (n.accessList = e.accessList), typeof e.blobVersionedHashes < "u" && (n.blobVersionedHashes = e.blobVersionedHashes), typeof e.blobs < "u" && (typeof e.blobs[0] != "string" ? n.blobs = e.blobs.map((r) => Me(r)) : n.blobs = e.blobs), typeof e.data < "u" && (n.data = e.data), typeof e.from < "u" && (n.from = e.from), typeof e.gas < "u" && (n.gas = X(e.gas)), typeof e.gasPrice < "u" && (n.gasPrice = X(e.gasPrice)), typeof e.maxFeePerBlobGas < "u" && (n.maxFeePerBlobGas = X(e.maxFeePerBlobGas)), typeof e.maxFeePerGas < "u" && (n.maxFeePerGas = X(e.maxFeePerGas)), typeof e.maxPriorityFeePerGas < "u" && (n.maxPriorityFeePerGas = X(e.maxPriorityFeePerGas)), typeof e.nonce < "u" && (n.nonce = X(e.nonce)), typeof e.to < "u" && (n.to = e.to), typeof e.type < "u" && (n.type = W1[e.type]), typeof e.value < "u" && (n.value = X(e.value)), n;
}
function $1(e) {
  return e.map((n) => ({
    address: n.address,
    r: n.r ? X(BigInt(n.r)) : n.r,
    s: n.s ? X(BigInt(n.s)) : n.s,
    chainId: X(n.chainId),
    nonce: X(n.nonce),
    ...typeof n.yParity < "u" ? { yParity: X(n.yParity) } : {},
    ...typeof n.v < "u" && typeof n.yParity > "u" ? { v: X(n.v) } : {}
  }));
}
function ae(e, n, r) {
  const i = e[n.name];
  if (typeof i == "function")
    return i;
  const o = e[r];
  return typeof o == "function" ? o : (u) => n(e, u);
}
const V1 = 2n ** 256n - 1n;
function Ai(e) {
  const { account: n, gasPrice: r, maxFeePerGas: i, maxPriorityFeePerGas: o, to: u } = e, c = n ? Jt(n) : void 0;
  if (c && !dn(c.address))
    throw new Ur({ address: c.address });
  if (u && !dn(u))
    throw new Ur({ address: u });
  if (typeof r < "u" && (typeof i < "u" || typeof o < "u"))
    throw new F1();
  if (i && i > V1)
    throw new ei({ maxFeePerGas: i });
  if (o && i && o > i)
    throw new ti({ maxFeePerGas: i, maxPriorityFeePerGas: o });
}
async function ni(e) {
  const n = await e.request({
    method: "eth_chainId"
  }, { dedupe: !0 });
  return fn(n);
}
class q1 extends O {
  constructor() {
    super("`baseFeeMultiplier` must be greater than 1.", {
      name: "BaseFeeScalarError"
    });
  }
}
class Ya extends O {
  constructor() {
    super("Chain does not support EIP-1559 fees.", {
      name: "Eip1559FeesNotSupportedError"
    });
  }
}
class J1 extends O {
  constructor({ maxPriorityFeePerGas: n }) {
    super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Ye(n)} gwei).`, { name: "MaxFeePerGasTooLowError" });
  }
}
class ld extends O {
  constructor({ blockHash: n, blockNumber: r }) {
    let i = "Block";
    n && (i = `Block at hash "${n}"`), r && (i = `Block at number "${r}"`), super(`${i} could not be found.`, { name: "BlockNotFoundError" });
  }
}
const dd = {
  "0x0": "legacy",
  "0x1": "eip2930",
  "0x2": "eip1559",
  "0x3": "eip4844",
  "0x4": "eip7702"
};
function hd(e) {
  const n = {
    ...e,
    blockHash: e.blockHash ? e.blockHash : null,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    chainId: e.chainId ? fn(e.chainId) : void 0,
    gas: e.gas ? BigInt(e.gas) : void 0,
    gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
    maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
    maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
    maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
    nonce: e.nonce ? fn(e.nonce) : void 0,
    to: e.to ? e.to : null,
    transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
    type: e.type ? dd[e.type] : void 0,
    typeHex: e.type ? e.type : void 0,
    value: e.value ? BigInt(e.value) : void 0,
    v: e.v ? BigInt(e.v) : void 0
  };
  return e.authorizationList && (n.authorizationList = K1(e.authorizationList)), n.yParity = (() => {
    if (e.yParity)
      return Number(e.yParity);
    if (typeof n.v == "bigint") {
      if (n.v === 0n || n.v === 27n)
        return 0;
      if (n.v === 1n || n.v === 28n)
        return 1;
      if (n.v >= 35n)
        return n.v % 2n === 0n ? 1 : 0;
    }
  })(), n.type === "legacy" && (delete n.accessList, delete n.maxFeePerBlobGas, delete n.maxFeePerGas, delete n.maxPriorityFeePerGas, delete n.yParity), n.type === "eip2930" && (delete n.maxFeePerBlobGas, delete n.maxFeePerGas, delete n.maxPriorityFeePerGas), n.type === "eip1559" && delete n.maxFeePerBlobGas, n;
}
function K1(e) {
  return e.map((n) => ({
    address: n.address,
    chainId: Number(n.chainId),
    nonce: Number(n.nonce),
    r: n.r,
    s: n.s,
    yParity: Number(n.yParity)
  }));
}
function Y1(e) {
  const n = (e.transactions ?? []).map((r) => typeof r == "string" ? r : hd(r));
  return {
    ...e,
    baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
    blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
    difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
    excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
    gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
    gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
    hash: e.hash ? e.hash : null,
    logsBloom: e.logsBloom ? e.logsBloom : null,
    nonce: e.nonce ? e.nonce : null,
    number: e.number ? BigInt(e.number) : null,
    size: e.size ? BigInt(e.size) : void 0,
    timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
    transactions: n,
    totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
  };
}
async function Xn(e, { blockHash: n, blockNumber: r, blockTag: i, includeTransactions: o } = {}) {
  var A, y, x;
  const u = i ?? "latest", c = o ?? !1, l = r !== void 0 ? X(r) : void 0;
  let h = null;
  if (n ? h = await e.request({
    method: "eth_getBlockByHash",
    params: [n, c]
  }, { dedupe: !0 }) : h = await e.request({
    method: "eth_getBlockByNumber",
    params: [l || u, c]
  }, { dedupe: !!l }), !h)
    throw new ld({ blockHash: n, blockNumber: r });
  return (((x = (y = (A = e.chain) == null ? void 0 : A.formatters) == null ? void 0 : y.block) == null ? void 0 : x.format) || Y1)(h);
}
async function pd(e) {
  const n = await e.request({
    method: "eth_gasPrice"
  });
  return BigInt(n);
}
async function j1(e, n) {
  var u, c;
  const { block: r, chain: i = e.chain, request: o } = n || {};
  try {
    const l = ((u = i == null ? void 0 : i.fees) == null ? void 0 : u.maxPriorityFeePerGas) ?? ((c = i == null ? void 0 : i.fees) == null ? void 0 : c.defaultPriorityFee);
    if (typeof l == "function") {
      const m = r || await ae(e, Xn, "getBlock")({}), A = await l({
        block: m,
        client: e,
        request: o
      });
      if (A === null)
        throw new Error();
      return A;
    }
    if (typeof l < "u")
      return l;
    const h = await e.request({
      method: "eth_maxPriorityFeePerGas"
    });
    return cn(h);
  } catch {
    const [l, h] = await Promise.all([
      r ? Promise.resolve(r) : ae(e, Xn, "getBlock")({}),
      ae(e, pd, "getGasPrice")({})
    ]);
    if (typeof l.baseFeePerGas != "bigint")
      throw new Ya();
    const m = h - l.baseFeePerGas;
    return m < 0n ? 0n : m;
  }
}
async function rl(e, n) {
  var x, T;
  const { block: r, chain: i = e.chain, request: o, type: u = "eip1559" } = n || {}, c = await (async () => {
    var I, _;
    return typeof ((I = i == null ? void 0 : i.fees) == null ? void 0 : I.baseFeeMultiplier) == "function" ? i.fees.baseFeeMultiplier({
      block: r,
      client: e,
      request: o
    }) : ((_ = i == null ? void 0 : i.fees) == null ? void 0 : _.baseFeeMultiplier) ?? 1.2;
  })();
  if (c < 1)
    throw new q1();
  const h = 10 ** (((x = c.toString().split(".")[1]) == null ? void 0 : x.length) ?? 0), m = (I) => I * BigInt(Math.ceil(c * h)) / BigInt(h), A = r || await ae(e, Xn, "getBlock")({});
  if (typeof ((T = i == null ? void 0 : i.fees) == null ? void 0 : T.estimateFeesPerGas) == "function") {
    const I = await i.fees.estimateFeesPerGas({
      block: r,
      client: e,
      multiply: m,
      request: o,
      type: u
    });
    if (I !== null)
      return I;
  }
  if (u === "eip1559") {
    if (typeof A.baseFeePerGas != "bigint")
      throw new Ya();
    const I = typeof (o == null ? void 0 : o.maxPriorityFeePerGas) == "bigint" ? o.maxPriorityFeePerGas : await j1(e, {
      block: A,
      chain: i,
      request: o
    }), _ = m(A.baseFeePerGas);
    return {
      maxFeePerGas: (o == null ? void 0 : o.maxFeePerGas) ?? _ + I,
      maxPriorityFeePerGas: I
    };
  }
  return {
    gasPrice: (o == null ? void 0 : o.gasPrice) ?? m(await ae(e, pd, "getGasPrice")({}))
  };
}
class Z1 extends O {
  constructor(n, { account: r, docsPath: i, chain: o, data: u, gas: c, gasPrice: l, maxFeePerGas: h, maxPriorityFeePerGas: m, nonce: A, to: y, value: x }) {
    var I;
    const T = Vr({
      from: r == null ? void 0 : r.address,
      to: y,
      value: typeof x < "u" && `${Va(x)} ${((I = o == null ? void 0 : o.nativeCurrency) == null ? void 0 : I.symbol) || "ETH"}`,
      data: u,
      gas: c,
      gasPrice: typeof l < "u" && `${Ye(l)} gwei`,
      maxFeePerGas: typeof h < "u" && `${Ye(h)} gwei`,
      maxPriorityFeePerGas: typeof m < "u" && `${Ye(m)} gwei`,
      nonce: A
    });
    super(n.shortMessage, {
      cause: n,
      docsPath: i,
      metaMessages: [
        ...n.metaMessages ? [...n.metaMessages, " "] : [],
        "Estimate Gas Arguments:",
        T
      ].filter(Boolean),
      name: "EstimateGasExecutionError"
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.cause = n;
  }
}
function X1(e, { docsPath: n, ...r }) {
  const i = (() => {
    const o = qa(e, r);
    return o instanceof gi ? e : o;
  })();
  return new Z1(i, {
    docsPath: n,
    ...r
  });
}
class ex extends O {
  constructor({ address: n }) {
    super(`State for account "${n}" is set multiple times.`, {
      name: "AccountStateConflictError"
    });
  }
}
class tx extends O {
  constructor() {
    super("state and stateDiff are set on the same account.", {
      name: "StateAssignmentConflictError"
    });
  }
}
function sl(e) {
  return e.reduce((n, { slot: r, value: i }) => `${n}        ${r}: ${i}
`, "");
}
function nx(e) {
  return e.reduce((n, { address: r, ...i }) => {
    let o = `${n}    ${r}:
`;
    return i.nonce && (o += `      nonce: ${i.nonce}
`), i.balance && (o += `      balance: ${i.balance}
`), i.code && (o += `      code: ${i.code}
`), i.state && (o += `      state:
`, o += sl(i.state)), i.stateDiff && (o += `      stateDiff:
`, o += sl(i.stateDiff)), o;
  }, `  State Override:
`).slice(0, -1);
}
function il(e) {
  if (!(!e || e.length === 0))
    return e.reduce((n, { slot: r, value: i }) => {
      if (r.length !== 66)
        throw new Vf({
          size: r.length,
          targetSize: 66,
          type: "hex"
        });
      if (i.length !== 66)
        throw new Vf({
          size: i.length,
          targetSize: 66,
          type: "hex"
        });
      return n[r] = i, n;
    }, {});
}
function rx(e) {
  const { balance: n, nonce: r, state: i, stateDiff: o, code: u } = e, c = {};
  if (u !== void 0 && (c.code = u), n !== void 0 && (c.balance = X(n)), r !== void 0 && (c.nonce = X(r)), i !== void 0 && (c.state = il(i)), o !== void 0) {
    if (c.state)
      throw new tx();
    c.stateDiff = il(o);
  }
  return c;
}
function gd(e) {
  if (!e)
    return;
  const n = {};
  for (const { address: r, ...i } of e) {
    if (!dn(r, { strict: !1 }))
      throw new Ur({ address: r });
    if (n[r])
      throw new ex({ address: r });
    n[r] = rx(i);
  }
  return n;
}
async function md(e, { address: n, blockNumber: r, blockTag: i = "latest" }) {
  const o = typeof r == "bigint" ? X(r) : void 0, u = await e.request({
    method: "eth_getBalance",
    params: [n, o || i]
  });
  return BigInt(u);
}
async function Ad(e, n) {
  var o, u, c;
  const { account: r = e.account } = n, i = r ? Jt(r) : void 0;
  try {
    let Pe = function($e) {
      const { block: be, request: Ee, rpcStateOverride: Ue } = $e;
      return e.request({
        method: "eth_estimateGas",
        params: Ue ? [Ee, be ?? "latest", Ue] : be ? [Ee, be] : [Ee]
      });
    };
    const { accessList: l, authorizationList: h, blobs: m, blobVersionedHashes: A, blockNumber: y, blockTag: x, data: T, gas: I, gasPrice: _, maxFeePerBlobGas: N, maxFeePerGas: S, maxPriorityFeePerGas: M, nonce: G, value: ee, stateOverride: H, ...Q } = await vd(e, {
      ...n,
      parameters: (
        // Some RPC Providers do not compute versioned hashes from blobs. We will need
        // to compute them.
        (i == null ? void 0 : i.type) === "local" ? void 0 : ["blobVersionedHashes"]
      )
    }), ie = (typeof y == "bigint" ? X(y) : void 0) || x, K = gd(H), pe = await (async () => {
      if (Q.to)
        return Q.to;
      if (h && h.length > 0)
        return await rd({
          authorization: h[0]
        }).catch(() => {
          throw new O("`to` is required. Could not infer from `authorizationList`");
        });
    })();
    Ai(n);
    const Y = (c = (u = (o = e.chain) == null ? void 0 : o.formatters) == null ? void 0 : u.transactionRequest) == null ? void 0 : c.format, me = (Y || Ka)({
      // Pick out extra data that might exist on the chain's transaction request type.
      ...Ja(Q, { format: Y }),
      from: i == null ? void 0 : i.address,
      accessList: l,
      authorizationList: h,
      blobs: m,
      blobVersionedHashes: A,
      data: T,
      gas: I,
      gasPrice: _,
      maxFeePerBlobGas: N,
      maxFeePerGas: S,
      maxPriorityFeePerGas: M,
      nonce: G,
      to: pe,
      value: ee
    });
    let We = BigInt(await Pe({ block: ie, request: me, rpcStateOverride: K }));
    if (h) {
      const $e = await md(e, { address: me.from }), be = await Promise.all(h.map(async (Ee) => {
        const { address: Ue } = Ee, Rt = await Pe({
          block: ie,
          request: {
            authorizationList: void 0,
            data: T,
            from: i == null ? void 0 : i.address,
            to: Ue,
            value: X($e)
          },
          rpcStateOverride: K
        }).catch(() => 100000n);
        return 2n * BigInt(Rt);
      }));
      We += be.reduce((Ee, Ue) => Ee + Ue, 0n);
    }
    return We;
  } catch (l) {
    throw X1(l, {
      ...n,
      account: i,
      chain: e.chain
    });
  }
}
async function sx(e, { address: n, blockTag: r = "latest", blockNumber: i }) {
  const o = await e.request({
    method: "eth_getTransactionCount",
    params: [
      n,
      typeof i == "bigint" ? X(i) : r
    ]
  }, {
    dedupe: !!i
  });
  return fn(o);
}
function wd(e) {
  const { kzg: n } = e, r = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), i = typeof e.blobs[0] == "string" ? e.blobs.map((u) => $t(u)) : e.blobs, o = [];
  for (const u of i)
    o.push(Uint8Array.from(n.blobToKzgCommitment(u)));
  return r === "bytes" ? o : o.map((u) => Me(u));
}
function yd(e) {
  const { kzg: n } = e, r = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), i = typeof e.blobs[0] == "string" ? e.blobs.map((c) => $t(c)) : e.blobs, o = typeof e.commitments[0] == "string" ? e.commitments.map((c) => $t(c)) : e.commitments, u = [];
  for (let c = 0; c < i.length; c++) {
    const l = i[c], h = o[c];
    u.push(Uint8Array.from(n.computeBlobKzgProof(l, h)));
  }
  return r === "bytes" ? u : u.map((c) => Me(c));
}
function ix(e, n, r, i) {
  if (typeof e.setBigUint64 == "function")
    return e.setBigUint64(n, r, i);
  const o = BigInt(32), u = BigInt(4294967295), c = Number(r >> o & u), l = Number(r & u), h = i ? 4 : 0, m = i ? 0 : 4;
  e.setUint32(n + h, c, i), e.setUint32(n + m, l, i);
}
function ox(e, n, r) {
  return e & n ^ ~e & r;
}
function ax(e, n, r) {
  return e & n ^ e & r ^ n & r;
}
class ux extends $l {
  constructor(n, r, i, o) {
    super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = n, this.outputLen = r, this.padOffset = i, this.isLE = o, this.buffer = new Uint8Array(n), this.view = $o(this.buffer);
  }
  update(n) {
    Xs(this);
    const { view: r, buffer: i, blockLen: o } = this;
    n = La(n);
    const u = n.length;
    for (let c = 0; c < u; ) {
      const l = Math.min(o - this.pos, u - c);
      if (l === o) {
        const h = $o(n);
        for (; o <= u - c; c += o)
          this.process(h, c);
        continue;
      }
      i.set(n.subarray(c, c + l), this.pos), this.pos += l, c += l, this.pos === o && (this.process(r, 0), this.pos = 0);
    }
    return this.length += n.length, this.roundClean(), this;
  }
  digestInto(n) {
    Xs(this), Wl(n, this), this.finished = !0;
    const { buffer: r, view: i, blockLen: o, isLE: u } = this;
    let { pos: c } = this;
    r[c++] = 128, this.buffer.subarray(c).fill(0), this.padOffset > o - c && (this.process(i, 0), c = 0);
    for (let y = c; y < o; y++)
      r[y] = 0;
    ix(i, o - 8, BigInt(this.length * 8), u), this.process(i, 0);
    const l = $o(n), h = this.outputLen;
    if (h % 4)
      throw new Error("_sha2: outputLen should be aligned to 32bit");
    const m = h / 4, A = this.get();
    if (m > A.length)
      throw new Error("_sha2: outputLen bigger than state");
    for (let y = 0; y < m; y++)
      l.setUint32(4 * y, A[y], u);
  }
  digest() {
    const { buffer: n, outputLen: r } = this;
    this.digestInto(n);
    const i = n.slice(0, r);
    return this.destroy(), i;
  }
  _cloneInto(n) {
    n || (n = new this.constructor()), n.set(...this.get());
    const { blockLen: r, buffer: i, length: o, finished: u, destroyed: c, pos: l } = this;
    return n.length = o, n.pos = l, n.finished = u, n.destroyed = c, o % r && n.buffer.set(i), n;
  }
}
const cx = /* @__PURE__ */ new Uint32Array([
  1116352408,
  1899447441,
  3049323471,
  3921009573,
  961987163,
  1508970993,
  2453635748,
  2870763221,
  3624381080,
  310598401,
  607225278,
  1426881987,
  1925078388,
  2162078206,
  2614888103,
  3248222580,
  3835390401,
  4022224774,
  264347078,
  604807628,
  770255983,
  1249150122,
  1555081692,
  1996064986,
  2554220882,
  2821834349,
  2952996808,
  3210313671,
  3336571891,
  3584528711,
  113926993,
  338241895,
  666307205,
  773529912,
  1294757372,
  1396182291,
  1695183700,
  1986661051,
  2177026350,
  2456956037,
  2730485921,
  2820302411,
  3259730800,
  3345764771,
  3516065817,
  3600352804,
  4094571909,
  275423344,
  430227734,
  506948616,
  659060556,
  883997877,
  958139571,
  1322822218,
  1537002063,
  1747873779,
  1955562222,
  2024104815,
  2227730452,
  2361852424,
  2428436474,
  2756734187,
  3204031479,
  3329325298
]), on = /* @__PURE__ */ new Uint32Array([
  1779033703,
  3144134277,
  1013904242,
  2773480762,
  1359893119,
  2600822924,
  528734635,
  1541459225
]), an = /* @__PURE__ */ new Uint32Array(64);
class fx extends ux {
  constructor(n = 32) {
    super(64, n, 8, !1), this.A = on[0] | 0, this.B = on[1] | 0, this.C = on[2] | 0, this.D = on[3] | 0, this.E = on[4] | 0, this.F = on[5] | 0, this.G = on[6] | 0, this.H = on[7] | 0;
  }
  get() {
    const { A: n, B: r, C: i, D: o, E: u, F: c, G: l, H: h } = this;
    return [n, r, i, o, u, c, l, h];
  }
  // prettier-ignore
  set(n, r, i, o, u, c, l, h) {
    this.A = n | 0, this.B = r | 0, this.C = i | 0, this.D = o | 0, this.E = u | 0, this.F = c | 0, this.G = l | 0, this.H = h | 0;
  }
  process(n, r) {
    for (let y = 0; y < 16; y++, r += 4)
      an[y] = n.getUint32(r, !1);
    for (let y = 16; y < 64; y++) {
      const x = an[y - 15], T = an[y - 2], I = Pt(x, 7) ^ Pt(x, 18) ^ x >>> 3, _ = Pt(T, 17) ^ Pt(T, 19) ^ T >>> 10;
      an[y] = _ + an[y - 7] + I + an[y - 16] | 0;
    }
    let { A: i, B: o, C: u, D: c, E: l, F: h, G: m, H: A } = this;
    for (let y = 0; y < 64; y++) {
      const x = Pt(l, 6) ^ Pt(l, 11) ^ Pt(l, 25), T = A + x + ox(l, h, m) + cx[y] + an[y] | 0, _ = (Pt(i, 2) ^ Pt(i, 13) ^ Pt(i, 22)) + ax(i, o, u) | 0;
      A = m, m = h, h = l, l = c + T | 0, c = u, u = o, o = i, i = T + _ | 0;
    }
    i = i + this.A | 0, o = o + this.B | 0, u = u + this.C | 0, c = c + this.D | 0, l = l + this.E | 0, h = h + this.F | 0, m = m + this.G | 0, A = A + this.H | 0, this.set(i, o, u, c, l, h, m, A);
  }
  roundClean() {
    an.fill(0);
  }
  destroy() {
    this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
  }
}
const lx = /* @__PURE__ */ Vl(() => new fx());
function dx(e, n) {
  return lx(Wt(e, { strict: !1 }) ? fi(e) : e);
}
function hx(e) {
  const { commitment: n, version: r = 1 } = e, i = e.to ?? (typeof n == "string" ? "hex" : "bytes"), o = dx(n);
  return o.set([r], 0), i === "bytes" ? o : Me(o);
}
function px(e) {
  const { commitments: n, version: r } = e, i = e.to, o = [];
  for (const u of n)
    o.push(hx({
      commitment: u,
      to: i,
      version: r
    }));
  return o;
}
const ol = 6, bd = 32, ja = 4096, xd = bd * ja, al = xd * ol - // terminator byte (0x80).
1 - // zero byte (0x00) appended to each field element.
1 * ja * ol;
class gx extends O {
  constructor({ maxSize: n, size: r }) {
    super("Blob size is too large.", {
      metaMessages: [`Max: ${n} bytes`, `Given: ${r} bytes`],
      name: "BlobSizeTooLargeError"
    });
  }
}
class mx extends O {
  constructor() {
    super("Blob data must not be empty.", { name: "EmptyBlobError" });
  }
}
function Ax(e) {
  const n = typeof e.data == "string" ? $t(e.data) : e.data, r = Be(n);
  if (!r)
    throw new mx();
  if (r > al)
    throw new gx({
      maxSize: al,
      size: r
    });
  const i = [];
  let o = !0, u = 0;
  for (; o; ) {
    const c = $a(new Uint8Array(xd));
    let l = 0;
    for (; l < ja; ) {
      const h = n.slice(u, u + (bd - 1));
      if (c.pushByte(0), c.pushBytes(h), h.length < 31) {
        c.pushByte(128), o = !1;
        break;
      }
      l++, u += 31;
    }
    i.push(c);
  }
  return i.map((c) => Me(c.bytes));
}
function wx(e) {
  const { data: n, kzg: r, to: i } = e, o = e.blobs ?? Ax({ data: n }), u = e.commitments ?? wd({ blobs: o, kzg: r, to: i }), c = e.proofs ?? yd({ blobs: o, commitments: u, kzg: r, to: i }), l = [];
  for (let h = 0; h < o.length; h++)
    l.push({
      blob: o[h],
      commitment: u[h],
      proof: c[h]
    });
  return l;
}
function yx(e) {
  if (e.type)
    return e.type;
  if (typeof e.authorizationList < "u")
    return "eip7702";
  if (typeof e.blobs < "u" || typeof e.blobVersionedHashes < "u" || typeof e.maxFeePerBlobGas < "u" || typeof e.sidecars < "u")
    return "eip4844";
  if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u")
    return "eip1559";
  if (typeof e.gasPrice < "u")
    return typeof e.accessList < "u" ? "eip2930" : "legacy";
  throw new k1({ transaction: e });
}
const Ed = [
  "blobVersionedHashes",
  "chainId",
  "fees",
  "gas",
  "nonce",
  "type"
], ul = /* @__PURE__ */ new Map();
async function vd(e, n) {
  const { account: r = e.account, blobs: i, chain: o, gas: u, kzg: c, nonce: l, nonceManager: h, parameters: m = Ed, type: A } = n, y = r && Jt(r), x = { ...n, ...y ? { from: y == null ? void 0 : y.address } : {} };
  let T;
  async function I() {
    return T || (T = await ae(e, Xn, "getBlock")({ blockTag: "latest" }), T);
  }
  let _;
  async function N() {
    return _ || (o ? o.id : typeof n.chainId < "u" ? n.chainId : (_ = await ae(e, ni, "getChainId")({}), _));
  }
  if (m.includes("nonce") && typeof l > "u" && y)
    if (h) {
      const S = await N();
      x.nonce = await h.consume({
        address: y.address,
        chainId: S,
        client: e
      });
    } else
      x.nonce = await ae(e, sx, "getTransactionCount")({
        address: y.address,
        blockTag: "pending"
      });
  if ((m.includes("blobVersionedHashes") || m.includes("sidecars")) && i && c) {
    const S = wd({ blobs: i, kzg: c });
    if (m.includes("blobVersionedHashes")) {
      const M = px({
        commitments: S,
        to: "hex"
      });
      x.blobVersionedHashes = M;
    }
    if (m.includes("sidecars")) {
      const M = yd({ blobs: i, commitments: S, kzg: c }), G = wx({
        blobs: i,
        commitments: S,
        proofs: M,
        to: "hex"
      });
      x.sidecars = G;
    }
  }
  if (m.includes("chainId") && (x.chainId = await N()), (m.includes("fees") || m.includes("type")) && typeof A > "u")
    try {
      x.type = yx(x);
    } catch {
      let S = ul.get(e.uid);
      if (typeof S > "u") {
        const M = await I();
        S = typeof (M == null ? void 0 : M.baseFeePerGas) == "bigint", ul.set(e.uid, S);
      }
      x.type = S ? "eip1559" : "legacy";
    }
  if (m.includes("fees"))
    if (x.type !== "legacy" && x.type !== "eip2930") {
      if (typeof x.maxFeePerGas > "u" || typeof x.maxPriorityFeePerGas > "u") {
        const S = await I(), { maxFeePerGas: M, maxPriorityFeePerGas: G } = await rl(e, {
          block: S,
          chain: o,
          request: x
        });
        if (typeof n.maxPriorityFeePerGas > "u" && n.maxFeePerGas && n.maxFeePerGas < G)
          throw new J1({
            maxPriorityFeePerGas: G
          });
        x.maxPriorityFeePerGas = G, x.maxFeePerGas = M;
      }
    } else {
      if (typeof n.maxFeePerGas < "u" || typeof n.maxPriorityFeePerGas < "u")
        throw new Ya();
      if (typeof n.gasPrice > "u") {
        const S = await I(), { gasPrice: M } = await rl(e, {
          block: S,
          chain: o,
          request: x,
          type: "legacy"
        });
        x.gasPrice = M;
      }
    }
  return m.includes("gas") && typeof u > "u" && (x.gas = await ae(e, Ad, "estimateGas")({
    ...x,
    account: y && { address: y.address, type: "json-rpc" }
  })), Ai(x), delete x.parameters, x;
}
async function bx(e, { serializedTransaction: n }) {
  return e.request({
    method: "eth_sendRawTransaction",
    params: [n]
  }, { retryCount: 0 });
}
const Yo = new ka(128);
async function Pd(e, n) {
  var M, G, ee, H;
  const { account: r = e.account, chain: i = e.chain, accessList: o, authorizationList: u, blobs: c, data: l, gas: h, gasPrice: m, maxFeePerBlobGas: A, maxFeePerGas: y, maxPriorityFeePerGas: x, nonce: T, type: I, value: _, ...N } = n;
  if (typeof r > "u")
    throw new Wa({
      docsPath: "/docs/actions/wallet/sendTransaction"
    });
  const S = r ? Jt(r) : null;
  try {
    Ai(n);
    const Q = await (async () => {
      if (n.to)
        return n.to;
      if (n.to !== null && u && u.length > 0)
        return await rd({
          authorization: u[0]
        }).catch(() => {
          throw new O("`to` is required. Could not infer from `authorizationList`.");
        });
    })();
    if ((S == null ? void 0 : S.type) === "json-rpc" || S === null) {
      let F;
      i !== null && (F = await ae(e, ni, "getChainId")({}), O1({
        currentChainId: F,
        chain: i
      }));
      const ie = (ee = (G = (M = e.chain) == null ? void 0 : M.formatters) == null ? void 0 : G.transactionRequest) == null ? void 0 : ee.format, pe = (ie || Ka)({
        // Pick out extra data that might exist on the chain's transaction request type.
        ...Ja(N, { format: ie }),
        accessList: o,
        authorizationList: u,
        blobs: c,
        chainId: F,
        data: l,
        from: S == null ? void 0 : S.address,
        gas: h,
        gasPrice: m,
        maxFeePerBlobGas: A,
        maxFeePerGas: y,
        maxPriorityFeePerGas: x,
        nonce: T,
        to: Q,
        type: I,
        value: _
      }), Y = Yo.get(e.uid), ce = Y ? "wallet_sendTransaction" : "eth_sendTransaction";
      try {
        return await e.request({
          method: ce,
          params: [pe]
        }, { retryCount: 0 });
      } catch (me) {
        if (Y === !1)
          throw me;
        const Pe = me;
        if (Pe.name === "InvalidInputRpcError" || Pe.name === "InvalidParamsRpcError" || Pe.name === "MethodNotFoundRpcError" || Pe.name === "MethodNotSupportedRpcError")
          return await e.request({
            method: "wallet_sendTransaction",
            params: [pe]
          }, { retryCount: 0 }).then((We) => (Yo.set(e.uid, !0), We)).catch((We) => {
            const $e = We;
            throw $e.name === "MethodNotFoundRpcError" || $e.name === "MethodNotSupportedRpcError" ? (Yo.set(e.uid, !1), Pe) : $e;
          });
        throw Pe;
      }
    }
    if ((S == null ? void 0 : S.type) === "local") {
      const F = await ae(e, vd, "prepareTransactionRequest")({
        account: S,
        accessList: o,
        authorizationList: u,
        blobs: c,
        chain: i,
        data: l,
        gas: h,
        gasPrice: m,
        maxFeePerBlobGas: A,
        maxFeePerGas: y,
        maxPriorityFeePerGas: x,
        nonce: T,
        nonceManager: S.nonceManager,
        parameters: [...Ed, "sidecars"],
        type: I,
        value: _,
        ...N,
        to: Q
      }), ie = (H = i == null ? void 0 : i.serializers) == null ? void 0 : H.transaction, K = await S.signTransaction(F, {
        serializer: ie
      });
      return await ae(e, bx, "sendRawTransaction")({
        serializedTransaction: K
      });
    }
    throw (S == null ? void 0 : S.type) === "smart" ? new Ko({
      metaMessages: [
        "Consider using the `sendUserOperation` Action instead."
      ],
      docsPath: "/docs/actions/bundler/sendUserOperation",
      type: "smart"
    }) : new Ko({
      docsPath: "/docs/actions/wallet/sendTransaction",
      type: S == null ? void 0 : S.type
    });
  } catch (Q) {
    throw Q instanceof Ko ? Q : fd(Q, {
      ...n,
      account: S,
      chain: n.chain || void 0
    });
  }
}
const Aa = [
  {
    inputs: [
      {
        components: [
          {
            name: "target",
            type: "address"
          },
          {
            name: "allowFailure",
            type: "bool"
          },
          {
            name: "callData",
            type: "bytes"
          }
        ],
        name: "calls",
        type: "tuple[]"
      }
    ],
    name: "aggregate3",
    outputs: [
      {
        components: [
          {
            name: "success",
            type: "bool"
          },
          {
            name: "returnData",
            type: "bytes"
          }
        ],
        name: "returnData",
        type: "tuple[]"
      }
    ],
    stateMutability: "view",
    type: "function"
  }
], wa = [
  {
    name: "query",
    type: "function",
    stateMutability: "view",
    inputs: [
      {
        type: "tuple[]",
        name: "queries",
        components: [
          {
            type: "address",
            name: "sender"
          },
          {
            type: "string[]",
            name: "urls"
          },
          {
            type: "bytes",
            name: "data"
          }
        ]
      }
    ],
    outputs: [
      {
        type: "bool[]",
        name: "failures"
      },
      {
        type: "bytes[]",
        name: "responses"
      }
    ]
  },
  {
    name: "HttpError",
    type: "error",
    inputs: [
      {
        type: "uint16",
        name: "status"
      },
      {
        type: "string",
        name: "message"
      }
    ]
  }
], xx = [
  {
    inputs: [],
    name: "ResolverNotFound",
    type: "error"
  },
  {
    inputs: [],
    name: "ResolverWildcardNotSupported",
    type: "error"
  },
  {
    inputs: [],
    name: "ResolverNotContract",
    type: "error"
  },
  {
    inputs: [
      {
        name: "returnData",
        type: "bytes"
      }
    ],
    name: "ResolverError",
    type: "error"
  },
  {
    inputs: [
      {
        components: [
          {
            name: "status",
            type: "uint16"
          },
          {
            name: "message",
            type: "string"
          }
        ],
        name: "errors",
        type: "tuple[]"
      }
    ],
    name: "HttpError",
    type: "error"
  }
], Ex = [
  ...xx,
  {
    name: "resolve",
    type: "function",
    stateMutability: "view",
    inputs: [
      { name: "name", type: "bytes" },
      { name: "data", type: "bytes" }
    ],
    outputs: [
      { name: "", type: "bytes" },
      { name: "address", type: "address" }
    ]
  },
  {
    name: "resolve",
    type: "function",
    stateMutability: "view",
    inputs: [
      { name: "name", type: "bytes" },
      { name: "data", type: "bytes" },
      { name: "gateways", type: "string[]" }
    ],
    outputs: [
      { name: "", type: "bytes" },
      { name: "address", type: "address" }
    ]
  }
], cl = [
  {
    name: "addr",
    type: "function",
    stateMutability: "view",
    inputs: [{ name: "name", type: "bytes32" }],
    outputs: [{ name: "", type: "address" }]
  },
  {
    name: "addr",
    type: "function",
    stateMutability: "view",
    inputs: [
      { name: "name", type: "bytes32" },
      { name: "coinType", type: "uint256" }
    ],
    outputs: [{ name: "", type: "bytes" }]
  }
];
function vx(e, n = {}) {
  typeof n.size < "u" && St(e, { size: n.size });
  const r = Me(e, n);
  return cn(r, n);
}
function Px(e, n = {}) {
  let r = e;
  if (typeof n.size < "u" && (St(r, { size: n.size }), r = ci(r)), r.length > 1 || r[0] > 1)
    throw new vb(r);
  return !!r[0];
}
function zt(e, n = {}) {
  typeof n.size < "u" && St(e, { size: n.size });
  const r = Me(e, n);
  return fn(r, n);
}
function Tx(e, n = {}) {
  let r = e;
  return typeof n.size < "u" && (St(r, { size: n.size }), r = ci(r, { dir: "right" })), new TextDecoder().decode(r);
}
function Za(e, n) {
  const r = typeof n == "string" ? $t(n) : n, i = $a(r);
  if (Be(r) === 0 && e.length > 0)
    throw new li();
  if (Be(n) && Be(n) < 32)
    throw new Nb({
      data: typeof n == "string" ? n : Me(n),
      params: e,
      size: Be(n)
    });
  let o = 0;
  const u = [];
  for (let c = 0; c < e.length; ++c) {
    const l = e[c];
    i.setPosition(o);
    const [h, m] = Kn(i, l, {
      staticPosition: 0
    });
    o += m, u.push(h);
  }
  return u;
}
function Kn(e, n, { staticPosition: r }) {
  const i = za(n.type);
  if (i) {
    const [o, u] = i;
    return Bx(e, { ...n, type: u }, { length: o, staticPosition: r });
  }
  if (n.type === "tuple")
    return _x(e, n, { staticPosition: r });
  if (n.type === "address")
    return Ix(e);
  if (n.type === "bool")
    return Sx(e);
  if (n.type.startsWith("bytes"))
    return Rx(e, n, { staticPosition: r });
  if (n.type.startsWith("uint") || n.type.startsWith("int"))
    return Dx(e, n);
  if (n.type === "string")
    return Cx(e, { staticPosition: r });
  throw new Qb(n.type, {
    docsPath: "/docs/contract/decodeAbiParameters"
  });
}
const fl = 32, ya = 32;
function Ix(e) {
  const n = e.readBytes(32);
  return [hi(Me(Zl(n, -20))), 32];
}
function Bx(e, n, { length: r, staticPosition: i }) {
  if (!r) {
    const c = zt(e.readBytes(ya)), l = i + c, h = l + fl;
    e.setPosition(l);
    const m = zt(e.readBytes(fl)), A = Fr(n);
    let y = 0;
    const x = [];
    for (let T = 0; T < m; ++T) {
      e.setPosition(h + (A ? T * 32 : y));
      const [I, _] = Kn(e, n, {
        staticPosition: h
      });
      y += _, x.push(I);
    }
    return e.setPosition(i + 32), [x, 32];
  }
  if (Fr(n)) {
    const c = zt(e.readBytes(ya)), l = i + c, h = [];
    for (let m = 0; m < r; ++m) {
      e.setPosition(l + m * 32);
      const [A] = Kn(e, n, {
        staticPosition: l
      });
      h.push(A);
    }
    return e.setPosition(i + 32), [h, 32];
  }
  let o = 0;
  const u = [];
  for (let c = 0; c < r; ++c) {
    const [l, h] = Kn(e, n, {
      staticPosition: i + o
    });
    o += h, u.push(l);
  }
  return [u, o];
}
function Sx(e) {
  return [Px(e.readBytes(32), { size: 32 }), 32];
}
function Rx(e, n, { staticPosition: r }) {
  const [i, o] = n.type.split("bytes");
  if (!o) {
    const c = zt(e.readBytes(32));
    e.setPosition(r + c);
    const l = zt(e.readBytes(32));
    if (l === 0)
      return e.setPosition(r + 32), ["0x", 32];
    const h = e.readBytes(l);
    return e.setPosition(r + 32), [Me(h), 32];
  }
  return [Me(e.readBytes(Number.parseInt(o), 32)), 32];
}
function Dx(e, n) {
  const r = n.type.startsWith("int"), i = Number.parseInt(n.type.split("int")[1] || "256"), o = e.readBytes(32);
  return [
    i > 48 ? vx(o, { signed: r }) : zt(o, { signed: r }),
    32
  ];
}
function _x(e, n, { staticPosition: r }) {
  const i = n.components.length === 0 || n.components.some(({ name: c }) => !c), o = i ? [] : {};
  let u = 0;
  if (Fr(n)) {
    const c = zt(e.readBytes(ya)), l = r + c;
    for (let h = 0; h < n.components.length; ++h) {
      const m = n.components[h];
      e.setPosition(l + u);
      const [A, y] = Kn(e, m, {
        staticPosition: l
      });
      u += y, o[i ? h : m == null ? void 0 : m.name] = A;
    }
    return e.setPosition(r + 32), [o, 32];
  }
  for (let c = 0; c < n.components.length; ++c) {
    const l = n.components[c], [h, m] = Kn(e, l, {
      staticPosition: r
    });
    o[i ? c : l == null ? void 0 : l.name] = h, u += m;
  }
  return [o, u];
}
function Cx(e, { staticPosition: n }) {
  const r = zt(e.readBytes(32)), i = n + r;
  e.setPosition(i);
  const o = zt(e.readBytes(32));
  if (o === 0)
    return e.setPosition(n + 32), ["", 32];
  const u = e.readBytes(o, 32), c = Tx(ci(u));
  return e.setPosition(n + 32), [c, 32];
}
function Fr(e) {
  var i;
  const { type: n } = e;
  if (n === "string" || n === "bytes" || n.endsWith("[]"))
    return !0;
  if (n === "tuple")
    return (i = e.components) == null ? void 0 : i.some(Fr);
  const r = za(e.type);
  return !!(r && Fr({ ...e, type: r[1] }));
}
const Nx = (e) => Bn(fi(e));
function Ox(e) {
  return Nx(e);
}
const Mx = "1.0.8";
let lt = class ba extends Error {
  constructor(n, r = {}) {
    var c;
    const i = r.cause instanceof ba ? r.cause.details : (c = r.cause) != null && c.message ? r.cause.message : r.details, o = r.cause instanceof ba && r.cause.docsPath || r.docsPath, u = [
      n || "An error occurred.",
      "",
      ...r.metaMessages ? [...r.metaMessages, ""] : [],
      ...o ? [`Docs: https://abitype.dev${o}`] : [],
      ...i ? [`Details: ${i}`] : [],
      `Version: abitype@${Mx}`
    ].join(`
`);
    super(u), Object.defineProperty(this, "details", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docsPath", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "metaMessages", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "shortMessage", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "AbiTypeError"
    }), r.cause && (this.cause = r.cause), this.details = i, this.docsPath = o, this.metaMessages = r.metaMessages, this.shortMessage = n;
  }
};
function Kt(e, n) {
  const r = e.exec(n);
  return r == null ? void 0 : r.groups;
}
const Td = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, Id = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/, Bd = /^\(.+?\).*?$/, ll = /^tuple(?<array>(\[(\d*)\])*)$/;
function xa(e) {
  let n = e.type;
  if (ll.test(e.type) && "components" in e) {
    n = "(";
    const r = e.components.length;
    for (let o = 0; o < r; o++) {
      const u = e.components[o];
      n += xa(u), o < r - 1 && (n += ", ");
    }
    const i = Kt(ll, e.type);
    return n += `)${(i == null ? void 0 : i.array) ?? ""}`, xa({
      ...e,
      type: n
    });
  }
  return "indexed" in e && e.indexed && (n = `${n} indexed`), e.name ? `${n} ${e.name}` : n;
}
function _r(e) {
  let n = "";
  const r = e.length;
  for (let i = 0; i < r; i++) {
    const o = e[i];
    n += xa(o), i !== r - 1 && (n += ", ");
  }
  return n;
}
function Ux(e) {
  var n;
  return e.type === "function" ? `function ${e.name}(${_r(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${(n = e.outputs) != null && n.length ? ` returns (${_r(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${_r(e.inputs)})` : e.type === "error" ? `error ${e.name}(${_r(e.inputs)})` : e.type === "constructor" ? `constructor(${_r(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? `fallback() external${e.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
}
const Sd = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
function Fx(e) {
  return Sd.test(e);
}
function kx(e) {
  return Kt(Sd, e);
}
const Rd = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
function Lx(e) {
  return Rd.test(e);
}
function Gx(e) {
  return Kt(Rd, e);
}
const Dd = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
function Hx(e) {
  return Dd.test(e);
}
function Qx(e) {
  return Kt(Dd, e);
}
const _d = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
function Cd(e) {
  return _d.test(e);
}
function zx(e) {
  return Kt(_d, e);
}
const Nd = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
function Wx(e) {
  return Nd.test(e);
}
function $x(e) {
  return Kt(Nd, e);
}
const Od = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
function Vx(e) {
  return Od.test(e);
}
function qx(e) {
  return Kt(Od, e);
}
const Jx = /^receive\(\) external payable$/;
function Kx(e) {
  return Jx.test(e);
}
const Yx = /* @__PURE__ */ new Set(["indexed"]), Ea = /* @__PURE__ */ new Set([
  "calldata",
  "memory",
  "storage"
]);
class jx extends lt {
  constructor({ type: n }) {
    super("Unknown type.", {
      metaMessages: [
        `Type "${n}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`
      ]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "UnknownTypeError"
    });
  }
}
class Zx extends lt {
  constructor({ type: n }) {
    super("Unknown type.", {
      metaMessages: [`Type "${n}" is not a valid ABI type.`]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "UnknownSolidityTypeError"
    });
  }
}
class Xx extends lt {
  constructor({ param: n }) {
    super("Invalid ABI parameter.", {
      details: n
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidParameterError"
    });
  }
}
class eE extends lt {
  constructor({ param: n, name: r }) {
    super("Invalid ABI parameter.", {
      details: n,
      metaMessages: [
        `"${r}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`
      ]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "SolidityProtectedKeywordError"
    });
  }
}
class tE extends lt {
  constructor({ param: n, type: r, modifier: i }) {
    super("Invalid ABI parameter.", {
      details: n,
      metaMessages: [
        `Modifier "${i}" not allowed${r ? ` in "${r}" type` : ""}.`
      ]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidModifierError"
    });
  }
}
class nE extends lt {
  constructor({ param: n, type: r, modifier: i }) {
    super("Invalid ABI parameter.", {
      details: n,
      metaMessages: [
        `Modifier "${i}" not allowed${r ? ` in "${r}" type` : ""}.`,
        `Data location can only be specified for array, struct, or mapping types, but "${i}" was given.`
      ]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidFunctionModifierError"
    });
  }
}
class rE extends lt {
  constructor({ abiParameter: n }) {
    super("Invalid ABI parameter.", {
      details: JSON.stringify(n, null, 2),
      metaMessages: ["ABI parameter type is invalid."]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidAbiTypeParameterError"
    });
  }
}
class sr extends lt {
  constructor({ signature: n, type: r }) {
    super(`Invalid ${r} signature.`, {
      details: n
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidSignatureError"
    });
  }
}
class sE extends lt {
  constructor({ signature: n }) {
    super("Unknown signature.", {
      details: n
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "UnknownSignatureError"
    });
  }
}
class iE extends lt {
  constructor({ signature: n }) {
    super("Invalid struct signature.", {
      details: n,
      metaMessages: ["No properties exist."]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidStructSignatureError"
    });
  }
}
class oE extends lt {
  constructor({ type: n }) {
    super("Circular reference detected.", {
      metaMessages: [`Struct "${n}" is a circular reference.`]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "CircularReferenceError"
    });
  }
}
class aE extends lt {
  constructor({ current: n, depth: r }) {
    super("Unbalanced parentheses.", {
      metaMessages: [
        `"${n.trim()}" has too many ${r > 0 ? "opening" : "closing"} parentheses.`
      ],
      details: `Depth "${r}"`
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidParenthesisError"
    });
  }
}
function uE(e, n, r) {
  let i = "";
  if (r)
    for (const o of Object.entries(r)) {
      if (!o)
        continue;
      let u = "";
      for (const c of o[1])
        u += `[${c.type}${c.name ? `:${c.name}` : ""}]`;
      i += `(${o[0]}{${u}})`;
    }
  return n ? `${n}:${e}${i}` : e;
}
const jo = /* @__PURE__ */ new Map([
  // Unnamed
  ["address", { type: "address" }],
  ["bool", { type: "bool" }],
  ["bytes", { type: "bytes" }],
  ["bytes32", { type: "bytes32" }],
  ["int", { type: "int256" }],
  ["int256", { type: "int256" }],
  ["string", { type: "string" }],
  ["uint", { type: "uint256" }],
  ["uint8", { type: "uint8" }],
  ["uint16", { type: "uint16" }],
  ["uint24", { type: "uint24" }],
  ["uint32", { type: "uint32" }],
  ["uint64", { type: "uint64" }],
  ["uint96", { type: "uint96" }],
  ["uint112", { type: "uint112" }],
  ["uint160", { type: "uint160" }],
  ["uint192", { type: "uint192" }],
  ["uint256", { type: "uint256" }],
  // Named
  ["address owner", { type: "address", name: "owner" }],
  ["address to", { type: "address", name: "to" }],
  ["bool approved", { type: "bool", name: "approved" }],
  ["bytes _data", { type: "bytes", name: "_data" }],
  ["bytes data", { type: "bytes", name: "data" }],
  ["bytes signature", { type: "bytes", name: "signature" }],
  ["bytes32 hash", { type: "bytes32", name: "hash" }],
  ["bytes32 r", { type: "bytes32", name: "r" }],
  ["bytes32 root", { type: "bytes32", name: "root" }],
  ["bytes32 s", { type: "bytes32", name: "s" }],
  ["string name", { type: "string", name: "name" }],
  ["string symbol", { type: "string", name: "symbol" }],
  ["string tokenURI", { type: "string", name: "tokenURI" }],
  ["uint tokenId", { type: "uint256", name: "tokenId" }],
  ["uint8 v", { type: "uint8", name: "v" }],
  ["uint256 balance", { type: "uint256", name: "balance" }],
  ["uint256 tokenId", { type: "uint256", name: "tokenId" }],
  ["uint256 value", { type: "uint256", name: "value" }],
  // Indexed
  [
    "event:address indexed from",
    { type: "address", name: "from", indexed: !0 }
  ],
  ["event:address indexed to", { type: "address", name: "to", indexed: !0 }],
  [
    "event:uint indexed tokenId",
    { type: "uint256", name: "tokenId", indexed: !0 }
  ],
  [
    "event:uint256 indexed tokenId",
    { type: "uint256", name: "tokenId", indexed: !0 }
  ]
]);
function cE(e, n = {}) {
  if (Hx(e))
    return fE(e, n);
  if (Lx(e))
    return lE(e, n);
  if (Fx(e))
    return dE(e, n);
  if (Wx(e))
    return hE(e, n);
  if (Vx(e))
    return pE(e);
  if (Kx(e))
    return {
      type: "receive",
      stateMutability: "payable"
    };
  throw new sE({ signature: e });
}
function fE(e, n = {}) {
  const r = Qx(e);
  if (!r)
    throw new sr({ signature: e, type: "function" });
  const i = yt(r.parameters), o = [], u = i.length;
  for (let l = 0; l < u; l++)
    o.push(Sn(i[l], {
      modifiers: Ea,
      structs: n,
      type: "function"
    }));
  const c = [];
  if (r.returns) {
    const l = yt(r.returns), h = l.length;
    for (let m = 0; m < h; m++)
      c.push(Sn(l[m], {
        modifiers: Ea,
        structs: n,
        type: "function"
      }));
  }
  return {
    name: r.name,
    type: "function",
    stateMutability: r.stateMutability ?? "nonpayable",
    inputs: o,
    outputs: c
  };
}
function lE(e, n = {}) {
  const r = Gx(e);
  if (!r)
    throw new sr({ signature: e, type: "event" });
  const i = yt(r.parameters), o = [], u = i.length;
  for (let c = 0; c < u; c++)
    o.push(Sn(i[c], {
      modifiers: Yx,
      structs: n,
      type: "event"
    }));
  return { name: r.name, type: "event", inputs: o };
}
function dE(e, n = {}) {
  const r = kx(e);
  if (!r)
    throw new sr({ signature: e, type: "error" });
  const i = yt(r.parameters), o = [], u = i.length;
  for (let c = 0; c < u; c++)
    o.push(Sn(i[c], { structs: n, type: "error" }));
  return { name: r.name, type: "error", inputs: o };
}
function hE(e, n = {}) {
  const r = $x(e);
  if (!r)
    throw new sr({ signature: e, type: "constructor" });
  const i = yt(r.parameters), o = [], u = i.length;
  for (let c = 0; c < u; c++)
    o.push(Sn(i[c], { structs: n, type: "constructor" }));
  return {
    type: "constructor",
    stateMutability: r.stateMutability ?? "nonpayable",
    inputs: o
  };
}
function pE(e) {
  const n = qx(e);
  if (!n)
    throw new sr({ signature: e, type: "fallback" });
  return {
    type: "fallback",
    stateMutability: n.stateMutability ?? "nonpayable"
  };
}
const gE = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, mE = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, AE = /^u?int$/;
function Sn(e, n) {
  var y, x;
  const r = uE(e, n == null ? void 0 : n.type, n == null ? void 0 : n.structs);
  if (jo.has(r))
    return jo.get(r);
  const i = Bd.test(e), o = Kt(i ? mE : gE, e);
  if (!o)
    throw new Xx({ param: e });
  if (o.name && yE(o.name))
    throw new eE({ param: e, name: o.name });
  const u = o.name ? { name: o.name } : {}, c = o.modifier === "indexed" ? { indexed: !0 } : {}, l = (n == null ? void 0 : n.structs) ?? {};
  let h, m = {};
  if (i) {
    h = "tuple";
    const T = yt(o.type), I = [], _ = T.length;
    for (let N = 0; N < _; N++)
      I.push(Sn(T[N], { structs: l }));
    m = { components: I };
  } else if (o.type in l)
    h = "tuple", m = { components: l[o.type] };
  else if (AE.test(o.type))
    h = `${o.type}256`;
  else if (h = o.type, (n == null ? void 0 : n.type) !== "struct" && !Md(h))
    throw new Zx({ type: h });
  if (o.modifier) {
    if (!((x = (y = n == null ? void 0 : n.modifiers) == null ? void 0 : y.has) != null && x.call(y, o.modifier)))
      throw new tE({
        param: e,
        type: n == null ? void 0 : n.type,
        modifier: o.modifier
      });
    if (Ea.has(o.modifier) && !bE(h, !!o.array))
      throw new nE({
        param: e,
        type: n == null ? void 0 : n.type,
        modifier: o.modifier
      });
  }
  const A = {
    type: `${h}${o.array ?? ""}`,
    ...u,
    ...c,
    ...m
  };
  return jo.set(r, A), A;
}
function yt(e, n = [], r = "", i = 0) {
  const o = e.trim().length;
  for (let u = 0; u < o; u++) {
    const c = e[u], l = e.slice(u + 1);
    switch (c) {
      case ",":
        return i === 0 ? yt(l, [...n, r.trim()]) : yt(l, n, `${r}${c}`, i);
      case "(":
        return yt(l, n, `${r}${c}`, i + 1);
      case ")":
        return yt(l, n, `${r}${c}`, i - 1);
      default:
        return yt(l, n, `${r}${c}`, i);
    }
  }
  if (r === "")
    return n;
  if (i !== 0)
    throw new aE({ current: r, depth: i });
  return n.push(r.trim()), n;
}
function Md(e) {
  return e === "address" || e === "bool" || e === "function" || e === "string" || Td.test(e) || Id.test(e);
}
const wE = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
function yE(e) {
  return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || Td.test(e) || Id.test(e) || wE.test(e);
}
function bE(e, n) {
  return n || e === "bytes" || e === "string" || e === "tuple";
}
function xE(e) {
  const n = {}, r = e.length;
  for (let c = 0; c < r; c++) {
    const l = e[c];
    if (!Cd(l))
      continue;
    const h = zx(l);
    if (!h)
      throw new sr({ signature: l, type: "struct" });
    const m = h.properties.split(";"), A = [], y = m.length;
    for (let x = 0; x < y; x++) {
      const I = m[x].trim();
      if (!I)
        continue;
      const _ = Sn(I, {
        type: "struct"
      });
      A.push(_);
    }
    if (!A.length)
      throw new iE({ signature: l });
    n[h.name] = A;
  }
  const i = {}, o = Object.entries(n), u = o.length;
  for (let c = 0; c < u; c++) {
    const [l, h] = o[c];
    i[l] = Ud(h, n);
  }
  return i;
}
const EE = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
function Ud(e, n, r = /* @__PURE__ */ new Set()) {
  const i = [], o = e.length;
  for (let u = 0; u < o; u++) {
    const c = e[u];
    if (Bd.test(c.type))
      i.push(c);
    else {
      const h = Kt(EE, c.type);
      if (!(h != null && h.type))
        throw new rE({ abiParameter: c });
      const { array: m, type: A } = h;
      if (A in n) {
        if (r.has(A))
          throw new oE({ type: A });
        i.push({
          ...c,
          type: `tuple${m ?? ""}`,
          components: Ud(n[A] ?? [], n, /* @__PURE__ */ new Set([...r, A]))
        });
      } else if (Md(A))
        i.push(c);
      else
        throw new jx({ type: A });
    }
  }
  return i;
}
function Fd(e) {
  const n = xE(e), r = [], i = e.length;
  for (let o = 0; o < i; o++) {
    const u = e[o];
    Cd(u) || r.push(cE(u, n));
  }
  return r;
}
function vE(e) {
  let n = !0, r = "", i = 0, o = "", u = !1;
  for (let c = 0; c < e.length; c++) {
    const l = e[c];
    if (["(", ")", ","].includes(l) && (n = !0), l === "(" && i++, l === ")" && i--, !!n) {
      if (i === 0) {
        if (l === " " && ["event", "function", ""].includes(o))
          o = "";
        else if (o += l, l === ")") {
          u = !0;
          break;
        }
        continue;
      }
      if (l === " ") {
        e[c - 1] !== "," && r !== "," && r !== ",(" && (r = "", n = !1);
        continue;
      }
      o += l, r += l;
    }
  }
  if (!u)
    throw new O("Unable to normalize signature.");
  return o;
}
const PE = (e) => {
  const n = typeof e == "string" ? e : Ux(e);
  return vE(n);
};
function kd(e) {
  return Ox(PE(e));
}
const TE = kd, qr = (e) => Zn(kd(e), 0, 4);
function Jr(e) {
  const { abi: n, args: r = [], name: i } = e, o = Wt(i, { strict: !1 }), u = n.filter((l) => o ? l.type === "function" ? qr(l) === i : l.type === "event" ? TE(l) === i : !1 : "name" in l && l.name === i);
  if (u.length === 0)
    return;
  if (u.length === 1)
    return u[0];
  let c;
  for (const l of u) {
    if (!("inputs" in l))
      continue;
    if (!r || r.length === 0) {
      if (!l.inputs || l.inputs.length === 0)
        return l;
      continue;
    }
    if (!l.inputs || l.inputs.length === 0 || l.inputs.length !== r.length)
      continue;
    if (r.every((m, A) => {
      const y = "inputs" in l && l.inputs[A];
      return y ? va(m, y) : !1;
    })) {
      if (c && "inputs" in c && c.inputs) {
        const m = Ld(l.inputs, c.inputs, r);
        if (m)
          throw new Lb({
            abiItem: l,
            type: m[0]
          }, {
            abiItem: c,
            type: m[1]
          });
      }
      c = l;
    }
  }
  return c || u[0];
}
function va(e, n) {
  const r = typeof e, i = n.type;
  switch (i) {
    case "address":
      return dn(e, { strict: !1 });
    case "bool":
      return r === "boolean";
    case "function":
      return r === "string";
    case "string":
      return r === "string";
    default:
      return i === "tuple" && "components" in n ? Object.values(n.components).every((o, u) => va(Object.values(e)[u], o)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(i) ? r === "number" || r === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(i) ? r === "string" || e instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(i) ? Array.isArray(e) && e.every((o) => va(o, {
        ...n,
        // Pop off `[]` or `[M]` from end of type
        type: i.replace(/(\[[0-9]{0,}\])$/, "")
      })) : !1;
  }
}
function Ld(e, n, r) {
  for (const i in e) {
    const o = e[i], u = n[i];
    if (o.type === "tuple" && u.type === "tuple" && "components" in o && "components" in u)
      return Ld(o.components, u.components, r[i]);
    const c = [o.type, u.type];
    if (c.includes("address") && c.includes("bytes20") ? !0 : c.includes("address") && c.includes("string") ? dn(r[i], { strict: !1 }) : c.includes("address") && c.includes("bytes") ? dn(r[i], { strict: !1 }) : !1)
      return c;
  }
}
const Zo = "/docs/contract/decodeFunctionResult";
function wi(e) {
  const { abi: n, args: r, functionName: i, data: o } = e;
  let u = n[0];
  if (i) {
    const l = Jr({ abi: n, args: r, name: i });
    if (!l)
      throw new jn(i, { docsPath: Zo });
    u = l;
  }
  if (u.type !== "function")
    throw new jn(void 0, { docsPath: Zo });
  if (!u.outputs)
    throw new Ql(u.name, { docsPath: Zo });
  const c = Za(u.outputs, o);
  if (c && c.length > 1)
    return c;
  if (c && c.length === 1)
    return c[0];
}
const dl = "/docs/contract/encodeFunctionData";
function IE(e) {
  const { abi: n, args: r, functionName: i } = e;
  let o = n[0];
  if (i) {
    const u = Jr({
      abi: n,
      args: r,
      name: i
    });
    if (!u)
      throw new jn(i, { docsPath: dl });
    o = u;
  }
  if (o.type !== "function")
    throw new jn(void 0, { docsPath: dl });
  return {
    abi: [o],
    functionName: qr(ln(o))
  };
}
function Kr(e) {
  const { args: n } = e, { abi: r, functionName: i } = (() => {
    var l;
    return e.abi.length === 1 && ((l = e.functionName) != null && l.startsWith("0x")) ? e : IE(e);
  })(), o = r[0], u = i, c = "inputs" in o && o.inputs ? pi(o.inputs, n ?? []) : void 0;
  return $r([u, c ?? "0x"]);
}
function Xa({ blockNumber: e, chain: n, contract: r }) {
  var o;
  const i = (o = n == null ? void 0 : n.contracts) == null ? void 0 : o[r];
  if (!i)
    throw new ua({
      chain: n,
      contract: { name: r }
    });
  if (e && i.blockCreated && i.blockCreated > e)
    throw new ua({
      blockNumber: e,
      chain: n,
      contract: {
        name: r,
        blockCreated: i.blockCreated
      }
    });
  return i.address;
}
const BE = {
  1: "An `assert` condition failed.",
  17: "Arithmetic operation resulted in underflow or overflow.",
  18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
  33: "Attempted to convert to an invalid type.",
  34: "Attempted to access a storage byte array that is incorrectly encoded.",
  49: "Performed `.pop()` on an empty array",
  50: "Array index is out of bounds.",
  65: "Allocated too much memory or created an array which is too large.",
  81: "Attempted to call a zero-initialized variable of internal function type."
}, Gd = {
  inputs: [
    {
      name: "message",
      type: "string"
    }
  ],
  name: "Error",
  type: "error"
}, SE = {
  inputs: [
    {
      name: "reason",
      type: "uint256"
    }
  ],
  name: "Panic",
  type: "error"
};
function RE(e) {
  const { abi: n, data: r } = e, i = Zn(r, 0, 4);
  if (i === "0x")
    throw new li();
  const u = [...n || [], Gd, SE].find((c) => c.type === "error" && i === qr(ln(c)));
  if (!u)
    throw new Hl(i, {
      docsPath: "/docs/contract/decodeErrorResult"
    });
  return {
    abiItem: u,
    args: "inputs" in u && u.inputs && u.inputs.length > 0 ? Za(u.inputs, Zn(r, 4)) : void 0,
    errorName: u.name
  };
}
function Hd({ abiItem: e, args: n, includeFunctionName: r = !0, includeName: i = !1 }) {
  if ("name" in e && "inputs" in e && e.inputs)
    return `${r ? e.name : ""}(${e.inputs.map((o, u) => `${i && o.name ? `${o.name}: ` : ""}${typeof n[u] == "object" ? Vt(n[u]) : n[u]}`).join(", ")})`;
}
class DE extends O {
  constructor(n, { account: r, docsPath: i, chain: o, data: u, gas: c, gasPrice: l, maxFeePerGas: h, maxPriorityFeePerGas: m, nonce: A, to: y, value: x, stateOverride: T }) {
    var N;
    const I = r ? Jt(r) : void 0;
    let _ = Vr({
      from: I == null ? void 0 : I.address,
      to: y,
      value: typeof x < "u" && `${Va(x)} ${((N = o == null ? void 0 : o.nativeCurrency) == null ? void 0 : N.symbol) || "ETH"}`,
      data: u,
      gas: c,
      gasPrice: typeof l < "u" && `${Ye(l)} gwei`,
      maxFeePerGas: typeof h < "u" && `${Ye(h)} gwei`,
      maxPriorityFeePerGas: typeof m < "u" && `${Ye(m)} gwei`,
      nonce: A
    });
    T && (_ += `
${nx(T)}`), super(n.shortMessage, {
      cause: n,
      docsPath: i,
      metaMessages: [
        ...n.metaMessages ? [...n.metaMessages, " "] : [],
        "Raw Call Arguments:",
        _
      ].filter(Boolean),
      name: "CallExecutionError"
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.cause = n;
  }
}
class _E extends O {
  constructor(n, { abi: r, args: i, contractAddress: o, docsPath: u, functionName: c, sender: l }) {
    const h = Jr({ abi: r, args: i, name: c }), m = h ? Hd({
      abiItem: h,
      args: i,
      includeFunctionName: !1,
      includeName: !1
    }) : void 0, A = h ? ln(h, { includeName: !0 }) : void 0, y = Vr({
      address: o && H1(o),
      function: A,
      args: m && m !== "()" && `${[...Array((c == null ? void 0 : c.length) ?? 0).keys()].map(() => " ").join("")}${m}`,
      sender: l
    });
    super(n.shortMessage || `An unknown error occurred while executing the contract function "${c}".`, {
      cause: n,
      docsPath: u,
      metaMessages: [
        ...n.metaMessages ? [...n.metaMessages, " "] : [],
        y && "Contract Call:",
        y
      ].filter(Boolean),
      name: "ContractFunctionExecutionError"
    }), Object.defineProperty(this, "abi", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "args", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "contractAddress", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "formattedArgs", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "functionName", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "sender", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.abi = r, this.args = i, this.cause = n, this.contractAddress = o, this.functionName = c, this.sender = l;
  }
}
class Pa extends O {
  constructor({ abi: n, data: r, functionName: i, message: o }) {
    let u, c, l, h;
    if (r && r !== "0x")
      try {
        c = RE({ abi: n, data: r });
        const { abiItem: A, errorName: y, args: x } = c;
        if (y === "Error")
          h = x[0];
        else if (y === "Panic") {
          const [T] = x;
          h = BE[T];
        } else {
          const T = A ? ln(A, { includeName: !0 }) : void 0, I = A && x ? Hd({
            abiItem: A,
            args: x,
            includeFunctionName: !1,
            includeName: !1
          }) : void 0;
          l = [
            T ? `Error: ${T}` : "",
            I && I !== "()" ? `       ${[...Array((y == null ? void 0 : y.length) ?? 0).keys()].map(() => " ").join("")}${I}` : ""
          ];
        }
      } catch (A) {
        u = A;
      }
    else o && (h = o);
    let m;
    u instanceof Hl && (m = u.signature, l = [
      `Unable to decode signature "${m}" as it was not found on the provided ABI.`,
      "Make sure you are using the correct ABI and that the error exists on it.",
      `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${m}.`
    ]), super(h && h !== "execution reverted" || m ? [
      `The contract function "${i}" reverted with the following ${m ? "signature" : "reason"}:`,
      h || m
    ].join(`
`) : `The contract function "${i}" reverted.`, {
      cause: u,
      metaMessages: l,
      name: "ContractFunctionRevertedError"
    }), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "raw", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "reason", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "signature", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.data = c, this.raw = r, this.reason = h, this.signature = m;
  }
}
class CE extends O {
  constructor({ functionName: n }) {
    super(`The contract function "${n}" returned no data ("0x").`, {
      metaMessages: [
        "This could be due to any of the following:",
        `  - The contract does not have the function "${n}",`,
        "  - The parameters passed to the contract function may be invalid, or",
        "  - The address is not a contract."
      ],
      name: "ContractFunctionZeroDataError"
    });
  }
}
class NE extends O {
  constructor({ factory: n }) {
    super(`Deployment for counterfactual contract call failed${n ? ` for factory "${n}".` : ""}`, {
      metaMessages: [
        "Please ensure:",
        "- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).",
        "- The `factoryData` is a valid encoded function call for contract deployment function on the factory."
      ],
      name: "CounterfactualDeploymentFailedError"
    });
  }
}
class eu extends O {
  constructor({ data: n, message: r }) {
    super(r || "", { name: "RawContractError" }), Object.defineProperty(this, "code", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: 3
    }), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.data = n;
  }
}
function OE(e, n) {
  var i, o, u, c, l, h;
  if (!(e instanceof O))
    return !1;
  const r = e.walk((m) => m instanceof Pa);
  return r instanceof Pa ? !!(((i = r.data) == null ? void 0 : i.errorName) === "ResolverNotFound" || ((o = r.data) == null ? void 0 : o.errorName) === "ResolverWildcardNotSupported" || ((u = r.data) == null ? void 0 : u.errorName) === "ResolverNotContract" || ((c = r.data) == null ? void 0 : c.errorName) === "ResolverError" || ((l = r.data) == null ? void 0 : l.errorName) === "HttpError" || (h = r.reason) != null && h.includes("Wildcard on non-extended resolvers is not supported")) : !1;
}
function ME(e) {
  const { abi: n, data: r } = e, i = Zn(r, 0, 4), o = n.find((u) => u.type === "function" && i === qr(ln(u)));
  if (!o)
    throw new kb(i, {
      docsPath: "/docs/contract/decodeFunctionData"
    });
  return {
    functionName: o.name,
    args: "inputs" in o && o.inputs && o.inputs.length > 0 ? Za(o.inputs, Zn(r, 4)) : void 0
  };
}
const Xo = "/docs/contract/encodeErrorResult";
function hl(e) {
  const { abi: n, errorName: r, args: i } = e;
  let o = n[0];
  if (r) {
    const h = Jr({ abi: n, args: i, name: r });
    if (!h)
      throw new Kf(r, { docsPath: Xo });
    o = h;
  }
  if (o.type !== "error")
    throw new Kf(void 0, { docsPath: Xo });
  const u = ln(o), c = qr(u);
  let l = "0x";
  if (i && i.length > 0) {
    if (!o.inputs)
      throw new Fb(o.name, { docsPath: Xo });
    l = pi(o.inputs, i);
  }
  return $r([c, l]);
}
const ea = "/docs/contract/encodeFunctionResult";
function UE(e) {
  const { abi: n, functionName: r, result: i } = e;
  let o = n[0];
  if (r) {
    const c = Jr({ abi: n, name: r });
    if (!c)
      throw new jn(r, { docsPath: ea });
    o = c;
  }
  if (o.type !== "function")
    throw new jn(void 0, { docsPath: ea });
  if (!o.outputs)
    throw new Ql(o.name, { docsPath: ea });
  const u = (() => {
    if (o.outputs.length === 0)
      return [];
    if (o.outputs.length === 1)
      return [i];
    if (Array.isArray(i))
      return i;
    throw new zl(i);
  })();
  return pi(o.outputs, u);
}
const FE = "x-batch-gateway:true";
async function A2(e) {
  const { data: n, ccipRequest: r } = e, { args: [i] } = ME({ abi: wa, data: n }), o = [], u = [];
  return await Promise.all(i.map(async (c, l) => {
    try {
      u[l] = await r(c), o[l] = !1;
    } catch (h) {
      o[l] = !0, u[l] = kE(h);
    }
  })), UE({
    abi: wa,
    functionName: "query",
    result: [o, u]
  });
}
function kE(e) {
  return e.name === "HttpRequestError" && e.status ? hl({
    abi: wa,
    errorName: "HttpError",
    args: [e.status, e.shortMessage]
  }) : hl({
    abi: [Gd],
    errorName: "Error",
    args: ["shortMessage" in e ? e.shortMessage : e.message]
  });
}
function Qd(e) {
  if (e.length !== 66 || e.indexOf("[") !== 0 || e.indexOf("]") !== 65)
    return null;
  const n = `0x${e.slice(1, 65)}`;
  return Wt(n) ? n : null;
}
function ta(e) {
  let n = new Uint8Array(32).fill(0);
  if (!e)
    return Me(n);
  const r = e.split(".");
  for (let i = r.length - 1; i >= 0; i -= 1) {
    const o = Qd(r[i]), u = o ? fi(o) : Bn(Pn(r[i]), "bytes");
    n = Bn(In([n, u]), "bytes");
  }
  return Me(n);
}
function LE(e) {
  return `[${e.slice(2)}]`;
}
function GE(e) {
  const n = new Uint8Array(32).fill(0);
  return e ? Qd(e) || Bn(Pn(e)) : Me(n);
}
function HE(e) {
  const n = e.replace(/^\.|\.$/gm, "");
  if (n.length === 0)
    return new Uint8Array(1);
  const r = new Uint8Array(Pn(n).byteLength + 2);
  let i = 0;
  const o = n.split(".");
  for (let u = 0; u < o.length; u++) {
    let c = Pn(o[u]);
    c.byteLength > 255 && (c = Pn(LE(GE(o[u])))), r[i] = c.length, r.set(c, i + 1), i += c.length + 1;
  }
  return r.byteLength !== i + 1 ? r.slice(0, i + 1) : r;
}
const QE = 3;
function Ta(e, { abi: n, address: r, args: i, docsPath: o, functionName: u, sender: c }) {
  const l = e instanceof eu ? e : e instanceof O ? e.walk((I) => "data" in I) || e.walk() : {}, { code: h, data: m, details: A, message: y, shortMessage: x } = l, T = e instanceof li ? new CE({ functionName: u }) : [QE, mi.code].includes(h) && (m || A || y || x) ? new Pa({
    abi: n,
    data: typeof m == "object" ? m.data : m,
    functionName: u,
    message: l instanceof cd ? A : x ?? y
  }) : e;
  return new _E(T, {
    abi: n,
    args: i,
    contractAddress: r,
    docsPath: o,
    functionName: u,
    sender: c
  });
}
const zE = "0.1.1";
function WE() {
  return zE;
}
let zd = class Ia extends Error {
  constructor(n, r = {}) {
    const i = (() => {
      var h;
      if (r.cause instanceof Ia) {
        if (r.cause.details)
          return r.cause.details;
        if (r.cause.shortMessage)
          return r.cause.shortMessage;
      }
      return (h = r.cause) != null && h.message ? r.cause.message : r.details;
    })(), o = r.cause instanceof Ia && r.cause.docsPath || r.docsPath, c = `https://oxlib.sh${o ?? ""}`, l = [
      n || "An error occurred.",
      ...r.metaMessages ? ["", ...r.metaMessages] : [],
      ...i || o ? [
        "",
        i ? `Details: ${i}` : void 0,
        o ? `See: ${c}` : void 0
      ] : []
    ].filter((h) => typeof h == "string").join(`
`);
    super(l, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docs", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docsPath", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "shortMessage", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "BaseError"
    }), Object.defineProperty(this, "version", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: `ox@${WE()}`
    }), this.cause = r.cause, this.details = i, this.docs = c, this.docsPath = o, this.shortMessage = n;
  }
  walk(n) {
    return Wd(this, n);
  }
};
function Wd(e, n) {
  return n != null && n(e) ? e : e && typeof e == "object" && "cause" in e && e.cause ? Wd(e.cause, n) : n ? null : e;
}
function $E(e, n = {}) {
  const { dir: r, size: i = 32 } = n;
  if (i === 0)
    return e;
  const o = e.replace("0x", "");
  if (o.length > i * 2)
    throw new JE({
      size: Math.ceil(o.length / 2),
      targetSize: i,
      type: "Hex"
    });
  return `0x${o[r === "right" ? "padEnd" : "padStart"](i * 2, "0")}`;
}
function Ht(e, n = {}) {
  const { signed: r, size: i } = n, o = BigInt(e);
  let u;
  i ? r ? u = (1n << BigInt(i) * 8n - 1n) - 1n : u = 2n ** (BigInt(i) * 8n) - 1n : typeof e == "number" && (u = BigInt(Number.MAX_SAFE_INTEGER));
  const c = typeof u == "bigint" && r ? -u - 1n : 0;
  if (u && o > u || o < c) {
    const m = typeof e == "bigint" ? "n" : "";
    throw new qE({
      max: u ? `${u}${m}` : void 0,
      min: `${c}${m}`,
      signed: r,
      size: i,
      value: `${e}${m}`
    });
  }
  const h = `0x${(r && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
  return i ? VE(h, i) : h;
}
function VE(e, n) {
  return $E(e, { dir: "left", size: n });
}
class qE extends zd {
  constructor({ max: n, min: r, signed: i, size: o, value: u }) {
    super(`Number \`${u}\` is not in safe${o ? ` ${o * 8}-bit` : ""}${i ? " signed" : " unsigned"} integer range ${n ? `(\`${r}\` to \`${n}\`)` : `(above \`${r}\`)`}`), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "Hex.IntegerOutOfRangeError"
    });
  }
}
class JE extends zd {
  constructor({ size: n, targetSize: r, type: i }) {
    super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (\`${n}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "Hex.SizeExceedsPaddingSizeError"
    });
  }
}
function KE(e) {
  return {
    address: e.address,
    amount: Ht(e.amount),
    index: Ht(e.index),
    validatorIndex: Ht(e.validatorIndex)
  };
}
function YE(e) {
  return {
    ...typeof e.baseFeePerGas == "bigint" && {
      baseFeePerGas: Ht(e.baseFeePerGas)
    },
    ...typeof e.blobBaseFee == "bigint" && {
      blobBaseFee: Ht(e.blobBaseFee)
    },
    ...typeof e.feeRecipient == "string" && {
      feeRecipient: e.feeRecipient
    },
    ...typeof e.gasLimit == "bigint" && {
      gasLimit: Ht(e.gasLimit)
    },
    ...typeof e.number == "bigint" && {
      number: Ht(e.number)
    },
    ...typeof e.prevRandao == "bigint" && {
      prevRandao: Ht(e.prevRandao)
    },
    ...typeof e.time == "bigint" && {
      time: Ht(e.time)
    },
    ...e.withdrawals && {
      withdrawals: e.withdrawals.map(KE)
    }
  };
}
const jE = "0x82ad56cb", ZE = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe", XE = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";
function ev(e, { docsPath: n, ...r }) {
  const i = (() => {
    const o = qa(e, r);
    return o instanceof gi ? e : o;
  })();
  return new DE(i, {
    docsPath: n,
    ...r
  });
}
function tu() {
  let e = () => {
  }, n = () => {
  };
  return { promise: new Promise((i, o) => {
    e = i, n = o;
  }), resolve: e, reject: n };
}
const na = /* @__PURE__ */ new Map();
function tv({ fn: e, id: n, shouldSplitBatch: r, wait: i = 0, sort: o }) {
  const u = async () => {
    const A = h();
    c();
    const y = A.map(({ args: x }) => x);
    y.length !== 0 && e(y).then((x) => {
      o && Array.isArray(x) && x.sort(o);
      for (let T = 0; T < A.length; T++) {
        const { resolve: I } = A[T];
        I == null || I([x[T], x]);
      }
    }).catch((x) => {
      for (let T = 0; T < A.length; T++) {
        const { reject: I } = A[T];
        I == null || I(x);
      }
    });
  }, c = () => na.delete(n), l = () => h().map(({ args: A }) => A), h = () => na.get(n) || [], m = (A) => na.set(n, [...h(), A]);
  return {
    flush: c,
    async schedule(A) {
      const { promise: y, resolve: x, reject: T } = tu();
      return (r == null ? void 0 : r([...l(), A])) && u(), h().length > 0 ? (m({ args: A, resolve: x, reject: T }), y) : (m({ args: A, resolve: x, reject: T }), setTimeout(u, i), y);
    }
  };
}
async function nv(e, n) {
  var ce, me, Pe, We;
  const { account: r = e.account, batch: i = !!((ce = e.batch) != null && ce.multicall), blockNumber: o, blockTag: u = "latest", accessList: c, blobs: l, blockOverrides: h, code: m, data: A, factory: y, factoryData: x, gas: T, gasPrice: I, maxFeePerBlobGas: _, maxFeePerGas: N, maxPriorityFeePerGas: S, nonce: M, to: G, value: ee, stateOverride: H, ...Q } = n, F = r ? Jt(r) : void 0;
  if (m && (y || x))
    throw new O("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
  if (m && G)
    throw new O("Cannot provide both `code` & `to` as parameters.");
  const ie = m && A, K = y && x && G && A, pe = ie || K, Y = ie ? iv({
    code: m,
    data: A
  }) : K ? ov({
    data: A,
    factory: y,
    factoryData: x,
    to: G
  }) : A;
  try {
    Ai(n);
    const be = (typeof o == "bigint" ? X(o) : void 0) || u, Ee = h ? YE(h) : void 0, Ue = gd(H), Rt = (We = (Pe = (me = e.chain) == null ? void 0 : me.formatters) == null ? void 0 : Pe.transactionRequest) == null ? void 0 : We.format, or = (Rt || Ka)({
      // Pick out extra data that might exist on the chain's transaction request type.
      ...Ja(Q, { format: Rt }),
      from: F == null ? void 0 : F.address,
      accessList: c,
      blobs: l,
      data: Y,
      gas: T,
      gasPrice: I,
      maxFeePerBlobGas: _,
      maxFeePerGas: N,
      maxPriorityFeePerGas: S,
      nonce: M,
      to: pe ? void 0 : G,
      value: ee
    });
    if (i && rv({ request: or }) && !Ue && !Ee)
      try {
        return await sv(e, {
          ...or,
          blockNumber: o,
          blockTag: u
        });
      } catch (Ge) {
        if (!(Ge instanceof sd) && !(Ge instanceof ua))
          throw Ge;
      }
    const Ei = (() => {
      const Ge = [
        or,
        be
      ];
      return Ue && Ee ? [...Ge, Ue, Ee] : Ue ? [...Ge, Ue] : Ee ? [...Ge, {}, Ee] : Ge;
    })(), jr = await e.request({
      method: "eth_call",
      params: Ei
    });
    return jr === "0x" ? { data: void 0 } : { data: jr };
  } catch ($e) {
    const be = av($e), { offchainLookup: Ee, offchainLookupSignature: Ue } = await import("./ccip-DY28DGvc.js");
    if (e.ccipRead !== !1 && (be == null ? void 0 : be.slice(0, 10)) === Ue && G)
      return { data: await Ee(e, { data: be, to: G }) };
    throw pe && (be == null ? void 0 : be.slice(0, 10)) === "0x101bb98d" ? new NE({ factory: y }) : ev($e, {
      ...n,
      account: F,
      chain: e.chain
    });
  }
}
function rv({ request: e }) {
  const { data: n, to: r, ...i } = e;
  return !(!n || n.startsWith(jE) || !r || Object.values(i).filter((o) => typeof o < "u").length > 0);
}
async function sv(e, n) {
  var _;
  const { batchSize: r = 1024, wait: i = 0 } = typeof ((_ = e.batch) == null ? void 0 : _.multicall) == "object" ? e.batch.multicall : {}, { blockNumber: o, blockTag: u = "latest", data: c, multicallAddress: l, to: h } = n;
  let m = l;
  if (!m) {
    if (!e.chain)
      throw new sd();
    m = Xa({
      blockNumber: o,
      chain: e.chain,
      contract: "multicall3"
    });
  }
  const y = (typeof o == "bigint" ? X(o) : void 0) || u, { schedule: x } = tv({
    id: `${e.uid}.${y}`,
    wait: i,
    shouldSplitBatch(N) {
      return N.reduce((M, { data: G }) => M + (G.length - 2), 0) > r * 2;
    },
    fn: async (N) => {
      const S = N.map((ee) => ({
        allowFailure: !0,
        callData: ee.data,
        target: ee.to
      })), M = Kr({
        abi: Aa,
        args: [S],
        functionName: "aggregate3"
      }), G = await e.request({
        method: "eth_call",
        params: [
          {
            data: M,
            to: m
          },
          y
        ]
      });
      return wi({
        abi: Aa,
        args: [S],
        functionName: "aggregate3",
        data: G || "0x"
      });
    }
  }), [{ returnData: T, success: I }] = await x({ data: c, to: h });
  if (!I)
    throw new eu({ data: T });
  return T === "0x" ? { data: void 0 } : { data: T };
}
function iv(e) {
  const { code: n, data: r } = e;
  return ed({
    abi: Fd(["constructor(bytes, bytes)"]),
    bytecode: ZE,
    args: [n, r]
  });
}
function ov(e) {
  const { data: n, factory: r, factoryData: i, to: o } = e;
  return ed({
    abi: Fd(["constructor(address, bytes, address, bytes)"]),
    bytecode: XE,
    args: [o, n, r, i]
  });
}
function av(e) {
  var r;
  if (!(e instanceof O))
    return;
  const n = e.walk();
  return typeof (n == null ? void 0 : n.data) == "object" ? (r = n.data) == null ? void 0 : r.data : n.data;
}
async function ir(e, n) {
  const { abi: r, address: i, args: o, functionName: u, ...c } = n, l = Kr({
    abi: r,
    args: o,
    functionName: u
  });
  try {
    const { data: h } = await ae(e, nv, "call")({
      ...c,
      data: l,
      to: i
    });
    return wi({
      abi: r,
      args: o,
      functionName: u,
      data: h || "0x"
    });
  } catch (h) {
    throw Ta(h, {
      abi: r,
      address: i,
      args: o,
      docsPath: "/docs/contract/readContract",
      functionName: u
    });
  }
}
async function uv(e, n) {
  const { blockNumber: r, blockTag: i, coinType: o, name: u, gatewayUrls: c, strict: l } = n, { chain: h } = e, m = (() => {
    if (n.universalResolverAddress)
      return n.universalResolverAddress;
    if (!h)
      throw new Error("client chain not configured. universalResolverAddress is required.");
    return Xa({
      blockNumber: r,
      chain: h,
      contract: "ensUniversalResolver"
    });
  })(), A = h == null ? void 0 : h.ensTlds;
  if (A && !A.some((y) => u.endsWith(y)))
    return null;
  try {
    const y = Kr({
      abi: cl,
      functionName: "addr",
      ...o != null ? { args: [ta(u), BigInt(o)] } : { args: [ta(u)] }
    }), x = {
      address: m,
      abi: Ex,
      functionName: "resolve",
      args: [
        js(HE(u)),
        y,
        c ?? [FE]
      ],
      blockNumber: r,
      blockTag: i
    }, I = await ae(e, ir, "readContract")(x);
    if (I[0] === "0x")
      return null;
    const _ = wi({
      abi: cl,
      args: o != null ? [ta(u), BigInt(o)] : void 0,
      functionName: "addr",
      data: I[0]
    });
    return _ === "0x" || ci(_) === "0x00" ? null : _;
  } catch (y) {
    if (l)
      throw y;
    if (OE(y))
      return null;
    throw y;
  }
}
const cv = /* @__PURE__ */ new Map(), fv = /* @__PURE__ */ new Map();
function lv(e) {
  const n = (o, u) => ({
    clear: () => u.delete(o),
    get: () => u.get(o),
    set: (c) => u.set(o, c)
  }), r = n(e, cv), i = n(e, fv);
  return {
    clear: () => {
      r.clear(), i.clear();
    },
    promise: r,
    response: i
  };
}
async function dv(e, { cacheKey: n, cacheTime: r = Number.POSITIVE_INFINITY }) {
  const i = lv(n), o = i.response.get();
  if (o && r > 0 && (/* @__PURE__ */ new Date()).getTime() - o.created.getTime() < r)
    return o.data;
  let u = i.promise.get();
  u || (u = e(), i.promise.set(u));
  try {
    const c = await u;
    return i.response.set({ created: /* @__PURE__ */ new Date(), data: c }), c;
  } finally {
    i.promise.clear();
  }
}
const hv = (e) => `blockNumber.${e}`;
async function nu(e, { cacheTime: n = e.cacheTime } = {}) {
  const r = await dv(() => e.request({
    method: "eth_blockNumber"
  }), { cacheKey: hv(e.uid), cacheTime: n });
  return BigInt(r);
}
function pv(e, { args: n, eventName: r } = {}) {
  return {
    ...e,
    blockHash: e.blockHash ? e.blockHash : null,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    logIndex: e.logIndex ? Number(e.logIndex) : null,
    transactionHash: e.transactionHash ? e.transactionHash : null,
    transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
    ...r ? { args: n, eventName: r } : {}
  };
}
async function gv(e, { blockHash: n, blockNumber: r, blockTag: i, hash: o, index: u }) {
  var A, y, x;
  const c = i || "latest", l = r !== void 0 ? X(r) : void 0;
  let h = null;
  if (o ? h = await e.request({
    method: "eth_getTransactionByHash",
    params: [o]
  }, { dedupe: !0 }) : n ? h = await e.request({
    method: "eth_getTransactionByBlockHashAndIndex",
    params: [n, X(u)]
  }, { dedupe: !0 }) : h = await e.request({
    method: "eth_getTransactionByBlockNumberAndIndex",
    params: [l || c, X(u)]
  }, { dedupe: !!l }), !h)
    throw new od({
      blockHash: n,
      blockNumber: r,
      blockTag: c,
      hash: o,
      index: u
    });
  return (((x = (y = (A = e.chain) == null ? void 0 : A.formatters) == null ? void 0 : y.transaction) == null ? void 0 : x.format) || hd)(h);
}
const $d = {
  "0x0": "reverted",
  "0x1": "success"
};
function mv(e) {
  const n = {
    ...e,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    contractAddress: e.contractAddress ? e.contractAddress : null,
    cumulativeGasUsed: e.cumulativeGasUsed ? BigInt(e.cumulativeGasUsed) : null,
    effectiveGasPrice: e.effectiveGasPrice ? BigInt(e.effectiveGasPrice) : null,
    gasUsed: e.gasUsed ? BigInt(e.gasUsed) : null,
    logs: e.logs ? e.logs.map((r) => pv(r)) : null,
    to: e.to ? e.to : null,
    transactionIndex: e.transactionIndex ? fn(e.transactionIndex) : null,
    status: e.status ? $d[e.status] : null,
    type: e.type ? dd[e.type] || e.type : null
  };
  return e.blobGasPrice && (n.blobGasPrice = BigInt(e.blobGasPrice)), e.blobGasUsed && (n.blobGasUsed = BigInt(e.blobGasUsed)), n;
}
async function pl(e, { hash: n }) {
  var o, u, c;
  const r = await e.request({
    method: "eth_getTransactionReceipt",
    params: [n]
  }, { dedupe: !0 });
  if (!r)
    throw new ad({ hash: n });
  return (((c = (u = (o = e.chain) == null ? void 0 : o.formatters) == null ? void 0 : u.transactionReceipt) == null ? void 0 : c.format) || mv)(r);
}
async function Vd(e, n) {
  var S;
  const { account: r, allowFailure: i = !0, batchSize: o, blockNumber: u, blockTag: c, multicallAddress: l, stateOverride: h } = n, m = n.contracts, A = o ?? (typeof ((S = e.batch) == null ? void 0 : S.multicall) == "object" && e.batch.multicall.batchSize || 1024);
  let y = l;
  if (!y) {
    if (!e.chain)
      throw new Error("client chain not configured. multicallAddress is required.");
    y = Xa({
      blockNumber: u,
      chain: e.chain,
      contract: "multicall3"
    });
  }
  const x = [[]];
  let T = 0, I = 0;
  for (let M = 0; M < m.length; M++) {
    const { abi: G, address: ee, args: H, functionName: Q } = m[M];
    try {
      const F = Kr({ abi: G, args: H, functionName: Q });
      I += (F.length - 2) / 2, // Check if batching is enabled.
      A > 0 && // Check if the current size of the batch exceeds the size limit.
      I > A && // Check if the current chunk is not already empty.
      x[T].length > 0 && (T++, I = (F.length - 2) / 2, x[T] = []), x[T] = [
        ...x[T],
        {
          allowFailure: !0,
          callData: F,
          target: ee
        }
      ];
    } catch (F) {
      const ie = Ta(F, {
        abi: G,
        address: ee,
        args: H,
        docsPath: "/docs/contract/multicall",
        functionName: Q,
        sender: r
      });
      if (!i)
        throw ie;
      x[T] = [
        ...x[T],
        {
          allowFailure: !0,
          callData: "0x",
          target: ee
        }
      ];
    }
  }
  const _ = await Promise.allSettled(x.map((M) => ae(e, ir, "readContract")({
    abi: Aa,
    account: r,
    address: y,
    args: [M],
    blockNumber: u,
    blockTag: c,
    functionName: "aggregate3",
    stateOverride: h
  }))), N = [];
  for (let M = 0; M < _.length; M++) {
    const G = _[M];
    if (G.status === "rejected") {
      if (!i)
        throw G.reason;
      for (let H = 0; H < x[M].length; H++)
        N.push({
          status: "failure",
          error: G.reason,
          result: void 0
        });
      continue;
    }
    const ee = G.value;
    for (let H = 0; H < ee.length; H++) {
      const { returnData: Q, success: F } = ee[H], { callData: ie } = x[M][H], { abi: K, address: pe, functionName: Y, args: ce } = m[N.length];
      try {
        if (ie === "0x")
          throw new li();
        if (!F)
          throw new eu({ data: Q });
        const me = wi({
          abi: K,
          args: ce,
          data: Q,
          functionName: Y
        });
        N.push(i ? { result: me, status: "success" } : me);
      } catch (me) {
        const Pe = Ta(me, {
          abi: K,
          address: pe,
          args: ce,
          docsPath: "/docs/contract/multicall",
          functionName: Y
        });
        if (!i)
          throw Pe;
        N.push({ error: Pe, result: void 0, status: "failure" });
      }
    }
  }
  if (N.length !== m.length)
    throw new O("multicall results mismatch");
  return N;
}
async function Ba(e) {
  return new Promise((n) => setTimeout(n, e));
}
function gl(e, { delay: n = 100, retryCount: r = 2, shouldRetry: i = () => !0 } = {}) {
  return new Promise((o, u) => {
    const c = async ({ count: l = 0 } = {}) => {
      const h = async ({ error: m }) => {
        const A = typeof n == "function" ? n({ count: l, error: m }) : n;
        A && await Ba(A), c({ count: l + 1 });
      };
      try {
        const m = await e();
        o(m);
      } catch (m) {
        if (l < r && await i({ count: l, error: m }))
          return h({ error: m });
        u(m);
      }
    };
    c();
  });
}
function Av(e) {
  return {
    formatters: void 0,
    fees: void 0,
    serializers: void 0,
    ...e
  };
}
class wv extends O {
  constructor({ domain: n }) {
    super(`Invalid domain "${Vt(n)}".`, {
      metaMessages: ["Must be a valid EIP-712 domain."]
    });
  }
}
class yv extends O {
  constructor({ primaryType: n, types: r }) {
    super(`Invalid primary type \`${n}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`, {
      docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
      metaMessages: ["Check that the primary type is a key in `types`."]
    });
  }
}
class bv extends O {
  constructor({ type: n }) {
    super(`Struct type "${n}" is invalid.`, {
      metaMessages: ["Struct type must not be a Solidity type."],
      name: "InvalidStructTypeError"
    });
  }
}
function xv(e) {
  const { domain: n, message: r, primaryType: i, types: o } = e, u = (h, m) => {
    const A = { ...m };
    for (const y of h) {
      const { name: x, type: T } = y;
      T === "address" && (A[x] = A[x].toLowerCase());
    }
    return A;
  }, c = o.EIP712Domain ? n ? u(o.EIP712Domain, n) : {} : {}, l = (() => {
    if (i !== "EIP712Domain")
      return u(o[i], r);
  })();
  return Vt({ domain: c, message: l, primaryType: i, types: o });
}
function Ev(e) {
  const { domain: n, message: r, primaryType: i, types: o } = e, u = (c, l) => {
    for (const h of c) {
      const { name: m, type: A } = h, y = l[m], x = A.match(Xl);
      if (x && (typeof y == "number" || typeof y == "bigint")) {
        const [_, N, S] = x;
        X(y, {
          signed: N === "int",
          size: Number.parseInt(S) / 8
        });
      }
      if (A === "address" && typeof y == "string" && !dn(y))
        throw new Ur({ address: y });
      const T = A.match(h1);
      if (T) {
        const [_, N] = T;
        if (N && Be(y) !== Number.parseInt(N))
          throw new Gb({
            expectedSize: Number.parseInt(N),
            givenSize: Be(y)
          });
      }
      const I = o[A];
      I && (Pv(A), u(I, y));
    }
  };
  if (o.EIP712Domain && n) {
    if (typeof n != "object")
      throw new wv({ domain: n });
    u(o.EIP712Domain, n);
  }
  if (i !== "EIP712Domain")
    if (o[i])
      u(o[i], r);
    else
      throw new yv({ primaryType: i, types: o });
}
function vv({ domain: e }) {
  return [
    typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
    (e == null ? void 0 : e.version) && { name: "version", type: "string" },
    (typeof (e == null ? void 0 : e.chainId) == "number" || typeof (e == null ? void 0 : e.chainId) == "bigint") && {
      name: "chainId",
      type: "uint256"
    },
    (e == null ? void 0 : e.verifyingContract) && {
      name: "verifyingContract",
      type: "address"
    },
    (e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
  ].filter(Boolean);
}
function Pv(e) {
  if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
    throw new bv({ type: e });
}
const ra = /* @__PURE__ */ new Map(), ml = /* @__PURE__ */ new Map();
let Tv = 0;
function ri(e, n, r) {
  const i = ++Tv, o = () => ra.get(e) || [], u = () => {
    const A = o();
    ra.set(e, A.filter((y) => y.id !== i));
  }, c = () => {
    const A = o();
    if (!A.some((x) => x.id === i))
      return;
    const y = ml.get(e);
    A.length === 1 && y && y(), u();
  }, l = o();
  if (ra.set(e, [
    ...l,
    { id: i, fns: n }
  ]), l && l.length > 0)
    return c;
  const h = {};
  for (const A in n)
    h[A] = (...y) => {
      var T, I;
      const x = o();
      if (x.length !== 0)
        for (const _ of x)
          (I = (T = _.fns)[A]) == null || I.call(T, ...y);
    };
  const m = r(h);
  return typeof m == "function" && ml.set(e, m), c;
}
function qd(e, { emitOnBegin: n, initialWaitTime: r, interval: i }) {
  let o = !0;
  const u = () => o = !1;
  return (async () => {
    let l;
    n && (l = await e({ unpoll: u }));
    const h = await (r == null ? void 0 : r(l)) ?? i;
    await Ba(h);
    const m = async () => {
      o && (await e({ unpoll: u }), await Ba(i), m());
    };
    m();
  })(), u;
}
function Iv(e, { emitOnBegin: n = !1, emitMissed: r = !1, onBlockNumber: i, onError: o, poll: u, pollingInterval: c = e.pollingInterval }) {
  const l = typeof u < "u" ? u : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket");
  let h;
  return l ? (() => {
    const y = Vt([
      "watchBlockNumber",
      e.uid,
      n,
      r,
      c
    ]);
    return ri(y, { onBlockNumber: i, onError: o }, (x) => qd(async () => {
      var T;
      try {
        const I = await ae(e, nu, "getBlockNumber")({ cacheTime: 0 });
        if (h) {
          if (I === h)
            return;
          if (I - h > 1 && r)
            for (let _ = h + 1n; _ < I; _++)
              x.onBlockNumber(_, h), h = _;
        }
        (!h || I > h) && (x.onBlockNumber(I, h), h = I);
      } catch (I) {
        (T = x.onError) == null || T.call(x, I);
      }
    }, {
      emitOnBegin: n,
      interval: c
    }));
  })() : (() => {
    const y = Vt([
      "watchBlockNumber",
      e.uid,
      n,
      r
    ]);
    return ri(y, { onBlockNumber: i, onError: o }, (x) => {
      let T = !0, I = () => T = !1;
      return (async () => {
        try {
          const _ = (() => {
            if (e.transport.type === "fallback") {
              const S = e.transport.transports.find((M) => M.config.type === "webSocket");
              return S ? S.value : e.transport;
            }
            return e.transport;
          })(), { unsubscribe: N } = await _.subscribe({
            params: ["newHeads"],
            onData(S) {
              var G;
              if (!T)
                return;
              const M = cn((G = S.result) == null ? void 0 : G.number);
              x.onBlockNumber(M, h), h = M;
            },
            onError(S) {
              var M;
              (M = x.onError) == null || M.call(x, S);
            }
          });
          I = N, T || I();
        } catch (_) {
          o == null || o(_);
        }
      })(), () => I();
    });
  })();
}
async function Bv(e) {
  var r;
  return ((r = e.account) == null ? void 0 : r.type) === "local" ? [e.account.address] : (await e.request({ method: "eth_accounts" }, { dedupe: !0 })).map((i) => hi(i));
}
async function Sv(e, n = {}) {
  const { account: r = e.account, chainId: i } = n, o = r ? Jt(r) : void 0, u = i ? [o == null ? void 0 : o.address, [X(i)]] : [o == null ? void 0 : o.address], c = await e.request({
    method: "wallet_getCapabilities",
    params: u
  }), l = {};
  for (const [h, m] of Object.entries(c)) {
    l[Number(h)] = {};
    for (let [A, y] of Object.entries(m))
      A === "addSubAccount" && (A = "unstable_addSubAccount"), l[Number(h)][A] = y;
  }
  return typeof i == "number" ? l[i] : l;
}
async function Rv(e, n) {
  const { account: r = e.account, capabilities: i, chain: o = e.chain, forceAtomic: u = !1, id: c, version: l = "2.0.0" } = n;
  if (typeof r > "u")
    throw new Wa({
      docsPath: "/docs/actions/wallet/sendCalls"
    });
  const h = r ? Jt(r) : null, m = n.calls.map((A) => {
    const y = A;
    return {
      data: y.abi ? Kr({
        abi: y.abi,
        functionName: y.functionName,
        args: y.args
      }) : y.data,
      to: y.to,
      value: y.value ? X(y.value) : void 0
    };
  });
  try {
    const A = await e.request({
      method: "wallet_sendCalls",
      params: [
        {
          atomicRequired: u,
          calls: m,
          capabilities: i,
          chainId: X(o.id),
          from: h == null ? void 0 : h.address,
          id: c,
          version: l
        }
      ]
    }, { retryCount: 0 });
    return typeof A == "string" ? { id: A } : A;
  } catch (A) {
    throw fd(A, {
      ...n,
      account: h,
      chain: n.chain
    });
  }
}
async function Dv(e, n) {
  const { atomic: r = !1, chainId: i, receipts: o, version: u = "2.0.0", ...c } = await e.request({
    method: "wallet_getCallsStatus",
    params: [n.id]
  }), [l, h] = (() => {
    const m = c.status;
    return m >= 100 && m < 200 ? ["pending", m] : m >= 200 && m < 300 ? ["success", m] : m >= 300 && m < 700 ? ["failure", m] : m === "CONFIRMED" ? ["success", 200] : m === "PENDING" ? ["pending", 100] : [void 0, m];
  })();
  return {
    ...c,
    atomic: r,
    // @ts-expect-error: for backwards compatibility
    chainId: i ? fn(i) : void 0,
    receipts: (o == null ? void 0 : o.map((m) => ({
      ...m,
      blockNumber: cn(m.blockNumber),
      gasUsed: cn(m.gasUsed),
      status: $d[m.status]
    }))) ?? [],
    statusCode: h,
    status: l,
    version: u
  };
}
async function _v(e, n) {
  const { id: r, pollingInterval: i = e.pollingInterval, status: o = ({ statusCode: x }) => x >= 200, timeout: u = 6e4 } = n, c = Vt(["waitForCallsStatus", e.uid, r]), { promise: l, resolve: h, reject: m } = tu();
  let A;
  const y = ri(c, { resolve: h, reject: m }, (x) => {
    const T = qd(async () => {
      const I = (_) => {
        clearTimeout(A), T(), _(), y();
      };
      try {
        const _ = await Dv(e, { id: r });
        if (!o(_))
          return;
        I(() => x.resolve(_));
      } catch (_) {
        I(() => x.reject(_));
      }
    }, {
      interval: i,
      emitOnBegin: !0
    });
    return T;
  });
  return A = u ? setTimeout(() => {
    y(), clearTimeout(A), m(new Cv({ id: r }));
  }, u) : void 0, await l;
}
class Cv extends O {
  constructor({ id: n }) {
    super(`Timed out while waiting for call bundle with id "${n}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
  }
}
async function Nv(e, {
  confirmations: n = 1,
  hash: r,
  onReplaced: i,
  pollingInterval: o = e.pollingInterval,
  retryCount: u = 6,
  retryDelay: c = ({ count: h }) => ~~(1 << h) * 200,
  // exponential backoff
  timeout: l = 18e4
}) {
  const h = Vt(["waitForTransactionReceipt", e.uid, r]);
  let m, A, y, x = !1;
  const { promise: T, resolve: I, reject: _ } = tu(), N = l ? setTimeout(() => _(new G1({ hash: r })), l) : void 0, S = ri(h, { onReplaced: i, resolve: I, reject: _ }, (M) => {
    const G = ae(e, Iv, "watchBlockNumber")({
      emitMissed: !0,
      emitOnBegin: !0,
      poll: !0,
      pollingInterval: o,
      async onBlockNumber(ee) {
        const H = (F) => {
          clearTimeout(N), G(), F(), S();
        };
        let Q = ee;
        if (!x)
          try {
            if (y) {
              if (n > 1 && (!y.blockNumber || Q - y.blockNumber + 1n < n))
                return;
              H(() => M.resolve(y));
              return;
            }
            if (m || (x = !0, await gl(async () => {
              m = await ae(e, gv, "getTransaction")({ hash: r }), m.blockNumber && (Q = m.blockNumber);
            }, {
              delay: c,
              retryCount: u
            }), x = !1), y = await ae(e, pl, "getTransactionReceipt")({ hash: r }), n > 1 && (!y.blockNumber || Q - y.blockNumber + 1n < n))
              return;
            H(() => M.resolve(y));
          } catch (F) {
            if (F instanceof od || F instanceof ad) {
              if (!m) {
                x = !1;
                return;
              }
              try {
                A = m, x = !0;
                const ie = await gl(() => ae(e, Xn, "getBlock")({
                  blockNumber: Q,
                  includeTransactions: !0
                }), {
                  delay: c,
                  retryCount: u,
                  shouldRetry: ({ error: Y }) => Y instanceof ld
                });
                x = !1;
                const K = ie.transactions.find(({ from: Y, nonce: ce }) => Y === A.from && ce === A.nonce);
                if (!K || (y = await ae(e, pl, "getTransactionReceipt")({
                  hash: K.hash
                }), n > 1 && (!y.blockNumber || Q - y.blockNumber + 1n < n)))
                  return;
                let pe = "replaced";
                K.to === A.to && K.value === A.value && K.input === A.input ? pe = "repriced" : K.from === K.to && K.value === 0n && (pe = "cancelled"), H(() => {
                  var Y;
                  (Y = M.onReplaced) == null || Y.call(M, {
                    reason: pe,
                    replacedTransaction: A,
                    transaction: K,
                    transactionReceipt: y
                  }), M.resolve(y);
                });
              } catch (ie) {
                H(() => M.reject(ie));
              }
            } else
              H(() => M.reject(F));
          }
      }
    });
  });
  return T;
}
async function ru(e, n) {
  const { account: r = e.account, domain: i, message: o, primaryType: u } = n;
  if (!r)
    throw new Wa({
      docsPath: "/docs/actions/wallet/signTypedData"
    });
  const c = Jt(r), l = {
    EIP712Domain: vv({ domain: i }),
    ...n.types
  };
  if (Ev({ domain: i, message: o, primaryType: u, types: l }), c.signTypedData)
    return c.signTypedData({ domain: i, message: o, primaryType: u, types: l });
  const h = xv({ domain: i, message: o, primaryType: u, types: l });
  return e.request({
    method: "eth_signTypedData_v4",
    params: [c.address, h]
  }, { retryCount: 0 });
}
var De;
(function(e) {
  e.RPCError = "RPCError", e.ProviderError = "ProviderError", e.ServerError = "ServerError", e.TransactionError = "TransactionError", e.ValidationError = "ValidationError", e.BalanceError = "BalanceError", e.NotFoundError = "NotFoundError", e.UnknownError = "UnknownError", e.SlippageError = "SlippageError", e.HTTPError = "HTTPError";
})(De || (De = {}));
var oe;
(function(e) {
  e[e.InternalError = 1e3] = "InternalError", e[e.ValidationError = 1001] = "ValidationError", e[e.TransactionUnderpriced = 1002] = "TransactionUnderpriced", e[e.TransactionFailed = 1003] = "TransactionFailed", e[e.Timeout = 1004] = "Timeout", e[e.ProviderUnavailable = 1005] = "ProviderUnavailable", e[e.NotFound = 1006] = "NotFound", e[e.ChainSwitchError = 1007] = "ChainSwitchError", e[e.TransactionUnprepared = 1008] = "TransactionUnprepared", e[e.GasLimitError = 1009] = "GasLimitError", e[e.TransactionCanceled = 1010] = "TransactionCanceled", e[e.SlippageError = 1011] = "SlippageError", e[e.SignatureRejected = 1012] = "SignatureRejected", e[e.BalanceError = 1013] = "BalanceError", e[e.AllowanceRequired = 1014] = "AllowanceRequired", e[e.InsufficientFunds = 1015] = "InsufficientFunds", e[e.ExchangeRateUpdateCanceled = 1016] = "ExchangeRateUpdateCanceled", e[e.WalletChangedDuringExecution = 1017] = "WalletChangedDuringExecution", e[e.TransactionExpired = 1018] = "TransactionExpired", e[e.TransactionSimulationFailed = 1019] = "TransactionSimulationFailed", e[e.TransactionConflict = 1020] = "TransactionConflict", e[e.TransactionNotFound = 1021] = "TransactionNotFound", e[e.TransactionRejected = 1022] = "TransactionRejected", e[e.RateLimitExceeded = 1023] = "RateLimitExceeded", e[e.ThirdPartyError = 1024] = "ThirdPartyError";
})(oe || (oe = {}));
var Tt;
(function(e) {
  e.UnknownError = "Unknown error occurred.", e.SlippageError = "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote.", e.GasLimitLow = "Gas limit is too low.", e.TransactionUnderpriced = "Transaction is underpriced.", e.TransactionReverted = "Transaction was reverted.";
})(Tt || (Tt = {}));
const Ov = (e) => {
  let n = e;
  for (; n != null && n.cause; )
    n = n.cause;
  return n;
};
class bt extends Error {
  constructor(r, i, o, u) {
    super(o);
    re(this, "code");
    re(this, "cause");
    this.name = r, this.code = i, this.cause = u;
    const c = Ov(this.cause);
    c != null && c.stack && (this.stack = c.stack);
  }
}
class Mv extends bt {
  constructor(n, r, i) {
    super(De.ProviderError, n, r, i);
  }
}
class Le extends bt {
  constructor(n, r, i) {
    super(De.TransactionError, n, r, i);
  }
}
class Uv extends bt {
  constructor(n, r) {
    super(De.UnknownError, oe.InternalError, n, r);
  }
}
class Fv extends bt {
  constructor(n, r) {
    super(De.BalanceError, oe.BalanceError, n, r);
  }
}
class kv extends bt {
  constructor(n) {
    super(De.ServerError, oe.InternalError, n);
  }
}
class qt extends bt {
  constructor(n) {
    super(De.ValidationError, oe.ValidationError, n);
  }
}
const Jd = "@lifi/sdk", kr = "3.7.0";
class Bt extends Error {
  constructor(r, i, o) {
    const u = `${r.message ? `[${r.name}] ${r.message}` : "Unknown error occurred"}
LI.FI SDK version: ${kr}`;
    super(u);
    re(this, "step");
    re(this, "process");
    re(this, "code");
    re(this, "name", "SDKError");
    re(this, "cause");
    this.name = "SDKError", this.step = i, this.process = o, this.cause = r, this.stack = this.cause.stack, this.code = r.code;
  }
}
const Lv = /* @__PURE__ */ new Map([
  [
    400,
    { type: De.ValidationError, code: oe.ValidationError }
  ],
  [404, { type: De.NotFoundError, code: oe.NotFound }],
  [
    409,
    {
      type: De.SlippageError,
      code: oe.SlippageError,
      message: Tt.SlippageError
    }
  ],
  [424, { type: De.ServerError, code: oe.ThirdPartyError }],
  [429, { type: De.ServerError, code: oe.RateLimitExceeded }],
  [500, { type: De.ServerError, code: oe.InternalError }]
]), Gv = (e) => Lv.get(e) ?? {
  type: De.ServerError,
  code: oe.InternalError
}, Hv = (e) => {
  const n = e.status || e.status === 0 ? e.status : "", r = e.statusText || "", i = `${n} ${r}`.trim();
  return `Request failed with ${i ? `status code ${i}` : "an unknown error"}`;
};
class Qv extends bt {
  constructor(r, i, o) {
    const u = Gv(r.status), c = u != null && u.message ? `
${u.message}` : "", l = Hv(r) + c;
    super(De.HTTPError, u.code, l);
    re(this, "response");
    re(this, "status");
    re(this, "url");
    re(this, "fetchOptions");
    re(this, "type");
    re(this, "responseBody");
    this.type = u.type, this.response = r, this.status = r.status, this.message = l, this.url = i, this.fetchOptions = o;
  }
  async buildAdditionalDetails() {
    var r, i;
    this.type && (this.message = `[${this.type}] ${this.message}`);
    try {
      this.responseBody = await this.response.json(), this.responseBody && (this.message += this.message.endsWith(".") ? ` ${(r = this.responseBody) == null ? void 0 : r.message.toString()}` : `. ${(i = this.responseBody) == null ? void 0 : i.message.toString()}`);
    } catch {
    }
    return this;
  }
}
function Lr(e) {
  return new Promise((n) => {
    setTimeout(() => n(null), e);
  });
}
const Al = {
  retries: 1
}, zv = ({ retries: e, ...n }) => ({
  ...n
}), Rn = async (e, n = {
  retries: Al.retries
}) => {
  var c;
  const { userId: r, integrator: i, widgetVersion: o, apiKey: u } = ye.get();
  if (!i)
    throw new Bt(new qt("You need to provide the Integrator property. Please see documentation https://docs.li.fi/integrate-li.fi-js-sdk/set-up-the-sdk"));
  n.retries = n.retries ?? Al.retries;
  try {
    u && (n.headers = {
      ...n.headers,
      "x-lifi-api-key": u
    }), r && (n.headers = {
      ...n.headers,
      "x-lifi-userid": r
    }), o && (n.headers = {
      ...n.headers,
      "x-lifi-widget": o
    }), kr && (n.headers = {
      ...n.headers,
      "x-lifi-sdk": kr
    }), n.headers = {
      ...n.headers,
      "x-lifi-integrator": i
    };
    const l = await fetch(e, zv(n));
    if (!l.ok)
      throw new Qv(l, e, n);
    return await l.json();
  } catch (l) {
    if (n.retries > 0 && l.status === 500)
      return await Lr(500), Rn(e, { ...n, retries: n.retries - 1 });
    throw await ((c = l.buildAdditionalDetails) == null ? void 0 : c.call(l)), new Bt(l);
  }
}, Wv = (e) => {
  const { id: n, type: r, tool: i, action: o, estimate: u } = e;
  return typeof n == "string" && ["swap", "cross", "lifi"].includes(r) && typeof i == "string" && $v(o) && Vv(u);
}, $v = (e) => {
  const { fromChainId: n, fromAmount: r, fromToken: i, toChainId: o, toToken: u } = e;
  return typeof n == "number" && typeof r == "string" && r !== "" && Sa(i) && typeof o == "number" && Sa(u);
}, Vv = (e) => {
  const { fromAmount: n, toAmount: r, toAmountMin: i, approvalAddress: o } = e;
  return typeof n == "string" && n !== "" && typeof r == "string" && r !== "" && typeof i == "string" && i !== "" && typeof o == "string";
}, Sa = (e) => {
  const { address: n, decimals: r, chainId: i } = e;
  return typeof n == "string" && typeof r == "number" && typeof i == "number";
};
class qv extends Map {
  constructor(r) {
    super();
    re(this, "maxSize");
    this.maxSize = r;
  }
  set(r, i) {
    return super.set(r, i), this.maxSize && this.size > this.maxSize && this.delete(this.keys().next().value), this;
  }
}
const $s = /* @__PURE__ */ new qv(8192);
function Jv(e, { enabled: n = !0, id: r }) {
  if (!n || !r)
    return e();
  if ($s.get(r))
    return $s.get(r);
  const i = e().finally(() => $s.delete(r));
  return $s.set(r, i), i;
}
const Kv = async (e, n) => (Wv(e), await Rn(`${ye.get().apiUrl}/advanced/stepTransaction`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify(e),
  signal: n == null ? void 0 : n.signal
})), Yv = async (e, n) => {
  if (!e.txHash)
    throw new Bt(new qt('Required parameter "txHash" is missing.'));
  const r = new URLSearchParams(e);
  return await Rn(`${ye.get().apiUrl}/status?${r}`, {
    signal: n == null ? void 0 : n.signal
  });
}, jv = async (e, n) => {
  var u, c, l, h, m, A, y, x, T, I, _, N, S, M, G, ee;
  const r = [
    "fromChain",
    "fromToken",
    "fromAddress",
    "fromAmount",
    "toChain",
    "toToken"
  ];
  for (const H of r)
    if (!e[H])
      throw new Bt(new qt(`Required parameter "${H}" is missing.`));
  const i = ye.get();
  e.integrator ?? (e.integrator = i.integrator), e.order ?? (e.order = (u = i.routeOptions) == null ? void 0 : u.order), e.slippage ?? (e.slippage = (c = i.routeOptions) == null ? void 0 : c.slippage), e.referrer ?? (e.referrer = (l = i.routeOptions) == null ? void 0 : l.referrer), e.fee ?? (e.fee = (h = i.routeOptions) == null ? void 0 : h.fee), e.allowBridges ?? (e.allowBridges = (A = (m = i.routeOptions) == null ? void 0 : m.bridges) == null ? void 0 : A.allow), e.denyBridges ?? (e.denyBridges = (x = (y = i.routeOptions) == null ? void 0 : y.bridges) == null ? void 0 : x.deny), e.preferBridges ?? (e.preferBridges = (I = (T = i.routeOptions) == null ? void 0 : T.bridges) == null ? void 0 : I.prefer), e.allowExchanges ?? (e.allowExchanges = (N = (_ = i.routeOptions) == null ? void 0 : _.exchanges) == null ? void 0 : N.allow), e.denyExchanges ?? (e.denyExchanges = (M = (S = i.routeOptions) == null ? void 0 : S.exchanges) == null ? void 0 : M.deny), e.preferExchanges ?? (e.preferExchanges = (ee = (G = i.routeOptions) == null ? void 0 : G.exchanges) == null ? void 0 : ee.prefer);
  for (const H of Object.keys(e))
    e[H] || delete e[H];
  const o = await Rn(`${ye.get().apiUrl}/relayer/quote?${new URLSearchParams(e)}`, {
    signal: n == null ? void 0 : n.signal
  });
  if (o.status === "error")
    throw new bt(De.ServerError, o.data.code, o.data.message);
  return o.data;
}, Zv = async (e, n) => {
  const r = [
    "typedData",
    "transactionRequest"
  ];
  for (const o of r)
    if (!e[o])
      throw new Bt(new qt(`Required parameter "${o}" is missing.`));
  const i = await Rn(`${ye.get().apiUrl}/relayer/relay`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify(e, (o, u) => typeof u == "bigint" ? u.toString() : u),
    signal: n == null ? void 0 : n.signal
  });
  if (i.status === "error")
    throw new bt(De.ServerError, i.data.code, i.data.message);
  return i.data;
}, Xv = async (e, n) => {
  if (!e.taskId)
    throw new Bt(new qt('Required parameter "taskId" is missing.'));
  const { taskId: r, ...i } = e, o = new URLSearchParams(i), u = await Rn(`${ye.get().apiUrl}/relayer/status/${r}?${o}`, {
    signal: n == null ? void 0 : n.signal
  });
  if (u.status === "error")
    throw new bt(De.ServerError, u.data.code, u.data.message);
  return u.data;
}, Kd = async (e, n) => {
  if (e)
    for (const o of Object.keys(e))
      e[o] || delete e[o];
  const r = new URLSearchParams(e).toString();
  return (await Jv(() => Rn(`${ye.get().apiUrl}/chains?${r}`, {
    signal: n == null ? void 0 : n.signal
  }), { id: `${Kd.name}.${r}` })).chains;
}, It = {
  state: {},
  get(e) {
    return this.state[e];
  },
  create(e) {
    var n;
    return this.state[e.route.id] = {
      ...this.state[e.route.id],
      ...e,
      executors: ((n = this.state[e.route.id]) == null ? void 0 : n.executors) ?? []
    }, this.state[e.route.id];
  },
  update(e) {
    this.state[e.route.id] && (this.state[e.route.id] = {
      ...this.state[e.route.id],
      ...e
    });
  },
  delete(e) {
    delete this.state[e];
  }
}, eP = {
  TOKEN_ALLOWANCE: {
    STARTED: "Setting token allowance",
    PENDING: "Waiting for token allowance",
    DONE: "Token allowance set"
  },
  SWITCH_CHAIN: {
    ACTION_REQUIRED: "Chain switch required",
    PENDING: "Waiting for chain switch",
    DONE: "Chain switched"
  },
  SWAP: {
    STARTED: "Preparing swap transaction",
    ACTION_REQUIRED: "Please sign the transaction",
    PENDING: "Waiting for swap transaction",
    DONE: "Swap completed"
  },
  CROSS_CHAIN: {
    STARTED: "Preparing bridge transaction",
    ACTION_REQUIRED: "Please sign the transaction",
    PENDING: "Waiting for bridge transaction",
    DONE: "Bridge transaction confirmed"
  },
  RECEIVING_CHAIN: {
    PENDING: "Waiting for destination chain",
    DONE: "Bridge completed"
  },
  PERMIT: {
    STARTED: "Preparing transaction",
    ACTION_REQUIRED: "Sign permit message",
    PENDING: "Waiting for permit message",
    DONE: "Permit message signed"
  },
  TRANSACTION: {}
}, tP = {
  PENDING: {
    BRIDGE_NOT_AVAILABLE: "Bridge communication is temporarily unavailable.",
    CHAIN_NOT_AVAILABLE: "RPC communication is temporarily unavailable.",
    UNKNOWN_ERROR: "An unexpected error occurred. Please seek assistance in the LI.FI discord server.",
    WAIT_SOURCE_CONFIRMATIONS: "The bridge deposit has been received. The bridge is waiting for more confirmations to start the off-chain logic.",
    WAIT_DESTINATION_TRANSACTION: "The bridge off-chain logic is being executed. Wait for the transaction to appear on the destination chain."
  },
  DONE: {
    PARTIAL: "Some of the received tokens are not the requested destination tokens.",
    REFUNDED: "The tokens were refunded to the sender address.",
    COMPLETED: "The transfer is complete."
  },
  FAILED: {},
  INVALID: {},
  NOT_FOUND: {}
};
function wl(e, n) {
  return eP[e][n];
}
function nP(e, n) {
  return n ? tP[e][n] : void 0;
}
class rP {
  constructor(n) {
    re(this, "routeId");
    re(this, "shouldUpdate", !0);
    /**
     * Initializes the execution object of a Step.
     * @param step  The current step in execution
     * @returns The initialized execution object for this step and a function to update this step
     */
    re(this, "initExecutionObject", (n) => (n.execution || (n.execution = {
      status: "PENDING",
      process: [],
      startedAt: Date.now()
    }, this.updateStepInRoute(n)), n.execution.status === "FAILED" && (n.execution.startedAt = Date.now(), n.execution.status = "PENDING", this.updateStepInRoute(n)), n.execution));
    /**
     * Create and push a new process into the execution.
     * @param step The step that should contain the new process.
     * @param type Type of the process. Used to identify already existing processes.
     * @param chainId Chain Id of the process.
     * @param status By default created process is set to the STARTED status. We can override new process with the needed status.
     * @returns Returns process.
     */
    re(this, "findOrCreateProcess", ({ step: n, type: r, chainId: i, status: o, startedAt: u }) => {
      const c = this.findProcess(n, r, o);
      if (c)
        return c;
      const l = {
        type: r,
        startedAt: u ?? Date.now(),
        message: wl(r, o ?? "STARTED"),
        status: o ?? "STARTED",
        chainId: i
      };
      return n.execution.process.push(l), this.updateStepInRoute(n), l;
    });
    /**
     * Update a process object.
     * @param step The step where the process should be updated
     * @param type  The process type to update
     * @param status The status the process gets.
     * @param [params] Additional parameters to append to the process.
     * @returns The update process
     */
    re(this, "updateProcess", (n, r, i, o) => {
      if (!n.execution)
        throw new Error("Can't update an empty step execution.");
      const u = this.findProcess(n, r);
      if (!u)
        throw new Error("Can't find a process for the given type.");
      switch (i) {
        case "CANCELLED":
          u.doneAt = Date.now();
          break;
        case "FAILED":
          u.doneAt = Date.now(), n.execution.status = "FAILED";
          break;
        case "DONE":
          u.doneAt = Date.now();
          break;
        case "PENDING":
          n.execution.status = "PENDING", u.pendingAt = Date.now();
          break;
        case "ACTION_REQUIRED":
          n.execution.status = "ACTION_REQUIRED", u.actionRequiredAt = Date.now();
          break;
      }
      if (u.status = i, u.message = wl(r, i), o)
        for (const [c, l] of Object.entries(o))
          u[c] = l;
      return n.execution.process = [
        ...n.execution.process.filter((c) => c.status === "DONE"),
        ...n.execution.process.filter((c) => c.status !== "DONE")
      ], this.updateStepInRoute(n), u;
    });
    /**
     * Remove a process from the execution
     * @param step The step where the process should be removed from
     * @param type  The process type to remove
     */
    re(this, "removeProcess", (n, r) => {
      if (!n.execution)
        throw new Error("Execution hasn't been initialized.");
      const i = n.execution.process.findIndex((o) => o.type === r);
      n.execution.process.splice(i, 1), this.updateStepInRoute(n);
    });
    re(this, "updateStepInRoute", (n) => {
      var o, u;
      if (!this.shouldUpdate)
        return n;
      const r = It.get(this.routeId);
      if (!r)
        throw new Error("Execution data not found.");
      const i = r.route.steps.findIndex((c) => c.id === n.id);
      if (i === -1)
        throw new Error("Couldn't find a step to update.");
      return r.route.steps[i] = { ...r.route.steps[i], ...n }, (u = (o = r.executionOptions) == null ? void 0 : o.updateRouteHook) == null || u.call(o, r.route), r.route.steps[i];
    });
    this.routeId = n;
  }
  /**
   * Updates the execution object of a Step.
   * @param step  The current step in execution
   * @param status  The status for the execution
   * @param execution Optional. Information about received tokens
   * @returns The step with the updated execution object
   */
  updateExecution(n, r, i) {
    if (!n.execution)
      throw Error("Can't update empty execution.");
    return n.execution.status = r, r === "DONE" && (n.execution.doneAt = Date.now()), i && (n.execution = {
      ...n.execution,
      ...i
    }), this.updateStepInRoute(n), n;
  }
  /**
   * Finds a process of the specified type in the step's execution
   * @param step The step to search in
   * @param type The process type to find
   * @param status Optional status to update the process with if found
   * @returns The found process or undefined if not found
   */
  findProcess(n, r, i) {
    var u;
    if (!((u = n.execution) != null && u.process))
      throw new Error("Execution hasn't been initialized.");
    const o = n.execution.process.find((c) => c.type === r);
    return o && i && o.status !== i && (o.status = i, this.updateStepInRoute(n)), o;
  }
  allowUpdates(n) {
    this.shouldUpdate = n;
  }
}
const sP = {
  allowInteraction: !0,
  allowUpdates: !0,
  allowExecution: !0
};
let iP = class {
  constructor(n) {
    re(this, "executionOptions");
    re(this, "statusManager");
    re(this, "allowUserInteraction", !0);
    re(this, "allowExecution", !0);
    re(this, "setInteraction", (n) => {
      const r = {
        ...sP,
        ...n
      };
      this.allowUserInteraction = r.allowInteraction, this.statusManager.allowUpdates(r.allowUpdates), this.allowExecution = r.allowExecution;
    });
    this.statusManager = new rP(n.routeId), this.executionOptions = n.executionOptions;
  }
};
const oP = async (e, n) => {
  const r = await aP(e, [n]);
  return r.length ? r[0] : null;
}, aP = async (e, n) => {
  const r = n.reduce((o, u) => (o[u.chainId] || (o[u.chainId] = []), o[u.chainId].push(u), o), {}), i = await uP(e, r);
  return Object.values(i).flat();
}, uP = async (e, n) => {
  if (!e)
    throw new qt("Missing walletAddress.");
  if (Object.values(n).flat().filter((c) => !Sa(c)).length)
    throw new qt("Invalid tokens passed.");
  const o = {}, u = await Promise.allSettled(Object.keys(n).map(async (c) => {
    const l = Number.parseInt(c), h = await ye.getChainById(l), m = ye.get().providers.find((y) => y.isAddress(e));
    if (!m)
      throw new Error(`SDK Token Provider for ${h.chainType} is not found.`);
    const A = await m.getBalance(e, n[l]);
    o[l] = A;
  }));
  if (ye.get().debug)
    for (const c of u)
      c.status;
  return o;
}, Yd = async (e, n, r = 0) => {
  const i = await oP(e, n.action.fromToken);
  if (i) {
    const o = i.amount ?? 0n, u = BigInt(n.action.fromAmount);
    if (o < u)
      if (r <= 3)
        await Lr(200), await Yd(e, n, r + 1);
      else if (u * BigInt((1 - (n.action.slippage ?? 0)) * 1e9) / 1000000000n <= o)
        n.action.fromAmount = o.toString();
      else {
        const c = Hf(u, i.decimals), l = Hf(o, i.decimals);
        let h = `Your ${i.symbol} balance is too low, you try to transfer ${c} ${i.symbol}, but your wallet only holds ${l} ${i.symbol}. No funds have been sent.`;
        throw o !== 0n && (h += `If the problem consists, please delete this transfer and start a new one with a maximum of ${l} ${i.symbol}.`), new Fv("The balance is too low.", new Error(h));
      }
  }
}, cP = 5e-3;
function fP(e, n) {
  const r = e.action.slippage || cP, i = BigInt(e.estimate.toAmountMin), o = BigInt(n.estimate.toAmountMin), u = i - o;
  let c = 0;
  return i > 0 && (c = Number(u * 1000000000n / i) / 1e9), c <= r;
}
const lP = async (e, n, r, i, o) => {
  var c;
  if (fP(n, r))
    return e.updateStepInRoute(r);
  let u;
  if (i && (u = await ((c = o == null ? void 0 : o.acceptExchangeRateUpdateHook) == null ? void 0 : c.call(o, {
    oldToAmount: n.estimate.toAmount,
    newToAmount: r.estimate.toAmount,
    toToken: r.action.toToken
  }))), !u)
    throw new Le(oe.ExchangeRateUpdateCanceled, `Exchange rate has changed!
Transaction was not sent, your funds are still in your wallet.
The exchange rate has changed and the previous estimation can not be fulfilled due to value loss.`);
  return e.updateStepInRoute(r);
}, dP = async (e, n) => {
  const i = `It appears that your transaction may not have been successful.
  However, to confirm this, please check your ${(await ye.getChainById(e.action.toChainId)).name} wallet for ${e.action.toToken.symbol}.`;
  return n ? `${i}
    You can also check the&nbsp;<a href="${n}" target="_blank" rel="nofollow noreferrer">block explorer</a> for more information.` : i;
}, jd = async (e, n = 5e3, r = 3, i = () => !0) => {
  let o, u = 0;
  for (; !o; )
    try {
      o = await e(), o || await Lr(n);
    } catch (c) {
      if (!i(u, c) || (u++, u === r))
        throw c;
      await Lr(n);
    }
  return o;
}, yl = {};
async function hP(e, n, r, i, o = 5e3) {
  const u = () => Yv({
    fromChain: i.action.fromChainId,
    toChain: i.action.toChainId,
    txHash: e,
    ...i.tool !== "custom" && { bridge: i.tool }
  }).then((h) => {
    switch (h.status) {
      case "DONE":
        return h;
      case "PENDING":
        n == null || n.updateProcess(i, r, "PENDING", {
          substatus: h.substatus,
          substatusMessage: h.substatusMessage || nP(h.status, h.substatus),
          txLink: h.bridgeExplorerLink
        });
        return;
      case "NOT_FOUND":
        return;
      default:
        return Promise.reject();
    }
  }).catch((h) => {
    process.env.NODE_ENV;
  });
  let c = yl[e];
  c || (c = jd(u, o), yl[e] = c);
  const l = await c;
  if (!("receiving" in l))
    throw new kv("Status doesn't contain destination chain information.");
  return l;
}
async function bl(e, n, r, i, o, u) {
  const c = n.txHash;
  let l = n.type;
  try {
    if (!c)
      throw new Error("Transaction hash is undefined.");
    r.id !== i.id && (l = o.findOrCreateProcess({
      step: e,
      type: "RECEIVING_CHAIN",
      status: "PENDING",
      chainId: i.id,
      startedAt: n.doneAt
    }).type);
    const m = await hP(c, o, l, e, u), A = m.receiving;
    return o.updateProcess(e, l, "DONE", {
      substatus: m.substatus,
      substatusMessage: m.substatusMessage,
      txHash: A == null ? void 0 : A.txHash,
      txLink: `${i.metamask.blockExplorerUrls[0]}tx/${A == null ? void 0 : A.txHash}`
    }), o.updateExecution(e, "DONE", {
      ...m.sending.amount && {
        fromAmount: m.sending.amount
      },
      ...(A == null ? void 0 : A.amount) && { toAmount: A.amount },
      ...(A == null ? void 0 : A.token) && { toToken: A.token },
      gasCosts: [
        {
          amount: m.sending.gasAmount,
          amountUSD: m.sending.gasAmountUSD,
          token: m.sending.gasToken,
          estimate: m.sending.gasUsed,
          limit: m.sending.gasUsed,
          price: m.sending.gasPrice,
          type: "SEND"
        }
      ]
    }), e;
  } catch (h) {
    const m = await dP(e, `${i.metamask.blockExplorerUrls[0]}tx/${c}`);
    throw o.updateProcess(e, l, "FAILED", {
      error: {
        code: oe.TransactionFailed,
        message: "Failed while waiting for status of destination chain transaction.",
        htmlMessage: m
      }
    }), o.updateExecution(e, "FAILED"), h;
  }
}
const pP = "0x0000000000000000000000000000000000000000", gP = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
BigInt("0xffffffffffff");
BigInt("0xffffffffffffffffffffffffffffffffffffffff");
const yi = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, Zd = (e) => e === pP || e === gP, su = nr([
  "function callDiamondWithPermit2(bytes, ((address, uint256), uint256, uint256), bytes) external",
  "function callDiamondWithEIP2612Signature(address, uint256, uint256, uint8, bytes32, bytes32, bytes) external payable",
  "function nextNonce(address) external view returns (uint256)",
  "function callDiamondWithPermit2Witness(bytes, address, ((address, uint256), uint256, uint256), bytes) external payable"
]), Vs = nr([
  "function permit(address, address, uint256, uint256, uint8, bytes32, bytes32) external",
  "function DOMAIN_SEPARATOR() external view returns (bytes32)",
  "function nonces(address) external view returns (uint256)",
  "function name() external view returns (string)",
  "function version() external view returns (string)"
]), mP = nr([
  "function approve(address, uint256) external returns (bool)"
]), AP = nr([
  "function allowance(address, address) external view returns (uint256)"
]), wP = nr([
  "function getEthBalance(address) external view returns (uint256)"
]), Xd = nr([
  "function balanceOf(address) external view returns (uint256)"
]), xl = {
  Permit: [
    { name: "owner", type: "address" },
    { name: "spender", type: "address" },
    { name: "value", type: "uint256" },
    { name: "nonce", type: "uint256" },
    { name: "deadline", type: "uint256" }
  ]
}, yP = /* @__PURE__ */ Av({
  id: 1,
  name: "Ethereum",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://eth.merkle.io"]
    }
  },
  blockExplorers: {
    default: {
      name: "Etherscan",
      url: "https://etherscan.io",
      apiUrl: "https://api.etherscan.io/api"
    }
  },
  contracts: {
    ensRegistry: {
      address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
    },
    ensUniversalResolver: {
      address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
      blockCreated: 19258213
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 14353601
    }
  }
}), bP = async (e) => {
  const n = (await ye.getRPCUrls())[e];
  if (!(n != null && n.length))
    throw new Error(`RPC URL not found for chainId: ${e}`);
  return n;
}, qs = {}, Yr = async (e) => {
  var c;
  if (qs[e])
    return qs[e];
  const r = (await bP(e)).map((l) => l.startsWith("wss") ? Ab(l) : wb(l, {
    batch: {
      batchSize: 64
    }
  })), i = await ye.getChainById(e), o = {
    ...i,
    ...i.metamask,
    name: i.metamask.chainName,
    rpcUrls: {
      default: { http: i.metamask.rpcUrls },
      public: { http: i.metamask.rpcUrls }
    }
  };
  o.id === Mr.ETH && (o.contracts = {
    ...yP.contracts,
    ...o.contracts
  });
  const u = ye.getProvider(Qt.EVM);
  return qs[e] = yb({
    chain: o,
    transport: bb(r, (c = u == null ? void 0 : u.options) == null ? void 0 : c.fallbackTransportConfig),
    batch: {
      multicall: !0
    }
  }), qs[e];
}, xP = (e) => {
  if (!e.length)
    return;
  const n = [...e].sort((i, o) => i > o ? 1 : i < o ? -1 : 0), r = Math.floor(n.length / 2);
  return n.length % 2 === 0 ? (n[r - 1] + n[r]) / 2n : n[r];
}, EP = (e) => ({
  ...e,
  ...e.metamask,
  blockExplorers: e.metamask.blockExplorerUrls.reduce((n, r, i) => (n[i === 0 ? "default" : `${i}`] = {
    name: r,
    url: r
  }, n), {}),
  name: e.metamask.chainName,
  rpcUrls: {
    default: { http: e.metamask.rpcUrls },
    public: { http: e.metamask.rpcUrls }
  },
  contracts: {
    ...e.multicallAddress ? { multicall3: { address: e.multicallAddress } } : void 0
  }
}), eh = async (e) => {
  const r = (await Xn(e, {
    includeTransactions: !0
  })).transactions.filter((c) => c.maxPriorityFeePerGas).map((c) => c.maxPriorityFeePerGas);
  if (!r.length)
    return;
  let i = 0n;
  for (const c of r)
    i += c;
  const o = xP(r) ?? 0n, u = i / BigInt(r.length);
  return o > u ? u : o;
}, th = async (e) => {
  var r;
  return (r = (await ye.getChains()).find((i) => i.id === e)) == null ? void 0 : r.multicallAddress;
}, vP = async (e, n, r, i) => {
  const o = await Yr(e);
  try {
    return await ir(o, {
      address: n,
      abi: AP,
      functionName: "allowance",
      args: [r, i]
    });
  } catch {
    return 0n;
  }
}, PP = async (e, n) => {
  try {
    return await (await fetch(`https://api.tenderly.co/api/v1/public-contract/${n}/tx/${e}`)).json();
  } catch {
  }
}, Ra = async (e, n, r) => {
  if (e instanceof Bt)
    return e.step = e.step ?? n, e.process = e.process ?? r, e;
  const i = await TP(e, n, r);
  return new Bt(i, n, r);
}, TP = async (e, n, r) => {
  var i, o, u, c, l;
  if (e.name === "UserRejectedRequestError" || ((i = e.cause) == null ? void 0 : i.name) === "UserRejectedRequestError")
    return new Le(oe.SignatureRejected, e.message, e);
  if (((o = e.cause) == null ? void 0 : o.code) === -32e3 || // Safe doesn't return proper code, but the error details includes 'rejected'
  e.name === "TransactionExecutionError" && ((c = (u = e.cause) == null ? void 0 : u.details) != null && c.includes("rejected")))
    return new Le(oe.SignatureRejected, e.message, e);
  if (((l = e.cause) == null ? void 0 : l.code) === -32603)
    return new Le(oe.TransactionRejected, e.message, e);
  if (n && (r != null && r.txHash) && e.code === oe.TransactionFailed && e.message === Tt.TransactionReverted) {
    const h = await PP(r.txHash, n.action.fromChainId), m = h == null ? void 0 : h.error_message;
    if (m != null && m.toLowerCase().includes("out of gas"))
      return new Le(oe.GasLimitError, Tt.GasLimitLow, e);
  }
  return e instanceof bt ? e : new Uv(e.message || Tt.UnknownError, e);
}, IP = "0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", BP = "0x36c25de3e541d5d970f66e4210d728721220fff5c077cc6cd008b3a0c62adab7";
function SP({ name: e, version: n, chainId: r, verifyingContract: i, withSalt: o = !1 }) {
  const u = Ks(Qf(e)), c = Ks(Qf(n)), l = o ? zf(Wf("bytes32, bytes32, bytes32, address, bytes32"), [
    BP,
    u,
    c,
    i,
    Cl(Nl(r), { size: 32 })
  ]) : zf(Wf("bytes32, bytes32, bytes32, uint256, address"), [
    IP,
    u,
    c,
    BigInt(r),
    i
  ]);
  return Ks(l);
}
function El({ name: e, version: n, chainId: r, verifyingContract: i, domainSeparator: o }) {
  if (!e || !o)
    return {
      isValid: !1,
      domain: {}
    };
  for (const u of [!1, !0]) {
    const c = SP({
      name: e,
      version: n,
      chainId: r,
      verifyingContract: i,
      withSalt: u
    });
    if (o.toLowerCase() === c.toLowerCase())
      return {
        isValid: !0,
        domain: u ? {
          name: e,
          version: n,
          verifyingContract: i,
          salt: Cl(Nl(r), { size: 32 })
        } : {
          name: e,
          version: n,
          chainId: r,
          verifyingContract: i
        }
      };
  }
  return {
    isValid: !1,
    domain: {}
  };
}
const RP = async (e, n, r, i, o) => {
  try {
    const u = await th(n), c = [
      {
        address: r,
        abi: Vs,
        functionName: "name"
      },
      {
        address: r,
        abi: Vs,
        functionName: "DOMAIN_SEPARATOR"
      },
      {
        address: r,
        abi: Vs,
        functionName: "nonces",
        args: [e.account.address]
      },
      {
        address: r,
        abi: Vs,
        functionName: "version"
      }
    ];
    if (u) {
      const [N, S, M, G] = await Vd(e, {
        contracts: c,
        multicallAddress: u
      });
      if (N.status !== "success" || S.status !== "success" || M.status !== "success" || !N.result || !S.result || M.result === void 0)
        return;
      const { isValid: ee, domain: H } = El({
        name: N.result,
        version: G.result ?? "1",
        chainId: n,
        verifyingContract: r,
        domainSeparator: S.result
      });
      if (!ee)
        return;
      const Q = {
        owner: e.account.address,
        spender: i,
        value: o.toString(),
        nonce: M.result.toString(),
        deadline: BigInt(Math.floor(Date.now() / 1e3) + 30 * 60).toString()
        // 30 minutes
      };
      return {
        primaryType: "Permit",
        domain: H,
        types: xl,
        message: Q
      };
    }
    const [l, h, m, A] = await Promise.allSettled(c.map((N) => ir(e, N)));
    if (l.status !== "fulfilled" || h.status !== "fulfilled" || m.status !== "fulfilled")
      return;
    const y = l.value, x = A.status === "fulfilled" ? A.value : "1", { isValid: T, domain: I } = El({
      name: y,
      version: x,
      chainId: n,
      verifyingContract: r,
      domainSeparator: h.value
    });
    if (!T)
      return;
    const _ = {
      owner: e.account.address,
      spender: i,
      value: o.toString(),
      nonce: m.value.toString(),
      deadline: BigInt(Math.floor(Date.now() / 1e3) + 30 * 60).toString()
      // 30 minutes
    };
    return {
      primaryType: "Permit",
      domain: I,
      types: xl,
      message: _
    };
  } catch {
    return;
  }
}, DP = async (e, n, r, i, o, u) => {
  var h;
  const c = Ua({
    abi: mP,
    functionName: "approve",
    args: [r, i]
  });
  if (u)
    return c;
  let l = {
    to: n,
    data: c,
    maxPriorityFeePerGas: ((h = e.account) == null ? void 0 : h.type) === "local" ? await eh(e) : void 0
  };
  if (o != null && o.updateTransactionRequestHook) {
    const m = await o.updateTransactionRequestHook({
      requestType: "approve",
      ...l
    });
    l = {
      ...l,
      ...m
    };
  }
  return ae(e, Pd, "sendTransaction")({
    to: l.to,
    account: e.account,
    data: l.data,
    gas: l.gas,
    gasPrice: l.gasPrice,
    maxFeePerGas: l.maxFeePerGas,
    maxPriorityFeePerGas: l.maxPriorityFeePerGas
  });
};
function nh(e) {
  return !!e.typedData && e.typedData.length > 0;
}
async function rh({ client: e, chainId: n, txHash: r, onReplaced: i }) {
  let { transactionReceipt: o, replacementReason: u } = await vl(e, r, i);
  if (!(o != null && o.status)) {
    const c = await Yr(n), l = await vl(c, r, i);
    o = l.transactionReceipt, u = l.replacementReason;
  }
  if ((o == null ? void 0 : o.status) === "reverted")
    throw new Le(oe.TransactionFailed, "Transaction was reverted.");
  if (u === "cancelled" || u === "replaced")
    throw new Le(oe.TransactionCanceled, "Transaction was canceled or replaced.");
  return o;
}
async function vl(e, n, r) {
  let i, o;
  try {
    o = await Nv(e, {
      hash: n,
      onReplaced: (u) => {
        i = u.reason, r == null || r(u);
      }
    });
  } catch {
  }
  return { transactionReceipt: o, replacementReason: i };
}
const _P = async ({ client: e, chain: n, step: r, statusManager: i, executionOptions: o, allowUserInteraction: u = !1, batchingSupported: c = !1, permit2Supported: l = !1, disableMessageSigning: h = !1 }) => {
  const m = i.findOrCreateProcess({
    step: r,
    type: "TOKEN_ALLOWANCE",
    chainId: r.action.fromChainId
  });
  try {
    if (m.txHash && m.status !== "DONE")
      return await Pl(e, m.txHash, m.type, r, n, i), { status: "DONE" };
    i.updateProcess(r, m.type, "STARTED");
    const A = l ? n.permit2 : r.estimate.approvalAddress, y = BigInt(r.action.fromAmount), x = await vP(n.id, r.action.fromToken.address, e.account.address, A);
    if (y <= x)
      return i.updateProcess(r, m.type, "DONE"), { status: "DONE" };
    const T = nh(r), I = !!n.permit2Proxy && !c && !h;
    let _;
    if (T ? _ = r.typedData.find((M) => M.primaryType === "Permit") : I && (_ = await RP(e, n.id, r.action.fromToken.address, n.permit2Proxy, y)), i.updateProcess(r, m.type, "ACTION_REQUIRED"), !u)
      return { status: "ACTION_REQUIRED" };
    if (I && _) {
      const M = await ae(e, ru, "signTypedData")({
        account: e.account,
        domain: _.domain,
        types: _.types,
        primaryType: "Permit",
        message: _.message
      });
      return i.updateProcess(r, m.type, "DONE"), {
        status: "NATIVE_PERMIT",
        data: {
          ..._,
          signature: M
        }
      };
    }
    const N = l ? yi : y, S = await DP(e, r.action.fromToken.address, A, N, o, c);
    return c ? (i.updateProcess(r, m.type, "DONE"), {
      status: "BATCH_APPROVAL",
      data: {
        to: r.action.fromToken.address,
        data: S,
        chainId: r.action.fromToken.chainId
      }
    }) : (await Pl(e, S, m.type, r, n, i), { status: "DONE" });
  } catch (A) {
    const y = await Ra(A, r, m);
    throw i.updateProcess(r, m.type, "FAILED", {
      error: {
        message: y.cause.message,
        code: y.code
      }
    }), i.updateExecution(r, "FAILED"), y;
  }
}, Pl = async (e, n, r, i, o, u) => {
  const c = o.metamask.blockExplorerUrls[0], l = (A) => `${c}tx/${A}`;
  u.updateProcess(i, r, "PENDING", {
    txHash: n,
    txLink: l(n)
  });
  const h = await rh({
    client: e,
    chainId: o.id,
    txHash: n,
    onReplaced(A) {
      const y = A.transaction.hash;
      u.updateProcess(i, r, "PENDING", {
        txHash: y,
        txLink: l(y)
      });
    }
  }), m = (h == null ? void 0 : h.transactionHash) || n;
  u.updateProcess(i, r, "DONE", {
    txHash: m,
    txLink: l(m)
  });
};
async function CP({ client: e, chainId: n }) {
  var i, o, u, c, l;
  const r = e ?? await ((o = (i = ye.getProvider(Qt.EVM)) == null ? void 0 : i.getWalletClient) == null ? void 0 : o.call(i));
  if (!r)
    throw new Error("WalletClient is not provided.");
  try {
    const h = await Promise.race([
      ae(r, Sv, "getCapabilities")({ chainId: n }),
      Lr(2e3)
    ]);
    return ((u = h == null ? void 0 : h.atomicBatch) == null ? void 0 : u.supported) || ((c = h == null ? void 0 : h.atomic) == null ? void 0 : c.status) === "supported" || ((l = h == null ? void 0 : h.atomic) == null ? void 0 : l.status) === "ready" || !1;
  } catch {
    return !1;
  }
}
const NP = (e, n, r, i, o) => {
  const { v: u, r: c, s: l } = xb(i);
  return Ua({
    abi: su,
    functionName: "callDiamondWithEIP2612Signature",
    args: [e, n, r, Number(u), c, l, o]
  });
}, OP = (e, n, r, i, o, u, c, l) => Ua({
  abi: su,
  functionName: "callDiamondWithPermit2",
  args: [
    o,
    [[e, n], r, i],
    u
  ]
}), MP = async (e, n, r, i) => {
  const o = await ir(e, {
    address: n.permit2Proxy,
    abi: su,
    functionName: "nextNonce",
    args: [e.account.address]
  });
  return {
    permitted: {
      token: r,
      amount: i
    },
    spender: n.permit2Proxy,
    nonce: o,
    deadline: BigInt(Math.floor(Date.now() / 1e3) + 30 * 60)
    // 30 minutes
  };
}, UP = process.env.NODE_ENV === "production", sa = "Invariant failed";
function Gr(e, n) {
  if (e)
    return;
  if (UP)
    throw new Error(sa);
  const r = typeof n == "function" ? n() : n, i = r ? `${sa}: ${r}` : sa;
  throw new Error(i);
}
const FP = yi, sh = yi, ih = yi, kP = "Permit2";
function oh(e, n) {
  return {
    name: kP,
    chainId: n,
    verifyingContract: e
  };
}
const bi = [
  { name: "token", type: "address" },
  { name: "amount", type: "uint256" }
], LP = {
  TokenPermissions: bi,
  PermitTransferFrom: [
    { name: "permitted", type: "TokenPermissions" },
    { name: "spender", type: "address" },
    { name: "nonce", type: "uint256" },
    { name: "deadline", type: "uint256" }
  ]
}, GP = {
  TokenPermissions: bi,
  PermitBatchTransferFrom: [
    { name: "permitted", type: "TokenPermissions[]" },
    { name: "spender", type: "address" },
    { name: "nonce", type: "uint256" },
    { name: "deadline", type: "uint256" }
  ]
};
function HP(e) {
  return !Array.isArray(e.permitted);
}
function QP(e, n, r, i) {
  Gr(ih >= e.deadline, "SIG_DEADLINE_OUT_OF_RANGE"), Gr(sh >= e.nonce, "NONCE_OUT_OF_RANGE");
  const o = oh(n, r);
  ah(e.permitted);
  const u = i ? {
    TokenPermissions: bi,
    ...i.witnessType,
    PermitWitnessTransferFrom: [
      { name: "permitted", type: "TokenPermissions" },
      { name: "spender", type: "address" },
      { name: "nonce", type: "uint256" },
      { name: "deadline", type: "uint256" },
      { name: "witness", type: i.witnessTypeName }
    ]
  } : LP, c = i ? Object.assign(e, { witness: i.witness }) : e;
  return {
    domain: o,
    types: u,
    message: c
  };
}
function zP(e, n, r, i) {
  Gr(ih >= e.deadline, "SIG_DEADLINE_OUT_OF_RANGE"), Gr(sh >= e.nonce, "NONCE_OUT_OF_RANGE");
  const o = oh(n, r);
  e.permitted.forEach(ah);
  const u = i ? {
    ...i.witnessType,
    TokenPermissions: bi,
    PermitBatchWitnessTransferFrom: [
      { name: "permitted", type: "TokenPermissions[]" },
      { name: "spender", type: "address" },
      { name: "nonce", type: "uint256" },
      { name: "deadline", type: "uint256" },
      { name: "witness", type: i.witnessTypeName }
    ]
  } : GP, c = i ? Object.assign(e, { witness: i.witness }) : e;
  return {
    domain: o,
    types: u,
    message: c
  };
}
function WP(e, n, r, i) {
  return HP(e) ? QP(e, n, r, i) : zP(e, n, r, i);
}
function ah(e) {
  Gr(FP >= e.amount, "AMOUNT_OUT_OF_RANGE");
}
async function $P(e) {
  const { client: n, chain: r, tokenAddress: i, amount: o, data: u, witness: c } = e, l = await MP(n, r, i, o), h = c ? {
    witness: {
      diamondAddress: r.diamondAddress,
      diamondCalldataHash: Ks(u)
    },
    witnessTypeName: "LiFiCall",
    witnessType: {
      LiFiCall: [
        { name: "diamondAddress", type: "address" },
        { name: "diamondCalldataHash", type: "bytes32" }
      ]
    }
  } : void 0, m = WP(l, r.permit2, r.id, h), A = c ? "PermitWitnessTransferFrom" : "PermitTransferFrom", y = await ae(n, ru, "signTypedData")({
    account: n.account,
    primaryType: A,
    domain: m.domain,
    types: m.types,
    message: m.message
  });
  return {
    ...m,
    primaryType: A,
    signature: y
  };
}
const VP = async (e, n, r, i, o) => {
  if (await ae(e, ni, "getChainId")(void 0) === r.action.fromChainId)
    return e;
  r.execution = n.initExecutionObject(r), n.updateExecution(r, "ACTION_REQUIRED");
  let c = n.findOrCreateProcess({
    step: r,
    type: "SWITCH_CHAIN",
    status: "ACTION_REQUIRED"
  });
  if (i)
    try {
      const l = await (o == null ? void 0 : o(r.action.fromChainId));
      let h;
      if (l && (h = await ae(l, ni, "getChainId")(void 0)), h !== r.action.fromChainId)
        throw new Mv(oe.ChainSwitchError, "Chain switch required.");
      return c = n.updateProcess(r, c.type, "DONE"), n.updateExecution(r, "PENDING"), l;
    } catch (l) {
      throw n.updateProcess(r, c.type, "FAILED", {
        error: {
          message: l.message,
          code: oe.ChainSwitchError
        }
      }), n.updateExecution(r, "FAILED"), l;
    }
}, qP = async (e, n) => {
  const { receipts: r, status: i, statusCode: o } = await ae(e, _v, "waitForCallsStatus")({
    id: n,
    timeout: 3e5
  });
  if (i === "success" || // @ts-expect-error: for backwards compatibility
  i === "CONFIRMED") {
    if (!(r != null && r.length) || !r.every((c) => c.transactionHash) || r.some((c) => c.status === "reverted"))
      throw new Le(oe.TransactionFailed, "Transaction was reverted.");
    return r.at(-1);
  }
  throw o >= 400 && o < 500 ? new Le(oe.TransactionCanceled, "Transaction was canceled.") : new Le(oe.TransactionFailed, "Transaction failed.");
}, JP = async (e, n) => jd(async () => {
  var i;
  const r = await Xv({
    taskId: e,
    fromChain: n.action.fromChainId,
    toChain: n.action.toChainId,
    ...n.tool !== "custom" && { bridge: n.tool }
  }).catch((o) => {
    process.env.NODE_ENV;
  });
  switch (r == null ? void 0 : r.status) {
    case "PENDING":
      return;
    case "DONE": {
      const o = (i = r == null ? void 0 : r.transactionStatus) == null ? void 0 : i.sending;
      return {
        status: "success",
        gasUsed: o == null ? void 0 : o.gasUsed,
        transactionHash: r == null ? void 0 : r.metadata.txHash
      };
    }
    case "FAILED":
      throw new Le(oe.TransactionFailed, "Transaction was reverted.");
    default:
      throw new Le(oe.TransactionNotFound, "Transaction not found.");
  }
}, 5e3, 3, (r, i) => !(i instanceof Le));
class KP extends iP {
  constructor(r) {
    super(r);
    re(this, "client");
    // Ensure that we are using the right chain and wallet when executing transactions.
    re(this, "checkClient", async (r, i) => {
      var c, l, h;
      const o = await VP(this.client, this.statusManager, r, this.allowUserInteraction, (c = this.executionOptions) == null ? void 0 : c.switchChainHook);
      o && (this.client = o);
      let u = (l = this.client.account) == null ? void 0 : l.address;
      if (!u) {
        const m = await ae(this.client, Bv, "getAddresses")(void 0);
        u = m == null ? void 0 : m[0];
      }
      if ((u == null ? void 0 : u.toLowerCase()) !== ((h = r.action.fromAddress) == null ? void 0 : h.toLowerCase())) {
        let m = i;
        m || (m = this.statusManager.findOrCreateProcess({
          step: r,
          type: "TRANSACTION"
        }));
        const A = "The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.";
        throw this.statusManager.updateProcess(r, m.type, "FAILED", {
          error: {
            code: oe.WalletChangedDuringExecution,
            message: A
          }
        }), this.statusManager.updateExecution(r, "FAILED"), await Ra(new Le(oe.WalletChangedDuringExecution, A), r, i);
      }
      return o;
    });
    re(this, "waitForTransaction", async ({ step: r, process: i, fromChain: o, toChain: u, txType: c, txHash: l, isBridgeExecution: h }) => {
      let m;
      switch (c) {
        case "batched":
          m = await qP(this.client, l);
          break;
        case "relayed":
          m = await JP(l, r);
          break;
        default:
          m = await rh({
            client: this.client,
            chainId: o.id,
            txHash: l,
            onReplaced: (A) => {
              this.statusManager.updateProcess(r, i.type, "PENDING", {
                txHash: A.transaction.hash,
                txLink: `${o.metamask.blockExplorerUrls[0]}tx/${A.transaction.hash}`
              });
            }
          });
      }
      m != null && m.transactionHash && m.transactionHash !== l && (i = this.statusManager.updateProcess(r, i.type, "PENDING", {
        txHash: m.transactionHash,
        txLink: `${o.metamask.blockExplorerUrls[0]}tx/${m.transactionHash}`
      })), h && (i = this.statusManager.updateProcess(r, i.type, "DONE")), await bl(r, i, o, u, this.statusManager);
    });
    re(this, "executeStep", async (r) => {
      var M, G, ee, H;
      r.execution = this.statusManager.initExecutionObject(r);
      const i = (M = r.execution) == null ? void 0 : M.process.find((Q) => Q.type === "RECEIVING_CHAIN");
      if ((i == null ? void 0 : i.substatus) !== "WAIT_DESTINATION_TRANSACTION" && !await this.checkClient(r))
        return r;
      const o = await ye.getChainById(r.action.fromChainId), u = await ye.getChainById(r.action.toChainId), c = [], l = await CP({
        client: this.client,
        chainId: o.id
      }), h = o.id !== u.id, m = h ? "CROSS_CHAIN" : "SWAP", A = r.execution.process.find((Q) => Q.type === m), y = o.nativeToken.address === r.action.fromToken.address, x = nh(r), T = ((G = this.executionOptions) == null ? void 0 : G.disableMessageSigning) || r.type !== "lifi", I = !!o.permit2 && !!o.permit2Proxy && !l && !y && !T && // Approval address is not required for Permit2 per se, but we use it to skip allowance checks for direct transfers
      !!r.estimate.approvalAddress, _ = (
        // No existing swap/bridge transaction is pending
        !(A != null && A.txHash) && // Token is not native (address is not zero)
        !y && // Approval address is required for allowance checks, but may be null in special cases (e.g. direct transfers)
        !!r.estimate.approvalAddress
      );
      let N;
      if (_) {
        const Q = await _P({
          client: this.client,
          chain: o,
          step: r,
          statusManager: this.statusManager,
          executionOptions: this.executionOptions,
          allowUserInteraction: this.allowUserInteraction,
          batchingSupported: l,
          permit2Supported: I,
          disableMessageSigning: T
        });
        if (Q.status === "BATCH_APPROVAL" && l && c.push(Q.data), Q.status === "NATIVE_PERMIT" && (N = Q.data), Q.status === "ACTION_REQUIRED" && !this.allowUserInteraction)
          return r;
      }
      let S = this.statusManager.findProcess(r, m);
      if ((S == null ? void 0 : S.status) === "DONE")
        return await bl(r, S, o, u, this.statusManager), r;
      try {
        if (S != null && S.txHash) {
          if (!await this.checkClient(r, S))
            return r;
          const ce = S.txHash, me = S.txType;
          return await this.waitForTransaction({
            step: r,
            process: S,
            fromChain: o,
            toChain: u,
            txType: me,
            txHash: ce,
            isBridgeExecution: h
          }), r;
        }
        const Q = !l && !N && I;
        if (S = this.statusManager.findOrCreateProcess({
          step: r,
          type: Q ? "PERMIT" : m,
          status: "STARTED",
          chainId: o.id
        }), await Yd(this.client.account.address, r), !r.transactionRequest) {
          const { execution: Y, ...ce } = r;
          let me;
          x ? me = {
            ...await jv({
              fromChain: ce.action.fromChainId,
              fromToken: ce.action.fromToken.address,
              fromAddress: ce.action.fromAddress,
              fromAmount: ce.action.fromAmount,
              toChain: ce.action.toChainId,
              toToken: ce.action.toToken.address,
              slippage: ce.action.slippage,
              toAddress: ce.action.toAddress,
              allowBridges: [ce.tool]
            }),
            id: ce.id
          } : me = await Kv(ce);
          const Pe = await lP(this.statusManager, r, me, this.allowUserInteraction, this.executionOptions);
          Object.assign(r, {
            ...Pe,
            execution: r.execution
          });
        }
        if (!r.transactionRequest)
          throw new Le(oe.TransactionUnprepared, "Unable to prepare transaction.");
        let F = {
          to: r.transactionRequest.to,
          from: r.transactionRequest.from,
          data: r.transactionRequest.data,
          value: r.transactionRequest.value ? BigInt(r.transactionRequest.value) : void 0,
          gas: r.transactionRequest.gasLimit ? BigInt(r.transactionRequest.gasLimit) : void 0,
          // gasPrice: step.transactionRequest.gasPrice
          //   ? BigInt(step.transactionRequest.gasPrice as string)
          //   : undefined,
          // maxFeePerGas: step.transactionRequest.maxFeePerGas
          //   ? BigInt(step.transactionRequest.maxFeePerGas as string)
          //   : undefined,
          maxPriorityFeePerGas: ((ee = this.client.account) == null ? void 0 : ee.type) === "local" ? await eh(this.client) : r.transactionRequest.maxPriorityFeePerGas ? BigInt(r.transactionRequest.maxPriorityFeePerGas) : void 0
        };
        if ((H = this.executionOptions) != null && H.updateTransactionRequestHook) {
          const Y = await this.executionOptions.updateTransactionRequestHook({
            requestType: "transaction",
            ...F
          });
          F = {
            ...F,
            ...Y
          };
        }
        if (!await this.checkClient(r, S) || (S = this.statusManager.updateProcess(r, S.type, "ACTION_REQUIRED"), !this.allowUserInteraction))
          return r;
        let K, pe = "standard";
        if (l) {
          const Y = {
            chainId: o.id,
            data: F.data,
            to: F.to,
            value: F.value
          };
          c.push(Y);
          const { id: ce } = await ae(this.client, Rv, "sendCalls")({
            account: this.client.account,
            calls: c
          });
          K = ce, pe = "batched";
        } else if (x) {
          const Y = r.typedData.find((be) => be.primaryType === "PermitWitnessTransferFrom" || be.primaryType === "Order");
          if (!Y)
            throw new Le(oe.TransactionUnprepared, "Unable to prepare transaction. Typed data for transfer is not found.");
          const ce = await ae(this.client, ru, "signTypedData")({
            account: this.client.account,
            primaryType: Y.primaryType,
            domain: Y.domain,
            types: Y.types,
            message: Y.message
          });
          this.statusManager.updateProcess(r, S.type, "DONE"), S = this.statusManager.findOrCreateProcess({
            step: r,
            type: m,
            status: "PENDING",
            chainId: o.id
          });
          const me = [
            {
              ...Y,
              signature: ce
            }
          ];
          N && me.unshift(N);
          const { execution: Pe, ...We } = r;
          K = (await Zv({
            ...We,
            typedData: me
          })).taskId, pe = "relayed";
        } else {
          if (N)
            F.data = NP(r.action.fromToken.address, BigInt(r.action.fromAmount), N.message.deadline, N.signature, F.data);
          else if (I) {
            const Y = await $P({
              client: this.client,
              chain: o,
              tokenAddress: r.action.fromToken.address,
              amount: BigInt(r.action.fromAmount),
              data: F.data
            });
            this.statusManager.updateProcess(r, S.type, "DONE"), S = this.statusManager.findOrCreateProcess({
              step: r,
              type: m,
              status: "PENDING",
              chainId: o.id
            }), F.data = OP(r.action.fromToken.address, BigInt(r.action.fromAmount), Y.message.nonce, Y.message.deadline, F.data, Y.signature);
          }
          if (N || I) {
            F.to = o.permit2Proxy;
            try {
              const Y = await Ad(this.client, {
                account: this.client.account,
                to: F.to,
                data: F.data,
                value: F.value
              });
              F.gas = F.gas && F.gas > Y ? F.gas : Y;
            } catch {
            } finally {
              this.statusManager.updateProcess(r, S.type, "DONE");
            }
          }
          S = this.statusManager.updateProcess(r, S.type, "ACTION_REQUIRED"), K = await ae(this.client, Pd, "sendTransaction")({
            to: F.to,
            account: this.client.account,
            data: F.data,
            value: F.value,
            gas: F.gas,
            gasPrice: F.gasPrice,
            maxFeePerGas: F.maxFeePerGas,
            maxPriorityFeePerGas: F.maxPriorityFeePerGas,
            chain: EP(o)
          });
        }
        return S = this.statusManager.updateProcess(
          r,
          S.type,
          "PENDING",
          // When atomic batch or relayer are supported, txHash represents the batch hash or taskId rather than an individual transaction hash
          {
            txHash: K,
            txType: pe,
            txLink: pe === "standard" ? `${o.metamask.blockExplorerUrls[0]}tx/${K}` : void 0
          }
        ), await this.waitForTransaction({
          step: r,
          process: S,
          fromChain: o,
          toChain: u,
          txHash: K,
          txType: pe,
          isBridgeExecution: h
        }), r;
      } catch (Q) {
        const F = await Ra(Q, r, S);
        throw S = this.statusManager.updateProcess(r, (S == null ? void 0 : S.type) || m, "FAILED", {
          error: {
            message: F.cause.message,
            code: F.code
          }
        }), this.statusManager.updateExecution(r, "FAILED"), F;
      }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Izt78aI+WZ6dJlZKp4pGISuv9rV0sAS0MWEwCmfauO7oQZMiakHU35LBxiyJoOMddhUWgcZuC8r4Ksvn75TTcQXLJ7kWtYhGuGqPd9dZuFjBWQHNwosXY5snbHFQq72CvHXhIg+shQxycuLOuWYErwCLZeF24b7F78pO7xw4X6lIAR02hUOf5087Rl0nOaeb6CK4i/KA/EZv76ftOWZtjwxslNr0E/u8rWUmnf3amfg6UZmBAluuoj3Dd7UV+9IAJ6iYcDfSJlgmIImohjfIUMJ27z+opj50Ak9af2LCNrWrBJvMovA1OeNO+MF/MwZvnaCxTgG7Cw4QfSPF6AYCGFt21M8PySZFeV3t2Rqqs5JMzMYzGRgq4o+UaKRgBf9GHi/9X9HXA3wxkCsd/UhnHSh2zUVDiraio/6nP4y3XJqs8ABfALAtCYU7DHPMPRjgcM6Ad/HiSXDAbOdSMkvGZPAkHs8wuQTy6X2Ov/JFvcPuKfV3/r9Q28";
const Tl = /* @__PURE__ */ new Map([[8217, "apostrophe"], [8260, "fraction slash"], [12539, "middle dot"]]), Il = 4;
function jP(e) {
  let n = 0;
  function r() {
    return e[n++] << 8 | e[n++];
  }
  let i = r(), o = 1, u = [0, 1];
  for (let H = 1; H < i; H++)
    u.push(o += r());
  let c = r(), l = n;
  n += c;
  let h = 0, m = 0;
  function A() {
    return h == 0 && (m = m << 8 | e[n++], h = 8), m >> --h & 1;
  }
  const y = 31, x = 2 ** y, T = x >>> 1, I = T >> 1, _ = x - 1;
  let N = 0;
  for (let H = 0; H < y; H++) N = N << 1 | A();
  let S = [], M = 0, G = x;
  for (; ; ) {
    let H = Math.floor(((N - M + 1) * o - 1) / G), Q = 0, F = i;
    for (; F - Q > 1; ) {
      let pe = Q + F >>> 1;
      H < u[pe] ? F = pe : Q = pe;
    }
    if (Q == 0) break;
    S.push(Q);
    let ie = M + Math.floor(G * u[Q] / o), K = M + Math.floor(G * u[Q + 1] / o) - 1;
    for (; ((ie ^ K) & T) == 0; )
      N = N << 1 & _ | A(), ie = ie << 1 & _, K = K << 1 & _ | 1;
    for (; ie & ~K & I; )
      N = N & T | N << 1 & _ >>> 1 | A(), ie = ie << 1 ^ T, K = (K ^ T) << 1 | T | 1;
    M = ie, G = 1 + K - ie;
  }
  let ee = i - 4;
  return S.map((H) => {
    switch (H - ee) {
      case 3:
        return ee + 65792 + (e[l++] << 16 | e[l++] << 8 | e[l++]);
      case 2:
        return ee + 256 + (e[l++] << 8 | e[l++]);
      case 1:
        return ee + e[l++];
      default:
        return H - 1;
    }
  });
}
function ZP(e) {
  let n = 0;
  return () => e[n++];
}
function uh(e) {
  return ZP(jP(XP(e)));
}
function XP(e) {
  let n = [];
  [..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((o, u) => n[o.charCodeAt(0)] = u);
  let r = e.length, i = new Uint8Array(6 * r >> 3);
  for (let o = 0, u = 0, c = 0, l = 0; o < r; o++)
    l = l << 6 | n[e.charCodeAt(o)], c += 6, c >= 8 && (i[u++] = l >> (c -= 8));
  return i;
}
function eT(e) {
  return e & 1 ? ~e >> 1 : e >> 1;
}
function tT(e, n) {
  let r = Array(e);
  for (let i = 0, o = 0; i < e; i++) r[i] = o += eT(n());
  return r;
}
function Hr(e, n = 0) {
  let r = [];
  for (; ; ) {
    let i = e(), o = e();
    if (!o) break;
    n += i;
    for (let u = 0; u < o; u++)
      r.push(n + u);
    n += o + 1;
  }
  return r;
}
function ch(e) {
  return Qr(() => {
    let n = Hr(e);
    if (n.length) return n;
  });
}
function fh(e) {
  let n = [];
  for (; ; ) {
    let r = e();
    if (r == 0) break;
    n.push(nT(r, e));
  }
  for (; ; ) {
    let r = e() - 1;
    if (r < 0) break;
    n.push(rT(r, e));
  }
  return n.flat();
}
function Qr(e) {
  let n = [];
  for (; ; ) {
    let r = e(n.length);
    if (!r) break;
    n.push(r);
  }
  return n;
}
function lh(e, n, r) {
  let i = Array(e).fill().map(() => []);
  for (let o = 0; o < n; o++)
    tT(e, r).forEach((u, c) => i[c].push(u));
  return i;
}
function nT(e, n) {
  let r = 1 + n(), i = n(), o = Qr(n);
  return lh(o.length, 1 + e, n).flatMap((c, l) => {
    let [h, ...m] = c;
    return Array(o[l]).fill().map((A, y) => {
      let x = y * i;
      return [h + y * r, m.map((T) => T + x)];
    });
  });
}
function rT(e, n) {
  let r = 1 + n();
  return lh(r, 1 + e, n).map((o) => [o[0], o.slice(1)]);
}
function sT(e) {
  let n = [], r = Hr(e);
  return o(i([]), []), n;
  function i(u) {
    let c = e(), l = Qr(() => {
      let h = Hr(e).map((m) => r[m]);
      if (h.length) return i(h);
    });
    return { S: c, B: l, Q: u };
  }
  function o({ S: u, B: c }, l, h) {
    if (!(u & 4 && h === l[l.length - 1])) {
      u & 2 && (h = l[l.length - 1]), u & 1 && n.push(l);
      for (let m of c)
        for (let A of m.Q)
          o(m, [...l, A], h);
    }
  }
}
function iT(e) {
  return e.toString(16).toUpperCase().padStart(2, "0");
}
function dh(e) {
  return `{${iT(e)}}`;
}
function oT(e) {
  let n = [];
  for (let r = 0, i = e.length; r < i; ) {
    let o = e.codePointAt(r);
    r += o < 65536 ? 1 : 2, n.push(o);
  }
  return n;
}
function er(e) {
  let r = e.length;
  if (r < 4096) return String.fromCodePoint(...e);
  let i = [];
  for (let o = 0; o < r; )
    i.push(String.fromCodePoint(...e.slice(o, o += 4096)));
  return i.join("");
}
function aT(e, n) {
  let r = e.length, i = r - n.length;
  for (let o = 0; i == 0 && o < r; o++) i = e[o] - n[o];
  return i;
}
var uT = "AEUDVgHLCGMATwDUADIAdAAhADQAFAAtABQAIQAPACcADQASAAoAGAAJABIACQARAAUACwAFAAwABQAQAAMABwAEAAoABQAJAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACwANAA0AAwAKAAkABAAdAAYAZwDTAeYDMwCxCl8B8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT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dgWa5KTgJJNjNwZMfmdnUIUn1JU5LiWX5UZEZbVlKSN76mlmjUR2ku+fucTNlO4IAAahnLjBhlvQNR9pe9swGBgq0YR7P3VCyI/seYwQ4QBzy9X+HPePgoF8WfKaJ4MBOhLCGHae6Z8xkNXwni9QAKvTNtVA56x8YJflZ/VvONRSlsSLmiSyNMnTjTaE1ko81zkzGEnVwEhjCzlwIqpxmpDAqwsEmtpdr3xpc7i/ZX3f2TzT3M0FdxIEQvO1jgmmiN+D1YpMduAzEhBtj2OBkMN/rv6p7Th4pSH6f5aH3aTvwFTl7EOSgGASI7ttyMehzpm4AVyK+bFEaFg9gnZsSUPpsbAe/0RFhrH+EXZ12Z7thf4dzN1+Sn+G8QrDA1VKaN4IFxD1rQz9Xq9Coii9S9/hPbTGjyBwFH3H1UdQuz5KsgPDEHua4/kPg2Gp/IIItsaLWBqiT9XH45MiQxSosGJ56H/0F2cjcCFd72l1665RNHURdC3lspI77esfJsl+rXXabkAy7vxDXG/XGGcKpwiKDPFfvMEgjkAHil4Za1F36RnyxxvdIAzvgfH8knukYDck07tc++DP4TdWeI7HXuq5Yl6VVFrUQtf64/dkXewlKZSHQo6YvCSpREB0GDrz+Ys2GfO8nw2SwrYwaf88AifzlPvP17bf1mI3AuccJvAjZIpBmqvharKFAebEjVKfGAwpQjWoXlm9LROsq9bCk1UeQ3CJxJqprzssS/Q04JeS1ReCCubL3J7sx86spkP4eNpp95UF+8K748icIs8vdILFklk9skQqi1So6cx3X906pvy1vz+KipTJ8fiVJxsV5MmT0XwA";
const zr = 44032, si = 4352, ii = 4449, oi = 4519, hh = 19, ph = 21, tr = 28, ai = ph * tr, cT = hh * ai, fT = zr + cT, lT = si + hh, dT = ii + ph, hT = oi + tr;
function Cr(e) {
  return e >> 24 & 255;
}
function gh(e) {
  return e & 16777215;
}
let Da, Bl, _a, Ys;
function pT() {
  let e = uh(uT);
  Da = new Map(ch(e).flatMap((n, r) => n.map((i) => [i, r + 1 << 24]))), Bl = new Set(Hr(e)), _a = /* @__PURE__ */ new Map(), Ys = /* @__PURE__ */ new Map();
  for (let [n, r] of fh(e)) {
    if (!Bl.has(n) && r.length == 2) {
      let [i, o] = r, u = Ys.get(i);
      u || (u = /* @__PURE__ */ new Map(), Ys.set(i, u)), u.set(o, n);
    }
    _a.set(n, r.reverse());
  }
}
function mh(e) {
  return e >= zr && e < fT;
}
function gT(e, n) {
  if (e >= si && e < lT && n >= ii && n < dT)
    return zr + (e - si) * ai + (n - ii) * tr;
  if (mh(e) && n > oi && n < hT && (e - zr) % tr == 0)
    return e + (n - oi);
  {
    let r = Ys.get(e);
    return r && (r = r.get(n), r) ? r : -1;
  }
}
function Ah(e) {
  Da || pT();
  let n = [], r = [], i = !1;
  function o(u) {
    let c = Da.get(u);
    c && (i = !0, u |= c), n.push(u);
  }
  for (let u of e)
    for (; ; ) {
      if (u < 128)
        n.push(u);
      else if (mh(u)) {
        let c = u - zr, l = c / ai | 0, h = c % ai / tr | 0, m = c % tr;
        o(si + l), o(ii + h), m > 0 && o(oi + m);
      } else {
        let c = _a.get(u);
        c ? r.push(...c) : o(u);
      }
      if (!r.length) break;
      u = r.pop();
    }
  if (i && n.length > 1) {
    let u = Cr(n[0]);
    for (let c = 1; c < n.length; c++) {
      let l = Cr(n[c]);
      if (l == 0 || u <= l) {
        u = l;
        continue;
      }
      let h = c - 1;
      for (; ; ) {
        let m = n[h + 1];
        if (n[h + 1] = n[h], n[h] = m, !h || (u = Cr(n[--h]), u <= l)) break;
      }
      u = Cr(n[c]);
    }
  }
  return n;
}
function mT(e) {
  let n = [], r = [], i = -1, o = 0;
  for (let u of e) {
    let c = Cr(u), l = gh(u);
    if (i == -1)
      c == 0 ? i = l : n.push(l);
    else if (o > 0 && o >= c)
      c == 0 ? (n.push(i, ...r), r.length = 0, i = l) : r.push(l), o = c;
    else {
      let h = gT(i, l);
      h >= 0 ? i = h : o == 0 && c == 0 ? (n.push(i), i = l) : (r.push(l), o = c);
    }
  }
  return i >= 0 && n.push(i, ...r), n;
}
function wh(e) {
  return Ah(e).map(gh);
}
function AT(e) {
  return mT(Ah(e));
}
const Sl = 45, yh = ".", bh = 65039, xh = 1, ui = (e) => Array.from(e);
function Wr(e, n) {
  return e.P.has(n) || e.Q.has(n);
}
class wT extends Array {
  get is_emoji() {
    return !0;
  }
  // free tagging system
}
let Ca, Eh, vn, Na, vh, Yn, ia, Vn, En, Rl, Oa;
function iu() {
  if (Ca) return;
  let e = uh(YP);
  const n = () => Hr(e), r = () => new Set(n()), i = (A, y) => y.forEach((x) => A.add(x));
  Ca = new Map(fh(e)), Eh = r(), vn = n(), Na = new Set(n().map((A) => vn[A])), vn = new Set(vn), vh = r(), r();
  let o = ch(e), u = e();
  const c = () => {
    let A = /* @__PURE__ */ new Set();
    return n().forEach((y) => i(A, o[y])), i(A, n()), A;
  };
  Yn = Qr((A) => {
    let y = Qr(e).map((x) => x + 96);
    if (y.length) {
      let x = A >= u;
      y[0] -= 32, y = er(y), x && (y = `Restricted[${y}]`);
      let T = c(), I = c(), _ = !e();
      return { N: y, P: T, Q: I, M: _, R: x };
    }
  }), ia = r(), Vn = /* @__PURE__ */ new Map();
  let l = n().concat(ui(ia)).sort((A, y) => A - y);
  l.forEach((A, y) => {
    let x = e(), T = l[y] = x ? l[y - x] : { V: [], M: /* @__PURE__ */ new Map() };
    T.V.push(A), ia.has(A) || Vn.set(A, T);
  });
  for (let { V: A, M: y } of new Set(Vn.values())) {
    let x = [];
    for (let I of A) {
      let _ = Yn.filter((S) => Wr(S, I)), N = x.find(({ G: S }) => _.some((M) => S.has(M)));
      N || (N = { G: /* @__PURE__ */ new Set(), V: [] }, x.push(N)), N.V.push(I), i(N.G, _);
    }
    let T = x.flatMap((I) => ui(I.G));
    for (let { G: I, V: _ } of x) {
      let N = new Set(T.filter((S) => !I.has(S)));
      for (let S of _)
        y.set(S, N);
    }
  }
  En = /* @__PURE__ */ new Set();
  let h = /* @__PURE__ */ new Set();
  const m = (A) => En.has(A) ? h.add(A) : En.add(A);
  for (let A of Yn) {
    for (let y of A.P) m(y);
    for (let y of A.Q) m(y);
  }
  for (let A of En)
    !Vn.has(A) && !h.has(A) && Vn.set(A, xh);
  i(En, wh(En)), Rl = sT(e).map((A) => wT.from(A)).sort(aT), Oa = /* @__PURE__ */ new Map();
  for (let A of Rl) {
    let y = [Oa];
    for (let x of A) {
      let T = y.map((I) => {
        let _ = I.get(x);
        return _ || (_ = /* @__PURE__ */ new Map(), I.set(x, _)), _;
      });
      x === bh ? y.push(...T) : y = T;
    }
    for (let x of y)
      x.V = A;
  }
}
function ou(e) {
  return (Ph(e) ? "" : `${au(xi([e]))} `) + dh(e);
}
function au(e) {
  return `"${e}"‎`;
}
function yT(e) {
  if (e.length >= 4 && e[2] == Sl && e[3] == Sl)
    throw new Error(`invalid label extension: "${er(e.slice(0, 4))}"`);
}
function bT(e) {
  for (let r = e.lastIndexOf(95); r > 0; )
    if (e[--r] !== 95)
      throw new Error("underscore allowed only at start");
}
function xT(e) {
  let n = e[0], r = Tl.get(n);
  if (r) throw Or(`leading ${r}`);
  let i = e.length, o = -1;
  for (let u = 1; u < i; u++) {
    n = e[u];
    let c = Tl.get(n);
    if (c) {
      if (o == u) throw Or(`${r} + ${c}`);
      o = u + 1, r = c;
    }
  }
  if (o == i) throw Or(`trailing ${r}`);
}
function xi(e, n = 1 / 0, r = dh) {
  let i = [];
  ET(e[0]) && i.push("◌"), e.length > n && (n >>= 1, e = [...e.slice(0, n), 8230, ...e.slice(-n)]);
  let o = 0, u = e.length;
  for (let c = 0; c < u; c++) {
    let l = e[c];
    Ph(l) && (i.push(er(e.slice(o, c))), i.push(r(l)), o = c + 1);
  }
  return i.push(er(e.slice(o, u))), i.join("");
}
function ET(e, n) {
  return iu(), vn.has(e);
}
function Ph(e) {
  return iu(), vh.has(e);
}
function vT(e) {
  return BT(PT(e, AT, DT));
}
function PT(e, n, r) {
  if (!e) return [];
  iu();
  let i = 0;
  return e.split(yh).map((o) => {
    let u = oT(o), c = {
      input: u,
      offset: i
      // codepoint, not substring!
    };
    i += u.length + 1;
    try {
      let l = c.tokens = RT(u, n, r), h = l.length, m;
      if (!h)
        throw new Error("empty label");
      let A = c.output = l.flat();
      if (bT(A), !(c.emoji = h > 1 || l[0].is_emoji) && A.every((x) => x < 128))
        yT(A), m = "ASCII";
      else {
        let x = l.flatMap((T) => T.is_emoji ? [] : T);
        if (!x.length)
          m = "Emoji";
        else {
          if (vn.has(A[0])) throw Or("leading combining mark");
          for (let _ = 1; _ < h; _++) {
            let N = l[_];
            if (!N.is_emoji && vn.has(N[0]))
              throw Or(`emoji + combining mark: "${er(l[_ - 1])} + ${xi([N[0]])}"`);
          }
          xT(A);
          let T = ui(new Set(x)), [I] = IT(T);
          ST(I, x), TT(I, T), m = I.N;
        }
      }
      c.type = m;
    } catch (l) {
      c.error = l;
    }
    return c;
  });
}
function TT(e, n) {
  let r, i = [];
  for (let o of n) {
    let u = Vn.get(o);
    if (u === xh) return;
    if (u) {
      let c = u.M.get(o);
      if (r = r ? r.filter((l) => c.has(l)) : ui(c), !r.length) return;
    } else
      i.push(o);
  }
  if (r) {
    for (let o of r)
      if (i.every((u) => Wr(o, u)))
        throw new Error(`whole-script confusable: ${e.N}/${o.N}`);
  }
}
function IT(e) {
  let n = Yn;
  for (let r of e) {
    let i = n.filter((o) => Wr(o, r));
    if (!i.length)
      throw Yn.some((o) => Wr(o, r)) ? Ih(n[0], r) : Th(r);
    if (n = i, i.length == 1) break;
  }
  return n;
}
function BT(e) {
  return e.map(({ input: n, error: r, output: i }) => {
    if (r) {
      let o = r.message;
      throw new Error(e.length == 1 ? o : `Invalid label ${au(xi(n, 63))}: ${o}`);
    }
    return er(i);
  }).join(yh);
}
function Th(e) {
  return new Error(`disallowed character: ${ou(e)}`);
}
function Ih(e, n) {
  let r = ou(n), i = Yn.find((o) => o.P.has(n));
  return i && (r = `${i.N} ${r}`), new Error(`illegal mixture: ${e.N} + ${r}`);
}
function Or(e) {
  return new Error(`illegal placement: ${e}`);
}
function ST(e, n) {
  for (let r of n)
    if (!Wr(e, r))
      throw Ih(e, r);
  if (e.M) {
    let r = wh(n);
    for (let i = 1, o = r.length; i < o; i++)
      if (Na.has(r[i])) {
        let u = i + 1;
        for (let c; u < o && Na.has(c = r[u]); u++)
          for (let l = i; l < u; l++)
            if (r[l] == c)
              throw new Error(`duplicate non-spacing marks: ${ou(c)}`);
        if (u - i > Il)
          throw new Error(`excessive non-spacing marks: ${au(xi(r.slice(i - 1, u)))} (${u - i}/${Il})`);
        i = u;
      }
  }
}
function RT(e, n, r) {
  let i = [], o = [];
  for (e = e.slice().reverse(); e.length; ) {
    let u = _T(e);
    if (u)
      o.length && (i.push(n(o)), o = []), i.push(r(u));
    else {
      let c = e.pop();
      if (En.has(c))
        o.push(c);
      else {
        let l = Ca.get(c);
        if (l)
          o.push(...l);
        else if (!Eh.has(c))
          throw Th(c);
      }
    }
  }
  return o.length && i.push(n(o)), i;
}
function DT(e) {
  return e.filter((n) => n != bh);
}
function _T(e, n) {
  let r = Oa, i, o = e.length;
  for (; o && (r = r.get(e[--o]), !!r); ) {
    let { V: u } = r;
    u && (i = u, e.length = o);
  }
  return i;
}
var Js = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function CT(e) {
  return vT(e);
}
function NT(e) {
  return CT(e);
}
const OT = async (e) => {
  try {
    const n = await Yr(Mr.ETH);
    return await uv(n, {
      name: NT(e)
    });
  } catch {
    return;
  }
}, MT = async (e, n) => {
  if (n.length === 0)
    return [];
  const { chainId: r } = n[0];
  for (const o of n)
    o.chainId;
  const i = await th(r);
  return i && n.length > 1 ? UT(r, n, e, i) : FT(r, n, e);
}, UT = async (e, n, r, i) => {
  const o = await Yr(e), u = n.map((h) => Zd(h.address) ? {
    address: i,
    abi: wP,
    functionName: "getEthBalance",
    args: [r]
  } : {
    address: h.address,
    abi: Xd,
    functionName: "balanceOf",
    args: [r]
  }), c = await nu(o), l = await Vd(o, {
    contracts: u,
    multicallAddress: i,
    blockNumber: c
  });
  return l.length ? n.map((h, m) => ({
    ...h,
    amount: l[m].result,
    blockNumber: c
  })) : [];
}, FT = async (e, n, r) => {
  const i = await Yr(e), o = await nu(i), u = n.map((h) => Zd(h.address) ? md(i, {
    address: r
  }) : ir(i, {
    address: h.address,
    abi: Xd,
    functionName: "balanceOf",
    args: [r]
  })), c = await Promise.allSettled(u);
  return n.map((h, m) => {
    const A = c[m];
    return A.status === "rejected" ? {
      ...h,
      blockNumber: o
    } : {
      ...h,
      amount: A.value,
      blockNumber: o
    };
  });
};
function y2(e) {
  const n = e ?? {};
  return {
    get type() {
      return Qt.EVM;
    },
    get options() {
      return n;
    },
    isAddress: Eb,
    resolveAddress: OT,
    getBalance: MT,
    getWalletClient: n.getWalletClient,
    async getStepExecutor(r) {
      var u;
      if (!n.getWalletClient)
        throw new Error("Client is not provided.");
      const i = await n.getWalletClient();
      return new KP({
        client: i,
        routeId: r.routeId,
        executionOptions: {
          ...r.executionOptions,
          switchChainHook: n.switchChain ?? ((u = r.executionOptions) == null ? void 0 : u.switchChainHook)
        }
      });
    },
    setOptions(r) {
      Object.assign(n, r);
    }
  };
}
const kT = async (e) => {
  for (let n = 0; n < e.steps.length; n++) {
    const r = e.steps[n];
    if (r.execution) {
      const i = r.execution.process.findLastIndex((o) => !!o.txHash && o.status !== "FAILED");
      i >= 0 ? r.execution.process = r.execution.process.slice(0, i + 1) : r.execution.process = [];
    }
    r.transactionRequest = void 0;
  }
}, Bh = async (e, n) => {
  var o;
  const r = structuredClone(e);
  let i = (o = It.get(r.id)) == null ? void 0 : o.promise;
  return i || (It.create({ route: r, executionOptions: n }), i = GT(r), It.update({
    route: r,
    promise: i
  }), i);
}, LT = async (e, n) => {
  const r = It.get(e.id);
  if (r && !r.executors.some((o) => !o.allowExecution)) {
    if (uu(e, {
      executeInBackground: n == null ? void 0 : n.executeInBackground
    }), !r.promise)
      throw new Error("Route execution promise not found.");
    return r.promise;
  }
  return await kT(e), Bh(e, n);
}, GT = async (e) => {
  var n, r, i, o;
  for (let u = 0; u < e.steps.length; u++) {
    const c = It.get(e.id);
    if (!c)
      break;
    const l = e.steps[u], h = e.steps[u - 1];
    if (((n = l.execution) == null ? void 0 : n.status) !== "DONE") {
      (r = h == null ? void 0 : h.execution) != null && r.toAmount && (l.action.fromAmount = h.execution.toAmount, (i = l.includedSteps) != null && i.length && (l.includedSteps[0].action.fromAmount = h.execution.toAmount));
      try {
        const m = l.action.fromAddress;
        if (!m)
          throw new Error("Action fromAddress is not specified.");
        const A = ye.get().providers.find((T) => T.isAddress(m));
        if (!A)
          throw new Error("SDK Execution Provider not found.");
        const y = await A.getStepExecutor({
          routeId: e.id,
          executionOptions: c.executionOptions
        });
        if (c.executors.push(y), c.executionOptions && uu(e, c.executionOptions), ((o = (await y.executeStep(l)).execution) == null ? void 0 : o.status) !== "DONE" && Ma(e), !y.allowExecution)
          return e;
      } catch (m) {
        throw Ma(e), m;
      }
    }
  }
  return It.delete(e.id), e;
}, uu = (e, n) => {
  const r = It.get(e.id);
  if (r) {
    if ("executeInBackground" in n)
      for (const i of r.executors)
        i.setInteraction({
          allowInteraction: !(n != null && n.executeInBackground),
          allowUpdates: !0
        });
    r.executionOptions = {
      ...r.executionOptions,
      ...n
    };
  }
}, Ma = (e) => {
  const n = It.get(e.id);
  if (!n)
    return e;
  for (const r of n.executors)
    r.setInteraction({
      allowInteraction: !1,
      allowUpdates: !1,
      allowExecution: !1
    });
  return It.delete(e.id), n.route;
}, HT = async (e, n) => {
  try {
    (await (await fetch(`https://registry.npmjs.org/${e ?? Jd}/latest`)).json()).version > (n ?? kr);
  } catch {
  }
};
function QT(e) {
  if (!e.integrator)
    throw new Error("Integrator not found. Please see documentation https://docs.li.fi/integrate-li.fi-js-sdk/set-up-the-sdk");
  const n = ye.set(e);
  return !e.disableVersionCheck && process.env.NODE_ENV === "development" && HT(Jd, kr), n;
}
async function zT() {
  ye.loading = Kd({
    chainTypes: [Qt.EVM, Qt.SVM, Qt.UTXO, Qt.MVM]
  }).then((e) => ye.setChains(e)).catch(), await ye.loading;
}
function WT(e) {
  const n = QT(e);
  return n.preloadChains && zT(), n;
}
const $T = (e) => {
  var r;
  if (!e.estimate.fromAmountUSD)
    throw new Bt(new qt("Missing 'fromAmountUSD' in step estimate."));
  if (!e.estimate.toAmountUSD)
    throw new Bt(new qt("Missing 'toAmountUSD' in step estimate."));
  return {
    id: e.id,
    fromChainId: e.action.fromToken.chainId,
    fromToken: e.action.fromToken,
    fromAmount: e.action.fromAmount,
    fromAmountUSD: e.estimate.fromAmountUSD,
    fromAddress: e.action.fromAddress,
    toChainId: e.action.toToken.chainId,
    toToken: e.action.toToken,
    toAmount: e.estimate.toAmount,
    toAmountMin: e.estimate.toAmountMin,
    toAmountUSD: e.estimate.toAmountUSD,
    toAddress: e.action.toAddress || e.action.fromAddress,
    gasCostUSD: (r = e.estimate.gasCosts) == null ? void 0 : r[0].amountUSD,
    steps: [e],
    insurance: { state: "NOT_INSURABLE", feeAmountUsd: "0" }
  };
};
function b2(e) {
  if (!e.integrator)
    throw new Error("Integrator name is required");
  return Tn.set(e);
}
const Tn = /* @__PURE__ */ (() => {
  const e = {
    integrator: "zksync easy-onramp",
    apiUrl: "https://easy-onramp-api.zksync.dev/api",
    services: [],
    provider: null,
    dev: !1
  };
  return {
    get() {
      return e;
    },
    set(n) {
      const { ...r } = n;
      return Object.assign(e, r), n.provider && WT({
        integrator: "ZKsync Easy OnRamp",
        providers: [n.provider]
      }), e;
    }
  };
})();
async function x2(e) {
  const n = Tn.get().apiUrl, r = new URL(`${n}/quotes`), i = new URLSearchParams();
  i.append("to", e.toAddress), i.append("chainId", e.chainId.toString()), i.append("token", e.toToken), i.append("routeType", "buy");
  const o = Tn.get().services;
  return o.length > 0 && i.append("services", o.join(",")), e.fiatCurrency && i.append("fiatCurrency", e.fiatCurrency), e.fiatAmount && i.append("fiatAmount", e.fiatAmount.toString()), Tn.get().dev && i.append("dev", "true"), await fetch(`${r}?${i.toString()}`).then((c) => c.json()).then((c) => c).catch((c) => {
    throw c;
  });
}
async function E2() {
  const e = Tn.get().apiUrl, n = new URL(`${e}/config`);
  return await fetch(n).then((i) => i.json()).then((i) => i).catch((i) => {
    throw i;
  });
}
var Nr = { exports: {} };
/**
 * @license
 * Lodash <https://lodash.com/>
 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */
var VT = Nr.exports, Dl;
function qT() {
  return Dl || (Dl = 1, function(e, n) {
    (function() {
      var r, i = "4.17.21", o = 200, u = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", c = "Expected a function", l = "Invalid `variable` option passed into `_.template`", h = "__lodash_hash_undefined__", m = 500, A = "__lodash_placeholder__", y = 1, x = 2, T = 4, I = 1, _ = 2, N = 1, S = 2, M = 4, G = 8, ee = 16, H = 32, Q = 64, F = 128, ie = 256, K = 512, pe = 30, Y = "...", ce = 800, me = 16, Pe = 1, We = 2, $e = 3, be = 1 / 0, Ee = 9007199254740991, Ue = 17976931348623157e292, Rt = NaN, dt = 4294967295, or = dt - 1, Ei = dt >>> 1, jr = [
        ["ary", F],
        ["bind", N],
        ["bindKey", S],
        ["curry", G],
        ["curryRight", ee],
        ["flip", K],
        ["partial", H],
        ["partialRight", Q],
        ["rearg", ie]
      ], Ge = "[object Arguments]", Zr = "[object Array]", Dh = "[object AsyncFunction]", ar = "[object Boolean]", ur = "[object Date]", _h = "[object DOMException]", Xr = "[object Error]", es = "[object Function]", cu = "[object GeneratorFunction]", ht = "[object Map]", cr = "[object Number]", Ch = "[object Null]", Dt = "[object Object]", fu = "[object Promise]", Nh = "[object Proxy]", fr = "[object RegExp]", pt = "[object Set]", lr = "[object String]", ts = "[object Symbol]", Oh = "[object Undefined]", dr = "[object WeakMap]", Mh = "[object WeakSet]", hr = "[object ArrayBuffer]", Dn = "[object DataView]", vi = "[object Float32Array]", Pi = "[object Float64Array]", Ti = "[object Int8Array]", Ii = "[object Int16Array]", Bi = "[object Int32Array]", Si = "[object Uint8Array]", Ri = "[object Uint8ClampedArray]", Di = "[object Uint16Array]", _i = "[object Uint32Array]", Uh = /\b__p \+= '';/g, Fh = /\b(__p \+=) '' \+/g, kh = /(__e\(.*?\)|\b__t\)) \+\n'';/g, lu = /&(?:amp|lt|gt|quot|#39);/g, du = /[&<>"']/g, Lh = RegExp(lu.source), Gh = RegExp(du.source), Hh = /<%-([\s\S]+?)%>/g, Qh = /<%([\s\S]+?)%>/g, hu = /<%=([\s\S]+?)%>/g, zh = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Wh = /^\w*$/, $h = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Ci = /[\\^$.*+?()[\]{}|]/g, Vh = RegExp(Ci.source), Ni = /^\s+/, qh = /\s/, Jh = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, Kh = /\{\n\/\* \[wrapped with (.+)\] \*/, Yh = /,? & /, jh = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, Zh = /[()=,{}\[\]\/\s]/, Xh = /\\(\\)?/g, ep = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, pu = /\w*$/, tp = /^[-+]0x[0-9a-f]+$/i, np = /^0b[01]+$/i, rp = /^\[object .+?Constructor\]$/, sp = /^0o[0-7]+$/i, ip = /^(?:0|[1-9]\d*)$/, op = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, ns = /($^)/, ap = /['\n\r\u2028\u2029\\]/g, rs = "\\ud800-\\udfff", up = "\\u0300-\\u036f", cp = "\\ufe20-\\ufe2f", fp = "\\u20d0-\\u20ff", gu = up + cp + fp, mu = "\\u2700-\\u27bf", Au = "a-z\\xdf-\\xf6\\xf8-\\xff", lp = "\\xac\\xb1\\xd7\\xf7", dp = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", hp = "\\u2000-\\u206f", pp = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", wu = "A-Z\\xc0-\\xd6\\xd8-\\xde", yu = "\\ufe0e\\ufe0f", bu = lp + dp + hp + pp, Oi = "['’]", gp = "[" + rs + "]", xu = "[" + bu + "]", ss = "[" + gu + "]", Eu = "\\d+", mp = "[" + mu + "]", vu = "[" + Au + "]", Pu = "[^" + rs + bu + Eu + mu + Au + wu + "]", Mi = "\\ud83c[\\udffb-\\udfff]", Ap = "(?:" + ss + "|" + Mi + ")", Tu = "[^" + rs + "]", Ui = "(?:\\ud83c[\\udde6-\\uddff]){2}", Fi = "[\\ud800-\\udbff][\\udc00-\\udfff]", _n = "[" + wu + "]", Iu = "\\u200d", Bu = "(?:" + vu + "|" + Pu + ")", wp = "(?:" + _n + "|" + Pu + ")", Su = "(?:" + Oi + "(?:d|ll|m|re|s|t|ve))?", Ru = "(?:" + Oi + "(?:D|LL|M|RE|S|T|VE))?", Du = Ap + "?", _u = "[" + yu + "]?", yp = "(?:" + Iu + "(?:" + [Tu, Ui, Fi].join("|") + ")" + _u + Du + ")*", bp = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", xp = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", Cu = _u + Du + yp, Ep = "(?:" + [mp, Ui, Fi].join("|") + ")" + Cu, vp = "(?:" + [Tu + ss + "?", ss, Ui, Fi, gp].join("|") + ")", Pp = RegExp(Oi, "g"), Tp = RegExp(ss, "g"), ki = RegExp(Mi + "(?=" + Mi + ")|" + vp + Cu, "g"), Ip = RegExp([
        _n + "?" + vu + "+" + Su + "(?=" + [xu, _n, "$"].join("|") + ")",
        wp + "+" + Ru + "(?=" + [xu, _n + Bu, "$"].join("|") + ")",
        _n + "?" + Bu + "+" + Su,
        _n + "+" + Ru,
        xp,
        bp,
        Eu,
        Ep
      ].join("|"), "g"), Bp = RegExp("[" + Iu + rs + gu + yu + "]"), Sp = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, Rp = [
        "Array",
        "Buffer",
        "DataView",
        "Date",
        "Error",
        "Float32Array",
        "Float64Array",
        "Function",
        "Int8Array",
        "Int16Array",
        "Int32Array",
        "Map",
        "Math",
        "Object",
        "Promise",
        "RegExp",
        "Set",
        "String",
        "Symbol",
        "TypeError",
        "Uint8Array",
        "Uint8ClampedArray",
        "Uint16Array",
        "Uint32Array",
        "WeakMap",
        "_",
        "clearTimeout",
        "isFinite",
        "parseInt",
        "setTimeout"
      ], Dp = -1, ge = {};
      ge[vi] = ge[Pi] = ge[Ti] = ge[Ii] = ge[Bi] = ge[Si] = ge[Ri] = ge[Di] = ge[_i] = !0, ge[Ge] = ge[Zr] = ge[hr] = ge[ar] = ge[Dn] = ge[ur] = ge[Xr] = ge[es] = ge[ht] = ge[cr] = ge[Dt] = ge[fr] = ge[pt] = ge[lr] = ge[dr] = !1;
      var he = {};
      he[Ge] = he[Zr] = he[hr] = he[Dn] = he[ar] = he[ur] = he[vi] = he[Pi] = he[Ti] = he[Ii] = he[Bi] = he[ht] = he[cr] = he[Dt] = he[fr] = he[pt] = he[lr] = he[ts] = he[Si] = he[Ri] = he[Di] = he[_i] = !0, he[Xr] = he[es] = he[dr] = !1;
      var _p = {
        // Latin-1 Supplement block.
        À: "A",
        Á: "A",
        Â: "A",
        Ã: "A",
        Ä: "A",
        Å: "A",
        à: "a",
        á: "a",
        â: "a",
        ã: "a",
        ä: "a",
        å: "a",
        Ç: "C",
        ç: "c",
        Ð: "D",
        ð: "d",
        È: "E",
        É: "E",
        Ê: "E",
        Ë: "E",
        è: "e",
        é: "e",
        ê: "e",
        ë: "e",
        Ì: "I",
        Í: "I",
        Î: "I",
        Ï: "I",
        ì: "i",
        í: "i",
        î: "i",
        ï: "i",
        Ñ: "N",
        ñ: "n",
        Ò: "O",
        Ó: "O",
        Ô: "O",
        Õ: "O",
        Ö: "O",
        Ø: "O",
        ò: "o",
        ó: "o",
        ô: "o",
        õ: "o",
        ö: "o",
        ø: "o",
        Ù: "U",
        Ú: "U",
        Û: "U",
        Ü: "U",
        ù: "u",
        ú: "u",
        û: "u",
        ü: "u",
        Ý: "Y",
        ý: "y",
        ÿ: "y",
        Æ: "Ae",
        æ: "ae",
        Þ: "Th",
        þ: "th",
        ß: "ss",
        // Latin Extended-A block.
        Ā: "A",
        Ă: "A",
        Ą: "A",
        ā: "a",
        ă: "a",
        ą: "a",
        Ć: "C",
        Ĉ: "C",
        Ċ: "C",
        Č: "C",
        ć: "c",
        ĉ: "c",
        ċ: "c",
        č: "c",
        Ď: "D",
        Đ: "D",
        ď: "d",
        đ: "d",
        Ē: "E",
        Ĕ: "E",
        Ė: "E",
        Ę: "E",
        Ě: "E",
        ē: "e",
        ĕ: "e",
        ė: "e",
        ę: "e",
        ě: "e",
        Ĝ: "G",
        Ğ: "G",
        Ġ: "G",
        Ģ: "G",
        ĝ: "g",
        ğ: "g",
        ġ: "g",
        ģ: "g",
        Ĥ: "H",
        Ħ: "H",
        ĥ: "h",
        ħ: "h",
        Ĩ: "I",
        Ī: "I",
        Ĭ: "I",
        Į: "I",
        İ: "I",
        ĩ: "i",
        ī: "i",
        ĭ: "i",
        į: "i",
        ı: "i",
        Ĵ: "J",
        ĵ: "j",
        Ķ: "K",
        ķ: "k",
        ĸ: "k",
        Ĺ: "L",
        Ļ: "L",
        Ľ: "L",
        Ŀ: "L",
        Ł: "L",
        ĺ: "l",
        ļ: "l",
        ľ: "l",
        ŀ: "l",
        ł: "l",
        Ń: "N",
        Ņ: "N",
        Ň: "N",
        Ŋ: "N",
        ń: "n",
        ņ: "n",
        ň: "n",
        ŋ: "n",
        Ō: "O",
        Ŏ: "O",
        Ő: "O",
        ō: "o",
        ŏ: "o",
        ő: "o",
        Ŕ: "R",
        Ŗ: "R",
        Ř: "R",
        ŕ: "r",
        ŗ: "r",
        ř: "r",
        Ś: "S",
        Ŝ: "S",
        Ş: "S",
        Š: "S",
        ś: "s",
        ŝ: "s",
        ş: "s",
        š: "s",
        Ţ: "T",
        Ť: "T",
        Ŧ: "T",
        ţ: "t",
        ť: "t",
        ŧ: "t",
        Ũ: "U",
        Ū: "U",
        Ŭ: "U",
        Ů: "U",
        Ű: "U",
        Ų: "U",
        ũ: "u",
        ū: "u",
        ŭ: "u",
        ů: "u",
        ű: "u",
        ų: "u",
        Ŵ: "W",
        ŵ: "w",
        Ŷ: "Y",
        ŷ: "y",
        Ÿ: "Y",
        Ź: "Z",
        Ż: "Z",
        Ž: "Z",
        ź: "z",
        ż: "z",
        ž: "z",
        IJ: "IJ",
        ij: "ij",
        Œ: "Oe",
        œ: "oe",
        ʼn: "'n",
        ſ: "s"
      }, Cp = {
        "&": "&amp;",
        "<": "&lt;",
        ">": "&gt;",
        '"': "&quot;",
        "'": "&#39;"
      }, Np = {
        "&amp;": "&",
        "&lt;": "<",
        "&gt;": ">",
        "&quot;": '"',
        "&#39;": "'"
      }, Op = {
        "\\": "\\",
        "'": "'",
        "\n": "n",
        "\r": "r",
        "\u2028": "u2028",
        "\u2029": "u2029"
      }, Mp = parseFloat, Up = parseInt, Nu = typeof Js == "object" && Js && Js.Object === Object && Js, Fp = typeof self == "object" && self && self.Object === Object && self, Ce = Nu || Fp || Function("return this")(), Li = n && !n.nodeType && n, hn = Li && !0 && e && !e.nodeType && e, Ou = hn && hn.exports === Li, Gi = Ou && Nu.process, rt = function() {
        try {
          var E = hn && hn.require && hn.require("util").types;
          return E || Gi && Gi.binding && Gi.binding("util");
        } catch {
        }
      }(), Mu = rt && rt.isArrayBuffer, Uu = rt && rt.isDate, Fu = rt && rt.isMap, ku = rt && rt.isRegExp, Lu = rt && rt.isSet, Gu = rt && rt.isTypedArray;
      function je(E, B, P) {
        switch (P.length) {
          case 0:
            return E.call(B);
          case 1:
            return E.call(B, P[0]);
          case 2:
            return E.call(B, P[0], P[1]);
          case 3:
            return E.call(B, P[0], P[1], P[2]);
        }
        return E.apply(B, P);
      }
      function kp(E, B, P, k) {
        for (var V = -1, ue = E == null ? 0 : E.length; ++V < ue; ) {
          var Se = E[V];
          B(k, Se, P(Se), E);
        }
        return k;
      }
      function st(E, B) {
        for (var P = -1, k = E == null ? 0 : E.length; ++P < k && B(E[P], P, E) !== !1; )
          ;
        return E;
      }
      function Lp(E, B) {
        for (var P = E == null ? 0 : E.length; P-- && B(E[P], P, E) !== !1; )
          ;
        return E;
      }
      function Hu(E, B) {
        for (var P = -1, k = E == null ? 0 : E.length; ++P < k; )
          if (!B(E[P], P, E))
            return !1;
        return !0;
      }
      function Yt(E, B) {
        for (var P = -1, k = E == null ? 0 : E.length, V = 0, ue = []; ++P < k; ) {
          var Se = E[P];
          B(Se, P, E) && (ue[V++] = Se);
        }
        return ue;
      }
      function is(E, B) {
        var P = E == null ? 0 : E.length;
        return !!P && Cn(E, B, 0) > -1;
      }
      function Hi(E, B, P) {
        for (var k = -1, V = E == null ? 0 : E.length; ++k < V; )
          if (P(B, E[k]))
            return !0;
        return !1;
      }
      function Ae(E, B) {
        for (var P = -1, k = E == null ? 0 : E.length, V = Array(k); ++P < k; )
          V[P] = B(E[P], P, E);
        return V;
      }
      function jt(E, B) {
        for (var P = -1, k = B.length, V = E.length; ++P < k; )
          E[V + P] = B[P];
        return E;
      }
      function Qi(E, B, P, k) {
        var V = -1, ue = E == null ? 0 : E.length;
        for (k && ue && (P = E[++V]); ++V < ue; )
          P = B(P, E[V], V, E);
        return P;
      }
      function Gp(E, B, P, k) {
        var V = E == null ? 0 : E.length;
        for (k && V && (P = E[--V]); V--; )
          P = B(P, E[V], V, E);
        return P;
      }
      function zi(E, B) {
        for (var P = -1, k = E == null ? 0 : E.length; ++P < k; )
          if (B(E[P], P, E))
            return !0;
        return !1;
      }
      var Hp = Wi("length");
      function Qp(E) {
        return E.split("");
      }
      function zp(E) {
        return E.match(jh) || [];
      }
      function Qu(E, B, P) {
        var k;
        return P(E, function(V, ue, Se) {
          if (B(V, ue, Se))
            return k = ue, !1;
        }), k;
      }
      function os(E, B, P, k) {
        for (var V = E.length, ue = P + (k ? 1 : -1); k ? ue-- : ++ue < V; )
          if (B(E[ue], ue, E))
            return ue;
        return -1;
      }
      function Cn(E, B, P) {
        return B === B ? tg(E, B, P) : os(E, zu, P);
      }
      function Wp(E, B, P, k) {
        for (var V = P - 1, ue = E.length; ++V < ue; )
          if (k(E[V], B))
            return V;
        return -1;
      }
      function zu(E) {
        return E !== E;
      }
      function Wu(E, B) {
        var P = E == null ? 0 : E.length;
        return P ? Vi(E, B) / P : Rt;
      }
      function Wi(E) {
        return function(B) {
          return B == null ? r : B[E];
        };
      }
      function $i(E) {
        return function(B) {
          return E == null ? r : E[B];
        };
      }
      function $u(E, B, P, k, V) {
        return V(E, function(ue, Se, de) {
          P = k ? (k = !1, ue) : B(P, ue, Se, de);
        }), P;
      }
      function $p(E, B) {
        var P = E.length;
        for (E.sort(B); P--; )
          E[P] = E[P].value;
        return E;
      }
      function Vi(E, B) {
        for (var P, k = -1, V = E.length; ++k < V; ) {
          var ue = B(E[k]);
          ue !== r && (P = P === r ? ue : P + ue);
        }
        return P;
      }
      function qi(E, B) {
        for (var P = -1, k = Array(E); ++P < E; )
          k[P] = B(P);
        return k;
      }
      function Vp(E, B) {
        return Ae(B, function(P) {
          return [P, E[P]];
        });
      }
      function Vu(E) {
        return E && E.slice(0, Yu(E) + 1).replace(Ni, "");
      }
      function Ze(E) {
        return function(B) {
          return E(B);
        };
      }
      function Ji(E, B) {
        return Ae(B, function(P) {
          return E[P];
        });
      }
      function pr(E, B) {
        return E.has(B);
      }
      function qu(E, B) {
        for (var P = -1, k = E.length; ++P < k && Cn(B, E[P], 0) > -1; )
          ;
        return P;
      }
      function Ju(E, B) {
        for (var P = E.length; P-- && Cn(B, E[P], 0) > -1; )
          ;
        return P;
      }
      function qp(E, B) {
        for (var P = E.length, k = 0; P--; )
          E[P] === B && ++k;
        return k;
      }
      var Jp = $i(_p), Kp = $i(Cp);
      function Yp(E) {
        return "\\" + Op[E];
      }
      function jp(E, B) {
        return E == null ? r : E[B];
      }
      function Nn(E) {
        return Bp.test(E);
      }
      function Zp(E) {
        return Sp.test(E);
      }
      function Xp(E) {
        for (var B, P = []; !(B = E.next()).done; )
          P.push(B.value);
        return P;
      }
      function Ki(E) {
        var B = -1, P = Array(E.size);
        return E.forEach(function(k, V) {
          P[++B] = [V, k];
        }), P;
      }
      function Ku(E, B) {
        return function(P) {
          return E(B(P));
        };
      }
      function Zt(E, B) {
        for (var P = -1, k = E.length, V = 0, ue = []; ++P < k; ) {
          var Se = E[P];
          (Se === B || Se === A) && (E[P] = A, ue[V++] = P);
        }
        return ue;
      }
      function as(E) {
        var B = -1, P = Array(E.size);
        return E.forEach(function(k) {
          P[++B] = k;
        }), P;
      }
      function eg(E) {
        var B = -1, P = Array(E.size);
        return E.forEach(function(k) {
          P[++B] = [k, k];
        }), P;
      }
      function tg(E, B, P) {
        for (var k = P - 1, V = E.length; ++k < V; )
          if (E[k] === B)
            return k;
        return -1;
      }
      function ng(E, B, P) {
        for (var k = P + 1; k--; )
          if (E[k] === B)
            return k;
        return k;
      }
      function On(E) {
        return Nn(E) ? sg(E) : Hp(E);
      }
      function gt(E) {
        return Nn(E) ? ig(E) : Qp(E);
      }
      function Yu(E) {
        for (var B = E.length; B-- && qh.test(E.charAt(B)); )
          ;
        return B;
      }
      var rg = $i(Np);
      function sg(E) {
        for (var B = ki.lastIndex = 0; ki.test(E); )
          ++B;
        return B;
      }
      function ig(E) {
        return E.match(ki) || [];
      }
      function og(E) {
        return E.match(Ip) || [];
      }
      var ag = function E(B) {
        B = B == null ? Ce : Mn.defaults(Ce.Object(), B, Mn.pick(Ce, Rp));
        var P = B.Array, k = B.Date, V = B.Error, ue = B.Function, Se = B.Math, de = B.Object, Yi = B.RegExp, ug = B.String, it = B.TypeError, us = P.prototype, cg = ue.prototype, Un = de.prototype, cs = B["__core-js_shared__"], fs = cg.toString, le = Un.hasOwnProperty, fg = 0, ju = function() {
          var t = /[^.]+$/.exec(cs && cs.keys && cs.keys.IE_PROTO || "");
          return t ? "Symbol(src)_1." + t : "";
        }(), ls = Un.toString, lg = fs.call(de), dg = Ce._, hg = Yi(
          "^" + fs.call(le).replace(Ci, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
        ), ds = Ou ? B.Buffer : r, Xt = B.Symbol, hs = B.Uint8Array, Zu = ds ? ds.allocUnsafe : r, ps = Ku(de.getPrototypeOf, de), Xu = de.create, ec = Un.propertyIsEnumerable, gs = us.splice, tc = Xt ? Xt.isConcatSpreadable : r, gr = Xt ? Xt.iterator : r, pn = Xt ? Xt.toStringTag : r, ms = function() {
          try {
            var t = yn(de, "defineProperty");
            return t({}, "", {}), t;
          } catch {
          }
        }(), pg = B.clearTimeout !== Ce.clearTimeout && B.clearTimeout, gg = k && k.now !== Ce.Date.now && k.now, mg = B.setTimeout !== Ce.setTimeout && B.setTimeout, As = Se.ceil, ws = Se.floor, ji = de.getOwnPropertySymbols, Ag = ds ? ds.isBuffer : r, nc = B.isFinite, wg = us.join, yg = Ku(de.keys, de), Re = Se.max, Fe = Se.min, bg = k.now, xg = B.parseInt, rc = Se.random, Eg = us.reverse, Zi = yn(B, "DataView"), mr = yn(B, "Map"), Xi = yn(B, "Promise"), Fn = yn(B, "Set"), Ar = yn(B, "WeakMap"), wr = yn(de, "create"), ys = Ar && new Ar(), kn = {}, vg = bn(Zi), Pg = bn(mr), Tg = bn(Xi), Ig = bn(Fn), Bg = bn(Ar), bs = Xt ? Xt.prototype : r, yr = bs ? bs.valueOf : r, sc = bs ? bs.toString : r;
        function p(t) {
          if (ve(t) && !q(t) && !(t instanceof ne)) {
            if (t instanceof ot)
              return t;
            if (le.call(t, "__wrapped__"))
              return of(t);
          }
          return new ot(t);
        }
        var Ln = /* @__PURE__ */ function() {
          function t() {
          }
          return function(s) {
            if (!xe(s))
              return {};
            if (Xu)
              return Xu(s);
            t.prototype = s;
            var a = new t();
            return t.prototype = r, a;
          };
        }();
        function xs() {
        }
        function ot(t, s) {
          this.__wrapped__ = t, this.__actions__ = [], this.__chain__ = !!s, this.__index__ = 0, this.__values__ = r;
        }
        p.templateSettings = {
          /**
           * Used to detect `data` property values to be HTML-escaped.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          escape: Hh,
          /**
           * Used to detect code to be evaluated.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          evaluate: Qh,
          /**
           * Used to detect `data` property values to inject.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          interpolate: hu,
          /**
           * Used to reference the data object in the template text.
           *
           * @memberOf _.templateSettings
           * @type {string}
           */
          variable: "",
          /**
           * Used to import variables into the compiled template.
           *
           * @memberOf _.templateSettings
           * @type {Object}
           */
          imports: {
            /**
             * A reference to the `lodash` function.
             *
             * @memberOf _.templateSettings.imports
             * @type {Function}
             */
            _: p
          }
        }, p.prototype = xs.prototype, p.prototype.constructor = p, ot.prototype = Ln(xs.prototype), ot.prototype.constructor = ot;
        function ne(t) {
          this.__wrapped__ = t, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = dt, this.__views__ = [];
        }
        function Sg() {
          var t = new ne(this.__wrapped__);
          return t.__actions__ = Ve(this.__actions__), t.__dir__ = this.__dir__, t.__filtered__ = this.__filtered__, t.__iteratees__ = Ve(this.__iteratees__), t.__takeCount__ = this.__takeCount__, t.__views__ = Ve(this.__views__), t;
        }
        function Rg() {
          if (this.__filtered__) {
            var t = new ne(this);
            t.__dir__ = -1, t.__filtered__ = !0;
          } else
            t = this.clone(), t.__dir__ *= -1;
          return t;
        }
        function Dg() {
          var t = this.__wrapped__.value(), s = this.__dir__, a = q(t), f = s < 0, d = a ? t.length : 0, g = Q0(0, d, this.__views__), w = g.start, b = g.end, v = b - w, R = f ? b : w - 1, D = this.__iteratees__, C = D.length, U = 0, L = Fe(v, this.__takeCount__);
          if (!a || !f && d == v && L == v)
            return Sc(t, this.__actions__);
          var W = [];
          e:
            for (; v-- && U < L; ) {
              R += s;
              for (var j = -1, $ = t[R]; ++j < C; ) {
                var te = D[j], se = te.iteratee, tt = te.type, ze = se($);
                if (tt == We)
                  $ = ze;
                else if (!ze) {
                  if (tt == Pe)
                    continue e;
                  break e;
                }
              }
              W[U++] = $;
            }
          return W;
        }
        ne.prototype = Ln(xs.prototype), ne.prototype.constructor = ne;
        function gn(t) {
          var s = -1, a = t == null ? 0 : t.length;
          for (this.clear(); ++s < a; ) {
            var f = t[s];
            this.set(f[0], f[1]);
          }
        }
        function _g() {
          this.__data__ = wr ? wr(null) : {}, this.size = 0;
        }
        function Cg(t) {
          var s = this.has(t) && delete this.__data__[t];
          return this.size -= s ? 1 : 0, s;
        }
        function Ng(t) {
          var s = this.__data__;
          if (wr) {
            var a = s[t];
            return a === h ? r : a;
          }
          return le.call(s, t) ? s[t] : r;
        }
        function Og(t) {
          var s = this.__data__;
          return wr ? s[t] !== r : le.call(s, t);
        }
        function Mg(t, s) {
          var a = this.__data__;
          return this.size += this.has(t) ? 0 : 1, a[t] = wr && s === r ? h : s, this;
        }
        gn.prototype.clear = _g, gn.prototype.delete = Cg, gn.prototype.get = Ng, gn.prototype.has = Og, gn.prototype.set = Mg;
        function _t(t) {
          var s = -1, a = t == null ? 0 : t.length;
          for (this.clear(); ++s < a; ) {
            var f = t[s];
            this.set(f[0], f[1]);
          }
        }
        function Ug() {
          this.__data__ = [], this.size = 0;
        }
        function Fg(t) {
          var s = this.__data__, a = Es(s, t);
          if (a < 0)
            return !1;
          var f = s.length - 1;
          return a == f ? s.pop() : gs.call(s, a, 1), --this.size, !0;
        }
        function kg(t) {
          var s = this.__data__, a = Es(s, t);
          return a < 0 ? r : s[a][1];
        }
        function Lg(t) {
          return Es(this.__data__, t) > -1;
        }
        function Gg(t, s) {
          var a = this.__data__, f = Es(a, t);
          return f < 0 ? (++this.size, a.push([t, s])) : a[f][1] = s, this;
        }
        _t.prototype.clear = Ug, _t.prototype.delete = Fg, _t.prototype.get = kg, _t.prototype.has = Lg, _t.prototype.set = Gg;
        function Ct(t) {
          var s = -1, a = t == null ? 0 : t.length;
          for (this.clear(); ++s < a; ) {
            var f = t[s];
            this.set(f[0], f[1]);
          }
        }
        function Hg() {
          this.size = 0, this.__data__ = {
            hash: new gn(),
            map: new (mr || _t)(),
            string: new gn()
          };
        }
        function Qg(t) {
          var s = Os(this, t).delete(t);
          return this.size -= s ? 1 : 0, s;
        }
        function zg(t) {
          return Os(this, t).get(t);
        }
        function Wg(t) {
          return Os(this, t).has(t);
        }
        function $g(t, s) {
          var a = Os(this, t), f = a.size;
          return a.set(t, s), this.size += a.size == f ? 0 : 1, this;
        }
        Ct.prototype.clear = Hg, Ct.prototype.delete = Qg, Ct.prototype.get = zg, Ct.prototype.has = Wg, Ct.prototype.set = $g;
        function mn(t) {
          var s = -1, a = t == null ? 0 : t.length;
          for (this.__data__ = new Ct(); ++s < a; )
            this.add(t[s]);
        }
        function Vg(t) {
          return this.__data__.set(t, h), this;
        }
        function qg(t) {
          return this.__data__.has(t);
        }
        mn.prototype.add = mn.prototype.push = Vg, mn.prototype.has = qg;
        function mt(t) {
          var s = this.__data__ = new _t(t);
          this.size = s.size;
        }
        function Jg() {
          this.__data__ = new _t(), this.size = 0;
        }
        function Kg(t) {
          var s = this.__data__, a = s.delete(t);
          return this.size = s.size, a;
        }
        function Yg(t) {
          return this.__data__.get(t);
        }
        function jg(t) {
          return this.__data__.has(t);
        }
        function Zg(t, s) {
          var a = this.__data__;
          if (a instanceof _t) {
            var f = a.__data__;
            if (!mr || f.length < o - 1)
              return f.push([t, s]), this.size = ++a.size, this;
            a = this.__data__ = new Ct(f);
          }
          return a.set(t, s), this.size = a.size, this;
        }
        mt.prototype.clear = Jg, mt.prototype.delete = Kg, mt.prototype.get = Yg, mt.prototype.has = jg, mt.prototype.set = Zg;
        function ic(t, s) {
          var a = q(t), f = !a && xn(t), d = !a && !f && sn(t), g = !a && !f && !d && zn(t), w = a || f || d || g, b = w ? qi(t.length, ug) : [], v = b.length;
          for (var R in t)
            (s || le.call(t, R)) && !(w && // Safari 9 has enumerable `arguments.length` in strict mode.
            (R == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
            d && (R == "offset" || R == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
            g && (R == "buffer" || R == "byteLength" || R == "byteOffset") || // Skip index properties.
            Ut(R, v))) && b.push(R);
          return b;
        }
        function oc(t) {
          var s = t.length;
          return s ? t[fo(0, s - 1)] : r;
        }
        function Xg(t, s) {
          return Ms(Ve(t), An(s, 0, t.length));
        }
        function e0(t) {
          return Ms(Ve(t));
        }
        function eo(t, s, a) {
          (a !== r && !At(t[s], a) || a === r && !(s in t)) && Nt(t, s, a);
        }
        function br(t, s, a) {
          var f = t[s];
          (!(le.call(t, s) && At(f, a)) || a === r && !(s in t)) && Nt(t, s, a);
        }
        function Es(t, s) {
          for (var a = t.length; a--; )
            if (At(t[a][0], s))
              return a;
          return -1;
        }
        function t0(t, s, a, f) {
          return en(t, function(d, g, w) {
            s(f, d, a(d), w);
          }), f;
        }
        function ac(t, s) {
          return t && Et(s, _e(s), t);
        }
        function n0(t, s) {
          return t && Et(s, Je(s), t);
        }
        function Nt(t, s, a) {
          s == "__proto__" && ms ? ms(t, s, {
            configurable: !0,
            enumerable: !0,
            value: a,
            writable: !0
          }) : t[s] = a;
        }
        function to(t, s) {
          for (var a = -1, f = s.length, d = P(f), g = t == null; ++a < f; )
            d[a] = g ? r : Uo(t, s[a]);
          return d;
        }
        function An(t, s, a) {
          return t === t && (a !== r && (t = t <= a ? t : a), s !== r && (t = t >= s ? t : s)), t;
        }
        function at(t, s, a, f, d, g) {
          var w, b = s & y, v = s & x, R = s & T;
          if (a && (w = d ? a(t, f, d, g) : a(t)), w !== r)
            return w;
          if (!xe(t))
            return t;
          var D = q(t);
          if (D) {
            if (w = W0(t), !b)
              return Ve(t, w);
          } else {
            var C = ke(t), U = C == es || C == cu;
            if (sn(t))
              return _c(t, b);
            if (C == Dt || C == Ge || U && !d) {
              if (w = v || U ? {} : Yc(t), !b)
                return v ? N0(t, n0(w, t)) : C0(t, ac(w, t));
            } else {
              if (!he[C])
                return d ? t : {};
              w = $0(t, C, b);
            }
          }
          g || (g = new mt());
          var L = g.get(t);
          if (L)
            return L;
          g.set(t, w), If(t) ? t.forEach(function($) {
            w.add(at($, s, a, $, t, g));
          }) : Pf(t) && t.forEach(function($, te) {
            w.set(te, at($, s, a, te, t, g));
          });
          var W = R ? v ? Eo : xo : v ? Je : _e, j = D ? r : W(t);
          return st(j || t, function($, te) {
            j && (te = $, $ = t[te]), br(w, te, at($, s, a, te, t, g));
          }), w;
        }
        function r0(t) {
          var s = _e(t);
          return function(a) {
            return uc(a, t, s);
          };
        }
        function uc(t, s, a) {
          var f = a.length;
          if (t == null)
            return !f;
          for (t = de(t); f--; ) {
            var d = a[f], g = s[d], w = t[d];
            if (w === r && !(d in t) || !g(w))
              return !1;
          }
          return !0;
        }
        function cc(t, s, a) {
          if (typeof t != "function")
            throw new it(c);
          return Br(function() {
            t.apply(r, a);
          }, s);
        }
        function xr(t, s, a, f) {
          var d = -1, g = is, w = !0, b = t.length, v = [], R = s.length;
          if (!b)
            return v;
          a && (s = Ae(s, Ze(a))), f ? (g = Hi, w = !1) : s.length >= o && (g = pr, w = !1, s = new mn(s));
          e:
            for (; ++d < b; ) {
              var D = t[d], C = a == null ? D : a(D);
              if (D = f || D !== 0 ? D : 0, w && C === C) {
                for (var U = R; U--; )
                  if (s[U] === C)
                    continue e;
                v.push(D);
              } else g(s, C, f) || v.push(D);
            }
          return v;
        }
        var en = Uc(xt), fc = Uc(ro, !0);
        function s0(t, s) {
          var a = !0;
          return en(t, function(f, d, g) {
            return a = !!s(f, d, g), a;
          }), a;
        }
        function vs(t, s, a) {
          for (var f = -1, d = t.length; ++f < d; ) {
            var g = t[f], w = s(g);
            if (w != null && (b === r ? w === w && !et(w) : a(w, b)))
              var b = w, v = g;
          }
          return v;
        }
        function i0(t, s, a, f) {
          var d = t.length;
          for (a = J(a), a < 0 && (a = -a > d ? 0 : d + a), f = f === r || f > d ? d : J(f), f < 0 && (f += d), f = a > f ? 0 : Sf(f); a < f; )
            t[a++] = s;
          return t;
        }
        function lc(t, s) {
          var a = [];
          return en(t, function(f, d, g) {
            s(f, d, g) && a.push(f);
          }), a;
        }
        function Ne(t, s, a, f, d) {
          var g = -1, w = t.length;
          for (a || (a = q0), d || (d = []); ++g < w; ) {
            var b = t[g];
            s > 0 && a(b) ? s > 1 ? Ne(b, s - 1, a, f, d) : jt(d, b) : f || (d[d.length] = b);
          }
          return d;
        }
        var no = Fc(), dc = Fc(!0);
        function xt(t, s) {
          return t && no(t, s, _e);
        }
        function ro(t, s) {
          return t && dc(t, s, _e);
        }
        function Ps(t, s) {
          return Yt(s, function(a) {
            return Ft(t[a]);
          });
        }
        function wn(t, s) {
          s = nn(s, t);
          for (var a = 0, f = s.length; t != null && a < f; )
            t = t[vt(s[a++])];
          return a && a == f ? t : r;
        }
        function hc(t, s, a) {
          var f = s(t);
          return q(t) ? f : jt(f, a(t));
        }
        function He(t) {
          return t == null ? t === r ? Oh : Ch : pn && pn in de(t) ? H0(t) : em(t);
        }
        function so(t, s) {
          return t > s;
        }
        function o0(t, s) {
          return t != null && le.call(t, s);
        }
        function a0(t, s) {
          return t != null && s in de(t);
        }
        function u0(t, s, a) {
          return t >= Fe(s, a) && t < Re(s, a);
        }
        function io(t, s, a) {
          for (var f = a ? Hi : is, d = t[0].length, g = t.length, w = g, b = P(g), v = 1 / 0, R = []; w--; ) {
            var D = t[w];
            w && s && (D = Ae(D, Ze(s))), v = Fe(D.length, v), b[w] = !a && (s || d >= 120 && D.length >= 120) ? new mn(w && D) : r;
          }
          D = t[0];
          var C = -1, U = b[0];
          e:
            for (; ++C < d && R.length < v; ) {
              var L = D[C], W = s ? s(L) : L;
              if (L = a || L !== 0 ? L : 0, !(U ? pr(U, W) : f(R, W, a))) {
                for (w = g; --w; ) {
                  var j = b[w];
                  if (!(j ? pr(j, W) : f(t[w], W, a)))
                    continue e;
                }
                U && U.push(W), R.push(L);
              }
            }
          return R;
        }
        function c0(t, s, a, f) {
          return xt(t, function(d, g, w) {
            s(f, a(d), g, w);
          }), f;
        }
        function Er(t, s, a) {
          s = nn(s, t), t = ef(t, s);
          var f = t == null ? t : t[vt(ct(s))];
          return f == null ? r : je(f, t, a);
        }
        function pc(t) {
          return ve(t) && He(t) == Ge;
        }
        function f0(t) {
          return ve(t) && He(t) == hr;
        }
        function l0(t) {
          return ve(t) && He(t) == ur;
        }
        function vr(t, s, a, f, d) {
          return t === s ? !0 : t == null || s == null || !ve(t) && !ve(s) ? t !== t && s !== s : d0(t, s, a, f, vr, d);
        }
        function d0(t, s, a, f, d, g) {
          var w = q(t), b = q(s), v = w ? Zr : ke(t), R = b ? Zr : ke(s);
          v = v == Ge ? Dt : v, R = R == Ge ? Dt : R;
          var D = v == Dt, C = R == Dt, U = v == R;
          if (U && sn(t)) {
            if (!sn(s))
              return !1;
            w = !0, D = !1;
          }
          if (U && !D)
            return g || (g = new mt()), w || zn(t) ? qc(t, s, a, f, d, g) : L0(t, s, v, a, f, d, g);
          if (!(a & I)) {
            var L = D && le.call(t, "__wrapped__"), W = C && le.call(s, "__wrapped__");
            if (L || W) {
              var j = L ? t.value() : t, $ = W ? s.value() : s;
              return g || (g = new mt()), d(j, $, a, f, g);
            }
          }
          return U ? (g || (g = new mt()), G0(t, s, a, f, d, g)) : !1;
        }
        function h0(t) {
          return ve(t) && ke(t) == ht;
        }
        function oo(t, s, a, f) {
          var d = a.length, g = d, w = !f;
          if (t == null)
            return !g;
          for (t = de(t); d--; ) {
            var b = a[d];
            if (w && b[2] ? b[1] !== t[b[0]] : !(b[0] in t))
              return !1;
          }
          for (; ++d < g; ) {
            b = a[d];
            var v = b[0], R = t[v], D = b[1];
            if (w && b[2]) {
              if (R === r && !(v in t))
                return !1;
            } else {
              var C = new mt();
              if (f)
                var U = f(R, D, v, t, s, C);
              if (!(U === r ? vr(D, R, I | _, f, C) : U))
                return !1;
            }
          }
          return !0;
        }
        function gc(t) {
          if (!xe(t) || K0(t))
            return !1;
          var s = Ft(t) ? hg : rp;
          return s.test(bn(t));
        }
        function p0(t) {
          return ve(t) && He(t) == fr;
        }
        function g0(t) {
          return ve(t) && ke(t) == pt;
        }
        function m0(t) {
          return ve(t) && Hs(t.length) && !!ge[He(t)];
        }
        function mc(t) {
          return typeof t == "function" ? t : t == null ? Ke : typeof t == "object" ? q(t) ? yc(t[0], t[1]) : wc(t) : Lf(t);
        }
        function ao(t) {
          if (!Ir(t))
            return yg(t);
          var s = [];
          for (var a in de(t))
            le.call(t, a) && a != "constructor" && s.push(a);
          return s;
        }
        function A0(t) {
          if (!xe(t))
            return X0(t);
          var s = Ir(t), a = [];
          for (var f in t)
            f == "constructor" && (s || !le.call(t, f)) || a.push(f);
          return a;
        }
        function uo(t, s) {
          return t < s;
        }
        function Ac(t, s) {
          var a = -1, f = qe(t) ? P(t.length) : [];
          return en(t, function(d, g, w) {
            f[++a] = s(d, g, w);
          }), f;
        }
        function wc(t) {
          var s = Po(t);
          return s.length == 1 && s[0][2] ? Zc(s[0][0], s[0][1]) : function(a) {
            return a === t || oo(a, t, s);
          };
        }
        function yc(t, s) {
          return Io(t) && jc(s) ? Zc(vt(t), s) : function(a) {
            var f = Uo(a, t);
            return f === r && f === s ? Fo(a, t) : vr(s, f, I | _);
          };
        }
        function Ts(t, s, a, f, d) {
          t !== s && no(s, function(g, w) {
            if (d || (d = new mt()), xe(g))
              w0(t, s, w, a, Ts, f, d);
            else {
              var b = f ? f(So(t, w), g, w + "", t, s, d) : r;
              b === r && (b = g), eo(t, w, b);
            }
          }, Je);
        }
        function w0(t, s, a, f, d, g, w) {
          var b = So(t, a), v = So(s, a), R = w.get(v);
          if (R) {
            eo(t, a, R);
            return;
          }
          var D = g ? g(b, v, a + "", t, s, w) : r, C = D === r;
          if (C) {
            var U = q(v), L = !U && sn(v), W = !U && !L && zn(v);
            D = v, U || L || W ? q(b) ? D = b : Te(b) ? D = Ve(b) : L ? (C = !1, D = _c(v, !0)) : W ? (C = !1, D = Cc(v, !0)) : D = [] : Sr(v) || xn(v) ? (D = b, xn(b) ? D = Rf(b) : (!xe(b) || Ft(b)) && (D = Yc(v))) : C = !1;
          }
          C && (w.set(v, D), d(D, v, f, g, w), w.delete(v)), eo(t, a, D);
        }
        function bc(t, s) {
          var a = t.length;
          if (a)
            return s += s < 0 ? a : 0, Ut(s, a) ? t[s] : r;
        }
        function xc(t, s, a) {
          s.length ? s = Ae(s, function(g) {
            return q(g) ? function(w) {
              return wn(w, g.length === 1 ? g[0] : g);
            } : g;
          }) : s = [Ke];
          var f = -1;
          s = Ae(s, Ze(z()));
          var d = Ac(t, function(g, w, b) {
            var v = Ae(s, function(R) {
              return R(g);
            });
            return { criteria: v, index: ++f, value: g };
          });
          return $p(d, function(g, w) {
            return _0(g, w, a);
          });
        }
        function y0(t, s) {
          return Ec(t, s, function(a, f) {
            return Fo(t, f);
          });
        }
        function Ec(t, s, a) {
          for (var f = -1, d = s.length, g = {}; ++f < d; ) {
            var w = s[f], b = wn(t, w);
            a(b, w) && Pr(g, nn(w, t), b);
          }
          return g;
        }
        function b0(t) {
          return function(s) {
            return wn(s, t);
          };
        }
        function co(t, s, a, f) {
          var d = f ? Wp : Cn, g = -1, w = s.length, b = t;
          for (t === s && (s = Ve(s)), a && (b = Ae(t, Ze(a))); ++g < w; )
            for (var v = 0, R = s[g], D = a ? a(R) : R; (v = d(b, D, v, f)) > -1; )
              b !== t && gs.call(b, v, 1), gs.call(t, v, 1);
          return t;
        }
        function vc(t, s) {
          for (var a = t ? s.length : 0, f = a - 1; a--; ) {
            var d = s[a];
            if (a == f || d !== g) {
              var g = d;
              Ut(d) ? gs.call(t, d, 1) : po(t, d);
            }
          }
          return t;
        }
        function fo(t, s) {
          return t + ws(rc() * (s - t + 1));
        }
        function x0(t, s, a, f) {
          for (var d = -1, g = Re(As((s - t) / (a || 1)), 0), w = P(g); g--; )
            w[f ? g : ++d] = t, t += a;
          return w;
        }
        function lo(t, s) {
          var a = "";
          if (!t || s < 1 || s > Ee)
            return a;
          do
            s % 2 && (a += t), s = ws(s / 2), s && (t += t);
          while (s);
          return a;
        }
        function Z(t, s) {
          return Ro(Xc(t, s, Ke), t + "");
        }
        function E0(t) {
          return oc(Wn(t));
        }
        function v0(t, s) {
          var a = Wn(t);
          return Ms(a, An(s, 0, a.length));
        }
        function Pr(t, s, a, f) {
          if (!xe(t))
            return t;
          s = nn(s, t);
          for (var d = -1, g = s.length, w = g - 1, b = t; b != null && ++d < g; ) {
            var v = vt(s[d]), R = a;
            if (v === "__proto__" || v === "constructor" || v === "prototype")
              return t;
            if (d != w) {
              var D = b[v];
              R = f ? f(D, v, b) : r, R === r && (R = xe(D) ? D : Ut(s[d + 1]) ? [] : {});
            }
            br(b, v, R), b = b[v];
          }
          return t;
        }
        var Pc = ys ? function(t, s) {
          return ys.set(t, s), t;
        } : Ke, P0 = ms ? function(t, s) {
          return ms(t, "toString", {
            configurable: !0,
            enumerable: !1,
            value: Lo(s),
            writable: !0
          });
        } : Ke;
        function T0(t) {
          return Ms(Wn(t));
        }
        function ut(t, s, a) {
          var f = -1, d = t.length;
          s < 0 && (s = -s > d ? 0 : d + s), a = a > d ? d : a, a < 0 && (a += d), d = s > a ? 0 : a - s >>> 0, s >>>= 0;
          for (var g = P(d); ++f < d; )
            g[f] = t[f + s];
          return g;
        }
        function I0(t, s) {
          var a;
          return en(t, function(f, d, g) {
            return a = s(f, d, g), !a;
          }), !!a;
        }
        function Is(t, s, a) {
          var f = 0, d = t == null ? f : t.length;
          if (typeof s == "number" && s === s && d <= Ei) {
            for (; f < d; ) {
              var g = f + d >>> 1, w = t[g];
              w !== null && !et(w) && (a ? w <= s : w < s) ? f = g + 1 : d = g;
            }
            return d;
          }
          return ho(t, s, Ke, a);
        }
        function ho(t, s, a, f) {
          var d = 0, g = t == null ? 0 : t.length;
          if (g === 0)
            return 0;
          s = a(s);
          for (var w = s !== s, b = s === null, v = et(s), R = s === r; d < g; ) {
            var D = ws((d + g) / 2), C = a(t[D]), U = C !== r, L = C === null, W = C === C, j = et(C);
            if (w)
              var $ = f || W;
            else R ? $ = W && (f || U) : b ? $ = W && U && (f || !L) : v ? $ = W && U && !L && (f || !j) : L || j ? $ = !1 : $ = f ? C <= s : C < s;
            $ ? d = D + 1 : g = D;
          }
          return Fe(g, or);
        }
        function Tc(t, s) {
          for (var a = -1, f = t.length, d = 0, g = []; ++a < f; ) {
            var w = t[a], b = s ? s(w) : w;
            if (!a || !At(b, v)) {
              var v = b;
              g[d++] = w === 0 ? 0 : w;
            }
          }
          return g;
        }
        function Ic(t) {
          return typeof t == "number" ? t : et(t) ? Rt : +t;
        }
        function Xe(t) {
          if (typeof t == "string")
            return t;
          if (q(t))
            return Ae(t, Xe) + "";
          if (et(t))
            return sc ? sc.call(t) : "";
          var s = t + "";
          return s == "0" && 1 / t == -1 / 0 ? "-0" : s;
        }
        function tn(t, s, a) {
          var f = -1, d = is, g = t.length, w = !0, b = [], v = b;
          if (a)
            w = !1, d = Hi;
          else if (g >= o) {
            var R = s ? null : F0(t);
            if (R)
              return as(R);
            w = !1, d = pr, v = new mn();
          } else
            v = s ? [] : b;
          e:
            for (; ++f < g; ) {
              var D = t[f], C = s ? s(D) : D;
              if (D = a || D !== 0 ? D : 0, w && C === C) {
                for (var U = v.length; U--; )
                  if (v[U] === C)
                    continue e;
                s && v.push(C), b.push(D);
              } else d(v, C, a) || (v !== b && v.push(C), b.push(D));
            }
          return b;
        }
        function po(t, s) {
          return s = nn(s, t), t = ef(t, s), t == null || delete t[vt(ct(s))];
        }
        function Bc(t, s, a, f) {
          return Pr(t, s, a(wn(t, s)), f);
        }
        function Bs(t, s, a, f) {
          for (var d = t.length, g = f ? d : -1; (f ? g-- : ++g < d) && s(t[g], g, t); )
            ;
          return a ? ut(t, f ? 0 : g, f ? g + 1 : d) : ut(t, f ? g + 1 : 0, f ? d : g);
        }
        function Sc(t, s) {
          var a = t;
          return a instanceof ne && (a = a.value()), Qi(s, function(f, d) {
            return d.func.apply(d.thisArg, jt([f], d.args));
          }, a);
        }
        function go(t, s, a) {
          var f = t.length;
          if (f < 2)
            return f ? tn(t[0]) : [];
          for (var d = -1, g = P(f); ++d < f; )
            for (var w = t[d], b = -1; ++b < f; )
              b != d && (g[d] = xr(g[d] || w, t[b], s, a));
          return tn(Ne(g, 1), s, a);
        }
        function Rc(t, s, a) {
          for (var f = -1, d = t.length, g = s.length, w = {}; ++f < d; ) {
            var b = f < g ? s[f] : r;
            a(w, t[f], b);
          }
          return w;
        }
        function mo(t) {
          return Te(t) ? t : [];
        }
        function Ao(t) {
          return typeof t == "function" ? t : Ke;
        }
        function nn(t, s) {
          return q(t) ? t : Io(t, s) ? [t] : sf(fe(t));
        }
        var B0 = Z;
        function rn(t, s, a) {
          var f = t.length;
          return a = a === r ? f : a, !s && a >= f ? t : ut(t, s, a);
        }
        var Dc = pg || function(t) {
          return Ce.clearTimeout(t);
        };
        function _c(t, s) {
          if (s)
            return t.slice();
          var a = t.length, f = Zu ? Zu(a) : new t.constructor(a);
          return t.copy(f), f;
        }
        function wo(t) {
          var s = new t.constructor(t.byteLength);
          return new hs(s).set(new hs(t)), s;
        }
        function S0(t, s) {
          var a = s ? wo(t.buffer) : t.buffer;
          return new t.constructor(a, t.byteOffset, t.byteLength);
        }
        function R0(t) {
          var s = new t.constructor(t.source, pu.exec(t));
          return s.lastIndex = t.lastIndex, s;
        }
        function D0(t) {
          return yr ? de(yr.call(t)) : {};
        }
        function Cc(t, s) {
          var a = s ? wo(t.buffer) : t.buffer;
          return new t.constructor(a, t.byteOffset, t.length);
        }
        function Nc(t, s) {
          if (t !== s) {
            var a = t !== r, f = t === null, d = t === t, g = et(t), w = s !== r, b = s === null, v = s === s, R = et(s);
            if (!b && !R && !g && t > s || g && w && v && !b && !R || f && w && v || !a && v || !d)
              return 1;
            if (!f && !g && !R && t < s || R && a && d && !f && !g || b && a && d || !w && d || !v)
              return -1;
          }
          return 0;
        }
        function _0(t, s, a) {
          for (var f = -1, d = t.criteria, g = s.criteria, w = d.length, b = a.length; ++f < w; ) {
            var v = Nc(d[f], g[f]);
            if (v) {
              if (f >= b)
                return v;
              var R = a[f];
              return v * (R == "desc" ? -1 : 1);
            }
          }
          return t.index - s.index;
        }
        function Oc(t, s, a, f) {
          for (var d = -1, g = t.length, w = a.length, b = -1, v = s.length, R = Re(g - w, 0), D = P(v + R), C = !f; ++b < v; )
            D[b] = s[b];
          for (; ++d < w; )
            (C || d < g) && (D[a[d]] = t[d]);
          for (; R--; )
            D[b++] = t[d++];
          return D;
        }
        function Mc(t, s, a, f) {
          for (var d = -1, g = t.length, w = -1, b = a.length, v = -1, R = s.length, D = Re(g - b, 0), C = P(D + R), U = !f; ++d < D; )
            C[d] = t[d];
          for (var L = d; ++v < R; )
            C[L + v] = s[v];
          for (; ++w < b; )
            (U || d < g) && (C[L + a[w]] = t[d++]);
          return C;
        }
        function Ve(t, s) {
          var a = -1, f = t.length;
          for (s || (s = P(f)); ++a < f; )
            s[a] = t[a];
          return s;
        }
        function Et(t, s, a, f) {
          var d = !a;
          a || (a = {});
          for (var g = -1, w = s.length; ++g < w; ) {
            var b = s[g], v = f ? f(a[b], t[b], b, a, t) : r;
            v === r && (v = t[b]), d ? Nt(a, b, v) : br(a, b, v);
          }
          return a;
        }
        function C0(t, s) {
          return Et(t, To(t), s);
        }
        function N0(t, s) {
          return Et(t, Jc(t), s);
        }
        function Ss(t, s) {
          return function(a, f) {
            var d = q(a) ? kp : t0, g = s ? s() : {};
            return d(a, t, z(f, 2), g);
          };
        }
        function Gn(t) {
          return Z(function(s, a) {
            var f = -1, d = a.length, g = d > 1 ? a[d - 1] : r, w = d > 2 ? a[2] : r;
            for (g = t.length > 3 && typeof g == "function" ? (d--, g) : r, w && Qe(a[0], a[1], w) && (g = d < 3 ? r : g, d = 1), s = de(s); ++f < d; ) {
              var b = a[f];
              b && t(s, b, f, g);
            }
            return s;
          });
        }
        function Uc(t, s) {
          return function(a, f) {
            if (a == null)
              return a;
            if (!qe(a))
              return t(a, f);
            for (var d = a.length, g = s ? d : -1, w = de(a); (s ? g-- : ++g < d) && f(w[g], g, w) !== !1; )
              ;
            return a;
          };
        }
        function Fc(t) {
          return function(s, a, f) {
            for (var d = -1, g = de(s), w = f(s), b = w.length; b--; ) {
              var v = w[t ? b : ++d];
              if (a(g[v], v, g) === !1)
                break;
            }
            return s;
          };
        }
        function O0(t, s, a) {
          var f = s & N, d = Tr(t);
          function g() {
            var w = this && this !== Ce && this instanceof g ? d : t;
            return w.apply(f ? a : this, arguments);
          }
          return g;
        }
        function kc(t) {
          return function(s) {
            s = fe(s);
            var a = Nn(s) ? gt(s) : r, f = a ? a[0] : s.charAt(0), d = a ? rn(a, 1).join("") : s.slice(1);
            return f[t]() + d;
          };
        }
        function Hn(t) {
          return function(s) {
            return Qi(Ff(Uf(s).replace(Pp, "")), t, "");
          };
        }
        function Tr(t) {
          return function() {
            var s = arguments;
            switch (s.length) {
              case 0:
                return new t();
              case 1:
                return new t(s[0]);
              case 2:
                return new t(s[0], s[1]);
              case 3:
                return new t(s[0], s[1], s[2]);
              case 4:
                return new t(s[0], s[1], s[2], s[3]);
              case 5:
                return new t(s[0], s[1], s[2], s[3], s[4]);
              case 6:
                return new t(s[0], s[1], s[2], s[3], s[4], s[5]);
              case 7:
                return new t(s[0], s[1], s[2], s[3], s[4], s[5], s[6]);
            }
            var a = Ln(t.prototype), f = t.apply(a, s);
            return xe(f) ? f : a;
          };
        }
        function M0(t, s, a) {
          var f = Tr(t);
          function d() {
            for (var g = arguments.length, w = P(g), b = g, v = Qn(d); b--; )
              w[b] = arguments[b];
            var R = g < 3 && w[0] !== v && w[g - 1] !== v ? [] : Zt(w, v);
            if (g -= R.length, g < a)
              return zc(
                t,
                s,
                Rs,
                d.placeholder,
                r,
                w,
                R,
                r,
                r,
                a - g
              );
            var D = this && this !== Ce && this instanceof d ? f : t;
            return je(D, this, w);
          }
          return d;
        }
        function Lc(t) {
          return function(s, a, f) {
            var d = de(s);
            if (!qe(s)) {
              var g = z(a, 3);
              s = _e(s), a = function(b) {
                return g(d[b], b, d);
              };
            }
            var w = t(s, a, f);
            return w > -1 ? d[g ? s[w] : w] : r;
          };
        }
        function Gc(t) {
          return Mt(function(s) {
            var a = s.length, f = a, d = ot.prototype.thru;
            for (t && s.reverse(); f--; ) {
              var g = s[f];
              if (typeof g != "function")
                throw new it(c);
              if (d && !w && Ns(g) == "wrapper")
                var w = new ot([], !0);
            }
            for (f = w ? f : a; ++f < a; ) {
              g = s[f];
              var b = Ns(g), v = b == "wrapper" ? vo(g) : r;
              v && Bo(v[0]) && v[1] == (F | G | H | ie) && !v[4].length && v[9] == 1 ? w = w[Ns(v[0])].apply(w, v[3]) : w = g.length == 1 && Bo(g) ? w[b]() : w.thru(g);
            }
            return function() {
              var R = arguments, D = R[0];
              if (w && R.length == 1 && q(D))
                return w.plant(D).value();
              for (var C = 0, U = a ? s[C].apply(this, R) : D; ++C < a; )
                U = s[C].call(this, U);
              return U;
            };
          });
        }
        function Rs(t, s, a, f, d, g, w, b, v, R) {
          var D = s & F, C = s & N, U = s & S, L = s & (G | ee), W = s & K, j = U ? r : Tr(t);
          function $() {
            for (var te = arguments.length, se = P(te), tt = te; tt--; )
              se[tt] = arguments[tt];
            if (L)
              var ze = Qn($), nt = qp(se, ze);
            if (f && (se = Oc(se, f, d, L)), g && (se = Mc(se, g, w, L)), te -= nt, L && te < R) {
              var Ie = Zt(se, ze);
              return zc(
                t,
                s,
                Rs,
                $.placeholder,
                a,
                se,
                Ie,
                b,
                v,
                R - te
              );
            }
            var wt = C ? a : this, Lt = U ? wt[t] : t;
            return te = se.length, b ? se = tm(se, b) : W && te > 1 && se.reverse(), D && v < te && (se.length = v), this && this !== Ce && this instanceof $ && (Lt = j || Tr(Lt)), Lt.apply(wt, se);
          }
          return $;
        }
        function Hc(t, s) {
          return function(a, f) {
            return c0(a, t, s(f), {});
          };
        }
        function Ds(t, s) {
          return function(a, f) {
            var d;
            if (a === r && f === r)
              return s;
            if (a !== r && (d = a), f !== r) {
              if (d === r)
                return f;
              typeof a == "string" || typeof f == "string" ? (a = Xe(a), f = Xe(f)) : (a = Ic(a), f = Ic(f)), d = t(a, f);
            }
            return d;
          };
        }
        function yo(t) {
          return Mt(function(s) {
            return s = Ae(s, Ze(z())), Z(function(a) {
              var f = this;
              return t(s, function(d) {
                return je(d, f, a);
              });
            });
          });
        }
        function _s(t, s) {
          s = s === r ? " " : Xe(s);
          var a = s.length;
          if (a < 2)
            return a ? lo(s, t) : s;
          var f = lo(s, As(t / On(s)));
          return Nn(s) ? rn(gt(f), 0, t).join("") : f.slice(0, t);
        }
        function U0(t, s, a, f) {
          var d = s & N, g = Tr(t);
          function w() {
            for (var b = -1, v = arguments.length, R = -1, D = f.length, C = P(D + v), U = this && this !== Ce && this instanceof w ? g : t; ++R < D; )
              C[R] = f[R];
            for (; v--; )
              C[R++] = arguments[++b];
            return je(U, d ? a : this, C);
          }
          return w;
        }
        function Qc(t) {
          return function(s, a, f) {
            return f && typeof f != "number" && Qe(s, a, f) && (a = f = r), s = kt(s), a === r ? (a = s, s = 0) : a = kt(a), f = f === r ? s < a ? 1 : -1 : kt(f), x0(s, a, f, t);
          };
        }
        function Cs(t) {
          return function(s, a) {
            return typeof s == "string" && typeof a == "string" || (s = ft(s), a = ft(a)), t(s, a);
          };
        }
        function zc(t, s, a, f, d, g, w, b, v, R) {
          var D = s & G, C = D ? w : r, U = D ? r : w, L = D ? g : r, W = D ? r : g;
          s |= D ? H : Q, s &= ~(D ? Q : H), s & M || (s &= -4);
          var j = [
            t,
            s,
            d,
            L,
            C,
            W,
            U,
            b,
            v,
            R
          ], $ = a.apply(r, j);
          return Bo(t) && tf($, j), $.placeholder = f, nf($, t, s);
        }
        function bo(t) {
          var s = Se[t];
          return function(a, f) {
            if (a = ft(a), f = f == null ? 0 : Fe(J(f), 292), f && nc(a)) {
              var d = (fe(a) + "e").split("e"), g = s(d[0] + "e" + (+d[1] + f));
              return d = (fe(g) + "e").split("e"), +(d[0] + "e" + (+d[1] - f));
            }
            return s(a);
          };
        }
        var F0 = Fn && 1 / as(new Fn([, -0]))[1] == be ? function(t) {
          return new Fn(t);
        } : Qo;
        function Wc(t) {
          return function(s) {
            var a = ke(s);
            return a == ht ? Ki(s) : a == pt ? eg(s) : Vp(s, t(s));
          };
        }
        function Ot(t, s, a, f, d, g, w, b) {
          var v = s & S;
          if (!v && typeof t != "function")
            throw new it(c);
          var R = f ? f.length : 0;
          if (R || (s &= -97, f = d = r), w = w === r ? w : Re(J(w), 0), b = b === r ? b : J(b), R -= d ? d.length : 0, s & Q) {
            var D = f, C = d;
            f = d = r;
          }
          var U = v ? r : vo(t), L = [
            t,
            s,
            a,
            f,
            d,
            D,
            C,
            g,
            w,
            b
          ];
          if (U && Z0(L, U), t = L[0], s = L[1], a = L[2], f = L[3], d = L[4], b = L[9] = L[9] === r ? v ? 0 : t.length : Re(L[9] - R, 0), !b && s & (G | ee) && (s &= -25), !s || s == N)
            var W = O0(t, s, a);
          else s == G || s == ee ? W = M0(t, s, b) : (s == H || s == (N | H)) && !d.length ? W = U0(t, s, a, f) : W = Rs.apply(r, L);
          var j = U ? Pc : tf;
          return nf(j(W, L), t, s);
        }
        function $c(t, s, a, f) {
          return t === r || At(t, Un[a]) && !le.call(f, a) ? s : t;
        }
        function Vc(t, s, a, f, d, g) {
          return xe(t) && xe(s) && (g.set(s, t), Ts(t, s, r, Vc, g), g.delete(s)), t;
        }
        function k0(t) {
          return Sr(t) ? r : t;
        }
        function qc(t, s, a, f, d, g) {
          var w = a & I, b = t.length, v = s.length;
          if (b != v && !(w && v > b))
            return !1;
          var R = g.get(t), D = g.get(s);
          if (R && D)
            return R == s && D == t;
          var C = -1, U = !0, L = a & _ ? new mn() : r;
          for (g.set(t, s), g.set(s, t); ++C < b; ) {
            var W = t[C], j = s[C];
            if (f)
              var $ = w ? f(j, W, C, s, t, g) : f(W, j, C, t, s, g);
            if ($ !== r) {
              if ($)
                continue;
              U = !1;
              break;
            }
            if (L) {
              if (!zi(s, function(te, se) {
                if (!pr(L, se) && (W === te || d(W, te, a, f, g)))
                  return L.push(se);
              })) {
                U = !1;
                break;
              }
            } else if (!(W === j || d(W, j, a, f, g))) {
              U = !1;
              break;
            }
          }
          return g.delete(t), g.delete(s), U;
        }
        function L0(t, s, a, f, d, g, w) {
          switch (a) {
            case Dn:
              if (t.byteLength != s.byteLength || t.byteOffset != s.byteOffset)
                return !1;
              t = t.buffer, s = s.buffer;
            case hr:
              return !(t.byteLength != s.byteLength || !g(new hs(t), new hs(s)));
            case ar:
            case ur:
            case cr:
              return At(+t, +s);
            case Xr:
              return t.name == s.name && t.message == s.message;
            case fr:
            case lr:
              return t == s + "";
            case ht:
              var b = Ki;
            case pt:
              var v = f & I;
              if (b || (b = as), t.size != s.size && !v)
                return !1;
              var R = w.get(t);
              if (R)
                return R == s;
              f |= _, w.set(t, s);
              var D = qc(b(t), b(s), f, d, g, w);
              return w.delete(t), D;
            case ts:
              if (yr)
                return yr.call(t) == yr.call(s);
          }
          return !1;
        }
        function G0(t, s, a, f, d, g) {
          var w = a & I, b = xo(t), v = b.length, R = xo(s), D = R.length;
          if (v != D && !w)
            return !1;
          for (var C = v; C--; ) {
            var U = b[C];
            if (!(w ? U in s : le.call(s, U)))
              return !1;
          }
          var L = g.get(t), W = g.get(s);
          if (L && W)
            return L == s && W == t;
          var j = !0;
          g.set(t, s), g.set(s, t);
          for (var $ = w; ++C < v; ) {
            U = b[C];
            var te = t[U], se = s[U];
            if (f)
              var tt = w ? f(se, te, U, s, t, g) : f(te, se, U, t, s, g);
            if (!(tt === r ? te === se || d(te, se, a, f, g) : tt)) {
              j = !1;
              break;
            }
            $ || ($ = U == "constructor");
          }
          if (j && !$) {
            var ze = t.constructor, nt = s.constructor;
            ze != nt && "constructor" in t && "constructor" in s && !(typeof ze == "function" && ze instanceof ze && typeof nt == "function" && nt instanceof nt) && (j = !1);
          }
          return g.delete(t), g.delete(s), j;
        }
        function Mt(t) {
          return Ro(Xc(t, r, cf), t + "");
        }
        function xo(t) {
          return hc(t, _e, To);
        }
        function Eo(t) {
          return hc(t, Je, Jc);
        }
        var vo = ys ? function(t) {
          return ys.get(t);
        } : Qo;
        function Ns(t) {
          for (var s = t.name + "", a = kn[s], f = le.call(kn, s) ? a.length : 0; f--; ) {
            var d = a[f], g = d.func;
            if (g == null || g == t)
              return d.name;
          }
          return s;
        }
        function Qn(t) {
          var s = le.call(p, "placeholder") ? p : t;
          return s.placeholder;
        }
        function z() {
          var t = p.iteratee || Go;
          return t = t === Go ? mc : t, arguments.length ? t(arguments[0], arguments[1]) : t;
        }
        function Os(t, s) {
          var a = t.__data__;
          return J0(s) ? a[typeof s == "string" ? "string" : "hash"] : a.map;
        }
        function Po(t) {
          for (var s = _e(t), a = s.length; a--; ) {
            var f = s[a], d = t[f];
            s[a] = [f, d, jc(d)];
          }
          return s;
        }
        function yn(t, s) {
          var a = jp(t, s);
          return gc(a) ? a : r;
        }
        function H0(t) {
          var s = le.call(t, pn), a = t[pn];
          try {
            t[pn] = r;
            var f = !0;
          } catch {
          }
          var d = ls.call(t);
          return f && (s ? t[pn] = a : delete t[pn]), d;
        }
        var To = ji ? function(t) {
          return t == null ? [] : (t = de(t), Yt(ji(t), function(s) {
            return ec.call(t, s);
          }));
        } : zo, Jc = ji ? function(t) {
          for (var s = []; t; )
            jt(s, To(t)), t = ps(t);
          return s;
        } : zo, ke = He;
        (Zi && ke(new Zi(new ArrayBuffer(1))) != Dn || mr && ke(new mr()) != ht || Xi && ke(Xi.resolve()) != fu || Fn && ke(new Fn()) != pt || Ar && ke(new Ar()) != dr) && (ke = function(t) {
          var s = He(t), a = s == Dt ? t.constructor : r, f = a ? bn(a) : "";
          if (f)
            switch (f) {
              case vg:
                return Dn;
              case Pg:
                return ht;
              case Tg:
                return fu;
              case Ig:
                return pt;
              case Bg:
                return dr;
            }
          return s;
        });
        function Q0(t, s, a) {
          for (var f = -1, d = a.length; ++f < d; ) {
            var g = a[f], w = g.size;
            switch (g.type) {
              case "drop":
                t += w;
                break;
              case "dropRight":
                s -= w;
                break;
              case "take":
                s = Fe(s, t + w);
                break;
              case "takeRight":
                t = Re(t, s - w);
                break;
            }
          }
          return { start: t, end: s };
        }
        function z0(t) {
          var s = t.match(Kh);
          return s ? s[1].split(Yh) : [];
        }
        function Kc(t, s, a) {
          s = nn(s, t);
          for (var f = -1, d = s.length, g = !1; ++f < d; ) {
            var w = vt(s[f]);
            if (!(g = t != null && a(t, w)))
              break;
            t = t[w];
          }
          return g || ++f != d ? g : (d = t == null ? 0 : t.length, !!d && Hs(d) && Ut(w, d) && (q(t) || xn(t)));
        }
        function W0(t) {
          var s = t.length, a = new t.constructor(s);
          return s && typeof t[0] == "string" && le.call(t, "index") && (a.index = t.index, a.input = t.input), a;
        }
        function Yc(t) {
          return typeof t.constructor == "function" && !Ir(t) ? Ln(ps(t)) : {};
        }
        function $0(t, s, a) {
          var f = t.constructor;
          switch (s) {
            case hr:
              return wo(t);
            case ar:
            case ur:
              return new f(+t);
            case Dn:
              return S0(t, a);
            case vi:
            case Pi:
            case Ti:
            case Ii:
            case Bi:
            case Si:
            case Ri:
            case Di:
            case _i:
              return Cc(t, a);
            case ht:
              return new f();
            case cr:
            case lr:
              return new f(t);
            case fr:
              return R0(t);
            case pt:
              return new f();
            case ts:
              return D0(t);
          }
        }
        function V0(t, s) {
          var a = s.length;
          if (!a)
            return t;
          var f = a - 1;
          return s[f] = (a > 1 ? "& " : "") + s[f], s = s.join(a > 2 ? ", " : " "), t.replace(Jh, `{
/* [wrapped with ` + s + `] */
`);
        }
        function q0(t) {
          return q(t) || xn(t) || !!(tc && t && t[tc]);
        }
        function Ut(t, s) {
          var a = typeof t;
          return s = s ?? Ee, !!s && (a == "number" || a != "symbol" && ip.test(t)) && t > -1 && t % 1 == 0 && t < s;
        }
        function Qe(t, s, a) {
          if (!xe(a))
            return !1;
          var f = typeof s;
          return (f == "number" ? qe(a) && Ut(s, a.length) : f == "string" && s in a) ? At(a[s], t) : !1;
        }
        function Io(t, s) {
          if (q(t))
            return !1;
          var a = typeof t;
          return a == "number" || a == "symbol" || a == "boolean" || t == null || et(t) ? !0 : Wh.test(t) || !zh.test(t) || s != null && t in de(s);
        }
        function J0(t) {
          var s = typeof t;
          return s == "string" || s == "number" || s == "symbol" || s == "boolean" ? t !== "__proto__" : t === null;
        }
        function Bo(t) {
          var s = Ns(t), a = p[s];
          if (typeof a != "function" || !(s in ne.prototype))
            return !1;
          if (t === a)
            return !0;
          var f = vo(a);
          return !!f && t === f[0];
        }
        function K0(t) {
          return !!ju && ju in t;
        }
        var Y0 = cs ? Ft : Wo;
        function Ir(t) {
          var s = t && t.constructor, a = typeof s == "function" && s.prototype || Un;
          return t === a;
        }
        function jc(t) {
          return t === t && !xe(t);
        }
        function Zc(t, s) {
          return function(a) {
            return a == null ? !1 : a[t] === s && (s !== r || t in de(a));
          };
        }
        function j0(t) {
          var s = Ls(t, function(f) {
            return a.size === m && a.clear(), f;
          }), a = s.cache;
          return s;
        }
        function Z0(t, s) {
          var a = t[1], f = s[1], d = a | f, g = d < (N | S | F), w = f == F && a == G || f == F && a == ie && t[7].length <= s[8] || f == (F | ie) && s[7].length <= s[8] && a == G;
          if (!(g || w))
            return t;
          f & N && (t[2] = s[2], d |= a & N ? 0 : M);
          var b = s[3];
          if (b) {
            var v = t[3];
            t[3] = v ? Oc(v, b, s[4]) : b, t[4] = v ? Zt(t[3], A) : s[4];
          }
          return b = s[5], b && (v = t[5], t[5] = v ? Mc(v, b, s[6]) : b, t[6] = v ? Zt(t[5], A) : s[6]), b = s[7], b && (t[7] = b), f & F && (t[8] = t[8] == null ? s[8] : Fe(t[8], s[8])), t[9] == null && (t[9] = s[9]), t[0] = s[0], t[1] = d, t;
        }
        function X0(t) {
          var s = [];
          if (t != null)
            for (var a in de(t))
              s.push(a);
          return s;
        }
        function em(t) {
          return ls.call(t);
        }
        function Xc(t, s, a) {
          return s = Re(s === r ? t.length - 1 : s, 0), function() {
            for (var f = arguments, d = -1, g = Re(f.length - s, 0), w = P(g); ++d < g; )
              w[d] = f[s + d];
            d = -1;
            for (var b = P(s + 1); ++d < s; )
              b[d] = f[d];
            return b[s] = a(w), je(t, this, b);
          };
        }
        function ef(t, s) {
          return s.length < 2 ? t : wn(t, ut(s, 0, -1));
        }
        function tm(t, s) {
          for (var a = t.length, f = Fe(s.length, a), d = Ve(t); f--; ) {
            var g = s[f];
            t[f] = Ut(g, a) ? d[g] : r;
          }
          return t;
        }
        function So(t, s) {
          if (!(s === "constructor" && typeof t[s] == "function") && s != "__proto__")
            return t[s];
        }
        var tf = rf(Pc), Br = mg || function(t, s) {
          return Ce.setTimeout(t, s);
        }, Ro = rf(P0);
        function nf(t, s, a) {
          var f = s + "";
          return Ro(t, V0(f, nm(z0(f), a)));
        }
        function rf(t) {
          var s = 0, a = 0;
          return function() {
            var f = bg(), d = me - (f - a);
            if (a = f, d > 0) {
              if (++s >= ce)
                return arguments[0];
            } else
              s = 0;
            return t.apply(r, arguments);
          };
        }
        function Ms(t, s) {
          var a = -1, f = t.length, d = f - 1;
          for (s = s === r ? f : s; ++a < s; ) {
            var g = fo(a, d), w = t[g];
            t[g] = t[a], t[a] = w;
          }
          return t.length = s, t;
        }
        var sf = j0(function(t) {
          var s = [];
          return t.charCodeAt(0) === 46 && s.push(""), t.replace($h, function(a, f, d, g) {
            s.push(d ? g.replace(Xh, "$1") : f || a);
          }), s;
        });
        function vt(t) {
          if (typeof t == "string" || et(t))
            return t;
          var s = t + "";
          return s == "0" && 1 / t == -1 / 0 ? "-0" : s;
        }
        function bn(t) {
          if (t != null) {
            try {
              return fs.call(t);
            } catch {
            }
            try {
              return t + "";
            } catch {
            }
          }
          return "";
        }
        function nm(t, s) {
          return st(jr, function(a) {
            var f = "_." + a[0];
            s & a[1] && !is(t, f) && t.push(f);
          }), t.sort();
        }
        function of(t) {
          if (t instanceof ne)
            return t.clone();
          var s = new ot(t.__wrapped__, t.__chain__);
          return s.__actions__ = Ve(t.__actions__), s.__index__ = t.__index__, s.__values__ = t.__values__, s;
        }
        function rm(t, s, a) {
          (a ? Qe(t, s, a) : s === r) ? s = 1 : s = Re(J(s), 0);
          var f = t == null ? 0 : t.length;
          if (!f || s < 1)
            return [];
          for (var d = 0, g = 0, w = P(As(f / s)); d < f; )
            w[g++] = ut(t, d, d += s);
          return w;
        }
        function sm(t) {
          for (var s = -1, a = t == null ? 0 : t.length, f = 0, d = []; ++s < a; ) {
            var g = t[s];
            g && (d[f++] = g);
          }
          return d;
        }
        function im() {
          var t = arguments.length;
          if (!t)
            return [];
          for (var s = P(t - 1), a = arguments[0], f = t; f--; )
            s[f - 1] = arguments[f];
          return jt(q(a) ? Ve(a) : [a], Ne(s, 1));
        }
        var om = Z(function(t, s) {
          return Te(t) ? xr(t, Ne(s, 1, Te, !0)) : [];
        }), am = Z(function(t, s) {
          var a = ct(s);
          return Te(a) && (a = r), Te(t) ? xr(t, Ne(s, 1, Te, !0), z(a, 2)) : [];
        }), um = Z(function(t, s) {
          var a = ct(s);
          return Te(a) && (a = r), Te(t) ? xr(t, Ne(s, 1, Te, !0), r, a) : [];
        });
        function cm(t, s, a) {
          var f = t == null ? 0 : t.length;
          return f ? (s = a || s === r ? 1 : J(s), ut(t, s < 0 ? 0 : s, f)) : [];
        }
        function fm(t, s, a) {
          var f = t == null ? 0 : t.length;
          return f ? (s = a || s === r ? 1 : J(s), s = f - s, ut(t, 0, s < 0 ? 0 : s)) : [];
        }
        function lm(t, s) {
          return t && t.length ? Bs(t, z(s, 3), !0, !0) : [];
        }
        function dm(t, s) {
          return t && t.length ? Bs(t, z(s, 3), !0) : [];
        }
        function hm(t, s, a, f) {
          var d = t == null ? 0 : t.length;
          return d ? (a && typeof a != "number" && Qe(t, s, a) && (a = 0, f = d), i0(t, s, a, f)) : [];
        }
        function af(t, s, a) {
          var f = t == null ? 0 : t.length;
          if (!f)
            return -1;
          var d = a == null ? 0 : J(a);
          return d < 0 && (d = Re(f + d, 0)), os(t, z(s, 3), d);
        }
        function uf(t, s, a) {
          var f = t == null ? 0 : t.length;
          if (!f)
            return -1;
          var d = f - 1;
          return a !== r && (d = J(a), d = a < 0 ? Re(f + d, 0) : Fe(d, f - 1)), os(t, z(s, 3), d, !0);
        }
        function cf(t) {
          var s = t == null ? 0 : t.length;
          return s ? Ne(t, 1) : [];
        }
        function pm(t) {
          var s = t == null ? 0 : t.length;
          return s ? Ne(t, be) : [];
        }
        function gm(t, s) {
          var a = t == null ? 0 : t.length;
          return a ? (s = s === r ? 1 : J(s), Ne(t, s)) : [];
        }
        function mm(t) {
          for (var s = -1, a = t == null ? 0 : t.length, f = {}; ++s < a; ) {
            var d = t[s];
            f[d[0]] = d[1];
          }
          return f;
        }
        function ff(t) {
          return t && t.length ? t[0] : r;
        }
        function Am(t, s, a) {
          var f = t == null ? 0 : t.length;
          if (!f)
            return -1;
          var d = a == null ? 0 : J(a);
          return d < 0 && (d = Re(f + d, 0)), Cn(t, s, d);
        }
        function wm(t) {
          var s = t == null ? 0 : t.length;
          return s ? ut(t, 0, -1) : [];
        }
        var ym = Z(function(t) {
          var s = Ae(t, mo);
          return s.length && s[0] === t[0] ? io(s) : [];
        }), bm = Z(function(t) {
          var s = ct(t), a = Ae(t, mo);
          return s === ct(a) ? s = r : a.pop(), a.length && a[0] === t[0] ? io(a, z(s, 2)) : [];
        }), xm = Z(function(t) {
          var s = ct(t), a = Ae(t, mo);
          return s = typeof s == "function" ? s : r, s && a.pop(), a.length && a[0] === t[0] ? io(a, r, s) : [];
        });
        function Em(t, s) {
          return t == null ? "" : wg.call(t, s);
        }
        function ct(t) {
          var s = t == null ? 0 : t.length;
          return s ? t[s - 1] : r;
        }
        function vm(t, s, a) {
          var f = t == null ? 0 : t.length;
          if (!f)
            return -1;
          var d = f;
          return a !== r && (d = J(a), d = d < 0 ? Re(f + d, 0) : Fe(d, f - 1)), s === s ? ng(t, s, d) : os(t, zu, d, !0);
        }
        function Pm(t, s) {
          return t && t.length ? bc(t, J(s)) : r;
        }
        var Tm = Z(lf);
        function lf(t, s) {
          return t && t.length && s && s.length ? co(t, s) : t;
        }
        function Im(t, s, a) {
          return t && t.length && s && s.length ? co(t, s, z(a, 2)) : t;
        }
        function Bm(t, s, a) {
          return t && t.length && s && s.length ? co(t, s, r, a) : t;
        }
        var Sm = Mt(function(t, s) {
          var a = t == null ? 0 : t.length, f = to(t, s);
          return vc(t, Ae(s, function(d) {
            return Ut(d, a) ? +d : d;
          }).sort(Nc)), f;
        });
        function Rm(t, s) {
          var a = [];
          if (!(t && t.length))
            return a;
          var f = -1, d = [], g = t.length;
          for (s = z(s, 3); ++f < g; ) {
            var w = t[f];
            s(w, f, t) && (a.push(w), d.push(f));
          }
          return vc(t, d), a;
        }
        function Do(t) {
          return t == null ? t : Eg.call(t);
        }
        function Dm(t, s, a) {
          var f = t == null ? 0 : t.length;
          return f ? (a && typeof a != "number" && Qe(t, s, a) ? (s = 0, a = f) : (s = s == null ? 0 : J(s), a = a === r ? f : J(a)), ut(t, s, a)) : [];
        }
        function _m(t, s) {
          return Is(t, s);
        }
        function Cm(t, s, a) {
          return ho(t, s, z(a, 2));
        }
        function Nm(t, s) {
          var a = t == null ? 0 : t.length;
          if (a) {
            var f = Is(t, s);
            if (f < a && At(t[f], s))
              return f;
          }
          return -1;
        }
        function Om(t, s) {
          return Is(t, s, !0);
        }
        function Mm(t, s, a) {
          return ho(t, s, z(a, 2), !0);
        }
        function Um(t, s) {
          var a = t == null ? 0 : t.length;
          if (a) {
            var f = Is(t, s, !0) - 1;
            if (At(t[f], s))
              return f;
          }
          return -1;
        }
        function Fm(t) {
          return t && t.length ? Tc(t) : [];
        }
        function km(t, s) {
          return t && t.length ? Tc(t, z(s, 2)) : [];
        }
        function Lm(t) {
          var s = t == null ? 0 : t.length;
          return s ? ut(t, 1, s) : [];
        }
        function Gm(t, s, a) {
          return t && t.length ? (s = a || s === r ? 1 : J(s), ut(t, 0, s < 0 ? 0 : s)) : [];
        }
        function Hm(t, s, a) {
          var f = t == null ? 0 : t.length;
          return f ? (s = a || s === r ? 1 : J(s), s = f - s, ut(t, s < 0 ? 0 : s, f)) : [];
        }
        function Qm(t, s) {
          return t && t.length ? Bs(t, z(s, 3), !1, !0) : [];
        }
        function zm(t, s) {
          return t && t.length ? Bs(t, z(s, 3)) : [];
        }
        var Wm = Z(function(t) {
          return tn(Ne(t, 1, Te, !0));
        }), $m = Z(function(t) {
          var s = ct(t);
          return Te(s) && (s = r), tn(Ne(t, 1, Te, !0), z(s, 2));
        }), Vm = Z(function(t) {
          var s = ct(t);
          return s = typeof s == "function" ? s : r, tn(Ne(t, 1, Te, !0), r, s);
        });
        function qm(t) {
          return t && t.length ? tn(t) : [];
        }
        function Jm(t, s) {
          return t && t.length ? tn(t, z(s, 2)) : [];
        }
        function Km(t, s) {
          return s = typeof s == "function" ? s : r, t && t.length ? tn(t, r, s) : [];
        }
        function _o(t) {
          if (!(t && t.length))
            return [];
          var s = 0;
          return t = Yt(t, function(a) {
            if (Te(a))
              return s = Re(a.length, s), !0;
          }), qi(s, function(a) {
            return Ae(t, Wi(a));
          });
        }
        function df(t, s) {
          if (!(t && t.length))
            return [];
          var a = _o(t);
          return s == null ? a : Ae(a, function(f) {
            return je(s, r, f);
          });
        }
        var Ym = Z(function(t, s) {
          return Te(t) ? xr(t, s) : [];
        }), jm = Z(function(t) {
          return go(Yt(t, Te));
        }), Zm = Z(function(t) {
          var s = ct(t);
          return Te(s) && (s = r), go(Yt(t, Te), z(s, 2));
        }), Xm = Z(function(t) {
          var s = ct(t);
          return s = typeof s == "function" ? s : r, go(Yt(t, Te), r, s);
        }), eA = Z(_o);
        function tA(t, s) {
          return Rc(t || [], s || [], br);
        }
        function nA(t, s) {
          return Rc(t || [], s || [], Pr);
        }
        var rA = Z(function(t) {
          var s = t.length, a = s > 1 ? t[s - 1] : r;
          return a = typeof a == "function" ? (t.pop(), a) : r, df(t, a);
        });
        function hf(t) {
          var s = p(t);
          return s.__chain__ = !0, s;
        }
        function sA(t, s) {
          return s(t), t;
        }
        function Us(t, s) {
          return s(t);
        }
        var iA = Mt(function(t) {
          var s = t.length, a = s ? t[0] : 0, f = this.__wrapped__, d = function(g) {
            return to(g, t);
          };
          return s > 1 || this.__actions__.length || !(f instanceof ne) || !Ut(a) ? this.thru(d) : (f = f.slice(a, +a + (s ? 1 : 0)), f.__actions__.push({
            func: Us,
            args: [d],
            thisArg: r
          }), new ot(f, this.__chain__).thru(function(g) {
            return s && !g.length && g.push(r), g;
          }));
        });
        function oA() {
          return hf(this);
        }
        function aA() {
          return new ot(this.value(), this.__chain__);
        }
        function uA() {
          this.__values__ === r && (this.__values__ = Bf(this.value()));
          var t = this.__index__ >= this.__values__.length, s = t ? r : this.__values__[this.__index__++];
          return { done: t, value: s };
        }
        function cA() {
          return this;
        }
        function fA(t) {
          for (var s, a = this; a instanceof xs; ) {
            var f = of(a);
            f.__index__ = 0, f.__values__ = r, s ? d.__wrapped__ = f : s = f;
            var d = f;
            a = a.__wrapped__;
          }
          return d.__wrapped__ = t, s;
        }
        function lA() {
          var t = this.__wrapped__;
          if (t instanceof ne) {
            var s = t;
            return this.__actions__.length && (s = new ne(this)), s = s.reverse(), s.__actions__.push({
              func: Us,
              args: [Do],
              thisArg: r
            }), new ot(s, this.__chain__);
          }
          return this.thru(Do);
        }
        function dA() {
          return Sc(this.__wrapped__, this.__actions__);
        }
        var hA = Ss(function(t, s, a) {
          le.call(t, a) ? ++t[a] : Nt(t, a, 1);
        });
        function pA(t, s, a) {
          var f = q(t) ? Hu : s0;
          return a && Qe(t, s, a) && (s = r), f(t, z(s, 3));
        }
        function gA(t, s) {
          var a = q(t) ? Yt : lc;
          return a(t, z(s, 3));
        }
        var mA = Lc(af), AA = Lc(uf);
        function wA(t, s) {
          return Ne(Fs(t, s), 1);
        }
        function yA(t, s) {
          return Ne(Fs(t, s), be);
        }
        function bA(t, s, a) {
          return a = a === r ? 1 : J(a), Ne(Fs(t, s), a);
        }
        function pf(t, s) {
          var a = q(t) ? st : en;
          return a(t, z(s, 3));
        }
        function gf(t, s) {
          var a = q(t) ? Lp : fc;
          return a(t, z(s, 3));
        }
        var xA = Ss(function(t, s, a) {
          le.call(t, a) ? t[a].push(s) : Nt(t, a, [s]);
        });
        function EA(t, s, a, f) {
          t = qe(t) ? t : Wn(t), a = a && !f ? J(a) : 0;
          var d = t.length;
          return a < 0 && (a = Re(d + a, 0)), Qs(t) ? a <= d && t.indexOf(s, a) > -1 : !!d && Cn(t, s, a) > -1;
        }
        var vA = Z(function(t, s, a) {
          var f = -1, d = typeof s == "function", g = qe(t) ? P(t.length) : [];
          return en(t, function(w) {
            g[++f] = d ? je(s, w, a) : Er(w, s, a);
          }), g;
        }), PA = Ss(function(t, s, a) {
          Nt(t, a, s);
        });
        function Fs(t, s) {
          var a = q(t) ? Ae : Ac;
          return a(t, z(s, 3));
        }
        function TA(t, s, a, f) {
          return t == null ? [] : (q(s) || (s = s == null ? [] : [s]), a = f ? r : a, q(a) || (a = a == null ? [] : [a]), xc(t, s, a));
        }
        var IA = Ss(function(t, s, a) {
          t[a ? 0 : 1].push(s);
        }, function() {
          return [[], []];
        });
        function BA(t, s, a) {
          var f = q(t) ? Qi : $u, d = arguments.length < 3;
          return f(t, z(s, 4), a, d, en);
        }
        function SA(t, s, a) {
          var f = q(t) ? Gp : $u, d = arguments.length < 3;
          return f(t, z(s, 4), a, d, fc);
        }
        function RA(t, s) {
          var a = q(t) ? Yt : lc;
          return a(t, Gs(z(s, 3)));
        }
        function DA(t) {
          var s = q(t) ? oc : E0;
          return s(t);
        }
        function _A(t, s, a) {
          (a ? Qe(t, s, a) : s === r) ? s = 1 : s = J(s);
          var f = q(t) ? Xg : v0;
          return f(t, s);
        }
        function CA(t) {
          var s = q(t) ? e0 : T0;
          return s(t);
        }
        function NA(t) {
          if (t == null)
            return 0;
          if (qe(t))
            return Qs(t) ? On(t) : t.length;
          var s = ke(t);
          return s == ht || s == pt ? t.size : ao(t).length;
        }
        function OA(t, s, a) {
          var f = q(t) ? zi : I0;
          return a && Qe(t, s, a) && (s = r), f(t, z(s, 3));
        }
        var MA = Z(function(t, s) {
          if (t == null)
            return [];
          var a = s.length;
          return a > 1 && Qe(t, s[0], s[1]) ? s = [] : a > 2 && Qe(s[0], s[1], s[2]) && (s = [s[0]]), xc(t, Ne(s, 1), []);
        }), ks = gg || function() {
          return Ce.Date.now();
        };
        function UA(t, s) {
          if (typeof s != "function")
            throw new it(c);
          return t = J(t), function() {
            if (--t < 1)
              return s.apply(this, arguments);
          };
        }
        function mf(t, s, a) {
          return s = a ? r : s, s = t && s == null ? t.length : s, Ot(t, F, r, r, r, r, s);
        }
        function Af(t, s) {
          var a;
          if (typeof s != "function")
            throw new it(c);
          return t = J(t), function() {
            return --t > 0 && (a = s.apply(this, arguments)), t <= 1 && (s = r), a;
          };
        }
        var Co = Z(function(t, s, a) {
          var f = N;
          if (a.length) {
            var d = Zt(a, Qn(Co));
            f |= H;
          }
          return Ot(t, f, s, a, d);
        }), wf = Z(function(t, s, a) {
          var f = N | S;
          if (a.length) {
            var d = Zt(a, Qn(wf));
            f |= H;
          }
          return Ot(s, f, t, a, d);
        });
        function yf(t, s, a) {
          s = a ? r : s;
          var f = Ot(t, G, r, r, r, r, r, s);
          return f.placeholder = yf.placeholder, f;
        }
        function bf(t, s, a) {
          s = a ? r : s;
          var f = Ot(t, ee, r, r, r, r, r, s);
          return f.placeholder = bf.placeholder, f;
        }
        function xf(t, s, a) {
          var f, d, g, w, b, v, R = 0, D = !1, C = !1, U = !0;
          if (typeof t != "function")
            throw new it(c);
          s = ft(s) || 0, xe(a) && (D = !!a.leading, C = "maxWait" in a, g = C ? Re(ft(a.maxWait) || 0, s) : g, U = "trailing" in a ? !!a.trailing : U);
          function L(Ie) {
            var wt = f, Lt = d;
            return f = d = r, R = Ie, w = t.apply(Lt, wt), w;
          }
          function W(Ie) {
            return R = Ie, b = Br(te, s), D ? L(Ie) : w;
          }
          function j(Ie) {
            var wt = Ie - v, Lt = Ie - R, Gf = s - wt;
            return C ? Fe(Gf, g - Lt) : Gf;
          }
          function $(Ie) {
            var wt = Ie - v, Lt = Ie - R;
            return v === r || wt >= s || wt < 0 || C && Lt >= g;
          }
          function te() {
            var Ie = ks();
            if ($(Ie))
              return se(Ie);
            b = Br(te, j(Ie));
          }
          function se(Ie) {
            return b = r, U && f ? L(Ie) : (f = d = r, w);
          }
          function tt() {
            b !== r && Dc(b), R = 0, f = v = d = b = r;
          }
          function ze() {
            return b === r ? w : se(ks());
          }
          function nt() {
            var Ie = ks(), wt = $(Ie);
            if (f = arguments, d = this, v = Ie, wt) {
              if (b === r)
                return W(v);
              if (C)
                return Dc(b), b = Br(te, s), L(v);
            }
            return b === r && (b = Br(te, s)), w;
          }
          return nt.cancel = tt, nt.flush = ze, nt;
        }
        var FA = Z(function(t, s) {
          return cc(t, 1, s);
        }), kA = Z(function(t, s, a) {
          return cc(t, ft(s) || 0, a);
        });
        function LA(t) {
          return Ot(t, K);
        }
        function Ls(t, s) {
          if (typeof t != "function" || s != null && typeof s != "function")
            throw new it(c);
          var a = function() {
            var f = arguments, d = s ? s.apply(this, f) : f[0], g = a.cache;
            if (g.has(d))
              return g.get(d);
            var w = t.apply(this, f);
            return a.cache = g.set(d, w) || g, w;
          };
          return a.cache = new (Ls.Cache || Ct)(), a;
        }
        Ls.Cache = Ct;
        function Gs(t) {
          if (typeof t != "function")
            throw new it(c);
          return function() {
            var s = arguments;
            switch (s.length) {
              case 0:
                return !t.call(this);
              case 1:
                return !t.call(this, s[0]);
              case 2:
                return !t.call(this, s[0], s[1]);
              case 3:
                return !t.call(this, s[0], s[1], s[2]);
            }
            return !t.apply(this, s);
          };
        }
        function GA(t) {
          return Af(2, t);
        }
        var HA = B0(function(t, s) {
          s = s.length == 1 && q(s[0]) ? Ae(s[0], Ze(z())) : Ae(Ne(s, 1), Ze(z()));
          var a = s.length;
          return Z(function(f) {
            for (var d = -1, g = Fe(f.length, a); ++d < g; )
              f[d] = s[d].call(this, f[d]);
            return je(t, this, f);
          });
        }), No = Z(function(t, s) {
          var a = Zt(s, Qn(No));
          return Ot(t, H, r, s, a);
        }), Ef = Z(function(t, s) {
          var a = Zt(s, Qn(Ef));
          return Ot(t, Q, r, s, a);
        }), QA = Mt(function(t, s) {
          return Ot(t, ie, r, r, r, s);
        });
        function zA(t, s) {
          if (typeof t != "function")
            throw new it(c);
          return s = s === r ? s : J(s), Z(t, s);
        }
        function WA(t, s) {
          if (typeof t != "function")
            throw new it(c);
          return s = s == null ? 0 : Re(J(s), 0), Z(function(a) {
            var f = a[s], d = rn(a, 0, s);
            return f && jt(d, f), je(t, this, d);
          });
        }
        function $A(t, s, a) {
          var f = !0, d = !0;
          if (typeof t != "function")
            throw new it(c);
          return xe(a) && (f = "leading" in a ? !!a.leading : f, d = "trailing" in a ? !!a.trailing : d), xf(t, s, {
            leading: f,
            maxWait: s,
            trailing: d
          });
        }
        function VA(t) {
          return mf(t, 1);
        }
        function qA(t, s) {
          return No(Ao(s), t);
        }
        function JA() {
          if (!arguments.length)
            return [];
          var t = arguments[0];
          return q(t) ? t : [t];
        }
        function KA(t) {
          return at(t, T);
        }
        function YA(t, s) {
          return s = typeof s == "function" ? s : r, at(t, T, s);
        }
        function jA(t) {
          return at(t, y | T);
        }
        function ZA(t, s) {
          return s = typeof s == "function" ? s : r, at(t, y | T, s);
        }
        function XA(t, s) {
          return s == null || uc(t, s, _e(s));
        }
        function At(t, s) {
          return t === s || t !== t && s !== s;
        }
        var ew = Cs(so), tw = Cs(function(t, s) {
          return t >= s;
        }), xn = pc(/* @__PURE__ */ function() {
          return arguments;
        }()) ? pc : function(t) {
          return ve(t) && le.call(t, "callee") && !ec.call(t, "callee");
        }, q = P.isArray, nw = Mu ? Ze(Mu) : f0;
        function qe(t) {
          return t != null && Hs(t.length) && !Ft(t);
        }
        function Te(t) {
          return ve(t) && qe(t);
        }
        function rw(t) {
          return t === !0 || t === !1 || ve(t) && He(t) == ar;
        }
        var sn = Ag || Wo, sw = Uu ? Ze(Uu) : l0;
        function iw(t) {
          return ve(t) && t.nodeType === 1 && !Sr(t);
        }
        function ow(t) {
          if (t == null)
            return !0;
          if (qe(t) && (q(t) || typeof t == "string" || typeof t.splice == "function" || sn(t) || zn(t) || xn(t)))
            return !t.length;
          var s = ke(t);
          if (s == ht || s == pt)
            return !t.size;
          if (Ir(t))
            return !ao(t).length;
          for (var a in t)
            if (le.call(t, a))
              return !1;
          return !0;
        }
        function aw(t, s) {
          return vr(t, s);
        }
        function uw(t, s, a) {
          a = typeof a == "function" ? a : r;
          var f = a ? a(t, s) : r;
          return f === r ? vr(t, s, r, a) : !!f;
        }
        function Oo(t) {
          if (!ve(t))
            return !1;
          var s = He(t);
          return s == Xr || s == _h || typeof t.message == "string" && typeof t.name == "string" && !Sr(t);
        }
        function cw(t) {
          return typeof t == "number" && nc(t);
        }
        function Ft(t) {
          if (!xe(t))
            return !1;
          var s = He(t);
          return s == es || s == cu || s == Dh || s == Nh;
        }
        function vf(t) {
          return typeof t == "number" && t == J(t);
        }
        function Hs(t) {
          return typeof t == "number" && t > -1 && t % 1 == 0 && t <= Ee;
        }
        function xe(t) {
          var s = typeof t;
          return t != null && (s == "object" || s == "function");
        }
        function ve(t) {
          return t != null && typeof t == "object";
        }
        var Pf = Fu ? Ze(Fu) : h0;
        function fw(t, s) {
          return t === s || oo(t, s, Po(s));
        }
        function lw(t, s, a) {
          return a = typeof a == "function" ? a : r, oo(t, s, Po(s), a);
        }
        function dw(t) {
          return Tf(t) && t != +t;
        }
        function hw(t) {
          if (Y0(t))
            throw new V(u);
          return gc(t);
        }
        function pw(t) {
          return t === null;
        }
        function gw(t) {
          return t == null;
        }
        function Tf(t) {
          return typeof t == "number" || ve(t) && He(t) == cr;
        }
        function Sr(t) {
          if (!ve(t) || He(t) != Dt)
            return !1;
          var s = ps(t);
          if (s === null)
            return !0;
          var a = le.call(s, "constructor") && s.constructor;
          return typeof a == "function" && a instanceof a && fs.call(a) == lg;
        }
        var Mo = ku ? Ze(ku) : p0;
        function mw(t) {
          return vf(t) && t >= -9007199254740991 && t <= Ee;
        }
        var If = Lu ? Ze(Lu) : g0;
        function Qs(t) {
          return typeof t == "string" || !q(t) && ve(t) && He(t) == lr;
        }
        function et(t) {
          return typeof t == "symbol" || ve(t) && He(t) == ts;
        }
        var zn = Gu ? Ze(Gu) : m0;
        function Aw(t) {
          return t === r;
        }
        function ww(t) {
          return ve(t) && ke(t) == dr;
        }
        function yw(t) {
          return ve(t) && He(t) == Mh;
        }
        var bw = Cs(uo), xw = Cs(function(t, s) {
          return t <= s;
        });
        function Bf(t) {
          if (!t)
            return [];
          if (qe(t))
            return Qs(t) ? gt(t) : Ve(t);
          if (gr && t[gr])
            return Xp(t[gr]());
          var s = ke(t), a = s == ht ? Ki : s == pt ? as : Wn;
          return a(t);
        }
        function kt(t) {
          if (!t)
            return t === 0 ? t : 0;
          if (t = ft(t), t === be || t === -1 / 0) {
            var s = t < 0 ? -1 : 1;
            return s * Ue;
          }
          return t === t ? t : 0;
        }
        function J(t) {
          var s = kt(t), a = s % 1;
          return s === s ? a ? s - a : s : 0;
        }
        function Sf(t) {
          return t ? An(J(t), 0, dt) : 0;
        }
        function ft(t) {
          if (typeof t == "number")
            return t;
          if (et(t))
            return Rt;
          if (xe(t)) {
            var s = typeof t.valueOf == "function" ? t.valueOf() : t;
            t = xe(s) ? s + "" : s;
          }
          if (typeof t != "string")
            return t === 0 ? t : +t;
          t = Vu(t);
          var a = np.test(t);
          return a || sp.test(t) ? Up(t.slice(2), a ? 2 : 8) : tp.test(t) ? Rt : +t;
        }
        function Rf(t) {
          return Et(t, Je(t));
        }
        function Ew(t) {
          return t ? An(J(t), -9007199254740991, Ee) : t === 0 ? t : 0;
        }
        function fe(t) {
          return t == null ? "" : Xe(t);
        }
        var vw = Gn(function(t, s) {
          if (Ir(s) || qe(s)) {
            Et(s, _e(s), t);
            return;
          }
          for (var a in s)
            le.call(s, a) && br(t, a, s[a]);
        }), Df = Gn(function(t, s) {
          Et(s, Je(s), t);
        }), zs = Gn(function(t, s, a, f) {
          Et(s, Je(s), t, f);
        }), Pw = Gn(function(t, s, a, f) {
          Et(s, _e(s), t, f);
        }), Tw = Mt(to);
        function Iw(t, s) {
          var a = Ln(t);
          return s == null ? a : ac(a, s);
        }
        var Bw = Z(function(t, s) {
          t = de(t);
          var a = -1, f = s.length, d = f > 2 ? s[2] : r;
          for (d && Qe(s[0], s[1], d) && (f = 1); ++a < f; )
            for (var g = s[a], w = Je(g), b = -1, v = w.length; ++b < v; ) {
              var R = w[b], D = t[R];
              (D === r || At(D, Un[R]) && !le.call(t, R)) && (t[R] = g[R]);
            }
          return t;
        }), Sw = Z(function(t) {
          return t.push(r, Vc), je(_f, r, t);
        });
        function Rw(t, s) {
          return Qu(t, z(s, 3), xt);
        }
        function Dw(t, s) {
          return Qu(t, z(s, 3), ro);
        }
        function _w(t, s) {
          return t == null ? t : no(t, z(s, 3), Je);
        }
        function Cw(t, s) {
          return t == null ? t : dc(t, z(s, 3), Je);
        }
        function Nw(t, s) {
          return t && xt(t, z(s, 3));
        }
        function Ow(t, s) {
          return t && ro(t, z(s, 3));
        }
        function Mw(t) {
          return t == null ? [] : Ps(t, _e(t));
        }
        function Uw(t) {
          return t == null ? [] : Ps(t, Je(t));
        }
        function Uo(t, s, a) {
          var f = t == null ? r : wn(t, s);
          return f === r ? a : f;
        }
        function Fw(t, s) {
          return t != null && Kc(t, s, o0);
        }
        function Fo(t, s) {
          return t != null && Kc(t, s, a0);
        }
        var kw = Hc(function(t, s, a) {
          s != null && typeof s.toString != "function" && (s = ls.call(s)), t[s] = a;
        }, Lo(Ke)), Lw = Hc(function(t, s, a) {
          s != null && typeof s.toString != "function" && (s = ls.call(s)), le.call(t, s) ? t[s].push(a) : t[s] = [a];
        }, z), Gw = Z(Er);
        function _e(t) {
          return qe(t) ? ic(t) : ao(t);
        }
        function Je(t) {
          return qe(t) ? ic(t, !0) : A0(t);
        }
        function Hw(t, s) {
          var a = {};
          return s = z(s, 3), xt(t, function(f, d, g) {
            Nt(a, s(f, d, g), f);
          }), a;
        }
        function Qw(t, s) {
          var a = {};
          return s = z(s, 3), xt(t, function(f, d, g) {
            Nt(a, d, s(f, d, g));
          }), a;
        }
        var zw = Gn(function(t, s, a) {
          Ts(t, s, a);
        }), _f = Gn(function(t, s, a, f) {
          Ts(t, s, a, f);
        }), Ww = Mt(function(t, s) {
          var a = {};
          if (t == null)
            return a;
          var f = !1;
          s = Ae(s, function(g) {
            return g = nn(g, t), f || (f = g.length > 1), g;
          }), Et(t, Eo(t), a), f && (a = at(a, y | x | T, k0));
          for (var d = s.length; d--; )
            po(a, s[d]);
          return a;
        });
        function $w(t, s) {
          return Cf(t, Gs(z(s)));
        }
        var Vw = Mt(function(t, s) {
          return t == null ? {} : y0(t, s);
        });
        function Cf(t, s) {
          if (t == null)
            return {};
          var a = Ae(Eo(t), function(f) {
            return [f];
          });
          return s = z(s), Ec(t, a, function(f, d) {
            return s(f, d[0]);
          });
        }
        function qw(t, s, a) {
          s = nn(s, t);
          var f = -1, d = s.length;
          for (d || (d = 1, t = r); ++f < d; ) {
            var g = t == null ? r : t[vt(s[f])];
            g === r && (f = d, g = a), t = Ft(g) ? g.call(t) : g;
          }
          return t;
        }
        function Jw(t, s, a) {
          return t == null ? t : Pr(t, s, a);
        }
        function Kw(t, s, a, f) {
          return f = typeof f == "function" ? f : r, t == null ? t : Pr(t, s, a, f);
        }
        var Nf = Wc(_e), Of = Wc(Je);
        function Yw(t, s, a) {
          var f = q(t), d = f || sn(t) || zn(t);
          if (s = z(s, 4), a == null) {
            var g = t && t.constructor;
            d ? a = f ? new g() : [] : xe(t) ? a = Ft(g) ? Ln(ps(t)) : {} : a = {};
          }
          return (d ? st : xt)(t, function(w, b, v) {
            return s(a, w, b, v);
          }), a;
        }
        function jw(t, s) {
          return t == null ? !0 : po(t, s);
        }
        function Zw(t, s, a) {
          return t == null ? t : Bc(t, s, Ao(a));
        }
        function Xw(t, s, a, f) {
          return f = typeof f == "function" ? f : r, t == null ? t : Bc(t, s, Ao(a), f);
        }
        function Wn(t) {
          return t == null ? [] : Ji(t, _e(t));
        }
        function ey(t) {
          return t == null ? [] : Ji(t, Je(t));
        }
        function ty(t, s, a) {
          return a === r && (a = s, s = r), a !== r && (a = ft(a), a = a === a ? a : 0), s !== r && (s = ft(s), s = s === s ? s : 0), An(ft(t), s, a);
        }
        function ny(t, s, a) {
          return s = kt(s), a === r ? (a = s, s = 0) : a = kt(a), t = ft(t), u0(t, s, a);
        }
        function ry(t, s, a) {
          if (a && typeof a != "boolean" && Qe(t, s, a) && (s = a = r), a === r && (typeof s == "boolean" ? (a = s, s = r) : typeof t == "boolean" && (a = t, t = r)), t === r && s === r ? (t = 0, s = 1) : (t = kt(t), s === r ? (s = t, t = 0) : s = kt(s)), t > s) {
            var f = t;
            t = s, s = f;
          }
          if (a || t % 1 || s % 1) {
            var d = rc();
            return Fe(t + d * (s - t + Mp("1e-" + ((d + "").length - 1))), s);
          }
          return fo(t, s);
        }
        var sy = Hn(function(t, s, a) {
          return s = s.toLowerCase(), t + (a ? Mf(s) : s);
        });
        function Mf(t) {
          return ko(fe(t).toLowerCase());
        }
        function Uf(t) {
          return t = fe(t), t && t.replace(op, Jp).replace(Tp, "");
        }
        function iy(t, s, a) {
          t = fe(t), s = Xe(s);
          var f = t.length;
          a = a === r ? f : An(J(a), 0, f);
          var d = a;
          return a -= s.length, a >= 0 && t.slice(a, d) == s;
        }
        function oy(t) {
          return t = fe(t), t && Gh.test(t) ? t.replace(du, Kp) : t;
        }
        function ay(t) {
          return t = fe(t), t && Vh.test(t) ? t.replace(Ci, "\\$&") : t;
        }
        var uy = Hn(function(t, s, a) {
          return t + (a ? "-" : "") + s.toLowerCase();
        }), cy = Hn(function(t, s, a) {
          return t + (a ? " " : "") + s.toLowerCase();
        }), fy = kc("toLowerCase");
        function ly(t, s, a) {
          t = fe(t), s = J(s);
          var f = s ? On(t) : 0;
          if (!s || f >= s)
            return t;
          var d = (s - f) / 2;
          return _s(ws(d), a) + t + _s(As(d), a);
        }
        function dy(t, s, a) {
          t = fe(t), s = J(s);
          var f = s ? On(t) : 0;
          return s && f < s ? t + _s(s - f, a) : t;
        }
        function hy(t, s, a) {
          t = fe(t), s = J(s);
          var f = s ? On(t) : 0;
          return s && f < s ? _s(s - f, a) + t : t;
        }
        function py(t, s, a) {
          return a || s == null ? s = 0 : s && (s = +s), xg(fe(t).replace(Ni, ""), s || 0);
        }
        function gy(t, s, a) {
          return (a ? Qe(t, s, a) : s === r) ? s = 1 : s = J(s), lo(fe(t), s);
        }
        function my() {
          var t = arguments, s = fe(t[0]);
          return t.length < 3 ? s : s.replace(t[1], t[2]);
        }
        var Ay = Hn(function(t, s, a) {
          return t + (a ? "_" : "") + s.toLowerCase();
        });
        function wy(t, s, a) {
          return a && typeof a != "number" && Qe(t, s, a) && (s = a = r), a = a === r ? dt : a >>> 0, a ? (t = fe(t), t && (typeof s == "string" || s != null && !Mo(s)) && (s = Xe(s), !s && Nn(t)) ? rn(gt(t), 0, a) : t.split(s, a)) : [];
        }
        var yy = Hn(function(t, s, a) {
          return t + (a ? " " : "") + ko(s);
        });
        function by(t, s, a) {
          return t = fe(t), a = a == null ? 0 : An(J(a), 0, t.length), s = Xe(s), t.slice(a, a + s.length) == s;
        }
        function xy(t, s, a) {
          var f = p.templateSettings;
          a && Qe(t, s, a) && (s = r), t = fe(t), s = zs({}, s, f, $c);
          var d = zs({}, s.imports, f.imports, $c), g = _e(d), w = Ji(d, g), b, v, R = 0, D = s.interpolate || ns, C = "__p += '", U = Yi(
            (s.escape || ns).source + "|" + D.source + "|" + (D === hu ? ep : ns).source + "|" + (s.evaluate || ns).source + "|$",
            "g"
          ), L = "//# sourceURL=" + (le.call(s, "sourceURL") ? (s.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Dp + "]") + `
`;
          t.replace(U, function($, te, se, tt, ze, nt) {
            return se || (se = tt), C += t.slice(R, nt).replace(ap, Yp), te && (b = !0, C += `' +
__e(` + te + `) +
'`), ze && (v = !0, C += `';
` + ze + `;
__p += '`), se && (C += `' +
((__t = (` + se + `)) == null ? '' : __t) +
'`), R = nt + $.length, $;
          }), C += `';
`;
          var W = le.call(s, "variable") && s.variable;
          if (!W)
            C = `with (obj) {
` + C + `
}
`;
          else if (Zh.test(W))
            throw new V(l);
          C = (v ? C.replace(Uh, "") : C).replace(Fh, "$1").replace(kh, "$1;"), C = "function(" + (W || "obj") + `) {
` + (W ? "" : `obj || (obj = {});
`) + "var __t, __p = ''" + (b ? ", __e = _.escape" : "") + (v ? `, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
` : `;
`) + C + `return __p
}`;
          var j = kf(function() {
            return ue(g, L + "return " + C).apply(r, w);
          });
          if (j.source = C, Oo(j))
            throw j;
          return j;
        }
        function Ey(t) {
          return fe(t).toLowerCase();
        }
        function vy(t) {
          return fe(t).toUpperCase();
        }
        function Py(t, s, a) {
          if (t = fe(t), t && (a || s === r))
            return Vu(t);
          if (!t || !(s = Xe(s)))
            return t;
          var f = gt(t), d = gt(s), g = qu(f, d), w = Ju(f, d) + 1;
          return rn(f, g, w).join("");
        }
        function Ty(t, s, a) {
          if (t = fe(t), t && (a || s === r))
            return t.slice(0, Yu(t) + 1);
          if (!t || !(s = Xe(s)))
            return t;
          var f = gt(t), d = Ju(f, gt(s)) + 1;
          return rn(f, 0, d).join("");
        }
        function Iy(t, s, a) {
          if (t = fe(t), t && (a || s === r))
            return t.replace(Ni, "");
          if (!t || !(s = Xe(s)))
            return t;
          var f = gt(t), d = qu(f, gt(s));
          return rn(f, d).join("");
        }
        function By(t, s) {
          var a = pe, f = Y;
          if (xe(s)) {
            var d = "separator" in s ? s.separator : d;
            a = "length" in s ? J(s.length) : a, f = "omission" in s ? Xe(s.omission) : f;
          }
          t = fe(t);
          var g = t.length;
          if (Nn(t)) {
            var w = gt(t);
            g = w.length;
          }
          if (a >= g)
            return t;
          var b = a - On(f);
          if (b < 1)
            return f;
          var v = w ? rn(w, 0, b).join("") : t.slice(0, b);
          if (d === r)
            return v + f;
          if (w && (b += v.length - b), Mo(d)) {
            if (t.slice(b).search(d)) {
              var R, D = v;
              for (d.global || (d = Yi(d.source, fe(pu.exec(d)) + "g")), d.lastIndex = 0; R = d.exec(D); )
                var C = R.index;
              v = v.slice(0, C === r ? b : C);
            }
          } else if (t.indexOf(Xe(d), b) != b) {
            var U = v.lastIndexOf(d);
            U > -1 && (v = v.slice(0, U));
          }
          return v + f;
        }
        function Sy(t) {
          return t = fe(t), t && Lh.test(t) ? t.replace(lu, rg) : t;
        }
        var Ry = Hn(function(t, s, a) {
          return t + (a ? " " : "") + s.toUpperCase();
        }), ko = kc("toUpperCase");
        function Ff(t, s, a) {
          return t = fe(t), s = a ? r : s, s === r ? Zp(t) ? og(t) : zp(t) : t.match(s) || [];
        }
        var kf = Z(function(t, s) {
          try {
            return je(t, r, s);
          } catch (a) {
            return Oo(a) ? a : new V(a);
          }
        }), Dy = Mt(function(t, s) {
          return st(s, function(a) {
            a = vt(a), Nt(t, a, Co(t[a], t));
          }), t;
        });
        function _y(t) {
          var s = t == null ? 0 : t.length, a = z();
          return t = s ? Ae(t, function(f) {
            if (typeof f[1] != "function")
              throw new it(c);
            return [a(f[0]), f[1]];
          }) : [], Z(function(f) {
            for (var d = -1; ++d < s; ) {
              var g = t[d];
              if (je(g[0], this, f))
                return je(g[1], this, f);
            }
          });
        }
        function Cy(t) {
          return r0(at(t, y));
        }
        function Lo(t) {
          return function() {
            return t;
          };
        }
        function Ny(t, s) {
          return t == null || t !== t ? s : t;
        }
        var Oy = Gc(), My = Gc(!0);
        function Ke(t) {
          return t;
        }
        function Go(t) {
          return mc(typeof t == "function" ? t : at(t, y));
        }
        function Uy(t) {
          return wc(at(t, y));
        }
        function Fy(t, s) {
          return yc(t, at(s, y));
        }
        var ky = Z(function(t, s) {
          return function(a) {
            return Er(a, t, s);
          };
        }), Ly = Z(function(t, s) {
          return function(a) {
            return Er(t, a, s);
          };
        });
        function Ho(t, s, a) {
          var f = _e(s), d = Ps(s, f);
          a == null && !(xe(s) && (d.length || !f.length)) && (a = s, s = t, t = this, d = Ps(s, _e(s)));
          var g = !(xe(a) && "chain" in a) || !!a.chain, w = Ft(t);
          return st(d, function(b) {
            var v = s[b];
            t[b] = v, w && (t.prototype[b] = function() {
              var R = this.__chain__;
              if (g || R) {
                var D = t(this.__wrapped__), C = D.__actions__ = Ve(this.__actions__);
                return C.push({ func: v, args: arguments, thisArg: t }), D.__chain__ = R, D;
              }
              return v.apply(t, jt([this.value()], arguments));
            });
          }), t;
        }
        function Gy() {
          return Ce._ === this && (Ce._ = dg), this;
        }
        function Qo() {
        }
        function Hy(t) {
          return t = J(t), Z(function(s) {
            return bc(s, t);
          });
        }
        var Qy = yo(Ae), zy = yo(Hu), Wy = yo(zi);
        function Lf(t) {
          return Io(t) ? Wi(vt(t)) : b0(t);
        }
        function $y(t) {
          return function(s) {
            return t == null ? r : wn(t, s);
          };
        }
        var Vy = Qc(), qy = Qc(!0);
        function zo() {
          return [];
        }
        function Wo() {
          return !1;
        }
        function Jy() {
          return {};
        }
        function Ky() {
          return "";
        }
        function Yy() {
          return !0;
        }
        function jy(t, s) {
          if (t = J(t), t < 1 || t > Ee)
            return [];
          var a = dt, f = Fe(t, dt);
          s = z(s), t -= dt;
          for (var d = qi(f, s); ++a < t; )
            s(a);
          return d;
        }
        function Zy(t) {
          return q(t) ? Ae(t, vt) : et(t) ? [t] : Ve(sf(fe(t)));
        }
        function Xy(t) {
          var s = ++fg;
          return fe(t) + s;
        }
        var eb = Ds(function(t, s) {
          return t + s;
        }, 0), tb = bo("ceil"), nb = Ds(function(t, s) {
          return t / s;
        }, 1), rb = bo("floor");
        function sb(t) {
          return t && t.length ? vs(t, Ke, so) : r;
        }
        function ib(t, s) {
          return t && t.length ? vs(t, z(s, 2), so) : r;
        }
        function ob(t) {
          return Wu(t, Ke);
        }
        function ab(t, s) {
          return Wu(t, z(s, 2));
        }
        function ub(t) {
          return t && t.length ? vs(t, Ke, uo) : r;
        }
        function cb(t, s) {
          return t && t.length ? vs(t, z(s, 2), uo) : r;
        }
        var fb = Ds(function(t, s) {
          return t * s;
        }, 1), lb = bo("round"), db = Ds(function(t, s) {
          return t - s;
        }, 0);
        function hb(t) {
          return t && t.length ? Vi(t, Ke) : 0;
        }
        function pb(t, s) {
          return t && t.length ? Vi(t, z(s, 2)) : 0;
        }
        return p.after = UA, p.ary = mf, p.assign = vw, p.assignIn = Df, p.assignInWith = zs, p.assignWith = Pw, p.at = Tw, p.before = Af, p.bind = Co, p.bindAll = Dy, p.bindKey = wf, p.castArray = JA, p.chain = hf, p.chunk = rm, p.compact = sm, p.concat = im, p.cond = _y, p.conforms = Cy, p.constant = Lo, p.countBy = hA, p.create = Iw, p.curry = yf, p.curryRight = bf, p.debounce = xf, p.defaults = Bw, p.defaultsDeep = Sw, p.defer = FA, p.delay = kA, p.difference = om, p.differenceBy = am, p.differenceWith = um, p.drop = cm, p.dropRight = fm, p.dropRightWhile = lm, p.dropWhile = dm, p.fill = hm, p.filter = gA, p.flatMap = wA, p.flatMapDeep = yA, p.flatMapDepth = bA, p.flatten = cf, p.flattenDeep = pm, p.flattenDepth = gm, p.flip = LA, p.flow = Oy, p.flowRight = My, p.fromPairs = mm, p.functions = Mw, p.functionsIn = Uw, p.groupBy = xA, p.initial = wm, p.intersection = ym, p.intersectionBy = bm, p.intersectionWith = xm, p.invert = kw, p.invertBy = Lw, p.invokeMap = vA, p.iteratee = Go, p.keyBy = PA, p.keys = _e, p.keysIn = Je, p.map = Fs, p.mapKeys = Hw, p.mapValues = Qw, p.matches = Uy, p.matchesProperty = Fy, p.memoize = Ls, p.merge = zw, p.mergeWith = _f, p.method = ky, p.methodOf = Ly, p.mixin = Ho, p.negate = Gs, p.nthArg = Hy, p.omit = Ww, p.omitBy = $w, p.once = GA, p.orderBy = TA, p.over = Qy, p.overArgs = HA, p.overEvery = zy, p.overSome = Wy, p.partial = No, p.partialRight = Ef, p.partition = IA, p.pick = Vw, p.pickBy = Cf, p.property = Lf, p.propertyOf = $y, p.pull = Tm, p.pullAll = lf, p.pullAllBy = Im, p.pullAllWith = Bm, p.pullAt = Sm, p.range = Vy, p.rangeRight = qy, p.rearg = QA, p.reject = RA, p.remove = Rm, p.rest = zA, p.reverse = Do, p.sampleSize = _A, p.set = Jw, p.setWith = Kw, p.shuffle = CA, p.slice = Dm, p.sortBy = MA, p.sortedUniq = Fm, p.sortedUniqBy = km, p.split = wy, p.spread = WA, p.tail = Lm, p.take = Gm, p.takeRight = Hm, p.takeRightWhile = Qm, p.takeWhile = zm, p.tap = sA, p.throttle = $A, p.thru = Us, p.toArray = Bf, p.toPairs = Nf, p.toPairsIn = Of, p.toPath = Zy, p.toPlainObject = Rf, p.transform = Yw, p.unary = VA, p.union = Wm, p.unionBy = $m, p.unionWith = Vm, p.uniq = qm, p.uniqBy = Jm, p.uniqWith = Km, p.unset = jw, p.unzip = _o, p.unzipWith = df, p.update = Zw, p.updateWith = Xw, p.values = Wn, p.valuesIn = ey, p.without = Ym, p.words = Ff, p.wrap = qA, p.xor = jm, p.xorBy = Zm, p.xorWith = Xm, p.zip = eA, p.zipObject = tA, p.zipObjectDeep = nA, p.zipWith = rA, p.entries = Nf, p.entriesIn = Of, p.extend = Df, p.extendWith = zs, Ho(p, p), p.add = eb, p.attempt = kf, p.camelCase = sy, p.capitalize = Mf, p.ceil = tb, p.clamp = ty, p.clone = KA, p.cloneDeep = jA, p.cloneDeepWith = ZA, p.cloneWith = YA, p.conformsTo = XA, p.deburr = Uf, p.defaultTo = Ny, p.divide = nb, p.endsWith = iy, p.eq = At, p.escape = oy, p.escapeRegExp = ay, p.every = pA, p.find = mA, p.findIndex = af, p.findKey = Rw, p.findLast = AA, p.findLastIndex = uf, p.findLastKey = Dw, p.floor = rb, p.forEach = pf, p.forEachRight = gf, p.forIn = _w, p.forInRight = Cw, p.forOwn = Nw, p.forOwnRight = Ow, p.get = Uo, p.gt = ew, p.gte = tw, p.has = Fw, p.hasIn = Fo, p.head = ff, p.identity = Ke, p.includes = EA, p.indexOf = Am, p.inRange = ny, p.invoke = Gw, p.isArguments = xn, p.isArray = q, p.isArrayBuffer = nw, p.isArrayLike = qe, p.isArrayLikeObject = Te, p.isBoolean = rw, p.isBuffer = sn, p.isDate = sw, p.isElement = iw, p.isEmpty = ow, p.isEqual = aw, p.isEqualWith = uw, p.isError = Oo, p.isFinite = cw, p.isFunction = Ft, p.isInteger = vf, p.isLength = Hs, p.isMap = Pf, p.isMatch = fw, p.isMatchWith = lw, p.isNaN = dw, p.isNative = hw, p.isNil = gw, p.isNull = pw, p.isNumber = Tf, p.isObject = xe, p.isObjectLike = ve, p.isPlainObject = Sr, p.isRegExp = Mo, p.isSafeInteger = mw, p.isSet = If, p.isString = Qs, p.isSymbol = et, p.isTypedArray = zn, p.isUndefined = Aw, p.isWeakMap = ww, p.isWeakSet = yw, p.join = Em, p.kebabCase = uy, p.last = ct, p.lastIndexOf = vm, p.lowerCase = cy, p.lowerFirst = fy, p.lt = bw, p.lte = xw, p.max = sb, p.maxBy = ib, p.mean = ob, p.meanBy = ab, p.min = ub, p.minBy = cb, p.stubArray = zo, p.stubFalse = Wo, p.stubObject = Jy, p.stubString = Ky, p.stubTrue = Yy, p.multiply = fb, p.nth = Pm, p.noConflict = Gy, p.noop = Qo, p.now = ks, p.pad = ly, p.padEnd = dy, p.padStart = hy, p.parseInt = py, p.random = ry, p.reduce = BA, p.reduceRight = SA, p.repeat = gy, p.replace = my, p.result = qw, p.round = lb, p.runInContext = E, p.sample = DA, p.size = NA, p.snakeCase = Ay, p.some = OA, p.sortedIndex = _m, p.sortedIndexBy = Cm, p.sortedIndexOf = Nm, p.sortedLastIndex = Om, p.sortedLastIndexBy = Mm, p.sortedLastIndexOf = Um, p.startCase = yy, p.startsWith = by, p.subtract = db, p.sum = hb, p.sumBy = pb, p.template = xy, p.times = jy, p.toFinite = kt, p.toInteger = J, p.toLength = Sf, p.toLower = Ey, p.toNumber = ft, p.toSafeInteger = Ew, p.toString = fe, p.toUpper = vy, p.trim = Py, p.trimEnd = Ty, p.trimStart = Iy, p.truncate = By, p.unescape = Sy, p.uniqueId = Xy, p.upperCase = Ry, p.upperFirst = ko, p.each = pf, p.eachRight = gf, p.first = ff, Ho(p, function() {
          var t = {};
          return xt(p, function(s, a) {
            le.call(p.prototype, a) || (t[a] = s);
          }), t;
        }(), { chain: !1 }), p.VERSION = i, st(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(t) {
          p[t].placeholder = p;
        }), st(["drop", "take"], function(t, s) {
          ne.prototype[t] = function(a) {
            a = a === r ? 1 : Re(J(a), 0);
            var f = this.__filtered__ && !s ? new ne(this) : this.clone();
            return f.__filtered__ ? f.__takeCount__ = Fe(a, f.__takeCount__) : f.__views__.push({
              size: Fe(a, dt),
              type: t + (f.__dir__ < 0 ? "Right" : "")
            }), f;
          }, ne.prototype[t + "Right"] = function(a) {
            return this.reverse()[t](a).reverse();
          };
        }), st(["filter", "map", "takeWhile"], function(t, s) {
          var a = s + 1, f = a == Pe || a == $e;
          ne.prototype[t] = function(d) {
            var g = this.clone();
            return g.__iteratees__.push({
              iteratee: z(d, 3),
              type: a
            }), g.__filtered__ = g.__filtered__ || f, g;
          };
        }), st(["head", "last"], function(t, s) {
          var a = "take" + (s ? "Right" : "");
          ne.prototype[t] = function() {
            return this[a](1).value()[0];
          };
        }), st(["initial", "tail"], function(t, s) {
          var a = "drop" + (s ? "" : "Right");
          ne.prototype[t] = function() {
            return this.__filtered__ ? new ne(this) : this[a](1);
          };
        }), ne.prototype.compact = function() {
          return this.filter(Ke);
        }, ne.prototype.find = function(t) {
          return this.filter(t).head();
        }, ne.prototype.findLast = function(t) {
          return this.reverse().find(t);
        }, ne.prototype.invokeMap = Z(function(t, s) {
          return typeof t == "function" ? new ne(this) : this.map(function(a) {
            return Er(a, t, s);
          });
        }), ne.prototype.reject = function(t) {
          return this.filter(Gs(z(t)));
        }, ne.prototype.slice = function(t, s) {
          t = J(t);
          var a = this;
          return a.__filtered__ && (t > 0 || s < 0) ? new ne(a) : (t < 0 ? a = a.takeRight(-t) : t && (a = a.drop(t)), s !== r && (s = J(s), a = s < 0 ? a.dropRight(-s) : a.take(s - t)), a);
        }, ne.prototype.takeRightWhile = function(t) {
          return this.reverse().takeWhile(t).reverse();
        }, ne.prototype.toArray = function() {
          return this.take(dt);
        }, xt(ne.prototype, function(t, s) {
          var a = /^(?:filter|find|map|reject)|While$/.test(s), f = /^(?:head|last)$/.test(s), d = p[f ? "take" + (s == "last" ? "Right" : "") : s], g = f || /^find/.test(s);
          d && (p.prototype[s] = function() {
            var w = this.__wrapped__, b = f ? [1] : arguments, v = w instanceof ne, R = b[0], D = v || q(w), C = function(te) {
              var se = d.apply(p, jt([te], b));
              return f && U ? se[0] : se;
            };
            D && a && typeof R == "function" && R.length != 1 && (v = D = !1);
            var U = this.__chain__, L = !!this.__actions__.length, W = g && !U, j = v && !L;
            if (!g && D) {
              w = j ? w : new ne(this);
              var $ = t.apply(w, b);
              return $.__actions__.push({ func: Us, args: [C], thisArg: r }), new ot($, U);
            }
            return W && j ? t.apply(this, b) : ($ = this.thru(C), W ? f ? $.value()[0] : $.value() : $);
          });
        }), st(["pop", "push", "shift", "sort", "splice", "unshift"], function(t) {
          var s = us[t], a = /^(?:push|sort|unshift)$/.test(t) ? "tap" : "thru", f = /^(?:pop|shift)$/.test(t);
          p.prototype[t] = function() {
            var d = arguments;
            if (f && !this.__chain__) {
              var g = this.value();
              return s.apply(q(g) ? g : [], d);
            }
            return this[a](function(w) {
              return s.apply(q(w) ? w : [], d);
            });
          };
        }), xt(ne.prototype, function(t, s) {
          var a = p[s];
          if (a) {
            var f = a.name + "";
            le.call(kn, f) || (kn[f] = []), kn[f].push({ name: s, func: a });
          }
        }), kn[Rs(r, S).name] = [{
          name: "wrapper",
          func: r
        }], ne.prototype.clone = Sg, ne.prototype.reverse = Rg, ne.prototype.value = Dg, p.prototype.at = iA, p.prototype.chain = oA, p.prototype.commit = aA, p.prototype.next = uA, p.prototype.plant = fA, p.prototype.reverse = lA, p.prototype.toJSON = p.prototype.valueOf = p.prototype.value = dA, p.prototype.first = p.prototype.head, gr && (p.prototype[gr] = cA), p;
      }, Mn = ag();
      hn ? ((hn.exports = Mn)._ = Mn, Li._ = Mn) : Ce._ = Mn;
    }).call(VT);
  }(Nr, Nr.exports)), Nr.exports;
}
var Jn = qT();
const Oe = [];
for (let e = 0; e < 256; ++e)
  Oe.push((e + 256).toString(16).slice(1));
function JT(e, n = 0) {
  return (Oe[e[n + 0]] + Oe[e[n + 1]] + Oe[e[n + 2]] + Oe[e[n + 3]] + "-" + Oe[e[n + 4]] + Oe[e[n + 5]] + "-" + Oe[e[n + 6]] + Oe[e[n + 7]] + "-" + Oe[e[n + 8]] + Oe[e[n + 9]] + "-" + Oe[e[n + 10]] + Oe[e[n + 11]] + Oe[e[n + 12]] + Oe[e[n + 13]] + Oe[e[n + 14]] + Oe[e[n + 15]]).toLowerCase();
}
let oa;
const KT = new Uint8Array(16);
function YT() {
  if (!oa) {
    if (typeof crypto > "u" || !crypto.getRandomValues)
      throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
    oa = crypto.getRandomValues.bind(crypto);
  }
  return oa(KT);
}
const jT = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), _l = { randomUUID: jT };
function ZT(e, n, r) {
  var o;
  if (_l.randomUUID && !e)
    return _l.randomUUID();
  e = e || {};
  const i = e.random ?? ((o = e.rng) == null ? void 0 : o.call(e)) ?? YT();
  if (i.length < 16)
    throw new Error("Random bytes length must be >= 16");
  return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, JT(i);
}
const we = {
  state: {},
  get(e) {
    return this.state[e] ? Jn.cloneDeep(this.state[e]) : void 0;
  },
  getExecutionOptions(e) {
    var n, r, i, o;
    return {
      allowExecution: (r = (n = this.state[e]) == null ? void 0 : n.executionOptions) == null ? void 0 : r.allowExecution,
      executeInBackground: (o = (i = this.state[e]) == null ? void 0 : i.executionOptions) == null ? void 0 : o.executeInBackground
    };
  },
  set(e, n) {
    const r = XT(e);
    return this.state[r.id] = {
      route: r,
      executionOptions: {
        allowExecution: !0,
        executeInBackground: !1,
        ...n
      }
    }, Jn.cloneDeep(this.state[r.id]);
  },
  update(e, n) {
    var i, o;
    const r = Jn.cloneDeep(n);
    if (this.state[e]) {
      this.state[e] = {
        ...this.state[e],
        route: {
          ...this.state[e].route,
          ...r.route ?? {}
        },
        executionOptions: {
          ...this.state[e].executionOptions,
          ...r.executionOptions ?? {}
        }
      };
      const u = Jn.cloneDeep(this.state[e].route);
      return (o = (i = this.state[e].executionOptions) == null ? void 0 : i.onUpdateHook) == null || o.call(i, u), u;
    }
  },
  delete(e) {
    delete this.state[e];
  }
};
function XT(e) {
  if (!e.id) {
    const n = ZT();
    e.id = n, e.steps.forEach((r, i) => {
      r.id = `${n}:${i}`;
    });
  }
  return e;
}
class e2 {
  constructor(n) {
    re(this, "routeId");
    re(this, "stepId");
    re(this, "_step");
    this.routeId = n.id.split(":")[0], this.stepId = +n.id.split(":")[1], this._step = Jn.cloneDeep(n), this.initExecution();
  }
  initExecution() {
    this._step.execution || (this._step.execution = {
      status: "PENDING",
      process: []
    }), this._step.execution.status === "FAILED" && (this._step.execution.status = "PENDING"), this.updateStepInRoute();
  }
  get step() {
    return this._step;
  }
  get executionOptions() {
    return we.getExecutionOptions(this.routeId) ?? {};
  }
  get executionStopped() {
    return this.executionOptions == null ? !0 : !this.executionOptions.allowExecution;
  }
  get interactionDisabled() {
    return this.executionOptions.executeInBackground == null ? !1 : this.executionOptions.executeInBackground;
  }
  get allStepsCompleted() {
    return this._step.execution.process.every((n) => n.status === "DONE");
  }
  completeStep() {
    return this.allStepsCompleted ? (this._step.execution.status = "DONE", this.updateStepInRoute()) : this.updateStepInRoute(!0), this._step;
  }
  findOrCreateProcess(n) {
    const r = this.getProcessByType(n.type);
    return r && r.status === "DONE" ? this.updateProcess(r) : (this._step.execution.process.push(n), this.updateProcess(n));
  }
  updateProcess({
    type: n,
    status: r,
    message: i,
    params: o
  }) {
    const u = this.getProcessByType(n);
    if (!u)
      throw new Error("Can't find a process for the given type.");
    switch (r) {
      case "FAILED":
        this._step.execution.status = "FAILED";
        break;
      case "PENDING":
        this._step.execution.status = "PENDING";
        break;
      case "ACTION_REQUIRED":
        this._step.execution.status = "ACTION_REQUIRED";
        break;
    }
    if (u.status = r, u.message = i, o)
      for (const [l, h] of Object.entries(o))
        u[l] = h;
    const c = r === "FAILED" || r === "ACTION_REQUIRED" && this.interactionDisabled;
    return this.updateStepInRoute(c), u;
  }
  updateStepInRoute(n = !1) {
    const r = we.get(this.routeId);
    r && (r.route.steps[this.stepId] = this._step, n ? Rh(this.routeId) : we.update(this.routeId, { route: r.route }));
  }
  /**
   * Injects the lifi steps into the route
   * This expects the array of steps to include *only*
   * a single step.
   * The assumption being that this is a lifi quote
   * not a lifi route.
   * https://docs.li.fi/integrate-li.fi-sdk/request-routes-quotes#difference-between-route-and-quote
   */
  injectLifiSteps(n) {
    const r = we.get(this.routeId).route;
    this._step = {
      ...n.steps[0],
      type: "lifi_token_swap",
      id: `${this.routeId}:${this.stepId}`
    }, r.steps[this.stepId] = {
      ...this._step,
      lifiRoute: n
    }, we.update(this.routeId, { route: r });
  }
  getProcessByType(n) {
    if (!this._step.execution)
      throw new Error("Can't find a process in an empty execution");
    return this._step.execution.process.find((r) => r.type === n) ?? null;
  }
}
class Sh {
  constructor(n, r) {
    re(this, "routeId");
    re(this, "stepManager");
    this.routeId = n.id, this.stepManager = new e2(Jn.cloneDeep(r));
  }
  get route() {
    return we.get(this.routeId).route;
  }
}
class t2 extends Sh {
  constructor(n, r) {
    super(n, r);
  }
  async executeStep() {
    let n;
    try {
      if (this.stepManager.step.lifiRoute)
        n = await LT(this.stepManager.step.lifiRoute, {
          updateRouteHook: this.onUpdateHook.bind(this),
          executeInBackground: this.stepManager.executionOptions.executeInBackground
        });
      else {
        const r = $T(this.stepManager.step.swapQuote);
        n = await Bh(r, {
          updateRouteHook: this.onUpdateHook.bind(this),
          executeInBackground: this.stepManager.executionOptions.executeInBackground
        });
      }
      this.stepManager.injectLifiSteps(n);
    } catch {
    } finally {
      return this.stepManager.completeStep();
    }
  }
  onUpdateHook(n) {
    this.processRoute(n);
  }
  processRoute(n) {
    var i, o, u;
    const r = (o = (i = n.steps[0].execution) == null ? void 0 : i.process) == null ? void 0 : o[n.steps[0].execution.process.length - 1];
    if (r && r.status === "FAILED" && !r.message)
      switch ((u = r.error) == null ? void 0 : u.code) {
        case 1002:
          r.message = Tt.TransactionUnderpriced;
          break;
        case 1003:
          r.message = Tt.TransactionReverted;
          break;
        case 1007:
          r.message = "Chain switch is required.";
          break;
        case 1009:
          r.message = Tt.GasLimitLow;
          break;
        case 1010:
          r.message = "Transaction was cancelled.";
          break;
        case 1011:
          r.message = Tt.SlippageError;
          break;
        case 1012:
          r.message = "Signature required.";
          break;
        case 1013:
          r.message = "The balance is too low to complete transaction.";
          break;
        case 1015:
          r.message = "Insufficient funds to complete transaction.";
          break;
        case 1017:
          r.message = "Wallet was changed during execution.";
          break;
        default:
          r.message = "Action failed.";
          break;
      }
    this.stepManager.injectLifiSteps(n);
  }
}
async function n2(e) {
  const n = Tn.get().apiUrl, r = new URL(`${n}/order-status/transak`);
  return r.searchParams.append("orderId", e), Tn.get().dev && r.searchParams.append("dev", "true"), await fetch(r).then((o) => o.json()).then((o) => o).catch((o) => {
    throw o;
  });
}
class r2 extends Sh {
  constructor(n, r) {
    super(n, r);
  }
  async executeStep() {
    if (this.stepManager.step.type === "onramp_via_link")
      try {
        const r = await this.openOnRampLink();
        if (r.status !== "DONE")
          return Rh(this.stepManager.routeId), this.stepManager.step;
        await this.checkOrderStatus(r.orderId);
      } catch (r) {
        throw new Error(`TRANSAK_STEP_ERROR: ${r.message}`);
      }
    return this.stepManager.completeStep();
  }
  async checkOrderStatus(n) {
    if (!n)
      throw new Error("No Order ID provided to check status.");
    const r = "STATUS_CHECK", i = this.stepManager.findOrCreateProcess({
      status: "PENDING",
      type: r,
      message: "Checking order status with Transak."
    });
    return new Promise((o) => {
      const u = async (l) => {
        const h = await n2(n);
        if (this.stepManager.executionStopped)
          return clearInterval(l), o(i);
        if (h.status === "AWAITING_PAYMENT_FROM_USER" || h.status === "PAYMENT_DONE_MARKED_BY_USER")
          this.stepManager.updateProcess({
            status: "PENDING",
            type: r,
            message: "Transak order is awaiting for payment."
          });
        else if (h.status === "PROCESSING" || h.status === "PENDING_DELIVERY_FROM_TRANSAK")
          this.stepManager.updateProcess({
            status: "PENDING",
            type: r,
            message: "Payment is pending processing with Transak."
          });
        else if (h.status === "ON_HOLD_PENDING_DELIVERY_FROM_TRANSAK")
          this.stepManager.updateProcess({
            status: "PENDING",
            type: r,
            message: `Order is on hold pending delivery from Transak. Order ID: ${n}`
          });
        else {
          if (h.status === "COMPLETED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "DONE",
              type: r,
              message: "Payment completed successfully.",
              params: {
                toAmount: h.cryptoAmount,
                toToken: h.cryptoCurrency,
                fromAmount: h.fiatAmount,
                fromCurrency: h.fiatCurrency
              }
            }));
          if (h.status === "CANCELLED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "CANCELLED",
              type: r,
              message: "Payment was cancelled."
            }));
          if (h.status === "EXPIRED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "CANCELLED",
              type: r,
              message: "Order expired."
            }));
          if (h.status === "REFUNDED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "CANCELLED",
              type: r,
              message: "Order was refunded."
            }));
          if (h.status === "FAILED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "FAILED",
              type: r,
              message: "Order failed: " + h.statusMessage
            }));
        }
      }, c = setInterval(async () => {
        await u(c);
      }, 3e3);
    });
  }
  async openOnRampLink() {
    const n = "EXTERNAL", r = this.stepManager.findOrCreateProcess({
      status: "ACTION_REQUIRED",
      type: n,
      message: "Complete payment process in Transak window."
    });
    return new Promise((i) => {
      if (r.status === "DONE" && r.orderId || this.stepManager.executionStopped || this.stepManager.interactionDisabled)
        return i(r);
      const o = new URL(this.stepManager.step.link);
      o.searchParams.set("redirectURL", window.location.origin);
      const u = window.open(o.toString(), "_blank", "width=600,height=800");
      if (!u)
        return i(
          this.stepManager.updateProcess({
            status: "FAILED",
            type: n,
            message: "Payment window failed to open."
          })
        );
      const c = setInterval(() => {
        if (!u || u.closed)
          return clearInterval(c), clearInterval(l), i(
            this.stepManager.updateProcess({
              status: "CANCELLED",
              type: n,
              message: "Payment window was closed before completing the process."
            })
          );
      }, 1e3), l = setInterval(() => {
        try {
          const h = u == null ? void 0 : u.location.href;
          if (!h || !h.startsWith(window.location.origin)) return;
          const m = new URL(h), A = m.searchParams.get("orderId"), y = m.searchParams.get("status");
          if (A && y)
            switch (clearInterval(c), clearInterval(l), u == null || u.close(), y) {
              case "COMPLETED":
              case "AWAITING_PAYMENT_FROM_USER":
              case "ON_HOLD_PENDING_DELIVERY_FROM_TRANSAK":
              case "PAYMENT_DONE_MARKED_BY_USER":
              case "PENDING_DELIVERY_FROM_TRANSAK":
              case "PROCESSING":
                return i(
                  this.stepManager.updateProcess({
                    status: "DONE",
                    type: n,
                    message: `Payment completed with Transak. Order ID: ${A}`,
                    params: { orderId: A }
                  })
                );
              case "FAILED":
              case "CANCELLED":
              case "EXPIRED":
              case "REFUNDED":
                return i(
                  this.stepManager.updateProcess({
                    status: "FAILED",
                    type: n,
                    message: `Payment failed with Transak. Order ID: ${A}`,
                    params: { orderId: A }
                  })
                );
              default:
                return i(
                  this.stepManager.updateProcess({
                    status: "FAILED",
                    type: n,
                    message: `Unknown order status received from Transak. Order ID: ${A}`,
                    params: { orderId: A }
                  })
                );
            }
        } catch (h) {
          if (h instanceof DOMException && h.name === "SecurityError") return;
        }
      }, 1e3);
    });
  }
}
function s2(e, n) {
  if (n.type === "onramp_via_link")
    switch (e.provider.key) {
      case "transak":
        return new r2(e, n);
    }
  else if (n.type === "lifi_token_swap")
    return new t2(e, n);
  throw new Error(`No executor found for ${n.type}`);
}
async function i2(e, n) {
  if (e.id) {
    const o = we.get(e.id);
    if (o != null && o.promise)
      return o.promise;
  }
  const r = we.set({ ...e, status: "RUNNING" }, n), i = a2(r);
  return we.update(r.route.id, { promise: i }), i;
}
function v2(e, n) {
  const r = we.get(e.id);
  if (r && "executeInBackground" in n) {
    we.update(e.id, { executionOptions: n });
    const i = r.route.steps.find((o) => o.type.includes("lifi"));
    i && i.lifiRoute && uu(i.lifiRoute, { executeInBackground: n.executeInBackground });
  }
}
function Rh(e) {
  const n = we.get(e);
  if (!n)
    return;
  we.update(
    e,
    {
      route: { ...n.route, status: "HALTING" },
      executionOptions: { allowExecution: !1 }
    }
  );
  const r = n.route.steps.find((i) => i.type.includes("lifi"));
  r && r.lifiRoute && Ma(r.lifiRoute);
}
async function P2(e, n) {
  if (!e.id)
    return Promise.reject({ error: new Error("Quote does not have an id. Please call executeRoute instead."), route: e });
  const r = we.get(e.id);
  if (r)
    return r.promise;
  const i = await o2(e);
  return i2(i, n);
}
async function o2(e) {
  for (let n = 0; n < e.steps.length; n++) {
    const r = e.steps[n];
    r.execution && (r.execution.process = r.execution.process.filter(
      (i) => i.status === "DONE"
    ));
  }
  return e;
}
async function a2(e) {
  var o, u;
  for (let c = 0; c < e.route.steps.length; c++) {
    if (((o = e.route.steps[c].execution) == null ? void 0 : o.status) === "DONE")
      continue;
    const h = s2(e.route, e.route.steps[c]);
    try {
      await h.executeStep();
      const m = we.get(e.route.id);
      if (m && !((u = m.executionOptions) != null && u.allowExecution)) {
        const A = we.update(m.route.id, { route: { ...m.route, status: "HALTED" } });
        return we.delete(A.id), A;
      }
    } catch (m) {
      const A = we.get(e.route.id);
      throw we.update(A.route.id, { route: { ...A.route, status: "HALTED" } }), we.delete(A.route.id), new Error("ERROR in SDK", m);
    }
  }
  const n = we.get(e.route.id), r = n.route.steps.every((c) => {
    var l;
    return ((l = c.execution) == null ? void 0 : l.status) === "DONE";
  });
  let i;
  return r ? i = we.update(n.route.id, { route: { ...n.route, status: "DONE" } }) : i = we.update(n.route.id, { route: { ...n.route, status: "HALTED" } }), we.delete(i.id), i;
}
function T2(e, n, r = "include") {
  return n.length ? e.map((o) => ({
    ...o,
    paymentMethods: o.paymentMethods.filter((u) => {
      const c = n.includes(u.method);
      return r === "include" ? c : !c;
    })
  })).filter((o) => o.paymentMethods.length > 0) : [...e];
}
function I2(e, n, r) {
  return {
    type: e,
    provider: r,
    ...n
  };
}
function B2(e, n = !0, r = "asc") {
  const i = (o, u) => {
    const c = r === "asc" ? 1 : -1;
    return (o.pay.totalFeeFiat - u.pay.totalFeeFiat) * c;
  };
  return n ? e.map((o) => ({
    ...o,
    paymentMethods: [...o.paymentMethods].sort(i)
  })) : e.flatMap(
    (o) => o.paymentMethods.map((u) => ({
      ...o,
      paymentMethods: [u]
    }))
  ).sort((o, u) => i(o.paymentMethods[0], u.paymentMethods[0]));
}
function S2(e) {
  return e.flatMap(
    (r) => r.paymentMethods.map((i) => ({
      ...r,
      paymentMethods: [i]
    }))
  ).sort((r, i) => r.paymentMethods[0].receive.amountFiat - i.paymentMethods[0].receive.amountFiat);
}
function R2(e) {
  return e.map((n) => ({
    ...n,
    paymentMethods: n.paymentMethods.sort(
      (r, i) => r.receive.amountFiat - i.receive.amountFiat
    )
  }));
}
export {
  T2 as A,
  O as B,
  I2 as C,
  B2 as D,
  y2 as E,
  S2 as F,
  R2 as G,
  m2 as H,
  Ur as I,
  A2 as a,
  In as b,
  nv as c,
  RE as d,
  pi as e,
  Wt as f,
  ud as g,
  $l as h,
  dn as i,
  h2 as j,
  Xs as k,
  FE as l,
  di as m,
  p2 as n,
  lx as o,
  E2 as p,
  x2 as q,
  g2 as r,
  Vt as s,
  La as t,
  Tn as u,
  b2 as v,
  i2 as w,
  P2 as x,
  Rh as y,
  v2 as z
};
//# sourceMappingURL=index-DQcMajga.js.map