UNPKG

@openai/agents-realtime

Version:

The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows. This package contains the logic for building realtime voice agents on the server or in the browser.

1,623 lines 1.46 MB
var Qa = Object.defineProperty; var ns = (n) => { throw TypeError(n); }; var ei = (n, e, t) => e in n ? Qa(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t; var _ = (n, e, t) => ei(n, typeof e != "symbol" ? e + "" : e, t), er = (n, e, t) => e.has(n) || ns("Cannot " + t); var o = (n, e, t) => (er(n, e, "read from private field"), t ? t.call(n) : e.get(n)), T = (n, e, t) => e.has(n) ? ns("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), y = (n, e, t, r) => (er(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t), F = (n, e, t) => (er(n, e, "access private method"), t); const lr = { version: "0.1.8" }; async function Pr(n) { try { return [null, await n()]; } catch (e) { return [e, null]; } } function ti(n, e) { const t = { ...n }; return Object.defineProperties(t, { $brand: { value: "auto-parseable-response-format", enumerable: !1 }, $parseRaw: { value: e, enumerable: !1 } }), t; } const ni = Symbol("Let zodToJsonSchema decide on which parser to use"), rs = { name: void 0, $refStrategy: "root", effectStrategy: "input", pipeStrategy: "all", dateStrategy: "format:date-time", mapStrategy: "entries", nullableStrategy: "from-target", removeAdditionalStrategy: "passthrough", definitionPath: "definitions", target: "jsonSchema7", strictUnions: !1, errorMessages: !1, markdownDescription: !1, patternStrategy: "escape", applyRegexFlags: !1, emailStrategy: "format:email", base64Strategy: "contentEncoding:base64", nameStrategy: "ref" }, ri = (n) => typeof n == "string" ? { ...rs, basePath: ["#"], definitions: {}, name: n } : { ...rs, basePath: ["#"], definitions: {}, ...n }, pr = (n) => "_def" in n ? n._def : n; function si(n) { if (!n) return !0; for (const e in n) return !1; return !0; } const ai = (n) => { const e = ri(n), t = e.name !== void 0 ? [...e.basePath, e.definitionPath, e.name] : e.basePath; return { ...e, currentPath: t, propertyPath: void 0, seenRefs: /* @__PURE__ */ new Set(), seen: new Map(Object.entries(e.definitions).map(([r, s]) => [ pr(s), { def: pr(s), path: [...e.basePath, e.definitionPath, r], // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now. jsonSchema: void 0 } ])) }; }; function Xs(n, e, t, r) { r != null && r.errorMessages && t && (n.errorMessage = { ...n.errorMessage, [e]: t }); } function V(n, e, t, r, s) { n[e] = t, Xs(n, e, r, s); } var J; (function(n) { n.assertEqual = (s) => { }; function e(s) { } n.assertIs = e; function t(s) { throw new Error(); } n.assertNever = t, n.arrayToEnum = (s) => { const a = {}; for (const i of s) a[i] = i; return a; }, n.getValidEnumValues = (s) => { const a = n.objectKeys(s).filter((u) => typeof s[s[u]] != "number"), i = {}; for (const u of a) i[u] = s[u]; return n.objectValues(i); }, n.objectValues = (s) => n.objectKeys(s).map(function(a) { return s[a]; }), n.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => { const a = []; for (const i in s) Object.prototype.hasOwnProperty.call(s, i) && a.push(i); return a; }, n.find = (s, a) => { for (const i of s) if (a(i)) return i; }, n.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s; function r(s, a = " | ") { return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a); } n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a; })(J || (J = {})); var ss; (function(n) { n.mergeShapes = (e, t) => ({ ...e, ...t // second overwrites first }); })(ss || (ss = {})); const k = J.arrayToEnum([ "string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set" ]), Fe = (n) => { switch (typeof n) { case "undefined": return k.undefined; case "string": return k.string; case "number": return Number.isNaN(n) ? k.nan : k.number; case "boolean": return k.boolean; case "function": return k.function; case "bigint": return k.bigint; case "symbol": return k.symbol; case "object": return Array.isArray(n) ? k.array : n === null ? k.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? k.promise : typeof Map < "u" && n instanceof Map ? k.map : typeof Set < "u" && n instanceof Set ? k.set : typeof Date < "u" && n instanceof Date ? k.date : k.object; default: return k.unknown; } }, x = J.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" ]); class je extends Error { get errors() { return this.issues; } constructor(e) { super(), this.issues = [], this.addIssue = (r) => { this.issues = [...this.issues, r]; }, this.addIssues = (r = []) => { this.issues = [...this.issues, ...r]; }; const t = new.target.prototype; Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e; } format(e) { const t = e || function(a) { return a.message; }, r = { _errors: [] }, s = (a) => { for (const i of a.issues) if (i.code === "invalid_union") i.unionErrors.map(s); else if (i.code === "invalid_return_type") s(i.returnTypeError); else if (i.code === "invalid_arguments") s(i.argumentsError); else if (i.path.length === 0) r._errors.push(t(i)); else { let u = r, d = 0; for (; d < i.path.length; ) { const l = i.path[d]; d === i.path.length - 1 ? (u[l] = u[l] || { _errors: [] }, u[l]._errors.push(t(i))) : u[l] = u[l] || { _errors: [] }, u = u[l], d++; } } }; return s(this), r; } static assert(e) { if (!(e instanceof je)) throw new Error(`Not a ZodError: ${e}`); } toString() { return this.message; } get message() { return JSON.stringify(this.issues, J.jsonStringifyReplacer, 2); } get isEmpty() { return this.issues.length === 0; } flatten(e = (t) => t.message) { const t = {}, r = []; for (const s of this.issues) s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : r.push(e(s)); return { formErrors: r, fieldErrors: t }; } get formErrors() { return this.flatten(); } } je.create = (n) => new je(n); const fr = (n, e) => { let t; switch (n.code) { case x.invalid_type: n.received === k.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`; break; case x.invalid_literal: t = `Invalid literal value, expected ${JSON.stringify(n.expected, J.jsonStringifyReplacer)}`; break; case x.unrecognized_keys: t = `Unrecognized key(s) in object: ${J.joinValues(n.keys, ", ")}`; break; case x.invalid_union: t = "Invalid input"; break; case x.invalid_union_discriminator: t = `Invalid discriminator value. Expected ${J.joinValues(n.options)}`; break; case x.invalid_enum_value: t = `Invalid enum value. Expected ${J.joinValues(n.options)}, received '${n.received}'`; break; case x.invalid_arguments: t = "Invalid function arguments"; break; case x.invalid_return_type: t = "Invalid function return type"; break; case x.invalid_date: t = "Invalid date"; break; case x.invalid_string: typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : J.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid"; break; case x.too_small: n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input"; break; case x.too_big: n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input"; break; case x.custom: t = "Invalid input"; break; case x.invalid_intersection_types: t = "Intersection results could not be merged"; break; case x.not_multiple_of: t = `Number must be a multiple of ${n.multipleOf}`; break; case x.not_finite: t = "Number must be finite"; break; default: t = e.defaultError, J.assertNever(n); } return { message: t }; }; let ii = fr; function oi() { return ii; } const ui = (n) => { const { data: e, path: t, errorMaps: r, issueData: s } = n, a = [...t, ...s.path || []], i = { ...s, path: a }; if (s.message !== void 0) return { ...s, path: a, message: s.message }; let u = ""; const d = r.filter((l) => !!l).slice().reverse(); for (const l of d) u = l(i, { data: e, defaultError: u }).message; return { ...s, path: a, message: u }; }; function I(n, e) { const t = oi(), r = ui({ issueData: e, data: n.data, path: n.path, errorMaps: [ n.common.contextualErrorMap, // contextual error map is first priority n.schemaErrorMap, // then schema-bound map if available t, // then global override map t === fr ? void 0 : fr // then global default map ].filter((s) => !!s) }); n.common.issues.push(r); } class oe { constructor() { this.value = "valid"; } dirty() { this.value === "valid" && (this.value = "dirty"); } abort() { this.value !== "aborted" && (this.value = "aborted"); } static mergeArray(e, t) { const r = []; for (const s of t) { if (s.status === "aborted") return P; s.status === "dirty" && e.dirty(), r.push(s.value); } return { status: e.value, value: r }; } static async mergeObjectAsync(e, t) { const r = []; for (const s of t) { const a = await s.key, i = await s.value; r.push({ key: a, value: i }); } return oe.mergeObjectSync(e, r); } static mergeObjectSync(e, t) { const r = {}; for (const s of t) { const { key: a, value: i } = s; if (a.status === "aborted" || i.status === "aborted") return P; a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (r[a.value] = i.value); } return { status: e.value, value: r }; } } const P = Object.freeze({ status: "aborted" }), Jt = (n) => ({ status: "dirty", value: n }), ve = (n) => ({ status: "valid", value: n }), as = (n) => n.status === "aborted", is = (n) => n.status === "dirty", Ft = (n) => n.status === "valid", Rn = (n) => typeof Promise < "u" && n instanceof Promise; var C; (function(n) { n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message; })(C || (C = {})); class ke { constructor(e, t, r, s) { this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s; } 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; } } const os = (n, e) => { if (Ft(e)) return { success: !0, data: e.value }; if (!n.common.issues.length) throw new Error("Validation failed but no issues detected."); return { success: !1, get error() { if (this._error) return this._error; const t = new je(n.common.issues); return this._error = t, this._error; } }; }; function j(n) { if (!n) return {}; const { errorMap: e, invalid_type_error: t, required_error: r, description: s } = n; if (e && (t || r)) 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: (i, u) => { const { message: d } = n; return i.code === "invalid_enum_value" ? { message: d ?? u.defaultError } : typeof u.data > "u" ? { message: d ?? r ?? u.defaultError } : i.code !== "invalid_type" ? { message: u.defaultError } : { message: d ?? t ?? u.defaultError }; }, description: s }; } class Z { get description() { return this._def.description; } _getType(e) { return Fe(e.data); } _getOrReturnCtx(e, t) { return t || { common: e.parent.common, data: e.data, parsedType: Fe(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent }; } _processInputParams(e) { return { status: new oe(), ctx: { common: e.parent.common, data: e.data, parsedType: Fe(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent } }; } _parseSync(e) { const t = this._parse(e); if (Rn(t)) throw new Error("Synchronous parse encountered promise."); return t; } _parseAsync(e) { const t = this._parse(e); return Promise.resolve(t); } parse(e, t) { const r = this.safeParse(e, t); if (r.success) return r.data; throw r.error; } safeParse(e, t) { const r = { common: { issues: [], async: (t == null ? void 0 : t.async) ?? !1, contextualErrorMap: t == null ? void 0 : t.errorMap }, path: (t == null ? void 0 : t.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: Fe(e) }, s = this._parseSync({ data: e, path: r.path, parent: r }); return os(r, s); } "~validate"(e) { var r, s; const t = { common: { issues: [], async: !!this["~standard"].async }, path: [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: Fe(e) }; if (!this["~standard"].async) try { const a = this._parseSync({ data: e, path: [], parent: t }); return Ft(a) ? { value: a.value } : { issues: t.common.issues }; } catch (a) { (s = (r = a == null ? void 0 : a.message) == null ? void 0 : r.toLowerCase()) != null && s.includes("encountered") && (this["~standard"].async = !0), t.common = { issues: [], async: !0 }; } return this._parseAsync({ data: e, path: [], parent: t }).then((a) => Ft(a) ? { value: a.value } : { issues: t.common.issues }); } async parseAsync(e, t) { const r = await this.safeParseAsync(e, t); if (r.success) return r.data; throw r.error; } async safeParseAsync(e, t) { const r = { common: { issues: [], contextualErrorMap: t == null ? void 0 : t.errorMap, async: !0 }, path: (t == null ? void 0 : t.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: Fe(e) }, s = this._parse({ data: e, path: r.path, parent: r }), a = await (Rn(s) ? s : Promise.resolve(s)); return os(r, a); } refine(e, t) { const r = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t; return this._refinement((s, a) => { const i = e(s), u = () => a.addIssue({ code: x.custom, ...r(s) }); return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (u(), !1)) : i ? !0 : (u(), !1); }); } refinement(e, t) { return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1)); } _refinement(e) { return new pt({ schema: this, typeName: S.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: (t) => this["~validate"](t) }; } optional() { return Me.create(this, this._def); } nullable() { return ft.create(this, this._def); } nullish() { return this.nullable().optional(); } array() { return Ie.create(this); } promise() { return Fn.create(this, this._def); } or(e) { return Dn.create([this, e], this._def); } and(e) { return Pn.create(this, e, this._def); } transform(e) { return new pt({ ...j(this._def), schema: this, typeName: S.ZodEffects, effect: { type: "transform", transform: e } }); } default(e) { const t = typeof e == "function" ? e : () => e; return new Ln({ ...j(this._def), innerType: this, defaultValue: t, typeName: S.ZodDefault }); } brand() { return new na({ typeName: S.ZodBranded, type: this, ...j(this._def) }); } catch(e) { const t = typeof e == "function" ? e : () => e; return new Zn({ ...j(this._def), innerType: this, catchValue: t, typeName: S.ZodCatch }); } describe(e) { const t = this.constructor; return new t({ ...this._def, description: e }); } pipe(e) { return jr.create(this, e); } readonly() { return Un.create(this); } isOptional() { return this.safeParse(void 0).success; } isNullable() { return this.safeParse(null).success; } } const ci = /^c[^\s-]{8,}$/i, di = /^[0-9a-z]+$/, li = /^[0-9A-HJKMNP-TV-Z]{26}$/i, pi = /^[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, fi = /^[a-z0-9_-]{21}$/i, hi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, mi = /^[-+]?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)?)??$/, gi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, _i = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$"; let tr; const yi = /^(?:(?: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])$/, vi = /^(?:(?: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])$/, wi = /^(([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]))$/, bi = /^(([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])$/, xi = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Si = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Qs = "((\\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])))", Ti = new RegExp(`^${Qs}$`); function ea(n) { let e = "[0-5]\\d"; n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`); const t = n.precision ? "+" : "?"; return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`; } function Ii(n) { return new RegExp(`^${ea(n)}$`); } function ki(n) { let e = `${Qs}T${ea(n)}`; const t = []; return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`); } function Ai(n, e) { return !!((e === "v4" || !e) && yi.test(n) || (e === "v6" || !e) && wi.test(n)); } function Ci(n, e) { if (!hi.test(n)) return !1; try { const [t] = n.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r)); return !(typeof s != "object" || s === null || "typ" in s && (s == null ? void 0 : s.typ) !== "JWT" || !s.alg || e && s.alg !== e); } catch { return !1; } } function Ei(n, e) { return !!((e === "v4" || !e) && vi.test(n) || (e === "v6" || !e) && bi.test(n)); } class Pe extends Z { _parse(e) { if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== k.string) { const a = this._getOrReturnCtx(e); return I(a, { code: x.invalid_type, expected: k.string, received: a.parsedType }), P; } const r = new oe(); let s; for (const a of this._def.checks) if (a.kind === "min") e.data.length < a.value && (s = this._getOrReturnCtx(e, s), I(s, { code: x.too_small, minimum: a.value, type: "string", inclusive: !0, exact: !1, message: a.message }), r.dirty()); else if (a.kind === "max") e.data.length > a.value && (s = this._getOrReturnCtx(e, s), I(s, { code: x.too_big, maximum: a.value, type: "string", inclusive: !0, exact: !1, message: a.message }), r.dirty()); else if (a.kind === "length") { const i = e.data.length > a.value, u = e.data.length < a.value; (i || u) && (s = this._getOrReturnCtx(e, s), i ? I(s, { code: x.too_big, maximum: a.value, type: "string", inclusive: !0, exact: !0, message: a.message }) : u && I(s, { code: x.too_small, minimum: a.value, type: "string", inclusive: !0, exact: !0, message: a.message }), r.dirty()); } else if (a.kind === "email") gi.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "email", code: x.invalid_string, message: a.message }), r.dirty()); else if (a.kind === "emoji") tr || (tr = new RegExp(_i, "u")), tr.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "emoji", code: x.invalid_string, message: a.message }), r.dirty()); else if (a.kind === "uuid") pi.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "uuid", code: x.invalid_string, message: a.message }), r.dirty()); else if (a.kind === "nanoid") fi.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "nanoid", code: x.invalid_string, message: a.message }), r.dirty()); else if (a.kind === "cuid") ci.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "cuid", code: x.invalid_string, message: a.message }), r.dirty()); else if (a.kind === "cuid2") di.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "cuid2", code: x.invalid_string, message: a.message }), r.dirty()); else if (a.kind === "ulid") li.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "ulid", code: x.invalid_string, message: a.message }), r.dirty()); else if (a.kind === "url") try { new URL(e.data); } catch { s = this._getOrReturnCtx(e, s), I(s, { validation: "url", code: x.invalid_string, message: a.message }), r.dirty(); } else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "regex", code: x.invalid_string, message: a.message }), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), I(s, { code: x.invalid_string, validation: { includes: a.value, position: a.position }, message: a.message }), r.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), I(s, { code: x.invalid_string, validation: { startsWith: a.value }, message: a.message }), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), I(s, { code: x.invalid_string, validation: { endsWith: a.value }, message: a.message }), r.dirty()) : a.kind === "datetime" ? ki(a).test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { code: x.invalid_string, validation: "datetime", message: a.message }), r.dirty()) : a.kind === "date" ? Ti.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { code: x.invalid_string, validation: "date", message: a.message }), r.dirty()) : a.kind === "time" ? Ii(a).test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { code: x.invalid_string, validation: "time", message: a.message }), r.dirty()) : a.kind === "duration" ? mi.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "duration", code: x.invalid_string, message: a.message }), r.dirty()) : a.kind === "ip" ? Ai(e.data, a.version) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "ip", code: x.invalid_string, message: a.message }), r.dirty()) : a.kind === "jwt" ? Ci(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "jwt", code: x.invalid_string, message: a.message }), r.dirty()) : a.kind === "cidr" ? Ei(e.data, a.version) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "cidr", code: x.invalid_string, message: a.message }), r.dirty()) : a.kind === "base64" ? xi.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "base64", code: x.invalid_string, message: a.message }), r.dirty()) : a.kind === "base64url" ? Si.test(e.data) || (s = this._getOrReturnCtx(e, s), I(s, { validation: "base64url", code: x.invalid_string, message: a.message }), r.dirty()) : J.assertNever(a); return { status: r.value, value: e.data }; } _regex(e, t, r) { return this.refinement((s) => e.test(s), { validation: t, code: x.invalid_string, ...C.errToObj(r) }); } _addCheck(e) { return new Pe({ ...this._def, checks: [...this._def.checks, e] }); } email(e) { return this._addCheck({ kind: "email", ...C.errToObj(e) }); } url(e) { return this._addCheck({ kind: "url", ...C.errToObj(e) }); } emoji(e) { return this._addCheck({ kind: "emoji", ...C.errToObj(e) }); } uuid(e) { return this._addCheck({ kind: "uuid", ...C.errToObj(e) }); } nanoid(e) { return this._addCheck({ kind: "nanoid", ...C.errToObj(e) }); } cuid(e) { return this._addCheck({ kind: "cuid", ...C.errToObj(e) }); } cuid2(e) { return this._addCheck({ kind: "cuid2", ...C.errToObj(e) }); } ulid(e) { return this._addCheck({ kind: "ulid", ...C.errToObj(e) }); } base64(e) { return this._addCheck({ kind: "base64", ...C.errToObj(e) }); } base64url(e) { return this._addCheck({ kind: "base64url", ...C.errToObj(e) }); } jwt(e) { return this._addCheck({ kind: "jwt", ...C.errToObj(e) }); } ip(e) { return this._addCheck({ kind: "ip", ...C.errToObj(e) }); } cidr(e) { return this._addCheck({ kind: "cidr", ...C.errToObj(e) }); } datetime(e) { return typeof e == "string" ? this._addCheck({ kind: "datetime", precision: null, offset: !1, local: !1, message: e }) : this._addCheck({ kind: "datetime", precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision, offset: (e == null ? void 0 : e.offset) ?? !1, local: (e == null ? void 0 : e.local) ?? !1, ...C.errToObj(e == null ? void 0 : 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 == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision, ...C.errToObj(e == null ? void 0 : e.message) }); } duration(e) { return this._addCheck({ kind: "duration", ...C.errToObj(e) }); } regex(e, t) { return this._addCheck({ kind: "regex", regex: e, ...C.errToObj(t) }); } includes(e, t) { return this._addCheck({ kind: "includes", value: e, position: t == null ? void 0 : t.position, ...C.errToObj(t == null ? void 0 : t.message) }); } startsWith(e, t) { return this._addCheck({ kind: "startsWith", value: e, ...C.errToObj(t) }); } endsWith(e, t) { return this._addCheck({ kind: "endsWith", value: e, ...C.errToObj(t) }); } min(e, t) { return this._addCheck({ kind: "min", value: e, ...C.errToObj(t) }); } max(e, t) { return this._addCheck({ kind: "max", value: e, ...C.errToObj(t) }); } length(e, t) { return this._addCheck({ kind: "length", value: e, ...C.errToObj(t) }); } /** * Equivalent to `.min(1)` */ nonempty(e) { return this.min(1, C.errToObj(e)); } trim() { return new Pe({ ...this._def, checks: [...this._def.checks, { kind: "trim" }] }); } toLowerCase() { return new Pe({ ...this._def, checks: [...this._def.checks, { kind: "toLowerCase" }] }); } toUpperCase() { return new Pe({ ...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 (const t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value); return e; } get maxLength() { let e = null; for (const t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value); return e; } } Pe.create = (n) => new Pe({ checks: [], typeName: S.ZodString, coerce: (n == null ? void 0 : n.coerce) ?? !1, ...j(n) }); function Oi(n, e) { const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, a = Number.parseInt(n.toFixed(s).replace(".", "")), i = Number.parseInt(e.toFixed(s).replace(".", "")); return a % i / 10 ** s; } class Lt extends Z { 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) !== k.number) { const a = this._getOrReturnCtx(e); return I(a, { code: x.invalid_type, expected: k.number, received: a.parsedType }), P; } let r; const s = new oe(); for (const a of this._def.checks) a.kind === "int" ? J.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), I(r, { code: x.invalid_type, expected: "integer", received: "float", message: a.message }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), I(r, { code: x.too_small, minimum: a.value, type: "number", inclusive: a.inclusive, exact: !1, message: a.message }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), I(r, { code: x.too_big, maximum: a.value, type: "number", inclusive: a.inclusive, exact: !1, message: a.message }), s.dirty()) : a.kind === "multipleOf" ? Oi(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), I(r, { code: x.not_multiple_of, multipleOf: a.value, message: a.message }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), I(r, { code: x.not_finite, message: a.message }), s.dirty()) : J.assertNever(a); return { status: s.value, value: e.data }; } gte(e, t) { return this.setLimit("min", e, !0, C.toString(t)); } gt(e, t) { return this.setLimit("min", e, !1, C.toString(t)); } lte(e, t) { return this.setLimit("max", e, !0, C.toString(t)); } lt(e, t) { return this.setLimit("max", e, !1, C.toString(t)); } setLimit(e, t, r, s) { return new Lt({ ...this._def, checks: [ ...this._def.checks, { kind: e, value: t, inclusive: r, message: C.toString(s) } ] }); } _addCheck(e) { return new Lt({ ...this._def, checks: [...this._def.checks, e] }); } int(e) { return this._addCheck({ kind: "int", message: C.toString(e) }); } positive(e) { return this._addCheck({ kind: "min", value: 0, inclusive: !1, message: C.toString(e) }); } negative(e) { return this._addCheck({ kind: "max", value: 0, inclusive: !1, message: C.toString(e) }); } nonpositive(e) { return this._addCheck({ kind: "max", value: 0, inclusive: !0, message: C.toString(e) }); } nonnegative(e) { return this._addCheck({ kind: "min", value: 0, inclusive: !0, message: C.toString(e) }); } multipleOf(e, t) { return this._addCheck({ kind: "multipleOf", value: e, message: C.toString(t) }); } finite(e) { return this._addCheck({ kind: "finite", message: C.toString(e) }); } safe(e) { return this._addCheck({ kind: "min", inclusive: !0, value: Number.MIN_SAFE_INTEGER, message: C.toString(e) })._addCheck({ kind: "max", inclusive: !0, value: Number.MAX_SAFE_INTEGER, message: C.toString(e) }); } get minValue() { let e = null; for (const t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value); return e; } get maxValue() { let e = null; for (const t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value); return e; } get isInt() { return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && J.isInteger(e.value)); } get isFinite() { let e = null, t = null; for (const r of this._def.checks) { if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf") return !0; r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value); } return Number.isFinite(t) && Number.isFinite(e); } } Lt.create = (n) => new Lt({ checks: [], typeName: S.ZodNumber, coerce: (n == null ? void 0 : n.coerce) || !1, ...j(n) }); class Gt extends Z { constructor() { super(...arguments), this.min = this.gte, this.max = this.lte; } _parse(e) { if (this._def.coerce) try { e.data = BigInt(e.data); } catch { return this._getInvalidInput(e); } if (this._getType(e) !== k.bigint) return this._getInvalidInput(e); let r; const s = new oe(); for (const a of this._def.checks) a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), I(r, { code: x.too_small, type: "bigint", minimum: a.value, inclusive: a.inclusive, message: a.message }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), I(r, { code: x.too_big, type: "bigint", maximum: a.value, inclusive: a.inclusive, message: a.message }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), I(r, { code: x.not_multiple_of, multipleOf: a.value, message: a.message }), s.dirty()) : J.assertNever(a); return { status: s.value, value: e.data }; } _getInvalidInput(e) { const t = this._getOrReturnCtx(e); return I(t, { code: x.invalid_type, expected: k.bigint, received: t.parsedType }), P; } gte(e, t) { return this.setLimit("min", e, !0, C.toString(t)); } gt(e, t) { return this.setLimit("min", e, !1, C.toString(t)); } lte(e, t) { return this.setLimit("max", e, !0, C.toString(t)); } lt(e, t) { return this.setLimit("max", e, !1, C.toString(t)); } setLimit(e, t, r, s) { return new Gt({ ...this._def, checks: [ ...this._def.checks, { kind: e, value: t, inclusive: r, message: C.toString(s) } ] }); } _addCheck(e) { return new Gt({ ...this._def, checks: [...this._def.checks, e] }); } positive(e) { return this._addCheck({ kind: "min", value: BigInt(0), inclusive: !1, message: C.toString(e) }); } negative(e) { return this._addCheck({ kind: "max", value: BigInt(0), inclusive: !1, message: C.toString(e) }); } nonpositive(e) { return this._addCheck({ kind: "max", value: BigInt(0), inclusive: !0, message: C.toString(e) }); } nonnegative(e) { return this._addCheck({ kind: "min", value: BigInt(0), inclusive: !0, message: C.toString(e) }); } multipleOf(e, t) { return this._addCheck({ kind: "multipleOf", value: e, message: C.toString(t) }); } get minValue() { let e = null; for (const t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value); return e; } get maxValue() { let e = null; for (const t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value); return e; } } Gt.create = (n) => new Gt({ checks: [], typeName: S.ZodBigInt, coerce: (n == null ? void 0 : n.coerce) ?? !1, ...j(n) }); class hr extends Z { _parse(e) { if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== k.boolean) { const r = this._getOrReturnCtx(e); return I(r, { code: x.invalid_type, expected: k.boolean, received: r.parsedType }), P; } return ve(e.data); } } hr.create = (n) => new hr({ typeName: S.ZodBoolean, coerce: (n == null ? void 0 : n.coerce) || !1, ...j(n) }); class Nn extends Z { _parse(e) { if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== k.date) { const a = this._getOrReturnCtx(e); return I(a, { code: x.invalid_type, expected: k.date, received: a.parsedType }), P; } if (Number.isNaN(e.data.getTime())) { const a = this._getOrReturnCtx(e); return I(a, { code: x.invalid_date }), P; } const r = new oe(); let s; for (const a of this._def.checks) a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), I(s, { code: x.too_small, message: a.message, inclusive: !0, exact: !1, minimum: a.value, type: "date" }), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), I(s, { code: x.too_big, message: a.message, inclusive: !0, exact: !1, maximum: a.value, type: "date" }), r.dirty()) : J.assertNever(a); return { status: r.value, value: new Date(e.data.getTime()) }; } _addCheck(e) { return new Nn({ ...this._def, checks: [...this._def.checks, e] }); } min(e, t) { return this._addCheck({ kind: "min", value: e.getTime(), message: C.toString(t) }); } max(e, t) { return this._addCheck({ kind: "max", value: e.getTime(), message: C.toString(t) }); } get minDate() { let e = null; for (const t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value); return e != null ? new Date(e) : null; } get maxDate() { let e = null; for (const t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value); return e != null ? new Date(e) : null; } } Nn.create = (n) => new Nn({ checks: [], coerce: (n == null ? void 0 : n.coerce) || !1, typeName: S.ZodDate, ...j(n) }); class us extends Z { _parse(e) { if (this._getType(e) !== k.symbol) { const r = this._getOrReturnCtx(e); return I(r, { code: x.invalid_type, expected: k.symbol, received: r.parsedType }), P; } return ve(e.data); } } us.create = (n) => new us({ typeName: S.ZodSymbol, ...j(n) }); class mr extends Z { _parse(e) { if (this._getType(e) !== k.undefined) { const r = this._getOrReturnCtx(e); return I(r, { code: x.invalid_type, expected: k.undefined, received: r.parsedType }), P; } return ve(e.data); } } mr.create = (n) => new mr({ typeName: S.ZodUndefined, ...j(n) }); class gr extends Z { _parse(e) { if (this._getType(e) !== k.null) { const r = this._getOrReturnCtx(e); return I(r, { code: x.invalid_type, expected: k.null, received: r.parsedType }), P; } return ve(e.data); } } gr.create = (n) => new gr({ typeName: S.ZodNull, ...j(n) }); class _r extends Z { constructor() { super(...arguments), this._any = !0; } _parse(e) { return ve(e.data); } } _r.create = (n) => new _r({ typeName: S.ZodAny, ...j(n) }); class cs extends Z { constructor() { super(...arguments), this._unknown = !0; } _parse(e) { return ve(e.data); } } cs.create = (n) => new cs({ typeName: S.ZodUnknown, ...j(n) }); class ze extends Z { _parse(e) { const t = this._getOrReturnCtx(e); return I(t, { code: x.invalid_type, expected: k.never, received: t.parsedType }), P; } } ze.create = (n) => new ze({ typeName: S.ZodNever, ...j(n) }); class ds extends Z { _parse(e) { if (this._getType(e) !== k.undefined) { const r = this._getOrReturnCtx(e); return I(r, { code: x.invalid_type, expected: k.void, received: r.parsedType }), P; } return ve(e.data); } } ds.create = (n) => new ds({ typeName: S.ZodVoid, ...j(n) }); class Ie extends Z { _parse(e) { const { ctx: t, status: r } = this._processInputParams(e), s = this._def; if (t.parsedType !== k.array) return I(t, { code: x.invalid_type, expected: k.array, received: t.parsedType }), P; if (s.exactLength !== null) { const i = t.data.length > s.exactLength.value, u = t.data.length < s.exactLength.value; (i || u) && (I(t, { code: i ? x.too_big : x.too_small, minimum: u ? s.exactLength.value : void 0, maximum: i ? s.exactLength.value : void 0, type: "array", inclusive: !0, exact: !0, message: s.exactLength.message }), r.dirty()); } if (s.minLength !== null && t.data.length < s.minLength.value && (I(t, { code: x.too_small, minimum: s.minLength.value, type: "array", inclusive: !0, exact: !1, message: s.minLength.message }), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (I(t, { code: x.too_big, maximum: s.maxLength.value, type: "array", inclusive: !0, exact: !1, message: s.maxLength.message }), r.dirty()), t.common.async) return Promise.all([...t.data].