@getopenpay/openpay-js-react 0.0.11 → 0.0.12-alpha.2ec8d17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +756 -744
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as
|
|
3
|
-
const
|
|
1
|
+
import gr, { createContext as vr, useContext as xr, useState as N, useMemo as Oe, useCallback as Te, useRef as Zt, useEffect as qe } from "react";
|
|
2
|
+
import { jsx as ie } from "react/jsx-runtime";
|
|
3
|
+
const jt = vr({
|
|
4
4
|
formId: "",
|
|
5
5
|
formHeight: "",
|
|
6
6
|
referer: void 0,
|
|
@@ -8,34 +8,34 @@ const Zt = gr({
|
|
|
8
8
|
registerIframe: () => {
|
|
9
9
|
},
|
|
10
10
|
baseUrl: ""
|
|
11
|
-
}),
|
|
12
|
-
const r =
|
|
11
|
+
}), br = () => {
|
|
12
|
+
const r = xr(jt);
|
|
13
13
|
if (!r)
|
|
14
14
|
throw new Error("useOpenPayElements must be used within an OpenPayElementsProvider");
|
|
15
15
|
return r;
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
return (
|
|
17
|
+
var I = [];
|
|
18
|
+
for (var ft = 0; ft < 256; ++ft)
|
|
19
|
+
I.push((ft + 256).toString(16).slice(1));
|
|
20
|
+
function kr(r, e = 0) {
|
|
21
|
+
return (I[r[e + 0]] + I[r[e + 1]] + I[r[e + 2]] + I[r[e + 3]] + "-" + I[r[e + 4]] + I[r[e + 5]] + "-" + I[r[e + 6]] + I[r[e + 7]] + "-" + I[r[e + 8]] + I[r[e + 9]] + "-" + I[r[e + 10]] + I[r[e + 11]] + I[r[e + 12]] + I[r[e + 13]] + I[r[e + 14]] + I[r[e + 15]]).toLowerCase();
|
|
22
22
|
}
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
if (!
|
|
23
|
+
var Be, wr = new Uint8Array(16);
|
|
24
|
+
function Er() {
|
|
25
|
+
if (!Be && (Be = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Be))
|
|
26
26
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
27
|
-
return
|
|
27
|
+
return Be(wr);
|
|
28
28
|
}
|
|
29
|
-
var
|
|
30
|
-
const
|
|
31
|
-
randomUUID:
|
|
29
|
+
var Tr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
30
|
+
const Ot = {
|
|
31
|
+
randomUUID: Tr
|
|
32
32
|
};
|
|
33
|
-
function
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
33
|
+
function Mt(r, e, t) {
|
|
34
|
+
if (Ot.randomUUID && !e && !r)
|
|
35
|
+
return Ot.randomUUID();
|
|
36
36
|
r = r || {};
|
|
37
|
-
var n = r.random || (r.rng ||
|
|
38
|
-
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128,
|
|
37
|
+
var n = r.random || (r.rng || Er)();
|
|
38
|
+
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, kr(n);
|
|
39
39
|
}
|
|
40
40
|
var x;
|
|
41
41
|
(function(r) {
|
|
@@ -73,14 +73,14 @@ var x;
|
|
|
73
73
|
}
|
|
74
74
|
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
75
75
|
})(x || (x = {}));
|
|
76
|
-
var
|
|
76
|
+
var pt;
|
|
77
77
|
(function(r) {
|
|
78
78
|
r.mergeShapes = (e, t) => ({
|
|
79
79
|
...e,
|
|
80
80
|
...t
|
|
81
81
|
// second overwrites first
|
|
82
82
|
});
|
|
83
|
-
})(
|
|
83
|
+
})(pt || (pt = {}));
|
|
84
84
|
const h = x.arrayToEnum([
|
|
85
85
|
"string",
|
|
86
86
|
"nan",
|
|
@@ -102,7 +102,7 @@ const h = x.arrayToEnum([
|
|
|
102
102
|
"never",
|
|
103
103
|
"map",
|
|
104
104
|
"set"
|
|
105
|
-
]),
|
|
105
|
+
]), ae = (r) => {
|
|
106
106
|
switch (typeof r) {
|
|
107
107
|
case "undefined":
|
|
108
108
|
return h.undefined;
|
|
@@ -140,8 +140,8 @@ const h = x.arrayToEnum([
|
|
|
140
140
|
"invalid_intersection_types",
|
|
141
141
|
"not_multiple_of",
|
|
142
142
|
"not_finite"
|
|
143
|
-
]),
|
|
144
|
-
class
|
|
143
|
+
]), Sr = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
144
|
+
class D extends Error {
|
|
145
145
|
constructor(e) {
|
|
146
146
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
147
147
|
this.issues = [...this.issues, n];
|
|
@@ -178,7 +178,7 @@ class M extends Error {
|
|
|
178
178
|
return s(this), n;
|
|
179
179
|
}
|
|
180
180
|
static assert(e) {
|
|
181
|
-
if (!(e instanceof
|
|
181
|
+
if (!(e instanceof D))
|
|
182
182
|
throw new Error(`Not a ZodError: ${e}`);
|
|
183
183
|
}
|
|
184
184
|
toString() {
|
|
@@ -200,8 +200,8 @@ class M extends Error {
|
|
|
200
200
|
return this.flatten();
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
const
|
|
203
|
+
D.create = (r) => new D(r);
|
|
204
|
+
const xe = (r, e) => {
|
|
205
205
|
let t;
|
|
206
206
|
switch (r.code) {
|
|
207
207
|
case d.invalid_type:
|
|
@@ -257,14 +257,14 @@ const _e = (r, e) => {
|
|
|
257
257
|
}
|
|
258
258
|
return { message: t };
|
|
259
259
|
};
|
|
260
|
-
let
|
|
261
|
-
function
|
|
262
|
-
|
|
260
|
+
let Dt = xe;
|
|
261
|
+
function Cr(r) {
|
|
262
|
+
Dt = r;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
264
|
+
function He() {
|
|
265
|
+
return Dt;
|
|
266
266
|
}
|
|
267
|
-
const
|
|
267
|
+
const Ke = (r) => {
|
|
268
268
|
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
|
|
269
269
|
...s,
|
|
270
270
|
path: a
|
|
@@ -284,9 +284,9 @@ const Ye = (r) => {
|
|
|
284
284
|
path: a,
|
|
285
285
|
message: o
|
|
286
286
|
};
|
|
287
|
-
},
|
|
288
|
-
function
|
|
289
|
-
const t =
|
|
287
|
+
}, Or = [];
|
|
288
|
+
function f(r, e) {
|
|
289
|
+
const t = He(), n = Ke({
|
|
290
290
|
issueData: e,
|
|
291
291
|
data: r.data,
|
|
292
292
|
path: r.path,
|
|
@@ -294,13 +294,13 @@ function l(r, e) {
|
|
|
294
294
|
r.common.contextualErrorMap,
|
|
295
295
|
r.schemaErrorMap,
|
|
296
296
|
t,
|
|
297
|
-
t ===
|
|
297
|
+
t === xe ? void 0 : xe
|
|
298
298
|
// then global default map
|
|
299
299
|
].filter((s) => !!s)
|
|
300
300
|
});
|
|
301
301
|
r.common.issues.push(n);
|
|
302
302
|
}
|
|
303
|
-
class
|
|
303
|
+
class P {
|
|
304
304
|
constructor() {
|
|
305
305
|
this.value = "valid";
|
|
306
306
|
}
|
|
@@ -314,7 +314,7 @@ class N {
|
|
|
314
314
|
const n = [];
|
|
315
315
|
for (const s of t) {
|
|
316
316
|
if (s.status === "aborted")
|
|
317
|
-
return
|
|
317
|
+
return _;
|
|
318
318
|
s.status === "dirty" && e.dirty(), n.push(s.value);
|
|
319
319
|
}
|
|
320
320
|
return { status: e.value, value: n };
|
|
@@ -328,27 +328,27 @@ class N {
|
|
|
328
328
|
value: i
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
return
|
|
331
|
+
return P.mergeObjectSync(e, n);
|
|
332
332
|
}
|
|
333
333
|
static mergeObjectSync(e, t) {
|
|
334
334
|
const n = {};
|
|
335
335
|
for (const s of t) {
|
|
336
336
|
const { key: a, value: i } = s;
|
|
337
337
|
if (a.status === "aborted" || i.status === "aborted")
|
|
338
|
-
return
|
|
338
|
+
return _;
|
|
339
339
|
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
|
|
340
340
|
}
|
|
341
341
|
return { status: e.value, value: n };
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
const
|
|
344
|
+
const _ = Object.freeze({
|
|
345
345
|
status: "aborted"
|
|
346
|
-
}),
|
|
347
|
-
function
|
|
346
|
+
}), ge = (r) => ({ status: "dirty", value: r }), A = (r) => ({ status: "valid", value: r }), mt = (r) => r.status === "aborted", yt = (r) => r.status === "dirty", Re = (r) => r.status === "valid", Ie = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
347
|
+
function Ye(r, e, t, n) {
|
|
348
348
|
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");
|
|
349
349
|
return e.get(r);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Ut(r, e, t, n, s) {
|
|
352
352
|
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
353
353
|
return e.set(r, t), t;
|
|
354
354
|
}
|
|
@@ -365,7 +365,7 @@ class Y {
|
|
|
365
365
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
const
|
|
368
|
+
const Rt = (r, e) => {
|
|
369
369
|
if (Re(e))
|
|
370
370
|
return { success: !0, data: e.value };
|
|
371
371
|
if (!r.common.issues.length)
|
|
@@ -375,7 +375,7 @@ const Ot = (r, e) => {
|
|
|
375
375
|
get error() {
|
|
376
376
|
if (this._error)
|
|
377
377
|
return this._error;
|
|
378
|
-
const t = new
|
|
378
|
+
const t = new D(r.common.issues);
|
|
379
379
|
return this._error = t, this._error;
|
|
380
380
|
}
|
|
381
381
|
};
|
|
@@ -392,7 +392,7 @@ function g(r) {
|
|
|
392
392
|
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (u = p ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = p ?? t) !== null && c !== void 0 ? c : o.defaultError };
|
|
393
393
|
}, description: s };
|
|
394
394
|
}
|
|
395
|
-
class
|
|
395
|
+
class v {
|
|
396
396
|
constructor(e) {
|
|
397
397
|
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this);
|
|
398
398
|
}
|
|
@@ -400,13 +400,13 @@ class _ {
|
|
|
400
400
|
return this._def.description;
|
|
401
401
|
}
|
|
402
402
|
_getType(e) {
|
|
403
|
-
return
|
|
403
|
+
return ae(e.data);
|
|
404
404
|
}
|
|
405
405
|
_getOrReturnCtx(e, t) {
|
|
406
406
|
return t || {
|
|
407
407
|
common: e.parent.common,
|
|
408
408
|
data: e.data,
|
|
409
|
-
parsedType:
|
|
409
|
+
parsedType: ae(e.data),
|
|
410
410
|
schemaErrorMap: this._def.errorMap,
|
|
411
411
|
path: e.path,
|
|
412
412
|
parent: e.parent
|
|
@@ -414,11 +414,11 @@ class _ {
|
|
|
414
414
|
}
|
|
415
415
|
_processInputParams(e) {
|
|
416
416
|
return {
|
|
417
|
-
status: new
|
|
417
|
+
status: new P(),
|
|
418
418
|
ctx: {
|
|
419
419
|
common: e.parent.common,
|
|
420
420
|
data: e.data,
|
|
421
|
-
parsedType:
|
|
421
|
+
parsedType: ae(e.data),
|
|
422
422
|
schemaErrorMap: this._def.errorMap,
|
|
423
423
|
path: e.path,
|
|
424
424
|
parent: e.parent
|
|
@@ -453,9 +453,9 @@ class _ {
|
|
|
453
453
|
schemaErrorMap: this._def.errorMap,
|
|
454
454
|
parent: null,
|
|
455
455
|
data: e,
|
|
456
|
-
parsedType:
|
|
456
|
+
parsedType: ae(e)
|
|
457
457
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
458
|
-
return
|
|
458
|
+
return Rt(s, a);
|
|
459
459
|
}
|
|
460
460
|
async parseAsync(e, t) {
|
|
461
461
|
const n = await this.safeParseAsync(e, t);
|
|
@@ -474,9 +474,9 @@ class _ {
|
|
|
474
474
|
schemaErrorMap: this._def.errorMap,
|
|
475
475
|
parent: null,
|
|
476
476
|
data: e,
|
|
477
|
-
parsedType:
|
|
477
|
+
parsedType: ae(e)
|
|
478
478
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (Ie(s) ? s : Promise.resolve(s));
|
|
479
|
-
return
|
|
479
|
+
return Rt(n, a);
|
|
480
480
|
}
|
|
481
481
|
refine(e, t) {
|
|
482
482
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
@@ -492,7 +492,7 @@ class _ {
|
|
|
492
492
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
|
|
493
493
|
}
|
|
494
494
|
_refinement(e) {
|
|
495
|
-
return new
|
|
495
|
+
return new W({
|
|
496
496
|
schema: this,
|
|
497
497
|
typeName: y.ZodEffects,
|
|
498
498
|
effect: { type: "refinement", refinement: e }
|
|
@@ -505,16 +505,16 @@ class _ {
|
|
|
505
505
|
return K.create(this, this._def);
|
|
506
506
|
}
|
|
507
507
|
nullable() {
|
|
508
|
-
return
|
|
508
|
+
return ue.create(this, this._def);
|
|
509
509
|
}
|
|
510
510
|
nullish() {
|
|
511
511
|
return this.nullable().optional();
|
|
512
512
|
}
|
|
513
513
|
array() {
|
|
514
|
-
return
|
|
514
|
+
return B.create(this, this._def);
|
|
515
515
|
}
|
|
516
516
|
promise() {
|
|
517
|
-
return
|
|
517
|
+
return ke.create(this, this._def);
|
|
518
518
|
}
|
|
519
519
|
or(e) {
|
|
520
520
|
return Ze.create([this, e], this._def);
|
|
@@ -523,7 +523,7 @@ class _ {
|
|
|
523
523
|
return je.create(this, e, this._def);
|
|
524
524
|
}
|
|
525
525
|
transform(e) {
|
|
526
|
-
return new
|
|
526
|
+
return new W({
|
|
527
527
|
...g(this._def),
|
|
528
528
|
schema: this,
|
|
529
529
|
typeName: y.ZodEffects,
|
|
@@ -540,7 +540,7 @@ class _ {
|
|
|
540
540
|
});
|
|
541
541
|
}
|
|
542
542
|
brand() {
|
|
543
|
-
return new
|
|
543
|
+
return new vt({
|
|
544
544
|
typeName: y.ZodBranded,
|
|
545
545
|
type: this,
|
|
546
546
|
...g(this._def)
|
|
@@ -575,39 +575,39 @@ class _ {
|
|
|
575
575
|
return this.safeParse(null).success;
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
|
-
const
|
|
579
|
-
let
|
|
580
|
-
const
|
|
581
|
-
function
|
|
578
|
+
const Rr = /^c[^\s-]{8,}$/i, Ir = /^[0-9a-z]+$/, Nr = /^[0-9A-HJKMNP-TV-Z]{26}$/, Pr = /^[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, Ar = /^[a-z0-9_-]{21}$/i, Zr = /^[-+]?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)?)??$/, jr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Mr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
579
|
+
let ht;
|
|
580
|
+
const Dr = /^(?:(?: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])$/, Ur = /^(([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})))$/, Lr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Lt = "((\\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])))", $r = new RegExp(`^${Lt}$`);
|
|
581
|
+
function $t(r) {
|
|
582
582
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
583
583
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
return new RegExp(`^${
|
|
585
|
+
function Vr(r) {
|
|
586
|
+
return new RegExp(`^${$t(r)}$`);
|
|
587
587
|
}
|
|
588
|
-
function
|
|
589
|
-
let e = `${Lt}T${
|
|
588
|
+
function Vt(r) {
|
|
589
|
+
let e = `${Lt}T${$t(r)}`;
|
|
590
590
|
const t = [];
|
|
591
591
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
592
592
|
}
|
|
593
|
-
function
|
|
594
|
-
return !!((e === "v4" || !e) &&
|
|
593
|
+
function zr(r, e) {
|
|
594
|
+
return !!((e === "v4" || !e) && Dr.test(r) || (e === "v6" || !e) && Ur.test(r));
|
|
595
595
|
}
|
|
596
|
-
class
|
|
596
|
+
class F extends v {
|
|
597
597
|
_parse(e) {
|
|
598
598
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
599
599
|
const a = this._getOrReturnCtx(e);
|
|
600
|
-
return
|
|
600
|
+
return f(a, {
|
|
601
601
|
code: d.invalid_type,
|
|
602
602
|
expected: h.string,
|
|
603
603
|
received: a.parsedType
|
|
604
|
-
}),
|
|
604
|
+
}), _;
|
|
605
605
|
}
|
|
606
|
-
const n = new
|
|
606
|
+
const n = new P();
|
|
607
607
|
let s;
|
|
608
608
|
for (const a of this._def.checks)
|
|
609
609
|
if (a.kind === "min")
|
|
610
|
-
e.data.length < a.value && (s = this._getOrReturnCtx(e, s),
|
|
610
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
611
611
|
code: d.too_small,
|
|
612
612
|
minimum: a.value,
|
|
613
613
|
type: "string",
|
|
@@ -616,7 +616,7 @@ class z extends _ {
|
|
|
616
616
|
message: a.message
|
|
617
617
|
}), n.dirty());
|
|
618
618
|
else if (a.kind === "max")
|
|
619
|
-
e.data.length > a.value && (s = this._getOrReturnCtx(e, s),
|
|
619
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
620
620
|
code: d.too_big,
|
|
621
621
|
maximum: a.value,
|
|
622
622
|
type: "string",
|
|
@@ -626,14 +626,14 @@ class z extends _ {
|
|
|
626
626
|
}), n.dirty());
|
|
627
627
|
else if (a.kind === "length") {
|
|
628
628
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
629
|
-
(i || o) && (s = this._getOrReturnCtx(e, s), i ?
|
|
629
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? f(s, {
|
|
630
630
|
code: d.too_big,
|
|
631
631
|
maximum: a.value,
|
|
632
632
|
type: "string",
|
|
633
633
|
inclusive: !0,
|
|
634
634
|
exact: !0,
|
|
635
635
|
message: a.message
|
|
636
|
-
}) : o &&
|
|
636
|
+
}) : o && f(s, {
|
|
637
637
|
code: d.too_small,
|
|
638
638
|
minimum: a.value,
|
|
639
639
|
type: "string",
|
|
@@ -642,43 +642,43 @@ class z extends _ {
|
|
|
642
642
|
message: a.message
|
|
643
643
|
}), n.dirty());
|
|
644
644
|
} else if (a.kind === "email")
|
|
645
|
-
|
|
645
|
+
jr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
646
646
|
validation: "email",
|
|
647
647
|
code: d.invalid_string,
|
|
648
648
|
message: a.message
|
|
649
649
|
}), n.dirty());
|
|
650
650
|
else if (a.kind === "emoji")
|
|
651
|
-
|
|
651
|
+
ht || (ht = new RegExp(Mr, "u")), ht.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
652
652
|
validation: "emoji",
|
|
653
653
|
code: d.invalid_string,
|
|
654
654
|
message: a.message
|
|
655
655
|
}), n.dirty());
|
|
656
656
|
else if (a.kind === "uuid")
|
|
657
|
-
|
|
657
|
+
Pr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
658
658
|
validation: "uuid",
|
|
659
659
|
code: d.invalid_string,
|
|
660
660
|
message: a.message
|
|
661
661
|
}), n.dirty());
|
|
662
662
|
else if (a.kind === "nanoid")
|
|
663
|
-
Ar.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
663
|
+
Ar.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
664
664
|
validation: "nanoid",
|
|
665
665
|
code: d.invalid_string,
|
|
666
666
|
message: a.message
|
|
667
667
|
}), n.dirty());
|
|
668
668
|
else if (a.kind === "cuid")
|
|
669
|
-
|
|
669
|
+
Rr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
670
670
|
validation: "cuid",
|
|
671
671
|
code: d.invalid_string,
|
|
672
672
|
message: a.message
|
|
673
673
|
}), n.dirty());
|
|
674
674
|
else if (a.kind === "cuid2")
|
|
675
|
-
|
|
675
|
+
Ir.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
676
676
|
validation: "cuid2",
|
|
677
677
|
code: d.invalid_string,
|
|
678
678
|
message: a.message
|
|
679
679
|
}), n.dirty());
|
|
680
680
|
else if (a.kind === "ulid")
|
|
681
|
-
|
|
681
|
+
Nr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
682
682
|
validation: "ulid",
|
|
683
683
|
code: d.invalid_string,
|
|
684
684
|
message: a.message
|
|
@@ -687,49 +687,49 @@ class z extends _ {
|
|
|
687
687
|
try {
|
|
688
688
|
new URL(e.data);
|
|
689
689
|
} catch {
|
|
690
|
-
s = this._getOrReturnCtx(e, s),
|
|
690
|
+
s = this._getOrReturnCtx(e, s), f(s, {
|
|
691
691
|
validation: "url",
|
|
692
692
|
code: d.invalid_string,
|
|
693
693
|
message: a.message
|
|
694
694
|
}), n.dirty();
|
|
695
695
|
}
|
|
696
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
696
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
697
697
|
validation: "regex",
|
|
698
698
|
code: d.invalid_string,
|
|
699
699
|
message: a.message
|
|
700
|
-
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s),
|
|
700
|
+
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
701
701
|
code: d.invalid_string,
|
|
702
702
|
validation: { includes: a.value, position: a.position },
|
|
703
703
|
message: a.message
|
|
704
|
-
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
704
|
+
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
705
705
|
code: d.invalid_string,
|
|
706
706
|
validation: { startsWith: a.value },
|
|
707
707
|
message: a.message
|
|
708
|
-
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
708
|
+
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
709
709
|
code: d.invalid_string,
|
|
710
710
|
validation: { endsWith: a.value },
|
|
711
711
|
message: a.message
|
|
712
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
712
|
+
}), n.dirty()) : a.kind === "datetime" ? Vt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
713
713
|
code: d.invalid_string,
|
|
714
714
|
validation: "datetime",
|
|
715
715
|
message: a.message
|
|
716
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
716
|
+
}), n.dirty()) : a.kind === "date" ? $r.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
717
717
|
code: d.invalid_string,
|
|
718
718
|
validation: "date",
|
|
719
719
|
message: a.message
|
|
720
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
720
|
+
}), n.dirty()) : a.kind === "time" ? Vr(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
721
721
|
code: d.invalid_string,
|
|
722
722
|
validation: "time",
|
|
723
723
|
message: a.message
|
|
724
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
724
|
+
}), n.dirty()) : a.kind === "duration" ? Zr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
725
725
|
validation: "duration",
|
|
726
726
|
code: d.invalid_string,
|
|
727
727
|
message: a.message
|
|
728
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
728
|
+
}), n.dirty()) : a.kind === "ip" ? zr(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
729
729
|
validation: "ip",
|
|
730
730
|
code: d.invalid_string,
|
|
731
731
|
message: a.message
|
|
732
|
-
}), n.dirty()) : a.kind === "base64" ? Lr.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
732
|
+
}), n.dirty()) : a.kind === "base64" ? Lr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
733
733
|
validation: "base64",
|
|
734
734
|
code: d.invalid_string,
|
|
735
735
|
message: a.message
|
|
@@ -744,7 +744,7 @@ class z extends _ {
|
|
|
744
744
|
});
|
|
745
745
|
}
|
|
746
746
|
_addCheck(e) {
|
|
747
|
-
return new
|
|
747
|
+
return new F({
|
|
748
748
|
...this._def,
|
|
749
749
|
checks: [...this._def.checks, e]
|
|
750
750
|
});
|
|
@@ -870,19 +870,19 @@ class z extends _ {
|
|
|
870
870
|
return this.min(1, m.errToObj(e));
|
|
871
871
|
}
|
|
872
872
|
trim() {
|
|
873
|
-
return new
|
|
873
|
+
return new F({
|
|
874
874
|
...this._def,
|
|
875
875
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
878
|
toLowerCase() {
|
|
879
|
-
return new
|
|
879
|
+
return new F({
|
|
880
880
|
...this._def,
|
|
881
881
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
882
882
|
});
|
|
883
883
|
}
|
|
884
884
|
toUpperCase() {
|
|
885
|
-
return new
|
|
885
|
+
return new F({
|
|
886
886
|
...this._def,
|
|
887
887
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
888
888
|
});
|
|
@@ -942,59 +942,59 @@ class z extends _ {
|
|
|
942
942
|
return e;
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
|
|
945
|
+
F.create = (r) => {
|
|
946
946
|
var e;
|
|
947
|
-
return new
|
|
947
|
+
return new F({
|
|
948
948
|
checks: [],
|
|
949
949
|
typeName: y.ZodString,
|
|
950
950
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
951
951
|
...g(r)
|
|
952
952
|
});
|
|
953
953
|
};
|
|
954
|
-
function
|
|
954
|
+
function Fr(r, e) {
|
|
955
955
|
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
956
956
|
return a % i / Math.pow(10, s);
|
|
957
957
|
}
|
|
958
|
-
class
|
|
958
|
+
class oe extends v {
|
|
959
959
|
constructor() {
|
|
960
960
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
961
961
|
}
|
|
962
962
|
_parse(e) {
|
|
963
963
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.number) {
|
|
964
964
|
const a = this._getOrReturnCtx(e);
|
|
965
|
-
return
|
|
965
|
+
return f(a, {
|
|
966
966
|
code: d.invalid_type,
|
|
967
967
|
expected: h.number,
|
|
968
968
|
received: a.parsedType
|
|
969
|
-
}),
|
|
969
|
+
}), _;
|
|
970
970
|
}
|
|
971
971
|
let n;
|
|
972
|
-
const s = new
|
|
972
|
+
const s = new P();
|
|
973
973
|
for (const a of this._def.checks)
|
|
974
|
-
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
974
|
+
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
|
|
975
975
|
code: d.invalid_type,
|
|
976
976
|
expected: "integer",
|
|
977
977
|
received: "float",
|
|
978
978
|
message: a.message
|
|
979
|
-
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
979
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
980
980
|
code: d.too_small,
|
|
981
981
|
minimum: a.value,
|
|
982
982
|
type: "number",
|
|
983
983
|
inclusive: a.inclusive,
|
|
984
984
|
exact: !1,
|
|
985
985
|
message: a.message
|
|
986
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
986
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
987
987
|
code: d.too_big,
|
|
988
988
|
maximum: a.value,
|
|
989
989
|
type: "number",
|
|
990
990
|
inclusive: a.inclusive,
|
|
991
991
|
exact: !1,
|
|
992
992
|
message: a.message
|
|
993
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
993
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Fr(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
994
994
|
code: d.not_multiple_of,
|
|
995
995
|
multipleOf: a.value,
|
|
996
996
|
message: a.message
|
|
997
|
-
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
997
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
|
|
998
998
|
code: d.not_finite,
|
|
999
999
|
message: a.message
|
|
1000
1000
|
}), s.dirty()) : x.assertNever(a);
|
|
@@ -1013,7 +1013,7 @@ class ce extends _ {
|
|
|
1013
1013
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1014
1014
|
}
|
|
1015
1015
|
setLimit(e, t, n, s) {
|
|
1016
|
-
return new
|
|
1016
|
+
return new oe({
|
|
1017
1017
|
...this._def,
|
|
1018
1018
|
checks: [
|
|
1019
1019
|
...this._def.checks,
|
|
@@ -1027,7 +1027,7 @@ class ce extends _ {
|
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
1029
|
_addCheck(e) {
|
|
1030
|
-
return new
|
|
1030
|
+
return new oe({
|
|
1031
1031
|
...this._def,
|
|
1032
1032
|
checks: [...this._def.checks, e]
|
|
1033
1033
|
});
|
|
@@ -1121,41 +1121,41 @@ class ce extends _ {
|
|
|
1121
1121
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
|
-
|
|
1124
|
+
oe.create = (r) => new oe({
|
|
1125
1125
|
checks: [],
|
|
1126
1126
|
typeName: y.ZodNumber,
|
|
1127
1127
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1128
1128
|
...g(r)
|
|
1129
1129
|
});
|
|
1130
|
-
class
|
|
1130
|
+
class ce extends v {
|
|
1131
1131
|
constructor() {
|
|
1132
1132
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1133
1133
|
}
|
|
1134
1134
|
_parse(e) {
|
|
1135
1135
|
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== h.bigint) {
|
|
1136
1136
|
const a = this._getOrReturnCtx(e);
|
|
1137
|
-
return
|
|
1137
|
+
return f(a, {
|
|
1138
1138
|
code: d.invalid_type,
|
|
1139
1139
|
expected: h.bigint,
|
|
1140
1140
|
received: a.parsedType
|
|
1141
|
-
}),
|
|
1141
|
+
}), _;
|
|
1142
1142
|
}
|
|
1143
1143
|
let n;
|
|
1144
|
-
const s = new
|
|
1144
|
+
const s = new P();
|
|
1145
1145
|
for (const a of this._def.checks)
|
|
1146
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1146
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1147
1147
|
code: d.too_small,
|
|
1148
1148
|
type: "bigint",
|
|
1149
1149
|
minimum: a.value,
|
|
1150
1150
|
inclusive: a.inclusive,
|
|
1151
1151
|
message: a.message
|
|
1152
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1152
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1153
1153
|
code: d.too_big,
|
|
1154
1154
|
type: "bigint",
|
|
1155
1155
|
maximum: a.value,
|
|
1156
1156
|
inclusive: a.inclusive,
|
|
1157
1157
|
message: a.message
|
|
1158
|
-
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n),
|
|
1158
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1159
1159
|
code: d.not_multiple_of,
|
|
1160
1160
|
multipleOf: a.value,
|
|
1161
1161
|
message: a.message
|
|
@@ -1175,7 +1175,7 @@ class de extends _ {
|
|
|
1175
1175
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1176
1176
|
}
|
|
1177
1177
|
setLimit(e, t, n, s) {
|
|
1178
|
-
return new
|
|
1178
|
+
return new ce({
|
|
1179
1179
|
...this._def,
|
|
1180
1180
|
checks: [
|
|
1181
1181
|
...this._def.checks,
|
|
@@ -1189,7 +1189,7 @@ class de extends _ {
|
|
|
1189
1189
|
});
|
|
1190
1190
|
}
|
|
1191
1191
|
_addCheck(e) {
|
|
1192
|
-
return new
|
|
1192
|
+
return new ce({
|
|
1193
1193
|
...this._def,
|
|
1194
1194
|
checks: [...this._def.checks, e]
|
|
1195
1195
|
});
|
|
@@ -1246,26 +1246,26 @@ class de extends _ {
|
|
|
1246
1246
|
return e;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
|
|
1249
|
+
ce.create = (r) => {
|
|
1250
1250
|
var e;
|
|
1251
|
-
return new
|
|
1251
|
+
return new ce({
|
|
1252
1252
|
checks: [],
|
|
1253
1253
|
typeName: y.ZodBigInt,
|
|
1254
1254
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1255
1255
|
...g(r)
|
|
1256
1256
|
});
|
|
1257
1257
|
};
|
|
1258
|
-
class Ne extends
|
|
1258
|
+
class Ne extends v {
|
|
1259
1259
|
_parse(e) {
|
|
1260
1260
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
1261
1261
|
const n = this._getOrReturnCtx(e);
|
|
1262
|
-
return
|
|
1262
|
+
return f(n, {
|
|
1263
1263
|
code: d.invalid_type,
|
|
1264
1264
|
expected: h.boolean,
|
|
1265
1265
|
received: n.parsedType
|
|
1266
|
-
}),
|
|
1266
|
+
}), _;
|
|
1267
1267
|
}
|
|
1268
|
-
return
|
|
1268
|
+
return A(e.data);
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
1271
|
Ne.create = (r) => new Ne({
|
|
@@ -1273,33 +1273,33 @@ Ne.create = (r) => new Ne({
|
|
|
1273
1273
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1274
1274
|
...g(r)
|
|
1275
1275
|
});
|
|
1276
|
-
class
|
|
1276
|
+
class pe extends v {
|
|
1277
1277
|
_parse(e) {
|
|
1278
1278
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
|
|
1279
1279
|
const a = this._getOrReturnCtx(e);
|
|
1280
|
-
return
|
|
1280
|
+
return f(a, {
|
|
1281
1281
|
code: d.invalid_type,
|
|
1282
1282
|
expected: h.date,
|
|
1283
1283
|
received: a.parsedType
|
|
1284
|
-
}),
|
|
1284
|
+
}), _;
|
|
1285
1285
|
}
|
|
1286
1286
|
if (isNaN(e.data.getTime())) {
|
|
1287
1287
|
const a = this._getOrReturnCtx(e);
|
|
1288
|
-
return
|
|
1288
|
+
return f(a, {
|
|
1289
1289
|
code: d.invalid_date
|
|
1290
|
-
}),
|
|
1290
|
+
}), _;
|
|
1291
1291
|
}
|
|
1292
|
-
const n = new
|
|
1292
|
+
const n = new P();
|
|
1293
1293
|
let s;
|
|
1294
1294
|
for (const a of this._def.checks)
|
|
1295
|
-
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s),
|
|
1295
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
1296
1296
|
code: d.too_small,
|
|
1297
1297
|
message: a.message,
|
|
1298
1298
|
inclusive: !0,
|
|
1299
1299
|
exact: !1,
|
|
1300
1300
|
minimum: a.value,
|
|
1301
1301
|
type: "date"
|
|
1302
|
-
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s),
|
|
1302
|
+
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
1303
1303
|
code: d.too_big,
|
|
1304
1304
|
message: a.message,
|
|
1305
1305
|
inclusive: !0,
|
|
@@ -1313,7 +1313,7 @@ class he extends _ {
|
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
1315
|
_addCheck(e) {
|
|
1316
|
-
return new
|
|
1316
|
+
return new pe({
|
|
1317
1317
|
...this._def,
|
|
1318
1318
|
checks: [...this._def.checks, e]
|
|
1319
1319
|
});
|
|
@@ -1345,130 +1345,130 @@ class he extends _ {
|
|
|
1345
1345
|
return e != null ? new Date(e) : null;
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
-
|
|
1348
|
+
pe.create = (r) => new pe({
|
|
1349
1349
|
checks: [],
|
|
1350
1350
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1351
1351
|
typeName: y.ZodDate,
|
|
1352
1352
|
...g(r)
|
|
1353
1353
|
});
|
|
1354
|
-
class
|
|
1354
|
+
class Je extends v {
|
|
1355
1355
|
_parse(e) {
|
|
1356
1356
|
if (this._getType(e) !== h.symbol) {
|
|
1357
1357
|
const n = this._getOrReturnCtx(e);
|
|
1358
|
-
return
|
|
1358
|
+
return f(n, {
|
|
1359
1359
|
code: d.invalid_type,
|
|
1360
1360
|
expected: h.symbol,
|
|
1361
1361
|
received: n.parsedType
|
|
1362
|
-
}),
|
|
1362
|
+
}), _;
|
|
1363
1363
|
}
|
|
1364
|
-
return
|
|
1364
|
+
return A(e.data);
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
|
-
|
|
1367
|
+
Je.create = (r) => new Je({
|
|
1368
1368
|
typeName: y.ZodSymbol,
|
|
1369
1369
|
...g(r)
|
|
1370
1370
|
});
|
|
1371
|
-
class
|
|
1371
|
+
class Pe extends v {
|
|
1372
1372
|
_parse(e) {
|
|
1373
1373
|
if (this._getType(e) !== h.undefined) {
|
|
1374
1374
|
const n = this._getOrReturnCtx(e);
|
|
1375
|
-
return
|
|
1375
|
+
return f(n, {
|
|
1376
1376
|
code: d.invalid_type,
|
|
1377
1377
|
expected: h.undefined,
|
|
1378
1378
|
received: n.parsedType
|
|
1379
|
-
}),
|
|
1379
|
+
}), _;
|
|
1380
1380
|
}
|
|
1381
|
-
return
|
|
1381
|
+
return A(e.data);
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
|
-
|
|
1384
|
+
Pe.create = (r) => new Pe({
|
|
1385
1385
|
typeName: y.ZodUndefined,
|
|
1386
1386
|
...g(r)
|
|
1387
1387
|
});
|
|
1388
|
-
class
|
|
1388
|
+
class Ae extends v {
|
|
1389
1389
|
_parse(e) {
|
|
1390
1390
|
if (this._getType(e) !== h.null) {
|
|
1391
1391
|
const n = this._getOrReturnCtx(e);
|
|
1392
|
-
return
|
|
1392
|
+
return f(n, {
|
|
1393
1393
|
code: d.invalid_type,
|
|
1394
1394
|
expected: h.null,
|
|
1395
1395
|
received: n.parsedType
|
|
1396
|
-
}),
|
|
1396
|
+
}), _;
|
|
1397
1397
|
}
|
|
1398
|
-
return
|
|
1398
|
+
return A(e.data);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
|
-
|
|
1401
|
+
Ae.create = (r) => new Ae({
|
|
1402
1402
|
typeName: y.ZodNull,
|
|
1403
1403
|
...g(r)
|
|
1404
1404
|
});
|
|
1405
|
-
class
|
|
1405
|
+
class be extends v {
|
|
1406
1406
|
constructor() {
|
|
1407
1407
|
super(...arguments), this._any = !0;
|
|
1408
1408
|
}
|
|
1409
1409
|
_parse(e) {
|
|
1410
|
-
return
|
|
1410
|
+
return A(e.data);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
|
-
|
|
1413
|
+
be.create = (r) => new be({
|
|
1414
1414
|
typeName: y.ZodAny,
|
|
1415
1415
|
...g(r)
|
|
1416
1416
|
});
|
|
1417
|
-
class
|
|
1417
|
+
class he extends v {
|
|
1418
1418
|
constructor() {
|
|
1419
1419
|
super(...arguments), this._unknown = !0;
|
|
1420
1420
|
}
|
|
1421
1421
|
_parse(e) {
|
|
1422
|
-
return
|
|
1422
|
+
return A(e.data);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
|
-
|
|
1425
|
+
he.create = (r) => new he({
|
|
1426
1426
|
typeName: y.ZodUnknown,
|
|
1427
1427
|
...g(r)
|
|
1428
1428
|
});
|
|
1429
|
-
class
|
|
1429
|
+
class re extends v {
|
|
1430
1430
|
_parse(e) {
|
|
1431
1431
|
const t = this._getOrReturnCtx(e);
|
|
1432
|
-
return
|
|
1432
|
+
return f(t, {
|
|
1433
1433
|
code: d.invalid_type,
|
|
1434
1434
|
expected: h.never,
|
|
1435
1435
|
received: t.parsedType
|
|
1436
|
-
}),
|
|
1436
|
+
}), _;
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
|
-
|
|
1439
|
+
re.create = (r) => new re({
|
|
1440
1440
|
typeName: y.ZodNever,
|
|
1441
1441
|
...g(r)
|
|
1442
1442
|
});
|
|
1443
|
-
class
|
|
1443
|
+
class Ge extends v {
|
|
1444
1444
|
_parse(e) {
|
|
1445
1445
|
if (this._getType(e) !== h.undefined) {
|
|
1446
1446
|
const n = this._getOrReturnCtx(e);
|
|
1447
|
-
return
|
|
1447
|
+
return f(n, {
|
|
1448
1448
|
code: d.invalid_type,
|
|
1449
1449
|
expected: h.void,
|
|
1450
1450
|
received: n.parsedType
|
|
1451
|
-
}),
|
|
1451
|
+
}), _;
|
|
1452
1452
|
}
|
|
1453
|
-
return
|
|
1453
|
+
return A(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
|
|
1456
|
+
Ge.create = (r) => new Ge({
|
|
1457
1457
|
typeName: y.ZodVoid,
|
|
1458
1458
|
...g(r)
|
|
1459
1459
|
});
|
|
1460
|
-
class
|
|
1460
|
+
class B extends v {
|
|
1461
1461
|
_parse(e) {
|
|
1462
1462
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1463
1463
|
if (t.parsedType !== h.array)
|
|
1464
|
-
return
|
|
1464
|
+
return f(t, {
|
|
1465
1465
|
code: d.invalid_type,
|
|
1466
1466
|
expected: h.array,
|
|
1467
1467
|
received: t.parsedType
|
|
1468
|
-
}),
|
|
1468
|
+
}), _;
|
|
1469
1469
|
if (s.exactLength !== null) {
|
|
1470
1470
|
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1471
|
-
(i || o) && (
|
|
1471
|
+
(i || o) && (f(t, {
|
|
1472
1472
|
code: i ? d.too_big : d.too_small,
|
|
1473
1473
|
minimum: o ? s.exactLength.value : void 0,
|
|
1474
1474
|
maximum: i ? s.exactLength.value : void 0,
|
|
@@ -1478,14 +1478,14 @@ class F extends _ {
|
|
|
1478
1478
|
message: s.exactLength.message
|
|
1479
1479
|
}), n.dirty());
|
|
1480
1480
|
}
|
|
1481
|
-
if (s.minLength !== null && t.data.length < s.minLength.value && (
|
|
1481
|
+
if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
|
|
1482
1482
|
code: d.too_small,
|
|
1483
1483
|
minimum: s.minLength.value,
|
|
1484
1484
|
type: "array",
|
|
1485
1485
|
inclusive: !0,
|
|
1486
1486
|
exact: !1,
|
|
1487
1487
|
message: s.minLength.message
|
|
1488
|
-
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (
|
|
1488
|
+
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
|
|
1489
1489
|
code: d.too_big,
|
|
1490
1490
|
maximum: s.maxLength.value,
|
|
1491
1491
|
type: "array",
|
|
@@ -1493,27 +1493,27 @@ class F extends _ {
|
|
|
1493
1493
|
exact: !1,
|
|
1494
1494
|
message: s.maxLength.message
|
|
1495
1495
|
}), n.dirty()), t.common.async)
|
|
1496
|
-
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new Y(t, i, t.path, o)))).then((i) =>
|
|
1496
|
+
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new Y(t, i, t.path, o)))).then((i) => P.mergeArray(n, i));
|
|
1497
1497
|
const a = [...t.data].map((i, o) => s.type._parseSync(new Y(t, i, t.path, o)));
|
|
1498
|
-
return
|
|
1498
|
+
return P.mergeArray(n, a);
|
|
1499
1499
|
}
|
|
1500
1500
|
get element() {
|
|
1501
1501
|
return this._def.type;
|
|
1502
1502
|
}
|
|
1503
1503
|
min(e, t) {
|
|
1504
|
-
return new
|
|
1504
|
+
return new B({
|
|
1505
1505
|
...this._def,
|
|
1506
1506
|
minLength: { value: e, message: m.toString(t) }
|
|
1507
1507
|
});
|
|
1508
1508
|
}
|
|
1509
1509
|
max(e, t) {
|
|
1510
|
-
return new
|
|
1510
|
+
return new B({
|
|
1511
1511
|
...this._def,
|
|
1512
1512
|
maxLength: { value: e, message: m.toString(t) }
|
|
1513
1513
|
});
|
|
1514
1514
|
}
|
|
1515
1515
|
length(e, t) {
|
|
1516
|
-
return new
|
|
1516
|
+
return new B({
|
|
1517
1517
|
...this._def,
|
|
1518
1518
|
exactLength: { value: e, message: m.toString(t) }
|
|
1519
1519
|
});
|
|
@@ -1522,7 +1522,7 @@ class F extends _ {
|
|
|
1522
1522
|
return this.min(1, e);
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
|
-
|
|
1525
|
+
B.create = (r, e) => new B({
|
|
1526
1526
|
type: r,
|
|
1527
1527
|
minLength: null,
|
|
1528
1528
|
maxLength: null,
|
|
@@ -1530,23 +1530,23 @@ F.create = (r, e) => new F({
|
|
|
1530
1530
|
typeName: y.ZodArray,
|
|
1531
1531
|
...g(e)
|
|
1532
1532
|
});
|
|
1533
|
-
function
|
|
1533
|
+
function _e(r) {
|
|
1534
1534
|
if (r instanceof E) {
|
|
1535
1535
|
const e = {};
|
|
1536
1536
|
for (const t in r.shape) {
|
|
1537
1537
|
const n = r.shape[t];
|
|
1538
|
-
e[t] = K.create(
|
|
1538
|
+
e[t] = K.create(_e(n));
|
|
1539
1539
|
}
|
|
1540
1540
|
return new E({
|
|
1541
1541
|
...r._def,
|
|
1542
1542
|
shape: () => e
|
|
1543
1543
|
});
|
|
1544
|
-
} else return r instanceof
|
|
1544
|
+
} else return r instanceof B ? new B({
|
|
1545
1545
|
...r._def,
|
|
1546
|
-
type:
|
|
1547
|
-
}) : r instanceof K ? K.create(
|
|
1546
|
+
type: _e(r.element)
|
|
1547
|
+
}) : r instanceof K ? K.create(_e(r.unwrap())) : r instanceof ue ? ue.create(_e(r.unwrap())) : r instanceof J ? J.create(r.items.map((e) => _e(e))) : r;
|
|
1548
1548
|
}
|
|
1549
|
-
class E extends
|
|
1549
|
+
class E extends v {
|
|
1550
1550
|
constructor() {
|
|
1551
1551
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1552
1552
|
}
|
|
@@ -1559,26 +1559,26 @@ class E extends _ {
|
|
|
1559
1559
|
_parse(e) {
|
|
1560
1560
|
if (this._getType(e) !== h.object) {
|
|
1561
1561
|
const c = this._getOrReturnCtx(e);
|
|
1562
|
-
return
|
|
1562
|
+
return f(c, {
|
|
1563
1563
|
code: d.invalid_type,
|
|
1564
1564
|
expected: h.object,
|
|
1565
1565
|
received: c.parsedType
|
|
1566
|
-
}),
|
|
1566
|
+
}), _;
|
|
1567
1567
|
}
|
|
1568
1568
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1569
|
-
if (!(this._def.catchall instanceof
|
|
1569
|
+
if (!(this._def.catchall instanceof re && this._def.unknownKeys === "strip"))
|
|
1570
1570
|
for (const c in s.data)
|
|
1571
1571
|
i.includes(c) || o.push(c);
|
|
1572
1572
|
const u = [];
|
|
1573
1573
|
for (const c of i) {
|
|
1574
|
-
const p = a[c],
|
|
1574
|
+
const p = a[c], k = s.data[c];
|
|
1575
1575
|
u.push({
|
|
1576
1576
|
key: { status: "valid", value: c },
|
|
1577
|
-
value: p._parse(new Y(s,
|
|
1577
|
+
value: p._parse(new Y(s, k, s.path, c)),
|
|
1578
1578
|
alwaysSet: c in s.data
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
1581
|
-
if (this._def.catchall instanceof
|
|
1581
|
+
if (this._def.catchall instanceof re) {
|
|
1582
1582
|
const c = this._def.unknownKeys;
|
|
1583
1583
|
if (c === "passthrough")
|
|
1584
1584
|
for (const p of o)
|
|
@@ -1587,7 +1587,7 @@ class E extends _ {
|
|
|
1587
1587
|
value: { status: "valid", value: s.data[p] }
|
|
1588
1588
|
});
|
|
1589
1589
|
else if (c === "strict")
|
|
1590
|
-
o.length > 0 && (
|
|
1590
|
+
o.length > 0 && (f(s, {
|
|
1591
1591
|
code: d.unrecognized_keys,
|
|
1592
1592
|
keys: o
|
|
1593
1593
|
}), n.dirty());
|
|
@@ -1595,11 +1595,11 @@ class E extends _ {
|
|
|
1595
1595
|
} else {
|
|
1596
1596
|
const c = this._def.catchall;
|
|
1597
1597
|
for (const p of o) {
|
|
1598
|
-
const
|
|
1598
|
+
const k = s.data[p];
|
|
1599
1599
|
u.push({
|
|
1600
1600
|
key: { status: "valid", value: p },
|
|
1601
1601
|
value: c._parse(
|
|
1602
|
-
new Y(s,
|
|
1602
|
+
new Y(s, k, s.path, p)
|
|
1603
1603
|
//, ctx.child(key), value, getParsedType(value)
|
|
1604
1604
|
),
|
|
1605
1605
|
alwaysSet: p in s.data
|
|
@@ -1609,15 +1609,15 @@ class E extends _ {
|
|
|
1609
1609
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1610
1610
|
const c = [];
|
|
1611
1611
|
for (const p of u) {
|
|
1612
|
-
const
|
|
1612
|
+
const k = await p.key, T = await p.value;
|
|
1613
1613
|
c.push({
|
|
1614
|
-
key:
|
|
1614
|
+
key: k,
|
|
1615
1615
|
value: T,
|
|
1616
1616
|
alwaysSet: p.alwaysSet
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
1619
1619
|
return c;
|
|
1620
|
-
}).then((c) =>
|
|
1620
|
+
}).then((c) => P.mergeObjectSync(n, c)) : P.mergeObjectSync(n, u);
|
|
1621
1621
|
}
|
|
1622
1622
|
get shape() {
|
|
1623
1623
|
return this._def.shape();
|
|
@@ -1780,7 +1780,7 @@ class E extends _ {
|
|
|
1780
1780
|
* @deprecated
|
|
1781
1781
|
*/
|
|
1782
1782
|
deepPartial() {
|
|
1783
|
-
return
|
|
1783
|
+
return _e(this);
|
|
1784
1784
|
}
|
|
1785
1785
|
partial(e) {
|
|
1786
1786
|
const t = {};
|
|
@@ -1809,31 +1809,31 @@ class E extends _ {
|
|
|
1809
1809
|
});
|
|
1810
1810
|
}
|
|
1811
1811
|
keyof() {
|
|
1812
|
-
return
|
|
1812
|
+
return zt(x.objectKeys(this.shape));
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
1815
|
E.create = (r, e) => new E({
|
|
1816
1816
|
shape: () => r,
|
|
1817
1817
|
unknownKeys: "strip",
|
|
1818
|
-
catchall:
|
|
1818
|
+
catchall: re.create(),
|
|
1819
1819
|
typeName: y.ZodObject,
|
|
1820
1820
|
...g(e)
|
|
1821
1821
|
});
|
|
1822
1822
|
E.strictCreate = (r, e) => new E({
|
|
1823
1823
|
shape: () => r,
|
|
1824
1824
|
unknownKeys: "strict",
|
|
1825
|
-
catchall:
|
|
1825
|
+
catchall: re.create(),
|
|
1826
1826
|
typeName: y.ZodObject,
|
|
1827
1827
|
...g(e)
|
|
1828
1828
|
});
|
|
1829
1829
|
E.lazycreate = (r, e) => new E({
|
|
1830
1830
|
shape: r,
|
|
1831
1831
|
unknownKeys: "strip",
|
|
1832
|
-
catchall:
|
|
1832
|
+
catchall: re.create(),
|
|
1833
1833
|
typeName: y.ZodObject,
|
|
1834
1834
|
...g(e)
|
|
1835
1835
|
});
|
|
1836
|
-
class Ze extends
|
|
1836
|
+
class Ze extends v {
|
|
1837
1837
|
_parse(e) {
|
|
1838
1838
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1839
1839
|
function s(a) {
|
|
@@ -1843,11 +1843,11 @@ class Ze extends _ {
|
|
|
1843
1843
|
for (const o of a)
|
|
1844
1844
|
if (o.result.status === "dirty")
|
|
1845
1845
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1846
|
-
const i = a.map((o) => new
|
|
1847
|
-
return
|
|
1846
|
+
const i = a.map((o) => new D(o.ctx.common.issues));
|
|
1847
|
+
return f(t, {
|
|
1848
1848
|
code: d.invalid_union,
|
|
1849
1849
|
unionErrors: i
|
|
1850
|
-
}),
|
|
1850
|
+
}), _;
|
|
1851
1851
|
}
|
|
1852
1852
|
if (t.common.async)
|
|
1853
1853
|
return Promise.all(n.map(async (a) => {
|
|
@@ -1890,11 +1890,11 @@ class Ze extends _ {
|
|
|
1890
1890
|
}
|
|
1891
1891
|
if (a)
|
|
1892
1892
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1893
|
-
const o = i.map((u) => new
|
|
1894
|
-
return
|
|
1893
|
+
const o = i.map((u) => new D(u));
|
|
1894
|
+
return f(t, {
|
|
1895
1895
|
code: d.invalid_union,
|
|
1896
1896
|
unionErrors: o
|
|
1897
|
-
}),
|
|
1897
|
+
}), _;
|
|
1898
1898
|
}
|
|
1899
1899
|
}
|
|
1900
1900
|
get options() {
|
|
@@ -1906,16 +1906,16 @@ Ze.create = (r, e) => new Ze({
|
|
|
1906
1906
|
typeName: y.ZodUnion,
|
|
1907
1907
|
...g(e)
|
|
1908
1908
|
});
|
|
1909
|
-
const
|
|
1910
|
-
class tt extends
|
|
1909
|
+
const te = (r) => r instanceof De ? te(r.schema) : r instanceof W ? te(r.innerType()) : r instanceof Ue ? [r.value] : r instanceof de ? r.options : r instanceof Le ? x.objectValues(r.enum) : r instanceof $e ? te(r._def.innerType) : r instanceof Pe ? [void 0] : r instanceof Ae ? [null] : r instanceof K ? [void 0, ...te(r.unwrap())] : r instanceof ue ? [null, ...te(r.unwrap())] : r instanceof vt || r instanceof ze ? te(r.unwrap()) : r instanceof Ve ? te(r._def.innerType) : [];
|
|
1910
|
+
class tt extends v {
|
|
1911
1911
|
_parse(e) {
|
|
1912
1912
|
const { ctx: t } = this._processInputParams(e);
|
|
1913
1913
|
if (t.parsedType !== h.object)
|
|
1914
|
-
return
|
|
1914
|
+
return f(t, {
|
|
1915
1915
|
code: d.invalid_type,
|
|
1916
1916
|
expected: h.object,
|
|
1917
1917
|
received: t.parsedType
|
|
1918
|
-
}),
|
|
1918
|
+
}), _;
|
|
1919
1919
|
const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
|
|
1920
1920
|
return a ? t.common.async ? a._parseAsync({
|
|
1921
1921
|
data: t.data,
|
|
@@ -1925,11 +1925,11 @@ class tt extends _ {
|
|
|
1925
1925
|
data: t.data,
|
|
1926
1926
|
path: t.path,
|
|
1927
1927
|
parent: t
|
|
1928
|
-
}) : (
|
|
1928
|
+
}) : (f(t, {
|
|
1929
1929
|
code: d.invalid_union_discriminator,
|
|
1930
1930
|
options: Array.from(this.optionsMap.keys()),
|
|
1931
1931
|
path: [n]
|
|
1932
|
-
}),
|
|
1932
|
+
}), _);
|
|
1933
1933
|
}
|
|
1934
1934
|
get discriminator() {
|
|
1935
1935
|
return this._def.discriminator;
|
|
@@ -1951,7 +1951,7 @@ class tt extends _ {
|
|
|
1951
1951
|
static create(e, t, n) {
|
|
1952
1952
|
const s = /* @__PURE__ */ new Map();
|
|
1953
1953
|
for (const a of t) {
|
|
1954
|
-
const i =
|
|
1954
|
+
const i = te(a.shape[e]);
|
|
1955
1955
|
if (!i.length)
|
|
1956
1956
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1957
1957
|
for (const o of i) {
|
|
@@ -1969,14 +1969,14 @@ class tt extends _ {
|
|
|
1969
1969
|
});
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
|
-
function
|
|
1973
|
-
const t =
|
|
1972
|
+
function _t(r, e) {
|
|
1973
|
+
const t = ae(r), n = ae(e);
|
|
1974
1974
|
if (r === e)
|
|
1975
1975
|
return { valid: !0, data: r };
|
|
1976
1976
|
if (t === h.object && n === h.object) {
|
|
1977
1977
|
const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
1978
1978
|
for (const o of a) {
|
|
1979
|
-
const u =
|
|
1979
|
+
const u = _t(r[o], e[o]);
|
|
1980
1980
|
if (!u.valid)
|
|
1981
1981
|
return { valid: !1 };
|
|
1982
1982
|
i[o] = u.data;
|
|
@@ -1987,7 +1987,7 @@ function pt(r, e) {
|
|
|
1987
1987
|
return { valid: !1 };
|
|
1988
1988
|
const s = [];
|
|
1989
1989
|
for (let a = 0; a < r.length; a++) {
|
|
1990
|
-
const i = r[a], o = e[a], u =
|
|
1990
|
+
const i = r[a], o = e[a], u = _t(i, o);
|
|
1991
1991
|
if (!u.valid)
|
|
1992
1992
|
return { valid: !1 };
|
|
1993
1993
|
s.push(u.data);
|
|
@@ -1995,15 +1995,15 @@ function pt(r, e) {
|
|
|
1995
1995
|
return { valid: !0, data: s };
|
|
1996
1996
|
} else return t === h.date && n === h.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
1997
1997
|
}
|
|
1998
|
-
class je extends
|
|
1998
|
+
class je extends v {
|
|
1999
1999
|
_parse(e) {
|
|
2000
2000
|
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2001
|
-
if (
|
|
2002
|
-
return
|
|
2003
|
-
const o =
|
|
2004
|
-
return o.valid ? ((
|
|
2001
|
+
if (mt(a) || mt(i))
|
|
2002
|
+
return _;
|
|
2003
|
+
const o = _t(a.value, i.value);
|
|
2004
|
+
return o.valid ? ((yt(a) || yt(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(n, {
|
|
2005
2005
|
code: d.invalid_intersection_types
|
|
2006
|
-
}),
|
|
2006
|
+
}), _);
|
|
2007
2007
|
};
|
|
2008
2008
|
return n.common.async ? Promise.all([
|
|
2009
2009
|
this._def.left._parseAsync({
|
|
@@ -2033,24 +2033,24 @@ je.create = (r, e, t) => new je({
|
|
|
2033
2033
|
typeName: y.ZodIntersection,
|
|
2034
2034
|
...g(t)
|
|
2035
2035
|
});
|
|
2036
|
-
class J extends
|
|
2036
|
+
class J extends v {
|
|
2037
2037
|
_parse(e) {
|
|
2038
2038
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2039
2039
|
if (n.parsedType !== h.array)
|
|
2040
|
-
return
|
|
2040
|
+
return f(n, {
|
|
2041
2041
|
code: d.invalid_type,
|
|
2042
2042
|
expected: h.array,
|
|
2043
2043
|
received: n.parsedType
|
|
2044
|
-
}),
|
|
2044
|
+
}), _;
|
|
2045
2045
|
if (n.data.length < this._def.items.length)
|
|
2046
|
-
return
|
|
2046
|
+
return f(n, {
|
|
2047
2047
|
code: d.too_small,
|
|
2048
2048
|
minimum: this._def.items.length,
|
|
2049
2049
|
inclusive: !0,
|
|
2050
2050
|
exact: !1,
|
|
2051
2051
|
type: "array"
|
|
2052
|
-
}),
|
|
2053
|
-
!this._def.rest && n.data.length > this._def.items.length && (
|
|
2052
|
+
}), _;
|
|
2053
|
+
!this._def.rest && n.data.length > this._def.items.length && (f(n, {
|
|
2054
2054
|
code: d.too_big,
|
|
2055
2055
|
maximum: this._def.items.length,
|
|
2056
2056
|
inclusive: !0,
|
|
@@ -2061,7 +2061,7 @@ class J extends _ {
|
|
|
2061
2061
|
const u = this._def.items[o] || this._def.rest;
|
|
2062
2062
|
return u ? u._parse(new Y(n, i, n.path, o)) : null;
|
|
2063
2063
|
}).filter((i) => !!i);
|
|
2064
|
-
return n.common.async ? Promise.all(a).then((i) =>
|
|
2064
|
+
return n.common.async ? Promise.all(a).then((i) => P.mergeArray(t, i)) : P.mergeArray(t, a);
|
|
2065
2065
|
}
|
|
2066
2066
|
get items() {
|
|
2067
2067
|
return this._def.items;
|
|
@@ -2083,7 +2083,7 @@ J.create = (r, e) => {
|
|
|
2083
2083
|
...g(e)
|
|
2084
2084
|
});
|
|
2085
2085
|
};
|
|
2086
|
-
class Me extends
|
|
2086
|
+
class Me extends v {
|
|
2087
2087
|
get keySchema() {
|
|
2088
2088
|
return this._def.keyType;
|
|
2089
2089
|
}
|
|
@@ -2093,11 +2093,11 @@ class Me extends _ {
|
|
|
2093
2093
|
_parse(e) {
|
|
2094
2094
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2095
2095
|
if (n.parsedType !== h.object)
|
|
2096
|
-
return
|
|
2096
|
+
return f(n, {
|
|
2097
2097
|
code: d.invalid_type,
|
|
2098
2098
|
expected: h.object,
|
|
2099
2099
|
received: n.parsedType
|
|
2100
|
-
}),
|
|
2100
|
+
}), _;
|
|
2101
2101
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2102
2102
|
for (const o in n.data)
|
|
2103
2103
|
s.push({
|
|
@@ -2105,26 +2105,26 @@ class Me extends _ {
|
|
|
2105
2105
|
value: i._parse(new Y(n, n.data[o], n.path, o)),
|
|
2106
2106
|
alwaysSet: o in n.data
|
|
2107
2107
|
});
|
|
2108
|
-
return n.common.async ?
|
|
2108
|
+
return n.common.async ? P.mergeObjectAsync(t, s) : P.mergeObjectSync(t, s);
|
|
2109
2109
|
}
|
|
2110
2110
|
get element() {
|
|
2111
2111
|
return this._def.valueType;
|
|
2112
2112
|
}
|
|
2113
2113
|
static create(e, t, n) {
|
|
2114
|
-
return t instanceof
|
|
2114
|
+
return t instanceof v ? new Me({
|
|
2115
2115
|
keyType: e,
|
|
2116
2116
|
valueType: t,
|
|
2117
2117
|
typeName: y.ZodRecord,
|
|
2118
2118
|
...g(n)
|
|
2119
2119
|
}) : new Me({
|
|
2120
|
-
keyType:
|
|
2120
|
+
keyType: F.create(),
|
|
2121
2121
|
valueType: e,
|
|
2122
2122
|
typeName: y.ZodRecord,
|
|
2123
2123
|
...g(t)
|
|
2124
2124
|
});
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
|
-
class
|
|
2127
|
+
class Xe extends v {
|
|
2128
2128
|
get keySchema() {
|
|
2129
2129
|
return this._def.keyType;
|
|
2130
2130
|
}
|
|
@@ -2134,11 +2134,11 @@ class Qe extends _ {
|
|
|
2134
2134
|
_parse(e) {
|
|
2135
2135
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2136
2136
|
if (n.parsedType !== h.map)
|
|
2137
|
-
return
|
|
2137
|
+
return f(n, {
|
|
2138
2138
|
code: d.invalid_type,
|
|
2139
2139
|
expected: h.map,
|
|
2140
2140
|
received: n.parsedType
|
|
2141
|
-
}),
|
|
2141
|
+
}), _;
|
|
2142
2142
|
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], c) => ({
|
|
2143
2143
|
key: s._parse(new Y(n, o, n.path, [c, "key"])),
|
|
2144
2144
|
value: a._parse(new Y(n, u, n.path, [c, "value"]))
|
|
@@ -2149,7 +2149,7 @@ class Qe extends _ {
|
|
|
2149
2149
|
for (const u of i) {
|
|
2150
2150
|
const c = await u.key, p = await u.value;
|
|
2151
2151
|
if (c.status === "aborted" || p.status === "aborted")
|
|
2152
|
-
return
|
|
2152
|
+
return _;
|
|
2153
2153
|
(c.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(c.value, p.value);
|
|
2154
2154
|
}
|
|
2155
2155
|
return { status: t.value, value: o };
|
|
@@ -2159,37 +2159,37 @@ class Qe extends _ {
|
|
|
2159
2159
|
for (const u of i) {
|
|
2160
2160
|
const c = u.key, p = u.value;
|
|
2161
2161
|
if (c.status === "aborted" || p.status === "aborted")
|
|
2162
|
-
return
|
|
2162
|
+
return _;
|
|
2163
2163
|
(c.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(c.value, p.value);
|
|
2164
2164
|
}
|
|
2165
2165
|
return { status: t.value, value: o };
|
|
2166
2166
|
}
|
|
2167
2167
|
}
|
|
2168
2168
|
}
|
|
2169
|
-
|
|
2169
|
+
Xe.create = (r, e, t) => new Xe({
|
|
2170
2170
|
valueType: e,
|
|
2171
2171
|
keyType: r,
|
|
2172
2172
|
typeName: y.ZodMap,
|
|
2173
2173
|
...g(t)
|
|
2174
2174
|
});
|
|
2175
|
-
class
|
|
2175
|
+
class me extends v {
|
|
2176
2176
|
_parse(e) {
|
|
2177
2177
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2178
2178
|
if (n.parsedType !== h.set)
|
|
2179
|
-
return
|
|
2179
|
+
return f(n, {
|
|
2180
2180
|
code: d.invalid_type,
|
|
2181
2181
|
expected: h.set,
|
|
2182
2182
|
received: n.parsedType
|
|
2183
|
-
}),
|
|
2183
|
+
}), _;
|
|
2184
2184
|
const s = this._def;
|
|
2185
|
-
s.minSize !== null && n.data.size < s.minSize.value && (
|
|
2185
|
+
s.minSize !== null && n.data.size < s.minSize.value && (f(n, {
|
|
2186
2186
|
code: d.too_small,
|
|
2187
2187
|
minimum: s.minSize.value,
|
|
2188
2188
|
type: "set",
|
|
2189
2189
|
inclusive: !0,
|
|
2190
2190
|
exact: !1,
|
|
2191
2191
|
message: s.minSize.message
|
|
2192
|
-
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (
|
|
2192
|
+
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (f(n, {
|
|
2193
2193
|
code: d.too_big,
|
|
2194
2194
|
maximum: s.maxSize.value,
|
|
2195
2195
|
type: "set",
|
|
@@ -2202,7 +2202,7 @@ class pe extends _ {
|
|
|
2202
2202
|
const c = /* @__PURE__ */ new Set();
|
|
2203
2203
|
for (const p of u) {
|
|
2204
2204
|
if (p.status === "aborted")
|
|
2205
|
-
return
|
|
2205
|
+
return _;
|
|
2206
2206
|
p.status === "dirty" && t.dirty(), c.add(p.value);
|
|
2207
2207
|
}
|
|
2208
2208
|
return { status: t.value, value: c };
|
|
@@ -2211,13 +2211,13 @@ class pe extends _ {
|
|
|
2211
2211
|
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2212
2212
|
}
|
|
2213
2213
|
min(e, t) {
|
|
2214
|
-
return new
|
|
2214
|
+
return new me({
|
|
2215
2215
|
...this._def,
|
|
2216
2216
|
minSize: { value: e, message: m.toString(t) }
|
|
2217
2217
|
});
|
|
2218
2218
|
}
|
|
2219
2219
|
max(e, t) {
|
|
2220
|
-
return new
|
|
2220
|
+
return new me({
|
|
2221
2221
|
...this._def,
|
|
2222
2222
|
maxSize: { value: e, message: m.toString(t) }
|
|
2223
2223
|
});
|
|
@@ -2229,34 +2229,34 @@ class pe extends _ {
|
|
|
2229
2229
|
return this.min(1, e);
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
|
-
|
|
2232
|
+
me.create = (r, e) => new me({
|
|
2233
2233
|
valueType: r,
|
|
2234
2234
|
minSize: null,
|
|
2235
2235
|
maxSize: null,
|
|
2236
2236
|
typeName: y.ZodSet,
|
|
2237
2237
|
...g(e)
|
|
2238
2238
|
});
|
|
2239
|
-
class
|
|
2239
|
+
class ve extends v {
|
|
2240
2240
|
constructor() {
|
|
2241
2241
|
super(...arguments), this.validate = this.implement;
|
|
2242
2242
|
}
|
|
2243
2243
|
_parse(e) {
|
|
2244
2244
|
const { ctx: t } = this._processInputParams(e);
|
|
2245
2245
|
if (t.parsedType !== h.function)
|
|
2246
|
-
return
|
|
2246
|
+
return f(t, {
|
|
2247
2247
|
code: d.invalid_type,
|
|
2248
2248
|
expected: h.function,
|
|
2249
2249
|
received: t.parsedType
|
|
2250
|
-
}),
|
|
2250
|
+
}), _;
|
|
2251
2251
|
function n(o, u) {
|
|
2252
|
-
return
|
|
2252
|
+
return Ke({
|
|
2253
2253
|
data: o,
|
|
2254
2254
|
path: t.path,
|
|
2255
2255
|
errorMaps: [
|
|
2256
2256
|
t.common.contextualErrorMap,
|
|
2257
2257
|
t.schemaErrorMap,
|
|
2258
|
-
|
|
2259
|
-
|
|
2258
|
+
He(),
|
|
2259
|
+
xe
|
|
2260
2260
|
].filter((c) => !!c),
|
|
2261
2261
|
issueData: {
|
|
2262
2262
|
code: d.invalid_arguments,
|
|
@@ -2265,14 +2265,14 @@ class ge extends _ {
|
|
|
2265
2265
|
});
|
|
2266
2266
|
}
|
|
2267
2267
|
function s(o, u) {
|
|
2268
|
-
return
|
|
2268
|
+
return Ke({
|
|
2269
2269
|
data: o,
|
|
2270
2270
|
path: t.path,
|
|
2271
2271
|
errorMaps: [
|
|
2272
2272
|
t.common.contextualErrorMap,
|
|
2273
2273
|
t.schemaErrorMap,
|
|
2274
|
-
|
|
2275
|
-
|
|
2274
|
+
He(),
|
|
2275
|
+
xe
|
|
2276
2276
|
].filter((c) => !!c),
|
|
2277
2277
|
issueData: {
|
|
2278
2278
|
code: d.invalid_return_type,
|
|
@@ -2281,26 +2281,26 @@ class ge extends _ {
|
|
|
2281
2281
|
});
|
|
2282
2282
|
}
|
|
2283
2283
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2284
|
-
if (this._def.returns instanceof
|
|
2284
|
+
if (this._def.returns instanceof ke) {
|
|
2285
2285
|
const o = this;
|
|
2286
|
-
return
|
|
2287
|
-
const c = new
|
|
2288
|
-
throw c.addIssue(n(u,
|
|
2289
|
-
}),
|
|
2290
|
-
return await o._def.returns._def.type.parseAsync(
|
|
2291
|
-
throw c.addIssue(s(
|
|
2286
|
+
return A(async function(...u) {
|
|
2287
|
+
const c = new D([]), p = await o._def.args.parseAsync(u, a).catch(($) => {
|
|
2288
|
+
throw c.addIssue(n(u, $)), c;
|
|
2289
|
+
}), k = await Reflect.apply(i, this, p);
|
|
2290
|
+
return await o._def.returns._def.type.parseAsync(k, a).catch(($) => {
|
|
2291
|
+
throw c.addIssue(s(k, $)), c;
|
|
2292
2292
|
});
|
|
2293
2293
|
});
|
|
2294
2294
|
} else {
|
|
2295
2295
|
const o = this;
|
|
2296
|
-
return
|
|
2296
|
+
return A(function(...u) {
|
|
2297
2297
|
const c = o._def.args.safeParse(u, a);
|
|
2298
2298
|
if (!c.success)
|
|
2299
|
-
throw new
|
|
2300
|
-
const p = Reflect.apply(i, this, c.data),
|
|
2301
|
-
if (!
|
|
2302
|
-
throw new
|
|
2303
|
-
return
|
|
2299
|
+
throw new D([n(u, c.error)]);
|
|
2300
|
+
const p = Reflect.apply(i, this, c.data), k = o._def.returns.safeParse(p, a);
|
|
2301
|
+
if (!k.success)
|
|
2302
|
+
throw new D([s(p, k.error)]);
|
|
2303
|
+
return k.data;
|
|
2304
2304
|
});
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
@@ -2311,13 +2311,13 @@ class ge extends _ {
|
|
|
2311
2311
|
return this._def.returns;
|
|
2312
2312
|
}
|
|
2313
2313
|
args(...e) {
|
|
2314
|
-
return new
|
|
2314
|
+
return new ve({
|
|
2315
2315
|
...this._def,
|
|
2316
|
-
args: J.create(e).rest(
|
|
2316
|
+
args: J.create(e).rest(he.create())
|
|
2317
2317
|
});
|
|
2318
2318
|
}
|
|
2319
2319
|
returns(e) {
|
|
2320
|
-
return new
|
|
2320
|
+
return new ve({
|
|
2321
2321
|
...this._def,
|
|
2322
2322
|
returns: e
|
|
2323
2323
|
});
|
|
@@ -2329,15 +2329,15 @@ class ge extends _ {
|
|
|
2329
2329
|
return this.parse(e);
|
|
2330
2330
|
}
|
|
2331
2331
|
static create(e, t, n) {
|
|
2332
|
-
return new
|
|
2333
|
-
args: e || J.create([]).rest(
|
|
2334
|
-
returns: t ||
|
|
2332
|
+
return new ve({
|
|
2333
|
+
args: e || J.create([]).rest(he.create()),
|
|
2334
|
+
returns: t || he.create(),
|
|
2335
2335
|
typeName: y.ZodFunction,
|
|
2336
2336
|
...g(n)
|
|
2337
2337
|
});
|
|
2338
2338
|
}
|
|
2339
2339
|
}
|
|
2340
|
-
class De extends
|
|
2340
|
+
class De extends v {
|
|
2341
2341
|
get schema() {
|
|
2342
2342
|
return this._def.getter();
|
|
2343
2343
|
}
|
|
@@ -2351,15 +2351,15 @@ De.create = (r, e) => new De({
|
|
|
2351
2351
|
typeName: y.ZodLazy,
|
|
2352
2352
|
...g(e)
|
|
2353
2353
|
});
|
|
2354
|
-
class
|
|
2354
|
+
class Ue extends v {
|
|
2355
2355
|
_parse(e) {
|
|
2356
2356
|
if (e.data !== this._def.value) {
|
|
2357
2357
|
const t = this._getOrReturnCtx(e);
|
|
2358
|
-
return
|
|
2358
|
+
return f(t, {
|
|
2359
2359
|
received: t.data,
|
|
2360
2360
|
code: d.invalid_literal,
|
|
2361
2361
|
expected: this._def.value
|
|
2362
|
-
}),
|
|
2362
|
+
}), _;
|
|
2363
2363
|
}
|
|
2364
2364
|
return { status: "valid", value: e.data };
|
|
2365
2365
|
}
|
|
@@ -2367,40 +2367,40 @@ class Le extends _ {
|
|
|
2367
2367
|
return this._def.value;
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
|
-
|
|
2370
|
+
Ue.create = (r, e) => new Ue({
|
|
2371
2371
|
value: r,
|
|
2372
2372
|
typeName: y.ZodLiteral,
|
|
2373
2373
|
...g(e)
|
|
2374
2374
|
});
|
|
2375
|
-
function
|
|
2376
|
-
return new
|
|
2375
|
+
function zt(r, e) {
|
|
2376
|
+
return new de({
|
|
2377
2377
|
values: r,
|
|
2378
2378
|
typeName: y.ZodEnum,
|
|
2379
2379
|
...g(e)
|
|
2380
2380
|
});
|
|
2381
2381
|
}
|
|
2382
|
-
class
|
|
2382
|
+
class de extends v {
|
|
2383
2383
|
constructor() {
|
|
2384
2384
|
super(...arguments), Se.set(this, void 0);
|
|
2385
2385
|
}
|
|
2386
2386
|
_parse(e) {
|
|
2387
2387
|
if (typeof e.data != "string") {
|
|
2388
2388
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2389
|
-
return
|
|
2389
|
+
return f(t, {
|
|
2390
2390
|
expected: x.joinValues(n),
|
|
2391
2391
|
received: t.parsedType,
|
|
2392
2392
|
code: d.invalid_type
|
|
2393
|
-
}),
|
|
2393
|
+
}), _;
|
|
2394
2394
|
}
|
|
2395
|
-
if (
|
|
2395
|
+
if (Ye(this, Se) || Ut(this, Se, new Set(this._def.values)), !Ye(this, Se).has(e.data)) {
|
|
2396
2396
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2397
|
-
return
|
|
2397
|
+
return f(t, {
|
|
2398
2398
|
received: t.data,
|
|
2399
2399
|
code: d.invalid_enum_value,
|
|
2400
2400
|
options: n
|
|
2401
|
-
}),
|
|
2401
|
+
}), _;
|
|
2402
2402
|
}
|
|
2403
|
-
return
|
|
2403
|
+
return A(e.data);
|
|
2404
2404
|
}
|
|
2405
2405
|
get options() {
|
|
2406
2406
|
return this._def.values;
|
|
@@ -2424,21 +2424,21 @@ class ue extends _ {
|
|
|
2424
2424
|
return e;
|
|
2425
2425
|
}
|
|
2426
2426
|
extract(e, t = this._def) {
|
|
2427
|
-
return
|
|
2427
|
+
return de.create(e, {
|
|
2428
2428
|
...this._def,
|
|
2429
2429
|
...t
|
|
2430
2430
|
});
|
|
2431
2431
|
}
|
|
2432
2432
|
exclude(e, t = this._def) {
|
|
2433
|
-
return
|
|
2433
|
+
return de.create(this.options.filter((n) => !e.includes(n)), {
|
|
2434
2434
|
...this._def,
|
|
2435
2435
|
...t
|
|
2436
2436
|
});
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
2439
|
Se = /* @__PURE__ */ new WeakMap();
|
|
2440
|
-
|
|
2441
|
-
class
|
|
2440
|
+
de.create = zt;
|
|
2441
|
+
class Le extends v {
|
|
2442
2442
|
constructor() {
|
|
2443
2443
|
super(...arguments), Ce.set(this, void 0);
|
|
2444
2444
|
}
|
|
@@ -2446,57 +2446,57 @@ class Ue extends _ {
|
|
|
2446
2446
|
const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2447
2447
|
if (n.parsedType !== h.string && n.parsedType !== h.number) {
|
|
2448
2448
|
const s = x.objectValues(t);
|
|
2449
|
-
return
|
|
2449
|
+
return f(n, {
|
|
2450
2450
|
expected: x.joinValues(s),
|
|
2451
2451
|
received: n.parsedType,
|
|
2452
2452
|
code: d.invalid_type
|
|
2453
|
-
}),
|
|
2453
|
+
}), _;
|
|
2454
2454
|
}
|
|
2455
|
-
if (
|
|
2455
|
+
if (Ye(this, Ce) || Ut(this, Ce, new Set(x.getValidEnumValues(this._def.values))), !Ye(this, Ce).has(e.data)) {
|
|
2456
2456
|
const s = x.objectValues(t);
|
|
2457
|
-
return
|
|
2457
|
+
return f(n, {
|
|
2458
2458
|
received: n.data,
|
|
2459
2459
|
code: d.invalid_enum_value,
|
|
2460
2460
|
options: s
|
|
2461
|
-
}),
|
|
2461
|
+
}), _;
|
|
2462
2462
|
}
|
|
2463
|
-
return
|
|
2463
|
+
return A(e.data);
|
|
2464
2464
|
}
|
|
2465
2465
|
get enum() {
|
|
2466
2466
|
return this._def.values;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
2469
|
Ce = /* @__PURE__ */ new WeakMap();
|
|
2470
|
-
|
|
2470
|
+
Le.create = (r, e) => new Le({
|
|
2471
2471
|
values: r,
|
|
2472
2472
|
typeName: y.ZodNativeEnum,
|
|
2473
2473
|
...g(e)
|
|
2474
2474
|
});
|
|
2475
|
-
class
|
|
2475
|
+
class ke extends v {
|
|
2476
2476
|
unwrap() {
|
|
2477
2477
|
return this._def.type;
|
|
2478
2478
|
}
|
|
2479
2479
|
_parse(e) {
|
|
2480
2480
|
const { ctx: t } = this._processInputParams(e);
|
|
2481
2481
|
if (t.parsedType !== h.promise && t.common.async === !1)
|
|
2482
|
-
return
|
|
2482
|
+
return f(t, {
|
|
2483
2483
|
code: d.invalid_type,
|
|
2484
2484
|
expected: h.promise,
|
|
2485
2485
|
received: t.parsedType
|
|
2486
|
-
}),
|
|
2486
|
+
}), _;
|
|
2487
2487
|
const n = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
|
|
2488
|
-
return
|
|
2488
|
+
return A(n.then((s) => this._def.type.parseAsync(s, {
|
|
2489
2489
|
path: t.path,
|
|
2490
2490
|
errorMap: t.common.contextualErrorMap
|
|
2491
2491
|
})));
|
|
2492
2492
|
}
|
|
2493
2493
|
}
|
|
2494
|
-
|
|
2494
|
+
ke.create = (r, e) => new ke({
|
|
2495
2495
|
type: r,
|
|
2496
2496
|
typeName: y.ZodPromise,
|
|
2497
2497
|
...g(e)
|
|
2498
2498
|
});
|
|
2499
|
-
class
|
|
2499
|
+
class W extends v {
|
|
2500
2500
|
innerType() {
|
|
2501
2501
|
return this._def.schema;
|
|
2502
2502
|
}
|
|
@@ -2506,7 +2506,7 @@ class B extends _ {
|
|
|
2506
2506
|
_parse(e) {
|
|
2507
2507
|
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2508
2508
|
addIssue: (i) => {
|
|
2509
|
-
|
|
2509
|
+
f(n, i), i.fatal ? t.abort() : t.dirty();
|
|
2510
2510
|
},
|
|
2511
2511
|
get path() {
|
|
2512
2512
|
return n.path;
|
|
@@ -2517,23 +2517,23 @@ class B extends _ {
|
|
|
2517
2517
|
if (n.common.async)
|
|
2518
2518
|
return Promise.resolve(i).then(async (o) => {
|
|
2519
2519
|
if (t.value === "aborted")
|
|
2520
|
-
return
|
|
2520
|
+
return _;
|
|
2521
2521
|
const u = await this._def.schema._parseAsync({
|
|
2522
2522
|
data: o,
|
|
2523
2523
|
path: n.path,
|
|
2524
2524
|
parent: n
|
|
2525
2525
|
});
|
|
2526
|
-
return u.status === "aborted" ?
|
|
2526
|
+
return u.status === "aborted" ? _ : u.status === "dirty" || t.value === "dirty" ? ge(u.value) : u;
|
|
2527
2527
|
});
|
|
2528
2528
|
{
|
|
2529
2529
|
if (t.value === "aborted")
|
|
2530
|
-
return
|
|
2530
|
+
return _;
|
|
2531
2531
|
const o = this._def.schema._parseSync({
|
|
2532
2532
|
data: i,
|
|
2533
2533
|
path: n.path,
|
|
2534
2534
|
parent: n
|
|
2535
2535
|
});
|
|
2536
|
-
return o.status === "aborted" ?
|
|
2536
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? ge(o.value) : o;
|
|
2537
2537
|
}
|
|
2538
2538
|
}
|
|
2539
2539
|
if (s.type === "refinement") {
|
|
@@ -2551,9 +2551,9 @@ class B extends _ {
|
|
|
2551
2551
|
path: n.path,
|
|
2552
2552
|
parent: n
|
|
2553
2553
|
});
|
|
2554
|
-
return o.status === "aborted" ?
|
|
2554
|
+
return o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2555
2555
|
} else
|
|
2556
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ?
|
|
2556
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2557
2557
|
}
|
|
2558
2558
|
if (s.type === "transform")
|
|
2559
2559
|
if (n.common.async === !1) {
|
|
@@ -2573,21 +2573,21 @@ class B extends _ {
|
|
|
2573
2573
|
x.assertNever(s);
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
|
-
|
|
2576
|
+
W.create = (r, e, t) => new W({
|
|
2577
2577
|
schema: r,
|
|
2578
2578
|
typeName: y.ZodEffects,
|
|
2579
2579
|
effect: e,
|
|
2580
2580
|
...g(t)
|
|
2581
2581
|
});
|
|
2582
|
-
|
|
2582
|
+
W.createWithPreprocess = (r, e, t) => new W({
|
|
2583
2583
|
schema: e,
|
|
2584
2584
|
effect: { type: "preprocess", transform: r },
|
|
2585
2585
|
typeName: y.ZodEffects,
|
|
2586
2586
|
...g(t)
|
|
2587
2587
|
});
|
|
2588
|
-
class K extends
|
|
2588
|
+
class K extends v {
|
|
2589
2589
|
_parse(e) {
|
|
2590
|
-
return this._getType(e) === h.undefined ?
|
|
2590
|
+
return this._getType(e) === h.undefined ? A(void 0) : this._def.innerType._parse(e);
|
|
2591
2591
|
}
|
|
2592
2592
|
unwrap() {
|
|
2593
2593
|
return this._def.innerType;
|
|
@@ -2598,20 +2598,20 @@ K.create = (r, e) => new K({
|
|
|
2598
2598
|
typeName: y.ZodOptional,
|
|
2599
2599
|
...g(e)
|
|
2600
2600
|
});
|
|
2601
|
-
class
|
|
2601
|
+
class ue extends v {
|
|
2602
2602
|
_parse(e) {
|
|
2603
|
-
return this._getType(e) === h.null ?
|
|
2603
|
+
return this._getType(e) === h.null ? A(null) : this._def.innerType._parse(e);
|
|
2604
2604
|
}
|
|
2605
2605
|
unwrap() {
|
|
2606
2606
|
return this._def.innerType;
|
|
2607
2607
|
}
|
|
2608
2608
|
}
|
|
2609
|
-
|
|
2609
|
+
ue.create = (r, e) => new ue({
|
|
2610
2610
|
innerType: r,
|
|
2611
2611
|
typeName: y.ZodNullable,
|
|
2612
2612
|
...g(e)
|
|
2613
2613
|
});
|
|
2614
|
-
class $e extends
|
|
2614
|
+
class $e extends v {
|
|
2615
2615
|
_parse(e) {
|
|
2616
2616
|
const { ctx: t } = this._processInputParams(e);
|
|
2617
2617
|
let n = t.data;
|
|
@@ -2631,7 +2631,7 @@ $e.create = (r, e) => new $e({
|
|
|
2631
2631
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2632
2632
|
...g(e)
|
|
2633
2633
|
});
|
|
2634
|
-
class Ve extends
|
|
2634
|
+
class Ve extends v {
|
|
2635
2635
|
_parse(e) {
|
|
2636
2636
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
2637
2637
|
...t,
|
|
@@ -2650,7 +2650,7 @@ class Ve extends _ {
|
|
|
2650
2650
|
status: "valid",
|
|
2651
2651
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2652
2652
|
get error() {
|
|
2653
|
-
return new
|
|
2653
|
+
return new D(n.common.issues);
|
|
2654
2654
|
},
|
|
2655
2655
|
input: n.data
|
|
2656
2656
|
})
|
|
@@ -2658,7 +2658,7 @@ class Ve extends _ {
|
|
|
2658
2658
|
status: "valid",
|
|
2659
2659
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2660
2660
|
get error() {
|
|
2661
|
-
return new
|
|
2661
|
+
return new D(n.common.issues);
|
|
2662
2662
|
},
|
|
2663
2663
|
input: n.data
|
|
2664
2664
|
})
|
|
@@ -2674,25 +2674,25 @@ Ve.create = (r, e) => new Ve({
|
|
|
2674
2674
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2675
2675
|
...g(e)
|
|
2676
2676
|
});
|
|
2677
|
-
class
|
|
2677
|
+
class Qe extends v {
|
|
2678
2678
|
_parse(e) {
|
|
2679
2679
|
if (this._getType(e) !== h.nan) {
|
|
2680
2680
|
const n = this._getOrReturnCtx(e);
|
|
2681
|
-
return
|
|
2681
|
+
return f(n, {
|
|
2682
2682
|
code: d.invalid_type,
|
|
2683
2683
|
expected: h.nan,
|
|
2684
2684
|
received: n.parsedType
|
|
2685
|
-
}),
|
|
2685
|
+
}), _;
|
|
2686
2686
|
}
|
|
2687
2687
|
return { status: "valid", value: e.data };
|
|
2688
2688
|
}
|
|
2689
2689
|
}
|
|
2690
|
-
|
|
2690
|
+
Qe.create = (r) => new Qe({
|
|
2691
2691
|
typeName: y.ZodNaN,
|
|
2692
2692
|
...g(r)
|
|
2693
2693
|
});
|
|
2694
|
-
const
|
|
2695
|
-
class
|
|
2694
|
+
const Br = Symbol("zod_brand");
|
|
2695
|
+
class vt extends v {
|
|
2696
2696
|
_parse(e) {
|
|
2697
2697
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2698
2698
|
return this._def.type._parse({
|
|
@@ -2705,7 +2705,7 @@ class yt extends _ {
|
|
|
2705
2705
|
return this._def.type;
|
|
2706
2706
|
}
|
|
2707
2707
|
}
|
|
2708
|
-
class Fe extends
|
|
2708
|
+
class Fe extends v {
|
|
2709
2709
|
_parse(e) {
|
|
2710
2710
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2711
2711
|
if (n.common.async)
|
|
@@ -2715,7 +2715,7 @@ class Fe extends _ {
|
|
|
2715
2715
|
path: n.path,
|
|
2716
2716
|
parent: n
|
|
2717
2717
|
});
|
|
2718
|
-
return a.status === "aborted" ?
|
|
2718
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), ge(a.value)) : this._def.out._parseAsync({
|
|
2719
2719
|
data: a.value,
|
|
2720
2720
|
path: n.path,
|
|
2721
2721
|
parent: n
|
|
@@ -2727,7 +2727,7 @@ class Fe extends _ {
|
|
|
2727
2727
|
path: n.path,
|
|
2728
2728
|
parent: n
|
|
2729
2729
|
});
|
|
2730
|
-
return s.status === "aborted" ?
|
|
2730
|
+
return s.status === "aborted" ? _ : s.status === "dirty" ? (t.dirty(), {
|
|
2731
2731
|
status: "dirty",
|
|
2732
2732
|
value: s.value
|
|
2733
2733
|
}) : this._def.out._parseSync({
|
|
@@ -2745,7 +2745,7 @@ class Fe extends _ {
|
|
|
2745
2745
|
});
|
|
2746
2746
|
}
|
|
2747
2747
|
}
|
|
2748
|
-
class ze extends
|
|
2748
|
+
class ze extends v {
|
|
2749
2749
|
_parse(e) {
|
|
2750
2750
|
const t = this._def.innerType._parse(e), n = (s) => (Re(s) && (s.value = Object.freeze(s.value)), s);
|
|
2751
2751
|
return Ie(t) ? t.then((s) => n(s)) : n(t);
|
|
@@ -2759,174 +2759,174 @@ ze.create = (r, e) => new ze({
|
|
|
2759
2759
|
typeName: y.ZodReadonly,
|
|
2760
2760
|
...g(e)
|
|
2761
2761
|
});
|
|
2762
|
-
function
|
|
2763
|
-
return r ?
|
|
2762
|
+
function Ft(r, e = {}, t) {
|
|
2763
|
+
return r ? be.create().superRefine((n, s) => {
|
|
2764
2764
|
var a, i;
|
|
2765
2765
|
if (!r(n)) {
|
|
2766
2766
|
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, c = typeof o == "string" ? { message: o } : o;
|
|
2767
2767
|
s.addIssue({ code: "custom", ...c, fatal: u });
|
|
2768
2768
|
}
|
|
2769
|
-
}) :
|
|
2769
|
+
}) : be.create();
|
|
2770
2770
|
}
|
|
2771
|
-
const
|
|
2771
|
+
const Wr = {
|
|
2772
2772
|
object: E.lazycreate
|
|
2773
2773
|
};
|
|
2774
2774
|
var y;
|
|
2775
2775
|
(function(r) {
|
|
2776
2776
|
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";
|
|
2777
2777
|
})(y || (y = {}));
|
|
2778
|
-
const
|
|
2778
|
+
const qr = (r, e = {
|
|
2779
2779
|
message: `Input not instance of ${r.name}`
|
|
2780
|
-
}) =>
|
|
2781
|
-
string: (r) =>
|
|
2782
|
-
number: (r) =>
|
|
2780
|
+
}) => Ft((t) => t instanceof r, e), Bt = F.create, Wt = oe.create, Hr = Qe.create, Kr = ce.create, qt = Ne.create, Yr = pe.create, Jr = Je.create, Gr = Pe.create, Xr = Ae.create, Qr = be.create, en = he.create, tn = re.create, rn = Ge.create, nn = B.create, sn = E.create, an = E.strictCreate, on = Ze.create, cn = tt.create, dn = je.create, un = J.create, ln = Me.create, fn = Xe.create, hn = me.create, pn = ve.create, mn = De.create, yn = Ue.create, _n = de.create, gn = Le.create, vn = ke.create, It = W.create, xn = K.create, bn = ue.create, kn = W.createWithPreprocess, wn = Fe.create, En = () => Bt().optional(), Tn = () => Wt().optional(), Sn = () => qt().optional(), Cn = {
|
|
2781
|
+
string: (r) => F.create({ ...r, coerce: !0 }),
|
|
2782
|
+
number: (r) => oe.create({ ...r, coerce: !0 }),
|
|
2783
2783
|
boolean: (r) => Ne.create({
|
|
2784
2784
|
...r,
|
|
2785
2785
|
coerce: !0
|
|
2786
2786
|
}),
|
|
2787
|
-
bigint: (r) =>
|
|
2788
|
-
date: (r) =>
|
|
2789
|
-
},
|
|
2790
|
-
var
|
|
2787
|
+
bigint: (r) => ce.create({ ...r, coerce: !0 }),
|
|
2788
|
+
date: (r) => pe.create({ ...r, coerce: !0 })
|
|
2789
|
+
}, On = _;
|
|
2790
|
+
var l = /* @__PURE__ */ Object.freeze({
|
|
2791
2791
|
__proto__: null,
|
|
2792
|
-
defaultErrorMap:
|
|
2793
|
-
setErrorMap:
|
|
2794
|
-
getErrorMap:
|
|
2795
|
-
makeIssue:
|
|
2796
|
-
EMPTY_PATH:
|
|
2797
|
-
addIssueToContext:
|
|
2798
|
-
ParseStatus:
|
|
2799
|
-
INVALID:
|
|
2800
|
-
DIRTY:
|
|
2801
|
-
OK:
|
|
2802
|
-
isAborted:
|
|
2803
|
-
isDirty:
|
|
2792
|
+
defaultErrorMap: xe,
|
|
2793
|
+
setErrorMap: Cr,
|
|
2794
|
+
getErrorMap: He,
|
|
2795
|
+
makeIssue: Ke,
|
|
2796
|
+
EMPTY_PATH: Or,
|
|
2797
|
+
addIssueToContext: f,
|
|
2798
|
+
ParseStatus: P,
|
|
2799
|
+
INVALID: _,
|
|
2800
|
+
DIRTY: ge,
|
|
2801
|
+
OK: A,
|
|
2802
|
+
isAborted: mt,
|
|
2803
|
+
isDirty: yt,
|
|
2804
2804
|
isValid: Re,
|
|
2805
2805
|
isAsync: Ie,
|
|
2806
2806
|
get util() {
|
|
2807
2807
|
return x;
|
|
2808
2808
|
},
|
|
2809
2809
|
get objectUtil() {
|
|
2810
|
-
return
|
|
2810
|
+
return pt;
|
|
2811
2811
|
},
|
|
2812
2812
|
ZodParsedType: h,
|
|
2813
|
-
getParsedType:
|
|
2814
|
-
ZodType:
|
|
2815
|
-
datetimeRegex:
|
|
2816
|
-
ZodString:
|
|
2817
|
-
ZodNumber:
|
|
2818
|
-
ZodBigInt:
|
|
2813
|
+
getParsedType: ae,
|
|
2814
|
+
ZodType: v,
|
|
2815
|
+
datetimeRegex: Vt,
|
|
2816
|
+
ZodString: F,
|
|
2817
|
+
ZodNumber: oe,
|
|
2818
|
+
ZodBigInt: ce,
|
|
2819
2819
|
ZodBoolean: Ne,
|
|
2820
|
-
ZodDate:
|
|
2821
|
-
ZodSymbol:
|
|
2822
|
-
ZodUndefined:
|
|
2823
|
-
ZodNull:
|
|
2824
|
-
ZodAny:
|
|
2825
|
-
ZodUnknown:
|
|
2826
|
-
ZodNever:
|
|
2827
|
-
ZodVoid:
|
|
2828
|
-
ZodArray:
|
|
2820
|
+
ZodDate: pe,
|
|
2821
|
+
ZodSymbol: Je,
|
|
2822
|
+
ZodUndefined: Pe,
|
|
2823
|
+
ZodNull: Ae,
|
|
2824
|
+
ZodAny: be,
|
|
2825
|
+
ZodUnknown: he,
|
|
2826
|
+
ZodNever: re,
|
|
2827
|
+
ZodVoid: Ge,
|
|
2828
|
+
ZodArray: B,
|
|
2829
2829
|
ZodObject: E,
|
|
2830
2830
|
ZodUnion: Ze,
|
|
2831
2831
|
ZodDiscriminatedUnion: tt,
|
|
2832
2832
|
ZodIntersection: je,
|
|
2833
2833
|
ZodTuple: J,
|
|
2834
2834
|
ZodRecord: Me,
|
|
2835
|
-
ZodMap:
|
|
2836
|
-
ZodSet:
|
|
2837
|
-
ZodFunction:
|
|
2835
|
+
ZodMap: Xe,
|
|
2836
|
+
ZodSet: me,
|
|
2837
|
+
ZodFunction: ve,
|
|
2838
2838
|
ZodLazy: De,
|
|
2839
|
-
ZodLiteral:
|
|
2840
|
-
ZodEnum:
|
|
2841
|
-
ZodNativeEnum:
|
|
2842
|
-
ZodPromise:
|
|
2843
|
-
ZodEffects:
|
|
2844
|
-
ZodTransformer:
|
|
2839
|
+
ZodLiteral: Ue,
|
|
2840
|
+
ZodEnum: de,
|
|
2841
|
+
ZodNativeEnum: Le,
|
|
2842
|
+
ZodPromise: ke,
|
|
2843
|
+
ZodEffects: W,
|
|
2844
|
+
ZodTransformer: W,
|
|
2845
2845
|
ZodOptional: K,
|
|
2846
|
-
ZodNullable:
|
|
2846
|
+
ZodNullable: ue,
|
|
2847
2847
|
ZodDefault: $e,
|
|
2848
2848
|
ZodCatch: Ve,
|
|
2849
|
-
ZodNaN:
|
|
2850
|
-
BRAND:
|
|
2851
|
-
ZodBranded:
|
|
2849
|
+
ZodNaN: Qe,
|
|
2850
|
+
BRAND: Br,
|
|
2851
|
+
ZodBranded: vt,
|
|
2852
2852
|
ZodPipeline: Fe,
|
|
2853
2853
|
ZodReadonly: ze,
|
|
2854
|
-
custom:
|
|
2855
|
-
Schema:
|
|
2856
|
-
ZodSchema:
|
|
2857
|
-
late:
|
|
2854
|
+
custom: Ft,
|
|
2855
|
+
Schema: v,
|
|
2856
|
+
ZodSchema: v,
|
|
2857
|
+
late: Wr,
|
|
2858
2858
|
get ZodFirstPartyTypeKind() {
|
|
2859
2859
|
return y;
|
|
2860
2860
|
},
|
|
2861
|
-
coerce:
|
|
2862
|
-
any:
|
|
2863
|
-
array:
|
|
2864
|
-
bigint:
|
|
2865
|
-
boolean:
|
|
2866
|
-
date:
|
|
2867
|
-
discriminatedUnion:
|
|
2868
|
-
effect:
|
|
2869
|
-
enum:
|
|
2870
|
-
function:
|
|
2871
|
-
instanceof:
|
|
2872
|
-
intersection:
|
|
2873
|
-
lazy:
|
|
2874
|
-
literal:
|
|
2875
|
-
map:
|
|
2876
|
-
nan:
|
|
2877
|
-
nativeEnum:
|
|
2878
|
-
never:
|
|
2879
|
-
null:
|
|
2880
|
-
nullable:
|
|
2881
|
-
number:
|
|
2882
|
-
object:
|
|
2883
|
-
oboolean:
|
|
2884
|
-
onumber:
|
|
2885
|
-
optional:
|
|
2886
|
-
ostring:
|
|
2887
|
-
pipeline:
|
|
2888
|
-
preprocess:
|
|
2889
|
-
promise:
|
|
2890
|
-
record:
|
|
2891
|
-
set:
|
|
2892
|
-
strictObject:
|
|
2893
|
-
string:
|
|
2894
|
-
symbol:
|
|
2895
|
-
transformer:
|
|
2896
|
-
tuple:
|
|
2897
|
-
undefined:
|
|
2898
|
-
union:
|
|
2899
|
-
unknown:
|
|
2900
|
-
void:
|
|
2901
|
-
NEVER:
|
|
2861
|
+
coerce: Cn,
|
|
2862
|
+
any: Qr,
|
|
2863
|
+
array: nn,
|
|
2864
|
+
bigint: Kr,
|
|
2865
|
+
boolean: qt,
|
|
2866
|
+
date: Yr,
|
|
2867
|
+
discriminatedUnion: cn,
|
|
2868
|
+
effect: It,
|
|
2869
|
+
enum: _n,
|
|
2870
|
+
function: pn,
|
|
2871
|
+
instanceof: qr,
|
|
2872
|
+
intersection: dn,
|
|
2873
|
+
lazy: mn,
|
|
2874
|
+
literal: yn,
|
|
2875
|
+
map: fn,
|
|
2876
|
+
nan: Hr,
|
|
2877
|
+
nativeEnum: gn,
|
|
2878
|
+
never: tn,
|
|
2879
|
+
null: Xr,
|
|
2880
|
+
nullable: bn,
|
|
2881
|
+
number: Wt,
|
|
2882
|
+
object: sn,
|
|
2883
|
+
oboolean: Sn,
|
|
2884
|
+
onumber: Tn,
|
|
2885
|
+
optional: xn,
|
|
2886
|
+
ostring: En,
|
|
2887
|
+
pipeline: wn,
|
|
2888
|
+
preprocess: kn,
|
|
2889
|
+
promise: vn,
|
|
2890
|
+
record: ln,
|
|
2891
|
+
set: hn,
|
|
2892
|
+
strictObject: an,
|
|
2893
|
+
string: Bt,
|
|
2894
|
+
symbol: Jr,
|
|
2895
|
+
transformer: It,
|
|
2896
|
+
tuple: un,
|
|
2897
|
+
undefined: Gr,
|
|
2898
|
+
union: on,
|
|
2899
|
+
unknown: en,
|
|
2900
|
+
void: rn,
|
|
2901
|
+
NEVER: On,
|
|
2902
2902
|
ZodIssueCode: d,
|
|
2903
|
-
quotelessJson:
|
|
2904
|
-
ZodError:
|
|
2903
|
+
quotelessJson: Sr,
|
|
2904
|
+
ZodError: D
|
|
2905
2905
|
});
|
|
2906
|
-
const
|
|
2907
|
-
var
|
|
2908
|
-
const Ht =
|
|
2906
|
+
const L = l.string().trim().min(1, { message: "Cannot be blank" }), M = l.string().trim().optional(), Nt = (r) => l.nullable(r.optional());
|
|
2907
|
+
var et = /* @__PURE__ */ ((r) => (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.PROMOTION_CODE = "promotionCode", r))(et || {});
|
|
2908
|
+
const Ht = l.nativeEnum(et);
|
|
2909
2909
|
var Kt = /* @__PURE__ */ ((r) => (r.CARD_NUMBER = "cardNumber", r.CARD_EXPIRY = "cardExpiry", r.CARD_CVC = "cardCvc", r))(Kt || {});
|
|
2910
|
-
const Yt =
|
|
2911
|
-
provider:
|
|
2912
|
-
processor_name:
|
|
2913
|
-
metadata:
|
|
2910
|
+
const Yt = l.nativeEnum(Kt), Rn = l.union([Ht, Yt]), Jt = l.object({
|
|
2911
|
+
provider: l.string(),
|
|
2912
|
+
processor_name: Nt(l.string()),
|
|
2913
|
+
metadata: Nt(l.record(l.string(), l.any()))
|
|
2914
2914
|
});
|
|
2915
|
-
|
|
2916
|
-
cardNumber:
|
|
2917
|
-
expiry:
|
|
2918
|
-
cvc:
|
|
2915
|
+
l.object({
|
|
2916
|
+
cardNumber: M,
|
|
2917
|
+
expiry: M,
|
|
2918
|
+
cvc: M
|
|
2919
2919
|
});
|
|
2920
|
-
|
|
2921
|
-
backgroundColor:
|
|
2922
|
-
color:
|
|
2923
|
-
fontFamily:
|
|
2924
|
-
fontSize:
|
|
2925
|
-
fontWeight:
|
|
2926
|
-
margin:
|
|
2927
|
-
padding:
|
|
2920
|
+
l.object({
|
|
2921
|
+
backgroundColor: M,
|
|
2922
|
+
color: M,
|
|
2923
|
+
fontFamily: M,
|
|
2924
|
+
fontSize: M,
|
|
2925
|
+
fontWeight: M,
|
|
2926
|
+
margin: M,
|
|
2927
|
+
padding: M
|
|
2928
2928
|
});
|
|
2929
|
-
const
|
|
2929
|
+
const b = l.enum([
|
|
2930
2930
|
// Element -> Form
|
|
2931
2931
|
"LOADED",
|
|
2932
2932
|
"BLUR",
|
|
@@ -2941,76 +2941,81 @@ const k = f.enum([
|
|
|
2941
2941
|
"VALIDATION_ERROR",
|
|
2942
2942
|
"TOKENIZE_ERROR",
|
|
2943
2943
|
"CHECKOUT_ERROR",
|
|
2944
|
+
"SETUP_PAYMENT_METHOD_SUCCESS",
|
|
2944
2945
|
// Form -> Element
|
|
2945
2946
|
"TOKENIZE",
|
|
2946
2947
|
"CHECKOUT",
|
|
2947
2948
|
"START_PAYMENT_FLOW"
|
|
2948
|
-
]),
|
|
2949
|
-
type: Nn,
|
|
2950
|
-
elementType: Yt
|
|
2951
|
-
}), Pn = k.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), Zn = f.object({
|
|
2949
|
+
]), In = b.extract(["TOKENIZE_STARTED", "CHECKOUT_STARTED"]), Nn = l.object({ type: In }), Pn = b.extract(["BLUR", "FOCUS", "CHANGE"]), An = l.object({
|
|
2952
2950
|
type: Pn,
|
|
2953
|
-
|
|
2954
|
-
}),
|
|
2955
|
-
type:
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2951
|
+
elementType: Yt
|
|
2952
|
+
}), Zn = b.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), jn = l.object({
|
|
2953
|
+
type: Zn,
|
|
2954
|
+
message: L
|
|
2955
|
+
}), Mn = b.extract(["VALIDATION_ERROR"]), Dn = l.object({
|
|
2956
|
+
type: Mn,
|
|
2957
|
+
elementType: Rn,
|
|
2958
|
+
errors: l.array(l.string())
|
|
2959
|
+
}), Un = l.object({
|
|
2960
|
+
type: l.literal(b.enum.LOADED),
|
|
2961
|
+
sessionId: L,
|
|
2962
|
+
height: L,
|
|
2963
|
+
totalAmountAtoms: l.number(),
|
|
2964
|
+
currency: M,
|
|
2965
|
+
checkoutPaymentMethods: l.array(Jt)
|
|
2966
|
+
}), Ln = l.object({
|
|
2967
|
+
type: l.literal(b.enum.PAYMENT_FLOW_STARTED),
|
|
2968
|
+
nextActionMetadata: l.record(l.string(), l.any()),
|
|
2969
|
+
paymentFlowMetadata: l.any().optional(),
|
|
2970
|
+
startPFMetadata: l.optional(l.record(l.string(), l.any()))
|
|
2971
|
+
}), $n = l.object({
|
|
2972
|
+
type: l.literal(b.enum.SETUP_PAYMENT_METHOD_SUCCESS),
|
|
2973
|
+
paymentMethodId: l.string()
|
|
2974
|
+
}), Vn = l.object({
|
|
2975
|
+
firstName: L,
|
|
2976
|
+
lastName: L,
|
|
2977
|
+
email: L,
|
|
2978
|
+
zipCode: L,
|
|
2979
|
+
country: L,
|
|
2980
|
+
promotionCode: M
|
|
2981
|
+
}), zn = b.extract(["TOKENIZE", "CHECKOUT", "START_PAYMENT_FLOW"]), Gt = l.object({
|
|
2982
|
+
type: zn,
|
|
2983
|
+
sessionId: L,
|
|
2980
2984
|
checkoutPaymentMethod: Jt,
|
|
2981
|
-
paymentFlowMetadata:
|
|
2982
|
-
doNotUseLegacyCCFlow:
|
|
2983
|
-
existingCCPMId:
|
|
2984
|
-
}).extend(
|
|
2985
|
-
type:
|
|
2986
|
-
isReadyForCheckout:
|
|
2987
|
-
}),
|
|
2988
|
-
type:
|
|
2989
|
-
invoiceUrls:
|
|
2990
|
-
subscriptionIds:
|
|
2991
|
-
customerId:
|
|
2992
|
-
}),
|
|
2993
|
-
|
|
2985
|
+
paymentFlowMetadata: l.any().optional(),
|
|
2986
|
+
doNotUseLegacyCCFlow: l.boolean().optional(),
|
|
2987
|
+
existingCCPMId: M
|
|
2988
|
+
}).extend(Vn.shape), Fn = l.object({
|
|
2989
|
+
type: l.literal(b.enum.TOKENIZE_SUCCESS),
|
|
2990
|
+
isReadyForCheckout: l.boolean()
|
|
2991
|
+
}), Bn = l.object({
|
|
2992
|
+
type: l.literal(b.enum.CHECKOUT_SUCCESS),
|
|
2993
|
+
invoiceUrls: l.array(l.string()),
|
|
2994
|
+
subscriptionIds: l.array(l.string()),
|
|
2995
|
+
customerId: l.string()
|
|
2996
|
+
}), Wn = l.discriminatedUnion("type", [
|
|
2997
|
+
Nn,
|
|
2994
2998
|
An,
|
|
2995
|
-
|
|
2996
|
-
Mn,
|
|
2999
|
+
jn,
|
|
2997
3000
|
Dn,
|
|
3001
|
+
Un,
|
|
2998
3002
|
Gt,
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
Ln
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3003
|
+
Fn,
|
|
3004
|
+
Bn,
|
|
3005
|
+
Ln,
|
|
3006
|
+
$n
|
|
3007
|
+
]), qn = l.object({
|
|
3008
|
+
payload: Wn,
|
|
3009
|
+
nonce: L,
|
|
3010
|
+
formId: L,
|
|
3011
|
+
elementId: L
|
|
3007
3012
|
});
|
|
3008
|
-
|
|
3009
|
-
isLoading:
|
|
3010
|
-
isAvailable:
|
|
3011
|
-
startFlow:
|
|
3013
|
+
l.object({
|
|
3014
|
+
isLoading: l.boolean(),
|
|
3015
|
+
isAvailable: l.boolean(),
|
|
3016
|
+
startFlow: l.function(l.tuple([]), l.void())
|
|
3012
3017
|
});
|
|
3013
|
-
const
|
|
3018
|
+
const Hn = (r) => {
|
|
3014
3019
|
const e = {};
|
|
3015
3020
|
return Object.entries(r).forEach(([t, n]) => {
|
|
3016
3021
|
try {
|
|
@@ -3023,47 +3028,49 @@ const Wn = (r) => {
|
|
|
3023
3028
|
}, Xt = (r, e) => Array.from(r.querySelectorAll("input[data-opid]") ?? []).reduce((s, a) => {
|
|
3024
3029
|
const i = a.getAttribute("data-opid");
|
|
3025
3030
|
return i ? { ...s, [i]: a.value } : s;
|
|
3026
|
-
}, e),
|
|
3031
|
+
}, e), We = (r, e, t, n, s, a, i) => {
|
|
3027
3032
|
const o = Xt(t, {
|
|
3028
3033
|
type: r,
|
|
3029
3034
|
sessionId: e,
|
|
3030
3035
|
checkoutPaymentMethod: s,
|
|
3031
3036
|
paymentFlowMetadata: i,
|
|
3032
3037
|
doNotUseLegacyCCFlow: a
|
|
3033
|
-
})
|
|
3038
|
+
});
|
|
3039
|
+
(s.provider === "apple_pay" || s.provider === "google_pay") && (o[et.ZIP_CODE] || (o[et.ZIP_CODE] = "00000"));
|
|
3040
|
+
const u = Gt.safeParse(o);
|
|
3034
3041
|
if (u.success)
|
|
3035
3042
|
return u.data;
|
|
3036
3043
|
{
|
|
3037
|
-
const c = u.error.format(), p =
|
|
3038
|
-
for (const [
|
|
3039
|
-
n(
|
|
3044
|
+
const c = u.error.format(), p = Hn(c);
|
|
3045
|
+
for (const [k, T] of Object.entries(p))
|
|
3046
|
+
n(k, T, k);
|
|
3040
3047
|
return null;
|
|
3041
3048
|
}
|
|
3042
|
-
},
|
|
3049
|
+
}, Kn = (r) => {
|
|
3043
3050
|
try {
|
|
3044
|
-
return
|
|
3051
|
+
return qn.parse(r);
|
|
3045
3052
|
} catch (e) {
|
|
3046
3053
|
throw e;
|
|
3047
3054
|
}
|
|
3048
3055
|
}, Ee = (r, e, t, n, s) => {
|
|
3049
3056
|
const a = {
|
|
3050
3057
|
payload: n,
|
|
3051
|
-
nonce:
|
|
3058
|
+
nonce: Mt(),
|
|
3052
3059
|
formId: e,
|
|
3053
3060
|
elementId: t
|
|
3054
3061
|
};
|
|
3055
3062
|
r.postMessage(JSON.stringify(a), s);
|
|
3056
|
-
},
|
|
3063
|
+
}, Yn = "https://cde.openpaystaging.com", Jn = {
|
|
3057
3064
|
usd: "usd",
|
|
3058
3065
|
brl: "brl"
|
|
3059
|
-
},
|
|
3066
|
+
}, xt = async (r) => {
|
|
3060
3067
|
for (let t = 0; t < 10; t++)
|
|
3061
|
-
|
|
3062
|
-
if (!
|
|
3068
|
+
Pt() || await Xn(500);
|
|
3069
|
+
if (!Pt())
|
|
3063
3070
|
throw new Error("Stripe JS not found.");
|
|
3064
3071
|
return new Stripe(r);
|
|
3065
|
-
},
|
|
3066
|
-
const n =
|
|
3072
|
+
}, Gn = async (r, e, t) => {
|
|
3073
|
+
const n = await xt(r), s = Jn[t];
|
|
3067
3074
|
return n.paymentRequest({
|
|
3068
3075
|
// TODO: replace this with stripe account country as soon as we support it
|
|
3069
3076
|
country: "US",
|
|
@@ -3075,9 +3082,9 @@ const Wn = (r) => {
|
|
|
3075
3082
|
requestPayerName: !0,
|
|
3076
3083
|
requestPayerEmail: !0
|
|
3077
3084
|
});
|
|
3078
|
-
},
|
|
3085
|
+
}, Xn = (r) => new Promise((e) => {
|
|
3079
3086
|
setTimeout(e, r);
|
|
3080
|
-
}),
|
|
3087
|
+
}), Pt = () => "Stripe" in window, Qn = async (r) => new Promise((e, t) => {
|
|
3081
3088
|
try {
|
|
3082
3089
|
r.on("paymentmethod", async (n) => {
|
|
3083
3090
|
e(n);
|
|
@@ -3087,12 +3094,12 @@ const Wn = (r) => {
|
|
|
3087
3094
|
} catch (n) {
|
|
3088
3095
|
t(n);
|
|
3089
3096
|
}
|
|
3090
|
-
}),
|
|
3097
|
+
}), es = (r) => {
|
|
3091
3098
|
const e = r == null ? void 0 : r.stripe_pk;
|
|
3092
3099
|
if (typeof e != "string")
|
|
3093
3100
|
throw new Error("Invalid: stripe_pk not passed in checkout payment method");
|
|
3094
3101
|
return e;
|
|
3095
|
-
},
|
|
3102
|
+
}, ts = async (r, e) => {
|
|
3096
3103
|
const t = r.nextActionMetadata;
|
|
3097
3104
|
if (!r.paymentFlowMetadata || !r.paymentFlowMetadata.stripePmId)
|
|
3098
3105
|
throw new Error(`Invalid payment flow metadata format: ${JSON.stringify(r.paymentFlowMetadata)}`);
|
|
@@ -3100,22 +3107,22 @@ const Wn = (r) => {
|
|
|
3100
3107
|
throw new Error(`Invalid next action metadata format: ${JSON.stringify(t)}`);
|
|
3101
3108
|
if (e.paymentMethod.id !== r.paymentFlowMetadata.stripePmId)
|
|
3102
3109
|
throw new Error(`PM ID mismatch: ${e.paymentMethod.id} != ${r.paymentFlowMetadata.stripePmId}`);
|
|
3103
|
-
const s = await
|
|
3110
|
+
const s = await (await xt(t.stripe_pk)).confirmCardSetup(t.client_secret, {
|
|
3104
3111
|
payment_method: r.paymentFlowMetadata.stripePmId
|
|
3105
3112
|
});
|
|
3106
3113
|
if (s.error)
|
|
3107
3114
|
throw e.complete("fail"), new Error(`Payment failed: ${s.error.message ?? "unknown"}`);
|
|
3108
3115
|
e.complete("success");
|
|
3109
|
-
},
|
|
3116
|
+
}, rs = async (r) => {
|
|
3110
3117
|
var a, i, o, u;
|
|
3111
|
-
const e = r.nextActionMetadata, n = await
|
|
3118
|
+
const e = r.nextActionMetadata, n = await (await xt(e.stripe_pk)).confirmCardSetup(e.client_secret, {
|
|
3112
3119
|
payment_method: e.stripe_pm_id
|
|
3113
3120
|
}), s = (a = n.setupIntent) == null ? void 0 : a.status;
|
|
3114
3121
|
if (s !== "succeeded") throw s === "canceled" ? new Error("Payment cancelled, please click Submit again to pay") : new Error(
|
|
3115
3122
|
`${((i = n.error) == null ? void 0 : i.message) ?? ((u = (o = n.setupIntent) == null ? void 0 : o.last_setup_error) == null ? void 0 : u.message) ?? "Payment failed, please click submit again to pay."}`
|
|
3116
3123
|
);
|
|
3117
|
-
},
|
|
3118
|
-
const [e, t] =
|
|
3124
|
+
}, ns = (r = {}) => {
|
|
3125
|
+
const [e, t] = N(r), n = Oe(
|
|
3119
3126
|
() => ({
|
|
3120
3127
|
set: (a, i) => {
|
|
3121
3128
|
t((o) => ({
|
|
@@ -3142,13 +3149,13 @@ const Wn = (r) => {
|
|
|
3142
3149
|
};
|
|
3143
3150
|
return [e, s];
|
|
3144
3151
|
};
|
|
3145
|
-
function
|
|
3152
|
+
function ss(r) {
|
|
3146
3153
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
3147
3154
|
}
|
|
3148
|
-
var
|
|
3155
|
+
var bt = { exports: {} }, as = gr;
|
|
3149
3156
|
function Qt(r, e, t) {
|
|
3150
3157
|
var n = typeof e == "function";
|
|
3151
|
-
|
|
3158
|
+
as.useEffect(function() {
|
|
3152
3159
|
var s, a = !0, i = r(function() {
|
|
3153
3160
|
return a;
|
|
3154
3161
|
});
|
|
@@ -3159,40 +3166,40 @@ function Qt(r, e, t) {
|
|
|
3159
3166
|
};
|
|
3160
3167
|
}, n ? t : e);
|
|
3161
3168
|
}
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
var
|
|
3165
|
-
const
|
|
3166
|
-
type:
|
|
3167
|
-
loc:
|
|
3168
|
-
msg:
|
|
3169
|
-
url:
|
|
3170
|
-
}),
|
|
3171
|
-
code:
|
|
3172
|
-
message:
|
|
3173
|
-
path:
|
|
3174
|
-
}),
|
|
3169
|
+
bt.exports = Qt;
|
|
3170
|
+
bt.exports.useAsyncEffect = Qt;
|
|
3171
|
+
var is = bt.exports;
|
|
3172
|
+
const os = /* @__PURE__ */ ss(is), cs = l.object({
|
|
3173
|
+
type: l.string(),
|
|
3174
|
+
loc: l.array(l.string()),
|
|
3175
|
+
msg: l.string(),
|
|
3176
|
+
url: l.string()
|
|
3177
|
+
}), ds = l.array(cs), us = l.object({
|
|
3178
|
+
code: l.string(),
|
|
3179
|
+
message: l.string(),
|
|
3180
|
+
path: l.array(l.string())
|
|
3181
|
+
}), ls = l.array(us), fs = {
|
|
3175
3182
|
"failed to fetch": "Connection error: please double check if you are connected to the internet, then try again"
|
|
3176
|
-
},
|
|
3183
|
+
}, gt = (r) => {
|
|
3177
3184
|
const e = r.toLowerCase().trim();
|
|
3178
|
-
return
|
|
3179
|
-
},
|
|
3185
|
+
return fs[e] ?? r;
|
|
3186
|
+
}, hs = (r) => {
|
|
3180
3187
|
try {
|
|
3181
3188
|
return typeof JSON.parse(r) == "object";
|
|
3182
3189
|
} catch {
|
|
3183
3190
|
return !1;
|
|
3184
3191
|
}
|
|
3185
|
-
},
|
|
3186
|
-
${r.map((t) => `• ${
|
|
3187
|
-
`)}`,
|
|
3192
|
+
}, ps = (r) => r.length === 1 ? gt(r[0].msg) : `Please fix the following errors:
|
|
3193
|
+
${r.map((t) => `• ${gt(t.msg)}`).join(`
|
|
3194
|
+
`)}`, ms = (r) => `Encountered the following errors:
|
|
3188
3195
|
${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
3189
3196
|
`)}`, er = (r) => {
|
|
3190
3197
|
if (window.cur_error = r, r instanceof Error)
|
|
3191
|
-
if (
|
|
3198
|
+
if (hs(r.message)) {
|
|
3192
3199
|
const e = JSON.parse(r.message);
|
|
3193
|
-
return
|
|
3200
|
+
return ds.safeParse(e).success ? ps(e) : ls.safeParse(e).success ? ms(e) : r.message;
|
|
3194
3201
|
} else
|
|
3195
|
-
return
|
|
3202
|
+
return gt(r.message);
|
|
3196
3203
|
if (typeof r == "object")
|
|
3197
3204
|
try {
|
|
3198
3205
|
return JSON.stringify(r);
|
|
@@ -3201,7 +3208,7 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3201
3208
|
}
|
|
3202
3209
|
else
|
|
3203
3210
|
return r + "";
|
|
3204
|
-
},
|
|
3211
|
+
}, ys = l.enum(["apple_pay", "google_pay"]), _s = {
|
|
3205
3212
|
apple_pay: "applePay",
|
|
3206
3213
|
google_pay: "googlePay"
|
|
3207
3214
|
}, At = {
|
|
@@ -3209,31 +3216,31 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3209
3216
|
isAvailable: !1,
|
|
3210
3217
|
startFlow: () => {
|
|
3211
3218
|
}
|
|
3212
|
-
},
|
|
3219
|
+
}, gs = {
|
|
3213
3220
|
isLoading: !1,
|
|
3214
3221
|
isAvailable: !1,
|
|
3215
3222
|
startFlow: () => {
|
|
3216
3223
|
}
|
|
3217
3224
|
}, vs = (r, e, t, n, s, a, i) => {
|
|
3218
|
-
const [o, u] =
|
|
3225
|
+
const [o, u] = ns({
|
|
3219
3226
|
apple_pay: At,
|
|
3220
3227
|
google_pay: At
|
|
3221
3228
|
}), c = r === void 0 || e === void 0 || t === void 0 || !n;
|
|
3222
|
-
return
|
|
3229
|
+
return os(async () => {
|
|
3223
3230
|
if (!c)
|
|
3224
|
-
for (const p of
|
|
3225
|
-
const
|
|
3231
|
+
for (const p of ys.options) {
|
|
3232
|
+
const k = p.replace("_", "");
|
|
3226
3233
|
try {
|
|
3227
|
-
const T = t.find((
|
|
3234
|
+
const T = t.find((ne) => ne.provider === p && ne.processor_name === "stripe");
|
|
3228
3235
|
if (!T)
|
|
3229
|
-
throw new Error(`${
|
|
3230
|
-
const
|
|
3231
|
-
if (!
|
|
3232
|
-
throw new Error(`Cannot make payment with ${
|
|
3236
|
+
throw new Error(`${k} is not available as a checkout method`);
|
|
3237
|
+
const $ = es(T.metadata), le = await Gn($, r, e), S = await le.canMakePayment();
|
|
3238
|
+
if (!S)
|
|
3239
|
+
throw new Error(`Cannot make payment with ${k} for this session`);
|
|
3233
3240
|
const nt = async () => {
|
|
3234
3241
|
try {
|
|
3235
|
-
if (Xt(n, {}), a && !
|
|
3236
|
-
|
|
3242
|
+
if (Xt(n, {}), a && !We(
|
|
3243
|
+
b.enum.START_PAYMENT_FLOW,
|
|
3237
3244
|
// This is ok since we're just calling this function to use the validation function inside it
|
|
3238
3245
|
"dummy",
|
|
3239
3246
|
n,
|
|
@@ -3242,24 +3249,24 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3242
3249
|
!1
|
|
3243
3250
|
))
|
|
3244
3251
|
return;
|
|
3245
|
-
|
|
3246
|
-
const
|
|
3247
|
-
s(
|
|
3248
|
-
} catch (
|
|
3249
|
-
i(er(
|
|
3252
|
+
le.show();
|
|
3253
|
+
const ne = await Qn(le);
|
|
3254
|
+
s(ne, T);
|
|
3255
|
+
} catch (ne) {
|
|
3256
|
+
i(er(ne));
|
|
3250
3257
|
}
|
|
3251
3258
|
};
|
|
3252
3259
|
u.set(p, {
|
|
3253
3260
|
isLoading: !1,
|
|
3254
|
-
isAvailable:
|
|
3261
|
+
isAvailable: S[_s[p]],
|
|
3255
3262
|
startFlow: nt
|
|
3256
3263
|
});
|
|
3257
3264
|
} catch {
|
|
3258
|
-
u.set(p,
|
|
3265
|
+
u.set(p, gs);
|
|
3259
3266
|
}
|
|
3260
3267
|
}
|
|
3261
3268
|
}, [c, t]), o;
|
|
3262
|
-
},
|
|
3269
|
+
}, ws = (r) => {
|
|
3263
3270
|
const {
|
|
3264
3271
|
children: e,
|
|
3265
3272
|
checkoutSecureToken: t,
|
|
@@ -3271,221 +3278,226 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3271
3278
|
onLoadError: u,
|
|
3272
3279
|
onValidationError: c,
|
|
3273
3280
|
onCheckoutStarted: p,
|
|
3274
|
-
onCheckoutSuccess:
|
|
3281
|
+
onCheckoutSuccess: k,
|
|
3275
3282
|
onCheckoutError: T,
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3283
|
+
onSetupPaymentMethodSuccess: $,
|
|
3284
|
+
baseUrl: le
|
|
3285
|
+
} = r, S = le ?? Yn, [nt, ne] = N(void 0), [st, tr] = N([]), [rr, nr] = N("1px"), [kt, sr] = N(!1), [G, we] = N(void 0), [wt, ye] = N(!1), [fe, ar] = N([]), [se, ir] = N({}), [Et, at] = N(0), [Tt, X] = N(!1), [q, or] = N(void 0), [it, cr] = N(void 0), [ot, dr] = N(void 0), [Q, ur] = N(void 0), [ct, lr] = N(void 0), ee = Oe(() => `opjs-form-${Mt()}`, []), H = Zt(null), dt = Te(
|
|
3286
|
+
(C) => {
|
|
3287
|
+
if (C.origin !== S || !C.source) return;
|
|
3288
|
+
const U = C.source, O = Kn(JSON.parse(C.data)), V = O.elementId;
|
|
3289
|
+
if (O.formId !== ee || !V || O.nonce in st)
|
|
3282
3290
|
return;
|
|
3283
|
-
|
|
3284
|
-
const w =
|
|
3285
|
-
if (
|
|
3286
|
-
s(
|
|
3287
|
-
else if (
|
|
3288
|
-
a(
|
|
3289
|
-
else if (
|
|
3290
|
-
i(
|
|
3291
|
-
else if (
|
|
3292
|
-
const
|
|
3293
|
-
if (
|
|
3291
|
+
tr((j) => [...j, O.nonce]);
|
|
3292
|
+
const w = O.payload, Z = w.type;
|
|
3293
|
+
if (Z === b.enum.FOCUS && s)
|
|
3294
|
+
s(O.elementId);
|
|
3295
|
+
else if (Z === b.enum.BLUR && a)
|
|
3296
|
+
a(O.elementId);
|
|
3297
|
+
else if (Z === b.enum.CHANGE && i)
|
|
3298
|
+
i(O.elementId);
|
|
3299
|
+
else if (Z === b.enum.LOADED) {
|
|
3300
|
+
const j = fe.find((z) => z.contentWindow === U);
|
|
3301
|
+
if (ye(!1), !j)
|
|
3294
3302
|
return;
|
|
3295
|
-
|
|
3296
|
-
const
|
|
3297
|
-
|
|
3298
|
-
} else if (
|
|
3299
|
-
|
|
3300
|
-
else if (
|
|
3301
|
-
if (!
|
|
3303
|
+
ir((z) => ({ ...z, [V]: U }));
|
|
3304
|
+
const R = w.height ? `${w.height}px` : "100%";
|
|
3305
|
+
nr(R), dr(w.totalAmountAtoms), cr(w.currency), ur(w.checkoutPaymentMethods), q || or(w.sessionId);
|
|
3306
|
+
} else if (Z === b.enum.TOKENIZE_STARTED)
|
|
3307
|
+
ye(!0), p && p();
|
|
3308
|
+
else if (Z === b.enum.PAYMENT_FLOW_STARTED) {
|
|
3309
|
+
if (!G)
|
|
3302
3310
|
throw new Error("extraData not populated");
|
|
3303
3311
|
(async () => {
|
|
3304
|
-
const
|
|
3305
|
-
if (
|
|
3306
|
-
await
|
|
3307
|
-
else if (
|
|
3308
|
-
if (!
|
|
3312
|
+
const R = w.nextActionMetadata.type;
|
|
3313
|
+
if (R !== void 0) if (R === "stripe_3ds")
|
|
3314
|
+
await rs(w);
|
|
3315
|
+
else if (R === "stripe_payment_request") {
|
|
3316
|
+
if (!ct)
|
|
3309
3317
|
throw new Error("Stripe PM not set");
|
|
3310
|
-
await
|
|
3318
|
+
await ts(w, ct);
|
|
3311
3319
|
} else
|
|
3312
|
-
throw new Error(`Unknown next action type: ${
|
|
3320
|
+
throw new Error(`Unknown next action type: ${R}`);
|
|
3313
3321
|
})().then(() => {
|
|
3314
|
-
var
|
|
3315
|
-
let
|
|
3316
|
-
if (
|
|
3322
|
+
var z;
|
|
3323
|
+
let R;
|
|
3324
|
+
if (G.checkoutPaymentMethod.provider === "credit_card" && (R = (z = w.startPFMetadata) == null ? void 0 : z.cc_pm_id, !R))
|
|
3317
3325
|
throw new Error("CC PM ID not found");
|
|
3318
3326
|
Ee(
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
{ ...
|
|
3323
|
-
|
|
3324
|
-
),
|
|
3325
|
-
}).catch((
|
|
3326
|
-
const
|
|
3327
|
-
|
|
3327
|
+
U,
|
|
3328
|
+
ee,
|
|
3329
|
+
V,
|
|
3330
|
+
{ ...G, type: "CHECKOUT", doNotUseLegacyCCFlow: !0, existingCCPMId: R },
|
|
3331
|
+
S
|
|
3332
|
+
), X(!0), we(void 0), p && p();
|
|
3333
|
+
}).catch((R) => {
|
|
3334
|
+
const z = er(R);
|
|
3335
|
+
ye(!1), X(!1), T && T(z);
|
|
3328
3336
|
});
|
|
3329
|
-
} else if (
|
|
3330
|
-
const
|
|
3331
|
-
!
|
|
3332
|
-
} else if (
|
|
3333
|
-
|
|
3334
|
-
else if (
|
|
3337
|
+
} else if (Z === b.enum.TOKENIZE_SUCCESS && G) {
|
|
3338
|
+
const j = Et + 1, R = j === Object.keys(se).length;
|
|
3339
|
+
!Tt && (R || w.isReadyForCheckout) ? (Ee(U, ee, V, G, S), X(!0), we(void 0)) : at(j);
|
|
3340
|
+
} else if (Z === b.enum.CHECKOUT_SUCCESS)
|
|
3341
|
+
ye(!1), at(0), X(!1), k && k(w.invoiceUrls, w.subscriptionIds, w.customerId);
|
|
3342
|
+
else if (Z === b.enum.SETUP_PAYMENT_METHOD_SUCCESS)
|
|
3343
|
+
ye(!1), at(0), X(!1), $ && $(w.paymentMethodId);
|
|
3344
|
+
else if (Z === b.enum.LOAD_ERROR)
|
|
3335
3345
|
u && u(w.message);
|
|
3336
|
-
else if (
|
|
3337
|
-
const
|
|
3338
|
-
(
|
|
3339
|
-
} else if (
|
|
3346
|
+
else if (Z === b.enum.VALIDATION_ERROR) {
|
|
3347
|
+
const j = G == null ? void 0 : G.checkoutPaymentMethod.provider;
|
|
3348
|
+
(j === "credit_card" || j === void 0) && c && c(w.elementType, w.errors, V);
|
|
3349
|
+
} else if (Z === b.enum.TOKENIZE_ERROR || Z === b.enum.CHECKOUT_ERROR)
|
|
3340
3350
|
if (w.message === "3DS_REQUIRED") {
|
|
3341
|
-
const
|
|
3342
|
-
if (!q || !H.current || !c || !
|
|
3343
|
-
for (const [
|
|
3344
|
-
if (!
|
|
3345
|
-
const
|
|
3346
|
-
|
|
3351
|
+
const j = Q == null ? void 0 : Q.find((R) => R.provider === "credit_card");
|
|
3352
|
+
if (!q || !H.current || !c || !j) return;
|
|
3353
|
+
for (const [R, z] of Object.entries(se)) {
|
|
3354
|
+
if (!z) continue;
|
|
3355
|
+
const lt = We(
|
|
3356
|
+
b.enum.START_PAYMENT_FLOW,
|
|
3347
3357
|
q,
|
|
3348
3358
|
H.current,
|
|
3349
3359
|
c,
|
|
3350
3360
|
// Only stripe supports frontend 3DS right now,
|
|
3351
3361
|
// so we pass processor_name: 'stripe' to tell delegator to only use stripe
|
|
3352
|
-
{ ...
|
|
3362
|
+
{ ...j, processor_name: "stripe" },
|
|
3353
3363
|
!1
|
|
3354
3364
|
);
|
|
3355
|
-
if (
|
|
3356
|
-
|
|
3365
|
+
if (lt) {
|
|
3366
|
+
X(!0), we(lt), Ee(z, ee, R, lt, S);
|
|
3357
3367
|
break;
|
|
3358
3368
|
}
|
|
3359
3369
|
}
|
|
3360
3370
|
} else
|
|
3361
|
-
|
|
3371
|
+
ye(!1), X(!1), T && T(w.message);
|
|
3362
3372
|
},
|
|
3363
3373
|
[
|
|
3364
|
-
|
|
3374
|
+
ee,
|
|
3365
3375
|
q,
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3376
|
+
st,
|
|
3377
|
+
G,
|
|
3378
|
+
fe,
|
|
3369
3379
|
se,
|
|
3370
|
-
kt,
|
|
3371
3380
|
Et,
|
|
3381
|
+
Tt,
|
|
3372
3382
|
a,
|
|
3373
3383
|
i,
|
|
3374
3384
|
s,
|
|
3375
3385
|
u,
|
|
3376
3386
|
p,
|
|
3377
|
-
|
|
3387
|
+
k,
|
|
3388
|
+
$,
|
|
3378
3389
|
T,
|
|
3379
3390
|
c,
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3391
|
+
S,
|
|
3392
|
+
ct,
|
|
3393
|
+
Q
|
|
3383
3394
|
]
|
|
3384
|
-
),
|
|
3385
|
-
if (!H.current || !c || !q || !
|
|
3386
|
-
const
|
|
3387
|
-
if (!
|
|
3395
|
+
), fr = Te(() => {
|
|
3396
|
+
if (!H.current || !c || !q || !Q) return;
|
|
3397
|
+
const C = Q.find((O) => O.provider === "credit_card");
|
|
3398
|
+
if (!C)
|
|
3388
3399
|
throw new Error("Card not available as a payment method in checkout");
|
|
3389
|
-
const
|
|
3390
|
-
|
|
3400
|
+
const U = We(
|
|
3401
|
+
b.enum.TOKENIZE,
|
|
3391
3402
|
q,
|
|
3392
3403
|
H.current,
|
|
3393
3404
|
c,
|
|
3394
|
-
|
|
3405
|
+
C,
|
|
3395
3406
|
!1
|
|
3396
3407
|
);
|
|
3397
|
-
if (
|
|
3398
|
-
for (const [
|
|
3399
|
-
|
|
3400
|
-
|
|
3408
|
+
if (U) {
|
|
3409
|
+
for (const [O, V] of Object.entries(se))
|
|
3410
|
+
V && Ee(V, ee, O, U, S);
|
|
3411
|
+
U.type = b.enum.CHECKOUT, we(U);
|
|
3401
3412
|
}
|
|
3402
|
-
}, [H, se,
|
|
3403
|
-
(
|
|
3404
|
-
|
|
3413
|
+
}, [H, se, ee, c, q, S, Q]), ut = Te(
|
|
3414
|
+
(C) => {
|
|
3415
|
+
wt && C.preventDefault();
|
|
3405
3416
|
},
|
|
3406
|
-
[
|
|
3417
|
+
[wt]
|
|
3407
3418
|
);
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3419
|
+
qe(() => {
|
|
3420
|
+
if (kt || !H.current) return;
|
|
3421
|
+
fe.length > 0 && fe.length === Object.keys(se).length && (sr(!0), o && o(ot, it));
|
|
3422
|
+
}, [fe, se, kt, o, ot, it]), qe(() => (ne(window.location.origin), window.addEventListener("message", dt), window.addEventListener("beforeunload", ut), () => {
|
|
3423
|
+
window.removeEventListener("beforeunload", ut), window.removeEventListener("message", dt);
|
|
3424
|
+
}), [q, dt, ut]);
|
|
3425
|
+
const hr = Te(
|
|
3426
|
+
(C) => {
|
|
3427
|
+
fe.find((O) => O.contentWindow === C.contentWindow) || ar((O) => [...O, C]);
|
|
3416
3428
|
},
|
|
3417
|
-
[
|
|
3418
|
-
),
|
|
3419
|
-
if (!(!H.current || !c || !q || !
|
|
3420
|
-
for (const [
|
|
3421
|
-
if (
|
|
3422
|
-
const
|
|
3423
|
-
stripePmId:
|
|
3424
|
-
}, w =
|
|
3425
|
-
|
|
3429
|
+
[fe]
|
|
3430
|
+
), pr = async (C, U) => {
|
|
3431
|
+
if (!(!H.current || !c || !q || !Q))
|
|
3432
|
+
for (const [O, V] of Object.entries(se)) {
|
|
3433
|
+
if (!V) continue;
|
|
3434
|
+
const Ct = {
|
|
3435
|
+
stripePmId: C.paymentMethod.id
|
|
3436
|
+
}, w = We(
|
|
3437
|
+
b.enum.START_PAYMENT_FLOW,
|
|
3426
3438
|
q,
|
|
3427
3439
|
H.current,
|
|
3428
3440
|
c,
|
|
3429
|
-
|
|
3441
|
+
U,
|
|
3430
3442
|
!1,
|
|
3431
|
-
|
|
3443
|
+
Ct
|
|
3432
3444
|
);
|
|
3433
3445
|
if (w) {
|
|
3434
|
-
|
|
3446
|
+
lr(C), X(!0), we(w), Ee(V, ee, O, w, S);
|
|
3435
3447
|
break;
|
|
3436
3448
|
}
|
|
3437
3449
|
}
|
|
3438
|
-
},
|
|
3439
|
-
|
|
3440
|
-
},
|
|
3441
|
-
formId:
|
|
3442
|
-
formHeight:
|
|
3443
|
-
referer:
|
|
3450
|
+
}, mr = (C) => {
|
|
3451
|
+
X(!1), T && T(C);
|
|
3452
|
+
}, yr = {
|
|
3453
|
+
formId: ee,
|
|
3454
|
+
formHeight: rr,
|
|
3455
|
+
referer: nt,
|
|
3444
3456
|
checkoutSecureToken: t,
|
|
3445
|
-
registerIframe:
|
|
3446
|
-
baseUrl:
|
|
3447
|
-
},
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3457
|
+
registerIframe: hr,
|
|
3458
|
+
baseUrl: S
|
|
3459
|
+
}, St = vs(
|
|
3460
|
+
ot,
|
|
3461
|
+
it,
|
|
3462
|
+
Q,
|
|
3451
3463
|
H.current,
|
|
3452
|
-
|
|
3464
|
+
pr,
|
|
3453
3465
|
c,
|
|
3454
|
-
|
|
3455
|
-
),
|
|
3456
|
-
submit:
|
|
3457
|
-
applePay:
|
|
3458
|
-
googlePay:
|
|
3466
|
+
mr
|
|
3467
|
+
), _r = {
|
|
3468
|
+
submit: fr,
|
|
3469
|
+
applePay: St.apple_pay,
|
|
3470
|
+
googlePay: St.google_pay
|
|
3459
3471
|
};
|
|
3460
|
-
return /* @__PURE__ */
|
|
3461
|
-
},
|
|
3462
|
-
const { subPath: e, styles: t } = r, { formId: n, referer: s, formHeight: a, checkoutSecureToken: i, registerIframe: o, baseUrl: u } =
|
|
3472
|
+
return /* @__PURE__ */ ie(jt.Provider, { value: yr, children: /* @__PURE__ */ ie("div", { className: n, ref: H, children: e(_r) }) });
|
|
3473
|
+
}, xs = (r) => JSON.stringify(r), rt = (r) => {
|
|
3474
|
+
const { subPath: e, styles: t } = r, { formId: n, referer: s, formHeight: a, checkoutSecureToken: i, registerIframe: o, baseUrl: u } = br(), [c, p] = N(!1), k = Zt(null), T = Oe(() => t ? xs(t) : "", [t]), $ = Oe(() => ({
|
|
3463
3475
|
border: "none",
|
|
3464
3476
|
width: "100%",
|
|
3465
3477
|
height: a
|
|
3466
|
-
}), [a]),
|
|
3478
|
+
}), [a]), le = Oe(() => {
|
|
3467
3479
|
if (!i || !s) return "";
|
|
3468
|
-
const
|
|
3469
|
-
return
|
|
3480
|
+
const S = new URLSearchParams();
|
|
3481
|
+
return S.append("referer", s), S.append("styles", T), S.append("formId", n), S.append("secureToken", i), S.toString();
|
|
3470
3482
|
}, [T, n, s, i]);
|
|
3471
|
-
return
|
|
3472
|
-
!
|
|
3473
|
-
}, [c]), i ? /* @__PURE__ */
|
|
3483
|
+
return qe(() => p(!0), []), qe(() => {
|
|
3484
|
+
!k.current || !c || o(k.current);
|
|
3485
|
+
}, [c]), i ? /* @__PURE__ */ ie(
|
|
3474
3486
|
"iframe",
|
|
3475
3487
|
{
|
|
3476
3488
|
name: `${e}-element`,
|
|
3477
|
-
src: `${u}/app/v1/${e}-element/?${
|
|
3478
|
-
style:
|
|
3479
|
-
ref:
|
|
3489
|
+
src: `${u}/app/v1/${e}-element/?${le}`,
|
|
3490
|
+
style: $,
|
|
3491
|
+
ref: k
|
|
3480
3492
|
}
|
|
3481
|
-
) : /* @__PURE__ */
|
|
3482
|
-
},
|
|
3493
|
+
) : /* @__PURE__ */ ie("div", {});
|
|
3494
|
+
}, Es = ({ styles: r }) => /* @__PURE__ */ ie(rt, { styles: r, subPath: "card-cvc" }), Ts = ({ styles: r }) => /* @__PURE__ */ ie(rt, { styles: r, subPath: "card" }), Ss = ({ styles: r }) => /* @__PURE__ */ ie(rt, { styles: r, subPath: "card-expiry" }), Cs = ({ styles: r }) => /* @__PURE__ */ ie(rt, { styles: r, subPath: "card-number" });
|
|
3483
3495
|
export {
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3496
|
+
Es as CardCvcElement,
|
|
3497
|
+
Ts as CardElement,
|
|
3498
|
+
Ss as CardExpiryElement,
|
|
3499
|
+
Cs as CardNumberElement,
|
|
3500
|
+
ws as ElementsForm,
|
|
3501
|
+
et as FieldName,
|
|
3502
|
+
br as useOpenPayElements
|
|
3491
3503
|
};
|