wn-ts-node
Version:
Wordnet interface library - TypeScript port
1,518 lines (1,517 loc) • 106 kB
JavaScript
import { parse as Ne } from "smol-toml";
class Es {
hooks = /* @__PURE__ */ new Map();
pluginDependencies = /* @__PURE__ */ new Map();
pluginPriorities = /* @__PURE__ */ new Map();
constructor() {
[
"kernel:init",
"lexicon:loaded",
"lexicon:updated",
"data:loaded",
"data:updated",
"plugin:added",
"plugin:removed",
"schema:changed"
].forEach((n) => {
this.hooks.set(n, []);
});
}
/**
* Register a plugin's lifecycle hooks
*/
registerPlugin(t) {
const n = t.name, o = t.priority ?? 100;
this.pluginPriorities.set(n, o), t.dependencies && this.pluginDependencies.set(n, t.dependencies), Object.entries(t.hooks).forEach(([r, i]) => {
if (i) {
const s = r, a = this.hooks.get(s) || [];
a.push({
plugin: n,
hook: i,
priority: o
}), a.sort((l, d) => l.priority - d.priority), this.hooks.set(s, a);
}
});
}
/**
* Unregister a plugin's lifecycle hooks
*/
unregisterPlugin(t) {
this.pluginPriorities.delete(t), this.pluginDependencies.delete(t), this.hooks.forEach((n, o) => {
const r = n.filter((i) => i.plugin !== t);
this.hooks.set(o, r);
});
}
/**
* Emit a lifecycle event and run all registered hooks in priority order
*/
async emit(t, n, o) {
const r = this.hooks.get(t) || [], i = await this.validateDependencies(r, t);
for (const { plugin: s, hook: a } of i)
try {
await a(t, n, o), console.log(`✅ Lifecycle hook executed: ${s} -> ${t}`);
} catch (l) {
console.error(`❌ Lifecycle hook failed: ${s} -> ${t}`, l);
}
}
/**
* Validate that plugin dependencies are satisfied
*/
async validateDependencies(t, n) {
const o = [];
for (const { plugin: r, hook: i, priority: s } of t) {
const a = this.pluginDependencies.get(r) || [];
a.every((d) => Array.from(this.hooks.values()).some((m) => m.some((g) => g.plugin === d))) ? o.push({ plugin: r, hook: i, priority: s }) : console.warn(`⚠️ Skipping ${r} -> ${n}: dependencies not satisfied: ${a.join(", ")}`);
}
return o;
}
/**
* Get all registered plugins
*/
getRegisteredPlugins() {
return Array.from(this.pluginPriorities.keys());
}
/**
* Get hooks for a specific event
*/
getHooksForEvent(t) {
return (this.hooks.get(t) || []).map(({ plugin: o, priority: r }) => ({ plugin: o, priority: r }));
}
}
function Ie(e, t, n = {}) {
return {
name: e,
hooks: t,
dependencies: n.dependencies || [],
priority: n.priority || 0
};
}
// @__NO_SIDE_EFFECTS__
function c(e, t, n) {
function o(a, l) {
var d;
Object.defineProperty(a, "_zod", {
value: a._zod ?? {},
enumerable: !1
}), (d = a._zod).traits ?? (d.traits = /* @__PURE__ */ new Set()), a._zod.traits.add(e), t(a, l);
for (const f in s.prototype)
f in a || Object.defineProperty(a, f, { value: s.prototype[f].bind(a) });
a._zod.constr = s, a._zod.def = l;
}
const r = n?.Parent ?? Object;
class i extends r {
}
Object.defineProperty(i, "name", { value: e });
function s(a) {
var l;
const d = n?.Parent ? new i() : this;
o(d, a), (l = d._zod).deferred ?? (l.deferred = []);
for (const f of d._zod.deferred)
f();
return d;
}
return Object.defineProperty(s, "init", { value: o }), Object.defineProperty(s, Symbol.hasInstance, {
value: (a) => n?.Parent && a instanceof n.Parent ? !0 : a?._zod?.traits?.has(e)
}), Object.defineProperty(s, "name", { value: e }), s;
}
class q extends Error {
constructor() {
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
}
}
const at = {};
function C(e) {
return at;
}
function Mt(e) {
const t = Object.values(e).filter((o) => typeof o == "number");
return Object.entries(e).filter(([o, r]) => t.indexOf(+o) === -1).map(([o, r]) => r);
}
function we(e, t) {
return typeof t == "bigint" ? t.toString() : t;
}
function ct(e) {
return {
get value() {
{
const t = e();
return Object.defineProperty(this, "value", { value: t }), t;
}
}
};
}
function Se(e) {
return e == null;
}
function Pe(e) {
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
return e.slice(t, n);
}
function Wt(e, t) {
const n = (e.toString().split(".")[1] || "").length, o = t.toString();
let r = (o.split(".")[1] || "").length;
if (r === 0 && /\d?e-\d?/.test(o)) {
const l = o.match(/\d?e-(\d?)/);
l?.[1] && (r = Number.parseInt(l[1]));
}
const i = n > r ? n : r, s = Number.parseInt(e.toFixed(i).replace(".", "")), a = Number.parseInt(t.toFixed(i).replace(".", ""));
return s % a / 10 ** i;
}
const Te = Symbol("evaluating");
function y(e, t, n) {
let o;
Object.defineProperty(e, t, {
get() {
if (o !== Te)
return o === void 0 && (o = Te, o = n()), o;
},
set(r) {
Object.defineProperty(e, t, {
value: r
// configurable: true,
});
},
configurable: !0
});
}
function Bt(e) {
return Object.create(Object.getPrototypeOf(e), Object.getOwnPropertyDescriptors(e));
}
function T(e, t, n) {
Object.defineProperty(e, t, {
value: n,
writable: !0,
enumerable: !0,
configurable: !0
});
}
function U(...e) {
const t = {};
for (const n of e) {
const o = Object.getOwnPropertyDescriptors(n);
Object.assign(t, o);
}
return Object.defineProperties({}, t);
}
function Oe(e) {
return JSON.stringify(e);
}
const ut = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
};
function be(e) {
return typeof e == "object" && e !== null && !Array.isArray(e);
}
const Vt = ct(() => {
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
return !1;
try {
const e = Function;
return new e(""), !0;
} catch {
return !1;
}
});
function G(e) {
if (be(e) === !1)
return !1;
const t = e.constructor;
if (t === void 0)
return !0;
const n = t.prototype;
return !(be(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
}
function lt(e) {
return G(e) ? { ...e } : e;
}
const Jt = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
function le(e) {
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function O(e, t, n) {
const o = new e._zod.constr(t ?? e._zod.def);
return (!t || n?.parent) && (o._zod.parent = e), o;
}
function p(e) {
const t = e;
if (!t)
return {};
if (typeof t == "string")
return { error: () => t };
if (t?.message !== void 0) {
if (t?.error !== void 0)
throw new 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 Kt(e) {
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
}
const qt = {
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
int32: [-2147483648, 2147483647],
uint32: [0, 4294967295],
float32: [-34028234663852886e22, 34028234663852886e22],
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
};
function Gt(e, t) {
const n = e._zod.def, o = U(e._zod.def, {
get shape() {
const r = {};
for (const i in t) {
if (!(i in n.shape))
throw new Error(`Unrecognized key: "${i}"`);
t[i] && (r[i] = n.shape[i]);
}
return T(this, "shape", r), r;
},
checks: []
});
return O(e, o);
}
function Ht(e, t) {
const n = e._zod.def, o = U(e._zod.def, {
get shape() {
const r = { ...e._zod.def.shape };
for (const i in t) {
if (!(i in n.shape))
throw new Error(`Unrecognized key: "${i}"`);
t[i] && delete r[i];
}
return T(this, "shape", r), r;
},
checks: []
});
return O(e, o);
}
function Yt(e, t) {
if (!G(t))
throw new Error("Invalid input to extend: expected a plain object");
const n = U(e._zod.def, {
get shape() {
const o = { ...e._zod.def.shape, ...t };
return T(this, "shape", o), o;
},
checks: []
});
return O(e, n);
}
function Xt(e, t) {
const n = U(e._zod.def, {
get shape() {
const o = { ...e._zod.def.shape, ...t._zod.def.shape };
return T(this, "shape", o), o;
},
get catchall() {
return t._zod.def.catchall;
},
checks: []
// delete existing checks
});
return O(e, n);
}
function Qt(e, t, n) {
const o = U(t._zod.def, {
get shape() {
const r = t._zod.def.shape, i = { ...r };
if (n)
for (const s in n) {
if (!(s in r))
throw new Error(`Unrecognized key: "${s}"`);
n[s] && (i[s] = e ? new e({
type: "optional",
innerType: r[s]
}) : r[s]);
}
else
for (const s in r)
i[s] = e ? new e({
type: "optional",
innerType: r[s]
}) : r[s];
return T(this, "shape", i), i;
},
checks: []
});
return O(t, o);
}
function en(e, t, n) {
const o = U(t._zod.def, {
get shape() {
const r = t._zod.def.shape, i = { ...r };
if (n)
for (const s in n) {
if (!(s in i))
throw new Error(`Unrecognized key: "${s}"`);
n[s] && (i[s] = new e({
type: "nonoptional",
innerType: r[s]
}));
}
else
for (const s in r)
i[s] = new e({
type: "nonoptional",
innerType: r[s]
});
return T(this, "shape", i), i;
},
checks: []
});
return O(t, o);
}
function K(e, t = 0) {
for (let n = t; n < e.issues.length; n++)
if (e.issues[n]?.continue !== !0)
return !0;
return !1;
}
function F(e, t) {
return t.map((n) => {
var o;
return (o = n).path ?? (o.path = []), n.path.unshift(e), n;
});
}
function te(e) {
return typeof e == "string" ? e : e?.message;
}
function N(e, t, n) {
const o = { ...e, path: e.path ?? [] };
if (!e.message) {
const r = te(e.inst?._zod.def?.error?.(e)) ?? te(t?.error?.(e)) ?? te(n.customError?.(e)) ?? te(n.localeError?.(e)) ?? "Invalid input";
o.message = r;
}
return delete o.inst, delete o.continue, t?.reportInput || delete o.input, o;
}
function Ee(e) {
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
}
function H(...e) {
const [t, n, o] = e;
return typeof t == "string" ? {
message: t,
code: "custom",
input: n,
inst: o
} : { ...t };
}
const dt = (e, t) => {
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
value: e._zod,
enumerable: !1
}), Object.defineProperty(e, "issues", {
value: t,
enumerable: !1
}), e.message = JSON.stringify(t, we, 2), Object.defineProperty(e, "toString", {
value: () => e.message,
enumerable: !1
});
}, pt = /* @__PURE__ */ c("$ZodError", dt), mt = /* @__PURE__ */ c("$ZodError", dt, { Parent: Error });
function tn(e, t = (n) => n.message) {
const n = {}, o = [];
for (const r of e.issues)
r.path.length > 0 ? (n[r.path[0]] = n[r.path[0]] || [], n[r.path[0]].push(t(r))) : o.push(t(r));
return { formErrors: o, fieldErrors: n };
}
function nn(e, t) {
const n = t || function(i) {
return i.message;
}, o = { _errors: [] }, r = (i) => {
for (const s of i.issues)
if (s.code === "invalid_union" && s.errors.length)
s.errors.map((a) => r({ issues: a }));
else if (s.code === "invalid_key")
r({ issues: s.issues });
else if (s.code === "invalid_element")
r({ issues: s.issues });
else if (s.path.length === 0)
o._errors.push(n(s));
else {
let a = o, l = 0;
for (; l < s.path.length; ) {
const d = s.path[l];
l === s.path.length - 1 ? (a[d] = a[d] || { _errors: [] }, a[d]._errors.push(n(s))) : a[d] = a[d] || { _errors: [] }, a = a[d], l++;
}
}
};
return r(e), o;
}
const on = (e) => (t, n, o, r) => {
const i = o ? Object.assign(o, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i);
if (s instanceof Promise)
throw new q();
if (s.issues.length) {
const a = new (r?.Err ?? e)(s.issues.map((l) => N(l, i, C())));
throw ut(a, r?.callee), a;
}
return s.value;
}, rn = (e) => async (t, n, o, r) => {
const i = o ? Object.assign(o, { async: !0 }) : { async: !0 };
let s = t._zod.run({ value: n, issues: [] }, i);
if (s instanceof Promise && (s = await s), s.issues.length) {
const a = new (r?.Err ?? e)(s.issues.map((l) => N(l, i, C())));
throw ut(a, r?.callee), a;
}
return s.value;
}, ht = (e) => (t, n, o) => {
const r = o ? { ...o, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, r);
if (i instanceof Promise)
throw new q();
return i.issues.length ? {
success: !1,
error: new (e ?? pt)(i.issues.map((s) => N(s, r, C())))
} : { success: !0, data: i.value };
}, sn = /* @__PURE__ */ ht(mt), ft = (e) => async (t, n, o) => {
const r = o ? Object.assign(o, { async: !0 }) : { async: !0 };
let i = t._zod.run({ value: n, issues: [] }, r);
return i instanceof Promise && (i = await i), i.issues.length ? {
success: !1,
error: new e(i.issues.map((s) => N(s, r, C())))
} : { success: !0, data: i.value };
}, an = /* @__PURE__ */ ft(mt), cn = /^[cC][^\s-]{8,}$/, un = /^[0-9a-z]+$/, ln = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, dn = /^[0-9a-vA-V]{20}$/, pn = /^[A-Za-z0-9]{27}$/, mn = /^[a-zA-Z0-9_-]{21}$/, hn = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, fn = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Re = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/, gn = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, _n = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
function vn() {
return new RegExp(_n, "u");
}
const yn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, wn = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/, bn = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, zn = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, kn = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, gt = /^[A-Za-z0-9_-]*$/, $n = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/, xn = /^\+(?:[0-9]){6,14}[0-9]$/, _t = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", Zn = /* @__PURE__ */ new RegExp(`^${_t}$`);
function vt(e) {
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
}
function In(e) {
return new RegExp(`^${vt(e)}$`);
}
function Sn(e) {
const t = vt({ precision: e.precision }), n = ["Z"];
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
const o = `${t}(?:${n.join("|")})`;
return new RegExp(`^${_t}T(?:${o})$`);
}
const Pn = (e) => {
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
return new RegExp(`^${t}$`);
}, En = /^\d+$/, Ln = /^-?\d+(?:\.\d+)?/i, jn = /true|false/i, Dn = /^[^A-Z]*$/, An = /^[^a-z]*$/, I = /* @__PURE__ */ c("$ZodCheck", (e, t) => {
var n;
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
}), yt = {
number: "number",
bigint: "bigint",
object: "date"
}, wt = /* @__PURE__ */ c("$ZodCheckLessThan", (e, t) => {
I.init(e, t);
const n = yt[typeof t.value];
e._zod.onattach.push((o) => {
const r = o._zod.bag, i = (t.inclusive ? r.maximum : r.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
t.value < i && (t.inclusive ? r.maximum = t.value : r.exclusiveMaximum = t.value);
}), e._zod.check = (o) => {
(t.inclusive ? o.value <= t.value : o.value < t.value) || o.issues.push({
origin: n,
code: "too_big",
maximum: t.value,
input: o.value,
inclusive: t.inclusive,
inst: e,
continue: !t.abort
});
};
}), bt = /* @__PURE__ */ c("$ZodCheckGreaterThan", (e, t) => {
I.init(e, t);
const n = yt[typeof t.value];
e._zod.onattach.push((o) => {
const r = o._zod.bag, i = (t.inclusive ? r.minimum : r.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
t.value > i && (t.inclusive ? r.minimum = t.value : r.exclusiveMinimum = t.value);
}), e._zod.check = (o) => {
(t.inclusive ? o.value >= t.value : o.value > t.value) || o.issues.push({
origin: n,
code: "too_small",
minimum: t.value,
input: o.value,
inclusive: t.inclusive,
inst: e,
continue: !t.abort
});
};
}), Cn = /* @__PURE__ */ c("$ZodCheckMultipleOf", (e, t) => {
I.init(e, t), e._zod.onattach.push((n) => {
var o;
(o = n._zod.bag).multipleOf ?? (o.multipleOf = t.value);
}), e._zod.check = (n) => {
if (typeof n.value != typeof t.value)
throw new Error("Cannot mix number and bigint in multiple_of check.");
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : Wt(n.value, t.value) === 0) || n.issues.push({
origin: typeof n.value,
code: "not_multiple_of",
divisor: t.value,
input: n.value,
inst: e,
continue: !t.abort
});
};
}), Nn = /* @__PURE__ */ c("$ZodCheckNumberFormat", (e, t) => {
I.init(e, t), t.format = t.format || "float64";
const n = t.format?.includes("int"), o = n ? "int" : "number", [r, i] = qt[t.format];
e._zod.onattach.push((s) => {
const a = s._zod.bag;
a.format = t.format, a.minimum = r, a.maximum = i, n && (a.pattern = En);
}), e._zod.check = (s) => {
const a = s.value;
if (n) {
if (!Number.isInteger(a)) {
s.issues.push({
expected: o,
format: t.format,
code: "invalid_type",
continue: !1,
input: a,
inst: e
});
return;
}
if (!Number.isSafeInteger(a)) {
a > 0 ? s.issues.push({
input: a,
code: "too_big",
maximum: Number.MAX_SAFE_INTEGER,
note: "Integers must be within the safe integer range.",
inst: e,
origin: o,
continue: !t.abort
}) : s.issues.push({
input: a,
code: "too_small",
minimum: Number.MIN_SAFE_INTEGER,
note: "Integers must be within the safe integer range.",
inst: e,
origin: o,
continue: !t.abort
});
return;
}
}
a < r && s.issues.push({
origin: "number",
input: a,
code: "too_small",
minimum: r,
inclusive: !0,
inst: e,
continue: !t.abort
}), a > i && s.issues.push({
origin: "number",
input: a,
code: "too_big",
maximum: i,
inst: e
});
};
}), Tn = /* @__PURE__ */ c("$ZodCheckMaxLength", (e, t) => {
var n;
I.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
const r = o.value;
return !Se(r) && r.length !== void 0;
}), e._zod.onattach.push((o) => {
const r = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
t.maximum < r && (o._zod.bag.maximum = t.maximum);
}), e._zod.check = (o) => {
const r = o.value;
if (r.length <= t.maximum)
return;
const s = Ee(r);
o.issues.push({
origin: s,
code: "too_big",
maximum: t.maximum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort
});
};
}), On = /* @__PURE__ */ c("$ZodCheckMinLength", (e, t) => {
var n;
I.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
const r = o.value;
return !Se(r) && r.length !== void 0;
}), e._zod.onattach.push((o) => {
const r = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
t.minimum > r && (o._zod.bag.minimum = t.minimum);
}), e._zod.check = (o) => {
const r = o.value;
if (r.length >= t.minimum)
return;
const s = Ee(r);
o.issues.push({
origin: s,
code: "too_small",
minimum: t.minimum,
inclusive: !0,
input: r,
inst: e,
continue: !t.abort
});
};
}), Rn = /* @__PURE__ */ c("$ZodCheckLengthEquals", (e, t) => {
var n;
I.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
const r = o.value;
return !Se(r) && r.length !== void 0;
}), e._zod.onattach.push((o) => {
const r = o._zod.bag;
r.minimum = t.length, r.maximum = t.length, r.length = t.length;
}), e._zod.check = (o) => {
const r = o.value, i = r.length;
if (i === t.length)
return;
const s = Ee(r), a = i > t.length;
o.issues.push({
origin: s,
...a ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
inclusive: !0,
exact: !0,
input: o.value,
inst: e,
continue: !t.abort
});
};
}), de = /* @__PURE__ */ c("$ZodCheckStringFormat", (e, t) => {
var n, o;
I.init(e, t), e._zod.onattach.push((r) => {
const i = r._zod.bag;
i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
}), t.pattern ? (n = e._zod).check ?? (n.check = (r) => {
t.pattern.lastIndex = 0, !t.pattern.test(r.value) && r.issues.push({
origin: "string",
code: "invalid_format",
format: t.format,
input: r.value,
...t.pattern ? { pattern: t.pattern.toString() } : {},
inst: e,
continue: !t.abort
});
}) : (o = e._zod).check ?? (o.check = () => {
});
}), Fn = /* @__PURE__ */ c("$ZodCheckRegex", (e, t) => {
de.init(e, t), e._zod.check = (n) => {
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
origin: "string",
code: "invalid_format",
format: "regex",
input: n.value,
pattern: t.pattern.toString(),
inst: e,
continue: !t.abort
});
};
}), Un = /* @__PURE__ */ c("$ZodCheckLowerCase", (e, t) => {
t.pattern ?? (t.pattern = Dn), de.init(e, t);
}), Mn = /* @__PURE__ */ c("$ZodCheckUpperCase", (e, t) => {
t.pattern ?? (t.pattern = An), de.init(e, t);
}), Wn = /* @__PURE__ */ c("$ZodCheckIncludes", (e, t) => {
I.init(e, t);
const n = le(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
t.pattern = o, e._zod.onattach.push((r) => {
const i = r._zod.bag;
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(o);
}), e._zod.check = (r) => {
r.value.includes(t.includes, t.position) || r.issues.push({
origin: "string",
code: "invalid_format",
format: "includes",
includes: t.includes,
input: r.value,
inst: e,
continue: !t.abort
});
};
}), Bn = /* @__PURE__ */ c("$ZodCheckStartsWith", (e, t) => {
I.init(e, t);
const n = new RegExp(`^${le(t.prefix)}.*`);
t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
const r = o._zod.bag;
r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n);
}), e._zod.check = (o) => {
o.value.startsWith(t.prefix) || o.issues.push({
origin: "string",
code: "invalid_format",
format: "starts_with",
prefix: t.prefix,
input: o.value,
inst: e,
continue: !t.abort
});
};
}), Vn = /* @__PURE__ */ c("$ZodCheckEndsWith", (e, t) => {
I.init(e, t);
const n = new RegExp(`.*${le(t.suffix)}$`);
t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
const r = o._zod.bag;
r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n);
}), e._zod.check = (o) => {
o.value.endsWith(t.suffix) || o.issues.push({
origin: "string",
code: "invalid_format",
format: "ends_with",
suffix: t.suffix,
input: o.value,
inst: e,
continue: !t.abort
});
};
}), Jn = /* @__PURE__ */ c("$ZodCheckOverwrite", (e, t) => {
I.init(e, t), e._zod.check = (n) => {
n.value = t.tx(n.value);
};
});
class Kn {
constructor(t = []) {
this.content = [], this.indent = 0, this && (this.args = t);
}
indented(t) {
this.indent += 1, t(this), this.indent -= 1;
}
write(t) {
if (typeof t == "function") {
t(this, { execution: "sync" }), t(this, { execution: "async" });
return;
}
const o = t.split(`
`).filter((s) => s), r = Math.min(...o.map((s) => s.length - s.trimStart().length)), i = o.map((s) => s.slice(r)).map((s) => " ".repeat(this.indent * 2) + s);
for (const s of i)
this.content.push(s);
}
compile() {
const t = Function, n = this?.args, r = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
return new t(...n, r.join(`
`));
}
}
const qn = {
major: 4,
minor: 0,
patch: 17
}, b = /* @__PURE__ */ c("$ZodType", (e, t) => {
var n;
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = qn;
const o = [...e._zod.def.checks ?? []];
e._zod.traits.has("$ZodCheck") && o.unshift(e);
for (const r of o)
for (const i of r._zod.onattach)
i(e);
if (o.length === 0)
(n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
e._zod.run = e._zod.parse;
});
else {
const r = (i, s, a) => {
let l = K(i), d;
for (const f of s) {
if (f._zod.def.when) {
if (!f._zod.def.when(i))
continue;
} else if (l)
continue;
const m = i.issues.length, g = f._zod.check(i);
if (g instanceof Promise && a?.async === !1)
throw new q();
if (d || g instanceof Promise)
d = (d ?? Promise.resolve()).then(async () => {
await g, i.issues.length !== m && (l || (l = K(i, m)));
});
else {
if (i.issues.length === m)
continue;
l || (l = K(i, m));
}
}
return d ? d.then(() => i) : i;
};
e._zod.run = (i, s) => {
const a = e._zod.parse(i, s);
if (a instanceof Promise) {
if (s.async === !1)
throw new q();
return a.then((l) => r(l, o, s));
}
return r(a, o, s);
};
}
e["~standard"] = {
validate: (r) => {
try {
const i = sn(e, r);
return i.success ? { value: i.data } : { issues: i.error?.issues };
} catch {
return an(e, r).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
}
},
vendor: "zod",
version: 1
};
}), Le = /* @__PURE__ */ c("$ZodString", (e, t) => {
b.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Pn(e._zod.bag), e._zod.parse = (n, o) => {
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;
};
}), w = /* @__PURE__ */ c("$ZodStringFormat", (e, t) => {
de.init(e, t), Le.init(e, t);
}), Gn = /* @__PURE__ */ c("$ZodGUID", (e, t) => {
t.pattern ?? (t.pattern = fn), w.init(e, t);
}), Hn = /* @__PURE__ */ c("$ZodUUID", (e, t) => {
if (t.version) {
const o = {
v1: 1,
v2: 2,
v3: 3,
v4: 4,
v5: 5,
v6: 6,
v7: 7,
v8: 8
}[t.version];
if (o === void 0)
throw new Error(`Invalid UUID version: "${t.version}"`);
t.pattern ?? (t.pattern = Re(o));
} else
t.pattern ?? (t.pattern = Re());
w.init(e, t);
}), Yn = /* @__PURE__ */ c("$ZodEmail", (e, t) => {
t.pattern ?? (t.pattern = gn), w.init(e, t);
}), Xn = /* @__PURE__ */ c("$ZodURL", (e, t) => {
w.init(e, t), e._zod.check = (n) => {
try {
const o = n.value.trim(), r = new URL(o);
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(r.hostname) || n.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid hostname",
pattern: $n.source,
input: n.value,
inst: e,
continue: !t.abort
})), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(r.protocol.endsWith(":") ? r.protocol.slice(0, -1) : r.protocol) || n.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid protocol",
pattern: t.protocol.source,
input: n.value,
inst: e,
continue: !t.abort
})), t.normalize ? n.value = r.href : n.value = o;
return;
} catch {
n.issues.push({
code: "invalid_format",
format: "url",
input: n.value,
inst: e,
continue: !t.abort
});
}
};
}), Qn = /* @__PURE__ */ c("$ZodEmoji", (e, t) => {
t.pattern ?? (t.pattern = vn()), w.init(e, t);
}), eo = /* @__PURE__ */ c("$ZodNanoID", (e, t) => {
t.pattern ?? (t.pattern = mn), w.init(e, t);
}), to = /* @__PURE__ */ c("$ZodCUID", (e, t) => {
t.pattern ?? (t.pattern = cn), w.init(e, t);
}), no = /* @__PURE__ */ c("$ZodCUID2", (e, t) => {
t.pattern ?? (t.pattern = un), w.init(e, t);
}), oo = /* @__PURE__ */ c("$ZodULID", (e, t) => {
t.pattern ?? (t.pattern = ln), w.init(e, t);
}), ro = /* @__PURE__ */ c("$ZodXID", (e, t) => {
t.pattern ?? (t.pattern = dn), w.init(e, t);
}), io = /* @__PURE__ */ c("$ZodKSUID", (e, t) => {
t.pattern ?? (t.pattern = pn), w.init(e, t);
}), so = /* @__PURE__ */ c("$ZodISODateTime", (e, t) => {
t.pattern ?? (t.pattern = Sn(t)), w.init(e, t);
}), ao = /* @__PURE__ */ c("$ZodISODate", (e, t) => {
t.pattern ?? (t.pattern = Zn), w.init(e, t);
}), co = /* @__PURE__ */ c("$ZodISOTime", (e, t) => {
t.pattern ?? (t.pattern = In(t)), w.init(e, t);
}), uo = /* @__PURE__ */ c("$ZodISODuration", (e, t) => {
t.pattern ?? (t.pattern = hn), w.init(e, t);
}), lo = /* @__PURE__ */ c("$ZodIPv4", (e, t) => {
t.pattern ?? (t.pattern = yn), w.init(e, t), e._zod.onattach.push((n) => {
const o = n._zod.bag;
o.format = "ipv4";
});
}), po = /* @__PURE__ */ c("$ZodIPv6", (e, t) => {
t.pattern ?? (t.pattern = wn), w.init(e, t), e._zod.onattach.push((n) => {
const o = n._zod.bag;
o.format = "ipv6";
}), e._zod.check = (n) => {
try {
new URL(`http://[${n.value}]`);
} catch {
n.issues.push({
code: "invalid_format",
format: "ipv6",
input: n.value,
inst: e,
continue: !t.abort
});
}
};
}), mo = /* @__PURE__ */ c("$ZodCIDRv4", (e, t) => {
t.pattern ?? (t.pattern = bn), w.init(e, t);
}), ho = /* @__PURE__ */ c("$ZodCIDRv6", (e, t) => {
t.pattern ?? (t.pattern = zn), w.init(e, t), e._zod.check = (n) => {
const [o, r] = n.value.split("/");
try {
if (!r)
throw new Error();
const i = Number(r);
if (`${i}` !== r)
throw new Error();
if (i < 0 || i > 128)
throw new Error();
new URL(`http://[${o}]`);
} catch {
n.issues.push({
code: "invalid_format",
format: "cidrv6",
input: n.value,
inst: e,
continue: !t.abort
});
}
};
});
function zt(e) {
if (e === "")
return !0;
if (e.length % 4 !== 0)
return !1;
try {
return atob(e), !0;
} catch {
return !1;
}
}
const fo = /* @__PURE__ */ c("$ZodBase64", (e, t) => {
t.pattern ?? (t.pattern = kn), w.init(e, t), e._zod.onattach.push((n) => {
n._zod.bag.contentEncoding = "base64";
}), e._zod.check = (n) => {
zt(n.value) || n.issues.push({
code: "invalid_format",
format: "base64",
input: n.value,
inst: e,
continue: !t.abort
});
};
});
function go(e) {
if (!gt.test(e))
return !1;
const t = e.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
return zt(n);
}
const _o = /* @__PURE__ */ c("$ZodBase64URL", (e, t) => {
t.pattern ?? (t.pattern = gt), w.init(e, t), e._zod.onattach.push((n) => {
n._zod.bag.contentEncoding = "base64url";
}), e._zod.check = (n) => {
go(n.value) || n.issues.push({
code: "invalid_format",
format: "base64url",
input: n.value,
inst: e,
continue: !t.abort
});
};
}), vo = /* @__PURE__ */ c("$ZodE164", (e, t) => {
t.pattern ?? (t.pattern = xn), w.init(e, t);
});
function yo(e, t = null) {
try {
const n = e.split(".");
if (n.length !== 3)
return !1;
const [o] = n;
if (!o)
return !1;
const r = JSON.parse(atob(o));
return !("typ" in r && r?.typ !== "JWT" || !r.alg || t && (!("alg" in r) || r.alg !== t));
} catch {
return !1;
}
}
const wo = /* @__PURE__ */ c("$ZodJWT", (e, t) => {
w.init(e, t), e._zod.check = (n) => {
yo(n.value, t.alg) || n.issues.push({
code: "invalid_format",
format: "jwt",
input: n.value,
inst: e,
continue: !t.abort
});
};
}), kt = /* @__PURE__ */ c("$ZodNumber", (e, t) => {
b.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Ln, e._zod.parse = (n, o) => {
if (t.coerce)
try {
n.value = Number(n.value);
} catch {
}
const r = n.value;
if (typeof r == "number" && !Number.isNaN(r) && Number.isFinite(r))
return n;
const i = typeof r == "number" ? Number.isNaN(r) ? "NaN" : Number.isFinite(r) ? void 0 : "Infinity" : void 0;
return n.issues.push({
expected: "number",
code: "invalid_type",
input: r,
inst: e,
...i ? { received: i } : {}
}), n;
};
}), bo = /* @__PURE__ */ c("$ZodNumber", (e, t) => {
Nn.init(e, t), kt.init(e, t);
}), zo = /* @__PURE__ */ c("$ZodBoolean", (e, t) => {
b.init(e, t), e._zod.pattern = jn, e._zod.parse = (n, o) => {
if (t.coerce)
try {
n.value = !!n.value;
} catch {
}
const r = n.value;
return typeof r == "boolean" || n.issues.push({
expected: "boolean",
code: "invalid_type",
input: r,
inst: e
}), n;
};
}), ko = /* @__PURE__ */ c("$ZodAny", (e, t) => {
b.init(e, t), e._zod.parse = (n) => n;
}), $o = /* @__PURE__ */ c("$ZodUnknown", (e, t) => {
b.init(e, t), e._zod.parse = (n) => n;
}), xo = /* @__PURE__ */ c("$ZodNever", (e, t) => {
b.init(e, t), e._zod.parse = (n, o) => (n.issues.push({
expected: "never",
code: "invalid_type",
input: n.value,
inst: e
}), n);
});
function Fe(e, t, n) {
e.issues.length && t.issues.push(...F(n, e.issues)), t.value[n] = e.value;
}
const Zo = /* @__PURE__ */ c("$ZodArray", (e, t) => {
b.init(e, t), e._zod.parse = (n, o) => {
const r = n.value;
if (!Array.isArray(r))
return n.issues.push({
expected: "array",
code: "invalid_type",
input: r,
inst: e
}), n;
n.value = Array(r.length);
const i = [];
for (let s = 0; s < r.length; s++) {
const a = r[s], l = t.element._zod.run({
value: a,
issues: []
}, o);
l instanceof Promise ? i.push(l.then((d) => Fe(d, n, s))) : Fe(l, n, s);
}
return i.length ? Promise.all(i).then(() => n) : n;
};
});
function ne(e, t, n, o) {
e.issues.length && t.issues.push(...F(n, e.issues)), e.value === void 0 ? n in o && (t.value[n] = void 0) : t.value[n] = e.value;
}
const Io = /* @__PURE__ */ c("$ZodObject", (e, t) => {
b.init(e, t);
const n = ct(() => {
const m = Object.keys(t.shape);
for (const _ of m)
if (!t.shape[_]._zod.traits.has("$ZodType"))
throw new Error(`Invalid element at key "${_}": expected a Zod schema`);
const g = Kt(t.shape);
return {
shape: t.shape,
keys: m,
keySet: new Set(m),
numKeys: m.length,
optionalKeys: new Set(g)
};
});
y(e._zod, "propValues", () => {
const m = t.shape, g = {};
for (const _ in m) {
const P = m[_]._zod;
if (P.values) {
g[_] ?? (g[_] = /* @__PURE__ */ new Set());
for (const A of P.values)
g[_].add(A);
}
}
return g;
});
const o = (m) => {
const g = new Kn(["shape", "payload", "ctx"]), _ = n.value, P = (E) => {
const x = Oe(E);
return `shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`;
};
g.write("const input = payload.value;");
const A = /* @__PURE__ */ Object.create(null);
let fe = 0;
for (const E of _.keys)
A[E] = `key_${fe++}`;
g.write("const newResult = {}");
for (const E of _.keys) {
const x = A[E], Z = Oe(E);
g.write(`const ${x} = ${P(E)};`), g.write(`
if (${x}.issues.length) {
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
...iss,
path: iss.path ? [${Z}, ...iss.path] : [${Z}]
})));
}
if (${x}.value === undefined) {
if (${Z} in input) {
newResult[${Z}] = undefined;
}
} else {
newResult[${Z}] = ${x}.value;
}
`);
}
g.write("payload.value = newResult;"), g.write("return payload;");
const ee = g.compile();
return (E, x) => ee(m, E, x);
};
let r;
const i = be, s = !at.jitless, l = s && Vt.value, d = t.catchall;
let f;
e._zod.parse = (m, g) => {
f ?? (f = n.value);
const _ = m.value;
if (!i(_))
return m.issues.push({
expected: "object",
code: "invalid_type",
input: _,
inst: e
}), m;
const P = [];
if (s && l && g?.async === !1 && g.jitless !== !0)
r || (r = o(t.shape)), m = r(m, g);
else {
m.value = {};
const x = f.shape;
for (const Z of f.keys) {
const ge = x[Z]._zod.run({ value: _[Z], issues: [] }, g);
ge instanceof Promise ? P.push(ge.then((Ut) => ne(Ut, m, Z, _))) : ne(ge, m, Z, _);
}
}
if (!d)
return P.length ? Promise.all(P).then(() => m) : m;
const A = [], fe = f.keySet, ee = d._zod, E = ee.def.type;
for (const x of Object.keys(_)) {
if (fe.has(x))
continue;
if (E === "never") {
A.push(x);
continue;
}
const Z = ee.run({ value: _[x], issues: [] }, g);
Z instanceof Promise ? P.push(Z.then((Ce) => ne(Ce, m, x, _))) : ne(Z, m, x, _);
}
return A.length && m.issues.push({
code: "unrecognized_keys",
keys: A,
input: _,
inst: e
}), P.length ? Promise.all(P).then(() => m) : m;
};
});
function Ue(e, t, n, o) {
for (const i of e)
if (i.issues.length === 0)
return t.value = i.value, t;
const r = e.filter((i) => !K(i));
return r.length === 1 ? (t.value = r[0].value, r[0]) : (t.issues.push({
code: "invalid_union",
input: t.value,
inst: n,
errors: e.map((i) => i.issues.map((s) => N(s, o, C())))
}), t);
}
const So = /* @__PURE__ */ c("$ZodUnion", (e, t) => {
b.init(e, t), y(e._zod, "optin", () => t.options.some((r) => r._zod.optin === "optional") ? "optional" : void 0), y(e._zod, "optout", () => t.options.some((r) => r._zod.optout === "optional") ? "optional" : void 0), y(e._zod, "values", () => {
if (t.options.every((r) => r._zod.values))
return new Set(t.options.flatMap((r) => Array.from(r._zod.values)));
}), y(e._zod, "pattern", () => {
if (t.options.every((r) => r._zod.pattern)) {
const r = t.options.map((i) => i._zod.pattern);
return new RegExp(`^(${r.map((i) => Pe(i.source)).join("|")})$`);
}
});
const n = t.options.length === 1, o = t.options[0]._zod.run;
e._zod.parse = (r, i) => {
if (n)
return o(r, i);
let s = !1;
const a = [];
for (const l of t.options) {
const d = l._zod.run({
value: r.value,
issues: []
}, i);
if (d instanceof Promise)
a.push(d), s = !0;
else {
if (d.issues.length === 0)
return d;
a.push(d);
}
}
return s ? Promise.all(a).then((l) => Ue(l, r, e, i)) : Ue(a, r, e, i);
};
}), Po = /* @__PURE__ */ c("$ZodIntersection", (e, t) => {
b.init(e, t), e._zod.parse = (n, o) => {
const r = n.value, i = t.left._zod.run({ value: r, issues: [] }, o), s = t.right._zod.run({ value: r, issues: [] }, o);
return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([l, d]) => Me(n, l, d)) : Me(n, i, s);
};
});
function ze(e, t) {
if (e === t)
return { valid: !0, data: e };
if (e instanceof Date && t instanceof Date && +e == +t)
return { valid: !0, data: e };
if (G(e) && G(t)) {
const n = Object.keys(t), o = Object.keys(e).filter((i) => n.indexOf(i) !== -1), r = { ...e, ...t };
for (const i of o) {
const s = ze(e[i], t[i]);
if (!s.valid)
return {
valid: !1,
mergeErrorPath: [i, ...s.mergeErrorPath]
};
r[i] = s.data;
}
return { valid: !0, data: r };
}
if (Array.isArray(e) && Array.isArray(t)) {
if (e.length !== t.length)
return { valid: !1, mergeErrorPath: [] };
const n = [];
for (let o = 0; o < e.length; o++) {
const r = e[o], i = t[o], s = ze(r, i);
if (!s.valid)
return {
valid: !1,
mergeErrorPath: [o, ...s.mergeErrorPath]
};
n.push(s.data);
}
return { valid: !0, data: n };
}
return { valid: !1, mergeErrorPath: [] };
}
function Me(e, t, n) {
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), K(e))
return e;
const o = ze(t.value, n.value);
if (!o.valid)
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
return e.value = o.data, e;
}
const Eo = /* @__PURE__ */ c("$ZodRecord", (e, t) => {
b.init(e, t), e._zod.parse = (n, o) => {
const r = n.value;
if (!G(r))
return n.issues.push({
expected: "record",
code: "invalid_type",
input: r,
inst: e
}), n;
const i = [];
if (t.keyType._zod.values) {
const s = t.keyType._zod.values;
n.value = {};
for (const l of s)
if (typeof l == "string" || typeof l == "number" || typeof l == "symbol") {
const d = t.valueType._zod.run({ value: r[l], issues: [] }, o);
d instanceof Promise ? i.push(d.then((f) => {
f.issues.length && n.issues.push(...F(l, f.issues)), n.value[l] = f.value;
})) : (d.issues.length && n.issues.push(...F(l, d.issues)), n.value[l] = d.value);
}
let a;
for (const l in r)
s.has(l) || (a = a ?? [], a.push(l));
a && a.length > 0 && n.issues.push({
code: "unrecognized_keys",
input: r,
inst: e,
keys: a
});
} else {
n.value = {};
for (const s of Reflect.ownKeys(r)) {
if (s === "__proto__")
continue;
const a = t.keyType._zod.run({ value: s, issues: [] }, o);
if (a instanceof Promise)
throw new Error("Async schemas not supported in object keys currently");
if (a.issues.length) {
n.issues.push({
code: "invalid_key",
origin: "record",
issues: a.issues.map((d) => N(d, o, C())),
input: s,
path: [s],
inst: e
}), n.value[a.value] = a.value;
continue;
}
const l = t.valueType._zod.run({ value: r[s], issues: [] }, o);
l instanceof Promise ? i.push(l.then((d) => {
d.issues.length && n.issues.push(...F(s, d.issues)), n.value[a.value] = d.value;
})) : (l.issues.length && n.issues.push(...F(s, l.issues)), n.value[a.value] = l.value);
}
}
return i.length ? Promise.all(i).then(() => n) : n;
};
}), Lo = /* @__PURE__ */ c("$ZodEnum", (e, t) => {
b.init(e, t);
const n = Mt(t.entries), o = new Set(n);
e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((r) => Jt.has(typeof r)).map((r) => typeof r == "string" ? le(r) : r.toString()).join("|")})$`), e._zod.parse = (r, i) => {
const s = r.value;
return o.has(s) || r.issues.push({
code: "invalid_value",
values: n,
input: s,
inst: e
}), r;
};
}), jo = /* @__PURE__ */ c("$ZodTransform", (e, t) => {
b.init(e, t), e._zod.parse = (n, o) => {
const r = t.transform(n.value, n);
if (o.async)
return (r instanceof Promise ? r : Promise.resolve(r)).then((s) => (n.value = s, n));
if (r instanceof Promise)
throw new q();
return n.value = r, n;
};
});
function We(e, t) {
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
}
const Do = /* @__PURE__ */ c("$ZodOptional", (e, t) => {
b.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", y(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), y(e._zod, "pattern", () => {
const n = t.innerType._zod.pattern;
return n ? new RegExp(`^(${Pe(n.source)})?$`) : void 0;
}), e._zod.parse = (n, o) => {
if (t.innerType._zod.optin === "optional") {
const r = t.innerType._zod.run(n, o);
return r instanceof Promise ? r.then((i) => We(i, n.value)) : We(r, n.value);
}
return n.value === void 0 ? n : t.innerType._zod.run(n, o);
};
}), Ao = /* @__PURE__ */ c("$ZodNullable", (e, t) => {
b.init(e, t), y(e._zod, "optin", () => t.innerType._zod.optin), y(e._zod, "optout", () => t.innerType._zod.optout), y(e._zod, "pattern", () => {
const n = t.innerType._zod.pattern;
return n ? new RegExp(`^(${Pe(n.source)}|null)$`) : void 0;
}), y(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, o) => n.value === null ? n : t.innerType._zod.run(n, o);
}), Co = /* @__PURE__ */ c("$ZodDefault", (e, t) => {
b.init(e, t), e._zod.optin = "optional", y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
if (n.value === void 0)
return n.value = t.defaultValue, n;
const r = t.innerType._zod.run(n, o);
return r instanceof Promise ? r.then((i) => Be(i, t)) : Be(r, t);
};
});
function Be(e, t) {
return e.value === void 0 && (e.value = t.defaultValue), e;
}
const No = /* @__PURE__ */ c("$ZodPrefault", (e, t) => {
b.init(e, t), e._zod.optin = "optional", y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => (n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, o));
}), To = /* @__PURE__ */ c("$ZodNonOptional", (e, t) => {
b.init(e, t), y(e._zod, "values", () => {
const n = t.innerType._zod.values;
return n ? new Set([...n].filter((o) => o !== void 0)) : void 0;
}), e._zod.parse = (n, o) => {
const r = t.innerType._zod.run(n, o);
return r instanceof Promise ? r.then((i) => Ve(i, e)) : Ve(r, e);
};
});
function Ve(e, t) {
return !e.issues.length && e.value === void 0 && e.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: e.value,
inst: t
}), e;
}
const Oo = /* @__PURE__ */ c("$ZodCatch", (e, t) => {
b.init(e, t), y(e._zod, "optin", () => t.innerType._zod.optin), y(e._zod, "optout", () => t.innerType._zod.optout), y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
const r = t.innerType._zod.run(n, o);
return r instanceof Promise ? r.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
...n,
error: {
issues: i.issues.map((s) => N(s, o, C()))
},
input: n.value
}), n.issues = []), n)) : (n.value = r.value, r.issues.length && (n.value = t.catchValue({
...n,
error: {
issues: r.issues.map((i) => N(i, o, C()))
},
input: n.value
}), n.issues = []), n);
};
}), Ro = /* @__PURE__ */ c("$ZodPipe", (e, t) => {
b.init(e, t), y(e._zod, "values", () => t.in._zod.values), y(e._zod, "optin", () => t.in._zod.optin), y(e._zod, "optout", () => t.out._zod.optout), y(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, o) => {
const r = t.in._zod.run(n, o);
return r instanceof Promise ? r.then((i) => Je(i, t, o)) : Je(r, t, o);
};
});
function Je(e, t, n) {
return e.issues.length ? e : t.out._zod.run({ value: e.value, issues: e.issues }, n);
}
const Fo = /* @__PURE__ */ c("$ZodReadonly", (e, t) => {
b.init(e, t), y(e._zod, "propValues", () => t.innerType._zod.propValues), y(e._zod, "values", () => t.innerType._zod.values), y(e._zod, "optin", () => t.innerType._zod.optin), y(e._zod, "optout", () => t.innerType._zod.optout), e._zod.parse = (n, o) => {
const r = t.innerType._zod.run(n, o);
return r instanceof Promise ? r.then(Ke) : Ke(r);
};
});
function Ke(e) {
return e.value = Object.freeze(e.value), e;
}
const Uo = /* @__PURE__ */ c("$ZodCustom", (e, t) => {
I.init(e, t), b.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
const o = n.value, r = t.fn(o);
if (r instanceof Promise)
return r.then((i) => qe(i, n, o, e));
qe(r, n, o, e);
};
});
function qe(e, t, n, o) {
if (!e) {
const r = {
code: "custom",
input: n,
inst: o,
// incorporates params.error into issue reporting
path: [...o._zod.def.path ?? []],
// incorporates params.error into issue reporting
continue: !o._zod.def.abort
// params: inst._zod.def.params,
};
o._zod.def.params && (r.params = o._zod.def.params), t.issues.push(H(r));
}
}
cla