storybook
Version:
Storybook: Develop, document, and test UI components in isolation
1,338 lines (1,327 loc) • 204 kB
JavaScript
"use strict";
var ka = Object.create;
var ze = Object.defineProperty;
var Ta = Object.getOwnPropertyDescriptor;
var Ia = Object.getOwnPropertyNames;
var Sa = Object.getPrototypeOf, Ca = Object.prototype.hasOwnProperty;
var o = (t, e) => ze(t, "name", { value: e, configurable: !0 });
var jn = (t, e) => () => (t && (e = t(t = 0)), e);
var S = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports), Pa = (t, e) => {
for (var r in e)
ze(t, r, { get: e[r], enumerable: !0 });
}, An = (t, e, r, n) => {
if (e && typeof e == "object" || typeof e == "function")
for (let s of Ia(e))
!Ca.call(t, s) && s !== r && ze(t, s, { get: () => e[s], enumerable: !(n = Ta(e, s)) || n.enumerable });
return t;
};
var T = (t, e, r) => (r = t != null ? ka(Sa(t)) : {}, An(
// 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 ? ze(r, "default", { value: t, enumerable: !0 }) : r,
t
)), Ea = (t) => An(ze({}, "__esModule", { value: !0 }), t);
// ../node_modules/picocolors/picocolors.js
var Nn = S((El, lr) => {
var vt = process || {}, On = vt.argv || [], xt = vt.env || {}, ja = !(xt.NO_COLOR || On.includes("--no-color")) && (!!xt.FORCE_COLOR || On.
includes("--color") || vt.platform === "win32" || (vt.stdout || {}).isTTY && xt.TERM !== "dumb" || !!xt.CI), Aa = /* @__PURE__ */ o((t, e, r = t) => (n) => {
let s = "" + n, i = s.indexOf(e, t.length);
return ~i ? t + Oa(s, e, r, i) + e : t + s + e;
}, "formatter"), Oa = /* @__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"), Zn = /* @__PURE__ */ o((t = ja) => {
let e = t ? Aa : () => 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");
lr.exports = Zn();
lr.exports.createColors = Zn;
});
// ../node_modules/walk-up-path/dist/cjs/index.js
var $n = S((bt) => {
"use strict";
Object.defineProperty(bt, "__esModule", { value: !0 });
bt.walkUp = void 0;
var Un = require("path"), Za = /* @__PURE__ */ o(function* (t) {
for (t = (0, Un.resolve)(t); t; ) {
yield t;
let e = (0, Un.dirname)(t);
if (e === t)
break;
t = e;
}
}, "walkUp");
bt.walkUp = Za;
});
// ../node_modules/ts-dedent/dist/index.js
var Gn = S((We) => {
"use strict";
Object.defineProperty(We, "__esModule", { value: !0 });
We.dedent = void 0;
function zn(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(zn, "dedent");
We.dedent = zn;
We.default = zn;
});
// ../node_modules/zod/lib/helpers/util.js
var Je = S((P) => {
"use strict";
Object.defineProperty(P, "__esModule", { value: !0 });
P.getParsedType = P.ZodParsedType = P.objectUtil = P.util = void 0;
var yr;
(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;
})(yr || (P.util = yr = {}));
var Wn;
(function(t) {
t.mergeShapes = (e, r) => ({
...e,
...r
// second overwrites first
});
})(Wn || (P.objectUtil = Wn = {}));
P.ZodParsedType = yr.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set"
]);
var Da = /* @__PURE__ */ o((t) => {
switch (typeof t) {
case "undefined":
return P.ZodParsedType.undefined;
case "string":
return P.ZodParsedType.string;
case "number":
return isNaN(t) ? P.ZodParsedType.nan : P.ZodParsedType.number;
case "boolean":
return P.ZodParsedType.boolean;
case "function":
return P.ZodParsedType.function;
case "bigint":
return P.ZodParsedType.bigint;
case "symbol":
return P.ZodParsedType.symbol;
case "object":
return Array.isArray(t) ? P.ZodParsedType.array : t === null ? P.ZodParsedType.null : t.then && typeof t.then == "function" && t.catch &&
typeof t.catch == "function" ? P.ZodParsedType.promise : typeof Map < "u" && t instanceof Map ? P.ZodParsedType.map : typeof Set < "\
u" && t instanceof Set ? P.ZodParsedType.set : typeof Date < "u" && t instanceof Date ? P.ZodParsedType.date : P.ZodParsedType.object;
default:
return P.ZodParsedType.unknown;
}
}, "getParsedType");
P.getParsedType = Da;
});
// ../node_modules/zod/lib/ZodError.js
var kt = S((Q) => {
"use strict";
Object.defineProperty(Q, "__esModule", { value: !0 });
Q.ZodError = Q.quotelessJson = Q.ZodIssueCode = void 0;
var Jn = Je();
Q.ZodIssueCode = Jn.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 La = /* @__PURE__ */ o((t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:"), "quotelessJson");
Q.quotelessJson = La;
var He = 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, Jn.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();
}
};
Q.ZodError = He;
He.create = (t) => new He(t);
});
// ../node_modules/zod/lib/locales/en.js
var xr = S((gr) => {
"use strict";
Object.defineProperty(gr, "__esModule", { value: !0 });
var oe = Je(), O = kt(), Ma = /* @__PURE__ */ o((t, e) => {
let r;
switch (t.code) {
case O.ZodIssueCode.invalid_type:
t.received === oe.ZodParsedType.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
break;
case O.ZodIssueCode.invalid_literal:
r = `Invalid literal value, expected ${JSON.stringify(t.expected, oe.util.jsonStringifyReplacer)}`;
break;
case O.ZodIssueCode.unrecognized_keys:
r = `Unrecognized key(s) in object: ${oe.util.joinValues(t.keys, ", ")}`;
break;
case O.ZodIssueCode.invalid_union:
r = "Invalid input";
break;
case O.ZodIssueCode.invalid_union_discriminator:
r = `Invalid discriminator value. Expected ${oe.util.joinValues(t.options)}`;
break;
case O.ZodIssueCode.invalid_enum_value:
r = `Invalid enum value. Expected ${oe.util.joinValues(t.options)}, received '${t.received}'`;
break;
case O.ZodIssueCode.invalid_arguments:
r = "Invalid function arguments";
break;
case O.ZodIssueCode.invalid_return_type:
r = "Invalid function return type";
break;
case O.ZodIssueCode.invalid_date:
r = "Invalid date";
break;
case O.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}"` : oe.util.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` :
r = "Invalid";
break;
case O.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 O.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 O.ZodIssueCode.custom:
r = "Invalid input";
break;
case O.ZodIssueCode.invalid_intersection_types:
r = "Intersection results could not be merged";
break;
case O.ZodIssueCode.not_multiple_of:
r = `Number must be a multiple of ${t.multipleOf}`;
break;
case O.ZodIssueCode.not_finite:
r = "Number must be finite";
break;
default:
r = e.defaultError, oe.util.assertNever(t);
}
return { message: r };
}, "errorMap");
gr.default = Ma;
});
// ../node_modules/zod/lib/errors.js
var Tt = S((z) => {
"use strict";
var Ua = z && z.__importDefault || function(t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(z, "__esModule", { value: !0 });
z.getErrorMap = z.setErrorMap = z.defaultErrorMap = void 0;
var Hn = Ua(xr());
z.defaultErrorMap = Hn.default;
var Kn = Hn.default;
function $a(t) {
Kn = t;
}
o($a, "setErrorMap");
z.setErrorMap = $a;
function Va() {
return Kn;
}
o(Va, "getErrorMap");
z.getErrorMap = Va;
});
// ../node_modules/zod/lib/helpers/parseUtil.js
var br = S((I) => {
"use strict";
var Fa = I && I.__importDefault || function(t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(I, "__esModule", { value: !0 });
I.isAsync = I.isValid = I.isDirty = I.isAborted = I.OK = I.DIRTY = I.INVALID = I.ParseStatus = I.addIssueToContext = I.EMPTY_PATH = I.makeIssue =
void 0;
var Ba = Tt(), Yn = Fa(xr()), qa = /* @__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");
I.makeIssue = qa;
I.EMPTY_PATH = [];
function za(t, e) {
let r = (0, Ba.getErrorMap)(), n = (0, I.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 === Yn.default ? void 0 : Yn.default
// then global default map
].filter((s) => !!s)
});
t.common.issues.push(n);
}
o(za, "addIssueToContext");
I.addIssueToContext = za;
var vr = 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 I.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 I.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 };
}
};
I.ParseStatus = vr;
I.INVALID = Object.freeze({
status: "aborted"
});
var Ga = /* @__PURE__ */ o((t) => ({ status: "dirty", value: t }), "DIRTY");
I.DIRTY = Ga;
var Wa = /* @__PURE__ */ o((t) => ({ status: "valid", value: t }), "OK");
I.OK = Wa;
var Ja = /* @__PURE__ */ o((t) => t.status === "aborted", "isAborted");
I.isAborted = Ja;
var Ha = /* @__PURE__ */ o((t) => t.status === "dirty", "isDirty");
I.isDirty = Ha;
var Ka = /* @__PURE__ */ o((t) => t.status === "valid", "isValid");
I.isValid = Ka;
var Ya = /* @__PURE__ */ o((t) => typeof Promise < "u" && t instanceof Promise, "isAsync");
I.isAsync = Ya;
});
// ../node_modules/zod/lib/helpers/typeAliases.js
var Qn = S((Xn) => {
"use strict";
Object.defineProperty(Xn, "__esModule", { value: !0 });
});
// ../node_modules/zod/lib/helpers/errorUtil.js
var ts = S((It) => {
"use strict";
Object.defineProperty(It, "__esModule", { value: !0 });
It.errorUtil = void 0;
var es;
(function(t) {
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
})(es || (It.errorUtil = es = {}));
});
// ../node_modules/zod/lib/types.js
var ms = S((d) => {
"use strict";
var Ct = 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);
}, ss = 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;
}, Ke, Ye;
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 St = Tt(), y = ts(), u = br(), h = Je(), m = kt(), M = 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;
}
}, rs = /* @__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 rs(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 rs(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 L.create(this, this._def);
}
nullable() {
return W.create(this, this._def);
}
nullish() {
return this.nullable().optional();
}
array() {
return X.create(this);
}
promise() {
return re.create(this, this._def);
}
or(e) {
return fe.create([this, e], this._def);
}
and(e) {
return me.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 ve({
...v(this._def),
innerType: this,
defaultValue: r,
typeName: g.ZodDefault
});
}
brand() {
return new Xe({
typeName: g.ZodBranded,
type: this,
...v(this._def)
});
}
catch(e) {
let r = typeof e == "function" ? e : () => e;
return new be({
...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 Qe.create(this, e);
}
readonly() {
return _e.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 Xa = /^c[^\s-]{8,}$/i, Qa = /^[0-9a-z]+$/, ec = /^[0-9A-HJKMNP-TV-Z]{26}$/i, tc = /^[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,
rc = /^[a-z0-9_-]{21}$/i, nc = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, sc = /^[-+]?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)?)??$/,
ic = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, oc = "^(\\p{Extended_Pictographic}|\\p{Emoji_Comp\
onent})+$", _r, ac = /^(?:(?: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])$/, cc = /^(?:(?: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])$/,
dc = /^(([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]))$/,
uc = /^(([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])$/,
lc = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, pc = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
is = "((\\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])))", fc = new RegExp(`^${is}$`);
function os(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(os, "timeRegexSource");
function mc(t) {
return new RegExp(`^${os(t)}$`);
}
o(mc, "timeRegex");
function as(t) {
let e = `${is}T${os(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(as, "datetimeRegex");
d.datetimeRegex = as;
function hc(t, e) {
return !!((e === "v4" || !e) && ac.test(t) || (e === "v6" || !e) && dc.test(t));
}
o(hc, "isValidIP");
function yc(t, e) {
if (!nc.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(yc, "isValidJWT");
function gc(t, e) {
return !!((e === "v4" || !e) && cc.test(t) || (e === "v6" || !e) && uc.test(t));
}
o(gc, "isValidCidr");
var ee = 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")
ic.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")
_r || (_r = new RegExp(oc, "u")), _r.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")
tc.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")
rc.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")
Xa.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")
Qa.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")
ec.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" ? as(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" ? fc.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" ? mc(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" ? sc.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" ? hc(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" ? yc(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" ? gc(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" ? lc.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" ? pc.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 = ee;
ee.create = (t) => {
var e;
return new ee({
checks: [],
typeName: g.ZodString,
coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
...v(t)
});
};
function xc(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(xc, "floatSafeRemainder");
var ae = 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_type,
expected: h.ZodParsedType.number,
received: i.parsedType
}), u.INVALID;
}
let n, s = new u.ParseStatus();
for (let i of this._def.checks)
i.kind === "int" ? h.util.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), (0, u.addIssueToContext)(n, {
code: m.ZodIssueCode.invalid_type,
expected: "integer",
received: "float",
message: i.message
}), s.dirty()) : i.kind === "min" ? (i.inclusive ? e.