storybook
Version:
Storybook: Develop, document, and test UI components in isolation
1,335 lines (1,324 loc) • 204 kB
JavaScript
import ESM_COMPAT_Module from "node:module";
import { fileURLToPath as ESM_COMPAT_fileURLToPath } from 'node:url';
import { dirname as ESM_COMPAT_dirname } from 'node:path';
const __filename = ESM_COMPAT_fileURLToPath(import.meta.url);
const __dirname = ESM_COMPAT_dirname(__filename);
const require = ESM_COMPAT_Module.createRequire(import.meta.url);
var Lo = Object.create;
var Kt = Object.defineProperty;
var Mo = Object.getOwnPropertyDescriptor;
var Uo = Object.getOwnPropertyNames;
var $o = Object.getPrototypeOf, Vo = Object.prototype.hasOwnProperty;
var o = (t, e) => Kt(t, "name", { value: e, configurable: !0 }), O = /* @__PURE__ */ ((t) => typeof require < "u" ? require : typeof Proxy <
"u" ? new Proxy(t, {
get: (e, r) => (typeof require < "u" ? require : e)[r]
}) : t)(function(t) {
if (typeof require < "u") return require.apply(this, arguments);
throw Error('Dynamic require of "' + t + '" is not supported');
});
var dn = (t, e) => () => (t && (e = t(t = 0)), e);
var I = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
var Fo = (t, e, r, n) => {
if (e && typeof e == "object" || typeof e == "function")
for (let s of Uo(e))
!Vo.call(t, s) && s !== r && Kt(t, s, { get: () => e[s], enumerable: !(n = Mo(e, s)) || n.enumerable });
return t;
};
var H = (t, e, r) => (r = t != null ? Lo($o(t)) : {}, Fo(
// 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.
e || !t || !t.__esModule ? Kt(r, "default", { value: t, enumerable: !0 }) : r,
t
));
// ../node_modules/picocolors/picocolors.js
var pn = I((Fl, Yt) => {
var ot = process || {}, un = ot.argv || [], it = ot.env || {}, Bo = !(it.NO_COLOR || un.includes("--no-color")) && (!!it.FORCE_COLOR || un.
includes("--color") || ot.platform === "win32" || (ot.stdout || {}).isTTY && it.TERM !== "dumb" || !!it.CI), qo = /* @__PURE__ */ o((t, e, r = t) => (n) => {
let s = "" + n, i = s.indexOf(e, t.length);
return ~i ? t + zo(s, e, r, i) + e : t + s + e;
}, "formatter"), zo = /* @__PURE__ */ o((t, e, r, n) => {
let s = "", i = 0;
do
s += t.substring(i, n) + r, i = n + e.length, n = t.indexOf(e, i);
while (~n);
return s + t.substring(i);
}, "replaceClose"), ln = /* @__PURE__ */ o((t = Bo) => {
let e = t ? qo : () => String;
return {
isColorSupported: t,
reset: e("\x1B[0m", "\x1B[0m"),
bold: e("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
dim: e("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
italic: e("\x1B[3m", "\x1B[23m"),
underline: e("\x1B[4m", "\x1B[24m"),
inverse: e("\x1B[7m", "\x1B[27m"),
hidden: e("\x1B[8m", "\x1B[28m"),
strikethrough: e("\x1B[9m", "\x1B[29m"),
black: e("\x1B[30m", "\x1B[39m"),
red: e("\x1B[31m", "\x1B[39m"),
green: e("\x1B[32m", "\x1B[39m"),
yellow: e("\x1B[33m", "\x1B[39m"),
blue: e("\x1B[34m", "\x1B[39m"),
magenta: e("\x1B[35m", "\x1B[39m"),
cyan: e("\x1B[36m", "\x1B[39m"),
white: e("\x1B[37m", "\x1B[39m"),
gray: e("\x1B[90m", "\x1B[39m"),
bgBlack: e("\x1B[40m", "\x1B[49m"),
bgRed: e("\x1B[41m", "\x1B[49m"),
bgGreen: e("\x1B[42m", "\x1B[49m"),
bgYellow: e("\x1B[43m", "\x1B[49m"),
bgBlue: e("\x1B[44m", "\x1B[49m"),
bgMagenta: e("\x1B[45m", "\x1B[49m"),
bgCyan: e("\x1B[46m", "\x1B[49m"),
bgWhite: e("\x1B[47m", "\x1B[49m"),
blackBright: e("\x1B[90m", "\x1B[39m"),
redBright: e("\x1B[91m", "\x1B[39m"),
greenBright: e("\x1B[92m", "\x1B[39m"),
yellowBright: e("\x1B[93m", "\x1B[39m"),
blueBright: e("\x1B[94m", "\x1B[39m"),
magentaBright: e("\x1B[95m", "\x1B[39m"),
cyanBright: e("\x1B[96m", "\x1B[39m"),
whiteBright: e("\x1B[97m", "\x1B[39m"),
bgBlackBright: e("\x1B[100m", "\x1B[49m"),
bgRedBright: e("\x1B[101m", "\x1B[49m"),
bgGreenBright: e("\x1B[102m", "\x1B[49m"),
bgYellowBright: e("\x1B[103m", "\x1B[49m"),
bgBlueBright: e("\x1B[104m", "\x1B[49m"),
bgMagentaBright: e("\x1B[105m", "\x1B[49m"),
bgCyanBright: e("\x1B[106m", "\x1B[49m"),
bgWhiteBright: e("\x1B[107m", "\x1B[49m")
};
}, "createColors");
Yt.exports = ln();
Yt.exports.createColors = ln;
});
// ../node_modules/walk-up-path/dist/cjs/index.js
var _n = I((dt) => {
"use strict";
Object.defineProperty(dt, "__esModule", { value: !0 });
dt.walkUp = void 0;
var bn = O("path"), Wo = /* @__PURE__ */ o(function* (t) {
for (t = (0, bn.resolve)(t); t; ) {
yield t;
let e = (0, bn.dirname)(t);
if (e === t)
break;
t = e;
}
}, "walkUp");
dt.walkUp = Wo;
});
// ../node_modules/ts-dedent/dist/index.js
var In = I((Le) => {
"use strict";
Object.defineProperty(Le, "__esModule", { value: !0 });
Le.dedent = void 0;
function Tn(t) {
for (var e = [], r = 1; r < arguments.length; r++)
e[r - 1] = arguments[r];
var n = Array.from(typeof t == "string" ? [t] : t);
n[n.length - 1] = n[n.length - 1].replace(/\r?\n([\t ]*)$/, "");
var s = n.reduce(function(c, p) {
var l = p.match(/\n([\t ]+|(?!\s).)/g);
return l ? c.concat(l.map(function(f) {
var x, w;
return (w = (x = f.match(/[\t ]/g)) === null || x === void 0 ? void 0 : x.length) !== null && w !== void 0 ? w : 0;
})) : c;
}, []);
if (s.length) {
var i = new RegExp(`
[ ]{` + Math.min.apply(Math, s) + "}", "g");
n = n.map(function(c) {
return c.replace(i, `
`);
});
}
n[0] = n[0].replace(/^\r?\n/, "");
var a = n[0];
return e.forEach(function(c, p) {
var l = a.match(/(?:^|\n)( *)$/), f = l ? l[1] : "", x = c;
typeof c == "string" && c.includes(`
`) && (x = String(c).split(`
`).map(function(w, _) {
return _ === 0 ? w : "" + f + w;
}).join(`
`)), a += x + n[p + 1];
}), a;
}
o(Tn, "dedent");
Le.dedent = Tn;
Le.default = Tn;
});
// ../node_modules/zod/lib/helpers/util.js
var Me = I((C) => {
"use strict";
Object.defineProperty(C, "__esModule", { value: !0 });
C.getParsedType = C.ZodParsedType = C.objectUtil = C.util = void 0;
var Qt;
(function(t) {
t.assertEqual = (s) => s;
function e(s) {
}
o(e, "assertIs"), t.assertIs = e;
function r(s) {
throw new Error();
}
o(r, "assertNever"), t.assertNever = r, t.arrayToEnum = (s) => {
let i = {};
for (let a of s)
i[a] = a;
return i;
}, t.getValidEnumValues = (s) => {
let i = t.objectKeys(s).filter((c) => typeof s[s[c]] != "number"), a = {};
for (let c of i)
a[c] = s[c];
return t.objectValues(a);
}, t.objectValues = (s) => t.objectKeys(s).map(function(i) {
return s[i];
}), t.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
let i = [];
for (let a in s)
Object.prototype.hasOwnProperty.call(s, a) && i.push(a);
return i;
}, t.find = (s, i) => {
for (let a of s)
if (i(a))
return a;
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.
floor(s) === s;
function n(s, i = " | ") {
return s.map((a) => typeof a == "string" ? `'${a}'` : a).join(i);
}
o(n, "joinValues"), t.joinValues = n, t.jsonStringifyReplacer = (s, i) => typeof i == "bigint" ? i.toString() : i;
})(Qt || (C.util = Qt = {}));
var Sn;
(function(t) {
t.mergeShapes = (e, r) => ({
...e,
...r
// second overwrites first
});
})(Sn || (C.objectUtil = Sn = {}));
C.ZodParsedType = Qt.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set"
]);
var Qo = /* @__PURE__ */ o((t) => {
switch (typeof t) {
case "undefined":
return C.ZodParsedType.undefined;
case "string":
return C.ZodParsedType.string;
case "number":
return isNaN(t) ? C.ZodParsedType.nan : C.ZodParsedType.number;
case "boolean":
return C.ZodParsedType.boolean;
case "function":
return C.ZodParsedType.function;
case "bigint":
return C.ZodParsedType.bigint;
case "symbol":
return C.ZodParsedType.symbol;
case "object":
return Array.isArray(t) ? C.ZodParsedType.array : t === null ? C.ZodParsedType.null : t.then && typeof t.then == "function" && t.catch &&
typeof t.catch == "function" ? C.ZodParsedType.promise : typeof Map < "u" && t instanceof Map ? C.ZodParsedType.map : typeof Set < "\
u" && t instanceof Set ? C.ZodParsedType.set : typeof Date < "u" && t instanceof Date ? C.ZodParsedType.date : C.ZodParsedType.object;
default:
return C.ZodParsedType.unknown;
}
}, "getParsedType");
C.getParsedType = Qo;
});
// ../node_modules/zod/lib/ZodError.js
var lt = I((K) => {
"use strict";
Object.defineProperty(K, "__esModule", { value: !0 });
K.ZodError = K.quotelessJson = K.ZodIssueCode = void 0;
var Cn = Me();
K.ZodIssueCode = Cn.util.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite"
]);
var ea = /* @__PURE__ */ o((t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:"), "quotelessJson");
K.quotelessJson = ea;
var Ue = class t extends Error {
static {
o(this, "ZodError");
}
get errors() {
return this.issues;
}
constructor(e) {
super(), this.issues = [], this.addIssue = (n) => {
this.issues = [...this.issues, n];
}, this.addIssues = (n = []) => {
this.issues = [...this.issues, ...n];
};
let r = new.target.prototype;
Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = e;
}
format(e) {
let r = e || function(i) {
return i.message;
}, n = { _errors: [] }, s = /* @__PURE__ */ o((i) => {
for (let a of i.issues)
if (a.code === "invalid_union")
a.unionErrors.map(s);
else if (a.code === "invalid_return_type")
s(a.returnTypeError);
else if (a.code === "invalid_arguments")
s(a.argumentsError);
else if (a.path.length === 0)
n._errors.push(r(a));
else {
let c = n, p = 0;
for (; p < a.path.length; ) {
let l = a.path[p];
p === a.path.length - 1 ? (c[l] = c[l] || { _errors: [] }, c[l]._errors.push(r(a))) : c[l] = c[l] || { _errors: [] }, c = c[l],
p++;
}
}
}, "processError");
return s(this), n;
}
static assert(e) {
if (!(e instanceof t))
throw new Error(`Not a ZodError: ${e}`);
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, Cn.util.jsonStringifyReplacer, 2);
}
get isEmpty() {
return this.issues.length === 0;
}
flatten(e = (r) => r.message) {
let r = {}, n = [];
for (let s of this.issues)
s.path.length > 0 ? (r[s.path[0]] = r[s.path[0]] || [], r[s.path[0]].push(e(s))) : n.push(e(s));
return { formErrors: n, fieldErrors: r };
}
get formErrors() {
return this.flatten();
}
};
K.ZodError = Ue;
Ue.create = (t) => new Ue(t);
});
// ../node_modules/zod/lib/locales/en.js
var tr = I((er) => {
"use strict";
Object.defineProperty(er, "__esModule", { value: !0 });
var te = Me(), A = lt(), ta = /* @__PURE__ */ o((t, e) => {
let r;
switch (t.code) {
case A.ZodIssueCode.invalid_type:
t.received === te.ZodParsedType.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
break;
case A.ZodIssueCode.invalid_literal:
r = `Invalid literal value, expected ${JSON.stringify(t.expected, te.util.jsonStringifyReplacer)}`;
break;
case A.ZodIssueCode.unrecognized_keys:
r = `Unrecognized key(s) in object: ${te.util.joinValues(t.keys, ", ")}`;
break;
case A.ZodIssueCode.invalid_union:
r = "Invalid input";
break;
case A.ZodIssueCode.invalid_union_discriminator:
r = `Invalid discriminator value. Expected ${te.util.joinValues(t.options)}`;
break;
case A.ZodIssueCode.invalid_enum_value:
r = `Invalid enum value. Expected ${te.util.joinValues(t.options)}, received '${t.received}'`;
break;
case A.ZodIssueCode.invalid_arguments:
r = "Invalid function arguments";
break;
case A.ZodIssueCode.invalid_return_type:
r = "Invalid function return type";
break;
case A.ZodIssueCode.invalid_date:
r = "Invalid date";
break;
case A.ZodIssueCode.invalid_string:
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.
validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "start\
sWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input\
: must end with "${t.validation.endsWith}"` : te.util.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` :
r = "Invalid";
break;
case A.ZodIssueCode.too_small:
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` :
t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` :
t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater tha\
n "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "gre\
ater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
break;
case A.ZodIssueCode.too_big:
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` :
t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` :
t.type === "number" ? r = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` :
t.type === "bigint" ? r = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` :
t.type === "date" ? r = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(
Number(t.maximum))}` : r = "Invalid input";
break;
case A.ZodIssueCode.custom:
r = "Invalid input";
break;
case A.ZodIssueCode.invalid_intersection_types:
r = "Intersection results could not be merged";
break;
case A.ZodIssueCode.not_multiple_of:
r = `Number must be a multiple of ${t.multipleOf}`;
break;
case A.ZodIssueCode.not_finite:
r = "Number must be finite";
break;
default:
r = e.defaultError, te.util.assertNever(t);
}
return { message: r };
}, "errorMap");
er.default = ta;
});
// ../node_modules/zod/lib/errors.js
var pt = I((V) => {
"use strict";
var ra = V && V.__importDefault || function(t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(V, "__esModule", { value: !0 });
V.getErrorMap = V.setErrorMap = V.defaultErrorMap = void 0;
var Pn = ra(tr());
V.defaultErrorMap = Pn.default;
var En = Pn.default;
function na(t) {
En = t;
}
o(na, "setErrorMap");
V.setErrorMap = na;
function sa() {
return En;
}
o(sa, "getErrorMap");
V.getErrorMap = sa;
});
// ../node_modules/zod/lib/helpers/parseUtil.js
var nr = I((T) => {
"use strict";
var ia = T && T.__importDefault || function(t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(T, "__esModule", { value: !0 });
T.isAsync = T.isValid = T.isDirty = T.isAborted = T.OK = T.DIRTY = T.INVALID = T.ParseStatus = T.addIssueToContext = T.EMPTY_PATH = T.makeIssue =
void 0;
var oa = pt(), jn = ia(tr()), aa = /* @__PURE__ */ o((t) => {
let { data: e, path: r, errorMaps: n, issueData: s } = t, i = [...r, ...s.path || []], a = {
...s,
path: i
};
if (s.message !== void 0)
return {
...s,
path: i,
message: s.message
};
let c = "", p = n.filter((l) => !!l).slice().reverse();
for (let l of p)
c = l(a, { data: e, defaultError: c }).message;
return {
...s,
path: i,
message: c
};
}, "makeIssue");
T.makeIssue = aa;
T.EMPTY_PATH = [];
function ca(t, e) {
let r = (0, oa.getErrorMap)(), n = (0, T.makeIssue)({
issueData: e,
data: t.data,
path: t.path,
errorMaps: [
t.common.contextualErrorMap,
// contextual error map is first priority
t.schemaErrorMap,
// then schema-bound map if available
r,
// then global override map
r === jn.default ? void 0 : jn.default
// then global default map
].filter((s) => !!s)
});
t.common.issues.push(n);
}
o(ca, "addIssueToContext");
T.addIssueToContext = ca;
var rr = class t {
static {
o(this, "ParseStatus");
}
constructor() {
this.value = "valid";
}
dirty() {
this.value === "valid" && (this.value = "dirty");
}
abort() {
this.value !== "aborted" && (this.value = "aborted");
}
static mergeArray(e, r) {
let n = [];
for (let s of r) {
if (s.status === "aborted")
return T.INVALID;
s.status === "dirty" && e.dirty(), n.push(s.value);
}
return { status: e.value, value: n };
}
static async mergeObjectAsync(e, r) {
let n = [];
for (let s of r) {
let i = await s.key, a = await s.value;
n.push({
key: i,
value: a
});
}
return t.mergeObjectSync(e, n);
}
static mergeObjectSync(e, r) {
let n = {};
for (let s of r) {
let { key: i, value: a } = s;
if (i.status === "aborted" || a.status === "aborted")
return T.INVALID;
i.status === "dirty" && e.dirty(), a.status === "dirty" && e.dirty(), i.value !== "__proto__" && (typeof a.value < "u" || s.alwaysSet) &&
(n[i.value] = a.value);
}
return { status: e.value, value: n };
}
};
T.ParseStatus = rr;
T.INVALID = Object.freeze({
status: "aborted"
});
var da = /* @__PURE__ */ o((t) => ({ status: "dirty", value: t }), "DIRTY");
T.DIRTY = da;
var ua = /* @__PURE__ */ o((t) => ({ status: "valid", value: t }), "OK");
T.OK = ua;
var la = /* @__PURE__ */ o((t) => t.status === "aborted", "isAborted");
T.isAborted = la;
var pa = /* @__PURE__ */ o((t) => t.status === "dirty", "isDirty");
T.isDirty = pa;
var fa = /* @__PURE__ */ o((t) => t.status === "valid", "isValid");
T.isValid = fa;
var ma = /* @__PURE__ */ o((t) => typeof Promise < "u" && t instanceof Promise, "isAsync");
T.isAsync = ma;
});
// ../node_modules/zod/lib/helpers/typeAliases.js
var On = I((An) => {
"use strict";
Object.defineProperty(An, "__esModule", { value: !0 });
});
// ../node_modules/zod/lib/helpers/errorUtil.js
var Nn = I((ft) => {
"use strict";
Object.defineProperty(ft, "__esModule", { value: !0 });
ft.errorUtil = void 0;
var Zn;
(function(t) {
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
})(Zn || (ft.errorUtil = Zn = {}));
});
// ../node_modules/zod/lib/types.js
var Wn = I((d) => {
"use strict";
var ht = d && d.__classPrivateFieldGet || function(t, e, r, n) {
if (r === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did n\
ot declare it");
return r === "m" ? n : r === "a" ? n.call(t) : n ? n.value : e.get(t);
}, Ln = d && d.__classPrivateFieldSet || function(t, e, r, n, s) {
if (n === "m") throw new TypeError("Private method is not writable");
if (n === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
if (typeof e == "function" ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did no\
t declare it");
return n === "a" ? s.call(t, r) : s ? s.value = r : e.set(t, r), r;
}, $e, Ve;
Object.defineProperty(d, "__esModule", { value: !0 });
d.boolean = d.bigint = d.array = d.any = d.coerce = d.ZodFirstPartyTypeKind = d.late = d.ZodSchema = d.Schema = d.custom = d.ZodReadonly =
d.ZodPipeline = d.ZodBranded = d.BRAND = d.ZodNaN = d.ZodCatch = d.ZodDefault = d.ZodNullable = d.ZodOptional = d.ZodTransformer = d.ZodEffects =
d.ZodPromise = d.ZodNativeEnum = d.ZodEnum = d.ZodLiteral = d.ZodLazy = d.ZodFunction = d.ZodSet = d.ZodMap = d.ZodRecord = d.ZodTuple = d.
ZodIntersection = d.ZodDiscriminatedUnion = d.ZodUnion = d.ZodObject = d.ZodArray = d.ZodVoid = d.ZodNever = d.ZodUnknown = d.ZodAny = d.ZodNull =
d.ZodUndefined = d.ZodSymbol = d.ZodDate = d.ZodBoolean = d.ZodBigInt = d.ZodNumber = d.ZodString = d.datetimeRegex = d.ZodType = void 0;
d.NEVER = d.void = d.unknown = d.union = d.undefined = d.tuple = d.transformer = d.symbol = d.string = d.strictObject = d.set = d.record =
d.promise = d.preprocess = d.pipeline = d.ostring = d.optional = d.onumber = d.oboolean = d.object = d.number = d.nullable = d.null = d.never =
d.nativeEnum = d.nan = d.map = d.literal = d.lazy = d.intersection = d.instanceof = d.function = d.enum = d.effect = d.discriminatedUnion =
d.date = void 0;
var mt = pt(), y = Nn(), u = nr(), h = Me(), m = lt(), L = class {
static {
o(this, "ParseInputLazyPath");
}
constructor(e, r, n, s) {
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
}
get path() {
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.
push(...this._path, this._key)), this._cachedPath;
}
}, Rn = /* @__PURE__ */ o((t, e) => {
if ((0, u.isValid)(e))
return { success: !0, data: e.value };
if (!t.common.issues.length)
throw new Error("Validation failed but no issues detected.");
return {
success: !1,
get error() {
if (this._error)
return this._error;
let r = new m.ZodError(t.common.issues);
return this._error = r, this._error;
}
};
}, "handleResult");
function v(t) {
if (!t)
return {};
let { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
if (e && (r || n))
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
return e ? { errorMap: e, description: s } : { errorMap: /* @__PURE__ */ o((a, c) => {
var p, l;
let { message: f } = t;
return a.code === "invalid_enum_value" ? { message: f ?? c.defaultError } : typeof c.data > "u" ? { message: (p = f ?? n) !== null && p !==
void 0 ? p : c.defaultError } : a.code !== "invalid_type" ? { message: c.defaultError } : { message: (l = f ?? r) !== null && l !== void 0 ?
l : c.defaultError };
}, "customMap"), description: s };
}
o(v, "processCreateParams");
var b = class {
static {
o(this, "ZodType");
}
get description() {
return this._def.description;
}
_getType(e) {
return (0, h.getParsedType)(e.data);
}
_getOrReturnCtx(e, r) {
return r || {
common: e.parent.common,
data: e.data,
parsedType: (0, h.getParsedType)(e.data),
schemaErrorMap: this._def.errorMap,
path: e.path,
parent: e.parent
};
}
_processInputParams(e) {
return {
status: new u.ParseStatus(),
ctx: {
common: e.parent.common,
data: e.data,
parsedType: (0, h.getParsedType)(e.data),
schemaErrorMap: this._def.errorMap,
path: e.path,
parent: e.parent
}
};
}
_parseSync(e) {
let r = this._parse(e);
if ((0, u.isAsync)(r))
throw new Error("Synchronous parse encountered promise.");
return r;
}
_parseAsync(e) {
let r = this._parse(e);
return Promise.resolve(r);
}
parse(e, r) {
let n = this.safeParse(e, r);
if (n.success)
return n.data;
throw n.error;
}
safeParse(e, r) {
var n;
let s = {
common: {
issues: [],
async: (n = r?.async) !== null && n !== void 0 ? n : !1,
contextualErrorMap: r?.errorMap
},
path: r?.path || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: (0, h.getParsedType)(e)
}, i = this._parseSync({ data: e, path: s.path, parent: s });
return Rn(s, i);
}
"~validate"(e) {
var r, n;
let s = {
common: {
issues: [],
async: !!this["~standard"].async
},
path: [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: (0, h.getParsedType)(e)
};
if (!this["~standard"].async)
try {
let i = this._parseSync({ data: e, path: [], parent: s });
return (0, u.isValid)(i) ? {
value: i.value
} : {
issues: s.common.issues
};
} catch (i) {
!((n = (r = i?.message) === null || r === void 0 ? void 0 : r.toLowerCase()) === null || n === void 0) && n.includes("encountered") &&
(this["~standard"].async = !0), s.common = {
issues: [],
async: !0
};
}
return this._parseAsync({ data: e, path: [], parent: s }).then((i) => (0, u.isValid)(i) ? {
value: i.value
} : {
issues: s.common.issues
});
}
async parseAsync(e, r) {
let n = await this.safeParseAsync(e, r);
if (n.success)
return n.data;
throw n.error;
}
async safeParseAsync(e, r) {
let n = {
common: {
issues: [],
contextualErrorMap: r?.errorMap,
async: !0
},
path: r?.path || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: (0, h.getParsedType)(e)
}, s = this._parse({ data: e, path: n.path, parent: n }), i = await ((0, u.isAsync)(s) ? s : Promise.resolve(s));
return Rn(n, i);
}
refine(e, r) {
let n = /* @__PURE__ */ o((s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r, "getIssu\
eProperties");
return this._refinement((s, i) => {
let a = e(s), c = /* @__PURE__ */ o(() => i.addIssue({
code: m.ZodIssueCode.custom,
...n(s)
}), "setError");
return typeof Promise < "u" && a instanceof Promise ? a.then((p) => p ? !0 : (c(), !1)) : a ? !0 : (c(), !1);
});
}
refinement(e, r) {
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
}
_refinement(e) {
return new R({
schema: this,
typeName: g.ZodEffects,
effect: { type: "refinement", refinement: e }
});
}
superRefine(e) {
return this._refinement(e);
}
constructor(e) {
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync =
this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.
bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.
bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.
promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(
this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe =
this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.
bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
version: 1,
vendor: "zod",
validate: /* @__PURE__ */ o((r) => this["~validate"](r), "validate")
};
}
optional() {
return D.create(this, this._def);
}
nullable() {
return B.create(this, this._def);
}
nullish() {
return this.nullable().optional();
}
array() {
return J.create(this);
}
promise() {
return Q.create(this, this._def);
}
or(e) {
return ce.create([this, e], this._def);
}
and(e) {
return de.create(this, e, this._def);
}
transform(e) {
return new R({
...v(this._def),
schema: this,
typeName: g.ZodEffects,
effect: { type: "transform", transform: e }
});
}
default(e) {
let r = typeof e == "function" ? e : () => e;
return new me({
...v(this._def),
innerType: this,
defaultValue: r,
typeName: g.ZodDefault
});
}
brand() {
return new Fe({
typeName: g.ZodBranded,
type: this,
...v(this._def)
});
}
catch(e) {
let r = typeof e == "function" ? e : () => e;
return new he({
...v(this._def),
innerType: this,
catchValue: r,
typeName: g.ZodCatch
});
}
describe(e) {
let r = this.constructor;
return new r({
...this._def,
description: e
});
}
pipe(e) {
return Be.create(this, e);
}
readonly() {
return ye.create(this);
}
isOptional() {
return this.safeParse(void 0).success;
}
isNullable() {
return this.safeParse(null).success;
}
};
d.ZodType = b;
d.Schema = b;
d.ZodSchema = b;
var ha = /^c[^\s-]{8,}$/i, ya = /^[0-9a-z]+$/, ga = /^[0-9A-HJKMNP-TV-Z]{26}$/i, xa = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,
va = /^[a-z0-9_-]{21}$/i, ba = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, _a = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,
wa = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ka = "^(\\p{Extended_Pictographic}|\\p{Emoji_Comp\
onent})+$", sr, Ta = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Ia = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
Sa = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,
Ca = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
Pa = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ea = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
Mn = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469\
]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ja = new RegExp(`^${Mn}$`);
function Un(t) {
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
}
o(Un, "timeRegexSource");
function Aa(t) {
return new RegExp(`^${Un(t)}$`);
}
o(Aa, "timeRegex");
function $n(t) {
let e = `${Mn}T${Un(t)}`, r = [];
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
}
o($n, "datetimeRegex");
d.datetimeRegex = $n;
function Oa(t, e) {
return !!((e === "v4" || !e) && Ta.test(t) || (e === "v6" || !e) && Sa.test(t));
}
o(Oa, "isValidIP");
function Za(t, e) {
if (!ba.test(t))
return !1;
try {
let [r] = t.split("."), n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(
n));
return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
} catch {
return !1;
}
}
o(Za, "isValidJWT");
function Na(t, e) {
return !!((e === "v4" || !e) && Ia.test(t) || (e === "v6" || !e) && Ca.test(t));
}
o(Na, "isValidCidr");
var Y = class t extends b {
static {
o(this, "ZodString");
}
_parse(e) {
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.ZodParsedType.string) {
let i = this._getOrReturnCtx(e);
return (0, u.addIssueToContext)(i, {
code: m.ZodIssueCode.invalid_type,
expected: h.ZodParsedType.string,
received: i.parsedType
}), u.INVALID;
}
let n = new u.ParseStatus(), s;
for (let i of this._def.checks)
if (i.kind === "min")
e.data.length < i.value && (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.too_small,
minimum: i.value,
type: "string",
inclusive: !0,
exact: !1,
message: i.message
}), n.dirty());
else if (i.kind === "max")
e.data.length > i.value && (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.too_big,
maximum: i.value,
type: "string",
inclusive: !0,
exact: !1,
message: i.message
}), n.dirty());
else if (i.kind === "length") {
let a = e.data.length > i.value, c = e.data.length < i.value;
(a || c) && (s = this._getOrReturnCtx(e, s), a ? (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.too_big,
maximum: i.value,
type: "string",
inclusive: !0,
exact: !0,
message: i.message
}) : c && (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.too_small,
minimum: i.value,
type: "string",
inclusive: !0,
exact: !0,
message: i.message
}), n.dirty());
} else if (i.kind === "email")
wa.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "email",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty());
else if (i.kind === "emoji")
sr || (sr = new RegExp(ka, "u")), sr.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "emoji",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty());
else if (i.kind === "uuid")
xa.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "uuid",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty());
else if (i.kind === "nanoid")
va.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "nanoid",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty());
else if (i.kind === "cuid")
ha.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "cuid",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty());
else if (i.kind === "cuid2")
ya.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "cuid2",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty());
else if (i.kind === "ulid")
ga.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "ulid",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty());
else if (i.kind === "url")
try {
new URL(e.data);
} catch {
s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "url",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty();
}
else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(
s, {
validation: "regex",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (s = this.
_getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: { includes: i.value, position: i.position },
message: i.message
}), n.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() :
i.kind === "startsWith" ? e.data.startsWith(i.value) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: { startsWith: i.value },
message: i.message
}), n.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: { endsWith: i.value },
message: i.message
}), n.dirty()) : i.kind === "datetime" ? $n(i).test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: "datetime",
message: i.message
}), n.dirty()) : i.kind === "date" ? ja.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: "date",
message: i.message
}), n.dirty()) : i.kind === "time" ? Aa(i).test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: "time",
message: i.message
}), n.dirty()) : i.kind === "duration" ? _a.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "duration",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty()) : i.kind === "ip" ? Oa(e.data, i.version) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "ip",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty()) : i.kind === "jwt" ? Za(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "jwt",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty()) : i.kind === "cidr" ? Na(e.data, i.version) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "cidr",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty()) : i.kind === "base64" ? Pa.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "base64",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty()) : i.kind === "base64url" ? Ea.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "base64url",
code: m.ZodIssueCode.invalid_string,
message: i.message
}), n.dirty()) : h.util.assertNever(i);
return { status: n.value, value: e.data };
}
_regex(e, r, n) {
return this.refinement((s) => e.test(s), {
validation: r,
code: m.ZodIssueCode.invalid_string,
...y.errorUtil.errToObj(n)
});
}
_addCheck(e) {
return new t({
...this._def,
checks: [...this._def.checks, e]
});
}
email(e) {
return this._addCheck({ kind: "email", ...y.errorUtil.errToObj(e) });
}
url(e) {
return this._addCheck({ kind: "url", ...y.errorUtil.errToObj(e) });
}
emoji(e) {
return this._addCheck({ kind: "emoji", ...y.errorUtil.errToObj(e) });
}
uuid(e) {
return this._addCheck({ kind: "uuid", ...y.errorUtil.errToObj(e) });
}
nanoid(e) {
return this._addCheck({ kind: "nanoid", ...y.errorUtil.errToObj(e) });
}
cuid(e) {
return this._addCheck({ kind: "cuid", ...y.errorUtil.errToObj(e) });
}
cuid2(e) {
return this._addCheck({ kind: "cuid2", ...y.errorUtil.errToObj(e) });
}
ulid(e) {
return this._addCheck({ kind: "ulid", ...y.errorUtil.errToObj(e) });
}
base64(e) {
return this._addCheck({ kind: "base64", ...y.errorUtil.errToObj(e) });
}
base64url(e) {
return this._addCheck({
kind: "base64url",
...y.errorUtil.errToObj(e)
});
}
jwt(e) {
return this._addCheck({ kind: "jwt", ...y.errorUtil.errToObj(e) });
}
ip(e) {
return this._addCheck({ kind: "ip", ...y.errorUtil.errToObj(e) });
}
cidr(e) {
return this._addCheck({ kind: "cidr", ...y.errorUtil.errToObj(e) });
}
datetime(e) {
var r, n;
return typeof e == "string" ? this._addCheck({
kind: "datetime",
precision: null,
offset: !1,
local: !1,
message: e
}) : this._addCheck({
kind: "datetime",
precision: typeof e?.precision > "u" ? null : e?.precision,
offset: (r = e?.offset) !== null && r !== void 0 ? r : !1,
local: (n = e?.local) !== null && n !== void 0 ? n : !1,
...y.errorUtil.errToObj(e?.message)
});
}
date(e) {
return this._addCheck({ kind: "date", message: e });
}
time(e) {
return typeof e == "string" ? this._addCheck({
kind: "time",
precision: null,
message: e
}) : this._addCheck({
kind: "time",
precision: typeof e?.precision > "u" ? null : e?.precision,
...y.errorUtil.errToObj(e?.message)
});
}
duration(e) {
return this._addCheck({ kind: "duration", ...y.errorUtil.errToObj(e) });
}
regex(e, r) {
return this._addCheck({
kind: "regex",
regex: e,
...y.errorUtil.errToObj(r)
});
}
includes(e, r) {
return this._addCheck({
kind: "includes",
value: e,
position: r?.position,
...y.errorUtil.errToObj(r?.message)
});
}
startsWith(e, r) {
return this._addCheck({
kind: "startsWith",
value: e,
...y.errorUtil.errToObj(r)
});
}
endsWith(e, r) {
return this._addCheck({
kind: "endsWith",
value: e,
...y.errorUtil.errToObj(r)
});
}
min(e, r) {
return this._addCheck({
kind: "min",
value: e,
...y.errorUtil.errToObj(r)
});
}
max(e, r) {
return this._addCheck({
kind: "max",
value: e,
...y.errorUtil.errToObj(r)
});
}
length(e, r) {
return this._addCheck({
kind: "length",
value: e,
...y.errorUtil.errToObj(r)
});
}
/**
* Equivalent to `.min(1)`
*/
nonempty(e) {
return this.min(1, y.errorUtil.errToObj(e));
}
trim() {
return new t({
...this._def,
checks: [...this._def.checks, { kind: "trim" }]
});
}
toLowerCase() {
return new t({
...this._def,
checks: [...this._def.checks, { kind: "toLowerCase" }]
});
}
toUpperCase() {
return new t({
...this._def,
checks: [...this._def.checks, { kind: "toUpperCase" }]
});
}
get isDatetime() {
return !!this._def.checks.find((e) => e.kind === "datetime");
}
get isDate() {
return !!this._def.checks.find((e) => e.kind === "date");
}
get isTime() {
return !!this._def.checks.find((e) => e.kind === "time");
}
get isDuration() {
return !!this._def.checks.find((e) => e.kind === "duration");
}
get isEmail() {
return !!this._def.checks.find((e) => e.kind === "email");
}
get isURL() {
return !!this._def.checks.find((e) => e.kind === "url");
}
get isEmoji() {
return !!this._def.checks.find((e) => e.kind === "emoji");
}
get isUUID() {
return !!this._def.checks.find((e) => e.kind === "uuid");
}
get isNANOID() {
return !!this._def.checks.find((e) => e.kind === "nanoid");
}
get isCUID() {
return !!this._def.checks.find((e) => e.kind === "cuid");
}
get isCUID2() {
return !!this._def.checks.find((e) => e.kind === "cuid2");
}
get isULID() {
return !!this._def.checks.find((e) => e.kind === "ulid");
}
get isIP() {
return !!this._def.checks.find((e) => e.kind === "ip");
}
get isCIDR() {
return !!this._def.checks.find((e) => e.kind === "cidr");
}
get isBase64() {
return !!this._def.checks.find((e) => e.kind === "base64");
}
get isBase64url() {
return !!this._def.checks.find((e) => e.kind === "base64url");
}
get minLength() {
let e = null;
for (let r of this._def.checks)
r.kind === "min" && (e === null || r.value > e) && (e = r.value);
return e;
}
get maxLength() {
let e = null;
for (let r of this._def.checks)
r.kind === "max" && (e === null || r.value < e) && (e = r.value);
return e;
}
};
d.ZodString = Y;
Y.create = (t) => {
var e;
return new Y({
checks: [],
typeName: g.ZodString,
coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
...v(t)
});
};
function Ra(t, e) {
let r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, i = parseInt(t.toFixed(
s).replace(".", "")), a = parseInt(e.toFixed(s).replace(".", ""));
return i % a / Math.pow(10, s);
}
o(Ra, "floatSafeRemainder");
var re = class t extends b {
static {
o(this, "ZodNumber");
}
constructor() {
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
}
_parse(e) {
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.ZodParsedType.number) {
let i = this._getOrReturnCtx(e);
return (0, u.addIssueToContext)(i, {
code: m.ZodIssueCode.invalid