LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download

    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • swap_horiz
      Codec
    • schema
      Standard Schema
    • format_quote
      String

    • error
      Stack

  • JSON Schema

    • data_object
      Schema to JSON
    • code
      JSON to Schema
    • verified
      Compliance

    • deployed_code
      Libraries

    • article
      Blog
Expand sidebarExpand sidebar
zod (compile)/Compiled (minified)Compiled (minified)
github
GitHubGitHub
DiscordDiscord
PreferencesPreferences
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures
schemas/libraries/zod/download_compiled/compile/minified.js
code_off
View RawView Raw
Copy to clipboardCopy to clipboard
schemas/libraries/zod/download_compiled/compile/minified.js
code_off
View RawView Raw
Copy to clipboardCopy to clipboard
schemas/libraries/zod/download_compiled/compile/minified.js
code_off
View RawView Raw
Copy to clipboardCopy to clipboard
schemas/libraries/zod/download_compiled/compile/minified.js
code_off
View RawView Raw
Copy to clipboardCopy to clipboard
function e() { return (e) => e; } function t(e) { let t = Object.values(e).filter( (e) => typeof e == `number`, ); return Object.entries(e) .filter( ([e, n]) => t.indexOf(+e) === -1, ) .map(([e, t]) => t); } function n(e, t = `|`) { return e.map((e) => se(e)).join(t); } function r(e, t) { return typeof t == `bigint` ? t.toString() : t; } var i = class { constructor(e) { ((this._getter = e), (this._value = void 0)); } get value() { let e = this._getter; return ( e !== void 0 && ((this._value = e()), (this._getter = void 0)), this._value ); } }; function a(e) { return new i(e); } function o(e) { return e == null; } function s(e) { let t = +!!e.startsWith(`^`), n = e.endsWith(`$`) ? e.length - 1 : e.length; return e.slice(t, n); } function c(e, t) { let n = e / t, r = Math.round(n), i = 4 * 2 ** -52 * Math.max(Math.abs(n), 1); return Math.abs(n - r) < i ? 0 : n - r; } function l(e, t, n) { Object.defineProperty(e, t, { value: n, writable: !0, enumerable: !0, configurable: !0, }); } function u(e) { let t = Object.getOwnPropertyDescriptor( e, `shape`, ); return t?.get ? t.get.raw : t?.value; } function d(e) { return ( u(e._zod.def) ?? e._zod.def.shape ); } function f(e, t, n) { Object.defineProperty(e, t, { get() { let e = n(); return (l(this, t, e), e); }, enumerable: !0, configurable: !0, }); } function p(e, t, n) { t in e ? l(e, t, n) : (e[t] = n); } function m(e, t, n, r) { let i = d(t); for (let a of n) { let n = Object.getOwnPropertyDescriptor( i, a, ); n.enumerable && (n.get ? f(e, a, () => { let e = t._zod.def.shape[a]; return r ? r(e, a) : e; }) : p( e, a, r ? r(n.value, a) : n.value, )); } } function h(e, t) { for (let n of Reflect.ownKeys(t)) { let r = Object.getOwnPropertyDescriptor( t, n, ); r.enumerable && (r.get ? f(e, n, () => t[n]) : p(e, n, r.value)); } } function g(...e) { let t = {}; for (let n of e) { let e = Object.getOwnPropertyDescriptors( n, ); Object.assign(t, e); } return Object.defineProperties({}, t); } function _(e) { return JSON.stringify(e); } function ee(e) { return e .toLowerCase() .trim() .replace(/[^\w\s-]/g, ``) .replace(/[\s_-]+/g, `-`) .replace(/^-+|-+$/g, ``); } const te = `captureStackTrace` in Error ? Error.captureStackTrace : (...e) => {}; function ne(e) { return ( typeof e == `object` && !!e && !Array.isArray(e) ); } const re = /* @__PURE__*/ a(() => { if ( O.jitless || (typeof navigator < `u` && navigator?.userAgent?.includes( `Cloudflare`, )) ) return !1; try { return (Function(``), !0); } catch { return !1; } }); function v(e) { if (ne(e) === !1) return !1; let t = e.constructor; if ( t === void 0 || typeof t != `function` ) return !0; let n = t.prototype; return ( ne(n) !== !1 && Object.prototype.hasOwnProperty.call( n, `isPrototypeOf`, ) !== !1 ); } function ie(e) { return v(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e; } const ae = /* @__PURE__*/ new Set([ `string`, `number`, `symbol`, ]); function oe(e) { return e.replace( /[.*+?^${}()|[\]\\]/g, `\\$&`, ); } function y(e, t, n) { let r = new e._zod.constr( t ?? e._zod.def, ); return ( (!t || n?.parent) && (r._zod.parent = e), r ); } function b(e) { let t = e; if (!t) return {}; if (typeof t == `string`) return { error: () => t }; if (t?.message !== void 0) { if (t?.error !== void 0) throw Error( "Cannot specify both `message` and `error` params", ); t.error = t.message; } return ( delete t.message, typeof t.error == `string` ? { ...t, error: () => t.error } : t ); } function se(e) { return typeof e == `bigint` ? e.toString() + `n` : typeof e == `string` ? `"${e}"` : `${e}`; } function ce(e) { return Object.keys(e).filter( (t) => e[t]._zod.optin !== void 0 && e[t]._zod.optout === `optional`, ); } const le = { safeint: [ -(2 ** 53 - 1), 2 ** 53 - 1, ], int32: [-2147483648, 2147483647], uint32: [0, 4294967295], float32: [ -34028234663852886e22, 34028234663852886e22, ], float64: [ -Number.MAX_VALUE, Number.MAX_VALUE, ], }, ue = { int64: [ /* @__PURE__*/ BigInt( `-9223372036854775808`, ), /* @__PURE__*/ BigInt( `9223372036854775807`, ), ], uint64: [ /* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt( `18446744073709551615`, ), ], }; function de(e, t) { let n = e._zod.def, r = n.checks; if (r && r.length > 0) throw Error( `.pick() cannot be used on object schemas containing refinements`, ); let i = {}; return ( m(i, e, fe(e, t)), y(e, g(n, { shape: i, checks: [] })) ); } function fe(e, t) { let n = d(e), r = []; for (let e of Reflect.ownKeys(t)) { if ( !Object.getOwnPropertyDescriptor( n, e, )?.enumerable ) throw Error( `Unrecognized key: "${String(e)}"`, ); t[e] && r.push(e); } return r; } function pe(e, t) { let n = e._zod.def, r = n.checks; if (r && r.length > 0) throw Error( `.omit() cannot be used on object schemas containing refinements`, ); let i = new Set(fe(e, t)), a = {}; return ( m( a, e, Reflect.ownKeys(d(e)).filter( (e) => !i.has(e), ), ), y(e, g(n, { shape: a, checks: [] })) ); } function me(e, t) { if (!v(t)) throw Error( `Invalid input to extend: expected a plain object`, ); let n = e._zod.def.checks; if (n && n.length > 0) { let n = d(e); for (let e of Reflect.ownKeys(t)) if ( Object.getOwnPropertyDescriptor( n, e, ) !== void 0 ) throw Error( "Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.", ); } return y( e, g(e._zod.def, { shape: he(e, t) }), ); } function he(e, t) { let n = {}; return ( m(n, e, Reflect.ownKeys(d(e))), h(n, t), n ); } function ge(e, t) { if (!v(t)) throw Error( `Invalid input to safeExtend: expected a plain object`, ); return y( e, g(e._zod.def, { shape: he(e, t) }), ); } function _e(e, t) { if (!t?._zod?.def) throw Error( "Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.", ); if (e._zod.def.checks?.length) throw Error( `.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`, ); let n = {}; return ( m(n, e, Reflect.ownKeys(d(e))), m(n, t, Reflect.ownKeys(d(t))), y( e, g(e._zod.def, { shape: n, get catchall() { return t._zod.def.catchall; }, checks: t._zod.def.checks ?? [], }), ) ); } function ve(e, t, n, r = `partial`) { let i = t._zod.def.checks; if (i && i.length > 0) throw Error( `.${r}() cannot be used on object schemas containing refinements`, ); let a = n ? new Set(fe(t, n)) : void 0, o = {}; return ( m( o, t, Reflect.ownKeys(d(t)), e && ((t, n) => a && !a.has(n) ? t : new e({ type: `optional`, innerType: t, })), ), y( t, g(t._zod.def, { shape: o, checks: [], }), ) ); } function ye(e, t, n) { let r = n ? new Set(fe(t, n)) : void 0, i = {}; return ( m( i, t, Reflect.ownKeys(d(t)), (t, n) => r && !r.has(n) ? t : new e({ type: `nonoptional`, innerType: t, }), ), y(t, g(t._zod.def, { shape: i })) ); } function x(e, t = 0) { if (e.aborted === !0) return !0; for ( let n = t; n < e.issues.length; n++ ) if (e.issues[n]?.continue !== !0) return !0; return !1; } function be(e, t = 0) { if (e.aborted === !0) return !0; for ( let n = t; n < e.issues.length; n++ ) if (e.issues[n]?.continue === !1) return !0; return !1; } function xe(e, t) { return t.map((t) => { var n; return ( (n = t).path ?? (n.path = []), t.path.unshift(e), t ); }); } function Se(e) { return typeof e == `string` ? e : e?.message; } function Ce(e, t, n) { var r; for (let i = t; i < e.length; i++) (r = e[i]).schema ?? (r.schema = n); } function S(e, t, n) { var r; let i = e.inst?._zod?.traits; i?.has(`$ZodType`) && (i.has(`$ZodCheck`) ? ((r = e).schema ?? (r.schema = e.inst)) : (e.schema = e.inst)); let a = e.schema === e.inst ? void 0 : e.schema?._zod.def?.error, o = e.message ? e.message : (Se( e.inst?._zod.def?.error?.(e), ) ?? Se(a?.(e)) ?? Se(t?.error?.(e)) ?? Se(n.customError?.(e)) ?? Se(n.localeError?.(e)) ?? `Invalid input`), s = {}; for (let t of Object.keys(e)) t !== `inst` && t !== `schema` && t !== `continue` && t !== `input` && t !== `__proto__` && (s[t] = e[t]); return ( (s.path ??= []), (s.message = o), t?.reportInput && (s.input = e.input), s ); } const we = /[\uD800-\uDBFF]/; function Te(e) { let t = e.length; if (!we.test(e)) return t; let n = t; for (let r = 0; r < t - 1; r++) (e.charCodeAt(r) & 64512) == 55296 && (e.charCodeAt(r + 1) & 64512) == 56320 && (n--, r++); return n; } function Ee(e) { return Array.isArray(e) ? `array` : typeof e == `string` ? `string` : `unknown`; } function De(e) { let t = typeof e; switch (t) { case `number`: return Number.isNaN(e) ? `nan` : `number`; case `object`: { if (e === null) return `null`; if (Array.isArray(e)) return `array`; let t = e; if ( t && Object.getPrototypeOf(t) !== Object.prototype && `constructor` in t && t.constructor ) return t.constructor.name; } } return t; } function Oe(...e) { let [t, n, r] = e; return typeof t == `string` ? { message: t, code: `custom`, input: n, inst: r, } : { ...t }; } function ke(e, t) { for (let n in t) { let r = Object.getOwnPropertyDescriptor( t, n, ); r.get ? Object.defineProperty(e, n, { ...r, enumerable: !1, }) : Me(e, n, r.value); } } function C(e, t, n, r = !0) { return ( Object.defineProperty(e, t, { configurable: !0, writable: !0, enumerable: r, value: n, }), n ); } function Ae(e, t, n) { return C(e, t, n, !1); } function je(e, t) { for (let n in e) { let r = e[n]; Object.defineProperty(t, n, { configurable: !0, enumerable: !0, get() { return C(this, n, r(this)); }, set(e) { C(this, n, e); }, }); } return t; } function Me(e, t, n) { Object.defineProperty(e, t, { configurable: !0, get() { return this == null ? n : C(this, t, n.bind(this)); }, set(e) { C(this, t, e); }, }); } function Ne(e, t) { let n = Object.getPrototypeOf(e); return t in n ? void 0 : n; } let Pe, w = !1; const Fe = { configurable: !0, get() { w = !0; }, }; function T(e, t, n) { let r = Object.getPrototypeOf(e._zod); if (t in r && Pe !== e._zod) { Pe = void 0; return; } ((Pe = e._zod), Object.defineProperty(r, t, { configurable: !0, get() { Object.defineProperty( this, t, Fe, ); let e = w; w = !1; try { let r = n(this); return ( w ? delete this[t] : Object.defineProperty( this, t, { configurable: !0, writable: !0, value: r, }, ), (w ||= e), r ); } catch (n) { throw ( delete this[t], (w ||= e), n ); } }, set(e) { Object.defineProperty(this, t, { configurable: !0, writable: !0, value: e, }); }, })); } function Ie(e, t, n, r) { let i = Ne(e, t); i && Object.defineProperty(i, t, { configurable: !0, get() { let e = { configurable: !0, writable: !0, enumerable: r, value: void 0, }; return ( Object.defineProperty( this, t, e, ), (e.value = n(this)), Object.defineProperty( this, t, e, ), e.value ); }, set(e) { Object.defineProperty(this, t, { configurable: !0, writable: !0, enumerable: r, value: e, }); }, }); } function Le(e) { let t = () => e; return ( (t[`~constantCatch`] = !0), t ); } var Re; const ze = { value: void 0, enumerable: !1, }; let Be = `captureStackTrace` in Error ? Error : null; function Ve(e) { let t = Be; if (t) { let n = t.stackTraceLimit; if (typeof n == `number`) { try { t.stackTraceLimit = 0; } catch { return ((Be = null), new e()); } try { return new e(); } finally { t.stackTraceLimit = n; } } } return new e(); } function E(e, t, n, r) { let i = {}; function a(e) { ((this.def = e), (this.constr = d), (this.traits = /* @__PURE__ */ new Set())); } a.prototype = i; let o = n, s = o && /* @__PURE__ */ new WeakSet(); function c(n, r) { if (!n._zod) { ze.value = new a(r); try { Object.defineProperty( n, "_zod", ze, ); } finally { ze.value = void 0; } } else if (n._zod.traits.has(e)) return; if ( (n._zod.traits.add(e), t(n, r), s) ) { let e = Object.getPrototypeOf(n), t = n._zod.constr.prototype, r = e; for (; r && r !== t;) r = Object.getPrototypeOf(r); let i = r ?? e; s.has(i) || (s.add(i), ke(i, o)); } let i = d.prototype; for (let e in i) Object.prototype.hasOwnProperty.call( i, e, ) && (e in n || (n[e] = i[e].bind(n))); } let l = r?.Parent ?? Object; class u extends l {} Object.defineProperty(u, "name", { value: e, }); function d(e) { let t = r?.Parent ? Ve(u) : this; c(t, e); let n = t._zod.deferred; if (n) { for (let e of n) e(); t._zod.deferred = void 0; } let i = globalThis.__zod_globalConfig ?.postProcessor; return (i && i(t), t); } return ( Object.defineProperty(d, "init", { value: c, }), Object.defineProperty( d, Symbol.hasInstance, { value: (t) => r?.Parent && t instanceof r.Parent ? !0 : t?._zod?.traits?.has(e), }, ), Object.defineProperty(d, "name", { value: e, }), d ); } var D = class extends Error { constructor() { super( `Encountered Promise during synchronous parse. Use .parseAsync() instead.`, ); } }, He = class extends Error { constructor(e) { (super( `Encountered unidirectional transform during encode: ${e}`, ), (this.name = `ZodEncodeError`)); } }; (Re = globalThis).__zod_globalConfig ?? (Re.__zod_globalConfig = {}); const O = globalThis.__zod_globalConfig; function k(e) { return (e && Object.assign(O, e), O); } function Ue() { let e = this._zod; return ( (e.message ??= JSON.stringify( e.def, r, 2, )), e.message ); } function We(e) { this._zod.message = e; } const Ge = { get: Ue, set: We, enumerable: !0, configurable: !0, }, Ke = { value: void 0, enumerable: !1, }, qe = /* @__PURE__ */ new WeakSet([ Object.prototype, Error.prototype, ]), Je = (e, t) => { ((e.name = `$ZodError`), (Ke.value = t), Object.defineProperty( e, "issues", Ke, ), (Ke.value = void 0), Object.defineProperty( e, "message", Ge, )); let n = Object.getPrototypeOf(e); qe.has(n) || (qe.add(n), Object.defineProperty( n, "toString", { configurable: !0, enumerable: !1, get() { let e = () => this.message; return ( Object.defineProperty( this, "toString", { value: e, configurable: !0, writable: !0, }, ), e ); }, set(e) { Object.defineProperty( this, "toString", { value: e, configurable: !0, writable: !0, }, ); }, }, )); }, Ye = E(`$ZodError`, Je); E(`$ZodError`, Je, void 0, { Parent: Error, }); function Xe(e, t, n) { return ( Object.prototype.hasOwnProperty.call( e, t, ) || (t === `__proto__` ? Object.defineProperty(e, t, { value: n(), writable: !0, enumerable: !0, configurable: !0, }) : (e[t] = n())), e[t] ); } function Ze(e, t = (e) => e.message) { let n = {}, r = []; for (let i of e.issues) i.path.length > 0 ? Xe(n, i.path[0], () => []).push( t(i), ) : r.push(t(i)); return { formErrors: r, fieldErrors: n, }; } function Qe(e, t = (e) => e.message) { let n = { _errors: [] }, r = (e, i = []) => { for (let a of e.issues) if ( a.code === `invalid_union` && a.errors.length ) a.errors.map((e) => r({ issues: e }, [ ...i, ...a.path, ]), ); else if ( a.code === `invalid_key` ) r({ issues: a.issues }, [ ...i, ...a.path, ]); else if ( a.code === `invalid_element` ) r({ issues: a.issues }, [ ...i, ...a.path, ]); else { let e = [...i, ...a.path]; if (e.length === 0) n._errors.push(t(a)); else { let r = n, i = 0; for (; i < e.length;) { let n = e[i], o = i === e.length - 1; if (n === `_errors`) { (o && r._errors.push(t(a)), i++); continue; } Object.prototype.hasOwnProperty.call( r, n, ) || Object.defineProperty( r, n, { value: { _errors: [], }, enumerable: !0, writable: !0, configurable: !0, }, ); let s = r[n]; (o && s._errors.push(t(a)), (r = s), i++); } } } }; return (r(e), n); } function $e(e, t) { return { callee: t?.callee ?? e, Err: t?.Err, }; } const et = (e) => { let t = (n, r, i, a) => { let o = i ? { ...i, async: !1 } : { async: !1 }, s = n._zod.run( { value: r, issues: [] }, o, ); if (s instanceof Promise) throw new D(); if (s.issues.length) { let n = new (a?.Err ?? e)( s.issues.map((e) => S(e, o, k()), ), ); throw ( te(n, a?.callee ?? t), n ); } return s.value; }; return t; }, tt = (e) => { let t = async (n, r, i, a) => { let o = i ? { ...i, async: !0 } : { async: !0 }, s = n._zod.run( { value: r, issues: [] }, o, ); if ( (s instanceof Promise && (s = await s), s.issues.length) ) { let n = new (a?.Err ?? e)( s.issues.map((e) => S(e, o, k()), ), ); throw ( te(n, a?.callee ?? t), n ); } return s.value; }; return t; }, nt = (e) => (t, n, r) => { let i = r ? { ...r, async: !1 } : { async: !1 }, a = t._zod.run( { value: n, issues: [] }, i, ); if (a instanceof Promise) throw new D(); return a.issues.length ? rt(e, a.issues, i) : { success: !0, data: a.value }; }; function rt(e, t, n) { let r; return { success: !1, get error() { return ( r || ((r = new e( t.map((e) => S(e, n, k())), )), (t = void 0), (n = void 0)), r ); }, set error(e) { ((r = e), (t = void 0), (n = void 0)); }, }; } const it = (e) => async (t, n, r) => { let i = r ? { ...r, async: !0 } : { async: !0 }, a = t._zod.run( { value: n, issues: [] }, i, ); return ( a instanceof Promise && (a = await a), a.issues.length ? rt(e, a.issues, i) : { success: !0, data: a.value } ); }, at = /* @__PURE__ */ Symbol.for( `zod.compile.invalid`, ), ot = /* @__PURE__ */ Symbol.for( `zod.compile.fallback`, ), st = (e, t, n) => { let r = e._zod.bag.validator; if (r !== void 0) { if (r(t) !== at) return !0; if ( r.definite === !0 && n === void 0 ) return !1; } return ct(e, t, n); }; function ct(e, t, n) { let r = n ? { ...n, async: !1, abortEarly: !0, } : { async: !1, abortEarly: !0 }, i = e._zod.bag.fallbackRun, a; if ( (i ? ((r[ot] = !0), (a = i( { value: t, issues: [] }, r, ))) : (a = e._zod.run( { value: t, issues: [] }, r, )), a instanceof Promise) ) throw new D(); return a.issues.length === 0; } const lt = async (e, t, n) => { let r = n ? { ...n, async: !0, abortEarly: !0, } : { async: !0, abortEarly: !0 }, i = e._zod.run( { value: t, issues: [] }, r, ); return ( i instanceof Promise && (i = await i), i.issues.length === 0 ); }, ut = (e) => { let t = et(e), n = (e, r, i, a) => { let o = i ? { ...i, direction: `backward`, } : { direction: `backward` }; return t(e, r, o, $e(n, a)); }; return n; }, dt = (e) => { let t = et(e), n = (e, r, i, a) => t(e, r, i, $e(n, a)); return n; }, ft = (e) => { let t = tt(e), n = async (e, r, i, a) => { let o = i ? { ...i, direction: `backward`, } : { direction: `backward` }; return await t( e, r, o, $e(n, a), ); }; return n; }, pt = (e) => { let t = tt(e), n = async (e, r, i, a) => await t(e, r, i, $e(n, a)); return n; }, mt = (e) => (t, n, r) => { let i = r ? { ...r, direction: `backward` } : { direction: `backward` }; return nt(e)(t, n, i); }, ht = (e) => (t, n, r) => nt(e)(t, n, r), gt = (e) => async (t, n, r) => { let i = r ? { ...r, direction: `backward` } : { direction: `backward` }; return it(e)(t, n, i); }, _t = (e) => async (t, n, r) => it(e)(t, n, r), vt = /^[cC][0-9a-z]{6,}$/, yt = /^[0-9a-z]+$/, bt = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/, xt = /^[0-9a-vA-V]{20}$/, St = /^[A-Za-z0-9]{27}$/, Ct = /^[a-zA-Z0-9_-]{21}$/; function wt(e) { return RegExp( `^[a-zA-Z0-9_-]{${e}}$`, ); } const Tt = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Et = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Dt = (e) => e ? RegExp( `^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`, ) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Ot = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; function kt() { return RegExp( `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`, `u`, ); } const At = /^(?:(?: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])$/, jt = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, Mt = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, Nt = /^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Pt = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Ft = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/, It = /^https?$/, Lt = /^\+[1-9]\d{6,14}$/, Rt = /^\d(?:[ -]?\d){11,18}$/, zt = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/, Bt = `(?:(?:\\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])))`; function Vt(e) { return RegExp(`^${e}$`); } const Ht = /*@__PURE__*/ Vt(Bt); function Ut(e) { let t = `(?:[01]\\d|2[0-3]):[0-5]\\d`; return typeof e.precision == `number` ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : e.seconds ? `${t}:[0-5]\\d(?:\\.\\d+)?` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`; } function Wt(e) { return RegExp(`^${Ut(e)}$`); } function Gt(e) { let t = [`Z`]; e.offset && t.push( `([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`, ); let n = `${Ut({ precision: e.precision, seconds: !0 })}(?:${t.join(`|`)})`, r = e.local ? `${n}|${Ut({ precision: e.precision })}` : n; return RegExp(`^${Bt}T(?:${r})$`); } const Kt = /^[\s\S]{0,}$/, qt = /^-?\d+(?:\.\d+)?$/, Jt = /^[^A-Z]*$/, Yt = /^[^a-z]*$/, A = /*@__PURE__*/ E( `$ZodCheck`, (e, t) => { var n; ((e._zod ??= {}), (e._zod.def = t), (n = e._zod).onattach ?? (n.onattach = [])); }, ), Xt = (e) => { let t = e.value; return !o(t) && t.length !== void 0; }, Zt = { number: `number`, bigint: `bigint`, object: `date`, }, Qt = /*@__PURE__*/ E( `$ZodCheckLessThan`, (e, t) => { A.init(e, t); let n = Zt[typeof t.value]; e._zod.check = (r) => { (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({ origin: Zt[typeof r.value] ?? n, code: `too_big`, maximum: typeof t.value == `object` ? t.value.getTime() : t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort, }); }; }, ), $t = /*@__PURE__*/ E( `$ZodCheckGreaterThan`, (e, t) => { A.init(e, t); let n = Zt[typeof t.value]; e._zod.check = (r) => { (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({ origin: Zt[typeof r.value] ?? n, code: `too_small`, minimum: typeof t.value == `object` ? t.value.getTime() : t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort, }); }; }, ), en = /*@__PURE__*/ E( `$ZodCheckMultipleOf`, (e, t) => { (A.init(e, t), (e._zod.check = (n) => { if ( typeof n.value != typeof t.value ) throw Error( `Cannot mix number and bigint in multiple_of check.`, ); (typeof n.value == `bigint` ? t.value !== BigInt(0) && n.value % t.value === BigInt(0) : c(n.value, t.value) === 0) || n.issues.push({ origin: typeof n.value, code: `not_multiple_of`, divisor: t.value, input: n.value, inst: e, continue: !t.abort, }); })); }, ), tn = /*@__PURE__*/ E( `$ZodCheckNumberFormat`, (e, t) => { (A.init(e, t), (t.format = t.format || `float64`)); let n = t.format?.includes(`int`), r = n ? `int` : `number`, [i, a] = le[t.format]; e._zod.check = (o) => { let s = o.value; if (n) { if (!Number.isInteger(s)) { o.issues.push({ expected: r, format: t.format, code: `invalid_type`, continue: !1, input: s, inst: e, }); return; } if ( !Number.isSafeInteger(s) ) { s > 0 ? o.issues.push({ input: s, code: `too_big`, maximum: 2 ** 53 - 1, note: `Integers must be within the safe integer range.`, inst: e, origin: r, inclusive: !0, continue: !t.abort, }) : o.issues.push({ input: s, code: `too_small`, minimum: -( 2 ** 53 - 1 ), note: `Integers must be within the safe integer range.`, inst: e, origin: r, inclusive: !0, continue: !t.abort, }); return; } } (s < i && o.issues.push({ origin: `number`, input: s, code: `too_small`, minimum: i, inclusive: !0, inst: e, continue: !t.abort, }), s > a && o.issues.push({ origin: `number`, input: s, code: `too_big`, maximum: a, inclusive: !0, inst: e, continue: !t.abort, })); }; }, ), nn = /*@__PURE__*/ E( `$ZodCheckMaxLength`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length; if ( (typeof r == `string` && i > t.maximum ? Te(r) : i) <= t.maximum ) return; let a = Ee(r); n.issues.push({ origin: a, code: `too_big`, maximum: t.maximum, inclusive: !0, input: r, inst: e, continue: !t.abort, }); })); }, ), rn = /*@__PURE__*/ E( `$ZodCheckMinLength`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length; if ( (typeof r == `string` && i >= t.minimum && i < t.minimum * 2 ? Te(r) : i) >= t.minimum ) return; let a = Ee(r); n.issues.push({ origin: a, code: `too_small`, minimum: t.minimum, inclusive: !0, input: r, inst: e, continue: !t.abort, }); })); }, ), an = /*@__PURE__*/ E( `$ZodCheckLengthEquals`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length, a = typeof r == `string` && i >= t.length && i <= t.length * 2 ? Te(r) : i; if (a === t.length) return; let o = Ee(r), s = a > t.length; n.issues.push({ origin: o, ...(s ? { code: `too_big`, maximum: t.length, } : { code: `too_small`, minimum: t.length, }), inclusive: !0, exact: !0, input: n.value, inst: e, continue: !t.abort, }); })); }, ), on = /*@__PURE__*/ E( `$ZodCheckStringFormat`, (e, t) => { var n, r; (A.init(e, t), t.pattern ? ((n = e._zod).check ?? (n.check = (n) => { ((t.pattern.lastIndex = 0), !t.pattern.test( n.value, ) && n.issues.push({ origin: `string`, code: `invalid_format`, format: t.format, input: n.value, ...(t.pattern ? { pattern: t.pattern.toString(), } : {}), inst: e, continue: !t.abort, })); })) : ((r = e._zod).check ?? (r.check = () => {}))); }, ), sn = /*@__PURE__*/ E( `$ZodCheckRegex`, (e, t) => { (on.init(e, t), (e._zod.check = (n) => { ((t.pattern.lastIndex = 0), !t.pattern.test(n.value) && n.issues.push({ origin: `string`, code: `invalid_format`, format: `regex`, input: n.value, pattern: t.pattern.toString(), inst: e, continue: !t.abort, })); })); }, ), cn = /*@__PURE__*/ E( `$ZodCheckLowerCase`, (e, t) => { ((t.pattern ??= Jt), on.init(e, t)); }, ), ln = /*@__PURE__*/ E( `$ZodCheckUpperCase`, (e, t) => { ((t.pattern ??= Yt), on.init(e, t)); }, ), un = /*@__PURE__*/ E( `$ZodCheckIncludes`, (e, t) => { A.init(e, t); let n = oe(t.includes); ((t.pattern = new RegExp( typeof t.position == `number` ? `^.{${t.position},}${n}` : n, )), (e._zod.check = (n) => { n.value.includes( t.includes, t.position, ) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `includes`, includes: t.includes, input: n.value, inst: e, continue: !t.abort, }); })); }, ), dn = /*@__PURE__*/ E( `$ZodCheckStartsWith`, (e, t) => { A.init(e, t); let n = RegExp( `^${oe(t.prefix)}.*`, ); ((t.pattern ??= n), (e._zod.check = (n) => { n.value.startsWith( t.prefix, ) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `starts_with`, prefix: t.prefix, input: n.value, inst: e, continue: !t.abort, }); })); }, ), fn = /*@__PURE__*/ E( `$ZodCheckEndsWith`, (e, t) => { A.init(e, t); let n = RegExp( `.*${oe(t.suffix)}$`, ); ((t.pattern ??= n), (e._zod.check = (n) => { n.value.endsWith(t.suffix) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `ends_with`, suffix: t.suffix, input: n.value, inst: e, continue: !t.abort, }); })); }, ), pn = /*@__PURE__*/ E( `$ZodCheckOverwrite`, (e, t) => { (A.init(e, t), (e._zod.check = (e) => { e.value = t.tx(e.value); })); }, ); var mn = class { constructor(e = [], t = {}) { ((this.content = []), (this.indent = 0), (this.args = e), (this.closed = t)); } indented(e) { this.indent += 1; try { e(this); } finally { --this.indent; } } write(e) { if (typeof e == `function`) { (e(this, { execution: `sync` }), e(this, { execution: `async`, })); return; } let t = e .split(` `) .filter((e) => e), n = Math.min( ...t.map( (e) => e.length - e.trimStart().length, ), ), r = t .map((e) => e.slice(n)) .map( (e) => ` `.repeat( this.indent * 2, ) + e, ); for (let e of r) this.content.push(e); } compile() { let e = Function, t = this?.content ?? [``]; return new e( ...Object.keys(this.closed), `return function (${this.args.join(`, `)}) {\n${t.join(` `)}\n};`, )(...Object.values(this.closed)); } }; const hn = { major: 4, minor: 6, patch: 5, }, j = /*@__PURE__*/ E( `$ZodType`, (e, t) => { var n; ((e ??= {}), (e._zod.def = t), (e._zod.bag = e._zod.bag || {}), (e._zod.version = hn)); let r = e._zod.def.checks, i = e._zod.traits.has( `$ZodCheck`, ) ? [e, ...(r ?? [])] : r?.length ? [...r] : []; for (let t of i) for (let n of t._zod.onattach) n(e); if (i.length === 0) ((n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => { e._zod.run = e._zod.parse; })); else { let t = (t, n, r) => { if (t.memo) return t; let i = x(t), a; for (let o of n) { if (o._zod.def.when) { if ( be(t) || !o._zod.def.when(t) ) continue; } else if (i) continue; let n = t.issues.length, s = o._zod.check(t); if ( s instanceof Promise && r?.async === !1 ) throw new D(); if ( a || s instanceof Promise ) a = ( a ?? Promise.resolve() ).then(async () => { (await s, t.issues.length !== n && (Ce( t.issues, n, e, ), (i ||= x(t, n)))); }); else { if ( t.issues.length === n ) continue; (Ce(t.issues, n, e), (i ||= x(t, n))); } } return a ? a.then(() => t) : t; }, n = (n, r, a) => { if (x(n)) return ( (n.aborted = !0), n ); let o = t(r, i, a); if (o instanceof Promise) { if (a.async === !1) throw new D(); return o.then((t) => e._zod.parse(t, a), ); } return e._zod.parse(o, a); }; e._zod.run = (r, a) => { if (a.skipChecks) return e._zod.parse(r, a); if ( a.direction === `backward` ) { let t = e._zod.parse( { value: r.value, issues: [], }, { ...a, skipChecks: !0 }, ); return t instanceof Promise ? t.then((e) => n(e, r, a), ) : n(t, r, a); } let o = e._zod.parse(r, a); if (o instanceof Promise) { if (a.async === !1) throw new D(); return o.then((e) => t(e, i, a), ); } return t(o, i, a); }; } }, { get "~standard"() { return Ae( this, `~standard`, vn(this), ); }, set "~standard"(e) { C(this, `~standard`, e); }, }, ), gn = (e, t) => e.issues.length ? { issues: e.issues.map((e) => S(e, t, k()), ), } : { value: e.value }; async function _n(e, t) { let n = { async: !0 }; return gn( await e._zod.run( { value: t, issues: [] }, n, ), n, ); } function vn(e) { return { validate: (t) => { let n = { async: !1 }; try { let r = e._zod.run( { value: t, issues: [] }, n, ); if (!(r instanceof Promise)) return gn(r, n); } catch {} return _n(e, t); }, vendor: `zod`, version: 1, }; } const yn = /*@__PURE__*/ E( `$ZodString`, (e, t) => { (j.init(e, t), (e._zod.pattern = t.pattern ?? Kt), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = String(n.value); } catch {} return ( typeof n.value == `string` || n.issues.push({ expected: `string`, code: `invalid_type`, input: n.value, inst: e, }), n ); })); }, ), M = /*@__PURE__*/ E( `$ZodStringFormat`, (e, t) => { (on.init(e, t), yn.init(e, t)); }, ), bn = /*@__PURE__*/ E( `$ZodGUID`, (e, t) => { ((t.pattern ??= Et), M.init(e, t)); }, ), xn = /*@__PURE__*/ E( `$ZodUUID`, (e, t) => { if (t.version) { let e = { v1: 1, v2: 2, v3: 3, v4: 4, v5: 5, v6: 6, v7: 7, v8: 8, }[t.version]; if (e === void 0) throw Error( `Invalid UUID version: "${t.version}"`, ); t.pattern ??= Dt(e); } else t.pattern ??= Dt(); M.init(e, t); }, ), Sn = /*@__PURE__*/ E( `$ZodEmail`, (e, t) => { ((t.pattern ??= Ot), M.init(e, t)); }, ); function Cn(e) { try { return typeof URL < `u` && typeof URL.canParse == `function` ? URL.canParse(e) : (new URL(e), !0); } catch { return !1; } } function wn(e, t) { return !(`normalize` in t) && !(`hostname` in t) && !(`protocol` in t) ? Cn(e) || 2 : Tn(e, t); } function Tn(e, t) { if ( !t.normalize && t.protocol?.source === It.source && !/^https?:\/\//i.test(e) ) return 1; try { if (typeof URL < `u`) { let t = URL; if (typeof t.parse == `function`) return t.parse(e) ?? 2; } return new URL(e); } catch { return 2; } } const En = /[\t\n\r]/g; function Dn(e) { return e.replace(En, ``); } function On(e, t) { return ( (t.lastIndex = 0), t.test(e.hostname) ); } function kn(e, t) { return ( (t.lastIndex = 0), t.test( e.protocol.endsWith(`:`) ? e.protocol.slice(0, -1) : e.protocol, ) ); } const An = /*@__PURE__*/ E( `$ZodURL`, (e, t) => { (M.init(e, t), (e._zod.check = (n) => { try { let r = n.value.trim(), i = wn(r, t); if (i === 1) { n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid URL format`, input: n.value, inst: e, continue: !t.abort, }); return; } if (i === 2) { n.issues.push({ code: `invalid_format`, format: `url`, input: n.value, inst: e, continue: !t.abort, }); return; } if (i === !0) { n.value = Dn(r); return; } (t.hostname && !On(i, t.hostname) && n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid hostname`, pattern: t.hostname.source, input: n.value, inst: e, continue: !t.abort, }), t.protocol && !kn(i, t.protocol) && n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid protocol`, pattern: t.protocol.source, input: n.value, inst: e, continue: !t.abort, }), (n.value = t.normalize ? i.href : Dn(r))); return; } catch { n.issues.push({ code: `invalid_format`, format: `url`, input: n.value, inst: e, continue: !t.abort, }); } })); }, ), jn = /*@__PURE__*/ E( `$ZodEmoji`, (e, t) => { ((t.pattern ??= kt()), M.init(e, t)); }, ), Mn = /*@__PURE__*/ E( `$ZodNanoID`, (e, t) => { if ( t.length !== void 0 && (!Number.isInteger(t.length) || t.length < 1) ) throw Error( `Invalid nanoid length: ${t.length}`, ); ((t.pattern ??= t.length === void 0 ? Ct : wt(t.length)), M.init(e, t)); }, ), Nn = /*@__PURE__*/ E( `$ZodCUID`, (e, t) => { ((t.pattern ??= vt), M.init(e, t)); }, ), Pn = /*@__PURE__*/ E( `$ZodCUID2`, (e, t) => { ((t.pattern ??= yt), M.init(e, t)); }, ), Fn = /*@__PURE__*/ E( `$ZodULID`, (e, t) => { ((t.pattern ??= bt), M.init(e, t)); }, ), In = /*@__PURE__*/ E( `$ZodXID`, (e, t) => { ((t.pattern ??= xt), M.init(e, t)); }, ), Ln = /*@__PURE__*/ E( `$ZodKSUID`, (e, t) => { ((t.pattern ??= St), M.init(e, t)); }, ), Rn = /*@__PURE__*/ E( `$ZodISODateTime`, (e, t) => { ((t.pattern ??= Gt(t)), M.init(e, t)); }, ), zn = /*@__PURE__*/ E( `$ZodISODate`, (e, t) => { ((t.pattern ??= Ht), M.init(e, t)); }, ), Bn = /*@__PURE__*/ E( `$ZodISOTime`, (e, t) => { ((t.pattern ??= Wt(t)), M.init(e, t)); }, ), Vn = /*@__PURE__*/ E( `$ZodISODuration`, (e, t) => { ((t.pattern ??= Tt), M.init(e, t)); }, ), Hn = /*@__PURE__*/ E( `$ZodIPv4`, (e, t) => { ((t.pattern ??= At), M.init(e, t)); }, ), Un = /^[0-9a-fA-F:.]+$/; function Wn(e) { return Un.test(e) ? Cn(`http://[${e}]`) : !1; } const Gn = /*@__PURE__*/ E( `$ZodIPv6`, (e, t) => { ((t.pattern ??= jt), M.init(e, t), (e._zod.check = (n) => { Wn(n.value) || n.issues.push({ code: `invalid_format`, format: `ipv6`, input: n.value, inst: e, continue: !t.abort, }); })); }, ), Kn = /*@__PURE__*/ E( `$ZodCIDRv4`, (e, t) => { ((t.pattern ??= Mt), M.init(e, t)); }, ); function qn(e) { let t = e.split(`/`); if (t.length !== 2) return !1; let [n, r] = t; if (!r) return !1; let i = Number(r); return `${i}` !== r || i < 0 || i > 128 ? !1 : Wn(n); } const Jn = /*@__PURE__*/ E( `$ZodCIDRv6`, (e, t) => { ((t.pattern ??= Nt), M.init(e, t), (e._zod.check = (n) => { qn(n.value) || n.issues.push({ code: `invalid_format`, format: `cidrv6`, input: n.value, inst: e, continue: !t.abort, }); })); }, ); function Yn(e) { if (e === ``) return !0; if (/\s/.test(e) || e.length % 4 != 0) return !1; try { return (atob(e), !0); } catch { return !1; } } const Xn = /^[0-9a-zA-Z+/]*={0,2}$/, Zn = /*@__PURE__*/ E( `$ZodBase64`, (e, t) => { ((t.pattern ??= Xn), M.init(e, t), (e._zod.check = (n) => { Yn(n.value) || n.issues.push({ code: `invalid_format`, format: `base64`, input: n.value, inst: e, continue: !t.abort, }); })); }, ), Qn = /^[A-Za-z0-9_-]*$/; function $n(e) { if (!Qn.test(e)) return !1; let t = e.replace(/[-_]/g, (e) => e === `-` ? `+` : `/`, ); return Yn( t.padEnd( Math.ceil(t.length / 4) * 4, `=`, ), ); } const er = /*@__PURE__*/ E( `$ZodBase64URL`, (e, t) => { ((t.pattern ??= Qn), M.init(e, t), (e._zod.check = (n) => { $n(n.value) || n.issues.push({ code: `invalid_format`, format: `base64url`, input: n.value, inst: e, continue: !t.abort, }); })); }, ), tr = /*@__PURE__*/ E( `$ZodE164`, (e, t) => { ((t.pattern ??= Lt), M.init(e, t)); }, ), nr = /[- ]/g; function rr(e) { let t = e.length, n = 1, r = 0; for (; t;) { let i = e.charCodeAt(--t) - 48; ((n ^= 1), (r += n ? [ 0, 2, 4, 6, 8, 1, 3, 5, 7, 9, ][i] : i)); } return r % 10 == 0; } function ir(e) { return Rt.test(e) ? rr(e.replace(nr, ``)) : !1; } function ar(e) { let t = 0, n = e.length; for (let r = 4; r < n; r++) { let n = e.charCodeAt(r); t = (n >= 65 ? t * 100 + (n - 55) : t * 10 + (n - 48)) % 97; } for (let n = 0; n < 4; n++) { let r = e.charCodeAt(n); t = (r >= 65 ? t * 100 + (r - 55) : t * 10 + (r - 48)) % 97; } return t === 1; } function or(e) { return zt.test(e) ? ar(e) : !1; } function sr(e, t = null) { try { let n = e.split(`.`); if (n.length !== 3) return !1; let [r] = n; if (!r) return !1; let i = JSON.parse(atob(r)); return !( (`typ` in i && i?.typ !== `JWT`) || !i.alg || (t && (!(`alg` in i) || i.alg !== t)) ); } catch { return !1; } } const cr = /*@__PURE__*/ E( `$ZodJWT`, (e, t) => { (M.init(e, t), (e._zod.check = (n) => { sr(n.value, t.alg) || n.issues.push({ code: `invalid_format`, format: `jwt`, input: n.value, inst: e, continue: !t.abort, }); })); }, ), lr = /*@__PURE__*/ E( `$ZodNumber`, (e, t) => { (j.init(e, t), (e._zod.pattern = qt), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = Number(n.value); } catch {} let i = n.value; if ( typeof i == `number` && !Number.isNaN(i) && Number.isFinite(i) ) return n; let a = typeof i == `number` ? Number.isNaN(i) ? `NaN` : Number.isFinite(i) ? void 0 : String(i) : void 0; return ( n.issues.push({ expected: `number`, code: `invalid_type`, input: i, inst: e, ...(a ? { received: a } : {}), }), n ); })); }, ), ur = /*@__PURE__*/ E( `$ZodNumberFormat`, (e, t) => { (tn.init(e, t), lr.init(e, t)); }, ), dr = /*@__PURE__*/ E( `$ZodUnknown`, (e, t) => { (j.init(e, t), (e._zod.parse = (e) => e)); }, ), fr = /*@__PURE__*/ E( `$ZodNever`, (e, t) => { (j.init(e, t), (e._zod.parse = (t, n) => ( t.issues.push({ expected: `never`, code: `invalid_type`, input: t.value, inst: e, }), t ))); }, ), pr = /*@__PURE__*/ E( `$ZodDate`, (e, t) => { (j.init(e, t), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = new Date( n.value, ); } catch {} let i = n.value, a = i instanceof Date; return ( (a && !Number.isNaN( i.getTime(), )) || n.issues.push({ expected: `date`, code: `invalid_type`, input: i, ...(a ? { received: `Invalid Date`, } : {}), inst: e, }), n ); })); }, ); function mr(e, t, n) { (e.issues.length && t.issues.push(...xe(n, e.issues)), (t.value[n] = e.value)); } const hr = /*@__PURE__*/ E( `$ZodArray`, (e, t) => { j.init(e, t); let n = O.memoizer; (n?.attach(e), (e._zod.parse = (r, i) => { let a = r.value; if (!Array.isArray(a)) return ( r.issues.push({ expected: `array`, code: `invalid_type`, input: a, inst: e, }), r ); r.value = n ? n.alloc( e, r, Array(a.length), i, ) : Array(a.length); let o = [], s = i?.abortEarly; for ( let e = 0; e < a.length; e++ ) { let n = a[e], c = t.element._zod.run( { value: n, issues: [] }, i, ); if (c instanceof Promise) o.push( c.then((t) => mr(t, r, e), ), ); else if ( (mr(c, r, e), s && c.issues.length !== 0 && x(c)) ) break; } return o.length ? Promise.all(o).then(() => r) : r; })); }, ); function gr(e, t, n, r, i, a) { let o = n in r, s = a === `optional`; if (o || !s || i !== `optional`) { if (e.issues.length) { if (i !== void 0 && s && !o) return; t.issues.push(...xe(n, e.issues)); } if (!o && i === void 0) { e.issues.length || t.issues.push({ code: `invalid_type`, expected: `nonoptional`, input: void 0, path: [n], }); return; } e.value === void 0 ? (o || (i === `defaulted` && !s)) && (t.value[n] = void 0) : (t.value[n] = e.value); } } const _r = []; function vr(e) { let t = Object.keys(e.shape), n = Object.getOwnPropertySymbols( e.shape, ), r = n.length ? n : _r, i = r.length ? [...t, ...r] : t; for (let t of i) if ( !e.shape?.[t]?._zod?.traits?.has( `$ZodType`, ) ) throw Error( `Invalid element at key "${String(t)}": expected a Zod schema`, ); let a = ce(e.shape); return { ...e, allKeys: i, symbolKeys: r, keySet: new Set(t), numKeys: t.length, optionalKeys: new Set(a), }; } function yr(e, t, n, r, i, a, o) { let s = [], c = i.keySet, l = i.catchall._zod, u = l.def.type, d = l.optin, f = l.optout, p = 0; for (let i in t) { if (o && n.issues.length !== p) { if (x(n, p)) break; p = n.issues.length; } if (c.has(i)) continue; if (i === `__proto__`) { u === `never` && s.push(i); continue; } if (u === `never`) { s.push(i); continue; } let a = l.run( { value: t[i], issues: [] }, r, ); a instanceof Promise ? e.push( a.then((e) => gr(e, n, i, t, d, f), ), ) : gr(a, n, i, t, d, f); } return ( s.length && n.issues.push({ code: `unrecognized_keys`, keys: s, input: t, inst: a, continue: !0, }), e.length ? Promise.all(e).then(() => n) : n ); } const br = /*@__PURE__*/ E( `$ZodObject`, (e, t) => { j.init(e, t); let n = Object.getOwnPropertyDescriptor( t, `shape`, ), r = n?.get ? n.get.raw : (t.shape ?? {}); if (r) { let e = () => { let n = { ...r }; return ( Object.defineProperty( t, "shape", { value: n }, ), (e.raw = n), n ); }; ((e.raw = r), Object.defineProperty( t, "shape", { get: e }, )); } let i = a(() => vr(t)); T(e, `propValues`, (e) => { let t = e.def.shape, n = {}; for (let e in t) { let r = t[e]._zod; if (r.values) { Object.prototype.hasOwnProperty.call( n, e, ) || l( n, e, /* @__PURE__ */ new Set(), ); for (let t of r.values) n[e].add(t); r.optin !== void 0 && n[e].add(void 0); } } return n; }); let o = ne, s = t.catchall, c, u = O.memoizer; (u?.attach(e), (e._zod.parse = (t, n) => { c ??= i.value; let r = t.value; if (!o(r)) return ( t.issues.push({ expected: `object`, code: `invalid_type`, input: r, inst: e, }), t ); t.value = u ? u.alloc(e, t, {}, n) : {}; let a = [], l = c.shape, d = n?.abortEarly, f = t.issues.length; for (let e of c.allKeys) { if ( d && t.issues.length !== f ) { if (x(t, f)) break; f = t.issues.length; } if (e === `__proto__`) continue; let i = l[e], o = i._zod.optin, s = i._zod.optout, c = i._zod.run( { value: r[e], issues: [], }, n, ); c instanceof Promise ? a.push( c.then((n) => gr( n, t, e, r, o, s, ), ), ) : gr(c, t, e, r, o, s); } return s ? yr( a, r, t, n, i.value, e, d === !0, ) : a.length ? Promise.all(a).then( () => t, ) : t; })); }, ), xr = /*@__PURE__*/ E( `$ZodObjectJIT`, (e, t) => { br.init(e, t); let n = e._zod.parse, r = a(() => vr(t)), i = O.memoizer, o = (t) => { let n = r.value, a = n.symbolKeys, o = new mn( [`payload`, `ctx`], { shape: t, inst: e, memo: i, syms: a, }, ), s = (e) => `shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`, c = (e, t) => ` let ${e}_ab = false; for (let i = 0; i < ${e}.issues.length; i++) { const iss = ${e}.issues[i]; iss.path = iss.path ? [${t}, ...iss.path] : [${t}]; payload.issues.push(iss); if (iss.continue !== true) ${e}_ab = true; } if (${e}_ab && ctx && ctx.abortEarly) { payload.value = newResult; return payload; }`; o.write( `const input = payload.value;`, ); let l = Object.create(null), u = 0; for (let e of n.allKeys) l[e] = `key_${u++}`; o.write( i ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`, ); for (let e of n.allKeys) { if (e === `__proto__`) continue; let n = l[e], r = typeof e == `symbol` ? `syms[${a.indexOf(e)}]` : _(e), i = `${r} in input`, u = t[e], d = u?._zod?.optin, f = d !== void 0, p = u?._zod?.optout === `optional`; if ( (o.write( `const ${n} = ${s(r)};`, ), f && p) ) { let e = d === `optional` ? `${n}_present` : `${n}.value !== undefined || ${n}_present`; o.write(` const ${n}_present = ${i}; if (!${n}.issues.length || ${n}_present) { if (${n}.issues.length) {${c(n, r)} } if (${e}) { newResult[${r}] = ${n}.value; } } `); } else f ? (o.write(` if (${n}.issues.length) {${c(n, r)} } `), d === `defaulted` ? o.write( `newResult[${r}] = ${n}.value;`, ) : o.write(` if (${n}.value !== undefined || ${i}) { newResult[${r}] = ${n}.value; } `)) : o.write(` const ${n}_present = ${i}; if (${n}.issues.length) {${c(n, r)} } if (!${n}_present && !${n}.issues.length) { payload.issues.push({ code: "invalid_type", expected: "nonoptional", input: undefined, path: [${r}] }); if (ctx && ctx.abortEarly) { payload.value = newResult; return payload; } } if (${n}_present) { newResult[${r}] = ${n}.value; } `); } return ( o.write( `payload.value = newResult;`, ), o.write(`return payload;`), o.compile() ); }, s, c = ne, l = !O.jitless, u = l && re.value, d = t.catchall, f; e._zod.parse = (i, a) => { f ??= r.value; let p = i.value; return c(p) ? l && u && a?.async === !1 && a.jitless !== !0 ? ((s ||= o(t.shape)), (i = s(i, a)), d ? yr( [], p, i, a, f, e, a?.abortEarly === !0, ) : i) : n(i, a) : (i.issues.push({ expected: `object`, code: `invalid_type`, input: p, inst: e, }), i); }; }, ); function Sr(e, t, n, r) { for (let n of e) if (n.issues.length === 0) return ((t.value = n.value), t); let i = e.filter((e) => !x(e)); return i.length === 1 ? ((t.value = i[0].value), i[0]) : (t.issues.push({ code: `invalid_union`, input: t.value, inst: n, errors: e.map((e) => e.issues.map((e) => S(e, r, k()), ), ), }), t); } const Cr = /*@__PURE__*/ E( `$ZodUnion`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.options.some( (e) => e._zod.optin === `defaulted`, ) ? `defaulted` : e.def.options.some( (e) => e._zod.optin !== void 0, ) ? `optional` : void 0, ), T(e, `optout`, (e) => e.def.options.some( (e) => e._zod.optout === `optional`, ) ? `optional` : void 0, ), T(e, `values`, (e) => { if ( e.def.options.every( (e) => e._zod.values, ) ) return new Set( e.def.options.flatMap( (e) => Array.from( e._zod.values, ), ), ); }), T(e, `pattern`, (e) => { if ( e.def.options.every( (e) => e._zod.pattern, ) ) { let t = e.def.options.map( (e) => e._zod.pattern, ); return RegExp( `^(${t.map((e) => s(e.source)).join(`|`)})$`, ); } })); let n = t.options.length === 1 ? t.options[0]._zod.run : null; e._zod.parse = (r, i) => { if (n) return n(r, i); let a = !1, o = []; for (let e of t.options) { let t = e._zod.run( { value: r.value, issues: [], }, i, ); if (t instanceof Promise) (o.push(t), (a = !0)); else { if (t.issues.length === 0) return t; o.push(t); } } return a ? Promise.all(o).then((t) => Sr(t, r, e, i), ) : Sr(o, r, e, i); }; }, ), wr = /*@__PURE__*/ E( `$ZodIntersection`, (e, t) => { (j.init(e, t), (e._zod.parse = (e, n) => { let r = e.value, i = t.left._zod.run( { value: r, issues: [] }, n, ), a = t.right._zod.run( { value: r, issues: [] }, n, ); return i instanceof Promise || a instanceof Promise ? Promise.all([i, a]).then( ([t, n]) => Er(e, t, n), ) : Er(e, i, a); })); }, ); function Tr(e, t) { if ( e === t || (e instanceof Date && t instanceof Date && +e == +t) ) return { valid: !0, data: e }; if (v(e) && v(t)) { let n = Object.keys(t), r = Object.keys(e).filter( (e) => n.indexOf(e) !== -1, ), i = { ...e, ...t }; Object.prototype.hasOwnProperty.call( i, `__proto__`, ) && delete i.__proto__; for (let n of r) { if (n === `__proto__`) continue; let r = Tr(e[n], t[n]); if (!r.valid) return { valid: !1, mergeErrorPath: [ n, ...r.mergeErrorPath, ], }; i[n] = r.data; } return { valid: !0, data: i }; } if ( Array.isArray(e) && Array.isArray(t) ) { if (e.length !== t.length) return { valid: !1, mergeErrorPath: [], }; let n = []; for (let r = 0; r < e.length; r++) { let i = e[r], a = t[r], o = Tr(i, a); if (!o.valid) return { valid: !1, mergeErrorPath: [ r, ...o.mergeErrorPath, ], }; n.push(o.data); } return { valid: !0, data: n }; } return { valid: !1, mergeErrorPath: [], }; } function Er(e, t, n) { let r = /* @__PURE__ */ new Map(), i, a = /* @__PURE__ */ new Map(), o = (e, t) => { let n; if ( e.code === `unrecognized_keys` && !e.path?.length ) ((i ??= e), (n = e.keys)); else if ( e.code === `invalid_key` && e.origin === `record` && e.path?.length === 1 ) { let t = String(e.path[0]); (a.has(t) || a.set(t, e), (n = [t])); } else return !1; for (let e of n) (r.has(e) || r.set(e, {}), (r.get(e)[t] = !0)); return !0; }; for (let n of t.issues) o(n, `l`) || e.issues.push(n); for (let t of n.issues) o(t, `r`) || e.issues.push(t); let s = [...r] .filter(([, e]) => e.l && e.r) .map(([e]) => e); if (s.length) { let t = i ? s.filter((e) => i.keys.includes(e), ) : []; t.length && e.issues.push({ ...i, keys: t }); for (let n of s) !t.includes(n) && a.has(n) && e.issues.push(a.get(n)); } let c = Tr(t.value, n.value); if (!c.valid) { if (x(e)) return e; throw Error( `Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`, ); } return ((e.value = c.data), e); } const Dr = /*@__PURE__*/ E( `$ZodEnum`, (e, n) => { j.init(e, n); let r = t(n.entries), i = new Set(r); ((e._zod.values = i), T(e, `pattern`, (e) => { let n = t( e.def.entries, ).filter((e) => ae.has(typeof e), ); return RegExp( n.length ? `^(${n.map((e) => oe(e.toString())).join(`|`)})$` : `^[^\\s\\S]$`, ); }), (e._zod.parse = (t, n) => { let a = t.value; return ( i.has(a) || t.issues.push({ code: `invalid_value`, values: r, input: a, inst: e, }), t ); })); }, ), Or = /*@__PURE__*/ E( `$ZodTransform`, (e, t) => { (j.init(e, t), (e._zod.optin = `optional`), O.memoizer?.guard(e), (e._zod.parse = (n, r) => { if ( r.direction === `backward` ) throw new He( e.constructor.name, ); let i = t.transform( n.value, n, ); if (r.async) return ( i instanceof Promise ? i : Promise.resolve(i) ).then( (e) => ((n.value = e), n), ); if (i instanceof Promise) throw new D(); return ((n.value = i), n); })); }, ); function kr(e, t) { return ( (e.value = t.issues.length ? void 0 : t.value), e ); } const Ar = /*@__PURE__*/ E( `$ZodOptional`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin === `defaulted` ? `defaulted` : `optional`, ), (e._zod.optout = `optional`), T(e, `values`, (e) => { let t = e.def.innerType._zod.values; return t ? /* @__PURE__ */ new Set([ ...t, void 0, ]) : void 0; }), T(e, `pattern`, (e) => { let t = e.def.innerType._zod .pattern; return t ? RegExp( `^(${s(t.source)})?$`, ) : void 0; }), (e._zod.parse = (e, n) => { if (e.value === void 0) { if ( t.innerType._zod.optin !== `defaulted` ) return e; let r = t.innerType._zod.run( { value: e.value, issues: [], }, n, ); return r instanceof Promise ? r.then((t) => kr(e, t)) : kr(e, r); } return t.innerType._zod.run( e, n, ); })); }, ), jr = /*@__PURE__*/ E( `$ZodExactOptional`, (e, t) => { (Ar.init(e, t), T( e, `values`, (e) => e.def.innerType._zod.values, ), T( e, `pattern`, (e) => e.def.innerType._zod .pattern, ), (e._zod.parse = (e, n) => t.innerType._zod.run(e, n))); }, ), Mr = /*@__PURE__*/ E( `$ZodNullable`, (e, t) => { (j.init(e, t), T( e, `optin`, (e) => e.def.innerType._zod.optin, ), T( e, `optout`, (e) => e.def.innerType._zod.optout, ), T(e, `pattern`, (e) => { let t = e.def.innerType._zod .pattern; return t ? RegExp( `^(${s(t.source)}|null)$`, ) : void 0; }), T(e, `values`, (e) => e.def.innerType._zod.values ? /* @__PURE__ */ new Set([ ...e.def.innerType._zod .values, null, ]) : void 0, ), (e._zod.parse = (e, n) => e.value === null ? e : t.innerType._zod.run( e, n, ))); }, ), Nr = /*@__PURE__*/ E( `$ZodDefault`, (e, t) => { (j.init(e, t), (e._zod.optin = `defaulted`), T( e, `values`, (e) => e.def.innerType._zod.values, ), (e._zod.parse = (e, n) => { if ( n.direction === `backward` ) return t.innerType._zod.run( e, n, ); if (e.value === void 0) return ( (e.value = t.defaultValue), e ); let r = t.innerType._zod.run( e, n, ); return r instanceof Promise ? r.then((e) => Pr(e, t)) : Pr(r, t); })); }, ); function Pr(e, t) { return ( e.value === void 0 && (e.value = t.defaultValue), e ); } const Fr = /*@__PURE__*/ E( `$ZodPrefault`, (e, t) => { (j.init(e, t), (e._zod.optin = `defaulted`), T( e, `values`, (e) => e.def.innerType._zod.values, ), (e._zod.parse = (e, n) => ( n.direction === `backward` || (e.value === void 0 && (e.value = t.defaultValue)), t.innerType._zod.run(e, n) ))); }, ), Ir = /*@__PURE__*/ E( `$ZodNonOptional`, (e, t) => { (j.init(e, t), T(e, `values`, (e) => { let t = e.def.innerType._zod.values; return t ? new Set( [...t].filter( (e) => e !== void 0, ), ) : void 0; }), (e._zod.parse = (n, r) => { let i = t.innerType._zod.run( n, r, ); return i instanceof Promise ? i.then((t) => Lr(t, e)) : Lr(i, e); })); }, ); function Lr(e, t) { return ( !e.issues.length && e.value === void 0 && e.issues.push({ code: `invalid_type`, expected: `nonoptional`, input: e.value, inst: t, }), e ); } function Rr(e, t, n, r) { return t.issues.length ? ((e.value = n.catchValue({ ...t, value: e.value, error: { issues: t.issues.map((e) => S(e, r, k()), ), }, input: e.value, })), e) : ((e.value = t.value), t.memo && (e.memo = !0), e); } const zr = /*@__PURE__*/ E( `$ZodCatch`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin === `defaulted` ? `defaulted` : `optional`, ), T( e, `optout`, (e) => e.def.innerType._zod.optout, ), T( e, `values`, (e) => e.def.innerType._zod.values, ), (e._zod.parse = (e, n) => { if ( n.direction === `backward` ) return t.innerType._zod.run( e, n, ); let r = t.innerType._zod.run( { value: e.value, issues: [], }, n, ); return r instanceof Promise ? r.then((r) => Rr(e, r, t, n), ) : Rr(e, r, t, n); })); }, ), Br = /*@__PURE__*/ E( `$ZodPipe`, (e, t) => { (j.init(e, t), T( e, `values`, (e) => e.def.in._zod.values, ), T( e, `optin`, (e) => e.def.in._zod.optin, ), T( e, `optout`, (e) => e.def.out._zod.optout, ), T( e, `propValues`, (e) => e.def.in._zod.propValues, ), (e._zod.parse = (e, n) => { if ( n.direction === `backward` ) { let r = t.out._zod.run( e, n, ); return r instanceof Promise ? r.then((e) => Vr(e, t.in, n), ) : Vr(r, t.in, n); } let r = t.in._zod.run(e, n); return r instanceof Promise ? r.then((e) => Vr(e, t.out, n), ) : Vr(r, t.out, n); })); }, ); function Vr(e, t, n) { return e.issues.some( (e) => e.code !== `unrecognized_keys`, ) ? ((e.aborted = !0), e) : t._zod.run( { value: e.value, issues: e.issues, }, n, ); } const Hr = /*@__PURE__*/ E( `$ZodReadonly`, (e, t) => { (j.init(e, t), T( e, `propValues`, (e) => e.def.innerType._zod .propValues, ), T( e, `values`, (e) => e.def.innerType._zod.values, ), T( e, `optin`, (e) => e.def.innerType?._zod?.optin, ), T( e, `optout`, (e) => e.def.innerType?._zod?.optout, ), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run( e, n, ); let r = t.innerType._zod.run( e, n, ); return r instanceof Promise ? r.then(Ur) : Ur(r); })); }, ); function Ur(e) { return ( e.memo || (e.value = Object.freeze( e.value, )), e ); } const Wr = /*@__PURE__*/ E( `$ZodCustom`, (e, t) => { (A.init(e, t), j.init(e, t), (e._zod.parse = (e, t) => e), (e._zod.check = (n) => { let r = n.value, i = t.fn(r); if (i instanceof Promise) return i.then((t) => Gr(t, n, r, e), ); Gr(i, n, r, e); })); }, ); function Gr(e, t, n, r) { if (!e) { let e = { code: `custom`, input: n, inst: r, path: [ ...(r._zod.def.path ?? []), ], continue: !r._zod.def.abort, }; (r._zod.def.params && (e.params = r._zod.def.params), t.issues.push(Oe(e))); } } var Kr = class extends Error { constructor() { (super( `Cannot parse a reference cycle that closes through a transform`, ), (this.name = `ZodCyclicError`)); } }; const qr = `~memo`, Jr = []; function Yr(e) { return typeof e == `object` && !!e; } function Xr(e) { return e.map((e) => e.path ? { ...e, path: e.path.slice() } : { ...e }, ); } const Zr = /*@__PURE__*/ new WeakMap(); function Qr(e, t, n) { let r = Zr.get(e); if (r !== void 0) return r ? 2 : 0; if (t.has(e)) return 2; t.add(e); let i = 0, a = (e) => { if (i !== 2 && e?._zod) { let r = Qr(e, t, n); r > i && (i = r); } }, o = (e, r) => { let i = 0; for (let a of Reflect.ownKeys( e, )) { let o = Object.getOwnPropertyDescriptor( e, a, ); if (r && !o.enumerable) continue; let s = o.get ? 1 : o.value?._zod ? Qr(o.value, t, n) : 0; s > i && (i = s); } return i; }, s = (e) => { e > i && (i = e); }, c = e._zod.def; switch (c.type) { case `object`: { let e = u(c); (s(e ? o(e, !0) : 1), a(c.catchall)); break; } case `array`: a(c.element); break; case `tuple`: for (let e of c.items) a(e); a(c.rest); break; case `record`: case `map`: (a(c.keyType), a(c.valueType)); break; case `set`: a(c.valueType); break; case `union`: for (let e of c.options) a(e); break; case `intersection`: (a(c.left), a(c.right)); break; case `optional`: case `nullable`: case `default`: case `prefault`: case `catch`: case `readonly`: case `nonoptional`: case `promise`: case `success`: a(c.innerType); break; case `pipe`: (a(c.in), a(c.out)); break; case `function`: (a(c.input), a(c.output)); break; case `lazy`: { let r = c._cachedInner ?? (n ? e._zod.innerType : void 0); s(r ? Qr(r, t, !1) : 1); break; } case `template_literal`: case `string`: case `number`: case `int`: case `boolean`: case `bigint`: case `symbol`: case `undefined`: case `null`: case `void`: case `never`: case `any`: case `unknown`: case `date`: case `nan`: case `enum`: case `literal`: case `file`: case `transform`: case `custom`: break; default: for (let e in c) { let t = Object.getOwnPropertyDescriptor( c, e, ); if (!t || t.get) continue; let n = t.value; if (n && typeof n == `object`) { if (n._zod) a(n); else if (Array.isArray(n)) for (let e of n) a(e); } } } return (t.delete(e), $r(e, i)); } function $r(e, t) { return ( t !== 1 && Zr.set(e, t === 2), t ); } function ei(e) { return ( Qr( e, /* @__PURE__ */ new Set(), !0, ) !== 0 ); } function ti(e, t) { let n = e.buckets.get(t); return ( n || ((n = /* @__PURE__ */ new WeakMap()), e.buckets.set(t, n)), n ); } let ni; const ri = [], ii = { alloc(e, t, n) { let r = ni; if (!r) return n; ni = void 0; let i = { value: n, issues: null, }; return ( r.set(t.value, i), ri.push(i), n ); }, guard(e) { var t; ((t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred.push(() => { let t = e._zod.parse, n = (e, n) => { if ( n.direction !== `backward` && oi(n, e.value) ) throw new Kr(); return t(e, n); }; ((e._zod.parse = n), e._zod.run === t && (e._zod.run = n)); })); }, attach(e) { var t; let n, r = !1, i, a; ((t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred.push(() => { let t = e._zod.parse, o = (s, c) => { if (n === void 0) { let i = Qr( e, /* @__PURE__ */ new Set(), !1, ); if (i === 0) return ( (e._zod.parse = t), e._zod.run === o && (e._zod.run = t), t(s, c) ); i === 2 || r ? (n = !0) : (r = !0); } let l = s.value; if (!Yr(l)) return t(s, c); let u = c[qr]; u || ((u = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0, }), (c[qr] = u)); let d; i === c ? (d = a) : ((d = ti(u, e)), (i = c), (a = d)); let f = d.get(l); if (f) return ( (s.value = f.value), f.issues ? f.issues.length && s.issues.push( ...Xr(f.issues), ) : ((s.memo = !0), u.backEdges ?? (u.backEdges = /* @__PURE__ */ new WeakSet()), u.backEdges.add( f.value, )), s ); ni = d; let p = ri.length, m = t(s, c); ni = void 0; let h = ri.length > p ? ri.pop() : void 0; return m instanceof Promise ? m.then( (e) => ( h && (h.issues = e .issues.length ? Xr(e.issues) : Jr), e ), ) : (h && (h.issues = m.issues .length ? Xr(m.issues) : Jr), m); }; ((e._zod.parse = o), e._zod.run === t && (e._zod.run = o)); })); }, }; function ai() { return ii; } function oi(e, t) { let n = e[qr]?.backEdges; return ( n !== void 0 && Yr(t) && n.has(t) ); } const si = () => { let e = { string: { unit: `characters`, verb: `to have`, }, file: { unit: `bytes`, verb: `to have`, }, array: { unit: `items`, verb: `to have`, }, set: { unit: `items`, verb: `to have`, }, map: { unit: `entries`, verb: `to have`, }, }; function t(t) { return e[t] ?? null; } let r = { regex: `input`, email: `email address`, url: `URL`, emoji: `emoji`, uuid: `UUID`, uuidv4: `UUIDv4`, uuidv6: `UUIDv6`, nanoid: `nanoid`, guid: `GUID`, cuid: `cuid`, cuid2: `cuid2`, ulid: `ULID`, xid: `XID`, ksuid: `KSUID`, datetime: `ISO datetime`, date: `ISO date`, time: `ISO time`, duration: `ISO duration`, ipv4: `IPv4 address`, ipv6: `IPv6 address`, mac: `MAC address`, cidrv4: `IPv4 range`, cidrv6: `IPv6 range`, base64: `base64-encoded string`, base64url: `base64url-encoded string`, json_string: `JSON string`, e164: `E.164 number`, currency_code: `currency code`, credit_card: `credit card number`, iban: `IBAN`, jwt: `JWT`, template_literal: `input`, }, i = { nan: `NaN` }; function a(e, t) { return e === `number` && typeof t == `number` && !Number.isFinite(t) ? String(t) : (i[e] ?? e); } return (e) => { switch (e.code) { case `invalid_type`: return `Invalid input: expected ${a(e.expected)}, received ${a(De(e.input), e.input)}`; case `invalid_value`: return e.values.length === 1 ? `Invalid input: expected ${se(e.values[0])}` : `Invalid option: expected one of ${n(e.values, `|`)}`; case `too_big`: { let n = e.exact ? `exactly ` : e.inclusive ? `<=` : `<`, r = t(e.origin); return r ? `Too big: expected ${e.origin ?? `value`} to have ${n}${e.maximum.toString()} ${r.unit ?? `elements`}` : `Too big: expected ${e.origin ?? `value`} to be ${n}${e.maximum.toString()}`; } case `too_small`: { let n = e.exact ? `exactly ` : e.inclusive ? `>=` : `>`, r = t(e.origin); return r ? `Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}` : `Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`; } case `invalid_format`: { let t = e; return t.format === `starts_with` ? `Invalid string: must start with "${t.prefix}"` : t.format === `ends_with` ? `Invalid string: must end with "${t.suffix}"` : t.format === `includes` ? `Invalid string: must include "${t.includes}"` : t.format === `regex` ? `Invalid string: must match pattern ${t.pattern}` : `Invalid ${r[t.format] ?? e.format}`; } case `not_multiple_of`: return `Invalid number: must be a multiple of ${e.divisor}`; case `unrecognized_keys`: return `Unrecognized key${e.keys.length > 1 ? `s` : ``}: ${n(e.keys, `, `)}`; case `invalid_key`: return `Invalid key in ${e.origin}`; case `invalid_union`: return e.options && Array.isArray(e.options) && e.options.length > 0 ? `Invalid discriminator value. Expected ${e.options.map((e) => `'${e}'`).join(` | `)}` : e.inclusive === !1 ? `Invalid input: more than one option matched` : `Invalid input`; case `invalid_element`: return `Invalid value in ${e.origin}`; default: return `Invalid input`; } }; }; function ci() { return { localeError: si() }; } var li, ui = class { constructor() { ((this._map = /* @__PURE__ */ new WeakMap()), (this._idmap = /* @__PURE__ */ new Map())); } add(e, ...t) { let n = t[0]; return ( this._map.set(e, n), n && typeof n == `object` && `id` in n && this._idmap.set(n.id, e), this ); } clear() { return ( (this._map = /* @__PURE__ */ new WeakMap()), (this._idmap = /* @__PURE__ */ new Map()), this ); } remove(e) { let t = this._map.get(e); return ( t && typeof t == `object` && `id` in t && this._idmap.delete(t.id), this._map.delete(e), this ); } get(e) { let t = e._zod.parent; if (t) { let n = { ...(this.get(t) ?? {}), }; delete n.id; let r = { ...n, ...this._map.get(e), }; return Object.keys(r).length ? r : void 0; } return this._map.get(e); } has(e) { return this._map.has(e); } }; function di() { return new ui(); } (li = globalThis) .__zod_globalRegistry ?? (li.__zod_globalRegistry = di()); const fi = globalThis.__zod_globalRegistry, N = Symbol.for(`zod.compile.invalid`), pi = Symbol.for( `zod.compile.fallback`, ); var P = class extends Error { constructor( e = `z.compile does not support async refinements, transforms, or checks`, ) { (super(e), (this.name = `ZodCompileAsyncError`)); } }, F = class extends Error { constructor(e, t = !0) { (super( `z.compile does not support ${e}; this schema must use the runtime parser`, ), (this.name = `ZodCompileUnsupportedError`), (this.islandable = t)); } }; function mi(e, t) { try { return vi(e, { assertOnly: !0 }); } catch { return t; } } function hi(e, t) { try { let t = vi(e), n = gi(e, t); return ( (n._zod.bag.validator = mi(e, t)), n ); } catch (n) { if (t?.strict) throw n; return e; } } function gi(e, t) { if (ei(e)) throw new F( `a schema whose subtree contains a reference cycle`, ); let n = y(e), r = e._zod.run, i = r.__originalRun ?? r, a = (e, n) => { if ( n?.async || n?.direction === `backward` || n?.skipChecks || n?.[pi] || (n && oi(n, e.value)) ) return i(e, n); let r = t(e.value); return r === N ? (n && (n[pi] = !0), i(e, n)) : ((e.value = r), e); }; return ( (a.__originalRun = i), (n._zod.bag.fallbackRun = i), (n._zod.bag.validator = t), (n._zod.run = a), r.__originalRun || _i(n, e, t), n ); } function _i(e, t, n) { let r = e, i = t; if ( typeof i.safeParse == `function` ) { let e = i.safeParse; r.safeParse = (t, r) => { let i = n(t); return i === N ? e(t, r) : { success: !0, data: i }; }; } if (typeof i.parse == `function`) { let e = i.parse; r.parse = (t, r) => { let i = n(t); return i === N ? e(t, r) : i; }; } } function vi(e, t) { let n = !0; try { n = ei(e); } catch {} if (n) throw new F( `a schema whose subtree contains a reference cycle`, ); let r = { constants: /* @__PURE__ */ new Map(), constantCounter: 0, varCounter: 0, definite: !0, }, i = new mn([`input`]), a = V( i, r, e, `input`, !t?.assertOnly, ); i.write( a === null ? `return true;` : `return ${a};`, ); let o = [ `INVALID`, ...r.constants.keys(), ], s = [N, ...r.constants.values()], c = i.content.join(` `), l = t?.debug ? o.length > 0 ? `// Constants: ${o.join(`, `)}\n${c}` : c : ``, u = Function, d = `return (input) => {\n${c}\n}`, f; try { f = new u(...o, d)(...s); } catch (e) { throw new F( `this schema (generated code failed to evaluate: ${e.message})`, ); } return ( t?.debug && (f.code = l), (f.definite = r.definite), f ); } function I(e, t) { for (let [n, r] of e.constants) if (r === t) return n; let n = `c${e.constantCounter++}`; return (e.constants.set(n, t), n); } function L(e, t) { return ((e.definite = !1), I(e, t)); } function R(e) { return `v${e.varCounter++}`; } function yi(e, t) { let n = e._zod.run( { value: t, issues: [] }, {}, ); if (n && typeof n.then == `function`) return N; let r = n; return r.issues.length === 0 ? r.value : N; } function z(e, t, n, r, i = !0) { let a = e.content.length, o = t.constants.size, s = t.constantCounter, c = t.varCounter; try { return V(e, t, n, r, i); } catch (i) { if ( !(i instanceof F) || !i.islandable ) throw i; if ( ((e.content.length = a), t.constants.size > o) ) { let e = Array.from( t.constants.keys(), ).slice(o); for (let n of e) t.constants.delete(n); } return ( (t.constantCounter = s), (t.varCounter = c), bi(e, t, n, r) ); } } function bi(e, t, n, r) { t.definite = !1; let i = I(t, n), a = I(t, yi), o = R(t); return ( e.write( `const ${o} = ${a}(${i}, ${r});`, ), e.write( `if (${o} === INVALID) return INVALID;`, ), o ); } const xi = /* @__PURE__ */ new Set([ `max_size`, `min_size`, `size_equals`, `max_length`, `min_length`, `length_equals`, ]); function Si(e, t, n, r) { let i = n._zod.def.checks; if (!i || i.length === 0) return r; let a = r; for (let n of i) { let r = n._zod.def; if (r.when && !xi.has(r.check)) throw new F( `check with a custom "when" condition`, ); switch (r.check) { case `greater_than`: Ti(e, t, r, a); break; case `less_than`: Ei(e, t, r, a); break; case `multiple_of`: Di(e, t, r, a); break; case `number_format`: Oi(e, r, a); break; case `min_length`: { let n = B( r.minimum, `min_length`, ), i = Ci( e, t, a, `${a}.length >= ${n} && ${a}.length < ${r.minimum * 2}`, ); e.write( `if (${i} < ${n}) return INVALID;`, ); break; } case `max_length`: { let n = B( r.maximum, `max_length`, ), i = Ci( e, t, a, `${a}.length > ${n}`, ); e.write( `if (${i} > ${n}) return INVALID;`, ); break; } case `length_equals`: { let n = B( r.length, `length_equals`, ), i = Ci( e, t, a, `${a}.length >= ${n} && ${a}.length <= ${r.length * 2}`, ); e.write( `if (${i} !== ${n}) return INVALID;`, ); break; } case `min_size`: e.write( `if (${a}.size < ${B(r.minimum, `min_size`)}) return INVALID;`, ); break; case `max_size`: e.write( `if (${a}.size > ${B(r.maximum, `max_size`)}) return INVALID;`, ); break; case `size_equals`: e.write( `if (${a}.size !== ${B(r.size, `size_equals`)}) return INVALID;`, ); break; case `string_format`: a = Ri(e, t, r, a); break; case `custom`: a = Ii(e, t, n, a); break; case `bigint_format`: ki(e, r, a); break; case `mime_type`: Ai(e, t, r, a); break; case `property`: Mi(e, t, r, a); break; case `properties`: ji(e, t, r, a); break; case `overwrite`: { let r = R(t); (Ni(e, t, n, a, r), (a = r)); break; } default: throw new F( `check type ${r.check}`, ); } } return a; } function Ci(e, t, n, r) { let i = I(t, Te), a = R(t); return ( e.write( `const ${a} = typeof ${n} === "string" && ${r} ? ${i}(${n}) : ${n}.length;`, ), a ); } function B(e, t) { if ( typeof e != `number` || !Number.isFinite(e) ) throw new F( `${t} bound of type ${typeof e}`, ); return `${e}`; } function wi(e, t) { if (typeof t == `bigint`) return `${t}n`; if (typeof t == `number`) { if (Number.isNaN(t)) throw new F( `comparison check with NaN bound`, ); return `${t}`; } if (t instanceof Date) { if (Number.isNaN(t.getTime())) throw new F( `comparison check with Invalid Date bound`, ); return I(e, t); } throw new F( `comparison check bound of type ${typeof t}`, ); } function Ti(e, t, n, r) { let i = n.inclusive ? `<` : `<=`; e.write( `if (${r} ${i} ${wi(t, n.value)}) return INVALID;`, ); } function Ei(e, t, n, r) { let i = n.inclusive ? `>` : `>=`; e.write( `if (${r} ${i} ${wi(t, n.value)}) return INVALID;`, ); } function Di(e, t, n, r) { if (typeof n.value == `bigint`) { if (n.value === BigInt(0)) throw new F( `multiple_of check with a zero divisor`, ); e.write( `if (${r} % ${n.value}n !== 0n) return INVALID;`, ); } else { let i = I(t, c); e.write( `if (${i}(${r}, ${B(n.value, `multiple_of`)}) !== 0) return INVALID;`, ); } } function Oi(e, t, n) { let r = t.format; switch (r) { case `safeint`: e.write( `if (!Number.isSafeInteger(${n})) return INVALID;`, ); break; case `int32`: e.write( `if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`, ); break; case `uint32`: e.write( `if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`, ); break; case `float32`: e.write( `if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`, ); break; case `float64`: e.write( `if (!Number.isFinite(${n})) return INVALID;`, ); break; default: throw new F(`number format ${r}`); } } function ki(e, t, n) { let r = t.format; if (r) switch (r) { case `int64`: e.write( `if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`, ); break; case `uint64`: e.write( `if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`, ); break; default: throw new F( `bigint format ${r}`, ); } } function Ai(e, t, n, r) { let i = n.mime; if (i && i.length > 0) { let n = I(t, new Set(i)); e.write( `if (!${n}.has(${r}.type)) return INVALID;`, ); } } function ji(e, t, n, r) { if (n.when) throw new F( `check with a custom "when" condition`, ); e.write( `if (${r} == null) return INVALID;`, ); let i = n.shape; for (let n of Reflect.ownKeys(i)) { let a = typeof n == `symbol` ? I(t, n) : _(n), o = R(t); (e.write( `const ${o} = ${r}[${a}];`, ), z(e, t, i[n], o, !1)); } } function Mi(e, t, n, r) { let i = `${r}[${JSON.stringify(n.property)}]`; V(e, t, n.schema, i); } function Ni(e, t, n, r, i) { let a = n._zod.def.tx; if (!a) throw new F( `overwrite check without a transform function`, ); if (W(a)) throw new P( `z.compile: async overwrite transforms are not supported`, ); let o = I(t, a); e.write(`const ${i} = ${o}(${r});`); } function Pi() { throw new D(); } function Fi(e) { this.issues.push(e); } function Ii(e, t, n, r) { let i = n._zod.def; if (i.fn) { if (W(i.fn)) throw new P( `z.compile: async .refine() predicates are not supported`, ); let n = L(t, i.fn), a = I(t, Pi), o = R(t); return ( e.write( `const ${o} = ${n}(${r});`, ), e.write( `if (${o} instanceof Promise) ${a}();`, ), e.write( `if (!${o}) return INVALID;`, ), r ); } if (n._zod.check) { if (W(n._zod.check)) throw new P( `z.compile: async .superRefine() / check functions are not supported`, ); let i = n._zod.check, a = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi, }; return ( i(t) instanceof Promise && Pi(), t.issues.length === 0 ? t.value : N ); }), o = R(t); return ( e.write( `const ${o} = ${a}(${r});`, ), e.write( `if (${o} === INVALID) return INVALID;`, ), o ); } throw new F( `custom check without a predicate or check function`, ); } const Li = /* @__PURE__ */ new Set([ `cidrv4`, `cuid`, `cuid2`, `date`, `datetime`, `duration`, `e164`, `email`, `emoji`, `ends_with`, `guid`, `includes`, `ipv4`, `ksuid`, `lowercase`, `mac`, `nanoid`, `regex`, `starts_with`, `time`, `ulid`, `uppercase`, `uuid`, `xid`, ]); function Ri(e, t, n, r, i = !0) { let a = n.format; if (a === `base64`) { let n = I(t, Yn); return ( e.write( `if (!${n}(${r})) return INVALID;`, ), r ); } if (a === `base64url`) { let n = I(t, $n); return ( e.write( `if (!${n}(${r})) return INVALID;`, ), r ); } if (a === `jwt`) { let i = I(t, sr), a = I(t, n.alg ?? null); return ( e.write( `if (!${i}(${r}, ${a})) return INVALID;`, ), r ); } if (a === `ipv6`) { let n = I(t, Wn); return ( e.write( `if (!${n}(${r})) return INVALID;`, ), r ); } if (a === `cidrv6`) { let n = I(t, qn); return ( e.write( `if (!${n}(${r})) return INVALID;`, ), r ); } if (a === `credit_card`) { let n = I(t, ir); return ( e.write( `if (!${n}(${r})) return INVALID;`, ), r ); } if (a === `iban`) { let n = I(t, or); return ( e.write( `if (!${n}(${r})) return INVALID;`, ), r ); } let o = n; if ( a === `url` || a === `httpurl` || o.normalize || o.hostname !== void 0 || o.protocol !== void 0 ) { let a = I(t, wn), s = I(t, n), c = R(t), l = R(t); if ( (e.write( `const ${c} = ${r}.trim();`, ), e.write( `const ${l} = ${a}(${c}, ${s});`, ), e.write( `if (typeof ${l} === "number") return INVALID;`, ), o.hostname !== void 0) ) { let n = I(t, On); e.write( `if (!${n}(${l}, ${s}.hostname)) return INVALID;`, ); } if (o.protocol !== void 0) { let n = I(t, kn); e.write( `if (!${n}(${l}, ${s}.protocol)) return INVALID;`, ); } if (!i) return null; let u = R(t), d = o.normalize ? `${l}.href` : `${I(t, Dn)}(${c})`; return ( e.write(`const ${u} = ${d};`), u ); } let s = n.fn; if (s) { if (W(s)) throw new F( `async string format ${a}`, ); let n = I(t, s); return ( e.write( `if (!${n}(${r})) return INVALID;`, ), r ); } if (Li.has(a) && n.pattern) { let i = I(t, n.pattern); return ( e.write(`${i}.lastIndex = 0;`), e.write( `if (!${i}.test(${r})) return INVALID;`, ), r ); } let c = n.format; switch (c) { case `regex`: throw new F( `regex format without a pattern`, ); case `lowercase`: e.write( `if (${r} !== ${r}.toLowerCase()) return INVALID;`, ); break; case `uppercase`: e.write( `if (${r} !== ${r}.toUpperCase()) return INVALID;`, ); break; case `includes`: e.write( `if (!${r}.includes(${_(n.includes)})) return INVALID;`, ); break; case `starts_with`: { let t = n.prefix; e.write( `if (${r}.slice(0, ${t.length}) !== ${_(t)}) return INVALID;`, ); break; } case `ends_with`: { let t = n.suffix; e.write( `if (${r}.slice(-${t.length}) !== ${_(t)}) return INVALID;`, ); break; } default: throw new F(`string format ${c}`); } return r; } function V(e, t, n, r, i = !0) { let a = n._zod.def, o = a.type; if (a.coerce) throw new F( `coercion (z.coerce.${o}())`, ); let s = i || !!a.checks?.length, c; switch (o) { case `string`: c = zi(e, t, n, r, s); break; case `number`: c = Bi(e, n, r); break; case `boolean`: c = Vi(e, r); break; case `bigint`: c = Hi(e, n, r); break; case `symbol`: c = Ui(e, r); break; case `undefined`: c = Wi(e, r); break; case `null`: c = Gi(e, r); break; case `any`: case `unknown`: c = r; break; case `never`: (e.write(`return INVALID;`), (c = r)); break; case `void`: c = Ki(e, r); break; case `nan`: c = qi(e, r); break; case `date`: c = Ji(e, r); break; case `object`: c = Yi(e, t, n, r, s); break; case `optional`: c = Xi(e, t, n, r, s); break; case `nullable`: c = ta(e, t, n, r, s); break; case `array`: c = na(e, t, n, r, s); break; case `literal`: c = ra(e, t, n, r); break; case `enum`: c = ia(e, t, n, r); break; case `readonly`: { let i = aa(e, t, n, r), a = R(t); (e.write( `const ${a} = Object.freeze(${i});`, ), (c = a)); break; } case `success`: (aa(e, t, n, r), (c = `true`)); break; case `default`: case `prefault`: c = oa(e, t, n, r); break; case `nonoptional`: c = sa(e, t, n, r); break; case `tuple`: c = ca(e, t, n, r); break; case `union`: c = ua(e, t, n, r); break; case `intersection`: c = pa(e, t, n, r); break; case `record`: c = ma(e, t, n, r); break; case `map`: c = _a(e, t, n, r); break; case `set`: c = va(e, t, n, r); break; case `file`: c = ya(e, r); break; case `template_literal`: c = ba(e, t, n, r); break; case `lazy`: c = xa(e, t, n, r); break; case `pipe`: c = Sa(e, t, n, r); break; case `custom`: c = Ca(e, t, n, r); break; case `transform`: c = Ea(e, t, n, r); break; case `catch`: c = Ta(e, t, n, r); break; default: throw new F(`schema type ${o}`); } return c === null ? null : Si(e, t, n, c); } function zi(e, t, n, r, i = !0) { e.write( `if (typeof ${r} !== "string") return INVALID;`, ); let a = n._zod.def; return a.format === void 0 ? r : Ri(e, t, a, r, i); } function Bi(e, t, n) { e.write( `if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`, ); let r = t._zod.def; return ( r.check === `number_format` && r.format && Oi(e, { format: r.format }, n), n ); } function Vi(e, t) { return ( e.write( `if (typeof ${t} !== "boolean") return INVALID;`, ), t ); } function Hi(e, t, n) { e.write( `if (typeof ${n} !== "bigint") return INVALID;`, ); let r = t._zod.def; if (r.format) switch (r.format) { case `int64`: e.write( `if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`, ); break; case `uint64`: e.write( `if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`, ); } return n; } function Ui(e, t) { return ( e.write( `if (typeof ${t} !== "symbol") return INVALID;`, ), t ); } function Wi(e, t) { return ( e.write( `if (${t} !== undefined) return INVALID;`, ), t ); } function Gi(e, t) { return ( e.write( `if (${t} !== null) return INVALID;`, ), t ); } function Ki(e, t) { return ( e.write( `if (${t} !== undefined) return INVALID;`, ), t ); } function qi(e, t) { return ( e.write( `if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`, ), t ); } function Ji(e, t) { return ( e.write( `if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`, ), t ); } function Yi(e, t, n, r, i = !0) { let a = n._zod.def; e.write( `if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`, ); let o = a.shape, s = Object.keys(o), c = Object.getOwnPropertySymbols(o), l = c.length ? [...s, ...c] : s, u = (e) => typeof e == `symbol` ? I(t, e) : _(e), d = (e) => typeof e == `symbol` ? `[${u(e)}]` : _(e), f = o; if (s.includes(`__proto__`)) throw new F( `object shape key "__proto__"`, ); let p = /* @__PURE__ */ new Map(); for (let n of l) { let a = f[n], o = u(n), s = R(t); if ( (e.write( `const ${s} = ${r}[${o}];`, ), a._zod.optin !== void 0) ) { let i = R(t); (e.write(`let ${i} = (() => {`), e.indented((e) => { let n = z(e, t, a, s); e.write(`return ${n};`); }), e.write(`})();`), a._zod.optout === `optional` ? (e.write( `if (${i} === INVALID) {`, ), e.indented((e) => { (e.write( `if (${o} in ${r}) return INVALID;`, ), e.write( `${i} = undefined;`, )); }), e.write(`}`)) : e.write( `if (${i} === INVALID) return INVALID;`, ), p.set(n, i)); } else { Qi(a) && e.write( `if (!(${o} in ${r})) return INVALID;`, ); let c = z(e, t, a, s, i); c !== null && p.set(n, c); } } let m = a.catchall, h = `none`; if (m) { let t = m._zod.def.type; if (t === `never`) { let t = s .map((e) => `k !== ${_(e)}`) .join(` && `) || `true`; (e.write( `for (const k in ${r}) {`, ), e.indented((e) => { e.write( `if (${t}) return INVALID;`, ); }), e.write(`}`)); } else h = (t === `unknown` || t === `any`) && !m._zod.def.checks?.length ? `passthrough` : `schema`; } let g = R(t), ee = l.some( (e) => ea(f[e]) || $i(f[e]), ); if (!i) { if (h === `schema`) { let n = s.length > 0 ? I(t, new Set(s)) : null; (e.write( `for (const k in ${r}) {`, ), e.indented((e) => { (e.write( `if (k === "__proto__") continue;`, ), n && e.write( `if (${n}.has(k)) continue;`, )); let i = R(t); (e.write( `const ${i} = ${r}[k];`, ), z(e, t, m, i, !1)); }), e.write(`}`)); } return null; } if (ee) { e.write(`const ${g} = {};`); for (let t of l) { let n = u(t), i = p.get(t); $i(f[t]) ? e.write( `if (${n} in ${r}) ${g}[${n}] = ${i};`, ) : ea(f[t]) ? e.write( `if (${i} !== undefined || ${n} in ${r}) ${g}[${n}] = ${i};`, ) : e.write( `${g}[${n}] = ${i};`, ); } } else { let t = l .map( (e) => `${d(e)}: ${p.get(e)}`, ) .join(`, `); e.write(`const ${g} = { ${t} };`); } if (h !== `none`) { let n = s.length > 0 ? I(t, new Set(s)) : null; (e.write(`for (const k in ${r}) {`), e.indented((e) => { if ( (e.write( `if (k === "__proto__") continue;`, ), n && e.write( `if (${n}.has(k)) continue;`, ), h === `passthrough`) ) e.write(`${g}[k] = ${r}[k];`); else { let n = R(t); e.write( `const ${n} = ${r}[k];`, ); let i = z(e, t, m, n); e.write(`${g}[k] = ${i};`); } }), e.write(`}`)); } return g; } function Xi(e, t, n, r, i = !0) { let a = n._zod.def; if (Zi(n)) return V(e, t, a.innerType, r, i); if ( a.innerType._zod.optin === `defaulted` ) { let n = R(t), i = R(t); return ( e.write(`let ${n};`), e.write( `if (${r} === undefined) {`, ), e.indented((e) => { (e.write( `const ${i} = (() => {`, ), e.indented((e) => { let n = V( e, t, a.innerType, r, ); e.write(`return ${n};`); }), e.write(`})();`), e.write( `if (${i} !== INVALID) ${n} = ${i};`, )); }), e.write(`} else {`), e.indented((e) => { let i = V(e, t, a.innerType, r); e.write(`${n} = ${i};`); }), e.write(`}`), n ); } let o = i ? R(t) : null; return ( o && e.write(`let ${o};`), e.write( `if (${r} !== undefined) {`, ), e.indented((e) => { let n = V( e, t, a.innerType, r, i, ); o && n !== null && e.write(`${o} = ${n};`); }), e.write(`}`), o ); } function Zi(e) { return ( e._zod.traits?.has( `$ZodExactOptional`, ) === !0 ); } function Qi(e) { return ( e._zod.optin === void 0 && H(e) ); } function H(e) { if (e._zod.def.coerce) return !0; let t = e._zod.def; switch (t.type) { case `any`: case `unknown`: case `undefined`: case `void`: case `default`: case `prefault`: case `transform`: case `custom`: case `lazy`: return !0; case `string`: case `number`: case `boolean`: case `bigint`: case `symbol`: case `null`: case `never`: case `nan`: case `date`: case `object`: case `array`: case `tuple`: case `record`: case `map`: case `set`: case `file`: case `template_literal`: return !1; case `nonoptional`: return t.innerType ? H(t.innerType) : !1; case `literal`: return !!t.values?.includes( void 0, ); case `enum`: return !!e._zod.values?.has( void 0, ); case `optional`: case `nullable`: case `readonly`: case `success`: return ( !t.innerType || H(t.innerType) ); case `catch`: return !0; case `union`: return ( !t.options || t.options.some(H) ); case `intersection`: return ( !t.left || !t.right || (H(t.left) && H(t.right)) ); case `pipe`: return !t.in || H(t.in); default: return !0; } } function $i(e) { return ( e._zod.optin === `optional` && e._zod.optout === `optional` ); } function ea(e) { return ( (e._zod.optin !== `defaulted` || e._zod.optout === `optional`) && U(e) ); } function U(e) { let t = e._zod.def; switch (t.type) { case `string`: case `number`: case `boolean`: case `bigint`: case `symbol`: case `null`: case `nan`: case `date`: case `object`: case `array`: case `tuple`: case `record`: case `map`: case `set`: case `file`: case `template_literal`: case `never`: case `success`: return !1; case `literal`: return !!t.values?.includes( void 0, ); case `enum`: return !!e._zod.values?.has( void 0, ); case `optional`: return !0; case `nullable`: case `readonly`: case `nonoptional`: return ( !t.innerType || U(t.innerType) ); case `union`: return ( !t.options || t.options.some(U) ); case `intersection`: return ( !t.left || !t.right || U(t.left) || U(t.right) ); case `pipe`: return !t.out || U(t.out); default: return !0; } } function ta(e, t, n, r, i = !0) { let a = n._zod.def, o = i ? R(t) : null; return ( o && e.write(`let ${o} = null;`), e.write(`if (${r} !== null) {`), e.indented((e) => { let n = V( e, t, a.innerType, r, i, ); o && n !== null && e.write(`${o} = ${n};`); }), e.write(`}`), o ); } function na(e, t, n, r, i = !0) { let a = n._zod.def; e.write( `if (!Array.isArray(${r})) return INVALID;`, ); let o = i ? R(t) : null, s = R(t), c = R(t); return ( o && e.write( `const ${o} = new Array(${r}.length);`, ), e.write( `for (let ${s} = 0; ${s} < ${r}.length; ${s}++) {`, ), e.indented((e) => { e.write( `const ${c} = ${r}[${s}];`, ); let n = z(e, t, a.element, c, i); o && n !== null && e.write(`${o}[${s}] = ${n};`); }), e.write(`}`), o ); } function ra(e, t, n, r) { let i = n._zod.def.values; if (i.length !== 1) { let n = I(t, new Set(i)); return ( e.write( `if (!${n}.has(${r})) return INVALID;`, ), r ); } let a = i[0]; if ( typeof a == `number` && Number.isNaN(a) ) { let n = I(t, new Set(i)); return ( e.write( `if (!${n}.has(${r})) return INVALID;`, ), r ); } if (typeof a == `string`) e.write( `if (${r} !== ${_(a)}) return INVALID;`, ); else if ( typeof a == `number` || typeof a == `boolean` ) e.write( `if (${r} !== ${a}) return INVALID;`, ); else if (a === null) e.write( `if (${r} !== null) return INVALID;`, ); else if (a === void 0) e.write( `if (${r} !== undefined) return INVALID;`, ); else if (typeof a == `bigint`) e.write( `if (${r} !== ${a}n) return INVALID;`, ); else throw new F( `literal type ${typeof a}`, ); return r; } function ia(e, t, n, r) { let i = n._zod.values; if (!i) throw new F( `enum schema without enumerated values`, ); let a = I(t, i); return ( e.write( `if (!${a}.has(${r})) return INVALID;`, ), r ); } function aa(e, t, n, r) { let i = n._zod.def; return V(e, t, i.innerType, r); } function oa(e, t, n, r) { let i = n._zod.def, a = Object.getOwnPropertyDescriptor( n._zod.def, `defaultValue`, ) ? () => n._zod.def.defaultValue : void 0; if (n._zod.def.type === `prefault`) { if (!a) return V(e, t, i.innerType, r); let n = I(t, a), o = R(t); return ( e.write(`let ${o} = ${r};`), e.write( `if (${r} === undefined) ${o} = ${n}();`, ), V(e, t, i.innerType, o) ); } let o = R(t); if (a) { let n = I(t, a), s = I(t, ie); (e.write(`let ${o};`), e.write( `if (${r} === undefined) {`, ), e.indented((e) => { e.write(`${o} = ${s}(${n}());`); }), e.write(`} else {`), e.indented((e) => { let a = V(e, t, i.innerType, r); e.write( `${o} = ${a} === undefined ? ${s}(${n}()) : ${a};`, ); }), e.write(`}`)); } else (e.write(`let ${o};`), e.write( `if (${r} !== undefined) {`, ), e.indented((e) => { let n = V(e, t, i.innerType, r); e.write(`${o} = ${n};`); }), e.write(`}`)); return o; } function sa(e, t, n, r) { let i = n._zod.def, a = V(e, t, i.innerType, r), o = R(t); return ( e.write(`const ${o} = ${a};`), e.write( `if (${o} === undefined) return INVALID;`, ), o ); } function ca(e, t, n, r) { let i = n._zod.def, a = i.items, o = i.rest; e.write( `if (!Array.isArray(${r})) return INVALID;`, ); let s = la(a, `optin`), c = la(a, `optout`); o ? e.write( `if (${r}.length < ${s}) return INVALID;`, ) : e.write( `if (${r}.length < ${s} || ${r}.length > ${a.length}) return INVALID;`, ); let l = R(t); e.write(`const ${l} = [];`); for (let n = 0; n < a.length; n++) { let i = a[n]; if (n >= c) (e.write( `if (${l}.length === ${n}) {`, ), e.indented((e) => { (e.write( `if (${n} < ${r}.length) {`, ), e.indented((e) => { let a = R(t); e.write( `const ${a} = ${r}[${n}];`, ); let o = z(e, t, i, a); e.write( `${l}[${n}] = ${o};`, ); }), e.write(`} else {`), e.indented((e) => { if ($i(i)) { e.write( `${l}.length = ${n};`, ); return; } let r = R(t), a = R(t); (e.write( `const ${r} = undefined;`, ), e.write( `const ${a} = (() => {`, ), e.indented((e) => { let n = z(e, t, i, r); e.write( `return ${n};`, ); }), e.write(`})();`), e.write( `if (${a} === INVALID || ${a} === undefined) ${l}.length = ${n};`, ), e.write( `else ${l}[${n}] = ${a};`, )); }), e.write(`}`)); }), e.write(`}`)); else { let a = R(t); e.write( `const ${a} = ${r}[${n}];`, ); let o = z(e, t, i, a); e.write(`${l}[${n}] = ${o};`); } } if (o) { let n = R(t), i = R(t); (e.write( `for (let ${n} = ${a.length}; ${n} < ${r}.length; ${n}++) {`, ), e.indented((e) => { e.write( `const ${i} = ${r}[${n}];`, ); let a = z(e, t, o, i); e.write(`${l}[${n}] = ${a};`); }), e.write(`}`)); } return l; } function la(e, t) { for ( let n = e.length - 1; n >= 0; n-- ) if ( !(t === `optin` ? e[n]._zod.optin !== void 0 : e[n]._zod.optout === `optional`) ) return n + 1; return 0; } function ua(e, t, n, r) { let i = n._zod.def, a = i.options; if (i.discriminator) return da(e, t, i, r); if (i.inclusive === !1) throw new F( `exclusive unions (z.xor)`, ); if (a.length === 0) return ( e.write(`return INVALID;`), r ); if (a.length === 1) return V(e, t, a[0], r); if ( a.every( (e) => e._zod.def.type === `literal` && !e._zod.def.checks?.length, ) ) { let n = I( t, new Set( a.flatMap( (e) => e._zod.def.values, ), ), ); return ( e.write( `if (!${n}.has(${r})) return INVALID;`, ), r ); } let o = R(t); e.write(`let ${o};`); for (let n = 0; n < a.length; n++) { let i = a[n]; (n === 0 ? e.write(`${o} = (() => {`) : e.write( `if (${o} === INVALID) ${o} = (() => {`, ), e.indented((e) => { let n = V(e, t, i, r); e.write(`return ${n};`); }), e.write(`})();`)); } return ( e.write( `if (${o} === INVALID) return INVALID;`, ), o ); } function da(e, t, n, r) { if (n.unionFallback) throw new F( `discriminated union with unionFallback`, ); if (n.options.length === 0) return ( e.write(`return INVALID;`), r ); let i = R(t), a = R(t); (e.write( `const ${i} = ${r}?.[${_(n.discriminator)}];`, ), e.write(`let ${a};`)); let o = !0, s = /* @__PURE__ */ new Set(); for (let c of n.options) { let l = c._zod.propValues?.[ n.discriminator ]; if (!l || l.size === 0) throw new F( `discriminated union option without static discriminator values`, ); for (let e of l) { if (s.has(e)) throw new F( `duplicate discriminator value ${String(e)}`, ); s.add(e); } let u = Array.from(l, (e) => fa(t, i, e), ), d = o ? `if` : `else if`; (e.write( `${d} (${u.join(` || `)}) {`, ), e.indented((e) => { let n = V(e, t, c, r); e.write(`${a} = ${n};`); }), e.write(`}`), (o = !1)); } return ( e.write(`else { return INVALID; }`), a ); } function fa(e, t, n) { if (typeof n == `string`) return `${t} === ${_(n)}`; if (typeof n == `number`) return Number.isNaN(n) ? `Number.isNaN(${t})` : `${t} === ${n}`; if (typeof n == `boolean`) return `${t} === ${n}`; if (n === null) return `${t} === null`; if (n === void 0) return `${t} === undefined`; if (typeof n == `bigint`) return `${t} === ${n}n`; if (typeof n == `symbol`) return `${t} === ${I(e, n)}`; throw new F( `literal discriminator value ${String(n)}`, ); } function pa(e, t, n, r) { let i = n._zod.def; t.definite = !1; let a = z(e, t, i.left, r), o = z(e, t, i.right, r), s = I(t, Tr), c = R(t); return ( e.write( `const ${c} = ${s}(${a}, ${o});`, ), e.write( `if (!${c}.valid) return INVALID;`, ), `${c}.data` ); } function ma(e, t, n, r) { let i = n._zod.def, a = I(t, v); e.write( `if (!${a}(${r})) return INVALID;`, ); let o = R(t), s = R(t), c = R(t); e.write(`const ${o} = {};`); let l = i, u = l.partial ? void 0 : i.keyType._zod.values; if (u) { let n = []; for (let a of u) { if ( typeof a != `string` && typeof a != `number` && typeof a != `symbol` ) throw new F( `record key value ${String(a)}`, ); let s = typeof a == `number` ? a.toString() : a; if (s === `__proto__`) throw new F( `record key "__proto__"`, ); n.push(s); let c = I(t, a), l = V(e, t, i.keyType, c), u = R(t); e.write( `const ${u} = ${r}[${ga(t, s)}];`, ); let d = z(e, t, i.valueType, u); e.write(`${o}[${l}] = ${d};`); } let a = I(t, new Set(n)); return ( e.write( `for (const ${s} in ${r}) {`, ), e.indented((e) => { (e.write( `if (${a}.has(${s})) continue;`, ), l.mode === `loose` ? e.write( `if (${s} !== "__proto__") ${o}[${s}] = ${r}[${s}];`, ) : e.write( `return INVALID;`, )); }), e.write(`}`), o ); } let d = i.keyType._zod.def; if ( d.type !== `string` || d.format !== void 0 || d.coerce || (d.checks?.length ?? 0) !== 0 ) { let n = i.mode === `loose`, a = vi(i.keyType); a.definite === !1 && (t.definite = !1); let c = I(t, a), l = I(t, qt), u = R(t); return ( ha(e, t, r, s, (e) => { (e.write( `let ${u} = ${c}(${s});`, ), e.write( `if (${u} === INVALID && typeof ${s} === "string" && ${l}.test(${s})) ${u} = ${c}(Number(${s}));`, ), n ? e.write( `if (${u} === INVALID) { ${o}[${s}] = ${r}[${s}]; continue; }`, ) : e.write( `if (${u} === INVALID) return INVALID;`, ), e.write( `if (${u} === "__proto__") continue;`, )); let a = R(t); e.write( `const ${a} = ${r}[${s}];`, ); let d = z(e, t, i.valueType, a); e.write(`${o}[${u}] = ${d};`); }), o ); } return ( ha( e, t, r, s, (e) => { e.write( `const ${c} = ${r}[${s}];`, ); let n = z(e, t, i.valueType, c); e.write(`${o}[${s}] = ${n};`); }, `return INVALID;`, ), o ); } function ha(e, t, n, r, i, a) { let o = I( t, Object.prototype .propertyIsEnumerable, ), s = R(t), c = R(t), l = R(t); (e.write( `const ${s} = Object.getOwnPropertySymbols(${n});`, ), e.write( `const ${c} = Object.getOwnPropertyNames(${n});`, ), e.write( `for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`, ), e.indented((e) => { (e.write( `const ${r} = ${c}[${l}];`, ), e.write( `if (${r} === "__proto__" || !${o}.call(${n}, ${r})) continue;`, ), i(e)); }), e.write(`}`), e.write( `for (let ${l} = 0; ${l} < ${s}.length; ${l}++) {`, ), e.indented((e) => { (e.write( `const ${r} = ${s}[${l}];`, ), e.write( `if (!${o}.call(${n}, ${r})) continue;`, ), a ? e.write(a) : i(e)); }), e.write(`}`)); } function ga(e, t) { return typeof t == `string` ? _(t) : I(e, t); } function _a(e, t, n, r) { let i = n._zod.def; e.write( `if (!(${r} instanceof Map)) return INVALID;`, ); let a = R(t), o = R(t), s = R(t); return ( e.write(`const ${a} = new Map();`), e.write( `for (const [${o}, ${s}] of ${r}) {`, ), e.indented((e) => { let n = V(e, t, i.keyType, o), r = V(e, t, i.valueType, s); e.write(`${a}.set(${n}, ${r});`); }), e.write(`}`), a ); } function va(e, t, n, r) { let i = n._zod.def; e.write( `if (!(${r} instanceof Set)) return INVALID;`, ); let a = R(t), o = R(t); return ( e.write(`const ${a} = new Set();`), e.write( `for (const ${o} of ${r}) {`, ), e.indented((e) => { let n = V(e, t, i.valueType, o); e.write(`${a}.add(${n});`); }), e.write(`}`), a ); } function ya(e, t) { return ( e.write( `if (!(${t} instanceof File)) return INVALID;`, ), t ); } function ba(e, t, n, r) { e.write( `if (typeof ${r} !== "string") return INVALID;`, ); let i = n._zod.pattern; if (i) { let n = I(t, i); (e.write(`${n}.lastIndex = 0;`), e.write( `if (!${n}.test(${r})) return INVALID;`, )); } return r; } function xa(e, t, n, r) { let i = n._zod.def, a = L(t, i.getter), o = I(t, { parser: null }); (e.write(`if (!${o}.parser) {`), e.indented((e) => { (e.write(`const inner = ${a}();`), e.write( `${o}.parser = function(input) {`, ), e.indented((e) => { (e.write( `const result = inner._zod.run({ value: input, issues: [] }, {});`, ), e.write( `return result.issues.length === 0 ? result.value : INVALID;`, )); }), e.write(`};`)); }), e.write(`}`)); let s = R(t); return ( e.write( `const ${s} = ${o}.parser(${r});`, ), e.write( `if (${s} === INVALID) return INVALID;`, ), s ); } function Sa(e, t, n, r) { let i = n._zod.def, a = V(e, t, i.in, r); if (i.transform) { if (W(i.transform)) throw new P( `z.compile: async transforms in pipes are not supported`, ); let n = i.transform, r = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi, }, r = n(e, t); return r instanceof Promise ? N : t.issues.length === 0 ? r : N; }), o = R(t); return ( e.write( `const ${o} = ${r}(${a});`, ), e.write( `if (${o} === INVALID) return INVALID;`, ), V(e, t, i.out, o) ); } return V(e, t, i.out, a); } function W(e) { return ( typeof e == `function` && (e.constructor.name === `AsyncFunction` || e[Symbol.toStringTag] === `AsyncFunction`) ); } function Ca(e, t, n, r) { let i = n._zod.def; if (i.fn) { if (W(i.fn)) throw new P( `z.compile: async custom predicates are not supported`, ); let n = L(t, i.fn), a = I(t, Pi), o = R(t); (e.write( `const ${o} = ${n}(${r});`, ), e.write( `if (${o} instanceof Promise) ${a}();`, ), e.write( `if (!${o}) return INVALID;`, )); } else throw new F( `custom schema without a predicate function`, ); return r; } function wa(e, t, n) { let r = e._zod.run( { value: n, issues: [] }, {}, ); if (r && typeof r.then == `function`) return N; let i = r; return i.issues.length === 0 ? i.value : t(); } function Ta(e, t, n, r) { let i = n._zod.def; if (!i.catchValue[`~constantCatch`]) throw new F( `catch with a callback (only a constant catch value compiles)`, !1, ); let a = R(t); (e.write(`let ${a} = (() => {`), e.indented((e) => { let n = z(e, t, i.innerType, r); e.write(`return ${n};`); }), e.write(`})();`)); let o = I(t, i.innerType), s = L(t, i.catchValue), c = I(t, wa); return ( e.write(`if (${a} === INVALID) {`), e.indented((e) => { (e.write( `${a} = ${c}(${o}, ${s}, ${r});`, ), e.write( `if (${a} === INVALID) return INVALID;`, )); }), e.write(`}`), a ); } function Ea(e, t, n, r) { let i = n._zod.def; if (i.transform) { if (W(i.transform)) throw new P( `z.compile: async transforms are not supported`, ); let n = i.transform, a = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi, }, r = n(e, t); return r instanceof Promise ? N : t.issues.length === 0 ? r : N; }), o = R(t); return ( e.write( `const ${o} = ${a}(${r});`, ), e.write( `if (${o} === INVALID) return INVALID;`, ), o ); } return r; } function Da(e) { return ( (e.checks &&= [...e.checks]), e ); } // @__NO_SIDE_EFFECTS__ function Oa(e, t) { return new e( Da({ type: `string`, ...b(t) }), ); } // @__NO_SIDE_EFFECTS__ function ka(e, t) { return new e({ type: `string`, format: `email`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Aa(e, t) { return new e({ type: `string`, format: `guid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function ja(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ma(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v4`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Na(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v6`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Pa(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v7`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Fa(e, t) { return new e({ type: `string`, format: `url`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ia(e, t) { return new e({ type: `string`, format: `emoji`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function La(e, t) { return new e({ type: `string`, format: `nanoid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ra(e, t) { return new e({ type: `string`, format: `cuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function za(e, t) { return new e({ type: `string`, format: `cuid2`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ba(e, t) { return new e({ type: `string`, format: `ulid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Va(e, t) { return new e({ type: `string`, format: `xid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ha(e, t) { return new e({ type: `string`, format: `ksuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ua(e, t) { return new e({ type: `string`, format: `ipv4`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Wa(e, t) { return new e({ type: `string`, format: `ipv6`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ga(e, t) { return new e({ type: `string`, format: `cidrv4`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ka(e, t) { return new e({ type: `string`, format: `cidrv6`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function qa(e, t) { return new e({ type: `string`, format: `base64`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ja(e, t) { return new e({ type: `string`, format: `base64url`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ya(e, t) { return new e({ type: `string`, format: `e164`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Xa(e, t) { return new e({ type: `string`, format: `jwt`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Za(e, t) { return new e({ type: `string`, format: `datetime`, check: `string_format`, offset: !1, local: !1, precision: null, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Qa(e, t) { return new e({ type: `string`, format: `date`, check: `string_format`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function $a(e, t) { return new e({ type: `string`, format: `time`, check: `string_format`, precision: null, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function eo(e, t) { return new e({ type: `string`, format: `duration`, check: `string_format`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function to(e, t) { return new e( Da({ type: `number`, checks: [], ...b(t), }), ); } // @__NO_SIDE_EFFECTS__ function no(e, t) { return new e({ type: `number`, check: `number_format`, abort: !1, format: `safeint`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function ro(e) { return new e({ type: `unknown` }); } // @__NO_SIDE_EFFECTS__ function io(e, t) { return new e({ type: `never`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function ao(e, t) { return new e({ type: `date`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function oo(e, t) { return new Qt({ check: `less_than`, ...b(t), value: e, inclusive: !1, }); } // @__NO_SIDE_EFFECTS__ function so(e, t) { return new Qt({ check: `less_than`, ...b(t), value: e, inclusive: !0, }); } // @__NO_SIDE_EFFECTS__ function co(e, t) { return new $t({ check: `greater_than`, ...b(t), value: e, inclusive: !1, }); } // @__NO_SIDE_EFFECTS__ function lo(e, t) { return new $t({ check: `greater_than`, ...b(t), value: e, inclusive: !0, }); } // @__NO_SIDE_EFFECTS__ function uo(e, t) { return new en({ check: `multiple_of`, ...b(t), value: e, }); } // @__NO_SIDE_EFFECTS__ function fo(e, t) { return new nn({ check: `max_length`, ...b(t), maximum: e, }); } // @__NO_SIDE_EFFECTS__ function po(e, t) { return new rn({ check: `min_length`, ...b(t), minimum: e, }); } // @__NO_SIDE_EFFECTS__ function mo(e, t) { return new an({ check: `length_equals`, ...b(t), length: e, }); } // @__NO_SIDE_EFFECTS__ function ho(e, t) { return new sn({ check: `string_format`, format: `regex`, ...b(t), pattern: e, }); } // @__NO_SIDE_EFFECTS__ function go(e) { return new cn({ check: `string_format`, format: `lowercase`, ...b(e), }); } // @__NO_SIDE_EFFECTS__ function _o(e) { return new ln({ check: `string_format`, format: `uppercase`, ...b(e), }); } // @__NO_SIDE_EFFECTS__ function vo(e, t) { return new un({ check: `string_format`, format: `includes`, ...b(t), includes: e, }); } // @__NO_SIDE_EFFECTS__ function yo(e, t) { return new dn({ check: `string_format`, format: `starts_with`, ...b(t), prefix: e, }); } // @__NO_SIDE_EFFECTS__ function bo(e, t) { return new fn({ check: `string_format`, format: `ends_with`, ...b(t), suffix: e, }); } // @__NO_SIDE_EFFECTS__ function xo(e) { return new pn({ check: `overwrite`, tx: e, }); } // @__NO_SIDE_EFFECTS__ function So(e) { return /* @__PURE__ */ xo((t) => t.normalize(e), ); } // @__NO_SIDE_EFFECTS__ function Co() { return /* @__PURE__ */ xo((e) => e.trim(), ); } // @__NO_SIDE_EFFECTS__ function wo() { return /* @__PURE__ */ xo((e) => e.toLowerCase(), ); } // @__NO_SIDE_EFFECTS__ function To() { return /* @__PURE__ */ xo((e) => e.toUpperCase(), ); } // @__NO_SIDE_EFFECTS__ function Eo() { return /* @__PURE__ */ xo((e) => ee(e), ); } // @__NO_SIDE_EFFECTS__ function Do(e, t, n) { return new e({ type: `array`, element: t, ...b(n), }); } // @__NO_SIDE_EFFECTS__ function Oo(e, t, n) { return new e({ type: `custom`, check: `custom`, fn: t, ...b(n), }); } // @__NO_SIDE_EFFECTS__ function ko(e, t) { let n = /* @__PURE__ */ Ao( (t) => ( (t.addIssue = (e) => { if (typeof e == `string`) t.issues.push( Oe(e, t.value, n._zod.def), ); else { let r = e; (r.fatal && (r.continue = !1), (r.code ??= `custom`), `input` in r || (r.input = t.value), (r.inst ??= n), (r.continue ??= !n._zod.def.abort), t.issues.push(Oe(r))); } }), e(t.value, t) ), t, ); return n; } // @__NO_SIDE_EFFECTS__ function Ao(e, t) { let n = new A({ check: `custom`, ...b(t), }); return ((n._zod.check = e), n); } function jo(e, ...t) { for (let n of t) for (let t of Reflect.ownKeys(n)) Object.prototype.propertyIsEnumerable.call( n, t, ) && l(e, t, n[t]); return e; } function Mo(e) { let t = e?.target ?? `draft-2020-12`; return ( t === `draft-4` && (t = `draft-04`), t === `draft-7` && (t = `draft-07`), { processors: e.processors ?? {}, metadataRegistry: e?.metadata ?? fi, target: t, unrepresentable: e?.unrepresentable ?? `throw`, override: e?.override ?? (() => {}), io: e?.io ?? `output`, counter: 0, seen: /* @__PURE__ */ new Map(), sharedDefsExtractedFor: void 0, sharedEmitDoneFor: void 0, cycles: e?.cycles ?? `ref`, reused: e?.reused ?? `inline`, intersections: [], deferred: [], external: e?.external ?? void 0, } ); } function G(e, t, n, r, i) { let a = typeof t.unrepresentable == `function` ? t.unrepresentable({ zodSchema: e, path: r.path, message: i, }) : t.unrepresentable; if (a === `any`) return !1; if (a === void 0 || a === `throw`) throw Error(i); return (Object.assign(n, a), !0); } function K( e, t, n = { path: [], schemaPath: [] }, ) { var r; let i = e._zod.def, a = t.seen.get(e); if (a) return ( a.count++, n.schemaPath.includes(e) && (a.cycle = n.path), a.schema ); let o = { schema: {}, count: 1, cycle: void 0, path: n.path, }; (t.seen.set(e, o), (t.sharedDefsExtractedFor = void 0), (t.sharedEmitDoneFor = void 0)); let s = e._zod.toJSONSchema?.(); if (s) o.schema = s; else { let r = { ...n, schemaPath: [...n.schemaPath, e], path: n.path, }; if (e._zod.processJSONSchema) e._zod.processJSONSchema( t, o.schema, r, ); else { let n = o.schema, a = t.processors[i.type]; if (!a) throw Error( `[toJSONSchema]: Non-representable type encountered: ${i.type}`, ); a(e, t, n, r); } let a = e._zod.parent; a && ((o.ref ||= a), K(a, t, r), (t.seen.get(a).isParent = !0)); } let c = t.metadataRegistry.get(e); return ( c && jo(o.schema, c), t.io === `input` && q(e) && (delete o.schema.examples, delete o.schema.default), t.io === `input` && `_prefault` in o.schema && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, t.seen.get(e).schema ); } function No(e) { return e .replace(/~/g, `~0`) .replace(/\//g, `~1`); } function Po(e, t) { let n = e.seen.get(t); if (!n) throw Error( `Unprocessed schema. This is a bug in Zod.`, ); if ( e.external && e.sharedDefsExtractedFor === e.external ) return; let r = /* @__PURE__ */ new Map(); for (let t of e.seen.entries()) { let n = e.metadataRegistry.get( t[0], )?.id; if (n) { let e = r.get(n); if (e && e !== t[0]) throw Error( `Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`, ); r.set(n, t[0]); } } let i = (t) => { let r = e.target === `draft-2020-12` ? `$defs` : `definitions`; if (e.external) { let n = e.external.registry.get( t[0], )?.id, i = e.external.uri ?? ((e) => e); if (n) return { ref: i(n) }; let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`; return ( (t[1].defId = a), { defId: a, ref: `${i(`__shared`)}#/${r}/${No(a)}`, } ); } let i = `#/${r}/`; if (t[1] === n && !t[1].schema.id) return { ref: `#` }; let a = t[1].schema.id ?? `__schema${e.counter++}`; return { defId: a, ref: i + No(a), }; }, a = (e) => { if (e[1].schema.$ref) return; let t = e[1], { ref: n, defId: r } = i(e); ((t.def = { ...t.schema }), r && (t.defId = r)); let a = t.schema; for (let e in a) delete a[e]; a.$ref = n; }; if (e.cycles === `throw`) for (let t of e.seen.entries()) { let e = t[1]; if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root> Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`); } for (let n of e.seen.entries()) { let r = n[1]; if (t === n[0]) { a(n); continue; } if (e.external) { let r = e.external.registry.get( n[0], )?.id; if (t !== n[0] && r) { a(n); continue; } } if ( e.metadataRegistry.get(n[0])?.id ) { a(n); continue; } if (r.cycle) { a(n); continue; } r.count > 1 && e.reused === `ref` && a(n); } e.external && (e.sharedDefsExtractedFor = e.external); } function Fo(e) { let t = e.anyOf; if ( !Array.isArray(t) || t.length === 0 || e.type !== void 0 ) return; let n = []; for (let e of t) { if (!e || typeof e != `object`) return; Fo(e); let t = Object.keys(e); if ( t.length !== 1 || t[0] !== `type` ) return; let r = e.type; for (let e of Array.isArray(r) ? r : [r]) { if (typeof e != `string`) return; n.includes(e) || n.push(e); } } (delete e.anyOf, (e.type = n.length === 1 ? n[0] : n)); } const Io = /* @__PURE__ */ new Set([ `type`, `properties`, `required`, `additionalProperties`, ]), Lo = [`oneOf`, `anyOf`]; function Ro(e) { let t = e.additionalProperties; return t === void 0 || t === !1 || typeof t != `object` || !t ? null : Object.keys(t).length ? t : null; } function zo(e) { let t = []; for (let n of e) { if ( typeof n != `object` || n.type !== `object` ) return null; for (let e in n) if (!Io.has(e)) return null; t.push(n); } let n = {}, r = /* @__PURE__ */ new Set(); for (let e of t) { for (let r in e.properties) { if ( Object.prototype.hasOwnProperty.call( n, r, ) ) continue; let e = []; for (let n of t) { let t = n.properties?.[r] ?? Ro(n); t != null && (e.some( (e) => JSON.stringify(e) === JSON.stringify(t), ) || e.push(t)); } l( n, r, e.length === 1 ? e[0] : (zo(e) ?? { allOf: e }), ); } for (let t of e.required ?? []) r.add(t); } let i = { type: `object`, properties: n, }; if ( (r.size && (i.required = [...r]), t.every( (e) => e.additionalProperties === !1, )) ) i.additionalProperties = !1; else { let e = []; for (let n of t) { let t = Ro(n); t && !e.some( (e) => JSON.stringify(e) === JSON.stringify(t), ) && e.push(t); } e.length === 1 ? (i.additionalProperties = e[0]) : e.length > 1 && (i.additionalProperties = { allOf: e, }); } return i; } function Bo(e) { let t = e.allOf; if (!Array.isArray(t) || t.length < 2) return; for (let t of Io) if (t in e) return; let n = t.filter((e) => Lo.some((t) => Array.isArray(e[t]), ), ), r = null; if (!n.length) r = zo(t); else { let e = n[0], i = Lo.find((t) => Array.isArray(e[t]), ); if (Object.keys(e).length !== 1) return; let a = t.filter((t) => t !== e), o = e[i].map((e) => zo([...a, e]), ); if (o.some((e) => !e)) return; r = { [i]: o }; } r && (delete e.allOf, jo(e, r)); } function Vo(e, t) { let n = e.seen.get(t); if (!n) throw Error( `Unprocessed schema. This is a bug in Zod.`, ); let r = (t) => { let n = e.seen.get(t); if (n.ref === null) return; let i = n.def ?? n.schema, a = { ...i }, o = n.ref; if (((n.ref = null), o)) { r(o); let n = e.seen.get(o), s = n.schema; if ( (s.$ref && (e.target === `draft-07` || e.target === `draft-04` || e.target === `openapi-3.0`) ? ((i.allOf = i.allOf ?? []), i.allOf.push(s)) : jo(i, s), jo(i, a), t._zod.parent === o) ) for (let e in i) e !== `$ref` && e !== `allOf` && (e in a || delete i[e]); if (s.$ref && n.def) for (let e in i) e !== `$ref` && e !== `allOf` && e in n.def && JSON.stringify(i[e]) === JSON.stringify( n.def[e], ) && delete i[e]; } let s = t._zod.parent; if (s && s !== o) { r(s); let t = e.seen.get(s); if ( t?.schema.$ref && ((i.$ref = t.schema.$ref), t.def) ) for (let e in i) e !== `$ref` && e !== `allOf` && e in t.def && JSON.stringify(i[e]) === JSON.stringify( t.def[e], ) && delete i[e]; } e.override({ zodSchema: t, jsonSchema: i, path: n.path ?? [], }); }; if ( !e.external || e.sharedEmitDoneFor !== e.external ) { for (let t of [ ...e.seen.entries(), ].reverse()) r(t[0]); if (e.target !== `openapi-3.0`) for (let t of e.seen.entries()) Fo(t[1].def ?? t[1].schema); for (let t of e.deferred) t(); if (e.intersections.length) { let t = /* @__PURE__ */ new Map(); for (let n of e.seen.values()) for (let e of [ n.schema, n.def, ]) { let n = e?.allOf; if (!Array.isArray(n)) continue; let r = t.get(n); r ? r.push(e) : t.set(n, [e]); } for (let n of e.intersections) for (let e of t.get(n) ?? []) Bo(e); } } let i = {}; if ( (e.target === `draft-2020-12` ? (i.$schema = `https://json-schema.org/draft/2020-12/schema`) : e.target === `draft-07` ? (i.$schema = `http://json-schema.org/draft-07/schema#`) : e.target === `draft-04` ? (i.$schema = `http://json-schema.org/draft-04/schema#`) : e.target, e.external?.uri) ) { let n = e.external.registry.get(t)?.id; if (!n) throw Error( "Schema is missing an `id` property", ); i.$id = e.external.uri(n); } jo( i, n.defId ? n.schema : (n.def ?? n.schema), ); let a = e.metadataRegistry.get(t)?.id; a !== void 0 && i.id === a && delete i.id; let o = e.external?.defs ?? {}; if ( !e.external || e.sharedEmitDoneFor !== e.external ) for (let t of e.seen.entries()) { let e = t[1]; e.def && e.defId && (e.def.id === e.defId && delete e.def.id, l(o, e.defId, e.def)); } (e.external && (e.sharedEmitDoneFor = e.external), e.external || (Object.keys(o).length > 0 && (e.target === `draft-2020-12` ? (i.$defs = o) : (i.definitions = o)))); try { let n = JSON.parse( JSON.stringify(i), ); return ( Object.defineProperty( n, "~standard", { value: { ...t[`~standard`], jsonSchema: { input: Uo( t, `input`, e.processors, ), output: Uo( t, `output`, e.processors, ), }, }, enumerable: !1, writable: !1, }, ), n ); } catch { throw Error( `Error converting schema to JSON.`, ); } } function q(e, t) { let n = t ?? { seen: /* @__PURE__ */ new Set(), }; if (n.seen.has(e)) return !1; n.seen.add(e); let r = e._zod.def; if (r.type === `transform`) return !0; if (r.type === `array`) return q(r.element, n); if (r.type === `set`) return q(r.valueType, n); if (r.type === `lazy`) return q(r.getter(), n); if ( r.type === `promise` || r.type === `optional` || r.type === `nonoptional` || r.type === `nullable` || r.type === `readonly` || r.type === "default" || r.type === `prefault` || r.type === `catch` ) return q(r.innerType, n); if (r.type === `intersection`) return ( q(r.left, n) || q(r.right, n) ); if ( r.type === `record` || r.type === `map` ) return ( q(r.keyType, n) || q(r.valueType, n) ); if (r.type === `pipe`) return e._zod.traits.has( `$ZodCodec`, ) ? !0 : q(r.in, n) || q(r.out, n); if (r.type === `object`) { for (let e in r.shape) if (q(r.shape[e], n)) return !0; return !1; } if (r.type === `union`) { for (let e of r.options) if (q(e, n)) return !0; return !1; } if (r.type === `tuple`) { for (let e of r.items) if (q(e, n)) return !0; return !!(r.rest && q(r.rest, n)); } return !1; } const Ho = (e, t = {}) => (n) => { let r = Mo({ ...n, processors: t, }); return ( K(e, r), Po(r, e), Vo(r, e) ); }, Uo = (e, t, n = {}) => (r) => { let { libraryOptions: i, target: a, } = r ?? {}, o = Mo({ ...(i ?? {}), target: a, io: t, processors: n, }); return ( K(e, o), Po(o, e), Vo(o, e) ); }, Wo = (e, t, n) => { (e[t] === void 0 || n > e[t]) && (e[t] = n); }, Go = (e, t, n) => { (e[t] === void 0 || n < e[t]) && (e[t] = n); }, Ko = (e, t) => { (Wo(e, `minimum`, t), Go(e, `maximum`, t)); }, qo = (e, t) => { ((e.multipleOf ??= []), e.multipleOf.includes(t) || e.multipleOf.push(t)); }, Jo = (e, t) => { ((e.patterns ??= /* @__PURE__ */ new Set()), e.patterns.add(t)); }, Yo = (e, t) => { e.mime = e.mime ? e.mime.filter((e) => t.includes(e), ) : [...t]; }, Xo = (e, t) => { ((e.format = t), t.includes(`int`) && (e.isInt = !0)); }, Zo = (e, t) => Wo(e, `minimum`, t.minimum), Qo = (e, t) => Go(e, `maximum`, t.maximum), $o = (e) => (t, n) => { Xo(t, n.format); let [r, i] = e[n.format]; (Wo(t, `minimum`, r), Go(t, `maximum`, i)); }, es = { greater_than: (e, t) => Wo( e, t.inclusive ? `minimum` : `exclusiveMinimum`, t.value, ), less_than: (e, t) => Go( e, t.inclusive ? `maximum` : `exclusiveMaximum`, t.value, ), multiple_of: (e, t) => qo(e, t.value), number_format: $o(le), bigint_format: $o(ue), min_length: Zo, max_length: Qo, length_equals: (e, t) => Ko(e, t.length), min_size: Zo, max_size: Qo, size_equals: (e, t) => Ko(e, t.size), string_format: (e, t) => { (Xo(e, t.format), t.pattern && Jo(e, t.pattern), (t.format === `base64` || t.format === `base64url`) && (e.contentEncoding = t.format), (t.local || t.precision === -1) && (e.laxFormat = !0)); }, mime_type: (e, t) => Yo(e, t.mime), }; function J(e) { let t = {}, n = e._zod.def, r = e._zod.traits.has(`$ZodCheck`) ? [e, ...(n.checks ?? [])] : (n.checks ?? []); for (let e of r) es[e._zod.def.check]?.( t, e._zod.def, ); let i = e._zod.bag; (i.minimum !== void 0 && Wo(t, `minimum`, i.minimum), i.exclusiveMinimum !== void 0 && Wo( t, `exclusiveMinimum`, i.exclusiveMinimum, ), i.maximum !== void 0 && Go(t, `maximum`, i.maximum), i.exclusiveMaximum !== void 0 && Go( t, `exclusiveMaximum`, i.exclusiveMaximum, ), i.multipleOf !== void 0 && qo(t, i.multipleOf), i.format !== void 0 && ((t.format ??= i.format), i.format.includes(`int`) && (t.isInt = !0)), i.mime && Yo(t, i.mime)); for (let e of i.patterns ?? []) Jo(t, e); return t; } const ts = { guid: `uuid`, url: `uri`, datetime: `date-time`, json_string: `json-string`, regex: ``, }, ns = /* @__PURE__ */ new Map([ [Xn, Pt], [Qn, Ft], ]), rs = (e) => ns.get(e) ?? e, is = (e, t, n, r) => { let i = n; i.type = `string`; let { minimum: a, maximum: o, format: s, patterns: c, contentEncoding: l, laxFormat: u, } = J(e); if ( (typeof a == `number` && (i.minLength = a), typeof o == `number` && (i.maxLength = o), s && ((i.format = ts[s] ?? s), i.format === `` && delete i.format, (s === `time` || u) && delete i.format), l && (i.contentEncoding = l), c && c.size > 0) ) { let e = [...c].map(rs); e.length === 1 ? (i.pattern = e[0].source) : e.length > 1 && (i.allOf = [ ...e.map((e) => ({ ...(t.target === `draft-07` || t.target === `draft-04` || t.target === `openapi-3.0` ? { type: `string` } : {}), pattern: e.source, })), ]); } }, as = (e, t, n, r) => { let i = n, { minimum: a, maximum: o, multipleOf: s, exclusiveMaximum: c, exclusiveMinimum: l, isInt: u, } = J(e); i.type = u ? `integer` : `number`; let d = typeof l == `number` && l >= (a ?? -1 / 0), f = typeof c == `number` && c <= (o ?? 1 / 0), p = t.target === `draft-04` || t.target === `openapi-3.0`; if ( (d ? p ? ((i.minimum = l), (i.exclusiveMinimum = !0)) : (i.exclusiveMinimum = l) : typeof a == `number` && (i.minimum = a), f ? p ? ((i.maximum = c), (i.exclusiveMaximum = !0)) : (i.exclusiveMaximum = c) : typeof o == `number` && (i.maximum = o), s) ) { let n = /* @__PURE__ */ new Set(); for (let a of s) Number.isFinite(a) && a !== 0 ? n.add(Math.abs(a)) : G( e, t, i, r, `A multipleOf divisor of ${a} cannot be represented in JSON Schema`, ); let [a, ...o] = n; (a !== void 0 && (i.multipleOf = a), o.length && (i.allOf = [ ...(i.allOf ?? []), ...o.map((e) => ({ multipleOf: e, })), ])); } }, os = (e, t, n, r) => { n.not = {}; }, ss = (e, t, n, r) => { G( e, t, n, r, `Date cannot be represented in JSON Schema`, ); }, cs = (e, n, r, i) => { let a = e._zod.def, o = t(a.entries); if (o.length === 0) { r.not = {}; return; } (o.every( (e) => typeof e == `number`, ) && (r.type = `number`), o.every( (e) => typeof e == `string`, ) && (r.type = `string`), (r.enum = o)); }, ls = (e, t, n, r) => { G( e, t, n, r, `Custom types cannot be represented in JSON Schema`, ); }, us = (e, t, n, r) => { G( e, t, n, r, `Transforms cannot be represented in JSON Schema`, ); }, ds = (e, t, n, r) => { let i = n, a = e._zod.def, { minimum: o, maximum: s } = J(e); (typeof o == `number` && (i.minItems = o), typeof s == `number` && (i.maxItems = s), (i.type = `array`), (i.items = K(a.element, t, { ...r, path: [...r.path, `items`], }))); }; function fs(e) { let t = e._zod.def; return t.type === `pipe` && t.in._zod.traits.has( `$ZodTransform`, ) ? fs(t.out) : t.type === `catch` ? fs(t.innerType) : e._zod.optin; } const ps = (e, t, n, r) => { let i = n, a = e._zod.def, o = a.shape; if ( Object.getOwnPropertySymbols(o) .length && G( e, t, i, r, `Symbol keys cannot be represented in JSON Schema`, ) ) return; ((i.type = `object`), (i.properties = {})); for (let e in o) l( i.properties, e, K(o[e], t, { ...r, path: [ ...r.path, `properties`, e, ], }), ); let s = []; for (let e of Object.keys(o)) { let n = a.shape[e]; (t.io === `input` ? fs(n) === void 0 : n._zod.optout === void 0) && s.push(e); } (s.length > 0 && (i.required = s), a.catchall?._zod.def.type === `never` ? (i.additionalProperties = !1) : a.catchall ? a.catchall && (i.additionalProperties = K( a.catchall, t, { ...r, path: [ ...r.path, `additionalProperties`, ], }, )) : t.io === `output` && (i.additionalProperties = !1)); }, ms = (e, t, n, r) => { let i = e._zod.def, a = i.inclusive === !1, o = i.options.map((e, n) => K(e, t, { ...r, path: [ ...r.path, a ? `oneOf` : `anyOf`, n, ], }), ); a ? (n.oneOf = o) : (n.anyOf = o); }, hs = (e, t, n, r) => { let i = e._zod.def, a = K(i.left, t, { ...r, path: [...r.path, `allOf`, 0], }), o = K(i.right, t, { ...r, path: [...r.path, `allOf`, 1], }), s = (e) => `allOf` in e && Object.keys(e).length === 1, c = [ ...(s(a) ? a.allOf : [a]), ...(s(o) ? o.allOf : [o]), ]; ((n.allOf = c), t.intersections.push(c)); }, gs = (e, t, n, r) => { let i = e._zod.def, a = K(i.innerType, t, r), o = t.seen.get(e); t.target === `openapi-3.0` ? ((o.ref = i.innerType), (n.nullable = !0)) : (n.anyOf = [ a, { type: `null` }, ]); }, _s = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; }, vs = Symbol(); function ys(e, t, n, r, i) { let a = !1, o = JSON.stringify(e, (e, t) => typeof t == `bigint` ? ((a = !0), null) : t, ); return a ? (G( t, n, r, i, `BigInt defaults cannot be represented in JSON Schema`, ), vs) : JSON.parse(o); } const bs = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; let o = ys( i.defaultValue, e, t, n, r, ); o !== vs && (n.default = o); }, xs = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); if ( ((a.ref = i.innerType), t.io !== `input`) ) return; let o = ys( i.defaultValue, e, t, n, r, ); o !== vs && (n._prefault = o); }, Ss = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; let o; try { o = i.catchValue(void 0); } catch { G( e, t, n, r, `Dynamic catch values are not supported in JSON Schema`, ); return; } n.default = o; }, Cs = (e, t, n, r) => { let i = e._zod.def, a = i.in._zod.traits.has( `$ZodTransform`, ), o = t.io === `input` ? a ? i.out : i.in : i.out; K(o, t, r); let s = t.seen.get(e); s.ref = o; }, ws = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); ((a.ref = i.innerType), (n.readOnly = !0)); }, Ts = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; }, Es = /* @__PURE__ */ new WeakSet([ Object.prototype, Error.prototype, ]); function Ds(e, t, n) { Object.defineProperty(e, t, { configurable: !0, enumerable: !1, get() { let e = n(this); return ( Object.defineProperty(this, t, { value: e, configurable: !0, writable: !0, }), e ); }, set(e) { Object.defineProperty(this, t, { value: e, configurable: !0, writable: !0, }); }, }); } const Y = /*@__PURE__*/ E( `ZodError`, (e, t) => { (Ye.init(e, t), (e.name = `ZodError`)); let n = Object.getPrototypeOf(e); Es.has(n) || (Es.add(n), Ds( n, `format`, (e) => (t) => Qe(e, t), ), Ds( n, `flatten`, (e) => (t) => Ze(e, t), ), Ds( n, `addIssue`, (e) => (t) => { (e.issues.push(t), (e.message = JSON.stringify( e.issues, r, 2, ))); }, ), Ds( n, `addIssues`, (e) => (t) => { (e.issues.push(...t), (e.message = JSON.stringify( e.issues, r, 2, ))); }, ), Object.defineProperty( n, "isEmpty", { configurable: !0, enumerable: !1, get() { return ( this.issues.length === 0 ); }, }, )); }, void 0, { Parent: Error }, ), Os = /* @__PURE__ */ et(Y), ks = /* @__PURE__ */ tt(Y), As = /* @__PURE__ */ nt(Y), js = /* @__PURE__ */ it(Y), Ms = /* @__PURE__ */ ut(Y), Ns = /* @__PURE__ */ dt(Y), Ps = /* @__PURE__ */ ft(Y), Fs = /* @__PURE__ */ pt(Y), Is = /* @__PURE__ */ mt(Y), Ls = /* @__PURE__ */ ht(Y), Rs = /* @__PURE__ */ gt(Y), zs = /* @__PURE__ */ _t(Y); function Bs() { O.localeError || k(ci()); } function Vs() { O.memoizer || k({ memoizer: ai() }); } const X = /*@__PURE__*/ E( `ZodType`, (e, t) => ( Bs(), j.init(e, t), (e.def = t), (e.type = t.type), e ), { check(...e) { let t = this.def; return this.clone( g(t, { checks: [ ...(t.checks ?? []), ...e.map((e) => typeof e == `function` ? { _zod: { check: e, def: { check: `custom`, }, onattach: [], }, } : e, ), ], }), { parent: !0 }, ); }, with(...e) { return this.check(...e); }, clone(e, t) { return y(this, e, t); }, brand() { return this; }, register(e, t) { return (e.add(this, t), this); }, refine(e, t) { return this.check(el(e, t)); }, superRefine(e, t) { return this.check(tl(e, t)); }, overwrite(e) { return this.check( /* @__PURE__ */ xo(e), ); }, optional() { return Ic(this); }, exactOptional() { return Rc(this); }, nullable() { return Bc(this); }, nullish() { return Ic(Bc(this)); }, nonoptional(e) { return Kc(this, e); }, array() { return wc(this); }, or(e) { return Oc([this, e]); }, and(e) { return Ac(this, e); }, transform(e) { return Xc(this, Pc(e)); }, default(e) { return Hc(this, e); }, prefault(e) { return Wc(this, e); }, catch(e) { return Jc(this, e); }, pipe(e) { return Xc(this, e); }, readonly() { return Qc(this); }, describe(e) { let t = this.clone(); return ( fi.add(t, { description: e }), t ); }, meta(...e) { if (e.length === 0) return fi.get(this); let t = this.clone(); return (fi.add(t, e[0]), t); }, isOptional() { return this.safeParse(void 0) .success; }, isNullable() { return this.safeParse(null) .success; }, apply(e, ...t) { return t.length === 0 ? e(this) : e(this, ...t); }, get "~standard"() { return Ae(this, `~standard`, { ...vn(this), jsonSchema: { input: Uo(this, `input`), output: Uo(this, `output`), }, }); }, set "~standard"(e) { C(this, `~standard`, e); }, parse: function e(t, n) { return Os(this, t, n, { callee: e, }); }, parseAsync: async function e( t, n, ) { return await ks(this, t, n, { callee: e, }); }, safeParse(e, t) { return As(this, e, t); }, async safeParseAsync(e, t) { return js(this, e, t); }, get spa() { return this?.safeParseAsync; }, set spa(e) { C(this, `spa`, e); }, validate(e, t) { return st(this, e, t); }, validateAsync(e, t) { return lt(this, e, t); }, encode: function e(t, n) { return Ms(this, t, n, { callee: e, }); }, decode: function e(t, n) { return Ns(this, t, n, { callee: e, }); }, encodeAsync: async function e( t, n, ) { return await Ps(this, t, n, { callee: e, }); }, decodeAsync: async function e( t, n, ) { return await Fs(this, t, n, { callee: e, }); }, safeEncode(e, t) { return Is(this, e, t); }, safeDecode(e, t) { return Ls(this, e, t); }, async safeEncodeAsync(e, t) { return Rs(this, e, t); }, async safeDecodeAsync(e, t) { return zs(this, e, t); }, toJSONSchema(e) { return Ho(this, {})(e); }, get description() { return fi.get(this) ?.description; }, get _def() { return this._zod.def; }, }, ), Hs = /*@__PURE__*/ E( `_ZodString`, (e, t) => { (yn.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => is(e, t, n, r))); }, /*@__PURE__*/ je( { format: (e) => J(e).format ?? null, minLength: (e) => J(e).minimum ?? null, maxLength: (e) => J(e).maximum ?? null, }, { regex(...e) { return this.check( /* @__PURE__ */ ho(...e), ); }, includes(...e) { return this.check( /* @__PURE__ */ vo(...e), ); }, startsWith(...e) { return this.check( /* @__PURE__ */ yo(...e), ); }, endsWith(...e) { return this.check( /* @__PURE__ */ bo(...e), ); }, min(...e) { return this.check( /* @__PURE__ */ po(...e), ); }, max(...e) { return this.check( /* @__PURE__ */ fo(...e), ); }, length(...e) { return this.check( /* @__PURE__ */ mo(...e), ); }, nonempty(...e) { return this.check( /* @__PURE__ */ po(1, ...e), ); }, lowercase(e) { return this.check( /* @__PURE__ */ go(e), ); }, uppercase(e) { return this.check( /* @__PURE__ */ _o(e), ); }, trim() { return this.check( /* @__PURE__ */ Co(), ); }, normalize(...e) { return this.check( /* @__PURE__ */ So(...e), ); }, toLowerCase() { return this.check( /* @__PURE__ */ wo(), ); }, toUpperCase() { return this.check( /* @__PURE__ */ To(), ); }, slugify() { return this.check( /* @__PURE__ */ Eo(), ); }, }, ), ), Us = /*@__PURE__*/ E( `ZodString`, (e, t) => { (yn.init(e, t), Hs.init(e, t)); }, { email(e) { return this.check( /* @__PURE__ */ ka(Js, e), ); }, url(e) { return this.check( /* @__PURE__ */ Fa(Zs, e), ); }, jwt(e) { return this.check( /* @__PURE__ */ Xa(pc, e), ); }, emoji(e) { return this.check( /* @__PURE__ */ Ia($s, e), ); }, guid(e) { return this.check( /* @__PURE__ */ Aa(Ys, e), ); }, uuid(e) { return this.check( /* @__PURE__ */ ja(Xs, e), ); }, uuidv4(e) { return this.check( /* @__PURE__ */ Ma(Xs, e), ); }, uuidv6(e) { return this.check( /* @__PURE__ */ Na(Xs, e), ); }, uuidv7(e) { return this.check( /* @__PURE__ */ Pa(Xs, e), ); }, nanoid(e) { return this.check( /* @__PURE__ */ La(ec, e), ); }, cuid(e) { return this.check( /* @__PURE__ */ Ra(tc, e), ); }, cuid2(e) { return this.check( /* @__PURE__ */ za(nc, e), ); }, ulid(e) { return this.check( /* @__PURE__ */ Ba(rc, e), ); }, base64(e) { return this.check( /* @__PURE__ */ qa(uc, e), ); }, base64url(e) { return this.check( /* @__PURE__ */ Ja(dc, e), ); }, xid(e) { return this.check( /* @__PURE__ */ Va(ic, e), ); }, ksuid(e) { return this.check( /* @__PURE__ */ Ha(ac, e), ); }, ipv4(e) { return this.check( /* @__PURE__ */ Ua(oc, e), ); }, ipv6(e) { return this.check( /* @__PURE__ */ Wa(sc, e), ); }, cidrv4(e) { return this.check( /* @__PURE__ */ Ga(cc, e), ); }, cidrv6(e) { return this.check( /* @__PURE__ */ Ka(lc, e), ); }, e164(e) { return this.check( /* @__PURE__ */ Ya(fc, e), ); }, datetime(e) { return this.check( /* @__PURE__ */ Za(Ws, e), ); }, date(e) { return this.check( /* @__PURE__ */ Qa(Gs, e), ); }, time(e) { return this.check( /* @__PURE__ */ $a(Ks, e), ); }, duration(e) { return this.check( /* @__PURE__ */ eo(qs, e), ); }, }, ); function Z(e) { return /* @__PURE__ */ Oa(Us, e); } const Q = /*@__PURE__*/ E( `ZodStringFormat`, (e, t) => { (M.init(e, t), Hs.init(e, t)); }, ), Ws = /*@__PURE__*/ E( `ZodISODateTime`, (e, t) => { (Rn.init(e, t), Q.init(e, t)); }, ), Gs = /*@__PURE__*/ E( `ZodISODate`, (e, t) => { (zn.init(e, t), Q.init(e, t)); }, ), Ks = /*@__PURE__*/ E( `ZodISOTime`, (e, t) => { (Bn.init(e, t), Q.init(e, t)); }, ), qs = /*@__PURE__*/ E( `ZodISODuration`, (e, t) => { (Vn.init(e, t), Q.init(e, t)); }, ), Js = /*@__PURE__*/ E( `ZodEmail`, (e, t) => { (Sn.init(e, t), Q.init(e, t)); }, ), Ys = /*@__PURE__*/ E( `ZodGUID`, (e, t) => { (bn.init(e, t), Q.init(e, t)); }, ), Xs = /*@__PURE__*/ E( `ZodUUID`, (e, t) => { (xn.init(e, t), Q.init(e, t)); }, ), Zs = /*@__PURE__*/ E( `ZodURL`, (e, t) => { (An.init(e, t), Q.init(e, t)); }, ); function Qs(e) { return /* @__PURE__ */ Fa(Zs, e); } const $s = /*@__PURE__*/ E( `ZodEmoji`, (e, t) => { (jn.init(e, t), Q.init(e, t)); }, ), ec = /*@__PURE__*/ E( `ZodNanoID`, (e, t) => { (Mn.init(e, t), Q.init(e, t)); }, ), tc = /*@__PURE__*/ E( `ZodCUID`, (e, t) => { (Nn.init(e, t), Q.init(e, t)); }, ), nc = /*@__PURE__*/ E( `ZodCUID2`, (e, t) => { (Pn.init(e, t), Q.init(e, t)); }, ), rc = /*@__PURE__*/ E( `ZodULID`, (e, t) => { (Fn.init(e, t), Q.init(e, t)); }, ), ic = /*@__PURE__*/ E( `ZodXID`, (e, t) => { (In.init(e, t), Q.init(e, t)); }, ), ac = /*@__PURE__*/ E( `ZodKSUID`, (e, t) => { (Ln.init(e, t), Q.init(e, t)); }, ), oc = /*@__PURE__*/ E( `ZodIPv4`, (e, t) => { (Hn.init(e, t), Q.init(e, t)); }, ), sc = /*@__PURE__*/ E( `ZodIPv6`, (e, t) => { (Gn.init(e, t), Q.init(e, t)); }, ), cc = /*@__PURE__*/ E( `ZodCIDRv4`, (e, t) => { (Kn.init(e, t), Q.init(e, t)); }, ), lc = /*@__PURE__*/ E( `ZodCIDRv6`, (e, t) => { (Jn.init(e, t), Q.init(e, t)); }, ), uc = /*@__PURE__*/ E( `ZodBase64`, (e, t) => { (Zn.init(e, t), Q.init(e, t)); }, ), dc = /*@__PURE__*/ E( `ZodBase64URL`, (e, t) => { (er.init(e, t), Q.init(e, t)); }, ), fc = /*@__PURE__*/ E( `ZodE164`, (e, t) => { (tr.init(e, t), Q.init(e, t)); }, ), pc = /*@__PURE__*/ E( `ZodJWT`, (e, t) => { (cr.init(e, t), Q.init(e, t)); }, ), mc = /*@__PURE__*/ E( `ZodNumber`, (e, t) => { (lr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => as(e, t, n, r)), (e.isFinite = !0)); }, /*@__PURE__*/ je( { minValue: (e) => { let { minimum: t, exclusiveMinimum: n, } = J(e); return Math.max( t ?? -1 / 0, n ?? -1 / 0, ); }, maxValue: (e) => { let { maximum: t, exclusiveMaximum: n, } = J(e); return Math.min( t ?? 1 / 0, n ?? 1 / 0, ); }, isInt: (e) => { let { isInt: t, multipleOf: n, } = J(e); return ( !!t || !!n?.some( Number.isSafeInteger, ) ); }, format: (e) => J(e).format ?? null, }, { gt(e, t) { return this.check( /* @__PURE__ */ co(e, t), ); }, gte(e, t) { return this.check( /* @__PURE__ */ lo(e, t), ); }, min(e, t) { return this.check( /* @__PURE__ */ lo(e, t), ); }, lt(e, t) { return this.check( /* @__PURE__ */ oo(e, t), ); }, lte(e, t) { return this.check( /* @__PURE__ */ so(e, t), ); }, max(e, t) { return this.check( /* @__PURE__ */ so(e, t), ); }, int(e) { return this.check(gc(e)); }, safe(e) { return this.check(gc(e)); }, positive(e) { return this.check( /* @__PURE__ */ co(0, e), ); }, nonnegative(e) { return this.check( /* @__PURE__ */ lo(0, e), ); }, negative(e) { return this.check( /* @__PURE__ */ oo(0, e), ); }, nonpositive(e) { return this.check( /* @__PURE__ */ so(0, e), ); }, multipleOf(e, t) { return this.check( /* @__PURE__ */ uo(e, t), ); }, step(e, t) { return this.check( /* @__PURE__ */ uo(e, t), ); }, finite() { return this; }, }, ), ); function $(e) { return /* @__PURE__ */ to(mc, e); } const hc = /*@__PURE__*/ E( `ZodNumberFormat`, (e, t) => { (ur.init(e, t), mc.init(e, t)); }, ); function gc(e) { return /* @__PURE__ */ no(hc, e); } const _c = /*@__PURE__*/ E( `ZodUnknown`, (e, t) => { (dr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( e, t, n, ) => void 0)); }, ); function vc() { return /* @__PURE__ */ ro(_c); } const yc = /*@__PURE__*/ E( `ZodNever`, (e, t) => { (fr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => os(e, t, n, r))); }, ); function bc(e) { return /* @__PURE__ */ io(yc, e); } const xc = /*@__PURE__*/ E( `ZodDate`, (e, t) => { (pr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => ss(e, t, n, r)), (e.min = (t, n) => e.check( /* @__PURE__ */ lo(t, n), )), (e.max = (t, n) => e.check( /* @__PURE__ */ so(t, n), ))); }, /*@__PURE__*/ je( { minDate: (e) => { let { minimum: t } = J(e); return t ? new Date(t) : null; }, maxDate: (e) => { let { maximum: t } = J(e); return t ? new Date(t) : null; }, }, {}, ), ); function Sc(e) { return /* @__PURE__ */ ao(xc, e); } const Cc = /*@__PURE__*/ E( `ZodArray`, (e, t) => { (Vs(), hr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => ds(e, t, n, r)), (e.element = t.element)); }, { min(e, t) { return this.check( /* @__PURE__ */ po(e, t), ); }, nonempty(e) { return this.check( /* @__PURE__ */ po(1, e), ); }, max(e, t) { return this.check( /* @__PURE__ */ fo(e, t), ); }, length(e, t) { return this.check( /* @__PURE__ */ mo(e, t), ); }, unwrap() { return this.element; }, }, ); function wc(e, t) { return /* @__PURE__ */ Do(Cc, e, t); } const Tc = /*@__PURE__*/ E( `ZodObject`, (e, t) => { (Vs(), xr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => ps(e, t, n, r)), Ie( e, `shape`, (e) => e._zod.def.shape, !1, )); }, { keyof() { return Mc( Object.keys( this._zod.def.shape, ), ); }, catchall(e) { return this.clone( g(this._zod.def, { catchall: e, }), ); }, passthrough() { return this.clone( g(this._zod.def, { catchall: vc(), }), ); }, loose() { return this.clone( g(this._zod.def, { catchall: vc(), }), ); }, strict() { return this.clone( g(this._zod.def, { catchall: bc(), }), ); }, strip() { return this.clone( g(this._zod.def, { catchall: void 0, }), ); }, extend(e) { return me(this, e); }, safeExtend(e) { return ge(this, e); }, merge(e) { return _e(this, e); }, pick(e) { return de(this, e); }, omit(e) { return pe(this, e); }, partial(...e) { return ve(Fc, this, e[0]); }, exactPartial(...e) { return ve( Lc, this, e[0], `exactPartial`, ); }, required(...e) { return ye(Gc, this, e[0]); }, }, ); function Ec(e, t) { let n = { type: `object`, shape: e ?? {}, ...b(t), }; return new Tc(n); } const Dc = /*@__PURE__*/ E( `ZodUnion`, (e, t) => { (Cr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => ms(e, t, n, r)), (e.options = t.options)); }, ); function Oc(e, t) { return new Dc({ type: `union`, options: e, ...b(t), }); } const kc = /*@__PURE__*/ E( `ZodIntersection`, (e, t) => { (wr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => hs(e, t, n, r))); }, ); function Ac(e, t) { return new kc({ type: `intersection`, left: e, right: t, }); } const jc = /*@__PURE__*/ E( `ZodEnum`, (e, t) => { (Dr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => cs(e, t, n, r)), (e.enum = t.entries), (e.options = [...e._zod.values])); let n = new Set( Object.keys(t.entries), ); ((e.extract = (e, r) => { let i = {}; for (let r of e) if (n.has(r)) i[r] = t.entries[r]; else throw Error( `Key ${r} not found in enum`, ); return new jc({ ...t, checks: [], ...b(r), entries: i, }); }), (e.exclude = (e, r) => { let i = { ...t.entries }; for (let t of e) if (n.has(t)) delete i[t]; else throw Error( `Key ${t} not found in enum`, ); return new jc({ ...t, checks: [], ...b(r), entries: i, }); })); }, ); function Mc(e, t) { let n = Array.isArray(e) ? Object.fromEntries( e.map((e) => [e, e]), ) : e; return new jc({ type: `enum`, entries: n, ...b(t), }); } const Nc = /*@__PURE__*/ E( `ZodTransform`, (e, t) => { (Vs(), Or.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => us(e, t, n, r)), (e._zod.parse = (n, r) => { if (r.direction === `backward`) throw new He( e.constructor.name, ); n.addIssue = (r) => { if (typeof r == `string`) n.issues.push( Oe(r, n.value, t), ); else { let t = r; (t.fatal && (t.continue = !1), (t.code ??= `custom`), `input` in t || (t.input = n.value), (t.inst ??= e), n.issues.push(Oe(t))); } }; let i = t.transform(n.value, n); return i instanceof Promise ? i.then( (e) => ((n.value = e), n), ) : ((n.value = i), n); })); }, ); function Pc(e) { return new Nc({ type: `transform`, transform: e, }); } const Fc = /*@__PURE__*/ E( `ZodOptional`, (e, t) => { (Ar.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => Ts(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }, ); function Ic(e) { return new Fc({ type: `optional`, innerType: e, }); } const Lc = /*@__PURE__*/ E( `ZodExactOptional`, (e, t) => { (jr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => Ts(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }, ); function Rc(e) { return new Lc({ type: `optional`, innerType: e, }); } const zc = /*@__PURE__*/ E( `ZodNullable`, (e, t) => { (Mr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => gs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }, ); function Bc(e) { return new zc({ type: `nullable`, innerType: e, }); } const Vc = /*@__PURE__*/ E( `ZodDefault`, (e, t) => { (Nr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => bs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType), (e.removeDefault = e.unwrap)); }, ); function Hc(e, t) { return new Vc({ type: `default`, innerType: e, get defaultValue() { return typeof t == `function` ? t() : ie(t); }, }); } const Uc = /*@__PURE__*/ E( `ZodPrefault`, (e, t) => { (Fr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => xs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }, ); function Wc(e, t) { return new Uc({ type: `prefault`, innerType: e, get defaultValue() { return typeof t == `function` ? t() : ie(t); }, }); } const Gc = /*@__PURE__*/ E( `ZodNonOptional`, (e, t) => { (Ir.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => _s(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }, ); function Kc(e, t) { return new Gc({ type: `nonoptional`, innerType: e, ...b(t), }); } const qc = /*@__PURE__*/ E( `ZodCatch`, (e, t) => { (zr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => Ss(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType), (e.removeCatch = e.unwrap)); }, ); function Jc(e, t) { return new qc({ type: `catch`, innerType: e, catchValue: typeof t == `function` ? t : Le(t), }); } const Yc = /*@__PURE__*/ E( `ZodPipe`, (e, t) => { (Br.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => Cs(e, t, n, r)), (e.in = t.in), (e.out = t.out)); }, ); function Xc(e, t) { return new Yc({ type: `pipe`, in: e, out: t, }); } const Zc = /*@__PURE__*/ E( `ZodReadonly`, (e, t) => { (Hr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => ws(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }, ); function Qc(e) { return new Zc({ type: `readonly`, innerType: e, }); } const $c = /*@__PURE__*/ E( `ZodCustom`, (e, t) => { (Wr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = ( t, n, r, ) => ls(e, t, n, r))); }, ); function el(e, t = {}) { return /* @__PURE__ */ Oo($c, e, t); } function tl(e, t) { return /* @__PURE__ */ ko(e, t); } const nl = Ec({ id: $(), created: Sc(), title: Z().min(1).max(100), type: Mc([`jpg`, `png`]), size: $(), url: Qs(), }), rl = Ec({ id: $(), stars: $().min(1).max(5), title: Z().min(1).max(100), text: Z().min(1).max(1e3), images: wc(nl), }); hi( e()( Ec({ id: $(), created: Sc(), title: Z().min(1).max(100), brand: Z().min(1).max(30), description: Z().min(1).max(500), price: $().min(1).max(1e4), discount: $() .min(1) .max(100) .nullable(), quantity: $().min(0).max(10), tags: wc(Z().min(1).max(30)), images: wc(nl), ratings: wc(rl), }), ), { strict: !0 }, ).parse({});
function e() { return (e) => e; } function t(e) { let t = Object.values(e).filter( (e) => typeof e == `number`, ); return Object.entries(e) .filter(([e, n]) => t.indexOf(+e) === -1) .map(([e, t]) => t); } function n(e, t = `|`) { return e.map((e) => se(e)).join(t); } function r(e, t) { return typeof t == `bigint` ? t.toString() : t; } var i = class { constructor(e) { ((this._getter = e), (this._value = void 0)); } get value() { let e = this._getter; return ( e !== void 0 && ((this._value = e()), (this._getter = void 0)), this._value ); } }; function a(e) { return new i(e); } function o(e) { return e == null; } function s(e) { let t = +!!e.startsWith(`^`), n = e.endsWith(`$`) ? e.length - 1 : e.length; return e.slice(t, n); } function c(e, t) { let n = e / t, r = Math.round(n), i = 4 * 2 ** -52 * Math.max(Math.abs(n), 1); return Math.abs(n - r) < i ? 0 : n - r; } function l(e, t, n) { Object.defineProperty(e, t, { value: n, writable: !0, enumerable: !0, configurable: !0, }); } function u(e) { let t = Object.getOwnPropertyDescriptor(e, `shape`); return t?.get ? t.get.raw : t?.value; } function d(e) { return u(e._zod.def) ?? e._zod.def.shape; } function f(e, t, n) { Object.defineProperty(e, t, { get() { let e = n(); return (l(this, t, e), e); }, enumerable: !0, configurable: !0, }); } function p(e, t, n) { t in e ? l(e, t, n) : (e[t] = n); } function m(e, t, n, r) { let i = d(t); for (let a of n) { let n = Object.getOwnPropertyDescriptor(i, a); n.enumerable && (n.get ? f(e, a, () => { let e = t._zod.def.shape[a]; return r ? r(e, a) : e; }) : p(e, a, r ? r(n.value, a) : n.value)); } } function h(e, t) { for (let n of Reflect.ownKeys(t)) { let r = Object.getOwnPropertyDescriptor(t, n); r.enumerable && (r.get ? f(e, n, () => t[n]) : p(e, n, r.value)); } } function g(...e) { let t = {}; for (let n of e) { let e = Object.getOwnPropertyDescriptors(n); Object.assign(t, e); } return Object.defineProperties({}, t); } function _(e) { return JSON.stringify(e); } function ee(e) { return e .toLowerCase() .trim() .replace(/[^\w\s-]/g, ``) .replace(/[\s_-]+/g, `-`) .replace(/^-+|-+$/g, ``); } const te = `captureStackTrace` in Error ? Error.captureStackTrace : (...e) => {}; function ne(e) { return typeof e == `object` && !!e && !Array.isArray(e); } const re = /* @__PURE__*/ a(() => { if ( O.jitless || (typeof navigator < `u` && navigator?.userAgent?.includes(`Cloudflare`)) ) return !1; try { return (Function(``), !0); } catch { return !1; } }); function v(e) { if (ne(e) === !1) return !1; let t = e.constructor; if (t === void 0 || typeof t != `function`) return !0; let n = t.prototype; return ( ne(n) !== !1 && Object.prototype.hasOwnProperty.call( n, `isPrototypeOf`, ) !== !1 ); } function ie(e) { return v(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e; } const ae = /* @__PURE__*/ new Set([ `string`, `number`, `symbol`, ]); function oe(e) { return e.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`); } function y(e, t, n) { let r = new e._zod.constr(t ?? e._zod.def); return ((!t || n?.parent) && (r._zod.parent = e), r); } function b(e) { let t = e; if (!t) return {}; if (typeof t == `string`) return { error: () => t }; if (t?.message !== void 0) { if (t?.error !== void 0) throw Error( "Cannot specify both `message` and `error` params", ); t.error = t.message; } return ( delete t.message, typeof t.error == `string` ? { ...t, error: () => t.error } : t ); } function se(e) { return typeof e == `bigint` ? e.toString() + `n` : typeof e == `string` ? `"${e}"` : `${e}`; } function ce(e) { return Object.keys(e).filter( (t) => e[t]._zod.optin !== void 0 && e[t]._zod.optout === `optional`, ); } const le = { safeint: [-(2 ** 53 - 1), 2 ** 53 - 1], int32: [-2147483648, 2147483647], uint32: [0, 4294967295], float32: [-34028234663852886e22, 34028234663852886e22], float64: [-Number.MAX_VALUE, Number.MAX_VALUE], }, ue = { int64: [ /* @__PURE__*/ BigInt(`-9223372036854775808`), /* @__PURE__*/ BigInt(`9223372036854775807`), ], uint64: [ /* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt(`18446744073709551615`), ], }; function de(e, t) { let n = e._zod.def, r = n.checks; if (r && r.length > 0) throw Error( `.pick() cannot be used on object schemas containing refinements`, ); let i = {}; return ( m(i, e, fe(e, t)), y(e, g(n, { shape: i, checks: [] })) ); } function fe(e, t) { let n = d(e), r = []; for (let e of Reflect.ownKeys(t)) { if (!Object.getOwnPropertyDescriptor(n, e)?.enumerable) throw Error(`Unrecognized key: "${String(e)}"`); t[e] && r.push(e); } return r; } function pe(e, t) { let n = e._zod.def, r = n.checks; if (r && r.length > 0) throw Error( `.omit() cannot be used on object schemas containing refinements`, ); let i = new Set(fe(e, t)), a = {}; return ( m( a, e, Reflect.ownKeys(d(e)).filter((e) => !i.has(e)), ), y(e, g(n, { shape: a, checks: [] })) ); } function me(e, t) { if (!v(t)) throw Error( `Invalid input to extend: expected a plain object`, ); let n = e._zod.def.checks; if (n && n.length > 0) { let n = d(e); for (let e of Reflect.ownKeys(t)) if (Object.getOwnPropertyDescriptor(n, e) !== void 0) throw Error( "Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.", ); } return y(e, g(e._zod.def, { shape: he(e, t) })); } function he(e, t) { let n = {}; return (m(n, e, Reflect.ownKeys(d(e))), h(n, t), n); } function ge(e, t) { if (!v(t)) throw Error( `Invalid input to safeExtend: expected a plain object`, ); return y(e, g(e._zod.def, { shape: he(e, t) })); } function _e(e, t) { if (!t?._zod?.def) throw Error( "Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.", ); if (e._zod.def.checks?.length) throw Error( `.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`, ); let n = {}; return ( m(n, e, Reflect.ownKeys(d(e))), m(n, t, Reflect.ownKeys(d(t))), y( e, g(e._zod.def, { shape: n, get catchall() { return t._zod.def.catchall; }, checks: t._zod.def.checks ?? [], }), ) ); } function ve(e, t, n, r = `partial`) { let i = t._zod.def.checks; if (i && i.length > 0) throw Error( `.${r}() cannot be used on object schemas containing refinements`, ); let a = n ? new Set(fe(t, n)) : void 0, o = {}; return ( m( o, t, Reflect.ownKeys(d(t)), e && ((t, n) => a && !a.has(n) ? t : new e({ type: `optional`, innerType: t })), ), y(t, g(t._zod.def, { shape: o, checks: [] })) ); } function ye(e, t, n) { let r = n ? new Set(fe(t, n)) : void 0, i = {}; return ( m(i, t, Reflect.ownKeys(d(t)), (t, n) => r && !r.has(n) ? t : new e({ type: `nonoptional`, innerType: t }), ), y(t, g(t._zod.def, { shape: i })) ); } function x(e, t = 0) { if (e.aborted === !0) return !0; for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0; return !1; } function be(e, t = 0) { if (e.aborted === !0) return !0; for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue === !1) return !0; return !1; } function xe(e, t) { return t.map((t) => { var n; return ( (n = t).path ?? (n.path = []), t.path.unshift(e), t ); }); } function Se(e) { return typeof e == `string` ? e : e?.message; } function Ce(e, t, n) { var r; for (let i = t; i < e.length; i++) (r = e[i]).schema ?? (r.schema = n); } function S(e, t, n) { var r; let i = e.inst?._zod?.traits; i?.has(`$ZodType`) && (i.has(`$ZodCheck`) ? ((r = e).schema ?? (r.schema = e.inst)) : (e.schema = e.inst)); let a = e.schema === e.inst ? void 0 : e.schema?._zod.def?.error, o = e.message ? e.message : (Se(e.inst?._zod.def?.error?.(e)) ?? Se(a?.(e)) ?? Se(t?.error?.(e)) ?? Se(n.customError?.(e)) ?? Se(n.localeError?.(e)) ?? `Invalid input`), s = {}; for (let t of Object.keys(e)) t !== `inst` && t !== `schema` && t !== `continue` && t !== `input` && t !== `__proto__` && (s[t] = e[t]); return ( (s.path ??= []), (s.message = o), t?.reportInput && (s.input = e.input), s ); } const we = /[\uD800-\uDBFF]/; function Te(e) { let t = e.length; if (!we.test(e)) return t; let n = t; for (let r = 0; r < t - 1; r++) (e.charCodeAt(r) & 64512) == 55296 && (e.charCodeAt(r + 1) & 64512) == 56320 && (n--, r++); return n; } function Ee(e) { return Array.isArray(e) ? `array` : typeof e == `string` ? `string` : `unknown`; } function De(e) { let t = typeof e; switch (t) { case `number`: return Number.isNaN(e) ? `nan` : `number`; case `object`: { if (e === null) return `null`; if (Array.isArray(e)) return `array`; let t = e; if ( t && Object.getPrototypeOf(t) !== Object.prototype && `constructor` in t && t.constructor ) return t.constructor.name; } } return t; } function Oe(...e) { let [t, n, r] = e; return typeof t == `string` ? { message: t, code: `custom`, input: n, inst: r } : { ...t }; } function ke(e, t) { for (let n in t) { let r = Object.getOwnPropertyDescriptor(t, n); r.get ? Object.defineProperty(e, n, { ...r, enumerable: !1, }) : Me(e, n, r.value); } } function C(e, t, n, r = !0) { return ( Object.defineProperty(e, t, { configurable: !0, writable: !0, enumerable: r, value: n, }), n ); } function Ae(e, t, n) { return C(e, t, n, !1); } function je(e, t) { for (let n in e) { let r = e[n]; Object.defineProperty(t, n, { configurable: !0, enumerable: !0, get() { return C(this, n, r(this)); }, set(e) { C(this, n, e); }, }); } return t; } function Me(e, t, n) { Object.defineProperty(e, t, { configurable: !0, get() { return this == null ? n : C(this, t, n.bind(this)); }, set(e) { C(this, t, e); }, }); } function Ne(e, t) { let n = Object.getPrototypeOf(e); return t in n ? void 0 : n; } let Pe, w = !1; const Fe = { configurable: !0, get() { w = !0; }, }; function T(e, t, n) { let r = Object.getPrototypeOf(e._zod); if (t in r && Pe !== e._zod) { Pe = void 0; return; } ((Pe = e._zod), Object.defineProperty(r, t, { configurable: !0, get() { Object.defineProperty(this, t, Fe); let e = w; w = !1; try { let r = n(this); return ( w ? delete this[t] : Object.defineProperty(this, t, { configurable: !0, writable: !0, value: r, }), (w ||= e), r ); } catch (n) { throw (delete this[t], (w ||= e), n); } }, set(e) { Object.defineProperty(this, t, { configurable: !0, writable: !0, value: e, }); }, })); } function Ie(e, t, n, r) { let i = Ne(e, t); i && Object.defineProperty(i, t, { configurable: !0, get() { let e = { configurable: !0, writable: !0, enumerable: r, value: void 0, }; return ( Object.defineProperty(this, t, e), (e.value = n(this)), Object.defineProperty(this, t, e), e.value ); }, set(e) { Object.defineProperty(this, t, { configurable: !0, writable: !0, enumerable: r, value: e, }); }, }); } function Le(e) { let t = () => e; return ((t[`~constantCatch`] = !0), t); } var Re; const ze = { value: void 0, enumerable: !1 }; let Be = `captureStackTrace` in Error ? Error : null; function Ve(e) { let t = Be; if (t) { let n = t.stackTraceLimit; if (typeof n == `number`) { try { t.stackTraceLimit = 0; } catch { return ((Be = null), new e()); } try { return new e(); } finally { t.stackTraceLimit = n; } } } return new e(); } function E(e, t, n, r) { let i = {}; function a(e) { ((this.def = e), (this.constr = d), (this.traits = /* @__PURE__ */ new Set())); } a.prototype = i; let o = n, s = o && /* @__PURE__ */ new WeakSet(); function c(n, r) { if (!n._zod) { ze.value = new a(r); try { Object.defineProperty(n, "_zod", ze); } finally { ze.value = void 0; } } else if (n._zod.traits.has(e)) return; if ((n._zod.traits.add(e), t(n, r), s)) { let e = Object.getPrototypeOf(n), t = n._zod.constr.prototype, r = e; for (; r && r !== t;) r = Object.getPrototypeOf(r); let i = r ?? e; s.has(i) || (s.add(i), ke(i, o)); } let i = d.prototype; for (let e in i) Object.prototype.hasOwnProperty.call(i, e) && (e in n || (n[e] = i[e].bind(n))); } let l = r?.Parent ?? Object; class u extends l {} Object.defineProperty(u, "name", { value: e }); function d(e) { let t = r?.Parent ? Ve(u) : this; c(t, e); let n = t._zod.deferred; if (n) { for (let e of n) e(); t._zod.deferred = void 0; } let i = globalThis.__zod_globalConfig?.postProcessor; return (i && i(t), t); } return ( Object.defineProperty(d, "init", { value: c }), Object.defineProperty(d, Symbol.hasInstance, { value: (t) => r?.Parent && t instanceof r.Parent ? !0 : t?._zod?.traits?.has(e), }), Object.defineProperty(d, "name", { value: e }), d ); } var D = class extends Error { constructor() { super( `Encountered Promise during synchronous parse. Use .parseAsync() instead.`, ); } }, He = class extends Error { constructor(e) { (super( `Encountered unidirectional transform during encode: ${e}`, ), (this.name = `ZodEncodeError`)); } }; (Re = globalThis).__zod_globalConfig ?? (Re.__zod_globalConfig = {}); const O = globalThis.__zod_globalConfig; function k(e) { return (e && Object.assign(O, e), O); } function Ue() { let e = this._zod; return ( (e.message ??= JSON.stringify(e.def, r, 2)), e.message ); } function We(e) { this._zod.message = e; } const Ge = { get: Ue, set: We, enumerable: !0, configurable: !0, }, Ke = { value: void 0, enumerable: !1 }, qe = /* @__PURE__ */ new WeakSet([ Object.prototype, Error.prototype, ]), Je = (e, t) => { ((e.name = `$ZodError`), (Ke.value = t), Object.defineProperty(e, "issues", Ke), (Ke.value = void 0), Object.defineProperty(e, "message", Ge)); let n = Object.getPrototypeOf(e); qe.has(n) || (qe.add(n), Object.defineProperty(n, "toString", { configurable: !0, enumerable: !1, get() { let e = () => this.message; return ( Object.defineProperty(this, "toString", { value: e, configurable: !0, writable: !0, }), e ); }, set(e) { Object.defineProperty(this, "toString", { value: e, configurable: !0, writable: !0, }); }, })); }, Ye = E(`$ZodError`, Je); E(`$ZodError`, Je, void 0, { Parent: Error }); function Xe(e, t, n) { return ( Object.prototype.hasOwnProperty.call(e, t) || (t === `__proto__` ? Object.defineProperty(e, t, { value: n(), writable: !0, enumerable: !0, configurable: !0, }) : (e[t] = n())), e[t] ); } function Ze(e, t = (e) => e.message) { let n = {}, r = []; for (let i of e.issues) i.path.length > 0 ? Xe(n, i.path[0], () => []).push(t(i)) : r.push(t(i)); return { formErrors: r, fieldErrors: n }; } function Qe(e, t = (e) => e.message) { let n = { _errors: [] }, r = (e, i = []) => { for (let a of e.issues) if (a.code === `invalid_union` && a.errors.length) a.errors.map((e) => r({ issues: e }, [...i, ...a.path]), ); else if (a.code === `invalid_key`) r({ issues: a.issues }, [...i, ...a.path]); else if (a.code === `invalid_element`) r({ issues: a.issues }, [...i, ...a.path]); else { let e = [...i, ...a.path]; if (e.length === 0) n._errors.push(t(a)); else { let r = n, i = 0; for (; i < e.length;) { let n = e[i], o = i === e.length - 1; if (n === `_errors`) { (o && r._errors.push(t(a)), i++); continue; } Object.prototype.hasOwnProperty.call(r, n) || Object.defineProperty(r, n, { value: { _errors: [] }, enumerable: !0, writable: !0, configurable: !0, }); let s = r[n]; (o && s._errors.push(t(a)), (r = s), i++); } } } }; return (r(e), n); } function $e(e, t) { return { callee: t?.callee ?? e, Err: t?.Err }; } const et = (e) => { let t = (n, r, i, a) => { let o = i ? { ...i, async: !1 } : { async: !1 }, s = n._zod.run({ value: r, issues: [] }, o); if (s instanceof Promise) throw new D(); if (s.issues.length) { let n = new (a?.Err ?? e)( s.issues.map((e) => S(e, o, k())), ); throw (te(n, a?.callee ?? t), n); } return s.value; }; return t; }, tt = (e) => { let t = async (n, r, i, a) => { let o = i ? { ...i, async: !0 } : { async: !0 }, s = n._zod.run({ value: r, issues: [] }, o); if ( (s instanceof Promise && (s = await s), s.issues.length) ) { let n = new (a?.Err ?? e)( s.issues.map((e) => S(e, o, k())), ); throw (te(n, a?.callee ?? t), n); } return s.value; }; return t; }, nt = (e) => (t, n, r) => { let i = r ? { ...r, async: !1 } : { async: !1 }, a = t._zod.run({ value: n, issues: [] }, i); if (a instanceof Promise) throw new D(); return a.issues.length ? rt(e, a.issues, i) : { success: !0, data: a.value }; }; function rt(e, t, n) { let r; return { success: !1, get error() { return ( r || ((r = new e(t.map((e) => S(e, n, k())))), (t = void 0), (n = void 0)), r ); }, set error(e) { ((r = e), (t = void 0), (n = void 0)); }, }; } const it = (e) => async (t, n, r) => { let i = r ? { ...r, async: !0 } : { async: !0 }, a = t._zod.run({ value: n, issues: [] }, i); return ( a instanceof Promise && (a = await a), a.issues.length ? rt(e, a.issues, i) : { success: !0, data: a.value } ); }, at = /* @__PURE__ */ Symbol.for(`zod.compile.invalid`), ot = /* @__PURE__ */ Symbol.for(`zod.compile.fallback`), st = (e, t, n) => { let r = e._zod.bag.validator; if (r !== void 0) { if (r(t) !== at) return !0; if (r.definite === !0 && n === void 0) return !1; } return ct(e, t, n); }; function ct(e, t, n) { let r = n ? { ...n, async: !1, abortEarly: !0 } : { async: !1, abortEarly: !0 }, i = e._zod.bag.fallbackRun, a; if ( (i ? ((r[ot] = !0), (a = i({ value: t, issues: [] }, r))) : (a = e._zod.run({ value: t, issues: [] }, r)), a instanceof Promise) ) throw new D(); return a.issues.length === 0; } const lt = async (e, t, n) => { let r = n ? { ...n, async: !0, abortEarly: !0 } : { async: !0, abortEarly: !0 }, i = e._zod.run({ value: t, issues: [] }, r); return ( i instanceof Promise && (i = await i), i.issues.length === 0 ); }, ut = (e) => { let t = et(e), n = (e, r, i, a) => { let o = i ? { ...i, direction: `backward` } : { direction: `backward` }; return t(e, r, o, $e(n, a)); }; return n; }, dt = (e) => { let t = et(e), n = (e, r, i, a) => t(e, r, i, $e(n, a)); return n; }, ft = (e) => { let t = tt(e), n = async (e, r, i, a) => { let o = i ? { ...i, direction: `backward` } : { direction: `backward` }; return await t(e, r, o, $e(n, a)); }; return n; }, pt = (e) => { let t = tt(e), n = async (e, r, i, a) => await t(e, r, i, $e(n, a)); return n; }, mt = (e) => (t, n, r) => { let i = r ? { ...r, direction: `backward` } : { direction: `backward` }; return nt(e)(t, n, i); }, ht = (e) => (t, n, r) => nt(e)(t, n, r), gt = (e) => async (t, n, r) => { let i = r ? { ...r, direction: `backward` } : { direction: `backward` }; return it(e)(t, n, i); }, _t = (e) => async (t, n, r) => it(e)(t, n, r), vt = /^[cC][0-9a-z]{6,}$/, yt = /^[0-9a-z]+$/, bt = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/, xt = /^[0-9a-vA-V]{20}$/, St = /^[A-Za-z0-9]{27}$/, Ct = /^[a-zA-Z0-9_-]{21}$/; function wt(e) { return RegExp(`^[a-zA-Z0-9_-]{${e}}$`); } const Tt = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Et = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Dt = (e) => e ? RegExp( `^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`, ) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Ot = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; function kt() { return RegExp( `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`, `u`, ); } const At = /^(?:(?: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])$/, jt = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, Mt = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, Nt = /^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Pt = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Ft = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/, It = /^https?$/, Lt = /^\+[1-9]\d{6,14}$/, Rt = /^\d(?:[ -]?\d){11,18}$/, zt = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/, Bt = `(?:(?:\\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])))`; function Vt(e) { return RegExp(`^${e}$`); } const Ht = /*@__PURE__*/ Vt(Bt); function Ut(e) { let t = `(?:[01]\\d|2[0-3]):[0-5]\\d`; return typeof e.precision == `number` ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : e.seconds ? `${t}:[0-5]\\d(?:\\.\\d+)?` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`; } function Wt(e) { return RegExp(`^${Ut(e)}$`); } function Gt(e) { let t = [`Z`]; e.offset && t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); let n = `${Ut({ precision: e.precision, seconds: !0 })}(?:${t.join(`|`)})`, r = e.local ? `${n}|${Ut({ precision: e.precision })}` : n; return RegExp(`^${Bt}T(?:${r})$`); } const Kt = /^[\s\S]{0,}$/, qt = /^-?\d+(?:\.\d+)?$/, Jt = /^[^A-Z]*$/, Yt = /^[^a-z]*$/, A = /*@__PURE__*/ E(`$ZodCheck`, (e, t) => { var n; ((e._zod ??= {}), (e._zod.def = t), (n = e._zod).onattach ?? (n.onattach = [])); }), Xt = (e) => { let t = e.value; return !o(t) && t.length !== void 0; }, Zt = { number: `number`, bigint: `bigint`, object: `date`, }, Qt = /*@__PURE__*/ E(`$ZodCheckLessThan`, (e, t) => { A.init(e, t); let n = Zt[typeof t.value]; e._zod.check = (r) => { (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({ origin: Zt[typeof r.value] ?? n, code: `too_big`, maximum: typeof t.value == `object` ? t.value.getTime() : t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort, }); }; }), $t = /*@__PURE__*/ E(`$ZodCheckGreaterThan`, (e, t) => { A.init(e, t); let n = Zt[typeof t.value]; e._zod.check = (r) => { (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({ origin: Zt[typeof r.value] ?? n, code: `too_small`, minimum: typeof t.value == `object` ? t.value.getTime() : t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort, }); }; }), en = /*@__PURE__*/ E(`$ZodCheckMultipleOf`, (e, t) => { (A.init(e, t), (e._zod.check = (n) => { if (typeof n.value != typeof t.value) throw Error( `Cannot mix number and bigint in multiple_of check.`, ); (typeof n.value == `bigint` ? t.value !== BigInt(0) && n.value % t.value === BigInt(0) : c(n.value, t.value) === 0) || n.issues.push({ origin: typeof n.value, code: `not_multiple_of`, divisor: t.value, input: n.value, inst: e, continue: !t.abort, }); })); }), tn = /*@__PURE__*/ E(`$ZodCheckNumberFormat`, (e, t) => { (A.init(e, t), (t.format = t.format || `float64`)); let n = t.format?.includes(`int`), r = n ? `int` : `number`, [i, a] = le[t.format]; e._zod.check = (o) => { let s = o.value; if (n) { if (!Number.isInteger(s)) { o.issues.push({ expected: r, format: t.format, code: `invalid_type`, continue: !1, input: s, inst: e, }); return; } if (!Number.isSafeInteger(s)) { s > 0 ? o.issues.push({ input: s, code: `too_big`, maximum: 2 ** 53 - 1, note: `Integers must be within the safe integer range.`, inst: e, origin: r, inclusive: !0, continue: !t.abort, }) : o.issues.push({ input: s, code: `too_small`, minimum: -(2 ** 53 - 1), note: `Integers must be within the safe integer range.`, inst: e, origin: r, inclusive: !0, continue: !t.abort, }); return; } } (s < i && o.issues.push({ origin: `number`, input: s, code: `too_small`, minimum: i, inclusive: !0, inst: e, continue: !t.abort, }), s > a && o.issues.push({ origin: `number`, input: s, code: `too_big`, maximum: a, inclusive: !0, inst: e, continue: !t.abort, })); }; }), nn = /*@__PURE__*/ E(`$ZodCheckMaxLength`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length; if ( (typeof r == `string` && i > t.maximum ? Te(r) : i) <= t.maximum ) return; let a = Ee(r); n.issues.push({ origin: a, code: `too_big`, maximum: t.maximum, inclusive: !0, input: r, inst: e, continue: !t.abort, }); })); }), rn = /*@__PURE__*/ E(`$ZodCheckMinLength`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length; if ( (typeof r == `string` && i >= t.minimum && i < t.minimum * 2 ? Te(r) : i) >= t.minimum ) return; let a = Ee(r); n.issues.push({ origin: a, code: `too_small`, minimum: t.minimum, inclusive: !0, input: r, inst: e, continue: !t.abort, }); })); }), an = /*@__PURE__*/ E(`$ZodCheckLengthEquals`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length, a = typeof r == `string` && i >= t.length && i <= t.length * 2 ? Te(r) : i; if (a === t.length) return; let o = Ee(r), s = a > t.length; n.issues.push({ origin: o, ...(s ? { code: `too_big`, maximum: t.length } : { code: `too_small`, minimum: t.length }), inclusive: !0, exact: !0, input: n.value, inst: e, continue: !t.abort, }); })); }), on = /*@__PURE__*/ E(`$ZodCheckStringFormat`, (e, t) => { var n, r; (A.init(e, t), t.pattern ? ((n = e._zod).check ?? (n.check = (n) => { ((t.pattern.lastIndex = 0), !t.pattern.test(n.value) && n.issues.push({ origin: `string`, code: `invalid_format`, format: t.format, input: n.value, ...(t.pattern ? { pattern: t.pattern.toString() } : {}), inst: e, continue: !t.abort, })); })) : ((r = e._zod).check ?? (r.check = () => {}))); }), sn = /*@__PURE__*/ E(`$ZodCheckRegex`, (e, t) => { (on.init(e, t), (e._zod.check = (n) => { ((t.pattern.lastIndex = 0), !t.pattern.test(n.value) && n.issues.push({ origin: `string`, code: `invalid_format`, format: `regex`, input: n.value, pattern: t.pattern.toString(), inst: e, continue: !t.abort, })); })); }), cn = /*@__PURE__*/ E(`$ZodCheckLowerCase`, (e, t) => { ((t.pattern ??= Jt), on.init(e, t)); }), ln = /*@__PURE__*/ E(`$ZodCheckUpperCase`, (e, t) => { ((t.pattern ??= Yt), on.init(e, t)); }), un = /*@__PURE__*/ E(`$ZodCheckIncludes`, (e, t) => { A.init(e, t); let n = oe(t.includes); ((t.pattern = new RegExp( typeof t.position == `number` ? `^.{${t.position},}${n}` : n, )), (e._zod.check = (n) => { n.value.includes(t.includes, t.position) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `includes`, includes: t.includes, input: n.value, inst: e, continue: !t.abort, }); })); }), dn = /*@__PURE__*/ E(`$ZodCheckStartsWith`, (e, t) => { A.init(e, t); let n = RegExp(`^${oe(t.prefix)}.*`); ((t.pattern ??= n), (e._zod.check = (n) => { n.value.startsWith(t.prefix) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `starts_with`, prefix: t.prefix, input: n.value, inst: e, continue: !t.abort, }); })); }), fn = /*@__PURE__*/ E(`$ZodCheckEndsWith`, (e, t) => { A.init(e, t); let n = RegExp(`.*${oe(t.suffix)}$`); ((t.pattern ??= n), (e._zod.check = (n) => { n.value.endsWith(t.suffix) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `ends_with`, suffix: t.suffix, input: n.value, inst: e, continue: !t.abort, }); })); }), pn = /*@__PURE__*/ E(`$ZodCheckOverwrite`, (e, t) => { (A.init(e, t), (e._zod.check = (e) => { e.value = t.tx(e.value); })); }); var mn = class { constructor(e = [], t = {}) { ((this.content = []), (this.indent = 0), (this.args = e), (this.closed = t)); } indented(e) { this.indent += 1; try { e(this); } finally { --this.indent; } } write(e) { if (typeof e == `function`) { (e(this, { execution: `sync` }), e(this, { execution: `async` })); return; } let t = e .split(` `) .filter((e) => e), n = Math.min( ...t.map((e) => e.length - e.trimStart().length), ), r = t .map((e) => e.slice(n)) .map((e) => ` `.repeat(this.indent * 2) + e); for (let e of r) this.content.push(e); } compile() { let e = Function, t = this?.content ?? [``]; return new e( ...Object.keys(this.closed), `return function (${this.args.join(`, `)}) {\n${t.join(` `)}\n};`, )(...Object.values(this.closed)); } }; const hn = { major: 4, minor: 6, patch: 5 }, j = /*@__PURE__*/ E( `$ZodType`, (e, t) => { var n; ((e ??= {}), (e._zod.def = t), (e._zod.bag = e._zod.bag || {}), (e._zod.version = hn)); let r = e._zod.def.checks, i = e._zod.traits.has(`$ZodCheck`) ? [e, ...(r ?? [])] : r?.length ? [...r] : []; for (let t of i) for (let n of t._zod.onattach) n(e); if (i.length === 0) ((n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => { e._zod.run = e._zod.parse; })); else { let t = (t, n, r) => { if (t.memo) return t; let i = x(t), a; for (let o of n) { if (o._zod.def.when) { if (be(t) || !o._zod.def.when(t)) continue; } else if (i) continue; let n = t.issues.length, s = o._zod.check(t); if (s instanceof Promise && r?.async === !1) throw new D(); if (a || s instanceof Promise) a = (a ?? Promise.resolve()).then( async () => { (await s, t.issues.length !== n && (Ce(t.issues, n, e), (i ||= x(t, n)))); }, ); else { if (t.issues.length === n) continue; (Ce(t.issues, n, e), (i ||= x(t, n))); } } return a ? a.then(() => t) : t; }, n = (n, r, a) => { if (x(n)) return ((n.aborted = !0), n); let o = t(r, i, a); if (o instanceof Promise) { if (a.async === !1) throw new D(); return o.then((t) => e._zod.parse(t, a)); } return e._zod.parse(o, a); }; e._zod.run = (r, a) => { if (a.skipChecks) return e._zod.parse(r, a); if (a.direction === `backward`) { let t = e._zod.parse( { value: r.value, issues: [] }, { ...a, skipChecks: !0 }, ); return t instanceof Promise ? t.then((e) => n(e, r, a)) : n(t, r, a); } let o = e._zod.parse(r, a); if (o instanceof Promise) { if (a.async === !1) throw new D(); return o.then((e) => t(e, i, a)); } return t(o, i, a); }; } }, { get "~standard"() { return Ae(this, `~standard`, vn(this)); }, set "~standard"(e) { C(this, `~standard`, e); }, }, ), gn = (e, t) => e.issues.length ? { issues: e.issues.map((e) => S(e, t, k())) } : { value: e.value }; async function _n(e, t) { let n = { async: !0 }; return gn( await e._zod.run({ value: t, issues: [] }, n), n, ); } function vn(e) { return { validate: (t) => { let n = { async: !1 }; try { let r = e._zod.run({ value: t, issues: [] }, n); if (!(r instanceof Promise)) return gn(r, n); } catch {} return _n(e, t); }, vendor: `zod`, version: 1, }; } const yn = /*@__PURE__*/ E(`$ZodString`, (e, t) => { (j.init(e, t), (e._zod.pattern = t.pattern ?? Kt), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = String(n.value); } catch {} return ( typeof n.value == `string` || n.issues.push({ expected: `string`, code: `invalid_type`, input: n.value, inst: e, }), n ); })); }), M = /*@__PURE__*/ E(`$ZodStringFormat`, (e, t) => { (on.init(e, t), yn.init(e, t)); }), bn = /*@__PURE__*/ E(`$ZodGUID`, (e, t) => { ((t.pattern ??= Et), M.init(e, t)); }), xn = /*@__PURE__*/ E(`$ZodUUID`, (e, t) => { if (t.version) { let e = { v1: 1, v2: 2, v3: 3, v4: 4, v5: 5, v6: 6, v7: 7, v8: 8, }[t.version]; if (e === void 0) throw Error(`Invalid UUID version: "${t.version}"`); t.pattern ??= Dt(e); } else t.pattern ??= Dt(); M.init(e, t); }), Sn = /*@__PURE__*/ E(`$ZodEmail`, (e, t) => { ((t.pattern ??= Ot), M.init(e, t)); }); function Cn(e) { try { return typeof URL < `u` && typeof URL.canParse == `function` ? URL.canParse(e) : (new URL(e), !0); } catch { return !1; } } function wn(e, t) { return !(`normalize` in t) && !(`hostname` in t) && !(`protocol` in t) ? Cn(e) || 2 : Tn(e, t); } function Tn(e, t) { if ( !t.normalize && t.protocol?.source === It.source && !/^https?:\/\//i.test(e) ) return 1; try { if (typeof URL < `u`) { let t = URL; if (typeof t.parse == `function`) return t.parse(e) ?? 2; } return new URL(e); } catch { return 2; } } const En = /[\t\n\r]/g; function Dn(e) { return e.replace(En, ``); } function On(e, t) { return ((t.lastIndex = 0), t.test(e.hostname)); } function kn(e, t) { return ( (t.lastIndex = 0), t.test( e.protocol.endsWith(`:`) ? e.protocol.slice(0, -1) : e.protocol, ) ); } const An = /*@__PURE__*/ E(`$ZodURL`, (e, t) => { (M.init(e, t), (e._zod.check = (n) => { try { let r = n.value.trim(), i = wn(r, t); if (i === 1) { n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid URL format`, input: n.value, inst: e, continue: !t.abort, }); return; } if (i === 2) { n.issues.push({ code: `invalid_format`, format: `url`, input: n.value, inst: e, continue: !t.abort, }); return; } if (i === !0) { n.value = Dn(r); return; } (t.hostname && !On(i, t.hostname) && n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid hostname`, pattern: t.hostname.source, input: n.value, inst: e, continue: !t.abort, }), t.protocol && !kn(i, t.protocol) && n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid protocol`, pattern: t.protocol.source, input: n.value, inst: e, continue: !t.abort, }), (n.value = t.normalize ? i.href : Dn(r))); return; } catch { n.issues.push({ code: `invalid_format`, format: `url`, input: n.value, inst: e, continue: !t.abort, }); } })); }), jn = /*@__PURE__*/ E(`$ZodEmoji`, (e, t) => { ((t.pattern ??= kt()), M.init(e, t)); }), Mn = /*@__PURE__*/ E(`$ZodNanoID`, (e, t) => { if ( t.length !== void 0 && (!Number.isInteger(t.length) || t.length < 1) ) throw Error(`Invalid nanoid length: ${t.length}`); ((t.pattern ??= t.length === void 0 ? Ct : wt(t.length)), M.init(e, t)); }), Nn = /*@__PURE__*/ E(`$ZodCUID`, (e, t) => { ((t.pattern ??= vt), M.init(e, t)); }), Pn = /*@__PURE__*/ E(`$ZodCUID2`, (e, t) => { ((t.pattern ??= yt), M.init(e, t)); }), Fn = /*@__PURE__*/ E(`$ZodULID`, (e, t) => { ((t.pattern ??= bt), M.init(e, t)); }), In = /*@__PURE__*/ E(`$ZodXID`, (e, t) => { ((t.pattern ??= xt), M.init(e, t)); }), Ln = /*@__PURE__*/ E(`$ZodKSUID`, (e, t) => { ((t.pattern ??= St), M.init(e, t)); }), Rn = /*@__PURE__*/ E(`$ZodISODateTime`, (e, t) => { ((t.pattern ??= Gt(t)), M.init(e, t)); }), zn = /*@__PURE__*/ E(`$ZodISODate`, (e, t) => { ((t.pattern ??= Ht), M.init(e, t)); }), Bn = /*@__PURE__*/ E(`$ZodISOTime`, (e, t) => { ((t.pattern ??= Wt(t)), M.init(e, t)); }), Vn = /*@__PURE__*/ E(`$ZodISODuration`, (e, t) => { ((t.pattern ??= Tt), M.init(e, t)); }), Hn = /*@__PURE__*/ E(`$ZodIPv4`, (e, t) => { ((t.pattern ??= At), M.init(e, t)); }), Un = /^[0-9a-fA-F:.]+$/; function Wn(e) { return Un.test(e) ? Cn(`http://[${e}]`) : !1; } const Gn = /*@__PURE__*/ E(`$ZodIPv6`, (e, t) => { ((t.pattern ??= jt), M.init(e, t), (e._zod.check = (n) => { Wn(n.value) || n.issues.push({ code: `invalid_format`, format: `ipv6`, input: n.value, inst: e, continue: !t.abort, }); })); }), Kn = /*@__PURE__*/ E(`$ZodCIDRv4`, (e, t) => { ((t.pattern ??= Mt), M.init(e, t)); }); function qn(e) { let t = e.split(`/`); if (t.length !== 2) return !1; let [n, r] = t; if (!r) return !1; let i = Number(r); return `${i}` !== r || i < 0 || i > 128 ? !1 : Wn(n); } const Jn = /*@__PURE__*/ E(`$ZodCIDRv6`, (e, t) => { ((t.pattern ??= Nt), M.init(e, t), (e._zod.check = (n) => { qn(n.value) || n.issues.push({ code: `invalid_format`, format: `cidrv6`, input: n.value, inst: e, continue: !t.abort, }); })); }); function Yn(e) { if (e === ``) return !0; if (/\s/.test(e) || e.length % 4 != 0) return !1; try { return (atob(e), !0); } catch { return !1; } } const Xn = /^[0-9a-zA-Z+/]*={0,2}$/, Zn = /*@__PURE__*/ E(`$ZodBase64`, (e, t) => { ((t.pattern ??= Xn), M.init(e, t), (e._zod.check = (n) => { Yn(n.value) || n.issues.push({ code: `invalid_format`, format: `base64`, input: n.value, inst: e, continue: !t.abort, }); })); }), Qn = /^[A-Za-z0-9_-]*$/; function $n(e) { if (!Qn.test(e)) return !1; let t = e.replace(/[-_]/g, (e) => e === `-` ? `+` : `/`, ); return Yn(t.padEnd(Math.ceil(t.length / 4) * 4, `=`)); } const er = /*@__PURE__*/ E(`$ZodBase64URL`, (e, t) => { ((t.pattern ??= Qn), M.init(e, t), (e._zod.check = (n) => { $n(n.value) || n.issues.push({ code: `invalid_format`, format: `base64url`, input: n.value, inst: e, continue: !t.abort, }); })); }), tr = /*@__PURE__*/ E(`$ZodE164`, (e, t) => { ((t.pattern ??= Lt), M.init(e, t)); }), nr = /[- ]/g; function rr(e) { let t = e.length, n = 1, r = 0; for (; t;) { let i = e.charCodeAt(--t) - 48; ((n ^= 1), (r += n ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][i] : i)); } return r % 10 == 0; } function ir(e) { return Rt.test(e) ? rr(e.replace(nr, ``)) : !1; } function ar(e) { let t = 0, n = e.length; for (let r = 4; r < n; r++) { let n = e.charCodeAt(r); t = (n >= 65 ? t * 100 + (n - 55) : t * 10 + (n - 48)) % 97; } for (let n = 0; n < 4; n++) { let r = e.charCodeAt(n); t = (r >= 65 ? t * 100 + (r - 55) : t * 10 + (r - 48)) % 97; } return t === 1; } function or(e) { return zt.test(e) ? ar(e) : !1; } function sr(e, t = null) { try { let n = e.split(`.`); if (n.length !== 3) return !1; let [r] = n; if (!r) return !1; let i = JSON.parse(atob(r)); return !( (`typ` in i && i?.typ !== `JWT`) || !i.alg || (t && (!(`alg` in i) || i.alg !== t)) ); } catch { return !1; } } const cr = /*@__PURE__*/ E(`$ZodJWT`, (e, t) => { (M.init(e, t), (e._zod.check = (n) => { sr(n.value, t.alg) || n.issues.push({ code: `invalid_format`, format: `jwt`, input: n.value, inst: e, continue: !t.abort, }); })); }), lr = /*@__PURE__*/ E(`$ZodNumber`, (e, t) => { (j.init(e, t), (e._zod.pattern = qt), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = Number(n.value); } catch {} let i = n.value; if ( typeof i == `number` && !Number.isNaN(i) && Number.isFinite(i) ) return n; let a = typeof i == `number` ? Number.isNaN(i) ? `NaN` : Number.isFinite(i) ? void 0 : String(i) : void 0; return ( n.issues.push({ expected: `number`, code: `invalid_type`, input: i, inst: e, ...(a ? { received: a } : {}), }), n ); })); }), ur = /*@__PURE__*/ E(`$ZodNumberFormat`, (e, t) => { (tn.init(e, t), lr.init(e, t)); }), dr = /*@__PURE__*/ E(`$ZodUnknown`, (e, t) => { (j.init(e, t), (e._zod.parse = (e) => e)); }), fr = /*@__PURE__*/ E(`$ZodNever`, (e, t) => { (j.init(e, t), (e._zod.parse = (t, n) => ( t.issues.push({ expected: `never`, code: `invalid_type`, input: t.value, inst: e, }), t ))); }), pr = /*@__PURE__*/ E(`$ZodDate`, (e, t) => { (j.init(e, t), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = new Date(n.value); } catch {} let i = n.value, a = i instanceof Date; return ( (a && !Number.isNaN(i.getTime())) || n.issues.push({ expected: `date`, code: `invalid_type`, input: i, ...(a ? { received: `Invalid Date` } : {}), inst: e, }), n ); })); }); function mr(e, t, n) { (e.issues.length && t.issues.push(...xe(n, e.issues)), (t.value[n] = e.value)); } const hr = /*@__PURE__*/ E(`$ZodArray`, (e, t) => { j.init(e, t); let n = O.memoizer; (n?.attach(e), (e._zod.parse = (r, i) => { let a = r.value; if (!Array.isArray(a)) return ( r.issues.push({ expected: `array`, code: `invalid_type`, input: a, inst: e, }), r ); r.value = n ? n.alloc(e, r, Array(a.length), i) : Array(a.length); let o = [], s = i?.abortEarly; for (let e = 0; e < a.length; e++) { let n = a[e], c = t.element._zod.run( { value: n, issues: [] }, i, ); if (c instanceof Promise) o.push(c.then((t) => mr(t, r, e))); else if ( (mr(c, r, e), s && c.issues.length !== 0 && x(c)) ) break; } return o.length ? Promise.all(o).then(() => r) : r; })); }); function gr(e, t, n, r, i, a) { let o = n in r, s = a === `optional`; if (o || !s || i !== `optional`) { if (e.issues.length) { if (i !== void 0 && s && !o) return; t.issues.push(...xe(n, e.issues)); } if (!o && i === void 0) { e.issues.length || t.issues.push({ code: `invalid_type`, expected: `nonoptional`, input: void 0, path: [n], }); return; } e.value === void 0 ? (o || (i === `defaulted` && !s)) && (t.value[n] = void 0) : (t.value[n] = e.value); } } const _r = []; function vr(e) { let t = Object.keys(e.shape), n = Object.getOwnPropertySymbols(e.shape), r = n.length ? n : _r, i = r.length ? [...t, ...r] : t; for (let t of i) if (!e.shape?.[t]?._zod?.traits?.has(`$ZodType`)) throw Error( `Invalid element at key "${String(t)}": expected a Zod schema`, ); let a = ce(e.shape); return { ...e, allKeys: i, symbolKeys: r, keySet: new Set(t), numKeys: t.length, optionalKeys: new Set(a), }; } function yr(e, t, n, r, i, a, o) { let s = [], c = i.keySet, l = i.catchall._zod, u = l.def.type, d = l.optin, f = l.optout, p = 0; for (let i in t) { if (o && n.issues.length !== p) { if (x(n, p)) break; p = n.issues.length; } if (c.has(i)) continue; if (i === `__proto__`) { u === `never` && s.push(i); continue; } if (u === `never`) { s.push(i); continue; } let a = l.run({ value: t[i], issues: [] }, r); a instanceof Promise ? e.push(a.then((e) => gr(e, n, i, t, d, f))) : gr(a, n, i, t, d, f); } return ( s.length && n.issues.push({ code: `unrecognized_keys`, keys: s, input: t, inst: a, continue: !0, }), e.length ? Promise.all(e).then(() => n) : n ); } const br = /*@__PURE__*/ E(`$ZodObject`, (e, t) => { j.init(e, t); let n = Object.getOwnPropertyDescriptor(t, `shape`), r = n?.get ? n.get.raw : (t.shape ?? {}); if (r) { let e = () => { let n = { ...r }; return ( Object.defineProperty(t, "shape", { value: n }), (e.raw = n), n ); }; ((e.raw = r), Object.defineProperty(t, "shape", { get: e })); } let i = a(() => vr(t)); T(e, `propValues`, (e) => { let t = e.def.shape, n = {}; for (let e in t) { let r = t[e]._zod; if (r.values) { Object.prototype.hasOwnProperty.call(n, e) || l(n, e, /* @__PURE__ */ new Set()); for (let t of r.values) n[e].add(t); r.optin !== void 0 && n[e].add(void 0); } } return n; }); let o = ne, s = t.catchall, c, u = O.memoizer; (u?.attach(e), (e._zod.parse = (t, n) => { c ??= i.value; let r = t.value; if (!o(r)) return ( t.issues.push({ expected: `object`, code: `invalid_type`, input: r, inst: e, }), t ); t.value = u ? u.alloc(e, t, {}, n) : {}; let a = [], l = c.shape, d = n?.abortEarly, f = t.issues.length; for (let e of c.allKeys) { if (d && t.issues.length !== f) { if (x(t, f)) break; f = t.issues.length; } if (e === `__proto__`) continue; let i = l[e], o = i._zod.optin, s = i._zod.optout, c = i._zod.run({ value: r[e], issues: [] }, n); c instanceof Promise ? a.push(c.then((n) => gr(n, t, e, r, o, s))) : gr(c, t, e, r, o, s); } return s ? yr(a, r, t, n, i.value, e, d === !0) : a.length ? Promise.all(a).then(() => t) : t; })); }), xr = /*@__PURE__*/ E(`$ZodObjectJIT`, (e, t) => { br.init(e, t); let n = e._zod.parse, r = a(() => vr(t)), i = O.memoizer, o = (t) => { let n = r.value, a = n.symbolKeys, o = new mn([`payload`, `ctx`], { shape: t, inst: e, memo: i, syms: a, }), s = (e) => `shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`, c = (e, t) => ` let ${e}_ab = false; for (let i = 0; i < ${e}.issues.length; i++) { const iss = ${e}.issues[i]; iss.path = iss.path ? [${t}, ...iss.path] : [${t}]; payload.issues.push(iss); if (iss.continue !== true) ${e}_ab = true; } if (${e}_ab && ctx && ctx.abortEarly) { payload.value = newResult; return payload; }`; o.write(`const input = payload.value;`); let l = Object.create(null), u = 0; for (let e of n.allKeys) l[e] = `key_${u++}`; o.write( i ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`, ); for (let e of n.allKeys) { if (e === `__proto__`) continue; let n = l[e], r = typeof e == `symbol` ? `syms[${a.indexOf(e)}]` : _(e), i = `${r} in input`, u = t[e], d = u?._zod?.optin, f = d !== void 0, p = u?._zod?.optout === `optional`; if ((o.write(`const ${n} = ${s(r)};`), f && p)) { let e = d === `optional` ? `${n}_present` : `${n}.value !== undefined || ${n}_present`; o.write(` const ${n}_present = ${i}; if (!${n}.issues.length || ${n}_present) { if (${n}.issues.length) {${c(n, r)} } if (${e}) { newResult[${r}] = ${n}.value; } } `); } else f ? (o.write(` if (${n}.issues.length) {${c(n, r)} } `), d === `defaulted` ? o.write(`newResult[${r}] = ${n}.value;`) : o.write(` if (${n}.value !== undefined || ${i}) { newResult[${r}] = ${n}.value; } `)) : o.write(` const ${n}_present = ${i}; if (${n}.issues.length) {${c(n, r)} } if (!${n}_present && !${n}.issues.length) { payload.issues.push({ code: "invalid_type", expected: "nonoptional", input: undefined, path: [${r}] }); if (ctx && ctx.abortEarly) { payload.value = newResult; return payload; } } if (${n}_present) { newResult[${r}] = ${n}.value; } `); } return ( o.write(`payload.value = newResult;`), o.write(`return payload;`), o.compile() ); }, s, c = ne, l = !O.jitless, u = l && re.value, d = t.catchall, f; e._zod.parse = (i, a) => { f ??= r.value; let p = i.value; return c(p) ? l && u && a?.async === !1 && a.jitless !== !0 ? ((s ||= o(t.shape)), (i = s(i, a)), d ? yr([], p, i, a, f, e, a?.abortEarly === !0) : i) : n(i, a) : (i.issues.push({ expected: `object`, code: `invalid_type`, input: p, inst: e, }), i); }; }); function Sr(e, t, n, r) { for (let n of e) if (n.issues.length === 0) return ((t.value = n.value), t); let i = e.filter((e) => !x(e)); return i.length === 1 ? ((t.value = i[0].value), i[0]) : (t.issues.push({ code: `invalid_union`, input: t.value, inst: n, errors: e.map((e) => e.issues.map((e) => S(e, r, k())), ), }), t); } const Cr = /*@__PURE__*/ E(`$ZodUnion`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.options.some( (e) => e._zod.optin === `defaulted`, ) ? `defaulted` : e.def.options.some( (e) => e._zod.optin !== void 0, ) ? `optional` : void 0, ), T(e, `optout`, (e) => e.def.options.some( (e) => e._zod.optout === `optional`, ) ? `optional` : void 0, ), T(e, `values`, (e) => { if (e.def.options.every((e) => e._zod.values)) return new Set( e.def.options.flatMap((e) => Array.from(e._zod.values), ), ); }), T(e, `pattern`, (e) => { if (e.def.options.every((e) => e._zod.pattern)) { let t = e.def.options.map((e) => e._zod.pattern); return RegExp( `^(${t.map((e) => s(e.source)).join(`|`)})$`, ); } })); let n = t.options.length === 1 ? t.options[0]._zod.run : null; e._zod.parse = (r, i) => { if (n) return n(r, i); let a = !1, o = []; for (let e of t.options) { let t = e._zod.run( { value: r.value, issues: [] }, i, ); if (t instanceof Promise) (o.push(t), (a = !0)); else { if (t.issues.length === 0) return t; o.push(t); } } return a ? Promise.all(o).then((t) => Sr(t, r, e, i)) : Sr(o, r, e, i); }; }), wr = /*@__PURE__*/ E(`$ZodIntersection`, (e, t) => { (j.init(e, t), (e._zod.parse = (e, n) => { let r = e.value, i = t.left._zod.run({ value: r, issues: [] }, n), a = t.right._zod.run({ value: r, issues: [] }, n); return i instanceof Promise || a instanceof Promise ? Promise.all([i, a]).then(([t, n]) => Er(e, t, n), ) : Er(e, i, a); })); }); function Tr(e, t) { if ( e === t || (e instanceof Date && t instanceof Date && +e == +t) ) return { valid: !0, data: e }; if (v(e) && v(t)) { let n = Object.keys(t), r = Object.keys(e).filter((e) => n.indexOf(e) !== -1), i = { ...e, ...t }; Object.prototype.hasOwnProperty.call(i, `__proto__`) && delete i.__proto__; for (let n of r) { if (n === `__proto__`) continue; let r = Tr(e[n], t[n]); if (!r.valid) return { valid: !1, mergeErrorPath: [n, ...r.mergeErrorPath], }; i[n] = r.data; } return { valid: !0, data: i }; } if (Array.isArray(e) && Array.isArray(t)) { if (e.length !== t.length) return { valid: !1, mergeErrorPath: [] }; let n = []; for (let r = 0; r < e.length; r++) { let i = e[r], a = t[r], o = Tr(i, a); if (!o.valid) return { valid: !1, mergeErrorPath: [r, ...o.mergeErrorPath], }; n.push(o.data); } return { valid: !0, data: n }; } return { valid: !1, mergeErrorPath: [] }; } function Er(e, t, n) { let r = /* @__PURE__ */ new Map(), i, a = /* @__PURE__ */ new Map(), o = (e, t) => { let n; if (e.code === `unrecognized_keys` && !e.path?.length) ((i ??= e), (n = e.keys)); else if ( e.code === `invalid_key` && e.origin === `record` && e.path?.length === 1 ) { let t = String(e.path[0]); (a.has(t) || a.set(t, e), (n = [t])); } else return !1; for (let e of n) (r.has(e) || r.set(e, {}), (r.get(e)[t] = !0)); return !0; }; for (let n of t.issues) o(n, `l`) || e.issues.push(n); for (let t of n.issues) o(t, `r`) || e.issues.push(t); let s = [...r] .filter(([, e]) => e.l && e.r) .map(([e]) => e); if (s.length) { let t = i ? s.filter((e) => i.keys.includes(e)) : []; t.length && e.issues.push({ ...i, keys: t }); for (let n of s) !t.includes(n) && a.has(n) && e.issues.push(a.get(n)); } let c = Tr(t.value, n.value); if (!c.valid) { if (x(e)) return e; throw Error( `Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`, ); } return ((e.value = c.data), e); } const Dr = /*@__PURE__*/ E(`$ZodEnum`, (e, n) => { j.init(e, n); let r = t(n.entries), i = new Set(r); ((e._zod.values = i), T(e, `pattern`, (e) => { let n = t(e.def.entries).filter((e) => ae.has(typeof e), ); return RegExp( n.length ? `^(${n.map((e) => oe(e.toString())).join(`|`)})$` : `^[^\\s\\S]$`, ); }), (e._zod.parse = (t, n) => { let a = t.value; return ( i.has(a) || t.issues.push({ code: `invalid_value`, values: r, input: a, inst: e, }), t ); })); }), Or = /*@__PURE__*/ E(`$ZodTransform`, (e, t) => { (j.init(e, t), (e._zod.optin = `optional`), O.memoizer?.guard(e), (e._zod.parse = (n, r) => { if (r.direction === `backward`) throw new He(e.constructor.name); let i = t.transform(n.value, n); if (r.async) return ( i instanceof Promise ? i : Promise.resolve(i) ).then((e) => ((n.value = e), n)); if (i instanceof Promise) throw new D(); return ((n.value = i), n); })); }); function kr(e, t) { return ( (e.value = t.issues.length ? void 0 : t.value), e ); } const Ar = /*@__PURE__*/ E(`$ZodOptional`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin === `defaulted` ? `defaulted` : `optional`, ), (e._zod.optout = `optional`), T(e, `values`, (e) => { let t = e.def.innerType._zod.values; return t ? /* @__PURE__ */ new Set([...t, void 0]) : void 0; }), T(e, `pattern`, (e) => { let t = e.def.innerType._zod.pattern; return t ? RegExp(`^(${s(t.source)})?$`) : void 0; }), (e._zod.parse = (e, n) => { if (e.value === void 0) { if (t.innerType._zod.optin !== `defaulted`) return e; let r = t.innerType._zod.run( { value: e.value, issues: [] }, n, ); return r instanceof Promise ? r.then((t) => kr(e, t)) : kr(e, r); } return t.innerType._zod.run(e, n); })); }), jr = /*@__PURE__*/ E(`$ZodExactOptional`, (e, t) => { (Ar.init(e, t), T(e, `values`, (e) => e.def.innerType._zod.values), T(e, `pattern`, (e) => e.def.innerType._zod.pattern), (e._zod.parse = (e, n) => t.innerType._zod.run(e, n))); }), Mr = /*@__PURE__*/ E(`$ZodNullable`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin), T(e, `optout`, (e) => e.def.innerType._zod.optout), T(e, `pattern`, (e) => { let t = e.def.innerType._zod.pattern; return t ? RegExp(`^(${s(t.source)}|null)$`) : void 0; }), T(e, `values`, (e) => e.def.innerType._zod.values ? /* @__PURE__ */ new Set([ ...e.def.innerType._zod.values, null, ]) : void 0, ), (e._zod.parse = (e, n) => e.value === null ? e : t.innerType._zod.run(e, n))); }), Nr = /*@__PURE__*/ E(`$ZodDefault`, (e, t) => { (j.init(e, t), (e._zod.optin = `defaulted`), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); if (e.value === void 0) return ((e.value = t.defaultValue), e); let r = t.innerType._zod.run(e, n); return r instanceof Promise ? r.then((e) => Pr(e, t)) : Pr(r, t); })); }); function Pr(e, t) { return ( e.value === void 0 && (e.value = t.defaultValue), e ); } const Fr = /*@__PURE__*/ E(`$ZodPrefault`, (e, t) => { (j.init(e, t), (e._zod.optin = `defaulted`), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => ( n.direction === `backward` || (e.value === void 0 && (e.value = t.defaultValue)), t.innerType._zod.run(e, n) ))); }), Ir = /*@__PURE__*/ E(`$ZodNonOptional`, (e, t) => { (j.init(e, t), T(e, `values`, (e) => { let t = e.def.innerType._zod.values; return t ? new Set([...t].filter((e) => e !== void 0)) : void 0; }), (e._zod.parse = (n, r) => { let i = t.innerType._zod.run(n, r); return i instanceof Promise ? i.then((t) => Lr(t, e)) : Lr(i, e); })); }); function Lr(e, t) { return ( !e.issues.length && e.value === void 0 && e.issues.push({ code: `invalid_type`, expected: `nonoptional`, input: e.value, inst: t, }), e ); } function Rr(e, t, n, r) { return t.issues.length ? ((e.value = n.catchValue({ ...t, value: e.value, error: { issues: t.issues.map((e) => S(e, r, k())), }, input: e.value, })), e) : ((e.value = t.value), t.memo && (e.memo = !0), e); } const zr = /*@__PURE__*/ E(`$ZodCatch`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin === `defaulted` ? `defaulted` : `optional`, ), T(e, `optout`, (e) => e.def.innerType._zod.optout), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); let r = t.innerType._zod.run( { value: e.value, issues: [] }, n, ); return r instanceof Promise ? r.then((r) => Rr(e, r, t, n)) : Rr(e, r, t, n); })); }), Br = /*@__PURE__*/ E(`$ZodPipe`, (e, t) => { (j.init(e, t), T(e, `values`, (e) => e.def.in._zod.values), T(e, `optin`, (e) => e.def.in._zod.optin), T(e, `optout`, (e) => e.def.out._zod.optout), T(e, `propValues`, (e) => e.def.in._zod.propValues), (e._zod.parse = (e, n) => { if (n.direction === `backward`) { let r = t.out._zod.run(e, n); return r instanceof Promise ? r.then((e) => Vr(e, t.in, n)) : Vr(r, t.in, n); } let r = t.in._zod.run(e, n); return r instanceof Promise ? r.then((e) => Vr(e, t.out, n)) : Vr(r, t.out, n); })); }); function Vr(e, t, n) { return e.issues.some( (e) => e.code !== `unrecognized_keys`, ) ? ((e.aborted = !0), e) : t._zod.run({ value: e.value, issues: e.issues }, n); } const Hr = /*@__PURE__*/ E(`$ZodReadonly`, (e, t) => { (j.init(e, t), T( e, `propValues`, (e) => e.def.innerType._zod.propValues, ), T(e, `values`, (e) => e.def.innerType._zod.values), T(e, `optin`, (e) => e.def.innerType?._zod?.optin), T(e, `optout`, (e) => e.def.innerType?._zod?.optout), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); let r = t.innerType._zod.run(e, n); return r instanceof Promise ? r.then(Ur) : Ur(r); })); }); function Ur(e) { return (e.memo || (e.value = Object.freeze(e.value)), e); } const Wr = /*@__PURE__*/ E(`$ZodCustom`, (e, t) => { (A.init(e, t), j.init(e, t), (e._zod.parse = (e, t) => e), (e._zod.check = (n) => { let r = n.value, i = t.fn(r); if (i instanceof Promise) return i.then((t) => Gr(t, n, r, e)); Gr(i, n, r, e); })); }); function Gr(e, t, n, r) { if (!e) { let e = { code: `custom`, input: n, inst: r, path: [...(r._zod.def.path ?? [])], continue: !r._zod.def.abort, }; (r._zod.def.params && (e.params = r._zod.def.params), t.issues.push(Oe(e))); } } var Kr = class extends Error { constructor() { (super( `Cannot parse a reference cycle that closes through a transform`, ), (this.name = `ZodCyclicError`)); } }; const qr = `~memo`, Jr = []; function Yr(e) { return typeof e == `object` && !!e; } function Xr(e) { return e.map((e) => e.path ? { ...e, path: e.path.slice() } : { ...e }, ); } const Zr = /*@__PURE__*/ new WeakMap(); function Qr(e, t, n) { let r = Zr.get(e); if (r !== void 0) return r ? 2 : 0; if (t.has(e)) return 2; t.add(e); let i = 0, a = (e) => { if (i !== 2 && e?._zod) { let r = Qr(e, t, n); r > i && (i = r); } }, o = (e, r) => { let i = 0; for (let a of Reflect.ownKeys(e)) { let o = Object.getOwnPropertyDescriptor(e, a); if (r && !o.enumerable) continue; let s = o.get ? 1 : o.value?._zod ? Qr(o.value, t, n) : 0; s > i && (i = s); } return i; }, s = (e) => { e > i && (i = e); }, c = e._zod.def; switch (c.type) { case `object`: { let e = u(c); (s(e ? o(e, !0) : 1), a(c.catchall)); break; } case `array`: a(c.element); break; case `tuple`: for (let e of c.items) a(e); a(c.rest); break; case `record`: case `map`: (a(c.keyType), a(c.valueType)); break; case `set`: a(c.valueType); break; case `union`: for (let e of c.options) a(e); break; case `intersection`: (a(c.left), a(c.right)); break; case `optional`: case `nullable`: case `default`: case `prefault`: case `catch`: case `readonly`: case `nonoptional`: case `promise`: case `success`: a(c.innerType); break; case `pipe`: (a(c.in), a(c.out)); break; case `function`: (a(c.input), a(c.output)); break; case `lazy`: { let r = c._cachedInner ?? (n ? e._zod.innerType : void 0); s(r ? Qr(r, t, !1) : 1); break; } case `template_literal`: case `string`: case `number`: case `int`: case `boolean`: case `bigint`: case `symbol`: case `undefined`: case `null`: case `void`: case `never`: case `any`: case `unknown`: case `date`: case `nan`: case `enum`: case `literal`: case `file`: case `transform`: case `custom`: break; default: for (let e in c) { let t = Object.getOwnPropertyDescriptor(c, e); if (!t || t.get) continue; let n = t.value; if (n && typeof n == `object`) { if (n._zod) a(n); else if (Array.isArray(n)) for (let e of n) a(e); } } } return (t.delete(e), $r(e, i)); } function $r(e, t) { return (t !== 1 && Zr.set(e, t === 2), t); } function ei(e) { return Qr(e, /* @__PURE__ */ new Set(), !0) !== 0; } function ti(e, t) { let n = e.buckets.get(t); return ( n || ((n = /* @__PURE__ */ new WeakMap()), e.buckets.set(t, n)), n ); } let ni; const ri = [], ii = { alloc(e, t, n) { let r = ni; if (!r) return n; ni = void 0; let i = { value: n, issues: null }; return (r.set(t.value, i), ri.push(i), n); }, guard(e) { var t; ((t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred.push(() => { let t = e._zod.parse, n = (e, n) => { if ( n.direction !== `backward` && oi(n, e.value) ) throw new Kr(); return t(e, n); }; ((e._zod.parse = n), e._zod.run === t && (e._zod.run = n)); })); }, attach(e) { var t; let n, r = !1, i, a; ((t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred.push(() => { let t = e._zod.parse, o = (s, c) => { if (n === void 0) { let i = Qr( e, /* @__PURE__ */ new Set(), !1, ); if (i === 0) return ( (e._zod.parse = t), e._zod.run === o && (e._zod.run = t), t(s, c) ); i === 2 || r ? (n = !0) : (r = !0); } let l = s.value; if (!Yr(l)) return t(s, c); let u = c[qr]; u || ((u = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0, }), (c[qr] = u)); let d; i === c ? (d = a) : ((d = ti(u, e)), (i = c), (a = d)); let f = d.get(l); if (f) return ( (s.value = f.value), f.issues ? f.issues.length && s.issues.push(...Xr(f.issues)) : ((s.memo = !0), u.backEdges ?? (u.backEdges = /* @__PURE__ */ new WeakSet()), u.backEdges.add(f.value)), s ); ni = d; let p = ri.length, m = t(s, c); ni = void 0; let h = ri.length > p ? ri.pop() : void 0; return m instanceof Promise ? m.then( (e) => ( h && (h.issues = e.issues.length ? Xr(e.issues) : Jr), e ), ) : (h && (h.issues = m.issues.length ? Xr(m.issues) : Jr), m); }; ((e._zod.parse = o), e._zod.run === t && (e._zod.run = o)); })); }, }; function ai() { return ii; } function oi(e, t) { let n = e[qr]?.backEdges; return n !== void 0 && Yr(t) && n.has(t); } const si = () => { let e = { string: { unit: `characters`, verb: `to have` }, file: { unit: `bytes`, verb: `to have` }, array: { unit: `items`, verb: `to have` }, set: { unit: `items`, verb: `to have` }, map: { unit: `entries`, verb: `to have` }, }; function t(t) { return e[t] ?? null; } let r = { regex: `input`, email: `email address`, url: `URL`, emoji: `emoji`, uuid: `UUID`, uuidv4: `UUIDv4`, uuidv6: `UUIDv6`, nanoid: `nanoid`, guid: `GUID`, cuid: `cuid`, cuid2: `cuid2`, ulid: `ULID`, xid: `XID`, ksuid: `KSUID`, datetime: `ISO datetime`, date: `ISO date`, time: `ISO time`, duration: `ISO duration`, ipv4: `IPv4 address`, ipv6: `IPv6 address`, mac: `MAC address`, cidrv4: `IPv4 range`, cidrv6: `IPv6 range`, base64: `base64-encoded string`, base64url: `base64url-encoded string`, json_string: `JSON string`, e164: `E.164 number`, currency_code: `currency code`, credit_card: `credit card number`, iban: `IBAN`, jwt: `JWT`, template_literal: `input`, }, i = { nan: `NaN` }; function a(e, t) { return e === `number` && typeof t == `number` && !Number.isFinite(t) ? String(t) : (i[e] ?? e); } return (e) => { switch (e.code) { case `invalid_type`: return `Invalid input: expected ${a(e.expected)}, received ${a(De(e.input), e.input)}`; case `invalid_value`: return e.values.length === 1 ? `Invalid input: expected ${se(e.values[0])}` : `Invalid option: expected one of ${n(e.values, `|`)}`; case `too_big`: { let n = e.exact ? `exactly ` : e.inclusive ? `<=` : `<`, r = t(e.origin); return r ? `Too big: expected ${e.origin ?? `value`} to have ${n}${e.maximum.toString()} ${r.unit ?? `elements`}` : `Too big: expected ${e.origin ?? `value`} to be ${n}${e.maximum.toString()}`; } case `too_small`: { let n = e.exact ? `exactly ` : e.inclusive ? `>=` : `>`, r = t(e.origin); return r ? `Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}` : `Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`; } case `invalid_format`: { let t = e; return t.format === `starts_with` ? `Invalid string: must start with "${t.prefix}"` : t.format === `ends_with` ? `Invalid string: must end with "${t.suffix}"` : t.format === `includes` ? `Invalid string: must include "${t.includes}"` : t.format === `regex` ? `Invalid string: must match pattern ${t.pattern}` : `Invalid ${r[t.format] ?? e.format}`; } case `not_multiple_of`: return `Invalid number: must be a multiple of ${e.divisor}`; case `unrecognized_keys`: return `Unrecognized key${e.keys.length > 1 ? `s` : ``}: ${n(e.keys, `, `)}`; case `invalid_key`: return `Invalid key in ${e.origin}`; case `invalid_union`: return e.options && Array.isArray(e.options) && e.options.length > 0 ? `Invalid discriminator value. Expected ${e.options.map((e) => `'${e}'`).join(` | `)}` : e.inclusive === !1 ? `Invalid input: more than one option matched` : `Invalid input`; case `invalid_element`: return `Invalid value in ${e.origin}`; default: return `Invalid input`; } }; }; function ci() { return { localeError: si() }; } var li, ui = class { constructor() { ((this._map = /* @__PURE__ */ new WeakMap()), (this._idmap = /* @__PURE__ */ new Map())); } add(e, ...t) { let n = t[0]; return ( this._map.set(e, n), n && typeof n == `object` && `id` in n && this._idmap.set(n.id, e), this ); } clear() { return ( (this._map = /* @__PURE__ */ new WeakMap()), (this._idmap = /* @__PURE__ */ new Map()), this ); } remove(e) { let t = this._map.get(e); return ( t && typeof t == `object` && `id` in t && this._idmap.delete(t.id), this._map.delete(e), this ); } get(e) { let t = e._zod.parent; if (t) { let n = { ...(this.get(t) ?? {}) }; delete n.id; let r = { ...n, ...this._map.get(e) }; return Object.keys(r).length ? r : void 0; } return this._map.get(e); } has(e) { return this._map.has(e); } }; function di() { return new ui(); } (li = globalThis).__zod_globalRegistry ?? (li.__zod_globalRegistry = di()); const fi = globalThis.__zod_globalRegistry, N = Symbol.for(`zod.compile.invalid`), pi = Symbol.for(`zod.compile.fallback`); var P = class extends Error { constructor( e = `z.compile does not support async refinements, transforms, or checks`, ) { (super(e), (this.name = `ZodCompileAsyncError`)); } }, F = class extends Error { constructor(e, t = !0) { (super( `z.compile does not support ${e}; this schema must use the runtime parser`, ), (this.name = `ZodCompileUnsupportedError`), (this.islandable = t)); } }; function mi(e, t) { try { return vi(e, { assertOnly: !0 }); } catch { return t; } } function hi(e, t) { try { let t = vi(e), n = gi(e, t); return ((n._zod.bag.validator = mi(e, t)), n); } catch (n) { if (t?.strict) throw n; return e; } } function gi(e, t) { if (ei(e)) throw new F( `a schema whose subtree contains a reference cycle`, ); let n = y(e), r = e._zod.run, i = r.__originalRun ?? r, a = (e, n) => { if ( n?.async || n?.direction === `backward` || n?.skipChecks || n?.[pi] || (n && oi(n, e.value)) ) return i(e, n); let r = t(e.value); return r === N ? (n && (n[pi] = !0), i(e, n)) : ((e.value = r), e); }; return ( (a.__originalRun = i), (n._zod.bag.fallbackRun = i), (n._zod.bag.validator = t), (n._zod.run = a), r.__originalRun || _i(n, e, t), n ); } function _i(e, t, n) { let r = e, i = t; if (typeof i.safeParse == `function`) { let e = i.safeParse; r.safeParse = (t, r) => { let i = n(t); return i === N ? e(t, r) : { success: !0, data: i }; }; } if (typeof i.parse == `function`) { let e = i.parse; r.parse = (t, r) => { let i = n(t); return i === N ? e(t, r) : i; }; } } function vi(e, t) { let n = !0; try { n = ei(e); } catch {} if (n) throw new F( `a schema whose subtree contains a reference cycle`, ); let r = { constants: /* @__PURE__ */ new Map(), constantCounter: 0, varCounter: 0, definite: !0, }, i = new mn([`input`]), a = V(i, r, e, `input`, !t?.assertOnly); i.write(a === null ? `return true;` : `return ${a};`); let o = [`INVALID`, ...r.constants.keys()], s = [N, ...r.constants.values()], c = i.content.join(` `), l = t?.debug ? o.length > 0 ? `// Constants: ${o.join(`, `)}\n${c}` : c : ``, u = Function, d = `return (input) => {\n${c}\n}`, f; try { f = new u(...o, d)(...s); } catch (e) { throw new F( `this schema (generated code failed to evaluate: ${e.message})`, ); } return ( t?.debug && (f.code = l), (f.definite = r.definite), f ); } function I(e, t) { for (let [n, r] of e.constants) if (r === t) return n; let n = `c${e.constantCounter++}`; return (e.constants.set(n, t), n); } function L(e, t) { return ((e.definite = !1), I(e, t)); } function R(e) { return `v${e.varCounter++}`; } function yi(e, t) { let n = e._zod.run({ value: t, issues: [] }, {}); if (n && typeof n.then == `function`) return N; let r = n; return r.issues.length === 0 ? r.value : N; } function z(e, t, n, r, i = !0) { let a = e.content.length, o = t.constants.size, s = t.constantCounter, c = t.varCounter; try { return V(e, t, n, r, i); } catch (i) { if (!(i instanceof F) || !i.islandable) throw i; if (((e.content.length = a), t.constants.size > o)) { let e = Array.from(t.constants.keys()).slice(o); for (let n of e) t.constants.delete(n); } return ( (t.constantCounter = s), (t.varCounter = c), bi(e, t, n, r) ); } } function bi(e, t, n, r) { t.definite = !1; let i = I(t, n), a = I(t, yi), o = R(t); return ( e.write(`const ${o} = ${a}(${i}, ${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } const xi = /* @__PURE__ */ new Set([ `max_size`, `min_size`, `size_equals`, `max_length`, `min_length`, `length_equals`, ]); function Si(e, t, n, r) { let i = n._zod.def.checks; if (!i || i.length === 0) return r; let a = r; for (let n of i) { let r = n._zod.def; if (r.when && !xi.has(r.check)) throw new F(`check with a custom "when" condition`); switch (r.check) { case `greater_than`: Ti(e, t, r, a); break; case `less_than`: Ei(e, t, r, a); break; case `multiple_of`: Di(e, t, r, a); break; case `number_format`: Oi(e, r, a); break; case `min_length`: { let n = B(r.minimum, `min_length`), i = Ci( e, t, a, `${a}.length >= ${n} && ${a}.length < ${r.minimum * 2}`, ); e.write(`if (${i} < ${n}) return INVALID;`); break; } case `max_length`: { let n = B(r.maximum, `max_length`), i = Ci(e, t, a, `${a}.length > ${n}`); e.write(`if (${i} > ${n}) return INVALID;`); break; } case `length_equals`: { let n = B(r.length, `length_equals`), i = Ci( e, t, a, `${a}.length >= ${n} && ${a}.length <= ${r.length * 2}`, ); e.write(`if (${i} !== ${n}) return INVALID;`); break; } case `min_size`: e.write( `if (${a}.size < ${B(r.minimum, `min_size`)}) return INVALID;`, ); break; case `max_size`: e.write( `if (${a}.size > ${B(r.maximum, `max_size`)}) return INVALID;`, ); break; case `size_equals`: e.write( `if (${a}.size !== ${B(r.size, `size_equals`)}) return INVALID;`, ); break; case `string_format`: a = Ri(e, t, r, a); break; case `custom`: a = Ii(e, t, n, a); break; case `bigint_format`: ki(e, r, a); break; case `mime_type`: Ai(e, t, r, a); break; case `property`: Mi(e, t, r, a); break; case `properties`: ji(e, t, r, a); break; case `overwrite`: { let r = R(t); (Ni(e, t, n, a, r), (a = r)); break; } default: throw new F(`check type ${r.check}`); } } return a; } function Ci(e, t, n, r) { let i = I(t, Te), a = R(t); return ( e.write( `const ${a} = typeof ${n} === "string" && ${r} ? ${i}(${n}) : ${n}.length;`, ), a ); } function B(e, t) { if (typeof e != `number` || !Number.isFinite(e)) throw new F(`${t} bound of type ${typeof e}`); return `${e}`; } function wi(e, t) { if (typeof t == `bigint`) return `${t}n`; if (typeof t == `number`) { if (Number.isNaN(t)) throw new F(`comparison check with NaN bound`); return `${t}`; } if (t instanceof Date) { if (Number.isNaN(t.getTime())) throw new F( `comparison check with Invalid Date bound`, ); return I(e, t); } throw new F(`comparison check bound of type ${typeof t}`); } function Ti(e, t, n, r) { let i = n.inclusive ? `<` : `<=`; e.write( `if (${r} ${i} ${wi(t, n.value)}) return INVALID;`, ); } function Ei(e, t, n, r) { let i = n.inclusive ? `>` : `>=`; e.write( `if (${r} ${i} ${wi(t, n.value)}) return INVALID;`, ); } function Di(e, t, n, r) { if (typeof n.value == `bigint`) { if (n.value === BigInt(0)) throw new F(`multiple_of check with a zero divisor`); e.write( `if (${r} % ${n.value}n !== 0n) return INVALID;`, ); } else { let i = I(t, c); e.write( `if (${i}(${r}, ${B(n.value, `multiple_of`)}) !== 0) return INVALID;`, ); } } function Oi(e, t, n) { let r = t.format; switch (r) { case `safeint`: e.write( `if (!Number.isSafeInteger(${n})) return INVALID;`, ); break; case `int32`: e.write( `if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`, ); break; case `uint32`: e.write( `if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`, ); break; case `float32`: e.write( `if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`, ); break; case `float64`: e.write( `if (!Number.isFinite(${n})) return INVALID;`, ); break; default: throw new F(`number format ${r}`); } } function ki(e, t, n) { let r = t.format; if (r) switch (r) { case `int64`: e.write( `if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`, ); break; case `uint64`: e.write( `if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`, ); break; default: throw new F(`bigint format ${r}`); } } function Ai(e, t, n, r) { let i = n.mime; if (i && i.length > 0) { let n = I(t, new Set(i)); e.write(`if (!${n}.has(${r}.type)) return INVALID;`); } } function ji(e, t, n, r) { if (n.when) throw new F(`check with a custom "when" condition`); e.write(`if (${r} == null) return INVALID;`); let i = n.shape; for (let n of Reflect.ownKeys(i)) { let a = typeof n == `symbol` ? I(t, n) : _(n), o = R(t); (e.write(`const ${o} = ${r}[${a}];`), z(e, t, i[n], o, !1)); } } function Mi(e, t, n, r) { let i = `${r}[${JSON.stringify(n.property)}]`; V(e, t, n.schema, i); } function Ni(e, t, n, r, i) { let a = n._zod.def.tx; if (!a) throw new F( `overwrite check without a transform function`, ); if (W(a)) throw new P( `z.compile: async overwrite transforms are not supported`, ); let o = I(t, a); e.write(`const ${i} = ${o}(${r});`); } function Pi() { throw new D(); } function Fi(e) { this.issues.push(e); } function Ii(e, t, n, r) { let i = n._zod.def; if (i.fn) { if (W(i.fn)) throw new P( `z.compile: async .refine() predicates are not supported`, ); let n = L(t, i.fn), a = I(t, Pi), o = R(t); return ( e.write(`const ${o} = ${n}(${r});`), e.write(`if (${o} instanceof Promise) ${a}();`), e.write(`if (!${o}) return INVALID;`), r ); } if (n._zod.check) { if (W(n._zod.check)) throw new P( `z.compile: async .superRefine() / check functions are not supported`, ); let i = n._zod.check, a = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }; return ( i(t) instanceof Promise && Pi(), t.issues.length === 0 ? t.value : N ); }), o = R(t); return ( e.write(`const ${o} = ${a}(${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } throw new F( `custom check without a predicate or check function`, ); } const Li = /* @__PURE__ */ new Set([ `cidrv4`, `cuid`, `cuid2`, `date`, `datetime`, `duration`, `e164`, `email`, `emoji`, `ends_with`, `guid`, `includes`, `ipv4`, `ksuid`, `lowercase`, `mac`, `nanoid`, `regex`, `starts_with`, `time`, `ulid`, `uppercase`, `uuid`, `xid`, ]); function Ri(e, t, n, r, i = !0) { let a = n.format; if (a === `base64`) { let n = I(t, Yn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `base64url`) { let n = I(t, $n); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `jwt`) { let i = I(t, sr), a = I(t, n.alg ?? null); return ( e.write(`if (!${i}(${r}, ${a})) return INVALID;`), r ); } if (a === `ipv6`) { let n = I(t, Wn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `cidrv6`) { let n = I(t, qn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `credit_card`) { let n = I(t, ir); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `iban`) { let n = I(t, or); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } let o = n; if ( a === `url` || a === `httpurl` || o.normalize || o.hostname !== void 0 || o.protocol !== void 0 ) { let a = I(t, wn), s = I(t, n), c = R(t), l = R(t); if ( (e.write(`const ${c} = ${r}.trim();`), e.write(`const ${l} = ${a}(${c}, ${s});`), e.write( `if (typeof ${l} === "number") return INVALID;`, ), o.hostname !== void 0) ) { let n = I(t, On); e.write( `if (!${n}(${l}, ${s}.hostname)) return INVALID;`, ); } if (o.protocol !== void 0) { let n = I(t, kn); e.write( `if (!${n}(${l}, ${s}.protocol)) return INVALID;`, ); } if (!i) return null; let u = R(t), d = o.normalize ? `${l}.href` : `${I(t, Dn)}(${c})`; return (e.write(`const ${u} = ${d};`), u); } let s = n.fn; if (s) { if (W(s)) throw new F(`async string format ${a}`); let n = I(t, s); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (Li.has(a) && n.pattern) { let i = I(t, n.pattern); return ( e.write(`${i}.lastIndex = 0;`), e.write(`if (!${i}.test(${r})) return INVALID;`), r ); } let c = n.format; switch (c) { case `regex`: throw new F(`regex format without a pattern`); case `lowercase`: e.write( `if (${r} !== ${r}.toLowerCase()) return INVALID;`, ); break; case `uppercase`: e.write( `if (${r} !== ${r}.toUpperCase()) return INVALID;`, ); break; case `includes`: e.write( `if (!${r}.includes(${_(n.includes)})) return INVALID;`, ); break; case `starts_with`: { let t = n.prefix; e.write( `if (${r}.slice(0, ${t.length}) !== ${_(t)}) return INVALID;`, ); break; } case `ends_with`: { let t = n.suffix; e.write( `if (${r}.slice(-${t.length}) !== ${_(t)}) return INVALID;`, ); break; } default: throw new F(`string format ${c}`); } return r; } function V(e, t, n, r, i = !0) { let a = n._zod.def, o = a.type; if (a.coerce) throw new F(`coercion (z.coerce.${o}())`); let s = i || !!a.checks?.length, c; switch (o) { case `string`: c = zi(e, t, n, r, s); break; case `number`: c = Bi(e, n, r); break; case `boolean`: c = Vi(e, r); break; case `bigint`: c = Hi(e, n, r); break; case `symbol`: c = Ui(e, r); break; case `undefined`: c = Wi(e, r); break; case `null`: c = Gi(e, r); break; case `any`: case `unknown`: c = r; break; case `never`: (e.write(`return INVALID;`), (c = r)); break; case `void`: c = Ki(e, r); break; case `nan`: c = qi(e, r); break; case `date`: c = Ji(e, r); break; case `object`: c = Yi(e, t, n, r, s); break; case `optional`: c = Xi(e, t, n, r, s); break; case `nullable`: c = ta(e, t, n, r, s); break; case `array`: c = na(e, t, n, r, s); break; case `literal`: c = ra(e, t, n, r); break; case `enum`: c = ia(e, t, n, r); break; case `readonly`: { let i = aa(e, t, n, r), a = R(t); (e.write(`const ${a} = Object.freeze(${i});`), (c = a)); break; } case `success`: (aa(e, t, n, r), (c = `true`)); break; case `default`: case `prefault`: c = oa(e, t, n, r); break; case `nonoptional`: c = sa(e, t, n, r); break; case `tuple`: c = ca(e, t, n, r); break; case `union`: c = ua(e, t, n, r); break; case `intersection`: c = pa(e, t, n, r); break; case `record`: c = ma(e, t, n, r); break; case `map`: c = _a(e, t, n, r); break; case `set`: c = va(e, t, n, r); break; case `file`: c = ya(e, r); break; case `template_literal`: c = ba(e, t, n, r); break; case `lazy`: c = xa(e, t, n, r); break; case `pipe`: c = Sa(e, t, n, r); break; case `custom`: c = Ca(e, t, n, r); break; case `transform`: c = Ea(e, t, n, r); break; case `catch`: c = Ta(e, t, n, r); break; default: throw new F(`schema type ${o}`); } return c === null ? null : Si(e, t, n, c); } function zi(e, t, n, r, i = !0) { e.write(`if (typeof ${r} !== "string") return INVALID;`); let a = n._zod.def; return a.format === void 0 ? r : Ri(e, t, a, r, i); } function Bi(e, t, n) { e.write( `if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`, ); let r = t._zod.def; return ( r.check === `number_format` && r.format && Oi(e, { format: r.format }, n), n ); } function Vi(e, t) { return ( e.write( `if (typeof ${t} !== "boolean") return INVALID;`, ), t ); } function Hi(e, t, n) { e.write(`if (typeof ${n} !== "bigint") return INVALID;`); let r = t._zod.def; if (r.format) switch (r.format) { case `int64`: e.write( `if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`, ); break; case `uint64`: e.write( `if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`, ); } return n; } function Ui(e, t) { return ( e.write( `if (typeof ${t} !== "symbol") return INVALID;`, ), t ); } function Wi(e, t) { return ( e.write(`if (${t} !== undefined) return INVALID;`), t ); } function Gi(e, t) { return (e.write(`if (${t} !== null) return INVALID;`), t); } function Ki(e, t) { return ( e.write(`if (${t} !== undefined) return INVALID;`), t ); } function qi(e, t) { return ( e.write( `if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`, ), t ); } function Ji(e, t) { return ( e.write( `if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`, ), t ); } function Yi(e, t, n, r, i = !0) { let a = n._zod.def; e.write( `if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`, ); let o = a.shape, s = Object.keys(o), c = Object.getOwnPropertySymbols(o), l = c.length ? [...s, ...c] : s, u = (e) => (typeof e == `symbol` ? I(t, e) : _(e)), d = (e) => (typeof e == `symbol` ? `[${u(e)}]` : _(e)), f = o; if (s.includes(`__proto__`)) throw new F(`object shape key "__proto__"`); let p = /* @__PURE__ */ new Map(); for (let n of l) { let a = f[n], o = u(n), s = R(t); if ( (e.write(`const ${s} = ${r}[${o}];`), a._zod.optin !== void 0) ) { let i = R(t); (e.write(`let ${i} = (() => {`), e.indented((e) => { let n = z(e, t, a, s); e.write(`return ${n};`); }), e.write(`})();`), a._zod.optout === `optional` ? (e.write(`if (${i} === INVALID) {`), e.indented((e) => { (e.write(`if (${o} in ${r}) return INVALID;`), e.write(`${i} = undefined;`)); }), e.write(`}`)) : e.write( `if (${i} === INVALID) return INVALID;`, ), p.set(n, i)); } else { Qi(a) && e.write(`if (!(${o} in ${r})) return INVALID;`); let c = z(e, t, a, s, i); c !== null && p.set(n, c); } } let m = a.catchall, h = `none`; if (m) { let t = m._zod.def.type; if (t === `never`) { let t = s.map((e) => `k !== ${_(e)}`).join(` && `) || `true`; (e.write(`for (const k in ${r}) {`), e.indented((e) => { e.write(`if (${t}) return INVALID;`); }), e.write(`}`)); } else h = (t === `unknown` || t === `any`) && !m._zod.def.checks?.length ? `passthrough` : `schema`; } let g = R(t), ee = l.some((e) => ea(f[e]) || $i(f[e])); if (!i) { if (h === `schema`) { let n = s.length > 0 ? I(t, new Set(s)) : null; (e.write(`for (const k in ${r}) {`), e.indented((e) => { (e.write(`if (k === "__proto__") continue;`), n && e.write(`if (${n}.has(k)) continue;`)); let i = R(t); (e.write(`const ${i} = ${r}[k];`), z(e, t, m, i, !1)); }), e.write(`}`)); } return null; } if (ee) { e.write(`const ${g} = {};`); for (let t of l) { let n = u(t), i = p.get(t); $i(f[t]) ? e.write(`if (${n} in ${r}) ${g}[${n}] = ${i};`) : ea(f[t]) ? e.write( `if (${i} !== undefined || ${n} in ${r}) ${g}[${n}] = ${i};`, ) : e.write(`${g}[${n}] = ${i};`); } } else { let t = l.map((e) => `${d(e)}: ${p.get(e)}`).join(`, `); e.write(`const ${g} = { ${t} };`); } if (h !== `none`) { let n = s.length > 0 ? I(t, new Set(s)) : null; (e.write(`for (const k in ${r}) {`), e.indented((e) => { if ( (e.write(`if (k === "__proto__") continue;`), n && e.write(`if (${n}.has(k)) continue;`), h === `passthrough`) ) e.write(`${g}[k] = ${r}[k];`); else { let n = R(t); e.write(`const ${n} = ${r}[k];`); let i = z(e, t, m, n); e.write(`${g}[k] = ${i};`); } }), e.write(`}`)); } return g; } function Xi(e, t, n, r, i = !0) { let a = n._zod.def; if (Zi(n)) return V(e, t, a.innerType, r, i); if (a.innerType._zod.optin === `defaulted`) { let n = R(t), i = R(t); return ( e.write(`let ${n};`), e.write(`if (${r} === undefined) {`), e.indented((e) => { (e.write(`const ${i} = (() => {`), e.indented((e) => { let n = V(e, t, a.innerType, r); e.write(`return ${n};`); }), e.write(`})();`), e.write(`if (${i} !== INVALID) ${n} = ${i};`)); }), e.write(`} else {`), e.indented((e) => { let i = V(e, t, a.innerType, r); e.write(`${n} = ${i};`); }), e.write(`}`), n ); } let o = i ? R(t) : null; return ( o && e.write(`let ${o};`), e.write(`if (${r} !== undefined) {`), e.indented((e) => { let n = V(e, t, a.innerType, r, i); o && n !== null && e.write(`${o} = ${n};`); }), e.write(`}`), o ); } function Zi(e) { return e._zod.traits?.has(`$ZodExactOptional`) === !0; } function Qi(e) { return e._zod.optin === void 0 && H(e); } function H(e) { if (e._zod.def.coerce) return !0; let t = e._zod.def; switch (t.type) { case `any`: case `unknown`: case `undefined`: case `void`: case `default`: case `prefault`: case `transform`: case `custom`: case `lazy`: return !0; case `string`: case `number`: case `boolean`: case `bigint`: case `symbol`: case `null`: case `never`: case `nan`: case `date`: case `object`: case `array`: case `tuple`: case `record`: case `map`: case `set`: case `file`: case `template_literal`: return !1; case `nonoptional`: return t.innerType ? H(t.innerType) : !1; case `literal`: return !!t.values?.includes(void 0); case `enum`: return !!e._zod.values?.has(void 0); case `optional`: case `nullable`: case `readonly`: case `success`: return !t.innerType || H(t.innerType); case `catch`: return !0; case `union`: return !t.options || t.options.some(H); case `intersection`: return ( !t.left || !t.right || (H(t.left) && H(t.right)) ); case `pipe`: return !t.in || H(t.in); default: return !0; } } function $i(e) { return ( e._zod.optin === `optional` && e._zod.optout === `optional` ); } function ea(e) { return ( (e._zod.optin !== `defaulted` || e._zod.optout === `optional`) && U(e) ); } function U(e) { let t = e._zod.def; switch (t.type) { case `string`: case `number`: case `boolean`: case `bigint`: case `symbol`: case `null`: case `nan`: case `date`: case `object`: case `array`: case `tuple`: case `record`: case `map`: case `set`: case `file`: case `template_literal`: case `never`: case `success`: return !1; case `literal`: return !!t.values?.includes(void 0); case `enum`: return !!e._zod.values?.has(void 0); case `optional`: return !0; case `nullable`: case `readonly`: case `nonoptional`: return !t.innerType || U(t.innerType); case `union`: return !t.options || t.options.some(U); case `intersection`: return !t.left || !t.right || U(t.left) || U(t.right); case `pipe`: return !t.out || U(t.out); default: return !0; } } function ta(e, t, n, r, i = !0) { let a = n._zod.def, o = i ? R(t) : null; return ( o && e.write(`let ${o} = null;`), e.write(`if (${r} !== null) {`), e.indented((e) => { let n = V(e, t, a.innerType, r, i); o && n !== null && e.write(`${o} = ${n};`); }), e.write(`}`), o ); } function na(e, t, n, r, i = !0) { let a = n._zod.def; e.write(`if (!Array.isArray(${r})) return INVALID;`); let o = i ? R(t) : null, s = R(t), c = R(t); return ( o && e.write(`const ${o} = new Array(${r}.length);`), e.write( `for (let ${s} = 0; ${s} < ${r}.length; ${s}++) {`, ), e.indented((e) => { e.write(`const ${c} = ${r}[${s}];`); let n = z(e, t, a.element, c, i); o && n !== null && e.write(`${o}[${s}] = ${n};`); }), e.write(`}`), o ); } function ra(e, t, n, r) { let i = n._zod.def.values; if (i.length !== 1) { let n = I(t, new Set(i)); return ( e.write(`if (!${n}.has(${r})) return INVALID;`), r ); } let a = i[0]; if (typeof a == `number` && Number.isNaN(a)) { let n = I(t, new Set(i)); return ( e.write(`if (!${n}.has(${r})) return INVALID;`), r ); } if (typeof a == `string`) e.write(`if (${r} !== ${_(a)}) return INVALID;`); else if (typeof a == `number` || typeof a == `boolean`) e.write(`if (${r} !== ${a}) return INVALID;`); else if (a === null) e.write(`if (${r} !== null) return INVALID;`); else if (a === void 0) e.write(`if (${r} !== undefined) return INVALID;`); else if (typeof a == `bigint`) e.write(`if (${r} !== ${a}n) return INVALID;`); else throw new F(`literal type ${typeof a}`); return r; } function ia(e, t, n, r) { let i = n._zod.values; if (!i) throw new F(`enum schema without enumerated values`); let a = I(t, i); return ( e.write(`if (!${a}.has(${r})) return INVALID;`), r ); } function aa(e, t, n, r) { let i = n._zod.def; return V(e, t, i.innerType, r); } function oa(e, t, n, r) { let i = n._zod.def, a = Object.getOwnPropertyDescriptor( n._zod.def, `defaultValue`, ) ? () => n._zod.def.defaultValue : void 0; if (n._zod.def.type === `prefault`) { if (!a) return V(e, t, i.innerType, r); let n = I(t, a), o = R(t); return ( e.write(`let ${o} = ${r};`), e.write(`if (${r} === undefined) ${o} = ${n}();`), V(e, t, i.innerType, o) ); } let o = R(t); if (a) { let n = I(t, a), s = I(t, ie); (e.write(`let ${o};`), e.write(`if (${r} === undefined) {`), e.indented((e) => { e.write(`${o} = ${s}(${n}());`); }), e.write(`} else {`), e.indented((e) => { let a = V(e, t, i.innerType, r); e.write( `${o} = ${a} === undefined ? ${s}(${n}()) : ${a};`, ); }), e.write(`}`)); } else (e.write(`let ${o};`), e.write(`if (${r} !== undefined) {`), e.indented((e) => { let n = V(e, t, i.innerType, r); e.write(`${o} = ${n};`); }), e.write(`}`)); return o; } function sa(e, t, n, r) { let i = n._zod.def, a = V(e, t, i.innerType, r), o = R(t); return ( e.write(`const ${o} = ${a};`), e.write(`if (${o} === undefined) return INVALID;`), o ); } function ca(e, t, n, r) { let i = n._zod.def, a = i.items, o = i.rest; e.write(`if (!Array.isArray(${r})) return INVALID;`); let s = la(a, `optin`), c = la(a, `optout`); o ? e.write(`if (${r}.length < ${s}) return INVALID;`) : e.write( `if (${r}.length < ${s} || ${r}.length > ${a.length}) return INVALID;`, ); let l = R(t); e.write(`const ${l} = [];`); for (let n = 0; n < a.length; n++) { let i = a[n]; if (n >= c) (e.write(`if (${l}.length === ${n}) {`), e.indented((e) => { (e.write(`if (${n} < ${r}.length) {`), e.indented((e) => { let a = R(t); e.write(`const ${a} = ${r}[${n}];`); let o = z(e, t, i, a); e.write(`${l}[${n}] = ${o};`); }), e.write(`} else {`), e.indented((e) => { if ($i(i)) { e.write(`${l}.length = ${n};`); return; } let r = R(t), a = R(t); (e.write(`const ${r} = undefined;`), e.write(`const ${a} = (() => {`), e.indented((e) => { let n = z(e, t, i, r); e.write(`return ${n};`); }), e.write(`})();`), e.write( `if (${a} === INVALID || ${a} === undefined) ${l}.length = ${n};`, ), e.write(`else ${l}[${n}] = ${a};`)); }), e.write(`}`)); }), e.write(`}`)); else { let a = R(t); e.write(`const ${a} = ${r}[${n}];`); let o = z(e, t, i, a); e.write(`${l}[${n}] = ${o};`); } } if (o) { let n = R(t), i = R(t); (e.write( `for (let ${n} = ${a.length}; ${n} < ${r}.length; ${n}++) {`, ), e.indented((e) => { e.write(`const ${i} = ${r}[${n}];`); let a = z(e, t, o, i); e.write(`${l}[${n}] = ${a};`); }), e.write(`}`)); } return l; } function la(e, t) { for (let n = e.length - 1; n >= 0; n--) if ( !(t === `optin` ? e[n]._zod.optin !== void 0 : e[n]._zod.optout === `optional`) ) return n + 1; return 0; } function ua(e, t, n, r) { let i = n._zod.def, a = i.options; if (i.discriminator) return da(e, t, i, r); if (i.inclusive === !1) throw new F(`exclusive unions (z.xor)`); if (a.length === 0) return (e.write(`return INVALID;`), r); if (a.length === 1) return V(e, t, a[0], r); if ( a.every( (e) => e._zod.def.type === `literal` && !e._zod.def.checks?.length, ) ) { let n = I( t, new Set(a.flatMap((e) => e._zod.def.values)), ); return ( e.write(`if (!${n}.has(${r})) return INVALID;`), r ); } let o = R(t); e.write(`let ${o};`); for (let n = 0; n < a.length; n++) { let i = a[n]; (n === 0 ? e.write(`${o} = (() => {`) : e.write(`if (${o} === INVALID) ${o} = (() => {`), e.indented((e) => { let n = V(e, t, i, r); e.write(`return ${n};`); }), e.write(`})();`)); } return ( e.write(`if (${o} === INVALID) return INVALID;`), o ); } function da(e, t, n, r) { if (n.unionFallback) throw new F(`discriminated union with unionFallback`); if (n.options.length === 0) return (e.write(`return INVALID;`), r); let i = R(t), a = R(t); (e.write(`const ${i} = ${r}?.[${_(n.discriminator)}];`), e.write(`let ${a};`)); let o = !0, s = /* @__PURE__ */ new Set(); for (let c of n.options) { let l = c._zod.propValues?.[n.discriminator]; if (!l || l.size === 0) throw new F( `discriminated union option without static discriminator values`, ); for (let e of l) { if (s.has(e)) throw new F( `duplicate discriminator value ${String(e)}`, ); s.add(e); } let u = Array.from(l, (e) => fa(t, i, e)), d = o ? `if` : `else if`; (e.write(`${d} (${u.join(` || `)}) {`), e.indented((e) => { let n = V(e, t, c, r); e.write(`${a} = ${n};`); }), e.write(`}`), (o = !1)); } return (e.write(`else { return INVALID; }`), a); } function fa(e, t, n) { if (typeof n == `string`) return `${t} === ${_(n)}`; if (typeof n == `number`) return Number.isNaN(n) ? `Number.isNaN(${t})` : `${t} === ${n}`; if (typeof n == `boolean`) return `${t} === ${n}`; if (n === null) return `${t} === null`; if (n === void 0) return `${t} === undefined`; if (typeof n == `bigint`) return `${t} === ${n}n`; if (typeof n == `symbol`) return `${t} === ${I(e, n)}`; throw new F(`literal discriminator value ${String(n)}`); } function pa(e, t, n, r) { let i = n._zod.def; t.definite = !1; let a = z(e, t, i.left, r), o = z(e, t, i.right, r), s = I(t, Tr), c = R(t); return ( e.write(`const ${c} = ${s}(${a}, ${o});`), e.write(`if (!${c}.valid) return INVALID;`), `${c}.data` ); } function ma(e, t, n, r) { let i = n._zod.def, a = I(t, v); e.write(`if (!${a}(${r})) return INVALID;`); let o = R(t), s = R(t), c = R(t); e.write(`const ${o} = {};`); let l = i, u = l.partial ? void 0 : i.keyType._zod.values; if (u) { let n = []; for (let a of u) { if ( typeof a != `string` && typeof a != `number` && typeof a != `symbol` ) throw new F(`record key value ${String(a)}`); let s = typeof a == `number` ? a.toString() : a; if (s === `__proto__`) throw new F(`record key "__proto__"`); n.push(s); let c = I(t, a), l = V(e, t, i.keyType, c), u = R(t); e.write(`const ${u} = ${r}[${ga(t, s)}];`); let d = z(e, t, i.valueType, u); e.write(`${o}[${l}] = ${d};`); } let a = I(t, new Set(n)); return ( e.write(`for (const ${s} in ${r}) {`), e.indented((e) => { (e.write(`if (${a}.has(${s})) continue;`), l.mode === `loose` ? e.write( `if (${s} !== "__proto__") ${o}[${s}] = ${r}[${s}];`, ) : e.write(`return INVALID;`)); }), e.write(`}`), o ); } let d = i.keyType._zod.def; if ( d.type !== `string` || d.format !== void 0 || d.coerce || (d.checks?.length ?? 0) !== 0 ) { let n = i.mode === `loose`, a = vi(i.keyType); a.definite === !1 && (t.definite = !1); let c = I(t, a), l = I(t, qt), u = R(t); return ( ha(e, t, r, s, (e) => { (e.write(`let ${u} = ${c}(${s});`), e.write( `if (${u} === INVALID && typeof ${s} === "string" && ${l}.test(${s})) ${u} = ${c}(Number(${s}));`, ), n ? e.write( `if (${u} === INVALID) { ${o}[${s}] = ${r}[${s}]; continue; }`, ) : e.write( `if (${u} === INVALID) return INVALID;`, ), e.write(`if (${u} === "__proto__") continue;`)); let a = R(t); e.write(`const ${a} = ${r}[${s}];`); let d = z(e, t, i.valueType, a); e.write(`${o}[${u}] = ${d};`); }), o ); } return ( ha( e, t, r, s, (e) => { e.write(`const ${c} = ${r}[${s}];`); let n = z(e, t, i.valueType, c); e.write(`${o}[${s}] = ${n};`); }, `return INVALID;`, ), o ); } function ha(e, t, n, r, i, a) { let o = I(t, Object.prototype.propertyIsEnumerable), s = R(t), c = R(t), l = R(t); (e.write( `const ${s} = Object.getOwnPropertySymbols(${n});`, ), e.write( `const ${c} = Object.getOwnPropertyNames(${n});`, ), e.write( `for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`, ), e.indented((e) => { (e.write(`const ${r} = ${c}[${l}];`), e.write( `if (${r} === "__proto__" || !${o}.call(${n}, ${r})) continue;`, ), i(e)); }), e.write(`}`), e.write( `for (let ${l} = 0; ${l} < ${s}.length; ${l}++) {`, ), e.indented((e) => { (e.write(`const ${r} = ${s}[${l}];`), e.write(`if (!${o}.call(${n}, ${r})) continue;`), a ? e.write(a) : i(e)); }), e.write(`}`)); } function ga(e, t) { return typeof t == `string` ? _(t) : I(e, t); } function _a(e, t, n, r) { let i = n._zod.def; e.write(`if (!(${r} instanceof Map)) return INVALID;`); let a = R(t), o = R(t), s = R(t); return ( e.write(`const ${a} = new Map();`), e.write(`for (const [${o}, ${s}] of ${r}) {`), e.indented((e) => { let n = V(e, t, i.keyType, o), r = V(e, t, i.valueType, s); e.write(`${a}.set(${n}, ${r});`); }), e.write(`}`), a ); } function va(e, t, n, r) { let i = n._zod.def; e.write(`if (!(${r} instanceof Set)) return INVALID;`); let a = R(t), o = R(t); return ( e.write(`const ${a} = new Set();`), e.write(`for (const ${o} of ${r}) {`), e.indented((e) => { let n = V(e, t, i.valueType, o); e.write(`${a}.add(${n});`); }), e.write(`}`), a ); } function ya(e, t) { return ( e.write(`if (!(${t} instanceof File)) return INVALID;`), t ); } function ba(e, t, n, r) { e.write(`if (typeof ${r} !== "string") return INVALID;`); let i = n._zod.pattern; if (i) { let n = I(t, i); (e.write(`${n}.lastIndex = 0;`), e.write(`if (!${n}.test(${r})) return INVALID;`)); } return r; } function xa(e, t, n, r) { let i = n._zod.def, a = L(t, i.getter), o = I(t, { parser: null }); (e.write(`if (!${o}.parser) {`), e.indented((e) => { (e.write(`const inner = ${a}();`), e.write(`${o}.parser = function(input) {`), e.indented((e) => { (e.write( `const result = inner._zod.run({ value: input, issues: [] }, {});`, ), e.write( `return result.issues.length === 0 ? result.value : INVALID;`, )); }), e.write(`};`)); }), e.write(`}`)); let s = R(t); return ( e.write(`const ${s} = ${o}.parser(${r});`), e.write(`if (${s} === INVALID) return INVALID;`), s ); } function Sa(e, t, n, r) { let i = n._zod.def, a = V(e, t, i.in, r); if (i.transform) { if (W(i.transform)) throw new P( `z.compile: async transforms in pipes are not supported`, ); let n = i.transform, r = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }, r = n(e, t); return r instanceof Promise ? N : t.issues.length === 0 ? r : N; }), o = R(t); return ( e.write(`const ${o} = ${r}(${a});`), e.write(`if (${o} === INVALID) return INVALID;`), V(e, t, i.out, o) ); } return V(e, t, i.out, a); } function W(e) { return ( typeof e == `function` && (e.constructor.name === `AsyncFunction` || e[Symbol.toStringTag] === `AsyncFunction`) ); } function Ca(e, t, n, r) { let i = n._zod.def; if (i.fn) { if (W(i.fn)) throw new P( `z.compile: async custom predicates are not supported`, ); let n = L(t, i.fn), a = I(t, Pi), o = R(t); (e.write(`const ${o} = ${n}(${r});`), e.write(`if (${o} instanceof Promise) ${a}();`), e.write(`if (!${o}) return INVALID;`)); } else throw new F( `custom schema without a predicate function`, ); return r; } function wa(e, t, n) { let r = e._zod.run({ value: n, issues: [] }, {}); if (r && typeof r.then == `function`) return N; let i = r; return i.issues.length === 0 ? i.value : t(); } function Ta(e, t, n, r) { let i = n._zod.def; if (!i.catchValue[`~constantCatch`]) throw new F( `catch with a callback (only a constant catch value compiles)`, !1, ); let a = R(t); (e.write(`let ${a} = (() => {`), e.indented((e) => { let n = z(e, t, i.innerType, r); e.write(`return ${n};`); }), e.write(`})();`)); let o = I(t, i.innerType), s = L(t, i.catchValue), c = I(t, wa); return ( e.write(`if (${a} === INVALID) {`), e.indented((e) => { (e.write(`${a} = ${c}(${o}, ${s}, ${r});`), e.write(`if (${a} === INVALID) return INVALID;`)); }), e.write(`}`), a ); } function Ea(e, t, n, r) { let i = n._zod.def; if (i.transform) { if (W(i.transform)) throw new P( `z.compile: async transforms are not supported`, ); let n = i.transform, a = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }, r = n(e, t); return r instanceof Promise ? N : t.issues.length === 0 ? r : N; }), o = R(t); return ( e.write(`const ${o} = ${a}(${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } return r; } function Da(e) { return ((e.checks &&= [...e.checks]), e); } // @__NO_SIDE_EFFECTS__ function Oa(e, t) { return new e(Da({ type: `string`, ...b(t) })); } // @__NO_SIDE_EFFECTS__ function ka(e, t) { return new e({ type: `string`, format: `email`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Aa(e, t) { return new e({ type: `string`, format: `guid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function ja(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ma(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v4`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Na(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v6`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Pa(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v7`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Fa(e, t) { return new e({ type: `string`, format: `url`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ia(e, t) { return new e({ type: `string`, format: `emoji`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function La(e, t) { return new e({ type: `string`, format: `nanoid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ra(e, t) { return new e({ type: `string`, format: `cuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function za(e, t) { return new e({ type: `string`, format: `cuid2`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ba(e, t) { return new e({ type: `string`, format: `ulid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Va(e, t) { return new e({ type: `string`, format: `xid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ha(e, t) { return new e({ type: `string`, format: `ksuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ua(e, t) { return new e({ type: `string`, format: `ipv4`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Wa(e, t) { return new e({ type: `string`, format: `ipv6`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ga(e, t) { return new e({ type: `string`, format: `cidrv4`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ka(e, t) { return new e({ type: `string`, format: `cidrv6`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function qa(e, t) { return new e({ type: `string`, format: `base64`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ja(e, t) { return new e({ type: `string`, format: `base64url`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ya(e, t) { return new e({ type: `string`, format: `e164`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Xa(e, t) { return new e({ type: `string`, format: `jwt`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Za(e, t) { return new e({ type: `string`, format: `datetime`, check: `string_format`, offset: !1, local: !1, precision: null, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Qa(e, t) { return new e({ type: `string`, format: `date`, check: `string_format`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function $a(e, t) { return new e({ type: `string`, format: `time`, check: `string_format`, precision: null, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function eo(e, t) { return new e({ type: `string`, format: `duration`, check: `string_format`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function to(e, t) { return new e(Da({ type: `number`, checks: [], ...b(t) })); } // @__NO_SIDE_EFFECTS__ function no(e, t) { return new e({ type: `number`, check: `number_format`, abort: !1, format: `safeint`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function ro(e) { return new e({ type: `unknown` }); } // @__NO_SIDE_EFFECTS__ function io(e, t) { return new e({ type: `never`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function ao(e, t) { return new e({ type: `date`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function oo(e, t) { return new Qt({ check: `less_than`, ...b(t), value: e, inclusive: !1, }); } // @__NO_SIDE_EFFECTS__ function so(e, t) { return new Qt({ check: `less_than`, ...b(t), value: e, inclusive: !0, }); } // @__NO_SIDE_EFFECTS__ function co(e, t) { return new $t({ check: `greater_than`, ...b(t), value: e, inclusive: !1, }); } // @__NO_SIDE_EFFECTS__ function lo(e, t) { return new $t({ check: `greater_than`, ...b(t), value: e, inclusive: !0, }); } // @__NO_SIDE_EFFECTS__ function uo(e, t) { return new en({ check: `multiple_of`, ...b(t), value: e, }); } // @__NO_SIDE_EFFECTS__ function fo(e, t) { return new nn({ check: `max_length`, ...b(t), maximum: e, }); } // @__NO_SIDE_EFFECTS__ function po(e, t) { return new rn({ check: `min_length`, ...b(t), minimum: e, }); } // @__NO_SIDE_EFFECTS__ function mo(e, t) { return new an({ check: `length_equals`, ...b(t), length: e, }); } // @__NO_SIDE_EFFECTS__ function ho(e, t) { return new sn({ check: `string_format`, format: `regex`, ...b(t), pattern: e, }); } // @__NO_SIDE_EFFECTS__ function go(e) { return new cn({ check: `string_format`, format: `lowercase`, ...b(e), }); } // @__NO_SIDE_EFFECTS__ function _o(e) { return new ln({ check: `string_format`, format: `uppercase`, ...b(e), }); } // @__NO_SIDE_EFFECTS__ function vo(e, t) { return new un({ check: `string_format`, format: `includes`, ...b(t), includes: e, }); } // @__NO_SIDE_EFFECTS__ function yo(e, t) { return new dn({ check: `string_format`, format: `starts_with`, ...b(t), prefix: e, }); } // @__NO_SIDE_EFFECTS__ function bo(e, t) { return new fn({ check: `string_format`, format: `ends_with`, ...b(t), suffix: e, }); } // @__NO_SIDE_EFFECTS__ function xo(e) { return new pn({ check: `overwrite`, tx: e }); } // @__NO_SIDE_EFFECTS__ function So(e) { return /* @__PURE__ */ xo((t) => t.normalize(e)); } // @__NO_SIDE_EFFECTS__ function Co() { return /* @__PURE__ */ xo((e) => e.trim()); } // @__NO_SIDE_EFFECTS__ function wo() { return /* @__PURE__ */ xo((e) => e.toLowerCase()); } // @__NO_SIDE_EFFECTS__ function To() { return /* @__PURE__ */ xo((e) => e.toUpperCase()); } // @__NO_SIDE_EFFECTS__ function Eo() { return /* @__PURE__ */ xo((e) => ee(e)); } // @__NO_SIDE_EFFECTS__ function Do(e, t, n) { return new e({ type: `array`, element: t, ...b(n) }); } // @__NO_SIDE_EFFECTS__ function Oo(e, t, n) { return new e({ type: `custom`, check: `custom`, fn: t, ...b(n), }); } // @__NO_SIDE_EFFECTS__ function ko(e, t) { let n = /* @__PURE__ */ Ao( (t) => ( (t.addIssue = (e) => { if (typeof e == `string`) t.issues.push(Oe(e, t.value, n._zod.def)); else { let r = e; (r.fatal && (r.continue = !1), (r.code ??= `custom`), `input` in r || (r.input = t.value), (r.inst ??= n), (r.continue ??= !n._zod.def.abort), t.issues.push(Oe(r))); } }), e(t.value, t) ), t, ); return n; } // @__NO_SIDE_EFFECTS__ function Ao(e, t) { let n = new A({ check: `custom`, ...b(t) }); return ((n._zod.check = e), n); } function jo(e, ...t) { for (let n of t) for (let t of Reflect.ownKeys(n)) Object.prototype.propertyIsEnumerable.call(n, t) && l(e, t, n[t]); return e; } function Mo(e) { let t = e?.target ?? `draft-2020-12`; return ( t === `draft-4` && (t = `draft-04`), t === `draft-7` && (t = `draft-07`), { processors: e.processors ?? {}, metadataRegistry: e?.metadata ?? fi, target: t, unrepresentable: e?.unrepresentable ?? `throw`, override: e?.override ?? (() => {}), io: e?.io ?? `output`, counter: 0, seen: /* @__PURE__ */ new Map(), sharedDefsExtractedFor: void 0, sharedEmitDoneFor: void 0, cycles: e?.cycles ?? `ref`, reused: e?.reused ?? `inline`, intersections: [], deferred: [], external: e?.external ?? void 0, } ); } function G(e, t, n, r, i) { let a = typeof t.unrepresentable == `function` ? t.unrepresentable({ zodSchema: e, path: r.path, message: i, }) : t.unrepresentable; if (a === `any`) return !1; if (a === void 0 || a === `throw`) throw Error(i); return (Object.assign(n, a), !0); } function K(e, t, n = { path: [], schemaPath: [] }) { var r; let i = e._zod.def, a = t.seen.get(e); if (a) return ( a.count++, n.schemaPath.includes(e) && (a.cycle = n.path), a.schema ); let o = { schema: {}, count: 1, cycle: void 0, path: n.path, }; (t.seen.set(e, o), (t.sharedDefsExtractedFor = void 0), (t.sharedEmitDoneFor = void 0)); let s = e._zod.toJSONSchema?.(); if (s) o.schema = s; else { let r = { ...n, schemaPath: [...n.schemaPath, e], path: n.path, }; if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, o.schema, r); else { let n = o.schema, a = t.processors[i.type]; if (!a) throw Error( `[toJSONSchema]: Non-representable type encountered: ${i.type}`, ); a(e, t, n, r); } let a = e._zod.parent; a && ((o.ref ||= a), K(a, t, r), (t.seen.get(a).isParent = !0)); } let c = t.metadataRegistry.get(e); return ( c && jo(o.schema, c), t.io === `input` && q(e) && (delete o.schema.examples, delete o.schema.default), t.io === `input` && `_prefault` in o.schema && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, t.seen.get(e).schema ); } function No(e) { return e.replace(/~/g, `~0`).replace(/\//g, `~1`); } function Po(e, t) { let n = e.seen.get(t); if (!n) throw Error( `Unprocessed schema. This is a bug in Zod.`, ); if (e.external && e.sharedDefsExtractedFor === e.external) return; let r = /* @__PURE__ */ new Map(); for (let t of e.seen.entries()) { let n = e.metadataRegistry.get(t[0])?.id; if (n) { let e = r.get(n); if (e && e !== t[0]) throw Error( `Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`, ); r.set(n, t[0]); } } let i = (t) => { let r = e.target === `draft-2020-12` ? `$defs` : `definitions`; if (e.external) { let n = e.external.registry.get(t[0])?.id, i = e.external.uri ?? ((e) => e); if (n) return { ref: i(n) }; let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`; return ( (t[1].defId = a), { defId: a, ref: `${i(`__shared`)}#/${r}/${No(a)}`, } ); } let i = `#/${r}/`; if (t[1] === n && !t[1].schema.id) return { ref: `#` }; let a = t[1].schema.id ?? `__schema${e.counter++}`; return { defId: a, ref: i + No(a) }; }, a = (e) => { if (e[1].schema.$ref) return; let t = e[1], { ref: n, defId: r } = i(e); ((t.def = { ...t.schema }), r && (t.defId = r)); let a = t.schema; for (let e in a) delete a[e]; a.$ref = n; }; if (e.cycles === `throw`) for (let t of e.seen.entries()) { let e = t[1]; if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root> Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`); } for (let n of e.seen.entries()) { let r = n[1]; if (t === n[0]) { a(n); continue; } if (e.external) { let r = e.external.registry.get(n[0])?.id; if (t !== n[0] && r) { a(n); continue; } } if (e.metadataRegistry.get(n[0])?.id) { a(n); continue; } if (r.cycle) { a(n); continue; } r.count > 1 && e.reused === `ref` && a(n); } e.external && (e.sharedDefsExtractedFor = e.external); } function Fo(e) { let t = e.anyOf; if ( !Array.isArray(t) || t.length === 0 || e.type !== void 0 ) return; let n = []; for (let e of t) { if (!e || typeof e != `object`) return; Fo(e); let t = Object.keys(e); if (t.length !== 1 || t[0] !== `type`) return; let r = e.type; for (let e of Array.isArray(r) ? r : [r]) { if (typeof e != `string`) return; n.includes(e) || n.push(e); } } (delete e.anyOf, (e.type = n.length === 1 ? n[0] : n)); } const Io = /* @__PURE__ */ new Set([ `type`, `properties`, `required`, `additionalProperties`, ]), Lo = [`oneOf`, `anyOf`]; function Ro(e) { let t = e.additionalProperties; return t === void 0 || t === !1 || typeof t != `object` || !t ? null : Object.keys(t).length ? t : null; } function zo(e) { let t = []; for (let n of e) { if (typeof n != `object` || n.type !== `object`) return null; for (let e in n) if (!Io.has(e)) return null; t.push(n); } let n = {}, r = /* @__PURE__ */ new Set(); for (let e of t) { for (let r in e.properties) { if (Object.prototype.hasOwnProperty.call(n, r)) continue; let e = []; for (let n of t) { let t = n.properties?.[r] ?? Ro(n); t != null && (e.some( (e) => JSON.stringify(e) === JSON.stringify(t), ) || e.push(t)); } l( n, r, e.length === 1 ? e[0] : (zo(e) ?? { allOf: e }), ); } for (let t of e.required ?? []) r.add(t); } let i = { type: `object`, properties: n }; if ( (r.size && (i.required = [...r]), t.every((e) => e.additionalProperties === !1)) ) i.additionalProperties = !1; else { let e = []; for (let n of t) { let t = Ro(n); t && !e.some( (e) => JSON.stringify(e) === JSON.stringify(t), ) && e.push(t); } e.length === 1 ? (i.additionalProperties = e[0]) : e.length > 1 && (i.additionalProperties = { allOf: e }); } return i; } function Bo(e) { let t = e.allOf; if (!Array.isArray(t) || t.length < 2) return; for (let t of Io) if (t in e) return; let n = t.filter((e) => Lo.some((t) => Array.isArray(e[t])), ), r = null; if (!n.length) r = zo(t); else { let e = n[0], i = Lo.find((t) => Array.isArray(e[t])); if (Object.keys(e).length !== 1) return; let a = t.filter((t) => t !== e), o = e[i].map((e) => zo([...a, e])); if (o.some((e) => !e)) return; r = { [i]: o }; } r && (delete e.allOf, jo(e, r)); } function Vo(e, t) { let n = e.seen.get(t); if (!n) throw Error( `Unprocessed schema. This is a bug in Zod.`, ); let r = (t) => { let n = e.seen.get(t); if (n.ref === null) return; let i = n.def ?? n.schema, a = { ...i }, o = n.ref; if (((n.ref = null), o)) { r(o); let n = e.seen.get(o), s = n.schema; if ( (s.$ref && (e.target === `draft-07` || e.target === `draft-04` || e.target === `openapi-3.0`) ? ((i.allOf = i.allOf ?? []), i.allOf.push(s)) : jo(i, s), jo(i, a), t._zod.parent === o) ) for (let e in i) e !== `$ref` && e !== `allOf` && (e in a || delete i[e]); if (s.$ref && n.def) for (let e in i) e !== `$ref` && e !== `allOf` && e in n.def && JSON.stringify(i[e]) === JSON.stringify(n.def[e]) && delete i[e]; } let s = t._zod.parent; if (s && s !== o) { r(s); let t = e.seen.get(s); if ( t?.schema.$ref && ((i.$ref = t.schema.$ref), t.def) ) for (let e in i) e !== `$ref` && e !== `allOf` && e in t.def && JSON.stringify(i[e]) === JSON.stringify(t.def[e]) && delete i[e]; } e.override({ zodSchema: t, jsonSchema: i, path: n.path ?? [], }); }; if (!e.external || e.sharedEmitDoneFor !== e.external) { for (let t of [...e.seen.entries()].reverse()) r(t[0]); if (e.target !== `openapi-3.0`) for (let t of e.seen.entries()) Fo(t[1].def ?? t[1].schema); for (let t of e.deferred) t(); if (e.intersections.length) { let t = /* @__PURE__ */ new Map(); for (let n of e.seen.values()) for (let e of [n.schema, n.def]) { let n = e?.allOf; if (!Array.isArray(n)) continue; let r = t.get(n); r ? r.push(e) : t.set(n, [e]); } for (let n of e.intersections) for (let e of t.get(n) ?? []) Bo(e); } } let i = {}; if ( (e.target === `draft-2020-12` ? (i.$schema = `https://json-schema.org/draft/2020-12/schema`) : e.target === `draft-07` ? (i.$schema = `http://json-schema.org/draft-07/schema#`) : e.target === `draft-04` ? (i.$schema = `http://json-schema.org/draft-04/schema#`) : e.target, e.external?.uri) ) { let n = e.external.registry.get(t)?.id; if (!n) throw Error("Schema is missing an `id` property"); i.$id = e.external.uri(n); } jo(i, n.defId ? n.schema : (n.def ?? n.schema)); let a = e.metadataRegistry.get(t)?.id; a !== void 0 && i.id === a && delete i.id; let o = e.external?.defs ?? {}; if (!e.external || e.sharedEmitDoneFor !== e.external) for (let t of e.seen.entries()) { let e = t[1]; e.def && e.defId && (e.def.id === e.defId && delete e.def.id, l(o, e.defId, e.def)); } (e.external && (e.sharedEmitDoneFor = e.external), e.external || (Object.keys(o).length > 0 && (e.target === `draft-2020-12` ? (i.$defs = o) : (i.definitions = o)))); try { let n = JSON.parse(JSON.stringify(i)); return ( Object.defineProperty(n, "~standard", { value: { ...t[`~standard`], jsonSchema: { input: Uo(t, `input`, e.processors), output: Uo(t, `output`, e.processors), }, }, enumerable: !1, writable: !1, }), n ); } catch { throw Error(`Error converting schema to JSON.`); } } function q(e, t) { let n = t ?? { seen: /* @__PURE__ */ new Set() }; if (n.seen.has(e)) return !1; n.seen.add(e); let r = e._zod.def; if (r.type === `transform`) return !0; if (r.type === `array`) return q(r.element, n); if (r.type === `set`) return q(r.valueType, n); if (r.type === `lazy`) return q(r.getter(), n); if ( r.type === `promise` || r.type === `optional` || r.type === `nonoptional` || r.type === `nullable` || r.type === `readonly` || r.type === "default" || r.type === `prefault` || r.type === `catch` ) return q(r.innerType, n); if (r.type === `intersection`) return q(r.left, n) || q(r.right, n); if (r.type === `record` || r.type === `map`) return q(r.keyType, n) || q(r.valueType, n); if (r.type === `pipe`) return e._zod.traits.has(`$ZodCodec`) ? !0 : q(r.in, n) || q(r.out, n); if (r.type === `object`) { for (let e in r.shape) if (q(r.shape[e], n)) return !0; return !1; } if (r.type === `union`) { for (let e of r.options) if (q(e, n)) return !0; return !1; } if (r.type === `tuple`) { for (let e of r.items) if (q(e, n)) return !0; return !!(r.rest && q(r.rest, n)); } return !1; } const Ho = (e, t = {}) => (n) => { let r = Mo({ ...n, processors: t }); return (K(e, r), Po(r, e), Vo(r, e)); }, Uo = (e, t, n = {}) => (r) => { let { libraryOptions: i, target: a } = r ?? {}, o = Mo({ ...(i ?? {}), target: a, io: t, processors: n, }); return (K(e, o), Po(o, e), Vo(o, e)); }, Wo = (e, t, n) => { (e[t] === void 0 || n > e[t]) && (e[t] = n); }, Go = (e, t, n) => { (e[t] === void 0 || n < e[t]) && (e[t] = n); }, Ko = (e, t) => { (Wo(e, `minimum`, t), Go(e, `maximum`, t)); }, qo = (e, t) => { ((e.multipleOf ??= []), e.multipleOf.includes(t) || e.multipleOf.push(t)); }, Jo = (e, t) => { ((e.patterns ??= /* @__PURE__ */ new Set()), e.patterns.add(t)); }, Yo = (e, t) => { e.mime = e.mime ? e.mime.filter((e) => t.includes(e)) : [...t]; }, Xo = (e, t) => { ((e.format = t), t.includes(`int`) && (e.isInt = !0)); }, Zo = (e, t) => Wo(e, `minimum`, t.minimum), Qo = (e, t) => Go(e, `maximum`, t.maximum), $o = (e) => (t, n) => { Xo(t, n.format); let [r, i] = e[n.format]; (Wo(t, `minimum`, r), Go(t, `maximum`, i)); }, es = { greater_than: (e, t) => Wo( e, t.inclusive ? `minimum` : `exclusiveMinimum`, t.value, ), less_than: (e, t) => Go( e, t.inclusive ? `maximum` : `exclusiveMaximum`, t.value, ), multiple_of: (e, t) => qo(e, t.value), number_format: $o(le), bigint_format: $o(ue), min_length: Zo, max_length: Qo, length_equals: (e, t) => Ko(e, t.length), min_size: Zo, max_size: Qo, size_equals: (e, t) => Ko(e, t.size), string_format: (e, t) => { (Xo(e, t.format), t.pattern && Jo(e, t.pattern), (t.format === `base64` || t.format === `base64url`) && (e.contentEncoding = t.format), (t.local || t.precision === -1) && (e.laxFormat = !0)); }, mime_type: (e, t) => Yo(e, t.mime), }; function J(e) { let t = {}, n = e._zod.def, r = e._zod.traits.has(`$ZodCheck`) ? [e, ...(n.checks ?? [])] : (n.checks ?? []); for (let e of r) es[e._zod.def.check]?.(t, e._zod.def); let i = e._zod.bag; (i.minimum !== void 0 && Wo(t, `minimum`, i.minimum), i.exclusiveMinimum !== void 0 && Wo(t, `exclusiveMinimum`, i.exclusiveMinimum), i.maximum !== void 0 && Go(t, `maximum`, i.maximum), i.exclusiveMaximum !== void 0 && Go(t, `exclusiveMaximum`, i.exclusiveMaximum), i.multipleOf !== void 0 && qo(t, i.multipleOf), i.format !== void 0 && ((t.format ??= i.format), i.format.includes(`int`) && (t.isInt = !0)), i.mime && Yo(t, i.mime)); for (let e of i.patterns ?? []) Jo(t, e); return t; } const ts = { guid: `uuid`, url: `uri`, datetime: `date-time`, json_string: `json-string`, regex: ``, }, ns = /* @__PURE__ */ new Map([ [Xn, Pt], [Qn, Ft], ]), rs = (e) => ns.get(e) ?? e, is = (e, t, n, r) => { let i = n; i.type = `string`; let { minimum: a, maximum: o, format: s, patterns: c, contentEncoding: l, laxFormat: u, } = J(e); if ( (typeof a == `number` && (i.minLength = a), typeof o == `number` && (i.maxLength = o), s && ((i.format = ts[s] ?? s), i.format === `` && delete i.format, (s === `time` || u) && delete i.format), l && (i.contentEncoding = l), c && c.size > 0) ) { let e = [...c].map(rs); e.length === 1 ? (i.pattern = e[0].source) : e.length > 1 && (i.allOf = [ ...e.map((e) => ({ ...(t.target === `draft-07` || t.target === `draft-04` || t.target === `openapi-3.0` ? { type: `string` } : {}), pattern: e.source, })), ]); } }, as = (e, t, n, r) => { let i = n, { minimum: a, maximum: o, multipleOf: s, exclusiveMaximum: c, exclusiveMinimum: l, isInt: u, } = J(e); i.type = u ? `integer` : `number`; let d = typeof l == `number` && l >= (a ?? -1 / 0), f = typeof c == `number` && c <= (o ?? 1 / 0), p = t.target === `draft-04` || t.target === `openapi-3.0`; if ( (d ? p ? ((i.minimum = l), (i.exclusiveMinimum = !0)) : (i.exclusiveMinimum = l) : typeof a == `number` && (i.minimum = a), f ? p ? ((i.maximum = c), (i.exclusiveMaximum = !0)) : (i.exclusiveMaximum = c) : typeof o == `number` && (i.maximum = o), s) ) { let n = /* @__PURE__ */ new Set(); for (let a of s) Number.isFinite(a) && a !== 0 ? n.add(Math.abs(a)) : G( e, t, i, r, `A multipleOf divisor of ${a} cannot be represented in JSON Schema`, ); let [a, ...o] = n; (a !== void 0 && (i.multipleOf = a), o.length && (i.allOf = [ ...(i.allOf ?? []), ...o.map((e) => ({ multipleOf: e })), ])); } }, os = (e, t, n, r) => { n.not = {}; }, ss = (e, t, n, r) => { G( e, t, n, r, `Date cannot be represented in JSON Schema`, ); }, cs = (e, n, r, i) => { let a = e._zod.def, o = t(a.entries); if (o.length === 0) { r.not = {}; return; } (o.every((e) => typeof e == `number`) && (r.type = `number`), o.every((e) => typeof e == `string`) && (r.type = `string`), (r.enum = o)); }, ls = (e, t, n, r) => { G( e, t, n, r, `Custom types cannot be represented in JSON Schema`, ); }, us = (e, t, n, r) => { G( e, t, n, r, `Transforms cannot be represented in JSON Schema`, ); }, ds = (e, t, n, r) => { let i = n, a = e._zod.def, { minimum: o, maximum: s } = J(e); (typeof o == `number` && (i.minItems = o), typeof s == `number` && (i.maxItems = s), (i.type = `array`), (i.items = K(a.element, t, { ...r, path: [...r.path, `items`], }))); }; function fs(e) { let t = e._zod.def; return t.type === `pipe` && t.in._zod.traits.has(`$ZodTransform`) ? fs(t.out) : t.type === `catch` ? fs(t.innerType) : e._zod.optin; } const ps = (e, t, n, r) => { let i = n, a = e._zod.def, o = a.shape; if ( Object.getOwnPropertySymbols(o).length && G( e, t, i, r, `Symbol keys cannot be represented in JSON Schema`, ) ) return; ((i.type = `object`), (i.properties = {})); for (let e in o) l( i.properties, e, K(o[e], t, { ...r, path: [...r.path, `properties`, e], }), ); let s = []; for (let e of Object.keys(o)) { let n = a.shape[e]; (t.io === `input` ? fs(n) === void 0 : n._zod.optout === void 0) && s.push(e); } (s.length > 0 && (i.required = s), a.catchall?._zod.def.type === `never` ? (i.additionalProperties = !1) : a.catchall ? a.catchall && (i.additionalProperties = K(a.catchall, t, { ...r, path: [...r.path, `additionalProperties`], })) : t.io === `output` && (i.additionalProperties = !1)); }, ms = (e, t, n, r) => { let i = e._zod.def, a = i.inclusive === !1, o = i.options.map((e, n) => K(e, t, { ...r, path: [...r.path, a ? `oneOf` : `anyOf`, n], }), ); a ? (n.oneOf = o) : (n.anyOf = o); }, hs = (e, t, n, r) => { let i = e._zod.def, a = K(i.left, t, { ...r, path: [...r.path, `allOf`, 0], }), o = K(i.right, t, { ...r, path: [...r.path, `allOf`, 1], }), s = (e) => `allOf` in e && Object.keys(e).length === 1, c = [ ...(s(a) ? a.allOf : [a]), ...(s(o) ? o.allOf : [o]), ]; ((n.allOf = c), t.intersections.push(c)); }, gs = (e, t, n, r) => { let i = e._zod.def, a = K(i.innerType, t, r), o = t.seen.get(e); t.target === `openapi-3.0` ? ((o.ref = i.innerType), (n.nullable = !0)) : (n.anyOf = [a, { type: `null` }]); }, _s = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; }, vs = Symbol(); function ys(e, t, n, r, i) { let a = !1, o = JSON.stringify(e, (e, t) => typeof t == `bigint` ? ((a = !0), null) : t, ); return a ? (G( t, n, r, i, `BigInt defaults cannot be represented in JSON Schema`, ), vs) : JSON.parse(o); } const bs = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; let o = ys(i.defaultValue, e, t, n, r); o !== vs && (n.default = o); }, xs = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); if (((a.ref = i.innerType), t.io !== `input`)) return; let o = ys(i.defaultValue, e, t, n, r); o !== vs && (n._prefault = o); }, Ss = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; let o; try { o = i.catchValue(void 0); } catch { G( e, t, n, r, `Dynamic catch values are not supported in JSON Schema`, ); return; } n.default = o; }, Cs = (e, t, n, r) => { let i = e._zod.def, a = i.in._zod.traits.has(`$ZodTransform`), o = t.io === `input` ? (a ? i.out : i.in) : i.out; K(o, t, r); let s = t.seen.get(e); s.ref = o; }, ws = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); ((a.ref = i.innerType), (n.readOnly = !0)); }, Ts = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; }, Es = /* @__PURE__ */ new WeakSet([ Object.prototype, Error.prototype, ]); function Ds(e, t, n) { Object.defineProperty(e, t, { configurable: !0, enumerable: !1, get() { let e = n(this); return ( Object.defineProperty(this, t, { value: e, configurable: !0, writable: !0, }), e ); }, set(e) { Object.defineProperty(this, t, { value: e, configurable: !0, writable: !0, }); }, }); } const Y = /*@__PURE__*/ E( `ZodError`, (e, t) => { (Ye.init(e, t), (e.name = `ZodError`)); let n = Object.getPrototypeOf(e); Es.has(n) || (Es.add(n), Ds(n, `format`, (e) => (t) => Qe(e, t)), Ds(n, `flatten`, (e) => (t) => Ze(e, t)), Ds(n, `addIssue`, (e) => (t) => { (e.issues.push(t), (e.message = JSON.stringify(e.issues, r, 2))); }), Ds(n, `addIssues`, (e) => (t) => { (e.issues.push(...t), (e.message = JSON.stringify(e.issues, r, 2))); }), Object.defineProperty(n, "isEmpty", { configurable: !0, enumerable: !1, get() { return this.issues.length === 0; }, })); }, void 0, { Parent: Error }, ), Os = /* @__PURE__ */ et(Y), ks = /* @__PURE__ */ tt(Y), As = /* @__PURE__ */ nt(Y), js = /* @__PURE__ */ it(Y), Ms = /* @__PURE__ */ ut(Y), Ns = /* @__PURE__ */ dt(Y), Ps = /* @__PURE__ */ ft(Y), Fs = /* @__PURE__ */ pt(Y), Is = /* @__PURE__ */ mt(Y), Ls = /* @__PURE__ */ ht(Y), Rs = /* @__PURE__ */ gt(Y), zs = /* @__PURE__ */ _t(Y); function Bs() { O.localeError || k(ci()); } function Vs() { O.memoizer || k({ memoizer: ai() }); } const X = /*@__PURE__*/ E( `ZodType`, (e, t) => ( Bs(), j.init(e, t), (e.def = t), (e.type = t.type), e ), { check(...e) { let t = this.def; return this.clone( g(t, { checks: [ ...(t.checks ?? []), ...e.map((e) => typeof e == `function` ? { _zod: { check: e, def: { check: `custom` }, onattach: [], }, } : e, ), ], }), { parent: !0 }, ); }, with(...e) { return this.check(...e); }, clone(e, t) { return y(this, e, t); }, brand() { return this; }, register(e, t) { return (e.add(this, t), this); }, refine(e, t) { return this.check(el(e, t)); }, superRefine(e, t) { return this.check(tl(e, t)); }, overwrite(e) { return this.check(/* @__PURE__ */ xo(e)); }, optional() { return Ic(this); }, exactOptional() { return Rc(this); }, nullable() { return Bc(this); }, nullish() { return Ic(Bc(this)); }, nonoptional(e) { return Kc(this, e); }, array() { return wc(this); }, or(e) { return Oc([this, e]); }, and(e) { return Ac(this, e); }, transform(e) { return Xc(this, Pc(e)); }, default(e) { return Hc(this, e); }, prefault(e) { return Wc(this, e); }, catch(e) { return Jc(this, e); }, pipe(e) { return Xc(this, e); }, readonly() { return Qc(this); }, describe(e) { let t = this.clone(); return (fi.add(t, { description: e }), t); }, meta(...e) { if (e.length === 0) return fi.get(this); let t = this.clone(); return (fi.add(t, e[0]), t); }, isOptional() { return this.safeParse(void 0).success; }, isNullable() { return this.safeParse(null).success; }, apply(e, ...t) { return t.length === 0 ? e(this) : e(this, ...t); }, get "~standard"() { return Ae(this, `~standard`, { ...vn(this), jsonSchema: { input: Uo(this, `input`), output: Uo(this, `output`), }, }); }, set "~standard"(e) { C(this, `~standard`, e); }, parse: function e(t, n) { return Os(this, t, n, { callee: e }); }, parseAsync: async function e(t, n) { return await ks(this, t, n, { callee: e }); }, safeParse(e, t) { return As(this, e, t); }, async safeParseAsync(e, t) { return js(this, e, t); }, get spa() { return this?.safeParseAsync; }, set spa(e) { C(this, `spa`, e); }, validate(e, t) { return st(this, e, t); }, validateAsync(e, t) { return lt(this, e, t); }, encode: function e(t, n) { return Ms(this, t, n, { callee: e }); }, decode: function e(t, n) { return Ns(this, t, n, { callee: e }); }, encodeAsync: async function e(t, n) { return await Ps(this, t, n, { callee: e }); }, decodeAsync: async function e(t, n) { return await Fs(this, t, n, { callee: e }); }, safeEncode(e, t) { return Is(this, e, t); }, safeDecode(e, t) { return Ls(this, e, t); }, async safeEncodeAsync(e, t) { return Rs(this, e, t); }, async safeDecodeAsync(e, t) { return zs(this, e, t); }, toJSONSchema(e) { return Ho(this, {})(e); }, get description() { return fi.get(this)?.description; }, get _def() { return this._zod.def; }, }, ), Hs = /*@__PURE__*/ E( `_ZodString`, (e, t) => { (yn.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => is(e, t, n, r))); }, /*@__PURE__*/ je( { format: (e) => J(e).format ?? null, minLength: (e) => J(e).minimum ?? null, maxLength: (e) => J(e).maximum ?? null, }, { regex(...e) { return this.check(/* @__PURE__ */ ho(...e)); }, includes(...e) { return this.check(/* @__PURE__ */ vo(...e)); }, startsWith(...e) { return this.check(/* @__PURE__ */ yo(...e)); }, endsWith(...e) { return this.check(/* @__PURE__ */ bo(...e)); }, min(...e) { return this.check(/* @__PURE__ */ po(...e)); }, max(...e) { return this.check(/* @__PURE__ */ fo(...e)); }, length(...e) { return this.check(/* @__PURE__ */ mo(...e)); }, nonempty(...e) { return this.check(/* @__PURE__ */ po(1, ...e)); }, lowercase(e) { return this.check(/* @__PURE__ */ go(e)); }, uppercase(e) { return this.check(/* @__PURE__ */ _o(e)); }, trim() { return this.check(/* @__PURE__ */ Co()); }, normalize(...e) { return this.check(/* @__PURE__ */ So(...e)); }, toLowerCase() { return this.check(/* @__PURE__ */ wo()); }, toUpperCase() { return this.check(/* @__PURE__ */ To()); }, slugify() { return this.check(/* @__PURE__ */ Eo()); }, }, ), ), Us = /*@__PURE__*/ E( `ZodString`, (e, t) => { (yn.init(e, t), Hs.init(e, t)); }, { email(e) { return this.check(/* @__PURE__ */ ka(Js, e)); }, url(e) { return this.check(/* @__PURE__ */ Fa(Zs, e)); }, jwt(e) { return this.check(/* @__PURE__ */ Xa(pc, e)); }, emoji(e) { return this.check(/* @__PURE__ */ Ia($s, e)); }, guid(e) { return this.check(/* @__PURE__ */ Aa(Ys, e)); }, uuid(e) { return this.check(/* @__PURE__ */ ja(Xs, e)); }, uuidv4(e) { return this.check(/* @__PURE__ */ Ma(Xs, e)); }, uuidv6(e) { return this.check(/* @__PURE__ */ Na(Xs, e)); }, uuidv7(e) { return this.check(/* @__PURE__ */ Pa(Xs, e)); }, nanoid(e) { return this.check(/* @__PURE__ */ La(ec, e)); }, cuid(e) { return this.check(/* @__PURE__ */ Ra(tc, e)); }, cuid2(e) { return this.check(/* @__PURE__ */ za(nc, e)); }, ulid(e) { return this.check(/* @__PURE__ */ Ba(rc, e)); }, base64(e) { return this.check(/* @__PURE__ */ qa(uc, e)); }, base64url(e) { return this.check(/* @__PURE__ */ Ja(dc, e)); }, xid(e) { return this.check(/* @__PURE__ */ Va(ic, e)); }, ksuid(e) { return this.check(/* @__PURE__ */ Ha(ac, e)); }, ipv4(e) { return this.check(/* @__PURE__ */ Ua(oc, e)); }, ipv6(e) { return this.check(/* @__PURE__ */ Wa(sc, e)); }, cidrv4(e) { return this.check(/* @__PURE__ */ Ga(cc, e)); }, cidrv6(e) { return this.check(/* @__PURE__ */ Ka(lc, e)); }, e164(e) { return this.check(/* @__PURE__ */ Ya(fc, e)); }, datetime(e) { return this.check(/* @__PURE__ */ Za(Ws, e)); }, date(e) { return this.check(/* @__PURE__ */ Qa(Gs, e)); }, time(e) { return this.check(/* @__PURE__ */ $a(Ks, e)); }, duration(e) { return this.check(/* @__PURE__ */ eo(qs, e)); }, }, ); function Z(e) { return /* @__PURE__ */ Oa(Us, e); } const Q = /*@__PURE__*/ E(`ZodStringFormat`, (e, t) => { (M.init(e, t), Hs.init(e, t)); }), Ws = /*@__PURE__*/ E(`ZodISODateTime`, (e, t) => { (Rn.init(e, t), Q.init(e, t)); }), Gs = /*@__PURE__*/ E(`ZodISODate`, (e, t) => { (zn.init(e, t), Q.init(e, t)); }), Ks = /*@__PURE__*/ E(`ZodISOTime`, (e, t) => { (Bn.init(e, t), Q.init(e, t)); }), qs = /*@__PURE__*/ E(`ZodISODuration`, (e, t) => { (Vn.init(e, t), Q.init(e, t)); }), Js = /*@__PURE__*/ E(`ZodEmail`, (e, t) => { (Sn.init(e, t), Q.init(e, t)); }), Ys = /*@__PURE__*/ E(`ZodGUID`, (e, t) => { (bn.init(e, t), Q.init(e, t)); }), Xs = /*@__PURE__*/ E(`ZodUUID`, (e, t) => { (xn.init(e, t), Q.init(e, t)); }), Zs = /*@__PURE__*/ E(`ZodURL`, (e, t) => { (An.init(e, t), Q.init(e, t)); }); function Qs(e) { return /* @__PURE__ */ Fa(Zs, e); } const $s = /*@__PURE__*/ E(`ZodEmoji`, (e, t) => { (jn.init(e, t), Q.init(e, t)); }), ec = /*@__PURE__*/ E(`ZodNanoID`, (e, t) => { (Mn.init(e, t), Q.init(e, t)); }), tc = /*@__PURE__*/ E(`ZodCUID`, (e, t) => { (Nn.init(e, t), Q.init(e, t)); }), nc = /*@__PURE__*/ E(`ZodCUID2`, (e, t) => { (Pn.init(e, t), Q.init(e, t)); }), rc = /*@__PURE__*/ E(`ZodULID`, (e, t) => { (Fn.init(e, t), Q.init(e, t)); }), ic = /*@__PURE__*/ E(`ZodXID`, (e, t) => { (In.init(e, t), Q.init(e, t)); }), ac = /*@__PURE__*/ E(`ZodKSUID`, (e, t) => { (Ln.init(e, t), Q.init(e, t)); }), oc = /*@__PURE__*/ E(`ZodIPv4`, (e, t) => { (Hn.init(e, t), Q.init(e, t)); }), sc = /*@__PURE__*/ E(`ZodIPv6`, (e, t) => { (Gn.init(e, t), Q.init(e, t)); }), cc = /*@__PURE__*/ E(`ZodCIDRv4`, (e, t) => { (Kn.init(e, t), Q.init(e, t)); }), lc = /*@__PURE__*/ E(`ZodCIDRv6`, (e, t) => { (Jn.init(e, t), Q.init(e, t)); }), uc = /*@__PURE__*/ E(`ZodBase64`, (e, t) => { (Zn.init(e, t), Q.init(e, t)); }), dc = /*@__PURE__*/ E(`ZodBase64URL`, (e, t) => { (er.init(e, t), Q.init(e, t)); }), fc = /*@__PURE__*/ E(`ZodE164`, (e, t) => { (tr.init(e, t), Q.init(e, t)); }), pc = /*@__PURE__*/ E(`ZodJWT`, (e, t) => { (cr.init(e, t), Q.init(e, t)); }), mc = /*@__PURE__*/ E( `ZodNumber`, (e, t) => { (lr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => as(e, t, n, r)), (e.isFinite = !0)); }, /*@__PURE__*/ je( { minValue: (e) => { let { minimum: t, exclusiveMinimum: n } = J(e); return Math.max(t ?? -1 / 0, n ?? -1 / 0); }, maxValue: (e) => { let { maximum: t, exclusiveMaximum: n } = J(e); return Math.min(t ?? 1 / 0, n ?? 1 / 0); }, isInt: (e) => { let { isInt: t, multipleOf: n } = J(e); return !!t || !!n?.some(Number.isSafeInteger); }, format: (e) => J(e).format ?? null, }, { gt(e, t) { return this.check(/* @__PURE__ */ co(e, t)); }, gte(e, t) { return this.check(/* @__PURE__ */ lo(e, t)); }, min(e, t) { return this.check(/* @__PURE__ */ lo(e, t)); }, lt(e, t) { return this.check(/* @__PURE__ */ oo(e, t)); }, lte(e, t) { return this.check(/* @__PURE__ */ so(e, t)); }, max(e, t) { return this.check(/* @__PURE__ */ so(e, t)); }, int(e) { return this.check(gc(e)); }, safe(e) { return this.check(gc(e)); }, positive(e) { return this.check(/* @__PURE__ */ co(0, e)); }, nonnegative(e) { return this.check(/* @__PURE__ */ lo(0, e)); }, negative(e) { return this.check(/* @__PURE__ */ oo(0, e)); }, nonpositive(e) { return this.check(/* @__PURE__ */ so(0, e)); }, multipleOf(e, t) { return this.check(/* @__PURE__ */ uo(e, t)); }, step(e, t) { return this.check(/* @__PURE__ */ uo(e, t)); }, finite() { return this; }, }, ), ); function $(e) { return /* @__PURE__ */ to(mc, e); } const hc = /*@__PURE__*/ E(`ZodNumberFormat`, (e, t) => { (ur.init(e, t), mc.init(e, t)); }); function gc(e) { return /* @__PURE__ */ no(hc, e); } const _c = /*@__PURE__*/ E(`ZodUnknown`, (e, t) => { (dr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (e, t, n) => void 0)); }); function vc() { return /* @__PURE__ */ ro(_c); } const yc = /*@__PURE__*/ E(`ZodNever`, (e, t) => { (fr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => os(e, t, n, r))); }); function bc(e) { return /* @__PURE__ */ io(yc, e); } const xc = /*@__PURE__*/ E( `ZodDate`, (e, t) => { (pr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ss(e, t, n, r)), (e.min = (t, n) => e.check(/* @__PURE__ */ lo(t, n))), (e.max = (t, n) => e.check(/* @__PURE__ */ so(t, n)))); }, /*@__PURE__*/ je( { minDate: (e) => { let { minimum: t } = J(e); return t ? new Date(t) : null; }, maxDate: (e) => { let { maximum: t } = J(e); return t ? new Date(t) : null; }, }, {}, ), ); function Sc(e) { return /* @__PURE__ */ ao(xc, e); } const Cc = /*@__PURE__*/ E( `ZodArray`, (e, t) => { (Vs(), hr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ds(e, t, n, r)), (e.element = t.element)); }, { min(e, t) { return this.check(/* @__PURE__ */ po(e, t)); }, nonempty(e) { return this.check(/* @__PURE__ */ po(1, e)); }, max(e, t) { return this.check(/* @__PURE__ */ fo(e, t)); }, length(e, t) { return this.check(/* @__PURE__ */ mo(e, t)); }, unwrap() { return this.element; }, }, ); function wc(e, t) { return /* @__PURE__ */ Do(Cc, e, t); } const Tc = /*@__PURE__*/ E( `ZodObject`, (e, t) => { (Vs(), xr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ps(e, t, n, r)), Ie(e, `shape`, (e) => e._zod.def.shape, !1)); }, { keyof() { return Mc(Object.keys(this._zod.def.shape)); }, catchall(e) { return this.clone(g(this._zod.def, { catchall: e })); }, passthrough() { return this.clone( g(this._zod.def, { catchall: vc() }), ); }, loose() { return this.clone( g(this._zod.def, { catchall: vc() }), ); }, strict() { return this.clone( g(this._zod.def, { catchall: bc() }), ); }, strip() { return this.clone( g(this._zod.def, { catchall: void 0 }), ); }, extend(e) { return me(this, e); }, safeExtend(e) { return ge(this, e); }, merge(e) { return _e(this, e); }, pick(e) { return de(this, e); }, omit(e) { return pe(this, e); }, partial(...e) { return ve(Fc, this, e[0]); }, exactPartial(...e) { return ve(Lc, this, e[0], `exactPartial`); }, required(...e) { return ye(Gc, this, e[0]); }, }, ); function Ec(e, t) { let n = { type: `object`, shape: e ?? {}, ...b(t) }; return new Tc(n); } const Dc = /*@__PURE__*/ E(`ZodUnion`, (e, t) => { (Cr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ms(e, t, n, r)), (e.options = t.options)); }); function Oc(e, t) { return new Dc({ type: `union`, options: e, ...b(t) }); } const kc = /*@__PURE__*/ E(`ZodIntersection`, (e, t) => { (wr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => hs(e, t, n, r))); }); function Ac(e, t) { return new kc({ type: `intersection`, left: e, right: t, }); } const jc = /*@__PURE__*/ E(`ZodEnum`, (e, t) => { (Dr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => cs(e, t, n, r)), (e.enum = t.entries), (e.options = [...e._zod.values])); let n = new Set(Object.keys(t.entries)); ((e.extract = (e, r) => { let i = {}; for (let r of e) if (n.has(r)) i[r] = t.entries[r]; else throw Error(`Key ${r} not found in enum`); return new jc({ ...t, checks: [], ...b(r), entries: i, }); }), (e.exclude = (e, r) => { let i = { ...t.entries }; for (let t of e) if (n.has(t)) delete i[t]; else throw Error(`Key ${t} not found in enum`); return new jc({ ...t, checks: [], ...b(r), entries: i, }); })); }); function Mc(e, t) { let n = Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e; return new jc({ type: `enum`, entries: n, ...b(t) }); } const Nc = /*@__PURE__*/ E(`ZodTransform`, (e, t) => { (Vs(), Or.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => us(e, t, n, r)), (e._zod.parse = (n, r) => { if (r.direction === `backward`) throw new He(e.constructor.name); n.addIssue = (r) => { if (typeof r == `string`) n.issues.push(Oe(r, n.value, t)); else { let t = r; (t.fatal && (t.continue = !1), (t.code ??= `custom`), `input` in t || (t.input = n.value), (t.inst ??= e), n.issues.push(Oe(t))); } }; let i = t.transform(n.value, n); return i instanceof Promise ? i.then((e) => ((n.value = e), n)) : ((n.value = i), n); })); }); function Pc(e) { return new Nc({ type: `transform`, transform: e }); } const Fc = /*@__PURE__*/ E(`ZodOptional`, (e, t) => { (Ar.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ts(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Ic(e) { return new Fc({ type: `optional`, innerType: e }); } const Lc = /*@__PURE__*/ E(`ZodExactOptional`, (e, t) => { (jr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ts(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Rc(e) { return new Lc({ type: `optional`, innerType: e }); } const zc = /*@__PURE__*/ E(`ZodNullable`, (e, t) => { (Mr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => gs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Bc(e) { return new zc({ type: `nullable`, innerType: e }); } const Vc = /*@__PURE__*/ E(`ZodDefault`, (e, t) => { (Nr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => bs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType), (e.removeDefault = e.unwrap)); }); function Hc(e, t) { return new Vc({ type: `default`, innerType: e, get defaultValue() { return typeof t == `function` ? t() : ie(t); }, }); } const Uc = /*@__PURE__*/ E(`ZodPrefault`, (e, t) => { (Fr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => xs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Wc(e, t) { return new Uc({ type: `prefault`, innerType: e, get defaultValue() { return typeof t == `function` ? t() : ie(t); }, }); } const Gc = /*@__PURE__*/ E(`ZodNonOptional`, (e, t) => { (Ir.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => _s(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Kc(e, t) { return new Gc({ type: `nonoptional`, innerType: e, ...b(t), }); } const qc = /*@__PURE__*/ E(`ZodCatch`, (e, t) => { (zr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ss(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType), (e.removeCatch = e.unwrap)); }); function Jc(e, t) { return new qc({ type: `catch`, innerType: e, catchValue: typeof t == `function` ? t : Le(t), }); } const Yc = /*@__PURE__*/ E(`ZodPipe`, (e, t) => { (Br.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Cs(e, t, n, r)), (e.in = t.in), (e.out = t.out)); }); function Xc(e, t) { return new Yc({ type: `pipe`, in: e, out: t }); } const Zc = /*@__PURE__*/ E(`ZodReadonly`, (e, t) => { (Hr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ws(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Qc(e) { return new Zc({ type: `readonly`, innerType: e }); } const $c = /*@__PURE__*/ E(`ZodCustom`, (e, t) => { (Wr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ls(e, t, n, r))); }); function el(e, t = {}) { return /* @__PURE__ */ Oo($c, e, t); } function tl(e, t) { return /* @__PURE__ */ ko(e, t); } const nl = Ec({ id: $(), created: Sc(), title: Z().min(1).max(100), type: Mc([`jpg`, `png`]), size: $(), url: Qs(), }), rl = Ec({ id: $(), stars: $().min(1).max(5), title: Z().min(1).max(100), text: Z().min(1).max(1e3), images: wc(nl), }); hi( e()( Ec({ id: $(), created: Sc(), title: Z().min(1).max(100), brand: Z().min(1).max(30), description: Z().min(1).max(500), price: $().min(1).max(1e4), discount: $().min(1).max(100).nullable(), quantity: $().min(0).max(10), tags: wc(Z().min(1).max(30)), images: wc(nl), ratings: wc(rl), }), ), { strict: !0 }, ).parse({});
function e() { return (e) => e; } function t(e) { let t = Object.values(e).filter((e) => typeof e == `number`); return Object.entries(e) .filter(([e, n]) => t.indexOf(+e) === -1) .map(([e, t]) => t); } function n(e, t = `|`) { return e.map((e) => se(e)).join(t); } function r(e, t) { return typeof t == `bigint` ? t.toString() : t; } var i = class { constructor(e) { ((this._getter = e), (this._value = void 0)); } get value() { let e = this._getter; return ( e !== void 0 && ((this._value = e()), (this._getter = void 0)), this._value ); } }; function a(e) { return new i(e); } function o(e) { return e == null; } function s(e) { let t = +!!e.startsWith(`^`), n = e.endsWith(`$`) ? e.length - 1 : e.length; return e.slice(t, n); } function c(e, t) { let n = e / t, r = Math.round(n), i = 4 * 2 ** -52 * Math.max(Math.abs(n), 1); return Math.abs(n - r) < i ? 0 : n - r; } function l(e, t, n) { Object.defineProperty(e, t, { value: n, writable: !0, enumerable: !0, configurable: !0, }); } function u(e) { let t = Object.getOwnPropertyDescriptor(e, `shape`); return t?.get ? t.get.raw : t?.value; } function d(e) { return u(e._zod.def) ?? e._zod.def.shape; } function f(e, t, n) { Object.defineProperty(e, t, { get() { let e = n(); return (l(this, t, e), e); }, enumerable: !0, configurable: !0, }); } function p(e, t, n) { t in e ? l(e, t, n) : (e[t] = n); } function m(e, t, n, r) { let i = d(t); for (let a of n) { let n = Object.getOwnPropertyDescriptor(i, a); n.enumerable && (n.get ? f(e, a, () => { let e = t._zod.def.shape[a]; return r ? r(e, a) : e; }) : p(e, a, r ? r(n.value, a) : n.value)); } } function h(e, t) { for (let n of Reflect.ownKeys(t)) { let r = Object.getOwnPropertyDescriptor(t, n); r.enumerable && (r.get ? f(e, n, () => t[n]) : p(e, n, r.value)); } } function g(...e) { let t = {}; for (let n of e) { let e = Object.getOwnPropertyDescriptors(n); Object.assign(t, e); } return Object.defineProperties({}, t); } function _(e) { return JSON.stringify(e); } function ee(e) { return e .toLowerCase() .trim() .replace(/[^\w\s-]/g, ``) .replace(/[\s_-]+/g, `-`) .replace(/^-+|-+$/g, ``); } const te = `captureStackTrace` in Error ? Error.captureStackTrace : (...e) => {}; function ne(e) { return typeof e == `object` && !!e && !Array.isArray(e); } const re = /* @__PURE__*/ a(() => { if ( O.jitless || (typeof navigator < `u` && navigator?.userAgent?.includes(`Cloudflare`)) ) return !1; try { return (Function(``), !0); } catch { return !1; } }); function v(e) { if (ne(e) === !1) return !1; let t = e.constructor; if (t === void 0 || typeof t != `function`) return !0; let n = t.prototype; return ( ne(n) !== !1 && Object.prototype.hasOwnProperty.call(n, `isPrototypeOf`) !== !1 ); } function ie(e) { return v(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e; } const ae = /* @__PURE__*/ new Set([`string`, `number`, `symbol`]); function oe(e) { return e.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`); } function y(e, t, n) { let r = new e._zod.constr(t ?? e._zod.def); return ((!t || n?.parent) && (r._zod.parent = e), r); } function b(e) { let t = e; if (!t) return {}; if (typeof t == `string`) return { error: () => t }; if (t?.message !== void 0) { if (t?.error !== void 0) throw Error("Cannot specify both `message` and `error` params"); t.error = t.message; } return ( delete t.message, typeof t.error == `string` ? { ...t, error: () => t.error } : t ); } function se(e) { return typeof e == `bigint` ? e.toString() + `n` : typeof e == `string` ? `"${e}"` : `${e}`; } function ce(e) { return Object.keys(e).filter( (t) => e[t]._zod.optin !== void 0 && e[t]._zod.optout === `optional`, ); } const le = { safeint: [-(2 ** 53 - 1), 2 ** 53 - 1], int32: [-2147483648, 2147483647], uint32: [0, 4294967295], float32: [-34028234663852886e22, 34028234663852886e22], float64: [-Number.MAX_VALUE, Number.MAX_VALUE], }, ue = { int64: [ /* @__PURE__*/ BigInt(`-9223372036854775808`), /* @__PURE__*/ BigInt(`9223372036854775807`), ], uint64: [ /* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt(`18446744073709551615`), ], }; function de(e, t) { let n = e._zod.def, r = n.checks; if (r && r.length > 0) throw Error( `.pick() cannot be used on object schemas containing refinements`, ); let i = {}; return (m(i, e, fe(e, t)), y(e, g(n, { shape: i, checks: [] }))); } function fe(e, t) { let n = d(e), r = []; for (let e of Reflect.ownKeys(t)) { if (!Object.getOwnPropertyDescriptor(n, e)?.enumerable) throw Error(`Unrecognized key: "${String(e)}"`); t[e] && r.push(e); } return r; } function pe(e, t) { let n = e._zod.def, r = n.checks; if (r && r.length > 0) throw Error( `.omit() cannot be used on object schemas containing refinements`, ); let i = new Set(fe(e, t)), a = {}; return ( m( a, e, Reflect.ownKeys(d(e)).filter((e) => !i.has(e)), ), y(e, g(n, { shape: a, checks: [] })) ); } function me(e, t) { if (!v(t)) throw Error(`Invalid input to extend: expected a plain object`); let n = e._zod.def.checks; if (n && n.length > 0) { let n = d(e); for (let e of Reflect.ownKeys(t)) if (Object.getOwnPropertyDescriptor(n, e) !== void 0) throw Error( "Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.", ); } return y(e, g(e._zod.def, { shape: he(e, t) })); } function he(e, t) { let n = {}; return (m(n, e, Reflect.ownKeys(d(e))), h(n, t), n); } function ge(e, t) { if (!v(t)) throw Error(`Invalid input to safeExtend: expected a plain object`); return y(e, g(e._zod.def, { shape: he(e, t) })); } function _e(e, t) { if (!t?._zod?.def) throw Error( "Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.", ); if (e._zod.def.checks?.length) throw Error( `.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`, ); let n = {}; return ( m(n, e, Reflect.ownKeys(d(e))), m(n, t, Reflect.ownKeys(d(t))), y( e, g(e._zod.def, { shape: n, get catchall() { return t._zod.def.catchall; }, checks: t._zod.def.checks ?? [], }), ) ); } function ve(e, t, n, r = `partial`) { let i = t._zod.def.checks; if (i && i.length > 0) throw Error( `.${r}() cannot be used on object schemas containing refinements`, ); let a = n ? new Set(fe(t, n)) : void 0, o = {}; return ( m( o, t, Reflect.ownKeys(d(t)), e && ((t, n) => a && !a.has(n) ? t : new e({ type: `optional`, innerType: t })), ), y(t, g(t._zod.def, { shape: o, checks: [] })) ); } function ye(e, t, n) { let r = n ? new Set(fe(t, n)) : void 0, i = {}; return ( m(i, t, Reflect.ownKeys(d(t)), (t, n) => r && !r.has(n) ? t : new e({ type: `nonoptional`, innerType: t }), ), y(t, g(t._zod.def, { shape: i })) ); } function x(e, t = 0) { if (e.aborted === !0) return !0; for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0; return !1; } function be(e, t = 0) { if (e.aborted === !0) return !0; for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue === !1) return !0; return !1; } function xe(e, t) { return t.map((t) => { var n; return ((n = t).path ?? (n.path = []), t.path.unshift(e), t); }); } function Se(e) { return typeof e == `string` ? e : e?.message; } function Ce(e, t, n) { var r; for (let i = t; i < e.length; i++) (r = e[i]).schema ?? (r.schema = n); } function S(e, t, n) { var r; let i = e.inst?._zod?.traits; i?.has(`$ZodType`) && (i.has(`$ZodCheck`) ? ((r = e).schema ?? (r.schema = e.inst)) : (e.schema = e.inst)); let a = e.schema === e.inst ? void 0 : e.schema?._zod.def?.error, o = e.message ? e.message : (Se(e.inst?._zod.def?.error?.(e)) ?? Se(a?.(e)) ?? Se(t?.error?.(e)) ?? Se(n.customError?.(e)) ?? Se(n.localeError?.(e)) ?? `Invalid input`), s = {}; for (let t of Object.keys(e)) t !== `inst` && t !== `schema` && t !== `continue` && t !== `input` && t !== `__proto__` && (s[t] = e[t]); return ( (s.path ??= []), (s.message = o), t?.reportInput && (s.input = e.input), s ); } const we = /[\uD800-\uDBFF]/; function Te(e) { let t = e.length; if (!we.test(e)) return t; let n = t; for (let r = 0; r < t - 1; r++) (e.charCodeAt(r) & 64512) == 55296 && (e.charCodeAt(r + 1) & 64512) == 56320 && (n--, r++); return n; } function Ee(e) { return Array.isArray(e) ? `array` : typeof e == `string` ? `string` : `unknown`; } function De(e) { let t = typeof e; switch (t) { case `number`: return Number.isNaN(e) ? `nan` : `number`; case `object`: { if (e === null) return `null`; if (Array.isArray(e)) return `array`; let t = e; if ( t && Object.getPrototypeOf(t) !== Object.prototype && `constructor` in t && t.constructor ) return t.constructor.name; } } return t; } function Oe(...e) { let [t, n, r] = e; return typeof t == `string` ? { message: t, code: `custom`, input: n, inst: r } : { ...t }; } function ke(e, t) { for (let n in t) { let r = Object.getOwnPropertyDescriptor(t, n); r.get ? Object.defineProperty(e, n, { ...r, enumerable: !1 }) : Me(e, n, r.value); } } function C(e, t, n, r = !0) { return ( Object.defineProperty(e, t, { configurable: !0, writable: !0, enumerable: r, value: n, }), n ); } function Ae(e, t, n) { return C(e, t, n, !1); } function je(e, t) { for (let n in e) { let r = e[n]; Object.defineProperty(t, n, { configurable: !0, enumerable: !0, get() { return C(this, n, r(this)); }, set(e) { C(this, n, e); }, }); } return t; } function Me(e, t, n) { Object.defineProperty(e, t, { configurable: !0, get() { return this == null ? n : C(this, t, n.bind(this)); }, set(e) { C(this, t, e); }, }); } function Ne(e, t) { let n = Object.getPrototypeOf(e); return t in n ? void 0 : n; } let Pe, w = !1; const Fe = { configurable: !0, get() { w = !0; }, }; function T(e, t, n) { let r = Object.getPrototypeOf(e._zod); if (t in r && Pe !== e._zod) { Pe = void 0; return; } ((Pe = e._zod), Object.defineProperty(r, t, { configurable: !0, get() { Object.defineProperty(this, t, Fe); let e = w; w = !1; try { let r = n(this); return ( w ? delete this[t] : Object.defineProperty(this, t, { configurable: !0, writable: !0, value: r, }), (w ||= e), r ); } catch (n) { throw (delete this[t], (w ||= e), n); } }, set(e) { Object.defineProperty(this, t, { configurable: !0, writable: !0, value: e, }); }, })); } function Ie(e, t, n, r) { let i = Ne(e, t); i && Object.defineProperty(i, t, { configurable: !0, get() { let e = { configurable: !0, writable: !0, enumerable: r, value: void 0, }; return ( Object.defineProperty(this, t, e), (e.value = n(this)), Object.defineProperty(this, t, e), e.value ); }, set(e) { Object.defineProperty(this, t, { configurable: !0, writable: !0, enumerable: r, value: e, }); }, }); } function Le(e) { let t = () => e; return ((t[`~constantCatch`] = !0), t); } var Re; const ze = { value: void 0, enumerable: !1 }; let Be = `captureStackTrace` in Error ? Error : null; function Ve(e) { let t = Be; if (t) { let n = t.stackTraceLimit; if (typeof n == `number`) { try { t.stackTraceLimit = 0; } catch { return ((Be = null), new e()); } try { return new e(); } finally { t.stackTraceLimit = n; } } } return new e(); } function E(e, t, n, r) { let i = {}; function a(e) { ((this.def = e), (this.constr = d), (this.traits = /* @__PURE__ */ new Set())); } a.prototype = i; let o = n, s = o && /* @__PURE__ */ new WeakSet(); function c(n, r) { if (!n._zod) { ze.value = new a(r); try { Object.defineProperty(n, "_zod", ze); } finally { ze.value = void 0; } } else if (n._zod.traits.has(e)) return; if ((n._zod.traits.add(e), t(n, r), s)) { let e = Object.getPrototypeOf(n), t = n._zod.constr.prototype, r = e; for (; r && r !== t;) r = Object.getPrototypeOf(r); let i = r ?? e; s.has(i) || (s.add(i), ke(i, o)); } let i = d.prototype; for (let e in i) Object.prototype.hasOwnProperty.call(i, e) && (e in n || (n[e] = i[e].bind(n))); } let l = r?.Parent ?? Object; class u extends l {} Object.defineProperty(u, "name", { value: e }); function d(e) { let t = r?.Parent ? Ve(u) : this; c(t, e); let n = t._zod.deferred; if (n) { for (let e of n) e(); t._zod.deferred = void 0; } let i = globalThis.__zod_globalConfig?.postProcessor; return (i && i(t), t); } return ( Object.defineProperty(d, "init", { value: c }), Object.defineProperty(d, Symbol.hasInstance, { value: (t) => r?.Parent && t instanceof r.Parent ? !0 : t?._zod?.traits?.has(e), }), Object.defineProperty(d, "name", { value: e }), d ); } var D = class extends Error { constructor() { super( `Encountered Promise during synchronous parse. Use .parseAsync() instead.`, ); } }, He = class extends Error { constructor(e) { (super(`Encountered unidirectional transform during encode: ${e}`), (this.name = `ZodEncodeError`)); } }; (Re = globalThis).__zod_globalConfig ?? (Re.__zod_globalConfig = {}); const O = globalThis.__zod_globalConfig; function k(e) { return (e && Object.assign(O, e), O); } function Ue() { let e = this._zod; return ((e.message ??= JSON.stringify(e.def, r, 2)), e.message); } function We(e) { this._zod.message = e; } const Ge = { get: Ue, set: We, enumerable: !0, configurable: !0 }, Ke = { value: void 0, enumerable: !1 }, qe = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]), Je = (e, t) => { ((e.name = `$ZodError`), (Ke.value = t), Object.defineProperty(e, "issues", Ke), (Ke.value = void 0), Object.defineProperty(e, "message", Ge)); let n = Object.getPrototypeOf(e); qe.has(n) || (qe.add(n), Object.defineProperty(n, "toString", { configurable: !0, enumerable: !1, get() { let e = () => this.message; return ( Object.defineProperty(this, "toString", { value: e, configurable: !0, writable: !0, }), e ); }, set(e) { Object.defineProperty(this, "toString", { value: e, configurable: !0, writable: !0, }); }, })); }, Ye = E(`$ZodError`, Je); E(`$ZodError`, Je, void 0, { Parent: Error }); function Xe(e, t, n) { return ( Object.prototype.hasOwnProperty.call(e, t) || (t === `__proto__` ? Object.defineProperty(e, t, { value: n(), writable: !0, enumerable: !0, configurable: !0, }) : (e[t] = n())), e[t] ); } function Ze(e, t = (e) => e.message) { let n = {}, r = []; for (let i of e.issues) i.path.length > 0 ? Xe(n, i.path[0], () => []).push(t(i)) : r.push(t(i)); return { formErrors: r, fieldErrors: n }; } function Qe(e, t = (e) => e.message) { let n = { _errors: [] }, r = (e, i = []) => { for (let a of e.issues) if (a.code === `invalid_union` && a.errors.length) a.errors.map((e) => r({ issues: e }, [...i, ...a.path])); else if (a.code === `invalid_key`) r({ issues: a.issues }, [...i, ...a.path]); else if (a.code === `invalid_element`) r({ issues: a.issues }, [...i, ...a.path]); else { let e = [...i, ...a.path]; if (e.length === 0) n._errors.push(t(a)); else { let r = n, i = 0; for (; i < e.length;) { let n = e[i], o = i === e.length - 1; if (n === `_errors`) { (o && r._errors.push(t(a)), i++); continue; } Object.prototype.hasOwnProperty.call(r, n) || Object.defineProperty(r, n, { value: { _errors: [] }, enumerable: !0, writable: !0, configurable: !0, }); let s = r[n]; (o && s._errors.push(t(a)), (r = s), i++); } } } }; return (r(e), n); } function $e(e, t) { return { callee: t?.callee ?? e, Err: t?.Err }; } const et = (e) => { let t = (n, r, i, a) => { let o = i ? { ...i, async: !1 } : { async: !1 }, s = n._zod.run({ value: r, issues: [] }, o); if (s instanceof Promise) throw new D(); if (s.issues.length) { let n = new (a?.Err ?? e)(s.issues.map((e) => S(e, o, k()))); throw (te(n, a?.callee ?? t), n); } return s.value; }; return t; }, tt = (e) => { let t = async (n, r, i, a) => { let o = i ? { ...i, async: !0 } : { async: !0 }, s = n._zod.run({ value: r, issues: [] }, o); if ((s instanceof Promise && (s = await s), s.issues.length)) { let n = new (a?.Err ?? e)(s.issues.map((e) => S(e, o, k()))); throw (te(n, a?.callee ?? t), n); } return s.value; }; return t; }, nt = (e) => (t, n, r) => { let i = r ? { ...r, async: !1 } : { async: !1 }, a = t._zod.run({ value: n, issues: [] }, i); if (a instanceof Promise) throw new D(); return a.issues.length ? rt(e, a.issues, i) : { success: !0, data: a.value }; }; function rt(e, t, n) { let r; return { success: !1, get error() { return ( r || ((r = new e(t.map((e) => S(e, n, k())))), (t = void 0), (n = void 0)), r ); }, set error(e) { ((r = e), (t = void 0), (n = void 0)); }, }; } const it = (e) => async (t, n, r) => { let i = r ? { ...r, async: !0 } : { async: !0 }, a = t._zod.run({ value: n, issues: [] }, i); return ( a instanceof Promise && (a = await a), a.issues.length ? rt(e, a.issues, i) : { success: !0, data: a.value } ); }, at = /* @__PURE__ */ Symbol.for(`zod.compile.invalid`), ot = /* @__PURE__ */ Symbol.for(`zod.compile.fallback`), st = (e, t, n) => { let r = e._zod.bag.validator; if (r !== void 0) { if (r(t) !== at) return !0; if (r.definite === !0 && n === void 0) return !1; } return ct(e, t, n); }; function ct(e, t, n) { let r = n ? { ...n, async: !1, abortEarly: !0 } : { async: !1, abortEarly: !0 }, i = e._zod.bag.fallbackRun, a; if ( (i ? ((r[ot] = !0), (a = i({ value: t, issues: [] }, r))) : (a = e._zod.run({ value: t, issues: [] }, r)), a instanceof Promise) ) throw new D(); return a.issues.length === 0; } const lt = async (e, t, n) => { let r = n ? { ...n, async: !0, abortEarly: !0 } : { async: !0, abortEarly: !0 }, i = e._zod.run({ value: t, issues: [] }, r); return (i instanceof Promise && (i = await i), i.issues.length === 0); }, ut = (e) => { let t = et(e), n = (e, r, i, a) => { let o = i ? { ...i, direction: `backward` } : { direction: `backward` }; return t(e, r, o, $e(n, a)); }; return n; }, dt = (e) => { let t = et(e), n = (e, r, i, a) => t(e, r, i, $e(n, a)); return n; }, ft = (e) => { let t = tt(e), n = async (e, r, i, a) => { let o = i ? { ...i, direction: `backward` } : { direction: `backward` }; return await t(e, r, o, $e(n, a)); }; return n; }, pt = (e) => { let t = tt(e), n = async (e, r, i, a) => await t(e, r, i, $e(n, a)); return n; }, mt = (e) => (t, n, r) => { let i = r ? { ...r, direction: `backward` } : { direction: `backward` }; return nt(e)(t, n, i); }, ht = (e) => (t, n, r) => nt(e)(t, n, r), gt = (e) => async (t, n, r) => { let i = r ? { ...r, direction: `backward` } : { direction: `backward` }; return it(e)(t, n, i); }, _t = (e) => async (t, n, r) => it(e)(t, n, r), vt = /^[cC][0-9a-z]{6,}$/, yt = /^[0-9a-z]+$/, bt = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/, xt = /^[0-9a-vA-V]{20}$/, St = /^[A-Za-z0-9]{27}$/, Ct = /^[a-zA-Z0-9_-]{21}$/; function wt(e) { return RegExp(`^[a-zA-Z0-9_-]{${e}}$`); } const Tt = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Et = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Dt = (e) => e ? RegExp( `^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`, ) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Ot = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; function kt() { return RegExp( `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`, `u`, ); } const At = /^(?:(?: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])$/, jt = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, Mt = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, Nt = /^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Pt = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Ft = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/, It = /^https?$/, Lt = /^\+[1-9]\d{6,14}$/, Rt = /^\d(?:[ -]?\d){11,18}$/, zt = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/, Bt = `(?:(?:\\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])))`; function Vt(e) { return RegExp(`^${e}$`); } const Ht = /*@__PURE__*/ Vt(Bt); function Ut(e) { let t = `(?:[01]\\d|2[0-3]):[0-5]\\d`; return typeof e.precision == `number` ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : e.seconds ? `${t}:[0-5]\\d(?:\\.\\d+)?` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`; } function Wt(e) { return RegExp(`^${Ut(e)}$`); } function Gt(e) { let t = [`Z`]; e.offset && t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); let n = `${Ut({ precision: e.precision, seconds: !0 })}(?:${t.join(`|`)})`, r = e.local ? `${n}|${Ut({ precision: e.precision })}` : n; return RegExp(`^${Bt}T(?:${r})$`); } const Kt = /^[\s\S]{0,}$/, qt = /^-?\d+(?:\.\d+)?$/, Jt = /^[^A-Z]*$/, Yt = /^[^a-z]*$/, A = /*@__PURE__*/ E(`$ZodCheck`, (e, t) => { var n; ((e._zod ??= {}), (e._zod.def = t), (n = e._zod).onattach ?? (n.onattach = [])); }), Xt = (e) => { let t = e.value; return !o(t) && t.length !== void 0; }, Zt = { number: `number`, bigint: `bigint`, object: `date` }, Qt = /*@__PURE__*/ E(`$ZodCheckLessThan`, (e, t) => { A.init(e, t); let n = Zt[typeof t.value]; e._zod.check = (r) => { (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({ origin: Zt[typeof r.value] ?? n, code: `too_big`, maximum: typeof t.value == `object` ? t.value.getTime() : t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort, }); }; }), $t = /*@__PURE__*/ E(`$ZodCheckGreaterThan`, (e, t) => { A.init(e, t); let n = Zt[typeof t.value]; e._zod.check = (r) => { (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({ origin: Zt[typeof r.value] ?? n, code: `too_small`, minimum: typeof t.value == `object` ? t.value.getTime() : t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort, }); }; }), en = /*@__PURE__*/ E(`$ZodCheckMultipleOf`, (e, t) => { (A.init(e, t), (e._zod.check = (n) => { if (typeof n.value != typeof t.value) throw Error(`Cannot mix number and bigint in multiple_of check.`); (typeof n.value == `bigint` ? t.value !== BigInt(0) && n.value % t.value === BigInt(0) : c(n.value, t.value) === 0) || n.issues.push({ origin: typeof n.value, code: `not_multiple_of`, divisor: t.value, input: n.value, inst: e, continue: !t.abort, }); })); }), tn = /*@__PURE__*/ E(`$ZodCheckNumberFormat`, (e, t) => { (A.init(e, t), (t.format = t.format || `float64`)); let n = t.format?.includes(`int`), r = n ? `int` : `number`, [i, a] = le[t.format]; e._zod.check = (o) => { let s = o.value; if (n) { if (!Number.isInteger(s)) { o.issues.push({ expected: r, format: t.format, code: `invalid_type`, continue: !1, input: s, inst: e, }); return; } if (!Number.isSafeInteger(s)) { s > 0 ? o.issues.push({ input: s, code: `too_big`, maximum: 2 ** 53 - 1, note: `Integers must be within the safe integer range.`, inst: e, origin: r, inclusive: !0, continue: !t.abort, }) : o.issues.push({ input: s, code: `too_small`, minimum: -(2 ** 53 - 1), note: `Integers must be within the safe integer range.`, inst: e, origin: r, inclusive: !0, continue: !t.abort, }); return; } } (s < i && o.issues.push({ origin: `number`, input: s, code: `too_small`, minimum: i, inclusive: !0, inst: e, continue: !t.abort, }), s > a && o.issues.push({ origin: `number`, input: s, code: `too_big`, maximum: a, inclusive: !0, inst: e, continue: !t.abort, })); }; }), nn = /*@__PURE__*/ E(`$ZodCheckMaxLength`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length; if ((typeof r == `string` && i > t.maximum ? Te(r) : i) <= t.maximum) return; let a = Ee(r); n.issues.push({ origin: a, code: `too_big`, maximum: t.maximum, inclusive: !0, input: r, inst: e, continue: !t.abort, }); })); }), rn = /*@__PURE__*/ E(`$ZodCheckMinLength`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length; if ( (typeof r == `string` && i >= t.minimum && i < t.minimum * 2 ? Te(r) : i) >= t.minimum ) return; let a = Ee(r); n.issues.push({ origin: a, code: `too_small`, minimum: t.minimum, inclusive: !0, input: r, inst: e, continue: !t.abort, }); })); }), an = /*@__PURE__*/ E(`$ZodCheckLengthEquals`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length, a = typeof r == `string` && i >= t.length && i <= t.length * 2 ? Te(r) : i; if (a === t.length) return; let o = Ee(r), s = a > t.length; n.issues.push({ origin: o, ...(s ? { code: `too_big`, maximum: t.length } : { code: `too_small`, minimum: t.length }), inclusive: !0, exact: !0, input: n.value, inst: e, continue: !t.abort, }); })); }), on = /*@__PURE__*/ E(`$ZodCheckStringFormat`, (e, t) => { var n, r; (A.init(e, t), t.pattern ? ((n = e._zod).check ?? (n.check = (n) => { ((t.pattern.lastIndex = 0), !t.pattern.test(n.value) && n.issues.push({ origin: `string`, code: `invalid_format`, format: t.format, input: n.value, ...(t.pattern ? { pattern: t.pattern.toString() } : {}), inst: e, continue: !t.abort, })); })) : ((r = e._zod).check ?? (r.check = () => {}))); }), sn = /*@__PURE__*/ E(`$ZodCheckRegex`, (e, t) => { (on.init(e, t), (e._zod.check = (n) => { ((t.pattern.lastIndex = 0), !t.pattern.test(n.value) && n.issues.push({ origin: `string`, code: `invalid_format`, format: `regex`, input: n.value, pattern: t.pattern.toString(), inst: e, continue: !t.abort, })); })); }), cn = /*@__PURE__*/ E(`$ZodCheckLowerCase`, (e, t) => { ((t.pattern ??= Jt), on.init(e, t)); }), ln = /*@__PURE__*/ E(`$ZodCheckUpperCase`, (e, t) => { ((t.pattern ??= Yt), on.init(e, t)); }), un = /*@__PURE__*/ E(`$ZodCheckIncludes`, (e, t) => { A.init(e, t); let n = oe(t.includes); ((t.pattern = new RegExp( typeof t.position == `number` ? `^.{${t.position},}${n}` : n, )), (e._zod.check = (n) => { n.value.includes(t.includes, t.position) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `includes`, includes: t.includes, input: n.value, inst: e, continue: !t.abort, }); })); }), dn = /*@__PURE__*/ E(`$ZodCheckStartsWith`, (e, t) => { A.init(e, t); let n = RegExp(`^${oe(t.prefix)}.*`); ((t.pattern ??= n), (e._zod.check = (n) => { n.value.startsWith(t.prefix) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `starts_with`, prefix: t.prefix, input: n.value, inst: e, continue: !t.abort, }); })); }), fn = /*@__PURE__*/ E(`$ZodCheckEndsWith`, (e, t) => { A.init(e, t); let n = RegExp(`.*${oe(t.suffix)}$`); ((t.pattern ??= n), (e._zod.check = (n) => { n.value.endsWith(t.suffix) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `ends_with`, suffix: t.suffix, input: n.value, inst: e, continue: !t.abort, }); })); }), pn = /*@__PURE__*/ E(`$ZodCheckOverwrite`, (e, t) => { (A.init(e, t), (e._zod.check = (e) => { e.value = t.tx(e.value); })); }); var mn = class { constructor(e = [], t = {}) { ((this.content = []), (this.indent = 0), (this.args = e), (this.closed = t)); } indented(e) { this.indent += 1; try { e(this); } finally { --this.indent; } } write(e) { if (typeof e == `function`) { (e(this, { execution: `sync` }), e(this, { execution: `async` })); return; } let t = e .split(` `) .filter((e) => e), n = Math.min(...t.map((e) => e.length - e.trimStart().length)), r = t.map((e) => e.slice(n)).map((e) => ` `.repeat(this.indent * 2) + e); for (let e of r) this.content.push(e); } compile() { let e = Function, t = this?.content ?? [``]; return new e( ...Object.keys(this.closed), `return function (${this.args.join(`, `)}) {\n${t.join(` `)}\n};`, )(...Object.values(this.closed)); } }; const hn = { major: 4, minor: 6, patch: 5 }, j = /*@__PURE__*/ E( `$ZodType`, (e, t) => { var n; ((e ??= {}), (e._zod.def = t), (e._zod.bag = e._zod.bag || {}), (e._zod.version = hn)); let r = e._zod.def.checks, i = e._zod.traits.has(`$ZodCheck`) ? [e, ...(r ?? [])] : r?.length ? [...r] : []; for (let t of i) for (let n of t._zod.onattach) n(e); if (i.length === 0) ((n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => { e._zod.run = e._zod.parse; })); else { let t = (t, n, r) => { if (t.memo) return t; let i = x(t), a; for (let o of n) { if (o._zod.def.when) { if (be(t) || !o._zod.def.when(t)) continue; } else if (i) continue; let n = t.issues.length, s = o._zod.check(t); if (s instanceof Promise && r?.async === !1) throw new D(); if (a || s instanceof Promise) a = (a ?? Promise.resolve()).then(async () => { (await s, t.issues.length !== n && (Ce(t.issues, n, e), (i ||= x(t, n)))); }); else { if (t.issues.length === n) continue; (Ce(t.issues, n, e), (i ||= x(t, n))); } } return a ? a.then(() => t) : t; }, n = (n, r, a) => { if (x(n)) return ((n.aborted = !0), n); let o = t(r, i, a); if (o instanceof Promise) { if (a.async === !1) throw new D(); return o.then((t) => e._zod.parse(t, a)); } return e._zod.parse(o, a); }; e._zod.run = (r, a) => { if (a.skipChecks) return e._zod.parse(r, a); if (a.direction === `backward`) { let t = e._zod.parse( { value: r.value, issues: [] }, { ...a, skipChecks: !0 }, ); return t instanceof Promise ? t.then((e) => n(e, r, a)) : n(t, r, a); } let o = e._zod.parse(r, a); if (o instanceof Promise) { if (a.async === !1) throw new D(); return o.then((e) => t(e, i, a)); } return t(o, i, a); }; } }, { get "~standard"() { return Ae(this, `~standard`, vn(this)); }, set "~standard"(e) { C(this, `~standard`, e); }, }, ), gn = (e, t) => e.issues.length ? { issues: e.issues.map((e) => S(e, t, k())) } : { value: e.value }; async function _n(e, t) { let n = { async: !0 }; return gn(await e._zod.run({ value: t, issues: [] }, n), n); } function vn(e) { return { validate: (t) => { let n = { async: !1 }; try { let r = e._zod.run({ value: t, issues: [] }, n); if (!(r instanceof Promise)) return gn(r, n); } catch {} return _n(e, t); }, vendor: `zod`, version: 1, }; } const yn = /*@__PURE__*/ E(`$ZodString`, (e, t) => { (j.init(e, t), (e._zod.pattern = t.pattern ?? Kt), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = String(n.value); } catch {} return ( typeof n.value == `string` || n.issues.push({ expected: `string`, code: `invalid_type`, input: n.value, inst: e, }), n ); })); }), M = /*@__PURE__*/ E(`$ZodStringFormat`, (e, t) => { (on.init(e, t), yn.init(e, t)); }), bn = /*@__PURE__*/ E(`$ZodGUID`, (e, t) => { ((t.pattern ??= Et), M.init(e, t)); }), xn = /*@__PURE__*/ E(`$ZodUUID`, (e, t) => { if (t.version) { let e = { v1: 1, v2: 2, v3: 3, v4: 4, v5: 5, v6: 6, v7: 7, v8: 8 }[ t.version ]; if (e === void 0) throw Error(`Invalid UUID version: "${t.version}"`); t.pattern ??= Dt(e); } else t.pattern ??= Dt(); M.init(e, t); }), Sn = /*@__PURE__*/ E(`$ZodEmail`, (e, t) => { ((t.pattern ??= Ot), M.init(e, t)); }); function Cn(e) { try { return typeof URL < `u` && typeof URL.canParse == `function` ? URL.canParse(e) : (new URL(e), !0); } catch { return !1; } } function wn(e, t) { return !(`normalize` in t) && !(`hostname` in t) && !(`protocol` in t) ? Cn(e) || 2 : Tn(e, t); } function Tn(e, t) { if ( !t.normalize && t.protocol?.source === It.source && !/^https?:\/\//i.test(e) ) return 1; try { if (typeof URL < `u`) { let t = URL; if (typeof t.parse == `function`) return t.parse(e) ?? 2; } return new URL(e); } catch { return 2; } } const En = /[\t\n\r]/g; function Dn(e) { return e.replace(En, ``); } function On(e, t) { return ((t.lastIndex = 0), t.test(e.hostname)); } function kn(e, t) { return ( (t.lastIndex = 0), t.test(e.protocol.endsWith(`:`) ? e.protocol.slice(0, -1) : e.protocol) ); } const An = /*@__PURE__*/ E(`$ZodURL`, (e, t) => { (M.init(e, t), (e._zod.check = (n) => { try { let r = n.value.trim(), i = wn(r, t); if (i === 1) { n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid URL format`, input: n.value, inst: e, continue: !t.abort, }); return; } if (i === 2) { n.issues.push({ code: `invalid_format`, format: `url`, input: n.value, inst: e, continue: !t.abort, }); return; } if (i === !0) { n.value = Dn(r); return; } (t.hostname && !On(i, t.hostname) && n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid hostname`, pattern: t.hostname.source, input: n.value, inst: e, continue: !t.abort, }), t.protocol && !kn(i, t.protocol) && n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid protocol`, pattern: t.protocol.source, input: n.value, inst: e, continue: !t.abort, }), (n.value = t.normalize ? i.href : Dn(r))); return; } catch { n.issues.push({ code: `invalid_format`, format: `url`, input: n.value, inst: e, continue: !t.abort, }); } })); }), jn = /*@__PURE__*/ E(`$ZodEmoji`, (e, t) => { ((t.pattern ??= kt()), M.init(e, t)); }), Mn = /*@__PURE__*/ E(`$ZodNanoID`, (e, t) => { if (t.length !== void 0 && (!Number.isInteger(t.length) || t.length < 1)) throw Error(`Invalid nanoid length: ${t.length}`); ((t.pattern ??= t.length === void 0 ? Ct : wt(t.length)), M.init(e, t)); }), Nn = /*@__PURE__*/ E(`$ZodCUID`, (e, t) => { ((t.pattern ??= vt), M.init(e, t)); }), Pn = /*@__PURE__*/ E(`$ZodCUID2`, (e, t) => { ((t.pattern ??= yt), M.init(e, t)); }), Fn = /*@__PURE__*/ E(`$ZodULID`, (e, t) => { ((t.pattern ??= bt), M.init(e, t)); }), In = /*@__PURE__*/ E(`$ZodXID`, (e, t) => { ((t.pattern ??= xt), M.init(e, t)); }), Ln = /*@__PURE__*/ E(`$ZodKSUID`, (e, t) => { ((t.pattern ??= St), M.init(e, t)); }), Rn = /*@__PURE__*/ E(`$ZodISODateTime`, (e, t) => { ((t.pattern ??= Gt(t)), M.init(e, t)); }), zn = /*@__PURE__*/ E(`$ZodISODate`, (e, t) => { ((t.pattern ??= Ht), M.init(e, t)); }), Bn = /*@__PURE__*/ E(`$ZodISOTime`, (e, t) => { ((t.pattern ??= Wt(t)), M.init(e, t)); }), Vn = /*@__PURE__*/ E(`$ZodISODuration`, (e, t) => { ((t.pattern ??= Tt), M.init(e, t)); }), Hn = /*@__PURE__*/ E(`$ZodIPv4`, (e, t) => { ((t.pattern ??= At), M.init(e, t)); }), Un = /^[0-9a-fA-F:.]+$/; function Wn(e) { return Un.test(e) ? Cn(`http://[${e}]`) : !1; } const Gn = /*@__PURE__*/ E(`$ZodIPv6`, (e, t) => { ((t.pattern ??= jt), M.init(e, t), (e._zod.check = (n) => { Wn(n.value) || n.issues.push({ code: `invalid_format`, format: `ipv6`, input: n.value, inst: e, continue: !t.abort, }); })); }), Kn = /*@__PURE__*/ E(`$ZodCIDRv4`, (e, t) => { ((t.pattern ??= Mt), M.init(e, t)); }); function qn(e) { let t = e.split(`/`); if (t.length !== 2) return !1; let [n, r] = t; if (!r) return !1; let i = Number(r); return `${i}` !== r || i < 0 || i > 128 ? !1 : Wn(n); } const Jn = /*@__PURE__*/ E(`$ZodCIDRv6`, (e, t) => { ((t.pattern ??= Nt), M.init(e, t), (e._zod.check = (n) => { qn(n.value) || n.issues.push({ code: `invalid_format`, format: `cidrv6`, input: n.value, inst: e, continue: !t.abort, }); })); }); function Yn(e) { if (e === ``) return !0; if (/\s/.test(e) || e.length % 4 != 0) return !1; try { return (atob(e), !0); } catch { return !1; } } const Xn = /^[0-9a-zA-Z+/]*={0,2}$/, Zn = /*@__PURE__*/ E(`$ZodBase64`, (e, t) => { ((t.pattern ??= Xn), M.init(e, t), (e._zod.check = (n) => { Yn(n.value) || n.issues.push({ code: `invalid_format`, format: `base64`, input: n.value, inst: e, continue: !t.abort, }); })); }), Qn = /^[A-Za-z0-9_-]*$/; function $n(e) { if (!Qn.test(e)) return !1; let t = e.replace(/[-_]/g, (e) => (e === `-` ? `+` : `/`)); return Yn(t.padEnd(Math.ceil(t.length / 4) * 4, `=`)); } const er = /*@__PURE__*/ E(`$ZodBase64URL`, (e, t) => { ((t.pattern ??= Qn), M.init(e, t), (e._zod.check = (n) => { $n(n.value) || n.issues.push({ code: `invalid_format`, format: `base64url`, input: n.value, inst: e, continue: !t.abort, }); })); }), tr = /*@__PURE__*/ E(`$ZodE164`, (e, t) => { ((t.pattern ??= Lt), M.init(e, t)); }), nr = /[- ]/g; function rr(e) { let t = e.length, n = 1, r = 0; for (; t;) { let i = e.charCodeAt(--t) - 48; ((n ^= 1), (r += n ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][i] : i)); } return r % 10 == 0; } function ir(e) { return Rt.test(e) ? rr(e.replace(nr, ``)) : !1; } function ar(e) { let t = 0, n = e.length; for (let r = 4; r < n; r++) { let n = e.charCodeAt(r); t = (n >= 65 ? t * 100 + (n - 55) : t * 10 + (n - 48)) % 97; } for (let n = 0; n < 4; n++) { let r = e.charCodeAt(n); t = (r >= 65 ? t * 100 + (r - 55) : t * 10 + (r - 48)) % 97; } return t === 1; } function or(e) { return zt.test(e) ? ar(e) : !1; } function sr(e, t = null) { try { let n = e.split(`.`); if (n.length !== 3) return !1; let [r] = n; if (!r) return !1; let i = JSON.parse(atob(r)); return !( (`typ` in i && i?.typ !== `JWT`) || !i.alg || (t && (!(`alg` in i) || i.alg !== t)) ); } catch { return !1; } } const cr = /*@__PURE__*/ E(`$ZodJWT`, (e, t) => { (M.init(e, t), (e._zod.check = (n) => { sr(n.value, t.alg) || n.issues.push({ code: `invalid_format`, format: `jwt`, input: n.value, inst: e, continue: !t.abort, }); })); }), lr = /*@__PURE__*/ E(`$ZodNumber`, (e, t) => { (j.init(e, t), (e._zod.pattern = qt), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = Number(n.value); } catch {} let i = n.value; if (typeof i == `number` && !Number.isNaN(i) && Number.isFinite(i)) return n; let a = typeof i == `number` ? Number.isNaN(i) ? `NaN` : Number.isFinite(i) ? void 0 : String(i) : void 0; return ( n.issues.push({ expected: `number`, code: `invalid_type`, input: i, inst: e, ...(a ? { received: a } : {}), }), n ); })); }), ur = /*@__PURE__*/ E(`$ZodNumberFormat`, (e, t) => { (tn.init(e, t), lr.init(e, t)); }), dr = /*@__PURE__*/ E(`$ZodUnknown`, (e, t) => { (j.init(e, t), (e._zod.parse = (e) => e)); }), fr = /*@__PURE__*/ E(`$ZodNever`, (e, t) => { (j.init(e, t), (e._zod.parse = (t, n) => ( t.issues.push({ expected: `never`, code: `invalid_type`, input: t.value, inst: e, }), t ))); }), pr = /*@__PURE__*/ E(`$ZodDate`, (e, t) => { (j.init(e, t), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = new Date(n.value); } catch {} let i = n.value, a = i instanceof Date; return ( (a && !Number.isNaN(i.getTime())) || n.issues.push({ expected: `date`, code: `invalid_type`, input: i, ...(a ? { received: `Invalid Date` } : {}), inst: e, }), n ); })); }); function mr(e, t, n) { (e.issues.length && t.issues.push(...xe(n, e.issues)), (t.value[n] = e.value)); } const hr = /*@__PURE__*/ E(`$ZodArray`, (e, t) => { j.init(e, t); let n = O.memoizer; (n?.attach(e), (e._zod.parse = (r, i) => { let a = r.value; if (!Array.isArray(a)) return ( r.issues.push({ expected: `array`, code: `invalid_type`, input: a, inst: e, }), r ); r.value = n ? n.alloc(e, r, Array(a.length), i) : Array(a.length); let o = [], s = i?.abortEarly; for (let e = 0; e < a.length; e++) { let n = a[e], c = t.element._zod.run({ value: n, issues: [] }, i); if (c instanceof Promise) o.push(c.then((t) => mr(t, r, e))); else if ((mr(c, r, e), s && c.issues.length !== 0 && x(c))) break; } return o.length ? Promise.all(o).then(() => r) : r; })); }); function gr(e, t, n, r, i, a) { let o = n in r, s = a === `optional`; if (o || !s || i !== `optional`) { if (e.issues.length) { if (i !== void 0 && s && !o) return; t.issues.push(...xe(n, e.issues)); } if (!o && i === void 0) { e.issues.length || t.issues.push({ code: `invalid_type`, expected: `nonoptional`, input: void 0, path: [n], }); return; } e.value === void 0 ? (o || (i === `defaulted` && !s)) && (t.value[n] = void 0) : (t.value[n] = e.value); } } const _r = []; function vr(e) { let t = Object.keys(e.shape), n = Object.getOwnPropertySymbols(e.shape), r = n.length ? n : _r, i = r.length ? [...t, ...r] : t; for (let t of i) if (!e.shape?.[t]?._zod?.traits?.has(`$ZodType`)) throw Error( `Invalid element at key "${String(t)}": expected a Zod schema`, ); let a = ce(e.shape); return { ...e, allKeys: i, symbolKeys: r, keySet: new Set(t), numKeys: t.length, optionalKeys: new Set(a), }; } function yr(e, t, n, r, i, a, o) { let s = [], c = i.keySet, l = i.catchall._zod, u = l.def.type, d = l.optin, f = l.optout, p = 0; for (let i in t) { if (o && n.issues.length !== p) { if (x(n, p)) break; p = n.issues.length; } if (c.has(i)) continue; if (i === `__proto__`) { u === `never` && s.push(i); continue; } if (u === `never`) { s.push(i); continue; } let a = l.run({ value: t[i], issues: [] }, r); a instanceof Promise ? e.push(a.then((e) => gr(e, n, i, t, d, f))) : gr(a, n, i, t, d, f); } return ( s.length && n.issues.push({ code: `unrecognized_keys`, keys: s, input: t, inst: a, continue: !0, }), e.length ? Promise.all(e).then(() => n) : n ); } const br = /*@__PURE__*/ E(`$ZodObject`, (e, t) => { j.init(e, t); let n = Object.getOwnPropertyDescriptor(t, `shape`), r = n?.get ? n.get.raw : (t.shape ?? {}); if (r) { let e = () => { let n = { ...r }; return ( Object.defineProperty(t, "shape", { value: n }), (e.raw = n), n ); }; ((e.raw = r), Object.defineProperty(t, "shape", { get: e })); } let i = a(() => vr(t)); T(e, `propValues`, (e) => { let t = e.def.shape, n = {}; for (let e in t) { let r = t[e]._zod; if (r.values) { Object.prototype.hasOwnProperty.call(n, e) || l(n, e, /* @__PURE__ */ new Set()); for (let t of r.values) n[e].add(t); r.optin !== void 0 && n[e].add(void 0); } } return n; }); let o = ne, s = t.catchall, c, u = O.memoizer; (u?.attach(e), (e._zod.parse = (t, n) => { c ??= i.value; let r = t.value; if (!o(r)) return ( t.issues.push({ expected: `object`, code: `invalid_type`, input: r, inst: e, }), t ); t.value = u ? u.alloc(e, t, {}, n) : {}; let a = [], l = c.shape, d = n?.abortEarly, f = t.issues.length; for (let e of c.allKeys) { if (d && t.issues.length !== f) { if (x(t, f)) break; f = t.issues.length; } if (e === `__proto__`) continue; let i = l[e], o = i._zod.optin, s = i._zod.optout, c = i._zod.run({ value: r[e], issues: [] }, n); c instanceof Promise ? a.push(c.then((n) => gr(n, t, e, r, o, s))) : gr(c, t, e, r, o, s); } return s ? yr(a, r, t, n, i.value, e, d === !0) : a.length ? Promise.all(a).then(() => t) : t; })); }), xr = /*@__PURE__*/ E(`$ZodObjectJIT`, (e, t) => { br.init(e, t); let n = e._zod.parse, r = a(() => vr(t)), i = O.memoizer, o = (t) => { let n = r.value, a = n.symbolKeys, o = new mn([`payload`, `ctx`], { shape: t, inst: e, memo: i, syms: a, }), s = (e) => `shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`, c = (e, t) => ` let ${e}_ab = false; for (let i = 0; i < ${e}.issues.length; i++) { const iss = ${e}.issues[i]; iss.path = iss.path ? [${t}, ...iss.path] : [${t}]; payload.issues.push(iss); if (iss.continue !== true) ${e}_ab = true; } if (${e}_ab && ctx && ctx.abortEarly) { payload.value = newResult; return payload; }`; o.write(`const input = payload.value;`); let l = Object.create(null), u = 0; for (let e of n.allKeys) l[e] = `key_${u++}`; o.write( i ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`, ); for (let e of n.allKeys) { if (e === `__proto__`) continue; let n = l[e], r = typeof e == `symbol` ? `syms[${a.indexOf(e)}]` : _(e), i = `${r} in input`, u = t[e], d = u?._zod?.optin, f = d !== void 0, p = u?._zod?.optout === `optional`; if ((o.write(`const ${n} = ${s(r)};`), f && p)) { let e = d === `optional` ? `${n}_present` : `${n}.value !== undefined || ${n}_present`; o.write(` const ${n}_present = ${i}; if (!${n}.issues.length || ${n}_present) { if (${n}.issues.length) {${c(n, r)} } if (${e}) { newResult[${r}] = ${n}.value; } } `); } else f ? (o.write(` if (${n}.issues.length) {${c(n, r)} } `), d === `defaulted` ? o.write(`newResult[${r}] = ${n}.value;`) : o.write(` if (${n}.value !== undefined || ${i}) { newResult[${r}] = ${n}.value; } `)) : o.write(` const ${n}_present = ${i}; if (${n}.issues.length) {${c(n, r)} } if (!${n}_present && !${n}.issues.length) { payload.issues.push({ code: "invalid_type", expected: "nonoptional", input: undefined, path: [${r}] }); if (ctx && ctx.abortEarly) { payload.value = newResult; return payload; } } if (${n}_present) { newResult[${r}] = ${n}.value; } `); } return ( o.write(`payload.value = newResult;`), o.write(`return payload;`), o.compile() ); }, s, c = ne, l = !O.jitless, u = l && re.value, d = t.catchall, f; e._zod.parse = (i, a) => { f ??= r.value; let p = i.value; return c(p) ? l && u && a?.async === !1 && a.jitless !== !0 ? ((s ||= o(t.shape)), (i = s(i, a)), d ? yr([], p, i, a, f, e, a?.abortEarly === !0) : i) : n(i, a) : (i.issues.push({ expected: `object`, code: `invalid_type`, input: p, inst: e, }), i); }; }); function Sr(e, t, n, r) { for (let n of e) if (n.issues.length === 0) return ((t.value = n.value), t); let i = e.filter((e) => !x(e)); return i.length === 1 ? ((t.value = i[0].value), i[0]) : (t.issues.push({ code: `invalid_union`, input: t.value, inst: n, errors: e.map((e) => e.issues.map((e) => S(e, r, k()))), }), t); } const Cr = /*@__PURE__*/ E(`$ZodUnion`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.options.some((e) => e._zod.optin === `defaulted`) ? `defaulted` : e.def.options.some((e) => e._zod.optin !== void 0) ? `optional` : void 0, ), T(e, `optout`, (e) => e.def.options.some((e) => e._zod.optout === `optional`) ? `optional` : void 0, ), T(e, `values`, (e) => { if (e.def.options.every((e) => e._zod.values)) return new Set( e.def.options.flatMap((e) => Array.from(e._zod.values)), ); }), T(e, `pattern`, (e) => { if (e.def.options.every((e) => e._zod.pattern)) { let t = e.def.options.map((e) => e._zod.pattern); return RegExp(`^(${t.map((e) => s(e.source)).join(`|`)})$`); } })); let n = t.options.length === 1 ? t.options[0]._zod.run : null; e._zod.parse = (r, i) => { if (n) return n(r, i); let a = !1, o = []; for (let e of t.options) { let t = e._zod.run({ value: r.value, issues: [] }, i); if (t instanceof Promise) (o.push(t), (a = !0)); else { if (t.issues.length === 0) return t; o.push(t); } } return a ? Promise.all(o).then((t) => Sr(t, r, e, i)) : Sr(o, r, e, i); }; }), wr = /*@__PURE__*/ E(`$ZodIntersection`, (e, t) => { (j.init(e, t), (e._zod.parse = (e, n) => { let r = e.value, i = t.left._zod.run({ value: r, issues: [] }, n), a = t.right._zod.run({ value: r, issues: [] }, n); return i instanceof Promise || a instanceof Promise ? Promise.all([i, a]).then(([t, n]) => Er(e, t, n)) : Er(e, i, a); })); }); function Tr(e, t) { if (e === t || (e instanceof Date && t instanceof Date && +e == +t)) return { valid: !0, data: e }; if (v(e) && v(t)) { let n = Object.keys(t), r = Object.keys(e).filter((e) => n.indexOf(e) !== -1), i = { ...e, ...t }; Object.prototype.hasOwnProperty.call(i, `__proto__`) && delete i.__proto__; for (let n of r) { if (n === `__proto__`) continue; let r = Tr(e[n], t[n]); if (!r.valid) return { valid: !1, mergeErrorPath: [n, ...r.mergeErrorPath] }; i[n] = r.data; } return { valid: !0, data: i }; } if (Array.isArray(e) && Array.isArray(t)) { if (e.length !== t.length) return { valid: !1, mergeErrorPath: [] }; let n = []; for (let r = 0; r < e.length; r++) { let i = e[r], a = t[r], o = Tr(i, a); if (!o.valid) return { valid: !1, mergeErrorPath: [r, ...o.mergeErrorPath] }; n.push(o.data); } return { valid: !0, data: n }; } return { valid: !1, mergeErrorPath: [] }; } function Er(e, t, n) { let r = /* @__PURE__ */ new Map(), i, a = /* @__PURE__ */ new Map(), o = (e, t) => { let n; if (e.code === `unrecognized_keys` && !e.path?.length) ((i ??= e), (n = e.keys)); else if ( e.code === `invalid_key` && e.origin === `record` && e.path?.length === 1 ) { let t = String(e.path[0]); (a.has(t) || a.set(t, e), (n = [t])); } else return !1; for (let e of n) (r.has(e) || r.set(e, {}), (r.get(e)[t] = !0)); return !0; }; for (let n of t.issues) o(n, `l`) || e.issues.push(n); for (let t of n.issues) o(t, `r`) || e.issues.push(t); let s = [...r].filter(([, e]) => e.l && e.r).map(([e]) => e); if (s.length) { let t = i ? s.filter((e) => i.keys.includes(e)) : []; t.length && e.issues.push({ ...i, keys: t }); for (let n of s) !t.includes(n) && a.has(n) && e.issues.push(a.get(n)); } let c = Tr(t.value, n.value); if (!c.valid) { if (x(e)) return e; throw Error( `Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`, ); } return ((e.value = c.data), e); } const Dr = /*@__PURE__*/ E(`$ZodEnum`, (e, n) => { j.init(e, n); let r = t(n.entries), i = new Set(r); ((e._zod.values = i), T(e, `pattern`, (e) => { let n = t(e.def.entries).filter((e) => ae.has(typeof e)); return RegExp( n.length ? `^(${n.map((e) => oe(e.toString())).join(`|`)})$` : `^[^\\s\\S]$`, ); }), (e._zod.parse = (t, n) => { let a = t.value; return ( i.has(a) || t.issues.push({ code: `invalid_value`, values: r, input: a, inst: e, }), t ); })); }), Or = /*@__PURE__*/ E(`$ZodTransform`, (e, t) => { (j.init(e, t), (e._zod.optin = `optional`), O.memoizer?.guard(e), (e._zod.parse = (n, r) => { if (r.direction === `backward`) throw new He(e.constructor.name); let i = t.transform(n.value, n); if (r.async) return (i instanceof Promise ? i : Promise.resolve(i)).then( (e) => ((n.value = e), n), ); if (i instanceof Promise) throw new D(); return ((n.value = i), n); })); }); function kr(e, t) { return ((e.value = t.issues.length ? void 0 : t.value), e); } const Ar = /*@__PURE__*/ E(`$ZodOptional`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin === `defaulted` ? `defaulted` : `optional`, ), (e._zod.optout = `optional`), T(e, `values`, (e) => { let t = e.def.innerType._zod.values; return t ? /* @__PURE__ */ new Set([...t, void 0]) : void 0; }), T(e, `pattern`, (e) => { let t = e.def.innerType._zod.pattern; return t ? RegExp(`^(${s(t.source)})?$`) : void 0; }), (e._zod.parse = (e, n) => { if (e.value === void 0) { if (t.innerType._zod.optin !== `defaulted`) return e; let r = t.innerType._zod.run({ value: e.value, issues: [] }, n); return r instanceof Promise ? r.then((t) => kr(e, t)) : kr(e, r); } return t.innerType._zod.run(e, n); })); }), jr = /*@__PURE__*/ E(`$ZodExactOptional`, (e, t) => { (Ar.init(e, t), T(e, `values`, (e) => e.def.innerType._zod.values), T(e, `pattern`, (e) => e.def.innerType._zod.pattern), (e._zod.parse = (e, n) => t.innerType._zod.run(e, n))); }), Mr = /*@__PURE__*/ E(`$ZodNullable`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin), T(e, `optout`, (e) => e.def.innerType._zod.optout), T(e, `pattern`, (e) => { let t = e.def.innerType._zod.pattern; return t ? RegExp(`^(${s(t.source)}|null)$`) : void 0; }), T(e, `values`, (e) => e.def.innerType._zod.values ? /* @__PURE__ */ new Set([...e.def.innerType._zod.values, null]) : void 0, ), (e._zod.parse = (e, n) => e.value === null ? e : t.innerType._zod.run(e, n))); }), Nr = /*@__PURE__*/ E(`$ZodDefault`, (e, t) => { (j.init(e, t), (e._zod.optin = `defaulted`), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); if (e.value === void 0) return ((e.value = t.defaultValue), e); let r = t.innerType._zod.run(e, n); return r instanceof Promise ? r.then((e) => Pr(e, t)) : Pr(r, t); })); }); function Pr(e, t) { return (e.value === void 0 && (e.value = t.defaultValue), e); } const Fr = /*@__PURE__*/ E(`$ZodPrefault`, (e, t) => { (j.init(e, t), (e._zod.optin = `defaulted`), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => ( n.direction === `backward` || (e.value === void 0 && (e.value = t.defaultValue)), t.innerType._zod.run(e, n) ))); }), Ir = /*@__PURE__*/ E(`$ZodNonOptional`, (e, t) => { (j.init(e, t), T(e, `values`, (e) => { let t = e.def.innerType._zod.values; return t ? new Set([...t].filter((e) => e !== void 0)) : void 0; }), (e._zod.parse = (n, r) => { let i = t.innerType._zod.run(n, r); return i instanceof Promise ? i.then((t) => Lr(t, e)) : Lr(i, e); })); }); function Lr(e, t) { return ( !e.issues.length && e.value === void 0 && e.issues.push({ code: `invalid_type`, expected: `nonoptional`, input: e.value, inst: t, }), e ); } function Rr(e, t, n, r) { return t.issues.length ? ((e.value = n.catchValue({ ...t, value: e.value, error: { issues: t.issues.map((e) => S(e, r, k())) }, input: e.value, })), e) : ((e.value = t.value), t.memo && (e.memo = !0), e); } const zr = /*@__PURE__*/ E(`$ZodCatch`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin === `defaulted` ? `defaulted` : `optional`, ), T(e, `optout`, (e) => e.def.innerType._zod.optout), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); let r = t.innerType._zod.run({ value: e.value, issues: [] }, n); return r instanceof Promise ? r.then((r) => Rr(e, r, t, n)) : Rr(e, r, t, n); })); }), Br = /*@__PURE__*/ E(`$ZodPipe`, (e, t) => { (j.init(e, t), T(e, `values`, (e) => e.def.in._zod.values), T(e, `optin`, (e) => e.def.in._zod.optin), T(e, `optout`, (e) => e.def.out._zod.optout), T(e, `propValues`, (e) => e.def.in._zod.propValues), (e._zod.parse = (e, n) => { if (n.direction === `backward`) { let r = t.out._zod.run(e, n); return r instanceof Promise ? r.then((e) => Vr(e, t.in, n)) : Vr(r, t.in, n); } let r = t.in._zod.run(e, n); return r instanceof Promise ? r.then((e) => Vr(e, t.out, n)) : Vr(r, t.out, n); })); }); function Vr(e, t, n) { return e.issues.some((e) => e.code !== `unrecognized_keys`) ? ((e.aborted = !0), e) : t._zod.run({ value: e.value, issues: e.issues }, n); } const Hr = /*@__PURE__*/ E(`$ZodReadonly`, (e, t) => { (j.init(e, t), T(e, `propValues`, (e) => e.def.innerType._zod.propValues), T(e, `values`, (e) => e.def.innerType._zod.values), T(e, `optin`, (e) => e.def.innerType?._zod?.optin), T(e, `optout`, (e) => e.def.innerType?._zod?.optout), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); let r = t.innerType._zod.run(e, n); return r instanceof Promise ? r.then(Ur) : Ur(r); })); }); function Ur(e) { return (e.memo || (e.value = Object.freeze(e.value)), e); } const Wr = /*@__PURE__*/ E(`$ZodCustom`, (e, t) => { (A.init(e, t), j.init(e, t), (e._zod.parse = (e, t) => e), (e._zod.check = (n) => { let r = n.value, i = t.fn(r); if (i instanceof Promise) return i.then((t) => Gr(t, n, r, e)); Gr(i, n, r, e); })); }); function Gr(e, t, n, r) { if (!e) { let e = { code: `custom`, input: n, inst: r, path: [...(r._zod.def.path ?? [])], continue: !r._zod.def.abort, }; (r._zod.def.params && (e.params = r._zod.def.params), t.issues.push(Oe(e))); } } var Kr = class extends Error { constructor() { (super(`Cannot parse a reference cycle that closes through a transform`), (this.name = `ZodCyclicError`)); } }; const qr = `~memo`, Jr = []; function Yr(e) { return typeof e == `object` && !!e; } function Xr(e) { return e.map((e) => (e.path ? { ...e, path: e.path.slice() } : { ...e })); } const Zr = /*@__PURE__*/ new WeakMap(); function Qr(e, t, n) { let r = Zr.get(e); if (r !== void 0) return r ? 2 : 0; if (t.has(e)) return 2; t.add(e); let i = 0, a = (e) => { if (i !== 2 && e?._zod) { let r = Qr(e, t, n); r > i && (i = r); } }, o = (e, r) => { let i = 0; for (let a of Reflect.ownKeys(e)) { let o = Object.getOwnPropertyDescriptor(e, a); if (r && !o.enumerable) continue; let s = o.get ? 1 : o.value?._zod ? Qr(o.value, t, n) : 0; s > i && (i = s); } return i; }, s = (e) => { e > i && (i = e); }, c = e._zod.def; switch (c.type) { case `object`: { let e = u(c); (s(e ? o(e, !0) : 1), a(c.catchall)); break; } case `array`: a(c.element); break; case `tuple`: for (let e of c.items) a(e); a(c.rest); break; case `record`: case `map`: (a(c.keyType), a(c.valueType)); break; case `set`: a(c.valueType); break; case `union`: for (let e of c.options) a(e); break; case `intersection`: (a(c.left), a(c.right)); break; case `optional`: case `nullable`: case `default`: case `prefault`: case `catch`: case `readonly`: case `nonoptional`: case `promise`: case `success`: a(c.innerType); break; case `pipe`: (a(c.in), a(c.out)); break; case `function`: (a(c.input), a(c.output)); break; case `lazy`: { let r = c._cachedInner ?? (n ? e._zod.innerType : void 0); s(r ? Qr(r, t, !1) : 1); break; } case `template_literal`: case `string`: case `number`: case `int`: case `boolean`: case `bigint`: case `symbol`: case `undefined`: case `null`: case `void`: case `never`: case `any`: case `unknown`: case `date`: case `nan`: case `enum`: case `literal`: case `file`: case `transform`: case `custom`: break; default: for (let e in c) { let t = Object.getOwnPropertyDescriptor(c, e); if (!t || t.get) continue; let n = t.value; if (n && typeof n == `object`) { if (n._zod) a(n); else if (Array.isArray(n)) for (let e of n) a(e); } } } return (t.delete(e), $r(e, i)); } function $r(e, t) { return (t !== 1 && Zr.set(e, t === 2), t); } function ei(e) { return Qr(e, /* @__PURE__ */ new Set(), !0) !== 0; } function ti(e, t) { let n = e.buckets.get(t); return (n || ((n = /* @__PURE__ */ new WeakMap()), e.buckets.set(t, n)), n); } let ni; const ri = [], ii = { alloc(e, t, n) { let r = ni; if (!r) return n; ni = void 0; let i = { value: n, issues: null }; return (r.set(t.value, i), ri.push(i), n); }, guard(e) { var t; ((t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred.push(() => { let t = e._zod.parse, n = (e, n) => { if (n.direction !== `backward` && oi(n, e.value)) throw new Kr(); return t(e, n); }; ((e._zod.parse = n), e._zod.run === t && (e._zod.run = n)); })); }, attach(e) { var t; let n, r = !1, i, a; ((t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred.push(() => { let t = e._zod.parse, o = (s, c) => { if (n === void 0) { let i = Qr(e, /* @__PURE__ */ new Set(), !1); if (i === 0) return ( (e._zod.parse = t), e._zod.run === o && (e._zod.run = t), t(s, c) ); i === 2 || r ? (n = !0) : (r = !0); } let l = s.value; if (!Yr(l)) return t(s, c); let u = c[qr]; u || ((u = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0, }), (c[qr] = u)); let d; i === c ? (d = a) : ((d = ti(u, e)), (i = c), (a = d)); let f = d.get(l); if (f) return ( (s.value = f.value), f.issues ? f.issues.length && s.issues.push(...Xr(f.issues)) : ((s.memo = !0), u.backEdges ?? (u.backEdges = /* @__PURE__ */ new WeakSet()), u.backEdges.add(f.value)), s ); ni = d; let p = ri.length, m = t(s, c); ni = void 0; let h = ri.length > p ? ri.pop() : void 0; return m instanceof Promise ? m.then( (e) => ( h && (h.issues = e.issues.length ? Xr(e.issues) : Jr), e ), ) : (h && (h.issues = m.issues.length ? Xr(m.issues) : Jr), m); }; ((e._zod.parse = o), e._zod.run === t && (e._zod.run = o)); })); }, }; function ai() { return ii; } function oi(e, t) { let n = e[qr]?.backEdges; return n !== void 0 && Yr(t) && n.has(t); } const si = () => { let e = { string: { unit: `characters`, verb: `to have` }, file: { unit: `bytes`, verb: `to have` }, array: { unit: `items`, verb: `to have` }, set: { unit: `items`, verb: `to have` }, map: { unit: `entries`, verb: `to have` }, }; function t(t) { return e[t] ?? null; } let r = { regex: `input`, email: `email address`, url: `URL`, emoji: `emoji`, uuid: `UUID`, uuidv4: `UUIDv4`, uuidv6: `UUIDv6`, nanoid: `nanoid`, guid: `GUID`, cuid: `cuid`, cuid2: `cuid2`, ulid: `ULID`, xid: `XID`, ksuid: `KSUID`, datetime: `ISO datetime`, date: `ISO date`, time: `ISO time`, duration: `ISO duration`, ipv4: `IPv4 address`, ipv6: `IPv6 address`, mac: `MAC address`, cidrv4: `IPv4 range`, cidrv6: `IPv6 range`, base64: `base64-encoded string`, base64url: `base64url-encoded string`, json_string: `JSON string`, e164: `E.164 number`, currency_code: `currency code`, credit_card: `credit card number`, iban: `IBAN`, jwt: `JWT`, template_literal: `input`, }, i = { nan: `NaN` }; function a(e, t) { return e === `number` && typeof t == `number` && !Number.isFinite(t) ? String(t) : (i[e] ?? e); } return (e) => { switch (e.code) { case `invalid_type`: return `Invalid input: expected ${a(e.expected)}, received ${a(De(e.input), e.input)}`; case `invalid_value`: return e.values.length === 1 ? `Invalid input: expected ${se(e.values[0])}` : `Invalid option: expected one of ${n(e.values, `|`)}`; case `too_big`: { let n = e.exact ? `exactly ` : e.inclusive ? `<=` : `<`, r = t(e.origin); return r ? `Too big: expected ${e.origin ?? `value`} to have ${n}${e.maximum.toString()} ${r.unit ?? `elements`}` : `Too big: expected ${e.origin ?? `value`} to be ${n}${e.maximum.toString()}`; } case `too_small`: { let n = e.exact ? `exactly ` : e.inclusive ? `>=` : `>`, r = t(e.origin); return r ? `Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}` : `Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`; } case `invalid_format`: { let t = e; return t.format === `starts_with` ? `Invalid string: must start with "${t.prefix}"` : t.format === `ends_with` ? `Invalid string: must end with "${t.suffix}"` : t.format === `includes` ? `Invalid string: must include "${t.includes}"` : t.format === `regex` ? `Invalid string: must match pattern ${t.pattern}` : `Invalid ${r[t.format] ?? e.format}`; } case `not_multiple_of`: return `Invalid number: must be a multiple of ${e.divisor}`; case `unrecognized_keys`: return `Unrecognized key${e.keys.length > 1 ? `s` : ``}: ${n(e.keys, `, `)}`; case `invalid_key`: return `Invalid key in ${e.origin}`; case `invalid_union`: return e.options && Array.isArray(e.options) && e.options.length > 0 ? `Invalid discriminator value. Expected ${e.options.map((e) => `'${e}'`).join(` | `)}` : e.inclusive === !1 ? `Invalid input: more than one option matched` : `Invalid input`; case `invalid_element`: return `Invalid value in ${e.origin}`; default: return `Invalid input`; } }; }; function ci() { return { localeError: si() }; } var li, ui = class { constructor() { ((this._map = /* @__PURE__ */ new WeakMap()), (this._idmap = /* @__PURE__ */ new Map())); } add(e, ...t) { let n = t[0]; return ( this._map.set(e, n), n && typeof n == `object` && `id` in n && this._idmap.set(n.id, e), this ); } clear() { return ( (this._map = /* @__PURE__ */ new WeakMap()), (this._idmap = /* @__PURE__ */ new Map()), this ); } remove(e) { let t = this._map.get(e); return ( t && typeof t == `object` && `id` in t && this._idmap.delete(t.id), this._map.delete(e), this ); } get(e) { let t = e._zod.parent; if (t) { let n = { ...(this.get(t) ?? {}) }; delete n.id; let r = { ...n, ...this._map.get(e) }; return Object.keys(r).length ? r : void 0; } return this._map.get(e); } has(e) { return this._map.has(e); } }; function di() { return new ui(); } (li = globalThis).__zod_globalRegistry ?? (li.__zod_globalRegistry = di()); const fi = globalThis.__zod_globalRegistry, N = Symbol.for(`zod.compile.invalid`), pi = Symbol.for(`zod.compile.fallback`); var P = class extends Error { constructor( e = `z.compile does not support async refinements, transforms, or checks`, ) { (super(e), (this.name = `ZodCompileAsyncError`)); } }, F = class extends Error { constructor(e, t = !0) { (super( `z.compile does not support ${e}; this schema must use the runtime parser`, ), (this.name = `ZodCompileUnsupportedError`), (this.islandable = t)); } }; function mi(e, t) { try { return vi(e, { assertOnly: !0 }); } catch { return t; } } function hi(e, t) { try { let t = vi(e), n = gi(e, t); return ((n._zod.bag.validator = mi(e, t)), n); } catch (n) { if (t?.strict) throw n; return e; } } function gi(e, t) { if (ei(e)) throw new F(`a schema whose subtree contains a reference cycle`); let n = y(e), r = e._zod.run, i = r.__originalRun ?? r, a = (e, n) => { if ( n?.async || n?.direction === `backward` || n?.skipChecks || n?.[pi] || (n && oi(n, e.value)) ) return i(e, n); let r = t(e.value); return r === N ? (n && (n[pi] = !0), i(e, n)) : ((e.value = r), e); }; return ( (a.__originalRun = i), (n._zod.bag.fallbackRun = i), (n._zod.bag.validator = t), (n._zod.run = a), r.__originalRun || _i(n, e, t), n ); } function _i(e, t, n) { let r = e, i = t; if (typeof i.safeParse == `function`) { let e = i.safeParse; r.safeParse = (t, r) => { let i = n(t); return i === N ? e(t, r) : { success: !0, data: i }; }; } if (typeof i.parse == `function`) { let e = i.parse; r.parse = (t, r) => { let i = n(t); return i === N ? e(t, r) : i; }; } } function vi(e, t) { let n = !0; try { n = ei(e); } catch {} if (n) throw new F(`a schema whose subtree contains a reference cycle`); let r = { constants: /* @__PURE__ */ new Map(), constantCounter: 0, varCounter: 0, definite: !0, }, i = new mn([`input`]), a = V(i, r, e, `input`, !t?.assertOnly); i.write(a === null ? `return true;` : `return ${a};`); let o = [`INVALID`, ...r.constants.keys()], s = [N, ...r.constants.values()], c = i.content.join(` `), l = t?.debug ? o.length > 0 ? `// Constants: ${o.join(`, `)}\n${c}` : c : ``, u = Function, d = `return (input) => {\n${c}\n}`, f; try { f = new u(...o, d)(...s); } catch (e) { throw new F( `this schema (generated code failed to evaluate: ${e.message})`, ); } return (t?.debug && (f.code = l), (f.definite = r.definite), f); } function I(e, t) { for (let [n, r] of e.constants) if (r === t) return n; let n = `c${e.constantCounter++}`; return (e.constants.set(n, t), n); } function L(e, t) { return ((e.definite = !1), I(e, t)); } function R(e) { return `v${e.varCounter++}`; } function yi(e, t) { let n = e._zod.run({ value: t, issues: [] }, {}); if (n && typeof n.then == `function`) return N; let r = n; return r.issues.length === 0 ? r.value : N; } function z(e, t, n, r, i = !0) { let a = e.content.length, o = t.constants.size, s = t.constantCounter, c = t.varCounter; try { return V(e, t, n, r, i); } catch (i) { if (!(i instanceof F) || !i.islandable) throw i; if (((e.content.length = a), t.constants.size > o)) { let e = Array.from(t.constants.keys()).slice(o); for (let n of e) t.constants.delete(n); } return ((t.constantCounter = s), (t.varCounter = c), bi(e, t, n, r)); } } function bi(e, t, n, r) { t.definite = !1; let i = I(t, n), a = I(t, yi), o = R(t); return ( e.write(`const ${o} = ${a}(${i}, ${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } const xi = /* @__PURE__ */ new Set([ `max_size`, `min_size`, `size_equals`, `max_length`, `min_length`, `length_equals`, ]); function Si(e, t, n, r) { let i = n._zod.def.checks; if (!i || i.length === 0) return r; let a = r; for (let n of i) { let r = n._zod.def; if (r.when && !xi.has(r.check)) throw new F(`check with a custom "when" condition`); switch (r.check) { case `greater_than`: Ti(e, t, r, a); break; case `less_than`: Ei(e, t, r, a); break; case `multiple_of`: Di(e, t, r, a); break; case `number_format`: Oi(e, r, a); break; case `min_length`: { let n = B(r.minimum, `min_length`), i = Ci( e, t, a, `${a}.length >= ${n} && ${a}.length < ${r.minimum * 2}`, ); e.write(`if (${i} < ${n}) return INVALID;`); break; } case `max_length`: { let n = B(r.maximum, `max_length`), i = Ci(e, t, a, `${a}.length > ${n}`); e.write(`if (${i} > ${n}) return INVALID;`); break; } case `length_equals`: { let n = B(r.length, `length_equals`), i = Ci( e, t, a, `${a}.length >= ${n} && ${a}.length <= ${r.length * 2}`, ); e.write(`if (${i} !== ${n}) return INVALID;`); break; } case `min_size`: e.write(`if (${a}.size < ${B(r.minimum, `min_size`)}) return INVALID;`); break; case `max_size`: e.write(`if (${a}.size > ${B(r.maximum, `max_size`)}) return INVALID;`); break; case `size_equals`: e.write( `if (${a}.size !== ${B(r.size, `size_equals`)}) return INVALID;`, ); break; case `string_format`: a = Ri(e, t, r, a); break; case `custom`: a = Ii(e, t, n, a); break; case `bigint_format`: ki(e, r, a); break; case `mime_type`: Ai(e, t, r, a); break; case `property`: Mi(e, t, r, a); break; case `properties`: ji(e, t, r, a); break; case `overwrite`: { let r = R(t); (Ni(e, t, n, a, r), (a = r)); break; } default: throw new F(`check type ${r.check}`); } } return a; } function Ci(e, t, n, r) { let i = I(t, Te), a = R(t); return ( e.write( `const ${a} = typeof ${n} === "string" && ${r} ? ${i}(${n}) : ${n}.length;`, ), a ); } function B(e, t) { if (typeof e != `number` || !Number.isFinite(e)) throw new F(`${t} bound of type ${typeof e}`); return `${e}`; } function wi(e, t) { if (typeof t == `bigint`) return `${t}n`; if (typeof t == `number`) { if (Number.isNaN(t)) throw new F(`comparison check with NaN bound`); return `${t}`; } if (t instanceof Date) { if (Number.isNaN(t.getTime())) throw new F(`comparison check with Invalid Date bound`); return I(e, t); } throw new F(`comparison check bound of type ${typeof t}`); } function Ti(e, t, n, r) { let i = n.inclusive ? `<` : `<=`; e.write(`if (${r} ${i} ${wi(t, n.value)}) return INVALID;`); } function Ei(e, t, n, r) { let i = n.inclusive ? `>` : `>=`; e.write(`if (${r} ${i} ${wi(t, n.value)}) return INVALID;`); } function Di(e, t, n, r) { if (typeof n.value == `bigint`) { if (n.value === BigInt(0)) throw new F(`multiple_of check with a zero divisor`); e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`); } else { let i = I(t, c); e.write( `if (${i}(${r}, ${B(n.value, `multiple_of`)}) !== 0) return INVALID;`, ); } } function Oi(e, t, n) { let r = t.format; switch (r) { case `safeint`: e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`); break; case `int32`: e.write( `if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`, ); break; case `uint32`: e.write( `if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`, ); break; case `float32`: e.write( `if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`, ); break; case `float64`: e.write(`if (!Number.isFinite(${n})) return INVALID;`); break; default: throw new F(`number format ${r}`); } } function ki(e, t, n) { let r = t.format; if (r) switch (r) { case `int64`: e.write( `if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`, ); break; case `uint64`: e.write( `if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`, ); break; default: throw new F(`bigint format ${r}`); } } function Ai(e, t, n, r) { let i = n.mime; if (i && i.length > 0) { let n = I(t, new Set(i)); e.write(`if (!${n}.has(${r}.type)) return INVALID;`); } } function ji(e, t, n, r) { if (n.when) throw new F(`check with a custom "when" condition`); e.write(`if (${r} == null) return INVALID;`); let i = n.shape; for (let n of Reflect.ownKeys(i)) { let a = typeof n == `symbol` ? I(t, n) : _(n), o = R(t); (e.write(`const ${o} = ${r}[${a}];`), z(e, t, i[n], o, !1)); } } function Mi(e, t, n, r) { let i = `${r}[${JSON.stringify(n.property)}]`; V(e, t, n.schema, i); } function Ni(e, t, n, r, i) { let a = n._zod.def.tx; if (!a) throw new F(`overwrite check without a transform function`); if (W(a)) throw new P(`z.compile: async overwrite transforms are not supported`); let o = I(t, a); e.write(`const ${i} = ${o}(${r});`); } function Pi() { throw new D(); } function Fi(e) { this.issues.push(e); } function Ii(e, t, n, r) { let i = n._zod.def; if (i.fn) { if (W(i.fn)) throw new P(`z.compile: async .refine() predicates are not supported`); let n = L(t, i.fn), a = I(t, Pi), o = R(t); return ( e.write(`const ${o} = ${n}(${r});`), e.write(`if (${o} instanceof Promise) ${a}();`), e.write(`if (!${o}) return INVALID;`), r ); } if (n._zod.check) { if (W(n._zod.check)) throw new P( `z.compile: async .superRefine() / check functions are not supported`, ); let i = n._zod.check, a = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }; return ( i(t) instanceof Promise && Pi(), t.issues.length === 0 ? t.value : N ); }), o = R(t); return ( e.write(`const ${o} = ${a}(${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } throw new F(`custom check without a predicate or check function`); } const Li = /* @__PURE__ */ new Set([ `cidrv4`, `cuid`, `cuid2`, `date`, `datetime`, `duration`, `e164`, `email`, `emoji`, `ends_with`, `guid`, `includes`, `ipv4`, `ksuid`, `lowercase`, `mac`, `nanoid`, `regex`, `starts_with`, `time`, `ulid`, `uppercase`, `uuid`, `xid`, ]); function Ri(e, t, n, r, i = !0) { let a = n.format; if (a === `base64`) { let n = I(t, Yn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `base64url`) { let n = I(t, $n); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `jwt`) { let i = I(t, sr), a = I(t, n.alg ?? null); return (e.write(`if (!${i}(${r}, ${a})) return INVALID;`), r); } if (a === `ipv6`) { let n = I(t, Wn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `cidrv6`) { let n = I(t, qn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `credit_card`) { let n = I(t, ir); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `iban`) { let n = I(t, or); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } let o = n; if ( a === `url` || a === `httpurl` || o.normalize || o.hostname !== void 0 || o.protocol !== void 0 ) { let a = I(t, wn), s = I(t, n), c = R(t), l = R(t); if ( (e.write(`const ${c} = ${r}.trim();`), e.write(`const ${l} = ${a}(${c}, ${s});`), e.write(`if (typeof ${l} === "number") return INVALID;`), o.hostname !== void 0) ) { let n = I(t, On); e.write(`if (!${n}(${l}, ${s}.hostname)) return INVALID;`); } if (o.protocol !== void 0) { let n = I(t, kn); e.write(`if (!${n}(${l}, ${s}.protocol)) return INVALID;`); } if (!i) return null; let u = R(t), d = o.normalize ? `${l}.href` : `${I(t, Dn)}(${c})`; return (e.write(`const ${u} = ${d};`), u); } let s = n.fn; if (s) { if (W(s)) throw new F(`async string format ${a}`); let n = I(t, s); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (Li.has(a) && n.pattern) { let i = I(t, n.pattern); return ( e.write(`${i}.lastIndex = 0;`), e.write(`if (!${i}.test(${r})) return INVALID;`), r ); } let c = n.format; switch (c) { case `regex`: throw new F(`regex format without a pattern`); case `lowercase`: e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`); break; case `uppercase`: e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`); break; case `includes`: e.write(`if (!${r}.includes(${_(n.includes)})) return INVALID;`); break; case `starts_with`: { let t = n.prefix; e.write(`if (${r}.slice(0, ${t.length}) !== ${_(t)}) return INVALID;`); break; } case `ends_with`: { let t = n.suffix; e.write(`if (${r}.slice(-${t.length}) !== ${_(t)}) return INVALID;`); break; } default: throw new F(`string format ${c}`); } return r; } function V(e, t, n, r, i = !0) { let a = n._zod.def, o = a.type; if (a.coerce) throw new F(`coercion (z.coerce.${o}())`); let s = i || !!a.checks?.length, c; switch (o) { case `string`: c = zi(e, t, n, r, s); break; case `number`: c = Bi(e, n, r); break; case `boolean`: c = Vi(e, r); break; case `bigint`: c = Hi(e, n, r); break; case `symbol`: c = Ui(e, r); break; case `undefined`: c = Wi(e, r); break; case `null`: c = Gi(e, r); break; case `any`: case `unknown`: c = r; break; case `never`: (e.write(`return INVALID;`), (c = r)); break; case `void`: c = Ki(e, r); break; case `nan`: c = qi(e, r); break; case `date`: c = Ji(e, r); break; case `object`: c = Yi(e, t, n, r, s); break; case `optional`: c = Xi(e, t, n, r, s); break; case `nullable`: c = ta(e, t, n, r, s); break; case `array`: c = na(e, t, n, r, s); break; case `literal`: c = ra(e, t, n, r); break; case `enum`: c = ia(e, t, n, r); break; case `readonly`: { let i = aa(e, t, n, r), a = R(t); (e.write(`const ${a} = Object.freeze(${i});`), (c = a)); break; } case `success`: (aa(e, t, n, r), (c = `true`)); break; case `default`: case `prefault`: c = oa(e, t, n, r); break; case `nonoptional`: c = sa(e, t, n, r); break; case `tuple`: c = ca(e, t, n, r); break; case `union`: c = ua(e, t, n, r); break; case `intersection`: c = pa(e, t, n, r); break; case `record`: c = ma(e, t, n, r); break; case `map`: c = _a(e, t, n, r); break; case `set`: c = va(e, t, n, r); break; case `file`: c = ya(e, r); break; case `template_literal`: c = ba(e, t, n, r); break; case `lazy`: c = xa(e, t, n, r); break; case `pipe`: c = Sa(e, t, n, r); break; case `custom`: c = Ca(e, t, n, r); break; case `transform`: c = Ea(e, t, n, r); break; case `catch`: c = Ta(e, t, n, r); break; default: throw new F(`schema type ${o}`); } return c === null ? null : Si(e, t, n, c); } function zi(e, t, n, r, i = !0) { e.write(`if (typeof ${r} !== "string") return INVALID;`); let a = n._zod.def; return a.format === void 0 ? r : Ri(e, t, a, r, i); } function Bi(e, t, n) { e.write( `if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`, ); let r = t._zod.def; return ( r.check === `number_format` && r.format && Oi(e, { format: r.format }, n), n ); } function Vi(e, t) { return (e.write(`if (typeof ${t} !== "boolean") return INVALID;`), t); } function Hi(e, t, n) { e.write(`if (typeof ${n} !== "bigint") return INVALID;`); let r = t._zod.def; if (r.format) switch (r.format) { case `int64`: e.write( `if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`, ); break; case `uint64`: e.write( `if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`, ); } return n; } function Ui(e, t) { return (e.write(`if (typeof ${t} !== "symbol") return INVALID;`), t); } function Wi(e, t) { return (e.write(`if (${t} !== undefined) return INVALID;`), t); } function Gi(e, t) { return (e.write(`if (${t} !== null) return INVALID;`), t); } function Ki(e, t) { return (e.write(`if (${t} !== undefined) return INVALID;`), t); } function qi(e, t) { return ( e.write( `if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`, ), t ); } function Ji(e, t) { return ( e.write( `if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`, ), t ); } function Yi(e, t, n, r, i = !0) { let a = n._zod.def; e.write( `if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`, ); let o = a.shape, s = Object.keys(o), c = Object.getOwnPropertySymbols(o), l = c.length ? [...s, ...c] : s, u = (e) => (typeof e == `symbol` ? I(t, e) : _(e)), d = (e) => (typeof e == `symbol` ? `[${u(e)}]` : _(e)), f = o; if (s.includes(`__proto__`)) throw new F(`object shape key "__proto__"`); let p = /* @__PURE__ */ new Map(); for (let n of l) { let a = f[n], o = u(n), s = R(t); if ((e.write(`const ${s} = ${r}[${o}];`), a._zod.optin !== void 0)) { let i = R(t); (e.write(`let ${i} = (() => {`), e.indented((e) => { let n = z(e, t, a, s); e.write(`return ${n};`); }), e.write(`})();`), a._zod.optout === `optional` ? (e.write(`if (${i} === INVALID) {`), e.indented((e) => { (e.write(`if (${o} in ${r}) return INVALID;`), e.write(`${i} = undefined;`)); }), e.write(`}`)) : e.write(`if (${i} === INVALID) return INVALID;`), p.set(n, i)); } else { Qi(a) && e.write(`if (!(${o} in ${r})) return INVALID;`); let c = z(e, t, a, s, i); c !== null && p.set(n, c); } } let m = a.catchall, h = `none`; if (m) { let t = m._zod.def.type; if (t === `never`) { let t = s.map((e) => `k !== ${_(e)}`).join(` && `) || `true`; (e.write(`for (const k in ${r}) {`), e.indented((e) => { e.write(`if (${t}) return INVALID;`); }), e.write(`}`)); } else h = (t === `unknown` || t === `any`) && !m._zod.def.checks?.length ? `passthrough` : `schema`; } let g = R(t), ee = l.some((e) => ea(f[e]) || $i(f[e])); if (!i) { if (h === `schema`) { let n = s.length > 0 ? I(t, new Set(s)) : null; (e.write(`for (const k in ${r}) {`), e.indented((e) => { (e.write(`if (k === "__proto__") continue;`), n && e.write(`if (${n}.has(k)) continue;`)); let i = R(t); (e.write(`const ${i} = ${r}[k];`), z(e, t, m, i, !1)); }), e.write(`}`)); } return null; } if (ee) { e.write(`const ${g} = {};`); for (let t of l) { let n = u(t), i = p.get(t); $i(f[t]) ? e.write(`if (${n} in ${r}) ${g}[${n}] = ${i};`) : ea(f[t]) ? e.write( `if (${i} !== undefined || ${n} in ${r}) ${g}[${n}] = ${i};`, ) : e.write(`${g}[${n}] = ${i};`); } } else { let t = l.map((e) => `${d(e)}: ${p.get(e)}`).join(`, `); e.write(`const ${g} = { ${t} };`); } if (h !== `none`) { let n = s.length > 0 ? I(t, new Set(s)) : null; (e.write(`for (const k in ${r}) {`), e.indented((e) => { if ( (e.write(`if (k === "__proto__") continue;`), n && e.write(`if (${n}.has(k)) continue;`), h === `passthrough`) ) e.write(`${g}[k] = ${r}[k];`); else { let n = R(t); e.write(`const ${n} = ${r}[k];`); let i = z(e, t, m, n); e.write(`${g}[k] = ${i};`); } }), e.write(`}`)); } return g; } function Xi(e, t, n, r, i = !0) { let a = n._zod.def; if (Zi(n)) return V(e, t, a.innerType, r, i); if (a.innerType._zod.optin === `defaulted`) { let n = R(t), i = R(t); return ( e.write(`let ${n};`), e.write(`if (${r} === undefined) {`), e.indented((e) => { (e.write(`const ${i} = (() => {`), e.indented((e) => { let n = V(e, t, a.innerType, r); e.write(`return ${n};`); }), e.write(`})();`), e.write(`if (${i} !== INVALID) ${n} = ${i};`)); }), e.write(`} else {`), e.indented((e) => { let i = V(e, t, a.innerType, r); e.write(`${n} = ${i};`); }), e.write(`}`), n ); } let o = i ? R(t) : null; return ( o && e.write(`let ${o};`), e.write(`if (${r} !== undefined) {`), e.indented((e) => { let n = V(e, t, a.innerType, r, i); o && n !== null && e.write(`${o} = ${n};`); }), e.write(`}`), o ); } function Zi(e) { return e._zod.traits?.has(`$ZodExactOptional`) === !0; } function Qi(e) { return e._zod.optin === void 0 && H(e); } function H(e) { if (e._zod.def.coerce) return !0; let t = e._zod.def; switch (t.type) { case `any`: case `unknown`: case `undefined`: case `void`: case `default`: case `prefault`: case `transform`: case `custom`: case `lazy`: return !0; case `string`: case `number`: case `boolean`: case `bigint`: case `symbol`: case `null`: case `never`: case `nan`: case `date`: case `object`: case `array`: case `tuple`: case `record`: case `map`: case `set`: case `file`: case `template_literal`: return !1; case `nonoptional`: return t.innerType ? H(t.innerType) : !1; case `literal`: return !!t.values?.includes(void 0); case `enum`: return !!e._zod.values?.has(void 0); case `optional`: case `nullable`: case `readonly`: case `success`: return !t.innerType || H(t.innerType); case `catch`: return !0; case `union`: return !t.options || t.options.some(H); case `intersection`: return !t.left || !t.right || (H(t.left) && H(t.right)); case `pipe`: return !t.in || H(t.in); default: return !0; } } function $i(e) { return e._zod.optin === `optional` && e._zod.optout === `optional`; } function ea(e) { return (e._zod.optin !== `defaulted` || e._zod.optout === `optional`) && U(e); } function U(e) { let t = e._zod.def; switch (t.type) { case `string`: case `number`: case `boolean`: case `bigint`: case `symbol`: case `null`: case `nan`: case `date`: case `object`: case `array`: case `tuple`: case `record`: case `map`: case `set`: case `file`: case `template_literal`: case `never`: case `success`: return !1; case `literal`: return !!t.values?.includes(void 0); case `enum`: return !!e._zod.values?.has(void 0); case `optional`: return !0; case `nullable`: case `readonly`: case `nonoptional`: return !t.innerType || U(t.innerType); case `union`: return !t.options || t.options.some(U); case `intersection`: return !t.left || !t.right || U(t.left) || U(t.right); case `pipe`: return !t.out || U(t.out); default: return !0; } } function ta(e, t, n, r, i = !0) { let a = n._zod.def, o = i ? R(t) : null; return ( o && e.write(`let ${o} = null;`), e.write(`if (${r} !== null) {`), e.indented((e) => { let n = V(e, t, a.innerType, r, i); o && n !== null && e.write(`${o} = ${n};`); }), e.write(`}`), o ); } function na(e, t, n, r, i = !0) { let a = n._zod.def; e.write(`if (!Array.isArray(${r})) return INVALID;`); let o = i ? R(t) : null, s = R(t), c = R(t); return ( o && e.write(`const ${o} = new Array(${r}.length);`), e.write(`for (let ${s} = 0; ${s} < ${r}.length; ${s}++) {`), e.indented((e) => { e.write(`const ${c} = ${r}[${s}];`); let n = z(e, t, a.element, c, i); o && n !== null && e.write(`${o}[${s}] = ${n};`); }), e.write(`}`), o ); } function ra(e, t, n, r) { let i = n._zod.def.values; if (i.length !== 1) { let n = I(t, new Set(i)); return (e.write(`if (!${n}.has(${r})) return INVALID;`), r); } let a = i[0]; if (typeof a == `number` && Number.isNaN(a)) { let n = I(t, new Set(i)); return (e.write(`if (!${n}.has(${r})) return INVALID;`), r); } if (typeof a == `string`) e.write(`if (${r} !== ${_(a)}) return INVALID;`); else if (typeof a == `number` || typeof a == `boolean`) e.write(`if (${r} !== ${a}) return INVALID;`); else if (a === null) e.write(`if (${r} !== null) return INVALID;`); else if (a === void 0) e.write(`if (${r} !== undefined) return INVALID;`); else if (typeof a == `bigint`) e.write(`if (${r} !== ${a}n) return INVALID;`); else throw new F(`literal type ${typeof a}`); return r; } function ia(e, t, n, r) { let i = n._zod.values; if (!i) throw new F(`enum schema without enumerated values`); let a = I(t, i); return (e.write(`if (!${a}.has(${r})) return INVALID;`), r); } function aa(e, t, n, r) { let i = n._zod.def; return V(e, t, i.innerType, r); } function oa(e, t, n, r) { let i = n._zod.def, a = Object.getOwnPropertyDescriptor(n._zod.def, `defaultValue`) ? () => n._zod.def.defaultValue : void 0; if (n._zod.def.type === `prefault`) { if (!a) return V(e, t, i.innerType, r); let n = I(t, a), o = R(t); return ( e.write(`let ${o} = ${r};`), e.write(`if (${r} === undefined) ${o} = ${n}();`), V(e, t, i.innerType, o) ); } let o = R(t); if (a) { let n = I(t, a), s = I(t, ie); (e.write(`let ${o};`), e.write(`if (${r} === undefined) {`), e.indented((e) => { e.write(`${o} = ${s}(${n}());`); }), e.write(`} else {`), e.indented((e) => { let a = V(e, t, i.innerType, r); e.write(`${o} = ${a} === undefined ? ${s}(${n}()) : ${a};`); }), e.write(`}`)); } else (e.write(`let ${o};`), e.write(`if (${r} !== undefined) {`), e.indented((e) => { let n = V(e, t, i.innerType, r); e.write(`${o} = ${n};`); }), e.write(`}`)); return o; } function sa(e, t, n, r) { let i = n._zod.def, a = V(e, t, i.innerType, r), o = R(t); return ( e.write(`const ${o} = ${a};`), e.write(`if (${o} === undefined) return INVALID;`), o ); } function ca(e, t, n, r) { let i = n._zod.def, a = i.items, o = i.rest; e.write(`if (!Array.isArray(${r})) return INVALID;`); let s = la(a, `optin`), c = la(a, `optout`); o ? e.write(`if (${r}.length < ${s}) return INVALID;`) : e.write( `if (${r}.length < ${s} || ${r}.length > ${a.length}) return INVALID;`, ); let l = R(t); e.write(`const ${l} = [];`); for (let n = 0; n < a.length; n++) { let i = a[n]; if (n >= c) (e.write(`if (${l}.length === ${n}) {`), e.indented((e) => { (e.write(`if (${n} < ${r}.length) {`), e.indented((e) => { let a = R(t); e.write(`const ${a} = ${r}[${n}];`); let o = z(e, t, i, a); e.write(`${l}[${n}] = ${o};`); }), e.write(`} else {`), e.indented((e) => { if ($i(i)) { e.write(`${l}.length = ${n};`); return; } let r = R(t), a = R(t); (e.write(`const ${r} = undefined;`), e.write(`const ${a} = (() => {`), e.indented((e) => { let n = z(e, t, i, r); e.write(`return ${n};`); }), e.write(`})();`), e.write( `if (${a} === INVALID || ${a} === undefined) ${l}.length = ${n};`, ), e.write(`else ${l}[${n}] = ${a};`)); }), e.write(`}`)); }), e.write(`}`)); else { let a = R(t); e.write(`const ${a} = ${r}[${n}];`); let o = z(e, t, i, a); e.write(`${l}[${n}] = ${o};`); } } if (o) { let n = R(t), i = R(t); (e.write(`for (let ${n} = ${a.length}; ${n} < ${r}.length; ${n}++) {`), e.indented((e) => { e.write(`const ${i} = ${r}[${n}];`); let a = z(e, t, o, i); e.write(`${l}[${n}] = ${a};`); }), e.write(`}`)); } return l; } function la(e, t) { for (let n = e.length - 1; n >= 0; n--) if ( !(t === `optin` ? e[n]._zod.optin !== void 0 : e[n]._zod.optout === `optional`) ) return n + 1; return 0; } function ua(e, t, n, r) { let i = n._zod.def, a = i.options; if (i.discriminator) return da(e, t, i, r); if (i.inclusive === !1) throw new F(`exclusive unions (z.xor)`); if (a.length === 0) return (e.write(`return INVALID;`), r); if (a.length === 1) return V(e, t, a[0], r); if ( a.every((e) => e._zod.def.type === `literal` && !e._zod.def.checks?.length) ) { let n = I(t, new Set(a.flatMap((e) => e._zod.def.values))); return (e.write(`if (!${n}.has(${r})) return INVALID;`), r); } let o = R(t); e.write(`let ${o};`); for (let n = 0; n < a.length; n++) { let i = a[n]; (n === 0 ? e.write(`${o} = (() => {`) : e.write(`if (${o} === INVALID) ${o} = (() => {`), e.indented((e) => { let n = V(e, t, i, r); e.write(`return ${n};`); }), e.write(`})();`)); } return (e.write(`if (${o} === INVALID) return INVALID;`), o); } function da(e, t, n, r) { if (n.unionFallback) throw new F(`discriminated union with unionFallback`); if (n.options.length === 0) return (e.write(`return INVALID;`), r); let i = R(t), a = R(t); (e.write(`const ${i} = ${r}?.[${_(n.discriminator)}];`), e.write(`let ${a};`)); let o = !0, s = /* @__PURE__ */ new Set(); for (let c of n.options) { let l = c._zod.propValues?.[n.discriminator]; if (!l || l.size === 0) throw new F( `discriminated union option without static discriminator values`, ); for (let e of l) { if (s.has(e)) throw new F(`duplicate discriminator value ${String(e)}`); s.add(e); } let u = Array.from(l, (e) => fa(t, i, e)), d = o ? `if` : `else if`; (e.write(`${d} (${u.join(` || `)}) {`), e.indented((e) => { let n = V(e, t, c, r); e.write(`${a} = ${n};`); }), e.write(`}`), (o = !1)); } return (e.write(`else { return INVALID; }`), a); } function fa(e, t, n) { if (typeof n == `string`) return `${t} === ${_(n)}`; if (typeof n == `number`) return Number.isNaN(n) ? `Number.isNaN(${t})` : `${t} === ${n}`; if (typeof n == `boolean`) return `${t} === ${n}`; if (n === null) return `${t} === null`; if (n === void 0) return `${t} === undefined`; if (typeof n == `bigint`) return `${t} === ${n}n`; if (typeof n == `symbol`) return `${t} === ${I(e, n)}`; throw new F(`literal discriminator value ${String(n)}`); } function pa(e, t, n, r) { let i = n._zod.def; t.definite = !1; let a = z(e, t, i.left, r), o = z(e, t, i.right, r), s = I(t, Tr), c = R(t); return ( e.write(`const ${c} = ${s}(${a}, ${o});`), e.write(`if (!${c}.valid) return INVALID;`), `${c}.data` ); } function ma(e, t, n, r) { let i = n._zod.def, a = I(t, v); e.write(`if (!${a}(${r})) return INVALID;`); let o = R(t), s = R(t), c = R(t); e.write(`const ${o} = {};`); let l = i, u = l.partial ? void 0 : i.keyType._zod.values; if (u) { let n = []; for (let a of u) { if (typeof a != `string` && typeof a != `number` && typeof a != `symbol`) throw new F(`record key value ${String(a)}`); let s = typeof a == `number` ? a.toString() : a; if (s === `__proto__`) throw new F(`record key "__proto__"`); n.push(s); let c = I(t, a), l = V(e, t, i.keyType, c), u = R(t); e.write(`const ${u} = ${r}[${ga(t, s)}];`); let d = z(e, t, i.valueType, u); e.write(`${o}[${l}] = ${d};`); } let a = I(t, new Set(n)); return ( e.write(`for (const ${s} in ${r}) {`), e.indented((e) => { (e.write(`if (${a}.has(${s})) continue;`), l.mode === `loose` ? e.write(`if (${s} !== "__proto__") ${o}[${s}] = ${r}[${s}];`) : e.write(`return INVALID;`)); }), e.write(`}`), o ); } let d = i.keyType._zod.def; if ( d.type !== `string` || d.format !== void 0 || d.coerce || (d.checks?.length ?? 0) !== 0 ) { let n = i.mode === `loose`, a = vi(i.keyType); a.definite === !1 && (t.definite = !1); let c = I(t, a), l = I(t, qt), u = R(t); return ( ha(e, t, r, s, (e) => { (e.write(`let ${u} = ${c}(${s});`), e.write( `if (${u} === INVALID && typeof ${s} === "string" && ${l}.test(${s})) ${u} = ${c}(Number(${s}));`, ), n ? e.write( `if (${u} === INVALID) { ${o}[${s}] = ${r}[${s}]; continue; }`, ) : e.write(`if (${u} === INVALID) return INVALID;`), e.write(`if (${u} === "__proto__") continue;`)); let a = R(t); e.write(`const ${a} = ${r}[${s}];`); let d = z(e, t, i.valueType, a); e.write(`${o}[${u}] = ${d};`); }), o ); } return ( ha( e, t, r, s, (e) => { e.write(`const ${c} = ${r}[${s}];`); let n = z(e, t, i.valueType, c); e.write(`${o}[${s}] = ${n};`); }, `return INVALID;`, ), o ); } function ha(e, t, n, r, i, a) { let o = I(t, Object.prototype.propertyIsEnumerable), s = R(t), c = R(t), l = R(t); (e.write(`const ${s} = Object.getOwnPropertySymbols(${n});`), e.write(`const ${c} = Object.getOwnPropertyNames(${n});`), e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`), e.indented((e) => { (e.write(`const ${r} = ${c}[${l}];`), e.write( `if (${r} === "__proto__" || !${o}.call(${n}, ${r})) continue;`, ), i(e)); }), e.write(`}`), e.write(`for (let ${l} = 0; ${l} < ${s}.length; ${l}++) {`), e.indented((e) => { (e.write(`const ${r} = ${s}[${l}];`), e.write(`if (!${o}.call(${n}, ${r})) continue;`), a ? e.write(a) : i(e)); }), e.write(`}`)); } function ga(e, t) { return typeof t == `string` ? _(t) : I(e, t); } function _a(e, t, n, r) { let i = n._zod.def; e.write(`if (!(${r} instanceof Map)) return INVALID;`); let a = R(t), o = R(t), s = R(t); return ( e.write(`const ${a} = new Map();`), e.write(`for (const [${o}, ${s}] of ${r}) {`), e.indented((e) => { let n = V(e, t, i.keyType, o), r = V(e, t, i.valueType, s); e.write(`${a}.set(${n}, ${r});`); }), e.write(`}`), a ); } function va(e, t, n, r) { let i = n._zod.def; e.write(`if (!(${r} instanceof Set)) return INVALID;`); let a = R(t), o = R(t); return ( e.write(`const ${a} = new Set();`), e.write(`for (const ${o} of ${r}) {`), e.indented((e) => { let n = V(e, t, i.valueType, o); e.write(`${a}.add(${n});`); }), e.write(`}`), a ); } function ya(e, t) { return (e.write(`if (!(${t} instanceof File)) return INVALID;`), t); } function ba(e, t, n, r) { e.write(`if (typeof ${r} !== "string") return INVALID;`); let i = n._zod.pattern; if (i) { let n = I(t, i); (e.write(`${n}.lastIndex = 0;`), e.write(`if (!${n}.test(${r})) return INVALID;`)); } return r; } function xa(e, t, n, r) { let i = n._zod.def, a = L(t, i.getter), o = I(t, { parser: null }); (e.write(`if (!${o}.parser) {`), e.indented((e) => { (e.write(`const inner = ${a}();`), e.write(`${o}.parser = function(input) {`), e.indented((e) => { (e.write( `const result = inner._zod.run({ value: input, issues: [] }, {});`, ), e.write( `return result.issues.length === 0 ? result.value : INVALID;`, )); }), e.write(`};`)); }), e.write(`}`)); let s = R(t); return ( e.write(`const ${s} = ${o}.parser(${r});`), e.write(`if (${s} === INVALID) return INVALID;`), s ); } function Sa(e, t, n, r) { let i = n._zod.def, a = V(e, t, i.in, r); if (i.transform) { if (W(i.transform)) throw new P(`z.compile: async transforms in pipes are not supported`); let n = i.transform, r = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }, r = n(e, t); return r instanceof Promise ? N : t.issues.length === 0 ? r : N; }), o = R(t); return ( e.write(`const ${o} = ${r}(${a});`), e.write(`if (${o} === INVALID) return INVALID;`), V(e, t, i.out, o) ); } return V(e, t, i.out, a); } function W(e) { return ( typeof e == `function` && (e.constructor.name === `AsyncFunction` || e[Symbol.toStringTag] === `AsyncFunction`) ); } function Ca(e, t, n, r) { let i = n._zod.def; if (i.fn) { if (W(i.fn)) throw new P(`z.compile: async custom predicates are not supported`); let n = L(t, i.fn), a = I(t, Pi), o = R(t); (e.write(`const ${o} = ${n}(${r});`), e.write(`if (${o} instanceof Promise) ${a}();`), e.write(`if (!${o}) return INVALID;`)); } else throw new F(`custom schema without a predicate function`); return r; } function wa(e, t, n) { let r = e._zod.run({ value: n, issues: [] }, {}); if (r && typeof r.then == `function`) return N; let i = r; return i.issues.length === 0 ? i.value : t(); } function Ta(e, t, n, r) { let i = n._zod.def; if (!i.catchValue[`~constantCatch`]) throw new F( `catch with a callback (only a constant catch value compiles)`, !1, ); let a = R(t); (e.write(`let ${a} = (() => {`), e.indented((e) => { let n = z(e, t, i.innerType, r); e.write(`return ${n};`); }), e.write(`})();`)); let o = I(t, i.innerType), s = L(t, i.catchValue), c = I(t, wa); return ( e.write(`if (${a} === INVALID) {`), e.indented((e) => { (e.write(`${a} = ${c}(${o}, ${s}, ${r});`), e.write(`if (${a} === INVALID) return INVALID;`)); }), e.write(`}`), a ); } function Ea(e, t, n, r) { let i = n._zod.def; if (i.transform) { if (W(i.transform)) throw new P(`z.compile: async transforms are not supported`); let n = i.transform, a = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }, r = n(e, t); return r instanceof Promise ? N : t.issues.length === 0 ? r : N; }), o = R(t); return ( e.write(`const ${o} = ${a}(${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } return r; } function Da(e) { return ((e.checks &&= [...e.checks]), e); } // @__NO_SIDE_EFFECTS__ function Oa(e, t) { return new e(Da({ type: `string`, ...b(t) })); } // @__NO_SIDE_EFFECTS__ function ka(e, t) { return new e({ type: `string`, format: `email`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Aa(e, t) { return new e({ type: `string`, format: `guid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function ja(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ma(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v4`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Na(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v6`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Pa(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v7`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Fa(e, t) { return new e({ type: `string`, format: `url`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ia(e, t) { return new e({ type: `string`, format: `emoji`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function La(e, t) { return new e({ type: `string`, format: `nanoid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ra(e, t) { return new e({ type: `string`, format: `cuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function za(e, t) { return new e({ type: `string`, format: `cuid2`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ba(e, t) { return new e({ type: `string`, format: `ulid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Va(e, t) { return new e({ type: `string`, format: `xid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ha(e, t) { return new e({ type: `string`, format: `ksuid`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ua(e, t) { return new e({ type: `string`, format: `ipv4`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Wa(e, t) { return new e({ type: `string`, format: `ipv6`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ga(e, t) { return new e({ type: `string`, format: `cidrv4`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ka(e, t) { return new e({ type: `string`, format: `cidrv6`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function qa(e, t) { return new e({ type: `string`, format: `base64`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ja(e, t) { return new e({ type: `string`, format: `base64url`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Ya(e, t) { return new e({ type: `string`, format: `e164`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Xa(e, t) { return new e({ type: `string`, format: `jwt`, check: `string_format`, abort: !1, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Za(e, t) { return new e({ type: `string`, format: `datetime`, check: `string_format`, offset: !1, local: !1, precision: null, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Qa(e, t) { return new e({ type: `string`, format: `date`, check: `string_format`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function $a(e, t) { return new e({ type: `string`, format: `time`, check: `string_format`, precision: null, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function eo(e, t) { return new e({ type: `string`, format: `duration`, check: `string_format`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function to(e, t) { return new e(Da({ type: `number`, checks: [], ...b(t) })); } // @__NO_SIDE_EFFECTS__ function no(e, t) { return new e({ type: `number`, check: `number_format`, abort: !1, format: `safeint`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function ro(e) { return new e({ type: `unknown` }); } // @__NO_SIDE_EFFECTS__ function io(e, t) { return new e({ type: `never`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function ao(e, t) { return new e({ type: `date`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function oo(e, t) { return new Qt({ check: `less_than`, ...b(t), value: e, inclusive: !1 }); } // @__NO_SIDE_EFFECTS__ function so(e, t) { return new Qt({ check: `less_than`, ...b(t), value: e, inclusive: !0 }); } // @__NO_SIDE_EFFECTS__ function co(e, t) { return new $t({ check: `greater_than`, ...b(t), value: e, inclusive: !1 }); } // @__NO_SIDE_EFFECTS__ function lo(e, t) { return new $t({ check: `greater_than`, ...b(t), value: e, inclusive: !0 }); } // @__NO_SIDE_EFFECTS__ function uo(e, t) { return new en({ check: `multiple_of`, ...b(t), value: e }); } // @__NO_SIDE_EFFECTS__ function fo(e, t) { return new nn({ check: `max_length`, ...b(t), maximum: e }); } // @__NO_SIDE_EFFECTS__ function po(e, t) { return new rn({ check: `min_length`, ...b(t), minimum: e }); } // @__NO_SIDE_EFFECTS__ function mo(e, t) { return new an({ check: `length_equals`, ...b(t), length: e }); } // @__NO_SIDE_EFFECTS__ function ho(e, t) { return new sn({ check: `string_format`, format: `regex`, ...b(t), pattern: e, }); } // @__NO_SIDE_EFFECTS__ function go(e) { return new cn({ check: `string_format`, format: `lowercase`, ...b(e) }); } // @__NO_SIDE_EFFECTS__ function _o(e) { return new ln({ check: `string_format`, format: `uppercase`, ...b(e) }); } // @__NO_SIDE_EFFECTS__ function vo(e, t) { return new un({ check: `string_format`, format: `includes`, ...b(t), includes: e, }); } // @__NO_SIDE_EFFECTS__ function yo(e, t) { return new dn({ check: `string_format`, format: `starts_with`, ...b(t), prefix: e, }); } // @__NO_SIDE_EFFECTS__ function bo(e, t) { return new fn({ check: `string_format`, format: `ends_with`, ...b(t), suffix: e, }); } // @__NO_SIDE_EFFECTS__ function xo(e) { return new pn({ check: `overwrite`, tx: e }); } // @__NO_SIDE_EFFECTS__ function So(e) { return /* @__PURE__ */ xo((t) => t.normalize(e)); } // @__NO_SIDE_EFFECTS__ function Co() { return /* @__PURE__ */ xo((e) => e.trim()); } // @__NO_SIDE_EFFECTS__ function wo() { return /* @__PURE__ */ xo((e) => e.toLowerCase()); } // @__NO_SIDE_EFFECTS__ function To() { return /* @__PURE__ */ xo((e) => e.toUpperCase()); } // @__NO_SIDE_EFFECTS__ function Eo() { return /* @__PURE__ */ xo((e) => ee(e)); } // @__NO_SIDE_EFFECTS__ function Do(e, t, n) { return new e({ type: `array`, element: t, ...b(n) }); } // @__NO_SIDE_EFFECTS__ function Oo(e, t, n) { return new e({ type: `custom`, check: `custom`, fn: t, ...b(n) }); } // @__NO_SIDE_EFFECTS__ function ko(e, t) { let n = /* @__PURE__ */ Ao( (t) => ( (t.addIssue = (e) => { if (typeof e == `string`) t.issues.push(Oe(e, t.value, n._zod.def)); else { let r = e; (r.fatal && (r.continue = !1), (r.code ??= `custom`), `input` in r || (r.input = t.value), (r.inst ??= n), (r.continue ??= !n._zod.def.abort), t.issues.push(Oe(r))); } }), e(t.value, t) ), t, ); return n; } // @__NO_SIDE_EFFECTS__ function Ao(e, t) { let n = new A({ check: `custom`, ...b(t) }); return ((n._zod.check = e), n); } function jo(e, ...t) { for (let n of t) for (let t of Reflect.ownKeys(n)) Object.prototype.propertyIsEnumerable.call(n, t) && l(e, t, n[t]); return e; } function Mo(e) { let t = e?.target ?? `draft-2020-12`; return ( t === `draft-4` && (t = `draft-04`), t === `draft-7` && (t = `draft-07`), { processors: e.processors ?? {}, metadataRegistry: e?.metadata ?? fi, target: t, unrepresentable: e?.unrepresentable ?? `throw`, override: e?.override ?? (() => {}), io: e?.io ?? `output`, counter: 0, seen: /* @__PURE__ */ new Map(), sharedDefsExtractedFor: void 0, sharedEmitDoneFor: void 0, cycles: e?.cycles ?? `ref`, reused: e?.reused ?? `inline`, intersections: [], deferred: [], external: e?.external ?? void 0, } ); } function G(e, t, n, r, i) { let a = typeof t.unrepresentable == `function` ? t.unrepresentable({ zodSchema: e, path: r.path, message: i }) : t.unrepresentable; if (a === `any`) return !1; if (a === void 0 || a === `throw`) throw Error(i); return (Object.assign(n, a), !0); } function K(e, t, n = { path: [], schemaPath: [] }) { var r; let i = e._zod.def, a = t.seen.get(e); if (a) return ( a.count++, n.schemaPath.includes(e) && (a.cycle = n.path), a.schema ); let o = { schema: {}, count: 1, cycle: void 0, path: n.path }; (t.seen.set(e, o), (t.sharedDefsExtractedFor = void 0), (t.sharedEmitDoneFor = void 0)); let s = e._zod.toJSONSchema?.(); if (s) o.schema = s; else { let r = { ...n, schemaPath: [...n.schemaPath, e], path: n.path }; if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, o.schema, r); else { let n = o.schema, a = t.processors[i.type]; if (!a) throw Error( `[toJSONSchema]: Non-representable type encountered: ${i.type}`, ); a(e, t, n, r); } let a = e._zod.parent; a && ((o.ref ||= a), K(a, t, r), (t.seen.get(a).isParent = !0)); } let c = t.metadataRegistry.get(e); return ( c && jo(o.schema, c), t.io === `input` && q(e) && (delete o.schema.examples, delete o.schema.default), t.io === `input` && `_prefault` in o.schema && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, t.seen.get(e).schema ); } function No(e) { return e.replace(/~/g, `~0`).replace(/\//g, `~1`); } function Po(e, t) { let n = e.seen.get(t); if (!n) throw Error(`Unprocessed schema. This is a bug in Zod.`); if (e.external && e.sharedDefsExtractedFor === e.external) return; let r = /* @__PURE__ */ new Map(); for (let t of e.seen.entries()) { let n = e.metadataRegistry.get(t[0])?.id; if (n) { let e = r.get(n); if (e && e !== t[0]) throw Error( `Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`, ); r.set(n, t[0]); } } let i = (t) => { let r = e.target === `draft-2020-12` ? `$defs` : `definitions`; if (e.external) { let n = e.external.registry.get(t[0])?.id, i = e.external.uri ?? ((e) => e); if (n) return { ref: i(n) }; let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`; return ( (t[1].defId = a), { defId: a, ref: `${i(`__shared`)}#/${r}/${No(a)}` } ); } let i = `#/${r}/`; if (t[1] === n && !t[1].schema.id) return { ref: `#` }; let a = t[1].schema.id ?? `__schema${e.counter++}`; return { defId: a, ref: i + No(a) }; }, a = (e) => { if (e[1].schema.$ref) return; let t = e[1], { ref: n, defId: r } = i(e); ((t.def = { ...t.schema }), r && (t.defId = r)); let a = t.schema; for (let e in a) delete a[e]; a.$ref = n; }; if (e.cycles === `throw`) for (let t of e.seen.entries()) { let e = t[1]; if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root> Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`); } for (let n of e.seen.entries()) { let r = n[1]; if (t === n[0]) { a(n); continue; } if (e.external) { let r = e.external.registry.get(n[0])?.id; if (t !== n[0] && r) { a(n); continue; } } if (e.metadataRegistry.get(n[0])?.id) { a(n); continue; } if (r.cycle) { a(n); continue; } r.count > 1 && e.reused === `ref` && a(n); } e.external && (e.sharedDefsExtractedFor = e.external); } function Fo(e) { let t = e.anyOf; if (!Array.isArray(t) || t.length === 0 || e.type !== void 0) return; let n = []; for (let e of t) { if (!e || typeof e != `object`) return; Fo(e); let t = Object.keys(e); if (t.length !== 1 || t[0] !== `type`) return; let r = e.type; for (let e of Array.isArray(r) ? r : [r]) { if (typeof e != `string`) return; n.includes(e) || n.push(e); } } (delete e.anyOf, (e.type = n.length === 1 ? n[0] : n)); } const Io = /* @__PURE__ */ new Set([ `type`, `properties`, `required`, `additionalProperties`, ]), Lo = [`oneOf`, `anyOf`]; function Ro(e) { let t = e.additionalProperties; return t === void 0 || t === !1 || typeof t != `object` || !t ? null : Object.keys(t).length ? t : null; } function zo(e) { let t = []; for (let n of e) { if (typeof n != `object` || n.type !== `object`) return null; for (let e in n) if (!Io.has(e)) return null; t.push(n); } let n = {}, r = /* @__PURE__ */ new Set(); for (let e of t) { for (let r in e.properties) { if (Object.prototype.hasOwnProperty.call(n, r)) continue; let e = []; for (let n of t) { let t = n.properties?.[r] ?? Ro(n); t != null && (e.some((e) => JSON.stringify(e) === JSON.stringify(t)) || e.push(t)); } l(n, r, e.length === 1 ? e[0] : (zo(e) ?? { allOf: e })); } for (let t of e.required ?? []) r.add(t); } let i = { type: `object`, properties: n }; if ( (r.size && (i.required = [...r]), t.every((e) => e.additionalProperties === !1)) ) i.additionalProperties = !1; else { let e = []; for (let n of t) { let t = Ro(n); t && !e.some((e) => JSON.stringify(e) === JSON.stringify(t)) && e.push(t); } e.length === 1 ? (i.additionalProperties = e[0]) : e.length > 1 && (i.additionalProperties = { allOf: e }); } return i; } function Bo(e) { let t = e.allOf; if (!Array.isArray(t) || t.length < 2) return; for (let t of Io) if (t in e) return; let n = t.filter((e) => Lo.some((t) => Array.isArray(e[t]))), r = null; if (!n.length) r = zo(t); else { let e = n[0], i = Lo.find((t) => Array.isArray(e[t])); if (Object.keys(e).length !== 1) return; let a = t.filter((t) => t !== e), o = e[i].map((e) => zo([...a, e])); if (o.some((e) => !e)) return; r = { [i]: o }; } r && (delete e.allOf, jo(e, r)); } function Vo(e, t) { let n = e.seen.get(t); if (!n) throw Error(`Unprocessed schema. This is a bug in Zod.`); let r = (t) => { let n = e.seen.get(t); if (n.ref === null) return; let i = n.def ?? n.schema, a = { ...i }, o = n.ref; if (((n.ref = null), o)) { r(o); let n = e.seen.get(o), s = n.schema; if ( (s.$ref && (e.target === `draft-07` || e.target === `draft-04` || e.target === `openapi-3.0`) ? ((i.allOf = i.allOf ?? []), i.allOf.push(s)) : jo(i, s), jo(i, a), t._zod.parent === o) ) for (let e in i) e !== `$ref` && e !== `allOf` && (e in a || delete i[e]); if (s.$ref && n.def) for (let e in i) e !== `$ref` && e !== `allOf` && e in n.def && JSON.stringify(i[e]) === JSON.stringify(n.def[e]) && delete i[e]; } let s = t._zod.parent; if (s && s !== o) { r(s); let t = e.seen.get(s); if (t?.schema.$ref && ((i.$ref = t.schema.$ref), t.def)) for (let e in i) e !== `$ref` && e !== `allOf` && e in t.def && JSON.stringify(i[e]) === JSON.stringify(t.def[e]) && delete i[e]; } e.override({ zodSchema: t, jsonSchema: i, path: n.path ?? [] }); }; if (!e.external || e.sharedEmitDoneFor !== e.external) { for (let t of [...e.seen.entries()].reverse()) r(t[0]); if (e.target !== `openapi-3.0`) for (let t of e.seen.entries()) Fo(t[1].def ?? t[1].schema); for (let t of e.deferred) t(); if (e.intersections.length) { let t = /* @__PURE__ */ new Map(); for (let n of e.seen.values()) for (let e of [n.schema, n.def]) { let n = e?.allOf; if (!Array.isArray(n)) continue; let r = t.get(n); r ? r.push(e) : t.set(n, [e]); } for (let n of e.intersections) for (let e of t.get(n) ?? []) Bo(e); } } let i = {}; if ( (e.target === `draft-2020-12` ? (i.$schema = `https://json-schema.org/draft/2020-12/schema`) : e.target === `draft-07` ? (i.$schema = `http://json-schema.org/draft-07/schema#`) : e.target === `draft-04` ? (i.$schema = `http://json-schema.org/draft-04/schema#`) : e.target, e.external?.uri) ) { let n = e.external.registry.get(t)?.id; if (!n) throw Error("Schema is missing an `id` property"); i.$id = e.external.uri(n); } jo(i, n.defId ? n.schema : (n.def ?? n.schema)); let a = e.metadataRegistry.get(t)?.id; a !== void 0 && i.id === a && delete i.id; let o = e.external?.defs ?? {}; if (!e.external || e.sharedEmitDoneFor !== e.external) for (let t of e.seen.entries()) { let e = t[1]; e.def && e.defId && (e.def.id === e.defId && delete e.def.id, l(o, e.defId, e.def)); } (e.external && (e.sharedEmitDoneFor = e.external), e.external || (Object.keys(o).length > 0 && (e.target === `draft-2020-12` ? (i.$defs = o) : (i.definitions = o)))); try { let n = JSON.parse(JSON.stringify(i)); return ( Object.defineProperty(n, "~standard", { value: { ...t[`~standard`], jsonSchema: { input: Uo(t, `input`, e.processors), output: Uo(t, `output`, e.processors), }, }, enumerable: !1, writable: !1, }), n ); } catch { throw Error(`Error converting schema to JSON.`); } } function q(e, t) { let n = t ?? { seen: /* @__PURE__ */ new Set() }; if (n.seen.has(e)) return !1; n.seen.add(e); let r = e._zod.def; if (r.type === `transform`) return !0; if (r.type === `array`) return q(r.element, n); if (r.type === `set`) return q(r.valueType, n); if (r.type === `lazy`) return q(r.getter(), n); if ( r.type === `promise` || r.type === `optional` || r.type === `nonoptional` || r.type === `nullable` || r.type === `readonly` || r.type === "default" || r.type === `prefault` || r.type === `catch` ) return q(r.innerType, n); if (r.type === `intersection`) return q(r.left, n) || q(r.right, n); if (r.type === `record` || r.type === `map`) return q(r.keyType, n) || q(r.valueType, n); if (r.type === `pipe`) return e._zod.traits.has(`$ZodCodec`) ? !0 : q(r.in, n) || q(r.out, n); if (r.type === `object`) { for (let e in r.shape) if (q(r.shape[e], n)) return !0; return !1; } if (r.type === `union`) { for (let e of r.options) if (q(e, n)) return !0; return !1; } if (r.type === `tuple`) { for (let e of r.items) if (q(e, n)) return !0; return !!(r.rest && q(r.rest, n)); } return !1; } const Ho = (e, t = {}) => (n) => { let r = Mo({ ...n, processors: t }); return (K(e, r), Po(r, e), Vo(r, e)); }, Uo = (e, t, n = {}) => (r) => { let { libraryOptions: i, target: a } = r ?? {}, o = Mo({ ...(i ?? {}), target: a, io: t, processors: n }); return (K(e, o), Po(o, e), Vo(o, e)); }, Wo = (e, t, n) => { (e[t] === void 0 || n > e[t]) && (e[t] = n); }, Go = (e, t, n) => { (e[t] === void 0 || n < e[t]) && (e[t] = n); }, Ko = (e, t) => { (Wo(e, `minimum`, t), Go(e, `maximum`, t)); }, qo = (e, t) => { ((e.multipleOf ??= []), e.multipleOf.includes(t) || e.multipleOf.push(t)); }, Jo = (e, t) => { ((e.patterns ??= /* @__PURE__ */ new Set()), e.patterns.add(t)); }, Yo = (e, t) => { e.mime = e.mime ? e.mime.filter((e) => t.includes(e)) : [...t]; }, Xo = (e, t) => { ((e.format = t), t.includes(`int`) && (e.isInt = !0)); }, Zo = (e, t) => Wo(e, `minimum`, t.minimum), Qo = (e, t) => Go(e, `maximum`, t.maximum), $o = (e) => (t, n) => { Xo(t, n.format); let [r, i] = e[n.format]; (Wo(t, `minimum`, r), Go(t, `maximum`, i)); }, es = { greater_than: (e, t) => Wo(e, t.inclusive ? `minimum` : `exclusiveMinimum`, t.value), less_than: (e, t) => Go(e, t.inclusive ? `maximum` : `exclusiveMaximum`, t.value), multiple_of: (e, t) => qo(e, t.value), number_format: $o(le), bigint_format: $o(ue), min_length: Zo, max_length: Qo, length_equals: (e, t) => Ko(e, t.length), min_size: Zo, max_size: Qo, size_equals: (e, t) => Ko(e, t.size), string_format: (e, t) => { (Xo(e, t.format), t.pattern && Jo(e, t.pattern), (t.format === `base64` || t.format === `base64url`) && (e.contentEncoding = t.format), (t.local || t.precision === -1) && (e.laxFormat = !0)); }, mime_type: (e, t) => Yo(e, t.mime), }; function J(e) { let t = {}, n = e._zod.def, r = e._zod.traits.has(`$ZodCheck`) ? [e, ...(n.checks ?? [])] : (n.checks ?? []); for (let e of r) es[e._zod.def.check]?.(t, e._zod.def); let i = e._zod.bag; (i.minimum !== void 0 && Wo(t, `minimum`, i.minimum), i.exclusiveMinimum !== void 0 && Wo(t, `exclusiveMinimum`, i.exclusiveMinimum), i.maximum !== void 0 && Go(t, `maximum`, i.maximum), i.exclusiveMaximum !== void 0 && Go(t, `exclusiveMaximum`, i.exclusiveMaximum), i.multipleOf !== void 0 && qo(t, i.multipleOf), i.format !== void 0 && ((t.format ??= i.format), i.format.includes(`int`) && (t.isInt = !0)), i.mime && Yo(t, i.mime)); for (let e of i.patterns ?? []) Jo(t, e); return t; } const ts = { guid: `uuid`, url: `uri`, datetime: `date-time`, json_string: `json-string`, regex: ``, }, ns = /* @__PURE__ */ new Map([ [Xn, Pt], [Qn, Ft], ]), rs = (e) => ns.get(e) ?? e, is = (e, t, n, r) => { let i = n; i.type = `string`; let { minimum: a, maximum: o, format: s, patterns: c, contentEncoding: l, laxFormat: u, } = J(e); if ( (typeof a == `number` && (i.minLength = a), typeof o == `number` && (i.maxLength = o), s && ((i.format = ts[s] ?? s), i.format === `` && delete i.format, (s === `time` || u) && delete i.format), l && (i.contentEncoding = l), c && c.size > 0) ) { let e = [...c].map(rs); e.length === 1 ? (i.pattern = e[0].source) : e.length > 1 && (i.allOf = [ ...e.map((e) => ({ ...(t.target === `draft-07` || t.target === `draft-04` || t.target === `openapi-3.0` ? { type: `string` } : {}), pattern: e.source, })), ]); } }, as = (e, t, n, r) => { let i = n, { minimum: a, maximum: o, multipleOf: s, exclusiveMaximum: c, exclusiveMinimum: l, isInt: u, } = J(e); i.type = u ? `integer` : `number`; let d = typeof l == `number` && l >= (a ?? -1 / 0), f = typeof c == `number` && c <= (o ?? 1 / 0), p = t.target === `draft-04` || t.target === `openapi-3.0`; if ( (d ? p ? ((i.minimum = l), (i.exclusiveMinimum = !0)) : (i.exclusiveMinimum = l) : typeof a == `number` && (i.minimum = a), f ? p ? ((i.maximum = c), (i.exclusiveMaximum = !0)) : (i.exclusiveMaximum = c) : typeof o == `number` && (i.maximum = o), s) ) { let n = /* @__PURE__ */ new Set(); for (let a of s) Number.isFinite(a) && a !== 0 ? n.add(Math.abs(a)) : G( e, t, i, r, `A multipleOf divisor of ${a} cannot be represented in JSON Schema`, ); let [a, ...o] = n; (a !== void 0 && (i.multipleOf = a), o.length && (i.allOf = [ ...(i.allOf ?? []), ...o.map((e) => ({ multipleOf: e })), ])); } }, os = (e, t, n, r) => { n.not = {}; }, ss = (e, t, n, r) => { G(e, t, n, r, `Date cannot be represented in JSON Schema`); }, cs = (e, n, r, i) => { let a = e._zod.def, o = t(a.entries); if (o.length === 0) { r.not = {}; return; } (o.every((e) => typeof e == `number`) && (r.type = `number`), o.every((e) => typeof e == `string`) && (r.type = `string`), (r.enum = o)); }, ls = (e, t, n, r) => { G(e, t, n, r, `Custom types cannot be represented in JSON Schema`); }, us = (e, t, n, r) => { G(e, t, n, r, `Transforms cannot be represented in JSON Schema`); }, ds = (e, t, n, r) => { let i = n, a = e._zod.def, { minimum: o, maximum: s } = J(e); (typeof o == `number` && (i.minItems = o), typeof s == `number` && (i.maxItems = s), (i.type = `array`), (i.items = K(a.element, t, { ...r, path: [...r.path, `items`] }))); }; function fs(e) { let t = e._zod.def; return t.type === `pipe` && t.in._zod.traits.has(`$ZodTransform`) ? fs(t.out) : t.type === `catch` ? fs(t.innerType) : e._zod.optin; } const ps = (e, t, n, r) => { let i = n, a = e._zod.def, o = a.shape; if ( Object.getOwnPropertySymbols(o).length && G(e, t, i, r, `Symbol keys cannot be represented in JSON Schema`) ) return; ((i.type = `object`), (i.properties = {})); for (let e in o) l( i.properties, e, K(o[e], t, { ...r, path: [...r.path, `properties`, e] }), ); let s = []; for (let e of Object.keys(o)) { let n = a.shape[e]; (t.io === `input` ? fs(n) === void 0 : n._zod.optout === void 0) && s.push(e); } (s.length > 0 && (i.required = s), a.catchall?._zod.def.type === `never` ? (i.additionalProperties = !1) : a.catchall ? a.catchall && (i.additionalProperties = K(a.catchall, t, { ...r, path: [...r.path, `additionalProperties`], })) : t.io === `output` && (i.additionalProperties = !1)); }, ms = (e, t, n, r) => { let i = e._zod.def, a = i.inclusive === !1, o = i.options.map((e, n) => K(e, t, { ...r, path: [...r.path, a ? `oneOf` : `anyOf`, n] }), ); a ? (n.oneOf = o) : (n.anyOf = o); }, hs = (e, t, n, r) => { let i = e._zod.def, a = K(i.left, t, { ...r, path: [...r.path, `allOf`, 0] }), o = K(i.right, t, { ...r, path: [...r.path, `allOf`, 1] }), s = (e) => `allOf` in e && Object.keys(e).length === 1, c = [...(s(a) ? a.allOf : [a]), ...(s(o) ? o.allOf : [o])]; ((n.allOf = c), t.intersections.push(c)); }, gs = (e, t, n, r) => { let i = e._zod.def, a = K(i.innerType, t, r), o = t.seen.get(e); t.target === `openapi-3.0` ? ((o.ref = i.innerType), (n.nullable = !0)) : (n.anyOf = [a, { type: `null` }]); }, _s = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; }, vs = Symbol(); function ys(e, t, n, r, i) { let a = !1, o = JSON.stringify(e, (e, t) => typeof t == `bigint` ? ((a = !0), null) : t, ); return a ? (G(t, n, r, i, `BigInt defaults cannot be represented in JSON Schema`), vs) : JSON.parse(o); } const bs = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; let o = ys(i.defaultValue, e, t, n, r); o !== vs && (n.default = o); }, xs = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); if (((a.ref = i.innerType), t.io !== `input`)) return; let o = ys(i.defaultValue, e, t, n, r); o !== vs && (n._prefault = o); }, Ss = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; let o; try { o = i.catchValue(void 0); } catch { G(e, t, n, r, `Dynamic catch values are not supported in JSON Schema`); return; } n.default = o; }, Cs = (e, t, n, r) => { let i = e._zod.def, a = i.in._zod.traits.has(`$ZodTransform`), o = t.io === `input` ? (a ? i.out : i.in) : i.out; K(o, t, r); let s = t.seen.get(e); s.ref = o; }, ws = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); ((a.ref = i.innerType), (n.readOnly = !0)); }, Ts = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; }, Es = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]); function Ds(e, t, n) { Object.defineProperty(e, t, { configurable: !0, enumerable: !1, get() { let e = n(this); return ( Object.defineProperty(this, t, { value: e, configurable: !0, writable: !0, }), e ); }, set(e) { Object.defineProperty(this, t, { value: e, configurable: !0, writable: !0, }); }, }); } const Y = /*@__PURE__*/ E( `ZodError`, (e, t) => { (Ye.init(e, t), (e.name = `ZodError`)); let n = Object.getPrototypeOf(e); Es.has(n) || (Es.add(n), Ds(n, `format`, (e) => (t) => Qe(e, t)), Ds(n, `flatten`, (e) => (t) => Ze(e, t)), Ds(n, `addIssue`, (e) => (t) => { (e.issues.push(t), (e.message = JSON.stringify(e.issues, r, 2))); }), Ds(n, `addIssues`, (e) => (t) => { (e.issues.push(...t), (e.message = JSON.stringify(e.issues, r, 2))); }), Object.defineProperty(n, "isEmpty", { configurable: !0, enumerable: !1, get() { return this.issues.length === 0; }, })); }, void 0, { Parent: Error }, ), Os = /* @__PURE__ */ et(Y), ks = /* @__PURE__ */ tt(Y), As = /* @__PURE__ */ nt(Y), js = /* @__PURE__ */ it(Y), Ms = /* @__PURE__ */ ut(Y), Ns = /* @__PURE__ */ dt(Y), Ps = /* @__PURE__ */ ft(Y), Fs = /* @__PURE__ */ pt(Y), Is = /* @__PURE__ */ mt(Y), Ls = /* @__PURE__ */ ht(Y), Rs = /* @__PURE__ */ gt(Y), zs = /* @__PURE__ */ _t(Y); function Bs() { O.localeError || k(ci()); } function Vs() { O.memoizer || k({ memoizer: ai() }); } const X = /*@__PURE__*/ E( `ZodType`, (e, t) => (Bs(), j.init(e, t), (e.def = t), (e.type = t.type), e), { check(...e) { let t = this.def; return this.clone( g(t, { checks: [ ...(t.checks ?? []), ...e.map((e) => typeof e == `function` ? { _zod: { check: e, def: { check: `custom` }, onattach: [], }, } : e, ), ], }), { parent: !0 }, ); }, with(...e) { return this.check(...e); }, clone(e, t) { return y(this, e, t); }, brand() { return this; }, register(e, t) { return (e.add(this, t), this); }, refine(e, t) { return this.check(el(e, t)); }, superRefine(e, t) { return this.check(tl(e, t)); }, overwrite(e) { return this.check(/* @__PURE__ */ xo(e)); }, optional() { return Ic(this); }, exactOptional() { return Rc(this); }, nullable() { return Bc(this); }, nullish() { return Ic(Bc(this)); }, nonoptional(e) { return Kc(this, e); }, array() { return wc(this); }, or(e) { return Oc([this, e]); }, and(e) { return Ac(this, e); }, transform(e) { return Xc(this, Pc(e)); }, default(e) { return Hc(this, e); }, prefault(e) { return Wc(this, e); }, catch(e) { return Jc(this, e); }, pipe(e) { return Xc(this, e); }, readonly() { return Qc(this); }, describe(e) { let t = this.clone(); return (fi.add(t, { description: e }), t); }, meta(...e) { if (e.length === 0) return fi.get(this); let t = this.clone(); return (fi.add(t, e[0]), t); }, isOptional() { return this.safeParse(void 0).success; }, isNullable() { return this.safeParse(null).success; }, apply(e, ...t) { return t.length === 0 ? e(this) : e(this, ...t); }, get "~standard"() { return Ae(this, `~standard`, { ...vn(this), jsonSchema: { input: Uo(this, `input`), output: Uo(this, `output`) }, }); }, set "~standard"(e) { C(this, `~standard`, e); }, parse: function e(t, n) { return Os(this, t, n, { callee: e }); }, parseAsync: async function e(t, n) { return await ks(this, t, n, { callee: e }); }, safeParse(e, t) { return As(this, e, t); }, async safeParseAsync(e, t) { return js(this, e, t); }, get spa() { return this?.safeParseAsync; }, set spa(e) { C(this, `spa`, e); }, validate(e, t) { return st(this, e, t); }, validateAsync(e, t) { return lt(this, e, t); }, encode: function e(t, n) { return Ms(this, t, n, { callee: e }); }, decode: function e(t, n) { return Ns(this, t, n, { callee: e }); }, encodeAsync: async function e(t, n) { return await Ps(this, t, n, { callee: e }); }, decodeAsync: async function e(t, n) { return await Fs(this, t, n, { callee: e }); }, safeEncode(e, t) { return Is(this, e, t); }, safeDecode(e, t) { return Ls(this, e, t); }, async safeEncodeAsync(e, t) { return Rs(this, e, t); }, async safeDecodeAsync(e, t) { return zs(this, e, t); }, toJSONSchema(e) { return Ho(this, {})(e); }, get description() { return fi.get(this)?.description; }, get _def() { return this._zod.def; }, }, ), Hs = /*@__PURE__*/ E( `_ZodString`, (e, t) => { (yn.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => is(e, t, n, r))); }, /*@__PURE__*/ je( { format: (e) => J(e).format ?? null, minLength: (e) => J(e).minimum ?? null, maxLength: (e) => J(e).maximum ?? null, }, { regex(...e) { return this.check(/* @__PURE__ */ ho(...e)); }, includes(...e) { return this.check(/* @__PURE__ */ vo(...e)); }, startsWith(...e) { return this.check(/* @__PURE__ */ yo(...e)); }, endsWith(...e) { return this.check(/* @__PURE__ */ bo(...e)); }, min(...e) { return this.check(/* @__PURE__ */ po(...e)); }, max(...e) { return this.check(/* @__PURE__ */ fo(...e)); }, length(...e) { return this.check(/* @__PURE__ */ mo(...e)); }, nonempty(...e) { return this.check(/* @__PURE__ */ po(1, ...e)); }, lowercase(e) { return this.check(/* @__PURE__ */ go(e)); }, uppercase(e) { return this.check(/* @__PURE__ */ _o(e)); }, trim() { return this.check(/* @__PURE__ */ Co()); }, normalize(...e) { return this.check(/* @__PURE__ */ So(...e)); }, toLowerCase() { return this.check(/* @__PURE__ */ wo()); }, toUpperCase() { return this.check(/* @__PURE__ */ To()); }, slugify() { return this.check(/* @__PURE__ */ Eo()); }, }, ), ), Us = /*@__PURE__*/ E( `ZodString`, (e, t) => { (yn.init(e, t), Hs.init(e, t)); }, { email(e) { return this.check(/* @__PURE__ */ ka(Js, e)); }, url(e) { return this.check(/* @__PURE__ */ Fa(Zs, e)); }, jwt(e) { return this.check(/* @__PURE__ */ Xa(pc, e)); }, emoji(e) { return this.check(/* @__PURE__ */ Ia($s, e)); }, guid(e) { return this.check(/* @__PURE__ */ Aa(Ys, e)); }, uuid(e) { return this.check(/* @__PURE__ */ ja(Xs, e)); }, uuidv4(e) { return this.check(/* @__PURE__ */ Ma(Xs, e)); }, uuidv6(e) { return this.check(/* @__PURE__ */ Na(Xs, e)); }, uuidv7(e) { return this.check(/* @__PURE__ */ Pa(Xs, e)); }, nanoid(e) { return this.check(/* @__PURE__ */ La(ec, e)); }, cuid(e) { return this.check(/* @__PURE__ */ Ra(tc, e)); }, cuid2(e) { return this.check(/* @__PURE__ */ za(nc, e)); }, ulid(e) { return this.check(/* @__PURE__ */ Ba(rc, e)); }, base64(e) { return this.check(/* @__PURE__ */ qa(uc, e)); }, base64url(e) { return this.check(/* @__PURE__ */ Ja(dc, e)); }, xid(e) { return this.check(/* @__PURE__ */ Va(ic, e)); }, ksuid(e) { return this.check(/* @__PURE__ */ Ha(ac, e)); }, ipv4(e) { return this.check(/* @__PURE__ */ Ua(oc, e)); }, ipv6(e) { return this.check(/* @__PURE__ */ Wa(sc, e)); }, cidrv4(e) { return this.check(/* @__PURE__ */ Ga(cc, e)); }, cidrv6(e) { return this.check(/* @__PURE__ */ Ka(lc, e)); }, e164(e) { return this.check(/* @__PURE__ */ Ya(fc, e)); }, datetime(e) { return this.check(/* @__PURE__ */ Za(Ws, e)); }, date(e) { return this.check(/* @__PURE__ */ Qa(Gs, e)); }, time(e) { return this.check(/* @__PURE__ */ $a(Ks, e)); }, duration(e) { return this.check(/* @__PURE__ */ eo(qs, e)); }, }, ); function Z(e) { return /* @__PURE__ */ Oa(Us, e); } const Q = /*@__PURE__*/ E(`ZodStringFormat`, (e, t) => { (M.init(e, t), Hs.init(e, t)); }), Ws = /*@__PURE__*/ E(`ZodISODateTime`, (e, t) => { (Rn.init(e, t), Q.init(e, t)); }), Gs = /*@__PURE__*/ E(`ZodISODate`, (e, t) => { (zn.init(e, t), Q.init(e, t)); }), Ks = /*@__PURE__*/ E(`ZodISOTime`, (e, t) => { (Bn.init(e, t), Q.init(e, t)); }), qs = /*@__PURE__*/ E(`ZodISODuration`, (e, t) => { (Vn.init(e, t), Q.init(e, t)); }), Js = /*@__PURE__*/ E(`ZodEmail`, (e, t) => { (Sn.init(e, t), Q.init(e, t)); }), Ys = /*@__PURE__*/ E(`ZodGUID`, (e, t) => { (bn.init(e, t), Q.init(e, t)); }), Xs = /*@__PURE__*/ E(`ZodUUID`, (e, t) => { (xn.init(e, t), Q.init(e, t)); }), Zs = /*@__PURE__*/ E(`ZodURL`, (e, t) => { (An.init(e, t), Q.init(e, t)); }); function Qs(e) { return /* @__PURE__ */ Fa(Zs, e); } const $s = /*@__PURE__*/ E(`ZodEmoji`, (e, t) => { (jn.init(e, t), Q.init(e, t)); }), ec = /*@__PURE__*/ E(`ZodNanoID`, (e, t) => { (Mn.init(e, t), Q.init(e, t)); }), tc = /*@__PURE__*/ E(`ZodCUID`, (e, t) => { (Nn.init(e, t), Q.init(e, t)); }), nc = /*@__PURE__*/ E(`ZodCUID2`, (e, t) => { (Pn.init(e, t), Q.init(e, t)); }), rc = /*@__PURE__*/ E(`ZodULID`, (e, t) => { (Fn.init(e, t), Q.init(e, t)); }), ic = /*@__PURE__*/ E(`ZodXID`, (e, t) => { (In.init(e, t), Q.init(e, t)); }), ac = /*@__PURE__*/ E(`ZodKSUID`, (e, t) => { (Ln.init(e, t), Q.init(e, t)); }), oc = /*@__PURE__*/ E(`ZodIPv4`, (e, t) => { (Hn.init(e, t), Q.init(e, t)); }), sc = /*@__PURE__*/ E(`ZodIPv6`, (e, t) => { (Gn.init(e, t), Q.init(e, t)); }), cc = /*@__PURE__*/ E(`ZodCIDRv4`, (e, t) => { (Kn.init(e, t), Q.init(e, t)); }), lc = /*@__PURE__*/ E(`ZodCIDRv6`, (e, t) => { (Jn.init(e, t), Q.init(e, t)); }), uc = /*@__PURE__*/ E(`ZodBase64`, (e, t) => { (Zn.init(e, t), Q.init(e, t)); }), dc = /*@__PURE__*/ E(`ZodBase64URL`, (e, t) => { (er.init(e, t), Q.init(e, t)); }), fc = /*@__PURE__*/ E(`ZodE164`, (e, t) => { (tr.init(e, t), Q.init(e, t)); }), pc = /*@__PURE__*/ E(`ZodJWT`, (e, t) => { (cr.init(e, t), Q.init(e, t)); }), mc = /*@__PURE__*/ E( `ZodNumber`, (e, t) => { (lr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => as(e, t, n, r)), (e.isFinite = !0)); }, /*@__PURE__*/ je( { minValue: (e) => { let { minimum: t, exclusiveMinimum: n } = J(e); return Math.max(t ?? -1 / 0, n ?? -1 / 0); }, maxValue: (e) => { let { maximum: t, exclusiveMaximum: n } = J(e); return Math.min(t ?? 1 / 0, n ?? 1 / 0); }, isInt: (e) => { let { isInt: t, multipleOf: n } = J(e); return !!t || !!n?.some(Number.isSafeInteger); }, format: (e) => J(e).format ?? null, }, { gt(e, t) { return this.check(/* @__PURE__ */ co(e, t)); }, gte(e, t) { return this.check(/* @__PURE__ */ lo(e, t)); }, min(e, t) { return this.check(/* @__PURE__ */ lo(e, t)); }, lt(e, t) { return this.check(/* @__PURE__ */ oo(e, t)); }, lte(e, t) { return this.check(/* @__PURE__ */ so(e, t)); }, max(e, t) { return this.check(/* @__PURE__ */ so(e, t)); }, int(e) { return this.check(gc(e)); }, safe(e) { return this.check(gc(e)); }, positive(e) { return this.check(/* @__PURE__ */ co(0, e)); }, nonnegative(e) { return this.check(/* @__PURE__ */ lo(0, e)); }, negative(e) { return this.check(/* @__PURE__ */ oo(0, e)); }, nonpositive(e) { return this.check(/* @__PURE__ */ so(0, e)); }, multipleOf(e, t) { return this.check(/* @__PURE__ */ uo(e, t)); }, step(e, t) { return this.check(/* @__PURE__ */ uo(e, t)); }, finite() { return this; }, }, ), ); function $(e) { return /* @__PURE__ */ to(mc, e); } const hc = /*@__PURE__*/ E(`ZodNumberFormat`, (e, t) => { (ur.init(e, t), mc.init(e, t)); }); function gc(e) { return /* @__PURE__ */ no(hc, e); } const _c = /*@__PURE__*/ E(`ZodUnknown`, (e, t) => { (dr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (e, t, n) => void 0)); }); function vc() { return /* @__PURE__ */ ro(_c); } const yc = /*@__PURE__*/ E(`ZodNever`, (e, t) => { (fr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => os(e, t, n, r))); }); function bc(e) { return /* @__PURE__ */ io(yc, e); } const xc = /*@__PURE__*/ E( `ZodDate`, (e, t) => { (pr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ss(e, t, n, r)), (e.min = (t, n) => e.check(/* @__PURE__ */ lo(t, n))), (e.max = (t, n) => e.check(/* @__PURE__ */ so(t, n)))); }, /*@__PURE__*/ je( { minDate: (e) => { let { minimum: t } = J(e); return t ? new Date(t) : null; }, maxDate: (e) => { let { maximum: t } = J(e); return t ? new Date(t) : null; }, }, {}, ), ); function Sc(e) { return /* @__PURE__ */ ao(xc, e); } const Cc = /*@__PURE__*/ E( `ZodArray`, (e, t) => { (Vs(), hr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ds(e, t, n, r)), (e.element = t.element)); }, { min(e, t) { return this.check(/* @__PURE__ */ po(e, t)); }, nonempty(e) { return this.check(/* @__PURE__ */ po(1, e)); }, max(e, t) { return this.check(/* @__PURE__ */ fo(e, t)); }, length(e, t) { return this.check(/* @__PURE__ */ mo(e, t)); }, unwrap() { return this.element; }, }, ); function wc(e, t) { return /* @__PURE__ */ Do(Cc, e, t); } const Tc = /*@__PURE__*/ E( `ZodObject`, (e, t) => { (Vs(), xr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ps(e, t, n, r)), Ie(e, `shape`, (e) => e._zod.def.shape, !1)); }, { keyof() { return Mc(Object.keys(this._zod.def.shape)); }, catchall(e) { return this.clone(g(this._zod.def, { catchall: e })); }, passthrough() { return this.clone(g(this._zod.def, { catchall: vc() })); }, loose() { return this.clone(g(this._zod.def, { catchall: vc() })); }, strict() { return this.clone(g(this._zod.def, { catchall: bc() })); }, strip() { return this.clone(g(this._zod.def, { catchall: void 0 })); }, extend(e) { return me(this, e); }, safeExtend(e) { return ge(this, e); }, merge(e) { return _e(this, e); }, pick(e) { return de(this, e); }, omit(e) { return pe(this, e); }, partial(...e) { return ve(Fc, this, e[0]); }, exactPartial(...e) { return ve(Lc, this, e[0], `exactPartial`); }, required(...e) { return ye(Gc, this, e[0]); }, }, ); function Ec(e, t) { let n = { type: `object`, shape: e ?? {}, ...b(t) }; return new Tc(n); } const Dc = /*@__PURE__*/ E(`ZodUnion`, (e, t) => { (Cr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ms(e, t, n, r)), (e.options = t.options)); }); function Oc(e, t) { return new Dc({ type: `union`, options: e, ...b(t) }); } const kc = /*@__PURE__*/ E(`ZodIntersection`, (e, t) => { (wr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => hs(e, t, n, r))); }); function Ac(e, t) { return new kc({ type: `intersection`, left: e, right: t }); } const jc = /*@__PURE__*/ E(`ZodEnum`, (e, t) => { (Dr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => cs(e, t, n, r)), (e.enum = t.entries), (e.options = [...e._zod.values])); let n = new Set(Object.keys(t.entries)); ((e.extract = (e, r) => { let i = {}; for (let r of e) if (n.has(r)) i[r] = t.entries[r]; else throw Error(`Key ${r} not found in enum`); return new jc({ ...t, checks: [], ...b(r), entries: i }); }), (e.exclude = (e, r) => { let i = { ...t.entries }; for (let t of e) if (n.has(t)) delete i[t]; else throw Error(`Key ${t} not found in enum`); return new jc({ ...t, checks: [], ...b(r), entries: i }); })); }); function Mc(e, t) { let n = Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e; return new jc({ type: `enum`, entries: n, ...b(t) }); } const Nc = /*@__PURE__*/ E(`ZodTransform`, (e, t) => { (Vs(), Or.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => us(e, t, n, r)), (e._zod.parse = (n, r) => { if (r.direction === `backward`) throw new He(e.constructor.name); n.addIssue = (r) => { if (typeof r == `string`) n.issues.push(Oe(r, n.value, t)); else { let t = r; (t.fatal && (t.continue = !1), (t.code ??= `custom`), `input` in t || (t.input = n.value), (t.inst ??= e), n.issues.push(Oe(t))); } }; let i = t.transform(n.value, n); return i instanceof Promise ? i.then((e) => ((n.value = e), n)) : ((n.value = i), n); })); }); function Pc(e) { return new Nc({ type: `transform`, transform: e }); } const Fc = /*@__PURE__*/ E(`ZodOptional`, (e, t) => { (Ar.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ts(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Ic(e) { return new Fc({ type: `optional`, innerType: e }); } const Lc = /*@__PURE__*/ E(`ZodExactOptional`, (e, t) => { (jr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ts(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Rc(e) { return new Lc({ type: `optional`, innerType: e }); } const zc = /*@__PURE__*/ E(`ZodNullable`, (e, t) => { (Mr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => gs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Bc(e) { return new zc({ type: `nullable`, innerType: e }); } const Vc = /*@__PURE__*/ E(`ZodDefault`, (e, t) => { (Nr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => bs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType), (e.removeDefault = e.unwrap)); }); function Hc(e, t) { return new Vc({ type: `default`, innerType: e, get defaultValue() { return typeof t == `function` ? t() : ie(t); }, }); } const Uc = /*@__PURE__*/ E(`ZodPrefault`, (e, t) => { (Fr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => xs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Wc(e, t) { return new Uc({ type: `prefault`, innerType: e, get defaultValue() { return typeof t == `function` ? t() : ie(t); }, }); } const Gc = /*@__PURE__*/ E(`ZodNonOptional`, (e, t) => { (Ir.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => _s(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Kc(e, t) { return new Gc({ type: `nonoptional`, innerType: e, ...b(t) }); } const qc = /*@__PURE__*/ E(`ZodCatch`, (e, t) => { (zr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ss(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType), (e.removeCatch = e.unwrap)); }); function Jc(e, t) { return new qc({ type: `catch`, innerType: e, catchValue: typeof t == `function` ? t : Le(t), }); } const Yc = /*@__PURE__*/ E(`ZodPipe`, (e, t) => { (Br.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Cs(e, t, n, r)), (e.in = t.in), (e.out = t.out)); }); function Xc(e, t) { return new Yc({ type: `pipe`, in: e, out: t }); } const Zc = /*@__PURE__*/ E(`ZodReadonly`, (e, t) => { (Hr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ws(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Qc(e) { return new Zc({ type: `readonly`, innerType: e }); } const $c = /*@__PURE__*/ E(`ZodCustom`, (e, t) => { (Wr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ls(e, t, n, r))); }); function el(e, t = {}) { return /* @__PURE__ */ Oo($c, e, t); } function tl(e, t) { return /* @__PURE__ */ ko(e, t); } const nl = Ec({ id: $(), created: Sc(), title: Z().min(1).max(100), type: Mc([`jpg`, `png`]), size: $(), url: Qs(), }), rl = Ec({ id: $(), stars: $().min(1).max(5), title: Z().min(1).max(100), text: Z().min(1).max(1e3), images: wc(nl), }); hi( e()( Ec({ id: $(), created: Sc(), title: Z().min(1).max(100), brand: Z().min(1).max(30), description: Z().min(1).max(500), price: $().min(1).max(1e4), discount: $().min(1).max(100).nullable(), quantity: $().min(0).max(10), tags: wc(Z().min(1).max(30)), images: wc(nl), ratings: wc(rl), }), ), { strict: !0 }, ).parse({});
function e() { return (e) => e; } function t(e) { let t = Object.values(e).filter((e) => typeof e == `number`); return Object.entries(e) .filter(([e, n]) => t.indexOf(+e) === -1) .map(([e, t]) => t); } function n(e, t = `|`) { return e.map((e) => se(e)).join(t); } function r(e, t) { return typeof t == `bigint` ? t.toString() : t; } var i = class { constructor(e) { ((this._getter = e), (this._value = void 0)); } get value() { let e = this._getter; return (e !== void 0 && ((this._value = e()), (this._getter = void 0)), this._value); } }; function a(e) { return new i(e); } function o(e) { return e == null; } function s(e) { let t = +!!e.startsWith(`^`), n = e.endsWith(`$`) ? e.length - 1 : e.length; return e.slice(t, n); } function c(e, t) { let n = e / t, r = Math.round(n), i = 4 * 2 ** -52 * Math.max(Math.abs(n), 1); return Math.abs(n - r) < i ? 0 : n - r; } function l(e, t, n) { Object.defineProperty(e, t, { value: n, writable: !0, enumerable: !0, configurable: !0 }); } function u(e) { let t = Object.getOwnPropertyDescriptor(e, `shape`); return t?.get ? t.get.raw : t?.value; } function d(e) { return u(e._zod.def) ?? e._zod.def.shape; } function f(e, t, n) { Object.defineProperty(e, t, { get() { let e = n(); return (l(this, t, e), e); }, enumerable: !0, configurable: !0, }); } function p(e, t, n) { t in e ? l(e, t, n) : (e[t] = n); } function m(e, t, n, r) { let i = d(t); for (let a of n) { let n = Object.getOwnPropertyDescriptor(i, a); n.enumerable && (n.get ? f(e, a, () => { let e = t._zod.def.shape[a]; return r ? r(e, a) : e; }) : p(e, a, r ? r(n.value, a) : n.value)); } } function h(e, t) { for (let n of Reflect.ownKeys(t)) { let r = Object.getOwnPropertyDescriptor(t, n); r.enumerable && (r.get ? f(e, n, () => t[n]) : p(e, n, r.value)); } } function g(...e) { let t = {}; for (let n of e) { let e = Object.getOwnPropertyDescriptors(n); Object.assign(t, e); } return Object.defineProperties({}, t); } function _(e) { return JSON.stringify(e); } function ee(e) { return e .toLowerCase() .trim() .replace(/[^\w\s-]/g, ``) .replace(/[\s_-]+/g, `-`) .replace(/^-+|-+$/g, ``); } const te = `captureStackTrace` in Error ? Error.captureStackTrace : (...e) => {}; function ne(e) { return typeof e == `object` && !!e && !Array.isArray(e); } const re = /* @__PURE__*/ a(() => { if (O.jitless || (typeof navigator < `u` && navigator?.userAgent?.includes(`Cloudflare`))) return !1; try { return (Function(``), !0); } catch { return !1; } }); function v(e) { if (ne(e) === !1) return !1; let t = e.constructor; if (t === void 0 || typeof t != `function`) return !0; let n = t.prototype; return ne(n) !== !1 && Object.prototype.hasOwnProperty.call(n, `isPrototypeOf`) !== !1; } function ie(e) { return v(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e; } const ae = /* @__PURE__*/ new Set([`string`, `number`, `symbol`]); function oe(e) { return e.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`); } function y(e, t, n) { let r = new e._zod.constr(t ?? e._zod.def); return ((!t || n?.parent) && (r._zod.parent = e), r); } function b(e) { let t = e; if (!t) return {}; if (typeof t == `string`) return { error: () => t }; if (t?.message !== void 0) { if (t?.error !== void 0) throw Error("Cannot specify both `message` and `error` params"); t.error = t.message; } return (delete t.message, typeof t.error == `string` ? { ...t, error: () => t.error } : t); } function se(e) { return typeof e == `bigint` ? e.toString() + `n` : typeof e == `string` ? `"${e}"` : `${e}`; } function ce(e) { return Object.keys(e).filter( (t) => e[t]._zod.optin !== void 0 && e[t]._zod.optout === `optional`, ); } const le = { safeint: [-(2 ** 53 - 1), 2 ** 53 - 1], int32: [-2147483648, 2147483647], uint32: [0, 4294967295], float32: [-34028234663852886e22, 34028234663852886e22], float64: [-Number.MAX_VALUE, Number.MAX_VALUE], }, ue = { int64: [ /* @__PURE__*/ BigInt(`-9223372036854775808`), /* @__PURE__*/ BigInt(`9223372036854775807`), ], uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt(`18446744073709551615`)], }; function de(e, t) { let n = e._zod.def, r = n.checks; if (r && r.length > 0) throw Error(`.pick() cannot be used on object schemas containing refinements`); let i = {}; return (m(i, e, fe(e, t)), y(e, g(n, { shape: i, checks: [] }))); } function fe(e, t) { let n = d(e), r = []; for (let e of Reflect.ownKeys(t)) { if (!Object.getOwnPropertyDescriptor(n, e)?.enumerable) throw Error(`Unrecognized key: "${String(e)}"`); t[e] && r.push(e); } return r; } function pe(e, t) { let n = e._zod.def, r = n.checks; if (r && r.length > 0) throw Error(`.omit() cannot be used on object schemas containing refinements`); let i = new Set(fe(e, t)), a = {}; return ( m( a, e, Reflect.ownKeys(d(e)).filter((e) => !i.has(e)), ), y(e, g(n, { shape: a, checks: [] })) ); } function me(e, t) { if (!v(t)) throw Error(`Invalid input to extend: expected a plain object`); let n = e._zod.def.checks; if (n && n.length > 0) { let n = d(e); for (let e of Reflect.ownKeys(t)) if (Object.getOwnPropertyDescriptor(n, e) !== void 0) throw Error( "Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.", ); } return y(e, g(e._zod.def, { shape: he(e, t) })); } function he(e, t) { let n = {}; return (m(n, e, Reflect.ownKeys(d(e))), h(n, t), n); } function ge(e, t) { if (!v(t)) throw Error(`Invalid input to safeExtend: expected a plain object`); return y(e, g(e._zod.def, { shape: he(e, t) })); } function _e(e, t) { if (!t?._zod?.def) throw Error( "Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.", ); if (e._zod.def.checks?.length) throw Error( `.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`, ); let n = {}; return ( m(n, e, Reflect.ownKeys(d(e))), m(n, t, Reflect.ownKeys(d(t))), y( e, g(e._zod.def, { shape: n, get catchall() { return t._zod.def.catchall; }, checks: t._zod.def.checks ?? [], }), ) ); } function ve(e, t, n, r = `partial`) { let i = t._zod.def.checks; if (i && i.length > 0) throw Error(`.${r}() cannot be used on object schemas containing refinements`); let a = n ? new Set(fe(t, n)) : void 0, o = {}; return ( m( o, t, Reflect.ownKeys(d(t)), e && ((t, n) => (a && !a.has(n) ? t : new e({ type: `optional`, innerType: t }))), ), y(t, g(t._zod.def, { shape: o, checks: [] })) ); } function ye(e, t, n) { let r = n ? new Set(fe(t, n)) : void 0, i = {}; return ( m(i, t, Reflect.ownKeys(d(t)), (t, n) => r && !r.has(n) ? t : new e({ type: `nonoptional`, innerType: t }), ), y(t, g(t._zod.def, { shape: i })) ); } function x(e, t = 0) { if (e.aborted === !0) return !0; for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0; return !1; } function be(e, t = 0) { if (e.aborted === !0) return !0; for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue === !1) return !0; return !1; } function xe(e, t) { return t.map((t) => { var n; return ((n = t).path ?? (n.path = []), t.path.unshift(e), t); }); } function Se(e) { return typeof e == `string` ? e : e?.message; } function Ce(e, t, n) { var r; for (let i = t; i < e.length; i++) (r = e[i]).schema ?? (r.schema = n); } function S(e, t, n) { var r; let i = e.inst?._zod?.traits; i?.has(`$ZodType`) && (i.has(`$ZodCheck`) ? ((r = e).schema ?? (r.schema = e.inst)) : (e.schema = e.inst)); let a = e.schema === e.inst ? void 0 : e.schema?._zod.def?.error, o = e.message ? e.message : (Se(e.inst?._zod.def?.error?.(e)) ?? Se(a?.(e)) ?? Se(t?.error?.(e)) ?? Se(n.customError?.(e)) ?? Se(n.localeError?.(e)) ?? `Invalid input`), s = {}; for (let t of Object.keys(e)) t !== `inst` && t !== `schema` && t !== `continue` && t !== `input` && t !== `__proto__` && (s[t] = e[t]); return ((s.path ??= []), (s.message = o), t?.reportInput && (s.input = e.input), s); } const we = /[\uD800-\uDBFF]/; function Te(e) { let t = e.length; if (!we.test(e)) return t; let n = t; for (let r = 0; r < t - 1; r++) (e.charCodeAt(r) & 64512) == 55296 && (e.charCodeAt(r + 1) & 64512) == 56320 && (n--, r++); return n; } function Ee(e) { return Array.isArray(e) ? `array` : typeof e == `string` ? `string` : `unknown`; } function De(e) { let t = typeof e; switch (t) { case `number`: return Number.isNaN(e) ? `nan` : `number`; case `object`: { if (e === null) return `null`; if (Array.isArray(e)) return `array`; let t = e; if (t && Object.getPrototypeOf(t) !== Object.prototype && `constructor` in t && t.constructor) return t.constructor.name; } } return t; } function Oe(...e) { let [t, n, r] = e; return typeof t == `string` ? { message: t, code: `custom`, input: n, inst: r } : { ...t }; } function ke(e, t) { for (let n in t) { let r = Object.getOwnPropertyDescriptor(t, n); r.get ? Object.defineProperty(e, n, { ...r, enumerable: !1 }) : Me(e, n, r.value); } } function C(e, t, n, r = !0) { return ( Object.defineProperty(e, t, { configurable: !0, writable: !0, enumerable: r, value: n }), n ); } function Ae(e, t, n) { return C(e, t, n, !1); } function je(e, t) { for (let n in e) { let r = e[n]; Object.defineProperty(t, n, { configurable: !0, enumerable: !0, get() { return C(this, n, r(this)); }, set(e) { C(this, n, e); }, }); } return t; } function Me(e, t, n) { Object.defineProperty(e, t, { configurable: !0, get() { return this == null ? n : C(this, t, n.bind(this)); }, set(e) { C(this, t, e); }, }); } function Ne(e, t) { let n = Object.getPrototypeOf(e); return t in n ? void 0 : n; } let Pe, w = !1; const Fe = { configurable: !0, get() { w = !0; }, }; function T(e, t, n) { let r = Object.getPrototypeOf(e._zod); if (t in r && Pe !== e._zod) { Pe = void 0; return; } ((Pe = e._zod), Object.defineProperty(r, t, { configurable: !0, get() { Object.defineProperty(this, t, Fe); let e = w; w = !1; try { let r = n(this); return ( w ? delete this[t] : Object.defineProperty(this, t, { configurable: !0, writable: !0, value: r }), (w ||= e), r ); } catch (n) { throw (delete this[t], (w ||= e), n); } }, set(e) { Object.defineProperty(this, t, { configurable: !0, writable: !0, value: e }); }, })); } function Ie(e, t, n, r) { let i = Ne(e, t); i && Object.defineProperty(i, t, { configurable: !0, get() { let e = { configurable: !0, writable: !0, enumerable: r, value: void 0 }; return ( Object.defineProperty(this, t, e), (e.value = n(this)), Object.defineProperty(this, t, e), e.value ); }, set(e) { Object.defineProperty(this, t, { configurable: !0, writable: !0, enumerable: r, value: e }); }, }); } function Le(e) { let t = () => e; return ((t[`~constantCatch`] = !0), t); } var Re; const ze = { value: void 0, enumerable: !1 }; let Be = `captureStackTrace` in Error ? Error : null; function Ve(e) { let t = Be; if (t) { let n = t.stackTraceLimit; if (typeof n == `number`) { try { t.stackTraceLimit = 0; } catch { return ((Be = null), new e()); } try { return new e(); } finally { t.stackTraceLimit = n; } } } return new e(); } function E(e, t, n, r) { let i = {}; function a(e) { ((this.def = e), (this.constr = d), (this.traits = /* @__PURE__ */ new Set())); } a.prototype = i; let o = n, s = o && /* @__PURE__ */ new WeakSet(); function c(n, r) { if (!n._zod) { ze.value = new a(r); try { Object.defineProperty(n, "_zod", ze); } finally { ze.value = void 0; } } else if (n._zod.traits.has(e)) return; if ((n._zod.traits.add(e), t(n, r), s)) { let e = Object.getPrototypeOf(n), t = n._zod.constr.prototype, r = e; for (; r && r !== t;) r = Object.getPrototypeOf(r); let i = r ?? e; s.has(i) || (s.add(i), ke(i, o)); } let i = d.prototype; for (let e in i) Object.prototype.hasOwnProperty.call(i, e) && (e in n || (n[e] = i[e].bind(n))); } let l = r?.Parent ?? Object; class u extends l {} Object.defineProperty(u, "name", { value: e }); function d(e) { let t = r?.Parent ? Ve(u) : this; c(t, e); let n = t._zod.deferred; if (n) { for (let e of n) e(); t._zod.deferred = void 0; } let i = globalThis.__zod_globalConfig?.postProcessor; return (i && i(t), t); } return ( Object.defineProperty(d, "init", { value: c }), Object.defineProperty(d, Symbol.hasInstance, { value: (t) => (r?.Parent && t instanceof r.Parent ? !0 : t?._zod?.traits?.has(e)), }), Object.defineProperty(d, "name", { value: e }), d ); } var D = class extends Error { constructor() { super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`); } }, He = class extends Error { constructor(e) { (super(`Encountered unidirectional transform during encode: ${e}`), (this.name = `ZodEncodeError`)); } }; (Re = globalThis).__zod_globalConfig ?? (Re.__zod_globalConfig = {}); const O = globalThis.__zod_globalConfig; function k(e) { return (e && Object.assign(O, e), O); } function Ue() { let e = this._zod; return ((e.message ??= JSON.stringify(e.def, r, 2)), e.message); } function We(e) { this._zod.message = e; } const Ge = { get: Ue, set: We, enumerable: !0, configurable: !0 }, Ke = { value: void 0, enumerable: !1 }, qe = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]), Je = (e, t) => { ((e.name = `$ZodError`), (Ke.value = t), Object.defineProperty(e, "issues", Ke), (Ke.value = void 0), Object.defineProperty(e, "message", Ge)); let n = Object.getPrototypeOf(e); qe.has(n) || (qe.add(n), Object.defineProperty(n, "toString", { configurable: !0, enumerable: !1, get() { let e = () => this.message; return ( Object.defineProperty(this, "toString", { value: e, configurable: !0, writable: !0 }), e ); }, set(e) { Object.defineProperty(this, "toString", { value: e, configurable: !0, writable: !0 }); }, })); }, Ye = E(`$ZodError`, Je); E(`$ZodError`, Je, void 0, { Parent: Error }); function Xe(e, t, n) { return ( Object.prototype.hasOwnProperty.call(e, t) || (t === `__proto__` ? Object.defineProperty(e, t, { value: n(), writable: !0, enumerable: !0, configurable: !0, }) : (e[t] = n())), e[t] ); } function Ze(e, t = (e) => e.message) { let n = {}, r = []; for (let i of e.issues) i.path.length > 0 ? Xe(n, i.path[0], () => []).push(t(i)) : r.push(t(i)); return { formErrors: r, fieldErrors: n }; } function Qe(e, t = (e) => e.message) { let n = { _errors: [] }, r = (e, i = []) => { for (let a of e.issues) if (a.code === `invalid_union` && a.errors.length) a.errors.map((e) => r({ issues: e }, [...i, ...a.path])); else if (a.code === `invalid_key`) r({ issues: a.issues }, [...i, ...a.path]); else if (a.code === `invalid_element`) r({ issues: a.issues }, [...i, ...a.path]); else { let e = [...i, ...a.path]; if (e.length === 0) n._errors.push(t(a)); else { let r = n, i = 0; for (; i < e.length;) { let n = e[i], o = i === e.length - 1; if (n === `_errors`) { (o && r._errors.push(t(a)), i++); continue; } Object.prototype.hasOwnProperty.call(r, n) || Object.defineProperty(r, n, { value: { _errors: [] }, enumerable: !0, writable: !0, configurable: !0, }); let s = r[n]; (o && s._errors.push(t(a)), (r = s), i++); } } } }; return (r(e), n); } function $e(e, t) { return { callee: t?.callee ?? e, Err: t?.Err }; } const et = (e) => { let t = (n, r, i, a) => { let o = i ? { ...i, async: !1 } : { async: !1 }, s = n._zod.run({ value: r, issues: [] }, o); if (s instanceof Promise) throw new D(); if (s.issues.length) { let n = new (a?.Err ?? e)(s.issues.map((e) => S(e, o, k()))); throw (te(n, a?.callee ?? t), n); } return s.value; }; return t; }, tt = (e) => { let t = async (n, r, i, a) => { let o = i ? { ...i, async: !0 } : { async: !0 }, s = n._zod.run({ value: r, issues: [] }, o); if ((s instanceof Promise && (s = await s), s.issues.length)) { let n = new (a?.Err ?? e)(s.issues.map((e) => S(e, o, k()))); throw (te(n, a?.callee ?? t), n); } return s.value; }; return t; }, nt = (e) => (t, n, r) => { let i = r ? { ...r, async: !1 } : { async: !1 }, a = t._zod.run({ value: n, issues: [] }, i); if (a instanceof Promise) throw new D(); return a.issues.length ? rt(e, a.issues, i) : { success: !0, data: a.value }; }; function rt(e, t, n) { let r; return { success: !1, get error() { return (r || ((r = new e(t.map((e) => S(e, n, k())))), (t = void 0), (n = void 0)), r); }, set error(e) { ((r = e), (t = void 0), (n = void 0)); }, }; } const it = (e) => async (t, n, r) => { let i = r ? { ...r, async: !0 } : { async: !0 }, a = t._zod.run({ value: n, issues: [] }, i); return ( a instanceof Promise && (a = await a), a.issues.length ? rt(e, a.issues, i) : { success: !0, data: a.value } ); }, at = /* @__PURE__ */ Symbol.for(`zod.compile.invalid`), ot = /* @__PURE__ */ Symbol.for(`zod.compile.fallback`), st = (e, t, n) => { let r = e._zod.bag.validator; if (r !== void 0) { if (r(t) !== at) return !0; if (r.definite === !0 && n === void 0) return !1; } return ct(e, t, n); }; function ct(e, t, n) { let r = n ? { ...n, async: !1, abortEarly: !0 } : { async: !1, abortEarly: !0 }, i = e._zod.bag.fallbackRun, a; if ( (i ? ((r[ot] = !0), (a = i({ value: t, issues: [] }, r))) : (a = e._zod.run({ value: t, issues: [] }, r)), a instanceof Promise) ) throw new D(); return a.issues.length === 0; } const lt = async (e, t, n) => { let r = n ? { ...n, async: !0, abortEarly: !0 } : { async: !0, abortEarly: !0 }, i = e._zod.run({ value: t, issues: [] }, r); return (i instanceof Promise && (i = await i), i.issues.length === 0); }, ut = (e) => { let t = et(e), n = (e, r, i, a) => { let o = i ? { ...i, direction: `backward` } : { direction: `backward` }; return t(e, r, o, $e(n, a)); }; return n; }, dt = (e) => { let t = et(e), n = (e, r, i, a) => t(e, r, i, $e(n, a)); return n; }, ft = (e) => { let t = tt(e), n = async (e, r, i, a) => { let o = i ? { ...i, direction: `backward` } : { direction: `backward` }; return await t(e, r, o, $e(n, a)); }; return n; }, pt = (e) => { let t = tt(e), n = async (e, r, i, a) => await t(e, r, i, $e(n, a)); return n; }, mt = (e) => (t, n, r) => { let i = r ? { ...r, direction: `backward` } : { direction: `backward` }; return nt(e)(t, n, i); }, ht = (e) => (t, n, r) => nt(e)(t, n, r), gt = (e) => async (t, n, r) => { let i = r ? { ...r, direction: `backward` } : { direction: `backward` }; return it(e)(t, n, i); }, _t = (e) => async (t, n, r) => it(e)(t, n, r), vt = /^[cC][0-9a-z]{6,}$/, yt = /^[0-9a-z]+$/, bt = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/, xt = /^[0-9a-vA-V]{20}$/, St = /^[A-Za-z0-9]{27}$/, Ct = /^[a-zA-Z0-9_-]{21}$/; function wt(e) { return RegExp(`^[a-zA-Z0-9_-]{${e}}$`); } const Tt = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Et = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Dt = (e) => e ? RegExp( `^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`, ) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Ot = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; function kt() { return RegExp( `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`, `u`, ); } const At = /^(?:(?: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])$/, jt = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, Mt = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, Nt = /^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Pt = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Ft = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/, It = /^https?$/, Lt = /^\+[1-9]\d{6,14}$/, Rt = /^\d(?:[ -]?\d){11,18}$/, zt = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/, Bt = `(?:(?:\\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])))`; function Vt(e) { return RegExp(`^${e}$`); } const Ht = /*@__PURE__*/ Vt(Bt); function Ut(e) { let t = `(?:[01]\\d|2[0-3]):[0-5]\\d`; return typeof e.precision == `number` ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : e.seconds ? `${t}:[0-5]\\d(?:\\.\\d+)?` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`; } function Wt(e) { return RegExp(`^${Ut(e)}$`); } function Gt(e) { let t = [`Z`]; e.offset && t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); let n = `${Ut({ precision: e.precision, seconds: !0 })}(?:${t.join(`|`)})`, r = e.local ? `${n}|${Ut({ precision: e.precision })}` : n; return RegExp(`^${Bt}T(?:${r})$`); } const Kt = /^[\s\S]{0,}$/, qt = /^-?\d+(?:\.\d+)?$/, Jt = /^[^A-Z]*$/, Yt = /^[^a-z]*$/, A = /*@__PURE__*/ E(`$ZodCheck`, (e, t) => { var n; ((e._zod ??= {}), (e._zod.def = t), (n = e._zod).onattach ?? (n.onattach = [])); }), Xt = (e) => { let t = e.value; return !o(t) && t.length !== void 0; }, Zt = { number: `number`, bigint: `bigint`, object: `date` }, Qt = /*@__PURE__*/ E(`$ZodCheckLessThan`, (e, t) => { A.init(e, t); let n = Zt[typeof t.value]; e._zod.check = (r) => { (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({ origin: Zt[typeof r.value] ?? n, code: `too_big`, maximum: typeof t.value == `object` ? t.value.getTime() : t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort, }); }; }), $t = /*@__PURE__*/ E(`$ZodCheckGreaterThan`, (e, t) => { A.init(e, t); let n = Zt[typeof t.value]; e._zod.check = (r) => { (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({ origin: Zt[typeof r.value] ?? n, code: `too_small`, minimum: typeof t.value == `object` ? t.value.getTime() : t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort, }); }; }), en = /*@__PURE__*/ E(`$ZodCheckMultipleOf`, (e, t) => { (A.init(e, t), (e._zod.check = (n) => { if (typeof n.value != typeof t.value) throw Error(`Cannot mix number and bigint in multiple_of check.`); (typeof n.value == `bigint` ? t.value !== BigInt(0) && n.value % t.value === BigInt(0) : c(n.value, t.value) === 0) || n.issues.push({ origin: typeof n.value, code: `not_multiple_of`, divisor: t.value, input: n.value, inst: e, continue: !t.abort, }); })); }), tn = /*@__PURE__*/ E(`$ZodCheckNumberFormat`, (e, t) => { (A.init(e, t), (t.format = t.format || `float64`)); let n = t.format?.includes(`int`), r = n ? `int` : `number`, [i, a] = le[t.format]; e._zod.check = (o) => { let s = o.value; if (n) { if (!Number.isInteger(s)) { o.issues.push({ expected: r, format: t.format, code: `invalid_type`, continue: !1, input: s, inst: e, }); return; } if (!Number.isSafeInteger(s)) { s > 0 ? o.issues.push({ input: s, code: `too_big`, maximum: 2 ** 53 - 1, note: `Integers must be within the safe integer range.`, inst: e, origin: r, inclusive: !0, continue: !t.abort, }) : o.issues.push({ input: s, code: `too_small`, minimum: -(2 ** 53 - 1), note: `Integers must be within the safe integer range.`, inst: e, origin: r, inclusive: !0, continue: !t.abort, }); return; } } (s < i && o.issues.push({ origin: `number`, input: s, code: `too_small`, minimum: i, inclusive: !0, inst: e, continue: !t.abort, }), s > a && o.issues.push({ origin: `number`, input: s, code: `too_big`, maximum: a, inclusive: !0, inst: e, continue: !t.abort, })); }; }), nn = /*@__PURE__*/ E(`$ZodCheckMaxLength`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length; if ((typeof r == `string` && i > t.maximum ? Te(r) : i) <= t.maximum) return; let a = Ee(r); n.issues.push({ origin: a, code: `too_big`, maximum: t.maximum, inclusive: !0, input: r, inst: e, continue: !t.abort, }); })); }), rn = /*@__PURE__*/ E(`$ZodCheckMinLength`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length; if ((typeof r == `string` && i >= t.minimum && i < t.minimum * 2 ? Te(r) : i) >= t.minimum) return; let a = Ee(r); n.issues.push({ origin: a, code: `too_small`, minimum: t.minimum, inclusive: !0, input: r, inst: e, continue: !t.abort, }); })); }), an = /*@__PURE__*/ E(`$ZodCheckLengthEquals`, (e, t) => { var n; (A.init(e, t), (n = e._zod.def).when ?? (n.when = Xt), (e._zod.check = (n) => { let r = n.value, i = r.length, a = typeof r == `string` && i >= t.length && i <= t.length * 2 ? Te(r) : i; if (a === t.length) return; let o = Ee(r), s = a > t.length; n.issues.push({ origin: o, ...(s ? { code: `too_big`, maximum: t.length } : { code: `too_small`, minimum: t.length }), inclusive: !0, exact: !0, input: n.value, inst: e, continue: !t.abort, }); })); }), on = /*@__PURE__*/ E(`$ZodCheckStringFormat`, (e, t) => { var n, r; (A.init(e, t), t.pattern ? ((n = e._zod).check ?? (n.check = (n) => { ((t.pattern.lastIndex = 0), !t.pattern.test(n.value) && n.issues.push({ origin: `string`, code: `invalid_format`, format: t.format, input: n.value, ...(t.pattern ? { pattern: t.pattern.toString() } : {}), inst: e, continue: !t.abort, })); })) : ((r = e._zod).check ?? (r.check = () => {}))); }), sn = /*@__PURE__*/ E(`$ZodCheckRegex`, (e, t) => { (on.init(e, t), (e._zod.check = (n) => { ((t.pattern.lastIndex = 0), !t.pattern.test(n.value) && n.issues.push({ origin: `string`, code: `invalid_format`, format: `regex`, input: n.value, pattern: t.pattern.toString(), inst: e, continue: !t.abort, })); })); }), cn = /*@__PURE__*/ E(`$ZodCheckLowerCase`, (e, t) => { ((t.pattern ??= Jt), on.init(e, t)); }), ln = /*@__PURE__*/ E(`$ZodCheckUpperCase`, (e, t) => { ((t.pattern ??= Yt), on.init(e, t)); }), un = /*@__PURE__*/ E(`$ZodCheckIncludes`, (e, t) => { A.init(e, t); let n = oe(t.includes); ((t.pattern = new RegExp(typeof t.position == `number` ? `^.{${t.position},}${n}` : n)), (e._zod.check = (n) => { n.value.includes(t.includes, t.position) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `includes`, includes: t.includes, input: n.value, inst: e, continue: !t.abort, }); })); }), dn = /*@__PURE__*/ E(`$ZodCheckStartsWith`, (e, t) => { A.init(e, t); let n = RegExp(`^${oe(t.prefix)}.*`); ((t.pattern ??= n), (e._zod.check = (n) => { n.value.startsWith(t.prefix) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `starts_with`, prefix: t.prefix, input: n.value, inst: e, continue: !t.abort, }); })); }), fn = /*@__PURE__*/ E(`$ZodCheckEndsWith`, (e, t) => { A.init(e, t); let n = RegExp(`.*${oe(t.suffix)}$`); ((t.pattern ??= n), (e._zod.check = (n) => { n.value.endsWith(t.suffix) || n.issues.push({ origin: `string`, code: `invalid_format`, format: `ends_with`, suffix: t.suffix, input: n.value, inst: e, continue: !t.abort, }); })); }), pn = /*@__PURE__*/ E(`$ZodCheckOverwrite`, (e, t) => { (A.init(e, t), (e._zod.check = (e) => { e.value = t.tx(e.value); })); }); var mn = class { constructor(e = [], t = {}) { ((this.content = []), (this.indent = 0), (this.args = e), (this.closed = t)); } indented(e) { this.indent += 1; try { e(this); } finally { --this.indent; } } write(e) { if (typeof e == `function`) { (e(this, { execution: `sync` }), e(this, { execution: `async` })); return; } let t = e .split(` `) .filter((e) => e), n = Math.min(...t.map((e) => e.length - e.trimStart().length)), r = t.map((e) => e.slice(n)).map((e) => ` `.repeat(this.indent * 2) + e); for (let e of r) this.content.push(e); } compile() { let e = Function, t = this?.content ?? [``]; return new e( ...Object.keys(this.closed), `return function (${this.args.join(`, `)}) {\n${t.join(` `)}\n};`, )(...Object.values(this.closed)); } }; const hn = { major: 4, minor: 6, patch: 5 }, j = /*@__PURE__*/ E( `$ZodType`, (e, t) => { var n; ((e ??= {}), (e._zod.def = t), (e._zod.bag = e._zod.bag || {}), (e._zod.version = hn)); let r = e._zod.def.checks, i = e._zod.traits.has(`$ZodCheck`) ? [e, ...(r ?? [])] : r?.length ? [...r] : []; for (let t of i) for (let n of t._zod.onattach) n(e); if (i.length === 0) ((n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => { e._zod.run = e._zod.parse; })); else { let t = (t, n, r) => { if (t.memo) return t; let i = x(t), a; for (let o of n) { if (o._zod.def.when) { if (be(t) || !o._zod.def.when(t)) continue; } else if (i) continue; let n = t.issues.length, s = o._zod.check(t); if (s instanceof Promise && r?.async === !1) throw new D(); if (a || s instanceof Promise) a = (a ?? Promise.resolve()).then(async () => { (await s, t.issues.length !== n && (Ce(t.issues, n, e), (i ||= x(t, n)))); }); else { if (t.issues.length === n) continue; (Ce(t.issues, n, e), (i ||= x(t, n))); } } return a ? a.then(() => t) : t; }, n = (n, r, a) => { if (x(n)) return ((n.aborted = !0), n); let o = t(r, i, a); if (o instanceof Promise) { if (a.async === !1) throw new D(); return o.then((t) => e._zod.parse(t, a)); } return e._zod.parse(o, a); }; e._zod.run = (r, a) => { if (a.skipChecks) return e._zod.parse(r, a); if (a.direction === `backward`) { let t = e._zod.parse({ value: r.value, issues: [] }, { ...a, skipChecks: !0 }); return t instanceof Promise ? t.then((e) => n(e, r, a)) : n(t, r, a); } let o = e._zod.parse(r, a); if (o instanceof Promise) { if (a.async === !1) throw new D(); return o.then((e) => t(e, i, a)); } return t(o, i, a); }; } }, { get "~standard"() { return Ae(this, `~standard`, vn(this)); }, set "~standard"(e) { C(this, `~standard`, e); }, }, ), gn = (e, t) => e.issues.length ? { issues: e.issues.map((e) => S(e, t, k())) } : { value: e.value }; async function _n(e, t) { let n = { async: !0 }; return gn(await e._zod.run({ value: t, issues: [] }, n), n); } function vn(e) { return { validate: (t) => { let n = { async: !1 }; try { let r = e._zod.run({ value: t, issues: [] }, n); if (!(r instanceof Promise)) return gn(r, n); } catch {} return _n(e, t); }, vendor: `zod`, version: 1, }; } const yn = /*@__PURE__*/ E(`$ZodString`, (e, t) => { (j.init(e, t), (e._zod.pattern = t.pattern ?? Kt), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = String(n.value); } catch {} return ( typeof n.value == `string` || n.issues.push({ expected: `string`, code: `invalid_type`, input: n.value, inst: e }), n ); })); }), M = /*@__PURE__*/ E(`$ZodStringFormat`, (e, t) => { (on.init(e, t), yn.init(e, t)); }), bn = /*@__PURE__*/ E(`$ZodGUID`, (e, t) => { ((t.pattern ??= Et), M.init(e, t)); }), xn = /*@__PURE__*/ E(`$ZodUUID`, (e, t) => { if (t.version) { let e = { v1: 1, v2: 2, v3: 3, v4: 4, v5: 5, v6: 6, v7: 7, v8: 8 }[t.version]; if (e === void 0) throw Error(`Invalid UUID version: "${t.version}"`); t.pattern ??= Dt(e); } else t.pattern ??= Dt(); M.init(e, t); }), Sn = /*@__PURE__*/ E(`$ZodEmail`, (e, t) => { ((t.pattern ??= Ot), M.init(e, t)); }); function Cn(e) { try { return typeof URL < `u` && typeof URL.canParse == `function` ? URL.canParse(e) : (new URL(e), !0); } catch { return !1; } } function wn(e, t) { return !(`normalize` in t) && !(`hostname` in t) && !(`protocol` in t) ? Cn(e) || 2 : Tn(e, t); } function Tn(e, t) { if (!t.normalize && t.protocol?.source === It.source && !/^https?:\/\//i.test(e)) return 1; try { if (typeof URL < `u`) { let t = URL; if (typeof t.parse == `function`) return t.parse(e) ?? 2; } return new URL(e); } catch { return 2; } } const En = /[\t\n\r]/g; function Dn(e) { return e.replace(En, ``); } function On(e, t) { return ((t.lastIndex = 0), t.test(e.hostname)); } function kn(e, t) { return ( (t.lastIndex = 0), t.test(e.protocol.endsWith(`:`) ? e.protocol.slice(0, -1) : e.protocol) ); } const An = /*@__PURE__*/ E(`$ZodURL`, (e, t) => { (M.init(e, t), (e._zod.check = (n) => { try { let r = n.value.trim(), i = wn(r, t); if (i === 1) { n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid URL format`, input: n.value, inst: e, continue: !t.abort, }); return; } if (i === 2) { n.issues.push({ code: `invalid_format`, format: `url`, input: n.value, inst: e, continue: !t.abort, }); return; } if (i === !0) { n.value = Dn(r); return; } (t.hostname && !On(i, t.hostname) && n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid hostname`, pattern: t.hostname.source, input: n.value, inst: e, continue: !t.abort, }), t.protocol && !kn(i, t.protocol) && n.issues.push({ code: `invalid_format`, format: `url`, note: `Invalid protocol`, pattern: t.protocol.source, input: n.value, inst: e, continue: !t.abort, }), (n.value = t.normalize ? i.href : Dn(r))); return; } catch { n.issues.push({ code: `invalid_format`, format: `url`, input: n.value, inst: e, continue: !t.abort, }); } })); }), jn = /*@__PURE__*/ E(`$ZodEmoji`, (e, t) => { ((t.pattern ??= kt()), M.init(e, t)); }), Mn = /*@__PURE__*/ E(`$ZodNanoID`, (e, t) => { if (t.length !== void 0 && (!Number.isInteger(t.length) || t.length < 1)) throw Error(`Invalid nanoid length: ${t.length}`); ((t.pattern ??= t.length === void 0 ? Ct : wt(t.length)), M.init(e, t)); }), Nn = /*@__PURE__*/ E(`$ZodCUID`, (e, t) => { ((t.pattern ??= vt), M.init(e, t)); }), Pn = /*@__PURE__*/ E(`$ZodCUID2`, (e, t) => { ((t.pattern ??= yt), M.init(e, t)); }), Fn = /*@__PURE__*/ E(`$ZodULID`, (e, t) => { ((t.pattern ??= bt), M.init(e, t)); }), In = /*@__PURE__*/ E(`$ZodXID`, (e, t) => { ((t.pattern ??= xt), M.init(e, t)); }), Ln = /*@__PURE__*/ E(`$ZodKSUID`, (e, t) => { ((t.pattern ??= St), M.init(e, t)); }), Rn = /*@__PURE__*/ E(`$ZodISODateTime`, (e, t) => { ((t.pattern ??= Gt(t)), M.init(e, t)); }), zn = /*@__PURE__*/ E(`$ZodISODate`, (e, t) => { ((t.pattern ??= Ht), M.init(e, t)); }), Bn = /*@__PURE__*/ E(`$ZodISOTime`, (e, t) => { ((t.pattern ??= Wt(t)), M.init(e, t)); }), Vn = /*@__PURE__*/ E(`$ZodISODuration`, (e, t) => { ((t.pattern ??= Tt), M.init(e, t)); }), Hn = /*@__PURE__*/ E(`$ZodIPv4`, (e, t) => { ((t.pattern ??= At), M.init(e, t)); }), Un = /^[0-9a-fA-F:.]+$/; function Wn(e) { return Un.test(e) ? Cn(`http://[${e}]`) : !1; } const Gn = /*@__PURE__*/ E(`$ZodIPv6`, (e, t) => { ((t.pattern ??= jt), M.init(e, t), (e._zod.check = (n) => { Wn(n.value) || n.issues.push({ code: `invalid_format`, format: `ipv6`, input: n.value, inst: e, continue: !t.abort, }); })); }), Kn = /*@__PURE__*/ E(`$ZodCIDRv4`, (e, t) => { ((t.pattern ??= Mt), M.init(e, t)); }); function qn(e) { let t = e.split(`/`); if (t.length !== 2) return !1; let [n, r] = t; if (!r) return !1; let i = Number(r); return `${i}` !== r || i < 0 || i > 128 ? !1 : Wn(n); } const Jn = /*@__PURE__*/ E(`$ZodCIDRv6`, (e, t) => { ((t.pattern ??= Nt), M.init(e, t), (e._zod.check = (n) => { qn(n.value) || n.issues.push({ code: `invalid_format`, format: `cidrv6`, input: n.value, inst: e, continue: !t.abort, }); })); }); function Yn(e) { if (e === ``) return !0; if (/\s/.test(e) || e.length % 4 != 0) return !1; try { return (atob(e), !0); } catch { return !1; } } const Xn = /^[0-9a-zA-Z+/]*={0,2}$/, Zn = /*@__PURE__*/ E(`$ZodBase64`, (e, t) => { ((t.pattern ??= Xn), M.init(e, t), (e._zod.check = (n) => { Yn(n.value) || n.issues.push({ code: `invalid_format`, format: `base64`, input: n.value, inst: e, continue: !t.abort, }); })); }), Qn = /^[A-Za-z0-9_-]*$/; function $n(e) { if (!Qn.test(e)) return !1; let t = e.replace(/[-_]/g, (e) => (e === `-` ? `+` : `/`)); return Yn(t.padEnd(Math.ceil(t.length / 4) * 4, `=`)); } const er = /*@__PURE__*/ E(`$ZodBase64URL`, (e, t) => { ((t.pattern ??= Qn), M.init(e, t), (e._zod.check = (n) => { $n(n.value) || n.issues.push({ code: `invalid_format`, format: `base64url`, input: n.value, inst: e, continue: !t.abort, }); })); }), tr = /*@__PURE__*/ E(`$ZodE164`, (e, t) => { ((t.pattern ??= Lt), M.init(e, t)); }), nr = /[- ]/g; function rr(e) { let t = e.length, n = 1, r = 0; for (; t;) { let i = e.charCodeAt(--t) - 48; ((n ^= 1), (r += n ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][i] : i)); } return r % 10 == 0; } function ir(e) { return Rt.test(e) ? rr(e.replace(nr, ``)) : !1; } function ar(e) { let t = 0, n = e.length; for (let r = 4; r < n; r++) { let n = e.charCodeAt(r); t = (n >= 65 ? t * 100 + (n - 55) : t * 10 + (n - 48)) % 97; } for (let n = 0; n < 4; n++) { let r = e.charCodeAt(n); t = (r >= 65 ? t * 100 + (r - 55) : t * 10 + (r - 48)) % 97; } return t === 1; } function or(e) { return zt.test(e) ? ar(e) : !1; } function sr(e, t = null) { try { let n = e.split(`.`); if (n.length !== 3) return !1; let [r] = n; if (!r) return !1; let i = JSON.parse(atob(r)); return !((`typ` in i && i?.typ !== `JWT`) || !i.alg || (t && (!(`alg` in i) || i.alg !== t))); } catch { return !1; } } const cr = /*@__PURE__*/ E(`$ZodJWT`, (e, t) => { (M.init(e, t), (e._zod.check = (n) => { sr(n.value, t.alg) || n.issues.push({ code: `invalid_format`, format: `jwt`, input: n.value, inst: e, continue: !t.abort, }); })); }), lr = /*@__PURE__*/ E(`$ZodNumber`, (e, t) => { (j.init(e, t), (e._zod.pattern = qt), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = Number(n.value); } catch {} let i = n.value; if (typeof i == `number` && !Number.isNaN(i) && Number.isFinite(i)) return n; let a = typeof i == `number` ? Number.isNaN(i) ? `NaN` : Number.isFinite(i) ? void 0 : String(i) : void 0; return ( n.issues.push({ expected: `number`, code: `invalid_type`, input: i, inst: e, ...(a ? { received: a } : {}), }), n ); })); }), ur = /*@__PURE__*/ E(`$ZodNumberFormat`, (e, t) => { (tn.init(e, t), lr.init(e, t)); }), dr = /*@__PURE__*/ E(`$ZodUnknown`, (e, t) => { (j.init(e, t), (e._zod.parse = (e) => e)); }), fr = /*@__PURE__*/ E(`$ZodNever`, (e, t) => { (j.init(e, t), (e._zod.parse = (t, n) => ( t.issues.push({ expected: `never`, code: `invalid_type`, input: t.value, inst: e }), t ))); }), pr = /*@__PURE__*/ E(`$ZodDate`, (e, t) => { (j.init(e, t), (e._zod.parse = (n, r) => { if (t.coerce) try { n.value = new Date(n.value); } catch {} let i = n.value, a = i instanceof Date; return ( (a && !Number.isNaN(i.getTime())) || n.issues.push({ expected: `date`, code: `invalid_type`, input: i, ...(a ? { received: `Invalid Date` } : {}), inst: e, }), n ); })); }); function mr(e, t, n) { (e.issues.length && t.issues.push(...xe(n, e.issues)), (t.value[n] = e.value)); } const hr = /*@__PURE__*/ E(`$ZodArray`, (e, t) => { j.init(e, t); let n = O.memoizer; (n?.attach(e), (e._zod.parse = (r, i) => { let a = r.value; if (!Array.isArray(a)) return (r.issues.push({ expected: `array`, code: `invalid_type`, input: a, inst: e }), r); r.value = n ? n.alloc(e, r, Array(a.length), i) : Array(a.length); let o = [], s = i?.abortEarly; for (let e = 0; e < a.length; e++) { let n = a[e], c = t.element._zod.run({ value: n, issues: [] }, i); if (c instanceof Promise) o.push(c.then((t) => mr(t, r, e))); else if ((mr(c, r, e), s && c.issues.length !== 0 && x(c))) break; } return o.length ? Promise.all(o).then(() => r) : r; })); }); function gr(e, t, n, r, i, a) { let o = n in r, s = a === `optional`; if (o || !s || i !== `optional`) { if (e.issues.length) { if (i !== void 0 && s && !o) return; t.issues.push(...xe(n, e.issues)); } if (!o && i === void 0) { e.issues.length || t.issues.push({ code: `invalid_type`, expected: `nonoptional`, input: void 0, path: [n] }); return; } e.value === void 0 ? (o || (i === `defaulted` && !s)) && (t.value[n] = void 0) : (t.value[n] = e.value); } } const _r = []; function vr(e) { let t = Object.keys(e.shape), n = Object.getOwnPropertySymbols(e.shape), r = n.length ? n : _r, i = r.length ? [...t, ...r] : t; for (let t of i) if (!e.shape?.[t]?._zod?.traits?.has(`$ZodType`)) throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`); let a = ce(e.shape); return { ...e, allKeys: i, symbolKeys: r, keySet: new Set(t), numKeys: t.length, optionalKeys: new Set(a), }; } function yr(e, t, n, r, i, a, o) { let s = [], c = i.keySet, l = i.catchall._zod, u = l.def.type, d = l.optin, f = l.optout, p = 0; for (let i in t) { if (o && n.issues.length !== p) { if (x(n, p)) break; p = n.issues.length; } if (c.has(i)) continue; if (i === `__proto__`) { u === `never` && s.push(i); continue; } if (u === `never`) { s.push(i); continue; } let a = l.run({ value: t[i], issues: [] }, r); a instanceof Promise ? e.push(a.then((e) => gr(e, n, i, t, d, f))) : gr(a, n, i, t, d, f); } return ( s.length && n.issues.push({ code: `unrecognized_keys`, keys: s, input: t, inst: a, continue: !0 }), e.length ? Promise.all(e).then(() => n) : n ); } const br = /*@__PURE__*/ E(`$ZodObject`, (e, t) => { j.init(e, t); let n = Object.getOwnPropertyDescriptor(t, `shape`), r = n?.get ? n.get.raw : (t.shape ?? {}); if (r) { let e = () => { let n = { ...r }; return (Object.defineProperty(t, "shape", { value: n }), (e.raw = n), n); }; ((e.raw = r), Object.defineProperty(t, "shape", { get: e })); } let i = a(() => vr(t)); T(e, `propValues`, (e) => { let t = e.def.shape, n = {}; for (let e in t) { let r = t[e]._zod; if (r.values) { Object.prototype.hasOwnProperty.call(n, e) || l(n, e, /* @__PURE__ */ new Set()); for (let t of r.values) n[e].add(t); r.optin !== void 0 && n[e].add(void 0); } } return n; }); let o = ne, s = t.catchall, c, u = O.memoizer; (u?.attach(e), (e._zod.parse = (t, n) => { c ??= i.value; let r = t.value; if (!o(r)) return ( t.issues.push({ expected: `object`, code: `invalid_type`, input: r, inst: e }), t ); t.value = u ? u.alloc(e, t, {}, n) : {}; let a = [], l = c.shape, d = n?.abortEarly, f = t.issues.length; for (let e of c.allKeys) { if (d && t.issues.length !== f) { if (x(t, f)) break; f = t.issues.length; } if (e === `__proto__`) continue; let i = l[e], o = i._zod.optin, s = i._zod.optout, c = i._zod.run({ value: r[e], issues: [] }, n); c instanceof Promise ? a.push(c.then((n) => gr(n, t, e, r, o, s))) : gr(c, t, e, r, o, s); } return s ? yr(a, r, t, n, i.value, e, d === !0) : a.length ? Promise.all(a).then(() => t) : t; })); }), xr = /*@__PURE__*/ E(`$ZodObjectJIT`, (e, t) => { br.init(e, t); let n = e._zod.parse, r = a(() => vr(t)), i = O.memoizer, o = (t) => { let n = r.value, a = n.symbolKeys, o = new mn([`payload`, `ctx`], { shape: t, inst: e, memo: i, syms: a }), s = (e) => `shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`, c = (e, t) => ` let ${e}_ab = false; for (let i = 0; i < ${e}.issues.length; i++) { const iss = ${e}.issues[i]; iss.path = iss.path ? [${t}, ...iss.path] : [${t}]; payload.issues.push(iss); if (iss.continue !== true) ${e}_ab = true; } if (${e}_ab && ctx && ctx.abortEarly) { payload.value = newResult; return payload; }`; o.write(`const input = payload.value;`); let l = Object.create(null), u = 0; for (let e of n.allKeys) l[e] = `key_${u++}`; o.write( i ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`, ); for (let e of n.allKeys) { if (e === `__proto__`) continue; let n = l[e], r = typeof e == `symbol` ? `syms[${a.indexOf(e)}]` : _(e), i = `${r} in input`, u = t[e], d = u?._zod?.optin, f = d !== void 0, p = u?._zod?.optout === `optional`; if ((o.write(`const ${n} = ${s(r)};`), f && p)) { let e = d === `optional` ? `${n}_present` : `${n}.value !== undefined || ${n}_present`; o.write(` const ${n}_present = ${i}; if (!${n}.issues.length || ${n}_present) { if (${n}.issues.length) {${c(n, r)} } if (${e}) { newResult[${r}] = ${n}.value; } } `); } else f ? (o.write(` if (${n}.issues.length) {${c(n, r)} } `), d === `defaulted` ? o.write(`newResult[${r}] = ${n}.value;`) : o.write(` if (${n}.value !== undefined || ${i}) { newResult[${r}] = ${n}.value; } `)) : o.write(` const ${n}_present = ${i}; if (${n}.issues.length) {${c(n, r)} } if (!${n}_present && !${n}.issues.length) { payload.issues.push({ code: "invalid_type", expected: "nonoptional", input: undefined, path: [${r}] }); if (ctx && ctx.abortEarly) { payload.value = newResult; return payload; } } if (${n}_present) { newResult[${r}] = ${n}.value; } `); } return (o.write(`payload.value = newResult;`), o.write(`return payload;`), o.compile()); }, s, c = ne, l = !O.jitless, u = l && re.value, d = t.catchall, f; e._zod.parse = (i, a) => { f ??= r.value; let p = i.value; return c(p) ? l && u && a?.async === !1 && a.jitless !== !0 ? ((s ||= o(t.shape)), (i = s(i, a)), d ? yr([], p, i, a, f, e, a?.abortEarly === !0) : i) : n(i, a) : (i.issues.push({ expected: `object`, code: `invalid_type`, input: p, inst: e }), i); }; }); function Sr(e, t, n, r) { for (let n of e) if (n.issues.length === 0) return ((t.value = n.value), t); let i = e.filter((e) => !x(e)); return i.length === 1 ? ((t.value = i[0].value), i[0]) : (t.issues.push({ code: `invalid_union`, input: t.value, inst: n, errors: e.map((e) => e.issues.map((e) => S(e, r, k()))), }), t); } const Cr = /*@__PURE__*/ E(`$ZodUnion`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.options.some((e) => e._zod.optin === `defaulted`) ? `defaulted` : e.def.options.some((e) => e._zod.optin !== void 0) ? `optional` : void 0, ), T(e, `optout`, (e) => e.def.options.some((e) => e._zod.optout === `optional`) ? `optional` : void 0, ), T(e, `values`, (e) => { if (e.def.options.every((e) => e._zod.values)) return new Set(e.def.options.flatMap((e) => Array.from(e._zod.values))); }), T(e, `pattern`, (e) => { if (e.def.options.every((e) => e._zod.pattern)) { let t = e.def.options.map((e) => e._zod.pattern); return RegExp(`^(${t.map((e) => s(e.source)).join(`|`)})$`); } })); let n = t.options.length === 1 ? t.options[0]._zod.run : null; e._zod.parse = (r, i) => { if (n) return n(r, i); let a = !1, o = []; for (let e of t.options) { let t = e._zod.run({ value: r.value, issues: [] }, i); if (t instanceof Promise) (o.push(t), (a = !0)); else { if (t.issues.length === 0) return t; o.push(t); } } return a ? Promise.all(o).then((t) => Sr(t, r, e, i)) : Sr(o, r, e, i); }; }), wr = /*@__PURE__*/ E(`$ZodIntersection`, (e, t) => { (j.init(e, t), (e._zod.parse = (e, n) => { let r = e.value, i = t.left._zod.run({ value: r, issues: [] }, n), a = t.right._zod.run({ value: r, issues: [] }, n); return i instanceof Promise || a instanceof Promise ? Promise.all([i, a]).then(([t, n]) => Er(e, t, n)) : Er(e, i, a); })); }); function Tr(e, t) { if (e === t || (e instanceof Date && t instanceof Date && +e == +t)) return { valid: !0, data: e }; if (v(e) && v(t)) { let n = Object.keys(t), r = Object.keys(e).filter((e) => n.indexOf(e) !== -1), i = { ...e, ...t }; Object.prototype.hasOwnProperty.call(i, `__proto__`) && delete i.__proto__; for (let n of r) { if (n === `__proto__`) continue; let r = Tr(e[n], t[n]); if (!r.valid) return { valid: !1, mergeErrorPath: [n, ...r.mergeErrorPath] }; i[n] = r.data; } return { valid: !0, data: i }; } if (Array.isArray(e) && Array.isArray(t)) { if (e.length !== t.length) return { valid: !1, mergeErrorPath: [] }; let n = []; for (let r = 0; r < e.length; r++) { let i = e[r], a = t[r], o = Tr(i, a); if (!o.valid) return { valid: !1, mergeErrorPath: [r, ...o.mergeErrorPath] }; n.push(o.data); } return { valid: !0, data: n }; } return { valid: !1, mergeErrorPath: [] }; } function Er(e, t, n) { let r = /* @__PURE__ */ new Map(), i, a = /* @__PURE__ */ new Map(), o = (e, t) => { let n; if (e.code === `unrecognized_keys` && !e.path?.length) ((i ??= e), (n = e.keys)); else if (e.code === `invalid_key` && e.origin === `record` && e.path?.length === 1) { let t = String(e.path[0]); (a.has(t) || a.set(t, e), (n = [t])); } else return !1; for (let e of n) (r.has(e) || r.set(e, {}), (r.get(e)[t] = !0)); return !0; }; for (let n of t.issues) o(n, `l`) || e.issues.push(n); for (let t of n.issues) o(t, `r`) || e.issues.push(t); let s = [...r].filter(([, e]) => e.l && e.r).map(([e]) => e); if (s.length) { let t = i ? s.filter((e) => i.keys.includes(e)) : []; t.length && e.issues.push({ ...i, keys: t }); for (let n of s) !t.includes(n) && a.has(n) && e.issues.push(a.get(n)); } let c = Tr(t.value, n.value); if (!c.valid) { if (x(e)) return e; throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`); } return ((e.value = c.data), e); } const Dr = /*@__PURE__*/ E(`$ZodEnum`, (e, n) => { j.init(e, n); let r = t(n.entries), i = new Set(r); ((e._zod.values = i), T(e, `pattern`, (e) => { let n = t(e.def.entries).filter((e) => ae.has(typeof e)); return RegExp(n.length ? `^(${n.map((e) => oe(e.toString())).join(`|`)})$` : `^[^\\s\\S]$`); }), (e._zod.parse = (t, n) => { let a = t.value; return ( i.has(a) || t.issues.push({ code: `invalid_value`, values: r, input: a, inst: e }), t ); })); }), Or = /*@__PURE__*/ E(`$ZodTransform`, (e, t) => { (j.init(e, t), (e._zod.optin = `optional`), O.memoizer?.guard(e), (e._zod.parse = (n, r) => { if (r.direction === `backward`) throw new He(e.constructor.name); let i = t.transform(n.value, n); if (r.async) return (i instanceof Promise ? i : Promise.resolve(i)).then((e) => ((n.value = e), n)); if (i instanceof Promise) throw new D(); return ((n.value = i), n); })); }); function kr(e, t) { return ((e.value = t.issues.length ? void 0 : t.value), e); } const Ar = /*@__PURE__*/ E(`$ZodOptional`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => (e.def.innerType._zod.optin === `defaulted` ? `defaulted` : `optional`)), (e._zod.optout = `optional`), T(e, `values`, (e) => { let t = e.def.innerType._zod.values; return t ? /* @__PURE__ */ new Set([...t, void 0]) : void 0; }), T(e, `pattern`, (e) => { let t = e.def.innerType._zod.pattern; return t ? RegExp(`^(${s(t.source)})?$`) : void 0; }), (e._zod.parse = (e, n) => { if (e.value === void 0) { if (t.innerType._zod.optin !== `defaulted`) return e; let r = t.innerType._zod.run({ value: e.value, issues: [] }, n); return r instanceof Promise ? r.then((t) => kr(e, t)) : kr(e, r); } return t.innerType._zod.run(e, n); })); }), jr = /*@__PURE__*/ E(`$ZodExactOptional`, (e, t) => { (Ar.init(e, t), T(e, `values`, (e) => e.def.innerType._zod.values), T(e, `pattern`, (e) => e.def.innerType._zod.pattern), (e._zod.parse = (e, n) => t.innerType._zod.run(e, n))); }), Mr = /*@__PURE__*/ E(`$ZodNullable`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => e.def.innerType._zod.optin), T(e, `optout`, (e) => e.def.innerType._zod.optout), T(e, `pattern`, (e) => { let t = e.def.innerType._zod.pattern; return t ? RegExp(`^(${s(t.source)}|null)$`) : void 0; }), T(e, `values`, (e) => e.def.innerType._zod.values ? /* @__PURE__ */ new Set([...e.def.innerType._zod.values, null]) : void 0, ), (e._zod.parse = (e, n) => (e.value === null ? e : t.innerType._zod.run(e, n)))); }), Nr = /*@__PURE__*/ E(`$ZodDefault`, (e, t) => { (j.init(e, t), (e._zod.optin = `defaulted`), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); if (e.value === void 0) return ((e.value = t.defaultValue), e); let r = t.innerType._zod.run(e, n); return r instanceof Promise ? r.then((e) => Pr(e, t)) : Pr(r, t); })); }); function Pr(e, t) { return (e.value === void 0 && (e.value = t.defaultValue), e); } const Fr = /*@__PURE__*/ E(`$ZodPrefault`, (e, t) => { (j.init(e, t), (e._zod.optin = `defaulted`), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => ( n.direction === `backward` || (e.value === void 0 && (e.value = t.defaultValue)), t.innerType._zod.run(e, n) ))); }), Ir = /*@__PURE__*/ E(`$ZodNonOptional`, (e, t) => { (j.init(e, t), T(e, `values`, (e) => { let t = e.def.innerType._zod.values; return t ? new Set([...t].filter((e) => e !== void 0)) : void 0; }), (e._zod.parse = (n, r) => { let i = t.innerType._zod.run(n, r); return i instanceof Promise ? i.then((t) => Lr(t, e)) : Lr(i, e); })); }); function Lr(e, t) { return ( !e.issues.length && e.value === void 0 && e.issues.push({ code: `invalid_type`, expected: `nonoptional`, input: e.value, inst: t }), e ); } function Rr(e, t, n, r) { return t.issues.length ? ((e.value = n.catchValue({ ...t, value: e.value, error: { issues: t.issues.map((e) => S(e, r, k())) }, input: e.value, })), e) : ((e.value = t.value), t.memo && (e.memo = !0), e); } const zr = /*@__PURE__*/ E(`$ZodCatch`, (e, t) => { (j.init(e, t), T(e, `optin`, (e) => (e.def.innerType._zod.optin === `defaulted` ? `defaulted` : `optional`)), T(e, `optout`, (e) => e.def.innerType._zod.optout), T(e, `values`, (e) => e.def.innerType._zod.values), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); let r = t.innerType._zod.run({ value: e.value, issues: [] }, n); return r instanceof Promise ? r.then((r) => Rr(e, r, t, n)) : Rr(e, r, t, n); })); }), Br = /*@__PURE__*/ E(`$ZodPipe`, (e, t) => { (j.init(e, t), T(e, `values`, (e) => e.def.in._zod.values), T(e, `optin`, (e) => e.def.in._zod.optin), T(e, `optout`, (e) => e.def.out._zod.optout), T(e, `propValues`, (e) => e.def.in._zod.propValues), (e._zod.parse = (e, n) => { if (n.direction === `backward`) { let r = t.out._zod.run(e, n); return r instanceof Promise ? r.then((e) => Vr(e, t.in, n)) : Vr(r, t.in, n); } let r = t.in._zod.run(e, n); return r instanceof Promise ? r.then((e) => Vr(e, t.out, n)) : Vr(r, t.out, n); })); }); function Vr(e, t, n) { return e.issues.some((e) => e.code !== `unrecognized_keys`) ? ((e.aborted = !0), e) : t._zod.run({ value: e.value, issues: e.issues }, n); } const Hr = /*@__PURE__*/ E(`$ZodReadonly`, (e, t) => { (j.init(e, t), T(e, `propValues`, (e) => e.def.innerType._zod.propValues), T(e, `values`, (e) => e.def.innerType._zod.values), T(e, `optin`, (e) => e.def.innerType?._zod?.optin), T(e, `optout`, (e) => e.def.innerType?._zod?.optout), (e._zod.parse = (e, n) => { if (n.direction === `backward`) return t.innerType._zod.run(e, n); let r = t.innerType._zod.run(e, n); return r instanceof Promise ? r.then(Ur) : Ur(r); })); }); function Ur(e) { return (e.memo || (e.value = Object.freeze(e.value)), e); } const Wr = /*@__PURE__*/ E(`$ZodCustom`, (e, t) => { (A.init(e, t), j.init(e, t), (e._zod.parse = (e, t) => e), (e._zod.check = (n) => { let r = n.value, i = t.fn(r); if (i instanceof Promise) return i.then((t) => Gr(t, n, r, e)); Gr(i, n, r, e); })); }); function Gr(e, t, n, r) { if (!e) { let e = { code: `custom`, input: n, inst: r, path: [...(r._zod.def.path ?? [])], continue: !r._zod.def.abort, }; (r._zod.def.params && (e.params = r._zod.def.params), t.issues.push(Oe(e))); } } var Kr = class extends Error { constructor() { (super(`Cannot parse a reference cycle that closes through a transform`), (this.name = `ZodCyclicError`)); } }; const qr = `~memo`, Jr = []; function Yr(e) { return typeof e == `object` && !!e; } function Xr(e) { return e.map((e) => (e.path ? { ...e, path: e.path.slice() } : { ...e })); } const Zr = /*@__PURE__*/ new WeakMap(); function Qr(e, t, n) { let r = Zr.get(e); if (r !== void 0) return r ? 2 : 0; if (t.has(e)) return 2; t.add(e); let i = 0, a = (e) => { if (i !== 2 && e?._zod) { let r = Qr(e, t, n); r > i && (i = r); } }, o = (e, r) => { let i = 0; for (let a of Reflect.ownKeys(e)) { let o = Object.getOwnPropertyDescriptor(e, a); if (r && !o.enumerable) continue; let s = o.get ? 1 : o.value?._zod ? Qr(o.value, t, n) : 0; s > i && (i = s); } return i; }, s = (e) => { e > i && (i = e); }, c = e._zod.def; switch (c.type) { case `object`: { let e = u(c); (s(e ? o(e, !0) : 1), a(c.catchall)); break; } case `array`: a(c.element); break; case `tuple`: for (let e of c.items) a(e); a(c.rest); break; case `record`: case `map`: (a(c.keyType), a(c.valueType)); break; case `set`: a(c.valueType); break; case `union`: for (let e of c.options) a(e); break; case `intersection`: (a(c.left), a(c.right)); break; case `optional`: case `nullable`: case `default`: case `prefault`: case `catch`: case `readonly`: case `nonoptional`: case `promise`: case `success`: a(c.innerType); break; case `pipe`: (a(c.in), a(c.out)); break; case `function`: (a(c.input), a(c.output)); break; case `lazy`: { let r = c._cachedInner ?? (n ? e._zod.innerType : void 0); s(r ? Qr(r, t, !1) : 1); break; } case `template_literal`: case `string`: case `number`: case `int`: case `boolean`: case `bigint`: case `symbol`: case `undefined`: case `null`: case `void`: case `never`: case `any`: case `unknown`: case `date`: case `nan`: case `enum`: case `literal`: case `file`: case `transform`: case `custom`: break; default: for (let e in c) { let t = Object.getOwnPropertyDescriptor(c, e); if (!t || t.get) continue; let n = t.value; if (n && typeof n == `object`) { if (n._zod) a(n); else if (Array.isArray(n)) for (let e of n) a(e); } } } return (t.delete(e), $r(e, i)); } function $r(e, t) { return (t !== 1 && Zr.set(e, t === 2), t); } function ei(e) { return Qr(e, /* @__PURE__ */ new Set(), !0) !== 0; } function ti(e, t) { let n = e.buckets.get(t); return (n || ((n = /* @__PURE__ */ new WeakMap()), e.buckets.set(t, n)), n); } let ni; const ri = [], ii = { alloc(e, t, n) { let r = ni; if (!r) return n; ni = void 0; let i = { value: n, issues: null }; return (r.set(t.value, i), ri.push(i), n); }, guard(e) { var t; ((t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred.push(() => { let t = e._zod.parse, n = (e, n) => { if (n.direction !== `backward` && oi(n, e.value)) throw new Kr(); return t(e, n); }; ((e._zod.parse = n), e._zod.run === t && (e._zod.run = n)); })); }, attach(e) { var t; let n, r = !1, i, a; ((t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred.push(() => { let t = e._zod.parse, o = (s, c) => { if (n === void 0) { let i = Qr(e, /* @__PURE__ */ new Set(), !1); if (i === 0) return ((e._zod.parse = t), e._zod.run === o && (e._zod.run = t), t(s, c)); i === 2 || r ? (n = !0) : (r = !0); } let l = s.value; if (!Yr(l)) return t(s, c); let u = c[qr]; u || ((u = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0 }), (c[qr] = u)); let d; i === c ? (d = a) : ((d = ti(u, e)), (i = c), (a = d)); let f = d.get(l); if (f) return ( (s.value = f.value), f.issues ? f.issues.length && s.issues.push(...Xr(f.issues)) : ((s.memo = !0), u.backEdges ?? (u.backEdges = /* @__PURE__ */ new WeakSet()), u.backEdges.add(f.value)), s ); ni = d; let p = ri.length, m = t(s, c); ni = void 0; let h = ri.length > p ? ri.pop() : void 0; return m instanceof Promise ? m.then((e) => (h && (h.issues = e.issues.length ? Xr(e.issues) : Jr), e)) : (h && (h.issues = m.issues.length ? Xr(m.issues) : Jr), m); }; ((e._zod.parse = o), e._zod.run === t && (e._zod.run = o)); })); }, }; function ai() { return ii; } function oi(e, t) { let n = e[qr]?.backEdges; return n !== void 0 && Yr(t) && n.has(t); } const si = () => { let e = { string: { unit: `characters`, verb: `to have` }, file: { unit: `bytes`, verb: `to have` }, array: { unit: `items`, verb: `to have` }, set: { unit: `items`, verb: `to have` }, map: { unit: `entries`, verb: `to have` }, }; function t(t) { return e[t] ?? null; } let r = { regex: `input`, email: `email address`, url: `URL`, emoji: `emoji`, uuid: `UUID`, uuidv4: `UUIDv4`, uuidv6: `UUIDv6`, nanoid: `nanoid`, guid: `GUID`, cuid: `cuid`, cuid2: `cuid2`, ulid: `ULID`, xid: `XID`, ksuid: `KSUID`, datetime: `ISO datetime`, date: `ISO date`, time: `ISO time`, duration: `ISO duration`, ipv4: `IPv4 address`, ipv6: `IPv6 address`, mac: `MAC address`, cidrv4: `IPv4 range`, cidrv6: `IPv6 range`, base64: `base64-encoded string`, base64url: `base64url-encoded string`, json_string: `JSON string`, e164: `E.164 number`, currency_code: `currency code`, credit_card: `credit card number`, iban: `IBAN`, jwt: `JWT`, template_literal: `input`, }, i = { nan: `NaN` }; function a(e, t) { return e === `number` && typeof t == `number` && !Number.isFinite(t) ? String(t) : (i[e] ?? e); } return (e) => { switch (e.code) { case `invalid_type`: return `Invalid input: expected ${a(e.expected)}, received ${a(De(e.input), e.input)}`; case `invalid_value`: return e.values.length === 1 ? `Invalid input: expected ${se(e.values[0])}` : `Invalid option: expected one of ${n(e.values, `|`)}`; case `too_big`: { let n = e.exact ? `exactly ` : e.inclusive ? `<=` : `<`, r = t(e.origin); return r ? `Too big: expected ${e.origin ?? `value`} to have ${n}${e.maximum.toString()} ${r.unit ?? `elements`}` : `Too big: expected ${e.origin ?? `value`} to be ${n}${e.maximum.toString()}`; } case `too_small`: { let n = e.exact ? `exactly ` : e.inclusive ? `>=` : `>`, r = t(e.origin); return r ? `Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}` : `Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`; } case `invalid_format`: { let t = e; return t.format === `starts_with` ? `Invalid string: must start with "${t.prefix}"` : t.format === `ends_with` ? `Invalid string: must end with "${t.suffix}"` : t.format === `includes` ? `Invalid string: must include "${t.includes}"` : t.format === `regex` ? `Invalid string: must match pattern ${t.pattern}` : `Invalid ${r[t.format] ?? e.format}`; } case `not_multiple_of`: return `Invalid number: must be a multiple of ${e.divisor}`; case `unrecognized_keys`: return `Unrecognized key${e.keys.length > 1 ? `s` : ``}: ${n(e.keys, `, `)}`; case `invalid_key`: return `Invalid key in ${e.origin}`; case `invalid_union`: return e.options && Array.isArray(e.options) && e.options.length > 0 ? `Invalid discriminator value. Expected ${e.options.map((e) => `'${e}'`).join(` | `)}` : e.inclusive === !1 ? `Invalid input: more than one option matched` : `Invalid input`; case `invalid_element`: return `Invalid value in ${e.origin}`; default: return `Invalid input`; } }; }; function ci() { return { localeError: si() }; } var li, ui = class { constructor() { ((this._map = /* @__PURE__ */ new WeakMap()), (this._idmap = /* @__PURE__ */ new Map())); } add(e, ...t) { let n = t[0]; return ( this._map.set(e, n), n && typeof n == `object` && `id` in n && this._idmap.set(n.id, e), this ); } clear() { return ( (this._map = /* @__PURE__ */ new WeakMap()), (this._idmap = /* @__PURE__ */ new Map()), this ); } remove(e) { let t = this._map.get(e); return ( t && typeof t == `object` && `id` in t && this._idmap.delete(t.id), this._map.delete(e), this ); } get(e) { let t = e._zod.parent; if (t) { let n = { ...(this.get(t) ?? {}) }; delete n.id; let r = { ...n, ...this._map.get(e) }; return Object.keys(r).length ? r : void 0; } return this._map.get(e); } has(e) { return this._map.has(e); } }; function di() { return new ui(); } (li = globalThis).__zod_globalRegistry ?? (li.__zod_globalRegistry = di()); const fi = globalThis.__zod_globalRegistry, N = Symbol.for(`zod.compile.invalid`), pi = Symbol.for(`zod.compile.fallback`); var P = class extends Error { constructor(e = `z.compile does not support async refinements, transforms, or checks`) { (super(e), (this.name = `ZodCompileAsyncError`)); } }, F = class extends Error { constructor(e, t = !0) { (super(`z.compile does not support ${e}; this schema must use the runtime parser`), (this.name = `ZodCompileUnsupportedError`), (this.islandable = t)); } }; function mi(e, t) { try { return vi(e, { assertOnly: !0 }); } catch { return t; } } function hi(e, t) { try { let t = vi(e), n = gi(e, t); return ((n._zod.bag.validator = mi(e, t)), n); } catch (n) { if (t?.strict) throw n; return e; } } function gi(e, t) { if (ei(e)) throw new F(`a schema whose subtree contains a reference cycle`); let n = y(e), r = e._zod.run, i = r.__originalRun ?? r, a = (e, n) => { if ( n?.async || n?.direction === `backward` || n?.skipChecks || n?.[pi] || (n && oi(n, e.value)) ) return i(e, n); let r = t(e.value); return r === N ? (n && (n[pi] = !0), i(e, n)) : ((e.value = r), e); }; return ( (a.__originalRun = i), (n._zod.bag.fallbackRun = i), (n._zod.bag.validator = t), (n._zod.run = a), r.__originalRun || _i(n, e, t), n ); } function _i(e, t, n) { let r = e, i = t; if (typeof i.safeParse == `function`) { let e = i.safeParse; r.safeParse = (t, r) => { let i = n(t); return i === N ? e(t, r) : { success: !0, data: i }; }; } if (typeof i.parse == `function`) { let e = i.parse; r.parse = (t, r) => { let i = n(t); return i === N ? e(t, r) : i; }; } } function vi(e, t) { let n = !0; try { n = ei(e); } catch {} if (n) throw new F(`a schema whose subtree contains a reference cycle`); let r = { constants: /* @__PURE__ */ new Map(), constantCounter: 0, varCounter: 0, definite: !0 }, i = new mn([`input`]), a = V(i, r, e, `input`, !t?.assertOnly); i.write(a === null ? `return true;` : `return ${a};`); let o = [`INVALID`, ...r.constants.keys()], s = [N, ...r.constants.values()], c = i.content.join(` `), l = t?.debug ? (o.length > 0 ? `// Constants: ${o.join(`, `)}\n${c}` : c) : ``, u = Function, d = `return (input) => {\n${c}\n}`, f; try { f = new u(...o, d)(...s); } catch (e) { throw new F(`this schema (generated code failed to evaluate: ${e.message})`); } return (t?.debug && (f.code = l), (f.definite = r.definite), f); } function I(e, t) { for (let [n, r] of e.constants) if (r === t) return n; let n = `c${e.constantCounter++}`; return (e.constants.set(n, t), n); } function L(e, t) { return ((e.definite = !1), I(e, t)); } function R(e) { return `v${e.varCounter++}`; } function yi(e, t) { let n = e._zod.run({ value: t, issues: [] }, {}); if (n && typeof n.then == `function`) return N; let r = n; return r.issues.length === 0 ? r.value : N; } function z(e, t, n, r, i = !0) { let a = e.content.length, o = t.constants.size, s = t.constantCounter, c = t.varCounter; try { return V(e, t, n, r, i); } catch (i) { if (!(i instanceof F) || !i.islandable) throw i; if (((e.content.length = a), t.constants.size > o)) { let e = Array.from(t.constants.keys()).slice(o); for (let n of e) t.constants.delete(n); } return ((t.constantCounter = s), (t.varCounter = c), bi(e, t, n, r)); } } function bi(e, t, n, r) { t.definite = !1; let i = I(t, n), a = I(t, yi), o = R(t); return ( e.write(`const ${o} = ${a}(${i}, ${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } const xi = /* @__PURE__ */ new Set([ `max_size`, `min_size`, `size_equals`, `max_length`, `min_length`, `length_equals`, ]); function Si(e, t, n, r) { let i = n._zod.def.checks; if (!i || i.length === 0) return r; let a = r; for (let n of i) { let r = n._zod.def; if (r.when && !xi.has(r.check)) throw new F(`check with a custom "when" condition`); switch (r.check) { case `greater_than`: Ti(e, t, r, a); break; case `less_than`: Ei(e, t, r, a); break; case `multiple_of`: Di(e, t, r, a); break; case `number_format`: Oi(e, r, a); break; case `min_length`: { let n = B(r.minimum, `min_length`), i = Ci(e, t, a, `${a}.length >= ${n} && ${a}.length < ${r.minimum * 2}`); e.write(`if (${i} < ${n}) return INVALID;`); break; } case `max_length`: { let n = B(r.maximum, `max_length`), i = Ci(e, t, a, `${a}.length > ${n}`); e.write(`if (${i} > ${n}) return INVALID;`); break; } case `length_equals`: { let n = B(r.length, `length_equals`), i = Ci(e, t, a, `${a}.length >= ${n} && ${a}.length <= ${r.length * 2}`); e.write(`if (${i} !== ${n}) return INVALID;`); break; } case `min_size`: e.write(`if (${a}.size < ${B(r.minimum, `min_size`)}) return INVALID;`); break; case `max_size`: e.write(`if (${a}.size > ${B(r.maximum, `max_size`)}) return INVALID;`); break; case `size_equals`: e.write(`if (${a}.size !== ${B(r.size, `size_equals`)}) return INVALID;`); break; case `string_format`: a = Ri(e, t, r, a); break; case `custom`: a = Ii(e, t, n, a); break; case `bigint_format`: ki(e, r, a); break; case `mime_type`: Ai(e, t, r, a); break; case `property`: Mi(e, t, r, a); break; case `properties`: ji(e, t, r, a); break; case `overwrite`: { let r = R(t); (Ni(e, t, n, a, r), (a = r)); break; } default: throw new F(`check type ${r.check}`); } } return a; } function Ci(e, t, n, r) { let i = I(t, Te), a = R(t); return (e.write(`const ${a} = typeof ${n} === "string" && ${r} ? ${i}(${n}) : ${n}.length;`), a); } function B(e, t) { if (typeof e != `number` || !Number.isFinite(e)) throw new F(`${t} bound of type ${typeof e}`); return `${e}`; } function wi(e, t) { if (typeof t == `bigint`) return `${t}n`; if (typeof t == `number`) { if (Number.isNaN(t)) throw new F(`comparison check with NaN bound`); return `${t}`; } if (t instanceof Date) { if (Number.isNaN(t.getTime())) throw new F(`comparison check with Invalid Date bound`); return I(e, t); } throw new F(`comparison check bound of type ${typeof t}`); } function Ti(e, t, n, r) { let i = n.inclusive ? `<` : `<=`; e.write(`if (${r} ${i} ${wi(t, n.value)}) return INVALID;`); } function Ei(e, t, n, r) { let i = n.inclusive ? `>` : `>=`; e.write(`if (${r} ${i} ${wi(t, n.value)}) return INVALID;`); } function Di(e, t, n, r) { if (typeof n.value == `bigint`) { if (n.value === BigInt(0)) throw new F(`multiple_of check with a zero divisor`); e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`); } else { let i = I(t, c); e.write(`if (${i}(${r}, ${B(n.value, `multiple_of`)}) !== 0) return INVALID;`); } } function Oi(e, t, n) { let r = t.format; switch (r) { case `safeint`: e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`); break; case `int32`: e.write( `if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`, ); break; case `uint32`: e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`); break; case `float32`: e.write( `if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`, ); break; case `float64`: e.write(`if (!Number.isFinite(${n})) return INVALID;`); break; default: throw new F(`number format ${r}`); } } function ki(e, t, n) { let r = t.format; if (r) switch (r) { case `int64`: e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`); break; case `uint64`: e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`); break; default: throw new F(`bigint format ${r}`); } } function Ai(e, t, n, r) { let i = n.mime; if (i && i.length > 0) { let n = I(t, new Set(i)); e.write(`if (!${n}.has(${r}.type)) return INVALID;`); } } function ji(e, t, n, r) { if (n.when) throw new F(`check with a custom "when" condition`); e.write(`if (${r} == null) return INVALID;`); let i = n.shape; for (let n of Reflect.ownKeys(i)) { let a = typeof n == `symbol` ? I(t, n) : _(n), o = R(t); (e.write(`const ${o} = ${r}[${a}];`), z(e, t, i[n], o, !1)); } } function Mi(e, t, n, r) { let i = `${r}[${JSON.stringify(n.property)}]`; V(e, t, n.schema, i); } function Ni(e, t, n, r, i) { let a = n._zod.def.tx; if (!a) throw new F(`overwrite check without a transform function`); if (W(a)) throw new P(`z.compile: async overwrite transforms are not supported`); let o = I(t, a); e.write(`const ${i} = ${o}(${r});`); } function Pi() { throw new D(); } function Fi(e) { this.issues.push(e); } function Ii(e, t, n, r) { let i = n._zod.def; if (i.fn) { if (W(i.fn)) throw new P(`z.compile: async .refine() predicates are not supported`); let n = L(t, i.fn), a = I(t, Pi), o = R(t); return ( e.write(`const ${o} = ${n}(${r});`), e.write(`if (${o} instanceof Promise) ${a}();`), e.write(`if (!${o}) return INVALID;`), r ); } if (n._zod.check) { if (W(n._zod.check)) throw new P(`z.compile: async .superRefine() / check functions are not supported`); let i = n._zod.check, a = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }; return (i(t) instanceof Promise && Pi(), t.issues.length === 0 ? t.value : N); }), o = R(t); return ( e.write(`const ${o} = ${a}(${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } throw new F(`custom check without a predicate or check function`); } const Li = /* @__PURE__ */ new Set([ `cidrv4`, `cuid`, `cuid2`, `date`, `datetime`, `duration`, `e164`, `email`, `emoji`, `ends_with`, `guid`, `includes`, `ipv4`, `ksuid`, `lowercase`, `mac`, `nanoid`, `regex`, `starts_with`, `time`, `ulid`, `uppercase`, `uuid`, `xid`, ]); function Ri(e, t, n, r, i = !0) { let a = n.format; if (a === `base64`) { let n = I(t, Yn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `base64url`) { let n = I(t, $n); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `jwt`) { let i = I(t, sr), a = I(t, n.alg ?? null); return (e.write(`if (!${i}(${r}, ${a})) return INVALID;`), r); } if (a === `ipv6`) { let n = I(t, Wn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `cidrv6`) { let n = I(t, qn); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `credit_card`) { let n = I(t, ir); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (a === `iban`) { let n = I(t, or); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } let o = n; if ( a === `url` || a === `httpurl` || o.normalize || o.hostname !== void 0 || o.protocol !== void 0 ) { let a = I(t, wn), s = I(t, n), c = R(t), l = R(t); if ( (e.write(`const ${c} = ${r}.trim();`), e.write(`const ${l} = ${a}(${c}, ${s});`), e.write(`if (typeof ${l} === "number") return INVALID;`), o.hostname !== void 0) ) { let n = I(t, On); e.write(`if (!${n}(${l}, ${s}.hostname)) return INVALID;`); } if (o.protocol !== void 0) { let n = I(t, kn); e.write(`if (!${n}(${l}, ${s}.protocol)) return INVALID;`); } if (!i) return null; let u = R(t), d = o.normalize ? `${l}.href` : `${I(t, Dn)}(${c})`; return (e.write(`const ${u} = ${d};`), u); } let s = n.fn; if (s) { if (W(s)) throw new F(`async string format ${a}`); let n = I(t, s); return (e.write(`if (!${n}(${r})) return INVALID;`), r); } if (Li.has(a) && n.pattern) { let i = I(t, n.pattern); return (e.write(`${i}.lastIndex = 0;`), e.write(`if (!${i}.test(${r})) return INVALID;`), r); } let c = n.format; switch (c) { case `regex`: throw new F(`regex format without a pattern`); case `lowercase`: e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`); break; case `uppercase`: e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`); break; case `includes`: e.write(`if (!${r}.includes(${_(n.includes)})) return INVALID;`); break; case `starts_with`: { let t = n.prefix; e.write(`if (${r}.slice(0, ${t.length}) !== ${_(t)}) return INVALID;`); break; } case `ends_with`: { let t = n.suffix; e.write(`if (${r}.slice(-${t.length}) !== ${_(t)}) return INVALID;`); break; } default: throw new F(`string format ${c}`); } return r; } function V(e, t, n, r, i = !0) { let a = n._zod.def, o = a.type; if (a.coerce) throw new F(`coercion (z.coerce.${o}())`); let s = i || !!a.checks?.length, c; switch (o) { case `string`: c = zi(e, t, n, r, s); break; case `number`: c = Bi(e, n, r); break; case `boolean`: c = Vi(e, r); break; case `bigint`: c = Hi(e, n, r); break; case `symbol`: c = Ui(e, r); break; case `undefined`: c = Wi(e, r); break; case `null`: c = Gi(e, r); break; case `any`: case `unknown`: c = r; break; case `never`: (e.write(`return INVALID;`), (c = r)); break; case `void`: c = Ki(e, r); break; case `nan`: c = qi(e, r); break; case `date`: c = Ji(e, r); break; case `object`: c = Yi(e, t, n, r, s); break; case `optional`: c = Xi(e, t, n, r, s); break; case `nullable`: c = ta(e, t, n, r, s); break; case `array`: c = na(e, t, n, r, s); break; case `literal`: c = ra(e, t, n, r); break; case `enum`: c = ia(e, t, n, r); break; case `readonly`: { let i = aa(e, t, n, r), a = R(t); (e.write(`const ${a} = Object.freeze(${i});`), (c = a)); break; } case `success`: (aa(e, t, n, r), (c = `true`)); break; case `default`: case `prefault`: c = oa(e, t, n, r); break; case `nonoptional`: c = sa(e, t, n, r); break; case `tuple`: c = ca(e, t, n, r); break; case `union`: c = ua(e, t, n, r); break; case `intersection`: c = pa(e, t, n, r); break; case `record`: c = ma(e, t, n, r); break; case `map`: c = _a(e, t, n, r); break; case `set`: c = va(e, t, n, r); break; case `file`: c = ya(e, r); break; case `template_literal`: c = ba(e, t, n, r); break; case `lazy`: c = xa(e, t, n, r); break; case `pipe`: c = Sa(e, t, n, r); break; case `custom`: c = Ca(e, t, n, r); break; case `transform`: c = Ea(e, t, n, r); break; case `catch`: c = Ta(e, t, n, r); break; default: throw new F(`schema type ${o}`); } return c === null ? null : Si(e, t, n, c); } function zi(e, t, n, r, i = !0) { e.write(`if (typeof ${r} !== "string") return INVALID;`); let a = n._zod.def; return a.format === void 0 ? r : Ri(e, t, a, r, i); } function Bi(e, t, n) { e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`); let r = t._zod.def; return (r.check === `number_format` && r.format && Oi(e, { format: r.format }, n), n); } function Vi(e, t) { return (e.write(`if (typeof ${t} !== "boolean") return INVALID;`), t); } function Hi(e, t, n) { e.write(`if (typeof ${n} !== "bigint") return INVALID;`); let r = t._zod.def; if (r.format) switch (r.format) { case `int64`: e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`); break; case `uint64`: e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`); } return n; } function Ui(e, t) { return (e.write(`if (typeof ${t} !== "symbol") return INVALID;`), t); } function Wi(e, t) { return (e.write(`if (${t} !== undefined) return INVALID;`), t); } function Gi(e, t) { return (e.write(`if (${t} !== null) return INVALID;`), t); } function Ki(e, t) { return (e.write(`if (${t} !== undefined) return INVALID;`), t); } function qi(e, t) { return (e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`), t); } function Ji(e, t) { return ( e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`), t ); } function Yi(e, t, n, r, i = !0) { let a = n._zod.def; e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`); let o = a.shape, s = Object.keys(o), c = Object.getOwnPropertySymbols(o), l = c.length ? [...s, ...c] : s, u = (e) => (typeof e == `symbol` ? I(t, e) : _(e)), d = (e) => (typeof e == `symbol` ? `[${u(e)}]` : _(e)), f = o; if (s.includes(`__proto__`)) throw new F(`object shape key "__proto__"`); let p = /* @__PURE__ */ new Map(); for (let n of l) { let a = f[n], o = u(n), s = R(t); if ((e.write(`const ${s} = ${r}[${o}];`), a._zod.optin !== void 0)) { let i = R(t); (e.write(`let ${i} = (() => {`), e.indented((e) => { let n = z(e, t, a, s); e.write(`return ${n};`); }), e.write(`})();`), a._zod.optout === `optional` ? (e.write(`if (${i} === INVALID) {`), e.indented((e) => { (e.write(`if (${o} in ${r}) return INVALID;`), e.write(`${i} = undefined;`)); }), e.write(`}`)) : e.write(`if (${i} === INVALID) return INVALID;`), p.set(n, i)); } else { Qi(a) && e.write(`if (!(${o} in ${r})) return INVALID;`); let c = z(e, t, a, s, i); c !== null && p.set(n, c); } } let m = a.catchall, h = `none`; if (m) { let t = m._zod.def.type; if (t === `never`) { let t = s.map((e) => `k !== ${_(e)}`).join(` && `) || `true`; (e.write(`for (const k in ${r}) {`), e.indented((e) => { e.write(`if (${t}) return INVALID;`); }), e.write(`}`)); } else h = (t === `unknown` || t === `any`) && !m._zod.def.checks?.length ? `passthrough` : `schema`; } let g = R(t), ee = l.some((e) => ea(f[e]) || $i(f[e])); if (!i) { if (h === `schema`) { let n = s.length > 0 ? I(t, new Set(s)) : null; (e.write(`for (const k in ${r}) {`), e.indented((e) => { (e.write(`if (k === "__proto__") continue;`), n && e.write(`if (${n}.has(k)) continue;`)); let i = R(t); (e.write(`const ${i} = ${r}[k];`), z(e, t, m, i, !1)); }), e.write(`}`)); } return null; } if (ee) { e.write(`const ${g} = {};`); for (let t of l) { let n = u(t), i = p.get(t); $i(f[t]) ? e.write(`if (${n} in ${r}) ${g}[${n}] = ${i};`) : ea(f[t]) ? e.write(`if (${i} !== undefined || ${n} in ${r}) ${g}[${n}] = ${i};`) : e.write(`${g}[${n}] = ${i};`); } } else { let t = l.map((e) => `${d(e)}: ${p.get(e)}`).join(`, `); e.write(`const ${g} = { ${t} };`); } if (h !== `none`) { let n = s.length > 0 ? I(t, new Set(s)) : null; (e.write(`for (const k in ${r}) {`), e.indented((e) => { if ( (e.write(`if (k === "__proto__") continue;`), n && e.write(`if (${n}.has(k)) continue;`), h === `passthrough`) ) e.write(`${g}[k] = ${r}[k];`); else { let n = R(t); e.write(`const ${n} = ${r}[k];`); let i = z(e, t, m, n); e.write(`${g}[k] = ${i};`); } }), e.write(`}`)); } return g; } function Xi(e, t, n, r, i = !0) { let a = n._zod.def; if (Zi(n)) return V(e, t, a.innerType, r, i); if (a.innerType._zod.optin === `defaulted`) { let n = R(t), i = R(t); return ( e.write(`let ${n};`), e.write(`if (${r} === undefined) {`), e.indented((e) => { (e.write(`const ${i} = (() => {`), e.indented((e) => { let n = V(e, t, a.innerType, r); e.write(`return ${n};`); }), e.write(`})();`), e.write(`if (${i} !== INVALID) ${n} = ${i};`)); }), e.write(`} else {`), e.indented((e) => { let i = V(e, t, a.innerType, r); e.write(`${n} = ${i};`); }), e.write(`}`), n ); } let o = i ? R(t) : null; return ( o && e.write(`let ${o};`), e.write(`if (${r} !== undefined) {`), e.indented((e) => { let n = V(e, t, a.innerType, r, i); o && n !== null && e.write(`${o} = ${n};`); }), e.write(`}`), o ); } function Zi(e) { return e._zod.traits?.has(`$ZodExactOptional`) === !0; } function Qi(e) { return e._zod.optin === void 0 && H(e); } function H(e) { if (e._zod.def.coerce) return !0; let t = e._zod.def; switch (t.type) { case `any`: case `unknown`: case `undefined`: case `void`: case `default`: case `prefault`: case `transform`: case `custom`: case `lazy`: return !0; case `string`: case `number`: case `boolean`: case `bigint`: case `symbol`: case `null`: case `never`: case `nan`: case `date`: case `object`: case `array`: case `tuple`: case `record`: case `map`: case `set`: case `file`: case `template_literal`: return !1; case `nonoptional`: return t.innerType ? H(t.innerType) : !1; case `literal`: return !!t.values?.includes(void 0); case `enum`: return !!e._zod.values?.has(void 0); case `optional`: case `nullable`: case `readonly`: case `success`: return !t.innerType || H(t.innerType); case `catch`: return !0; case `union`: return !t.options || t.options.some(H); case `intersection`: return !t.left || !t.right || (H(t.left) && H(t.right)); case `pipe`: return !t.in || H(t.in); default: return !0; } } function $i(e) { return e._zod.optin === `optional` && e._zod.optout === `optional`; } function ea(e) { return (e._zod.optin !== `defaulted` || e._zod.optout === `optional`) && U(e); } function U(e) { let t = e._zod.def; switch (t.type) { case `string`: case `number`: case `boolean`: case `bigint`: case `symbol`: case `null`: case `nan`: case `date`: case `object`: case `array`: case `tuple`: case `record`: case `map`: case `set`: case `file`: case `template_literal`: case `never`: case `success`: return !1; case `literal`: return !!t.values?.includes(void 0); case `enum`: return !!e._zod.values?.has(void 0); case `optional`: return !0; case `nullable`: case `readonly`: case `nonoptional`: return !t.innerType || U(t.innerType); case `union`: return !t.options || t.options.some(U); case `intersection`: return !t.left || !t.right || U(t.left) || U(t.right); case `pipe`: return !t.out || U(t.out); default: return !0; } } function ta(e, t, n, r, i = !0) { let a = n._zod.def, o = i ? R(t) : null; return ( o && e.write(`let ${o} = null;`), e.write(`if (${r} !== null) {`), e.indented((e) => { let n = V(e, t, a.innerType, r, i); o && n !== null && e.write(`${o} = ${n};`); }), e.write(`}`), o ); } function na(e, t, n, r, i = !0) { let a = n._zod.def; e.write(`if (!Array.isArray(${r})) return INVALID;`); let o = i ? R(t) : null, s = R(t), c = R(t); return ( o && e.write(`const ${o} = new Array(${r}.length);`), e.write(`for (let ${s} = 0; ${s} < ${r}.length; ${s}++) {`), e.indented((e) => { e.write(`const ${c} = ${r}[${s}];`); let n = z(e, t, a.element, c, i); o && n !== null && e.write(`${o}[${s}] = ${n};`); }), e.write(`}`), o ); } function ra(e, t, n, r) { let i = n._zod.def.values; if (i.length !== 1) { let n = I(t, new Set(i)); return (e.write(`if (!${n}.has(${r})) return INVALID;`), r); } let a = i[0]; if (typeof a == `number` && Number.isNaN(a)) { let n = I(t, new Set(i)); return (e.write(`if (!${n}.has(${r})) return INVALID;`), r); } if (typeof a == `string`) e.write(`if (${r} !== ${_(a)}) return INVALID;`); else if (typeof a == `number` || typeof a == `boolean`) e.write(`if (${r} !== ${a}) return INVALID;`); else if (a === null) e.write(`if (${r} !== null) return INVALID;`); else if (a === void 0) e.write(`if (${r} !== undefined) return INVALID;`); else if (typeof a == `bigint`) e.write(`if (${r} !== ${a}n) return INVALID;`); else throw new F(`literal type ${typeof a}`); return r; } function ia(e, t, n, r) { let i = n._zod.values; if (!i) throw new F(`enum schema without enumerated values`); let a = I(t, i); return (e.write(`if (!${a}.has(${r})) return INVALID;`), r); } function aa(e, t, n, r) { let i = n._zod.def; return V(e, t, i.innerType, r); } function oa(e, t, n, r) { let i = n._zod.def, a = Object.getOwnPropertyDescriptor(n._zod.def, `defaultValue`) ? () => n._zod.def.defaultValue : void 0; if (n._zod.def.type === `prefault`) { if (!a) return V(e, t, i.innerType, r); let n = I(t, a), o = R(t); return ( e.write(`let ${o} = ${r};`), e.write(`if (${r} === undefined) ${o} = ${n}();`), V(e, t, i.innerType, o) ); } let o = R(t); if (a) { let n = I(t, a), s = I(t, ie); (e.write(`let ${o};`), e.write(`if (${r} === undefined) {`), e.indented((e) => { e.write(`${o} = ${s}(${n}());`); }), e.write(`} else {`), e.indented((e) => { let a = V(e, t, i.innerType, r); e.write(`${o} = ${a} === undefined ? ${s}(${n}()) : ${a};`); }), e.write(`}`)); } else (e.write(`let ${o};`), e.write(`if (${r} !== undefined) {`), e.indented((e) => { let n = V(e, t, i.innerType, r); e.write(`${o} = ${n};`); }), e.write(`}`)); return o; } function sa(e, t, n, r) { let i = n._zod.def, a = V(e, t, i.innerType, r), o = R(t); return (e.write(`const ${o} = ${a};`), e.write(`if (${o} === undefined) return INVALID;`), o); } function ca(e, t, n, r) { let i = n._zod.def, a = i.items, o = i.rest; e.write(`if (!Array.isArray(${r})) return INVALID;`); let s = la(a, `optin`), c = la(a, `optout`); o ? e.write(`if (${r}.length < ${s}) return INVALID;`) : e.write(`if (${r}.length < ${s} || ${r}.length > ${a.length}) return INVALID;`); let l = R(t); e.write(`const ${l} = [];`); for (let n = 0; n < a.length; n++) { let i = a[n]; if (n >= c) (e.write(`if (${l}.length === ${n}) {`), e.indented((e) => { (e.write(`if (${n} < ${r}.length) {`), e.indented((e) => { let a = R(t); e.write(`const ${a} = ${r}[${n}];`); let o = z(e, t, i, a); e.write(`${l}[${n}] = ${o};`); }), e.write(`} else {`), e.indented((e) => { if ($i(i)) { e.write(`${l}.length = ${n};`); return; } let r = R(t), a = R(t); (e.write(`const ${r} = undefined;`), e.write(`const ${a} = (() => {`), e.indented((e) => { let n = z(e, t, i, r); e.write(`return ${n};`); }), e.write(`})();`), e.write(`if (${a} === INVALID || ${a} === undefined) ${l}.length = ${n};`), e.write(`else ${l}[${n}] = ${a};`)); }), e.write(`}`)); }), e.write(`}`)); else { let a = R(t); e.write(`const ${a} = ${r}[${n}];`); let o = z(e, t, i, a); e.write(`${l}[${n}] = ${o};`); } } if (o) { let n = R(t), i = R(t); (e.write(`for (let ${n} = ${a.length}; ${n} < ${r}.length; ${n}++) {`), e.indented((e) => { e.write(`const ${i} = ${r}[${n}];`); let a = z(e, t, o, i); e.write(`${l}[${n}] = ${a};`); }), e.write(`}`)); } return l; } function la(e, t) { for (let n = e.length - 1; n >= 0; n--) if (!(t === `optin` ? e[n]._zod.optin !== void 0 : e[n]._zod.optout === `optional`)) return n + 1; return 0; } function ua(e, t, n, r) { let i = n._zod.def, a = i.options; if (i.discriminator) return da(e, t, i, r); if (i.inclusive === !1) throw new F(`exclusive unions (z.xor)`); if (a.length === 0) return (e.write(`return INVALID;`), r); if (a.length === 1) return V(e, t, a[0], r); if (a.every((e) => e._zod.def.type === `literal` && !e._zod.def.checks?.length)) { let n = I(t, new Set(a.flatMap((e) => e._zod.def.values))); return (e.write(`if (!${n}.has(${r})) return INVALID;`), r); } let o = R(t); e.write(`let ${o};`); for (let n = 0; n < a.length; n++) { let i = a[n]; (n === 0 ? e.write(`${o} = (() => {`) : e.write(`if (${o} === INVALID) ${o} = (() => {`), e.indented((e) => { let n = V(e, t, i, r); e.write(`return ${n};`); }), e.write(`})();`)); } return (e.write(`if (${o} === INVALID) return INVALID;`), o); } function da(e, t, n, r) { if (n.unionFallback) throw new F(`discriminated union with unionFallback`); if (n.options.length === 0) return (e.write(`return INVALID;`), r); let i = R(t), a = R(t); (e.write(`const ${i} = ${r}?.[${_(n.discriminator)}];`), e.write(`let ${a};`)); let o = !0, s = /* @__PURE__ */ new Set(); for (let c of n.options) { let l = c._zod.propValues?.[n.discriminator]; if (!l || l.size === 0) throw new F(`discriminated union option without static discriminator values`); for (let e of l) { if (s.has(e)) throw new F(`duplicate discriminator value ${String(e)}`); s.add(e); } let u = Array.from(l, (e) => fa(t, i, e)), d = o ? `if` : `else if`; (e.write(`${d} (${u.join(` || `)}) {`), e.indented((e) => { let n = V(e, t, c, r); e.write(`${a} = ${n};`); }), e.write(`}`), (o = !1)); } return (e.write(`else { return INVALID; }`), a); } function fa(e, t, n) { if (typeof n == `string`) return `${t} === ${_(n)}`; if (typeof n == `number`) return Number.isNaN(n) ? `Number.isNaN(${t})` : `${t} === ${n}`; if (typeof n == `boolean`) return `${t} === ${n}`; if (n === null) return `${t} === null`; if (n === void 0) return `${t} === undefined`; if (typeof n == `bigint`) return `${t} === ${n}n`; if (typeof n == `symbol`) return `${t} === ${I(e, n)}`; throw new F(`literal discriminator value ${String(n)}`); } function pa(e, t, n, r) { let i = n._zod.def; t.definite = !1; let a = z(e, t, i.left, r), o = z(e, t, i.right, r), s = I(t, Tr), c = R(t); return ( e.write(`const ${c} = ${s}(${a}, ${o});`), e.write(`if (!${c}.valid) return INVALID;`), `${c}.data` ); } function ma(e, t, n, r) { let i = n._zod.def, a = I(t, v); e.write(`if (!${a}(${r})) return INVALID;`); let o = R(t), s = R(t), c = R(t); e.write(`const ${o} = {};`); let l = i, u = l.partial ? void 0 : i.keyType._zod.values; if (u) { let n = []; for (let a of u) { if (typeof a != `string` && typeof a != `number` && typeof a != `symbol`) throw new F(`record key value ${String(a)}`); let s = typeof a == `number` ? a.toString() : a; if (s === `__proto__`) throw new F(`record key "__proto__"`); n.push(s); let c = I(t, a), l = V(e, t, i.keyType, c), u = R(t); e.write(`const ${u} = ${r}[${ga(t, s)}];`); let d = z(e, t, i.valueType, u); e.write(`${o}[${l}] = ${d};`); } let a = I(t, new Set(n)); return ( e.write(`for (const ${s} in ${r}) {`), e.indented((e) => { (e.write(`if (${a}.has(${s})) continue;`), l.mode === `loose` ? e.write(`if (${s} !== "__proto__") ${o}[${s}] = ${r}[${s}];`) : e.write(`return INVALID;`)); }), e.write(`}`), o ); } let d = i.keyType._zod.def; if (d.type !== `string` || d.format !== void 0 || d.coerce || (d.checks?.length ?? 0) !== 0) { let n = i.mode === `loose`, a = vi(i.keyType); a.definite === !1 && (t.definite = !1); let c = I(t, a), l = I(t, qt), u = R(t); return ( ha(e, t, r, s, (e) => { (e.write(`let ${u} = ${c}(${s});`), e.write( `if (${u} === INVALID && typeof ${s} === "string" && ${l}.test(${s})) ${u} = ${c}(Number(${s}));`, ), n ? e.write(`if (${u} === INVALID) { ${o}[${s}] = ${r}[${s}]; continue; }`) : e.write(`if (${u} === INVALID) return INVALID;`), e.write(`if (${u} === "__proto__") continue;`)); let a = R(t); e.write(`const ${a} = ${r}[${s}];`); let d = z(e, t, i.valueType, a); e.write(`${o}[${u}] = ${d};`); }), o ); } return ( ha( e, t, r, s, (e) => { e.write(`const ${c} = ${r}[${s}];`); let n = z(e, t, i.valueType, c); e.write(`${o}[${s}] = ${n};`); }, `return INVALID;`, ), o ); } function ha(e, t, n, r, i, a) { let o = I(t, Object.prototype.propertyIsEnumerable), s = R(t), c = R(t), l = R(t); (e.write(`const ${s} = Object.getOwnPropertySymbols(${n});`), e.write(`const ${c} = Object.getOwnPropertyNames(${n});`), e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`), e.indented((e) => { (e.write(`const ${r} = ${c}[${l}];`), e.write(`if (${r} === "__proto__" || !${o}.call(${n}, ${r})) continue;`), i(e)); }), e.write(`}`), e.write(`for (let ${l} = 0; ${l} < ${s}.length; ${l}++) {`), e.indented((e) => { (e.write(`const ${r} = ${s}[${l}];`), e.write(`if (!${o}.call(${n}, ${r})) continue;`), a ? e.write(a) : i(e)); }), e.write(`}`)); } function ga(e, t) { return typeof t == `string` ? _(t) : I(e, t); } function _a(e, t, n, r) { let i = n._zod.def; e.write(`if (!(${r} instanceof Map)) return INVALID;`); let a = R(t), o = R(t), s = R(t); return ( e.write(`const ${a} = new Map();`), e.write(`for (const [${o}, ${s}] of ${r}) {`), e.indented((e) => { let n = V(e, t, i.keyType, o), r = V(e, t, i.valueType, s); e.write(`${a}.set(${n}, ${r});`); }), e.write(`}`), a ); } function va(e, t, n, r) { let i = n._zod.def; e.write(`if (!(${r} instanceof Set)) return INVALID;`); let a = R(t), o = R(t); return ( e.write(`const ${a} = new Set();`), e.write(`for (const ${o} of ${r}) {`), e.indented((e) => { let n = V(e, t, i.valueType, o); e.write(`${a}.add(${n});`); }), e.write(`}`), a ); } function ya(e, t) { return (e.write(`if (!(${t} instanceof File)) return INVALID;`), t); } function ba(e, t, n, r) { e.write(`if (typeof ${r} !== "string") return INVALID;`); let i = n._zod.pattern; if (i) { let n = I(t, i); (e.write(`${n}.lastIndex = 0;`), e.write(`if (!${n}.test(${r})) return INVALID;`)); } return r; } function xa(e, t, n, r) { let i = n._zod.def, a = L(t, i.getter), o = I(t, { parser: null }); (e.write(`if (!${o}.parser) {`), e.indented((e) => { (e.write(`const inner = ${a}();`), e.write(`${o}.parser = function(input) {`), e.indented((e) => { (e.write(`const result = inner._zod.run({ value: input, issues: [] }, {});`), e.write(`return result.issues.length === 0 ? result.value : INVALID;`)); }), e.write(`};`)); }), e.write(`}`)); let s = R(t); return ( e.write(`const ${s} = ${o}.parser(${r});`), e.write(`if (${s} === INVALID) return INVALID;`), s ); } function Sa(e, t, n, r) { let i = n._zod.def, a = V(e, t, i.in, r); if (i.transform) { if (W(i.transform)) throw new P(`z.compile: async transforms in pipes are not supported`); let n = i.transform, r = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }, r = n(e, t); return r instanceof Promise ? N : t.issues.length === 0 ? r : N; }), o = R(t); return ( e.write(`const ${o} = ${r}(${a});`), e.write(`if (${o} === INVALID) return INVALID;`), V(e, t, i.out, o) ); } return V(e, t, i.out, a); } function W(e) { return ( typeof e == `function` && (e.constructor.name === `AsyncFunction` || e[Symbol.toStringTag] === `AsyncFunction`) ); } function Ca(e, t, n, r) { let i = n._zod.def; if (i.fn) { if (W(i.fn)) throw new P(`z.compile: async custom predicates are not supported`); let n = L(t, i.fn), a = I(t, Pi), o = R(t); (e.write(`const ${o} = ${n}(${r});`), e.write(`if (${o} instanceof Promise) ${a}();`), e.write(`if (!${o}) return INVALID;`)); } else throw new F(`custom schema without a predicate function`); return r; } function wa(e, t, n) { let r = e._zod.run({ value: n, issues: [] }, {}); if (r && typeof r.then == `function`) return N; let i = r; return i.issues.length === 0 ? i.value : t(); } function Ta(e, t, n, r) { let i = n._zod.def; if (!i.catchValue[`~constantCatch`]) throw new F(`catch with a callback (only a constant catch value compiles)`, !1); let a = R(t); (e.write(`let ${a} = (() => {`), e.indented((e) => { let n = z(e, t, i.innerType, r); e.write(`return ${n};`); }), e.write(`})();`)); let o = I(t, i.innerType), s = L(t, i.catchValue), c = I(t, wa); return ( e.write(`if (${a} === INVALID) {`), e.indented((e) => { (e.write(`${a} = ${c}(${o}, ${s}, ${r});`), e.write(`if (${a} === INVALID) return INVALID;`)); }), e.write(`}`), a ); } function Ea(e, t, n, r) { let i = n._zod.def; if (i.transform) { if (W(i.transform)) throw new P(`z.compile: async transforms are not supported`); let n = i.transform, a = L(t, (e) => { let t = { value: e, issues: [], addIssue: Fi }, r = n(e, t); return r instanceof Promise ? N : t.issues.length === 0 ? r : N; }), o = R(t); return ( e.write(`const ${o} = ${a}(${r});`), e.write(`if (${o} === INVALID) return INVALID;`), o ); } return r; } function Da(e) { return ((e.checks &&= [...e.checks]), e); } // @__NO_SIDE_EFFECTS__ function Oa(e, t) { return new e(Da({ type: `string`, ...b(t) })); } // @__NO_SIDE_EFFECTS__ function ka(e, t) { return new e({ type: `string`, format: `email`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Aa(e, t) { return new e({ type: `string`, format: `guid`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function ja(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ma(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v4`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Na(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v6`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Pa(e, t) { return new e({ type: `string`, format: `uuid`, check: `string_format`, abort: !1, version: `v7`, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Fa(e, t) { return new e({ type: `string`, format: `url`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ia(e, t) { return new e({ type: `string`, format: `emoji`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function La(e, t) { return new e({ type: `string`, format: `nanoid`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ra(e, t) { return new e({ type: `string`, format: `cuid`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function za(e, t) { return new e({ type: `string`, format: `cuid2`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ba(e, t) { return new e({ type: `string`, format: `ulid`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Va(e, t) { return new e({ type: `string`, format: `xid`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ha(e, t) { return new e({ type: `string`, format: `ksuid`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ua(e, t) { return new e({ type: `string`, format: `ipv4`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Wa(e, t) { return new e({ type: `string`, format: `ipv6`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ga(e, t) { return new e({ type: `string`, format: `cidrv4`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ka(e, t) { return new e({ type: `string`, format: `cidrv6`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function qa(e, t) { return new e({ type: `string`, format: `base64`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ja(e, t) { return new e({ type: `string`, format: `base64url`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Ya(e, t) { return new e({ type: `string`, format: `e164`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Xa(e, t) { return new e({ type: `string`, format: `jwt`, check: `string_format`, abort: !1, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function Za(e, t) { return new e({ type: `string`, format: `datetime`, check: `string_format`, offset: !1, local: !1, precision: null, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function Qa(e, t) { return new e({ type: `string`, format: `date`, check: `string_format`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function $a(e, t) { return new e({ type: `string`, format: `time`, check: `string_format`, precision: null, ...b(t), }); } // @__NO_SIDE_EFFECTS__ function eo(e, t) { return new e({ type: `string`, format: `duration`, check: `string_format`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function to(e, t) { return new e(Da({ type: `number`, checks: [], ...b(t) })); } // @__NO_SIDE_EFFECTS__ function no(e, t) { return new e({ type: `number`, check: `number_format`, abort: !1, format: `safeint`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function ro(e) { return new e({ type: `unknown` }); } // @__NO_SIDE_EFFECTS__ function io(e, t) { return new e({ type: `never`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function ao(e, t) { return new e({ type: `date`, ...b(t) }); } // @__NO_SIDE_EFFECTS__ function oo(e, t) { return new Qt({ check: `less_than`, ...b(t), value: e, inclusive: !1 }); } // @__NO_SIDE_EFFECTS__ function so(e, t) { return new Qt({ check: `less_than`, ...b(t), value: e, inclusive: !0 }); } // @__NO_SIDE_EFFECTS__ function co(e, t) { return new $t({ check: `greater_than`, ...b(t), value: e, inclusive: !1 }); } // @__NO_SIDE_EFFECTS__ function lo(e, t) { return new $t({ check: `greater_than`, ...b(t), value: e, inclusive: !0 }); } // @__NO_SIDE_EFFECTS__ function uo(e, t) { return new en({ check: `multiple_of`, ...b(t), value: e }); } // @__NO_SIDE_EFFECTS__ function fo(e, t) { return new nn({ check: `max_length`, ...b(t), maximum: e }); } // @__NO_SIDE_EFFECTS__ function po(e, t) { return new rn({ check: `min_length`, ...b(t), minimum: e }); } // @__NO_SIDE_EFFECTS__ function mo(e, t) { return new an({ check: `length_equals`, ...b(t), length: e }); } // @__NO_SIDE_EFFECTS__ function ho(e, t) { return new sn({ check: `string_format`, format: `regex`, ...b(t), pattern: e }); } // @__NO_SIDE_EFFECTS__ function go(e) { return new cn({ check: `string_format`, format: `lowercase`, ...b(e) }); } // @__NO_SIDE_EFFECTS__ function _o(e) { return new ln({ check: `string_format`, format: `uppercase`, ...b(e) }); } // @__NO_SIDE_EFFECTS__ function vo(e, t) { return new un({ check: `string_format`, format: `includes`, ...b(t), includes: e }); } // @__NO_SIDE_EFFECTS__ function yo(e, t) { return new dn({ check: `string_format`, format: `starts_with`, ...b(t), prefix: e }); } // @__NO_SIDE_EFFECTS__ function bo(e, t) { return new fn({ check: `string_format`, format: `ends_with`, ...b(t), suffix: e }); } // @__NO_SIDE_EFFECTS__ function xo(e) { return new pn({ check: `overwrite`, tx: e }); } // @__NO_SIDE_EFFECTS__ function So(e) { return /* @__PURE__ */ xo((t) => t.normalize(e)); } // @__NO_SIDE_EFFECTS__ function Co() { return /* @__PURE__ */ xo((e) => e.trim()); } // @__NO_SIDE_EFFECTS__ function wo() { return /* @__PURE__ */ xo((e) => e.toLowerCase()); } // @__NO_SIDE_EFFECTS__ function To() { return /* @__PURE__ */ xo((e) => e.toUpperCase()); } // @__NO_SIDE_EFFECTS__ function Eo() { return /* @__PURE__ */ xo((e) => ee(e)); } // @__NO_SIDE_EFFECTS__ function Do(e, t, n) { return new e({ type: `array`, element: t, ...b(n) }); } // @__NO_SIDE_EFFECTS__ function Oo(e, t, n) { return new e({ type: `custom`, check: `custom`, fn: t, ...b(n) }); } // @__NO_SIDE_EFFECTS__ function ko(e, t) { let n = /* @__PURE__ */ Ao( (t) => ( (t.addIssue = (e) => { if (typeof e == `string`) t.issues.push(Oe(e, t.value, n._zod.def)); else { let r = e; (r.fatal && (r.continue = !1), (r.code ??= `custom`), `input` in r || (r.input = t.value), (r.inst ??= n), (r.continue ??= !n._zod.def.abort), t.issues.push(Oe(r))); } }), e(t.value, t) ), t, ); return n; } // @__NO_SIDE_EFFECTS__ function Ao(e, t) { let n = new A({ check: `custom`, ...b(t) }); return ((n._zod.check = e), n); } function jo(e, ...t) { for (let n of t) for (let t of Reflect.ownKeys(n)) Object.prototype.propertyIsEnumerable.call(n, t) && l(e, t, n[t]); return e; } function Mo(e) { let t = e?.target ?? `draft-2020-12`; return ( t === `draft-4` && (t = `draft-04`), t === `draft-7` && (t = `draft-07`), { processors: e.processors ?? {}, metadataRegistry: e?.metadata ?? fi, target: t, unrepresentable: e?.unrepresentable ?? `throw`, override: e?.override ?? (() => {}), io: e?.io ?? `output`, counter: 0, seen: /* @__PURE__ */ new Map(), sharedDefsExtractedFor: void 0, sharedEmitDoneFor: void 0, cycles: e?.cycles ?? `ref`, reused: e?.reused ?? `inline`, intersections: [], deferred: [], external: e?.external ?? void 0, } ); } function G(e, t, n, r, i) { let a = typeof t.unrepresentable == `function` ? t.unrepresentable({ zodSchema: e, path: r.path, message: i }) : t.unrepresentable; if (a === `any`) return !1; if (a === void 0 || a === `throw`) throw Error(i); return (Object.assign(n, a), !0); } function K(e, t, n = { path: [], schemaPath: [] }) { var r; let i = e._zod.def, a = t.seen.get(e); if (a) return (a.count++, n.schemaPath.includes(e) && (a.cycle = n.path), a.schema); let o = { schema: {}, count: 1, cycle: void 0, path: n.path }; (t.seen.set(e, o), (t.sharedDefsExtractedFor = void 0), (t.sharedEmitDoneFor = void 0)); let s = e._zod.toJSONSchema?.(); if (s) o.schema = s; else { let r = { ...n, schemaPath: [...n.schemaPath, e], path: n.path }; if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, o.schema, r); else { let n = o.schema, a = t.processors[i.type]; if (!a) throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`); a(e, t, n, r); } let a = e._zod.parent; a && ((o.ref ||= a), K(a, t, r), (t.seen.get(a).isParent = !0)); } let c = t.metadataRegistry.get(e); return ( c && jo(o.schema, c), t.io === `input` && q(e) && (delete o.schema.examples, delete o.schema.default), t.io === `input` && `_prefault` in o.schema && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, t.seen.get(e).schema ); } function No(e) { return e.replace(/~/g, `~0`).replace(/\//g, `~1`); } function Po(e, t) { let n = e.seen.get(t); if (!n) throw Error(`Unprocessed schema. This is a bug in Zod.`); if (e.external && e.sharedDefsExtractedFor === e.external) return; let r = /* @__PURE__ */ new Map(); for (let t of e.seen.entries()) { let n = e.metadataRegistry.get(t[0])?.id; if (n) { let e = r.get(n); if (e && e !== t[0]) throw Error( `Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`, ); r.set(n, t[0]); } } let i = (t) => { let r = e.target === `draft-2020-12` ? `$defs` : `definitions`; if (e.external) { let n = e.external.registry.get(t[0])?.id, i = e.external.uri ?? ((e) => e); if (n) return { ref: i(n) }; let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`; return ((t[1].defId = a), { defId: a, ref: `${i(`__shared`)}#/${r}/${No(a)}` }); } let i = `#/${r}/`; if (t[1] === n && !t[1].schema.id) return { ref: `#` }; let a = t[1].schema.id ?? `__schema${e.counter++}`; return { defId: a, ref: i + No(a) }; }, a = (e) => { if (e[1].schema.$ref) return; let t = e[1], { ref: n, defId: r } = i(e); ((t.def = { ...t.schema }), r && (t.defId = r)); let a = t.schema; for (let e in a) delete a[e]; a.$ref = n; }; if (e.cycles === `throw`) for (let t of e.seen.entries()) { let e = t[1]; if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root> Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`); } for (let n of e.seen.entries()) { let r = n[1]; if (t === n[0]) { a(n); continue; } if (e.external) { let r = e.external.registry.get(n[0])?.id; if (t !== n[0] && r) { a(n); continue; } } if (e.metadataRegistry.get(n[0])?.id) { a(n); continue; } if (r.cycle) { a(n); continue; } r.count > 1 && e.reused === `ref` && a(n); } e.external && (e.sharedDefsExtractedFor = e.external); } function Fo(e) { let t = e.anyOf; if (!Array.isArray(t) || t.length === 0 || e.type !== void 0) return; let n = []; for (let e of t) { if (!e || typeof e != `object`) return; Fo(e); let t = Object.keys(e); if (t.length !== 1 || t[0] !== `type`) return; let r = e.type; for (let e of Array.isArray(r) ? r : [r]) { if (typeof e != `string`) return; n.includes(e) || n.push(e); } } (delete e.anyOf, (e.type = n.length === 1 ? n[0] : n)); } const Io = /* @__PURE__ */ new Set([`type`, `properties`, `required`, `additionalProperties`]), Lo = [`oneOf`, `anyOf`]; function Ro(e) { let t = e.additionalProperties; return t === void 0 || t === !1 || typeof t != `object` || !t ? null : Object.keys(t).length ? t : null; } function zo(e) { let t = []; for (let n of e) { if (typeof n != `object` || n.type !== `object`) return null; for (let e in n) if (!Io.has(e)) return null; t.push(n); } let n = {}, r = /* @__PURE__ */ new Set(); for (let e of t) { for (let r in e.properties) { if (Object.prototype.hasOwnProperty.call(n, r)) continue; let e = []; for (let n of t) { let t = n.properties?.[r] ?? Ro(n); t != null && (e.some((e) => JSON.stringify(e) === JSON.stringify(t)) || e.push(t)); } l(n, r, e.length === 1 ? e[0] : (zo(e) ?? { allOf: e })); } for (let t of e.required ?? []) r.add(t); } let i = { type: `object`, properties: n }; if ((r.size && (i.required = [...r]), t.every((e) => e.additionalProperties === !1))) i.additionalProperties = !1; else { let e = []; for (let n of t) { let t = Ro(n); t && !e.some((e) => JSON.stringify(e) === JSON.stringify(t)) && e.push(t); } e.length === 1 ? (i.additionalProperties = e[0]) : e.length > 1 && (i.additionalProperties = { allOf: e }); } return i; } function Bo(e) { let t = e.allOf; if (!Array.isArray(t) || t.length < 2) return; for (let t of Io) if (t in e) return; let n = t.filter((e) => Lo.some((t) => Array.isArray(e[t]))), r = null; if (!n.length) r = zo(t); else { let e = n[0], i = Lo.find((t) => Array.isArray(e[t])); if (Object.keys(e).length !== 1) return; let a = t.filter((t) => t !== e), o = e[i].map((e) => zo([...a, e])); if (o.some((e) => !e)) return; r = { [i]: o }; } r && (delete e.allOf, jo(e, r)); } function Vo(e, t) { let n = e.seen.get(t); if (!n) throw Error(`Unprocessed schema. This is a bug in Zod.`); let r = (t) => { let n = e.seen.get(t); if (n.ref === null) return; let i = n.def ?? n.schema, a = { ...i }, o = n.ref; if (((n.ref = null), o)) { r(o); let n = e.seen.get(o), s = n.schema; if ( (s.$ref && (e.target === `draft-07` || e.target === `draft-04` || e.target === `openapi-3.0`) ? ((i.allOf = i.allOf ?? []), i.allOf.push(s)) : jo(i, s), jo(i, a), t._zod.parent === o) ) for (let e in i) e !== `$ref` && e !== `allOf` && (e in a || delete i[e]); if (s.$ref && n.def) for (let e in i) e !== `$ref` && e !== `allOf` && e in n.def && JSON.stringify(i[e]) === JSON.stringify(n.def[e]) && delete i[e]; } let s = t._zod.parent; if (s && s !== o) { r(s); let t = e.seen.get(s); if (t?.schema.$ref && ((i.$ref = t.schema.$ref), t.def)) for (let e in i) e !== `$ref` && e !== `allOf` && e in t.def && JSON.stringify(i[e]) === JSON.stringify(t.def[e]) && delete i[e]; } e.override({ zodSchema: t, jsonSchema: i, path: n.path ?? [] }); }; if (!e.external || e.sharedEmitDoneFor !== e.external) { for (let t of [...e.seen.entries()].reverse()) r(t[0]); if (e.target !== `openapi-3.0`) for (let t of e.seen.entries()) Fo(t[1].def ?? t[1].schema); for (let t of e.deferred) t(); if (e.intersections.length) { let t = /* @__PURE__ */ new Map(); for (let n of e.seen.values()) for (let e of [n.schema, n.def]) { let n = e?.allOf; if (!Array.isArray(n)) continue; let r = t.get(n); r ? r.push(e) : t.set(n, [e]); } for (let n of e.intersections) for (let e of t.get(n) ?? []) Bo(e); } } let i = {}; if ( (e.target === `draft-2020-12` ? (i.$schema = `https://json-schema.org/draft/2020-12/schema`) : e.target === `draft-07` ? (i.$schema = `http://json-schema.org/draft-07/schema#`) : e.target === `draft-04` ? (i.$schema = `http://json-schema.org/draft-04/schema#`) : e.target, e.external?.uri) ) { let n = e.external.registry.get(t)?.id; if (!n) throw Error("Schema is missing an `id` property"); i.$id = e.external.uri(n); } jo(i, n.defId ? n.schema : (n.def ?? n.schema)); let a = e.metadataRegistry.get(t)?.id; a !== void 0 && i.id === a && delete i.id; let o = e.external?.defs ?? {}; if (!e.external || e.sharedEmitDoneFor !== e.external) for (let t of e.seen.entries()) { let e = t[1]; e.def && e.defId && (e.def.id === e.defId && delete e.def.id, l(o, e.defId, e.def)); } (e.external && (e.sharedEmitDoneFor = e.external), e.external || (Object.keys(o).length > 0 && (e.target === `draft-2020-12` ? (i.$defs = o) : (i.definitions = o)))); try { let n = JSON.parse(JSON.stringify(i)); return ( Object.defineProperty(n, "~standard", { value: { ...t[`~standard`], jsonSchema: { input: Uo(t, `input`, e.processors), output: Uo(t, `output`, e.processors), }, }, enumerable: !1, writable: !1, }), n ); } catch { throw Error(`Error converting schema to JSON.`); } } function q(e, t) { let n = t ?? { seen: /* @__PURE__ */ new Set() }; if (n.seen.has(e)) return !1; n.seen.add(e); let r = e._zod.def; if (r.type === `transform`) return !0; if (r.type === `array`) return q(r.element, n); if (r.type === `set`) return q(r.valueType, n); if (r.type === `lazy`) return q(r.getter(), n); if ( r.type === `promise` || r.type === `optional` || r.type === `nonoptional` || r.type === `nullable` || r.type === `readonly` || r.type === "default" || r.type === `prefault` || r.type === `catch` ) return q(r.innerType, n); if (r.type === `intersection`) return q(r.left, n) || q(r.right, n); if (r.type === `record` || r.type === `map`) return q(r.keyType, n) || q(r.valueType, n); if (r.type === `pipe`) return e._zod.traits.has(`$ZodCodec`) ? !0 : q(r.in, n) || q(r.out, n); if (r.type === `object`) { for (let e in r.shape) if (q(r.shape[e], n)) return !0; return !1; } if (r.type === `union`) { for (let e of r.options) if (q(e, n)) return !0; return !1; } if (r.type === `tuple`) { for (let e of r.items) if (q(e, n)) return !0; return !!(r.rest && q(r.rest, n)); } return !1; } const Ho = (e, t = {}) => (n) => { let r = Mo({ ...n, processors: t }); return (K(e, r), Po(r, e), Vo(r, e)); }, Uo = (e, t, n = {}) => (r) => { let { libraryOptions: i, target: a } = r ?? {}, o = Mo({ ...(i ?? {}), target: a, io: t, processors: n }); return (K(e, o), Po(o, e), Vo(o, e)); }, Wo = (e, t, n) => { (e[t] === void 0 || n > e[t]) && (e[t] = n); }, Go = (e, t, n) => { (e[t] === void 0 || n < e[t]) && (e[t] = n); }, Ko = (e, t) => { (Wo(e, `minimum`, t), Go(e, `maximum`, t)); }, qo = (e, t) => { ((e.multipleOf ??= []), e.multipleOf.includes(t) || e.multipleOf.push(t)); }, Jo = (e, t) => { ((e.patterns ??= /* @__PURE__ */ new Set()), e.patterns.add(t)); }, Yo = (e, t) => { e.mime = e.mime ? e.mime.filter((e) => t.includes(e)) : [...t]; }, Xo = (e, t) => { ((e.format = t), t.includes(`int`) && (e.isInt = !0)); }, Zo = (e, t) => Wo(e, `minimum`, t.minimum), Qo = (e, t) => Go(e, `maximum`, t.maximum), $o = (e) => (t, n) => { Xo(t, n.format); let [r, i] = e[n.format]; (Wo(t, `minimum`, r), Go(t, `maximum`, i)); }, es = { greater_than: (e, t) => Wo(e, t.inclusive ? `minimum` : `exclusiveMinimum`, t.value), less_than: (e, t) => Go(e, t.inclusive ? `maximum` : `exclusiveMaximum`, t.value), multiple_of: (e, t) => qo(e, t.value), number_format: $o(le), bigint_format: $o(ue), min_length: Zo, max_length: Qo, length_equals: (e, t) => Ko(e, t.length), min_size: Zo, max_size: Qo, size_equals: (e, t) => Ko(e, t.size), string_format: (e, t) => { (Xo(e, t.format), t.pattern && Jo(e, t.pattern), (t.format === `base64` || t.format === `base64url`) && (e.contentEncoding = t.format), (t.local || t.precision === -1) && (e.laxFormat = !0)); }, mime_type: (e, t) => Yo(e, t.mime), }; function J(e) { let t = {}, n = e._zod.def, r = e._zod.traits.has(`$ZodCheck`) ? [e, ...(n.checks ?? [])] : (n.checks ?? []); for (let e of r) es[e._zod.def.check]?.(t, e._zod.def); let i = e._zod.bag; (i.minimum !== void 0 && Wo(t, `minimum`, i.minimum), i.exclusiveMinimum !== void 0 && Wo(t, `exclusiveMinimum`, i.exclusiveMinimum), i.maximum !== void 0 && Go(t, `maximum`, i.maximum), i.exclusiveMaximum !== void 0 && Go(t, `exclusiveMaximum`, i.exclusiveMaximum), i.multipleOf !== void 0 && qo(t, i.multipleOf), i.format !== void 0 && ((t.format ??= i.format), i.format.includes(`int`) && (t.isInt = !0)), i.mime && Yo(t, i.mime)); for (let e of i.patterns ?? []) Jo(t, e); return t; } const ts = { guid: `uuid`, url: `uri`, datetime: `date-time`, json_string: `json-string`, regex: ``, }, ns = /* @__PURE__ */ new Map([ [Xn, Pt], [Qn, Ft], ]), rs = (e) => ns.get(e) ?? e, is = (e, t, n, r) => { let i = n; i.type = `string`; let { minimum: a, maximum: o, format: s, patterns: c, contentEncoding: l, laxFormat: u } = J(e); if ( (typeof a == `number` && (i.minLength = a), typeof o == `number` && (i.maxLength = o), s && ((i.format = ts[s] ?? s), i.format === `` && delete i.format, (s === `time` || u) && delete i.format), l && (i.contentEncoding = l), c && c.size > 0) ) { let e = [...c].map(rs); e.length === 1 ? (i.pattern = e[0].source) : e.length > 1 && (i.allOf = [ ...e.map((e) => ({ ...(t.target === `draft-07` || t.target === `draft-04` || t.target === `openapi-3.0` ? { type: `string` } : {}), pattern: e.source, })), ]); } }, as = (e, t, n, r) => { let i = n, { minimum: a, maximum: o, multipleOf: s, exclusiveMaximum: c, exclusiveMinimum: l, isInt: u, } = J(e); i.type = u ? `integer` : `number`; let d = typeof l == `number` && l >= (a ?? -1 / 0), f = typeof c == `number` && c <= (o ?? 1 / 0), p = t.target === `draft-04` || t.target === `openapi-3.0`; if ( (d ? p ? ((i.minimum = l), (i.exclusiveMinimum = !0)) : (i.exclusiveMinimum = l) : typeof a == `number` && (i.minimum = a), f ? p ? ((i.maximum = c), (i.exclusiveMaximum = !0)) : (i.exclusiveMaximum = c) : typeof o == `number` && (i.maximum = o), s) ) { let n = /* @__PURE__ */ new Set(); for (let a of s) Number.isFinite(a) && a !== 0 ? n.add(Math.abs(a)) : G(e, t, i, r, `A multipleOf divisor of ${a} cannot be represented in JSON Schema`); let [a, ...o] = n; (a !== void 0 && (i.multipleOf = a), o.length && (i.allOf = [...(i.allOf ?? []), ...o.map((e) => ({ multipleOf: e }))])); } }, os = (e, t, n, r) => { n.not = {}; }, ss = (e, t, n, r) => { G(e, t, n, r, `Date cannot be represented in JSON Schema`); }, cs = (e, n, r, i) => { let a = e._zod.def, o = t(a.entries); if (o.length === 0) { r.not = {}; return; } (o.every((e) => typeof e == `number`) && (r.type = `number`), o.every((e) => typeof e == `string`) && (r.type = `string`), (r.enum = o)); }, ls = (e, t, n, r) => { G(e, t, n, r, `Custom types cannot be represented in JSON Schema`); }, us = (e, t, n, r) => { G(e, t, n, r, `Transforms cannot be represented in JSON Schema`); }, ds = (e, t, n, r) => { let i = n, a = e._zod.def, { minimum: o, maximum: s } = J(e); (typeof o == `number` && (i.minItems = o), typeof s == `number` && (i.maxItems = s), (i.type = `array`), (i.items = K(a.element, t, { ...r, path: [...r.path, `items`] }))); }; function fs(e) { let t = e._zod.def; return t.type === `pipe` && t.in._zod.traits.has(`$ZodTransform`) ? fs(t.out) : t.type === `catch` ? fs(t.innerType) : e._zod.optin; } const ps = (e, t, n, r) => { let i = n, a = e._zod.def, o = a.shape; if ( Object.getOwnPropertySymbols(o).length && G(e, t, i, r, `Symbol keys cannot be represented in JSON Schema`) ) return; ((i.type = `object`), (i.properties = {})); for (let e in o) l(i.properties, e, K(o[e], t, { ...r, path: [...r.path, `properties`, e] })); let s = []; for (let e of Object.keys(o)) { let n = a.shape[e]; (t.io === `input` ? fs(n) === void 0 : n._zod.optout === void 0) && s.push(e); } (s.length > 0 && (i.required = s), a.catchall?._zod.def.type === `never` ? (i.additionalProperties = !1) : a.catchall ? a.catchall && (i.additionalProperties = K(a.catchall, t, { ...r, path: [...r.path, `additionalProperties`], })) : t.io === `output` && (i.additionalProperties = !1)); }, ms = (e, t, n, r) => { let i = e._zod.def, a = i.inclusive === !1, o = i.options.map((e, n) => K(e, t, { ...r, path: [...r.path, a ? `oneOf` : `anyOf`, n] })); a ? (n.oneOf = o) : (n.anyOf = o); }, hs = (e, t, n, r) => { let i = e._zod.def, a = K(i.left, t, { ...r, path: [...r.path, `allOf`, 0] }), o = K(i.right, t, { ...r, path: [...r.path, `allOf`, 1] }), s = (e) => `allOf` in e && Object.keys(e).length === 1, c = [...(s(a) ? a.allOf : [a]), ...(s(o) ? o.allOf : [o])]; ((n.allOf = c), t.intersections.push(c)); }, gs = (e, t, n, r) => { let i = e._zod.def, a = K(i.innerType, t, r), o = t.seen.get(e); t.target === `openapi-3.0` ? ((o.ref = i.innerType), (n.nullable = !0)) : (n.anyOf = [a, { type: `null` }]); }, _s = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; }, vs = Symbol(); function ys(e, t, n, r, i) { let a = !1, o = JSON.stringify(e, (e, t) => (typeof t == `bigint` ? ((a = !0), null) : t)); return a ? (G(t, n, r, i, `BigInt defaults cannot be represented in JSON Schema`), vs) : JSON.parse(o); } const bs = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; let o = ys(i.defaultValue, e, t, n, r); o !== vs && (n.default = o); }, xs = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); if (((a.ref = i.innerType), t.io !== `input`)) return; let o = ys(i.defaultValue, e, t, n, r); o !== vs && (n._prefault = o); }, Ss = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; let o; try { o = i.catchValue(void 0); } catch { G(e, t, n, r, `Dynamic catch values are not supported in JSON Schema`); return; } n.default = o; }, Cs = (e, t, n, r) => { let i = e._zod.def, a = i.in._zod.traits.has(`$ZodTransform`), o = t.io === `input` ? (a ? i.out : i.in) : i.out; K(o, t, r); let s = t.seen.get(e); s.ref = o; }, ws = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); ((a.ref = i.innerType), (n.readOnly = !0)); }, Ts = (e, t, n, r) => { let i = e._zod.def; K(i.innerType, t, r); let a = t.seen.get(e); a.ref = i.innerType; }, Es = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]); function Ds(e, t, n) { Object.defineProperty(e, t, { configurable: !0, enumerable: !1, get() { let e = n(this); return (Object.defineProperty(this, t, { value: e, configurable: !0, writable: !0 }), e); }, set(e) { Object.defineProperty(this, t, { value: e, configurable: !0, writable: !0 }); }, }); } const Y = /*@__PURE__*/ E( `ZodError`, (e, t) => { (Ye.init(e, t), (e.name = `ZodError`)); let n = Object.getPrototypeOf(e); Es.has(n) || (Es.add(n), Ds(n, `format`, (e) => (t) => Qe(e, t)), Ds(n, `flatten`, (e) => (t) => Ze(e, t)), Ds(n, `addIssue`, (e) => (t) => { (e.issues.push(t), (e.message = JSON.stringify(e.issues, r, 2))); }), Ds(n, `addIssues`, (e) => (t) => { (e.issues.push(...t), (e.message = JSON.stringify(e.issues, r, 2))); }), Object.defineProperty(n, "isEmpty", { configurable: !0, enumerable: !1, get() { return this.issues.length === 0; }, })); }, void 0, { Parent: Error }, ), Os = /* @__PURE__ */ et(Y), ks = /* @__PURE__ */ tt(Y), As = /* @__PURE__ */ nt(Y), js = /* @__PURE__ */ it(Y), Ms = /* @__PURE__ */ ut(Y), Ns = /* @__PURE__ */ dt(Y), Ps = /* @__PURE__ */ ft(Y), Fs = /* @__PURE__ */ pt(Y), Is = /* @__PURE__ */ mt(Y), Ls = /* @__PURE__ */ ht(Y), Rs = /* @__PURE__ */ gt(Y), zs = /* @__PURE__ */ _t(Y); function Bs() { O.localeError || k(ci()); } function Vs() { O.memoizer || k({ memoizer: ai() }); } const X = /*@__PURE__*/ E( `ZodType`, (e, t) => (Bs(), j.init(e, t), (e.def = t), (e.type = t.type), e), { check(...e) { let t = this.def; return this.clone( g(t, { checks: [ ...(t.checks ?? []), ...e.map((e) => typeof e == `function` ? { _zod: { check: e, def: { check: `custom` }, onattach: [] } } : e, ), ], }), { parent: !0 }, ); }, with(...e) { return this.check(...e); }, clone(e, t) { return y(this, e, t); }, brand() { return this; }, register(e, t) { return (e.add(this, t), this); }, refine(e, t) { return this.check(el(e, t)); }, superRefine(e, t) { return this.check(tl(e, t)); }, overwrite(e) { return this.check(/* @__PURE__ */ xo(e)); }, optional() { return Ic(this); }, exactOptional() { return Rc(this); }, nullable() { return Bc(this); }, nullish() { return Ic(Bc(this)); }, nonoptional(e) { return Kc(this, e); }, array() { return wc(this); }, or(e) { return Oc([this, e]); }, and(e) { return Ac(this, e); }, transform(e) { return Xc(this, Pc(e)); }, default(e) { return Hc(this, e); }, prefault(e) { return Wc(this, e); }, catch(e) { return Jc(this, e); }, pipe(e) { return Xc(this, e); }, readonly() { return Qc(this); }, describe(e) { let t = this.clone(); return (fi.add(t, { description: e }), t); }, meta(...e) { if (e.length === 0) return fi.get(this); let t = this.clone(); return (fi.add(t, e[0]), t); }, isOptional() { return this.safeParse(void 0).success; }, isNullable() { return this.safeParse(null).success; }, apply(e, ...t) { return t.length === 0 ? e(this) : e(this, ...t); }, get "~standard"() { return Ae(this, `~standard`, { ...vn(this), jsonSchema: { input: Uo(this, `input`), output: Uo(this, `output`) }, }); }, set "~standard"(e) { C(this, `~standard`, e); }, parse: function e(t, n) { return Os(this, t, n, { callee: e }); }, parseAsync: async function e(t, n) { return await ks(this, t, n, { callee: e }); }, safeParse(e, t) { return As(this, e, t); }, async safeParseAsync(e, t) { return js(this, e, t); }, get spa() { return this?.safeParseAsync; }, set spa(e) { C(this, `spa`, e); }, validate(e, t) { return st(this, e, t); }, validateAsync(e, t) { return lt(this, e, t); }, encode: function e(t, n) { return Ms(this, t, n, { callee: e }); }, decode: function e(t, n) { return Ns(this, t, n, { callee: e }); }, encodeAsync: async function e(t, n) { return await Ps(this, t, n, { callee: e }); }, decodeAsync: async function e(t, n) { return await Fs(this, t, n, { callee: e }); }, safeEncode(e, t) { return Is(this, e, t); }, safeDecode(e, t) { return Ls(this, e, t); }, async safeEncodeAsync(e, t) { return Rs(this, e, t); }, async safeDecodeAsync(e, t) { return zs(this, e, t); }, toJSONSchema(e) { return Ho(this, {})(e); }, get description() { return fi.get(this)?.description; }, get _def() { return this._zod.def; }, }, ), Hs = /*@__PURE__*/ E( `_ZodString`, (e, t) => { (yn.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => is(e, t, n, r))); }, /*@__PURE__*/ je( { format: (e) => J(e).format ?? null, minLength: (e) => J(e).minimum ?? null, maxLength: (e) => J(e).maximum ?? null, }, { regex(...e) { return this.check(/* @__PURE__ */ ho(...e)); }, includes(...e) { return this.check(/* @__PURE__ */ vo(...e)); }, startsWith(...e) { return this.check(/* @__PURE__ */ yo(...e)); }, endsWith(...e) { return this.check(/* @__PURE__ */ bo(...e)); }, min(...e) { return this.check(/* @__PURE__ */ po(...e)); }, max(...e) { return this.check(/* @__PURE__ */ fo(...e)); }, length(...e) { return this.check(/* @__PURE__ */ mo(...e)); }, nonempty(...e) { return this.check(/* @__PURE__ */ po(1, ...e)); }, lowercase(e) { return this.check(/* @__PURE__ */ go(e)); }, uppercase(e) { return this.check(/* @__PURE__ */ _o(e)); }, trim() { return this.check(/* @__PURE__ */ Co()); }, normalize(...e) { return this.check(/* @__PURE__ */ So(...e)); }, toLowerCase() { return this.check(/* @__PURE__ */ wo()); }, toUpperCase() { return this.check(/* @__PURE__ */ To()); }, slugify() { return this.check(/* @__PURE__ */ Eo()); }, }, ), ), Us = /*@__PURE__*/ E( `ZodString`, (e, t) => { (yn.init(e, t), Hs.init(e, t)); }, { email(e) { return this.check(/* @__PURE__ */ ka(Js, e)); }, url(e) { return this.check(/* @__PURE__ */ Fa(Zs, e)); }, jwt(e) { return this.check(/* @__PURE__ */ Xa(pc, e)); }, emoji(e) { return this.check(/* @__PURE__ */ Ia($s, e)); }, guid(e) { return this.check(/* @__PURE__ */ Aa(Ys, e)); }, uuid(e) { return this.check(/* @__PURE__ */ ja(Xs, e)); }, uuidv4(e) { return this.check(/* @__PURE__ */ Ma(Xs, e)); }, uuidv6(e) { return this.check(/* @__PURE__ */ Na(Xs, e)); }, uuidv7(e) { return this.check(/* @__PURE__ */ Pa(Xs, e)); }, nanoid(e) { return this.check(/* @__PURE__ */ La(ec, e)); }, cuid(e) { return this.check(/* @__PURE__ */ Ra(tc, e)); }, cuid2(e) { return this.check(/* @__PURE__ */ za(nc, e)); }, ulid(e) { return this.check(/* @__PURE__ */ Ba(rc, e)); }, base64(e) { return this.check(/* @__PURE__ */ qa(uc, e)); }, base64url(e) { return this.check(/* @__PURE__ */ Ja(dc, e)); }, xid(e) { return this.check(/* @__PURE__ */ Va(ic, e)); }, ksuid(e) { return this.check(/* @__PURE__ */ Ha(ac, e)); }, ipv4(e) { return this.check(/* @__PURE__ */ Ua(oc, e)); }, ipv6(e) { return this.check(/* @__PURE__ */ Wa(sc, e)); }, cidrv4(e) { return this.check(/* @__PURE__ */ Ga(cc, e)); }, cidrv6(e) { return this.check(/* @__PURE__ */ Ka(lc, e)); }, e164(e) { return this.check(/* @__PURE__ */ Ya(fc, e)); }, datetime(e) { return this.check(/* @__PURE__ */ Za(Ws, e)); }, date(e) { return this.check(/* @__PURE__ */ Qa(Gs, e)); }, time(e) { return this.check(/* @__PURE__ */ $a(Ks, e)); }, duration(e) { return this.check(/* @__PURE__ */ eo(qs, e)); }, }, ); function Z(e) { return /* @__PURE__ */ Oa(Us, e); } const Q = /*@__PURE__*/ E(`ZodStringFormat`, (e, t) => { (M.init(e, t), Hs.init(e, t)); }), Ws = /*@__PURE__*/ E(`ZodISODateTime`, (e, t) => { (Rn.init(e, t), Q.init(e, t)); }), Gs = /*@__PURE__*/ E(`ZodISODate`, (e, t) => { (zn.init(e, t), Q.init(e, t)); }), Ks = /*@__PURE__*/ E(`ZodISOTime`, (e, t) => { (Bn.init(e, t), Q.init(e, t)); }), qs = /*@__PURE__*/ E(`ZodISODuration`, (e, t) => { (Vn.init(e, t), Q.init(e, t)); }), Js = /*@__PURE__*/ E(`ZodEmail`, (e, t) => { (Sn.init(e, t), Q.init(e, t)); }), Ys = /*@__PURE__*/ E(`ZodGUID`, (e, t) => { (bn.init(e, t), Q.init(e, t)); }), Xs = /*@__PURE__*/ E(`ZodUUID`, (e, t) => { (xn.init(e, t), Q.init(e, t)); }), Zs = /*@__PURE__*/ E(`ZodURL`, (e, t) => { (An.init(e, t), Q.init(e, t)); }); function Qs(e) { return /* @__PURE__ */ Fa(Zs, e); } const $s = /*@__PURE__*/ E(`ZodEmoji`, (e, t) => { (jn.init(e, t), Q.init(e, t)); }), ec = /*@__PURE__*/ E(`ZodNanoID`, (e, t) => { (Mn.init(e, t), Q.init(e, t)); }), tc = /*@__PURE__*/ E(`ZodCUID`, (e, t) => { (Nn.init(e, t), Q.init(e, t)); }), nc = /*@__PURE__*/ E(`ZodCUID2`, (e, t) => { (Pn.init(e, t), Q.init(e, t)); }), rc = /*@__PURE__*/ E(`ZodULID`, (e, t) => { (Fn.init(e, t), Q.init(e, t)); }), ic = /*@__PURE__*/ E(`ZodXID`, (e, t) => { (In.init(e, t), Q.init(e, t)); }), ac = /*@__PURE__*/ E(`ZodKSUID`, (e, t) => { (Ln.init(e, t), Q.init(e, t)); }), oc = /*@__PURE__*/ E(`ZodIPv4`, (e, t) => { (Hn.init(e, t), Q.init(e, t)); }), sc = /*@__PURE__*/ E(`ZodIPv6`, (e, t) => { (Gn.init(e, t), Q.init(e, t)); }), cc = /*@__PURE__*/ E(`ZodCIDRv4`, (e, t) => { (Kn.init(e, t), Q.init(e, t)); }), lc = /*@__PURE__*/ E(`ZodCIDRv6`, (e, t) => { (Jn.init(e, t), Q.init(e, t)); }), uc = /*@__PURE__*/ E(`ZodBase64`, (e, t) => { (Zn.init(e, t), Q.init(e, t)); }), dc = /*@__PURE__*/ E(`ZodBase64URL`, (e, t) => { (er.init(e, t), Q.init(e, t)); }), fc = /*@__PURE__*/ E(`ZodE164`, (e, t) => { (tr.init(e, t), Q.init(e, t)); }), pc = /*@__PURE__*/ E(`ZodJWT`, (e, t) => { (cr.init(e, t), Q.init(e, t)); }), mc = /*@__PURE__*/ E( `ZodNumber`, (e, t) => { (lr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => as(e, t, n, r)), (e.isFinite = !0)); }, /*@__PURE__*/ je( { minValue: (e) => { let { minimum: t, exclusiveMinimum: n } = J(e); return Math.max(t ?? -1 / 0, n ?? -1 / 0); }, maxValue: (e) => { let { maximum: t, exclusiveMaximum: n } = J(e); return Math.min(t ?? 1 / 0, n ?? 1 / 0); }, isInt: (e) => { let { isInt: t, multipleOf: n } = J(e); return !!t || !!n?.some(Number.isSafeInteger); }, format: (e) => J(e).format ?? null, }, { gt(e, t) { return this.check(/* @__PURE__ */ co(e, t)); }, gte(e, t) { return this.check(/* @__PURE__ */ lo(e, t)); }, min(e, t) { return this.check(/* @__PURE__ */ lo(e, t)); }, lt(e, t) { return this.check(/* @__PURE__ */ oo(e, t)); }, lte(e, t) { return this.check(/* @__PURE__ */ so(e, t)); }, max(e, t) { return this.check(/* @__PURE__ */ so(e, t)); }, int(e) { return this.check(gc(e)); }, safe(e) { return this.check(gc(e)); }, positive(e) { return this.check(/* @__PURE__ */ co(0, e)); }, nonnegative(e) { return this.check(/* @__PURE__ */ lo(0, e)); }, negative(e) { return this.check(/* @__PURE__ */ oo(0, e)); }, nonpositive(e) { return this.check(/* @__PURE__ */ so(0, e)); }, multipleOf(e, t) { return this.check(/* @__PURE__ */ uo(e, t)); }, step(e, t) { return this.check(/* @__PURE__ */ uo(e, t)); }, finite() { return this; }, }, ), ); function $(e) { return /* @__PURE__ */ to(mc, e); } const hc = /*@__PURE__*/ E(`ZodNumberFormat`, (e, t) => { (ur.init(e, t), mc.init(e, t)); }); function gc(e) { return /* @__PURE__ */ no(hc, e); } const _c = /*@__PURE__*/ E(`ZodUnknown`, (e, t) => { (dr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (e, t, n) => void 0)); }); function vc() { return /* @__PURE__ */ ro(_c); } const yc = /*@__PURE__*/ E(`ZodNever`, (e, t) => { (fr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => os(e, t, n, r))); }); function bc(e) { return /* @__PURE__ */ io(yc, e); } const xc = /*@__PURE__*/ E( `ZodDate`, (e, t) => { (pr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ss(e, t, n, r)), (e.min = (t, n) => e.check(/* @__PURE__ */ lo(t, n))), (e.max = (t, n) => e.check(/* @__PURE__ */ so(t, n)))); }, /*@__PURE__*/ je( { minDate: (e) => { let { minimum: t } = J(e); return t ? new Date(t) : null; }, maxDate: (e) => { let { maximum: t } = J(e); return t ? new Date(t) : null; }, }, {}, ), ); function Sc(e) { return /* @__PURE__ */ ao(xc, e); } const Cc = /*@__PURE__*/ E( `ZodArray`, (e, t) => { (Vs(), hr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ds(e, t, n, r)), (e.element = t.element)); }, { min(e, t) { return this.check(/* @__PURE__ */ po(e, t)); }, nonempty(e) { return this.check(/* @__PURE__ */ po(1, e)); }, max(e, t) { return this.check(/* @__PURE__ */ fo(e, t)); }, length(e, t) { return this.check(/* @__PURE__ */ mo(e, t)); }, unwrap() { return this.element; }, }, ); function wc(e, t) { return /* @__PURE__ */ Do(Cc, e, t); } const Tc = /*@__PURE__*/ E( `ZodObject`, (e, t) => { (Vs(), xr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ps(e, t, n, r)), Ie(e, `shape`, (e) => e._zod.def.shape, !1)); }, { keyof() { return Mc(Object.keys(this._zod.def.shape)); }, catchall(e) { return this.clone(g(this._zod.def, { catchall: e })); }, passthrough() { return this.clone(g(this._zod.def, { catchall: vc() })); }, loose() { return this.clone(g(this._zod.def, { catchall: vc() })); }, strict() { return this.clone(g(this._zod.def, { catchall: bc() })); }, strip() { return this.clone(g(this._zod.def, { catchall: void 0 })); }, extend(e) { return me(this, e); }, safeExtend(e) { return ge(this, e); }, merge(e) { return _e(this, e); }, pick(e) { return de(this, e); }, omit(e) { return pe(this, e); }, partial(...e) { return ve(Fc, this, e[0]); }, exactPartial(...e) { return ve(Lc, this, e[0], `exactPartial`); }, required(...e) { return ye(Gc, this, e[0]); }, }, ); function Ec(e, t) { let n = { type: `object`, shape: e ?? {}, ...b(t) }; return new Tc(n); } const Dc = /*@__PURE__*/ E(`ZodUnion`, (e, t) => { (Cr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ms(e, t, n, r)), (e.options = t.options)); }); function Oc(e, t) { return new Dc({ type: `union`, options: e, ...b(t) }); } const kc = /*@__PURE__*/ E(`ZodIntersection`, (e, t) => { (wr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => hs(e, t, n, r))); }); function Ac(e, t) { return new kc({ type: `intersection`, left: e, right: t }); } const jc = /*@__PURE__*/ E(`ZodEnum`, (e, t) => { (Dr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => cs(e, t, n, r)), (e.enum = t.entries), (e.options = [...e._zod.values])); let n = new Set(Object.keys(t.entries)); ((e.extract = (e, r) => { let i = {}; for (let r of e) if (n.has(r)) i[r] = t.entries[r]; else throw Error(`Key ${r} not found in enum`); return new jc({ ...t, checks: [], ...b(r), entries: i }); }), (e.exclude = (e, r) => { let i = { ...t.entries }; for (let t of e) if (n.has(t)) delete i[t]; else throw Error(`Key ${t} not found in enum`); return new jc({ ...t, checks: [], ...b(r), entries: i }); })); }); function Mc(e, t) { let n = Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e; return new jc({ type: `enum`, entries: n, ...b(t) }); } const Nc = /*@__PURE__*/ E(`ZodTransform`, (e, t) => { (Vs(), Or.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => us(e, t, n, r)), (e._zod.parse = (n, r) => { if (r.direction === `backward`) throw new He(e.constructor.name); n.addIssue = (r) => { if (typeof r == `string`) n.issues.push(Oe(r, n.value, t)); else { let t = r; (t.fatal && (t.continue = !1), (t.code ??= `custom`), `input` in t || (t.input = n.value), (t.inst ??= e), n.issues.push(Oe(t))); } }; let i = t.transform(n.value, n); return i instanceof Promise ? i.then((e) => ((n.value = e), n)) : ((n.value = i), n); })); }); function Pc(e) { return new Nc({ type: `transform`, transform: e }); } const Fc = /*@__PURE__*/ E(`ZodOptional`, (e, t) => { (Ar.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ts(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Ic(e) { return new Fc({ type: `optional`, innerType: e }); } const Lc = /*@__PURE__*/ E(`ZodExactOptional`, (e, t) => { (jr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ts(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Rc(e) { return new Lc({ type: `optional`, innerType: e }); } const zc = /*@__PURE__*/ E(`ZodNullable`, (e, t) => { (Mr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => gs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Bc(e) { return new zc({ type: `nullable`, innerType: e }); } const Vc = /*@__PURE__*/ E(`ZodDefault`, (e, t) => { (Nr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => bs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType), (e.removeDefault = e.unwrap)); }); function Hc(e, t) { return new Vc({ type: `default`, innerType: e, get defaultValue() { return typeof t == `function` ? t() : ie(t); }, }); } const Uc = /*@__PURE__*/ E(`ZodPrefault`, (e, t) => { (Fr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => xs(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Wc(e, t) { return new Uc({ type: `prefault`, innerType: e, get defaultValue() { return typeof t == `function` ? t() : ie(t); }, }); } const Gc = /*@__PURE__*/ E(`ZodNonOptional`, (e, t) => { (Ir.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => _s(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Kc(e, t) { return new Gc({ type: `nonoptional`, innerType: e, ...b(t) }); } const qc = /*@__PURE__*/ E(`ZodCatch`, (e, t) => { (zr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Ss(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType), (e.removeCatch = e.unwrap)); }); function Jc(e, t) { return new qc({ type: `catch`, innerType: e, catchValue: typeof t == `function` ? t : Le(t) }); } const Yc = /*@__PURE__*/ E(`ZodPipe`, (e, t) => { (Br.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => Cs(e, t, n, r)), (e.in = t.in), (e.out = t.out)); }); function Xc(e, t) { return new Yc({ type: `pipe`, in: e, out: t }); } const Zc = /*@__PURE__*/ E(`ZodReadonly`, (e, t) => { (Hr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ws(e, t, n, r)), (e.unwrap = () => e._zod.def.innerType)); }); function Qc(e) { return new Zc({ type: `readonly`, innerType: e }); } const $c = /*@__PURE__*/ E(`ZodCustom`, (e, t) => { (Wr.init(e, t), X.init(e, t), (e._zod.processJSONSchema = (t, n, r) => ls(e, t, n, r))); }); function el(e, t = {}) { return /* @__PURE__ */ Oo($c, e, t); } function tl(e, t) { return /* @__PURE__ */ ko(e, t); } const nl = Ec({ id: $(), created: Sc(), title: Z().min(1).max(100), type: Mc([`jpg`, `png`]), size: $(), url: Qs(), }), rl = Ec({ id: $(), stars: $().min(1).max(5), title: Z().min(1).max(100), text: Z().min(1).max(1e3), images: wc(nl), }); hi( e()( Ec({ id: $(), created: Sc(), title: Z().min(1).max(100), brand: Z().min(1).max(30), description: Z().min(1).max(500), price: $().min(1).max(1e4), discount: $().min(1).max(100).nullable(), quantity: $().min(0).max(10), tags: wc(Z().min(1).max(30)), images: wc(nl), ratings: wc(rl), }), ), { strict: !0 }, ).parse({});