vite-plugin-norg 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +161 -9
- package/dist/plugin/index.d.ts +4 -8
- package/dist/plugin/index.js +1317 -2628
- package/dist/plugin/plugin.d.ts +1 -1
- package/dist/plugin/wasm.d.ts +0 -1
- package/dist/vite_plugin_norg_parser-koOTkJLR.js +170 -0
- package/package.json +32 -33
- package/dist/vite_plugin_norg_parser-CNE0aFue.js +0 -183
package/dist/plugin/index.js
CHANGED
|
@@ -1,2708 +1,1397 @@
|
|
|
1
|
-
import { createFilter as
|
|
2
|
-
let
|
|
1
|
+
import { createFilter as Pe } from "vite";
|
|
2
|
+
let dt;
|
|
3
3
|
let __tla = (async () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return s.objectValues(i);
|
|
22
|
-
}, s.objectValues = (a) => s.objectKeys(a).map(function(n) {
|
|
23
|
-
return a[n];
|
|
24
|
-
}), s.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
|
|
25
|
-
const n = [];
|
|
26
|
-
for (const i in a) Object.prototype.hasOwnProperty.call(a, i) && n.push(i);
|
|
27
|
-
return n;
|
|
28
|
-
}, s.find = (a, n) => {
|
|
29
|
-
for (const i of a) if (n(i)) return i;
|
|
30
|
-
}, s.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a;
|
|
31
|
-
function r(a, n = " | ") {
|
|
32
|
-
return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(n);
|
|
33
|
-
}
|
|
34
|
-
s.joinValues = r, s.jsonStringifyReplacer = (a, n) => typeof n == "bigint" ? n.toString() : n;
|
|
35
|
-
})(v || (v = {}));
|
|
36
|
-
var se;
|
|
37
|
-
(function(s) {
|
|
38
|
-
s.mergeShapes = (e, t) => ({
|
|
39
|
-
...e,
|
|
40
|
-
...t
|
|
41
|
-
});
|
|
42
|
-
})(se || (se = {}));
|
|
43
|
-
const f = v.arrayToEnum([
|
|
44
|
-
"string",
|
|
45
|
-
"nan",
|
|
46
|
-
"number",
|
|
47
|
-
"integer",
|
|
48
|
-
"float",
|
|
49
|
-
"boolean",
|
|
50
|
-
"date",
|
|
51
|
-
"bigint",
|
|
52
|
-
"symbol",
|
|
53
|
-
"function",
|
|
54
|
-
"undefined",
|
|
55
|
-
"null",
|
|
56
|
-
"array",
|
|
57
|
-
"object",
|
|
58
|
-
"unknown",
|
|
59
|
-
"promise",
|
|
60
|
-
"void",
|
|
61
|
-
"never",
|
|
62
|
-
"map",
|
|
63
|
-
"set"
|
|
64
|
-
]), T = (s) => {
|
|
65
|
-
switch (typeof s) {
|
|
66
|
-
case "undefined":
|
|
67
|
-
return f.undefined;
|
|
68
|
-
case "string":
|
|
69
|
-
return f.string;
|
|
70
|
-
case "number":
|
|
71
|
-
return Number.isNaN(s) ? f.nan : f.number;
|
|
72
|
-
case "boolean":
|
|
73
|
-
return f.boolean;
|
|
74
|
-
case "function":
|
|
75
|
-
return f.function;
|
|
76
|
-
case "bigint":
|
|
77
|
-
return f.bigint;
|
|
78
|
-
case "symbol":
|
|
79
|
-
return f.symbol;
|
|
80
|
-
case "object":
|
|
81
|
-
return Array.isArray(s) ? f.array : s === null ? f.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? f.promise : typeof Map < "u" && s instanceof Map ? f.map : typeof Set < "u" && s instanceof Set ? f.set : typeof Date < "u" && s instanceof Date ? f.date : f.object;
|
|
82
|
-
default:
|
|
83
|
-
return f.unknown;
|
|
84
|
-
}
|
|
85
|
-
}, d = v.arrayToEnum([
|
|
86
|
-
"invalid_type",
|
|
87
|
-
"invalid_literal",
|
|
88
|
-
"custom",
|
|
89
|
-
"invalid_union",
|
|
90
|
-
"invalid_union_discriminator",
|
|
91
|
-
"invalid_enum_value",
|
|
92
|
-
"unrecognized_keys",
|
|
93
|
-
"invalid_arguments",
|
|
94
|
-
"invalid_return_type",
|
|
95
|
-
"invalid_date",
|
|
96
|
-
"invalid_string",
|
|
97
|
-
"too_small",
|
|
98
|
-
"too_big",
|
|
99
|
-
"invalid_intersection_types",
|
|
100
|
-
"not_multiple_of",
|
|
101
|
-
"not_finite"
|
|
102
|
-
]);
|
|
103
|
-
class O extends Error {
|
|
104
|
-
get errors() {
|
|
105
|
-
return this.issues;
|
|
106
|
-
}
|
|
107
|
-
constructor(e) {
|
|
108
|
-
super(), this.issues = [], this.addIssue = (r) => {
|
|
109
|
-
this.issues = [
|
|
110
|
-
...this.issues,
|
|
111
|
-
r
|
|
112
|
-
];
|
|
113
|
-
}, this.addIssues = (r = []) => {
|
|
114
|
-
this.issues = [
|
|
115
|
-
...this.issues,
|
|
116
|
-
...r
|
|
117
|
-
];
|
|
118
|
-
};
|
|
119
|
-
const t = new.target.prototype;
|
|
120
|
-
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
121
|
-
}
|
|
122
|
-
format(e) {
|
|
123
|
-
const t = e || function(n) {
|
|
124
|
-
return n.message;
|
|
125
|
-
}, r = {
|
|
126
|
-
_errors: []
|
|
127
|
-
}, a = (n) => {
|
|
128
|
-
for (const i of n.issues) if (i.code === "invalid_union") i.unionErrors.map(a);
|
|
129
|
-
else if (i.code === "invalid_return_type") a(i.returnTypeError);
|
|
130
|
-
else if (i.code === "invalid_arguments") a(i.argumentsError);
|
|
131
|
-
else if (i.path.length === 0) r._errors.push(t(i));
|
|
132
|
-
else {
|
|
133
|
-
let o = r, u = 0;
|
|
134
|
-
for (; u < i.path.length; ) {
|
|
135
|
-
const l = i.path[u];
|
|
136
|
-
u === i.path.length - 1 ? (o[l] = o[l] || {
|
|
137
|
-
_errors: []
|
|
138
|
-
}, o[l]._errors.push(t(i))) : o[l] = o[l] || {
|
|
139
|
-
_errors: []
|
|
140
|
-
}, o = o[l], u++;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
return a(this), r;
|
|
145
|
-
}
|
|
146
|
-
static assert(e) {
|
|
147
|
-
if (!(e instanceof O)) throw new Error(`Not a ZodError: ${e}`);
|
|
148
|
-
}
|
|
149
|
-
toString() {
|
|
150
|
-
return this.message;
|
|
151
|
-
}
|
|
152
|
-
get message() {
|
|
153
|
-
return JSON.stringify(this.issues, v.jsonStringifyReplacer, 2);
|
|
154
|
-
}
|
|
155
|
-
get isEmpty() {
|
|
156
|
-
return this.issues.length === 0;
|
|
157
|
-
}
|
|
158
|
-
flatten(e = (t) => t.message) {
|
|
159
|
-
const t = {}, r = [];
|
|
160
|
-
for (const a of this.issues) a.path.length > 0 ? (t[a.path[0]] = t[a.path[0]] || [], t[a.path[0]].push(e(a))) : r.push(e(a));
|
|
161
|
-
return {
|
|
162
|
-
formErrors: r,
|
|
163
|
-
fieldErrors: t
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
get formErrors() {
|
|
167
|
-
return this.flatten();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
O.create = (s) => new O(s);
|
|
171
|
-
const Y = (s, e) => {
|
|
172
|
-
let t;
|
|
173
|
-
switch (s.code) {
|
|
174
|
-
case d.invalid_type:
|
|
175
|
-
s.received === f.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
|
|
176
|
-
break;
|
|
177
|
-
case d.invalid_literal:
|
|
178
|
-
t = `Invalid literal value, expected ${JSON.stringify(s.expected, v.jsonStringifyReplacer)}`;
|
|
179
|
-
break;
|
|
180
|
-
case d.unrecognized_keys:
|
|
181
|
-
t = `Unrecognized key(s) in object: ${v.joinValues(s.keys, ", ")}`;
|
|
182
|
-
break;
|
|
183
|
-
case d.invalid_union:
|
|
184
|
-
t = "Invalid input";
|
|
185
|
-
break;
|
|
186
|
-
case d.invalid_union_discriminator:
|
|
187
|
-
t = `Invalid discriminator value. Expected ${v.joinValues(s.options)}`;
|
|
188
|
-
break;
|
|
189
|
-
case d.invalid_enum_value:
|
|
190
|
-
t = `Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;
|
|
191
|
-
break;
|
|
192
|
-
case d.invalid_arguments:
|
|
193
|
-
t = "Invalid function arguments";
|
|
194
|
-
break;
|
|
195
|
-
case d.invalid_return_type:
|
|
196
|
-
t = "Invalid function return type";
|
|
197
|
-
break;
|
|
198
|
-
case d.invalid_date:
|
|
199
|
-
t = "Invalid date";
|
|
200
|
-
break;
|
|
201
|
-
case d.invalid_string:
|
|
202
|
-
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : v.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
|
|
203
|
-
break;
|
|
204
|
-
case d.too_small:
|
|
205
|
-
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
|
|
206
|
-
break;
|
|
207
|
-
case d.too_big:
|
|
208
|
-
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? t = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : t = "Invalid input";
|
|
209
|
-
break;
|
|
210
|
-
case d.custom:
|
|
211
|
-
t = "Invalid input";
|
|
212
|
-
break;
|
|
213
|
-
case d.invalid_intersection_types:
|
|
214
|
-
t = "Intersection results could not be merged";
|
|
215
|
-
break;
|
|
216
|
-
case d.not_multiple_of:
|
|
217
|
-
t = `Number must be a multiple of ${s.multipleOf}`;
|
|
218
|
-
break;
|
|
219
|
-
case d.not_finite:
|
|
220
|
-
t = "Number must be finite";
|
|
221
|
-
break;
|
|
222
|
-
default:
|
|
223
|
-
t = e.defaultError, v.assertNever(s);
|
|
224
|
-
}
|
|
225
|
-
return {
|
|
226
|
-
message: t
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
|
-
let we = Y;
|
|
230
|
-
function Ce() {
|
|
231
|
-
return we;
|
|
232
|
-
}
|
|
233
|
-
const Oe = (s) => {
|
|
234
|
-
const { data: e, path: t, errorMaps: r, issueData: a } = s, n = [
|
|
235
|
-
...t,
|
|
236
|
-
...a.path || []
|
|
237
|
-
], i = {
|
|
238
|
-
...a,
|
|
239
|
-
path: n
|
|
240
|
-
};
|
|
241
|
-
if (a.message !== void 0) return {
|
|
242
|
-
...a,
|
|
243
|
-
path: n,
|
|
244
|
-
message: a.message
|
|
245
|
-
};
|
|
246
|
-
let o = "";
|
|
247
|
-
const u = r.filter((l) => !!l).slice().reverse();
|
|
248
|
-
for (const l of u) o = l(i, {
|
|
249
|
-
data: e,
|
|
250
|
-
defaultError: o
|
|
251
|
-
}).message;
|
|
252
|
-
return {
|
|
253
|
-
...a,
|
|
254
|
-
path: n,
|
|
255
|
-
message: o
|
|
256
|
-
};
|
|
257
|
-
};
|
|
258
|
-
function c(s, e) {
|
|
259
|
-
const t = Ce(), r = Oe({
|
|
260
|
-
issueData: e,
|
|
261
|
-
data: s.data,
|
|
262
|
-
path: s.path,
|
|
263
|
-
errorMaps: [
|
|
264
|
-
s.common.contextualErrorMap,
|
|
265
|
-
s.schemaErrorMap,
|
|
266
|
-
t,
|
|
267
|
-
t === Y ? void 0 : Y
|
|
268
|
-
].filter((a) => !!a)
|
|
4
|
+
function c(e, n, t) {
|
|
5
|
+
function r(i, a) {
|
|
6
|
+
var d;
|
|
7
|
+
Object.defineProperty(i, "_zod", {
|
|
8
|
+
value: i._zod ?? {},
|
|
9
|
+
enumerable: false
|
|
10
|
+
}), (d = i._zod).traits ?? (d.traits = /* @__PURE__ */ new Set()), i._zod.traits.add(e), n(i, a);
|
|
11
|
+
for (const p in u.prototype) p in i || Object.defineProperty(i, p, {
|
|
12
|
+
value: u.prototype[p].bind(i)
|
|
13
|
+
});
|
|
14
|
+
i._zod.constr = u, i._zod.def = a;
|
|
15
|
+
}
|
|
16
|
+
const o = (t == null ? void 0 : t.Parent) ?? Object;
|
|
17
|
+
class s extends o {
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(s, "name", {
|
|
20
|
+
value: e
|
|
269
21
|
});
|
|
270
|
-
|
|
22
|
+
function u(i) {
|
|
23
|
+
var a;
|
|
24
|
+
const d = (t == null ? void 0 : t.Parent) ? new s() : this;
|
|
25
|
+
r(d, i), (a = d._zod).deferred ?? (a.deferred = []);
|
|
26
|
+
for (const p of d._zod.deferred) p();
|
|
27
|
+
return d;
|
|
28
|
+
}
|
|
29
|
+
return Object.defineProperty(u, "init", {
|
|
30
|
+
value: r
|
|
31
|
+
}), Object.defineProperty(u, Symbol.hasInstance, {
|
|
32
|
+
value: (i) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
return (t == null ? void 0 : t.Parent) && i instanceof t.Parent ? true : (_b = (_a = i == null ? void 0 : i._zod) == null ? void 0 : _a.traits) == null ? void 0 : _b.has(e);
|
|
35
|
+
}
|
|
36
|
+
}), Object.defineProperty(u, "name", {
|
|
37
|
+
value: e
|
|
38
|
+
}), u;
|
|
271
39
|
}
|
|
272
|
-
class
|
|
40
|
+
class R extends Error {
|
|
273
41
|
constructor() {
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
dirty() {
|
|
277
|
-
this.value === "valid" && (this.value = "dirty");
|
|
278
|
-
}
|
|
279
|
-
abort() {
|
|
280
|
-
this.value !== "aborted" && (this.value = "aborted");
|
|
281
|
-
}
|
|
282
|
-
static mergeArray(e, t) {
|
|
283
|
-
const r = [];
|
|
284
|
-
for (const a of t) {
|
|
285
|
-
if (a.status === "aborted") return m;
|
|
286
|
-
a.status === "dirty" && e.dirty(), r.push(a.value);
|
|
287
|
-
}
|
|
288
|
-
return {
|
|
289
|
-
status: e.value,
|
|
290
|
-
value: r
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
static async mergeObjectAsync(e, t) {
|
|
294
|
-
const r = [];
|
|
295
|
-
for (const a of t) {
|
|
296
|
-
const n = await a.key, i = await a.value;
|
|
297
|
-
r.push({
|
|
298
|
-
key: n,
|
|
299
|
-
value: i
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
return k.mergeObjectSync(e, r);
|
|
303
|
-
}
|
|
304
|
-
static mergeObjectSync(e, t) {
|
|
305
|
-
const r = {};
|
|
306
|
-
for (const a of t) {
|
|
307
|
-
const { key: n, value: i } = a;
|
|
308
|
-
if (n.status === "aborted" || i.status === "aborted") return m;
|
|
309
|
-
n.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), n.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (r[n.value] = i.value);
|
|
310
|
-
}
|
|
311
|
-
return {
|
|
312
|
-
status: e.value,
|
|
313
|
-
value: r
|
|
314
|
-
};
|
|
42
|
+
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
315
43
|
}
|
|
316
44
|
}
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
status: "dirty",
|
|
321
|
-
value: s
|
|
322
|
-
}), b = (s) => ({
|
|
323
|
-
status: "valid",
|
|
324
|
-
value: s
|
|
325
|
-
}), re = (s) => s.status === "aborted", ae = (s) => s.status === "dirty", I = (s) => s.status === "valid", U = (s) => typeof Promise < "u" && s instanceof Promise;
|
|
326
|
-
var h;
|
|
327
|
-
(function(s) {
|
|
328
|
-
s.errToObj = (e) => typeof e == "string" ? {
|
|
329
|
-
message: e
|
|
330
|
-
} : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
331
|
-
})(h || (h = {}));
|
|
332
|
-
class N {
|
|
333
|
-
constructor(e, t, r, a) {
|
|
334
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = a;
|
|
335
|
-
}
|
|
336
|
-
get path() {
|
|
337
|
-
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
338
|
-
}
|
|
45
|
+
const he = {};
|
|
46
|
+
function b(e) {
|
|
47
|
+
return he;
|
|
339
48
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
49
|
+
function ke(e) {
|
|
50
|
+
const n = Object.values(e).filter((r) => typeof r == "number");
|
|
51
|
+
return Object.entries(e).filter(([r, o]) => n.indexOf(+r) === -1).map(([r, o]) => o);
|
|
52
|
+
}
|
|
53
|
+
function Oe(e, n) {
|
|
54
|
+
return typeof n == "bigint" ? n.toString() : n;
|
|
55
|
+
}
|
|
56
|
+
function _e(e) {
|
|
346
57
|
return {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
58
|
+
get value() {
|
|
59
|
+
{
|
|
60
|
+
const n = e();
|
|
61
|
+
return Object.defineProperty(this, "value", {
|
|
62
|
+
value: n
|
|
63
|
+
}), n;
|
|
64
|
+
}
|
|
352
65
|
}
|
|
353
66
|
};
|
|
354
|
-
};
|
|
355
|
-
function _(s) {
|
|
356
|
-
if (!s) return {};
|
|
357
|
-
const { errorMap: e, invalid_type_error: t, required_error: r, description: a } = s;
|
|
358
|
-
if (e && (t || r)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
359
|
-
return e ? {
|
|
360
|
-
errorMap: e,
|
|
361
|
-
description: a
|
|
362
|
-
} : {
|
|
363
|
-
errorMap: (i, o) => {
|
|
364
|
-
const { message: u } = s;
|
|
365
|
-
return i.code === "invalid_enum_value" ? {
|
|
366
|
-
message: u ?? o.defaultError
|
|
367
|
-
} : typeof o.data > "u" ? {
|
|
368
|
-
message: u ?? r ?? o.defaultError
|
|
369
|
-
} : i.code !== "invalid_type" ? {
|
|
370
|
-
message: o.defaultError
|
|
371
|
-
} : {
|
|
372
|
-
message: u ?? t ?? o.defaultError
|
|
373
|
-
};
|
|
374
|
-
},
|
|
375
|
-
description: a
|
|
376
|
-
};
|
|
377
67
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
path: e.path,
|
|
392
|
-
parent: e.parent
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
_processInputParams(e) {
|
|
396
|
-
return {
|
|
397
|
-
status: new k(),
|
|
398
|
-
ctx: {
|
|
399
|
-
common: e.parent.common,
|
|
400
|
-
data: e.data,
|
|
401
|
-
parsedType: T(e.data),
|
|
402
|
-
schemaErrorMap: this._def.errorMap,
|
|
403
|
-
path: e.path,
|
|
404
|
-
parent: e.parent
|
|
68
|
+
function K(e) {
|
|
69
|
+
return e == null;
|
|
70
|
+
}
|
|
71
|
+
function q(e) {
|
|
72
|
+
const n = e.startsWith("^") ? 1 : 0, t = e.endsWith("$") ? e.length - 1 : e.length;
|
|
73
|
+
return e.slice(n, t);
|
|
74
|
+
}
|
|
75
|
+
function h(e, n, t) {
|
|
76
|
+
Object.defineProperty(e, n, {
|
|
77
|
+
get() {
|
|
78
|
+
{
|
|
79
|
+
const r = t();
|
|
80
|
+
return e[n] = r, r;
|
|
405
81
|
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
if (U(t)) throw new Error("Synchronous parse encountered promise.");
|
|
411
|
-
return t;
|
|
412
|
-
}
|
|
413
|
-
_parseAsync(e) {
|
|
414
|
-
const t = this._parse(e);
|
|
415
|
-
return Promise.resolve(t);
|
|
416
|
-
}
|
|
417
|
-
parse(e, t) {
|
|
418
|
-
const r = this.safeParse(e, t);
|
|
419
|
-
if (r.success) return r.data;
|
|
420
|
-
throw r.error;
|
|
421
|
-
}
|
|
422
|
-
safeParse(e, t) {
|
|
423
|
-
const r = {
|
|
424
|
-
common: {
|
|
425
|
-
issues: [],
|
|
426
|
-
async: (t == null ? void 0 : t.async) ?? false,
|
|
427
|
-
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
428
|
-
},
|
|
429
|
-
path: (t == null ? void 0 : t.path) || [],
|
|
430
|
-
schemaErrorMap: this._def.errorMap,
|
|
431
|
-
parent: null,
|
|
432
|
-
data: e,
|
|
433
|
-
parsedType: T(e)
|
|
434
|
-
}, a = this._parseSync({
|
|
435
|
-
data: e,
|
|
436
|
-
path: r.path,
|
|
437
|
-
parent: r
|
|
438
|
-
});
|
|
439
|
-
return ne(r, a);
|
|
440
|
-
}
|
|
441
|
-
"~validate"(e) {
|
|
442
|
-
var _a, _b;
|
|
443
|
-
const t = {
|
|
444
|
-
common: {
|
|
445
|
-
issues: [],
|
|
446
|
-
async: !!this["~standard"].async
|
|
447
|
-
},
|
|
448
|
-
path: [],
|
|
449
|
-
schemaErrorMap: this._def.errorMap,
|
|
450
|
-
parent: null,
|
|
451
|
-
data: e,
|
|
452
|
-
parsedType: T(e)
|
|
453
|
-
};
|
|
454
|
-
if (!this["~standard"].async) try {
|
|
455
|
-
const r = this._parseSync({
|
|
456
|
-
data: e,
|
|
457
|
-
path: [],
|
|
458
|
-
parent: t
|
|
459
|
-
});
|
|
460
|
-
return I(r) ? {
|
|
461
|
-
value: r.value
|
|
462
|
-
} : {
|
|
463
|
-
issues: t.common.issues
|
|
464
|
-
};
|
|
465
|
-
} catch (r) {
|
|
466
|
-
((_b = (_a = r == null ? void 0 : r.message) == null ? void 0 : _a.toLowerCase()) == null ? void 0 : _b.includes("encountered")) && (this["~standard"].async = true), t.common = {
|
|
467
|
-
issues: [],
|
|
468
|
-
async: true
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
return this._parseAsync({
|
|
472
|
-
data: e,
|
|
473
|
-
path: [],
|
|
474
|
-
parent: t
|
|
475
|
-
}).then((r) => I(r) ? {
|
|
476
|
-
value: r.value
|
|
477
|
-
} : {
|
|
478
|
-
issues: t.common.issues
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
async parseAsync(e, t) {
|
|
482
|
-
const r = await this.safeParseAsync(e, t);
|
|
483
|
-
if (r.success) return r.data;
|
|
484
|
-
throw r.error;
|
|
485
|
-
}
|
|
486
|
-
async safeParseAsync(e, t) {
|
|
487
|
-
const r = {
|
|
488
|
-
common: {
|
|
489
|
-
issues: [],
|
|
490
|
-
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
491
|
-
async: true
|
|
492
|
-
},
|
|
493
|
-
path: (t == null ? void 0 : t.path) || [],
|
|
494
|
-
schemaErrorMap: this._def.errorMap,
|
|
495
|
-
parent: null,
|
|
496
|
-
data: e,
|
|
497
|
-
parsedType: T(e)
|
|
498
|
-
}, a = this._parse({
|
|
499
|
-
data: e,
|
|
500
|
-
path: r.path,
|
|
501
|
-
parent: r
|
|
502
|
-
}), n = await (U(a) ? a : Promise.resolve(a));
|
|
503
|
-
return ne(r, n);
|
|
504
|
-
}
|
|
505
|
-
refine(e, t) {
|
|
506
|
-
const r = (a) => typeof t == "string" || typeof t > "u" ? {
|
|
507
|
-
message: t
|
|
508
|
-
} : typeof t == "function" ? t(a) : t;
|
|
509
|
-
return this._refinement((a, n) => {
|
|
510
|
-
const i = e(a), o = () => n.addIssue({
|
|
511
|
-
code: d.custom,
|
|
512
|
-
...r(a)
|
|
82
|
+
},
|
|
83
|
+
set(r) {
|
|
84
|
+
Object.defineProperty(e, n, {
|
|
85
|
+
value: r
|
|
513
86
|
});
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
refinement(e, t) {
|
|
518
|
-
return this._refinement((r, a) => e(r) ? true : (a.addIssue(typeof t == "function" ? t(r, a) : t), false));
|
|
519
|
-
}
|
|
520
|
-
_refinement(e) {
|
|
521
|
-
return new $({
|
|
522
|
-
schema: this,
|
|
523
|
-
typeName: p.ZodEffects,
|
|
524
|
-
effect: {
|
|
525
|
-
type: "refinement",
|
|
526
|
-
refinement: e
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
superRefine(e) {
|
|
531
|
-
return this._refinement(e);
|
|
532
|
-
}
|
|
533
|
-
constructor(e) {
|
|
534
|
-
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
|
|
535
|
-
version: 1,
|
|
536
|
-
vendor: "zod",
|
|
537
|
-
validate: (t) => this["~validate"](t)
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
optional() {
|
|
541
|
-
return S.create(this, this._def);
|
|
542
|
-
}
|
|
543
|
-
nullable() {
|
|
544
|
-
return V.create(this, this._def);
|
|
545
|
-
}
|
|
546
|
-
nullish() {
|
|
547
|
-
return this.nullable().optional();
|
|
548
|
-
}
|
|
549
|
-
array() {
|
|
550
|
-
return w.create(this);
|
|
551
|
-
}
|
|
552
|
-
promise() {
|
|
553
|
-
return J.create(this, this._def);
|
|
554
|
-
}
|
|
555
|
-
or(e) {
|
|
556
|
-
return F.create([
|
|
557
|
-
this,
|
|
558
|
-
e
|
|
559
|
-
], this._def);
|
|
560
|
-
}
|
|
561
|
-
and(e) {
|
|
562
|
-
return W.create(this, e, this._def);
|
|
563
|
-
}
|
|
564
|
-
transform(e) {
|
|
565
|
-
return new $({
|
|
566
|
-
..._(this._def),
|
|
567
|
-
schema: this,
|
|
568
|
-
typeName: p.ZodEffects,
|
|
569
|
-
effect: {
|
|
570
|
-
type: "transform",
|
|
571
|
-
transform: e
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
default(e) {
|
|
576
|
-
const t = typeof e == "function" ? e : () => e;
|
|
577
|
-
return new X({
|
|
578
|
-
..._(this._def),
|
|
579
|
-
innerType: this,
|
|
580
|
-
defaultValue: t,
|
|
581
|
-
typeName: p.ZodDefault
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
brand() {
|
|
585
|
-
return new He({
|
|
586
|
-
typeName: p.ZodBranded,
|
|
587
|
-
type: this,
|
|
588
|
-
..._(this._def)
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
catch(e) {
|
|
592
|
-
const t = typeof e == "function" ? e : () => e;
|
|
593
|
-
return new K({
|
|
594
|
-
..._(this._def),
|
|
595
|
-
innerType: this,
|
|
596
|
-
catchValue: t,
|
|
597
|
-
typeName: p.ZodCatch
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
describe(e) {
|
|
601
|
-
const t = this.constructor;
|
|
602
|
-
return new t({
|
|
603
|
-
...this._def,
|
|
604
|
-
description: e
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
pipe(e) {
|
|
608
|
-
return te.create(this, e);
|
|
609
|
-
}
|
|
610
|
-
readonly() {
|
|
611
|
-
return ee.create(this);
|
|
612
|
-
}
|
|
613
|
-
isOptional() {
|
|
614
|
-
return this.safeParse(void 0).success;
|
|
615
|
-
}
|
|
616
|
-
isNullable() {
|
|
617
|
-
return this.safeParse(null).success;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
const Te = /^c[^\s-]{8,}$/i, Se = /^[0-9a-z]+$/, Ne = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ae = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Ze = /^[a-z0-9_-]{21}$/i, Re = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, je = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ie = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ee = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
621
|
-
let H;
|
|
622
|
-
const $e = /^(?:(?: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])$/, Ve = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, Me = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Pe = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Le = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ze = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ve = "((\\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])))", De = new RegExp(`^${ve}$`);
|
|
623
|
-
function xe(s) {
|
|
624
|
-
let e = "[0-5]\\d";
|
|
625
|
-
s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
626
|
-
const t = s.precision ? "+" : "?";
|
|
627
|
-
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
87
|
+
},
|
|
88
|
+
configurable: true
|
|
89
|
+
});
|
|
628
90
|
}
|
|
629
|
-
function
|
|
630
|
-
|
|
91
|
+
function W(e, n, t) {
|
|
92
|
+
Object.defineProperty(e, n, {
|
|
93
|
+
value: t,
|
|
94
|
+
writable: true,
|
|
95
|
+
enumerable: true,
|
|
96
|
+
configurable: true
|
|
97
|
+
});
|
|
631
98
|
}
|
|
632
|
-
function
|
|
633
|
-
|
|
634
|
-
const t = [];
|
|
635
|
-
return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
99
|
+
function j(e) {
|
|
100
|
+
return JSON.stringify(e);
|
|
636
101
|
}
|
|
637
|
-
|
|
638
|
-
|
|
102
|
+
const me = Error.captureStackTrace ? Error.captureStackTrace : (...e) => {
|
|
103
|
+
};
|
|
104
|
+
function J(e) {
|
|
105
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
639
106
|
}
|
|
640
|
-
|
|
641
|
-
|
|
107
|
+
const Ee = _e(() => {
|
|
108
|
+
var _a;
|
|
109
|
+
if (typeof navigator < "u" && ((_a = navigator == null ? void 0 : navigator.userAgent) == null ? void 0 : _a.includes("Cloudflare"))) return false;
|
|
642
110
|
try {
|
|
643
|
-
const
|
|
644
|
-
return
|
|
111
|
+
const e = Function;
|
|
112
|
+
return new e(""), true;
|
|
645
113
|
} catch {
|
|
646
114
|
return false;
|
|
647
115
|
}
|
|
116
|
+
});
|
|
117
|
+
function D(e) {
|
|
118
|
+
if (J(e) === false) return false;
|
|
119
|
+
const n = e.constructor;
|
|
120
|
+
if (n === void 0) return true;
|
|
121
|
+
const t = n.prototype;
|
|
122
|
+
return !(J(t) === false || Object.prototype.hasOwnProperty.call(t, "isPrototypeOf") === false);
|
|
648
123
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
return c(n, {
|
|
657
|
-
code: d.invalid_type,
|
|
658
|
-
expected: f.string,
|
|
659
|
-
received: n.parsedType
|
|
660
|
-
}), m;
|
|
661
|
-
}
|
|
662
|
-
const r = new k();
|
|
663
|
-
let a;
|
|
664
|
-
for (const n of this._def.checks) if (n.kind === "min") e.data.length < n.value && (a = this._getOrReturnCtx(e, a), c(a, {
|
|
665
|
-
code: d.too_small,
|
|
666
|
-
minimum: n.value,
|
|
667
|
-
type: "string",
|
|
668
|
-
inclusive: true,
|
|
669
|
-
exact: false,
|
|
670
|
-
message: n.message
|
|
671
|
-
}), r.dirty());
|
|
672
|
-
else if (n.kind === "max") e.data.length > n.value && (a = this._getOrReturnCtx(e, a), c(a, {
|
|
673
|
-
code: d.too_big,
|
|
674
|
-
maximum: n.value,
|
|
675
|
-
type: "string",
|
|
676
|
-
inclusive: true,
|
|
677
|
-
exact: false,
|
|
678
|
-
message: n.message
|
|
679
|
-
}), r.dirty());
|
|
680
|
-
else if (n.kind === "length") {
|
|
681
|
-
const i = e.data.length > n.value, o = e.data.length < n.value;
|
|
682
|
-
(i || o) && (a = this._getOrReturnCtx(e, a), i ? c(a, {
|
|
683
|
-
code: d.too_big,
|
|
684
|
-
maximum: n.value,
|
|
685
|
-
type: "string",
|
|
686
|
-
inclusive: true,
|
|
687
|
-
exact: true,
|
|
688
|
-
message: n.message
|
|
689
|
-
}) : o && c(a, {
|
|
690
|
-
code: d.too_small,
|
|
691
|
-
minimum: n.value,
|
|
692
|
-
type: "string",
|
|
693
|
-
inclusive: true,
|
|
694
|
-
exact: true,
|
|
695
|
-
message: n.message
|
|
696
|
-
}), r.dirty());
|
|
697
|
-
} else if (n.kind === "email") Ie.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
698
|
-
validation: "email",
|
|
699
|
-
code: d.invalid_string,
|
|
700
|
-
message: n.message
|
|
701
|
-
}), r.dirty());
|
|
702
|
-
else if (n.kind === "emoji") H || (H = new RegExp(Ee, "u")), H.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
703
|
-
validation: "emoji",
|
|
704
|
-
code: d.invalid_string,
|
|
705
|
-
message: n.message
|
|
706
|
-
}), r.dirty());
|
|
707
|
-
else if (n.kind === "uuid") Ae.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
708
|
-
validation: "uuid",
|
|
709
|
-
code: d.invalid_string,
|
|
710
|
-
message: n.message
|
|
711
|
-
}), r.dirty());
|
|
712
|
-
else if (n.kind === "nanoid") Ze.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
713
|
-
validation: "nanoid",
|
|
714
|
-
code: d.invalid_string,
|
|
715
|
-
message: n.message
|
|
716
|
-
}), r.dirty());
|
|
717
|
-
else if (n.kind === "cuid") Te.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
718
|
-
validation: "cuid",
|
|
719
|
-
code: d.invalid_string,
|
|
720
|
-
message: n.message
|
|
721
|
-
}), r.dirty());
|
|
722
|
-
else if (n.kind === "cuid2") Se.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
723
|
-
validation: "cuid2",
|
|
724
|
-
code: d.invalid_string,
|
|
725
|
-
message: n.message
|
|
726
|
-
}), r.dirty());
|
|
727
|
-
else if (n.kind === "ulid") Ne.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
728
|
-
validation: "ulid",
|
|
729
|
-
code: d.invalid_string,
|
|
730
|
-
message: n.message
|
|
731
|
-
}), r.dirty());
|
|
732
|
-
else if (n.kind === "url") try {
|
|
733
|
-
new URL(e.data);
|
|
734
|
-
} catch {
|
|
735
|
-
a = this._getOrReturnCtx(e, a), c(a, {
|
|
736
|
-
validation: "url",
|
|
737
|
-
code: d.invalid_string,
|
|
738
|
-
message: n.message
|
|
739
|
-
}), r.dirty();
|
|
740
|
-
}
|
|
741
|
-
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
742
|
-
validation: "regex",
|
|
743
|
-
code: d.invalid_string,
|
|
744
|
-
message: n.message
|
|
745
|
-
}), r.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
746
|
-
code: d.invalid_string,
|
|
747
|
-
validation: {
|
|
748
|
-
includes: n.value,
|
|
749
|
-
position: n.position
|
|
750
|
-
},
|
|
751
|
-
message: n.message
|
|
752
|
-
}), r.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
753
|
-
code: d.invalid_string,
|
|
754
|
-
validation: {
|
|
755
|
-
startsWith: n.value
|
|
756
|
-
},
|
|
757
|
-
message: n.message
|
|
758
|
-
}), r.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
759
|
-
code: d.invalid_string,
|
|
760
|
-
validation: {
|
|
761
|
-
endsWith: n.value
|
|
762
|
-
},
|
|
763
|
-
message: n.message
|
|
764
|
-
}), r.dirty()) : n.kind === "datetime" ? Be(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
765
|
-
code: d.invalid_string,
|
|
766
|
-
validation: "datetime",
|
|
767
|
-
message: n.message
|
|
768
|
-
}), r.dirty()) : n.kind === "date" ? De.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
769
|
-
code: d.invalid_string,
|
|
770
|
-
validation: "date",
|
|
771
|
-
message: n.message
|
|
772
|
-
}), r.dirty()) : n.kind === "time" ? Ue(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
773
|
-
code: d.invalid_string,
|
|
774
|
-
validation: "time",
|
|
775
|
-
message: n.message
|
|
776
|
-
}), r.dirty()) : n.kind === "duration" ? je.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
777
|
-
validation: "duration",
|
|
778
|
-
code: d.invalid_string,
|
|
779
|
-
message: n.message
|
|
780
|
-
}), r.dirty()) : n.kind === "ip" ? Fe(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
781
|
-
validation: "ip",
|
|
782
|
-
code: d.invalid_string,
|
|
783
|
-
message: n.message
|
|
784
|
-
}), r.dirty()) : n.kind === "jwt" ? We(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
785
|
-
validation: "jwt",
|
|
786
|
-
code: d.invalid_string,
|
|
787
|
-
message: n.message
|
|
788
|
-
}), r.dirty()) : n.kind === "cidr" ? Je(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
789
|
-
validation: "cidr",
|
|
790
|
-
code: d.invalid_string,
|
|
791
|
-
message: n.message
|
|
792
|
-
}), r.dirty()) : n.kind === "base64" ? Le.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
793
|
-
validation: "base64",
|
|
794
|
-
code: d.invalid_string,
|
|
795
|
-
message: n.message
|
|
796
|
-
}), r.dirty()) : n.kind === "base64url" ? ze.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
797
|
-
validation: "base64url",
|
|
798
|
-
code: d.invalid_string,
|
|
799
|
-
message: n.message
|
|
800
|
-
}), r.dirty()) : v.assertNever(n);
|
|
801
|
-
return {
|
|
802
|
-
status: r.value,
|
|
803
|
-
value: e.data
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
_regex(e, t, r) {
|
|
807
|
-
return this.refinement((a) => e.test(a), {
|
|
808
|
-
validation: t,
|
|
809
|
-
code: d.invalid_string,
|
|
810
|
-
...h.errToObj(r)
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
_addCheck(e) {
|
|
814
|
-
return new Z({
|
|
815
|
-
...this._def,
|
|
816
|
-
checks: [
|
|
817
|
-
...this._def.checks,
|
|
818
|
-
e
|
|
819
|
-
]
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
email(e) {
|
|
823
|
-
return this._addCheck({
|
|
824
|
-
kind: "email",
|
|
825
|
-
...h.errToObj(e)
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
url(e) {
|
|
829
|
-
return this._addCheck({
|
|
830
|
-
kind: "url",
|
|
831
|
-
...h.errToObj(e)
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
emoji(e) {
|
|
835
|
-
return this._addCheck({
|
|
836
|
-
kind: "emoji",
|
|
837
|
-
...h.errToObj(e)
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
uuid(e) {
|
|
841
|
-
return this._addCheck({
|
|
842
|
-
kind: "uuid",
|
|
843
|
-
...h.errToObj(e)
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
nanoid(e) {
|
|
847
|
-
return this._addCheck({
|
|
848
|
-
kind: "nanoid",
|
|
849
|
-
...h.errToObj(e)
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
cuid(e) {
|
|
853
|
-
return this._addCheck({
|
|
854
|
-
kind: "cuid",
|
|
855
|
-
...h.errToObj(e)
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
cuid2(e) {
|
|
859
|
-
return this._addCheck({
|
|
860
|
-
kind: "cuid2",
|
|
861
|
-
...h.errToObj(e)
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
ulid(e) {
|
|
865
|
-
return this._addCheck({
|
|
866
|
-
kind: "ulid",
|
|
867
|
-
...h.errToObj(e)
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
base64(e) {
|
|
871
|
-
return this._addCheck({
|
|
872
|
-
kind: "base64",
|
|
873
|
-
...h.errToObj(e)
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
base64url(e) {
|
|
877
|
-
return this._addCheck({
|
|
878
|
-
kind: "base64url",
|
|
879
|
-
...h.errToObj(e)
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
jwt(e) {
|
|
883
|
-
return this._addCheck({
|
|
884
|
-
kind: "jwt",
|
|
885
|
-
...h.errToObj(e)
|
|
886
|
-
});
|
|
887
|
-
}
|
|
888
|
-
ip(e) {
|
|
889
|
-
return this._addCheck({
|
|
890
|
-
kind: "ip",
|
|
891
|
-
...h.errToObj(e)
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
cidr(e) {
|
|
895
|
-
return this._addCheck({
|
|
896
|
-
kind: "cidr",
|
|
897
|
-
...h.errToObj(e)
|
|
898
|
-
});
|
|
899
|
-
}
|
|
900
|
-
datetime(e) {
|
|
901
|
-
return typeof e == "string" ? this._addCheck({
|
|
902
|
-
kind: "datetime",
|
|
903
|
-
precision: null,
|
|
904
|
-
offset: false,
|
|
905
|
-
local: false,
|
|
906
|
-
message: e
|
|
907
|
-
}) : this._addCheck({
|
|
908
|
-
kind: "datetime",
|
|
909
|
-
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
910
|
-
offset: (e == null ? void 0 : e.offset) ?? false,
|
|
911
|
-
local: (e == null ? void 0 : e.local) ?? false,
|
|
912
|
-
...h.errToObj(e == null ? void 0 : e.message)
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
date(e) {
|
|
916
|
-
return this._addCheck({
|
|
917
|
-
kind: "date",
|
|
918
|
-
message: e
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
time(e) {
|
|
922
|
-
return typeof e == "string" ? this._addCheck({
|
|
923
|
-
kind: "time",
|
|
924
|
-
precision: null,
|
|
925
|
-
message: e
|
|
926
|
-
}) : this._addCheck({
|
|
927
|
-
kind: "time",
|
|
928
|
-
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
929
|
-
...h.errToObj(e == null ? void 0 : e.message)
|
|
930
|
-
});
|
|
931
|
-
}
|
|
932
|
-
duration(e) {
|
|
933
|
-
return this._addCheck({
|
|
934
|
-
kind: "duration",
|
|
935
|
-
...h.errToObj(e)
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
regex(e, t) {
|
|
939
|
-
return this._addCheck({
|
|
940
|
-
kind: "regex",
|
|
941
|
-
regex: e,
|
|
942
|
-
...h.errToObj(t)
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
includes(e, t) {
|
|
946
|
-
return this._addCheck({
|
|
947
|
-
kind: "includes",
|
|
948
|
-
value: e,
|
|
949
|
-
position: t == null ? void 0 : t.position,
|
|
950
|
-
...h.errToObj(t == null ? void 0 : t.message)
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
startsWith(e, t) {
|
|
954
|
-
return this._addCheck({
|
|
955
|
-
kind: "startsWith",
|
|
956
|
-
value: e,
|
|
957
|
-
...h.errToObj(t)
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
endsWith(e, t) {
|
|
961
|
-
return this._addCheck({
|
|
962
|
-
kind: "endsWith",
|
|
963
|
-
value: e,
|
|
964
|
-
...h.errToObj(t)
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
min(e, t) {
|
|
968
|
-
return this._addCheck({
|
|
969
|
-
kind: "min",
|
|
970
|
-
value: e,
|
|
971
|
-
...h.errToObj(t)
|
|
972
|
-
});
|
|
973
|
-
}
|
|
974
|
-
max(e, t) {
|
|
975
|
-
return this._addCheck({
|
|
976
|
-
kind: "max",
|
|
977
|
-
value: e,
|
|
978
|
-
...h.errToObj(t)
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
length(e, t) {
|
|
982
|
-
return this._addCheck({
|
|
983
|
-
kind: "length",
|
|
984
|
-
value: e,
|
|
985
|
-
...h.errToObj(t)
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
nonempty(e) {
|
|
989
|
-
return this.min(1, h.errToObj(e));
|
|
990
|
-
}
|
|
991
|
-
trim() {
|
|
992
|
-
return new Z({
|
|
993
|
-
...this._def,
|
|
994
|
-
checks: [
|
|
995
|
-
...this._def.checks,
|
|
996
|
-
{
|
|
997
|
-
kind: "trim"
|
|
998
|
-
}
|
|
999
|
-
]
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
toLowerCase() {
|
|
1003
|
-
return new Z({
|
|
1004
|
-
...this._def,
|
|
1005
|
-
checks: [
|
|
1006
|
-
...this._def.checks,
|
|
1007
|
-
{
|
|
1008
|
-
kind: "toLowerCase"
|
|
1009
|
-
}
|
|
1010
|
-
]
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
toUpperCase() {
|
|
1014
|
-
return new Z({
|
|
1015
|
-
...this._def,
|
|
1016
|
-
checks: [
|
|
1017
|
-
...this._def.checks,
|
|
1018
|
-
{
|
|
1019
|
-
kind: "toUpperCase"
|
|
1020
|
-
}
|
|
1021
|
-
]
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
get isDatetime() {
|
|
1025
|
-
return !!this._def.checks.find((e) => e.kind === "datetime");
|
|
1026
|
-
}
|
|
1027
|
-
get isDate() {
|
|
1028
|
-
return !!this._def.checks.find((e) => e.kind === "date");
|
|
1029
|
-
}
|
|
1030
|
-
get isTime() {
|
|
1031
|
-
return !!this._def.checks.find((e) => e.kind === "time");
|
|
1032
|
-
}
|
|
1033
|
-
get isDuration() {
|
|
1034
|
-
return !!this._def.checks.find((e) => e.kind === "duration");
|
|
1035
|
-
}
|
|
1036
|
-
get isEmail() {
|
|
1037
|
-
return !!this._def.checks.find((e) => e.kind === "email");
|
|
1038
|
-
}
|
|
1039
|
-
get isURL() {
|
|
1040
|
-
return !!this._def.checks.find((e) => e.kind === "url");
|
|
1041
|
-
}
|
|
1042
|
-
get isEmoji() {
|
|
1043
|
-
return !!this._def.checks.find((e) => e.kind === "emoji");
|
|
1044
|
-
}
|
|
1045
|
-
get isUUID() {
|
|
1046
|
-
return !!this._def.checks.find((e) => e.kind === "uuid");
|
|
1047
|
-
}
|
|
1048
|
-
get isNANOID() {
|
|
1049
|
-
return !!this._def.checks.find((e) => e.kind === "nanoid");
|
|
1050
|
-
}
|
|
1051
|
-
get isCUID() {
|
|
1052
|
-
return !!this._def.checks.find((e) => e.kind === "cuid");
|
|
1053
|
-
}
|
|
1054
|
-
get isCUID2() {
|
|
1055
|
-
return !!this._def.checks.find((e) => e.kind === "cuid2");
|
|
1056
|
-
}
|
|
1057
|
-
get isULID() {
|
|
1058
|
-
return !!this._def.checks.find((e) => e.kind === "ulid");
|
|
1059
|
-
}
|
|
1060
|
-
get isIP() {
|
|
1061
|
-
return !!this._def.checks.find((e) => e.kind === "ip");
|
|
1062
|
-
}
|
|
1063
|
-
get isCIDR() {
|
|
1064
|
-
return !!this._def.checks.find((e) => e.kind === "cidr");
|
|
1065
|
-
}
|
|
1066
|
-
get isBase64() {
|
|
1067
|
-
return !!this._def.checks.find((e) => e.kind === "base64");
|
|
1068
|
-
}
|
|
1069
|
-
get isBase64url() {
|
|
1070
|
-
return !!this._def.checks.find((e) => e.kind === "base64url");
|
|
1071
|
-
}
|
|
1072
|
-
get minLength() {
|
|
1073
|
-
let e = null;
|
|
1074
|
-
for (const t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1075
|
-
return e;
|
|
1076
|
-
}
|
|
1077
|
-
get maxLength() {
|
|
1078
|
-
let e = null;
|
|
1079
|
-
for (const t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1080
|
-
return e;
|
|
1081
|
-
}
|
|
124
|
+
const je = /* @__PURE__ */ new Set([
|
|
125
|
+
"string",
|
|
126
|
+
"number",
|
|
127
|
+
"symbol"
|
|
128
|
+
]);
|
|
129
|
+
function Te(e) {
|
|
130
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1082
131
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
coerce: (s == null ? void 0 : s.coerce) ?? false,
|
|
1087
|
-
..._(s)
|
|
1088
|
-
});
|
|
1089
|
-
function qe(s, e) {
|
|
1090
|
-
const t = (s.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, a = t > r ? t : r, n = Number.parseInt(s.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
|
|
1091
|
-
return n % i / 10 ** a;
|
|
132
|
+
function k(e, n, t) {
|
|
133
|
+
const r = new e._zod.constr(n ?? e._zod.def);
|
|
134
|
+
return (!n || (t == null ? void 0 : t.parent)) && (r._zod.parent = e), r;
|
|
1092
135
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
const a = new k();
|
|
1108
|
-
for (const n of this._def.checks) n.kind === "int" ? v.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
|
|
1109
|
-
code: d.invalid_type,
|
|
1110
|
-
expected: "integer",
|
|
1111
|
-
received: "float",
|
|
1112
|
-
message: n.message
|
|
1113
|
-
}), a.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r), c(r, {
|
|
1114
|
-
code: d.too_small,
|
|
1115
|
-
minimum: n.value,
|
|
1116
|
-
type: "number",
|
|
1117
|
-
inclusive: n.inclusive,
|
|
1118
|
-
exact: false,
|
|
1119
|
-
message: n.message
|
|
1120
|
-
}), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r), c(r, {
|
|
1121
|
-
code: d.too_big,
|
|
1122
|
-
maximum: n.value,
|
|
1123
|
-
type: "number",
|
|
1124
|
-
inclusive: n.inclusive,
|
|
1125
|
-
exact: false,
|
|
1126
|
-
message: n.message
|
|
1127
|
-
}), a.dirty()) : n.kind === "multipleOf" ? qe(e.data, n.value) !== 0 && (r = this._getOrReturnCtx(e, r), c(r, {
|
|
1128
|
-
code: d.not_multiple_of,
|
|
1129
|
-
multipleOf: n.value,
|
|
1130
|
-
message: n.message
|
|
1131
|
-
}), a.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
|
|
1132
|
-
code: d.not_finite,
|
|
1133
|
-
message: n.message
|
|
1134
|
-
}), a.dirty()) : v.assertNever(n);
|
|
1135
|
-
return {
|
|
1136
|
-
status: a.value,
|
|
1137
|
-
value: e.data
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
gte(e, t) {
|
|
1141
|
-
return this.setLimit("min", e, true, h.toString(t));
|
|
1142
|
-
}
|
|
1143
|
-
gt(e, t) {
|
|
1144
|
-
return this.setLimit("min", e, false, h.toString(t));
|
|
1145
|
-
}
|
|
1146
|
-
lte(e, t) {
|
|
1147
|
-
return this.setLimit("max", e, true, h.toString(t));
|
|
1148
|
-
}
|
|
1149
|
-
lt(e, t) {
|
|
1150
|
-
return this.setLimit("max", e, false, h.toString(t));
|
|
1151
|
-
}
|
|
1152
|
-
setLimit(e, t, r, a) {
|
|
1153
|
-
return new P({
|
|
1154
|
-
...this._def,
|
|
1155
|
-
checks: [
|
|
1156
|
-
...this._def.checks,
|
|
1157
|
-
{
|
|
1158
|
-
kind: e,
|
|
1159
|
-
value: t,
|
|
1160
|
-
inclusive: r,
|
|
1161
|
-
message: h.toString(a)
|
|
1162
|
-
}
|
|
1163
|
-
]
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
_addCheck(e) {
|
|
1167
|
-
return new P({
|
|
1168
|
-
...this._def,
|
|
1169
|
-
checks: [
|
|
1170
|
-
...this._def.checks,
|
|
1171
|
-
e
|
|
1172
|
-
]
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
int(e) {
|
|
1176
|
-
return this._addCheck({
|
|
1177
|
-
kind: "int",
|
|
1178
|
-
message: h.toString(e)
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
positive(e) {
|
|
1182
|
-
return this._addCheck({
|
|
1183
|
-
kind: "min",
|
|
1184
|
-
value: 0,
|
|
1185
|
-
inclusive: false,
|
|
1186
|
-
message: h.toString(e)
|
|
1187
|
-
});
|
|
1188
|
-
}
|
|
1189
|
-
negative(e) {
|
|
1190
|
-
return this._addCheck({
|
|
1191
|
-
kind: "max",
|
|
1192
|
-
value: 0,
|
|
1193
|
-
inclusive: false,
|
|
1194
|
-
message: h.toString(e)
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
nonpositive(e) {
|
|
1198
|
-
return this._addCheck({
|
|
1199
|
-
kind: "max",
|
|
1200
|
-
value: 0,
|
|
1201
|
-
inclusive: true,
|
|
1202
|
-
message: h.toString(e)
|
|
1203
|
-
});
|
|
1204
|
-
}
|
|
1205
|
-
nonnegative(e) {
|
|
1206
|
-
return this._addCheck({
|
|
1207
|
-
kind: "min",
|
|
1208
|
-
value: 0,
|
|
1209
|
-
inclusive: true,
|
|
1210
|
-
message: h.toString(e)
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
multipleOf(e, t) {
|
|
1214
|
-
return this._addCheck({
|
|
1215
|
-
kind: "multipleOf",
|
|
1216
|
-
value: e,
|
|
1217
|
-
message: h.toString(t)
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
finite(e) {
|
|
1221
|
-
return this._addCheck({
|
|
1222
|
-
kind: "finite",
|
|
1223
|
-
message: h.toString(e)
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
safe(e) {
|
|
1227
|
-
return this._addCheck({
|
|
1228
|
-
kind: "min",
|
|
1229
|
-
inclusive: true,
|
|
1230
|
-
value: Number.MIN_SAFE_INTEGER,
|
|
1231
|
-
message: h.toString(e)
|
|
1232
|
-
})._addCheck({
|
|
1233
|
-
kind: "max",
|
|
1234
|
-
inclusive: true,
|
|
1235
|
-
value: Number.MAX_SAFE_INTEGER,
|
|
1236
|
-
message: h.toString(e)
|
|
1237
|
-
});
|
|
1238
|
-
}
|
|
1239
|
-
get minValue() {
|
|
1240
|
-
let e = null;
|
|
1241
|
-
for (const t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1242
|
-
return e;
|
|
1243
|
-
}
|
|
1244
|
-
get maxValue() {
|
|
1245
|
-
let e = null;
|
|
1246
|
-
for (const t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1247
|
-
return e;
|
|
1248
|
-
}
|
|
1249
|
-
get isInt() {
|
|
1250
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && v.isInteger(e.value));
|
|
1251
|
-
}
|
|
1252
|
-
get isFinite() {
|
|
1253
|
-
let e = null, t = null;
|
|
1254
|
-
for (const r of this._def.checks) {
|
|
1255
|
-
if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf") return true;
|
|
1256
|
-
r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
|
|
1257
|
-
}
|
|
1258
|
-
return Number.isFinite(t) && Number.isFinite(e);
|
|
1259
|
-
}
|
|
136
|
+
function $(e) {
|
|
137
|
+
const n = e;
|
|
138
|
+
if (!n) return {};
|
|
139
|
+
if (typeof n == "string") return {
|
|
140
|
+
error: () => n
|
|
141
|
+
};
|
|
142
|
+
if ((n == null ? void 0 : n.message) !== void 0) {
|
|
143
|
+
if ((n == null ? void 0 : n.error) !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
144
|
+
n.error = n.message;
|
|
145
|
+
}
|
|
146
|
+
return delete n.message, typeof n.error == "string" ? {
|
|
147
|
+
...n,
|
|
148
|
+
error: () => n.error
|
|
149
|
+
} : n;
|
|
1260
150
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
typeName: p.ZodNumber,
|
|
1264
|
-
coerce: (s == null ? void 0 : s.coerce) || false,
|
|
1265
|
-
..._(s)
|
|
1266
|
-
});
|
|
1267
|
-
class L extends y {
|
|
1268
|
-
constructor() {
|
|
1269
|
-
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1270
|
-
}
|
|
1271
|
-
_parse(e) {
|
|
1272
|
-
if (this._def.coerce) try {
|
|
1273
|
-
e.data = BigInt(e.data);
|
|
1274
|
-
} catch {
|
|
1275
|
-
return this._getInvalidInput(e);
|
|
1276
|
-
}
|
|
1277
|
-
if (this._getType(e) !== f.bigint) return this._getInvalidInput(e);
|
|
1278
|
-
let r;
|
|
1279
|
-
const a = new k();
|
|
1280
|
-
for (const n of this._def.checks) n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r), c(r, {
|
|
1281
|
-
code: d.too_small,
|
|
1282
|
-
type: "bigint",
|
|
1283
|
-
minimum: n.value,
|
|
1284
|
-
inclusive: n.inclusive,
|
|
1285
|
-
message: n.message
|
|
1286
|
-
}), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r), c(r, {
|
|
1287
|
-
code: d.too_big,
|
|
1288
|
-
type: "bigint",
|
|
1289
|
-
maximum: n.value,
|
|
1290
|
-
inclusive: n.inclusive,
|
|
1291
|
-
message: n.message
|
|
1292
|
-
}), a.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), c(r, {
|
|
1293
|
-
code: d.not_multiple_of,
|
|
1294
|
-
multipleOf: n.value,
|
|
1295
|
-
message: n.message
|
|
1296
|
-
}), a.dirty()) : v.assertNever(n);
|
|
1297
|
-
return {
|
|
1298
|
-
status: a.value,
|
|
1299
|
-
value: e.data
|
|
1300
|
-
};
|
|
1301
|
-
}
|
|
1302
|
-
_getInvalidInput(e) {
|
|
1303
|
-
const t = this._getOrReturnCtx(e);
|
|
1304
|
-
return c(t, {
|
|
1305
|
-
code: d.invalid_type,
|
|
1306
|
-
expected: f.bigint,
|
|
1307
|
-
received: t.parsedType
|
|
1308
|
-
}), m;
|
|
1309
|
-
}
|
|
1310
|
-
gte(e, t) {
|
|
1311
|
-
return this.setLimit("min", e, true, h.toString(t));
|
|
1312
|
-
}
|
|
1313
|
-
gt(e, t) {
|
|
1314
|
-
return this.setLimit("min", e, false, h.toString(t));
|
|
1315
|
-
}
|
|
1316
|
-
lte(e, t) {
|
|
1317
|
-
return this.setLimit("max", e, true, h.toString(t));
|
|
1318
|
-
}
|
|
1319
|
-
lt(e, t) {
|
|
1320
|
-
return this.setLimit("max", e, false, h.toString(t));
|
|
1321
|
-
}
|
|
1322
|
-
setLimit(e, t, r, a) {
|
|
1323
|
-
return new L({
|
|
1324
|
-
...this._def,
|
|
1325
|
-
checks: [
|
|
1326
|
-
...this._def.checks,
|
|
1327
|
-
{
|
|
1328
|
-
kind: e,
|
|
1329
|
-
value: t,
|
|
1330
|
-
inclusive: r,
|
|
1331
|
-
message: h.toString(a)
|
|
1332
|
-
}
|
|
1333
|
-
]
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
_addCheck(e) {
|
|
1337
|
-
return new L({
|
|
1338
|
-
...this._def,
|
|
1339
|
-
checks: [
|
|
1340
|
-
...this._def.checks,
|
|
1341
|
-
e
|
|
1342
|
-
]
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
positive(e) {
|
|
1346
|
-
return this._addCheck({
|
|
1347
|
-
kind: "min",
|
|
1348
|
-
value: BigInt(0),
|
|
1349
|
-
inclusive: false,
|
|
1350
|
-
message: h.toString(e)
|
|
1351
|
-
});
|
|
1352
|
-
}
|
|
1353
|
-
negative(e) {
|
|
1354
|
-
return this._addCheck({
|
|
1355
|
-
kind: "max",
|
|
1356
|
-
value: BigInt(0),
|
|
1357
|
-
inclusive: false,
|
|
1358
|
-
message: h.toString(e)
|
|
1359
|
-
});
|
|
1360
|
-
}
|
|
1361
|
-
nonpositive(e) {
|
|
1362
|
-
return this._addCheck({
|
|
1363
|
-
kind: "max",
|
|
1364
|
-
value: BigInt(0),
|
|
1365
|
-
inclusive: true,
|
|
1366
|
-
message: h.toString(e)
|
|
1367
|
-
});
|
|
1368
|
-
}
|
|
1369
|
-
nonnegative(e) {
|
|
1370
|
-
return this._addCheck({
|
|
1371
|
-
kind: "min",
|
|
1372
|
-
value: BigInt(0),
|
|
1373
|
-
inclusive: true,
|
|
1374
|
-
message: h.toString(e)
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
multipleOf(e, t) {
|
|
1378
|
-
return this._addCheck({
|
|
1379
|
-
kind: "multipleOf",
|
|
1380
|
-
value: e,
|
|
1381
|
-
message: h.toString(t)
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1384
|
-
get minValue() {
|
|
1385
|
-
let e = null;
|
|
1386
|
-
for (const t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1387
|
-
return e;
|
|
1388
|
-
}
|
|
1389
|
-
get maxValue() {
|
|
1390
|
-
let e = null;
|
|
1391
|
-
for (const t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1392
|
-
return e;
|
|
1393
|
-
}
|
|
151
|
+
function Re(e) {
|
|
152
|
+
return Object.keys(e).filter((n) => e[n]._zod.optin === "optional" && e[n]._zod.optout === "optional");
|
|
1394
153
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
code: d.invalid_type,
|
|
1407
|
-
expected: f.boolean,
|
|
1408
|
-
received: r.parsedType
|
|
1409
|
-
}), m;
|
|
1410
|
-
}
|
|
1411
|
-
return b(e.data);
|
|
1412
|
-
}
|
|
154
|
+
function Se(e, n) {
|
|
155
|
+
const t = {}, r = e._zod.def;
|
|
156
|
+
for (const o in n) {
|
|
157
|
+
if (!(o in r.shape)) throw new Error(`Unrecognized key: "${o}"`);
|
|
158
|
+
n[o] && (t[o] = r.shape[o]);
|
|
159
|
+
}
|
|
160
|
+
return k(e, {
|
|
161
|
+
...e._zod.def,
|
|
162
|
+
shape: t,
|
|
163
|
+
checks: []
|
|
164
|
+
});
|
|
1413
165
|
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
}), m;
|
|
1428
|
-
}
|
|
1429
|
-
if (Number.isNaN(e.data.getTime())) {
|
|
1430
|
-
const n = this._getOrReturnCtx(e);
|
|
1431
|
-
return c(n, {
|
|
1432
|
-
code: d.invalid_date
|
|
1433
|
-
}), m;
|
|
1434
|
-
}
|
|
1435
|
-
const r = new k();
|
|
1436
|
-
let a;
|
|
1437
|
-
for (const n of this._def.checks) n.kind === "min" ? e.data.getTime() < n.value && (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1438
|
-
code: d.too_small,
|
|
1439
|
-
message: n.message,
|
|
1440
|
-
inclusive: true,
|
|
1441
|
-
exact: false,
|
|
1442
|
-
minimum: n.value,
|
|
1443
|
-
type: "date"
|
|
1444
|
-
}), r.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1445
|
-
code: d.too_big,
|
|
1446
|
-
message: n.message,
|
|
1447
|
-
inclusive: true,
|
|
1448
|
-
exact: false,
|
|
1449
|
-
maximum: n.value,
|
|
1450
|
-
type: "date"
|
|
1451
|
-
}), r.dirty()) : v.assertNever(n);
|
|
1452
|
-
return {
|
|
1453
|
-
status: r.value,
|
|
1454
|
-
value: new Date(e.data.getTime())
|
|
1455
|
-
};
|
|
1456
|
-
}
|
|
1457
|
-
_addCheck(e) {
|
|
1458
|
-
return new B({
|
|
1459
|
-
...this._def,
|
|
1460
|
-
checks: [
|
|
1461
|
-
...this._def.checks,
|
|
1462
|
-
e
|
|
1463
|
-
]
|
|
1464
|
-
});
|
|
1465
|
-
}
|
|
1466
|
-
min(e, t) {
|
|
1467
|
-
return this._addCheck({
|
|
1468
|
-
kind: "min",
|
|
1469
|
-
value: e.getTime(),
|
|
1470
|
-
message: h.toString(t)
|
|
1471
|
-
});
|
|
1472
|
-
}
|
|
1473
|
-
max(e, t) {
|
|
1474
|
-
return this._addCheck({
|
|
1475
|
-
kind: "max",
|
|
1476
|
-
value: e.getTime(),
|
|
1477
|
-
message: h.toString(t)
|
|
1478
|
-
});
|
|
1479
|
-
}
|
|
1480
|
-
get minDate() {
|
|
1481
|
-
let e = null;
|
|
1482
|
-
for (const t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1483
|
-
return e != null ? new Date(e) : null;
|
|
1484
|
-
}
|
|
1485
|
-
get maxDate() {
|
|
1486
|
-
let e = null;
|
|
1487
|
-
for (const t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1488
|
-
return e != null ? new Date(e) : null;
|
|
1489
|
-
}
|
|
166
|
+
function xe(e, n) {
|
|
167
|
+
const t = {
|
|
168
|
+
...e._zod.def.shape
|
|
169
|
+
}, r = e._zod.def;
|
|
170
|
+
for (const o in n) {
|
|
171
|
+
if (!(o in r.shape)) throw new Error(`Unrecognized key: "${o}"`);
|
|
172
|
+
n[o] && delete t[o];
|
|
173
|
+
}
|
|
174
|
+
return k(e, {
|
|
175
|
+
...e._zod.def,
|
|
176
|
+
shape: t,
|
|
177
|
+
checks: []
|
|
178
|
+
});
|
|
1490
179
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
}), m;
|
|
1506
|
-
}
|
|
1507
|
-
return b(e.data);
|
|
1508
|
-
}
|
|
180
|
+
function Ae(e, n) {
|
|
181
|
+
if (!D(n)) throw new Error("Invalid input to extend: expected a plain object");
|
|
182
|
+
const t = {
|
|
183
|
+
...e._zod.def,
|
|
184
|
+
get shape() {
|
|
185
|
+
const r = {
|
|
186
|
+
...e._zod.def.shape,
|
|
187
|
+
...n
|
|
188
|
+
};
|
|
189
|
+
return W(this, "shape", r), r;
|
|
190
|
+
},
|
|
191
|
+
checks: []
|
|
192
|
+
};
|
|
193
|
+
return k(e, t);
|
|
1509
194
|
}
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
return
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
}
|
|
1524
|
-
return b(e.data);
|
|
1525
|
-
}
|
|
195
|
+
function Ne(e, n) {
|
|
196
|
+
return k(e, {
|
|
197
|
+
...e._zod.def,
|
|
198
|
+
get shape() {
|
|
199
|
+
const t = {
|
|
200
|
+
...e._zod.def.shape,
|
|
201
|
+
...n._zod.def.shape
|
|
202
|
+
};
|
|
203
|
+
return W(this, "shape", t), t;
|
|
204
|
+
},
|
|
205
|
+
catchall: n._zod.def.catchall,
|
|
206
|
+
checks: []
|
|
207
|
+
});
|
|
1526
208
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
209
|
+
function Ie(e, n, t) {
|
|
210
|
+
const r = n._zod.def.shape, o = {
|
|
211
|
+
...r
|
|
212
|
+
};
|
|
213
|
+
if (t) for (const s in t) {
|
|
214
|
+
if (!(s in r)) throw new Error(`Unrecognized key: "${s}"`);
|
|
215
|
+
t[s] && (o[s] = e ? new e({
|
|
216
|
+
type: "optional",
|
|
217
|
+
innerType: r[s]
|
|
218
|
+
}) : r[s]);
|
|
219
|
+
}
|
|
220
|
+
else for (const s in r) o[s] = e ? new e({
|
|
221
|
+
type: "optional",
|
|
222
|
+
innerType: r[s]
|
|
223
|
+
}) : r[s];
|
|
224
|
+
return k(n, {
|
|
225
|
+
...n._zod.def,
|
|
226
|
+
shape: o,
|
|
227
|
+
checks: []
|
|
228
|
+
});
|
|
1543
229
|
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
230
|
+
function Ce(e, n, t) {
|
|
231
|
+
const r = n._zod.def.shape, o = {
|
|
232
|
+
...r
|
|
233
|
+
};
|
|
234
|
+
if (t) for (const s in t) {
|
|
235
|
+
if (!(s in o)) throw new Error(`Unrecognized key: "${s}"`);
|
|
236
|
+
t[s] && (o[s] = new e({
|
|
237
|
+
type: "nonoptional",
|
|
238
|
+
innerType: r[s]
|
|
239
|
+
}));
|
|
1554
240
|
}
|
|
241
|
+
else for (const s in r) o[s] = new e({
|
|
242
|
+
type: "nonoptional",
|
|
243
|
+
innerType: r[s]
|
|
244
|
+
});
|
|
245
|
+
return k(n, {
|
|
246
|
+
...n._zod.def,
|
|
247
|
+
shape: o,
|
|
248
|
+
checks: []
|
|
249
|
+
});
|
|
1555
250
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
class ue extends y {
|
|
1561
|
-
constructor() {
|
|
1562
|
-
super(...arguments), this._unknown = true;
|
|
1563
|
-
}
|
|
1564
|
-
_parse(e) {
|
|
1565
|
-
return b(e.data);
|
|
1566
|
-
}
|
|
251
|
+
function T(e, n = 0) {
|
|
252
|
+
var _a;
|
|
253
|
+
for (let t = n; t < e.issues.length; t++) if (((_a = e.issues[t]) == null ? void 0 : _a.continue) !== true) return true;
|
|
254
|
+
return false;
|
|
1567
255
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
_parse(e) {
|
|
1574
|
-
const t = this._getOrReturnCtx(e);
|
|
1575
|
-
return c(t, {
|
|
1576
|
-
code: d.invalid_type,
|
|
1577
|
-
expected: f.never,
|
|
1578
|
-
received: t.parsedType
|
|
1579
|
-
}), m;
|
|
1580
|
-
}
|
|
256
|
+
function H(e, n) {
|
|
257
|
+
return n.map((t) => {
|
|
258
|
+
var r;
|
|
259
|
+
return (r = t).path ?? (r.path = []), t.path.unshift(e), t;
|
|
260
|
+
});
|
|
1581
261
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
}), m;
|
|
1595
|
-
}
|
|
1596
|
-
return b(e.data);
|
|
262
|
+
function N(e) {
|
|
263
|
+
return typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
264
|
+
}
|
|
265
|
+
function P(e, n, t) {
|
|
266
|
+
var _a, _b, _c, _d, _e2, _f;
|
|
267
|
+
const r = {
|
|
268
|
+
...e,
|
|
269
|
+
path: e.path ?? []
|
|
270
|
+
};
|
|
271
|
+
if (!e.message) {
|
|
272
|
+
const o = N((_c = (_b = (_a = e.inst) == null ? void 0 : _a._zod.def) == null ? void 0 : _b.error) == null ? void 0 : _c.call(_b, e)) ?? N((_d = n == null ? void 0 : n.error) == null ? void 0 : _d.call(n, e)) ?? N((_e2 = t.customError) == null ? void 0 : _e2.call(t, e)) ?? N((_f = t.localeError) == null ? void 0 : _f.call(t, e)) ?? "Invalid input";
|
|
273
|
+
r.message = o;
|
|
1597
274
|
}
|
|
275
|
+
return delete r.inst, delete r.continue, (n == null ? void 0 : n.reportInput) || delete r.input, r;
|
|
276
|
+
}
|
|
277
|
+
function B(e) {
|
|
278
|
+
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
1598
279
|
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
280
|
+
function S(...e) {
|
|
281
|
+
const [n, t, r] = e;
|
|
282
|
+
return typeof n == "string" ? {
|
|
283
|
+
message: n,
|
|
284
|
+
code: "custom",
|
|
285
|
+
input: t,
|
|
286
|
+
inst: r
|
|
287
|
+
} : {
|
|
288
|
+
...n
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const ve = (e, n) => {
|
|
292
|
+
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
293
|
+
value: e._zod,
|
|
294
|
+
enumerable: false
|
|
295
|
+
}), Object.defineProperty(e, "issues", {
|
|
296
|
+
value: n,
|
|
297
|
+
enumerable: false
|
|
298
|
+
}), Object.defineProperty(e, "message", {
|
|
299
|
+
get() {
|
|
300
|
+
return JSON.stringify(n, Oe, 2);
|
|
301
|
+
},
|
|
302
|
+
enumerable: true
|
|
303
|
+
}), Object.defineProperty(e, "toString", {
|
|
304
|
+
value: () => e.message,
|
|
305
|
+
enumerable: false
|
|
306
|
+
});
|
|
307
|
+
}, ge = c("$ZodError", ve), ze = c("$ZodError", ve, {
|
|
308
|
+
Parent: Error
|
|
1602
309
|
});
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
}
|
|
1623
|
-
if (a.minLength !== null && t.data.length < a.minLength.value && (c(t, {
|
|
1624
|
-
code: d.too_small,
|
|
1625
|
-
minimum: a.minLength.value,
|
|
1626
|
-
type: "array",
|
|
1627
|
-
inclusive: true,
|
|
1628
|
-
exact: false,
|
|
1629
|
-
message: a.minLength.message
|
|
1630
|
-
}), r.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (c(t, {
|
|
1631
|
-
code: d.too_big,
|
|
1632
|
-
maximum: a.maxLength.value,
|
|
1633
|
-
type: "array",
|
|
1634
|
-
inclusive: true,
|
|
1635
|
-
exact: false,
|
|
1636
|
-
message: a.maxLength.message
|
|
1637
|
-
}), r.dirty()), t.common.async) return Promise.all([
|
|
1638
|
-
...t.data
|
|
1639
|
-
].map((i, o) => a.type._parseAsync(new N(t, i, t.path, o)))).then((i) => k.mergeArray(r, i));
|
|
1640
|
-
const n = [
|
|
1641
|
-
...t.data
|
|
1642
|
-
].map((i, o) => a.type._parseSync(new N(t, i, t.path, o)));
|
|
1643
|
-
return k.mergeArray(r, n);
|
|
1644
|
-
}
|
|
1645
|
-
get element() {
|
|
1646
|
-
return this._def.type;
|
|
1647
|
-
}
|
|
1648
|
-
min(e, t) {
|
|
1649
|
-
return new w({
|
|
1650
|
-
...this._def,
|
|
1651
|
-
minLength: {
|
|
1652
|
-
value: e,
|
|
1653
|
-
message: h.toString(t)
|
|
1654
|
-
}
|
|
310
|
+
function Le(e, n = (t) => t.message) {
|
|
311
|
+
const t = {}, r = [];
|
|
312
|
+
for (const o of e.issues) o.path.length > 0 ? (t[o.path[0]] = t[o.path[0]] || [], t[o.path[0]].push(n(o))) : r.push(n(o));
|
|
313
|
+
return {
|
|
314
|
+
formErrors: r,
|
|
315
|
+
fieldErrors: t
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function Ue(e, n) {
|
|
319
|
+
const t = n || function(s) {
|
|
320
|
+
return s.message;
|
|
321
|
+
}, r = {
|
|
322
|
+
_errors: []
|
|
323
|
+
}, o = (s) => {
|
|
324
|
+
for (const u of s.issues) if (u.code === "invalid_union" && u.errors.length) u.errors.map((i) => o({
|
|
325
|
+
issues: i
|
|
326
|
+
}));
|
|
327
|
+
else if (u.code === "invalid_key") o({
|
|
328
|
+
issues: u.issues
|
|
1655
329
|
});
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
return new w({
|
|
1659
|
-
...this._def,
|
|
1660
|
-
maxLength: {
|
|
1661
|
-
value: e,
|
|
1662
|
-
message: h.toString(t)
|
|
1663
|
-
}
|
|
330
|
+
else if (u.code === "invalid_element") o({
|
|
331
|
+
issues: u.issues
|
|
1664
332
|
});
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
333
|
+
else if (u.path.length === 0) r._errors.push(t(u));
|
|
334
|
+
else {
|
|
335
|
+
let i = r, a = 0;
|
|
336
|
+
for (; a < u.path.length; ) {
|
|
337
|
+
const d = u.path[a];
|
|
338
|
+
a === u.path.length - 1 ? (i[d] = i[d] || {
|
|
339
|
+
_errors: []
|
|
340
|
+
}, i[d]._errors.push(t(u))) : i[d] = i[d] || {
|
|
341
|
+
_errors: []
|
|
342
|
+
}, i = i[d], a++;
|
|
1672
343
|
}
|
|
1673
|
-
});
|
|
1674
|
-
}
|
|
1675
|
-
nonempty(e) {
|
|
1676
|
-
return this.min(1, e);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
w.create = (s, e) => new w({
|
|
1680
|
-
type: s,
|
|
1681
|
-
minLength: null,
|
|
1682
|
-
maxLength: null,
|
|
1683
|
-
exactLength: null,
|
|
1684
|
-
typeName: p.ZodArray,
|
|
1685
|
-
..._(e)
|
|
1686
|
-
});
|
|
1687
|
-
function j(s) {
|
|
1688
|
-
if (s instanceof x) {
|
|
1689
|
-
const e = {};
|
|
1690
|
-
for (const t in s.shape) {
|
|
1691
|
-
const r = s.shape[t];
|
|
1692
|
-
e[t] = S.create(j(r));
|
|
1693
344
|
}
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
shape: () => e
|
|
1697
|
-
});
|
|
1698
|
-
} else return s instanceof w ? new w({
|
|
1699
|
-
...s._def,
|
|
1700
|
-
type: j(s.element)
|
|
1701
|
-
}) : s instanceof S ? S.create(j(s.unwrap())) : s instanceof V ? V.create(j(s.unwrap())) : s instanceof R ? R.create(s.items.map((e) => j(e))) : s;
|
|
345
|
+
};
|
|
346
|
+
return o(e), r;
|
|
1702
347
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
var _a, _b;
|
|
1792
|
-
const a = ((_b = (_a = this._def).errorMap) == null ? void 0 : _b.call(_a, t, r).message) ?? r.defaultError;
|
|
1793
|
-
return t.code === "unrecognized_keys" ? {
|
|
1794
|
-
message: h.errToObj(e).message ?? a
|
|
1795
|
-
} : {
|
|
1796
|
-
message: a
|
|
1797
|
-
};
|
|
1798
|
-
}
|
|
1799
|
-
} : {}
|
|
1800
|
-
});
|
|
1801
|
-
}
|
|
1802
|
-
strip() {
|
|
1803
|
-
return new x({
|
|
1804
|
-
...this._def,
|
|
1805
|
-
unknownKeys: "strip"
|
|
1806
|
-
});
|
|
1807
|
-
}
|
|
1808
|
-
passthrough() {
|
|
1809
|
-
return new x({
|
|
1810
|
-
...this._def,
|
|
1811
|
-
unknownKeys: "passthrough"
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
extend(e) {
|
|
1815
|
-
return new x({
|
|
1816
|
-
...this._def,
|
|
1817
|
-
shape: () => ({
|
|
1818
|
-
...this._def.shape(),
|
|
1819
|
-
...e
|
|
1820
|
-
})
|
|
1821
|
-
});
|
|
1822
|
-
}
|
|
1823
|
-
merge(e) {
|
|
1824
|
-
return new x({
|
|
1825
|
-
unknownKeys: e._def.unknownKeys,
|
|
1826
|
-
catchall: e._def.catchall,
|
|
1827
|
-
shape: () => ({
|
|
1828
|
-
...this._def.shape(),
|
|
1829
|
-
...e._def.shape()
|
|
1830
|
-
}),
|
|
1831
|
-
typeName: p.ZodObject
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
|
-
setKey(e, t) {
|
|
1835
|
-
return this.augment({
|
|
1836
|
-
[e]: t
|
|
1837
|
-
});
|
|
1838
|
-
}
|
|
1839
|
-
catchall(e) {
|
|
1840
|
-
return new x({
|
|
1841
|
-
...this._def,
|
|
1842
|
-
catchall: e
|
|
1843
|
-
});
|
|
1844
|
-
}
|
|
1845
|
-
pick(e) {
|
|
1846
|
-
const t = {};
|
|
1847
|
-
for (const r of v.objectKeys(e)) e[r] && this.shape[r] && (t[r] = this.shape[r]);
|
|
1848
|
-
return new x({
|
|
1849
|
-
...this._def,
|
|
1850
|
-
shape: () => t
|
|
348
|
+
const Ve = (e) => (n, t, r, o) => {
|
|
349
|
+
const s = r ? Object.assign(r, {
|
|
350
|
+
async: false
|
|
351
|
+
}) : {
|
|
352
|
+
async: false
|
|
353
|
+
}, u = n._zod.run({
|
|
354
|
+
value: t,
|
|
355
|
+
issues: []
|
|
356
|
+
}, s);
|
|
357
|
+
if (u instanceof Promise) throw new R();
|
|
358
|
+
if (u.issues.length) {
|
|
359
|
+
const i = new ((o == null ? void 0 : o.Err) ?? e)(u.issues.map((a) => P(a, s, b())));
|
|
360
|
+
throw me(i, o == null ? void 0 : o.callee), i;
|
|
361
|
+
}
|
|
362
|
+
return u.value;
|
|
363
|
+
}, Je = (e) => async (n, t, r, o) => {
|
|
364
|
+
const s = r ? Object.assign(r, {
|
|
365
|
+
async: true
|
|
366
|
+
}) : {
|
|
367
|
+
async: true
|
|
368
|
+
};
|
|
369
|
+
let u = n._zod.run({
|
|
370
|
+
value: t,
|
|
371
|
+
issues: []
|
|
372
|
+
}, s);
|
|
373
|
+
if (u instanceof Promise && (u = await u), u.issues.length) {
|
|
374
|
+
const i = new ((o == null ? void 0 : o.Err) ?? e)(u.issues.map((a) => P(a, s, b())));
|
|
375
|
+
throw me(i, o == null ? void 0 : o.callee), i;
|
|
376
|
+
}
|
|
377
|
+
return u.value;
|
|
378
|
+
}, ye = (e) => (n, t, r) => {
|
|
379
|
+
const o = r ? {
|
|
380
|
+
...r,
|
|
381
|
+
async: false
|
|
382
|
+
} : {
|
|
383
|
+
async: false
|
|
384
|
+
}, s = n._zod.run({
|
|
385
|
+
value: t,
|
|
386
|
+
issues: []
|
|
387
|
+
}, o);
|
|
388
|
+
if (s instanceof Promise) throw new R();
|
|
389
|
+
return s.issues.length ? {
|
|
390
|
+
success: false,
|
|
391
|
+
error: new (e ?? ge)(s.issues.map((u) => P(u, o, b())))
|
|
392
|
+
} : {
|
|
393
|
+
success: true,
|
|
394
|
+
data: s.value
|
|
395
|
+
};
|
|
396
|
+
}, De = ye(ze), we = (e) => async (n, t, r) => {
|
|
397
|
+
const o = r ? Object.assign(r, {
|
|
398
|
+
async: true
|
|
399
|
+
}) : {
|
|
400
|
+
async: true
|
|
401
|
+
};
|
|
402
|
+
let s = n._zod.run({
|
|
403
|
+
value: t,
|
|
404
|
+
issues: []
|
|
405
|
+
}, o);
|
|
406
|
+
return s instanceof Promise && (s = await s), s.issues.length ? {
|
|
407
|
+
success: false,
|
|
408
|
+
error: new e(s.issues.map((u) => P(u, o, b())))
|
|
409
|
+
} : {
|
|
410
|
+
success: true,
|
|
411
|
+
data: s.value
|
|
412
|
+
};
|
|
413
|
+
}, Fe = we(ze), O = c("$ZodCheck", (e, n) => {
|
|
414
|
+
var t;
|
|
415
|
+
e._zod ?? (e._zod = {}), e._zod.def = n, (t = e._zod).onattach ?? (t.onattach = []);
|
|
416
|
+
}), Me = c("$ZodCheckMaxLength", (e, n) => {
|
|
417
|
+
var t;
|
|
418
|
+
O.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
|
|
419
|
+
const o = r.value;
|
|
420
|
+
return !K(o) && o.length !== void 0;
|
|
421
|
+
}), e._zod.onattach.push((r) => {
|
|
422
|
+
const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
423
|
+
n.maximum < o && (r._zod.bag.maximum = n.maximum);
|
|
424
|
+
}), e._zod.check = (r) => {
|
|
425
|
+
const o = r.value;
|
|
426
|
+
if (o.length <= n.maximum) return;
|
|
427
|
+
const u = B(o);
|
|
428
|
+
r.issues.push({
|
|
429
|
+
origin: u,
|
|
430
|
+
code: "too_big",
|
|
431
|
+
maximum: n.maximum,
|
|
432
|
+
inclusive: true,
|
|
433
|
+
input: o,
|
|
434
|
+
inst: e,
|
|
435
|
+
continue: !n.abort
|
|
1851
436
|
});
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
437
|
+
};
|
|
438
|
+
}), Ke = c("$ZodCheckMinLength", (e, n) => {
|
|
439
|
+
var t;
|
|
440
|
+
O.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
|
|
441
|
+
const o = r.value;
|
|
442
|
+
return !K(o) && o.length !== void 0;
|
|
443
|
+
}), e._zod.onattach.push((r) => {
|
|
444
|
+
const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
445
|
+
n.minimum > o && (r._zod.bag.minimum = n.minimum);
|
|
446
|
+
}), e._zod.check = (r) => {
|
|
447
|
+
const o = r.value;
|
|
448
|
+
if (o.length >= n.minimum) return;
|
|
449
|
+
const u = B(o);
|
|
450
|
+
r.issues.push({
|
|
451
|
+
origin: u,
|
|
452
|
+
code: "too_small",
|
|
453
|
+
minimum: n.minimum,
|
|
454
|
+
inclusive: true,
|
|
455
|
+
input: o,
|
|
456
|
+
inst: e,
|
|
457
|
+
continue: !n.abort
|
|
1859
458
|
});
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
459
|
+
};
|
|
460
|
+
}), qe = c("$ZodCheckLengthEquals", (e, n) => {
|
|
461
|
+
var t;
|
|
462
|
+
O.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
|
|
463
|
+
const o = r.value;
|
|
464
|
+
return !K(o) && o.length !== void 0;
|
|
465
|
+
}), e._zod.onattach.push((r) => {
|
|
466
|
+
const o = r._zod.bag;
|
|
467
|
+
o.minimum = n.length, o.maximum = n.length, o.length = n.length;
|
|
468
|
+
}), e._zod.check = (r) => {
|
|
469
|
+
const o = r.value, s = o.length;
|
|
470
|
+
if (s === n.length) return;
|
|
471
|
+
const u = B(o), i = s > n.length;
|
|
472
|
+
r.issues.push({
|
|
473
|
+
origin: u,
|
|
474
|
+
...i ? {
|
|
475
|
+
code: "too_big",
|
|
476
|
+
maximum: n.length
|
|
477
|
+
} : {
|
|
478
|
+
code: "too_small",
|
|
479
|
+
minimum: n.length
|
|
480
|
+
},
|
|
481
|
+
inclusive: true,
|
|
482
|
+
exact: true,
|
|
483
|
+
input: r.value,
|
|
484
|
+
inst: e,
|
|
485
|
+
continue: !n.abort
|
|
1873
486
|
});
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
487
|
+
};
|
|
488
|
+
}), We = c("$ZodCheckOverwrite", (e, n) => {
|
|
489
|
+
O.init(e, n), e._zod.check = (t) => {
|
|
490
|
+
t.value = n.tx(t.value);
|
|
491
|
+
};
|
|
492
|
+
});
|
|
493
|
+
class He {
|
|
494
|
+
constructor(n = []) {
|
|
495
|
+
this.content = [], this.indent = 0, this && (this.args = n);
|
|
496
|
+
}
|
|
497
|
+
indented(n) {
|
|
498
|
+
this.indent += 1, n(this), this.indent -= 1;
|
|
499
|
+
}
|
|
500
|
+
write(n) {
|
|
501
|
+
if (typeof n == "function") {
|
|
502
|
+
n(this, {
|
|
503
|
+
execution: "sync"
|
|
504
|
+
}), n(this, {
|
|
505
|
+
execution: "async"
|
|
506
|
+
});
|
|
507
|
+
return;
|
|
1882
508
|
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
509
|
+
const r = n.split(`
|
|
510
|
+
`).filter((u) => u), o = Math.min(...r.map((u) => u.length - u.trimStart().length)), s = r.map((u) => u.slice(o)).map((u) => " ".repeat(this.indent * 2) + u);
|
|
511
|
+
for (const u of s) this.content.push(u);
|
|
512
|
+
}
|
|
513
|
+
compile() {
|
|
514
|
+
const n = Function, t = this == null ? void 0 : this.args, o = [
|
|
515
|
+
...((this == null ? void 0 : this.content) ?? [
|
|
516
|
+
""
|
|
517
|
+
]).map((s) => ` ${s}`)
|
|
518
|
+
];
|
|
519
|
+
return new n(...t, o.join(`
|
|
520
|
+
`));
|
|
1890
521
|
}
|
|
1891
522
|
}
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
523
|
+
const Be = {
|
|
524
|
+
major: 4,
|
|
525
|
+
minor: 0,
|
|
526
|
+
patch: 5
|
|
527
|
+
}, v = c("$ZodType", (e, n) => {
|
|
528
|
+
var _a;
|
|
529
|
+
var t;
|
|
530
|
+
e ?? (e = {}), e._zod.def = n, e._zod.bag = e._zod.bag || {}, e._zod.version = Be;
|
|
531
|
+
const r = [
|
|
532
|
+
...e._zod.def.checks ?? []
|
|
533
|
+
];
|
|
534
|
+
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
535
|
+
for (const o of r) for (const s of o._zod.onattach) s(e);
|
|
536
|
+
if (r.length === 0) (t = e._zod).deferred ?? (t.deferred = []), (_a = e._zod.deferred) == null ? void 0 : _a.push(() => {
|
|
537
|
+
e._zod.run = e._zod.parse;
|
|
538
|
+
});
|
|
539
|
+
else {
|
|
540
|
+
const o = (s, u, i) => {
|
|
541
|
+
let a = T(s), d;
|
|
542
|
+
for (const p of u) {
|
|
543
|
+
if (p._zod.def.when) {
|
|
544
|
+
if (!p._zod.def.when(s)) continue;
|
|
545
|
+
} else if (a) continue;
|
|
546
|
+
const l = s.issues.length, f = p._zod.check(s);
|
|
547
|
+
if (f instanceof Promise && (i == null ? void 0 : i.async) === false) throw new R();
|
|
548
|
+
if (d || f instanceof Promise) d = (d ?? Promise.resolve()).then(async () => {
|
|
549
|
+
await f, s.issues.length !== l && (a || (a = T(s, l)));
|
|
550
|
+
});
|
|
551
|
+
else {
|
|
552
|
+
if (s.issues.length === l) continue;
|
|
553
|
+
a || (a = T(s, l));
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return d ? d.then(() => s) : s;
|
|
557
|
+
};
|
|
558
|
+
e._zod.run = (s, u) => {
|
|
559
|
+
const i = e._zod.parse(s, u);
|
|
560
|
+
if (i instanceof Promise) {
|
|
561
|
+
if (u.async === false) throw new R();
|
|
562
|
+
return i.then((a) => o(a, r, u));
|
|
563
|
+
}
|
|
564
|
+
return o(i, r, u);
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
e["~standard"] = {
|
|
568
|
+
validate: (o) => {
|
|
569
|
+
var _a2;
|
|
570
|
+
try {
|
|
571
|
+
const s = De(e, o);
|
|
572
|
+
return s.success ? {
|
|
573
|
+
value: s.data
|
|
574
|
+
} : {
|
|
575
|
+
issues: (_a2 = s.error) == null ? void 0 : _a2.issues
|
|
576
|
+
};
|
|
577
|
+
} catch {
|
|
578
|
+
return Fe(e, o).then((u) => {
|
|
579
|
+
var _a3;
|
|
580
|
+
return u.success ? {
|
|
581
|
+
value: u.data
|
|
582
|
+
} : {
|
|
583
|
+
issues: (_a3 = u.error) == null ? void 0 : _a3.issues
|
|
584
|
+
};
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
vendor: "zod",
|
|
589
|
+
version: 1
|
|
590
|
+
};
|
|
591
|
+
}), Ye = c("$ZodAny", (e, n) => {
|
|
592
|
+
v.init(e, n), e._zod.parse = (t) => t;
|
|
593
|
+
}), Ge = c("$ZodUnknown", (e, n) => {
|
|
594
|
+
v.init(e, n), e._zod.parse = (t) => t;
|
|
595
|
+
}), Qe = c("$ZodNever", (e, n) => {
|
|
596
|
+
v.init(e, n), e._zod.parse = (t, r) => (t.issues.push({
|
|
597
|
+
expected: "never",
|
|
598
|
+
code: "invalid_type",
|
|
599
|
+
input: t.value,
|
|
600
|
+
inst: e
|
|
601
|
+
}), t);
|
|
1905
602
|
});
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
603
|
+
function Q(e, n, t) {
|
|
604
|
+
e.issues.length && n.issues.push(...H(t, e.issues)), n.value[t] = e.value;
|
|
605
|
+
}
|
|
606
|
+
const Xe = c("$ZodArray", (e, n) => {
|
|
607
|
+
v.init(e, n), e._zod.parse = (t, r) => {
|
|
608
|
+
const o = t.value;
|
|
609
|
+
if (!Array.isArray(o)) return t.issues.push({
|
|
610
|
+
expected: "array",
|
|
611
|
+
code: "invalid_type",
|
|
612
|
+
input: o,
|
|
613
|
+
inst: e
|
|
614
|
+
}), t;
|
|
615
|
+
t.value = Array(o.length);
|
|
616
|
+
const s = [];
|
|
617
|
+
for (let u = 0; u < o.length; u++) {
|
|
618
|
+
const i = o[u], a = n.element._zod.run({
|
|
619
|
+
value: i,
|
|
620
|
+
issues: []
|
|
621
|
+
}, r);
|
|
622
|
+
a instanceof Promise ? s.push(a.then((d) => Q(d, t, u))) : Q(a, t, u);
|
|
623
|
+
}
|
|
624
|
+
return s.length ? Promise.all(s).then(() => t) : t;
|
|
625
|
+
};
|
|
1912
626
|
});
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
627
|
+
function I(e, n, t) {
|
|
628
|
+
e.issues.length && n.issues.push(...H(t, e.issues)), n.value[t] = e.value;
|
|
629
|
+
}
|
|
630
|
+
function X(e, n, t, r) {
|
|
631
|
+
e.issues.length ? r[t] === void 0 ? t in r ? n.value[t] = void 0 : n.value[t] = e.value : n.issues.push(...H(t, e.issues)) : e.value === void 0 ? t in r && (n.value[t] = void 0) : n.value[t] = e.value;
|
|
632
|
+
}
|
|
633
|
+
const en = c("$ZodObject", (e, n) => {
|
|
634
|
+
v.init(e, n);
|
|
635
|
+
const t = _e(() => {
|
|
636
|
+
const l = Object.keys(n.shape);
|
|
637
|
+
for (const _ of l) if (!(n.shape[_] instanceof v)) throw new Error(`Invalid element at key "${_}": expected a Zod schema`);
|
|
638
|
+
const f = Re(n.shape);
|
|
639
|
+
return {
|
|
640
|
+
shape: n.shape,
|
|
641
|
+
keys: l,
|
|
642
|
+
keySet: new Set(l),
|
|
643
|
+
numKeys: l.length,
|
|
644
|
+
optionalKeys: new Set(f)
|
|
645
|
+
};
|
|
646
|
+
});
|
|
647
|
+
h(e._zod, "propValues", () => {
|
|
648
|
+
const l = n.shape, f = {};
|
|
649
|
+
for (const _ in l) {
|
|
650
|
+
const w = l[_]._zod;
|
|
651
|
+
if (w.values) {
|
|
652
|
+
f[_] ?? (f[_] = /* @__PURE__ */ new Set());
|
|
653
|
+
for (const Z of w.values) f[_].add(Z);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
return f;
|
|
657
|
+
});
|
|
658
|
+
const r = (l) => {
|
|
659
|
+
const f = new He([
|
|
660
|
+
"shape",
|
|
661
|
+
"payload",
|
|
662
|
+
"ctx"
|
|
663
|
+
]), _ = t.value, w = (y) => {
|
|
664
|
+
const m = j(y);
|
|
665
|
+
return `shape[${m}]._zod.run({ value: input[${m}], issues: [] }, ctx)`;
|
|
666
|
+
};
|
|
667
|
+
f.write("const input = payload.value;");
|
|
668
|
+
const Z = /* @__PURE__ */ Object.create(null);
|
|
669
|
+
let V = 0;
|
|
670
|
+
for (const y of _.keys) Z[y] = `key_${V++}`;
|
|
671
|
+
f.write("const newResult = {}");
|
|
672
|
+
for (const y of _.keys) if (_.optionalKeys.has(y)) {
|
|
673
|
+
const m = Z[y];
|
|
674
|
+
f.write(`const ${m} = ${w(y)};`);
|
|
675
|
+
const g = j(y);
|
|
676
|
+
f.write(`
|
|
677
|
+
if (${m}.issues.length) {
|
|
678
|
+
if (input[${g}] === undefined) {
|
|
679
|
+
if (${g} in input) {
|
|
680
|
+
newResult[${g}] = undefined;
|
|
681
|
+
}
|
|
682
|
+
} else {
|
|
683
|
+
payload.issues = payload.issues.concat(
|
|
684
|
+
${m}.issues.map((iss) => ({
|
|
685
|
+
...iss,
|
|
686
|
+
path: iss.path ? [${g}, ...iss.path] : [${g}],
|
|
687
|
+
}))
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
} else if (${m}.value === undefined) {
|
|
691
|
+
if (${g} in input) newResult[${g}] = undefined;
|
|
692
|
+
} else {
|
|
693
|
+
newResult[${g}] = ${m}.value;
|
|
694
|
+
}
|
|
695
|
+
`);
|
|
696
|
+
} else {
|
|
697
|
+
const m = Z[y];
|
|
698
|
+
f.write(`const ${m} = ${w(y)};`), f.write(`
|
|
699
|
+
if (${m}.issues.length) payload.issues = payload.issues.concat(${m}.issues.map(iss => ({
|
|
700
|
+
...iss,
|
|
701
|
+
path: iss.path ? [${j(y)}, ...iss.path] : [${j(y)}]
|
|
702
|
+
})));`), f.write(`newResult[${j(y)}] = ${m}.value`);
|
|
1924
703
|
}
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
704
|
+
f.write("payload.value = newResult;"), f.write("return payload;");
|
|
705
|
+
const x = f.compile();
|
|
706
|
+
return (y, m) => x(l, y, m);
|
|
707
|
+
};
|
|
708
|
+
let o;
|
|
709
|
+
const s = J, u = !he.jitless, a = u && Ee.value, d = n.catchall;
|
|
710
|
+
let p;
|
|
711
|
+
e._zod.parse = (l, f) => {
|
|
712
|
+
p ?? (p = t.value);
|
|
713
|
+
const _ = l.value;
|
|
714
|
+
if (!s(_)) return l.issues.push({
|
|
715
|
+
expected: "object",
|
|
716
|
+
code: "invalid_type",
|
|
717
|
+
input: _,
|
|
718
|
+
inst: e
|
|
719
|
+
}), l;
|
|
720
|
+
const w = [];
|
|
721
|
+
if (u && a && (f == null ? void 0 : f.async) === false && f.jitless !== true) o || (o = r(n.shape)), l = o(l, f);
|
|
722
|
+
else {
|
|
723
|
+
l.value = {};
|
|
724
|
+
const m = p.shape;
|
|
725
|
+
for (const g of p.keys) {
|
|
726
|
+
const E = m[g], A = E._zod.run({
|
|
727
|
+
value: _[g],
|
|
1930
728
|
issues: []
|
|
1931
|
-
},
|
|
1932
|
-
|
|
1933
|
-
};
|
|
1934
|
-
return {
|
|
1935
|
-
result: await n._parseAsync({
|
|
1936
|
-
data: t.data,
|
|
1937
|
-
path: t.path,
|
|
1938
|
-
parent: i
|
|
1939
|
-
}),
|
|
1940
|
-
ctx: i
|
|
1941
|
-
};
|
|
1942
|
-
})).then(a);
|
|
1943
|
-
{
|
|
1944
|
-
let n;
|
|
1945
|
-
const i = [];
|
|
1946
|
-
for (const u of r) {
|
|
1947
|
-
const l = {
|
|
1948
|
-
...t,
|
|
1949
|
-
common: {
|
|
1950
|
-
...t.common,
|
|
1951
|
-
issues: []
|
|
1952
|
-
},
|
|
1953
|
-
parent: null
|
|
1954
|
-
}, g = u._parseSync({
|
|
1955
|
-
data: t.data,
|
|
1956
|
-
path: t.path,
|
|
1957
|
-
parent: l
|
|
1958
|
-
});
|
|
1959
|
-
if (g.status === "valid") return g;
|
|
1960
|
-
g.status === "dirty" && !n && (n = {
|
|
1961
|
-
result: g,
|
|
1962
|
-
ctx: l
|
|
1963
|
-
}), l.common.issues.length && i.push(l.common.issues);
|
|
729
|
+
}, f), Y = E._zod.optin === "optional" && E._zod.optout === "optional";
|
|
730
|
+
A instanceof Promise ? w.push(A.then((G) => Y ? X(G, l, g, _) : I(G, l, g))) : Y ? X(A, l, g, _) : I(A, l, g);
|
|
1964
731
|
}
|
|
1965
|
-
if (n) return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
1966
|
-
const o = i.map((u) => new O(u));
|
|
1967
|
-
return c(t, {
|
|
1968
|
-
code: d.invalid_union,
|
|
1969
|
-
unionErrors: o
|
|
1970
|
-
}), m;
|
|
1971
732
|
}
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
733
|
+
if (!d) return w.length ? Promise.all(w).then(() => l) : l;
|
|
734
|
+
const Z = [], V = p.keySet, x = d._zod, y = x.def.type;
|
|
735
|
+
for (const m of Object.keys(_)) {
|
|
736
|
+
if (V.has(m)) continue;
|
|
737
|
+
if (y === "never") {
|
|
738
|
+
Z.push(m);
|
|
739
|
+
continue;
|
|
740
|
+
}
|
|
741
|
+
const g = x.run({
|
|
742
|
+
value: _[m],
|
|
743
|
+
issues: []
|
|
744
|
+
}, f);
|
|
745
|
+
g instanceof Promise ? w.push(g.then((E) => I(E, l, m))) : I(g, l, m);
|
|
746
|
+
}
|
|
747
|
+
return Z.length && l.issues.push({
|
|
748
|
+
code: "unrecognized_keys",
|
|
749
|
+
keys: Z,
|
|
750
|
+
input: _,
|
|
751
|
+
inst: e
|
|
752
|
+
}), w.length ? Promise.all(w).then(() => l) : l;
|
|
753
|
+
};
|
|
754
|
+
});
|
|
755
|
+
function ee(e, n, t, r) {
|
|
756
|
+
for (const o of e) if (o.issues.length === 0) return n.value = o.value, n;
|
|
757
|
+
return n.issues.push({
|
|
758
|
+
code: "invalid_union",
|
|
759
|
+
input: n.value,
|
|
760
|
+
inst: t,
|
|
761
|
+
errors: e.map((o) => o.issues.map((s) => P(s, r, b())))
|
|
762
|
+
}), n;
|
|
1976
763
|
}
|
|
1977
|
-
|
|
1978
|
-
options:
|
|
1979
|
-
|
|
1980
|
-
|
|
764
|
+
const nn = c("$ZodUnion", (e, n) => {
|
|
765
|
+
v.init(e, n), h(e._zod, "optin", () => n.options.some((t) => t._zod.optin === "optional") ? "optional" : void 0), h(e._zod, "optout", () => n.options.some((t) => t._zod.optout === "optional") ? "optional" : void 0), h(e._zod, "values", () => {
|
|
766
|
+
if (n.options.every((t) => t._zod.values)) return new Set(n.options.flatMap((t) => Array.from(t._zod.values)));
|
|
767
|
+
}), h(e._zod, "pattern", () => {
|
|
768
|
+
if (n.options.every((t) => t._zod.pattern)) {
|
|
769
|
+
const t = n.options.map((r) => r._zod.pattern);
|
|
770
|
+
return new RegExp(`^(${t.map((r) => q(r.source)).join("|")})$`);
|
|
771
|
+
}
|
|
772
|
+
}), e._zod.parse = (t, r) => {
|
|
773
|
+
let o = false;
|
|
774
|
+
const s = [];
|
|
775
|
+
for (const u of n.options) {
|
|
776
|
+
const i = u._zod.run({
|
|
777
|
+
value: t.value,
|
|
778
|
+
issues: []
|
|
779
|
+
}, r);
|
|
780
|
+
if (i instanceof Promise) s.push(i), o = true;
|
|
781
|
+
else {
|
|
782
|
+
if (i.issues.length === 0) return i;
|
|
783
|
+
s.push(i);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return o ? Promise.all(s).then((u) => ee(u, t, e, r)) : ee(s, t, e, r);
|
|
787
|
+
};
|
|
788
|
+
}), tn = c("$ZodIntersection", (e, n) => {
|
|
789
|
+
v.init(e, n), e._zod.parse = (t, r) => {
|
|
790
|
+
const o = t.value, s = n.left._zod.run({
|
|
791
|
+
value: o,
|
|
792
|
+
issues: []
|
|
793
|
+
}, r), u = n.right._zod.run({
|
|
794
|
+
value: o,
|
|
795
|
+
issues: []
|
|
796
|
+
}, r);
|
|
797
|
+
return s instanceof Promise || u instanceof Promise ? Promise.all([
|
|
798
|
+
s,
|
|
799
|
+
u
|
|
800
|
+
]).then(([a, d]) => ne(t, a, d)) : ne(t, s, u);
|
|
801
|
+
};
|
|
1981
802
|
});
|
|
1982
|
-
function
|
|
1983
|
-
|
|
1984
|
-
|
|
803
|
+
function F(e, n) {
|
|
804
|
+
if (e === n) return {
|
|
805
|
+
valid: true,
|
|
806
|
+
data: e
|
|
807
|
+
};
|
|
808
|
+
if (e instanceof Date && n instanceof Date && +e == +n) return {
|
|
1985
809
|
valid: true,
|
|
1986
|
-
data:
|
|
810
|
+
data: e
|
|
1987
811
|
};
|
|
1988
|
-
if (
|
|
1989
|
-
const
|
|
1990
|
-
...
|
|
1991
|
-
...
|
|
812
|
+
if (D(e) && D(n)) {
|
|
813
|
+
const t = Object.keys(n), r = Object.keys(e).filter((s) => t.indexOf(s) !== -1), o = {
|
|
814
|
+
...e,
|
|
815
|
+
...n
|
|
1992
816
|
};
|
|
1993
|
-
for (const
|
|
1994
|
-
const u =
|
|
817
|
+
for (const s of r) {
|
|
818
|
+
const u = F(e[s], n[s]);
|
|
1995
819
|
if (!u.valid) return {
|
|
1996
|
-
valid: false
|
|
820
|
+
valid: false,
|
|
821
|
+
mergeErrorPath: [
|
|
822
|
+
s,
|
|
823
|
+
...u.mergeErrorPath
|
|
824
|
+
]
|
|
1997
825
|
};
|
|
1998
|
-
|
|
826
|
+
o[s] = u.data;
|
|
1999
827
|
}
|
|
2000
828
|
return {
|
|
2001
829
|
valid: true,
|
|
2002
|
-
data:
|
|
830
|
+
data: o
|
|
2003
831
|
};
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
|
|
832
|
+
}
|
|
833
|
+
if (Array.isArray(e) && Array.isArray(n)) {
|
|
834
|
+
if (e.length !== n.length) return {
|
|
835
|
+
valid: false,
|
|
836
|
+
mergeErrorPath: []
|
|
2007
837
|
};
|
|
2008
|
-
const
|
|
2009
|
-
for (let
|
|
2010
|
-
const
|
|
838
|
+
const t = [];
|
|
839
|
+
for (let r = 0; r < e.length; r++) {
|
|
840
|
+
const o = e[r], s = n[r], u = F(o, s);
|
|
2011
841
|
if (!u.valid) return {
|
|
2012
|
-
valid: false
|
|
842
|
+
valid: false,
|
|
843
|
+
mergeErrorPath: [
|
|
844
|
+
r,
|
|
845
|
+
...u.mergeErrorPath
|
|
846
|
+
]
|
|
2013
847
|
};
|
|
2014
|
-
|
|
848
|
+
t.push(u.data);
|
|
2015
849
|
}
|
|
2016
850
|
return {
|
|
2017
851
|
valid: true,
|
|
2018
|
-
data:
|
|
852
|
+
data: t
|
|
2019
853
|
};
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
valid: false
|
|
854
|
+
}
|
|
855
|
+
return {
|
|
856
|
+
valid: false,
|
|
857
|
+
mergeErrorPath: []
|
|
2025
858
|
};
|
|
2026
859
|
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
return o.valid ? ((ae(n) || ae(i)) && t.dirty(), {
|
|
2033
|
-
status: t.value,
|
|
2034
|
-
value: o.data
|
|
2035
|
-
}) : (c(r, {
|
|
2036
|
-
code: d.invalid_intersection_types
|
|
2037
|
-
}), m);
|
|
2038
|
-
};
|
|
2039
|
-
return r.common.async ? Promise.all([
|
|
2040
|
-
this._def.left._parseAsync({
|
|
2041
|
-
data: r.data,
|
|
2042
|
-
path: r.path,
|
|
2043
|
-
parent: r
|
|
2044
|
-
}),
|
|
2045
|
-
this._def.right._parseAsync({
|
|
2046
|
-
data: r.data,
|
|
2047
|
-
path: r.path,
|
|
2048
|
-
parent: r
|
|
2049
|
-
})
|
|
2050
|
-
]).then(([n, i]) => a(n, i)) : a(this._def.left._parseSync({
|
|
2051
|
-
data: r.data,
|
|
2052
|
-
path: r.path,
|
|
2053
|
-
parent: r
|
|
2054
|
-
}), this._def.right._parseSync({
|
|
2055
|
-
data: r.data,
|
|
2056
|
-
path: r.path,
|
|
2057
|
-
parent: r
|
|
2058
|
-
}));
|
|
2059
|
-
}
|
|
860
|
+
function ne(e, n, t) {
|
|
861
|
+
if (n.issues.length && e.issues.push(...n.issues), t.issues.length && e.issues.push(...t.issues), T(e)) return e;
|
|
862
|
+
const r = F(n.value, t.value);
|
|
863
|
+
if (!r.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
|
|
864
|
+
return e.value = r.data, e;
|
|
2060
865
|
}
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
866
|
+
const rn = c("$ZodEnum", (e, n) => {
|
|
867
|
+
v.init(e, n);
|
|
868
|
+
const t = ke(n.entries);
|
|
869
|
+
e._zod.values = new Set(t), e._zod.pattern = new RegExp(`^(${t.filter((r) => je.has(typeof r)).map((r) => typeof r == "string" ? Te(r) : r.toString()).join("|")})$`), e._zod.parse = (r, o) => {
|
|
870
|
+
const s = r.value;
|
|
871
|
+
return e._zod.values.has(s) || r.issues.push({
|
|
872
|
+
code: "invalid_value",
|
|
873
|
+
values: t,
|
|
874
|
+
input: s,
|
|
875
|
+
inst: e
|
|
876
|
+
}), r;
|
|
877
|
+
};
|
|
878
|
+
}), on = c("$ZodTransform", (e, n) => {
|
|
879
|
+
v.init(e, n), e._zod.parse = (t, r) => {
|
|
880
|
+
const o = n.transform(t.value, t);
|
|
881
|
+
if (r.async) return (o instanceof Promise ? o : Promise.resolve(o)).then((u) => (t.value = u, t));
|
|
882
|
+
if (o instanceof Promise) throw new R();
|
|
883
|
+
return t.value = o, t;
|
|
884
|
+
};
|
|
885
|
+
}), sn = c("$ZodOptional", (e, n) => {
|
|
886
|
+
v.init(e, n), e._zod.optin = "optional", e._zod.optout = "optional", h(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([
|
|
887
|
+
...n.innerType._zod.values,
|
|
888
|
+
void 0
|
|
889
|
+
]) : void 0), h(e._zod, "pattern", () => {
|
|
890
|
+
const t = n.innerType._zod.pattern;
|
|
891
|
+
return t ? new RegExp(`^(${q(t.source)})?$`) : void 0;
|
|
892
|
+
}), e._zod.parse = (t, r) => n.innerType._zod.optin === "optional" ? n.innerType._zod.run(t, r) : t.value === void 0 ? t : n.innerType._zod.run(t, r);
|
|
893
|
+
}), un = c("$ZodNullable", (e, n) => {
|
|
894
|
+
v.init(e, n), h(e._zod, "optin", () => n.innerType._zod.optin), h(e._zod, "optout", () => n.innerType._zod.optout), h(e._zod, "pattern", () => {
|
|
895
|
+
const t = n.innerType._zod.pattern;
|
|
896
|
+
return t ? new RegExp(`^(${q(t.source)}|null)$`) : void 0;
|
|
897
|
+
}), h(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([
|
|
898
|
+
...n.innerType._zod.values,
|
|
899
|
+
null
|
|
900
|
+
]) : void 0), e._zod.parse = (t, r) => t.value === null ? t : n.innerType._zod.run(t, r);
|
|
901
|
+
}), cn = c("$ZodDefault", (e, n) => {
|
|
902
|
+
v.init(e, n), e._zod.optin = "optional", h(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
|
|
903
|
+
if (t.value === void 0) return t.value = n.defaultValue, t;
|
|
904
|
+
const o = n.innerType._zod.run(t, r);
|
|
905
|
+
return o instanceof Promise ? o.then((s) => te(s, n)) : te(o, n);
|
|
906
|
+
};
|
|
2066
907
|
});
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2070
|
-
if (r.parsedType !== f.array) return c(r, {
|
|
2071
|
-
code: d.invalid_type,
|
|
2072
|
-
expected: f.array,
|
|
2073
|
-
received: r.parsedType
|
|
2074
|
-
}), m;
|
|
2075
|
-
if (r.data.length < this._def.items.length) return c(r, {
|
|
2076
|
-
code: d.too_small,
|
|
2077
|
-
minimum: this._def.items.length,
|
|
2078
|
-
inclusive: true,
|
|
2079
|
-
exact: false,
|
|
2080
|
-
type: "array"
|
|
2081
|
-
}), m;
|
|
2082
|
-
!this._def.rest && r.data.length > this._def.items.length && (c(r, {
|
|
2083
|
-
code: d.too_big,
|
|
2084
|
-
maximum: this._def.items.length,
|
|
2085
|
-
inclusive: true,
|
|
2086
|
-
exact: false,
|
|
2087
|
-
type: "array"
|
|
2088
|
-
}), t.dirty());
|
|
2089
|
-
const n = [
|
|
2090
|
-
...r.data
|
|
2091
|
-
].map((i, o) => {
|
|
2092
|
-
const u = this._def.items[o] || this._def.rest;
|
|
2093
|
-
return u ? u._parse(new N(r, i, r.path, o)) : null;
|
|
2094
|
-
}).filter((i) => !!i);
|
|
2095
|
-
return r.common.async ? Promise.all(n).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, n);
|
|
2096
|
-
}
|
|
2097
|
-
get items() {
|
|
2098
|
-
return this._def.items;
|
|
2099
|
-
}
|
|
2100
|
-
rest(e) {
|
|
2101
|
-
return new R({
|
|
2102
|
-
...this._def,
|
|
2103
|
-
rest: e
|
|
2104
|
-
});
|
|
2105
|
-
}
|
|
908
|
+
function te(e, n) {
|
|
909
|
+
return e.value === void 0 && (e.value = n.defaultValue), e;
|
|
2106
910
|
}
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
expected: f.map,
|
|
2128
|
-
received: r.parsedType
|
|
2129
|
-
}), m;
|
|
2130
|
-
const a = this._def.keyType, n = this._def.valueType, i = [
|
|
2131
|
-
...r.data.entries()
|
|
2132
|
-
].map(([o, u], l) => ({
|
|
2133
|
-
key: a._parse(new N(r, o, r.path, [
|
|
2134
|
-
l,
|
|
2135
|
-
"key"
|
|
2136
|
-
])),
|
|
2137
|
-
value: n._parse(new N(r, u, r.path, [
|
|
2138
|
-
l,
|
|
2139
|
-
"value"
|
|
2140
|
-
]))
|
|
2141
|
-
}));
|
|
2142
|
-
if (r.common.async) {
|
|
2143
|
-
const o = /* @__PURE__ */ new Map();
|
|
2144
|
-
return Promise.resolve().then(async () => {
|
|
2145
|
-
for (const u of i) {
|
|
2146
|
-
const l = await u.key, g = await u.value;
|
|
2147
|
-
if (l.status === "aborted" || g.status === "aborted") return m;
|
|
2148
|
-
(l.status === "dirty" || g.status === "dirty") && t.dirty(), o.set(l.value, g.value);
|
|
2149
|
-
}
|
|
2150
|
-
return {
|
|
2151
|
-
status: t.value,
|
|
2152
|
-
value: o
|
|
2153
|
-
};
|
|
2154
|
-
});
|
|
2155
|
-
} else {
|
|
2156
|
-
const o = /* @__PURE__ */ new Map();
|
|
2157
|
-
for (const u of i) {
|
|
2158
|
-
const l = u.key, g = u.value;
|
|
2159
|
-
if (l.status === "aborted" || g.status === "aborted") return m;
|
|
2160
|
-
(l.status === "dirty" || g.status === "dirty") && t.dirty(), o.set(l.value, g.value);
|
|
2161
|
-
}
|
|
2162
|
-
return {
|
|
2163
|
-
status: t.value,
|
|
2164
|
-
value: o
|
|
2165
|
-
};
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
911
|
+
const an = c("$ZodPrefault", (e, n) => {
|
|
912
|
+
v.init(e, n), e._zod.optin = "optional", h(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => (t.value === void 0 && (t.value = n.defaultValue), n.innerType._zod.run(t, r));
|
|
913
|
+
}), ln = c("$ZodNonOptional", (e, n) => {
|
|
914
|
+
v.init(e, n), h(e._zod, "values", () => {
|
|
915
|
+
const t = n.innerType._zod.values;
|
|
916
|
+
return t ? new Set([
|
|
917
|
+
...t
|
|
918
|
+
].filter((r) => r !== void 0)) : void 0;
|
|
919
|
+
}), e._zod.parse = (t, r) => {
|
|
920
|
+
const o = n.innerType._zod.run(t, r);
|
|
921
|
+
return o instanceof Promise ? o.then((s) => re(s, e)) : re(o, e);
|
|
922
|
+
};
|
|
923
|
+
});
|
|
924
|
+
function re(e, n) {
|
|
925
|
+
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
926
|
+
code: "invalid_type",
|
|
927
|
+
expected: "nonoptional",
|
|
928
|
+
input: e.value,
|
|
929
|
+
inst: n
|
|
930
|
+
}), e;
|
|
2168
931
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
932
|
+
const dn = c("$ZodCatch", (e, n) => {
|
|
933
|
+
v.init(e, n), e._zod.optin = "optional", h(e._zod, "optout", () => n.innerType._zod.optout), h(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
|
|
934
|
+
const o = n.innerType._zod.run(t, r);
|
|
935
|
+
return o instanceof Promise ? o.then((s) => (t.value = s.value, s.issues.length && (t.value = n.catchValue({
|
|
936
|
+
...t,
|
|
937
|
+
error: {
|
|
938
|
+
issues: s.issues.map((u) => P(u, r, b()))
|
|
939
|
+
},
|
|
940
|
+
input: t.value
|
|
941
|
+
}), t.issues = []), t)) : (t.value = o.value, o.issues.length && (t.value = n.catchValue({
|
|
942
|
+
...t,
|
|
943
|
+
error: {
|
|
944
|
+
issues: o.issues.map((s) => P(s, r, b()))
|
|
945
|
+
},
|
|
946
|
+
input: t.value
|
|
947
|
+
}), t.issues = []), t);
|
|
948
|
+
};
|
|
949
|
+
}), fn = c("$ZodPipe", (e, n) => {
|
|
950
|
+
v.init(e, n), h(e._zod, "values", () => n.in._zod.values), h(e._zod, "optin", () => n.in._zod.optin), h(e._zod, "optout", () => n.out._zod.optout), h(e._zod, "propValues", () => n.in._zod.propValues), e._zod.parse = (t, r) => {
|
|
951
|
+
const o = n.in._zod.run(t, r);
|
|
952
|
+
return o instanceof Promise ? o.then((s) => oe(s, n, r)) : oe(o, n, r);
|
|
953
|
+
};
|
|
2174
954
|
});
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
expected: f.set,
|
|
2181
|
-
received: r.parsedType
|
|
2182
|
-
}), m;
|
|
2183
|
-
const a = this._def;
|
|
2184
|
-
a.minSize !== null && r.data.size < a.minSize.value && (c(r, {
|
|
2185
|
-
code: d.too_small,
|
|
2186
|
-
minimum: a.minSize.value,
|
|
2187
|
-
type: "set",
|
|
2188
|
-
inclusive: true,
|
|
2189
|
-
exact: false,
|
|
2190
|
-
message: a.minSize.message
|
|
2191
|
-
}), t.dirty()), a.maxSize !== null && r.data.size > a.maxSize.value && (c(r, {
|
|
2192
|
-
code: d.too_big,
|
|
2193
|
-
maximum: a.maxSize.value,
|
|
2194
|
-
type: "set",
|
|
2195
|
-
inclusive: true,
|
|
2196
|
-
exact: false,
|
|
2197
|
-
message: a.maxSize.message
|
|
2198
|
-
}), t.dirty());
|
|
2199
|
-
const n = this._def.valueType;
|
|
2200
|
-
function i(u) {
|
|
2201
|
-
const l = /* @__PURE__ */ new Set();
|
|
2202
|
-
for (const g of u) {
|
|
2203
|
-
if (g.status === "aborted") return m;
|
|
2204
|
-
g.status === "dirty" && t.dirty(), l.add(g.value);
|
|
2205
|
-
}
|
|
2206
|
-
return {
|
|
2207
|
-
status: t.value,
|
|
2208
|
-
value: l
|
|
2209
|
-
};
|
|
2210
|
-
}
|
|
2211
|
-
const o = [
|
|
2212
|
-
...r.data.values()
|
|
2213
|
-
].map((u, l) => n._parse(new N(r, u, r.path, l)));
|
|
2214
|
-
return r.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2215
|
-
}
|
|
2216
|
-
min(e, t) {
|
|
2217
|
-
return new z({
|
|
2218
|
-
...this._def,
|
|
2219
|
-
minSize: {
|
|
2220
|
-
value: e,
|
|
2221
|
-
message: h.toString(t)
|
|
2222
|
-
}
|
|
2223
|
-
});
|
|
2224
|
-
}
|
|
2225
|
-
max(e, t) {
|
|
2226
|
-
return new z({
|
|
2227
|
-
...this._def,
|
|
2228
|
-
maxSize: {
|
|
2229
|
-
value: e,
|
|
2230
|
-
message: h.toString(t)
|
|
2231
|
-
}
|
|
2232
|
-
});
|
|
2233
|
-
}
|
|
2234
|
-
size(e, t) {
|
|
2235
|
-
return this.min(e, t).max(e, t);
|
|
2236
|
-
}
|
|
2237
|
-
nonempty(e) {
|
|
2238
|
-
return this.min(1, e);
|
|
2239
|
-
}
|
|
955
|
+
function oe(e, n, t) {
|
|
956
|
+
return T(e) ? e : n.out._zod.run({
|
|
957
|
+
value: e.value,
|
|
958
|
+
issues: e.issues
|
|
959
|
+
}, t);
|
|
2240
960
|
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
..._(e)
|
|
961
|
+
const pn = c("$ZodReadonly", (e, n) => {
|
|
962
|
+
v.init(e, n), h(e._zod, "propValues", () => n.innerType._zod.propValues), h(e._zod, "values", () => n.innerType._zod.values), h(e._zod, "optin", () => n.innerType._zod.optin), h(e._zod, "optout", () => n.innerType._zod.optout), e._zod.parse = (t, r) => {
|
|
963
|
+
const o = n.innerType._zod.run(t, r);
|
|
964
|
+
return o instanceof Promise ? o.then(se) : se(o);
|
|
965
|
+
};
|
|
2247
966
|
});
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
return this._def.getter();
|
|
2251
|
-
}
|
|
2252
|
-
_parse(e) {
|
|
2253
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2254
|
-
return this._def.getter()._parse({
|
|
2255
|
-
data: t.data,
|
|
2256
|
-
path: t.path,
|
|
2257
|
-
parent: t
|
|
2258
|
-
});
|
|
2259
|
-
}
|
|
967
|
+
function se(e) {
|
|
968
|
+
return e.value = Object.freeze(e.value), e;
|
|
2260
969
|
}
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
970
|
+
const hn = c("$ZodCustom", (e, n) => {
|
|
971
|
+
O.init(e, n), v.init(e, n), e._zod.parse = (t, r) => t, e._zod.check = (t) => {
|
|
972
|
+
const r = t.value, o = n.fn(r);
|
|
973
|
+
if (o instanceof Promise) return o.then((s) => ue(s, t, r, e));
|
|
974
|
+
ue(o, t, r, e);
|
|
975
|
+
};
|
|
2265
976
|
});
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
return {
|
|
2277
|
-
status: "valid",
|
|
2278
|
-
value: e.data
|
|
977
|
+
function ue(e, n, t, r) {
|
|
978
|
+
if (!e) {
|
|
979
|
+
const o = {
|
|
980
|
+
code: "custom",
|
|
981
|
+
input: t,
|
|
982
|
+
inst: r,
|
|
983
|
+
path: [
|
|
984
|
+
...r._zod.def.path ?? []
|
|
985
|
+
],
|
|
986
|
+
continue: !r._zod.def.abort
|
|
2279
987
|
};
|
|
988
|
+
r._zod.def.params && (o.params = r._zod.def.params), n.issues.push(S(o));
|
|
2280
989
|
}
|
|
2281
|
-
get value() {
|
|
2282
|
-
return this._def.value;
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
me.create = (s, e) => new me({
|
|
2286
|
-
value: s,
|
|
2287
|
-
typeName: p.ZodLiteral,
|
|
2288
|
-
..._(e)
|
|
2289
|
-
});
|
|
2290
|
-
function ke(s, e) {
|
|
2291
|
-
return new E({
|
|
2292
|
-
values: s,
|
|
2293
|
-
typeName: p.ZodEnum,
|
|
2294
|
-
..._(e)
|
|
2295
|
-
});
|
|
2296
990
|
}
|
|
2297
|
-
class
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2301
|
-
return c(t, {
|
|
2302
|
-
expected: v.joinValues(r),
|
|
2303
|
-
received: t.parsedType,
|
|
2304
|
-
code: d.invalid_type
|
|
2305
|
-
}), m;
|
|
2306
|
-
}
|
|
2307
|
-
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2308
|
-
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2309
|
-
return c(t, {
|
|
2310
|
-
received: t.data,
|
|
2311
|
-
code: d.invalid_enum_value,
|
|
2312
|
-
options: r
|
|
2313
|
-
}), m;
|
|
2314
|
-
}
|
|
2315
|
-
return b(e.data);
|
|
2316
|
-
}
|
|
2317
|
-
get options() {
|
|
2318
|
-
return this._def.values;
|
|
991
|
+
class _n {
|
|
992
|
+
constructor() {
|
|
993
|
+
this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map();
|
|
2319
994
|
}
|
|
2320
|
-
|
|
2321
|
-
const
|
|
2322
|
-
|
|
2323
|
-
|
|
995
|
+
add(n, ...t) {
|
|
996
|
+
const r = t[0];
|
|
997
|
+
if (this._map.set(n, r), r && typeof r == "object" && "id" in r) {
|
|
998
|
+
if (this._idmap.has(r.id)) throw new Error(`ID ${r.id} already exists in the registry`);
|
|
999
|
+
this._idmap.set(r.id, n);
|
|
1000
|
+
}
|
|
1001
|
+
return this;
|
|
2324
1002
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
for (const t of this._def.values) e[t] = t;
|
|
2328
|
-
return e;
|
|
1003
|
+
clear() {
|
|
1004
|
+
return this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map(), this;
|
|
2329
1005
|
}
|
|
2330
|
-
|
|
2331
|
-
const
|
|
2332
|
-
|
|
2333
|
-
return e;
|
|
1006
|
+
remove(n) {
|
|
1007
|
+
const t = this._map.get(n);
|
|
1008
|
+
return t && typeof t == "object" && "id" in t && this._idmap.delete(t.id), this._map.delete(n), this;
|
|
2334
1009
|
}
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
1010
|
+
get(n) {
|
|
1011
|
+
const t = n._zod.parent;
|
|
1012
|
+
if (t) {
|
|
1013
|
+
const r = {
|
|
1014
|
+
...this.get(t) ?? {}
|
|
1015
|
+
};
|
|
1016
|
+
return delete r.id, {
|
|
1017
|
+
...r,
|
|
1018
|
+
...this._map.get(n)
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
return this._map.get(n);
|
|
2340
1022
|
}
|
|
2341
|
-
|
|
2342
|
-
return
|
|
2343
|
-
...this._def,
|
|
2344
|
-
...t
|
|
2345
|
-
});
|
|
1023
|
+
has(n) {
|
|
1024
|
+
return this._map.has(n);
|
|
2346
1025
|
}
|
|
2347
1026
|
}
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
1027
|
+
function mn() {
|
|
1028
|
+
return new _n();
|
|
1029
|
+
}
|
|
1030
|
+
const C = mn();
|
|
1031
|
+
function vn(e) {
|
|
1032
|
+
return new e({
|
|
1033
|
+
type: "any"
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
function gn(e) {
|
|
1037
|
+
return new e({
|
|
1038
|
+
type: "unknown"
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
function zn(e, n) {
|
|
1042
|
+
return new e({
|
|
1043
|
+
type: "never",
|
|
1044
|
+
...$(n)
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
function yn(e, n) {
|
|
1048
|
+
return new Me({
|
|
1049
|
+
check: "max_length",
|
|
1050
|
+
...$(n),
|
|
1051
|
+
maximum: e
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
function ie(e, n) {
|
|
1055
|
+
return new Ke({
|
|
1056
|
+
check: "min_length",
|
|
1057
|
+
...$(n),
|
|
1058
|
+
minimum: e
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
function wn(e, n) {
|
|
1062
|
+
return new qe({
|
|
1063
|
+
check: "length_equals",
|
|
1064
|
+
...$(n),
|
|
1065
|
+
length: e
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
function $n(e) {
|
|
1069
|
+
return new We({
|
|
1070
|
+
check: "overwrite",
|
|
1071
|
+
tx: e
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
function Zn(e, n, t) {
|
|
1075
|
+
return new e({
|
|
1076
|
+
type: "array",
|
|
1077
|
+
element: n,
|
|
1078
|
+
...$(t)
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
function bn(e, n, t) {
|
|
1082
|
+
return new e({
|
|
1083
|
+
type: "custom",
|
|
1084
|
+
check: "custom",
|
|
1085
|
+
fn: n,
|
|
1086
|
+
...$(t)
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
const Pn = (e, n) => {
|
|
1090
|
+
ge.init(e, n), e.name = "ZodError", Object.defineProperties(e, {
|
|
1091
|
+
format: {
|
|
1092
|
+
value: (t) => Ue(e, t)
|
|
1093
|
+
},
|
|
1094
|
+
flatten: {
|
|
1095
|
+
value: (t) => Le(e, t)
|
|
1096
|
+
},
|
|
1097
|
+
addIssue: {
|
|
1098
|
+
value: (t) => e.issues.push(t)
|
|
1099
|
+
},
|
|
1100
|
+
addIssues: {
|
|
1101
|
+
value: (t) => e.issues.push(...t)
|
|
1102
|
+
},
|
|
1103
|
+
isEmpty: {
|
|
1104
|
+
get() {
|
|
1105
|
+
return e.issues.length === 0;
|
|
1106
|
+
}
|
|
2367
1107
|
}
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
1108
|
+
});
|
|
1109
|
+
}, U = c("ZodError", Pn, {
|
|
1110
|
+
Parent: Error
|
|
1111
|
+
}), kn = Ve(U), On = Je(U), En = ye(U), jn = we(U), z = c("ZodType", (e, n) => (v.init(e, n), e.def = n, Object.defineProperty(e, "_def", {
|
|
1112
|
+
value: n
|
|
1113
|
+
}), e.check = (...t) => e.clone({
|
|
1114
|
+
...n,
|
|
1115
|
+
checks: [
|
|
1116
|
+
...n.checks ?? [],
|
|
1117
|
+
...t.map((r) => typeof r == "function" ? {
|
|
1118
|
+
_zod: {
|
|
1119
|
+
check: r,
|
|
1120
|
+
def: {
|
|
1121
|
+
check: "custom"
|
|
1122
|
+
},
|
|
1123
|
+
onattach: []
|
|
1124
|
+
}
|
|
1125
|
+
} : r)
|
|
1126
|
+
]
|
|
1127
|
+
}), e.clone = (t, r) => k(e, t, r), e.brand = () => e, e.register = (t, r) => (t.add(e, r), e), e.parse = (t, r) => kn(e, t, r, {
|
|
1128
|
+
callee: e.parse
|
|
1129
|
+
}), e.safeParse = (t, r) => En(e, t, r), e.parseAsync = async (t, r) => On(e, t, r, {
|
|
1130
|
+
callee: e.parseAsync
|
|
1131
|
+
}), e.safeParseAsync = async (t, r) => jn(e, t, r), e.spa = e.safeParseAsync, e.refine = (t, r) => e.check(rt(t, r)), e.superRefine = (t) => e.check(ot(t)), e.overwrite = (t) => e.check($n(t)), e.optional = () => le(e), e.nullable = () => de(e), e.nullish = () => le(de(e)), e.nonoptional = (t) => Bn(e, t), e.array = () => Nn(e), e.or = (t) => Un([
|
|
1132
|
+
e,
|
|
1133
|
+
t
|
|
1134
|
+
]), e.and = (t) => Jn(e, t), e.transform = (t) => fe(e, Fn(t)), e.default = (t) => qn(e, t), e.prefault = (t) => Hn(e, t), e.catch = (t) => Gn(e, t), e.pipe = (t) => fe(e, t), e.readonly = () => et(e), e.describe = (t) => {
|
|
1135
|
+
const r = e.clone();
|
|
1136
|
+
return C.add(r, {
|
|
1137
|
+
description: t
|
|
1138
|
+
}), r;
|
|
1139
|
+
}, Object.defineProperty(e, "description", {
|
|
1140
|
+
get() {
|
|
1141
|
+
var _a;
|
|
1142
|
+
return (_a = C.get(e)) == null ? void 0 : _a.description;
|
|
1143
|
+
},
|
|
1144
|
+
configurable: true
|
|
1145
|
+
}), e.meta = (...t) => {
|
|
1146
|
+
if (t.length === 0) return C.get(e);
|
|
1147
|
+
const r = e.clone();
|
|
1148
|
+
return C.add(r, t[0]), r;
|
|
1149
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Tn = c("ZodAny", (e, n) => {
|
|
1150
|
+
Ye.init(e, n), z.init(e, n);
|
|
1151
|
+
});
|
|
1152
|
+
function ce() {
|
|
1153
|
+
return vn(Tn);
|
|
2373
1154
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
typeName: p.ZodNativeEnum,
|
|
2377
|
-
..._(e)
|
|
1155
|
+
const Rn = c("ZodUnknown", (e, n) => {
|
|
1156
|
+
Ge.init(e, n), z.init(e, n);
|
|
2378
1157
|
});
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
return this._def.type;
|
|
2382
|
-
}
|
|
2383
|
-
_parse(e) {
|
|
2384
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2385
|
-
if (t.parsedType !== f.promise && t.common.async === false) return c(t, {
|
|
2386
|
-
code: d.invalid_type,
|
|
2387
|
-
expected: f.promise,
|
|
2388
|
-
received: t.parsedType
|
|
2389
|
-
}), m;
|
|
2390
|
-
const r = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2391
|
-
return b(r.then((a) => this._def.type.parseAsync(a, {
|
|
2392
|
-
path: t.path,
|
|
2393
|
-
errorMap: t.common.contextualErrorMap
|
|
2394
|
-
})));
|
|
2395
|
-
}
|
|
1158
|
+
function ae() {
|
|
1159
|
+
return gn(Rn);
|
|
2396
1160
|
}
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
typeName: p.ZodPromise,
|
|
2400
|
-
..._(e)
|
|
1161
|
+
const Sn = c("ZodNever", (e, n) => {
|
|
1162
|
+
Qe.init(e, n), z.init(e, n);
|
|
2401
1163
|
});
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
return this._def.schema;
|
|
2405
|
-
}
|
|
2406
|
-
sourceType() {
|
|
2407
|
-
return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2408
|
-
}
|
|
2409
|
-
_parse(e) {
|
|
2410
|
-
const { status: t, ctx: r } = this._processInputParams(e), a = this._def.effect || null, n = {
|
|
2411
|
-
addIssue: (i) => {
|
|
2412
|
-
c(r, i), i.fatal ? t.abort() : t.dirty();
|
|
2413
|
-
},
|
|
2414
|
-
get path() {
|
|
2415
|
-
return r.path;
|
|
2416
|
-
}
|
|
2417
|
-
};
|
|
2418
|
-
if (n.addIssue = n.addIssue.bind(n), a.type === "preprocess") {
|
|
2419
|
-
const i = a.transform(r.data, n);
|
|
2420
|
-
if (r.common.async) return Promise.resolve(i).then(async (o) => {
|
|
2421
|
-
if (t.value === "aborted") return m;
|
|
2422
|
-
const u = await this._def.schema._parseAsync({
|
|
2423
|
-
data: o,
|
|
2424
|
-
path: r.path,
|
|
2425
|
-
parent: r
|
|
2426
|
-
});
|
|
2427
|
-
return u.status === "aborted" ? m : u.status === "dirty" || t.value === "dirty" ? M(u.value) : u;
|
|
2428
|
-
});
|
|
2429
|
-
{
|
|
2430
|
-
if (t.value === "aborted") return m;
|
|
2431
|
-
const o = this._def.schema._parseSync({
|
|
2432
|
-
data: i,
|
|
2433
|
-
path: r.path,
|
|
2434
|
-
parent: r
|
|
2435
|
-
});
|
|
2436
|
-
return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? M(o.value) : o;
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
if (a.type === "refinement") {
|
|
2440
|
-
const i = (o) => {
|
|
2441
|
-
const u = a.refinement(o, n);
|
|
2442
|
-
if (r.common.async) return Promise.resolve(u);
|
|
2443
|
-
if (u instanceof Promise) throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2444
|
-
return o;
|
|
2445
|
-
};
|
|
2446
|
-
if (r.common.async === false) {
|
|
2447
|
-
const o = this._def.schema._parseSync({
|
|
2448
|
-
data: r.data,
|
|
2449
|
-
path: r.path,
|
|
2450
|
-
parent: r
|
|
2451
|
-
});
|
|
2452
|
-
return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), {
|
|
2453
|
-
status: t.value,
|
|
2454
|
-
value: o.value
|
|
2455
|
-
});
|
|
2456
|
-
} else return this._def.schema._parseAsync({
|
|
2457
|
-
data: r.data,
|
|
2458
|
-
path: r.path,
|
|
2459
|
-
parent: r
|
|
2460
|
-
}).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({
|
|
2461
|
-
status: t.value,
|
|
2462
|
-
value: o.value
|
|
2463
|
-
}))));
|
|
2464
|
-
}
|
|
2465
|
-
if (a.type === "transform") if (r.common.async === false) {
|
|
2466
|
-
const i = this._def.schema._parseSync({
|
|
2467
|
-
data: r.data,
|
|
2468
|
-
path: r.path,
|
|
2469
|
-
parent: r
|
|
2470
|
-
});
|
|
2471
|
-
if (!I(i)) return m;
|
|
2472
|
-
const o = a.transform(i.value, n);
|
|
2473
|
-
if (o instanceof Promise) throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2474
|
-
return {
|
|
2475
|
-
status: t.value,
|
|
2476
|
-
value: o
|
|
2477
|
-
};
|
|
2478
|
-
} else return this._def.schema._parseAsync({
|
|
2479
|
-
data: r.data,
|
|
2480
|
-
path: r.path,
|
|
2481
|
-
parent: r
|
|
2482
|
-
}).then((i) => I(i) ? Promise.resolve(a.transform(i.value, n)).then((o) => ({
|
|
2483
|
-
status: t.value,
|
|
2484
|
-
value: o
|
|
2485
|
-
})) : m);
|
|
2486
|
-
v.assertNever(a);
|
|
2487
|
-
}
|
|
1164
|
+
function xn(e) {
|
|
1165
|
+
return zn(Sn, e);
|
|
2488
1166
|
}
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
typeName: p.ZodEffects,
|
|
2492
|
-
effect: e,
|
|
2493
|
-
..._(t)
|
|
1167
|
+
const An = c("ZodArray", (e, n) => {
|
|
1168
|
+
Xe.init(e, n), z.init(e, n), e.element = n.element, e.min = (t, r) => e.check(ie(t, r)), e.nonempty = (t) => e.check(ie(1, t)), e.max = (t, r) => e.check(yn(t, r)), e.length = (t, r) => e.check(wn(t, r)), e.unwrap = () => e.element;
|
|
2494
1169
|
});
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
1170
|
+
function Nn(e, n) {
|
|
1171
|
+
return Zn(An, e, n);
|
|
1172
|
+
}
|
|
1173
|
+
const In = c("ZodObject", (e, n) => {
|
|
1174
|
+
en.init(e, n), z.init(e, n), h(e, "shape", () => n.shape), e.keyof = () => $e(Object.keys(e._zod.def.shape)), e.catchall = (t) => e.clone({
|
|
1175
|
+
...e._zod.def,
|
|
1176
|
+
catchall: t
|
|
1177
|
+
}), e.passthrough = () => e.clone({
|
|
1178
|
+
...e._zod.def,
|
|
1179
|
+
catchall: ae()
|
|
1180
|
+
}), e.loose = () => e.clone({
|
|
1181
|
+
...e._zod.def,
|
|
1182
|
+
catchall: ae()
|
|
1183
|
+
}), e.strict = () => e.clone({
|
|
1184
|
+
...e._zod.def,
|
|
1185
|
+
catchall: xn()
|
|
1186
|
+
}), e.strip = () => e.clone({
|
|
1187
|
+
...e._zod.def,
|
|
1188
|
+
catchall: void 0
|
|
1189
|
+
}), e.extend = (t) => Ae(e, t), e.merge = (t) => Ne(e, t), e.pick = (t) => Se(e, t), e.omit = (t) => xe(e, t), e.partial = (...t) => Ie(Ze, e, t[0]), e.required = (...t) => Ce(be, e, t[0]);
|
|
2503
1190
|
});
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
1191
|
+
function Cn(e, n) {
|
|
1192
|
+
const t = {
|
|
1193
|
+
type: "object",
|
|
1194
|
+
get shape() {
|
|
1195
|
+
return W(this, "shape", {
|
|
1196
|
+
...e
|
|
1197
|
+
}), this.shape;
|
|
1198
|
+
},
|
|
1199
|
+
...$(n)
|
|
1200
|
+
};
|
|
1201
|
+
return new In(t);
|
|
2511
1202
|
}
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
typeName: p.ZodOptional,
|
|
2515
|
-
..._(e)
|
|
1203
|
+
const Ln = c("ZodUnion", (e, n) => {
|
|
1204
|
+
nn.init(e, n), z.init(e, n), e.options = n.options;
|
|
2516
1205
|
});
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
}
|
|
1206
|
+
function Un(e, n) {
|
|
1207
|
+
return new Ln({
|
|
1208
|
+
type: "union",
|
|
1209
|
+
options: e,
|
|
1210
|
+
...$(n)
|
|
1211
|
+
});
|
|
2524
1212
|
}
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
typeName: p.ZodNullable,
|
|
2528
|
-
..._(e)
|
|
1213
|
+
const Vn = c("ZodIntersection", (e, n) => {
|
|
1214
|
+
tn.init(e, n), z.init(e, n);
|
|
2529
1215
|
});
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
path: t.path,
|
|
2537
|
-
parent: t
|
|
2538
|
-
});
|
|
2539
|
-
}
|
|
2540
|
-
removeDefault() {
|
|
2541
|
-
return this._def.innerType;
|
|
2542
|
-
}
|
|
1216
|
+
function Jn(e, n) {
|
|
1217
|
+
return new Vn({
|
|
1218
|
+
type: "intersection",
|
|
1219
|
+
left: e,
|
|
1220
|
+
right: n
|
|
1221
|
+
});
|
|
2543
1222
|
}
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
1223
|
+
const M = c("ZodEnum", (e, n) => {
|
|
1224
|
+
rn.init(e, n), z.init(e, n), e.enum = n.entries, e.options = Object.values(n.entries);
|
|
1225
|
+
const t = new Set(Object.keys(n.entries));
|
|
1226
|
+
e.extract = (r, o) => {
|
|
1227
|
+
const s = {};
|
|
1228
|
+
for (const u of r) if (t.has(u)) s[u] = n.entries[u];
|
|
1229
|
+
else throw new Error(`Key ${u} not found in enum`);
|
|
1230
|
+
return new M({
|
|
1231
|
+
...n,
|
|
1232
|
+
checks: [],
|
|
1233
|
+
...$(o),
|
|
1234
|
+
entries: s
|
|
1235
|
+
});
|
|
1236
|
+
}, e.exclude = (r, o) => {
|
|
1237
|
+
const s = {
|
|
1238
|
+
...n.entries
|
|
1239
|
+
};
|
|
1240
|
+
for (const u of r) if (t.has(u)) delete s[u];
|
|
1241
|
+
else throw new Error(`Key ${u} not found in enum`);
|
|
1242
|
+
return new M({
|
|
1243
|
+
...n,
|
|
1244
|
+
checks: [],
|
|
1245
|
+
...$(o),
|
|
1246
|
+
entries: s
|
|
1247
|
+
});
|
|
1248
|
+
};
|
|
2549
1249
|
});
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
1250
|
+
function $e(e, n) {
|
|
1251
|
+
const t = Array.isArray(e) ? Object.fromEntries(e.map((r) => [
|
|
1252
|
+
r,
|
|
1253
|
+
r
|
|
1254
|
+
])) : e;
|
|
1255
|
+
return new M({
|
|
1256
|
+
type: "enum",
|
|
1257
|
+
entries: t,
|
|
1258
|
+
...$(n)
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
const Dn = c("ZodTransform", (e, n) => {
|
|
1262
|
+
on.init(e, n), z.init(e, n), e._zod.parse = (t, r) => {
|
|
1263
|
+
t.addIssue = (s) => {
|
|
1264
|
+
if (typeof s == "string") t.issues.push(S(s, t.value, n));
|
|
1265
|
+
else {
|
|
1266
|
+
const u = s;
|
|
1267
|
+
u.fatal && (u.continue = false), u.code ?? (u.code = "custom"), u.input ?? (u.input = t.value), u.inst ?? (u.inst = e), u.continue ?? (u.continue = true), t.issues.push(S(u));
|
|
2563
1268
|
}
|
|
2564
|
-
});
|
|
2565
|
-
return U(a) ? a.then((n) => ({
|
|
2566
|
-
status: "valid",
|
|
2567
|
-
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2568
|
-
get error() {
|
|
2569
|
-
return new O(r.common.issues);
|
|
2570
|
-
},
|
|
2571
|
-
input: r.data
|
|
2572
|
-
})
|
|
2573
|
-
})) : {
|
|
2574
|
-
status: "valid",
|
|
2575
|
-
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2576
|
-
get error() {
|
|
2577
|
-
return new O(r.common.issues);
|
|
2578
|
-
},
|
|
2579
|
-
input: r.data
|
|
2580
|
-
})
|
|
2581
1269
|
};
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
1270
|
+
const o = n.transform(t.value, t);
|
|
1271
|
+
return o instanceof Promise ? o.then((s) => (t.value = s, t)) : (t.value = o, t);
|
|
1272
|
+
};
|
|
1273
|
+
});
|
|
1274
|
+
function Fn(e) {
|
|
1275
|
+
return new Dn({
|
|
1276
|
+
type: "transform",
|
|
1277
|
+
transform: e
|
|
1278
|
+
});
|
|
2586
1279
|
}
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
typeName: p.ZodCatch,
|
|
2590
|
-
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2591
|
-
..._(e)
|
|
1280
|
+
const Ze = c("ZodOptional", (e, n) => {
|
|
1281
|
+
sn.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType;
|
|
2592
1282
|
});
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
code: d.invalid_type,
|
|
2599
|
-
expected: f.nan,
|
|
2600
|
-
received: r.parsedType
|
|
2601
|
-
}), m;
|
|
2602
|
-
}
|
|
2603
|
-
return {
|
|
2604
|
-
status: "valid",
|
|
2605
|
-
value: e.data
|
|
2606
|
-
};
|
|
2607
|
-
}
|
|
1283
|
+
function le(e) {
|
|
1284
|
+
return new Ze({
|
|
1285
|
+
type: "optional",
|
|
1286
|
+
innerType: e
|
|
1287
|
+
});
|
|
2608
1288
|
}
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
..._(s)
|
|
1289
|
+
const Mn = c("ZodNullable", (e, n) => {
|
|
1290
|
+
un.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType;
|
|
2612
1291
|
});
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
path: t.path,
|
|
2619
|
-
parent: t
|
|
2620
|
-
});
|
|
2621
|
-
}
|
|
2622
|
-
unwrap() {
|
|
2623
|
-
return this._def.type;
|
|
2624
|
-
}
|
|
1292
|
+
function de(e) {
|
|
1293
|
+
return new Mn({
|
|
1294
|
+
type: "nullable",
|
|
1295
|
+
innerType: e
|
|
1296
|
+
});
|
|
2625
1297
|
}
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), M(n.value)) : this._def.out._parseAsync({
|
|
2636
|
-
data: n.value,
|
|
2637
|
-
path: r.path,
|
|
2638
|
-
parent: r
|
|
2639
|
-
});
|
|
2640
|
-
})();
|
|
2641
|
-
{
|
|
2642
|
-
const a = this._def.in._parseSync({
|
|
2643
|
-
data: r.data,
|
|
2644
|
-
path: r.path,
|
|
2645
|
-
parent: r
|
|
2646
|
-
});
|
|
2647
|
-
return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), {
|
|
2648
|
-
status: "dirty",
|
|
2649
|
-
value: a.value
|
|
2650
|
-
}) : this._def.out._parseSync({
|
|
2651
|
-
data: a.value,
|
|
2652
|
-
path: r.path,
|
|
2653
|
-
parent: r
|
|
2654
|
-
});
|
|
1298
|
+
const Kn = c("ZodDefault", (e, n) => {
|
|
1299
|
+
cn.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
1300
|
+
});
|
|
1301
|
+
function qn(e, n) {
|
|
1302
|
+
return new Kn({
|
|
1303
|
+
type: "default",
|
|
1304
|
+
innerType: e,
|
|
1305
|
+
get defaultValue() {
|
|
1306
|
+
return typeof n == "function" ? n() : n;
|
|
2655
1307
|
}
|
|
2656
|
-
}
|
|
2657
|
-
static create(e, t) {
|
|
2658
|
-
return new te({
|
|
2659
|
-
in: e,
|
|
2660
|
-
out: t,
|
|
2661
|
-
typeName: p.ZodPipeline
|
|
2662
|
-
});
|
|
2663
|
-
}
|
|
1308
|
+
});
|
|
2664
1309
|
}
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
1310
|
+
const Wn = c("ZodPrefault", (e, n) => {
|
|
1311
|
+
an.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType;
|
|
1312
|
+
});
|
|
1313
|
+
function Hn(e, n) {
|
|
1314
|
+
return new Wn({
|
|
1315
|
+
type: "prefault",
|
|
1316
|
+
innerType: e,
|
|
1317
|
+
get defaultValue() {
|
|
1318
|
+
return typeof n == "function" ? n() : n;
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
const be = c("ZodNonOptional", (e, n) => {
|
|
1323
|
+
ln.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType;
|
|
1324
|
+
});
|
|
1325
|
+
function Bn(e, n) {
|
|
1326
|
+
return new be({
|
|
1327
|
+
type: "nonoptional",
|
|
1328
|
+
innerType: e,
|
|
1329
|
+
...$(n)
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
const Yn = c("ZodCatch", (e, n) => {
|
|
1333
|
+
dn.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
1334
|
+
});
|
|
1335
|
+
function Gn(e, n) {
|
|
1336
|
+
return new Yn({
|
|
1337
|
+
type: "catch",
|
|
1338
|
+
innerType: e,
|
|
1339
|
+
catchValue: typeof n == "function" ? n : () => n
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
const Qn = c("ZodPipe", (e, n) => {
|
|
1343
|
+
fn.init(e, n), z.init(e, n), e.in = n.in, e.out = n.out;
|
|
1344
|
+
});
|
|
1345
|
+
function fe(e, n) {
|
|
1346
|
+
return new Qn({
|
|
1347
|
+
type: "pipe",
|
|
1348
|
+
in: e,
|
|
1349
|
+
out: n
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
const Xn = c("ZodReadonly", (e, n) => {
|
|
1353
|
+
pn.init(e, n), z.init(e, n);
|
|
1354
|
+
});
|
|
1355
|
+
function et(e) {
|
|
1356
|
+
return new Xn({
|
|
1357
|
+
type: "readonly",
|
|
1358
|
+
innerType: e
|
|
1359
|
+
});
|
|
2673
1360
|
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
typeName: p.ZodReadonly,
|
|
2677
|
-
..._(e)
|
|
1361
|
+
const nt = c("ZodCustom", (e, n) => {
|
|
1362
|
+
hn.init(e, n), z.init(e, n);
|
|
2678
1363
|
});
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
1364
|
+
function tt(e) {
|
|
1365
|
+
const n = new O({
|
|
1366
|
+
check: "custom"
|
|
1367
|
+
});
|
|
1368
|
+
return n._zod.check = e, n;
|
|
1369
|
+
}
|
|
1370
|
+
function rt(e, n = {}) {
|
|
1371
|
+
return bn(nt, e, n);
|
|
1372
|
+
}
|
|
1373
|
+
function ot(e) {
|
|
1374
|
+
const n = tt((t) => (t.addIssue = (r) => {
|
|
1375
|
+
if (typeof r == "string") t.issues.push(S(r, t.value, n._zod.def));
|
|
1376
|
+
else {
|
|
1377
|
+
const o = r;
|
|
1378
|
+
o.fatal && (o.continue = false), o.code ?? (o.code = "custom"), o.input ?? (o.input = t.value), o.inst ?? (o.inst = n), o.continue ?? (o.continue = !n._zod.def.abort), t.issues.push(S(o));
|
|
1379
|
+
}
|
|
1380
|
+
}, e(t.value, t)));
|
|
1381
|
+
return n;
|
|
1382
|
+
}
|
|
1383
|
+
let L = null;
|
|
1384
|
+
async function st() {
|
|
1385
|
+
if (L) return L;
|
|
2697
1386
|
try {
|
|
2698
|
-
const
|
|
2699
|
-
return await
|
|
2700
|
-
} catch (
|
|
2701
|
-
throw new Error(`Failed to load norg parser: ${
|
|
1387
|
+
const e = await import("../vite_plugin_norg_parser-koOTkJLR.js");
|
|
1388
|
+
return await e.default(), L = e.parse_norg, L;
|
|
1389
|
+
} catch (e) {
|
|
1390
|
+
throw new Error(`Failed to load norg parser: ${e}`);
|
|
2702
1391
|
}
|
|
2703
1392
|
}
|
|
2704
|
-
const
|
|
2705
|
-
const t = JSON.stringify(
|
|
1393
|
+
const ut = ({ html: e, metadata: n }) => {
|
|
1394
|
+
const t = JSON.stringify(n ?? {}), r = JSON.stringify(e);
|
|
2706
1395
|
return [
|
|
2707
1396
|
`export const metadata = ${t};`,
|
|
2708
1397
|
`export const html = ${r};`,
|
|
@@ -2710,11 +1399,11 @@ let __tla = (async () => {
|
|
|
2710
1399
|
].join(`
|
|
2711
1400
|
`);
|
|
2712
1401
|
};
|
|
2713
|
-
function
|
|
2714
|
-
const t = JSON.stringify(
|
|
1402
|
+
function it({ html: e, metadata: n }) {
|
|
1403
|
+
const t = JSON.stringify(n ?? {});
|
|
2715
1404
|
return [
|
|
2716
1405
|
"<script>",
|
|
2717
|
-
` const htmlContent = ${JSON.stringify(
|
|
1406
|
+
` const htmlContent = ${JSON.stringify(e)};`,
|
|
2718
1407
|
"<\/script>",
|
|
2719
1408
|
'<script context="module">',
|
|
2720
1409
|
` export const metadata = ${t};`,
|
|
@@ -2723,8 +1412,8 @@ let __tla = (async () => {
|
|
|
2723
1412
|
].join(`
|
|
2724
1413
|
`);
|
|
2725
1414
|
}
|
|
2726
|
-
function
|
|
2727
|
-
const t = JSON.stringify(
|
|
1415
|
+
function ct({ html: e, metadata: n }) {
|
|
1416
|
+
const t = JSON.stringify(n ?? {}), r = JSON.stringify(e);
|
|
2728
1417
|
return [
|
|
2729
1418
|
'import React from "react";',
|
|
2730
1419
|
`export const metadata = ${t};`,
|
|
@@ -2734,60 +1423,60 @@ let __tla = (async () => {
|
|
|
2734
1423
|
].join(`
|
|
2735
1424
|
`);
|
|
2736
1425
|
}
|
|
2737
|
-
const
|
|
2738
|
-
mode:
|
|
1426
|
+
const at = Cn({
|
|
1427
|
+
mode: $e([
|
|
2739
1428
|
"html",
|
|
2740
1429
|
"svelte",
|
|
2741
1430
|
"react"
|
|
2742
1431
|
]),
|
|
2743
|
-
include:
|
|
2744
|
-
exclude:
|
|
2745
|
-
}),
|
|
2746
|
-
html:
|
|
2747
|
-
svelte:
|
|
2748
|
-
react:
|
|
1432
|
+
include: ce().optional(),
|
|
1433
|
+
exclude: ce().optional()
|
|
1434
|
+
}), pe = {
|
|
1435
|
+
html: ut,
|
|
1436
|
+
svelte: it,
|
|
1437
|
+
react: ct
|
|
2749
1438
|
};
|
|
2750
|
-
|
|
2751
|
-
const
|
|
2752
|
-
let
|
|
2753
|
-
const
|
|
2754
|
-
if (!
|
|
2755
|
-
|
|
2756
|
-
} catch (
|
|
2757
|
-
throw new Error(`Failed to load norg parser: ${
|
|
1439
|
+
dt = function(e) {
|
|
1440
|
+
const n = at.parse(e), { include: t, exclude: r, mode: o } = n, s = Pe(t, r);
|
|
1441
|
+
let u = null;
|
|
1442
|
+
const i = async () => {
|
|
1443
|
+
if (!u) try {
|
|
1444
|
+
u = await st();
|
|
1445
|
+
} catch (a) {
|
|
1446
|
+
throw new Error(`Failed to load norg parser: ${a}`);
|
|
2758
1447
|
}
|
|
2759
|
-
return
|
|
1448
|
+
return u;
|
|
2760
1449
|
};
|
|
2761
1450
|
return {
|
|
2762
1451
|
name: "vite-plugin-norg",
|
|
2763
1452
|
enforce: "pre",
|
|
2764
|
-
async resolveId(
|
|
2765
|
-
if (!
|
|
2766
|
-
const
|
|
1453
|
+
async resolveId(a, d) {
|
|
1454
|
+
if (!a.endsWith(".norg")) return null;
|
|
1455
|
+
const p = await this.resolve(a, d, {
|
|
2767
1456
|
skipSelf: true
|
|
2768
1457
|
});
|
|
2769
|
-
return
|
|
1458
|
+
return p ? p.id : null;
|
|
2770
1459
|
},
|
|
2771
|
-
async load(
|
|
2772
|
-
if (
|
|
2773
|
-
const { readFile:
|
|
2774
|
-
await
|
|
2775
|
-
return
|
|
2776
|
-
}),
|
|
2777
|
-
return
|
|
2778
|
-
} catch (
|
|
2779
|
-
this.error(new Error(`Failed to parse norg file ${
|
|
1460
|
+
async load(a) {
|
|
1461
|
+
if (s(a)) try {
|
|
1462
|
+
const { readFile: d } = await import("node:fs/promises").then(async (m) => {
|
|
1463
|
+
await m.__tla;
|
|
1464
|
+
return m;
|
|
1465
|
+
}), p = await i(), l = await d(a, "utf-8"), f = p(l);
|
|
1466
|
+
return pe[o](f);
|
|
1467
|
+
} catch (d) {
|
|
1468
|
+
this.error(new Error(`Failed to parse norg file ${a}: ${d}`));
|
|
2780
1469
|
}
|
|
2781
1470
|
},
|
|
2782
|
-
async handleHotUpdate(
|
|
2783
|
-
if (!
|
|
2784
|
-
const
|
|
2785
|
-
|
|
1471
|
+
async handleHotUpdate(a) {
|
|
1472
|
+
if (!s(a.file) || !a.file.endsWith(".norg")) return;
|
|
1473
|
+
const d = a.read;
|
|
1474
|
+
a.read = async function() {
|
|
2786
1475
|
try {
|
|
2787
|
-
const
|
|
2788
|
-
return
|
|
2789
|
-
} catch (
|
|
2790
|
-
throw new Error(`Failed to parse norg file ${
|
|
1476
|
+
const p = await d(), l = await i();
|
|
1477
|
+
return pe[o](l(p));
|
|
1478
|
+
} catch (p) {
|
|
1479
|
+
throw new Error(`Failed to parse norg file ${a.file}: ${p}`);
|
|
2791
1480
|
}
|
|
2792
1481
|
};
|
|
2793
1482
|
}
|
|
@@ -2796,6 +1485,6 @@ let __tla = (async () => {
|
|
|
2796
1485
|
})();
|
|
2797
1486
|
export {
|
|
2798
1487
|
__tla,
|
|
2799
|
-
|
|
2800
|
-
|
|
1488
|
+
dt as default,
|
|
1489
|
+
dt as norgPlugin
|
|
2801
1490
|
};
|