2814 lines
80 KiB
JavaScript
2814 lines
80 KiB
JavaScript
// Metro module 12084 (f12085).
|
|
import * as _Module12085 from "./Module12085";
|
|
import * as _$ZodAsyncError from "./$ZodAsyncError";
|
|
import * as _Module12086 from "./Module12086";
|
|
import * as _mergeDefs from "./mergeDefs";
|
|
import * as _Module12087 from "./Module12087";
|
|
import * as _Module12081 from "./Module12081";
|
|
import { safeParse, safeParseAsync, parseAsync } from "./Module12081";
|
|
import { Doc } from "./Doc";
|
|
function $mk88814() {
|
|
return (a0) => a0 === "-" ? "+" : "/";
|
|
}
|
|
function $mk88818() {
|
|
return (a0) => a0.issues.length === 0;
|
|
}
|
|
function $mk88819($env) {
|
|
return (a0) => a0.issues.map($mk108627($env));
|
|
}
|
|
function $mk108627($env) {
|
|
return (a0) => {
|
|
const r0 = $env.$parent;
|
|
return r0[10].finalizeIssue(a0, $env[0], r0[8].config());
|
|
};
|
|
}
|
|
function $mk108630($env) {
|
|
return (a0) => $env.$parent[0]._zod.parse(a0, $env[0]);
|
|
}
|
|
let isValidJWT, normalizeDef, handleCatchall, handleUnionResults, handleExclusiveUnionResults, mergeValues, handleIntersectionResults, handleTupleResult, handleMapResult, handleSetResult, handleCodecAResult, handleReadonlyResult, c8316_5, c8316_6, c8316_7, c8316_8, c8316_9, c8316_10;
|
|
let env8316 = {};
|
|
export function isValidBase64(a0) {
|
|
if (a0 === "") {
|
|
return true;
|
|
}
|
|
if (a0.length % 4 !== 0) {
|
|
return false;
|
|
}
|
|
try {
|
|
atob(a0);
|
|
} catch ($e) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
isValidJWT = function isValidJWT(a0, r5 = null) {
|
|
let r29;
|
|
L19: {
|
|
L18: {
|
|
try {
|
|
const r8 = a0.split(".");
|
|
if (r8.length !== 3) {
|
|
break L19;
|
|
}
|
|
const [r17] = r8;
|
|
if (r17) {
|
|
const r25 = JSON.parse(atob(r17));
|
|
r29 = !("typ" in r25) || r25?.typ === "JWT";
|
|
if (!r29) {
|
|
break L18;
|
|
}
|
|
r29 = !!r25.alg && (r5 ? "alg" in r25 && r25.alg === r5 : !r5);
|
|
break L18;
|
|
}
|
|
} catch ($e) {
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
return r29;
|
|
}
|
|
return false;
|
|
};
|
|
normalizeDef = function normalizeDef(a0) {
|
|
const keys = Object.keys(a0.shape);
|
|
for (const item of keys) {
|
|
const shape3 = a0.shape;
|
|
const r32 = shape3 == null;
|
|
let r33 = void 0;
|
|
if (!r32) {
|
|
const r35 = shape3[item];
|
|
const r36 = r35 == null;
|
|
r33 = void 0;
|
|
if (!r36) {
|
|
const _zod = r35._zod;
|
|
const r38 = _zod == null;
|
|
r33 = void 0;
|
|
if (!r38) {
|
|
const traits = _zod.traits;
|
|
r33 = traits == null ? void 0 : traits.has("$ZodType");
|
|
}
|
|
}
|
|
}
|
|
if (!r33) {
|
|
throw new Error(`Invalid element at key "${item}": expected a Zod schema`);
|
|
}
|
|
}
|
|
const r54 = c8316_10.optionalKeys(a0.shape);
|
|
return {
|
|
...a0,
|
|
keys,
|
|
keySet: new Set(keys),
|
|
numKeys: keys.length,
|
|
optionalKeys: new Set(r54)
|
|
};
|
|
};
|
|
handleCatchall = function handleCatchall(a0, a1, a2, a3, a4, a5) {
|
|
let env19432 = {
|
|
$parent: env8316
|
|
};
|
|
env19432[0] = a1;
|
|
let r7 = a2;
|
|
env19432[1] = a2;
|
|
const keys = [];
|
|
const keySet = a4.keySet;
|
|
const _zod = a4.catchall._zod;
|
|
const type = _zod.def.type;
|
|
const r5 = _zod.optout === "optional";
|
|
env19432[2] = r5;
|
|
for (const key in a1) {
|
|
let c19433_0 = key;
|
|
if (!keySet.has(key)) {
|
|
if (type === "never") {
|
|
keys.push(key);
|
|
} else {
|
|
const r41 = _zod.run({
|
|
value: a1[key],
|
|
issues: []
|
|
}, a3);
|
|
if (r41 instanceof Promise) {
|
|
a0.push(r41.then((result) => {
|
|
L8: {
|
|
const r3 = env19432[1];
|
|
const r5 = env19432[0];
|
|
const r1 = env19432[2];
|
|
if (result.issues.length) {
|
|
if (r1 && !(c19433_0 in r5)) {
|
|
break L8;
|
|
}
|
|
const issues = r3.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(c19433_0, result.issues)]);
|
|
}
|
|
if (result.value === void 0) {
|
|
if (c19433_0 in r5) {
|
|
r3.value[c19433_0] = void 0;
|
|
}
|
|
} else {
|
|
r3.value[c19433_0] = result.value;
|
|
}
|
|
}
|
|
}));
|
|
} else {
|
|
if (r41.issues.length) {
|
|
if (r5 && !(key in a1)) {
|
|
continue;
|
|
}
|
|
const issues = a2.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(key, r41.issues)]);
|
|
}
|
|
if (r41.value === void 0) {
|
|
if (key in a1) {
|
|
a2.value[key] = void 0;
|
|
}
|
|
} else {
|
|
a2.value[key] = r41.value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (keys.length) {
|
|
a2.issues.push({
|
|
code: "unrecognized_keys",
|
|
keys,
|
|
input: a1,
|
|
inst: a5
|
|
});
|
|
}
|
|
if (a0.length) {
|
|
r7 = Promise.all(a0).then(() => env19432[1]);
|
|
}
|
|
return r7;
|
|
};
|
|
handleUnionResults = function handleUnionResults(a0, a1, a2, c19434_0) {
|
|
let r45;
|
|
for (const item of a0) {
|
|
if (item.issues.length !== 0) {
|
|
continue;
|
|
}
|
|
a1.value = item.value;
|
|
return a1;
|
|
}
|
|
const r33 = a0.filter((item) => !c8316_10.aborted(item));
|
|
if (r33.length === 1) {
|
|
a1.value = r33[0].value;
|
|
r45 = r33[0];
|
|
} else {
|
|
a1.issues.push({
|
|
code: "invalid_union",
|
|
input: a1.value,
|
|
inst: a2,
|
|
errors: a0.map((item) => item.issues.map((issue) => c8316_10.finalizeIssue(issue, c19434_0, c8316_8.config())))
|
|
});
|
|
r45 = a1;
|
|
}
|
|
return r45;
|
|
};
|
|
handleExclusiveUnionResults = function handleExclusiveUnionResults(a0, a1, a2, a3) {
|
|
let env19435;
|
|
const r7 = env19435 = {
|
|
$parent: env8316
|
|
};
|
|
env19435[0] = a3;
|
|
const r12 = a0.filter($mk88818());
|
|
if (r12.length === 1) {
|
|
a1.value = r12[0].value;
|
|
} else if (r12.length === 0) {
|
|
a1.issues.push({
|
|
code: "invalid_union",
|
|
input: a1.value,
|
|
inst: a2,
|
|
errors: a0.map($mk88819(r7))
|
|
});
|
|
} else {
|
|
a1.issues.push({
|
|
code: "invalid_union",
|
|
input: a1.value,
|
|
inst: a2,
|
|
errors: [],
|
|
inclusive: false
|
|
});
|
|
}
|
|
return a1;
|
|
};
|
|
mergeValues = function mergeValues(a0, a1) {
|
|
if (a0 === a1) {
|
|
return {
|
|
valid: true,
|
|
data: a0
|
|
};
|
|
}
|
|
if (a0 instanceof Date && a1 instanceof Date && +a0 === +a1) {
|
|
return {
|
|
valid: true,
|
|
data: a0
|
|
};
|
|
}
|
|
if (c8316_10.isPlainObject(a0) && c8316_10.isPlainObject(a1)) {
|
|
let c19436_0 = Object.keys(a1);
|
|
const r72 = Object.keys(a0).filter((item) => c19436_0.indexOf(item) !== -1);
|
|
const data2 = {
|
|
...a0,
|
|
...a1
|
|
};
|
|
for (const item of r72) {
|
|
const r91 = mergeValues(a0[item], a1[item]);
|
|
const valid2 = r91.valid;
|
|
if (valid2) {
|
|
data2[item] = r91.data;
|
|
continue;
|
|
}
|
|
return {
|
|
valid: false,
|
|
mergeErrorPath: [item, ...r91.mergeErrorPath]
|
|
};
|
|
}
|
|
return {
|
|
valid: true,
|
|
data: data2
|
|
};
|
|
}
|
|
if (Array.isArray(a0) && Array.isArray(a1)) {
|
|
if (a0.length !== a1.length) {
|
|
return {
|
|
valid: false,
|
|
mergeErrorPath: []
|
|
};
|
|
}
|
|
const data = [];
|
|
const r50 = 0 < a0.length;
|
|
let r4 = 0;
|
|
if (r50) {
|
|
do {
|
|
const r52 = mergeValues(a0[r4], a1[r4]);
|
|
const valid = r52.valid;
|
|
const r54 = r4;
|
|
if (!valid) {
|
|
return {
|
|
valid: false,
|
|
mergeErrorPath: [r54, ...r52.mergeErrorPath]
|
|
};
|
|
}
|
|
data.push(r52.data);
|
|
r4 = r54 + 1;
|
|
} while (r4 < a0.length);
|
|
}
|
|
return {
|
|
valid: true,
|
|
data
|
|
};
|
|
}
|
|
return {
|
|
valid: false,
|
|
mergeErrorPath: []
|
|
};
|
|
};
|
|
handleIntersectionResults = function handleIntersectionResults(a0, a1, a2) {
|
|
let r9 = void 0;
|
|
const map = new Map();
|
|
for (const issue of a1.issues) {
|
|
const r42 = issue;
|
|
if (issue.code === "unrecognized_keys") {
|
|
if (r9 == null) {
|
|
r9 = r42;
|
|
}
|
|
for (const key of r42.keys) {
|
|
if (!map.has(key)) {
|
|
map.set(key, {});
|
|
}
|
|
map.get(key).l = true;
|
|
}
|
|
} else {
|
|
a0.issues.push(r42);
|
|
}
|
|
}
|
|
for (const issue2 of a2.issues) {
|
|
const r74 = issue2;
|
|
if (issue2.code === "unrecognized_keys") {
|
|
for (const key2 of r74.keys) {
|
|
if (!map.has(key2)) {
|
|
map.set(key2, {});
|
|
}
|
|
map.get(key2).r = true;
|
|
}
|
|
continue;
|
|
}
|
|
a0.issues.push(r74);
|
|
}
|
|
const keys = [...map].filter((item) => {
|
|
const [, r2] = item;
|
|
return r2.l && r2.r;
|
|
}).map((item) => {
|
|
const [r8] = item;
|
|
return r8;
|
|
});
|
|
if (keys.length && r9) {
|
|
a0.issues.push({
|
|
...r9,
|
|
keys
|
|
});
|
|
}
|
|
if (c8316_10.aborted(a0)) {
|
|
return a0;
|
|
}
|
|
const r124 = mergeValues(a1.value, a2.value);
|
|
if (r124.valid) {
|
|
a0.value = r124.data;
|
|
return a0;
|
|
}
|
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r124.mergeErrorPath)}`);
|
|
};
|
|
handleTupleResult = function handleTupleResult(a0, a1, a2) {
|
|
if (a0.issues.length) {
|
|
const issues = a1.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(a2, a0.issues)]);
|
|
}
|
|
a1.value[a2] = a0.value;
|
|
};
|
|
handleMapResult = function handleMapResult(a0, a1, a2, a3, a4, a5, c19437_0) {
|
|
if (a0.issues.length) {
|
|
const r22 = c8316_10.propertyKeyTypes.has(typeof a3);
|
|
const issues = a2.issues;
|
|
const push = issues.push;
|
|
if (r22) {
|
|
push.apply(issues, [...c8316_10.prefixIssues(a3, a0.issues)]);
|
|
} else {
|
|
push.call(issues, {
|
|
code: "invalid_key",
|
|
origin: "map",
|
|
input: a4,
|
|
inst: a5,
|
|
issues: a0.issues.map((issue) => c8316_10.finalizeIssue(issue, c19437_0, c8316_8.config()))
|
|
});
|
|
}
|
|
}
|
|
if (a1.issues.length) {
|
|
const r42 = c8316_10.propertyKeyTypes.has(typeof a3);
|
|
const issues2 = a2.issues;
|
|
const push2 = issues2.push;
|
|
if (r42) {
|
|
push2.apply(issues2, [...c8316_10.prefixIssues(a3, a1.issues)]);
|
|
} else {
|
|
push2.call(issues2, {
|
|
origin: "map",
|
|
code: "invalid_element",
|
|
input: a4,
|
|
inst: a5,
|
|
key: a3,
|
|
issues: a1.issues.map((issue) => c8316_10.finalizeIssue(issue, c19437_0, c8316_8.config()))
|
|
});
|
|
}
|
|
}
|
|
a2.value.set(a0.value, a1.value);
|
|
};
|
|
handleSetResult = function handleSetResult(a0, a1) {
|
|
if (a0.issues.length) {
|
|
const issues = a1.issues;
|
|
issues.push.apply(issues, [...a0.issues]);
|
|
}
|
|
a1.value.add(a0.value);
|
|
};
|
|
handleCodecAResult = function handleCodecAResult(a0, a1, a2) {
|
|
let r21, r38;
|
|
if (a0.issues.length) {
|
|
a0.aborted = true;
|
|
return a0;
|
|
}
|
|
if ((a2.direction || "forward") === "forward") {
|
|
const value11 = a1.transform(a0.value, a0);
|
|
if (value11 instanceof Promise) {
|
|
r38 = value11.then((result) => {
|
|
let r13;
|
|
const out = a1.out;
|
|
if (a0.issues.length) {
|
|
a0.aborted = true;
|
|
r13 = a0;
|
|
} else {
|
|
r13 = out._zod.run({
|
|
value: result,
|
|
issues: a0.issues
|
|
}, a2);
|
|
}
|
|
return r13;
|
|
});
|
|
} else {
|
|
const out = a1.out;
|
|
if (a0.issues.length) {
|
|
a0.aborted = true;
|
|
r38 = a0;
|
|
} else {
|
|
r38 = out._zod.run({
|
|
value: value11,
|
|
issues: a0.issues
|
|
}, a2);
|
|
}
|
|
}
|
|
return r38;
|
|
}
|
|
const value10 = a1.reverseTransform(a0.value, a0);
|
|
if (value10 instanceof Promise) {
|
|
r21 = value10.then((result) => {
|
|
let r13;
|
|
const in2 = a1.in;
|
|
if (a0.issues.length) {
|
|
a0.aborted = true;
|
|
r13 = a0;
|
|
} else {
|
|
r13 = in2._zod.run({
|
|
value: result,
|
|
issues: a0.issues
|
|
}, a2);
|
|
}
|
|
return r13;
|
|
});
|
|
} else {
|
|
const in2 = a1.in;
|
|
if (a0.issues.length) {
|
|
a0.aborted = true;
|
|
r21 = a0;
|
|
} else {
|
|
r21 = in2._zod.run({
|
|
value: value10,
|
|
issues: a0.issues
|
|
}, a2);
|
|
}
|
|
}
|
|
return r21;
|
|
};
|
|
handleReadonlyResult = function handleReadonlyResult(a0) {
|
|
a0.value = Object.freeze(a0.value);
|
|
return a0;
|
|
};
|
|
c8316_5 = (this ? this.__createBinding : this) || (Object.create ? function(a0, a1, a2, a3) {
|
|
const r6 = a3 === void 0 ? a2 : a3;
|
|
let r9 = Object.getOwnPropertyDescriptor(a1, a2);
|
|
if (!(r9 ? !("get" in r9 ? !a1.__esModule : r9.writable || r9.configurable) : r9)) {
|
|
r9 = {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return a1[a2];
|
|
}
|
|
};
|
|
}
|
|
Object.defineProperty(a0, r6, r9);
|
|
} : function(a0, a1, a2, a3) {
|
|
a0[a3 === void 0 ? a2 : a3] = a1[a2];
|
|
});
|
|
c8316_6 = (this ? this.__setModuleDefault : this) || (Object.create ? function(a0, a1) {
|
|
Object.defineProperty(a0, "default", {
|
|
enumerable: true,
|
|
value: a1
|
|
});
|
|
} : function(a0, a1) {
|
|
a0.default = a1;
|
|
});
|
|
const r37 = (this ? this.__importStar : this) || function(a0) {
|
|
if (a0 && a0.__esModule) {
|
|
return a0;
|
|
}
|
|
const r15 = {};
|
|
if (a0 != null) {
|
|
for (const key in a0) {
|
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(a0, key)) {
|
|
c8316_5(r15, a0, key);
|
|
}
|
|
}
|
|
}
|
|
c8316_6(r15, a0);
|
|
return r15;
|
|
};
|
|
export function isValidBase64URL(a0) {
|
|
if (c8316_9.base64url.test(a0)) {
|
|
const r14 = a0.replace.call(a0, /[-_]/g, $mk88814());
|
|
return isValidBase64(r14.padEnd(4 * Math.ceil(r14.length / 4), "="));
|
|
}
|
|
return false;
|
|
}
|
|
export { isValidJWT };
|
|
c8316_7 = r37(_Module12085);
|
|
c8316_8 = r37(_$ZodAsyncError);
|
|
c8316_9 = r37(_Module12086);
|
|
c8316_10 = r37(_mergeDefs);
|
|
exports.$ZodType = c8316_8.$constructor("$ZodType", (a0, a1) => {
|
|
let env19440 = {
|
|
$parent: env8316
|
|
};
|
|
let r5 = a0;
|
|
env19440[0] = a0;
|
|
if (a0 == null) {
|
|
const r0 = {};
|
|
env19440[0] = r0;
|
|
r5 = r0;
|
|
}
|
|
r5._zod.def = a1;
|
|
r5._zod.bag = r5._zod.bag || {};
|
|
r5._zod.version = _Module12087.version;
|
|
let checks = r5._zod.def.checks;
|
|
if (checks == null) {
|
|
checks = [];
|
|
}
|
|
const r39 = [...checks];
|
|
env19440[1] = r39;
|
|
if (r5._zod.traits.has("$ZodCheck")) {
|
|
r39.unshift(r5);
|
|
}
|
|
for (const item of r39) {
|
|
for (const item2 of item._zod.onattach) {
|
|
item2(r5);
|
|
}
|
|
}
|
|
if (r39.length === 0) {
|
|
const _zod = r5._zod;
|
|
if (_zod.deferred == null) {
|
|
_zod.deferred = [];
|
|
}
|
|
const deferred = r5._zod.deferred;
|
|
if (deferred != null) {
|
|
deferred.push(() => {
|
|
const r3 = env19440[0];
|
|
r3._zod.run = r3._zod.parse;
|
|
});
|
|
}
|
|
} else {
|
|
env19440[2] = (a0, a1, c27230_1) => {
|
|
let c27230_2, c27230_4;
|
|
let r0 = a0;
|
|
let c27230_3 = c8316_10.aborted(a0);
|
|
const _loop = function _loop() {
|
|
if (c27230_4._zod.def.when) {
|
|
if (!c27230_4._zod.def.when(a0)) {
|
|
return 0;
|
|
}
|
|
} else if (c27230_3) {
|
|
return 0;
|
|
}
|
|
const length = a0.issues.length;
|
|
const value9 = c27230_4._zod.check(a0);
|
|
if (value9 instanceof Promise) {
|
|
if (c27230_1?.async === false) {
|
|
throw new c8316_8.$ZodAsyncError();
|
|
}
|
|
}
|
|
L18: {
|
|
if (!c27230_2 && !(value9 instanceof Promise)) {
|
|
if (a0.issues.length === length) {
|
|
return 0;
|
|
}
|
|
if (c27230_3) {
|
|
break L18;
|
|
}
|
|
c27230_3 = c8316_10.aborted(a0, length);
|
|
} else {
|
|
let r42 = c27230_2;
|
|
if (r42 == null) {
|
|
r42 = Promise.resolve();
|
|
}
|
|
c27230_2 = r42.then(async () => {
|
|
let c31652_0;
|
|
c31652_0 = void 0;
|
|
await value9;
|
|
if (a0.issues.length !== length) {
|
|
if (!c27230_3) {
|
|
c27230_3 = c8316_10.aborted(a0, length);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
for (const item of a1) {
|
|
c27230_4 = item;
|
|
_loop();
|
|
}
|
|
if (c27230_2) {
|
|
r0 = c27230_2.then(() => a0);
|
|
}
|
|
return r0;
|
|
};
|
|
env19440[3] = (a0, a1, a2) => {};
|
|
r5._zod.run = (a0, a1) => {
|
|
let r62;
|
|
if (a1.skipChecks) {
|
|
return env19440[0]._zod.parse(a0, a1);
|
|
}
|
|
if (a1.direction === "backward") {
|
|
const r38 = env19440[0];
|
|
const r44 = r38._zod.parse({
|
|
value: a0.value,
|
|
issues: []
|
|
}, {
|
|
...a1,
|
|
skipChecks: true
|
|
});
|
|
if (r44 instanceof Promise) {
|
|
r62 = r44.then((result) => {
|
|
let r26;
|
|
const r2 = env19440;
|
|
const r3 = env19440[3];
|
|
let env30490;
|
|
const r5 = env30490 = {
|
|
$parent: r2
|
|
};
|
|
env30490[0] = a1;
|
|
if (c8316_10.aborted(result)) {
|
|
result.aborted = true;
|
|
r26 = result;
|
|
} else {
|
|
const r20 = (0, env19440[2])(a0, env19440[1], a1);
|
|
if (r20 instanceof Promise) {
|
|
if (a1.async === false) {
|
|
throw new c8316_8.$ZodAsyncError();
|
|
}
|
|
r26 = r20.then($mk108630(r5));
|
|
} else {
|
|
r26 = env19440[0]._zod.parse(r20, a1);
|
|
}
|
|
}
|
|
return r26;
|
|
});
|
|
} else {
|
|
let env27232;
|
|
const r50 = env27232 = {
|
|
$parent: env19440
|
|
};
|
|
env27232[0] = a1;
|
|
if (c8316_10.aborted(r44)) {
|
|
r44.aborted = true;
|
|
r62 = r44;
|
|
} else {
|
|
const r57 = (0, env19440[2])(a0, env19440[1], a1);
|
|
if (r57 instanceof Promise) {
|
|
if (a1.async === false) {
|
|
throw new c8316_8.$ZodAsyncError();
|
|
}
|
|
r62 = r57.then($mk108630(r50));
|
|
} else {
|
|
r62 = r38._zod.parse(r57, a1);
|
|
}
|
|
}
|
|
}
|
|
return r62;
|
|
}
|
|
const r9 = env19440[0]._zod.parse(a0, a1);
|
|
if (r9 instanceof Promise) {
|
|
if (a1.async === false) {
|
|
throw new c8316_8.$ZodAsyncError();
|
|
}
|
|
return r9.then((result) => (0, env19440[2])(result, env19440[1], a1));
|
|
}
|
|
return (0, env19440[2])(r9, env19440[1], a1);
|
|
};
|
|
}
|
|
c8316_10.defineLazy(r5, "~standard", () => ({
|
|
validate: (a0) => {
|
|
let r19;
|
|
try {
|
|
const r12 = (0, safeParse)(env19440[0], a0);
|
|
r19 = r12.success ? {
|
|
value: r12.data
|
|
} : {
|
|
issues: r12.error?.issues
|
|
};
|
|
} catch ($e) {
|
|
return (0, safeParseAsync)(env19440[0], a0).then((result) => result.success ? {
|
|
value: result.data
|
|
} : {
|
|
issues: result.error?.issues
|
|
});
|
|
}
|
|
return r19;
|
|
},
|
|
vendor: "zod",
|
|
version: 1
|
|
}));
|
|
});
|
|
Object.defineProperty(exports, "clone", {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _mergeDefs.clone;
|
|
}
|
|
});
|
|
exports.$ZodString = c8316_8.$constructor("$ZodString", (a0, a1) => {
|
|
const inst = a0;
|
|
let c19441_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
const _zod = a0._zod;
|
|
let r17 = a0 == null ? void 0 : a0._zod.bag?.patterns;
|
|
if (r17 == null) {
|
|
r17 = [];
|
|
}
|
|
let pattern = [...r17].pop();
|
|
if (pattern == null) {
|
|
pattern = c8316_9.string(a0._zod.bag);
|
|
}
|
|
_zod.pattern = pattern;
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (c19441_1.coerce) {
|
|
try {
|
|
a0.value = String(a0.value);
|
|
} catch ($e) {}
|
|
}
|
|
if (typeof a0.value !== "string") {
|
|
a0.issues.push({
|
|
expected: "string",
|
|
code: "invalid_type",
|
|
input: a0.value,
|
|
inst
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodStringFormat = c8316_8.$constructor("$ZodStringFormat", (a0, a1) => {
|
|
c8316_7.$ZodCheckStringFormat.init(a0, a1);
|
|
exports.$ZodString.init(a0, a1);
|
|
});
|
|
exports.$ZodGUID = c8316_8.$constructor("$ZodGUID", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.guid;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodUUID = c8316_8.$constructor("$ZodUUID", (a0, a1) => {
|
|
if (a1.version) {
|
|
const r5 = ({
|
|
v1: 1,
|
|
v2: 2,
|
|
v3: 3,
|
|
v4: 4,
|
|
v5: 5,
|
|
v6: 6,
|
|
v7: 7,
|
|
v8: 8
|
|
})[a1.version];
|
|
if (r5 === void 0) {
|
|
throw new Error(`Invalid UUID version: "${a1.version}"`);
|
|
}
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.uuid(r5);
|
|
}
|
|
} else if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.uuid();
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodEmail = c8316_8.$constructor("$ZodEmail", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.email;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodURL = c8316_8.$constructor("$ZodURL", (a0, a1) => {
|
|
const inst2 = a0;
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.check = (a0) => {
|
|
try {
|
|
const r8 = a0.value.trim();
|
|
const uRL = new URL(r8);
|
|
if (a1.hostname) {
|
|
a1.hostname.lastIndex = 0;
|
|
if (!a1.hostname.test(uRL.hostname)) {
|
|
const issues = a0.issues;
|
|
issues.push({
|
|
code: "invalid_format",
|
|
format: "url",
|
|
note: "Invalid hostname",
|
|
pattern: a1.hostname.source,
|
|
input: a0.value,
|
|
inst: inst2,
|
|
continue: !a1.abort
|
|
});
|
|
}
|
|
}
|
|
if (a1.protocol) {
|
|
a1.protocol.lastIndex = 0;
|
|
const protocol2 = a1.protocol;
|
|
const r51 = uRL.protocol.endsWith(":");
|
|
const protocol = uRL.protocol;
|
|
if (!protocol2.test(r51 ? protocol.slice(0, -1) : protocol)) {
|
|
const issues2 = a0.issues;
|
|
issues2.push({
|
|
code: "invalid_format",
|
|
format: "url",
|
|
note: "Invalid protocol",
|
|
pattern: a1.protocol.source,
|
|
input: a0.value,
|
|
inst: inst2,
|
|
continue: !a1.abort
|
|
});
|
|
}
|
|
}
|
|
if (a1.normalize) {
|
|
a0.value = uRL.href;
|
|
} else {
|
|
a0.value = r8;
|
|
}
|
|
} catch ($e) {
|
|
a0.issues.push({
|
|
code: "invalid_format",
|
|
format: "url",
|
|
input: a0.value,
|
|
inst: inst2,
|
|
continue: !a1.abort
|
|
});
|
|
return void 0;
|
|
}
|
|
};
|
|
});
|
|
exports.$ZodEmoji = c8316_8.$constructor("$ZodEmoji", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.emoji();
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodNanoID = c8316_8.$constructor("$ZodNanoID", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.nanoid;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodCUID = c8316_8.$constructor("$ZodCUID", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.cuid;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodCUID2 = c8316_8.$constructor("$ZodCUID2", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.cuid2;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodULID = c8316_8.$constructor("$ZodULID", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.ulid;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodXID = c8316_8.$constructor("$ZodXID", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.xid;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodKSUID = c8316_8.$constructor("$ZodKSUID", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.ksuid;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodISODateTime = c8316_8.$constructor("$ZodISODateTime", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.datetime(a1);
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodISODate = c8316_8.$constructor("$ZodISODate", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.date;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodISOTime = c8316_8.$constructor("$ZodISOTime", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.time(a1);
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodISODuration = c8316_8.$constructor("$ZodISODuration", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.duration;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodIPv4 = c8316_8.$constructor("$ZodIPv4", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.ipv4;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.bag.format = "ipv4";
|
|
});
|
|
exports.$ZodIPv6 = c8316_8.$constructor("$ZodIPv6", (a0, a1) => {
|
|
const inst3 = a0;
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.ipv6;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.bag.format = "ipv6";
|
|
a0._zod.check = (a0) => {
|
|
try {
|
|
new URL(`http://[${a0.value}]`);
|
|
} catch ($e) {
|
|
a0.issues.push({
|
|
code: "invalid_format",
|
|
format: "ipv6",
|
|
input: a0.value,
|
|
inst: inst3,
|
|
continue: !a1.abort
|
|
});
|
|
}
|
|
};
|
|
});
|
|
exports.$ZodMAC = c8316_8.$constructor("$ZodMAC", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.mac(a1.delimiter);
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.bag.format = "mac";
|
|
});
|
|
exports.$ZodCIDRv4 = c8316_8.$constructor("$ZodCIDRv4", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.cidrv4;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodCIDRv6 = c8316_8.$constructor("$ZodCIDRv6", (a0, a1) => {
|
|
const inst4 = a0;
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.cidrv6;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.check = (a0) => {
|
|
const r12 = a0.value.split("/");
|
|
L12: {
|
|
try {
|
|
if (r12.length !== 2) {
|
|
throw new Error();
|
|
}
|
|
const [r18, r19] = r12;
|
|
if (r19) {
|
|
const r8 = Number(r19);
|
|
if (`${r8}` !== r19) {
|
|
throw new Error();
|
|
}
|
|
if (!(r8 < 0) && !(r8 > 128)) {
|
|
new URL(`http://[${r18}]`);
|
|
break L12;
|
|
}
|
|
throw new Error();
|
|
}
|
|
throw new Error();
|
|
} catch ($e) {
|
|
a0.issues.push({
|
|
code: "invalid_format",
|
|
format: "cidrv6",
|
|
input: a0.value,
|
|
inst: inst4,
|
|
continue: !a1.abort
|
|
});
|
|
}
|
|
}
|
|
};
|
|
});
|
|
exports.$ZodBase64 = c8316_8.$constructor("$ZodBase64", (a0, a1) => {
|
|
const inst5 = a0;
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.base64;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.bag.contentEncoding = "base64";
|
|
a0._zod.check = (a0) => {
|
|
if (!isValidBase64(a0.value)) {
|
|
a0.issues.push({
|
|
code: "invalid_format",
|
|
format: "base64",
|
|
input: a0.value,
|
|
inst: inst5,
|
|
continue: !a1.abort
|
|
});
|
|
}
|
|
};
|
|
});
|
|
exports.$ZodBase64URL = c8316_8.$constructor("$ZodBase64URL", (a0, a1) => {
|
|
const inst6 = a0;
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.base64url;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.bag.contentEncoding = "base64url";
|
|
a0._zod.check = (a0) => {
|
|
const value10 = a0.value;
|
|
const r12 = c8316_9.base64url.test(value10);
|
|
let r2 = false;
|
|
if (r12) {
|
|
const r15 = value10.replace(/[-_]/g, $mk88814());
|
|
r2 = isValidBase64(r15.padEnd(4 * Math.ceil(r15.length / 4), "="));
|
|
}
|
|
if (!r2) {
|
|
a0.issues.push({
|
|
code: "invalid_format",
|
|
format: "base64url",
|
|
input: a0.value,
|
|
inst: inst6,
|
|
continue: !a1.abort
|
|
});
|
|
}
|
|
};
|
|
});
|
|
exports.$ZodE164 = c8316_8.$constructor("$ZodE164", (a0, a1) => {
|
|
if (a1.pattern == null) {
|
|
a1.pattern = c8316_9.e164;
|
|
}
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
});
|
|
exports.$ZodJWT = c8316_8.$constructor("$ZodJWT", (a0, a1) => {
|
|
const inst7 = a0;
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.check = (a0) => {
|
|
const value10 = a0.value;
|
|
if (!isValidJWT(value10, a1.alg)) {
|
|
a0.issues.push({
|
|
code: "invalid_format",
|
|
format: "jwt",
|
|
input: a0.value,
|
|
inst: inst7,
|
|
continue: !a1.abort
|
|
});
|
|
}
|
|
};
|
|
});
|
|
exports.$ZodCustomStringFormat = c8316_8.$constructor("$ZodCustomStringFormat", (a0, a1) => {
|
|
const inst8 = a0;
|
|
exports.$ZodStringFormat.init(a0, a1);
|
|
a0._zod.check = (a0) => {
|
|
if (!a1.fn(a0.value)) {
|
|
a0.issues.push({
|
|
code: "invalid_format",
|
|
format: a1.format,
|
|
input: a0.value,
|
|
inst: inst8,
|
|
continue: !a1.abort
|
|
});
|
|
}
|
|
};
|
|
});
|
|
exports.$ZodNumber = c8316_8.$constructor("$ZodNumber", (a0, a1) => {
|
|
const inst9 = a0;
|
|
let c19449_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
const _zod = a0._zod;
|
|
let pattern = a0._zod.bag.pattern;
|
|
if (pattern == null) {
|
|
pattern = c8316_9.number;
|
|
}
|
|
_zod.pattern = pattern;
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (c19449_1.coerce) {
|
|
try {
|
|
a0.value = Number(a0.value);
|
|
} catch ($e) {}
|
|
}
|
|
const value10 = a0.value;
|
|
if (typeof value10 === "number" && !Number.isNaN(value10) && Number.isFinite(value10)) {
|
|
return a0;
|
|
}
|
|
const received = typeof value10 === "number" ? Number.isNaN(value10) ? "NaN" : Number.isFinite(value10) ? void 0 : "Infinity" : void 0;
|
|
a0.issues.push({
|
|
expected: "number",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst9,
|
|
...received ? {
|
|
received
|
|
} : {}
|
|
});
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodNumberFormat = c8316_8.$constructor("$ZodNumberFormat", (a0, a1) => {
|
|
c8316_7.$ZodCheckNumberFormat.init(a0, a1);
|
|
exports.$ZodNumber.init(a0, a1);
|
|
});
|
|
exports.$ZodBoolean = c8316_8.$constructor("$ZodBoolean", (a0, a1) => {
|
|
const inst10 = a0;
|
|
let c19450_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.pattern = c8316_9.boolean;
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (c19450_1.coerce) {
|
|
try {
|
|
a0.value = Boolean(a0.value);
|
|
} catch ($e) {}
|
|
}
|
|
const value10 = a0.value;
|
|
if (typeof value10 !== "boolean") {
|
|
a0.issues.push({
|
|
expected: "boolean",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst10
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodBigInt = c8316_8.$constructor("$ZodBigInt", (a0, a1) => {
|
|
const inst11 = a0;
|
|
let c19451_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.pattern = c8316_9.bigint;
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (c19451_1.coerce) {
|
|
try {
|
|
a0.value = BigInt(a0.value);
|
|
} catch ($e) {}
|
|
}
|
|
if (typeof a0.value !== "bigint") {
|
|
a0.issues.push({
|
|
expected: "bigint",
|
|
code: "invalid_type",
|
|
input: a0.value,
|
|
inst: inst11
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodBigIntFormat = c8316_8.$constructor("$ZodBigIntFormat", (a0, a1) => {
|
|
c8316_7.$ZodCheckBigIntFormat.init(a0, a1);
|
|
exports.$ZodBigInt.init(a0, a1);
|
|
});
|
|
exports.$ZodSymbol = c8316_8.$constructor("$ZodSymbol", (a0, a1) => {
|
|
const inst12 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
const value10 = a0.value;
|
|
if (typeof value10 !== "symbol") {
|
|
a0.issues.push({
|
|
expected: "symbol",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst12
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodUndefined = c8316_8.$constructor("$ZodUndefined", (a0, a1) => {
|
|
const inst13 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.pattern = c8316_9.undefined;
|
|
a0._zod.values = new Set([void 0]);
|
|
a0._zod.optin = "optional";
|
|
a0._zod.optout = "optional";
|
|
a0._zod.parse = (a0, a1) => {
|
|
const value10 = a0.value;
|
|
if (value10 !== void 0) {
|
|
a0.issues.push({
|
|
expected: "undefined",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst13
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodNull = c8316_8.$constructor("$ZodNull", (a0, a1) => {
|
|
const inst14 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.pattern = c8316_9.null;
|
|
a0._zod.values = new Set([null]);
|
|
a0._zod.parse = (a0, a1) => {
|
|
const value10 = a0.value;
|
|
if (value10 !== null) {
|
|
a0.issues.push({
|
|
expected: "null",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst14
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodAny = c8316_8.$constructor("$ZodAny", (a0, a1) => {
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0) => a0;
|
|
});
|
|
exports.$ZodUnknown = c8316_8.$constructor("$ZodUnknown", (a0, a1) => {
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0) => a0;
|
|
});
|
|
exports.$ZodNever = c8316_8.$constructor("$ZodNever", (a0, a1) => {
|
|
const inst15 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
a0.issues.push({
|
|
expected: "never",
|
|
code: "invalid_type",
|
|
input: a0.value,
|
|
inst: inst15
|
|
});
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodVoid = c8316_8.$constructor("$ZodVoid", (a0, a1) => {
|
|
const inst16 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
const value10 = a0.value;
|
|
if (value10 !== void 0) {
|
|
a0.issues.push({
|
|
expected: "void",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst16
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodDate = c8316_8.$constructor("$ZodDate", (a0, a1) => {
|
|
const inst17 = a0;
|
|
let c19457_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (c19457_1.coerce) {
|
|
try {
|
|
a0.value = new Date(a0.value);
|
|
} catch ($e) {}
|
|
}
|
|
const value10 = a0.value;
|
|
const r5 = value10 instanceof Date;
|
|
if (!(r5 && !Number.isNaN(value10.getTime()))) {
|
|
a0.issues.push({
|
|
expected: "date",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
...r5 ? {
|
|
received: "Invalid Date"
|
|
} : {},
|
|
inst: inst17
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodArray = c8316_8.$constructor("$ZodArray", (a0, a1) => {
|
|
const inst18 = a0;
|
|
let c19458_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
let env27233 = {
|
|
$parent: env8316
|
|
};
|
|
let r6 = a0;
|
|
env27233[0] = a0;
|
|
const value10 = a0.value;
|
|
if (Array.isArray(value10)) {
|
|
a0.value = Array(value10.length);
|
|
const r31 = [];
|
|
const r33 = 0 < value10.length;
|
|
let r0 = 0;
|
|
if (r33) {
|
|
do {
|
|
let c27234_0 = r0;
|
|
const r40 = c19458_1.element._zod.run({
|
|
value: value10[r0],
|
|
issues: []
|
|
}, a1);
|
|
const r42 = r40 instanceof Promise;
|
|
const r1 = r0;
|
|
if (r42) {
|
|
r31.push(r40.then((result) => {
|
|
const r13 = env27233[0];
|
|
if (result.issues.length) {
|
|
const issues = r13.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(c27234_0, result.issues)]);
|
|
}
|
|
r13.value[c27234_0] = result.value;
|
|
}));
|
|
} else {
|
|
if (r40.issues.length) {
|
|
const issues = a0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(r1, r40.issues)]);
|
|
}
|
|
a0.value[r1] = r40.value;
|
|
}
|
|
r0 = r1 + 1;
|
|
} while (r0 < value10.length);
|
|
}
|
|
if (r31.length) {
|
|
r6 = Promise.all(r31).then(() => env27233[0]);
|
|
}
|
|
return r6;
|
|
}
|
|
a0.issues.push({
|
|
expected: "array",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst18
|
|
});
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodObject = c8316_8.$constructor("$ZodObject", (a0, a1) => {
|
|
let shape, c19459_3, value, isObject, catchall;
|
|
const inst19 = a0;
|
|
let c19459_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
if (!Object.getOwnPropertyDescriptor(a1, "shape")?.get) {
|
|
shape = a1.shape;
|
|
Object.defineProperty(a1, "shape", {
|
|
get: () => {
|
|
const value10 = {
|
|
...shape
|
|
};
|
|
Object.defineProperty(c19459_1, "shape", {
|
|
value: value10
|
|
});
|
|
return value10;
|
|
}
|
|
});
|
|
}
|
|
c19459_3 = c8316_10.cached(() => normalizeDef(c19459_1));
|
|
c8316_10.defineLazy(a0._zod, "propValues", () => {
|
|
const shape3 = c19459_1.shape;
|
|
const r28 = {};
|
|
for (const key in shape3) {
|
|
const _zod = shape3[key]._zod;
|
|
if (_zod.values) {
|
|
if (r28[key] == null) {
|
|
r28[key] = new Set();
|
|
}
|
|
for (const value10 of _zod.values) {
|
|
r28[key].add(value10);
|
|
}
|
|
}
|
|
}
|
|
return r28;
|
|
});
|
|
isObject = c8316_10.isObject;
|
|
catchall = a1.catchall;
|
|
a0._zod.parse = (a0, a1) => {
|
|
let c27235_0 = a0;
|
|
if (value == null) {
|
|
value = c19459_3.value;
|
|
}
|
|
const value4 = a0.value;
|
|
if (!isObject(value4)) {
|
|
a0.issues.push({
|
|
expected: "object",
|
|
code: "invalid_type",
|
|
input: value4,
|
|
inst: inst19
|
|
});
|
|
return a0;
|
|
}
|
|
a0.value = {};
|
|
const r38 = [];
|
|
let c27235_3 = r38;
|
|
const shape2 = value.shape;
|
|
const _loop4 = function _loop4(a0) {
|
|
let c30491_0, c30491_1;
|
|
L10: {
|
|
c30491_0 = a0;
|
|
const r17 = shape2[a0];
|
|
const r1 = r17._zod.optout === "optional";
|
|
c30491_1 = r1;
|
|
const r24 = r17._zod.run({
|
|
value: value4[a0],
|
|
issues: []
|
|
}, a1);
|
|
if (r24 instanceof Promise) {
|
|
c27235_3.push(r24.then((result) => {
|
|
L8: {
|
|
if (result.issues.length) {
|
|
if (c30491_1 && !(c30491_0 in value4)) {
|
|
break L8;
|
|
}
|
|
const issues = c27235_0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(c30491_0, result.issues)]);
|
|
}
|
|
if (result.value === void 0) {
|
|
if (c30491_0 in value4) {
|
|
c27235_0.value[c30491_0] = void 0;
|
|
}
|
|
} else {
|
|
c27235_0.value[c30491_0] = result.value;
|
|
}
|
|
}
|
|
}));
|
|
} else {
|
|
if (r24.issues.length) {
|
|
if (r1 && !(a0 in value4)) {
|
|
break L10;
|
|
}
|
|
const issues = c27235_0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(a0, r24.issues)]);
|
|
}
|
|
if (r24.value === void 0) {
|
|
if (a0 in value4) {
|
|
c27235_0.value[a0] = void 0;
|
|
}
|
|
} else {
|
|
c27235_0.value[a0] = r24.value;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
for (const key of value.keys) {
|
|
_loop4(key);
|
|
}
|
|
return catchall ? handleCatchall(r38, value4, a0, a1, c19459_3.value, inst19) : r38.length ? Promise.all(r38).then(() => c27235_0) : a0;
|
|
};
|
|
});
|
|
exports.$ZodObjectJIT = c8316_8.$constructor("$ZodObjectJIT", (a0, a1) => {
|
|
let c19460_2, value2, isObject2, c19460_7, value3, catchall2;
|
|
const inst20 = a0;
|
|
let c19460_1 = a1;
|
|
exports.$ZodObject.init(a0, a1);
|
|
const parse = a0._zod.parse;
|
|
let c19460_5 = c8316_10.cached(() => normalizeDef(c19460_1));
|
|
isObject2 = c8316_10.isObject;
|
|
const jitless = c8316_8.globalConfig.jitless;
|
|
let r19 = !jitless;
|
|
c19460_7 = r19;
|
|
const allowsEval = c8316_10.allowsEval;
|
|
if (!jitless) {
|
|
r19 = allowsEval.value;
|
|
}
|
|
value3 = r19;
|
|
catchall2 = a1.catchall;
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r27, r35;
|
|
if (value2 == null) {
|
|
value2 = c19460_5.value;
|
|
}
|
|
const value10 = a0.value;
|
|
if (isObject2(value10)) {
|
|
if (c19460_7 && value3) {
|
|
if (a1?.async === false && a1.jitless !== true) {
|
|
let r36 = c19460_2;
|
|
if (!r36) {
|
|
const r39 = ((a0) => {
|
|
let r67, r68;
|
|
let c30492_1;
|
|
let c30492_0 = a0;
|
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
const value10 = c19460_5.value;
|
|
const parseStr = (a0) => {
|
|
const r4 = c8316_10.esc(a0);
|
|
return `shape[${r4}]._zod.run({ value: input[${r4}], issues: [] }, ctx)`;
|
|
};
|
|
doc.write("const input = payload.value;");
|
|
const r23 = Object.create(null);
|
|
let r81 = 0;
|
|
let r83 = value10.keys[Symbol.iterator]();
|
|
const next = r83.next;
|
|
while (true) {
|
|
const r8 = r83 === void 0 ? void 0 : (r67 = next.call(r83)).done ? r83 = void 0 : r67.value;
|
|
if (r83 === void 0) {
|
|
doc.write("const newResult = {};");
|
|
let r95 = value10.keys[Symbol.iterator]();
|
|
const next2 = r95.next;
|
|
const r18 = "] = undefined;\n }\n } else {\n newResult[";
|
|
const r15 = "]\n })));\n }\n }\n \n if (";
|
|
const r13 = ".issues.map(iss => ({\n ...iss,\n path: iss.path ? [";
|
|
const r12 = " in input) {\n payload.issues = payload.issues.concat(";
|
|
const r9 = "]\n })));\n }\n \n if (";
|
|
const r97 = ".issues.map(iss => ({\n ...iss,\n path: iss.path ? [";
|
|
const r98 = ".issues.length) {\n payload.issues = payload.issues.concat(";
|
|
while (true) {
|
|
const r103 = r95 === void 0 ? void 0 : (r68 = next2.call(r95)).done ? r95 = void 0 : r68.value;
|
|
if (r95 === void 0) {
|
|
doc.write("payload.value = newResult;");
|
|
doc.write("return payload;");
|
|
c30492_1 = doc.compile();
|
|
return (a0, a1) => c30492_1(c30492_0, a0, a1);
|
|
}
|
|
try {
|
|
const r105 = r23[r103];
|
|
const r107 = c8316_10.esc(r103);
|
|
const r108 = a0[r103];
|
|
const r110 = r108 == null ? void 0 : r108._zod?.optout;
|
|
doc.write(`const ${r105} = ${parseStr(r103)};`);
|
|
if (r110 === "optional") {
|
|
doc.write(`
|
|
if (${r105}.issues.length) {
|
|
if (${r107}${r12}${r105}${r13}${r107}, ...iss.path] : [${r107}${r15}${r105}.value === undefined) {
|
|
if (${r107} in input) {
|
|
newResult[${r107}${r18}${r107}] = ${r105}.value;
|
|
}
|
|
|
|
`);
|
|
} else {
|
|
doc.write(`
|
|
if (${r105}${r98}${r105}${r97}${r107}, ...iss.path] : [${r107}${r9}${r105}.value === undefined) {
|
|
if (${r107} in input) {
|
|
newResult[${r107}${r18}${r107}] = ${r105}.value;
|
|
}
|
|
|
|
`);
|
|
}
|
|
} catch (r158) {
|
|
if (r95 !== void 0 && typeof r95.return === "function") {
|
|
try {
|
|
r95.return();
|
|
} catch {}
|
|
}
|
|
throw r158;
|
|
}
|
|
}
|
|
} else {
|
|
try {
|
|
const r88 = +r81;
|
|
r81 = r88 + 1;
|
|
r23[r8] = "key_" + r88;
|
|
} catch (r90) {
|
|
if (r83 !== void 0 && typeof r83.return === "function") {
|
|
try {
|
|
r83.return();
|
|
} catch {}
|
|
}
|
|
throw r90;
|
|
}
|
|
}
|
|
}
|
|
})(c19460_1.shape);
|
|
c19460_2 = r39;
|
|
r36 = r39;
|
|
}
|
|
const r11 = r36(a0, a1);
|
|
r35 = catchall2 ? handleCatchall([], value10, r11, a1, value2, inst20) : r11;
|
|
} else {
|
|
r35 = parse(a0, a1);
|
|
}
|
|
} else {
|
|
r35 = parse(a0, a1);
|
|
}
|
|
r27 = r35;
|
|
} else {
|
|
a0.issues.push({
|
|
expected: "object",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst20
|
|
});
|
|
r27 = a0;
|
|
}
|
|
return r27;
|
|
};
|
|
});
|
|
exports.$ZodUnion = c8316_8.$constructor("$ZodUnion", (a0, a1) => {
|
|
let c19461_2, run;
|
|
let c19461_0 = a0;
|
|
let c19461_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "optin", () => c19461_1.options.some((option) => option._zod.optin === "optional") ? "optional" : void 0);
|
|
c8316_10.defineLazy(a0._zod, "optout", () => c19461_1.options.some((option) => option._zod.optout === "optional") ? "optional" : void 0);
|
|
c8316_10.defineLazy(a0._zod, "values", () => {
|
|
if (c19461_1.options.every((option) => option._zod.values)) {
|
|
return new Set(c19461_1.options.flatMap((option) => Array.from(option._zod.values)));
|
|
}
|
|
});
|
|
c8316_10.defineLazy(a0._zod, "pattern", () => {
|
|
if (c19461_1.options.every((option) => option._zod.pattern)) {
|
|
return new RegExp(`^(${c19461_1.options.map((option) => option._zod.pattern).map((item) => c8316_10.cleanRegex(item.source)).join("|")})\$`);
|
|
}
|
|
});
|
|
c19461_2 = a1.options.length === 1;
|
|
run = a1.options[0]._zod.run;
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (c19461_2) {
|
|
return run(a0, a1);
|
|
}
|
|
let r31 = false;
|
|
const r8 = [];
|
|
for (const option of c19461_1.options) {
|
|
const r40 = option._zod.run({
|
|
value: a0.value,
|
|
issues: []
|
|
}, a1);
|
|
if (r40 instanceof Promise) {
|
|
r8.push(r40);
|
|
r31 = true;
|
|
continue;
|
|
}
|
|
if (r40.issues.length !== 0) {
|
|
r8.push(r40);
|
|
continue;
|
|
}
|
|
return r40;
|
|
}
|
|
return r31 ? Promise.all(r8).then((result) => handleUnionResults(result, a0, c19461_0, a1)) : handleUnionResults(r8, a0, c19461_0, a1);
|
|
};
|
|
});
|
|
exports.$ZodXor = c8316_8.$constructor("$ZodXor", (a0, a1) => {
|
|
const inst21 = a0;
|
|
let c19462_1 = a1;
|
|
exports.$ZodUnion.init(a0, a1);
|
|
a1.inclusive = false;
|
|
let c19462_2 = a1.options.length === 1;
|
|
const run2 = a1.options[0]._zod.run;
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r49;
|
|
if (c19462_2) {
|
|
return run2(a0, a1);
|
|
}
|
|
let r30 = false;
|
|
const r8 = [];
|
|
for (const option of c19462_1.options) {
|
|
const r39 = option._zod.run({
|
|
value: a0.value,
|
|
issues: []
|
|
}, a1);
|
|
const r42 = r39 instanceof Promise;
|
|
r8.push(r39);
|
|
if (r42) {
|
|
r30 = true;
|
|
}
|
|
}
|
|
if (r30) {
|
|
r49 = Promise.all(r8).then((result) => {
|
|
let env30493;
|
|
const r7 = env30493 = {
|
|
$parent: env8316
|
|
};
|
|
env30493[0] = a1;
|
|
const r15 = result.filter($mk88818());
|
|
if (r15.length === 1) {
|
|
a0.value = r15[0].value;
|
|
} else if (r15.length === 0) {
|
|
a0.issues.push({
|
|
code: "invalid_union",
|
|
input: a0.value,
|
|
inst: inst21,
|
|
errors: result.map($mk88819(r7))
|
|
});
|
|
} else {
|
|
a0.issues.push({
|
|
code: "invalid_union",
|
|
input: a0.value,
|
|
inst: inst21,
|
|
errors: [],
|
|
inclusive: false
|
|
});
|
|
}
|
|
return a0;
|
|
});
|
|
} else {
|
|
handleExclusiveUnionResults(r8, a0, inst21, a1);
|
|
r49 = a0;
|
|
}
|
|
return r49;
|
|
};
|
|
});
|
|
exports.$ZodDiscriminatedUnion = c8316_8.$constructor("$ZodDiscriminatedUnion", (a0, a1) => {
|
|
let c19463_3;
|
|
const inst22 = a0;
|
|
let c19463_1 = a1;
|
|
a1.inclusive = false;
|
|
exports.$ZodUnion.init(a0, a1);
|
|
const parse2 = a0._zod.parse;
|
|
c8316_10.defineLazy(a0._zod, "propValues", () => {
|
|
const r0 = {};
|
|
for (const option of c19463_1.options) {
|
|
const propValues = option._zod.propValues;
|
|
if (propValues && Object.keys(propValues).length !== 0) {
|
|
for (const item of Object.entries(propValues)) {
|
|
const [r57, r59] = item;
|
|
if (!r0[r57]) {
|
|
r0[r57] = new Set();
|
|
}
|
|
for (const item2 of r59) {
|
|
r0[r57].add(item2);
|
|
}
|
|
}
|
|
continue;
|
|
}
|
|
throw new Error(`Invalid discriminated union option at index "${c19463_1.options.indexOf(option)}"`);
|
|
}
|
|
return r0;
|
|
});
|
|
c19463_3 = c8316_10.cached(() => {
|
|
const options = c19463_1.options;
|
|
const map = new Map();
|
|
for (const item2 of options) {
|
|
const propValues = item2._zod.propValues;
|
|
const r40 = propValues == null ? void 0 : propValues[c19463_1.discriminator];
|
|
if (r40 && r40.size !== 0) {
|
|
for (const item of r40) {
|
|
if (map.has(item)) {
|
|
throw new Error(`Duplicate discriminator value "${String(item)}"`);
|
|
}
|
|
map.set(item, item2);
|
|
}
|
|
continue;
|
|
}
|
|
throw new Error(`Invalid discriminated union option at index "${c19463_1.options.indexOf(item2)}"`);
|
|
}
|
|
return map;
|
|
});
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r34;
|
|
const value10 = a0.value;
|
|
if (c8316_10.isObject(value10)) {
|
|
const r25 = c19463_3.value.get(value10 == null ? void 0 : value10[c19463_1.discriminator]);
|
|
if (r25) {
|
|
r34 = r25._zod.run(a0, a1);
|
|
} else if (c19463_1.unionFallback) {
|
|
r34 = parse2(a0, a1);
|
|
} else {
|
|
a0.issues.push({
|
|
code: "invalid_union",
|
|
errors: [],
|
|
note: "No matching discriminator",
|
|
discriminator: c19463_1.discriminator,
|
|
input: value10,
|
|
path: [c19463_1.discriminator],
|
|
inst: inst22
|
|
});
|
|
r34 = a0;
|
|
}
|
|
return r34;
|
|
}
|
|
a0.issues.push({
|
|
code: "invalid_type",
|
|
expected: "object",
|
|
input: value10,
|
|
inst: inst22
|
|
});
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodIntersection = c8316_8.$constructor("$ZodIntersection", (a0, a1) => {
|
|
let c19464_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r2 = a0;
|
|
const value10 = a0.value;
|
|
const r14 = c19464_0.left._zod.run({
|
|
value: value10,
|
|
issues: []
|
|
}, a1);
|
|
const r20 = c19464_0.right._zod.run({
|
|
value: value10,
|
|
issues: []
|
|
}, a1);
|
|
if (!(r14 instanceof Promise) && !(r20 instanceof Promise)) {
|
|
handleIntersectionResults(a0, r14, r20);
|
|
} else {
|
|
r2 = Promise.all([r14, r20]).then((result) => {
|
|
const [r25, r26] = result;
|
|
handleIntersectionResults(a0, r25, r26);
|
|
return a0;
|
|
});
|
|
}
|
|
return r2;
|
|
};
|
|
});
|
|
exports.$ZodTuple = c8316_8.$constructor("$ZodTuple", (a0, a1) => {
|
|
const inst23 = a0;
|
|
let c19465_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
const items = a1.items;
|
|
a0._zod.parse = (a0, a1) => {
|
|
let c27239_1;
|
|
let r0 = a0;
|
|
const value10 = a0.value;
|
|
if (!Array.isArray(value10)) {
|
|
a0.issues.push({
|
|
input: value10,
|
|
inst: inst23,
|
|
expected: "tuple",
|
|
code: "invalid_type"
|
|
});
|
|
return a0;
|
|
}
|
|
a0.value = [];
|
|
const r41 = [];
|
|
const r18 = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
const r49 = r18 !== -1 ? items.length - r18 : 0;
|
|
L11: {
|
|
if (!c19465_1.rest) {
|
|
const r55 = value10.length > items.length;
|
|
const r58 = value10.length < r49 - 1;
|
|
if (!r55 && !r58) {
|
|
break L11;
|
|
}
|
|
a0.issues.push({
|
|
...r55 ? {
|
|
code: "too_big",
|
|
maximum: items.length,
|
|
inclusive: true
|
|
} : {
|
|
code: "too_small",
|
|
minimum: items.length
|
|
},
|
|
input: value10,
|
|
inst: inst23,
|
|
origin: "array"
|
|
});
|
|
return a0;
|
|
}
|
|
}
|
|
let r70 = -1;
|
|
c27239_1 = -1;
|
|
for (const item of items) {
|
|
const r79 = r70 + 1;
|
|
r70 = r79;
|
|
c27239_1 = r79;
|
|
if (r79 >= value10.length && r70 >= r49) {
|
|
continue;
|
|
}
|
|
const r89 = item._zod.run({
|
|
value: value10[r70],
|
|
issues: []
|
|
}, a1);
|
|
if (r89 instanceof Promise) {
|
|
r41.push(r89.then((result) => {
|
|
if (result.issues.length) {
|
|
const issues = a0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(c27239_1, result.issues)]);
|
|
}
|
|
a0.value[c27239_1] = result.value;
|
|
}));
|
|
} else {
|
|
handleTupleResult(r89, a0, r70);
|
|
}
|
|
}
|
|
if (c19465_1.rest) {
|
|
for (const item2 of value10.slice(items.length)) {
|
|
const r117 = r70 + 1;
|
|
r70 = r117;
|
|
c27239_1 = r117;
|
|
const r124 = c19465_1.rest._zod.run({
|
|
value: item2,
|
|
issues: []
|
|
}, a1);
|
|
if (r124 instanceof Promise) {
|
|
r41.push(r124.then((result) => {
|
|
if (result.issues.length) {
|
|
const issues = a0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(c27239_1, result.issues)]);
|
|
}
|
|
a0.value[c27239_1] = result.value;
|
|
}));
|
|
} else {
|
|
handleTupleResult(r124, a0, r70);
|
|
}
|
|
}
|
|
}
|
|
if (r41.length) {
|
|
r0 = Promise.all(r41).then(() => a0);
|
|
}
|
|
return r0;
|
|
};
|
|
});
|
|
exports.$ZodRecord = c8316_8.$constructor("$ZodRecord", (a0, a1) => {
|
|
const inst24 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, c27240_1) => {
|
|
let r17, r30;
|
|
let c27240_3, c27240_4;
|
|
let r0 = a0;
|
|
let c27240_0 = a0;
|
|
const value5 = a0.value;
|
|
if (c8316_10.isPlainObject(value5)) {
|
|
const r37 = [];
|
|
c27240_3 = r37;
|
|
const values = a1.keyType._zod.values;
|
|
a0.value = {};
|
|
if (values) {
|
|
const set = new Set();
|
|
c27240_4 = set;
|
|
const _loop5 = function _loop5(a0) {
|
|
if (!(typeof a0 !== "string" && (typeof a0 !== "number" && typeof a0 !== "symbol"))) {
|
|
c27240_4.add(typeof a0 === "number" ? a0.toString() : a0);
|
|
const r25 = a1.valueType._zod.run({
|
|
value: value5[a0],
|
|
issues: []
|
|
}, c27240_1);
|
|
if (r25 instanceof Promise) {
|
|
c27240_3.push(r25.then((result) => {
|
|
if (result.issues.length) {
|
|
const issues = c27240_0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(a0, result.issues)]);
|
|
}
|
|
c27240_0.value[a0] = result.value;
|
|
}));
|
|
} else {
|
|
if (r25.issues.length) {
|
|
const issues = c27240_0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(a0, r25.issues)]);
|
|
}
|
|
c27240_0.value[a0] = r25.value;
|
|
}
|
|
}
|
|
};
|
|
let r57 = values[Symbol.iterator]();
|
|
const next = r57.next;
|
|
while (true) {
|
|
const r62 = r57 === void 0 ? void 0 : (r30 = next.call(r57)).done ? r57 = void 0 : r30.value;
|
|
if (r57 === void 0) {
|
|
let r68 = void 0;
|
|
let keys = void 0;
|
|
for (const key in value5) {
|
|
r17 = r68;
|
|
keys = r17;
|
|
const r73 = set.has(key);
|
|
r68 = r17;
|
|
if (!r73) {
|
|
const r74 = r17 == null ? [] : r17;
|
|
r74.push(key);
|
|
r68 = r74;
|
|
}
|
|
}
|
|
r17 = r68;
|
|
keys = r17;
|
|
if (!(keys && keys.length > 0)) {
|
|
break;
|
|
}
|
|
a0.issues.push({
|
|
code: "unrecognized_keys",
|
|
input: value5,
|
|
inst: inst24,
|
|
keys
|
|
});
|
|
break;
|
|
}
|
|
try {
|
|
_loop5(r62);
|
|
} catch (r65) {
|
|
if (r57 !== void 0 && typeof r57.return === "function") {
|
|
try {
|
|
r57.return();
|
|
} catch {}
|
|
}
|
|
throw r65;
|
|
}
|
|
}
|
|
} else {
|
|
const _loop6 = function _loop6(a0) {
|
|
if (a0 === "__proto__") {
|
|
return 0;
|
|
}
|
|
const _zod = a1.keyType._zod;
|
|
const r20 = {
|
|
value: a0,
|
|
issues: []
|
|
};
|
|
const r11 = _zod.run(r20, c27240_1);
|
|
let c30495_1 = r11;
|
|
if (r11 instanceof Promise) {
|
|
throw new Error("Async schemas not supported in object keys currently");
|
|
}
|
|
let r23 = r11;
|
|
if (typeof a0 === "string") {
|
|
const r28 = c8316_9.number.test(a0);
|
|
r23 = r11;
|
|
if (r28) {
|
|
const length2 = r11.issues.length;
|
|
r23 = r11;
|
|
if (length2) {
|
|
const r37 = a1.keyType._zod.run({
|
|
value: Number(a0),
|
|
issues: []
|
|
}, c27240_1);
|
|
if (r37 instanceof Promise) {
|
|
throw new Error("Async schemas not supported in object keys currently");
|
|
}
|
|
const length3 = r37.issues.length;
|
|
r23 = r11;
|
|
if (length3 === 0) {
|
|
c30495_1 = r37;
|
|
r23 = r37;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (r23.issues.length) {
|
|
if (a1.mode === "loose") {
|
|
c27240_0.value[a0] = value5[a0];
|
|
} else {
|
|
c27240_0.issues.push({
|
|
code: "invalid_key",
|
|
origin: "record",
|
|
issues: r23.issues.map((issue) => c8316_10.finalizeIssue(issue, c27240_1, c8316_8.config())),
|
|
input: a0,
|
|
path: [a0],
|
|
inst: inst24
|
|
});
|
|
}
|
|
return 0;
|
|
}
|
|
const r51 = a1.valueType._zod.run({
|
|
value: value5[a0],
|
|
issues: []
|
|
}, c27240_1);
|
|
if (r51 instanceof Promise) {
|
|
c27240_3.push(r51.then((result) => {
|
|
if (result.issues.length) {
|
|
const issues = c27240_0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(a0, result.issues)]);
|
|
}
|
|
c27240_0.value[c30495_1.value] = result.value;
|
|
}));
|
|
} else {
|
|
if (r51.issues.length) {
|
|
const issues = c27240_0.issues;
|
|
issues.push.apply(issues, [...c8316_10.prefixIssues(a0, r51.issues)]);
|
|
}
|
|
c27240_0.value[r23.value] = r51.value;
|
|
}
|
|
};
|
|
for (const item of Reflect.ownKeys(value5)) {
|
|
_loop6(item);
|
|
}
|
|
}
|
|
if (r37.length) {
|
|
r0 = Promise.all(r37).then(() => c27240_0);
|
|
}
|
|
return r0;
|
|
}
|
|
a0.issues.push({
|
|
expected: "record",
|
|
code: "invalid_type",
|
|
input: value5,
|
|
inst: inst24
|
|
});
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodMap = c8316_8.$constructor("$ZodMap", (a0, a1) => {
|
|
const inst25 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, c27241_1) => {
|
|
let value7;
|
|
let r0 = a0;
|
|
let c27241_0 = a0;
|
|
const value6 = a0.value;
|
|
if (!(value6 instanceof Map)) {
|
|
a0.issues.push({
|
|
expected: "map",
|
|
code: "invalid_type",
|
|
input: value6,
|
|
inst: inst25
|
|
});
|
|
return a0;
|
|
}
|
|
const r30 = [];
|
|
let c27241_3 = r30;
|
|
a0.value = new Map();
|
|
const _loop7 = function _loop7(a0) {
|
|
const _zod = a1.keyType._zod;
|
|
const r21 = {
|
|
value: a0,
|
|
issues: []
|
|
};
|
|
const r22 = _zod.run(r21, c27241_1);
|
|
const r29 = a1.valueType._zod.run({
|
|
value: value7,
|
|
issues: []
|
|
}, c27241_1);
|
|
if (!(r22 instanceof Promise) && !(r29 instanceof Promise)) {
|
|
handleMapResult(r22, r29, c27241_0, a0, value6, inst25, c27241_1);
|
|
} else {
|
|
c27241_3.push(Promise.all([r22, r29]).then((result) => {
|
|
const [r11, r10] = result;
|
|
handleMapResult(r11, r10, c27241_0, a0, value6, inst25, c27241_1);
|
|
}));
|
|
}
|
|
};
|
|
for (const item of value6) {
|
|
let r43;
|
|
[r43, value7] = item;
|
|
_loop7(r43);
|
|
}
|
|
if (r30.length) {
|
|
r0 = Promise.all(r30).then(() => c27241_0);
|
|
}
|
|
return r0;
|
|
};
|
|
});
|
|
exports.$ZodSet = c8316_8.$constructor("$ZodSet", (a0, a1) => {
|
|
const inst26 = a0;
|
|
let c19468_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r0 = a0;
|
|
const value10 = a0.value;
|
|
if (!(value10 instanceof Set)) {
|
|
a0.issues.push({
|
|
input: value10,
|
|
inst: inst26,
|
|
expected: "set",
|
|
code: "invalid_type"
|
|
});
|
|
return a0;
|
|
}
|
|
const r31 = [];
|
|
a0.value = new Set();
|
|
for (const item of value10) {
|
|
const r46 = c19468_1.valueType._zod.run({
|
|
value: item,
|
|
issues: []
|
|
}, a1);
|
|
if (r46 instanceof Promise) {
|
|
r31.push(r46.then((result) => {
|
|
if (result.issues.length) {
|
|
const issues = a0.issues;
|
|
issues.push.apply(issues, [...result.issues]);
|
|
}
|
|
a0.value.add(result.value);
|
|
}));
|
|
} else {
|
|
handleSetResult(r46, a0);
|
|
}
|
|
}
|
|
if (r31.length) {
|
|
r0 = Promise.all(r31).then(() => a0);
|
|
}
|
|
return r0;
|
|
};
|
|
});
|
|
exports.$ZodEnum = c8316_8.$constructor("$ZodEnum", (a0, a1) => {
|
|
const inst27 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
const enumValues = c8316_10.getEnumValues(a1.entries);
|
|
const set = new Set(enumValues);
|
|
let c19469_2 = set;
|
|
a0._zod.values = set;
|
|
a0._zod.pattern = new RegExp(`^(${enumValues.filter((enumValue) => c8316_10.propertyKeyTypes.has(typeof enumValue)).map((item) => typeof item === "string" ? c8316_10.escapeRegex(item) : item.toString()).join("|")})\$`);
|
|
a0._zod.parse = (a0, a1) => {
|
|
const value10 = a0.value;
|
|
if (!c19469_2.has(value10)) {
|
|
a0.issues.push({
|
|
code: "invalid_value",
|
|
values: enumValues,
|
|
input: value10,
|
|
inst: inst27
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodLiteral = c8316_8.$constructor("$ZodLiteral", (a0, a1) => {
|
|
const inst28 = a0;
|
|
let c19470_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
if (a1.values.length === 0) {
|
|
throw new Error("Cannot create literal schema with no valid values");
|
|
}
|
|
const set = new Set(a1.values);
|
|
let c19470_2 = set;
|
|
a0._zod.values = set;
|
|
a0._zod.pattern = new RegExp(`^(${a1.values.map((value) => typeof value === "string" ? c8316_10.escapeRegex(value) : value ? c8316_10.escapeRegex(value.toString()) : String(value)).join("|")})\$`);
|
|
a0._zod.parse = (a0, a1) => {
|
|
const value10 = a0.value;
|
|
if (!c19470_2.has(value10)) {
|
|
a0.issues.push({
|
|
code: "invalid_value",
|
|
values: c19470_1.values,
|
|
input: value10,
|
|
inst: inst28
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodFile = c8316_8.$constructor("$ZodFile", (a0, a1) => {
|
|
const inst29 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
const value10 = a0.value;
|
|
if (!(value10 instanceof File)) {
|
|
a0.issues.push({
|
|
expected: "file",
|
|
code: "invalid_type",
|
|
input: value10,
|
|
inst: inst29
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodTransform = c8316_8.$constructor("$ZodTransform", (a0, a1) => {
|
|
let c19472_0 = a0;
|
|
let c19472_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (a1.direction === "backward") {
|
|
throw new c8316_8.$ZodEncodeError(c19472_0.constructor.name);
|
|
}
|
|
const value10 = c19472_1.transform(a0.value, a0);
|
|
const async = a1.async;
|
|
const r0 = value10 instanceof Promise;
|
|
if (async) {
|
|
return (r0 ? value10 : Promise.resolve(value10)).then((result) => {
|
|
a0.value = result;
|
|
return a0;
|
|
});
|
|
}
|
|
if (r0) {
|
|
throw new c8316_8.$ZodAsyncError();
|
|
}
|
|
a0.value = value10;
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodOptional = c8316_8.$constructor("$ZodOptional", (a0, a1) => {
|
|
let c19473_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.optin = "optional";
|
|
a0._zod.optout = "optional";
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19473_0.innerType._zod.values ? new Set([...c19473_0.innerType._zod.values, void 0]) : void 0);
|
|
c8316_10.defineLazy(a0._zod, "pattern", () => {
|
|
const pattern = c19473_0.innerType._zod.pattern;
|
|
return pattern ? new RegExp(`^(${c8316_10.cleanRegex(pattern.source)})?\$`) : void 0;
|
|
});
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r25;
|
|
if (c19473_0.innerType._zod.optin === "optional") {
|
|
const r18 = c19473_0.innerType._zod.run(a0, a1);
|
|
if (r18 instanceof Promise) {
|
|
r25 = r18.then((result) => {
|
|
const value10 = a0.value;
|
|
return result.issues.length ? value10 === void 0 ? {
|
|
issues: [],
|
|
value: void 0
|
|
} : result : result;
|
|
});
|
|
} else {
|
|
const value10 = a0.value;
|
|
r25 = r18.issues.length ? value10 === void 0 ? {
|
|
issues: [],
|
|
value: void 0
|
|
} : r18 : r18;
|
|
}
|
|
return r25;
|
|
}
|
|
return a0.value !== void 0 ? c19473_0.innerType._zod.run(a0, a1) : a0;
|
|
};
|
|
});
|
|
exports.$ZodExactOptional = c8316_8.$constructor("$ZodExactOptional", (a0, a1) => {
|
|
let c19474_0 = a1;
|
|
exports.$ZodOptional.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19474_0.innerType._zod.values);
|
|
c8316_10.defineLazy(a0._zod, "pattern", () => c19474_0.innerType._zod.pattern);
|
|
a0._zod.parse = (a0, a1) => c19474_0.innerType._zod.run(a0, a1);
|
|
});
|
|
exports.$ZodNullable = c8316_8.$constructor("$ZodNullable", (a0, a1) => {
|
|
let c19475_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "optin", () => c19475_0.innerType._zod.optin);
|
|
c8316_10.defineLazy(a0._zod, "optout", () => c19475_0.innerType._zod.optout);
|
|
c8316_10.defineLazy(a0._zod, "pattern", () => {
|
|
const pattern = c19475_0.innerType._zod.pattern;
|
|
return pattern ? new RegExp(`^(${c8316_10.cleanRegex(pattern.source)}|null)\$`) : void 0;
|
|
});
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19475_0.innerType._zod.values ? new Set([...c19475_0.innerType._zod.values, null]) : void 0);
|
|
a0._zod.parse = (a0, a1) => a0.value !== null ? c19475_0.innerType._zod.run(a0, a1) : a0;
|
|
});
|
|
exports.$ZodDefault = c8316_8.$constructor("$ZodDefault", (a0, a1) => {
|
|
let c19476_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.optin = "optional";
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19476_0.innerType._zod.values);
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r16;
|
|
if (a1.direction === "backward") {
|
|
return c19476_0.innerType._zod.run(a0, a1);
|
|
}
|
|
if (a0.value === void 0) {
|
|
a0.value = c19476_0.defaultValue;
|
|
return a0;
|
|
}
|
|
const r8 = c19476_0.innerType._zod.run(a0, a1);
|
|
if (r8 instanceof Promise) {
|
|
r16 = r8.then((result) => {
|
|
if (result.value === void 0) {
|
|
result.value = c19476_0.defaultValue;
|
|
}
|
|
return result;
|
|
});
|
|
} else {
|
|
const value10 = r8.value;
|
|
r16 = r8;
|
|
if (value10 === void 0) {
|
|
r8.value = c19476_0.defaultValue;
|
|
r16 = r8;
|
|
}
|
|
}
|
|
return r16;
|
|
};
|
|
});
|
|
exports.$ZodPrefault = c8316_8.$constructor("$ZodPrefault", (a0, a1) => {
|
|
let c19477_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.optin = "optional";
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19477_0.innerType._zod.values);
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (a1.direction !== "backward" && a0.value === void 0) {
|
|
a0.value = c19477_0.defaultValue;
|
|
}
|
|
return c19477_0.innerType._zod.run(a0, a1);
|
|
};
|
|
});
|
|
exports.$ZodNonOptional = c8316_8.$constructor("$ZodNonOptional", (a0, a1) => {
|
|
const inst30 = a0;
|
|
let c19478_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "values", () => {
|
|
const values = c19478_1.innerType._zod.values;
|
|
return values ? new Set([...values].filter((item) => item !== void 0)) : void 0;
|
|
});
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r18;
|
|
const r11 = c19478_1.innerType._zod.run(a0, a1);
|
|
if (r11 instanceof Promise) {
|
|
r18 = r11.then((result) => {
|
|
if (!(result.issues.length || result.value !== void 0)) {
|
|
result.issues.push({
|
|
code: "invalid_type",
|
|
expected: "nonoptional",
|
|
input: result.value,
|
|
inst: inst30
|
|
});
|
|
}
|
|
return result;
|
|
});
|
|
} else {
|
|
const r15 = r11.issues.length || r11.value !== void 0;
|
|
r18 = r11;
|
|
if (!r15) {
|
|
r11.issues.push({
|
|
code: "invalid_type",
|
|
expected: "nonoptional",
|
|
input: r11.value,
|
|
inst: inst30
|
|
});
|
|
r18 = r11;
|
|
}
|
|
}
|
|
return r18;
|
|
};
|
|
});
|
|
exports.$ZodSuccess = c8316_8.$constructor("$ZodSuccess", (a0, a1) => {
|
|
let c19479_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r2 = a0;
|
|
if (a1.direction === "backward") {
|
|
throw new c8316_8.$ZodEncodeError("ZodSuccess");
|
|
}
|
|
const r15 = c19479_0.innerType._zod.run(a0, a1);
|
|
if (r15 instanceof Promise) {
|
|
r2 = r15.then((result) => {
|
|
a0.value = result.issues.length === 0;
|
|
return a0;
|
|
});
|
|
} else {
|
|
a0.value = r15.issues.length === 0;
|
|
}
|
|
return r2;
|
|
};
|
|
});
|
|
exports.$ZodCatch = c8316_8.$constructor("$ZodCatch", (a0, a1) => {
|
|
let c19480_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "optin", () => c19480_0.innerType._zod.optin);
|
|
c8316_10.defineLazy(a0._zod, "optout", () => c19480_0.innerType._zod.optout);
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19480_0.innerType._zod.values);
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r24;
|
|
if (a1.direction === "backward") {
|
|
return c19480_0.innerType._zod.run(a0, a1);
|
|
}
|
|
const r7 = c19480_0.innerType._zod.run(a0, a1);
|
|
if (r7 instanceof Promise) {
|
|
r24 = r7.then((result) => {
|
|
a0.value = result.value;
|
|
if (result.issues.length) {
|
|
a0.value = c19480_0.catchValue({
|
|
...a0,
|
|
error: {
|
|
issues: result.issues.map((issue) => c8316_10.finalizeIssue(issue, a1, c8316_8.config()))
|
|
},
|
|
input: a0.value
|
|
});
|
|
a0.issues = [];
|
|
}
|
|
return a0;
|
|
});
|
|
} else {
|
|
a0.value = r7.value;
|
|
const length2 = r7.issues.length;
|
|
r24 = a0;
|
|
if (length2) {
|
|
a0.value = c19480_0.catchValue({
|
|
...a0,
|
|
error: {
|
|
issues: r7.issues.map((issue) => c8316_10.finalizeIssue(issue, a1, c8316_8.config()))
|
|
},
|
|
input: a0.value
|
|
});
|
|
a0.issues = [];
|
|
r24 = a0;
|
|
}
|
|
}
|
|
return r24;
|
|
};
|
|
});
|
|
exports.$ZodNaN = c8316_8.$constructor("$ZodNaN", (a0, a1) => {
|
|
const inst31 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => {
|
|
const value10 = a0.value;
|
|
if (!(typeof value10 === "number" ? Number.isNaN(a0.value) : typeof value10 === "number")) {
|
|
a0.issues.push({
|
|
input: a0.value,
|
|
inst: inst31,
|
|
expected: "nan",
|
|
code: "invalid_type"
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodPipe = c8316_8.$constructor("$ZodPipe", (a0, a1) => {
|
|
let c19482_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19482_0.in._zod.values);
|
|
c8316_10.defineLazy(a0._zod, "optin", () => c19482_0.in._zod.optin);
|
|
c8316_10.defineLazy(a0._zod, "optout", () => c19482_0.out._zod.optout);
|
|
c8316_10.defineLazy(a0._zod, "propValues", () => c19482_0.in._zod.propValues);
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r22, r42;
|
|
if (a1.direction === "backward") {
|
|
const r30 = c19482_0.out._zod.run(a0, a1);
|
|
if (r30 instanceof Promise) {
|
|
r42 = r30.then((result) => {
|
|
let r14;
|
|
const in2 = c19482_0.in;
|
|
if (result.issues.length) {
|
|
result.aborted = true;
|
|
r14 = result;
|
|
} else {
|
|
r14 = in2._zod.run({
|
|
value: result.value,
|
|
issues: result.issues
|
|
}, a1);
|
|
}
|
|
return r14;
|
|
});
|
|
} else {
|
|
const in2 = c19482_0.in;
|
|
if (r30.issues.length) {
|
|
r30.aborted = true;
|
|
r42 = r30;
|
|
} else {
|
|
r42 = in2._zod.run({
|
|
value: r30.value,
|
|
issues: r30.issues
|
|
}, a1);
|
|
}
|
|
}
|
|
return r42;
|
|
}
|
|
const r8 = c19482_0.in._zod.run(a0, a1);
|
|
if (r8 instanceof Promise) {
|
|
r22 = r8.then((result) => {
|
|
let r14;
|
|
const out = c19482_0.out;
|
|
if (result.issues.length) {
|
|
result.aborted = true;
|
|
r14 = result;
|
|
} else {
|
|
r14 = out._zod.run({
|
|
value: result.value,
|
|
issues: result.issues
|
|
}, a1);
|
|
}
|
|
return r14;
|
|
});
|
|
} else {
|
|
const out = c19482_0.out;
|
|
if (r8.issues.length) {
|
|
r8.aborted = true;
|
|
r22 = r8;
|
|
} else {
|
|
r22 = out._zod.run({
|
|
value: r8.value,
|
|
issues: r8.issues
|
|
}, a1);
|
|
}
|
|
}
|
|
return r22;
|
|
};
|
|
});
|
|
exports.$ZodCodec = c8316_8.$constructor("$ZodCodec", (a0, a1) => {
|
|
let c19483_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19483_0.in._zod.values);
|
|
c8316_10.defineLazy(a0._zod, "optin", () => c19483_0.in._zod.optin);
|
|
c8316_10.defineLazy(a0._zod, "optout", () => c19483_0.out._zod.optout);
|
|
c8316_10.defineLazy(a0._zod, "propValues", () => c19483_0.in._zod.propValues);
|
|
a0._zod.parse = (a0, a1) => {
|
|
if ((a1.direction || "forward") === "forward") {
|
|
const r24 = c19483_0.in._zod.run(a0, a1);
|
|
return r24 instanceof Promise ? r24.then((result) => handleCodecAResult(result, c19483_0, a1)) : handleCodecAResult(r24, c19483_0, a1);
|
|
}
|
|
const r9 = c19483_0.out._zod.run(a0, a1);
|
|
return r9 instanceof Promise ? r9.then((result) => handleCodecAResult(result, c19483_0, a1)) : handleCodecAResult(r9, c19483_0, a1);
|
|
};
|
|
});
|
|
exports.$ZodReadonly = c8316_8.$constructor("$ZodReadonly", (a0, a1) => {
|
|
let c19484_0 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "propValues", () => c19484_0.innerType._zod.propValues);
|
|
c8316_10.defineLazy(a0._zod, "values", () => c19484_0.innerType._zod.values);
|
|
c8316_10.defineLazy(a0._zod, "optin", () => {
|
|
const innerType = c19484_0.innerType;
|
|
return innerType == null ? void 0 : innerType._zod?.optin;
|
|
});
|
|
c8316_10.defineLazy(a0._zod, "optout", () => {
|
|
const innerType = c19484_0.innerType;
|
|
return innerType == null ? void 0 : innerType._zod?.optout;
|
|
});
|
|
a0._zod.parse = (a0, a1) => {
|
|
let r17;
|
|
if (a1.direction === "backward") {
|
|
return c19484_0.innerType._zod.run(a0, a1);
|
|
}
|
|
const r7 = c19484_0.innerType._zod.run(a0, a1);
|
|
if (r7 instanceof Promise) {
|
|
r17 = r7.then(handleReadonlyResult);
|
|
} else {
|
|
r7.value = Object.freeze(r7.value);
|
|
r17 = r7;
|
|
}
|
|
return r17;
|
|
};
|
|
});
|
|
exports.$ZodTemplateLiteral = c8316_8.$constructor("$ZodTemplateLiteral", (a0, a1) => {
|
|
const inst32 = a0;
|
|
let c19485_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
const r10 = [];
|
|
for (const part of a1.parts) {
|
|
const r43 = part;
|
|
if (typeof part === "object" && r43 !== null) {
|
|
if (r43._zod.pattern) {
|
|
const r89 = r43._zod.pattern instanceof RegExp;
|
|
const pattern = r43._zod.pattern;
|
|
const r93 = r89 ? pattern.source : pattern;
|
|
if (r93) {
|
|
const r111 = r93.startsWith("^") ? 1 : 0;
|
|
const r114 = r93.endsWith("$");
|
|
const length2 = r93.length;
|
|
r10.push(r93.slice(r111, r114 ? length2 - 1 : length2));
|
|
continue;
|
|
}
|
|
throw new Error(`Invalid template literal part: ${r43._zod.traits}`);
|
|
}
|
|
throw new Error(`Invalid template literal part, no pattern found: ${[...r43._zod.traits].shift()}`);
|
|
}
|
|
if (r43 !== null && !c8316_10.primitiveTypes.has(typeof r43)) {
|
|
throw new Error(`Invalid template literal part: ${r43}`);
|
|
}
|
|
r10.push(c8316_10.escapeRegex(`${r43}`));
|
|
}
|
|
a0._zod.pattern = new RegExp(`^${r10.join("")}\$`);
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (typeof a0.value !== "string") {
|
|
a0.issues.push({
|
|
input: a0.value,
|
|
inst: inst32,
|
|
expected: "string",
|
|
code: "invalid_type"
|
|
});
|
|
} else {
|
|
inst32._zod.pattern.lastIndex = 0;
|
|
if (!inst32._zod.pattern.test(a0.value)) {
|
|
const issues = a0.issues;
|
|
let format = c19485_1.format;
|
|
if (format == null) {
|
|
format = "template_literal";
|
|
}
|
|
issues.push({
|
|
input: a0.value,
|
|
inst: inst32,
|
|
code: "invalid_format",
|
|
format,
|
|
pattern: inst32._zod.pattern.source
|
|
});
|
|
}
|
|
}
|
|
return a0;
|
|
};
|
|
});
|
|
exports.$ZodFunction = c8316_8.$constructor("$ZodFunction", (a0, a1) => {
|
|
const inst33 = a0;
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._def = a1;
|
|
a0._zod.def = a1;
|
|
a0.implement = (a0) => {
|
|
if (typeof a0 !== "function") {
|
|
throw new Error("implement() must be called with a function");
|
|
}
|
|
return function(...args) {
|
|
const r25 = Reflect.apply(a0, this, inst33._def.input ? (0, _Module12081.parse)(inst33._def.input, args) : args);
|
|
return inst33._def.output ? (0, _Module12081.parse)(inst33._def.output, r25) : r25;
|
|
};
|
|
};
|
|
a0.implementAsync = (a0) => {
|
|
if (typeof a0 !== "function") {
|
|
throw new Error("implementAsync() must be called with a function");
|
|
}
|
|
return async function(...c30497_1) {
|
|
let r125;
|
|
let c30497_3, _this2;
|
|
const _this = this;
|
|
let c31653_0, c31653_1, c31653_2;
|
|
L19: {
|
|
_this2 = _this;
|
|
c30497_3 = void 0;
|
|
c31653_0 = c30497_1;
|
|
c31653_1 = void 0;
|
|
c31653_2 = void 0;
|
|
await void 0;
|
|
c31653_1 = inst33._def.input ? await (0, parseAsync)(inst33._def.input, c31653_0) : c31653_0;
|
|
c31653_2 = await Reflect.apply(a0, _this2, c31653_1);
|
|
if (inst33._def.output) {
|
|
r125 = await (0, parseAsync)(inst33._def.output, c31653_2);
|
|
break L19;
|
|
}
|
|
return c31653_2;
|
|
}
|
|
return r125;
|
|
};
|
|
};
|
|
a0._zod.parse = (a0, a1) => {
|
|
if (typeof a0.value !== "function") {
|
|
a0.issues.push({
|
|
code: "invalid_type",
|
|
expected: "function",
|
|
input: a0.value,
|
|
inst: inst33
|
|
});
|
|
return a0;
|
|
}
|
|
a0.value = inst33._def.output && inst33._def.output._zod.def.type === "promise" ? inst33.implementAsync(a0.value) : inst33.implement(a0.value);
|
|
return a0;
|
|
};
|
|
a0.input = function(...args) {
|
|
let r21;
|
|
const constructor = inst33.constructor;
|
|
const isArray = Array.isArray(args[0]);
|
|
const r14 = {
|
|
type: "function",
|
|
input: null,
|
|
output: null
|
|
};
|
|
if (isArray) {
|
|
r14.input = new exports.$ZodTuple({
|
|
type: "tuple",
|
|
items: args[0],
|
|
rest: args[1]
|
|
});
|
|
r14.output = inst33._def.output;
|
|
r21 = new constructor(r14);
|
|
} else {
|
|
r14.input = args[0];
|
|
r14.output = inst33._def.output;
|
|
r21 = new constructor(r14);
|
|
}
|
|
return r21;
|
|
};
|
|
a0.output = (a0) => new inst33.constructor({
|
|
type: "function",
|
|
input: inst33._def.input,
|
|
output: a0
|
|
});
|
|
return a0;
|
|
});
|
|
exports.$ZodPromise = c8316_8.$constructor("$ZodPromise", (a0, a1) => {
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, c27251_0) => Promise.resolve(a0.value).then((result) => a1.innerType._zod.run({
|
|
value: result,
|
|
issues: []
|
|
}, c27251_0));
|
|
});
|
|
exports.$ZodLazy = c8316_8.$constructor("$ZodLazy", (a0, a1) => {
|
|
let c19488_0 = a0;
|
|
let c19488_1 = a1;
|
|
exports.$ZodType.init(a0, a1);
|
|
c8316_10.defineLazy(a0._zod, "innerType", () => c19488_1.getter());
|
|
c8316_10.defineLazy(a0._zod, "pattern", () => {
|
|
const innerType = c19488_0._zod.innerType;
|
|
return innerType == null ? void 0 : innerType._zod?.pattern;
|
|
});
|
|
c8316_10.defineLazy(a0._zod, "propValues", () => {
|
|
const innerType = c19488_0._zod.innerType;
|
|
return innerType == null ? void 0 : innerType._zod?.propValues;
|
|
});
|
|
c8316_10.defineLazy(a0._zod, "optin", () => {
|
|
const innerType = c19488_0._zod.innerType;
|
|
let r7 = innerType == null ? void 0 : innerType._zod?.optin;
|
|
if (r7 == null) {
|
|
r7 = void 0;
|
|
}
|
|
return r7;
|
|
});
|
|
c8316_10.defineLazy(a0._zod, "optout", () => {
|
|
const innerType = c19488_0._zod.innerType;
|
|
let r7 = innerType == null ? void 0 : innerType._zod?.optout;
|
|
if (r7 == null) {
|
|
r7 = void 0;
|
|
}
|
|
return r7;
|
|
});
|
|
a0._zod.parse = (a0, a1) => c19488_0._zod.innerType._zod.run(a0, a1);
|
|
});
|
|
exports.$ZodCustom = c8316_8.$constructor("$ZodCustom", (a0, a1) => {
|
|
const inst34 = a0;
|
|
let c19489_1 = a1;
|
|
c8316_7.$ZodCheck.init(a0, a1);
|
|
exports.$ZodType.init(a0, a1);
|
|
a0._zod.parse = (a0, a1) => a0;
|
|
a0._zod.check = (a0) => {
|
|
const value8 = a0.value;
|
|
const r12 = c19489_1.fn(value8);
|
|
if (r12 instanceof Promise) {
|
|
return r12.then((result) => {
|
|
if (!result) {
|
|
let path = inst34._zod.def.path;
|
|
if (path == null) {
|
|
path = [];
|
|
}
|
|
const r6 = {
|
|
code: "custom",
|
|
input: value8,
|
|
inst: inst34,
|
|
path: [...path],
|
|
continue: !inst34._zod.def.abort
|
|
};
|
|
if (inst34._zod.def.params) {
|
|
r6.params = inst34._zod.def.params;
|
|
}
|
|
a0.issues.push(c8316_10.issue(r6));
|
|
}
|
|
});
|
|
}
|
|
if (!r12) {
|
|
let path = inst34._zod.def.path;
|
|
if (path == null) {
|
|
path = [];
|
|
}
|
|
const r8 = {
|
|
code: "custom",
|
|
input: value8,
|
|
inst: inst34,
|
|
path: [...path],
|
|
continue: !inst34._zod.def.abort
|
|
};
|
|
if (inst34._zod.def.params) {
|
|
r8.params = inst34._zod.def.params;
|
|
}
|
|
a0.issues.push(c8316_10.issue(r8));
|
|
}
|
|
};
|
|
});
|