commit 18d1a02e984a156dd10b0da63ebf5478adb202a5 Author: Yigid BALABAN Date: Tue Oct 1 22:56:10 2024 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/dist/bundle.js b/dist/bundle.js new file mode 100644 index 0000000..8b647ae --- /dev/null +++ b/dist/bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see bundle.js.LICENSE.txt */ +(()=>{var __webpack_modules__={"./index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _roadhog_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./roadhog.js */ \"./roadhog.js\");\n\n\nconst endpoint = \"http://localhost:3000\";\n\nasync function signIn(type) {\n try {\n const result = await (0,_roadhog_js__WEBPACK_IMPORTED_MODULE_0__.signIn)(type);\n if (result.success) {\n console.log('Successfully signed in with', type);\n const b = document.createElement('button');\n b.innerText = 'Click to access protected';\n b.setAttribute('onclick', 'fetchProtected()');\n document.body.appendChild(b);\n } else {\n console.error('Sign-in failed:', result.error);\n }\n } catch (error) {\n console.error('Sign-in error:', error);\n }\n}\n\nasync function signOff() {\n\n}\n\nasync function fetchProtected() {\n const response = await fetch(`${endpoint}/protected`, {\n method: 'GET',\n headers: {\n 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`\n }\n });\n if (!response.ok) {\n console.error('error fetching /protected:', response);\n } else {\n const { message, address, type } = await response.json();\n console.log('success fetching /protected:', `you are ${address} from ${type} and CCIR says ${message}.`);\n }\n}\n\nwindow.signIn = signIn;\nwindow.fetchProtected = fetchProtected;\nwindow.signOff = signOff;\n\nfunction init() {\n console.log('start');\n if (!window.ethereum) console.log('ethereum not detected');\n if (!window.solana) console.log('solana not detected');\n}\n\nwindow.addEventListener('load', init);\n\n\n//# sourceURL=webpack:///./index.js?")},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/_shortw_utils.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.createCurve = exports.getHash = void 0;\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nconst hmac_1 = __webpack_require__(/*! @noble/hashes/hmac */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/hmac.js");\nconst utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js");\nconst weierstrass_js_1 = __webpack_require__(/*! ./abstract/weierstrass.js */ "./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/weierstrass.js");\n// connects noble-curves to noble-hashes\nfunction getHash(hash) {\n return {\n hash,\n hmac: (key, ...msgs) => (0, hmac_1.hmac)(hash, key, (0, utils_1.concatBytes)(...msgs)),\n randomBytes: utils_1.randomBytes,\n };\n}\nexports.getHash = getHash;\nfunction createCurve(curveDef, defHash) {\n const create = (hash) => (0, weierstrass_js_1.weierstrass)({ ...curveDef, ...getHash(hash) });\n return Object.freeze({ ...create(defHash), create });\n}\nexports.createCurve = createCurve;\n//# sourceMappingURL=_shortw_utils.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/_shortw_utils.js?')},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/curve.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateBasic = exports.wNAF = void 0;\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Abelian group utilities\nconst modular_js_1 = __webpack_require__(/*! ./modular.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/modular.js\");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js\");\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\n// Elliptic curve multiplication of Point by scalar. Fragile.\n// Scalars should always be less than curve order: this should be checked inside of a curve itself.\n// Creates precomputation tables for fast multiplication:\n// - private scalar is split by fixed size windows of W bits\n// - every window point is collected from window's table & added to accumulator\n// - since windows are different, same point inside tables won't be accessed more than once per calc\n// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n// - +1 window is neccessary for wNAF\n// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow\n// windows to be in different memory locations\nfunction wNAF(c, bits) {\n const constTimeNegate = (condition, item) => {\n const neg = item.negate();\n return condition ? neg : item;\n };\n const opts = (W) => {\n const windows = Math.ceil(bits / W) + 1; // +1, because\n const windowSize = 2 ** (W - 1); // -1 because we skip zero\n return { windows, windowSize };\n };\n return {\n constTimeNegate,\n // non-const time multiplication ladder\n unsafeLadder(elm, n) {\n let p = c.ZERO;\n let d = elm;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n },\n /**\n * Creates a wNAF precomputation window. Used for caching.\n * Default window size is set by `utils.precompute()` and is equal to 8.\n * Number of precomputed points depends on the curve size:\n * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n * - 𝑊 is the window size\n * - 𝑛 is the bitlength of the curve order.\n * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n * @returns precomputed point tables flattened to a single array\n */\n precomputeWindow(elm, W) {\n const { windows, windowSize } = opts(W);\n const points = [];\n let p = elm;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n // =1, because we skip zero\n for (let i = 1; i < windowSize; i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n },\n /**\n * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n * @param W window size\n * @param precomputes precomputed tables\n * @param n scalar (we don't check here, but should be less than curve order)\n * @returns real and fake (for const-time) points\n */\n wNAF(W, precomputes, n) {\n // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise\n // But need to carefully remove other checks before wNAF. ORDER == bits here\n const { windows, windowSize } = opts(W);\n let p = c.ZERO;\n let f = c.BASE;\n const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc.\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n // Extract W bits.\n let wbits = Number(n & mask);\n // Shift number by W bits.\n n >>= shiftBy;\n // If the bits are bigger than max size, we'll split those.\n // +224 => 256 - 32\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n // there is negate now: it is possible that negated element from low value\n // would be the same as high element, which will create carry into next window.\n // It's not obvious how this can fail, but still worth investigating later.\n // Check if we're onto Zero point.\n // Add random point inside current window to f.\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n // The most important part for const-time getPublicKey\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ()\n // Even if the variable is still unused, there are some checks which will\n // throw an exception, so compiler needs to prove they won't happen, which is hard.\n // At this point there is a way to F be infinity-point even if p is not,\n // which makes it less const-time: around 1 bigint multiply.\n return { p, f };\n },\n wNAFCached(P, precomputesMap, n, transform) {\n // @ts-ignore\n const W = P._WINDOW_SIZE || 1;\n // Calculate precomputes on a first run, reuse them after\n let comp = precomputesMap.get(P);\n if (!comp) {\n comp = this.precomputeWindow(P, W);\n if (W !== 1) {\n precomputesMap.set(P, transform(comp));\n }\n }\n return this.wNAF(W, comp, n);\n },\n };\n}\nexports.wNAF = wNAF;\nfunction validateBasic(curve) {\n (0, modular_js_1.validateField)(curve.Fp);\n (0, utils_js_1.validateObject)(curve, {\n n: 'bigint',\n h: 'bigint',\n Gx: 'field',\n Gy: 'field',\n }, {\n nBitLength: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n });\n // Set defaults\n return Object.freeze({\n ...(0, modular_js_1.nLength)(curve.n, curve.nBitLength),\n ...curve,\n ...{ p: curve.Fp.ORDER },\n });\n}\nexports.validateBasic = validateBasic;\n//# sourceMappingURL=curve.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/curve.js?")},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/hash-to-curve.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.createHasher = exports.isogenyMap = exports.hash_to_field = exports.expand_message_xof = exports.expand_message_xmd = void 0;\nconst modular_js_1 = __webpack_require__(/*! ./modular.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/modular.js\");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js\");\nfunction validateDST(dst) {\n if (dst instanceof Uint8Array)\n return dst;\n if (typeof dst === 'string')\n return (0, utils_js_1.utf8ToBytes)(dst);\n throw new Error('DST must be Uint8Array or string');\n}\n// Octet Stream to Integer. \"spec\" implementation of os2ip is 2.5x slower vs bytesToNumberBE.\nconst os2ip = utils_js_1.bytesToNumberBE;\n// Integer to Octet Stream (numberToBytesBE)\nfunction i2osp(value, length) {\n if (value < 0 || value >= 1 << (8 * length)) {\n throw new Error(`bad I2OSP call: value=${value} length=${length}`);\n }\n const res = Array.from({ length }).fill(0);\n for (let i = length - 1; i >= 0; i--) {\n res[i] = value & 0xff;\n value >>>= 8;\n }\n return new Uint8Array(res);\n}\nfunction strxor(a, b) {\n const arr = new Uint8Array(a.length);\n for (let i = 0; i < a.length; i++) {\n arr[i] = a[i] ^ b[i];\n }\n return arr;\n}\nfunction isBytes(item) {\n if (!(item instanceof Uint8Array))\n throw new Error('Uint8Array expected');\n}\nfunction isNum(item) {\n if (!Number.isSafeInteger(item))\n throw new Error('number expected');\n}\n// Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits\n// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1\nfunction expand_message_xmd(msg, DST, lenInBytes, H) {\n isBytes(msg);\n isBytes(DST);\n isNum(lenInBytes);\n // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3\n if (DST.length > 255)\n DST = H((0, utils_js_1.concatBytes)((0, utils_js_1.utf8ToBytes)('H2C-OVERSIZE-DST-'), DST));\n const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H;\n const ell = Math.ceil(lenInBytes / b_in_bytes);\n if (ell > 255)\n throw new Error('Invalid xmd length');\n const DST_prime = (0, utils_js_1.concatBytes)(DST, i2osp(DST.length, 1));\n const Z_pad = i2osp(0, r_in_bytes);\n const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str\n const b = new Array(ell);\n const b_0 = H((0, utils_js_1.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));\n b[0] = H((0, utils_js_1.concatBytes)(b_0, i2osp(1, 1), DST_prime));\n for (let i = 1; i <= ell; i++) {\n const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime];\n b[i] = H((0, utils_js_1.concatBytes)(...args));\n }\n const pseudo_random_bytes = (0, utils_js_1.concatBytes)(...b);\n return pseudo_random_bytes.slice(0, lenInBytes);\n}\nexports.expand_message_xmd = expand_message_xmd;\n// Produces a uniformly random byte string using an extendable-output function (XOF) H.\n// 1. The collision resistance of H MUST be at least k bits.\n// 2. H MUST be an XOF that has been proved indifferentiable from\n// a random oracle under a reasonable cryptographic assumption.\n// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2\nfunction expand_message_xof(msg, DST, lenInBytes, k, H) {\n isBytes(msg);\n isBytes(DST);\n isNum(lenInBytes);\n // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3\n // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8));\n if (DST.length > 255) {\n const dkLen = Math.ceil((2 * k) / 8);\n DST = H.create({ dkLen }).update((0, utils_js_1.utf8ToBytes)('H2C-OVERSIZE-DST-')).update(DST).digest();\n }\n if (lenInBytes > 65535 || DST.length > 255)\n throw new Error('expand_message_xof: invalid lenInBytes');\n return (H.create({ dkLen: lenInBytes })\n .update(msg)\n .update(i2osp(lenInBytes, 2))\n // 2. DST_prime = DST || I2OSP(len(DST), 1)\n .update(DST)\n .update(i2osp(DST.length, 1))\n .digest());\n}\nexports.expand_message_xof = expand_message_xof;\n/**\n * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F\n * https://www.rfc-editor.org/rfc/rfc9380#section-5.2\n * @param msg a byte string containing the message to hash\n * @param count the number of elements of F to output\n * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above\n * @returns [u_0, ..., u_(count - 1)], a list of field elements.\n */\nfunction hash_to_field(msg, count, options) {\n (0, utils_js_1.validateObject)(options, {\n DST: 'stringOrUint8Array',\n p: 'bigint',\n m: 'isSafeInteger',\n k: 'isSafeInteger',\n hash: 'hash',\n });\n const { p, k, m, hash, expand, DST: _DST } = options;\n isBytes(msg);\n isNum(count);\n const DST = validateDST(_DST);\n const log2p = p.toString(2).length;\n const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above\n const len_in_bytes = count * m * L;\n let prb; // pseudo_random_bytes\n if (expand === 'xmd') {\n prb = expand_message_xmd(msg, DST, len_in_bytes, hash);\n }\n else if (expand === 'xof') {\n prb = expand_message_xof(msg, DST, len_in_bytes, k, hash);\n }\n else if (expand === '_internal_pass') {\n // for internal tests only\n prb = msg;\n }\n else {\n throw new Error('expand must be \"xmd\" or \"xof\"');\n }\n const u = new Array(count);\n for (let i = 0; i < count; i++) {\n const e = new Array(m);\n for (let j = 0; j < m; j++) {\n const elm_offset = L * (j + i * m);\n const tv = prb.subarray(elm_offset, elm_offset + L);\n e[j] = (0, modular_js_1.mod)(os2ip(tv), p);\n }\n u[i] = e;\n }\n return u;\n}\nexports.hash_to_field = hash_to_field;\nfunction isogenyMap(field, map) {\n // Make same order as in spec\n const COEFF = map.map((i) => Array.from(i).reverse());\n return (x, y) => {\n const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));\n x = field.div(xNum, xDen); // xNum / xDen\n y = field.mul(y, field.div(yNum, yDen)); // y * (yNum / yDev)\n return { x, y };\n };\n}\nexports.isogenyMap = isogenyMap;\nfunction createHasher(Point, mapToCurve, def) {\n if (typeof mapToCurve !== 'function')\n throw new Error('mapToCurve() must be defined');\n return {\n // Encodes byte string to elliptic curve.\n // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3\n hashToCurve(msg, options) {\n const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options });\n const u0 = Point.fromAffine(mapToCurve(u[0]));\n const u1 = Point.fromAffine(mapToCurve(u[1]));\n const P = u0.add(u1).clearCofactor();\n P.assertValidity();\n return P;\n },\n // Encodes byte string to elliptic curve.\n // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3\n encodeToCurve(msg, options) {\n const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options });\n const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor();\n P.assertValidity();\n return P;\n },\n };\n}\nexports.createHasher = createHasher;\n//# sourceMappingURL=hash-to-curve.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/hash-to-curve.js?")},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/modular.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.mapHashToField = exports.getMinHashLength = exports.getFieldBytesLength = exports.hashToPrivateScalar = exports.FpSqrtEven = exports.FpSqrtOdd = exports.Field = exports.nLength = exports.FpIsSquare = exports.FpDiv = exports.FpInvertBatch = exports.FpPow = exports.validateField = exports.isNegativeLE = exports.FpSqrt = exports.tonelliShanks = exports.invert = exports.pow2 = exports.pow = exports.mod = void 0;\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Utilities for modular arithmetics and finite fields\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js\");\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);\n// prettier-ignore\nconst _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8);\n// prettier-ignore\nconst _9n = BigInt(9), _16n = BigInt(16);\n// Calculates a modulo b\nfunction mod(a, b) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\nexports.mod = mod;\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\n// TODO: use field version && remove\nfunction pow(num, power, modulo) {\n if (modulo <= _0n || power < _0n)\n throw new Error('Expected power/modulo > 0');\n if (modulo === _1n)\n return _0n;\n let res = _1n;\n while (power > _0n) {\n if (power & _1n)\n res = (res * num) % modulo;\n num = (num * num) % modulo;\n power >>= _1n;\n }\n return res;\n}\nexports.pow = pow;\n// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4)\nfunction pow2(x, power, modulo) {\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= modulo;\n }\n return res;\n}\nexports.pow2 = pow2;\n// Inverses number over modulo\nfunction invert(number, modulo) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/\n // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n let a = mod(number, modulo);\n let b = modulo;\n // prettier-ignore\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n // JIT applies optimization if those two lines follow each other\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n // prettier-ignore\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\nexports.invert = invert;\n/**\n * Tonelli-Shanks square root search algorithm.\n * 1. https://eprint.iacr.org/2012/685.pdf (page 12)\n * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks\n * Will start an infinite loop if field order P is not prime.\n * @param P field order\n * @returns function that takes field Fp (created from P) and number n\n */\nfunction tonelliShanks(P) {\n // Legendre constant: used to calculate Legendre symbol (a | p),\n // which denotes the value of a^((p-1)/2) (mod p).\n // (a | p) ≡ 1 if a is a square (mod p)\n // (a | p) ≡ -1 if a is not a square (mod p)\n // (a | p) ≡ 0 if a ≡ 0 (mod p)\n const legendreC = (P - _1n) / _2n;\n let Q, S, Z;\n // Step 1: By factoring out powers of 2 from p - 1,\n // find q and s such that p - 1 = q*(2^s) with q odd\n for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++)\n ;\n // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq\n for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++)\n ;\n // Fast-path\n if (S === 1) {\n const p1div4 = (P + _1n) / _4n;\n return function tonelliFast(Fp, n) {\n const root = Fp.pow(n, p1div4);\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Slow-path\n const Q1div2 = (Q + _1n) / _2n;\n return function tonelliSlow(Fp, n) {\n // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1\n if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))\n throw new Error('Cannot find square root');\n let r = S;\n // TODO: will fail at Fp2/etc\n let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b\n let x = Fp.pow(n, Q1div2); // first guess at the square root\n let b = Fp.pow(n, Q); // first guess at the fudge factor\n while (!Fp.eql(b, Fp.ONE)) {\n if (Fp.eql(b, Fp.ZERO))\n return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)\n // Find m such b^(2^m)==1\n let m = 1;\n for (let t2 = Fp.sqr(b); m < r; m++) {\n if (Fp.eql(t2, Fp.ONE))\n break;\n t2 = Fp.sqr(t2); // t2 *= t2\n }\n // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow\n const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1)\n g = Fp.sqr(ge); // g = ge * ge\n x = Fp.mul(x, ge); // x *= ge\n b = Fp.mul(b, g); // b *= g\n r = m;\n }\n return x;\n };\n}\nexports.tonelliShanks = tonelliShanks;\nfunction FpSqrt(P) {\n // NOTE: different algorithms can give different roots, it is up to user to decide which one they want.\n // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n // P ≡ 3 (mod 4)\n // √n = n^((P+1)/4)\n if (P % _4n === _3n) {\n // Not all roots possible!\n // const ORDER =\n // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;\n // const NUM = 72057594037927816n;\n const p1div4 = (P + _1n) / _4n;\n return function sqrt3mod4(Fp, n) {\n const root = Fp.pow(n, p1div4);\n // Throw if root**2 != n\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)\n if (P % _8n === _5n) {\n const c1 = (P - _5n) / _8n;\n return function sqrt5mod8(Fp, n) {\n const n2 = Fp.mul(n, _2n);\n const v = Fp.pow(n2, c1);\n const nv = Fp.mul(n, v);\n const i = Fp.mul(Fp.mul(nv, _2n), v);\n const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // P ≡ 9 (mod 16)\n if (P % _16n === _9n) {\n // NOTE: tonelli is too slow for bls-Fp2 calculations even on start\n // Means we cannot use sqrt for constants at all!\n //\n // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic\n // sqrt = (x) => {\n // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4\n // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1\n // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1\n // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1\n // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x\n // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x\n // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x\n // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x\n // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x\n // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2\n // }\n }\n // Other cases: Tonelli-Shanks algorithm\n return tonelliShanks(P);\n}\nexports.FpSqrt = FpSqrt;\n// Little-endian check for first LE bit (last BE bit);\nconst isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;\nexports.isNegativeLE = isNegativeLE;\n// prettier-ignore\nconst FIELD_FIELDS = [\n 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n 'eql', 'add', 'sub', 'mul', 'pow', 'div',\n 'addN', 'subN', 'mulN', 'sqrN'\n];\nfunction validateField(field) {\n const initial = {\n ORDER: 'bigint',\n MASK: 'bigint',\n BYTES: 'isSafeInteger',\n BITS: 'isSafeInteger',\n };\n const opts = FIELD_FIELDS.reduce((map, val) => {\n map[val] = 'function';\n return map;\n }, initial);\n return (0, utils_js_1.validateObject)(field, opts);\n}\nexports.validateField = validateField;\n// Generic field functions\n/**\n * Same as `pow` but for Fp: non-constant-time.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n */\nfunction FpPow(f, num, power) {\n // Should have same speed as pow for bigints\n // TODO: benchmark!\n if (power < _0n)\n throw new Error('Expected power > 0');\n if (power === _0n)\n return f.ONE;\n if (power === _1n)\n return num;\n let p = f.ONE;\n let d = num;\n while (power > _0n) {\n if (power & _1n)\n p = f.mul(p, d);\n d = f.sqr(d);\n power >>= _1n;\n }\n return p;\n}\nexports.FpPow = FpPow;\n/**\n * Efficiently invert an array of Field elements.\n * `inv(0)` will return `undefined` here: make sure to throw an error.\n */\nfunction FpInvertBatch(f, nums) {\n const tmp = new Array(nums.length);\n // Walk from first to last, multiply them by each other MOD p\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = acc;\n return f.mul(acc, num);\n }, f.ONE);\n // Invert last element\n const inverted = f.inv(lastMultiplied);\n // Walk from last to first, multiply them by inverted each other MOD p\n nums.reduceRight((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = f.mul(acc, tmp[i]);\n return f.mul(acc, num);\n }, inverted);\n return tmp;\n}\nexports.FpInvertBatch = FpInvertBatch;\nfunction FpDiv(f, lhs, rhs) {\n return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs));\n}\nexports.FpDiv = FpDiv;\n// This function returns True whenever the value x is a square in the field F.\nfunction FpIsSquare(f) {\n const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic\n return (x) => {\n const p = f.pow(x, legendreConst);\n return f.eql(p, f.ZERO) || f.eql(p, f.ONE);\n };\n}\nexports.FpIsSquare = FpIsSquare;\n// CURVE.n lengths\nfunction nLength(n, nBitLength) {\n // Bit size, byte size of CURVE.n\n const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n const nByteLength = Math.ceil(_nBitLength / 8);\n return { nBitLength: _nBitLength, nByteLength };\n}\nexports.nLength = nLength;\n/**\n * Initializes a finite field over prime. **Non-primes are not supported.**\n * Do not init in loop: slow. Very fragile: always run a benchmark on a change.\n * Major performance optimizations:\n * * a) denormalized operations like mulN instead of mul\n * * b) same object shape: never add or remove keys\n * * c) Object.freeze\n * @param ORDER prime positive bigint\n * @param bitLen how many bits the field consumes\n * @param isLE (def: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nfunction Field(ORDER, bitLen, isLE = false, redef = {}) {\n if (ORDER <= _0n)\n throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);\n const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);\n if (BYTES > 2048)\n throw new Error('Field lengths over 2048 bytes are not supported');\n const sqrtP = FpSqrt(ORDER);\n const f = Object.freeze({\n ORDER,\n BITS,\n BYTES,\n MASK: (0, utils_js_1.bitMask)(BITS),\n ZERO: _0n,\n ONE: _1n,\n create: (num) => mod(num, ORDER),\n isValid: (num) => {\n if (typeof num !== 'bigint')\n throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);\n return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n },\n is0: (num) => num === _0n,\n isOdd: (num) => (num & _1n) === _1n,\n neg: (num) => mod(-num, ORDER),\n eql: (lhs, rhs) => lhs === rhs,\n sqr: (num) => mod(num * num, ORDER),\n add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n pow: (num, power) => FpPow(f, num, power),\n div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n // Same as above, but doesn't normalize\n sqrN: (num) => num * num,\n addN: (lhs, rhs) => lhs + rhs,\n subN: (lhs, rhs) => lhs - rhs,\n mulN: (lhs, rhs) => lhs * rhs,\n inv: (num) => invert(num, ORDER),\n sqrt: redef.sqrt || ((n) => sqrtP(f, n)),\n invertBatch: (lst) => FpInvertBatch(f, lst),\n // TODO: do we really need constant cmov?\n // We don't have const-time bigints anyway, so probably will be not very useful\n cmov: (a, b, c) => (c ? b : a),\n toBytes: (num) => (isLE ? (0, utils_js_1.numberToBytesLE)(num, BYTES) : (0, utils_js_1.numberToBytesBE)(num, BYTES)),\n fromBytes: (bytes) => {\n if (bytes.length !== BYTES)\n throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);\n return isLE ? (0, utils_js_1.bytesToNumberLE)(bytes) : (0, utils_js_1.bytesToNumberBE)(bytes);\n },\n });\n return Object.freeze(f);\n}\nexports.Field = Field;\nfunction FpSqrtOdd(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? root : Fp.neg(root);\n}\nexports.FpSqrtOdd = FpSqrtOdd;\nfunction FpSqrtEven(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\nexports.FpSqrtEven = FpSqrtEven;\n/**\n * \"Constant-time\" private key generation utility.\n * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).\n * Which makes it slightly more biased, less secure.\n * @deprecated use mapKeyToField instead\n */\nfunction hashToPrivateScalar(hash, groupOrder, isLE = false) {\n hash = (0, utils_js_1.ensureBytes)('privateHash', hash);\n const hashLen = hash.length;\n const minLen = nLength(groupOrder).nByteLength + 8;\n if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);\n const num = isLE ? (0, utils_js_1.bytesToNumberLE)(hash) : (0, utils_js_1.bytesToNumberBE)(hash);\n return mod(num, groupOrder - _1n) + _1n;\n}\nexports.hashToPrivateScalar = hashToPrivateScalar;\n/**\n * Returns total number of bytes consumed by the field element.\n * For example, 32 bytes for usual 256-bit weierstrass curve.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of field\n */\nfunction getFieldBytesLength(fieldOrder) {\n if (typeof fieldOrder !== 'bigint')\n throw new Error('field order must be bigint');\n const bitLength = fieldOrder.toString(2).length;\n return Math.ceil(bitLength / 8);\n}\nexports.getFieldBytesLength = getFieldBytesLength;\n/**\n * Returns minimal amount of bytes that can be safely reduced\n * by field order.\n * Should be 2^-128 for 128-bit curve such as P256.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of target hash\n */\nfunction getMinHashLength(fieldOrder) {\n const length = getFieldBytesLength(fieldOrder);\n return length + Math.ceil(length / 2);\n}\nexports.getMinHashLength = getMinHashLength;\n/**\n * \"Constant-time\" private key generation utility.\n * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 48 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final\n * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nfunction mapHashToField(key, fieldOrder, isLE = false) {\n const len = key.length;\n const fieldLen = getFieldBytesLength(fieldOrder);\n const minLen = getMinHashLength(fieldOrder);\n // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.\n if (len < 16 || len < minLen || len > 1024)\n throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);\n const num = isLE ? (0, utils_js_1.bytesToNumberBE)(key) : (0, utils_js_1.bytesToNumberLE)(key);\n // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n const reduced = mod(num, fieldOrder - _1n) + _1n;\n return isLE ? (0, utils_js_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_js_1.numberToBytesBE)(reduced, fieldLen);\n}\nexports.mapHashToField = mapHashToField;\n//# sourceMappingURL=modular.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/modular.js?")},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js":(__unused_webpack_module,exports)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateObject = exports.createHmacDrbg = exports.bitMask = exports.bitSet = exports.bitGet = exports.bitLen = exports.utf8ToBytes = exports.equalBytes = exports.concatBytes = exports.ensureBytes = exports.numberToVarBytesBE = exports.numberToBytesLE = exports.numberToBytesBE = exports.bytesToNumberLE = exports.bytesToNumberBE = exports.hexToBytes = exports.hexToNumber = exports.numberToHexUnpadded = exports.bytesToHex = void 0;\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// 100 lines of code in the file are duplicated from noble-hashes (utils).\n// This is OK: `abstract` directory does not use noble-hashes.\n// User may opt-in into using different hashing library. This way, noble-hashes\n// won't be included into their bundle.\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst u8a = (a) => a instanceof Uint8Array;\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\nexports.bytesToHex = bytesToHex;\nfunction numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\nexports.numberToHexUnpadded = numberToHexUnpadded;\nfunction hexToNumber(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // Big Endian\n return BigInt(hex === '' ? '0' : `0x${hex}`);\n}\nexports.hexToNumber = hexToNumber;\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\nexports.hexToBytes = hexToBytes;\n// BE: Big Endian, LE: Little Endian\nfunction bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nexports.bytesToNumberBE = bytesToNumberBE;\nfunction bytesToNumberLE(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));\n}\nexports.bytesToNumberLE = bytesToNumberLE;\nfunction numberToBytesBE(n, len) {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\nexports.numberToBytesBE = numberToBytesBE;\nfunction numberToBytesLE(n, len) {\n return numberToBytesBE(n, len).reverse();\n}\nexports.numberToBytesLE = numberToBytesLE;\n// Unpadded, rarely used\nfunction numberToVarBytesBE(n) {\n return hexToBytes(numberToHexUnpadded(n));\n}\nexports.numberToVarBytesBE = numberToVarBytesBE;\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'private key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nfunction ensureBytes(title, hex, expectedLength) {\n let res;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes(hex);\n }\n catch (e) {\n throw new Error(`${title} must be valid hex string, got \"${hex}\". Cause: ${e}`);\n }\n }\n else if (u8a(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n }\n else {\n throw new Error(`${title} must be hex string or Uint8Array`);\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);\n return res;\n}\nexports.ensureBytes = ensureBytes;\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\nexports.concatBytes = concatBytes;\nfunction equalBytes(b1, b2) {\n // We don't care about timing attacks here\n if (b1.length !== b2.length)\n return false;\n for (let i = 0; i < b1.length; i++)\n if (b1[i] !== b2[i])\n return false;\n return true;\n}\nexports.equalBytes = equalBytes;\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\nexports.utf8ToBytes = utf8ToBytes;\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n */\nfunction bitLen(n) {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1)\n ;\n return len;\n}\nexports.bitLen = bitLen;\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nfunction bitGet(n, pos) {\n return (n >> BigInt(pos)) & _1n;\n}\nexports.bitGet = bitGet;\n/**\n * Sets single bit at position.\n */\nconst bitSet = (n, pos, value) => {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n};\nexports.bitSet = bitSet;\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nconst bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;\nexports.bitMask = bitMask;\n// DRBG\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst u8fr = (arr) => Uint8Array.from(arr); // another shortcut\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nfunction createHmacDrbg(hashLen, qByteLen, hmacFn) {\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function')\n throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n()) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000)\n throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes(...out);\n };\n const genUntil = (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed();\n reset();\n return res;\n };\n return genUntil;\n}\nexports.createHmacDrbg = createHmacDrbg;\n// Validating curves and fields\nconst validatorFns = {\n bigint: (val) => typeof val === 'bigint',\n function: (val) => typeof val === 'function',\n boolean: (val) => typeof val === 'boolean',\n string: (val) => typeof val === 'string',\n stringOrUint8Array: (val) => typeof val === 'string' || val instanceof Uint8Array,\n isSafeInteger: (val) => Number.isSafeInteger(val),\n array: (val) => Array.isArray(val),\n field: (val, object) => object.Fp.isValid(val),\n hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n};\n// type Record = { [P in K]: T; }\nfunction validateObject(object, validators, optValidators = {}) {\n const checkField = (fieldName, type, isOptional) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function')\n throw new Error(`Invalid validator \"${type}\", expected function`);\n const val = object[fieldName];\n if (isOptional && val === undefined)\n return;\n if (!checkVal(val, object)) {\n throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);\n }\n };\n for (const [fieldName, type] of Object.entries(validators))\n checkField(fieldName, type, false);\n for (const [fieldName, type] of Object.entries(optValidators))\n checkField(fieldName, type, true);\n return object;\n}\nexports.validateObject = validateObject;\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js?")},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/weierstrass.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.mapToCurveSimpleSWU = exports.SWUFpSqrtRatio = exports.weierstrass = exports.weierstrassPoints = exports.DER = void 0;\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Short Weierstrass curve. The formula is: y² = x³ + ax + b\nconst mod = __webpack_require__(/*! ./modular.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/modular.js\");\nconst ut = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js\");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js\");\nconst curve_js_1 = __webpack_require__(/*! ./curve.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/curve.js\");\nfunction validatePointOpts(curve) {\n const opts = (0, curve_js_1.validateBasic)(curve);\n ut.validateObject(opts, {\n a: 'field',\n b: 'field',\n }, {\n allowedPrivateKeyLengths: 'array',\n wrapPrivateKey: 'boolean',\n isTorsionFree: 'function',\n clearCofactor: 'function',\n allowInfinityPoint: 'boolean',\n fromBytes: 'function',\n toBytes: 'function',\n });\n const { endo, Fp, a } = opts;\n if (endo) {\n if (!Fp.eql(a, Fp.ZERO)) {\n throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0');\n }\n if (typeof endo !== 'object' ||\n typeof endo.beta !== 'bigint' ||\n typeof endo.splitScalar !== 'function') {\n throw new Error('Expected endomorphism with beta: bigint and splitScalar: function');\n }\n }\n return Object.freeze({ ...opts });\n}\n// ASN.1 DER encoding utilities\nconst { bytesToNumberBE: b2n, hexToBytes: h2b } = ut;\nexports.DER = {\n // asn.1 DER encoding utils\n Err: class DERErr extends Error {\n constructor(m = '') {\n super(m);\n }\n },\n _parseInt(data) {\n const { Err: E } = exports.DER;\n if (data.length < 2 || data[0] !== 0x02)\n throw new E('Invalid signature integer tag');\n const len = data[1];\n const res = data.subarray(2, len + 2);\n if (!len || res.length !== len)\n throw new E('Invalid signature integer: wrong length');\n // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,\n // since we always use positive integers here. It must always be empty:\n // - add zero byte if exists\n // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)\n if (res[0] & 0b10000000)\n throw new E('Invalid signature integer: negative');\n if (res[0] === 0x00 && !(res[1] & 0b10000000))\n throw new E('Invalid signature integer: unnecessary leading zero');\n return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left\n },\n toSig(hex) {\n // parse DER signature\n const { Err: E } = exports.DER;\n const data = typeof hex === 'string' ? h2b(hex) : hex;\n if (!(data instanceof Uint8Array))\n throw new Error('ui8a expected');\n let l = data.length;\n if (l < 2 || data[0] != 0x30)\n throw new E('Invalid signature tag');\n if (data[1] !== l - 2)\n throw new E('Invalid signature: incorrect length');\n const { d: r, l: sBytes } = exports.DER._parseInt(data.subarray(2));\n const { d: s, l: rBytesLeft } = exports.DER._parseInt(sBytes);\n if (rBytesLeft.length)\n throw new E('Invalid signature: left bytes after parsing');\n return { r, s };\n },\n hexFromSig(sig) {\n // Add leading zero if first byte has negative bit enabled. More details in '_parseInt'\n const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s);\n const h = (num) => {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n };\n const s = slice(h(sig.s));\n const r = slice(h(sig.r));\n const shl = s.length / 2;\n const rhl = r.length / 2;\n const sl = h(shl);\n const rl = h(rhl);\n return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;\n },\n};\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);\nfunction weierstrassPoints(opts) {\n const CURVE = validatePointOpts(opts);\n const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ\n const toBytes = CURVE.toBytes ||\n ((_c, point, _isCompressed) => {\n const a = point.toAffine();\n return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y));\n });\n const fromBytes = CURVE.fromBytes ||\n ((bytes) => {\n // const head = bytes[0];\n const tail = bytes.subarray(1);\n // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported');\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n });\n /**\n * y² = x³ + ax + b: Short weierstrass curve formula\n * @returns y²\n */\n function weierstrassEquation(x) {\n const { a, b } = CURVE;\n const x2 = Fp.sqr(x); // x * x\n const x3 = Fp.mul(x2, x); // x2 * x\n return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b\n }\n // Validate whether the passed curve params are valid.\n // We check if curve equation works for generator point.\n // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381.\n // ProjectivePoint class has not been initialized yet.\n if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))\n throw new Error('bad generator point: equation left != right');\n // Valid group elements reside in range 1..n-1\n function isWithinCurveOrder(num) {\n return typeof num === 'bigint' && _0n < num && num < CURVE.n;\n }\n function assertGE(num) {\n if (!isWithinCurveOrder(num))\n throw new Error('Expected valid bigint: 0 < bigint < curve.n');\n }\n // Validates if priv key is valid and converts it to bigint.\n // Supports options allowedPrivateKeyLengths and wrapPrivateKey.\n function normPrivateKeyToScalar(key) {\n const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;\n if (lengths && typeof key !== 'bigint') {\n if (key instanceof Uint8Array)\n key = ut.bytesToHex(key);\n // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes\n if (typeof key !== 'string' || !lengths.includes(key.length))\n throw new Error('Invalid key');\n key = key.padStart(nByteLength * 2, '0');\n }\n let num;\n try {\n num =\n typeof key === 'bigint'\n ? key\n : ut.bytesToNumberBE((0, utils_js_1.ensureBytes)('private key', key, nByteLength));\n }\n catch (error) {\n throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);\n }\n if (wrapPrivateKey)\n num = mod.mod(num, n); // disabled by default, enabled for BLS\n assertGE(num); // num in range [1..N-1]\n return num;\n }\n const pointPrecomputes = new Map();\n function assertPrjPoint(other) {\n if (!(other instanceof Point))\n throw new Error('ProjectivePoint expected');\n }\n /**\n * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)\n * Default Point works in 2d / affine coordinates: (x, y)\n * We're doing calculations in projective, because its operations don't require costly inversion.\n */\n class Point {\n constructor(px, py, pz) {\n this.px = px;\n this.py = py;\n this.pz = pz;\n if (px == null || !Fp.isValid(px))\n throw new Error('x required');\n if (py == null || !Fp.isValid(py))\n throw new Error('y required');\n if (pz == null || !Fp.isValid(pz))\n throw new Error('z required');\n }\n // Does not validate if the point is on-curve.\n // Use fromHex instead, or call assertValidity() later.\n static fromAffine(p) {\n const { x, y } = p || {};\n if (!p || !Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('invalid affine point');\n if (p instanceof Point)\n throw new Error('projective point not allowed');\n const is0 = (i) => Fp.eql(i, Fp.ZERO);\n // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0)\n if (is0(x) && is0(y))\n return Point.ZERO;\n return new Point(x, y, Fp.ONE);\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n /**\n * Takes a bunch of Projective Points but executes only one\n * inversion on all of them. Inversion is very slow operation,\n * so this improves performance massively.\n * Optimization: converts a list of projective points to a list of identical points with Z=1.\n */\n static normalizeZ(points) {\n const toInv = Fp.invertBatch(points.map((p) => p.pz));\n return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n }\n /**\n * Converts hash string or Uint8Array to Point.\n * @param hex short/long ECDSA hex\n */\n static fromHex(hex) {\n const P = Point.fromAffine(fromBytes((0, utils_js_1.ensureBytes)('pointHex', hex)));\n P.assertValidity();\n return P;\n }\n // Multiplies generator point by privateKey.\n static fromPrivateKey(privateKey) {\n return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));\n }\n // \"Private method\", don't use it directly\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n // A point on curve is valid if it conforms to equation.\n assertValidity() {\n if (this.is0()) {\n // (0, 1, 0) aka ZERO is invalid in most contexts.\n // In BLS, ZERO can be serialized, so we allow it.\n // (0, 0, 0) is wrong representation of ZERO and is always invalid.\n if (CURVE.allowInfinityPoint && !Fp.is0(this.py))\n return;\n throw new Error('bad point: ZERO');\n }\n // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`\n const { x, y } = this.toAffine();\n // Check if x, y are valid field elements\n if (!Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('bad point: x or y not FE');\n const left = Fp.sqr(y); // y²\n const right = weierstrassEquation(x); // x³ + ax + b\n if (!Fp.eql(left, right))\n throw new Error('bad point: equation left != right');\n if (!this.isTorsionFree())\n throw new Error('bad point: not in prime-order subgroup');\n }\n hasEvenY() {\n const { y } = this.toAffine();\n if (Fp.isOdd)\n return !Fp.isOdd(y);\n throw new Error(\"Field doesn't support isOdd\");\n }\n /**\n * Compare one point to another.\n */\n equals(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));\n const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));\n return U1 && U2;\n }\n /**\n * Flips point to one corresponding to (x, -y) in Affine coordinates.\n */\n negate() {\n return new Point(this.px, Fp.neg(this.py), this.pz);\n }\n // Renes-Costello-Batina exception-free doubling formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 3\n // Cost: 8M + 3S + 3*a + 2*b3 + 15add.\n double() {\n const { a, b } = CURVE;\n const b3 = Fp.mul(b, _3n);\n const { px: X1, py: Y1, pz: Z1 } = this;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n let t0 = Fp.mul(X1, X1); // step 1\n let t1 = Fp.mul(Y1, Y1);\n let t2 = Fp.mul(Z1, Z1);\n let t3 = Fp.mul(X1, Y1);\n t3 = Fp.add(t3, t3); // step 5\n Z3 = Fp.mul(X1, Z1);\n Z3 = Fp.add(Z3, Z3);\n X3 = Fp.mul(a, Z3);\n Y3 = Fp.mul(b3, t2);\n Y3 = Fp.add(X3, Y3); // step 10\n X3 = Fp.sub(t1, Y3);\n Y3 = Fp.add(t1, Y3);\n Y3 = Fp.mul(X3, Y3);\n X3 = Fp.mul(t3, X3);\n Z3 = Fp.mul(b3, Z3); // step 15\n t2 = Fp.mul(a, t2);\n t3 = Fp.sub(t0, t2);\n t3 = Fp.mul(a, t3);\n t3 = Fp.add(t3, Z3);\n Z3 = Fp.add(t0, t0); // step 20\n t0 = Fp.add(Z3, t0);\n t0 = Fp.add(t0, t2);\n t0 = Fp.mul(t0, t3);\n Y3 = Fp.add(Y3, t0);\n t2 = Fp.mul(Y1, Z1); // step 25\n t2 = Fp.add(t2, t2);\n t0 = Fp.mul(t2, t3);\n X3 = Fp.sub(X3, t0);\n Z3 = Fp.mul(t2, t1);\n Z3 = Fp.add(Z3, Z3); // step 30\n Z3 = Fp.add(Z3, Z3);\n return new Point(X3, Y3, Z3);\n }\n // Renes-Costello-Batina exception-free addition formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 1\n // Cost: 12M + 0S + 3*a + 3*b3 + 23add.\n add(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n const a = CURVE.a;\n const b3 = Fp.mul(CURVE.b, _3n);\n let t0 = Fp.mul(X1, X2); // step 1\n let t1 = Fp.mul(Y1, Y2);\n let t2 = Fp.mul(Z1, Z2);\n let t3 = Fp.add(X1, Y1);\n let t4 = Fp.add(X2, Y2); // step 5\n t3 = Fp.mul(t3, t4);\n t4 = Fp.add(t0, t1);\n t3 = Fp.sub(t3, t4);\n t4 = Fp.add(X1, Z1);\n let t5 = Fp.add(X2, Z2); // step 10\n t4 = Fp.mul(t4, t5);\n t5 = Fp.add(t0, t2);\n t4 = Fp.sub(t4, t5);\n t5 = Fp.add(Y1, Z1);\n X3 = Fp.add(Y2, Z2); // step 15\n t5 = Fp.mul(t5, X3);\n X3 = Fp.add(t1, t2);\n t5 = Fp.sub(t5, X3);\n Z3 = Fp.mul(a, t4);\n X3 = Fp.mul(b3, t2); // step 20\n Z3 = Fp.add(X3, Z3);\n X3 = Fp.sub(t1, Z3);\n Z3 = Fp.add(t1, Z3);\n Y3 = Fp.mul(X3, Z3);\n t1 = Fp.add(t0, t0); // step 25\n t1 = Fp.add(t1, t0);\n t2 = Fp.mul(a, t2);\n t4 = Fp.mul(b3, t4);\n t1 = Fp.add(t1, t2);\n t2 = Fp.sub(t0, t2); // step 30\n t2 = Fp.mul(a, t2);\n t4 = Fp.add(t4, t2);\n t0 = Fp.mul(t1, t4);\n Y3 = Fp.add(Y3, t0);\n t0 = Fp.mul(t5, t4); // step 35\n X3 = Fp.mul(t3, X3);\n X3 = Fp.sub(X3, t0);\n t0 = Fp.mul(t3, t1);\n Z3 = Fp.mul(t5, Z3);\n Z3 = Fp.add(Z3, t0); // step 40\n return new Point(X3, Y3, Z3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n wNAF(n) {\n return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => {\n const toInv = Fp.invertBatch(comp.map((p) => p.pz));\n return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n });\n }\n /**\n * Non-constant-time multiplication. Uses double-and-add algorithm.\n * It's faster, but should only be used when you don't care about\n * an exposed private key e.g. sig verification, which works over *public* keys.\n */\n multiplyUnsafe(n) {\n const I = Point.ZERO;\n if (n === _0n)\n return I;\n assertGE(n); // Will throw on 0\n if (n === _1n)\n return this;\n const { endo } = CURVE;\n if (!endo)\n return wnaf.unsafeLadder(this, n);\n // Apply endomorphism\n let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let k1p = I;\n let k2p = I;\n let d = this;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n)\n k1p = k1p.add(d);\n if (k2 & _1n)\n k2p = k2p.add(d);\n d = d.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n if (k1neg)\n k1p = k1p.negate();\n if (k2neg)\n k2p = k2p.negate();\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n return k1p.add(k2p);\n }\n /**\n * Constant time multiplication.\n * Uses wNAF method. Windowed method may be 10% faster,\n * but takes 2x longer to generate and consumes 2x memory.\n * Uses precomputes when available.\n * Uses endomorphism for Koblitz curves.\n * @param scalar by which the point would be multiplied\n * @returns New point\n */\n multiply(scalar) {\n assertGE(scalar);\n let n = scalar;\n let point, fake; // Fake point is used to const-time mult\n const { endo } = CURVE;\n if (endo) {\n const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let { p: k1p, f: f1p } = this.wNAF(k1);\n let { p: k2p, f: f2p } = this.wNAF(k2);\n k1p = wnaf.constTimeNegate(k1neg, k1p);\n k2p = wnaf.constTimeNegate(k2neg, k2p);\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n point = k1p.add(k2p);\n fake = f1p.add(f2p);\n }\n else {\n const { p, f } = this.wNAF(n);\n point = p;\n fake = f;\n }\n // Normalize `z` for both points, but return only real one\n return Point.normalizeZ([point, fake])[0];\n }\n /**\n * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.\n * Not using Strauss-Shamir trick: precomputation tables are faster.\n * The trick could be useful if both P and Q are not G (not in our case).\n * @returns non-zero affine point\n */\n multiplyAndAddUnsafe(Q, a, b) {\n const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes\n const mul = (P, a // Select faster multiply() method\n ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));\n const sum = mul(this, a).add(mul(Q, b));\n return sum.is0() ? undefined : sum;\n }\n // Converts Projective point to affine (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n // (x, y, z) ∋ (x=x/z, y=y/z)\n toAffine(iz) {\n const { px: x, py: y, pz: z } = this;\n const is0 = this.is0();\n // If invZ was 0, we return zero point. However we still want to execute\n // all operations, so we replace invZ with a random number, 1.\n if (iz == null)\n iz = is0 ? Fp.ONE : Fp.inv(z);\n const ax = Fp.mul(x, iz);\n const ay = Fp.mul(y, iz);\n const zz = Fp.mul(z, iz);\n if (is0)\n return { x: Fp.ZERO, y: Fp.ZERO };\n if (!Fp.eql(zz, Fp.ONE))\n throw new Error('invZ was invalid');\n return { x: ax, y: ay };\n }\n isTorsionFree() {\n const { h: cofactor, isTorsionFree } = CURVE;\n if (cofactor === _1n)\n return true; // No subgroups, always torsion-free\n if (isTorsionFree)\n return isTorsionFree(Point, this);\n throw new Error('isTorsionFree() has not been declared for the elliptic curve');\n }\n clearCofactor() {\n const { h: cofactor, clearCofactor } = CURVE;\n if (cofactor === _1n)\n return this; // Fast-path\n if (clearCofactor)\n return clearCofactor(Point, this);\n return this.multiplyUnsafe(CURVE.h);\n }\n toRawBytes(isCompressed = true) {\n this.assertValidity();\n return toBytes(Point, this, isCompressed);\n }\n toHex(isCompressed = true) {\n return ut.bytesToHex(this.toRawBytes(isCompressed));\n }\n }\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);\n Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);\n const _bits = CURVE.nBitLength;\n const wnaf = (0, curve_js_1.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);\n // Validate if generator point is on curve\n return {\n CURVE,\n ProjectivePoint: Point,\n normPrivateKeyToScalar,\n weierstrassEquation,\n isWithinCurveOrder,\n };\n}\nexports.weierstrassPoints = weierstrassPoints;\nfunction validateOpts(curve) {\n const opts = (0, curve_js_1.validateBasic)(curve);\n ut.validateObject(opts, {\n hash: 'hash',\n hmac: 'function',\n randomBytes: 'function',\n }, {\n bits2int: 'function',\n bits2int_modN: 'function',\n lowS: 'boolean',\n });\n return Object.freeze({ lowS: true, ...opts });\n}\nfunction weierstrass(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { Fp, n: CURVE_ORDER } = CURVE;\n const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32\n const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32\n function isValidFieldElement(num) {\n return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE\n }\n function modN(a) {\n return mod.mod(a, CURVE_ORDER);\n }\n function invN(a) {\n return mod.invert(a, CURVE_ORDER);\n }\n const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({\n ...CURVE,\n toBytes(_c, point, isCompressed) {\n const a = point.toAffine();\n const x = Fp.toBytes(a.x);\n const cat = ut.concatBytes;\n if (isCompressed) {\n return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x);\n }\n else {\n return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y));\n }\n },\n fromBytes(bytes) {\n const len = bytes.length;\n const head = bytes[0];\n const tail = bytes.subarray(1);\n // this.assertValidity() is done inside of fromHex\n if (len === compressedLen && (head === 0x02 || head === 0x03)) {\n const x = ut.bytesToNumberBE(tail);\n if (!isValidFieldElement(x))\n throw new Error('Point is not on curve');\n const y2 = weierstrassEquation(x); // y² = x³ + ax + b\n let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4\n const isYOdd = (y & _1n) === _1n;\n // ECDSA\n const isHeadOdd = (head & 1) === 1;\n if (isHeadOdd !== isYOdd)\n y = Fp.neg(y);\n return { x, y };\n }\n else if (len === uncompressedLen && head === 0x04) {\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n }\n else {\n throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`);\n }\n },\n });\n const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength));\n function isBiggerThanHalfOrder(number) {\n const HALF = CURVE_ORDER >> _1n;\n return number > HALF;\n }\n function normalizeS(s) {\n return isBiggerThanHalfOrder(s) ? modN(-s) : s;\n }\n // slice bytes num\n const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to));\n /**\n * ECDSA signature with its (r, s) properties. Supports DER & compact representations.\n */\n class Signature {\n constructor(r, s, recovery) {\n this.r = r;\n this.s = s;\n this.recovery = recovery;\n this.assertValidity();\n }\n // pair (bytes of r, bytes of s)\n static fromCompact(hex) {\n const l = CURVE.nByteLength;\n hex = (0, utils_js_1.ensureBytes)('compactSignature', hex, l * 2);\n return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));\n }\n // DER encoded ECDSA signature\n // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script\n static fromDER(hex) {\n const { r, s } = exports.DER.toSig((0, utils_js_1.ensureBytes)('DER', hex));\n return new Signature(r, s);\n }\n assertValidity() {\n // can use assertGE here\n if (!isWithinCurveOrder(this.r))\n throw new Error('r must be 0 < r < CURVE.n');\n if (!isWithinCurveOrder(this.s))\n throw new Error('s must be 0 < s < CURVE.n');\n }\n addRecoveryBit(recovery) {\n return new Signature(this.r, this.s, recovery);\n }\n recoverPublicKey(msgHash) {\n const { r, s, recovery: rec } = this;\n const h = bits2int_modN((0, utils_js_1.ensureBytes)('msgHash', msgHash)); // Truncate hash\n if (rec == null || ![0, 1, 2, 3].includes(rec))\n throw new Error('recovery id invalid');\n const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;\n if (radj >= Fp.ORDER)\n throw new Error('recovery id 2 or 3 invalid');\n const prefix = (rec & 1) === 0 ? '02' : '03';\n const R = Point.fromHex(prefix + numToNByteStr(radj));\n const ir = invN(radj); // r^-1\n const u1 = modN(-h * ir); // -hr^-1\n const u2 = modN(s * ir); // sr^-1\n const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1)\n if (!Q)\n throw new Error('point at infinify'); // unsafe is fine: no priv data leaked\n Q.assertValidity();\n return Q;\n }\n // Signatures should be low-s, to prevent malleability.\n hasHighS() {\n return isBiggerThanHalfOrder(this.s);\n }\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;\n }\n // DER-encoded\n toDERRawBytes() {\n return ut.hexToBytes(this.toDERHex());\n }\n toDERHex() {\n return exports.DER.hexFromSig({ r: this.r, s: this.s });\n }\n // padded bytes of r, then padded bytes of s\n toCompactRawBytes() {\n return ut.hexToBytes(this.toCompactHex());\n }\n toCompactHex() {\n return numToNByteStr(this.r) + numToNByteStr(this.s);\n }\n }\n const utils = {\n isValidPrivateKey(privateKey) {\n try {\n normPrivateKeyToScalar(privateKey);\n return true;\n }\n catch (error) {\n return false;\n }\n },\n normPrivateKeyToScalar: normPrivateKeyToScalar,\n /**\n * Produces cryptographically secure private key from random of size\n * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.\n */\n randomPrivateKey: () => {\n const length = mod.getMinHashLength(CURVE.n);\n return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);\n },\n /**\n * Creates precompute table for an arbitrary EC point. Makes point \"cached\".\n * Allows to massively speed-up `point.multiply(scalar)`.\n * @returns cached point\n * @example\n * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));\n * fast.multiply(privKey); // much faster ECDH now\n */\n precompute(windowSize = 8, point = Point.BASE) {\n point._setWindowSize(windowSize);\n point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here\n return point;\n },\n };\n /**\n * Computes public key for a private key. Checks for validity of the private key.\n * @param privateKey private key\n * @param isCompressed whether to return compact (default), or full key\n * @returns Public key, full when isCompressed=false; short when isCompressed=true\n */\n function getPublicKey(privateKey, isCompressed = true) {\n return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);\n }\n /**\n * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.\n */\n function isProbPub(item) {\n const arr = item instanceof Uint8Array;\n const str = typeof item === 'string';\n const len = (arr || str) && item.length;\n if (arr)\n return len === compressedLen || len === uncompressedLen;\n if (str)\n return len === 2 * compressedLen || len === 2 * uncompressedLen;\n if (item instanceof Point)\n return true;\n return false;\n }\n /**\n * ECDH (Elliptic Curve Diffie Hellman).\n * Computes shared public key from private key and public key.\n * Checks: 1) private key validity 2) shared key is on-curve.\n * Does NOT hash the result.\n * @param privateA private key\n * @param publicB different public key\n * @param isCompressed whether to return compact (default), or full key\n * @returns shared public key\n */\n function getSharedSecret(privateA, publicB, isCompressed = true) {\n if (isProbPub(privateA))\n throw new Error('first arg must be private key');\n if (!isProbPub(publicB))\n throw new Error('second arg must be public key');\n const b = Point.fromHex(publicB); // check for being on-curve\n return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);\n }\n // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.\n // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.\n // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.\n // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors\n const bits2int = CURVE.bits2int ||\n function (bytes) {\n // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)\n // for some cases, since bytes.length * 8 is not actual bitLength.\n const num = ut.bytesToNumberBE(bytes); // check for == u8 done here\n const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits\n return delta > 0 ? num >> BigInt(delta) : num;\n };\n const bits2int_modN = CURVE.bits2int_modN ||\n function (bytes) {\n return modN(bits2int(bytes)); // can't use bytesToNumberBE here\n };\n // NOTE: pads output with zero as per spec\n const ORDER_MASK = ut.bitMask(CURVE.nBitLength);\n /**\n * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.\n */\n function int2octets(num) {\n if (typeof num !== 'bigint')\n throw new Error('bigint expected');\n if (!(_0n <= num && num < ORDER_MASK))\n throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);\n // works with order, can have different size than numToField!\n return ut.numberToBytesBE(num, CURVE.nByteLength);\n }\n // Steps A, D of RFC6979 3.2\n // Creates RFC6979 seed; converts msg/privKey to numbers.\n // Used only in sign, not in verify.\n // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521.\n // Also it can be bigger for P224 + SHA256\n function prepSig(msgHash, privateKey, opts = defaultSigOpts) {\n if (['recovered', 'canonical'].some((k) => k in opts))\n throw new Error('sign() legacy options not supported');\n const { hash, randomBytes } = CURVE;\n let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default\n if (lowS == null)\n lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash\n msgHash = (0, utils_js_1.ensureBytes)('msgHash', msgHash);\n if (prehash)\n msgHash = (0, utils_js_1.ensureBytes)('prehashed msgHash', hash(msgHash));\n // We can't later call bits2octets, since nested bits2int is broken for curves\n // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call.\n // const bits2octets = (bits) => int2octets(bits2int_modN(bits))\n const h1int = bits2int_modN(msgHash);\n const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint\n const seedArgs = [int2octets(d), int2octets(h1int)];\n // extraEntropy. RFC6979 3.6: additional k' (optional).\n if (ent != null) {\n // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is\n seedArgs.push((0, utils_js_1.ensureBytes)('extraEntropy', e)); // check for being bytes\n }\n const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2\n const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!\n // Converts signature params into point w r/s, checks result for validity.\n function k2sig(kBytes) {\n // RFC 6979 Section 3.2, step 3: k = bits2int(T)\n const k = bits2int(kBytes); // Cannot use fields methods, since it is group element\n if (!isWithinCurveOrder(k))\n return; // Important: all mod() calls here must be done over N\n const ik = invN(k); // k^-1 mod n\n const q = Point.BASE.multiply(k).toAffine(); // q = Gk\n const r = modN(q.x); // r = q.x mod n\n if (r === _0n)\n return;\n // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to\n // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:\n // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT\n const s = modN(ik * modN(m + r * d)); // Not using blinding here\n if (s === _0n)\n return;\n let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)\n let normS = s;\n if (lowS && isBiggerThanHalfOrder(s)) {\n normS = normalizeS(s); // if lowS was passed, ensure s is always\n recovery ^= 1; // // in the bottom half of N\n }\n return new Signature(r, normS, recovery); // use normS, not s\n }\n return { seed, k2sig };\n }\n const defaultSigOpts = { lowS: CURVE.lowS, prehash: false };\n const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };\n /**\n * Signs message hash with a private key.\n * ```\n * sign(m, d, k) where\n * (x, y) = G × k\n * r = x mod n\n * s = (m + dr)/k mod n\n * ```\n * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`.\n * @param privKey private key\n * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg.\n * @returns signature with recovery param\n */\n function sign(msgHash, privKey, opts = defaultSigOpts) {\n const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2.\n const C = CURVE;\n const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);\n return drbg(seed, k2sig); // Steps B, C, D, E, F, G\n }\n // Enable precomputes. Slows down first publicKey computation by 20ms.\n Point.BASE._setWindowSize(8);\n // utils.precompute(8, ProjectivePoint.BASE)\n /**\n * Verifies a signature against message hash and public key.\n * Rejects lowS signatures by default: to override,\n * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:\n *\n * ```\n * verify(r, s, h, P) where\n * U1 = hs^-1 mod n\n * U2 = rs^-1 mod n\n * R = U1⋅G - U2⋅P\n * mod(R.x, n) == r\n * ```\n */\n function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {\n const sg = signature;\n msgHash = (0, utils_js_1.ensureBytes)('msgHash', msgHash);\n publicKey = (0, utils_js_1.ensureBytes)('publicKey', publicKey);\n if ('strict' in opts)\n throw new Error('options.strict was renamed to lowS');\n const { lowS, prehash } = opts;\n let _sig = undefined;\n let P;\n try {\n if (typeof sg === 'string' || sg instanceof Uint8Array) {\n // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length).\n // Since DER can also be 2*nByteLength bytes, we check for it first.\n try {\n _sig = Signature.fromDER(sg);\n }\n catch (derError) {\n if (!(derError instanceof exports.DER.Err))\n throw derError;\n _sig = Signature.fromCompact(sg);\n }\n }\n else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') {\n const { r, s } = sg;\n _sig = new Signature(r, s);\n }\n else {\n throw new Error('PARSE');\n }\n P = Point.fromHex(publicKey);\n }\n catch (error) {\n if (error.message === 'PARSE')\n throw new Error(`signature must be Signature instance, Uint8Array or hex string`);\n return false;\n }\n if (lowS && _sig.hasHighS())\n return false;\n if (prehash)\n msgHash = CURVE.hash(msgHash);\n const { r, s } = _sig;\n const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element\n const is = invN(s); // s^-1\n const u1 = modN(h * is); // u1 = hs^-1 mod n\n const u2 = modN(r * is); // u2 = rs^-1 mod n\n const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P\n if (!R)\n return false;\n const v = modN(R.x);\n return v === r;\n }\n return {\n CURVE,\n getPublicKey,\n getSharedSecret,\n sign,\n verify,\n ProjectivePoint: Point,\n Signature,\n utils,\n };\n}\nexports.weierstrass = weierstrass;\n/**\n * Implementation of the Shallue and van de Woestijne method for any weierstrass curve.\n * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.\n * b = True and y = sqrt(u / v) if (u / v) is square in F, and\n * b = False and y = sqrt(Z * (u / v)) otherwise.\n * @param Fp\n * @param Z\n * @returns\n */\nfunction SWUFpSqrtRatio(Fp, Z) {\n // Generic implementation\n const q = Fp.ORDER;\n let l = _0n;\n for (let o = q - _1n; o % _2n === _0n; o /= _2n)\n l += _1n;\n const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.\n // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.\n // 2n ** c1 == 2n << (c1-1)\n const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);\n const _2n_pow_c1 = _2n_pow_c1_1 * _2n;\n const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic\n const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic\n const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic\n const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic\n const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2\n const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)\n let sqrtRatio = (u, v) => {\n let tv1 = c6; // 1. tv1 = c6\n let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4\n let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2\n tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v\n let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3\n tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3\n tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2\n tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v\n tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u\n let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2\n tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5\n let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1\n tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7\n tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)\n tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)\n // 17. for i in (c1, c1 - 1, ..., 2):\n for (let i = c1; i > _1n; i--) {\n let tv5 = i - _2n; // 18. tv5 = i - 2\n tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5\n let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5\n const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1\n tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1\n tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1\n tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1)\n tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1)\n }\n return { isValid: isQR, value: tv3 };\n };\n if (Fp.ORDER % _4n === _3n) {\n // sqrt_ratio_3mod4(u, v)\n const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic\n const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)\n sqrtRatio = (u, v) => {\n let tv1 = Fp.sqr(v); // 1. tv1 = v^2\n const tv2 = Fp.mul(u, v); // 2. tv2 = u * v\n tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2\n let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1\n y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2\n const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2\n const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v\n const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u\n let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)\n return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2\n };\n }\n // No curves uses that\n // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8\n return sqrtRatio;\n}\nexports.SWUFpSqrtRatio = SWUFpSqrtRatio;\n/**\n * Simplified Shallue-van de Woestijne-Ulas Method\n * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2\n */\nfunction mapToCurveSimpleSWU(Fp, opts) {\n mod.validateField(Fp);\n if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))\n throw new Error('mapToCurveSimpleSWU: invalid opts');\n const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);\n if (!Fp.isOdd)\n throw new Error('Fp.isOdd is not implemented!');\n // Input: u, an element of F.\n // Output: (x, y), a point on E.\n return (u) => {\n // prettier-ignore\n let tv1, tv2, tv3, tv4, tv5, tv6, x, y;\n tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1\n tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2\n tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1\n tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1\n tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3\n tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0)\n tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4\n tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2\n tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2\n tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6\n tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5\n tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3\n tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4\n tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6\n tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5\n x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3\n const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)\n y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1\n y = Fp.mul(y, value); // 20. y = y * y1\n x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square)\n y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square)\n const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y)\n y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1)\n x = Fp.div(x, tv4); // 25. x = x / tv4\n return { x, y };\n };\n}\nexports.mapToCurveSimpleSWU = mapToCurveSimpleSWU;\n//# sourceMappingURL=weierstrass.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/weierstrass.js?")},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/secp256k1.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.encodeToCurve = exports.hashToCurve = exports.schnorr = exports.secp256k1 = void 0;\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nconst sha256_1 = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/sha256.js\");\nconst utils_1 = __webpack_require__(/*! @noble/hashes/utils */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js\");\nconst modular_js_1 = __webpack_require__(/*! ./abstract/modular.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/modular.js\");\nconst weierstrass_js_1 = __webpack_require__(/*! ./abstract/weierstrass.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/weierstrass.js\");\nconst utils_js_1 = __webpack_require__(/*! ./abstract/utils.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js\");\nconst hash_to_curve_js_1 = __webpack_require__(/*! ./abstract/hash-to-curve.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/hash-to-curve.js\");\nconst _shortw_utils_js_1 = __webpack_require__(/*! ./_shortw_utils.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/_shortw_utils.js\");\nconst secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');\nconst secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst divNearest = (a, b) => (a + b / _2n) / b;\n/**\n * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit.\n * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00]\n */\nfunction sqrtMod(y) {\n const P = secp256k1P;\n // prettier-ignore\n const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);\n // prettier-ignore\n const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);\n const b2 = (y * y * y) % P; // x^3, 11\n const b3 = (b2 * b2 * y) % P; // x^7\n const b6 = ((0, modular_js_1.pow2)(b3, _3n, P) * b3) % P;\n const b9 = ((0, modular_js_1.pow2)(b6, _3n, P) * b3) % P;\n const b11 = ((0, modular_js_1.pow2)(b9, _2n, P) * b2) % P;\n const b22 = ((0, modular_js_1.pow2)(b11, _11n, P) * b11) % P;\n const b44 = ((0, modular_js_1.pow2)(b22, _22n, P) * b22) % P;\n const b88 = ((0, modular_js_1.pow2)(b44, _44n, P) * b44) % P;\n const b176 = ((0, modular_js_1.pow2)(b88, _88n, P) * b88) % P;\n const b220 = ((0, modular_js_1.pow2)(b176, _44n, P) * b44) % P;\n const b223 = ((0, modular_js_1.pow2)(b220, _3n, P) * b3) % P;\n const t1 = ((0, modular_js_1.pow2)(b223, _23n, P) * b22) % P;\n const t2 = ((0, modular_js_1.pow2)(t1, _6n, P) * b2) % P;\n const root = (0, modular_js_1.pow2)(t2, _2n, P);\n if (!Fp.eql(Fp.sqr(root), y))\n throw new Error('Cannot find square root');\n return root;\n}\nconst Fp = (0, modular_js_1.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod });\nexports.secp256k1 = (0, _shortw_utils_js_1.createCurve)({\n a: BigInt(0),\n b: BigInt(7),\n Fp,\n n: secp256k1N,\n // Base point (x, y) aka generator point\n Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),\n Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),\n h: BigInt(1),\n lowS: true,\n /**\n * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism.\n * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%.\n * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit.\n * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066\n */\n endo: {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n splitScalar: (k) => {\n const n = secp256k1N;\n const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15');\n const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3');\n const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8');\n const b2 = a1;\n const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16)\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n let k1 = (0, modular_js_1.mod)(k - c1 * a1 - c2 * a2, n);\n let k2 = (0, modular_js_1.mod)(-c1 * b1 - c2 * b2, n);\n const k1neg = k1 > POW_2_128;\n const k2neg = k2 > POW_2_128;\n if (k1neg)\n k1 = n - k1;\n if (k2neg)\n k2 = n - k2;\n if (k1 > POW_2_128 || k2 > POW_2_128) {\n throw new Error('splitScalar: Endomorphism failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n },\n },\n}, sha256_1.sha256);\n// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.\n// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki\nconst _0n = BigInt(0);\nconst fe = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1P;\nconst ge = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1N;\n/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */\nconst TAGGED_HASH_PREFIXES = {};\nfunction taggedHash(tag, ...messages) {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = (0, sha256_1.sha256)(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = (0, utils_js_1.concatBytes)(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return (0, sha256_1.sha256)((0, utils_js_1.concatBytes)(tagP, ...messages));\n}\n// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03\nconst pointToBytes = (point) => point.toRawBytes(true).slice(1);\nconst numTo32b = (n) => (0, utils_js_1.numberToBytesBE)(n, 32);\nconst modP = (x) => (0, modular_js_1.mod)(x, secp256k1P);\nconst modN = (x) => (0, modular_js_1.mod)(x, secp256k1N);\nconst Point = exports.secp256k1.ProjectivePoint;\nconst GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b);\n// Calculate point, scalar and bytes\nfunction schnorrGetExtPubKey(priv) {\n let d_ = exports.secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey\n let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside\n const scalar = p.hasEvenY() ? d_ : modN(-d_);\n return { scalar: scalar, bytes: pointToBytes(p) };\n}\n/**\n * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point.\n * @returns valid point checked for being on-curve\n */\nfunction lift_x(x) {\n if (!fe(x))\n throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p.\n const xx = modP(x * x);\n const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p.\n let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p.\n if (y % _2n !== _0n)\n y = modP(-y); // Return the unique point P such that x(P) = x and\n const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise.\n p.assertValidity();\n return p;\n}\n/**\n * Create tagged hash, convert it to bigint, reduce modulo-n.\n */\nfunction challenge(...args) {\n return modN((0, utils_js_1.bytesToNumberBE)(taggedHash('BIP0340/challenge', ...args)));\n}\n/**\n * Schnorr public key is just `x` coordinate of Point as per BIP340.\n */\nfunction schnorrGetPublicKey(privateKey) {\n return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G)\n}\n/**\n * Creates Schnorr signature as per BIP340. Verifies itself before returning anything.\n * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.\n */\nfunction schnorrSign(message, privateKey, auxRand = (0, utils_1.randomBytes)(32)) {\n const m = (0, utils_js_1.ensureBytes)('message', message);\n const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder\n const a = (0, utils_js_1.ensureBytes)('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array\n const t = numTo32b(d ^ (0, utils_js_1.bytesToNumberBE)(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a)\n const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m)\n const k_ = modN((0, utils_js_1.bytesToNumberBE)(rand)); // Let k' = int(rand) mod n\n if (k_ === _0n)\n throw new Error('sign failed: k is zero'); // Fail if k' = 0.\n const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G.\n const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n.\n const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n).\n sig.set(rx, 0);\n sig.set(numTo32b(modN(k + e * d)), 32);\n // If Verify(bytes(P), m, sig) (see below) returns failure, abort\n if (!schnorrVerify(sig, m, px))\n throw new Error('sign: Invalid signature produced');\n return sig;\n}\n/**\n * Verifies Schnorr signature.\n * Will swallow errors & return false except for initial type validation of arguments.\n */\nfunction schnorrVerify(signature, message, publicKey) {\n const sig = (0, utils_js_1.ensureBytes)('signature', signature, 64);\n const m = (0, utils_js_1.ensureBytes)('message', message);\n const pub = (0, utils_js_1.ensureBytes)('publicKey', publicKey, 32);\n try {\n const P = lift_x((0, utils_js_1.bytesToNumberBE)(pub)); // P = lift_x(int(pk)); fail if that fails\n const r = (0, utils_js_1.bytesToNumberBE)(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.\n if (!fe(r))\n return false;\n const s = (0, utils_js_1.bytesToNumberBE)(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.\n if (!ge(s))\n return false;\n const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n\n const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P\n if (!R || !R.hasEvenY() || R.toAffine().x !== r)\n return false; // -eP == (n-e)P\n return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r.\n }\n catch (error) {\n return false;\n }\n}\nexports.schnorr = (() => ({\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n utils: {\n randomPrivateKey: exports.secp256k1.utils.randomPrivateKey,\n lift_x,\n pointToBytes,\n numberToBytesBE: utils_js_1.numberToBytesBE,\n bytesToNumberBE: utils_js_1.bytesToNumberBE,\n taggedHash,\n mod: modular_js_1.mod,\n },\n}))();\nconst isoMap = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.isogenyMap)(Fp, [\n // xNum\n [\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7',\n '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581',\n '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262',\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c',\n ],\n // xDen\n [\n '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b',\n '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n // yNum\n [\n '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c',\n '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3',\n '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931',\n '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84',\n ],\n // yDen\n [\n '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b',\n '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573',\n '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n].map((i) => i.map((j) => BigInt(j)))))();\nconst mapSWU = /* @__PURE__ */ (() => (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp, {\n A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'),\n B: BigInt('1771'),\n Z: Fp.create(BigInt('-11')),\n}))();\nconst htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.secp256k1.ProjectivePoint, (scalars) => {\n const { x, y } = mapSWU(Fp.create(scalars[0]));\n return isoMap(x, y);\n}, {\n DST: 'secp256k1_XMD:SHA-256_SSWU_RO_',\n encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_',\n p: Fp.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: sha256_1.sha256,\n}))();\nexports.hashToCurve = (() => htf.hashToCurve)();\nexports.encodeToCurve = (() => htf.encodeToCurve)();\n//# sourceMappingURL=secp256k1.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/secp256k1.js?")},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_assert.js":(__unused_webpack_module,exports)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.output = exports.exists = exports.hash = exports.bytes = exports.bool = exports.number = void 0;\nfunction number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nexports.number = number;\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nexports.bool = bool;\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nexports.bytes = bytes;\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nexports.hash = hash;\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nexports.exists = exists;\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexports.output = output;\nconst assert = { number, bool, bytes, hash, exists, output };\nexports[\"default\"] = assert;\n//# sourceMappingURL=_assert.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_assert.js?")},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_sha2.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SHA2 = void 0;\nconst _assert_js_1 = __webpack_require__(/*! ./_assert.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_assert.js\");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js\");\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Base SHA2 class (RFC 6234)\nclass SHA2 extends utils_js_1.Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = (0, utils_js_1.createView)(this.buffer);\n }\n update(data) {\n (0, _assert_js_1.exists)(this);\n const { view, buffer, blockLen } = this;\n data = (0, utils_js_1.toBytes)(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = (0, utils_js_1.createView)(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n (0, _assert_js_1.exists)(this);\n (0, _assert_js_1.output)(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = (0, utils_js_1.createView)(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\nexports.SHA2 = SHA2;\n//# sourceMappingURL=_sha2.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_sha2.js?")},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_u64.js":(__unused_webpack_module,exports)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.add5L = exports.add5H = exports.add4H = exports.add4L = exports.add3H = exports.add3L = exports.add = exports.rotlBL = exports.rotlBH = exports.rotlSL = exports.rotlSH = exports.rotr32L = exports.rotr32H = exports.rotrBL = exports.rotrBH = exports.rotrSL = exports.rotrSH = exports.shrSL = exports.shrSH = exports.toBig = exports.split = exports.fromBig = void 0;\nconst U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nexports.fromBig = fromBig;\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nexports.split = split;\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\nexports.toBig = toBig;\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nexports.shrSH = shrSH;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\nexports.shrSL = shrSL;\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nexports.rotrSH = rotrSH;\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\nexports.rotrSL = rotrSL;\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nexports.rotrBH = rotrBH;\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\nexports.rotrBL = rotrBL;\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nexports.rotr32H = rotr32H;\nconst rotr32L = (h, _l) => h;\nexports.rotr32L = rotr32L;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nexports.rotlSH = rotlSH;\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\nexports.rotlSL = rotlSL;\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nexports.rotlBH = rotlBH;\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\nexports.rotlBL = rotlBL;\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\nexports.add = add;\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nexports.add3L = add3L;\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nexports.add3H = add3H;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nexports.add4L = add4L;\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nexports.add4H = add4H;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nexports.add5L = add5L;\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\nexports.add5H = add5H;\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexports["default"] = u64;\n//# sourceMappingURL=_u64.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_u64.js?')},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/crypto.js":(__unused_webpack_module,exports)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.crypto = void 0;\nexports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n//# sourceMappingURL=crypto.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/crypto.js?")},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/hmac.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.hmac = exports.HMAC = void 0;\nconst _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_assert.js");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js");\n// HMAC (RFC 2104)\nclass HMAC extends utils_js_1.Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n (0, _assert_js_1.hash)(hash);\n const key = (0, utils_js_1.toBytes)(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== \'function\')\n throw new Error(\'Expected instance of class which extends utils.Hash\');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf) {\n (0, _assert_js_1.exists)(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n (0, _assert_js_1.exists)(this);\n (0, _assert_js_1.bytes)(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don\'t know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\nexports.HMAC = HMAC;\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n */\nconst hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nexports.hmac = hmac;\nexports.hmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/hmac.js?')},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/pbkdf2.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.pbkdf2Async = exports.pbkdf2 = void 0;\nconst _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_assert.js");\nconst hmac_js_1 = __webpack_require__(/*! ./hmac.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/hmac.js");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js");\n// Common prologue and epilogue for sync/async functions\nfunction pbkdf2Init(hash, _password, _salt, _opts) {\n (0, _assert_js_1.hash)(hash);\n const opts = (0, utils_js_1.checkOpts)({ dkLen: 32, asyncTick: 10 }, _opts);\n const { c, dkLen, asyncTick } = opts;\n (0, _assert_js_1.number)(c);\n (0, _assert_js_1.number)(dkLen);\n (0, _assert_js_1.number)(asyncTick);\n if (c < 1)\n throw new Error(\'PBKDF2: iterations (c) should be >= 1\');\n const password = (0, utils_js_1.toBytes)(_password);\n const salt = (0, utils_js_1.toBytes)(_salt);\n // DK = PBKDF2(PRF, Password, Salt, c, dkLen);\n const DK = new Uint8Array(dkLen);\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n const PRF = hmac_js_1.hmac.create(hash, password);\n const PRFSalt = PRF._cloneInto().update(salt);\n return { c, dkLen, asyncTick, DK, PRF, PRFSalt };\n}\nfunction pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {\n PRF.destroy();\n PRFSalt.destroy();\n if (prfW)\n prfW.destroy();\n u.fill(0);\n return DK;\n}\n/**\n * PBKDF2-HMAC: RFC 2898 key derivation function\n * @param hash - hash function that would be used e.g. sha256\n * @param password - password from which a derived key is generated\n * @param salt - cryptographic salt\n * @param opts - {c, dkLen} where c is work factor and dkLen is output message size\n */\nfunction pbkdf2(hash, password, salt, opts) {\n const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = (0, utils_js_1.createView)(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n for (let ui = 1; ui < c; ui++) {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n }\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\nexports.pbkdf2 = pbkdf2;\nasync function pbkdf2Async(hash, password, salt, opts) {\n const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = (0, utils_js_1.createView)(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n await (0, utils_js_1.asyncLoop)(c - 1, asyncTick, () => {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n });\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\nexports.pbkdf2Async = pbkdf2Async;\n//# sourceMappingURL=pbkdf2.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/pbkdf2.js?')},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/ripemd160.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.ripemd160 = exports.RIPEMD160 = void 0;\nconst _sha2_js_1 = __webpack_require__(/*! ./_sha2.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_sha2.js");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js");\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\nconst Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);\nconst Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);\nconst Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);\nlet idxL = [Id];\nlet idxR = [Pi];\nfor (let i = 0; i < 4; i++)\n for (let j of [idxL, idxR])\n j.push(j[i].map((k) => Rho[k]));\nconst shifts = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => new Uint8Array(i));\nconst shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst Kl = /* @__PURE__ */ new Uint32Array([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr = /* @__PURE__ */ new Uint32Array([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word, shift) => (word << shift) | (word >>> (32 - shift));\n// It\'s called f() in spec.\nfunction f(group, x, y, z) {\n if (group === 0)\n return x ^ y ^ z;\n else if (group === 1)\n return (x & y) | (~x & z);\n else if (group === 2)\n return (x | ~y) ^ z;\n else if (group === 3)\n return (x & z) | (y & ~z);\n else\n return x ^ (y | ~z);\n}\n// Temporary buffer, not used to store anything between runs\nconst BUF = /* @__PURE__ */ new Uint32Array(16);\nclass RIPEMD160 extends _sha2_js_1.SHA2 {\n constructor() {\n super(64, 20, 8, true);\n this.h0 = 0x67452301 | 0;\n this.h1 = 0xefcdab89 | 0;\n this.h2 = 0x98badcfe | 0;\n this.h3 = 0x10325476 | 0;\n this.h4 = 0xc3d2e1f0 | 0;\n }\n get() {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n set(h0, h1, h2, h3, h4) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n BUF[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);\n }\n roundClean() {\n BUF.fill(0);\n }\n destroy() {\n this.destroyed = true;\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0);\n }\n}\nexports.RIPEMD160 = RIPEMD160;\n/**\n * RIPEMD-160 - a hash function from 1990s.\n * @param message - msg that would be hashed\n */\nexports.ripemd160 = (0, utils_js_1.wrapConstructor)(() => new RIPEMD160());\n//# sourceMappingURL=ripemd160.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/ripemd160.js?')},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/scrypt.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.scryptAsync = exports.scrypt = void 0;\nconst _assert_js_1 = __webpack_require__(/*! ./_assert.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_assert.js\");\nconst sha256_js_1 = __webpack_require__(/*! ./sha256.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/sha256.js\");\nconst pbkdf2_js_1 = __webpack_require__(/*! ./pbkdf2.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/pbkdf2.js\");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js\");\n// RFC 7914 Scrypt KDF\n// Left rotate for uint32\nconst rotl = (a, b) => (a << b) | (a >>> (32 - b));\n// The main Scrypt loop: uses Salsa extensively.\n// Six versions of the function were tried, this is the fastest one.\n// prettier-ignore\nfunction XorAndSalsa(prev, pi, input, ii, out, oi) {\n // Based on https://cr.yp.to/salsa20.html\n // Xor blocks\n let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];\n let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];\n let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];\n let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];\n let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];\n let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];\n let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];\n let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];\n // Save state to temporary variables (salsa)\n let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;\n // Main loop (salsa)\n for (let i = 0; i < 8; i += 2) {\n x04 ^= rotl(x00 + x12 | 0, 7);\n x08 ^= rotl(x04 + x00 | 0, 9);\n x12 ^= rotl(x08 + x04 | 0, 13);\n x00 ^= rotl(x12 + x08 | 0, 18);\n x09 ^= rotl(x05 + x01 | 0, 7);\n x13 ^= rotl(x09 + x05 | 0, 9);\n x01 ^= rotl(x13 + x09 | 0, 13);\n x05 ^= rotl(x01 + x13 | 0, 18);\n x14 ^= rotl(x10 + x06 | 0, 7);\n x02 ^= rotl(x14 + x10 | 0, 9);\n x06 ^= rotl(x02 + x14 | 0, 13);\n x10 ^= rotl(x06 + x02 | 0, 18);\n x03 ^= rotl(x15 + x11 | 0, 7);\n x07 ^= rotl(x03 + x15 | 0, 9);\n x11 ^= rotl(x07 + x03 | 0, 13);\n x15 ^= rotl(x11 + x07 | 0, 18);\n x01 ^= rotl(x00 + x03 | 0, 7);\n x02 ^= rotl(x01 + x00 | 0, 9);\n x03 ^= rotl(x02 + x01 | 0, 13);\n x00 ^= rotl(x03 + x02 | 0, 18);\n x06 ^= rotl(x05 + x04 | 0, 7);\n x07 ^= rotl(x06 + x05 | 0, 9);\n x04 ^= rotl(x07 + x06 | 0, 13);\n x05 ^= rotl(x04 + x07 | 0, 18);\n x11 ^= rotl(x10 + x09 | 0, 7);\n x08 ^= rotl(x11 + x10 | 0, 9);\n x09 ^= rotl(x08 + x11 | 0, 13);\n x10 ^= rotl(x09 + x08 | 0, 18);\n x12 ^= rotl(x15 + x14 | 0, 7);\n x13 ^= rotl(x12 + x15 | 0, 9);\n x14 ^= rotl(x13 + x12 | 0, 13);\n x15 ^= rotl(x14 + x13 | 0, 18);\n }\n // Write output (salsa)\n out[oi++] = (y00 + x00) | 0;\n out[oi++] = (y01 + x01) | 0;\n out[oi++] = (y02 + x02) | 0;\n out[oi++] = (y03 + x03) | 0;\n out[oi++] = (y04 + x04) | 0;\n out[oi++] = (y05 + x05) | 0;\n out[oi++] = (y06 + x06) | 0;\n out[oi++] = (y07 + x07) | 0;\n out[oi++] = (y08 + x08) | 0;\n out[oi++] = (y09 + x09) | 0;\n out[oi++] = (y10 + x10) | 0;\n out[oi++] = (y11 + x11) | 0;\n out[oi++] = (y12 + x12) | 0;\n out[oi++] = (y13 + x13) | 0;\n out[oi++] = (y14 + x14) | 0;\n out[oi++] = (y15 + x15) | 0;\n}\nfunction BlockMix(input, ii, out, oi, r) {\n // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks)\n let head = oi + 0;\n let tail = oi + 16 * r;\n for (let i = 0; i < 16; i++)\n out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1]\n for (let i = 0; i < r; i++, head += 16, ii += 16) {\n // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1\n XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1])\n if (i > 0)\n tail += 16; // First iteration overwrites tmp value in tail\n XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i])\n }\n}\n// Common prologue and epilogue for sync/async functions\nfunction scryptInit(password, salt, _opts) {\n // Maxmem - 1GB+1KB by default\n const opts = (0, utils_js_1.checkOpts)({\n dkLen: 32,\n asyncTick: 10,\n maxmem: 1024 ** 3 + 1024,\n }, _opts);\n const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;\n (0, _assert_js_1.number)(N);\n (0, _assert_js_1.number)(r);\n (0, _assert_js_1.number)(p);\n (0, _assert_js_1.number)(dkLen);\n (0, _assert_js_1.number)(asyncTick);\n (0, _assert_js_1.number)(maxmem);\n if (onProgress !== undefined && typeof onProgress !== 'function')\n throw new Error('progressCb should be function');\n const blockSize = 128 * r;\n const blockSize32 = blockSize / 4;\n if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) {\n // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function\n // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future.\n throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32');\n }\n if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) {\n throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)');\n }\n if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) {\n throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32');\n }\n const memUsed = blockSize * (N + p);\n if (memUsed > maxmem) {\n throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`);\n }\n // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor)\n // Since it has only one iteration there is no reason to use async variant\n const B = (0, pbkdf2_js_1.pbkdf2)(sha256_js_1.sha256, password, salt, { c: 1, dkLen: blockSize * p });\n const B32 = (0, utils_js_1.u32)(B);\n // Re-used between parallel iterations. Array(iterations) of B\n const V = (0, utils_js_1.u32)(new Uint8Array(blockSize * N));\n const tmp = (0, utils_js_1.u32)(new Uint8Array(blockSize));\n let blockMixCb = () => { };\n if (onProgress) {\n const totalBlockMix = 2 * N * p;\n // Invoke callback if progress changes from 10.01 to 10.02\n // Allows to draw smooth progress bar on up to 8K screen\n const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1);\n let blockMixCnt = 0;\n blockMixCb = () => {\n blockMixCnt++;\n if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))\n onProgress(blockMixCnt / totalBlockMix);\n };\n }\n return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };\n}\nfunction scryptOutput(password, dkLen, B, V, tmp) {\n const res = (0, pbkdf2_js_1.pbkdf2)(sha256_js_1.sha256, password, B, { c: 1, dkLen });\n B.fill(0);\n V.fill(0);\n tmp.fill(0);\n return res;\n}\n/**\n * Scrypt KDF from RFC 7914.\n * @param password - pass\n * @param salt - salt\n * @param opts - parameters\n * - `N` is cpu/mem work factor (power of 2 e.g. 2**18)\n * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance\n * - `p` is parallelization factor (1 is common)\n * - `dkLen` is output key length in bytes e.g. 32.\n * - `asyncTick` - (default: 10) max time in ms for which async function can block execution\n * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt\n * - `onProgress` - callback function that would be executed for progress report\n * @returns Derived key\n */\nfunction scrypt(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n for (let i = 0, pos = 0; i < N - 1; i++) {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n }\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n for (let i = 0; i < N; i++) {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n }\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\nexports.scrypt = scrypt;\n/**\n * Scrypt KDF from RFC 7914.\n */\nasync function scryptAsync(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n let pos = 0;\n await (0, utils_js_1.asyncLoop)(N - 1, asyncTick, () => {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n });\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n await (0, utils_js_1.asyncLoop)(N, asyncTick, () => {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n });\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\nexports.scryptAsync = scryptAsync;\n//# sourceMappingURL=scrypt.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/scrypt.js?")},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/sha256.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.sha224 = exports.sha256 = void 0;\nconst _sha2_js_1 = __webpack_require__(/*! ./_sha2.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_sha2.js");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js");\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n// prettier-ignore\nconst IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends _sha2_js_1.SHA2 {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n this.F = IV[5] | 0;\n this.G = IV[6] | 0;\n this.H = IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = (0, utils_js_1.rotr)(W15, 7) ^ (0, utils_js_1.rotr)(W15, 18) ^ (W15 >>> 3);\n const s1 = (0, utils_js_1.rotr)(W2, 17) ^ (0, utils_js_1.rotr)(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = (0, utils_js_1.rotr)(E, 6) ^ (0, utils_js_1.rotr)(E, 11) ^ (0, utils_js_1.rotr)(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = (0, utils_js_1.rotr)(A, 2) ^ (0, utils_js_1.rotr)(A, 13) ^ (0, utils_js_1.rotr)(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexports.sha256 = (0, utils_js_1.wrapConstructor)(() => new SHA256());\nexports.sha224 = (0, utils_js_1.wrapConstructor)(() => new SHA224());\n//# sourceMappingURL=sha256.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/sha256.js?')},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/sha3.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = exports.keccakP = void 0;\nconst _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_assert.js");\nconst _u64_js_1 = __webpack_require__(/*! ./_u64.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_u64.js");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js");\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It\'s called a sponge function.\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ (0, _u64_js_1.split)(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? (0, _u64_js_1.rotlBH)(h, l, s) : (0, _u64_js_1.rotlSH)(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? (0, _u64_js_1.rotlBL)(h, l, s) : (0, _u64_js_1.rotlSL)(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nfunction keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexports.keccakP = keccakP;\nclass Keccak extends utils_js_1.Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n (0, _assert_js_1.number)(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error(\'Sha3 supports only keccak-f1600 function\');\n this.state = new Uint8Array(200);\n this.state32 = (0, utils_js_1.u32)(this.state);\n }\n keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n (0, _assert_js_1.exists)(this);\n const { blockLen, state } = this;\n data = (0, utils_js_1.toBytes)(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n (0, _assert_js_1.exists)(this, false);\n (0, _assert_js_1.bytes)(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error(\'XOF is not possible for this instance\');\n return this.writeInto(out);\n }\n xof(bytes) {\n (0, _assert_js_1.number)(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n (0, _assert_js_1.output)(out, this);\n if (this.finished)\n throw new Error(\'digest() was already called\');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nexports.Keccak = Keccak;\nconst gen = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructor)(() => new Keccak(blockLen, suffix, outputLen));\nexports.sha3_224 = gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexports.sha3_256 = gen(0x06, 136, 256 / 8);\nexports.sha3_384 = gen(0x06, 104, 384 / 8);\nexports.sha3_512 = gen(0x06, 72, 512 / 8);\nexports.keccak_224 = gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexports.keccak_256 = gen(0x01, 136, 256 / 8);\nexports.keccak_384 = gen(0x01, 104, 384 / 8);\nexports.keccak_512 = gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapXOFConstructorWithOpts)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexports.shake128 = genShake(0x1f, 168, 128 / 8);\nexports.shake256 = genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/sha3.js?')},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/sha512.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.sha384 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.SHA512 = void 0;\nconst _sha2_js_1 = __webpack_require__(/*! ./_sha2.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_sha2.js\");\nconst _u64_js_1 = __webpack_require__(/*! ./_u64.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/_u64.js\");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js\");\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => _u64_js_1.default.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nclass SHA512 extends _sha2_js_1.SHA2 {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = _u64_js_1.default.rotrSH(W15h, W15l, 1) ^ _u64_js_1.default.rotrSH(W15h, W15l, 8) ^ _u64_js_1.default.shrSH(W15h, W15l, 7);\n const s0l = _u64_js_1.default.rotrSL(W15h, W15l, 1) ^ _u64_js_1.default.rotrSL(W15h, W15l, 8) ^ _u64_js_1.default.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = _u64_js_1.default.rotrSH(W2h, W2l, 19) ^ _u64_js_1.default.rotrBH(W2h, W2l, 61) ^ _u64_js_1.default.shrSH(W2h, W2l, 6);\n const s1l = _u64_js_1.default.rotrSL(W2h, W2l, 19) ^ _u64_js_1.default.rotrBL(W2h, W2l, 61) ^ _u64_js_1.default.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = _u64_js_1.default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = _u64_js_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = _u64_js_1.default.rotrSH(Eh, El, 14) ^ _u64_js_1.default.rotrSH(Eh, El, 18) ^ _u64_js_1.default.rotrBH(Eh, El, 41);\n const sigma1l = _u64_js_1.default.rotrSL(Eh, El, 14) ^ _u64_js_1.default.rotrSL(Eh, El, 18) ^ _u64_js_1.default.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = _u64_js_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = _u64_js_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = _u64_js_1.default.rotrSH(Ah, Al, 28) ^ _u64_js_1.default.rotrBH(Ah, Al, 34) ^ _u64_js_1.default.rotrBH(Ah, Al, 39);\n const sigma0l = _u64_js_1.default.rotrSL(Ah, Al, 28) ^ _u64_js_1.default.rotrBL(Ah, Al, 34) ^ _u64_js_1.default.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = _u64_js_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = _u64_js_1.default.add3L(T1l, sigma0l, MAJl);\n Ah = _u64_js_1.default.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = _u64_js_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = _u64_js_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = _u64_js_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = _u64_js_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = _u64_js_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = _u64_js_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = _u64_js_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = _u64_js_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nexports.SHA512 = SHA512;\nclass SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nclass SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nclass SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nexports.sha512 = (0, utils_js_1.wrapConstructor)(() => new SHA512());\nexports.sha512_224 = (0, utils_js_1.wrapConstructor)(() => new SHA512_224());\nexports.sha512_256 = (0, utils_js_1.wrapConstructor)(() => new SHA512_256());\nexports.sha384 = (0, utils_js_1.wrapConstructor)(() => new SHA384());\n//# sourceMappingURL=sha512.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/sha512.js?")},"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.randomBytes = exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nconst crypto_1 = __webpack_require__(/*! @noble/hashes/crypto */ \"./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/crypto.js\");\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nconst u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexports.u8 = u8;\nconst u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\nexports.u32 = u32;\n// Cast array to view\nconst createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\nexports.createView = createView;\n// The rotate right (circular right shift) operation for uint32\nconst rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\nexports.rotr = rotr;\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!exports.isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\nexports.bytesToHex = bytesToHex;\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\nexports.hexToBytes = hexToBytes;\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nconst nextTick = async () => { };\nexports.nextTick = nextTick;\n// Returns control to thread each 'tick' ms to avoid blocking\nasync function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await (0, exports.nextTick)();\n ts += diff;\n }\n}\nexports.asyncLoop = asyncLoop;\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\nexports.utf8ToBytes = utf8ToBytes;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nfunction toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\nexports.toBytes = toBytes;\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\nexports.concatBytes = concatBytes;\n// For runtime check if class implements interface\nclass Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nexports.Hash = Hash;\nconst toStr = {}.toString;\nfunction checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexports.checkOpts = checkOpts;\nfunction wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexports.wrapConstructor = wrapConstructor;\nfunction wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexports.wrapConstructorWithOpts = wrapConstructorWithOpts;\nfunction wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nfunction randomBytes(bytesLength = 32) {\n if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {\n return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\nexports.randomBytes = randomBytes;\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js?")},"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/_assert.js":(__unused_webpack_module,exports)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.isBytes = isBytes;\nexports.number = number;\nexports.bool = bool;\nexports.bytes = bytes;\nexports.hash = hash;\nexports.exists = exists;\nexports.output = output;\nfunction number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`positive integer expected, not ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`boolean expected, not ${b}`);\n}\n// copied from utils\nfunction isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\nfunction bytes(b, ...lengths) {\n if (!isBytes(b))\n throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(h) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(h.outputLen);\n number(h.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nconst assert = { number, bool, bytes, hash, exists, output };\nexports[\"default\"] = assert;\n//# sourceMappingURL=_assert.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/_assert.js?")},"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/_u64.js":(__unused_webpack_module,exports)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.add5L = exports.add5H = exports.add4H = exports.add4L = exports.add3H = exports.add3L = exports.rotlBL = exports.rotlBH = exports.rotlSL = exports.rotlSH = exports.rotr32L = exports.rotr32H = exports.rotrBL = exports.rotrBH = exports.rotrSL = exports.rotrSH = exports.shrSL = exports.shrSH = exports.toBig = void 0;\nexports.fromBig = fromBig;\nexports.split = split;\nexports.add = add;\nconst U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\nexports.toBig = toBig;\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nexports.shrSH = shrSH;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\nexports.shrSL = shrSL;\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nexports.rotrSH = rotrSH;\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\nexports.rotrSL = rotrSL;\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nexports.rotrBH = rotrBH;\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\nexports.rotrBL = rotrBL;\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nexports.rotr32H = rotr32H;\nconst rotr32L = (h, _l) => h;\nexports.rotr32L = rotr32L;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nexports.rotlSH = rotlSH;\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\nexports.rotlSL = rotlSL;\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nexports.rotlBH = rotlBH;\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\nexports.rotlBL = rotlBL;\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nexports.add3L = add3L;\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nexports.add3H = add3H;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nexports.add4L = add4L;\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nexports.add4H = add4H;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nexports.add5L = add5L;\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\nexports.add5H = add5H;\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexports["default"] = u64;\n//# sourceMappingURL=_u64.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/_u64.js?')},"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/crypto.js":(__unused_webpack_module,exports)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.crypto = void 0;\nexports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n//# sourceMappingURL=crypto.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/crypto.js?")},"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/sha3.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = void 0;\nexports.keccakP = keccakP;\nconst _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/_assert.js");\nconst _u64_js_1 = __webpack_require__(/*! ./_u64.js */ "./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/_u64.js");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/utils.js");\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It\'s called a sponge function.\n// Various per round constants calculations\nconst SHA3_PI = [];\nconst SHA3_ROTL = [];\nconst _SHA3_IOTA = [];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ (0, _u64_js_1.split)(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? (0, _u64_js_1.rotlBH)(h, l, s) : (0, _u64_js_1.rotlSH)(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? (0, _u64_js_1.rotlBL)(h, l, s) : (0, _u64_js_1.rotlSL)(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nfunction keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nclass Keccak extends utils_js_1.Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n (0, _assert_js_1.number)(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error(\'Sha3 supports only keccak-f1600 function\');\n this.state = new Uint8Array(200);\n this.state32 = (0, utils_js_1.u32)(this.state);\n }\n keccak() {\n if (!utils_js_1.isLE)\n (0, utils_js_1.byteSwap32)(this.state32);\n keccakP(this.state32, this.rounds);\n if (!utils_js_1.isLE)\n (0, utils_js_1.byteSwap32)(this.state32);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n (0, _assert_js_1.exists)(this);\n const { blockLen, state } = this;\n data = (0, utils_js_1.toBytes)(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n (0, _assert_js_1.exists)(this, false);\n (0, _assert_js_1.bytes)(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error(\'XOF is not possible for this instance\');\n return this.writeInto(out);\n }\n xof(bytes) {\n (0, _assert_js_1.number)(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n (0, _assert_js_1.output)(out, this);\n if (this.finished)\n throw new Error(\'digest() was already called\');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nexports.Keccak = Keccak;\nconst gen = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructor)(() => new Keccak(blockLen, suffix, outputLen));\nexports.sha3_224 = gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexports.sha3_256 = gen(0x06, 136, 256 / 8);\nexports.sha3_384 = gen(0x06, 104, 384 / 8);\nexports.sha3_512 = gen(0x06, 72, 512 / 8);\nexports.keccak_224 = gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexports.keccak_256 = gen(0x01, 136, 256 / 8);\nexports.keccak_384 = gen(0x01, 104, 384 / 8);\nexports.keccak_512 = gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapXOFConstructorWithOpts)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexports.shake128 = genShake(0x1f, 168, 128 / 8);\nexports.shake256 = genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/sha3.js?')},"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/utils.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Hash = exports.nextTick = exports.byteSwapIfBE = exports.byteSwap = exports.isLE = exports.rotl = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;\nexports.isBytes = isBytes;\nexports.byteSwap32 = byteSwap32;\nexports.bytesToHex = bytesToHex;\nexports.hexToBytes = hexToBytes;\nexports.asyncLoop = asyncLoop;\nexports.utf8ToBytes = utf8ToBytes;\nexports.toBytes = toBytes;\nexports.concatBytes = concatBytes;\nexports.checkOpts = checkOpts;\nexports.wrapConstructor = wrapConstructor;\nexports.wrapConstructorWithOpts = wrapConstructorWithOpts;\nexports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;\nexports.randomBytes = randomBytes;\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nconst crypto_1 = __webpack_require__(/*! @noble/hashes/crypto */ \"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/crypto.js\");\nconst _assert_js_1 = __webpack_require__(/*! ./_assert.js */ \"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/_assert.js\");\n// export { isBytes } from './_assert.js';\n// We can't reuse isBytes from _assert, because somehow this causes huge perf issues\nfunction isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\n// Cast array to different type\nconst u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexports.u8 = u8;\nconst u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\nexports.u32 = u32;\n// Cast array to view\nconst createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\nexports.createView = createView;\n// The rotate right (circular right shift) operation for uint32\nconst rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\nexports.rotr = rotr;\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0);\nexports.rotl = rotl;\nexports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\n// The byte swap operation for uint32\nconst byteSwap = (word) => ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff);\nexports.byteSwap = byteSwap;\n// Conditionally byte swap if on a big-endian platform\nexports.byteSwapIfBE = exports.isLE ? (n) => n : (n) => (0, exports.byteSwap)(n);\n// In place byte swap for Uint32Array\nfunction byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = (0, exports.byteSwap)(arr[i]);\n }\n}\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nfunction bytesToHex(bytes) {\n (0, _assert_js_1.bytes)(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };\nfunction asciiToBase16(char) {\n if (char >= asciis._0 && char <= asciis._9)\n return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F)\n return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f)\n return char - (asciis._a - 10);\n return;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nfunction hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nconst nextTick = async () => { };\nexports.nextTick = nextTick;\n// Returns control to thread each 'tick' ms to avoid blocking\nasync function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await (0, exports.nextTick)();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nfunction utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nfunction toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n (0, _assert_js_1.bytes)(data);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nfunction concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n (0, _assert_js_1.bytes)(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n// For runtime check if class implements interface\nclass Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nexports.Hash = Hash;\nconst toStr = {}.toString;\nfunction checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nfunction wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nfunction wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nfunction wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nfunction randomBytes(bytesLength = 32) {\n if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {\n return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n // Legacy Node.js compatibility\n if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === 'function') {\n return crypto_1.crypto.randomBytes(bytesLength);\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/utils.js?")},"./node_modules/.pnpm/@solana+buffer-layout@4.0.1/node_modules/@solana/buffer-layout/lib/Layout.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("/* The MIT License (MIT)\n *\n * Copyright 2015-2018 Peter A. Bigot\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * Support for translating between Uint8Array instances and JavaScript\n * native types.\n *\n * {@link module:Layout~Layout|Layout} is the basis of a class\n * hierarchy that associates property names with sequences of encoded\n * bytes.\n *\n * Layouts are supported for these scalar (numeric) types:\n * * {@link module:Layout~UInt|Unsigned integers in little-endian\n * format} with {@link module:Layout.u8|8-bit}, {@link\n * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},\n * {@link module:Layout.u32|32-bit}, {@link\n * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}\n * representation ranges;\n * * {@link module:Layout~UIntBE|Unsigned integers in big-endian\n * format} with {@link module:Layout.u16be|16-bit}, {@link\n * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},\n * {@link module:Layout.u40be|40-bit}, and {@link\n * module:Layout.u48be|48-bit} representation ranges;\n * * {@link module:Layout~Int|Signed integers in little-endian\n * format} with {@link module:Layout.s8|8-bit}, {@link\n * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},\n * {@link module:Layout.s32|32-bit}, {@link\n * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}\n * representation ranges;\n * * {@link module:Layout~IntBE|Signed integers in big-endian format}\n * with {@link module:Layout.s16be|16-bit}, {@link\n * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},\n * {@link module:Layout.s40be|40-bit}, and {@link\n * module:Layout.s48be|48-bit} representation ranges;\n * * 64-bit integral values that decode to an exact (if magnitude is\n * less than 2^53) or nearby integral Number in {@link\n * module:Layout.nu64|unsigned little-endian}, {@link\n * module:Layout.nu64be|unsigned big-endian}, {@link\n * module:Layout.ns64|signed little-endian}, and {@link\n * module:Layout.ns64be|unsigned big-endian} encodings;\n * * 32-bit floating point values with {@link\n * module:Layout.f32|little-endian} and {@link\n * module:Layout.f32be|big-endian} representations;\n * * 64-bit floating point values with {@link\n * module:Layout.f64|little-endian} and {@link\n * module:Layout.f64be|big-endian} representations;\n * * {@link module:Layout.const|Constants} that take no space in the\n * encoded expression.\n *\n * and for these aggregate types:\n * * {@link module:Layout.seq|Sequence}s of instances of a {@link\n * module:Layout~Layout|Layout}, with JavaScript representation as\n * an Array and constant or data-dependent {@link\n * module:Layout~Sequence#count|length};\n * * {@link module:Layout.struct|Structure}s that aggregate a\n * heterogeneous sequence of {@link module:Layout~Layout|Layout}\n * instances, with JavaScript representation as an Object;\n * * {@link module:Layout.union|Union}s that support multiple {@link\n * module:Layout~VariantLayout|variant layouts} over a fixed\n * (padded) or variable (not padded) span of bytes, using an\n * unsigned integer at the start of the data or a separate {@link\n * module:Layout.unionLayoutDiscriminator|layout element} to\n * determine which layout to use when interpreting the buffer\n * contents;\n * * {@link module:Layout.bits|BitStructure}s that contain a sequence\n * of individual {@link\n * module:Layout~BitStructure#addField|BitField}s packed into an 8,\n * 16, 24, or 32-bit unsigned integer starting at the least- or\n * most-significant bit;\n * * {@link module:Layout.cstr|C strings} of varying length;\n * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link\n * module:Layout~Blob#length|length} raw data.\n *\n * All {@link module:Layout~Layout|Layout} instances are immutable\n * after construction, to prevent internal state from becoming\n * inconsistent.\n *\n * @local Layout\n * @local ExternalLayout\n * @local GreedyCount\n * @local OffsetLayout\n * @local UInt\n * @local UIntBE\n * @local Int\n * @local IntBE\n * @local NearUInt64\n * @local NearUInt64BE\n * @local NearInt64\n * @local NearInt64BE\n * @local Float\n * @local FloatBE\n * @local Double\n * @local DoubleBE\n * @local Sequence\n * @local Structure\n * @local UnionDiscriminator\n * @local UnionLayoutDiscriminator\n * @local Union\n * @local VariantLayout\n * @local BitStructure\n * @local BitField\n * @local Boolean\n * @local Blob\n * @local CString\n * @local Constant\n * @local bindConstructorLayout\n * @module Layout\n * @license MIT\n * @author Peter A. Bigot\n * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}\n */\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.s16 = exports.s8 = exports.nu64be = exports.u48be = exports.u40be = exports.u32be = exports.u24be = exports.u16be = exports.nu64 = exports.u48 = exports.u40 = exports.u32 = exports.u24 = exports.u16 = exports.u8 = exports.offset = exports.greedy = exports.Constant = exports.UTF8 = exports.CString = exports.Blob = exports.Boolean = exports.BitField = exports.BitStructure = exports.VariantLayout = exports.Union = exports.UnionLayoutDiscriminator = exports.UnionDiscriminator = exports.Structure = exports.Sequence = exports.DoubleBE = exports.Double = exports.FloatBE = exports.Float = exports.NearInt64BE = exports.NearInt64 = exports.NearUInt64BE = exports.NearUInt64 = exports.IntBE = exports.Int = exports.UIntBE = exports.UInt = exports.OffsetLayout = exports.GreedyCount = exports.ExternalLayout = exports.bindConstructorLayout = exports.nameWithProperty = exports.Layout = exports.uint8ArrayToBuffer = exports.checkUint8Array = void 0;\nexports.constant = exports.utf8 = exports.cstr = exports.blob = exports.unionLayoutDiscriminator = exports.union = exports.seq = exports.bits = exports.struct = exports.f64be = exports.f64 = exports.f32be = exports.f32 = exports.ns64be = exports.s48be = exports.s40be = exports.s32be = exports.s24be = exports.s16be = exports.ns64 = exports.s48 = exports.s40 = exports.s32 = exports.s24 = void 0;\nconst buffer_1 = __webpack_require__(/*! buffer */ \"./node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js\");\n/* Check if a value is a Uint8Array.\n *\n * @ignore */\nfunction checkUint8Array(b) {\n if (!(b instanceof Uint8Array)) {\n throw new TypeError('b must be a Uint8Array');\n }\n}\nexports.checkUint8Array = checkUint8Array;\n/* Create a Buffer instance from a Uint8Array.\n *\n * @ignore */\nfunction uint8ArrayToBuffer(b) {\n checkUint8Array(b);\n return buffer_1.Buffer.from(b.buffer, b.byteOffset, b.length);\n}\nexports.uint8ArrayToBuffer = uint8ArrayToBuffer;\n/**\n * Base class for layout objects.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support the {@link\n * Layout#encode|encode} or {@link Layout#decode|decode} functions.\n *\n * @param {Number} span - Initializer for {@link Layout#span|span}. The\n * parameter must be an integer; a negative value signifies that the\n * span is {@link Layout#getSpan|value-specific}.\n *\n * @param {string} [property] - Initializer for {@link\n * Layout#property|property}.\n *\n * @abstract\n */\nclass Layout {\n constructor(span, property) {\n if (!Number.isInteger(span)) {\n throw new TypeError('span must be an integer');\n }\n /** The span of the layout in bytes.\n *\n * Positive values are generally expected.\n *\n * Zero will only appear in {@link Constant}s and in {@link\n * Sequence}s where the {@link Sequence#count|count} is zero.\n *\n * A negative value indicates that the span is value-specific, and\n * must be obtained using {@link Layout#getSpan|getSpan}. */\n this.span = span;\n /** The property name used when this layout is represented in an\n * Object.\n *\n * Used only for layouts that {@link Layout#decode|decode} to Object\n * instances. If left undefined the span of the unnamed layout will\n * be treated as padding: it will not be mutated by {@link\n * Layout#encode|encode} nor represented as a property in the\n * decoded Object. */\n this.property = property;\n }\n /** Function to create an Object into which decoded properties will\n * be written.\n *\n * Used only for layouts that {@link Layout#decode|decode} to Object\n * instances, which means:\n * * {@link Structure}\n * * {@link Union}\n * * {@link VariantLayout}\n * * {@link BitStructure}\n *\n * If left undefined the JavaScript representation of these layouts\n * will be Object instances.\n *\n * See {@link bindConstructorLayout}.\n */\n makeDestinationObject() {\n return {};\n }\n /**\n * Calculate the span of a specific instance of a layout.\n *\n * @param {Uint8Array} b - the buffer that contains an encoded instance.\n *\n * @param {Number} [offset] - the offset at which the encoded instance\n * starts. If absent a zero offset is inferred.\n *\n * @return {Number} - the number of bytes covered by the layout\n * instance. If this method is not overridden in a subclass the\n * definition-time constant {@link Layout#span|span} will be\n * returned.\n *\n * @throws {RangeError} - if the length of the value cannot be\n * determined.\n */\n getSpan(b, offset) {\n if (0 > this.span) {\n throw new RangeError('indeterminate span');\n }\n return this.span;\n }\n /**\n * Replicate the layout using a new property.\n *\n * This function must be used to get a structurally-equivalent layout\n * with a different name since all {@link Layout} instances are\n * immutable.\n *\n * **NOTE** This is a shallow copy. All fields except {@link\n * Layout#property|property} are strictly equal to the origin layout.\n *\n * @param {String} property - the value for {@link\n * Layout#property|property} in the replica.\n *\n * @returns {Layout} - the copy with {@link Layout#property|property}\n * set to `property`.\n */\n replicate(property) {\n const rv = Object.create(this.constructor.prototype);\n Object.assign(rv, this);\n rv.property = property;\n return rv;\n }\n /**\n * Create an object from layout properties and an array of values.\n *\n * **NOTE** This function returns `undefined` if invoked on a layout\n * that does not return its value as an Object. Objects are\n * returned for things that are a {@link Structure}, which includes\n * {@link VariantLayout|variant layouts} if they are structures, and\n * excludes {@link Union}s. If you want this feature for a union\n * you must use {@link Union.getVariant|getVariant} to select the\n * desired layout.\n *\n * @param {Array} values - an array of values that correspond to the\n * default order for properties. As with {@link Layout#decode|decode}\n * layout elements that have no property name are skipped when\n * iterating over the array values. Only the top-level properties are\n * assigned; arguments are not assigned to properties of contained\n * layouts. Any unused values are ignored.\n *\n * @return {(Object|undefined)}\n */\n fromArray(values) {\n return undefined;\n }\n}\nexports.Layout = Layout;\n/* Provide text that carries a name (such as for a function that will\n * be throwing an error) annotated with the property of a given layout\n * (such as one for which the value was unacceptable).\n *\n * @ignore */\nfunction nameWithProperty(name, lo) {\n if (lo.property) {\n return name + '[' + lo.property + ']';\n }\n return name;\n}\nexports.nameWithProperty = nameWithProperty;\n/**\n * Augment a class so that instances can be encoded/decoded using a\n * given layout.\n *\n * Calling this function couples `Class` with `layout` in several ways:\n *\n * * `Class.layout_` becomes a static member property equal to `layout`;\n * * `layout.boundConstructor_` becomes a static member property equal\n * to `Class`;\n * * The {@link Layout#makeDestinationObject|makeDestinationObject()}\n * property of `layout` is set to a function that returns a `new\n * Class()`;\n * * `Class.decode(b, offset)` becomes a static member function that\n * delegates to {@link Layout#decode|layout.decode}. The\n * synthesized function may be captured and extended.\n * * `Class.prototype.encode(b, offset)` provides an instance member\n * function that delegates to {@link Layout#encode|layout.encode}\n * with `src` set to `this`. The synthesized function may be\n * captured and extended, but when the extension is invoked `this`\n * must be explicitly bound to the instance.\n *\n * @param {class} Class - a JavaScript class with a nullary\n * constructor.\n *\n * @param {Layout} layout - the {@link Layout} instance used to encode\n * instances of `Class`.\n */\n// `Class` must be a constructor Function, but the assignment of a `layout_` property to it makes it difficult to type\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction bindConstructorLayout(Class, layout) {\n if ('function' !== typeof Class) {\n throw new TypeError('Class must be constructor');\n }\n if (Object.prototype.hasOwnProperty.call(Class, 'layout_')) {\n throw new Error('Class is already bound to a layout');\n }\n if (!(layout && (layout instanceof Layout))) {\n throw new TypeError('layout must be a Layout');\n }\n if (Object.prototype.hasOwnProperty.call(layout, 'boundConstructor_')) {\n throw new Error('layout is already bound to a constructor');\n }\n Class.layout_ = layout;\n layout.boundConstructor_ = Class;\n layout.makeDestinationObject = (() => new Class());\n Object.defineProperty(Class.prototype, 'encode', {\n value(b, offset) {\n return layout.encode(this, b, offset);\n },\n writable: true,\n });\n Object.defineProperty(Class, 'decode', {\n value(b, offset) {\n return layout.decode(b, offset);\n },\n writable: true,\n });\n}\nexports.bindConstructorLayout = bindConstructorLayout;\n/**\n * An object that behaves like a layout but does not consume space\n * within its containing layout.\n *\n * This is primarily used to obtain metadata about a member, such as a\n * {@link OffsetLayout} that can provide data about a {@link\n * Layout#getSpan|value-specific span}.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support {@link\n * ExternalLayout#isCount|isCount} or other {@link Layout} functions.\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @abstract\n * @augments {Layout}\n */\nclass ExternalLayout extends Layout {\n /**\n * Return `true` iff the external layout decodes to an unsigned\n * integer layout.\n *\n * In that case it can be used as the source of {@link\n * Sequence#count|Sequence counts}, {@link Blob#length|Blob lengths},\n * or as {@link UnionLayoutDiscriminator#layout|external union\n * discriminators}.\n *\n * @abstract\n */\n isCount() {\n throw new Error('ExternalLayout is abstract');\n }\n}\nexports.ExternalLayout = ExternalLayout;\n/**\n * An {@link ExternalLayout} that determines its {@link\n * Layout#decode|value} based on offset into and length of the buffer\n * on which it is invoked.\n *\n * *Factory*: {@link module:Layout.greedy|greedy}\n *\n * @param {Number} [elementSpan] - initializer for {@link\n * GreedyCount#elementSpan|elementSpan}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {ExternalLayout}\n */\nclass GreedyCount extends ExternalLayout {\n constructor(elementSpan = 1, property) {\n if ((!Number.isInteger(elementSpan)) || (0 >= elementSpan)) {\n throw new TypeError('elementSpan must be a (positive) integer');\n }\n super(-1, property);\n /** The layout for individual elements of the sequence. The value\n * must be a positive integer. If not provided, the value will be\n * 1. */\n this.elementSpan = elementSpan;\n }\n /** @override */\n isCount() {\n return true;\n }\n /** @override */\n decode(b, offset = 0) {\n checkUint8Array(b);\n const rem = b.length - offset;\n return Math.floor(rem / this.elementSpan);\n }\n /** @override */\n encode(src, b, offset) {\n return 0;\n }\n}\nexports.GreedyCount = GreedyCount;\n/**\n * An {@link ExternalLayout} that supports accessing a {@link Layout}\n * at a fixed offset from the start of another Layout. The offset may\n * be before, within, or after the base layout.\n *\n * *Factory*: {@link module:Layout.offset|offset}\n *\n * @param {Layout} layout - initializer for {@link\n * OffsetLayout#layout|layout}, modulo `property`.\n *\n * @param {Number} [offset] - Initializes {@link\n * OffsetLayout#offset|offset}. Defaults to zero.\n *\n * @param {string} [property] - Optional new property name for a\n * {@link Layout#replicate| replica} of `layout` to be used as {@link\n * OffsetLayout#layout|layout}. If not provided the `layout` is used\n * unchanged.\n *\n * @augments {Layout}\n */\nclass OffsetLayout extends ExternalLayout {\n constructor(layout, offset = 0, property) {\n if (!(layout instanceof Layout)) {\n throw new TypeError('layout must be a Layout');\n }\n if (!Number.isInteger(offset)) {\n throw new TypeError('offset must be integer or undefined');\n }\n super(layout.span, property || layout.property);\n /** The subordinated layout. */\n this.layout = layout;\n /** The location of {@link OffsetLayout#layout} relative to the\n * start of another layout.\n *\n * The value may be positive or negative, but an error will thrown\n * if at the point of use it goes outside the span of the Uint8Array\n * being accessed. */\n this.offset = offset;\n }\n /** @override */\n isCount() {\n return ((this.layout instanceof UInt)\n || (this.layout instanceof UIntBE));\n }\n /** @override */\n decode(b, offset = 0) {\n return this.layout.decode(b, offset + this.offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n return this.layout.encode(src, b, offset + this.offset);\n }\n}\nexports.OffsetLayout = OffsetLayout;\n/**\n * Represent an unsigned integer in little-endian format.\n *\n * *Factory*: {@link module:Layout.u8|u8}, {@link\n * module:Layout.u16|u16}, {@link module:Layout.u24|u24}, {@link\n * module:Layout.u32|u32}, {@link module:Layout.u40|u40}, {@link\n * module:Layout.u48|u48}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UInt extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readUIntLE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeUIntLE(src, offset, this.span);\n return this.span;\n }\n}\nexports.UInt = UInt;\n/**\n * Represent an unsigned integer in big-endian format.\n *\n * *Factory*: {@link module:Layout.u8be|u8be}, {@link\n * module:Layout.u16be|u16be}, {@link module:Layout.u24be|u24be},\n * {@link module:Layout.u32be|u32be}, {@link\n * module:Layout.u40be|u40be}, {@link module:Layout.u48be|u48be}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UIntBE extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readUIntBE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeUIntBE(src, offset, this.span);\n return this.span;\n }\n}\nexports.UIntBE = UIntBE;\n/**\n * Represent a signed integer in little-endian format.\n *\n * *Factory*: {@link module:Layout.s8|s8}, {@link\n * module:Layout.s16|s16}, {@link module:Layout.s24|s24}, {@link\n * module:Layout.s32|s32}, {@link module:Layout.s40|s40}, {@link\n * module:Layout.s48|s48}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Int extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readIntLE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeIntLE(src, offset, this.span);\n return this.span;\n }\n}\nexports.Int = Int;\n/**\n * Represent a signed integer in big-endian format.\n *\n * *Factory*: {@link module:Layout.s8be|s8be}, {@link\n * module:Layout.s16be|s16be}, {@link module:Layout.s24be|s24be},\n * {@link module:Layout.s32be|s32be}, {@link\n * module:Layout.s40be|s40be}, {@link module:Layout.s48be|s48be}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass IntBE extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readIntBE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeIntBE(src, offset, this.span);\n return this.span;\n }\n}\nexports.IntBE = IntBE;\nconst V2E32 = Math.pow(2, 32);\n/* True modulus high and low 32-bit words, where low word is always\n * non-negative. */\nfunction divmodInt64(src) {\n const hi32 = Math.floor(src / V2E32);\n const lo32 = src - (hi32 * V2E32);\n return { hi32, lo32 };\n}\n/* Reconstruct Number from quotient and non-negative remainder */\nfunction roundedInt64(hi32, lo32) {\n return hi32 * V2E32 + lo32;\n}\n/**\n * Represent an unsigned 64-bit integer in little-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.nu64|nu64}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearUInt64 extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const lo32 = buffer.readUInt32LE(offset);\n const hi32 = buffer.readUInt32LE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32LE(split.lo32, offset);\n buffer.writeUInt32LE(split.hi32, offset + 4);\n return 8;\n }\n}\nexports.NearUInt64 = NearUInt64;\n/**\n * Represent an unsigned 64-bit integer in big-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.nu64be|nu64be}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearUInt64BE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const hi32 = buffer.readUInt32BE(offset);\n const lo32 = buffer.readUInt32BE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32BE(split.hi32, offset);\n buffer.writeUInt32BE(split.lo32, offset + 4);\n return 8;\n }\n}\nexports.NearUInt64BE = NearUInt64BE;\n/**\n * Represent a signed 64-bit integer in little-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.ns64|ns64}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearInt64 extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const lo32 = buffer.readUInt32LE(offset);\n const hi32 = buffer.readInt32LE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32LE(split.lo32, offset);\n buffer.writeInt32LE(split.hi32, offset + 4);\n return 8;\n }\n}\nexports.NearInt64 = NearInt64;\n/**\n * Represent a signed 64-bit integer in big-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.ns64be|ns64be}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearInt64BE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const hi32 = buffer.readInt32BE(offset);\n const lo32 = buffer.readUInt32BE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeInt32BE(split.hi32, offset);\n buffer.writeUInt32BE(split.lo32, offset + 4);\n return 8;\n }\n}\nexports.NearInt64BE = NearInt64BE;\n/**\n * Represent a 32-bit floating point number in little-endian format.\n *\n * *Factory*: {@link module:Layout.f32|f32}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Float extends Layout {\n constructor(property) {\n super(4, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readFloatLE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeFloatLE(src, offset);\n return 4;\n }\n}\nexports.Float = Float;\n/**\n * Represent a 32-bit floating point number in big-endian format.\n *\n * *Factory*: {@link module:Layout.f32be|f32be}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass FloatBE extends Layout {\n constructor(property) {\n super(4, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readFloatBE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeFloatBE(src, offset);\n return 4;\n }\n}\nexports.FloatBE = FloatBE;\n/**\n * Represent a 64-bit floating point number in little-endian format.\n *\n * *Factory*: {@link module:Layout.f64|f64}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Double extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readDoubleLE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeDoubleLE(src, offset);\n return 8;\n }\n}\nexports.Double = Double;\n/**\n * Represent a 64-bit floating point number in big-endian format.\n *\n * *Factory*: {@link module:Layout.f64be|f64be}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass DoubleBE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readDoubleBE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeDoubleBE(src, offset);\n return 8;\n }\n}\nexports.DoubleBE = DoubleBE;\n/**\n * Represent a contiguous sequence of a specific layout as an Array.\n *\n * *Factory*: {@link module:Layout.seq|seq}\n *\n * @param {Layout} elementLayout - initializer for {@link\n * Sequence#elementLayout|elementLayout}.\n *\n * @param {(Number|ExternalLayout)} count - initializer for {@link\n * Sequence#count|count}. The parameter must be either a positive\n * integer or an instance of {@link ExternalLayout}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Sequence extends Layout {\n constructor(elementLayout, count, property) {\n if (!(elementLayout instanceof Layout)) {\n throw new TypeError('elementLayout must be a Layout');\n }\n if (!(((count instanceof ExternalLayout) && count.isCount())\n || (Number.isInteger(count) && (0 <= count)))) {\n throw new TypeError('count must be non-negative integer '\n + 'or an unsigned integer ExternalLayout');\n }\n let span = -1;\n if ((!(count instanceof ExternalLayout))\n && (0 < elementLayout.span)) {\n span = count * elementLayout.span;\n }\n super(span, property);\n /** The layout for individual elements of the sequence. */\n this.elementLayout = elementLayout;\n /** The number of elements in the sequence.\n *\n * This will be either a non-negative integer or an instance of\n * {@link ExternalLayout} for which {@link\n * ExternalLayout#isCount|isCount()} is `true`. */\n this.count = count;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n let span = 0;\n let count = this.count;\n if (count instanceof ExternalLayout) {\n count = count.decode(b, offset);\n }\n if (0 < this.elementLayout.span) {\n span = count * this.elementLayout.span;\n }\n else {\n let idx = 0;\n while (idx < count) {\n span += this.elementLayout.getSpan(b, offset + span);\n ++idx;\n }\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n const rv = [];\n let i = 0;\n let count = this.count;\n if (count instanceof ExternalLayout) {\n count = count.decode(b, offset);\n }\n while (i < count) {\n rv.push(this.elementLayout.decode(b, offset));\n offset += this.elementLayout.getSpan(b, offset);\n i += 1;\n }\n return rv;\n }\n /** Implement {@link Layout#encode|encode} for {@link Sequence}.\n *\n * **NOTE** If `src` is shorter than {@link Sequence#count|count} then\n * the unused space in the buffer is left unchanged. If `src` is\n * longer than {@link Sequence#count|count} the unneeded elements are\n * ignored.\n *\n * **NOTE** If {@link Layout#count|count} is an instance of {@link\n * ExternalLayout} then the length of `src` will be encoded as the\n * count after `src` is encoded. */\n encode(src, b, offset = 0) {\n const elo = this.elementLayout;\n const span = src.reduce((span, v) => {\n return span + elo.encode(v, b, offset + span);\n }, 0);\n if (this.count instanceof ExternalLayout) {\n this.count.encode(src.length, b, offset);\n }\n return span;\n }\n}\nexports.Sequence = Sequence;\n/**\n * Represent a contiguous sequence of arbitrary layout elements as an\n * Object.\n *\n * *Factory*: {@link module:Layout.struct|struct}\n *\n * **NOTE** The {@link Layout#span|span} of the structure is variable\n * if any layout in {@link Structure#fields|fields} has a variable\n * span. When {@link Layout#encode|encoding} we must have a value for\n * all variable-length fields, or we wouldn't be able to figure out\n * how much space to use for storage. We can only identify the value\n * for a field when it has a {@link Layout#property|property}. As\n * such, although a structure may contain both unnamed fields and\n * variable-length fields, it cannot contain an unnamed\n * variable-length field.\n *\n * @param {Layout[]} fields - initializer for {@link\n * Structure#fields|fields}. An error is raised if this contains a\n * variable-length field for which a {@link Layout#property|property}\n * is not defined.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @param {Boolean} [decodePrefixes] - initializer for {@link\n * Structure#decodePrefixes|property}.\n *\n * @throws {Error} - if `fields` contains an unnamed variable-length\n * layout.\n *\n * @augments {Layout}\n */\nclass Structure extends Layout {\n constructor(fields, property, decodePrefixes) {\n if (!(Array.isArray(fields)\n && fields.reduce((acc, v) => acc && (v instanceof Layout), true))) {\n throw new TypeError('fields must be array of Layout instances');\n }\n if (('boolean' === typeof property)\n && (undefined === decodePrefixes)) {\n decodePrefixes = property;\n property = undefined;\n }\n /* Verify absence of unnamed variable-length fields. */\n for (const fd of fields) {\n if ((0 > fd.span)\n && (undefined === fd.property)) {\n throw new Error('fields cannot contain unnamed variable-length layout');\n }\n }\n let span = -1;\n try {\n span = fields.reduce((span, fd) => span + fd.getSpan(), 0);\n }\n catch (e) {\n // ignore error\n }\n super(span, property);\n /** The sequence of {@link Layout} values that comprise the\n * structure.\n *\n * The individual elements need not be the same type, and may be\n * either scalar or aggregate layouts. If a member layout leaves\n * its {@link Layout#property|property} undefined the\n * corresponding region of the buffer associated with the element\n * will not be mutated.\n *\n * @type {Layout[]} */\n this.fields = fields;\n /** Control behavior of {@link Layout#decode|decode()} given short\n * buffers.\n *\n * In some situations a structure many be extended with additional\n * fields over time, with older installations providing only a\n * prefix of the full structure. If this property is `true`\n * decoding will accept those buffers and leave subsequent fields\n * undefined, as long as the buffer ends at a field boundary.\n * Defaults to `false`. */\n this.decodePrefixes = !!decodePrefixes;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n let span = 0;\n try {\n span = this.fields.reduce((span, fd) => {\n const fsp = fd.getSpan(b, offset);\n offset += fsp;\n return span + fsp;\n }, 0);\n }\n catch (e) {\n throw new RangeError('indeterminate span');\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n checkUint8Array(b);\n const dest = this.makeDestinationObject();\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n dest[fd.property] = fd.decode(b, offset);\n }\n offset += fd.getSpan(b, offset);\n if (this.decodePrefixes\n && (b.length === offset)) {\n break;\n }\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link Structure}.\n *\n * If `src` is missing a property for a member with a defined {@link\n * Layout#property|property} the corresponding region of the buffer is\n * left unmodified. */\n encode(src, b, offset = 0) {\n const firstOffset = offset;\n let lastOffset = 0;\n let lastWrote = 0;\n for (const fd of this.fields) {\n let span = fd.span;\n lastWrote = (0 < span) ? span : 0;\n if (undefined !== fd.property) {\n const fv = src[fd.property];\n if (undefined !== fv) {\n lastWrote = fd.encode(fv, b, offset);\n if (0 > span) {\n /* Read the as-encoded span, which is not necessarily the\n * same as what we wrote. */\n span = fd.getSpan(b, offset);\n }\n }\n }\n lastOffset = offset;\n offset += span;\n }\n /* Use (lastOffset + lastWrote) instead of offset because the last\n * item may have had a dynamic length and we don't want to include\n * the padding between it and the end of the space reserved for\n * it. */\n return (lastOffset + lastWrote) - firstOffset;\n }\n /** @override */\n fromArray(values) {\n const dest = this.makeDestinationObject();\n for (const fd of this.fields) {\n if ((undefined !== fd.property)\n && (0 < values.length)) {\n dest[fd.property] = values.shift();\n }\n }\n return dest;\n }\n /**\n * Get access to the layout of a given property.\n *\n * @param {String} property - the structure member of interest.\n *\n * @return {Layout} - the layout associated with `property`, or\n * undefined if there is no such property.\n */\n layoutFor(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n for (const fd of this.fields) {\n if (fd.property === property) {\n return fd;\n }\n }\n return undefined;\n }\n /**\n * Get the offset of a structure member.\n *\n * @param {String} property - the structure member of interest.\n *\n * @return {Number} - the offset in bytes to the start of `property`\n * within the structure, or undefined if `property` is not a field\n * within the structure. If the property is a member but follows a\n * variable-length structure member a negative number will be\n * returned.\n */\n offsetOf(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n let offset = 0;\n for (const fd of this.fields) {\n if (fd.property === property) {\n return offset;\n }\n if (0 > fd.span) {\n offset = -1;\n }\n else if (0 <= offset) {\n offset += fd.span;\n }\n }\n return undefined;\n }\n}\nexports.Structure = Structure;\n/**\n * An object that can provide a {@link\n * Union#discriminator|discriminator} API for {@link Union}.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support the {@link\n * UnionDiscriminator#encode|encode} or {@link\n * UnionDiscriminator#decode|decode} functions.\n *\n * @param {string} [property] - Default for {@link\n * UnionDiscriminator#property|property}.\n *\n * @abstract\n */\nclass UnionDiscriminator {\n constructor(property) {\n /** The {@link Layout#property|property} to be used when the\n * discriminator is referenced in isolation (generally when {@link\n * Union#decode|Union decode} cannot delegate to a specific\n * variant). */\n this.property = property;\n }\n /** Analog to {@link Layout#decode|Layout decode} for union discriminators.\n *\n * The implementation of this method need not reference the buffer if\n * variant information is available through other means. */\n decode(b, offset) {\n throw new Error('UnionDiscriminator is abstract');\n }\n /** Analog to {@link Layout#decode|Layout encode} for union discriminators.\n *\n * The implementation of this method need not store the value if\n * variant information is maintained through other means. */\n encode(src, b, offset) {\n throw new Error('UnionDiscriminator is abstract');\n }\n}\nexports.UnionDiscriminator = UnionDiscriminator;\n/**\n * An object that can provide a {@link\n * UnionDiscriminator|discriminator API} for {@link Union} using an\n * unsigned integral {@link Layout} instance located either inside or\n * outside the union.\n *\n * @param {ExternalLayout} layout - initializes {@link\n * UnionLayoutDiscriminator#layout|layout}. Must satisfy {@link\n * ExternalLayout#isCount|isCount()}.\n *\n * @param {string} [property] - Default for {@link\n * UnionDiscriminator#property|property}, superseding the property\n * from `layout`, but defaulting to `variant` if neither `property`\n * nor layout provide a property name.\n *\n * @augments {UnionDiscriminator}\n */\nclass UnionLayoutDiscriminator extends UnionDiscriminator {\n constructor(layout, property) {\n if (!((layout instanceof ExternalLayout)\n && layout.isCount())) {\n throw new TypeError('layout must be an unsigned integer ExternalLayout');\n }\n super(property || layout.property || 'variant');\n /** The {@link ExternalLayout} used to access the discriminator\n * value. */\n this.layout = layout;\n }\n /** Delegate decoding to {@link UnionLayoutDiscriminator#layout|layout}. */\n decode(b, offset) {\n return this.layout.decode(b, offset);\n }\n /** Delegate encoding to {@link UnionLayoutDiscriminator#layout|layout}. */\n encode(src, b, offset) {\n return this.layout.encode(src, b, offset);\n }\n}\nexports.UnionLayoutDiscriminator = UnionLayoutDiscriminator;\n/**\n * Represent any number of span-compatible layouts.\n *\n * *Factory*: {@link module:Layout.union|union}\n *\n * If the union has a {@link Union#defaultLayout|default layout} that\n * layout must have a non-negative {@link Layout#span|span}. The span\n * of a fixed-span union includes its {@link\n * Union#discriminator|discriminator} if the variant is a {@link\n * Union#usesPrefixDiscriminator|prefix of the union}, plus the span\n * of its {@link Union#defaultLayout|default layout}.\n *\n * If the union does not have a default layout then the encoded span\n * of the union depends on the encoded span of its variant (which may\n * be fixed or variable).\n *\n * {@link VariantLayout#layout|Variant layout}s are added through\n * {@link Union#addVariant|addVariant}. If the union has a default\n * layout, the span of the {@link VariantLayout#layout|layout\n * contained by the variant} must not exceed the span of the {@link\n * Union#defaultLayout|default layout} (minus the span of a {@link\n * Union#usesPrefixDiscriminator|prefix disriminator}, if used). The\n * span of the variant will equal the span of the union itself.\n *\n * The variant for a buffer can only be identified from the {@link\n * Union#discriminator|discriminator} {@link\n * UnionDiscriminator#property|property} (in the case of the {@link\n * Union#defaultLayout|default layout}), or by using {@link\n * Union#getVariant|getVariant} and examining the resulting {@link\n * VariantLayout} instance.\n *\n * A variant compatible with a JavaScript object can be identified\n * using {@link Union#getSourceVariant|getSourceVariant}.\n *\n * @param {(UnionDiscriminator|ExternalLayout|Layout)} discr - How to\n * identify the layout used to interpret the union contents. The\n * parameter must be an instance of {@link UnionDiscriminator}, an\n * {@link ExternalLayout} that satisfies {@link\n * ExternalLayout#isCount|isCount()}, or {@link UInt} (or {@link\n * UIntBE}). When a non-external layout element is passed the layout\n * appears at the start of the union. In all cases the (synthesized)\n * {@link UnionDiscriminator} instance is recorded as {@link\n * Union#discriminator|discriminator}.\n *\n * @param {(Layout|null)} defaultLayout - initializer for {@link\n * Union#defaultLayout|defaultLayout}. If absent defaults to `null`.\n * If `null` there is no default layout: the union has data-dependent\n * length and attempts to decode or encode unrecognized variants will\n * throw an exception. A {@link Layout} instance must have a\n * non-negative {@link Layout#span|span}, and if it lacks a {@link\n * Layout#property|property} the {@link\n * Union#defaultLayout|defaultLayout} will be a {@link\n * Layout#replicate|replica} with property `content`.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Union extends Layout {\n constructor(discr, defaultLayout, property) {\n let discriminator;\n if ((discr instanceof UInt)\n || (discr instanceof UIntBE)) {\n discriminator = new UnionLayoutDiscriminator(new OffsetLayout(discr));\n }\n else if ((discr instanceof ExternalLayout)\n && discr.isCount()) {\n discriminator = new UnionLayoutDiscriminator(discr);\n }\n else if (!(discr instanceof UnionDiscriminator)) {\n throw new TypeError('discr must be a UnionDiscriminator '\n + 'or an unsigned integer layout');\n }\n else {\n discriminator = discr;\n }\n if (undefined === defaultLayout) {\n defaultLayout = null;\n }\n if (!((null === defaultLayout)\n || (defaultLayout instanceof Layout))) {\n throw new TypeError('defaultLayout must be null or a Layout');\n }\n if (null !== defaultLayout) {\n if (0 > defaultLayout.span) {\n throw new Error('defaultLayout must have constant span');\n }\n if (undefined === defaultLayout.property) {\n defaultLayout = defaultLayout.replicate('content');\n }\n }\n /* The union span can be estimated only if there's a default\n * layout. The union spans its default layout, plus any prefix\n * variant layout. By construction both layouts, if present, have\n * non-negative span. */\n let span = -1;\n if (defaultLayout) {\n span = defaultLayout.span;\n if ((0 <= span) && ((discr instanceof UInt)\n || (discr instanceof UIntBE))) {\n span += discriminator.layout.span;\n }\n }\n super(span, property);\n /** The interface for the discriminator value in isolation.\n *\n * This a {@link UnionDiscriminator} either passed to the\n * constructor or synthesized from the `discr` constructor\n * argument. {@link\n * Union#usesPrefixDiscriminator|usesPrefixDiscriminator} will be\n * `true` iff the `discr` parameter was a non-offset {@link\n * Layout} instance. */\n this.discriminator = discriminator;\n /** `true` if the {@link Union#discriminator|discriminator} is the\n * first field in the union.\n *\n * If `false` the discriminator is obtained from somewhere\n * else. */\n this.usesPrefixDiscriminator = (discr instanceof UInt)\n || (discr instanceof UIntBE);\n /** The layout for non-discriminator content when the value of the\n * discriminator is not recognized.\n *\n * This is the value passed to the constructor. It is\n * structurally equivalent to the second component of {@link\n * Union#layout|layout} but may have a different property\n * name. */\n this.defaultLayout = defaultLayout;\n /** A registry of allowed variants.\n *\n * The keys are unsigned integers which should be compatible with\n * {@link Union.discriminator|discriminator}. The property value\n * is the corresponding {@link VariantLayout} instances assigned\n * to this union by {@link Union#addVariant|addVariant}.\n *\n * **NOTE** The registry remains mutable so that variants can be\n * {@link Union#addVariant|added} at any time. Users should not\n * manipulate the content of this property. */\n this.registry = {};\n /* Private variable used when invoking getSourceVariant */\n let boundGetSourceVariant = this.defaultGetSourceVariant.bind(this);\n /** Function to infer the variant selected by a source object.\n *\n * Defaults to {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant} but may\n * be overridden using {@link\n * Union#configGetSourceVariant|configGetSourceVariant}.\n *\n * @param {Object} src - as with {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant}.\n *\n * @returns {(undefined|VariantLayout)} The default variant\n * (`undefined`) or first registered variant that uses a property\n * available in `src`. */\n this.getSourceVariant = function (src) {\n return boundGetSourceVariant(src);\n };\n /** Function to override the implementation of {@link\n * Union#getSourceVariant|getSourceVariant}.\n *\n * Use this if the desired variant cannot be identified using the\n * algorithm of {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant}.\n *\n * **NOTE** The provided function will be invoked bound to this\n * Union instance, providing local access to {@link\n * Union#registry|registry}.\n *\n * @param {Function} gsv - a function that follows the API of\n * {@link Union#defaultGetSourceVariant|defaultGetSourceVariant}. */\n this.configGetSourceVariant = function (gsv) {\n boundGetSourceVariant = gsv.bind(this);\n };\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n /* Default layouts always have non-negative span, so we don't have\n * one and we have to recognize the variant which will in turn\n * determine the span. */\n const vlo = this.getVariant(b, offset);\n if (!vlo) {\n throw new Error('unable to determine span for unrecognized variant');\n }\n return vlo.getSpan(b, offset);\n }\n /**\n * Method to infer a registered Union variant compatible with `src`.\n *\n * The first satisfied rule in the following sequence defines the\n * return value:\n * * If `src` has properties matching the Union discriminator and\n * the default layout, `undefined` is returned regardless of the\n * value of the discriminator property (this ensures the default\n * layout will be used);\n * * If `src` has a property matching the Union discriminator, the\n * value of the discriminator identifies a registered variant, and\n * either (a) the variant has no layout, or (b) `src` has the\n * variant's property, then the variant is returned (because the\n * source satisfies the constraints of the variant it identifies);\n * * If `src` does not have a property matching the Union\n * discriminator, but does have a property matching a registered\n * variant, then the variant is returned (because the source\n * matches a variant without an explicit conflict);\n * * An error is thrown (because we either can't identify a variant,\n * or we were explicitly told the variant but can't satisfy it).\n *\n * @param {Object} src - an object presumed to be compatible with\n * the content of the Union.\n *\n * @return {(undefined|VariantLayout)} - as described above.\n *\n * @throws {Error} - if `src` cannot be associated with a default or\n * registered variant.\n */\n defaultGetSourceVariant(src) {\n if (Object.prototype.hasOwnProperty.call(src, this.discriminator.property)) {\n if (this.defaultLayout && this.defaultLayout.property\n && Object.prototype.hasOwnProperty.call(src, this.defaultLayout.property)) {\n return undefined;\n }\n const vlo = this.registry[src[this.discriminator.property]];\n if (vlo\n && ((!vlo.layout)\n || (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)))) {\n return vlo;\n }\n }\n else {\n for (const tag in this.registry) {\n const vlo = this.registry[tag];\n if (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)) {\n return vlo;\n }\n }\n }\n throw new Error('unable to infer src variant');\n }\n /** Implement {@link Layout#decode|decode} for {@link Union}.\n *\n * If the variant is {@link Union#addVariant|registered} the return\n * value is an instance of that variant, with no explicit\n * discriminator. Otherwise the {@link Union#defaultLayout|default\n * layout} is used to decode the content. */\n decode(b, offset = 0) {\n let dest;\n const dlo = this.discriminator;\n const discr = dlo.decode(b, offset);\n const clo = this.registry[discr];\n if (undefined === clo) {\n const defaultLayout = this.defaultLayout;\n let contentOffset = 0;\n if (this.usesPrefixDiscriminator) {\n contentOffset = dlo.layout.span;\n }\n dest = this.makeDestinationObject();\n dest[dlo.property] = discr;\n // defaultLayout.property can be undefined, but this is allowed by buffer-layout\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n dest[defaultLayout.property] = defaultLayout.decode(b, offset + contentOffset);\n }\n else {\n dest = clo.decode(b, offset);\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link Union}.\n *\n * This API assumes the `src` object is consistent with the union's\n * {@link Union#defaultLayout|default layout}. To encode variants\n * use the appropriate variant-specific {@link VariantLayout#encode}\n * method. */\n encode(src, b, offset = 0) {\n const vlo = this.getSourceVariant(src);\n if (undefined === vlo) {\n const dlo = this.discriminator;\n // this.defaultLayout is not undefined when vlo is undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const clo = this.defaultLayout;\n let contentOffset = 0;\n if (this.usesPrefixDiscriminator) {\n contentOffset = dlo.layout.span;\n }\n dlo.encode(src[dlo.property], b, offset);\n // clo.property is not undefined when vlo is undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return contentOffset + clo.encode(src[clo.property], b, offset + contentOffset);\n }\n return vlo.encode(src, b, offset);\n }\n /** Register a new variant structure within a union. The newly\n * created variant is returned.\n *\n * @param {Number} variant - initializer for {@link\n * VariantLayout#variant|variant}.\n *\n * @param {Layout} layout - initializer for {@link\n * VariantLayout#layout|layout}.\n *\n * @param {String} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {VariantLayout} */\n addVariant(variant, layout, property) {\n const rv = new VariantLayout(this, variant, layout, property);\n this.registry[variant] = rv;\n return rv;\n }\n /**\n * Get the layout associated with a registered variant.\n *\n * If `vb` does not produce a registered variant the function returns\n * `undefined`.\n *\n * @param {(Number|Uint8Array)} vb - either the variant number, or a\n * buffer from which the discriminator is to be read.\n *\n * @param {Number} offset - offset into `vb` for the start of the\n * union. Used only when `vb` is an instance of {Uint8Array}.\n *\n * @return {({VariantLayout}|undefined)}\n */\n getVariant(vb, offset = 0) {\n let variant;\n if (vb instanceof Uint8Array) {\n variant = this.discriminator.decode(vb, offset);\n }\n else {\n variant = vb;\n }\n return this.registry[variant];\n }\n}\nexports.Union = Union;\n/**\n * Represent a specific variant within a containing union.\n *\n * **NOTE** The {@link Layout#span|span} of the variant may include\n * the span of the {@link Union#discriminator|discriminator} used to\n * identify it, but values read and written using the variant strictly\n * conform to the content of {@link VariantLayout#layout|layout}.\n *\n * **NOTE** User code should not invoke this constructor directly. Use\n * the union {@link Union#addVariant|addVariant} helper method.\n *\n * @param {Union} union - initializer for {@link\n * VariantLayout#union|union}.\n *\n * @param {Number} variant - initializer for {@link\n * VariantLayout#variant|variant}.\n *\n * @param {Layout} [layout] - initializer for {@link\n * VariantLayout#layout|layout}. If absent the variant carries no\n * data.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}. Unlike many other layouts, variant\n * layouts normally include a property name so they can be identified\n * within their containing {@link Union}. The property identifier may\n * be absent only if `layout` is is absent.\n *\n * @augments {Layout}\n */\nclass VariantLayout extends Layout {\n constructor(union, variant, layout, property) {\n if (!(union instanceof Union)) {\n throw new TypeError('union must be a Union');\n }\n if ((!Number.isInteger(variant)) || (0 > variant)) {\n throw new TypeError('variant must be a (non-negative) integer');\n }\n if (('string' === typeof layout)\n && (undefined === property)) {\n property = layout;\n layout = null;\n }\n if (layout) {\n if (!(layout instanceof Layout)) {\n throw new TypeError('layout must be a Layout');\n }\n if ((null !== union.defaultLayout)\n && (0 <= layout.span)\n && (layout.span > union.defaultLayout.span)) {\n throw new Error('variant span exceeds span of containing union');\n }\n if ('string' !== typeof property) {\n throw new TypeError('variant must have a String property');\n }\n }\n let span = union.span;\n if (0 > union.span) {\n span = layout ? layout.span : 0;\n if ((0 <= span) && union.usesPrefixDiscriminator) {\n span += union.discriminator.layout.span;\n }\n }\n super(span, property);\n /** The {@link Union} to which this variant belongs. */\n this.union = union;\n /** The unsigned integral value identifying this variant within\n * the {@link Union#discriminator|discriminator} of the containing\n * union. */\n this.variant = variant;\n /** The {@link Layout} to be used when reading/writing the\n * non-discriminator part of the {@link\n * VariantLayout#union|union}. If `null` the variant carries no\n * data. */\n this.layout = layout || null;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n /* Will be equal to the containing union span if that is not\n * variable. */\n return this.span;\n }\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n /* Span is defined solely by the variant (and prefix discriminator) */\n let span = 0;\n if (this.layout) {\n span = this.layout.getSpan(b, offset + contentOffset);\n }\n return contentOffset + span;\n }\n /** @override */\n decode(b, offset = 0) {\n const dest = this.makeDestinationObject();\n if (this !== this.union.getVariant(b, offset)) {\n throw new Error('variant mismatch');\n }\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n if (this.layout) {\n dest[this.property] = this.layout.decode(b, offset + contentOffset);\n }\n else if (this.property) {\n dest[this.property] = true;\n }\n else if (this.union.usesPrefixDiscriminator) {\n dest[this.union.discriminator.property] = this.variant;\n }\n return dest;\n }\n /** @override */\n encode(src, b, offset = 0) {\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n if (this.layout\n && (!Object.prototype.hasOwnProperty.call(src, this.property))) {\n throw new TypeError('variant lacks property ' + this.property);\n }\n this.union.discriminator.encode(this.variant, b, offset);\n let span = contentOffset;\n if (this.layout) {\n this.layout.encode(src[this.property], b, offset + contentOffset);\n span += this.layout.getSpan(b, offset + contentOffset);\n if ((0 <= this.union.span)\n && (span > this.union.span)) {\n throw new Error('encoded variant overruns containing union');\n }\n }\n return span;\n }\n /** Delegate {@link Layout#fromArray|fromArray} to {@link\n * VariantLayout#layout|layout}. */\n fromArray(values) {\n if (this.layout) {\n return this.layout.fromArray(values);\n }\n return undefined;\n }\n}\nexports.VariantLayout = VariantLayout;\n/** JavaScript chose to define bitwise operations as operating on\n * signed 32-bit values in 2's complement form, meaning any integer\n * with bit 31 set is going to look negative. For right shifts that's\n * not a problem, because `>>>` is a logical shift, but for every\n * other bitwise operator we have to compensate for possible negative\n * results. */\nfunction fixBitwiseResult(v) {\n if (0 > v) {\n v += 0x100000000;\n }\n return v;\n}\n/**\n * Contain a sequence of bit fields as an unsigned integer.\n *\n * *Factory*: {@link module:Layout.bits|bits}\n *\n * This is a container element; within it there are {@link BitField}\n * instances that provide the extracted properties. The container\n * simply defines the aggregate representation and its bit ordering.\n * The representation is an object containing properties with numeric\n * or {@link Boolean} values.\n *\n * {@link BitField}s are added with the {@link\n * BitStructure#addField|addField} and {@link\n * BitStructure#addBoolean|addBoolean} methods.\n\n * @param {Layout} word - initializer for {@link\n * BitStructure#word|word}. The parameter must be an instance of\n * {@link UInt} (or {@link UIntBE}) that is no more than 4 bytes wide.\n *\n * @param {bool} [msb] - `true` if the bit numbering starts at the\n * most significant bit of the containing word; `false` (default) if\n * it starts at the least significant bit of the containing word. If\n * the parameter at this position is a string and `property` is\n * `undefined` the value of this argument will instead be used as the\n * value of `property`.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass BitStructure extends Layout {\n constructor(word, msb, property) {\n if (!((word instanceof UInt)\n || (word instanceof UIntBE))) {\n throw new TypeError('word must be a UInt or UIntBE layout');\n }\n if (('string' === typeof msb)\n && (undefined === property)) {\n property = msb;\n msb = false;\n }\n if (4 < word.span) {\n throw new RangeError('word cannot exceed 32 bits');\n }\n super(word.span, property);\n /** The layout used for the packed value. {@link BitField}\n * instances are packed sequentially depending on {@link\n * BitStructure#msb|msb}. */\n this.word = word;\n /** Whether the bit sequences are packed starting at the most\n * significant bit growing down (`true`), or the least significant\n * bit growing up (`false`).\n *\n * **NOTE** Regardless of this value, the least significant bit of\n * any {@link BitField} value is the least significant bit of the\n * corresponding section of the packed value. */\n this.msb = !!msb;\n /** The sequence of {@link BitField} layouts that comprise the\n * packed structure.\n *\n * **NOTE** The array remains mutable to allow fields to be {@link\n * BitStructure#addField|added} after construction. Users should\n * not manipulate the content of this property.*/\n this.fields = [];\n /* Storage for the value. Capture a variable instead of using an\n * instance property because we don't want anything to change the\n * value without going through the mutator. */\n let value = 0;\n this._packedSetValue = function (v) {\n value = fixBitwiseResult(v);\n return this;\n };\n this._packedGetValue = function () {\n return value;\n };\n }\n /** @override */\n decode(b, offset = 0) {\n const dest = this.makeDestinationObject();\n const value = this.word.decode(b, offset);\n this._packedSetValue(value);\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n dest[fd.property] = fd.decode(b);\n }\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link BitStructure}.\n *\n * If `src` is missing a property for a member with a defined {@link\n * Layout#property|property} the corresponding region of the packed\n * value is left unmodified. Unused bits are also left unmodified. */\n encode(src, b, offset = 0) {\n const value = this.word.decode(b, offset);\n this._packedSetValue(value);\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n const fv = src[fd.property];\n if (undefined !== fv) {\n fd.encode(fv);\n }\n }\n }\n return this.word.encode(this._packedGetValue(), b, offset);\n }\n /** Register a new bitfield with a containing bit structure. The\n * resulting bitfield is returned.\n *\n * @param {Number} bits - initializer for {@link BitField#bits|bits}.\n *\n * @param {string} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {BitField} */\n addField(bits, property) {\n const bf = new BitField(this, bits, property);\n this.fields.push(bf);\n return bf;\n }\n /** As with {@link BitStructure#addField|addField} for single-bit\n * fields with `boolean` value representation.\n *\n * @param {string} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {Boolean} */\n // `Boolean` conflicts with the native primitive type\n // eslint-disable-next-line @typescript-eslint/ban-types\n addBoolean(property) {\n // This is my Boolean, not the Javascript one.\n const bf = new Boolean(this, property);\n this.fields.push(bf);\n return bf;\n }\n /**\n * Get access to the bit field for a given property.\n *\n * @param {String} property - the bit field of interest.\n *\n * @return {BitField} - the field associated with `property`, or\n * undefined if there is no such property.\n */\n fieldFor(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n for (const fd of this.fields) {\n if (fd.property === property) {\n return fd;\n }\n }\n return undefined;\n }\n}\nexports.BitStructure = BitStructure;\n/**\n * Represent a sequence of bits within a {@link BitStructure}.\n *\n * All bit field values are represented as unsigned integers.\n *\n * **NOTE** User code should not invoke this constructor directly.\n * Use the container {@link BitStructure#addField|addField} helper\n * method.\n *\n * **NOTE** BitField instances are not instances of {@link Layout}\n * since {@link Layout#span|span} measures 8-bit units.\n *\n * @param {BitStructure} container - initializer for {@link\n * BitField#container|container}.\n *\n * @param {Number} bits - initializer for {@link BitField#bits|bits}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n */\nclass BitField {\n constructor(container, bits, property) {\n if (!(container instanceof BitStructure)) {\n throw new TypeError('container must be a BitStructure');\n }\n if ((!Number.isInteger(bits)) || (0 >= bits)) {\n throw new TypeError('bits must be positive integer');\n }\n const totalBits = 8 * container.span;\n const usedBits = container.fields.reduce((sum, fd) => sum + fd.bits, 0);\n if ((bits + usedBits) > totalBits) {\n throw new Error('bits too long for span remainder ('\n + (totalBits - usedBits) + ' of '\n + totalBits + ' remain)');\n }\n /** The {@link BitStructure} instance to which this bit field\n * belongs. */\n this.container = container;\n /** The span of this value in bits. */\n this.bits = bits;\n /** A mask of {@link BitField#bits|bits} bits isolating value bits\n * that fit within the field.\n *\n * That is, it masks a value that has not yet been shifted into\n * position within its containing packed integer. */\n this.valueMask = (1 << bits) - 1;\n if (32 === bits) { // shifted value out of range\n this.valueMask = 0xFFFFFFFF;\n }\n /** The offset of the value within the containing packed unsigned\n * integer. The least significant bit of the packed value is at\n * offset zero, regardless of bit ordering used. */\n this.start = usedBits;\n if (this.container.msb) {\n this.start = totalBits - usedBits - bits;\n }\n /** A mask of {@link BitField#bits|bits} isolating the field value\n * within the containing packed unsigned integer. */\n this.wordMask = fixBitwiseResult(this.valueMask << this.start);\n /** The property name used when this bitfield is represented in an\n * Object.\n *\n * Intended to be functionally equivalent to {@link\n * Layout#property}.\n *\n * If left undefined the corresponding span of bits will be\n * treated as padding: it will not be mutated by {@link\n * Layout#encode|encode} nor represented as a property in the\n * decoded Object. */\n this.property = property;\n }\n /** Store a value into the corresponding subsequence of the containing\n * bit field. */\n decode(b, offset) {\n const word = this.container._packedGetValue();\n const wordValue = fixBitwiseResult(word & this.wordMask);\n const value = wordValue >>> this.start;\n return value;\n }\n /** Store a value into the corresponding subsequence of the containing\n * bit field.\n *\n * **NOTE** This is not a specialization of {@link\n * Layout#encode|Layout.encode} and there is no return value. */\n encode(value) {\n if ('number' !== typeof value\n || !Number.isInteger(value)\n || (value !== fixBitwiseResult(value & this.valueMask))) {\n throw new TypeError(nameWithProperty('BitField.encode', this)\n + ' value must be integer not exceeding ' + this.valueMask);\n }\n const word = this.container._packedGetValue();\n const wordValue = fixBitwiseResult(value << this.start);\n this.container._packedSetValue(fixBitwiseResult(word & ~this.wordMask)\n | wordValue);\n }\n}\nexports.BitField = BitField;\n/**\n * Represent a single bit within a {@link BitStructure} as a\n * JavaScript boolean.\n *\n * **NOTE** User code should not invoke this constructor directly.\n * Use the container {@link BitStructure#addBoolean|addBoolean} helper\n * method.\n *\n * @param {BitStructure} container - initializer for {@link\n * BitField#container|container}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {BitField}\n */\n/* eslint-disable no-extend-native */\nclass Boolean extends BitField {\n constructor(container, property) {\n super(container, 1, property);\n }\n /** Override {@link BitField#decode|decode} for {@link Boolean|Boolean}.\n *\n * @returns {boolean} */\n decode(b, offset) {\n return !!super.decode(b, offset);\n }\n /** @override */\n encode(value) {\n if ('boolean' === typeof value) {\n // BitField requires integer values\n value = +value;\n }\n super.encode(value);\n }\n}\nexports.Boolean = Boolean;\n/* eslint-enable no-extend-native */\n/**\n * Contain a fixed-length block of arbitrary data, represented as a\n * Uint8Array.\n *\n * *Factory*: {@link module:Layout.blob|blob}\n *\n * @param {(Number|ExternalLayout)} length - initializes {@link\n * Blob#length|length}.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Blob extends Layout {\n constructor(length, property) {\n if (!(((length instanceof ExternalLayout) && length.isCount())\n || (Number.isInteger(length) && (0 <= length)))) {\n throw new TypeError('length must be positive integer '\n + 'or an unsigned integer ExternalLayout');\n }\n let span = -1;\n if (!(length instanceof ExternalLayout)) {\n span = length;\n }\n super(span, property);\n /** The number of bytes in the blob.\n *\n * This may be a non-negative integer, or an instance of {@link\n * ExternalLayout} that satisfies {@link\n * ExternalLayout#isCount|isCount()}. */\n this.length = length;\n }\n /** @override */\n getSpan(b, offset) {\n let span = this.span;\n if (0 > span) {\n span = this.length.decode(b, offset);\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n let span = this.span;\n if (0 > span) {\n span = this.length.decode(b, offset);\n }\n return uint8ArrayToBuffer(b).slice(offset, offset + span);\n }\n /** Implement {@link Layout#encode|encode} for {@link Blob}.\n *\n * **NOTE** If {@link Layout#count|count} is an instance of {@link\n * ExternalLayout} then the length of `src` will be encoded as the\n * count after `src` is encoded. */\n encode(src, b, offset) {\n let span = this.length;\n if (this.length instanceof ExternalLayout) {\n span = src.length;\n }\n if (!(src instanceof Uint8Array && span === src.length)) {\n throw new TypeError(nameWithProperty('Blob.encode', this)\n + ' requires (length ' + span + ') Uint8Array as src');\n }\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Uint8Array');\n }\n const srcBuffer = uint8ArrayToBuffer(src);\n uint8ArrayToBuffer(b).write(srcBuffer.toString('hex'), offset, span, 'hex');\n if (this.length instanceof ExternalLayout) {\n this.length.encode(span, b, offset);\n }\n return span;\n }\n}\nexports.Blob = Blob;\n/**\n * Contain a `NUL`-terminated UTF8 string.\n *\n * *Factory*: {@link module:Layout.cstr|cstr}\n *\n * **NOTE** Any UTF8 string that incorporates a zero-valued byte will\n * not be correctly decoded by this layout.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass CString extends Layout {\n constructor(property) {\n super(-1, property);\n }\n /** @override */\n getSpan(b, offset = 0) {\n checkUint8Array(b);\n let idx = offset;\n while ((idx < b.length) && (0 !== b[idx])) {\n idx += 1;\n }\n return 1 + idx - offset;\n }\n /** @override */\n decode(b, offset = 0) {\n const span = this.getSpan(b, offset);\n return uint8ArrayToBuffer(b).slice(offset, offset + span - 1).toString('utf-8');\n }\n /** @override */\n encode(src, b, offset = 0) {\n /* Must force this to a string, lest it be a number and the\n * \"utf8-encoding\" below actually allocate a buffer of length\n * src */\n if ('string' !== typeof src) {\n src = String(src);\n }\n const srcb = buffer_1.Buffer.from(src, 'utf8');\n const span = srcb.length;\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Buffer');\n }\n const buffer = uint8ArrayToBuffer(b);\n srcb.copy(buffer, offset);\n buffer[offset + span] = 0;\n return span + 1;\n }\n}\nexports.CString = CString;\n/**\n * Contain a UTF8 string with implicit length.\n *\n * *Factory*: {@link module:Layout.utf8|utf8}\n *\n * **NOTE** Because the length is implicit in the size of the buffer\n * this layout should be used only in isolation, or in a situation\n * where the length can be expressed by operating on a slice of the\n * containing buffer.\n *\n * @param {Number} [maxSpan] - the maximum length allowed for encoded\n * string content. If not provided there is no bound on the allowed\n * content.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UTF8 extends Layout {\n constructor(maxSpan, property) {\n if (('string' === typeof maxSpan) && (undefined === property)) {\n property = maxSpan;\n maxSpan = undefined;\n }\n if (undefined === maxSpan) {\n maxSpan = -1;\n }\n else if (!Number.isInteger(maxSpan)) {\n throw new TypeError('maxSpan must be an integer');\n }\n super(-1, property);\n /** The maximum span of the layout in bytes.\n *\n * Positive values are generally expected. Zero is abnormal.\n * Attempts to encode or decode a value that exceeds this length\n * will throw a `RangeError`.\n *\n * A negative value indicates that there is no bound on the length\n * of the content. */\n this.maxSpan = maxSpan;\n }\n /** @override */\n getSpan(b, offset = 0) {\n checkUint8Array(b);\n return b.length - offset;\n }\n /** @override */\n decode(b, offset = 0) {\n const span = this.getSpan(b, offset);\n if ((0 <= this.maxSpan)\n && (this.maxSpan < span)) {\n throw new RangeError('text length exceeds maxSpan');\n }\n return uint8ArrayToBuffer(b).slice(offset, offset + span).toString('utf-8');\n }\n /** @override */\n encode(src, b, offset = 0) {\n /* Must force this to a string, lest it be a number and the\n * \"utf8-encoding\" below actually allocate a buffer of length\n * src */\n if ('string' !== typeof src) {\n src = String(src);\n }\n const srcb = buffer_1.Buffer.from(src, 'utf8');\n const span = srcb.length;\n if ((0 <= this.maxSpan)\n && (this.maxSpan < span)) {\n throw new RangeError('text length exceeds maxSpan');\n }\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Buffer');\n }\n srcb.copy(uint8ArrayToBuffer(b), offset);\n return span;\n }\n}\nexports.UTF8 = UTF8;\n/**\n * Contain a constant value.\n *\n * This layout may be used in cases where a JavaScript value can be\n * inferred without an expression in the binary encoding. An example\n * would be a {@link VariantLayout|variant layout} where the content\n * is implied by the union {@link Union#discriminator|discriminator}.\n *\n * @param {Object|Number|String} value - initializer for {@link\n * Constant#value|value}. If the value is an object (or array) and\n * the application intends the object to remain unchanged regardless\n * of what is done to values decoded by this layout, the value should\n * be frozen prior passing it to this constructor.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Constant extends Layout {\n constructor(value, property) {\n super(0, property);\n /** The value produced by this constant when the layout is {@link\n * Constant#decode|decoded}.\n *\n * Any JavaScript value including `null` and `undefined` is\n * permitted.\n *\n * **WARNING** If `value` passed in the constructor was not\n * frozen, it is possible for users of decoded values to change\n * the content of the value. */\n this.value = value;\n }\n /** @override */\n decode(b, offset) {\n return this.value;\n }\n /** @override */\n encode(src, b, offset) {\n /* Constants take no space */\n return 0;\n }\n}\nexports.Constant = Constant;\n/** Factory for {@link GreedyCount}. */\nexports.greedy = ((elementSpan, property) => new GreedyCount(elementSpan, property));\n/** Factory for {@link OffsetLayout}. */\nexports.offset = ((layout, offset, property) => new OffsetLayout(layout, offset, property));\n/** Factory for {@link UInt|unsigned int layouts} spanning one\n * byte. */\nexports.u8 = ((property) => new UInt(1, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning two bytes. */\nexports.u16 = ((property) => new UInt(2, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning three bytes. */\nexports.u24 = ((property) => new UInt(3, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning four bytes. */\nexports.u32 = ((property) => new UInt(4, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning five bytes. */\nexports.u40 = ((property) => new UInt(5, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning six bytes. */\nexports.u48 = ((property) => new UInt(6, property));\n/** Factory for {@link NearUInt64|little-endian unsigned int\n * layouts} interpreted as Numbers. */\nexports.nu64 = ((property) => new NearUInt64(property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning two bytes. */\nexports.u16be = ((property) => new UIntBE(2, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning three bytes. */\nexports.u24be = ((property) => new UIntBE(3, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning four bytes. */\nexports.u32be = ((property) => new UIntBE(4, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning five bytes. */\nexports.u40be = ((property) => new UIntBE(5, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning six bytes. */\nexports.u48be = ((property) => new UIntBE(6, property));\n/** Factory for {@link NearUInt64BE|big-endian unsigned int\n * layouts} interpreted as Numbers. */\nexports.nu64be = ((property) => new NearUInt64BE(property));\n/** Factory for {@link Int|signed int layouts} spanning one\n * byte. */\nexports.s8 = ((property) => new Int(1, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning two bytes. */\nexports.s16 = ((property) => new Int(2, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning three bytes. */\nexports.s24 = ((property) => new Int(3, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning four bytes. */\nexports.s32 = ((property) => new Int(4, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning five bytes. */\nexports.s40 = ((property) => new Int(5, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning six bytes. */\nexports.s48 = ((property) => new Int(6, property));\n/** Factory for {@link NearInt64|little-endian signed int layouts}\n * interpreted as Numbers. */\nexports.ns64 = ((property) => new NearInt64(property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning two bytes. */\nexports.s16be = ((property) => new IntBE(2, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning three bytes. */\nexports.s24be = ((property) => new IntBE(3, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning four bytes. */\nexports.s32be = ((property) => new IntBE(4, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning five bytes. */\nexports.s40be = ((property) => new IntBE(5, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning six bytes. */\nexports.s48be = ((property) => new IntBE(6, property));\n/** Factory for {@link NearInt64BE|big-endian signed int layouts}\n * interpreted as Numbers. */\nexports.ns64be = ((property) => new NearInt64BE(property));\n/** Factory for {@link Float|little-endian 32-bit floating point} values. */\nexports.f32 = ((property) => new Float(property));\n/** Factory for {@link FloatBE|big-endian 32-bit floating point} values. */\nexports.f32be = ((property) => new FloatBE(property));\n/** Factory for {@link Double|little-endian 64-bit floating point} values. */\nexports.f64 = ((property) => new Double(property));\n/** Factory for {@link DoubleBE|big-endian 64-bit floating point} values. */\nexports.f64be = ((property) => new DoubleBE(property));\n/** Factory for {@link Structure} values. */\nexports.struct = ((fields, property, decodePrefixes) => new Structure(fields, property, decodePrefixes));\n/** Factory for {@link BitStructure} values. */\nexports.bits = ((word, msb, property) => new BitStructure(word, msb, property));\n/** Factory for {@link Sequence} values. */\nexports.seq = ((elementLayout, count, property) => new Sequence(elementLayout, count, property));\n/** Factory for {@link Union} values. */\nexports.union = ((discr, defaultLayout, property) => new Union(discr, defaultLayout, property));\n/** Factory for {@link UnionLayoutDiscriminator} values. */\nexports.unionLayoutDiscriminator = ((layout, property) => new UnionLayoutDiscriminator(layout, property));\n/** Factory for {@link Blob} values. */\nexports.blob = ((length, property) => new Blob(length, property));\n/** Factory for {@link CString} values. */\nexports.cstr = ((property) => new CString(property));\n/** Factory for {@link UTF8} values. */\nexports.utf8 = ((maxSpan, property) => new UTF8(maxSpan, property));\n/** Factory for {@link Constant} values. */\nexports.constant = ((value, property) => new Constant(value, property));\n//# sourceMappingURL=Layout.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@solana+buffer-layout@4.0.1/node_modules/@solana/buffer-layout/lib/Layout.js?")},"./node_modules/.pnpm/@solana+web3.js@1.95.3_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@solana/web3.js/lib/index.browser.esm.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Account: () => (/* binding */ Account),\n/* harmony export */ AddressLookupTableAccount: () => (/* binding */ AddressLookupTableAccount),\n/* harmony export */ AddressLookupTableInstruction: () => (/* binding */ AddressLookupTableInstruction),\n/* harmony export */ AddressLookupTableProgram: () => (/* binding */ AddressLookupTableProgram),\n/* harmony export */ Authorized: () => (/* binding */ Authorized),\n/* harmony export */ BLOCKHASH_CACHE_TIMEOUT_MS: () => (/* binding */ BLOCKHASH_CACHE_TIMEOUT_MS),\n/* harmony export */ BPF_LOADER_DEPRECATED_PROGRAM_ID: () => (/* binding */ BPF_LOADER_DEPRECATED_PROGRAM_ID),\n/* harmony export */ BPF_LOADER_PROGRAM_ID: () => (/* binding */ BPF_LOADER_PROGRAM_ID),\n/* harmony export */ BpfLoader: () => (/* binding */ BpfLoader),\n/* harmony export */ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS: () => (/* binding */ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS),\n/* harmony export */ ComputeBudgetInstruction: () => (/* binding */ ComputeBudgetInstruction),\n/* harmony export */ ComputeBudgetProgram: () => (/* binding */ ComputeBudgetProgram),\n/* harmony export */ Connection: () => (/* binding */ Connection),\n/* harmony export */ Ed25519Program: () => (/* binding */ Ed25519Program),\n/* harmony export */ Enum: () => (/* binding */ Enum),\n/* harmony export */ EpochSchedule: () => (/* binding */ EpochSchedule),\n/* harmony export */ FeeCalculatorLayout: () => (/* binding */ FeeCalculatorLayout),\n/* harmony export */ Keypair: () => (/* binding */ Keypair),\n/* harmony export */ LAMPORTS_PER_SOL: () => (/* binding */ LAMPORTS_PER_SOL),\n/* harmony export */ LOOKUP_TABLE_INSTRUCTION_LAYOUTS: () => (/* binding */ LOOKUP_TABLE_INSTRUCTION_LAYOUTS),\n/* harmony export */ Loader: () => (/* binding */ Loader),\n/* harmony export */ Lockup: () => (/* binding */ Lockup),\n/* harmony export */ MAX_SEED_LENGTH: () => (/* binding */ MAX_SEED_LENGTH),\n/* harmony export */ Message: () => (/* binding */ Message),\n/* harmony export */ MessageAccountKeys: () => (/* binding */ MessageAccountKeys),\n/* harmony export */ MessageV0: () => (/* binding */ MessageV0),\n/* harmony export */ NONCE_ACCOUNT_LENGTH: () => (/* binding */ NONCE_ACCOUNT_LENGTH),\n/* harmony export */ NonceAccount: () => (/* binding */ NonceAccount),\n/* harmony export */ PACKET_DATA_SIZE: () => (/* binding */ PACKET_DATA_SIZE),\n/* harmony export */ PUBLIC_KEY_LENGTH: () => (/* binding */ PUBLIC_KEY_LENGTH),\n/* harmony export */ PublicKey: () => (/* binding */ PublicKey),\n/* harmony export */ SIGNATURE_LENGTH_IN_BYTES: () => (/* binding */ SIGNATURE_LENGTH_IN_BYTES),\n/* harmony export */ SOLANA_SCHEMA: () => (/* binding */ SOLANA_SCHEMA),\n/* harmony export */ STAKE_CONFIG_ID: () => (/* binding */ STAKE_CONFIG_ID),\n/* harmony export */ STAKE_INSTRUCTION_LAYOUTS: () => (/* binding */ STAKE_INSTRUCTION_LAYOUTS),\n/* harmony export */ SYSTEM_INSTRUCTION_LAYOUTS: () => (/* binding */ SYSTEM_INSTRUCTION_LAYOUTS),\n/* harmony export */ SYSVAR_CLOCK_PUBKEY: () => (/* binding */ SYSVAR_CLOCK_PUBKEY),\n/* harmony export */ SYSVAR_EPOCH_SCHEDULE_PUBKEY: () => (/* binding */ SYSVAR_EPOCH_SCHEDULE_PUBKEY),\n/* harmony export */ SYSVAR_INSTRUCTIONS_PUBKEY: () => (/* binding */ SYSVAR_INSTRUCTIONS_PUBKEY),\n/* harmony export */ SYSVAR_RECENT_BLOCKHASHES_PUBKEY: () => (/* binding */ SYSVAR_RECENT_BLOCKHASHES_PUBKEY),\n/* harmony export */ SYSVAR_RENT_PUBKEY: () => (/* binding */ SYSVAR_RENT_PUBKEY),\n/* harmony export */ SYSVAR_REWARDS_PUBKEY: () => (/* binding */ SYSVAR_REWARDS_PUBKEY),\n/* harmony export */ SYSVAR_SLOT_HASHES_PUBKEY: () => (/* binding */ SYSVAR_SLOT_HASHES_PUBKEY),\n/* harmony export */ SYSVAR_SLOT_HISTORY_PUBKEY: () => (/* binding */ SYSVAR_SLOT_HISTORY_PUBKEY),\n/* harmony export */ SYSVAR_STAKE_HISTORY_PUBKEY: () => (/* binding */ SYSVAR_STAKE_HISTORY_PUBKEY),\n/* harmony export */ Secp256k1Program: () => (/* binding */ Secp256k1Program),\n/* harmony export */ SendTransactionError: () => (/* binding */ SendTransactionError),\n/* harmony export */ SolanaJSONRPCError: () => (/* binding */ SolanaJSONRPCError),\n/* harmony export */ SolanaJSONRPCErrorCode: () => (/* binding */ SolanaJSONRPCErrorCode),\n/* harmony export */ StakeAuthorizationLayout: () => (/* binding */ StakeAuthorizationLayout),\n/* harmony export */ StakeInstruction: () => (/* binding */ StakeInstruction),\n/* harmony export */ StakeProgram: () => (/* binding */ StakeProgram),\n/* harmony export */ Struct: () => (/* binding */ Struct),\n/* harmony export */ SystemInstruction: () => (/* binding */ SystemInstruction),\n/* harmony export */ SystemProgram: () => (/* binding */ SystemProgram),\n/* harmony export */ Transaction: () => (/* binding */ Transaction),\n/* harmony export */ TransactionExpiredBlockheightExceededError: () => (/* binding */ TransactionExpiredBlockheightExceededError),\n/* harmony export */ TransactionExpiredNonceInvalidError: () => (/* binding */ TransactionExpiredNonceInvalidError),\n/* harmony export */ TransactionExpiredTimeoutError: () => (/* binding */ TransactionExpiredTimeoutError),\n/* harmony export */ TransactionInstruction: () => (/* binding */ TransactionInstruction),\n/* harmony export */ TransactionMessage: () => (/* binding */ TransactionMessage),\n/* harmony export */ TransactionStatus: () => (/* binding */ TransactionStatus),\n/* harmony export */ VALIDATOR_INFO_KEY: () => (/* binding */ VALIDATOR_INFO_KEY),\n/* harmony export */ VERSION_PREFIX_MASK: () => (/* binding */ VERSION_PREFIX_MASK),\n/* harmony export */ VOTE_PROGRAM_ID: () => (/* binding */ VOTE_PROGRAM_ID),\n/* harmony export */ ValidatorInfo: () => (/* binding */ ValidatorInfo),\n/* harmony export */ VersionedMessage: () => (/* binding */ VersionedMessage),\n/* harmony export */ VersionedTransaction: () => (/* binding */ VersionedTransaction),\n/* harmony export */ VoteAccount: () => (/* binding */ VoteAccount),\n/* harmony export */ VoteAuthorizationLayout: () => (/* binding */ VoteAuthorizationLayout),\n/* harmony export */ VoteInit: () => (/* binding */ VoteInit),\n/* harmony export */ VoteInstruction: () => (/* binding */ VoteInstruction),\n/* harmony export */ VoteProgram: () => (/* binding */ VoteProgram),\n/* harmony export */ clusterApiUrl: () => (/* binding */ clusterApiUrl),\n/* harmony export */ sendAndConfirmRawTransaction: () => (/* binding */ sendAndConfirmRawTransaction),\n/* harmony export */ sendAndConfirmTransaction: () => (/* binding */ sendAndConfirmTransaction)\n/* harmony export */ });\n/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ \"./node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js\");\n/* harmony import */ var _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @noble/curves/ed25519 */ \"./node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/ed25519.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! bn.js */ \"./node_modules/.pnpm/bn.js@5.2.1/node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var bs58__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! bs58 */ \"./node_modules/.pnpm/bs58@4.0.1/node_modules/bs58/index.js\");\n/* harmony import */ var bs58__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(bs58__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @noble/hashes/sha256 */ \"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.js\");\n/* harmony import */ var borsh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! borsh */ \"./node_modules/.pnpm/borsh@0.7.0/node_modules/borsh/lib/index.js\");\n/* harmony import */ var borsh__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(borsh__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @solana/buffer-layout */ \"./node_modules/.pnpm/@solana+buffer-layout@4.0.1/node_modules/@solana/buffer-layout/lib/Layout.js\");\n/* harmony import */ var bigint_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! bigint-buffer */ \"./node_modules/.pnpm/bigint-buffer@1.1.5/node_modules/bigint-buffer/dist/browser.js\");\n/* harmony import */ var superstruct__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! superstruct */ \"./node_modules/.pnpm/superstruct@2.0.2/node_modules/superstruct/dist/index.mjs\");\n/* harmony import */ var jayson_lib_client_browser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! jayson/lib/client/browser */ \"./node_modules/.pnpm/jayson@4.1.2_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/jayson/lib/client/browser/index.js\");\n/* harmony import */ var jayson_lib_client_browser__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(jayson_lib_client_browser__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var rpc_websockets__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! rpc-websockets */ \"./node_modules/.pnpm/rpc-websockets@9.0.4/node_modules/rpc-websockets/dist/index.browser.mjs\");\n/* harmony import */ var _noble_hashes_sha3__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @noble/hashes/sha3 */ \"./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js\");\n/* harmony import */ var _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @noble/curves/secp256k1 */ \"./node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/secp256k1.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * A 64 byte secret key, the first 32 bytes of which is the\n * private scalar and the last 32 bytes is the public key.\n * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/\n */\n\n/**\n * Ed25519 Keypair\n */\n\nconst generatePrivateKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_8__.ed25519.utils.randomPrivateKey;\nconst generateKeypair = () => {\n const privateScalar = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_8__.ed25519.utils.randomPrivateKey();\n const publicKey = getPublicKey(privateScalar);\n const secretKey = new Uint8Array(64);\n secretKey.set(privateScalar);\n secretKey.set(publicKey, 32);\n return {\n publicKey,\n secretKey\n };\n};\nconst getPublicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_8__.ed25519.getPublicKey;\nfunction isOnCurve(publicKey) {\n try {\n _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_8__.ed25519.ExtendedPoint.fromHex(publicKey);\n return true;\n } catch {\n return false;\n }\n}\nconst sign = (message, secretKey) => _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_8__.ed25519.sign(message, secretKey.slice(0, 32));\nconst verify = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_8__.ed25519.verify;\n\nconst toBuffer = arr => {\n if (buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.isBuffer(arr)) {\n return arr;\n } else if (arr instanceof Uint8Array) {\n return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength);\n } else {\n return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(arr);\n }\n};\n\n// Class wrapping a plain object\nclass Struct {\n constructor(properties) {\n Object.assign(this, properties);\n }\n encode() {\n return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from((0,borsh__WEBPACK_IMPORTED_MODULE_3__.serialize)(SOLANA_SCHEMA, this));\n }\n static decode(data) {\n return (0,borsh__WEBPACK_IMPORTED_MODULE_3__.deserialize)(SOLANA_SCHEMA, this, data);\n }\n static decodeUnchecked(data) {\n return (0,borsh__WEBPACK_IMPORTED_MODULE_3__.deserializeUnchecked)(SOLANA_SCHEMA, this, data);\n }\n}\n\n// Class representing a Rust-compatible enum, since enums are only strings or\n// numbers in pure JS\nclass Enum extends Struct {\n constructor(properties) {\n super(properties);\n this.enum = '';\n if (Object.keys(properties).length !== 1) {\n throw new Error('Enum can only take single value');\n }\n Object.keys(properties).map(key => {\n this.enum = key;\n });\n }\n}\nconst SOLANA_SCHEMA = new Map();\n\nvar _PublicKey;\n\n/**\n * Maximum length of derived pubkey seed\n */\nconst MAX_SEED_LENGTH = 32;\n\n/**\n * Size of public key in bytes\n */\nconst PUBLIC_KEY_LENGTH = 32;\n\n/**\n * Value to be converted into public key\n */\n\n/**\n * JSON object representation of PublicKey class\n */\n\nfunction isPublicKeyData(value) {\n return value._bn !== undefined;\n}\n\n// local counter used by PublicKey.unique()\nlet uniquePublicKeyCounter = 1;\n\n/**\n * A public key\n */\nclass PublicKey extends Struct {\n /**\n * Create a new PublicKey object\n * @param value ed25519 public key as buffer or base-58 encoded string\n */\n constructor(value) {\n super({});\n /** @internal */\n this._bn = void 0;\n if (isPublicKeyData(value)) {\n this._bn = value._bn;\n } else {\n if (typeof value === 'string') {\n // assume base 58 encoding by default\n const decoded = bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(value);\n if (decoded.length != PUBLIC_KEY_LENGTH) {\n throw new Error(`Invalid public key input`);\n }\n this._bn = new (bn_js__WEBPACK_IMPORTED_MODULE_1___default())(decoded);\n } else {\n this._bn = new (bn_js__WEBPACK_IMPORTED_MODULE_1___default())(value);\n }\n if (this._bn.byteLength() > PUBLIC_KEY_LENGTH) {\n throw new Error(`Invalid public key input`);\n }\n }\n }\n\n /**\n * Returns a unique PublicKey for tests and benchmarks using a counter\n */\n static unique() {\n const key = new PublicKey(uniquePublicKeyCounter);\n uniquePublicKeyCounter += 1;\n return new PublicKey(key.toBuffer());\n }\n\n /**\n * Default public key value. The base58-encoded string representation is all ones (as seen below)\n * The underlying BN number is 32 bytes that are all zeros\n */\n\n /**\n * Checks if two publicKeys are equal\n */\n equals(publicKey) {\n return this._bn.eq(publicKey._bn);\n }\n\n /**\n * Return the base-58 representation of the public key\n */\n toBase58() {\n return bs58__WEBPACK_IMPORTED_MODULE_2___default().encode(this.toBytes());\n }\n toJSON() {\n return this.toBase58();\n }\n\n /**\n * Return the byte array representation of the public key in big endian\n */\n toBytes() {\n const buf = this.toBuffer();\n return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n\n /**\n * Return the Buffer representation of the public key in big endian\n */\n toBuffer() {\n const b = this._bn.toArrayLike(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer);\n if (b.length === PUBLIC_KEY_LENGTH) {\n return b;\n }\n const zeroPad = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(32);\n b.copy(zeroPad, 32 - b.length);\n return zeroPad;\n }\n get [Symbol.toStringTag]() {\n return `PublicKey(${this.toString()})`;\n }\n\n /**\n * Return the base-58 representation of the public key\n */\n toString() {\n return this.toBase58();\n }\n\n /**\n * Derive a public key from another key, a seed, and a program ID.\n * The program ID will also serve as the owner of the public key, giving\n * it permission to write data to the account.\n */\n /* eslint-disable require-await */\n static async createWithSeed(fromPublicKey, seed, programId) {\n const buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([fromPublicKey.toBuffer(), buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(seed), programId.toBuffer()]);\n const publicKeyBytes = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_9__.sha256)(buffer);\n return new PublicKey(publicKeyBytes);\n }\n\n /**\n * Derive a program address from seeds and a program ID.\n */\n /* eslint-disable require-await */\n static createProgramAddressSync(seeds, programId) {\n let buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(0);\n seeds.forEach(function (seed) {\n if (seed.length > MAX_SEED_LENGTH) {\n throw new TypeError(`Max seed length exceeded`);\n }\n buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([buffer, toBuffer(seed)]);\n });\n buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([buffer, programId.toBuffer(), buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from('ProgramDerivedAddress')]);\n const publicKeyBytes = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_9__.sha256)(buffer);\n if (isOnCurve(publicKeyBytes)) {\n throw new Error(`Invalid seeds, address must fall off the curve`);\n }\n return new PublicKey(publicKeyBytes);\n }\n\n /**\n * Async version of createProgramAddressSync\n * For backwards compatibility\n *\n * @deprecated Use {@link createProgramAddressSync} instead\n */\n /* eslint-disable require-await */\n static async createProgramAddress(seeds, programId) {\n return this.createProgramAddressSync(seeds, programId);\n }\n\n /**\n * Find a valid program address\n *\n * Valid program addresses must fall off the ed25519 curve. This function\n * iterates a nonce until it finds one that when combined with the seeds\n * results in a valid program address.\n */\n static findProgramAddressSync(seeds, programId) {\n let nonce = 255;\n let address;\n while (nonce != 0) {\n try {\n const seedsWithNonce = seeds.concat(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from([nonce]));\n address = this.createProgramAddressSync(seedsWithNonce, programId);\n } catch (err) {\n if (err instanceof TypeError) {\n throw err;\n }\n nonce--;\n continue;\n }\n return [address, nonce];\n }\n throw new Error(`Unable to find a viable program address nonce`);\n }\n\n /**\n * Async version of findProgramAddressSync\n * For backwards compatibility\n *\n * @deprecated Use {@link findProgramAddressSync} instead\n */\n static async findProgramAddress(seeds, programId) {\n return this.findProgramAddressSync(seeds, programId);\n }\n\n /**\n * Check that a pubkey is on the ed25519 curve.\n */\n static isOnCurve(pubkeyData) {\n const pubkey = new PublicKey(pubkeyData);\n return isOnCurve(pubkey.toBytes());\n }\n}\n_PublicKey = PublicKey;\nPublicKey.default = new _PublicKey('11111111111111111111111111111111');\nSOLANA_SCHEMA.set(PublicKey, {\n kind: 'struct',\n fields: [['_bn', 'u256']]\n});\n\n/**\n * An account key pair (public and secret keys).\n *\n * @deprecated since v1.10.0, please use {@link Keypair} instead.\n */\nclass Account {\n /**\n * Create a new Account object\n *\n * If the secretKey parameter is not provided a new key pair is randomly\n * created for the account\n *\n * @param secretKey Secret key for the account\n */\n constructor(secretKey) {\n /** @internal */\n this._publicKey = void 0;\n /** @internal */\n this._secretKey = void 0;\n if (secretKey) {\n const secretKeyBuffer = toBuffer(secretKey);\n if (secretKey.length !== 64) {\n throw new Error('bad secret key size');\n }\n this._publicKey = secretKeyBuffer.slice(32, 64);\n this._secretKey = secretKeyBuffer.slice(0, 32);\n } else {\n this._secretKey = toBuffer(generatePrivateKey());\n this._publicKey = toBuffer(getPublicKey(this._secretKey));\n }\n }\n\n /**\n * The public key for this account\n */\n get publicKey() {\n return new PublicKey(this._publicKey);\n }\n\n /**\n * The **unencrypted** secret key for this account. The first 32 bytes\n * is the private scalar and the last 32 bytes is the public key.\n * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/\n */\n get secretKey() {\n return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([this._secretKey, this._publicKey], 64);\n }\n}\n\nconst BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey('BPFLoader1111111111111111111111111111111111');\n\n/**\n * Maximum over-the-wire size of a Transaction\n *\n * 1280 is IPv6 minimum MTU\n * 40 bytes is the size of the IPv6 header\n * 8 bytes is the size of the fragment header\n */\nconst PACKET_DATA_SIZE = 1280 - 40 - 8;\nconst VERSION_PREFIX_MASK = 0x7f;\nconst SIGNATURE_LENGTH_IN_BYTES = 64;\n\nclass TransactionExpiredBlockheightExceededError extends Error {\n constructor(signature) {\n super(`Signature ${signature} has expired: block height exceeded.`);\n this.signature = void 0;\n this.signature = signature;\n }\n}\nObject.defineProperty(TransactionExpiredBlockheightExceededError.prototype, 'name', {\n value: 'TransactionExpiredBlockheightExceededError'\n});\nclass TransactionExpiredTimeoutError extends Error {\n constructor(signature, timeoutSeconds) {\n super(`Transaction was not confirmed in ${timeoutSeconds.toFixed(2)} seconds. It is ` + 'unknown if it succeeded or failed. Check signature ' + `${signature} using the Solana Explorer or CLI tools.`);\n this.signature = void 0;\n this.signature = signature;\n }\n}\nObject.defineProperty(TransactionExpiredTimeoutError.prototype, 'name', {\n value: 'TransactionExpiredTimeoutError'\n});\nclass TransactionExpiredNonceInvalidError extends Error {\n constructor(signature) {\n super(`Signature ${signature} has expired: the nonce is no longer valid.`);\n this.signature = void 0;\n this.signature = signature;\n }\n}\nObject.defineProperty(TransactionExpiredNonceInvalidError.prototype, 'name', {\n value: 'TransactionExpiredNonceInvalidError'\n});\n\nclass MessageAccountKeys {\n constructor(staticAccountKeys, accountKeysFromLookups) {\n this.staticAccountKeys = void 0;\n this.accountKeysFromLookups = void 0;\n this.staticAccountKeys = staticAccountKeys;\n this.accountKeysFromLookups = accountKeysFromLookups;\n }\n keySegments() {\n const keySegments = [this.staticAccountKeys];\n if (this.accountKeysFromLookups) {\n keySegments.push(this.accountKeysFromLookups.writable);\n keySegments.push(this.accountKeysFromLookups.readonly);\n }\n return keySegments;\n }\n get(index) {\n for (const keySegment of this.keySegments()) {\n if (index < keySegment.length) {\n return keySegment[index];\n } else {\n index -= keySegment.length;\n }\n }\n return;\n }\n get length() {\n return this.keySegments().flat().length;\n }\n compileInstructions(instructions) {\n // Bail early if any account indexes would overflow a u8\n const U8_MAX = 255;\n if (this.length > U8_MAX + 1) {\n throw new Error('Account index overflow encountered during compilation');\n }\n const keyIndexMap = new Map();\n this.keySegments().flat().forEach((key, index) => {\n keyIndexMap.set(key.toBase58(), index);\n });\n const findKeyIndex = key => {\n const keyIndex = keyIndexMap.get(key.toBase58());\n if (keyIndex === undefined) throw new Error('Encountered an unknown instruction account key during compilation');\n return keyIndex;\n };\n return instructions.map(instruction => {\n return {\n programIdIndex: findKeyIndex(instruction.programId),\n accountKeyIndexes: instruction.keys.map(meta => findKeyIndex(meta.pubkey)),\n data: instruction.data\n };\n });\n }\n}\n\n/**\n * Layout for a public key\n */\nconst publicKey = (property = 'publicKey') => {\n return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(32, property);\n};\n\n/**\n * Layout for a signature\n */\nconst signature = (property = 'signature') => {\n return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(64, property);\n};\n/**\n * Layout for a Rust String type\n */\nconst rustString = (property = 'string') => {\n const rsl = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('length'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('lengthPadding'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32(), -8), 'chars')], property);\n const _decode = rsl.decode.bind(rsl);\n const _encode = rsl.encode.bind(rsl);\n const rslShim = rsl;\n rslShim.decode = (b, offset) => {\n const data = _decode(b, offset);\n return data['chars'].toString();\n };\n rslShim.encode = (str, b, offset) => {\n const data = {\n chars: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(str, 'utf8')\n };\n return _encode(data, b, offset);\n };\n rslShim.alloc = str => {\n return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32().span + _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32().span + buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(str, 'utf8').length;\n };\n return rslShim;\n};\n\n/**\n * Layout for an Authorized object\n */\nconst authorized = (property = 'authorized') => {\n return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([publicKey('staker'), publicKey('withdrawer')], property);\n};\n\n/**\n * Layout for a Lockup object\n */\nconst lockup = (property = 'lockup') => {\n return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('unixTimestamp'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('epoch'), publicKey('custodian')], property);\n};\n\n/**\n * Layout for a VoteInit object\n */\nconst voteInit = (property = 'voteInit') => {\n return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([publicKey('nodePubkey'), publicKey('authorizedVoter'), publicKey('authorizedWithdrawer'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('commission')], property);\n};\n\n/**\n * Layout for a VoteAuthorizeWithSeedArgs object\n */\nconst voteAuthorizeWithSeedArgs = (property = 'voteAuthorizeWithSeedArgs') => {\n return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('voteAuthorizationType'), publicKey('currentAuthorityDerivedKeyOwnerPubkey'), rustString('currentAuthorityDerivedKeySeed'), publicKey('newAuthorized')], property);\n};\nfunction getAlloc(type, fields) {\n const getItemAlloc = item => {\n if (item.span >= 0) {\n return item.span;\n } else if (typeof item.alloc === 'function') {\n return item.alloc(fields[item.property]);\n } else if ('count' in item && 'elementLayout' in item) {\n const field = fields[item.property];\n if (Array.isArray(field)) {\n return field.length * getItemAlloc(item.elementLayout);\n }\n } else if ('fields' in item) {\n // This is a `Structure` whose size needs to be recursively measured.\n return getAlloc({\n layout: item\n }, fields[item.property]);\n }\n // Couldn't determine allocated size of layout\n return 0;\n };\n let alloc = 0;\n type.layout.fields.forEach(item => {\n alloc += getItemAlloc(item);\n });\n return alloc;\n}\n\nfunction decodeLength(bytes) {\n let len = 0;\n let size = 0;\n for (;;) {\n let elem = bytes.shift();\n len |= (elem & 0x7f) << size * 7;\n size += 1;\n if ((elem & 0x80) === 0) {\n break;\n }\n }\n return len;\n}\nfunction encodeLength(bytes, len) {\n let rem_len = len;\n for (;;) {\n let elem = rem_len & 0x7f;\n rem_len >>= 7;\n if (rem_len == 0) {\n bytes.push(elem);\n break;\n } else {\n elem |= 0x80;\n bytes.push(elem);\n }\n }\n}\n\nfunction assert (condition, message) {\n if (!condition) {\n throw new Error(message || 'Assertion failed');\n }\n}\n\nclass CompiledKeys {\n constructor(payer, keyMetaMap) {\n this.payer = void 0;\n this.keyMetaMap = void 0;\n this.payer = payer;\n this.keyMetaMap = keyMetaMap;\n }\n static compile(instructions, payer) {\n const keyMetaMap = new Map();\n const getOrInsertDefault = pubkey => {\n const address = pubkey.toBase58();\n let keyMeta = keyMetaMap.get(address);\n if (keyMeta === undefined) {\n keyMeta = {\n isSigner: false,\n isWritable: false,\n isInvoked: false\n };\n keyMetaMap.set(address, keyMeta);\n }\n return keyMeta;\n };\n const payerKeyMeta = getOrInsertDefault(payer);\n payerKeyMeta.isSigner = true;\n payerKeyMeta.isWritable = true;\n for (const ix of instructions) {\n getOrInsertDefault(ix.programId).isInvoked = true;\n for (const accountMeta of ix.keys) {\n const keyMeta = getOrInsertDefault(accountMeta.pubkey);\n keyMeta.isSigner ||= accountMeta.isSigner;\n keyMeta.isWritable ||= accountMeta.isWritable;\n }\n }\n return new CompiledKeys(payer, keyMetaMap);\n }\n getMessageComponents() {\n const mapEntries = [...this.keyMetaMap.entries()];\n assert(mapEntries.length <= 256, 'Max static account keys length exceeded');\n const writableSigners = mapEntries.filter(([, meta]) => meta.isSigner && meta.isWritable);\n const readonlySigners = mapEntries.filter(([, meta]) => meta.isSigner && !meta.isWritable);\n const writableNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && meta.isWritable);\n const readonlyNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && !meta.isWritable);\n const header = {\n numRequiredSignatures: writableSigners.length + readonlySigners.length,\n numReadonlySignedAccounts: readonlySigners.length,\n numReadonlyUnsignedAccounts: readonlyNonSigners.length\n };\n\n // sanity checks\n {\n assert(writableSigners.length > 0, 'Expected at least one writable signer key');\n const [payerAddress] = writableSigners[0];\n assert(payerAddress === this.payer.toBase58(), 'Expected first writable signer key to be the fee payer');\n }\n const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey(address)), ...readonlySigners.map(([address]) => new PublicKey(address)), ...writableNonSigners.map(([address]) => new PublicKey(address)), ...readonlyNonSigners.map(([address]) => new PublicKey(address))];\n return [header, staticAccountKeys];\n }\n extractTableLookup(lookupTable) {\n const [writableIndexes, drainedWritableKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && keyMeta.isWritable);\n const [readonlyIndexes, drainedReadonlyKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && !keyMeta.isWritable);\n\n // Don't extract lookup if no keys were found\n if (writableIndexes.length === 0 && readonlyIndexes.length === 0) {\n return;\n }\n return [{\n accountKey: lookupTable.key,\n writableIndexes,\n readonlyIndexes\n }, {\n writable: drainedWritableKeys,\n readonly: drainedReadonlyKeys\n }];\n }\n\n /** @internal */\n drainKeysFoundInLookupTable(lookupTableEntries, keyMetaFilter) {\n const lookupTableIndexes = new Array();\n const drainedKeys = new Array();\n for (const [address, keyMeta] of this.keyMetaMap.entries()) {\n if (keyMetaFilter(keyMeta)) {\n const key = new PublicKey(address);\n const lookupTableIndex = lookupTableEntries.findIndex(entry => entry.equals(key));\n if (lookupTableIndex >= 0) {\n assert(lookupTableIndex < 256, 'Max lookup table index exceeded');\n lookupTableIndexes.push(lookupTableIndex);\n drainedKeys.push(key);\n this.keyMetaMap.delete(address);\n }\n }\n }\n return [lookupTableIndexes, drainedKeys];\n }\n}\n\nconst END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';\n\n/**\n * Delegates to `Array#shift`, but throws if the array is zero-length.\n */\nfunction guardedShift(byteArray) {\n if (byteArray.length === 0) {\n throw new Error(END_OF_BUFFER_ERROR_MESSAGE);\n }\n return byteArray.shift();\n}\n\n/**\n * Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of\n * the array.\n */\nfunction guardedSplice(byteArray, ...args) {\n const [start] = args;\n if (args.length === 2 // Implies that `deleteCount` was supplied\n ? start + (args[1] ?? 0) > byteArray.length : start >= byteArray.length) {\n throw new Error(END_OF_BUFFER_ERROR_MESSAGE);\n }\n return byteArray.splice(...args);\n}\n\n/**\n * An instruction to execute by a program\n *\n * @property {number} programIdIndex\n * @property {number[]} accounts\n * @property {string} data\n */\n\n/**\n * Message constructor arguments\n */\n\n/**\n * List of instructions to be processed atomically\n */\nclass Message {\n constructor(args) {\n this.header = void 0;\n this.accountKeys = void 0;\n this.recentBlockhash = void 0;\n this.instructions = void 0;\n this.indexToProgramIds = new Map();\n this.header = args.header;\n this.accountKeys = args.accountKeys.map(account => new PublicKey(account));\n this.recentBlockhash = args.recentBlockhash;\n this.instructions = args.instructions;\n this.instructions.forEach(ix => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));\n }\n get version() {\n return 'legacy';\n }\n get staticAccountKeys() {\n return this.accountKeys;\n }\n get compiledInstructions() {\n return this.instructions.map(ix => ({\n programIdIndex: ix.programIdIndex,\n accountKeyIndexes: ix.accounts,\n data: bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(ix.data)\n }));\n }\n get addressTableLookups() {\n return [];\n }\n getAccountKeys() {\n return new MessageAccountKeys(this.staticAccountKeys);\n }\n static compile(args) {\n const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);\n const [header, staticAccountKeys] = compiledKeys.getMessageComponents();\n const accountKeys = new MessageAccountKeys(staticAccountKeys);\n const instructions = accountKeys.compileInstructions(args.instructions).map(ix => ({\n programIdIndex: ix.programIdIndex,\n accounts: ix.accountKeyIndexes,\n data: bs58__WEBPACK_IMPORTED_MODULE_2___default().encode(ix.data)\n }));\n return new Message({\n header,\n accountKeys: staticAccountKeys,\n recentBlockhash: args.recentBlockhash,\n instructions\n });\n }\n isAccountSigner(index) {\n return index < this.header.numRequiredSignatures;\n }\n isAccountWritable(index) {\n const numSignedAccounts = this.header.numRequiredSignatures;\n if (index >= this.header.numRequiredSignatures) {\n const unsignedAccountIndex = index - numSignedAccounts;\n const numUnsignedAccounts = this.accountKeys.length - numSignedAccounts;\n const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;\n return unsignedAccountIndex < numWritableUnsignedAccounts;\n } else {\n const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts;\n return index < numWritableSignedAccounts;\n }\n }\n isProgramId(index) {\n return this.indexToProgramIds.has(index);\n }\n programIds() {\n return [...this.indexToProgramIds.values()];\n }\n nonProgramIds() {\n return this.accountKeys.filter((_, index) => !this.isProgramId(index));\n }\n serialize() {\n const numKeys = this.accountKeys.length;\n let keyCount = [];\n encodeLength(keyCount, numKeys);\n const instructions = this.instructions.map(instruction => {\n const {\n accounts,\n programIdIndex\n } = instruction;\n const data = Array.from(bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(instruction.data));\n let keyIndicesCount = [];\n encodeLength(keyIndicesCount, accounts.length);\n let dataCount = [];\n encodeLength(dataCount, data.length);\n return {\n programIdIndex,\n keyIndicesCount: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(keyIndicesCount),\n keyIndices: accounts,\n dataLength: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(dataCount),\n data\n };\n });\n let instructionCount = [];\n encodeLength(instructionCount, instructions.length);\n let instructionBuffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(PACKET_DATA_SIZE);\n buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(instructionCount).copy(instructionBuffer);\n let instructionBufferLength = instructionCount.length;\n instructions.forEach(instruction => {\n const instructionLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('programIdIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(instruction.keyIndicesCount.length, 'keyIndicesCount'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('keyIndex'), instruction.keyIndices.length, 'keyIndices'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(instruction.dataLength.length, 'dataLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('userdatum'), instruction.data.length, 'data')]);\n const length = instructionLayout.encode(instruction, instructionBuffer, instructionBufferLength);\n instructionBufferLength += length;\n });\n instructionBuffer = instructionBuffer.slice(0, instructionBufferLength);\n const signDataLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(1, 'numRequiredSignatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(1, 'numReadonlySignedAccounts'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(1, 'numReadonlyUnsignedAccounts'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(keyCount.length, 'keyCount'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(publicKey('key'), numKeys, 'keys'), publicKey('recentBlockhash')]);\n const transaction = {\n numRequiredSignatures: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from([this.header.numRequiredSignatures]),\n numReadonlySignedAccounts: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from([this.header.numReadonlySignedAccounts]),\n numReadonlyUnsignedAccounts: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from([this.header.numReadonlyUnsignedAccounts]),\n keyCount: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(keyCount),\n keys: this.accountKeys.map(key => toBuffer(key.toBytes())),\n recentBlockhash: bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(this.recentBlockhash)\n };\n let signData = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(2048);\n const length = signDataLayout.encode(transaction, signData);\n instructionBuffer.copy(signData, length);\n return signData.slice(0, length + instructionBuffer.length);\n }\n\n /**\n * Decode a compiled message into a Message object.\n */\n static from(buffer) {\n // Slice up wire data\n let byteArray = [...buffer];\n const numRequiredSignatures = guardedShift(byteArray);\n if (numRequiredSignatures !== (numRequiredSignatures & VERSION_PREFIX_MASK)) {\n throw new Error('Versioned messages must be deserialized with VersionedMessage.deserialize()');\n }\n const numReadonlySignedAccounts = guardedShift(byteArray);\n const numReadonlyUnsignedAccounts = guardedShift(byteArray);\n const accountCount = decodeLength(byteArray);\n let accountKeys = [];\n for (let i = 0; i < accountCount; i++) {\n const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);\n accountKeys.push(new PublicKey(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(account)));\n }\n const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);\n const instructionCount = decodeLength(byteArray);\n let instructions = [];\n for (let i = 0; i < instructionCount; i++) {\n const programIdIndex = guardedShift(byteArray);\n const accountCount = decodeLength(byteArray);\n const accounts = guardedSplice(byteArray, 0, accountCount);\n const dataLength = decodeLength(byteArray);\n const dataSlice = guardedSplice(byteArray, 0, dataLength);\n const data = bs58__WEBPACK_IMPORTED_MODULE_2___default().encode(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(dataSlice));\n instructions.push({\n programIdIndex,\n accounts,\n data\n });\n }\n const messageArgs = {\n header: {\n numRequiredSignatures,\n numReadonlySignedAccounts,\n numReadonlyUnsignedAccounts\n },\n recentBlockhash: bs58__WEBPACK_IMPORTED_MODULE_2___default().encode(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(recentBlockhash)),\n accountKeys,\n instructions\n };\n return new Message(messageArgs);\n }\n}\n\n/**\n * Message constructor arguments\n */\n\nclass MessageV0 {\n constructor(args) {\n this.header = void 0;\n this.staticAccountKeys = void 0;\n this.recentBlockhash = void 0;\n this.compiledInstructions = void 0;\n this.addressTableLookups = void 0;\n this.header = args.header;\n this.staticAccountKeys = args.staticAccountKeys;\n this.recentBlockhash = args.recentBlockhash;\n this.compiledInstructions = args.compiledInstructions;\n this.addressTableLookups = args.addressTableLookups;\n }\n get version() {\n return 0;\n }\n get numAccountKeysFromLookups() {\n let count = 0;\n for (const lookup of this.addressTableLookups) {\n count += lookup.readonlyIndexes.length + lookup.writableIndexes.length;\n }\n return count;\n }\n getAccountKeys(args) {\n let accountKeysFromLookups;\n if (args && 'accountKeysFromLookups' in args && args.accountKeysFromLookups) {\n if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {\n throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');\n }\n accountKeysFromLookups = args.accountKeysFromLookups;\n } else if (args && 'addressLookupTableAccounts' in args && args.addressLookupTableAccounts) {\n accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);\n } else if (this.addressTableLookups.length > 0) {\n throw new Error('Failed to get account keys because address table lookups were not resolved');\n }\n return new MessageAccountKeys(this.staticAccountKeys, accountKeysFromLookups);\n }\n isAccountSigner(index) {\n return index < this.header.numRequiredSignatures;\n }\n isAccountWritable(index) {\n const numSignedAccounts = this.header.numRequiredSignatures;\n const numStaticAccountKeys = this.staticAccountKeys.length;\n if (index >= numStaticAccountKeys) {\n const lookupAccountKeysIndex = index - numStaticAccountKeys;\n const numWritableLookupAccountKeys = this.addressTableLookups.reduce((count, lookup) => count + lookup.writableIndexes.length, 0);\n return lookupAccountKeysIndex < numWritableLookupAccountKeys;\n } else if (index >= this.header.numRequiredSignatures) {\n const unsignedAccountIndex = index - numSignedAccounts;\n const numUnsignedAccounts = numStaticAccountKeys - numSignedAccounts;\n const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;\n return unsignedAccountIndex < numWritableUnsignedAccounts;\n } else {\n const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts;\n return index < numWritableSignedAccounts;\n }\n }\n resolveAddressTableLookups(addressLookupTableAccounts) {\n const accountKeysFromLookups = {\n writable: [],\n readonly: []\n };\n for (const tableLookup of this.addressTableLookups) {\n const tableAccount = addressLookupTableAccounts.find(account => account.key.equals(tableLookup.accountKey));\n if (!tableAccount) {\n throw new Error(`Failed to find address lookup table account for table key ${tableLookup.accountKey.toBase58()}`);\n }\n for (const index of tableLookup.writableIndexes) {\n if (index < tableAccount.state.addresses.length) {\n accountKeysFromLookups.writable.push(tableAccount.state.addresses[index]);\n } else {\n throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);\n }\n }\n for (const index of tableLookup.readonlyIndexes) {\n if (index < tableAccount.state.addresses.length) {\n accountKeysFromLookups.readonly.push(tableAccount.state.addresses[index]);\n } else {\n throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);\n }\n }\n }\n return accountKeysFromLookups;\n }\n static compile(args) {\n const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);\n const addressTableLookups = new Array();\n const accountKeysFromLookups = {\n writable: new Array(),\n readonly: new Array()\n };\n const lookupTableAccounts = args.addressLookupTableAccounts || [];\n for (const lookupTable of lookupTableAccounts) {\n const extractResult = compiledKeys.extractTableLookup(lookupTable);\n if (extractResult !== undefined) {\n const [addressTableLookup, {\n writable,\n readonly\n }] = extractResult;\n addressTableLookups.push(addressTableLookup);\n accountKeysFromLookups.writable.push(...writable);\n accountKeysFromLookups.readonly.push(...readonly);\n }\n }\n const [header, staticAccountKeys] = compiledKeys.getMessageComponents();\n const accountKeys = new MessageAccountKeys(staticAccountKeys, accountKeysFromLookups);\n const compiledInstructions = accountKeys.compileInstructions(args.instructions);\n return new MessageV0({\n header,\n staticAccountKeys,\n recentBlockhash: args.recentBlockhash,\n compiledInstructions,\n addressTableLookups\n });\n }\n serialize() {\n const encodedStaticAccountKeysLength = Array();\n encodeLength(encodedStaticAccountKeysLength, this.staticAccountKeys.length);\n const serializedInstructions = this.serializeInstructions();\n const encodedInstructionsLength = Array();\n encodeLength(encodedInstructionsLength, this.compiledInstructions.length);\n const serializedAddressTableLookups = this.serializeAddressTableLookups();\n const encodedAddressTableLookupsLength = Array();\n encodeLength(encodedAddressTableLookupsLength, this.addressTableLookups.length);\n const messageLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('prefix'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('numRequiredSignatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('numReadonlySignedAccounts'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('numReadonlyUnsignedAccounts')], 'header'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(encodedStaticAccountKeysLength.length, 'staticAccountKeysLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(publicKey(), this.staticAccountKeys.length, 'staticAccountKeys'), publicKey('recentBlockhash'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(encodedInstructionsLength.length, 'instructionsLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(serializedInstructions.length, 'serializedInstructions'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(encodedAddressTableLookupsLength.length, 'addressTableLookupsLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(serializedAddressTableLookups.length, 'serializedAddressTableLookups')]);\n const serializedMessage = new Uint8Array(PACKET_DATA_SIZE);\n const MESSAGE_VERSION_0_PREFIX = 1 << 7;\n const serializedMessageLength = messageLayout.encode({\n prefix: MESSAGE_VERSION_0_PREFIX,\n header: this.header,\n staticAccountKeysLength: new Uint8Array(encodedStaticAccountKeysLength),\n staticAccountKeys: this.staticAccountKeys.map(key => key.toBytes()),\n recentBlockhash: bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(this.recentBlockhash),\n instructionsLength: new Uint8Array(encodedInstructionsLength),\n serializedInstructions,\n addressTableLookupsLength: new Uint8Array(encodedAddressTableLookupsLength),\n serializedAddressTableLookups\n }, serializedMessage);\n return serializedMessage.slice(0, serializedMessageLength);\n }\n serializeInstructions() {\n let serializedLength = 0;\n const serializedInstructions = new Uint8Array(PACKET_DATA_SIZE);\n for (const instruction of this.compiledInstructions) {\n const encodedAccountKeyIndexesLength = Array();\n encodeLength(encodedAccountKeyIndexesLength, instruction.accountKeyIndexes.length);\n const encodedDataLength = Array();\n encodeLength(encodedDataLength, instruction.data.length);\n const instructionLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('programIdIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(encodedAccountKeyIndexesLength.length, 'encodedAccountKeyIndexesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8(), instruction.accountKeyIndexes.length, 'accountKeyIndexes'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(encodedDataLength.length, 'encodedDataLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(instruction.data.length, 'data')]);\n serializedLength += instructionLayout.encode({\n programIdIndex: instruction.programIdIndex,\n encodedAccountKeyIndexesLength: new Uint8Array(encodedAccountKeyIndexesLength),\n accountKeyIndexes: instruction.accountKeyIndexes,\n encodedDataLength: new Uint8Array(encodedDataLength),\n data: instruction.data\n }, serializedInstructions, serializedLength);\n }\n return serializedInstructions.slice(0, serializedLength);\n }\n serializeAddressTableLookups() {\n let serializedLength = 0;\n const serializedAddressTableLookups = new Uint8Array(PACKET_DATA_SIZE);\n for (const lookup of this.addressTableLookups) {\n const encodedWritableIndexesLength = Array();\n encodeLength(encodedWritableIndexesLength, lookup.writableIndexes.length);\n const encodedReadonlyIndexesLength = Array();\n encodeLength(encodedReadonlyIndexesLength, lookup.readonlyIndexes.length);\n const addressTableLookupLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([publicKey('accountKey'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(encodedWritableIndexesLength.length, 'encodedWritableIndexesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8(), lookup.writableIndexes.length, 'writableIndexes'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(encodedReadonlyIndexesLength.length, 'encodedReadonlyIndexesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8(), lookup.readonlyIndexes.length, 'readonlyIndexes')]);\n serializedLength += addressTableLookupLayout.encode({\n accountKey: lookup.accountKey.toBytes(),\n encodedWritableIndexesLength: new Uint8Array(encodedWritableIndexesLength),\n writableIndexes: lookup.writableIndexes,\n encodedReadonlyIndexesLength: new Uint8Array(encodedReadonlyIndexesLength),\n readonlyIndexes: lookup.readonlyIndexes\n }, serializedAddressTableLookups, serializedLength);\n }\n return serializedAddressTableLookups.slice(0, serializedLength);\n }\n static deserialize(serializedMessage) {\n let byteArray = [...serializedMessage];\n const prefix = guardedShift(byteArray);\n const maskedPrefix = prefix & VERSION_PREFIX_MASK;\n assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`);\n const version = maskedPrefix;\n assert(version === 0, `Expected versioned message with version 0 but found version ${version}`);\n const header = {\n numRequiredSignatures: guardedShift(byteArray),\n numReadonlySignedAccounts: guardedShift(byteArray),\n numReadonlyUnsignedAccounts: guardedShift(byteArray)\n };\n const staticAccountKeys = [];\n const staticAccountKeysLength = decodeLength(byteArray);\n for (let i = 0; i < staticAccountKeysLength; i++) {\n staticAccountKeys.push(new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)));\n }\n const recentBlockhash = bs58__WEBPACK_IMPORTED_MODULE_2___default().encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));\n const instructionCount = decodeLength(byteArray);\n const compiledInstructions = [];\n for (let i = 0; i < instructionCount; i++) {\n const programIdIndex = guardedShift(byteArray);\n const accountKeyIndexesLength = decodeLength(byteArray);\n const accountKeyIndexes = guardedSplice(byteArray, 0, accountKeyIndexesLength);\n const dataLength = decodeLength(byteArray);\n const data = new Uint8Array(guardedSplice(byteArray, 0, dataLength));\n compiledInstructions.push({\n programIdIndex,\n accountKeyIndexes,\n data\n });\n }\n const addressTableLookupsCount = decodeLength(byteArray);\n const addressTableLookups = [];\n for (let i = 0; i < addressTableLookupsCount; i++) {\n const accountKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));\n const writableIndexesLength = decodeLength(byteArray);\n const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);\n const readonlyIndexesLength = decodeLength(byteArray);\n const readonlyIndexes = guardedSplice(byteArray, 0, readonlyIndexesLength);\n addressTableLookups.push({\n accountKey,\n writableIndexes,\n readonlyIndexes\n });\n }\n return new MessageV0({\n header,\n staticAccountKeys,\n recentBlockhash,\n compiledInstructions,\n addressTableLookups\n });\n }\n}\n\n// eslint-disable-next-line no-redeclare\nconst VersionedMessage = {\n deserializeMessageVersion(serializedMessage) {\n const prefix = serializedMessage[0];\n const maskedPrefix = prefix & VERSION_PREFIX_MASK;\n\n // if the highest bit of the prefix is not set, the message is not versioned\n if (maskedPrefix === prefix) {\n return 'legacy';\n }\n\n // the lower 7 bits of the prefix indicate the message version\n return maskedPrefix;\n },\n deserialize: serializedMessage => {\n const version = VersionedMessage.deserializeMessageVersion(serializedMessage);\n if (version === 'legacy') {\n return Message.from(serializedMessage);\n }\n if (version === 0) {\n return MessageV0.deserialize(serializedMessage);\n } else {\n throw new Error(`Transaction message version ${version} deserialization is not supported`);\n }\n }\n};\n\n/** @internal */\n\n/**\n * Transaction signature as base-58 encoded string\n */\n\nlet TransactionStatus = /*#__PURE__*/function (TransactionStatus) {\n TransactionStatus[TransactionStatus[\"BLOCKHEIGHT_EXCEEDED\"] = 0] = \"BLOCKHEIGHT_EXCEEDED\";\n TransactionStatus[TransactionStatus[\"PROCESSED\"] = 1] = \"PROCESSED\";\n TransactionStatus[TransactionStatus[\"TIMED_OUT\"] = 2] = \"TIMED_OUT\";\n TransactionStatus[TransactionStatus[\"NONCE_INVALID\"] = 3] = \"NONCE_INVALID\";\n return TransactionStatus;\n}({});\n\n/**\n * Default (empty) signature\n */\nconst DEFAULT_SIGNATURE = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);\n\n/**\n * Account metadata used to define instructions\n */\n\n/**\n * List of TransactionInstruction object fields that may be initialized at construction\n */\n\n/**\n * Configuration object for Transaction.serialize()\n */\n\n/**\n * @internal\n */\n\n/**\n * Transaction Instruction class\n */\nclass TransactionInstruction {\n constructor(opts) {\n /**\n * Public keys to include in this transaction\n * Boolean represents whether this pubkey needs to sign the transaction\n */\n this.keys = void 0;\n /**\n * Program Id to execute\n */\n this.programId = void 0;\n /**\n * Program input\n */\n this.data = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(0);\n this.programId = opts.programId;\n this.keys = opts.keys;\n if (opts.data) {\n this.data = opts.data;\n }\n }\n\n /**\n * @internal\n */\n toJSON() {\n return {\n keys: this.keys.map(({\n pubkey,\n isSigner,\n isWritable\n }) => ({\n pubkey: pubkey.toJSON(),\n isSigner,\n isWritable\n })),\n programId: this.programId.toJSON(),\n data: [...this.data]\n };\n }\n}\n\n/**\n * Pair of signature and corresponding public key\n */\n\n/**\n * List of Transaction object fields that may be initialized at construction\n */\n\n// For backward compatibility; an unfortunate consequence of being\n// forced to over-export types by the documentation generator.\n// See https://github.com/solana-labs/solana/pull/25820\n\n/**\n * Blockhash-based transactions have a lifetime that are defined by\n * the blockhash they include. Any transaction whose blockhash is\n * too old will be rejected.\n */\n\n/**\n * Use these options to construct a durable nonce transaction.\n */\n\n/**\n * Nonce information to be used to build an offline Transaction.\n */\n\n/**\n * @internal\n */\n\n/**\n * Transaction class\n */\nclass Transaction {\n /**\n * The first (payer) Transaction signature\n *\n * @returns {Buffer | null} Buffer of payer's signature\n */\n get signature() {\n if (this.signatures.length > 0) {\n return this.signatures[0].signature;\n }\n return null;\n }\n\n /**\n * The transaction fee payer\n */\n\n // Construct a transaction with a blockhash and lastValidBlockHeight\n\n // Construct a transaction using a durable nonce\n\n /**\n * @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.\n * Please supply a `TransactionBlockhashCtor` instead.\n */\n\n /**\n * Construct an empty Transaction\n */\n constructor(opts) {\n /**\n * Signatures for the transaction. Typically created by invoking the\n * `sign()` method\n */\n this.signatures = [];\n this.feePayer = void 0;\n /**\n * The instructions to atomically execute\n */\n this.instructions = [];\n /**\n * A recent transaction id. Must be populated by the caller\n */\n this.recentBlockhash = void 0;\n /**\n * the last block chain can advance to before tx is declared expired\n * */\n this.lastValidBlockHeight = void 0;\n /**\n * Optional Nonce information. If populated, transaction will use a durable\n * Nonce hash instead of a recentBlockhash. Must be populated by the caller\n */\n this.nonceInfo = void 0;\n /**\n * If this is a nonce transaction this represents the minimum slot from which\n * to evaluate if the nonce has advanced when attempting to confirm the\n * transaction. This protects against a case where the transaction confirmation\n * logic loads the nonce account from an old slot and assumes the mismatch in\n * nonce value implies that the nonce has been advanced.\n */\n this.minNonceContextSlot = void 0;\n /**\n * @internal\n */\n this._message = void 0;\n /**\n * @internal\n */\n this._json = void 0;\n if (!opts) {\n return;\n }\n if (opts.feePayer) {\n this.feePayer = opts.feePayer;\n }\n if (opts.signatures) {\n this.signatures = opts.signatures;\n }\n if (Object.prototype.hasOwnProperty.call(opts, 'nonceInfo')) {\n const {\n minContextSlot,\n nonceInfo\n } = opts;\n this.minNonceContextSlot = minContextSlot;\n this.nonceInfo = nonceInfo;\n } else if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {\n const {\n blockhash,\n lastValidBlockHeight\n } = opts;\n this.recentBlockhash = blockhash;\n this.lastValidBlockHeight = lastValidBlockHeight;\n } else {\n const {\n recentBlockhash,\n nonceInfo\n } = opts;\n if (nonceInfo) {\n this.nonceInfo = nonceInfo;\n }\n this.recentBlockhash = recentBlockhash;\n }\n }\n\n /**\n * @internal\n */\n toJSON() {\n return {\n recentBlockhash: this.recentBlockhash || null,\n feePayer: this.feePayer ? this.feePayer.toJSON() : null,\n nonceInfo: this.nonceInfo ? {\n nonce: this.nonceInfo.nonce,\n nonceInstruction: this.nonceInfo.nonceInstruction.toJSON()\n } : null,\n instructions: this.instructions.map(instruction => instruction.toJSON()),\n signers: this.signatures.map(({\n publicKey\n }) => {\n return publicKey.toJSON();\n })\n };\n }\n\n /**\n * Add one or more instructions to this Transaction\n *\n * @param {Array< Transaction | TransactionInstruction | TransactionInstructionCtorFields >} items - Instructions to add to the Transaction\n */\n add(...items) {\n if (items.length === 0) {\n throw new Error('No instructions');\n }\n items.forEach(item => {\n if ('instructions' in item) {\n this.instructions = this.instructions.concat(item.instructions);\n } else if ('data' in item && 'programId' in item && 'keys' in item) {\n this.instructions.push(item);\n } else {\n this.instructions.push(new TransactionInstruction(item));\n }\n });\n return this;\n }\n\n /**\n * Compile transaction data\n */\n compileMessage() {\n if (this._message && JSON.stringify(this.toJSON()) === JSON.stringify(this._json)) {\n return this._message;\n }\n let recentBlockhash;\n let instructions;\n if (this.nonceInfo) {\n recentBlockhash = this.nonceInfo.nonce;\n if (this.instructions[0] != this.nonceInfo.nonceInstruction) {\n instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];\n } else {\n instructions = this.instructions;\n }\n } else {\n recentBlockhash = this.recentBlockhash;\n instructions = this.instructions;\n }\n if (!recentBlockhash) {\n throw new Error('Transaction recentBlockhash required');\n }\n if (instructions.length < 1) {\n console.warn('No instructions provided');\n }\n let feePayer;\n if (this.feePayer) {\n feePayer = this.feePayer;\n } else if (this.signatures.length > 0 && this.signatures[0].publicKey) {\n // Use implicit fee payer\n feePayer = this.signatures[0].publicKey;\n } else {\n throw new Error('Transaction fee payer required');\n }\n for (let i = 0; i < instructions.length; i++) {\n if (instructions[i].programId === undefined) {\n throw new Error(`Transaction instruction index ${i} has undefined program id`);\n }\n }\n const programIds = [];\n const accountMetas = [];\n instructions.forEach(instruction => {\n instruction.keys.forEach(accountMeta => {\n accountMetas.push({\n ...accountMeta\n });\n });\n const programId = instruction.programId.toString();\n if (!programIds.includes(programId)) {\n programIds.push(programId);\n }\n });\n\n // Append programID account metas\n programIds.forEach(programId => {\n accountMetas.push({\n pubkey: new PublicKey(programId),\n isSigner: false,\n isWritable: false\n });\n });\n\n // Cull duplicate account metas\n const uniqueMetas = [];\n accountMetas.forEach(accountMeta => {\n const pubkeyString = accountMeta.pubkey.toString();\n const uniqueIndex = uniqueMetas.findIndex(x => {\n return x.pubkey.toString() === pubkeyString;\n });\n if (uniqueIndex > -1) {\n uniqueMetas[uniqueIndex].isWritable = uniqueMetas[uniqueIndex].isWritable || accountMeta.isWritable;\n uniqueMetas[uniqueIndex].isSigner = uniqueMetas[uniqueIndex].isSigner || accountMeta.isSigner;\n } else {\n uniqueMetas.push(accountMeta);\n }\n });\n\n // Sort. Prioritizing first by signer, then by writable\n uniqueMetas.sort(function (x, y) {\n if (x.isSigner !== y.isSigner) {\n // Signers always come before non-signers\n return x.isSigner ? -1 : 1;\n }\n if (x.isWritable !== y.isWritable) {\n // Writable accounts always come before read-only accounts\n return x.isWritable ? -1 : 1;\n }\n // Otherwise, sort by pubkey, stringwise.\n const options = {\n localeMatcher: 'best fit',\n usage: 'sort',\n sensitivity: 'variant',\n ignorePunctuation: false,\n numeric: false,\n caseFirst: 'lower'\n };\n return x.pubkey.toBase58().localeCompare(y.pubkey.toBase58(), 'en', options);\n });\n\n // Move fee payer to the front\n const feePayerIndex = uniqueMetas.findIndex(x => {\n return x.pubkey.equals(feePayer);\n });\n if (feePayerIndex > -1) {\n const [payerMeta] = uniqueMetas.splice(feePayerIndex, 1);\n payerMeta.isSigner = true;\n payerMeta.isWritable = true;\n uniqueMetas.unshift(payerMeta);\n } else {\n uniqueMetas.unshift({\n pubkey: feePayer,\n isSigner: true,\n isWritable: true\n });\n }\n\n // Disallow unknown signers\n for (const signature of this.signatures) {\n const uniqueIndex = uniqueMetas.findIndex(x => {\n return x.pubkey.equals(signature.publicKey);\n });\n if (uniqueIndex > -1) {\n if (!uniqueMetas[uniqueIndex].isSigner) {\n uniqueMetas[uniqueIndex].isSigner = true;\n console.warn('Transaction references a signature that is unnecessary, ' + 'only the fee payer and instruction signer accounts should sign a transaction. ' + 'This behavior is deprecated and will throw an error in the next major version release.');\n }\n } else {\n throw new Error(`unknown signer: ${signature.publicKey.toString()}`);\n }\n }\n let numRequiredSignatures = 0;\n let numReadonlySignedAccounts = 0;\n let numReadonlyUnsignedAccounts = 0;\n\n // Split out signing from non-signing keys and count header values\n const signedKeys = [];\n const unsignedKeys = [];\n uniqueMetas.forEach(({\n pubkey,\n isSigner,\n isWritable\n }) => {\n if (isSigner) {\n signedKeys.push(pubkey.toString());\n numRequiredSignatures += 1;\n if (!isWritable) {\n numReadonlySignedAccounts += 1;\n }\n } else {\n unsignedKeys.push(pubkey.toString());\n if (!isWritable) {\n numReadonlyUnsignedAccounts += 1;\n }\n }\n });\n const accountKeys = signedKeys.concat(unsignedKeys);\n const compiledInstructions = instructions.map(instruction => {\n const {\n data,\n programId\n } = instruction;\n return {\n programIdIndex: accountKeys.indexOf(programId.toString()),\n accounts: instruction.keys.map(meta => accountKeys.indexOf(meta.pubkey.toString())),\n data: bs58__WEBPACK_IMPORTED_MODULE_2___default().encode(data)\n };\n });\n compiledInstructions.forEach(instruction => {\n assert(instruction.programIdIndex >= 0);\n instruction.accounts.forEach(keyIndex => assert(keyIndex >= 0));\n });\n return new Message({\n header: {\n numRequiredSignatures,\n numReadonlySignedAccounts,\n numReadonlyUnsignedAccounts\n },\n accountKeys,\n recentBlockhash,\n instructions: compiledInstructions\n });\n }\n\n /**\n * @internal\n */\n _compile() {\n const message = this.compileMessage();\n const signedKeys = message.accountKeys.slice(0, message.header.numRequiredSignatures);\n if (this.signatures.length === signedKeys.length) {\n const valid = this.signatures.every((pair, index) => {\n return signedKeys[index].equals(pair.publicKey);\n });\n if (valid) return message;\n }\n this.signatures = signedKeys.map(publicKey => ({\n signature: null,\n publicKey\n }));\n return message;\n }\n\n /**\n * Get a buffer of the Transaction data that need to be covered by signatures\n */\n serializeMessage() {\n return this._compile().serialize();\n }\n\n /**\n * Get the estimated fee associated with a transaction\n *\n * @param {Connection} connection Connection to RPC Endpoint.\n *\n * @returns {Promise} The estimated fee for the transaction\n */\n async getEstimatedFee(connection) {\n return (await connection.getFeeForMessage(this.compileMessage())).value;\n }\n\n /**\n * Specify the public keys which will be used to sign the Transaction.\n * The first signer will be used as the transaction fee payer account.\n *\n * Signatures can be added with either `partialSign` or `addSignature`\n *\n * @deprecated Deprecated since v0.84.0. Only the fee payer needs to be\n * specified and it can be set in the Transaction constructor or with the\n * `feePayer` property.\n */\n setSigners(...signers) {\n if (signers.length === 0) {\n throw new Error('No signers');\n }\n const seen = new Set();\n this.signatures = signers.filter(publicKey => {\n const key = publicKey.toString();\n if (seen.has(key)) {\n return false;\n } else {\n seen.add(key);\n return true;\n }\n }).map(publicKey => ({\n signature: null,\n publicKey\n }));\n }\n\n /**\n * Sign the Transaction with the specified signers. Multiple signatures may\n * be applied to a Transaction. The first signature is considered \"primary\"\n * and is used identify and confirm transactions.\n *\n * If the Transaction `feePayer` is not set, the first signer will be used\n * as the transaction fee payer account.\n *\n * Transaction fields should not be modified after the first call to `sign`,\n * as doing so may invalidate the signature and cause the Transaction to be\n * rejected.\n *\n * The Transaction must be assigned a valid `recentBlockhash` before invoking this method\n *\n * @param {Array} signers Array of signers that will sign the transaction\n */\n sign(...signers) {\n if (signers.length === 0) {\n throw new Error('No signers');\n }\n\n // Dedupe signers\n const seen = new Set();\n const uniqueSigners = [];\n for (const signer of signers) {\n const key = signer.publicKey.toString();\n if (seen.has(key)) {\n continue;\n } else {\n seen.add(key);\n uniqueSigners.push(signer);\n }\n }\n this.signatures = uniqueSigners.map(signer => ({\n signature: null,\n publicKey: signer.publicKey\n }));\n const message = this._compile();\n this._partialSign(message, ...uniqueSigners);\n }\n\n /**\n * Partially sign a transaction with the specified accounts. All accounts must\n * correspond to either the fee payer or a signer account in the transaction\n * instructions.\n *\n * All the caveats from the `sign` method apply to `partialSign`\n *\n * @param {Array} signers Array of signers that will sign the transaction\n */\n partialSign(...signers) {\n if (signers.length === 0) {\n throw new Error('No signers');\n }\n\n // Dedupe signers\n const seen = new Set();\n const uniqueSigners = [];\n for (const signer of signers) {\n const key = signer.publicKey.toString();\n if (seen.has(key)) {\n continue;\n } else {\n seen.add(key);\n uniqueSigners.push(signer);\n }\n }\n const message = this._compile();\n this._partialSign(message, ...uniqueSigners);\n }\n\n /**\n * @internal\n */\n _partialSign(message, ...signers) {\n const signData = message.serialize();\n signers.forEach(signer => {\n const signature = sign(signData, signer.secretKey);\n this._addSignature(signer.publicKey, toBuffer(signature));\n });\n }\n\n /**\n * Add an externally created signature to a transaction. The public key\n * must correspond to either the fee payer or a signer account in the transaction\n * instructions.\n *\n * @param {PublicKey} pubkey Public key that will be added to the transaction.\n * @param {Buffer} signature An externally created signature to add to the transaction.\n */\n addSignature(pubkey, signature) {\n this._compile(); // Ensure signatures array is populated\n this._addSignature(pubkey, signature);\n }\n\n /**\n * @internal\n */\n _addSignature(pubkey, signature) {\n assert(signature.length === 64);\n const index = this.signatures.findIndex(sigpair => pubkey.equals(sigpair.publicKey));\n if (index < 0) {\n throw new Error(`unknown signer: ${pubkey.toString()}`);\n }\n this.signatures[index].signature = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signature);\n }\n\n /**\n * Verify signatures of a Transaction\n * Optional parameter specifies if we're expecting a fully signed Transaction or a partially signed one.\n * If no boolean is provided, we expect a fully signed Transaction by default.\n *\n * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction\n */\n verifySignatures(requireAllSignatures = true) {\n const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);\n return !signatureErrors;\n }\n\n /**\n * @internal\n */\n _getMessageSignednessErrors(message, requireAllSignatures) {\n const errors = {};\n for (const {\n signature,\n publicKey\n } of this.signatures) {\n if (signature === null) {\n if (requireAllSignatures) {\n (errors.missing ||= []).push(publicKey);\n }\n } else {\n if (!verify(signature, message, publicKey.toBytes())) {\n (errors.invalid ||= []).push(publicKey);\n }\n }\n }\n return errors.invalid || errors.missing ? errors : undefined;\n }\n\n /**\n * Serialize the Transaction in the wire format.\n *\n * @param {Buffer} [config] Config of transaction.\n *\n * @returns {Buffer} Signature of transaction in wire format.\n */\n serialize(config) {\n const {\n requireAllSignatures,\n verifySignatures\n } = Object.assign({\n requireAllSignatures: true,\n verifySignatures: true\n }, config);\n const signData = this.serializeMessage();\n if (verifySignatures) {\n const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);\n if (sigErrors) {\n let errorMessage = 'Signature verification failed.';\n if (sigErrors.invalid) {\n errorMessage += `\\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\\`].`;\n }\n if (sigErrors.missing) {\n errorMessage += `\\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\\`].`;\n }\n throw new Error(errorMessage);\n }\n }\n return this._serialize(signData);\n }\n\n /**\n * @internal\n */\n _serialize(signData) {\n const {\n signatures\n } = this;\n const signatureCount = [];\n encodeLength(signatureCount, signatures.length);\n const transactionLength = signatureCount.length + signatures.length * 64 + signData.length;\n const wireTransaction = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(transactionLength);\n assert(signatures.length < 256);\n buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signatureCount).copy(wireTransaction, 0);\n signatures.forEach(({\n signature\n }, index) => {\n if (signature !== null) {\n assert(signature.length === 64, `signature has invalid length`);\n buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signature).copy(wireTransaction, signatureCount.length + index * 64);\n }\n });\n signData.copy(wireTransaction, signatureCount.length + signatures.length * 64);\n assert(wireTransaction.length <= PACKET_DATA_SIZE, `Transaction too large: ${wireTransaction.length} > ${PACKET_DATA_SIZE}`);\n return wireTransaction;\n }\n\n /**\n * Deprecated method\n * @internal\n */\n get keys() {\n assert(this.instructions.length === 1);\n return this.instructions[0].keys.map(keyObj => keyObj.pubkey);\n }\n\n /**\n * Deprecated method\n * @internal\n */\n get programId() {\n assert(this.instructions.length === 1);\n return this.instructions[0].programId;\n }\n\n /**\n * Deprecated method\n * @internal\n */\n get data() {\n assert(this.instructions.length === 1);\n return this.instructions[0].data;\n }\n\n /**\n * Parse a wire transaction into a Transaction object.\n *\n * @param {Buffer | Uint8Array | Array} buffer Signature of wire Transaction\n *\n * @returns {Transaction} Transaction associated with the signature\n */\n static from(buffer) {\n // Slice up wire data\n let byteArray = [...buffer];\n const signatureCount = decodeLength(byteArray);\n let signatures = [];\n for (let i = 0; i < signatureCount; i++) {\n const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);\n signatures.push(bs58__WEBPACK_IMPORTED_MODULE_2___default().encode(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signature)));\n }\n return Transaction.populate(Message.from(byteArray), signatures);\n }\n\n /**\n * Populate Transaction object from message and signatures\n *\n * @param {Message} message Message of transaction\n * @param {Array} signatures List of signatures to assign to the transaction\n *\n * @returns {Transaction} The populated Transaction\n */\n static populate(message, signatures = []) {\n const transaction = new Transaction();\n transaction.recentBlockhash = message.recentBlockhash;\n if (message.header.numRequiredSignatures > 0) {\n transaction.feePayer = message.accountKeys[0];\n }\n signatures.forEach((signature, index) => {\n const sigPubkeyPair = {\n signature: signature == bs58__WEBPACK_IMPORTED_MODULE_2___default().encode(DEFAULT_SIGNATURE) ? null : bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(signature),\n publicKey: message.accountKeys[index]\n };\n transaction.signatures.push(sigPubkeyPair);\n });\n message.instructions.forEach(instruction => {\n const keys = instruction.accounts.map(account => {\n const pubkey = message.accountKeys[account];\n return {\n pubkey,\n isSigner: transaction.signatures.some(keyObj => keyObj.publicKey.toString() === pubkey.toString()) || message.isAccountSigner(account),\n isWritable: message.isAccountWritable(account)\n };\n });\n transaction.instructions.push(new TransactionInstruction({\n keys,\n programId: message.accountKeys[instruction.programIdIndex],\n data: bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(instruction.data)\n }));\n });\n transaction._message = message;\n transaction._json = transaction.toJSON();\n return transaction;\n }\n}\n\nclass TransactionMessage {\n constructor(args) {\n this.payerKey = void 0;\n this.instructions = void 0;\n this.recentBlockhash = void 0;\n this.payerKey = args.payerKey;\n this.instructions = args.instructions;\n this.recentBlockhash = args.recentBlockhash;\n }\n static decompile(message, args) {\n const {\n header,\n compiledInstructions,\n recentBlockhash\n } = message;\n const {\n numRequiredSignatures,\n numReadonlySignedAccounts,\n numReadonlyUnsignedAccounts\n } = header;\n const numWritableSignedAccounts = numRequiredSignatures - numReadonlySignedAccounts;\n assert(numWritableSignedAccounts > 0, 'Message header is invalid');\n const numWritableUnsignedAccounts = message.staticAccountKeys.length - numRequiredSignatures - numReadonlyUnsignedAccounts;\n assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid');\n const accountKeys = message.getAccountKeys(args);\n const payerKey = accountKeys.get(0);\n if (payerKey === undefined) {\n throw new Error('Failed to decompile message because no account keys were found');\n }\n const instructions = [];\n for (const compiledIx of compiledInstructions) {\n const keys = [];\n for (const keyIndex of compiledIx.accountKeyIndexes) {\n const pubkey = accountKeys.get(keyIndex);\n if (pubkey === undefined) {\n throw new Error(`Failed to find key for account key index ${keyIndex}`);\n }\n const isSigner = keyIndex < numRequiredSignatures;\n let isWritable;\n if (isSigner) {\n isWritable = keyIndex < numWritableSignedAccounts;\n } else if (keyIndex < accountKeys.staticAccountKeys.length) {\n isWritable = keyIndex - numRequiredSignatures < numWritableUnsignedAccounts;\n } else {\n isWritable = keyIndex - accountKeys.staticAccountKeys.length <\n // accountKeysFromLookups cannot be undefined because we already found a pubkey for this index above\n accountKeys.accountKeysFromLookups.writable.length;\n }\n keys.push({\n pubkey,\n isSigner: keyIndex < header.numRequiredSignatures,\n isWritable\n });\n }\n const programId = accountKeys.get(compiledIx.programIdIndex);\n if (programId === undefined) {\n throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);\n }\n instructions.push(new TransactionInstruction({\n programId,\n data: toBuffer(compiledIx.data),\n keys\n }));\n }\n return new TransactionMessage({\n payerKey,\n instructions,\n recentBlockhash\n });\n }\n compileToLegacyMessage() {\n return Message.compile({\n payerKey: this.payerKey,\n recentBlockhash: this.recentBlockhash,\n instructions: this.instructions\n });\n }\n compileToV0Message(addressLookupTableAccounts) {\n return MessageV0.compile({\n payerKey: this.payerKey,\n recentBlockhash: this.recentBlockhash,\n instructions: this.instructions,\n addressLookupTableAccounts\n });\n }\n}\n\n/**\n * Versioned transaction class\n */\nclass VersionedTransaction {\n get version() {\n return this.message.version;\n }\n constructor(message, signatures) {\n this.signatures = void 0;\n this.message = void 0;\n if (signatures !== undefined) {\n assert(signatures.length === message.header.numRequiredSignatures, 'Expected signatures length to be equal to the number of required signatures');\n this.signatures = signatures;\n } else {\n const defaultSignatures = [];\n for (let i = 0; i < message.header.numRequiredSignatures; i++) {\n defaultSignatures.push(new Uint8Array(SIGNATURE_LENGTH_IN_BYTES));\n }\n this.signatures = defaultSignatures;\n }\n this.message = message;\n }\n serialize() {\n const serializedMessage = this.message.serialize();\n const encodedSignaturesLength = Array();\n encodeLength(encodedSignaturesLength, this.signatures.length);\n const transactionLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(encodedSignaturesLength.length, 'encodedSignaturesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(signature(), this.signatures.length, 'signatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(serializedMessage.length, 'serializedMessage')]);\n const serializedTransaction = new Uint8Array(2048);\n const serializedTransactionLength = transactionLayout.encode({\n encodedSignaturesLength: new Uint8Array(encodedSignaturesLength),\n signatures: this.signatures,\n serializedMessage\n }, serializedTransaction);\n return serializedTransaction.slice(0, serializedTransactionLength);\n }\n static deserialize(serializedTransaction) {\n let byteArray = [...serializedTransaction];\n const signatures = [];\n const signaturesLength = decodeLength(byteArray);\n for (let i = 0; i < signaturesLength; i++) {\n signatures.push(new Uint8Array(guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES)));\n }\n const message = VersionedMessage.deserialize(new Uint8Array(byteArray));\n return new VersionedTransaction(message, signatures);\n }\n sign(signers) {\n const messageData = this.message.serialize();\n const signerPubkeys = this.message.staticAccountKeys.slice(0, this.message.header.numRequiredSignatures);\n for (const signer of signers) {\n const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(signer.publicKey));\n assert(signerIndex >= 0, `Cannot sign with non signer key ${signer.publicKey.toBase58()}`);\n this.signatures[signerIndex] = sign(messageData, signer.secretKey);\n }\n }\n addSignature(publicKey, signature) {\n assert(signature.byteLength === 64, 'Signature must be 64 bytes long');\n const signerPubkeys = this.message.staticAccountKeys.slice(0, this.message.header.numRequiredSignatures);\n const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(publicKey));\n assert(signerIndex >= 0, `Can not add signature; \\`${publicKey.toBase58()}\\` is not required to sign this transaction`);\n this.signatures[signerIndex] = signature;\n }\n}\n\n// TODO: These constants should be removed in favor of reading them out of a\n// Syscall account\n\n/**\n * @internal\n */\nconst NUM_TICKS_PER_SECOND = 160;\n\n/**\n * @internal\n */\nconst DEFAULT_TICKS_PER_SLOT = 64;\n\n/**\n * @internal\n */\nconst NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;\n\n/**\n * @internal\n */\nconst MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;\n\nconst SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');\nconst SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey('SysvarEpochSchedu1e111111111111111111111111');\nconst SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey('Sysvar1nstructions1111111111111111111111111');\nconst SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey('SysvarRecentB1ockHashes11111111111111111111');\nconst SYSVAR_RENT_PUBKEY = new PublicKey('SysvarRent111111111111111111111111111111111');\nconst SYSVAR_REWARDS_PUBKEY = new PublicKey('SysvarRewards111111111111111111111111111111');\nconst SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey('SysvarS1otHashes111111111111111111111111111');\nconst SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey('SysvarS1otHistory11111111111111111111111111');\nconst SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey('SysvarStakeHistory1111111111111111111111111');\n\nclass SendTransactionError extends Error {\n constructor({\n action,\n signature,\n transactionMessage,\n logs\n }) {\n const maybeLogsOutput = logs ? `Logs: \\n${JSON.stringify(logs.slice(-10), null, 2)}. ` : '';\n const guideText = '\\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.';\n let message;\n switch (action) {\n case 'send':\n message = `Transaction ${signature} resulted in an error. \\n` + `${transactionMessage}. ` + maybeLogsOutput + guideText;\n break;\n case 'simulate':\n message = `Simulation failed. \\nMessage: ${transactionMessage}. \\n` + maybeLogsOutput + guideText;\n break;\n default:\n {\n message = `Unknown action '${(a => a)(action)}'`;\n }\n }\n super(message);\n this.signature = void 0;\n this.transactionMessage = void 0;\n this.transactionLogs = void 0;\n this.signature = signature;\n this.transactionMessage = transactionMessage;\n this.transactionLogs = logs ? logs : undefined;\n }\n get transactionError() {\n return {\n message: this.transactionMessage,\n logs: Array.isArray(this.transactionLogs) ? this.transactionLogs : undefined\n };\n }\n\n /* @deprecated Use `await getLogs()` instead */\n get logs() {\n const cachedLogs = this.transactionLogs;\n if (cachedLogs != null && typeof cachedLogs === 'object' && 'then' in cachedLogs) {\n return undefined;\n }\n return cachedLogs;\n }\n async getLogs(connection) {\n if (!Array.isArray(this.transactionLogs)) {\n this.transactionLogs = new Promise((resolve, reject) => {\n connection.getTransaction(this.signature).then(tx => {\n if (tx && tx.meta && tx.meta.logMessages) {\n const logs = tx.meta.logMessages;\n this.transactionLogs = logs;\n resolve(logs);\n } else {\n reject(new Error('Log messages not found'));\n }\n }).catch(reject);\n });\n }\n return await this.transactionLogs;\n }\n}\n\n// Keep in sync with client/src/rpc_custom_errors.rs\n// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/\nconst SolanaJSONRPCErrorCode = {\n JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001,\n JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002,\n JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003,\n JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004,\n JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005,\n JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006,\n JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007,\n JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008,\n JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009,\n JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010,\n JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011,\n JSON_RPC_SCAN_ERROR: -32012,\n JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013,\n JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014,\n JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015,\n JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016\n};\nclass SolanaJSONRPCError extends Error {\n constructor({\n code,\n message,\n data\n }, customMessage) {\n super(customMessage != null ? `${customMessage}: ${message}` : message);\n this.code = void 0;\n this.data = void 0;\n this.code = code;\n this.data = data;\n this.name = 'SolanaJSONRPCError';\n }\n}\n\n/**\n * Sign, send and confirm a transaction.\n *\n * If `commitment` option is not specified, defaults to 'max' commitment.\n *\n * @param {Connection} connection\n * @param {Transaction} transaction\n * @param {Array} signers\n * @param {ConfirmOptions} [options]\n * @returns {Promise}\n */\nasync function sendAndConfirmTransaction(connection, transaction, signers, options) {\n const sendOptions = options && {\n skipPreflight: options.skipPreflight,\n preflightCommitment: options.preflightCommitment || options.commitment,\n maxRetries: options.maxRetries,\n minContextSlot: options.minContextSlot\n };\n const signature = await connection.sendTransaction(transaction, signers, sendOptions);\n let status;\n if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {\n status = (await connection.confirmTransaction({\n abortSignal: options?.abortSignal,\n signature: signature,\n blockhash: transaction.recentBlockhash,\n lastValidBlockHeight: transaction.lastValidBlockHeight\n }, options && options.commitment)).value;\n } else if (transaction.minNonceContextSlot != null && transaction.nonceInfo != null) {\n const {\n nonceInstruction\n } = transaction.nonceInfo;\n const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;\n status = (await connection.confirmTransaction({\n abortSignal: options?.abortSignal,\n minContextSlot: transaction.minNonceContextSlot,\n nonceAccountPubkey,\n nonceValue: transaction.nonceInfo.nonce,\n signature\n }, options && options.commitment)).value;\n } else {\n if (options?.abortSignal != null) {\n console.warn('sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was ' + 'supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` ' + 'or a combination of `nonceInfo` and `minNonceContextSlot` are abortable.');\n }\n status = (await connection.confirmTransaction(signature, options && options.commitment)).value;\n }\n if (status.err) {\n if (signature != null) {\n throw new SendTransactionError({\n action: 'send',\n signature: signature,\n transactionMessage: `Status: (${JSON.stringify(status)})`\n });\n }\n throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);\n }\n return signature;\n}\n\n// zzz\nfunction sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/**\n * @internal\n */\n\n/**\n * Populate a buffer of instruction data using an InstructionType\n * @internal\n */\nfunction encodeData(type, fields) {\n const allocLength = type.layout.span >= 0 ? type.layout.span : getAlloc(type, fields);\n const data = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(allocLength);\n const layoutFields = Object.assign({\n instruction: type.index\n }, fields);\n type.layout.encode(layoutFields, data);\n return data;\n}\n\n/**\n * Decode instruction data buffer using an InstructionType\n * @internal\n */\nfunction decodeData$1(type, buffer) {\n let data;\n try {\n data = type.layout.decode(buffer);\n } catch (err) {\n throw new Error('invalid instruction; ' + err);\n }\n if (data.instruction !== type.index) {\n throw new Error(`invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`);\n }\n return data;\n}\n\n/**\n * https://github.com/solana-labs/solana/blob/90bedd7e067b5b8f3ddbb45da00a4e9cabb22c62/sdk/src/fee_calculator.rs#L7-L11\n *\n * @internal\n */\nconst FeeCalculatorLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('lamportsPerSignature');\n\n/**\n * Calculator for transaction fees.\n *\n * @deprecated Deprecated since Solana v1.8.0.\n */\n\n/**\n * See https://github.com/solana-labs/solana/blob/0ea2843ec9cdc517572b8e62c959f41b55cf4453/sdk/src/nonce_state.rs#L29-L32\n *\n * @internal\n */\nconst NonceAccountLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('version'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('state'), publicKey('authorizedPubkey'), publicKey('nonce'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([FeeCalculatorLayout], 'feeCalculator')]);\nconst NONCE_ACCOUNT_LENGTH = NonceAccountLayout.span;\n\n/**\n * A durable nonce is a 32 byte value encoded as a base58 string.\n */\n\n/**\n * NonceAccount class\n */\nclass NonceAccount {\n /**\n * @internal\n */\n constructor(args) {\n this.authorizedPubkey = void 0;\n this.nonce = void 0;\n this.feeCalculator = void 0;\n this.authorizedPubkey = args.authorizedPubkey;\n this.nonce = args.nonce;\n this.feeCalculator = args.feeCalculator;\n }\n\n /**\n * Deserialize NonceAccount from the account data.\n *\n * @param buffer account data\n * @return NonceAccount\n */\n static fromAccountData(buffer) {\n const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer), 0);\n return new NonceAccount({\n authorizedPubkey: new PublicKey(nonceAccount.authorizedPubkey),\n nonce: new PublicKey(nonceAccount.nonce).toString(),\n feeCalculator: nonceAccount.feeCalculator\n });\n }\n}\n\nconst encodeDecode = layout => {\n const decode = layout.decode.bind(layout);\n const encode = layout.encode.bind(layout);\n return {\n decode,\n encode\n };\n};\nconst bigInt = length => property => {\n const layout = (0,_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob)(length, property);\n const {\n encode,\n decode\n } = encodeDecode(layout);\n const bigIntLayout = layout;\n bigIntLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return (0,bigint_buffer__WEBPACK_IMPORTED_MODULE_5__.toBigIntLE)(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(src));\n };\n bigIntLayout.encode = (bigInt, buffer, offset) => {\n const src = (0,bigint_buffer__WEBPACK_IMPORTED_MODULE_5__.toBufferLE)(bigInt, length);\n return encode(src, buffer, offset);\n };\n return bigIntLayout;\n};\nconst u64 = bigInt(8);\n\n/**\n * Create account system transaction params\n */\n\n/**\n * Transfer system transaction params\n */\n\n/**\n * Assign system transaction params\n */\n\n/**\n * Create account with seed system transaction params\n */\n\n/**\n * Create nonce account system transaction params\n */\n\n/**\n * Create nonce account with seed system transaction params\n */\n\n/**\n * Initialize nonce account system instruction params\n */\n\n/**\n * Advance nonce account system instruction params\n */\n\n/**\n * Withdraw nonce account system transaction params\n */\n\n/**\n * Authorize nonce account system transaction params\n */\n\n/**\n * Allocate account system transaction params\n */\n\n/**\n * Allocate account with seed system transaction params\n */\n\n/**\n * Assign account with seed system transaction params\n */\n\n/**\n * Transfer with seed system transaction params\n */\n\n/** Decoded transfer system transaction instruction */\n\n/** Decoded transferWithSeed system transaction instruction */\n\n/**\n * System Instruction class\n */\nclass SystemInstruction {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Decode a system instruction and retrieve the instruction type.\n */\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [ixType, layout] of Object.entries(SYSTEM_INSTRUCTION_LAYOUTS)) {\n if (layout.index == typeIndex) {\n type = ixType;\n break;\n }\n }\n if (!type) {\n throw new Error('Instruction type incorrect; not a SystemInstruction');\n }\n return type;\n }\n\n /**\n * Decode a create account system instruction and retrieve the instruction params.\n */\n static decodeCreateAccount(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n lamports,\n space,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Create, instruction.data);\n return {\n fromPubkey: instruction.keys[0].pubkey,\n newAccountPubkey: instruction.keys[1].pubkey,\n lamports,\n space,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode a transfer system instruction and retrieve the instruction params.\n */\n static decodeTransfer(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n lamports\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Transfer, instruction.data);\n return {\n fromPubkey: instruction.keys[0].pubkey,\n toPubkey: instruction.keys[1].pubkey,\n lamports\n };\n }\n\n /**\n * Decode a transfer with seed system instruction and retrieve the instruction params.\n */\n static decodeTransferWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n lamports,\n seed,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed, instruction.data);\n return {\n fromPubkey: instruction.keys[0].pubkey,\n basePubkey: instruction.keys[1].pubkey,\n toPubkey: instruction.keys[2].pubkey,\n lamports,\n seed,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode an allocate system instruction and retrieve the instruction params.\n */\n static decodeAllocate(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 1);\n const {\n space\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Allocate, instruction.data);\n return {\n accountPubkey: instruction.keys[0].pubkey,\n space\n };\n }\n\n /**\n * Decode an allocate with seed system instruction and retrieve the instruction params.\n */\n static decodeAllocateWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 1);\n const {\n base,\n seed,\n space,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data);\n return {\n accountPubkey: instruction.keys[0].pubkey,\n basePubkey: new PublicKey(base),\n seed,\n space,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode an assign system instruction and retrieve the instruction params.\n */\n static decodeAssign(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 1);\n const {\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data);\n return {\n accountPubkey: instruction.keys[0].pubkey,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode an assign with seed system instruction and retrieve the instruction params.\n */\n static decodeAssignWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 1);\n const {\n base,\n seed,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data);\n return {\n accountPubkey: instruction.keys[0].pubkey,\n basePubkey: new PublicKey(base),\n seed,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode a create account with seed system instruction and retrieve the instruction params.\n */\n static decodeCreateWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n base,\n seed,\n lamports,\n space,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed, instruction.data);\n return {\n fromPubkey: instruction.keys[0].pubkey,\n newAccountPubkey: instruction.keys[1].pubkey,\n basePubkey: new PublicKey(base),\n seed,\n lamports,\n space,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode a nonce initialize system instruction and retrieve the instruction params.\n */\n static decodeNonceInitialize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n authorized\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data);\n return {\n noncePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: new PublicKey(authorized)\n };\n }\n\n /**\n * Decode a nonce advance system instruction and retrieve the instruction params.\n */\n static decodeNonceAdvance(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount, instruction.data);\n return {\n noncePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey\n };\n }\n\n /**\n * Decode a nonce withdraw system instruction and retrieve the instruction params.\n */\n static decodeNonceWithdraw(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 5);\n const {\n lamports\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount, instruction.data);\n return {\n noncePubkey: instruction.keys[0].pubkey,\n toPubkey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[4].pubkey,\n lamports\n };\n }\n\n /**\n * Decode a nonce authorize system instruction and retrieve the instruction params.\n */\n static decodeNonceAuthorize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n authorized\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount, instruction.data);\n return {\n noncePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[1].pubkey,\n newAuthorizedPubkey: new PublicKey(authorized)\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(SystemProgram.programId)) {\n throw new Error('invalid instruction; programId is not SystemProgram');\n }\n }\n\n /**\n * @internal\n */\n static checkKeyLength(keys, expectedLength) {\n if (keys.length < expectedLength) {\n throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);\n }\n }\n}\n\n/**\n * An enumeration of valid SystemInstructionType's\n */\n\n/**\n * An enumeration of valid system InstructionType's\n * @internal\n */\nconst SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({\n Create: {\n index: 0,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('lamports'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('space'), publicKey('programId')])\n },\n Assign: {\n index: 1,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('programId')])\n },\n Transfer: {\n index: 2,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), u64('lamports')])\n },\n CreateWithSeed: {\n index: 3,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('base'), rustString('seed'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('lamports'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('space'), publicKey('programId')])\n },\n AdvanceNonceAccount: {\n index: 4,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n },\n WithdrawNonceAccount: {\n index: 5,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('lamports')])\n },\n InitializeNonceAccount: {\n index: 6,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('authorized')])\n },\n AuthorizeNonceAccount: {\n index: 7,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('authorized')])\n },\n Allocate: {\n index: 8,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('space')])\n },\n AllocateWithSeed: {\n index: 9,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('base'), rustString('seed'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('space'), publicKey('programId')])\n },\n AssignWithSeed: {\n index: 10,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('base'), rustString('seed'), publicKey('programId')])\n },\n TransferWithSeed: {\n index: 11,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])\n },\n UpgradeNonceAccount: {\n index: 12,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n }\n});\n\n/**\n * Factory class for transactions to interact with the System program\n */\nclass SystemProgram {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the System program\n */\n\n /**\n * Generate a transaction instruction that creates a new account\n */\n static createAccount(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.Create;\n const data = encodeData(type, {\n lamports: params.lamports,\n space: params.space,\n programId: toBuffer(params.programId.toBuffer())\n });\n return new TransactionInstruction({\n keys: [{\n pubkey: params.fromPubkey,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: params.newAccountPubkey,\n isSigner: true,\n isWritable: true\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that transfers lamports from one account to another\n */\n static transfer(params) {\n let data;\n let keys;\n if ('basePubkey' in params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed;\n data = encodeData(type, {\n lamports: BigInt(params.lamports),\n seed: params.seed,\n programId: toBuffer(params.programId.toBuffer())\n });\n keys = [{\n pubkey: params.fromPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.basePubkey,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: params.toPubkey,\n isSigner: false,\n isWritable: true\n }];\n } else {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.Transfer;\n data = encodeData(type, {\n lamports: BigInt(params.lamports)\n });\n keys = [{\n pubkey: params.fromPubkey,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: params.toPubkey,\n isSigner: false,\n isWritable: true\n }];\n }\n return new TransactionInstruction({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that assigns an account to a program\n */\n static assign(params) {\n let data;\n let keys;\n if ('basePubkey' in params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed;\n data = encodeData(type, {\n base: toBuffer(params.basePubkey.toBuffer()),\n seed: params.seed,\n programId: toBuffer(params.programId.toBuffer())\n });\n keys = [{\n pubkey: params.accountPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.basePubkey,\n isSigner: true,\n isWritable: false\n }];\n } else {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.Assign;\n data = encodeData(type, {\n programId: toBuffer(params.programId.toBuffer())\n });\n keys = [{\n pubkey: params.accountPubkey,\n isSigner: true,\n isWritable: true\n }];\n }\n return new TransactionInstruction({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that creates a new account at\n * an address generated with `from`, a seed, and programId\n */\n static createAccountWithSeed(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed;\n const data = encodeData(type, {\n base: toBuffer(params.basePubkey.toBuffer()),\n seed: params.seed,\n lamports: params.lamports,\n space: params.space,\n programId: toBuffer(params.programId.toBuffer())\n });\n let keys = [{\n pubkey: params.fromPubkey,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: params.newAccountPubkey,\n isSigner: false,\n isWritable: true\n }];\n if (!params.basePubkey.equals(params.fromPubkey)) {\n keys.push({\n pubkey: params.basePubkey,\n isSigner: true,\n isWritable: false\n });\n }\n return new TransactionInstruction({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction that creates a new Nonce account\n */\n static createNonceAccount(params) {\n const transaction = new Transaction();\n if ('basePubkey' in params && 'seed' in params) {\n transaction.add(SystemProgram.createAccountWithSeed({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.noncePubkey,\n basePubkey: params.basePubkey,\n seed: params.seed,\n lamports: params.lamports,\n space: NONCE_ACCOUNT_LENGTH,\n programId: this.programId\n }));\n } else {\n transaction.add(SystemProgram.createAccount({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.noncePubkey,\n lamports: params.lamports,\n space: NONCE_ACCOUNT_LENGTH,\n programId: this.programId\n }));\n }\n const initParams = {\n noncePubkey: params.noncePubkey,\n authorizedPubkey: params.authorizedPubkey\n };\n transaction.add(this.nonceInitialize(initParams));\n return transaction;\n }\n\n /**\n * Generate an instruction to initialize a Nonce account\n */\n static nonceInitialize(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount;\n const data = encodeData(type, {\n authorized: toBuffer(params.authorizedPubkey.toBuffer())\n });\n const instructionData = {\n keys: [{\n pubkey: params.noncePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }],\n programId: this.programId,\n data\n };\n return new TransactionInstruction(instructionData);\n }\n\n /**\n * Generate an instruction to advance the nonce in a Nonce account\n */\n static nonceAdvance(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount;\n const data = encodeData(type);\n const instructionData = {\n keys: [{\n pubkey: params.noncePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: params.authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n };\n return new TransactionInstruction(instructionData);\n }\n\n /**\n * Generate a transaction instruction that withdraws lamports from a Nonce account\n */\n static nonceWithdraw(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount;\n const data = encodeData(type, {\n lamports: params.lamports\n });\n return new TransactionInstruction({\n keys: [{\n pubkey: params.noncePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.toPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: params.authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that authorizes a new PublicKey as the authority\n * on a Nonce account.\n */\n static nonceAuthorize(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount;\n const data = encodeData(type, {\n authorized: toBuffer(params.newAuthorizedPubkey.toBuffer())\n });\n return new TransactionInstruction({\n keys: [{\n pubkey: params.noncePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that allocates space in an account without funding\n */\n static allocate(params) {\n let data;\n let keys;\n if ('basePubkey' in params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed;\n data = encodeData(type, {\n base: toBuffer(params.basePubkey.toBuffer()),\n seed: params.seed,\n space: params.space,\n programId: toBuffer(params.programId.toBuffer())\n });\n keys = [{\n pubkey: params.accountPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.basePubkey,\n isSigner: true,\n isWritable: false\n }];\n } else {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.Allocate;\n data = encodeData(type, {\n space: params.space\n });\n keys = [{\n pubkey: params.accountPubkey,\n isSigner: true,\n isWritable: true\n }];\n }\n return new TransactionInstruction({\n keys,\n programId: this.programId,\n data\n });\n }\n}\nSystemProgram.programId = new PublicKey('11111111111111111111111111111111');\n\n// Keep program chunks under PACKET_DATA_SIZE, leaving enough room for the\n// rest of the Transaction fields\n//\n// TODO: replace 300 with a proper constant for the size of the other\n// Transaction fields\nconst CHUNK_SIZE = PACKET_DATA_SIZE - 300;\n\n/**\n * Program loader interface\n */\nclass Loader {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Amount of program data placed in each load Transaction\n */\n\n /**\n * Minimum number of signatures required to load a program not including\n * retries\n *\n * Can be used to calculate transaction fees\n */\n static getMinNumSignatures(dataLength) {\n return 2 * (\n // Every transaction requires two signatures (payer + program)\n Math.ceil(dataLength / Loader.chunkSize) + 1 +\n // Add one for Create transaction\n 1) // Add one for Finalize transaction\n ;\n }\n\n /**\n * Loads a generic program\n *\n * @param connection The connection to use\n * @param payer System account that pays to load the program\n * @param program Account to load the program into\n * @param programId Public key that identifies the loader\n * @param data Program octets\n * @return true if program was loaded successfully, false if program was already loaded\n */\n static async load(connection, payer, program, programId, data) {\n {\n const balanceNeeded = await connection.getMinimumBalanceForRentExemption(data.length);\n\n // Fetch program account info to check if it has already been created\n const programInfo = await connection.getAccountInfo(program.publicKey, 'confirmed');\n let transaction = null;\n if (programInfo !== null) {\n if (programInfo.executable) {\n console.error('Program load failed, account is already executable');\n return false;\n }\n if (programInfo.data.length !== data.length) {\n transaction = transaction || new Transaction();\n transaction.add(SystemProgram.allocate({\n accountPubkey: program.publicKey,\n space: data.length\n }));\n }\n if (!programInfo.owner.equals(programId)) {\n transaction = transaction || new Transaction();\n transaction.add(SystemProgram.assign({\n accountPubkey: program.publicKey,\n programId\n }));\n }\n if (programInfo.lamports < balanceNeeded) {\n transaction = transaction || new Transaction();\n transaction.add(SystemProgram.transfer({\n fromPubkey: payer.publicKey,\n toPubkey: program.publicKey,\n lamports: balanceNeeded - programInfo.lamports\n }));\n }\n } else {\n transaction = new Transaction().add(SystemProgram.createAccount({\n fromPubkey: payer.publicKey,\n newAccountPubkey: program.publicKey,\n lamports: balanceNeeded > 0 ? balanceNeeded : 1,\n space: data.length,\n programId\n }));\n }\n\n // If the account is already created correctly, skip this step\n // and proceed directly to loading instructions\n if (transaction !== null) {\n await sendAndConfirmTransaction(connection, transaction, [payer, program], {\n commitment: 'confirmed'\n });\n }\n }\n const dataLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('offset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('bytesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('bytesLengthPadding'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('byte'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32(), -8), 'bytes')]);\n const chunkSize = Loader.chunkSize;\n let offset = 0;\n let array = data;\n let transactions = [];\n while (array.length > 0) {\n const bytes = array.slice(0, chunkSize);\n const data = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(chunkSize + 16);\n dataLayout.encode({\n instruction: 0,\n // Load instruction\n offset,\n bytes: bytes,\n bytesLength: 0,\n bytesLengthPadding: 0\n }, data);\n const transaction = new Transaction().add({\n keys: [{\n pubkey: program.publicKey,\n isSigner: true,\n isWritable: true\n }],\n programId,\n data\n });\n transactions.push(sendAndConfirmTransaction(connection, transaction, [payer, program], {\n commitment: 'confirmed'\n }));\n\n // Delay between sends in an attempt to reduce rate limit errors\n if (connection._rpcEndpoint.includes('solana.com')) {\n const REQUESTS_PER_SECOND = 4;\n await sleep(1000 / REQUESTS_PER_SECOND);\n }\n offset += chunkSize;\n array = array.slice(chunkSize);\n }\n await Promise.all(transactions);\n\n // Finalize the account loaded with program data for execution\n {\n const dataLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')]);\n const data = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(dataLayout.span);\n dataLayout.encode({\n instruction: 1 // Finalize instruction\n }, data);\n const transaction = new Transaction().add({\n keys: [{\n pubkey: program.publicKey,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }],\n programId,\n data\n });\n const deployCommitment = 'processed';\n const finalizeSignature = await connection.sendTransaction(transaction, [payer, program], {\n preflightCommitment: deployCommitment\n });\n const {\n context,\n value\n } = await connection.confirmTransaction({\n signature: finalizeSignature,\n lastValidBlockHeight: transaction.lastValidBlockHeight,\n blockhash: transaction.recentBlockhash\n }, deployCommitment);\n if (value.err) {\n throw new Error(`Transaction ${finalizeSignature} failed (${JSON.stringify(value)})`);\n }\n // We prevent programs from being usable until the slot after their deployment.\n // See https://github.com/solana-labs/solana/pull/29654\n while (true // eslint-disable-line no-constant-condition\n ) {\n try {\n const currentSlot = await connection.getSlot({\n commitment: deployCommitment\n });\n if (currentSlot > context.slot) {\n break;\n }\n } catch {\n /* empty */\n }\n await new Promise(resolve => setTimeout(resolve, Math.round(MS_PER_SLOT / 2)));\n }\n }\n\n // success\n return true;\n }\n}\nLoader.chunkSize = CHUNK_SIZE;\n\n/**\n * @deprecated Deprecated since Solana v1.17.20.\n */\nconst BPF_LOADER_PROGRAM_ID = new PublicKey('BPFLoader2111111111111111111111111111111111');\n\n/**\n * Factory class for transactions to interact with a program loader\n *\n * @deprecated Deprecated since Solana v1.17.20.\n */\nclass BpfLoader {\n /**\n * Minimum number of signatures required to load a program not including\n * retries\n *\n * Can be used to calculate transaction fees\n */\n static getMinNumSignatures(dataLength) {\n return Loader.getMinNumSignatures(dataLength);\n }\n\n /**\n * Load a SBF program\n *\n * @param connection The connection to use\n * @param payer Account that will pay program loading fees\n * @param program Account to load the program into\n * @param elf The entire ELF containing the SBF program\n * @param loaderProgramId The program id of the BPF loader to use\n * @return true if program was loaded successfully, false if program was already loaded\n */\n static load(connection, payer, program, elf, loaderProgramId) {\n return Loader.load(connection, payer, program, loaderProgramId, elf);\n }\n}\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nvar objToString = Object.prototype.toString;\nvar objKeys = Object.keys || function(obj) {\n\t\tvar keys = [];\n\t\tfor (var name in obj) {\n\t\t\tkeys.push(name);\n\t\t}\n\t\treturn keys;\n\t};\n\nfunction stringify(val, isArrayProp) {\n\tvar i, max, str, keys, key, propVal, toStr;\n\tif (val === true) {\n\t\treturn \"true\";\n\t}\n\tif (val === false) {\n\t\treturn \"false\";\n\t}\n\tswitch (typeof val) {\n\t\tcase \"object\":\n\t\t\tif (val === null) {\n\t\t\t\treturn null;\n\t\t\t} else if (val.toJSON && typeof val.toJSON === \"function\") {\n\t\t\t\treturn stringify(val.toJSON(), isArrayProp);\n\t\t\t} else {\n\t\t\t\ttoStr = objToString.call(val);\n\t\t\t\tif (toStr === \"[object Array]\") {\n\t\t\t\t\tstr = '[';\n\t\t\t\t\tmax = val.length - 1;\n\t\t\t\t\tfor(i = 0; i < max; i++) {\n\t\t\t\t\t\tstr += stringify(val[i], true) + ',';\n\t\t\t\t\t}\n\t\t\t\t\tif (max > -1) {\n\t\t\t\t\t\tstr += stringify(val[i], true);\n\t\t\t\t\t}\n\t\t\t\t\treturn str + ']';\n\t\t\t\t} else if (toStr === \"[object Object]\") {\n\t\t\t\t\t// only object is left\n\t\t\t\t\tkeys = objKeys(val).sort();\n\t\t\t\t\tmax = keys.length;\n\t\t\t\t\tstr = \"\";\n\t\t\t\t\ti = 0;\n\t\t\t\t\twhile (i < max) {\n\t\t\t\t\t\tkey = keys[i];\n\t\t\t\t\t\tpropVal = stringify(val[key], false);\n\t\t\t\t\t\tif (propVal !== undefined) {\n\t\t\t\t\t\t\tif (str) {\n\t\t\t\t\t\t\t\tstr += ',';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstr += JSON.stringify(key) + ':' + propVal;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ti++;\n\t\t\t\t\t}\n\t\t\t\t\treturn '{' + str + '}';\n\t\t\t\t} else {\n\t\t\t\t\treturn JSON.stringify(val);\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"function\":\n\t\tcase \"undefined\":\n\t\t\treturn isArrayProp ? null : undefined;\n\t\tcase \"string\":\n\t\t\treturn JSON.stringify(val);\n\t\tdefault:\n\t\t\treturn isFinite(val) ? val : null;\n\t}\n}\n\nvar fastStableStringify = function(val) {\n\tvar returnVal = stringify(val, false);\n\tif (returnVal !== undefined) {\n\t\treturn ''+ returnVal;\n\t}\n};\n\nvar fastStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringify);\n\nconst MINIMUM_SLOT_PER_EPOCH = 32;\n\n// Returns the number of trailing zeros in the binary representation of self.\nfunction trailingZeros(n) {\n let trailingZeros = 0;\n while (n > 1) {\n n /= 2;\n trailingZeros++;\n }\n return trailingZeros;\n}\n\n// Returns the smallest power of two greater than or equal to n\nfunction nextPowerOfTwo(n) {\n if (n === 0) return 1;\n n--;\n n |= n >> 1;\n n |= n >> 2;\n n |= n >> 4;\n n |= n >> 8;\n n |= n >> 16;\n n |= n >> 32;\n return n + 1;\n}\n\n/**\n * Epoch schedule\n * (see https://docs.solana.com/terminology#epoch)\n * Can be retrieved with the {@link Connection.getEpochSchedule} method\n */\nclass EpochSchedule {\n constructor(slotsPerEpoch, leaderScheduleSlotOffset, warmup, firstNormalEpoch, firstNormalSlot) {\n /** The maximum number of slots in each epoch */\n this.slotsPerEpoch = void 0;\n /** The number of slots before beginning of an epoch to calculate a leader schedule for that epoch */\n this.leaderScheduleSlotOffset = void 0;\n /** Indicates whether epochs start short and grow */\n this.warmup = void 0;\n /** The first epoch with `slotsPerEpoch` slots */\n this.firstNormalEpoch = void 0;\n /** The first slot of `firstNormalEpoch` */\n this.firstNormalSlot = void 0;\n this.slotsPerEpoch = slotsPerEpoch;\n this.leaderScheduleSlotOffset = leaderScheduleSlotOffset;\n this.warmup = warmup;\n this.firstNormalEpoch = firstNormalEpoch;\n this.firstNormalSlot = firstNormalSlot;\n }\n getEpoch(slot) {\n return this.getEpochAndSlotIndex(slot)[0];\n }\n getEpochAndSlotIndex(slot) {\n if (slot < this.firstNormalSlot) {\n const epoch = trailingZeros(nextPowerOfTwo(slot + MINIMUM_SLOT_PER_EPOCH + 1)) - trailingZeros(MINIMUM_SLOT_PER_EPOCH) - 1;\n const epochLen = this.getSlotsInEpoch(epoch);\n const slotIndex = slot - (epochLen - MINIMUM_SLOT_PER_EPOCH);\n return [epoch, slotIndex];\n } else {\n const normalSlotIndex = slot - this.firstNormalSlot;\n const normalEpochIndex = Math.floor(normalSlotIndex / this.slotsPerEpoch);\n const epoch = this.firstNormalEpoch + normalEpochIndex;\n const slotIndex = normalSlotIndex % this.slotsPerEpoch;\n return [epoch, slotIndex];\n }\n }\n getFirstSlotInEpoch(epoch) {\n if (epoch <= this.firstNormalEpoch) {\n return (Math.pow(2, epoch) - 1) * MINIMUM_SLOT_PER_EPOCH;\n } else {\n return (epoch - this.firstNormalEpoch) * this.slotsPerEpoch + this.firstNormalSlot;\n }\n }\n getLastSlotInEpoch(epoch) {\n return this.getFirstSlotInEpoch(epoch) + this.getSlotsInEpoch(epoch) - 1;\n }\n getSlotsInEpoch(epoch) {\n if (epoch < this.firstNormalEpoch) {\n return Math.pow(2, epoch + trailingZeros(MINIMUM_SLOT_PER_EPOCH));\n } else {\n return this.slotsPerEpoch;\n }\n }\n}\n\nvar fetchImpl = globalThis.fetch;\n\nclass RpcWebSocketClient extends rpc_websockets__WEBPACK_IMPORTED_MODULE_7__.CommonClient {\n constructor(address, options, generate_request_id) {\n const webSocketFactory = url => {\n const rpc = (0,rpc_websockets__WEBPACK_IMPORTED_MODULE_7__.WebSocket)(url, {\n autoconnect: true,\n max_reconnects: 5,\n reconnect: true,\n reconnect_interval: 1000,\n ...options\n });\n if ('socket' in rpc) {\n this.underlyingSocket = rpc.socket;\n } else {\n this.underlyingSocket = rpc;\n }\n return rpc;\n };\n super(webSocketFactory, address, options, generate_request_id);\n this.underlyingSocket = void 0;\n }\n call(...args) {\n const readyState = this.underlyingSocket?.readyState;\n if (readyState === 1 /* WebSocket.OPEN */) {\n return super.call(...args);\n }\n return Promise.reject(new Error('Tried to call a JSON-RPC method `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')'));\n }\n notify(...args) {\n const readyState = this.underlyingSocket?.readyState;\n if (readyState === 1 /* WebSocket.OPEN */) {\n return super.notify(...args);\n }\n return Promise.reject(new Error('Tried to send a JSON-RPC notification `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')'));\n }\n}\n\n/**\n * @internal\n */\n\n/**\n * Decode account data buffer using an AccountType\n * @internal\n */\nfunction decodeData(type, data) {\n let decoded;\n try {\n decoded = type.layout.decode(data);\n } catch (err) {\n throw new Error('invalid instruction; ' + err);\n }\n if (decoded.typeIndex !== type.index) {\n throw new Error(`invalid account data; account type mismatch ${decoded.typeIndex} != ${type.index}`);\n }\n return decoded;\n}\n\n/// The serialized size of lookup table metadata\nconst LOOKUP_TABLE_META_SIZE = 56;\nclass AddressLookupTableAccount {\n constructor(args) {\n this.key = void 0;\n this.state = void 0;\n this.key = args.key;\n this.state = args.state;\n }\n isActive() {\n const U64_MAX = BigInt('0xffffffffffffffff');\n return this.state.deactivationSlot === U64_MAX;\n }\n static deserialize(accountData) {\n const meta = decodeData(LookupTableMetaLayout, accountData);\n const serializedAddressesLen = accountData.length - LOOKUP_TABLE_META_SIZE;\n assert(serializedAddressesLen >= 0, 'lookup table is invalid');\n assert(serializedAddressesLen % 32 === 0, 'lookup table is invalid');\n const numSerializedAddresses = serializedAddressesLen / 32;\n const {\n addresses\n } = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(publicKey(), numSerializedAddresses, 'addresses')]).decode(accountData.slice(LOOKUP_TABLE_META_SIZE));\n return {\n deactivationSlot: meta.deactivationSlot,\n lastExtendedSlot: meta.lastExtendedSlot,\n lastExtendedSlotStartIndex: meta.lastExtendedStartIndex,\n authority: meta.authority.length !== 0 ? new PublicKey(meta.authority[0]) : undefined,\n addresses: addresses.map(address => new PublicKey(address))\n };\n }\n}\nconst LookupTableMetaLayout = {\n index: 1,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('typeIndex'), u64('deactivationSlot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('lastExtendedSlot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('lastExtendedStartIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8(),\n // option\n _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(publicKey(), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8(), -1), 'authority')])\n};\n\nconst URL_RE = /^[^:]+:\\/\\/([^:[]+|\\[[^\\]]+\\])(:\\d+)?(.*)/i;\nfunction makeWebsocketUrl(endpoint) {\n const matches = endpoint.match(URL_RE);\n if (matches == null) {\n throw TypeError(`Failed to validate endpoint URL \\`${endpoint}\\``);\n }\n const [_,\n // eslint-disable-line @typescript-eslint/no-unused-vars\n hostish, portWithColon, rest] = matches;\n const protocol = endpoint.startsWith('https:') ? 'wss:' : 'ws:';\n const startPort = portWithColon == null ? null : parseInt(portWithColon.slice(1), 10);\n const websocketPort =\n // Only shift the port by +1 as a convention for ws(s) only if given endpoint\n // is explicitly specifying the endpoint port (HTTP-based RPC), assuming\n // we're directly trying to connect to agave-validator's ws listening port.\n // When the endpoint omits the port, we're connecting to the protocol\n // default ports: http(80) or https(443) and it's assumed we're behind a reverse\n // proxy which manages WebSocket upgrade and backend port redirection.\n startPort == null ? '' : `:${startPort + 1}`;\n return `${protocol}//${hostish}${websocketPort}${rest}`;\n}\n\nconst PublicKeyFromString = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.coerce)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.instance)(PublicKey), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(), value => new PublicKey(value));\nconst RawAccountDataResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.tuple)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('base64')]);\nconst BufferFromRawAccountData = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.coerce)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.instance)(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer), RawAccountDataResult, value => buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(value[0], 'base64'));\n\n/**\n * Attempt to use a recent blockhash for up to 30 seconds\n * @internal\n */\nconst BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000;\n\n/**\n * HACK.\n * Copied from rpc-websockets/dist/lib/client.\n * Otherwise, `yarn build` fails with:\n * https://gist.github.com/steveluscher/c057eca81d479ef705cdb53162f9971d\n */\n\n/** @internal */\n/** @internal */\n/** @internal */\n/** @internal */\n\n/** @internal */\n/**\n * @internal\n * Every subscription contains the args used to open the subscription with\n * the server, and a list of callers interested in notifications.\n */\n\n/**\n * @internal\n * A subscription may be in various states of connectedness. Only when it is\n * fully connected will it have a server subscription id associated with it.\n * This id can be returned to the server to unsubscribe the client entirely.\n */\n\n/**\n * A type that encapsulates a subscription's RPC method\n * names and notification (callback) signature.\n */\n\n/**\n * @internal\n * Utility type that keeps tagged unions intact while omitting properties.\n */\n\n/**\n * @internal\n * This type represents a single subscribable 'topic.' It's made up of:\n *\n * - The args used to open the subscription with the server,\n * - The state of the subscription, in terms of its connectedness, and\n * - The set of callbacks to call when the server publishes notifications\n *\n * This record gets indexed by `SubscriptionConfigHash` and is used to\n * set up subscriptions, fan out notifications, and track subscription state.\n */\n\n/**\n * @internal\n */\n\n/**\n * Extra contextual information for RPC responses\n */\n\n/**\n * Options for sending transactions\n */\n\n/**\n * Options for confirming transactions\n */\n\n/**\n * Options for getConfirmedSignaturesForAddress2\n */\n\n/**\n * Options for getSignaturesForAddress\n */\n\n/**\n * RPC Response with extra contextual information\n */\n\n/**\n * A strategy for confirming transactions that uses the last valid\n * block height for a given blockhash to check for transaction expiration.\n */\n\n/**\n * A strategy for confirming durable nonce transactions.\n */\n\n/**\n * Properties shared by all transaction confirmation strategies\n */\n\n/**\n * This type represents all transaction confirmation strategies\n */\n\n/* @internal */\nfunction assertEndpointUrl(putativeUrl) {\n if (/^https?:/.test(putativeUrl) === false) {\n throw new TypeError('Endpoint URL must start with `http:` or `https:`.');\n }\n return putativeUrl;\n}\n\n/** @internal */\nfunction extractCommitmentFromConfig(commitmentOrConfig) {\n let commitment;\n let config;\n if (typeof commitmentOrConfig === 'string') {\n commitment = commitmentOrConfig;\n } else if (commitmentOrConfig) {\n const {\n commitment: specifiedCommitment,\n ...specifiedConfig\n } = commitmentOrConfig;\n commitment = specifiedCommitment;\n config = specifiedConfig;\n }\n return {\n commitment,\n config\n };\n}\n\n/**\n * @internal\n */\nfunction applyDefaultMemcmpEncodingToFilters(filters) {\n return filters.map(filter => 'memcmp' in filter ? {\n ...filter,\n memcmp: {\n ...filter.memcmp,\n encoding: filter.memcmp.encoding ?? 'base58'\n }\n } : filter);\n}\n\n/**\n * @internal\n */\nfunction createRpcResult(result) {\n return (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n jsonrpc: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('2.0'),\n id: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n result\n }), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n jsonrpc: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('2.0'),\n id: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n error: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n code: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.unknown)(),\n message: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n data: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.any)())\n })\n })]);\n}\nconst UnknownRpcResult = createRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.unknown)());\n\n/**\n * @internal\n */\nfunction jsonRpcResult(schema) {\n return (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.coerce)(createRpcResult(schema), UnknownRpcResult, value => {\n if ('error' in value) {\n return value;\n } else {\n return {\n ...value,\n result: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(value.result, schema)\n };\n }\n });\n}\n\n/**\n * @internal\n */\nfunction jsonRpcResultAndContext(value) {\n return jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n context: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n }),\n value\n }));\n}\n\n/**\n * @internal\n */\nfunction notificationResultAndContext(value) {\n return (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n context: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n }),\n value\n });\n}\n\n/**\n * @internal\n */\nfunction versionedMessageFromResponse(version, response) {\n if (version === 0) {\n return new MessageV0({\n header: response.header,\n staticAccountKeys: response.accountKeys.map(accountKey => new PublicKey(accountKey)),\n recentBlockhash: response.recentBlockhash,\n compiledInstructions: response.instructions.map(ix => ({\n programIdIndex: ix.programIdIndex,\n accountKeyIndexes: ix.accounts,\n data: bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(ix.data)\n })),\n addressTableLookups: response.addressTableLookups\n });\n } else {\n return new Message(response);\n }\n}\n\n/**\n * The level of commitment desired when querying state\n *
\n *   'processed': Query the most recent block which has reached 1 confirmation by the connected node\n *   'confirmed': Query the most recent block which has reached 1 confirmation by the cluster\n *   'finalized': Query the most recent block which has been finalized by the cluster\n * 
\n */\n\n// Deprecated as of v1.5.5\n\n/**\n * A subset of Commitment levels, which are at least optimistically confirmed\n *
\n *   'confirmed': Query the most recent block which has reached 1 confirmation by the cluster\n *   'finalized': Query the most recent block which has been finalized by the cluster\n * 
\n */\n\n/**\n * Filter for largest accounts query\n *
\n *   'circulating':    Return the largest accounts that are part of the circulating supply\n *   'nonCirculating': Return the largest accounts that are not part of the circulating supply\n * 
\n */\n\n/**\n * Configuration object for changing `getAccountInfo` query behavior\n */\n\n/**\n * Configuration object for changing `getBalance` query behavior\n */\n\n/**\n * Configuration object for changing `getBlock` query behavior\n */\n\n/**\n * Configuration object for changing `getBlock` query behavior\n */\n\n/**\n * Configuration object for changing `getStakeMinimumDelegation` query behavior\n */\n\n/**\n * Configuration object for changing `getBlockHeight` query behavior\n */\n\n/**\n * Configuration object for changing `getEpochInfo` query behavior\n */\n\n/**\n * Configuration object for changing `getInflationReward` query behavior\n */\n\n/**\n * Configuration object for changing `getLatestBlockhash` query behavior\n */\n\n/**\n * Configuration object for changing `isBlockhashValid` query behavior\n */\n\n/**\n * Configuration object for changing `getSlot` query behavior\n */\n\n/**\n * Configuration object for changing `getSlotLeader` query behavior\n */\n\n/**\n * Configuration object for changing `getTransaction` query behavior\n */\n\n/**\n * Configuration object for changing `getTransaction` query behavior\n */\n\n/**\n * Configuration object for changing `getLargestAccounts` query behavior\n */\n\n/**\n * Configuration object for changing `getSupply` request behavior\n */\n\n/**\n * Configuration object for changing query behavior\n */\n\n/**\n * Information describing a cluster node\n */\n\n/**\n * Information describing a vote account\n */\n\n/**\n * A collection of cluster vote accounts\n */\n\n/**\n * Network Inflation\n * (see https://docs.solana.com/implemented-proposals/ed_overview)\n */\n\nconst GetInflationGovernorResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n foundation: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n foundationTerm: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n initial: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n taper: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n terminal: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/**\n * The inflation reward for an epoch\n */\n\n/**\n * Expected JSON RPC response for the \"getInflationReward\" message\n */\nconst GetInflationRewardResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n epoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n effectiveSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n amount: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n postBalance: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n commission: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()))\n}))));\n\n/**\n * Configuration object for changing `getRecentPrioritizationFees` query behavior\n */\n\n/**\n * Expected JSON RPC response for the \"getRecentPrioritizationFees\" message\n */\nconst GetRecentPrioritizationFeesResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n prioritizationFee: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n}));\n/**\n * Expected JSON RPC response for the \"getInflationRate\" message\n */\nconst GetInflationRateResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n total: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n validator: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n foundation: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n epoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/**\n * Information about the current epoch\n */\n\nconst GetEpochInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n epoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n slotIndex: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n slotsInEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n absoluteSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n transactionCount: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n});\nconst GetEpochScheduleResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n slotsPerEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n leaderScheduleSlotOffset: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n warmup: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n firstNormalEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n firstNormalSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/**\n * Leader schedule\n * (see https://docs.solana.com/terminology#leader-schedule)\n */\n\nconst GetLeaderScheduleResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.record)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()));\n\n/**\n * Transaction error or null\n */\nconst TransactionErrorResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({}), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()]));\n\n/**\n * Signature status for a transaction\n */\nconst SignatureStatusResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n err: TransactionErrorResult\n});\n\n/**\n * Transaction signature received notification\n */\nconst SignatureReceivedResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('receivedSignature');\n\n/**\n * Version info for a node\n */\n\nconst VersionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n 'solana-core': (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n 'feature-set': (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n});\nconst ParsedInstructionStruct = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n program: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n programId: PublicKeyFromString,\n parsed: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.unknown)()\n});\nconst PartiallyDecodedInstructionStruct = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n programId: PublicKeyFromString,\n accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(PublicKeyFromString),\n data: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()\n});\nconst SimulatedTransactionResponseStruct = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n err: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({}), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()])),\n logs: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)())),\n accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n owner: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n data: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n }))))),\n unitsConsumed: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n returnData: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n programId: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n data: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.tuple)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('base64')])\n }))),\n innerInstructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n index: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([ParsedInstructionStruct, PartiallyDecodedInstructionStruct]))\n }))))\n}));\n\n/**\n * Metadata for a parsed confirmed transaction on the ledger\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionMeta} instead.\n */\n\n/**\n * Collection of addresses loaded by a transaction using address table lookups\n */\n\n/**\n * Metadata for a parsed transaction on the ledger\n */\n\n/**\n * Metadata for a confirmed transaction on the ledger\n */\n\n/**\n * A processed transaction from the RPC API\n */\n\n/**\n * A processed transaction from the RPC API\n */\n\n/**\n * A processed transaction message from the RPC API\n */\n\n/**\n * A confirmed transaction on the ledger\n *\n * @deprecated Deprecated since RPC v1.8.0.\n */\n\n/**\n * A partially decoded transaction instruction\n */\n\n/**\n * A parsed transaction message account\n */\n\n/**\n * A parsed transaction instruction\n */\n\n/**\n * A parsed address table lookup\n */\n\n/**\n * A parsed transaction message\n */\n\n/**\n * A parsed transaction\n */\n\n/**\n * A parsed and confirmed transaction on the ledger\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.\n */\n\n/**\n * A parsed transaction on the ledger with meta\n */\n\n/**\n * A processed block fetched from the RPC API\n */\n\n/**\n * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`\n */\n\n/**\n * A processed block fetched from the RPC API where the `transactionDetails` mode is `none`\n */\n\n/**\n * A block with parsed transactions\n */\n\n/**\n * A block with parsed transactions where the `transactionDetails` mode is `accounts`\n */\n\n/**\n * A block with parsed transactions where the `transactionDetails` mode is `none`\n */\n\n/**\n * A processed block fetched from the RPC API\n */\n\n/**\n * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`\n */\n\n/**\n * A processed block fetched from the RPC API where the `transactionDetails` mode is `none`\n */\n\n/**\n * A confirmed block on the ledger\n *\n * @deprecated Deprecated since RPC v1.8.0.\n */\n\n/**\n * A Block on the ledger with signatures only\n */\n\n/**\n * recent block production information\n */\n\n/**\n * Expected JSON RPC response for the \"getBlockProduction\" message\n */\nconst BlockProductionResponseStruct = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n byIdentity: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.record)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())),\n range: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n firstSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n lastSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n })\n}));\n\n/**\n * A performance sample\n */\n\nfunction createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent) {\n const fetch = customFetch ? customFetch : fetchImpl;\n let agent;\n {\n if (httpAgent != null) {\n console.warn('You have supplied an `httpAgent` when creating a `Connection` in a browser environment.' + 'It has been ignored; `httpAgent` is only used in Node environments.');\n }\n }\n let fetchWithMiddleware;\n if (fetchMiddleware) {\n fetchWithMiddleware = async (info, init) => {\n const modifiedFetchArgs = await new Promise((resolve, reject) => {\n try {\n fetchMiddleware(info, init, (modifiedInfo, modifiedInit) => resolve([modifiedInfo, modifiedInit]));\n } catch (error) {\n reject(error);\n }\n });\n return await fetch(...modifiedFetchArgs);\n };\n }\n const clientBrowser = new (jayson_lib_client_browser__WEBPACK_IMPORTED_MODULE_6___default())(async (request, callback) => {\n const options = {\n method: 'POST',\n body: request,\n agent,\n headers: Object.assign({\n 'Content-Type': 'application/json'\n }, httpHeaders || {}, COMMON_HTTP_HEADERS)\n };\n try {\n let too_many_requests_retries = 5;\n let res;\n let waitTime = 500;\n for (;;) {\n if (fetchWithMiddleware) {\n res = await fetchWithMiddleware(url, options);\n } else {\n res = await fetch(url, options);\n }\n if (res.status !== 429 /* Too many requests */) {\n break;\n }\n if (disableRetryOnRateLimit === true) {\n break;\n }\n too_many_requests_retries -= 1;\n if (too_many_requests_retries === 0) {\n break;\n }\n console.error(`Server responded with ${res.status} ${res.statusText}. Retrying after ${waitTime}ms delay...`);\n await sleep(waitTime);\n waitTime *= 2;\n }\n const text = await res.text();\n if (res.ok) {\n callback(null, text);\n } else {\n callback(new Error(`${res.status} ${res.statusText}: ${text}`));\n }\n } catch (err) {\n if (err instanceof Error) callback(err);\n }\n }, {});\n return clientBrowser;\n}\nfunction createRpcRequest(client) {\n return (method, args) => {\n return new Promise((resolve, reject) => {\n client.request(method, args, (err, response) => {\n if (err) {\n reject(err);\n return;\n }\n resolve(response);\n });\n });\n };\n}\nfunction createRpcBatchRequest(client) {\n return requests => {\n return new Promise((resolve, reject) => {\n // Do nothing if requests is empty\n if (requests.length === 0) resolve([]);\n const batch = requests.map(params => {\n return client.request(params.methodName, params.args);\n });\n client.request(batch, (err, response) => {\n if (err) {\n reject(err);\n return;\n }\n resolve(response);\n });\n });\n };\n}\n\n/**\n * Expected JSON RPC response for the \"getInflationGovernor\" message\n */\nconst GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult);\n\n/**\n * Expected JSON RPC response for the \"getInflationRate\" message\n */\nconst GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);\n\n/**\n * Expected JSON RPC response for the \"getRecentPrioritizationFees\" message\n */\nconst GetRecentPrioritizationFeesRpcResult = jsonRpcResult(GetRecentPrioritizationFeesResult);\n\n/**\n * Expected JSON RPC response for the \"getEpochInfo\" message\n */\nconst GetEpochInfoRpcResult = jsonRpcResult(GetEpochInfoResult);\n\n/**\n * Expected JSON RPC response for the \"getEpochSchedule\" message\n */\nconst GetEpochScheduleRpcResult = jsonRpcResult(GetEpochScheduleResult);\n\n/**\n * Expected JSON RPC response for the \"getLeaderSchedule\" message\n */\nconst GetLeaderScheduleRpcResult = jsonRpcResult(GetLeaderScheduleResult);\n\n/**\n * Expected JSON RPC response for the \"minimumLedgerSlot\" and \"getFirstAvailableBlock\" messages\n */\nconst SlotRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)());\n\n/**\n * Supply\n */\n\n/**\n * Expected JSON RPC response for the \"getSupply\" message\n */\nconst GetSupplyRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n total: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n circulating: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n nonCirculating: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n nonCirculatingAccounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(PublicKeyFromString)\n}));\n\n/**\n * Token amount object which returns a token amount in different formats\n * for various client use cases.\n */\n\n/**\n * Expected JSON RPC structure for token amounts\n */\nconst TokenAmountResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n amount: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n uiAmount: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n decimals: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n uiAmountString: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)())\n});\n\n/**\n * Token address and balance.\n */\n\n/**\n * Expected JSON RPC response for the \"getTokenLargestAccounts\" message\n */\nconst GetTokenLargestAccountsResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n address: PublicKeyFromString,\n amount: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n uiAmount: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n decimals: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n uiAmountString: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)())\n})));\n\n/**\n * Expected JSON RPC response for the \"getTokenAccountsByOwner\" message\n */\nconst GetTokenAccountsByOwner = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n pubkey: PublicKeyFromString,\n account: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n owner: PublicKeyFromString,\n lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n data: BufferFromRawAccountData,\n rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n })\n})));\nconst ParsedAccountDataResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n program: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parsed: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.unknown)(),\n space: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/**\n * Expected JSON RPC response for the \"getTokenAccountsByOwner\" message with parsed data\n */\nconst GetParsedTokenAccountsByOwner = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n pubkey: PublicKeyFromString,\n account: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n owner: PublicKeyFromString,\n lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n data: ParsedAccountDataResult,\n rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n })\n})));\n\n/**\n * Pair of an account address and its balance\n */\n\n/**\n * Expected JSON RPC response for the \"getLargestAccounts\" message\n */\nconst GetLargestAccountsRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n address: PublicKeyFromString\n})));\n\n/**\n * @internal\n */\nconst AccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n owner: PublicKeyFromString,\n lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n data: BufferFromRawAccountData,\n rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/**\n * @internal\n */\nconst KeyedAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n pubkey: PublicKeyFromString,\n account: AccountInfoResult\n});\nconst ParsedOrRawAccountData = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.coerce)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.instance)(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer), ParsedAccountDataResult]), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([RawAccountDataResult, ParsedAccountDataResult]), value => {\n if (Array.isArray(value)) {\n return (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(value, BufferFromRawAccountData);\n } else {\n return value;\n }\n});\n\n/**\n * @internal\n */\nconst ParsedAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n owner: PublicKeyFromString,\n lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n data: ParsedOrRawAccountData,\n rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\nconst KeyedParsedAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n pubkey: PublicKeyFromString,\n account: ParsedAccountInfoResult\n});\n\n/**\n * @internal\n */\nconst StakeActivationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n state: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('active'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('inactive'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('activating'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('deactivating')]),\n active: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n inactive: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/**\n * Expected JSON RPC response for the \"getConfirmedSignaturesForAddress2\" message\n */\n\nconst GetConfirmedSignaturesForAddress2RpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n signature: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n err: TransactionErrorResult,\n memo: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()))\n})));\n\n/**\n * Expected JSON RPC response for the \"getSignaturesForAddress\" message\n */\nconst GetSignaturesForAddressRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n signature: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n err: TransactionErrorResult,\n memo: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()))\n})));\n\n/***\n * Expected JSON RPC response for the \"accountNotification\" message\n */\nconst AccountNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n result: notificationResultAndContext(AccountInfoResult)\n});\n\n/**\n * @internal\n */\nconst ProgramAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n pubkey: PublicKeyFromString,\n account: AccountInfoResult\n});\n\n/***\n * Expected JSON RPC response for the \"programNotification\" message\n */\nconst ProgramAccountNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n result: notificationResultAndContext(ProgramAccountInfoResult)\n});\n\n/**\n * @internal\n */\nconst SlotInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n parent: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n root: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/**\n * Expected JSON RPC response for the \"slotNotification\" message\n */\nconst SlotNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n result: SlotInfoResult\n});\n\n/**\n * Slot updates which can be used for tracking the live progress of a cluster.\n * - `\"firstShredReceived\"`: connected node received the first shred of a block.\n * Indicates that a new block that is being produced.\n * - `\"completed\"`: connected node has received all shreds of a block. Indicates\n * a block was recently produced.\n * - `\"optimisticConfirmation\"`: block was optimistically confirmed by the\n * cluster. It is not guaranteed that an optimistic confirmation notification\n * will be sent for every finalized blocks.\n * - `\"root\"`: the connected node rooted this block.\n * - `\"createdBank\"`: the connected node has started validating this block.\n * - `\"frozen\"`: the connected node has validated this block.\n * - `\"dead\"`: the connected node failed to validate this block.\n */\n\n/**\n * @internal\n */\nconst SlotUpdateResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n type: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('firstShredReceived'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('completed'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('optimisticConfirmation'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('root')]),\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n timestamp: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n}), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n type: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('createdBank'),\n parent: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n timestamp: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n}), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n type: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('frozen'),\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n timestamp: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n stats: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n numTransactionEntries: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n numSuccessfulTransactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n numFailedTransactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n maxTransactionsPerEntry: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n })\n}), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n type: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('dead'),\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n timestamp: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n err: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()\n})]);\n\n/**\n * Expected JSON RPC response for the \"slotsUpdatesNotification\" message\n */\nconst SlotUpdateNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n result: SlotUpdateResult\n});\n\n/**\n * Expected JSON RPC response for the \"signatureNotification\" message\n */\nconst SignatureNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n result: notificationResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([SignatureStatusResult, SignatureReceivedResult]))\n});\n\n/**\n * Expected JSON RPC response for the \"rootNotification\" message\n */\nconst RootNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n result: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\nconst ContactInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n pubkey: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n gossip: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n tpu: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n rpc: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n version: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)())\n});\nconst VoteAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n votePubkey: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n nodePubkey: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n activatedStake: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n epochVoteAccount: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n epochCredits: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.tuple)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()])),\n commission: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n lastVote: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n rootSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n});\n\n/**\n * Expected JSON RPC response for the \"getVoteAccounts\" message\n */\nconst GetVoteAccounts = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n current: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(VoteAccountInfoResult),\n delinquent: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(VoteAccountInfoResult)\n}));\nconst ConfirmationStatus = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('processed'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('confirmed'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('finalized')]);\nconst SignatureStatusResponse = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n confirmations: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n err: TransactionErrorResult,\n confirmationStatus: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(ConfirmationStatus)\n});\n\n/**\n * Expected JSON RPC response for the \"getSignatureStatuses\" message\n */\nconst GetSignatureStatusesRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(SignatureStatusResponse)));\n\n/**\n * Expected JSON RPC response for the \"getMinimumBalanceForRentExemption\" message\n */\nconst GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)());\nconst AddressTableLookupStruct = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accountKey: PublicKeyFromString,\n writableIndexes: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n readonlyIndexes: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n});\nconst ConfirmedTransactionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n signatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n message: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accountKeys: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n header: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n numRequiredSignatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n numReadonlySignedAccounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n numReadonlyUnsignedAccounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n }),\n instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n data: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n programIdIndex: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n })),\n recentBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n addressTableLookups: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(AddressTableLookupStruct))\n })\n});\nconst AnnotatedAccountKey = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n pubkey: PublicKeyFromString,\n signer: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n writable: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)(),\n source: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('transaction'), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('lookupTable')]))\n});\nconst ConfirmedTransactionAccountsModeResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accountKeys: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(AnnotatedAccountKey),\n signatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)())\n});\nconst ParsedInstructionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n parsed: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.unknown)(),\n program: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n programId: PublicKeyFromString\n});\nconst RawInstructionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(PublicKeyFromString),\n data: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n programId: PublicKeyFromString\n});\nconst InstructionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([RawInstructionResult, ParsedInstructionResult]);\nconst UnknownInstructionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n parsed: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.unknown)(),\n program: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n programId: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()\n}), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n data: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n programId: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()\n})]);\nconst ParsedOrRawInstruction = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.coerce)(InstructionResult, UnknownInstructionResult, value => {\n if ('accounts' in value) {\n return (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(value, RawInstructionResult);\n } else {\n return (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(value, ParsedInstructionResult);\n }\n});\n\n/**\n * @internal\n */\nconst ParsedConfirmedTransactionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n signatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n message: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accountKeys: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(AnnotatedAccountKey),\n instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(ParsedOrRawInstruction),\n recentBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n addressTableLookups: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(AddressTableLookupStruct)))\n })\n});\nconst TokenBalanceResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accountIndex: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n mint: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n owner: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n uiTokenAmount: TokenAmountResult\n});\nconst LoadedAddressesResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n writable: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(PublicKeyFromString),\n readonly: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(PublicKeyFromString)\n});\n\n/**\n * @internal\n */\nconst ConfirmedTransactionMetaResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n err: TransactionErrorResult,\n fee: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n innerInstructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n index: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n data: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n programIdIndex: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n }))\n })))),\n preBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n postBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n logMessages: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()))),\n preTokenBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(TokenBalanceResult))),\n postTokenBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(TokenBalanceResult))),\n loadedAddresses: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(LoadedAddressesResult),\n computeUnitsConsumed: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n});\n\n/**\n * @internal\n */\nconst ParsedConfirmedTransactionMetaResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n err: TransactionErrorResult,\n fee: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n innerInstructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n index: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(ParsedOrRawInstruction)\n })))),\n preBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n postBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n logMessages: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()))),\n preTokenBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(TokenBalanceResult))),\n postTokenBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(TokenBalanceResult))),\n loadedAddresses: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(LoadedAddressesResult),\n computeUnitsConsumed: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n});\nconst TransactionVersionStruct = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)(0), (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.literal)('legacy')]);\n\n/** @internal */\nconst RewardsResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n pubkey: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n postBalance: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n rewardType: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n commission: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()))\n});\n\n/**\n * Expected JSON RPC response for the \"getBlock\" message\n */\nconst GetBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n transaction: ConfirmedTransactionResult,\n meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ConfirmedTransactionMetaResult),\n version: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(TransactionVersionStruct)\n })),\n rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(RewardsResult)),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n})));\n\n/**\n * Expected JSON RPC response for the \"getBlock\" message when `transactionDetails` is `none`\n */\nconst GetNoneModeBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(RewardsResult)),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n})));\n\n/**\n * Expected JSON RPC response for the \"getBlock\" message when `transactionDetails` is `accounts`\n */\nconst GetAccountsModeBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n transaction: ConfirmedTransactionAccountsModeResult,\n meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ConfirmedTransactionMetaResult),\n version: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(TransactionVersionStruct)\n })),\n rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(RewardsResult)),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n})));\n\n/**\n * Expected parsed JSON RPC response for the \"getBlock\" message\n */\nconst GetParsedBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n transaction: ParsedConfirmedTransactionResult,\n meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ParsedConfirmedTransactionMetaResult),\n version: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(TransactionVersionStruct)\n })),\n rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(RewardsResult)),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n})));\n\n/**\n * Expected parsed JSON RPC response for the \"getBlock\" message when `transactionDetails` is `accounts`\n */\nconst GetParsedAccountsModeBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n transaction: ConfirmedTransactionAccountsModeResult,\n meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ParsedConfirmedTransactionMetaResult),\n version: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(TransactionVersionStruct)\n })),\n rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(RewardsResult)),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n})));\n\n/**\n * Expected parsed JSON RPC response for the \"getBlock\" message when `transactionDetails` is `none`\n */\nconst GetParsedNoneModeBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(RewardsResult)),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()),\n blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n})));\n\n/**\n * Expected JSON RPC response for the \"getConfirmedBlock\" message\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetBlockRpcResult} instead.\n */\nconst GetConfirmedBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n transaction: ConfirmedTransactionResult,\n meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ConfirmedTransactionMetaResult)\n })),\n rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(RewardsResult)),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n})));\n\n/**\n * Expected JSON RPC response for the \"getBlock\" message\n */\nconst GetBlockSignaturesRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n signatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())\n})));\n\n/**\n * Expected JSON RPC response for the \"getTransaction\" message\n */\nconst GetTransactionRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ConfirmedTransactionMetaResult),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())),\n transaction: ConfirmedTransactionResult,\n version: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(TransactionVersionStruct)\n})));\n\n/**\n * Expected parsed JSON RPC response for the \"getTransaction\" message\n */\nconst GetParsedTransactionRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n transaction: ParsedConfirmedTransactionResult,\n meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ParsedConfirmedTransactionMetaResult),\n blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())),\n version: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)(TransactionVersionStruct)\n})));\n\n/**\n * Expected JSON RPC response for the \"getRecentBlockhash\" message\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.\n */\nconst GetRecentBlockhashAndContextRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n feeCalculator: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n lamportsPerSignature: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n })\n}));\n\n/**\n * Expected JSON RPC response for the \"getLatestBlockhash\" message\n */\nconst GetLatestBlockhashRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n lastValidBlockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n}));\n\n/**\n * Expected JSON RPC response for the \"isBlockhashValid\" message\n */\nconst IsBlockhashValidRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.boolean)());\nconst PerfSampleResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n numTransactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n numSlots: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)(),\n samplePeriodSecs: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/*\n * Expected JSON RPC response for \"getRecentPerformanceSamples\" message\n */\nconst GetRecentPerformanceSamplesRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(PerfSampleResult));\n\n/**\n * Expected JSON RPC response for the \"getFeeCalculatorForBlockhash\" message\n */\nconst GetFeeCalculatorRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n feeCalculator: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n lamportsPerSignature: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n })\n})));\n\n/**\n * Expected JSON RPC response for the \"requestAirdrop\" message\n */\nconst RequestAirdropRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)());\n\n/**\n * Expected JSON RPC response for the \"sendTransaction\" message\n */\nconst SendTransactionRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)());\n\n/**\n * Information about the latest slot being processed by a node\n */\n\n/**\n * Parsed account data\n */\n\n/**\n * Stake Activation data\n */\n\n/**\n * Data slice argument for getProgramAccounts\n */\n\n/**\n * Memory comparison filter for getProgramAccounts\n */\n\n/**\n * Data size comparison filter for getProgramAccounts\n */\n\n/**\n * A filter object for getProgramAccounts\n */\n\n/**\n * Configuration object for getProgramAccounts requests\n */\n\n/**\n * Configuration object for getParsedProgramAccounts\n */\n\n/**\n * Configuration object for getMultipleAccounts\n */\n\n/**\n * Configuration object for `getStakeActivation`\n */\n\n/**\n * Configuration object for `getStakeActivation`\n */\n\n/**\n * Configuration object for `getStakeActivation`\n */\n\n/**\n * Configuration object for `getNonce`\n */\n\n/**\n * Configuration object for `getNonceAndContext`\n */\n\n/**\n * Information describing an account\n */\n\n/**\n * Account information identified by pubkey\n */\n\n/**\n * Callback function for account change notifications\n */\n\n/**\n * Callback function for program account change notifications\n */\n\n/**\n * Callback function for slot change notifications\n */\n\n/**\n * Callback function for slot update notifications\n */\n\n/**\n * Callback function for signature status notifications\n */\n\n/**\n * Signature status notification with transaction result\n */\n\n/**\n * Signature received notification\n */\n\n/**\n * Callback function for signature notifications\n */\n\n/**\n * Signature subscription options\n */\n\n/**\n * Callback function for root change notifications\n */\n\n/**\n * @internal\n */\nconst LogsResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n err: TransactionErrorResult,\n logs: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n signature: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()\n});\n\n/**\n * Logs result.\n */\n\n/**\n * Expected JSON RPC response for the \"logsNotification\" message.\n */\nconst LogsNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n result: notificationResultAndContext(LogsResult),\n subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()\n});\n\n/**\n * Filter for log subscriptions.\n */\n\n/**\n * Callback function for log notifications.\n */\n\n/**\n * Signature result\n */\n\n/**\n * Transaction error\n */\n\n/**\n * Transaction confirmation status\n *
\n *   'processed': Transaction landed in a block which has reached 1 confirmation by the connected node\n *   'confirmed': Transaction landed in a block which has reached 1 confirmation by the cluster\n *   'finalized': Transaction landed in a block which has been finalized by the cluster\n * 
\n */\n\n/**\n * Signature status\n */\n\n/**\n * A confirmed signature with its status\n */\n\n/**\n * An object defining headers to be passed to the RPC server\n */\n\n/**\n * The type of the JavaScript `fetch()` API\n */\n\n/**\n * A callback used to augment the outgoing HTTP request\n */\n\n/**\n * Configuration for instantiating a Connection\n */\n\n/** @internal */\nconst COMMON_HTTP_HEADERS = {\n 'solana-client': `js/${\"1.0.0-maintenance\"}`\n};\n\n/**\n * A connection to a fullnode JSON RPC endpoint\n */\nclass Connection {\n /**\n * Establish a JSON RPC connection\n *\n * @param endpoint URL to the fullnode JSON RPC endpoint\n * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object\n */\n constructor(endpoint, _commitmentOrConfig) {\n /** @internal */\n this._commitment = void 0;\n /** @internal */\n this._confirmTransactionInitialTimeout = void 0;\n /** @internal */\n this._rpcEndpoint = void 0;\n /** @internal */\n this._rpcWsEndpoint = void 0;\n /** @internal */\n this._rpcClient = void 0;\n /** @internal */\n this._rpcRequest = void 0;\n /** @internal */\n this._rpcBatchRequest = void 0;\n /** @internal */\n this._rpcWebSocket = void 0;\n /** @internal */\n this._rpcWebSocketConnected = false;\n /** @internal */\n this._rpcWebSocketHeartbeat = null;\n /** @internal */\n this._rpcWebSocketIdleTimeout = null;\n /** @internal\n * A number that we increment every time an active connection closes.\n * Used to determine whether the same socket connection that was open\n * when an async operation started is the same one that's active when\n * its continuation fires.\n *\n */\n this._rpcWebSocketGeneration = 0;\n /** @internal */\n this._disableBlockhashCaching = false;\n /** @internal */\n this._pollingBlockhash = false;\n /** @internal */\n this._blockhashInfo = {\n latestBlockhash: null,\n lastFetch: 0,\n transactionSignatures: [],\n simulatedSignatures: []\n };\n /** @internal */\n this._nextClientSubscriptionId = 0;\n /** @internal */\n this._subscriptionDisposeFunctionsByClientSubscriptionId = {};\n /** @internal */\n this._subscriptionHashByClientSubscriptionId = {};\n /** @internal */\n this._subscriptionStateChangeCallbacksByHash = {};\n /** @internal */\n this._subscriptionCallbacksByServerSubscriptionId = {};\n /** @internal */\n this._subscriptionsByHash = {};\n /**\n * Special case.\n * After a signature is processed, RPCs automatically dispose of the\n * subscription on the server side. We need to track which of these\n * subscriptions have been disposed in such a way, so that we know\n * whether the client is dealing with a not-yet-processed signature\n * (in which case we must tear down the server subscription) or an\n * already-processed signature (in which case the client can simply\n * clear out the subscription locally without telling the server).\n *\n * NOTE: There is a proposal to eliminate this special case, here:\n * https://github.com/solana-labs/solana/issues/18892\n */\n /** @internal */\n this._subscriptionsAutoDisposedByRpc = new Set();\n /*\n * Returns the current block height of the node\n */\n this.getBlockHeight = (() => {\n const requestPromises = {};\n return async commitmentOrConfig => {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const requestHash = fastStableStringify$1(args);\n requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {\n try {\n const unsafeRes = await this._rpcRequest('getBlockHeight', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get block height information');\n }\n return res.result;\n } finally {\n delete requestPromises[requestHash];\n }\n })();\n return await requestPromises[requestHash];\n };\n })();\n let wsEndpoint;\n let httpHeaders;\n let fetch;\n let fetchMiddleware;\n let disableRetryOnRateLimit;\n let httpAgent;\n if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {\n this._commitment = _commitmentOrConfig;\n } else if (_commitmentOrConfig) {\n this._commitment = _commitmentOrConfig.commitment;\n this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;\n wsEndpoint = _commitmentOrConfig.wsEndpoint;\n httpHeaders = _commitmentOrConfig.httpHeaders;\n fetch = _commitmentOrConfig.fetch;\n fetchMiddleware = _commitmentOrConfig.fetchMiddleware;\n disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;\n httpAgent = _commitmentOrConfig.httpAgent;\n }\n this._rpcEndpoint = assertEndpointUrl(endpoint);\n this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);\n this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent);\n this._rpcRequest = createRpcRequest(this._rpcClient);\n this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);\n this._rpcWebSocket = new RpcWebSocketClient(this._rpcWsEndpoint, {\n autoconnect: false,\n max_reconnects: Infinity\n });\n this._rpcWebSocket.on('open', this._wsOnOpen.bind(this));\n this._rpcWebSocket.on('error', this._wsOnError.bind(this));\n this._rpcWebSocket.on('close', this._wsOnClose.bind(this));\n this._rpcWebSocket.on('accountNotification', this._wsOnAccountNotification.bind(this));\n this._rpcWebSocket.on('programNotification', this._wsOnProgramAccountNotification.bind(this));\n this._rpcWebSocket.on('slotNotification', this._wsOnSlotNotification.bind(this));\n this._rpcWebSocket.on('slotsUpdatesNotification', this._wsOnSlotUpdatesNotification.bind(this));\n this._rpcWebSocket.on('signatureNotification', this._wsOnSignatureNotification.bind(this));\n this._rpcWebSocket.on('rootNotification', this._wsOnRootNotification.bind(this));\n this._rpcWebSocket.on('logsNotification', this._wsOnLogsNotification.bind(this));\n }\n\n /**\n * The default commitment used for requests\n */\n get commitment() {\n return this._commitment;\n }\n\n /**\n * The RPC endpoint\n */\n get rpcEndpoint() {\n return this._rpcEndpoint;\n }\n\n /**\n * Fetch the balance for the specified public key, return with context\n */\n async getBalanceAndContext(publicKey, commitmentOrConfig) {\n /** @internal */\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getBalance', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get balance for ${publicKey.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch the balance for the specified public key\n */\n async getBalance(publicKey, commitmentOrConfig) {\n return await this.getBalanceAndContext(publicKey, commitmentOrConfig).then(x => x.value).catch(e => {\n throw new Error('failed to get balance of account ' + publicKey.toBase58() + ': ' + e);\n });\n }\n\n /**\n * Fetch the estimated production time of a block\n */\n async getBlockTime(slot) {\n const unsafeRes = await this._rpcRequest('getBlockTime', [slot]);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get block time for slot ${slot}`);\n }\n return res.result;\n }\n\n /**\n * Fetch the lowest slot that the node has information about in its ledger.\n * This value may increase over time if the node is configured to purge older ledger data\n */\n async getMinimumLedgerSlot() {\n const unsafeRes = await this._rpcRequest('minimumLedgerSlot', []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get minimum ledger slot');\n }\n return res.result;\n }\n\n /**\n * Fetch the slot of the lowest confirmed block that has not been purged from the ledger\n */\n async getFirstAvailableBlock() {\n const unsafeRes = await this._rpcRequest('getFirstAvailableBlock', []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, SlotRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get first available block');\n }\n return res.result;\n }\n\n /**\n * Fetch information about the current supply\n */\n async getSupply(config) {\n let configArg = {};\n if (typeof config === 'string') {\n configArg = {\n commitment: config\n };\n } else if (config) {\n configArg = {\n ...config,\n commitment: config && config.commitment || this.commitment\n };\n } else {\n configArg = {\n commitment: this.commitment\n };\n }\n const unsafeRes = await this._rpcRequest('getSupply', [configArg]);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetSupplyRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get supply');\n }\n return res.result;\n }\n\n /**\n * Fetch the current supply of a token mint\n */\n async getTokenSupply(tokenMintAddress, commitment) {\n const args = this._buildArgs([tokenMintAddress.toBase58()], commitment);\n const unsafeRes = await this._rpcRequest('getTokenSupply', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get token supply');\n }\n return res.result;\n }\n\n /**\n * Fetch the current balance of a token account\n */\n async getTokenAccountBalance(tokenAddress, commitment) {\n const args = this._buildArgs([tokenAddress.toBase58()], commitment);\n const unsafeRes = await this._rpcRequest('getTokenAccountBalance', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get token account balance');\n }\n return res.result;\n }\n\n /**\n * Fetch all the token accounts owned by the specified account\n *\n * @return {Promise}\n */\n async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n let _args = [ownerAddress.toBase58()];\n if ('mint' in filter) {\n _args.push({\n mint: filter.mint.toBase58()\n });\n } else {\n _args.push({\n programId: filter.programId.toBase58()\n });\n }\n const args = this._buildArgs(_args, commitment, 'base64', config);\n const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetTokenAccountsByOwner);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch parsed token accounts owned by the specified account\n *\n * @return {Promise}>>>}\n */\n async getParsedTokenAccountsByOwner(ownerAddress, filter, commitment) {\n let _args = [ownerAddress.toBase58()];\n if ('mint' in filter) {\n _args.push({\n mint: filter.mint.toBase58()\n });\n } else {\n _args.push({\n programId: filter.programId.toBase58()\n });\n }\n const args = this._buildArgs(_args, commitment, 'jsonParsed');\n const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetParsedTokenAccountsByOwner);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch the 20 largest accounts with their current balances\n */\n async getLargestAccounts(config) {\n const arg = {\n ...config,\n commitment: config && config.commitment || this.commitment\n };\n const args = arg.filter || arg.commitment ? [arg] : [];\n const unsafeRes = await this._rpcRequest('getLargestAccounts', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetLargestAccountsRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get largest accounts');\n }\n return res.result;\n }\n\n /**\n * Fetch the 20 largest token accounts with their current balances\n * for a given mint.\n */\n async getTokenLargestAccounts(mintAddress, commitment) {\n const args = this._buildArgs([mintAddress.toBase58()], commitment);\n const unsafeRes = await this._rpcRequest('getTokenLargestAccounts', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetTokenLargestAccountsResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get token largest accounts');\n }\n return res.result;\n }\n\n /**\n * Fetch all the account info for the specified public key, return with context\n */\n async getAccountInfoAndContext(publicKey, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment, 'base64', config);\n const unsafeRes = await this._rpcRequest('getAccountInfo', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(AccountInfoResult)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch parsed account info for the specified public key\n */\n async getParsedAccountInfo(publicKey, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getAccountInfo', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ParsedAccountInfoResult)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch all the account info for the specified public key\n */\n async getAccountInfo(publicKey, commitmentOrConfig) {\n try {\n const res = await this.getAccountInfoAndContext(publicKey, commitmentOrConfig);\n return res.value;\n } catch (e) {\n throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);\n }\n }\n\n /**\n * Fetch all the account info for multiple accounts specified by an array of public keys, return with context\n */\n async getMultipleParsedAccounts(publicKeys, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const keys = publicKeys.map(key => key.toBase58());\n const args = this._buildArgs([keys], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(ParsedAccountInfoResult))));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`);\n }\n return res.result;\n }\n\n /**\n * Fetch all the account info for multiple accounts specified by an array of public keys, return with context\n */\n async getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const keys = publicKeys.map(key => key.toBase58());\n const args = this._buildArgs([keys], commitment, 'base64', config);\n const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)(AccountInfoResult))));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`);\n }\n return res.result;\n }\n\n /**\n * Fetch all the account info for multiple accounts specified by an array of public keys\n */\n async getMultipleAccountsInfo(publicKeys, commitmentOrConfig) {\n const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig);\n return res.value;\n }\n\n /**\n * Returns epoch activation information for a stake account that has been delegated\n *\n * @deprecated Deprecated since RPC v1.18; will be removed in a future version.\n */\n async getStakeActivation(publicKey, commitmentOrConfig, epoch) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment, undefined /* encoding */, {\n ...config,\n epoch: epoch != null ? epoch : config?.epoch\n });\n const unsafeRes = await this._rpcRequest('getStakeActivation', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult(StakeActivationResult));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get Stake Activation ${publicKey.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch all the accounts owned by the specified program id\n *\n * @return {Promise}>>}\n */\n\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n async getProgramAccounts(programId, configOrCommitment) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(configOrCommitment);\n const {\n encoding,\n ...configWithoutEncoding\n } = config || {};\n const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', {\n ...configWithoutEncoding,\n ...(configWithoutEncoding.filters ? {\n filters: applyDefaultMemcmpEncodingToFilters(configWithoutEncoding.filters)\n } : null)\n });\n const unsafeRes = await this._rpcRequest('getProgramAccounts', args);\n const baseSchema = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(KeyedAccountInfoResult);\n const res = configWithoutEncoding.withContext === true ? (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext(baseSchema)) : (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult(baseSchema));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch and parse all the accounts owned by the specified program id\n *\n * @return {Promise}>>}\n */\n async getParsedProgramAccounts(programId, configOrCommitment) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(configOrCommitment);\n const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getProgramAccounts', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(KeyedParsedAccountInfoResult)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);\n }\n return res.result;\n }\n\n /** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n async confirmTransaction(strategy, commitment) {\n let rawSignature;\n if (typeof strategy == 'string') {\n rawSignature = strategy;\n } else {\n const config = strategy;\n if (config.abortSignal?.aborted) {\n return Promise.reject(config.abortSignal.reason);\n }\n rawSignature = config.signature;\n }\n let decodedSignature;\n try {\n decodedSignature = bs58__WEBPACK_IMPORTED_MODULE_2___default().decode(rawSignature);\n } catch (err) {\n throw new Error('signature must be base58 encoded: ' + rawSignature);\n }\n assert(decodedSignature.length === 64, 'signature has invalid length');\n if (typeof strategy === 'string') {\n return await this.confirmTransactionUsingLegacyTimeoutStrategy({\n commitment: commitment || this.commitment,\n signature: rawSignature\n });\n } else if ('lastValidBlockHeight' in strategy) {\n return await this.confirmTransactionUsingBlockHeightExceedanceStrategy({\n commitment: commitment || this.commitment,\n strategy\n });\n } else {\n return await this.confirmTransactionUsingDurableNonceStrategy({\n commitment: commitment || this.commitment,\n strategy\n });\n }\n }\n getCancellationPromise(signal) {\n return new Promise((_, reject) => {\n if (signal == null) {\n return;\n }\n if (signal.aborted) {\n reject(signal.reason);\n } else {\n signal.addEventListener('abort', () => {\n reject(signal.reason);\n });\n }\n });\n }\n getTransactionConfirmationPromise({\n commitment,\n signature\n }) {\n let signatureSubscriptionId;\n let disposeSignatureSubscriptionStateChangeObserver;\n let done = false;\n const confirmationPromise = new Promise((resolve, reject) => {\n try {\n signatureSubscriptionId = this.onSignature(signature, (result, context) => {\n signatureSubscriptionId = undefined;\n const response = {\n context,\n value: result\n };\n resolve({\n __type: TransactionStatus.PROCESSED,\n response\n });\n }, commitment);\n const subscriptionSetupPromise = new Promise(resolveSubscriptionSetup => {\n if (signatureSubscriptionId == null) {\n resolveSubscriptionSetup();\n } else {\n disposeSignatureSubscriptionStateChangeObserver = this._onSubscriptionStateChange(signatureSubscriptionId, nextState => {\n if (nextState === 'subscribed') {\n resolveSubscriptionSetup();\n }\n });\n }\n });\n (async () => {\n await subscriptionSetupPromise;\n if (done) return;\n const response = await this.getSignatureStatus(signature);\n if (done) return;\n if (response == null) {\n return;\n }\n const {\n context,\n value\n } = response;\n if (value == null) {\n return;\n }\n if (value?.err) {\n reject(value.err);\n } else {\n switch (commitment) {\n case 'confirmed':\n case 'single':\n case 'singleGossip':\n {\n if (value.confirmationStatus === 'processed') {\n return;\n }\n break;\n }\n case 'finalized':\n case 'max':\n case 'root':\n {\n if (value.confirmationStatus === 'processed' || value.confirmationStatus === 'confirmed') {\n return;\n }\n break;\n }\n // exhaust enums to ensure full coverage\n case 'processed':\n case 'recent':\n }\n done = true;\n resolve({\n __type: TransactionStatus.PROCESSED,\n response: {\n context,\n value\n }\n });\n }\n })();\n } catch (err) {\n reject(err);\n }\n });\n const abortConfirmation = () => {\n if (disposeSignatureSubscriptionStateChangeObserver) {\n disposeSignatureSubscriptionStateChangeObserver();\n disposeSignatureSubscriptionStateChangeObserver = undefined;\n }\n if (signatureSubscriptionId != null) {\n this.removeSignatureListener(signatureSubscriptionId);\n signatureSubscriptionId = undefined;\n }\n };\n return {\n abortConfirmation,\n confirmationPromise\n };\n }\n async confirmTransactionUsingBlockHeightExceedanceStrategy({\n commitment,\n strategy: {\n abortSignal,\n lastValidBlockHeight,\n signature\n }\n }) {\n let done = false;\n const expiryPromise = new Promise(resolve => {\n const checkBlockHeight = async () => {\n try {\n const blockHeight = await this.getBlockHeight(commitment);\n return blockHeight;\n } catch (_e) {\n return -1;\n }\n };\n (async () => {\n let currentBlockHeight = await checkBlockHeight();\n if (done) return;\n while (currentBlockHeight <= lastValidBlockHeight) {\n await sleep(1000);\n if (done) return;\n currentBlockHeight = await checkBlockHeight();\n if (done) return;\n }\n resolve({\n __type: TransactionStatus.BLOCKHEIGHT_EXCEEDED\n });\n })();\n });\n const {\n abortConfirmation,\n confirmationPromise\n } = this.getTransactionConfirmationPromise({\n commitment,\n signature\n });\n const cancellationPromise = this.getCancellationPromise(abortSignal);\n let result;\n try {\n const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);\n if (outcome.__type === TransactionStatus.PROCESSED) {\n result = outcome.response;\n } else {\n throw new TransactionExpiredBlockheightExceededError(signature);\n }\n } finally {\n done = true;\n abortConfirmation();\n }\n return result;\n }\n async confirmTransactionUsingDurableNonceStrategy({\n commitment,\n strategy: {\n abortSignal,\n minContextSlot,\n nonceAccountPubkey,\n nonceValue,\n signature\n }\n }) {\n let done = false;\n const expiryPromise = new Promise(resolve => {\n let currentNonceValue = nonceValue;\n let lastCheckedSlot = null;\n const getCurrentNonceValue = async () => {\n try {\n const {\n context,\n value: nonceAccount\n } = await this.getNonceAndContext(nonceAccountPubkey, {\n commitment,\n minContextSlot\n });\n lastCheckedSlot = context.slot;\n return nonceAccount?.nonce;\n } catch (e) {\n // If for whatever reason we can't reach/read the nonce\n // account, just keep using the last-known value.\n return currentNonceValue;\n }\n };\n (async () => {\n currentNonceValue = await getCurrentNonceValue();\n if (done) return;\n while (true // eslint-disable-line no-constant-condition\n ) {\n if (nonceValue !== currentNonceValue) {\n resolve({\n __type: TransactionStatus.NONCE_INVALID,\n slotInWhichNonceDidAdvance: lastCheckedSlot\n });\n return;\n }\n await sleep(2000);\n if (done) return;\n currentNonceValue = await getCurrentNonceValue();\n if (done) return;\n }\n })();\n });\n const {\n abortConfirmation,\n confirmationPromise\n } = this.getTransactionConfirmationPromise({\n commitment,\n signature\n });\n const cancellationPromise = this.getCancellationPromise(abortSignal);\n let result;\n try {\n const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);\n if (outcome.__type === TransactionStatus.PROCESSED) {\n result = outcome.response;\n } else {\n // Double check that the transaction is indeed unconfirmed.\n let signatureStatus;\n while (true // eslint-disable-line no-constant-condition\n ) {\n const status = await this.getSignatureStatus(signature);\n if (status == null) {\n break;\n }\n if (status.context.slot < (outcome.slotInWhichNonceDidAdvance ?? minContextSlot)) {\n await sleep(400);\n continue;\n }\n signatureStatus = status;\n break;\n }\n if (signatureStatus?.value) {\n const commitmentForStatus = commitment || 'finalized';\n const {\n confirmationStatus\n } = signatureStatus.value;\n switch (commitmentForStatus) {\n case 'processed':\n case 'recent':\n if (confirmationStatus !== 'processed' && confirmationStatus !== 'confirmed' && confirmationStatus !== 'finalized') {\n throw new TransactionExpiredNonceInvalidError(signature);\n }\n break;\n case 'confirmed':\n case 'single':\n case 'singleGossip':\n if (confirmationStatus !== 'confirmed' && confirmationStatus !== 'finalized') {\n throw new TransactionExpiredNonceInvalidError(signature);\n }\n break;\n case 'finalized':\n case 'max':\n case 'root':\n if (confirmationStatus !== 'finalized') {\n throw new TransactionExpiredNonceInvalidError(signature);\n }\n break;\n default:\n // Exhaustive switch.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n (_ => {})(commitmentForStatus);\n }\n result = {\n context: signatureStatus.context,\n value: {\n err: signatureStatus.value.err\n }\n };\n } else {\n throw new TransactionExpiredNonceInvalidError(signature);\n }\n }\n } finally {\n done = true;\n abortConfirmation();\n }\n return result;\n }\n async confirmTransactionUsingLegacyTimeoutStrategy({\n commitment,\n signature\n }) {\n let timeoutId;\n const expiryPromise = new Promise(resolve => {\n let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;\n switch (commitment) {\n case 'processed':\n case 'recent':\n case 'single':\n case 'confirmed':\n case 'singleGossip':\n {\n timeoutMs = this._confirmTransactionInitialTimeout || 30 * 1000;\n break;\n }\n }\n timeoutId = setTimeout(() => resolve({\n __type: TransactionStatus.TIMED_OUT,\n timeoutMs\n }), timeoutMs);\n });\n const {\n abortConfirmation,\n confirmationPromise\n } = this.getTransactionConfirmationPromise({\n commitment,\n signature\n });\n let result;\n try {\n const outcome = await Promise.race([confirmationPromise, expiryPromise]);\n if (outcome.__type === TransactionStatus.PROCESSED) {\n result = outcome.response;\n } else {\n throw new TransactionExpiredTimeoutError(signature, outcome.timeoutMs / 1000);\n }\n } finally {\n clearTimeout(timeoutId);\n abortConfirmation();\n }\n return result;\n }\n\n /**\n * Return the list of nodes that are currently participating in the cluster\n */\n async getClusterNodes() {\n const unsafeRes = await this._rpcRequest('getClusterNodes', []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(ContactInfoResult)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get cluster nodes');\n }\n return res.result;\n }\n\n /**\n * Return the list of nodes that are currently participating in the cluster\n */\n async getVoteAccounts(commitment) {\n const args = this._buildArgs([], commitment);\n const unsafeRes = await this._rpcRequest('getVoteAccounts', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetVoteAccounts);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get vote accounts');\n }\n return res.result;\n }\n\n /**\n * Fetch the current slot that the node is processing\n */\n async getSlot(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getSlot', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get slot');\n }\n return res.result;\n }\n\n /**\n * Fetch the current slot leader of the cluster\n */\n async getSlotLeader(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getSlotLeader', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get slot leader');\n }\n return res.result;\n }\n\n /**\n * Fetch `limit` number of slot leaders starting from `startSlot`\n *\n * @param startSlot fetch slot leaders starting from this slot\n * @param limit number of slot leaders to return\n */\n async getSlotLeaders(startSlot, limit) {\n const args = [startSlot, limit];\n const unsafeRes = await this._rpcRequest('getSlotLeaders', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)(PublicKeyFromString)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get slot leaders');\n }\n return res.result;\n }\n\n /**\n * Fetch the current status of a signature\n */\n async getSignatureStatus(signature, config) {\n const {\n context,\n value: values\n } = await this.getSignatureStatuses([signature], config);\n assert(values.length === 1);\n const value = values[0];\n return {\n context,\n value\n };\n }\n\n /**\n * Fetch the current statuses of a batch of signatures\n */\n async getSignatureStatuses(signatures, config) {\n const params = [signatures];\n if (config) {\n params.push(config);\n }\n const unsafeRes = await this._rpcRequest('getSignatureStatuses', params);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetSignatureStatusesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get signature status');\n }\n return res.result;\n }\n\n /**\n * Fetch the current transaction count of the cluster\n */\n async getTransactionCount(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getTransactionCount', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transaction count');\n }\n return res.result;\n }\n\n /**\n * Fetch the current total currency supply of the cluster in lamports\n *\n * @deprecated Deprecated since RPC v1.2.8. Please use {@link getSupply} instead.\n */\n async getTotalSupply(commitment) {\n const result = await this.getSupply({\n commitment,\n excludeNonCirculatingAccountsList: true\n });\n return result.value.total;\n }\n\n /**\n * Fetch the cluster InflationGovernor parameters\n */\n async getInflationGovernor(commitment) {\n const args = this._buildArgs([], commitment);\n const unsafeRes = await this._rpcRequest('getInflationGovernor', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetInflationGovernorRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get inflation');\n }\n return res.result;\n }\n\n /**\n * Fetch the inflation reward for a list of addresses for an epoch\n */\n async getInflationReward(addresses, epoch, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined /* encoding */, {\n ...config,\n epoch: epoch != null ? epoch : config?.epoch\n });\n const unsafeRes = await this._rpcRequest('getInflationReward', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetInflationRewardResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get inflation reward');\n }\n return res.result;\n }\n\n /**\n * Fetch the specific inflation values for the current epoch\n */\n async getInflationRate() {\n const unsafeRes = await this._rpcRequest('getInflationRate', []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetInflationRateRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get inflation rate');\n }\n return res.result;\n }\n\n /**\n * Fetch the Epoch Info parameters\n */\n async getEpochInfo(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getEpochInfo', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetEpochInfoRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get epoch info');\n }\n return res.result;\n }\n\n /**\n * Fetch the Epoch Schedule parameters\n */\n async getEpochSchedule() {\n const unsafeRes = await this._rpcRequest('getEpochSchedule', []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetEpochScheduleRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get epoch schedule');\n }\n const epochSchedule = res.result;\n return new EpochSchedule(epochSchedule.slotsPerEpoch, epochSchedule.leaderScheduleSlotOffset, epochSchedule.warmup, epochSchedule.firstNormalEpoch, epochSchedule.firstNormalSlot);\n }\n\n /**\n * Fetch the leader schedule for the current epoch\n * @return {Promise>}\n */\n async getLeaderSchedule() {\n const unsafeRes = await this._rpcRequest('getLeaderSchedule', []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetLeaderScheduleRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get leader schedule');\n }\n return res.result;\n }\n\n /**\n * Fetch the minimum balance needed to exempt an account of `dataLength`\n * size from rent\n */\n async getMinimumBalanceForRentExemption(dataLength, commitment) {\n const args = this._buildArgs([dataLength], commitment);\n const unsafeRes = await this._rpcRequest('getMinimumBalanceForRentExemption', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetMinimumBalanceForRentExemptionRpcResult);\n if ('error' in res) {\n console.warn('Unable to fetch minimum balance for rent exemption');\n return 0;\n }\n return res.result;\n }\n\n /**\n * Fetch a recent blockhash from the cluster, return with context\n * @return {Promise>}\n *\n * @deprecated Deprecated since RPC v1.9.0. Please use {@link getLatestBlockhash} instead.\n */\n async getRecentBlockhashAndContext(commitment) {\n const args = this._buildArgs([], commitment);\n const unsafeRes = await this._rpcRequest('getRecentBlockhash', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetRecentBlockhashAndContextRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get recent blockhash');\n }\n return res.result;\n }\n\n /**\n * Fetch recent performance samples\n * @return {Promise>}\n */\n async getRecentPerformanceSamples(limit) {\n const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetRecentPerformanceSamplesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get recent performance samples');\n }\n return res.result;\n }\n\n /**\n * Fetch the fee calculator for a recent blockhash from the cluster, return with context\n *\n * @deprecated Deprecated since RPC v1.9.0. Please use {@link getFeeForMessage} instead.\n */\n async getFeeCalculatorForBlockhash(blockhash, commitment) {\n const args = this._buildArgs([blockhash], commitment);\n const unsafeRes = await this._rpcRequest('getFeeCalculatorForBlockhash', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetFeeCalculatorRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get fee calculator');\n }\n const {\n context,\n value\n } = res.result;\n return {\n context,\n value: value !== null ? value.feeCalculator : null\n };\n }\n\n /**\n * Fetch the fee for a message from the cluster, return with context\n */\n async getFeeForMessage(message, commitment) {\n const wireMessage = toBuffer(message.serialize()).toString('base64');\n const args = this._buildArgs([wireMessage], commitment);\n const unsafeRes = await this._rpcRequest('getFeeForMessage', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get fee for message');\n }\n if (res.result === null) {\n throw new Error('invalid blockhash');\n }\n return res.result;\n }\n\n /**\n * Fetch a list of prioritization fees from recent blocks.\n */\n async getRecentPrioritizationFees(config) {\n const accounts = config?.lockedWritableAccounts?.map(key => key.toBase58());\n const args = accounts?.length ? [accounts] : [];\n const unsafeRes = await this._rpcRequest('getRecentPrioritizationFees', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetRecentPrioritizationFeesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get recent prioritization fees');\n }\n return res.result;\n }\n /**\n * Fetch a recent blockhash from the cluster\n * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link getLatestBlockhash} instead.\n */\n async getRecentBlockhash(commitment) {\n try {\n const res = await this.getRecentBlockhashAndContext(commitment);\n return res.value;\n } catch (e) {\n throw new Error('failed to get recent blockhash: ' + e);\n }\n }\n\n /**\n * Fetch the latest blockhash from the cluster\n * @return {Promise}\n */\n async getLatestBlockhash(commitmentOrConfig) {\n try {\n const res = await this.getLatestBlockhashAndContext(commitmentOrConfig);\n return res.value;\n } catch (e) {\n throw new Error('failed to get recent blockhash: ' + e);\n }\n }\n\n /**\n * Fetch the latest blockhash from the cluster\n * @return {Promise}\n */\n async getLatestBlockhashAndContext(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getLatestBlockhash', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetLatestBlockhashRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get latest blockhash');\n }\n return res.result;\n }\n\n /**\n * Returns whether a blockhash is still valid or not\n */\n async isBlockhashValid(blockhash, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const args = this._buildArgs([blockhash], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('isBlockhashValid', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, IsBlockhashValidRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to determine if the blockhash `' + blockhash + '`is valid');\n }\n return res.result;\n }\n\n /**\n * Fetch the node version\n */\n async getVersion() {\n const unsafeRes = await this._rpcRequest('getVersion', []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult(VersionResult));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get version');\n }\n return res.result;\n }\n\n /**\n * Fetch the genesis hash\n */\n async getGenesisHash() {\n const unsafeRes = await this._rpcRequest('getGenesisHash', []);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get genesis hash');\n }\n return res.result;\n }\n\n /**\n * Fetch a processed block from the cluster.\n *\n * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by\n * setting the `maxSupportedTransactionVersion` property.\n */\n\n /**\n * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by\n * setting the `maxSupportedTransactionVersion` property.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by\n * setting the `maxSupportedTransactionVersion` property.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Fetch a processed block from the cluster.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Fetch a processed block from the cluster.\n */\n // eslint-disable-next-line no-dupe-class-members\n async getBlock(slot, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getBlock', args);\n try {\n switch (config?.transactionDetails) {\n case 'accounts':\n {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetAccountsModeBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n case 'none':\n {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetNoneModeBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n default:\n {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n const {\n result\n } = res;\n return result ? {\n ...result,\n transactions: result.transactions.map(({\n transaction,\n meta,\n version\n }) => ({\n meta,\n transaction: {\n ...transaction,\n message: versionedMessageFromResponse(version, transaction.message)\n },\n version\n }))\n } : null;\n }\n }\n } catch (e) {\n throw new SolanaJSONRPCError(e, 'failed to get confirmed block');\n }\n }\n\n /**\n * Fetch parsed transaction details for a confirmed or finalized block\n */\n\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n async getParsedBlock(slot, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const args = this._buildArgsAtLeastConfirmed([slot], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getBlock', args);\n try {\n switch (config?.transactionDetails) {\n case 'accounts':\n {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetParsedAccountsModeBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n case 'none':\n {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetParsedNoneModeBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n default:\n {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetParsedBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n }\n } catch (e) {\n throw new SolanaJSONRPCError(e, 'failed to get block');\n }\n }\n /*\n * Returns recent block production information from the current or previous epoch\n */\n async getBlockProduction(configOrCommitment) {\n let extra;\n let commitment;\n if (typeof configOrCommitment === 'string') {\n commitment = configOrCommitment;\n } else if (configOrCommitment) {\n const {\n commitment: c,\n ...rest\n } = configOrCommitment;\n commitment = c;\n extra = rest;\n }\n const args = this._buildArgs([], commitment, 'base64', extra);\n const unsafeRes = await this._rpcRequest('getBlockProduction', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, BlockProductionResponseStruct);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get block production information');\n }\n return res.result;\n }\n\n /**\n * Fetch a confirmed or finalized transaction from the cluster.\n *\n * @deprecated Instead, call `getTransaction` using a\n * `GetVersionedTransactionConfig` by setting the\n * `maxSupportedTransactionVersion` property.\n */\n\n /**\n * Fetch a confirmed or finalized transaction from the cluster.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Fetch a confirmed or finalized transaction from the cluster.\n */\n // eslint-disable-next-line no-dupe-class-members\n async getTransaction(signature, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getTransaction', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transaction');\n }\n const result = res.result;\n if (!result) return result;\n return {\n ...result,\n transaction: {\n ...result.transaction,\n message: versionedMessageFromResponse(result.version, result.transaction.message)\n }\n };\n }\n\n /**\n * Fetch parsed transaction details for a confirmed or finalized transaction\n */\n async getParsedTransaction(signature, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getTransaction', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetParsedTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transaction');\n }\n return res.result;\n }\n\n /**\n * Fetch parsed transaction details for a batch of confirmed transactions\n */\n async getParsedTransactions(signatures, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const batch = signatures.map(signature => {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);\n return {\n methodName: 'getTransaction',\n args\n };\n });\n const unsafeRes = await this._rpcBatchRequest(batch);\n const res = unsafeRes.map(unsafeRes => {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetParsedTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transactions');\n }\n return res.result;\n });\n return res;\n }\n\n /**\n * Fetch transaction details for a batch of confirmed transactions.\n * Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.\n *\n * @deprecated Instead, call `getTransactions` using a\n * `GetVersionedTransactionConfig` by setting the\n * `maxSupportedTransactionVersion` property.\n */\n\n /**\n * Fetch transaction details for a batch of confirmed transactions.\n * Similar to {@link getParsedTransactions} but returns a {@link\n * VersionedTransactionResponse}.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Fetch transaction details for a batch of confirmed transactions.\n * Similar to {@link getParsedTransactions} but returns a {@link\n * VersionedTransactionResponse}.\n */\n // eslint-disable-next-line no-dupe-class-members\n async getTransactions(signatures, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const batch = signatures.map(signature => {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined /* encoding */, config);\n return {\n methodName: 'getTransaction',\n args\n };\n });\n const unsafeRes = await this._rpcBatchRequest(batch);\n const res = unsafeRes.map(unsafeRes => {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transactions');\n }\n const result = res.result;\n if (!result) return result;\n return {\n ...result,\n transaction: {\n ...result.transaction,\n message: versionedMessageFromResponse(result.version, result.transaction.message)\n }\n };\n });\n return res;\n }\n\n /**\n * Fetch a list of Transactions and transaction statuses from the cluster\n * for a confirmed block.\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlock} instead.\n */\n async getConfirmedBlock(slot, commitment) {\n const args = this._buildArgsAtLeastConfirmed([slot], commitment);\n const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetConfirmedBlockRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');\n }\n const result = res.result;\n if (!result) {\n throw new Error('Confirmed block ' + slot + ' not found');\n }\n const block = {\n ...result,\n transactions: result.transactions.map(({\n transaction,\n meta\n }) => {\n const message = new Message(transaction.message);\n return {\n meta,\n transaction: {\n ...transaction,\n message\n }\n };\n })\n };\n return {\n ...block,\n transactions: block.transactions.map(({\n transaction,\n meta\n }) => {\n return {\n meta,\n transaction: Transaction.populate(transaction.message, transaction.signatures)\n };\n })\n };\n }\n\n /**\n * Fetch confirmed blocks between two slots\n */\n async getBlocks(startSlot, endSlot, commitment) {\n const args = this._buildArgsAtLeastConfirmed(endSlot !== undefined ? [startSlot, endSlot] : [startSlot], commitment);\n const unsafeRes = await this._rpcRequest('getBlocks', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)())));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get blocks');\n }\n return res.result;\n }\n\n /**\n * Fetch a list of Signatures from the cluster for a block, excluding rewards\n */\n async getBlockSignatures(slot, commitment) {\n const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, {\n transactionDetails: 'signatures',\n rewards: false\n });\n const unsafeRes = await this._rpcRequest('getBlock', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetBlockSignaturesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get block');\n }\n const result = res.result;\n if (!result) {\n throw new Error('Block ' + slot + ' not found');\n }\n return result;\n }\n\n /**\n * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlockSignatures} instead.\n */\n async getConfirmedBlockSignatures(slot, commitment) {\n const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, {\n transactionDetails: 'signatures',\n rewards: false\n });\n const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetBlockSignaturesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');\n }\n const result = res.result;\n if (!result) {\n throw new Error('Confirmed block ' + slot + ' not found');\n }\n return result;\n }\n\n /**\n * Fetch a transaction details for a confirmed transaction\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getTransaction} instead.\n */\n async getConfirmedTransaction(signature, commitment) {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment);\n const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transaction');\n }\n const result = res.result;\n if (!result) return result;\n const message = new Message(result.transaction.message);\n const signatures = result.transaction.signatures;\n return {\n ...result,\n transaction: Transaction.populate(message, signatures)\n };\n }\n\n /**\n * Fetch parsed transaction details for a confirmed transaction\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransaction} instead.\n */\n async getParsedConfirmedTransaction(signature, commitment) {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');\n const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetParsedTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction');\n }\n return res.result;\n }\n\n /**\n * Fetch parsed transaction details for a batch of confirmed transactions\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransactions} instead.\n */\n async getParsedConfirmedTransactions(signatures, commitment) {\n const batch = signatures.map(signature => {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');\n return {\n methodName: 'getConfirmedTransaction',\n args\n };\n });\n const unsafeRes = await this._rpcBatchRequest(batch);\n const res = unsafeRes.map(unsafeRes => {\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetParsedTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transactions');\n }\n return res.result;\n });\n return res;\n }\n\n /**\n * Fetch a list of all the confirmed signatures for transactions involving an address\n * within a specified slot range. Max range allowed is 10,000 slots.\n *\n * @deprecated Deprecated since RPC v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.\n *\n * @param address queried address\n * @param startSlot start slot, inclusive\n * @param endSlot end slot, inclusive\n */\n async getConfirmedSignaturesForAddress(address, startSlot, endSlot) {\n let options = {};\n let firstAvailableBlock = await this.getFirstAvailableBlock();\n while (!('until' in options)) {\n startSlot--;\n if (startSlot <= 0 || startSlot < firstAvailableBlock) {\n break;\n }\n try {\n const block = await this.getConfirmedBlockSignatures(startSlot, 'finalized');\n if (block.signatures.length > 0) {\n options.until = block.signatures[block.signatures.length - 1].toString();\n }\n } catch (err) {\n if (err instanceof Error && err.message.includes('skipped')) {\n continue;\n } else {\n throw err;\n }\n }\n }\n let highestConfirmedRoot = await this.getSlot('finalized');\n while (!('before' in options)) {\n endSlot++;\n if (endSlot > highestConfirmedRoot) {\n break;\n }\n try {\n const block = await this.getConfirmedBlockSignatures(endSlot);\n if (block.signatures.length > 0) {\n options.before = block.signatures[block.signatures.length - 1].toString();\n }\n } catch (err) {\n if (err instanceof Error && err.message.includes('skipped')) {\n continue;\n } else {\n throw err;\n }\n }\n }\n const confirmedSignatureInfo = await this.getConfirmedSignaturesForAddress2(address, options);\n return confirmedSignatureInfo.map(info => info.signature);\n }\n\n /**\n * Returns confirmed signatures for transactions involving an\n * address backwards in time from the provided signature or most recent confirmed block\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getSignaturesForAddress} instead.\n */\n async getConfirmedSignaturesForAddress2(address, options, commitment) {\n const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options);\n const unsafeRes = await this._rpcRequest('getConfirmedSignaturesForAddress2', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed signatures for address');\n }\n return res.result;\n }\n\n /**\n * Returns confirmed signatures for transactions involving an\n * address backwards in time from the provided signature or most recent confirmed block\n *\n *\n * @param address queried address\n * @param options\n */\n async getSignaturesForAddress(address, options, commitment) {\n const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options);\n const unsafeRes = await this._rpcRequest('getSignaturesForAddress', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, GetSignaturesForAddressRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get signatures for address');\n }\n return res.result;\n }\n async getAddressLookupTable(accountKey, config) {\n const {\n context,\n value: accountInfo\n } = await this.getAccountInfoAndContext(accountKey, config);\n let value = null;\n if (accountInfo !== null) {\n value = new AddressLookupTableAccount({\n key: accountKey,\n state: AddressLookupTableAccount.deserialize(accountInfo.data)\n });\n }\n return {\n context,\n value\n };\n }\n\n /**\n * Fetch the contents of a Nonce account from the cluster, return with context\n */\n async getNonceAndContext(nonceAccount, commitmentOrConfig) {\n const {\n context,\n value: accountInfo\n } = await this.getAccountInfoAndContext(nonceAccount, commitmentOrConfig);\n let value = null;\n if (accountInfo !== null) {\n value = NonceAccount.fromAccountData(accountInfo.data);\n }\n return {\n context,\n value\n };\n }\n\n /**\n * Fetch the contents of a Nonce account from the cluster\n */\n async getNonce(nonceAccount, commitmentOrConfig) {\n return await this.getNonceAndContext(nonceAccount, commitmentOrConfig).then(x => x.value).catch(e => {\n throw new Error('failed to get nonce for account ' + nonceAccount.toBase58() + ': ' + e);\n });\n }\n\n /**\n * Request an allocation of lamports to the specified address\n *\n * ```typescript\n * import { Connection, PublicKey, LAMPORTS_PER_SOL } from \"@solana/web3.js\";\n *\n * (async () => {\n * const connection = new Connection(\"https://api.testnet.solana.com\", \"confirmed\");\n * const myAddress = new PublicKey(\"2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM\");\n * const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL);\n * await connection.confirmTransaction(signature);\n * })();\n * ```\n */\n async requestAirdrop(to, lamports) {\n const unsafeRes = await this._rpcRequest('requestAirdrop', [to.toBase58(), lamports]);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, RequestAirdropRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `airdrop to ${to.toBase58()} failed`);\n }\n return res.result;\n }\n\n /**\n * @internal\n */\n async _blockhashWithExpiryBlockHeight(disableCache) {\n if (!disableCache) {\n // Wait for polling to finish\n while (this._pollingBlockhash) {\n await sleep(100);\n }\n const timeSinceFetch = Date.now() - this._blockhashInfo.lastFetch;\n const expired = timeSinceFetch >= BLOCKHASH_CACHE_TIMEOUT_MS;\n if (this._blockhashInfo.latestBlockhash !== null && !expired) {\n return this._blockhashInfo.latestBlockhash;\n }\n }\n return await this._pollNewBlockhash();\n }\n\n /**\n * @internal\n */\n async _pollNewBlockhash() {\n this._pollingBlockhash = true;\n try {\n const startTime = Date.now();\n const cachedLatestBlockhash = this._blockhashInfo.latestBlockhash;\n const cachedBlockhash = cachedLatestBlockhash ? cachedLatestBlockhash.blockhash : null;\n for (let i = 0; i < 50; i++) {\n const latestBlockhash = await this.getLatestBlockhash('finalized');\n if (cachedBlockhash !== latestBlockhash.blockhash) {\n this._blockhashInfo = {\n latestBlockhash,\n lastFetch: Date.now(),\n transactionSignatures: [],\n simulatedSignatures: []\n };\n return latestBlockhash;\n }\n\n // Sleep for approximately half a slot\n await sleep(MS_PER_SLOT / 2);\n }\n throw new Error(`Unable to obtain a new blockhash after ${Date.now() - startTime}ms`);\n } finally {\n this._pollingBlockhash = false;\n }\n }\n\n /**\n * get the stake minimum delegation\n */\n async getStakeMinimumDelegation(config) {\n const {\n commitment,\n config: configArg\n } = extractCommitmentFromConfig(config);\n const args = this._buildArgs([], commitment, 'base64', configArg);\n const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.number)()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);\n }\n return res.result;\n }\n\n /**\n * Simulate a transaction\n *\n * @deprecated Instead, call {@link simulateTransaction} with {@link\n * VersionedTransaction} and {@link SimulateTransactionConfig} parameters\n */\n\n /**\n * Simulate a transaction\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Simulate a transaction\n */\n // eslint-disable-next-line no-dupe-class-members\n async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {\n if ('message' in transactionOrMessage) {\n const versionedTx = transactionOrMessage;\n const wireTransaction = versionedTx.serialize();\n const encodedTransaction = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(wireTransaction).toString('base64');\n if (Array.isArray(configOrSigners) || includeAccounts !== undefined) {\n throw new Error('Invalid arguments');\n }\n const config = configOrSigners || {};\n config.encoding = 'base64';\n if (!('commitment' in config)) {\n config.commitment = this.commitment;\n }\n if (configOrSigners && typeof configOrSigners === 'object' && 'innerInstructions' in configOrSigners) {\n config.innerInstructions = configOrSigners.innerInstructions;\n }\n const args = [encodedTransaction, config];\n const unsafeRes = await this._rpcRequest('simulateTransaction', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, SimulatedTransactionResponseStruct);\n if ('error' in res) {\n throw new Error('failed to simulate transaction: ' + res.error.message);\n }\n return res.result;\n }\n let transaction;\n if (transactionOrMessage instanceof Transaction) {\n let originalTx = transactionOrMessage;\n transaction = new Transaction();\n transaction.feePayer = originalTx.feePayer;\n transaction.instructions = transactionOrMessage.instructions;\n transaction.nonceInfo = originalTx.nonceInfo;\n transaction.signatures = originalTx.signatures;\n } else {\n transaction = Transaction.populate(transactionOrMessage);\n // HACK: this function relies on mutating the populated transaction\n transaction._message = transaction._json = undefined;\n }\n if (configOrSigners !== undefined && !Array.isArray(configOrSigners)) {\n throw new Error('Invalid arguments');\n }\n const signers = configOrSigners;\n if (transaction.nonceInfo && signers) {\n transaction.sign(...signers);\n } else {\n let disableCache = this._disableBlockhashCaching;\n for (;;) {\n const latestBlockhash = await this._blockhashWithExpiryBlockHeight(disableCache);\n transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;\n transaction.recentBlockhash = latestBlockhash.blockhash;\n if (!signers) break;\n transaction.sign(...signers);\n if (!transaction.signature) {\n throw new Error('!signature'); // should never happen\n }\n const signature = transaction.signature.toString('base64');\n if (!this._blockhashInfo.simulatedSignatures.includes(signature) && !this._blockhashInfo.transactionSignatures.includes(signature)) {\n // The signature of this transaction has not been seen before with the\n // current recentBlockhash, all done. Let's break\n this._blockhashInfo.simulatedSignatures.push(signature);\n break;\n } else {\n // This transaction would be treated as duplicate (its derived signature\n // matched to one of already recorded signatures).\n // So, we must fetch a new blockhash for a different signature by disabling\n // our cache not to wait for the cache expiration (BLOCKHASH_CACHE_TIMEOUT_MS).\n disableCache = true;\n }\n }\n }\n const message = transaction._compile();\n const signData = message.serialize();\n const wireTransaction = transaction._serialize(signData);\n const encodedTransaction = wireTransaction.toString('base64');\n const config = {\n encoding: 'base64',\n commitment: this.commitment\n };\n if (includeAccounts) {\n const addresses = (Array.isArray(includeAccounts) ? includeAccounts : message.nonProgramIds()).map(key => key.toBase58());\n config['accounts'] = {\n encoding: 'base64',\n addresses\n };\n }\n if (signers) {\n config.sigVerify = true;\n }\n if (configOrSigners && typeof configOrSigners === 'object' && 'innerInstructions' in configOrSigners) {\n config.innerInstructions = configOrSigners.innerInstructions;\n }\n const args = [encodedTransaction, config];\n const unsafeRes = await this._rpcRequest('simulateTransaction', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, SimulatedTransactionResponseStruct);\n if ('error' in res) {\n let logs;\n if ('data' in res.error) {\n logs = res.error.data.logs;\n if (logs && Array.isArray(logs)) {\n const traceIndent = '\\n ';\n const logTrace = traceIndent + logs.join(traceIndent);\n console.error(res.error.message, logTrace);\n }\n }\n throw new SendTransactionError({\n action: 'simulate',\n signature: '',\n transactionMessage: res.error.message,\n logs: logs\n });\n }\n return res.result;\n }\n\n /**\n * Sign and send a transaction\n *\n * @deprecated Instead, call {@link sendTransaction} with a {@link\n * VersionedTransaction}\n */\n\n /**\n * Send a signed transaction\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Sign and send a transaction\n */\n // eslint-disable-next-line no-dupe-class-members\n async sendTransaction(transaction, signersOrOptions, options) {\n if ('version' in transaction) {\n if (signersOrOptions && Array.isArray(signersOrOptions)) {\n throw new Error('Invalid arguments');\n }\n const wireTransaction = transaction.serialize();\n return await this.sendRawTransaction(wireTransaction, signersOrOptions);\n }\n if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {\n throw new Error('Invalid arguments');\n }\n const signers = signersOrOptions;\n if (transaction.nonceInfo) {\n transaction.sign(...signers);\n } else {\n let disableCache = this._disableBlockhashCaching;\n for (;;) {\n const latestBlockhash = await this._blockhashWithExpiryBlockHeight(disableCache);\n transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;\n transaction.recentBlockhash = latestBlockhash.blockhash;\n transaction.sign(...signers);\n if (!transaction.signature) {\n throw new Error('!signature'); // should never happen\n }\n const signature = transaction.signature.toString('base64');\n if (!this._blockhashInfo.transactionSignatures.includes(signature)) {\n // The signature of this transaction has not been seen before with the\n // current recentBlockhash, all done. Let's break\n this._blockhashInfo.transactionSignatures.push(signature);\n break;\n } else {\n // This transaction would be treated as duplicate (its derived signature\n // matched to one of already recorded signatures).\n // So, we must fetch a new blockhash for a different signature by disabling\n // our cache not to wait for the cache expiration (BLOCKHASH_CACHE_TIMEOUT_MS).\n disableCache = true;\n }\n }\n }\n const wireTransaction = transaction.serialize();\n return await this.sendRawTransaction(wireTransaction, options);\n }\n\n /**\n * Send a transaction that has already been signed and serialized into the\n * wire format\n */\n async sendRawTransaction(rawTransaction, options) {\n const encodedTransaction = toBuffer(rawTransaction).toString('base64');\n const result = await this.sendEncodedTransaction(encodedTransaction, options);\n return result;\n }\n\n /**\n * Send a transaction that has already been signed, serialized into the\n * wire format, and encoded as a base64 string\n */\n async sendEncodedTransaction(encodedTransaction, options) {\n const config = {\n encoding: 'base64'\n };\n const skipPreflight = options && options.skipPreflight;\n const preflightCommitment = skipPreflight === true ? 'processed' // FIXME Remove when https://github.com/anza-xyz/agave/pull/483 is deployed.\n : options && options.preflightCommitment || this.commitment;\n if (options && options.maxRetries != null) {\n config.maxRetries = options.maxRetries;\n }\n if (options && options.minContextSlot != null) {\n config.minContextSlot = options.minContextSlot;\n }\n if (skipPreflight) {\n config.skipPreflight = skipPreflight;\n }\n if (preflightCommitment) {\n config.preflightCommitment = preflightCommitment;\n }\n const args = [encodedTransaction, config];\n const unsafeRes = await this._rpcRequest('sendTransaction', args);\n const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(unsafeRes, SendTransactionRpcResult);\n if ('error' in res) {\n let logs = undefined;\n if ('data' in res.error) {\n logs = res.error.data.logs;\n }\n throw new SendTransactionError({\n action: skipPreflight ? 'send' : 'simulate',\n signature: '',\n transactionMessage: res.error.message,\n logs: logs\n });\n }\n return res.result;\n }\n\n /**\n * @internal\n */\n _wsOnOpen() {\n this._rpcWebSocketConnected = true;\n this._rpcWebSocketHeartbeat = setInterval(() => {\n // Ping server every 5s to prevent idle timeouts\n (async () => {\n try {\n await this._rpcWebSocket.notify('ping');\n // eslint-disable-next-line no-empty\n } catch {}\n })();\n }, 5000);\n this._updateSubscriptions();\n }\n\n /**\n * @internal\n */\n _wsOnError(err) {\n this._rpcWebSocketConnected = false;\n console.error('ws error:', err.message);\n }\n\n /**\n * @internal\n */\n _wsOnClose(code) {\n this._rpcWebSocketConnected = false;\n this._rpcWebSocketGeneration = (this._rpcWebSocketGeneration + 1) % Number.MAX_SAFE_INTEGER;\n if (this._rpcWebSocketIdleTimeout) {\n clearTimeout(this._rpcWebSocketIdleTimeout);\n this._rpcWebSocketIdleTimeout = null;\n }\n if (this._rpcWebSocketHeartbeat) {\n clearInterval(this._rpcWebSocketHeartbeat);\n this._rpcWebSocketHeartbeat = null;\n }\n if (code === 1000) {\n // explicit close, check if any subscriptions have been made since close\n this._updateSubscriptions();\n return;\n }\n\n // implicit close, prepare subscriptions for auto-reconnect\n this._subscriptionCallbacksByServerSubscriptionId = {};\n Object.entries(this._subscriptionsByHash).forEach(([hash, subscription]) => {\n this._setSubscription(hash, {\n ...subscription,\n state: 'pending'\n });\n });\n }\n\n /**\n * @internal\n */\n _setSubscription(hash, nextSubscription) {\n const prevState = this._subscriptionsByHash[hash]?.state;\n this._subscriptionsByHash[hash] = nextSubscription;\n if (prevState !== nextSubscription.state) {\n const stateChangeCallbacks = this._subscriptionStateChangeCallbacksByHash[hash];\n if (stateChangeCallbacks) {\n stateChangeCallbacks.forEach(cb => {\n try {\n cb(nextSubscription.state);\n // eslint-disable-next-line no-empty\n } catch {}\n });\n }\n }\n }\n\n /**\n * @internal\n */\n _onSubscriptionStateChange(clientSubscriptionId, callback) {\n const hash = this._subscriptionHashByClientSubscriptionId[clientSubscriptionId];\n if (hash == null) {\n return () => {};\n }\n const stateChangeCallbacks = this._subscriptionStateChangeCallbacksByHash[hash] ||= new Set();\n stateChangeCallbacks.add(callback);\n return () => {\n stateChangeCallbacks.delete(callback);\n if (stateChangeCallbacks.size === 0) {\n delete this._subscriptionStateChangeCallbacksByHash[hash];\n }\n };\n }\n\n /**\n * @internal\n */\n async _updateSubscriptions() {\n if (Object.keys(this._subscriptionsByHash).length === 0) {\n if (this._rpcWebSocketConnected) {\n this._rpcWebSocketConnected = false;\n this._rpcWebSocketIdleTimeout = setTimeout(() => {\n this._rpcWebSocketIdleTimeout = null;\n try {\n this._rpcWebSocket.close();\n } catch (err) {\n // swallow error if socket has already been closed.\n if (err instanceof Error) {\n console.log(`Error when closing socket connection: ${err.message}`);\n }\n }\n }, 500);\n }\n return;\n }\n if (this._rpcWebSocketIdleTimeout !== null) {\n clearTimeout(this._rpcWebSocketIdleTimeout);\n this._rpcWebSocketIdleTimeout = null;\n this._rpcWebSocketConnected = true;\n }\n if (!this._rpcWebSocketConnected) {\n this._rpcWebSocket.connect();\n return;\n }\n const activeWebSocketGeneration = this._rpcWebSocketGeneration;\n const isCurrentConnectionStillActive = () => {\n return activeWebSocketGeneration === this._rpcWebSocketGeneration;\n };\n await Promise.all(\n // Don't be tempted to change this to `Object.entries`. We call\n // `_updateSubscriptions` recursively when processing the state,\n // so it's important that we look up the *current* version of\n // each subscription, every time we process a hash.\n Object.keys(this._subscriptionsByHash).map(async hash => {\n const subscription = this._subscriptionsByHash[hash];\n if (subscription === undefined) {\n // This entry has since been deleted. Skip.\n return;\n }\n switch (subscription.state) {\n case 'pending':\n case 'unsubscribed':\n if (subscription.callbacks.size === 0) {\n /**\n * You can end up here when:\n *\n * - a subscription has recently unsubscribed\n * without having new callbacks added to it\n * while the unsubscribe was in flight, or\n * - when a pending subscription has its\n * listeners removed before a request was\n * sent to the server.\n *\n * Being that nobody is interested in this\n * subscription any longer, delete it.\n */\n delete this._subscriptionsByHash[hash];\n if (subscription.state === 'unsubscribed') {\n delete this._subscriptionCallbacksByServerSubscriptionId[subscription.serverSubscriptionId];\n }\n await this._updateSubscriptions();\n return;\n }\n await (async () => {\n const {\n args,\n method\n } = subscription;\n try {\n this._setSubscription(hash, {\n ...subscription,\n state: 'subscribing'\n });\n const serverSubscriptionId = await this._rpcWebSocket.call(method, args);\n this._setSubscription(hash, {\n ...subscription,\n serverSubscriptionId,\n state: 'subscribed'\n });\n this._subscriptionCallbacksByServerSubscriptionId[serverSubscriptionId] = subscription.callbacks;\n await this._updateSubscriptions();\n } catch (e) {\n if (e instanceof Error) {\n console.error(`${method} error for argument`, args, e.message);\n }\n if (!isCurrentConnectionStillActive()) {\n return;\n }\n // TODO: Maybe add an 'errored' state or a retry limit?\n this._setSubscription(hash, {\n ...subscription,\n state: 'pending'\n });\n await this._updateSubscriptions();\n }\n })();\n break;\n case 'subscribed':\n if (subscription.callbacks.size === 0) {\n // By the time we successfully set up a subscription\n // with the server, the client stopped caring about it.\n // Tear it down now.\n await (async () => {\n const {\n serverSubscriptionId,\n unsubscribeMethod\n } = subscription;\n if (this._subscriptionsAutoDisposedByRpc.has(serverSubscriptionId)) {\n /**\n * Special case.\n * If we're dealing with a subscription that has been auto-\n * disposed by the RPC, then we can skip the RPC call to\n * tear down the subscription here.\n *\n * NOTE: There is a proposal to eliminate this special case, here:\n * https://github.com/solana-labs/solana/issues/18892\n */\n this._subscriptionsAutoDisposedByRpc.delete(serverSubscriptionId);\n } else {\n this._setSubscription(hash, {\n ...subscription,\n state: 'unsubscribing'\n });\n this._setSubscription(hash, {\n ...subscription,\n state: 'unsubscribing'\n });\n try {\n await this._rpcWebSocket.call(unsubscribeMethod, [serverSubscriptionId]);\n } catch (e) {\n if (e instanceof Error) {\n console.error(`${unsubscribeMethod} error:`, e.message);\n }\n if (!isCurrentConnectionStillActive()) {\n return;\n }\n // TODO: Maybe add an 'errored' state or a retry limit?\n this._setSubscription(hash, {\n ...subscription,\n state: 'subscribed'\n });\n await this._updateSubscriptions();\n return;\n }\n }\n this._setSubscription(hash, {\n ...subscription,\n state: 'unsubscribed'\n });\n await this._updateSubscriptions();\n })();\n }\n break;\n }\n }));\n }\n\n /**\n * @internal\n */\n _handleServerNotification(serverSubscriptionId, callbackArgs) {\n const callbacks = this._subscriptionCallbacksByServerSubscriptionId[serverSubscriptionId];\n if (callbacks === undefined) {\n return;\n }\n callbacks.forEach(cb => {\n try {\n cb(\n // I failed to find a way to convince TypeScript that `cb` is of type\n // `TCallback` which is certainly compatible with `Parameters`.\n // See https://github.com/microsoft/TypeScript/issues/47615\n // @ts-ignore\n ...callbackArgs);\n } catch (e) {\n console.error(e);\n }\n });\n }\n\n /**\n * @internal\n */\n _wsOnAccountNotification(notification) {\n const {\n result,\n subscription\n } = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(notification, AccountNotificationResult);\n this._handleServerNotification(subscription, [result.value, result.context]);\n }\n\n /**\n * @internal\n */\n _makeSubscription(subscriptionConfig,\n /**\n * When preparing `args` for a call to `_makeSubscription`, be sure\n * to carefully apply a default `commitment` property, if necessary.\n *\n * - If the user supplied a `commitment` use that.\n * - Otherwise, if the `Connection::commitment` is set, use that.\n * - Otherwise, set it to the RPC server default: `finalized`.\n *\n * This is extremely important to ensure that these two fundamentally\n * identical subscriptions produce the same identifying hash:\n *\n * - A subscription made without specifying a commitment.\n * - A subscription made where the commitment specified is the same\n * as the default applied to the subscription above.\n *\n * Example; these two subscriptions must produce the same hash:\n *\n * - An `accountSubscribe` subscription for `'PUBKEY'`\n * - An `accountSubscribe` subscription for `'PUBKEY'` with commitment\n * `'finalized'`.\n *\n * See the 'making a subscription with defaulted params omitted' test\n * in `connection-subscriptions.ts` for more.\n */\n args) {\n const clientSubscriptionId = this._nextClientSubscriptionId++;\n const hash = fastStableStringify$1([subscriptionConfig.method, args]);\n const existingSubscription = this._subscriptionsByHash[hash];\n if (existingSubscription === undefined) {\n this._subscriptionsByHash[hash] = {\n ...subscriptionConfig,\n args,\n callbacks: new Set([subscriptionConfig.callback]),\n state: 'pending'\n };\n } else {\n existingSubscription.callbacks.add(subscriptionConfig.callback);\n }\n this._subscriptionHashByClientSubscriptionId[clientSubscriptionId] = hash;\n this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId] = async () => {\n delete this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId];\n delete this._subscriptionHashByClientSubscriptionId[clientSubscriptionId];\n const subscription = this._subscriptionsByHash[hash];\n assert(subscription !== undefined, `Could not find a \\`Subscription\\` when tearing down client subscription #${clientSubscriptionId}`);\n subscription.callbacks.delete(subscriptionConfig.callback);\n await this._updateSubscriptions();\n };\n this._updateSubscriptions();\n return clientSubscriptionId;\n }\n\n /**\n * Register a callback to be invoked whenever the specified account changes\n *\n * @param publicKey Public key of the account to monitor\n * @param callback Function to invoke whenever the account is changed\n * @param config\n * @return subscription id\n */\n\n /** @deprecated Instead, pass in an {@link AccountSubscriptionConfig} */\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n onAccountChange(publicKey, callback, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment || this._commitment || 'finalized',\n // Apply connection/server default.\n 'base64', config);\n return this._makeSubscription({\n callback,\n method: 'accountSubscribe',\n unsubscribeMethod: 'accountUnsubscribe'\n }, args);\n }\n\n /**\n * Deregister an account notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeAccountChangeListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'account change');\n }\n\n /**\n * @internal\n */\n _wsOnProgramAccountNotification(notification) {\n const {\n result,\n subscription\n } = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(notification, ProgramAccountNotificationResult);\n this._handleServerNotification(subscription, [{\n accountId: result.value.pubkey,\n accountInfo: result.value.account\n }, result.context]);\n }\n\n /**\n * Register a callback to be invoked whenever accounts owned by the\n * specified program change\n *\n * @param programId Public key of the program to monitor\n * @param callback Function to invoke whenever the account is changed\n * @param config\n * @return subscription id\n */\n\n /** @deprecated Instead, pass in a {@link ProgramAccountSubscriptionConfig} */\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n onProgramAccountChange(programId, callback, commitmentOrConfig, maybeFilters) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([programId.toBase58()], commitment || this._commitment || 'finalized',\n // Apply connection/server default.\n 'base64' /* encoding */, config ? config : maybeFilters ? {\n filters: applyDefaultMemcmpEncodingToFilters(maybeFilters)\n } : undefined /* extra */);\n return this._makeSubscription({\n callback,\n method: 'programSubscribe',\n unsubscribeMethod: 'programUnsubscribe'\n }, args);\n }\n\n /**\n * Deregister an account notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeProgramAccountChangeListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'program account change');\n }\n\n /**\n * Registers a callback to be invoked whenever logs are emitted.\n */\n onLogs(filter, callback, commitment) {\n const args = this._buildArgs([typeof filter === 'object' ? {\n mentions: [filter.toString()]\n } : filter], commitment || this._commitment || 'finalized' // Apply connection/server default.\n );\n return this._makeSubscription({\n callback,\n method: 'logsSubscribe',\n unsubscribeMethod: 'logsUnsubscribe'\n }, args);\n }\n\n /**\n * Deregister a logs callback.\n *\n * @param clientSubscriptionId client subscription id to deregister.\n */\n async removeOnLogsListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'logs');\n }\n\n /**\n * @internal\n */\n _wsOnLogsNotification(notification) {\n const {\n result,\n subscription\n } = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(notification, LogsNotificationResult);\n this._handleServerNotification(subscription, [result.value, result.context]);\n }\n\n /**\n * @internal\n */\n _wsOnSlotNotification(notification) {\n const {\n result,\n subscription\n } = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(notification, SlotNotificationResult);\n this._handleServerNotification(subscription, [result]);\n }\n\n /**\n * Register a callback to be invoked upon slot changes\n *\n * @param callback Function to invoke whenever the slot changes\n * @return subscription id\n */\n onSlotChange(callback) {\n return this._makeSubscription({\n callback,\n method: 'slotSubscribe',\n unsubscribeMethod: 'slotUnsubscribe'\n }, [] /* args */);\n }\n\n /**\n * Deregister a slot notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeSlotChangeListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot change');\n }\n\n /**\n * @internal\n */\n _wsOnSlotUpdatesNotification(notification) {\n const {\n result,\n subscription\n } = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(notification, SlotUpdateNotificationResult);\n this._handleServerNotification(subscription, [result]);\n }\n\n /**\n * Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s\n * may be useful to track live progress of a cluster.\n *\n * @param callback Function to invoke whenever the slot updates\n * @return subscription id\n */\n onSlotUpdate(callback) {\n return this._makeSubscription({\n callback,\n method: 'slotsUpdatesSubscribe',\n unsubscribeMethod: 'slotsUpdatesUnsubscribe'\n }, [] /* args */);\n }\n\n /**\n * Deregister a slot update notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeSlotUpdateListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot update');\n }\n\n /**\n * @internal\n */\n\n async _unsubscribeClientSubscription(clientSubscriptionId, subscriptionName) {\n const dispose = this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId];\n if (dispose) {\n await dispose();\n } else {\n console.warn('Ignored unsubscribe request because an active subscription with id ' + `\\`${clientSubscriptionId}\\` for '${subscriptionName}' events ` + 'could not be found.');\n }\n }\n _buildArgs(args, override, encoding, extra) {\n const commitment = override || this._commitment;\n if (commitment || encoding || extra) {\n let options = {};\n if (encoding) {\n options.encoding = encoding;\n }\n if (commitment) {\n options.commitment = commitment;\n }\n if (extra) {\n options = Object.assign(options, extra);\n }\n args.push(options);\n }\n return args;\n }\n\n /**\n * @internal\n */\n _buildArgsAtLeastConfirmed(args, override, encoding, extra) {\n const commitment = override || this._commitment;\n if (commitment && !['confirmed', 'finalized'].includes(commitment)) {\n throw new Error('Using Connection with default commitment: `' + this._commitment + '`, but method requires at least `confirmed`');\n }\n return this._buildArgs(args, override, encoding, extra);\n }\n\n /**\n * @internal\n */\n _wsOnSignatureNotification(notification) {\n const {\n result,\n subscription\n } = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(notification, SignatureNotificationResult);\n if (result.value !== 'receivedSignature') {\n /**\n * Special case.\n * After a signature is processed, RPCs automatically dispose of the\n * subscription on the server side. We need to track which of these\n * subscriptions have been disposed in such a way, so that we know\n * whether the client is dealing with a not-yet-processed signature\n * (in which case we must tear down the server subscription) or an\n * already-processed signature (in which case the client can simply\n * clear out the subscription locally without telling the server).\n *\n * NOTE: There is a proposal to eliminate this special case, here:\n * https://github.com/solana-labs/solana/issues/18892\n */\n this._subscriptionsAutoDisposedByRpc.add(subscription);\n }\n this._handleServerNotification(subscription, result.value === 'receivedSignature' ? [{\n type: 'received'\n }, result.context] : [{\n type: 'status',\n result: result.value\n }, result.context]);\n }\n\n /**\n * Register a callback to be invoked upon signature updates\n *\n * @param signature Transaction signature string in base 58\n * @param callback Function to invoke on signature notifications\n * @param commitment Specify the commitment level signature must reach before notification\n * @return subscription id\n */\n onSignature(signature, callback, commitment) {\n const args = this._buildArgs([signature], commitment || this._commitment || 'finalized' // Apply connection/server default.\n );\n const clientSubscriptionId = this._makeSubscription({\n callback: (notification, context) => {\n if (notification.type === 'status') {\n callback(notification.result, context);\n // Signatures subscriptions are auto-removed by the RPC service\n // so no need to explicitly send an unsubscribe message.\n try {\n this.removeSignatureListener(clientSubscriptionId);\n // eslint-disable-next-line no-empty\n } catch (_err) {\n // Already removed.\n }\n }\n },\n method: 'signatureSubscribe',\n unsubscribeMethod: 'signatureUnsubscribe'\n }, args);\n return clientSubscriptionId;\n }\n\n /**\n * Register a callback to be invoked when a transaction is\n * received and/or processed.\n *\n * @param signature Transaction signature string in base 58\n * @param callback Function to invoke on signature notifications\n * @param options Enable received notifications and set the commitment\n * level that signature must reach before notification\n * @return subscription id\n */\n onSignatureWithOptions(signature, callback, options) {\n const {\n commitment,\n ...extra\n } = {\n ...options,\n commitment: options && options.commitment || this._commitment || 'finalized' // Apply connection/server default.\n };\n const args = this._buildArgs([signature], commitment, undefined /* encoding */, extra);\n const clientSubscriptionId = this._makeSubscription({\n callback: (notification, context) => {\n callback(notification, context);\n // Signatures subscriptions are auto-removed by the RPC service\n // so no need to explicitly send an unsubscribe message.\n try {\n this.removeSignatureListener(clientSubscriptionId);\n // eslint-disable-next-line no-empty\n } catch (_err) {\n // Already removed.\n }\n },\n method: 'signatureSubscribe',\n unsubscribeMethod: 'signatureUnsubscribe'\n }, args);\n return clientSubscriptionId;\n }\n\n /**\n * Deregister a signature notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeSignatureListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'signature result');\n }\n\n /**\n * @internal\n */\n _wsOnRootNotification(notification) {\n const {\n result,\n subscription\n } = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.create)(notification, RootNotificationResult);\n this._handleServerNotification(subscription, [result]);\n }\n\n /**\n * Register a callback to be invoked upon root changes\n *\n * @param callback Function to invoke whenever the root changes\n * @return subscription id\n */\n onRootChange(callback) {\n return this._makeSubscription({\n callback,\n method: 'rootSubscribe',\n unsubscribeMethod: 'rootUnsubscribe'\n }, [] /* args */);\n }\n\n /**\n * Deregister a root notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeRootChangeListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'root change');\n }\n}\n\n/**\n * Keypair signer interface\n */\n\n/**\n * An account keypair used for signing transactions.\n */\nclass Keypair {\n /**\n * Create a new keypair instance.\n * Generate random keypair if no {@link Ed25519Keypair} is provided.\n *\n * @param {Ed25519Keypair} keypair ed25519 keypair\n */\n constructor(keypair) {\n this._keypair = void 0;\n this._keypair = keypair ?? generateKeypair();\n }\n\n /**\n * Generate a new random keypair\n *\n * @returns {Keypair} Keypair\n */\n static generate() {\n return new Keypair(generateKeypair());\n }\n\n /**\n * Create a keypair from a raw secret key byte array.\n *\n * This method should only be used to recreate a keypair from a previously\n * generated secret key. Generating keypairs from a random seed should be done\n * with the {@link Keypair.fromSeed} method.\n *\n * @throws error if the provided secret key is invalid and validation is not skipped.\n *\n * @param secretKey secret key byte array\n * @param options skip secret key validation\n *\n * @returns {Keypair} Keypair\n */\n static fromSecretKey(secretKey, options) {\n if (secretKey.byteLength !== 64) {\n throw new Error('bad secret key size');\n }\n const publicKey = secretKey.slice(32, 64);\n if (!options || !options.skipValidation) {\n const privateScalar = secretKey.slice(0, 32);\n const computedPublicKey = getPublicKey(privateScalar);\n for (let ii = 0; ii < 32; ii++) {\n if (publicKey[ii] !== computedPublicKey[ii]) {\n throw new Error('provided secretKey is invalid');\n }\n }\n }\n return new Keypair({\n publicKey,\n secretKey\n });\n }\n\n /**\n * Generate a keypair from a 32 byte seed.\n *\n * @param seed seed byte array\n *\n * @returns {Keypair} Keypair\n */\n static fromSeed(seed) {\n const publicKey = getPublicKey(seed);\n const secretKey = new Uint8Array(64);\n secretKey.set(seed);\n secretKey.set(publicKey, 32);\n return new Keypair({\n publicKey,\n secretKey\n });\n }\n\n /**\n * The public key for this keypair\n *\n * @returns {PublicKey} PublicKey\n */\n get publicKey() {\n return new PublicKey(this._keypair.publicKey);\n }\n\n /**\n * The raw secret key for this keypair\n * @returns {Uint8Array} Secret key in an array of Uint8 bytes\n */\n get secretKey() {\n return new Uint8Array(this._keypair.secretKey);\n }\n}\n\n/**\n * An enumeration of valid LookupTableInstructionType's\n */\n\n/**\n * An enumeration of valid address lookup table InstructionType's\n * @internal\n */\nconst LOOKUP_TABLE_INSTRUCTION_LAYOUTS = Object.freeze({\n CreateLookupTable: {\n index: 0,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), u64('recentSlot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('bumpSeed')])\n },\n FreezeLookupTable: {\n index: 1,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n },\n ExtendLookupTable: {\n index: 2,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), u64(), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(publicKey(), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32(), -8), 'addresses')])\n },\n DeactivateLookupTable: {\n index: 3,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n },\n CloseLookupTable: {\n index: 4,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n }\n});\nclass AddressLookupTableInstruction {\n /**\n * @internal\n */\n constructor() {}\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction');\n const index = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [layoutType, layout] of Object.entries(LOOKUP_TABLE_INSTRUCTION_LAYOUTS)) {\n if (layout.index == index) {\n type = layoutType;\n break;\n }\n }\n if (!type) {\n throw new Error('Invalid Instruction. Should be a LookupTable Instruction');\n }\n return type;\n }\n static decodeCreateLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeysLength(instruction.keys, 4);\n const {\n recentSlot\n } = decodeData$1(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable, instruction.data);\n return {\n authority: instruction.keys[1].pubkey,\n payer: instruction.keys[2].pubkey,\n recentSlot: Number(recentSlot)\n };\n }\n static decodeExtendLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n if (instruction.keys.length < 2) {\n throw new Error(`invalid instruction; found ${instruction.keys.length} keys, expected at least 2`);\n }\n const {\n addresses\n } = decodeData$1(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable, instruction.data);\n return {\n lookupTable: instruction.keys[0].pubkey,\n authority: instruction.keys[1].pubkey,\n payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : undefined,\n addresses: addresses.map(buffer => new PublicKey(buffer))\n };\n }\n static decodeCloseLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeysLength(instruction.keys, 3);\n return {\n lookupTable: instruction.keys[0].pubkey,\n authority: instruction.keys[1].pubkey,\n recipient: instruction.keys[2].pubkey\n };\n }\n static decodeFreezeLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeysLength(instruction.keys, 2);\n return {\n lookupTable: instruction.keys[0].pubkey,\n authority: instruction.keys[1].pubkey\n };\n }\n static decodeDeactivateLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeysLength(instruction.keys, 2);\n return {\n lookupTable: instruction.keys[0].pubkey,\n authority: instruction.keys[1].pubkey\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(AddressLookupTableProgram.programId)) {\n throw new Error('invalid instruction; programId is not AddressLookupTable Program');\n }\n }\n /**\n * @internal\n */\n static checkKeysLength(keys, expectedLength) {\n if (keys.length < expectedLength) {\n throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);\n }\n }\n}\nclass AddressLookupTableProgram {\n /**\n * @internal\n */\n constructor() {}\n static createLookupTable(params) {\n const [lookupTableAddress, bumpSeed] = PublicKey.findProgramAddressSync([params.authority.toBuffer(), (0,bigint_buffer__WEBPACK_IMPORTED_MODULE_5__.toBufferLE)(BigInt(params.recentSlot), 8)], this.programId);\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;\n const data = encodeData(type, {\n recentSlot: BigInt(params.recentSlot),\n bumpSeed: bumpSeed\n });\n const keys = [{\n pubkey: lookupTableAddress,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: params.payer,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: SystemProgram.programId,\n isSigner: false,\n isWritable: false\n }];\n return [new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n }), lookupTableAddress];\n }\n static freezeLookupTable(params) {\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.FreezeLookupTable;\n const data = encodeData(type);\n const keys = [{\n pubkey: params.lookupTable,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }];\n return new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n });\n }\n static extendLookupTable(params) {\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable;\n const data = encodeData(type, {\n addresses: params.addresses.map(addr => addr.toBytes())\n });\n const keys = [{\n pubkey: params.lookupTable,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }];\n if (params.payer) {\n keys.push({\n pubkey: params.payer,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: SystemProgram.programId,\n isSigner: false,\n isWritable: false\n });\n }\n return new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n });\n }\n static deactivateLookupTable(params) {\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.DeactivateLookupTable;\n const data = encodeData(type);\n const keys = [{\n pubkey: params.lookupTable,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }];\n return new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n });\n }\n static closeLookupTable(params) {\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CloseLookupTable;\n const data = encodeData(type);\n const keys = [{\n pubkey: params.lookupTable,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: params.recipient,\n isSigner: false,\n isWritable: true\n }];\n return new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n });\n }\n}\nAddressLookupTableProgram.programId = new PublicKey('AddressLookupTab1e1111111111111111111111111');\n\n/**\n * Compute Budget Instruction class\n */\nclass ComputeBudgetInstruction {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Decode a compute budget instruction and retrieve the instruction type.\n */\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [ixType, layout] of Object.entries(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS)) {\n if (layout.index == typeIndex) {\n type = ixType;\n break;\n }\n }\n if (!type) {\n throw new Error('Instruction type incorrect; not a ComputeBudgetInstruction');\n }\n return type;\n }\n\n /**\n * Decode request units compute budget instruction and retrieve the instruction params.\n */\n static decodeRequestUnits(instruction) {\n this.checkProgramId(instruction.programId);\n const {\n units,\n additionalFee\n } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits, instruction.data);\n return {\n units,\n additionalFee\n };\n }\n\n /**\n * Decode request heap frame compute budget instruction and retrieve the instruction params.\n */\n static decodeRequestHeapFrame(instruction) {\n this.checkProgramId(instruction.programId);\n const {\n bytes\n } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame, instruction.data);\n return {\n bytes\n };\n }\n\n /**\n * Decode set compute unit limit compute budget instruction and retrieve the instruction params.\n */\n static decodeSetComputeUnitLimit(instruction) {\n this.checkProgramId(instruction.programId);\n const {\n units\n } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit, instruction.data);\n return {\n units\n };\n }\n\n /**\n * Decode set compute unit price compute budget instruction and retrieve the instruction params.\n */\n static decodeSetComputeUnitPrice(instruction) {\n this.checkProgramId(instruction.programId);\n const {\n microLamports\n } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice, instruction.data);\n return {\n microLamports\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(ComputeBudgetProgram.programId)) {\n throw new Error('invalid instruction; programId is not ComputeBudgetProgram');\n }\n }\n}\n\n/**\n * An enumeration of valid ComputeBudgetInstructionType's\n */\n\n/**\n * Request units instruction params\n */\n\n/**\n * Request heap frame instruction params\n */\n\n/**\n * Set compute unit limit instruction params\n */\n\n/**\n * Set compute unit price instruction params\n */\n\n/**\n * An enumeration of valid ComputeBudget InstructionType's\n * @internal\n */\nconst COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = Object.freeze({\n RequestUnits: {\n index: 0,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('units'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('additionalFee')])\n },\n RequestHeapFrame: {\n index: 1,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('bytes')])\n },\n SetComputeUnitLimit: {\n index: 2,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('units')])\n },\n SetComputeUnitPrice: {\n index: 3,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('instruction'), u64('microLamports')])\n }\n});\n\n/**\n * Factory class for transaction instructions to interact with the Compute Budget program\n */\nclass ComputeBudgetProgram {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the Compute Budget program\n */\n\n /**\n * @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}\n */\n static requestUnits(params) {\n const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;\n const data = encodeData(type, params);\n return new TransactionInstruction({\n keys: [],\n programId: this.programId,\n data\n });\n }\n static requestHeapFrame(params) {\n const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame;\n const data = encodeData(type, params);\n return new TransactionInstruction({\n keys: [],\n programId: this.programId,\n data\n });\n }\n static setComputeUnitLimit(params) {\n const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;\n const data = encodeData(type, params);\n return new TransactionInstruction({\n keys: [],\n programId: this.programId,\n data\n });\n }\n static setComputeUnitPrice(params) {\n const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice;\n const data = encodeData(type, {\n microLamports: BigInt(params.microLamports)\n });\n return new TransactionInstruction({\n keys: [],\n programId: this.programId,\n data\n });\n }\n}\nComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111');\n\nconst PRIVATE_KEY_BYTES$1 = 64;\nconst PUBLIC_KEY_BYTES$1 = 32;\nconst SIGNATURE_BYTES = 64;\n\n/**\n * Params for creating an ed25519 instruction using a public key\n */\n\n/**\n * Params for creating an ed25519 instruction using a private key\n */\n\nconst ED25519_INSTRUCTION_LAYOUT = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('numSignatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('padding'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('signatureOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('signatureInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('publicKeyOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('publicKeyInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('messageDataOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('messageDataSize'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('messageInstructionIndex')]);\nclass Ed25519Program {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the ed25519 program\n */\n\n /**\n * Create an ed25519 instruction with a public key and signature. The\n * public key must be a buffer that is 32 bytes long, and the signature\n * must be a buffer of 64 bytes.\n */\n static createInstructionWithPublicKey(params) {\n const {\n publicKey,\n message,\n signature,\n instructionIndex\n } = params;\n assert(publicKey.length === PUBLIC_KEY_BYTES$1, `Public Key must be ${PUBLIC_KEY_BYTES$1} bytes but received ${publicKey.length} bytes`);\n assert(signature.length === SIGNATURE_BYTES, `Signature must be ${SIGNATURE_BYTES} bytes but received ${signature.length} bytes`);\n const publicKeyOffset = ED25519_INSTRUCTION_LAYOUT.span;\n const signatureOffset = publicKeyOffset + publicKey.length;\n const messageDataOffset = signatureOffset + signature.length;\n const numSignatures = 1;\n const instructionData = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(messageDataOffset + message.length);\n const index = instructionIndex == null ? 0xffff // An index of `u16::MAX` makes it default to the current instruction.\n : instructionIndex;\n ED25519_INSTRUCTION_LAYOUT.encode({\n numSignatures,\n padding: 0,\n signatureOffset,\n signatureInstructionIndex: index,\n publicKeyOffset,\n publicKeyInstructionIndex: index,\n messageDataOffset,\n messageDataSize: message.length,\n messageInstructionIndex: index\n }, instructionData);\n instructionData.fill(publicKey, publicKeyOffset);\n instructionData.fill(signature, signatureOffset);\n instructionData.fill(message, messageDataOffset);\n return new TransactionInstruction({\n keys: [],\n programId: Ed25519Program.programId,\n data: instructionData\n });\n }\n\n /**\n * Create an ed25519 instruction with a private key. The private key\n * must be a buffer that is 64 bytes long.\n */\n static createInstructionWithPrivateKey(params) {\n const {\n privateKey,\n message,\n instructionIndex\n } = params;\n assert(privateKey.length === PRIVATE_KEY_BYTES$1, `Private key must be ${PRIVATE_KEY_BYTES$1} bytes but received ${privateKey.length} bytes`);\n try {\n const keypair = Keypair.fromSecretKey(privateKey);\n const publicKey = keypair.publicKey.toBytes();\n const signature = sign(message, keypair.secretKey);\n return this.createInstructionWithPublicKey({\n publicKey,\n message,\n signature,\n instructionIndex\n });\n } catch (error) {\n throw new Error(`Error creating instruction; ${error}`);\n }\n }\n}\nEd25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');\n\nconst ecdsaSign = (msgHash, privKey) => {\n const signature = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_11__.secp256k1.sign(msgHash, privKey);\n return [signature.toCompactRawBytes(), signature.recovery];\n};\n_noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_11__.secp256k1.utils.isValidPrivateKey;\nconst publicKeyCreate = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_11__.secp256k1.getPublicKey;\n\nconst PRIVATE_KEY_BYTES = 32;\nconst ETHEREUM_ADDRESS_BYTES = 20;\nconst PUBLIC_KEY_BYTES = 64;\nconst SIGNATURE_OFFSETS_SERIALIZED_SIZE = 11;\n\n/**\n * Params for creating an secp256k1 instruction using a public key\n */\n\n/**\n * Params for creating an secp256k1 instruction using an Ethereum address\n */\n\n/**\n * Params for creating an secp256k1 instruction using a private key\n */\n\nconst SECP256K1_INSTRUCTION_LAYOUT = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('numSignatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('signatureOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('signatureInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('ethAddressOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('ethAddressInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('messageDataOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u16('messageDataSize'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('messageInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(20, 'ethAddress'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.blob(64, 'signature'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('recoveryId')]);\nclass Secp256k1Program {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the secp256k1 program\n */\n\n /**\n * Construct an Ethereum address from a secp256k1 public key buffer.\n * @param {Buffer} publicKey a 64 byte secp256k1 public key buffer\n */\n static publicKeyToEthAddress(publicKey) {\n assert(publicKey.length === PUBLIC_KEY_BYTES, `Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey.length} bytes`);\n try {\n return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from((0,_noble_hashes_sha3__WEBPACK_IMPORTED_MODULE_12__.keccak_256)(toBuffer(publicKey))).slice(-ETHEREUM_ADDRESS_BYTES);\n } catch (error) {\n throw new Error(`Error constructing Ethereum address: ${error}`);\n }\n }\n\n /**\n * Create an secp256k1 instruction with a public key. The public key\n * must be a buffer that is 64 bytes long.\n */\n static createInstructionWithPublicKey(params) {\n const {\n publicKey,\n message,\n signature,\n recoveryId,\n instructionIndex\n } = params;\n return Secp256k1Program.createInstructionWithEthAddress({\n ethAddress: Secp256k1Program.publicKeyToEthAddress(publicKey),\n message,\n signature,\n recoveryId,\n instructionIndex\n });\n }\n\n /**\n * Create an secp256k1 instruction with an Ethereum address. The address\n * must be a hex string or a buffer that is 20 bytes long.\n */\n static createInstructionWithEthAddress(params) {\n const {\n ethAddress: rawAddress,\n message,\n signature,\n recoveryId,\n instructionIndex = 0\n } = params;\n let ethAddress;\n if (typeof rawAddress === 'string') {\n if (rawAddress.startsWith('0x')) {\n ethAddress = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(rawAddress.substr(2), 'hex');\n } else {\n ethAddress = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(rawAddress, 'hex');\n }\n } else {\n ethAddress = rawAddress;\n }\n assert(ethAddress.length === ETHEREUM_ADDRESS_BYTES, `Address must be ${ETHEREUM_ADDRESS_BYTES} bytes but received ${ethAddress.length} bytes`);\n const dataStart = 1 + SIGNATURE_OFFSETS_SERIALIZED_SIZE;\n const ethAddressOffset = dataStart;\n const signatureOffset = dataStart + ethAddress.length;\n const messageDataOffset = signatureOffset + signature.length + 1;\n const numSignatures = 1;\n const instructionData = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(SECP256K1_INSTRUCTION_LAYOUT.span + message.length);\n SECP256K1_INSTRUCTION_LAYOUT.encode({\n numSignatures,\n signatureOffset,\n signatureInstructionIndex: instructionIndex,\n ethAddressOffset,\n ethAddressInstructionIndex: instructionIndex,\n messageDataOffset,\n messageDataSize: message.length,\n messageInstructionIndex: instructionIndex,\n signature: toBuffer(signature),\n ethAddress: toBuffer(ethAddress),\n recoveryId\n }, instructionData);\n instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span);\n return new TransactionInstruction({\n keys: [],\n programId: Secp256k1Program.programId,\n data: instructionData\n });\n }\n\n /**\n * Create an secp256k1 instruction with a private key. The private key\n * must be a buffer that is 32 bytes long.\n */\n static createInstructionWithPrivateKey(params) {\n const {\n privateKey: pkey,\n message,\n instructionIndex\n } = params;\n assert(pkey.length === PRIVATE_KEY_BYTES, `Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`);\n try {\n const privateKey = toBuffer(pkey);\n const publicKey = publicKeyCreate(privateKey, false /* isCompressed */).slice(1); // throw away leading byte\n const messageHash = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from((0,_noble_hashes_sha3__WEBPACK_IMPORTED_MODULE_12__.keccak_256)(toBuffer(message)));\n const [signature, recoveryId] = ecdsaSign(messageHash, privateKey);\n return this.createInstructionWithPublicKey({\n publicKey,\n message,\n signature,\n recoveryId,\n instructionIndex\n });\n } catch (error) {\n throw new Error(`Error creating instruction; ${error}`);\n }\n }\n}\nSecp256k1Program.programId = new PublicKey('KeccakSecp256k11111111111111111111111111111');\n\nvar _Lockup;\n\n/**\n * Address of the stake config account which configures the rate\n * of stake warmup and cooldown as well as the slashing penalty.\n */\nconst STAKE_CONFIG_ID = new PublicKey('StakeConfig11111111111111111111111111111111');\n\n/**\n * Stake account authority info\n */\nclass Authorized {\n /**\n * Create a new Authorized object\n * @param staker the stake authority\n * @param withdrawer the withdraw authority\n */\n constructor(staker, withdrawer) {\n /** stake authority */\n this.staker = void 0;\n /** withdraw authority */\n this.withdrawer = void 0;\n this.staker = staker;\n this.withdrawer = withdrawer;\n }\n}\n/**\n * Stake account lockup info\n */\nclass Lockup {\n /**\n * Create a new Lockup object\n */\n constructor(unixTimestamp, epoch, custodian) {\n /** Unix timestamp of lockup expiration */\n this.unixTimestamp = void 0;\n /** Epoch of lockup expiration */\n this.epoch = void 0;\n /** Lockup custodian authority */\n this.custodian = void 0;\n this.unixTimestamp = unixTimestamp;\n this.epoch = epoch;\n this.custodian = custodian;\n }\n\n /**\n * Default, inactive Lockup value\n */\n}\n_Lockup = Lockup;\nLockup.default = new _Lockup(0, 0, PublicKey.default);\n/**\n * Create stake account transaction params\n */\n/**\n * Create stake account with seed transaction params\n */\n/**\n * Initialize stake instruction params\n */\n/**\n * Delegate stake instruction params\n */\n/**\n * Authorize stake instruction params\n */\n/**\n * Authorize stake instruction params using a derived key\n */\n/**\n * Split stake instruction params\n */\n/**\n * Split with seed transaction params\n */\n/**\n * Withdraw stake instruction params\n */\n/**\n * Deactivate stake instruction params\n */\n/**\n * Merge stake instruction params\n */\n/**\n * Stake Instruction class\n */\nclass StakeInstruction {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Decode a stake instruction and retrieve the instruction type.\n */\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [ixType, layout] of Object.entries(STAKE_INSTRUCTION_LAYOUTS)) {\n if (layout.index == typeIndex) {\n type = ixType;\n break;\n }\n }\n if (!type) {\n throw new Error('Instruction type incorrect; not a StakeInstruction');\n }\n return type;\n }\n\n /**\n * Decode a initialize stake instruction and retrieve the instruction params.\n */\n static decodeInitialize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n authorized,\n lockup\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n authorized: new Authorized(new PublicKey(authorized.staker), new PublicKey(authorized.withdrawer)),\n lockup: new Lockup(lockup.unixTimestamp, lockup.epoch, new PublicKey(lockup.custodian))\n };\n }\n\n /**\n * Decode a delegate stake instruction and retrieve the instruction params.\n */\n static decodeDelegate(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 6);\n decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Delegate, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n votePubkey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[5].pubkey\n };\n }\n\n /**\n * Decode an authorize stake instruction and retrieve the instruction params.\n */\n static decodeAuthorize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n newAuthorized,\n stakeAuthorizationType\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Authorize, instruction.data);\n const o = {\n stakePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey,\n newAuthorizedPubkey: new PublicKey(newAuthorized),\n stakeAuthorizationType: {\n index: stakeAuthorizationType\n }\n };\n if (instruction.keys.length > 3) {\n o.custodianPubkey = instruction.keys[3].pubkey;\n }\n return o;\n }\n\n /**\n * Decode an authorize-with-seed stake instruction and retrieve the instruction params.\n */\n static decodeAuthorizeWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n newAuthorized,\n stakeAuthorizationType,\n authoritySeed,\n authorityOwner\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);\n const o = {\n stakePubkey: instruction.keys[0].pubkey,\n authorityBase: instruction.keys[1].pubkey,\n authoritySeed: authoritySeed,\n authorityOwner: new PublicKey(authorityOwner),\n newAuthorizedPubkey: new PublicKey(newAuthorized),\n stakeAuthorizationType: {\n index: stakeAuthorizationType\n }\n };\n if (instruction.keys.length > 3) {\n o.custodianPubkey = instruction.keys[3].pubkey;\n }\n return o;\n }\n\n /**\n * Decode a split stake instruction and retrieve the instruction params.\n */\n static decodeSplit(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n lamports\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Split, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n splitStakePubkey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey,\n lamports\n };\n }\n\n /**\n * Decode a merge stake instruction and retrieve the instruction params.\n */\n static decodeMerge(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Merge, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n sourceStakePubKey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[4].pubkey\n };\n }\n\n /**\n * Decode a withdraw stake instruction and retrieve the instruction params.\n */\n static decodeWithdraw(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 5);\n const {\n lamports\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Withdraw, instruction.data);\n const o = {\n stakePubkey: instruction.keys[0].pubkey,\n toPubkey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[4].pubkey,\n lamports\n };\n if (instruction.keys.length > 5) {\n o.custodianPubkey = instruction.keys[5].pubkey;\n }\n return o;\n }\n\n /**\n * Decode a deactivate stake instruction and retrieve the instruction params.\n */\n static decodeDeactivate(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Deactivate, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(StakeProgram.programId)) {\n throw new Error('invalid instruction; programId is not StakeProgram');\n }\n }\n\n /**\n * @internal\n */\n static checkKeyLength(keys, expectedLength) {\n if (keys.length < expectedLength) {\n throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);\n }\n }\n}\n\n/**\n * An enumeration of valid StakeInstructionType's\n */\n\n/**\n * An enumeration of valid stake InstructionType's\n * @internal\n */\nconst STAKE_INSTRUCTION_LAYOUTS = Object.freeze({\n Initialize: {\n index: 0,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), authorized(), lockup()])\n },\n Authorize: {\n index: 1,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('newAuthorized'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('stakeAuthorizationType')])\n },\n Delegate: {\n index: 2,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n },\n Split: {\n index: 3,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('lamports')])\n },\n Withdraw: {\n index: 4,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('lamports')])\n },\n Deactivate: {\n index: 5,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n },\n Merge: {\n index: 7,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n },\n AuthorizeWithSeed: {\n index: 8,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('newAuthorized'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('stakeAuthorizationType'), rustString('authoritySeed'), publicKey('authorityOwner')])\n }\n});\n\n/**\n * Stake authorization type\n */\n\n/**\n * An enumeration of valid StakeAuthorizationLayout's\n */\nconst StakeAuthorizationLayout = Object.freeze({\n Staker: {\n index: 0\n },\n Withdrawer: {\n index: 1\n }\n});\n\n/**\n * Factory class for transactions to interact with the Stake program\n */\nclass StakeProgram {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the Stake program\n */\n\n /**\n * Generate an Initialize instruction to add to a Stake Create transaction\n */\n static initialize(params) {\n const {\n stakePubkey,\n authorized,\n lockup: maybeLockup\n } = params;\n const lockup = maybeLockup || Lockup.default;\n const type = STAKE_INSTRUCTION_LAYOUTS.Initialize;\n const data = encodeData(type, {\n authorized: {\n staker: toBuffer(authorized.staker.toBuffer()),\n withdrawer: toBuffer(authorized.withdrawer.toBuffer())\n },\n lockup: {\n unixTimestamp: lockup.unixTimestamp,\n epoch: lockup.epoch,\n custodian: toBuffer(lockup.custodian.toBuffer())\n }\n });\n const instructionData = {\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }],\n programId: this.programId,\n data\n };\n return new TransactionInstruction(instructionData);\n }\n\n /**\n * Generate a Transaction that creates a new Stake account at\n * an address generated with `from`, a seed, and the Stake programId\n */\n static createAccountWithSeed(params) {\n const transaction = new Transaction();\n transaction.add(SystemProgram.createAccountWithSeed({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.stakePubkey,\n basePubkey: params.basePubkey,\n seed: params.seed,\n lamports: params.lamports,\n space: this.space,\n programId: this.programId\n }));\n const {\n stakePubkey,\n authorized,\n lockup\n } = params;\n return transaction.add(this.initialize({\n stakePubkey,\n authorized,\n lockup\n }));\n }\n\n /**\n * Generate a Transaction that creates a new Stake account\n */\n static createAccount(params) {\n const transaction = new Transaction();\n transaction.add(SystemProgram.createAccount({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.stakePubkey,\n lamports: params.lamports,\n space: this.space,\n programId: this.programId\n }));\n const {\n stakePubkey,\n authorized,\n lockup\n } = params;\n return transaction.add(this.initialize({\n stakePubkey,\n authorized,\n lockup\n }));\n }\n\n /**\n * Generate a Transaction that delegates Stake tokens to a validator\n * Vote PublicKey. This transaction can also be used to redelegate Stake\n * to a new validator Vote PublicKey.\n */\n static delegate(params) {\n const {\n stakePubkey,\n authorizedPubkey,\n votePubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Delegate;\n const data = encodeData(type);\n return new Transaction().add({\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: votePubkey,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_STAKE_HISTORY_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: STAKE_CONFIG_ID,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that authorizes a new PublicKey as Staker\n * or Withdrawer on the Stake account.\n */\n static authorize(params) {\n const {\n stakePubkey,\n authorizedPubkey,\n newAuthorizedPubkey,\n stakeAuthorizationType,\n custodianPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Authorize;\n const data = encodeData(type, {\n newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),\n stakeAuthorizationType: stakeAuthorizationType.index\n });\n const keys = [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }];\n if (custodianPubkey) {\n keys.push({\n pubkey: custodianPubkey,\n isSigner: true,\n isWritable: false\n });\n }\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that authorizes a new PublicKey as Staker\n * or Withdrawer on the Stake account.\n */\n static authorizeWithSeed(params) {\n const {\n stakePubkey,\n authorityBase,\n authoritySeed,\n authorityOwner,\n newAuthorizedPubkey,\n stakeAuthorizationType,\n custodianPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed;\n const data = encodeData(type, {\n newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),\n stakeAuthorizationType: stakeAuthorizationType.index,\n authoritySeed: authoritySeed,\n authorityOwner: toBuffer(authorityOwner.toBuffer())\n });\n const keys = [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: authorityBase,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }];\n if (custodianPubkey) {\n keys.push({\n pubkey: custodianPubkey,\n isSigner: true,\n isWritable: false\n });\n }\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * @internal\n */\n static splitInstruction(params) {\n const {\n stakePubkey,\n authorizedPubkey,\n splitStakePubkey,\n lamports\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Split;\n const data = encodeData(type, {\n lamports\n });\n return new TransactionInstruction({\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: splitStakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that splits Stake tokens into another stake account\n */\n static split(params,\n // Compute the cost of allocating the new stake account in lamports\n rentExemptReserve) {\n const transaction = new Transaction();\n transaction.add(SystemProgram.createAccount({\n fromPubkey: params.authorizedPubkey,\n newAccountPubkey: params.splitStakePubkey,\n lamports: rentExemptReserve,\n space: this.space,\n programId: this.programId\n }));\n return transaction.add(this.splitInstruction(params));\n }\n\n /**\n * Generate a Transaction that splits Stake tokens into another account\n * derived from a base public key and seed\n */\n static splitWithSeed(params,\n // If this stake account is new, compute the cost of allocating it in lamports\n rentExemptReserve) {\n const {\n stakePubkey,\n authorizedPubkey,\n splitStakePubkey,\n basePubkey,\n seed,\n lamports\n } = params;\n const transaction = new Transaction();\n transaction.add(SystemProgram.allocate({\n accountPubkey: splitStakePubkey,\n basePubkey,\n seed,\n space: this.space,\n programId: this.programId\n }));\n if (rentExemptReserve && rentExemptReserve > 0) {\n transaction.add(SystemProgram.transfer({\n fromPubkey: params.authorizedPubkey,\n toPubkey: splitStakePubkey,\n lamports: rentExemptReserve\n }));\n }\n return transaction.add(this.splitInstruction({\n stakePubkey,\n authorizedPubkey,\n splitStakePubkey,\n lamports\n }));\n }\n\n /**\n * Generate a Transaction that merges Stake accounts.\n */\n static merge(params) {\n const {\n stakePubkey,\n sourceStakePubKey,\n authorizedPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Merge;\n const data = encodeData(type);\n return new Transaction().add({\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: sourceStakePubKey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_STAKE_HISTORY_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that withdraws deactivated Stake tokens.\n */\n static withdraw(params) {\n const {\n stakePubkey,\n authorizedPubkey,\n toPubkey,\n lamports,\n custodianPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Withdraw;\n const data = encodeData(type, {\n lamports\n });\n const keys = [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: toPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_STAKE_HISTORY_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }];\n if (custodianPubkey) {\n keys.push({\n pubkey: custodianPubkey,\n isSigner: true,\n isWritable: false\n });\n }\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that deactivates Stake tokens.\n */\n static deactivate(params) {\n const {\n stakePubkey,\n authorizedPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Deactivate;\n const data = encodeData(type);\n return new Transaction().add({\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n}\nStakeProgram.programId = new PublicKey('Stake11111111111111111111111111111111111111');\n/**\n * Max space of a Stake account\n *\n * This is generated from the solana-stake-program StakeState struct as\n * `StakeStateV2::size_of()`:\n * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeStateV2.html\n */\nStakeProgram.space = 200;\n\n/**\n * Vote account info\n */\nclass VoteInit {\n /** [0, 100] */\n\n constructor(nodePubkey, authorizedVoter, authorizedWithdrawer, commission) {\n this.nodePubkey = void 0;\n this.authorizedVoter = void 0;\n this.authorizedWithdrawer = void 0;\n this.commission = void 0;\n this.nodePubkey = nodePubkey;\n this.authorizedVoter = authorizedVoter;\n this.authorizedWithdrawer = authorizedWithdrawer;\n this.commission = commission;\n }\n}\n\n/**\n * Create vote account transaction params\n */\n\n/**\n * InitializeAccount instruction params\n */\n\n/**\n * Authorize instruction params\n */\n\n/**\n * AuthorizeWithSeed instruction params\n */\n\n/**\n * Withdraw from vote account transaction params\n */\n\n/**\n * Update validator identity (node pubkey) vote account instruction params.\n */\n\n/**\n * Vote Instruction class\n */\nclass VoteInstruction {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Decode a vote instruction and retrieve the instruction type.\n */\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [ixType, layout] of Object.entries(VOTE_INSTRUCTION_LAYOUTS)) {\n if (layout.index == typeIndex) {\n type = ixType;\n break;\n }\n }\n if (!type) {\n throw new Error('Instruction type incorrect; not a VoteInstruction');\n }\n return type;\n }\n\n /**\n * Decode an initialize vote instruction and retrieve the instruction params.\n */\n static decodeInitializeAccount(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 4);\n const {\n voteInit\n } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.InitializeAccount, instruction.data);\n return {\n votePubkey: instruction.keys[0].pubkey,\n nodePubkey: instruction.keys[3].pubkey,\n voteInit: new VoteInit(new PublicKey(voteInit.nodePubkey), new PublicKey(voteInit.authorizedVoter), new PublicKey(voteInit.authorizedWithdrawer), voteInit.commission)\n };\n }\n\n /**\n * Decode an authorize instruction and retrieve the instruction params.\n */\n static decodeAuthorize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n newAuthorized,\n voteAuthorizationType\n } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.Authorize, instruction.data);\n return {\n votePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey,\n newAuthorizedPubkey: new PublicKey(newAuthorized),\n voteAuthorizationType: {\n index: voteAuthorizationType\n }\n };\n }\n\n /**\n * Decode an authorize instruction and retrieve the instruction params.\n */\n static decodeAuthorizeWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n voteAuthorizeWithSeedArgs: {\n currentAuthorityDerivedKeyOwnerPubkey,\n currentAuthorityDerivedKeySeed,\n newAuthorized,\n voteAuthorizationType\n }\n } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);\n return {\n currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey,\n currentAuthorityDerivedKeyOwnerPubkey: new PublicKey(currentAuthorityDerivedKeyOwnerPubkey),\n currentAuthorityDerivedKeySeed: currentAuthorityDerivedKeySeed,\n newAuthorizedPubkey: new PublicKey(newAuthorized),\n voteAuthorizationType: {\n index: voteAuthorizationType\n },\n votePubkey: instruction.keys[0].pubkey\n };\n }\n\n /**\n * Decode a withdraw instruction and retrieve the instruction params.\n */\n static decodeWithdraw(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n lamports\n } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.Withdraw, instruction.data);\n return {\n votePubkey: instruction.keys[0].pubkey,\n authorizedWithdrawerPubkey: instruction.keys[2].pubkey,\n lamports,\n toPubkey: instruction.keys[1].pubkey\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(VoteProgram.programId)) {\n throw new Error('invalid instruction; programId is not VoteProgram');\n }\n }\n\n /**\n * @internal\n */\n static checkKeyLength(keys, expectedLength) {\n if (keys.length < expectedLength) {\n throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);\n }\n }\n}\n\n/**\n * An enumeration of valid VoteInstructionType's\n */\n\n/** @internal */\n\nconst VOTE_INSTRUCTION_LAYOUTS = Object.freeze({\n InitializeAccount: {\n index: 0,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), voteInit()])\n },\n Authorize: {\n index: 1,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), publicKey('newAuthorized'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('voteAuthorizationType')])\n },\n Withdraw: {\n index: 3,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.ns64('lamports')])\n },\n UpdateValidatorIdentity: {\n index: 4,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction')])\n },\n AuthorizeWithSeed: {\n index: 10,\n layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('instruction'), voteAuthorizeWithSeedArgs()])\n }\n});\n\n/**\n * VoteAuthorize type\n */\n\n/**\n * An enumeration of valid VoteAuthorization layouts.\n */\nconst VoteAuthorizationLayout = Object.freeze({\n Voter: {\n index: 0\n },\n Withdrawer: {\n index: 1\n }\n});\n\n/**\n * Factory class for transactions to interact with the Vote program\n */\nclass VoteProgram {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the Vote program\n */\n\n /**\n * Generate an Initialize instruction.\n */\n static initializeAccount(params) {\n const {\n votePubkey,\n nodePubkey,\n voteInit\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.InitializeAccount;\n const data = encodeData(type, {\n voteInit: {\n nodePubkey: toBuffer(voteInit.nodePubkey.toBuffer()),\n authorizedVoter: toBuffer(voteInit.authorizedVoter.toBuffer()),\n authorizedWithdrawer: toBuffer(voteInit.authorizedWithdrawer.toBuffer()),\n commission: voteInit.commission\n }\n });\n const instructionData = {\n keys: [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: nodePubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n };\n return new TransactionInstruction(instructionData);\n }\n\n /**\n * Generate a transaction that creates a new Vote account.\n */\n static createAccount(params) {\n const transaction = new Transaction();\n transaction.add(SystemProgram.createAccount({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.votePubkey,\n lamports: params.lamports,\n space: this.space,\n programId: this.programId\n }));\n return transaction.add(this.initializeAccount({\n votePubkey: params.votePubkey,\n nodePubkey: params.voteInit.nodePubkey,\n voteInit: params.voteInit\n }));\n }\n\n /**\n * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.\n */\n static authorize(params) {\n const {\n votePubkey,\n authorizedPubkey,\n newAuthorizedPubkey,\n voteAuthorizationType\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.Authorize;\n const data = encodeData(type, {\n newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),\n voteAuthorizationType: voteAuthorizationType.index\n });\n const keys = [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }];\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account\n * where the current Voter or Withdrawer authority is a derived key.\n */\n static authorizeWithSeed(params) {\n const {\n currentAuthorityDerivedKeyBasePubkey,\n currentAuthorityDerivedKeyOwnerPubkey,\n currentAuthorityDerivedKeySeed,\n newAuthorizedPubkey,\n voteAuthorizationType,\n votePubkey\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed;\n const data = encodeData(type, {\n voteAuthorizeWithSeedArgs: {\n currentAuthorityDerivedKeyOwnerPubkey: toBuffer(currentAuthorityDerivedKeyOwnerPubkey.toBuffer()),\n currentAuthorityDerivedKeySeed: currentAuthorityDerivedKeySeed,\n newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),\n voteAuthorizationType: voteAuthorizationType.index\n }\n });\n const keys = [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: currentAuthorityDerivedKeyBasePubkey,\n isSigner: true,\n isWritable: false\n }];\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction to withdraw from a Vote account.\n */\n static withdraw(params) {\n const {\n votePubkey,\n authorizedWithdrawerPubkey,\n lamports,\n toPubkey\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.Withdraw;\n const data = encodeData(type, {\n lamports\n });\n const keys = [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: toPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: authorizedWithdrawerPubkey,\n isSigner: true,\n isWritable: false\n }];\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction to withdraw safely from a Vote account.\n *\n * This function was created as a safeguard for vote accounts running validators, `safeWithdraw`\n * checks that the withdraw amount will not exceed the specified balance while leaving enough left\n * to cover rent. If you wish to close the vote account by withdrawing the full amount, call the\n * `withdraw` method directly.\n */\n static safeWithdraw(params, currentVoteAccountBalance, rentExemptMinimum) {\n if (params.lamports > currentVoteAccountBalance - rentExemptMinimum) {\n throw new Error('Withdraw will leave vote account with insufficient funds.');\n }\n return VoteProgram.withdraw(params);\n }\n\n /**\n * Generate a transaction to update the validator identity (node pubkey) of a Vote account.\n */\n static updateValidatorIdentity(params) {\n const {\n votePubkey,\n authorizedWithdrawerPubkey,\n nodePubkey\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.UpdateValidatorIdentity;\n const data = encodeData(type);\n const keys = [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: nodePubkey,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: authorizedWithdrawerPubkey,\n isSigner: true,\n isWritable: false\n }];\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n}\nVoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');\n/**\n * Max space of a Vote account\n *\n * This is generated from the solana-vote-program VoteState struct as\n * `VoteState::size_of()`:\n * https://docs.rs/solana-vote-program/1.9.5/solana_vote_program/vote_state/struct.VoteState.html#method.size_of\n *\n * KEEP IN SYNC WITH `VoteState::size_of()` in https://github.com/solana-labs/solana/blob/a474cb24b9238f5edcc982f65c0b37d4a1046f7e/sdk/program/src/vote/state/mod.rs#L340-L342\n */\nVoteProgram.space = 3762;\n\nconst VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');\n\n/**\n * @internal\n */\n\n/**\n * Info used to identity validators.\n */\n\nconst InfoString = (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.type)({\n name: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)(),\n website: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n details: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n iconUrl: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)()),\n keybaseUsername: (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_10__.string)())\n});\n\n/**\n * ValidatorInfo class\n */\nclass ValidatorInfo {\n /**\n * Construct a valid ValidatorInfo\n *\n * @param key validator public key\n * @param info validator information\n */\n constructor(key, info) {\n /**\n * validator public key\n */\n this.key = void 0;\n /**\n * validator information\n */\n this.info = void 0;\n this.key = key;\n this.info = info;\n }\n\n /**\n * Deserialize ValidatorInfo from the config account data. Exactly two config\n * keys are required in the data.\n *\n * @param buffer config account data\n * @return null if info was not found\n */\n static fromConfigData(buffer) {\n let byteArray = [...buffer];\n const configKeyCount = decodeLength(byteArray);\n if (configKeyCount !== 2) return null;\n const configKeys = [];\n for (let i = 0; i < 2; i++) {\n const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));\n const isSigner = guardedShift(byteArray) === 1;\n configKeys.push({\n publicKey,\n isSigner\n });\n }\n if (configKeys[0].publicKey.equals(VALIDATOR_INFO_KEY)) {\n if (configKeys[1].isSigner) {\n const rawInfo = rustString().decode(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(byteArray));\n const info = JSON.parse(rawInfo);\n (0,superstruct__WEBPACK_IMPORTED_MODULE_10__.assert)(info, InfoString);\n return new ValidatorInfo(configKeys[1].publicKey, info);\n }\n }\n return null;\n }\n}\n\nconst VOTE_PROGRAM_ID = new PublicKey('Vote111111111111111111111111111111111111111');\n\n/**\n * History of how many credits earned by the end of each epoch\n */\n\n/**\n * See https://github.com/solana-labs/solana/blob/8a12ed029cfa38d4a45400916c2463fb82bbec8c/programs/vote_api/src/vote_state.rs#L68-L88\n *\n * @internal\n */\nconst VoteAccountLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([publicKey('nodePubkey'), publicKey('authorizedWithdrawer'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('commission'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64(),\n// votes.length\n_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('slot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32('confirmationCount')]), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32(), -8), 'votes'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('rootSlotValid'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('rootSlot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64(),\n// authorizedVoters.length\n_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('epoch'), publicKey('authorizedVoter')]), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32(), -8), 'authorizedVoters'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([publicKey('authorizedPubkey'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('epochOfLastAuthorizedSwitch'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('targetEpoch')]), 32, 'buf'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('idx'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u8('isEmpty')], 'priorVoters'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64(),\n// epochCredits.length\n_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('epoch'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('credits'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('prevCredits')]), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.u32(), -8), 'epochCredits'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('slot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_4__.nu64('timestamp')], 'lastTimestamp')]);\n/**\n * VoteAccount class\n */\nclass VoteAccount {\n /**\n * @internal\n */\n constructor(args) {\n this.nodePubkey = void 0;\n this.authorizedWithdrawer = void 0;\n this.commission = void 0;\n this.rootSlot = void 0;\n this.votes = void 0;\n this.authorizedVoters = void 0;\n this.priorVoters = void 0;\n this.epochCredits = void 0;\n this.lastTimestamp = void 0;\n this.nodePubkey = args.nodePubkey;\n this.authorizedWithdrawer = args.authorizedWithdrawer;\n this.commission = args.commission;\n this.rootSlot = args.rootSlot;\n this.votes = args.votes;\n this.authorizedVoters = args.authorizedVoters;\n this.priorVoters = args.priorVoters;\n this.epochCredits = args.epochCredits;\n this.lastTimestamp = args.lastTimestamp;\n }\n\n /**\n * Deserialize VoteAccount from the account data.\n *\n * @param buffer account data\n * @return VoteAccount\n */\n static fromAccountData(buffer) {\n const versionOffset = 4;\n const va = VoteAccountLayout.decode(toBuffer(buffer), versionOffset);\n let rootSlot = va.rootSlot;\n if (!va.rootSlotValid) {\n rootSlot = null;\n }\n return new VoteAccount({\n nodePubkey: new PublicKey(va.nodePubkey),\n authorizedWithdrawer: new PublicKey(va.authorizedWithdrawer),\n commission: va.commission,\n votes: va.votes,\n rootSlot,\n authorizedVoters: va.authorizedVoters.map(parseAuthorizedVoter),\n priorVoters: getPriorVoters(va.priorVoters),\n epochCredits: va.epochCredits,\n lastTimestamp: va.lastTimestamp\n });\n }\n}\nfunction parseAuthorizedVoter({\n authorizedVoter,\n epoch\n}) {\n return {\n epoch,\n authorizedVoter: new PublicKey(authorizedVoter)\n };\n}\nfunction parsePriorVoters({\n authorizedPubkey,\n epochOfLastAuthorizedSwitch,\n targetEpoch\n}) {\n return {\n authorizedPubkey: new PublicKey(authorizedPubkey),\n epochOfLastAuthorizedSwitch,\n targetEpoch\n };\n}\nfunction getPriorVoters({\n buf,\n idx,\n isEmpty\n}) {\n if (isEmpty) {\n return [];\n }\n return [...buf.slice(idx + 1).map(parsePriorVoters), ...buf.slice(0, idx).map(parsePriorVoters)];\n}\n\nconst endpoint = {\n http: {\n devnet: 'http://api.devnet.solana.com',\n testnet: 'http://api.testnet.solana.com',\n 'mainnet-beta': 'http://api.mainnet-beta.solana.com/'\n },\n https: {\n devnet: 'https://api.devnet.solana.com',\n testnet: 'https://api.testnet.solana.com',\n 'mainnet-beta': 'https://api.mainnet-beta.solana.com/'\n }\n};\n/**\n * Retrieves the RPC API URL for the specified cluster\n * @param {Cluster} [cluster=\"devnet\"] - The cluster name of the RPC API URL to use. Possible options: 'devnet' | 'testnet' | 'mainnet-beta'\n * @param {boolean} [tls=\"http\"] - Use TLS when connecting to cluster.\n *\n * @returns {string} URL string of the RPC endpoint\n */\nfunction clusterApiUrl(cluster, tls) {\n const key = tls === false ? 'http' : 'https';\n if (!cluster) {\n return endpoint[key]['devnet'];\n }\n const url = endpoint[key][cluster];\n if (!url) {\n throw new Error(`Unknown ${key} cluster: ${cluster}`);\n }\n return url;\n}\n\n/**\n * Send and confirm a raw transaction\n *\n * If `commitment` option is not specified, defaults to 'max' commitment.\n *\n * @param {Connection} connection\n * @param {Buffer} rawTransaction\n * @param {TransactionConfirmationStrategy} confirmationStrategy\n * @param {ConfirmOptions} [options]\n * @returns {Promise}\n */\n\n/**\n * @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`\n * is no longer supported and will be removed in a future version.\n */\n// eslint-disable-next-line no-redeclare\n\n// eslint-disable-next-line no-redeclare\nasync function sendAndConfirmRawTransaction(connection, rawTransaction, confirmationStrategyOrConfirmOptions, maybeConfirmOptions) {\n let confirmationStrategy;\n let options;\n if (confirmationStrategyOrConfirmOptions && Object.prototype.hasOwnProperty.call(confirmationStrategyOrConfirmOptions, 'lastValidBlockHeight')) {\n confirmationStrategy = confirmationStrategyOrConfirmOptions;\n options = maybeConfirmOptions;\n } else if (confirmationStrategyOrConfirmOptions && Object.prototype.hasOwnProperty.call(confirmationStrategyOrConfirmOptions, 'nonceValue')) {\n confirmationStrategy = confirmationStrategyOrConfirmOptions;\n options = maybeConfirmOptions;\n } else {\n options = confirmationStrategyOrConfirmOptions;\n }\n const sendOptions = options && {\n skipPreflight: options.skipPreflight,\n preflightCommitment: options.preflightCommitment || options.commitment,\n minContextSlot: options.minContextSlot\n };\n const signature = await connection.sendRawTransaction(rawTransaction, sendOptions);\n const commitment = options && options.commitment;\n const confirmationPromise = confirmationStrategy ? connection.confirmTransaction(confirmationStrategy, commitment) : connection.confirmTransaction(signature, commitment);\n const status = (await confirmationPromise).value;\n if (status.err) {\n if (signature != null) {\n throw new SendTransactionError({\n action: sendOptions?.skipPreflight ? 'send' : 'simulate',\n signature: signature,\n transactionMessage: `Status: (${JSON.stringify(status)})`\n });\n }\n throw new Error(`Raw transaction ${signature} failed (${JSON.stringify(status)})`);\n }\n return signature;\n}\n\n/**\n * There are 1-billion lamports in one SOL\n */\nconst LAMPORTS_PER_SOL = 1000000000;\n\n\n//# sourceMappingURL=index.browser.esm.js.map\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@solana+web3.js@1.95.3_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@solana/web3.js/lib/index.browser.esm.js?")},"./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/abnf.js":function(__unused_webpack_module,exports,__webpack_require__){"use strict";eval('\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { "default": mod };\n};\nvar _a;\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.ParsedMessage = void 0;\nconst api_1 = __importDefault(__webpack_require__(/*! apg-js/src/apg-api/api */ "./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/api.js"));\nconst node_exports_1 = __importDefault(__webpack_require__(/*! apg-js/src/apg-lib/node-exports */ "./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/node-exports.js"));\nconst utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/utils.js");\nconst GRAMMAR = `\nsign-in-with-ethereum =\n [ scheme "://" ] domain %s" wants you to sign in with your Ethereum account:" LF\n address LF\n LF\n [ statement LF ]\n LF\n %s"URI: " URI LF\n %s"Version: " version LF\n %s"Chain ID: " chain-id LF\n %s"Nonce: " nonce LF\n %s"Issued At: " issued-at\n [ LF %s"Expiration Time: " expiration-time ]\n [ LF %s"Not Before: " not-before ]\n [ LF %s"Request ID: " request-id ]\n [ LF %s"Resources:"\n resources ]\n\ndomain = authority\n\naddress = "0x" 40*40HEXDIG\n ; Must also conform to captilization\n ; checksum encoding specified in EIP-55\n ; where applicable (EOAs).\n\nstatement = 1*( reserved / unreserved / " " )\n ; The purpose is to exclude LF (line breaks).\n\nversion = "1"\n\nnonce = 8*( ALPHA / DIGIT )\n\nissued-at = date-time\nexpiration-time = date-time\nnot-before = date-time\n\nrequest-id = *pchar\n\nchain-id = 1*DIGIT\n ; See EIP-155 for valid CHAIN_IDs.\n\nresources = *( LF resource )\n\nresource = "- " URI\n\n; ------------------------------------------------------------------------------\n; RFC 3986\n\nURI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]\n\nhier-part = "//" authority path-abempty\n / path-absolute\n / path-rootless\n / path-empty\n\nscheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )\n\nauthority = [ userinfo "@" ] host [ ":" port ]\nuserinfo = *( unreserved / pct-encoded / sub-delims / ":" )\nhost = IP-literal / IPv4address / reg-name\nport = *DIGIT\n\nIP-literal = "[" ( IPv6address / IPvFuture ) "]"\n\nIPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )\n\nIPv6address = 6( h16 ":" ) ls32\n / "::" 5( h16 ":" ) ls32\n / [ h16 ] "::" 4( h16 ":" ) ls32\n / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32\n / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32\n / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32\n / [ *4( h16 ":" ) h16 ] "::" ls32\n / [ *5( h16 ":" ) h16 ] "::" h16\n / [ *6( h16 ":" ) h16 ] "::"\n\nh16 = 1*4HEXDIG\nls32 = ( h16 ":" h16 ) / IPv4address\nIPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet\ndec-octet = DIGIT ; 0-9\n / %x31-39 DIGIT ; 10-99\n / "1" 2DIGIT ; 100-199\n / "2" %x30-34 DIGIT ; 200-249\n / "25" %x30-35 ; 250-255\n\nreg-name = *( unreserved / pct-encoded / sub-delims )\n\npath-abempty = *( "/" segment )\npath-absolute = "/" [ segment-nz *( "/" segment ) ]\npath-rootless = segment-nz *( "/" segment )\npath-empty = 0pchar\n\nsegment = *pchar\nsegment-nz = 1*pchar\n\npchar = unreserved / pct-encoded / sub-delims / ":" / "@"\n\nquery = *( pchar / "/" / "?" )\n\nfragment = *( pchar / "/" / "?" )\n\npct-encoded = "%" HEXDIG HEXDIG\n\nunreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\nreserved = gen-delims / sub-delims\ngen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"\nsub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n / "*" / "+" / "," / ";" / "="\n\n; ------------------------------------------------------------------------------\n; RFC 3339\n\ndate-fullyear = 4DIGIT\ndate-month = 2DIGIT ; 01-12\ndate-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on\n ; month/year\ntime-hour = 2DIGIT ; 00-23\ntime-minute = 2DIGIT ; 00-59\ntime-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second\n ; rules\ntime-secfrac = "." 1*DIGIT\ntime-numoffset = ("+" / "-") time-hour ":" time-minute\ntime-offset = "Z" / time-numoffset\n\npartial-time = time-hour ":" time-minute ":" time-second\n [time-secfrac]\nfull-date = date-fullyear "-" date-month "-" date-mday\nfull-time = partial-time time-offset\n\ndate-time = full-date "T" full-time\n\n; ------------------------------------------------------------------------------\n; RFC 5234\n\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\nLF = %x0A\n ; linefeed\nDIGIT = %x30-39\n ; 0-9\nHEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n`;\nclass GrammarApi {\n static generateApi() {\n const api = new api_1.default(GRAMMAR);\n api.generate();\n if (api.errors.length) {\n console.error(api.errorsToAscii());\n console.error(api.linesToAscii());\n console.log(api.displayAttributeErrors());\n throw new Error(`ABNF grammar has errors`);\n }\n return api.toObject();\n }\n}\n_a = GrammarApi;\nGrammarApi.grammarObj = _a.generateApi();\nclass ParsedMessage {\n constructor(msg) {\n const parser = new node_exports_1.default.parser();\n parser.ast = new node_exports_1.default.ast();\n const id = node_exports_1.default.ids;\n const scheme = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE && phraseIndex === 0) {\n data.scheme = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks.scheme = scheme;\n const domain = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.domain = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks.domain = domain;\n const address = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.address = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks.address = address;\n const statement = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.statement = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks.statement = statement;\n const uri = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n if (!data.uri) {\n data.uri = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n }\n return ret;\n };\n parser.ast.callbacks.uri = uri;\n const version = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.version = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks.version = version;\n const chainId = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.chainId = (0, utils_1.parseIntegerNumber)(node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength));\n }\n return ret;\n };\n parser.ast.callbacks["chain-id"] = chainId;\n const nonce = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.nonce = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks.nonce = nonce;\n const issuedAt = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.issuedAt = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks["issued-at"] = issuedAt;\n const expirationTime = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.expirationTime = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks["expiration-time"] = expirationTime;\n const notBefore = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.notBefore = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks["not-before"] = notBefore;\n const requestId = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.requestId = node_exports_1.default.utils.charsToString(chars, phraseIndex, phraseLength);\n }\n return ret;\n };\n parser.ast.callbacks["request-id"] = requestId;\n const resources = function (state, chars, phraseIndex, phraseLength, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.resources = node_exports_1.default.utils\n .charsToString(chars, phraseIndex, phraseLength)\n .slice(3)\n .split("\\n- ");\n }\n return ret;\n };\n parser.ast.callbacks.resources = resources;\n const result = parser.parse(GrammarApi.grammarObj, "sign-in-with-ethereum", msg);\n if (!result.success) {\n throw new Error(`Invalid message: ${JSON.stringify(result)}`);\n }\n const elements = {};\n parser.ast.translate(elements);\n for (const [key, value] of Object.entries(elements)) {\n this[key] = value;\n }\n if (this.domain.length === 0) {\n throw new Error("Domain cannot be empty.");\n }\n if (!(0, utils_1.isEIP55Address)(this.address)) {\n throw new Error("Address not conformant to EIP-55.");\n }\n }\n}\nexports.ParsedMessage = ParsedMessage;\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/abnf.js?')},"./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/parsers.js":function(__unused_webpack_module,exports,__webpack_require__){"use strict";eval('\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.ParsedMessage = void 0;\nconst abnf_1 = __webpack_require__(/*! ./abnf */ "./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/abnf.js");\nObject.defineProperty(exports, "ParsedMessage", ({ enumerable: true, get: function () { return abnf_1.ParsedMessage; } }));\n__exportStar(__webpack_require__(/*! ./utils */ "./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/utils.js"), exports);\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/parsers.js?')},"./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/utils.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.parseIntegerNumber = exports.isEIP55Address = void 0;\nconst sha3_1 = __webpack_require__(/*! @noble/hashes/sha3 */ "./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/sha3.js");\nconst utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/utils.js");\n/**\n * This method is supposed to check if an address is conforming to EIP-55.\n * @param address Address to be checked if conforms with EIP-55.\n * @returns Either the return is or not in the EIP-55 format.\n */\nconst isEIP55Address = (address) => {\n if (address.length != 42) {\n return false;\n }\n const lowerAddress = `${address}`.toLowerCase().replace(\'0x\', \'\');\n const hash = (0, utils_1.bytesToHex)((0, sha3_1.keccak_256)(lowerAddress));\n let ret = \'0x\';\n for (let i = 0; i < lowerAddress.length; i++) {\n if (parseInt(hash[i], 16) >= 8) {\n ret += lowerAddress[i].toUpperCase();\n }\n else {\n ret += lowerAddress[i];\n }\n }\n return address === ret;\n};\nexports.isEIP55Address = isEIP55Address;\nconst parseIntegerNumber = (number) => {\n const parsed = parseInt(number);\n if (isNaN(parsed))\n throw new Error("Invalid number.");\n if (parsed === Infinity)\n throw new Error("Invalid number.");\n return parsed;\n};\nexports.parseIntegerNumber = parseIntegerNumber;\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@spruceid+siwe-parser@2.1.2/node_modules/@spruceid/siwe-parser/dist/utils.js?')},"./node_modules/.pnpm/@stablelib+binary@1.0.1/node_modules/@stablelib/binary/lib/binary.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, "__esModule", ({ value: true }));\n/**\n * Package binary provides functions for encoding and decoding numbers in byte arrays.\n */\nvar int_1 = __webpack_require__(/*! @stablelib/int */ "./node_modules/.pnpm/@stablelib+int@1.0.1/node_modules/@stablelib/int/lib/int.js");\n// TODO(dchest): add asserts for correct value ranges and array offsets.\n/**\n * Reads 2 bytes from array starting at offset as big-endian\n * signed 16-bit integer and returns it.\n */\nfunction readInt16BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (((array[offset + 0] << 8) | array[offset + 1]) << 16) >> 16;\n}\nexports.readInt16BE = readInt16BE;\n/**\n * Reads 2 bytes from array starting at offset as big-endian\n * unsigned 16-bit integer and returns it.\n */\nfunction readUint16BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 0] << 8) | array[offset + 1]) >>> 0;\n}\nexports.readUint16BE = readUint16BE;\n/**\n * Reads 2 bytes from array starting at offset as little-endian\n * signed 16-bit integer and returns it.\n */\nfunction readInt16LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (((array[offset + 1] << 8) | array[offset]) << 16) >> 16;\n}\nexports.readInt16LE = readInt16LE;\n/**\n * Reads 2 bytes from array starting at offset as little-endian\n * unsigned 16-bit integer and returns it.\n */\nfunction readUint16LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 1] << 8) | array[offset]) >>> 0;\n}\nexports.readUint16LE = readUint16LE;\n/**\n * Writes 2-byte big-endian representation of 16-bit unsigned\n * value to byte array starting at offset.\n *\n * If byte array is not given, creates a new 2-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint16BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(2); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 8;\n out[offset + 1] = value >>> 0;\n return out;\n}\nexports.writeUint16BE = writeUint16BE;\nexports.writeInt16BE = writeUint16BE;\n/**\n * Writes 2-byte little-endian representation of 16-bit unsigned\n * value to array starting at offset.\n *\n * If byte array is not given, creates a new 2-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint16LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(2); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 0;\n out[offset + 1] = value >>> 8;\n return out;\n}\nexports.writeUint16LE = writeUint16LE;\nexports.writeInt16LE = writeUint16LE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * signed 32-bit integer and returns it.\n */\nfunction readInt32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (array[offset] << 24) |\n (array[offset + 1] << 16) |\n (array[offset + 2] << 8) |\n array[offset + 3];\n}\nexports.readInt32BE = readInt32BE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * unsigned 32-bit integer and returns it.\n */\nfunction readUint32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset] << 24) |\n (array[offset + 1] << 16) |\n (array[offset + 2] << 8) |\n array[offset + 3]) >>> 0;\n}\nexports.readUint32BE = readUint32BE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * signed 32-bit integer and returns it.\n */\nfunction readInt32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (array[offset + 3] << 24) |\n (array[offset + 2] << 16) |\n (array[offset + 1] << 8) |\n array[offset];\n}\nexports.readInt32LE = readInt32LE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * unsigned 32-bit integer and returns it.\n */\nfunction readUint32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 3] << 24) |\n (array[offset + 2] << 16) |\n (array[offset + 1] << 8) |\n array[offset]) >>> 0;\n}\nexports.readUint32LE = readUint32LE;\n/**\n * Writes 4-byte big-endian representation of 32-bit unsigned\n * value to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint32BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 24;\n out[offset + 1] = value >>> 16;\n out[offset + 2] = value >>> 8;\n out[offset + 3] = value >>> 0;\n return out;\n}\nexports.writeUint32BE = writeUint32BE;\nexports.writeInt32BE = writeUint32BE;\n/**\n * Writes 4-byte little-endian representation of 32-bit unsigned\n * value to array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint32LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 0;\n out[offset + 1] = value >>> 8;\n out[offset + 2] = value >>> 16;\n out[offset + 3] = value >>> 24;\n return out;\n}\nexports.writeUint32LE = writeUint32LE;\nexports.writeInt32LE = writeUint32LE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * signed 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports exact\n * numbers in range -9007199254740991 to 9007199254740991.\n * If the number stored in the byte array is outside this range,\n * the result is not exact.\n */\nfunction readInt64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var hi = readInt32BE(array, offset);\n var lo = readInt32BE(array, offset + 4);\n return hi * 0x100000000 + lo - ((lo >> 31) * 0x100000000);\n}\nexports.readInt64BE = readInt64BE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * unsigned 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports values up to 2^53-1.\n */\nfunction readUint64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var hi = readUint32BE(array, offset);\n var lo = readUint32BE(array, offset + 4);\n return hi * 0x100000000 + lo;\n}\nexports.readUint64BE = readUint64BE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * signed 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports exact\n * numbers in range -9007199254740991 to 9007199254740991.\n * If the number stored in the byte array is outside this range,\n * the result is not exact.\n */\nfunction readInt64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var lo = readInt32LE(array, offset);\n var hi = readInt32LE(array, offset + 4);\n return hi * 0x100000000 + lo - ((lo >> 31) * 0x100000000);\n}\nexports.readInt64LE = readInt64LE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * unsigned 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports values up to 2^53-1.\n */\nfunction readUint64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var lo = readUint32LE(array, offset);\n var hi = readUint32LE(array, offset + 4);\n return hi * 0x100000000 + lo;\n}\nexports.readUint64LE = readUint64LE;\n/**\n * Writes 8-byte big-endian representation of 64-bit unsigned\n * value to byte array starting at offset.\n *\n * Due to JavaScript limitation, supports values up to 2^53-1.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint64BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n writeUint32BE(value / 0x100000000 >>> 0, out, offset);\n writeUint32BE(value >>> 0, out, offset + 4);\n return out;\n}\nexports.writeUint64BE = writeUint64BE;\nexports.writeInt64BE = writeUint64BE;\n/**\n * Writes 8-byte little-endian representation of 64-bit unsigned\n * value to byte array starting at offset.\n *\n * Due to JavaScript limitation, supports values up to 2^53-1.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint64LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n writeUint32LE(value >>> 0, out, offset);\n writeUint32LE(value / 0x100000000 >>> 0, out, offset + 4);\n return out;\n}\nexports.writeUint64LE = writeUint64LE;\nexports.writeInt64LE = writeUint64LE;\n/**\n * Reads bytes from array starting at offset as big-endian\n * unsigned bitLen-bit integer and returns it.\n *\n * Supports bit lengths divisible by 8, up to 48.\n */\nfunction readUintBE(bitLength, array, offset) {\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error("readUintBE supports only bitLengths divisible by 8");\n }\n if (bitLength / 8 > array.length - offset) {\n throw new Error("readUintBE: array is too short for the given bitLength");\n }\n var result = 0;\n var mul = 1;\n for (var i = bitLength / 8 + offset - 1; i >= offset; i--) {\n result += array[i] * mul;\n mul *= 256;\n }\n return result;\n}\nexports.readUintBE = readUintBE;\n/**\n * Reads bytes from array starting at offset as little-endian\n * unsigned bitLen-bit integer and returns it.\n *\n * Supports bit lengths divisible by 8, up to 48.\n */\nfunction readUintLE(bitLength, array, offset) {\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error("readUintLE supports only bitLengths divisible by 8");\n }\n if (bitLength / 8 > array.length - offset) {\n throw new Error("readUintLE: array is too short for the given bitLength");\n }\n var result = 0;\n var mul = 1;\n for (var i = offset; i < offset + bitLength / 8; i++) {\n result += array[i] * mul;\n mul *= 256;\n }\n return result;\n}\nexports.readUintLE = readUintLE;\n/**\n * Writes a big-endian representation of bitLen-bit unsigned\n * value to array starting at offset.\n *\n * Supports bit lengths divisible by 8, up to 48.\n *\n * If byte array is not given, creates a new one.\n *\n * Returns the output byte array.\n */\nfunction writeUintBE(bitLength, value, out, offset) {\n if (out === void 0) { out = new Uint8Array(bitLength / 8); }\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error("writeUintBE supports only bitLengths divisible by 8");\n }\n if (!int_1.isSafeInteger(value)) {\n throw new Error("writeUintBE value must be an integer");\n }\n var div = 1;\n for (var i = bitLength / 8 + offset - 1; i >= offset; i--) {\n out[i] = (value / div) & 0xff;\n div *= 256;\n }\n return out;\n}\nexports.writeUintBE = writeUintBE;\n/**\n * Writes a little-endian representation of bitLen-bit unsigned\n * value to array starting at offset.\n *\n * Supports bit lengths divisible by 8, up to 48.\n *\n * If byte array is not given, creates a new one.\n *\n * Returns the output byte array.\n */\nfunction writeUintLE(bitLength, value, out, offset) {\n if (out === void 0) { out = new Uint8Array(bitLength / 8); }\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error("writeUintLE supports only bitLengths divisible by 8");\n }\n if (!int_1.isSafeInteger(value)) {\n throw new Error("writeUintLE value must be an integer");\n }\n var div = 1;\n for (var i = offset; i < offset + bitLength / 8; i++) {\n out[i] = (value / div) & 0xff;\n div *= 256;\n }\n return out;\n}\nexports.writeUintLE = writeUintLE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * 32-bit floating-point number and returns it.\n */\nfunction readFloat32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat32(offset);\n}\nexports.readFloat32BE = readFloat32BE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * 32-bit floating-point number and returns it.\n */\nfunction readFloat32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat32(offset, true);\n}\nexports.readFloat32LE = readFloat32LE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * 64-bit floating-point number ("double") and returns it.\n */\nfunction readFloat64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat64(offset);\n}\nexports.readFloat64BE = readFloat64BE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * 64-bit floating-point number ("double") and returns it.\n */\nfunction readFloat64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat64(offset, true);\n}\nexports.readFloat64LE = readFloat64LE;\n/**\n * Writes 4-byte big-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat32BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat32(offset, value);\n return out;\n}\nexports.writeFloat32BE = writeFloat32BE;\n/**\n * Writes 4-byte little-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat32LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat32(offset, value, true);\n return out;\n}\nexports.writeFloat32LE = writeFloat32LE;\n/**\n * Writes 8-byte big-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat64BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat64(offset, value);\n return out;\n}\nexports.writeFloat64BE = writeFloat64BE;\n/**\n * Writes 8-byte little-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat64LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat64(offset, value, true);\n return out;\n}\nexports.writeFloat64LE = writeFloat64LE;\n//# sourceMappingURL=binary.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@stablelib+binary@1.0.1/node_modules/@stablelib/binary/lib/binary.js?')},"./node_modules/.pnpm/@stablelib+int@1.0.1/node_modules/@stablelib/int/lib/int.js":(__unused_webpack_module,exports)=>{"use strict";eval('\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, "__esModule", ({ value: true }));\n/**\n * Package int provides helper functions for integerss.\n */\n// Shim using 16-bit pieces.\nfunction imulShim(a, b) {\n var ah = (a >>> 16) & 0xffff, al = a & 0xffff;\n var bh = (b >>> 16) & 0xffff, bl = b & 0xffff;\n return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);\n}\n/** 32-bit integer multiplication. */\n// Use system Math.imul if available, otherwise use our shim.\nexports.mul = Math.imul || imulShim;\n/** 32-bit integer addition. */\nfunction add(a, b) {\n return (a + b) | 0;\n}\nexports.add = add;\n/** 32-bit integer subtraction. */\nfunction sub(a, b) {\n return (a - b) | 0;\n}\nexports.sub = sub;\n/** 32-bit integer left rotation */\nfunction rotl(x, n) {\n return x << n | x >>> (32 - n);\n}\nexports.rotl = rotl;\n/** 32-bit integer left rotation */\nfunction rotr(x, n) {\n return x << (32 - n) | x >>> n;\n}\nexports.rotr = rotr;\nfunction isIntegerShim(n) {\n return typeof n === "number" && isFinite(n) && Math.floor(n) === n;\n}\n/**\n * Returns true if the argument is an integer number.\n *\n * In ES2015, Number.isInteger.\n */\nexports.isInteger = Number.isInteger || isIntegerShim;\n/**\n * Math.pow(2, 53) - 1\n *\n * In ES2015 Number.MAX_SAFE_INTEGER.\n */\nexports.MAX_SAFE_INTEGER = 9007199254740991;\n/**\n * Returns true if the argument is a safe integer number\n * (-MIN_SAFE_INTEGER < number <= MAX_SAFE_INTEGER)\n *\n * In ES2015, Number.isSafeInteger.\n */\nexports.isSafeInteger = function (n) {\n return exports.isInteger(n) && (n >= -exports.MAX_SAFE_INTEGER && n <= exports.MAX_SAFE_INTEGER);\n};\n//# sourceMappingURL=int.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@stablelib+int@1.0.1/node_modules/@stablelib/int/lib/int.js?')},"./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/random.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.randomStringForEntropy = exports.randomString = exports.randomUint32 = exports.randomBytes = exports.defaultRandomSource = void 0;\nconst system_1 = __webpack_require__(/*! ./source/system */ "./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/system.js");\nconst binary_1 = __webpack_require__(/*! @stablelib/binary */ "./node_modules/.pnpm/@stablelib+binary@1.0.1/node_modules/@stablelib/binary/lib/binary.js");\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ "./node_modules/.pnpm/@stablelib+wipe@1.0.1/node_modules/@stablelib/wipe/lib/wipe.js");\nexports.defaultRandomSource = new system_1.SystemRandomSource();\nfunction randomBytes(length, prng = exports.defaultRandomSource) {\n return prng.randomBytes(length);\n}\nexports.randomBytes = randomBytes;\n/**\n * Returns a uniformly random unsigned 32-bit integer.\n */\nfunction randomUint32(prng = exports.defaultRandomSource) {\n // Generate 4-byte random buffer.\n const buf = randomBytes(4, prng);\n // Convert bytes from buffer into a 32-bit integer.\n // It\'s not important which byte order to use, since\n // the result is random.\n const result = (0, binary_1.readUint32LE)(buf);\n // Clean the buffer.\n (0, wipe_1.wipe)(buf);\n return result;\n}\nexports.randomUint32 = randomUint32;\n/** 62 alphanumeric characters for default charset of randomString() */\nconst ALPHANUMERIC = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";\n/**\n * Returns a uniform random string of the given length\n * with characters from the given charset.\n *\n * Charset must not have more than 256 characters.\n *\n * Default charset generates case-sensitive alphanumeric\n * strings (0-9, A-Z, a-z).\n */\nfunction randomString(length, charset = ALPHANUMERIC, prng = exports.defaultRandomSource) {\n if (charset.length < 2) {\n throw new Error("randomString charset is too short");\n }\n if (charset.length > 256) {\n throw new Error("randomString charset is too long");\n }\n let out = \'\';\n const charsLen = charset.length;\n const maxByte = 256 - (256 % charsLen);\n while (length > 0) {\n const buf = randomBytes(Math.ceil(length * 256 / maxByte), prng);\n for (let i = 0; i < buf.length && length > 0; i++) {\n const randomByte = buf[i];\n if (randomByte < maxByte) {\n out += charset.charAt(randomByte % charsLen);\n length--;\n }\n }\n (0, wipe_1.wipe)(buf);\n }\n return out;\n}\nexports.randomString = randomString;\n/**\n * Returns uniform random string containing at least the given\n * number of bits of entropy.\n *\n * For example, randomStringForEntropy(128) will return a 22-character\n * alphanumeric string, while randomStringForEntropy(128, "0123456789")\n * will return a 39-character numeric string, both will contain at\n * least 128 bits of entropy.\n *\n * Default charset generates case-sensitive alphanumeric\n * strings (0-9, A-Z, a-z).\n */\nfunction randomStringForEntropy(bits, charset = ALPHANUMERIC, prng = exports.defaultRandomSource) {\n const length = Math.ceil(bits / (Math.log(charset.length) / Math.LN2));\n return randomString(length, charset, prng);\n}\nexports.randomStringForEntropy = randomStringForEntropy;\n//# sourceMappingURL=random.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/random.js?')},"./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/browser.js":(__unused_webpack_module,exports)=>{"use strict";eval('\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.BrowserRandomSource = void 0;\nconst QUOTA = 65536;\nclass BrowserRandomSource {\n constructor() {\n this.isAvailable = false;\n this.isInstantiated = false;\n const browserCrypto = typeof self !== \'undefined\'\n ? (self.crypto || self.msCrypto) // IE11 has msCrypto\n : null;\n if (browserCrypto && browserCrypto.getRandomValues !== undefined) {\n this._crypto = browserCrypto;\n this.isAvailable = true;\n this.isInstantiated = true;\n }\n }\n randomBytes(length) {\n if (!this.isAvailable || !this._crypto) {\n throw new Error("Browser random byte generator is not available.");\n }\n const out = new Uint8Array(length);\n for (let i = 0; i < out.length; i += QUOTA) {\n this._crypto.getRandomValues(out.subarray(i, i + Math.min(out.length - i, QUOTA)));\n }\n return out;\n }\n}\nexports.BrowserRandomSource = BrowserRandomSource;\n//# sourceMappingURL=browser.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/browser.js?')},"./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/node.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.NodeRandomSource = void 0;\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ "./node_modules/.pnpm/@stablelib+wipe@1.0.1/node_modules/@stablelib/wipe/lib/wipe.js");\nclass NodeRandomSource {\n constructor() {\n this.isAvailable = false;\n this.isInstantiated = false;\n if (true) {\n const nodeCrypto = __webpack_require__(/*! crypto */ "?9b08");\n if (nodeCrypto && nodeCrypto.randomBytes) {\n this._crypto = nodeCrypto;\n this.isAvailable = true;\n this.isInstantiated = true;\n }\n }\n }\n randomBytes(length) {\n if (!this.isAvailable || !this._crypto) {\n throw new Error("Node.js random byte generator is not available.");\n }\n // Get random bytes (result is Buffer).\n let buffer = this._crypto.randomBytes(length);\n // Make sure we got the length that we requested.\n if (buffer.length !== length) {\n throw new Error("NodeRandomSource: got fewer bytes than requested");\n }\n // Allocate output array.\n const out = new Uint8Array(length);\n // Copy bytes from buffer to output.\n for (let i = 0; i < out.length; i++) {\n out[i] = buffer[i];\n }\n // Cleanup.\n (0, wipe_1.wipe)(buffer);\n return out;\n }\n}\nexports.NodeRandomSource = NodeRandomSource;\n//# sourceMappingURL=node.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/node.js?')},"./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/system.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.SystemRandomSource = void 0;\nconst browser_1 = __webpack_require__(/*! ./browser */ "./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/browser.js");\nconst node_1 = __webpack_require__(/*! ./node */ "./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/node.js");\nclass SystemRandomSource {\n constructor() {\n this.isAvailable = false;\n this.name = "";\n // Try browser.\n this._source = new browser_1.BrowserRandomSource();\n if (this._source.isAvailable) {\n this.isAvailable = true;\n this.name = "Browser";\n return;\n }\n // If no browser source, try Node.\n this._source = new node_1.NodeRandomSource();\n if (this._source.isAvailable) {\n this.isAvailable = true;\n this.name = "Node";\n return;\n }\n // No sources, we\'re out of options.\n }\n randomBytes(length) {\n if (!this.isAvailable) {\n throw new Error("System random byte generator is not available.");\n }\n return this._source.randomBytes(length);\n }\n}\nexports.SystemRandomSource = SystemRandomSource;\n//# sourceMappingURL=system.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/system.js?')},"./node_modules/.pnpm/@stablelib+wipe@1.0.1/node_modules/@stablelib/wipe/lib/wipe.js":(__unused_webpack_module,exports)=>{"use strict";eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Sets all values in the given array to zero and returns it.\n *\n * The fact that it sets bytes to zero can be relied on.\n *\n * There is no guarantee that this function makes data disappear from memory,\n * as runtime implementation can, for example, have copying garbage collector\n * that will make copies of sensitive data before we wipe it. Or that an\n * operating system will write our data to swap or sleep image. Another thing\n * is that an optimizing compiler can remove calls to this function or make it\n * no-op. There's nothing we can do with it, so we just do our best and hope\n * that everything will be okay and good will triumph over evil.\n */\nfunction wipe(array) {\n // Right now it's similar to array.fill(0). If it turns\n // out that runtimes optimize this call away, maybe\n // we can try something else.\n for (var i = 0; i < array.length; i++) {\n array[i] = 0;\n }\n return array;\n}\nexports.wipe = wipe;\n//# sourceMappingURL=wipe.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@stablelib+wipe@1.0.1/node_modules/@stablelib/wipe/lib/wipe.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/api.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module is Application Programming Interface (API) for **APG** - the ABNF Parser Generator.\n//\n// *Note on teminology.*\n// APG is a parser generator.\n// However, it really only generates a \"grammar object\" (see below) from the defining SABNF grammar.\n// The generated parser is incomplete at this stage.\n// Remaining, it is the job of the user to develop the generated parser from the grammar object and the **APG** Library (**apg-lib**).\n//\n// The following terminology my help clear up any confusion between the idea of a \"generated parser\" versus a \"generated grammar object\".\n\n// - The generating parser: **APG** is an **APG** parser (yes, there is a circular dependence between **apg-api** and **apg-lib**). We'll call it the generating parser.\n// - The target parser: **APG**'s goal is to generate a parser. We'll call it the target parser.\n// - The target grammar: this is the (ASCII) SABNF grammar defining the target parser.\n// - The target grammar object: **APG** parses the SABNF grammar and generates the JavaScript source for a target grammar object constructor function\n// and/or an actual grammar object.\n// - The final target parser: The user then develops the final target parser using the generated target grammar\n// object and the **APG** parsing library, **apg-lib**.\n// Throws execeptions on fatal errors.\n//\n// src: the input SABNF grammar
\n// may be one of:\n// - Buffer of bytes\n// - JavaScript string\n// - Array of integer character codes\nmodule.exports = function api(src) {\n const { Buffer } = __webpack_require__(/*! buffer */ \"./node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js\");\n const thisFileName = 'api.js: ';\n const thisObject = this;\n\n /* PRIVATE PROPERTIES */\n const apglib = __webpack_require__(/*! ../apg-lib/node-exports */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/node-exports.js\");\n const converter = __webpack_require__(/*! ../apg-conv-api/converter */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-conv-api/converter.js\");\n const scanner = __webpack_require__(/*! ./scanner */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner.js\");\n const parser = new (__webpack_require__(/*! ./parser */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/parser.js\"))();\n const { attributes, showAttributes, showAttributeErrors, showRuleDependencies } = __webpack_require__(/*! ./attributes */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/attributes.js\");\n const showRules = __webpack_require__(/*! ./show-rules */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/show-rules.js\");\n\n /* PRIVATE MEMBERS (FUNCTIONS) */\n /* Convert a phrase (array of character codes) to HTML. */\n const abnfToHtml = function abnfToHtml(chars, beg, len) {\n const NORMAL = 0;\n const CONTROL = 1;\n const INVALID = 2;\n const CONTROL_BEG = ``;\n const CONTROL_END = '';\n const INVALID_BEG = ``;\n const INVALID_END = '';\n let end;\n let html = '';\n const TRUE = true;\n while (TRUE) {\n if (!Array.isArray(chars) || chars.length === 0) {\n break;\n }\n if (typeof beg !== 'number') {\n throw new Error('abnfToHtml: beg must be type number');\n }\n if (beg >= chars.length) {\n break;\n }\n if (typeof len !== 'number' || beg + len >= chars.length) {\n end = chars.length;\n } else {\n end = beg + len;\n }\n let state = NORMAL;\n for (let i = beg; i < end; i += 1) {\n const ch = chars[i];\n if (ch >= 32 && ch <= 126) {\n /* normal - printable ASCII characters */\n if (state === CONTROL) {\n html += CONTROL_END;\n state = NORMAL;\n } else if (state === INVALID) {\n html += INVALID_END;\n state = NORMAL;\n }\n /* handle reserved HTML entity characters */\n switch (ch) {\n case 32:\n html += ' ';\n break;\n case 60:\n html += '<';\n break;\n case 62:\n html += '>';\n break;\n case 38:\n html += '&';\n break;\n case 34:\n html += '"';\n break;\n case 39:\n html += ''';\n break;\n case 92:\n html += '\';\n break;\n default:\n html += String.fromCharCode(ch);\n break;\n }\n } else if (ch === 9 || ch === 10 || ch === 13) {\n /* control characters */\n if (state === NORMAL) {\n html += CONTROL_BEG;\n state = CONTROL;\n } else if (state === INVALID) {\n html += INVALID_END + CONTROL_BEG;\n state = CONTROL;\n }\n if (ch === 9) {\n html += 'TAB';\n }\n if (ch === 10) {\n html += 'LF';\n }\n if (ch === 13) {\n html += 'CR';\n }\n } else {\n /* invalid characters */\n if (state === NORMAL) {\n html += INVALID_BEG;\n state = INVALID;\n } else if (state === CONTROL) {\n html += CONTROL_END + INVALID_BEG;\n state = INVALID;\n }\n /* display character as hexadecimal value */\n html += `\\\\x${apglib.utils.charToHex(ch)}`;\n }\n }\n if (state === INVALID) {\n html += INVALID_END;\n }\n if (state === CONTROL) {\n html += CONTROL_END;\n }\n break;\n }\n return html;\n };\n /* Convert a phrase (array of character codes) to ASCII text. */\n const abnfToAscii = function abnfToAscii(chars, beg, len) {\n let str = '';\n for (let i = beg; i < beg + len; i += 1) {\n const ch = chars[i];\n if (ch >= 32 && ch <= 126) {\n str += String.fromCharCode(ch);\n } else {\n switch (ch) {\n case 9:\n str += '\\\\t';\n break;\n case 10:\n str += '\\\\n';\n break;\n case 13:\n str += '\\\\r';\n break;\n default:\n str += '\\\\unknown';\n break;\n }\n }\n }\n return str;\n };\n /* translate lines (SABNF grammar) to ASCII text */\n const linesToAscii = function linesToAscii(lines) {\n let str = 'Annotated Input Grammar';\n lines.forEach((val) => {\n str += '\\n';\n str += `line no: ${val.lineNo}`;\n str += ` : char index: ${val.beginChar}`;\n str += ` : length: ${val.length}`;\n str += ` : abnf: ${abnfToAscii(thisObject.chars, val.beginChar, val.length)}`;\n });\n str += '\\n';\n return str;\n };\n /* translate lines (SABNF grammar) to HTML */\n const linesToHtml = function linesToHtml(lines) {\n let html = '';\n html += `\\n`;\n const title = 'Annotated Input Grammar';\n html += `\\n`;\n html += '';\n html += '';\n html += '\\n';\n lines.forEach((val) => {\n html += '';\n html += `';\n html += '\\n';\n });\n\n html += '
${title}
line
no.
first
char

length

text
${val.lineNo}`;\n html += `${val.beginChar}`;\n html += `${val.length}`;\n html += `${abnfToHtml(thisObject.chars, val.beginChar, val.length)}`;\n html += '
\\n';\n return html;\n };\n /* Format the error messages to HTML, for page display. */\n const errorsToHtml = function errorsToHtml(errors, lines, chars, title) {\n const [style] = apglib;\n let html = '';\n const errorArrow = `»`;\n html += `

\\n`;\n if (title && typeof title === 'string') {\n html += `\\n`;\n }\n html += '\\n';\n errors.forEach((val) => {\n let line;\n let relchar;\n let beg;\n let end;\n let text;\n let prefix = '';\n let suffix = '';\n if (lines.length === 0) {\n text = errorArrow;\n relchar = 0;\n } else {\n line = lines[val.line];\n beg = line.beginChar;\n if (val.char > beg) {\n prefix = abnfToHtml(chars, beg, val.char - beg);\n }\n beg = val.char;\n end = line.beginChar + line.length;\n if (beg < end) {\n suffix = abnfToHtml(chars, beg, end - beg);\n }\n text = prefix + errorArrow + suffix;\n relchar = val.char - line.beginChar;\n html += '';\n html += ``;\n html += '\\n';\n html += '';\n html += ``;\n html += '\\n';\n }\n });\n html += '
${title}
line
no.
line
offset
error
offset

text
${val.line}${line.beginChar}${relchar}${text}
↑: ${apglib.utils.stringToAsciiHtml(val.msg)}

\\n';\n return html;\n };\n /* Display an array of errors in ASCII text */\n const errorsToAscii = function errorsToAscii(errors, lines, chars) {\n let str;\n let line;\n let beg;\n let len;\n str = '';\n errors.forEach((error) => {\n line = lines[error.line];\n str += `${line.lineNo}: `;\n str += `${line.beginChar}: `;\n str += `${error.char - line.beginChar}: `;\n beg = line.beginChar;\n len = error.char - line.beginChar;\n str += abnfToAscii(chars, beg, len);\n str += ' >> ';\n beg = error.char;\n len = line.beginChar + line.length - error.char;\n str += abnfToAscii(chars, beg, len);\n str += '\\n';\n str += `${line.lineNo}: `;\n str += `${line.beginChar}: `;\n str += `${error.char - line.beginChar}: `;\n str += 'error: ';\n str += error.msg;\n str += '\\n';\n });\n return str;\n };\n let isScanned = false;\n let isParsed = false;\n let isTranslated = false;\n let haveAttributes = false;\n let attributeErrors = 0;\n let lineMap;\n\n /* PUBLIC PROPERTIES */\n // The input SABNF grammar as a JavaScript string.\n // this.sabnf;\n // The input SABNF grammar as an array of character codes.\n // this.chars;\n // An array of line objects, defining each line of the input SABNF grammar\n // - lineNo : the zero-based line number\n // - beginChar : offset (into `this.chars`) of the first character in the line\n // - length : the number of characters in the line\n // - textLength : the number of characters of text in the line, excluding the line ending characters\n // - endType : \"CRLF\", \"LF\", \"CR\" or \"none\" if the last line has no line ending characters\n // - invalidChars : `true` if the line contains invalid characters, `false` otherwise\n // this.lines;\n // An array of rule names and data.\n // - name : the rule name\n // - lower : the rule name in lower case\n // - index : the index of the rule (ordered by appearance in SABNF grammar)\n // - isBkr : `true` if this rule has been back referenced, `false` otherwise\n // - opcodes : array of opcodes for this rule\n // - attrs : the rule attributes\n // - ctrl : system data\n // this.rules;\n // An array of UDT names and data.\n // this.udts;\n // An array of errors, if any.\n // - line : the line number containing the error\n // - char : the character offset of the error\n // - msg : the error message\n this.errors = [];\n\n /* CONSTRUCTOR */\n if (Buffer.isBuffer(src)) {\n this.chars = converter.decode('BINARY', src);\n } else if (Array.isArray(src)) {\n this.chars = src.slice();\n } else if (typeof src === 'string') {\n this.chars = converter.decode('STRING', src);\n } else {\n throw new Error(`${thisFileName}input source is not a string, byte Buffer or character array`);\n }\n this.sabnf = converter.encode('STRING', this.chars);\n\n /* PUBLIC MEMBERS (FUNCTIONS) */\n // Scan the input SABNF grammar for invalid characters and catalog the lines via `this.lines`.\n // - strict : (optional) if `true`, all lines, including the last must end with CRLF (\\r\\n),\n // if `false` (in any JavaScript sense) then line endings may be any mix of CRLF, LF, CR, or end-of-file.\n // - trace (*) : (optional) a parser trace object, which will trace the parser that does the scan\n this.scan = function scan(strict, trace) {\n this.lines = scanner(this.chars, this.errors, strict, trace);\n isScanned = true;\n };\n // Parse the input SABNF grammar for correct syntax.\n // - strict : (optional) if `true`, the input grammar must be strict ABNF, conforming to [RFC 5234](https://tools.ietf.org/html/rfc5234)\n // and [RFC 7405](https://tools.ietf.org/html/rfc7405). No superset features allowed.\n // - trace (\\*) : (optional) a parser trace object, which will trace the syntax parser\n //\n // (*)NOTE: the trace option was used primarily during development.\n // Error detection and reporting is now fairly robust and tracing should be unnecessary. Use at your own peril.\n this.parse = function parse(strict, lite, trace) {\n if (!isScanned) {\n throw new Error(`${thisFileName}grammar not scanned`);\n }\n parser.syntax(this.chars, this.lines, this.errors, strict, lite, trace);\n isParsed = true;\n };\n // Translate the SABNF grammar syntax into the opcodes that will guide the parser for this grammar.\n this.translate = function translate() {\n if (!isParsed) {\n throw new Error(`${thisFileName}grammar not scanned and parsed`);\n }\n const ret = parser.semantic(this.chars, this.lines, this.errors);\n if (this.errors.length === 0) {\n this.rules = ret.rules;\n this.udts = ret.udts;\n lineMap = ret.lineMap;\n isTranslated = true;\n }\n };\n // Compute the attributes of each rule.\n this.attributes = function attrs() {\n if (!isTranslated) {\n throw new Error(`${thisFileName}grammar not scanned, parsed and translated`);\n }\n attributeErrors = attributes(this.rules, this.udts, lineMap, this.errors);\n haveAttributes = true;\n return attributeErrors;\n };\n // This function will perform the full suite of steps required to generate a parser grammar object\n // from the input SABNF grammar.\n this.generate = function generate(strict) {\n this.lines = scanner(this.chars, this.errors, strict);\n if (this.errors.length) {\n return;\n }\n parser.syntax(this.chars, this.lines, this.errors, strict);\n if (this.errors.length) {\n return;\n }\n const ret = parser.semantic(this.chars, this.lines, this.errors);\n if (this.errors.length) {\n return;\n }\n this.rules = ret.rules;\n this.udts = ret.udts;\n lineMap = ret.lineMap;\n\n attributeErrors = attributes(this.rules, this.udts, lineMap, this.errors);\n haveAttributes = true;\n };\n // Display the rules.\n // Must scan, parse and translate before calling this function, otherwise there are no rules to display.\n // - order\n // - \"index\" or \"i\", index order (default)\n // - \"alpha\" or \"a\", alphabetical order\n // - none of above, index order (default)\n this.displayRules = function displayRules(order = 'index') {\n if (!isTranslated) {\n throw new Error(`${thisFileName}grammar not scanned, parsed and translated`);\n }\n return showRules(this.rules, this.udts, order);\n };\n // Display the rule dependencies.\n // Must scan, parse, translate and compute attributes before calling this function.\n // Otherwise the rule dependencies are not known.\n // - order\n // - \"index\" or \"i\", index order (default)\n // - \"alpha\" or \"a\", alphabetical order\n // - \"type\" or \"t\", ordered by type (alphabetical within each type/group)\n // - none of above, index order (default)\n this.displayRuleDependencies = function displayRuleDependencies(order = 'index') {\n if (!haveAttributes) {\n throw new Error(`${thisFileName}no attributes - must be preceeded by call to attributes()`);\n }\n return showRuleDependencies(order);\n };\n // Display the attributes.\n // Must scan, parse, translate and compute attributes before calling this function.\n // - order\n // - \"index\" or \"i\", index order (default)\n // - \"alpha\" or \"a\", alphabetical order\n // - \"type\" or \"t\", ordered by type (alphabetical within each type/group)\n // - none of above, type order (default)\n this.displayAttributes = function displayAttributes(order = 'index') {\n if (!haveAttributes) {\n throw new Error(`${thisFileName}no attributes - must be preceeded by call to attributes()`);\n }\n if (attributeErrors) {\n showAttributeErrors(order);\n }\n return showAttributes(order);\n };\n this.displayAttributeErrors = function displayAttributeErrors() {\n if (!haveAttributes) {\n throw new Error(`${thisFileName}no attributes - must be preceeded by call to attributes()`);\n }\n return showAttributeErrors();\n };\n // Returns a parser grammar object constructor function as a JavaScript string.\n // This object can then be used to construct a parser.\n this.toSource = function toSource(config = undefined) {\n if (!haveAttributes) {\n throw new Error(`${thisFileName}can't generate parser source - must be preceeded by call to attributes()`);\n }\n if (attributeErrors) {\n throw new Error(`${thisFileName}can't generate parser source - attributes have ${attributeErrors} errors`);\n }\n return parser.generateSource(this.chars, this.lines, this.rules, this.udts, config);\n };\n // Returns a parser grammar object.\n // This grammar object may be used by the application to construct a parser.\n this.toObject = function toObject() {\n if (!haveAttributes) {\n throw new Error(`${thisFileName}can't generate parser source - must be preceeded by call to attributes()`);\n }\n if (attributeErrors) {\n throw new Error(`${thisFileName}can't generate parser source - attributes have ${attributeErrors} errors`);\n }\n return parser.generateObject(this.sabnf, this.rules, this.udts);\n };\n // Display errors in text format, suitable for `console.log()`.\n this.errorsToAscii = function errorsToAsciiFunc() {\n return errorsToAscii(this.errors, this.lines, this.chars);\n };\n // Display errors in HTML format, suitable for web page display.\n // (`apg-lib.css` required for proper styling)\n this.errorsToHtml = function errorsToHtmlFunc(title) {\n return errorsToHtml(this.errors, this.lines, this.chars, title);\n };\n // Generate an annotated the SABNF grammar display in text format.\n this.linesToAscii = function linesToAsciiFunc() {\n return linesToAscii(this.lines);\n };\n // Generate an annotated the SABNF grammar display in HTML format.\n // (`apg-lib.css` required for proper styling)\n this.linesToHtml = function linesToHtmlFunc() {\n return linesToHtml(this.lines);\n };\n // This function was only used by apg.html which has been abandoned.\n /*\n this.getAttributesObject = function () {\n return null;\n };\n */\n};\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/api.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/attributes.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('/* eslint-disable class-methods-use-this */\n/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// Attributes Validation\n//\n// It is well known that recursive-descent parsers will fail if a rule is left recursive.\n// Besides left recursion, there are a couple of other fatal attributes that need to be disclosed as well.\n// There are several non-fatal attributes that are of interest also.\n// This module will determine six different attributes listed here with simple examples.\n//\n// **fatal attributes**
\n// left recursion
\n// S = S "x" / "y"\n//\n// cyclic
\n// S = S\n//\n// infinite
\n// S = "y" S\n//\n// **non-fatal attributes** (but nice to know)
\n// nested recursion
\n// S = "a" S "b" / "y"\n//\n// right recursion
\n// S = "x" S / "y"\n//\n// empty string
\n// S = "x" S / ""\n//\n// Note that these are “aggregate” attributes, in that if the attribute is true it only means that it can be true,\n// not that it will always be true for every input string.\n// In the simple examples above the attributes may be obvious and definite – always true or false.\n// However, for a large grammar with possibly hundreds of rules and parse tree branches,\n// it can be obscure which branches lead to which attributes.\n// Furthermore, different input strings will lead the parser down different branches.\n// One input string may parse perfectly while another will hit a left-recursive branch and bottom out the call stack.\n//\n// It is for this reason that the APG parser generator computes these attributes.\n// When using the API the attributes call is optional but generating a parser without checking the attributes - proceed at your own peril.\n//\n// Additionally, the attribute phase will identify rule dependencies and mutually-recursive groups. For example,\n//\n// S = "a" A "b" / "y"
\n// A = "x"\n//\n// S is dependent on A but A is not dependent on S.\n//\n// S = "a" A "b" / "c"
\n// A = "x" S "y" / "z"\n//\n// S and A are dependent on one another and are mutually recursive.\nmodule.exports = (function exportAttributes() {\n const id = __webpack_require__(/*! ../apg-lib/identifiers */ "./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/identifiers.js");\n const { ruleAttributes, showAttributes, showAttributeErrors } = __webpack_require__(/*! ./rule-attributes */ "./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/rule-attributes.js");\n const { ruleDependencies, showRuleDependencies } = __webpack_require__(/*! ./rule-dependencies */ "./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/rule-dependencies.js");\n class State {\n constructor(rules, udts) {\n this.rules = rules;\n this.udts = udts;\n this.ruleCount = rules.length;\n this.udtCount = udts.length;\n this.startRule = 0;\n this.dependenciesComplete = false;\n this.attributesComplete = false;\n this.isMutuallyRecursive = false;\n this.ruleIndexes = this.indexArray(this.ruleCount);\n this.ruleAlphaIndexes = this.indexArray(this.ruleCount);\n this.ruleTypeIndexes = this.indexArray(this.ruleCount);\n this.udtIndexes = this.indexArray(this.udtCount);\n this.udtAlphaIndexes = this.indexArray(this.udtCount);\n this.attrsErrorCount = 0;\n this.attrs = [];\n this.attrsErrors = [];\n this.attrsWorking = [];\n this.ruleDeps = [];\n for (let i = 0; i < this.ruleCount; i += 1) {\n this.attrs.push(this.attrGen(this.rules[i]));\n this.attrsWorking.push(this.attrGen(this.rules[i]));\n this.ruleDeps.push(this.rdGen(rules[i], this.ruleCount, this.udtCount));\n }\n this.compRulesAlpha = this.compRulesAlpha.bind(this);\n this.compUdtsAlpha = this.compUdtsAlpha.bind(this);\n this.compRulesType = this.compRulesType.bind(this);\n this.compRulesGroup = this.compRulesGroup.bind(this);\n }\n\n // eslint-disable-next-line class-methods-use-this\n attrGen(rule) {\n return {\n left: false,\n nested: false,\n right: false,\n empty: false,\n finite: false,\n cyclic: false,\n leaf: false,\n isOpen: false,\n isComplete: false,\n rule,\n };\n }\n\n // eslint-disable-next-line class-methods-use-this\n attrInit(attr) {\n attr.left = false;\n attr.nested = false;\n attr.right = false;\n attr.empty = false;\n attr.finite = false;\n attr.cyclic = false;\n attr.leaf = false;\n attr.isOpen = false;\n attr.isComplete = false;\n }\n\n attrCopy(dst, src) {\n dst.left = src.left;\n dst.nested = src.nested;\n dst.right = src.right;\n dst.empty = src.empty;\n dst.finite = src.finite;\n dst.cyclic = src.cyclic;\n dst.leaf = src.leaf;\n dst.isOpen = src.isOpen;\n dst.isComplete = src.isComplete;\n dst.rule = src.rule;\n }\n\n rdGen(rule, ruleCount, udtCount) {\n const ret = {\n rule,\n recursiveType: id.ATTR_N,\n groupNumber: -1,\n refersTo: this.falseArray(ruleCount),\n refersToUdt: this.falseArray(udtCount),\n referencedBy: this.falseArray(ruleCount),\n };\n return ret;\n }\n\n typeToString(recursiveType) {\n switch (recursiveType) {\n case id.ATTR_N:\n return \' N\';\n case id.ATTR_R:\n return \' R\';\n case id.ATTR_MR:\n return \'MR\';\n default:\n return \'UNKNOWN\';\n }\n }\n\n falseArray(length) {\n const ret = [];\n if (length > 0) {\n for (let i = 0; i < length; i += 1) {\n ret.push(false);\n }\n }\n return ret;\n }\n\n falsifyArray(a) {\n for (let i = 0; i < a.length; i += 1) {\n a[i] = false;\n }\n }\n\n indexArray(length) {\n const ret = [];\n if (length > 0) {\n for (let i = 0; i < length; i += 1) {\n ret.push(i);\n }\n }\n return ret;\n }\n\n compRulesAlpha(left, right) {\n if (this.rules[left].lower < this.rules[right].lower) {\n return -1;\n }\n if (this.rules[left].lower > this.rules[right].lower) {\n return 1;\n }\n return 0;\n }\n\n compUdtsAlpha(left, right) {\n if (this.udts[left].lower < this.udts[right].lower) {\n return -1;\n }\n if (this.udts[left].lower > this.udts[right].lower) {\n return 1;\n }\n return 0;\n }\n\n compRulesType(left, right) {\n if (this.ruleDeps[left].recursiveType < this.ruleDeps[right].recursiveType) {\n return -1;\n }\n if (this.ruleDeps[left].recursiveType > this.ruleDeps[right].recursiveType) {\n return 1;\n }\n return 0;\n }\n\n compRulesGroup(left, right) {\n if (this.ruleDeps[left].recursiveType === id.ATTR_MR && this.ruleDeps[right].recursiveType === id.ATTR_MR) {\n if (this.ruleDeps[left].groupNumber < this.ruleDeps[right].groupNumber) {\n return -1;\n }\n if (this.ruleDeps[left].groupNumber > this.ruleDeps[right].groupNumber) {\n return 1;\n }\n }\n return 0;\n }\n }\n // eslint-disable-next-line no-unused-vars\n const attributes = function attributes(rules = [], udts = [], lineMap = [], errors = []) {\n // let i = 0;\n // Initialize the state. The state of the computation get passed around to multiple functions in multiple files.\n const state = new State(rules, udts);\n\n // Determine all rule dependencies\n // - which rules each rule refers to\n // - which rules reference each rule\n ruleDependencies(state);\n\n // Determine the attributes for each rule.\n ruleAttributes(state);\n if (state.attrsErrorCount) {\n errors.push({ line: 0, char: 0, msg: `${state.attrsErrorCount} attribute errors` });\n }\n\n // Return the number of attribute errors to the caller.\n return state.attrsErrorCount;\n };\n\n /* Destructuring assignment - see MDN Web Docs */\n return { attributes, showAttributes, showAttributeErrors, showRuleDependencies };\n})();\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/attributes.js?')},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/parser.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module converts an input SABNF grammar text file into a\n// grammar object that can be used with `apg-lib` in an application parser.\n// **apg** is, in fact itself, an ABNF parser that generates an SABNF parser.\n// It is based on the grammar
\n// `./dist/abnf-for-sabnf-grammar.bnf`.
\n// In its syntax phase, **apg** analyzes the user's input SABNF grammar for correct syntax, generating an AST as it goes.\n// In its semantic phase, **apg** translates the AST to generate the parser for the input grammar.\nmodule.exports = function exportParser() {\n const thisFileName = 'parser: ';\n const ApgLib = __webpack_require__(/*! ../apg-lib/node-exports */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/node-exports.js\");\n const id = ApgLib.ids;\n const syn = new (__webpack_require__(/*! ./syntax-callbacks */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/syntax-callbacks.js\"))();\n const sem = new (__webpack_require__(/*! ./semantic-callbacks */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/semantic-callbacks.js\"))();\n const sabnfGrammar = new (__webpack_require__(/*! ./sabnf-grammar */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/sabnf-grammar.js\"))();\n // eslint-disable-next-line new-cap\n const parser = new ApgLib.parser();\n // eslint-disable-next-line new-cap\n parser.ast = new ApgLib.ast();\n parser.callbacks = syn.callbacks;\n parser.ast.callbacks = sem.callbacks;\n\n /* find the line containing the given character index */\n const findLine = function findLine(lines, charIndex, charLength) {\n if (charIndex < 0 || charIndex >= charLength) {\n /* return error if out of range */\n return -1;\n }\n for (let i = 0; i < lines.length; i += 1) {\n if (charIndex >= lines[i].beginChar && charIndex < lines[i].beginChar + lines[i].length) {\n return i;\n }\n }\n /* should never reach here */\n return -1;\n };\n const translateIndex = function translateIndex(map, index) {\n let ret = -1;\n if (index < map.length) {\n for (let i = index; i < map.length; i += 1) {\n if (map[i] !== null) {\n ret = map[i];\n break;\n }\n }\n }\n return ret;\n };\n /* helper function when removing redundant opcodes */\n const reduceOpcodes = function reduceOpcodes(rules) {\n rules.forEach((rule) => {\n const opcodes = [];\n const map = [];\n let reducedIndex = 0;\n rule.opcodes.forEach((op) => {\n if (op.type === id.ALT && op.children.length === 1) {\n map.push(null);\n } else if (op.type === id.CAT && op.children.length === 1) {\n map.push(null);\n } else if (op.type === id.REP && op.min === 1 && op.max === 1) {\n map.push(null);\n } else {\n map.push(reducedIndex);\n opcodes.push(op);\n reducedIndex += 1;\n }\n });\n map.push(reducedIndex);\n /* translate original opcode indexes to the reduced set. */\n opcodes.forEach((op) => {\n if (op.type === id.ALT || op.type === id.CAT) {\n for (let i = 0; i < op.children.length; i += 1) {\n op.children[i] = translateIndex(map, op.children[i]);\n }\n }\n });\n rule.opcodes = opcodes;\n });\n };\n /* Parse the grammar - the syntax phase. */\n /* SABNF grammar syntax errors are caught and reported here. */\n this.syntax = function syntax(chars, lines, errors, strict, lite, trace) {\n if (trace) {\n if (trace.traceObject !== 'traceObject') {\n throw new TypeError(`${thisFileName}trace argument is not a trace object`);\n }\n parser.trace = trace;\n }\n const data = {};\n data.errors = errors;\n data.strict = !!strict;\n data.lite = !!lite;\n data.lines = lines;\n data.findLine = findLine;\n data.charsLength = chars.length;\n data.ruleCount = 0;\n const result = parser.parse(sabnfGrammar, 'file', chars, data);\n if (!result.success) {\n errors.push({\n line: 0,\n char: 0,\n msg: 'syntax analysis of input grammar failed',\n });\n }\n };\n /* Parse the grammar - the semantic phase, translates the AST. */\n /* SABNF grammar syntax errors are caught and reported here. */\n this.semantic = function semantic(chars, lines, errors) {\n const data = {};\n data.errors = errors;\n data.lines = lines;\n data.findLine = findLine;\n data.charsLength = chars.length;\n parser.ast.translate(data);\n if (errors.length) {\n return null;\n }\n /* Remove unneeded operators. */\n /* ALT operators with a single alternate */\n /* CAT operators with a single phrase to concatenate */\n /* REP(1,1) operators (`1*1RuleName` or `1RuleName` is the same as just `RuleName`.) */\n reduceOpcodes(data.rules);\n return {\n rules: data.rules,\n udts: data.udts,\n lineMap: data.rulesLineMap,\n };\n };\n // Generate a grammar constructor function.\n // An object instantiated from this constructor is used with the `apg-lib` `parser()` function.\n this.generateSource = function generateSource(chars, lines, rules, udts, config) {\n let source = '';\n let typescript = false;\n let lite = false;\n // config may have multiple grammar object type options in which case\n // --typescript > --lite > no options\n if (config) {\n if (config.typescript) {\n typescript = true;\n lite = false;\n } else if (config.lite) {\n typescript = false;\n lite = true;\n }\n }\n let i;\n let bkrname;\n let bkrlower;\n let opcodeCount = 0;\n let charCodeMin = Infinity;\n let charCodeMax = 0;\n const ruleNames = [];\n const udtNames = [];\n let alt = 0;\n let cat = 0;\n let rnm = 0;\n let udt = 0;\n let rep = 0;\n let and = 0;\n let not = 0;\n let tls = 0;\n let tbs = 0;\n let trg = 0;\n let bkr = 0;\n let bka = 0;\n let bkn = 0;\n let abg = 0;\n let aen = 0;\n rules.forEach((rule) => {\n ruleNames.push(rule.lower);\n opcodeCount += rule.opcodes.length;\n rule.opcodes.forEach((op) => {\n switch (op.type) {\n case id.ALT:\n alt += 1;\n break;\n case id.CAT:\n cat += 1;\n break;\n case id.RNM:\n rnm += 1;\n break;\n case id.UDT:\n udt += 1;\n break;\n case id.REP:\n rep += 1;\n break;\n case id.AND:\n and += 1;\n break;\n case id.NOT:\n not += 1;\n break;\n case id.BKA:\n bka += 1;\n break;\n case id.BKN:\n bkn += 1;\n break;\n case id.BKR:\n bkr += 1;\n break;\n case id.ABG:\n abg += 1;\n break;\n case id.AEN:\n aen += 1;\n break;\n case id.TLS:\n tls += 1;\n for (i = 0; i < op.string.length; i += 1) {\n if (op.string[i] < charCodeMin) {\n charCodeMin = op.string[i];\n }\n if (op.string[i] > charCodeMax) {\n charCodeMax = op.string[i];\n }\n }\n break;\n case id.TBS:\n tbs += 1;\n for (i = 0; i < op.string.length; i += 1) {\n if (op.string[i] < charCodeMin) {\n charCodeMin = op.string[i];\n }\n if (op.string[i] > charCodeMax) {\n charCodeMax = op.string[i];\n }\n }\n break;\n case id.TRG:\n trg += 1;\n if (op.min < charCodeMin) {\n charCodeMin = op.min;\n }\n if (op.max > charCodeMax) {\n charCodeMax = op.max;\n }\n break;\n default:\n throw new Error('generateSource: unrecognized opcode');\n }\n });\n });\n ruleNames.sort();\n if (udts.length > 0) {\n udts.forEach((udtFunc) => {\n udtNames.push(udtFunc.lower);\n });\n udtNames.sort();\n }\n source += '// copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved
\\n';\n source += '// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
\\n';\n source += '//\\n';\n source += '// Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)\\n';\n if (config) {\n if (config.funcName) {\n source += `const ${config.funcName} = function grammar(){\\n`;\n } else if (typescript) {\n source += 'export function grammar(){\\n';\n } else if (lite) {\n source += 'export default function grammar(){\\n';\n } else {\n source += `module.exports = function grammar(){\\n`;\n }\n } else {\n source += `module.exports = function grammar(){\\n`;\n }\n source += ' // ```\\n';\n source += ' // SUMMARY\\n';\n source += ` // rules = ${rules.length}\\n`;\n source += ` // udts = ${udts.length}\\n`;\n source += ` // opcodes = ${opcodeCount}\\n`;\n source += ' // --- ABNF original opcodes\\n';\n source += ` // ALT = ${alt}\\n`;\n source += ` // CAT = ${cat}\\n`;\n source += ` // REP = ${rep}\\n`;\n source += ` // RNM = ${rnm}\\n`;\n source += ` // TLS = ${tls}\\n`;\n source += ` // TBS = ${tbs}\\n`;\n source += ` // TRG = ${trg}\\n`;\n source += ' // --- SABNF superset opcodes\\n';\n source += ` // UDT = ${udt}\\n`;\n source += ` // AND = ${and}\\n`;\n source += ` // NOT = ${not}\\n`;\n if (!lite) {\n source += ` // BKA = ${bka}\\n`;\n source += ` // BKN = ${bkn}\\n`;\n source += ` // BKR = ${bkr}\\n`;\n source += ` // ABG = ${abg}\\n`;\n source += ` // AEN = ${aen}\\n`;\n }\n source += ' // characters = [';\n if (tls + tbs + trg === 0) {\n source += ' none defined ]';\n } else {\n source += `${charCodeMin} - ${charCodeMax}]`;\n }\n if (udt > 0) {\n source += ' + user defined';\n }\n source += '\\n';\n source += ' // ```\\n';\n source += ' /* OBJECT IDENTIFIER (for internal parser use) */\\n';\n source += \" this.grammarObject = 'grammarObject';\\n\";\n source += '\\n';\n source += ' /* RULES */\\n';\n source += ' this.rules = [];\\n';\n rules.forEach((rule, ii) => {\n let thisRule = ' this.rules[';\n thisRule += ii;\n thisRule += \"] = { name: '\";\n thisRule += rule.name;\n thisRule += \"', lower: '\";\n thisRule += rule.lower;\n thisRule += \"', index: \";\n thisRule += rule.index;\n thisRule += ', isBkr: ';\n thisRule += rule.isBkr;\n thisRule += ' };\\n';\n source += thisRule;\n });\n source += '\\n';\n source += ' /* UDTS */\\n';\n source += ' this.udts = [];\\n';\n if (udts.length > 0) {\n udts.forEach((udtFunc, ii) => {\n let thisUdt = ' this.udts[';\n thisUdt += ii;\n thisUdt += \"] = { name: '\";\n thisUdt += udtFunc.name;\n thisUdt += \"', lower: '\";\n thisUdt += udtFunc.lower;\n thisUdt += \"', index: \";\n thisUdt += udtFunc.index;\n thisUdt += ', empty: ';\n thisUdt += udtFunc.empty;\n thisUdt += ', isBkr: ';\n thisUdt += udtFunc.isBkr;\n thisUdt += ' };\\n';\n source += thisUdt;\n });\n }\n source += '\\n';\n source += ' /* OPCODES */\\n';\n rules.forEach((rule, ruleIndex) => {\n if (ruleIndex > 0) {\n source += '\\n';\n }\n source += ` /* ${rule.name} */\\n`;\n source += ` this.rules[${ruleIndex}].opcodes = [];\\n`;\n rule.opcodes.forEach((op, opIndex) => {\n let prefix;\n switch (op.type) {\n case id.ALT:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${\n op.type\n }, children: [${op.children.toString()}] };// ALT\\n`;\n break;\n case id.CAT:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${\n op.type\n }, children: [${op.children.toString()}] };// CAT\\n`;\n break;\n case id.RNM:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type}, index: ${\n op.index\n } };// RNM(${rules[op.index].name})\\n`;\n break;\n case id.BKR:\n if (op.index >= rules.length) {\n bkrname = udts[op.index - rules.length].name;\n bkrlower = udts[op.index - rules.length].lower;\n } else {\n bkrname = rules[op.index].name;\n bkrlower = rules[op.index].lower;\n }\n prefix = '%i';\n if (op.bkrCase === id.BKR_MODE_CS) {\n prefix = '%s';\n }\n if (op.bkrMode === id.BKR_MODE_UM) {\n prefix += '%u';\n } else {\n prefix += '%p';\n }\n bkrname = prefix + bkrname;\n source +=\n ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type}, index: ${op.index}, lower: '${bkrlower}'` +\n `, bkrCase: ${op.bkrCase}, bkrMode: ${op.bkrMode} };// BKR(\\\\${bkrname})\\n`;\n break;\n case id.UDT:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type}, empty: ${\n op.empty\n }, index: ${op.index} };// UDT(${udts[op.index].name})\\n`;\n break;\n case id.REP:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type}, min: ${op.min}, max: ${op.max} };// REP\\n`;\n break;\n case id.AND:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type} };// AND\\n`;\n break;\n case id.NOT:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type} };// NOT\\n`;\n break;\n case id.ABG:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type} };// ABG(%^)\\n`;\n break;\n case id.AEN:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type} };// AEN(%$)\\n`;\n break;\n case id.BKA:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type} };// BKA\\n`;\n break;\n case id.BKN:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type} };// BKN\\n`;\n break;\n case id.TLS:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${\n op.type\n }, string: [${op.string.toString()}] };// TLS\\n`;\n break;\n case id.TBS:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${\n op.type\n }, string: [${op.string.toString()}] };// TBS\\n`;\n break;\n case id.TRG:\n source += ` this.rules[${ruleIndex}].opcodes[${opIndex}] = { type: ${op.type}, min: ${op.min}, max: ${op.max} };// TRG\\n`;\n break;\n default:\n throw new Error('parser.js: ~143: unrecognized opcode');\n }\n });\n });\n source += '\\n';\n source += ' // The `toString()` function will display the original grammar file(s) that produced these opcodes.\\n';\n source += ' this.toString = function toString(){\\n';\n source += ' let str = \"\";\\n';\n let str;\n lines.forEach((line) => {\n const end = line.beginChar + line.length;\n str = '';\n source += ' str += \"';\n for (let ii = line.beginChar; ii < end; ii += 1) {\n switch (chars[ii]) {\n case 9:\n str = ' ';\n break;\n case 10:\n str = '\\\\n';\n break;\n case 13:\n str = '\\\\r';\n break;\n case 34:\n str = '\\\\\"';\n break;\n case 92:\n str = '\\\\\\\\';\n break;\n default:\n str = String.fromCharCode(chars[ii]);\n break;\n }\n source += str;\n }\n source += '\";\\n';\n });\n source += ' return str;\\n';\n source += ' }\\n';\n source += '}\\n';\n return source;\n };\n // Generate a grammar file object.\n // Returns the same object as instantiating the constructor function returned by
\n // `this.generateSource()`.
\n this.generateObject = function generateObject(stringArg, rules, udts) {\n const obj = {};\n const ruleNames = [];\n const udtNames = [];\n const string = stringArg.slice(0);\n obj.grammarObject = 'grammarObject';\n rules.forEach((rule) => {\n ruleNames.push(rule.lower);\n });\n ruleNames.sort();\n if (udts.length > 0) {\n udts.forEach((udtFunc) => {\n udtNames.push(udtFunc.lower);\n });\n udtNames.sort();\n }\n obj.callbacks = [];\n ruleNames.forEach((name) => {\n obj.callbacks[name] = false;\n });\n if (udts.length > 0) {\n udtNames.forEach((name) => {\n obj.callbacks[name] = false;\n });\n }\n obj.rules = rules;\n obj.udts = udts;\n obj.toString = function toStringFunc() {\n return string;\n };\n return obj;\n };\n};\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/parser.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/rule-attributes.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module does the heavy lifting for attribute generation.\nmodule.exports = (function exportRuleAttributes() {\n const id = __webpack_require__(/*! ../apg-lib/identifiers */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/identifiers.js\");\n const thisFile = 'rule-attributes.js';\n let state = null;\n function isEmptyOnly(attr) {\n if (attr.left || attr.nested || attr.right || attr.cyclic) {\n return false;\n }\n return attr.empty;\n }\n function isRecursive(attr) {\n if (attr.left || attr.nested || attr.right || attr.cyclic) {\n return true;\n }\n return false;\n }\n function isCatNested(attrs, count) {\n let i = 0;\n let j = 0;\n let k = 0;\n /* 1. if any child is nested, CAT is nested */\n for (i = 0; i < count; i += 1) {\n if (attrs[i].nested) {\n return true;\n }\n }\n /* 2.) the left-most right recursive child\n is followed by at least one non-empty child */\n for (i = 0; i < count; i += 1) {\n if (attrs[i].right && !attrs[i].leaf) {\n for (j = i + 1; j < count; j += 1) {\n if (!isEmptyOnly(attrs[j])) {\n return true;\n }\n }\n }\n }\n /* 3.) the right-most left recursive child\n is preceded by at least one non-empty child */\n for (i = count - 1; i >= 0; i -= 1) {\n if (attrs[i].left && !attrs[i].leaf) {\n for (j = i - 1; j >= 0; j -= 1) {\n if (!isEmptyOnly(attrs[j])) {\n return true;\n }\n }\n }\n }\n /* 4. there is at lease one recursive child between\n the left-most and right-most non-recursive, non-empty children */\n for (i = 0; i < count; i += 1) {\n if (!attrs[i].empty && !isRecursive(attrs[i])) {\n for (j = i + 1; j < count; j += 1) {\n if (isRecursive(attrs[j])) {\n for (k = j + 1; k < count; k += 1) {\n if (!attrs[k].empty && !isRecursive(attrs[k])) {\n return true;\n }\n }\n }\n }\n }\n }\n\n /* none of the above */\n return false;\n }\n function isCatCyclic(attrs, count) {\n /* if all children are cyclic, CAT is cyclic */\n for (let i = 0; i < count; i += 1) {\n if (!attrs[i].cyclic) {\n return false;\n }\n }\n return true;\n }\n function isCatLeft(attrs, count) {\n /* if the left-most non-empty is left, CAT is left */\n for (let i = 0; i < count; i += 1) {\n if (attrs[i].left) {\n return true;\n }\n if (!attrs[i].empty) {\n return false;\n }\n /* keep looking */\n }\n return false; /* all left-most are empty */\n }\n function isCatRight(attrs, count) {\n /* if the right-most non-empty is right, CAT is right */\n for (let i = count - 1; i >= 0; i -= 1) {\n if (attrs[i].right) {\n return true;\n }\n if (!attrs[i].empty) {\n return false;\n }\n /* keep looking */\n }\n return false;\n }\n function isCatEmpty(attrs, count) {\n /* if all children are empty, CAT is empty */\n for (let i = 0; i < count; i += 1) {\n if (!attrs[i].empty) {\n return false;\n }\n }\n return true;\n }\n function isCatFinite(attrs, count) {\n /* if all children are finite, CAT is finite */\n for (let i = 0; i < count; i += 1) {\n if (!attrs[i].finite) {\n return false;\n }\n }\n return true;\n }\n function cat(stateArg, opcodes, opIndex, iAttr) {\n let i = 0;\n const opCat = opcodes[opIndex];\n const count = opCat.children.length;\n\n /* generate an empty array of child attributes */\n const childAttrs = [];\n for (i = 0; i < count; i += 1) {\n childAttrs.push(stateArg.attrGen());\n }\n for (i = 0; i < count; i += 1) {\n // eslint-disable-next-line no-use-before-define\n opEval(stateArg, opcodes, opCat.children[i], childAttrs[i]);\n }\n iAttr.left = isCatLeft(childAttrs, count);\n iAttr.right = isCatRight(childAttrs, count);\n iAttr.nested = isCatNested(childAttrs, count);\n iAttr.empty = isCatEmpty(childAttrs, count);\n iAttr.finite = isCatFinite(childAttrs, count);\n iAttr.cyclic = isCatCyclic(childAttrs, count);\n }\n function alt(stateArg, opcodes, opIndex, iAttr) {\n let i = 0;\n const opAlt = opcodes[opIndex];\n const count = opAlt.children.length;\n\n /* generate an empty array of child attributes */\n const childAttrs = [];\n for (i = 0; i < count; i += 1) {\n childAttrs.push(stateArg.attrGen());\n }\n for (i = 0; i < count; i += 1) {\n // eslint-disable-next-line no-use-before-define\n opEval(stateArg, opcodes, opAlt.children[i], childAttrs[i]);\n }\n\n /* if any child attribute is true, ALT is true */\n iAttr.left = false;\n iAttr.right = false;\n iAttr.nested = false;\n iAttr.empty = false;\n iAttr.finite = false;\n iAttr.cyclic = false;\n for (i = 0; i < count; i += 1) {\n if (childAttrs[i].left) {\n iAttr.left = true;\n }\n if (childAttrs[i].nested) {\n iAttr.nested = true;\n }\n if (childAttrs[i].right) {\n iAttr.right = true;\n }\n if (childAttrs[i].empty) {\n iAttr.empty = true;\n }\n if (childAttrs[i].finite) {\n iAttr.finite = true;\n }\n if (childAttrs[i].cyclic) {\n iAttr.cyclic = true;\n }\n }\n }\n function bkr(stateArg, opcodes, opIndex, iAttr) {\n const opBkr = opcodes[opIndex];\n if (opBkr.index >= stateArg.ruleCount) {\n /* use UDT values */\n iAttr.empty = stateArg.udts[opBkr.index - stateArg.ruleCount].empty;\n iAttr.finite = true;\n } else {\n /* use the empty and finite values from the back referenced rule */\n // eslint-disable-next-line no-use-before-define\n ruleAttrsEval(stateArg, opBkr.index, iAttr);\n\n /* however, this is a terminal node like TLS */\n iAttr.left = false;\n iAttr.nested = false;\n iAttr.right = false;\n iAttr.cyclic = false;\n }\n }\n\n function opEval(stateArg, opcodes, opIndex, iAttr) {\n stateArg.attrInit(iAttr);\n const opi = opcodes[opIndex];\n switch (opi.type) {\n case id.ALT:\n alt(stateArg, opcodes, opIndex, iAttr);\n break;\n case id.CAT:\n cat(stateArg, opcodes, opIndex, iAttr);\n break;\n case id.REP:\n opEval(stateArg, opcodes, opIndex + 1, iAttr);\n if (opi.min === 0) {\n iAttr.empty = true;\n iAttr.finite = true;\n }\n break;\n case id.RNM:\n // eslint-disable-next-line no-use-before-define\n ruleAttrsEval(stateArg, opcodes[opIndex].index, iAttr);\n break;\n case id.BKR:\n bkr(stateArg, opcodes, opIndex, iAttr);\n break;\n case id.AND:\n case id.NOT:\n case id.BKA:\n case id.BKN:\n opEval(stateArg, opcodes, opIndex + 1, iAttr);\n iAttr.empty = true;\n break;\n case id.TLS:\n iAttr.empty = !opcodes[opIndex].string.length;\n iAttr.finite = true;\n iAttr.cyclic = false;\n break;\n case id.TBS:\n case id.TRG:\n iAttr.empty = false;\n iAttr.finite = true;\n iAttr.cyclic = false;\n break;\n case id.UDT:\n iAttr.empty = opi.empty;\n iAttr.finite = true;\n iAttr.cyclic = false;\n break;\n case id.ABG:\n case id.AEN:\n iAttr.empty = true;\n iAttr.finite = true;\n iAttr.cyclic = false;\n break;\n default:\n throw new Error(`unknown opcode type: ${opi}`);\n }\n }\n // The main logic for handling rules that:\n // - have already be evaluated\n // - have not been evaluated and is the first occurrence on this branch\n // - second occurrence on this branch for the start rule\n // - second occurrence on this branch for non-start rules\n function ruleAttrsEval(stateArg, ruleIndex, iAttr) {\n const attri = stateArg.attrsWorking[ruleIndex];\n if (attri.isComplete) {\n /* just use the completed values */\n stateArg.attrCopy(iAttr, attri);\n } else if (!attri.isOpen) {\n /* open the rule and traverse it */\n attri.isOpen = true;\n opEval(stateArg, attri.rule.opcodes, 0, iAttr);\n /* complete this rule's attributes */\n attri.left = iAttr.left;\n attri.right = iAttr.right;\n attri.nested = iAttr.nested;\n attri.empty = iAttr.empty;\n attri.finite = iAttr.finite;\n attri.cyclic = iAttr.cyclic;\n attri.leaf = false;\n attri.isOpen = false;\n attri.isComplete = true;\n } else if (ruleIndex === stateArg.startRule) {\n /* use recursive leaf values */\n if (ruleIndex === stateArg.startRule) {\n iAttr.left = true;\n iAttr.right = true;\n iAttr.cyclic = true;\n iAttr.leaf = true;\n }\n } else {\n /* non-start rule terminal leaf */\n iAttr.finite = true;\n }\n }\n // The main driver for the attribute generation.\n const ruleAttributes = (stateArg) => {\n state = stateArg;\n let i = 0;\n let j = 0;\n const iAttr = state.attrGen();\n for (i = 0; i < state.ruleCount; i += 1) {\n /* initialize working attributes */\n for (j = 0; j < state.ruleCount; j += 1) {\n state.attrInit(state.attrsWorking[j]);\n }\n state.startRule = i;\n ruleAttrsEval(state, i, iAttr);\n\n /* save off the working attributes for this rule */\n state.attrCopy(state.attrs[i], state.attrsWorking[i]);\n }\n state.attributesComplete = true;\n let attri = null;\n for (i = 0; i < state.ruleCount; i += 1) {\n attri = state.attrs[i];\n if (attri.left || !attri.finite || attri.cyclic) {\n const temp = state.attrGen(attri.rule);\n state.attrCopy(temp, attri);\n state.attrsErrors.push(temp);\n state.attrsErrorCount += 1;\n }\n }\n };\n const truth = (val) => (val ? 't' : 'f');\n const tError = (val) => (val ? 'e' : 'f');\n const fError = (val) => (val ? 't' : 'e');\n const showAttr = (seq, index, attr, dep) => {\n let str = `${seq}:${index}:`;\n str += `${tError(attr.left)} `;\n str += `${truth(attr.nested)} `;\n str += `${truth(attr.right)} `;\n str += `${tError(attr.cyclic)} `;\n str += `${fError(attr.finite)} `;\n str += `${truth(attr.empty)}:`;\n str += `${state.typeToString(dep.recursiveType)}:`;\n str += dep.recursiveType === id.ATTR_MR ? dep.groupNumber : '-';\n str += `:${attr.rule.name}\\n`;\n return str;\n };\n\n const showLegend = () => {\n let str = 'LEGEND - t=true, f=false, e=error\\n';\n str += 'sequence:rule index:left nested right cyclic finite empty:type:group number:rule name\\n';\n return str;\n };\n const showAttributeErrors = () => {\n let attri = null;\n let depi = null;\n let str = '';\n str += 'RULE ATTRIBUTES WITH ERRORS\\n';\n str += showLegend();\n if (state.attrsErrorCount) {\n for (let i = 0; i < state.attrsErrorCount; i += 1) {\n attri = state.attrsErrors[i];\n depi = state.ruleDeps[attri.rule.index];\n str += showAttr(i, attri.rule.index, attri, depi);\n }\n } else {\n str += '\\n';\n }\n return str;\n };\n\n const show = (type) => {\n let i = 0;\n let ii = 0;\n let attri = null;\n let depi = null;\n let str = '';\n let { ruleIndexes } = state;\n // let udtIndexes = state.udtIndexes;\n if (type === 97) {\n ruleIndexes = state.ruleAlphaIndexes;\n // udtIndexes = state.udtAlphaIndexes;\n } else if (type === 116) {\n ruleIndexes = state.ruleTypeIndexes;\n // udtIndexes = state.udtAlphaIndexes;\n }\n /* show all attributes */\n for (i = 0; i < state.ruleCount; i += 1) {\n ii = ruleIndexes[i];\n attri = state.attrs[ii];\n depi = state.ruleDeps[ii];\n str += showAttr(i, ii, attri, depi);\n }\n return str;\n };\n\n // Display the rule attributes.\n // - order\n // - \"index\" or \"i\", index order (default)\n // - \"alpha\" or \"a\", alphabetical order\n // - \"type\" or \"t\", ordered by type (alphabetical within each type/group)\n // - none of above, index order (default)\n const showAttributes = (order = 'index') => {\n if (!state.attributesComplete) {\n throw new Error(`${thisFile}:showAttributes: attributes not available`);\n }\n let str = '';\n const leader = 'RULE ATTRIBUTES\\n';\n if (order.charCodeAt(0) === 97) {\n str += 'alphabetical by rule name\\n';\n str += leader;\n str += showLegend();\n str += show(97);\n } else if (order.charCodeAt(0) === 116) {\n str += 'ordered by rule type\\n';\n str += leader;\n str += showLegend();\n str += show(116);\n } else {\n str += 'ordered by rule index\\n';\n str += leader;\n str += showLegend();\n str += show();\n }\n return str;\n };\n\n /* Destructuring assignment - see MDN Web Docs */\n return { ruleAttributes, showAttributes, showAttributeErrors };\n})();\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/rule-attributes.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/rule-dependencies.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// Determine rule dependencies and types.\n// For each rule, determine which other rules it refers to\n// and which of the other rules refer back to it.\n//\n// Rule types are:\n// - non-recursive - the rule never refers to itself, even indirectly\n// - recursive - the rule refers to itself, possibly indirectly\n// - mutually-recursive - belongs to a group of two or more rules, each of which refers to every other rule in the group, including itself.\nmodule.exports = (() => {\n const id = __webpack_require__(/*! ../apg-lib/identifiers */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/identifiers.js\");\n let state = null; /* keep a global reference to the state for the show functions */\n\n /* scan the opcodes of the indexed rule and discover which rules it references and which rule refer back to it */\n const scan = (ruleCount, ruleDeps, index, isScanned) => {\n let i = 0;\n let j = 0;\n const rdi = ruleDeps[index];\n isScanned[index] = true;\n const op = rdi.rule.opcodes;\n for (i = 0; i < op.length; i += 1) {\n const opi = op[i];\n if (opi.type === id.RNM) {\n rdi.refersTo[opi.index] = true;\n if (!isScanned[opi.index]) {\n scan(ruleCount, ruleDeps, opi.index, isScanned);\n }\n for (j = 0; j < ruleCount; j += 1) {\n if (ruleDeps[opi.index].refersTo[j]) {\n rdi.refersTo[j] = true;\n }\n }\n } else if (opi.type === id.UDT) {\n rdi.refersToUdt[opi.index] = true;\n } else if (opi.type === id.BKR) {\n if (opi.index < ruleCount) {\n rdi.refersTo[opi.index] = true;\n if (!isScanned[opi.index]) {\n scan(ruleCount, ruleDeps, opi.index, isScanned);\n }\n } else {\n rdi.refersToUdt[ruleCount - opi.index] = true;\n }\n }\n }\n };\n // Determine the rule dependencies, types and mutually recursive groups.\n const ruleDependencies = (stateArg) => {\n state = stateArg; /* make it global */\n let i = 0;\n let j = 0;\n let groupCount = 0;\n let rdi = null;\n let rdj = null;\n let newGroup = false;\n state.dependenciesComplete = false;\n\n /* make a working array of rule scanned markers */\n const isScanned = state.falseArray(state.ruleCount);\n\n /* discover the rule dependencies */\n for (i = 0; i < state.ruleCount; i += 1) {\n state.falsifyArray(isScanned);\n scan(state.ruleCount, state.ruleDeps, i, isScanned);\n }\n /* discover all rules referencing each rule */\n for (i = 0; i < state.ruleCount; i += 1) {\n for (j = 0; j < state.ruleCount; j += 1) {\n if (i !== j) {\n if (state.ruleDeps[j].refersTo[i]) {\n state.ruleDeps[i].referencedBy[j] = true;\n }\n }\n }\n }\n /* find the non-recursive and recursive types */\n for (i = 0; i < state.ruleCount; i += 1) {\n state.ruleDeps[i].recursiveType = id.ATTR_N;\n if (state.ruleDeps[i].refersTo[i]) {\n state.ruleDeps[i].recursiveType = id.ATTR_R;\n }\n }\n\n /* find the mutually-recursive groups, if any */\n groupCount = -1;\n for (i = 0; i < state.ruleCount; i += 1) {\n rdi = state.ruleDeps[i];\n if (rdi.recursiveType === id.ATTR_R) {\n newGroup = true;\n for (j = 0; j < state.ruleCount; j += 1) {\n if (i !== j) {\n rdj = state.ruleDeps[j];\n if (rdj.recursiveType === id.ATTR_R) {\n if (rdi.refersTo[j] && rdj.refersTo[i]) {\n if (newGroup) {\n groupCount += 1;\n rdi.recursiveType = id.ATTR_MR;\n rdi.groupNumber = groupCount;\n newGroup = false;\n }\n rdj.recursiveType = id.ATTR_MR;\n rdj.groupNumber = groupCount;\n }\n }\n }\n }\n }\n }\n state.isMutuallyRecursive = groupCount > -1;\n\n /* sort the rules/UDTS */\n state.ruleAlphaIndexes.sort(state.compRulesAlpha);\n state.ruleTypeIndexes.sort(state.compRulesAlpha);\n state.ruleTypeIndexes.sort(state.compRulesType);\n if (state.isMutuallyRecursive) {\n state.ruleTypeIndexes.sort(state.compRulesGroup);\n }\n if (state.udtCount) {\n state.udtAlphaIndexes.sort(state.compUdtsAlpha);\n }\n\n state.dependenciesComplete = true;\n };\n const show = (type = null) => {\n let i = 0;\n let j = 0;\n let count = 0;\n let startSeg = 0;\n const maxRule = state.ruleCount - 1;\n const maxUdt = state.udtCount - 1;\n const lineLength = 100;\n let str = '';\n let pre = '';\n const toArrow = '=> ';\n const byArrow = '<= ';\n let first = false;\n let rdi = null;\n let { ruleIndexes } = state;\n let { udtIndexes } = state;\n if (type === 97) {\n ruleIndexes = state.ruleAlphaIndexes;\n udtIndexes = state.udtAlphaIndexes;\n } else if (type === 116) {\n ruleIndexes = state.ruleTypeIndexes;\n udtIndexes = state.udtAlphaIndexes;\n }\n for (i = 0; i < state.ruleCount; i += 1) {\n rdi = state.ruleDeps[ruleIndexes[i]];\n pre = `${ruleIndexes[i]}:${state.typeToString(rdi.recursiveType)}:`;\n if (state.isMutuallyRecursive) {\n pre += rdi.groupNumber > -1 ? rdi.groupNumber : '-';\n pre += ':';\n }\n pre += ' ';\n str += `${pre + state.rules[ruleIndexes[i]].name}\\n`;\n first = true;\n count = 0;\n startSeg = str.length;\n str += pre;\n for (j = 0; j < state.ruleCount; j += 1) {\n if (rdi.refersTo[ruleIndexes[j]]) {\n if (first) {\n str += toArrow;\n first = false;\n str += state.ruleDeps[ruleIndexes[j]].rule.name;\n } else {\n str += `, ${state.ruleDeps[ruleIndexes[j]].rule.name}`;\n }\n count += 1;\n }\n if (str.length - startSeg > lineLength && j !== maxRule) {\n str += `\\n${pre}${toArrow}`;\n startSeg = str.length;\n }\n }\n if (state.udtCount) {\n for (j = 0; j < state.udtCount; j += 1) {\n if (rdi.refersToUdt[udtIndexes[j]]) {\n if (first) {\n str += toArrow;\n first = false;\n str += state.udts[udtIndexes[j]].name;\n } else {\n str += `, ${state.udts[udtIndexes[j]].name}`;\n }\n count += 1;\n }\n if (str.length - startSeg > lineLength && j !== maxUdt) {\n str += `\\n${pre}${toArrow}`;\n startSeg = str.length;\n }\n }\n }\n if (count === 0) {\n str += '=> \\n';\n }\n if (first === false) {\n str += '\\n';\n }\n first = true;\n count = 0;\n startSeg = str.length;\n str += pre;\n for (j = 0; j < state.ruleCount; j += 1) {\n if (rdi.referencedBy[ruleIndexes[j]]) {\n if (first) {\n str += byArrow;\n first = false;\n str += state.ruleDeps[ruleIndexes[j]].rule.name;\n } else {\n str += `, ${state.ruleDeps[ruleIndexes[j]].rule.name}`;\n }\n count += 1;\n }\n if (str.length - startSeg > lineLength && j !== maxRule) {\n str += `\\n${pre}${toArrow}`;\n startSeg = str.length;\n }\n }\n if (count === 0) {\n str += '<= \\n';\n }\n if (first === false) {\n str += '\\n';\n }\n str += '\\n';\n }\n return str;\n };\n // Display the rule dependencies.\n // - order\n // - \"index\" or \"i\", index order (default)\n // - \"alpha\" or \"a\", alphabetical order\n // - \"type\" or \"t\", ordered by type (alphabetical within each type/group)\n // - none of above, index order (default)\n const showRuleDependencies = (order = 'index') => {\n let str = 'RULE DEPENDENCIES(index:type:[group number:])\\n';\n str += '=> refers to rule names\\n';\n str += '<= referenced by rule names\\n';\n if (!state.dependenciesComplete) {\n return str;\n }\n\n if (order.charCodeAt(0) === 97) {\n str += 'alphabetical by rule name\\n';\n str += show(97);\n } else if (order.charCodeAt(0) === 116) {\n str += 'ordered by rule type\\n';\n str += show(116);\n } else {\n str += 'ordered by rule index\\n';\n str += show(null);\n }\n return str;\n };\n\n /* Destructuring assignment - see MDN Web Docs */\n return { ruleDependencies, showRuleDependencies };\n})();\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/rule-dependencies.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/sabnf-grammar.js":module=>{eval("// copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved
\n// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
\n//\n// Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)\nmodule.exports = function grammar(){\n // ```\n // SUMMARY\n // rules = 95\n // udts = 0\n // opcodes = 372\n // --- ABNF original opcodes\n // ALT = 43\n // CAT = 48\n // REP = 34\n // RNM = 149\n // TLS = 2\n // TBS = 61\n // TRG = 35\n // --- SABNF superset opcodes\n // UDT = 0\n // AND = 0\n // NOT = 0\n // BKA = 0\n // BKN = 0\n // BKR = 0\n // ABG = 0\n // AEN = 0\n // characters = [9 - 126]\n // ```\n /* OBJECT IDENTIFIER (for internal parser use) */\n this.grammarObject = 'grammarObject';\n\n /* RULES */\n this.rules = [];\n this.rules[0] = { name: 'File', lower: 'file', index: 0, isBkr: false };\n this.rules[1] = { name: 'BlankLine', lower: 'blankline', index: 1, isBkr: false };\n this.rules[2] = { name: 'Rule', lower: 'rule', index: 2, isBkr: false };\n this.rules[3] = { name: 'RuleLookup', lower: 'rulelookup', index: 3, isBkr: false };\n this.rules[4] = { name: 'RuleNameTest', lower: 'rulenametest', index: 4, isBkr: false };\n this.rules[5] = { name: 'RuleName', lower: 'rulename', index: 5, isBkr: false };\n this.rules[6] = { name: 'RuleNameError', lower: 'rulenameerror', index: 6, isBkr: false };\n this.rules[7] = { name: 'DefinedAsTest', lower: 'definedastest', index: 7, isBkr: false };\n this.rules[8] = { name: 'DefinedAsError', lower: 'definedaserror', index: 8, isBkr: false };\n this.rules[9] = { name: 'DefinedAs', lower: 'definedas', index: 9, isBkr: false };\n this.rules[10] = { name: 'Defined', lower: 'defined', index: 10, isBkr: false };\n this.rules[11] = { name: 'IncAlt', lower: 'incalt', index: 11, isBkr: false };\n this.rules[12] = { name: 'RuleError', lower: 'ruleerror', index: 12, isBkr: false };\n this.rules[13] = { name: 'LineEndError', lower: 'lineenderror', index: 13, isBkr: false };\n this.rules[14] = { name: 'Alternation', lower: 'alternation', index: 14, isBkr: false };\n this.rules[15] = { name: 'Concatenation', lower: 'concatenation', index: 15, isBkr: false };\n this.rules[16] = { name: 'Repetition', lower: 'repetition', index: 16, isBkr: false };\n this.rules[17] = { name: 'Modifier', lower: 'modifier', index: 17, isBkr: false };\n this.rules[18] = { name: 'Predicate', lower: 'predicate', index: 18, isBkr: false };\n this.rules[19] = { name: 'BasicElement', lower: 'basicelement', index: 19, isBkr: false };\n this.rules[20] = { name: 'BasicElementErr', lower: 'basicelementerr', index: 20, isBkr: false };\n this.rules[21] = { name: 'Group', lower: 'group', index: 21, isBkr: false };\n this.rules[22] = { name: 'GroupError', lower: 'grouperror', index: 22, isBkr: false };\n this.rules[23] = { name: 'GroupOpen', lower: 'groupopen', index: 23, isBkr: false };\n this.rules[24] = { name: 'GroupClose', lower: 'groupclose', index: 24, isBkr: false };\n this.rules[25] = { name: 'Option', lower: 'option', index: 25, isBkr: false };\n this.rules[26] = { name: 'OptionError', lower: 'optionerror', index: 26, isBkr: false };\n this.rules[27] = { name: 'OptionOpen', lower: 'optionopen', index: 27, isBkr: false };\n this.rules[28] = { name: 'OptionClose', lower: 'optionclose', index: 28, isBkr: false };\n this.rules[29] = { name: 'RnmOp', lower: 'rnmop', index: 29, isBkr: false };\n this.rules[30] = { name: 'BkrOp', lower: 'bkrop', index: 30, isBkr: false };\n this.rules[31] = { name: 'bkrModifier', lower: 'bkrmodifier', index: 31, isBkr: false };\n this.rules[32] = { name: 'cs', lower: 'cs', index: 32, isBkr: false };\n this.rules[33] = { name: 'ci', lower: 'ci', index: 33, isBkr: false };\n this.rules[34] = { name: 'um', lower: 'um', index: 34, isBkr: false };\n this.rules[35] = { name: 'pm', lower: 'pm', index: 35, isBkr: false };\n this.rules[36] = { name: 'bkr-name', lower: 'bkr-name', index: 36, isBkr: false };\n this.rules[37] = { name: 'rname', lower: 'rname', index: 37, isBkr: false };\n this.rules[38] = { name: 'uname', lower: 'uname', index: 38, isBkr: false };\n this.rules[39] = { name: 'ename', lower: 'ename', index: 39, isBkr: false };\n this.rules[40] = { name: 'UdtOp', lower: 'udtop', index: 40, isBkr: false };\n this.rules[41] = { name: 'udt-non-empty', lower: 'udt-non-empty', index: 41, isBkr: false };\n this.rules[42] = { name: 'udt-empty', lower: 'udt-empty', index: 42, isBkr: false };\n this.rules[43] = { name: 'RepOp', lower: 'repop', index: 43, isBkr: false };\n this.rules[44] = { name: 'AltOp', lower: 'altop', index: 44, isBkr: false };\n this.rules[45] = { name: 'CatOp', lower: 'catop', index: 45, isBkr: false };\n this.rules[46] = { name: 'StarOp', lower: 'starop', index: 46, isBkr: false };\n this.rules[47] = { name: 'AndOp', lower: 'andop', index: 47, isBkr: false };\n this.rules[48] = { name: 'NotOp', lower: 'notop', index: 48, isBkr: false };\n this.rules[49] = { name: 'BkaOp', lower: 'bkaop', index: 49, isBkr: false };\n this.rules[50] = { name: 'BknOp', lower: 'bknop', index: 50, isBkr: false };\n this.rules[51] = { name: 'AbgOp', lower: 'abgop', index: 51, isBkr: false };\n this.rules[52] = { name: 'AenOp', lower: 'aenop', index: 52, isBkr: false };\n this.rules[53] = { name: 'TrgOp', lower: 'trgop', index: 53, isBkr: false };\n this.rules[54] = { name: 'TbsOp', lower: 'tbsop', index: 54, isBkr: false };\n this.rules[55] = { name: 'TlsOp', lower: 'tlsop', index: 55, isBkr: false };\n this.rules[56] = { name: 'TlsCase', lower: 'tlscase', index: 56, isBkr: false };\n this.rules[57] = { name: 'TlsOpen', lower: 'tlsopen', index: 57, isBkr: false };\n this.rules[58] = { name: 'TlsClose', lower: 'tlsclose', index: 58, isBkr: false };\n this.rules[59] = { name: 'TlsString', lower: 'tlsstring', index: 59, isBkr: false };\n this.rules[60] = { name: 'StringTab', lower: 'stringtab', index: 60, isBkr: false };\n this.rules[61] = { name: 'ClsOp', lower: 'clsop', index: 61, isBkr: false };\n this.rules[62] = { name: 'ClsOpen', lower: 'clsopen', index: 62, isBkr: false };\n this.rules[63] = { name: 'ClsClose', lower: 'clsclose', index: 63, isBkr: false };\n this.rules[64] = { name: 'ClsString', lower: 'clsstring', index: 64, isBkr: false };\n this.rules[65] = { name: 'ProsVal', lower: 'prosval', index: 65, isBkr: false };\n this.rules[66] = { name: 'ProsValOpen', lower: 'prosvalopen', index: 66, isBkr: false };\n this.rules[67] = { name: 'ProsValString', lower: 'prosvalstring', index: 67, isBkr: false };\n this.rules[68] = { name: 'ProsValClose', lower: 'prosvalclose', index: 68, isBkr: false };\n this.rules[69] = { name: 'rep-min', lower: 'rep-min', index: 69, isBkr: false };\n this.rules[70] = { name: 'rep-min-max', lower: 'rep-min-max', index: 70, isBkr: false };\n this.rules[71] = { name: 'rep-max', lower: 'rep-max', index: 71, isBkr: false };\n this.rules[72] = { name: 'rep-num', lower: 'rep-num', index: 72, isBkr: false };\n this.rules[73] = { name: 'dString', lower: 'dstring', index: 73, isBkr: false };\n this.rules[74] = { name: 'xString', lower: 'xstring', index: 74, isBkr: false };\n this.rules[75] = { name: 'bString', lower: 'bstring', index: 75, isBkr: false };\n this.rules[76] = { name: 'Dec', lower: 'dec', index: 76, isBkr: false };\n this.rules[77] = { name: 'Hex', lower: 'hex', index: 77, isBkr: false };\n this.rules[78] = { name: 'Bin', lower: 'bin', index: 78, isBkr: false };\n this.rules[79] = { name: 'dmin', lower: 'dmin', index: 79, isBkr: false };\n this.rules[80] = { name: 'dmax', lower: 'dmax', index: 80, isBkr: false };\n this.rules[81] = { name: 'bmin', lower: 'bmin', index: 81, isBkr: false };\n this.rules[82] = { name: 'bmax', lower: 'bmax', index: 82, isBkr: false };\n this.rules[83] = { name: 'xmin', lower: 'xmin', index: 83, isBkr: false };\n this.rules[84] = { name: 'xmax', lower: 'xmax', index: 84, isBkr: false };\n this.rules[85] = { name: 'dnum', lower: 'dnum', index: 85, isBkr: false };\n this.rules[86] = { name: 'bnum', lower: 'bnum', index: 86, isBkr: false };\n this.rules[87] = { name: 'xnum', lower: 'xnum', index: 87, isBkr: false };\n this.rules[88] = { name: 'alphanum', lower: 'alphanum', index: 88, isBkr: false };\n this.rules[89] = { name: 'owsp', lower: 'owsp', index: 89, isBkr: false };\n this.rules[90] = { name: 'wsp', lower: 'wsp', index: 90, isBkr: false };\n this.rules[91] = { name: 'space', lower: 'space', index: 91, isBkr: false };\n this.rules[92] = { name: 'comment', lower: 'comment', index: 92, isBkr: false };\n this.rules[93] = { name: 'LineEnd', lower: 'lineend', index: 93, isBkr: false };\n this.rules[94] = { name: 'LineContinue', lower: 'linecontinue', index: 94, isBkr: false };\n\n /* UDTS */\n this.udts = [];\n\n /* OPCODES */\n /* File */\n this.rules[0].opcodes = [];\n this.rules[0].opcodes[0] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[0].opcodes[1] = { type: 1, children: [2,3,4] };// ALT\n this.rules[0].opcodes[2] = { type: 4, index: 1 };// RNM(BlankLine)\n this.rules[0].opcodes[3] = { type: 4, index: 2 };// RNM(Rule)\n this.rules[0].opcodes[4] = { type: 4, index: 12 };// RNM(RuleError)\n\n /* BlankLine */\n this.rules[1].opcodes = [];\n this.rules[1].opcodes[0] = { type: 2, children: [1,5,7] };// CAT\n this.rules[1].opcodes[1] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[1].opcodes[2] = { type: 1, children: [3,4] };// ALT\n this.rules[1].opcodes[3] = { type: 6, string: [32] };// TBS\n this.rules[1].opcodes[4] = { type: 6, string: [9] };// TBS\n this.rules[1].opcodes[5] = { type: 3, min: 0, max: 1 };// REP\n this.rules[1].opcodes[6] = { type: 4, index: 92 };// RNM(comment)\n this.rules[1].opcodes[7] = { type: 4, index: 93 };// RNM(LineEnd)\n\n /* Rule */\n this.rules[2].opcodes = [];\n this.rules[2].opcodes[0] = { type: 2, children: [1,2,3,4] };// CAT\n this.rules[2].opcodes[1] = { type: 4, index: 3 };// RNM(RuleLookup)\n this.rules[2].opcodes[2] = { type: 4, index: 89 };// RNM(owsp)\n this.rules[2].opcodes[3] = { type: 4, index: 14 };// RNM(Alternation)\n this.rules[2].opcodes[4] = { type: 1, children: [5,8] };// ALT\n this.rules[2].opcodes[5] = { type: 2, children: [6,7] };// CAT\n this.rules[2].opcodes[6] = { type: 4, index: 89 };// RNM(owsp)\n this.rules[2].opcodes[7] = { type: 4, index: 93 };// RNM(LineEnd)\n this.rules[2].opcodes[8] = { type: 2, children: [9,10] };// CAT\n this.rules[2].opcodes[9] = { type: 4, index: 13 };// RNM(LineEndError)\n this.rules[2].opcodes[10] = { type: 4, index: 93 };// RNM(LineEnd)\n\n /* RuleLookup */\n this.rules[3].opcodes = [];\n this.rules[3].opcodes[0] = { type: 2, children: [1,2,3] };// CAT\n this.rules[3].opcodes[1] = { type: 4, index: 4 };// RNM(RuleNameTest)\n this.rules[3].opcodes[2] = { type: 4, index: 89 };// RNM(owsp)\n this.rules[3].opcodes[3] = { type: 4, index: 7 };// RNM(DefinedAsTest)\n\n /* RuleNameTest */\n this.rules[4].opcodes = [];\n this.rules[4].opcodes[0] = { type: 1, children: [1,2] };// ALT\n this.rules[4].opcodes[1] = { type: 4, index: 5 };// RNM(RuleName)\n this.rules[4].opcodes[2] = { type: 4, index: 6 };// RNM(RuleNameError)\n\n /* RuleName */\n this.rules[5].opcodes = [];\n this.rules[5].opcodes[0] = { type: 4, index: 88 };// RNM(alphanum)\n\n /* RuleNameError */\n this.rules[6].opcodes = [];\n this.rules[6].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[6].opcodes[1] = { type: 1, children: [2,3] };// ALT\n this.rules[6].opcodes[2] = { type: 5, min: 33, max: 60 };// TRG\n this.rules[6].opcodes[3] = { type: 5, min: 62, max: 126 };// TRG\n\n /* DefinedAsTest */\n this.rules[7].opcodes = [];\n this.rules[7].opcodes[0] = { type: 1, children: [1,2] };// ALT\n this.rules[7].opcodes[1] = { type: 4, index: 9 };// RNM(DefinedAs)\n this.rules[7].opcodes[2] = { type: 4, index: 8 };// RNM(DefinedAsError)\n\n /* DefinedAsError */\n this.rules[8].opcodes = [];\n this.rules[8].opcodes[0] = { type: 3, min: 1, max: 2 };// REP\n this.rules[8].opcodes[1] = { type: 5, min: 33, max: 126 };// TRG\n\n /* DefinedAs */\n this.rules[9].opcodes = [];\n this.rules[9].opcodes[0] = { type: 1, children: [1,2] };// ALT\n this.rules[9].opcodes[1] = { type: 4, index: 11 };// RNM(IncAlt)\n this.rules[9].opcodes[2] = { type: 4, index: 10 };// RNM(Defined)\n\n /* Defined */\n this.rules[10].opcodes = [];\n this.rules[10].opcodes[0] = { type: 6, string: [61] };// TBS\n\n /* IncAlt */\n this.rules[11].opcodes = [];\n this.rules[11].opcodes[0] = { type: 6, string: [61,47] };// TBS\n\n /* RuleError */\n this.rules[12].opcodes = [];\n this.rules[12].opcodes[0] = { type: 2, children: [1,6] };// CAT\n this.rules[12].opcodes[1] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[12].opcodes[2] = { type: 1, children: [3,4,5] };// ALT\n this.rules[12].opcodes[3] = { type: 5, min: 32, max: 126 };// TRG\n this.rules[12].opcodes[4] = { type: 6, string: [9] };// TBS\n this.rules[12].opcodes[5] = { type: 4, index: 94 };// RNM(LineContinue)\n this.rules[12].opcodes[6] = { type: 4, index: 93 };// RNM(LineEnd)\n\n /* LineEndError */\n this.rules[13].opcodes = [];\n this.rules[13].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[13].opcodes[1] = { type: 1, children: [2,3,4] };// ALT\n this.rules[13].opcodes[2] = { type: 5, min: 32, max: 126 };// TRG\n this.rules[13].opcodes[3] = { type: 6, string: [9] };// TBS\n this.rules[13].opcodes[4] = { type: 4, index: 94 };// RNM(LineContinue)\n\n /* Alternation */\n this.rules[14].opcodes = [];\n this.rules[14].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[14].opcodes[1] = { type: 4, index: 15 };// RNM(Concatenation)\n this.rules[14].opcodes[2] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[14].opcodes[3] = { type: 2, children: [4,5,6] };// CAT\n this.rules[14].opcodes[4] = { type: 4, index: 89 };// RNM(owsp)\n this.rules[14].opcodes[5] = { type: 4, index: 44 };// RNM(AltOp)\n this.rules[14].opcodes[6] = { type: 4, index: 15 };// RNM(Concatenation)\n\n /* Concatenation */\n this.rules[15].opcodes = [];\n this.rules[15].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[15].opcodes[1] = { type: 4, index: 16 };// RNM(Repetition)\n this.rules[15].opcodes[2] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[15].opcodes[3] = { type: 2, children: [4,5] };// CAT\n this.rules[15].opcodes[4] = { type: 4, index: 45 };// RNM(CatOp)\n this.rules[15].opcodes[5] = { type: 4, index: 16 };// RNM(Repetition)\n\n /* Repetition */\n this.rules[16].opcodes = [];\n this.rules[16].opcodes[0] = { type: 2, children: [1,3] };// CAT\n this.rules[16].opcodes[1] = { type: 3, min: 0, max: 1 };// REP\n this.rules[16].opcodes[2] = { type: 4, index: 17 };// RNM(Modifier)\n this.rules[16].opcodes[3] = { type: 1, children: [4,5,6,7] };// ALT\n this.rules[16].opcodes[4] = { type: 4, index: 21 };// RNM(Group)\n this.rules[16].opcodes[5] = { type: 4, index: 25 };// RNM(Option)\n this.rules[16].opcodes[6] = { type: 4, index: 19 };// RNM(BasicElement)\n this.rules[16].opcodes[7] = { type: 4, index: 20 };// RNM(BasicElementErr)\n\n /* Modifier */\n this.rules[17].opcodes = [];\n this.rules[17].opcodes[0] = { type: 1, children: [1,5] };// ALT\n this.rules[17].opcodes[1] = { type: 2, children: [2,3] };// CAT\n this.rules[17].opcodes[2] = { type: 4, index: 18 };// RNM(Predicate)\n this.rules[17].opcodes[3] = { type: 3, min: 0, max: 1 };// REP\n this.rules[17].opcodes[4] = { type: 4, index: 43 };// RNM(RepOp)\n this.rules[17].opcodes[5] = { type: 4, index: 43 };// RNM(RepOp)\n\n /* Predicate */\n this.rules[18].opcodes = [];\n this.rules[18].opcodes[0] = { type: 1, children: [1,2,3,4] };// ALT\n this.rules[18].opcodes[1] = { type: 4, index: 49 };// RNM(BkaOp)\n this.rules[18].opcodes[2] = { type: 4, index: 50 };// RNM(BknOp)\n this.rules[18].opcodes[3] = { type: 4, index: 47 };// RNM(AndOp)\n this.rules[18].opcodes[4] = { type: 4, index: 48 };// RNM(NotOp)\n\n /* BasicElement */\n this.rules[19].opcodes = [];\n this.rules[19].opcodes[0] = { type: 1, children: [1,2,3,4,5,6,7,8,9,10] };// ALT\n this.rules[19].opcodes[1] = { type: 4, index: 40 };// RNM(UdtOp)\n this.rules[19].opcodes[2] = { type: 4, index: 29 };// RNM(RnmOp)\n this.rules[19].opcodes[3] = { type: 4, index: 53 };// RNM(TrgOp)\n this.rules[19].opcodes[4] = { type: 4, index: 54 };// RNM(TbsOp)\n this.rules[19].opcodes[5] = { type: 4, index: 55 };// RNM(TlsOp)\n this.rules[19].opcodes[6] = { type: 4, index: 61 };// RNM(ClsOp)\n this.rules[19].opcodes[7] = { type: 4, index: 30 };// RNM(BkrOp)\n this.rules[19].opcodes[8] = { type: 4, index: 51 };// RNM(AbgOp)\n this.rules[19].opcodes[9] = { type: 4, index: 52 };// RNM(AenOp)\n this.rules[19].opcodes[10] = { type: 4, index: 65 };// RNM(ProsVal)\n\n /* BasicElementErr */\n this.rules[20].opcodes = [];\n this.rules[20].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[20].opcodes[1] = { type: 1, children: [2,3,4,5] };// ALT\n this.rules[20].opcodes[2] = { type: 5, min: 33, max: 40 };// TRG\n this.rules[20].opcodes[3] = { type: 5, min: 42, max: 46 };// TRG\n this.rules[20].opcodes[4] = { type: 5, min: 48, max: 92 };// TRG\n this.rules[20].opcodes[5] = { type: 5, min: 94, max: 126 };// TRG\n\n /* Group */\n this.rules[21].opcodes = [];\n this.rules[21].opcodes[0] = { type: 2, children: [1,2,3] };// CAT\n this.rules[21].opcodes[1] = { type: 4, index: 23 };// RNM(GroupOpen)\n this.rules[21].opcodes[2] = { type: 4, index: 14 };// RNM(Alternation)\n this.rules[21].opcodes[3] = { type: 1, children: [4,5] };// ALT\n this.rules[21].opcodes[4] = { type: 4, index: 24 };// RNM(GroupClose)\n this.rules[21].opcodes[5] = { type: 4, index: 22 };// RNM(GroupError)\n\n /* GroupError */\n this.rules[22].opcodes = [];\n this.rules[22].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[22].opcodes[1] = { type: 1, children: [2,3,4,5] };// ALT\n this.rules[22].opcodes[2] = { type: 5, min: 33, max: 40 };// TRG\n this.rules[22].opcodes[3] = { type: 5, min: 42, max: 46 };// TRG\n this.rules[22].opcodes[4] = { type: 5, min: 48, max: 92 };// TRG\n this.rules[22].opcodes[5] = { type: 5, min: 94, max: 126 };// TRG\n\n /* GroupOpen */\n this.rules[23].opcodes = [];\n this.rules[23].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[23].opcodes[1] = { type: 6, string: [40] };// TBS\n this.rules[23].opcodes[2] = { type: 4, index: 89 };// RNM(owsp)\n\n /* GroupClose */\n this.rules[24].opcodes = [];\n this.rules[24].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[24].opcodes[1] = { type: 4, index: 89 };// RNM(owsp)\n this.rules[24].opcodes[2] = { type: 6, string: [41] };// TBS\n\n /* Option */\n this.rules[25].opcodes = [];\n this.rules[25].opcodes[0] = { type: 2, children: [1,2,3] };// CAT\n this.rules[25].opcodes[1] = { type: 4, index: 27 };// RNM(OptionOpen)\n this.rules[25].opcodes[2] = { type: 4, index: 14 };// RNM(Alternation)\n this.rules[25].opcodes[3] = { type: 1, children: [4,5] };// ALT\n this.rules[25].opcodes[4] = { type: 4, index: 28 };// RNM(OptionClose)\n this.rules[25].opcodes[5] = { type: 4, index: 26 };// RNM(OptionError)\n\n /* OptionError */\n this.rules[26].opcodes = [];\n this.rules[26].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[26].opcodes[1] = { type: 1, children: [2,3,4,5] };// ALT\n this.rules[26].opcodes[2] = { type: 5, min: 33, max: 40 };// TRG\n this.rules[26].opcodes[3] = { type: 5, min: 42, max: 46 };// TRG\n this.rules[26].opcodes[4] = { type: 5, min: 48, max: 92 };// TRG\n this.rules[26].opcodes[5] = { type: 5, min: 94, max: 126 };// TRG\n\n /* OptionOpen */\n this.rules[27].opcodes = [];\n this.rules[27].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[27].opcodes[1] = { type: 6, string: [91] };// TBS\n this.rules[27].opcodes[2] = { type: 4, index: 89 };// RNM(owsp)\n\n /* OptionClose */\n this.rules[28].opcodes = [];\n this.rules[28].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[28].opcodes[1] = { type: 4, index: 89 };// RNM(owsp)\n this.rules[28].opcodes[2] = { type: 6, string: [93] };// TBS\n\n /* RnmOp */\n this.rules[29].opcodes = [];\n this.rules[29].opcodes[0] = { type: 4, index: 88 };// RNM(alphanum)\n\n /* BkrOp */\n this.rules[30].opcodes = [];\n this.rules[30].opcodes[0] = { type: 2, children: [1,2,4] };// CAT\n this.rules[30].opcodes[1] = { type: 6, string: [92] };// TBS\n this.rules[30].opcodes[2] = { type: 3, min: 0, max: 1 };// REP\n this.rules[30].opcodes[3] = { type: 4, index: 31 };// RNM(bkrModifier)\n this.rules[30].opcodes[4] = { type: 4, index: 36 };// RNM(bkr-name)\n\n /* bkrModifier */\n this.rules[31].opcodes = [];\n this.rules[31].opcodes[0] = { type: 1, children: [1,7,13,19] };// ALT\n this.rules[31].opcodes[1] = { type: 2, children: [2,3] };// CAT\n this.rules[31].opcodes[2] = { type: 4, index: 32 };// RNM(cs)\n this.rules[31].opcodes[3] = { type: 3, min: 0, max: 1 };// REP\n this.rules[31].opcodes[4] = { type: 1, children: [5,6] };// ALT\n this.rules[31].opcodes[5] = { type: 4, index: 34 };// RNM(um)\n this.rules[31].opcodes[6] = { type: 4, index: 35 };// RNM(pm)\n this.rules[31].opcodes[7] = { type: 2, children: [8,9] };// CAT\n this.rules[31].opcodes[8] = { type: 4, index: 33 };// RNM(ci)\n this.rules[31].opcodes[9] = { type: 3, min: 0, max: 1 };// REP\n this.rules[31].opcodes[10] = { type: 1, children: [11,12] };// ALT\n this.rules[31].opcodes[11] = { type: 4, index: 34 };// RNM(um)\n this.rules[31].opcodes[12] = { type: 4, index: 35 };// RNM(pm)\n this.rules[31].opcodes[13] = { type: 2, children: [14,15] };// CAT\n this.rules[31].opcodes[14] = { type: 4, index: 34 };// RNM(um)\n this.rules[31].opcodes[15] = { type: 3, min: 0, max: 1 };// REP\n this.rules[31].opcodes[16] = { type: 1, children: [17,18] };// ALT\n this.rules[31].opcodes[17] = { type: 4, index: 32 };// RNM(cs)\n this.rules[31].opcodes[18] = { type: 4, index: 33 };// RNM(ci)\n this.rules[31].opcodes[19] = { type: 2, children: [20,21] };// CAT\n this.rules[31].opcodes[20] = { type: 4, index: 35 };// RNM(pm)\n this.rules[31].opcodes[21] = { type: 3, min: 0, max: 1 };// REP\n this.rules[31].opcodes[22] = { type: 1, children: [23,24] };// ALT\n this.rules[31].opcodes[23] = { type: 4, index: 32 };// RNM(cs)\n this.rules[31].opcodes[24] = { type: 4, index: 33 };// RNM(ci)\n\n /* cs */\n this.rules[32].opcodes = [];\n this.rules[32].opcodes[0] = { type: 6, string: [37,115] };// TBS\n\n /* ci */\n this.rules[33].opcodes = [];\n this.rules[33].opcodes[0] = { type: 6, string: [37,105] };// TBS\n\n /* um */\n this.rules[34].opcodes = [];\n this.rules[34].opcodes[0] = { type: 6, string: [37,117] };// TBS\n\n /* pm */\n this.rules[35].opcodes = [];\n this.rules[35].opcodes[0] = { type: 6, string: [37,112] };// TBS\n\n /* bkr-name */\n this.rules[36].opcodes = [];\n this.rules[36].opcodes[0] = { type: 1, children: [1,2,3] };// ALT\n this.rules[36].opcodes[1] = { type: 4, index: 38 };// RNM(uname)\n this.rules[36].opcodes[2] = { type: 4, index: 39 };// RNM(ename)\n this.rules[36].opcodes[3] = { type: 4, index: 37 };// RNM(rname)\n\n /* rname */\n this.rules[37].opcodes = [];\n this.rules[37].opcodes[0] = { type: 4, index: 88 };// RNM(alphanum)\n\n /* uname */\n this.rules[38].opcodes = [];\n this.rules[38].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[38].opcodes[1] = { type: 6, string: [117,95] };// TBS\n this.rules[38].opcodes[2] = { type: 4, index: 88 };// RNM(alphanum)\n\n /* ename */\n this.rules[39].opcodes = [];\n this.rules[39].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[39].opcodes[1] = { type: 6, string: [101,95] };// TBS\n this.rules[39].opcodes[2] = { type: 4, index: 88 };// RNM(alphanum)\n\n /* UdtOp */\n this.rules[40].opcodes = [];\n this.rules[40].opcodes[0] = { type: 1, children: [1,2] };// ALT\n this.rules[40].opcodes[1] = { type: 4, index: 42 };// RNM(udt-empty)\n this.rules[40].opcodes[2] = { type: 4, index: 41 };// RNM(udt-non-empty)\n\n /* udt-non-empty */\n this.rules[41].opcodes = [];\n this.rules[41].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[41].opcodes[1] = { type: 6, string: [117,95] };// TBS\n this.rules[41].opcodes[2] = { type: 4, index: 88 };// RNM(alphanum)\n\n /* udt-empty */\n this.rules[42].opcodes = [];\n this.rules[42].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[42].opcodes[1] = { type: 6, string: [101,95] };// TBS\n this.rules[42].opcodes[2] = { type: 4, index: 88 };// RNM(alphanum)\n\n /* RepOp */\n this.rules[43].opcodes = [];\n this.rules[43].opcodes[0] = { type: 1, children: [1,5,8,11,12] };// ALT\n this.rules[43].opcodes[1] = { type: 2, children: [2,3,4] };// CAT\n this.rules[43].opcodes[2] = { type: 4, index: 69 };// RNM(rep-min)\n this.rules[43].opcodes[3] = { type: 4, index: 46 };// RNM(StarOp)\n this.rules[43].opcodes[4] = { type: 4, index: 71 };// RNM(rep-max)\n this.rules[43].opcodes[5] = { type: 2, children: [6,7] };// CAT\n this.rules[43].opcodes[6] = { type: 4, index: 69 };// RNM(rep-min)\n this.rules[43].opcodes[7] = { type: 4, index: 46 };// RNM(StarOp)\n this.rules[43].opcodes[8] = { type: 2, children: [9,10] };// CAT\n this.rules[43].opcodes[9] = { type: 4, index: 46 };// RNM(StarOp)\n this.rules[43].opcodes[10] = { type: 4, index: 71 };// RNM(rep-max)\n this.rules[43].opcodes[11] = { type: 4, index: 46 };// RNM(StarOp)\n this.rules[43].opcodes[12] = { type: 4, index: 70 };// RNM(rep-min-max)\n\n /* AltOp */\n this.rules[44].opcodes = [];\n this.rules[44].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[44].opcodes[1] = { type: 6, string: [47] };// TBS\n this.rules[44].opcodes[2] = { type: 4, index: 89 };// RNM(owsp)\n\n /* CatOp */\n this.rules[45].opcodes = [];\n this.rules[45].opcodes[0] = { type: 4, index: 90 };// RNM(wsp)\n\n /* StarOp */\n this.rules[46].opcodes = [];\n this.rules[46].opcodes[0] = { type: 6, string: [42] };// TBS\n\n /* AndOp */\n this.rules[47].opcodes = [];\n this.rules[47].opcodes[0] = { type: 6, string: [38] };// TBS\n\n /* NotOp */\n this.rules[48].opcodes = [];\n this.rules[48].opcodes[0] = { type: 6, string: [33] };// TBS\n\n /* BkaOp */\n this.rules[49].opcodes = [];\n this.rules[49].opcodes[0] = { type: 6, string: [38,38] };// TBS\n\n /* BknOp */\n this.rules[50].opcodes = [];\n this.rules[50].opcodes[0] = { type: 6, string: [33,33] };// TBS\n\n /* AbgOp */\n this.rules[51].opcodes = [];\n this.rules[51].opcodes[0] = { type: 6, string: [37,94] };// TBS\n\n /* AenOp */\n this.rules[52].opcodes = [];\n this.rules[52].opcodes[0] = { type: 6, string: [37,36] };// TBS\n\n /* TrgOp */\n this.rules[53].opcodes = [];\n this.rules[53].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[53].opcodes[1] = { type: 6, string: [37] };// TBS\n this.rules[53].opcodes[2] = { type: 1, children: [3,8,13] };// ALT\n this.rules[53].opcodes[3] = { type: 2, children: [4,5,6,7] };// CAT\n this.rules[53].opcodes[4] = { type: 4, index: 76 };// RNM(Dec)\n this.rules[53].opcodes[5] = { type: 4, index: 79 };// RNM(dmin)\n this.rules[53].opcodes[6] = { type: 6, string: [45] };// TBS\n this.rules[53].opcodes[7] = { type: 4, index: 80 };// RNM(dmax)\n this.rules[53].opcodes[8] = { type: 2, children: [9,10,11,12] };// CAT\n this.rules[53].opcodes[9] = { type: 4, index: 77 };// RNM(Hex)\n this.rules[53].opcodes[10] = { type: 4, index: 83 };// RNM(xmin)\n this.rules[53].opcodes[11] = { type: 6, string: [45] };// TBS\n this.rules[53].opcodes[12] = { type: 4, index: 84 };// RNM(xmax)\n this.rules[53].opcodes[13] = { type: 2, children: [14,15,16,17] };// CAT\n this.rules[53].opcodes[14] = { type: 4, index: 78 };// RNM(Bin)\n this.rules[53].opcodes[15] = { type: 4, index: 81 };// RNM(bmin)\n this.rules[53].opcodes[16] = { type: 6, string: [45] };// TBS\n this.rules[53].opcodes[17] = { type: 4, index: 82 };// RNM(bmax)\n\n /* TbsOp */\n this.rules[54].opcodes = [];\n this.rules[54].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[54].opcodes[1] = { type: 6, string: [37] };// TBS\n this.rules[54].opcodes[2] = { type: 1, children: [3,10,17] };// ALT\n this.rules[54].opcodes[3] = { type: 2, children: [4,5,6] };// CAT\n this.rules[54].opcodes[4] = { type: 4, index: 76 };// RNM(Dec)\n this.rules[54].opcodes[5] = { type: 4, index: 73 };// RNM(dString)\n this.rules[54].opcodes[6] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[54].opcodes[7] = { type: 2, children: [8,9] };// CAT\n this.rules[54].opcodes[8] = { type: 6, string: [46] };// TBS\n this.rules[54].opcodes[9] = { type: 4, index: 73 };// RNM(dString)\n this.rules[54].opcodes[10] = { type: 2, children: [11,12,13] };// CAT\n this.rules[54].opcodes[11] = { type: 4, index: 77 };// RNM(Hex)\n this.rules[54].opcodes[12] = { type: 4, index: 74 };// RNM(xString)\n this.rules[54].opcodes[13] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[54].opcodes[14] = { type: 2, children: [15,16] };// CAT\n this.rules[54].opcodes[15] = { type: 6, string: [46] };// TBS\n this.rules[54].opcodes[16] = { type: 4, index: 74 };// RNM(xString)\n this.rules[54].opcodes[17] = { type: 2, children: [18,19,20] };// CAT\n this.rules[54].opcodes[18] = { type: 4, index: 78 };// RNM(Bin)\n this.rules[54].opcodes[19] = { type: 4, index: 75 };// RNM(bString)\n this.rules[54].opcodes[20] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[54].opcodes[21] = { type: 2, children: [22,23] };// CAT\n this.rules[54].opcodes[22] = { type: 6, string: [46] };// TBS\n this.rules[54].opcodes[23] = { type: 4, index: 75 };// RNM(bString)\n\n /* TlsOp */\n this.rules[55].opcodes = [];\n this.rules[55].opcodes[0] = { type: 2, children: [1,2,3,4] };// CAT\n this.rules[55].opcodes[1] = { type: 4, index: 56 };// RNM(TlsCase)\n this.rules[55].opcodes[2] = { type: 4, index: 57 };// RNM(TlsOpen)\n this.rules[55].opcodes[3] = { type: 4, index: 59 };// RNM(TlsString)\n this.rules[55].opcodes[4] = { type: 4, index: 58 };// RNM(TlsClose)\n\n /* TlsCase */\n this.rules[56].opcodes = [];\n this.rules[56].opcodes[0] = { type: 3, min: 0, max: 1 };// REP\n this.rules[56].opcodes[1] = { type: 1, children: [2,3] };// ALT\n this.rules[56].opcodes[2] = { type: 7, string: [37,105] };// TLS\n this.rules[56].opcodes[3] = { type: 7, string: [37,115] };// TLS\n\n /* TlsOpen */\n this.rules[57].opcodes = [];\n this.rules[57].opcodes[0] = { type: 6, string: [34] };// TBS\n\n /* TlsClose */\n this.rules[58].opcodes = [];\n this.rules[58].opcodes[0] = { type: 6, string: [34] };// TBS\n\n /* TlsString */\n this.rules[59].opcodes = [];\n this.rules[59].opcodes[0] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[59].opcodes[1] = { type: 1, children: [2,3,4] };// ALT\n this.rules[59].opcodes[2] = { type: 5, min: 32, max: 33 };// TRG\n this.rules[59].opcodes[3] = { type: 5, min: 35, max: 126 };// TRG\n this.rules[59].opcodes[4] = { type: 4, index: 60 };// RNM(StringTab)\n\n /* StringTab */\n this.rules[60].opcodes = [];\n this.rules[60].opcodes[0] = { type: 6, string: [9] };// TBS\n\n /* ClsOp */\n this.rules[61].opcodes = [];\n this.rules[61].opcodes[0] = { type: 2, children: [1,2,3] };// CAT\n this.rules[61].opcodes[1] = { type: 4, index: 62 };// RNM(ClsOpen)\n this.rules[61].opcodes[2] = { type: 4, index: 64 };// RNM(ClsString)\n this.rules[61].opcodes[3] = { type: 4, index: 63 };// RNM(ClsClose)\n\n /* ClsOpen */\n this.rules[62].opcodes = [];\n this.rules[62].opcodes[0] = { type: 6, string: [39] };// TBS\n\n /* ClsClose */\n this.rules[63].opcodes = [];\n this.rules[63].opcodes[0] = { type: 6, string: [39] };// TBS\n\n /* ClsString */\n this.rules[64].opcodes = [];\n this.rules[64].opcodes[0] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[64].opcodes[1] = { type: 1, children: [2,3,4] };// ALT\n this.rules[64].opcodes[2] = { type: 5, min: 32, max: 38 };// TRG\n this.rules[64].opcodes[3] = { type: 5, min: 40, max: 126 };// TRG\n this.rules[64].opcodes[4] = { type: 4, index: 60 };// RNM(StringTab)\n\n /* ProsVal */\n this.rules[65].opcodes = [];\n this.rules[65].opcodes[0] = { type: 2, children: [1,2,3] };// CAT\n this.rules[65].opcodes[1] = { type: 4, index: 66 };// RNM(ProsValOpen)\n this.rules[65].opcodes[2] = { type: 4, index: 67 };// RNM(ProsValString)\n this.rules[65].opcodes[3] = { type: 4, index: 68 };// RNM(ProsValClose)\n\n /* ProsValOpen */\n this.rules[66].opcodes = [];\n this.rules[66].opcodes[0] = { type: 6, string: [60] };// TBS\n\n /* ProsValString */\n this.rules[67].opcodes = [];\n this.rules[67].opcodes[0] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[67].opcodes[1] = { type: 1, children: [2,3,4] };// ALT\n this.rules[67].opcodes[2] = { type: 5, min: 32, max: 61 };// TRG\n this.rules[67].opcodes[3] = { type: 5, min: 63, max: 126 };// TRG\n this.rules[67].opcodes[4] = { type: 4, index: 60 };// RNM(StringTab)\n\n /* ProsValClose */\n this.rules[68].opcodes = [];\n this.rules[68].opcodes[0] = { type: 6, string: [62] };// TBS\n\n /* rep-min */\n this.rules[69].opcodes = [];\n this.rules[69].opcodes[0] = { type: 4, index: 72 };// RNM(rep-num)\n\n /* rep-min-max */\n this.rules[70].opcodes = [];\n this.rules[70].opcodes[0] = { type: 4, index: 72 };// RNM(rep-num)\n\n /* rep-max */\n this.rules[71].opcodes = [];\n this.rules[71].opcodes[0] = { type: 4, index: 72 };// RNM(rep-num)\n\n /* rep-num */\n this.rules[72].opcodes = [];\n this.rules[72].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[72].opcodes[1] = { type: 5, min: 48, max: 57 };// TRG\n\n /* dString */\n this.rules[73].opcodes = [];\n this.rules[73].opcodes[0] = { type: 4, index: 85 };// RNM(dnum)\n\n /* xString */\n this.rules[74].opcodes = [];\n this.rules[74].opcodes[0] = { type: 4, index: 87 };// RNM(xnum)\n\n /* bString */\n this.rules[75].opcodes = [];\n this.rules[75].opcodes[0] = { type: 4, index: 86 };// RNM(bnum)\n\n /* Dec */\n this.rules[76].opcodes = [];\n this.rules[76].opcodes[0] = { type: 1, children: [1,2] };// ALT\n this.rules[76].opcodes[1] = { type: 6, string: [68] };// TBS\n this.rules[76].opcodes[2] = { type: 6, string: [100] };// TBS\n\n /* Hex */\n this.rules[77].opcodes = [];\n this.rules[77].opcodes[0] = { type: 1, children: [1,2] };// ALT\n this.rules[77].opcodes[1] = { type: 6, string: [88] };// TBS\n this.rules[77].opcodes[2] = { type: 6, string: [120] };// TBS\n\n /* Bin */\n this.rules[78].opcodes = [];\n this.rules[78].opcodes[0] = { type: 1, children: [1,2] };// ALT\n this.rules[78].opcodes[1] = { type: 6, string: [66] };// TBS\n this.rules[78].opcodes[2] = { type: 6, string: [98] };// TBS\n\n /* dmin */\n this.rules[79].opcodes = [];\n this.rules[79].opcodes[0] = { type: 4, index: 85 };// RNM(dnum)\n\n /* dmax */\n this.rules[80].opcodes = [];\n this.rules[80].opcodes[0] = { type: 4, index: 85 };// RNM(dnum)\n\n /* bmin */\n this.rules[81].opcodes = [];\n this.rules[81].opcodes[0] = { type: 4, index: 86 };// RNM(bnum)\n\n /* bmax */\n this.rules[82].opcodes = [];\n this.rules[82].opcodes[0] = { type: 4, index: 86 };// RNM(bnum)\n\n /* xmin */\n this.rules[83].opcodes = [];\n this.rules[83].opcodes[0] = { type: 4, index: 87 };// RNM(xnum)\n\n /* xmax */\n this.rules[84].opcodes = [];\n this.rules[84].opcodes[0] = { type: 4, index: 87 };// RNM(xnum)\n\n /* dnum */\n this.rules[85].opcodes = [];\n this.rules[85].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[85].opcodes[1] = { type: 5, min: 48, max: 57 };// TRG\n\n /* bnum */\n this.rules[86].opcodes = [];\n this.rules[86].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[86].opcodes[1] = { type: 5, min: 48, max: 49 };// TRG\n\n /* xnum */\n this.rules[87].opcodes = [];\n this.rules[87].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[87].opcodes[1] = { type: 1, children: [2,3,4] };// ALT\n this.rules[87].opcodes[2] = { type: 5, min: 48, max: 57 };// TRG\n this.rules[87].opcodes[3] = { type: 5, min: 65, max: 70 };// TRG\n this.rules[87].opcodes[4] = { type: 5, min: 97, max: 102 };// TRG\n\n /* alphanum */\n this.rules[88].opcodes = [];\n this.rules[88].opcodes[0] = { type: 2, children: [1,4] };// CAT\n this.rules[88].opcodes[1] = { type: 1, children: [2,3] };// ALT\n this.rules[88].opcodes[2] = { type: 5, min: 97, max: 122 };// TRG\n this.rules[88].opcodes[3] = { type: 5, min: 65, max: 90 };// TRG\n this.rules[88].opcodes[4] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[88].opcodes[5] = { type: 1, children: [6,7,8,9] };// ALT\n this.rules[88].opcodes[6] = { type: 5, min: 97, max: 122 };// TRG\n this.rules[88].opcodes[7] = { type: 5, min: 65, max: 90 };// TRG\n this.rules[88].opcodes[8] = { type: 5, min: 48, max: 57 };// TRG\n this.rules[88].opcodes[9] = { type: 6, string: [45] };// TBS\n\n /* owsp */\n this.rules[89].opcodes = [];\n this.rules[89].opcodes[0] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[89].opcodes[1] = { type: 4, index: 91 };// RNM(space)\n\n /* wsp */\n this.rules[90].opcodes = [];\n this.rules[90].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[90].opcodes[1] = { type: 4, index: 91 };// RNM(space)\n\n /* space */\n this.rules[91].opcodes = [];\n this.rules[91].opcodes[0] = { type: 1, children: [1,2,3,4] };// ALT\n this.rules[91].opcodes[1] = { type: 6, string: [32] };// TBS\n this.rules[91].opcodes[2] = { type: 6, string: [9] };// TBS\n this.rules[91].opcodes[3] = { type: 4, index: 92 };// RNM(comment)\n this.rules[91].opcodes[4] = { type: 4, index: 94 };// RNM(LineContinue)\n\n /* comment */\n this.rules[92].opcodes = [];\n this.rules[92].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[92].opcodes[1] = { type: 6, string: [59] };// TBS\n this.rules[92].opcodes[2] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[92].opcodes[3] = { type: 1, children: [4,5] };// ALT\n this.rules[92].opcodes[4] = { type: 5, min: 32, max: 126 };// TRG\n this.rules[92].opcodes[5] = { type: 6, string: [9] };// TBS\n\n /* LineEnd */\n this.rules[93].opcodes = [];\n this.rules[93].opcodes[0] = { type: 1, children: [1,2,3] };// ALT\n this.rules[93].opcodes[1] = { type: 6, string: [13,10] };// TBS\n this.rules[93].opcodes[2] = { type: 6, string: [10] };// TBS\n this.rules[93].opcodes[3] = { type: 6, string: [13] };// TBS\n\n /* LineContinue */\n this.rules[94].opcodes = [];\n this.rules[94].opcodes[0] = { type: 2, children: [1,5] };// CAT\n this.rules[94].opcodes[1] = { type: 1, children: [2,3,4] };// ALT\n this.rules[94].opcodes[2] = { type: 6, string: [13,10] };// TBS\n this.rules[94].opcodes[3] = { type: 6, string: [10] };// TBS\n this.rules[94].opcodes[4] = { type: 6, string: [13] };// TBS\n this.rules[94].opcodes[5] = { type: 1, children: [6,7] };// ALT\n this.rules[94].opcodes[6] = { type: 6, string: [32] };// TBS\n this.rules[94].opcodes[7] = { type: 6, string: [9] };// TBS\n\n // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n this.toString = function toString(){\n let str = \"\";\n str += \";\\n\";\n str += \"; ABNF for JavaScript APG 2.0 SABNF\\n\";\n str += \"; RFC 5234 with some restrictions and additions.\\n\";\n str += \"; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation\\n\";\n str += \"; - accepts %s\\\"string\\\" as a case-sensitive string\\n\";\n str += \"; - accepts %i\\\"string\\\" as a case-insensitive string\\n\";\n str += \"; - accepts \\\"string\\\" as a case-insensitive string\\n\";\n str += \";\\n\";\n str += \"; Some restrictions:\\n\";\n str += \"; 1. Rules must begin at first character of each line.\\n\";\n str += \"; Indentations on first rule and rules thereafter are not allowed.\\n\";\n str += \"; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.\\n\";\n str += \"; 3. Prose values, i.e. , are accepted as valid grammar syntax.\\n\";\n str += \"; However, a working parser cannot be generated from them.\\n\";\n str += \";\\n\";\n str += \"; Super set (SABNF) additions:\\n\";\n str += \"; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.\\n\";\n str += \"; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found\\n\";\n str += \"; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found\\n\";\n str += \"; e.g. &%d13 or &rule or !(A / B)\\n\";\n str += \"; 2. User-Defined Terminals (UDT) of the form, u_name and e_name are accepted.\\n\";\n str += \"; 'name' is alpha followed by alpha/num/hyphen just like a rule name.\\n\";\n str += \"; u_name may be used as an element but no rule definition is given.\\n\";\n str += \"; e.g. rule = A / u_myUdt\\n\";\n str += \"; A = \\\"a\\\"\\n\";\n str += \"; would be a valid grammar.\\n\";\n str += \"; 3. Case-sensitive, single-quoted strings are accepted.\\n\";\n str += \"; e.g. 'abc' would be equivalent to %d97.98.99\\n\";\n str += \"; (kept for backward compatibility, but superseded by %s\\\"abc\\\") \\n\";\n str += \"; New 12/26/2015\\n\";\n str += \"; 4. Look-behind operators are accepted as element prefixes.\\n\";\n str += \"; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found\\n\";\n str += \"; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found\\n\";\n str += \"; e.g. &&%d13 or &&rule or !!(A / B)\\n\";\n str += \"; 5. Back reference operators, i.e. \\\\rulename, are accepted.\\n\";\n str += \"; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts\\n\";\n str += \"; to match is a phrase previously matched by the rule 'rulename'.\\n\";\n str += \"; There are two modes of previous phrase matching - the parent-frame mode and the universal mode.\\n\";\n str += \"; In universal mode, \\\\rulename matches the last match to 'rulename' regardless of where it was found.\\n\";\n str += \"; In parent-frame mode, \\\\rulename matches only the last match found on the parent's frame or parse tree level.\\n\";\n str += \"; Back reference modifiers can be used to specify case and mode.\\n\";\n str += \"; \\\\A defaults to case-insensitive and universal mode, e.g. \\\\A === \\\\%i%uA\\n\";\n str += \"; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.\\n\";\n str += \"; Modifiers %u and %p determine universal mode and parent frame mode, respectively.\\n\";\n str += \"; Case and mode modifiers can appear in any order, e.g. \\\\%s%pA === \\\\%p%sA. \\n\";\n str += \"; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.\\n\";\n str += \"; Returns EMPTY or NOMATCH. Never consumes any characters.\\n\";\n str += \"; 8. String end anchor, AEN(%$) matches the end of the input string location.\\n\";\n str += \"; Returns EMPTY or NOMATCH. Never consumes any characters.\\n\";\n str += \";\\n\";\n str += \"File = *(BlankLine / Rule / RuleError)\\n\";\n str += \"BlankLine = *(%d32/%d9) [comment] LineEnd\\n\";\n str += \"Rule = RuleLookup owsp Alternation ((owsp LineEnd)\\n\";\n str += \" / (LineEndError LineEnd))\\n\";\n str += \"RuleLookup = RuleNameTest owsp DefinedAsTest\\n\";\n str += \"RuleNameTest = RuleName/RuleNameError\\n\";\n str += \"RuleName = alphanum\\n\";\n str += \"RuleNameError = 1*(%d33-60/%d62-126)\\n\";\n str += \"DefinedAsTest = DefinedAs / DefinedAsError\\n\";\n str += \"DefinedAsError = 1*2%d33-126\\n\";\n str += \"DefinedAs = IncAlt / Defined\\n\";\n str += \"Defined = %d61\\n\";\n str += \"IncAlt = %d61.47\\n\";\n str += \"RuleError = 1*(%d32-126 / %d9 / LineContinue) LineEnd\\n\";\n str += \"LineEndError = 1*(%d32-126 / %d9 / LineContinue)\\n\";\n str += \"Alternation = Concatenation *(owsp AltOp Concatenation)\\n\";\n str += \"Concatenation = Repetition *(CatOp Repetition)\\n\";\n str += \"Repetition = [Modifier] (Group / Option / BasicElement / BasicElementErr)\\n\";\n str += \"Modifier = (Predicate [RepOp])\\n\";\n str += \" / RepOp\\n\";\n str += \"Predicate = BkaOp\\n\";\n str += \" / BknOp\\n\";\n str += \" / AndOp\\n\";\n str += \" / NotOp\\n\";\n str += \"BasicElement = UdtOp\\n\";\n str += \" / RnmOp\\n\";\n str += \" / TrgOp\\n\";\n str += \" / TbsOp\\n\";\n str += \" / TlsOp\\n\";\n str += \" / ClsOp\\n\";\n str += \" / BkrOp\\n\";\n str += \" / AbgOp\\n\";\n str += \" / AenOp\\n\";\n str += \" / ProsVal\\n\";\n str += \"BasicElementErr = 1*(%d33-40/%d42-46/%d48-92/%d94-126)\\n\";\n str += \"Group = GroupOpen Alternation (GroupClose / GroupError)\\n\";\n str += \"GroupError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\\n\";\n str += \"GroupOpen = %d40 owsp\\n\";\n str += \"GroupClose = owsp %d41\\n\";\n str += \"Option = OptionOpen Alternation (OptionClose / OptionError)\\n\";\n str += \"OptionError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\\n\";\n str += \"OptionOpen = %d91 owsp\\n\";\n str += \"OptionClose = owsp %d93\\n\";\n str += \"RnmOp = alphanum\\n\";\n str += \"BkrOp = %d92 [bkrModifier] bkr-name\\n\";\n str += \"bkrModifier = (cs [um / pm]) / (ci [um / pm]) / (um [cs /ci]) / (pm [cs / ci])\\n\";\n str += \"cs = '%s'\\n\";\n str += \"ci = '%i'\\n\";\n str += \"um = '%u'\\n\";\n str += \"pm = '%p'\\n\";\n str += \"bkr-name = uname / ename / rname\\n\";\n str += \"rname = alphanum\\n\";\n str += \"uname = %d117.95 alphanum\\n\";\n str += \"ename = %d101.95 alphanum\\n\";\n str += \"UdtOp = udt-empty\\n\";\n str += \" / udt-non-empty\\n\";\n str += \"udt-non-empty = %d117.95 alphanum\\n\";\n str += \"udt-empty = %d101.95 alphanum\\n\";\n str += \"RepOp = (rep-min StarOp rep-max)\\n\";\n str += \" / (rep-min StarOp)\\n\";\n str += \" / (StarOp rep-max)\\n\";\n str += \" / StarOp\\n\";\n str += \" / rep-min-max\\n\";\n str += \"AltOp = %d47 owsp\\n\";\n str += \"CatOp = wsp\\n\";\n str += \"StarOp = %d42\\n\";\n str += \"AndOp = %d38\\n\";\n str += \"NotOp = %d33\\n\";\n str += \"BkaOp = %d38.38\\n\";\n str += \"BknOp = %d33.33\\n\";\n str += \"AbgOp = %d37.94\\n\";\n str += \"AenOp = %d37.36\\n\";\n str += \"TrgOp = %d37 ((Dec dmin %d45 dmax) / (Hex xmin %d45 xmax) / (Bin bmin %d45 bmax))\\n\";\n str += \"TbsOp = %d37 ((Dec dString *(%d46 dString)) / (Hex xString *(%d46 xString)) / (Bin bString *(%d46 bString)))\\n\";\n str += \"TlsOp = TlsCase TlsOpen TlsString TlsClose\\n\";\n str += \"TlsCase = [\\\"%i\\\" / \\\"%s\\\"]\\n\";\n str += \"TlsOpen = %d34\\n\";\n str += \"TlsClose = %d34\\n\";\n str += \"TlsString = *(%d32-33/%d35-126/StringTab)\\n\";\n str += \"StringTab = %d9\\n\";\n str += \"ClsOp = ClsOpen ClsString ClsClose\\n\";\n str += \"ClsOpen = %d39\\n\";\n str += \"ClsClose = %d39\\n\";\n str += \"ClsString = *(%d32-38/%d40-126/StringTab)\\n\";\n str += \"ProsVal = ProsValOpen ProsValString ProsValClose\\n\";\n str += \"ProsValOpen = %d60\\n\";\n str += \"ProsValString = *(%d32-61/%d63-126/StringTab)\\n\";\n str += \"ProsValClose = %d62\\n\";\n str += \"rep-min = rep-num\\n\";\n str += \"rep-min-max = rep-num\\n\";\n str += \"rep-max = rep-num\\n\";\n str += \"rep-num = 1*(%d48-57)\\n\";\n str += \"dString = dnum\\n\";\n str += \"xString = xnum\\n\";\n str += \"bString = bnum\\n\";\n str += \"Dec = (%d68/%d100)\\n\";\n str += \"Hex = (%d88/%d120)\\n\";\n str += \"Bin = (%d66/%d98)\\n\";\n str += \"dmin = dnum\\n\";\n str += \"dmax = dnum\\n\";\n str += \"bmin = bnum\\n\";\n str += \"bmax = bnum\\n\";\n str += \"xmin = xnum\\n\";\n str += \"xmax = xnum\\n\";\n str += \"dnum = 1*(%d48-57)\\n\";\n str += \"bnum = 1*%d48-49\\n\";\n str += \"xnum = 1*(%d48-57 / %d65-70 / %d97-102)\\n\";\n str += \";\\n\";\n str += \"; Basics\\n\";\n str += \"alphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)\\n\";\n str += \"owsp = *space\\n\";\n str += \"wsp = 1*space\\n\";\n str += \"space = %d32\\n\";\n str += \" / %d9\\n\";\n str += \" / comment\\n\";\n str += \" / LineContinue\\n\";\n str += \"comment = %d59 *(%d32-126 / %d9)\\n\";\n str += \"LineEnd = %d13.10\\n\";\n str += \" / %d10\\n\";\n str += \" / %d13\\n\";\n str += \"LineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)\\n\";\n return str;\n }\n}\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/sabnf-grammar.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner-callbacks.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// These are the AST translation callback functions used by the scanner\n// to analyze the characters and lines.\nconst ids = __webpack_require__(/*! ../apg-lib/identifiers */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/identifiers.js\");\nconst utils = __webpack_require__(/*! ../apg-lib/utilities */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/utilities.js\");\n\nfunction semLine(state, chars, phraseIndex, phraseCount, data) {\n if (state === ids.SEM_PRE) {\n data.endLength = 0;\n data.textLength = 0;\n data.invalidCount = 0;\n } else {\n data.lines.push({\n lineNo: data.lines.length,\n beginChar: phraseIndex,\n length: phraseCount,\n textLength: data.textLength,\n endType: data.endType,\n invalidChars: data.invalidCount,\n });\n }\n return ids.SEM_OK;\n}\nfunction semLineText(state, chars, phraseIndex, phraseCount, data) {\n if (state === ids.SEM_PRE) {\n data.textLength = phraseCount;\n }\n return ids.SEM_OK;\n}\nfunction semLastLine(state, chars, phraseIndex, phraseCount, data) {\n if (state === ids.SEM_PRE) {\n data.endLength = 0;\n data.textLength = 0;\n data.invalidCount = 0;\n } else if (data.strict) {\n data.lines.push({\n lineNo: data.lines.length,\n beginChar: phraseIndex,\n length: phraseCount,\n textLength: phraseCount,\n endType: 'none',\n invalidChars: data.invalidCount,\n });\n data.errors.push({\n line: data.lineNo,\n char: phraseIndex + phraseCount,\n msg: 'no line end on last line - strict ABNF specifies CRLF(\\\\r\\\\n, \\\\x0D\\\\x0A)',\n });\n } else {\n /* add a line ender */\n chars.push(10);\n data.lines.push({\n lineNo: data.lines.length,\n beginChar: phraseIndex,\n length: phraseCount + 1,\n textLength: phraseCount,\n endType: 'LF',\n invalidChars: data.invalidCount,\n });\n }\n return ids.SEM_OK;\n}\nfunction semInvalid(state, chars, phraseIndex, phraseCount, data) {\n if (state === ids.SEM_PRE) {\n data.errors.push({\n line: data.lineNo,\n char: phraseIndex,\n msg: `invalid character found '\\\\x${utils.charToHex(chars[phraseIndex])}'`,\n });\n }\n return ids.SEM_OK;\n}\nfunction semEnd(state, chars, phraseIndex, phraseCount, data) {\n if (state === ids.SEM_POST) {\n data.lineNo += 1;\n }\n return ids.SEM_OK;\n}\nfunction semLF(state, chars, phraseIndex, phraseCount, data) {\n if (state === ids.SEM_PRE) {\n data.endType = 'LF';\n if (data.strict) {\n data.errors.push({\n line: data.lineNo,\n char: phraseIndex,\n msg: 'line end character LF(\\\\n, \\\\x0A) - strict ABNF specifies CRLF(\\\\r\\\\n, \\\\x0D\\\\x0A)',\n });\n }\n }\n return ids.SEM_OK;\n}\nfunction semCR(state, chars, phraseIndex, phraseCount, data) {\n if (state === ids.SEM_PRE) {\n data.endType = 'CR';\n if (data.strict) {\n data.errors.push({\n line: data.lineNo,\n char: phraseIndex,\n msg: 'line end character CR(\\\\r, \\\\x0D) - strict ABNF specifies CRLF(\\\\r\\\\n, \\\\x0D\\\\x0A)',\n });\n }\n }\n return ids.SEM_OK;\n}\nfunction semCRLF(state, chars, phraseIndex, phraseCount, data) {\n if (state === ids.SEM_PRE) {\n data.endType = 'CRLF';\n }\n return ids.SEM_OK;\n}\nconst callbacks = [];\ncallbacks.line = semLine;\ncallbacks['line-text'] = semLineText;\ncallbacks['last-line'] = semLastLine;\ncallbacks.invalid = semInvalid;\ncallbacks.end = semEnd;\ncallbacks.lf = semLF;\ncallbacks.cr = semCR;\ncallbacks.crlf = semCRLF;\nexports.callbacks = callbacks;\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner-callbacks.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner-grammar.js":module=>{eval("// copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved
\n// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
\n//\n// Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)\nmodule.exports = function grammar(){\n // ```\n // SUMMARY\n // rules = 10\n // udts = 0\n // opcodes = 31\n // --- ABNF original opcodes\n // ALT = 5\n // CAT = 2\n // REP = 4\n // RNM = 11\n // TLS = 0\n // TBS = 4\n // TRG = 5\n // --- SABNF superset opcodes\n // UDT = 0\n // AND = 0\n // NOT = 0\n // BKA = 0\n // BKN = 0\n // BKR = 0\n // ABG = 0\n // AEN = 0\n // characters = [0 - 4294967295]\n // ```\n /* OBJECT IDENTIFIER (for internal parser use) */\n this.grammarObject = 'grammarObject';\n\n /* RULES */\n this.rules = [];\n this.rules[0] = { name: 'file', lower: 'file', index: 0, isBkr: false };\n this.rules[1] = { name: 'line', lower: 'line', index: 1, isBkr: false };\n this.rules[2] = { name: 'line-text', lower: 'line-text', index: 2, isBkr: false };\n this.rules[3] = { name: 'last-line', lower: 'last-line', index: 3, isBkr: false };\n this.rules[4] = { name: 'valid', lower: 'valid', index: 4, isBkr: false };\n this.rules[5] = { name: 'invalid', lower: 'invalid', index: 5, isBkr: false };\n this.rules[6] = { name: 'end', lower: 'end', index: 6, isBkr: false };\n this.rules[7] = { name: 'CRLF', lower: 'crlf', index: 7, isBkr: false };\n this.rules[8] = { name: 'LF', lower: 'lf', index: 8, isBkr: false };\n this.rules[9] = { name: 'CR', lower: 'cr', index: 9, isBkr: false };\n\n /* UDTS */\n this.udts = [];\n\n /* OPCODES */\n /* file */\n this.rules[0].opcodes = [];\n this.rules[0].opcodes[0] = { type: 2, children: [1,3] };// CAT\n this.rules[0].opcodes[1] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[0].opcodes[2] = { type: 4, index: 1 };// RNM(line)\n this.rules[0].opcodes[3] = { type: 3, min: 0, max: 1 };// REP\n this.rules[0].opcodes[4] = { type: 4, index: 3 };// RNM(last-line)\n\n /* line */\n this.rules[1].opcodes = [];\n this.rules[1].opcodes[0] = { type: 2, children: [1,2] };// CAT\n this.rules[1].opcodes[1] = { type: 4, index: 2 };// RNM(line-text)\n this.rules[1].opcodes[2] = { type: 4, index: 6 };// RNM(end)\n\n /* line-text */\n this.rules[2].opcodes = [];\n this.rules[2].opcodes[0] = { type: 3, min: 0, max: Infinity };// REP\n this.rules[2].opcodes[1] = { type: 1, children: [2,3] };// ALT\n this.rules[2].opcodes[2] = { type: 4, index: 4 };// RNM(valid)\n this.rules[2].opcodes[3] = { type: 4, index: 5 };// RNM(invalid)\n\n /* last-line */\n this.rules[3].opcodes = [];\n this.rules[3].opcodes[0] = { type: 3, min: 1, max: Infinity };// REP\n this.rules[3].opcodes[1] = { type: 1, children: [2,3] };// ALT\n this.rules[3].opcodes[2] = { type: 4, index: 4 };// RNM(valid)\n this.rules[3].opcodes[3] = { type: 4, index: 5 };// RNM(invalid)\n\n /* valid */\n this.rules[4].opcodes = [];\n this.rules[4].opcodes[0] = { type: 1, children: [1,2] };// ALT\n this.rules[4].opcodes[1] = { type: 5, min: 32, max: 126 };// TRG\n this.rules[4].opcodes[2] = { type: 6, string: [9] };// TBS\n\n /* invalid */\n this.rules[5].opcodes = [];\n this.rules[5].opcodes[0] = { type: 1, children: [1,2,3,4] };// ALT\n this.rules[5].opcodes[1] = { type: 5, min: 0, max: 8 };// TRG\n this.rules[5].opcodes[2] = { type: 5, min: 11, max: 12 };// TRG\n this.rules[5].opcodes[3] = { type: 5, min: 14, max: 31 };// TRG\n this.rules[5].opcodes[4] = { type: 5, min: 127, max: 4294967295 };// TRG\n\n /* end */\n this.rules[6].opcodes = [];\n this.rules[6].opcodes[0] = { type: 1, children: [1,2,3] };// ALT\n this.rules[6].opcodes[1] = { type: 4, index: 7 };// RNM(CRLF)\n this.rules[6].opcodes[2] = { type: 4, index: 8 };// RNM(LF)\n this.rules[6].opcodes[3] = { type: 4, index: 9 };// RNM(CR)\n\n /* CRLF */\n this.rules[7].opcodes = [];\n this.rules[7].opcodes[0] = { type: 6, string: [13,10] };// TBS\n\n /* LF */\n this.rules[8].opcodes = [];\n this.rules[8].opcodes[0] = { type: 6, string: [10] };// TBS\n\n /* CR */\n this.rules[9].opcodes = [];\n this.rules[9].opcodes[0] = { type: 6, string: [13] };// TBS\n\n // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n this.toString = function toString(){\n let str = \"\";\n str += \"file = *line [last-line]\\n\";\n str += \"line = line-text end\\n\";\n str += \"line-text = *(valid/invalid)\\n\";\n str += \"last-line = 1*(valid/invalid)\\n\";\n str += \"valid = %d32-126 / %d9\\n\";\n str += \"invalid = %d0-8 / %d11-12 /%d14-31 / %x7f-ffffffff\\n\";\n str += \"end = CRLF / LF / CR\\n\";\n str += \"CRLF = %d13.10\\n\";\n str += \"LF = %d10\\n\";\n str += \"CR = %d13\\n\";\n return str;\n }\n}\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner-grammar.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module reads the input grammar file and does a preliminary analysis\n// before attempting to parse it into a grammar object.\n// See:
\n// `./dist/scanner-grammar.bnf`
\n// for the grammar file this parser is based on.\n//\n// It has two primary functions.\n// - verify the character codes - no non-printing ASCII characters\n// - catalog the lines - create an array with a line object for each line.\n// The object carries information about the line number and character length which is used\n// by the parser generator primarily for error reporting.\nmodule.exports = function exfn(chars, errors, strict, trace) {\n const thisFileName = 'scanner.js: ';\n const apglib = __webpack_require__(/*! ../apg-lib/node-exports */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/node-exports.js\");\n const grammar = new (__webpack_require__(/*! ./scanner-grammar */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner-grammar.js\"))();\n const { callbacks } = __webpack_require__(/*! ./scanner-callbacks */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner-callbacks.js\");\n\n /* Scan the grammar for character code errors and catalog the lines. */\n const lines = [];\n // eslint-disable-next-line new-cap\n const parser = new apglib.parser();\n // eslint-disable-next-line new-cap\n parser.ast = new apglib.ast();\n parser.ast.callbacks = callbacks;\n if (trace) {\n if (trace.traceObject !== 'traceObject') {\n throw new TypeError(`${thisFileName}trace argument is not a trace object`);\n }\n parser.trace = trace;\n }\n\n /* parse the input SABNF grammar */\n const test = parser.parse(grammar, 'file', chars);\n if (test.success !== true) {\n errors.push({\n line: 0,\n char: 0,\n msg: 'syntax analysis error analyzing input SABNF grammar',\n });\n return;\n }\n const data = {\n lines,\n lineNo: 0,\n errors,\n strict: !!strict,\n };\n\n /* translate (analyze) the input SABNF grammar */\n parser.ast.translate(data);\n // eslint-disable-next-line consistent-return\n return lines;\n};\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/scanner.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/semantic-callbacks.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module has all of the AST translation callback functions for the semantic analysis\n// phase of the generator.\n// See:
\n// `./dist/abnf-for-sabnf-grammar.bnf`
\n// for the grammar file these callback functions are based on.\nmodule.exports = function exfn() {\n const apglib = __webpack_require__(/*! ../apg-lib/node-exports */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/node-exports.js\");\n const id = apglib.ids;\n\n /* Some helper functions. */\n const NameList = function NameList() {\n this.names = [];\n /* Adds a new rule name object to the list. Returns -1 if the name already exists. */\n /* Returns the added name object if the name does not already exist. */\n this.add = function add(name) {\n let ret = -1;\n const find = this.get(name);\n if (find === -1) {\n ret = {\n name,\n lower: name.toLowerCase(),\n index: this.names.length,\n };\n this.names.push(ret);\n }\n return ret;\n };\n /* Brute-force look up. */\n this.get = function get(name) {\n let ret = -1;\n const lower = name.toLowerCase();\n for (let i = 0; i < this.names.length; i += 1) {\n if (this.names[i].lower === lower) {\n ret = this.names[i];\n break;\n }\n }\n return ret;\n };\n };\n /* converts text decimal numbers from, e.g. %d99, to an integer */\n const decnum = function decnum(chars, beg, len) {\n let num = 0;\n for (let i = beg; i < beg + len; i += 1) {\n num = 10 * num + chars[i] - 48;\n }\n return num;\n };\n /* converts text binary numbers from, e.g. %b10, to an integer */\n const binnum = function binnum(chars, beg, len) {\n let num = 0;\n for (let i = beg; i < beg + len; i += 1) {\n num = 2 * num + chars[i] - 48;\n }\n return num;\n };\n /* converts text hexadecimal numbers from, e.g. %xff, to an integer */\n const hexnum = function hexnum(chars, beg, len) {\n let num = 0;\n for (let i = beg; i < beg + len; i += 1) {\n let digit = chars[i];\n if (digit >= 48 && digit <= 57) {\n digit -= 48;\n } else if (digit >= 65 && digit <= 70) {\n digit -= 55;\n } else if (digit >= 97 && digit <= 102) {\n digit -= 87;\n } else {\n throw new Error('hexnum out of range');\n }\n num = 16 * num + digit;\n }\n return num;\n };\n\n // This is the prototype for all semantic analysis callback functions.\n // ````\n // state - the translator state\n // id.SEM_PRE for downward (pre-branch) traversal of the AST\n // id.SEM_POST for upward (post branch) traversal of the AST\n // chars - the array of character codes for the input string\n // phraseIndex - index into the chars array to the first\n // character of the phrase\n // phraseCount - the number of characters in the phrase\n // data - user-defined data passed to the translator\n // for use by the callback functions.\n // @return id.SEM_OK, normal return.\n // id.SEM_SKIP in state id.SEM_PRE will\n // skip the branch below.\n // Any thing else is an error which will\n // stop the translation.\n // ````\n /*\n function semCallbackPrototype(state, chars, phraseIndex, phraseCount, data) {\n let ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n } else if (state === id.SEM_POST) {\n }\n return ret;\n }\n */\n // The AST callback functions.\n function semFile(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.ruleNames = new NameList();\n data.udtNames = new NameList();\n data.rules = [];\n data.udts = [];\n data.rulesLineMap = [];\n data.opcodes = [];\n data.altStack = [];\n data.topStack = null;\n data.topRule = null;\n } else if (state === id.SEM_POST) {\n /* validate RNM rule names and set opcode rule index */\n let nameObj;\n data.rules.forEach((rule) => {\n rule.isBkr = false;\n rule.opcodes.forEach((op) => {\n if (op.type === id.RNM) {\n nameObj = data.ruleNames.get(op.index.name);\n if (nameObj === -1) {\n data.errors.push({\n line: data.findLine(data.lines, op.index.phraseIndex, data.charsLength),\n char: op.index.phraseIndex,\n msg: `Rule name '${op.index.name}' used but not defined.`,\n });\n op.index = -1;\n } else {\n op.index = nameObj.index;\n }\n }\n });\n });\n /* validate BKR rule names and set opcode rule index */\n data.udts.forEach((udt) => {\n udt.isBkr = false;\n });\n data.rules.forEach((rule) => {\n rule.opcodes.forEach((op) => {\n if (op.type === id.BKR) {\n rule.hasBkr = true;\n nameObj = data.ruleNames.get(op.index.name);\n if (nameObj !== -1) {\n data.rules[nameObj.index].isBkr = true;\n op.index = nameObj.index;\n } else {\n nameObj = data.udtNames.get(op.index.name);\n if (nameObj !== -1) {\n data.udts[nameObj.index].isBkr = true;\n op.index = data.rules.length + nameObj.index;\n } else {\n data.errors.push({\n line: data.findLine(data.lines, op.index.phraseIndex, data.charsLength),\n char: op.index.phraseIndex,\n msg: `Back reference name '${op.index.name}' refers to undefined rule or unamed UDT.`,\n });\n op.index = -1;\n }\n }\n }\n });\n });\n }\n return ret;\n }\n function semRule(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.altStack.length = 0;\n data.topStack = null;\n data.rulesLineMap.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n });\n }\n return ret;\n }\n function semRuleLookup(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.ruleName = '';\n data.definedas = '';\n } else if (state === id.SEM_POST) {\n let ruleName;\n if (data.definedas === '=') {\n ruleName = data.ruleNames.add(data.ruleName);\n if (ruleName === -1) {\n data.definedas = null;\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: `Rule name '${data.ruleName}' previously defined.`,\n });\n } else {\n /* start a new rule */\n data.topRule = {\n name: ruleName.name,\n lower: ruleName.lower,\n opcodes: [],\n index: ruleName.index,\n };\n data.rules.push(data.topRule);\n data.opcodes = data.topRule.opcodes;\n }\n } else {\n ruleName = data.ruleNames.get(data.ruleName);\n if (ruleName === -1) {\n data.definedas = null;\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: `Rule name '${data.ruleName}' for incremental alternate not previously defined.`,\n });\n } else {\n data.topRule = data.rules[ruleName.index];\n data.opcodes = data.topRule.opcodes;\n }\n }\n }\n return ret;\n }\n function semAlternation(state, chars, phraseIndex, phraseCount, data) {\n let ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n const TRUE = true;\n while (TRUE) {\n if (data.definedas === null) {\n /* rule error - skip opcode generation */\n ret = id.SEM_SKIP;\n break;\n }\n if (data.topStack === null) {\n /* top-level ALT */\n if (data.definedas === '=') {\n /* \"=\" new rule */\n data.topStack = {\n alt: {\n type: id.ALT,\n children: [],\n },\n cat: null,\n };\n data.altStack.push(data.topStack);\n data.opcodes.push(data.topStack.alt);\n break;\n }\n /* \"=/\" incremental alternate */\n data.topStack = {\n alt: data.opcodes[0],\n cat: null,\n };\n data.altStack.push(data.topStack);\n break;\n }\n /* lower-level ALT */\n data.topStack = {\n alt: {\n type: id.ALT,\n children: [],\n },\n cat: null,\n };\n data.altStack.push(data.topStack);\n data.opcodes.push(data.topStack.alt);\n break;\n }\n } else if (state === id.SEM_POST) {\n data.altStack.pop();\n if (data.altStack.length > 0) {\n data.topStack = data.altStack[data.altStack.length - 1];\n } else {\n data.topStack = null;\n }\n }\n return ret;\n }\n function semConcatenation(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.topStack.alt.children.push(data.opcodes.length);\n data.topStack.cat = {\n type: id.CAT,\n children: [],\n };\n data.opcodes.push(data.topStack.cat);\n } else if (state === id.SEM_POST) {\n data.topStack.cat = null;\n }\n return ret;\n }\n function semRepetition(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.topStack.cat.children.push(data.opcodes.length);\n }\n return ret;\n }\n function semOptionOpen(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.REP,\n min: 0,\n max: 1,\n char: phraseIndex,\n });\n }\n return ret;\n }\n function semRuleName(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.ruleName = apglib.utils.charsToString(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semDefined(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.definedas = '=';\n }\n return ret;\n }\n function semIncAlt(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.definedas = '=/';\n }\n return ret;\n }\n function semRepOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.min = 0;\n data.max = Infinity;\n data.topRep = {\n type: id.REP,\n min: 0,\n max: Infinity,\n };\n data.opcodes.push(data.topRep);\n } else if (state === id.SEM_POST) {\n if (data.min > data.max) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: `repetition min cannot be greater than max: min: ${data.min}: max: ${data.max}`,\n });\n }\n data.topRep.min = data.min;\n data.topRep.max = data.max;\n }\n return ret;\n }\n function semRepMin(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.min = decnum(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semRepMax(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.max = decnum(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semRepMinMax(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.max = decnum(chars, phraseIndex, phraseCount);\n data.min = data.max;\n }\n return ret;\n }\n function semAndOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.AND,\n });\n }\n return ret;\n }\n function semNotOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.NOT,\n });\n }\n return ret;\n }\n function semRnmOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.RNM,\n /* NOTE: this is temporary info, index will be replaced with integer later. */\n /* Probably not the best coding practice but here you go. */\n index: {\n phraseIndex,\n name: apglib.utils.charsToString(chars, phraseIndex, phraseCount),\n },\n });\n }\n return ret;\n }\n function semAbgOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.ABG,\n });\n }\n return ret;\n }\n function semAenOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.AEN,\n });\n }\n return ret;\n }\n function semBkaOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.BKA,\n });\n }\n return ret;\n }\n function semBknOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.BKN,\n });\n }\n return ret;\n }\n function semBkrOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.ci = true; /* default to case insensitive */\n data.cs = false;\n data.um = true;\n data.pm = false;\n } else if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.BKR,\n bkrCase: data.cs === true ? id.BKR_MODE_CS : id.BKR_MODE_CI,\n bkrMode: data.pm === true ? id.BKR_MODE_PM : id.BKR_MODE_UM,\n /* NOTE: this is temporary info, index will be replaced with integer later. */\n /* Probably not the best coding practice but here you go. */\n index: {\n phraseIndex: data.bkrname.phraseIndex,\n name: apglib.utils.charsToString(chars, data.bkrname.phraseIndex, data.bkrname.phraseLength),\n },\n });\n }\n return ret;\n }\n function semBkrCi(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.ci = true;\n }\n return ret;\n }\n function semBkrCs(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.cs = true;\n }\n return ret;\n }\n function semBkrUm(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.um = true;\n }\n return ret;\n }\n function semBkrPm(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.pm = true;\n }\n return ret;\n }\n function semBkrName(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.bkrname = {\n phraseIndex,\n phraseLength: phraseCount,\n };\n }\n return ret;\n }\n function semUdtEmpty(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n const name = apglib.utils.charsToString(chars, phraseIndex, phraseCount);\n let udtName = data.udtNames.add(name);\n if (udtName === -1) {\n udtName = data.udtNames.get(name);\n if (udtName === -1) {\n throw new Error('semUdtEmpty: name look up error');\n }\n } else {\n data.udts.push({\n name: udtName.name,\n lower: udtName.lower,\n index: udtName.index,\n empty: true,\n });\n }\n data.opcodes.push({\n type: id.UDT,\n empty: true,\n index: udtName.index,\n });\n }\n return ret;\n }\n function semUdtNonEmpty(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n const name = apglib.utils.charsToString(chars, phraseIndex, phraseCount);\n let udtName = data.udtNames.add(name);\n if (udtName === -1) {\n udtName = data.udtNames.get(name);\n if (udtName === -1) {\n throw new Error('semUdtNonEmpty: name look up error');\n }\n } else {\n data.udts.push({\n name: udtName.name,\n lower: udtName.lower,\n index: udtName.index,\n empty: false,\n });\n }\n data.opcodes.push({\n type: id.UDT,\n empty: false,\n index: udtName.index,\n syntax: null,\n semantic: null,\n });\n }\n return ret;\n }\n function semTlsOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.tlscase = true; /* default to case insensitive */\n }\n return ret;\n }\n function semTlsCase(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n if (phraseCount > 0 && (chars[phraseIndex + 1] === 83 || chars[phraseIndex + 1] === 115)) {\n data.tlscase = false; /* set to case sensitive */\n }\n }\n return ret;\n }\n function semTlsString(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n if (data.tlscase) {\n const str = chars.slice(phraseIndex, phraseIndex + phraseCount);\n for (let i = 0; i < str.length; i += 1) {\n if (str[i] >= 65 && str[i] <= 90) {\n str[i] += 32;\n }\n }\n data.opcodes.push({\n type: id.TLS,\n string: str,\n });\n } else {\n data.opcodes.push({\n type: id.TBS,\n string: chars.slice(phraseIndex, phraseIndex + phraseCount),\n });\n }\n }\n return ret;\n }\n function semClsOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n if (phraseCount <= 2) {\n /* only TLS is allowed to be empty */\n data.opcodes.push({\n type: id.TLS,\n string: [],\n });\n } else {\n data.opcodes.push({\n type: id.TBS,\n string: chars.slice(phraseIndex + 1, phraseIndex + phraseCount - 1),\n });\n }\n }\n return ret;\n }\n function semTbsOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.tbsstr = [];\n } else if (state === id.SEM_POST) {\n data.opcodes.push({\n type: id.TBS,\n string: data.tbsstr,\n });\n }\n return ret;\n }\n function semTrgOp(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_PRE) {\n data.min = 0;\n data.max = 0;\n } else if (state === id.SEM_POST) {\n if (data.min > data.max) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: `TRG, (%dmin-max), min cannot be greater than max: min: ${data.min}: max: ${data.max}`,\n });\n }\n data.opcodes.push({\n type: id.TRG,\n min: data.min,\n max: data.max,\n });\n }\n return ret;\n }\n function semDmin(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.min = decnum(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semDmax(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.max = decnum(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semBmin(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.min = binnum(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semBmax(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.max = binnum(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semXmin(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.min = hexnum(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semXmax(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.max = hexnum(chars, phraseIndex, phraseCount);\n }\n return ret;\n }\n function semDstring(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.tbsstr.push(decnum(chars, phraseIndex, phraseCount));\n }\n return ret;\n }\n function semBstring(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.tbsstr.push(binnum(chars, phraseIndex, phraseCount));\n }\n return ret;\n }\n function semXstring(state, chars, phraseIndex, phraseCount, data) {\n const ret = id.SEM_OK;\n if (state === id.SEM_POST) {\n data.tbsstr.push(hexnum(chars, phraseIndex, phraseCount));\n }\n return ret;\n }\n // Define the callback functions to the AST object.\n this.callbacks = [];\n this.callbacks.abgop = semAbgOp;\n this.callbacks.aenop = semAenOp;\n this.callbacks.alternation = semAlternation;\n this.callbacks.andop = semAndOp;\n this.callbacks.bmax = semBmax;\n this.callbacks.bmin = semBmin;\n this.callbacks.bkaop = semBkaOp;\n this.callbacks.bknop = semBknOp;\n this.callbacks.bkrop = semBkrOp;\n this.callbacks['bkr-name'] = semBkrName;\n this.callbacks.bstring = semBstring;\n this.callbacks.clsop = semClsOp;\n this.callbacks.ci = semBkrCi;\n this.callbacks.cs = semBkrCs;\n this.callbacks.um = semBkrUm;\n this.callbacks.pm = semBkrPm;\n this.callbacks.concatenation = semConcatenation;\n this.callbacks.defined = semDefined;\n this.callbacks.dmax = semDmax;\n this.callbacks.dmin = semDmin;\n this.callbacks.dstring = semDstring;\n this.callbacks.file = semFile;\n this.callbacks.incalt = semIncAlt;\n this.callbacks.notop = semNotOp;\n this.callbacks.optionopen = semOptionOpen;\n this.callbacks['rep-max'] = semRepMax;\n this.callbacks['rep-min'] = semRepMin;\n this.callbacks['rep-min-max'] = semRepMinMax;\n this.callbacks.repetition = semRepetition;\n this.callbacks.repop = semRepOp;\n this.callbacks.rnmop = semRnmOp;\n this.callbacks.rule = semRule;\n this.callbacks.rulelookup = semRuleLookup;\n this.callbacks.rulename = semRuleName;\n this.callbacks.tbsop = semTbsOp;\n this.callbacks.tlscase = semTlsCase;\n this.callbacks.tlsstring = semTlsString;\n this.callbacks.tlsop = semTlsOp;\n this.callbacks.trgop = semTrgOp;\n this.callbacks['udt-empty'] = semUdtEmpty;\n this.callbacks['udt-non-empty'] = semUdtNonEmpty;\n this.callbacks.xmax = semXmax;\n this.callbacks.xmin = semXmin;\n this.callbacks.xstring = semXstring;\n};\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/semantic-callbacks.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/show-rules.js":module=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\nmodule.exports = (function exfn() {\n const thisFileName = 'show-rules.js';\n // Display the rules.\n // This function may be called before the attributes calculation.\n // Sorting is done independently from the attributes.\n // - order\n // - \"index\" or \"i\", index order (default)\n // - \"alpha\" or \"a\", alphabetical order\n // - none of above, index order (default)\n const showRules = function showRules(rulesIn = [], udtsIn = [], order = 'index') {\n const thisFuncName = 'showRules';\n let alphaArray = [];\n let udtAlphaArray = [];\n const indexArray = [];\n const udtIndexArray = [];\n const rules = rulesIn;\n const udts = udtsIn;\n const ruleCount = rulesIn.length;\n const udtCount = udtsIn.length;\n let str = 'RULE/UDT NAMES';\n let i;\n function compRulesAlpha(left, right) {\n if (rules[left].lower < rules[right].lower) {\n return -1;\n }\n if (rules[left].lower > rules[right].lower) {\n return 1;\n }\n return 0;\n }\n function compUdtsAlpha(left, right) {\n if (udts[left].lower < udts[right].lower) {\n return -1;\n }\n if (udts[left].lower > udts[right].lower) {\n return 1;\n }\n return 0;\n }\n if (!(Array.isArray(rulesIn) && rulesIn.length)) {\n throw new Error(`${thisFileName}:${thisFuncName}: rules arg must be array with length > 0`);\n }\n if (!Array.isArray(udtsIn)) {\n throw new Error(`${thisFileName}:${thisFuncName}: udts arg must be array`);\n }\n\n for (i = 0; i < ruleCount; i += 1) {\n indexArray.push(i);\n }\n alphaArray = indexArray.slice(0);\n alphaArray.sort(compRulesAlpha);\n if (udtCount) {\n for (i = 0; i < udtCount; i += 1) {\n udtIndexArray.push(i);\n }\n udtAlphaArray = udtIndexArray.slice(0);\n udtAlphaArray.sort(compUdtsAlpha);\n }\n if (order.charCodeAt(0) === 97) {\n str += ' - alphabetical by rule/UDT name\\n';\n for (i = 0; i < ruleCount; i += 1) {\n str += `${i}: ${alphaArray[i]}: ${rules[alphaArray[i]].name}\\n`;\n }\n if (udtCount) {\n for (i = 0; i < udtCount; i += 1) {\n str += `${i}: ${udtAlphaArray[i]}: ${udts[udtAlphaArray[i]].name}\\n`;\n }\n }\n } else {\n str += ' - ordered by rule/UDT index\\n';\n for (i = 0; i < ruleCount; i += 1) {\n str += `${i}: ${rules[i].name}\\n`;\n }\n if (udtCount) {\n for (i = 0; i < udtCount; i += 1) {\n str += `${i}: ${udts[i].name}\\n`;\n }\n }\n }\n return str;\n };\n return showRules;\n})();\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/show-rules.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/syntax-callbacks.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/* eslint-disable func-names */\n/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module has all of the callback functions for the syntax phase of the generation.\n// See:
\n// `./dist/abnf-for-sabnf-grammar.bnf`
\n// for the grammar file these callback functions are based on.\nmodule.exports = function exfn() {\n const thisFileName = 'syntax-callbacks.js: ';\n const apglib = __webpack_require__(/*! ../apg-lib/node-exports */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/node-exports.js\");\n const id = apglib.ids;\n let topAlt;\n /* syntax, RNM, callback functions */\n const synFile = function synFile(result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n data.altStack = [];\n data.repCount = 0;\n break;\n case id.EMPTY:\n data.errors.push({\n line: 0,\n char: 0,\n msg: 'grammar file is empty',\n });\n break;\n case id.MATCH:\n if (data.ruleCount === 0) {\n data.errors.push({\n line: 0,\n char: 0,\n msg: 'no rules defined',\n });\n }\n break;\n case id.NOMATCH:\n throw new Error(`${thisFileName}synFile: grammar file NOMATCH: design error: should never happen.`);\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n // eslint-disable-next-line func-names\n const synRule = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n data.altStack.length = 0;\n topAlt = {\n groupOpen: null,\n groupError: false,\n optionOpen: null,\n optionError: false,\n tlsOpen: null,\n clsOpen: null,\n prosValOpen: null,\n basicError: false,\n };\n data.altStack.push(topAlt);\n break;\n case id.EMPTY:\n throw new Error(`${thisFileName}synRule: EMPTY: rule cannot be empty`);\n case id.NOMATCH:\n break;\n case id.MATCH:\n data.ruleCount += 1;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synRuleError = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Unrecognized SABNF line. Invalid rule, comment or blank line.',\n });\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synRuleNameError = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Rule names must be alphanum and begin with alphabetic character.',\n });\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synDefinedAsError = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: \"Expected '=' or '=/'. Not found.\",\n });\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synAndOp = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.strict) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'AND operator(&) found - strict ABNF specified.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synNotOp = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.strict) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'NOT operator(!) found - strict ABNF specified.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synBkaOp = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.strict) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Positive look-behind operator(&&) found - strict ABNF specified.',\n });\n } else if (data.lite) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Positive look-behind operator(&&) found - apg-lite specified.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synBknOp = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.strict) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Negative look-behind operator(!!) found - strict ABNF specified.',\n });\n } else if (data.lite) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Negative look-behind operator(!!) found - apg-lite specified.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synAbgOp = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.strict) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Beginning of string anchor(%^) found - strict ABNF specified.',\n });\n } else if (data.lite) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Beginning of string anchor(%^) found - apg-lite specified.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synAenOp = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.strict) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'End of string anchor(%$) found - strict ABNF specified.',\n });\n } else if (data.lite) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'End of string anchor(%$) found - apg-lite specified.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synBkrOp = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.strict) {\n const name = apglib.utils.charsToString(chars, phraseIndex, result.phraseLength);\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: `Back reference operator(${name}) found - strict ABNF specified.`,\n });\n } else if (data.lite) {\n const name = apglib.utils.charsToString(chars, phraseIndex, result.phraseLength);\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: `Back reference operator(${name}) found - apg-lite specified.`,\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synUdtOp = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.strict) {\n const name = apglib.utils.charsToString(chars, phraseIndex, result.phraseLength);\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: `UDT operator found(${name}) - strict ABNF specified.`,\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synTlsOpen = function (result, chars, phraseIndex) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n topAlt.tlsOpen = phraseIndex;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synTlsString = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n data.stringTabChar = false;\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.stringTabChar !== false) {\n data.errors.push({\n line: data.findLine(data.lines, data.stringTabChar),\n char: data.stringTabChar,\n msg: \"Tab character (\\\\t, x09) not allowed in literal string (see 'quoted-string' definition, RFC 7405.)\",\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synStringTab = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n data.stringTabChar = phraseIndex;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synTlsClose = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n data.errors.push({\n line: data.findLine(data.lines, topAlt.tlsOpen),\n char: topAlt.tlsOpen,\n msg: 'Case-insensitive literal string(\"...\") opened but not closed.',\n });\n topAlt.basicError = true;\n topAlt.tlsOpen = null;\n break;\n case id.MATCH:\n topAlt.tlsOpen = null;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synClsOpen = function (result, chars, phraseIndex) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n topAlt.clsOpen = phraseIndex;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synClsString = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n data.stringTabChar = false;\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.stringTabChar !== false) {\n data.errors.push({\n line: data.findLine(data.lines, data.stringTabChar),\n char: data.stringTabChar,\n msg: 'Tab character (\\\\t, x09) not allowed in literal string.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synClsClose = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n data.errors.push({\n line: data.findLine(data.lines, topAlt.clsOpen),\n char: topAlt.clsOpen,\n msg: \"Case-sensitive literal string('...') opened but not closed.\",\n });\n topAlt.clsOpen = null;\n topAlt.basicError = true;\n break;\n case id.MATCH:\n if (data.strict) {\n data.errors.push({\n line: data.findLine(data.lines, topAlt.clsOpen),\n char: topAlt.clsOpen,\n msg: \"Case-sensitive string operator('...') found - strict ABNF specified.\",\n });\n }\n topAlt.clsOpen = null;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synProsValOpen = function (result, chars, phraseIndex) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n topAlt.prosValOpen = phraseIndex;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synProsValString = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n data.stringTabChar = false;\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (data.stringTabChar !== false) {\n data.errors.push({\n line: data.findLine(data.lines, data.stringTabChar),\n char: data.stringTabChar,\n msg: 'Tab character (\\\\t, x09) not allowed in prose value string.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synProsValClose = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n data.errors.push({\n line: data.findLine(data.lines, topAlt.prosValOpen),\n char: topAlt.prosValOpen,\n msg: 'Prose value operator(<...>) opened but not closed.',\n });\n topAlt.basicError = true;\n topAlt.prosValOpen = null;\n break;\n case id.MATCH:\n data.errors.push({\n line: data.findLine(data.lines, topAlt.prosValOpen),\n char: topAlt.prosValOpen,\n msg: 'Prose value operator(<...>) found. The ABNF syntax is valid, but a parser cannot be generated from this grammar.',\n });\n topAlt.prosValOpen = null;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synGroupOpen = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n topAlt = {\n groupOpen: phraseIndex,\n groupError: false,\n optionOpen: null,\n optionError: false,\n tlsOpen: null,\n clsOpen: null,\n prosValOpen: null,\n basicError: false,\n };\n data.altStack.push(topAlt);\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synGroupClose = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n data.errors.push({\n line: data.findLine(data.lines, topAlt.groupOpen),\n char: topAlt.groupOpen,\n msg: 'Group \"(...)\" opened but not closed.',\n });\n topAlt = data.altStack.pop();\n topAlt.groupError = true;\n break;\n case id.MATCH:\n topAlt = data.altStack.pop();\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synOptionOpen = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n topAlt = {\n groupOpen: null,\n groupError: false,\n optionOpen: phraseIndex,\n optionError: false,\n tlsOpen: null,\n clsOpen: null,\n prosValOpen: null,\n basicError: false,\n };\n data.altStack.push(topAlt);\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synOptionClose = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n data.errors.push({\n line: data.findLine(data.lines, topAlt.optionOpen),\n char: topAlt.optionOpen,\n msg: 'Option \"[...]\" opened but not closed.',\n });\n topAlt = data.altStack.pop();\n topAlt.optionError = true;\n break;\n case id.MATCH:\n topAlt = data.altStack.pop();\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synBasicElementError = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (topAlt.basicError === false) {\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Unrecognized SABNF element.',\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synLineEnd = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n if (result.phraseLength === 1 && data.strict) {\n const end = chars[phraseIndex] === 13 ? 'CR' : 'LF';\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: `Line end '${end}' found - strict ABNF specified, only CRLF allowed.`,\n });\n }\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synLineEndError = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n break;\n case id.MATCH:\n data.errors.push({\n line: data.findLine(data.lines, phraseIndex, data.charsLength),\n char: phraseIndex,\n msg: 'Unrecognized grammar element or characters.',\n });\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n const synRepetition = function (result, chars, phraseIndex, data) {\n switch (result.state) {\n case id.ACTIVE:\n break;\n case id.EMPTY:\n break;\n case id.NOMATCH:\n data.repCount += 1;\n break;\n case id.MATCH:\n data.repCount += 1;\n break;\n default:\n throw new Error(`${thisFileName}synFile: unrecognized case.`);\n }\n };\n // Define the list of callback functions.\n this.callbacks = [];\n this.callbacks.andop = synAndOp;\n this.callbacks.basicelementerr = synBasicElementError;\n this.callbacks.clsclose = synClsClose;\n this.callbacks.clsopen = synClsOpen;\n this.callbacks.clsstring = synClsString;\n this.callbacks.definedaserror = synDefinedAsError;\n this.callbacks.file = synFile;\n this.callbacks.groupclose = synGroupClose;\n this.callbacks.groupopen = synGroupOpen;\n this.callbacks.lineenderror = synLineEndError;\n this.callbacks.lineend = synLineEnd;\n this.callbacks.notop = synNotOp;\n this.callbacks.optionclose = synOptionClose;\n this.callbacks.optionopen = synOptionOpen;\n this.callbacks.prosvalclose = synProsValClose;\n this.callbacks.prosvalopen = synProsValOpen;\n this.callbacks.prosvalstring = synProsValString;\n this.callbacks.repetition = synRepetition;\n this.callbacks.rule = synRule;\n this.callbacks.ruleerror = synRuleError;\n this.callbacks.rulenameerror = synRuleNameError;\n this.callbacks.stringtab = synStringTab;\n this.callbacks.tlsclose = synTlsClose;\n this.callbacks.tlsopen = synTlsOpen;\n this.callbacks.tlsstring = synTlsString;\n this.callbacks.udtop = synUdtOp;\n this.callbacks.bkaop = synBkaOp;\n this.callbacks.bknop = synBknOp;\n this.callbacks.bkrop = synBkrOp;\n this.callbacks.abgop = synAbgOp;\n this.callbacks.aenop = synAenOp;\n};\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-api/syntax-callbacks.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-conv-api/converter.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module exposes the public encoding, decoding and conversion functions.\n// Its private functions provide the disassembling and interpetation of the source and destination encoding types.\n// In the case of Unicode encodings, private functions determine the presence of Byte Order Marks (BOMs), if any.\n//\n// Throws \"TypeError\" exceptions on input errors.\n//\n\n'use strict;';\n\nconst { Buffer } = __webpack_require__(/*! buffer */ \"./node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js\");\n\nconst trans = __webpack_require__(/*! ./transformers */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-conv-api/transformers.js\");\n\n/* types */\nconst UTF8 = 'UTF8';\nconst UTF16 = 'UTF16';\nconst UTF16BE = 'UTF16BE';\nconst UTF16LE = 'UTF16LE';\nconst UTF32 = 'UTF32';\nconst UTF32BE = 'UTF32BE';\nconst UTF32LE = 'UTF32LE';\nconst UINT7 = 'UINT7';\nconst ASCII = 'ASCII';\nconst BINARY = 'BINARY';\nconst UINT8 = 'UINT8';\nconst UINT16 = 'UINT16';\nconst UINT16LE = 'UINT16LE';\nconst UINT16BE = 'UINT16BE';\nconst UINT32 = 'UINT32';\nconst UINT32LE = 'UINT32LE';\nconst UINT32BE = 'UINT32BE';\nconst ESCAPED = 'ESCAPED';\nconst STRING = 'STRING';\n\n/* private functions */\n// Find the UTF8 BOM, if any.\nconst bom8 = function bom8(src) {\n src.type = UTF8;\n const buf = src.data;\n src.bom = 0;\n if (buf.length >= 3) {\n if (buf[0] === 0xef && buf[1] === 0xbb && buf[2] === 0xbf) {\n src.bom = 3;\n }\n }\n};\n// Find the UTF16 BOM, if any, and determine the UTF16 type.\n// Defaults to UTF16BE.\n// Throws TypeError exception if BOM does not match the specified type.\nconst bom16 = function bom16(src) {\n const buf = src.data;\n src.bom = 0;\n switch (src.type) {\n case UTF16:\n src.type = UTF16BE;\n if (buf.length >= 2) {\n if (buf[0] === 0xfe && buf[1] === 0xff) {\n src.bom = 2;\n } else if (buf[0] === 0xff && buf[1] === 0xfe) {\n src.type = UTF16LE;\n src.bom = 2;\n }\n }\n break;\n case UTF16BE:\n src.type = UTF16BE;\n if (buf.length >= 2) {\n if (buf[0] === 0xfe && buf[1] === 0xff) {\n src.bom = 2;\n } else if (buf[0] === 0xff && buf[1] === 0xfe) {\n throw new TypeError(`src type: \"${UTF16BE}\" specified but BOM is for \"${UTF16LE}\"`);\n }\n }\n break;\n case UTF16LE:\n src.type = UTF16LE;\n if (buf.length >= 0) {\n if (buf[0] === 0xfe && buf[1] === 0xff) {\n throw new TypeError(`src type: \"${UTF16LE}\" specified but BOM is for \"${UTF16BE}\"`);\n } else if (buf[0] === 0xff && buf[1] === 0xfe) {\n src.bom = 2;\n }\n }\n break;\n default:\n throw new TypeError(`UTF16 BOM: src type \"${src.type}\" unrecognized`);\n }\n};\n// Find the UTF32 BOM, if any, and determine the UTF32 type.\n// Defaults to UTF32BE.\n// Throws exception if BOM does not match the specified type.\nconst bom32 = function bom32(src) {\n const buf = src.data;\n src.bom = 0;\n switch (src.type) {\n case UTF32:\n src.type = UTF32BE;\n if (buf.length >= 4) {\n if (buf[0] === 0 && buf[1] === 0 && buf[2] === 0xfe && buf[3] === 0xff) {\n src.bom = 4;\n }\n if (buf[0] === 0xff && buf[1] === 0xfe && buf[2] === 0 && buf[3] === 0) {\n src.type = UTF32LE;\n src.bom = 4;\n }\n }\n break;\n case UTF32BE:\n src.type = UTF32BE;\n if (buf.length >= 4) {\n if (buf[0] === 0 && buf[1] === 0 && buf[2] === 0xfe && buf[3] === 0xff) {\n src.bom = 4;\n }\n if (buf[0] === 0xff && buf[1] === 0xfe && buf[2] === 0 && buf[3] === 0) {\n throw new TypeError(`src type: ${UTF32BE} specified but BOM is for ${UTF32LE}\"`);\n }\n }\n break;\n case UTF32LE:\n src.type = UTF32LE;\n if (buf.length >= 4) {\n if (buf[0] === 0 && buf[1] === 0 && buf[2] === 0xfe && buf[3] === 0xff) {\n throw new TypeError(`src type: \"${UTF32LE}\" specified but BOM is for \"${UTF32BE}\"`);\n }\n if (buf[0] === 0xff && buf[1] === 0xfe && buf[2] === 0 && buf[3] === 0) {\n src.bom = 4;\n }\n }\n break;\n default:\n throw new TypeError(`UTF32 BOM: src type \"${src.type}\" unrecognized`);\n }\n};\n// Validates the source encoding type and matching data.\n// If the BASE64: prefix is present, the base 64 decoding is done here as the initial step.\n// - For type STRING, data must be a JavaScript string.\n// - For type BASE64:*, data may be a string or Buffer.\n// - For all other types, data must be a Buffer.\n// - The BASE64: prefix is not allowed for type STRING.\nconst validateSrc = function validateSrc(type, data) {\n function getType(typeArg) {\n const ret = {\n type: '',\n base64: false,\n };\n const rx = /^(base64:)?([a-zA-Z0-9]+)$/i;\n const result = rx.exec(typeArg);\n if (result) {\n if (result[2]) {\n ret.type = result[2].toUpperCase();\n }\n if (result[1]) {\n ret.base64 = true;\n }\n }\n return ret;\n }\n const ret = getType(type.toUpperCase());\n if (ret.base64) {\n /* handle base 64 */\n if (ret.type === STRING) {\n throw new TypeError(`type: \"${type} \"BASE64:\" prefix not allowed with type ${STRING}`);\n }\n if (Buffer.isBuffer(data)) {\n ret.data = trans.base64.decode(data);\n } else if (typeof data === 'string') {\n const buf = Buffer.from(data, 'ascii');\n ret.data = trans.base64.decode(buf);\n } else {\n throw new TypeError(`type: \"${type} unrecognized data type: typeof(data): ${typeof data}`);\n }\n } else {\n ret.data = data;\n }\n switch (ret.type) {\n case UTF8:\n bom8(ret);\n break;\n case UTF16:\n case UTF16BE:\n case UTF16LE:\n bom16(ret);\n break;\n case UTF32:\n case UTF32BE:\n case UTF32LE:\n bom32(ret);\n break;\n case UINT16:\n ret.type = UINT16BE;\n break;\n case UINT32:\n ret.type = UINT32BE;\n break;\n case ASCII:\n ret.type = UINT7;\n break;\n case BINARY:\n ret.type = UINT8;\n break;\n case UINT7:\n case UINT8:\n case UINT16LE:\n case UINT16BE:\n case UINT32LE:\n case UINT32BE:\n case STRING:\n case ESCAPED:\n break;\n default:\n throw new TypeError(`type: \"${type}\" not recognized`);\n }\n if (ret.type === STRING) {\n if (typeof ret.data !== 'string') {\n throw new TypeError(`type: \"${type}\" but data is not a string`);\n }\n } else if (!Buffer.isBuffer(ret.data)) {\n throw new TypeError(`type: \"${type}\" but data is not a Buffer`);\n }\n return ret;\n};\n// Disassembles and validates the destination type.\n// `chars` must be an Array of integers.\n// The :BASE64 suffix is not allowed for type STRING.\nconst validateDst = function validateDst(type, chars) {\n function getType(typeArg) {\n let fix;\n let rem;\n const ret = {\n crlf: false,\n lf: false,\n base64: false,\n type: '',\n };\n /* prefix, if any */\n const TRUE = true;\n while (TRUE) {\n rem = typeArg;\n fix = typeArg.slice(0, 5);\n if (fix === 'CRLF:') {\n ret.crlf = true;\n rem = typeArg.slice(5);\n break;\n }\n fix = typeArg.slice(0, 3);\n if (fix === 'LF:') {\n ret.lf = true;\n rem = typeArg.slice(3);\n break;\n }\n break;\n }\n /* suffix, if any */\n fix = rem.split(':');\n if (fix.length === 1) {\n // eslint-disable-next-line prefer-destructuring\n ret.type = fix[0];\n } else if (fix.length === 2 && fix[1] === 'BASE64') {\n ret.base64 = true;\n // eslint-disable-next-line prefer-destructuring\n ret.type = fix[0];\n }\n return ret;\n }\n if (!Array.isArray(chars)) {\n throw new TypeError(`dst chars: not array: \"${typeof chars}`);\n }\n if (typeof type !== 'string') {\n throw new TypeError(`dst type: not string: \"${typeof type}`);\n }\n const ret = getType(type.toUpperCase());\n switch (ret.type) {\n case UTF8:\n case UTF16BE:\n case UTF16LE:\n case UTF32BE:\n case UTF32LE:\n case UINT7:\n case UINT8:\n case UINT16LE:\n case UINT16BE:\n case UINT32LE:\n case UINT32BE:\n case ESCAPED:\n break;\n case STRING:\n if (ret.base64) {\n throw new TypeError(`\":BASE64\" suffix not allowed with type ${STRING}`);\n }\n break;\n case ASCII:\n ret.type = UINT7;\n break;\n case BINARY:\n ret.type = UINT8;\n break;\n case UTF16:\n ret.type = UTF16BE;\n break;\n case UTF32:\n ret.type = UTF32BE;\n break;\n case UINT16:\n ret.type = UINT16BE;\n break;\n case UINT32:\n ret.type = UINT32BE;\n break;\n default:\n throw new TypeError(`dst type unrecognized: \"${type}\" : must have form [crlf:|lf:]type[:base64]`);\n }\n return ret;\n};\n// Select and call the requested encoding function.\nconst encode = function encode(type, chars) {\n switch (type) {\n case UTF8:\n return trans.utf8.encode(chars);\n case UTF16BE:\n return trans.utf16be.encode(chars);\n case UTF16LE:\n return trans.utf16le.encode(chars);\n case UTF32BE:\n return trans.utf32be.encode(chars);\n case UTF32LE:\n return trans.utf32le.encode(chars);\n case UINT7:\n return trans.uint7.encode(chars);\n case UINT8:\n return trans.uint8.encode(chars);\n case UINT16BE:\n return trans.uint16be.encode(chars);\n case UINT16LE:\n return trans.uint16le.encode(chars);\n case UINT32BE:\n return trans.uint32be.encode(chars);\n case UINT32LE:\n return trans.uint32le.encode(chars);\n case STRING:\n return trans.string.encode(chars);\n case ESCAPED:\n return trans.escaped.encode(chars);\n default:\n throw new TypeError(`encode type \"${type}\" not recognized`);\n }\n};\n// Select and call the requested decoding function.\n// `src` contains BOM information as well as the source type and data.\nconst decode = function decode(src) {\n switch (src.type) {\n case UTF8:\n return trans.utf8.decode(src.data, src.bom);\n case UTF16LE:\n return trans.utf16le.decode(src.data, src.bom);\n case UTF16BE:\n return trans.utf16be.decode(src.data, src.bom);\n case UTF32BE:\n return trans.utf32be.decode(src.data, src.bom);\n case UTF32LE:\n return trans.utf32le.decode(src.data, src.bom);\n case UINT7:\n return trans.uint7.decode(src.data);\n case UINT8:\n return trans.uint8.decode(src.data);\n case UINT16BE:\n return trans.uint16be.decode(src.data);\n case UINT16LE:\n return trans.uint16le.decode(src.data);\n case UINT32BE:\n return trans.uint32be.decode(src.data);\n case UINT32LE:\n return trans.uint32le.decode(src.data);\n case STRING:\n return trans.string.decode(src.data);\n case ESCAPED:\n return trans.escaped.decode(src.data);\n default:\n throw new TypeError(`decode type \"${src.type}\" not recognized`);\n }\n};\n\n// The public decoding function. Returns an array of integers.\nexports.decode = function exportsDecode(type, data) {\n const src = validateSrc(type, data);\n return decode(src);\n};\n// The public encoding function. Returns a Buffer-typed byte array.\nexports.encode = function exportsEncode(type, chars) {\n let c;\n let buf;\n const dst = validateDst(type, chars);\n if (dst.crlf) {\n /* prefix with CRLF line end conversion, don't contaminate caller's chars array */\n c = trans.lineEnds.crlf(chars);\n buf = encode(dst.type, c);\n } else if (dst.lf) {\n /* prefix with LF line end conversion, don't contaminate caller's chars array */\n c = trans.lineEnds.lf(chars);\n buf = encode(dst.type, c);\n } else {\n buf = encode(dst.type, chars);\n }\n if (dst.base64) {\n /* post base 64 encoding */\n buf = trans.base64.encode(buf);\n }\n return buf;\n};\n// Converts data of type `srcType` to data of type `dstType`.\n// `srcData` may be a JavaScript String, or node.js Buffer, depending on the corresponding type.\nconst convert = function convert(srcType, srcData, dstType) {\n return exports.encode(dstType, exports.decode(srcType, srcData));\n};\nexports.convert = convert;\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-conv-api/converter.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-conv-api/transformers.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval("/* eslint-disable prefer-destructuring */\n/* eslint-disable no-plusplus */\n/* eslint-disable no-bitwise */\n/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module contains the actual encoding and decoding algorithms.\n// Throws \"RangeError\" exceptions on characters or bytes out of range for the given encoding.\n\n'use strict;';\n\nconst { Buffer } = __webpack_require__(/*! buffer */ \"./node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js\");\n\n/* decoding error codes */\nconst NON_SHORTEST = 0xfffffffc;\nconst TRAILING = 0xfffffffd;\nconst RANGE = 0xfffffffe;\nconst ILL_FORMED = 0xffffffff;\n\n/* mask[n] = 2**n - 1, ie. mask[n] = n bits on. e.g. mask[6] = %b111111 */\nconst mask = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023];\n\n/* ascii[n] = 'HH', where 0xHH = n, eg. ascii[254] = 'FE' */\nconst ascii = [\n '00',\n '01',\n '02',\n '03',\n '04',\n '05',\n '06',\n '07',\n '08',\n '09',\n '0A',\n '0B',\n '0C',\n '0D',\n '0E',\n '0F',\n '10',\n '11',\n '12',\n '13',\n '14',\n '15',\n '16',\n '17',\n '18',\n '19',\n '1A',\n '1B',\n '1C',\n '1D',\n '1E',\n '1F',\n '20',\n '21',\n '22',\n '23',\n '24',\n '25',\n '26',\n '27',\n '28',\n '29',\n '2A',\n '2B',\n '2C',\n '2D',\n '2E',\n '2F',\n '30',\n '31',\n '32',\n '33',\n '34',\n '35',\n '36',\n '37',\n '38',\n '39',\n '3A',\n '3B',\n '3C',\n '3D',\n '3E',\n '3F',\n '40',\n '41',\n '42',\n '43',\n '44',\n '45',\n '46',\n '47',\n '48',\n '49',\n '4A',\n '4B',\n '4C',\n '4D',\n '4E',\n '4F',\n '50',\n '51',\n '52',\n '53',\n '54',\n '55',\n '56',\n '57',\n '58',\n '59',\n '5A',\n '5B',\n '5C',\n '5D',\n '5E',\n '5F',\n '60',\n '61',\n '62',\n '63',\n '64',\n '65',\n '66',\n '67',\n '68',\n '69',\n '6A',\n '6B',\n '6C',\n '6D',\n '6E',\n '6F',\n '70',\n '71',\n '72',\n '73',\n '74',\n '75',\n '76',\n '77',\n '78',\n '79',\n '7A',\n '7B',\n '7C',\n '7D',\n '7E',\n '7F',\n '80',\n '81',\n '82',\n '83',\n '84',\n '85',\n '86',\n '87',\n '88',\n '89',\n '8A',\n '8B',\n '8C',\n '8D',\n '8E',\n '8F',\n '90',\n '91',\n '92',\n '93',\n '94',\n '95',\n '96',\n '97',\n '98',\n '99',\n '9A',\n '9B',\n '9C',\n '9D',\n '9E',\n '9F',\n 'A0',\n 'A1',\n 'A2',\n 'A3',\n 'A4',\n 'A5',\n 'A6',\n 'A7',\n 'A8',\n 'A9',\n 'AA',\n 'AB',\n 'AC',\n 'AD',\n 'AE',\n 'AF',\n 'B0',\n 'B1',\n 'B2',\n 'B3',\n 'B4',\n 'B5',\n 'B6',\n 'B7',\n 'B8',\n 'B9',\n 'BA',\n 'BB',\n 'BC',\n 'BD',\n 'BE',\n 'BF',\n 'C0',\n 'C1',\n 'C2',\n 'C3',\n 'C4',\n 'C5',\n 'C6',\n 'C7',\n 'C8',\n 'C9',\n 'CA',\n 'CB',\n 'CC',\n 'CD',\n 'CE',\n 'CF',\n 'D0',\n 'D1',\n 'D2',\n 'D3',\n 'D4',\n 'D5',\n 'D6',\n 'D7',\n 'D8',\n 'D9',\n 'DA',\n 'DB',\n 'DC',\n 'DD',\n 'DE',\n 'DF',\n 'E0',\n 'E1',\n 'E2',\n 'E3',\n 'E4',\n 'E5',\n 'E6',\n 'E7',\n 'E8',\n 'E9',\n 'EA',\n 'EB',\n 'EC',\n 'ED',\n 'EE',\n 'EF',\n 'F0',\n 'F1',\n 'F2',\n 'F3',\n 'F4',\n 'F5',\n 'F6',\n 'F7',\n 'F8',\n 'F9',\n 'FA',\n 'FB',\n 'FC',\n 'FD',\n 'FE',\n 'FF',\n];\n\n/* vector of base 64 characters */\nconst base64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split('');\n\n/* vector of base 64 character codes */\nconst base64codes = [];\nbase64chars.forEach((char) => {\n base64codes.push(char.charCodeAt(0));\n});\n\n// The UTF8 algorithms.\nexports.utf8 = {\n encode(chars) {\n const bytes = [];\n chars.forEach((char) => {\n if (char >= 0 && char <= 0x7f) {\n bytes.push(char);\n } else if (char <= 0x7ff) {\n bytes.push(0xc0 + ((char >> 6) & mask[5]));\n bytes.push(0x80 + (char & mask[6]));\n } else if (char < 0xd800 || (char > 0xdfff && char <= 0xffff)) {\n bytes.push(0xe0 + ((char >> 12) & mask[4]));\n bytes.push(0x80 + ((char >> 6) & mask[6]));\n bytes.push(0x80 + (char & mask[6]));\n } else if (char >= 0x10000 && char <= 0x10ffff) {\n const u = (char >> 16) & mask[5];\n bytes.push(0xf0 + (u >> 2));\n bytes.push(0x80 + ((u & mask[2]) << 4) + ((char >> 12) & mask[4]));\n bytes.push(0x80 + ((char >> 6) & mask[6]));\n bytes.push(0x80 + (char & mask[6]));\n } else {\n throw new RangeError(`utf8.encode: character out of range: char: ${char}`);\n }\n });\n return Buffer.from(bytes);\n },\n decode(buf, bom) {\n /* bytes functions return error for non-shortest forms & values out of range */\n function bytes2(b1, b2) {\n /* U+0080..U+07FF */\n /* 00000000 00000yyy yyxxxxxx | 110yyyyy 10xxxxxx */\n if ((b2 & 0xc0) !== 0x80) {\n return TRAILING;\n }\n const x = ((b1 & mask[5]) << 6) + (b2 & mask[6]);\n if (x < 0x80) {\n return NON_SHORTEST;\n }\n return x;\n }\n function bytes3(b1, b2, b3) {\n /* U+0800..U+FFFF */\n /* 00000000 zzzzyyyy yyxxxxxx | 1110zzzz 10yyyyyy 10xxxxxx */\n if ((b3 & 0xc0) !== 0x80 || (b2 & 0xc0) !== 0x80) {\n return TRAILING;\n }\n const x = ((b1 & mask[4]) << 12) + ((b2 & mask[6]) << 6) + (b3 & mask[6]);\n if (x < 0x800) {\n return NON_SHORTEST;\n }\n if (x >= 0xd800 && x <= 0xdfff) {\n return RANGE;\n }\n return x;\n }\n function bytes4(b1, b2, b3, b4) {\n /* U+10000..U+10FFFF */\n /* 000uuuuu zzzzyyyy yyxxxxxx | 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx */\n if ((b4 & 0xc0) !== 0x80 || (b3 & 0xc0) !== 0x80 || (b2 & 0xc0) !== 0x80) {\n return TRAILING;\n }\n const x =\n ((((b1 & mask[3]) << 2) + ((b2 >> 4) & mask[2])) << 16) +\n ((b2 & mask[4]) << 12) +\n ((b3 & mask[6]) << 6) +\n (b4 & mask[6]);\n if (x < 0x10000) {\n return NON_SHORTEST;\n }\n if (x > 0x10ffff) {\n return RANGE;\n }\n return x;\n }\n let c;\n let b1;\n let i1;\n let i2;\n let i3;\n let inc;\n const len = buf.length;\n let i = bom ? 3 : 0;\n const chars = [];\n while (i < len) {\n b1 = buf[i];\n c = ILL_FORMED;\n const TRUE = true;\n while (TRUE) {\n if (b1 >= 0 && b1 <= 0x7f) {\n /* U+0000..U+007F 00..7F */\n c = b1;\n inc = 1;\n break;\n }\n i1 = i + 1;\n if (i1 < len && b1 >= 0xc2 && b1 <= 0xdf) {\n /* U+0080..U+07FF C2..DF 80..BF */\n c = bytes2(b1, buf[i1]);\n inc = 2;\n break;\n }\n i2 = i + 2;\n if (i2 < len && b1 >= 0xe0 && b1 <= 0xef) {\n /* U+0800..U+FFFF */\n c = bytes3(b1, buf[i1], buf[i2]);\n inc = 3;\n break;\n }\n i3 = i + 3;\n if (i3 < len && b1 >= 0xf0 && b1 <= 0xf4) {\n /* U+10000..U+10FFFF */\n c = bytes4(b1, buf[i1], buf[i2], buf[i3]);\n inc = 4;\n break;\n }\n /* if we fall through to here, it is an ill-formed sequence */\n break;\n }\n if (c > 0x10ffff) {\n const at = `byte[${i}]`;\n if (c === ILL_FORMED) {\n throw new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${at}`);\n }\n if (c === TRAILING) {\n throw new RangeError(`utf8.decode: illegal trailing byte found at: ${at}`);\n }\n if (c === RANGE) {\n throw new RangeError(`utf8.decode: code point out of range found at: ${at}`);\n }\n if (c === NON_SHORTEST) {\n throw new RangeError(`utf8.decode: non-shortest form found at: ${at}`);\n }\n throw new RangeError(`utf8.decode: unrecognized error found at: ${at}`);\n }\n chars.push(c);\n i += inc;\n }\n return chars;\n },\n};\n\n// The UTF16BE algorithms.\nexports.utf16be = {\n encode(chars) {\n const bytes = [];\n let char;\n let h;\n let l;\n for (let i = 0; i < chars.length; i += 1) {\n char = chars[i];\n if ((char >= 0 && char <= 0xd7ff) || (char >= 0xe000 && char <= 0xffff)) {\n bytes.push((char >> 8) & mask[8]);\n bytes.push(char & mask[8]);\n } else if (char >= 0x10000 && char <= 0x10ffff) {\n l = char - 0x10000;\n h = 0xd800 + (l >> 10);\n l = 0xdc00 + (l & mask[10]);\n bytes.push((h >> 8) & mask[8]);\n bytes.push(h & mask[8]);\n bytes.push((l >> 8) & mask[8]);\n bytes.push(l & mask[8]);\n } else {\n throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${i}]: ${char}`);\n }\n }\n return Buffer.from(bytes);\n },\n decode(buf, bom) {\n /* assumes caller has insured that buf is a Buffer of bytes */\n if (buf.length % 2 > 0) {\n throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${buf.length}`);\n }\n const chars = [];\n const len = buf.length;\n let i = bom ? 2 : 0;\n let j = 0;\n let c;\n let inc;\n let i1;\n let i3;\n let high;\n let low;\n while (i < len) {\n const TRUE = true;\n while (TRUE) {\n i1 = i + 1;\n if (i1 < len) {\n high = (buf[i] << 8) + buf[i1];\n if (high < 0xd800 || high > 0xdfff) {\n c = high;\n inc = 2;\n break;\n }\n i3 = i + 3;\n if (i3 < len) {\n low = (buf[i + 2] << 8) + buf[i3];\n if (high <= 0xdbff && low >= 0xdc00 && low <= 0xdfff) {\n c = 0x10000 + ((high - 0xd800) << 10) + (low - 0xdc00);\n inc = 4;\n break;\n }\n }\n }\n /* if we fall through to here, it is an ill-formed sequence */\n throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${i}]`);\n }\n chars[j++] = c;\n i += inc;\n }\n return chars;\n },\n};\n\n// The UTF16LE algorithms.\nexports.utf16le = {\n encode(chars) {\n const bytes = [];\n let char;\n let h;\n let l;\n for (let i = 0; i < chars.length; i += 1) {\n char = chars[i];\n if ((char >= 0 && char <= 0xd7ff) || (char >= 0xe000 && char <= 0xffff)) {\n bytes.push(char & mask[8]);\n bytes.push((char >> 8) & mask[8]);\n } else if (char >= 0x10000 && char <= 0x10ffff) {\n l = char - 0x10000;\n h = 0xd800 + (l >> 10);\n l = 0xdc00 + (l & mask[10]);\n bytes.push(h & mask[8]);\n bytes.push((h >> 8) & mask[8]);\n bytes.push(l & mask[8]);\n bytes.push((l >> 8) & mask[8]);\n } else {\n throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${i}]: ${char}`);\n }\n }\n return Buffer.from(bytes);\n },\n decode(buf, bom) {\n /* assumes caller has insured that buf is a Buffer of bytes */\n if (buf.length % 2 > 0) {\n throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${buf.length}`);\n }\n const chars = [];\n const len = buf.length;\n let i = bom ? 2 : 0;\n let j = 0;\n let c;\n let inc;\n let i1;\n let i3;\n let high;\n let low;\n while (i < len) {\n const TRUE = true;\n while (TRUE) {\n i1 = i + 1;\n if (i1 < len) {\n high = (buf[i1] << 8) + buf[i];\n if (high < 0xd800 || high > 0xdfff) {\n c = high;\n inc = 2;\n break;\n }\n i3 = i + 3;\n if (i3 < len) {\n low = (buf[i3] << 8) + buf[i + 2];\n if (high <= 0xdbff && low >= 0xdc00 && low <= 0xdfff) {\n c = 0x10000 + ((high - 0xd800) << 10) + (low - 0xdc00);\n inc = 4;\n break;\n }\n }\n }\n /* if we fall through to here, it is an ill-formed sequence */\n throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${i}]`);\n }\n chars[j++] = c;\n i += inc;\n }\n return chars;\n },\n};\n\n// The UTF32BE algorithms.\nexports.utf32be = {\n encode(chars) {\n const buf = Buffer.alloc(chars.length * 4);\n let i = 0;\n chars.forEach((char) => {\n if ((char >= 0xd800 && char <= 0xdfff) || char > 0x10ffff) {\n throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${i / 4}]: ${char}`);\n }\n buf[i++] = (char >> 24) & mask[8];\n buf[i++] = (char >> 16) & mask[8];\n buf[i++] = (char >> 8) & mask[8];\n buf[i++] = char & mask[8];\n });\n return buf;\n },\n decode(buf, bom) {\n /* caller to insure buf is a Buffer of bytes */\n if (buf.length % 4 > 0) {\n throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${buf.length}`);\n }\n const chars = [];\n let i = bom ? 4 : 0;\n for (; i < buf.length; i += 4) {\n const char = (buf[i] << 24) + (buf[i + 1] << 16) + (buf[i + 2] << 8) + buf[i + 3];\n if ((char >= 0xd800 && char <= 0xdfff) || char > 0x10ffff) {\n throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${i / 4}]: ${char}`);\n }\n chars.push(char);\n }\n return chars;\n },\n};\n\n// The UTF32LE algorithms.\nexports.utf32le = {\n encode(chars) {\n const buf = Buffer.alloc(chars.length * 4);\n let i = 0;\n chars.forEach((char) => {\n if ((char >= 0xd800 && char <= 0xdfff) || char > 0x10ffff) {\n throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${i / 4}]: ${char}`);\n }\n buf[i++] = char & mask[8];\n buf[i++] = (char >> 8) & mask[8];\n buf[i++] = (char >> 16) & mask[8];\n buf[i++] = (char >> 24) & mask[8];\n });\n return buf;\n },\n decode(buf, bom) {\n /* caller to insure buf is a Buffer of bytes */\n if (buf.length % 4 > 0) {\n throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${buf.length}`);\n }\n const chars = [];\n let i = bom ? 4 : 0;\n for (; i < buf.length; i += 4) {\n const char = (buf[i + 3] << 24) + (buf[i + 2] << 16) + (buf[i + 1] << 8) + buf[i];\n if ((char >= 0xd800 && char <= 0xdfff) || char > 0x10ffff) {\n throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${i / 4}]: ${char}`);\n }\n chars.push(char);\n }\n return chars;\n },\n};\n\n// The UINT7 algorithms. ASCII or 7-bit unsigned integers.\nexports.uint7 = {\n encode(chars) {\n const buf = Buffer.alloc(chars.length);\n for (let i = 0; i < chars.length; i += 1) {\n if (chars[i] > 0x7f) {\n throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${i}]: ${chars[i]}`);\n }\n buf[i] = chars[i];\n }\n return buf;\n },\n decode(buf) {\n const chars = [];\n for (let i = 0; i < buf.length; i += 1) {\n if (buf[i] > 0x7f) {\n throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${i}]: ${buf[i]}`);\n }\n chars[i] = buf[i];\n }\n return chars;\n },\n};\n\n// The UINT8 algorithms. BINARY, Latin 1 or 8-bit unsigned integers.\nexports.uint8 = {\n encode(chars) {\n const buf = Buffer.alloc(chars.length);\n for (let i = 0; i < chars.length; i += 1) {\n if (chars[i] > 0xff) {\n throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${i}]: ${chars[i]}`);\n }\n buf[i] = chars[i];\n }\n return buf;\n },\n decode(buf) {\n const chars = [];\n for (let i = 0; i < buf.length; i += 1) {\n chars[i] = buf[i];\n }\n return chars;\n },\n};\n\n// The UINT16BE algorithms. Big-endian 16-bit unsigned integers.\nexports.uint16be = {\n encode(chars) {\n const buf = Buffer.alloc(chars.length * 2);\n let i = 0;\n chars.forEach((char) => {\n if (char > 0xffff) {\n throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${i / 2}]: ${char}`);\n }\n buf[i++] = (char >> 8) & mask[8];\n buf[i++] = char & mask[8];\n });\n return buf;\n },\n decode(buf) {\n if (buf.length % 2 > 0) {\n throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${buf.length}`);\n }\n const chars = [];\n for (let i = 0; i < buf.length; i += 2) {\n chars.push((buf[i] << 8) + buf[i + 1]);\n }\n return chars;\n },\n};\n\n// The UINT16LE algorithms. Little-endian 16-bit unsigned integers.\nexports.uint16le = {\n encode(chars) {\n const buf = Buffer.alloc(chars.length * 2);\n let i = 0;\n chars.forEach((char) => {\n if (char > 0xffff) {\n throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${i / 2}]: ${char}`);\n }\n buf[i++] = char & mask[8];\n buf[i++] = (char >> 8) & mask[8];\n });\n return buf;\n },\n decode(buf) {\n if (buf.length % 2 > 0) {\n throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${buf.length}`);\n }\n const chars = [];\n for (let i = 0; i < buf.length; i += 2) {\n chars.push((buf[i + 1] << 8) + buf[i]);\n }\n return chars;\n },\n};\n\n// The UINT32BE algorithms. Big-endian 32-bit unsigned integers.\nexports.uint32be = {\n encode(chars) {\n const buf = Buffer.alloc(chars.length * 4);\n let i = 0;\n chars.forEach((char) => {\n buf[i++] = (char >> 24) & mask[8];\n buf[i++] = (char >> 16) & mask[8];\n buf[i++] = (char >> 8) & mask[8];\n buf[i++] = char & mask[8];\n });\n return buf;\n },\n decode(buf) {\n if (buf.length % 4 > 0) {\n throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${buf.length}`);\n }\n const chars = [];\n for (let i = 0; i < buf.length; i += 4) {\n chars.push((buf[i] << 24) + (buf[i + 1] << 16) + (buf[i + 2] << 8) + buf[i + 3]);\n }\n return chars;\n },\n};\n\n// The UINT32LE algorithms. Little-endian 32-bit unsigned integers.\nexports.uint32le = {\n encode(chars) {\n const buf = Buffer.alloc(chars.length * 4);\n let i = 0;\n chars.forEach((char) => {\n buf[i++] = char & mask[8];\n buf[i++] = (char >> 8) & mask[8];\n buf[i++] = (char >> 16) & mask[8];\n buf[i++] = (char >> 24) & mask[8];\n });\n return buf;\n },\n decode(buf) {\n /* caller to insure buf is a Buffer of bytes */\n if (buf.length % 4 > 0) {\n throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${buf.length}`);\n }\n const chars = [];\n for (let i = 0; i < buf.length; i += 4) {\n chars.push((buf[i + 3] << 24) + (buf[i + 2] << 16) + (buf[i + 1] << 8) + buf[i]);\n }\n return chars;\n },\n};\n\n// The STRING algorithms. Converts JavaScript strings to Array of 32-bit integers and vice versa.\n// Uses the node.js Buffer's native \"utf16le\" capabilites.\nexports.string = {\n encode(chars) {\n return exports.utf16le.encode(chars).toString('utf16le');\n },\n decode(str) {\n return exports.utf16le.decode(Buffer.from(str, 'utf16le'), 0);\n },\n};\n\n// The ESCAPED algorithms.\n// Note that ESCAPED format contains only ASCII characters.\n// The characters are always in the form of a Buffer of bytes.\nexports.escaped = {\n // Encodes an Array of 32-bit integers into ESCAPED format.\n encode(chars) {\n const bytes = [];\n for (let i = 0; i < chars.length; i += 1) {\n const char = chars[i];\n if (char === 96) {\n bytes.push(char);\n bytes.push(char);\n } else if (char === 10) {\n bytes.push(char);\n } else if (char >= 32 && char <= 126) {\n bytes.push(char);\n } else {\n let str = '';\n if (char >= 0 && char <= 31) {\n str += `\\`x${ascii[char]}`;\n } else if (char >= 127 && char <= 255) {\n str += `\\`x${ascii[char]}`;\n } else if (char >= 0x100 && char <= 0xffff) {\n str += `\\`u${ascii[(char >> 8) & mask[8]]}${ascii[char & mask[8]]}`;\n } else if (char >= 0x10000 && char <= 0xffffffff) {\n str += '`u{';\n const digit = (char >> 24) & mask[8];\n if (digit > 0) {\n str += ascii[digit];\n }\n str += `${ascii[(char >> 16) & mask[8]] + ascii[(char >> 8) & mask[8]] + ascii[char & mask[8]]}}`;\n } else {\n throw new Error('escape.encode(char): char > 0xffffffff not allowed');\n }\n const buf = Buffer.from(str);\n buf.forEach((b) => {\n bytes.push(b);\n });\n }\n }\n return Buffer.from(bytes);\n },\n // Decodes ESCAPED format from a Buffer of bytes to an Array of 32-bit integers.\n decode(buf) {\n function isHex(hex) {\n if ((hex >= 48 && hex <= 57) || (hex >= 65 && hex <= 70) || (hex >= 97 && hex <= 102)) {\n return true;\n }\n return false;\n }\n function getx(i, len, bufArg) {\n const ret = { char: null, nexti: i + 2, error: true };\n if (i + 1 < len) {\n if (isHex(bufArg[i]) && isHex(bufArg[i + 1])) {\n const str = String.fromCodePoint(bufArg[i], bufArg[i + 1]);\n ret.char = parseInt(str, 16);\n if (!Number.isNaN(ret.char)) {\n ret.error = false;\n }\n }\n }\n return ret;\n }\n function getu(i, len, bufArg) {\n const ret = { char: null, nexti: i + 4, error: true };\n if (i + 3 < len) {\n if (isHex(bufArg[i]) && isHex(bufArg[i + 1]) && isHex(bufArg[i + 2]) && isHex(bufArg[i + 3])) {\n const str = String.fromCodePoint(bufArg[i], bufArg[i + 1], bufArg[i + 2], bufArg[i + 3]);\n ret.char = parseInt(str, 16);\n if (!Number.isNaN(ret.char)) {\n ret.error = false;\n }\n }\n }\n return ret;\n }\n function getU(i, len, bufArg) {\n const ret = { char: null, nexti: i + 4, error: true };\n let str = '';\n while (i < len && isHex(bufArg[i])) {\n str += String.fromCodePoint(bufArg[i]);\n // eslint-disable-next-line no-param-reassign\n i += 1;\n }\n ret.char = parseInt(str, 16);\n if (bufArg[i] === 125 && !Number.isNaN(ret.char)) {\n ret.error = false;\n }\n ret.nexti = i + 1;\n return ret;\n }\n const chars = [];\n const len = buf.length;\n let i1;\n let ret;\n let error;\n let i = 0;\n while (i < len) {\n const TRUE = true;\n while (TRUE) {\n error = true;\n if (buf[i] !== 96) {\n /* unescaped character */\n chars.push(buf[i]);\n i += 1;\n error = false;\n break;\n }\n i1 = i + 1;\n if (i1 >= len) {\n break;\n }\n if (buf[i1] === 96) {\n /* escaped grave accent */\n chars.push(96);\n i += 2;\n error = false;\n break;\n }\n if (buf[i1] === 120) {\n ret = getx(i1 + 1, len, buf);\n if (ret.error) {\n break;\n }\n /* escaped hex */\n chars.push(ret.char);\n i = ret.nexti;\n error = false;\n break;\n }\n if (buf[i1] === 117) {\n if (buf[i1 + 1] === 123) {\n ret = getU(i1 + 2, len, buf);\n if (ret.error) {\n break;\n }\n /* escaped utf-32 */\n chars.push(ret.char);\n i = ret.nexti;\n error = false;\n break;\n }\n ret = getu(i1 + 1, len, buf);\n if (ret.error) {\n break;\n }\n /* escaped utf-16 */\n chars.push(ret.char);\n i = ret.nexti;\n error = false;\n break;\n }\n break;\n }\n if (error) {\n throw new Error(`escaped.decode: ill-formed escape sequence at buf[${i}]`);\n }\n }\n return chars;\n },\n};\n\n// The line end conversion algorigthms.\nconst CR = 13;\nconst LF = 10;\nexports.lineEnds = {\n crlf(chars) {\n const lfchars = [];\n let i = 0;\n while (i < chars.length) {\n switch (chars[i]) {\n case CR:\n if (i + 1 < chars.length && chars[i + 1] === LF) {\n i += 2;\n } else {\n i += 1;\n }\n lfchars.push(CR);\n lfchars.push(LF);\n break;\n case LF:\n lfchars.push(CR);\n lfchars.push(LF);\n i += 1;\n break;\n default:\n lfchars.push(chars[i]);\n i += 1;\n break;\n }\n }\n if (lfchars.length > 0 && lfchars[lfchars.length - 1] !== LF) {\n lfchars.push(CR);\n lfchars.push(LF);\n }\n return lfchars;\n },\n lf(chars) {\n const lfchars = [];\n let i = 0;\n while (i < chars.length) {\n switch (chars[i]) {\n case CR:\n if (i + 1 < chars.length && chars[i + 1] === LF) {\n i += 2;\n } else {\n i += 1;\n }\n lfchars.push(LF);\n break;\n case LF:\n lfchars.push(LF);\n i += 1;\n break;\n default:\n lfchars.push(chars[i]);\n i += 1;\n break;\n }\n }\n if (lfchars.length > 0 && lfchars[lfchars.length - 1] !== LF) {\n lfchars.push(LF);\n }\n return lfchars;\n },\n};\n\n// The base 64 algorithms.\nexports.base64 = {\n encode(buf) {\n if (buf.length === 0) {\n return Buffer.alloc(0);\n }\n let i;\n let j;\n let n;\n let tail = buf.length % 3;\n tail = tail > 0 ? 3 - tail : 0;\n let units = (buf.length + tail) / 3;\n const base64 = Buffer.alloc(units * 4);\n if (tail > 0) {\n units -= 1;\n }\n i = 0;\n j = 0;\n for (let u = 0; u < units; u += 1) {\n n = buf[i++] << 16;\n n += buf[i++] << 8;\n n += buf[i++];\n base64[j++] = base64codes[(n >> 18) & mask[6]];\n base64[j++] = base64codes[(n >> 12) & mask[6]];\n base64[j++] = base64codes[(n >> 6) & mask[6]];\n base64[j++] = base64codes[n & mask[6]];\n }\n if (tail === 0) {\n return base64;\n }\n if (tail === 1) {\n n = buf[i++] << 16;\n n += buf[i] << 8;\n base64[j++] = base64codes[(n >> 18) & mask[6]];\n base64[j++] = base64codes[(n >> 12) & mask[6]];\n base64[j++] = base64codes[(n >> 6) & mask[6]];\n base64[j] = base64codes[64];\n return base64;\n }\n if (tail === 2) {\n n = buf[i] << 16;\n base64[j++] = base64codes[(n >> 18) & mask[6]];\n base64[j++] = base64codes[(n >> 12) & mask[6]];\n base64[j++] = base64codes[64];\n base64[j] = base64codes[64];\n return base64;\n }\n return undefined;\n },\n decode(codes) {\n /* remove white space and ctrl characters, validate & translate characters */\n function validate(buf) {\n const chars = [];\n let tail = 0;\n for (let i = 0; i < buf.length; i += 1) {\n const char = buf[i];\n const TRUE = true;\n while (TRUE) {\n if (char === 32 || char === 9 || char === 10 || char === 13) {\n break;\n }\n if (char >= 65 && char <= 90) {\n chars.push(char - 65);\n break;\n }\n if (char >= 97 && char <= 122) {\n chars.push(char - 71);\n break;\n }\n if (char >= 48 && char <= 57) {\n chars.push(char + 4);\n break;\n }\n if (char === 43) {\n chars.push(62);\n break;\n }\n if (char === 47) {\n chars.push(63);\n break;\n }\n if (char === 61) {\n chars.push(64);\n tail += 1;\n break;\n }\n /* invalid character */\n throw new RangeError(`base64.decode: invalid character buf[${i}]: ${char}`);\n }\n }\n /* validate length */\n if (chars.length % 4 > 0) {\n throw new RangeError(`base64.decode: string length not integral multiple of 4: ${chars.length}`);\n }\n /* validate tail */\n switch (tail) {\n case 0:\n break;\n case 1:\n if (chars[chars.length - 1] !== 64) {\n throw new RangeError('base64.decode: one tail character found: not last character');\n }\n break;\n case 2:\n if (chars[chars.length - 1] !== 64 || chars[chars.length - 2] !== 64) {\n throw new RangeError('base64.decode: two tail characters found: not last characters');\n }\n break;\n default:\n throw new RangeError(`base64.decode: more than two tail characters found: ${tail}`);\n }\n return { tail, buf: Buffer.from(chars) };\n }\n\n if (codes.length === 0) {\n return Buffer.alloc(0);\n }\n const val = validate(codes);\n const { tail } = val;\n const base64 = val.buf;\n let i;\n let j;\n let n;\n let units = base64.length / 4;\n const buf = Buffer.alloc(units * 3 - tail);\n if (tail > 0) {\n units -= 1;\n }\n j = 0;\n i = 0;\n for (let u = 0; u < units; u += 1) {\n n = base64[i++] << 18;\n n += base64[i++] << 12;\n n += base64[i++] << 6;\n n += base64[i++];\n buf[j++] = (n >> 16) & mask[8];\n buf[j++] = (n >> 8) & mask[8];\n buf[j++] = n & mask[8];\n }\n if (tail === 1) {\n n = base64[i++] << 18;\n n += base64[i++] << 12;\n n += base64[i] << 6;\n buf[j++] = (n >> 16) & mask[8];\n buf[j] = (n >> 8) & mask[8];\n }\n if (tail === 2) {\n n = base64[i++] << 18;\n n += base64[i++] << 12;\n buf[j] = (n >> 16) & mask[8];\n }\n return buf;\n },\n // Converts a base 64 Buffer of bytes to a JavaScript string with line breaks.\n toString(buf) {\n if (buf.length % 4 > 0) {\n throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${buf.length}`);\n }\n let str = '';\n let lineLen = 0;\n function buildLine(c1, c2, c3, c4) {\n switch (lineLen) {\n case 76:\n str += `\\r\\n${c1}${c2}${c3}${c4}`;\n lineLen = 4;\n break;\n case 75:\n str += `${c1}\\r\\n${c2}${c3}${c4}`;\n lineLen = 3;\n break;\n case 74:\n str += `${c1 + c2}\\r\\n${c3}${c4}`;\n lineLen = 2;\n break;\n case 73:\n str += `${c1 + c2 + c3}\\r\\n${c4}`;\n lineLen = 1;\n break;\n default:\n str += c1 + c2 + c3 + c4;\n lineLen += 4;\n break;\n }\n }\n function validate(c) {\n if (c >= 65 && c <= 90) {\n return true;\n }\n if (c >= 97 && c <= 122) {\n return true;\n }\n if (c >= 48 && c <= 57) {\n return true;\n }\n if (c === 43) {\n return true;\n }\n if (c === 47) {\n return true;\n }\n if (c === 61) {\n return true;\n }\n return false;\n }\n for (let i = 0; i < buf.length; i += 4) {\n for (let j = i; j < i + 4; j += 1) {\n if (!validate(buf[j])) {\n throw new RangeError(`base64.toString: buf[${j}]: ${buf[j]} : not valid base64 character code`);\n }\n }\n buildLine(\n String.fromCharCode(buf[i]),\n String.fromCharCode(buf[i + 1]),\n String.fromCharCode(buf[i + 2]),\n String.fromCharCode(buf[i + 3])\n );\n }\n return str;\n },\n};\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-conv-api/transformers.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/ast.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module is used by the parser to build an [Abstract Syntax Tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (AST).\n// The AST can be thought of as a subset of the full parse tree.\n// Each node of the AST holds the phrase that was matched at the corresponding, named parse tree node.\n// It is built as the parser successfully matches phrases to the rule names\n// (`RNM` operators) and `UDT`s as it parses an input string.\n// The user controls which `RNM` or `UDT` names to keep on the AST.\n// The user can also associate callback functions with some or all of the retained\n// AST nodes to be used to translate the node phrases. That is, associate semantic\n// actions to the matched phrases.\n// Translating the AST rather that attempting to apply semantic actions during\n// the parsing process, has the advantage that there is no backtracking and that the phrases\n// are known while traversing down tree as will as up.\n//\n// Let `ast` be an `ast.js` object. To identify a node to be kept on the AST:\n// ```\n// ast.callbacks[\"rulename\"] = true; (all nodes default to false)\n// ```\n// To associate a callback function with a node:\n// ```\n// ast.callbacks[\"rulename\"] = fn\n// ```\n// `rulename` is any `RNM` or `UDT` name defined by the associated grammar\n// and `fn` is a user-written callback function.\n// (See [`apg-examples`](https://github.com/ldthomas/apg-js2-examples/tree/master/ast) for examples of how to create an AST,\n// define the nodes and callback functions and attach it to a parser.)\nmodule.exports = function exportsAst() {\n const id = __webpack_require__(/*! ./identifiers */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/identifiers.js\");\n const utils = __webpack_require__(/*! ./utilities */ \"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/utilities.js\");\n\n const thisFileName = 'ast.js: ';\n const that = this;\n let rules = null;\n let udts = null;\n let chars = null;\n let nodeCount = 0;\n const nodesDefined = [];\n const nodeCallbacks = [];\n const stack = [];\n const records = [];\n this.callbacks = [];\n this.astObject = 'astObject';\n /* called by the parser to initialize the AST with the rules, UDTs and the input characters */\n this.init = function init(rulesIn, udtsIn, charsIn) {\n stack.length = 0;\n records.length = 0;\n nodesDefined.length = 0;\n nodeCount = 0;\n rules = rulesIn;\n udts = udtsIn;\n chars = charsIn;\n let i;\n const list = [];\n for (i = 0; i < rules.length; i += 1) {\n list.push(rules[i].lower);\n }\n for (i = 0; i < udts.length; i += 1) {\n list.push(udts[i].lower);\n }\n nodeCount = rules.length + udts.length;\n for (i = 0; i < nodeCount; i += 1) {\n nodesDefined[i] = false;\n nodeCallbacks[i] = null;\n }\n for (const index in that.callbacks) {\n const lower = index.toLowerCase();\n i = list.indexOf(lower);\n if (i < 0) {\n throw new Error(`${thisFileName}init: node '${index}' not a rule or udt name`);\n }\n if (typeof that.callbacks[index] === 'function') {\n nodesDefined[i] = true;\n nodeCallbacks[i] = that.callbacks[index];\n }\n if (that.callbacks[index] === true) {\n nodesDefined[i] = true;\n }\n }\n };\n /* AST node definitions - called by the parser's `RNM` operator */\n this.ruleDefined = function ruleDefined(index) {\n return nodesDefined[index] !== false;\n };\n /* AST node definitions - called by the parser's `UDT` operator */\n this.udtDefined = function udtDefined(index) {\n return nodesDefined[rules.length + index] !== false;\n };\n /* called by the parser's `RNM` & `UDT` operators */\n /* builds a record for the downward traversal of the node */\n this.down = function down(callbackIndex, name) {\n const thisIndex = records.length;\n stack.push(thisIndex);\n records.push({\n name,\n thisIndex,\n thatIndex: null,\n state: id.SEM_PRE,\n callbackIndex,\n phraseIndex: null,\n phraseLength: null,\n stack: stack.length,\n });\n return thisIndex;\n };\n /* called by the parser's `RNM` & `UDT` operators */\n /* builds a record for the upward traversal of the node */\n this.up = function up(callbackIndex, name, phraseIndex, phraseLength) {\n const thisIndex = records.length;\n const thatIndex = stack.pop();\n records.push({\n name,\n thisIndex,\n thatIndex,\n state: id.SEM_POST,\n callbackIndex,\n phraseIndex,\n phraseLength,\n stack: stack.length,\n });\n records[thatIndex].thatIndex = thisIndex;\n records[thatIndex].phraseIndex = phraseIndex;\n records[thatIndex].phraseLength = phraseLength;\n return thisIndex;\n };\n // Called by the user to translate the AST.\n // Translate means to associate or apply some semantic action to the\n // phrases that were syntactically matched to the AST nodes according\n // to the defining grammar.\n // ```\n // data - optional user-defined data\n // passed to the callback functions by the translator\n // ```\n this.translate = function translate(data) {\n let ret;\n let callback;\n let record;\n for (let i = 0; i < records.length; i += 1) {\n record = records[i];\n callback = nodeCallbacks[record.callbackIndex];\n if (record.state === id.SEM_PRE) {\n if (callback !== null) {\n ret = callback(id.SEM_PRE, chars, record.phraseIndex, record.phraseLength, data);\n if (ret === id.SEM_SKIP) {\n i = record.thatIndex;\n }\n }\n } else if (callback !== null) {\n callback(id.SEM_POST, chars, record.phraseIndex, record.phraseLength, data);\n }\n }\n };\n /* called by the parser to reset the length of the records array */\n /* necessary on backtracking */\n this.setLength = function setLength(length) {\n records.length = length;\n if (length > 0) {\n stack.length = records[length - 1].stack;\n } else {\n stack.length = 0;\n }\n };\n /* called by the parser to get the length of the records array */\n this.getLength = function getLength() {\n return records.length;\n };\n /* helper for XML display */\n function indent(n) {\n let ret = '';\n for (let i = 0; i < n; i += 1) {\n ret += ' ';\n }\n return ret;\n }\n // Generate an `XML` version of the AST.\n // Useful if you want to use a special or favorite XML parser to translate the\n // AST.\n // ```\n // mode - the display mode of the captured phrases\n // - default mode is \"ascii\"\n // - can be: \"ascii\"\n // \"decimal\"\n // \"hexadecimal\"\n // \"unicode\"\n // ```\n this.toXml = function toSml(modeArg) {\n let display = utils.charsToDec;\n let caption = 'decimal integer character codes';\n if (typeof modeArg === 'string' && modeArg.length >= 3) {\n const mode = modeArg.slice(0, 3).toLowerCase();\n if (mode === 'asc') {\n display = utils.charsToAscii;\n caption = 'ASCII for printing characters, hex for non-printing';\n } else if (mode === 'hex') {\n display = utils.charsToHex;\n caption = 'hexadecimal integer character codes';\n } else if (mode === 'uni') {\n display = utils.charsToUnicode;\n caption = 'Unicode UTF-32 integer character codes';\n }\n }\n let xml = '';\n let depth = 0;\n xml += '\\n';\n xml += `\\n`;\n xml += `\x3c!-- input string, ${caption} --\x3e\\n`;\n xml += indent(depth + 2);\n xml += display(chars);\n xml += '\\n';\n records.forEach((rec) => {\n if (rec.state === id.SEM_PRE) {\n depth += 1;\n xml += indent(depth);\n xml += `\\n`;\n xml += indent(depth + 2);\n xml += display(chars, rec.phraseIndex, rec.phraseLength);\n xml += '\\n';\n } else {\n xml += indent(depth);\n xml += `\x3c!-- name=\"${rec.name}\" --\x3e\\n`;\n depth -= 1;\n }\n });\n\n xml += '\\n';\n return xml;\n };\n /* generate a JavaScript object version of the AST */\n /* for the phrase-matching engine apg-exp */\n this.phrases = function phrases() {\n const obj = {};\n let i;\n let record;\n for (i = 0; i < records.length; i += 1) {\n record = records[i];\n if (record.state === id.SEM_PRE) {\n if (!Array.isArray(obj[record.name])) {\n obj[record.name] = [];\n }\n obj[record.name].push({\n index: record.phraseIndex,\n length: record.phraseLength,\n });\n }\n }\n return obj;\n };\n};\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/ast.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/circular-buffer.js":module=>{eval("/* *************************************************************************************\n * copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved\n * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)\n * ********************************************************************************* */\n// This module acts as a \"circular buffer\". It is used to keep track\n// only the last N records in an array of records. If more than N records\n// are saved, each additional record overwrites the previously oldest record.\n// This module deals only with the record indexes and does not save\n// any actual records. It is used by [`trace.js`](./trace.html) for limiting the number of\n// trace records saved.\nmodule.exports = function exportsCircularBuffer() {\n 'use strict;';\n\n const thisFileName = 'circular-buffer.js: ';\n let itemIndex = -1;\n let maxListSize = 0;\n // Initialize buffer.
\n // *size* is `maxListSize`, the maximum number of records saved before overwriting begins.\n this.init = function init(size) {\n if (typeof size !== 'number' || size <= 0) {\n throw new Error(`${thisFileName}init: circular buffer size must an integer > 0`);\n }\n maxListSize = Math.ceil(size);\n itemIndex = -1;\n };\n // Call this to increment the number of records collected.
\n // Returns the array index number to store the next record in.\n this.increment = function increment() {\n itemIndex += 1;\n return (itemIndex + maxListSize) % maxListSize;\n };\n // Returns `maxListSize` - the maximum number of records to keep in the buffer.\n this.maxSize = function maxSize() {\n return maxListSize;\n };\n // Returns the highest number of items saved.
\n // (The number of items is the actual number of records processed\n // even though only `maxListSize` records are actually retained.)\n this.items = function items() {\n return itemIndex + 1;\n };\n // Returns the record number associated with this item index.\n this.getListIndex = function getListIndex(item) {\n if (itemIndex === -1) {\n return -1;\n }\n if (item < 0 || item > itemIndex) {\n return -1;\n }\n if (itemIndex - item >= maxListSize) {\n return -1;\n }\n return (item + maxListSize) % maxListSize;\n };\n // The iterator over the circular buffer.\n // The user's function, `fn`, will be called with arguments `fn(listIndex, itemIndex)`\n // where `listIndex` is the saved record index and `itemIndex` is the actual item index.\n this.forEach = function forEach(fn) {\n if (itemIndex === -1) {\n /* no records have been collected */\n return;\n }\n if (itemIndex < maxListSize) {\n /* fewer than maxListSize records have been collected - number of items = number of records */\n for (let i = 0; i <= itemIndex; i += 1) {\n fn(i, i);\n }\n return;\n }\n /* start with the oldest record saved and finish with the most recent record saved */\n for (let i = itemIndex - maxListSize + 1; i <= itemIndex; i += 1) {\n const listIndex = (i + maxListSize) % maxListSize;\n fn(listIndex, i);\n }\n };\n};\n\n\n//# sourceURL=webpack:///./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/circular-buffer.js?")},"./node_modules/.pnpm/apg-js@4.4.0/node_modules/apg-js/src/apg-lib/emitcss.js":module=>{eval("// This module has been developed programmatically in the `apg-lib` build process.\n// It is used to build web pages programatically on the fly without the need for + +

ZKL Roadhog Demo

+ + + + + diff --git a/index.js b/index.js new file mode 100644 index 0000000..1275c1c --- /dev/null +++ b/index.js @@ -0,0 +1,35 @@ +import { signIn as _signIn } from './roadhog.js'; + +const endpoint = "http://localhost:3000"; + +async function signIn(type) { + try { + const result = await _signIn(type); + if (result.success) { + console.log('Successfully signed in with', type); + const b = document.createElement('button'); + b.innerText = 'Click to access protected'; + b.setAttribute('onclick', 'fetchProtected()'); + document.body.appendChild(b); + } else { + console.error('Sign-in failed:', result.error); + } + } catch (error) { + console.error('Sign-in error:', error); + } +} + +async function signOff() { + +} + +window.signIn = signIn; +window.signOff = signOff; + +function init() { + console.log('start'); + if (!window.ethereum) console.log('ethereum not detected'); + if (!window.solana) console.log('solana not detected'); +} + +window.addEventListener('load', init); diff --git a/package.json b/package.json new file mode 100644 index 0000000..5a28d30 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "devDependencies": { + "terser-webpack-plugin": "^5.3.10", + "webpack": "^5.95.0", + "webpack-cli": "^5.1.4" + }, + "dependencies": { + "@solana/web3.js": "^1.95.3", + "bs58": "^6.0.0", + "ethers": "^6.13.3", + "siwe": "^2.3.2" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..f6c2365 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,1502 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@solana/web3.js': + specifier: ^1.95.3 + version: 1.95.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bs58: + specifier: ^6.0.0 + version: 6.0.0 + ethers: + specifier: ^6.13.3 + version: 6.13.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + siwe: + specifier: ^2.3.2 + version: 2.3.2(ethers@6.13.3(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + devDependencies: + terser-webpack-plugin: + specifier: ^5.3.10 + version: 5.3.10(webpack@5.95.0(webpack-cli@5.1.4)) + webpack: + specifier: ^5.95.0 + version: 5.95.0(webpack-cli@5.1.4) + webpack-cli: + specifier: ^5.1.4 + version: 5.1.4(webpack@5.95.0) + +packages: + + '@adraffy/ens-normalize@1.10.1': + resolution: {integrity: sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==} + + '@babel/runtime@7.25.6': + resolution: {integrity: sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==} + engines: {node: '>=6.9.0'} + + '@discoveryjs/json-ext@0.5.7': + resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==} + engines: {node: '>=10.0.0'} + + '@jridgewell/gen-mapping@0.3.5': + resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} + engines: {node: '>=6.0.0'} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/set-array@1.2.1': + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + + '@jridgewell/source-map@0.3.6': + resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==} + + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + + '@jridgewell/trace-mapping@0.3.25': + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + + '@noble/curves@1.2.0': + resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} + + '@noble/curves@1.6.0': + resolution: {integrity: sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==} + engines: {node: ^14.21.3 || >=16} + + '@noble/hashes@1.3.2': + resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==} + engines: {node: '>= 16'} + + '@noble/hashes@1.5.0': + resolution: {integrity: sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==} + engines: {node: ^14.21.3 || >=16} + + '@solana/buffer-layout@4.0.1': + resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==} + engines: {node: '>=5.10'} + + '@solana/web3.js@1.95.3': + resolution: {integrity: sha512-O6rPUN0w2fkNqx/Z3QJMB9L225Ex10PRDH8bTaIUPZXMPV0QP8ZpPvjQnXK+upUczlRgzHzd6SjKIha1p+I6og==} + + '@spruceid/siwe-parser@2.1.2': + resolution: {integrity: sha512-d/r3S1LwJyMaRAKQ0awmo9whfXeE88Qt00vRj91q5uv5ATtWIQEGJ67Yr5eSZw5zp1/fZCXZYuEckt8lSkereQ==} + + '@stablelib/binary@1.0.1': + resolution: {integrity: sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==} + + '@stablelib/int@1.0.1': + resolution: {integrity: sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==} + + '@stablelib/random@1.0.2': + resolution: {integrity: sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==} + + '@stablelib/wipe@1.0.1': + resolution: {integrity: sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==} + + '@swc/helpers@0.5.13': + resolution: {integrity: sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==} + + '@types/connect@3.4.38': + resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} + + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/node@12.20.55': + resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + + '@types/node@18.15.13': + resolution: {integrity: sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==} + + '@types/node@22.7.4': + resolution: {integrity: sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==} + + '@types/uuid@8.3.4': + resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==} + + '@types/ws@7.4.7': + resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} + + '@types/ws@8.5.12': + resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} + + '@webassemblyjs/ast@1.12.1': + resolution: {integrity: sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==} + + '@webassemblyjs/floating-point-hex-parser@1.11.6': + resolution: {integrity: sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==} + + '@webassemblyjs/helper-api-error@1.11.6': + resolution: {integrity: sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==} + + '@webassemblyjs/helper-buffer@1.12.1': + resolution: {integrity: sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==} + + '@webassemblyjs/helper-numbers@1.11.6': + resolution: {integrity: sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==} + + '@webassemblyjs/helper-wasm-bytecode@1.11.6': + resolution: {integrity: sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==} + + '@webassemblyjs/helper-wasm-section@1.12.1': + resolution: {integrity: sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==} + + '@webassemblyjs/ieee754@1.11.6': + resolution: {integrity: sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==} + + '@webassemblyjs/leb128@1.11.6': + resolution: {integrity: sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==} + + '@webassemblyjs/utf8@1.11.6': + resolution: {integrity: sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==} + + '@webassemblyjs/wasm-edit@1.12.1': + resolution: {integrity: sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==} + + '@webassemblyjs/wasm-gen@1.12.1': + resolution: {integrity: sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==} + + '@webassemblyjs/wasm-opt@1.12.1': + resolution: {integrity: sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==} + + '@webassemblyjs/wasm-parser@1.12.1': + resolution: {integrity: sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==} + + '@webassemblyjs/wast-printer@1.12.1': + resolution: {integrity: sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==} + + '@webpack-cli/configtest@2.1.1': + resolution: {integrity: sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + + '@webpack-cli/info@2.0.2': + resolution: {integrity: sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + + '@webpack-cli/serve@2.0.5': + resolution: {integrity: sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + webpack-dev-server: '*' + peerDependenciesMeta: + webpack-dev-server: + optional: true + + '@xtuc/ieee754@1.2.0': + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + + '@xtuc/long@4.2.2': + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + + JSONStream@1.3.5: + resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} + hasBin: true + + acorn-import-attributes@1.9.5: + resolution: {integrity: sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==} + peerDependencies: + acorn: ^8 + + acorn@8.12.1: + resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} + engines: {node: '>=0.4.0'} + hasBin: true + + aes-js@4.0.0-beta.5: + resolution: {integrity: sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==} + + agentkeepalive@4.5.0: + resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==} + engines: {node: '>= 8.0.0'} + + ajv-keywords@3.5.2: + resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} + peerDependencies: + ajv: ^6.9.1 + + ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + + apg-js@4.4.0: + resolution: {integrity: sha512-fefmXFknJmtgtNEXfPwZKYkMFX4Fyeyz+fNF6JWp87biGOPslJbCBVU158zvKRZfHBKnJDy8CMM40oLFGkXT8Q==} + + base-x@3.0.10: + resolution: {integrity: sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==} + + base-x@5.0.0: + resolution: {integrity: sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + bigint-buffer@1.1.5: + resolution: {integrity: sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==} + engines: {node: '>= 10.0.0'} + + bindings@1.5.0: + resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} + + bn.js@5.2.1: + resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} + + borsh@0.7.0: + resolution: {integrity: sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==} + + browserslist@4.24.0: + resolution: {integrity: sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + bs58@4.0.1: + resolution: {integrity: sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==} + + bs58@6.0.0: + resolution: {integrity: sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + + bufferutil@4.0.8: + resolution: {integrity: sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==} + engines: {node: '>=6.14.2'} + + caniuse-lite@1.0.30001664: + resolution: {integrity: sha512-AmE7k4dXiNKQipgn7a2xg558IRqPN3jMQY/rOsbxDhrd0tyChwbITBfiwtnqz8bi2M5mIWbxAYBvk7W7QBUS2g==} + + chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + + clone-deep@4.0.1: + resolution: {integrity: sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==} + engines: {node: '>=6'} + + colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + + commander@10.0.1: + resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} + engines: {node: '>=14'} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + + delay@5.0.0: + resolution: {integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==} + engines: {node: '>=10'} + + electron-to-chromium@1.5.30: + resolution: {integrity: sha512-sXI35EBN4lYxzc/pIGorlymYNzDBOqkSlVRe6MkgBsW/hW1tpC/HDJ2fjG7XnjakzfLEuvdmux0Mjs6jHq4UOA==} + + enhanced-resolve@5.17.1: + resolution: {integrity: sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==} + engines: {node: '>=10.13.0'} + + envinfo@7.14.0: + resolution: {integrity: sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==} + engines: {node: '>=4'} + hasBin: true + + es-module-lexer@1.5.4: + resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==} + + es6-promise@4.2.8: + resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} + + es6-promisify@5.0.0: + resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + ethers@6.13.3: + resolution: {integrity: sha512-/DzbZOLVtoO4fKvvQwpEucHAQgIwBGWuRvBdwE/lMXgXvvHHTSkn7XqAQ2b+gjJzZDJjWA9OD05bVceVOsBHbg==} + engines: {node: '>=14.0.0'} + + eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + eyes@0.1.8: + resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} + engines: {node: '> 0.1.90'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-stable-stringify@1.0.0: + resolution: {integrity: sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==} + + fastest-levenshtein@1.0.16: + resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==} + engines: {node: '>= 4.9.1'} + + file-uri-to-path@1.0.0: + resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + + find-up@4.1.0: + resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} + engines: {node: '>=8'} + + flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + + humanize-ms@1.2.1: + resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + import-local@3.2.0: + resolution: {integrity: sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==} + engines: {node: '>=8'} + hasBin: true + + interpret@3.1.1: + resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==} + engines: {node: '>=10.13.0'} + + is-core-module@2.15.1: + resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} + engines: {node: '>= 0.4'} + + is-plain-object@2.0.4: + resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} + engines: {node: '>=0.10.0'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + isobject@3.0.1: + resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} + engines: {node: '>=0.10.0'} + + isomorphic-ws@4.0.1: + resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} + peerDependencies: + ws: '*' + + jayson@4.1.2: + resolution: {integrity: sha512-5nzMWDHy6f+koZOuYsArh2AXs73NfWYVlFyJJuCedr93GpY+Ku8qq10ropSXVfHK+H0T6paA88ww+/dV+1fBNA==} + engines: {node: '>=8'} + hasBin: true + + jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-stringify-safe@5.0.1: + resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} + + jsonparse@1.3.1: + resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} + engines: {'0': node >= 0.2.0} + + kind-of@6.0.3: + resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} + engines: {node: '>=0.10.0'} + + loader-runner@4.3.0: + resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} + engines: {node: '>=6.11.5'} + + locate-path@5.0.0: + resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} + engines: {node: '>=8'} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + node-gyp-build@4.8.2: + resolution: {integrity: sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==} + hasBin: true + + node-releases@2.0.18: + resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} + + p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + + p-locate@4.1.0: + resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} + engines: {node: '>=8'} + + p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + + picocolors@1.1.0: + resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + + pkg-dir@4.2.0: + resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} + engines: {node: '>=8'} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + rechoir@0.8.0: + resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==} + engines: {node: '>= 10.13.0'} + + regenerator-runtime@0.14.1: + resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} + + resolve-cwd@3.0.0: + resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} + engines: {node: '>=8'} + + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + + resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} + hasBin: true + + rpc-websockets@9.0.4: + resolution: {integrity: sha512-yWZWN0M+bivtoNLnaDbtny4XchdAIF5Q4g/ZsC5UC61Ckbp0QczwO8fg44rV3uYmY4WHd+EZQbn90W1d8ojzqQ==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + schema-utils@3.3.0: + resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} + engines: {node: '>= 10.13.0'} + + serialize-javascript@6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} + + shallow-clone@3.0.1: + resolution: {integrity: sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==} + engines: {node: '>=8'} + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + siwe@2.3.2: + resolution: {integrity: sha512-aSf+6+Latyttbj5nMu6GF3doMfv2UYj83hhwZgUF20ky6fTS83uVhkQABdIVnEuS8y1bBdk7p6ltb9SmlhTTlA==} + peerDependencies: + ethers: ^5.6.8 || ^6.0.8 + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + superstruct@2.0.2: + resolution: {integrity: sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==} + engines: {node: '>=14.0.0'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + + tapable@2.2.1: + resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} + engines: {node: '>=6'} + + terser-webpack-plugin@5.3.10: + resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@swc/core': '*' + esbuild: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@swc/core': + optional: true + esbuild: + optional: true + uglify-js: + optional: true + + terser@5.34.1: + resolution: {integrity: sha512-FsJZ7iZLd/BXkz+4xrRTGJ26o/6VTjQytUk8b8OxkwcD2I+79VPJlz7qss1+zE7h8GNIScFqXcDyJ/KqBYZFVA==} + engines: {node: '>=10'} + hasBin: true + + text-encoding-utf-8@1.0.2: + resolution: {integrity: sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==} + + through@2.3.8: + resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + + tslib@2.4.0: + resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} + + tslib@2.7.0: + resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} + + undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + + update-browserslist-db@1.1.1: + resolution: {integrity: sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + utf-8-validate@5.0.10: + resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} + engines: {node: '>=6.14.2'} + + uuid@8.3.2: + resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} + hasBin: true + + valid-url@1.0.9: + resolution: {integrity: sha512-QQDsV8OnSf5Uc30CKSwG9lnhMPe6exHtTXLRYX8uMwKENy640pU+2BgBL0LRbDh/eYRahNCS7aewCx0wf3NYVA==} + + watchpack@2.4.2: + resolution: {integrity: sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==} + engines: {node: '>=10.13.0'} + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + webpack-cli@5.1.4: + resolution: {integrity: sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==} + engines: {node: '>=14.15.0'} + hasBin: true + peerDependencies: + '@webpack-cli/generators': '*' + webpack: 5.x.x + webpack-bundle-analyzer: '*' + webpack-dev-server: '*' + peerDependenciesMeta: + '@webpack-cli/generators': + optional: true + webpack-bundle-analyzer: + optional: true + webpack-dev-server: + optional: true + + webpack-merge@5.10.0: + resolution: {integrity: sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==} + engines: {node: '>=10.0.0'} + + webpack-sources@3.2.3: + resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} + engines: {node: '>=10.13.0'} + + webpack@5.95.0: + resolution: {integrity: sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + wildcard@2.0.1: + resolution: {integrity: sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==} + + ws@7.5.10: + resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} + engines: {node: '>=8.3.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + ws@8.17.1: + resolution: {integrity: sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + ws@8.18.0: + resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + +snapshots: + + '@adraffy/ens-normalize@1.10.1': {} + + '@babel/runtime@7.25.6': + dependencies: + regenerator-runtime: 0.14.1 + + '@discoveryjs/json-ext@0.5.7': {} + + '@jridgewell/gen-mapping@0.3.5': + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/set-array@1.2.1': {} + + '@jridgewell/source-map@0.3.6': + dependencies: + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/sourcemap-codec@1.5.0': {} + + '@jridgewell/trace-mapping@0.3.25': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + + '@noble/curves@1.2.0': + dependencies: + '@noble/hashes': 1.3.2 + + '@noble/curves@1.6.0': + dependencies: + '@noble/hashes': 1.5.0 + + '@noble/hashes@1.3.2': {} + + '@noble/hashes@1.5.0': {} + + '@solana/buffer-layout@4.0.1': + dependencies: + buffer: 6.0.3 + + '@solana/web3.js@1.95.3(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@babel/runtime': 7.25.6 + '@noble/curves': 1.6.0 + '@noble/hashes': 1.5.0 + '@solana/buffer-layout': 4.0.1 + agentkeepalive: 4.5.0 + bigint-buffer: 1.1.5 + bn.js: 5.2.1 + borsh: 0.7.0 + bs58: 4.0.1 + buffer: 6.0.3 + fast-stable-stringify: 1.0.0 + jayson: 4.1.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) + node-fetch: 2.7.0 + rpc-websockets: 9.0.4 + superstruct: 2.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + '@spruceid/siwe-parser@2.1.2': + dependencies: + '@noble/hashes': 1.5.0 + apg-js: 4.4.0 + uri-js: 4.4.1 + valid-url: 1.0.9 + + '@stablelib/binary@1.0.1': + dependencies: + '@stablelib/int': 1.0.1 + + '@stablelib/int@1.0.1': {} + + '@stablelib/random@1.0.2': + dependencies: + '@stablelib/binary': 1.0.1 + '@stablelib/wipe': 1.0.1 + + '@stablelib/wipe@1.0.1': {} + + '@swc/helpers@0.5.13': + dependencies: + tslib: 2.7.0 + + '@types/connect@3.4.38': + dependencies: + '@types/node': 22.7.4 + + '@types/estree@1.0.6': {} + + '@types/json-schema@7.0.15': {} + + '@types/node@12.20.55': {} + + '@types/node@18.15.13': {} + + '@types/node@22.7.4': + dependencies: + undici-types: 6.19.8 + + '@types/uuid@8.3.4': {} + + '@types/ws@7.4.7': + dependencies: + '@types/node': 22.7.4 + + '@types/ws@8.5.12': + dependencies: + '@types/node': 22.7.4 + + '@webassemblyjs/ast@1.12.1': + dependencies: + '@webassemblyjs/helper-numbers': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + + '@webassemblyjs/floating-point-hex-parser@1.11.6': {} + + '@webassemblyjs/helper-api-error@1.11.6': {} + + '@webassemblyjs/helper-buffer@1.12.1': {} + + '@webassemblyjs/helper-numbers@1.11.6': + dependencies: + '@webassemblyjs/floating-point-hex-parser': 1.11.6 + '@webassemblyjs/helper-api-error': 1.11.6 + '@xtuc/long': 4.2.2 + + '@webassemblyjs/helper-wasm-bytecode@1.11.6': {} + + '@webassemblyjs/helper-wasm-section@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-buffer': 1.12.1 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/wasm-gen': 1.12.1 + + '@webassemblyjs/ieee754@1.11.6': + dependencies: + '@xtuc/ieee754': 1.2.0 + + '@webassemblyjs/leb128@1.11.6': + dependencies: + '@xtuc/long': 4.2.2 + + '@webassemblyjs/utf8@1.11.6': {} + + '@webassemblyjs/wasm-edit@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-buffer': 1.12.1 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/helper-wasm-section': 1.12.1 + '@webassemblyjs/wasm-gen': 1.12.1 + '@webassemblyjs/wasm-opt': 1.12.1 + '@webassemblyjs/wasm-parser': 1.12.1 + '@webassemblyjs/wast-printer': 1.12.1 + + '@webassemblyjs/wasm-gen@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/ieee754': 1.11.6 + '@webassemblyjs/leb128': 1.11.6 + '@webassemblyjs/utf8': 1.11.6 + + '@webassemblyjs/wasm-opt@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-buffer': 1.12.1 + '@webassemblyjs/wasm-gen': 1.12.1 + '@webassemblyjs/wasm-parser': 1.12.1 + + '@webassemblyjs/wasm-parser@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-api-error': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/ieee754': 1.11.6 + '@webassemblyjs/leb128': 1.11.6 + '@webassemblyjs/utf8': 1.11.6 + + '@webassemblyjs/wast-printer@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@xtuc/long': 4.2.2 + + '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4))': + dependencies: + webpack: 5.95.0(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack@5.95.0) + + '@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4))': + dependencies: + webpack: 5.95.0(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack@5.95.0) + + '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4))': + dependencies: + webpack: 5.95.0(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack@5.95.0) + + '@xtuc/ieee754@1.2.0': {} + + '@xtuc/long@4.2.2': {} + + JSONStream@1.3.5: + dependencies: + jsonparse: 1.3.1 + through: 2.3.8 + + acorn-import-attributes@1.9.5(acorn@8.12.1): + dependencies: + acorn: 8.12.1 + + acorn@8.12.1: {} + + aes-js@4.0.0-beta.5: {} + + agentkeepalive@4.5.0: + dependencies: + humanize-ms: 1.2.1 + + ajv-keywords@3.5.2(ajv@6.12.6): + dependencies: + ajv: 6.12.6 + + ajv@6.12.6: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + apg-js@4.4.0: {} + + base-x@3.0.10: + dependencies: + safe-buffer: 5.2.1 + + base-x@5.0.0: {} + + base64-js@1.5.1: {} + + bigint-buffer@1.1.5: + dependencies: + bindings: 1.5.0 + + bindings@1.5.0: + dependencies: + file-uri-to-path: 1.0.0 + + bn.js@5.2.1: {} + + borsh@0.7.0: + dependencies: + bn.js: 5.2.1 + bs58: 4.0.1 + text-encoding-utf-8: 1.0.2 + + browserslist@4.24.0: + dependencies: + caniuse-lite: 1.0.30001664 + electron-to-chromium: 1.5.30 + node-releases: 2.0.18 + update-browserslist-db: 1.1.1(browserslist@4.24.0) + + bs58@4.0.1: + dependencies: + base-x: 3.0.10 + + bs58@6.0.0: + dependencies: + base-x: 5.0.0 + + buffer-from@1.1.2: {} + + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + bufferutil@4.0.8: + dependencies: + node-gyp-build: 4.8.2 + optional: true + + caniuse-lite@1.0.30001664: {} + + chrome-trace-event@1.0.4: {} + + clone-deep@4.0.1: + dependencies: + is-plain-object: 2.0.4 + kind-of: 6.0.3 + shallow-clone: 3.0.1 + + colorette@2.0.20: {} + + commander@10.0.1: {} + + commander@2.20.3: {} + + cross-spawn@7.0.3: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + delay@5.0.0: {} + + electron-to-chromium@1.5.30: {} + + enhanced-resolve@5.17.1: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.2.1 + + envinfo@7.14.0: {} + + es-module-lexer@1.5.4: {} + + es6-promise@4.2.8: {} + + es6-promisify@5.0.0: + dependencies: + es6-promise: 4.2.8 + + escalade@3.2.0: {} + + eslint-scope@5.1.1: + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@4.3.0: {} + + estraverse@5.3.0: {} + + ethers@6.13.3(bufferutil@4.0.8)(utf-8-validate@5.0.10): + dependencies: + '@adraffy/ens-normalize': 1.10.1 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@types/node': 18.15.13 + aes-js: 4.0.0-beta.5 + tslib: 2.4.0 + ws: 8.17.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + eventemitter3@5.0.1: {} + + events@3.3.0: {} + + eyes@0.1.8: {} + + fast-deep-equal@3.1.3: {} + + fast-json-stable-stringify@2.1.0: {} + + fast-stable-stringify@1.0.0: {} + + fastest-levenshtein@1.0.16: {} + + file-uri-to-path@1.0.0: {} + + find-up@4.1.0: + dependencies: + locate-path: 5.0.0 + path-exists: 4.0.0 + + flat@5.0.2: {} + + function-bind@1.1.2: {} + + glob-to-regexp@0.4.1: {} + + graceful-fs@4.2.11: {} + + has-flag@4.0.0: {} + + hasown@2.0.2: + dependencies: + function-bind: 1.1.2 + + humanize-ms@1.2.1: + dependencies: + ms: 2.1.3 + + ieee754@1.2.1: {} + + import-local@3.2.0: + dependencies: + pkg-dir: 4.2.0 + resolve-cwd: 3.0.0 + + interpret@3.1.1: {} + + is-core-module@2.15.1: + dependencies: + hasown: 2.0.2 + + is-plain-object@2.0.4: + dependencies: + isobject: 3.0.1 + + isexe@2.0.0: {} + + isobject@3.0.1: {} + + isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + dependencies: + ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) + + jayson@4.1.2(bufferutil@4.0.8)(utf-8-validate@5.0.10): + dependencies: + '@types/connect': 3.4.38 + '@types/node': 12.20.55 + '@types/ws': 7.4.7 + JSONStream: 1.3.5 + commander: 2.20.3 + delay: 5.0.0 + es6-promisify: 5.0.0 + eyes: 0.1.8 + isomorphic-ws: 4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + json-stringify-safe: 5.0.1 + uuid: 8.3.2 + ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + jest-worker@27.5.1: + dependencies: + '@types/node': 22.7.4 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@0.4.1: {} + + json-stringify-safe@5.0.1: {} + + jsonparse@1.3.1: {} + + kind-of@6.0.3: {} + + loader-runner@4.3.0: {} + + locate-path@5.0.0: + dependencies: + p-locate: 4.1.0 + + merge-stream@2.0.0: {} + + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + ms@2.1.3: {} + + neo-async@2.6.2: {} + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + node-gyp-build@4.8.2: + optional: true + + node-releases@2.0.18: {} + + p-limit@2.3.0: + dependencies: + p-try: 2.2.0 + + p-locate@4.1.0: + dependencies: + p-limit: 2.3.0 + + p-try@2.2.0: {} + + path-exists@4.0.0: {} + + path-key@3.1.1: {} + + path-parse@1.0.7: {} + + picocolors@1.1.0: {} + + pkg-dir@4.2.0: + dependencies: + find-up: 4.1.0 + + punycode@2.3.1: {} + + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + rechoir@0.8.0: + dependencies: + resolve: 1.22.8 + + regenerator-runtime@0.14.1: {} + + resolve-cwd@3.0.0: + dependencies: + resolve-from: 5.0.0 + + resolve-from@5.0.0: {} + + resolve@1.22.8: + dependencies: + is-core-module: 2.15.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + + rpc-websockets@9.0.4: + dependencies: + '@swc/helpers': 0.5.13 + '@types/uuid': 8.3.4 + '@types/ws': 8.5.12 + buffer: 6.0.3 + eventemitter3: 5.0.1 + uuid: 8.3.2 + ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + safe-buffer@5.2.1: {} + + schema-utils@3.3.0: + dependencies: + '@types/json-schema': 7.0.15 + ajv: 6.12.6 + ajv-keywords: 3.5.2(ajv@6.12.6) + + serialize-javascript@6.0.2: + dependencies: + randombytes: 2.1.0 + + shallow-clone@3.0.1: + dependencies: + kind-of: 6.0.3 + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + siwe@2.3.2(ethers@6.13.3(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + dependencies: + '@spruceid/siwe-parser': 2.1.2 + '@stablelib/random': 1.0.2 + ethers: 6.13.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + uri-js: 4.4.1 + valid-url: 1.0.9 + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + superstruct@2.0.2: {} + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + supports-preserve-symlinks-flag@1.0.0: {} + + tapable@2.2.1: {} + + terser-webpack-plugin@5.3.10(webpack@5.95.0(webpack-cli@5.1.4)): + dependencies: + '@jridgewell/trace-mapping': 0.3.25 + jest-worker: 27.5.1 + schema-utils: 3.3.0 + serialize-javascript: 6.0.2 + terser: 5.34.1 + webpack: 5.95.0(webpack-cli@5.1.4) + + terser@5.34.1: + dependencies: + '@jridgewell/source-map': 0.3.6 + acorn: 8.12.1 + commander: 2.20.3 + source-map-support: 0.5.21 + + text-encoding-utf-8@1.0.2: {} + + through@2.3.8: {} + + tr46@0.0.3: {} + + tslib@2.4.0: {} + + tslib@2.7.0: {} + + undici-types@6.19.8: {} + + update-browserslist-db@1.1.1(browserslist@4.24.0): + dependencies: + browserslist: 4.24.0 + escalade: 3.2.0 + picocolors: 1.1.0 + + uri-js@4.4.1: + dependencies: + punycode: 2.3.1 + + utf-8-validate@5.0.10: + dependencies: + node-gyp-build: 4.8.2 + optional: true + + uuid@8.3.2: {} + + valid-url@1.0.9: {} + + watchpack@2.4.2: + dependencies: + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + + webidl-conversions@3.0.1: {} + + webpack-cli@5.1.4(webpack@5.95.0): + dependencies: + '@discoveryjs/json-ext': 0.5.7 + '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4)) + '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4)) + '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4)) + colorette: 2.0.20 + commander: 10.0.1 + cross-spawn: 7.0.3 + envinfo: 7.14.0 + fastest-levenshtein: 1.0.16 + import-local: 3.2.0 + interpret: 3.1.1 + rechoir: 0.8.0 + webpack: 5.95.0(webpack-cli@5.1.4) + webpack-merge: 5.10.0 + + webpack-merge@5.10.0: + dependencies: + clone-deep: 4.0.1 + flat: 5.0.2 + wildcard: 2.0.1 + + webpack-sources@3.2.3: {} + + webpack@5.95.0(webpack-cli@5.1.4): + dependencies: + '@types/estree': 1.0.6 + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/wasm-edit': 1.12.1 + '@webassemblyjs/wasm-parser': 1.12.1 + acorn: 8.12.1 + acorn-import-attributes: 1.9.5(acorn@8.12.1) + browserslist: 4.24.0 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.17.1 + es-module-lexer: 1.5.4 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.0 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 3.3.0 + tapable: 2.2.1 + terser-webpack-plugin: 5.3.10(webpack@5.95.0(webpack-cli@5.1.4)) + watchpack: 2.4.2 + webpack-sources: 3.2.3 + optionalDependencies: + webpack-cli: 5.1.4(webpack@5.95.0) + transitivePeerDependencies: + - '@swc/core' + - esbuild + - uglify-js + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + wildcard@2.0.1: {} + + ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + ws@8.17.1(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 diff --git a/roadhog.js b/roadhog.js new file mode 100644 index 0000000..841f7e9 --- /dev/null +++ b/roadhog.js @@ -0,0 +1,88 @@ +import { SiweMessage } from 'siwe'; +import { BrowserProvider, JsonRpcSigner } from 'ethers'; +import * as solanaWeb3 from '@solana/web3.js'; +import bs58 from 'bs58'; + +const endpoint = 'http://localhost:3000'; + +export async function signIn(type) { + let address, signature, message; + + if (type === 'ethereum') { + await window.ethereum.request({ method: 'eth_requestAccounts' }); + const provider = new BrowserProvider(window.ethereum); + const signer = await provider.getSigner(); + address = await signer.getAddress(); + + const nonceResponse = await fetch(`${endpoint}/auth/nonce?address=${address}&type=ethereum`); + const { nonce } = await nonceResponse.json(); + + const siweMessage = new SiweMessage({ + domain: window.location.host, + address: address, + statement: 'Sign in with Ethereum to zk-Lokomotive.', + uri: window.location.origin, + version: '1', + chainId: 1, + nonce: nonce + }); + + message = siweMessage.prepareMessage(); + signature = await signer.signMessage(message); + } else if (type === 'solana') { + const provider = window.solana; + await provider.connect(); + address = provider.publicKey.toString(); + + const nonceResponse = await fetch(`${endpoint}/auth/nonce?address=${address}&type=solana`); + const { nonce } = await nonceResponse.json(); + + const encodedMessage = new TextEncoder().encode(nonce); + const signatureBytes = await provider.signMessage(encodedMessage, 'utf8'); + signature = bs58.encode(signatureBytes.signature); + } else { + throw new Error('Invalid type'); + } + + try { + const response = await fetch(`${endpoint}/auth/verify`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ type, message, address, signature }), + }); + + if (!response.ok) { + throw new Error((await response.json()).error); + } + + const { auth_token } = await response.json(); + + localStorage.setItem('auth_token', auth_token); + localStorage.setItem('auth_type', type); + + return { success: true, auth_token }; + } catch (error) { + console.error('Authentication error:', error); + return { success: false, error: error.message }; + } +} + +export async function signOff() { + const auth_token = localStorage.getItem('auth_token'); + const response = await fetch(`${endpoint}/auth/signoff`, { + method: 'DELETE', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${auth_token}` + } + }); + + if (!response.ok) { + throw new Error((await response.json()).error); + } else { + localStorage.removeItem('auth_token'); + return true; + } +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..8eac3a4 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,25 @@ +const path = require("path"); +const webpack = require("webpack"); +const TerserPlugin = require("terser-webpack-plugin"); + +module.exports = { + entry: "./index.js", + output: { + filename: "bundle.js", + path: path.resolve(__dirname, "dist") + }, + plugins: [ + new TerserPlugin({ + terserOptions: { + keep_fnames: ['signIn', 'fetchProtected'], + mangle: { + reserved: [ + "signIn", + "fetchProtected" + ] + } + } + }) + ], + mode: "development" +};