import { createRequire as __createRequire } from 'module'; import { fileURLToPath as __fileURLToPath } from 'url'; import { dirname as __pathDirname } from 'path'; const require = __createRequire(import.meta.url); const __filename = __fileURLToPath(import.meta.url); const __dirname = __pathDirname(__filename);
import {
  __esm
} from "./chunk-YPWSCLE3.js";

// ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/suins.mjs
function isValidSuiNSName(name) {
  if (name.length > MAX_SUI_NS_NAME_LENGTH) return false;
  if (name.includes("@")) return SUI_NS_NAME_REGEX.test(name);
  return SUI_NS_DOMAIN_REGEX.test(name);
}
function normalizeSuiNSName(name, format = "at") {
  const lowerCase = name.toLowerCase();
  let parts;
  if (lowerCase.includes("@")) {
    if (!SUI_NS_NAME_REGEX.test(lowerCase)) throw new Error(`Invalid SuiNS name ${name}`);
    const [labels, domain] = lowerCase.split("@");
    parts = [...labels ? labels.split(".") : [], domain];
  } else {
    if (!SUI_NS_DOMAIN_REGEX.test(lowerCase)) throw new Error(`Invalid SuiNS name ${name}`);
    parts = lowerCase.split(".").slice(0, -1);
  }
  if (format === "dot") return `${parts.join(".")}.sui`;
  return `${parts.slice(0, -1).join(".")}@${parts[parts.length - 1]}`;
}
var SUI_NS_NAME_REGEX, SUI_NS_DOMAIN_REGEX, MAX_SUI_NS_NAME_LENGTH;
var init_suins = __esm({
  "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/suins.mjs"() {
    "use strict";
    SUI_NS_NAME_REGEX = /^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i;
    SUI_NS_DOMAIN_REGEX = /^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i;
    MAX_SUI_NS_NAME_LENGTH = 235;
  }
});

// ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/move-registry.mjs
var NAME_PATTERN, VERSION_REGEX, MAX_APP_SIZE, NAME_SEPARATOR, isValidNamedPackage, isValidNamedType;
var init_move_registry = __esm({
  "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/move-registry.mjs"() {
    "use strict";
    init_suins();
    init_sui_types();
    NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
    VERSION_REGEX = /^\d+$/;
    MAX_APP_SIZE = 64;
    NAME_SEPARATOR = "/";
    isValidNamedPackage = (name) => {
      const parts = name.split(NAME_SEPARATOR);
      if (parts.length < 2 || parts.length > 3) return false;
      const [org, app, version] = parts;
      if (version !== void 0 && !VERSION_REGEX.test(version)) return false;
      if (!isValidSuiNSName(org)) return false;
      return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
    };
    isValidNamedType = (type) => {
      const splitType = type.split(/::|<|>|,/);
      for (const t of splitType) if (t.includes(NAME_SEPARATOR) && !isValidNamedPackage(t)) return false;
      return isValidStructTag(type);
    };
  }
});

// ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/uleb.mjs
function ulebEncode(num) {
  let bigNum = BigInt(num);
  const arr = [];
  let len = 0;
  if (bigNum === 0n) return [0];
  while (bigNum > 0) {
    arr[len] = Number(bigNum & 127n);
    bigNum >>= 7n;
    if (bigNum > 0n) arr[len] |= 128;
    len += 1;
  }
  return arr;
}
function ulebDecode(arr) {
  let total = 0n;
  let shift = 0n;
  let len = 0;
  while (true) {
    if (len >= arr.length) throw new Error("ULEB decode error: buffer overflow");
    const byte = arr[len];
    len += 1;
    total += BigInt(byte & 127) << shift;
    if ((byte & 128) === 0) break;
    shift += 7n;
  }
  if (total > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error("ULEB decode error: value exceeds MAX_SAFE_INTEGER");
  return {
    value: Number(total),
    length: len
  };
}
var init_uleb = __esm({
  "../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/uleb.mjs"() {
    "use strict";
  }
});

// ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/reader.mjs
var BcsReader;
var init_reader = __esm({
  "../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/reader.mjs"() {
    "use strict";
    init_uleb();
    BcsReader = class {
      /**
      * @param {Uint8Array} data Data to use as a buffer.
      */
      constructor(data) {
        this.bytePosition = 0;
        this.dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
      }
      /**
      * Shift current cursor position by `bytes`.
      *
      * @param {Number} bytes Number of bytes to
      * @returns {this} Self for possible chaining.
      */
      shift(bytes) {
        this.bytePosition += bytes;
        return this;
      }
      /**
      * Read U8 value from the buffer and shift cursor by 1.
      * @returns
      */
      read8() {
        const value = this.dataView.getUint8(this.bytePosition);
        this.shift(1);
        return value;
      }
      /**
      * Read U16 value from the buffer and shift cursor by 2.
      * @returns
      */
      read16() {
        const value = this.dataView.getUint16(this.bytePosition, true);
        this.shift(2);
        return value;
      }
      /**
      * Read U32 value from the buffer and shift cursor by 4.
      * @returns
      */
      read32() {
        const value = this.dataView.getUint32(this.bytePosition, true);
        this.shift(4);
        return value;
      }
      /**
      * Read U64 value from the buffer and shift cursor by 8.
      * @returns
      */
      read64() {
        const value1 = this.read32();
        const result = this.read32().toString(16) + value1.toString(16).padStart(8, "0");
        return BigInt("0x" + result).toString(10);
      }
      /**
      * Read U128 value from the buffer and shift cursor by 16.
      */
      read128() {
        const value1 = BigInt(this.read64());
        const result = BigInt(this.read64()).toString(16) + value1.toString(16).padStart(16, "0");
        return BigInt("0x" + result).toString(10);
      }
      /**
      * Read U128 value from the buffer and shift cursor by 32.
      * @returns
      */
      read256() {
        const value1 = BigInt(this.read128());
        const result = BigInt(this.read128()).toString(16) + value1.toString(16).padStart(32, "0");
        return BigInt("0x" + result).toString(10);
      }
      /**
      * Read `num` number of bytes from the buffer and shift cursor by `num`.
      * @param num Number of bytes to read.
      */
      readBytes(num) {
        const start = this.bytePosition + this.dataView.byteOffset;
        const value = new Uint8Array(this.dataView.buffer, start, num);
        this.shift(num);
        return value;
      }
      /**
      * Read ULEB value - an integer of varying size. Used for enum indexes and
      * vector lengths.
      * @returns {Number} The ULEB value.
      */
      readULEB() {
        const start = this.bytePosition + this.dataView.byteOffset;
        const { value, length } = ulebDecode(new Uint8Array(this.dataView.buffer, start));
        this.shift(length);
        return value;
      }
      /**
      * Read a BCS vector: read a length and then apply function `cb` X times
      * where X is the length of the vector, defined as ULEB in BCS bytes.
      * @param cb Callback to process elements of vector.
      * @returns {Array<Any>} Array of the resulting values, returned by callback.
      */
      readVec(cb) {
        const length = this.readULEB();
        const result = [];
        for (let i = 0; i < length; i++) result.push(cb(this, i, length));
        return result;
      }
    };
  }
});

// ../../node_modules/.pnpm/@scure+base@2.0.0/node_modules/@scure/base/index.js
function isBytes(a) {
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
}
function isArrayOf(isString, arr) {
  if (!Array.isArray(arr))
    return false;
  if (arr.length === 0)
    return true;
  if (isString) {
    return arr.every((item) => typeof item === "string");
  } else {
    return arr.every((item) => Number.isSafeInteger(item));
  }
}
function afn(input) {
  if (typeof input !== "function")
    throw new Error("function expected");
  return true;
}
function astr(label, input) {
  if (typeof input !== "string")
    throw new Error(`${label}: string expected`);
  return true;
}
function anumber(n) {
  if (!Number.isSafeInteger(n))
    throw new Error(`invalid integer: ${n}`);
}
function aArr(input) {
  if (!Array.isArray(input))
    throw new Error("array expected");
}
function astrArr(label, input) {
  if (!isArrayOf(true, input))
    throw new Error(`${label}: array of strings expected`);
}
function anumArr(label, input) {
  if (!isArrayOf(false, input))
    throw new Error(`${label}: array of numbers expected`);
}
// @__NO_SIDE_EFFECTS__
function chain(...args) {
  const id = (a) => a;
  const wrap = (a, b) => (c) => a(b(c));
  const encode = args.map((x) => x.encode).reduceRight(wrap, id);
  const decode = args.map((x) => x.decode).reduce(wrap, id);
  return { encode, decode };
}
// @__NO_SIDE_EFFECTS__
function alphabet(letters) {
  const lettersA = typeof letters === "string" ? letters.split("") : letters;
  const len = lettersA.length;
  astrArr("alphabet", lettersA);
  const indexes = new Map(lettersA.map((l, i) => [l, i]));
  return {
    encode: (digits) => {
      aArr(digits);
      return digits.map((i) => {
        if (!Number.isSafeInteger(i) || i < 0 || i >= len)
          throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${letters}`);
        return lettersA[i];
      });
    },
    decode: (input) => {
      aArr(input);
      return input.map((letter) => {
        astr("alphabet.decode", letter);
        const i = indexes.get(letter);
        if (i === void 0)
          throw new Error(`Unknown letter: "${letter}". Allowed: ${letters}`);
        return i;
      });
    }
  };
}
// @__NO_SIDE_EFFECTS__
function join(separator = "") {
  astr("join", separator);
  return {
    encode: (from) => {
      astrArr("join.decode", from);
      return from.join(separator);
    },
    decode: (to) => {
      astr("join.decode", to);
      return to.split(separator);
    }
  };
}
function convertRadix(data, from, to) {
  if (from < 2)
    throw new Error(`convertRadix: invalid from=${from}, base cannot be less than 2`);
  if (to < 2)
    throw new Error(`convertRadix: invalid to=${to}, base cannot be less than 2`);
  aArr(data);
  if (!data.length)
    return [];
  let pos = 0;
  const res = [];
  const digits = Array.from(data, (d) => {
    anumber(d);
    if (d < 0 || d >= from)
      throw new Error(`invalid integer: ${d}`);
    return d;
  });
  const dlen = digits.length;
  while (true) {
    let carry = 0;
    let done = true;
    for (let i = pos; i < dlen; i++) {
      const digit = digits[i];
      const fromCarry = from * carry;
      const digitBase = fromCarry + digit;
      if (!Number.isSafeInteger(digitBase) || fromCarry / from !== carry || digitBase - digit !== fromCarry) {
        throw new Error("convertRadix: carry overflow");
      }
      const div = digitBase / to;
      carry = digitBase % to;
      const rounded = Math.floor(div);
      digits[i] = rounded;
      if (!Number.isSafeInteger(rounded) || rounded * to + carry !== digitBase)
        throw new Error("convertRadix: carry overflow");
      if (!done)
        continue;
      else if (!rounded)
        pos = i;
      else
        done = false;
    }
    res.push(carry);
    if (done)
      break;
  }
  for (let i = 0; i < data.length - 1 && data[i] === 0; i++)
    res.push(0);
  return res.reverse();
}
function convertRadix2(data, from, to, padding) {
  aArr(data);
  if (from <= 0 || from > 32)
    throw new Error(`convertRadix2: wrong from=${from}`);
  if (to <= 0 || to > 32)
    throw new Error(`convertRadix2: wrong to=${to}`);
  if (/* @__PURE__ */ radix2carry(from, to) > 32) {
    throw new Error(`convertRadix2: carry overflow from=${from} to=${to} carryBits=${/* @__PURE__ */ radix2carry(from, to)}`);
  }
  let carry = 0;
  let pos = 0;
  const max = powers[from];
  const mask = powers[to] - 1;
  const res = [];
  for (const n of data) {
    anumber(n);
    if (n >= max)
      throw new Error(`convertRadix2: invalid data word=${n} from=${from}`);
    carry = carry << from | n;
    if (pos + from > 32)
      throw new Error(`convertRadix2: carry overflow pos=${pos} from=${from}`);
    pos += from;
    for (; pos >= to; pos -= to)
      res.push((carry >> pos - to & mask) >>> 0);
    const pow = powers[pos];
    if (pow === void 0)
      throw new Error("invalid carry");
    carry &= pow - 1;
  }
  carry = carry << to - pos & mask;
  if (!padding && pos >= from)
    throw new Error("Excess padding");
  if (!padding && carry > 0)
    throw new Error(`Non-zero padding: ${carry}`);
  if (padding && pos > 0)
    res.push(carry >>> 0);
  return res;
}
// @__NO_SIDE_EFFECTS__
function radix(num) {
  anumber(num);
  const _256 = 2 ** 8;
  return {
    encode: (bytes) => {
      if (!isBytes(bytes))
        throw new Error("radix.encode input should be Uint8Array");
      return convertRadix(Array.from(bytes), _256, num);
    },
    decode: (digits) => {
      anumArr("radix.decode", digits);
      return Uint8Array.from(convertRadix(digits, num, _256));
    }
  };
}
// @__NO_SIDE_EFFECTS__
function radix2(bits, revPadding = false) {
  anumber(bits);
  if (bits <= 0 || bits > 32)
    throw new Error("radix2: bits should be in (0..32]");
  if (/* @__PURE__ */ radix2carry(8, bits) > 32 || /* @__PURE__ */ radix2carry(bits, 8) > 32)
    throw new Error("radix2: carry overflow");
  return {
    encode: (bytes) => {
      if (!isBytes(bytes))
        throw new Error("radix2.encode input should be Uint8Array");
      return convertRadix2(Array.from(bytes), 8, bits, !revPadding);
    },
    decode: (digits) => {
      anumArr("radix2.decode", digits);
      return Uint8Array.from(convertRadix2(digits, bits, 8, revPadding));
    }
  };
}
function unsafeWrapper(fn) {
  afn(fn);
  return function(...args) {
    try {
      return fn.apply(null, args);
    } catch (e) {
    }
  };
}
function bech32Polymod(pre) {
  const b = pre >> 25;
  let chk = (pre & 33554431) << 5;
  for (let i = 0; i < POLYMOD_GENERATORS.length; i++) {
    if ((b >> i & 1) === 1)
      chk ^= POLYMOD_GENERATORS[i];
  }
  return chk;
}
function bechChecksum(prefix, words, encodingConst = 1) {
  const len = prefix.length;
  let chk = 1;
  for (let i = 0; i < len; i++) {
    const c = prefix.charCodeAt(i);
    if (c < 33 || c > 126)
      throw new Error(`Invalid prefix (${prefix})`);
    chk = bech32Polymod(chk) ^ c >> 5;
  }
  chk = bech32Polymod(chk);
  for (let i = 0; i < len; i++)
    chk = bech32Polymod(chk) ^ prefix.charCodeAt(i) & 31;
  for (let v of words)
    chk = bech32Polymod(chk) ^ v;
  for (let i = 0; i < 6; i++)
    chk = bech32Polymod(chk);
  chk ^= encodingConst;
  return BECH_ALPHABET.encode(convertRadix2([chk % powers[30]], 30, 5, false));
}
// @__NO_SIDE_EFFECTS__
function genBech32(encoding) {
  const ENCODING_CONST = encoding === "bech32" ? 1 : 734539939;
  const _words = /* @__PURE__ */ radix2(5);
  const fromWords = _words.decode;
  const toWords = _words.encode;
  const fromWordsUnsafe = unsafeWrapper(fromWords);
  function encode(prefix, words, limit = 90) {
    astr("bech32.encode prefix", prefix);
    if (isBytes(words))
      words = Array.from(words);
    anumArr("bech32.encode", words);
    const plen = prefix.length;
    if (plen === 0)
      throw new TypeError(`Invalid prefix length ${plen}`);
    const actualLength = plen + 7 + words.length;
    if (limit !== false && actualLength > limit)
      throw new TypeError(`Length ${actualLength} exceeds limit ${limit}`);
    const lowered = prefix.toLowerCase();
    const sum = bechChecksum(lowered, words, ENCODING_CONST);
    return `${lowered}1${BECH_ALPHABET.encode(words)}${sum}`;
  }
  function decode(str, limit = 90) {
    astr("bech32.decode input", str);
    const slen = str.length;
    if (slen < 8 || limit !== false && slen > limit)
      throw new TypeError(`invalid string length: ${slen} (${str}). Expected (8..${limit})`);
    const lowered = str.toLowerCase();
    if (str !== lowered && str !== str.toUpperCase())
      throw new Error(`String must be lowercase or uppercase`);
    const sepIndex = lowered.lastIndexOf("1");
    if (sepIndex === 0 || sepIndex === -1)
      throw new Error(`Letter "1" must be present between prefix and data only`);
    const prefix = lowered.slice(0, sepIndex);
    const data = lowered.slice(sepIndex + 1);
    if (data.length < 6)
      throw new Error("Data must be at least 6 characters long");
    const words = BECH_ALPHABET.decode(data).slice(0, -6);
    const sum = bechChecksum(prefix, words, ENCODING_CONST);
    if (!data.endsWith(sum))
      throw new Error(`Invalid checksum in ${str}: expected "${sum}"`);
    return { prefix, words };
  }
  const decodeUnsafe = unsafeWrapper(decode);
  function decodeToBytes(str) {
    const { prefix, words } = decode(str, false);
    return { prefix, words, bytes: fromWords(words) };
  }
  function encodeFromBytes(prefix, bytes) {
    return encode(prefix, toWords(bytes));
  }
  return {
    encode,
    decode,
    encodeFromBytes,
    decodeToBytes,
    decodeUnsafe,
    fromWords,
    fromWordsUnsafe,
    toWords
  };
}
var gcd, radix2carry, powers, base64urlnopad, genBase58, base58, BECH_ALPHABET, POLYMOD_GENERATORS, bech32;
var init_base = __esm({
  "../../node_modules/.pnpm/@scure+base@2.0.0/node_modules/@scure/base/index.js"() {
    "use strict";
    gcd = (a, b) => b === 0 ? a : gcd(b, a % b);
    radix2carry = /* @__NO_SIDE_EFFECTS__ */ (from, to) => from + (to - gcd(from, to));
    powers = /* @__PURE__ */ (() => {
      let res = [];
      for (let i = 0; i < 40; i++)
        res.push(2 ** i);
      return res;
    })();
    base64urlnopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), /* @__PURE__ */ join(""));
    genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => /* @__PURE__ */ chain(/* @__PURE__ */ radix(58), /* @__PURE__ */ alphabet(abc), /* @__PURE__ */ join(""));
    base58 = /* @__PURE__ */ genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
    BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ join(""));
    POLYMOD_GENERATORS = [996825010, 642813549, 513874426, 1027748829, 705979059];
    bech32 = /* @__PURE__ */ genBech32("bech32");
  }
});

// ../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/b58.mjs
var toBase58, fromBase58;
var init_b58 = __esm({
  "../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/b58.mjs"() {
    "use strict";
    init_base();
    toBase58 = (buffer) => base58.encode(buffer);
    fromBase58 = (str) => base58.decode(str);
  }
});

// ../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/b64.mjs
function fromBase64(base64String) {
  return Uint8Array.from(atob(base64String), (char) => char.charCodeAt(0));
}
function toBase64(bytes) {
  if (bytes.length < CHUNK_SIZE) return btoa(String.fromCharCode(...bytes));
  let output = "";
  for (var i = 0; i < bytes.length; i += CHUNK_SIZE) {
    const chunk = bytes.slice(i, i + CHUNK_SIZE);
    output += String.fromCharCode(...chunk);
  }
  return btoa(output);
}
var CHUNK_SIZE;
var init_b64 = __esm({
  "../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/b64.mjs"() {
    "use strict";
    CHUNK_SIZE = 8192;
  }
});

// ../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/hex.mjs
function fromHex(hexStr) {
  const normalized = hexStr.startsWith("0x") ? hexStr.slice(2) : hexStr;
  const padded = normalized.length % 2 === 0 ? normalized : `0${normalized}`;
  const intArr = padded.match(/[0-9a-fA-F]{2}/g)?.map((byte) => parseInt(byte, 16)) ?? [];
  if (intArr.length !== padded.length / 2) throw new Error(`Invalid hex string ${hexStr}`);
  return Uint8Array.from(intArr);
}
function toHex(bytes) {
  return bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), "");
}
var init_hex = __esm({
  "../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/hex.mjs"() {
    "use strict";
  }
});

// ../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/index.mjs
var init_dist = __esm({
  "../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/index.mjs"() {
    "use strict";
    init_b58();
    init_b64();
    init_hex();
  }
});

// ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/utils.mjs
function encodeStr(data, encoding) {
  switch (encoding) {
    case "base58":
      return toBase58(data);
    case "base64":
      return toBase64(data);
    case "hex":
      return toHex(data);
    default:
      throw new Error("Unsupported encoding, supported values are: base64, hex");
  }
}
function splitGenericParameters(str, genericSeparators = ["<", ">"]) {
  const [left, right] = genericSeparators;
  const tok = [];
  let word = "";
  let nestedAngleBrackets = 0;
  for (let i = 0; i < str.length; i++) {
    const char = str[i];
    if (char === left) nestedAngleBrackets++;
    if (char === right) nestedAngleBrackets--;
    if (nestedAngleBrackets === 0 && char === ",") {
      tok.push(word.trim());
      word = "";
      continue;
    }
    word += char;
  }
  tok.push(word.trim());
  return tok;
}
var init_utils = __esm({
  "../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/utils.mjs"() {
    "use strict";
    init_dist();
  }
});

// ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/writer.mjs
function toLittleEndian(bigint, size) {
  const result = new Uint8Array(size);
  let i = 0;
  while (bigint > 0) {
    result[i] = Number(bigint % BigInt(256));
    bigint = bigint / BigInt(256);
    i += 1;
  }
  return result;
}
var BcsWriter;
var init_writer = __esm({
  "../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/writer.mjs"() {
    "use strict";
    init_uleb();
    init_utils();
    BcsWriter = class {
      constructor({ initialSize = 1024, maxSize = Infinity, allocateSize = 1024 } = {}) {
        this.bytePosition = 0;
        this.size = initialSize;
        this.maxSize = maxSize;
        this.allocateSize = allocateSize;
        this.dataView = new DataView(new ArrayBuffer(initialSize));
      }
      ensureSizeOrGrow(bytes) {
        const requiredSize = this.bytePosition + bytes;
        if (requiredSize > this.size) {
          const nextSize = Math.min(this.maxSize, Math.max(this.size + requiredSize, this.size + this.allocateSize));
          if (requiredSize > nextSize) throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${requiredSize}`);
          this.size = nextSize;
          const nextBuffer = new ArrayBuffer(this.size);
          new Uint8Array(nextBuffer).set(new Uint8Array(this.dataView.buffer));
          this.dataView = new DataView(nextBuffer);
        }
      }
      /**
      * Shift current cursor position by `bytes`.
      *
      * @param {Number} bytes Number of bytes to
      * @returns {this} Self for possible chaining.
      */
      shift(bytes) {
        this.bytePosition += bytes;
        return this;
      }
      /**
      * Write a U8 value into a buffer and shift cursor position by 1.
      * @param {Number} value Value to write.
      * @returns {this}
      */
      write8(value) {
        this.ensureSizeOrGrow(1);
        this.dataView.setUint8(this.bytePosition, Number(value));
        return this.shift(1);
      }
      /**
      * Write a U8 value into a buffer and shift cursor position by 1.
      * @param {Number} value Value to write.
      * @returns {this}
      */
      writeBytes(bytes) {
        this.ensureSizeOrGrow(bytes.length);
        for (let i = 0; i < bytes.length; i++) this.dataView.setUint8(this.bytePosition + i, bytes[i]);
        return this.shift(bytes.length);
      }
      /**
      * Write a U16 value into a buffer and shift cursor position by 2.
      * @param {Number} value Value to write.
      * @returns {this}
      */
      write16(value) {
        this.ensureSizeOrGrow(2);
        this.dataView.setUint16(this.bytePosition, Number(value), true);
        return this.shift(2);
      }
      /**
      * Write a U32 value into a buffer and shift cursor position by 4.
      * @param {Number} value Value to write.
      * @returns {this}
      */
      write32(value) {
        this.ensureSizeOrGrow(4);
        this.dataView.setUint32(this.bytePosition, Number(value), true);
        return this.shift(4);
      }
      /**
      * Write a U64 value into a buffer and shift cursor position by 8.
      * @param {bigint} value Value to write.
      * @returns {this}
      */
      write64(value) {
        toLittleEndian(BigInt(value), 8).forEach((el) => this.write8(el));
        return this;
      }
      /**
      * Write a U128 value into a buffer and shift cursor position by 16.
      *
      * @param {bigint} value Value to write.
      * @returns {this}
      */
      write128(value) {
        toLittleEndian(BigInt(value), 16).forEach((el) => this.write8(el));
        return this;
      }
      /**
      * Write a U256 value into a buffer and shift cursor position by 16.
      *
      * @param {bigint} value Value to write.
      * @returns {this}
      */
      write256(value) {
        toLittleEndian(BigInt(value), 32).forEach((el) => this.write8(el));
        return this;
      }
      /**
      * Write a ULEB value into a buffer and shift cursor position by number of bytes
      * written.
      * @param {Number} value Value to write.
      * @returns {this}
      */
      writeULEB(value) {
        ulebEncode(value).forEach((el) => this.write8(el));
        return this;
      }
      /**
      * Write a vector into a buffer by first writing the vector length and then calling
      * a callback on each passed value.
      *
      * @param {Array<Any>} vector Array of elements to write.
      * @param {WriteVecCb} cb Callback to call on each element of the vector.
      * @returns {this}
      */
      writeVec(vector2, cb) {
        this.writeULEB(vector2.length);
        Array.from(vector2).forEach((el, i) => cb(this, el, i, vector2.length));
        return this;
      }
      /**
      * Adds support for iterations over the object.
      * @returns {Uint8Array}
      */
      *[Symbol.iterator]() {
        for (let i = 0; i < this.bytePosition; i++) yield this.dataView.getUint8(i);
        return this.toBytes();
      }
      /**
      * Get underlying buffer taking only value bytes (in case initial buffer size was bigger).
      * @returns {Uint8Array} Resulting bcs.
      */
      toBytes() {
        return new Uint8Array(this.dataView.buffer.slice(0, this.bytePosition));
      }
      /**
      * Represent data as 'hex' or 'base64'
      * @param encoding Encoding to use: 'base64' or 'hex'
      */
      toString(encoding) {
        return encodeStr(this.toBytes(), encoding);
      }
    };
  }
});

// ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/bcs-type.mjs
function isSerializedBcs(obj) {
  return !!obj && typeof obj === "object" && obj[SERIALIZED_BCS_BRAND] === true;
}
function fixedSizeBcsType({ size, ...options }) {
  return new BcsType({
    ...options,
    serializedSize: () => size
  });
}
function uIntBcsType({ readMethod, writeMethod, ...options }) {
  return fixedSizeBcsType({
    ...options,
    read: (reader) => reader[readMethod](),
    write: (value, writer) => writer[writeMethod](value),
    validate: (value) => {
      if (value < 0 || value > options.maxValue) throw new TypeError(`Invalid ${options.name} value: ${value}. Expected value in range 0-${options.maxValue}`);
      options.validate?.(value);
    }
  });
}
function bigUIntBcsType({ readMethod, writeMethod, ...options }) {
  return fixedSizeBcsType({
    ...options,
    read: (reader) => reader[readMethod](),
    write: (value, writer) => writer[writeMethod](BigInt(value)),
    validate: (val) => {
      const value = BigInt(val);
      if (value < 0 || value > options.maxValue) throw new TypeError(`Invalid ${options.name} value: ${value}. Expected value in range 0-${options.maxValue}`);
      options.validate?.(value);
    }
  });
}
function dynamicSizeBcsType({ serialize, ...options }) {
  const type = new BcsType({
    ...options,
    serialize,
    write: (value, writer) => {
      for (const byte of type.serialize(value).toBytes()) writer.write8(byte);
    }
  });
  return type;
}
function stringLikeBcsType({ toBytes, fromBytes, ...options }) {
  return new BcsType({
    ...options,
    read: (reader) => {
      const length = reader.readULEB();
      return fromBytes(reader.readBytes(length));
    },
    write: (hex, writer) => {
      const bytes = toBytes(hex);
      writer.writeULEB(bytes.length);
      for (let i = 0; i < bytes.length; i++) writer.write8(bytes[i]);
    },
    serialize: (value) => {
      const bytes = toBytes(value);
      const size = ulebEncode(bytes.length);
      const result = new Uint8Array(size.length + bytes.length);
      result.set(size, 0);
      result.set(bytes, size.length);
      return result;
    },
    validate: (value) => {
      if (typeof value !== "string") throw new TypeError(`Invalid ${options.name} value: ${value}. Expected string`);
      options.validate?.(value);
    }
  });
}
function lazyBcsType(cb) {
  let lazyType = null;
  function getType() {
    if (!lazyType) lazyType = cb();
    return lazyType;
  }
  return new BcsType({
    name: "lazy",
    read: (data) => getType().read(data),
    serializedSize: (value) => getType().serializedSize(value),
    write: (value, writer) => getType().write(value, writer),
    serialize: (value, options) => getType().serialize(value, options).toBytes()
  });
}
var BcsType, SERIALIZED_BCS_BRAND, SerializedBcs, BcsStruct, BcsEnum, BcsTuple;
var init_bcs_type = __esm({
  "../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/bcs-type.mjs"() {
    "use strict";
    init_uleb();
    init_reader();
    init_writer();
    init_dist();
    BcsType = class BcsType2 {
      #write;
      #serialize;
      constructor(options) {
        this.name = options.name;
        this.read = options.read;
        this.serializedSize = options.serializedSize ?? (() => null);
        this.#write = options.write;
        this.#serialize = options.serialize ?? ((value, options$1) => {
          const writer = new BcsWriter({
            initialSize: this.serializedSize(value) ?? void 0,
            ...options$1
          });
          this.#write(value, writer);
          return writer.toBytes();
        });
        this.validate = options.validate ?? (() => {
        });
      }
      write(value, writer) {
        this.validate(value);
        this.#write(value, writer);
      }
      serialize(value, options) {
        this.validate(value);
        return new SerializedBcs(this, this.#serialize(value, options));
      }
      parse(bytes) {
        const reader = new BcsReader(bytes);
        return this.read(reader);
      }
      fromHex(hex) {
        return this.parse(fromHex(hex));
      }
      fromBase58(b64) {
        return this.parse(fromBase58(b64));
      }
      fromBase64(b64) {
        return this.parse(fromBase64(b64));
      }
      transform({ name, input, output, validate }) {
        return new BcsType2({
          name: name ?? this.name,
          read: (reader) => output ? output(this.read(reader)) : this.read(reader),
          write: (value, writer) => this.#write(input ? input(value) : value, writer),
          serializedSize: (value) => this.serializedSize(input ? input(value) : value),
          serialize: (value, options) => this.#serialize(input ? input(value) : value, options),
          validate: (value) => {
            validate?.(value);
            this.validate(input ? input(value) : value);
          }
        });
      }
    };
    SERIALIZED_BCS_BRAND = /* @__PURE__ */ Symbol.for("@mysten/serialized-bcs");
    SerializedBcs = class {
      #schema;
      #bytes;
      get [SERIALIZED_BCS_BRAND]() {
        return true;
      }
      constructor(schema, bytes) {
        this.#schema = schema;
        this.#bytes = bytes;
      }
      toBytes() {
        return this.#bytes;
      }
      toHex() {
        return toHex(this.#bytes);
      }
      toBase64() {
        return toBase64(this.#bytes);
      }
      toBase58() {
        return toBase58(this.#bytes);
      }
      parse() {
        return this.#schema.parse(this.#bytes);
      }
    };
    BcsStruct = class extends BcsType {
      constructor({ name, fields, ...options }) {
        const canonicalOrder = Object.entries(fields);
        super({
          name,
          serializedSize: (values) => {
            let total = 0;
            for (const [field, type] of canonicalOrder) {
              const size = type.serializedSize(values[field]);
              if (size == null) return null;
              total += size;
            }
            return total;
          },
          read: (reader) => {
            const result = {};
            for (const [field, type] of canonicalOrder) result[field] = type.read(reader);
            return result;
          },
          write: (value, writer) => {
            for (const [field, type] of canonicalOrder) type.write(value[field], writer);
          },
          ...options,
          validate: (value) => {
            options?.validate?.(value);
            if (typeof value !== "object" || value == null) throw new TypeError(`Expected object, found ${typeof value}`);
          }
        });
      }
    };
    BcsEnum = class extends BcsType {
      constructor({ fields, ...options }) {
        const canonicalOrder = Object.entries(fields);
        super({
          read: (reader) => {
            const index = reader.readULEB();
            const enumEntry = canonicalOrder[index];
            if (!enumEntry) throw new TypeError(`Unknown value ${index} for enum ${options.name}`);
            const [kind, type] = enumEntry;
            return {
              [kind]: type?.read(reader) ?? true,
              $kind: kind
            };
          },
          write: (value, writer) => {
            const [name, val] = Object.entries(value).filter(([name$1]) => Object.hasOwn(fields, name$1))[0];
            for (let i = 0; i < canonicalOrder.length; i++) {
              const [optionName, optionType] = canonicalOrder[i];
              if (optionName === name) {
                writer.writeULEB(i);
                optionType?.write(val, writer);
                return;
              }
            }
          },
          ...options,
          validate: (value) => {
            options?.validate?.(value);
            if (typeof value !== "object" || value == null) throw new TypeError(`Expected object, found ${typeof value}`);
            const keys = Object.keys(value).filter((k) => value[k] !== void 0 && Object.hasOwn(fields, k));
            if (keys.length !== 1) throw new TypeError(`Expected object with one key, but found ${keys.length} for type ${options.name}}`);
            const [variant] = keys;
            if (!Object.hasOwn(fields, variant)) throw new TypeError(`Invalid enum variant ${variant}`);
          }
        });
      }
    };
    BcsTuple = class extends BcsType {
      constructor({ fields, name, ...options }) {
        super({
          name: name ?? `(${fields.map((t) => t.name).join(", ")})`,
          serializedSize: (values) => {
            let total = 0;
            for (let i = 0; i < fields.length; i++) {
              const size = fields[i].serializedSize(values[i]);
              if (size == null) return null;
              total += size;
            }
            return total;
          },
          read: (reader) => {
            const result = [];
            for (const field of fields) result.push(field.read(reader));
            return result;
          },
          write: (value, writer) => {
            for (let i = 0; i < fields.length; i++) fields[i].write(value[i], writer);
          },
          ...options,
          validate: (value) => {
            options?.validate?.(value);
            if (!Array.isArray(value)) throw new TypeError(`Expected array, found ${typeof value}`);
            if (value.length !== fields.length) throw new TypeError(`Expected array of length ${fields.length}, found ${value.length}`);
          }
        });
      }
    };
  }
});

// ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/bcs.mjs
function fixedArray(size, type, options) {
  return new BcsType({
    read: (reader) => {
      const result = new Array(size);
      for (let i = 0; i < size; i++) result[i] = type.read(reader);
      return result;
    },
    write: (value, writer) => {
      for (const item of value) type.write(item, writer);
    },
    ...options,
    name: options?.name ?? `${type.name}[${size}]`,
    validate: (value) => {
      options?.validate?.(value);
      if (!value || typeof value !== "object" || !("length" in value)) throw new TypeError(`Expected array, found ${typeof value}`);
      if (value.length !== size) throw new TypeError(`Expected array of length ${size}, found ${value.length}`);
    }
  });
}
function option(type) {
  return bcs.enum(`Option<${type.name}>`, {
    None: null,
    Some: type
  }).transform({
    input: (value) => {
      if (value == null) return { None: true };
      return { Some: value };
    },
    output: (value) => {
      if (value.$kind === "Some") return value.Some;
      return null;
    }
  });
}
function vector(type, options) {
  return new BcsType({
    read: (reader) => {
      const length = reader.readULEB();
      const result = new Array(length);
      for (let i = 0; i < length; i++) result[i] = type.read(reader);
      return result;
    },
    write: (value, writer) => {
      writer.writeULEB(value.length);
      for (const item of value) type.write(item, writer);
    },
    ...options,
    name: options?.name ?? `vector<${type.name}>`,
    validate: (value) => {
      options?.validate?.(value);
      if (!value || typeof value !== "object" || !("length" in value)) throw new TypeError(`Expected array, found ${typeof value}`);
    }
  });
}
function compareBcsBytes(a, b) {
  for (let i = 0; i < Math.min(a.length, b.length); i++) if (a[i] !== b[i]) return a[i] - b[i];
  return a.length - b.length;
}
function map(keyType, valueType) {
  return new BcsType({
    name: `Map<${keyType.name}, ${valueType.name}>`,
    read: (reader) => {
      const length = reader.readULEB();
      const result = /* @__PURE__ */ new Map();
      for (let i = 0; i < length; i++) result.set(keyType.read(reader), valueType.read(reader));
      return result;
    },
    write: (value, writer) => {
      const entries = [...value.entries()].map(([key, val]) => [keyType.serialize(key).toBytes(), val]);
      entries.sort(([a], [b]) => compareBcsBytes(a, b));
      writer.writeULEB(entries.length);
      for (const [keyBytes, val] of entries) {
        writer.writeBytes(keyBytes);
        valueType.write(val, writer);
      }
    }
  });
}
var bcs;
var init_bcs = __esm({
  "../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/bcs.mjs"() {
    "use strict";
    init_uleb();
    init_bcs_type();
    bcs = {
      u8(options) {
        return uIntBcsType({
          readMethod: "read8",
          writeMethod: "write8",
          size: 1,
          maxValue: 2 ** 8 - 1,
          ...options,
          name: options?.name ?? "u8"
        });
      },
      u16(options) {
        return uIntBcsType({
          readMethod: "read16",
          writeMethod: "write16",
          size: 2,
          maxValue: 2 ** 16 - 1,
          ...options,
          name: options?.name ?? "u16"
        });
      },
      u32(options) {
        return uIntBcsType({
          readMethod: "read32",
          writeMethod: "write32",
          size: 4,
          maxValue: 2 ** 32 - 1,
          ...options,
          name: options?.name ?? "u32"
        });
      },
      u64(options) {
        return bigUIntBcsType({
          readMethod: "read64",
          writeMethod: "write64",
          size: 8,
          maxValue: 2n ** 64n - 1n,
          ...options,
          name: options?.name ?? "u64"
        });
      },
      u128(options) {
        return bigUIntBcsType({
          readMethod: "read128",
          writeMethod: "write128",
          size: 16,
          maxValue: 2n ** 128n - 1n,
          ...options,
          name: options?.name ?? "u128"
        });
      },
      u256(options) {
        return bigUIntBcsType({
          readMethod: "read256",
          writeMethod: "write256",
          size: 32,
          maxValue: 2n ** 256n - 1n,
          ...options,
          name: options?.name ?? "u256"
        });
      },
      bool(options) {
        return fixedSizeBcsType({
          size: 1,
          read: (reader) => reader.read8() === 1,
          write: (value, writer) => writer.write8(value ? 1 : 0),
          ...options,
          name: options?.name ?? "bool",
          validate: (value) => {
            options?.validate?.(value);
            if (typeof value !== "boolean") throw new TypeError(`Expected boolean, found ${typeof value}`);
          }
        });
      },
      uleb128(options) {
        return dynamicSizeBcsType({
          read: (reader) => reader.readULEB(),
          serialize: (value) => {
            return Uint8Array.from(ulebEncode(value));
          },
          ...options,
          name: options?.name ?? "uleb128"
        });
      },
      bytes(size, options) {
        return fixedSizeBcsType({
          size,
          read: (reader) => reader.readBytes(size),
          write: (value, writer) => {
            writer.writeBytes(new Uint8Array(value));
          },
          ...options,
          name: options?.name ?? `bytes[${size}]`,
          validate: (value) => {
            options?.validate?.(value);
            if (!value || typeof value !== "object" || !("length" in value)) throw new TypeError(`Expected array, found ${typeof value}`);
            if (value.length !== size) throw new TypeError(`Expected array of length ${size}, found ${value.length}`);
          }
        });
      },
      byteVector(options) {
        return new BcsType({
          read: (reader) => {
            const length = reader.readULEB();
            return reader.readBytes(length);
          },
          write: (value, writer) => {
            const array = new Uint8Array(value);
            writer.writeULEB(array.length);
            writer.writeBytes(array);
          },
          ...options,
          name: options?.name ?? "vector<u8>",
          serializedSize: (value) => {
            const length = "length" in value ? value.length : null;
            return length == null ? null : ulebEncode(length).length + length;
          },
          validate: (value) => {
            options?.validate?.(value);
            if (!value || typeof value !== "object" || !("length" in value)) throw new TypeError(`Expected array, found ${typeof value}`);
          }
        });
      },
      string(options) {
        return stringLikeBcsType({
          toBytes: (value) => new TextEncoder().encode(value),
          fromBytes: (bytes) => new TextDecoder().decode(bytes),
          ...options,
          name: options?.name ?? "string"
        });
      },
      fixedArray,
      option,
      vector,
      tuple(fields, options) {
        return new BcsTuple({
          fields,
          ...options
        });
      },
      struct(name, fields, options) {
        return new BcsStruct({
          name,
          fields,
          ...options
        });
      },
      enum(name, fields, options) {
        return new BcsEnum({
          name,
          fields,
          ...options
        });
      },
      map,
      lazy(cb) {
        return lazyBcsType(cb);
      }
    };
  }
});

// ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/index.mjs
var init_dist2 = __esm({
  "../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/index.mjs"() {
    "use strict";
    init_utils();
    init_bcs_type();
    init_bcs();
    init_dist();
  }
});

// ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/sui-types.mjs
function isValidTransactionDigest(value) {
  try {
    return fromBase58(value).length === TX_DIGEST_LENGTH;
  } catch {
    return false;
  }
}
function isValidSuiAddress(value) {
  return isHex(value) && getHexByteLength(value) === SUI_ADDRESS_LENGTH;
}
function isValidSuiObjectId(value) {
  return isValidSuiAddress(value);
}
function isValidMoveIdentifier(name) {
  return MOVE_IDENTIFIER_REGEX.test(name);
}
function isValidTypeTag(type) {
  if (PRIMITIVE_TYPE_TAGS.includes(type)) return true;
  const vectorMatch = type.match(VECTOR_TYPE_REGEX);
  if (vectorMatch) return isValidTypeTag(vectorMatch[1]);
  if (type.includes("::")) return isValidStructTag(type);
  return false;
}
function isValidParsedStructTag(tag) {
  if (!isValidSuiAddress(tag.address) && !isValidNamedPackage(tag.address)) return false;
  if (!isValidMoveIdentifier(tag.module) || !isValidMoveIdentifier(tag.name)) return false;
  return tag.typeParams.every((param) => {
    if (typeof param === "string") return isValidTypeTag(param);
    return isValidParsedStructTag(param);
  });
}
function isValidStructTag(type) {
  try {
    return isValidParsedStructTag(parseStructTag(type));
  } catch {
    return false;
  }
}
function parseTypeTag(type) {
  if (type.startsWith("vector<")) {
    if (!type.endsWith(">")) throw new Error(`Invalid type tag: ${type}`);
    const inner = type.slice(7, -1);
    if (!inner) throw new Error(`Invalid type tag: ${type}`);
    const parsed = parseTypeTag(inner);
    if (typeof parsed === "string") return `vector<${parsed}>`;
    return `vector<${normalizeStructTag(parsed)}>`;
  }
  if (!type.includes("::")) return type;
  return parseStructTag(type);
}
function parseStructTag(type) {
  const parts = type.split("::");
  if (parts.length < 3) throw new Error(`Invalid struct tag: ${type}`);
  const [address, module] = parts;
  if (!address || !module) throw new Error(`Invalid struct tag: ${type}`);
  const isMvrPackage = isValidNamedPackage(address);
  const rest = type.slice(address.length + module.length + 4);
  const name = rest.includes("<") ? rest.slice(0, rest.indexOf("<")) : rest;
  if (!name || rest.includes("<") && !rest.endsWith(">")) throw new Error(`Invalid struct tag: ${type}`);
  const typeParams = rest.includes("<") ? splitGenericParameters(rest.slice(rest.indexOf("<") + 1, rest.lastIndexOf(">"))).map((typeParam) => parseTypeTag(typeParam.trim())) : [];
  return {
    address: isMvrPackage ? address : normalizeSuiAddress(address),
    module,
    name,
    typeParams
  };
}
function normalizeStructTag(type) {
  if (typeof type === "string" && type.startsWith("vector<")) throw new Error("normalizeStructTag does not support vector types. Use normalizeTypeTag instead.");
  const { address, module, name, typeParams } = typeof type === "string" ? parseStructTag(type) : type;
  return `${address}::${module}::${name}${typeParams?.length > 0 ? `<${typeParams.map((typeParam) => typeof typeParam === "string" ? typeParam : normalizeStructTag(typeParam)).join(",")}>` : ""}`;
}
function normalizeSuiAddress(value, forceAdd0x = false) {
  let address = value.toLowerCase();
  if (!forceAdd0x && address.startsWith("0x")) address = address.slice(2);
  return `0x${address.padStart(SUI_ADDRESS_LENGTH * 2, "0")}`;
}
function normalizeSuiObjectId(value, forceAdd0x = false) {
  return normalizeSuiAddress(value, forceAdd0x);
}
function isHex(value) {
  return /^(0x|0X)?[a-fA-F0-9]+$/.test(value) && value.length % 2 === 0;
}
function getHexByteLength(value) {
  return /^(0x|0X)/.test(value) ? (value.length - 2) / 2 : value.length / 2;
}
var TX_DIGEST_LENGTH, SUI_ADDRESS_LENGTH, MOVE_IDENTIFIER_REGEX, PRIMITIVE_TYPE_TAGS, VECTOR_TYPE_REGEX;
var init_sui_types = __esm({
  "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/sui-types.mjs"() {
    "use strict";
    init_move_registry();
    init_dist2();
    TX_DIGEST_LENGTH = 32;
    SUI_ADDRESS_LENGTH = 32;
    MOVE_IDENTIFIER_REGEX = /^[a-zA-Z][a-zA-Z0-9_]*$/;
    PRIMITIVE_TYPE_TAGS = [
      "bool",
      "u8",
      "u16",
      "u32",
      "u64",
      "u128",
      "u256",
      "address",
      "signer"
    ];
    VECTOR_TYPE_REGEX = /^vector<(.+)>$/;
  }
});

// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js
function isBytes2(a) {
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
}
function anumber2(n, title = "") {
  if (!Number.isSafeInteger(n) || n < 0) {
    const prefix = title && `"${title}" `;
    throw new Error(`${prefix}expected integer >= 0, got ${n}`);
  }
}
function abytes(value, length, title = "") {
  const bytes = isBytes2(value);
  const len = value?.length;
  const needsLen = length !== void 0;
  if (!bytes || needsLen && len !== length) {
    const prefix = title && `"${title}" `;
    const ofLen = needsLen ? ` of length ${length}` : "";
    const got = bytes ? `length=${len}` : `type=${typeof value}`;
    throw new Error(prefix + "expected Uint8Array" + ofLen + ", got " + got);
  }
  return value;
}
function ahash(h) {
  if (typeof h !== "function" || typeof h.create !== "function")
    throw new Error("Hash must wrapped by utils.createHasher");
  anumber2(h.outputLen);
  anumber2(h.blockLen);
}
function aexists(instance, checkFinished = true) {
  if (instance.destroyed)
    throw new Error("Hash instance has been destroyed");
  if (checkFinished && instance.finished)
    throw new Error("Hash#digest() has already been called");
}
function aoutput(out, instance) {
  abytes(out, void 0, "digestInto() output");
  const min = instance.outputLen;
  if (out.length < min) {
    throw new Error('"digestInto() output" expected to be of length >=' + min);
  }
}
function u32(arr) {
  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
}
function clean(...arrays) {
  for (let i = 0; i < arrays.length; i++) {
    arrays[i].fill(0);
  }
}
function createView(arr) {
  return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
}
function byteSwap(word) {
  return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
}
function byteSwap32(arr) {
  for (let i = 0; i < arr.length; i++) {
    arr[i] = byteSwap(arr[i]);
  }
  return arr;
}
function bytesToHex(bytes) {
  abytes(bytes);
  if (hasHexBuiltin)
    return bytes.toHex();
  let hex = "";
  for (let i = 0; i < bytes.length; i++) {
    hex += hexes[bytes[i]];
  }
  return hex;
}
function asciiToBase16(ch) {
  if (ch >= asciis._0 && ch <= asciis._9)
    return ch - asciis._0;
  if (ch >= asciis.A && ch <= asciis.F)
    return ch - (asciis.A - 10);
  if (ch >= asciis.a && ch <= asciis.f)
    return ch - (asciis.a - 10);
  return;
}
function hexToBytes(hex) {
  if (typeof hex !== "string")
    throw new Error("hex string expected, got " + typeof hex);
  if (hasHexBuiltin)
    return Uint8Array.fromHex(hex);
  const hl = hex.length;
  const al = hl / 2;
  if (hl % 2)
    throw new Error("hex string expected, got unpadded hex of length " + hl);
  const array = new Uint8Array(al);
  for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
    const n1 = asciiToBase16(hex.charCodeAt(hi));
    const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
    if (n1 === void 0 || n2 === void 0) {
      const char = hex[hi] + hex[hi + 1];
      throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
    }
    array[ai] = n1 * 16 + n2;
  }
  return array;
}
function utf8ToBytes(str) {
  if (typeof str !== "string")
    throw new Error("string expected");
  return new Uint8Array(new TextEncoder().encode(str));
}
function kdfInputToBytes(data, errorTitle = "") {
  if (typeof data === "string")
    return utf8ToBytes(data);
  return abytes(data, void 0, errorTitle);
}
function concatBytes(...arrays) {
  let sum = 0;
  for (let i = 0; i < arrays.length; i++) {
    const a = arrays[i];
    abytes(a);
    sum += a.length;
  }
  const res = new Uint8Array(sum);
  for (let i = 0, pad = 0; i < arrays.length; i++) {
    const a = arrays[i];
    res.set(a, pad);
    pad += a.length;
  }
  return res;
}
function checkOpts(defaults, opts) {
  if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]")
    throw new Error("options must be object or undefined");
  const merged = Object.assign(defaults, opts);
  return merged;
}
function createHasher(hashCons, info = {}) {
  const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
  const tmp = hashCons(void 0);
  hashC.outputLen = tmp.outputLen;
  hashC.blockLen = tmp.blockLen;
  hashC.create = (opts) => hashCons(opts);
  Object.assign(hashC, info);
  return Object.freeze(hashC);
}
function randomBytes(bytesLength = 32) {
  const cr = typeof globalThis === "object" ? globalThis.crypto : null;
  if (typeof cr?.getRandomValues !== "function")
    throw new Error("crypto.getRandomValues must be defined");
  return cr.getRandomValues(new Uint8Array(bytesLength));
}
var isLE, swap8IfBE, swap32IfBE, hasHexBuiltin, hexes, asciis, oidNist;
var init_utils2 = __esm({
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js"() {
    "use strict";
    isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
    swap8IfBE = isLE ? (n) => n : (n) => byteSwap(n);
    swap32IfBE = isLE ? (u) => u : byteSwap32;
    hasHexBuiltin = /* @__PURE__ */ (() => (
      // @ts-ignore
      typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
    ))();
    hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
    asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
    oidNist = (suffix) => ({
      oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
    });
  }
});

// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_blake.js
var BSIGMA;
var init_blake = __esm({
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_blake.js"() {
    "use strict";
    BSIGMA = /* @__PURE__ */ Uint8Array.from([
      0,
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15,
      14,
      10,
      4,
      8,
      9,
      15,
      13,
      6,
      1,
      12,
      0,
      2,
      11,
      7,
      5,
      3,
      11,
      8,
      12,
      0,
      5,
      2,
      15,
      13,
      10,
      14,
      3,
      6,
      7,
      1,
      9,
      4,
      7,
      9,
      3,
      1,
      13,
      12,
      11,
      14,
      2,
      6,
      5,
      10,
      4,
      0,
      15,
      8,
      9,
      0,
      5,
      7,
      2,
      4,
      10,
      15,
      14,
      1,
      11,
      12,
      6,
      8,
      3,
      13,
      2,
      12,
      6,
      10,
      0,
      11,
      8,
      3,
      4,
      13,
      7,
      5,
      15,
      14,
      1,
      9,
      12,
      5,
      1,
      15,
      14,
      13,
      4,
      10,
      0,
      7,
      6,
      3,
      9,
      2,
      8,
      11,
      13,
      11,
      7,
      14,
      12,
      1,
      3,
      9,
      5,
      0,
      15,
      4,
      8,
      6,
      2,
      10,
      6,
      15,
      14,
      9,
      11,
      3,
      0,
      8,
      12,
      2,
      13,
      7,
      1,
      4,
      10,
      5,
      10,
      2,
      8,
      4,
      7,
      6,
      1,
      5,
      15,
      11,
      9,
      14,
      3,
      12,
      13,
      0,
      0,
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15,
      14,
      10,
      4,
      8,
      9,
      15,
      13,
      6,
      1,
      12,
      0,
      2,
      11,
      7,
      5,
      3,
      // Blake1, unused in others
      11,
      8,
      12,
      0,
      5,
      2,
      15,
      13,
      10,
      14,
      3,
      6,
      7,
      1,
      9,
      4,
      7,
      9,
      3,
      1,
      13,
      12,
      11,
      14,
      2,
      6,
      5,
      10,
      4,
      0,
      15,
      8,
      9,
      0,
      5,
      7,
      2,
      4,
      10,
      15,
      14,
      1,
      11,
      12,
      6,
      8,
      3,
      13,
      2,
      12,
      6,
      10,
      0,
      11,
      8,
      3,
      4,
      13,
      7,
      5,
      15,
      14,
      1,
      9
    ]);
  }
});

// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_md.js
var HashMD, SHA512_IV;
var init_md = __esm({
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_md.js"() {
    "use strict";
    init_utils2();
    HashMD = class {
      blockLen;
      outputLen;
      padOffset;
      isLE;
      // For partial updates less than block size
      buffer;
      view;
      finished = false;
      length = 0;
      pos = 0;
      destroyed = false;
      constructor(blockLen, outputLen, padOffset, isLE2) {
        this.blockLen = blockLen;
        this.outputLen = outputLen;
        this.padOffset = padOffset;
        this.isLE = isLE2;
        this.buffer = new Uint8Array(blockLen);
        this.view = createView(this.buffer);
      }
      update(data) {
        aexists(this);
        abytes(data);
        const { view, buffer, blockLen } = this;
        const len = data.length;
        for (let pos = 0; pos < len; ) {
          const take = Math.min(blockLen - this.pos, len - pos);
          if (take === blockLen) {
            const dataView = createView(data);
            for (; blockLen <= len - pos; pos += blockLen)
              this.process(dataView, pos);
            continue;
          }
          buffer.set(data.subarray(pos, pos + take), this.pos);
          this.pos += take;
          pos += take;
          if (this.pos === blockLen) {
            this.process(view, 0);
            this.pos = 0;
          }
        }
        this.length += data.length;
        this.roundClean();
        return this;
      }
      digestInto(out) {
        aexists(this);
        aoutput(out, this);
        this.finished = true;
        const { buffer, view, blockLen, isLE: isLE2 } = this;
        let { pos } = this;
        buffer[pos++] = 128;
        clean(this.buffer.subarray(pos));
        if (this.padOffset > blockLen - pos) {
          this.process(view, 0);
          pos = 0;
        }
        for (let i = pos; i < blockLen; i++)
          buffer[i] = 0;
        view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE2);
        this.process(view, 0);
        const oview = createView(out);
        const len = this.outputLen;
        if (len % 4)
          throw new Error("_sha2: outputLen must be aligned to 32bit");
        const outLen = len / 4;
        const state = this.get();
        if (outLen > state.length)
          throw new Error("_sha2: outputLen bigger than state");
        for (let i = 0; i < outLen; i++)
          oview.setUint32(4 * i, state[i], isLE2);
      }
      digest() {
        const { buffer, outputLen } = this;
        this.digestInto(buffer);
        const res = buffer.slice(0, outputLen);
        this.destroy();
        return res;
      }
      _cloneInto(to) {
        to ||= new this.constructor();
        to.set(...this.get());
        const { blockLen, buffer, length, finished, destroyed, pos } = this;
        to.destroyed = destroyed;
        to.finished = finished;
        to.length = length;
        to.pos = pos;
        if (length % blockLen)
          to.buffer.set(buffer);
        return to;
      }
      clone() {
        return this._cloneInto();
      }
    };
    SHA512_IV = /* @__PURE__ */ Uint32Array.from([
      1779033703,
      4089235720,
      3144134277,
      2227873595,
      1013904242,
      4271175723,
      2773480762,
      1595750129,
      1359893119,
      2917565137,
      2600822924,
      725511199,
      528734635,
      4215389547,
      1541459225,
      327033209
    ]);
  }
});

// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js
function fromBig(n, le = false) {
  if (le)
    return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
  return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
}
function split(lst, le = false) {
  const len = lst.length;
  let Ah = new Uint32Array(len);
  let Al = new Uint32Array(len);
  for (let i = 0; i < len; i++) {
    const { h, l } = fromBig(lst[i], le);
    [Ah[i], Al[i]] = [h, l];
  }
  return [Ah, Al];
}
function add(Ah, Al, Bh, Bl) {
  const l = (Al >>> 0) + (Bl >>> 0);
  return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
}
var U32_MASK64, _32n, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, add3L, add3H, add4L, add4H, add5L, add5H;
var init_u64 = __esm({
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js"() {
    "use strict";
    U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
    _32n = /* @__PURE__ */ BigInt(32);
    shrSH = (h, _l, s) => h >>> s;
    shrSL = (h, l, s) => h << 32 - s | l >>> s;
    rotrSH = (h, l, s) => h >>> s | l << 32 - s;
    rotrSL = (h, l, s) => h << 32 - s | l >>> s;
    rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
    rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
    rotr32H = (_h, l) => l;
    rotr32L = (h, _l) => h;
    add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
    add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
    add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
    add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
    add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
    add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
  }
});

// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/blake2.js
function G1b(a, b, c, d, msg, x) {
  const Xl = msg[x], Xh = msg[x + 1];
  let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
  let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
  let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
  let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
  let ll = add3L(Al, Bl, Xl);
  Ah = add3H(ll, Ah, Bh, Xh);
  Al = ll | 0;
  ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
  ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) });
  ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
  ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
  ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) });
  BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
  BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
  BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
  BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
}
function G2b(a, b, c, d, msg, x) {
  const Xl = msg[x], Xh = msg[x + 1];
  let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
  let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
  let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
  let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
  let ll = add3L(Al, Bl, Xl);
  Ah = add3H(ll, Ah, Bh, Xh);
  Al = ll | 0;
  ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
  ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) });
  ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
  ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
  ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) });
  BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
  BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
  BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
  BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
}
function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
  anumber2(keyLen);
  if (outputLen < 0 || outputLen > keyLen)
    throw new Error("outputLen bigger than keyLen");
  const { key, salt, personalization } = opts;
  if (key !== void 0 && (key.length < 1 || key.length > keyLen))
    throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
  if (salt !== void 0)
    abytes(salt, saltLen, "salt");
  if (personalization !== void 0)
    abytes(personalization, persLen, "personalization");
}
var B2B_IV, BBUF, _BLAKE2, _BLAKE2b, blake2b;
var init_blake2 = __esm({
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/blake2.js"() {
    "use strict";
    init_blake();
    init_u64();
    init_utils2();
    B2B_IV = /* @__PURE__ */ Uint32Array.from([
      4089235720,
      1779033703,
      2227873595,
      3144134277,
      4271175723,
      1013904242,
      1595750129,
      2773480762,
      2917565137,
      1359893119,
      725511199,
      2600822924,
      4215389547,
      528734635,
      327033209,
      1541459225
    ]);
    BBUF = /* @__PURE__ */ new Uint32Array(32);
    _BLAKE2 = class {
      buffer;
      buffer32;
      finished = false;
      destroyed = false;
      length = 0;
      pos = 0;
      blockLen;
      outputLen;
      constructor(blockLen, outputLen) {
        anumber2(blockLen);
        anumber2(outputLen);
        this.blockLen = blockLen;
        this.outputLen = outputLen;
        this.buffer = new Uint8Array(blockLen);
        this.buffer32 = u32(this.buffer);
      }
      update(data) {
        aexists(this);
        abytes(data);
        const { blockLen, buffer, buffer32 } = this;
        const len = data.length;
        const offset = data.byteOffset;
        const buf = data.buffer;
        for (let pos = 0; pos < len; ) {
          if (this.pos === blockLen) {
            swap32IfBE(buffer32);
            this.compress(buffer32, 0, false);
            swap32IfBE(buffer32);
            this.pos = 0;
          }
          const take = Math.min(blockLen - this.pos, len - pos);
          const dataOffset = offset + pos;
          if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
            const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
            swap32IfBE(data32);
            for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
              this.length += blockLen;
              this.compress(data32, pos32, false);
            }
            swap32IfBE(data32);
            continue;
          }
          buffer.set(data.subarray(pos, pos + take), this.pos);
          this.pos += take;
          this.length += take;
          pos += take;
        }
        return this;
      }
      digestInto(out) {
        aexists(this);
        aoutput(out, this);
        const { pos, buffer32 } = this;
        this.finished = true;
        clean(this.buffer.subarray(pos));
        swap32IfBE(buffer32);
        this.compress(buffer32, 0, true);
        swap32IfBE(buffer32);
        const out32 = u32(out);
        this.get().forEach((v, i) => out32[i] = swap8IfBE(v));
      }
      digest() {
        const { buffer, outputLen } = this;
        this.digestInto(buffer);
        const res = buffer.slice(0, outputLen);
        this.destroy();
        return res;
      }
      _cloneInto(to) {
        const { buffer, length, finished, destroyed, outputLen, pos } = this;
        to ||= new this.constructor({ dkLen: outputLen });
        to.set(...this.get());
        to.buffer.set(buffer);
        to.destroyed = destroyed;
        to.finished = finished;
        to.length = length;
        to.pos = pos;
        to.outputLen = outputLen;
        return to;
      }
      clone() {
        return this._cloneInto();
      }
    };
    _BLAKE2b = class extends _BLAKE2 {
      // Same as SHA-512, but LE
      v0l = B2B_IV[0] | 0;
      v0h = B2B_IV[1] | 0;
      v1l = B2B_IV[2] | 0;
      v1h = B2B_IV[3] | 0;
      v2l = B2B_IV[4] | 0;
      v2h = B2B_IV[5] | 0;
      v3l = B2B_IV[6] | 0;
      v3h = B2B_IV[7] | 0;
      v4l = B2B_IV[8] | 0;
      v4h = B2B_IV[9] | 0;
      v5l = B2B_IV[10] | 0;
      v5h = B2B_IV[11] | 0;
      v6l = B2B_IV[12] | 0;
      v6h = B2B_IV[13] | 0;
      v7l = B2B_IV[14] | 0;
      v7h = B2B_IV[15] | 0;
      constructor(opts = {}) {
        const olen = opts.dkLen === void 0 ? 64 : opts.dkLen;
        super(128, olen);
        checkBlake2Opts(olen, opts, 64, 16, 16);
        let { key, personalization, salt } = opts;
        let keyLength = 0;
        if (key !== void 0) {
          abytes(key, void 0, "key");
          keyLength = key.length;
        }
        this.v0l ^= this.outputLen | keyLength << 8 | 1 << 16 | 1 << 24;
        if (salt !== void 0) {
          abytes(salt, void 0, "salt");
          const slt = u32(salt);
          this.v4l ^= swap8IfBE(slt[0]);
          this.v4h ^= swap8IfBE(slt[1]);
          this.v5l ^= swap8IfBE(slt[2]);
          this.v5h ^= swap8IfBE(slt[3]);
        }
        if (personalization !== void 0) {
          abytes(personalization, void 0, "personalization");
          const pers = u32(personalization);
          this.v6l ^= swap8IfBE(pers[0]);
          this.v6h ^= swap8IfBE(pers[1]);
          this.v7l ^= swap8IfBE(pers[2]);
          this.v7h ^= swap8IfBE(pers[3]);
        }
        if (key !== void 0) {
          const tmp = new Uint8Array(this.blockLen);
          tmp.set(key);
          this.update(tmp);
        }
      }
      // prettier-ignore
      get() {
        let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
        return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
      }
      // prettier-ignore
      set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
        this.v0l = v0l | 0;
        this.v0h = v0h | 0;
        this.v1l = v1l | 0;
        this.v1h = v1h | 0;
        this.v2l = v2l | 0;
        this.v2h = v2h | 0;
        this.v3l = v3l | 0;
        this.v3h = v3h | 0;
        this.v4l = v4l | 0;
        this.v4h = v4h | 0;
        this.v5l = v5l | 0;
        this.v5h = v5h | 0;
        this.v6l = v6l | 0;
        this.v6h = v6h | 0;
        this.v7l = v7l | 0;
        this.v7h = v7h | 0;
      }
      compress(msg, offset, isLast) {
        this.get().forEach((v, i) => BBUF[i] = v);
        BBUF.set(B2B_IV, 16);
        let { h, l } = fromBig(BigInt(this.length));
        BBUF[24] = B2B_IV[8] ^ l;
        BBUF[25] = B2B_IV[9] ^ h;
        if (isLast) {
          BBUF[28] = ~BBUF[28];
          BBUF[29] = ~BBUF[29];
        }
        let j = 0;
        const s = BSIGMA;
        for (let i = 0; i < 12; i++) {
          G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
          G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
          G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
          G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
          G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
          G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
          G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
          G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
          G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
          G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
          G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
          G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
          G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
          G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
          G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
          G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
        }
        this.v0l ^= BBUF[0] ^ BBUF[16];
        this.v0h ^= BBUF[1] ^ BBUF[17];
        this.v1l ^= BBUF[2] ^ BBUF[18];
        this.v1h ^= BBUF[3] ^ BBUF[19];
        this.v2l ^= BBUF[4] ^ BBUF[20];
        this.v2h ^= BBUF[5] ^ BBUF[21];
        this.v3l ^= BBUF[6] ^ BBUF[22];
        this.v3h ^= BBUF[7] ^ BBUF[23];
        this.v4l ^= BBUF[8] ^ BBUF[24];
        this.v4h ^= BBUF[9] ^ BBUF[25];
        this.v5l ^= BBUF[10] ^ BBUF[26];
        this.v5h ^= BBUF[11] ^ BBUF[27];
        this.v6l ^= BBUF[12] ^ BBUF[28];
        this.v6h ^= BBUF[13] ^ BBUF[29];
        this.v7l ^= BBUF[14] ^ BBUF[30];
        this.v7h ^= BBUF[15] ^ BBUF[31];
        clean(BBUF);
      }
      destroy() {
        this.destroyed = true;
        clean(this.buffer32);
        this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
      }
    };
    blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
  }
});

