@getopenpay/openpay-js-react 0.0.14 → 0.0.16-alpha.a071c74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +31 -16
- package/dist/index.js +1197 -1082
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as
|
|
3
|
-
const
|
|
1
|
+
import Wr, { createContext as Kr, useContext as Yr, useState as S, useMemo as ze, useCallback as ye, useRef as qe, useEffect as ge } from "react";
|
|
2
|
+
import { jsx as _e } from "react/jsx-runtime";
|
|
3
|
+
const nr = Kr({
|
|
4
4
|
formId: "",
|
|
5
5
|
formHeight: "",
|
|
6
6
|
referer: void 0,
|
|
@@ -8,34 +8,34 @@ const Jt = Lr({
|
|
|
8
8
|
registerIframe: () => {
|
|
9
9
|
},
|
|
10
10
|
baseUrl: ""
|
|
11
|
-
}),
|
|
12
|
-
const t =
|
|
11
|
+
}), Jr = () => {
|
|
12
|
+
const t = Yr(nr);
|
|
13
13
|
if (!t)
|
|
14
14
|
throw new Error("useOpenPayElements must be used within an OpenPayElementsProvider");
|
|
15
15
|
return t;
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
return (
|
|
17
|
+
var M = [];
|
|
18
|
+
for (var Tt = 0; Tt < 256; ++Tt)
|
|
19
|
+
M.push((Tt + 256).toString(16).slice(1));
|
|
20
|
+
function Gr(t, e = 0) {
|
|
21
|
+
return (M[t[e + 0]] + M[t[e + 1]] + M[t[e + 2]] + M[t[e + 3]] + "-" + M[t[e + 4]] + M[t[e + 5]] + "-" + M[t[e + 6]] + M[t[e + 7]] + "-" + M[t[e + 8]] + M[t[e + 9]] + "-" + M[t[e + 10]] + M[t[e + 11]] + M[t[e + 12]] + M[t[e + 13]] + M[t[e + 14]] + M[t[e + 15]]).toLowerCase();
|
|
22
22
|
}
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
if (!
|
|
23
|
+
var ut, Xr = new Uint8Array(16);
|
|
24
|
+
function Qr() {
|
|
25
|
+
if (!ut && (ut = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ut))
|
|
26
26
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
27
|
-
return
|
|
27
|
+
return ut(Xr);
|
|
28
28
|
}
|
|
29
|
-
var
|
|
30
|
-
const
|
|
31
|
-
randomUUID:
|
|
29
|
+
var en = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
30
|
+
const Kt = {
|
|
31
|
+
randomUUID: en
|
|
32
32
|
};
|
|
33
|
-
function
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
33
|
+
function sr(t, e, r) {
|
|
34
|
+
if (Kt.randomUUID && !e && !t)
|
|
35
|
+
return Kt.randomUUID();
|
|
36
36
|
t = t || {};
|
|
37
|
-
var n = t.random || (t.rng ||
|
|
38
|
-
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128,
|
|
37
|
+
var n = t.random || (t.rng || Qr)();
|
|
38
|
+
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Gr(n);
|
|
39
39
|
}
|
|
40
40
|
var x;
|
|
41
41
|
(function(t) {
|
|
@@ -73,15 +73,15 @@ var x;
|
|
|
73
73
|
}
|
|
74
74
|
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
75
75
|
})(x || (x = {}));
|
|
76
|
-
var
|
|
76
|
+
var St;
|
|
77
77
|
(function(t) {
|
|
78
78
|
t.mergeShapes = (e, r) => ({
|
|
79
79
|
...e,
|
|
80
80
|
...r
|
|
81
81
|
// second overwrites first
|
|
82
82
|
});
|
|
83
|
-
})(
|
|
84
|
-
const
|
|
83
|
+
})(St || (St = {}));
|
|
84
|
+
const p = x.arrayToEnum([
|
|
85
85
|
"string",
|
|
86
86
|
"nan",
|
|
87
87
|
"number",
|
|
@@ -102,26 +102,26 @@ const h = x.arrayToEnum([
|
|
|
102
102
|
"never",
|
|
103
103
|
"map",
|
|
104
104
|
"set"
|
|
105
|
-
]),
|
|
105
|
+
]), he = (t) => {
|
|
106
106
|
switch (typeof t) {
|
|
107
107
|
case "undefined":
|
|
108
|
-
return
|
|
108
|
+
return p.undefined;
|
|
109
109
|
case "string":
|
|
110
|
-
return
|
|
110
|
+
return p.string;
|
|
111
111
|
case "number":
|
|
112
|
-
return isNaN(t) ?
|
|
112
|
+
return isNaN(t) ? p.nan : p.number;
|
|
113
113
|
case "boolean":
|
|
114
|
-
return
|
|
114
|
+
return p.boolean;
|
|
115
115
|
case "function":
|
|
116
|
-
return
|
|
116
|
+
return p.function;
|
|
117
117
|
case "bigint":
|
|
118
|
-
return
|
|
118
|
+
return p.bigint;
|
|
119
119
|
case "symbol":
|
|
120
|
-
return
|
|
120
|
+
return p.symbol;
|
|
121
121
|
case "object":
|
|
122
|
-
return Array.isArray(t) ?
|
|
122
|
+
return Array.isArray(t) ? p.array : t === null ? p.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? p.promise : typeof Map < "u" && t instanceof Map ? p.map : typeof Set < "u" && t instanceof Set ? p.set : typeof Date < "u" && t instanceof Date ? p.date : p.object;
|
|
123
123
|
default:
|
|
124
|
-
return
|
|
124
|
+
return p.unknown;
|
|
125
125
|
}
|
|
126
126
|
}, l = x.arrayToEnum([
|
|
127
127
|
"invalid_type",
|
|
@@ -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
|
+
]), tn = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
144
|
+
class H 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 F extends Error {
|
|
|
178
178
|
return s(this), n;
|
|
179
179
|
}
|
|
180
180
|
static assert(e) {
|
|
181
|
-
if (!(e instanceof
|
|
181
|
+
if (!(e instanceof H))
|
|
182
182
|
throw new Error(`Not a ZodError: ${e}`);
|
|
183
183
|
}
|
|
184
184
|
toString() {
|
|
@@ -200,12 +200,12 @@ class F extends Error {
|
|
|
200
200
|
return this.flatten();
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
const
|
|
203
|
+
H.create = (t) => new H(t);
|
|
204
|
+
const Me = (t, e) => {
|
|
205
205
|
let r;
|
|
206
206
|
switch (t.code) {
|
|
207
207
|
case l.invalid_type:
|
|
208
|
-
t.received ===
|
|
208
|
+
t.received === p.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
|
|
209
209
|
break;
|
|
210
210
|
case l.invalid_literal:
|
|
211
211
|
r = `Invalid literal value, expected ${JSON.stringify(t.expected, x.jsonStringifyReplacer)}`;
|
|
@@ -257,14 +257,14 @@ const Pe = (t, e) => {
|
|
|
257
257
|
}
|
|
258
258
|
return { message: r };
|
|
259
259
|
};
|
|
260
|
-
let
|
|
261
|
-
function
|
|
262
|
-
|
|
260
|
+
let ar = Me;
|
|
261
|
+
function rn(t) {
|
|
262
|
+
ar = t;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
264
|
+
function ft() {
|
|
265
|
+
return ar;
|
|
266
266
|
}
|
|
267
|
-
const
|
|
267
|
+
const mt = (t) => {
|
|
268
268
|
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], o = {
|
|
269
269
|
...s,
|
|
270
270
|
path: a
|
|
@@ -284,9 +284,9 @@ const dt = (t) => {
|
|
|
284
284
|
path: a,
|
|
285
285
|
message: c
|
|
286
286
|
};
|
|
287
|
-
},
|
|
287
|
+
}, nn = [];
|
|
288
288
|
function m(t, e) {
|
|
289
|
-
const r =
|
|
289
|
+
const r = ft(), n = mt({
|
|
290
290
|
issueData: e,
|
|
291
291
|
data: t.data,
|
|
292
292
|
path: t.path,
|
|
@@ -294,13 +294,13 @@ function m(t, e) {
|
|
|
294
294
|
t.common.contextualErrorMap,
|
|
295
295
|
t.schemaErrorMap,
|
|
296
296
|
r,
|
|
297
|
-
r ===
|
|
297
|
+
r === Me ? void 0 : Me
|
|
298
298
|
// then global default map
|
|
299
299
|
].filter((s) => !!s)
|
|
300
300
|
});
|
|
301
301
|
t.common.issues.push(n);
|
|
302
302
|
}
|
|
303
|
-
class
|
|
303
|
+
class Z {
|
|
304
304
|
constructor() {
|
|
305
305
|
this.value = "valid";
|
|
306
306
|
}
|
|
@@ -328,7 +328,7 @@ class M {
|
|
|
328
328
|
value: o
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
return
|
|
331
|
+
return Z.mergeObjectSync(e, n);
|
|
332
332
|
}
|
|
333
333
|
static mergeObjectSync(e, r) {
|
|
334
334
|
const n = {};
|
|
@@ -343,21 +343,21 @@ class M {
|
|
|
343
343
|
}
|
|
344
344
|
const g = Object.freeze({
|
|
345
345
|
status: "aborted"
|
|
346
|
-
}),
|
|
347
|
-
function
|
|
346
|
+
}), Ne = (t) => ({ status: "dirty", value: t }), L = (t) => ({ status: "valid", value: t }), Rt = (t) => t.status === "aborted", Ot = (t) => t.status === "dirty", Be = (t) => t.status === "valid", He = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
347
|
+
function pt(t, e, r, n) {
|
|
348
348
|
if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
349
349
|
return e.get(t);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function ir(t, e, r, n, s) {
|
|
352
352
|
if (typeof e == "function" ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
353
353
|
return e.set(t, r), r;
|
|
354
354
|
}
|
|
355
|
-
var
|
|
355
|
+
var h;
|
|
356
356
|
(function(t) {
|
|
357
357
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
358
|
-
})(
|
|
359
|
-
var
|
|
360
|
-
class
|
|
358
|
+
})(h || (h = {}));
|
|
359
|
+
var Ve, Fe;
|
|
360
|
+
class ie {
|
|
361
361
|
constructor(e, r, n, s) {
|
|
362
362
|
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
|
|
363
363
|
}
|
|
@@ -365,8 +365,8 @@ class ee {
|
|
|
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
|
|
369
|
-
if (
|
|
368
|
+
const Yt = (t, e) => {
|
|
369
|
+
if (Be(e))
|
|
370
370
|
return { success: !0, data: e.value };
|
|
371
371
|
if (!t.common.issues.length)
|
|
372
372
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -375,7 +375,7 @@ const Vt = (t, e) => {
|
|
|
375
375
|
get error() {
|
|
376
376
|
if (this._error)
|
|
377
377
|
return this._error;
|
|
378
|
-
const r = new
|
|
378
|
+
const r = new H(t.common.issues);
|
|
379
379
|
return this._error = r, this._error;
|
|
380
380
|
}
|
|
381
381
|
};
|
|
@@ -392,7 +392,7 @@ function _(t) {
|
|
|
392
392
|
return o.code === "invalid_enum_value" ? { message: f ?? c.defaultError } : typeof c.data > "u" ? { message: (u = f ?? n) !== null && u !== void 0 ? u : c.defaultError } : o.code !== "invalid_type" ? { message: c.defaultError } : { message: (d = f ?? r) !== null && d !== void 0 ? d : c.defaultError };
|
|
393
393
|
}, description: s };
|
|
394
394
|
}
|
|
395
|
-
class
|
|
395
|
+
class w {
|
|
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 v {
|
|
|
400
400
|
return this._def.description;
|
|
401
401
|
}
|
|
402
402
|
_getType(e) {
|
|
403
|
-
return
|
|
403
|
+
return he(e.data);
|
|
404
404
|
}
|
|
405
405
|
_getOrReturnCtx(e, r) {
|
|
406
406
|
return r || {
|
|
407
407
|
common: e.parent.common,
|
|
408
408
|
data: e.data,
|
|
409
|
-
parsedType:
|
|
409
|
+
parsedType: he(e.data),
|
|
410
410
|
schemaErrorMap: this._def.errorMap,
|
|
411
411
|
path: e.path,
|
|
412
412
|
parent: e.parent
|
|
@@ -414,11 +414,11 @@ class v {
|
|
|
414
414
|
}
|
|
415
415
|
_processInputParams(e) {
|
|
416
416
|
return {
|
|
417
|
-
status: new
|
|
417
|
+
status: new Z(),
|
|
418
418
|
ctx: {
|
|
419
419
|
common: e.parent.common,
|
|
420
420
|
data: e.data,
|
|
421
|
-
parsedType:
|
|
421
|
+
parsedType: he(e.data),
|
|
422
422
|
schemaErrorMap: this._def.errorMap,
|
|
423
423
|
path: e.path,
|
|
424
424
|
parent: e.parent
|
|
@@ -427,7 +427,7 @@ class v {
|
|
|
427
427
|
}
|
|
428
428
|
_parseSync(e) {
|
|
429
429
|
const r = this._parse(e);
|
|
430
|
-
if (
|
|
430
|
+
if (He(r))
|
|
431
431
|
throw new Error("Synchronous parse encountered promise.");
|
|
432
432
|
return r;
|
|
433
433
|
}
|
|
@@ -453,9 +453,9 @@ class v {
|
|
|
453
453
|
schemaErrorMap: this._def.errorMap,
|
|
454
454
|
parent: null,
|
|
455
455
|
data: e,
|
|
456
|
-
parsedType:
|
|
456
|
+
parsedType: he(e)
|
|
457
457
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
458
|
-
return
|
|
458
|
+
return Yt(s, a);
|
|
459
459
|
}
|
|
460
460
|
async parseAsync(e, r) {
|
|
461
461
|
const n = await this.safeParseAsync(e, r);
|
|
@@ -474,9 +474,9 @@ class v {
|
|
|
474
474
|
schemaErrorMap: this._def.errorMap,
|
|
475
475
|
parent: null,
|
|
476
476
|
data: e,
|
|
477
|
-
parsedType:
|
|
478
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
479
|
-
return
|
|
477
|
+
parsedType: he(e)
|
|
478
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (He(s) ? s : Promise.resolve(s));
|
|
479
|
+
return Yt(n, a);
|
|
480
480
|
}
|
|
481
481
|
refine(e, r) {
|
|
482
482
|
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
|
|
@@ -492,7 +492,7 @@ class v {
|
|
|
492
492
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
|
|
493
493
|
}
|
|
494
494
|
_refinement(e) {
|
|
495
|
-
return new
|
|
495
|
+
return new Q({
|
|
496
496
|
schema: this,
|
|
497
497
|
typeName: y.ZodEffects,
|
|
498
498
|
effect: { type: "refinement", refinement: e }
|
|
@@ -502,28 +502,28 @@ class v {
|
|
|
502
502
|
return this._refinement(e);
|
|
503
503
|
}
|
|
504
504
|
optional() {
|
|
505
|
-
return
|
|
505
|
+
return se.create(this, this._def);
|
|
506
506
|
}
|
|
507
507
|
nullable() {
|
|
508
|
-
return
|
|
508
|
+
return xe.create(this, this._def);
|
|
509
509
|
}
|
|
510
510
|
nullish() {
|
|
511
511
|
return this.nullable().optional();
|
|
512
512
|
}
|
|
513
513
|
array() {
|
|
514
|
-
return
|
|
514
|
+
return X.create(this, this._def);
|
|
515
515
|
}
|
|
516
516
|
promise() {
|
|
517
|
-
return
|
|
517
|
+
return De.create(this, this._def);
|
|
518
518
|
}
|
|
519
519
|
or(e) {
|
|
520
|
-
return
|
|
520
|
+
return Je.create([this, e], this._def);
|
|
521
521
|
}
|
|
522
522
|
and(e) {
|
|
523
|
-
return
|
|
523
|
+
return Ge.create(this, e, this._def);
|
|
524
524
|
}
|
|
525
525
|
transform(e) {
|
|
526
|
-
return new
|
|
526
|
+
return new Q({
|
|
527
527
|
..._(this._def),
|
|
528
528
|
schema: this,
|
|
529
529
|
typeName: y.ZodEffects,
|
|
@@ -532,7 +532,7 @@ class v {
|
|
|
532
532
|
}
|
|
533
533
|
default(e) {
|
|
534
534
|
const r = typeof e == "function" ? e : () => e;
|
|
535
|
-
return new
|
|
535
|
+
return new rt({
|
|
536
536
|
..._(this._def),
|
|
537
537
|
innerType: this,
|
|
538
538
|
defaultValue: r,
|
|
@@ -540,7 +540,7 @@ class v {
|
|
|
540
540
|
});
|
|
541
541
|
}
|
|
542
542
|
brand() {
|
|
543
|
-
return new
|
|
543
|
+
return new jt({
|
|
544
544
|
typeName: y.ZodBranded,
|
|
545
545
|
type: this,
|
|
546
546
|
..._(this._def)
|
|
@@ -548,7 +548,7 @@ class v {
|
|
|
548
548
|
}
|
|
549
549
|
catch(e) {
|
|
550
550
|
const r = typeof e == "function" ? e : () => e;
|
|
551
|
-
return new
|
|
551
|
+
return new nt({
|
|
552
552
|
..._(this._def),
|
|
553
553
|
innerType: this,
|
|
554
554
|
catchValue: r,
|
|
@@ -563,10 +563,10 @@ class v {
|
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
pipe(e) {
|
|
566
|
-
return
|
|
566
|
+
return ot.create(this, e);
|
|
567
567
|
}
|
|
568
568
|
readonly() {
|
|
569
|
-
return
|
|
569
|
+
return st.create(this);
|
|
570
570
|
}
|
|
571
571
|
isOptional() {
|
|
572
572
|
return this.safeParse(void 0).success;
|
|
@@ -575,35 +575,35 @@ class v {
|
|
|
575
575
|
return this.safeParse(null).success;
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
|
-
const
|
|
579
|
-
let
|
|
580
|
-
const
|
|
581
|
-
function
|
|
578
|
+
const sn = /^c[^\s-]{8,}$/i, an = /^[0-9a-z]+$/, on = /^[0-9A-HJKMNP-TV-Z]{26}$/, cn = /^[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, dn = /^[a-z0-9_-]{21}$/i, un = /^[-+]?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)?)??$/, ln = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, fn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
579
|
+
let Ct;
|
|
580
|
+
const mn = /^(?:(?: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])$/, pn = /^(([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})))$/, hn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, or = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", yn = new RegExp(`^${or}$`);
|
|
581
|
+
function cr(t) {
|
|
582
582
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
583
583
|
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
return new RegExp(`^${
|
|
585
|
+
function gn(t) {
|
|
586
|
+
return new RegExp(`^${cr(t)}$`);
|
|
587
587
|
}
|
|
588
|
-
function
|
|
589
|
-
let e = `${
|
|
588
|
+
function dr(t) {
|
|
589
|
+
let e = `${or}T${cr(t)}`;
|
|
590
590
|
const r = [];
|
|
591
591
|
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
|
|
592
592
|
}
|
|
593
|
-
function
|
|
594
|
-
return !!((e === "v4" || !e) &&
|
|
593
|
+
function _n(t, e) {
|
|
594
|
+
return !!((e === "v4" || !e) && mn.test(t) || (e === "v6" || !e) && pn.test(t));
|
|
595
595
|
}
|
|
596
|
-
class
|
|
596
|
+
class G extends w {
|
|
597
597
|
_parse(e) {
|
|
598
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
598
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
599
599
|
const a = this._getOrReturnCtx(e);
|
|
600
600
|
return m(a, {
|
|
601
601
|
code: l.invalid_type,
|
|
602
|
-
expected:
|
|
602
|
+
expected: p.string,
|
|
603
603
|
received: a.parsedType
|
|
604
604
|
}), g;
|
|
605
605
|
}
|
|
606
|
-
const n = new
|
|
606
|
+
const n = new Z();
|
|
607
607
|
let s;
|
|
608
608
|
for (const a of this._def.checks)
|
|
609
609
|
if (a.kind === "min")
|
|
@@ -642,43 +642,43 @@ class W extends v {
|
|
|
642
642
|
message: a.message
|
|
643
643
|
}), n.dirty());
|
|
644
644
|
} else if (a.kind === "email")
|
|
645
|
-
|
|
645
|
+
ln.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
646
646
|
validation: "email",
|
|
647
647
|
code: l.invalid_string,
|
|
648
648
|
message: a.message
|
|
649
649
|
}), n.dirty());
|
|
650
650
|
else if (a.kind === "emoji")
|
|
651
|
-
|
|
651
|
+
Ct || (Ct = new RegExp(fn, "u")), Ct.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
652
652
|
validation: "emoji",
|
|
653
653
|
code: l.invalid_string,
|
|
654
654
|
message: a.message
|
|
655
655
|
}), n.dirty());
|
|
656
656
|
else if (a.kind === "uuid")
|
|
657
|
-
|
|
657
|
+
cn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
658
658
|
validation: "uuid",
|
|
659
659
|
code: l.invalid_string,
|
|
660
660
|
message: a.message
|
|
661
661
|
}), n.dirty());
|
|
662
662
|
else if (a.kind === "nanoid")
|
|
663
|
-
|
|
663
|
+
dn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
664
664
|
validation: "nanoid",
|
|
665
665
|
code: l.invalid_string,
|
|
666
666
|
message: a.message
|
|
667
667
|
}), n.dirty());
|
|
668
668
|
else if (a.kind === "cuid")
|
|
669
|
-
|
|
669
|
+
sn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
670
670
|
validation: "cuid",
|
|
671
671
|
code: l.invalid_string,
|
|
672
672
|
message: a.message
|
|
673
673
|
}), n.dirty());
|
|
674
674
|
else if (a.kind === "cuid2")
|
|
675
|
-
|
|
675
|
+
an.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
676
676
|
validation: "cuid2",
|
|
677
677
|
code: l.invalid_string,
|
|
678
678
|
message: a.message
|
|
679
679
|
}), n.dirty());
|
|
680
680
|
else if (a.kind === "ulid")
|
|
681
|
-
|
|
681
|
+
on.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
682
682
|
validation: "ulid",
|
|
683
683
|
code: l.invalid_string,
|
|
684
684
|
message: a.message
|
|
@@ -709,27 +709,27 @@ class W extends v {
|
|
|
709
709
|
code: l.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" ? dr(a).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
713
713
|
code: l.invalid_string,
|
|
714
714
|
validation: "datetime",
|
|
715
715
|
message: a.message
|
|
716
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
716
|
+
}), n.dirty()) : a.kind === "date" ? yn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
717
717
|
code: l.invalid_string,
|
|
718
718
|
validation: "date",
|
|
719
719
|
message: a.message
|
|
720
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
720
|
+
}), n.dirty()) : a.kind === "time" ? gn(a).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
721
721
|
code: l.invalid_string,
|
|
722
722
|
validation: "time",
|
|
723
723
|
message: a.message
|
|
724
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
724
|
+
}), n.dirty()) : a.kind === "duration" ? un.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
725
725
|
validation: "duration",
|
|
726
726
|
code: l.invalid_string,
|
|
727
727
|
message: a.message
|
|
728
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
728
|
+
}), n.dirty()) : a.kind === "ip" ? _n(e.data, a.version) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
729
729
|
validation: "ip",
|
|
730
730
|
code: l.invalid_string,
|
|
731
731
|
message: a.message
|
|
732
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
732
|
+
}), n.dirty()) : a.kind === "base64" ? hn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
733
733
|
validation: "base64",
|
|
734
734
|
code: l.invalid_string,
|
|
735
735
|
message: a.message
|
|
@@ -740,44 +740,44 @@ class W extends v {
|
|
|
740
740
|
return this.refinement((s) => e.test(s), {
|
|
741
741
|
validation: r,
|
|
742
742
|
code: l.invalid_string,
|
|
743
|
-
...
|
|
743
|
+
...h.errToObj(n)
|
|
744
744
|
});
|
|
745
745
|
}
|
|
746
746
|
_addCheck(e) {
|
|
747
|
-
return new
|
|
747
|
+
return new G({
|
|
748
748
|
...this._def,
|
|
749
749
|
checks: [...this._def.checks, e]
|
|
750
750
|
});
|
|
751
751
|
}
|
|
752
752
|
email(e) {
|
|
753
|
-
return this._addCheck({ kind: "email", ...
|
|
753
|
+
return this._addCheck({ kind: "email", ...h.errToObj(e) });
|
|
754
754
|
}
|
|
755
755
|
url(e) {
|
|
756
|
-
return this._addCheck({ kind: "url", ...
|
|
756
|
+
return this._addCheck({ kind: "url", ...h.errToObj(e) });
|
|
757
757
|
}
|
|
758
758
|
emoji(e) {
|
|
759
|
-
return this._addCheck({ kind: "emoji", ...
|
|
759
|
+
return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
|
|
760
760
|
}
|
|
761
761
|
uuid(e) {
|
|
762
|
-
return this._addCheck({ kind: "uuid", ...
|
|
762
|
+
return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
|
|
763
763
|
}
|
|
764
764
|
nanoid(e) {
|
|
765
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
765
|
+
return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
|
|
766
766
|
}
|
|
767
767
|
cuid(e) {
|
|
768
|
-
return this._addCheck({ kind: "cuid", ...
|
|
768
|
+
return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
|
|
769
769
|
}
|
|
770
770
|
cuid2(e) {
|
|
771
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
771
|
+
return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
|
|
772
772
|
}
|
|
773
773
|
ulid(e) {
|
|
774
|
-
return this._addCheck({ kind: "ulid", ...
|
|
774
|
+
return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
|
|
775
775
|
}
|
|
776
776
|
base64(e) {
|
|
777
|
-
return this._addCheck({ kind: "base64", ...
|
|
777
|
+
return this._addCheck({ kind: "base64", ...h.errToObj(e) });
|
|
778
778
|
}
|
|
779
779
|
ip(e) {
|
|
780
|
-
return this._addCheck({ kind: "ip", ...
|
|
780
|
+
return this._addCheck({ kind: "ip", ...h.errToObj(e) });
|
|
781
781
|
}
|
|
782
782
|
datetime(e) {
|
|
783
783
|
var r, n;
|
|
@@ -792,7 +792,7 @@ class W extends v {
|
|
|
792
792
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
793
793
|
offset: (r = e == null ? void 0 : e.offset) !== null && r !== void 0 ? r : !1,
|
|
794
794
|
local: (n = e == null ? void 0 : e.local) !== null && n !== void 0 ? n : !1,
|
|
795
|
-
...
|
|
795
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
date(e) {
|
|
@@ -806,17 +806,17 @@ class W extends v {
|
|
|
806
806
|
}) : this._addCheck({
|
|
807
807
|
kind: "time",
|
|
808
808
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
809
|
-
...
|
|
809
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
810
810
|
});
|
|
811
811
|
}
|
|
812
812
|
duration(e) {
|
|
813
|
-
return this._addCheck({ kind: "duration", ...
|
|
813
|
+
return this._addCheck({ kind: "duration", ...h.errToObj(e) });
|
|
814
814
|
}
|
|
815
815
|
regex(e, r) {
|
|
816
816
|
return this._addCheck({
|
|
817
817
|
kind: "regex",
|
|
818
818
|
regex: e,
|
|
819
|
-
...
|
|
819
|
+
...h.errToObj(r)
|
|
820
820
|
});
|
|
821
821
|
}
|
|
822
822
|
includes(e, r) {
|
|
@@ -824,42 +824,42 @@ class W extends v {
|
|
|
824
824
|
kind: "includes",
|
|
825
825
|
value: e,
|
|
826
826
|
position: r == null ? void 0 : r.position,
|
|
827
|
-
...
|
|
827
|
+
...h.errToObj(r == null ? void 0 : r.message)
|
|
828
828
|
});
|
|
829
829
|
}
|
|
830
830
|
startsWith(e, r) {
|
|
831
831
|
return this._addCheck({
|
|
832
832
|
kind: "startsWith",
|
|
833
833
|
value: e,
|
|
834
|
-
...
|
|
834
|
+
...h.errToObj(r)
|
|
835
835
|
});
|
|
836
836
|
}
|
|
837
837
|
endsWith(e, r) {
|
|
838
838
|
return this._addCheck({
|
|
839
839
|
kind: "endsWith",
|
|
840
840
|
value: e,
|
|
841
|
-
...
|
|
841
|
+
...h.errToObj(r)
|
|
842
842
|
});
|
|
843
843
|
}
|
|
844
844
|
min(e, r) {
|
|
845
845
|
return this._addCheck({
|
|
846
846
|
kind: "min",
|
|
847
847
|
value: e,
|
|
848
|
-
...
|
|
848
|
+
...h.errToObj(r)
|
|
849
849
|
});
|
|
850
850
|
}
|
|
851
851
|
max(e, r) {
|
|
852
852
|
return this._addCheck({
|
|
853
853
|
kind: "max",
|
|
854
854
|
value: e,
|
|
855
|
-
...
|
|
855
|
+
...h.errToObj(r)
|
|
856
856
|
});
|
|
857
857
|
}
|
|
858
858
|
length(e, r) {
|
|
859
859
|
return this._addCheck({
|
|
860
860
|
kind: "length",
|
|
861
861
|
value: e,
|
|
862
|
-
...
|
|
862
|
+
...h.errToObj(r)
|
|
863
863
|
});
|
|
864
864
|
}
|
|
865
865
|
/**
|
|
@@ -867,22 +867,22 @@ class W extends v {
|
|
|
867
867
|
* @see {@link ZodString.min}
|
|
868
868
|
*/
|
|
869
869
|
nonempty(e) {
|
|
870
|
-
return this.min(1,
|
|
870
|
+
return this.min(1, h.errToObj(e));
|
|
871
871
|
}
|
|
872
872
|
trim() {
|
|
873
|
-
return new
|
|
873
|
+
return new G({
|
|
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 G({
|
|
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 G({
|
|
886
886
|
...this._def,
|
|
887
887
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
888
888
|
});
|
|
@@ -942,34 +942,34 @@ class W extends v {
|
|
|
942
942
|
return e;
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
|
|
945
|
+
G.create = (t) => {
|
|
946
946
|
var e;
|
|
947
|
-
return new
|
|
947
|
+
return new G({
|
|
948
948
|
checks: [],
|
|
949
949
|
typeName: y.ZodString,
|
|
950
950
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
951
951
|
..._(t)
|
|
952
952
|
});
|
|
953
953
|
};
|
|
954
|
-
function
|
|
954
|
+
function vn(t, e) {
|
|
955
955
|
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = parseInt(t.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
|
|
956
956
|
return a % o / Math.pow(10, s);
|
|
957
957
|
}
|
|
958
|
-
class
|
|
958
|
+
class ve extends w {
|
|
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
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
963
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
|
|
964
964
|
const a = this._getOrReturnCtx(e);
|
|
965
965
|
return m(a, {
|
|
966
966
|
code: l.invalid_type,
|
|
967
|
-
expected:
|
|
967
|
+
expected: p.number,
|
|
968
968
|
received: a.parsedType
|
|
969
969
|
}), g;
|
|
970
970
|
}
|
|
971
971
|
let n;
|
|
972
|
-
const s = new
|
|
972
|
+
const s = new Z();
|
|
973
973
|
for (const a of this._def.checks)
|
|
974
974
|
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), m(n, {
|
|
975
975
|
code: l.invalid_type,
|
|
@@ -990,7 +990,7 @@ class pe extends v {
|
|
|
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" ? vn(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
994
994
|
code: l.not_multiple_of,
|
|
995
995
|
multipleOf: a.value,
|
|
996
996
|
message: a.message
|
|
@@ -1001,19 +1001,19 @@ class pe extends v {
|
|
|
1001
1001
|
return { status: s.value, value: e.data };
|
|
1002
1002
|
}
|
|
1003
1003
|
gte(e, r) {
|
|
1004
|
-
return this.setLimit("min", e, !0,
|
|
1004
|
+
return this.setLimit("min", e, !0, h.toString(r));
|
|
1005
1005
|
}
|
|
1006
1006
|
gt(e, r) {
|
|
1007
|
-
return this.setLimit("min", e, !1,
|
|
1007
|
+
return this.setLimit("min", e, !1, h.toString(r));
|
|
1008
1008
|
}
|
|
1009
1009
|
lte(e, r) {
|
|
1010
|
-
return this.setLimit("max", e, !0,
|
|
1010
|
+
return this.setLimit("max", e, !0, h.toString(r));
|
|
1011
1011
|
}
|
|
1012
1012
|
lt(e, r) {
|
|
1013
|
-
return this.setLimit("max", e, !1,
|
|
1013
|
+
return this.setLimit("max", e, !1, h.toString(r));
|
|
1014
1014
|
}
|
|
1015
1015
|
setLimit(e, r, n, s) {
|
|
1016
|
-
return new
|
|
1016
|
+
return new ve({
|
|
1017
1017
|
...this._def,
|
|
1018
1018
|
checks: [
|
|
1019
1019
|
...this._def.checks,
|
|
@@ -1021,13 +1021,13 @@ class pe extends v {
|
|
|
1021
1021
|
kind: e,
|
|
1022
1022
|
value: r,
|
|
1023
1023
|
inclusive: n,
|
|
1024
|
-
message:
|
|
1024
|
+
message: h.toString(s)
|
|
1025
1025
|
}
|
|
1026
1026
|
]
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
1029
|
_addCheck(e) {
|
|
1030
|
-
return new
|
|
1030
|
+
return new ve({
|
|
1031
1031
|
...this._def,
|
|
1032
1032
|
checks: [...this._def.checks, e]
|
|
1033
1033
|
});
|
|
@@ -1035,7 +1035,7 @@ class pe extends v {
|
|
|
1035
1035
|
int(e) {
|
|
1036
1036
|
return this._addCheck({
|
|
1037
1037
|
kind: "int",
|
|
1038
|
-
message:
|
|
1038
|
+
message: h.toString(e)
|
|
1039
1039
|
});
|
|
1040
1040
|
}
|
|
1041
1041
|
positive(e) {
|
|
@@ -1043,7 +1043,7 @@ class pe extends v {
|
|
|
1043
1043
|
kind: "min",
|
|
1044
1044
|
value: 0,
|
|
1045
1045
|
inclusive: !1,
|
|
1046
|
-
message:
|
|
1046
|
+
message: h.toString(e)
|
|
1047
1047
|
});
|
|
1048
1048
|
}
|
|
1049
1049
|
negative(e) {
|
|
@@ -1051,7 +1051,7 @@ class pe extends v {
|
|
|
1051
1051
|
kind: "max",
|
|
1052
1052
|
value: 0,
|
|
1053
1053
|
inclusive: !1,
|
|
1054
|
-
message:
|
|
1054
|
+
message: h.toString(e)
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
1057
1057
|
nonpositive(e) {
|
|
@@ -1059,7 +1059,7 @@ class pe extends v {
|
|
|
1059
1059
|
kind: "max",
|
|
1060
1060
|
value: 0,
|
|
1061
1061
|
inclusive: !0,
|
|
1062
|
-
message:
|
|
1062
|
+
message: h.toString(e)
|
|
1063
1063
|
});
|
|
1064
1064
|
}
|
|
1065
1065
|
nonnegative(e) {
|
|
@@ -1067,20 +1067,20 @@ class pe extends v {
|
|
|
1067
1067
|
kind: "min",
|
|
1068
1068
|
value: 0,
|
|
1069
1069
|
inclusive: !0,
|
|
1070
|
-
message:
|
|
1070
|
+
message: h.toString(e)
|
|
1071
1071
|
});
|
|
1072
1072
|
}
|
|
1073
1073
|
multipleOf(e, r) {
|
|
1074
1074
|
return this._addCheck({
|
|
1075
1075
|
kind: "multipleOf",
|
|
1076
1076
|
value: e,
|
|
1077
|
-
message:
|
|
1077
|
+
message: h.toString(r)
|
|
1078
1078
|
});
|
|
1079
1079
|
}
|
|
1080
1080
|
finite(e) {
|
|
1081
1081
|
return this._addCheck({
|
|
1082
1082
|
kind: "finite",
|
|
1083
|
-
message:
|
|
1083
|
+
message: h.toString(e)
|
|
1084
1084
|
});
|
|
1085
1085
|
}
|
|
1086
1086
|
safe(e) {
|
|
@@ -1088,12 +1088,12 @@ class pe extends v {
|
|
|
1088
1088
|
kind: "min",
|
|
1089
1089
|
inclusive: !0,
|
|
1090
1090
|
value: Number.MIN_SAFE_INTEGER,
|
|
1091
|
-
message:
|
|
1091
|
+
message: h.toString(e)
|
|
1092
1092
|
})._addCheck({
|
|
1093
1093
|
kind: "max",
|
|
1094
1094
|
inclusive: !0,
|
|
1095
1095
|
value: Number.MAX_SAFE_INTEGER,
|
|
1096
|
-
message:
|
|
1096
|
+
message: h.toString(e)
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
get minValue() {
|
|
@@ -1121,27 +1121,27 @@ class pe extends v {
|
|
|
1121
1121
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
|
-
|
|
1124
|
+
ve.create = (t) => new ve({
|
|
1125
1125
|
checks: [],
|
|
1126
1126
|
typeName: y.ZodNumber,
|
|
1127
1127
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1128
1128
|
..._(t)
|
|
1129
1129
|
});
|
|
1130
|
-
class
|
|
1130
|
+
class we extends w {
|
|
1131
1131
|
constructor() {
|
|
1132
1132
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1133
1133
|
}
|
|
1134
1134
|
_parse(e) {
|
|
1135
|
-
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !==
|
|
1135
|
+
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== p.bigint) {
|
|
1136
1136
|
const a = this._getOrReturnCtx(e);
|
|
1137
1137
|
return m(a, {
|
|
1138
1138
|
code: l.invalid_type,
|
|
1139
|
-
expected:
|
|
1139
|
+
expected: p.bigint,
|
|
1140
1140
|
received: a.parsedType
|
|
1141
1141
|
}), g;
|
|
1142
1142
|
}
|
|
1143
1143
|
let n;
|
|
1144
|
-
const s = new
|
|
1144
|
+
const s = new Z();
|
|
1145
1145
|
for (const a of this._def.checks)
|
|
1146
1146
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
1147
1147
|
code: l.too_small,
|
|
@@ -1163,19 +1163,19 @@ class ye extends v {
|
|
|
1163
1163
|
return { status: s.value, value: e.data };
|
|
1164
1164
|
}
|
|
1165
1165
|
gte(e, r) {
|
|
1166
|
-
return this.setLimit("min", e, !0,
|
|
1166
|
+
return this.setLimit("min", e, !0, h.toString(r));
|
|
1167
1167
|
}
|
|
1168
1168
|
gt(e, r) {
|
|
1169
|
-
return this.setLimit("min", e, !1,
|
|
1169
|
+
return this.setLimit("min", e, !1, h.toString(r));
|
|
1170
1170
|
}
|
|
1171
1171
|
lte(e, r) {
|
|
1172
|
-
return this.setLimit("max", e, !0,
|
|
1172
|
+
return this.setLimit("max", e, !0, h.toString(r));
|
|
1173
1173
|
}
|
|
1174
1174
|
lt(e, r) {
|
|
1175
|
-
return this.setLimit("max", e, !1,
|
|
1175
|
+
return this.setLimit("max", e, !1, h.toString(r));
|
|
1176
1176
|
}
|
|
1177
1177
|
setLimit(e, r, n, s) {
|
|
1178
|
-
return new
|
|
1178
|
+
return new we({
|
|
1179
1179
|
...this._def,
|
|
1180
1180
|
checks: [
|
|
1181
1181
|
...this._def.checks,
|
|
@@ -1183,13 +1183,13 @@ class ye extends v {
|
|
|
1183
1183
|
kind: e,
|
|
1184
1184
|
value: r,
|
|
1185
1185
|
inclusive: n,
|
|
1186
|
-
message:
|
|
1186
|
+
message: h.toString(s)
|
|
1187
1187
|
}
|
|
1188
1188
|
]
|
|
1189
1189
|
});
|
|
1190
1190
|
}
|
|
1191
1191
|
_addCheck(e) {
|
|
1192
|
-
return new
|
|
1192
|
+
return new we({
|
|
1193
1193
|
...this._def,
|
|
1194
1194
|
checks: [...this._def.checks, e]
|
|
1195
1195
|
});
|
|
@@ -1199,7 +1199,7 @@ class ye extends v {
|
|
|
1199
1199
|
kind: "min",
|
|
1200
1200
|
value: BigInt(0),
|
|
1201
1201
|
inclusive: !1,
|
|
1202
|
-
message:
|
|
1202
|
+
message: h.toString(e)
|
|
1203
1203
|
});
|
|
1204
1204
|
}
|
|
1205
1205
|
negative(e) {
|
|
@@ -1207,7 +1207,7 @@ class ye extends v {
|
|
|
1207
1207
|
kind: "max",
|
|
1208
1208
|
value: BigInt(0),
|
|
1209
1209
|
inclusive: !1,
|
|
1210
|
-
message:
|
|
1210
|
+
message: h.toString(e)
|
|
1211
1211
|
});
|
|
1212
1212
|
}
|
|
1213
1213
|
nonpositive(e) {
|
|
@@ -1215,7 +1215,7 @@ class ye extends v {
|
|
|
1215
1215
|
kind: "max",
|
|
1216
1216
|
value: BigInt(0),
|
|
1217
1217
|
inclusive: !0,
|
|
1218
|
-
message:
|
|
1218
|
+
message: h.toString(e)
|
|
1219
1219
|
});
|
|
1220
1220
|
}
|
|
1221
1221
|
nonnegative(e) {
|
|
@@ -1223,14 +1223,14 @@ class ye extends v {
|
|
|
1223
1223
|
kind: "min",
|
|
1224
1224
|
value: BigInt(0),
|
|
1225
1225
|
inclusive: !0,
|
|
1226
|
-
message:
|
|
1226
|
+
message: h.toString(e)
|
|
1227
1227
|
});
|
|
1228
1228
|
}
|
|
1229
1229
|
multipleOf(e, r) {
|
|
1230
1230
|
return this._addCheck({
|
|
1231
1231
|
kind: "multipleOf",
|
|
1232
1232
|
value: e,
|
|
1233
|
-
message:
|
|
1233
|
+
message: h.toString(r)
|
|
1234
1234
|
});
|
|
1235
1235
|
}
|
|
1236
1236
|
get minValue() {
|
|
@@ -1246,40 +1246,40 @@ class ye extends v {
|
|
|
1246
1246
|
return e;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
|
|
1249
|
+
we.create = (t) => {
|
|
1250
1250
|
var e;
|
|
1251
|
-
return new
|
|
1251
|
+
return new we({
|
|
1252
1252
|
checks: [],
|
|
1253
1253
|
typeName: y.ZodBigInt,
|
|
1254
1254
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
1255
1255
|
..._(t)
|
|
1256
1256
|
});
|
|
1257
1257
|
};
|
|
1258
|
-
class
|
|
1258
|
+
class We extends w {
|
|
1259
1259
|
_parse(e) {
|
|
1260
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1260
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
1261
1261
|
const n = this._getOrReturnCtx(e);
|
|
1262
1262
|
return m(n, {
|
|
1263
1263
|
code: l.invalid_type,
|
|
1264
|
-
expected:
|
|
1264
|
+
expected: p.boolean,
|
|
1265
1265
|
received: n.parsedType
|
|
1266
1266
|
}), g;
|
|
1267
1267
|
}
|
|
1268
|
-
return
|
|
1268
|
+
return L(e.data);
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
|
-
|
|
1271
|
+
We.create = (t) => new We({
|
|
1272
1272
|
typeName: y.ZodBoolean,
|
|
1273
1273
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1274
1274
|
..._(t)
|
|
1275
1275
|
});
|
|
1276
|
-
class
|
|
1276
|
+
class Oe extends w {
|
|
1277
1277
|
_parse(e) {
|
|
1278
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1278
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1279
1279
|
const a = this._getOrReturnCtx(e);
|
|
1280
1280
|
return m(a, {
|
|
1281
1281
|
code: l.invalid_type,
|
|
1282
|
-
expected:
|
|
1282
|
+
expected: p.date,
|
|
1283
1283
|
received: a.parsedType
|
|
1284
1284
|
}), g;
|
|
1285
1285
|
}
|
|
@@ -1289,7 +1289,7 @@ class Te extends v {
|
|
|
1289
1289
|
code: l.invalid_date
|
|
1290
1290
|
}), g;
|
|
1291
1291
|
}
|
|
1292
|
-
const n = new
|
|
1292
|
+
const n = new Z();
|
|
1293
1293
|
let s;
|
|
1294
1294
|
for (const a of this._def.checks)
|
|
1295
1295
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
@@ -1313,7 +1313,7 @@ class Te extends v {
|
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
1315
|
_addCheck(e) {
|
|
1316
|
-
return new
|
|
1316
|
+
return new Oe({
|
|
1317
1317
|
...this._def,
|
|
1318
1318
|
checks: [...this._def.checks, e]
|
|
1319
1319
|
});
|
|
@@ -1322,14 +1322,14 @@ class Te extends v {
|
|
|
1322
1322
|
return this._addCheck({
|
|
1323
1323
|
kind: "min",
|
|
1324
1324
|
value: e.getTime(),
|
|
1325
|
-
message:
|
|
1325
|
+
message: h.toString(r)
|
|
1326
1326
|
});
|
|
1327
1327
|
}
|
|
1328
1328
|
max(e, r) {
|
|
1329
1329
|
return this._addCheck({
|
|
1330
1330
|
kind: "max",
|
|
1331
1331
|
value: e.getTime(),
|
|
1332
|
-
message:
|
|
1332
|
+
message: h.toString(r)
|
|
1333
1333
|
});
|
|
1334
1334
|
}
|
|
1335
1335
|
get minDate() {
|
|
@@ -1345,125 +1345,125 @@ class Te extends v {
|
|
|
1345
1345
|
return e != null ? new Date(e) : null;
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
-
|
|
1348
|
+
Oe.create = (t) => new Oe({
|
|
1349
1349
|
checks: [],
|
|
1350
1350
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1351
1351
|
typeName: y.ZodDate,
|
|
1352
1352
|
..._(t)
|
|
1353
1353
|
});
|
|
1354
|
-
class
|
|
1354
|
+
class ht extends w {
|
|
1355
1355
|
_parse(e) {
|
|
1356
|
-
if (this._getType(e) !==
|
|
1356
|
+
if (this._getType(e) !== p.symbol) {
|
|
1357
1357
|
const n = this._getOrReturnCtx(e);
|
|
1358
1358
|
return m(n, {
|
|
1359
1359
|
code: l.invalid_type,
|
|
1360
|
-
expected:
|
|
1360
|
+
expected: p.symbol,
|
|
1361
1361
|
received: n.parsedType
|
|
1362
1362
|
}), g;
|
|
1363
1363
|
}
|
|
1364
|
-
return
|
|
1364
|
+
return L(e.data);
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
|
-
|
|
1367
|
+
ht.create = (t) => new ht({
|
|
1368
1368
|
typeName: y.ZodSymbol,
|
|
1369
1369
|
..._(t)
|
|
1370
1370
|
});
|
|
1371
|
-
class
|
|
1371
|
+
class Ke extends w {
|
|
1372
1372
|
_parse(e) {
|
|
1373
|
-
if (this._getType(e) !==
|
|
1373
|
+
if (this._getType(e) !== p.undefined) {
|
|
1374
1374
|
const n = this._getOrReturnCtx(e);
|
|
1375
1375
|
return m(n, {
|
|
1376
1376
|
code: l.invalid_type,
|
|
1377
|
-
expected:
|
|
1377
|
+
expected: p.undefined,
|
|
1378
1378
|
received: n.parsedType
|
|
1379
1379
|
}), g;
|
|
1380
1380
|
}
|
|
1381
|
-
return
|
|
1381
|
+
return L(e.data);
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
|
-
|
|
1384
|
+
Ke.create = (t) => new Ke({
|
|
1385
1385
|
typeName: y.ZodUndefined,
|
|
1386
1386
|
..._(t)
|
|
1387
1387
|
});
|
|
1388
|
-
class
|
|
1388
|
+
class Ye extends w {
|
|
1389
1389
|
_parse(e) {
|
|
1390
|
-
if (this._getType(e) !==
|
|
1390
|
+
if (this._getType(e) !== p.null) {
|
|
1391
1391
|
const n = this._getOrReturnCtx(e);
|
|
1392
1392
|
return m(n, {
|
|
1393
1393
|
code: l.invalid_type,
|
|
1394
|
-
expected:
|
|
1394
|
+
expected: p.null,
|
|
1395
1395
|
received: n.parsedType
|
|
1396
1396
|
}), g;
|
|
1397
1397
|
}
|
|
1398
|
-
return
|
|
1398
|
+
return L(e.data);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
|
-
|
|
1401
|
+
Ye.create = (t) => new Ye({
|
|
1402
1402
|
typeName: y.ZodNull,
|
|
1403
1403
|
..._(t)
|
|
1404
1404
|
});
|
|
1405
|
-
class
|
|
1405
|
+
class Ze extends w {
|
|
1406
1406
|
constructor() {
|
|
1407
1407
|
super(...arguments), this._any = !0;
|
|
1408
1408
|
}
|
|
1409
1409
|
_parse(e) {
|
|
1410
|
-
return
|
|
1410
|
+
return L(e.data);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
|
-
|
|
1413
|
+
Ze.create = (t) => new Ze({
|
|
1414
1414
|
typeName: y.ZodAny,
|
|
1415
1415
|
..._(t)
|
|
1416
1416
|
});
|
|
1417
|
-
class
|
|
1417
|
+
class Re extends w {
|
|
1418
1418
|
constructor() {
|
|
1419
1419
|
super(...arguments), this._unknown = !0;
|
|
1420
1420
|
}
|
|
1421
1421
|
_parse(e) {
|
|
1422
|
-
return
|
|
1422
|
+
return L(e.data);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
|
-
|
|
1425
|
+
Re.create = (t) => new Re({
|
|
1426
1426
|
typeName: y.ZodUnknown,
|
|
1427
1427
|
..._(t)
|
|
1428
1428
|
});
|
|
1429
|
-
class
|
|
1429
|
+
class le extends w {
|
|
1430
1430
|
_parse(e) {
|
|
1431
1431
|
const r = this._getOrReturnCtx(e);
|
|
1432
1432
|
return m(r, {
|
|
1433
1433
|
code: l.invalid_type,
|
|
1434
|
-
expected:
|
|
1434
|
+
expected: p.never,
|
|
1435
1435
|
received: r.parsedType
|
|
1436
1436
|
}), g;
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
|
-
|
|
1439
|
+
le.create = (t) => new le({
|
|
1440
1440
|
typeName: y.ZodNever,
|
|
1441
1441
|
..._(t)
|
|
1442
1442
|
});
|
|
1443
|
-
class
|
|
1443
|
+
class yt extends w {
|
|
1444
1444
|
_parse(e) {
|
|
1445
|
-
if (this._getType(e) !==
|
|
1445
|
+
if (this._getType(e) !== p.undefined) {
|
|
1446
1446
|
const n = this._getOrReturnCtx(e);
|
|
1447
1447
|
return m(n, {
|
|
1448
1448
|
code: l.invalid_type,
|
|
1449
|
-
expected:
|
|
1449
|
+
expected: p.void,
|
|
1450
1450
|
received: n.parsedType
|
|
1451
1451
|
}), g;
|
|
1452
1452
|
}
|
|
1453
|
-
return
|
|
1453
|
+
return L(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
|
|
1456
|
+
yt.create = (t) => new yt({
|
|
1457
1457
|
typeName: y.ZodVoid,
|
|
1458
1458
|
..._(t)
|
|
1459
1459
|
});
|
|
1460
|
-
class
|
|
1460
|
+
class X extends w {
|
|
1461
1461
|
_parse(e) {
|
|
1462
1462
|
const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
|
|
1463
|
-
if (r.parsedType !==
|
|
1463
|
+
if (r.parsedType !== p.array)
|
|
1464
1464
|
return m(r, {
|
|
1465
1465
|
code: l.invalid_type,
|
|
1466
|
-
expected:
|
|
1466
|
+
expected: p.array,
|
|
1467
1467
|
received: r.parsedType
|
|
1468
1468
|
}), g;
|
|
1469
1469
|
if (s.exactLength !== null) {
|
|
@@ -1493,36 +1493,36 @@ class K extends v {
|
|
|
1493
1493
|
exact: !1,
|
|
1494
1494
|
message: s.maxLength.message
|
|
1495
1495
|
}), n.dirty()), r.common.async)
|
|
1496
|
-
return Promise.all([...r.data].map((o, c) => s.type._parseAsync(new
|
|
1497
|
-
const a = [...r.data].map((o, c) => s.type._parseSync(new
|
|
1498
|
-
return
|
|
1496
|
+
return Promise.all([...r.data].map((o, c) => s.type._parseAsync(new ie(r, o, r.path, c)))).then((o) => Z.mergeArray(n, o));
|
|
1497
|
+
const a = [...r.data].map((o, c) => s.type._parseSync(new ie(r, o, r.path, c)));
|
|
1498
|
+
return Z.mergeArray(n, a);
|
|
1499
1499
|
}
|
|
1500
1500
|
get element() {
|
|
1501
1501
|
return this._def.type;
|
|
1502
1502
|
}
|
|
1503
1503
|
min(e, r) {
|
|
1504
|
-
return new
|
|
1504
|
+
return new X({
|
|
1505
1505
|
...this._def,
|
|
1506
|
-
minLength: { value: e, message:
|
|
1506
|
+
minLength: { value: e, message: h.toString(r) }
|
|
1507
1507
|
});
|
|
1508
1508
|
}
|
|
1509
1509
|
max(e, r) {
|
|
1510
|
-
return new
|
|
1510
|
+
return new X({
|
|
1511
1511
|
...this._def,
|
|
1512
|
-
maxLength: { value: e, message:
|
|
1512
|
+
maxLength: { value: e, message: h.toString(r) }
|
|
1513
1513
|
});
|
|
1514
1514
|
}
|
|
1515
1515
|
length(e, r) {
|
|
1516
|
-
return new
|
|
1516
|
+
return new X({
|
|
1517
1517
|
...this._def,
|
|
1518
|
-
exactLength: { value: e, message:
|
|
1518
|
+
exactLength: { value: e, message: h.toString(r) }
|
|
1519
1519
|
});
|
|
1520
1520
|
}
|
|
1521
1521
|
nonempty(e) {
|
|
1522
1522
|
return this.min(1, e);
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
|
-
|
|
1525
|
+
X.create = (t, e) => new X({
|
|
1526
1526
|
type: t,
|
|
1527
1527
|
minLength: null,
|
|
1528
1528
|
maxLength: null,
|
|
@@ -1530,23 +1530,23 @@ K.create = (t, e) => new K({
|
|
|
1530
1530
|
typeName: y.ZodArray,
|
|
1531
1531
|
..._(e)
|
|
1532
1532
|
});
|
|
1533
|
-
function
|
|
1534
|
-
if (t instanceof
|
|
1533
|
+
function Ae(t) {
|
|
1534
|
+
if (t instanceof R) {
|
|
1535
1535
|
const e = {};
|
|
1536
1536
|
for (const r in t.shape) {
|
|
1537
1537
|
const n = t.shape[r];
|
|
1538
|
-
e[r] =
|
|
1538
|
+
e[r] = se.create(Ae(n));
|
|
1539
1539
|
}
|
|
1540
|
-
return new
|
|
1540
|
+
return new R({
|
|
1541
1541
|
...t._def,
|
|
1542
1542
|
shape: () => e
|
|
1543
1543
|
});
|
|
1544
|
-
} else return t instanceof
|
|
1544
|
+
} else return t instanceof X ? new X({
|
|
1545
1545
|
...t._def,
|
|
1546
|
-
type:
|
|
1547
|
-
}) : t instanceof
|
|
1546
|
+
type: Ae(t.element)
|
|
1547
|
+
}) : t instanceof se ? se.create(Ae(t.unwrap())) : t instanceof xe ? xe.create(Ae(t.unwrap())) : t instanceof oe ? oe.create(t.items.map((e) => Ae(e))) : t;
|
|
1548
1548
|
}
|
|
1549
|
-
class
|
|
1549
|
+
class R extends w {
|
|
1550
1550
|
constructor() {
|
|
1551
1551
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1552
1552
|
}
|
|
@@ -1557,28 +1557,28 @@ class C extends v {
|
|
|
1557
1557
|
return this._cached = { shape: e, keys: r };
|
|
1558
1558
|
}
|
|
1559
1559
|
_parse(e) {
|
|
1560
|
-
if (this._getType(e) !==
|
|
1560
|
+
if (this._getType(e) !== p.object) {
|
|
1561
1561
|
const d = this._getOrReturnCtx(e);
|
|
1562
1562
|
return m(d, {
|
|
1563
1563
|
code: l.invalid_type,
|
|
1564
|
-
expected:
|
|
1564
|
+
expected: p.object,
|
|
1565
1565
|
received: d.parsedType
|
|
1566
1566
|
}), g;
|
|
1567
1567
|
}
|
|
1568
1568
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), c = [];
|
|
1569
|
-
if (!(this._def.catchall instanceof
|
|
1569
|
+
if (!(this._def.catchall instanceof le && this._def.unknownKeys === "strip"))
|
|
1570
1570
|
for (const d in s.data)
|
|
1571
1571
|
o.includes(d) || c.push(d);
|
|
1572
1572
|
const u = [];
|
|
1573
1573
|
for (const d of o) {
|
|
1574
|
-
const f = a[d],
|
|
1574
|
+
const f = a[d], v = s.data[d];
|
|
1575
1575
|
u.push({
|
|
1576
1576
|
key: { status: "valid", value: d },
|
|
1577
|
-
value: f._parse(new
|
|
1577
|
+
value: f._parse(new ie(s, v, s.path, d)),
|
|
1578
1578
|
alwaysSet: d in s.data
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
1581
|
-
if (this._def.catchall instanceof
|
|
1581
|
+
if (this._def.catchall instanceof le) {
|
|
1582
1582
|
const d = this._def.unknownKeys;
|
|
1583
1583
|
if (d === "passthrough")
|
|
1584
1584
|
for (const f of c)
|
|
@@ -1595,11 +1595,11 @@ class C extends v {
|
|
|
1595
1595
|
} else {
|
|
1596
1596
|
const d = this._def.catchall;
|
|
1597
1597
|
for (const f of c) {
|
|
1598
|
-
const
|
|
1598
|
+
const v = s.data[f];
|
|
1599
1599
|
u.push({
|
|
1600
1600
|
key: { status: "valid", value: f },
|
|
1601
1601
|
value: d._parse(
|
|
1602
|
-
new
|
|
1602
|
+
new ie(s, v, s.path, f)
|
|
1603
1603
|
//, ctx.child(key), value, getParsedType(value)
|
|
1604
1604
|
),
|
|
1605
1605
|
alwaysSet: f in s.data
|
|
@@ -1609,21 +1609,21 @@ class C extends v {
|
|
|
1609
1609
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1610
1610
|
const d = [];
|
|
1611
1611
|
for (const f of u) {
|
|
1612
|
-
const
|
|
1612
|
+
const v = await f.key, b = await f.value;
|
|
1613
1613
|
d.push({
|
|
1614
|
-
key:
|
|
1615
|
-
value:
|
|
1614
|
+
key: v,
|
|
1615
|
+
value: b,
|
|
1616
1616
|
alwaysSet: f.alwaysSet
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
1619
1619
|
return d;
|
|
1620
|
-
}).then((d) =>
|
|
1620
|
+
}).then((d) => Z.mergeObjectSync(n, d)) : Z.mergeObjectSync(n, u);
|
|
1621
1621
|
}
|
|
1622
1622
|
get shape() {
|
|
1623
1623
|
return this._def.shape();
|
|
1624
1624
|
}
|
|
1625
1625
|
strict(e) {
|
|
1626
|
-
return
|
|
1626
|
+
return h.errToObj, new R({
|
|
1627
1627
|
...this._def,
|
|
1628
1628
|
unknownKeys: "strict",
|
|
1629
1629
|
...e !== void 0 ? {
|
|
@@ -1631,7 +1631,7 @@ class C extends v {
|
|
|
1631
1631
|
var s, a, o, c;
|
|
1632
1632
|
const u = (o = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, r, n).message) !== null && o !== void 0 ? o : n.defaultError;
|
|
1633
1633
|
return r.code === "unrecognized_keys" ? {
|
|
1634
|
-
message: (c =
|
|
1634
|
+
message: (c = h.errToObj(e).message) !== null && c !== void 0 ? c : u
|
|
1635
1635
|
} : {
|
|
1636
1636
|
message: u
|
|
1637
1637
|
};
|
|
@@ -1640,13 +1640,13 @@ class C extends v {
|
|
|
1640
1640
|
});
|
|
1641
1641
|
}
|
|
1642
1642
|
strip() {
|
|
1643
|
-
return new
|
|
1643
|
+
return new R({
|
|
1644
1644
|
...this._def,
|
|
1645
1645
|
unknownKeys: "strip"
|
|
1646
1646
|
});
|
|
1647
1647
|
}
|
|
1648
1648
|
passthrough() {
|
|
1649
|
-
return new
|
|
1649
|
+
return new R({
|
|
1650
1650
|
...this._def,
|
|
1651
1651
|
unknownKeys: "passthrough"
|
|
1652
1652
|
});
|
|
@@ -1669,7 +1669,7 @@ class C extends v {
|
|
|
1669
1669
|
// }) as any;
|
|
1670
1670
|
// };
|
|
1671
1671
|
extend(e) {
|
|
1672
|
-
return new
|
|
1672
|
+
return new R({
|
|
1673
1673
|
...this._def,
|
|
1674
1674
|
shape: () => ({
|
|
1675
1675
|
...this._def.shape(),
|
|
@@ -1683,7 +1683,7 @@ class C extends v {
|
|
|
1683
1683
|
* upgrade if you are experiencing issues.
|
|
1684
1684
|
*/
|
|
1685
1685
|
merge(e) {
|
|
1686
|
-
return new
|
|
1686
|
+
return new R({
|
|
1687
1687
|
unknownKeys: e._def.unknownKeys,
|
|
1688
1688
|
catchall: e._def.catchall,
|
|
1689
1689
|
shape: () => ({
|
|
@@ -1753,7 +1753,7 @@ class C extends v {
|
|
|
1753
1753
|
// return merged;
|
|
1754
1754
|
// }
|
|
1755
1755
|
catchall(e) {
|
|
1756
|
-
return new
|
|
1756
|
+
return new R({
|
|
1757
1757
|
...this._def,
|
|
1758
1758
|
catchall: e
|
|
1759
1759
|
});
|
|
@@ -1762,7 +1762,7 @@ class C extends v {
|
|
|
1762
1762
|
const r = {};
|
|
1763
1763
|
return x.objectKeys(e).forEach((n) => {
|
|
1764
1764
|
e[n] && this.shape[n] && (r[n] = this.shape[n]);
|
|
1765
|
-
}), new
|
|
1765
|
+
}), new R({
|
|
1766
1766
|
...this._def,
|
|
1767
1767
|
shape: () => r
|
|
1768
1768
|
});
|
|
@@ -1771,7 +1771,7 @@ class C extends v {
|
|
|
1771
1771
|
const r = {};
|
|
1772
1772
|
return x.objectKeys(this.shape).forEach((n) => {
|
|
1773
1773
|
e[n] || (r[n] = this.shape[n]);
|
|
1774
|
-
}), new
|
|
1774
|
+
}), new R({
|
|
1775
1775
|
...this._def,
|
|
1776
1776
|
shape: () => r
|
|
1777
1777
|
});
|
|
@@ -1780,14 +1780,14 @@ class C extends v {
|
|
|
1780
1780
|
* @deprecated
|
|
1781
1781
|
*/
|
|
1782
1782
|
deepPartial() {
|
|
1783
|
-
return
|
|
1783
|
+
return Ae(this);
|
|
1784
1784
|
}
|
|
1785
1785
|
partial(e) {
|
|
1786
1786
|
const r = {};
|
|
1787
1787
|
return x.objectKeys(this.shape).forEach((n) => {
|
|
1788
1788
|
const s = this.shape[n];
|
|
1789
1789
|
e && !e[n] ? r[n] = s : r[n] = s.optional();
|
|
1790
|
-
}), new
|
|
1790
|
+
}), new R({
|
|
1791
1791
|
...this._def,
|
|
1792
1792
|
shape: () => r
|
|
1793
1793
|
});
|
|
@@ -1799,41 +1799,41 @@ class C extends v {
|
|
|
1799
1799
|
r[n] = this.shape[n];
|
|
1800
1800
|
else {
|
|
1801
1801
|
let a = this.shape[n];
|
|
1802
|
-
for (; a instanceof
|
|
1802
|
+
for (; a instanceof se; )
|
|
1803
1803
|
a = a._def.innerType;
|
|
1804
1804
|
r[n] = a;
|
|
1805
1805
|
}
|
|
1806
|
-
}), new
|
|
1806
|
+
}), new R({
|
|
1807
1807
|
...this._def,
|
|
1808
1808
|
shape: () => r
|
|
1809
1809
|
});
|
|
1810
1810
|
}
|
|
1811
1811
|
keyof() {
|
|
1812
|
-
return
|
|
1812
|
+
return ur(x.objectKeys(this.shape));
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
|
-
|
|
1815
|
+
R.create = (t, e) => new R({
|
|
1816
1816
|
shape: () => t,
|
|
1817
1817
|
unknownKeys: "strip",
|
|
1818
|
-
catchall:
|
|
1818
|
+
catchall: le.create(),
|
|
1819
1819
|
typeName: y.ZodObject,
|
|
1820
1820
|
..._(e)
|
|
1821
1821
|
});
|
|
1822
|
-
|
|
1822
|
+
R.strictCreate = (t, e) => new R({
|
|
1823
1823
|
shape: () => t,
|
|
1824
1824
|
unknownKeys: "strict",
|
|
1825
|
-
catchall:
|
|
1825
|
+
catchall: le.create(),
|
|
1826
1826
|
typeName: y.ZodObject,
|
|
1827
1827
|
..._(e)
|
|
1828
1828
|
});
|
|
1829
|
-
|
|
1829
|
+
R.lazycreate = (t, e) => new R({
|
|
1830
1830
|
shape: t,
|
|
1831
1831
|
unknownKeys: "strip",
|
|
1832
|
-
catchall:
|
|
1832
|
+
catchall: le.create(),
|
|
1833
1833
|
typeName: y.ZodObject,
|
|
1834
1834
|
..._(e)
|
|
1835
1835
|
});
|
|
1836
|
-
class
|
|
1836
|
+
class Je extends w {
|
|
1837
1837
|
_parse(e) {
|
|
1838
1838
|
const { ctx: r } = this._processInputParams(e), n = this._def.options;
|
|
1839
1839
|
function s(a) {
|
|
@@ -1843,7 +1843,7 @@ class qe extends v {
|
|
|
1843
1843
|
for (const c of a)
|
|
1844
1844
|
if (c.result.status === "dirty")
|
|
1845
1845
|
return r.common.issues.push(...c.ctx.common.issues), c.result;
|
|
1846
|
-
const o = a.map((c) => new
|
|
1846
|
+
const o = a.map((c) => new H(c.ctx.common.issues));
|
|
1847
1847
|
return m(r, {
|
|
1848
1848
|
code: l.invalid_union,
|
|
1849
1849
|
unionErrors: o
|
|
@@ -1890,7 +1890,7 @@ class qe extends v {
|
|
|
1890
1890
|
}
|
|
1891
1891
|
if (a)
|
|
1892
1892
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1893
|
-
const c = o.map((u) => new
|
|
1893
|
+
const c = o.map((u) => new H(u));
|
|
1894
1894
|
return m(r, {
|
|
1895
1895
|
code: l.invalid_union,
|
|
1896
1896
|
unionErrors: c
|
|
@@ -1901,19 +1901,19 @@ class qe extends v {
|
|
|
1901
1901
|
return this._def.options;
|
|
1902
1902
|
}
|
|
1903
1903
|
}
|
|
1904
|
-
|
|
1904
|
+
Je.create = (t, e) => new Je({
|
|
1905
1905
|
options: t,
|
|
1906
1906
|
typeName: y.ZodUnion,
|
|
1907
1907
|
..._(e)
|
|
1908
1908
|
});
|
|
1909
|
-
const
|
|
1910
|
-
class
|
|
1909
|
+
const ue = (t) => t instanceof Qe ? ue(t.schema) : t instanceof Q ? ue(t.innerType()) : t instanceof et ? [t.value] : t instanceof be ? t.options : t instanceof tt ? x.objectValues(t.enum) : t instanceof rt ? ue(t._def.innerType) : t instanceof Ke ? [void 0] : t instanceof Ye ? [null] : t instanceof se ? [void 0, ...ue(t.unwrap())] : t instanceof xe ? [null, ...ue(t.unwrap())] : t instanceof jt || t instanceof st ? ue(t.unwrap()) : t instanceof nt ? ue(t._def.innerType) : [];
|
|
1910
|
+
class wt extends w {
|
|
1911
1911
|
_parse(e) {
|
|
1912
1912
|
const { ctx: r } = this._processInputParams(e);
|
|
1913
|
-
if (r.parsedType !==
|
|
1913
|
+
if (r.parsedType !== p.object)
|
|
1914
1914
|
return m(r, {
|
|
1915
1915
|
code: l.invalid_type,
|
|
1916
|
-
expected:
|
|
1916
|
+
expected: p.object,
|
|
1917
1917
|
received: r.parsedType
|
|
1918
1918
|
}), g;
|
|
1919
1919
|
const n = this.discriminator, s = r.data[n], a = this.optionsMap.get(s);
|
|
@@ -1951,7 +1951,7 @@ class pt extends v {
|
|
|
1951
1951
|
static create(e, r, n) {
|
|
1952
1952
|
const s = /* @__PURE__ */ new Map();
|
|
1953
1953
|
for (const a of r) {
|
|
1954
|
-
const o =
|
|
1954
|
+
const o = ue(a.shape[e]);
|
|
1955
1955
|
if (!o.length)
|
|
1956
1956
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1957
1957
|
for (const c of o) {
|
|
@@ -1960,7 +1960,7 @@ class pt extends v {
|
|
|
1960
1960
|
s.set(c, a);
|
|
1961
1961
|
}
|
|
1962
1962
|
}
|
|
1963
|
-
return new
|
|
1963
|
+
return new wt({
|
|
1964
1964
|
typeName: y.ZodDiscriminatedUnion,
|
|
1965
1965
|
discriminator: e,
|
|
1966
1966
|
options: r,
|
|
@@ -1969,39 +1969,39 @@ class pt extends v {
|
|
|
1969
1969
|
});
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
|
-
function
|
|
1973
|
-
const r =
|
|
1972
|
+
function It(t, e) {
|
|
1973
|
+
const r = he(t), n = he(e);
|
|
1974
1974
|
if (t === e)
|
|
1975
1975
|
return { valid: !0, data: t };
|
|
1976
|
-
if (r ===
|
|
1976
|
+
if (r === p.object && n === p.object) {
|
|
1977
1977
|
const s = x.objectKeys(e), a = x.objectKeys(t).filter((c) => s.indexOf(c) !== -1), o = { ...t, ...e };
|
|
1978
1978
|
for (const c of a) {
|
|
1979
|
-
const u =
|
|
1979
|
+
const u = It(t[c], e[c]);
|
|
1980
1980
|
if (!u.valid)
|
|
1981
1981
|
return { valid: !1 };
|
|
1982
1982
|
o[c] = u.data;
|
|
1983
1983
|
}
|
|
1984
1984
|
return { valid: !0, data: o };
|
|
1985
|
-
} else if (r ===
|
|
1985
|
+
} else if (r === p.array && n === p.array) {
|
|
1986
1986
|
if (t.length !== e.length)
|
|
1987
1987
|
return { valid: !1 };
|
|
1988
1988
|
const s = [];
|
|
1989
1989
|
for (let a = 0; a < t.length; a++) {
|
|
1990
|
-
const o = t[a], c = e[a], u =
|
|
1990
|
+
const o = t[a], c = e[a], u = It(o, c);
|
|
1991
1991
|
if (!u.valid)
|
|
1992
1992
|
return { valid: !1 };
|
|
1993
1993
|
s.push(u.data);
|
|
1994
1994
|
}
|
|
1995
1995
|
return { valid: !0, data: s };
|
|
1996
|
-
} else return r ===
|
|
1996
|
+
} else return r === p.date && n === p.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
1997
1997
|
}
|
|
1998
|
-
class
|
|
1998
|
+
class Ge extends w {
|
|
1999
1999
|
_parse(e) {
|
|
2000
2000
|
const { status: r, ctx: n } = this._processInputParams(e), s = (a, o) => {
|
|
2001
|
-
if (
|
|
2001
|
+
if (Rt(a) || Rt(o))
|
|
2002
2002
|
return g;
|
|
2003
|
-
const c =
|
|
2004
|
-
return c.valid ? ((
|
|
2003
|
+
const c = It(a.value, o.value);
|
|
2004
|
+
return c.valid ? ((Ot(a) || Ot(o)) && r.dirty(), { status: r.value, value: c.data }) : (m(n, {
|
|
2005
2005
|
code: l.invalid_intersection_types
|
|
2006
2006
|
}), g);
|
|
2007
2007
|
};
|
|
@@ -2027,19 +2027,19 @@ class We extends v {
|
|
|
2027
2027
|
}));
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
|
-
|
|
2030
|
+
Ge.create = (t, e, r) => new Ge({
|
|
2031
2031
|
left: t,
|
|
2032
2032
|
right: e,
|
|
2033
2033
|
typeName: y.ZodIntersection,
|
|
2034
2034
|
..._(r)
|
|
2035
2035
|
});
|
|
2036
|
-
class
|
|
2036
|
+
class oe extends w {
|
|
2037
2037
|
_parse(e) {
|
|
2038
2038
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2039
|
-
if (n.parsedType !==
|
|
2039
|
+
if (n.parsedType !== p.array)
|
|
2040
2040
|
return m(n, {
|
|
2041
2041
|
code: l.invalid_type,
|
|
2042
|
-
expected:
|
|
2042
|
+
expected: p.array,
|
|
2043
2043
|
received: n.parsedType
|
|
2044
2044
|
}), g;
|
|
2045
2045
|
if (n.data.length < this._def.items.length)
|
|
@@ -2059,31 +2059,31 @@ class te extends v {
|
|
|
2059
2059
|
}), r.dirty());
|
|
2060
2060
|
const a = [...n.data].map((o, c) => {
|
|
2061
2061
|
const u = this._def.items[c] || this._def.rest;
|
|
2062
|
-
return u ? u._parse(new
|
|
2062
|
+
return u ? u._parse(new ie(n, o, n.path, c)) : null;
|
|
2063
2063
|
}).filter((o) => !!o);
|
|
2064
|
-
return n.common.async ? Promise.all(a).then((o) =>
|
|
2064
|
+
return n.common.async ? Promise.all(a).then((o) => Z.mergeArray(r, o)) : Z.mergeArray(r, a);
|
|
2065
2065
|
}
|
|
2066
2066
|
get items() {
|
|
2067
2067
|
return this._def.items;
|
|
2068
2068
|
}
|
|
2069
2069
|
rest(e) {
|
|
2070
|
-
return new
|
|
2070
|
+
return new oe({
|
|
2071
2071
|
...this._def,
|
|
2072
2072
|
rest: e
|
|
2073
2073
|
});
|
|
2074
2074
|
}
|
|
2075
2075
|
}
|
|
2076
|
-
|
|
2076
|
+
oe.create = (t, e) => {
|
|
2077
2077
|
if (!Array.isArray(t))
|
|
2078
2078
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2079
|
-
return new
|
|
2079
|
+
return new oe({
|
|
2080
2080
|
items: t,
|
|
2081
2081
|
typeName: y.ZodTuple,
|
|
2082
2082
|
rest: null,
|
|
2083
2083
|
..._(e)
|
|
2084
2084
|
});
|
|
2085
2085
|
};
|
|
2086
|
-
class
|
|
2086
|
+
class Xe extends w {
|
|
2087
2087
|
get keySchema() {
|
|
2088
2088
|
return this._def.keyType;
|
|
2089
2089
|
}
|
|
@@ -2092,39 +2092,39 @@ class Ke extends v {
|
|
|
2092
2092
|
}
|
|
2093
2093
|
_parse(e) {
|
|
2094
2094
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2095
|
-
if (n.parsedType !==
|
|
2095
|
+
if (n.parsedType !== p.object)
|
|
2096
2096
|
return m(n, {
|
|
2097
2097
|
code: l.invalid_type,
|
|
2098
|
-
expected:
|
|
2098
|
+
expected: p.object,
|
|
2099
2099
|
received: n.parsedType
|
|
2100
2100
|
}), g;
|
|
2101
2101
|
const s = [], a = this._def.keyType, o = this._def.valueType;
|
|
2102
2102
|
for (const c in n.data)
|
|
2103
2103
|
s.push({
|
|
2104
|
-
key: a._parse(new
|
|
2105
|
-
value: o._parse(new
|
|
2104
|
+
key: a._parse(new ie(n, c, n.path, c)),
|
|
2105
|
+
value: o._parse(new ie(n, n.data[c], n.path, c)),
|
|
2106
2106
|
alwaysSet: c in n.data
|
|
2107
2107
|
});
|
|
2108
|
-
return n.common.async ?
|
|
2108
|
+
return n.common.async ? Z.mergeObjectAsync(r, s) : Z.mergeObjectSync(r, s);
|
|
2109
2109
|
}
|
|
2110
2110
|
get element() {
|
|
2111
2111
|
return this._def.valueType;
|
|
2112
2112
|
}
|
|
2113
2113
|
static create(e, r, n) {
|
|
2114
|
-
return r instanceof
|
|
2114
|
+
return r instanceof w ? new Xe({
|
|
2115
2115
|
keyType: e,
|
|
2116
2116
|
valueType: r,
|
|
2117
2117
|
typeName: y.ZodRecord,
|
|
2118
2118
|
..._(n)
|
|
2119
|
-
}) : new
|
|
2120
|
-
keyType:
|
|
2119
|
+
}) : new Xe({
|
|
2120
|
+
keyType: G.create(),
|
|
2121
2121
|
valueType: e,
|
|
2122
2122
|
typeName: y.ZodRecord,
|
|
2123
2123
|
..._(r)
|
|
2124
2124
|
});
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
|
-
class
|
|
2127
|
+
class gt extends w {
|
|
2128
2128
|
get keySchema() {
|
|
2129
2129
|
return this._def.keyType;
|
|
2130
2130
|
}
|
|
@@ -2133,15 +2133,15 @@ class mt extends v {
|
|
|
2133
2133
|
}
|
|
2134
2134
|
_parse(e) {
|
|
2135
2135
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2136
|
-
if (n.parsedType !==
|
|
2136
|
+
if (n.parsedType !== p.map)
|
|
2137
2137
|
return m(n, {
|
|
2138
2138
|
code: l.invalid_type,
|
|
2139
|
-
expected:
|
|
2139
|
+
expected: p.map,
|
|
2140
2140
|
received: n.parsedType
|
|
2141
2141
|
}), g;
|
|
2142
2142
|
const s = this._def.keyType, a = this._def.valueType, o = [...n.data.entries()].map(([c, u], d) => ({
|
|
2143
|
-
key: s._parse(new
|
|
2144
|
-
value: a._parse(new
|
|
2143
|
+
key: s._parse(new ie(n, c, n.path, [d, "key"])),
|
|
2144
|
+
value: a._parse(new ie(n, u, n.path, [d, "value"]))
|
|
2145
2145
|
}));
|
|
2146
2146
|
if (n.common.async) {
|
|
2147
2147
|
const c = /* @__PURE__ */ new Map();
|
|
@@ -2166,19 +2166,19 @@ class mt extends v {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
}
|
|
2168
2168
|
}
|
|
2169
|
-
|
|
2169
|
+
gt.create = (t, e, r) => new gt({
|
|
2170
2170
|
valueType: e,
|
|
2171
2171
|
keyType: t,
|
|
2172
2172
|
typeName: y.ZodMap,
|
|
2173
2173
|
..._(r)
|
|
2174
2174
|
});
|
|
2175
|
-
class
|
|
2175
|
+
class Ie extends w {
|
|
2176
2176
|
_parse(e) {
|
|
2177
2177
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2178
|
-
if (n.parsedType !==
|
|
2178
|
+
if (n.parsedType !== p.set)
|
|
2179
2179
|
return m(n, {
|
|
2180
2180
|
code: l.invalid_type,
|
|
2181
|
-
expected:
|
|
2181
|
+
expected: p.set,
|
|
2182
2182
|
received: n.parsedType
|
|
2183
2183
|
}), g;
|
|
2184
2184
|
const s = this._def;
|
|
@@ -2207,19 +2207,19 @@ class Ce extends v {
|
|
|
2207
2207
|
}
|
|
2208
2208
|
return { status: r.value, value: d };
|
|
2209
2209
|
}
|
|
2210
|
-
const c = [...n.data.values()].map((u, d) => a._parse(new
|
|
2210
|
+
const c = [...n.data.values()].map((u, d) => a._parse(new ie(n, u, n.path, d)));
|
|
2211
2211
|
return n.common.async ? Promise.all(c).then((u) => o(u)) : o(c);
|
|
2212
2212
|
}
|
|
2213
2213
|
min(e, r) {
|
|
2214
|
-
return new
|
|
2214
|
+
return new Ie({
|
|
2215
2215
|
...this._def,
|
|
2216
|
-
minSize: { value: e, message:
|
|
2216
|
+
minSize: { value: e, message: h.toString(r) }
|
|
2217
2217
|
});
|
|
2218
2218
|
}
|
|
2219
2219
|
max(e, r) {
|
|
2220
|
-
return new
|
|
2220
|
+
return new Ie({
|
|
2221
2221
|
...this._def,
|
|
2222
|
-
maxSize: { value: e, message:
|
|
2222
|
+
maxSize: { value: e, message: h.toString(r) }
|
|
2223
2223
|
});
|
|
2224
2224
|
}
|
|
2225
2225
|
size(e, r) {
|
|
@@ -2229,34 +2229,34 @@ class Ce extends v {
|
|
|
2229
2229
|
return this.min(1, e);
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
|
-
|
|
2232
|
+
Ie.create = (t, e) => new Ie({
|
|
2233
2233
|
valueType: t,
|
|
2234
2234
|
minSize: null,
|
|
2235
2235
|
maxSize: null,
|
|
2236
2236
|
typeName: y.ZodSet,
|
|
2237
2237
|
..._(e)
|
|
2238
2238
|
});
|
|
2239
|
-
class
|
|
2239
|
+
class je extends w {
|
|
2240
2240
|
constructor() {
|
|
2241
2241
|
super(...arguments), this.validate = this.implement;
|
|
2242
2242
|
}
|
|
2243
2243
|
_parse(e) {
|
|
2244
2244
|
const { ctx: r } = this._processInputParams(e);
|
|
2245
|
-
if (r.parsedType !==
|
|
2245
|
+
if (r.parsedType !== p.function)
|
|
2246
2246
|
return m(r, {
|
|
2247
2247
|
code: l.invalid_type,
|
|
2248
|
-
expected:
|
|
2248
|
+
expected: p.function,
|
|
2249
2249
|
received: r.parsedType
|
|
2250
2250
|
}), g;
|
|
2251
2251
|
function n(c, u) {
|
|
2252
|
-
return
|
|
2252
|
+
return mt({
|
|
2253
2253
|
data: c,
|
|
2254
2254
|
path: r.path,
|
|
2255
2255
|
errorMaps: [
|
|
2256
2256
|
r.common.contextualErrorMap,
|
|
2257
2257
|
r.schemaErrorMap,
|
|
2258
|
-
|
|
2259
|
-
|
|
2258
|
+
ft(),
|
|
2259
|
+
Me
|
|
2260
2260
|
].filter((d) => !!d),
|
|
2261
2261
|
issueData: {
|
|
2262
2262
|
code: l.invalid_arguments,
|
|
@@ -2265,14 +2265,14 @@ class Ie extends v {
|
|
|
2265
2265
|
});
|
|
2266
2266
|
}
|
|
2267
2267
|
function s(c, u) {
|
|
2268
|
-
return
|
|
2268
|
+
return mt({
|
|
2269
2269
|
data: c,
|
|
2270
2270
|
path: r.path,
|
|
2271
2271
|
errorMaps: [
|
|
2272
2272
|
r.common.contextualErrorMap,
|
|
2273
2273
|
r.schemaErrorMap,
|
|
2274
|
-
|
|
2275
|
-
|
|
2274
|
+
ft(),
|
|
2275
|
+
Me
|
|
2276
2276
|
].filter((d) => !!d),
|
|
2277
2277
|
issueData: {
|
|
2278
2278
|
code: l.invalid_return_type,
|
|
@@ -2281,26 +2281,26 @@ class Ie extends v {
|
|
|
2281
2281
|
});
|
|
2282
2282
|
}
|
|
2283
2283
|
const a = { errorMap: r.common.contextualErrorMap }, o = r.data;
|
|
2284
|
-
if (this._def.returns instanceof
|
|
2284
|
+
if (this._def.returns instanceof De) {
|
|
2285
2285
|
const c = this;
|
|
2286
|
-
return
|
|
2287
|
-
const d = new
|
|
2288
|
-
throw d.addIssue(n(u,
|
|
2289
|
-
}),
|
|
2290
|
-
return await c._def.returns._def.type.parseAsync(
|
|
2291
|
-
throw d.addIssue(s(
|
|
2286
|
+
return L(async function(...u) {
|
|
2287
|
+
const d = new H([]), f = await c._def.args.parseAsync(u, a).catch((E) => {
|
|
2288
|
+
throw d.addIssue(n(u, E)), d;
|
|
2289
|
+
}), v = await Reflect.apply(o, this, f);
|
|
2290
|
+
return await c._def.returns._def.type.parseAsync(v, a).catch((E) => {
|
|
2291
|
+
throw d.addIssue(s(v, E)), d;
|
|
2292
2292
|
});
|
|
2293
2293
|
});
|
|
2294
2294
|
} else {
|
|
2295
2295
|
const c = this;
|
|
2296
|
-
return
|
|
2296
|
+
return L(function(...u) {
|
|
2297
2297
|
const d = c._def.args.safeParse(u, a);
|
|
2298
2298
|
if (!d.success)
|
|
2299
|
-
throw new
|
|
2300
|
-
const f = Reflect.apply(o, this, d.data),
|
|
2301
|
-
if (!
|
|
2302
|
-
throw new
|
|
2303
|
-
return
|
|
2299
|
+
throw new H([n(u, d.error)]);
|
|
2300
|
+
const f = Reflect.apply(o, this, d.data), v = c._def.returns.safeParse(f, a);
|
|
2301
|
+
if (!v.success)
|
|
2302
|
+
throw new H([s(f, v.error)]);
|
|
2303
|
+
return v.data;
|
|
2304
2304
|
});
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
@@ -2311,13 +2311,13 @@ class Ie extends v {
|
|
|
2311
2311
|
return this._def.returns;
|
|
2312
2312
|
}
|
|
2313
2313
|
args(...e) {
|
|
2314
|
-
return new
|
|
2314
|
+
return new je({
|
|
2315
2315
|
...this._def,
|
|
2316
|
-
args:
|
|
2316
|
+
args: oe.create(e).rest(Re.create())
|
|
2317
2317
|
});
|
|
2318
2318
|
}
|
|
2319
2319
|
returns(e) {
|
|
2320
|
-
return new
|
|
2320
|
+
return new je({
|
|
2321
2321
|
...this._def,
|
|
2322
2322
|
returns: e
|
|
2323
2323
|
});
|
|
@@ -2329,15 +2329,15 @@ class Ie extends v {
|
|
|
2329
2329
|
return this.parse(e);
|
|
2330
2330
|
}
|
|
2331
2331
|
static create(e, r, n) {
|
|
2332
|
-
return new
|
|
2333
|
-
args: e ||
|
|
2334
|
-
returns: r ||
|
|
2332
|
+
return new je({
|
|
2333
|
+
args: e || oe.create([]).rest(Re.create()),
|
|
2334
|
+
returns: r || Re.create(),
|
|
2335
2335
|
typeName: y.ZodFunction,
|
|
2336
2336
|
..._(n)
|
|
2337
2337
|
});
|
|
2338
2338
|
}
|
|
2339
2339
|
}
|
|
2340
|
-
class
|
|
2340
|
+
class Qe extends w {
|
|
2341
2341
|
get schema() {
|
|
2342
2342
|
return this._def.getter();
|
|
2343
2343
|
}
|
|
@@ -2346,12 +2346,12 @@ class Ye extends v {
|
|
|
2346
2346
|
return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
|
|
2349
|
+
Qe.create = (t, e) => new Qe({
|
|
2350
2350
|
getter: t,
|
|
2351
2351
|
typeName: y.ZodLazy,
|
|
2352
2352
|
..._(e)
|
|
2353
2353
|
});
|
|
2354
|
-
class
|
|
2354
|
+
class et extends w {
|
|
2355
2355
|
_parse(e) {
|
|
2356
2356
|
if (e.data !== this._def.value) {
|
|
2357
2357
|
const r = this._getOrReturnCtx(e);
|
|
@@ -2367,21 +2367,21 @@ class Je extends v {
|
|
|
2367
2367
|
return this._def.value;
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
|
-
|
|
2370
|
+
et.create = (t, e) => new et({
|
|
2371
2371
|
value: t,
|
|
2372
2372
|
typeName: y.ZodLiteral,
|
|
2373
2373
|
..._(e)
|
|
2374
2374
|
});
|
|
2375
|
-
function
|
|
2376
|
-
return new
|
|
2375
|
+
function ur(t, e) {
|
|
2376
|
+
return new be({
|
|
2377
2377
|
values: t,
|
|
2378
2378
|
typeName: y.ZodEnum,
|
|
2379
2379
|
..._(e)
|
|
2380
2380
|
});
|
|
2381
2381
|
}
|
|
2382
|
-
class
|
|
2382
|
+
class be extends w {
|
|
2383
2383
|
constructor() {
|
|
2384
|
-
super(...arguments),
|
|
2384
|
+
super(...arguments), Ve.set(this, void 0);
|
|
2385
2385
|
}
|
|
2386
2386
|
_parse(e) {
|
|
2387
2387
|
if (typeof e.data != "string") {
|
|
@@ -2392,7 +2392,7 @@ class ge extends v {
|
|
|
2392
2392
|
code: l.invalid_type
|
|
2393
2393
|
}), g;
|
|
2394
2394
|
}
|
|
2395
|
-
if (
|
|
2395
|
+
if (pt(this, Ve) || ir(this, Ve, new Set(this._def.values)), !pt(this, Ve).has(e.data)) {
|
|
2396
2396
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2397
2397
|
return m(r, {
|
|
2398
2398
|
received: r.data,
|
|
@@ -2400,7 +2400,7 @@ class ge extends v {
|
|
|
2400
2400
|
options: n
|
|
2401
2401
|
}), g;
|
|
2402
2402
|
}
|
|
2403
|
-
return
|
|
2403
|
+
return L(e.data);
|
|
2404
2404
|
}
|
|
2405
2405
|
get options() {
|
|
2406
2406
|
return this._def.values;
|
|
@@ -2424,27 +2424,27 @@ class ge extends v {
|
|
|
2424
2424
|
return e;
|
|
2425
2425
|
}
|
|
2426
2426
|
extract(e, r = this._def) {
|
|
2427
|
-
return
|
|
2427
|
+
return be.create(e, {
|
|
2428
2428
|
...this._def,
|
|
2429
2429
|
...r
|
|
2430
2430
|
});
|
|
2431
2431
|
}
|
|
2432
2432
|
exclude(e, r = this._def) {
|
|
2433
|
-
return
|
|
2433
|
+
return be.create(this.options.filter((n) => !e.includes(n)), {
|
|
2434
2434
|
...this._def,
|
|
2435
2435
|
...r
|
|
2436
2436
|
});
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
class
|
|
2439
|
+
Ve = /* @__PURE__ */ new WeakMap();
|
|
2440
|
+
be.create = ur;
|
|
2441
|
+
class tt extends w {
|
|
2442
2442
|
constructor() {
|
|
2443
|
-
super(...arguments),
|
|
2443
|
+
super(...arguments), Fe.set(this, void 0);
|
|
2444
2444
|
}
|
|
2445
2445
|
_parse(e) {
|
|
2446
2446
|
const r = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2447
|
-
if (n.parsedType !==
|
|
2447
|
+
if (n.parsedType !== p.string && n.parsedType !== p.number) {
|
|
2448
2448
|
const s = x.objectValues(r);
|
|
2449
2449
|
return m(n, {
|
|
2450
2450
|
expected: x.joinValues(s),
|
|
@@ -2452,7 +2452,7 @@ class Ge extends v {
|
|
|
2452
2452
|
code: l.invalid_type
|
|
2453
2453
|
}), g;
|
|
2454
2454
|
}
|
|
2455
|
-
if (
|
|
2455
|
+
if (pt(this, Fe) || ir(this, Fe, new Set(x.getValidEnumValues(this._def.values))), !pt(this, Fe).has(e.data)) {
|
|
2456
2456
|
const s = x.objectValues(r);
|
|
2457
2457
|
return m(n, {
|
|
2458
2458
|
received: n.data,
|
|
@@ -2460,43 +2460,43 @@ class Ge extends v {
|
|
|
2460
2460
|
options: s
|
|
2461
2461
|
}), g;
|
|
2462
2462
|
}
|
|
2463
|
-
return
|
|
2463
|
+
return L(e.data);
|
|
2464
2464
|
}
|
|
2465
2465
|
get enum() {
|
|
2466
2466
|
return this._def.values;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
|
|
2470
|
-
|
|
2469
|
+
Fe = /* @__PURE__ */ new WeakMap();
|
|
2470
|
+
tt.create = (t, e) => new tt({
|
|
2471
2471
|
values: t,
|
|
2472
2472
|
typeName: y.ZodNativeEnum,
|
|
2473
2473
|
..._(e)
|
|
2474
2474
|
});
|
|
2475
|
-
class
|
|
2475
|
+
class De extends w {
|
|
2476
2476
|
unwrap() {
|
|
2477
2477
|
return this._def.type;
|
|
2478
2478
|
}
|
|
2479
2479
|
_parse(e) {
|
|
2480
2480
|
const { ctx: r } = this._processInputParams(e);
|
|
2481
|
-
if (r.parsedType !==
|
|
2481
|
+
if (r.parsedType !== p.promise && r.common.async === !1)
|
|
2482
2482
|
return m(r, {
|
|
2483
2483
|
code: l.invalid_type,
|
|
2484
|
-
expected:
|
|
2484
|
+
expected: p.promise,
|
|
2485
2485
|
received: r.parsedType
|
|
2486
2486
|
}), g;
|
|
2487
|
-
const n = r.parsedType ===
|
|
2488
|
-
return
|
|
2487
|
+
const n = r.parsedType === p.promise ? r.data : Promise.resolve(r.data);
|
|
2488
|
+
return L(n.then((s) => this._def.type.parseAsync(s, {
|
|
2489
2489
|
path: r.path,
|
|
2490
2490
|
errorMap: r.common.contextualErrorMap
|
|
2491
2491
|
})));
|
|
2492
2492
|
}
|
|
2493
2493
|
}
|
|
2494
|
-
|
|
2494
|
+
De.create = (t, e) => new De({
|
|
2495
2495
|
type: t,
|
|
2496
2496
|
typeName: y.ZodPromise,
|
|
2497
2497
|
..._(e)
|
|
2498
2498
|
});
|
|
2499
|
-
class
|
|
2499
|
+
class Q extends w {
|
|
2500
2500
|
innerType() {
|
|
2501
2501
|
return this._def.schema;
|
|
2502
2502
|
}
|
|
@@ -2523,7 +2523,7 @@ class Y extends v {
|
|
|
2523
2523
|
path: n.path,
|
|
2524
2524
|
parent: n
|
|
2525
2525
|
});
|
|
2526
|
-
return u.status === "aborted" ? g : u.status === "dirty" || r.value === "dirty" ?
|
|
2526
|
+
return u.status === "aborted" ? g : u.status === "dirty" || r.value === "dirty" ? Ne(u.value) : u;
|
|
2527
2527
|
});
|
|
2528
2528
|
{
|
|
2529
2529
|
if (r.value === "aborted")
|
|
@@ -2533,7 +2533,7 @@ class Y extends v {
|
|
|
2533
2533
|
path: n.path,
|
|
2534
2534
|
parent: n
|
|
2535
2535
|
});
|
|
2536
|
-
return c.status === "aborted" ? g : c.status === "dirty" || r.value === "dirty" ?
|
|
2536
|
+
return c.status === "aborted" ? g : c.status === "dirty" || r.value === "dirty" ? Ne(c.value) : c;
|
|
2537
2537
|
}
|
|
2538
2538
|
}
|
|
2539
2539
|
if (s.type === "refinement") {
|
|
@@ -2562,60 +2562,60 @@ class Y extends v {
|
|
|
2562
2562
|
path: n.path,
|
|
2563
2563
|
parent: n
|
|
2564
2564
|
});
|
|
2565
|
-
if (!
|
|
2565
|
+
if (!Be(o))
|
|
2566
2566
|
return o;
|
|
2567
2567
|
const c = s.transform(o.value, a);
|
|
2568
2568
|
if (c instanceof Promise)
|
|
2569
2569
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2570
2570
|
return { status: r.value, value: c };
|
|
2571
2571
|
} else
|
|
2572
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) =>
|
|
2572
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => Be(o) ? Promise.resolve(s.transform(o.value, a)).then((c) => ({ status: r.value, value: c })) : o);
|
|
2573
2573
|
x.assertNever(s);
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
|
-
|
|
2576
|
+
Q.create = (t, e, r) => new Q({
|
|
2577
2577
|
schema: t,
|
|
2578
2578
|
typeName: y.ZodEffects,
|
|
2579
2579
|
effect: e,
|
|
2580
2580
|
..._(r)
|
|
2581
2581
|
});
|
|
2582
|
-
|
|
2582
|
+
Q.createWithPreprocess = (t, e, r) => new Q({
|
|
2583
2583
|
schema: e,
|
|
2584
2584
|
effect: { type: "preprocess", transform: t },
|
|
2585
2585
|
typeName: y.ZodEffects,
|
|
2586
2586
|
..._(r)
|
|
2587
2587
|
});
|
|
2588
|
-
class
|
|
2588
|
+
class se extends w {
|
|
2589
2589
|
_parse(e) {
|
|
2590
|
-
return this._getType(e) ===
|
|
2590
|
+
return this._getType(e) === p.undefined ? L(void 0) : this._def.innerType._parse(e);
|
|
2591
2591
|
}
|
|
2592
2592
|
unwrap() {
|
|
2593
2593
|
return this._def.innerType;
|
|
2594
2594
|
}
|
|
2595
2595
|
}
|
|
2596
|
-
|
|
2596
|
+
se.create = (t, e) => new se({
|
|
2597
2597
|
innerType: t,
|
|
2598
2598
|
typeName: y.ZodOptional,
|
|
2599
2599
|
..._(e)
|
|
2600
2600
|
});
|
|
2601
|
-
class
|
|
2601
|
+
class xe extends w {
|
|
2602
2602
|
_parse(e) {
|
|
2603
|
-
return this._getType(e) ===
|
|
2603
|
+
return this._getType(e) === p.null ? L(null) : this._def.innerType._parse(e);
|
|
2604
2604
|
}
|
|
2605
2605
|
unwrap() {
|
|
2606
2606
|
return this._def.innerType;
|
|
2607
2607
|
}
|
|
2608
2608
|
}
|
|
2609
|
-
|
|
2609
|
+
xe.create = (t, e) => new xe({
|
|
2610
2610
|
innerType: t,
|
|
2611
2611
|
typeName: y.ZodNullable,
|
|
2612
2612
|
..._(e)
|
|
2613
2613
|
});
|
|
2614
|
-
class
|
|
2614
|
+
class rt extends w {
|
|
2615
2615
|
_parse(e) {
|
|
2616
2616
|
const { ctx: r } = this._processInputParams(e);
|
|
2617
2617
|
let n = r.data;
|
|
2618
|
-
return r.parsedType ===
|
|
2618
|
+
return r.parsedType === p.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
2619
2619
|
data: n,
|
|
2620
2620
|
path: r.path,
|
|
2621
2621
|
parent: r
|
|
@@ -2625,13 +2625,13 @@ class Xe extends v {
|
|
|
2625
2625
|
return this._def.innerType;
|
|
2626
2626
|
}
|
|
2627
2627
|
}
|
|
2628
|
-
|
|
2628
|
+
rt.create = (t, e) => new rt({
|
|
2629
2629
|
innerType: t,
|
|
2630
2630
|
typeName: y.ZodDefault,
|
|
2631
2631
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2632
2632
|
..._(e)
|
|
2633
2633
|
});
|
|
2634
|
-
class
|
|
2634
|
+
class nt extends w {
|
|
2635
2635
|
_parse(e) {
|
|
2636
2636
|
const { ctx: r } = this._processInputParams(e), n = {
|
|
2637
2637
|
...r,
|
|
@@ -2646,11 +2646,11 @@ class Qe extends v {
|
|
|
2646
2646
|
...n
|
|
2647
2647
|
}
|
|
2648
2648
|
});
|
|
2649
|
-
return
|
|
2649
|
+
return He(s) ? s.then((a) => ({
|
|
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 H(n.common.issues);
|
|
2654
2654
|
},
|
|
2655
2655
|
input: n.data
|
|
2656
2656
|
})
|
|
@@ -2658,7 +2658,7 @@ class Qe extends v {
|
|
|
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 H(n.common.issues);
|
|
2662
2662
|
},
|
|
2663
2663
|
input: n.data
|
|
2664
2664
|
})
|
|
@@ -2668,31 +2668,31 @@ class Qe extends v {
|
|
|
2668
2668
|
return this._def.innerType;
|
|
2669
2669
|
}
|
|
2670
2670
|
}
|
|
2671
|
-
|
|
2671
|
+
nt.create = (t, e) => new nt({
|
|
2672
2672
|
innerType: t,
|
|
2673
2673
|
typeName: y.ZodCatch,
|
|
2674
2674
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2675
2675
|
..._(e)
|
|
2676
2676
|
});
|
|
2677
|
-
class
|
|
2677
|
+
class _t extends w {
|
|
2678
2678
|
_parse(e) {
|
|
2679
|
-
if (this._getType(e) !==
|
|
2679
|
+
if (this._getType(e) !== p.nan) {
|
|
2680
2680
|
const n = this._getOrReturnCtx(e);
|
|
2681
2681
|
return m(n, {
|
|
2682
2682
|
code: l.invalid_type,
|
|
2683
|
-
expected:
|
|
2683
|
+
expected: p.nan,
|
|
2684
2684
|
received: n.parsedType
|
|
2685
2685
|
}), g;
|
|
2686
2686
|
}
|
|
2687
2687
|
return { status: "valid", value: e.data };
|
|
2688
2688
|
}
|
|
2689
2689
|
}
|
|
2690
|
-
|
|
2690
|
+
_t.create = (t) => new _t({
|
|
2691
2691
|
typeName: y.ZodNaN,
|
|
2692
2692
|
..._(t)
|
|
2693
2693
|
});
|
|
2694
|
-
const
|
|
2695
|
-
class
|
|
2694
|
+
const wn = Symbol("zod_brand");
|
|
2695
|
+
class jt extends w {
|
|
2696
2696
|
_parse(e) {
|
|
2697
2697
|
const { ctx: r } = this._processInputParams(e), n = r.data;
|
|
2698
2698
|
return this._def.type._parse({
|
|
@@ -2705,7 +2705,7 @@ class It extends v {
|
|
|
2705
2705
|
return this._def.type;
|
|
2706
2706
|
}
|
|
2707
2707
|
}
|
|
2708
|
-
class
|
|
2708
|
+
class ot extends w {
|
|
2709
2709
|
_parse(e) {
|
|
2710
2710
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2711
2711
|
if (n.common.async)
|
|
@@ -2715,7 +2715,7 @@ class nt extends v {
|
|
|
2715
2715
|
path: n.path,
|
|
2716
2716
|
parent: n
|
|
2717
2717
|
});
|
|
2718
|
-
return a.status === "aborted" ? g : a.status === "dirty" ? (r.dirty(),
|
|
2718
|
+
return a.status === "aborted" ? g : a.status === "dirty" ? (r.dirty(), Ne(a.value)) : this._def.out._parseAsync({
|
|
2719
2719
|
data: a.value,
|
|
2720
2720
|
path: n.path,
|
|
2721
2721
|
parent: n
|
|
@@ -2738,195 +2738,197 @@ class nt extends v {
|
|
|
2738
2738
|
}
|
|
2739
2739
|
}
|
|
2740
2740
|
static create(e, r) {
|
|
2741
|
-
return new
|
|
2741
|
+
return new ot({
|
|
2742
2742
|
in: e,
|
|
2743
2743
|
out: r,
|
|
2744
2744
|
typeName: y.ZodPipeline
|
|
2745
2745
|
});
|
|
2746
2746
|
}
|
|
2747
2747
|
}
|
|
2748
|
-
class
|
|
2748
|
+
class st extends w {
|
|
2749
2749
|
_parse(e) {
|
|
2750
|
-
const r = this._def.innerType._parse(e), n = (s) => (
|
|
2751
|
-
return
|
|
2750
|
+
const r = this._def.innerType._parse(e), n = (s) => (Be(s) && (s.value = Object.freeze(s.value)), s);
|
|
2751
|
+
return He(r) ? r.then((s) => n(s)) : n(r);
|
|
2752
2752
|
}
|
|
2753
2753
|
unwrap() {
|
|
2754
2754
|
return this._def.innerType;
|
|
2755
2755
|
}
|
|
2756
2756
|
}
|
|
2757
|
-
|
|
2757
|
+
st.create = (t, e) => new st({
|
|
2758
2758
|
innerType: t,
|
|
2759
2759
|
typeName: y.ZodReadonly,
|
|
2760
2760
|
..._(e)
|
|
2761
2761
|
});
|
|
2762
|
-
function
|
|
2763
|
-
return t ?
|
|
2762
|
+
function lr(t, e = {}, r) {
|
|
2763
|
+
return t ? Ze.create().superRefine((n, s) => {
|
|
2764
2764
|
var a, o;
|
|
2765
2765
|
if (!t(n)) {
|
|
2766
2766
|
const c = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (o = (a = c.fatal) !== null && a !== void 0 ? a : r) !== null && o !== void 0 ? o : !0, d = typeof c == "string" ? { message: c } : c;
|
|
2767
2767
|
s.addIssue({ code: "custom", ...d, fatal: u });
|
|
2768
2768
|
}
|
|
2769
|
-
}) :
|
|
2769
|
+
}) : Ze.create();
|
|
2770
2770
|
}
|
|
2771
|
-
const
|
|
2772
|
-
object:
|
|
2771
|
+
const bn = {
|
|
2772
|
+
object: R.lazycreate
|
|
2773
2773
|
};
|
|
2774
2774
|
var y;
|
|
2775
2775
|
(function(t) {
|
|
2776
2776
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
2777
2777
|
})(y || (y = {}));
|
|
2778
|
-
const
|
|
2778
|
+
const xn = (t, e = {
|
|
2779
2779
|
message: `Input not instance of ${t.name}`
|
|
2780
|
-
}) =>
|
|
2781
|
-
string: (t) =>
|
|
2782
|
-
number: (t) =>
|
|
2783
|
-
boolean: (t) =>
|
|
2780
|
+
}) => lr((r) => r instanceof t, e), fr = G.create, mr = ve.create, En = _t.create, kn = we.create, pr = We.create, Tn = Oe.create, Cn = ht.create, Sn = Ke.create, Rn = Ye.create, On = Ze.create, In = Re.create, Pn = le.create, An = yt.create, Nn = X.create, jn = R.create, Mn = R.strictCreate, Zn = Je.create, Dn = wt.create, $n = Ge.create, Ln = oe.create, Un = Xe.create, Vn = gt.create, Fn = Ie.create, zn = je.create, qn = Qe.create, Bn = et.create, Hn = be.create, Wn = tt.create, Kn = De.create, Jt = Q.create, Yn = se.create, Jn = xe.create, Gn = Q.createWithPreprocess, Xn = ot.create, Qn = () => fr().optional(), es = () => mr().optional(), ts = () => pr().optional(), rs = {
|
|
2781
|
+
string: (t) => G.create({ ...t, coerce: !0 }),
|
|
2782
|
+
number: (t) => ve.create({ ...t, coerce: !0 }),
|
|
2783
|
+
boolean: (t) => We.create({
|
|
2784
2784
|
...t,
|
|
2785
2785
|
coerce: !0
|
|
2786
2786
|
}),
|
|
2787
|
-
bigint: (t) =>
|
|
2788
|
-
date: (t) =>
|
|
2789
|
-
},
|
|
2787
|
+
bigint: (t) => we.create({ ...t, coerce: !0 }),
|
|
2788
|
+
date: (t) => Oe.create({ ...t, coerce: !0 })
|
|
2789
|
+
}, ns = g;
|
|
2790
2790
|
var i = /* @__PURE__ */ Object.freeze({
|
|
2791
2791
|
__proto__: null,
|
|
2792
|
-
defaultErrorMap:
|
|
2793
|
-
setErrorMap:
|
|
2794
|
-
getErrorMap:
|
|
2795
|
-
makeIssue:
|
|
2796
|
-
EMPTY_PATH:
|
|
2792
|
+
defaultErrorMap: Me,
|
|
2793
|
+
setErrorMap: rn,
|
|
2794
|
+
getErrorMap: ft,
|
|
2795
|
+
makeIssue: mt,
|
|
2796
|
+
EMPTY_PATH: nn,
|
|
2797
2797
|
addIssueToContext: m,
|
|
2798
|
-
ParseStatus:
|
|
2798
|
+
ParseStatus: Z,
|
|
2799
2799
|
INVALID: g,
|
|
2800
|
-
DIRTY:
|
|
2801
|
-
OK:
|
|
2802
|
-
isAborted:
|
|
2803
|
-
isDirty:
|
|
2804
|
-
isValid:
|
|
2805
|
-
isAsync:
|
|
2800
|
+
DIRTY: Ne,
|
|
2801
|
+
OK: L,
|
|
2802
|
+
isAborted: Rt,
|
|
2803
|
+
isDirty: Ot,
|
|
2804
|
+
isValid: Be,
|
|
2805
|
+
isAsync: He,
|
|
2806
2806
|
get util() {
|
|
2807
2807
|
return x;
|
|
2808
2808
|
},
|
|
2809
2809
|
get objectUtil() {
|
|
2810
|
-
return
|
|
2810
|
+
return St;
|
|
2811
2811
|
},
|
|
2812
|
-
ZodParsedType:
|
|
2813
|
-
getParsedType:
|
|
2814
|
-
ZodType:
|
|
2815
|
-
datetimeRegex:
|
|
2816
|
-
ZodString:
|
|
2817
|
-
ZodNumber:
|
|
2818
|
-
ZodBigInt:
|
|
2819
|
-
ZodBoolean:
|
|
2820
|
-
ZodDate:
|
|
2821
|
-
ZodSymbol:
|
|
2822
|
-
ZodUndefined:
|
|
2823
|
-
ZodNull:
|
|
2824
|
-
ZodAny:
|
|
2825
|
-
ZodUnknown:
|
|
2826
|
-
ZodNever:
|
|
2827
|
-
ZodVoid:
|
|
2828
|
-
ZodArray:
|
|
2829
|
-
ZodObject:
|
|
2830
|
-
ZodUnion:
|
|
2831
|
-
ZodDiscriminatedUnion:
|
|
2832
|
-
ZodIntersection:
|
|
2833
|
-
ZodTuple:
|
|
2834
|
-
ZodRecord:
|
|
2835
|
-
ZodMap:
|
|
2836
|
-
ZodSet:
|
|
2837
|
-
ZodFunction:
|
|
2838
|
-
ZodLazy:
|
|
2839
|
-
ZodLiteral:
|
|
2840
|
-
ZodEnum:
|
|
2841
|
-
ZodNativeEnum:
|
|
2842
|
-
ZodPromise:
|
|
2843
|
-
ZodEffects:
|
|
2844
|
-
ZodTransformer:
|
|
2845
|
-
ZodOptional:
|
|
2846
|
-
ZodNullable:
|
|
2847
|
-
ZodDefault:
|
|
2848
|
-
ZodCatch:
|
|
2849
|
-
ZodNaN:
|
|
2850
|
-
BRAND:
|
|
2851
|
-
ZodBranded:
|
|
2852
|
-
ZodPipeline:
|
|
2853
|
-
ZodReadonly:
|
|
2854
|
-
custom:
|
|
2855
|
-
Schema:
|
|
2856
|
-
ZodSchema:
|
|
2857
|
-
late:
|
|
2812
|
+
ZodParsedType: p,
|
|
2813
|
+
getParsedType: he,
|
|
2814
|
+
ZodType: w,
|
|
2815
|
+
datetimeRegex: dr,
|
|
2816
|
+
ZodString: G,
|
|
2817
|
+
ZodNumber: ve,
|
|
2818
|
+
ZodBigInt: we,
|
|
2819
|
+
ZodBoolean: We,
|
|
2820
|
+
ZodDate: Oe,
|
|
2821
|
+
ZodSymbol: ht,
|
|
2822
|
+
ZodUndefined: Ke,
|
|
2823
|
+
ZodNull: Ye,
|
|
2824
|
+
ZodAny: Ze,
|
|
2825
|
+
ZodUnknown: Re,
|
|
2826
|
+
ZodNever: le,
|
|
2827
|
+
ZodVoid: yt,
|
|
2828
|
+
ZodArray: X,
|
|
2829
|
+
ZodObject: R,
|
|
2830
|
+
ZodUnion: Je,
|
|
2831
|
+
ZodDiscriminatedUnion: wt,
|
|
2832
|
+
ZodIntersection: Ge,
|
|
2833
|
+
ZodTuple: oe,
|
|
2834
|
+
ZodRecord: Xe,
|
|
2835
|
+
ZodMap: gt,
|
|
2836
|
+
ZodSet: Ie,
|
|
2837
|
+
ZodFunction: je,
|
|
2838
|
+
ZodLazy: Qe,
|
|
2839
|
+
ZodLiteral: et,
|
|
2840
|
+
ZodEnum: be,
|
|
2841
|
+
ZodNativeEnum: tt,
|
|
2842
|
+
ZodPromise: De,
|
|
2843
|
+
ZodEffects: Q,
|
|
2844
|
+
ZodTransformer: Q,
|
|
2845
|
+
ZodOptional: se,
|
|
2846
|
+
ZodNullable: xe,
|
|
2847
|
+
ZodDefault: rt,
|
|
2848
|
+
ZodCatch: nt,
|
|
2849
|
+
ZodNaN: _t,
|
|
2850
|
+
BRAND: wn,
|
|
2851
|
+
ZodBranded: jt,
|
|
2852
|
+
ZodPipeline: ot,
|
|
2853
|
+
ZodReadonly: st,
|
|
2854
|
+
custom: lr,
|
|
2855
|
+
Schema: w,
|
|
2856
|
+
ZodSchema: w,
|
|
2857
|
+
late: bn,
|
|
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: rs,
|
|
2862
|
+
any: On,
|
|
2863
|
+
array: Nn,
|
|
2864
|
+
bigint: kn,
|
|
2865
|
+
boolean: pr,
|
|
2866
|
+
date: Tn,
|
|
2867
|
+
discriminatedUnion: Dn,
|
|
2868
|
+
effect: Jt,
|
|
2869
|
+
enum: Hn,
|
|
2870
|
+
function: zn,
|
|
2871
|
+
instanceof: xn,
|
|
2872
|
+
intersection: $n,
|
|
2873
|
+
lazy: qn,
|
|
2874
|
+
literal: Bn,
|
|
2875
|
+
map: Vn,
|
|
2876
|
+
nan: En,
|
|
2877
|
+
nativeEnum: Wn,
|
|
2878
|
+
never: Pn,
|
|
2879
|
+
null: Rn,
|
|
2880
|
+
nullable: Jn,
|
|
2881
|
+
number: mr,
|
|
2882
|
+
object: jn,
|
|
2883
|
+
oboolean: ts,
|
|
2884
|
+
onumber: es,
|
|
2885
|
+
optional: Yn,
|
|
2886
|
+
ostring: Qn,
|
|
2887
|
+
pipeline: Xn,
|
|
2888
|
+
preprocess: Gn,
|
|
2889
|
+
promise: Kn,
|
|
2890
|
+
record: Un,
|
|
2891
|
+
set: Fn,
|
|
2892
|
+
strictObject: Mn,
|
|
2893
|
+
string: fr,
|
|
2894
|
+
symbol: Cn,
|
|
2895
|
+
transformer: Jt,
|
|
2896
|
+
tuple: Ln,
|
|
2897
|
+
undefined: Sn,
|
|
2898
|
+
union: Zn,
|
|
2899
|
+
unknown: In,
|
|
2900
|
+
void: An,
|
|
2901
|
+
NEVER: ns,
|
|
2902
2902
|
ZodIssueCode: l,
|
|
2903
|
-
quotelessJson:
|
|
2904
|
-
ZodError:
|
|
2903
|
+
quotelessJson: tn,
|
|
2904
|
+
ZodError: H
|
|
2905
2905
|
});
|
|
2906
|
-
const
|
|
2907
|
-
var
|
|
2908
|
-
const
|
|
2909
|
-
var
|
|
2910
|
-
const
|
|
2906
|
+
const B = i.string().trim().min(1, { message: "Cannot be blank" }), q = i.string().trim().optional(), Pt = (t) => i.nullable(t.optional());
|
|
2907
|
+
var at = /* @__PURE__ */ ((t) => (t.FIRST_NAME = "firstName", t.LAST_NAME = "lastName", t.EMAIL = "email", t.ZIP_CODE = "zipCode", t.CITY = "city", t.STATE = "state", t.COUNTRY = "country", t.ADDRESS = "address", t.PHONE = "phone", t.PROMOTION_CODE = "promotionCode", t))(at || {});
|
|
2908
|
+
const hr = i.nativeEnum(at);
|
|
2909
|
+
var yr = /* @__PURE__ */ ((t) => (t.CARD_NUMBER = "cardNumber", t.CARD_EXPIRY = "cardExpiry", t.CARD_CVC = "cardCvc", t))(yr || {});
|
|
2910
|
+
const gr = i.nativeEnum(yr), ss = i.union([hr, gr]), _r = i.object({
|
|
2911
2911
|
provider: i.string(),
|
|
2912
|
-
processor_name:
|
|
2913
|
-
metadata:
|
|
2912
|
+
processor_name: Pt(i.string()),
|
|
2913
|
+
metadata: Pt(i.record(i.string(), i.any()))
|
|
2914
|
+
}), as = i.object({
|
|
2915
|
+
id: i.string()
|
|
2914
2916
|
});
|
|
2915
2917
|
i.object({
|
|
2916
|
-
cardNumber:
|
|
2917
|
-
expiry:
|
|
2918
|
-
cvc:
|
|
2918
|
+
cardNumber: q,
|
|
2919
|
+
expiry: q,
|
|
2920
|
+
cvc: q
|
|
2919
2921
|
});
|
|
2920
2922
|
i.object({
|
|
2921
|
-
backgroundColor:
|
|
2922
|
-
color:
|
|
2923
|
-
fontFamily:
|
|
2924
|
-
fontSize:
|
|
2925
|
-
fontWeight:
|
|
2926
|
-
margin:
|
|
2927
|
-
padding:
|
|
2923
|
+
backgroundColor: q,
|
|
2924
|
+
color: q,
|
|
2925
|
+
fontFamily: q,
|
|
2926
|
+
fontSize: q,
|
|
2927
|
+
fontWeight: q,
|
|
2928
|
+
margin: q,
|
|
2929
|
+
padding: q
|
|
2928
2930
|
});
|
|
2929
|
-
const
|
|
2931
|
+
const k = i.enum([
|
|
2930
2932
|
// Element -> Form
|
|
2931
2933
|
"LAYOUT",
|
|
2932
2934
|
"LOADED",
|
|
@@ -2947,152 +2949,158 @@ const E = i.enum([
|
|
|
2947
2949
|
"TOKENIZE",
|
|
2948
2950
|
"CHECKOUT",
|
|
2949
2951
|
"START_PAYMENT_FLOW"
|
|
2950
|
-
]),
|
|
2951
|
-
type:
|
|
2952
|
-
elementType:
|
|
2953
|
-
}),
|
|
2954
|
-
type:
|
|
2955
|
-
message:
|
|
2956
|
-
}),
|
|
2957
|
-
type:
|
|
2958
|
-
elementType:
|
|
2952
|
+
]), is = k.extract(["TOKENIZE_STARTED", "CHECKOUT_STARTED"]), os = i.object({ type: is }), cs = k.extract(["BLUR", "FOCUS", "CHANGE"]), ds = i.object({
|
|
2953
|
+
type: cs,
|
|
2954
|
+
elementType: gr
|
|
2955
|
+
}), us = k.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), ls = i.object({
|
|
2956
|
+
type: us,
|
|
2957
|
+
message: B
|
|
2958
|
+
}), fs = k.extract(["VALIDATION_ERROR"]), ms = i.object({
|
|
2959
|
+
type: fs,
|
|
2960
|
+
elementType: ss,
|
|
2959
2961
|
errors: i.array(i.string())
|
|
2960
|
-
}),
|
|
2961
|
-
type: i.literal(
|
|
2962
|
-
height:
|
|
2963
|
-
}),
|
|
2964
|
-
type: i.literal(
|
|
2965
|
-
sessionId:
|
|
2962
|
+
}), ps = i.object({
|
|
2963
|
+
type: i.literal(k.enum.LAYOUT),
|
|
2964
|
+
height: B
|
|
2965
|
+
}), hs = i.object({
|
|
2966
|
+
type: i.literal(k.enum.LOADED),
|
|
2967
|
+
sessionId: B,
|
|
2966
2968
|
totalAmountAtoms: i.number(),
|
|
2967
|
-
currency:
|
|
2968
|
-
checkoutPaymentMethods: i.array(
|
|
2969
|
-
}),
|
|
2970
|
-
type: i.literal(
|
|
2969
|
+
currency: q,
|
|
2970
|
+
checkoutPaymentMethods: i.array(_r)
|
|
2971
|
+
}), ys = i.object({
|
|
2972
|
+
type: i.literal(k.enum.PAYMENT_FLOW_STARTED),
|
|
2971
2973
|
nextActionMetadata: i.record(i.string(), i.any()),
|
|
2972
2974
|
paymentFlowMetadata: i.any().optional(),
|
|
2973
2975
|
startPFMetadata: i.optional(i.record(i.string(), i.any()))
|
|
2974
|
-
}),
|
|
2975
|
-
type: i.literal(
|
|
2976
|
+
}), gs = i.object({
|
|
2977
|
+
type: i.literal(k.enum.SETUP_PAYMENT_METHOD_SUCCESS),
|
|
2976
2978
|
paymentMethodId: i.string()
|
|
2977
|
-
}),
|
|
2978
|
-
firstName:
|
|
2979
|
-
lastName:
|
|
2980
|
-
email:
|
|
2981
|
-
zipCode:
|
|
2982
|
-
country:
|
|
2983
|
-
promotionCode:
|
|
2984
|
-
}),
|
|
2985
|
-
type:
|
|
2986
|
-
sessionId:
|
|
2987
|
-
checkoutPaymentMethod:
|
|
2979
|
+
}), _s = i.object({
|
|
2980
|
+
firstName: B,
|
|
2981
|
+
lastName: B,
|
|
2982
|
+
email: B,
|
|
2983
|
+
zipCode: B,
|
|
2984
|
+
country: B,
|
|
2985
|
+
promotionCode: q
|
|
2986
|
+
}), vs = k.extract(["TOKENIZE", "CHECKOUT", "START_PAYMENT_FLOW"]), vr = i.object({
|
|
2987
|
+
type: vs,
|
|
2988
|
+
sessionId: B,
|
|
2989
|
+
checkoutPaymentMethod: _r,
|
|
2988
2990
|
paymentFlowMetadata: i.any().optional(),
|
|
2989
2991
|
doNotUseLegacyCCFlow: i.boolean().optional(),
|
|
2990
|
-
existingCCPMId:
|
|
2991
|
-
}).extend(
|
|
2992
|
-
type: i.literal(
|
|
2992
|
+
existingCCPMId: q
|
|
2993
|
+
}).extend(_s.shape), ws = i.object({
|
|
2994
|
+
type: i.literal(k.enum.TOKENIZE_SUCCESS),
|
|
2993
2995
|
isReadyForCheckout: i.boolean()
|
|
2994
|
-
}),
|
|
2995
|
-
type: i.literal(
|
|
2996
|
+
}), bs = i.object({
|
|
2997
|
+
type: i.literal(k.enum.CHECKOUT_SUCCESS),
|
|
2996
2998
|
invoiceUrls: i.array(i.string()),
|
|
2997
2999
|
subscriptionIds: i.array(i.string()),
|
|
2998
3000
|
customerId: i.string()
|
|
2999
|
-
}),
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
ts,
|
|
3003
|
-
ns,
|
|
3004
|
-
ss,
|
|
3005
|
-
as,
|
|
3006
|
-
fr,
|
|
3007
|
-
us,
|
|
3001
|
+
}), xs = i.discriminatedUnion("type", [
|
|
3002
|
+
os,
|
|
3003
|
+
ds,
|
|
3008
3004
|
ls,
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3005
|
+
ms,
|
|
3006
|
+
ps,
|
|
3007
|
+
hs,
|
|
3008
|
+
vr,
|
|
3009
|
+
ws,
|
|
3010
|
+
bs,
|
|
3011
|
+
ys,
|
|
3012
|
+
gs
|
|
3013
|
+
]), Es = i.object({
|
|
3014
|
+
payload: xs,
|
|
3015
|
+
nonce: B,
|
|
3016
|
+
formId: B,
|
|
3017
|
+
elementId: B
|
|
3016
3018
|
});
|
|
3017
3019
|
i.object({
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
startFlow: i.function(i.tuple([]), i.void())
|
|
3020
|
+
amountAtom: i.number(),
|
|
3021
|
+
currency: B
|
|
3021
3022
|
});
|
|
3022
3023
|
i.object({
|
|
3023
3024
|
secure_token: i.string(),
|
|
3024
3025
|
promotion_code: i.string().optional()
|
|
3025
3026
|
});
|
|
3026
|
-
|
|
3027
|
+
i.object({
|
|
3028
|
+
secure_token: i.string(),
|
|
3029
|
+
existing_cc_pm_id: Pt(i.string())
|
|
3030
|
+
});
|
|
3031
|
+
const ks = i.object({
|
|
3032
|
+
payment_methods: i.array(as)
|
|
3033
|
+
}), Ts = (t) => {
|
|
3027
3034
|
const e = {};
|
|
3028
3035
|
return Object.entries(t).forEach(([r, n]) => {
|
|
3029
3036
|
try {
|
|
3030
|
-
const s =
|
|
3037
|
+
const s = hr.parse(r);
|
|
3031
3038
|
Array.isArray(n) ? e[s] = n : Array.isArray(n._errors) && (e[s] = n._errors);
|
|
3032
3039
|
} catch {
|
|
3033
3040
|
return;
|
|
3034
3041
|
}
|
|
3035
3042
|
}), e;
|
|
3036
|
-
},
|
|
3043
|
+
}, Cs = (t, e) => Array.from(t.querySelectorAll("input[data-opid]") ?? []).reduce((s, a) => {
|
|
3037
3044
|
const o = a.getAttribute("data-opid");
|
|
3038
3045
|
return o ? { ...s, [o]: a.value } : s;
|
|
3039
|
-
}, e),
|
|
3040
|
-
const c =
|
|
3046
|
+
}, e), lt = (t, e, r, n, s, a, o) => {
|
|
3047
|
+
const c = Cs(r, {
|
|
3041
3048
|
type: t,
|
|
3042
3049
|
sessionId: e,
|
|
3043
3050
|
checkoutPaymentMethod: s,
|
|
3044
3051
|
paymentFlowMetadata: o,
|
|
3045
3052
|
doNotUseLegacyCCFlow: a
|
|
3046
3053
|
});
|
|
3047
|
-
(s.provider === "apple_pay" || s.provider === "google_pay") && (c[
|
|
3048
|
-
const u =
|
|
3054
|
+
(s.provider === "apple_pay" || s.provider === "google_pay") && (c[at.ZIP_CODE] || (c[at.ZIP_CODE] = "00000"));
|
|
3055
|
+
const u = vr.safeParse(c);
|
|
3049
3056
|
if (u.success)
|
|
3050
3057
|
return u.data;
|
|
3051
3058
|
{
|
|
3052
|
-
const d = u.error.format(), f =
|
|
3053
|
-
for (const [
|
|
3054
|
-
n(
|
|
3059
|
+
const d = u.error.format(), f = Ts(d);
|
|
3060
|
+
for (const [v, b] of Object.entries(f))
|
|
3061
|
+
n(v, b, v);
|
|
3055
3062
|
return null;
|
|
3056
3063
|
}
|
|
3057
|
-
},
|
|
3064
|
+
}, Ss = (t) => {
|
|
3058
3065
|
try {
|
|
3059
|
-
return
|
|
3066
|
+
return Es.parse(t);
|
|
3060
3067
|
} catch (e) {
|
|
3061
3068
|
throw e;
|
|
3062
3069
|
}
|
|
3063
|
-
},
|
|
3070
|
+
}, Ue = (t, e, r, n, s) => {
|
|
3064
3071
|
const a = {
|
|
3065
3072
|
payload: n,
|
|
3066
|
-
nonce:
|
|
3073
|
+
nonce: sr(),
|
|
3067
3074
|
formId: e,
|
|
3068
3075
|
elementId: r
|
|
3069
3076
|
};
|
|
3070
3077
|
t.postMessage(JSON.stringify(a), s);
|
|
3071
|
-
},
|
|
3078
|
+
}, Rs = "https://cde.openpaystaging.com", Os = {
|
|
3072
3079
|
usd: "usd",
|
|
3073
3080
|
brl: "brl"
|
|
3074
|
-
},
|
|
3081
|
+
}, Mt = async (t) => {
|
|
3075
3082
|
for (let r = 0; r < 10; r++)
|
|
3076
|
-
|
|
3077
|
-
if (!
|
|
3083
|
+
Gt() || await wr(500);
|
|
3084
|
+
if (!Gt())
|
|
3078
3085
|
throw new Error("Stripe JS not found.");
|
|
3079
3086
|
return new Stripe(t);
|
|
3080
|
-
},
|
|
3081
|
-
const
|
|
3082
|
-
return
|
|
3087
|
+
}, Is = async (t, e, r, n) => {
|
|
3088
|
+
const s = await Mt(t), a = Os[r.toLowerCase().trim()];
|
|
3089
|
+
return s.paymentRequest({
|
|
3083
3090
|
// TODO: replace this with stripe account country as soon as we support it
|
|
3084
3091
|
country: "US",
|
|
3085
|
-
currency:
|
|
3092
|
+
currency: a,
|
|
3086
3093
|
total: {
|
|
3087
3094
|
label: "Total",
|
|
3088
|
-
amount: e
|
|
3095
|
+
amount: e,
|
|
3096
|
+
pending: n
|
|
3089
3097
|
},
|
|
3090
3098
|
requestPayerName: !0,
|
|
3091
3099
|
requestPayerEmail: !0
|
|
3092
3100
|
});
|
|
3093
|
-
},
|
|
3101
|
+
}, wr = (t) => new Promise((e) => {
|
|
3094
3102
|
setTimeout(e, t);
|
|
3095
|
-
}),
|
|
3103
|
+
}), Gt = () => "Stripe" in window, Ps = async (t) => new Promise((e, r) => {
|
|
3096
3104
|
try {
|
|
3097
3105
|
t.on("paymentmethod", async (n) => {
|
|
3098
3106
|
e(n);
|
|
@@ -3102,12 +3110,12 @@ const hs = (t) => {
|
|
|
3102
3110
|
} catch (n) {
|
|
3103
3111
|
r(n);
|
|
3104
3112
|
}
|
|
3105
|
-
}),
|
|
3113
|
+
}), As = (t) => {
|
|
3106
3114
|
const e = t == null ? void 0 : t.stripe_pk;
|
|
3107
3115
|
if (typeof e != "string")
|
|
3108
3116
|
throw new Error("Invalid: stripe_pk not passed in checkout payment method");
|
|
3109
3117
|
return e;
|
|
3110
|
-
},
|
|
3118
|
+
}, Ns = async (t, e) => {
|
|
3111
3119
|
const r = t.nextActionMetadata;
|
|
3112
3120
|
if (!t.paymentFlowMetadata || !t.paymentFlowMetadata.stripePmId)
|
|
3113
3121
|
throw new Error(`Invalid payment flow metadata format: ${JSON.stringify(t.paymentFlowMetadata)}`);
|
|
@@ -3115,22 +3123,22 @@ const hs = (t) => {
|
|
|
3115
3123
|
throw new Error(`Invalid next action metadata format: ${JSON.stringify(r)}`);
|
|
3116
3124
|
if (e.paymentMethod.id !== t.paymentFlowMetadata.stripePmId)
|
|
3117
3125
|
throw new Error(`PM ID mismatch: ${e.paymentMethod.id} != ${t.paymentFlowMetadata.stripePmId}`);
|
|
3118
|
-
const s = await (await
|
|
3126
|
+
const s = await (await Mt(r.stripe_pk)).confirmCardSetup(r.client_secret, {
|
|
3119
3127
|
payment_method: t.paymentFlowMetadata.stripePmId
|
|
3120
3128
|
});
|
|
3121
3129
|
if (s.error)
|
|
3122
3130
|
throw e.complete("fail"), new Error(`Payment failed: ${s.error.message ?? "unknown"}`);
|
|
3123
3131
|
e.complete("success");
|
|
3124
|
-
},
|
|
3132
|
+
}, js = async (t) => {
|
|
3125
3133
|
var a, o, c, u;
|
|
3126
|
-
const e = t.nextActionMetadata, n = await (await
|
|
3134
|
+
const e = t.nextActionMetadata, n = await (await Mt(e.stripe_pk)).confirmCardSetup(e.client_secret, {
|
|
3127
3135
|
payment_method: e.stripe_pm_id
|
|
3128
3136
|
}), s = (a = n.setupIntent) == null ? void 0 : a.status;
|
|
3129
3137
|
if (s !== "succeeded") throw s === "canceled" ? new Error("Payment cancelled, please click Submit again to pay") : new Error(
|
|
3130
3138
|
`${((o = n.error) == null ? void 0 : o.message) ?? ((u = (c = n.setupIntent) == null ? void 0 : c.last_setup_error) == null ? void 0 : u.message) ?? "Payment failed, please click submit again to pay."}`
|
|
3131
3139
|
);
|
|
3132
|
-
},
|
|
3133
|
-
const [e, r] =
|
|
3140
|
+
}, Ms = (t = {}) => {
|
|
3141
|
+
const [e, r] = S(t), n = ze(
|
|
3134
3142
|
() => ({
|
|
3135
3143
|
set: (a, o) => {
|
|
3136
3144
|
r((c) => ({
|
|
@@ -3152,18 +3160,18 @@ const hs = (t) => {
|
|
|
3152
3160
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3153
3161
|
[r]
|
|
3154
3162
|
), s = {
|
|
3155
|
-
get:
|
|
3163
|
+
get: ye((a) => e[a], [e]),
|
|
3156
3164
|
...n
|
|
3157
3165
|
};
|
|
3158
3166
|
return [e, s];
|
|
3159
3167
|
};
|
|
3160
|
-
function
|
|
3168
|
+
function Zs(t) {
|
|
3161
3169
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
3162
3170
|
}
|
|
3163
|
-
var
|
|
3164
|
-
function
|
|
3171
|
+
var Zt = { exports: {} }, Ds = Wr;
|
|
3172
|
+
function br(t, e, r) {
|
|
3165
3173
|
var n = typeof e == "function";
|
|
3166
|
-
|
|
3174
|
+
Ds.useEffect(function() {
|
|
3167
3175
|
var s, a = !0, o = t(function() {
|
|
3168
3176
|
return a;
|
|
3169
3177
|
});
|
|
@@ -3174,40 +3182,40 @@ function pr(t, e, r) {
|
|
|
3174
3182
|
};
|
|
3175
3183
|
}, n ? r : e);
|
|
3176
3184
|
}
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
var
|
|
3180
|
-
const
|
|
3185
|
+
Zt.exports = br;
|
|
3186
|
+
Zt.exports.useAsyncEffect = br;
|
|
3187
|
+
var $s = Zt.exports;
|
|
3188
|
+
const vt = /* @__PURE__ */ Zs($s), Ls = i.object({
|
|
3181
3189
|
type: i.string(),
|
|
3182
3190
|
loc: i.array(i.string()),
|
|
3183
3191
|
msg: i.string(),
|
|
3184
3192
|
url: i.string()
|
|
3185
|
-
}),
|
|
3193
|
+
}), Us = i.array(Ls), Vs = i.object({
|
|
3186
3194
|
code: i.string(),
|
|
3187
3195
|
message: i.string(),
|
|
3188
3196
|
path: i.array(i.string())
|
|
3189
|
-
}),
|
|
3197
|
+
}), Fs = i.array(Vs), zs = {
|
|
3190
3198
|
"failed to fetch": "Connection error: please double check if you are connected to the internet, then try again"
|
|
3191
|
-
},
|
|
3199
|
+
}, At = (t) => {
|
|
3192
3200
|
const e = t.toLowerCase().trim();
|
|
3193
|
-
return
|
|
3194
|
-
},
|
|
3201
|
+
return zs[e] ?? t;
|
|
3202
|
+
}, qs = (t) => {
|
|
3195
3203
|
try {
|
|
3196
3204
|
return typeof JSON.parse(t) == "object";
|
|
3197
3205
|
} catch {
|
|
3198
3206
|
return !1;
|
|
3199
3207
|
}
|
|
3200
|
-
},
|
|
3201
|
-
${t.map((r) => `• ${
|
|
3202
|
-
`)}`,
|
|
3208
|
+
}, Bs = (t) => t.length === 1 ? At(t[0].msg) : `Please fix the following errors:
|
|
3209
|
+
${t.map((r) => `• ${At(r.msg)}`).join(`
|
|
3210
|
+
`)}`, Hs = (t) => `Encountered the following errors:
|
|
3203
3211
|
${t.map((r) => `- ${r.path.join("/")}: ${r.message}`).join(`
|
|
3204
|
-
`)}`,
|
|
3212
|
+
`)}`, Dt = (t) => {
|
|
3205
3213
|
if (window.cur_error = t, t instanceof Error)
|
|
3206
|
-
if (
|
|
3214
|
+
if (qs(t.message)) {
|
|
3207
3215
|
const e = JSON.parse(t.message);
|
|
3208
|
-
return
|
|
3216
|
+
return Us.safeParse(e).success ? Bs(e) : Fs.safeParse(e).success ? Hs(e) : t.message;
|
|
3209
3217
|
} else
|
|
3210
|
-
return
|
|
3218
|
+
return At(t.message);
|
|
3211
3219
|
if (typeof t == "object")
|
|
3212
3220
|
try {
|
|
3213
3221
|
return JSON.stringify(t);
|
|
@@ -3216,92 +3224,112 @@ ${t.map((r) => `- ${r.path.join("/")}: ${r.message}`).join(`
|
|
|
3216
3224
|
}
|
|
3217
3225
|
else
|
|
3218
3226
|
return t + "";
|
|
3219
|
-
}
|
|
3227
|
+
};
|
|
3228
|
+
function Ws(t, e = 0) {
|
|
3229
|
+
const r = qe(!1), n = qe(), s = qe(t), a = ye(() => r.current, []), o = ye(() => {
|
|
3230
|
+
r.current = !1, n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
3231
|
+
r.current = !0, s.current();
|
|
3232
|
+
}, e);
|
|
3233
|
+
}, [e]), c = ye(() => {
|
|
3234
|
+
r.current = null, n.current && clearTimeout(n.current);
|
|
3235
|
+
}, []);
|
|
3236
|
+
return ge(() => {
|
|
3237
|
+
s.current = t;
|
|
3238
|
+
}, [t]), ge(() => (o(), c), [e]), [a, c, o];
|
|
3239
|
+
}
|
|
3240
|
+
function Ks(t, e = 0, r = []) {
|
|
3241
|
+
const [n, s, a] = Ws(t, e);
|
|
3242
|
+
return ge(a, r), [n, s];
|
|
3243
|
+
}
|
|
3244
|
+
const N = (t) => i.nullable(t.optional());
|
|
3220
3245
|
i.string().trim().min(1, { message: "Cannot be blank" });
|
|
3221
|
-
const
|
|
3246
|
+
const Ys = i.object({
|
|
3247
|
+
cde_response_type: i.literal("error"),
|
|
3248
|
+
message: i.string()
|
|
3249
|
+
}), Js = i.enum(["usd", "brl"]), xr = i.object({
|
|
3222
3250
|
name: i.string(),
|
|
3223
|
-
amount_atom_off:
|
|
3224
|
-
percent_off:
|
|
3225
|
-
currency:
|
|
3251
|
+
amount_atom_off: N(i.number()),
|
|
3252
|
+
percent_off: N(i.number()),
|
|
3253
|
+
currency: N(i.string()),
|
|
3226
3254
|
duration: i.string(),
|
|
3227
|
-
duration_in_months:
|
|
3228
|
-
}),
|
|
3255
|
+
duration_in_months: N(i.number())
|
|
3256
|
+
}), Gs = i.object({
|
|
3229
3257
|
amount_subtotal_atom: i.number().int(),
|
|
3230
3258
|
amount_total_atom: i.number().int(),
|
|
3231
3259
|
currency: i.string(),
|
|
3232
|
-
description:
|
|
3260
|
+
description: N(i.string()),
|
|
3233
3261
|
price_id: i.string(),
|
|
3234
|
-
billing_interval:
|
|
3235
|
-
billing_interval_count:
|
|
3262
|
+
billing_interval: N(i.string()),
|
|
3263
|
+
billing_interval_count: N(i.number().int()),
|
|
3236
3264
|
quantity: i.number().int()
|
|
3237
|
-
}),
|
|
3265
|
+
}), Xs = i.record(i.string(), i.any()), Qs = i.object({
|
|
3238
3266
|
name: i.string(),
|
|
3239
|
-
settings:
|
|
3240
|
-
}),
|
|
3267
|
+
settings: N(Xs)
|
|
3268
|
+
}), ea = i.object({
|
|
3241
3269
|
provider: i.string(),
|
|
3242
|
-
processor_name:
|
|
3243
|
-
metadata:
|
|
3244
|
-
}),
|
|
3270
|
+
processor_name: N(i.string()),
|
|
3271
|
+
metadata: N(i.record(i.string(), i.any()))
|
|
3272
|
+
}), ta = i.object({
|
|
3245
3273
|
quantity: i.number()
|
|
3246
|
-
}),
|
|
3247
|
-
id:
|
|
3248
|
-
billing_interval:
|
|
3249
|
-
billing_interval_count:
|
|
3250
|
-
subscription_items: i.array(
|
|
3251
|
-
trial_start:
|
|
3252
|
-
trial_end:
|
|
3253
|
-
}),
|
|
3274
|
+
}), ra = i.object({
|
|
3275
|
+
id: N(i.string()),
|
|
3276
|
+
billing_interval: N(i.string()),
|
|
3277
|
+
billing_interval_count: N(i.number().int()),
|
|
3278
|
+
subscription_items: i.array(ta),
|
|
3279
|
+
trial_start: N(i.string()),
|
|
3280
|
+
trial_end: N(i.string())
|
|
3281
|
+
}), Er = i.object({
|
|
3254
3282
|
amount_atom: i.number()
|
|
3255
|
-
}),
|
|
3283
|
+
}), na = i.object({
|
|
3256
3284
|
amount_atom: i.number(),
|
|
3257
3285
|
amount_atom_considering_discount_applied: i.number(),
|
|
3258
3286
|
currency: i.string(),
|
|
3259
|
-
discount_amount_atoms: i.array(
|
|
3287
|
+
discount_amount_atoms: i.array(Er),
|
|
3260
3288
|
subscription_item_id: i.string()
|
|
3261
|
-
}),
|
|
3262
|
-
coupon:
|
|
3263
|
-
}),
|
|
3289
|
+
}), sa = i.object({
|
|
3290
|
+
coupon: xr
|
|
3291
|
+
}), aa = i.object({
|
|
3264
3292
|
currency: i.string(),
|
|
3265
|
-
discounts: i.array(
|
|
3266
|
-
hosted_invoice_url:
|
|
3267
|
-
lines: i.array(
|
|
3293
|
+
discounts: i.array(sa),
|
|
3294
|
+
hosted_invoice_url: N(i.string()),
|
|
3295
|
+
lines: i.array(na),
|
|
3268
3296
|
remaining_amount_atom: i.number(),
|
|
3269
3297
|
tax_amount_atom: i.number(),
|
|
3270
3298
|
total_amount_atom: i.number(),
|
|
3271
|
-
total_discount_amount_atoms: i.array(
|
|
3272
|
-
}),
|
|
3273
|
-
created: i.array(
|
|
3274
|
-
invoices: i.array(
|
|
3275
|
-
}),
|
|
3276
|
-
preview:
|
|
3277
|
-
preview_post_trial:
|
|
3278
|
-
coupons: i.array(
|
|
3279
|
-
}),
|
|
3299
|
+
total_discount_amount_atoms: i.array(Er)
|
|
3300
|
+
}), Xt = i.object({
|
|
3301
|
+
created: i.array(ra),
|
|
3302
|
+
invoices: i.array(aa)
|
|
3303
|
+
}), kr = i.object({
|
|
3304
|
+
preview: Xt,
|
|
3305
|
+
preview_post_trial: N(Xt),
|
|
3306
|
+
coupons: i.array(xr)
|
|
3307
|
+
}), Qt = i.object({
|
|
3280
3308
|
status: i.literal("open"),
|
|
3281
3309
|
token: i.string(),
|
|
3282
|
-
email:
|
|
3283
|
-
line_items: i.array(
|
|
3310
|
+
email: N(i.string()),
|
|
3311
|
+
line_items: i.array(Gs),
|
|
3284
3312
|
amount_subtotal_atom: i.number().int(),
|
|
3285
3313
|
amount_total_atom: i.number().int(),
|
|
3286
|
-
brand:
|
|
3287
|
-
subs_preview:
|
|
3314
|
+
brand: Qs,
|
|
3315
|
+
subs_preview: N(kr),
|
|
3288
3316
|
// Null in setup mode
|
|
3289
|
-
methods_available: i.array(
|
|
3290
|
-
}),
|
|
3317
|
+
methods_available: i.array(ea)
|
|
3318
|
+
}), Tr = i.discriminatedUnion("mode", [
|
|
3291
3319
|
i.object({
|
|
3292
3320
|
mode: i.literal("setup"),
|
|
3293
3321
|
currency: i.nullable(i.undefined())
|
|
3294
|
-
}).extend(
|
|
3322
|
+
}).extend(Qt.shape),
|
|
3295
3323
|
i.object({
|
|
3296
3324
|
mode: i.enum(["payment", "subscription"]),
|
|
3297
|
-
currency:
|
|
3298
|
-
}).extend(
|
|
3299
|
-
]),
|
|
3325
|
+
currency: Js
|
|
3326
|
+
}).extend(Qt.shape)
|
|
3327
|
+
]), ia = i.object({
|
|
3300
3328
|
status: i.literal("complete")
|
|
3301
|
-
}),
|
|
3329
|
+
}), oa = i.object({
|
|
3302
3330
|
status: i.literal("expired")
|
|
3303
3331
|
});
|
|
3304
|
-
i.union([
|
|
3332
|
+
i.union([Tr, ia, oa]);
|
|
3305
3333
|
i.object({
|
|
3306
3334
|
logo: i.string(),
|
|
3307
3335
|
icon: i.string(),
|
|
@@ -3320,13 +3348,13 @@ i.object({
|
|
|
3320
3348
|
id: i.string(),
|
|
3321
3349
|
return_url: i.string()
|
|
3322
3350
|
});
|
|
3323
|
-
const
|
|
3351
|
+
const ca = i.object({
|
|
3324
3352
|
type: i.string(),
|
|
3325
3353
|
loc: i.array(i.string()),
|
|
3326
3354
|
msg: i.string(),
|
|
3327
3355
|
url: i.string()
|
|
3328
3356
|
});
|
|
3329
|
-
i.array(
|
|
3357
|
+
i.array(ca);
|
|
3330
3358
|
i.object({
|
|
3331
3359
|
required_user_actions: i.array(i.record(i.string(), i.any()))
|
|
3332
3360
|
});
|
|
@@ -3334,121 +3362,180 @@ i.object({
|
|
|
3334
3362
|
required_user_actions: i.array(i.record(i.string(), i.any())),
|
|
3335
3363
|
cc_pm_id: i.string()
|
|
3336
3364
|
});
|
|
3337
|
-
const
|
|
3365
|
+
const $t = async (t, e, r) => {
|
|
3338
3366
|
const n = await t.send(e);
|
|
3339
|
-
if (
|
|
3367
|
+
if (ua(n))
|
|
3368
|
+
throw new Error(`[cde-client] Error querying CDE: ${n.message}`);
|
|
3369
|
+
if (!da(n, r)) {
|
|
3340
3370
|
const s = r.safeParse(n);
|
|
3341
3371
|
throw s.success ? new Error("Invalid state") : s.error;
|
|
3342
3372
|
}
|
|
3343
3373
|
return n;
|
|
3344
|
-
},
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
}
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
const k = bs(w.metadata), j = await sa(k, f);
|
|
3371
|
-
u.set(f, {
|
|
3372
|
-
isLoading: !1,
|
|
3373
|
-
isAvailable: j,
|
|
3374
|
-
startFlow: () => aa(
|
|
3375
|
-
t,
|
|
3376
|
-
e,
|
|
3377
|
-
n,
|
|
3378
|
-
w,
|
|
3379
|
-
k,
|
|
3380
|
-
s,
|
|
3381
|
-
a,
|
|
3382
|
-
o
|
|
3383
|
-
)
|
|
3384
|
-
});
|
|
3385
|
-
} catch {
|
|
3386
|
-
u.set(f, ta);
|
|
3387
|
-
}
|
|
3374
|
+
}, da = (t, e) => e.safeParse(t).success, ua = (t) => Ys.safeParse(t).success, la = async (t, e) => await $t(t, { type: "get_checkout_preview", payload: e }, kr), Lt = async (t) => await $t(t, { type: "get_prefill", payload: {} }, Tr), fa = async (t, e) => await $t(t, { type: "confirm_payment_flow", payload: e }, ks), ma = (t) => t.reduce((e, r) => e + r, 0), pa = (t, e, r, n) => {
|
|
3375
|
+
const [s, a] = S(""), [o, c] = S(""), [u, d] = S(null), [f, v] = S(!1), [b, E] = S(null);
|
|
3376
|
+
return vt(async () => {
|
|
3377
|
+
if (!n || !t)
|
|
3378
|
+
return;
|
|
3379
|
+
const O = await ha(n, at.PROMOTION_CODE);
|
|
3380
|
+
O == null || O.addEventListener("input", () => {
|
|
3381
|
+
v(!0), E(null), a(O.value);
|
|
3382
|
+
});
|
|
3383
|
+
}, [!!n, t]), Ks(
|
|
3384
|
+
() => {
|
|
3385
|
+
t && c(s);
|
|
3386
|
+
},
|
|
3387
|
+
1e3,
|
|
3388
|
+
[s, t]
|
|
3389
|
+
), vt(
|
|
3390
|
+
async (O) => {
|
|
3391
|
+
try {
|
|
3392
|
+
if (!e || !r || !t)
|
|
3393
|
+
return;
|
|
3394
|
+
const T = (await Lt(e)).mode === "setup", U = await Cr(e, r, T, o);
|
|
3395
|
+
O() && (E(null), d(U));
|
|
3396
|
+
} catch (I) {
|
|
3397
|
+
O() && E(Dt(I));
|
|
3398
|
+
} finally {
|
|
3399
|
+
O() && v(!1);
|
|
3388
3400
|
}
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3401
|
+
},
|
|
3402
|
+
[!e, !r, o, t]
|
|
3403
|
+
), {
|
|
3404
|
+
amount: u,
|
|
3405
|
+
isLoading: f,
|
|
3406
|
+
error: b
|
|
3407
|
+
};
|
|
3408
|
+
}, ha = async (t, e, r) => {
|
|
3409
|
+
const n = Date.now();
|
|
3410
|
+
for (r = r ?? 5e3; Date.now() - n < r; ) {
|
|
3411
|
+
const s = t.querySelector(`input[data-opid=${e}]`);
|
|
3412
|
+
if (s !== null) {
|
|
3413
|
+
if (!(s instanceof HTMLInputElement))
|
|
3414
|
+
throw new Error(`Invalid state: matched input element had wrong class: ${s.tagName}`);
|
|
3415
|
+
return s;
|
|
3416
|
+
}
|
|
3417
|
+
await wr(300);
|
|
3418
|
+
}
|
|
3419
|
+
return null;
|
|
3420
|
+
}, ya = async (t, e, r) => {
|
|
3421
|
+
const n = await la(t, {
|
|
3392
3422
|
secure_token: e,
|
|
3393
3423
|
promotion_code: r
|
|
3394
3424
|
}), s = new Set(n.preview.invoices.map((c) => c.currency));
|
|
3395
3425
|
if (s.size !== 1)
|
|
3396
3426
|
throw new Error(`Expected exactly one currency, got ${s.size}`);
|
|
3397
|
-
const a = s.values().next().value, o =
|
|
3427
|
+
const a = s.values().next().value, o = ma(n.preview.invoices.map((c) => c.remaining_amount_atom));
|
|
3398
3428
|
return {
|
|
3399
3429
|
currency: a,
|
|
3400
3430
|
amountAtom: o
|
|
3401
3431
|
};
|
|
3402
|
-
},
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3432
|
+
}, Cr = async (t, e, r, n) => {
|
|
3433
|
+
if (r)
|
|
3434
|
+
return { amountAtom: 0, currency: "usd" };
|
|
3435
|
+
{
|
|
3436
|
+
n = n || void 0;
|
|
3437
|
+
const s = await ya(t, e, n);
|
|
3438
|
+
return { amountAtom: s.amountAtom, currency: s.currency };
|
|
3439
|
+
}
|
|
3440
|
+
}, er = i.enum(["apple_pay", "google_pay"]), ga = {
|
|
3441
|
+
apple_pay: "applePay",
|
|
3442
|
+
google_pay: "googlePay"
|
|
3443
|
+
}, tr = {
|
|
3444
|
+
isLoading: !0,
|
|
3445
|
+
isAvailable: !1,
|
|
3446
|
+
startFlow: async () => {
|
|
3447
|
+
}
|
|
3448
|
+
}, _a = {
|
|
3449
|
+
isLoading: !1,
|
|
3450
|
+
isAvailable: !1,
|
|
3451
|
+
startFlow: async () => {
|
|
3452
|
+
}
|
|
3453
|
+
}, va = (t, e, r, n, s, a, o, c) => {
|
|
3454
|
+
const [u, d] = Ms({
|
|
3455
|
+
apple_pay: tr,
|
|
3456
|
+
google_pay: tr
|
|
3457
|
+
}), f = e === void 0 || r === void 0 || !n || !t, v = c.amount;
|
|
3458
|
+
return ge(() => {
|
|
3459
|
+
if (!Sr() || !v)
|
|
3460
|
+
return;
|
|
3461
|
+
const b = Rr();
|
|
3462
|
+
Or(b, v);
|
|
3463
|
+
}, [v]), vt(async () => {
|
|
3464
|
+
if (f)
|
|
3465
|
+
return;
|
|
3466
|
+
const b = r.find(
|
|
3467
|
+
(C) => C.processor_name === "stripe" && er.options.map((z) => String(z)).includes(C.provider)
|
|
3468
|
+
);
|
|
3469
|
+
if (!b)
|
|
3470
|
+
throw new Error("Stripe is not available as a checkout method");
|
|
3471
|
+
const E = As(b.metadata), I = (await Lt(t)).mode === "setup", T = await Cr(t, e, I, void 0), U = await Is(E, T.amountAtom, T.currency);
|
|
3472
|
+
xa(U);
|
|
3473
|
+
const D = await U.canMakePayment();
|
|
3474
|
+
for (const C of er.options) {
|
|
3475
|
+
C.replace("_", "");
|
|
3476
|
+
try {
|
|
3477
|
+
d.set(C, {
|
|
3478
|
+
isLoading: !1,
|
|
3479
|
+
isAvailable: (D == null ? void 0 : D[ga[C]]) ?? !1,
|
|
3480
|
+
startFlow: (z) => ba(n, b, s, a, o, z)
|
|
3481
|
+
});
|
|
3482
|
+
} catch {
|
|
3483
|
+
d.set(C, _a);
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
}, [f]), u;
|
|
3487
|
+
}, wa = (t, e, r) => !!lt(
|
|
3488
|
+
k.enum.START_PAYMENT_FLOW,
|
|
3489
|
+
// This is ok since we're just calling this function to use the validation function inside it
|
|
3490
|
+
"dummy",
|
|
3491
|
+
t,
|
|
3492
|
+
e ?? (() => {
|
|
3493
|
+
}),
|
|
3494
|
+
r,
|
|
3495
|
+
!1
|
|
3496
|
+
), ba = async (t, e, r, n, s, a) => {
|
|
3408
3497
|
try {
|
|
3409
|
-
|
|
3410
|
-
if (o && !it(
|
|
3411
|
-
E.enum.START_PAYMENT_FLOW,
|
|
3412
|
-
// This is ok since we're just calling this function to use the validation function inside it
|
|
3413
|
-
"dummy",
|
|
3414
|
-
r,
|
|
3415
|
-
o,
|
|
3416
|
-
n,
|
|
3417
|
-
!1
|
|
3418
|
-
))
|
|
3498
|
+
if (!wa(t, n, e))
|
|
3419
3499
|
return;
|
|
3420
|
-
const
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3500
|
+
const o = Rr();
|
|
3501
|
+
a != null && a.overridePaymentRequestAmount && Or(o, a.overridePaymentRequestAmount), o.show();
|
|
3502
|
+
const c = await Ps(o);
|
|
3503
|
+
r(c, e);
|
|
3504
|
+
} catch (o) {
|
|
3505
|
+
s(Dt(o));
|
|
3506
|
+
}
|
|
3507
|
+
}, xa = (t) => {
|
|
3508
|
+
if ("ojs_pr" in window)
|
|
3509
|
+
throw new Error("Attempted to set global PR twice");
|
|
3510
|
+
window.ojs_pr = t;
|
|
3511
|
+
}, Sr = () => "ojs_pr" in window, Rr = () => {
|
|
3512
|
+
if (!Sr())
|
|
3513
|
+
throw new Error("Global PR not set");
|
|
3514
|
+
return window.ojs_pr;
|
|
3515
|
+
}, Or = (t, e) => {
|
|
3516
|
+
t.update({ total: { amount: e.amountAtom, label: "Total" }, currency: e.currency });
|
|
3430
3517
|
};
|
|
3431
|
-
var
|
|
3518
|
+
var ae;
|
|
3432
3519
|
(function(t) {
|
|
3433
3520
|
t.Call = "call", t.Reply = "reply", t.Syn = "syn", t.SynAck = "synAck", t.Ack = "ack";
|
|
3434
|
-
})(
|
|
3435
|
-
var
|
|
3521
|
+
})(ae || (ae = {}));
|
|
3522
|
+
var Se;
|
|
3436
3523
|
(function(t) {
|
|
3437
3524
|
t.Fulfilled = "fulfilled", t.Rejected = "rejected";
|
|
3438
|
-
})(
|
|
3439
|
-
var
|
|
3525
|
+
})(Se || (Se = {}));
|
|
3526
|
+
var it;
|
|
3440
3527
|
(function(t) {
|
|
3441
3528
|
t.ConnectionDestroyed = "ConnectionDestroyed", t.ConnectionTimeout = "ConnectionTimeout", t.NoIframeSrc = "NoIframeSrc";
|
|
3442
|
-
})(
|
|
3443
|
-
var
|
|
3529
|
+
})(it || (it = {}));
|
|
3530
|
+
var Nt;
|
|
3444
3531
|
(function(t) {
|
|
3445
3532
|
t.DataCloneError = "DataCloneError";
|
|
3446
|
-
})(
|
|
3447
|
-
var
|
|
3533
|
+
})(Nt || (Nt = {}));
|
|
3534
|
+
var Ee;
|
|
3448
3535
|
(function(t) {
|
|
3449
3536
|
t.Message = "message";
|
|
3450
|
-
})(
|
|
3451
|
-
const
|
|
3537
|
+
})(Ee || (Ee = {}));
|
|
3538
|
+
const Ea = (t, e) => {
|
|
3452
3539
|
const r = [];
|
|
3453
3540
|
let n = !1;
|
|
3454
3541
|
return {
|
|
@@ -3461,132 +3548,132 @@ const ia = (t, e) => {
|
|
|
3461
3548
|
n ? s() : r.push(s);
|
|
3462
3549
|
}
|
|
3463
3550
|
};
|
|
3464
|
-
},
|
|
3465
|
-
},
|
|
3551
|
+
}, ka = (t) => (...e) => {
|
|
3552
|
+
}, Ta = {
|
|
3466
3553
|
"http:": "80",
|
|
3467
3554
|
"https:": "443"
|
|
3468
|
-
},
|
|
3469
|
-
if (t &&
|
|
3555
|
+
}, Ca = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, Sa = ["file:", "data:"], Ra = (t) => {
|
|
3556
|
+
if (t && Sa.find((c) => t.startsWith(c)))
|
|
3470
3557
|
return "null";
|
|
3471
|
-
const e = document.location, r =
|
|
3558
|
+
const e = document.location, r = Ca.exec(t);
|
|
3472
3559
|
let n, s, a;
|
|
3473
3560
|
r ? (n = r[1] ? r[1] : e.protocol, s = r[2], a = r[4]) : (n = e.protocol, s = e.hostname, a = e.port);
|
|
3474
|
-
const o = a && a !==
|
|
3561
|
+
const o = a && a !== Ta[n] ? `:${a}` : "";
|
|
3475
3562
|
return `${n}//${s}${o}`;
|
|
3476
|
-
},
|
|
3563
|
+
}, rr = ({ name: t, message: e, stack: r }) => ({
|
|
3477
3564
|
name: t,
|
|
3478
3565
|
message: e,
|
|
3479
3566
|
stack: r
|
|
3480
|
-
}),
|
|
3567
|
+
}), Oa = (t) => {
|
|
3481
3568
|
const e = new Error();
|
|
3482
3569
|
return Object.keys(t).forEach((r) => e[r] = t[r]), e;
|
|
3483
|
-
},
|
|
3570
|
+
}, Ia = (t, e, r) => {
|
|
3484
3571
|
const { localName: n, local: s, remote: a, originForSending: o, originForReceiving: c } = t;
|
|
3485
3572
|
let u = !1;
|
|
3486
3573
|
const d = (f) => {
|
|
3487
|
-
if (f.source !== a || f.data.penpal !==
|
|
3574
|
+
if (f.source !== a || f.data.penpal !== ae.Call)
|
|
3488
3575
|
return;
|
|
3489
3576
|
if (c !== "*" && f.origin !== c) {
|
|
3490
3577
|
r(`${n} received message from origin ${f.origin} which did not match expected origin ${c}`);
|
|
3491
3578
|
return;
|
|
3492
3579
|
}
|
|
3493
|
-
const
|
|
3494
|
-
r(`${n}: Received ${
|
|
3495
|
-
const
|
|
3496
|
-
if (r(`${n}: Sending ${
|
|
3497
|
-
r(`${n}: Unable to send ${
|
|
3580
|
+
const v = f.data, { methodName: b, args: E, id: O } = v;
|
|
3581
|
+
r(`${n}: Received ${b}() call`);
|
|
3582
|
+
const I = (T) => (U) => {
|
|
3583
|
+
if (r(`${n}: Sending ${b}() reply`), u) {
|
|
3584
|
+
r(`${n}: Unable to send ${b}() reply due to destroyed connection`);
|
|
3498
3585
|
return;
|
|
3499
3586
|
}
|
|
3500
|
-
const
|
|
3501
|
-
penpal:
|
|
3502
|
-
id:
|
|
3503
|
-
resolution:
|
|
3504
|
-
returnValue:
|
|
3587
|
+
const D = {
|
|
3588
|
+
penpal: ae.Reply,
|
|
3589
|
+
id: O,
|
|
3590
|
+
resolution: T,
|
|
3591
|
+
returnValue: U
|
|
3505
3592
|
};
|
|
3506
|
-
|
|
3593
|
+
T === Se.Rejected && U instanceof Error && (D.returnValue = rr(U), D.returnValueIsError = !0);
|
|
3507
3594
|
try {
|
|
3508
|
-
a.postMessage(
|
|
3509
|
-
} catch (
|
|
3510
|
-
if (
|
|
3511
|
-
const
|
|
3512
|
-
penpal:
|
|
3513
|
-
id:
|
|
3514
|
-
resolution:
|
|
3515
|
-
returnValue:
|
|
3595
|
+
a.postMessage(D, o);
|
|
3596
|
+
} catch (C) {
|
|
3597
|
+
if (C.name === Nt.DataCloneError) {
|
|
3598
|
+
const z = {
|
|
3599
|
+
penpal: ae.Reply,
|
|
3600
|
+
id: O,
|
|
3601
|
+
resolution: Se.Rejected,
|
|
3602
|
+
returnValue: rr(C),
|
|
3516
3603
|
returnValueIsError: !0
|
|
3517
3604
|
};
|
|
3518
|
-
a.postMessage(
|
|
3605
|
+
a.postMessage(z, o);
|
|
3519
3606
|
}
|
|
3520
|
-
throw
|
|
3607
|
+
throw C;
|
|
3521
3608
|
}
|
|
3522
3609
|
};
|
|
3523
|
-
new Promise((
|
|
3610
|
+
new Promise((T) => T(e[b].apply(e, E))).then(I(Se.Fulfilled), I(Se.Rejected));
|
|
3524
3611
|
};
|
|
3525
|
-
return s.addEventListener(
|
|
3526
|
-
u = !0, s.removeEventListener(
|
|
3612
|
+
return s.addEventListener(Ee.Message, d), () => {
|
|
3613
|
+
u = !0, s.removeEventListener(Ee.Message, d);
|
|
3527
3614
|
};
|
|
3528
3615
|
};
|
|
3529
|
-
let
|
|
3530
|
-
const
|
|
3531
|
-
const r =
|
|
3532
|
-
return r.push(t),
|
|
3533
|
-
},
|
|
3534
|
-
const n =
|
|
3616
|
+
let Pa = 0;
|
|
3617
|
+
const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t.join(Ir), ja = (t, e) => {
|
|
3618
|
+
const r = Pr(e || "");
|
|
3619
|
+
return r.push(t), Na(r);
|
|
3620
|
+
}, Ma = (t, e, r) => {
|
|
3621
|
+
const n = Pr(e);
|
|
3535
3622
|
return n.reduce((s, a, o) => (typeof s[a] > "u" && (s[a] = {}), o === n.length - 1 && (s[a] = r), s[a]), t), t;
|
|
3536
|
-
},
|
|
3623
|
+
}, Ar = (t, e) => {
|
|
3537
3624
|
const r = {};
|
|
3538
3625
|
return Object.keys(t).forEach((n) => {
|
|
3539
|
-
const s = t[n], a =
|
|
3540
|
-
typeof s == "object" && Object.assign(r,
|
|
3626
|
+
const s = t[n], a = ja(n, e);
|
|
3627
|
+
typeof s == "object" && Object.assign(r, Ar(s, a)), typeof s == "function" && (r[a] = s);
|
|
3541
3628
|
}), r;
|
|
3542
|
-
},
|
|
3629
|
+
}, Za = (t) => {
|
|
3543
3630
|
const e = {};
|
|
3544
3631
|
for (const r in t)
|
|
3545
|
-
|
|
3632
|
+
Ma(e, r, t[r]);
|
|
3546
3633
|
return e;
|
|
3547
|
-
},
|
|
3634
|
+
}, Da = (t, e, r, n, s) => {
|
|
3548
3635
|
const { localName: a, local: o, remote: c, originForSending: u, originForReceiving: d } = e;
|
|
3549
3636
|
let f = !1;
|
|
3550
3637
|
s(`${a}: Connecting call sender`);
|
|
3551
|
-
const
|
|
3552
|
-
s(`${a}: Sending ${
|
|
3553
|
-
let
|
|
3638
|
+
const v = (E) => (...O) => {
|
|
3639
|
+
s(`${a}: Sending ${E}() call`);
|
|
3640
|
+
let I;
|
|
3554
3641
|
try {
|
|
3555
|
-
c.closed && (
|
|
3642
|
+
c.closed && (I = !0);
|
|
3556
3643
|
} catch {
|
|
3557
|
-
|
|
3644
|
+
I = !0;
|
|
3558
3645
|
}
|
|
3559
|
-
if (
|
|
3560
|
-
const
|
|
3561
|
-
throw
|
|
3646
|
+
if (I && n(), f) {
|
|
3647
|
+
const T = new Error(`Unable to send ${E}() call due to destroyed connection`);
|
|
3648
|
+
throw T.code = it.ConnectionDestroyed, T;
|
|
3562
3649
|
}
|
|
3563
|
-
return new Promise((
|
|
3564
|
-
const
|
|
3565
|
-
if (
|
|
3650
|
+
return new Promise((T, U) => {
|
|
3651
|
+
const D = Aa(), C = (fe) => {
|
|
3652
|
+
if (fe.source !== c || fe.data.penpal !== ae.Reply || fe.data.id !== D)
|
|
3566
3653
|
return;
|
|
3567
|
-
if (d !== "*" &&
|
|
3568
|
-
s(`${a} received message from origin ${
|
|
3654
|
+
if (d !== "*" && fe.origin !== d) {
|
|
3655
|
+
s(`${a} received message from origin ${fe.origin} which did not match expected origin ${d}`);
|
|
3569
3656
|
return;
|
|
3570
3657
|
}
|
|
3571
|
-
const
|
|
3572
|
-
s(`${a}: Received ${
|
|
3573
|
-
let
|
|
3574
|
-
|
|
3658
|
+
const $e = fe.data;
|
|
3659
|
+
s(`${a}: Received ${E}() reply`), o.removeEventListener(Ee.Message, C);
|
|
3660
|
+
let ke = $e.returnValue;
|
|
3661
|
+
$e.returnValueIsError && (ke = Oa(ke)), ($e.resolution === Se.Fulfilled ? T : U)(ke);
|
|
3575
3662
|
};
|
|
3576
|
-
o.addEventListener(
|
|
3577
|
-
const
|
|
3578
|
-
penpal:
|
|
3579
|
-
id:
|
|
3580
|
-
methodName:
|
|
3581
|
-
args:
|
|
3663
|
+
o.addEventListener(Ee.Message, C);
|
|
3664
|
+
const z = {
|
|
3665
|
+
penpal: ae.Call,
|
|
3666
|
+
id: D,
|
|
3667
|
+
methodName: E,
|
|
3668
|
+
args: O
|
|
3582
3669
|
};
|
|
3583
|
-
c.postMessage(
|
|
3670
|
+
c.postMessage(z, u);
|
|
3584
3671
|
});
|
|
3585
|
-
},
|
|
3586
|
-
return Object.assign(t,
|
|
3672
|
+
}, b = r.reduce((E, O) => (E[O] = v(O), E), {});
|
|
3673
|
+
return Object.assign(t, Za(b)), () => {
|
|
3587
3674
|
f = !0;
|
|
3588
3675
|
};
|
|
3589
|
-
},
|
|
3676
|
+
}, $a = (t, e, r, n, s) => {
|
|
3590
3677
|
const { destroy: a, onDestroy: o } = n;
|
|
3591
3678
|
let c, u;
|
|
3592
3679
|
const d = {};
|
|
@@ -3596,20 +3683,20 @@ const pa = () => ++ha, wr = ".", xr = (t) => t ? t.split(wr) : [], ya = (t) => t
|
|
|
3596
3683
|
return;
|
|
3597
3684
|
}
|
|
3598
3685
|
s("Parent: Handshake - Received ACK");
|
|
3599
|
-
const
|
|
3686
|
+
const v = {
|
|
3600
3687
|
localName: "Parent",
|
|
3601
3688
|
local: window,
|
|
3602
3689
|
remote: f.source,
|
|
3603
3690
|
originForSending: r,
|
|
3604
3691
|
originForReceiving: e
|
|
3605
3692
|
};
|
|
3606
|
-
c && c(), c =
|
|
3607
|
-
delete d[
|
|
3693
|
+
c && c(), c = Ia(v, t, s), o(c), u && u.forEach((E) => {
|
|
3694
|
+
delete d[E];
|
|
3608
3695
|
}), u = f.data.methodNames;
|
|
3609
|
-
const
|
|
3610
|
-
return o(
|
|
3696
|
+
const b = Da(d, v, u, a, s);
|
|
3697
|
+
return o(b), d;
|
|
3611
3698
|
};
|
|
3612
|
-
},
|
|
3699
|
+
}, La = (t, e, r, n) => (s) => {
|
|
3613
3700
|
if (!s.source)
|
|
3614
3701
|
return;
|
|
3615
3702
|
if (r !== "*" && s.origin !== r) {
|
|
@@ -3618,80 +3705,80 @@ const pa = () => ++ha, wr = ".", xr = (t) => t ? t.split(wr) : [], ya = (t) => t
|
|
|
3618
3705
|
}
|
|
3619
3706
|
t("Parent: Handshake - Received SYN, responding with SYN-ACK");
|
|
3620
3707
|
const a = {
|
|
3621
|
-
penpal:
|
|
3708
|
+
penpal: ae.SynAck,
|
|
3622
3709
|
methodNames: Object.keys(e)
|
|
3623
3710
|
};
|
|
3624
3711
|
s.source.postMessage(a, n);
|
|
3625
|
-
},
|
|
3712
|
+
}, Ua = 6e4, Va = (t, e) => {
|
|
3626
3713
|
const { destroy: r, onDestroy: n } = e, s = setInterval(() => {
|
|
3627
3714
|
t.isConnected || (clearInterval(s), r());
|
|
3628
|
-
},
|
|
3715
|
+
}, Ua);
|
|
3629
3716
|
n(() => {
|
|
3630
3717
|
clearInterval(s);
|
|
3631
3718
|
});
|
|
3632
|
-
},
|
|
3719
|
+
}, Fa = (t, e) => {
|
|
3633
3720
|
let r;
|
|
3634
3721
|
return t !== void 0 && (r = window.setTimeout(() => {
|
|
3635
3722
|
const n = new Error(`Connection timed out after ${t}ms`);
|
|
3636
|
-
n.code =
|
|
3723
|
+
n.code = it.ConnectionTimeout, e(n);
|
|
3637
3724
|
}, t)), () => {
|
|
3638
3725
|
clearTimeout(r);
|
|
3639
3726
|
};
|
|
3640
|
-
},
|
|
3727
|
+
}, za = (t) => {
|
|
3641
3728
|
if (!t.src && !t.srcdoc) {
|
|
3642
3729
|
const e = new Error("Iframe must have src or srcdoc property defined.");
|
|
3643
|
-
throw e.code =
|
|
3730
|
+
throw e.code = it.NoIframeSrc, e;
|
|
3644
3731
|
}
|
|
3645
|
-
},
|
|
3732
|
+
}, qa = (t) => {
|
|
3646
3733
|
let { iframe: e, methods: r = {}, childOrigin: n, timeout: s, debug: a = !1 } = t;
|
|
3647
|
-
const o =
|
|
3648
|
-
n || (
|
|
3649
|
-
const f = n === "null" ? "*" : n,
|
|
3734
|
+
const o = ka(a), c = Ea("Parent", o), { onDestroy: u, destroy: d } = c;
|
|
3735
|
+
n || (za(e), n = Ra(e.src));
|
|
3736
|
+
const f = n === "null" ? "*" : n, v = Ar(r), b = La(o, v, n, f), E = $a(v, n, f, c, o);
|
|
3650
3737
|
return {
|
|
3651
|
-
promise: new Promise((
|
|
3652
|
-
const
|
|
3653
|
-
if (!(
|
|
3654
|
-
if (
|
|
3655
|
-
|
|
3738
|
+
promise: new Promise((I, T) => {
|
|
3739
|
+
const U = Fa(s, d), D = (C) => {
|
|
3740
|
+
if (!(C.source !== e.contentWindow || !C.data)) {
|
|
3741
|
+
if (C.data.penpal === ae.Syn) {
|
|
3742
|
+
b(C);
|
|
3656
3743
|
return;
|
|
3657
3744
|
}
|
|
3658
|
-
if (
|
|
3659
|
-
const
|
|
3660
|
-
|
|
3745
|
+
if (C.data.penpal === ae.Ack) {
|
|
3746
|
+
const z = E(C);
|
|
3747
|
+
z && (U(), I(z));
|
|
3661
3748
|
return;
|
|
3662
3749
|
}
|
|
3663
3750
|
}
|
|
3664
3751
|
};
|
|
3665
|
-
window.addEventListener(
|
|
3666
|
-
window.removeEventListener(
|
|
3752
|
+
window.addEventListener(Ee.Message, D), o("Parent: Awaiting handshake"), Va(e, c), u((C) => {
|
|
3753
|
+
window.removeEventListener(Ee.Message, D), C && T(C);
|
|
3667
3754
|
});
|
|
3668
3755
|
}),
|
|
3669
3756
|
destroy() {
|
|
3670
3757
|
d();
|
|
3671
3758
|
}
|
|
3672
3759
|
};
|
|
3673
|
-
},
|
|
3674
|
-
const [t, e] =
|
|
3760
|
+
}, Ba = () => {
|
|
3761
|
+
const [t, e] = S({ status: "none" }), r = async (n) => {
|
|
3675
3762
|
if (t.status !== "none")
|
|
3676
3763
|
return;
|
|
3677
3764
|
e({ status: "connecting" });
|
|
3678
|
-
const s =
|
|
3765
|
+
const s = qa({
|
|
3679
3766
|
iframe: n,
|
|
3680
3767
|
debug: !0
|
|
3681
3768
|
});
|
|
3682
3769
|
e({ status: "waiting", conn: s });
|
|
3683
3770
|
};
|
|
3684
|
-
return
|
|
3771
|
+
return vt(async () => {
|
|
3685
3772
|
if (t.status !== "waiting") return;
|
|
3686
|
-
const n = await t.conn.promise, s = await
|
|
3687
|
-
if (!
|
|
3773
|
+
const n = await t.conn.promise, s = await Ha(n);
|
|
3774
|
+
if (!Wa(n, s))
|
|
3688
3775
|
throw new Error("Got invalid CDE connection object");
|
|
3689
3776
|
e({ status: "connected", conn: n });
|
|
3690
3777
|
}, [t.status]), {
|
|
3691
3778
|
cdeConn: t.status === "connected" ? t.conn : null,
|
|
3692
3779
|
connectToCdeIframe: r
|
|
3693
3780
|
};
|
|
3694
|
-
},
|
|
3781
|
+
}, Ha = async (t) => {
|
|
3695
3782
|
if (typeof t != "object" || !t) return !1;
|
|
3696
3783
|
try {
|
|
3697
3784
|
const e = { type: "ping" }, r = await t.send(e);
|
|
@@ -3701,14 +3788,14 @@ const pa = () => ++ha, wr = ".", xr = (t) => t ? t.split(wr) : [], ya = (t) => t
|
|
|
3701
3788
|
} catch {
|
|
3702
3789
|
return !1;
|
|
3703
3790
|
}
|
|
3704
|
-
},
|
|
3791
|
+
}, Wa = (t, e) => !!t && e, Ka = (t) => {
|
|
3705
3792
|
if (typeof t != "string") return !1;
|
|
3706
3793
|
try {
|
|
3707
3794
|
return JSON.parse(t), !0;
|
|
3708
3795
|
} catch {
|
|
3709
3796
|
return !1;
|
|
3710
3797
|
}
|
|
3711
|
-
},
|
|
3798
|
+
}, Xa = (t) => {
|
|
3712
3799
|
const {
|
|
3713
3800
|
children: e,
|
|
3714
3801
|
checkoutSecureToken: r,
|
|
@@ -3720,233 +3807,261 @@ const pa = () => ++ha, wr = ".", xr = (t) => t ? t.split(wr) : [], ya = (t) => t
|
|
|
3720
3807
|
onLoadError: u,
|
|
3721
3808
|
onValidationError: d,
|
|
3722
3809
|
onCheckoutStarted: f,
|
|
3723
|
-
onCheckoutSuccess:
|
|
3724
|
-
onCheckoutError:
|
|
3725
|
-
onSetupPaymentMethodSuccess:
|
|
3726
|
-
baseUrl:
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3810
|
+
onCheckoutSuccess: v,
|
|
3811
|
+
onCheckoutError: b,
|
|
3812
|
+
onSetupPaymentMethodSuccess: E,
|
|
3813
|
+
baseUrl: O,
|
|
3814
|
+
enableDynamicPreviews: I
|
|
3815
|
+
} = t, T = O ?? Rs, [U, D] = S(void 0), [C, z] = S([]), [fe, $e] = S("1px"), [ke, Nr] = S(!1), [ee, Le] = S(void 0), [Ut, Te] = S(!1), [me, jr] = S([]), [pe, Mr] = S({}), [Vt, ct] = S(0), [Ft, te] = S(!1), [re, Zr] = S(void 0), [zt, Dr] = S(void 0), [qt, $r] = S(void 0), [ce, Lr] = S(void 0), [xt, Ur] = S(void 0), de = ze(() => `opjs-form-${sr()}`, []), K = qe(null), { cdeConn: Pe, connectToCdeIframe: Bt } = Ba(), Ht = pa(
|
|
3816
|
+
I ?? !1,
|
|
3817
|
+
Pe,
|
|
3818
|
+
r,
|
|
3819
|
+
K.current
|
|
3820
|
+
), Et = ye(
|
|
3821
|
+
(A) => {
|
|
3822
|
+
if (A.origin !== T || !A.source) return;
|
|
3823
|
+
const W = A.source;
|
|
3824
|
+
if (!Ka(A.data))
|
|
3732
3825
|
return;
|
|
3733
|
-
const
|
|
3734
|
-
if (
|
|
3826
|
+
const Y = JSON.parse(A.data), V = Ss(Y), Ce = V.elementId;
|
|
3827
|
+
if (V.formId !== de || !Ce || V.nonce in C)
|
|
3735
3828
|
return;
|
|
3736
|
-
|
|
3737
|
-
const
|
|
3738
|
-
if (
|
|
3739
|
-
const
|
|
3740
|
-
|
|
3741
|
-
} else if (
|
|
3742
|
-
s(
|
|
3743
|
-
else if (
|
|
3744
|
-
a(
|
|
3745
|
-
else if (
|
|
3746
|
-
o(
|
|
3747
|
-
else if (
|
|
3748
|
-
const
|
|
3749
|
-
if (
|
|
3829
|
+
z(($) => [...$, V.nonce]);
|
|
3830
|
+
const P = V.payload, F = P.type;
|
|
3831
|
+
if (F === k.enum.LAYOUT) {
|
|
3832
|
+
const $ = P.height ? `${P.height}px` : "100%";
|
|
3833
|
+
$e($);
|
|
3834
|
+
} else if (F === k.enum.FOCUS && s)
|
|
3835
|
+
s(V.elementId);
|
|
3836
|
+
else if (F === k.enum.BLUR && a)
|
|
3837
|
+
a(V.elementId);
|
|
3838
|
+
else if (F === k.enum.CHANGE && o)
|
|
3839
|
+
o(V.elementId);
|
|
3840
|
+
else if (F === k.enum.LOADED) {
|
|
3841
|
+
const $ = me.find((j) => j.contentWindow === W);
|
|
3842
|
+
if (Te(!1), !$)
|
|
3750
3843
|
return;
|
|
3751
|
-
|
|
3752
|
-
} else if (
|
|
3753
|
-
|
|
3754
|
-
else if (
|
|
3755
|
-
if (!
|
|
3844
|
+
Mr((j) => ({ ...j, [Ce]: W })), $r(P.totalAmountAtoms), Dr(P.currency), Lr(P.checkoutPaymentMethods), re || Zr(P.sessionId);
|
|
3845
|
+
} else if (F === k.enum.TOKENIZE_STARTED)
|
|
3846
|
+
Te(!0), f && f();
|
|
3847
|
+
else if (F === k.enum.PAYMENT_FLOW_STARTED) {
|
|
3848
|
+
if (!ee)
|
|
3756
3849
|
throw new Error("extraData not populated");
|
|
3850
|
+
if (!Pe)
|
|
3851
|
+
throw new Error("Not connected to CDE");
|
|
3757
3852
|
(async () => {
|
|
3758
|
-
const
|
|
3759
|
-
if (
|
|
3760
|
-
await
|
|
3761
|
-
else if (
|
|
3762
|
-
if (!
|
|
3853
|
+
const j = P.nextActionMetadata.type;
|
|
3854
|
+
if (j !== void 0) if (j === "stripe_3ds")
|
|
3855
|
+
await js(P);
|
|
3856
|
+
else if (j === "stripe_payment_request") {
|
|
3857
|
+
if (!xt)
|
|
3763
3858
|
throw new Error("Stripe PM not set");
|
|
3764
|
-
await
|
|
3859
|
+
await Ns(P, xt);
|
|
3765
3860
|
} else
|
|
3766
|
-
throw new Error(`Unknown next action type: ${
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3861
|
+
throw new Error(`Unknown next action type: ${j}`);
|
|
3862
|
+
const J = await Lt(Pe);
|
|
3863
|
+
if (J.mode === "setup") {
|
|
3864
|
+
const { payment_methods: ne } = await fa(Pe, {
|
|
3865
|
+
secure_token: J.token,
|
|
3866
|
+
existing_cc_pm_id: ee.existingCCPMId
|
|
3867
|
+
});
|
|
3868
|
+
if (ne.length !== 1)
|
|
3869
|
+
throw new Error(`Expected exactly one payment method, got ${ne.length}`);
|
|
3870
|
+
return Te(!1), ct(0), te(!1), E && E(ne[0].id), {
|
|
3871
|
+
proceedToCheckout: !1
|
|
3872
|
+
};
|
|
3873
|
+
} else
|
|
3874
|
+
return {
|
|
3875
|
+
proceedToCheckout: !0
|
|
3876
|
+
};
|
|
3877
|
+
})().then(({ proceedToCheckout: j }) => {
|
|
3878
|
+
var ne;
|
|
3879
|
+
if (!j)
|
|
3880
|
+
return;
|
|
3881
|
+
let J;
|
|
3882
|
+
if (ee.checkoutPaymentMethod.provider === "credit_card" && (J = (ne = P.startPFMetadata) == null ? void 0 : ne.cc_pm_id, !J))
|
|
3771
3883
|
throw new Error("CC PM ID not found");
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
{ ...
|
|
3884
|
+
Ue(
|
|
3885
|
+
W,
|
|
3886
|
+
de,
|
|
3887
|
+
Ce,
|
|
3888
|
+
{ ...ee, type: "CHECKOUT", doNotUseLegacyCCFlow: !0, existingCCPMId: J },
|
|
3777
3889
|
T
|
|
3778
|
-
),
|
|
3779
|
-
}).catch((
|
|
3780
|
-
const
|
|
3781
|
-
|
|
3890
|
+
), te(!0), Le(void 0), f && f();
|
|
3891
|
+
}).catch((j) => {
|
|
3892
|
+
const J = Dt(j);
|
|
3893
|
+
Te(!1), te(!1), b && b(J);
|
|
3782
3894
|
});
|
|
3783
|
-
} else if (
|
|
3784
|
-
const
|
|
3785
|
-
!
|
|
3786
|
-
} else if (
|
|
3787
|
-
|
|
3788
|
-
else if (
|
|
3789
|
-
|
|
3790
|
-
else if (
|
|
3791
|
-
u && u(
|
|
3792
|
-
else if (
|
|
3793
|
-
const
|
|
3794
|
-
(
|
|
3795
|
-
} else if (
|
|
3796
|
-
if (
|
|
3797
|
-
const
|
|
3798
|
-
if (!
|
|
3799
|
-
for (const [
|
|
3800
|
-
if (!
|
|
3801
|
-
const
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3895
|
+
} else if (F === k.enum.TOKENIZE_SUCCESS && ee) {
|
|
3896
|
+
const $ = Vt + 1, j = $ === Object.keys(pe).length;
|
|
3897
|
+
!Ft && (j || P.isReadyForCheckout) ? (Ue(W, de, Ce, ee, T), te(!0), Le(void 0)) : ct($);
|
|
3898
|
+
} else if (F === k.enum.CHECKOUT_SUCCESS)
|
|
3899
|
+
Te(!1), ct(0), te(!1), v && v(P.invoiceUrls, P.subscriptionIds, P.customerId);
|
|
3900
|
+
else if (F === k.enum.SETUP_PAYMENT_METHOD_SUCCESS)
|
|
3901
|
+
Te(!1), ct(0), te(!1), E && E(P.paymentMethodId);
|
|
3902
|
+
else if (F === k.enum.LOAD_ERROR)
|
|
3903
|
+
u && u(P.message);
|
|
3904
|
+
else if (F === k.enum.VALIDATION_ERROR) {
|
|
3905
|
+
const $ = ee == null ? void 0 : ee.checkoutPaymentMethod.provider;
|
|
3906
|
+
($ === "credit_card" || $ === void 0) && d && d(P.elementType, P.errors, Ce);
|
|
3907
|
+
} else if (F === k.enum.TOKENIZE_ERROR || F === k.enum.CHECKOUT_ERROR)
|
|
3908
|
+
if (P.message === "3DS_REQUIRED") {
|
|
3909
|
+
const $ = ce == null ? void 0 : ce.find((j) => j.provider === "credit_card");
|
|
3910
|
+
if (!re || !K.current || !d || !$) return;
|
|
3911
|
+
for (const [j, J] of Object.entries(pe)) {
|
|
3912
|
+
if (!J) continue;
|
|
3913
|
+
const ne = lt(
|
|
3914
|
+
k.enum.START_PAYMENT_FLOW,
|
|
3915
|
+
re,
|
|
3916
|
+
K.current,
|
|
3805
3917
|
d,
|
|
3806
3918
|
// Only stripe supports frontend 3DS right now,
|
|
3807
3919
|
// so we pass processor_name: 'stripe' to tell delegator to only use stripe
|
|
3808
|
-
{
|
|
3920
|
+
{ ...$, processor_name: "stripe" },
|
|
3809
3921
|
!1
|
|
3810
3922
|
);
|
|
3811
|
-
if (
|
|
3812
|
-
|
|
3923
|
+
if (ne) {
|
|
3924
|
+
te(!0), Le(ne), Ue(J, de, j, ne, T);
|
|
3813
3925
|
break;
|
|
3814
3926
|
}
|
|
3815
3927
|
}
|
|
3816
3928
|
} else
|
|
3817
|
-
|
|
3929
|
+
Te(!1), te(!1), b && b(P.message);
|
|
3818
3930
|
},
|
|
3819
3931
|
[
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3932
|
+
de,
|
|
3933
|
+
re,
|
|
3934
|
+
C,
|
|
3935
|
+
ee,
|
|
3936
|
+
me,
|
|
3937
|
+
pe,
|
|
3938
|
+
Vt,
|
|
3939
|
+
Ft,
|
|
3828
3940
|
a,
|
|
3829
3941
|
o,
|
|
3830
3942
|
s,
|
|
3831
3943
|
u,
|
|
3832
3944
|
f,
|
|
3945
|
+
v,
|
|
3946
|
+
E,
|
|
3833
3947
|
b,
|
|
3834
|
-
k,
|
|
3835
|
-
w,
|
|
3836
3948
|
d,
|
|
3837
3949
|
T,
|
|
3838
|
-
|
|
3839
|
-
|
|
3950
|
+
xt,
|
|
3951
|
+
ce,
|
|
3952
|
+
Pe
|
|
3840
3953
|
]
|
|
3841
|
-
),
|
|
3842
|
-
if (!
|
|
3843
|
-
const
|
|
3844
|
-
if (!
|
|
3954
|
+
), Vr = ye(() => {
|
|
3955
|
+
if (!K.current || !d || !re || !ce) return;
|
|
3956
|
+
const A = ce.find((Y) => Y.provider === "credit_card");
|
|
3957
|
+
if (!A)
|
|
3845
3958
|
throw new Error("Card not available as a payment method in checkout");
|
|
3846
|
-
const
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3959
|
+
const W = lt(
|
|
3960
|
+
k.enum.TOKENIZE,
|
|
3961
|
+
re,
|
|
3962
|
+
K.current,
|
|
3850
3963
|
d,
|
|
3851
|
-
|
|
3964
|
+
A,
|
|
3852
3965
|
!1
|
|
3853
3966
|
);
|
|
3854
|
-
if (
|
|
3855
|
-
for (const [
|
|
3856
|
-
|
|
3857
|
-
|
|
3967
|
+
if (W) {
|
|
3968
|
+
for (const [Y, V] of Object.entries(pe))
|
|
3969
|
+
V && Ue(V, de, Y, W, T);
|
|
3970
|
+
W.type = k.enum.CHECKOUT, Le(W);
|
|
3858
3971
|
}
|
|
3859
|
-
}, [
|
|
3860
|
-
(
|
|
3861
|
-
|
|
3972
|
+
}, [K, pe, de, d, re, T, ce]), kt = ye(
|
|
3973
|
+
(A) => {
|
|
3974
|
+
Ut && A.preventDefault();
|
|
3862
3975
|
},
|
|
3863
|
-
[
|
|
3976
|
+
[Ut]
|
|
3864
3977
|
);
|
|
3865
|
-
|
|
3866
|
-
if (
|
|
3867
|
-
|
|
3868
|
-
}, [
|
|
3869
|
-
window.removeEventListener("beforeunload",
|
|
3870
|
-
}), [
|
|
3871
|
-
const
|
|
3872
|
-
(
|
|
3873
|
-
|
|
3978
|
+
ge(() => {
|
|
3979
|
+
if (ke || !K.current) return;
|
|
3980
|
+
me.length > 0 && me.length === Object.keys(pe).length && (Nr(!0), c && c(qt, zt));
|
|
3981
|
+
}, [me, pe, ke, c, qt, zt]), ge(() => (D(window.location.origin), window.addEventListener("message", Et), window.addEventListener("beforeunload", kt), () => {
|
|
3982
|
+
window.removeEventListener("beforeunload", kt), window.removeEventListener("message", Et);
|
|
3983
|
+
}), [re, Et, kt]);
|
|
3984
|
+
const Fr = ye(
|
|
3985
|
+
(A) => {
|
|
3986
|
+
me.find((Y) => Y.contentWindow === A.contentWindow) || (me.length === 0 && Bt(A), jr((Y) => [...Y, A]));
|
|
3874
3987
|
},
|
|
3875
|
-
[
|
|
3876
|
-
),
|
|
3877
|
-
if (!(!
|
|
3878
|
-
for (const [
|
|
3879
|
-
if (!
|
|
3880
|
-
const
|
|
3881
|
-
stripePmId:
|
|
3882
|
-
},
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3988
|
+
[me, Bt]
|
|
3989
|
+
), zr = async (A, W) => {
|
|
3990
|
+
if (!(!K.current || !d || !re || !ce))
|
|
3991
|
+
for (const [Y, V] of Object.entries(pe)) {
|
|
3992
|
+
if (!V) continue;
|
|
3993
|
+
const Ce = {
|
|
3994
|
+
stripePmId: A.paymentMethod.id
|
|
3995
|
+
}, dt = lt(
|
|
3996
|
+
k.enum.START_PAYMENT_FLOW,
|
|
3997
|
+
re,
|
|
3998
|
+
K.current,
|
|
3886
3999
|
d,
|
|
3887
|
-
|
|
4000
|
+
W,
|
|
3888
4001
|
!1,
|
|
3889
|
-
|
|
4002
|
+
Ce
|
|
3890
4003
|
);
|
|
3891
|
-
if (
|
|
3892
|
-
|
|
4004
|
+
if (dt) {
|
|
4005
|
+
Ur(A), te(!0), Le(dt), Ue(V, de, Y, dt, T);
|
|
3893
4006
|
break;
|
|
3894
4007
|
}
|
|
3895
4008
|
}
|
|
3896
|
-
},
|
|
3897
|
-
|
|
3898
|
-
},
|
|
3899
|
-
formId:
|
|
3900
|
-
formHeight:
|
|
3901
|
-
referer:
|
|
4009
|
+
}, qr = (A) => {
|
|
4010
|
+
te(!1), b && b(A);
|
|
4011
|
+
}, Br = {
|
|
4012
|
+
formId: de,
|
|
4013
|
+
formHeight: fe,
|
|
4014
|
+
referer: U,
|
|
3902
4015
|
checkoutSecureToken: r,
|
|
3903
|
-
registerIframe:
|
|
4016
|
+
registerIframe: Fr,
|
|
3904
4017
|
baseUrl: T
|
|
3905
|
-
},
|
|
3906
|
-
|
|
4018
|
+
}, Wt = va(
|
|
4019
|
+
Pe,
|
|
3907
4020
|
r,
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
4021
|
+
ce,
|
|
4022
|
+
K.current,
|
|
4023
|
+
zr,
|
|
3911
4024
|
d,
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
4025
|
+
qr,
|
|
4026
|
+
Ht
|
|
4027
|
+
), Hr = {
|
|
4028
|
+
submit: Vr,
|
|
4029
|
+
applePay: Wt.apple_pay,
|
|
4030
|
+
googlePay: Wt.google_pay,
|
|
4031
|
+
loaded: ke,
|
|
4032
|
+
preview: Ht
|
|
3918
4033
|
};
|
|
3919
|
-
return /* @__PURE__ */
|
|
3920
|
-
},
|
|
3921
|
-
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: o, registerIframe: c, baseUrl: u } =
|
|
4034
|
+
return /* @__PURE__ */ _e(nr.Provider, { value: Br, children: /* @__PURE__ */ _e("div", { className: n, ref: K, children: e(Hr) }) });
|
|
4035
|
+
}, Ya = (t) => JSON.stringify(t), bt = (t) => {
|
|
4036
|
+
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: o, registerIframe: c, baseUrl: u } = Jr(), [d, f] = S(!1), v = qe(null), b = ze(() => r ? Ya(r) : "", [r]), E = ze(() => ({
|
|
3922
4037
|
border: "none",
|
|
3923
4038
|
width: "100%",
|
|
3924
4039
|
height: a
|
|
3925
|
-
}), [a]),
|
|
4040
|
+
}), [a]), O = ze(() => {
|
|
3926
4041
|
if (!o || !s) return "";
|
|
3927
|
-
const
|
|
3928
|
-
return
|
|
3929
|
-
}, [
|
|
3930
|
-
return
|
|
3931
|
-
!
|
|
3932
|
-
}, [d]), o ? /* @__PURE__ */
|
|
4042
|
+
const I = new URLSearchParams();
|
|
4043
|
+
return I.append("referer", s), I.append("styles", b), I.append("formId", n), I.append("secureToken", o), I.toString();
|
|
4044
|
+
}, [b, n, s, o]);
|
|
4045
|
+
return ge(() => f(!0), []), ge(() => {
|
|
4046
|
+
!v.current || !d || c(v.current);
|
|
4047
|
+
}, [d]), o ? /* @__PURE__ */ _e(
|
|
3933
4048
|
"iframe",
|
|
3934
4049
|
{
|
|
3935
4050
|
id: `ojs-${e}-element`,
|
|
3936
4051
|
name: `${e}-element`,
|
|
3937
4052
|
className: "ojs-iframe",
|
|
3938
|
-
src: `${u}/app/v1/${e}-element/?${
|
|
3939
|
-
style:
|
|
3940
|
-
ref:
|
|
4053
|
+
src: `${u}/app/v1/${e}-element/?${O}`,
|
|
4054
|
+
style: E,
|
|
4055
|
+
ref: v
|
|
3941
4056
|
}
|
|
3942
|
-
) : /* @__PURE__ */
|
|
3943
|
-
},
|
|
4057
|
+
) : /* @__PURE__ */ _e("div", {});
|
|
4058
|
+
}, Qa = ({ styles: t }) => /* @__PURE__ */ _e(bt, { styles: t, subPath: "card-cvc" }), ei = ({ styles: t }) => /* @__PURE__ */ _e(bt, { styles: t, subPath: "card" }), ti = ({ styles: t }) => /* @__PURE__ */ _e(bt, { styles: t, subPath: "card-expiry" }), ri = ({ styles: t }) => /* @__PURE__ */ _e(bt, { styles: t, subPath: "card-number" });
|
|
3944
4059
|
export {
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
4060
|
+
Qa as CardCvcElement,
|
|
4061
|
+
ei as CardElement,
|
|
4062
|
+
ti as CardExpiryElement,
|
|
4063
|
+
ri as CardNumberElement,
|
|
4064
|
+
Xa as ElementsForm,
|
|
4065
|
+
at as FieldName,
|
|
4066
|
+
Jr as useOpenPayElements
|
|
3952
4067
|
};
|