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