@jsdev_ninja/core 0.8.50 → 0.8.51

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