UNPKG

@etherspot/data-utils

Version:
1,447 lines (1,428 loc) 758 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key2 of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key2) && key2 !== except) __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __decorateClass = (decorators, target, key2, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key2, result) : decorator(result)) || result; if (kind && result) __defProp(target, key2, result); return result; }; // node_modules/viem/_esm/utils/data/isHex.js function isHex(value, { strict = true } = {}) { if (!value) return false; if (typeof value !== "string") return false; return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x"); } var init_isHex = __esm({ "node_modules/viem/_esm/utils/data/isHex.js"() { } }); // node_modules/viem/_esm/utils/data/size.js function size(value) { if (isHex(value, { strict: false })) return Math.ceil((value.length - 2) / 2); return value.length; } var init_size = __esm({ "node_modules/viem/_esm/utils/data/size.js"() { init_isHex(); } }); // node_modules/viem/_esm/errors/version.js var version; var init_version = __esm({ "node_modules/viem/_esm/errors/version.js"() { version = "2.22.19"; } }); // node_modules/viem/_esm/errors/base.js function walk(err, fn) { if (fn?.(err)) return err; if (err && typeof err === "object" && "cause" in err && err.cause !== void 0) return walk(err.cause, fn); return fn ? null : err; } var errorConfig, BaseError; var init_base = __esm({ "node_modules/viem/_esm/errors/base.js"() { init_version(); errorConfig = { getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0, version: `viem@${version}` }; BaseError = class _BaseError extends Error { constructor(shortMessage, args = {}) { const details = (() => { if (args.cause instanceof _BaseError) return args.cause.details; if (args.cause?.message) return args.cause.message; return args.details; })(); const docsPath = (() => { if (args.cause instanceof _BaseError) return args.cause.docsPath || args.docsPath; return args.docsPath; })(); const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath }); const message = [ shortMessage || "An error occurred.", "", ...args.metaMessages ? [...args.metaMessages, ""] : [], ...docsUrl ? [`Docs: ${docsUrl}`] : [], ...details ? [`Details: ${details}`] : [], ...errorConfig.version ? [`Version: ${errorConfig.version}`] : [] ].join("\n"); super(message, args.cause ? { cause: args.cause } : void 0); Object.defineProperty(this, "details", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "docsPath", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "metaMessages", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "shortMessage", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "version", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "BaseError" }); this.details = details; this.docsPath = docsPath; this.metaMessages = args.metaMessages; this.name = args.name ?? this.name; this.shortMessage = shortMessage; this.version = version; } walk(fn) { return walk(this, fn); } }; } }); // node_modules/viem/_esm/errors/data.js var SizeExceedsPaddingSizeError; var init_data = __esm({ "node_modules/viem/_esm/errors/data.js"() { init_base(); SizeExceedsPaddingSizeError = class extends BaseError { constructor({ size: size2, targetSize, type }) { super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" }); } }; } }); // node_modules/viem/_esm/utils/data/pad.js function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) { if (typeof hexOrBytes === "string") return padHex(hexOrBytes, { dir, size: size2 }); return padBytes(hexOrBytes, { dir, size: size2 }); } function padHex(hex_, { dir, size: size2 = 32 } = {}) { if (size2 === null) return hex_; const hex = hex_.replace("0x", ""); if (hex.length > size2 * 2) throw new SizeExceedsPaddingSizeError({ size: Math.ceil(hex.length / 2), targetSize: size2, type: "hex" }); return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`; } function padBytes(bytes, { dir, size: size2 = 32 } = {}) { if (size2 === null) return bytes; if (bytes.length > size2) throw new SizeExceedsPaddingSizeError({ size: bytes.length, targetSize: size2, type: "bytes" }); const paddedBytes = new Uint8Array(size2); for (let i = 0; i < size2; i++) { const padEnd = dir === "right"; paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1]; } return paddedBytes; } var init_pad = __esm({ "node_modules/viem/_esm/utils/data/pad.js"() { init_data(); } }); // node_modules/viem/_esm/errors/encoding.js var IntegerOutOfRangeError, SizeOverflowError; var init_encoding = __esm({ "node_modules/viem/_esm/errors/encoding.js"() { init_base(); IntegerOutOfRangeError = class extends BaseError { constructor({ max, min, signed: signed2, size: size2, value }) { super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed2 ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" }); } }; SizeOverflowError = class extends BaseError { constructor({ givenSize, maxSize }) { super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" }); } }; } }); // node_modules/viem/_esm/utils/encoding/fromHex.js function assertSize(hexOrBytes, { size: size2 }) { if (size(hexOrBytes) > size2) throw new SizeOverflowError({ givenSize: size(hexOrBytes), maxSize: size2 }); } var init_fromHex = __esm({ "node_modules/viem/_esm/utils/encoding/fromHex.js"() { init_encoding(); init_size(); } }); // node_modules/viem/_esm/utils/encoding/toHex.js function toHex(value, opts = {}) { if (typeof value === "number" || typeof value === "bigint") return numberToHex(value, opts); if (typeof value === "string") { return stringToHex(value, opts); } if (typeof value === "boolean") return boolToHex(value, opts); return bytesToHex(value, opts); } function boolToHex(value, opts = {}) { const hex = `0x${Number(value)}`; if (typeof opts.size === "number") { assertSize(hex, { size: opts.size }); return pad(hex, { size: opts.size }); } return hex; } function bytesToHex(value, opts = {}) { let string = ""; for (let i = 0; i < value.length; i++) { string += hexes[value[i]]; } const hex = `0x${string}`; if (typeof opts.size === "number") { assertSize(hex, { size: opts.size }); return pad(hex, { dir: "right", size: opts.size }); } return hex; } function numberToHex(value_, opts = {}) { const { signed: signed2, size: size2 } = opts; const value = BigInt(value_); let maxValue; if (size2) { if (signed2) maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n; else maxValue = 2n ** (BigInt(size2) * 8n) - 1n; } else if (typeof value_ === "number") { maxValue = BigInt(Number.MAX_SAFE_INTEGER); } const minValue = typeof maxValue === "bigint" && signed2 ? -maxValue - 1n : 0; if (maxValue && value > maxValue || value < minValue) { const suffix = typeof value_ === "bigint" ? "n" : ""; throw new IntegerOutOfRangeError({ max: maxValue ? `${maxValue}${suffix}` : void 0, min: `${minValue}${suffix}`, signed: signed2, size: size2, value: `${value_}${suffix}` }); } const hex = `0x${(signed2 && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`; if (size2) return pad(hex, { size: size2 }); return hex; } function stringToHex(value_, opts = {}) { const value = encoder.encode(value_); return bytesToHex(value, opts); } var hexes, encoder; var init_toHex = __esm({ "node_modules/viem/_esm/utils/encoding/toHex.js"() { init_encoding(); init_pad(); init_fromHex(); hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0")); encoder = /* @__PURE__ */ new TextEncoder(); } }); // node_modules/viem/_esm/utils/encoding/toBytes.js function toBytes(value, opts = {}) { if (typeof value === "number" || typeof value === "bigint") return numberToBytes(value, opts); if (typeof value === "boolean") return boolToBytes(value, opts); if (isHex(value)) return hexToBytes(value, opts); return stringToBytes(value, opts); } function boolToBytes(value, opts = {}) { const bytes = new Uint8Array(1); bytes[0] = Number(value); if (typeof opts.size === "number") { assertSize(bytes, { size: opts.size }); return pad(bytes, { size: opts.size }); } return bytes; } function charCodeToBase16(char) { if (char >= charCodeMap.zero && char <= charCodeMap.nine) return char - charCodeMap.zero; if (char >= charCodeMap.A && char <= charCodeMap.F) return char - (charCodeMap.A - 10); if (char >= charCodeMap.a && char <= charCodeMap.f) return char - (charCodeMap.a - 10); return void 0; } function hexToBytes(hex_, opts = {}) { let hex = hex_; if (opts.size) { assertSize(hex, { size: opts.size }); hex = pad(hex, { dir: "right", size: opts.size }); } let hexString = hex.slice(2); if (hexString.length % 2) hexString = `0${hexString}`; const length = hexString.length / 2; const bytes = new Uint8Array(length); for (let index = 0, j = 0; index < length; index++) { const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++)); const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++)); if (nibbleLeft === void 0 || nibbleRight === void 0) { throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`); } bytes[index] = nibbleLeft * 16 + nibbleRight; } return bytes; } function numberToBytes(value, opts) { const hex = numberToHex(value, opts); return hexToBytes(hex); } function stringToBytes(value, opts = {}) { const bytes = encoder2.encode(value); if (typeof opts.size === "number") { assertSize(bytes, { size: opts.size }); return pad(bytes, { dir: "right", size: opts.size }); } return bytes; } var encoder2, charCodeMap; var init_toBytes = __esm({ "node_modules/viem/_esm/utils/encoding/toBytes.js"() { init_base(); init_isHex(); init_pad(); init_fromHex(); init_toHex(); encoder2 = /* @__PURE__ */ new TextEncoder(); charCodeMap = { zero: 48, nine: 57, A: 65, F: 70, a: 97, f: 102 }; } }); // node_modules/@noble/hashes/esm/_assert.js function anumber(n) { if (!Number.isSafeInteger(n) || n < 0) throw new Error("positive integer expected, got " + n); } function isBytes(a) { return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array"; } function abytes(b, ...lengths) { if (!isBytes(b)) throw new Error("Uint8Array expected"); if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length); } 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); const min = instance.outputLen; if (out.length < min) { throw new Error("digestInto() expects output buffer of length at least " + min); } } var init_assert = __esm({ "node_modules/@noble/hashes/esm/_assert.js"() { } }); // node_modules/@noble/hashes/esm/_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) { let Ah = new Uint32Array(lst.length); let Al = new Uint32Array(lst.length); for (let i = 0; i < lst.length; i++) { const { h, l } = fromBig(lst[i], le); [Ah[i], Al[i]] = [h, l]; } return [Ah, Al]; } var U32_MASK64, _32n, rotlSH, rotlSL, rotlBH, rotlBL; var init_u64 = __esm({ "node_modules/@noble/hashes/esm/_u64.js"() { U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); _32n = /* @__PURE__ */ BigInt(32); rotlSH = (h, l, s) => h << s | l >>> 32 - s; rotlSL = (h, l, s) => l << s | h >>> 32 - s; rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s; rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s; } }); // node_modules/@noble/hashes/esm/utils.js function u32(arr) { return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); } 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]); } } function utf8ToBytes(str) { if (typeof str !== "string") throw new Error("utf8ToBytes expected string, got " + typeof str); return new Uint8Array(new TextEncoder().encode(str)); } function toBytes2(data) { if (typeof data === "string") data = utf8ToBytes(data); abytes(data); return data; } function wrapConstructor(hashCons) { const hashC = (msg) => hashCons().update(toBytes2(msg)).digest(); const tmp = hashCons(); hashC.outputLen = tmp.outputLen; hashC.blockLen = tmp.blockLen; hashC.create = () => hashCons(); return hashC; } function wrapXOFConstructorWithOpts(hashCons) { const hashC = (msg, opts) => hashCons(opts).update(toBytes2(msg)).digest(); const tmp = hashCons({}); hashC.outputLen = tmp.outputLen; hashC.blockLen = tmp.blockLen; hashC.create = (opts) => hashCons(opts); return hashC; } var isLE, Hash; var init_utils = __esm({ "node_modules/@noble/hashes/esm/utils.js"() { init_assert(); isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)(); Hash = class { // Safe version that clones internal state clone() { return this._cloneInto(); } }; } }); // node_modules/@noble/hashes/esm/sha3.js function keccakP(s, rounds = 24) { const B = new Uint32Array(5 * 2); for (let round = 24 - rounds; round < 24; round++) { for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; for (let x = 0; x < 10; x += 2) { const idx1 = (x + 8) % 10; const idx0 = (x + 2) % 10; const B0 = B[idx0]; const B1 = B[idx0 + 1]; const Th = rotlH(B0, B1, 1) ^ B[idx1]; const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; for (let y = 0; y < 50; y += 10) { s[x + y] ^= Th; s[x + y + 1] ^= Tl; } } let curH = s[2]; let curL = s[3]; for (let t = 0; t < 24; t++) { const shift = SHA3_ROTL[t]; const Th = rotlH(curH, curL, shift); const Tl = rotlL(curH, curL, shift); const PI = SHA3_PI[t]; curH = s[PI]; curL = s[PI + 1]; s[PI] = Th; s[PI + 1] = Tl; } for (let y = 0; y < 50; y += 10) { for (let x = 0; x < 10; x++) B[x] = s[y + x]; for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; } s[0] ^= SHA3_IOTA_H[round]; s[1] ^= SHA3_IOTA_L[round]; } B.fill(0); } var SHA3_PI, SHA3_ROTL, _SHA3_IOTA, _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_IOTA_H, SHA3_IOTA_L, rotlH, rotlL, Keccak, gen, sha3_224, sha3_256, sha3_384, sha3_512, keccak_224, keccak_256, keccak_384, keccak_512, genShake, shake128, shake256; var init_sha3 = __esm({ "node_modules/@noble/hashes/esm/sha3.js"() { init_assert(); init_u64(); init_utils(); SHA3_PI = []; SHA3_ROTL = []; _SHA3_IOTA = []; _0n = /* @__PURE__ */ BigInt(0); _1n = /* @__PURE__ */ BigInt(1); _2n = /* @__PURE__ */ BigInt(2); _7n = /* @__PURE__ */ BigInt(7); _256n = /* @__PURE__ */ BigInt(256); _0x71n = /* @__PURE__ */ BigInt(113); for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { [x, y] = [y, (2 * x + 3 * y) % 5]; SHA3_PI.push(2 * (5 * y + x)); SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64); let t = _0n; for (let j = 0; j < 7; j++) { R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n; if (R & _2n) t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n; } _SHA3_IOTA.push(t); } [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s); rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s); Keccak = class _Keccak extends Hash { // NOTE: we accept arguments in bytes instead of bits here. constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { super(); this.blockLen = blockLen; this.suffix = suffix; this.outputLen = outputLen; this.enableXOF = enableXOF; this.rounds = rounds; this.pos = 0; this.posOut = 0; this.finished = false; this.destroyed = false; anumber(outputLen); if (0 >= this.blockLen || this.blockLen >= 200) throw new Error("Sha3 supports only keccak-f1600 function"); this.state = new Uint8Array(200); this.state32 = u32(this.state); } keccak() { if (!isLE) byteSwap32(this.state32); keccakP(this.state32, this.rounds); if (!isLE) byteSwap32(this.state32); this.posOut = 0; this.pos = 0; } update(data) { aexists(this); const { blockLen, state } = this; data = toBytes2(data); const len = data.length; for (let pos = 0; pos < len; ) { const take = Math.min(blockLen - this.pos, len - pos); for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++]; if (this.pos === blockLen) this.keccak(); } return this; } finish() { if (this.finished) return; this.finished = true; const { state, suffix, pos, blockLen } = this; state[pos] ^= suffix; if ((suffix & 128) !== 0 && pos === blockLen - 1) this.keccak(); state[blockLen - 1] ^= 128; this.keccak(); } writeInto(out) { aexists(this, false); abytes(out); this.finish(); const bufferOut = this.state; const { blockLen } = this; for (let pos = 0, len = out.length; pos < len; ) { if (this.posOut >= blockLen) this.keccak(); const take = Math.min(blockLen - this.posOut, len - pos); out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); this.posOut += take; pos += take; } return out; } xofInto(out) { if (!this.enableXOF) throw new Error("XOF is not possible for this instance"); return this.writeInto(out); } xof(bytes) { anumber(bytes); return this.xofInto(new Uint8Array(bytes)); } digestInto(out) { aoutput(out, this); if (this.finished) throw new Error("digest() was already called"); this.writeInto(out); this.destroy(); return out; } digest() { return this.digestInto(new Uint8Array(this.outputLen)); } destroy() { this.destroyed = true; this.state.fill(0); } _cloneInto(to) { const { blockLen, suffix, outputLen, rounds, enableXOF } = this; to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); to.state32.set(this.state32); to.pos = this.pos; to.posOut = this.posOut; to.finished = this.finished; to.rounds = rounds; to.suffix = suffix; to.outputLen = outputLen; to.enableXOF = enableXOF; to.destroyed = this.destroyed; return to; } }; gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); sha3_224 = /* @__PURE__ */ gen(6, 144, 224 / 8); sha3_256 = /* @__PURE__ */ gen(6, 136, 256 / 8); sha3_384 = /* @__PURE__ */ gen(6, 104, 384 / 8); sha3_512 = /* @__PURE__ */ gen(6, 72, 512 / 8); keccak_224 = /* @__PURE__ */ gen(1, 144, 224 / 8); keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8); keccak_384 = /* @__PURE__ */ gen(1, 104, 384 / 8); keccak_512 = /* @__PURE__ */ gen(1, 72, 512 / 8); genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true)); shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8); shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8); } }); // node_modules/viem/_esm/utils/hash/keccak256.js function keccak256(value, to_) { const to = to_ || "hex"; const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value); if (to === "bytes") return bytes; return toHex(bytes); } var init_keccak256 = __esm({ "node_modules/viem/_esm/utils/hash/keccak256.js"() { init_sha3(); init_isHex(); init_toBytes(); init_toHex(); } }); // node_modules/viem/_esm/utils/lru.js var LruMap; var init_lru = __esm({ "node_modules/viem/_esm/utils/lru.js"() { LruMap = class extends Map { constructor(size2) { super(); Object.defineProperty(this, "maxSize", { enumerable: true, configurable: true, writable: true, value: void 0 }); this.maxSize = size2; } get(key2) { const value = super.get(key2); if (super.has(key2) && value !== void 0) { this.delete(key2); super.set(key2, value); } return value; } set(key2, value) { super.set(key2, value); if (this.maxSize && this.size > this.maxSize) { const firstKey = this.keys().next().value; if (firstKey) this.delete(firstKey); } return this; } }; } }); // node_modules/viem/_esm/utils/address/getAddress.js function checksumAddress(address_, chainId) { if (checksumAddressCache.has(`${address_}.${chainId}`)) return checksumAddressCache.get(`${address_}.${chainId}`); const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase(); const hash3 = keccak256(stringToBytes(hexAddress), "bytes"); const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split(""); for (let i = 0; i < 40; i += 2) { if (hash3[i >> 1] >> 4 >= 8 && address[i]) { address[i] = address[i].toUpperCase(); } if ((hash3[i >> 1] & 15) >= 8 && address[i + 1]) { address[i + 1] = address[i + 1].toUpperCase(); } } const result = `0x${address.join("")}`; checksumAddressCache.set(`${address_}.${chainId}`, result); return result; } var checksumAddressCache; var init_getAddress = __esm({ "node_modules/viem/_esm/utils/address/getAddress.js"() { init_toBytes(); init_keccak256(); init_lru(); checksumAddressCache = /* @__PURE__ */ new LruMap(8192); } }); // node_modules/viem/_esm/utils/address/isAddress.js function isAddress(address, options) { const { strict = true } = options ?? {}; const cacheKey = `${address}.${strict}`; if (isAddressCache.has(cacheKey)) return isAddressCache.get(cacheKey); const result = (() => { if (!addressRegex.test(address)) return false; if (address.toLowerCase() === address) return true; if (strict) return checksumAddress(address) === address; return true; })(); isAddressCache.set(cacheKey, result); return result; } var addressRegex, isAddressCache; var init_isAddress = __esm({ "node_modules/viem/_esm/utils/address/isAddress.js"() { init_lru(); init_getAddress(); addressRegex = /^0x[a-fA-F0-9]{40}$/; isAddressCache = /* @__PURE__ */ new LruMap(8192); } }); // node_modules/js-sha3/src/sha3.js var require_sha3 = __commonJS({ "node_modules/js-sha3/src/sha3.js"(exports, module2) { (function() { "use strict"; var INPUT_ERROR = "input is invalid type"; var FINALIZE_ERROR = "finalize already called"; var WINDOW = typeof window === "object"; var root = WINDOW ? window : {}; if (root.JS_SHA3_NO_WINDOW) { WINDOW = false; } var WEB_WORKER = !WINDOW && typeof self === "object"; var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node; if (NODE_JS) { root = global; } else if (WEB_WORKER) { root = self; } var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module2 === "object" && module2.exports; var AMD = typeof define === "function" && define.amd; var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined"; var HEX_CHARS = "0123456789abcdef".split(""); var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; var KECCAK_PADDING = [1, 256, 65536, 16777216]; var PADDING = [6, 1536, 393216, 100663296]; var SHIFT = [0, 8, 16, 24]; var RC = [ 1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648 ]; var BITS = [224, 256, 384, 512]; var SHAKE_BITS = [128, 256]; var OUTPUT_TYPES = ["hex", "buffer", "arrayBuffer", "array", "digest"]; var CSHAKE_BYTEPAD = { "128": 168, "256": 136 }; if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { Array.isArray = function(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; }; } if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { ArrayBuffer.isView = function(obj) { return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer; }; } var createOutputMethod = function(bits2, padding2, outputType) { return function(message) { return new Keccak2(bits2, padding2, bits2).update(message)[outputType](); }; }; var createShakeOutputMethod = function(bits2, padding2, outputType) { return function(message, outputBits) { return new Keccak2(bits2, padding2, outputBits).update(message)[outputType](); }; }; var createCshakeOutputMethod = function(bits2, padding2, outputType) { return function(message, outputBits, n, s) { return methods["cshake" + bits2].update(message, outputBits, n, s)[outputType](); }; }; var createKmacOutputMethod = function(bits2, padding2, outputType) { return function(key2, message, outputBits, s) { return methods["kmac" + bits2].update(key2, message, outputBits, s)[outputType](); }; }; var createOutputMethods = function(method, createMethod2, bits2, padding2) { for (var i2 = 0; i2 < OUTPUT_TYPES.length; ++i2) { var type = OUTPUT_TYPES[i2]; method[type] = createMethod2(bits2, padding2, type); } return method; }; var createMethod = function(bits2, padding2) { var method = createOutputMethod(bits2, padding2, "hex"); method.create = function() { return new Keccak2(bits2, padding2, bits2); }; method.update = function(message) { return method.create().update(message); }; return createOutputMethods(method, createOutputMethod, bits2, padding2); }; var createShakeMethod = function(bits2, padding2) { var method = createShakeOutputMethod(bits2, padding2, "hex"); method.create = function(outputBits) { return new Keccak2(bits2, padding2, outputBits); }; method.update = function(message, outputBits) { return method.create(outputBits).update(message); }; return createOutputMethods(method, createShakeOutputMethod, bits2, padding2); }; var createCshakeMethod = function(bits2, padding2) { var w = CSHAKE_BYTEPAD[bits2]; var method = createCshakeOutputMethod(bits2, padding2, "hex"); method.create = function(outputBits, n, s) { if (!n && !s) { return methods["shake" + bits2].create(outputBits); } else { return new Keccak2(bits2, padding2, outputBits).bytepad([n, s], w); } }; method.update = function(message, outputBits, n, s) { return method.create(outputBits, n, s).update(message); }; return createOutputMethods(method, createCshakeOutputMethod, bits2, padding2); }; var createKmacMethod = function(bits2, padding2) { var w = CSHAKE_BYTEPAD[bits2]; var method = createKmacOutputMethod(bits2, padding2, "hex"); method.create = function(key2, outputBits, s) { return new Kmac(bits2, padding2, outputBits).bytepad(["KMAC", s], w).bytepad([key2], w); }; method.update = function(key2, message, outputBits, s) { return method.create(key2, outputBits, s).update(message); }; return createOutputMethods(method, createKmacOutputMethod, bits2, padding2); }; var algorithms = [ { name: "keccak", padding: KECCAK_PADDING, bits: BITS, createMethod }, { name: "sha3", padding: PADDING, bits: BITS, createMethod }, { name: "shake", padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, { name: "cshake", padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, { name: "kmac", padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } ]; var methods = {}, methodNames = []; for (var i = 0; i < algorithms.length; ++i) { var algorithm = algorithms[i]; var bits = algorithm.bits; for (var j = 0; j < bits.length; ++j) { var methodName = algorithm.name + "_" + bits[j]; methodNames.push(methodName); methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); if (algorithm.name !== "sha3") { var newMethodName = algorithm.name + bits[j]; methodNames.push(newMethodName); methods[newMethodName] = methods[methodName]; } } } function Keccak2(bits2, padding2, outputBits) { this.blocks = []; this.s = []; this.padding = padding2; this.outputBits = outputBits; this.reset = true; this.finalized = false; this.block = 0; this.start = 0; this.blockCount = 1600 - (bits2 << 1) >> 5; this.byteCount = this.blockCount << 2; this.outputBlocks = outputBits >> 5; this.extraBytes = (outputBits & 31) >> 3; for (var i2 = 0; i2 < 50; ++i2) { this.s[i2] = 0; } } Keccak2.prototype.update = function(message) { if (this.finalized) { throw new Error(FINALIZE_ERROR); } var notString, type = typeof message; if (type !== "string") { if (type === "object") { if (message === null) { throw new Error(INPUT_ERROR); } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { message = new Uint8Array(message); } else if (!Array.isArray(message)) { if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { throw new Error(INPUT_ERROR); } } } else { throw new Error(INPUT_ERROR); } notString = true; } var blocks = this.blocks, byteCount = this.byteCount, length = message.length, blockCount = this.blockCount, index = 0, s = this.s, i2, code; while (index < length) { if (this.reset) { this.reset = false; blocks[0] = this.block; for (i2 = 1; i2 < blockCount + 1; ++i2) { blocks[i2] = 0; } } if (notString) { for (i2 = this.start; index < length && i2 < byteCount; ++index) { blocks[i2 >> 2] |= message[index] << SHIFT[i2++ & 3]; } } else { for (i2 = this.start; index < length && i2 < byteCount; ++index) { code = message.charCodeAt(index); if (code < 128) { blocks[i2 >> 2] |= code << SHIFT[i2++ & 3]; } else if (code < 2048) { blocks[i2 >> 2] |= (192 | code >> 6) << SHIFT[i2++ & 3]; blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; } else if (code < 55296 || code >= 57344) { blocks[i2 >> 2] |= (224 | code >> 12) << SHIFT[i2++ & 3]; blocks[i2 >> 2] |= (128 | code >> 6 & 63) << SHIFT[i2++ & 3]; blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; } else { code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023); blocks[i2 >> 2] |= (240 | code >> 18) << SHIFT[i2++ & 3]; blocks[i2 >> 2] |= (128 | code >> 12 & 63) << SHIFT[i2++ & 3]; blocks[i2 >> 2] |= (128 | code >> 6 & 63) << SHIFT[i2++ & 3]; blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; } } } this.lastByteIndex = i2; if (i2 >= byteCount) { this.start = i2 - byteCount; this.block = blocks[blockCount]; for (i2 = 0; i2 < blockCount; ++i2) { s[i2] ^= blocks[i2]; } f(s); this.reset = true; } else { this.start = i2; } } return this; }; Keccak2.prototype.encode = function(x, right) { var o = x & 255, n = 1; var bytes = [o]; x = x >> 8; o = x & 255; while (o > 0) { bytes.unshift(o); x = x >> 8; o = x & 255; ++n; } if (right) { bytes.push(n); } else { bytes.unshift(n); } this.update(bytes); return bytes.length; }; Keccak2.prototype.encodeString = function(str) { var notString, type = typeof str; if (type !== "string") { if (type === "object") { if (str === null) { throw new Error(INPUT_ERROR); } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { str = new Uint8Array(str); } else if (!Array.isArray(str)) { if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { throw new Error(INPUT_ERROR); } } } else { throw new Error(INPUT_ERROR); } notString = true; } var bytes = 0, length = str.length; if (notString) { bytes = length; } else { for (var i2 = 0; i2 < str.length; ++i2) { var code = str.charCodeAt(i2); if (code < 128) { bytes += 1; } else if (code < 2048) { bytes += 2; } else if (code < 55296 || code >= 57344) { bytes += 3; } else { code = 65536 + ((code & 1023) << 10 | str.charCodeAt(++i2) & 1023); bytes += 4; } } } bytes += this.encode(bytes * 8); this.update(str); return bytes; }; Keccak2.prototype.bytepad = function(strs, w) { var bytes = this.encode(w); for (var i2 = 0; i2 < strs.length; ++i2) { bytes += this.encodeString(strs[i2]); } var paddingBytes = w - bytes % w; var zeros2 = []; zeros2.length = paddingBytes; this.update(zeros2); return this; }; Keccak2.prototype.finalize = function() { if (this.finalized) { return; } this.finalized = true; var blocks = this.blocks, i2 = this.lastByteIndex, blockCount = this.blockCount, s = this.s; blocks[i2 >> 2] |= this.padding[i2 & 3]; if (this.lastByteIndex === this.byteCount) { blocks[0] = blocks[blockCount]; for (i2 = 1; i2 < blockCount + 1; ++i2) { blocks[i2] = 0; } } blocks[blockCount - 1] |= 2147483648; for (i2 = 0; i2 < blockCount; ++i2) { s[i2] ^= blocks[i2]; } f(s); }; Keccak2.prototype.toString = Keccak2.prototype.hex = function() { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 0; var hex = "", block; while (j2 < outputBlocks) { for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { block = s[i2]; hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15] + HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15] + HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15] + HEX_CHARS[block >> 28 & 15] + HEX_CHARS[block >> 24 & 15]; } if (j2 % blockCount === 0) { f(s); i2 = 0; } } if (extraBytes) { block = s[i2]; hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15]; if (extraBytes > 1) { hex += HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15]; } if (extraBytes > 2) { hex += HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15]; } } return hex; }; Keccak2.prototype.arrayBuffer = function() { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 0; var bytes = this.outputBits >> 3; var buffer; if (extraBytes) { buffer = new ArrayBuffer(outputBlocks + 1 << 2); } else { buffer = new ArrayBuffer(bytes); } var array = new Uint32Array(buffer); while (j2 < outputBlocks) { for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { array[j2] = s[i2]; } if (j2 % blockCount === 0) { f(s); } } if (extraBytes) { array[i2] = s[i2]; buffer = buffer.slice(0, bytes); } return buffer; }; Keccak2.prototype.buffer = Keccak2.prototype.arrayBuffer; Keccak2.prototype.digest = Keccak2.prototype.array = function() { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 0; var array = [], offset, block; while (j2 < outputBlocks) { for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { offset = j2 << 2; block = s[i2]; array[offset] = block & 255; array[offset + 1] = block >> 8 & 255; array[offset + 2] = block >> 16 & 255; array[offset + 3] = block >> 24 & 255; } if (j2 % blockCount === 0) { f(s); } } if (extraBytes) { offset = j2 << 2; block = s[i2]; array[offset] = block & 255; if (extraBytes > 1) { array[offset + 1] = block >> 8 & 255; } if (extraBytes > 2) { array[offset + 2] = block >> 16 & 255; } } return array; }; function Kmac(bits2, padding2, outputBits) { Keccak2.call(this, bits2, padding2, outputBits); } Kmac.prototype = new Keccak2(); Kmac.prototype.finalize = function() { this.encode(this.outputBits, true); return Keccak2.prototype.finalize.call(this); }; var f = function(s) { var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; for (n = 0; n < 48; n += 2) { c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; h = c8 ^ (c2 << 1 | c3 >>> 31); l = c9 ^ (c3 << 1 | c2 >>> 31); s[0] ^= h; s[1] ^= l; s[10] ^= h; s[11] ^= l; s[20] ^= h; s[21] ^= l; s[30] ^= h; s[31] ^= l; s[40] ^= h; s[41] ^= l; h = c0 ^ (c4 << 1 | c5 >>> 31); l = c1 ^ (c5 << 1 | c4 >>> 31); s[2] ^= h; s[3] ^= l; s[12] ^= h; s[13] ^= l; s[22] ^= h; s[23] ^= l; s[32] ^= h; s[33] ^= l; s[42] ^= h; s[43] ^= l; h = c2 ^ (c6 << 1 | c7 >>> 31); l = c3 ^ (c7 << 1 | c6 >>> 31); s[4] ^= h; s[5] ^= l; s[14] ^= h; s[15] ^= l; s[24] ^= h; s[25] ^= l; s[34] ^= h; s[35] ^= l; s[44] ^= h; s[45] ^= l; h = c4 ^ (c8 << 1 | c9 >>> 31); l = c5 ^ (c9 << 1 | c8 >>> 31); s[6] ^= h; s[7] ^= l; s[16] ^= h; s[17] ^= l; s[26] ^= h; s[27] ^= l; s[36] ^= h; s[37] ^= l; s[46] ^= h; s[47] ^= l; h = c6 ^ (c0 << 1 | c1 >>> 31); l = c7 ^ (c1 << 1 | c0 >>> 31); s[8] ^= h; s[9] ^= l; s[18] ^= h; s[19] ^= l; s[28] ^= h; s[29] ^= l; s[38] ^= h; s[39] ^= l; s[48] ^= h; s[49] ^= l; b0 = s[0]; b1 = s[1]; b32 = s[11] << 4 | s[10] >>> 28; b33 = s[10] << 4 | s[11] >>> 28; b14 = s[20] << 3 | s[21] >>> 29; b15 = s[21] << 3 | s[20] >>> 29; b46 = s[31] << 9 | s[30] >>> 23; b47 = s[30] << 9 | s[31] >>> 23; b28 = s[40] << 18 | s[41] >>> 14; b29 = s[41] << 18 | s[40] >>> 14; b20 = s[2] << 1 | s[3] >>> 31; b21 = s[3] << 1 | s[2] >>> 31; b2 = s[13] << 12 | s[12] >>> 20; b3 = s[12] << 12 | s[13] >>> 20; b34 = s[22] << 10 | s[23] >>> 22; b35 = s[23] << 10 | s[22] >>> 22; b16 = s[33] << 13 | s[32] >>> 19; b17 = s[32] << 13 | s[33] >>> 19; b48 = s[42] << 2 | s[43] >>> 30; b49 = s[43] << 2 | s[42] >>> 30; b40 = s[5] << 30 | s[4] >>> 2; b41 = s[4] << 30 | s[5] >>> 2; b22 = s[14] << 6 | s[15] >>> 26; b23 = s[15] << 6 | s[14] >>> 26; b4 = s[25] << 11 | s[24] >>> 21; b5 = s[24] << 11 | s[25] >>> 21; b36 = s[34] << 15 | s[35] >>> 17; b37 = s[35] << 15 | s[34] >>> 17; b18 = s[45] << 29 | s[44] >>> 3; b19 = s[44] << 29 | s[45] >>> 3; b10 = s[6] << 28 | s[7] >>> 4; b11 = s[7] << 28 | s[6] >>> 4; b42 = s[17] << 23 | s[16] >>> 9; b43 = s[16] << 23 | s[17] >>> 9; b24 = s[26] << 25 | s[27] >>> 7; b25 = s[27] << 25 | s[26] >>> 7; b6 = s[36] << 21 | s[37] >>> 11; b7 = s[37] << 21 | s[36] >>> 11; b38 = s[47] << 24 | s[46] >>> 8; b39 = s[46] << 24 | s[47] >>> 8; b30 = s[8] << 27 | s[9] >>> 5; b31 = s[9] << 27 | s[8] >>> 5; b12 = s[18] << 20 | s[19] >>> 12; b13 = s[19] << 20 | s[18] >>> 12; b44 = s[29] << 7 | s[28] >>> 25; b45 = s[28] << 7 | s[29] >>> 25; b26 = s[38] << 8 | s[39] >>> 24; b27 = s[39] << 8 | s[38] >>> 24; b8 = s[48] << 14 | s[49] >>> 18; b9 = s[49] << 14 | s[48] >>> 18; s[0] = b0 ^ ~b2 & b4; s[1] = b1 ^ ~b3 & b5; s[10] = b10 ^ ~b12 & b14; s[11] = b11 ^ ~b13 & b15; s[20] = b20 ^ ~b22 & b24; s[21] = b21 ^ ~b23 & b25; s[30] = b30 ^ ~b32 & b34; s[31] = b31 ^ ~b33 & b35; s[40] = b40 ^ ~b42 & b44; s[41] = b41 ^ ~b43 & b45; s[2] = b2 ^ ~b4 & b6; s[3] = b3 ^ ~b5 & b7; s[12] = b12 ^ ~b14 & b16; s[13] = b13 ^ ~b15 & b17; s[22] = b22 ^ ~b24 & b26; s[23] = b23 ^ ~b25 & b27; s[32] = b32 ^ ~b34 & b36; s[33] = b33 ^ ~b35 & b37; s[42] = b42 ^ ~b44 & b46; s[43] = b43 ^ ~b45 & b47; s[4] = b4 ^ ~b6 & b8; s[5] = b5 ^ ~b7 & b9; s[14] = b14 ^ ~b16 & b18; s[15] = b15 ^ ~b17 & b19; s[24] = b24 ^ ~b26 & b28; s[25] = b25 ^ ~b27 & b29; s[34] = b34 ^ ~b36 & b38; s[35] = b35 ^ ~b37 & b39; s[44] = b44 ^ ~b46 & b48; s[45] = b45 ^ ~b47 & b49; s[6] = b6 ^ ~b8 & b0; s[7] = b7 ^ ~b9 & b1; s[16] = b16 ^ ~b18 & b10; s[17] = b17 ^ ~b19 & b11; s[26] = b26 ^ ~b28 & b20; s[27] = b27 ^ ~b29 & b21; s[36] = b36 ^ ~b38 & b30; s[37] = b37 ^ ~b39 & b31; s[46] = b46 ^ ~b48 & b40; s[47] = b47 ^ ~b49 & b41; s[8] = b8 ^ ~b0 & b2; s[9] = b9 ^ ~b1 & b3; s[18] = b18 ^ ~b10 & b12; s[19] = b19 ^ ~b11 & b13; s[28] = b28 ^ ~b20 & b22; s[29] = b29 ^ ~b