@fileflow/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4575 @@
1
+ import { jsxs as v, jsx as c, Fragment as zt } from "react/jsx-runtime";
2
+ import { useCallback as gt, useState as Yt, useEffect as Wt } from "react";
3
+ import { c as se, b as Ht, u as Kt, X as vt, d as R, U as Jt, A as Qt, h as Xe, e as et, L as Ee, f as Me, g as he, C as Gt } from "./index-CML_nPxo.mjs";
4
+ /**
5
+ * @license lucide-react v0.321.0 - ISC
6
+ *
7
+ * This source code is licensed under the ISC license.
8
+ * See the LICENSE file in the root directory of this source tree.
9
+ */
10
+ const Xt = se("Car", [
11
+ [
12
+ "path",
13
+ {
14
+ d: "M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",
15
+ key: "5owen"
16
+ }
17
+ ],
18
+ ["circle", { cx: "7", cy: "17", r: "2", key: "u2ysq9" }],
19
+ ["path", { d: "M9 17h6", key: "r8uit2" }],
20
+ ["circle", { cx: "17", cy: "17", r: "2", key: "axvx0g" }]
21
+ ]);
22
+ /**
23
+ * @license lucide-react v0.321.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */
28
+ const tt = se("Clock", [
29
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
30
+ ["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
31
+ ]);
32
+ /**
33
+ * @license lucide-react v0.321.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */
38
+ const _t = se("FileText", [
39
+ ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
40
+ ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
41
+ ["path", { d: "M10 9H8", key: "b1mrlr" }],
42
+ ["path", { d: "M16 13H8", key: "t4e002" }],
43
+ ["path", { d: "M16 17H8", key: "z1uh3a" }]
44
+ ]);
45
+ /**
46
+ * @license lucide-react v0.321.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ */
51
+ const er = se("Home", [
52
+ ["path", { d: "m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z", key: "y5dka4" }],
53
+ ["polyline", { points: "9 22 9 12 15 12 15 22", key: "e2us08" }]
54
+ ]);
55
+ /**
56
+ * @license lucide-react v0.321.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */
61
+ const tr = se("Image", [
62
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
63
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
64
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
65
+ ]);
66
+ /**
67
+ * @license lucide-react v0.321.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */
72
+ const rt = se("ShieldCheck", [
73
+ ["path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10", key: "1irkt0" }],
74
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
75
+ ]), at = (a) => ({
76
+ id: null,
77
+ type: a,
78
+ status: "uploaded",
79
+ file: null,
80
+ previewUrl: null,
81
+ extractedData: null,
82
+ confidence: 0,
83
+ fraudFlags: [],
84
+ error: null
85
+ }), st = {
86
+ sessionId: null,
87
+ status: "idle",
88
+ step: "select",
89
+ requiredDocuments: [],
90
+ currentDocumentType: null,
91
+ documents: /* @__PURE__ */ new Map(),
92
+ isVerified: !1,
93
+ verificationStatus: null,
94
+ isLoading: !1,
95
+ error: null
96
+ }, ye = Ht((a, e) => ({
97
+ ...st,
98
+ setSessionId: (t) => a({ sessionId: t }),
99
+ setRequiredDocuments: (t) => {
100
+ const r = /* @__PURE__ */ new Map();
101
+ for (const s of t)
102
+ r.set(s, at(s));
103
+ a({
104
+ requiredDocuments: t,
105
+ documents: r,
106
+ currentDocumentType: t[0] || null
107
+ });
108
+ },
109
+ setCurrentDocumentType: (t) => a({ currentDocumentType: t }),
110
+ setDocumentFile: (t, r) => {
111
+ const { documents: s } = e(), i = s.get(t) || at(t), n = URL.createObjectURL(r), o = new Map(s);
112
+ o.set(t, {
113
+ ...i,
114
+ file: r,
115
+ previewUrl: n,
116
+ status: "uploaded",
117
+ error: null
118
+ }), a({ documents: o });
119
+ },
120
+ setDocumentStatus: (t, r) => {
121
+ const { documents: s } = e(), i = s.get(t);
122
+ if (i) {
123
+ const n = new Map(s);
124
+ n.set(t, { ...i, status: r }), a({ documents: n });
125
+ }
126
+ },
127
+ setDocumentData: (t, r) => {
128
+ const { documents: s } = e(), i = s.get(t);
129
+ if (i) {
130
+ const n = new Map(s);
131
+ n.set(t, { ...i, ...r }), a({ documents: n });
132
+ }
133
+ },
134
+ clearDocumentPreview: (t) => {
135
+ const { documents: r } = e(), s = r.get(t);
136
+ s != null && s.previewUrl && URL.revokeObjectURL(s.previewUrl);
137
+ },
138
+ setStep: (t) => a({ step: t }),
139
+ nextDocument: () => {
140
+ const { requiredDocuments: t, currentDocumentType: r, documents: s } = e(), i = r ? t.indexOf(r) : -1;
141
+ for (let n = i + 1; n < t.length; n++) {
142
+ const o = t[n], d = s.get(o);
143
+ if (!(d != null && d.file)) {
144
+ a({ currentDocumentType: o });
145
+ return;
146
+ }
147
+ }
148
+ a({
149
+ currentDocumentType: null,
150
+ step: "processing"
151
+ });
152
+ },
153
+ setVerificationStatus: (t) => a({ verificationStatus: t }),
154
+ setVerified: (t) => a({ isVerified: t }),
155
+ setStatus: (t) => a({ status: t }),
156
+ setLoading: (t) => a({ isLoading: t }),
157
+ setError: (t) => a({ error: t }),
158
+ getNextRequiredDocument: () => {
159
+ const { requiredDocuments: t, documents: r } = e();
160
+ for (const s of t) {
161
+ const i = r.get(s);
162
+ if (!(i != null && i.file))
163
+ return s;
164
+ }
165
+ return null;
166
+ },
167
+ areAllDocumentsUploaded: () => {
168
+ const { requiredDocuments: t, documents: r } = e();
169
+ return t.every((s) => {
170
+ const i = r.get(s);
171
+ return (i == null ? void 0 : i.file) !== null;
172
+ });
173
+ },
174
+ areAllDocumentsProcessed: () => {
175
+ const { requiredDocuments: t, documents: r } = e();
176
+ return t.every((s) => {
177
+ const i = r.get(s);
178
+ return (i == null ? void 0 : i.status) === "completed" || (i == null ? void 0 : i.status) === "requires_review";
179
+ });
180
+ },
181
+ reset: () => {
182
+ const { documents: t } = e();
183
+ for (const r of t.values())
184
+ r.previewUrl && URL.revokeObjectURL(r.previewUrl);
185
+ a(st);
186
+ }
187
+ }));
188
+ var k;
189
+ (function(a) {
190
+ a.assertEqual = (s) => {
191
+ };
192
+ function e(s) {
193
+ }
194
+ a.assertIs = e;
195
+ function t(s) {
196
+ throw new Error();
197
+ }
198
+ a.assertNever = t, a.arrayToEnum = (s) => {
199
+ const i = {};
200
+ for (const n of s)
201
+ i[n] = n;
202
+ return i;
203
+ }, a.getValidEnumValues = (s) => {
204
+ const i = a.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), n = {};
205
+ for (const o of i)
206
+ n[o] = s[o];
207
+ return a.objectValues(n);
208
+ }, a.objectValues = (s) => a.objectKeys(s).map(function(i) {
209
+ return s[i];
210
+ }), a.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
211
+ const i = [];
212
+ for (const n in s)
213
+ Object.prototype.hasOwnProperty.call(s, n) && i.push(n);
214
+ return i;
215
+ }, a.find = (s, i) => {
216
+ for (const n of s)
217
+ if (i(n))
218
+ return n;
219
+ }, a.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s;
220
+ function r(s, i = " | ") {
221
+ return s.map((n) => typeof n == "string" ? `'${n}'` : n).join(i);
222
+ }
223
+ a.joinValues = r, a.jsonStringifyReplacer = (s, i) => typeof i == "bigint" ? i.toString() : i;
224
+ })(k || (k = {}));
225
+ var it;
226
+ (function(a) {
227
+ a.mergeShapes = (e, t) => ({
228
+ ...e,
229
+ ...t
230
+ // second overwrites first
231
+ });
232
+ })(it || (it = {}));
233
+ const m = k.arrayToEnum([
234
+ "string",
235
+ "nan",
236
+ "number",
237
+ "integer",
238
+ "float",
239
+ "boolean",
240
+ "date",
241
+ "bigint",
242
+ "symbol",
243
+ "function",
244
+ "undefined",
245
+ "null",
246
+ "array",
247
+ "object",
248
+ "unknown",
249
+ "promise",
250
+ "void",
251
+ "never",
252
+ "map",
253
+ "set"
254
+ ]), V = (a) => {
255
+ switch (typeof a) {
256
+ case "undefined":
257
+ return m.undefined;
258
+ case "string":
259
+ return m.string;
260
+ case "number":
261
+ return Number.isNaN(a) ? m.nan : m.number;
262
+ case "boolean":
263
+ return m.boolean;
264
+ case "function":
265
+ return m.function;
266
+ case "bigint":
267
+ return m.bigint;
268
+ case "symbol":
269
+ return m.symbol;
270
+ case "object":
271
+ return Array.isArray(a) ? m.array : a === null ? m.null : a.then && typeof a.then == "function" && a.catch && typeof a.catch == "function" ? m.promise : typeof Map < "u" && a instanceof Map ? m.map : typeof Set < "u" && a instanceof Set ? m.set : typeof Date < "u" && a instanceof Date ? m.date : m.object;
272
+ default:
273
+ return m.unknown;
274
+ }
275
+ }, l = k.arrayToEnum([
276
+ "invalid_type",
277
+ "invalid_literal",
278
+ "custom",
279
+ "invalid_union",
280
+ "invalid_union_discriminator",
281
+ "invalid_enum_value",
282
+ "unrecognized_keys",
283
+ "invalid_arguments",
284
+ "invalid_return_type",
285
+ "invalid_date",
286
+ "invalid_string",
287
+ "too_small",
288
+ "too_big",
289
+ "invalid_intersection_types",
290
+ "not_multiple_of",
291
+ "not_finite"
292
+ ]);
293
+ class U extends Error {
294
+ get errors() {
295
+ return this.issues;
296
+ }
297
+ constructor(e) {
298
+ super(), this.issues = [], this.addIssue = (r) => {
299
+ this.issues = [...this.issues, r];
300
+ }, this.addIssues = (r = []) => {
301
+ this.issues = [...this.issues, ...r];
302
+ };
303
+ const t = new.target.prototype;
304
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
305
+ }
306
+ format(e) {
307
+ const t = e || function(i) {
308
+ return i.message;
309
+ }, r = { _errors: [] }, s = (i) => {
310
+ for (const n of i.issues)
311
+ if (n.code === "invalid_union")
312
+ n.unionErrors.map(s);
313
+ else if (n.code === "invalid_return_type")
314
+ s(n.returnTypeError);
315
+ else if (n.code === "invalid_arguments")
316
+ s(n.argumentsError);
317
+ else if (n.path.length === 0)
318
+ r._errors.push(t(n));
319
+ else {
320
+ let o = r, d = 0;
321
+ for (; d < n.path.length; ) {
322
+ const h = n.path[d];
323
+ d === n.path.length - 1 ? (o[h] = o[h] || { _errors: [] }, o[h]._errors.push(t(n))) : o[h] = o[h] || { _errors: [] }, o = o[h], d++;
324
+ }
325
+ }
326
+ };
327
+ return s(this), r;
328
+ }
329
+ static assert(e) {
330
+ if (!(e instanceof U))
331
+ throw new Error(`Not a ZodError: ${e}`);
332
+ }
333
+ toString() {
334
+ return this.message;
335
+ }
336
+ get message() {
337
+ return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
338
+ }
339
+ get isEmpty() {
340
+ return this.issues.length === 0;
341
+ }
342
+ flatten(e = (t) => t.message) {
343
+ const t = {}, r = [];
344
+ for (const s of this.issues)
345
+ if (s.path.length > 0) {
346
+ const i = s.path[0];
347
+ t[i] = t[i] || [], t[i].push(e(s));
348
+ } else
349
+ r.push(e(s));
350
+ return { formErrors: r, fieldErrors: t };
351
+ }
352
+ get formErrors() {
353
+ return this.flatten();
354
+ }
355
+ }
356
+ U.create = (a) => new U(a);
357
+ const je = (a, e) => {
358
+ let t;
359
+ switch (a.code) {
360
+ case l.invalid_type:
361
+ a.received === m.undefined ? t = "Required" : t = `Expected ${a.expected}, received ${a.received}`;
362
+ break;
363
+ case l.invalid_literal:
364
+ t = `Invalid literal value, expected ${JSON.stringify(a.expected, k.jsonStringifyReplacer)}`;
365
+ break;
366
+ case l.unrecognized_keys:
367
+ t = `Unrecognized key(s) in object: ${k.joinValues(a.keys, ", ")}`;
368
+ break;
369
+ case l.invalid_union:
370
+ t = "Invalid input";
371
+ break;
372
+ case l.invalid_union_discriminator:
373
+ t = `Invalid discriminator value. Expected ${k.joinValues(a.options)}`;
374
+ break;
375
+ case l.invalid_enum_value:
376
+ t = `Invalid enum value. Expected ${k.joinValues(a.options)}, received '${a.received}'`;
377
+ break;
378
+ case l.invalid_arguments:
379
+ t = "Invalid function arguments";
380
+ break;
381
+ case l.invalid_return_type:
382
+ t = "Invalid function return type";
383
+ break;
384
+ case l.invalid_date:
385
+ t = "Invalid date";
386
+ break;
387
+ case l.invalid_string:
388
+ typeof a.validation == "object" ? "includes" in a.validation ? (t = `Invalid input: must include "${a.validation.includes}"`, typeof a.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${a.validation.position}`)) : "startsWith" in a.validation ? t = `Invalid input: must start with "${a.validation.startsWith}"` : "endsWith" in a.validation ? t = `Invalid input: must end with "${a.validation.endsWith}"` : k.assertNever(a.validation) : a.validation !== "regex" ? t = `Invalid ${a.validation}` : t = "Invalid";
389
+ break;
390
+ case l.too_small:
391
+ a.type === "array" ? t = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "more than"} ${a.minimum} element(s)` : a.type === "string" ? t = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "over"} ${a.minimum} character(s)` : a.type === "number" ? t = `Number must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${a.minimum}` : a.type === "bigint" ? t = `Number must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${a.minimum}` : a.type === "date" ? t = `Date must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(a.minimum))}` : t = "Invalid input";
392
+ break;
393
+ case l.too_big:
394
+ a.type === "array" ? t = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at most" : "less than"} ${a.maximum} element(s)` : a.type === "string" ? t = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at most" : "under"} ${a.maximum} character(s)` : a.type === "number" ? t = `Number must be ${a.exact ? "exactly" : a.inclusive ? "less than or equal to" : "less than"} ${a.maximum}` : a.type === "bigint" ? t = `BigInt must be ${a.exact ? "exactly" : a.inclusive ? "less than or equal to" : "less than"} ${a.maximum}` : a.type === "date" ? t = `Date must be ${a.exact ? "exactly" : a.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(a.maximum))}` : t = "Invalid input";
395
+ break;
396
+ case l.custom:
397
+ t = "Invalid input";
398
+ break;
399
+ case l.invalid_intersection_types:
400
+ t = "Intersection results could not be merged";
401
+ break;
402
+ case l.not_multiple_of:
403
+ t = `Number must be a multiple of ${a.multipleOf}`;
404
+ break;
405
+ case l.not_finite:
406
+ t = "Number must be finite";
407
+ break;
408
+ default:
409
+ t = e.defaultError, k.assertNever(a);
410
+ }
411
+ return { message: t };
412
+ };
413
+ let rr = je;
414
+ function ar() {
415
+ return rr;
416
+ }
417
+ const sr = (a) => {
418
+ const { data: e, path: t, errorMaps: r, issueData: s } = a, i = [...t, ...s.path || []], n = {
419
+ ...s,
420
+ path: i
421
+ };
422
+ if (s.message !== void 0)
423
+ return {
424
+ ...s,
425
+ path: i,
426
+ message: s.message
427
+ };
428
+ let o = "";
429
+ const d = r.filter((h) => !!h).slice().reverse();
430
+ for (const h of d)
431
+ o = h(n, { data: e, defaultError: o }).message;
432
+ return {
433
+ ...s,
434
+ path: i,
435
+ message: o
436
+ };
437
+ };
438
+ function f(a, e) {
439
+ const t = ar(), r = sr({
440
+ issueData: e,
441
+ data: a.data,
442
+ path: a.path,
443
+ errorMaps: [
444
+ a.common.contextualErrorMap,
445
+ // contextual error map is first priority
446
+ a.schemaErrorMap,
447
+ // then schema-bound map if available
448
+ t,
449
+ // then global override map
450
+ t === je ? void 0 : je
451
+ // then global default map
452
+ ].filter((s) => !!s)
453
+ });
454
+ a.common.issues.push(r);
455
+ }
456
+ class A {
457
+ constructor() {
458
+ this.value = "valid";
459
+ }
460
+ dirty() {
461
+ this.value === "valid" && (this.value = "dirty");
462
+ }
463
+ abort() {
464
+ this.value !== "aborted" && (this.value = "aborted");
465
+ }
466
+ static mergeArray(e, t) {
467
+ const r = [];
468
+ for (const s of t) {
469
+ if (s.status === "aborted")
470
+ return y;
471
+ s.status === "dirty" && e.dirty(), r.push(s.value);
472
+ }
473
+ return { status: e.value, value: r };
474
+ }
475
+ static async mergeObjectAsync(e, t) {
476
+ const r = [];
477
+ for (const s of t) {
478
+ const i = await s.key, n = await s.value;
479
+ r.push({
480
+ key: i,
481
+ value: n
482
+ });
483
+ }
484
+ return A.mergeObjectSync(e, r);
485
+ }
486
+ static mergeObjectSync(e, t) {
487
+ const r = {};
488
+ for (const s of t) {
489
+ const { key: i, value: n } = s;
490
+ if (i.status === "aborted" || n.status === "aborted")
491
+ return y;
492
+ i.status === "dirty" && e.dirty(), n.status === "dirty" && e.dirty(), i.value !== "__proto__" && (typeof n.value < "u" || s.alwaysSet) && (r[i.value] = n.value);
493
+ }
494
+ return { status: e.value, value: r };
495
+ }
496
+ }
497
+ const y = Object.freeze({
498
+ status: "aborted"
499
+ }), oe = (a) => ({ status: "dirty", value: a }), E = (a) => ({ status: "valid", value: a }), nt = (a) => a.status === "aborted", ot = (a) => a.status === "dirty", re = (a) => a.status === "valid", ge = (a) => typeof Promise < "u" && a instanceof Promise;
500
+ var p;
501
+ (function(a) {
502
+ a.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, a.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
503
+ })(p || (p = {}));
504
+ class P {
505
+ constructor(e, t, r, s) {
506
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
507
+ }
508
+ get path() {
509
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
510
+ }
511
+ }
512
+ const lt = (a, e) => {
513
+ if (re(e))
514
+ return { success: !0, data: e.value };
515
+ if (!a.common.issues.length)
516
+ throw new Error("Validation failed but no issues detected.");
517
+ return {
518
+ success: !1,
519
+ get error() {
520
+ if (this._error)
521
+ return this._error;
522
+ const t = new U(a.common.issues);
523
+ return this._error = t, this._error;
524
+ }
525
+ };
526
+ };
527
+ function _(a) {
528
+ if (!a)
529
+ return {};
530
+ const { errorMap: e, invalid_type_error: t, required_error: r, description: s } = a;
531
+ if (e && (t || r))
532
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
533
+ return e ? { errorMap: e, description: s } : { errorMap: (n, o) => {
534
+ const { message: d } = a;
535
+ return n.code === "invalid_enum_value" ? { message: d ?? o.defaultError } : typeof o.data > "u" ? { message: d ?? r ?? o.defaultError } : n.code !== "invalid_type" ? { message: o.defaultError } : { message: d ?? t ?? o.defaultError };
536
+ }, description: s };
537
+ }
538
+ class b {
539
+ get description() {
540
+ return this._def.description;
541
+ }
542
+ _getType(e) {
543
+ return V(e.data);
544
+ }
545
+ _getOrReturnCtx(e, t) {
546
+ return t || {
547
+ common: e.parent.common,
548
+ data: e.data,
549
+ parsedType: V(e.data),
550
+ schemaErrorMap: this._def.errorMap,
551
+ path: e.path,
552
+ parent: e.parent
553
+ };
554
+ }
555
+ _processInputParams(e) {
556
+ return {
557
+ status: new A(),
558
+ ctx: {
559
+ common: e.parent.common,
560
+ data: e.data,
561
+ parsedType: V(e.data),
562
+ schemaErrorMap: this._def.errorMap,
563
+ path: e.path,
564
+ parent: e.parent
565
+ }
566
+ };
567
+ }
568
+ _parseSync(e) {
569
+ const t = this._parse(e);
570
+ if (ge(t))
571
+ throw new Error("Synchronous parse encountered promise.");
572
+ return t;
573
+ }
574
+ _parseAsync(e) {
575
+ const t = this._parse(e);
576
+ return Promise.resolve(t);
577
+ }
578
+ parse(e, t) {
579
+ const r = this.safeParse(e, t);
580
+ if (r.success)
581
+ return r.data;
582
+ throw r.error;
583
+ }
584
+ safeParse(e, t) {
585
+ const r = {
586
+ common: {
587
+ issues: [],
588
+ async: (t == null ? void 0 : t.async) ?? !1,
589
+ contextualErrorMap: t == null ? void 0 : t.errorMap
590
+ },
591
+ path: (t == null ? void 0 : t.path) || [],
592
+ schemaErrorMap: this._def.errorMap,
593
+ parent: null,
594
+ data: e,
595
+ parsedType: V(e)
596
+ }, s = this._parseSync({ data: e, path: r.path, parent: r });
597
+ return lt(r, s);
598
+ }
599
+ "~validate"(e) {
600
+ var r, s;
601
+ const t = {
602
+ common: {
603
+ issues: [],
604
+ async: !!this["~standard"].async
605
+ },
606
+ path: [],
607
+ schemaErrorMap: this._def.errorMap,
608
+ parent: null,
609
+ data: e,
610
+ parsedType: V(e)
611
+ };
612
+ if (!this["~standard"].async)
613
+ try {
614
+ const i = this._parseSync({ data: e, path: [], parent: t });
615
+ return re(i) ? {
616
+ value: i.value
617
+ } : {
618
+ issues: t.common.issues
619
+ };
620
+ } catch (i) {
621
+ (s = (r = i == null ? void 0 : i.message) == null ? void 0 : r.toLowerCase()) != null && s.includes("encountered") && (this["~standard"].async = !0), t.common = {
622
+ issues: [],
623
+ async: !0
624
+ };
625
+ }
626
+ return this._parseAsync({ data: e, path: [], parent: t }).then((i) => re(i) ? {
627
+ value: i.value
628
+ } : {
629
+ issues: t.common.issues
630
+ });
631
+ }
632
+ async parseAsync(e, t) {
633
+ const r = await this.safeParseAsync(e, t);
634
+ if (r.success)
635
+ return r.data;
636
+ throw r.error;
637
+ }
638
+ async safeParseAsync(e, t) {
639
+ const r = {
640
+ common: {
641
+ issues: [],
642
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
643
+ async: !0
644
+ },
645
+ path: (t == null ? void 0 : t.path) || [],
646
+ schemaErrorMap: this._def.errorMap,
647
+ parent: null,
648
+ data: e,
649
+ parsedType: V(e)
650
+ }, s = this._parse({ data: e, path: r.path, parent: r }), i = await (ge(s) ? s : Promise.resolve(s));
651
+ return lt(r, i);
652
+ }
653
+ refine(e, t) {
654
+ const r = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
655
+ return this._refinement((s, i) => {
656
+ const n = e(s), o = () => i.addIssue({
657
+ code: l.custom,
658
+ ...r(s)
659
+ });
660
+ return typeof Promise < "u" && n instanceof Promise ? n.then((d) => d ? !0 : (o(), !1)) : n ? !0 : (o(), !1);
661
+ });
662
+ }
663
+ refinement(e, t) {
664
+ return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1));
665
+ }
666
+ _refinement(e) {
667
+ return new Q({
668
+ schema: this,
669
+ typeName: g.ZodEffects,
670
+ effect: { type: "refinement", refinement: e }
671
+ });
672
+ }
673
+ superRefine(e) {
674
+ return this._refinement(e);
675
+ }
676
+ constructor(e) {
677
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
678
+ version: 1,
679
+ vendor: "zod",
680
+ validate: (t) => this["~validate"](t)
681
+ };
682
+ }
683
+ optional() {
684
+ return B.create(this, this._def);
685
+ }
686
+ nullable() {
687
+ return G.create(this, this._def);
688
+ }
689
+ nullish() {
690
+ return this.nullable().optional();
691
+ }
692
+ array() {
693
+ return F.create(this);
694
+ }
695
+ promise() {
696
+ return Ne.create(this, this._def);
697
+ }
698
+ or(e) {
699
+ return xe.create([this, e], this._def);
700
+ }
701
+ and(e) {
702
+ return be.create(this, e, this._def);
703
+ }
704
+ transform(e) {
705
+ return new Q({
706
+ ..._(this._def),
707
+ schema: this,
708
+ typeName: g.ZodEffects,
709
+ effect: { type: "transform", transform: e }
710
+ });
711
+ }
712
+ default(e) {
713
+ const t = typeof e == "function" ? e : () => e;
714
+ return new Ce({
715
+ ..._(this._def),
716
+ innerType: this,
717
+ defaultValue: t,
718
+ typeName: g.ZodDefault
719
+ });
720
+ }
721
+ brand() {
722
+ return new wt({
723
+ typeName: g.ZodBranded,
724
+ type: this,
725
+ ..._(this._def)
726
+ });
727
+ }
728
+ catch(e) {
729
+ const t = typeof e == "function" ? e : () => e;
730
+ return new Se({
731
+ ..._(this._def),
732
+ innerType: this,
733
+ catchValue: t,
734
+ typeName: g.ZodCatch
735
+ });
736
+ }
737
+ describe(e) {
738
+ const t = this.constructor;
739
+ return new t({
740
+ ...this._def,
741
+ description: e
742
+ });
743
+ }
744
+ pipe(e) {
745
+ return Ue.create(this, e);
746
+ }
747
+ readonly() {
748
+ return Te.create(this);
749
+ }
750
+ isOptional() {
751
+ return this.safeParse(void 0).success;
752
+ }
753
+ isNullable() {
754
+ return this.safeParse(null).success;
755
+ }
756
+ }
757
+ const ir = /^c[^\s-]{8,}$/i, nr = /^[0-9a-z]+$/, or = /^[0-9A-HJKMNP-TV-Z]{26}$/i, lr = /^[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, cr = /^[a-z0-9_-]{21}$/i, dr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, fr = /^[-+]?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)?)??$/, ur = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, mr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
758
+ let Re;
759
+ const pr = /^(?:(?: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])$/, hr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, yr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, gr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, vr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, _r = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, xt = "((\\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])))", xr = new RegExp(`^${xt}$`);
760
+ function bt(a) {
761
+ let e = "[0-5]\\d";
762
+ a.precision ? e = `${e}\\.\\d{${a.precision}}` : a.precision == null && (e = `${e}(\\.\\d+)?`);
763
+ const t = a.precision ? "+" : "?";
764
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
765
+ }
766
+ function br(a) {
767
+ return new RegExp(`^${bt(a)}$`);
768
+ }
769
+ function kr(a) {
770
+ let e = `${xt}T${bt(a)}`;
771
+ const t = [];
772
+ return t.push(a.local ? "Z?" : "Z"), a.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
773
+ }
774
+ function wr(a, e) {
775
+ return !!((e === "v4" || !e) && pr.test(a) || (e === "v6" || !e) && yr.test(a));
776
+ }
777
+ function Nr(a, e) {
778
+ if (!dr.test(a))
779
+ return !1;
780
+ try {
781
+ const [t] = a.split(".");
782
+ if (!t)
783
+ return !1;
784
+ const r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r));
785
+ return !(typeof s != "object" || s === null || "typ" in s && (s == null ? void 0 : s.typ) !== "JWT" || !s.alg || e && s.alg !== e);
786
+ } catch {
787
+ return !1;
788
+ }
789
+ }
790
+ function Cr(a, e) {
791
+ return !!((e === "v4" || !e) && hr.test(a) || (e === "v6" || !e) && gr.test(a));
792
+ }
793
+ class $ extends b {
794
+ _parse(e) {
795
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== m.string) {
796
+ const i = this._getOrReturnCtx(e);
797
+ return f(i, {
798
+ code: l.invalid_type,
799
+ expected: m.string,
800
+ received: i.parsedType
801
+ }), y;
802
+ }
803
+ const r = new A();
804
+ let s;
805
+ for (const i of this._def.checks)
806
+ if (i.kind === "min")
807
+ e.data.length < i.value && (s = this._getOrReturnCtx(e, s), f(s, {
808
+ code: l.too_small,
809
+ minimum: i.value,
810
+ type: "string",
811
+ inclusive: !0,
812
+ exact: !1,
813
+ message: i.message
814
+ }), r.dirty());
815
+ else if (i.kind === "max")
816
+ e.data.length > i.value && (s = this._getOrReturnCtx(e, s), f(s, {
817
+ code: l.too_big,
818
+ maximum: i.value,
819
+ type: "string",
820
+ inclusive: !0,
821
+ exact: !1,
822
+ message: i.message
823
+ }), r.dirty());
824
+ else if (i.kind === "length") {
825
+ const n = e.data.length > i.value, o = e.data.length < i.value;
826
+ (n || o) && (s = this._getOrReturnCtx(e, s), n ? f(s, {
827
+ code: l.too_big,
828
+ maximum: i.value,
829
+ type: "string",
830
+ inclusive: !0,
831
+ exact: !0,
832
+ message: i.message
833
+ }) : o && f(s, {
834
+ code: l.too_small,
835
+ minimum: i.value,
836
+ type: "string",
837
+ inclusive: !0,
838
+ exact: !0,
839
+ message: i.message
840
+ }), r.dirty());
841
+ } else if (i.kind === "email")
842
+ ur.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
843
+ validation: "email",
844
+ code: l.invalid_string,
845
+ message: i.message
846
+ }), r.dirty());
847
+ else if (i.kind === "emoji")
848
+ Re || (Re = new RegExp(mr, "u")), Re.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
849
+ validation: "emoji",
850
+ code: l.invalid_string,
851
+ message: i.message
852
+ }), r.dirty());
853
+ else if (i.kind === "uuid")
854
+ lr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
855
+ validation: "uuid",
856
+ code: l.invalid_string,
857
+ message: i.message
858
+ }), r.dirty());
859
+ else if (i.kind === "nanoid")
860
+ cr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
861
+ validation: "nanoid",
862
+ code: l.invalid_string,
863
+ message: i.message
864
+ }), r.dirty());
865
+ else if (i.kind === "cuid")
866
+ ir.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
867
+ validation: "cuid",
868
+ code: l.invalid_string,
869
+ message: i.message
870
+ }), r.dirty());
871
+ else if (i.kind === "cuid2")
872
+ nr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
873
+ validation: "cuid2",
874
+ code: l.invalid_string,
875
+ message: i.message
876
+ }), r.dirty());
877
+ else if (i.kind === "ulid")
878
+ or.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
879
+ validation: "ulid",
880
+ code: l.invalid_string,
881
+ message: i.message
882
+ }), r.dirty());
883
+ else if (i.kind === "url")
884
+ try {
885
+ new URL(e.data);
886
+ } catch {
887
+ s = this._getOrReturnCtx(e, s), f(s, {
888
+ validation: "url",
889
+ code: l.invalid_string,
890
+ message: i.message
891
+ }), r.dirty();
892
+ }
893
+ else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
894
+ validation: "regex",
895
+ code: l.invalid_string,
896
+ message: i.message
897
+ }), r.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (s = this._getOrReturnCtx(e, s), f(s, {
898
+ code: l.invalid_string,
899
+ validation: { includes: i.value, position: i.position },
900
+ message: i.message
901
+ }), r.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (s = this._getOrReturnCtx(e, s), f(s, {
902
+ code: l.invalid_string,
903
+ validation: { startsWith: i.value },
904
+ message: i.message
905
+ }), r.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (s = this._getOrReturnCtx(e, s), f(s, {
906
+ code: l.invalid_string,
907
+ validation: { endsWith: i.value },
908
+ message: i.message
909
+ }), r.dirty()) : i.kind === "datetime" ? kr(i).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
910
+ code: l.invalid_string,
911
+ validation: "datetime",
912
+ message: i.message
913
+ }), r.dirty()) : i.kind === "date" ? xr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
914
+ code: l.invalid_string,
915
+ validation: "date",
916
+ message: i.message
917
+ }), r.dirty()) : i.kind === "time" ? br(i).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
918
+ code: l.invalid_string,
919
+ validation: "time",
920
+ message: i.message
921
+ }), r.dirty()) : i.kind === "duration" ? fr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
922
+ validation: "duration",
923
+ code: l.invalid_string,
924
+ message: i.message
925
+ }), r.dirty()) : i.kind === "ip" ? wr(e.data, i.version) || (s = this._getOrReturnCtx(e, s), f(s, {
926
+ validation: "ip",
927
+ code: l.invalid_string,
928
+ message: i.message
929
+ }), r.dirty()) : i.kind === "jwt" ? Nr(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
930
+ validation: "jwt",
931
+ code: l.invalid_string,
932
+ message: i.message
933
+ }), r.dirty()) : i.kind === "cidr" ? Cr(e.data, i.version) || (s = this._getOrReturnCtx(e, s), f(s, {
934
+ validation: "cidr",
935
+ code: l.invalid_string,
936
+ message: i.message
937
+ }), r.dirty()) : i.kind === "base64" ? vr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
938
+ validation: "base64",
939
+ code: l.invalid_string,
940
+ message: i.message
941
+ }), r.dirty()) : i.kind === "base64url" ? _r.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
942
+ validation: "base64url",
943
+ code: l.invalid_string,
944
+ message: i.message
945
+ }), r.dirty()) : k.assertNever(i);
946
+ return { status: r.value, value: e.data };
947
+ }
948
+ _regex(e, t, r) {
949
+ return this.refinement((s) => e.test(s), {
950
+ validation: t,
951
+ code: l.invalid_string,
952
+ ...p.errToObj(r)
953
+ });
954
+ }
955
+ _addCheck(e) {
956
+ return new $({
957
+ ...this._def,
958
+ checks: [...this._def.checks, e]
959
+ });
960
+ }
961
+ email(e) {
962
+ return this._addCheck({ kind: "email", ...p.errToObj(e) });
963
+ }
964
+ url(e) {
965
+ return this._addCheck({ kind: "url", ...p.errToObj(e) });
966
+ }
967
+ emoji(e) {
968
+ return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
969
+ }
970
+ uuid(e) {
971
+ return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
972
+ }
973
+ nanoid(e) {
974
+ return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
975
+ }
976
+ cuid(e) {
977
+ return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
978
+ }
979
+ cuid2(e) {
980
+ return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
981
+ }
982
+ ulid(e) {
983
+ return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
984
+ }
985
+ base64(e) {
986
+ return this._addCheck({ kind: "base64", ...p.errToObj(e) });
987
+ }
988
+ base64url(e) {
989
+ return this._addCheck({
990
+ kind: "base64url",
991
+ ...p.errToObj(e)
992
+ });
993
+ }
994
+ jwt(e) {
995
+ return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
996
+ }
997
+ ip(e) {
998
+ return this._addCheck({ kind: "ip", ...p.errToObj(e) });
999
+ }
1000
+ cidr(e) {
1001
+ return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
1002
+ }
1003
+ datetime(e) {
1004
+ return typeof e == "string" ? this._addCheck({
1005
+ kind: "datetime",
1006
+ precision: null,
1007
+ offset: !1,
1008
+ local: !1,
1009
+ message: e
1010
+ }) : this._addCheck({
1011
+ kind: "datetime",
1012
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
1013
+ offset: (e == null ? void 0 : e.offset) ?? !1,
1014
+ local: (e == null ? void 0 : e.local) ?? !1,
1015
+ ...p.errToObj(e == null ? void 0 : e.message)
1016
+ });
1017
+ }
1018
+ date(e) {
1019
+ return this._addCheck({ kind: "date", message: e });
1020
+ }
1021
+ time(e) {
1022
+ return typeof e == "string" ? this._addCheck({
1023
+ kind: "time",
1024
+ precision: null,
1025
+ message: e
1026
+ }) : this._addCheck({
1027
+ kind: "time",
1028
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
1029
+ ...p.errToObj(e == null ? void 0 : e.message)
1030
+ });
1031
+ }
1032
+ duration(e) {
1033
+ return this._addCheck({ kind: "duration", ...p.errToObj(e) });
1034
+ }
1035
+ regex(e, t) {
1036
+ return this._addCheck({
1037
+ kind: "regex",
1038
+ regex: e,
1039
+ ...p.errToObj(t)
1040
+ });
1041
+ }
1042
+ includes(e, t) {
1043
+ return this._addCheck({
1044
+ kind: "includes",
1045
+ value: e,
1046
+ position: t == null ? void 0 : t.position,
1047
+ ...p.errToObj(t == null ? void 0 : t.message)
1048
+ });
1049
+ }
1050
+ startsWith(e, t) {
1051
+ return this._addCheck({
1052
+ kind: "startsWith",
1053
+ value: e,
1054
+ ...p.errToObj(t)
1055
+ });
1056
+ }
1057
+ endsWith(e, t) {
1058
+ return this._addCheck({
1059
+ kind: "endsWith",
1060
+ value: e,
1061
+ ...p.errToObj(t)
1062
+ });
1063
+ }
1064
+ min(e, t) {
1065
+ return this._addCheck({
1066
+ kind: "min",
1067
+ value: e,
1068
+ ...p.errToObj(t)
1069
+ });
1070
+ }
1071
+ max(e, t) {
1072
+ return this._addCheck({
1073
+ kind: "max",
1074
+ value: e,
1075
+ ...p.errToObj(t)
1076
+ });
1077
+ }
1078
+ length(e, t) {
1079
+ return this._addCheck({
1080
+ kind: "length",
1081
+ value: e,
1082
+ ...p.errToObj(t)
1083
+ });
1084
+ }
1085
+ /**
1086
+ * Equivalent to `.min(1)`
1087
+ */
1088
+ nonempty(e) {
1089
+ return this.min(1, p.errToObj(e));
1090
+ }
1091
+ trim() {
1092
+ return new $({
1093
+ ...this._def,
1094
+ checks: [...this._def.checks, { kind: "trim" }]
1095
+ });
1096
+ }
1097
+ toLowerCase() {
1098
+ return new $({
1099
+ ...this._def,
1100
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1101
+ });
1102
+ }
1103
+ toUpperCase() {
1104
+ return new $({
1105
+ ...this._def,
1106
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1107
+ });
1108
+ }
1109
+ get isDatetime() {
1110
+ return !!this._def.checks.find((e) => e.kind === "datetime");
1111
+ }
1112
+ get isDate() {
1113
+ return !!this._def.checks.find((e) => e.kind === "date");
1114
+ }
1115
+ get isTime() {
1116
+ return !!this._def.checks.find((e) => e.kind === "time");
1117
+ }
1118
+ get isDuration() {
1119
+ return !!this._def.checks.find((e) => e.kind === "duration");
1120
+ }
1121
+ get isEmail() {
1122
+ return !!this._def.checks.find((e) => e.kind === "email");
1123
+ }
1124
+ get isURL() {
1125
+ return !!this._def.checks.find((e) => e.kind === "url");
1126
+ }
1127
+ get isEmoji() {
1128
+ return !!this._def.checks.find((e) => e.kind === "emoji");
1129
+ }
1130
+ get isUUID() {
1131
+ return !!this._def.checks.find((e) => e.kind === "uuid");
1132
+ }
1133
+ get isNANOID() {
1134
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
1135
+ }
1136
+ get isCUID() {
1137
+ return !!this._def.checks.find((e) => e.kind === "cuid");
1138
+ }
1139
+ get isCUID2() {
1140
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
1141
+ }
1142
+ get isULID() {
1143
+ return !!this._def.checks.find((e) => e.kind === "ulid");
1144
+ }
1145
+ get isIP() {
1146
+ return !!this._def.checks.find((e) => e.kind === "ip");
1147
+ }
1148
+ get isCIDR() {
1149
+ return !!this._def.checks.find((e) => e.kind === "cidr");
1150
+ }
1151
+ get isBase64() {
1152
+ return !!this._def.checks.find((e) => e.kind === "base64");
1153
+ }
1154
+ get isBase64url() {
1155
+ return !!this._def.checks.find((e) => e.kind === "base64url");
1156
+ }
1157
+ get minLength() {
1158
+ let e = null;
1159
+ for (const t of this._def.checks)
1160
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1161
+ return e;
1162
+ }
1163
+ get maxLength() {
1164
+ let e = null;
1165
+ for (const t of this._def.checks)
1166
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1167
+ return e;
1168
+ }
1169
+ }
1170
+ $.create = (a) => new $({
1171
+ checks: [],
1172
+ typeName: g.ZodString,
1173
+ coerce: (a == null ? void 0 : a.coerce) ?? !1,
1174
+ ..._(a)
1175
+ });
1176
+ function Sr(a, e) {
1177
+ const t = (a.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, i = Number.parseInt(a.toFixed(s).replace(".", "")), n = Number.parseInt(e.toFixed(s).replace(".", ""));
1178
+ return i % n / 10 ** s;
1179
+ }
1180
+ class ae extends b {
1181
+ constructor() {
1182
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1183
+ }
1184
+ _parse(e) {
1185
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== m.number) {
1186
+ const i = this._getOrReturnCtx(e);
1187
+ return f(i, {
1188
+ code: l.invalid_type,
1189
+ expected: m.number,
1190
+ received: i.parsedType
1191
+ }), y;
1192
+ }
1193
+ let r;
1194
+ const s = new A();
1195
+ for (const i of this._def.checks)
1196
+ i.kind === "int" ? k.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
1197
+ code: l.invalid_type,
1198
+ expected: "integer",
1199
+ received: "float",
1200
+ message: i.message
1201
+ }), s.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1202
+ code: l.too_small,
1203
+ minimum: i.value,
1204
+ type: "number",
1205
+ inclusive: i.inclusive,
1206
+ exact: !1,
1207
+ message: i.message
1208
+ }), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1209
+ code: l.too_big,
1210
+ maximum: i.value,
1211
+ type: "number",
1212
+ inclusive: i.inclusive,
1213
+ exact: !1,
1214
+ message: i.message
1215
+ }), s.dirty()) : i.kind === "multipleOf" ? Sr(e.data, i.value) !== 0 && (r = this._getOrReturnCtx(e, r), f(r, {
1216
+ code: l.not_multiple_of,
1217
+ multipleOf: i.value,
1218
+ message: i.message
1219
+ }), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
1220
+ code: l.not_finite,
1221
+ message: i.message
1222
+ }), s.dirty()) : k.assertNever(i);
1223
+ return { status: s.value, value: e.data };
1224
+ }
1225
+ gte(e, t) {
1226
+ return this.setLimit("min", e, !0, p.toString(t));
1227
+ }
1228
+ gt(e, t) {
1229
+ return this.setLimit("min", e, !1, p.toString(t));
1230
+ }
1231
+ lte(e, t) {
1232
+ return this.setLimit("max", e, !0, p.toString(t));
1233
+ }
1234
+ lt(e, t) {
1235
+ return this.setLimit("max", e, !1, p.toString(t));
1236
+ }
1237
+ setLimit(e, t, r, s) {
1238
+ return new ae({
1239
+ ...this._def,
1240
+ checks: [
1241
+ ...this._def.checks,
1242
+ {
1243
+ kind: e,
1244
+ value: t,
1245
+ inclusive: r,
1246
+ message: p.toString(s)
1247
+ }
1248
+ ]
1249
+ });
1250
+ }
1251
+ _addCheck(e) {
1252
+ return new ae({
1253
+ ...this._def,
1254
+ checks: [...this._def.checks, e]
1255
+ });
1256
+ }
1257
+ int(e) {
1258
+ return this._addCheck({
1259
+ kind: "int",
1260
+ message: p.toString(e)
1261
+ });
1262
+ }
1263
+ positive(e) {
1264
+ return this._addCheck({
1265
+ kind: "min",
1266
+ value: 0,
1267
+ inclusive: !1,
1268
+ message: p.toString(e)
1269
+ });
1270
+ }
1271
+ negative(e) {
1272
+ return this._addCheck({
1273
+ kind: "max",
1274
+ value: 0,
1275
+ inclusive: !1,
1276
+ message: p.toString(e)
1277
+ });
1278
+ }
1279
+ nonpositive(e) {
1280
+ return this._addCheck({
1281
+ kind: "max",
1282
+ value: 0,
1283
+ inclusive: !0,
1284
+ message: p.toString(e)
1285
+ });
1286
+ }
1287
+ nonnegative(e) {
1288
+ return this._addCheck({
1289
+ kind: "min",
1290
+ value: 0,
1291
+ inclusive: !0,
1292
+ message: p.toString(e)
1293
+ });
1294
+ }
1295
+ multipleOf(e, t) {
1296
+ return this._addCheck({
1297
+ kind: "multipleOf",
1298
+ value: e,
1299
+ message: p.toString(t)
1300
+ });
1301
+ }
1302
+ finite(e) {
1303
+ return this._addCheck({
1304
+ kind: "finite",
1305
+ message: p.toString(e)
1306
+ });
1307
+ }
1308
+ safe(e) {
1309
+ return this._addCheck({
1310
+ kind: "min",
1311
+ inclusive: !0,
1312
+ value: Number.MIN_SAFE_INTEGER,
1313
+ message: p.toString(e)
1314
+ })._addCheck({
1315
+ kind: "max",
1316
+ inclusive: !0,
1317
+ value: Number.MAX_SAFE_INTEGER,
1318
+ message: p.toString(e)
1319
+ });
1320
+ }
1321
+ get minValue() {
1322
+ let e = null;
1323
+ for (const t of this._def.checks)
1324
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1325
+ return e;
1326
+ }
1327
+ get maxValue() {
1328
+ let e = null;
1329
+ for (const t of this._def.checks)
1330
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1331
+ return e;
1332
+ }
1333
+ get isInt() {
1334
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && k.isInteger(e.value));
1335
+ }
1336
+ get isFinite() {
1337
+ let e = null, t = null;
1338
+ for (const r of this._def.checks) {
1339
+ if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
1340
+ return !0;
1341
+ r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
1342
+ }
1343
+ return Number.isFinite(t) && Number.isFinite(e);
1344
+ }
1345
+ }
1346
+ ae.create = (a) => new ae({
1347
+ checks: [],
1348
+ typeName: g.ZodNumber,
1349
+ coerce: (a == null ? void 0 : a.coerce) || !1,
1350
+ ..._(a)
1351
+ });
1352
+ class ce extends b {
1353
+ constructor() {
1354
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1355
+ }
1356
+ _parse(e) {
1357
+ if (this._def.coerce)
1358
+ try {
1359
+ e.data = BigInt(e.data);
1360
+ } catch {
1361
+ return this._getInvalidInput(e);
1362
+ }
1363
+ if (this._getType(e) !== m.bigint)
1364
+ return this._getInvalidInput(e);
1365
+ let r;
1366
+ const s = new A();
1367
+ for (const i of this._def.checks)
1368
+ i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1369
+ code: l.too_small,
1370
+ type: "bigint",
1371
+ minimum: i.value,
1372
+ inclusive: i.inclusive,
1373
+ message: i.message
1374
+ }), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1375
+ code: l.too_big,
1376
+ type: "bigint",
1377
+ maximum: i.value,
1378
+ inclusive: i.inclusive,
1379
+ message: i.message
1380
+ }), s.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), f(r, {
1381
+ code: l.not_multiple_of,
1382
+ multipleOf: i.value,
1383
+ message: i.message
1384
+ }), s.dirty()) : k.assertNever(i);
1385
+ return { status: s.value, value: e.data };
1386
+ }
1387
+ _getInvalidInput(e) {
1388
+ const t = this._getOrReturnCtx(e);
1389
+ return f(t, {
1390
+ code: l.invalid_type,
1391
+ expected: m.bigint,
1392
+ received: t.parsedType
1393
+ }), y;
1394
+ }
1395
+ gte(e, t) {
1396
+ return this.setLimit("min", e, !0, p.toString(t));
1397
+ }
1398
+ gt(e, t) {
1399
+ return this.setLimit("min", e, !1, p.toString(t));
1400
+ }
1401
+ lte(e, t) {
1402
+ return this.setLimit("max", e, !0, p.toString(t));
1403
+ }
1404
+ lt(e, t) {
1405
+ return this.setLimit("max", e, !1, p.toString(t));
1406
+ }
1407
+ setLimit(e, t, r, s) {
1408
+ return new ce({
1409
+ ...this._def,
1410
+ checks: [
1411
+ ...this._def.checks,
1412
+ {
1413
+ kind: e,
1414
+ value: t,
1415
+ inclusive: r,
1416
+ message: p.toString(s)
1417
+ }
1418
+ ]
1419
+ });
1420
+ }
1421
+ _addCheck(e) {
1422
+ return new ce({
1423
+ ...this._def,
1424
+ checks: [...this._def.checks, e]
1425
+ });
1426
+ }
1427
+ positive(e) {
1428
+ return this._addCheck({
1429
+ kind: "min",
1430
+ value: BigInt(0),
1431
+ inclusive: !1,
1432
+ message: p.toString(e)
1433
+ });
1434
+ }
1435
+ negative(e) {
1436
+ return this._addCheck({
1437
+ kind: "max",
1438
+ value: BigInt(0),
1439
+ inclusive: !1,
1440
+ message: p.toString(e)
1441
+ });
1442
+ }
1443
+ nonpositive(e) {
1444
+ return this._addCheck({
1445
+ kind: "max",
1446
+ value: BigInt(0),
1447
+ inclusive: !0,
1448
+ message: p.toString(e)
1449
+ });
1450
+ }
1451
+ nonnegative(e) {
1452
+ return this._addCheck({
1453
+ kind: "min",
1454
+ value: BigInt(0),
1455
+ inclusive: !0,
1456
+ message: p.toString(e)
1457
+ });
1458
+ }
1459
+ multipleOf(e, t) {
1460
+ return this._addCheck({
1461
+ kind: "multipleOf",
1462
+ value: e,
1463
+ message: p.toString(t)
1464
+ });
1465
+ }
1466
+ get minValue() {
1467
+ let e = null;
1468
+ for (const t of this._def.checks)
1469
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1470
+ return e;
1471
+ }
1472
+ get maxValue() {
1473
+ let e = null;
1474
+ for (const t of this._def.checks)
1475
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1476
+ return e;
1477
+ }
1478
+ }
1479
+ ce.create = (a) => new ce({
1480
+ checks: [],
1481
+ typeName: g.ZodBigInt,
1482
+ coerce: (a == null ? void 0 : a.coerce) ?? !1,
1483
+ ..._(a)
1484
+ });
1485
+ class Ze extends b {
1486
+ _parse(e) {
1487
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
1488
+ const r = this._getOrReturnCtx(e);
1489
+ return f(r, {
1490
+ code: l.invalid_type,
1491
+ expected: m.boolean,
1492
+ received: r.parsedType
1493
+ }), y;
1494
+ }
1495
+ return E(e.data);
1496
+ }
1497
+ }
1498
+ Ze.create = (a) => new Ze({
1499
+ typeName: g.ZodBoolean,
1500
+ coerce: (a == null ? void 0 : a.coerce) || !1,
1501
+ ..._(a)
1502
+ });
1503
+ class ve extends b {
1504
+ _parse(e) {
1505
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== m.date) {
1506
+ const i = this._getOrReturnCtx(e);
1507
+ return f(i, {
1508
+ code: l.invalid_type,
1509
+ expected: m.date,
1510
+ received: i.parsedType
1511
+ }), y;
1512
+ }
1513
+ if (Number.isNaN(e.data.getTime())) {
1514
+ const i = this._getOrReturnCtx(e);
1515
+ return f(i, {
1516
+ code: l.invalid_date
1517
+ }), y;
1518
+ }
1519
+ const r = new A();
1520
+ let s;
1521
+ for (const i of this._def.checks)
1522
+ i.kind === "min" ? e.data.getTime() < i.value && (s = this._getOrReturnCtx(e, s), f(s, {
1523
+ code: l.too_small,
1524
+ message: i.message,
1525
+ inclusive: !0,
1526
+ exact: !1,
1527
+ minimum: i.value,
1528
+ type: "date"
1529
+ }), r.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (s = this._getOrReturnCtx(e, s), f(s, {
1530
+ code: l.too_big,
1531
+ message: i.message,
1532
+ inclusive: !0,
1533
+ exact: !1,
1534
+ maximum: i.value,
1535
+ type: "date"
1536
+ }), r.dirty()) : k.assertNever(i);
1537
+ return {
1538
+ status: r.value,
1539
+ value: new Date(e.data.getTime())
1540
+ };
1541
+ }
1542
+ _addCheck(e) {
1543
+ return new ve({
1544
+ ...this._def,
1545
+ checks: [...this._def.checks, e]
1546
+ });
1547
+ }
1548
+ min(e, t) {
1549
+ return this._addCheck({
1550
+ kind: "min",
1551
+ value: e.getTime(),
1552
+ message: p.toString(t)
1553
+ });
1554
+ }
1555
+ max(e, t) {
1556
+ return this._addCheck({
1557
+ kind: "max",
1558
+ value: e.getTime(),
1559
+ message: p.toString(t)
1560
+ });
1561
+ }
1562
+ get minDate() {
1563
+ let e = null;
1564
+ for (const t of this._def.checks)
1565
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1566
+ return e != null ? new Date(e) : null;
1567
+ }
1568
+ get maxDate() {
1569
+ let e = null;
1570
+ for (const t of this._def.checks)
1571
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1572
+ return e != null ? new Date(e) : null;
1573
+ }
1574
+ }
1575
+ ve.create = (a) => new ve({
1576
+ checks: [],
1577
+ coerce: (a == null ? void 0 : a.coerce) || !1,
1578
+ typeName: g.ZodDate,
1579
+ ..._(a)
1580
+ });
1581
+ class ct extends b {
1582
+ _parse(e) {
1583
+ if (this._getType(e) !== m.symbol) {
1584
+ const r = this._getOrReturnCtx(e);
1585
+ return f(r, {
1586
+ code: l.invalid_type,
1587
+ expected: m.symbol,
1588
+ received: r.parsedType
1589
+ }), y;
1590
+ }
1591
+ return E(e.data);
1592
+ }
1593
+ }
1594
+ ct.create = (a) => new ct({
1595
+ typeName: g.ZodSymbol,
1596
+ ..._(a)
1597
+ });
1598
+ class Fe extends b {
1599
+ _parse(e) {
1600
+ if (this._getType(e) !== m.undefined) {
1601
+ const r = this._getOrReturnCtx(e);
1602
+ return f(r, {
1603
+ code: l.invalid_type,
1604
+ expected: m.undefined,
1605
+ received: r.parsedType
1606
+ }), y;
1607
+ }
1608
+ return E(e.data);
1609
+ }
1610
+ }
1611
+ Fe.create = (a) => new Fe({
1612
+ typeName: g.ZodUndefined,
1613
+ ..._(a)
1614
+ });
1615
+ class _e extends b {
1616
+ _parse(e) {
1617
+ if (this._getType(e) !== m.null) {
1618
+ const r = this._getOrReturnCtx(e);
1619
+ return f(r, {
1620
+ code: l.invalid_type,
1621
+ expected: m.null,
1622
+ received: r.parsedType
1623
+ }), y;
1624
+ }
1625
+ return E(e.data);
1626
+ }
1627
+ }
1628
+ _e.create = (a) => new _e({
1629
+ typeName: g.ZodNull,
1630
+ ..._(a)
1631
+ });
1632
+ class dt extends b {
1633
+ constructor() {
1634
+ super(...arguments), this._any = !0;
1635
+ }
1636
+ _parse(e) {
1637
+ return E(e.data);
1638
+ }
1639
+ }
1640
+ dt.create = (a) => new dt({
1641
+ typeName: g.ZodAny,
1642
+ ..._(a)
1643
+ });
1644
+ class Pe extends b {
1645
+ constructor() {
1646
+ super(...arguments), this._unknown = !0;
1647
+ }
1648
+ _parse(e) {
1649
+ return E(e.data);
1650
+ }
1651
+ }
1652
+ Pe.create = (a) => new Pe({
1653
+ typeName: g.ZodUnknown,
1654
+ ..._(a)
1655
+ });
1656
+ class z extends b {
1657
+ _parse(e) {
1658
+ const t = this._getOrReturnCtx(e);
1659
+ return f(t, {
1660
+ code: l.invalid_type,
1661
+ expected: m.never,
1662
+ received: t.parsedType
1663
+ }), y;
1664
+ }
1665
+ }
1666
+ z.create = (a) => new z({
1667
+ typeName: g.ZodNever,
1668
+ ..._(a)
1669
+ });
1670
+ class ft extends b {
1671
+ _parse(e) {
1672
+ if (this._getType(e) !== m.undefined) {
1673
+ const r = this._getOrReturnCtx(e);
1674
+ return f(r, {
1675
+ code: l.invalid_type,
1676
+ expected: m.void,
1677
+ received: r.parsedType
1678
+ }), y;
1679
+ }
1680
+ return E(e.data);
1681
+ }
1682
+ }
1683
+ ft.create = (a) => new ft({
1684
+ typeName: g.ZodVoid,
1685
+ ..._(a)
1686
+ });
1687
+ class F extends b {
1688
+ _parse(e) {
1689
+ const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
1690
+ if (t.parsedType !== m.array)
1691
+ return f(t, {
1692
+ code: l.invalid_type,
1693
+ expected: m.array,
1694
+ received: t.parsedType
1695
+ }), y;
1696
+ if (s.exactLength !== null) {
1697
+ const n = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1698
+ (n || o) && (f(t, {
1699
+ code: n ? l.too_big : l.too_small,
1700
+ minimum: o ? s.exactLength.value : void 0,
1701
+ maximum: n ? s.exactLength.value : void 0,
1702
+ type: "array",
1703
+ inclusive: !0,
1704
+ exact: !0,
1705
+ message: s.exactLength.message
1706
+ }), r.dirty());
1707
+ }
1708
+ if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
1709
+ code: l.too_small,
1710
+ minimum: s.minLength.value,
1711
+ type: "array",
1712
+ inclusive: !0,
1713
+ exact: !1,
1714
+ message: s.minLength.message
1715
+ }), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
1716
+ code: l.too_big,
1717
+ maximum: s.maxLength.value,
1718
+ type: "array",
1719
+ inclusive: !0,
1720
+ exact: !1,
1721
+ message: s.maxLength.message
1722
+ }), r.dirty()), t.common.async)
1723
+ return Promise.all([...t.data].map((n, o) => s.type._parseAsync(new P(t, n, t.path, o)))).then((n) => A.mergeArray(r, n));
1724
+ const i = [...t.data].map((n, o) => s.type._parseSync(new P(t, n, t.path, o)));
1725
+ return A.mergeArray(r, i);
1726
+ }
1727
+ get element() {
1728
+ return this._def.type;
1729
+ }
1730
+ min(e, t) {
1731
+ return new F({
1732
+ ...this._def,
1733
+ minLength: { value: e, message: p.toString(t) }
1734
+ });
1735
+ }
1736
+ max(e, t) {
1737
+ return new F({
1738
+ ...this._def,
1739
+ maxLength: { value: e, message: p.toString(t) }
1740
+ });
1741
+ }
1742
+ length(e, t) {
1743
+ return new F({
1744
+ ...this._def,
1745
+ exactLength: { value: e, message: p.toString(t) }
1746
+ });
1747
+ }
1748
+ nonempty(e) {
1749
+ return this.min(1, e);
1750
+ }
1751
+ }
1752
+ F.create = (a, e) => new F({
1753
+ type: a,
1754
+ minLength: null,
1755
+ maxLength: null,
1756
+ exactLength: null,
1757
+ typeName: g.ZodArray,
1758
+ ..._(e)
1759
+ });
1760
+ function te(a) {
1761
+ if (a instanceof T) {
1762
+ const e = {};
1763
+ for (const t in a.shape) {
1764
+ const r = a.shape[t];
1765
+ e[t] = B.create(te(r));
1766
+ }
1767
+ return new T({
1768
+ ...a._def,
1769
+ shape: () => e
1770
+ });
1771
+ } else return a instanceof F ? new F({
1772
+ ...a._def,
1773
+ type: te(a.element)
1774
+ }) : a instanceof B ? B.create(te(a.unwrap())) : a instanceof G ? G.create(te(a.unwrap())) : a instanceof K ? K.create(a.items.map((e) => te(e))) : a;
1775
+ }
1776
+ class T extends b {
1777
+ constructor() {
1778
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1779
+ }
1780
+ _getCached() {
1781
+ if (this._cached !== null)
1782
+ return this._cached;
1783
+ const e = this._def.shape(), t = k.objectKeys(e);
1784
+ return this._cached = { shape: e, keys: t }, this._cached;
1785
+ }
1786
+ _parse(e) {
1787
+ if (this._getType(e) !== m.object) {
1788
+ const h = this._getOrReturnCtx(e);
1789
+ return f(h, {
1790
+ code: l.invalid_type,
1791
+ expected: m.object,
1792
+ received: h.parsedType
1793
+ }), y;
1794
+ }
1795
+ const { status: r, ctx: s } = this._processInputParams(e), { shape: i, keys: n } = this._getCached(), o = [];
1796
+ if (!(this._def.catchall instanceof z && this._def.unknownKeys === "strip"))
1797
+ for (const h in s.data)
1798
+ n.includes(h) || o.push(h);
1799
+ const d = [];
1800
+ for (const h of n) {
1801
+ const x = i[h], M = s.data[h];
1802
+ d.push({
1803
+ key: { status: "valid", value: h },
1804
+ value: x._parse(new P(s, M, s.path, h)),
1805
+ alwaysSet: h in s.data
1806
+ });
1807
+ }
1808
+ if (this._def.catchall instanceof z) {
1809
+ const h = this._def.unknownKeys;
1810
+ if (h === "passthrough")
1811
+ for (const x of o)
1812
+ d.push({
1813
+ key: { status: "valid", value: x },
1814
+ value: { status: "valid", value: s.data[x] }
1815
+ });
1816
+ else if (h === "strict")
1817
+ o.length > 0 && (f(s, {
1818
+ code: l.unrecognized_keys,
1819
+ keys: o
1820
+ }), r.dirty());
1821
+ else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1822
+ } else {
1823
+ const h = this._def.catchall;
1824
+ for (const x of o) {
1825
+ const M = s.data[x];
1826
+ d.push({
1827
+ key: { status: "valid", value: x },
1828
+ value: h._parse(
1829
+ new P(s, M, s.path, x)
1830
+ //, ctx.child(key), value, getParsedType(value)
1831
+ ),
1832
+ alwaysSet: x in s.data
1833
+ });
1834
+ }
1835
+ }
1836
+ return s.common.async ? Promise.resolve().then(async () => {
1837
+ const h = [];
1838
+ for (const x of d) {
1839
+ const M = await x.key, ie = await x.value;
1840
+ h.push({
1841
+ key: M,
1842
+ value: ie,
1843
+ alwaysSet: x.alwaysSet
1844
+ });
1845
+ }
1846
+ return h;
1847
+ }).then((h) => A.mergeObjectSync(r, h)) : A.mergeObjectSync(r, d);
1848
+ }
1849
+ get shape() {
1850
+ return this._def.shape();
1851
+ }
1852
+ strict(e) {
1853
+ return p.errToObj, new T({
1854
+ ...this._def,
1855
+ unknownKeys: "strict",
1856
+ ...e !== void 0 ? {
1857
+ errorMap: (t, r) => {
1858
+ var i, n;
1859
+ const s = ((n = (i = this._def).errorMap) == null ? void 0 : n.call(i, t, r).message) ?? r.defaultError;
1860
+ return t.code === "unrecognized_keys" ? {
1861
+ message: p.errToObj(e).message ?? s
1862
+ } : {
1863
+ message: s
1864
+ };
1865
+ }
1866
+ } : {}
1867
+ });
1868
+ }
1869
+ strip() {
1870
+ return new T({
1871
+ ...this._def,
1872
+ unknownKeys: "strip"
1873
+ });
1874
+ }
1875
+ passthrough() {
1876
+ return new T({
1877
+ ...this._def,
1878
+ unknownKeys: "passthrough"
1879
+ });
1880
+ }
1881
+ // const AugmentFactory =
1882
+ // <Def extends ZodObjectDef>(def: Def) =>
1883
+ // <Augmentation extends ZodRawShape>(
1884
+ // augmentation: Augmentation
1885
+ // ): ZodObject<
1886
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1887
+ // Def["unknownKeys"],
1888
+ // Def["catchall"]
1889
+ // > => {
1890
+ // return new ZodObject({
1891
+ // ...def,
1892
+ // shape: () => ({
1893
+ // ...def.shape(),
1894
+ // ...augmentation,
1895
+ // }),
1896
+ // }) as any;
1897
+ // };
1898
+ extend(e) {
1899
+ return new T({
1900
+ ...this._def,
1901
+ shape: () => ({
1902
+ ...this._def.shape(),
1903
+ ...e
1904
+ })
1905
+ });
1906
+ }
1907
+ /**
1908
+ * Prior to zod@1.0.12 there was a bug in the
1909
+ * inferred type of merged objects. Please
1910
+ * upgrade if you are experiencing issues.
1911
+ */
1912
+ merge(e) {
1913
+ return new T({
1914
+ unknownKeys: e._def.unknownKeys,
1915
+ catchall: e._def.catchall,
1916
+ shape: () => ({
1917
+ ...this._def.shape(),
1918
+ ...e._def.shape()
1919
+ }),
1920
+ typeName: g.ZodObject
1921
+ });
1922
+ }
1923
+ // merge<
1924
+ // Incoming extends AnyZodObject,
1925
+ // Augmentation extends Incoming["shape"],
1926
+ // NewOutput extends {
1927
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1928
+ // ? Augmentation[k]["_output"]
1929
+ // : k extends keyof Output
1930
+ // ? Output[k]
1931
+ // : never;
1932
+ // },
1933
+ // NewInput extends {
1934
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1935
+ // ? Augmentation[k]["_input"]
1936
+ // : k extends keyof Input
1937
+ // ? Input[k]
1938
+ // : never;
1939
+ // }
1940
+ // >(
1941
+ // merging: Incoming
1942
+ // ): ZodObject<
1943
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1944
+ // Incoming["_def"]["unknownKeys"],
1945
+ // Incoming["_def"]["catchall"],
1946
+ // NewOutput,
1947
+ // NewInput
1948
+ // > {
1949
+ // const merged: any = new ZodObject({
1950
+ // unknownKeys: merging._def.unknownKeys,
1951
+ // catchall: merging._def.catchall,
1952
+ // shape: () =>
1953
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1954
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1955
+ // }) as any;
1956
+ // return merged;
1957
+ // }
1958
+ setKey(e, t) {
1959
+ return this.augment({ [e]: t });
1960
+ }
1961
+ // merge<Incoming extends AnyZodObject>(
1962
+ // merging: Incoming
1963
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1964
+ // ZodObject<
1965
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1966
+ // Incoming["_def"]["unknownKeys"],
1967
+ // Incoming["_def"]["catchall"]
1968
+ // > {
1969
+ // // const mergedShape = objectUtil.mergeShapes(
1970
+ // // this._def.shape(),
1971
+ // // merging._def.shape()
1972
+ // // );
1973
+ // const merged: any = new ZodObject({
1974
+ // unknownKeys: merging._def.unknownKeys,
1975
+ // catchall: merging._def.catchall,
1976
+ // shape: () =>
1977
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1978
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1979
+ // }) as any;
1980
+ // return merged;
1981
+ // }
1982
+ catchall(e) {
1983
+ return new T({
1984
+ ...this._def,
1985
+ catchall: e
1986
+ });
1987
+ }
1988
+ pick(e) {
1989
+ const t = {};
1990
+ for (const r of k.objectKeys(e))
1991
+ e[r] && this.shape[r] && (t[r] = this.shape[r]);
1992
+ return new T({
1993
+ ...this._def,
1994
+ shape: () => t
1995
+ });
1996
+ }
1997
+ omit(e) {
1998
+ const t = {};
1999
+ for (const r of k.objectKeys(this.shape))
2000
+ e[r] || (t[r] = this.shape[r]);
2001
+ return new T({
2002
+ ...this._def,
2003
+ shape: () => t
2004
+ });
2005
+ }
2006
+ /**
2007
+ * @deprecated
2008
+ */
2009
+ deepPartial() {
2010
+ return te(this);
2011
+ }
2012
+ partial(e) {
2013
+ const t = {};
2014
+ for (const r of k.objectKeys(this.shape)) {
2015
+ const s = this.shape[r];
2016
+ e && !e[r] ? t[r] = s : t[r] = s.optional();
2017
+ }
2018
+ return new T({
2019
+ ...this._def,
2020
+ shape: () => t
2021
+ });
2022
+ }
2023
+ required(e) {
2024
+ const t = {};
2025
+ for (const r of k.objectKeys(this.shape))
2026
+ if (e && !e[r])
2027
+ t[r] = this.shape[r];
2028
+ else {
2029
+ let i = this.shape[r];
2030
+ for (; i instanceof B; )
2031
+ i = i._def.innerType;
2032
+ t[r] = i;
2033
+ }
2034
+ return new T({
2035
+ ...this._def,
2036
+ shape: () => t
2037
+ });
2038
+ }
2039
+ keyof() {
2040
+ return kt(k.objectKeys(this.shape));
2041
+ }
2042
+ }
2043
+ T.create = (a, e) => new T({
2044
+ shape: () => a,
2045
+ unknownKeys: "strip",
2046
+ catchall: z.create(),
2047
+ typeName: g.ZodObject,
2048
+ ..._(e)
2049
+ });
2050
+ T.strictCreate = (a, e) => new T({
2051
+ shape: () => a,
2052
+ unknownKeys: "strict",
2053
+ catchall: z.create(),
2054
+ typeName: g.ZodObject,
2055
+ ..._(e)
2056
+ });
2057
+ T.lazycreate = (a, e) => new T({
2058
+ shape: a,
2059
+ unknownKeys: "strip",
2060
+ catchall: z.create(),
2061
+ typeName: g.ZodObject,
2062
+ ..._(e)
2063
+ });
2064
+ class xe extends b {
2065
+ _parse(e) {
2066
+ const { ctx: t } = this._processInputParams(e), r = this._def.options;
2067
+ function s(i) {
2068
+ for (const o of i)
2069
+ if (o.result.status === "valid")
2070
+ return o.result;
2071
+ for (const o of i)
2072
+ if (o.result.status === "dirty")
2073
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
2074
+ const n = i.map((o) => new U(o.ctx.common.issues));
2075
+ return f(t, {
2076
+ code: l.invalid_union,
2077
+ unionErrors: n
2078
+ }), y;
2079
+ }
2080
+ if (t.common.async)
2081
+ return Promise.all(r.map(async (i) => {
2082
+ const n = {
2083
+ ...t,
2084
+ common: {
2085
+ ...t.common,
2086
+ issues: []
2087
+ },
2088
+ parent: null
2089
+ };
2090
+ return {
2091
+ result: await i._parseAsync({
2092
+ data: t.data,
2093
+ path: t.path,
2094
+ parent: n
2095
+ }),
2096
+ ctx: n
2097
+ };
2098
+ })).then(s);
2099
+ {
2100
+ let i;
2101
+ const n = [];
2102
+ for (const d of r) {
2103
+ const h = {
2104
+ ...t,
2105
+ common: {
2106
+ ...t.common,
2107
+ issues: []
2108
+ },
2109
+ parent: null
2110
+ }, x = d._parseSync({
2111
+ data: t.data,
2112
+ path: t.path,
2113
+ parent: h
2114
+ });
2115
+ if (x.status === "valid")
2116
+ return x;
2117
+ x.status === "dirty" && !i && (i = { result: x, ctx: h }), h.common.issues.length && n.push(h.common.issues);
2118
+ }
2119
+ if (i)
2120
+ return t.common.issues.push(...i.ctx.common.issues), i.result;
2121
+ const o = n.map((d) => new U(d));
2122
+ return f(t, {
2123
+ code: l.invalid_union,
2124
+ unionErrors: o
2125
+ }), y;
2126
+ }
2127
+ }
2128
+ get options() {
2129
+ return this._def.options;
2130
+ }
2131
+ }
2132
+ xe.create = (a, e) => new xe({
2133
+ options: a,
2134
+ typeName: g.ZodUnion,
2135
+ ..._(e)
2136
+ });
2137
+ const L = (a) => a instanceof Le ? L(a.schema) : a instanceof Q ? L(a.innerType()) : a instanceof we ? [a.value] : a instanceof J ? a.options : a instanceof $e ? k.objectValues(a.enum) : a instanceof Ce ? L(a._def.innerType) : a instanceof Fe ? [void 0] : a instanceof _e ? [null] : a instanceof B ? [void 0, ...L(a.unwrap())] : a instanceof G ? [null, ...L(a.unwrap())] : a instanceof wt || a instanceof Te ? L(a.unwrap()) : a instanceof Se ? L(a._def.innerType) : [];
2138
+ class Be extends b {
2139
+ _parse(e) {
2140
+ const { ctx: t } = this._processInputParams(e);
2141
+ if (t.parsedType !== m.object)
2142
+ return f(t, {
2143
+ code: l.invalid_type,
2144
+ expected: m.object,
2145
+ received: t.parsedType
2146
+ }), y;
2147
+ const r = this.discriminator, s = t.data[r], i = this.optionsMap.get(s);
2148
+ return i ? t.common.async ? i._parseAsync({
2149
+ data: t.data,
2150
+ path: t.path,
2151
+ parent: t
2152
+ }) : i._parseSync({
2153
+ data: t.data,
2154
+ path: t.path,
2155
+ parent: t
2156
+ }) : (f(t, {
2157
+ code: l.invalid_union_discriminator,
2158
+ options: Array.from(this.optionsMap.keys()),
2159
+ path: [r]
2160
+ }), y);
2161
+ }
2162
+ get discriminator() {
2163
+ return this._def.discriminator;
2164
+ }
2165
+ get options() {
2166
+ return this._def.options;
2167
+ }
2168
+ get optionsMap() {
2169
+ return this._def.optionsMap;
2170
+ }
2171
+ /**
2172
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2173
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2174
+ * have a different value for each object in the union.
2175
+ * @param discriminator the name of the discriminator property
2176
+ * @param types an array of object schemas
2177
+ * @param params
2178
+ */
2179
+ static create(e, t, r) {
2180
+ const s = /* @__PURE__ */ new Map();
2181
+ for (const i of t) {
2182
+ const n = L(i.shape[e]);
2183
+ if (!n.length)
2184
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2185
+ for (const o of n) {
2186
+ if (s.has(o))
2187
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
2188
+ s.set(o, i);
2189
+ }
2190
+ }
2191
+ return new Be({
2192
+ typeName: g.ZodDiscriminatedUnion,
2193
+ discriminator: e,
2194
+ options: t,
2195
+ optionsMap: s,
2196
+ ..._(r)
2197
+ });
2198
+ }
2199
+ }
2200
+ function qe(a, e) {
2201
+ const t = V(a), r = V(e);
2202
+ if (a === e)
2203
+ return { valid: !0, data: a };
2204
+ if (t === m.object && r === m.object) {
2205
+ const s = k.objectKeys(e), i = k.objectKeys(a).filter((o) => s.indexOf(o) !== -1), n = { ...a, ...e };
2206
+ for (const o of i) {
2207
+ const d = qe(a[o], e[o]);
2208
+ if (!d.valid)
2209
+ return { valid: !1 };
2210
+ n[o] = d.data;
2211
+ }
2212
+ return { valid: !0, data: n };
2213
+ } else if (t === m.array && r === m.array) {
2214
+ if (a.length !== e.length)
2215
+ return { valid: !1 };
2216
+ const s = [];
2217
+ for (let i = 0; i < a.length; i++) {
2218
+ const n = a[i], o = e[i], d = qe(n, o);
2219
+ if (!d.valid)
2220
+ return { valid: !1 };
2221
+ s.push(d.data);
2222
+ }
2223
+ return { valid: !0, data: s };
2224
+ } else return t === m.date && r === m.date && +a == +e ? { valid: !0, data: a } : { valid: !1 };
2225
+ }
2226
+ class be extends b {
2227
+ _parse(e) {
2228
+ const { status: t, ctx: r } = this._processInputParams(e), s = (i, n) => {
2229
+ if (nt(i) || nt(n))
2230
+ return y;
2231
+ const o = qe(i.value, n.value);
2232
+ return o.valid ? ((ot(i) || ot(n)) && t.dirty(), { status: t.value, value: o.data }) : (f(r, {
2233
+ code: l.invalid_intersection_types
2234
+ }), y);
2235
+ };
2236
+ return r.common.async ? Promise.all([
2237
+ this._def.left._parseAsync({
2238
+ data: r.data,
2239
+ path: r.path,
2240
+ parent: r
2241
+ }),
2242
+ this._def.right._parseAsync({
2243
+ data: r.data,
2244
+ path: r.path,
2245
+ parent: r
2246
+ })
2247
+ ]).then(([i, n]) => s(i, n)) : s(this._def.left._parseSync({
2248
+ data: r.data,
2249
+ path: r.path,
2250
+ parent: r
2251
+ }), this._def.right._parseSync({
2252
+ data: r.data,
2253
+ path: r.path,
2254
+ parent: r
2255
+ }));
2256
+ }
2257
+ }
2258
+ be.create = (a, e, t) => new be({
2259
+ left: a,
2260
+ right: e,
2261
+ typeName: g.ZodIntersection,
2262
+ ..._(t)
2263
+ });
2264
+ class K extends b {
2265
+ _parse(e) {
2266
+ const { status: t, ctx: r } = this._processInputParams(e);
2267
+ if (r.parsedType !== m.array)
2268
+ return f(r, {
2269
+ code: l.invalid_type,
2270
+ expected: m.array,
2271
+ received: r.parsedType
2272
+ }), y;
2273
+ if (r.data.length < this._def.items.length)
2274
+ return f(r, {
2275
+ code: l.too_small,
2276
+ minimum: this._def.items.length,
2277
+ inclusive: !0,
2278
+ exact: !1,
2279
+ type: "array"
2280
+ }), y;
2281
+ !this._def.rest && r.data.length > this._def.items.length && (f(r, {
2282
+ code: l.too_big,
2283
+ maximum: this._def.items.length,
2284
+ inclusive: !0,
2285
+ exact: !1,
2286
+ type: "array"
2287
+ }), t.dirty());
2288
+ const i = [...r.data].map((n, o) => {
2289
+ const d = this._def.items[o] || this._def.rest;
2290
+ return d ? d._parse(new P(r, n, r.path, o)) : null;
2291
+ }).filter((n) => !!n);
2292
+ return r.common.async ? Promise.all(i).then((n) => A.mergeArray(t, n)) : A.mergeArray(t, i);
2293
+ }
2294
+ get items() {
2295
+ return this._def.items;
2296
+ }
2297
+ rest(e) {
2298
+ return new K({
2299
+ ...this._def,
2300
+ rest: e
2301
+ });
2302
+ }
2303
+ }
2304
+ K.create = (a, e) => {
2305
+ if (!Array.isArray(a))
2306
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2307
+ return new K({
2308
+ items: a,
2309
+ typeName: g.ZodTuple,
2310
+ rest: null,
2311
+ ..._(e)
2312
+ });
2313
+ };
2314
+ class ke extends b {
2315
+ get keySchema() {
2316
+ return this._def.keyType;
2317
+ }
2318
+ get valueSchema() {
2319
+ return this._def.valueType;
2320
+ }
2321
+ _parse(e) {
2322
+ const { status: t, ctx: r } = this._processInputParams(e);
2323
+ if (r.parsedType !== m.object)
2324
+ return f(r, {
2325
+ code: l.invalid_type,
2326
+ expected: m.object,
2327
+ received: r.parsedType
2328
+ }), y;
2329
+ const s = [], i = this._def.keyType, n = this._def.valueType;
2330
+ for (const o in r.data)
2331
+ s.push({
2332
+ key: i._parse(new P(r, o, r.path, o)),
2333
+ value: n._parse(new P(r, r.data[o], r.path, o)),
2334
+ alwaysSet: o in r.data
2335
+ });
2336
+ return r.common.async ? A.mergeObjectAsync(t, s) : A.mergeObjectSync(t, s);
2337
+ }
2338
+ get element() {
2339
+ return this._def.valueType;
2340
+ }
2341
+ static create(e, t, r) {
2342
+ return t instanceof b ? new ke({
2343
+ keyType: e,
2344
+ valueType: t,
2345
+ typeName: g.ZodRecord,
2346
+ ..._(r)
2347
+ }) : new ke({
2348
+ keyType: $.create(),
2349
+ valueType: e,
2350
+ typeName: g.ZodRecord,
2351
+ ..._(t)
2352
+ });
2353
+ }
2354
+ }
2355
+ class ut extends b {
2356
+ get keySchema() {
2357
+ return this._def.keyType;
2358
+ }
2359
+ get valueSchema() {
2360
+ return this._def.valueType;
2361
+ }
2362
+ _parse(e) {
2363
+ const { status: t, ctx: r } = this._processInputParams(e);
2364
+ if (r.parsedType !== m.map)
2365
+ return f(r, {
2366
+ code: l.invalid_type,
2367
+ expected: m.map,
2368
+ received: r.parsedType
2369
+ }), y;
2370
+ const s = this._def.keyType, i = this._def.valueType, n = [...r.data.entries()].map(([o, d], h) => ({
2371
+ key: s._parse(new P(r, o, r.path, [h, "key"])),
2372
+ value: i._parse(new P(r, d, r.path, [h, "value"]))
2373
+ }));
2374
+ if (r.common.async) {
2375
+ const o = /* @__PURE__ */ new Map();
2376
+ return Promise.resolve().then(async () => {
2377
+ for (const d of n) {
2378
+ const h = await d.key, x = await d.value;
2379
+ if (h.status === "aborted" || x.status === "aborted")
2380
+ return y;
2381
+ (h.status === "dirty" || x.status === "dirty") && t.dirty(), o.set(h.value, x.value);
2382
+ }
2383
+ return { status: t.value, value: o };
2384
+ });
2385
+ } else {
2386
+ const o = /* @__PURE__ */ new Map();
2387
+ for (const d of n) {
2388
+ const h = d.key, x = d.value;
2389
+ if (h.status === "aborted" || x.status === "aborted")
2390
+ return y;
2391
+ (h.status === "dirty" || x.status === "dirty") && t.dirty(), o.set(h.value, x.value);
2392
+ }
2393
+ return { status: t.value, value: o };
2394
+ }
2395
+ }
2396
+ }
2397
+ ut.create = (a, e, t) => new ut({
2398
+ valueType: e,
2399
+ keyType: a,
2400
+ typeName: g.ZodMap,
2401
+ ..._(t)
2402
+ });
2403
+ class de extends b {
2404
+ _parse(e) {
2405
+ const { status: t, ctx: r } = this._processInputParams(e);
2406
+ if (r.parsedType !== m.set)
2407
+ return f(r, {
2408
+ code: l.invalid_type,
2409
+ expected: m.set,
2410
+ received: r.parsedType
2411
+ }), y;
2412
+ const s = this._def;
2413
+ s.minSize !== null && r.data.size < s.minSize.value && (f(r, {
2414
+ code: l.too_small,
2415
+ minimum: s.minSize.value,
2416
+ type: "set",
2417
+ inclusive: !0,
2418
+ exact: !1,
2419
+ message: s.minSize.message
2420
+ }), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (f(r, {
2421
+ code: l.too_big,
2422
+ maximum: s.maxSize.value,
2423
+ type: "set",
2424
+ inclusive: !0,
2425
+ exact: !1,
2426
+ message: s.maxSize.message
2427
+ }), t.dirty());
2428
+ const i = this._def.valueType;
2429
+ function n(d) {
2430
+ const h = /* @__PURE__ */ new Set();
2431
+ for (const x of d) {
2432
+ if (x.status === "aborted")
2433
+ return y;
2434
+ x.status === "dirty" && t.dirty(), h.add(x.value);
2435
+ }
2436
+ return { status: t.value, value: h };
2437
+ }
2438
+ const o = [...r.data.values()].map((d, h) => i._parse(new P(r, d, r.path, h)));
2439
+ return r.common.async ? Promise.all(o).then((d) => n(d)) : n(o);
2440
+ }
2441
+ min(e, t) {
2442
+ return new de({
2443
+ ...this._def,
2444
+ minSize: { value: e, message: p.toString(t) }
2445
+ });
2446
+ }
2447
+ max(e, t) {
2448
+ return new de({
2449
+ ...this._def,
2450
+ maxSize: { value: e, message: p.toString(t) }
2451
+ });
2452
+ }
2453
+ size(e, t) {
2454
+ return this.min(e, t).max(e, t);
2455
+ }
2456
+ nonempty(e) {
2457
+ return this.min(1, e);
2458
+ }
2459
+ }
2460
+ de.create = (a, e) => new de({
2461
+ valueType: a,
2462
+ minSize: null,
2463
+ maxSize: null,
2464
+ typeName: g.ZodSet,
2465
+ ..._(e)
2466
+ });
2467
+ class Le extends b {
2468
+ get schema() {
2469
+ return this._def.getter();
2470
+ }
2471
+ _parse(e) {
2472
+ const { ctx: t } = this._processInputParams(e);
2473
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2474
+ }
2475
+ }
2476
+ Le.create = (a, e) => new Le({
2477
+ getter: a,
2478
+ typeName: g.ZodLazy,
2479
+ ..._(e)
2480
+ });
2481
+ class we extends b {
2482
+ _parse(e) {
2483
+ if (e.data !== this._def.value) {
2484
+ const t = this._getOrReturnCtx(e);
2485
+ return f(t, {
2486
+ received: t.data,
2487
+ code: l.invalid_literal,
2488
+ expected: this._def.value
2489
+ }), y;
2490
+ }
2491
+ return { status: "valid", value: e.data };
2492
+ }
2493
+ get value() {
2494
+ return this._def.value;
2495
+ }
2496
+ }
2497
+ we.create = (a, e) => new we({
2498
+ value: a,
2499
+ typeName: g.ZodLiteral,
2500
+ ..._(e)
2501
+ });
2502
+ function kt(a, e) {
2503
+ return new J({
2504
+ values: a,
2505
+ typeName: g.ZodEnum,
2506
+ ..._(e)
2507
+ });
2508
+ }
2509
+ class J extends b {
2510
+ _parse(e) {
2511
+ if (typeof e.data != "string") {
2512
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2513
+ return f(t, {
2514
+ expected: k.joinValues(r),
2515
+ received: t.parsedType,
2516
+ code: l.invalid_type
2517
+ }), y;
2518
+ }
2519
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2520
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2521
+ return f(t, {
2522
+ received: t.data,
2523
+ code: l.invalid_enum_value,
2524
+ options: r
2525
+ }), y;
2526
+ }
2527
+ return E(e.data);
2528
+ }
2529
+ get options() {
2530
+ return this._def.values;
2531
+ }
2532
+ get enum() {
2533
+ const e = {};
2534
+ for (const t of this._def.values)
2535
+ e[t] = t;
2536
+ return e;
2537
+ }
2538
+ get Values() {
2539
+ const e = {};
2540
+ for (const t of this._def.values)
2541
+ e[t] = t;
2542
+ return e;
2543
+ }
2544
+ get Enum() {
2545
+ const e = {};
2546
+ for (const t of this._def.values)
2547
+ e[t] = t;
2548
+ return e;
2549
+ }
2550
+ extract(e, t = this._def) {
2551
+ return J.create(e, {
2552
+ ...this._def,
2553
+ ...t
2554
+ });
2555
+ }
2556
+ exclude(e, t = this._def) {
2557
+ return J.create(this.options.filter((r) => !e.includes(r)), {
2558
+ ...this._def,
2559
+ ...t
2560
+ });
2561
+ }
2562
+ }
2563
+ J.create = kt;
2564
+ class $e extends b {
2565
+ _parse(e) {
2566
+ const t = k.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
2567
+ if (r.parsedType !== m.string && r.parsedType !== m.number) {
2568
+ const s = k.objectValues(t);
2569
+ return f(r, {
2570
+ expected: k.joinValues(s),
2571
+ received: r.parsedType,
2572
+ code: l.invalid_type
2573
+ }), y;
2574
+ }
2575
+ if (this._cache || (this._cache = new Set(k.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2576
+ const s = k.objectValues(t);
2577
+ return f(r, {
2578
+ received: r.data,
2579
+ code: l.invalid_enum_value,
2580
+ options: s
2581
+ }), y;
2582
+ }
2583
+ return E(e.data);
2584
+ }
2585
+ get enum() {
2586
+ return this._def.values;
2587
+ }
2588
+ }
2589
+ $e.create = (a, e) => new $e({
2590
+ values: a,
2591
+ typeName: g.ZodNativeEnum,
2592
+ ..._(e)
2593
+ });
2594
+ class Ne extends b {
2595
+ unwrap() {
2596
+ return this._def.type;
2597
+ }
2598
+ _parse(e) {
2599
+ const { ctx: t } = this._processInputParams(e);
2600
+ if (t.parsedType !== m.promise && t.common.async === !1)
2601
+ return f(t, {
2602
+ code: l.invalid_type,
2603
+ expected: m.promise,
2604
+ received: t.parsedType
2605
+ }), y;
2606
+ const r = t.parsedType === m.promise ? t.data : Promise.resolve(t.data);
2607
+ return E(r.then((s) => this._def.type.parseAsync(s, {
2608
+ path: t.path,
2609
+ errorMap: t.common.contextualErrorMap
2610
+ })));
2611
+ }
2612
+ }
2613
+ Ne.create = (a, e) => new Ne({
2614
+ type: a,
2615
+ typeName: g.ZodPromise,
2616
+ ..._(e)
2617
+ });
2618
+ class Q extends b {
2619
+ innerType() {
2620
+ return this._def.schema;
2621
+ }
2622
+ sourceType() {
2623
+ return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2624
+ }
2625
+ _parse(e) {
2626
+ const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, i = {
2627
+ addIssue: (n) => {
2628
+ f(r, n), n.fatal ? t.abort() : t.dirty();
2629
+ },
2630
+ get path() {
2631
+ return r.path;
2632
+ }
2633
+ };
2634
+ if (i.addIssue = i.addIssue.bind(i), s.type === "preprocess") {
2635
+ const n = s.transform(r.data, i);
2636
+ if (r.common.async)
2637
+ return Promise.resolve(n).then(async (o) => {
2638
+ if (t.value === "aborted")
2639
+ return y;
2640
+ const d = await this._def.schema._parseAsync({
2641
+ data: o,
2642
+ path: r.path,
2643
+ parent: r
2644
+ });
2645
+ return d.status === "aborted" ? y : d.status === "dirty" || t.value === "dirty" ? oe(d.value) : d;
2646
+ });
2647
+ {
2648
+ if (t.value === "aborted")
2649
+ return y;
2650
+ const o = this._def.schema._parseSync({
2651
+ data: n,
2652
+ path: r.path,
2653
+ parent: r
2654
+ });
2655
+ return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? oe(o.value) : o;
2656
+ }
2657
+ }
2658
+ if (s.type === "refinement") {
2659
+ const n = (o) => {
2660
+ const d = s.refinement(o, i);
2661
+ if (r.common.async)
2662
+ return Promise.resolve(d);
2663
+ if (d instanceof Promise)
2664
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2665
+ return o;
2666
+ };
2667
+ if (r.common.async === !1) {
2668
+ const o = this._def.schema._parseSync({
2669
+ data: r.data,
2670
+ path: r.path,
2671
+ parent: r
2672
+ });
2673
+ return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), n(o.value), { status: t.value, value: o.value });
2674
+ } else
2675
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), n(o.value).then(() => ({ status: t.value, value: o.value }))));
2676
+ }
2677
+ if (s.type === "transform")
2678
+ if (r.common.async === !1) {
2679
+ const n = this._def.schema._parseSync({
2680
+ data: r.data,
2681
+ path: r.path,
2682
+ parent: r
2683
+ });
2684
+ if (!re(n))
2685
+ return y;
2686
+ const o = s.transform(n.value, i);
2687
+ if (o instanceof Promise)
2688
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2689
+ return { status: t.value, value: o };
2690
+ } else
2691
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((n) => re(n) ? Promise.resolve(s.transform(n.value, i)).then((o) => ({
2692
+ status: t.value,
2693
+ value: o
2694
+ })) : y);
2695
+ k.assertNever(s);
2696
+ }
2697
+ }
2698
+ Q.create = (a, e, t) => new Q({
2699
+ schema: a,
2700
+ typeName: g.ZodEffects,
2701
+ effect: e,
2702
+ ..._(t)
2703
+ });
2704
+ Q.createWithPreprocess = (a, e, t) => new Q({
2705
+ schema: e,
2706
+ effect: { type: "preprocess", transform: a },
2707
+ typeName: g.ZodEffects,
2708
+ ..._(t)
2709
+ });
2710
+ class B extends b {
2711
+ _parse(e) {
2712
+ return this._getType(e) === m.undefined ? E(void 0) : this._def.innerType._parse(e);
2713
+ }
2714
+ unwrap() {
2715
+ return this._def.innerType;
2716
+ }
2717
+ }
2718
+ B.create = (a, e) => new B({
2719
+ innerType: a,
2720
+ typeName: g.ZodOptional,
2721
+ ..._(e)
2722
+ });
2723
+ class G extends b {
2724
+ _parse(e) {
2725
+ return this._getType(e) === m.null ? E(null) : this._def.innerType._parse(e);
2726
+ }
2727
+ unwrap() {
2728
+ return this._def.innerType;
2729
+ }
2730
+ }
2731
+ G.create = (a, e) => new G({
2732
+ innerType: a,
2733
+ typeName: g.ZodNullable,
2734
+ ..._(e)
2735
+ });
2736
+ class Ce extends b {
2737
+ _parse(e) {
2738
+ const { ctx: t } = this._processInputParams(e);
2739
+ let r = t.data;
2740
+ return t.parsedType === m.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
2741
+ data: r,
2742
+ path: t.path,
2743
+ parent: t
2744
+ });
2745
+ }
2746
+ removeDefault() {
2747
+ return this._def.innerType;
2748
+ }
2749
+ }
2750
+ Ce.create = (a, e) => new Ce({
2751
+ innerType: a,
2752
+ typeName: g.ZodDefault,
2753
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2754
+ ..._(e)
2755
+ });
2756
+ class Se extends b {
2757
+ _parse(e) {
2758
+ const { ctx: t } = this._processInputParams(e), r = {
2759
+ ...t,
2760
+ common: {
2761
+ ...t.common,
2762
+ issues: []
2763
+ }
2764
+ }, s = this._def.innerType._parse({
2765
+ data: r.data,
2766
+ path: r.path,
2767
+ parent: {
2768
+ ...r
2769
+ }
2770
+ });
2771
+ return ge(s) ? s.then((i) => ({
2772
+ status: "valid",
2773
+ value: i.status === "valid" ? i.value : this._def.catchValue({
2774
+ get error() {
2775
+ return new U(r.common.issues);
2776
+ },
2777
+ input: r.data
2778
+ })
2779
+ })) : {
2780
+ status: "valid",
2781
+ value: s.status === "valid" ? s.value : this._def.catchValue({
2782
+ get error() {
2783
+ return new U(r.common.issues);
2784
+ },
2785
+ input: r.data
2786
+ })
2787
+ };
2788
+ }
2789
+ removeCatch() {
2790
+ return this._def.innerType;
2791
+ }
2792
+ }
2793
+ Se.create = (a, e) => new Se({
2794
+ innerType: a,
2795
+ typeName: g.ZodCatch,
2796
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2797
+ ..._(e)
2798
+ });
2799
+ class mt extends b {
2800
+ _parse(e) {
2801
+ if (this._getType(e) !== m.nan) {
2802
+ const r = this._getOrReturnCtx(e);
2803
+ return f(r, {
2804
+ code: l.invalid_type,
2805
+ expected: m.nan,
2806
+ received: r.parsedType
2807
+ }), y;
2808
+ }
2809
+ return { status: "valid", value: e.data };
2810
+ }
2811
+ }
2812
+ mt.create = (a) => new mt({
2813
+ typeName: g.ZodNaN,
2814
+ ..._(a)
2815
+ });
2816
+ class wt extends b {
2817
+ _parse(e) {
2818
+ const { ctx: t } = this._processInputParams(e), r = t.data;
2819
+ return this._def.type._parse({
2820
+ data: r,
2821
+ path: t.path,
2822
+ parent: t
2823
+ });
2824
+ }
2825
+ unwrap() {
2826
+ return this._def.type;
2827
+ }
2828
+ }
2829
+ class Ue extends b {
2830
+ _parse(e) {
2831
+ const { status: t, ctx: r } = this._processInputParams(e);
2832
+ if (r.common.async)
2833
+ return (async () => {
2834
+ const i = await this._def.in._parseAsync({
2835
+ data: r.data,
2836
+ path: r.path,
2837
+ parent: r
2838
+ });
2839
+ return i.status === "aborted" ? y : i.status === "dirty" ? (t.dirty(), oe(i.value)) : this._def.out._parseAsync({
2840
+ data: i.value,
2841
+ path: r.path,
2842
+ parent: r
2843
+ });
2844
+ })();
2845
+ {
2846
+ const s = this._def.in._parseSync({
2847
+ data: r.data,
2848
+ path: r.path,
2849
+ parent: r
2850
+ });
2851
+ return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
2852
+ status: "dirty",
2853
+ value: s.value
2854
+ }) : this._def.out._parseSync({
2855
+ data: s.value,
2856
+ path: r.path,
2857
+ parent: r
2858
+ });
2859
+ }
2860
+ }
2861
+ static create(e, t) {
2862
+ return new Ue({
2863
+ in: e,
2864
+ out: t,
2865
+ typeName: g.ZodPipeline
2866
+ });
2867
+ }
2868
+ }
2869
+ class Te extends b {
2870
+ _parse(e) {
2871
+ const t = this._def.innerType._parse(e), r = (s) => (re(s) && (s.value = Object.freeze(s.value)), s);
2872
+ return ge(t) ? t.then((s) => r(s)) : r(t);
2873
+ }
2874
+ unwrap() {
2875
+ return this._def.innerType;
2876
+ }
2877
+ }
2878
+ Te.create = (a, e) => new Te({
2879
+ innerType: a,
2880
+ typeName: g.ZodReadonly,
2881
+ ..._(e)
2882
+ });
2883
+ var g;
2884
+ (function(a) {
2885
+ a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
2886
+ })(g || (g = {}));
2887
+ const u = $.create, w = ae.create, j = Ze.create, Ve = _e.create, fe = Pe.create;
2888
+ z.create;
2889
+ const X = F.create, N = T.create, ze = xe.create, Tr = Be.create;
2890
+ be.create;
2891
+ K.create;
2892
+ const ue = ke.create, Ae = we.create, I = J.create;
2893
+ Ne.create;
2894
+ B.create;
2895
+ G.create;
2896
+ var le = {
2897
+ colors: {
2898
+ primary: "#6366f1",
2899
+ primaryHover: "#4f46e5",
2900
+ primaryLight: "#e0e7ff",
2901
+ background: "#f8fafc",
2902
+ backgroundSecondary: "#f1f5f9",
2903
+ backgroundTertiary: "#e2e8f0",
2904
+ surface: "#ffffff",
2905
+ surfaceHover: "#f8fafc",
2906
+ border: "#e2e8f0",
2907
+ borderHover: "#a5b4fc",
2908
+ textPrimary: "#0f172a",
2909
+ textSecondary: "#475569",
2910
+ textMuted: "#94a3b8",
2911
+ textInverse: "#ffffff",
2912
+ success: "#10b981",
2913
+ successLight: "#d1fae5",
2914
+ warning: "#f59e0b",
2915
+ warningLight: "#fef3c7",
2916
+ error: "#ef4444",
2917
+ errorLight: "#fee2e2",
2918
+ info: "#3b82f6",
2919
+ infoLight: "#dbeafe"
2920
+ }
2921
+ };
2922
+ ({
2923
+ ...le.colors
2924
+ }, {
2925
+ ...le.colors
2926
+ }), {
2927
+ ...le.colors
2928
+ }, {
2929
+ ...le.colors
2930
+ };
2931
+ ({
2932
+ ...le.colors
2933
+ });
2934
+ var Dr = I([
2935
+ "string",
2936
+ "number",
2937
+ "integer",
2938
+ "float",
2939
+ "boolean",
2940
+ "date",
2941
+ "datetime",
2942
+ "email",
2943
+ "phone",
2944
+ "url",
2945
+ "enum"
2946
+ ]), Nt = I([
2947
+ "required",
2948
+ "email",
2949
+ "phone",
2950
+ "url",
2951
+ "date",
2952
+ "number",
2953
+ "integer",
2954
+ "float",
2955
+ "minLength",
2956
+ "maxLength",
2957
+ "min",
2958
+ "max",
2959
+ "pattern",
2960
+ "enum",
2961
+ "unique",
2962
+ "custom"
2963
+ ]), Ct = I(["error", "warning", "info"]), Ar = N({
2964
+ type: Nt,
2965
+ params: ue(fe()).optional(),
2966
+ message: u().optional(),
2967
+ severity: Ct.optional().default("error")
2968
+ }), Ir = I([
2969
+ "trim",
2970
+ "lowercase",
2971
+ "uppercase",
2972
+ "capitalize",
2973
+ "toNumber",
2974
+ "toDate",
2975
+ "toBoolean",
2976
+ "replace",
2977
+ "custom"
2978
+ ]), Or = N({
2979
+ type: Ir,
2980
+ params: ue(fe()).optional()
2981
+ }), Rr = N({
2982
+ key: u().min(1).max(100),
2983
+ label: u().min(1).max(200),
2984
+ type: Dr,
2985
+ required: j().optional().default(!1),
2986
+ description: u().max(500).optional(),
2987
+ validators: X(Ar).optional(),
2988
+ transform: Or.optional()
2989
+ }), Er = N({
2990
+ allowExtraColumns: j().optional().default(!1),
2991
+ skipEmptyRows: j().optional().default(!0),
2992
+ trimWhitespace: j().optional().default(!0),
2993
+ dateFormat: u().optional(),
2994
+ uniqueKeys: X(u()).optional(),
2995
+ maxRows: w().int().positive().optional().default(1e5)
2996
+ }), Mr = N({
2997
+ columns: X(Rr).min(1),
2998
+ options: Er.optional()
2999
+ });
3000
+ I([
3001
+ "created",
3002
+ "file_uploaded",
3003
+ "parsing",
3004
+ "parsed",
3005
+ "mapping",
3006
+ "mapped",
3007
+ "validating",
3008
+ "validated",
3009
+ "editing",
3010
+ "completed",
3011
+ "failed",
3012
+ "cancelled"
3013
+ ]);
3014
+ N({
3015
+ schema: Mr,
3016
+ metadata: ue(fe()).optional()
3017
+ });
3018
+ var jr = N({
3019
+ sourceColumn: u(),
3020
+ targetKey: u().nullable(),
3021
+ confidence: w().min(0).max(1),
3022
+ isAutoMapped: j(),
3023
+ reasoning: u().optional()
3024
+ });
3025
+ N({
3026
+ sessionId: u().uuid(),
3027
+ mappings: X(jr)
3028
+ });
3029
+ N({
3030
+ rowIndex: w().int().nonnegative(),
3031
+ columnKey: u(),
3032
+ value: ze([u(), w(), j(), Ve()]),
3033
+ severity: Ct,
3034
+ validatorType: Nt,
3035
+ message: u(),
3036
+ suggestion: u().optional()
3037
+ });
3038
+ N({
3039
+ sessionId: u().uuid(),
3040
+ rowIndex: w().int().nonnegative(),
3041
+ columnKey: u(),
3042
+ value: ze([u(), w(), j(), Ve()])
3043
+ });
3044
+ N({
3045
+ sessionId: u().uuid(),
3046
+ updates: X(
3047
+ N({
3048
+ rowIndex: w().int().nonnegative(),
3049
+ columnKey: u(),
3050
+ value: ze([u(), w(), j(), Ve()])
3051
+ })
3052
+ )
3053
+ });
3054
+ N({
3055
+ sessionId: u().uuid(),
3056
+ skipInvalidRows: j().optional().default(!1),
3057
+ acknowledgeWarnings: j().optional().default(!1)
3058
+ });
3059
+ var Zr = /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ ]?\d[ABCEGHJ-NPRSTV-Z]\d$/i, Fr = /^[A-Z]{2}\d{6}$/, St = {
3060
+ AB: {
3061
+ code: "AB",
3062
+ name: "Alberta",
3063
+ nameInFrench: "Alberta",
3064
+ isTerritory: !1,
3065
+ licenseFormat: /^\d{6,9}$/,
3066
+ licenseFormatDescription: "6-9 digits",
3067
+ licenseExampleFormat: "123456789"
3068
+ },
3069
+ BC: {
3070
+ code: "BC",
3071
+ name: "British Columbia",
3072
+ nameInFrench: "Colombie-Britannique",
3073
+ isTerritory: !1,
3074
+ licenseFormat: /^\d{7}$/,
3075
+ licenseFormatDescription: "7 digits",
3076
+ licenseExampleFormat: "1234567"
3077
+ },
3078
+ MB: {
3079
+ code: "MB",
3080
+ name: "Manitoba",
3081
+ nameInFrench: "Manitoba",
3082
+ isTerritory: !1,
3083
+ licenseFormat: /^[A-Z]{2}\d{6}[A-Z]?$/,
3084
+ licenseFormatDescription: "2 letters + 6 digits + optional letter",
3085
+ licenseExampleFormat: "AB123456C"
3086
+ },
3087
+ NB: {
3088
+ code: "NB",
3089
+ name: "New Brunswick",
3090
+ nameInFrench: "Nouveau-Brunswick",
3091
+ isTerritory: !1,
3092
+ licenseFormat: /^\d{7}$/,
3093
+ licenseFormatDescription: "7 digits",
3094
+ licenseExampleFormat: "1234567"
3095
+ },
3096
+ NL: {
3097
+ code: "NL",
3098
+ name: "Newfoundland and Labrador",
3099
+ nameInFrench: "Terre-Neuve-et-Labrador",
3100
+ isTerritory: !1,
3101
+ licenseFormat: /^[A-Z]\d{9}$/,
3102
+ licenseFormatDescription: "1 letter + 9 digits",
3103
+ licenseExampleFormat: "A123456789"
3104
+ },
3105
+ NS: {
3106
+ code: "NS",
3107
+ name: "Nova Scotia",
3108
+ nameInFrench: "Nouvelle-Écosse",
3109
+ isTerritory: !1,
3110
+ licenseFormat: /^[A-Z]{5}\d{9}$/,
3111
+ licenseFormatDescription: "5 letters + 9 digits",
3112
+ licenseExampleFormat: "ABCDE123456789"
3113
+ },
3114
+ NT: {
3115
+ code: "NT",
3116
+ name: "Northwest Territories",
3117
+ nameInFrench: "Territoires du Nord-Ouest",
3118
+ isTerritory: !0,
3119
+ licenseFormat: /^\d{6}$/,
3120
+ licenseFormatDescription: "6 digits",
3121
+ licenseExampleFormat: "123456"
3122
+ },
3123
+ NU: {
3124
+ code: "NU",
3125
+ name: "Nunavut",
3126
+ nameInFrench: "Nunavut",
3127
+ isTerritory: !0,
3128
+ licenseFormat: /^\d{6}$/,
3129
+ licenseFormatDescription: "6 digits",
3130
+ licenseExampleFormat: "123456"
3131
+ },
3132
+ ON: {
3133
+ code: "ON",
3134
+ name: "Ontario",
3135
+ nameInFrench: "Ontario",
3136
+ isTerritory: !1,
3137
+ licenseFormat: /^[A-Z]\d{4}-\d{5}-\d{5}$|^[A-Z]\d{14}$/,
3138
+ licenseFormatDescription: "1 letter + 14 digits (with or without dashes)",
3139
+ licenseExampleFormat: "A1234-56789-01234"
3140
+ },
3141
+ PE: {
3142
+ code: "PE",
3143
+ name: "Prince Edward Island",
3144
+ nameInFrench: "Île-du-Prince-Édouard",
3145
+ isTerritory: !1,
3146
+ licenseFormat: /^\d{5,6}$/,
3147
+ licenseFormatDescription: "5-6 digits",
3148
+ licenseExampleFormat: "123456"
3149
+ },
3150
+ QC: {
3151
+ code: "QC",
3152
+ name: "Quebec",
3153
+ nameInFrench: "Québec",
3154
+ isTerritory: !1,
3155
+ licenseFormat: /^[A-Z]\d{12}$/,
3156
+ licenseFormatDescription: "1 letter + 12 digits",
3157
+ licenseExampleFormat: "A123456789012"
3158
+ },
3159
+ SK: {
3160
+ code: "SK",
3161
+ name: "Saskatchewan",
3162
+ nameInFrench: "Saskatchewan",
3163
+ isTerritory: !1,
3164
+ licenseFormat: /^\d{8}$/,
3165
+ licenseFormatDescription: "8 digits",
3166
+ licenseExampleFormat: "12345678"
3167
+ },
3168
+ YT: {
3169
+ code: "YT",
3170
+ name: "Yukon",
3171
+ nameInFrench: "Yukon",
3172
+ isTerritory: !0,
3173
+ licenseFormat: /^\d{6}$/,
3174
+ licenseFormatDescription: "6 digits",
3175
+ licenseExampleFormat: "123456"
3176
+ }
3177
+ };
3178
+ Object.fromEntries(
3179
+ Object.entries(St).map(([a, e]) => [a, e.name])
3180
+ );
3181
+ var Tt = I([
3182
+ "AB",
3183
+ "BC",
3184
+ "MB",
3185
+ "NB",
3186
+ "NL",
3187
+ "NS",
3188
+ "NT",
3189
+ "NU",
3190
+ "ON",
3191
+ "PE",
3192
+ "QC",
3193
+ "SK",
3194
+ "YT"
3195
+ ]), Dt = N({
3196
+ streetLine1: u().min(1).max(200),
3197
+ streetLine2: u().max(200).optional(),
3198
+ city: u().min(1).max(100),
3199
+ province: Tt,
3200
+ postalCode: u().regex(Zr, "Invalid Canadian postal code format (A1A 1A1)"),
3201
+ country: Ae("Canada")
3202
+ }), Ye = I(["passport", "drivers_license", "proof_of_address"]), Pr = I(["uploaded", "processing", "completed", "failed", "requires_review"]), qr = I(["excellent", "good", "fair", "poor"]), Lr = I(["tesseract", "textract", "gpt4vision"]), At = I(["M", "F", "X"]), $r = I([
3203
+ "image_manipulation",
3204
+ "poor_quality",
3205
+ "inconsistent_data",
3206
+ "expired_document",
3207
+ "invalid_format",
3208
+ "suspicious_pattern",
3209
+ "missing_security_features",
3210
+ "document_tampering"
3211
+ ]), Br = I(["high", "medium", "low"]), Ur = N({
3212
+ type: $r,
3213
+ severity: Br,
3214
+ message: u(),
3215
+ field: u().optional(),
3216
+ details: ue(fe()).optional()
3217
+ }), Vr = N({
3218
+ fullName: w().min(0).max(1),
3219
+ passportNumber: w().min(0).max(1),
3220
+ dateOfBirth: w().min(0).max(1),
3221
+ dateOfIssue: w().min(0).max(1),
3222
+ dateOfExpiry: w().min(0).max(1),
3223
+ placeOfBirth: w().min(0).max(1),
3224
+ sex: w().min(0).max(1),
3225
+ nationality: w().min(0).max(1)
3226
+ }), zr = N({
3227
+ documentType: Ae("passport"),
3228
+ fullName: u().min(1),
3229
+ givenNames: u().min(1),
3230
+ surname: u().min(1),
3231
+ passportNumber: u().regex(Fr, "Invalid Canadian passport number (format: AB123456)"),
3232
+ dateOfBirth: u().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
3233
+ dateOfIssue: u().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
3234
+ dateOfExpiry: u().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
3235
+ placeOfBirth: u().min(1),
3236
+ sex: At,
3237
+ nationality: u().min(1),
3238
+ photoBase64: u().optional(),
3239
+ mrzLine1: u().optional(),
3240
+ mrzLine2: u().optional(),
3241
+ confidence: Vr
3242
+ }), Yr = N({
3243
+ fullName: w().min(0).max(1),
3244
+ licenseNumber: w().min(0).max(1),
3245
+ dateOfBirth: w().min(0).max(1),
3246
+ expiryDate: w().min(0).max(1),
3247
+ address: w().min(0).max(1),
3248
+ province: w().min(0).max(1),
3249
+ licenseClass: w().min(0).max(1)
3250
+ }), It = N({
3251
+ documentType: Ae("drivers_license"),
3252
+ fullName: u().min(1),
3253
+ firstName: u().min(1),
3254
+ lastName: u().min(1),
3255
+ middleName: u().optional(),
3256
+ licenseNumber: u().min(1),
3257
+ dateOfBirth: u().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
3258
+ expiryDate: u().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
3259
+ issueDate: u().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format").optional(),
3260
+ address: Dt,
3261
+ province: Tt,
3262
+ licenseClass: u().min(1),
3263
+ restrictions: u().optional(),
3264
+ endorsements: u().optional(),
3265
+ sex: At.optional(),
3266
+ height: u().optional(),
3267
+ eyeColor: u().optional(),
3268
+ photoBase64: u().optional(),
3269
+ confidence: Yr
3270
+ });
3271
+ It.refine(
3272
+ (a) => St[a.province].licenseFormat.test(a.licenseNumber),
3273
+ {
3274
+ message: "License number format doesn't match the province requirements",
3275
+ path: ["licenseNumber"]
3276
+ }
3277
+ );
3278
+ var Wr = I([
3279
+ "utility_bill",
3280
+ "bank_statement",
3281
+ "government_letter",
3282
+ "tax_statement",
3283
+ "lease_agreement",
3284
+ "insurance_statement",
3285
+ "other"
3286
+ ]), Hr = N({
3287
+ fullName: w().min(0).max(1),
3288
+ address: w().min(0).max(1),
3289
+ documentSubType: w().min(0).max(1),
3290
+ issuer: w().min(0).max(1),
3291
+ documentDate: w().min(0).max(1)
3292
+ }), Ot = N({
3293
+ documentType: Ae("proof_of_address"),
3294
+ fullName: u().min(1),
3295
+ address: Dt,
3296
+ documentSubType: Wr,
3297
+ issuer: u().min(1),
3298
+ documentDate: u().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
3299
+ accountNumber: u().max(4).optional(),
3300
+ // Last 4 digits only
3301
+ statementPeriod: N({
3302
+ start: u(),
3303
+ end: u()
3304
+ }).optional(),
3305
+ confidence: Hr
3306
+ });
3307
+ Ot.refine(
3308
+ (a) => {
3309
+ const e = new Date(a.documentDate);
3310
+ return ((/* @__PURE__ */ new Date()).getTime() - e.getTime()) / (1e3 * 60 * 60 * 24) <= 90;
3311
+ },
3312
+ {
3313
+ message: "Proof of address must be dated within the last 90 days",
3314
+ path: ["documentDate"]
3315
+ }
3316
+ );
3317
+ var Kr = Tr("documentType", [
3318
+ zr,
3319
+ It,
3320
+ Ot
3321
+ ]);
3322
+ I([
3323
+ "created",
3324
+ "documents_pending",
3325
+ "processing",
3326
+ "review_required",
3327
+ "completed",
3328
+ "failed",
3329
+ "cancelled"
3330
+ ]);
3331
+ N({
3332
+ requiredDocuments: X(Ye).min(1),
3333
+ metadata: ue(fe()).optional()
3334
+ });
3335
+ N({
3336
+ sessionId: u().uuid(),
3337
+ documentType: Ye
3338
+ });
3339
+ N({
3340
+ id: u().uuid(),
3341
+ sessionId: u().uuid(),
3342
+ type: Ye,
3343
+ status: Pr,
3344
+ uploadedAt: u().datetime(),
3345
+ processedAt: u().datetime().optional(),
3346
+ originalFilename: u(),
3347
+ fileSize: w().int().positive(),
3348
+ mimeType: u(),
3349
+ s3Key: u(),
3350
+ extractedData: Kr.optional(),
3351
+ confidence: w().min(0).max(1),
3352
+ ocrQuality: qr,
3353
+ fraudFlags: X(Ur),
3354
+ processingTimeMs: w().int().optional(),
3355
+ ocrProvider: Lr.optional(),
3356
+ aiModel: u().optional()
3357
+ });
3358
+ N({
3359
+ sessionId: u().uuid(),
3360
+ acceptWarnings: j().optional().default(!1)
3361
+ });
3362
+ var pt = ["payment", "payout", "subscription"], De = [
3363
+ "credit_card",
3364
+ "digital_cheque",
3365
+ "etransfer_request_money",
3366
+ "etransfer_standard",
3367
+ "interac_online",
3368
+ "online_banking",
3369
+ "apple_pay",
3370
+ "google_pay",
3371
+ "ach_payment",
3372
+ "etransfer_send_money",
3373
+ "visa_direct",
3374
+ "credit_send",
3375
+ "master_card_send",
3376
+ "direct_deposit",
3377
+ "rtp_payout",
3378
+ "ach_payout",
3379
+ "wire_transfer"
3380
+ ], ht = ["digital", "physical"], yt = ["daily", "weekly", "monthly", "yearly"], Rt = [
3381
+ {
3382
+ key: "sid",
3383
+ label: "Site ID",
3384
+ type: "integer",
3385
+ required: !0,
3386
+ description: "Your site's unique ID (whole number)",
3387
+ validators: [
3388
+ { type: "required", message: "Site ID is required" },
3389
+ { type: "integer", message: "Site ID must be a whole number" },
3390
+ { type: "min", params: { value: 1 }, message: "Site ID must be a positive number" }
3391
+ ]
3392
+ },
3393
+ {
3394
+ key: "type",
3395
+ label: "Transaction Type",
3396
+ type: "enum",
3397
+ required: !0,
3398
+ description: "Type of transaction: payment, payout, or subscription",
3399
+ validators: [
3400
+ { type: "required", message: "Transaction type is required" },
3401
+ {
3402
+ type: "enum",
3403
+ params: { values: pt },
3404
+ message: `Transaction type must be one of: ${pt.join(", ")}`
3405
+ }
3406
+ ],
3407
+ transform: { type: "lowercase" }
3408
+ },
3409
+ {
3410
+ key: "methods",
3411
+ label: "Payment Methods",
3412
+ type: "string",
3413
+ required: !0,
3414
+ description: "Payment methods (comma-separated): credit_card, interac_online, etc.",
3415
+ validators: [
3416
+ { type: "required", message: "At least one payment method is required" },
3417
+ {
3418
+ type: "custom",
3419
+ params: {
3420
+ validatorName: "commaSeparatedEnum",
3421
+ allowedValues: De
3422
+ },
3423
+ message: `Payment methods must be comma-separated values from: ${De.join(", ")}`
3424
+ }
3425
+ ],
3426
+ transform: { type: "lowercase" }
3427
+ },
3428
+ {
3429
+ key: "email",
3430
+ label: "Customer Email",
3431
+ type: "email",
3432
+ required: !0,
3433
+ description: "Customer's email address",
3434
+ validators: [
3435
+ { type: "required", message: "Customer email is required" },
3436
+ { type: "email", message: "Must be a valid email address" }
3437
+ ],
3438
+ transform: { type: "trim" }
3439
+ },
3440
+ {
3441
+ key: "item_name",
3442
+ label: "Item Name",
3443
+ type: "string",
3444
+ required: !0,
3445
+ description: "Name of the product or service",
3446
+ validators: [
3447
+ { type: "required", message: "Item name is required" },
3448
+ { type: "minLength", params: { value: 1 }, message: "Item name cannot be empty" },
3449
+ { type: "maxLength", params: { value: 255 }, message: "Item name must be 255 characters or less" }
3450
+ ],
3451
+ transform: { type: "trim" }
3452
+ },
3453
+ {
3454
+ key: "item_quantity",
3455
+ label: "Item Quantity",
3456
+ type: "integer",
3457
+ required: !0,
3458
+ description: "Number of items (whole number)",
3459
+ validators: [
3460
+ { type: "required", message: "Item quantity is required" },
3461
+ { type: "integer", message: "Item quantity must be a whole number" },
3462
+ { type: "min", params: { value: 1 }, message: "Item quantity must be at least 1" }
3463
+ ]
3464
+ },
3465
+ {
3466
+ key: "item_unit_price",
3467
+ label: "Item Unit Price",
3468
+ type: "float",
3469
+ required: !0,
3470
+ description: "Price per item (decimal number, no currency symbols)",
3471
+ validators: [
3472
+ { type: "required", message: "Item unit price is required" },
3473
+ { type: "float", message: "Item unit price must be a number" },
3474
+ { type: "min", params: { value: 0 }, message: "Item unit price cannot be negative" },
3475
+ {
3476
+ type: "pattern",
3477
+ params: { regex: "^[0-9]+(\\.[0-9]{1,2})?$" },
3478
+ message: "Item unit price must be a number with up to 2 decimal places (no currency symbols)",
3479
+ severity: "warning"
3480
+ }
3481
+ ]
3482
+ },
3483
+ {
3484
+ key: "item_type",
3485
+ label: "Item Type",
3486
+ type: "enum",
3487
+ required: !0,
3488
+ description: "Type of item: digital or physical",
3489
+ validators: [
3490
+ { type: "required", message: "Item type is required" },
3491
+ {
3492
+ type: "enum",
3493
+ params: { values: ht },
3494
+ message: `Item type must be one of: ${ht.join(", ")}`
3495
+ }
3496
+ ],
3497
+ transform: { type: "lowercase" }
3498
+ },
3499
+ {
3500
+ key: "udf1",
3501
+ label: "Custom Reference (UDF1)",
3502
+ type: "string",
3503
+ required: !0,
3504
+ description: "Your internal reference (invoice number, order ID, etc.)",
3505
+ validators: [
3506
+ { type: "required", message: "Custom reference (UDF1) is required" },
3507
+ { type: "maxLength", params: { value: 255 }, message: "Custom reference must be 255 characters or less" }
3508
+ ],
3509
+ transform: { type: "trim" }
3510
+ }
3511
+ ], Jr = [
3512
+ {
3513
+ key: "preferred_method",
3514
+ label: "Preferred Payment Method",
3515
+ type: "enum",
3516
+ required: !1,
3517
+ description: "Default payment method selected for customer",
3518
+ validators: [
3519
+ {
3520
+ type: "enum",
3521
+ params: { values: De },
3522
+ message: `Preferred method must be one of: ${De.join(", ")}`
3523
+ }
3524
+ ],
3525
+ transform: { type: "lowercase" }
3526
+ }
3527
+ ], Qr = [
3528
+ {
3529
+ key: "phone",
3530
+ label: "Phone Number",
3531
+ type: "phone",
3532
+ required: !1,
3533
+ description: "Customer phone number",
3534
+ validators: [
3535
+ { type: "phone", message: "Must be a valid phone number", severity: "warning" }
3536
+ ],
3537
+ transform: { type: "trim" }
3538
+ },
3539
+ {
3540
+ key: "billing_first_name",
3541
+ label: "Billing First Name",
3542
+ type: "string",
3543
+ required: !1,
3544
+ description: "Customer billing first name",
3545
+ validators: [
3546
+ { type: "maxLength", params: { value: 100 }, message: "First name must be 100 characters or less" }
3547
+ ],
3548
+ transform: { type: "trim" }
3549
+ },
3550
+ {
3551
+ key: "billing_last_name",
3552
+ label: "Billing Last Name",
3553
+ type: "string",
3554
+ required: !1,
3555
+ description: "Customer billing last name",
3556
+ validators: [
3557
+ { type: "maxLength", params: { value: 100 }, message: "Last name must be 100 characters or less" }
3558
+ ],
3559
+ transform: { type: "trim" }
3560
+ },
3561
+ {
3562
+ key: "billing_address",
3563
+ label: "Billing Address",
3564
+ type: "string",
3565
+ required: !1,
3566
+ description: "Customer billing street address",
3567
+ validators: [
3568
+ { type: "maxLength", params: { value: 255 }, message: "Address must be 255 characters or less" }
3569
+ ],
3570
+ transform: { type: "trim" }
3571
+ },
3572
+ {
3573
+ key: "billing_unit_number",
3574
+ label: "Billing Unit Number",
3575
+ type: "string",
3576
+ required: !1,
3577
+ description: "Apartment, suite, or unit number",
3578
+ validators: [
3579
+ { type: "maxLength", params: { value: 50 }, message: "Unit number must be 50 characters or less" }
3580
+ ],
3581
+ transform: { type: "trim" }
3582
+ },
3583
+ {
3584
+ key: "billing_city",
3585
+ label: "Billing City",
3586
+ type: "string",
3587
+ required: !1,
3588
+ description: "Customer billing city",
3589
+ validators: [
3590
+ { type: "maxLength", params: { value: 100 }, message: "City must be 100 characters or less" }
3591
+ ],
3592
+ transform: { type: "trim" }
3593
+ },
3594
+ {
3595
+ key: "billing_state",
3596
+ label: "Billing State/Province",
3597
+ type: "string",
3598
+ required: !1,
3599
+ description: "State or province code (e.g., ON, BC, CA)",
3600
+ validators: [
3601
+ { type: "maxLength", params: { value: 50 }, message: "State/Province must be 50 characters or less" }
3602
+ ],
3603
+ transform: { type: "trim" }
3604
+ },
3605
+ {
3606
+ key: "billing_country",
3607
+ label: "Billing Country",
3608
+ type: "string",
3609
+ required: !1,
3610
+ description: "Country name or code",
3611
+ validators: [
3612
+ { type: "maxLength", params: { value: 100 }, message: "Country must be 100 characters or less" }
3613
+ ],
3614
+ transform: { type: "trim" }
3615
+ },
3616
+ {
3617
+ key: "billing_zip_code",
3618
+ label: "Billing Postal/ZIP Code",
3619
+ type: "string",
3620
+ required: !1,
3621
+ description: "Postal or ZIP code",
3622
+ validators: [
3623
+ { type: "maxLength", params: { value: 20 }, message: "Postal code must be 20 characters or less" }
3624
+ ],
3625
+ transform: { type: "trim" }
3626
+ },
3627
+ {
3628
+ key: "billing_company",
3629
+ label: "Billing Company",
3630
+ type: "string",
3631
+ required: !1,
3632
+ description: "Company or business name",
3633
+ validators: [
3634
+ { type: "maxLength", params: { value: 255 }, message: "Company name must be 255 characters or less" }
3635
+ ],
3636
+ transform: { type: "trim" }
3637
+ }
3638
+ ], Gr = [
3639
+ {
3640
+ key: "shipping_first_name",
3641
+ label: "Shipping First Name",
3642
+ type: "string",
3643
+ required: !1,
3644
+ description: "Shipping recipient first name",
3645
+ transform: { type: "trim" }
3646
+ },
3647
+ {
3648
+ key: "shipping_last_name",
3649
+ label: "Shipping Last Name",
3650
+ type: "string",
3651
+ required: !1,
3652
+ description: "Shipping recipient last name",
3653
+ transform: { type: "trim" }
3654
+ },
3655
+ {
3656
+ key: "shipping_address",
3657
+ label: "Shipping Address",
3658
+ type: "string",
3659
+ required: !1,
3660
+ description: "Shipping street address",
3661
+ transform: { type: "trim" }
3662
+ },
3663
+ {
3664
+ key: "shipping_unit_number",
3665
+ label: "Shipping Unit Number",
3666
+ type: "string",
3667
+ required: !1,
3668
+ description: "Shipping apartment, suite, or unit number",
3669
+ transform: { type: "trim" }
3670
+ },
3671
+ {
3672
+ key: "shipping_city",
3673
+ label: "Shipping City",
3674
+ type: "string",
3675
+ required: !1,
3676
+ description: "Shipping city",
3677
+ transform: { type: "trim" }
3678
+ },
3679
+ {
3680
+ key: "shipping_state",
3681
+ label: "Shipping State/Province",
3682
+ type: "string",
3683
+ required: !1,
3684
+ description: "Shipping state or province",
3685
+ transform: { type: "trim" }
3686
+ },
3687
+ {
3688
+ key: "shipping_country",
3689
+ label: "Shipping Country",
3690
+ type: "string",
3691
+ required: !1,
3692
+ description: "Shipping country",
3693
+ transform: { type: "trim" }
3694
+ },
3695
+ {
3696
+ key: "shipping_zip_code",
3697
+ label: "Shipping Postal/ZIP Code",
3698
+ type: "string",
3699
+ required: !1,
3700
+ description: "Shipping postal or ZIP code",
3701
+ transform: { type: "trim" }
3702
+ }
3703
+ ], Xr = [
3704
+ {
3705
+ key: "item_description",
3706
+ label: "Item Description",
3707
+ type: "string",
3708
+ required: !1,
3709
+ description: "Detailed description of the item",
3710
+ validators: [
3711
+ { type: "maxLength", params: { value: 1e3 }, message: "Description must be 1000 characters or less" }
3712
+ ],
3713
+ transform: { type: "trim" }
3714
+ },
3715
+ {
3716
+ key: "item_sku",
3717
+ label: "Item SKU",
3718
+ type: "string",
3719
+ required: !1,
3720
+ description: "Product SKU or identifier",
3721
+ validators: [
3722
+ { type: "maxLength", params: { value: 100 }, message: "SKU must be 100 characters or less" }
3723
+ ],
3724
+ transform: { type: "trim" }
3725
+ },
3726
+ {
3727
+ key: "item_image_url",
3728
+ label: "Item Image URL",
3729
+ type: "url",
3730
+ required: !1,
3731
+ description: "URL to product image (must start with http:// or https://)",
3732
+ validators: [
3733
+ { type: "url", message: "Must be a valid URL starting with http:// or https://" }
3734
+ ],
3735
+ transform: { type: "trim" }
3736
+ },
3737
+ {
3738
+ key: "additional_items",
3739
+ label: "Additional Items",
3740
+ type: "string",
3741
+ required: !1,
3742
+ description: "Additional items in JSON format",
3743
+ transform: { type: "trim" }
3744
+ }
3745
+ ], ea = [
3746
+ {
3747
+ key: "email_recipients",
3748
+ label: "Email Recipients",
3749
+ type: "string",
3750
+ required: !1,
3751
+ description: "Additional email recipients for notifications",
3752
+ validators: [
3753
+ {
3754
+ type: "custom",
3755
+ params: { validatorName: "commaSeparatedEmails" },
3756
+ message: "Must be valid comma-separated email addresses",
3757
+ severity: "warning"
3758
+ }
3759
+ ],
3760
+ transform: { type: "trim" }
3761
+ },
3762
+ {
3763
+ key: "phone_recipients",
3764
+ label: "Phone Recipients",
3765
+ type: "string",
3766
+ required: !1,
3767
+ description: "SMS notification recipients",
3768
+ transform: { type: "trim" }
3769
+ },
3770
+ {
3771
+ key: "notification_info",
3772
+ label: "Notification Info",
3773
+ type: "string",
3774
+ required: !1,
3775
+ description: "Additional notification information",
3776
+ transform: { type: "trim" }
3777
+ }
3778
+ ], ta = [
3779
+ {
3780
+ key: "subscription_amount",
3781
+ label: "Subscription Amount",
3782
+ type: "float",
3783
+ required: !1,
3784
+ description: "Recurring subscription amount",
3785
+ validators: [
3786
+ { type: "float", message: "Subscription amount must be a number" },
3787
+ { type: "min", params: { value: 0 }, message: "Amount cannot be negative" }
3788
+ ]
3789
+ },
3790
+ {
3791
+ key: "billing_cycle_interval",
3792
+ label: "Billing Cycle Interval",
3793
+ type: "enum",
3794
+ required: !1,
3795
+ description: "Billing frequency: daily, weekly, monthly, yearly",
3796
+ validators: [
3797
+ {
3798
+ type: "enum",
3799
+ params: { values: yt },
3800
+ message: `Billing interval must be one of: ${yt.join(", ")}`
3801
+ }
3802
+ ],
3803
+ transform: { type: "lowercase" }
3804
+ },
3805
+ {
3806
+ key: "billing_cycle_interval_count",
3807
+ label: "Billing Cycle Count",
3808
+ type: "integer",
3809
+ required: !1,
3810
+ description: "Number of intervals between billing",
3811
+ validators: [
3812
+ { type: "integer", message: "Must be a whole number" },
3813
+ { type: "min", params: { value: 1 }, message: "Must be at least 1" }
3814
+ ]
3815
+ },
3816
+ {
3817
+ key: "billing_cycle_month",
3818
+ label: "Billing Cycle Month",
3819
+ type: "integer",
3820
+ required: !1,
3821
+ description: "Month for yearly billing (1-12)",
3822
+ validators: [
3823
+ { type: "integer", message: "Must be a whole number" },
3824
+ { type: "min", params: { value: 1 }, message: "Month must be 1-12" },
3825
+ { type: "max", params: { value: 12 }, message: "Month must be 1-12" }
3826
+ ]
3827
+ },
3828
+ {
3829
+ key: "billing_cycle_week",
3830
+ label: "Billing Cycle Week",
3831
+ type: "integer",
3832
+ required: !1,
3833
+ description: "Week number for billing",
3834
+ validators: [
3835
+ { type: "integer", message: "Must be a whole number" }
3836
+ ]
3837
+ },
3838
+ {
3839
+ key: "billing_cycle_day_of_month",
3840
+ label: "Billing Day of Month",
3841
+ type: "integer",
3842
+ required: !1,
3843
+ description: "Day of month for billing (1-31)",
3844
+ validators: [
3845
+ { type: "integer", message: "Must be a whole number" },
3846
+ { type: "min", params: { value: 1 }, message: "Day must be 1-31" },
3847
+ { type: "max", params: { value: 31 }, message: "Day must be 1-31" }
3848
+ ]
3849
+ },
3850
+ {
3851
+ key: "billing_cycle_day_of_week",
3852
+ label: "Billing Day of Week",
3853
+ type: "integer",
3854
+ required: !1,
3855
+ description: "Day of week for billing (0=Sunday, 6=Saturday)",
3856
+ validators: [
3857
+ { type: "integer", message: "Must be a whole number" },
3858
+ { type: "min", params: { value: 0 }, message: "Day must be 0-6" },
3859
+ { type: "max", params: { value: 6 }, message: "Day must be 0-6" }
3860
+ ]
3861
+ },
3862
+ {
3863
+ key: "billing_cycle_expression",
3864
+ label: "Billing Cycle Expression",
3865
+ type: "string",
3866
+ required: !1,
3867
+ description: "Cron expression for custom billing schedule",
3868
+ transform: { type: "trim" }
3869
+ },
3870
+ {
3871
+ key: "billing_cycle_weekday",
3872
+ label: "Billing Cycle Weekday",
3873
+ type: "boolean",
3874
+ required: !1,
3875
+ description: "Whether to bill only on weekdays"
3876
+ },
3877
+ {
3878
+ key: "billing_cycle_start_at",
3879
+ label: "Billing Cycle Start Date",
3880
+ type: "datetime",
3881
+ required: !1,
3882
+ description: "Start date for billing cycle (ISO 8601 format)",
3883
+ validators: [
3884
+ { type: "date", message: "Must be a valid date/time" }
3885
+ ]
3886
+ }
3887
+ ], ra = [
3888
+ {
3889
+ key: "return_url",
3890
+ label: "Return URL",
3891
+ type: "url",
3892
+ required: !1,
3893
+ description: "URL to redirect after successful payment",
3894
+ validators: [
3895
+ { type: "url", message: "Must be a valid URL starting with http:// or https://" }
3896
+ ],
3897
+ transform: { type: "trim" }
3898
+ },
3899
+ {
3900
+ key: "failed_return_url",
3901
+ label: "Failed Return URL",
3902
+ type: "url",
3903
+ required: !1,
3904
+ description: "URL to redirect after failed payment",
3905
+ validators: [
3906
+ { type: "url", message: "Must be a valid URL starting with http:// or https://" }
3907
+ ],
3908
+ transform: { type: "trim" }
3909
+ },
3910
+ {
3911
+ key: "merchant_ntf_url",
3912
+ label: "Merchant Notification URL",
3913
+ type: "url",
3914
+ required: !1,
3915
+ description: "Webhook URL for payment notifications",
3916
+ validators: [
3917
+ { type: "url", message: "Must be a valid URL starting with http:// or https://" }
3918
+ ],
3919
+ transform: { type: "trim" }
3920
+ }
3921
+ ], aa = [
3922
+ {
3923
+ key: "convinience_fee",
3924
+ label: "Convenience Fee",
3925
+ type: "float",
3926
+ required: !1,
3927
+ description: "Additional convenience fee amount",
3928
+ validators: [
3929
+ { type: "float", message: "Fee must be a number" },
3930
+ { type: "min", params: { value: 0 }, message: "Fee cannot be negative" }
3931
+ ]
3932
+ },
3933
+ {
3934
+ key: "udf2",
3935
+ label: "Custom Field 2 (UDF2)",
3936
+ type: "string",
3937
+ required: !1,
3938
+ description: "Additional custom reference field",
3939
+ validators: [
3940
+ { type: "maxLength", params: { value: 255 }, message: "Must be 255 characters or less" }
3941
+ ],
3942
+ transform: { type: "trim" }
3943
+ },
3944
+ {
3945
+ key: "udf3",
3946
+ label: "Custom Field 3 (UDF3)",
3947
+ type: "string",
3948
+ required: !1,
3949
+ description: "Additional custom reference field",
3950
+ validators: [
3951
+ { type: "maxLength", params: { value: 255 }, message: "Must be 255 characters or less" }
3952
+ ],
3953
+ transform: { type: "trim" }
3954
+ }
3955
+ ], sa = {
3956
+ columns: [
3957
+ ...Rt,
3958
+ ...Jr,
3959
+ ...Qr,
3960
+ ...Gr,
3961
+ ...Xr,
3962
+ ...ea,
3963
+ ...ta,
3964
+ ...ra,
3965
+ ...aa
3966
+ ]
3967
+ };
3968
+ Rt.map((a) => a.key);
3969
+ sa.columns.map((a) => a.key);
3970
+ var We = {
3971
+ passport: {
3972
+ type: "passport",
3973
+ label: "Canadian Passport",
3974
+ description: "A valid Canadian passport (not expired)",
3975
+ acceptedFormats: [".pdf", ".jpg", ".jpeg", ".png"],
3976
+ maxFileSize: 10 * 1024 * 1024,
3977
+ // 10MB
3978
+ estimatedProcessingTime: 8,
3979
+ requiredFields: [
3980
+ "fullName",
3981
+ "passportNumber",
3982
+ "dateOfBirth",
3983
+ "dateOfIssue",
3984
+ "dateOfExpiry",
3985
+ "placeOfBirth",
3986
+ "sex",
3987
+ "nationality"
3988
+ ]
3989
+ },
3990
+ drivers_license: {
3991
+ type: "drivers_license",
3992
+ label: "Canadian Driver's License",
3993
+ description: "A valid Canadian provincial or territorial driver's license",
3994
+ acceptedFormats: [".pdf", ".jpg", ".jpeg", ".png"],
3995
+ maxFileSize: 10 * 1024 * 1024,
3996
+ // 10MB
3997
+ estimatedProcessingTime: 8,
3998
+ requiredFields: [
3999
+ "fullName",
4000
+ "licenseNumber",
4001
+ "dateOfBirth",
4002
+ "expiryDate",
4003
+ "address",
4004
+ "province",
4005
+ "licenseClass"
4006
+ ]
4007
+ },
4008
+ proof_of_address: {
4009
+ type: "proof_of_address",
4010
+ label: "Proof of Address",
4011
+ description: "A document showing your current Canadian address (dated within 90 days)",
4012
+ acceptedFormats: [".pdf", ".jpg", ".jpeg", ".png"],
4013
+ maxFileSize: 10 * 1024 * 1024,
4014
+ // 10MB
4015
+ estimatedProcessingTime: 10,
4016
+ requiredFields: ["fullName", "address", "documentSubType", "issuer", "documentDate"]
4017
+ }
4018
+ };
4019
+ const ia = ({
4020
+ documentType: a,
4021
+ onFileSelect: e
4022
+ }) => {
4023
+ const { documents: t, setDocumentFile: r, isLoading: s } = ye(), i = t.get(a), n = We[a], o = gt(
4024
+ (D, He) => {
4025
+ if (!(He.length > 0) && D.length > 0) {
4026
+ const Z = D[0];
4027
+ r(a, Z), e == null || e(Z);
4028
+ }
4029
+ },
4030
+ [a, e, r]
4031
+ ), { getRootProps: d, getInputProps: h, isDragActive: x } = Kt({
4032
+ onDrop: o,
4033
+ accept: {
4034
+ "application/pdf": [".pdf"],
4035
+ "image/jpeg": [".jpg", ".jpeg"],
4036
+ "image/png": [".png"]
4037
+ },
4038
+ maxSize: n.maxFileSize,
4039
+ multiple: !1,
4040
+ disabled: s
4041
+ }), M = (D) => D < 1024 ? `${D} B` : D < 1024 * 1024 ? `${(D / 1024).toFixed(1)} KB` : `${(D / (1024 * 1024)).toFixed(1)} MB`, ie = () => {
4042
+ var D;
4043
+ return ((D = i == null ? void 0 : i.file) == null ? void 0 : D.type) === "application/pdf" ? /* @__PURE__ */ c(_t, { className: "ff-w-6 ff-h-6" }) : /* @__PURE__ */ c(tr, { className: "ff-w-6 ff-h-6" });
4044
+ }, Ie = (D) => {
4045
+ D.stopPropagation(), ye.getState().clearDocumentPreview(a), r(a, null);
4046
+ };
4047
+ return i != null && i.file && i.previewUrl ? /* @__PURE__ */ v("div", { className: "ff-space-y-4", children: [
4048
+ /* @__PURE__ */ c("div", { className: "ff-bg-primary-50 ff-border ff-border-primary-200 ff-rounded-lg ff-p-4", children: /* @__PURE__ */ v("div", { className: "ff-flex ff-items-center ff-gap-3", children: [
4049
+ /* @__PURE__ */ c("div", { className: "ff-p-2 ff-bg-primary-100 ff-rounded-lg ff-text-primary-600", children: ie() }),
4050
+ /* @__PURE__ */ v("div", { className: "ff-flex-1 ff-min-w-0", children: [
4051
+ /* @__PURE__ */ c("p", { className: "ff-font-medium ff-text-primary-900 ff-truncate", children: i.file.name }),
4052
+ /* @__PURE__ */ c("p", { className: "ff-text-sm ff-text-primary-600", children: M(i.file.size) })
4053
+ ] }),
4054
+ /* @__PURE__ */ c(
4055
+ "button",
4056
+ {
4057
+ onClick: Ie,
4058
+ className: "ff-p-1.5 ff-text-primary-600 hover:ff-text-primary-800 hover:ff-bg-primary-100 ff-rounded-full ff-transition-colors",
4059
+ "aria-label": "Remove file",
4060
+ children: /* @__PURE__ */ c(vt, { className: "ff-w-5 ff-h-5" })
4061
+ }
4062
+ )
4063
+ ] }) }),
4064
+ /* @__PURE__ */ c("div", { className: "ff-document-preview ff-aspect-[3/4] ff-max-h-96", children: i.file.type === "application/pdf" ? /* @__PURE__ */ c(
4065
+ "iframe",
4066
+ {
4067
+ src: i.previewUrl,
4068
+ className: "ff-w-full ff-h-full ff-rounded-lg",
4069
+ title: "Document preview"
4070
+ }
4071
+ ) : /* @__PURE__ */ c(
4072
+ "img",
4073
+ {
4074
+ src: i.previewUrl,
4075
+ alt: "Document preview",
4076
+ className: "ff-w-full ff-h-full ff-object-contain ff-rounded-lg"
4077
+ }
4078
+ ) })
4079
+ ] }) : /* @__PURE__ */ v("div", { className: "ff-space-y-4", children: [
4080
+ /* @__PURE__ */ v("div", { className: "ff-text-center ff-mb-4", children: [
4081
+ /* @__PURE__ */ c("h3", { className: "ff-text-lg ff-font-semibold ff-text-gray-900", children: n.label }),
4082
+ /* @__PURE__ */ c("p", { className: "ff-text-sm ff-text-gray-500 ff-mt-1", children: n.description })
4083
+ ] }),
4084
+ /* @__PURE__ */ v(
4085
+ "div",
4086
+ {
4087
+ ...d(),
4088
+ className: R(
4089
+ "ff-dropzone ff-min-h-[200px]",
4090
+ x && "ff-dropzone-active",
4091
+ s && "ff-opacity-50 ff-cursor-not-allowed"
4092
+ ),
4093
+ children: [
4094
+ /* @__PURE__ */ c("input", { ...h() }),
4095
+ /* @__PURE__ */ v("div", { className: "ff-flex ff-flex-col ff-items-center ff-gap-4", children: [
4096
+ /* @__PURE__ */ c(
4097
+ "div",
4098
+ {
4099
+ className: R(
4100
+ "ff-p-4 ff-rounded-full",
4101
+ x ? "ff-bg-primary-100" : "ff-bg-gray-100"
4102
+ ),
4103
+ children: /* @__PURE__ */ c(
4104
+ Jt,
4105
+ {
4106
+ className: R(
4107
+ "ff-w-10 ff-h-10",
4108
+ x ? "ff-text-primary-600" : "ff-text-gray-400"
4109
+ )
4110
+ }
4111
+ )
4112
+ }
4113
+ ),
4114
+ /* @__PURE__ */ v("div", { className: "ff-text-center", children: [
4115
+ /* @__PURE__ */ c("p", { className: "ff-text-base ff-font-medium ff-text-gray-700", children: x ? "Drop your document here" : "Upload your document" }),
4116
+ /* @__PURE__ */ v("p", { className: "ff-text-sm ff-text-gray-500 ff-mt-1", children: [
4117
+ "Drag & drop or",
4118
+ " ",
4119
+ /* @__PURE__ */ c("span", { className: "ff-text-primary-600 ff-font-medium", children: "browse files" })
4120
+ ] })
4121
+ ] }),
4122
+ /* @__PURE__ */ v("div", { className: "ff-flex ff-flex-wrap ff-justify-center ff-gap-2 ff-text-xs ff-text-gray-400", children: [
4123
+ n.acceptedFormats.map((D) => /* @__PURE__ */ c("span", { className: "ff-px-2 ff-py-1 ff-bg-gray-100 ff-rounded", children: D.toUpperCase() }, D)),
4124
+ /* @__PURE__ */ v("span", { className: "ff-px-2 ff-py-1", children: [
4125
+ "Max ",
4126
+ M(n.maxFileSize)
4127
+ ] })
4128
+ ] })
4129
+ ] })
4130
+ ]
4131
+ }
4132
+ ),
4133
+ (i == null ? void 0 : i.error) && /* @__PURE__ */ v("div", { className: "ff-flex ff-items-center ff-gap-2 ff-p-3 ff-bg-error-50 ff-text-error-700 ff-rounded-lg", children: [
4134
+ /* @__PURE__ */ c(Qt, { className: "ff-w-4 ff-h-4 ff-flex-shrink-0" }),
4135
+ /* @__PURE__ */ c("p", { className: "ff-text-sm", children: i.error })
4136
+ ] }),
4137
+ /* @__PURE__ */ v("div", { className: "ff-bg-gray-50 ff-rounded-lg ff-p-4", children: [
4138
+ /* @__PURE__ */ c("h4", { className: "ff-text-sm ff-font-medium ff-text-gray-700 ff-mb-2", children: "Tips for best results:" }),
4139
+ /* @__PURE__ */ v("ul", { className: "ff-text-sm ff-text-gray-500 ff-space-y-1 ff-list-disc ff-list-inside", children: [
4140
+ /* @__PURE__ */ c("li", { children: "Ensure all text is clearly visible and readable" }),
4141
+ /* @__PURE__ */ c("li", { children: "Avoid glare, shadows, or blurry images" }),
4142
+ /* @__PURE__ */ c("li", { children: "Include all four corners of the document" }),
4143
+ /* @__PURE__ */ c("li", { children: "Use good lighting when taking photos" })
4144
+ ] })
4145
+ ] })
4146
+ ] });
4147
+ }, na = ({
4148
+ documentType: a,
4149
+ showDetails: e = !0
4150
+ }) => {
4151
+ const { documents: t } = ye(), r = t.get(a), s = We[a], n = ((d) => {
4152
+ switch (d) {
4153
+ case "completed":
4154
+ return {
4155
+ icon: Me,
4156
+ color: "ff-text-success-600",
4157
+ bgColor: "ff-bg-success-100",
4158
+ label: "Verified",
4159
+ description: "Document successfully processed"
4160
+ };
4161
+ case "requires_review":
4162
+ return {
4163
+ icon: et,
4164
+ color: "ff-text-warning-600",
4165
+ bgColor: "ff-bg-warning-100",
4166
+ label: "Review Required",
4167
+ description: "Manual verification may be needed"
4168
+ };
4169
+ case "failed":
4170
+ return {
4171
+ icon: Xe,
4172
+ color: "ff-text-error-600",
4173
+ bgColor: "ff-bg-error-100",
4174
+ label: "Failed",
4175
+ description: "Unable to process document"
4176
+ };
4177
+ case "processing":
4178
+ return {
4179
+ icon: Ee,
4180
+ color: "ff-text-primary-600",
4181
+ bgColor: "ff-bg-primary-100",
4182
+ label: "Processing",
4183
+ description: "Analyzing document..."
4184
+ };
4185
+ case "uploaded":
4186
+ return {
4187
+ icon: tt,
4188
+ color: "ff-text-gray-600",
4189
+ bgColor: "ff-bg-gray-100",
4190
+ label: "Pending",
4191
+ description: "Waiting to be processed"
4192
+ };
4193
+ default:
4194
+ return {
4195
+ icon: tt,
4196
+ color: "ff-text-gray-400",
4197
+ bgColor: "ff-bg-gray-100",
4198
+ label: "Not Uploaded",
4199
+ description: "Upload document to continue"
4200
+ };
4201
+ }
4202
+ })(r == null ? void 0 : r.status), o = n.icon;
4203
+ return /* @__PURE__ */ v("div", { className: "ff-space-y-3", children: [
4204
+ /* @__PURE__ */ v("div", { className: "ff-flex ff-items-center ff-gap-3", children: [
4205
+ /* @__PURE__ */ c("div", { className: R("ff-p-2 ff-rounded-lg", n.bgColor), children: /* @__PURE__ */ c(
4206
+ o,
4207
+ {
4208
+ className: R(
4209
+ "ff-w-5 ff-h-5",
4210
+ n.color,
4211
+ (r == null ? void 0 : r.status) === "processing" && "ff-animate-spin"
4212
+ )
4213
+ }
4214
+ ) }),
4215
+ /* @__PURE__ */ v("div", { children: [
4216
+ /* @__PURE__ */ c("p", { className: "ff-font-medium ff-text-gray-900", children: s.label }),
4217
+ /* @__PURE__ */ c("p", { className: R("ff-text-sm", n.color), children: n.label })
4218
+ ] })
4219
+ ] }),
4220
+ (r == null ? void 0 : r.confidence) !== void 0 && r.confidence > 0 && /* @__PURE__ */ v("div", { className: "ff-space-y-1", children: [
4221
+ /* @__PURE__ */ v("div", { className: "ff-flex ff-items-center ff-justify-between ff-text-sm", children: [
4222
+ /* @__PURE__ */ c("span", { className: "ff-text-gray-600", children: "Confidence" }),
4223
+ /* @__PURE__ */ v(
4224
+ "span",
4225
+ {
4226
+ className: R(
4227
+ "ff-font-medium",
4228
+ r.confidence >= 0.8 && "ff-text-success-600",
4229
+ r.confidence >= 0.6 && r.confidence < 0.8 && "ff-text-warning-600",
4230
+ r.confidence < 0.6 && "ff-text-error-600"
4231
+ ),
4232
+ children: [
4233
+ Math.round(r.confidence * 100),
4234
+ "%"
4235
+ ]
4236
+ }
4237
+ )
4238
+ ] }),
4239
+ /* @__PURE__ */ c("div", { className: "ff-progress", children: /* @__PURE__ */ c(
4240
+ "div",
4241
+ {
4242
+ className: R(
4243
+ "ff-progress-bar",
4244
+ r.confidence >= 0.8 && "ff-bg-success-500",
4245
+ r.confidence >= 0.6 && r.confidence < 0.8 && "ff-bg-warning-500",
4246
+ r.confidence < 0.6 && "ff-bg-error-500"
4247
+ ),
4248
+ style: { width: `${r.confidence * 100}%` }
4249
+ }
4250
+ ) })
4251
+ ] }),
4252
+ e && (r == null ? void 0 : r.fraudFlags) && r.fraudFlags.length > 0 && /* @__PURE__ */ v("div", { className: "ff-space-y-2", children: [
4253
+ /* @__PURE__ */ c("p", { className: "ff-text-sm ff-font-medium ff-text-gray-700", children: "Issues Detected" }),
4254
+ /* @__PURE__ */ c("div", { className: "ff-space-y-1", children: r.fraudFlags.map((d, h) => /* @__PURE__ */ v(
4255
+ "div",
4256
+ {
4257
+ className: R(
4258
+ "ff-flex ff-items-start ff-gap-2 ff-p-2 ff-rounded ff-text-sm",
4259
+ d.severity === "high" && "ff-bg-error-50 ff-text-error-700",
4260
+ d.severity === "medium" && "ff-bg-warning-50 ff-text-warning-700",
4261
+ d.severity === "low" && "ff-bg-gray-50 ff-text-gray-600"
4262
+ ),
4263
+ children: [
4264
+ d.severity === "high" ? /* @__PURE__ */ c(Xe, { className: "ff-w-4 ff-h-4 ff-flex-shrink-0 ff-mt-0.5" }) : /* @__PURE__ */ c(et, { className: "ff-w-4 ff-h-4 ff-flex-shrink-0 ff-mt-0.5" }),
4265
+ /* @__PURE__ */ c("span", { children: d.message })
4266
+ ]
4267
+ },
4268
+ h
4269
+ )) })
4270
+ ] }),
4271
+ e && (r == null ? void 0 : r.extractedData) && r.status === "completed" && /* @__PURE__ */ v("div", { className: "ff-bg-gray-50 ff-rounded-lg ff-p-3", children: [
4272
+ /* @__PURE__ */ c("p", { className: "ff-text-sm ff-font-medium ff-text-gray-700 ff-mb-2", children: "Extracted Information" }),
4273
+ /* @__PURE__ */ v("dl", { className: "ff-space-y-1 ff-text-sm", children: [
4274
+ "fullName" in r.extractedData && /* @__PURE__ */ v("div", { className: "ff-flex ff-justify-between", children: [
4275
+ /* @__PURE__ */ c("dt", { className: "ff-text-gray-500", children: "Name" }),
4276
+ /* @__PURE__ */ c("dd", { className: "ff-text-gray-900 ff-font-medium", children: r.extractedData.fullName })
4277
+ ] }),
4278
+ "dateOfBirth" in r.extractedData && /* @__PURE__ */ v("div", { className: "ff-flex ff-justify-between", children: [
4279
+ /* @__PURE__ */ c("dt", { className: "ff-text-gray-500", children: "Date of Birth" }),
4280
+ /* @__PURE__ */ c("dd", { className: "ff-text-gray-900", children: r.extractedData.dateOfBirth })
4281
+ ] }),
4282
+ r.extractedData.documentType === "passport" && "passportNumber" in r.extractedData && /* @__PURE__ */ v("div", { className: "ff-flex ff-justify-between", children: [
4283
+ /* @__PURE__ */ c("dt", { className: "ff-text-gray-500", children: "Passport #" }),
4284
+ /* @__PURE__ */ c("dd", { className: "ff-text-gray-900 ff-font-mono", children: r.extractedData.passportNumber })
4285
+ ] }),
4286
+ r.extractedData.documentType === "drivers_license" && "licenseNumber" in r.extractedData && /* @__PURE__ */ v("div", { className: "ff-flex ff-justify-between", children: [
4287
+ /* @__PURE__ */ c("dt", { className: "ff-text-gray-500", children: "License #" }),
4288
+ /* @__PURE__ */ c("dd", { className: "ff-text-gray-900 ff-font-mono", children: r.extractedData.licenseNumber })
4289
+ ] }),
4290
+ "address" in r.extractedData && r.extractedData.address && /* @__PURE__ */ v("div", { className: "ff-flex ff-justify-between", children: [
4291
+ /* @__PURE__ */ c("dt", { className: "ff-text-gray-500", children: "Address" }),
4292
+ /* @__PURE__ */ v("dd", { className: "ff-text-gray-900 ff-text-right", children: [
4293
+ r.extractedData.address.city,
4294
+ ",",
4295
+ " ",
4296
+ r.extractedData.address.province
4297
+ ] })
4298
+ ] })
4299
+ ] })
4300
+ ] })
4301
+ ] });
4302
+ }, oa = {
4303
+ passport: _t,
4304
+ drivers_license: Xt,
4305
+ proof_of_address: er
4306
+ }, ma = ({
4307
+ requiredDocuments: a,
4308
+ onComplete: e,
4309
+ onCancel: t,
4310
+ onError: r
4311
+ }) => {
4312
+ const {
4313
+ sessionId: s,
4314
+ step: i,
4315
+ currentDocumentType: n,
4316
+ documents: o,
4317
+ isVerified: d,
4318
+ verificationStatus: h,
4319
+ isLoading: x,
4320
+ error: M,
4321
+ setSessionId: ie,
4322
+ setRequiredDocuments: Ie,
4323
+ setCurrentDocumentType: D,
4324
+ setDocumentStatus: He,
4325
+ setDocumentData: Z,
4326
+ setStep: Y,
4327
+ nextDocument: Et,
4328
+ setVerificationStatus: Mt,
4329
+ setVerified: jt,
4330
+ setLoading: ee,
4331
+ setError: me,
4332
+ areAllDocumentsUploaded: Ke,
4333
+ areAllDocumentsProcessed: Je,
4334
+ reset: Zt
4335
+ } = ye(), [la, W] = Yt(null);
4336
+ Wt(() => (Ie(a), Ft(), () => {
4337
+ W(null);
4338
+ }), [a]);
4339
+ const Ft = async () => {
4340
+ try {
4341
+ ee(!0);
4342
+ const C = await he().createKYCSession(a);
4343
+ ie(C.sessionId), Y("upload");
4344
+ } catch (S) {
4345
+ const C = S;
4346
+ me(C.message), r == null || r(C);
4347
+ } finally {
4348
+ ee(!1);
4349
+ }
4350
+ }, Pt = gt(
4351
+ async (S) => {
4352
+ if (!(!s || !n))
4353
+ try {
4354
+ ee(!0), me(null);
4355
+ const O = await he().uploadKYCDocument(s, n, S);
4356
+ Z(n, {
4357
+ id: O.documentId,
4358
+ status: "processing"
4359
+ }), W(O.documentId), qt(O.documentId);
4360
+ } catch (C) {
4361
+ const O = C;
4362
+ Z(n, {
4363
+ status: "failed",
4364
+ error: O.message
4365
+ }), r == null || r(O);
4366
+ } finally {
4367
+ ee(!1);
4368
+ }
4369
+ },
4370
+ [s, n]
4371
+ ), qt = async (S) => {
4372
+ let H = 0, ne = 0;
4373
+ const Oe = async () => {
4374
+ var Qe;
4375
+ if (H >= 30) {
4376
+ W(null), n && Z(n, {
4377
+ status: "failed",
4378
+ error: "Processing timed out. Please try again."
4379
+ });
4380
+ return;
4381
+ }
4382
+ if (ne >= 3) {
4383
+ W(null), n && Z(n, {
4384
+ status: "failed",
4385
+ error: "Failed to check document status. Please refresh and try again."
4386
+ });
4387
+ return;
4388
+ }
4389
+ try {
4390
+ const q = (await he().getKYCDocument(S)).document;
4391
+ ne = 0;
4392
+ const Vt = q.type;
4393
+ if (Z(Vt, {
4394
+ id: q.id,
4395
+ status: q.status,
4396
+ extractedData: q.extractedData,
4397
+ confidence: q.confidence,
4398
+ fraudFlags: q.fraudFlags,
4399
+ error: null
4400
+ // Clear any previous errors
4401
+ }), q.status === "completed" || q.status === "requires_review" || q.status === "failed") {
4402
+ W(null), Ke() ? Je() && Y("review") : Et();
4403
+ return;
4404
+ }
4405
+ H++, setTimeout(Oe, 2e3);
4406
+ } catch (Ge) {
4407
+ const pe = Ge;
4408
+ if (ne++, H++, pe.status === 404 || (Qe = pe.message) != null && Qe.includes("not found")) {
4409
+ W(null), n && Z(n, {
4410
+ status: "failed",
4411
+ error: "Session not found or invalid state"
4412
+ });
4413
+ return;
4414
+ }
4415
+ ne < 3 ? setTimeout(Oe, 3e3 * ne) : (W(null), n && Z(n, {
4416
+ status: "failed",
4417
+ error: pe.message || "Failed to process document"
4418
+ }));
4419
+ }
4420
+ };
4421
+ Oe();
4422
+ }, Lt = async () => {
4423
+ if (s)
4424
+ try {
4425
+ ee(!0), me(null);
4426
+ const C = await he().verifyKYCSession(s, !0);
4427
+ Mt(C.verificationStatus);
4428
+ const O = C.verificationStatus;
4429
+ jt(O.isVerified), Y("complete"), e == null || e(C);
4430
+ } catch (S) {
4431
+ const C = S;
4432
+ me(C.message), r == null || r(C);
4433
+ } finally {
4434
+ ee(!1);
4435
+ }
4436
+ }, $t = () => {
4437
+ Zt(), t == null || t();
4438
+ }, Bt = (S) => {
4439
+ D(S), Y("upload");
4440
+ }, Ut = (S) => {
4441
+ const C = o.get(S);
4442
+ return (C == null ? void 0 : C.status) === "completed" || (C == null ? void 0 : C.status) === "requires_review";
4443
+ };
4444
+ return /* @__PURE__ */ v("div", { className: "ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-flex ff-flex-col ff-max-h-[90vh]", children: [
4445
+ /* @__PURE__ */ v("div", { className: "ff-flex ff-items-center ff-justify-between ff-px-6 ff-py-4 ff-border-b ff-border-gray-200 ff-bg-gray-50 ff-flex-shrink-0", children: [
4446
+ /* @__PURE__ */ v("div", { className: "ff-flex ff-items-center ff-gap-3", children: [
4447
+ /* @__PURE__ */ c(rt, { className: "ff-w-6 ff-h-6 ff-text-primary-600" }),
4448
+ /* @__PURE__ */ c("h2", { className: "ff-text-xl ff-font-semibold ff-text-gray-900", children: "Identity Verification" })
4449
+ ] }),
4450
+ /* @__PURE__ */ c(
4451
+ "button",
4452
+ {
4453
+ onClick: $t,
4454
+ className: "ff-p-2 ff-text-gray-400 hover:ff-text-gray-600 ff-rounded-full hover:ff-bg-gray-100",
4455
+ children: /* @__PURE__ */ c(vt, { className: "ff-w-5 ff-h-5" })
4456
+ }
4457
+ )
4458
+ ] }),
4459
+ /* @__PURE__ */ v("div", { className: "ff-p-6 ff-overflow-y-auto ff-flex-1 ff-min-h-0", children: [
4460
+ M && /* @__PURE__ */ c("div", { className: "ff-mb-4 ff-p-4 ff-bg-error-50 ff-border ff-border-error-200 ff-rounded-lg ff-text-error-700", children: M }),
4461
+ i === "select" && /* @__PURE__ */ v("div", { className: "ff-space-y-4", children: [
4462
+ /* @__PURE__ */ c("p", { className: "ff-text-gray-600 ff-text-center ff-mb-6", children: "Please upload the following documents to verify your identity" }),
4463
+ /* @__PURE__ */ c("div", { className: "ff-grid ff-gap-4", children: a.map((S) => {
4464
+ const C = oa[S], O = We[S];
4465
+ o.get(S);
4466
+ const H = Ut(S);
4467
+ return /* @__PURE__ */ v(
4468
+ "button",
4469
+ {
4470
+ onClick: () => Bt(S),
4471
+ className: R(
4472
+ "ff-flex ff-items-center ff-gap-4 ff-p-4 ff-rounded-lg ff-border-2 ff-text-left ff-transition-all",
4473
+ H ? "ff-border-success-300 ff-bg-success-50" : "ff-border-gray-200 hover:ff-border-primary-300 hover:ff-bg-primary-50"
4474
+ ),
4475
+ children: [
4476
+ /* @__PURE__ */ c(
4477
+ "div",
4478
+ {
4479
+ className: R(
4480
+ "ff-p-3 ff-rounded-lg",
4481
+ H ? "ff-bg-success-100" : "ff-bg-gray-100"
4482
+ ),
4483
+ children: H ? /* @__PURE__ */ c(Me, { className: "ff-w-6 ff-h-6 ff-text-success-600" }) : /* @__PURE__ */ c(C, { className: "ff-w-6 ff-h-6 ff-text-gray-600" })
4484
+ }
4485
+ ),
4486
+ /* @__PURE__ */ v("div", { className: "ff-flex-1", children: [
4487
+ /* @__PURE__ */ c("p", { className: "ff-font-medium ff-text-gray-900", children: O.label }),
4488
+ /* @__PURE__ */ c("p", { className: "ff-text-sm ff-text-gray-500", children: O.description })
4489
+ ] }),
4490
+ /* @__PURE__ */ c(Gt, { className: "ff-w-5 ff-h-5 ff-text-gray-400" })
4491
+ ]
4492
+ },
4493
+ S
4494
+ );
4495
+ }) })
4496
+ ] }),
4497
+ i === "upload" && n && /* @__PURE__ */ c("div", { className: "ff-max-w-lg ff-mx-auto", children: /* @__PURE__ */ c(ia, { documentType: n, onFileSelect: Pt }) }),
4498
+ i === "processing" && /* @__PURE__ */ v("div", { className: "ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12", children: [
4499
+ /* @__PURE__ */ c(Ee, { className: "ff-w-12 ff-h-12 ff-text-primary-600 ff-animate-spin ff-mb-4" }),
4500
+ /* @__PURE__ */ c("h3", { className: "ff-text-lg ff-font-semibold ff-text-gray-900 ff-mb-2", children: "Processing Documents" }),
4501
+ /* @__PURE__ */ c("p", { className: "ff-text-gray-500 ff-text-center", children: "We're analyzing your documents. This may take a moment..." })
4502
+ ] }),
4503
+ i === "review" && /* @__PURE__ */ v("div", { className: "ff-space-y-6", children: [
4504
+ /* @__PURE__ */ v("div", { className: "ff-text-center ff-mb-6", children: [
4505
+ /* @__PURE__ */ c("h3", { className: "ff-text-lg ff-font-semibold ff-text-gray-900", children: "Review Your Documents" }),
4506
+ /* @__PURE__ */ c("p", { className: "ff-text-gray-500", children: "Please review the extracted information before completing verification" })
4507
+ ] }),
4508
+ /* @__PURE__ */ c("div", { className: "ff-grid ff-gap-4", children: a.map((S) => /* @__PURE__ */ c(
4509
+ "div",
4510
+ {
4511
+ className: "ff-border ff-border-gray-200 ff-rounded-lg ff-p-4",
4512
+ children: /* @__PURE__ */ c(na, { documentType: S, showDetails: !0 })
4513
+ },
4514
+ S
4515
+ )) })
4516
+ ] }),
4517
+ i === "complete" && /* @__PURE__ */ v("div", { className: "ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12", children: [
4518
+ /* @__PURE__ */ c(
4519
+ "div",
4520
+ {
4521
+ className: R(
4522
+ "ff-w-16 ff-h-16 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4",
4523
+ d ? "ff-bg-success-100" : "ff-bg-warning-100"
4524
+ ),
4525
+ children: d ? /* @__PURE__ */ c(Me, { className: "ff-w-10 ff-h-10 ff-text-success-600" }) : /* @__PURE__ */ c(rt, { className: "ff-w-10 ff-h-10 ff-text-warning-600" })
4526
+ }
4527
+ ),
4528
+ /* @__PURE__ */ c("h3", { className: "ff-text-xl ff-font-semibold ff-text-gray-900 ff-mb-2", children: d ? "Verification Complete!" : "Review Required" }),
4529
+ /* @__PURE__ */ c("p", { className: "ff-text-gray-500 ff-text-center", children: d ? "Your identity has been successfully verified." : "Additional review may be required. We will contact you if needed." })
4530
+ ] })
4531
+ ] }),
4532
+ i !== "complete" && /* @__PURE__ */ v("div", { className: "ff-flex ff-items-center ff-justify-between ff-px-6 ff-py-4 ff-border-t ff-border-gray-200 ff-bg-gray-50 ff-flex-shrink-0", children: [
4533
+ /* @__PURE__ */ c(
4534
+ "button",
4535
+ {
4536
+ onClick: () => {
4537
+ (i === "upload" || i === "review") && Y("select");
4538
+ },
4539
+ disabled: x,
4540
+ className: "ff-btn ff-btn-secondary",
4541
+ children: "Back"
4542
+ }
4543
+ ),
4544
+ i === "review" && /* @__PURE__ */ c(
4545
+ "button",
4546
+ {
4547
+ onClick: Lt,
4548
+ disabled: x || !Je(),
4549
+ className: "ff-btn ff-btn-primary",
4550
+ children: x ? /* @__PURE__ */ v(zt, { children: [
4551
+ /* @__PURE__ */ c(Ee, { className: "ff-w-4 ff-h-4 ff-mr-2 ff-animate-spin" }),
4552
+ "Verifying..."
4553
+ ] }) : "Complete Verification"
4554
+ }
4555
+ ),
4556
+ i === "select" && Ke() && /* @__PURE__ */ c(
4557
+ "button",
4558
+ {
4559
+ onClick: () => Y("review"),
4560
+ className: "ff-btn ff-btn-primary",
4561
+ children: "Review & Verify"
4562
+ }
4563
+ )
4564
+ ] })
4565
+ ] });
4566
+ };
4567
+ export {
4568
+ St as C,
4569
+ ia as D,
4570
+ ma as K,
4571
+ na as a,
4572
+ We as b,
4573
+ ye as u
4574
+ };
4575
+ //# sourceMappingURL=KYCWizard-D3Leb4rK.mjs.map