schemas/libraries/zod/mini/download_compiled/index/minified.js
schemas/libraries/zod/mini/download_compiled/index/minified.js
schemas/libraries/zod/mini/download_compiled/index/minified.js
schemas/libraries/zod/mini/download_compiled/index/minified.js
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 typeof t == `bigint`
? t.toString()
: t;
}
var r = 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 i(e) {
return new r(e);
}
function a(e) {
return e == null;
}
function o(e) {
let t = +!!e.startsWith(`^`),
n = e.endsWith(`$`)
? e.length - 1
: e.length;
return e.slice(t, n);
}
function s(e, t, n) {
Object.defineProperty(e, t, {
value: n,
writable: !0,
enumerable: !0,
configurable: !0,
});
}
const c =
`captureStackTrace` in Error
? Error.captureStackTrace
: (...e) => {};
function l(e) {
return (
typeof e == `object` &&
!!e &&
!Array.isArray(e)
);
}
const u = new Set([
`string`,
`number`,
`symbol`,
]);
function d(e) {
return e.replace(
/[.*+?^${}()|[\]\\]/g,
`\\$&`,
);
}
function f(e, t, n) {
let r = new e._zod.constr(
t ?? e._zod.def,
);
return (
(!t || n?.parent) &&
(r._zod.parent = e),
r
);
}
function p(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 ee(e) {
return Object.keys(e).filter(
(t) =>
e[t]._zod.optin !== void 0 &&
e[t]._zod.optout === `optional`,
);
}
function m(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 te(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 h(e, t) {
return t.map((t) => {
var n;
return (
(n = t).path ?? (n.path = []),
t.path.unshift(e),
t
);
});
}
function g(e) {
return typeof e == `string`
? e
: e?.message;
}
function ne(e, t, n) {
var r;
for (let i = t; i < e.length; i++)
(r = e[i]).schema ?? (r.schema = n);
}
function _(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
: (g(
e.inst?._zod.def?.error?.(e),
) ??
g(a?.(e)) ??
g(t?.error?.(e)) ??
g(n.customError?.(e)) ??
g(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 re = /[\uD800-\uDBFF]/;
function v(e) {
let t = e.length;
if (!re.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 y(e) {
return Array.isArray(e)
? `array`
: typeof e == `string`
? `string`
: `unknown`;
}
function ie(e, t) {
for (let n in t) {
let r =
Object.getOwnPropertyDescriptor(
t,
n,
);
r.get
? Object.defineProperty(e, n, {
...r,
enumerable: !1,
})
: oe(e, n, r.value);
}
}
function b(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 b(e, t, n, !1);
}
function oe(e, t, n) {
Object.defineProperty(e, t, {
configurable: !0,
get() {
return this == null
? n
: b(this, t, n.bind(this));
},
set(e) {
b(this, t, e);
},
});
}
function se(e, t) {
let n = Object.getPrototypeOf(e);
return t in n ? void 0 : n;
}
let x,
S = !1;
const ce = {
configurable: !0,
get() {
S = !0;
},
};
function C(e, t, n) {
let r = Object.getPrototypeOf(e._zod);
if (t in r && x !== e._zod) {
x = void 0;
return;
}
((x = e._zod),
Object.defineProperty(r, t, {
configurable: !0,
get() {
Object.defineProperty(
this,
t,
ce,
);
let e = S;
S = !1;
try {
let r = n(this);
return (
S
? delete this[t]
: Object.defineProperty(
this,
t,
{
configurable: !0,
writable: !0,
value: r,
},
),
(S ||= e),
r
);
} catch (n) {
throw (
delete this[t], (S ||= e), n
);
}
},
set(e) {
Object.defineProperty(this, t, {
configurable: !0,
writable: !0,
value: e,
});
},
}));
}
function le(e, t, n, r) {
let i = se(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,
});
},
});
}
var w;
const T = {
value: void 0,
enumerable: !1,
};
let E =
`captureStackTrace` in Error
? Error
: null;
function ue(e) {
let t = E;
if (t) {
let n = t.stackTraceLimit;
if (typeof n == `number`) {
try {
t.stackTraceLimit = 0;
} catch {
return ((E = null), new e());
}
try {
return new e();
} finally {
t.stackTraceLimit = n;
}
}
}
return new e();
}
function D(e, t, n, r) {
let i = {};
function a(e) {
((this.def = e),
(this.constr = d),
(this.traits =
new Set()));
}
a.prototype = i;
let o = n,
s =
o &&
new WeakSet();
function c(n, r) {
if (!n._zod) {
T.value = new a(r);
try {
Object.defineProperty(
n,
"_zod",
T,
);
} finally {
T.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), ie(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 ? ue(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 O = class extends Error {
constructor() {
super(
`Encountered Promise during synchronous parse. Use .parseAsync() instead.`,
);
}
};
(w = globalThis).__zod_globalConfig ??
(w.__zod_globalConfig = {});
const k = globalThis.__zod_globalConfig;
function A(e) {
return (e && Object.assign(k, e), k);
}
function de() {
let e = this._zod;
return (
(e.message ??= JSON.stringify(
e.def,
n,
2,
)),
e.message
);
}
function fe(e) {
this._zod.message = e;
}
const pe = {
get: de,
set: fe,
enumerable: !0,
configurable: !0,
},
j = { value: void 0, enumerable: !1 },
M = new WeakSet([
Object.prototype,
Error.prototype,
]),
N = (e, t) => {
((e.name = `$ZodError`),
(j.value = t),
Object.defineProperty(
e,
"issues",
j,
),
(j.value = void 0),
Object.defineProperty(
e,
"message",
pe,
));
let n = Object.getPrototypeOf(e);
M.has(n) ||
(M.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,
},
);
},
},
));
};
D(`$ZodError`, N);
const P = D(`$ZodError`, N, void 0, {
Parent: Error,
}),
me = ((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 O();
if (s.issues.length) {
let n = new (a?.Err ?? e)(
s.issues.map((e) =>
_(e, o, A()),
),
);
throw (c(n, a?.callee ?? t), n);
}
return s.value;
};
return t;
})(P),
he = ((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) =>
_(e, o, A()),
),
);
throw (c(n, a?.callee ?? t), n);
}
return s.value;
};
return t;
})(P),
ge = (
(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 O();
return a.issues.length
? F(e, a.issues, i)
: {
success: !0,
data: a.value,
};
}
)(P);
function F(e, t, n) {
let r;
return {
success: !1,
get error() {
return (
r ||
((r = new e(
t.map((e) => _(e, n, A())),
)),
(t = void 0),
(n = void 0)),
r
);
},
set error(e) {
((r = e),
(t = void 0),
(n = void 0));
},
};
}
const _e = (
(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
? F(e, a.issues, i)
: {
success: !0,
data: a.value,
}
);
}
)(P),
ve = /^https?$/,
ye = /^[\s\S]{0,}$/,
be = /^-?\d+(?:\.\d+)?$/,
I = D(
`$ZodCheck`,
(e, t) => {
var n;
((e._zod ??= {}),
(e._zod.def = t),
(n = e._zod).onattach ??
(n.onattach = []));
},
),
L = (e) => {
let t = e.value;
return !a(t) && t.length !== void 0;
},
R = {
number: `number`,
bigint: `bigint`,
object: `date`,
},
xe = D(
`$ZodCheckLessThan`,
(e, t) => {
I.init(e, t);
let n = R[typeof t.value];
e._zod.check = (r) => {
(t.inclusive
? r.value <= t.value
: r.value < t.value) ||
r.issues.push({
origin:
R[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,
});
};
},
),
Se = D(
`$ZodCheckGreaterThan`,
(e, t) => {
I.init(e, t);
let n = R[typeof t.value];
e._zod.check = (r) => {
(t.inclusive
? r.value >= t.value
: r.value > t.value) ||
r.issues.push({
origin:
R[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,
});
};
},
),
Ce = D(
`$ZodCheckMaxLength`,
(e, t) => {
var n;
(I.init(e, t),
(n = e._zod.def).when ??
(n.when = L),
(e._zod.check = (n) => {
let r = n.value,
i = r.length;
if (
(typeof r == `string` &&
i > t.maximum
? v(r)
: i) <= t.maximum
)
return;
let a = y(r);
n.issues.push({
origin: a,
code: `too_big`,
maximum: t.maximum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort,
});
}));
},
),
we = D(
`$ZodCheckMinLength`,
(e, t) => {
var n;
(I.init(e, t),
(n = e._zod.def).when ??
(n.when = L),
(e._zod.check = (n) => {
let r = n.value,
i = r.length;
if (
(typeof r == `string` &&
i >= t.minimum &&
i < t.minimum * 2
? v(r)
: i) >= t.minimum
)
return;
let a = y(r);
n.issues.push({
origin: a,
code: `too_small`,
minimum: t.minimum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort,
});
}));
},
),
Te = D(
`$ZodCheckStringFormat`,
(e, t) => {
var n, r;
(I.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 = () => {})));
},
),
Ee = { major: 4, minor: 6, patch: 5 },
z = D(
`$ZodType`,
(e, t) => {
var n;
((e ??= {}),
(e._zod.def = t),
(e._zod.bag = e._zod.bag || {}),
(e._zod.version = Ee));
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 = m(t),
a;
for (let o of n) {
if (o._zod.def.when) {
if (
te(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 O();
if (
a ||
s instanceof Promise
)
a = (
a ?? Promise.resolve()
).then(async () => {
(await s,
t.issues.length !==
n &&
(ne(
t.issues,
n,
e,
),
(i ||= m(t, n))));
});
else {
if (
t.issues.length === n
)
continue;
(ne(t.issues, n, e),
(i ||= m(t, n)));
}
}
return a
? a.then(() => t)
: t;
},
n = (n, r, a) => {
if (m(n))
return (
(n.aborted = !0), n
);
let o = t(r, i, a);
if (o instanceof Promise) {
if (a.async === !1)
throw new O();
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 O();
return o.then((e) =>
t(e, i, a),
);
}
return t(o, i, a);
};
}
},
{
get "~standard"() {
return ae(
this,
`~standard`,
ke(this),
);
},
set "~standard"(e) {
b(this, `~standard`, e);
},
},
),
De = (e, t) =>
e.issues.length
? {
issues: e.issues.map((e) =>
_(e, t, A()),
),
}
: { value: e.value };
async function Oe(e, t) {
let n = { async: !0 };
return De(
await e._zod.run(
{ value: t, issues: [] },
n,
),
n,
);
}
function ke(e) {
return {
validate: (t) => {
let n = { async: !1 };
try {
let r = e._zod.run(
{ value: t, issues: [] },
n,
);
if (!(r instanceof Promise))
return De(r, n);
} catch {}
return Oe(e, t);
},
vendor: `zod`,
version: 1,
};
}
const Ae = D(
`$ZodString`,
(e, t) => {
(z.init(e, t),
(e._zod.pattern =
t.pattern ?? ye),
(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
);
}));
},
),
je = D(
`$ZodStringFormat`,
(e, t) => {
(Te.init(e, t), Ae.init(e, t));
},
);
function Me(e) {
try {
return typeof URL < `u` &&
typeof URL.canParse == `function`
? URL.canParse(e)
: (new URL(e), !0);
} catch {
return !1;
}
}
function Ne(e, t) {
return !(`normalize` in t) &&
!(`hostname` in t) &&
!(`protocol` in t)
? Me(e) || 2
: Pe(e, t);
}
function Pe(e, t) {
if (
!t.normalize &&
t.protocol?.source === ve.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 Fe = /[\t\n\r]/g;
function B(e) {
return e.replace(Fe, ``);
}
function Ie(e, t) {
return (
(t.lastIndex = 0),
t.test(e.hostname)
);
}
function Le(e, t) {
return (
(t.lastIndex = 0),
t.test(
e.protocol.endsWith(`:`)
? e.protocol.slice(0, -1)
: e.protocol,
)
);
}
const Re = D(
`$ZodURL`,
(e, t) => {
(je.init(e, t),
(e._zod.check = (n) => {
try {
let r = n.value.trim(),
i = Ne(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 = B(r);
return;
}
(t.hostname &&
!Ie(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 &&
!Le(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
: B(r)));
return;
} catch {
n.issues.push({
code: `invalid_format`,
format: `url`,
input: n.value,
inst: e,
continue: !t.abort,
});
}
}));
},
),
ze = D(
`$ZodNumber`,
(e, t) => {
(z.init(e, t),
(e._zod.pattern = be),
(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
);
}));
},
),
Be = D(
`$ZodDate`,
(e, t) => {
(z.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 V(e, t, n) {
(e.issues.length &&
t.issues.push(...h(n, e.issues)),
(t.value[n] = e.value));
}
const Ve = D(
`$ZodArray`,
(e, t) => {
z.init(e, t);
let n = k.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) => V(t, r, e)),
);
else if (
(V(c, r, e),
s &&
c.issues.length !== 0 &&
m(c))
)
break;
}
return o.length
? Promise.all(o).then(() => r)
: r;
}));
},
);
function H(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(...h(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 He = [];
function Ue(e) {
let t = Object.keys(e.shape),
n = Object.getOwnPropertySymbols(
e.shape,
),
r = n.length ? n : He,
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 = ee(e.shape);
return {
...e,
allKeys: i,
symbolKeys: r,
keySet: new Set(t),
numKeys: t.length,
optionalKeys: new Set(a),
};
}
function We(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 (m(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) =>
H(e, n, i, t, d, f),
),
)
: H(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 Ge = D(
`$ZodObject`,
(e, t) => {
z.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 a = i(() => Ue(t));
C(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,
) ||
s(
n,
e,
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 = l,
c = t.catchall,
u,
d = k.memoizer;
(d?.attach(e),
(e._zod.parse = (t, n) => {
u ??= a.value;
let r = t.value;
if (!o(r))
return (
t.issues.push({
expected: `object`,
code: `invalid_type`,
input: r,
inst: e,
}),
t
);
t.value = d
? d.alloc(e, t, {}, n)
: {};
let i = [],
s = u.shape,
l = n?.abortEarly,
f = t.issues.length;
for (let e of u.allKeys) {
if (
l &&
t.issues.length !== f
) {
if (m(t, f)) break;
f = t.issues.length;
}
if (e === `__proto__`)
continue;
let a = s[e],
o = a._zod.optin,
c = a._zod.optout,
u = a._zod.run(
{
value: r[e],
issues: [],
},
n,
);
u instanceof Promise
? i.push(
u.then((n) =>
H(n, t, e, r, o, c),
),
)
: H(u, t, e, r, o, c);
}
return c
? We(
i,
r,
t,
n,
a.value,
e,
l === !0,
)
: i.length
? Promise.all(i).then(
() => t,
)
: t;
}));
},
),
Ke = D(
`$ZodEnum`,
(e, n) => {
z.init(e, n);
let r = t(n.entries),
i = new Set(r);
((e._zod.values = i),
C(e, `pattern`, (e) => {
let n = t(
e.def.entries,
).filter((e) =>
u.has(typeof e),
);
return RegExp(
n.length
? `^(${n.map((e) => d(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
);
}));
},
),
qe = D(
`$ZodNullable`,
(e, t) => {
(z.init(e, t),
C(
e,
`optin`,
(e) =>
e.def.innerType._zod.optin,
),
C(
e,
`optout`,
(e) =>
e.def.innerType._zod.optout,
),
C(e, `pattern`, (e) => {
let t =
e.def.innerType._zod
.pattern;
return t
? RegExp(
`^(${o(t.source)}|null)$`,
)
: void 0;
}),
C(e, `values`, (e) =>
e.def.innerType._zod.values
? 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,
)));
},
);
function U(e) {
return (
(e.checks &&= [...e.checks]), e
);
}
function Je(e, t) {
return new e(
U({ type: `string`, ...p(t) }),
);
}
function Ye(e, t) {
return new e({
type: `string`,
format: `url`,
check: `string_format`,
abort: !1,
...p(t),
});
}
function Xe(e, t) {
return new e(
U({
type: `number`,
checks: [],
...p(t),
}),
);
}
function Ze(e, t) {
return new e({
type: `date`,
...p(t),
});
}
function W(e, t) {
return new xe({
check: `less_than`,
...p(t),
value: e,
inclusive: !0,
});
}
function G(e, t) {
return new Se({
check: `greater_than`,
...p(t),
value: e,
inclusive: !0,
});
}
function K(e, t) {
return new Ce({
check: `max_length`,
...p(t),
maximum: e,
});
}
function q(e, t) {
return new we({
check: `min_length`,
...p(t),
minimum: e,
});
}
const J = D(
`ZodMiniType`,
(e, t) => {
if (!e._zod)
throw Error(
`Uninitialized schema in ZodMiniType.`,
);
(z.init(e, t),
(e.def = t),
(e.type = t.type));
},
{
get with() {
return this.check;
},
set with(e) {
b(this, `with`, e);
},
parse(e, t) {
return me(this, e, t, {
callee: this.parse,
});
},
parseAsync(e, t) {
return he(this, e, t, {
callee: this.parseAsync,
});
},
safeParse(e, t) {
return ge(this, e, t);
},
safeParseAsync(e, t) {
return _e(this, e, t);
},
check(...e) {
let t = this.def;
return this.clone(
{
...t,
checks: [
...(t.checks ?? []),
...e.map((e) =>
typeof e == `function`
? {
_zod: {
check: e,
def: {
check: `custom`,
},
onattach: [],
},
}
: e,
),
],
},
{ parent: !0 },
);
},
clone(e, t) {
return f(this, e, t);
},
brand() {
return this;
},
register(e, t) {
return (e.add(this, t), this);
},
apply(e, ...t) {
return t.length === 0
? e(this)
: e(this, ...t);
},
},
),
Y = D(
`ZodMiniString`,
(e, t) => {
(Ae.init(e, t), J.init(e, t));
},
);
function X(e) {
return Je(Y, e);
}
const Qe = D(
`ZodMiniStringFormat`,
(e, t) => {
(je.init(e, t), Y.init(e, t));
},
),
$e = D(
`ZodMiniURL`,
(e, t) => {
(Re.init(e, t), Qe.init(e, t));
},
);
function et(e) {
return Ye($e, e);
}
const tt = D(
`ZodMiniNumber`,
(e, t) => {
(ze.init(e, t), J.init(e, t));
},
);
function Z(e) {
return Xe(tt, e);
}
const nt = D(
`ZodMiniDate`,
(e, t) => {
(Be.init(e, t), J.init(e, t));
},
);
function rt(e) {
return Ze(nt, e);
}
const it = D(
`ZodMiniArray`,
(e, t) => {
(Ve.init(e, t), J.init(e, t));
},
);
function Q(e, t) {
return new it({
type: `array`,
element: e,
...p(t),
});
}
const at = D(
`ZodMiniObject`,
(e, t) => {
(Ge.init(e, t),
J.init(e, t),
le(
e,
`shape`,
(e) => e._zod.def.shape,
!1,
));
},
);
function $(e, t) {
let n = {
type: `object`,
shape: e ?? {},
...p(t),
};
return new at(n);
}
const ot = D(
`ZodMiniEnum`,
(e, t) => {
(Ke.init(e, t),
J.init(e, t),
(e.options = [...e._zod.values]));
},
);
function st(e, t) {
let n = Array.isArray(e)
? Object.fromEntries(
e.map((e) => [e, e]),
)
: e;
return new ot({
type: `enum`,
entries: n,
...p(t),
});
}
const ct = D(
`ZodMiniNullable`,
(e, t) => {
(qe.init(e, t), J.init(e, t));
},
);
function lt(e) {
return new ct({
type: `nullable`,
innerType: e,
});
}
const ut = $({
id: Z(),
created: rt(),
title: X().check(
q(1),
K(100),
),
type: st([
`jpg`,
`png`,
]),
size: Z(),
url: et(),
}),
dt = $({
id: Z(),
stars: Z().check(
G(1),
W(5),
),
title: X().check(
q(1),
K(100),
),
text: X().check(
q(1),
K(1e3),
),
images: Q(ut),
});
e()(
$({
id: Z(),
created: rt(),
title: X().check(
q(1),
K(100),
),
brand: X().check(
q(1),
K(30),
),
description:
X().check(
q(1),
K(500),
),
price: Z().check(
G(1),
W(1e4),
),
discount: lt(
Z().check(
G(1),
W(100),
),
),
quantity: Z().check(
G(0),
W(10),
),
tags: Q(
X().check(
q(1),
K(30),
),
),
images: Q(ut),
ratings: Q(dt),
}),
).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 typeof t == `bigint` ? t.toString() : t;
}
var r = 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 i(e) {
return new r(e);
}
function a(e) {
return e == null;
}
function o(e) {
let t = +!!e.startsWith(`^`),
n = e.endsWith(`$`) ? e.length - 1 : e.length;
return e.slice(t, n);
}
function s(e, t, n) {
Object.defineProperty(e, t, {
value: n,
writable: !0,
enumerable: !0,
configurable: !0,
});
}
const c =
`captureStackTrace` in Error
? Error.captureStackTrace
: (...e) => {};
function l(e) {
return typeof e == `object` && !!e && !Array.isArray(e);
}
const u = new Set([
`string`,
`number`,
`symbol`,
]);
function d(e) {
return e.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`);
}
function f(e, t, n) {
let r = new e._zod.constr(t ?? e._zod.def);
return ((!t || n?.parent) && (r._zod.parent = e), r);
}
function p(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 ee(e) {
return Object.keys(e).filter(
(t) =>
e[t]._zod.optin !== void 0 &&
e[t]._zod.optout === `optional`,
);
}
function m(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 te(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 h(e, t) {
return t.map((t) => {
var n;
return (
(n = t).path ?? (n.path = []), t.path.unshift(e), t
);
});
}
function g(e) {
return typeof e == `string` ? e : e?.message;
}
function ne(e, t, n) {
var r;
for (let i = t; i < e.length; i++)
(r = e[i]).schema ?? (r.schema = n);
}
function _(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
: (g(e.inst?._zod.def?.error?.(e)) ??
g(a?.(e)) ??
g(t?.error?.(e)) ??
g(n.customError?.(e)) ??
g(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 re = /[\uD800-\uDBFF]/;
function v(e) {
let t = e.length;
if (!re.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 y(e) {
return Array.isArray(e)
? `array`
: typeof e == `string`
? `string`
: `unknown`;
}
function ie(e, t) {
for (let n in t) {
let r = Object.getOwnPropertyDescriptor(t, n);
r.get
? Object.defineProperty(e, n, {
...r,
enumerable: !1,
})
: oe(e, n, r.value);
}
}
function b(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 b(e, t, n, !1);
}
function oe(e, t, n) {
Object.defineProperty(e, t, {
configurable: !0,
get() {
return this == null ? n : b(this, t, n.bind(this));
},
set(e) {
b(this, t, e);
},
});
}
function se(e, t) {
let n = Object.getPrototypeOf(e);
return t in n ? void 0 : n;
}
let x,
S = !1;
const ce = {
configurable: !0,
get() {
S = !0;
},
};
function C(e, t, n) {
let r = Object.getPrototypeOf(e._zod);
if (t in r && x !== e._zod) {
x = void 0;
return;
}
((x = e._zod),
Object.defineProperty(r, t, {
configurable: !0,
get() {
Object.defineProperty(this, t, ce);
let e = S;
S = !1;
try {
let r = n(this);
return (
S
? delete this[t]
: Object.defineProperty(this, t, {
configurable: !0,
writable: !0,
value: r,
}),
(S ||= e),
r
);
} catch (n) {
throw (delete this[t], (S ||= e), n);
}
},
set(e) {
Object.defineProperty(this, t, {
configurable: !0,
writable: !0,
value: e,
});
},
}));
}
function le(e, t, n, r) {
let i = se(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,
});
},
});
}
var w;
const T = { value: void 0, enumerable: !1 };
let E = `captureStackTrace` in Error ? Error : null;
function ue(e) {
let t = E;
if (t) {
let n = t.stackTraceLimit;
if (typeof n == `number`) {
try {
t.stackTraceLimit = 0;
} catch {
return ((E = null), new e());
}
try {
return new e();
} finally {
t.stackTraceLimit = n;
}
}
}
return new e();
}
function D(e, t, n, r) {
let i = {};
function a(e) {
((this.def = e),
(this.constr = d),
(this.traits = new Set()));
}
a.prototype = i;
let o = n,
s = o && new WeakSet();
function c(n, r) {
if (!n._zod) {
T.value = new a(r);
try {
Object.defineProperty(n, "_zod", T);
} finally {
T.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), ie(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 ? ue(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 O = class extends Error {
constructor() {
super(
`Encountered Promise during synchronous parse. Use .parseAsync() instead.`,
);
}
};
(w = globalThis).__zod_globalConfig ??
(w.__zod_globalConfig = {});
const k = globalThis.__zod_globalConfig;
function A(e) {
return (e && Object.assign(k, e), k);
}
function de() {
let e = this._zod;
return (
(e.message ??= JSON.stringify(e.def, n, 2)), e.message
);
}
function fe(e) {
this._zod.message = e;
}
const pe = {
get: de,
set: fe,
enumerable: !0,
configurable: !0,
},
j = { value: void 0, enumerable: !1 },
M = new WeakSet([
Object.prototype,
Error.prototype,
]),
N = (e, t) => {
((e.name = `$ZodError`),
(j.value = t),
Object.defineProperty(e, "issues", j),
(j.value = void 0),
Object.defineProperty(e, "message", pe));
let n = Object.getPrototypeOf(e);
M.has(n) ||
(M.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,
});
},
}));
};
D(`$ZodError`, N);
const P = D(`$ZodError`, N, void 0, { Parent: Error }),
me = ((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 O();
if (s.issues.length) {
let n = new (a?.Err ?? e)(
s.issues.map((e) => _(e, o, A())),
);
throw (c(n, a?.callee ?? t), n);
}
return s.value;
};
return t;
})(P),
he = ((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) => _(e, o, A())),
);
throw (c(n, a?.callee ?? t), n);
}
return s.value;
};
return t;
})(P),
ge = ((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 O();
return a.issues.length
? F(e, a.issues, i)
: { success: !0, data: a.value };
})(P);
function F(e, t, n) {
let r;
return {
success: !1,
get error() {
return (
r ||
((r = new e(t.map((e) => _(e, n, A())))),
(t = void 0),
(n = void 0)),
r
);
},
set error(e) {
((r = e), (t = void 0), (n = void 0));
},
};
}
const _e = ((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
? F(e, a.issues, i)
: { success: !0, data: a.value }
);
})(P),
ve = /^https?$/,
ye = /^[\s\S]{0,}$/,
be = /^-?\d+(?:\.\d+)?$/,
I = D(`$ZodCheck`, (e, t) => {
var n;
((e._zod ??= {}),
(e._zod.def = t),
(n = e._zod).onattach ?? (n.onattach = []));
}),
L = (e) => {
let t = e.value;
return !a(t) && t.length !== void 0;
},
R = {
number: `number`,
bigint: `bigint`,
object: `date`,
},
xe = D(`$ZodCheckLessThan`, (e, t) => {
I.init(e, t);
let n = R[typeof t.value];
e._zod.check = (r) => {
(t.inclusive
? r.value <= t.value
: r.value < t.value) ||
r.issues.push({
origin: R[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,
});
};
}),
Se = D(`$ZodCheckGreaterThan`, (e, t) => {
I.init(e, t);
let n = R[typeof t.value];
e._zod.check = (r) => {
(t.inclusive
? r.value >= t.value
: r.value > t.value) ||
r.issues.push({
origin: R[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,
});
};
}),
Ce = D(`$ZodCheckMaxLength`, (e, t) => {
var n;
(I.init(e, t),
(n = e._zod.def).when ?? (n.when = L),
(e._zod.check = (n) => {
let r = n.value,
i = r.length;
if (
(typeof r == `string` && i > t.maximum
? v(r)
: i) <= t.maximum
)
return;
let a = y(r);
n.issues.push({
origin: a,
code: `too_big`,
maximum: t.maximum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort,
});
}));
}),
we = D(`$ZodCheckMinLength`, (e, t) => {
var n;
(I.init(e, t),
(n = e._zod.def).when ?? (n.when = L),
(e._zod.check = (n) => {
let r = n.value,
i = r.length;
if (
(typeof r == `string` &&
i >= t.minimum &&
i < t.minimum * 2
? v(r)
: i) >= t.minimum
)
return;
let a = y(r);
n.issues.push({
origin: a,
code: `too_small`,
minimum: t.minimum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort,
});
}));
}),
Te = D(`$ZodCheckStringFormat`, (e, t) => {
var n, r;
(I.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 = () => {})));
}),
Ee = { major: 4, minor: 6, patch: 5 },
z = D(
`$ZodType`,
(e, t) => {
var n;
((e ??= {}),
(e._zod.def = t),
(e._zod.bag = e._zod.bag || {}),
(e._zod.version = Ee));
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 = m(t),
a;
for (let o of n) {
if (o._zod.def.when) {
if (te(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 O();
if (a || s instanceof Promise)
a = (a ?? Promise.resolve()).then(
async () => {
(await s,
t.issues.length !== n &&
(ne(t.issues, n, e),
(i ||= m(t, n))));
},
);
else {
if (t.issues.length === n) continue;
(ne(t.issues, n, e), (i ||= m(t, n)));
}
}
return a ? a.then(() => t) : t;
},
n = (n, r, a) => {
if (m(n)) return ((n.aborted = !0), n);
let o = t(r, i, a);
if (o instanceof Promise) {
if (a.async === !1) throw new O();
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 O();
return o.then((e) => t(e, i, a));
}
return t(o, i, a);
};
}
},
{
get "~standard"() {
return ae(this, `~standard`, ke(this));
},
set "~standard"(e) {
b(this, `~standard`, e);
},
},
),
De = (e, t) =>
e.issues.length
? { issues: e.issues.map((e) => _(e, t, A())) }
: { value: e.value };
async function Oe(e, t) {
let n = { async: !0 };
return De(
await e._zod.run({ value: t, issues: [] }, n),
n,
);
}
function ke(e) {
return {
validate: (t) => {
let n = { async: !1 };
try {
let r = e._zod.run({ value: t, issues: [] }, n);
if (!(r instanceof Promise)) return De(r, n);
} catch {}
return Oe(e, t);
},
vendor: `zod`,
version: 1,
};
}
const Ae = D(`$ZodString`, (e, t) => {
(z.init(e, t),
(e._zod.pattern = t.pattern ?? ye),
(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
);
}));
}),
je = D(`$ZodStringFormat`, (e, t) => {
(Te.init(e, t), Ae.init(e, t));
});
function Me(e) {
try {
return typeof URL < `u` &&
typeof URL.canParse == `function`
? URL.canParse(e)
: (new URL(e), !0);
} catch {
return !1;
}
}
function Ne(e, t) {
return !(`normalize` in t) &&
!(`hostname` in t) &&
!(`protocol` in t)
? Me(e) || 2
: Pe(e, t);
}
function Pe(e, t) {
if (
!t.normalize &&
t.protocol?.source === ve.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 Fe = /[\t\n\r]/g;
function B(e) {
return e.replace(Fe, ``);
}
function Ie(e, t) {
return ((t.lastIndex = 0), t.test(e.hostname));
}
function Le(e, t) {
return (
(t.lastIndex = 0),
t.test(
e.protocol.endsWith(`:`)
? e.protocol.slice(0, -1)
: e.protocol,
)
);
}
const Re = D(`$ZodURL`, (e, t) => {
(je.init(e, t),
(e._zod.check = (n) => {
try {
let r = n.value.trim(),
i = Ne(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 = B(r);
return;
}
(t.hostname &&
!Ie(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 &&
!Le(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 : B(r)));
return;
} catch {
n.issues.push({
code: `invalid_format`,
format: `url`,
input: n.value,
inst: e,
continue: !t.abort,
});
}
}));
}),
ze = D(`$ZodNumber`, (e, t) => {
(z.init(e, t),
(e._zod.pattern = be),
(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
);
}));
}),
Be = D(`$ZodDate`, (e, t) => {
(z.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 V(e, t, n) {
(e.issues.length && t.issues.push(...h(n, e.issues)),
(t.value[n] = e.value));
}
const Ve = D(`$ZodArray`, (e, t) => {
z.init(e, t);
let n = k.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) => V(t, r, e)));
else if (
(V(c, r, e), s && c.issues.length !== 0 && m(c))
)
break;
}
return o.length ? Promise.all(o).then(() => r) : r;
}));
});
function H(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(...h(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 He = [];
function Ue(e) {
let t = Object.keys(e.shape),
n = Object.getOwnPropertySymbols(e.shape),
r = n.length ? n : He,
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 = ee(e.shape);
return {
...e,
allKeys: i,
symbolKeys: r,
keySet: new Set(t),
numKeys: t.length,
optionalKeys: new Set(a),
};
}
function We(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 (m(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) => H(e, n, i, t, d, f)))
: H(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 Ge = D(`$ZodObject`, (e, t) => {
z.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 a = i(() => Ue(t));
C(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) ||
s(n, e, 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 = l,
c = t.catchall,
u,
d = k.memoizer;
(d?.attach(e),
(e._zod.parse = (t, n) => {
u ??= a.value;
let r = t.value;
if (!o(r))
return (
t.issues.push({
expected: `object`,
code: `invalid_type`,
input: r,
inst: e,
}),
t
);
t.value = d ? d.alloc(e, t, {}, n) : {};
let i = [],
s = u.shape,
l = n?.abortEarly,
f = t.issues.length;
for (let e of u.allKeys) {
if (l && t.issues.length !== f) {
if (m(t, f)) break;
f = t.issues.length;
}
if (e === `__proto__`) continue;
let a = s[e],
o = a._zod.optin,
c = a._zod.optout,
u = a._zod.run({ value: r[e], issues: [] }, n);
u instanceof Promise
? i.push(u.then((n) => H(n, t, e, r, o, c)))
: H(u, t, e, r, o, c);
}
return c
? We(i, r, t, n, a.value, e, l === !0)
: i.length
? Promise.all(i).then(() => t)
: t;
}));
}),
Ke = D(`$ZodEnum`, (e, n) => {
z.init(e, n);
let r = t(n.entries),
i = new Set(r);
((e._zod.values = i),
C(e, `pattern`, (e) => {
let n = t(e.def.entries).filter((e) =>
u.has(typeof e),
);
return RegExp(
n.length
? `^(${n.map((e) => d(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
);
}));
}),
qe = D(`$ZodNullable`, (e, t) => {
(z.init(e, t),
C(e, `optin`, (e) => e.def.innerType._zod.optin),
C(e, `optout`, (e) => e.def.innerType._zod.optout),
C(e, `pattern`, (e) => {
let t = e.def.innerType._zod.pattern;
return t
? RegExp(`^(${o(t.source)}|null)$`)
: void 0;
}),
C(e, `values`, (e) =>
e.def.innerType._zod.values
? 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)));
});
function U(e) {
return ((e.checks &&= [...e.checks]), e);
}
function Je(e, t) {
return new e(U({ type: `string`, ...p(t) }));
}
function Ye(e, t) {
return new e({
type: `string`,
format: `url`,
check: `string_format`,
abort: !1,
...p(t),
});
}
function Xe(e, t) {
return new e(U({ type: `number`, checks: [], ...p(t) }));
}
function Ze(e, t) {
return new e({ type: `date`, ...p(t) });
}
function W(e, t) {
return new xe({
check: `less_than`,
...p(t),
value: e,
inclusive: !0,
});
}
function G(e, t) {
return new Se({
check: `greater_than`,
...p(t),
value: e,
inclusive: !0,
});
}
function K(e, t) {
return new Ce({
check: `max_length`,
...p(t),
maximum: e,
});
}
function q(e, t) {
return new we({
check: `min_length`,
...p(t),
minimum: e,
});
}
const J = D(
`ZodMiniType`,
(e, t) => {
if (!e._zod)
throw Error(`Uninitialized schema in ZodMiniType.`);
(z.init(e, t), (e.def = t), (e.type = t.type));
},
{
get with() {
return this.check;
},
set with(e) {
b(this, `with`, e);
},
parse(e, t) {
return me(this, e, t, { callee: this.parse });
},
parseAsync(e, t) {
return he(this, e, t, { callee: this.parseAsync });
},
safeParse(e, t) {
return ge(this, e, t);
},
safeParseAsync(e, t) {
return _e(this, e, t);
},
check(...e) {
let t = this.def;
return this.clone(
{
...t,
checks: [
...(t.checks ?? []),
...e.map((e) =>
typeof e == `function`
? {
_zod: {
check: e,
def: { check: `custom` },
onattach: [],
},
}
: e,
),
],
},
{ parent: !0 },
);
},
clone(e, t) {
return f(this, e, t);
},
brand() {
return this;
},
register(e, t) {
return (e.add(this, t), this);
},
apply(e, ...t) {
return t.length === 0 ? e(this) : e(this, ...t);
},
},
),
Y = D(`ZodMiniString`, (e, t) => {
(Ae.init(e, t), J.init(e, t));
});
function X(e) {
return Je(Y, e);
}
const Qe = D(
`ZodMiniStringFormat`,
(e, t) => {
(je.init(e, t), Y.init(e, t));
},
),
$e = D(`ZodMiniURL`, (e, t) => {
(Re.init(e, t), Qe.init(e, t));
});
function et(e) {
return Ye($e, e);
}
const tt = D(`ZodMiniNumber`, (e, t) => {
(ze.init(e, t), J.init(e, t));
});
function Z(e) {
return Xe(tt, e);
}
const nt = D(`ZodMiniDate`, (e, t) => {
(Be.init(e, t), J.init(e, t));
});
function rt(e) {
return Ze(nt, e);
}
const it = D(`ZodMiniArray`, (e, t) => {
(Ve.init(e, t), J.init(e, t));
});
function Q(e, t) {
return new it({ type: `array`, element: e, ...p(t) });
}
const at = D(`ZodMiniObject`, (e, t) => {
(Ge.init(e, t),
J.init(e, t),
le(e, `shape`, (e) => e._zod.def.shape, !1));
});
function $(e, t) {
let n = { type: `object`, shape: e ?? {}, ...p(t) };
return new at(n);
}
const ot = D(`ZodMiniEnum`, (e, t) => {
(Ke.init(e, t),
J.init(e, t),
(e.options = [...e._zod.values]));
});
function st(e, t) {
let n = Array.isArray(e)
? Object.fromEntries(e.map((e) => [e, e]))
: e;
return new ot({ type: `enum`, entries: n, ...p(t) });
}
const ct = D(`ZodMiniNullable`, (e, t) => {
(qe.init(e, t), J.init(e, t));
});
function lt(e) {
return new ct({ type: `nullable`, innerType: e });
}
const ut = $({
id: Z(),
created: rt(),
title: X().check(
q(1),
K(100),
),
type: st([`jpg`, `png`]),
size: Z(),
url: et(),
}),
dt = $({
id: Z(),
stars: Z().check(
G(1),
W(5),
),
title: X().check(
q(1),
K(100),
),
text: X().check(
q(1),
K(1e3),
),
images: Q(ut),
});
e()(
$({
id: Z(),
created: rt(),
title: X().check(
q(1),
K(100),
),
brand: X().check(
q(1),
K(30),
),
description: X().check(
q(1),
K(500),
),
price: Z().check(
G(1),
W(1e4),
),
discount: lt(
Z().check(
G(1),
W(100),
),
),
quantity: Z().check(
G(0),
W(10),
),
tags: Q(
X().check(
q(1),
K(30),
),
),
images: Q(ut),
ratings: Q(dt),
}),
).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 typeof t == `bigint` ? t.toString() : t;
}
var r = 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 i(e) {
return new r(e);
}
function a(e) {
return e == null;
}
function o(e) {
let t = +!!e.startsWith(`^`),
n = e.endsWith(`$`) ? e.length - 1 : e.length;
return e.slice(t, n);
}
function s(e, t, n) {
Object.defineProperty(e, t, {
value: n,
writable: !0,
enumerable: !0,
configurable: !0,
});
}
const c = `captureStackTrace` in Error ? Error.captureStackTrace : (...e) => {};
function l(e) {
return typeof e == `object` && !!e && !Array.isArray(e);
}
const u = new Set([`string`, `number`, `symbol`]);
function d(e) {
return e.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`);
}
function f(e, t, n) {
let r = new e._zod.constr(t ?? e._zod.def);
return ((!t || n?.parent) && (r._zod.parent = e), r);
}
function p(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 ee(e) {
return Object.keys(e).filter(
(t) => e[t]._zod.optin !== void 0 && e[t]._zod.optout === `optional`,
);
}
function m(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 te(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 h(e, t) {
return t.map((t) => {
var n;
return ((n = t).path ?? (n.path = []), t.path.unshift(e), t);
});
}
function g(e) {
return typeof e == `string` ? e : e?.message;
}
function ne(e, t, n) {
var r;
for (let i = t; i < e.length; i++) (r = e[i]).schema ?? (r.schema = n);
}
function _(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
: (g(e.inst?._zod.def?.error?.(e)) ??
g(a?.(e)) ??
g(t?.error?.(e)) ??
g(n.customError?.(e)) ??
g(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 re = /[\uD800-\uDBFF]/;
function v(e) {
let t = e.length;
if (!re.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 y(e) {
return Array.isArray(e)
? `array`
: typeof e == `string`
? `string`
: `unknown`;
}
function ie(e, t) {
for (let n in t) {
let r = Object.getOwnPropertyDescriptor(t, n);
r.get
? Object.defineProperty(e, n, { ...r, enumerable: !1 })
: oe(e, n, r.value);
}
}
function b(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 b(e, t, n, !1);
}
function oe(e, t, n) {
Object.defineProperty(e, t, {
configurable: !0,
get() {
return this == null ? n : b(this, t, n.bind(this));
},
set(e) {
b(this, t, e);
},
});
}
function se(e, t) {
let n = Object.getPrototypeOf(e);
return t in n ? void 0 : n;
}
let x,
S = !1;
const ce = {
configurable: !0,
get() {
S = !0;
},
};
function C(e, t, n) {
let r = Object.getPrototypeOf(e._zod);
if (t in r && x !== e._zod) {
x = void 0;
return;
}
((x = e._zod),
Object.defineProperty(r, t, {
configurable: !0,
get() {
Object.defineProperty(this, t, ce);
let e = S;
S = !1;
try {
let r = n(this);
return (
S
? delete this[t]
: Object.defineProperty(this, t, {
configurable: !0,
writable: !0,
value: r,
}),
(S ||= e),
r
);
} catch (n) {
throw (delete this[t], (S ||= e), n);
}
},
set(e) {
Object.defineProperty(this, t, {
configurable: !0,
writable: !0,
value: e,
});
},
}));
}
function le(e, t, n, r) {
let i = se(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,
});
},
});
}
var w;
const T = { value: void 0, enumerable: !1 };
let E = `captureStackTrace` in Error ? Error : null;
function ue(e) {
let t = E;
if (t) {
let n = t.stackTraceLimit;
if (typeof n == `number`) {
try {
t.stackTraceLimit = 0;
} catch {
return ((E = null), new e());
}
try {
return new e();
} finally {
t.stackTraceLimit = n;
}
}
}
return new e();
}
function D(e, t, n, r) {
let i = {};
function a(e) {
((this.def = e),
(this.constr = d),
(this.traits = new Set()));
}
a.prototype = i;
let o = n,
s = o && new WeakSet();
function c(n, r) {
if (!n._zod) {
T.value = new a(r);
try {
Object.defineProperty(n, "_zod", T);
} finally {
T.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), ie(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 ? ue(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 O = class extends Error {
constructor() {
super(
`Encountered Promise during synchronous parse. Use .parseAsync() instead.`,
);
}
};
(w = globalThis).__zod_globalConfig ?? (w.__zod_globalConfig = {});
const k = globalThis.__zod_globalConfig;
function A(e) {
return (e && Object.assign(k, e), k);
}
function de() {
let e = this._zod;
return ((e.message ??= JSON.stringify(e.def, n, 2)), e.message);
}
function fe(e) {
this._zod.message = e;
}
const pe = { get: de, set: fe, enumerable: !0, configurable: !0 },
j = { value: void 0, enumerable: !1 },
M = new WeakSet([Object.prototype, Error.prototype]),
N = (e, t) => {
((e.name = `$ZodError`),
(j.value = t),
Object.defineProperty(e, "issues", j),
(j.value = void 0),
Object.defineProperty(e, "message", pe));
let n = Object.getPrototypeOf(e);
M.has(n) ||
(M.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,
});
},
}));
};
D(`$ZodError`, N);
const P = D(`$ZodError`, N, void 0, { Parent: Error }),
me = ((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 O();
if (s.issues.length) {
let n = new (a?.Err ?? e)(s.issues.map((e) => _(e, o, A())));
throw (c(n, a?.callee ?? t), n);
}
return s.value;
};
return t;
})(P),
he = ((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) => _(e, o, A())));
throw (c(n, a?.callee ?? t), n);
}
return s.value;
};
return t;
})(P),
ge = ((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 O();
return a.issues.length ? F(e, a.issues, i) : { success: !0, data: a.value };
})(P);
function F(e, t, n) {
let r;
return {
success: !1,
get error() {
return (
r ||
((r = new e(t.map((e) => _(e, n, A())))), (t = void 0), (n = void 0)),
r
);
},
set error(e) {
((r = e), (t = void 0), (n = void 0));
},
};
}
const _e = ((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 ? F(e, a.issues, i) : { success: !0, data: a.value }
);
})(P),
ve = /^https?$/,
ye = /^[\s\S]{0,}$/,
be = /^-?\d+(?:\.\d+)?$/,
I = D(`$ZodCheck`, (e, t) => {
var n;
((e._zod ??= {}),
(e._zod.def = t),
(n = e._zod).onattach ?? (n.onattach = []));
}),
L = (e) => {
let t = e.value;
return !a(t) && t.length !== void 0;
},
R = { number: `number`, bigint: `bigint`, object: `date` },
xe = D(`$ZodCheckLessThan`, (e, t) => {
I.init(e, t);
let n = R[typeof t.value];
e._zod.check = (r) => {
(t.inclusive ? r.value <= t.value : r.value < t.value) ||
r.issues.push({
origin: R[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,
});
};
}),
Se = D(`$ZodCheckGreaterThan`, (e, t) => {
I.init(e, t);
let n = R[typeof t.value];
e._zod.check = (r) => {
(t.inclusive ? r.value >= t.value : r.value > t.value) ||
r.issues.push({
origin: R[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,
});
};
}),
Ce = D(`$ZodCheckMaxLength`, (e, t) => {
var n;
(I.init(e, t),
(n = e._zod.def).when ?? (n.when = L),
(e._zod.check = (n) => {
let r = n.value,
i = r.length;
if ((typeof r == `string` && i > t.maximum ? v(r) : i) <= t.maximum)
return;
let a = y(r);
n.issues.push({
origin: a,
code: `too_big`,
maximum: t.maximum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort,
});
}));
}),
we = D(`$ZodCheckMinLength`, (e, t) => {
var n;
(I.init(e, t),
(n = e._zod.def).when ?? (n.when = L),
(e._zod.check = (n) => {
let r = n.value,
i = r.length;
if (
(typeof r == `string` && i >= t.minimum && i < t.minimum * 2
? v(r)
: i) >= t.minimum
)
return;
let a = y(r);
n.issues.push({
origin: a,
code: `too_small`,
minimum: t.minimum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort,
});
}));
}),
Te = D(`$ZodCheckStringFormat`, (e, t) => {
var n, r;
(I.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 = () => {})));
}),
Ee = { major: 4, minor: 6, patch: 5 },
z = D(
`$ZodType`,
(e, t) => {
var n;
((e ??= {}),
(e._zod.def = t),
(e._zod.bag = e._zod.bag || {}),
(e._zod.version = Ee));
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 = m(t),
a;
for (let o of n) {
if (o._zod.def.when) {
if (te(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 O();
if (a || s instanceof Promise)
a = (a ?? Promise.resolve()).then(async () => {
(await s,
t.issues.length !== n &&
(ne(t.issues, n, e), (i ||= m(t, n))));
});
else {
if (t.issues.length === n) continue;
(ne(t.issues, n, e), (i ||= m(t, n)));
}
}
return a ? a.then(() => t) : t;
},
n = (n, r, a) => {
if (m(n)) return ((n.aborted = !0), n);
let o = t(r, i, a);
if (o instanceof Promise) {
if (a.async === !1) throw new O();
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 O();
return o.then((e) => t(e, i, a));
}
return t(o, i, a);
};
}
},
{
get "~standard"() {
return ae(this, `~standard`, ke(this));
},
set "~standard"(e) {
b(this, `~standard`, e);
},
},
),
De = (e, t) =>
e.issues.length
? { issues: e.issues.map((e) => _(e, t, A())) }
: { value: e.value };
async function Oe(e, t) {
let n = { async: !0 };
return De(await e._zod.run({ value: t, issues: [] }, n), n);
}
function ke(e) {
return {
validate: (t) => {
let n = { async: !1 };
try {
let r = e._zod.run({ value: t, issues: [] }, n);
if (!(r instanceof Promise)) return De(r, n);
} catch {}
return Oe(e, t);
},
vendor: `zod`,
version: 1,
};
}
const Ae = D(`$ZodString`, (e, t) => {
(z.init(e, t),
(e._zod.pattern = t.pattern ?? ye),
(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
);
}));
}),
je = D(`$ZodStringFormat`, (e, t) => {
(Te.init(e, t), Ae.init(e, t));
});
function Me(e) {
try {
return typeof URL < `u` && typeof URL.canParse == `function`
? URL.canParse(e)
: (new URL(e), !0);
} catch {
return !1;
}
}
function Ne(e, t) {
return !(`normalize` in t) && !(`hostname` in t) && !(`protocol` in t)
? Me(e) || 2
: Pe(e, t);
}
function Pe(e, t) {
if (
!t.normalize &&
t.protocol?.source === ve.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 Fe = /[\t\n\r]/g;
function B(e) {
return e.replace(Fe, ``);
}
function Ie(e, t) {
return ((t.lastIndex = 0), t.test(e.hostname));
}
function Le(e, t) {
return (
(t.lastIndex = 0),
t.test(e.protocol.endsWith(`:`) ? e.protocol.slice(0, -1) : e.protocol)
);
}
const Re = D(`$ZodURL`, (e, t) => {
(je.init(e, t),
(e._zod.check = (n) => {
try {
let r = n.value.trim(),
i = Ne(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 = B(r);
return;
}
(t.hostname &&
!Ie(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 &&
!Le(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 : B(r)));
return;
} catch {
n.issues.push({
code: `invalid_format`,
format: `url`,
input: n.value,
inst: e,
continue: !t.abort,
});
}
}));
}),
ze = D(`$ZodNumber`, (e, t) => {
(z.init(e, t),
(e._zod.pattern = be),
(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
);
}));
}),
Be = D(`$ZodDate`, (e, t) => {
(z.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 V(e, t, n) {
(e.issues.length && t.issues.push(...h(n, e.issues)), (t.value[n] = e.value));
}
const Ve = D(`$ZodArray`, (e, t) => {
z.init(e, t);
let n = k.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) => V(t, r, e)));
else if ((V(c, r, e), s && c.issues.length !== 0 && m(c))) break;
}
return o.length ? Promise.all(o).then(() => r) : r;
}));
});
function H(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(...h(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 He = [];
function Ue(e) {
let t = Object.keys(e.shape),
n = Object.getOwnPropertySymbols(e.shape),
r = n.length ? n : He,
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 = ee(e.shape);
return {
...e,
allKeys: i,
symbolKeys: r,
keySet: new Set(t),
numKeys: t.length,
optionalKeys: new Set(a),
};
}
function We(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 (m(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) => H(e, n, i, t, d, f)))
: H(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 Ge = D(`$ZodObject`, (e, t) => {
z.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 a = i(() => Ue(t));
C(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) ||
s(n, e, 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 = l,
c = t.catchall,
u,
d = k.memoizer;
(d?.attach(e),
(e._zod.parse = (t, n) => {
u ??= a.value;
let r = t.value;
if (!o(r))
return (
t.issues.push({
expected: `object`,
code: `invalid_type`,
input: r,
inst: e,
}),
t
);
t.value = d ? d.alloc(e, t, {}, n) : {};
let i = [],
s = u.shape,
l = n?.abortEarly,
f = t.issues.length;
for (let e of u.allKeys) {
if (l && t.issues.length !== f) {
if (m(t, f)) break;
f = t.issues.length;
}
if (e === `__proto__`) continue;
let a = s[e],
o = a._zod.optin,
c = a._zod.optout,
u = a._zod.run({ value: r[e], issues: [] }, n);
u instanceof Promise
? i.push(u.then((n) => H(n, t, e, r, o, c)))
: H(u, t, e, r, o, c);
}
return c
? We(i, r, t, n, a.value, e, l === !0)
: i.length
? Promise.all(i).then(() => t)
: t;
}));
}),
Ke = D(`$ZodEnum`, (e, n) => {
z.init(e, n);
let r = t(n.entries),
i = new Set(r);
((e._zod.values = i),
C(e, `pattern`, (e) => {
let n = t(e.def.entries).filter((e) => u.has(typeof e));
return RegExp(
n.length
? `^(${n.map((e) => d(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
);
}));
}),
qe = D(`$ZodNullable`, (e, t) => {
(z.init(e, t),
C(e, `optin`, (e) => e.def.innerType._zod.optin),
C(e, `optout`, (e) => e.def.innerType._zod.optout),
C(e, `pattern`, (e) => {
let t = e.def.innerType._zod.pattern;
return t ? RegExp(`^(${o(t.source)}|null)$`) : void 0;
}),
C(e, `values`, (e) =>
e.def.innerType._zod.values
? 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)));
});
function U(e) {
return ((e.checks &&= [...e.checks]), e);
}
function Je(e, t) {
return new e(U({ type: `string`, ...p(t) }));
}
function Ye(e, t) {
return new e({
type: `string`,
format: `url`,
check: `string_format`,
abort: !1,
...p(t),
});
}
function Xe(e, t) {
return new e(U({ type: `number`, checks: [], ...p(t) }));
}
function Ze(e, t) {
return new e({ type: `date`, ...p(t) });
}
function W(e, t) {
return new xe({ check: `less_than`, ...p(t), value: e, inclusive: !0 });
}
function G(e, t) {
return new Se({ check: `greater_than`, ...p(t), value: e, inclusive: !0 });
}
function K(e, t) {
return new Ce({ check: `max_length`, ...p(t), maximum: e });
}
function q(e, t) {
return new we({ check: `min_length`, ...p(t), minimum: e });
}
const J = D(
`ZodMiniType`,
(e, t) => {
if (!e._zod) throw Error(`Uninitialized schema in ZodMiniType.`);
(z.init(e, t), (e.def = t), (e.type = t.type));
},
{
get with() {
return this.check;
},
set with(e) {
b(this, `with`, e);
},
parse(e, t) {
return me(this, e, t, { callee: this.parse });
},
parseAsync(e, t) {
return he(this, e, t, { callee: this.parseAsync });
},
safeParse(e, t) {
return ge(this, e, t);
},
safeParseAsync(e, t) {
return _e(this, e, t);
},
check(...e) {
let t = this.def;
return this.clone(
{
...t,
checks: [
...(t.checks ?? []),
...e.map((e) =>
typeof e == `function`
? {
_zod: {
check: e,
def: { check: `custom` },
onattach: [],
},
}
: e,
),
],
},
{ parent: !0 },
);
},
clone(e, t) {
return f(this, e, t);
},
brand() {
return this;
},
register(e, t) {
return (e.add(this, t), this);
},
apply(e, ...t) {
return t.length === 0 ? e(this) : e(this, ...t);
},
},
),
Y = D(`ZodMiniString`, (e, t) => {
(Ae.init(e, t), J.init(e, t));
});
function X(e) {
return Je(Y, e);
}
const Qe = D(`ZodMiniStringFormat`, (e, t) => {
(je.init(e, t), Y.init(e, t));
}),
$e = D(`ZodMiniURL`, (e, t) => {
(Re.init(e, t), Qe.init(e, t));
});
function et(e) {
return Ye($e, e);
}
const tt = D(`ZodMiniNumber`, (e, t) => {
(ze.init(e, t), J.init(e, t));
});
function Z(e) {
return Xe(tt, e);
}
const nt = D(`ZodMiniDate`, (e, t) => {
(Be.init(e, t), J.init(e, t));
});
function rt(e) {
return Ze(nt, e);
}
const it = D(`ZodMiniArray`, (e, t) => {
(Ve.init(e, t), J.init(e, t));
});
function Q(e, t) {
return new it({ type: `array`, element: e, ...p(t) });
}
const at = D(`ZodMiniObject`, (e, t) => {
(Ge.init(e, t), J.init(e, t), le(e, `shape`, (e) => e._zod.def.shape, !1));
});
function $(e, t) {
let n = { type: `object`, shape: e ?? {}, ...p(t) };
return new at(n);
}
const ot = D(`ZodMiniEnum`, (e, t) => {
(Ke.init(e, t), J.init(e, t), (e.options = [...e._zod.values]));
});
function st(e, t) {
let n = Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e;
return new ot({ type: `enum`, entries: n, ...p(t) });
}
const ct = D(`ZodMiniNullable`, (e, t) => {
(qe.init(e, t), J.init(e, t));
});
function lt(e) {
return new ct({ type: `nullable`, innerType: e });
}
const ut = $({
id: Z(),
created: rt(),
title: X().check(
q(1),
K(100),
),
type: st([`jpg`, `png`]),
size: Z(),
url: et(),
}),
dt = $({
id: Z(),
stars: Z().check(
G(1),
W(5),
),
title: X().check(
q(1),
K(100),
),
text: X().check(
q(1),
K(1e3),
),
images: Q(ut),
});
e()(
$({
id: Z(),
created: rt(),
title: X().check(
q(1),
K(100),
),
brand: X().check(
q(1),
K(30),
),
description: X().check(
q(1),
K(500),
),
price: Z().check(
G(1),
W(1e4),
),
discount: lt(
Z().check( G(1), W(100)),
),
quantity: Z().check(
G(0),
W(10),
),
tags: Q(
X().check( q(1), K(30)),
),
images: Q(ut),
ratings: Q(dt),
}),
).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 typeof t == `bigint` ? t.toString() : t;
}
var r = 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 i(e) {
return new r(e);
}
function a(e) {
return e == null;
}
function o(e) {
let t = +!!e.startsWith(`^`),
n = e.endsWith(`$`) ? e.length - 1 : e.length;
return e.slice(t, n);
}
function s(e, t, n) {
Object.defineProperty(e, t, { value: n, writable: !0, enumerable: !0, configurable: !0 });
}
const c = `captureStackTrace` in Error ? Error.captureStackTrace : (...e) => {};
function l(e) {
return typeof e == `object` && !!e && !Array.isArray(e);
}
const u = new Set([`string`, `number`, `symbol`]);
function d(e) {
return e.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`);
}
function f(e, t, n) {
let r = new e._zod.constr(t ?? e._zod.def);
return ((!t || n?.parent) && (r._zod.parent = e), r);
}
function p(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 ee(e) {
return Object.keys(e).filter(
(t) => e[t]._zod.optin !== void 0 && e[t]._zod.optout === `optional`,
);
}
function m(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 te(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 h(e, t) {
return t.map((t) => {
var n;
return ((n = t).path ?? (n.path = []), t.path.unshift(e), t);
});
}
function g(e) {
return typeof e == `string` ? e : e?.message;
}
function ne(e, t, n) {
var r;
for (let i = t; i < e.length; i++) (r = e[i]).schema ?? (r.schema = n);
}
function _(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
: (g(e.inst?._zod.def?.error?.(e)) ??
g(a?.(e)) ??
g(t?.error?.(e)) ??
g(n.customError?.(e)) ??
g(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 re = /[\uD800-\uDBFF]/;
function v(e) {
let t = e.length;
if (!re.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 y(e) {
return Array.isArray(e) ? `array` : typeof e == `string` ? `string` : `unknown`;
}
function ie(e, t) {
for (let n in t) {
let r = Object.getOwnPropertyDescriptor(t, n);
r.get ? Object.defineProperty(e, n, { ...r, enumerable: !1 }) : oe(e, n, r.value);
}
}
function b(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 b(e, t, n, !1);
}
function oe(e, t, n) {
Object.defineProperty(e, t, {
configurable: !0,
get() {
return this == null ? n : b(this, t, n.bind(this));
},
set(e) {
b(this, t, e);
},
});
}
function se(e, t) {
let n = Object.getPrototypeOf(e);
return t in n ? void 0 : n;
}
let x,
S = !1;
const ce = {
configurable: !0,
get() {
S = !0;
},
};
function C(e, t, n) {
let r = Object.getPrototypeOf(e._zod);
if (t in r && x !== e._zod) {
x = void 0;
return;
}
((x = e._zod),
Object.defineProperty(r, t, {
configurable: !0,
get() {
Object.defineProperty(this, t, ce);
let e = S;
S = !1;
try {
let r = n(this);
return (
S
? delete this[t]
: Object.defineProperty(this, t, { configurable: !0, writable: !0, value: r }),
(S ||= e),
r
);
} catch (n) {
throw (delete this[t], (S ||= e), n);
}
},
set(e) {
Object.defineProperty(this, t, { configurable: !0, writable: !0, value: e });
},
}));
}
function le(e, t, n, r) {
let i = se(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 });
},
});
}
var w;
const T = { value: void 0, enumerable: !1 };
let E = `captureStackTrace` in Error ? Error : null;
function ue(e) {
let t = E;
if (t) {
let n = t.stackTraceLimit;
if (typeof n == `number`) {
try {
t.stackTraceLimit = 0;
} catch {
return ((E = null), new e());
}
try {
return new e();
} finally {
t.stackTraceLimit = n;
}
}
}
return new e();
}
function D(e, t, n, r) {
let i = {};
function a(e) {
((this.def = e), (this.constr = d), (this.traits = new Set()));
}
a.prototype = i;
let o = n,
s = o && new WeakSet();
function c(n, r) {
if (!n._zod) {
T.value = new a(r);
try {
Object.defineProperty(n, "_zod", T);
} finally {
T.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), ie(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 ? ue(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 O = class extends Error {
constructor() {
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
}
};
(w = globalThis).__zod_globalConfig ?? (w.__zod_globalConfig = {});
const k = globalThis.__zod_globalConfig;
function A(e) {
return (e && Object.assign(k, e), k);
}
function de() {
let e = this._zod;
return ((e.message ??= JSON.stringify(e.def, n, 2)), e.message);
}
function fe(e) {
this._zod.message = e;
}
const pe = { get: de, set: fe, enumerable: !0, configurable: !0 },
j = { value: void 0, enumerable: !1 },
M = new WeakSet([Object.prototype, Error.prototype]),
N = (e, t) => {
((e.name = `$ZodError`),
(j.value = t),
Object.defineProperty(e, "issues", j),
(j.value = void 0),
Object.defineProperty(e, "message", pe));
let n = Object.getPrototypeOf(e);
M.has(n) ||
(M.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 });
},
}));
};
D(`$ZodError`, N);
const P = D(`$ZodError`, N, void 0, { Parent: Error }),
me = ((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 O();
if (s.issues.length) {
let n = new (a?.Err ?? e)(s.issues.map((e) => _(e, o, A())));
throw (c(n, a?.callee ?? t), n);
}
return s.value;
};
return t;
})(P),
he = ((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) => _(e, o, A())));
throw (c(n, a?.callee ?? t), n);
}
return s.value;
};
return t;
})(P),
ge = ((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 O();
return a.issues.length ? F(e, a.issues, i) : { success: !0, data: a.value };
})(P);
function F(e, t, n) {
let r;
return {
success: !1,
get error() {
return (r || ((r = new e(t.map((e) => _(e, n, A())))), (t = void 0), (n = void 0)), r);
},
set error(e) {
((r = e), (t = void 0), (n = void 0));
},
};
}
const _e = ((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 ? F(e, a.issues, i) : { success: !0, data: a.value }
);
})(P),
ve = /^https?$/,
ye = /^[\s\S]{0,}$/,
be = /^-?\d+(?:\.\d+)?$/,
I = D(`$ZodCheck`, (e, t) => {
var n;
((e._zod ??= {}), (e._zod.def = t), (n = e._zod).onattach ?? (n.onattach = []));
}),
L = (e) => {
let t = e.value;
return !a(t) && t.length !== void 0;
},
R = { number: `number`, bigint: `bigint`, object: `date` },
xe = D(`$ZodCheckLessThan`, (e, t) => {
I.init(e, t);
let n = R[typeof t.value];
e._zod.check = (r) => {
(t.inclusive ? r.value <= t.value : r.value < t.value) ||
r.issues.push({
origin: R[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,
});
};
}),
Se = D(`$ZodCheckGreaterThan`, (e, t) => {
I.init(e, t);
let n = R[typeof t.value];
e._zod.check = (r) => {
(t.inclusive ? r.value >= t.value : r.value > t.value) ||
r.issues.push({
origin: R[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,
});
};
}),
Ce = D(`$ZodCheckMaxLength`, (e, t) => {
var n;
(I.init(e, t),
(n = e._zod.def).when ?? (n.when = L),
(e._zod.check = (n) => {
let r = n.value,
i = r.length;
if ((typeof r == `string` && i > t.maximum ? v(r) : i) <= t.maximum) return;
let a = y(r);
n.issues.push({
origin: a,
code: `too_big`,
maximum: t.maximum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort,
});
}));
}),
we = D(`$ZodCheckMinLength`, (e, t) => {
var n;
(I.init(e, t),
(n = e._zod.def).when ?? (n.when = L),
(e._zod.check = (n) => {
let r = n.value,
i = r.length;
if ((typeof r == `string` && i >= t.minimum && i < t.minimum * 2 ? v(r) : i) >= t.minimum)
return;
let a = y(r);
n.issues.push({
origin: a,
code: `too_small`,
minimum: t.minimum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort,
});
}));
}),
Te = D(`$ZodCheckStringFormat`, (e, t) => {
var n, r;
(I.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 = () => {})));
}),
Ee = { major: 4, minor: 6, patch: 5 },
z = D(
`$ZodType`,
(e, t) => {
var n;
((e ??= {}), (e._zod.def = t), (e._zod.bag = e._zod.bag || {}), (e._zod.version = Ee));
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 = m(t),
a;
for (let o of n) {
if (o._zod.def.when) {
if (te(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 O();
if (a || s instanceof Promise)
a = (a ?? Promise.resolve()).then(async () => {
(await s, t.issues.length !== n && (ne(t.issues, n, e), (i ||= m(t, n))));
});
else {
if (t.issues.length === n) continue;
(ne(t.issues, n, e), (i ||= m(t, n)));
}
}
return a ? a.then(() => t) : t;
},
n = (n, r, a) => {
if (m(n)) return ((n.aborted = !0), n);
let o = t(r, i, a);
if (o instanceof Promise) {
if (a.async === !1) throw new O();
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 O();
return o.then((e) => t(e, i, a));
}
return t(o, i, a);
};
}
},
{
get "~standard"() {
return ae(this, `~standard`, ke(this));
},
set "~standard"(e) {
b(this, `~standard`, e);
},
},
),
De = (e, t) =>
e.issues.length ? { issues: e.issues.map((e) => _(e, t, A())) } : { value: e.value };
async function Oe(e, t) {
let n = { async: !0 };
return De(await e._zod.run({ value: t, issues: [] }, n), n);
}
function ke(e) {
return {
validate: (t) => {
let n = { async: !1 };
try {
let r = e._zod.run({ value: t, issues: [] }, n);
if (!(r instanceof Promise)) return De(r, n);
} catch {}
return Oe(e, t);
},
vendor: `zod`,
version: 1,
};
}
const Ae = D(`$ZodString`, (e, t) => {
(z.init(e, t),
(e._zod.pattern = t.pattern ?? ye),
(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
);
}));
}),
je = D(`$ZodStringFormat`, (e, t) => {
(Te.init(e, t), Ae.init(e, t));
});
function Me(e) {
try {
return typeof URL < `u` && typeof URL.canParse == `function`
? URL.canParse(e)
: (new URL(e), !0);
} catch {
return !1;
}
}
function Ne(e, t) {
return !(`normalize` in t) && !(`hostname` in t) && !(`protocol` in t) ? Me(e) || 2 : Pe(e, t);
}
function Pe(e, t) {
if (!t.normalize && t.protocol?.source === ve.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 Fe = /[\t\n\r]/g;
function B(e) {
return e.replace(Fe, ``);
}
function Ie(e, t) {
return ((t.lastIndex = 0), t.test(e.hostname));
}
function Le(e, t) {
return (
(t.lastIndex = 0), t.test(e.protocol.endsWith(`:`) ? e.protocol.slice(0, -1) : e.protocol)
);
}
const Re = D(`$ZodURL`, (e, t) => {
(je.init(e, t),
(e._zod.check = (n) => {
try {
let r = n.value.trim(),
i = Ne(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 = B(r);
return;
}
(t.hostname &&
!Ie(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 &&
!Le(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 : B(r)));
return;
} catch {
n.issues.push({
code: `invalid_format`,
format: `url`,
input: n.value,
inst: e,
continue: !t.abort,
});
}
}));
}),
ze = D(`$ZodNumber`, (e, t) => {
(z.init(e, t),
(e._zod.pattern = be),
(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
);
}));
}),
Be = D(`$ZodDate`, (e, t) => {
(z.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 V(e, t, n) {
(e.issues.length && t.issues.push(...h(n, e.issues)), (t.value[n] = e.value));
}
const Ve = D(`$ZodArray`, (e, t) => {
z.init(e, t);
let n = k.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) => V(t, r, e)));
else if ((V(c, r, e), s && c.issues.length !== 0 && m(c))) break;
}
return o.length ? Promise.all(o).then(() => r) : r;
}));
});
function H(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(...h(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 He = [];
function Ue(e) {
let t = Object.keys(e.shape),
n = Object.getOwnPropertySymbols(e.shape),
r = n.length ? n : He,
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 = ee(e.shape);
return {
...e,
allKeys: i,
symbolKeys: r,
keySet: new Set(t),
numKeys: t.length,
optionalKeys: new Set(a),
};
}
function We(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 (m(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) => H(e, n, i, t, d, f))) : H(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 Ge = D(`$ZodObject`, (e, t) => {
z.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 a = i(() => Ue(t));
C(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) || s(n, e, 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 = l,
c = t.catchall,
u,
d = k.memoizer;
(d?.attach(e),
(e._zod.parse = (t, n) => {
u ??= a.value;
let r = t.value;
if (!o(r))
return (
t.issues.push({ expected: `object`, code: `invalid_type`, input: r, inst: e }), t
);
t.value = d ? d.alloc(e, t, {}, n) : {};
let i = [],
s = u.shape,
l = n?.abortEarly,
f = t.issues.length;
for (let e of u.allKeys) {
if (l && t.issues.length !== f) {
if (m(t, f)) break;
f = t.issues.length;
}
if (e === `__proto__`) continue;
let a = s[e],
o = a._zod.optin,
c = a._zod.optout,
u = a._zod.run({ value: r[e], issues: [] }, n);
u instanceof Promise ? i.push(u.then((n) => H(n, t, e, r, o, c))) : H(u, t, e, r, o, c);
}
return c
? We(i, r, t, n, a.value, e, l === !0)
: i.length
? Promise.all(i).then(() => t)
: t;
}));
}),
Ke = D(`$ZodEnum`, (e, n) => {
z.init(e, n);
let r = t(n.entries),
i = new Set(r);
((e._zod.values = i),
C(e, `pattern`, (e) => {
let n = t(e.def.entries).filter((e) => u.has(typeof e));
return RegExp(n.length ? `^(${n.map((e) => d(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
);
}));
}),
qe = D(`$ZodNullable`, (e, t) => {
(z.init(e, t),
C(e, `optin`, (e) => e.def.innerType._zod.optin),
C(e, `optout`, (e) => e.def.innerType._zod.optout),
C(e, `pattern`, (e) => {
let t = e.def.innerType._zod.pattern;
return t ? RegExp(`^(${o(t.source)}|null)$`) : void 0;
}),
C(e, `values`, (e) =>
e.def.innerType._zod.values
? 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))));
});
function U(e) {
return ((e.checks &&= [...e.checks]), e);
}
function Je(e, t) {
return new e(U({ type: `string`, ...p(t) }));
}
function Ye(e, t) {
return new e({ type: `string`, format: `url`, check: `string_format`, abort: !1, ...p(t) });
}
function Xe(e, t) {
return new e(U({ type: `number`, checks: [], ...p(t) }));
}
function Ze(e, t) {
return new e({ type: `date`, ...p(t) });
}
function W(e, t) {
return new xe({ check: `less_than`, ...p(t), value: e, inclusive: !0 });
}
function G(e, t) {
return new Se({ check: `greater_than`, ...p(t), value: e, inclusive: !0 });
}
function K(e, t) {
return new Ce({ check: `max_length`, ...p(t), maximum: e });
}
function q(e, t) {
return new we({ check: `min_length`, ...p(t), minimum: e });
}
const J = D(
`ZodMiniType`,
(e, t) => {
if (!e._zod) throw Error(`Uninitialized schema in ZodMiniType.`);
(z.init(e, t), (e.def = t), (e.type = t.type));
},
{
get with() {
return this.check;
},
set with(e) {
b(this, `with`, e);
},
parse(e, t) {
return me(this, e, t, { callee: this.parse });
},
parseAsync(e, t) {
return he(this, e, t, { callee: this.parseAsync });
},
safeParse(e, t) {
return ge(this, e, t);
},
safeParseAsync(e, t) {
return _e(this, e, t);
},
check(...e) {
let t = this.def;
return this.clone(
{
...t,
checks: [
...(t.checks ?? []),
...e.map((e) =>
typeof e == `function`
? { _zod: { check: e, def: { check: `custom` }, onattach: [] } }
: e,
),
],
},
{ parent: !0 },
);
},
clone(e, t) {
return f(this, e, t);
},
brand() {
return this;
},
register(e, t) {
return (e.add(this, t), this);
},
apply(e, ...t) {
return t.length === 0 ? e(this) : e(this, ...t);
},
},
),
Y = D(`ZodMiniString`, (e, t) => {
(Ae.init(e, t), J.init(e, t));
});
function X(e) {
return Je(Y, e);
}
const Qe = D(`ZodMiniStringFormat`, (e, t) => {
(je.init(e, t), Y.init(e, t));
}),
$e = D(`ZodMiniURL`, (e, t) => {
(Re.init(e, t), Qe.init(e, t));
});
function et(e) {
return Ye($e, e);
}
const tt = D(`ZodMiniNumber`, (e, t) => {
(ze.init(e, t), J.init(e, t));
});
function Z(e) {
return Xe(tt, e);
}
const nt = D(`ZodMiniDate`, (e, t) => {
(Be.init(e, t), J.init(e, t));
});
function rt(e) {
return Ze(nt, e);
}
const it = D(`ZodMiniArray`, (e, t) => {
(Ve.init(e, t), J.init(e, t));
});
function Q(e, t) {
return new it({ type: `array`, element: e, ...p(t) });
}
const at = D(`ZodMiniObject`, (e, t) => {
(Ge.init(e, t), J.init(e, t), le(e, `shape`, (e) => e._zod.def.shape, !1));
});
function $(e, t) {
let n = { type: `object`, shape: e ?? {}, ...p(t) };
return new at(n);
}
const ot = D(`ZodMiniEnum`, (e, t) => {
(Ke.init(e, t), J.init(e, t), (e.options = [...e._zod.values]));
});
function st(e, t) {
let n = Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e;
return new ot({ type: `enum`, entries: n, ...p(t) });
}
const ct = D(`ZodMiniNullable`, (e, t) => {
(qe.init(e, t), J.init(e, t));
});
function lt(e) {
return new ct({ type: `nullable`, innerType: e });
}
const ut = $({
id: Z(),
created: rt(),
title: X().check( q(1), K(100)),
type: st([`jpg`, `png`]),
size: Z(),
url: et(),
}),
dt = $({
id: Z(),
stars: Z().check( G(1), W(5)),
title: X().check( q(1), K(100)),
text: X().check( q(1), K(1e3)),
images: Q(ut),
});
e()(
$({
id: Z(),
created: rt(),
title: X().check( q(1), K(100)),
brand: X().check( q(1), K(30)),
description: X().check( q(1), K(500)),
price: Z().check( G(1), W(1e4)),
discount: lt(
Z().check( G(1), W(100)),
),
quantity: Z().check( G(0), W(10)),
tags: Q( X().check( q(1), K(30))),
images: Q(ut),
ratings: Q(dt),
}),
).parse({});