ai-props 0.1.2 → 2.0.2
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/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +15 -0
- package/README.md +345 -352
- package/dist/ai.d.ts +125 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +199 -0
- package/dist/ai.js.map +1 -0
- package/dist/cache.d.ts +66 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +183 -0
- package/dist/cache.js.map +1 -0
- package/dist/generate.d.ts +69 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +221 -0
- package/dist/generate.js.map +1 -0
- package/dist/hoc.d.ts +164 -0
- package/dist/hoc.d.ts.map +1 -0
- package/dist/hoc.js +236 -0
- package/dist/hoc.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +152 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +58 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +253 -0
- package/dist/validate.js.map +1 -0
- package/package.json +16 -63
- package/src/ai.ts +264 -0
- package/src/cache.ts +216 -0
- package/src/generate.ts +276 -0
- package/src/hoc.ts +309 -0
- package/src/index.ts +66 -0
- package/src/types.ts +167 -0
- package/src/validate.ts +333 -0
- package/test/ai.test.ts +327 -0
- package/test/cache.test.ts +236 -0
- package/test/generate.test.ts +406 -0
- package/test/hoc.test.ts +411 -0
- package/test/validate.test.ts +324 -0
- package/tsconfig.json +9 -0
- package/vitest.config.ts +15 -0
- package/LICENSE +0 -21
- package/dist/AI.d.ts +0 -27
- package/dist/AI.d.ts.map +0 -1
- package/dist/AI.test.d.ts +0 -2
- package/dist/AI.test.d.ts.map +0 -1
- package/dist/ai-props.es.js +0 -3697
- package/dist/ai-props.umd.js +0 -30
- package/dist/components/ErrorBoundary.d.ts +0 -17
- package/dist/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/examples/BlogList.d.ts +0 -2
- package/dist/examples/BlogList.d.ts.map +0 -1
- package/dist/examples/BlogList.fixture.d.ts +0 -5
- package/dist/examples/BlogList.fixture.d.ts.map +0 -1
- package/dist/examples/HeroSection.d.ts +0 -2
- package/dist/examples/HeroSection.d.ts.map +0 -1
- package/dist/examples/HeroSection.fixture.d.ts +0 -5
- package/dist/examples/HeroSection.fixture.d.ts.map +0 -1
- package/dist/test/setup.d.ts +0 -2
- package/dist/test/setup.d.ts.map +0 -1
- package/dist/utils/schema.d.ts +0 -28
- package/dist/utils/schema.d.ts.map +0 -1
- package/dist/utils/styles.d.ts +0 -3
- package/dist/utils/styles.d.ts.map +0 -1
package/dist/ai-props.es.js
DELETED
|
@@ -1,3697 +0,0 @@
|
|
|
1
|
-
import nr, { useState as Jt, useEffect as zr } from "react";
|
|
2
|
-
var _t = { exports: {} }, Ce = {};
|
|
3
|
-
/**
|
|
4
|
-
* @license React
|
|
5
|
-
* react-jsx-runtime.production.min.js
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
var Gt;
|
|
13
|
-
function Ur() {
|
|
14
|
-
if (Gt) return Ce;
|
|
15
|
-
Gt = 1;
|
|
16
|
-
var r = nr, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, a = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
-
function o(c, l, f) {
|
|
18
|
-
var v, S = {}, N = null, B = null;
|
|
19
|
-
f !== void 0 && (N = "" + f), l.key !== void 0 && (N = "" + l.key), l.ref !== void 0 && (B = l.ref);
|
|
20
|
-
for (v in l) n.call(l, v) && !s.hasOwnProperty(v) && (S[v] = l[v]);
|
|
21
|
-
if (c && c.defaultProps) for (v in l = c.defaultProps, l) S[v] === void 0 && (S[v] = l[v]);
|
|
22
|
-
return { $$typeof: e, type: c, key: N, ref: B, props: S, _owner: a.current };
|
|
23
|
-
}
|
|
24
|
-
return Ce.Fragment = t, Ce.jsx = o, Ce.jsxs = o, Ce;
|
|
25
|
-
}
|
|
26
|
-
var Oe = {};
|
|
27
|
-
/**
|
|
28
|
-
* @license React
|
|
29
|
-
* react-jsx-runtime.development.js
|
|
30
|
-
*
|
|
31
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the MIT license found in the
|
|
34
|
-
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/
|
|
36
|
-
var Ht;
|
|
37
|
-
function Wr() {
|
|
38
|
-
return Ht || (Ht = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
-
var r = nr, e = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), c = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), B = Symbol.for("react.offscreen"), Ye = Symbol.iterator, st = "@@iterator";
|
|
40
|
-
function we(i) {
|
|
41
|
-
if (i === null || typeof i != "object")
|
|
42
|
-
return null;
|
|
43
|
-
var u = Ye && i[Ye] || i[st];
|
|
44
|
-
return typeof u == "function" ? u : null;
|
|
45
|
-
}
|
|
46
|
-
var Y = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
-
function Z(i) {
|
|
48
|
-
{
|
|
49
|
-
for (var u = arguments.length, p = new Array(u > 1 ? u - 1 : 0), b = 1; b < u; b++)
|
|
50
|
-
p[b - 1] = arguments[b];
|
|
51
|
-
it("error", i, p);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function it(i, u, p) {
|
|
55
|
-
{
|
|
56
|
-
var b = Y.ReactDebugCurrentFrame, R = b.getStackAddendum();
|
|
57
|
-
R !== "" && (u += "%s", p = p.concat([R]));
|
|
58
|
-
var C = p.map(function(T) {
|
|
59
|
-
return String(T);
|
|
60
|
-
});
|
|
61
|
-
C.unshift("Warning: " + u), Function.prototype.apply.call(console[i], console, C);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
var H = !1, ot = !1, Et = !1, K = !1, Te = !1, V;
|
|
65
|
-
V = Symbol.for("react.module.reference");
|
|
66
|
-
function ne(i) {
|
|
67
|
-
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || Te || i === a || i === f || i === v || K || i === B || H || ot || Et || typeof i == "object" && i !== null && (i.$$typeof === N || i.$$typeof === S || i.$$typeof === o || i.$$typeof === c || i.$$typeof === l || // This needs to include all possible module reference object
|
|
68
|
-
// types supported by any Flight configuration anywhere since
|
|
69
|
-
// we don't know which Flight build this will end up being used
|
|
70
|
-
// with.
|
|
71
|
-
i.$$typeof === V || i.getModuleId !== void 0));
|
|
72
|
-
}
|
|
73
|
-
function X(i, u, p) {
|
|
74
|
-
var b = i.displayName;
|
|
75
|
-
if (b)
|
|
76
|
-
return b;
|
|
77
|
-
var R = u.displayName || u.name || "";
|
|
78
|
-
return R !== "" ? p + "(" + R + ")" : p;
|
|
79
|
-
}
|
|
80
|
-
function ae(i) {
|
|
81
|
-
return i.displayName || "Context";
|
|
82
|
-
}
|
|
83
|
-
function L(i) {
|
|
84
|
-
if (i == null)
|
|
85
|
-
return null;
|
|
86
|
-
if (typeof i.tag == "number" && Z("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
|
|
87
|
-
return i.displayName || i.name || null;
|
|
88
|
-
if (typeof i == "string")
|
|
89
|
-
return i;
|
|
90
|
-
switch (i) {
|
|
91
|
-
case n:
|
|
92
|
-
return "Fragment";
|
|
93
|
-
case t:
|
|
94
|
-
return "Portal";
|
|
95
|
-
case s:
|
|
96
|
-
return "Profiler";
|
|
97
|
-
case a:
|
|
98
|
-
return "StrictMode";
|
|
99
|
-
case f:
|
|
100
|
-
return "Suspense";
|
|
101
|
-
case v:
|
|
102
|
-
return "SuspenseList";
|
|
103
|
-
}
|
|
104
|
-
if (typeof i == "object")
|
|
105
|
-
switch (i.$$typeof) {
|
|
106
|
-
case c:
|
|
107
|
-
var u = i;
|
|
108
|
-
return ae(u) + ".Consumer";
|
|
109
|
-
case o:
|
|
110
|
-
var p = i;
|
|
111
|
-
return ae(p._context) + ".Provider";
|
|
112
|
-
case l:
|
|
113
|
-
return X(i, i.render, "ForwardRef");
|
|
114
|
-
case S:
|
|
115
|
-
var b = i.displayName || null;
|
|
116
|
-
return b !== null ? b : L(i.type) || "Memo";
|
|
117
|
-
case N: {
|
|
118
|
-
var R = i, C = R._payload, T = R._init;
|
|
119
|
-
try {
|
|
120
|
-
return L(T(C));
|
|
121
|
-
} catch {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
var ue = Object.assign, Ee = 0, Rt, St, Ct, Ot, jt, At, Zt;
|
|
129
|
-
function Nt() {
|
|
130
|
-
}
|
|
131
|
-
Nt.__reactDisabledLog = !0;
|
|
132
|
-
function mr() {
|
|
133
|
-
{
|
|
134
|
-
if (Ee === 0) {
|
|
135
|
-
Rt = console.log, St = console.info, Ct = console.warn, Ot = console.error, jt = console.group, At = console.groupCollapsed, Zt = console.groupEnd;
|
|
136
|
-
var i = {
|
|
137
|
-
configurable: !0,
|
|
138
|
-
enumerable: !0,
|
|
139
|
-
value: Nt,
|
|
140
|
-
writable: !0
|
|
141
|
-
};
|
|
142
|
-
Object.defineProperties(console, {
|
|
143
|
-
info: i,
|
|
144
|
-
log: i,
|
|
145
|
-
warn: i,
|
|
146
|
-
error: i,
|
|
147
|
-
group: i,
|
|
148
|
-
groupCollapsed: i,
|
|
149
|
-
groupEnd: i
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
Ee++;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function vr() {
|
|
156
|
-
{
|
|
157
|
-
if (Ee--, Ee === 0) {
|
|
158
|
-
var i = {
|
|
159
|
-
configurable: !0,
|
|
160
|
-
enumerable: !0,
|
|
161
|
-
writable: !0
|
|
162
|
-
};
|
|
163
|
-
Object.defineProperties(console, {
|
|
164
|
-
log: ue({}, i, {
|
|
165
|
-
value: Rt
|
|
166
|
-
}),
|
|
167
|
-
info: ue({}, i, {
|
|
168
|
-
value: St
|
|
169
|
-
}),
|
|
170
|
-
warn: ue({}, i, {
|
|
171
|
-
value: Ct
|
|
172
|
-
}),
|
|
173
|
-
error: ue({}, i, {
|
|
174
|
-
value: Ot
|
|
175
|
-
}),
|
|
176
|
-
group: ue({}, i, {
|
|
177
|
-
value: jt
|
|
178
|
-
}),
|
|
179
|
-
groupCollapsed: ue({}, i, {
|
|
180
|
-
value: At
|
|
181
|
-
}),
|
|
182
|
-
groupEnd: ue({}, i, {
|
|
183
|
-
value: Zt
|
|
184
|
-
})
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
Ee < 0 && Z("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
var ct = Y.ReactCurrentDispatcher, ut;
|
|
191
|
-
function qe(i, u, p) {
|
|
192
|
-
{
|
|
193
|
-
if (ut === void 0)
|
|
194
|
-
try {
|
|
195
|
-
throw Error();
|
|
196
|
-
} catch (R) {
|
|
197
|
-
var b = R.stack.trim().match(/\n( *(at )?)/);
|
|
198
|
-
ut = b && b[1] || "";
|
|
199
|
-
}
|
|
200
|
-
return `
|
|
201
|
-
` + ut + i;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
var dt = !1, Je;
|
|
205
|
-
{
|
|
206
|
-
var yr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
-
Je = new yr();
|
|
208
|
-
}
|
|
209
|
-
function It(i, u) {
|
|
210
|
-
if (!i || dt)
|
|
211
|
-
return "";
|
|
212
|
-
{
|
|
213
|
-
var p = Je.get(i);
|
|
214
|
-
if (p !== void 0)
|
|
215
|
-
return p;
|
|
216
|
-
}
|
|
217
|
-
var b;
|
|
218
|
-
dt = !0;
|
|
219
|
-
var R = Error.prepareStackTrace;
|
|
220
|
-
Error.prepareStackTrace = void 0;
|
|
221
|
-
var C;
|
|
222
|
-
C = ct.current, ct.current = null, mr();
|
|
223
|
-
try {
|
|
224
|
-
if (u) {
|
|
225
|
-
var T = function() {
|
|
226
|
-
throw Error();
|
|
227
|
-
};
|
|
228
|
-
if (Object.defineProperty(T.prototype, "props", {
|
|
229
|
-
set: function() {
|
|
230
|
-
throw Error();
|
|
231
|
-
}
|
|
232
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
|
-
try {
|
|
234
|
-
Reflect.construct(T, []);
|
|
235
|
-
} catch (D) {
|
|
236
|
-
b = D;
|
|
237
|
-
}
|
|
238
|
-
Reflect.construct(i, [], T);
|
|
239
|
-
} else {
|
|
240
|
-
try {
|
|
241
|
-
T.call();
|
|
242
|
-
} catch (D) {
|
|
243
|
-
b = D;
|
|
244
|
-
}
|
|
245
|
-
i.call(T.prototype);
|
|
246
|
-
}
|
|
247
|
-
} else {
|
|
248
|
-
try {
|
|
249
|
-
throw Error();
|
|
250
|
-
} catch (D) {
|
|
251
|
-
b = D;
|
|
252
|
-
}
|
|
253
|
-
i();
|
|
254
|
-
}
|
|
255
|
-
} catch (D) {
|
|
256
|
-
if (D && b && typeof D.stack == "string") {
|
|
257
|
-
for (var w = D.stack.split(`
|
|
258
|
-
`), P = b.stack.split(`
|
|
259
|
-
`), j = w.length - 1, A = P.length - 1; j >= 1 && A >= 0 && w[j] !== P[A]; )
|
|
260
|
-
A--;
|
|
261
|
-
for (; j >= 1 && A >= 0; j--, A--)
|
|
262
|
-
if (w[j] !== P[A]) {
|
|
263
|
-
if (j !== 1 || A !== 1)
|
|
264
|
-
do
|
|
265
|
-
if (j--, A--, A < 0 || w[j] !== P[A]) {
|
|
266
|
-
var F = `
|
|
267
|
-
` + w[j].replace(" at new ", " at ");
|
|
268
|
-
return i.displayName && F.includes("<anonymous>") && (F = F.replace("<anonymous>", i.displayName)), typeof i == "function" && Je.set(i, F), F;
|
|
269
|
-
}
|
|
270
|
-
while (j >= 1 && A >= 0);
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
} finally {
|
|
275
|
-
dt = !1, ct.current = C, vr(), Error.prepareStackTrace = R;
|
|
276
|
-
}
|
|
277
|
-
var ve = i ? i.displayName || i.name : "", de = ve ? qe(ve) : "";
|
|
278
|
-
return typeof i == "function" && Je.set(i, de), de;
|
|
279
|
-
}
|
|
280
|
-
function gr(i, u, p) {
|
|
281
|
-
return It(i, !1);
|
|
282
|
-
}
|
|
283
|
-
function _r(i) {
|
|
284
|
-
var u = i.prototype;
|
|
285
|
-
return !!(u && u.isReactComponent);
|
|
286
|
-
}
|
|
287
|
-
function Ge(i, u, p) {
|
|
288
|
-
if (i == null)
|
|
289
|
-
return "";
|
|
290
|
-
if (typeof i == "function")
|
|
291
|
-
return It(i, _r(i));
|
|
292
|
-
if (typeof i == "string")
|
|
293
|
-
return qe(i);
|
|
294
|
-
switch (i) {
|
|
295
|
-
case f:
|
|
296
|
-
return qe("Suspense");
|
|
297
|
-
case v:
|
|
298
|
-
return qe("SuspenseList");
|
|
299
|
-
}
|
|
300
|
-
if (typeof i == "object")
|
|
301
|
-
switch (i.$$typeof) {
|
|
302
|
-
case l:
|
|
303
|
-
return gr(i.render);
|
|
304
|
-
case S:
|
|
305
|
-
return Ge(i.type, u, p);
|
|
306
|
-
case N: {
|
|
307
|
-
var b = i, R = b._payload, C = b._init;
|
|
308
|
-
try {
|
|
309
|
-
return Ge(C(R), u, p);
|
|
310
|
-
} catch {
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return "";
|
|
315
|
-
}
|
|
316
|
-
var Re = Object.prototype.hasOwnProperty, Pt = {}, $t = Y.ReactDebugCurrentFrame;
|
|
317
|
-
function He(i) {
|
|
318
|
-
if (i) {
|
|
319
|
-
var u = i._owner, p = Ge(i.type, i._source, u ? u.type : null);
|
|
320
|
-
$t.setExtraStackFrame(p);
|
|
321
|
-
} else
|
|
322
|
-
$t.setExtraStackFrame(null);
|
|
323
|
-
}
|
|
324
|
-
function br(i, u, p, b, R) {
|
|
325
|
-
{
|
|
326
|
-
var C = Function.call.bind(Re);
|
|
327
|
-
for (var T in i)
|
|
328
|
-
if (C(i, T)) {
|
|
329
|
-
var w = void 0;
|
|
330
|
-
try {
|
|
331
|
-
if (typeof i[T] != "function") {
|
|
332
|
-
var P = Error((b || "React class") + ": " + p + " type `" + T + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[T] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
|
-
throw P.name = "Invariant Violation", P;
|
|
334
|
-
}
|
|
335
|
-
w = i[T](u, T, b, p, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
|
-
} catch (j) {
|
|
337
|
-
w = j;
|
|
338
|
-
}
|
|
339
|
-
w && !(w instanceof Error) && (He(R), Z("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", b || "React class", p, T, typeof w), He(null)), w instanceof Error && !(w.message in Pt) && (Pt[w.message] = !0, He(R), Z("Failed %s type: %s", p, w.message), He(null));
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
var xr = Array.isArray;
|
|
344
|
-
function lt(i) {
|
|
345
|
-
return xr(i);
|
|
346
|
-
}
|
|
347
|
-
function kr(i) {
|
|
348
|
-
{
|
|
349
|
-
var u = typeof Symbol == "function" && Symbol.toStringTag, p = u && i[Symbol.toStringTag] || i.constructor.name || "Object";
|
|
350
|
-
return p;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
function wr(i) {
|
|
354
|
-
try {
|
|
355
|
-
return Dt(i), !1;
|
|
356
|
-
} catch {
|
|
357
|
-
return !0;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function Dt(i) {
|
|
361
|
-
return "" + i;
|
|
362
|
-
}
|
|
363
|
-
function Mt(i) {
|
|
364
|
-
if (wr(i))
|
|
365
|
-
return Z("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", kr(i)), Dt(i);
|
|
366
|
-
}
|
|
367
|
-
var Se = Y.ReactCurrentOwner, Tr = {
|
|
368
|
-
key: !0,
|
|
369
|
-
ref: !0,
|
|
370
|
-
__self: !0,
|
|
371
|
-
__source: !0
|
|
372
|
-
}, Vt, Lt, ft;
|
|
373
|
-
ft = {};
|
|
374
|
-
function Er(i) {
|
|
375
|
-
if (Re.call(i, "ref")) {
|
|
376
|
-
var u = Object.getOwnPropertyDescriptor(i, "ref").get;
|
|
377
|
-
if (u && u.isReactWarning)
|
|
378
|
-
return !1;
|
|
379
|
-
}
|
|
380
|
-
return i.ref !== void 0;
|
|
381
|
-
}
|
|
382
|
-
function Rr(i) {
|
|
383
|
-
if (Re.call(i, "key")) {
|
|
384
|
-
var u = Object.getOwnPropertyDescriptor(i, "key").get;
|
|
385
|
-
if (u && u.isReactWarning)
|
|
386
|
-
return !1;
|
|
387
|
-
}
|
|
388
|
-
return i.key !== void 0;
|
|
389
|
-
}
|
|
390
|
-
function Sr(i, u) {
|
|
391
|
-
if (typeof i.ref == "string" && Se.current && u && Se.current.stateNode !== u) {
|
|
392
|
-
var p = L(Se.current.type);
|
|
393
|
-
ft[p] || (Z('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', L(Se.current.type), i.ref), ft[p] = !0);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
function Cr(i, u) {
|
|
397
|
-
{
|
|
398
|
-
var p = function() {
|
|
399
|
-
Vt || (Vt = !0, Z("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
|
|
400
|
-
};
|
|
401
|
-
p.isReactWarning = !0, Object.defineProperty(i, "key", {
|
|
402
|
-
get: p,
|
|
403
|
-
configurable: !0
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
function Or(i, u) {
|
|
408
|
-
{
|
|
409
|
-
var p = function() {
|
|
410
|
-
Lt || (Lt = !0, Z("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
|
|
411
|
-
};
|
|
412
|
-
p.isReactWarning = !0, Object.defineProperty(i, "ref", {
|
|
413
|
-
get: p,
|
|
414
|
-
configurable: !0
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
var jr = function(i, u, p, b, R, C, T) {
|
|
419
|
-
var w = {
|
|
420
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
421
|
-
$$typeof: e,
|
|
422
|
-
// Built-in properties that belong on the element
|
|
423
|
-
type: i,
|
|
424
|
-
key: u,
|
|
425
|
-
ref: p,
|
|
426
|
-
props: T,
|
|
427
|
-
// Record the component responsible for creating this element.
|
|
428
|
-
_owner: C
|
|
429
|
-
};
|
|
430
|
-
return w._store = {}, Object.defineProperty(w._store, "validated", {
|
|
431
|
-
configurable: !1,
|
|
432
|
-
enumerable: !1,
|
|
433
|
-
writable: !0,
|
|
434
|
-
value: !1
|
|
435
|
-
}), Object.defineProperty(w, "_self", {
|
|
436
|
-
configurable: !1,
|
|
437
|
-
enumerable: !1,
|
|
438
|
-
writable: !1,
|
|
439
|
-
value: b
|
|
440
|
-
}), Object.defineProperty(w, "_source", {
|
|
441
|
-
configurable: !1,
|
|
442
|
-
enumerable: !1,
|
|
443
|
-
writable: !1,
|
|
444
|
-
value: R
|
|
445
|
-
}), Object.freeze && (Object.freeze(w.props), Object.freeze(w)), w;
|
|
446
|
-
};
|
|
447
|
-
function Ar(i, u, p, b, R) {
|
|
448
|
-
{
|
|
449
|
-
var C, T = {}, w = null, P = null;
|
|
450
|
-
p !== void 0 && (Mt(p), w = "" + p), Rr(u) && (Mt(u.key), w = "" + u.key), Er(u) && (P = u.ref, Sr(u, R));
|
|
451
|
-
for (C in u)
|
|
452
|
-
Re.call(u, C) && !Tr.hasOwnProperty(C) && (T[C] = u[C]);
|
|
453
|
-
if (i && i.defaultProps) {
|
|
454
|
-
var j = i.defaultProps;
|
|
455
|
-
for (C in j)
|
|
456
|
-
T[C] === void 0 && (T[C] = j[C]);
|
|
457
|
-
}
|
|
458
|
-
if (w || P) {
|
|
459
|
-
var A = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
|
460
|
-
w && Cr(T, A), P && Or(T, A);
|
|
461
|
-
}
|
|
462
|
-
return jr(i, w, P, R, b, Se.current, T);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
var ht = Y.ReactCurrentOwner, Ft = Y.ReactDebugCurrentFrame;
|
|
466
|
-
function me(i) {
|
|
467
|
-
if (i) {
|
|
468
|
-
var u = i._owner, p = Ge(i.type, i._source, u ? u.type : null);
|
|
469
|
-
Ft.setExtraStackFrame(p);
|
|
470
|
-
} else
|
|
471
|
-
Ft.setExtraStackFrame(null);
|
|
472
|
-
}
|
|
473
|
-
var pt;
|
|
474
|
-
pt = !1;
|
|
475
|
-
function mt(i) {
|
|
476
|
-
return typeof i == "object" && i !== null && i.$$typeof === e;
|
|
477
|
-
}
|
|
478
|
-
function zt() {
|
|
479
|
-
{
|
|
480
|
-
if (ht.current) {
|
|
481
|
-
var i = L(ht.current.type);
|
|
482
|
-
if (i)
|
|
483
|
-
return `
|
|
484
|
-
|
|
485
|
-
Check the render method of \`` + i + "`.";
|
|
486
|
-
}
|
|
487
|
-
return "";
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
function Zr(i) {
|
|
491
|
-
return "";
|
|
492
|
-
}
|
|
493
|
-
var Ut = {};
|
|
494
|
-
function Nr(i) {
|
|
495
|
-
{
|
|
496
|
-
var u = zt();
|
|
497
|
-
if (!u) {
|
|
498
|
-
var p = typeof i == "string" ? i : i.displayName || i.name;
|
|
499
|
-
p && (u = `
|
|
500
|
-
|
|
501
|
-
Check the top-level render call using <` + p + ">.");
|
|
502
|
-
}
|
|
503
|
-
return u;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
function Wt(i, u) {
|
|
507
|
-
{
|
|
508
|
-
if (!i._store || i._store.validated || i.key != null)
|
|
509
|
-
return;
|
|
510
|
-
i._store.validated = !0;
|
|
511
|
-
var p = Nr(u);
|
|
512
|
-
if (Ut[p])
|
|
513
|
-
return;
|
|
514
|
-
Ut[p] = !0;
|
|
515
|
-
var b = "";
|
|
516
|
-
i && i._owner && i._owner !== ht.current && (b = " It was passed a child from " + L(i._owner.type) + "."), me(i), Z('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', p, b), me(null);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
function Bt(i, u) {
|
|
520
|
-
{
|
|
521
|
-
if (typeof i != "object")
|
|
522
|
-
return;
|
|
523
|
-
if (lt(i))
|
|
524
|
-
for (var p = 0; p < i.length; p++) {
|
|
525
|
-
var b = i[p];
|
|
526
|
-
mt(b) && Wt(b, u);
|
|
527
|
-
}
|
|
528
|
-
else if (mt(i))
|
|
529
|
-
i._store && (i._store.validated = !0);
|
|
530
|
-
else if (i) {
|
|
531
|
-
var R = we(i);
|
|
532
|
-
if (typeof R == "function" && R !== i.entries)
|
|
533
|
-
for (var C = R.call(i), T; !(T = C.next()).done; )
|
|
534
|
-
mt(T.value) && Wt(T.value, u);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
function Ir(i) {
|
|
539
|
-
{
|
|
540
|
-
var u = i.type;
|
|
541
|
-
if (u == null || typeof u == "string")
|
|
542
|
-
return;
|
|
543
|
-
var p;
|
|
544
|
-
if (typeof u == "function")
|
|
545
|
-
p = u.propTypes;
|
|
546
|
-
else if (typeof u == "object" && (u.$$typeof === l || // Note: Memo only checks outer props here.
|
|
547
|
-
// Inner props are checked in the reconciler.
|
|
548
|
-
u.$$typeof === S))
|
|
549
|
-
p = u.propTypes;
|
|
550
|
-
else
|
|
551
|
-
return;
|
|
552
|
-
if (p) {
|
|
553
|
-
var b = L(u);
|
|
554
|
-
br(p, i.props, "prop", b, i);
|
|
555
|
-
} else if (u.PropTypes !== void 0 && !pt) {
|
|
556
|
-
pt = !0;
|
|
557
|
-
var R = L(u);
|
|
558
|
-
Z("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", R || "Unknown");
|
|
559
|
-
}
|
|
560
|
-
typeof u.getDefaultProps == "function" && !u.getDefaultProps.isReactClassApproved && Z("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
function Pr(i) {
|
|
564
|
-
{
|
|
565
|
-
for (var u = Object.keys(i.props), p = 0; p < u.length; p++) {
|
|
566
|
-
var b = u[p];
|
|
567
|
-
if (b !== "children" && b !== "key") {
|
|
568
|
-
me(i), Z("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", b), me(null);
|
|
569
|
-
break;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
i.ref !== null && (me(i), Z("Invalid attribute `ref` supplied to `React.Fragment`."), me(null));
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
var Yt = {};
|
|
576
|
-
function qt(i, u, p, b, R, C) {
|
|
577
|
-
{
|
|
578
|
-
var T = ne(i);
|
|
579
|
-
if (!T) {
|
|
580
|
-
var w = "";
|
|
581
|
-
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (w += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
582
|
-
var P = Zr();
|
|
583
|
-
P ? w += P : w += zt();
|
|
584
|
-
var j;
|
|
585
|
-
i === null ? j = "null" : lt(i) ? j = "array" : i !== void 0 && i.$$typeof === e ? (j = "<" + (L(i.type) || "Unknown") + " />", w = " Did you accidentally export a JSX literal instead of a component?") : j = typeof i, Z("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", j, w);
|
|
586
|
-
}
|
|
587
|
-
var A = Ar(i, u, p, R, C);
|
|
588
|
-
if (A == null)
|
|
589
|
-
return A;
|
|
590
|
-
if (T) {
|
|
591
|
-
var F = u.children;
|
|
592
|
-
if (F !== void 0)
|
|
593
|
-
if (b)
|
|
594
|
-
if (lt(F)) {
|
|
595
|
-
for (var ve = 0; ve < F.length; ve++)
|
|
596
|
-
Bt(F[ve], i);
|
|
597
|
-
Object.freeze && Object.freeze(F);
|
|
598
|
-
} else
|
|
599
|
-
Z("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
600
|
-
else
|
|
601
|
-
Bt(F, i);
|
|
602
|
-
}
|
|
603
|
-
if (Re.call(u, "key")) {
|
|
604
|
-
var de = L(i), D = Object.keys(u).filter(function(Fr) {
|
|
605
|
-
return Fr !== "key";
|
|
606
|
-
}), vt = D.length > 0 ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
607
|
-
if (!Yt[de + vt]) {
|
|
608
|
-
var Lr = D.length > 0 ? "{" + D.join(": ..., ") + ": ...}" : "{}";
|
|
609
|
-
Z(`A props object containing a "key" prop is being spread into JSX:
|
|
610
|
-
let props = %s;
|
|
611
|
-
<%s {...props} />
|
|
612
|
-
React keys must be passed directly to JSX without using spread:
|
|
613
|
-
let props = %s;
|
|
614
|
-
<%s key={someKey} {...props} />`, vt, de, Lr, de), Yt[de + vt] = !0;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
return i === n ? Pr(A) : Ir(A), A;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
function $r(i, u, p) {
|
|
621
|
-
return qt(i, u, p, !0);
|
|
622
|
-
}
|
|
623
|
-
function Dr(i, u, p) {
|
|
624
|
-
return qt(i, u, p, !1);
|
|
625
|
-
}
|
|
626
|
-
var Mr = Dr, Vr = $r;
|
|
627
|
-
Oe.Fragment = n, Oe.jsx = Mr, Oe.jsxs = Vr;
|
|
628
|
-
}()), Oe;
|
|
629
|
-
}
|
|
630
|
-
process.env.NODE_ENV === "production" ? _t.exports = Ur() : _t.exports = Wr();
|
|
631
|
-
var Kt = _t.exports;
|
|
632
|
-
function ar(r) {
|
|
633
|
-
var e, t, n = "";
|
|
634
|
-
if (typeof r == "string" || typeof r == "number") n += r;
|
|
635
|
-
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
636
|
-
var a = r.length;
|
|
637
|
-
for (e = 0; e < a; e++) r[e] && (t = ar(r[e])) && (n && (n += " "), n += t);
|
|
638
|
-
} else for (t in r) r[t] && (n && (n += " "), n += t);
|
|
639
|
-
return n;
|
|
640
|
-
}
|
|
641
|
-
function Xt() {
|
|
642
|
-
for (var r, e, t = 0, n = "", a = arguments.length; t < a; t++) (r = arguments[t]) && (e = ar(r)) && (n && (n += " "), n += e);
|
|
643
|
-
return n;
|
|
644
|
-
}
|
|
645
|
-
var E;
|
|
646
|
-
(function(r) {
|
|
647
|
-
r.assertEqual = (a) => a;
|
|
648
|
-
function e(a) {
|
|
649
|
-
}
|
|
650
|
-
r.assertIs = e;
|
|
651
|
-
function t(a) {
|
|
652
|
-
throw new Error();
|
|
653
|
-
}
|
|
654
|
-
r.assertNever = t, r.arrayToEnum = (a) => {
|
|
655
|
-
const s = {};
|
|
656
|
-
for (const o of a)
|
|
657
|
-
s[o] = o;
|
|
658
|
-
return s;
|
|
659
|
-
}, r.getValidEnumValues = (a) => {
|
|
660
|
-
const s = r.objectKeys(a).filter((c) => typeof a[a[c]] != "number"), o = {};
|
|
661
|
-
for (const c of s)
|
|
662
|
-
o[c] = a[c];
|
|
663
|
-
return r.objectValues(o);
|
|
664
|
-
}, r.objectValues = (a) => r.objectKeys(a).map(function(s) {
|
|
665
|
-
return a[s];
|
|
666
|
-
}), r.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
|
|
667
|
-
const s = [];
|
|
668
|
-
for (const o in a)
|
|
669
|
-
Object.prototype.hasOwnProperty.call(a, o) && s.push(o);
|
|
670
|
-
return s;
|
|
671
|
-
}, r.find = (a, s) => {
|
|
672
|
-
for (const o of a)
|
|
673
|
-
if (s(o))
|
|
674
|
-
return o;
|
|
675
|
-
}, r.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && isFinite(a) && Math.floor(a) === a;
|
|
676
|
-
function n(a, s = " | ") {
|
|
677
|
-
return a.map((o) => typeof o == "string" ? `'${o}'` : o).join(s);
|
|
678
|
-
}
|
|
679
|
-
r.joinValues = n, r.jsonStringifyReplacer = (a, s) => typeof s == "bigint" ? s.toString() : s;
|
|
680
|
-
})(E || (E = {}));
|
|
681
|
-
var bt;
|
|
682
|
-
(function(r) {
|
|
683
|
-
r.mergeShapes = (e, t) => ({
|
|
684
|
-
...e,
|
|
685
|
-
...t
|
|
686
|
-
// second overwrites first
|
|
687
|
-
});
|
|
688
|
-
})(bt || (bt = {}));
|
|
689
|
-
const m = E.arrayToEnum([
|
|
690
|
-
"string",
|
|
691
|
-
"nan",
|
|
692
|
-
"number",
|
|
693
|
-
"integer",
|
|
694
|
-
"float",
|
|
695
|
-
"boolean",
|
|
696
|
-
"date",
|
|
697
|
-
"bigint",
|
|
698
|
-
"symbol",
|
|
699
|
-
"function",
|
|
700
|
-
"undefined",
|
|
701
|
-
"null",
|
|
702
|
-
"array",
|
|
703
|
-
"object",
|
|
704
|
-
"unknown",
|
|
705
|
-
"promise",
|
|
706
|
-
"void",
|
|
707
|
-
"never",
|
|
708
|
-
"map",
|
|
709
|
-
"set"
|
|
710
|
-
]), te = (r) => {
|
|
711
|
-
switch (typeof r) {
|
|
712
|
-
case "undefined":
|
|
713
|
-
return m.undefined;
|
|
714
|
-
case "string":
|
|
715
|
-
return m.string;
|
|
716
|
-
case "number":
|
|
717
|
-
return isNaN(r) ? m.nan : m.number;
|
|
718
|
-
case "boolean":
|
|
719
|
-
return m.boolean;
|
|
720
|
-
case "function":
|
|
721
|
-
return m.function;
|
|
722
|
-
case "bigint":
|
|
723
|
-
return m.bigint;
|
|
724
|
-
case "symbol":
|
|
725
|
-
return m.symbol;
|
|
726
|
-
case "object":
|
|
727
|
-
return Array.isArray(r) ? m.array : r === null ? m.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? m.promise : typeof Map < "u" && r instanceof Map ? m.map : typeof Set < "u" && r instanceof Set ? m.set : typeof Date < "u" && r instanceof Date ? m.date : m.object;
|
|
728
|
-
default:
|
|
729
|
-
return m.unknown;
|
|
730
|
-
}
|
|
731
|
-
}, d = E.arrayToEnum([
|
|
732
|
-
"invalid_type",
|
|
733
|
-
"invalid_literal",
|
|
734
|
-
"custom",
|
|
735
|
-
"invalid_union",
|
|
736
|
-
"invalid_union_discriminator",
|
|
737
|
-
"invalid_enum_value",
|
|
738
|
-
"unrecognized_keys",
|
|
739
|
-
"invalid_arguments",
|
|
740
|
-
"invalid_return_type",
|
|
741
|
-
"invalid_date",
|
|
742
|
-
"invalid_string",
|
|
743
|
-
"too_small",
|
|
744
|
-
"too_big",
|
|
745
|
-
"invalid_intersection_types",
|
|
746
|
-
"not_multiple_of",
|
|
747
|
-
"not_finite"
|
|
748
|
-
]), Br = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
749
|
-
class M extends Error {
|
|
750
|
-
get errors() {
|
|
751
|
-
return this.issues;
|
|
752
|
-
}
|
|
753
|
-
constructor(e) {
|
|
754
|
-
super(), this.issues = [], this.addIssue = (n) => {
|
|
755
|
-
this.issues = [...this.issues, n];
|
|
756
|
-
}, this.addIssues = (n = []) => {
|
|
757
|
-
this.issues = [...this.issues, ...n];
|
|
758
|
-
};
|
|
759
|
-
const t = new.target.prototype;
|
|
760
|
-
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
761
|
-
}
|
|
762
|
-
format(e) {
|
|
763
|
-
const t = e || function(s) {
|
|
764
|
-
return s.message;
|
|
765
|
-
}, n = { _errors: [] }, a = (s) => {
|
|
766
|
-
for (const o of s.issues)
|
|
767
|
-
if (o.code === "invalid_union")
|
|
768
|
-
o.unionErrors.map(a);
|
|
769
|
-
else if (o.code === "invalid_return_type")
|
|
770
|
-
a(o.returnTypeError);
|
|
771
|
-
else if (o.code === "invalid_arguments")
|
|
772
|
-
a(o.argumentsError);
|
|
773
|
-
else if (o.path.length === 0)
|
|
774
|
-
n._errors.push(t(o));
|
|
775
|
-
else {
|
|
776
|
-
let c = n, l = 0;
|
|
777
|
-
for (; l < o.path.length; ) {
|
|
778
|
-
const f = o.path[l];
|
|
779
|
-
l === o.path.length - 1 ? (c[f] = c[f] || { _errors: [] }, c[f]._errors.push(t(o))) : c[f] = c[f] || { _errors: [] }, c = c[f], l++;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
};
|
|
783
|
-
return a(this), n;
|
|
784
|
-
}
|
|
785
|
-
static assert(e) {
|
|
786
|
-
if (!(e instanceof M))
|
|
787
|
-
throw new Error(`Not a ZodError: ${e}`);
|
|
788
|
-
}
|
|
789
|
-
toString() {
|
|
790
|
-
return this.message;
|
|
791
|
-
}
|
|
792
|
-
get message() {
|
|
793
|
-
return JSON.stringify(this.issues, E.jsonStringifyReplacer, 2);
|
|
794
|
-
}
|
|
795
|
-
get isEmpty() {
|
|
796
|
-
return this.issues.length === 0;
|
|
797
|
-
}
|
|
798
|
-
flatten(e = (t) => t.message) {
|
|
799
|
-
const t = {}, n = [];
|
|
800
|
-
for (const a of this.issues)
|
|
801
|
-
a.path.length > 0 ? (t[a.path[0]] = t[a.path[0]] || [], t[a.path[0]].push(e(a))) : n.push(e(a));
|
|
802
|
-
return { formErrors: n, fieldErrors: t };
|
|
803
|
-
}
|
|
804
|
-
get formErrors() {
|
|
805
|
-
return this.flatten();
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
M.create = (r) => new M(r);
|
|
809
|
-
const be = (r, e) => {
|
|
810
|
-
let t;
|
|
811
|
-
switch (r.code) {
|
|
812
|
-
case d.invalid_type:
|
|
813
|
-
r.received === m.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
814
|
-
break;
|
|
815
|
-
case d.invalid_literal:
|
|
816
|
-
t = `Invalid literal value, expected ${JSON.stringify(r.expected, E.jsonStringifyReplacer)}`;
|
|
817
|
-
break;
|
|
818
|
-
case d.unrecognized_keys:
|
|
819
|
-
t = `Unrecognized key(s) in object: ${E.joinValues(r.keys, ", ")}`;
|
|
820
|
-
break;
|
|
821
|
-
case d.invalid_union:
|
|
822
|
-
t = "Invalid input";
|
|
823
|
-
break;
|
|
824
|
-
case d.invalid_union_discriminator:
|
|
825
|
-
t = `Invalid discriminator value. Expected ${E.joinValues(r.options)}`;
|
|
826
|
-
break;
|
|
827
|
-
case d.invalid_enum_value:
|
|
828
|
-
t = `Invalid enum value. Expected ${E.joinValues(r.options)}, received '${r.received}'`;
|
|
829
|
-
break;
|
|
830
|
-
case d.invalid_arguments:
|
|
831
|
-
t = "Invalid function arguments";
|
|
832
|
-
break;
|
|
833
|
-
case d.invalid_return_type:
|
|
834
|
-
t = "Invalid function return type";
|
|
835
|
-
break;
|
|
836
|
-
case d.invalid_date:
|
|
837
|
-
t = "Invalid date";
|
|
838
|
-
break;
|
|
839
|
-
case d.invalid_string:
|
|
840
|
-
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : E.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
841
|
-
break;
|
|
842
|
-
case d.too_small:
|
|
843
|
-
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
844
|
-
break;
|
|
845
|
-
case d.too_big:
|
|
846
|
-
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
847
|
-
break;
|
|
848
|
-
case d.custom:
|
|
849
|
-
t = "Invalid input";
|
|
850
|
-
break;
|
|
851
|
-
case d.invalid_intersection_types:
|
|
852
|
-
t = "Intersection results could not be merged";
|
|
853
|
-
break;
|
|
854
|
-
case d.not_multiple_of:
|
|
855
|
-
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
856
|
-
break;
|
|
857
|
-
case d.not_finite:
|
|
858
|
-
t = "Number must be finite";
|
|
859
|
-
break;
|
|
860
|
-
default:
|
|
861
|
-
t = e.defaultError, E.assertNever(r);
|
|
862
|
-
}
|
|
863
|
-
return { message: t };
|
|
864
|
-
};
|
|
865
|
-
let sr = be;
|
|
866
|
-
function Yr(r) {
|
|
867
|
-
sr = r;
|
|
868
|
-
}
|
|
869
|
-
function Ke() {
|
|
870
|
-
return sr;
|
|
871
|
-
}
|
|
872
|
-
const Xe = (r) => {
|
|
873
|
-
const { data: e, path: t, errorMaps: n, issueData: a } = r, s = [...t, ...a.path || []], o = {
|
|
874
|
-
...a,
|
|
875
|
-
path: s
|
|
876
|
-
};
|
|
877
|
-
if (a.message !== void 0)
|
|
878
|
-
return {
|
|
879
|
-
...a,
|
|
880
|
-
path: s,
|
|
881
|
-
message: a.message
|
|
882
|
-
};
|
|
883
|
-
let c = "";
|
|
884
|
-
const l = n.filter((f) => !!f).slice().reverse();
|
|
885
|
-
for (const f of l)
|
|
886
|
-
c = f(o, { data: e, defaultError: c }).message;
|
|
887
|
-
return {
|
|
888
|
-
...a,
|
|
889
|
-
path: s,
|
|
890
|
-
message: c
|
|
891
|
-
};
|
|
892
|
-
}, qr = [];
|
|
893
|
-
function h(r, e) {
|
|
894
|
-
const t = Ke(), n = Xe({
|
|
895
|
-
issueData: e,
|
|
896
|
-
data: r.data,
|
|
897
|
-
path: r.path,
|
|
898
|
-
errorMaps: [
|
|
899
|
-
r.common.contextualErrorMap,
|
|
900
|
-
// contextual error map is first priority
|
|
901
|
-
r.schemaErrorMap,
|
|
902
|
-
// then schema-bound map if available
|
|
903
|
-
t,
|
|
904
|
-
// then global override map
|
|
905
|
-
t === be ? void 0 : be
|
|
906
|
-
// then global default map
|
|
907
|
-
].filter((a) => !!a)
|
|
908
|
-
});
|
|
909
|
-
r.common.issues.push(n);
|
|
910
|
-
}
|
|
911
|
-
class I {
|
|
912
|
-
constructor() {
|
|
913
|
-
this.value = "valid";
|
|
914
|
-
}
|
|
915
|
-
dirty() {
|
|
916
|
-
this.value === "valid" && (this.value = "dirty");
|
|
917
|
-
}
|
|
918
|
-
abort() {
|
|
919
|
-
this.value !== "aborted" && (this.value = "aborted");
|
|
920
|
-
}
|
|
921
|
-
static mergeArray(e, t) {
|
|
922
|
-
const n = [];
|
|
923
|
-
for (const a of t) {
|
|
924
|
-
if (a.status === "aborted")
|
|
925
|
-
return _;
|
|
926
|
-
a.status === "dirty" && e.dirty(), n.push(a.value);
|
|
927
|
-
}
|
|
928
|
-
return { status: e.value, value: n };
|
|
929
|
-
}
|
|
930
|
-
static async mergeObjectAsync(e, t) {
|
|
931
|
-
const n = [];
|
|
932
|
-
for (const a of t) {
|
|
933
|
-
const s = await a.key, o = await a.value;
|
|
934
|
-
n.push({
|
|
935
|
-
key: s,
|
|
936
|
-
value: o
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
return I.mergeObjectSync(e, n);
|
|
940
|
-
}
|
|
941
|
-
static mergeObjectSync(e, t) {
|
|
942
|
-
const n = {};
|
|
943
|
-
for (const a of t) {
|
|
944
|
-
const { key: s, value: o } = a;
|
|
945
|
-
if (s.status === "aborted" || o.status === "aborted")
|
|
946
|
-
return _;
|
|
947
|
-
s.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), s.value !== "__proto__" && (typeof o.value < "u" || a.alwaysSet) && (n[s.value] = o.value);
|
|
948
|
-
}
|
|
949
|
-
return { status: e.value, value: n };
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
const _ = Object.freeze({
|
|
953
|
-
status: "aborted"
|
|
954
|
-
}), ge = (r) => ({ status: "dirty", value: r }), $ = (r) => ({ status: "valid", value: r }), xt = (r) => r.status === "aborted", kt = (r) => r.status === "dirty", fe = (r) => r.status === "valid", Ze = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
955
|
-
function Qe(r, e, t, n) {
|
|
956
|
-
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
957
|
-
return e.get(r);
|
|
958
|
-
}
|
|
959
|
-
function ir(r, e, t, n, a) {
|
|
960
|
-
if (typeof e == "function" ? r !== e || !a : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
961
|
-
return e.set(r, t), t;
|
|
962
|
-
}
|
|
963
|
-
var y;
|
|
964
|
-
(function(r) {
|
|
965
|
-
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
966
|
-
})(y || (y = {}));
|
|
967
|
-
var je, Ae;
|
|
968
|
-
class J {
|
|
969
|
-
constructor(e, t, n, a) {
|
|
970
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = a;
|
|
971
|
-
}
|
|
972
|
-
get path() {
|
|
973
|
-
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
const Qt = (r, e) => {
|
|
977
|
-
if (fe(e))
|
|
978
|
-
return { success: !0, data: e.value };
|
|
979
|
-
if (!r.common.issues.length)
|
|
980
|
-
throw new Error("Validation failed but no issues detected.");
|
|
981
|
-
return {
|
|
982
|
-
success: !1,
|
|
983
|
-
get error() {
|
|
984
|
-
if (this._error)
|
|
985
|
-
return this._error;
|
|
986
|
-
const t = new M(r.common.issues);
|
|
987
|
-
return this._error = t, this._error;
|
|
988
|
-
}
|
|
989
|
-
};
|
|
990
|
-
};
|
|
991
|
-
function x(r) {
|
|
992
|
-
if (!r)
|
|
993
|
-
return {};
|
|
994
|
-
const { errorMap: e, invalid_type_error: t, required_error: n, description: a } = r;
|
|
995
|
-
if (e && (t || n))
|
|
996
|
-
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
997
|
-
return e ? { errorMap: e, description: a } : { errorMap: (o, c) => {
|
|
998
|
-
var l, f;
|
|
999
|
-
const { message: v } = r;
|
|
1000
|
-
return o.code === "invalid_enum_value" ? { message: v ?? c.defaultError } : typeof c.data > "u" ? { message: (l = v ?? n) !== null && l !== void 0 ? l : c.defaultError } : o.code !== "invalid_type" ? { message: c.defaultError } : { message: (f = v ?? t) !== null && f !== void 0 ? f : c.defaultError };
|
|
1001
|
-
}, description: a };
|
|
1002
|
-
}
|
|
1003
|
-
class k {
|
|
1004
|
-
get description() {
|
|
1005
|
-
return this._def.description;
|
|
1006
|
-
}
|
|
1007
|
-
_getType(e) {
|
|
1008
|
-
return te(e.data);
|
|
1009
|
-
}
|
|
1010
|
-
_getOrReturnCtx(e, t) {
|
|
1011
|
-
return t || {
|
|
1012
|
-
common: e.parent.common,
|
|
1013
|
-
data: e.data,
|
|
1014
|
-
parsedType: te(e.data),
|
|
1015
|
-
schemaErrorMap: this._def.errorMap,
|
|
1016
|
-
path: e.path,
|
|
1017
|
-
parent: e.parent
|
|
1018
|
-
};
|
|
1019
|
-
}
|
|
1020
|
-
_processInputParams(e) {
|
|
1021
|
-
return {
|
|
1022
|
-
status: new I(),
|
|
1023
|
-
ctx: {
|
|
1024
|
-
common: e.parent.common,
|
|
1025
|
-
data: e.data,
|
|
1026
|
-
parsedType: te(e.data),
|
|
1027
|
-
schemaErrorMap: this._def.errorMap,
|
|
1028
|
-
path: e.path,
|
|
1029
|
-
parent: e.parent
|
|
1030
|
-
}
|
|
1031
|
-
};
|
|
1032
|
-
}
|
|
1033
|
-
_parseSync(e) {
|
|
1034
|
-
const t = this._parse(e);
|
|
1035
|
-
if (Ze(t))
|
|
1036
|
-
throw new Error("Synchronous parse encountered promise.");
|
|
1037
|
-
return t;
|
|
1038
|
-
}
|
|
1039
|
-
_parseAsync(e) {
|
|
1040
|
-
const t = this._parse(e);
|
|
1041
|
-
return Promise.resolve(t);
|
|
1042
|
-
}
|
|
1043
|
-
parse(e, t) {
|
|
1044
|
-
const n = this.safeParse(e, t);
|
|
1045
|
-
if (n.success)
|
|
1046
|
-
return n.data;
|
|
1047
|
-
throw n.error;
|
|
1048
|
-
}
|
|
1049
|
-
safeParse(e, t) {
|
|
1050
|
-
var n;
|
|
1051
|
-
const a = {
|
|
1052
|
-
common: {
|
|
1053
|
-
issues: [],
|
|
1054
|
-
async: (n = t == null ? void 0 : t.async) !== null && n !== void 0 ? n : !1,
|
|
1055
|
-
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
1056
|
-
},
|
|
1057
|
-
path: (t == null ? void 0 : t.path) || [],
|
|
1058
|
-
schemaErrorMap: this._def.errorMap,
|
|
1059
|
-
parent: null,
|
|
1060
|
-
data: e,
|
|
1061
|
-
parsedType: te(e)
|
|
1062
|
-
}, s = this._parseSync({ data: e, path: a.path, parent: a });
|
|
1063
|
-
return Qt(a, s);
|
|
1064
|
-
}
|
|
1065
|
-
"~validate"(e) {
|
|
1066
|
-
var t, n;
|
|
1067
|
-
const a = {
|
|
1068
|
-
common: {
|
|
1069
|
-
issues: [],
|
|
1070
|
-
async: !!this["~standard"].async
|
|
1071
|
-
},
|
|
1072
|
-
path: [],
|
|
1073
|
-
schemaErrorMap: this._def.errorMap,
|
|
1074
|
-
parent: null,
|
|
1075
|
-
data: e,
|
|
1076
|
-
parsedType: te(e)
|
|
1077
|
-
};
|
|
1078
|
-
if (!this["~standard"].async)
|
|
1079
|
-
try {
|
|
1080
|
-
const s = this._parseSync({ data: e, path: [], parent: a });
|
|
1081
|
-
return fe(s) ? {
|
|
1082
|
-
value: s.value
|
|
1083
|
-
} : {
|
|
1084
|
-
issues: a.common.issues
|
|
1085
|
-
};
|
|
1086
|
-
} catch (s) {
|
|
1087
|
-
!((n = (t = s == null ? void 0 : s.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || n === void 0) && n.includes("encountered") && (this["~standard"].async = !0), a.common = {
|
|
1088
|
-
issues: [],
|
|
1089
|
-
async: !0
|
|
1090
|
-
};
|
|
1091
|
-
}
|
|
1092
|
-
return this._parseAsync({ data: e, path: [], parent: a }).then((s) => fe(s) ? {
|
|
1093
|
-
value: s.value
|
|
1094
|
-
} : {
|
|
1095
|
-
issues: a.common.issues
|
|
1096
|
-
});
|
|
1097
|
-
}
|
|
1098
|
-
async parseAsync(e, t) {
|
|
1099
|
-
const n = await this.safeParseAsync(e, t);
|
|
1100
|
-
if (n.success)
|
|
1101
|
-
return n.data;
|
|
1102
|
-
throw n.error;
|
|
1103
|
-
}
|
|
1104
|
-
async safeParseAsync(e, t) {
|
|
1105
|
-
const n = {
|
|
1106
|
-
common: {
|
|
1107
|
-
issues: [],
|
|
1108
|
-
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
1109
|
-
async: !0
|
|
1110
|
-
},
|
|
1111
|
-
path: (t == null ? void 0 : t.path) || [],
|
|
1112
|
-
schemaErrorMap: this._def.errorMap,
|
|
1113
|
-
parent: null,
|
|
1114
|
-
data: e,
|
|
1115
|
-
parsedType: te(e)
|
|
1116
|
-
}, a = this._parse({ data: e, path: n.path, parent: n }), s = await (Ze(a) ? a : Promise.resolve(a));
|
|
1117
|
-
return Qt(n, s);
|
|
1118
|
-
}
|
|
1119
|
-
refine(e, t) {
|
|
1120
|
-
const n = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
|
|
1121
|
-
return this._refinement((a, s) => {
|
|
1122
|
-
const o = e(a), c = () => s.addIssue({
|
|
1123
|
-
code: d.custom,
|
|
1124
|
-
...n(a)
|
|
1125
|
-
});
|
|
1126
|
-
return typeof Promise < "u" && o instanceof Promise ? o.then((l) => l ? !0 : (c(), !1)) : o ? !0 : (c(), !1);
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
refinement(e, t) {
|
|
1130
|
-
return this._refinement((n, a) => e(n) ? !0 : (a.addIssue(typeof t == "function" ? t(n, a) : t), !1));
|
|
1131
|
-
}
|
|
1132
|
-
_refinement(e) {
|
|
1133
|
-
return new W({
|
|
1134
|
-
schema: this,
|
|
1135
|
-
typeName: g.ZodEffects,
|
|
1136
|
-
effect: { type: "refinement", refinement: e }
|
|
1137
|
-
});
|
|
1138
|
-
}
|
|
1139
|
-
superRefine(e) {
|
|
1140
|
-
return this._refinement(e);
|
|
1141
|
-
}
|
|
1142
|
-
constructor(e) {
|
|
1143
|
-
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"] = {
|
|
1144
|
-
version: 1,
|
|
1145
|
-
vendor: "zod",
|
|
1146
|
-
validate: (t) => this["~validate"](t)
|
|
1147
|
-
};
|
|
1148
|
-
}
|
|
1149
|
-
optional() {
|
|
1150
|
-
return q.create(this, this._def);
|
|
1151
|
-
}
|
|
1152
|
-
nullable() {
|
|
1153
|
-
return ce.create(this, this._def);
|
|
1154
|
-
}
|
|
1155
|
-
nullish() {
|
|
1156
|
-
return this.nullable().optional();
|
|
1157
|
-
}
|
|
1158
|
-
array() {
|
|
1159
|
-
return U.create(this);
|
|
1160
|
-
}
|
|
1161
|
-
promise() {
|
|
1162
|
-
return ke.create(this, this._def);
|
|
1163
|
-
}
|
|
1164
|
-
or(e) {
|
|
1165
|
-
return $e.create([this, e], this._def);
|
|
1166
|
-
}
|
|
1167
|
-
and(e) {
|
|
1168
|
-
return De.create(this, e, this._def);
|
|
1169
|
-
}
|
|
1170
|
-
transform(e) {
|
|
1171
|
-
return new W({
|
|
1172
|
-
...x(this._def),
|
|
1173
|
-
schema: this,
|
|
1174
|
-
typeName: g.ZodEffects,
|
|
1175
|
-
effect: { type: "transform", transform: e }
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
default(e) {
|
|
1179
|
-
const t = typeof e == "function" ? e : () => e;
|
|
1180
|
-
return new ze({
|
|
1181
|
-
...x(this._def),
|
|
1182
|
-
innerType: this,
|
|
1183
|
-
defaultValue: t,
|
|
1184
|
-
typeName: g.ZodDefault
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
brand() {
|
|
1188
|
-
return new Tt({
|
|
1189
|
-
typeName: g.ZodBranded,
|
|
1190
|
-
type: this,
|
|
1191
|
-
...x(this._def)
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
catch(e) {
|
|
1195
|
-
const t = typeof e == "function" ? e : () => e;
|
|
1196
|
-
return new Ue({
|
|
1197
|
-
...x(this._def),
|
|
1198
|
-
innerType: this,
|
|
1199
|
-
catchValue: t,
|
|
1200
|
-
typeName: g.ZodCatch
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
describe(e) {
|
|
1204
|
-
const t = this.constructor;
|
|
1205
|
-
return new t({
|
|
1206
|
-
...this._def,
|
|
1207
|
-
description: e
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
pipe(e) {
|
|
1211
|
-
return Be.create(this, e);
|
|
1212
|
-
}
|
|
1213
|
-
readonly() {
|
|
1214
|
-
return We.create(this);
|
|
1215
|
-
}
|
|
1216
|
-
isOptional() {
|
|
1217
|
-
return this.safeParse(void 0).success;
|
|
1218
|
-
}
|
|
1219
|
-
isNullable() {
|
|
1220
|
-
return this.safeParse(null).success;
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
const Jr = /^c[^\s-]{8,}$/i, Gr = /^[0-9a-z]+$/, Hr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Kr = /^[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, Xr = /^[a-z0-9_-]{21}$/i, Qr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, en = /^[-+]?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)?)??$/, tn = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, rn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1224
|
-
let yt;
|
|
1225
|
-
const nn = /^(?:(?: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])$/, an = /^(?:(?: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])$/, sn = /^(([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]))$/, on = /^(([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])$/, cn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, un = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, or = "((\\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])))", dn = new RegExp(`^${or}$`);
|
|
1226
|
-
function cr(r) {
|
|
1227
|
-
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1228
|
-
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1229
|
-
}
|
|
1230
|
-
function ln(r) {
|
|
1231
|
-
return new RegExp(`^${cr(r)}$`);
|
|
1232
|
-
}
|
|
1233
|
-
function ur(r) {
|
|
1234
|
-
let e = `${or}T${cr(r)}`;
|
|
1235
|
-
const t = [];
|
|
1236
|
-
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1237
|
-
}
|
|
1238
|
-
function fn(r, e) {
|
|
1239
|
-
return !!((e === "v4" || !e) && nn.test(r) || (e === "v6" || !e) && sn.test(r));
|
|
1240
|
-
}
|
|
1241
|
-
function hn(r, e) {
|
|
1242
|
-
if (!Qr.test(r))
|
|
1243
|
-
return !1;
|
|
1244
|
-
try {
|
|
1245
|
-
const [t] = r.split("."), n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(n));
|
|
1246
|
-
return !(typeof a != "object" || a === null || !a.typ || !a.alg || e && a.alg !== e);
|
|
1247
|
-
} catch {
|
|
1248
|
-
return !1;
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
function pn(r, e) {
|
|
1252
|
-
return !!((e === "v4" || !e) && an.test(r) || (e === "v6" || !e) && on.test(r));
|
|
1253
|
-
}
|
|
1254
|
-
class z extends k {
|
|
1255
|
-
_parse(e) {
|
|
1256
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== m.string) {
|
|
1257
|
-
const s = this._getOrReturnCtx(e);
|
|
1258
|
-
return h(s, {
|
|
1259
|
-
code: d.invalid_type,
|
|
1260
|
-
expected: m.string,
|
|
1261
|
-
received: s.parsedType
|
|
1262
|
-
}), _;
|
|
1263
|
-
}
|
|
1264
|
-
const n = new I();
|
|
1265
|
-
let a;
|
|
1266
|
-
for (const s of this._def.checks)
|
|
1267
|
-
if (s.kind === "min")
|
|
1268
|
-
e.data.length < s.value && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1269
|
-
code: d.too_small,
|
|
1270
|
-
minimum: s.value,
|
|
1271
|
-
type: "string",
|
|
1272
|
-
inclusive: !0,
|
|
1273
|
-
exact: !1,
|
|
1274
|
-
message: s.message
|
|
1275
|
-
}), n.dirty());
|
|
1276
|
-
else if (s.kind === "max")
|
|
1277
|
-
e.data.length > s.value && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1278
|
-
code: d.too_big,
|
|
1279
|
-
maximum: s.value,
|
|
1280
|
-
type: "string",
|
|
1281
|
-
inclusive: !0,
|
|
1282
|
-
exact: !1,
|
|
1283
|
-
message: s.message
|
|
1284
|
-
}), n.dirty());
|
|
1285
|
-
else if (s.kind === "length") {
|
|
1286
|
-
const o = e.data.length > s.value, c = e.data.length < s.value;
|
|
1287
|
-
(o || c) && (a = this._getOrReturnCtx(e, a), o ? h(a, {
|
|
1288
|
-
code: d.too_big,
|
|
1289
|
-
maximum: s.value,
|
|
1290
|
-
type: "string",
|
|
1291
|
-
inclusive: !0,
|
|
1292
|
-
exact: !0,
|
|
1293
|
-
message: s.message
|
|
1294
|
-
}) : c && h(a, {
|
|
1295
|
-
code: d.too_small,
|
|
1296
|
-
minimum: s.value,
|
|
1297
|
-
type: "string",
|
|
1298
|
-
inclusive: !0,
|
|
1299
|
-
exact: !0,
|
|
1300
|
-
message: s.message
|
|
1301
|
-
}), n.dirty());
|
|
1302
|
-
} else if (s.kind === "email")
|
|
1303
|
-
tn.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1304
|
-
validation: "email",
|
|
1305
|
-
code: d.invalid_string,
|
|
1306
|
-
message: s.message
|
|
1307
|
-
}), n.dirty());
|
|
1308
|
-
else if (s.kind === "emoji")
|
|
1309
|
-
yt || (yt = new RegExp(rn, "u")), yt.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1310
|
-
validation: "emoji",
|
|
1311
|
-
code: d.invalid_string,
|
|
1312
|
-
message: s.message
|
|
1313
|
-
}), n.dirty());
|
|
1314
|
-
else if (s.kind === "uuid")
|
|
1315
|
-
Kr.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1316
|
-
validation: "uuid",
|
|
1317
|
-
code: d.invalid_string,
|
|
1318
|
-
message: s.message
|
|
1319
|
-
}), n.dirty());
|
|
1320
|
-
else if (s.kind === "nanoid")
|
|
1321
|
-
Xr.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1322
|
-
validation: "nanoid",
|
|
1323
|
-
code: d.invalid_string,
|
|
1324
|
-
message: s.message
|
|
1325
|
-
}), n.dirty());
|
|
1326
|
-
else if (s.kind === "cuid")
|
|
1327
|
-
Jr.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1328
|
-
validation: "cuid",
|
|
1329
|
-
code: d.invalid_string,
|
|
1330
|
-
message: s.message
|
|
1331
|
-
}), n.dirty());
|
|
1332
|
-
else if (s.kind === "cuid2")
|
|
1333
|
-
Gr.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1334
|
-
validation: "cuid2",
|
|
1335
|
-
code: d.invalid_string,
|
|
1336
|
-
message: s.message
|
|
1337
|
-
}), n.dirty());
|
|
1338
|
-
else if (s.kind === "ulid")
|
|
1339
|
-
Hr.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1340
|
-
validation: "ulid",
|
|
1341
|
-
code: d.invalid_string,
|
|
1342
|
-
message: s.message
|
|
1343
|
-
}), n.dirty());
|
|
1344
|
-
else if (s.kind === "url")
|
|
1345
|
-
try {
|
|
1346
|
-
new URL(e.data);
|
|
1347
|
-
} catch {
|
|
1348
|
-
a = this._getOrReturnCtx(e, a), h(a, {
|
|
1349
|
-
validation: "url",
|
|
1350
|
-
code: d.invalid_string,
|
|
1351
|
-
message: s.message
|
|
1352
|
-
}), n.dirty();
|
|
1353
|
-
}
|
|
1354
|
-
else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1355
|
-
validation: "regex",
|
|
1356
|
-
code: d.invalid_string,
|
|
1357
|
-
message: s.message
|
|
1358
|
-
}), n.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1359
|
-
code: d.invalid_string,
|
|
1360
|
-
validation: { includes: s.value, position: s.position },
|
|
1361
|
-
message: s.message
|
|
1362
|
-
}), n.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1363
|
-
code: d.invalid_string,
|
|
1364
|
-
validation: { startsWith: s.value },
|
|
1365
|
-
message: s.message
|
|
1366
|
-
}), n.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1367
|
-
code: d.invalid_string,
|
|
1368
|
-
validation: { endsWith: s.value },
|
|
1369
|
-
message: s.message
|
|
1370
|
-
}), n.dirty()) : s.kind === "datetime" ? ur(s).test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1371
|
-
code: d.invalid_string,
|
|
1372
|
-
validation: "datetime",
|
|
1373
|
-
message: s.message
|
|
1374
|
-
}), n.dirty()) : s.kind === "date" ? dn.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1375
|
-
code: d.invalid_string,
|
|
1376
|
-
validation: "date",
|
|
1377
|
-
message: s.message
|
|
1378
|
-
}), n.dirty()) : s.kind === "time" ? ln(s).test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1379
|
-
code: d.invalid_string,
|
|
1380
|
-
validation: "time",
|
|
1381
|
-
message: s.message
|
|
1382
|
-
}), n.dirty()) : s.kind === "duration" ? en.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1383
|
-
validation: "duration",
|
|
1384
|
-
code: d.invalid_string,
|
|
1385
|
-
message: s.message
|
|
1386
|
-
}), n.dirty()) : s.kind === "ip" ? fn(e.data, s.version) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1387
|
-
validation: "ip",
|
|
1388
|
-
code: d.invalid_string,
|
|
1389
|
-
message: s.message
|
|
1390
|
-
}), n.dirty()) : s.kind === "jwt" ? hn(e.data, s.alg) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1391
|
-
validation: "jwt",
|
|
1392
|
-
code: d.invalid_string,
|
|
1393
|
-
message: s.message
|
|
1394
|
-
}), n.dirty()) : s.kind === "cidr" ? pn(e.data, s.version) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1395
|
-
validation: "cidr",
|
|
1396
|
-
code: d.invalid_string,
|
|
1397
|
-
message: s.message
|
|
1398
|
-
}), n.dirty()) : s.kind === "base64" ? cn.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1399
|
-
validation: "base64",
|
|
1400
|
-
code: d.invalid_string,
|
|
1401
|
-
message: s.message
|
|
1402
|
-
}), n.dirty()) : s.kind === "base64url" ? un.test(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1403
|
-
validation: "base64url",
|
|
1404
|
-
code: d.invalid_string,
|
|
1405
|
-
message: s.message
|
|
1406
|
-
}), n.dirty()) : E.assertNever(s);
|
|
1407
|
-
return { status: n.value, value: e.data };
|
|
1408
|
-
}
|
|
1409
|
-
_regex(e, t, n) {
|
|
1410
|
-
return this.refinement((a) => e.test(a), {
|
|
1411
|
-
validation: t,
|
|
1412
|
-
code: d.invalid_string,
|
|
1413
|
-
...y.errToObj(n)
|
|
1414
|
-
});
|
|
1415
|
-
}
|
|
1416
|
-
_addCheck(e) {
|
|
1417
|
-
return new z({
|
|
1418
|
-
...this._def,
|
|
1419
|
-
checks: [...this._def.checks, e]
|
|
1420
|
-
});
|
|
1421
|
-
}
|
|
1422
|
-
email(e) {
|
|
1423
|
-
return this._addCheck({ kind: "email", ...y.errToObj(e) });
|
|
1424
|
-
}
|
|
1425
|
-
url(e) {
|
|
1426
|
-
return this._addCheck({ kind: "url", ...y.errToObj(e) });
|
|
1427
|
-
}
|
|
1428
|
-
emoji(e) {
|
|
1429
|
-
return this._addCheck({ kind: "emoji", ...y.errToObj(e) });
|
|
1430
|
-
}
|
|
1431
|
-
uuid(e) {
|
|
1432
|
-
return this._addCheck({ kind: "uuid", ...y.errToObj(e) });
|
|
1433
|
-
}
|
|
1434
|
-
nanoid(e) {
|
|
1435
|
-
return this._addCheck({ kind: "nanoid", ...y.errToObj(e) });
|
|
1436
|
-
}
|
|
1437
|
-
cuid(e) {
|
|
1438
|
-
return this._addCheck({ kind: "cuid", ...y.errToObj(e) });
|
|
1439
|
-
}
|
|
1440
|
-
cuid2(e) {
|
|
1441
|
-
return this._addCheck({ kind: "cuid2", ...y.errToObj(e) });
|
|
1442
|
-
}
|
|
1443
|
-
ulid(e) {
|
|
1444
|
-
return this._addCheck({ kind: "ulid", ...y.errToObj(e) });
|
|
1445
|
-
}
|
|
1446
|
-
base64(e) {
|
|
1447
|
-
return this._addCheck({ kind: "base64", ...y.errToObj(e) });
|
|
1448
|
-
}
|
|
1449
|
-
base64url(e) {
|
|
1450
|
-
return this._addCheck({
|
|
1451
|
-
kind: "base64url",
|
|
1452
|
-
...y.errToObj(e)
|
|
1453
|
-
});
|
|
1454
|
-
}
|
|
1455
|
-
jwt(e) {
|
|
1456
|
-
return this._addCheck({ kind: "jwt", ...y.errToObj(e) });
|
|
1457
|
-
}
|
|
1458
|
-
ip(e) {
|
|
1459
|
-
return this._addCheck({ kind: "ip", ...y.errToObj(e) });
|
|
1460
|
-
}
|
|
1461
|
-
cidr(e) {
|
|
1462
|
-
return this._addCheck({ kind: "cidr", ...y.errToObj(e) });
|
|
1463
|
-
}
|
|
1464
|
-
datetime(e) {
|
|
1465
|
-
var t, n;
|
|
1466
|
-
return typeof e == "string" ? this._addCheck({
|
|
1467
|
-
kind: "datetime",
|
|
1468
|
-
precision: null,
|
|
1469
|
-
offset: !1,
|
|
1470
|
-
local: !1,
|
|
1471
|
-
message: e
|
|
1472
|
-
}) : this._addCheck({
|
|
1473
|
-
kind: "datetime",
|
|
1474
|
-
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
1475
|
-
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
1476
|
-
local: (n = e == null ? void 0 : e.local) !== null && n !== void 0 ? n : !1,
|
|
1477
|
-
...y.errToObj(e == null ? void 0 : e.message)
|
|
1478
|
-
});
|
|
1479
|
-
}
|
|
1480
|
-
date(e) {
|
|
1481
|
-
return this._addCheck({ kind: "date", message: e });
|
|
1482
|
-
}
|
|
1483
|
-
time(e) {
|
|
1484
|
-
return typeof e == "string" ? this._addCheck({
|
|
1485
|
-
kind: "time",
|
|
1486
|
-
precision: null,
|
|
1487
|
-
message: e
|
|
1488
|
-
}) : this._addCheck({
|
|
1489
|
-
kind: "time",
|
|
1490
|
-
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
1491
|
-
...y.errToObj(e == null ? void 0 : e.message)
|
|
1492
|
-
});
|
|
1493
|
-
}
|
|
1494
|
-
duration(e) {
|
|
1495
|
-
return this._addCheck({ kind: "duration", ...y.errToObj(e) });
|
|
1496
|
-
}
|
|
1497
|
-
regex(e, t) {
|
|
1498
|
-
return this._addCheck({
|
|
1499
|
-
kind: "regex",
|
|
1500
|
-
regex: e,
|
|
1501
|
-
...y.errToObj(t)
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
includes(e, t) {
|
|
1505
|
-
return this._addCheck({
|
|
1506
|
-
kind: "includes",
|
|
1507
|
-
value: e,
|
|
1508
|
-
position: t == null ? void 0 : t.position,
|
|
1509
|
-
...y.errToObj(t == null ? void 0 : t.message)
|
|
1510
|
-
});
|
|
1511
|
-
}
|
|
1512
|
-
startsWith(e, t) {
|
|
1513
|
-
return this._addCheck({
|
|
1514
|
-
kind: "startsWith",
|
|
1515
|
-
value: e,
|
|
1516
|
-
...y.errToObj(t)
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
endsWith(e, t) {
|
|
1520
|
-
return this._addCheck({
|
|
1521
|
-
kind: "endsWith",
|
|
1522
|
-
value: e,
|
|
1523
|
-
...y.errToObj(t)
|
|
1524
|
-
});
|
|
1525
|
-
}
|
|
1526
|
-
min(e, t) {
|
|
1527
|
-
return this._addCheck({
|
|
1528
|
-
kind: "min",
|
|
1529
|
-
value: e,
|
|
1530
|
-
...y.errToObj(t)
|
|
1531
|
-
});
|
|
1532
|
-
}
|
|
1533
|
-
max(e, t) {
|
|
1534
|
-
return this._addCheck({
|
|
1535
|
-
kind: "max",
|
|
1536
|
-
value: e,
|
|
1537
|
-
...y.errToObj(t)
|
|
1538
|
-
});
|
|
1539
|
-
}
|
|
1540
|
-
length(e, t) {
|
|
1541
|
-
return this._addCheck({
|
|
1542
|
-
kind: "length",
|
|
1543
|
-
value: e,
|
|
1544
|
-
...y.errToObj(t)
|
|
1545
|
-
});
|
|
1546
|
-
}
|
|
1547
|
-
/**
|
|
1548
|
-
* Equivalent to `.min(1)`
|
|
1549
|
-
*/
|
|
1550
|
-
nonempty(e) {
|
|
1551
|
-
return this.min(1, y.errToObj(e));
|
|
1552
|
-
}
|
|
1553
|
-
trim() {
|
|
1554
|
-
return new z({
|
|
1555
|
-
...this._def,
|
|
1556
|
-
checks: [...this._def.checks, { kind: "trim" }]
|
|
1557
|
-
});
|
|
1558
|
-
}
|
|
1559
|
-
toLowerCase() {
|
|
1560
|
-
return new z({
|
|
1561
|
-
...this._def,
|
|
1562
|
-
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1563
|
-
});
|
|
1564
|
-
}
|
|
1565
|
-
toUpperCase() {
|
|
1566
|
-
return new z({
|
|
1567
|
-
...this._def,
|
|
1568
|
-
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1569
|
-
});
|
|
1570
|
-
}
|
|
1571
|
-
get isDatetime() {
|
|
1572
|
-
return !!this._def.checks.find((e) => e.kind === "datetime");
|
|
1573
|
-
}
|
|
1574
|
-
get isDate() {
|
|
1575
|
-
return !!this._def.checks.find((e) => e.kind === "date");
|
|
1576
|
-
}
|
|
1577
|
-
get isTime() {
|
|
1578
|
-
return !!this._def.checks.find((e) => e.kind === "time");
|
|
1579
|
-
}
|
|
1580
|
-
get isDuration() {
|
|
1581
|
-
return !!this._def.checks.find((e) => e.kind === "duration");
|
|
1582
|
-
}
|
|
1583
|
-
get isEmail() {
|
|
1584
|
-
return !!this._def.checks.find((e) => e.kind === "email");
|
|
1585
|
-
}
|
|
1586
|
-
get isURL() {
|
|
1587
|
-
return !!this._def.checks.find((e) => e.kind === "url");
|
|
1588
|
-
}
|
|
1589
|
-
get isEmoji() {
|
|
1590
|
-
return !!this._def.checks.find((e) => e.kind === "emoji");
|
|
1591
|
-
}
|
|
1592
|
-
get isUUID() {
|
|
1593
|
-
return !!this._def.checks.find((e) => e.kind === "uuid");
|
|
1594
|
-
}
|
|
1595
|
-
get isNANOID() {
|
|
1596
|
-
return !!this._def.checks.find((e) => e.kind === "nanoid");
|
|
1597
|
-
}
|
|
1598
|
-
get isCUID() {
|
|
1599
|
-
return !!this._def.checks.find((e) => e.kind === "cuid");
|
|
1600
|
-
}
|
|
1601
|
-
get isCUID2() {
|
|
1602
|
-
return !!this._def.checks.find((e) => e.kind === "cuid2");
|
|
1603
|
-
}
|
|
1604
|
-
get isULID() {
|
|
1605
|
-
return !!this._def.checks.find((e) => e.kind === "ulid");
|
|
1606
|
-
}
|
|
1607
|
-
get isIP() {
|
|
1608
|
-
return !!this._def.checks.find((e) => e.kind === "ip");
|
|
1609
|
-
}
|
|
1610
|
-
get isCIDR() {
|
|
1611
|
-
return !!this._def.checks.find((e) => e.kind === "cidr");
|
|
1612
|
-
}
|
|
1613
|
-
get isBase64() {
|
|
1614
|
-
return !!this._def.checks.find((e) => e.kind === "base64");
|
|
1615
|
-
}
|
|
1616
|
-
get isBase64url() {
|
|
1617
|
-
return !!this._def.checks.find((e) => e.kind === "base64url");
|
|
1618
|
-
}
|
|
1619
|
-
get minLength() {
|
|
1620
|
-
let e = null;
|
|
1621
|
-
for (const t of this._def.checks)
|
|
1622
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1623
|
-
return e;
|
|
1624
|
-
}
|
|
1625
|
-
get maxLength() {
|
|
1626
|
-
let e = null;
|
|
1627
|
-
for (const t of this._def.checks)
|
|
1628
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1629
|
-
return e;
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
z.create = (r) => {
|
|
1633
|
-
var e;
|
|
1634
|
-
return new z({
|
|
1635
|
-
checks: [],
|
|
1636
|
-
typeName: g.ZodString,
|
|
1637
|
-
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1638
|
-
...x(r)
|
|
1639
|
-
});
|
|
1640
|
-
};
|
|
1641
|
-
function mn(r, e) {
|
|
1642
|
-
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, a = t > n ? t : n, s = parseInt(r.toFixed(a).replace(".", "")), o = parseInt(e.toFixed(a).replace(".", ""));
|
|
1643
|
-
return s % o / Math.pow(10, a);
|
|
1644
|
-
}
|
|
1645
|
-
class se extends k {
|
|
1646
|
-
constructor() {
|
|
1647
|
-
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1648
|
-
}
|
|
1649
|
-
_parse(e) {
|
|
1650
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== m.number) {
|
|
1651
|
-
const s = this._getOrReturnCtx(e);
|
|
1652
|
-
return h(s, {
|
|
1653
|
-
code: d.invalid_type,
|
|
1654
|
-
expected: m.number,
|
|
1655
|
-
received: s.parsedType
|
|
1656
|
-
}), _;
|
|
1657
|
-
}
|
|
1658
|
-
let n;
|
|
1659
|
-
const a = new I();
|
|
1660
|
-
for (const s of this._def.checks)
|
|
1661
|
-
s.kind === "int" ? E.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1662
|
-
code: d.invalid_type,
|
|
1663
|
-
expected: "integer",
|
|
1664
|
-
received: "float",
|
|
1665
|
-
message: s.message
|
|
1666
|
-
}), a.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1667
|
-
code: d.too_small,
|
|
1668
|
-
minimum: s.value,
|
|
1669
|
-
type: "number",
|
|
1670
|
-
inclusive: s.inclusive,
|
|
1671
|
-
exact: !1,
|
|
1672
|
-
message: s.message
|
|
1673
|
-
}), a.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1674
|
-
code: d.too_big,
|
|
1675
|
-
maximum: s.value,
|
|
1676
|
-
type: "number",
|
|
1677
|
-
inclusive: s.inclusive,
|
|
1678
|
-
exact: !1,
|
|
1679
|
-
message: s.message
|
|
1680
|
-
}), a.dirty()) : s.kind === "multipleOf" ? mn(e.data, s.value) !== 0 && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1681
|
-
code: d.not_multiple_of,
|
|
1682
|
-
multipleOf: s.value,
|
|
1683
|
-
message: s.message
|
|
1684
|
-
}), a.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1685
|
-
code: d.not_finite,
|
|
1686
|
-
message: s.message
|
|
1687
|
-
}), a.dirty()) : E.assertNever(s);
|
|
1688
|
-
return { status: a.value, value: e.data };
|
|
1689
|
-
}
|
|
1690
|
-
gte(e, t) {
|
|
1691
|
-
return this.setLimit("min", e, !0, y.toString(t));
|
|
1692
|
-
}
|
|
1693
|
-
gt(e, t) {
|
|
1694
|
-
return this.setLimit("min", e, !1, y.toString(t));
|
|
1695
|
-
}
|
|
1696
|
-
lte(e, t) {
|
|
1697
|
-
return this.setLimit("max", e, !0, y.toString(t));
|
|
1698
|
-
}
|
|
1699
|
-
lt(e, t) {
|
|
1700
|
-
return this.setLimit("max", e, !1, y.toString(t));
|
|
1701
|
-
}
|
|
1702
|
-
setLimit(e, t, n, a) {
|
|
1703
|
-
return new se({
|
|
1704
|
-
...this._def,
|
|
1705
|
-
checks: [
|
|
1706
|
-
...this._def.checks,
|
|
1707
|
-
{
|
|
1708
|
-
kind: e,
|
|
1709
|
-
value: t,
|
|
1710
|
-
inclusive: n,
|
|
1711
|
-
message: y.toString(a)
|
|
1712
|
-
}
|
|
1713
|
-
]
|
|
1714
|
-
});
|
|
1715
|
-
}
|
|
1716
|
-
_addCheck(e) {
|
|
1717
|
-
return new se({
|
|
1718
|
-
...this._def,
|
|
1719
|
-
checks: [...this._def.checks, e]
|
|
1720
|
-
});
|
|
1721
|
-
}
|
|
1722
|
-
int(e) {
|
|
1723
|
-
return this._addCheck({
|
|
1724
|
-
kind: "int",
|
|
1725
|
-
message: y.toString(e)
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
positive(e) {
|
|
1729
|
-
return this._addCheck({
|
|
1730
|
-
kind: "min",
|
|
1731
|
-
value: 0,
|
|
1732
|
-
inclusive: !1,
|
|
1733
|
-
message: y.toString(e)
|
|
1734
|
-
});
|
|
1735
|
-
}
|
|
1736
|
-
negative(e) {
|
|
1737
|
-
return this._addCheck({
|
|
1738
|
-
kind: "max",
|
|
1739
|
-
value: 0,
|
|
1740
|
-
inclusive: !1,
|
|
1741
|
-
message: y.toString(e)
|
|
1742
|
-
});
|
|
1743
|
-
}
|
|
1744
|
-
nonpositive(e) {
|
|
1745
|
-
return this._addCheck({
|
|
1746
|
-
kind: "max",
|
|
1747
|
-
value: 0,
|
|
1748
|
-
inclusive: !0,
|
|
1749
|
-
message: y.toString(e)
|
|
1750
|
-
});
|
|
1751
|
-
}
|
|
1752
|
-
nonnegative(e) {
|
|
1753
|
-
return this._addCheck({
|
|
1754
|
-
kind: "min",
|
|
1755
|
-
value: 0,
|
|
1756
|
-
inclusive: !0,
|
|
1757
|
-
message: y.toString(e)
|
|
1758
|
-
});
|
|
1759
|
-
}
|
|
1760
|
-
multipleOf(e, t) {
|
|
1761
|
-
return this._addCheck({
|
|
1762
|
-
kind: "multipleOf",
|
|
1763
|
-
value: e,
|
|
1764
|
-
message: y.toString(t)
|
|
1765
|
-
});
|
|
1766
|
-
}
|
|
1767
|
-
finite(e) {
|
|
1768
|
-
return this._addCheck({
|
|
1769
|
-
kind: "finite",
|
|
1770
|
-
message: y.toString(e)
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1773
|
-
safe(e) {
|
|
1774
|
-
return this._addCheck({
|
|
1775
|
-
kind: "min",
|
|
1776
|
-
inclusive: !0,
|
|
1777
|
-
value: Number.MIN_SAFE_INTEGER,
|
|
1778
|
-
message: y.toString(e)
|
|
1779
|
-
})._addCheck({
|
|
1780
|
-
kind: "max",
|
|
1781
|
-
inclusive: !0,
|
|
1782
|
-
value: Number.MAX_SAFE_INTEGER,
|
|
1783
|
-
message: y.toString(e)
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
|
-
get minValue() {
|
|
1787
|
-
let e = null;
|
|
1788
|
-
for (const t of this._def.checks)
|
|
1789
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1790
|
-
return e;
|
|
1791
|
-
}
|
|
1792
|
-
get maxValue() {
|
|
1793
|
-
let e = null;
|
|
1794
|
-
for (const t of this._def.checks)
|
|
1795
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1796
|
-
return e;
|
|
1797
|
-
}
|
|
1798
|
-
get isInt() {
|
|
1799
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && E.isInteger(e.value));
|
|
1800
|
-
}
|
|
1801
|
-
get isFinite() {
|
|
1802
|
-
let e = null, t = null;
|
|
1803
|
-
for (const n of this._def.checks) {
|
|
1804
|
-
if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
|
|
1805
|
-
return !0;
|
|
1806
|
-
n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
|
|
1807
|
-
}
|
|
1808
|
-
return Number.isFinite(t) && Number.isFinite(e);
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
se.create = (r) => new se({
|
|
1812
|
-
checks: [],
|
|
1813
|
-
typeName: g.ZodNumber,
|
|
1814
|
-
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1815
|
-
...x(r)
|
|
1816
|
-
});
|
|
1817
|
-
class ie extends k {
|
|
1818
|
-
constructor() {
|
|
1819
|
-
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1820
|
-
}
|
|
1821
|
-
_parse(e) {
|
|
1822
|
-
if (this._def.coerce)
|
|
1823
|
-
try {
|
|
1824
|
-
e.data = BigInt(e.data);
|
|
1825
|
-
} catch {
|
|
1826
|
-
return this._getInvalidInput(e);
|
|
1827
|
-
}
|
|
1828
|
-
if (this._getType(e) !== m.bigint)
|
|
1829
|
-
return this._getInvalidInput(e);
|
|
1830
|
-
let n;
|
|
1831
|
-
const a = new I();
|
|
1832
|
-
for (const s of this._def.checks)
|
|
1833
|
-
s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1834
|
-
code: d.too_small,
|
|
1835
|
-
type: "bigint",
|
|
1836
|
-
minimum: s.value,
|
|
1837
|
-
inclusive: s.inclusive,
|
|
1838
|
-
message: s.message
|
|
1839
|
-
}), a.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1840
|
-
code: d.too_big,
|
|
1841
|
-
type: "bigint",
|
|
1842
|
-
maximum: s.value,
|
|
1843
|
-
inclusive: s.inclusive,
|
|
1844
|
-
message: s.message
|
|
1845
|
-
}), a.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1846
|
-
code: d.not_multiple_of,
|
|
1847
|
-
multipleOf: s.value,
|
|
1848
|
-
message: s.message
|
|
1849
|
-
}), a.dirty()) : E.assertNever(s);
|
|
1850
|
-
return { status: a.value, value: e.data };
|
|
1851
|
-
}
|
|
1852
|
-
_getInvalidInput(e) {
|
|
1853
|
-
const t = this._getOrReturnCtx(e);
|
|
1854
|
-
return h(t, {
|
|
1855
|
-
code: d.invalid_type,
|
|
1856
|
-
expected: m.bigint,
|
|
1857
|
-
received: t.parsedType
|
|
1858
|
-
}), _;
|
|
1859
|
-
}
|
|
1860
|
-
gte(e, t) {
|
|
1861
|
-
return this.setLimit("min", e, !0, y.toString(t));
|
|
1862
|
-
}
|
|
1863
|
-
gt(e, t) {
|
|
1864
|
-
return this.setLimit("min", e, !1, y.toString(t));
|
|
1865
|
-
}
|
|
1866
|
-
lte(e, t) {
|
|
1867
|
-
return this.setLimit("max", e, !0, y.toString(t));
|
|
1868
|
-
}
|
|
1869
|
-
lt(e, t) {
|
|
1870
|
-
return this.setLimit("max", e, !1, y.toString(t));
|
|
1871
|
-
}
|
|
1872
|
-
setLimit(e, t, n, a) {
|
|
1873
|
-
return new ie({
|
|
1874
|
-
...this._def,
|
|
1875
|
-
checks: [
|
|
1876
|
-
...this._def.checks,
|
|
1877
|
-
{
|
|
1878
|
-
kind: e,
|
|
1879
|
-
value: t,
|
|
1880
|
-
inclusive: n,
|
|
1881
|
-
message: y.toString(a)
|
|
1882
|
-
}
|
|
1883
|
-
]
|
|
1884
|
-
});
|
|
1885
|
-
}
|
|
1886
|
-
_addCheck(e) {
|
|
1887
|
-
return new ie({
|
|
1888
|
-
...this._def,
|
|
1889
|
-
checks: [...this._def.checks, e]
|
|
1890
|
-
});
|
|
1891
|
-
}
|
|
1892
|
-
positive(e) {
|
|
1893
|
-
return this._addCheck({
|
|
1894
|
-
kind: "min",
|
|
1895
|
-
value: BigInt(0),
|
|
1896
|
-
inclusive: !1,
|
|
1897
|
-
message: y.toString(e)
|
|
1898
|
-
});
|
|
1899
|
-
}
|
|
1900
|
-
negative(e) {
|
|
1901
|
-
return this._addCheck({
|
|
1902
|
-
kind: "max",
|
|
1903
|
-
value: BigInt(0),
|
|
1904
|
-
inclusive: !1,
|
|
1905
|
-
message: y.toString(e)
|
|
1906
|
-
});
|
|
1907
|
-
}
|
|
1908
|
-
nonpositive(e) {
|
|
1909
|
-
return this._addCheck({
|
|
1910
|
-
kind: "max",
|
|
1911
|
-
value: BigInt(0),
|
|
1912
|
-
inclusive: !0,
|
|
1913
|
-
message: y.toString(e)
|
|
1914
|
-
});
|
|
1915
|
-
}
|
|
1916
|
-
nonnegative(e) {
|
|
1917
|
-
return this._addCheck({
|
|
1918
|
-
kind: "min",
|
|
1919
|
-
value: BigInt(0),
|
|
1920
|
-
inclusive: !0,
|
|
1921
|
-
message: y.toString(e)
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
multipleOf(e, t) {
|
|
1925
|
-
return this._addCheck({
|
|
1926
|
-
kind: "multipleOf",
|
|
1927
|
-
value: e,
|
|
1928
|
-
message: y.toString(t)
|
|
1929
|
-
});
|
|
1930
|
-
}
|
|
1931
|
-
get minValue() {
|
|
1932
|
-
let e = null;
|
|
1933
|
-
for (const t of this._def.checks)
|
|
1934
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1935
|
-
return e;
|
|
1936
|
-
}
|
|
1937
|
-
get maxValue() {
|
|
1938
|
-
let e = null;
|
|
1939
|
-
for (const t of this._def.checks)
|
|
1940
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1941
|
-
return e;
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
ie.create = (r) => {
|
|
1945
|
-
var e;
|
|
1946
|
-
return new ie({
|
|
1947
|
-
checks: [],
|
|
1948
|
-
typeName: g.ZodBigInt,
|
|
1949
|
-
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1950
|
-
...x(r)
|
|
1951
|
-
});
|
|
1952
|
-
};
|
|
1953
|
-
class Ne extends k {
|
|
1954
|
-
_parse(e) {
|
|
1955
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
|
|
1956
|
-
const n = this._getOrReturnCtx(e);
|
|
1957
|
-
return h(n, {
|
|
1958
|
-
code: d.invalid_type,
|
|
1959
|
-
expected: m.boolean,
|
|
1960
|
-
received: n.parsedType
|
|
1961
|
-
}), _;
|
|
1962
|
-
}
|
|
1963
|
-
return $(e.data);
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
Ne.create = (r) => new Ne({
|
|
1967
|
-
typeName: g.ZodBoolean,
|
|
1968
|
-
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1969
|
-
...x(r)
|
|
1970
|
-
});
|
|
1971
|
-
class he extends k {
|
|
1972
|
-
_parse(e) {
|
|
1973
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== m.date) {
|
|
1974
|
-
const s = this._getOrReturnCtx(e);
|
|
1975
|
-
return h(s, {
|
|
1976
|
-
code: d.invalid_type,
|
|
1977
|
-
expected: m.date,
|
|
1978
|
-
received: s.parsedType
|
|
1979
|
-
}), _;
|
|
1980
|
-
}
|
|
1981
|
-
if (isNaN(e.data.getTime())) {
|
|
1982
|
-
const s = this._getOrReturnCtx(e);
|
|
1983
|
-
return h(s, {
|
|
1984
|
-
code: d.invalid_date
|
|
1985
|
-
}), _;
|
|
1986
|
-
}
|
|
1987
|
-
const n = new I();
|
|
1988
|
-
let a;
|
|
1989
|
-
for (const s of this._def.checks)
|
|
1990
|
-
s.kind === "min" ? e.data.getTime() < s.value && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1991
|
-
code: d.too_small,
|
|
1992
|
-
message: s.message,
|
|
1993
|
-
inclusive: !0,
|
|
1994
|
-
exact: !1,
|
|
1995
|
-
minimum: s.value,
|
|
1996
|
-
type: "date"
|
|
1997
|
-
}), n.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1998
|
-
code: d.too_big,
|
|
1999
|
-
message: s.message,
|
|
2000
|
-
inclusive: !0,
|
|
2001
|
-
exact: !1,
|
|
2002
|
-
maximum: s.value,
|
|
2003
|
-
type: "date"
|
|
2004
|
-
}), n.dirty()) : E.assertNever(s);
|
|
2005
|
-
return {
|
|
2006
|
-
status: n.value,
|
|
2007
|
-
value: new Date(e.data.getTime())
|
|
2008
|
-
};
|
|
2009
|
-
}
|
|
2010
|
-
_addCheck(e) {
|
|
2011
|
-
return new he({
|
|
2012
|
-
...this._def,
|
|
2013
|
-
checks: [...this._def.checks, e]
|
|
2014
|
-
});
|
|
2015
|
-
}
|
|
2016
|
-
min(e, t) {
|
|
2017
|
-
return this._addCheck({
|
|
2018
|
-
kind: "min",
|
|
2019
|
-
value: e.getTime(),
|
|
2020
|
-
message: y.toString(t)
|
|
2021
|
-
});
|
|
2022
|
-
}
|
|
2023
|
-
max(e, t) {
|
|
2024
|
-
return this._addCheck({
|
|
2025
|
-
kind: "max",
|
|
2026
|
-
value: e.getTime(),
|
|
2027
|
-
message: y.toString(t)
|
|
2028
|
-
});
|
|
2029
|
-
}
|
|
2030
|
-
get minDate() {
|
|
2031
|
-
let e = null;
|
|
2032
|
-
for (const t of this._def.checks)
|
|
2033
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
2034
|
-
return e != null ? new Date(e) : null;
|
|
2035
|
-
}
|
|
2036
|
-
get maxDate() {
|
|
2037
|
-
let e = null;
|
|
2038
|
-
for (const t of this._def.checks)
|
|
2039
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
2040
|
-
return e != null ? new Date(e) : null;
|
|
2041
|
-
}
|
|
2042
|
-
}
|
|
2043
|
-
he.create = (r) => new he({
|
|
2044
|
-
checks: [],
|
|
2045
|
-
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
2046
|
-
typeName: g.ZodDate,
|
|
2047
|
-
...x(r)
|
|
2048
|
-
});
|
|
2049
|
-
class et extends k {
|
|
2050
|
-
_parse(e) {
|
|
2051
|
-
if (this._getType(e) !== m.symbol) {
|
|
2052
|
-
const n = this._getOrReturnCtx(e);
|
|
2053
|
-
return h(n, {
|
|
2054
|
-
code: d.invalid_type,
|
|
2055
|
-
expected: m.symbol,
|
|
2056
|
-
received: n.parsedType
|
|
2057
|
-
}), _;
|
|
2058
|
-
}
|
|
2059
|
-
return $(e.data);
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
et.create = (r) => new et({
|
|
2063
|
-
typeName: g.ZodSymbol,
|
|
2064
|
-
...x(r)
|
|
2065
|
-
});
|
|
2066
|
-
class Ie extends k {
|
|
2067
|
-
_parse(e) {
|
|
2068
|
-
if (this._getType(e) !== m.undefined) {
|
|
2069
|
-
const n = this._getOrReturnCtx(e);
|
|
2070
|
-
return h(n, {
|
|
2071
|
-
code: d.invalid_type,
|
|
2072
|
-
expected: m.undefined,
|
|
2073
|
-
received: n.parsedType
|
|
2074
|
-
}), _;
|
|
2075
|
-
}
|
|
2076
|
-
return $(e.data);
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
Ie.create = (r) => new Ie({
|
|
2080
|
-
typeName: g.ZodUndefined,
|
|
2081
|
-
...x(r)
|
|
2082
|
-
});
|
|
2083
|
-
class Pe extends k {
|
|
2084
|
-
_parse(e) {
|
|
2085
|
-
if (this._getType(e) !== m.null) {
|
|
2086
|
-
const n = this._getOrReturnCtx(e);
|
|
2087
|
-
return h(n, {
|
|
2088
|
-
code: d.invalid_type,
|
|
2089
|
-
expected: m.null,
|
|
2090
|
-
received: n.parsedType
|
|
2091
|
-
}), _;
|
|
2092
|
-
}
|
|
2093
|
-
return $(e.data);
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
Pe.create = (r) => new Pe({
|
|
2097
|
-
typeName: g.ZodNull,
|
|
2098
|
-
...x(r)
|
|
2099
|
-
});
|
|
2100
|
-
class xe extends k {
|
|
2101
|
-
constructor() {
|
|
2102
|
-
super(...arguments), this._any = !0;
|
|
2103
|
-
}
|
|
2104
|
-
_parse(e) {
|
|
2105
|
-
return $(e.data);
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
xe.create = (r) => new xe({
|
|
2109
|
-
typeName: g.ZodAny,
|
|
2110
|
-
...x(r)
|
|
2111
|
-
});
|
|
2112
|
-
class le extends k {
|
|
2113
|
-
constructor() {
|
|
2114
|
-
super(...arguments), this._unknown = !0;
|
|
2115
|
-
}
|
|
2116
|
-
_parse(e) {
|
|
2117
|
-
return $(e.data);
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
le.create = (r) => new le({
|
|
2121
|
-
typeName: g.ZodUnknown,
|
|
2122
|
-
...x(r)
|
|
2123
|
-
});
|
|
2124
|
-
class re extends k {
|
|
2125
|
-
_parse(e) {
|
|
2126
|
-
const t = this._getOrReturnCtx(e);
|
|
2127
|
-
return h(t, {
|
|
2128
|
-
code: d.invalid_type,
|
|
2129
|
-
expected: m.never,
|
|
2130
|
-
received: t.parsedType
|
|
2131
|
-
}), _;
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
re.create = (r) => new re({
|
|
2135
|
-
typeName: g.ZodNever,
|
|
2136
|
-
...x(r)
|
|
2137
|
-
});
|
|
2138
|
-
class tt extends k {
|
|
2139
|
-
_parse(e) {
|
|
2140
|
-
if (this._getType(e) !== m.undefined) {
|
|
2141
|
-
const n = this._getOrReturnCtx(e);
|
|
2142
|
-
return h(n, {
|
|
2143
|
-
code: d.invalid_type,
|
|
2144
|
-
expected: m.void,
|
|
2145
|
-
received: n.parsedType
|
|
2146
|
-
}), _;
|
|
2147
|
-
}
|
|
2148
|
-
return $(e.data);
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
tt.create = (r) => new tt({
|
|
2152
|
-
typeName: g.ZodVoid,
|
|
2153
|
-
...x(r)
|
|
2154
|
-
});
|
|
2155
|
-
class U extends k {
|
|
2156
|
-
_parse(e) {
|
|
2157
|
-
const { ctx: t, status: n } = this._processInputParams(e), a = this._def;
|
|
2158
|
-
if (t.parsedType !== m.array)
|
|
2159
|
-
return h(t, {
|
|
2160
|
-
code: d.invalid_type,
|
|
2161
|
-
expected: m.array,
|
|
2162
|
-
received: t.parsedType
|
|
2163
|
-
}), _;
|
|
2164
|
-
if (a.exactLength !== null) {
|
|
2165
|
-
const o = t.data.length > a.exactLength.value, c = t.data.length < a.exactLength.value;
|
|
2166
|
-
(o || c) && (h(t, {
|
|
2167
|
-
code: o ? d.too_big : d.too_small,
|
|
2168
|
-
minimum: c ? a.exactLength.value : void 0,
|
|
2169
|
-
maximum: o ? a.exactLength.value : void 0,
|
|
2170
|
-
type: "array",
|
|
2171
|
-
inclusive: !0,
|
|
2172
|
-
exact: !0,
|
|
2173
|
-
message: a.exactLength.message
|
|
2174
|
-
}), n.dirty());
|
|
2175
|
-
}
|
|
2176
|
-
if (a.minLength !== null && t.data.length < a.minLength.value && (h(t, {
|
|
2177
|
-
code: d.too_small,
|
|
2178
|
-
minimum: a.minLength.value,
|
|
2179
|
-
type: "array",
|
|
2180
|
-
inclusive: !0,
|
|
2181
|
-
exact: !1,
|
|
2182
|
-
message: a.minLength.message
|
|
2183
|
-
}), n.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (h(t, {
|
|
2184
|
-
code: d.too_big,
|
|
2185
|
-
maximum: a.maxLength.value,
|
|
2186
|
-
type: "array",
|
|
2187
|
-
inclusive: !0,
|
|
2188
|
-
exact: !1,
|
|
2189
|
-
message: a.maxLength.message
|
|
2190
|
-
}), n.dirty()), t.common.async)
|
|
2191
|
-
return Promise.all([...t.data].map((o, c) => a.type._parseAsync(new J(t, o, t.path, c)))).then((o) => I.mergeArray(n, o));
|
|
2192
|
-
const s = [...t.data].map((o, c) => a.type._parseSync(new J(t, o, t.path, c)));
|
|
2193
|
-
return I.mergeArray(n, s);
|
|
2194
|
-
}
|
|
2195
|
-
get element() {
|
|
2196
|
-
return this._def.type;
|
|
2197
|
-
}
|
|
2198
|
-
min(e, t) {
|
|
2199
|
-
return new U({
|
|
2200
|
-
...this._def,
|
|
2201
|
-
minLength: { value: e, message: y.toString(t) }
|
|
2202
|
-
});
|
|
2203
|
-
}
|
|
2204
|
-
max(e, t) {
|
|
2205
|
-
return new U({
|
|
2206
|
-
...this._def,
|
|
2207
|
-
maxLength: { value: e, message: y.toString(t) }
|
|
2208
|
-
});
|
|
2209
|
-
}
|
|
2210
|
-
length(e, t) {
|
|
2211
|
-
return new U({
|
|
2212
|
-
...this._def,
|
|
2213
|
-
exactLength: { value: e, message: y.toString(t) }
|
|
2214
|
-
});
|
|
2215
|
-
}
|
|
2216
|
-
nonempty(e) {
|
|
2217
|
-
return this.min(1, e);
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
U.create = (r, e) => new U({
|
|
2221
|
-
type: r,
|
|
2222
|
-
minLength: null,
|
|
2223
|
-
maxLength: null,
|
|
2224
|
-
exactLength: null,
|
|
2225
|
-
typeName: g.ZodArray,
|
|
2226
|
-
...x(e)
|
|
2227
|
-
});
|
|
2228
|
-
function ye(r) {
|
|
2229
|
-
if (r instanceof O) {
|
|
2230
|
-
const e = {};
|
|
2231
|
-
for (const t in r.shape) {
|
|
2232
|
-
const n = r.shape[t];
|
|
2233
|
-
e[t] = q.create(ye(n));
|
|
2234
|
-
}
|
|
2235
|
-
return new O({
|
|
2236
|
-
...r._def,
|
|
2237
|
-
shape: () => e
|
|
2238
|
-
});
|
|
2239
|
-
} else return r instanceof U ? new U({
|
|
2240
|
-
...r._def,
|
|
2241
|
-
type: ye(r.element)
|
|
2242
|
-
}) : r instanceof q ? q.create(ye(r.unwrap())) : r instanceof ce ? ce.create(ye(r.unwrap())) : r instanceof G ? G.create(r.items.map((e) => ye(e))) : r;
|
|
2243
|
-
}
|
|
2244
|
-
class O extends k {
|
|
2245
|
-
constructor() {
|
|
2246
|
-
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2247
|
-
}
|
|
2248
|
-
_getCached() {
|
|
2249
|
-
if (this._cached !== null)
|
|
2250
|
-
return this._cached;
|
|
2251
|
-
const e = this._def.shape(), t = E.objectKeys(e);
|
|
2252
|
-
return this._cached = { shape: e, keys: t };
|
|
2253
|
-
}
|
|
2254
|
-
_parse(e) {
|
|
2255
|
-
if (this._getType(e) !== m.object) {
|
|
2256
|
-
const f = this._getOrReturnCtx(e);
|
|
2257
|
-
return h(f, {
|
|
2258
|
-
code: d.invalid_type,
|
|
2259
|
-
expected: m.object,
|
|
2260
|
-
received: f.parsedType
|
|
2261
|
-
}), _;
|
|
2262
|
-
}
|
|
2263
|
-
const { status: n, ctx: a } = this._processInputParams(e), { shape: s, keys: o } = this._getCached(), c = [];
|
|
2264
|
-
if (!(this._def.catchall instanceof re && this._def.unknownKeys === "strip"))
|
|
2265
|
-
for (const f in a.data)
|
|
2266
|
-
o.includes(f) || c.push(f);
|
|
2267
|
-
const l = [];
|
|
2268
|
-
for (const f of o) {
|
|
2269
|
-
const v = s[f], S = a.data[f];
|
|
2270
|
-
l.push({
|
|
2271
|
-
key: { status: "valid", value: f },
|
|
2272
|
-
value: v._parse(new J(a, S, a.path, f)),
|
|
2273
|
-
alwaysSet: f in a.data
|
|
2274
|
-
});
|
|
2275
|
-
}
|
|
2276
|
-
if (this._def.catchall instanceof re) {
|
|
2277
|
-
const f = this._def.unknownKeys;
|
|
2278
|
-
if (f === "passthrough")
|
|
2279
|
-
for (const v of c)
|
|
2280
|
-
l.push({
|
|
2281
|
-
key: { status: "valid", value: v },
|
|
2282
|
-
value: { status: "valid", value: a.data[v] }
|
|
2283
|
-
});
|
|
2284
|
-
else if (f === "strict")
|
|
2285
|
-
c.length > 0 && (h(a, {
|
|
2286
|
-
code: d.unrecognized_keys,
|
|
2287
|
-
keys: c
|
|
2288
|
-
}), n.dirty());
|
|
2289
|
-
else if (f !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2290
|
-
} else {
|
|
2291
|
-
const f = this._def.catchall;
|
|
2292
|
-
for (const v of c) {
|
|
2293
|
-
const S = a.data[v];
|
|
2294
|
-
l.push({
|
|
2295
|
-
key: { status: "valid", value: v },
|
|
2296
|
-
value: f._parse(
|
|
2297
|
-
new J(a, S, a.path, v)
|
|
2298
|
-
//, ctx.child(key), value, getParsedType(value)
|
|
2299
|
-
),
|
|
2300
|
-
alwaysSet: v in a.data
|
|
2301
|
-
});
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
return a.common.async ? Promise.resolve().then(async () => {
|
|
2305
|
-
const f = [];
|
|
2306
|
-
for (const v of l) {
|
|
2307
|
-
const S = await v.key, N = await v.value;
|
|
2308
|
-
f.push({
|
|
2309
|
-
key: S,
|
|
2310
|
-
value: N,
|
|
2311
|
-
alwaysSet: v.alwaysSet
|
|
2312
|
-
});
|
|
2313
|
-
}
|
|
2314
|
-
return f;
|
|
2315
|
-
}).then((f) => I.mergeObjectSync(n, f)) : I.mergeObjectSync(n, l);
|
|
2316
|
-
}
|
|
2317
|
-
get shape() {
|
|
2318
|
-
return this._def.shape();
|
|
2319
|
-
}
|
|
2320
|
-
strict(e) {
|
|
2321
|
-
return y.errToObj, new O({
|
|
2322
|
-
...this._def,
|
|
2323
|
-
unknownKeys: "strict",
|
|
2324
|
-
...e !== void 0 ? {
|
|
2325
|
-
errorMap: (t, n) => {
|
|
2326
|
-
var a, s, o, c;
|
|
2327
|
-
const l = (o = (s = (a = this._def).errorMap) === null || s === void 0 ? void 0 : s.call(a, t, n).message) !== null && o !== void 0 ? o : n.defaultError;
|
|
2328
|
-
return t.code === "unrecognized_keys" ? {
|
|
2329
|
-
message: (c = y.errToObj(e).message) !== null && c !== void 0 ? c : l
|
|
2330
|
-
} : {
|
|
2331
|
-
message: l
|
|
2332
|
-
};
|
|
2333
|
-
}
|
|
2334
|
-
} : {}
|
|
2335
|
-
});
|
|
2336
|
-
}
|
|
2337
|
-
strip() {
|
|
2338
|
-
return new O({
|
|
2339
|
-
...this._def,
|
|
2340
|
-
unknownKeys: "strip"
|
|
2341
|
-
});
|
|
2342
|
-
}
|
|
2343
|
-
passthrough() {
|
|
2344
|
-
return new O({
|
|
2345
|
-
...this._def,
|
|
2346
|
-
unknownKeys: "passthrough"
|
|
2347
|
-
});
|
|
2348
|
-
}
|
|
2349
|
-
// const AugmentFactory =
|
|
2350
|
-
// <Def extends ZodObjectDef>(def: Def) =>
|
|
2351
|
-
// <Augmentation extends ZodRawShape>(
|
|
2352
|
-
// augmentation: Augmentation
|
|
2353
|
-
// ): ZodObject<
|
|
2354
|
-
// extendShape<ReturnType<Def["shape"]>, Augmentation>,
|
|
2355
|
-
// Def["unknownKeys"],
|
|
2356
|
-
// Def["catchall"]
|
|
2357
|
-
// > => {
|
|
2358
|
-
// return new ZodObject({
|
|
2359
|
-
// ...def,
|
|
2360
|
-
// shape: () => ({
|
|
2361
|
-
// ...def.shape(),
|
|
2362
|
-
// ...augmentation,
|
|
2363
|
-
// }),
|
|
2364
|
-
// }) as any;
|
|
2365
|
-
// };
|
|
2366
|
-
extend(e) {
|
|
2367
|
-
return new O({
|
|
2368
|
-
...this._def,
|
|
2369
|
-
shape: () => ({
|
|
2370
|
-
...this._def.shape(),
|
|
2371
|
-
...e
|
|
2372
|
-
})
|
|
2373
|
-
});
|
|
2374
|
-
}
|
|
2375
|
-
/**
|
|
2376
|
-
* Prior to zod@1.0.12 there was a bug in the
|
|
2377
|
-
* inferred type of merged objects. Please
|
|
2378
|
-
* upgrade if you are experiencing issues.
|
|
2379
|
-
*/
|
|
2380
|
-
merge(e) {
|
|
2381
|
-
return new O({
|
|
2382
|
-
unknownKeys: e._def.unknownKeys,
|
|
2383
|
-
catchall: e._def.catchall,
|
|
2384
|
-
shape: () => ({
|
|
2385
|
-
...this._def.shape(),
|
|
2386
|
-
...e._def.shape()
|
|
2387
|
-
}),
|
|
2388
|
-
typeName: g.ZodObject
|
|
2389
|
-
});
|
|
2390
|
-
}
|
|
2391
|
-
// merge<
|
|
2392
|
-
// Incoming extends AnyZodObject,
|
|
2393
|
-
// Augmentation extends Incoming["shape"],
|
|
2394
|
-
// NewOutput extends {
|
|
2395
|
-
// [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
|
|
2396
|
-
// ? Augmentation[k]["_output"]
|
|
2397
|
-
// : k extends keyof Output
|
|
2398
|
-
// ? Output[k]
|
|
2399
|
-
// : never;
|
|
2400
|
-
// },
|
|
2401
|
-
// NewInput extends {
|
|
2402
|
-
// [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
|
|
2403
|
-
// ? Augmentation[k]["_input"]
|
|
2404
|
-
// : k extends keyof Input
|
|
2405
|
-
// ? Input[k]
|
|
2406
|
-
// : never;
|
|
2407
|
-
// }
|
|
2408
|
-
// >(
|
|
2409
|
-
// merging: Incoming
|
|
2410
|
-
// ): ZodObject<
|
|
2411
|
-
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
2412
|
-
// Incoming["_def"]["unknownKeys"],
|
|
2413
|
-
// Incoming["_def"]["catchall"],
|
|
2414
|
-
// NewOutput,
|
|
2415
|
-
// NewInput
|
|
2416
|
-
// > {
|
|
2417
|
-
// const merged: any = new ZodObject({
|
|
2418
|
-
// unknownKeys: merging._def.unknownKeys,
|
|
2419
|
-
// catchall: merging._def.catchall,
|
|
2420
|
-
// shape: () =>
|
|
2421
|
-
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
2422
|
-
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
2423
|
-
// }) as any;
|
|
2424
|
-
// return merged;
|
|
2425
|
-
// }
|
|
2426
|
-
setKey(e, t) {
|
|
2427
|
-
return this.augment({ [e]: t });
|
|
2428
|
-
}
|
|
2429
|
-
// merge<Incoming extends AnyZodObject>(
|
|
2430
|
-
// merging: Incoming
|
|
2431
|
-
// ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
|
|
2432
|
-
// ZodObject<
|
|
2433
|
-
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
2434
|
-
// Incoming["_def"]["unknownKeys"],
|
|
2435
|
-
// Incoming["_def"]["catchall"]
|
|
2436
|
-
// > {
|
|
2437
|
-
// // const mergedShape = objectUtil.mergeShapes(
|
|
2438
|
-
// // this._def.shape(),
|
|
2439
|
-
// // merging._def.shape()
|
|
2440
|
-
// // );
|
|
2441
|
-
// const merged: any = new ZodObject({
|
|
2442
|
-
// unknownKeys: merging._def.unknownKeys,
|
|
2443
|
-
// catchall: merging._def.catchall,
|
|
2444
|
-
// shape: () =>
|
|
2445
|
-
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
2446
|
-
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
2447
|
-
// }) as any;
|
|
2448
|
-
// return merged;
|
|
2449
|
-
// }
|
|
2450
|
-
catchall(e) {
|
|
2451
|
-
return new O({
|
|
2452
|
-
...this._def,
|
|
2453
|
-
catchall: e
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
pick(e) {
|
|
2457
|
-
const t = {};
|
|
2458
|
-
return E.objectKeys(e).forEach((n) => {
|
|
2459
|
-
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
2460
|
-
}), new O({
|
|
2461
|
-
...this._def,
|
|
2462
|
-
shape: () => t
|
|
2463
|
-
});
|
|
2464
|
-
}
|
|
2465
|
-
omit(e) {
|
|
2466
|
-
const t = {};
|
|
2467
|
-
return E.objectKeys(this.shape).forEach((n) => {
|
|
2468
|
-
e[n] || (t[n] = this.shape[n]);
|
|
2469
|
-
}), new O({
|
|
2470
|
-
...this._def,
|
|
2471
|
-
shape: () => t
|
|
2472
|
-
});
|
|
2473
|
-
}
|
|
2474
|
-
/**
|
|
2475
|
-
* @deprecated
|
|
2476
|
-
*/
|
|
2477
|
-
deepPartial() {
|
|
2478
|
-
return ye(this);
|
|
2479
|
-
}
|
|
2480
|
-
partial(e) {
|
|
2481
|
-
const t = {};
|
|
2482
|
-
return E.objectKeys(this.shape).forEach((n) => {
|
|
2483
|
-
const a = this.shape[n];
|
|
2484
|
-
e && !e[n] ? t[n] = a : t[n] = a.optional();
|
|
2485
|
-
}), new O({
|
|
2486
|
-
...this._def,
|
|
2487
|
-
shape: () => t
|
|
2488
|
-
});
|
|
2489
|
-
}
|
|
2490
|
-
required(e) {
|
|
2491
|
-
const t = {};
|
|
2492
|
-
return E.objectKeys(this.shape).forEach((n) => {
|
|
2493
|
-
if (e && !e[n])
|
|
2494
|
-
t[n] = this.shape[n];
|
|
2495
|
-
else {
|
|
2496
|
-
let s = this.shape[n];
|
|
2497
|
-
for (; s instanceof q; )
|
|
2498
|
-
s = s._def.innerType;
|
|
2499
|
-
t[n] = s;
|
|
2500
|
-
}
|
|
2501
|
-
}), new O({
|
|
2502
|
-
...this._def,
|
|
2503
|
-
shape: () => t
|
|
2504
|
-
});
|
|
2505
|
-
}
|
|
2506
|
-
keyof() {
|
|
2507
|
-
return dr(E.objectKeys(this.shape));
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
O.create = (r, e) => new O({
|
|
2511
|
-
shape: () => r,
|
|
2512
|
-
unknownKeys: "strip",
|
|
2513
|
-
catchall: re.create(),
|
|
2514
|
-
typeName: g.ZodObject,
|
|
2515
|
-
...x(e)
|
|
2516
|
-
});
|
|
2517
|
-
O.strictCreate = (r, e) => new O({
|
|
2518
|
-
shape: () => r,
|
|
2519
|
-
unknownKeys: "strict",
|
|
2520
|
-
catchall: re.create(),
|
|
2521
|
-
typeName: g.ZodObject,
|
|
2522
|
-
...x(e)
|
|
2523
|
-
});
|
|
2524
|
-
O.lazycreate = (r, e) => new O({
|
|
2525
|
-
shape: r,
|
|
2526
|
-
unknownKeys: "strip",
|
|
2527
|
-
catchall: re.create(),
|
|
2528
|
-
typeName: g.ZodObject,
|
|
2529
|
-
...x(e)
|
|
2530
|
-
});
|
|
2531
|
-
class $e extends k {
|
|
2532
|
-
_parse(e) {
|
|
2533
|
-
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
2534
|
-
function a(s) {
|
|
2535
|
-
for (const c of s)
|
|
2536
|
-
if (c.result.status === "valid")
|
|
2537
|
-
return c.result;
|
|
2538
|
-
for (const c of s)
|
|
2539
|
-
if (c.result.status === "dirty")
|
|
2540
|
-
return t.common.issues.push(...c.ctx.common.issues), c.result;
|
|
2541
|
-
const o = s.map((c) => new M(c.ctx.common.issues));
|
|
2542
|
-
return h(t, {
|
|
2543
|
-
code: d.invalid_union,
|
|
2544
|
-
unionErrors: o
|
|
2545
|
-
}), _;
|
|
2546
|
-
}
|
|
2547
|
-
if (t.common.async)
|
|
2548
|
-
return Promise.all(n.map(async (s) => {
|
|
2549
|
-
const o = {
|
|
2550
|
-
...t,
|
|
2551
|
-
common: {
|
|
2552
|
-
...t.common,
|
|
2553
|
-
issues: []
|
|
2554
|
-
},
|
|
2555
|
-
parent: null
|
|
2556
|
-
};
|
|
2557
|
-
return {
|
|
2558
|
-
result: await s._parseAsync({
|
|
2559
|
-
data: t.data,
|
|
2560
|
-
path: t.path,
|
|
2561
|
-
parent: o
|
|
2562
|
-
}),
|
|
2563
|
-
ctx: o
|
|
2564
|
-
};
|
|
2565
|
-
})).then(a);
|
|
2566
|
-
{
|
|
2567
|
-
let s;
|
|
2568
|
-
const o = [];
|
|
2569
|
-
for (const l of n) {
|
|
2570
|
-
const f = {
|
|
2571
|
-
...t,
|
|
2572
|
-
common: {
|
|
2573
|
-
...t.common,
|
|
2574
|
-
issues: []
|
|
2575
|
-
},
|
|
2576
|
-
parent: null
|
|
2577
|
-
}, v = l._parseSync({
|
|
2578
|
-
data: t.data,
|
|
2579
|
-
path: t.path,
|
|
2580
|
-
parent: f
|
|
2581
|
-
});
|
|
2582
|
-
if (v.status === "valid")
|
|
2583
|
-
return v;
|
|
2584
|
-
v.status === "dirty" && !s && (s = { result: v, ctx: f }), f.common.issues.length && o.push(f.common.issues);
|
|
2585
|
-
}
|
|
2586
|
-
if (s)
|
|
2587
|
-
return t.common.issues.push(...s.ctx.common.issues), s.result;
|
|
2588
|
-
const c = o.map((l) => new M(l));
|
|
2589
|
-
return h(t, {
|
|
2590
|
-
code: d.invalid_union,
|
|
2591
|
-
unionErrors: c
|
|
2592
|
-
}), _;
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
get options() {
|
|
2596
|
-
return this._def.options;
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
$e.create = (r, e) => new $e({
|
|
2600
|
-
options: r,
|
|
2601
|
-
typeName: g.ZodUnion,
|
|
2602
|
-
...x(e)
|
|
2603
|
-
});
|
|
2604
|
-
const Q = (r) => r instanceof Ve ? Q(r.schema) : r instanceof W ? Q(r.innerType()) : r instanceof Le ? [r.value] : r instanceof oe ? r.options : r instanceof Fe ? E.objectValues(r.enum) : r instanceof ze ? Q(r._def.innerType) : r instanceof Ie ? [void 0] : r instanceof Pe ? [null] : r instanceof q ? [void 0, ...Q(r.unwrap())] : r instanceof ce ? [null, ...Q(r.unwrap())] : r instanceof Tt || r instanceof We ? Q(r.unwrap()) : r instanceof Ue ? Q(r._def.innerType) : [];
|
|
2605
|
-
class at extends k {
|
|
2606
|
-
_parse(e) {
|
|
2607
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2608
|
-
if (t.parsedType !== m.object)
|
|
2609
|
-
return h(t, {
|
|
2610
|
-
code: d.invalid_type,
|
|
2611
|
-
expected: m.object,
|
|
2612
|
-
received: t.parsedType
|
|
2613
|
-
}), _;
|
|
2614
|
-
const n = this.discriminator, a = t.data[n], s = this.optionsMap.get(a);
|
|
2615
|
-
return s ? t.common.async ? s._parseAsync({
|
|
2616
|
-
data: t.data,
|
|
2617
|
-
path: t.path,
|
|
2618
|
-
parent: t
|
|
2619
|
-
}) : s._parseSync({
|
|
2620
|
-
data: t.data,
|
|
2621
|
-
path: t.path,
|
|
2622
|
-
parent: t
|
|
2623
|
-
}) : (h(t, {
|
|
2624
|
-
code: d.invalid_union_discriminator,
|
|
2625
|
-
options: Array.from(this.optionsMap.keys()),
|
|
2626
|
-
path: [n]
|
|
2627
|
-
}), _);
|
|
2628
|
-
}
|
|
2629
|
-
get discriminator() {
|
|
2630
|
-
return this._def.discriminator;
|
|
2631
|
-
}
|
|
2632
|
-
get options() {
|
|
2633
|
-
return this._def.options;
|
|
2634
|
-
}
|
|
2635
|
-
get optionsMap() {
|
|
2636
|
-
return this._def.optionsMap;
|
|
2637
|
-
}
|
|
2638
|
-
/**
|
|
2639
|
-
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
2640
|
-
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
2641
|
-
* have a different value for each object in the union.
|
|
2642
|
-
* @param discriminator the name of the discriminator property
|
|
2643
|
-
* @param types an array of object schemas
|
|
2644
|
-
* @param params
|
|
2645
|
-
*/
|
|
2646
|
-
static create(e, t, n) {
|
|
2647
|
-
const a = /* @__PURE__ */ new Map();
|
|
2648
|
-
for (const s of t) {
|
|
2649
|
-
const o = Q(s.shape[e]);
|
|
2650
|
-
if (!o.length)
|
|
2651
|
-
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2652
|
-
for (const c of o) {
|
|
2653
|
-
if (a.has(c))
|
|
2654
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);
|
|
2655
|
-
a.set(c, s);
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
return new at({
|
|
2659
|
-
typeName: g.ZodDiscriminatedUnion,
|
|
2660
|
-
discriminator: e,
|
|
2661
|
-
options: t,
|
|
2662
|
-
optionsMap: a,
|
|
2663
|
-
...x(n)
|
|
2664
|
-
});
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
function wt(r, e) {
|
|
2668
|
-
const t = te(r), n = te(e);
|
|
2669
|
-
if (r === e)
|
|
2670
|
-
return { valid: !0, data: r };
|
|
2671
|
-
if (t === m.object && n === m.object) {
|
|
2672
|
-
const a = E.objectKeys(e), s = E.objectKeys(r).filter((c) => a.indexOf(c) !== -1), o = { ...r, ...e };
|
|
2673
|
-
for (const c of s) {
|
|
2674
|
-
const l = wt(r[c], e[c]);
|
|
2675
|
-
if (!l.valid)
|
|
2676
|
-
return { valid: !1 };
|
|
2677
|
-
o[c] = l.data;
|
|
2678
|
-
}
|
|
2679
|
-
return { valid: !0, data: o };
|
|
2680
|
-
} else if (t === m.array && n === m.array) {
|
|
2681
|
-
if (r.length !== e.length)
|
|
2682
|
-
return { valid: !1 };
|
|
2683
|
-
const a = [];
|
|
2684
|
-
for (let s = 0; s < r.length; s++) {
|
|
2685
|
-
const o = r[s], c = e[s], l = wt(o, c);
|
|
2686
|
-
if (!l.valid)
|
|
2687
|
-
return { valid: !1 };
|
|
2688
|
-
a.push(l.data);
|
|
2689
|
-
}
|
|
2690
|
-
return { valid: !0, data: a };
|
|
2691
|
-
} else return t === m.date && n === m.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2692
|
-
}
|
|
2693
|
-
class De extends k {
|
|
2694
|
-
_parse(e) {
|
|
2695
|
-
const { status: t, ctx: n } = this._processInputParams(e), a = (s, o) => {
|
|
2696
|
-
if (xt(s) || xt(o))
|
|
2697
|
-
return _;
|
|
2698
|
-
const c = wt(s.value, o.value);
|
|
2699
|
-
return c.valid ? ((kt(s) || kt(o)) && t.dirty(), { status: t.value, value: c.data }) : (h(n, {
|
|
2700
|
-
code: d.invalid_intersection_types
|
|
2701
|
-
}), _);
|
|
2702
|
-
};
|
|
2703
|
-
return n.common.async ? Promise.all([
|
|
2704
|
-
this._def.left._parseAsync({
|
|
2705
|
-
data: n.data,
|
|
2706
|
-
path: n.path,
|
|
2707
|
-
parent: n
|
|
2708
|
-
}),
|
|
2709
|
-
this._def.right._parseAsync({
|
|
2710
|
-
data: n.data,
|
|
2711
|
-
path: n.path,
|
|
2712
|
-
parent: n
|
|
2713
|
-
})
|
|
2714
|
-
]).then(([s, o]) => a(s, o)) : a(this._def.left._parseSync({
|
|
2715
|
-
data: n.data,
|
|
2716
|
-
path: n.path,
|
|
2717
|
-
parent: n
|
|
2718
|
-
}), this._def.right._parseSync({
|
|
2719
|
-
data: n.data,
|
|
2720
|
-
path: n.path,
|
|
2721
|
-
parent: n
|
|
2722
|
-
}));
|
|
2723
|
-
}
|
|
2724
|
-
}
|
|
2725
|
-
De.create = (r, e, t) => new De({
|
|
2726
|
-
left: r,
|
|
2727
|
-
right: e,
|
|
2728
|
-
typeName: g.ZodIntersection,
|
|
2729
|
-
...x(t)
|
|
2730
|
-
});
|
|
2731
|
-
class G extends k {
|
|
2732
|
-
_parse(e) {
|
|
2733
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2734
|
-
if (n.parsedType !== m.array)
|
|
2735
|
-
return h(n, {
|
|
2736
|
-
code: d.invalid_type,
|
|
2737
|
-
expected: m.array,
|
|
2738
|
-
received: n.parsedType
|
|
2739
|
-
}), _;
|
|
2740
|
-
if (n.data.length < this._def.items.length)
|
|
2741
|
-
return h(n, {
|
|
2742
|
-
code: d.too_small,
|
|
2743
|
-
minimum: this._def.items.length,
|
|
2744
|
-
inclusive: !0,
|
|
2745
|
-
exact: !1,
|
|
2746
|
-
type: "array"
|
|
2747
|
-
}), _;
|
|
2748
|
-
!this._def.rest && n.data.length > this._def.items.length && (h(n, {
|
|
2749
|
-
code: d.too_big,
|
|
2750
|
-
maximum: this._def.items.length,
|
|
2751
|
-
inclusive: !0,
|
|
2752
|
-
exact: !1,
|
|
2753
|
-
type: "array"
|
|
2754
|
-
}), t.dirty());
|
|
2755
|
-
const s = [...n.data].map((o, c) => {
|
|
2756
|
-
const l = this._def.items[c] || this._def.rest;
|
|
2757
|
-
return l ? l._parse(new J(n, o, n.path, c)) : null;
|
|
2758
|
-
}).filter((o) => !!o);
|
|
2759
|
-
return n.common.async ? Promise.all(s).then((o) => I.mergeArray(t, o)) : I.mergeArray(t, s);
|
|
2760
|
-
}
|
|
2761
|
-
get items() {
|
|
2762
|
-
return this._def.items;
|
|
2763
|
-
}
|
|
2764
|
-
rest(e) {
|
|
2765
|
-
return new G({
|
|
2766
|
-
...this._def,
|
|
2767
|
-
rest: e
|
|
2768
|
-
});
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
G.create = (r, e) => {
|
|
2772
|
-
if (!Array.isArray(r))
|
|
2773
|
-
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2774
|
-
return new G({
|
|
2775
|
-
items: r,
|
|
2776
|
-
typeName: g.ZodTuple,
|
|
2777
|
-
rest: null,
|
|
2778
|
-
...x(e)
|
|
2779
|
-
});
|
|
2780
|
-
};
|
|
2781
|
-
class Me extends k {
|
|
2782
|
-
get keySchema() {
|
|
2783
|
-
return this._def.keyType;
|
|
2784
|
-
}
|
|
2785
|
-
get valueSchema() {
|
|
2786
|
-
return this._def.valueType;
|
|
2787
|
-
}
|
|
2788
|
-
_parse(e) {
|
|
2789
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2790
|
-
if (n.parsedType !== m.object)
|
|
2791
|
-
return h(n, {
|
|
2792
|
-
code: d.invalid_type,
|
|
2793
|
-
expected: m.object,
|
|
2794
|
-
received: n.parsedType
|
|
2795
|
-
}), _;
|
|
2796
|
-
const a = [], s = this._def.keyType, o = this._def.valueType;
|
|
2797
|
-
for (const c in n.data)
|
|
2798
|
-
a.push({
|
|
2799
|
-
key: s._parse(new J(n, c, n.path, c)),
|
|
2800
|
-
value: o._parse(new J(n, n.data[c], n.path, c)),
|
|
2801
|
-
alwaysSet: c in n.data
|
|
2802
|
-
});
|
|
2803
|
-
return n.common.async ? I.mergeObjectAsync(t, a) : I.mergeObjectSync(t, a);
|
|
2804
|
-
}
|
|
2805
|
-
get element() {
|
|
2806
|
-
return this._def.valueType;
|
|
2807
|
-
}
|
|
2808
|
-
static create(e, t, n) {
|
|
2809
|
-
return t instanceof k ? new Me({
|
|
2810
|
-
keyType: e,
|
|
2811
|
-
valueType: t,
|
|
2812
|
-
typeName: g.ZodRecord,
|
|
2813
|
-
...x(n)
|
|
2814
|
-
}) : new Me({
|
|
2815
|
-
keyType: z.create(),
|
|
2816
|
-
valueType: e,
|
|
2817
|
-
typeName: g.ZodRecord,
|
|
2818
|
-
...x(t)
|
|
2819
|
-
});
|
|
2820
|
-
}
|
|
2821
|
-
}
|
|
2822
|
-
class rt extends k {
|
|
2823
|
-
get keySchema() {
|
|
2824
|
-
return this._def.keyType;
|
|
2825
|
-
}
|
|
2826
|
-
get valueSchema() {
|
|
2827
|
-
return this._def.valueType;
|
|
2828
|
-
}
|
|
2829
|
-
_parse(e) {
|
|
2830
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2831
|
-
if (n.parsedType !== m.map)
|
|
2832
|
-
return h(n, {
|
|
2833
|
-
code: d.invalid_type,
|
|
2834
|
-
expected: m.map,
|
|
2835
|
-
received: n.parsedType
|
|
2836
|
-
}), _;
|
|
2837
|
-
const a = this._def.keyType, s = this._def.valueType, o = [...n.data.entries()].map(([c, l], f) => ({
|
|
2838
|
-
key: a._parse(new J(n, c, n.path, [f, "key"])),
|
|
2839
|
-
value: s._parse(new J(n, l, n.path, [f, "value"]))
|
|
2840
|
-
}));
|
|
2841
|
-
if (n.common.async) {
|
|
2842
|
-
const c = /* @__PURE__ */ new Map();
|
|
2843
|
-
return Promise.resolve().then(async () => {
|
|
2844
|
-
for (const l of o) {
|
|
2845
|
-
const f = await l.key, v = await l.value;
|
|
2846
|
-
if (f.status === "aborted" || v.status === "aborted")
|
|
2847
|
-
return _;
|
|
2848
|
-
(f.status === "dirty" || v.status === "dirty") && t.dirty(), c.set(f.value, v.value);
|
|
2849
|
-
}
|
|
2850
|
-
return { status: t.value, value: c };
|
|
2851
|
-
});
|
|
2852
|
-
} else {
|
|
2853
|
-
const c = /* @__PURE__ */ new Map();
|
|
2854
|
-
for (const l of o) {
|
|
2855
|
-
const f = l.key, v = l.value;
|
|
2856
|
-
if (f.status === "aborted" || v.status === "aborted")
|
|
2857
|
-
return _;
|
|
2858
|
-
(f.status === "dirty" || v.status === "dirty") && t.dirty(), c.set(f.value, v.value);
|
|
2859
|
-
}
|
|
2860
|
-
return { status: t.value, value: c };
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
}
|
|
2864
|
-
rt.create = (r, e, t) => new rt({
|
|
2865
|
-
valueType: e,
|
|
2866
|
-
keyType: r,
|
|
2867
|
-
typeName: g.ZodMap,
|
|
2868
|
-
...x(t)
|
|
2869
|
-
});
|
|
2870
|
-
class pe extends k {
|
|
2871
|
-
_parse(e) {
|
|
2872
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2873
|
-
if (n.parsedType !== m.set)
|
|
2874
|
-
return h(n, {
|
|
2875
|
-
code: d.invalid_type,
|
|
2876
|
-
expected: m.set,
|
|
2877
|
-
received: n.parsedType
|
|
2878
|
-
}), _;
|
|
2879
|
-
const a = this._def;
|
|
2880
|
-
a.minSize !== null && n.data.size < a.minSize.value && (h(n, {
|
|
2881
|
-
code: d.too_small,
|
|
2882
|
-
minimum: a.minSize.value,
|
|
2883
|
-
type: "set",
|
|
2884
|
-
inclusive: !0,
|
|
2885
|
-
exact: !1,
|
|
2886
|
-
message: a.minSize.message
|
|
2887
|
-
}), t.dirty()), a.maxSize !== null && n.data.size > a.maxSize.value && (h(n, {
|
|
2888
|
-
code: d.too_big,
|
|
2889
|
-
maximum: a.maxSize.value,
|
|
2890
|
-
type: "set",
|
|
2891
|
-
inclusive: !0,
|
|
2892
|
-
exact: !1,
|
|
2893
|
-
message: a.maxSize.message
|
|
2894
|
-
}), t.dirty());
|
|
2895
|
-
const s = this._def.valueType;
|
|
2896
|
-
function o(l) {
|
|
2897
|
-
const f = /* @__PURE__ */ new Set();
|
|
2898
|
-
for (const v of l) {
|
|
2899
|
-
if (v.status === "aborted")
|
|
2900
|
-
return _;
|
|
2901
|
-
v.status === "dirty" && t.dirty(), f.add(v.value);
|
|
2902
|
-
}
|
|
2903
|
-
return { status: t.value, value: f };
|
|
2904
|
-
}
|
|
2905
|
-
const c = [...n.data.values()].map((l, f) => s._parse(new J(n, l, n.path, f)));
|
|
2906
|
-
return n.common.async ? Promise.all(c).then((l) => o(l)) : o(c);
|
|
2907
|
-
}
|
|
2908
|
-
min(e, t) {
|
|
2909
|
-
return new pe({
|
|
2910
|
-
...this._def,
|
|
2911
|
-
minSize: { value: e, message: y.toString(t) }
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
|
-
max(e, t) {
|
|
2915
|
-
return new pe({
|
|
2916
|
-
...this._def,
|
|
2917
|
-
maxSize: { value: e, message: y.toString(t) }
|
|
2918
|
-
});
|
|
2919
|
-
}
|
|
2920
|
-
size(e, t) {
|
|
2921
|
-
return this.min(e, t).max(e, t);
|
|
2922
|
-
}
|
|
2923
|
-
nonempty(e) {
|
|
2924
|
-
return this.min(1, e);
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2927
|
-
pe.create = (r, e) => new pe({
|
|
2928
|
-
valueType: r,
|
|
2929
|
-
minSize: null,
|
|
2930
|
-
maxSize: null,
|
|
2931
|
-
typeName: g.ZodSet,
|
|
2932
|
-
...x(e)
|
|
2933
|
-
});
|
|
2934
|
-
class _e extends k {
|
|
2935
|
-
constructor() {
|
|
2936
|
-
super(...arguments), this.validate = this.implement;
|
|
2937
|
-
}
|
|
2938
|
-
_parse(e) {
|
|
2939
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2940
|
-
if (t.parsedType !== m.function)
|
|
2941
|
-
return h(t, {
|
|
2942
|
-
code: d.invalid_type,
|
|
2943
|
-
expected: m.function,
|
|
2944
|
-
received: t.parsedType
|
|
2945
|
-
}), _;
|
|
2946
|
-
function n(c, l) {
|
|
2947
|
-
return Xe({
|
|
2948
|
-
data: c,
|
|
2949
|
-
path: t.path,
|
|
2950
|
-
errorMaps: [
|
|
2951
|
-
t.common.contextualErrorMap,
|
|
2952
|
-
t.schemaErrorMap,
|
|
2953
|
-
Ke(),
|
|
2954
|
-
be
|
|
2955
|
-
].filter((f) => !!f),
|
|
2956
|
-
issueData: {
|
|
2957
|
-
code: d.invalid_arguments,
|
|
2958
|
-
argumentsError: l
|
|
2959
|
-
}
|
|
2960
|
-
});
|
|
2961
|
-
}
|
|
2962
|
-
function a(c, l) {
|
|
2963
|
-
return Xe({
|
|
2964
|
-
data: c,
|
|
2965
|
-
path: t.path,
|
|
2966
|
-
errorMaps: [
|
|
2967
|
-
t.common.contextualErrorMap,
|
|
2968
|
-
t.schemaErrorMap,
|
|
2969
|
-
Ke(),
|
|
2970
|
-
be
|
|
2971
|
-
].filter((f) => !!f),
|
|
2972
|
-
issueData: {
|
|
2973
|
-
code: d.invalid_return_type,
|
|
2974
|
-
returnTypeError: l
|
|
2975
|
-
}
|
|
2976
|
-
});
|
|
2977
|
-
}
|
|
2978
|
-
const s = { errorMap: t.common.contextualErrorMap }, o = t.data;
|
|
2979
|
-
if (this._def.returns instanceof ke) {
|
|
2980
|
-
const c = this;
|
|
2981
|
-
return $(async function(...l) {
|
|
2982
|
-
const f = new M([]), v = await c._def.args.parseAsync(l, s).catch((B) => {
|
|
2983
|
-
throw f.addIssue(n(l, B)), f;
|
|
2984
|
-
}), S = await Reflect.apply(o, this, v);
|
|
2985
|
-
return await c._def.returns._def.type.parseAsync(S, s).catch((B) => {
|
|
2986
|
-
throw f.addIssue(a(S, B)), f;
|
|
2987
|
-
});
|
|
2988
|
-
});
|
|
2989
|
-
} else {
|
|
2990
|
-
const c = this;
|
|
2991
|
-
return $(function(...l) {
|
|
2992
|
-
const f = c._def.args.safeParse(l, s);
|
|
2993
|
-
if (!f.success)
|
|
2994
|
-
throw new M([n(l, f.error)]);
|
|
2995
|
-
const v = Reflect.apply(o, this, f.data), S = c._def.returns.safeParse(v, s);
|
|
2996
|
-
if (!S.success)
|
|
2997
|
-
throw new M([a(v, S.error)]);
|
|
2998
|
-
return S.data;
|
|
2999
|
-
});
|
|
3000
|
-
}
|
|
3001
|
-
}
|
|
3002
|
-
parameters() {
|
|
3003
|
-
return this._def.args;
|
|
3004
|
-
}
|
|
3005
|
-
returnType() {
|
|
3006
|
-
return this._def.returns;
|
|
3007
|
-
}
|
|
3008
|
-
args(...e) {
|
|
3009
|
-
return new _e({
|
|
3010
|
-
...this._def,
|
|
3011
|
-
args: G.create(e).rest(le.create())
|
|
3012
|
-
});
|
|
3013
|
-
}
|
|
3014
|
-
returns(e) {
|
|
3015
|
-
return new _e({
|
|
3016
|
-
...this._def,
|
|
3017
|
-
returns: e
|
|
3018
|
-
});
|
|
3019
|
-
}
|
|
3020
|
-
implement(e) {
|
|
3021
|
-
return this.parse(e);
|
|
3022
|
-
}
|
|
3023
|
-
strictImplement(e) {
|
|
3024
|
-
return this.parse(e);
|
|
3025
|
-
}
|
|
3026
|
-
static create(e, t, n) {
|
|
3027
|
-
return new _e({
|
|
3028
|
-
args: e || G.create([]).rest(le.create()),
|
|
3029
|
-
returns: t || le.create(),
|
|
3030
|
-
typeName: g.ZodFunction,
|
|
3031
|
-
...x(n)
|
|
3032
|
-
});
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
class Ve extends k {
|
|
3036
|
-
get schema() {
|
|
3037
|
-
return this._def.getter();
|
|
3038
|
-
}
|
|
3039
|
-
_parse(e) {
|
|
3040
|
-
const { ctx: t } = this._processInputParams(e);
|
|
3041
|
-
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3042
|
-
}
|
|
3043
|
-
}
|
|
3044
|
-
Ve.create = (r, e) => new Ve({
|
|
3045
|
-
getter: r,
|
|
3046
|
-
typeName: g.ZodLazy,
|
|
3047
|
-
...x(e)
|
|
3048
|
-
});
|
|
3049
|
-
class Le extends k {
|
|
3050
|
-
_parse(e) {
|
|
3051
|
-
if (e.data !== this._def.value) {
|
|
3052
|
-
const t = this._getOrReturnCtx(e);
|
|
3053
|
-
return h(t, {
|
|
3054
|
-
received: t.data,
|
|
3055
|
-
code: d.invalid_literal,
|
|
3056
|
-
expected: this._def.value
|
|
3057
|
-
}), _;
|
|
3058
|
-
}
|
|
3059
|
-
return { status: "valid", value: e.data };
|
|
3060
|
-
}
|
|
3061
|
-
get value() {
|
|
3062
|
-
return this._def.value;
|
|
3063
|
-
}
|
|
3064
|
-
}
|
|
3065
|
-
Le.create = (r, e) => new Le({
|
|
3066
|
-
value: r,
|
|
3067
|
-
typeName: g.ZodLiteral,
|
|
3068
|
-
...x(e)
|
|
3069
|
-
});
|
|
3070
|
-
function dr(r, e) {
|
|
3071
|
-
return new oe({
|
|
3072
|
-
values: r,
|
|
3073
|
-
typeName: g.ZodEnum,
|
|
3074
|
-
...x(e)
|
|
3075
|
-
});
|
|
3076
|
-
}
|
|
3077
|
-
class oe extends k {
|
|
3078
|
-
constructor() {
|
|
3079
|
-
super(...arguments), je.set(this, void 0);
|
|
3080
|
-
}
|
|
3081
|
-
_parse(e) {
|
|
3082
|
-
if (typeof e.data != "string") {
|
|
3083
|
-
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
3084
|
-
return h(t, {
|
|
3085
|
-
expected: E.joinValues(n),
|
|
3086
|
-
received: t.parsedType,
|
|
3087
|
-
code: d.invalid_type
|
|
3088
|
-
}), _;
|
|
3089
|
-
}
|
|
3090
|
-
if (Qe(this, je) || ir(this, je, new Set(this._def.values)), !Qe(this, je).has(e.data)) {
|
|
3091
|
-
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
3092
|
-
return h(t, {
|
|
3093
|
-
received: t.data,
|
|
3094
|
-
code: d.invalid_enum_value,
|
|
3095
|
-
options: n
|
|
3096
|
-
}), _;
|
|
3097
|
-
}
|
|
3098
|
-
return $(e.data);
|
|
3099
|
-
}
|
|
3100
|
-
get options() {
|
|
3101
|
-
return this._def.values;
|
|
3102
|
-
}
|
|
3103
|
-
get enum() {
|
|
3104
|
-
const e = {};
|
|
3105
|
-
for (const t of this._def.values)
|
|
3106
|
-
e[t] = t;
|
|
3107
|
-
return e;
|
|
3108
|
-
}
|
|
3109
|
-
get Values() {
|
|
3110
|
-
const e = {};
|
|
3111
|
-
for (const t of this._def.values)
|
|
3112
|
-
e[t] = t;
|
|
3113
|
-
return e;
|
|
3114
|
-
}
|
|
3115
|
-
get Enum() {
|
|
3116
|
-
const e = {};
|
|
3117
|
-
for (const t of this._def.values)
|
|
3118
|
-
e[t] = t;
|
|
3119
|
-
return e;
|
|
3120
|
-
}
|
|
3121
|
-
extract(e, t = this._def) {
|
|
3122
|
-
return oe.create(e, {
|
|
3123
|
-
...this._def,
|
|
3124
|
-
...t
|
|
3125
|
-
});
|
|
3126
|
-
}
|
|
3127
|
-
exclude(e, t = this._def) {
|
|
3128
|
-
return oe.create(this.options.filter((n) => !e.includes(n)), {
|
|
3129
|
-
...this._def,
|
|
3130
|
-
...t
|
|
3131
|
-
});
|
|
3132
|
-
}
|
|
3133
|
-
}
|
|
3134
|
-
je = /* @__PURE__ */ new WeakMap();
|
|
3135
|
-
oe.create = dr;
|
|
3136
|
-
class Fe extends k {
|
|
3137
|
-
constructor() {
|
|
3138
|
-
super(...arguments), Ae.set(this, void 0);
|
|
3139
|
-
}
|
|
3140
|
-
_parse(e) {
|
|
3141
|
-
const t = E.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
3142
|
-
if (n.parsedType !== m.string && n.parsedType !== m.number) {
|
|
3143
|
-
const a = E.objectValues(t);
|
|
3144
|
-
return h(n, {
|
|
3145
|
-
expected: E.joinValues(a),
|
|
3146
|
-
received: n.parsedType,
|
|
3147
|
-
code: d.invalid_type
|
|
3148
|
-
}), _;
|
|
3149
|
-
}
|
|
3150
|
-
if (Qe(this, Ae) || ir(this, Ae, new Set(E.getValidEnumValues(this._def.values))), !Qe(this, Ae).has(e.data)) {
|
|
3151
|
-
const a = E.objectValues(t);
|
|
3152
|
-
return h(n, {
|
|
3153
|
-
received: n.data,
|
|
3154
|
-
code: d.invalid_enum_value,
|
|
3155
|
-
options: a
|
|
3156
|
-
}), _;
|
|
3157
|
-
}
|
|
3158
|
-
return $(e.data);
|
|
3159
|
-
}
|
|
3160
|
-
get enum() {
|
|
3161
|
-
return this._def.values;
|
|
3162
|
-
}
|
|
3163
|
-
}
|
|
3164
|
-
Ae = /* @__PURE__ */ new WeakMap();
|
|
3165
|
-
Fe.create = (r, e) => new Fe({
|
|
3166
|
-
values: r,
|
|
3167
|
-
typeName: g.ZodNativeEnum,
|
|
3168
|
-
...x(e)
|
|
3169
|
-
});
|
|
3170
|
-
class ke extends k {
|
|
3171
|
-
unwrap() {
|
|
3172
|
-
return this._def.type;
|
|
3173
|
-
}
|
|
3174
|
-
_parse(e) {
|
|
3175
|
-
const { ctx: t } = this._processInputParams(e);
|
|
3176
|
-
if (t.parsedType !== m.promise && t.common.async === !1)
|
|
3177
|
-
return h(t, {
|
|
3178
|
-
code: d.invalid_type,
|
|
3179
|
-
expected: m.promise,
|
|
3180
|
-
received: t.parsedType
|
|
3181
|
-
}), _;
|
|
3182
|
-
const n = t.parsedType === m.promise ? t.data : Promise.resolve(t.data);
|
|
3183
|
-
return $(n.then((a) => this._def.type.parseAsync(a, {
|
|
3184
|
-
path: t.path,
|
|
3185
|
-
errorMap: t.common.contextualErrorMap
|
|
3186
|
-
})));
|
|
3187
|
-
}
|
|
3188
|
-
}
|
|
3189
|
-
ke.create = (r, e) => new ke({
|
|
3190
|
-
type: r,
|
|
3191
|
-
typeName: g.ZodPromise,
|
|
3192
|
-
...x(e)
|
|
3193
|
-
});
|
|
3194
|
-
class W extends k {
|
|
3195
|
-
innerType() {
|
|
3196
|
-
return this._def.schema;
|
|
3197
|
-
}
|
|
3198
|
-
sourceType() {
|
|
3199
|
-
return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3200
|
-
}
|
|
3201
|
-
_parse(e) {
|
|
3202
|
-
const { status: t, ctx: n } = this._processInputParams(e), a = this._def.effect || null, s = {
|
|
3203
|
-
addIssue: (o) => {
|
|
3204
|
-
h(n, o), o.fatal ? t.abort() : t.dirty();
|
|
3205
|
-
},
|
|
3206
|
-
get path() {
|
|
3207
|
-
return n.path;
|
|
3208
|
-
}
|
|
3209
|
-
};
|
|
3210
|
-
if (s.addIssue = s.addIssue.bind(s), a.type === "preprocess") {
|
|
3211
|
-
const o = a.transform(n.data, s);
|
|
3212
|
-
if (n.common.async)
|
|
3213
|
-
return Promise.resolve(o).then(async (c) => {
|
|
3214
|
-
if (t.value === "aborted")
|
|
3215
|
-
return _;
|
|
3216
|
-
const l = await this._def.schema._parseAsync({
|
|
3217
|
-
data: c,
|
|
3218
|
-
path: n.path,
|
|
3219
|
-
parent: n
|
|
3220
|
-
});
|
|
3221
|
-
return l.status === "aborted" ? _ : l.status === "dirty" || t.value === "dirty" ? ge(l.value) : l;
|
|
3222
|
-
});
|
|
3223
|
-
{
|
|
3224
|
-
if (t.value === "aborted")
|
|
3225
|
-
return _;
|
|
3226
|
-
const c = this._def.schema._parseSync({
|
|
3227
|
-
data: o,
|
|
3228
|
-
path: n.path,
|
|
3229
|
-
parent: n
|
|
3230
|
-
});
|
|
3231
|
-
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? ge(c.value) : c;
|
|
3232
|
-
}
|
|
3233
|
-
}
|
|
3234
|
-
if (a.type === "refinement") {
|
|
3235
|
-
const o = (c) => {
|
|
3236
|
-
const l = a.refinement(c, s);
|
|
3237
|
-
if (n.common.async)
|
|
3238
|
-
return Promise.resolve(l);
|
|
3239
|
-
if (l instanceof Promise)
|
|
3240
|
-
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3241
|
-
return c;
|
|
3242
|
-
};
|
|
3243
|
-
if (n.common.async === !1) {
|
|
3244
|
-
const c = this._def.schema._parseSync({
|
|
3245
|
-
data: n.data,
|
|
3246
|
-
path: n.path,
|
|
3247
|
-
parent: n
|
|
3248
|
-
});
|
|
3249
|
-
return c.status === "aborted" ? _ : (c.status === "dirty" && t.dirty(), o(c.value), { status: t.value, value: c.value });
|
|
3250
|
-
} else
|
|
3251
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => c.status === "aborted" ? _ : (c.status === "dirty" && t.dirty(), o(c.value).then(() => ({ status: t.value, value: c.value }))));
|
|
3252
|
-
}
|
|
3253
|
-
if (a.type === "transform")
|
|
3254
|
-
if (n.common.async === !1) {
|
|
3255
|
-
const o = this._def.schema._parseSync({
|
|
3256
|
-
data: n.data,
|
|
3257
|
-
path: n.path,
|
|
3258
|
-
parent: n
|
|
3259
|
-
});
|
|
3260
|
-
if (!fe(o))
|
|
3261
|
-
return o;
|
|
3262
|
-
const c = a.transform(o.value, s);
|
|
3263
|
-
if (c instanceof Promise)
|
|
3264
|
-
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3265
|
-
return { status: t.value, value: c };
|
|
3266
|
-
} else
|
|
3267
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => fe(o) ? Promise.resolve(a.transform(o.value, s)).then((c) => ({ status: t.value, value: c })) : o);
|
|
3268
|
-
E.assertNever(a);
|
|
3269
|
-
}
|
|
3270
|
-
}
|
|
3271
|
-
W.create = (r, e, t) => new W({
|
|
3272
|
-
schema: r,
|
|
3273
|
-
typeName: g.ZodEffects,
|
|
3274
|
-
effect: e,
|
|
3275
|
-
...x(t)
|
|
3276
|
-
});
|
|
3277
|
-
W.createWithPreprocess = (r, e, t) => new W({
|
|
3278
|
-
schema: e,
|
|
3279
|
-
effect: { type: "preprocess", transform: r },
|
|
3280
|
-
typeName: g.ZodEffects,
|
|
3281
|
-
...x(t)
|
|
3282
|
-
});
|
|
3283
|
-
class q extends k {
|
|
3284
|
-
_parse(e) {
|
|
3285
|
-
return this._getType(e) === m.undefined ? $(void 0) : this._def.innerType._parse(e);
|
|
3286
|
-
}
|
|
3287
|
-
unwrap() {
|
|
3288
|
-
return this._def.innerType;
|
|
3289
|
-
}
|
|
3290
|
-
}
|
|
3291
|
-
q.create = (r, e) => new q({
|
|
3292
|
-
innerType: r,
|
|
3293
|
-
typeName: g.ZodOptional,
|
|
3294
|
-
...x(e)
|
|
3295
|
-
});
|
|
3296
|
-
class ce extends k {
|
|
3297
|
-
_parse(e) {
|
|
3298
|
-
return this._getType(e) === m.null ? $(null) : this._def.innerType._parse(e);
|
|
3299
|
-
}
|
|
3300
|
-
unwrap() {
|
|
3301
|
-
return this._def.innerType;
|
|
3302
|
-
}
|
|
3303
|
-
}
|
|
3304
|
-
ce.create = (r, e) => new ce({
|
|
3305
|
-
innerType: r,
|
|
3306
|
-
typeName: g.ZodNullable,
|
|
3307
|
-
...x(e)
|
|
3308
|
-
});
|
|
3309
|
-
class ze extends k {
|
|
3310
|
-
_parse(e) {
|
|
3311
|
-
const { ctx: t } = this._processInputParams(e);
|
|
3312
|
-
let n = t.data;
|
|
3313
|
-
return t.parsedType === m.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
3314
|
-
data: n,
|
|
3315
|
-
path: t.path,
|
|
3316
|
-
parent: t
|
|
3317
|
-
});
|
|
3318
|
-
}
|
|
3319
|
-
removeDefault() {
|
|
3320
|
-
return this._def.innerType;
|
|
3321
|
-
}
|
|
3322
|
-
}
|
|
3323
|
-
ze.create = (r, e) => new ze({
|
|
3324
|
-
innerType: r,
|
|
3325
|
-
typeName: g.ZodDefault,
|
|
3326
|
-
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
3327
|
-
...x(e)
|
|
3328
|
-
});
|
|
3329
|
-
class Ue extends k {
|
|
3330
|
-
_parse(e) {
|
|
3331
|
-
const { ctx: t } = this._processInputParams(e), n = {
|
|
3332
|
-
...t,
|
|
3333
|
-
common: {
|
|
3334
|
-
...t.common,
|
|
3335
|
-
issues: []
|
|
3336
|
-
}
|
|
3337
|
-
}, a = this._def.innerType._parse({
|
|
3338
|
-
data: n.data,
|
|
3339
|
-
path: n.path,
|
|
3340
|
-
parent: {
|
|
3341
|
-
...n
|
|
3342
|
-
}
|
|
3343
|
-
});
|
|
3344
|
-
return Ze(a) ? a.then((s) => ({
|
|
3345
|
-
status: "valid",
|
|
3346
|
-
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
3347
|
-
get error() {
|
|
3348
|
-
return new M(n.common.issues);
|
|
3349
|
-
},
|
|
3350
|
-
input: n.data
|
|
3351
|
-
})
|
|
3352
|
-
})) : {
|
|
3353
|
-
status: "valid",
|
|
3354
|
-
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3355
|
-
get error() {
|
|
3356
|
-
return new M(n.common.issues);
|
|
3357
|
-
},
|
|
3358
|
-
input: n.data
|
|
3359
|
-
})
|
|
3360
|
-
};
|
|
3361
|
-
}
|
|
3362
|
-
removeCatch() {
|
|
3363
|
-
return this._def.innerType;
|
|
3364
|
-
}
|
|
3365
|
-
}
|
|
3366
|
-
Ue.create = (r, e) => new Ue({
|
|
3367
|
-
innerType: r,
|
|
3368
|
-
typeName: g.ZodCatch,
|
|
3369
|
-
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3370
|
-
...x(e)
|
|
3371
|
-
});
|
|
3372
|
-
class nt extends k {
|
|
3373
|
-
_parse(e) {
|
|
3374
|
-
if (this._getType(e) !== m.nan) {
|
|
3375
|
-
const n = this._getOrReturnCtx(e);
|
|
3376
|
-
return h(n, {
|
|
3377
|
-
code: d.invalid_type,
|
|
3378
|
-
expected: m.nan,
|
|
3379
|
-
received: n.parsedType
|
|
3380
|
-
}), _;
|
|
3381
|
-
}
|
|
3382
|
-
return { status: "valid", value: e.data };
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3385
|
-
nt.create = (r) => new nt({
|
|
3386
|
-
typeName: g.ZodNaN,
|
|
3387
|
-
...x(r)
|
|
3388
|
-
});
|
|
3389
|
-
const vn = Symbol("zod_brand");
|
|
3390
|
-
class Tt extends k {
|
|
3391
|
-
_parse(e) {
|
|
3392
|
-
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
3393
|
-
return this._def.type._parse({
|
|
3394
|
-
data: n,
|
|
3395
|
-
path: t.path,
|
|
3396
|
-
parent: t
|
|
3397
|
-
});
|
|
3398
|
-
}
|
|
3399
|
-
unwrap() {
|
|
3400
|
-
return this._def.type;
|
|
3401
|
-
}
|
|
3402
|
-
}
|
|
3403
|
-
class Be extends k {
|
|
3404
|
-
_parse(e) {
|
|
3405
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
3406
|
-
if (n.common.async)
|
|
3407
|
-
return (async () => {
|
|
3408
|
-
const s = await this._def.in._parseAsync({
|
|
3409
|
-
data: n.data,
|
|
3410
|
-
path: n.path,
|
|
3411
|
-
parent: n
|
|
3412
|
-
});
|
|
3413
|
-
return s.status === "aborted" ? _ : s.status === "dirty" ? (t.dirty(), ge(s.value)) : this._def.out._parseAsync({
|
|
3414
|
-
data: s.value,
|
|
3415
|
-
path: n.path,
|
|
3416
|
-
parent: n
|
|
3417
|
-
});
|
|
3418
|
-
})();
|
|
3419
|
-
{
|
|
3420
|
-
const a = this._def.in._parseSync({
|
|
3421
|
-
data: n.data,
|
|
3422
|
-
path: n.path,
|
|
3423
|
-
parent: n
|
|
3424
|
-
});
|
|
3425
|
-
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), {
|
|
3426
|
-
status: "dirty",
|
|
3427
|
-
value: a.value
|
|
3428
|
-
}) : this._def.out._parseSync({
|
|
3429
|
-
data: a.value,
|
|
3430
|
-
path: n.path,
|
|
3431
|
-
parent: n
|
|
3432
|
-
});
|
|
3433
|
-
}
|
|
3434
|
-
}
|
|
3435
|
-
static create(e, t) {
|
|
3436
|
-
return new Be({
|
|
3437
|
-
in: e,
|
|
3438
|
-
out: t,
|
|
3439
|
-
typeName: g.ZodPipeline
|
|
3440
|
-
});
|
|
3441
|
-
}
|
|
3442
|
-
}
|
|
3443
|
-
class We extends k {
|
|
3444
|
-
_parse(e) {
|
|
3445
|
-
const t = this._def.innerType._parse(e), n = (a) => (fe(a) && (a.value = Object.freeze(a.value)), a);
|
|
3446
|
-
return Ze(t) ? t.then((a) => n(a)) : n(t);
|
|
3447
|
-
}
|
|
3448
|
-
unwrap() {
|
|
3449
|
-
return this._def.innerType;
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
|
-
We.create = (r, e) => new We({
|
|
3453
|
-
innerType: r,
|
|
3454
|
-
typeName: g.ZodReadonly,
|
|
3455
|
-
...x(e)
|
|
3456
|
-
});
|
|
3457
|
-
function lr(r, e = {}, t) {
|
|
3458
|
-
return r ? xe.create().superRefine((n, a) => {
|
|
3459
|
-
var s, o;
|
|
3460
|
-
if (!r(n)) {
|
|
3461
|
-
const c = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, l = (o = (s = c.fatal) !== null && s !== void 0 ? s : t) !== null && o !== void 0 ? o : !0, f = typeof c == "string" ? { message: c } : c;
|
|
3462
|
-
a.addIssue({ code: "custom", ...f, fatal: l });
|
|
3463
|
-
}
|
|
3464
|
-
}) : xe.create();
|
|
3465
|
-
}
|
|
3466
|
-
const yn = {
|
|
3467
|
-
object: O.lazycreate
|
|
3468
|
-
};
|
|
3469
|
-
var g;
|
|
3470
|
-
(function(r) {
|
|
3471
|
-
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
3472
|
-
})(g || (g = {}));
|
|
3473
|
-
const gn = (r, e = {
|
|
3474
|
-
message: `Input not instance of ${r.name}`
|
|
3475
|
-
}) => lr((t) => t instanceof r, e), fr = z.create, hr = se.create, _n = nt.create, bn = ie.create, pr = Ne.create, xn = he.create, kn = et.create, wn = Ie.create, Tn = Pe.create, En = xe.create, Rn = le.create, Sn = re.create, Cn = tt.create, On = U.create, jn = O.create, An = O.strictCreate, Zn = $e.create, Nn = at.create, In = De.create, Pn = G.create, $n = Me.create, Dn = rt.create, Mn = pe.create, Vn = _e.create, Ln = Ve.create, Fn = Le.create, zn = oe.create, Un = Fe.create, Wn = ke.create, er = W.create, Bn = q.create, Yn = ce.create, qn = W.createWithPreprocess, Jn = Be.create, Gn = () => fr().optional(), Hn = () => hr().optional(), Kn = () => pr().optional(), Xn = {
|
|
3476
|
-
string: (r) => z.create({ ...r, coerce: !0 }),
|
|
3477
|
-
number: (r) => se.create({ ...r, coerce: !0 }),
|
|
3478
|
-
boolean: (r) => Ne.create({
|
|
3479
|
-
...r,
|
|
3480
|
-
coerce: !0
|
|
3481
|
-
}),
|
|
3482
|
-
bigint: (r) => ie.create({ ...r, coerce: !0 }),
|
|
3483
|
-
date: (r) => he.create({ ...r, coerce: !0 })
|
|
3484
|
-
}, Qn = _;
|
|
3485
|
-
var ee = /* @__PURE__ */ Object.freeze({
|
|
3486
|
-
__proto__: null,
|
|
3487
|
-
defaultErrorMap: be,
|
|
3488
|
-
setErrorMap: Yr,
|
|
3489
|
-
getErrorMap: Ke,
|
|
3490
|
-
makeIssue: Xe,
|
|
3491
|
-
EMPTY_PATH: qr,
|
|
3492
|
-
addIssueToContext: h,
|
|
3493
|
-
ParseStatus: I,
|
|
3494
|
-
INVALID: _,
|
|
3495
|
-
DIRTY: ge,
|
|
3496
|
-
OK: $,
|
|
3497
|
-
isAborted: xt,
|
|
3498
|
-
isDirty: kt,
|
|
3499
|
-
isValid: fe,
|
|
3500
|
-
isAsync: Ze,
|
|
3501
|
-
get util() {
|
|
3502
|
-
return E;
|
|
3503
|
-
},
|
|
3504
|
-
get objectUtil() {
|
|
3505
|
-
return bt;
|
|
3506
|
-
},
|
|
3507
|
-
ZodParsedType: m,
|
|
3508
|
-
getParsedType: te,
|
|
3509
|
-
ZodType: k,
|
|
3510
|
-
datetimeRegex: ur,
|
|
3511
|
-
ZodString: z,
|
|
3512
|
-
ZodNumber: se,
|
|
3513
|
-
ZodBigInt: ie,
|
|
3514
|
-
ZodBoolean: Ne,
|
|
3515
|
-
ZodDate: he,
|
|
3516
|
-
ZodSymbol: et,
|
|
3517
|
-
ZodUndefined: Ie,
|
|
3518
|
-
ZodNull: Pe,
|
|
3519
|
-
ZodAny: xe,
|
|
3520
|
-
ZodUnknown: le,
|
|
3521
|
-
ZodNever: re,
|
|
3522
|
-
ZodVoid: tt,
|
|
3523
|
-
ZodArray: U,
|
|
3524
|
-
ZodObject: O,
|
|
3525
|
-
ZodUnion: $e,
|
|
3526
|
-
ZodDiscriminatedUnion: at,
|
|
3527
|
-
ZodIntersection: De,
|
|
3528
|
-
ZodTuple: G,
|
|
3529
|
-
ZodRecord: Me,
|
|
3530
|
-
ZodMap: rt,
|
|
3531
|
-
ZodSet: pe,
|
|
3532
|
-
ZodFunction: _e,
|
|
3533
|
-
ZodLazy: Ve,
|
|
3534
|
-
ZodLiteral: Le,
|
|
3535
|
-
ZodEnum: oe,
|
|
3536
|
-
ZodNativeEnum: Fe,
|
|
3537
|
-
ZodPromise: ke,
|
|
3538
|
-
ZodEffects: W,
|
|
3539
|
-
ZodTransformer: W,
|
|
3540
|
-
ZodOptional: q,
|
|
3541
|
-
ZodNullable: ce,
|
|
3542
|
-
ZodDefault: ze,
|
|
3543
|
-
ZodCatch: Ue,
|
|
3544
|
-
ZodNaN: nt,
|
|
3545
|
-
BRAND: vn,
|
|
3546
|
-
ZodBranded: Tt,
|
|
3547
|
-
ZodPipeline: Be,
|
|
3548
|
-
ZodReadonly: We,
|
|
3549
|
-
custom: lr,
|
|
3550
|
-
Schema: k,
|
|
3551
|
-
ZodSchema: k,
|
|
3552
|
-
late: yn,
|
|
3553
|
-
get ZodFirstPartyTypeKind() {
|
|
3554
|
-
return g;
|
|
3555
|
-
},
|
|
3556
|
-
coerce: Xn,
|
|
3557
|
-
any: En,
|
|
3558
|
-
array: On,
|
|
3559
|
-
bigint: bn,
|
|
3560
|
-
boolean: pr,
|
|
3561
|
-
date: xn,
|
|
3562
|
-
discriminatedUnion: Nn,
|
|
3563
|
-
effect: er,
|
|
3564
|
-
enum: zn,
|
|
3565
|
-
function: Vn,
|
|
3566
|
-
instanceof: gn,
|
|
3567
|
-
intersection: In,
|
|
3568
|
-
lazy: Ln,
|
|
3569
|
-
literal: Fn,
|
|
3570
|
-
map: Dn,
|
|
3571
|
-
nan: _n,
|
|
3572
|
-
nativeEnum: Un,
|
|
3573
|
-
never: Sn,
|
|
3574
|
-
null: Tn,
|
|
3575
|
-
nullable: Yn,
|
|
3576
|
-
number: hr,
|
|
3577
|
-
object: jn,
|
|
3578
|
-
oboolean: Kn,
|
|
3579
|
-
onumber: Hn,
|
|
3580
|
-
optional: Bn,
|
|
3581
|
-
ostring: Gn,
|
|
3582
|
-
pipeline: Jn,
|
|
3583
|
-
preprocess: qn,
|
|
3584
|
-
promise: Wn,
|
|
3585
|
-
record: $n,
|
|
3586
|
-
set: Mn,
|
|
3587
|
-
strictObject: An,
|
|
3588
|
-
string: fr,
|
|
3589
|
-
symbol: kn,
|
|
3590
|
-
transformer: er,
|
|
3591
|
-
tuple: Pn,
|
|
3592
|
-
undefined: wn,
|
|
3593
|
-
union: Zn,
|
|
3594
|
-
unknown: Rn,
|
|
3595
|
-
void: Cn,
|
|
3596
|
-
NEVER: Qn,
|
|
3597
|
-
ZodIssueCode: d,
|
|
3598
|
-
quotelessJson: Br,
|
|
3599
|
-
ZodError: M
|
|
3600
|
-
});
|
|
3601
|
-
function ea(r) {
|
|
3602
|
-
const e = {};
|
|
3603
|
-
for (const [t, n] of Object.entries(r))
|
|
3604
|
-
t === "profile" && typeof n == "object" && n !== null && "customer" in n && "solution" in n ? e[t] = ee.object({
|
|
3605
|
-
customer: ee.string().describe(n.customer),
|
|
3606
|
-
solution: ee.string().describe(n.solution)
|
|
3607
|
-
}) : Array.isArray(n) ? e[t] = ee.array(ee.string()).describe(n.join(", ")) : typeof n == "string" && (e[t] = n.includes("|") ? ee.enum(n.split("|").map((a) => a.trim())).describe(n) : ee.string().describe(n));
|
|
3608
|
-
return ee.object(e);
|
|
3609
|
-
}
|
|
3610
|
-
function tr(r) {
|
|
3611
|
-
return ea(r);
|
|
3612
|
-
}
|
|
3613
|
-
function gt(r) {
|
|
3614
|
-
return r instanceof ee.ZodType;
|
|
3615
|
-
}
|
|
3616
|
-
const rr = (r = "gpt-4") => typeof r == "string" ? { provider: "openai", model: r } : r;
|
|
3617
|
-
function ra({
|
|
3618
|
-
children: r,
|
|
3619
|
-
prompt: e,
|
|
3620
|
-
schema: t,
|
|
3621
|
-
model: n = "gpt-4",
|
|
3622
|
-
output: a = "object",
|
|
3623
|
-
count: s,
|
|
3624
|
-
cols: o,
|
|
3625
|
-
mode: c = "json",
|
|
3626
|
-
stream: l = !1,
|
|
3627
|
-
apiEndpoint: f,
|
|
3628
|
-
headers: v,
|
|
3629
|
-
experimental_telemetry: S,
|
|
3630
|
-
experimental_providerMetadata: N,
|
|
3631
|
-
className: B,
|
|
3632
|
-
itemClassName: Ye,
|
|
3633
|
-
gap: st = "1rem"
|
|
3634
|
-
}) {
|
|
3635
|
-
const [we, Y] = Jt([]), [Z, it] = Jt(null), H = gt(t) ? t : tr(t), ot = a === "array" ? {
|
|
3636
|
-
display: "grid",
|
|
3637
|
-
gridTemplateColumns: `repeat(${o || 1}, minmax(0, 1fr))`,
|
|
3638
|
-
gap: st
|
|
3639
|
-
} : void 0;
|
|
3640
|
-
if (zr(() => {
|
|
3641
|
-
(async () => {
|
|
3642
|
-
try {
|
|
3643
|
-
const K = gt(H) ? H.describe("") : H, Te = gt(H) ? H : tr(H);
|
|
3644
|
-
if (l) {
|
|
3645
|
-
const { streamObject: V } = await import("ai"), ne = V({
|
|
3646
|
-
prompt: e,
|
|
3647
|
-
model: rr(n),
|
|
3648
|
-
schema: a === "array" ? { type: "array", items: K } : K,
|
|
3649
|
-
mode: c || "json",
|
|
3650
|
-
...S && { experimental_telemetry: S },
|
|
3651
|
-
...N && { experimental_providerMetadata: N },
|
|
3652
|
-
...f && { apiEndpoint: f },
|
|
3653
|
-
...v && { headers: v }
|
|
3654
|
-
});
|
|
3655
|
-
for await (const X of ne)
|
|
3656
|
-
if (X.object)
|
|
3657
|
-
try {
|
|
3658
|
-
if (a === "array") {
|
|
3659
|
-
const ae = Array.isArray(X.object) ? X.object : [X.object];
|
|
3660
|
-
Y(ae.map((L) => Te.parse(L)));
|
|
3661
|
-
} else
|
|
3662
|
-
Y([Te.parse(X.object)]);
|
|
3663
|
-
} catch (ae) {
|
|
3664
|
-
console.error("Error parsing chunk:", ae);
|
|
3665
|
-
}
|
|
3666
|
-
} else {
|
|
3667
|
-
const V = await fetch(f || "/api/generate", {
|
|
3668
|
-
method: "POST",
|
|
3669
|
-
headers: {
|
|
3670
|
-
"Content-Type": "application/json",
|
|
3671
|
-
...v || {}
|
|
3672
|
-
},
|
|
3673
|
-
body: JSON.stringify({
|
|
3674
|
-
prompt: e,
|
|
3675
|
-
model: rr(n),
|
|
3676
|
-
schema: a === "array" ? { type: "array", items: K } : K,
|
|
3677
|
-
mode: c || "json",
|
|
3678
|
-
...S && { experimental_telemetry: S },
|
|
3679
|
-
...N && { experimental_providerMetadata: N }
|
|
3680
|
-
})
|
|
3681
|
-
});
|
|
3682
|
-
if (!(V != null && V.ok))
|
|
3683
|
-
throw new Error(`HTTP error! status: ${V == null ? void 0 : V.status}`);
|
|
3684
|
-
const ne = await V.json(), X = a === "array" ? Array.isArray(ne.object) ? ne.object : [ne.object] : [ne.object];
|
|
3685
|
-
Y(X.map((ae) => Te.parse(ae)));
|
|
3686
|
-
}
|
|
3687
|
-
} catch (K) {
|
|
3688
|
-
it(K instanceof Error ? K : new Error("Unknown error"));
|
|
3689
|
-
}
|
|
3690
|
-
})();
|
|
3691
|
-
}, [e, H, n, a, s, o, c, S, N, l, f, v]), Z)
|
|
3692
|
-
throw Z;
|
|
3693
|
-
return we.length ? a === "array" ? /* @__PURE__ */ Kt.jsx("div", { style: ot, className: Xt("ai-grid", B), children: /* @__PURE__ */ Kt.jsx("div", { className: Xt("ai-grid-items", Ye), children: r(we) }) }) : r(we[0]) : null;
|
|
3694
|
-
}
|
|
3695
|
-
export {
|
|
3696
|
-
ra as AI
|
|
3697
|
-
};
|