Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

4145 lines
124 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 5090ef85429ba5da.685e3e4591.js
* Module id: 832356
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
let t;
e.s([], 180703),
e.i(180703),
((tl = tc || (tc = {})).assertEqual = (e) => {}),
(tl.assertIs = function (e) {}),
(tl.assertNever = function (e) {
throw Error();
}),
(tl.arrayToEnum = (e) => {
let t = {};
for (let n of e) t[n] = n;
return t;
}),
(tl.getValidEnumValues = (e) => {
let t = tl.objectKeys(e).filter((t) => "number" != typeof e[e[t]]),
n = {};
for (let r of t) n[r] = e[r];
return tl.objectValues(n);
}),
(tl.objectValues = (e) =>
tl.objectKeys(e).map(function (t) {
return e[t];
})),
(tl.objectKeys =
"function" == typeof Object.keys
? (e) => Object.keys(e)
: (e) => {
let t = [];
for (let n in e)
Object.prototype.hasOwnProperty.call(e, n) && t.push(n);
return t;
}),
(tl.find = (e, t) => {
for (let n of e) if (t(n)) return n;
}),
(tl.isInteger =
"function" == typeof Number.isInteger
? (e) => Number.isInteger(e)
: (e) =>
"number" == typeof e &&
Number.isFinite(e) &&
Math.floor(e) === e),
(tl.joinValues = function (e, t = " | ") {
return e.map((e) => ("string" == typeof e ? `'${e}'` : e)).join(t);
}),
(tl.jsonStringifyReplacer = (e, t) =>
"bigint" == typeof t ? t.toString() : t),
((tp || (tp = {})).mergeShapes = (e, t) => ({ ...e, ...t }));
let n = tc.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set",
]),
r = (e) => {
switch (typeof e) {
case "undefined":
return n.undefined;
case "string":
return n.string;
case "number":
return Number.isNaN(e) ? n.nan : n.number;
case "boolean":
return n.boolean;
case "function":
return n.function;
case "bigint":
return n.bigint;
case "symbol":
return n.symbol;
case "object":
if (Array.isArray(e)) return n.array;
if (null === e) return n.null;
if (
e.then &&
"function" == typeof e.then &&
e.catch &&
"function" == typeof e.catch
)
return n.promise;
if ("u" > typeof Map && e instanceof Map) return n.map;
if ("u" > typeof Set && e instanceof Set) return n.set;
if ("u" > typeof Date && e instanceof Date) return n.date;
return n.object;
default:
return n.unknown;
}
};
e.s(
[
"ZodParsedType",
0,
n,
"getParsedType",
0,
r,
"objectUtil",
() => tp,
"util",
() => tc,
],
458728,
);
let s = tc.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",
]),
i = (e) => JSON.stringify(e, null, 2).replace(/"([^"]+)":/g, "$1:");
class a extends Error {
get errors() {
return this.issues;
}
constructor(e) {
super(),
(this.issues = []),
(this.addIssue = (e) => {
this.issues = [...this.issues, e];
}),
(this.addIssues = (e = []) => {
this.issues = [...this.issues, ...e];
});
const t = new.target.prototype;
Object.setPrototypeOf
? Object.setPrototypeOf(this, t)
: (this.__proto__ = t),
(this.name = "ZodError"),
(this.issues = e);
}
format(e) {
let t =
e ||
function (e) {
return e.message;
},
n = { _errors: [] },
r = (e) => {
for (let s of e.issues)
if ("invalid_union" === s.code) s.unionErrors.map(r);
else if ("invalid_return_type" === s.code) r(s.returnTypeError);
else if ("invalid_arguments" === s.code) r(s.argumentsError);
else if (0 === s.path.length) n._errors.push(t(s));
else {
let e = n,
r = 0;
for (; r < s.path.length; ) {
let n = s.path[r];
r === s.path.length - 1
? ((e[n] = e[n] || { _errors: [] }),
e[n]._errors.push(t(s)))
: (e[n] = e[n] || { _errors: [] }),
(e = e[n]),
r++;
}
}
};
return r(this), n;
}
static assert(e) {
if (!(e instanceof a)) throw Error(`Not a ZodError: ${e}`);
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, tc.jsonStringifyReplacer, 2);
}
get isEmpty() {
return 0 === this.issues.length;
}
flatten(e = (e) => e.message) {
let t = {},
n = [];
for (let r of this.issues)
if (r.path.length > 0) {
let n = r.path[0];
(t[n] = t[n] || []), t[n].push(e(r));
} else n.push(e(r));
return { formErrors: n, fieldErrors: t };
}
get formErrors() {
return this.flatten();
}
}
(a.create = (e) => new a(e)),
e.s(
["ZodError", () => a, "ZodIssueCode", 0, s, "quotelessJson", 0, i],
562436,
);
let o = (e, t) => {
let r;
switch (e.code) {
case s.invalid_type:
r =
e.received === n.undefined
? "Required"
: `Expected ${e.expected}, received ${e.received}`;
break;
case s.invalid_literal:
r = `Invalid literal value, expected ${JSON.stringify(e.expected, tc.jsonStringifyReplacer)}`;
break;
case s.unrecognized_keys:
r = `Unrecognized key(s) in object: ${tc.joinValues(e.keys, ", ")}`;
break;
case s.invalid_union:
r = "Invalid input";
break;
case s.invalid_union_discriminator:
r = `Invalid discriminator value. Expected ${tc.joinValues(e.options)}`;
break;
case s.invalid_enum_value:
r = `Invalid enum value. Expected ${tc.joinValues(e.options)}, received '${e.received}'`;
break;
case s.invalid_arguments:
r = "Invalid function arguments";
break;
case s.invalid_return_type:
r = "Invalid function return type";
break;
case s.invalid_date:
r = "Invalid date";
break;
case s.invalid_string:
"object" == typeof e.validation
? "includes" in e.validation
? ((r = `Invalid input: must include "${e.validation.includes}"`),
"number" == typeof e.validation.position &&
(r = `${r} at one or more positions greater than or equal to ${e.validation.position}`))
: "startsWith" in e.validation
? (r = `Invalid input: must start with "${e.validation.startsWith}"`)
: "endsWith" in e.validation
? (r = `Invalid input: must end with "${e.validation.endsWith}"`)
: tc.assertNever(e.validation)
: (r =
"regex" !== e.validation
? `Invalid ${e.validation}`
: "Invalid");
break;
case s.too_small:
r =
"array" === e.type
? `Array must contain ${e.exact ? "exactly" : e.inclusive ? "at least" : "more than"} ${e.minimum} element(s)`
: "string" === e.type
? `String must contain ${e.exact ? "exactly" : e.inclusive ? "at least" : "over"} ${e.minimum} character(s)`
: "number" === e.type || "bigint" === e.type
? `Number must be ${e.exact ? "exactly equal to " : e.inclusive ? "greater than or equal to " : "greater than "}${e.minimum}`
: "date" === e.type
? `Date must be ${e.exact ? "exactly equal to " : e.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(e.minimum))}`
: "Invalid input";
break;
case s.too_big:
r =
"array" === e.type
? `Array must contain ${e.exact ? "exactly" : e.inclusive ? "at most" : "less than"} ${e.maximum} element(s)`
: "string" === e.type
? `String must contain ${e.exact ? "exactly" : e.inclusive ? "at most" : "under"} ${e.maximum} character(s)`
: "number" === e.type
? `Number must be ${e.exact ? "exactly" : e.inclusive ? "less than or equal to" : "less than"} ${e.maximum}`
: "bigint" === e.type
? `BigInt must be ${e.exact ? "exactly" : e.inclusive ? "less than or equal to" : "less than"} ${e.maximum}`
: "date" === e.type
? `Date must be ${e.exact ? "exactly" : e.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(e.maximum))}`
: "Invalid input";
break;
case s.custom:
r = "Invalid input";
break;
case s.invalid_intersection_types:
r = "Intersection results could not be merged";
break;
case s.not_multiple_of:
r = `Number must be a multiple of ${e.multipleOf}`;
break;
case s.not_finite:
r = "Number must be finite";
break;
default:
(r = t.defaultError), tc.assertNever(e);
}
return { message: r };
},
l = o;
function u(e) {
l = e;
}
function d() {
return l;
}
e.s(["getErrorMap", () => d, "setErrorMap", () => u], 725827),
e.i(725827),
e.s(
[
"defaultErrorMap",
0,
o,
"getErrorMap",
() => d,
"setErrorMap",
() => u,
],
279407,
),
e.i(279407);
let c = (e) => {
let { data: t, path: n, errorMaps: r, issueData: s } = e,
i = [...n, ...(s.path || [])],
a = { ...s, path: i };
if (void 0 !== s.message) return { ...s, path: i, message: s.message };
let o = "";
for (let e of r
.filter((e) => !!e)
.slice()
.reverse())
o = e(a, { data: t, defaultError: o }).message;
return { ...s, path: i, message: o };
},
p = [];
function h(e, t) {
let n = l,
r = c({
issueData: t,
data: e.data,
path: e.path,
errorMaps: [
e.common.contextualErrorMap,
e.schemaErrorMap,
n,
n === o ? void 0 : o,
].filter((e) => !!e),
});
e.common.issues.push(r);
}
class f {
constructor() {
this.value = "valid";
}
dirty() {
"valid" === this.value && (this.value = "dirty");
}
abort() {
"aborted" !== this.value && (this.value = "aborted");
}
static mergeArray(e, t) {
let n = [];
for (let r of t) {
if ("aborted" === r.status) return g;
"dirty" === r.status && e.dirty(), n.push(r.value);
}
return { status: e.value, value: n };
}
static async mergeObjectAsync(e, t) {
let n = [];
for (let e of t) {
let t = await e.key,
r = await e.value;
n.push({ key: t, value: r });
}
return f.mergeObjectSync(e, n);
}
static mergeObjectSync(e, t) {
let n = {};
for (let r of t) {
let { key: t, value: s } = r;
if ("aborted" === t.status || "aborted" === s.status) return g;
"dirty" === t.status && e.dirty(),
"dirty" === s.status && e.dirty(),
"__proto__" !== t.value &&
(void 0 !== s.value || r.alwaysSet) &&
(n[t.value] = s.value);
}
return { status: e.value, value: n };
}
}
let g = Object.freeze({ status: "aborted" }),
m = (e) => ({ status: "dirty", value: e }),
v = (e) => ({ status: "valid", value: e }),
y = (e) => "aborted" === e.status,
_ = (e) => "dirty" === e.status,
E = (e) => "valid" === e.status,
b = (e) => "u" > typeof Promise && e instanceof Promise;
e.s(
[
"DIRTY",
0,
m,
"EMPTY_PATH",
0,
p,
"INVALID",
0,
g,
"OK",
0,
v,
"ParseStatus",
() => f,
"addIssueToContext",
() => h,
"isAborted",
0,
y,
"isAsync",
0,
b,
"isDirty",
0,
_,
"isValid",
0,
E,
"makeIssue",
0,
c,
],
696555,
),
e.i(696555),
e.s([], 924326),
e.i(924326),
e.i(458728),
((tu = th || (th = {})).errToObj = (e) =>
"string" == typeof e ? { message: e } : e || {}),
(tu.toString = (e) => ("string" == typeof e ? e : e?.message));
class T {
constructor(e, t, n, r) {
(this._cachedPath = []),
(this.parent = e),
(this.data = t),
(this._path = n),
(this._key = r);
}
get path() {
return (
this._cachedPath.length ||
(Array.isArray(this._key)
? this._cachedPath.push(...this._path, ...this._key)
: this._cachedPath.push(...this._path, this._key)),
this._cachedPath
);
}
}
let S = (e, t) => {
if (E(t)) return { success: !0, data: t.value };
if (!e.common.issues.length)
throw Error("Validation failed but no issues detected.");
return {
success: !1,
get error() {
if (this._error) return this._error;
let t = new a(e.common.issues);
return (this._error = t), this._error;
},
};
};
function A(e) {
if (!e) return {};
let {
errorMap: t,
invalid_type_error: n,
required_error: r,
description: s,
} = e;
if (t && (n || r))
throw Error(
'Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.',
);
return t
? { errorMap: t, description: s }
: {
errorMap: (t, s) => {
let { message: i } = e;
return "invalid_enum_value" === t.code
? { message: i ?? s.defaultError }
: void 0 === s.data
? { message: i ?? r ?? s.defaultError }
: "invalid_type" !== t.code
? { message: s.defaultError }
: { message: i ?? n ?? s.defaultError };
},
description: s,
};
}
class N {
get description() {
return this._def.description;
}
_getType(e) {
return r(e.data);
}
_getOrReturnCtx(e, t) {
return (
t || {
common: e.parent.common,
data: e.data,
parsedType: r(e.data),
schemaErrorMap: this._def.errorMap,
path: e.path,
parent: e.parent,
}
);
}
_processInputParams(e) {
return {
status: new f(),
ctx: {
common: e.parent.common,
data: e.data,
parsedType: r(e.data),
schemaErrorMap: this._def.errorMap,
path: e.path,
parent: e.parent,
},
};
}
_parseSync(e) {
let t = this._parse(e);
if (b(t)) throw Error("Synchronous parse encountered promise.");
return t;
}
_parseAsync(e) {
return Promise.resolve(this._parse(e));
}
parse(e, t) {
let n = this.safeParse(e, t);
if (n.success) return n.data;
throw n.error;
}
safeParse(e, t) {
let n = {
common: {
issues: [],
async: t?.async ?? !1,
contextualErrorMap: t?.errorMap,
},
path: t?.path || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: r(e),
},
s = this._parseSync({ data: e, path: n.path, parent: n });
return S(n, s);
}
"~validate"(e) {
let t = {
common: { issues: [], async: !!this["~standard"].async },
path: [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: r(e),
};
if (!this["~standard"].async)
try {
let n = this._parseSync({ data: e, path: [], parent: t });
return E(n) ? { value: n.value } : { issues: t.common.issues };
} catch (e) {
e?.message?.toLowerCase()?.includes("encountered") &&
(this["~standard"].async = !0),
(t.common = { issues: [], async: !0 });
}
return this._parseAsync({ data: e, path: [], parent: t }).then((e) =>
E(e) ? { value: e.value } : { issues: t.common.issues },
);
}
async parseAsync(e, t) {
let n = await this.safeParseAsync(e, t);
if (n.success) return n.data;
throw n.error;
}
async safeParseAsync(e, t) {
let n = {
common: { issues: [], contextualErrorMap: t?.errorMap, async: !0 },
path: t?.path || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: r(e),
},
s = this._parse({ data: e, path: n.path, parent: n });
return S(n, await (b(s) ? s : Promise.resolve(s)));
}
refine(e, t) {
return this._refinement((n, r) => {
let i = e(n),
a = () =>
r.addIssue({
code: s.custom,
...("string" == typeof t || void 0 === t
? { message: t }
: "function" == typeof t
? t(n)
: t),
});
return "u" > typeof Promise && i instanceof Promise
? i.then((e) => !!e || (a(), !1))
: !!i || (a(), !1);
});
}
refinement(e, t) {
return this._refinement(
(n, r) =>
!!e(n) || (r.addIssue("function" == typeof t ? t(n, r) : t), !1),
);
}
_refinement(e) {
return new e_({
schema: this,
typeName: tf.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: (e) => this["~validate"](e),
});
}
optional() {
return eE.create(this, this._def);
}
nullable() {
return eb.create(this, this._def);
}
nullish() {
return this.nullable().optional();
}
array() {
return en.create(this);
}
promise() {
return ey.create(this, this._def);
}
or(e) {
return es.create([this, e], this._def);
}
and(e) {
return eo.create(this, e, this._def);
}
transform(e) {
return new e_({
...A(this._def),
schema: this,
typeName: tf.ZodEffects,
effect: { type: "transform", transform: e },
});
}
default(e) {
return new eT({
...A(this._def),
innerType: this,
defaultValue: "function" == typeof e ? e : () => e,
typeName: tf.ZodDefault,
});
}
brand() {
return new eI({ typeName: tf.ZodBranded, type: this, ...A(this._def) });
}
catch(e) {
return new eS({
...A(this._def),
innerType: this,
catchValue: "function" == typeof e ? e : () => e,
typeName: tf.ZodCatch,
});
}
describe(e) {
return new this.constructor({ ...this._def, description: e });
}
pipe(e) {
return ew.create(this, e);
}
readonly() {
return eO.create(this);
}
isOptional() {
return this.safeParse(void 0).success;
}
isNullable() {
return this.safeParse(null).success;
}
}
let I = /^c[^\s-]{8,}$/i,
w = /^[0-9a-z]+$/,
O = /^[0-9A-HJKMNP-TV-Z]{26}$/i,
C =
/^[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,
R = /^[a-z0-9_-]{21}$/i,
k = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,
x =
/^[-+]?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)?)??$/,
P =
/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,
M =
/^(?:(?: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])$/,
L =
/^(?:(?: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])$/,
D =
/^(([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]))$/,
j =
/^(([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])$/,
Z = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
U =
/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
G =
"((\\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])))",
F = RegExp(`^${G}$`);
function $(e) {
let t = "[0-5]\\d";
e.precision
? (t = `${t}\\.\\d{${e.precision}}`)
: null == e.precision && (t = `${t}(\\.\\d+)?`);
let n = e.precision ? "+" : "?";
return `([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`;
}
function V(e) {
let t = `${G}T${$(e)}`,
n = [];
return (
n.push(e.local ? "Z?" : "Z"),
e.offset && n.push("([+-]\\d{2}:?\\d{2})"),
(t = `${t}(${n.join("|")})`),
RegExp(`^${t}$`)
);
}
class z extends N {
_parse(e) {
var r, i, a, o;
let l;
if (
(this._def.coerce && (e.data = String(e.data)),
this._getType(e) !== n.string)
) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.string,
received: t.parsedType,
}),
g
);
}
let u = new f();
for (let n of this._def.checks)
if ("min" === n.kind)
e.data.length < n.value &&
(h((l = this._getOrReturnCtx(e, l)), {
code: s.too_small,
minimum: n.value,
type: "string",
inclusive: !0,
exact: !1,
message: n.message,
}),
u.dirty());
else if ("max" === n.kind)
e.data.length > n.value &&
(h((l = this._getOrReturnCtx(e, l)), {
code: s.too_big,
maximum: n.value,
type: "string",
inclusive: !0,
exact: !1,
message: n.message,
}),
u.dirty());
else if ("length" === n.kind) {
let t = e.data.length > n.value,
r = e.data.length < n.value;
(t || r) &&
((l = this._getOrReturnCtx(e, l)),
t
? h(l, {
code: s.too_big,
maximum: n.value,
type: "string",
inclusive: !0,
exact: !0,
message: n.message,
})
: r &&
h(l, {
code: s.too_small,
minimum: n.value,
type: "string",
inclusive: !0,
exact: !0,
message: n.message,
}),
u.dirty());
} else if ("email" === n.kind)
P.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "email",
code: s.invalid_string,
message: n.message,
}),
u.dirty());
else if ("emoji" === n.kind)
t ||
(t = RegExp(
"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
"u",
)),
t.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "emoji",
code: s.invalid_string,
message: n.message,
}),
u.dirty());
else if ("uuid" === n.kind)
C.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "uuid",
code: s.invalid_string,
message: n.message,
}),
u.dirty());
else if ("nanoid" === n.kind)
R.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "nanoid",
code: s.invalid_string,
message: n.message,
}),
u.dirty());
else if ("cuid" === n.kind)
I.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "cuid",
code: s.invalid_string,
message: n.message,
}),
u.dirty());
else if ("cuid2" === n.kind)
w.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "cuid2",
code: s.invalid_string,
message: n.message,
}),
u.dirty());
else if ("ulid" === n.kind)
O.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "ulid",
code: s.invalid_string,
message: n.message,
}),
u.dirty());
else if ("url" === n.kind)
try {
new URL(e.data);
} catch {
h((l = this._getOrReturnCtx(e, l)), {
validation: "url",
code: s.invalid_string,
message: n.message,
}),
u.dirty();
}
else
"regex" === n.kind
? ((n.regex.lastIndex = 0),
n.regex.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "regex",
code: s.invalid_string,
message: n.message,
}),
u.dirty()))
: "trim" === n.kind
? (e.data = e.data.trim())
: "includes" === n.kind
? e.data.includes(n.value, n.position) ||
(h((l = this._getOrReturnCtx(e, l)), {
code: s.invalid_string,
validation: { includes: n.value, position: n.position },
message: n.message,
}),
u.dirty())
: "toLowerCase" === n.kind
? (e.data = e.data.toLowerCase())
: "toUpperCase" === n.kind
? (e.data = e.data.toUpperCase())
: "startsWith" === n.kind
? e.data.startsWith(n.value) ||
(h((l = this._getOrReturnCtx(e, l)), {
code: s.invalid_string,
validation: { startsWith: n.value },
message: n.message,
}),
u.dirty())
: "endsWith" === n.kind
? e.data.endsWith(n.value) ||
(h((l = this._getOrReturnCtx(e, l)), {
code: s.invalid_string,
validation: { endsWith: n.value },
message: n.message,
}),
u.dirty())
: "datetime" === n.kind
? V(n).test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
code: s.invalid_string,
validation: "datetime",
message: n.message,
}),
u.dirty())
: "date" === n.kind
? F.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
code: s.invalid_string,
validation: "date",
message: n.message,
}),
u.dirty())
: "time" === n.kind
? RegExp(`^${$(n)}$`).test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
code: s.invalid_string,
validation: "time",
message: n.message,
}),
u.dirty())
: "duration" === n.kind
? x.test(e.data) ||
(h((l = this._getOrReturnCtx(e, l)), {
validation: "duration",
code: s.invalid_string,
message: n.message,
}),
u.dirty())
: "ip" === n.kind
? ((r = e.data),
!(
(("v4" === (i = n.version) || !i) &&
M.test(r)) ||
(("v6" === i || !i) && D.test(r))
) &&
1 &&
(h((l = this._getOrReturnCtx(e, l)), {
validation: "ip",
code: s.invalid_string,
message: n.message,
}),
u.dirty()))
: "jwt" === n.kind
? !(function (e, t) {
if (!k.test(e)) return !1;
try {
let [n] = e.split(".");
if (!n) return !1;
let r = n
.replace(/-/g, "+")
.replace(/_/g, "/")
.padEnd(
n.length +
((4 - (n.length % 4)) % 4),
"=",
),
s = JSON.parse(atob(r));
if (
"object" != typeof s ||
null === s ||
("typ" in s &&
s?.typ !== "JWT") ||
!s.alg ||
(t && s.alg !== t)
)
return !1;
return !0;
} catch {
return !1;
}
})(e.data, n.alg) &&
(h((l = this._getOrReturnCtx(e, l)), {
validation: "jwt",
code: s.invalid_string,
message: n.message,
}),
u.dirty())
: "cidr" === n.kind
? ((a = e.data),
!(
(("v4" === (o = n.version) || !o) &&
L.test(a)) ||
(("v6" === o || !o) && j.test(a))
) &&
1 &&
(h(
(l = this._getOrReturnCtx(e, l)),
{
validation: "cidr",
code: s.invalid_string,
message: n.message,
},
),
u.dirty()))
: "base64" === n.kind
? Z.test(e.data) ||
(h(
(l = this._getOrReturnCtx(e, l)),
{
validation: "base64",
code: s.invalid_string,
message: n.message,
},
),
u.dirty())
: "base64url" === n.kind
? U.test(e.data) ||
(h(
(l = this._getOrReturnCtx(
e,
l,
)),
{
validation: "base64url",
code: s.invalid_string,
message: n.message,
},
),
u.dirty())
: tc.assertNever(n);
return { status: u.value, value: e.data };
}
_regex(e, t, n) {
return this.refinement((t) => e.test(t), {
validation: t,
code: s.invalid_string,
...th.errToObj(n),
});
}
_addCheck(e) {
return new z({ ...this._def, checks: [...this._def.checks, e] });
}
email(e) {
return this._addCheck({ kind: "email", ...th.errToObj(e) });
}
url(e) {
return this._addCheck({ kind: "url", ...th.errToObj(e) });
}
emoji(e) {
return this._addCheck({ kind: "emoji", ...th.errToObj(e) });
}
uuid(e) {
return this._addCheck({ kind: "uuid", ...th.errToObj(e) });
}
nanoid(e) {
return this._addCheck({ kind: "nanoid", ...th.errToObj(e) });
}
cuid(e) {
return this._addCheck({ kind: "cuid", ...th.errToObj(e) });
}
cuid2(e) {
return this._addCheck({ kind: "cuid2", ...th.errToObj(e) });
}
ulid(e) {
return this._addCheck({ kind: "ulid", ...th.errToObj(e) });
}
base64(e) {
return this._addCheck({ kind: "base64", ...th.errToObj(e) });
}
base64url(e) {
return this._addCheck({ kind: "base64url", ...th.errToObj(e) });
}
jwt(e) {
return this._addCheck({ kind: "jwt", ...th.errToObj(e) });
}
ip(e) {
return this._addCheck({ kind: "ip", ...th.errToObj(e) });
}
cidr(e) {
return this._addCheck({ kind: "cidr", ...th.errToObj(e) });
}
datetime(e) {
return "string" == typeof e
? this._addCheck({
kind: "datetime",
precision: null,
offset: !1,
local: !1,
message: e,
})
: this._addCheck({
kind: "datetime",
precision: void 0 === e?.precision ? null : e?.precision,
offset: e?.offset ?? !1,
local: e?.local ?? !1,
...th.errToObj(e?.message),
});
}
date(e) {
return this._addCheck({ kind: "date", message: e });
}
time(e) {
return "string" == typeof e
? this._addCheck({ kind: "time", precision: null, message: e })
: this._addCheck({
kind: "time",
precision: void 0 === e?.precision ? null : e?.precision,
...th.errToObj(e?.message),
});
}
duration(e) {
return this._addCheck({ kind: "duration", ...th.errToObj(e) });
}
regex(e, t) {
return this._addCheck({ kind: "regex", regex: e, ...th.errToObj(t) });
}
includes(e, t) {
return this._addCheck({
kind: "includes",
value: e,
position: t?.position,
...th.errToObj(t?.message),
});
}
startsWith(e, t) {
return this._addCheck({
kind: "startsWith",
value: e,
...th.errToObj(t),
});
}
endsWith(e, t) {
return this._addCheck({
kind: "endsWith",
value: e,
...th.errToObj(t),
});
}
min(e, t) {
return this._addCheck({ kind: "min", value: e, ...th.errToObj(t) });
}
max(e, t) {
return this._addCheck({ kind: "max", value: e, ...th.errToObj(t) });
}
length(e, t) {
return this._addCheck({ kind: "length", value: e, ...th.errToObj(t) });
}
nonempty(e) {
return this.min(1, th.errToObj(e));
}
trim() {
return new z({
...this._def,
checks: [...this._def.checks, { kind: "trim" }],
});
}
toLowerCase() {
return new z({
...this._def,
checks: [...this._def.checks, { kind: "toLowerCase" }],
});
}
toUpperCase() {
return new z({
...this._def,
checks: [...this._def.checks, { kind: "toUpperCase" }],
});
}
get isDatetime() {
return !!this._def.checks.find((e) => "datetime" === e.kind);
}
get isDate() {
return !!this._def.checks.find((e) => "date" === e.kind);
}
get isTime() {
return !!this._def.checks.find((e) => "time" === e.kind);
}
get isDuration() {
return !!this._def.checks.find((e) => "duration" === e.kind);
}
get isEmail() {
return !!this._def.checks.find((e) => "email" === e.kind);
}
get isURL() {
return !!this._def.checks.find((e) => "url" === e.kind);
}
get isEmoji() {
return !!this._def.checks.find((e) => "emoji" === e.kind);
}
get isUUID() {
return !!this._def.checks.find((e) => "uuid" === e.kind);
}
get isNANOID() {
return !!this._def.checks.find((e) => "nanoid" === e.kind);
}
get isCUID() {
return !!this._def.checks.find((e) => "cuid" === e.kind);
}
get isCUID2() {
return !!this._def.checks.find((e) => "cuid2" === e.kind);
}
get isULID() {
return !!this._def.checks.find((e) => "ulid" === e.kind);
}
get isIP() {
return !!this._def.checks.find((e) => "ip" === e.kind);
}
get isCIDR() {
return !!this._def.checks.find((e) => "cidr" === e.kind);
}
get isBase64() {
return !!this._def.checks.find((e) => "base64" === e.kind);
}
get isBase64url() {
return !!this._def.checks.find((e) => "base64url" === e.kind);
}
get minLength() {
let e = null;
for (let t of this._def.checks)
"min" === t.kind && (null === e || t.value > e) && (e = t.value);
return e;
}
get maxLength() {
let e = null;
for (let t of this._def.checks)
"max" === t.kind && (null === e || t.value < e) && (e = t.value);
return e;
}
}
z.create = (e) =>
new z({
checks: [],
typeName: tf.ZodString,
coerce: e?.coerce ?? !1,
...A(e),
});
class H extends N {
constructor() {
super(...arguments),
(this.min = this.gte),
(this.max = this.lte),
(this.step = this.multipleOf);
}
_parse(e) {
let t;
if (
(this._def.coerce && (e.data = Number(e.data)),
this._getType(e) !== n.number)
) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.number,
received: t.parsedType,
}),
g
);
}
let r = new f();
for (let n of this._def.checks)
"int" === n.kind
? tc.isInteger(e.data) ||
(h((t = this._getOrReturnCtx(e, t)), {
code: s.invalid_type,
expected: "integer",
received: "float",
message: n.message,
}),
r.dirty())
: "min" === n.kind
? (n.inclusive ? e.data < n.value : e.data <= n.value) &&
(h((t = this._getOrReturnCtx(e, t)), {
code: s.too_small,
minimum: n.value,
type: "number",
inclusive: n.inclusive,
exact: !1,
message: n.message,
}),
r.dirty())
: "max" === n.kind
? (n.inclusive ? e.data > n.value : e.data >= n.value) &&
(h((t = this._getOrReturnCtx(e, t)), {
code: s.too_big,
maximum: n.value,
type: "number",
inclusive: n.inclusive,
exact: !1,
message: n.message,
}),
r.dirty())
: "multipleOf" === n.kind
? 0 !==
(function (e, t) {
let n = (e.toString().split(".")[1] || "").length,
r = (t.toString().split(".")[1] || "").length,
s = n > r ? n : r;
return (
(Number.parseInt(e.toFixed(s).replace(".", "")) %
Number.parseInt(t.toFixed(s).replace(".", ""))) /
10 ** s
);
})(e.data, n.value) &&
(h((t = this._getOrReturnCtx(e, t)), {
code: s.not_multiple_of,
multipleOf: n.value,
message: n.message,
}),
r.dirty())
: "finite" === n.kind
? Number.isFinite(e.data) ||
(h((t = this._getOrReturnCtx(e, t)), {
code: s.not_finite,
message: n.message,
}),
r.dirty())
: tc.assertNever(n);
return { status: r.value, value: e.data };
}
gte(e, t) {
return this.setLimit("min", e, !0, th.toString(t));
}
gt(e, t) {
return this.setLimit("min", e, !1, th.toString(t));
}
lte(e, t) {
return this.setLimit("max", e, !0, th.toString(t));
}
lt(e, t) {
return this.setLimit("max", e, !1, th.toString(t));
}
setLimit(e, t, n, r) {
return new H({
...this._def,
checks: [
...this._def.checks,
{ kind: e, value: t, inclusive: n, message: th.toString(r) },
],
});
}
_addCheck(e) {
return new H({ ...this._def, checks: [...this._def.checks, e] });
}
int(e) {
return this._addCheck({ kind: "int", message: th.toString(e) });
}
positive(e) {
return this._addCheck({
kind: "min",
value: 0,
inclusive: !1,
message: th.toString(e),
});
}
negative(e) {
return this._addCheck({
kind: "max",
value: 0,
inclusive: !1,
message: th.toString(e),
});
}
nonpositive(e) {
return this._addCheck({
kind: "max",
value: 0,
inclusive: !0,
message: th.toString(e),
});
}
nonnegative(e) {
return this._addCheck({
kind: "min",
value: 0,
inclusive: !0,
message: th.toString(e),
});
}
multipleOf(e, t) {
return this._addCheck({
kind: "multipleOf",
value: e,
message: th.toString(t),
});
}
finite(e) {
return this._addCheck({ kind: "finite", message: th.toString(e) });
}
safe(e) {
return this._addCheck({
kind: "min",
inclusive: !0,
value: Number.MIN_SAFE_INTEGER,
message: th.toString(e),
})._addCheck({
kind: "max",
inclusive: !0,
value: Number.MAX_SAFE_INTEGER,
message: th.toString(e),
});
}
get minValue() {
let e = null;
for (let t of this._def.checks)
"min" === t.kind && (null === e || t.value > e) && (e = t.value);
return e;
}
get maxValue() {
let e = null;
for (let t of this._def.checks)
"max" === t.kind && (null === e || t.value < e) && (e = t.value);
return e;
}
get isInt() {
return !!this._def.checks.find(
(e) =>
"int" === e.kind ||
("multipleOf" === e.kind && tc.isInteger(e.value)),
);
}
get isFinite() {
let e = null,
t = null;
for (let n of this._def.checks)
if (
"finite" === n.kind ||
"int" === n.kind ||
"multipleOf" === n.kind
)
return !0;
else
"min" === n.kind
? (null === t || n.value > t) && (t = n.value)
: "max" === n.kind &&
(null === e || n.value < e) &&
(e = n.value);
return Number.isFinite(t) && Number.isFinite(e);
}
}
H.create = (e) =>
new H({
checks: [],
typeName: tf.ZodNumber,
coerce: e?.coerce || !1,
...A(e),
});
class K extends N {
constructor() {
super(...arguments), (this.min = this.gte), (this.max = this.lte);
}
_parse(e) {
let t;
if (this._def.coerce)
try {
e.data = BigInt(e.data);
} catch {
return this._getInvalidInput(e);
}
if (this._getType(e) !== n.bigint) return this._getInvalidInput(e);
let r = new f();
for (let n of this._def.checks)
"min" === n.kind
? (n.inclusive ? e.data < n.value : e.data <= n.value) &&
(h((t = this._getOrReturnCtx(e, t)), {
code: s.too_small,
type: "bigint",
minimum: n.value,
inclusive: n.inclusive,
message: n.message,
}),
r.dirty())
: "max" === n.kind
? (n.inclusive ? e.data > n.value : e.data >= n.value) &&
(h((t = this._getOrReturnCtx(e, t)), {
code: s.too_big,
type: "bigint",
maximum: n.value,
inclusive: n.inclusive,
message: n.message,
}),
r.dirty())
: "multipleOf" === n.kind
? e.data % n.value !== BigInt(0) &&
(h((t = this._getOrReturnCtx(e, t)), {
code: s.not_multiple_of,
multipleOf: n.value,
message: n.message,
}),
r.dirty())
: tc.assertNever(n);
return { status: r.value, value: e.data };
}
_getInvalidInput(e) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.bigint,
received: t.parsedType,
}),
g
);
}
gte(e, t) {
return this.setLimit("min", e, !0, th.toString(t));
}
gt(e, t) {
return this.setLimit("min", e, !1, th.toString(t));
}
lte(e, t) {
return this.setLimit("max", e, !0, th.toString(t));
}
lt(e, t) {
return this.setLimit("max", e, !1, th.toString(t));
}
setLimit(e, t, n, r) {
return new K({
...this._def,
checks: [
...this._def.checks,
{ kind: e, value: t, inclusive: n, message: th.toString(r) },
],
});
}
_addCheck(e) {
return new K({ ...this._def, checks: [...this._def.checks, e] });
}
positive(e) {
return this._addCheck({
kind: "min",
value: BigInt(0),
inclusive: !1,
message: th.toString(e),
});
}
negative(e) {
return this._addCheck({
kind: "max",
value: BigInt(0),
inclusive: !1,
message: th.toString(e),
});
}
nonpositive(e) {
return this._addCheck({
kind: "max",
value: BigInt(0),
inclusive: !0,
message: th.toString(e),
});
}
nonnegative(e) {
return this._addCheck({
kind: "min",
value: BigInt(0),
inclusive: !0,
message: th.toString(e),
});
}
multipleOf(e, t) {
return this._addCheck({
kind: "multipleOf",
value: e,
message: th.toString(t),
});
}
get minValue() {
let e = null;
for (let t of this._def.checks)
"min" === t.kind && (null === e || t.value > e) && (e = t.value);
return e;
}
get maxValue() {
let e = null;
for (let t of this._def.checks)
"max" === t.kind && (null === e || t.value < e) && (e = t.value);
return e;
}
}
K.create = (e) =>
new K({
checks: [],
typeName: tf.ZodBigInt,
coerce: e?.coerce ?? !1,
...A(e),
});
class B extends N {
_parse(e) {
if (
(this._def.coerce && (e.data = !!e.data),
this._getType(e) !== n.boolean)
) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.boolean,
received: t.parsedType,
}),
g
);
}
return v(e.data);
}
}
B.create = (e) =>
new B({ typeName: tf.ZodBoolean, coerce: e?.coerce || !1, ...A(e) });
class J extends N {
_parse(e) {
let t;
if (
(this._def.coerce && (e.data = new Date(e.data)),
this._getType(e) !== n.date)
) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.date,
received: t.parsedType,
}),
g
);
}
if (Number.isNaN(e.data.getTime()))
return h(this._getOrReturnCtx(e), { code: s.invalid_date }), g;
let r = new f();
for (let n of this._def.checks)
"min" === n.kind
? e.data.getTime() < n.value &&
(h((t = this._getOrReturnCtx(e, t)), {
code: s.too_small,
message: n.message,
inclusive: !0,
exact: !1,
minimum: n.value,
type: "date",
}),
r.dirty())
: "max" === n.kind
? e.data.getTime() > n.value &&
(h((t = this._getOrReturnCtx(e, t)), {
code: s.too_big,
message: n.message,
inclusive: !0,
exact: !1,
maximum: n.value,
type: "date",
}),
r.dirty())
: tc.assertNever(n);
return { status: r.value, value: new Date(e.data.getTime()) };
}
_addCheck(e) {
return new J({ ...this._def, checks: [...this._def.checks, e] });
}
min(e, t) {
return this._addCheck({
kind: "min",
value: e.getTime(),
message: th.toString(t),
});
}
max(e, t) {
return this._addCheck({
kind: "max",
value: e.getTime(),
message: th.toString(t),
});
}
get minDate() {
let e = null;
for (let t of this._def.checks)
"min" === t.kind && (null === e || t.value > e) && (e = t.value);
return null != e ? new Date(e) : null;
}
get maxDate() {
let e = null;
for (let t of this._def.checks)
"max" === t.kind && (null === e || t.value < e) && (e = t.value);
return null != e ? new Date(e) : null;
}
}
J.create = (e) =>
new J({
checks: [],
coerce: e?.coerce || !1,
typeName: tf.ZodDate,
...A(e),
});
class X extends N {
_parse(e) {
if (this._getType(e) !== n.symbol) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.symbol,
received: t.parsedType,
}),
g
);
}
return v(e.data);
}
}
X.create = (e) => new X({ typeName: tf.ZodSymbol, ...A(e) });
class W extends N {
_parse(e) {
if (this._getType(e) !== n.undefined) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.undefined,
received: t.parsedType,
}),
g
);
}
return v(e.data);
}
}
W.create = (e) => new W({ typeName: tf.ZodUndefined, ...A(e) });
class Y extends N {
_parse(e) {
if (this._getType(e) !== n.null) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.null,
received: t.parsedType,
}),
g
);
}
return v(e.data);
}
}
Y.create = (e) => new Y({ typeName: tf.ZodNull, ...A(e) });
class q extends N {
constructor() {
super(...arguments), (this._any = !0);
}
_parse(e) {
return v(e.data);
}
}
q.create = (e) => new q({ typeName: tf.ZodAny, ...A(e) });
class Q extends N {
constructor() {
super(...arguments), (this._unknown = !0);
}
_parse(e) {
return v(e.data);
}
}
Q.create = (e) => new Q({ typeName: tf.ZodUnknown, ...A(e) });
class ee extends N {
_parse(e) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.never,
received: t.parsedType,
}),
g
);
}
}
ee.create = (e) => new ee({ typeName: tf.ZodNever, ...A(e) });
class et extends N {
_parse(e) {
if (this._getType(e) !== n.undefined) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.void,
received: t.parsedType,
}),
g
);
}
return v(e.data);
}
}
et.create = (e) => new et({ typeName: tf.ZodVoid, ...A(e) });
class en extends N {
_parse(e) {
let { ctx: t, status: r } = this._processInputParams(e),
i = this._def;
if (t.parsedType !== n.array)
return (
h(t, {
code: s.invalid_type,
expected: n.array,
received: t.parsedType,
}),
g
);
if (null !== i.exactLength) {
let e = t.data.length > i.exactLength.value,
n = t.data.length < i.exactLength.value;
(e || n) &&
(h(t, {
code: e ? s.too_big : s.too_small,
minimum: n ? i.exactLength.value : void 0,
maximum: e ? i.exactLength.value : void 0,
type: "array",
inclusive: !0,
exact: !0,
message: i.exactLength.message,
}),
r.dirty());
}
if (
(null !== i.minLength &&
t.data.length < i.minLength.value &&
(h(t, {
code: s.too_small,
minimum: i.minLength.value,
type: "array",
inclusive: !0,
exact: !1,
message: i.minLength.message,
}),
r.dirty()),
null !== i.maxLength &&
t.data.length > i.maxLength.value &&
(h(t, {
code: s.too_big,
maximum: i.maxLength.value,
type: "array",
inclusive: !0,
exact: !1,
message: i.maxLength.message,
}),
r.dirty()),
t.common.async)
)
return Promise.all(
[...t.data].map((e, n) =>
i.type._parseAsync(new T(t, e, t.path, n)),
),
).then((e) => f.mergeArray(r, e));
let a = [...t.data].map((e, n) =>
i.type._parseSync(new T(t, e, t.path, n)),
);
return f.mergeArray(r, a);
}
get element() {
return this._def.type;
}
min(e, t) {
return new en({
...this._def,
minLength: { value: e, message: th.toString(t) },
});
}
max(e, t) {
return new en({
...this._def,
maxLength: { value: e, message: th.toString(t) },
});
}
length(e, t) {
return new en({
...this._def,
exactLength: { value: e, message: th.toString(t) },
});
}
nonempty(e) {
return this.min(1, e);
}
}
en.create = (e, t) =>
new en({
type: e,
minLength: null,
maxLength: null,
exactLength: null,
typeName: tf.ZodArray,
...A(t),
});
class er extends N {
constructor() {
super(...arguments),
(this._cached = null),
(this.nonstrict = this.passthrough),
(this.augment = this.extend);
}
_getCached() {
if (null !== this._cached) return this._cached;
let e = this._def.shape(),
t = tc.objectKeys(e);
return (this._cached = { shape: e, keys: t }), this._cached;
}
_parse(e) {
if (this._getType(e) !== n.object) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.object,
received: t.parsedType,
}),
g
);
}
let { status: t, ctx: r } = this._processInputParams(e),
{ shape: i, keys: a } = this._getCached(),
o = [];
if (
!(
this._def.catchall instanceof ee &&
"strip" === this._def.unknownKeys
)
)
for (let e in r.data) a.includes(e) || o.push(e);
let l = [];
for (let e of a) {
let t = i[e],
n = r.data[e];
l.push({
key: { status: "valid", value: e },
value: t._parse(new T(r, n, r.path, e)),
alwaysSet: e in r.data,
});
}
if (this._def.catchall instanceof ee) {
let e = this._def.unknownKeys;
if ("passthrough" === e)
for (let e of o)
l.push({
key: { status: "valid", value: e },
value: { status: "valid", value: r.data[e] },
});
else if ("strict" === e)
o.length > 0 &&
(h(r, { code: s.unrecognized_keys, keys: o }), t.dirty());
else if ("strip" === e);
else
throw Error("Internal ZodObject error: invalid unknownKeys value.");
} else {
let e = this._def.catchall;
for (let t of o) {
let n = r.data[t];
l.push({
key: { status: "valid", value: t },
value: e._parse(new T(r, n, r.path, t)),
alwaysSet: t in r.data,
});
}
}
return r.common.async
? Promise.resolve()
.then(async () => {
let e = [];
for (let t of l) {
let n = await t.key,
r = await t.value;
e.push({ key: n, value: r, alwaysSet: t.alwaysSet });
}
return e;
})
.then((e) => f.mergeObjectSync(t, e))
: f.mergeObjectSync(t, l);
}
get shape() {
return this._def.shape();
}
strict(e) {
return (
th.errToObj,
new er({
...this._def,
unknownKeys: "strict",
...(void 0 !== e
? {
errorMap: (t, n) => {
let r =
this._def.errorMap?.(t, n).message ?? n.defaultError;
return "unrecognized_keys" === t.code
? { message: th.errToObj(e).message ?? r }
: { message: r };
},
}
: {}),
})
);
}
strip() {
return new er({ ...this._def, unknownKeys: "strip" });
}
passthrough() {
return new er({ ...this._def, unknownKeys: "passthrough" });
}
extend(e) {
return new er({
...this._def,
shape: () => ({ ...this._def.shape(), ...e }),
});
}
merge(e) {
return new er({
unknownKeys: e._def.unknownKeys,
catchall: e._def.catchall,
shape: () => ({ ...this._def.shape(), ...e._def.shape() }),
typeName: tf.ZodObject,
});
}
setKey(e, t) {
return this.augment({ [e]: t });
}
catchall(e) {
return new er({ ...this._def, catchall: e });
}
pick(e) {
let t = {};
for (let n of tc.objectKeys(e))
e[n] && this.shape[n] && (t[n] = this.shape[n]);
return new er({ ...this._def, shape: () => t });
}
omit(e) {
let t = {};
for (let n of tc.objectKeys(this.shape)) e[n] || (t[n] = this.shape[n]);
return new er({ ...this._def, shape: () => t });
}
deepPartial() {
return (function e(t) {
if (t instanceof er) {
let n = {};
for (let r in t.shape) {
let s = t.shape[r];
n[r] = eE.create(e(s));
}
return new er({ ...t._def, shape: () => n });
}
if (t instanceof en) return new en({ ...t._def, type: e(t.element) });
if (t instanceof eE) return eE.create(e(t.unwrap()));
if (t instanceof eb) return eb.create(e(t.unwrap()));
if (t instanceof el) return el.create(t.items.map((t) => e(t)));
else return t;
})(this);
}
partial(e) {
let t = {};
for (let n of tc.objectKeys(this.shape)) {
let r = this.shape[n];
e && !e[n] ? (t[n] = r) : (t[n] = r.optional());
}
return new er({ ...this._def, shape: () => t });
}
required(e) {
let t = {};
for (let n of tc.objectKeys(this.shape))
if (e && !e[n]) t[n] = this.shape[n];
else {
let e = this.shape[n];
for (; e instanceof eE; ) e = e._def.innerType;
t[n] = e;
}
return new er({ ...this._def, shape: () => t });
}
keyof() {
return eg(tc.objectKeys(this.shape));
}
}
(er.create = (e, t) =>
new er({
shape: () => e,
unknownKeys: "strip",
catchall: ee.create(),
typeName: tf.ZodObject,
...A(t),
})),
(er.strictCreate = (e, t) =>
new er({
shape: () => e,
unknownKeys: "strict",
catchall: ee.create(),
typeName: tf.ZodObject,
...A(t),
})),
(er.lazycreate = (e, t) =>
new er({
shape: e,
unknownKeys: "strip",
catchall: ee.create(),
typeName: tf.ZodObject,
...A(t),
}));
class es extends N {
_parse(e) {
let { ctx: t } = this._processInputParams(e),
n = this._def.options;
if (t.common.async)
return Promise.all(
n.map(async (e) => {
let n = {
...t,
common: { ...t.common, issues: [] },
parent: null,
};
return {
result: await e._parseAsync({
data: t.data,
path: t.path,
parent: n,
}),
ctx: n,
};
}),
).then(function (e) {
for (let t of e) if ("valid" === t.result.status) return t.result;
for (let n of e)
if ("dirty" === n.result.status)
return t.common.issues.push(...n.ctx.common.issues), n.result;
let n = e.map((e) => new a(e.ctx.common.issues));
return h(t, { code: s.invalid_union, unionErrors: n }), g;
});
{
let e,
r = [];
for (let s of n) {
let n = { ...t, common: { ...t.common, issues: [] }, parent: null },
i = s._parseSync({ data: t.data, path: t.path, parent: n });
if ("valid" === i.status) return i;
"dirty" !== i.status || e || (e = { result: i, ctx: n }),
n.common.issues.length && r.push(n.common.issues);
}
if (e) return t.common.issues.push(...e.ctx.common.issues), e.result;
let i = r.map((e) => new a(e));
return h(t, { code: s.invalid_union, unionErrors: i }), g;
}
}
get options() {
return this._def.options;
}
}
es.create = (e, t) =>
new es({ options: e, typeName: tf.ZodUnion, ...A(t) });
let ei = (e) => {
if (e instanceof eh) return ei(e.schema);
if (e instanceof e_) return ei(e.innerType());
if (e instanceof ef) return [e.value];
if (e instanceof em) return e.options;
if (e instanceof ev) return tc.objectValues(e.enum);
else if (e instanceof eT) return ei(e._def.innerType);
else if (e instanceof W) return [void 0];
else if (e instanceof Y) return [null];
else if (e instanceof eE) return [void 0, ...ei(e.unwrap())];
else if (e instanceof eb) return [null, ...ei(e.unwrap())];
else if (e instanceof eI) return ei(e.unwrap());
else if (e instanceof eO) return ei(e.unwrap());
else if (e instanceof eS) return ei(e._def.innerType);
else return [];
};
class ea extends N {
_parse(e) {
let { ctx: t } = this._processInputParams(e);
if (t.parsedType !== n.object)
return (
h(t, {
code: s.invalid_type,
expected: n.object,
received: t.parsedType,
}),
g
);
let r = this.discriminator,
i = t.data[r],
a = this.optionsMap.get(i);
return a
? t.common.async
? a._parseAsync({ data: t.data, path: t.path, parent: t })
: a._parseSync({ data: t.data, path: t.path, parent: t })
: (h(t, {
code: s.invalid_union_discriminator,
options: Array.from(this.optionsMap.keys()),
path: [r],
}),
g);
}
get discriminator() {
return this._def.discriminator;
}
get options() {
return this._def.options;
}
get optionsMap() {
return this._def.optionsMap;
}
static create(e, t, n) {
let r = new Map();
for (let n of t) {
let t = ei(n.shape[e]);
if (!t.length)
throw Error(
`A discriminator value for key \`${e}\` could not be extracted from all schema options`,
);
for (let s of t) {
if (r.has(s))
throw Error(
`Discriminator property ${String(e)} has duplicate value ${String(s)}`,
);
r.set(s, n);
}
}
return new ea({
typeName: tf.ZodDiscriminatedUnion,
discriminator: e,
options: t,
optionsMap: r,
...A(n),
});
}
}
class eo extends N {
_parse(e) {
let { status: t, ctx: i } = this._processInputParams(e),
a = (e, a) => {
if (y(e) || y(a)) return g;
let o = (function e(t, s) {
let i = r(t),
a = r(s);
if (t === s) return { valid: !0, data: t };
if (i === n.object && a === n.object) {
let n = tc.objectKeys(s),
r = tc.objectKeys(t).filter((e) => -1 !== n.indexOf(e)),
i = { ...t, ...s };
for (let n of r) {
let r = e(t[n], s[n]);
if (!r.valid) return { valid: !1 };
i[n] = r.data;
}
return { valid: !0, data: i };
}
if (i === n.array && a === n.array) {
if (t.length !== s.length) return { valid: !1 };
let n = [];
for (let r = 0; r < t.length; r++) {
let i = e(t[r], s[r]);
if (!i.valid) return { valid: !1 };
n.push(i.data);
}
return { valid: !0, data: n };
}
if (i === n.date && a === n.date && +t == +s)
return { valid: !0, data: t };
return { valid: !1 };
})(e.value, a.value);
return o.valid
? ((_(e) || _(a)) && t.dirty(),
{ status: t.value, value: o.data })
: (h(i, { code: s.invalid_intersection_types }), g);
};
return i.common.async
? Promise.all([
this._def.left._parseAsync({
data: i.data,
path: i.path,
parent: i,
}),
this._def.right._parseAsync({
data: i.data,
path: i.path,
parent: i,
}),
]).then(([e, t]) => a(e, t))
: a(
this._def.left._parseSync({
data: i.data,
path: i.path,
parent: i,
}),
this._def.right._parseSync({
data: i.data,
path: i.path,
parent: i,
}),
);
}
}
eo.create = (e, t, n) =>
new eo({ left: e, right: t, typeName: tf.ZodIntersection, ...A(n) });
class el extends N {
_parse(e) {
let { status: t, ctx: r } = this._processInputParams(e);
if (r.parsedType !== n.array)
return (
h(r, {
code: s.invalid_type,
expected: n.array,
received: r.parsedType,
}),
g
);
if (r.data.length < this._def.items.length)
return (
h(r, {
code: s.too_small,
minimum: this._def.items.length,
inclusive: !0,
exact: !1,
type: "array",
}),
g
);
!this._def.rest &&
r.data.length > this._def.items.length &&
(h(r, {
code: s.too_big,
maximum: this._def.items.length,
inclusive: !0,
exact: !1,
type: "array",
}),
t.dirty());
let i = [...r.data]
.map((e, t) => {
let n = this._def.items[t] || this._def.rest;
return n ? n._parse(new T(r, e, r.path, t)) : null;
})
.filter((e) => !!e);
return r.common.async
? Promise.all(i).then((e) => f.mergeArray(t, e))
: f.mergeArray(t, i);
}
get items() {
return this._def.items;
}
rest(e) {
return new el({ ...this._def, rest: e });
}
}
el.create = (e, t) => {
if (!Array.isArray(e))
throw Error("You must pass an array of schemas to z.tuple([ ... ])");
return new el({ items: e, typeName: tf.ZodTuple, rest: null, ...A(t) });
};
class eu extends N {
get keySchema() {
return this._def.keyType;
}
get valueSchema() {
return this._def.valueType;
}
_parse(e) {
let { status: t, ctx: r } = this._processInputParams(e);
if (r.parsedType !== n.object)
return (
h(r, {
code: s.invalid_type,
expected: n.object,
received: r.parsedType,
}),
g
);
let i = [],
a = this._def.keyType,
o = this._def.valueType;
for (let e in r.data)
i.push({
key: a._parse(new T(r, e, r.path, e)),
value: o._parse(new T(r, r.data[e], r.path, e)),
alwaysSet: e in r.data,
});
return r.common.async
? f.mergeObjectAsync(t, i)
: f.mergeObjectSync(t, i);
}
get element() {
return this._def.valueType;
}
static create(e, t, n) {
return new eu(
t instanceof N
? { keyType: e, valueType: t, typeName: tf.ZodRecord, ...A(n) }
: {
keyType: z.create(),
valueType: e,
typeName: tf.ZodRecord,
...A(t),
},
);
}
}
class ed extends N {
get keySchema() {
return this._def.keyType;
}
get valueSchema() {
return this._def.valueType;
}
_parse(e) {
let { status: t, ctx: r } = this._processInputParams(e);
if (r.parsedType !== n.map)
return (
h(r, {
code: s.invalid_type,
expected: n.map,
received: r.parsedType,
}),
g
);
let i = this._def.keyType,
a = this._def.valueType,
o = [...r.data.entries()].map(([e, t], n) => ({
key: i._parse(new T(r, e, r.path, [n, "key"])),
value: a._parse(new T(r, t, r.path, [n, "value"])),
}));
if (r.common.async) {
let e = new Map();
return Promise.resolve().then(async () => {
for (let n of o) {
let r = await n.key,
s = await n.value;
if ("aborted" === r.status || "aborted" === s.status) return g;
("dirty" === r.status || "dirty" === s.status) && t.dirty(),
e.set(r.value, s.value);
}
return { status: t.value, value: e };
});
}
{
let e = new Map();
for (let n of o) {
let r = n.key,
s = n.value;
if ("aborted" === r.status || "aborted" === s.status) return g;
("dirty" === r.status || "dirty" === s.status) && t.dirty(),
e.set(r.value, s.value);
}
return { status: t.value, value: e };
}
}
}
ed.create = (e, t, n) =>
new ed({ valueType: t, keyType: e, typeName: tf.ZodMap, ...A(n) });
class ec extends N {
_parse(e) {
let { status: t, ctx: r } = this._processInputParams(e);
if (r.parsedType !== n.set)
return (
h(r, {
code: s.invalid_type,
expected: n.set,
received: r.parsedType,
}),
g
);
let i = this._def;
null !== i.minSize &&
r.data.size < i.minSize.value &&
(h(r, {
code: s.too_small,
minimum: i.minSize.value,
type: "set",
inclusive: !0,
exact: !1,
message: i.minSize.message,
}),
t.dirty()),
null !== i.maxSize &&
r.data.size > i.maxSize.value &&
(h(r, {
code: s.too_big,
maximum: i.maxSize.value,
type: "set",
inclusive: !0,
exact: !1,
message: i.maxSize.message,
}),
t.dirty());
let a = this._def.valueType;
function o(e) {
let n = new Set();
for (let r of e) {
if ("aborted" === r.status) return g;
"dirty" === r.status && t.dirty(), n.add(r.value);
}
return { status: t.value, value: n };
}
let l = [...r.data.values()].map((e, t) =>
a._parse(new T(r, e, r.path, t)),
);
return r.common.async ? Promise.all(l).then((e) => o(e)) : o(l);
}
min(e, t) {
return new ec({
...this._def,
minSize: { value: e, message: th.toString(t) },
});
}
max(e, t) {
return new ec({
...this._def,
maxSize: { value: e, message: th.toString(t) },
});
}
size(e, t) {
return this.min(e, t).max(e, t);
}
nonempty(e) {
return this.min(1, e);
}
}
ec.create = (e, t) =>
new ec({
valueType: e,
minSize: null,
maxSize: null,
typeName: tf.ZodSet,
...A(t),
});
class ep extends N {
constructor() {
super(...arguments), (this.validate = this.implement);
}
_parse(e) {
let { ctx: t } = this._processInputParams(e);
if (t.parsedType !== n.function)
return (
h(t, {
code: s.invalid_type,
expected: n.function,
received: t.parsedType,
}),
g
);
function r(e, n) {
return c({
data: e,
path: t.path,
errorMaps: [
t.common.contextualErrorMap,
t.schemaErrorMap,
l,
o,
].filter((e) => !!e),
issueData: { code: s.invalid_arguments, argumentsError: n },
});
}
function i(e, n) {
return c({
data: e,
path: t.path,
errorMaps: [
t.common.contextualErrorMap,
t.schemaErrorMap,
l,
o,
].filter((e) => !!e),
issueData: { code: s.invalid_return_type, returnTypeError: n },
});
}
let u = { errorMap: t.common.contextualErrorMap },
d = t.data;
if (this._def.returns instanceof ey) {
let e = this;
return v(async function (...t) {
let n = new a([]),
s = await e._def.args.parseAsync(t, u).catch((e) => {
throw (n.addIssue(r(t, e)), n);
}),
o = await Reflect.apply(d, this, s);
return await e._def.returns._def.type
.parseAsync(o, u)
.catch((e) => {
throw (n.addIssue(i(o, e)), n);
});
});
}
{
let e = this;
return v(function (...t) {
let n = e._def.args.safeParse(t, u);
if (!n.success) throw new a([r(t, n.error)]);
let s = Reflect.apply(d, this, n.data),
o = e._def.returns.safeParse(s, u);
if (!o.success) throw new a([i(s, o.error)]);
return o.data;
});
}
}
parameters() {
return this._def.args;
}
returnType() {
return this._def.returns;
}
args(...e) {
return new ep({ ...this._def, args: el.create(e).rest(Q.create()) });
}
returns(e) {
return new ep({ ...this._def, returns: e });
}
implement(e) {
return this.parse(e);
}
strictImplement(e) {
return this.parse(e);
}
static create(e, t, n) {
return new ep({
args: e || el.create([]).rest(Q.create()),
returns: t || Q.create(),
typeName: tf.ZodFunction,
...A(n),
});
}
}
class eh extends N {
get schema() {
return this._def.getter();
}
_parse(e) {
let { ctx: t } = this._processInputParams(e);
return this._def
.getter()
._parse({ data: t.data, path: t.path, parent: t });
}
}
eh.create = (e, t) => new eh({ getter: e, typeName: tf.ZodLazy, ...A(t) });
class ef extends N {
_parse(e) {
if (e.data !== this._def.value) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
received: t.data,
code: s.invalid_literal,
expected: this._def.value,
}),
g
);
}
return { status: "valid", value: e.data };
}
get value() {
return this._def.value;
}
}
function eg(e, t) {
return new em({ values: e, typeName: tf.ZodEnum, ...A(t) });
}
ef.create = (e, t) =>
new ef({ value: e, typeName: tf.ZodLiteral, ...A(t) });
class em extends N {
_parse(e) {
if ("string" != typeof e.data) {
let t = this._getOrReturnCtx(e),
n = this._def.values;
return (
h(t, {
expected: tc.joinValues(n),
received: t.parsedType,
code: s.invalid_type,
}),
g
);
}
if (
(this._cache || (this._cache = new Set(this._def.values)),
!this._cache.has(e.data))
) {
let t = this._getOrReturnCtx(e),
n = this._def.values;
return (
h(t, { received: t.data, code: s.invalid_enum_value, options: n }),
g
);
}
return v(e.data);
}
get options() {
return this._def.values;
}
get enum() {
let e = {};
for (let t of this._def.values) e[t] = t;
return e;
}
get Values() {
let e = {};
for (let t of this._def.values) e[t] = t;
return e;
}
get Enum() {
let e = {};
for (let t of this._def.values) e[t] = t;
return e;
}
extract(e, t = this._def) {
return em.create(e, { ...this._def, ...t });
}
exclude(e, t = this._def) {
return em.create(
this.options.filter((t) => !e.includes(t)),
{ ...this._def, ...t },
);
}
}
em.create = eg;
class ev extends N {
_parse(e) {
let t = tc.getValidEnumValues(this._def.values),
r = this._getOrReturnCtx(e);
if (r.parsedType !== n.string && r.parsedType !== n.number) {
let e = tc.objectValues(t);
return (
h(r, {
expected: tc.joinValues(e),
received: r.parsedType,
code: s.invalid_type,
}),
g
);
}
if (
(this._cache ||
(this._cache = new Set(tc.getValidEnumValues(this._def.values))),
!this._cache.has(e.data))
) {
let e = tc.objectValues(t);
return (
h(r, { received: r.data, code: s.invalid_enum_value, options: e }),
g
);
}
return v(e.data);
}
get enum() {
return this._def.values;
}
}
ev.create = (e, t) =>
new ev({ values: e, typeName: tf.ZodNativeEnum, ...A(t) });
class ey extends N {
unwrap() {
return this._def.type;
}
_parse(e) {
let { ctx: t } = this._processInputParams(e);
return t.parsedType !== n.promise && !1 === t.common.async
? (h(t, {
code: s.invalid_type,
expected: n.promise,
received: t.parsedType,
}),
g)
: v(
(t.parsedType === n.promise
? t.data
: Promise.resolve(t.data)
).then((e) =>
this._def.type.parseAsync(e, {
path: t.path,
errorMap: t.common.contextualErrorMap,
}),
),
);
}
}
ey.create = (e, t) => new ey({ type: e, typeName: tf.ZodPromise, ...A(t) });
class e_ extends N {
innerType() {
return this._def.schema;
}
sourceType() {
return this._def.schema._def.typeName === tf.ZodEffects
? this._def.schema.sourceType()
: this._def.schema;
}
_parse(e) {
let { status: t, ctx: n } = this._processInputParams(e),
r = this._def.effect || null,
s = {
addIssue: (e) => {
h(n, e), e.fatal ? t.abort() : t.dirty();
},
get path() {
return n.path;
},
};
if (((s.addIssue = s.addIssue.bind(s)), "preprocess" === r.type)) {
let e = r.transform(n.data, s);
if (n.common.async)
return Promise.resolve(e).then(async (e) => {
if ("aborted" === t.value) return g;
let r = await this._def.schema._parseAsync({
data: e,
path: n.path,
parent: n,
});
return "aborted" === r.status
? g
: "dirty" === r.status || "dirty" === t.value
? m(r.value)
: r;
});
{
if ("aborted" === t.value) return g;
let r = this._def.schema._parseSync({
data: e,
path: n.path,
parent: n,
});
return "aborted" === r.status
? g
: "dirty" === r.status || "dirty" === t.value
? m(r.value)
: r;
}
}
if ("refinement" === r.type) {
let e = (e) => {
let t = r.refinement(e, s);
if (n.common.async) return Promise.resolve(t);
if (t instanceof Promise)
throw Error(
"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.",
);
return e;
};
if (!1 !== n.common.async)
return this._def.schema
._parseAsync({ data: n.data, path: n.path, parent: n })
.then((n) =>
"aborted" === n.status
? g
: ("dirty" === n.status && t.dirty(),
e(n.value).then(() => ({
status: t.value,
value: n.value,
}))),
);
{
let r = this._def.schema._parseSync({
data: n.data,
path: n.path,
parent: n,
});
return "aborted" === r.status
? g
: ("dirty" === r.status && t.dirty(),
e(r.value),
{ status: t.value, value: r.value });
}
}
if ("transform" === r.type)
if (!1 !== n.common.async)
return this._def.schema
._parseAsync({ data: n.data, path: n.path, parent: n })
.then((e) =>
E(e)
? Promise.resolve(r.transform(e.value, s)).then((e) => ({
status: t.value,
value: e,
}))
: g,
);
else {
let e = this._def.schema._parseSync({
data: n.data,
path: n.path,
parent: n,
});
if (!E(e)) return g;
let i = r.transform(e.value, s);
if (i instanceof Promise)
throw Error(
"Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.",
);
return { status: t.value, value: i };
}
tc.assertNever(r);
}
}
(e_.create = (e, t, n) =>
new e_({ schema: e, typeName: tf.ZodEffects, effect: t, ...A(n) })),
(e_.createWithPreprocess = (e, t, n) =>
new e_({
schema: t,
effect: { type: "preprocess", transform: e },
typeName: tf.ZodEffects,
...A(n),
}));
class eE extends N {
_parse(e) {
return this._getType(e) === n.undefined
? v(void 0)
: this._def.innerType._parse(e);
}
unwrap() {
return this._def.innerType;
}
}
eE.create = (e, t) =>
new eE({ innerType: e, typeName: tf.ZodOptional, ...A(t) });
class eb extends N {
_parse(e) {
return this._getType(e) === n.null
? v(null)
: this._def.innerType._parse(e);
}
unwrap() {
return this._def.innerType;
}
}
eb.create = (e, t) =>
new eb({ innerType: e, typeName: tf.ZodNullable, ...A(t) });
class eT extends N {
_parse(e) {
let { ctx: t } = this._processInputParams(e),
r = t.data;
return (
t.parsedType === n.undefined && (r = this._def.defaultValue()),
this._def.innerType._parse({ data: r, path: t.path, parent: t })
);
}
removeDefault() {
return this._def.innerType;
}
}
eT.create = (e, t) =>
new eT({
innerType: e,
typeName: tf.ZodDefault,
defaultValue:
"function" == typeof t.default ? t.default : () => t.default,
...A(t),
});
class eS extends N {
_parse(e) {
let { ctx: t } = this._processInputParams(e),
n = { ...t, common: { ...t.common, issues: [] } },
r = this._def.innerType._parse({
data: n.data,
path: n.path,
parent: { ...n },
});
return b(r)
? r.then((e) => ({
status: "valid",
value:
"valid" === e.status
? e.value
: this._def.catchValue({
get error() {
return new a(n.common.issues);
},
input: n.data,
}),
}))
: {
status: "valid",
value:
"valid" === r.status
? r.value
: this._def.catchValue({
get error() {
return new a(n.common.issues);
},
input: n.data,
}),
};
}
removeCatch() {
return this._def.innerType;
}
}
eS.create = (e, t) =>
new eS({
innerType: e,
typeName: tf.ZodCatch,
catchValue: "function" == typeof t.catch ? t.catch : () => t.catch,
...A(t),
});
class eA extends N {
_parse(e) {
if (this._getType(e) !== n.nan) {
let t = this._getOrReturnCtx(e);
return (
h(t, {
code: s.invalid_type,
expected: n.nan,
received: t.parsedType,
}),
g
);
}
return { status: "valid", value: e.data };
}
}
eA.create = (e) => new eA({ typeName: tf.ZodNaN, ...A(e) });
let eN = Symbol("zod_brand");
class eI extends N {
_parse(e) {
let { ctx: t } = this._processInputParams(e),
n = t.data;
return this._def.type._parse({ data: n, path: t.path, parent: t });
}
unwrap() {
return this._def.type;
}
}
class ew extends N {
_parse(e) {
let { status: t, ctx: n } = this._processInputParams(e);
if (n.common.async)
return (async () => {
let e = await this._def.in._parseAsync({
data: n.data,
path: n.path,
parent: n,
});
return "aborted" === e.status
? g
: "dirty" === e.status
? (t.dirty(), m(e.value))
: this._def.out._parseAsync({
data: e.value,
path: n.path,
parent: n,
});
})();
{
let e = this._def.in._parseSync({
data: n.data,
path: n.path,
parent: n,
});
return "aborted" === e.status
? g
: "dirty" === e.status
? (t.dirty(), { status: "dirty", value: e.value })
: this._def.out._parseSync({
data: e.value,
path: n.path,
parent: n,
});
}
}
static create(e, t) {
return new ew({ in: e, out: t, typeName: tf.ZodPipeline });
}
}
class eO extends N {
_parse(e) {
let t = this._def.innerType._parse(e),
n = (e) => (E(e) && (e.value = Object.freeze(e.value)), e);
return b(t) ? t.then((e) => n(e)) : n(t);
}
unwrap() {
return this._def.innerType;
}
}
function eC(e, t) {
let n =
"function" == typeof e
? e(t)
: "string" == typeof e
? { message: e }
: e;
return "string" == typeof n ? { message: n } : n;
}
function eR(e, t = {}, n) {
return e
? q.create().superRefine((r, s) => {
let i = e(r);
if (i instanceof Promise)
return i.then((e) => {
if (!e) {
let e = eC(t, r),
i = e.fatal ?? n ?? !0;
s.addIssue({ code: "custom", ...e, fatal: i });
}
});
if (!i) {
let e = eC(t, r),
i = e.fatal ?? n ?? !0;
s.addIssue({ code: "custom", ...e, fatal: i });
}
})
: q.create();
}
eO.create = (e, t) =>
new eO({ innerType: e, typeName: tf.ZodReadonly, ...A(t) });
let ek = { object: er.lazycreate };
((td = tf || (tf = {})).ZodString = "ZodString"),
(td.ZodNumber = "ZodNumber"),
(td.ZodNaN = "ZodNaN"),
(td.ZodBigInt = "ZodBigInt"),
(td.ZodBoolean = "ZodBoolean"),
(td.ZodDate = "ZodDate"),
(td.ZodSymbol = "ZodSymbol"),
(td.ZodUndefined = "ZodUndefined"),
(td.ZodNull = "ZodNull"),
(td.ZodAny = "ZodAny"),
(td.ZodUnknown = "ZodUnknown"),
(td.ZodNever = "ZodNever"),
(td.ZodVoid = "ZodVoid"),
(td.ZodArray = "ZodArray"),
(td.ZodObject = "ZodObject"),
(td.ZodUnion = "ZodUnion"),
(td.ZodDiscriminatedUnion = "ZodDiscriminatedUnion"),
(td.ZodIntersection = "ZodIntersection"),
(td.ZodTuple = "ZodTuple"),
(td.ZodRecord = "ZodRecord"),
(td.ZodMap = "ZodMap"),
(td.ZodSet = "ZodSet"),
(td.ZodFunction = "ZodFunction"),
(td.ZodLazy = "ZodLazy"),
(td.ZodLiteral = "ZodLiteral"),
(td.ZodEnum = "ZodEnum"),
(td.ZodEffects = "ZodEffects"),
(td.ZodNativeEnum = "ZodNativeEnum"),
(td.ZodOptional = "ZodOptional"),
(td.ZodNullable = "ZodNullable"),
(td.ZodDefault = "ZodDefault"),
(td.ZodCatch = "ZodCatch"),
(td.ZodPromise = "ZodPromise"),
(td.ZodBranded = "ZodBranded"),
(td.ZodPipeline = "ZodPipeline"),
(td.ZodReadonly = "ZodReadonly");
let ex = (e, t = { message: `Input not instance of ${e.name}` }) =>
eR((t) => t instanceof e, t),
eP = z.create,
eM = H.create,
eL = eA.create,
eD = K.create,
ej = B.create,
eZ = J.create,
eU = X.create,
eG = W.create,
eF = Y.create,
e$ = q.create,
eV = Q.create,
ez = ee.create,
eH = et.create,
eK = en.create,
eB = er.create,
eJ = er.strictCreate,
eX = es.create,
eW = ea.create,
eY = eo.create,
eq = el.create,
eQ = eu.create,
e0 = ed.create,
e1 = ec.create,
e2 = ep.create,
e3 = eh.create,
e4 = ef.create,
e9 = em.create,
e8 = ev.create,
e6 = ey.create,
e7 = e_.create,
e5 = eE.create,
te = eb.create,
tt = e_.createWithPreprocess,
tn = ew.create,
tr = () => eP().optional(),
ts = () => eM().optional(),
ti = () => ej().optional(),
ta = {
string: (e) => z.create({ ...e, coerce: !0 }),
number: (e) => H.create({ ...e, coerce: !0 }),
boolean: (e) => B.create({ ...e, coerce: !0 }),
bigint: (e) => K.create({ ...e, coerce: !0 }),
date: (e) => J.create({ ...e, coerce: !0 }),
};
e.s(
[
"BRAND",
0,
eN,
"NEVER",
0,
g,
"Schema",
() => N,
"ZodAny",
() => q,
"ZodArray",
() => en,
"ZodBigInt",
() => K,
"ZodBoolean",
() => B,
"ZodBranded",
() => eI,
"ZodCatch",
() => eS,
"ZodDate",
() => J,
"ZodDefault",
() => eT,
"ZodDiscriminatedUnion",
() => ea,
"ZodEffects",
() => e_,
"ZodEnum",
() => em,
"ZodFirstPartyTypeKind",
() => tf,
"ZodFunction",
() => ep,
"ZodIntersection",
() => eo,
"ZodLazy",
() => eh,
"ZodLiteral",
() => ef,
"ZodMap",
() => ed,
"ZodNaN",
() => eA,
"ZodNativeEnum",
() => ev,
"ZodNever",
() => ee,
"ZodNull",
() => Y,
"ZodNullable",
() => eb,
"ZodNumber",
() => H,
"ZodObject",
() => er,
"ZodOptional",
() => eE,
"ZodPipeline",
() => ew,
"ZodPromise",
() => ey,
"ZodReadonly",
() => eO,
"ZodRecord",
() => eu,
"ZodSchema",
() => N,
"ZodSet",
() => ec,
"ZodString",
() => z,
"ZodSymbol",
() => X,
"ZodTransformer",
() => e_,
"ZodTuple",
() => el,
"ZodType",
() => N,
"ZodUndefined",
() => W,
"ZodUnion",
() => es,
"ZodUnknown",
() => Q,
"ZodVoid",
() => et,
"any",
() => e$,
"array",
() => eK,
"bigint",
() => eD,
"boolean",
() => ej,
"coerce",
0,
ta,
"custom",
() => eR,
"date",
() => eZ,
"datetimeRegex",
() => V,
"discriminatedUnion",
() => eW,
"effect",
() => e7,
"enum",
() => e9,
"function",
() => e2,
"instanceof",
() => ex,
"intersection",
() => eY,
"late",
0,
ek,
"lazy",
() => e3,
"literal",
() => e4,
"map",
() => e0,
"nan",
() => eL,
"nativeEnum",
() => e8,
"never",
() => ez,
"null",
() => eF,
"nullable",
() => te,
"number",
() => eM,
"object",
() => eB,
"oboolean",
() => ti,
"onumber",
() => ts,
"optional",
() => e5,
"ostring",
() => tr,
"pipeline",
() => tn,
"preprocess",
() => tt,
"promise",
() => e6,
"record",
() => eQ,
"set",
() => e1,
"strictObject",
() => eJ,
"string",
() => eP,
"symbol",
() => eU,
"transformer",
() => e7,
"tuple",
() => eq,
"undefined",
() => eG,
"union",
() => eX,
"unknown",
() => eV,
"void",
() => eH,
],
480,
),
e.i(480),
e.i(562436),
e.s(
[
"BRAND",
0,
eN,
"DIRTY",
0,
m,
"EMPTY_PATH",
0,
p,
"INVALID",
0,
g,
"NEVER",
0,
g,
"OK",
0,
v,
"ParseStatus",
() => f,
"Schema",
() => N,
"ZodAny",
() => q,
"ZodArray",
() => en,
"ZodBigInt",
() => K,
"ZodBoolean",
() => B,
"ZodBranded",
() => eI,
"ZodCatch",
() => eS,
"ZodDate",
() => J,
"ZodDefault",
() => eT,
"ZodDiscriminatedUnion",
() => ea,
"ZodEffects",
() => e_,
"ZodEnum",
() => em,
"ZodError",
() => a,
"ZodFirstPartyTypeKind",
() => tf,
"ZodFunction",
() => ep,
"ZodIntersection",
() => eo,
"ZodIssueCode",
0,
s,
"ZodLazy",
() => eh,
"ZodLiteral",
() => ef,
"ZodMap",
() => ed,
"ZodNaN",
() => eA,
"ZodNativeEnum",
() => ev,
"ZodNever",
() => ee,
"ZodNull",
() => Y,
"ZodNullable",
() => eb,
"ZodNumber",
() => H,
"ZodObject",
() => er,
"ZodOptional",
() => eE,
"ZodParsedType",
0,
n,
"ZodPipeline",
() => ew,
"ZodPromise",
() => ey,
"ZodReadonly",
() => eO,
"ZodRecord",
() => eu,
"ZodSchema",
() => N,
"ZodSet",
() => ec,
"ZodString",
() => z,
"ZodSymbol",
() => X,
"ZodTransformer",
() => e_,
"ZodTuple",
() => el,
"ZodType",
() => N,
"ZodUndefined",
() => W,
"ZodUnion",
() => es,
"ZodUnknown",
() => Q,
"ZodVoid",
() => et,
"addIssueToContext",
() => h,
"any",
() => e$,
"array",
() => eK,
"bigint",
() => eD,
"boolean",
() => ej,
"coerce",
0,
ta,
"custom",
() => eR,
"date",
() => eZ,
"datetimeRegex",
() => V,
"defaultErrorMap",
0,
o,
"discriminatedUnion",
() => eW,
"effect",
() => e7,
"enum",
() => e9,
"function",
() => e2,
"getErrorMap",
() => d,
"getParsedType",
0,
r,
"instanceof",
() => ex,
"intersection",
() => eY,
"isAborted",
0,
y,
"isAsync",
0,
b,
"isDirty",
0,
_,
"isValid",
0,
E,
"late",
0,
ek,
"lazy",
() => e3,
"literal",
() => e4,
"makeIssue",
0,
c,
"map",
() => e0,
"nan",
() => eL,
"nativeEnum",
() => e8,
"never",
() => ez,
"null",
() => eF,
"nullable",
() => te,
"number",
() => eM,
"object",
() => eB,
"objectUtil",
() => tp,
"oboolean",
() => ti,
"onumber",
() => ts,
"optional",
() => e5,
"ostring",
() => tr,
"pipeline",
() => tn,
"preprocess",
() => tt,
"promise",
() => e6,
"quotelessJson",
0,
i,
"record",
() => eQ,
"set",
() => e1,
"setErrorMap",
() => u,
"strictObject",
() => eJ,
"string",
() => eP,
"symbol",
() => eU,
"transformer",
() => e7,
"tuple",
() => eq,
"undefined",
() => eG,
"union",
() => eX,
"unknown",
() => eV,
"util",
() => tc,
"void",
() => eH,
],
966951,
);
var to,
tl,
tu,
td,
tc,
tp,
th,
tf,
tg = e.i(966951);
e.s(["z", 0, tg], 832356);
var tg = tg;
let tm = tg.object({ name: tg.string(), arguments: tg.string() }),
tv = tg.object({
id: tg.string(),
type: tg.literal("function"),
function: tm,
encryptedValue: tg.string().optional(),
}),
ty = tg.object({
id: tg.string(),
role: tg.string(),
content: tg.string().optional(),
name: tg.string().optional(),
encryptedValue: tg.string().optional(),
}),
t_ = tg.object({ type: tg.literal("text"), text: tg.string() }),
tE = tg.object({
type: tg.literal("binary"),
mimeType: tg.string(),
id: tg.string().optional(),
url: tg.string().optional(),
data: tg.string().optional(),
filename: tg.string().optional(),
}),
tb = (e, t) => {
e.id ||
e.url ||
e.data ||
t.addIssue({
code: tg.ZodIssueCode.custom,
message:
"BinaryInputContent requires at least one of id, url, or data.",
path: ["id"],
});
},
tT = tE.superRefine((e, t) => {
tb(e, t);
}),
tS = tg.discriminatedUnion("type", [t_, tE]).superRefine((e, t) => {
"binary" === e.type && tb(e, t);
}),
tA = ty.extend({ role: tg.literal("developer"), content: tg.string() }),
tN = ty.extend({ role: tg.literal("system"), content: tg.string() }),
tI = ty.extend({
role: tg.literal("assistant"),
content: tg.string().optional(),
toolCalls: tg.array(tv).optional(),
}),
tw = ty.extend({
role: tg.literal("user"),
content: tg.union([tg.string(), tg.array(tS)]),
}),
tO = tg.object({
id: tg.string(),
content: tg.string(),
role: tg.literal("tool"),
toolCallId: tg.string(),
error: tg.string().optional(),
encryptedValue: tg.string().optional(),
}),
tC = tg.object({
id: tg.string(),
role: tg.literal("activity"),
activityType: tg.string(),
content: tg.record(tg.any()),
}),
tR = tg.object({
id: tg.string(),
role: tg.literal("reasoning"),
content: tg.string(),
encryptedValue: tg.string().optional(),
}),
tk = tg.discriminatedUnion("role", [tA, tN, tI, tw, tO, tC, tR]),
tx = tg.union([
tg.literal("developer"),
tg.literal("system"),
tg.literal("assistant"),
tg.literal("user"),
tg.literal("tool"),
tg.literal("activity"),
tg.literal("reasoning"),
]),
tP = tg.object({ description: tg.string(), value: tg.string() }),
tM = tg.object({
name: tg.string(),
description: tg.string(),
parameters: tg.any(),
}),
tL = tg.object({
threadId: tg.string(),
runId: tg.string(),
parentRunId: tg.string().optional(),
state: tg.any(),
messages: tg.array(tk),
tools: tg.array(tM),
context: tg.array(tP),
forwardedProps: tg.any(),
}),
tD = tg.any();
var tj = class extends Error {
constructor(e) {
super(e);
}
},
tZ = class extends tj {
constructor() {
super(
"Connect not implemented. This method is not supported by the current agent.",
);
}
};
let tU = tg.union([
tg.literal("developer"),
tg.literal("system"),
tg.literal("assistant"),
tg.literal("user"),
]),
tG =
(((to = {}).TEXT_MESSAGE_START = "TEXT_MESSAGE_START"),
(to.TEXT_MESSAGE_CONTENT = "TEXT_MESSAGE_CONTENT"),
(to.TEXT_MESSAGE_END = "TEXT_MESSAGE_END"),
(to.TEXT_MESSAGE_CHUNK = "TEXT_MESSAGE_CHUNK"),
(to.TOOL_CALL_START = "TOOL_CALL_START"),
(to.TOOL_CALL_ARGS = "TOOL_CALL_ARGS"),
(to.TOOL_CALL_END = "TOOL_CALL_END"),
(to.TOOL_CALL_CHUNK = "TOOL_CALL_CHUNK"),
(to.TOOL_CALL_RESULT = "TOOL_CALL_RESULT"),
(to.THINKING_START = "THINKING_START"),
(to.THINKING_END = "THINKING_END"),
(to.THINKING_TEXT_MESSAGE_START = "THINKING_TEXT_MESSAGE_START"),
(to.THINKING_TEXT_MESSAGE_CONTENT = "THINKING_TEXT_MESSAGE_CONTENT"),
(to.THINKING_TEXT_MESSAGE_END = "THINKING_TEXT_MESSAGE_END"),
(to.STATE_SNAPSHOT = "STATE_SNAPSHOT"),
(to.STATE_DELTA = "STATE_DELTA"),
(to.MESSAGES_SNAPSHOT = "MESSAGES_SNAPSHOT"),
(to.ACTIVITY_SNAPSHOT = "ACTIVITY_SNAPSHOT"),
(to.ACTIVITY_DELTA = "ACTIVITY_DELTA"),
(to.RAW = "RAW"),
(to.CUSTOM = "CUSTOM"),
(to.RUN_STARTED = "RUN_STARTED"),
(to.RUN_FINISHED = "RUN_FINISHED"),
(to.RUN_ERROR = "RUN_ERROR"),
(to.STEP_STARTED = "STEP_STARTED"),
(to.STEP_FINISHED = "STEP_FINISHED"),
(to.REASONING_START = "REASONING_START"),
(to.REASONING_MESSAGE_START = "REASONING_MESSAGE_START"),
(to.REASONING_MESSAGE_CONTENT = "REASONING_MESSAGE_CONTENT"),
(to.REASONING_MESSAGE_END = "REASONING_MESSAGE_END"),
(to.REASONING_MESSAGE_CHUNK = "REASONING_MESSAGE_CHUNK"),
(to.REASONING_END = "REASONING_END"),
(to.REASONING_ENCRYPTED_VALUE = "REASONING_ENCRYPTED_VALUE"),
to),
tF = tg
.object({
type: tg.nativeEnum(tG),
timestamp: tg.number().optional(),
rawEvent: tg.any().optional(),
})
.passthrough(),
t$ = tF.extend({
type: tg.literal(tG.TEXT_MESSAGE_START),
messageId: tg.string(),
role: tU.default("assistant"),
}),
tV = tF.extend({
type: tg.literal(tG.TEXT_MESSAGE_CONTENT),
messageId: tg.string(),
delta: tg
.string()
.refine((e) => e.length > 0, "Delta must not be an empty string"),
}),
tz = tF.extend({
type: tg.literal(tG.TEXT_MESSAGE_END),
messageId: tg.string(),
}),
tH = tF.extend({
type: tg.literal(tG.TEXT_MESSAGE_CHUNK),
messageId: tg.string().optional(),
role: tU.optional(),
delta: tg.string().optional(),
}),
tK = tF.extend({ type: tg.literal(tG.THINKING_TEXT_MESSAGE_START) }),
tB = tV
.omit({ messageId: !0, type: !0 })
.extend({ type: tg.literal(tG.THINKING_TEXT_MESSAGE_CONTENT) }),
tJ = tF.extend({ type: tg.literal(tG.THINKING_TEXT_MESSAGE_END) }),
tX = tF.extend({
type: tg.literal(tG.TOOL_CALL_START),
toolCallId: tg.string(),
toolCallName: tg.string(),
parentMessageId: tg.string().optional(),
}),
tW = tF.extend({
type: tg.literal(tG.TOOL_CALL_ARGS),
toolCallId: tg.string(),
delta: tg.string(),
}),
tY = tF.extend({
type: tg.literal(tG.TOOL_CALL_END),
toolCallId: tg.string(),
}),
tq = tF.extend({
messageId: tg.string(),
type: tg.literal(tG.TOOL_CALL_RESULT),
toolCallId: tg.string(),
content: tg.string(),
role: tg.literal("tool").optional(),
}),
tQ = tF.extend({
type: tg.literal(tG.TOOL_CALL_CHUNK),
toolCallId: tg.string().optional(),
toolCallName: tg.string().optional(),
parentMessageId: tg.string().optional(),
delta: tg.string().optional(),
}),
t0 = tF.extend({
type: tg.literal(tG.THINKING_START),
title: tg.string().optional(),
}),
t1 = tF.extend({ type: tg.literal(tG.THINKING_END) }),
t2 = tF.extend({ type: tg.literal(tG.STATE_SNAPSHOT), snapshot: tD }),
t3 = tF.extend({
type: tg.literal(tG.STATE_DELTA),
delta: tg.array(tg.any()),
}),
t4 = tF.extend({
type: tg.literal(tG.MESSAGES_SNAPSHOT),
messages: tg.array(tk),
}),
t9 = tF.extend({
type: tg.literal(tG.ACTIVITY_SNAPSHOT),
messageId: tg.string(),
activityType: tg.string(),
content: tg.record(tg.any()),
replace: tg.boolean().optional().default(!0),
}),
t8 = tF.extend({
type: tg.literal(tG.ACTIVITY_DELTA),
messageId: tg.string(),
activityType: tg.string(),
patch: tg.array(tg.any()),
}),
t6 = tF.extend({
type: tg.literal(tG.RAW),
event: tg.any(),
source: tg.string().optional(),
}),
t7 = tF.extend({
type: tg.literal(tG.CUSTOM),
name: tg.string(),
value: tg.any(),
}),
t5 = tF.extend({
type: tg.literal(tG.RUN_STARTED),
threadId: tg.string(),
runId: tg.string(),
parentRunId: tg.string().optional(),
input: tL.optional(),
}),
ne = tF.extend({
type: tg.literal(tG.RUN_FINISHED),
threadId: tg.string(),
runId: tg.string(),
result: tg.any().optional(),
}),
nt = tF.extend({
type: tg.literal(tG.RUN_ERROR),
message: tg.string(),
code: tg.string().optional(),
}),
nn = tF.extend({
type: tg.literal(tG.STEP_STARTED),
stepName: tg.string(),
}),
nr = tF.extend({
type: tg.literal(tG.STEP_FINISHED),
stepName: tg.string(),
}),
ns = tg.union([tg.literal("tool-call"), tg.literal("message")]),
ni = tF.extend({
type: tg.literal(tG.REASONING_START),
messageId: tg.string(),
}),
na = tF.extend({
type: tg.literal(tG.REASONING_MESSAGE_START),
messageId: tg.string(),
role: tg.literal("reasoning"),
}),
no = tF.extend({
type: tg.literal(tG.REASONING_MESSAGE_CONTENT),
messageId: tg.string(),
delta: tg
.string()
.refine((e) => e.length > 0, "Delta must not be an empty string"),
}),
nl = tF.extend({
type: tg.literal(tG.REASONING_MESSAGE_END),
messageId: tg.string(),
}),
nu = tF.extend({
type: tg.literal(tG.REASONING_MESSAGE_CHUNK),
messageId: tg.string().optional(),
delta: tg.string().optional(),
}),
nd = tF.extend({
type: tg.literal(tG.REASONING_END),
messageId: tg.string(),
}),
nc = tF.extend({
type: tg.literal(tG.REASONING_ENCRYPTED_VALUE),
subtype: ns,
entityId: tg.string(),
encryptedValue: tg.string(),
}),
np = tg.discriminatedUnion("type", [
t$,
tV,
tz,
tH,
t0,
t1,
tK,
tB,
tJ,
tX,
tW,
tY,
tQ,
tq,
t2,
t3,
t4,
t9,
t8,
t6,
t7,
t5,
ne,
nt,
nn,
nr,
ni,
na,
no,
nl,
nu,
nd,
nc,
]);
e.s(
[
"AGUIConnectNotImplementedError",
() => tZ,
"AGUIError",
() => tj,
"ActivityDeltaEventSchema",
() => t8,
"ActivityMessageSchema",
() => tC,
"ActivitySnapshotEventSchema",
() => t9,
"AssistantMessageSchema",
() => tI,
"BaseEventSchema",
() => tF,
"BaseMessageSchema",
() => ty,
"BinaryInputContentSchema",
() => tT,
"ContextSchema",
() => tP,
"CustomEventSchema",
() => t7,
"DeveloperMessageSchema",
() => tA,
"EventSchemas",
() => np,
"EventType",
() => tG,
"FunctionCallSchema",
() => tm,
"InputContentSchema",
() => tS,
"MessageSchema",
() => tk,
"MessagesSnapshotEventSchema",
() => t4,
"RawEventSchema",
() => t6,
"ReasoningEncryptedValueEventSchema",
() => nc,
"ReasoningEncryptedValueSubtypeSchema",
() => ns,
"ReasoningEndEventSchema",
() => nd,
"ReasoningMessageChunkEventSchema",
() => nu,
"ReasoningMessageContentEventSchema",
() => no,
"ReasoningMessageEndEventSchema",
() => nl,
"ReasoningMessageSchema",
() => tR,
"ReasoningMessageStartEventSchema",
() => na,
"ReasoningStartEventSchema",
() => ni,
"RoleSchema",
() => tx,
"RunAgentInputSchema",
() => tL,
"RunErrorEventSchema",
() => nt,
"RunFinishedEventSchema",
() => ne,
"RunStartedEventSchema",
() => t5,
"StateDeltaEventSchema",
() => t3,
"StateSchema",
() => tD,
"StateSnapshotEventSchema",
() => t2,
"StepFinishedEventSchema",
() => nr,
"StepStartedEventSchema",
() => nn,
"SystemMessageSchema",
() => tN,
"TextInputContentSchema",
() => t_,
"TextMessageChunkEventSchema",
() => tH,
"TextMessageContentEventSchema",
() => tV,
"TextMessageEndEventSchema",
() => tz,
"TextMessageStartEventSchema",
() => t$,
"ThinkingEndEventSchema",
() => t1,
"ThinkingStartEventSchema",
() => t0,
"ThinkingTextMessageContentEventSchema",
() => tB,
"ThinkingTextMessageEndEventSchema",
() => tJ,
"ThinkingTextMessageStartEventSchema",
() => tK,
"ToolCallArgsEventSchema",
() => tW,
"ToolCallChunkEventSchema",
() => tQ,
"ToolCallEndEventSchema",
() => tY,
"ToolCallResultEventSchema",
() => tq,
"ToolCallSchema",
() => tv,
"ToolCallStartEventSchema",
() => tX,
"ToolMessageSchema",
() => tO,
"ToolSchema",
() => tM,
"UserMessageSchema",
() => tw,
],
361769,
);
};
export default moduleFactory;