export {
  isValidSuiNSName,
  normalizeSuiNSName,
  init_suins,
  isValidNamedPackage,
  isValidNamedType,
  init_move_registry,
  base64urlnopad,
  bech32,
  init_base,
  toBase58,
  fromBase58,
  fromBase64,
  toBase64,
  fromHex,
  toHex,
  splitGenericParameters,
  BcsType,
  isSerializedBcs,
  BcsStruct,
  BcsEnum,
  BcsTuple,
  compareBcsBytes,
  bcs,
  init_dist2 as init_dist,
  isValidTransactionDigest,
  SUI_ADDRESS_LENGTH,
  isValidSuiAddress,
  isValidSuiObjectId,
  isValidStructTag,
  parseStructTag,
  normalizeStructTag,
  normalizeSuiAddress,
  normalizeSuiObjectId,
  init_sui_types,
  isBytes2 as isBytes,
  anumber2 as anumber,
  abytes,
  ahash,
  aexists,
  clean,
  createView,
  bytesToHex,
  hexToBytes,
  kdfInputToBytes,
  concatBytes,
  checkOpts,
  createHasher,
  randomBytes,
  oidNist,
  init_utils2 as init_utils,
  HashMD,
  SHA512_IV,
  init_md,
  split,
  shrSH,
  shrSL,
  rotrSH,
  rotrSL,
  rotrBH,
  rotrBL,
  add,
  add3L,
  add3H,
  add4L,
  add4H,
  add5L,
  add5H,
  init_u64,
  blake2b,
  init_blake2
};
/*! Bundled license information:

@scure/base/index.js:
  (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)

@noble/hashes/utils.js:
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
*/
//# sourceMappingURL=chunk-BLV67HXL.js.map