@etherspot/remote-signer
Version:
Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler
1,424 lines (1,388 loc) • 308 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/viem/_esm/utils/data/isHex.js
function isHex(value, { strict = true } = {}) {
if (!value)
return false;
if (typeof value !== "string")
return false;
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
}
var init_isHex = __esm({
"node_modules/viem/_esm/utils/data/isHex.js"() {
}
});
// node_modules/viem/_esm/utils/data/size.js
function size(value) {
if (isHex(value, { strict: false }))
return Math.ceil((value.length - 2) / 2);
return value.length;
}
var init_size = __esm({
"node_modules/viem/_esm/utils/data/size.js"() {
init_isHex();
}
});
// node_modules/viem/_esm/errors/version.js
var version;
var init_version = __esm({
"node_modules/viem/_esm/errors/version.js"() {
version = "2.16.3";
}
});
// node_modules/viem/_esm/errors/utils.js
var getVersion;
var init_utils = __esm({
"node_modules/viem/_esm/errors/utils.js"() {
init_version();
getVersion = () => `viem@${version}`;
}
});
// node_modules/viem/_esm/errors/base.js
function walk(err, fn) {
if (fn?.(err))
return err;
if (err && typeof err === "object" && "cause" in err)
return walk(err.cause, fn);
return fn ? null : err;
}
var BaseError;
var init_base = __esm({
"node_modules/viem/_esm/errors/base.js"() {
init_utils();
BaseError = class _BaseError extends Error {
constructor(shortMessage, args = {}) {
super();
Object.defineProperty(this, "details", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "docsPath", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "metaMessages", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "shortMessage", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "ViemError"
});
Object.defineProperty(this, "version", {
enumerable: true,
configurable: true,
writable: true,
value: getVersion()
});
const details = args.cause instanceof _BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
const docsPath = args.cause instanceof _BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
this.message = [
shortMessage || "An error occurred.",
"",
...args.metaMessages ? [...args.metaMessages, ""] : [],
...docsPath ? [
`Docs: ${args.docsBaseUrl ?? "https://viem.sh"}${docsPath}${args.docsSlug ? `#${args.docsSlug}` : ""}`
] : [],
...details ? [`Details: ${details}`] : [],
`Version: ${this.version}`
].join("\n");
if (args.cause)
this.cause = args.cause;
this.details = details;
this.docsPath = docsPath;
this.metaMessages = args.metaMessages;
this.shortMessage = shortMessage;
}
walk(fn) {
return walk(this, fn);
}
};
}
});
// node_modules/viem/_esm/errors/data.js
var SizeExceedsPaddingSizeError;
var init_data = __esm({
"node_modules/viem/_esm/errors/data.js"() {
init_base();
SizeExceedsPaddingSizeError = class extends BaseError {
constructor({ size: size2, targetSize, type }) {
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "SizeExceedsPaddingSizeError"
});
}
};
}
});
// node_modules/viem/_esm/utils/data/pad.js
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
if (typeof hexOrBytes === "string")
return padHex(hexOrBytes, { dir, size: size2 });
return padBytes(hexOrBytes, { dir, size: size2 });
}
function padHex(hex_, { dir, size: size2 = 32 } = {}) {
if (size2 === null)
return hex_;
const hex = hex_.replace("0x", "");
if (hex.length > size2 * 2)
throw new SizeExceedsPaddingSizeError({
size: Math.ceil(hex.length / 2),
targetSize: size2,
type: "hex"
});
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
}
function padBytes(bytes2, { dir, size: size2 = 32 } = {}) {
if (size2 === null)
return bytes2;
if (bytes2.length > size2)
throw new SizeExceedsPaddingSizeError({
size: bytes2.length,
targetSize: size2,
type: "bytes"
});
const paddedBytes = new Uint8Array(size2);
for (let i = 0; i < size2; i++) {
const padEnd = dir === "right";
paddedBytes[padEnd ? i : size2 - i - 1] = bytes2[padEnd ? i : bytes2.length - i - 1];
}
return paddedBytes;
}
var init_pad = __esm({
"node_modules/viem/_esm/utils/data/pad.js"() {
init_data();
}
});
// node_modules/viem/_esm/errors/encoding.js
var IntegerOutOfRangeError, SizeOverflowError;
var init_encoding = __esm({
"node_modules/viem/_esm/errors/encoding.js"() {
init_base();
IntegerOutOfRangeError = class extends BaseError {
constructor({ max, min, signed, size: size2, value }) {
super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "IntegerOutOfRangeError"
});
}
};
SizeOverflowError = class extends BaseError {
constructor({ givenSize, maxSize }) {
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "SizeOverflowError"
});
}
};
}
});
// node_modules/viem/_esm/utils/encoding/fromHex.js
function assertSize(hexOrBytes, { size: size2 }) {
if (size(hexOrBytes) > size2)
throw new SizeOverflowError({
givenSize: size(hexOrBytes),
maxSize: size2
});
}
var init_fromHex = __esm({
"node_modules/viem/_esm/utils/encoding/fromHex.js"() {
init_encoding();
init_size();
}
});
// node_modules/viem/_esm/utils/encoding/toHex.js
function toHex(value, opts = {}) {
if (typeof value === "number" || typeof value === "bigint")
return numberToHex(value, opts);
if (typeof value === "string") {
return stringToHex(value, opts);
}
if (typeof value === "boolean")
return boolToHex(value, opts);
return bytesToHex(value, opts);
}
function boolToHex(value, opts = {}) {
const hex = `0x${Number(value)}`;
if (typeof opts.size === "number") {
assertSize(hex, { size: opts.size });
return pad(hex, { size: opts.size });
}
return hex;
}
function bytesToHex(value, opts = {}) {
let string = "";
for (let i = 0; i < value.length; i++) {
string += hexes[value[i]];
}
const hex = `0x${string}`;
if (typeof opts.size === "number") {
assertSize(hex, { size: opts.size });
return pad(hex, { dir: "right", size: opts.size });
}
return hex;
}
function numberToHex(value_, opts = {}) {
const { signed, size: size2 } = opts;
const value = BigInt(value_);
let maxValue;
if (size2) {
if (signed)
maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
else
maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
} else if (typeof value_ === "number") {
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
}
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
if (maxValue && value > maxValue || value < minValue) {
const suffix = typeof value_ === "bigint" ? "n" : "";
throw new IntegerOutOfRangeError({
max: maxValue ? `${maxValue}${suffix}` : void 0,
min: `${minValue}${suffix}`,
signed,
size: size2,
value: `${value_}${suffix}`
});
}
const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
if (size2)
return pad(hex, { size: size2 });
return hex;
}
function stringToHex(value_, opts = {}) {
const value = encoder.encode(value_);
return bytesToHex(value, opts);
}
var hexes, encoder;
var init_toHex = __esm({
"node_modules/viem/_esm/utils/encoding/toHex.js"() {
init_encoding();
init_pad();
init_fromHex();
hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
encoder = /* @__PURE__ */ new TextEncoder();
}
});
// node_modules/viem/_esm/utils/encoding/toBytes.js
function toBytes(value, opts = {}) {
if (typeof value === "number" || typeof value === "bigint")
return numberToBytes(value, opts);
if (typeof value === "boolean")
return boolToBytes(value, opts);
if (isHex(value))
return hexToBytes(value, opts);
return stringToBytes(value, opts);
}
function boolToBytes(value, opts = {}) {
const bytes2 = new Uint8Array(1);
bytes2[0] = Number(value);
if (typeof opts.size === "number") {
assertSize(bytes2, { size: opts.size });
return pad(bytes2, { size: opts.size });
}
return bytes2;
}
function charCodeToBase16(char) {
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
return char - charCodeMap.zero;
if (char >= charCodeMap.A && char <= charCodeMap.F)
return char - (charCodeMap.A - 10);
if (char >= charCodeMap.a && char <= charCodeMap.f)
return char - (charCodeMap.a - 10);
return void 0;
}
function hexToBytes(hex_, opts = {}) {
let hex = hex_;
if (opts.size) {
assertSize(hex, { size: opts.size });
hex = pad(hex, { dir: "right", size: opts.size });
}
let hexString = hex.slice(2);
if (hexString.length % 2)
hexString = `0${hexString}`;
const length = hexString.length / 2;
const bytes2 = new Uint8Array(length);
for (let index = 0, j = 0; index < length; index++) {
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
if (nibbleLeft === void 0 || nibbleRight === void 0) {
throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
}
bytes2[index] = nibbleLeft * 16 + nibbleRight;
}
return bytes2;
}
function numberToBytes(value, opts) {
const hex = numberToHex(value, opts);
return hexToBytes(hex);
}
function stringToBytes(value, opts = {}) {
const bytes2 = encoder2.encode(value);
if (typeof opts.size === "number") {
assertSize(bytes2, { size: opts.size });
return pad(bytes2, { dir: "right", size: opts.size });
}
return bytes2;
}
var encoder2, charCodeMap;
var init_toBytes = __esm({
"node_modules/viem/_esm/utils/encoding/toBytes.js"() {
init_base();
init_isHex();
init_pad();
init_fromHex();
init_toHex();
encoder2 = /* @__PURE__ */ new TextEncoder();
charCodeMap = {
zero: 48,
nine: 57,
A: 65,
F: 70,
a: 97,
f: 102
};
}
});
// node_modules/@noble/hashes/esm/_assert.js
function number(n) {
if (!Number.isSafeInteger(n) || n < 0)
throw new Error(`Wrong positive integer: ${n}`);
}
function bytes(b, ...lengths) {
if (!(b instanceof Uint8Array))
throw new Error("Expected Uint8Array");
if (lengths.length > 0 && !lengths.includes(b.length))
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
}
function exists(instance, checkFinished = true) {
if (instance.destroyed)
throw new Error("Hash instance has been destroyed");
if (checkFinished && instance.finished)
throw new Error("Hash#digest() has already been called");
}
function output(out, instance) {
bytes(out);
const min = instance.outputLen;
if (out.length < min) {
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
}
}
var init_assert = __esm({
"node_modules/@noble/hashes/esm/_assert.js"() {
}
});
// node_modules/@noble/hashes/esm/_u64.js
function fromBig(n, le = false) {
if (le)
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
}
function split(lst, le = false) {
let Ah = new Uint32Array(lst.length);
let Al = new Uint32Array(lst.length);
for (let i = 0; i < lst.length; i++) {
const { h, l } = fromBig(lst[i], le);
[Ah[i], Al[i]] = [h, l];
}
return [Ah, Al];
}
var U32_MASK64, _32n, rotlSH, rotlSL, rotlBH, rotlBL;
var init_u64 = __esm({
"node_modules/@noble/hashes/esm/_u64.js"() {
U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
_32n = /* @__PURE__ */ BigInt(32);
rotlSH = (h, l, s) => h << s | l >>> 32 - s;
rotlSL = (h, l, s) => l << s | h >>> 32 - s;
rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
}
});
// node_modules/@noble/hashes/esm/utils.js
function utf8ToBytes(str) {
if (typeof str !== "string")
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
return new Uint8Array(new TextEncoder().encode(str));
}
function toBytes2(data) {
if (typeof data === "string")
data = utf8ToBytes(data);
if (!u8a(data))
throw new Error(`expected Uint8Array, got ${typeof data}`);
return data;
}
function wrapConstructor(hashCons) {
const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
const tmp = hashCons();
hashC.outputLen = tmp.outputLen;
hashC.blockLen = tmp.blockLen;
hashC.create = () => hashCons();
return hashC;
}
function wrapXOFConstructorWithOpts(hashCons) {
const hashC = (msg, opts) => hashCons(opts).update(toBytes2(msg)).digest();
const tmp = hashCons({});
hashC.outputLen = tmp.outputLen;
hashC.blockLen = tmp.blockLen;
hashC.create = (opts) => hashCons(opts);
return hashC;
}
var u8a, u32, isLE, Hash, toStr;
var init_utils2 = __esm({
"node_modules/@noble/hashes/esm/utils.js"() {
u8a = (a) => a instanceof Uint8Array;
u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
if (!isLE)
throw new Error("Non little-endian hardware is not supported");
Hash = class {
// Safe version that clones internal state
clone() {
return this._cloneInto();
}
};
toStr = {}.toString;
}
});
// node_modules/@noble/hashes/esm/sha3.js
function keccakP(s, rounds = 24) {
const B = new Uint32Array(5 * 2);
for (let round = 24 - rounds; round < 24; round++) {
for (let x = 0; x < 10; x++)
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
for (let x = 0; x < 10; x += 2) {
const idx1 = (x + 8) % 10;
const idx0 = (x + 2) % 10;
const B0 = B[idx0];
const B1 = B[idx0 + 1];
const Th = rotlH(B0, B1, 1) ^ B[idx1];
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
for (let y = 0; y < 50; y += 10) {
s[x + y] ^= Th;
s[x + y + 1] ^= Tl;
}
}
let curH = s[2];
let curL = s[3];
for (let t = 0; t < 24; t++) {
const shift = SHA3_ROTL[t];
const Th = rotlH(curH, curL, shift);
const Tl = rotlL(curH, curL, shift);
const PI = SHA3_PI[t];
curH = s[PI];
curL = s[PI + 1];
s[PI] = Th;
s[PI + 1] = Tl;
}
for (let y = 0; y < 50; y += 10) {
for (let x = 0; x < 10; x++)
B[x] = s[y + x];
for (let x = 0; x < 10; x++)
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
}
s[0] ^= SHA3_IOTA_H[round];
s[1] ^= SHA3_IOTA_L[round];
}
B.fill(0);
}
var SHA3_PI, SHA3_ROTL, _SHA3_IOTA, _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_IOTA_H, SHA3_IOTA_L, rotlH, rotlL, Keccak, gen, sha3_224, sha3_256, sha3_384, sha3_512, keccak_224, keccak_256, keccak_384, keccak_512, genShake, shake128, shake256;
var init_sha3 = __esm({
"node_modules/@noble/hashes/esm/sha3.js"() {
init_assert();
init_u64();
init_utils2();
[SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
_0n = /* @__PURE__ */ BigInt(0);
_1n = /* @__PURE__ */ BigInt(1);
_2n = /* @__PURE__ */ BigInt(2);
_7n = /* @__PURE__ */ BigInt(7);
_256n = /* @__PURE__ */ BigInt(256);
_0x71n = /* @__PURE__ */ BigInt(113);
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
[x, y] = [y, (2 * x + 3 * y) % 5];
SHA3_PI.push(2 * (5 * y + x));
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
let t = _0n;
for (let j = 0; j < 7; j++) {
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
if (R & _2n)
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
}
_SHA3_IOTA.push(t);
}
[SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
Keccak = class _Keccak extends Hash {
// NOTE: we accept arguments in bytes instead of bits here.
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
super();
this.blockLen = blockLen;
this.suffix = suffix;
this.outputLen = outputLen;
this.enableXOF = enableXOF;
this.rounds = rounds;
this.pos = 0;
this.posOut = 0;
this.finished = false;
this.destroyed = false;
number(outputLen);
if (0 >= this.blockLen || this.blockLen >= 200)
throw new Error("Sha3 supports only keccak-f1600 function");
this.state = new Uint8Array(200);
this.state32 = u32(this.state);
}
keccak() {
keccakP(this.state32, this.rounds);
this.posOut = 0;
this.pos = 0;
}
update(data) {
exists(this);
const { blockLen, state } = this;
data = toBytes2(data);
const len = data.length;
for (let pos = 0; pos < len; ) {
const take = Math.min(blockLen - this.pos, len - pos);
for (let i = 0; i < take; i++)
state[this.pos++] ^= data[pos++];
if (this.pos === blockLen)
this.keccak();
}
return this;
}
finish() {
if (this.finished)
return;
this.finished = true;
const { state, suffix, pos, blockLen } = this;
state[pos] ^= suffix;
if ((suffix & 128) !== 0 && pos === blockLen - 1)
this.keccak();
state[blockLen - 1] ^= 128;
this.keccak();
}
writeInto(out) {
exists(this, false);
bytes(out);
this.finish();
const bufferOut = this.state;
const { blockLen } = this;
for (let pos = 0, len = out.length; pos < len; ) {
if (this.posOut >= blockLen)
this.keccak();
const take = Math.min(blockLen - this.posOut, len - pos);
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
this.posOut += take;
pos += take;
}
return out;
}
xofInto(out) {
if (!this.enableXOF)
throw new Error("XOF is not possible for this instance");
return this.writeInto(out);
}
xof(bytes2) {
number(bytes2);
return this.xofInto(new Uint8Array(bytes2));
}
digestInto(out) {
output(out, this);
if (this.finished)
throw new Error("digest() was already called");
this.writeInto(out);
this.destroy();
return out;
}
digest() {
return this.digestInto(new Uint8Array(this.outputLen));
}
destroy() {
this.destroyed = true;
this.state.fill(0);
}
_cloneInto(to) {
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
to.state32.set(this.state32);
to.pos = this.pos;
to.posOut = this.posOut;
to.finished = this.finished;
to.rounds = rounds;
to.suffix = suffix;
to.outputLen = outputLen;
to.enableXOF = enableXOF;
to.destroyed = this.destroyed;
return to;
}
};
gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
sha3_224 = /* @__PURE__ */ gen(6, 144, 224 / 8);
sha3_256 = /* @__PURE__ */ gen(6, 136, 256 / 8);
sha3_384 = /* @__PURE__ */ gen(6, 104, 384 / 8);
sha3_512 = /* @__PURE__ */ gen(6, 72, 512 / 8);
keccak_224 = /* @__PURE__ */ gen(1, 144, 224 / 8);
keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
keccak_384 = /* @__PURE__ */ gen(1, 104, 384 / 8);
keccak_512 = /* @__PURE__ */ gen(1, 72, 512 / 8);
genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
}
});
// node_modules/viem/_esm/utils/hash/keccak256.js
function keccak256(value, to_) {
const to = to_ || "hex";
const bytes2 = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
if (to === "bytes")
return bytes2;
return toHex(bytes2);
}
var init_keccak256 = __esm({
"node_modules/viem/_esm/utils/hash/keccak256.js"() {
init_sha3();
init_isHex();
init_toBytes();
init_toHex();
}
});
// node_modules/viem/_esm/errors/address.js
var InvalidAddressError;
var init_address = __esm({
"node_modules/viem/_esm/errors/address.js"() {
init_base();
InvalidAddressError = class extends BaseError {
constructor({ address }) {
super(`Address "${address}" is invalid.`, {
metaMessages: [
"- Address must be a hex value of 20 bytes (40 hex characters).",
"- Address must match its checksum counterpart."
]
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "InvalidAddressError"
});
}
};
}
});
// node_modules/viem/_esm/utils/lru.js
var LruMap;
var init_lru = __esm({
"node_modules/viem/_esm/utils/lru.js"() {
LruMap = class extends Map {
constructor(size2) {
super();
Object.defineProperty(this, "maxSize", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.maxSize = size2;
}
set(key, value) {
super.set(key, value);
if (this.maxSize && this.size > this.maxSize)
this.delete(this.keys().next().value);
return this;
}
};
}
});
// node_modules/viem/_esm/utils/address/getAddress.js
function checksumAddress(address_, chainId) {
if (checksumAddressCache.has(`${address_}.${chainId}`))
return checksumAddressCache.get(`${address_}.${chainId}`);
const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
const hash = keccak256(stringToBytes(hexAddress), "bytes");
const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
for (let i = 0; i < 40; i += 2) {
if (hash[i >> 1] >> 4 >= 8 && address[i]) {
address[i] = address[i].toUpperCase();
}
if ((hash[i >> 1] & 15) >= 8 && address[i + 1]) {
address[i + 1] = address[i + 1].toUpperCase();
}
}
const result = `0x${address.join("")}`;
checksumAddressCache.set(`${address_}.${chainId}`, result);
return result;
}
function getAddress(address, chainId) {
if (!isAddress(address, { strict: false }))
throw new InvalidAddressError({ address });
return checksumAddress(address, chainId);
}
var checksumAddressCache;
var init_getAddress = __esm({
"node_modules/viem/_esm/utils/address/getAddress.js"() {
init_address();
init_toBytes();
init_keccak256();
init_lru();
init_isAddress();
checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
}
});
// node_modules/viem/_esm/utils/address/isAddress.js
function isAddress(address, options) {
const { strict = true } = options ?? {};
const cacheKey = `${address}.${strict}`;
if (isAddressCache.has(cacheKey))
return isAddressCache.get(cacheKey);
const result = (() => {
if (!addressRegex.test(address))
return false;
if (address.toLowerCase() === address)
return true;
if (strict)
return checksumAddress(address) === address;
return true;
})();
isAddressCache.set(cacheKey, result);
return result;
}
var addressRegex, isAddressCache;
var init_isAddress = __esm({
"node_modules/viem/_esm/utils/address/isAddress.js"() {
init_lru();
init_getAddress();
addressRegex = /^0x[a-fA-F0-9]{40}$/;
isAddressCache = /* @__PURE__ */ new LruMap(8192);
}
});
// node_modules/validator/lib/util/assertString.js
var require_assertString = __commonJS({
"node_modules/validator/lib/util/assertString.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = assertString;
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
function assertString(input) {
var isString = typeof input === "string" || input instanceof String;
if (!isString) {
var invalidType = _typeof(input);
if (input === null) invalidType = "null";
else if (invalidType === "object") invalidType = input.constructor.name;
throw new TypeError("Expected a string but received a ".concat(invalidType));
}
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/toDate.js
var require_toDate = __commonJS({
"node_modules/validator/lib/toDate.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toDate;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function toDate(date) {
(0, _assertString.default)(date);
date = Date.parse(date);
return !isNaN(date) ? new Date(date) : null;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/alpha.js
var require_alpha = __commonJS({
"node_modules/validator/lib/alpha.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.farsiLocales = exports2.englishLocales = exports2.dotDecimal = exports2.decimal = exports2.commaDecimal = exports2.bengaliLocales = exports2.arabicLocales = exports2.alphanumeric = exports2.alpha = void 0;
var alpha = exports2.alpha = {
"en-US": /^[A-Z]+$/i,
"az-AZ": /^[A-VXYZÇƏĞİıÖŞÜ]+$/i,
"bg-BG": /^[А-Я]+$/i,
"cs-CZ": /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
"da-DK": /^[A-ZÆØÅ]+$/i,
"de-DE": /^[A-ZÄÖÜß]+$/i,
"el-GR": /^[Α-ώ]+$/i,
"es-ES": /^[A-ZÁÉÍÑÓÚÜ]+$/i,
"fa-IR": /^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,
"fi-FI": /^[A-ZÅÄÖ]+$/i,
"fr-FR": /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
"it-IT": /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
"ja-JP": /^[ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
"nb-NO": /^[A-ZÆØÅ]+$/i,
"nl-NL": /^[A-ZÁÉËÏÓÖÜÚ]+$/i,
"nn-NO": /^[A-ZÆØÅ]+$/i,
"hu-HU": /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
"pl-PL": /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
"pt-PT": /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
"ru-RU": /^[А-ЯЁ]+$/i,
"kk-KZ": /^[А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,
"sl-SI": /^[A-ZČĆĐŠŽ]+$/i,
"sk-SK": /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
"sr-RS@latin": /^[A-ZČĆŽŠĐ]+$/i,
"sr-RS": /^[А-ЯЂЈЉЊЋЏ]+$/i,
"sv-SE": /^[A-ZÅÄÖ]+$/i,
"th-TH": /^[ก-๐\s]+$/i,
"tr-TR": /^[A-ZÇĞİıÖŞÜ]+$/i,
"uk-UA": /^[А-ЩЬЮЯЄIЇҐі]+$/i,
"vi-VN": /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
"ko-KR": /^[ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
"ku-IQ": /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[א-ת]+$/,
fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
eo: /^[ABCĈD-GĜHĤIJĴK-PRSŜTUŬVZ]+$/i,
"hi-IN": /^[\u0900-\u0961]+[\u0972-\u097F]*$/i,
"si-LK": /^[\u0D80-\u0DFF]+$/
};
var alphanumeric = exports2.alphanumeric = {
"en-US": /^[0-9A-Z]+$/i,
"az-AZ": /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,
"bg-BG": /^[0-9А-Я]+$/i,
"cs-CZ": /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
"da-DK": /^[0-9A-ZÆØÅ]+$/i,
"de-DE": /^[0-9A-ZÄÖÜß]+$/i,
"el-GR": /^[0-9Α-ω]+$/i,
"es-ES": /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
"fi-FI": /^[0-9A-ZÅÄÖ]+$/i,
"fr-FR": /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
"it-IT": /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
"ja-JP": /^[0-90-9ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
"hu-HU": /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
"nb-NO": /^[0-9A-ZÆØÅ]+$/i,
"nl-NL": /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
"nn-NO": /^[0-9A-ZÆØÅ]+$/i,
"pl-PL": /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
"pt-PT": /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
"ru-RU": /^[0-9А-ЯЁ]+$/i,
"kk-KZ": /^[0-9А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,
"sl-SI": /^[0-9A-ZČĆĐŠŽ]+$/i,
"sk-SK": /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
"sr-RS@latin": /^[0-9A-ZČĆŽŠĐ]+$/i,
"sr-RS": /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
"sv-SE": /^[0-9A-ZÅÄÖ]+$/i,
"th-TH": /^[ก-๙\s]+$/i,
"tr-TR": /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
"uk-UA": /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
"ko-KR": /^[0-9ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
"ku-IQ": /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
"vi-VN": /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[0-9א-ת]+$/,
fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣ০১২৩৪৫৬৭৮৯ৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
eo: /^[0-9ABCĈD-GĜHĤIJĴK-PRSŜTUŬVZ]+$/i,
"hi-IN": /^[\u0900-\u0963]+[\u0966-\u097F]*$/i,
"si-LK": /^[0-9\u0D80-\u0DFF]+$/
};
var decimal = exports2.decimal = {
"en-US": ".",
ar: "\u066B"
};
var englishLocales = exports2.englishLocales = ["AU", "GB", "HK", "IN", "NZ", "ZA", "ZM"];
for (i = 0; i < englishLocales.length; i++) {
locale = "en-".concat(englishLocales[i]);
alpha[locale] = alpha["en-US"];
alphanumeric[locale] = alphanumeric["en-US"];
decimal[locale] = decimal["en-US"];
}
var locale;
var i;
var arabicLocales = exports2.arabicLocales = ["AE", "BH", "DZ", "EG", "IQ", "JO", "KW", "LB", "LY", "MA", "QM", "QA", "SA", "SD", "SY", "TN", "YE"];
for (_i = 0; _i < arabicLocales.length; _i++) {
_locale = "ar-".concat(arabicLocales[_i]);
alpha[_locale] = alpha.ar;
alphanumeric[_locale] = alphanumeric.ar;
decimal[_locale] = decimal.ar;
}
var _locale;
var _i;
var farsiLocales = exports2.farsiLocales = ["IR", "AF"];
for (_i2 = 0; _i2 < farsiLocales.length; _i2++) {
_locale2 = "fa-".concat(farsiLocales[_i2]);
alphanumeric[_locale2] = alphanumeric.fa;
decimal[_locale2] = decimal.ar;
}
var _locale2;
var _i2;
var bengaliLocales = exports2.bengaliLocales = ["BD", "IN"];
for (_i3 = 0; _i3 < bengaliLocales.length; _i3++) {
_locale3 = "bn-".concat(bengaliLocales[_i3]);
alpha[_locale3] = alpha.bn;
alphanumeric[_locale3] = alphanumeric.bn;
decimal[_locale3] = decimal["en-US"];
}
var _locale3;
var _i3;
var dotDecimal = exports2.dotDecimal = ["ar-EG", "ar-LB", "ar-LY"];
var commaDecimal = exports2.commaDecimal = ["bg-BG", "cs-CZ", "da-DK", "de-DE", "el-GR", "en-ZM", "eo", "es-ES", "fr-CA", "fr-FR", "id-ID", "it-IT", "ku-IQ", "hi-IN", "hu-HU", "nb-NO", "nn-NO", "nl-NL", "pl-PL", "pt-PT", "ru-RU", "kk-KZ", "si-LK", "sl-SI", "sr-RS@latin", "sr-RS", "sv-SE", "tr-TR", "uk-UA", "vi-VN"];
for (_i4 = 0; _i4 < dotDecimal.length; _i4++) {
decimal[dotDecimal[_i4]] = decimal["en-US"];
}
var _i4;
for (_i5 = 0; _i5 < commaDecimal.length; _i5++) {
decimal[commaDecimal[_i5]] = ",";
}
var _i5;
alpha["fr-CA"] = alpha["fr-FR"];
alphanumeric["fr-CA"] = alphanumeric["fr-FR"];
alpha["pt-BR"] = alpha["pt-PT"];
alphanumeric["pt-BR"] = alphanumeric["pt-PT"];
decimal["pt-BR"] = decimal["pt-PT"];
alpha["pl-Pl"] = alpha["pl-PL"];
alphanumeric["pl-Pl"] = alphanumeric["pl-PL"];
decimal["pl-Pl"] = decimal["pl-PL"];
alpha["fa-AF"] = alpha.fa;
}
});
// node_modules/validator/lib/isFloat.js
var require_isFloat = __commonJS({
"node_modules/validator/lib/isFloat.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isFloat;
exports2.locales = void 0;
var _assertString = _interopRequireDefault(require_assertString());
var _alpha = require_alpha();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function isFloat(str, options) {
(0, _assertString.default)(str);
options = options || {};
var float = new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(options.locale ? _alpha.decimal[options.locale] : ".", "[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"));
if (str === "" || str === "." || str === "," || str === "-" || str === "+") {
return false;
}
var value = parseFloat(str.replace(",", "."));
return float.test(str) && (!options.hasOwnProperty("min") || value >= options.min) && (!options.hasOwnProperty("max") || value <= options.max) && (!options.hasOwnProperty("lt") || value < options.lt) && (!options.hasOwnProperty("gt") || value > options.gt);
}
var locales = exports2.locales = Object.keys(_alpha.decimal);
}
});
// node_modules/validator/lib/toFloat.js
var require_toFloat = __commonJS({
"node_modules/validator/lib/toFloat.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toFloat;
var _isFloat = _interopRequireDefault(require_isFloat());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function toFloat(str) {
if (!(0, _isFloat.default)(str)) return NaN;
return parseFloat(str);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/toInt.js
var require_toInt = __commonJS({
"node_modules/validator/lib/toInt.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toInt;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function toInt(str, radix) {
(0, _assertString.default)(str);
return parseInt(str, radix || 10);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/toBoolean.js
var require_toBoolean = __commonJS({
"node_modules/validator/lib/toBoolean.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toBoolean;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function toBoolean(str, strict) {
(0, _assertString.default)(str);
if (strict) {
return str === "1" || /^true$/i.test(str);
}
return str !== "0" && !/^false$/i.test(str) && str !== "";
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/equals.js
var require_equals = __commonJS({
"node_modules/validator/lib/equals.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = equals;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function equals(str, comparison) {
(0, _assertString.default)(str);
return str === comparison;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/util/toString.js
var require_toString = __commonJS({
"node_modules/validator/lib/util/toString.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toString2;
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
function toString2(input) {
if (_typeof(input) === "object" && input !== null) {
if (typeof input.toString === "function") {
input = input.toString();
} else {
input = "[object Object]";
}
} else if (input === null || typeof input === "undefined" || isNaN(input) && !input.length) {
input = "";
}
return String(input);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/util/merge.js
var require_merge = __commonJS({
"node_modules/validator/lib/util/merge.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = merge;
function merge() {
var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var defaults = arguments.length > 1 ? arguments[1] : void 0;
for (var key in defaults) {
if (typeof obj[key] === "undefined") {
obj[key] = defaults[key];
}
}
return obj;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/contains.js
var require_contains = __commonJS({
"node_modules/validator/lib/contains.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = contains;
var _assertString = _interopRequireDefault(require_assertString());
var _toString = _interopRequireDefault(require_toString());
var _merge = _interopRequireDefault(require_merge());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var defaulContainsOptions = {
ignoreCase: false,
minOccurrences: 1
};
function contains(str, elem, options) {
(0, _assertString.default)(str);
options = (0, _merge.default)(options, defaulContainsOptions);
if (options.ignoreCase) {
return str.toLowerCase().split((0, _toString.default)(elem).toLowerCase()).length > options.minOccurrences;
}
return str.split((0, _toString.default)(elem)).length > options.minOccurrences;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/matches.js
var require_matches = __commonJS({
"node_modules/validator/lib/matches.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = matches;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function matches(str, pattern, modifiers) {
(0, _assertString.default)(str);
if (Object.prototype.toString.call(pattern) !== "[object RegExp]") {
pattern = new RegExp(pattern, modifiers);
}
return !!str.match(pattern);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isByteLength.js
var require_isByteLength = __commonJS({
"node_modules/validator/lib/isByteLength.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isByteLength;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
function isByteLength(str, options) {
(0, _assertString.default)(str);
var min;
var max;
if (_typeof(options) === "object") {
min = options.min || 0;
max = options.max;
} else {
min = arguments[1];
max = arguments[2];
}
var len = encodeURI(str).split(/%..|./).length - 1;
return len >= min && (typeof max === "undefined" || len <= max);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isFQDN.js
var require_isFQDN = __commonJS({
"node_modules/validator/lib/isFQDN.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isFQDN;
var _assertString = _interopRequireDefault(require_assertString());
var _merge = _interopRequireDefault(require_merge());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var default_fqdn_options = {
require_tld: true,
allow_underscores: false,
allow_trailing_dot: false,
allow_numeric_tld: false,
allow_wildcard: false,
ignore_max_length: false
};
function isFQDN(str, options) {
(0, _assertString.default)(str);
options = (0, _merge.default)(options, default_fqdn_options);
if (options.allow_trailing_dot && str[str.length - 1] === ".") {
str = str.substring(0, str.length - 1);
}
if (options.allow_wildcard === true && str.indexOf("*.") === 0) {
str = str.substring(2);
}
var parts = str.split(".");
var tld = parts[parts.length - 1];
if (options.require_tld) {
if (parts.length < 2) {
return false;
}
if (!options.allow_numeric_tld && !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
return false;
}
if (/\s/.test(tld)) {
return false;
}
}
if (!options.allow_numeric_tld && /^\d+$/.test(tld)) {
return false;
}
return parts.every(function(part) {
if (part.length > 63 && !options.ignore_max_length) {
return false;
}
if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) {
return false;
}
if (/[\uff01-\uff5e]/.test(part)) {
return false;
}
if (/^-|-$/.test(part)) {
return false;
}
if (!options.allow_underscores && /_/.test(part)) {
return false;
}
return true;
});
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isIP.js
var require_isIP = __commonJS({
"node_modules/validator/lib/isIP.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isIP;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var IPv4SegmentFormat = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])";
var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat);
var IPv4AddressRegExp = new RegExp("^".concat(IPv4AddressFormat, "$"));
var IPv6SegmentFormat = "(?:[0-9a-fA-F]{1,4})";
var IPv6AddressRegExp = new RegExp("^(" + "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){5}(?::").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,2}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){4}(?:(:").concat(IPv6SegmentFormat, "){0,1}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,3}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){3}(?:(:").concat(IPv6SegmentFormat, "){0,2}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,4}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){2}(?:(:").concat(IPv6SegmentFormat, "){0,3}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,5}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") + "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") + ")(%[0-9a-zA-Z-.:]{1,})?$");
function isIP(str) {
var version4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
(0, _assertString.default)(str);
version4 = String(version4);
if (!version4) {
return isIP(str, 4) || isIP(str, 6);
}
if (version4 === "4") {
return IPv4AddressRegExp.test(str);
}
if (version4 === "6") {
return IPv6AddressRegExp.test(str);
}
return false;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isEmail.js
var require_isEmail = __commonJS({
"node_modules/validator/lib/isEmail.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isEmail;
var _assertString = _interopRequireDefault(require_assertString());
var _isByteLength = _interopRequireDefault(require_isByteLength());
var _isFQDN = _interopRequireDefault(require_isFQDN());
var _isIP = _interopRequireDefault(require_isIP());
var _merge = _interopRequireDefault(require_merge());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var default_email_options =