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