@jsdev_ninja/core 0.12.7 → 0.12.9

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 (57) hide show
  1. package/dist/core.cjs.js +1 -1
  2. package/dist/core.cjs.js.map +1 -1
  3. package/dist/core.es.js +988 -837
  4. package/dist/core.es.js.map +1 -1
  5. package/dist/core.umd.js +1 -1
  6. package/dist/core.umd.js.map +1 -1
  7. package/dist/entities/Discount/__tests__/engine.test.d.ts +2 -0
  8. package/dist/entities/Discount/__tests__/engine.test.d.ts.map +1 -0
  9. package/dist/entities/Discount/__tests__/engine.test.js +298 -0
  10. package/dist/entities/Discount/__tests__/factory.test.d.ts +2 -0
  11. package/dist/entities/Discount/__tests__/factory.test.d.ts.map +1 -0
  12. package/dist/entities/Discount/__tests__/factory.test.js +75 -0
  13. package/dist/entities/Discount/__tests__/integration.test.d.ts +2 -0
  14. package/dist/entities/Discount/__tests__/integration.test.d.ts.map +1 -0
  15. package/dist/entities/Discount/__tests__/integration.test.js +115 -0
  16. package/dist/entities/Discount/__tests__/simple.test.d.ts +2 -0
  17. package/dist/entities/Discount/__tests__/simple.test.d.ts.map +1 -0
  18. package/dist/entities/Discount/__tests__/simple.test.js +186 -0
  19. package/dist/entities/Discount/__tests__/utils.test.d.ts +2 -0
  20. package/dist/entities/Discount/__tests__/utils.test.d.ts.map +1 -0
  21. package/dist/entities/Discount/__tests__/utils.test.js +55 -0
  22. package/dist/entities/Discount/engine.d.ts +29 -0
  23. package/dist/entities/Discount/engine.d.ts.map +1 -0
  24. package/dist/entities/Discount/engine.js +80 -0
  25. package/dist/entities/Discount/factory.d.ts +10 -0
  26. package/dist/entities/Discount/factory.d.ts.map +1 -0
  27. package/dist/entities/Discount/factory.js +18 -0
  28. package/dist/entities/Discount/index.d.ts +9 -0
  29. package/dist/entities/Discount/index.d.ts.map +1 -0
  30. package/dist/entities/Discount/index.js +8 -0
  31. package/dist/entities/Discount/strategies/BundleStrategy.d.ts +12 -0
  32. package/dist/entities/Discount/strategies/BundleStrategy.d.ts.map +1 -0
  33. package/dist/entities/Discount/strategies/BundleStrategy.js +78 -0
  34. package/dist/entities/Discount/strategies/__tests__/BundleStrategy.test.d.ts +2 -0
  35. package/dist/entities/Discount/strategies/__tests__/BundleStrategy.test.d.ts.map +1 -0
  36. package/dist/entities/Discount/strategies/__tests__/BundleStrategy.test.js +265 -0
  37. package/dist/entities/Discount/strategy.d.ts +6 -0
  38. package/dist/entities/Discount/strategy.d.ts.map +1 -0
  39. package/dist/entities/Discount/strategy.js +1 -0
  40. package/dist/entities/Discount/types.d.ts +148 -0
  41. package/dist/entities/Discount/types.d.ts.map +1 -0
  42. package/dist/entities/Discount/types.js +29 -0
  43. package/dist/entities/Discount/utils.d.ts +29 -0
  44. package/dist/entities/Discount/utils.d.ts.map +1 -0
  45. package/dist/entities/Discount/utils.js +39 -0
  46. package/dist/tsconfig.app.tsbuildinfo +1 -1
  47. package/dist/utils/index.d.ts.map +1 -1
  48. package/dist/utils/index.js +27 -63
  49. package/lib/entities/Discount/strategies/BundleStrategy.ts +115 -119
  50. package/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.ts +12 -7
  51. package/lib/entities/Discount/types.ts +44 -44
  52. package/lib/utils/index.ts +32 -83
  53. package/package.json +1 -1
  54. package/dist/entities/Discount.d.ts +0 -71
  55. package/dist/entities/Discount.d.ts.map +0 -1
  56. package/dist/entities/Discount.js +0 -20
  57. package/lib/entities/Discount.ts +0 -23
package/dist/core.es.js CHANGED
@@ -1,4 +1,7 @@
1
- var b;
1
+ var rt = Object.defineProperty;
2
+ var nt = (r, e, t) => e in r ? rt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var Pe = (r, e, t) => nt(r, typeof e != "symbol" ? e + "" : e, t);
4
+ var x;
2
5
  (function(r) {
3
6
  r.assertEqual = (s) => s;
4
7
  function e(s) {
@@ -9,31 +12,31 @@ var b;
9
12
  }
10
13
  r.assertNever = t, r.arrayToEnum = (s) => {
11
14
  const a = {};
12
- for (const c of s)
13
- a[c] = c;
15
+ for (const o of s)
16
+ a[o] = o;
14
17
  return a;
15
18
  }, r.getValidEnumValues = (s) => {
16
- const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), c = {};
17
- for (const o of a)
18
- c[o] = s[o];
19
- return r.objectValues(c);
19
+ const a = r.objectKeys(s).filter((c) => typeof s[s[c]] != "number"), o = {};
20
+ for (const c of a)
21
+ o[c] = s[c];
22
+ return r.objectValues(o);
20
23
  }, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
21
24
  return s[a];
22
25
  }), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
23
26
  const a = [];
24
- for (const c in s)
25
- Object.prototype.hasOwnProperty.call(s, c) && a.push(c);
27
+ for (const o in s)
28
+ Object.prototype.hasOwnProperty.call(s, o) && a.push(o);
26
29
  return a;
27
30
  }, r.find = (s, a) => {
28
- for (const c of s)
29
- if (a(c))
30
- return c;
31
+ for (const o of s)
32
+ if (a(o))
33
+ return o;
31
34
  }, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
32
35
  function n(s, a = " | ") {
33
- return s.map((c) => typeof c == "string" ? `'${c}'` : c).join(a);
36
+ return s.map((o) => typeof o == "string" ? `'${o}'` : o).join(a);
34
37
  }
35
38
  r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
36
- })(b || (b = {}));
39
+ })(x || (x = {}));
37
40
  var Ne;
38
41
  (function(r) {
39
42
  r.mergeShapes = (e, t) => ({
@@ -42,7 +45,7 @@ var Ne;
42
45
  // second overwrites first
43
46
  });
44
47
  })(Ne || (Ne = {}));
45
- const h = b.arrayToEnum([
48
+ const h = x.arrayToEnum([
46
49
  "string",
47
50
  "nan",
48
51
  "number",
@@ -63,7 +66,7 @@ const h = b.arrayToEnum([
63
66
  "never",
64
67
  "map",
65
68
  "set"
66
- ]), $ = (r) => {
69
+ ]), D = (r) => {
67
70
  switch (typeof r) {
68
71
  case "undefined":
69
72
  return h.undefined;
@@ -84,7 +87,7 @@ const h = b.arrayToEnum([
84
87
  default:
85
88
  return h.unknown;
86
89
  }
87
- }, d = b.arrayToEnum([
90
+ }, u = x.arrayToEnum([
88
91
  "invalid_type",
89
92
  "invalid_literal",
90
93
  "custom",
@@ -101,7 +104,7 @@ const h = b.arrayToEnum([
101
104
  "invalid_intersection_types",
102
105
  "not_multiple_of",
103
106
  "not_finite"
104
- ]), at = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
107
+ ]), st = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
105
108
  class C extends Error {
106
109
  get errors() {
107
110
  return this.issues;
@@ -119,20 +122,20 @@ class C extends Error {
119
122
  const t = e || function(a) {
120
123
  return a.message;
121
124
  }, n = { _errors: [] }, s = (a) => {
122
- for (const c of a.issues)
123
- if (c.code === "invalid_union")
124
- c.unionErrors.map(s);
125
- else if (c.code === "invalid_return_type")
126
- s(c.returnTypeError);
127
- else if (c.code === "invalid_arguments")
128
- s(c.argumentsError);
129
- else if (c.path.length === 0)
130
- n._errors.push(t(c));
125
+ for (const o of a.issues)
126
+ if (o.code === "invalid_union")
127
+ o.unionErrors.map(s);
128
+ else if (o.code === "invalid_return_type")
129
+ s(o.returnTypeError);
130
+ else if (o.code === "invalid_arguments")
131
+ s(o.argumentsError);
132
+ else if (o.path.length === 0)
133
+ n._errors.push(t(o));
131
134
  else {
132
- let o = n, l = 0;
133
- for (; l < c.path.length; ) {
134
- const u = c.path[l];
135
- l === c.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(c))) : o[u] = o[u] || { _errors: [] }, o = o[u], l++;
135
+ let c = n, d = 0;
136
+ for (; d < o.path.length; ) {
137
+ const l = o.path[d];
138
+ d === o.path.length - 1 ? (c[l] = c[l] || { _errors: [] }, c[l]._errors.push(t(o))) : c[l] = c[l] || { _errors: [] }, c = c[l], d++;
136
139
  }
137
140
  }
138
141
  };
@@ -146,7 +149,7 @@ class C extends Error {
146
149
  return this.message;
147
150
  }
148
151
  get message() {
149
- return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
152
+ return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
150
153
  }
151
154
  get isEmpty() {
152
155
  return this.issues.length === 0;
@@ -162,71 +165,71 @@ class C extends Error {
162
165
  }
163
166
  }
164
167
  C.create = (r) => new C(r);
165
- const G = (r, e) => {
168
+ const H = (r, e) => {
166
169
  let t;
167
170
  switch (r.code) {
168
- case d.invalid_type:
171
+ case u.invalid_type:
169
172
  r.received === h.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
170
173
  break;
171
- case d.invalid_literal:
172
- t = `Invalid literal value, expected ${JSON.stringify(r.expected, b.jsonStringifyReplacer)}`;
174
+ case u.invalid_literal:
175
+ t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
173
176
  break;
174
- case d.unrecognized_keys:
175
- t = `Unrecognized key(s) in object: ${b.joinValues(r.keys, ", ")}`;
177
+ case u.unrecognized_keys:
178
+ t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
176
179
  break;
177
- case d.invalid_union:
180
+ case u.invalid_union:
178
181
  t = "Invalid input";
179
182
  break;
180
- case d.invalid_union_discriminator:
181
- t = `Invalid discriminator value. Expected ${b.joinValues(r.options)}`;
183
+ case u.invalid_union_discriminator:
184
+ t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
182
185
  break;
183
- case d.invalid_enum_value:
184
- t = `Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;
186
+ case u.invalid_enum_value:
187
+ t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
185
188
  break;
186
- case d.invalid_arguments:
189
+ case u.invalid_arguments:
187
190
  t = "Invalid function arguments";
188
191
  break;
189
- case d.invalid_return_type:
192
+ case u.invalid_return_type:
190
193
  t = "Invalid function return type";
191
194
  break;
192
- case d.invalid_date:
195
+ case u.invalid_date:
193
196
  t = "Invalid date";
194
197
  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";
198
+ case u.invalid_string:
199
+ 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}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
197
200
  break;
198
- case d.too_small:
201
+ case u.too_small:
199
202
  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
203
  break;
201
- case d.too_big:
204
+ case u.too_big:
202
205
  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
206
  break;
204
- case d.custom:
207
+ case u.custom:
205
208
  t = "Invalid input";
206
209
  break;
207
- case d.invalid_intersection_types:
210
+ case u.invalid_intersection_types:
208
211
  t = "Intersection results could not be merged";
209
212
  break;
210
- case d.not_multiple_of:
213
+ case u.not_multiple_of:
211
214
  t = `Number must be a multiple of ${r.multipleOf}`;
212
215
  break;
213
- case d.not_finite:
216
+ case u.not_finite:
214
217
  t = "Number must be finite";
215
218
  break;
216
219
  default:
217
- t = e.defaultError, b.assertNever(r);
220
+ t = e.defaultError, x.assertNever(r);
218
221
  }
219
222
  return { message: t };
220
223
  };
221
- let Ue = G;
222
- function it(r) {
223
- Ue = r;
224
+ let Ve = H;
225
+ function at(r) {
226
+ Ve = r;
224
227
  }
225
- function ve() {
226
- return Ue;
228
+ function ge() {
229
+ return Ve;
227
230
  }
228
- const _e = (r) => {
229
- const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], c = {
231
+ const ve = (r) => {
232
+ const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], o = {
230
233
  ...s,
231
234
  path: a
232
235
  };
@@ -236,18 +239,18 @@ const _e = (r) => {
236
239
  path: a,
237
240
  message: s.message
238
241
  };
239
- let o = "";
240
- const l = n.filter((u) => !!u).slice().reverse();
241
- for (const u of l)
242
- o = u(c, { data: e, defaultError: o }).message;
242
+ let c = "";
243
+ const d = n.filter((l) => !!l).slice().reverse();
244
+ for (const l of d)
245
+ c = l(o, { data: e, defaultError: c }).message;
243
246
  return {
244
247
  ...s,
245
248
  path: a,
246
- message: o
249
+ message: c
247
250
  };
248
- }, ot = [];
251
+ }, it = [];
249
252
  function f(r, e) {
250
- const t = ve(), n = _e({
253
+ const t = ge(), n = ve({
251
254
  issueData: e,
252
255
  data: r.data,
253
256
  path: r.path,
@@ -258,7 +261,7 @@ function f(r, e) {
258
261
  // then schema-bound map if available
259
262
  t,
260
263
  // then global override map
261
- t === G ? void 0 : G
264
+ t === H ? void 0 : H
262
265
  // then global default map
263
266
  ].filter((s) => !!s)
264
267
  });
@@ -286,10 +289,10 @@ class T {
286
289
  static async mergeObjectAsync(e, t) {
287
290
  const n = [];
288
291
  for (const s of t) {
289
- const a = await s.key, c = await s.value;
292
+ const a = await s.key, o = await s.value;
290
293
  n.push({
291
294
  key: a,
292
- value: c
295
+ value: o
293
296
  });
294
297
  }
295
298
  return T.mergeObjectSync(e, n);
@@ -297,30 +300,30 @@ class T {
297
300
  static mergeObjectSync(e, t) {
298
301
  const n = {};
299
302
  for (const s of t) {
300
- const { key: a, value: c } = s;
301
- if (a.status === "aborted" || c.status === "aborted")
303
+ const { key: a, value: o } = s;
304
+ if (a.status === "aborted" || o.status === "aborted")
302
305
  return g;
303
- a.status === "dirty" && e.dirty(), c.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof c.value < "u" || s.alwaysSet) && (n[a.value] = c.value);
306
+ 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
307
  }
305
308
  return { status: e.value, value: n };
306
309
  }
307
310
  }
308
311
  const g = Object.freeze({
309
312
  status: "aborted"
310
- }), Y = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Oe = (r) => r.status === "aborted", je = (r) => r.status === "dirty", B = (r) => r.status === "valid", se = (r) => typeof Promise < "u" && r instanceof Promise;
311
- function be(r, e, t, n) {
313
+ }), J = (r) => ({ status: "dirty", value: r }), I = (r) => ({ status: "valid", value: r }), Ze = (r) => r.status === "aborted", Oe = (r) => r.status === "dirty", B = (r) => r.status === "valid", ne = (r) => typeof Promise < "u" && r instanceof Promise;
314
+ function _e(r, e, t, n) {
312
315
  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
316
  return e.get(r);
314
317
  }
315
- function Be(r, e, t, n, s) {
318
+ function Fe(r, e, t, n, s) {
316
319
  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
320
  return e.set(r, t), t;
318
321
  }
319
- var m;
322
+ var p;
320
323
  (function(r) {
321
324
  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 re, ne;
325
+ })(p || (p = {}));
326
+ var ee, te;
324
327
  class E {
325
328
  constructor(e, t, n, s) {
326
329
  this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
@@ -329,7 +332,7 @@ class E {
329
332
  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
333
  }
331
334
  }
332
- const Me = (r, e) => {
335
+ const De = (r, e) => {
333
336
  if (B(e))
334
337
  return { success: !0, data: e.value };
335
338
  if (!r.common.issues.length)
@@ -350,10 +353,10 @@ function v(r) {
350
353
  const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
351
354
  if (e && (t || n))
352
355
  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: (c, o) => {
354
- var l, u;
355
- const { message: p } = r;
356
- return c.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (l = p ?? n) !== null && l !== void 0 ? l : o.defaultError } : c.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = p ?? t) !== null && u !== void 0 ? u : o.defaultError };
356
+ return e ? { errorMap: e, description: s } : { errorMap: (o, c) => {
357
+ var d, l;
358
+ const { message: m } = r;
359
+ return o.code === "invalid_enum_value" ? { message: m ?? c.defaultError } : typeof c.data > "u" ? { message: (d = m ?? n) !== null && d !== void 0 ? d : c.defaultError } : o.code !== "invalid_type" ? { message: c.defaultError } : { message: (l = m ?? t) !== null && l !== void 0 ? l : c.defaultError };
357
360
  }, description: s };
358
361
  }
359
362
  class _ {
@@ -361,13 +364,13 @@ class _ {
361
364
  return this._def.description;
362
365
  }
363
366
  _getType(e) {
364
- return $(e.data);
367
+ return D(e.data);
365
368
  }
366
369
  _getOrReturnCtx(e, t) {
367
370
  return t || {
368
371
  common: e.parent.common,
369
372
  data: e.data,
370
- parsedType: $(e.data),
373
+ parsedType: D(e.data),
371
374
  schemaErrorMap: this._def.errorMap,
372
375
  path: e.path,
373
376
  parent: e.parent
@@ -379,7 +382,7 @@ class _ {
379
382
  ctx: {
380
383
  common: e.parent.common,
381
384
  data: e.data,
382
- parsedType: $(e.data),
385
+ parsedType: D(e.data),
383
386
  schemaErrorMap: this._def.errorMap,
384
387
  path: e.path,
385
388
  parent: e.parent
@@ -388,7 +391,7 @@ class _ {
388
391
  }
389
392
  _parseSync(e) {
390
393
  const t = this._parse(e);
391
- if (se(t))
394
+ if (ne(t))
392
395
  throw new Error("Synchronous parse encountered promise.");
393
396
  return t;
394
397
  }
@@ -414,9 +417,9 @@ class _ {
414
417
  schemaErrorMap: this._def.errorMap,
415
418
  parent: null,
416
419
  data: e,
417
- parsedType: $(e)
420
+ parsedType: D(e)
418
421
  }, a = this._parseSync({ data: e, path: s.path, parent: s });
419
- return Me(s, a);
422
+ return De(s, a);
420
423
  }
421
424
  "~validate"(e) {
422
425
  var t, n;
@@ -429,7 +432,7 @@ class _ {
429
432
  schemaErrorMap: this._def.errorMap,
430
433
  parent: null,
431
434
  data: e,
432
- parsedType: $(e)
435
+ parsedType: D(e)
433
436
  };
434
437
  if (!this["~standard"].async)
435
438
  try {
@@ -468,25 +471,25 @@ class _ {
468
471
  schemaErrorMap: this._def.errorMap,
469
472
  parent: null,
470
473
  data: e,
471
- parsedType: $(e)
472
- }, s = this._parse({ data: e, path: n.path, parent: n }), a = await (se(s) ? s : Promise.resolve(s));
473
- return Me(n, a);
474
+ parsedType: D(e)
475
+ }, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ne(s) ? s : Promise.resolve(s));
476
+ return De(n, a);
474
477
  }
475
478
  refine(e, t) {
476
479
  const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
477
480
  return this._refinement((s, a) => {
478
- const c = e(s), o = () => a.addIssue({
479
- code: d.custom,
481
+ const o = e(s), c = () => a.addIssue({
482
+ code: u.custom,
480
483
  ...n(s)
481
484
  });
482
- return typeof Promise < "u" && c instanceof Promise ? c.then((l) => l ? !0 : (o(), !1)) : c ? !0 : (o(), !1);
485
+ return typeof Promise < "u" && o instanceof Promise ? o.then((d) => d ? !0 : (c(), !1)) : o ? !0 : (c(), !1);
483
486
  });
484
487
  }
485
488
  refinement(e, t) {
486
489
  return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
487
490
  }
488
491
  _refinement(e) {
489
- return new N({
492
+ return new O({
490
493
  schema: this,
491
494
  typeName: y.ZodEffects,
492
495
  effect: { type: "refinement", refinement: e }
@@ -506,25 +509,25 @@ class _ {
506
509
  return j.create(this, this._def);
507
510
  }
508
511
  nullable() {
509
- return F.create(this, this._def);
512
+ return z.create(this, this._def);
510
513
  }
511
514
  nullish() {
512
515
  return this.nullable().optional();
513
516
  }
514
517
  array() {
515
- return A.create(this);
518
+ return Z.create(this);
516
519
  }
517
520
  promise() {
518
- return K.create(this, this._def);
521
+ return X.create(this, this._def);
519
522
  }
520
523
  or(e) {
521
- return ce.create([this, e], this._def);
524
+ return oe.create([this, e], this._def);
522
525
  }
523
526
  and(e) {
524
- return de.create(this, e, this._def);
527
+ return ce.create(this, e, this._def);
525
528
  }
526
529
  transform(e) {
527
- return new N({
530
+ return new O({
528
531
  ...v(this._def),
529
532
  schema: this,
530
533
  typeName: y.ZodEffects,
@@ -533,7 +536,7 @@ class _ {
533
536
  }
534
537
  default(e) {
535
538
  const t = typeof e == "function" ? e : () => e;
536
- return new pe({
539
+ return new he({
537
540
  ...v(this._def),
538
541
  innerType: this,
539
542
  defaultValue: t,
@@ -541,7 +544,7 @@ class _ {
541
544
  });
542
545
  }
543
546
  brand() {
544
- return new Re({
547
+ return new Ee({
545
548
  typeName: y.ZodBranded,
546
549
  type: this,
547
550
  ...v(this._def)
@@ -564,10 +567,10 @@ class _ {
564
567
  });
565
568
  }
566
569
  pipe(e) {
567
- return ge.create(this, e);
570
+ return ye.create(this, e);
568
571
  }
569
572
  readonly() {
570
- return ye.create(this);
573
+ return pe.create(this);
571
574
  }
572
575
  isOptional() {
573
576
  return this.safeParse(void 0).success;
@@ -576,26 +579,26 @@ class _ {
576
579
  return this.safeParse(null).success;
577
580
  }
578
581
  }
579
- const ct = /^c[^\s-]{8,}$/i, dt = /^[0-9a-z]+$/, ut = /^[0-9A-HJKMNP-TV-Z]{26}$/i, lt = /^[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, ft = /^[a-z0-9_-]{21}$/i, ht = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, pt = /^[-+]?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)?)??$/, mt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, yt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
580
- let Ze;
581
- const gt = /^(?:(?: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])$/, vt = /^(?:(?: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])$/, _t = /^(([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]))$/, bt = /^(([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])$/, xt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, kt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, qe = "((\\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])))", wt = new RegExp(`^${qe}$`);
582
- function We(r) {
582
+ const ot = /^c[^\s-]{8,}$/i, ct = /^[0-9a-z]+$/, dt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ut = /^[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, lt = /^[a-z0-9_-]{21}$/i, ft = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ht = /^[-+]?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)?)??$/, mt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, pt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
583
+ let Ce;
584
+ const yt = /^(?:(?: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])$/, gt = /^(?:(?: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])$/, vt = /^(([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]))$/, _t = /^(([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])$/, bt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, xt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Le = "((\\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])))", kt = new RegExp(`^${Le}$`);
585
+ function ze(r) {
583
586
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
584
587
  return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
585
588
  }
586
- function Tt(r) {
587
- return new RegExp(`^${We(r)}$`);
589
+ function wt(r) {
590
+ return new RegExp(`^${ze(r)}$`);
588
591
  }
589
- function Je(r) {
590
- let e = `${qe}T${We(r)}`;
592
+ function Ue(r) {
593
+ let e = `${Le}T${ze(r)}`;
591
594
  const t = [];
592
595
  return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
593
596
  }
594
- function St(r, e) {
595
- return !!((e === "v4" || !e) && gt.test(r) || (e === "v6" || !e) && _t.test(r));
597
+ function Tt(r, e) {
598
+ return !!((e === "v4" || !e) && yt.test(r) || (e === "v6" || !e) && vt.test(r));
596
599
  }
597
- function Ct(r, e) {
598
- if (!ht.test(r))
600
+ function It(r, e) {
601
+ if (!ft.test(r))
599
602
  return !1;
600
603
  try {
601
604
  const [t] = r.split("."), n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(n));
@@ -604,15 +607,15 @@ function Ct(r, e) {
604
607
  return !1;
605
608
  }
606
609
  }
607
- function Zt(r, e) {
608
- return !!((e === "v4" || !e) && vt.test(r) || (e === "v6" || !e) && bt.test(r));
610
+ function St(r, e) {
611
+ return !!((e === "v4" || !e) && gt.test(r) || (e === "v6" || !e) && _t.test(r));
609
612
  }
610
- class I extends _ {
613
+ class N extends _ {
611
614
  _parse(e) {
612
615
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
613
616
  const a = this._getOrReturnCtx(e);
614
617
  return f(a, {
615
- code: d.invalid_type,
618
+ code: u.invalid_type,
616
619
  expected: h.string,
617
620
  received: a.parsedType
618
621
  }), g;
@@ -622,7 +625,7 @@ class I extends _ {
622
625
  for (const a of this._def.checks)
623
626
  if (a.kind === "min")
624
627
  e.data.length < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
625
- code: d.too_small,
628
+ code: u.too_small,
626
629
  minimum: a.value,
627
630
  type: "string",
628
631
  inclusive: !0,
@@ -631,7 +634,7 @@ class I extends _ {
631
634
  }), n.dirty());
632
635
  else if (a.kind === "max")
633
636
  e.data.length > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
634
- code: d.too_big,
637
+ code: u.too_big,
635
638
  maximum: a.value,
636
639
  type: "string",
637
640
  inclusive: !0,
@@ -639,16 +642,16 @@ class I extends _ {
639
642
  message: a.message
640
643
  }), n.dirty());
641
644
  else if (a.kind === "length") {
642
- const c = e.data.length > a.value, o = e.data.length < a.value;
643
- (c || o) && (s = this._getOrReturnCtx(e, s), c ? f(s, {
644
- code: d.too_big,
645
+ const o = e.data.length > a.value, c = e.data.length < a.value;
646
+ (o || c) && (s = this._getOrReturnCtx(e, s), o ? f(s, {
647
+ code: u.too_big,
645
648
  maximum: a.value,
646
649
  type: "string",
647
650
  inclusive: !0,
648
651
  exact: !0,
649
652
  message: a.message
650
- }) : o && f(s, {
651
- code: d.too_small,
653
+ }) : c && f(s, {
654
+ code: u.too_small,
652
655
  minimum: a.value,
653
656
  type: "string",
654
657
  inclusive: !0,
@@ -658,43 +661,43 @@ class I extends _ {
658
661
  } else if (a.kind === "email")
659
662
  mt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
660
663
  validation: "email",
661
- code: d.invalid_string,
664
+ code: u.invalid_string,
662
665
  message: a.message
663
666
  }), n.dirty());
664
667
  else if (a.kind === "emoji")
665
- Ze || (Ze = new RegExp(yt, "u")), Ze.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
668
+ Ce || (Ce = new RegExp(pt, "u")), Ce.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
666
669
  validation: "emoji",
667
- code: d.invalid_string,
670
+ code: u.invalid_string,
668
671
  message: a.message
669
672
  }), n.dirty());
670
673
  else if (a.kind === "uuid")
671
- lt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
674
+ ut.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
672
675
  validation: "uuid",
673
- code: d.invalid_string,
676
+ code: u.invalid_string,
674
677
  message: a.message
675
678
  }), n.dirty());
676
679
  else if (a.kind === "nanoid")
677
- ft.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
680
+ lt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
678
681
  validation: "nanoid",
679
- code: d.invalid_string,
682
+ code: u.invalid_string,
680
683
  message: a.message
681
684
  }), n.dirty());
682
685
  else if (a.kind === "cuid")
683
- ct.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
686
+ ot.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
684
687
  validation: "cuid",
685
- code: d.invalid_string,
688
+ code: u.invalid_string,
686
689
  message: a.message
687
690
  }), n.dirty());
688
691
  else if (a.kind === "cuid2")
689
- dt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
692
+ ct.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
690
693
  validation: "cuid2",
691
- code: d.invalid_string,
694
+ code: u.invalid_string,
692
695
  message: a.message
693
696
  }), n.dirty());
694
697
  else if (a.kind === "ulid")
695
- ut.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
698
+ dt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
696
699
  validation: "ulid",
697
- code: d.invalid_string,
700
+ code: u.invalid_string,
698
701
  message: a.message
699
702
  }), n.dirty());
700
703
  else if (a.kind === "url")
@@ -703,119 +706,119 @@ class I extends _ {
703
706
  } catch {
704
707
  s = this._getOrReturnCtx(e, s), f(s, {
705
708
  validation: "url",
706
- code: d.invalid_string,
709
+ code: u.invalid_string,
707
710
  message: a.message
708
711
  }), n.dirty();
709
712
  }
710
713
  else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
711
714
  validation: "regex",
712
- code: d.invalid_string,
715
+ code: u.invalid_string,
713
716
  message: a.message
714
717
  }), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), f(s, {
715
- code: d.invalid_string,
718
+ code: u.invalid_string,
716
719
  validation: { includes: a.value, position: a.position },
717
720
  message: a.message
718
721
  }), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
719
- code: d.invalid_string,
722
+ code: u.invalid_string,
720
723
  validation: { startsWith: a.value },
721
724
  message: a.message
722
725
  }), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
723
- code: d.invalid_string,
726
+ code: u.invalid_string,
724
727
  validation: { endsWith: a.value },
725
728
  message: a.message
726
- }), n.dirty()) : a.kind === "datetime" ? Je(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
727
- code: d.invalid_string,
729
+ }), n.dirty()) : a.kind === "datetime" ? Ue(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
730
+ code: u.invalid_string,
728
731
  validation: "datetime",
729
732
  message: a.message
730
- }), n.dirty()) : a.kind === "date" ? wt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
731
- code: d.invalid_string,
733
+ }), n.dirty()) : a.kind === "date" ? kt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
734
+ code: u.invalid_string,
732
735
  validation: "date",
733
736
  message: a.message
734
- }), n.dirty()) : a.kind === "time" ? Tt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
735
- code: d.invalid_string,
737
+ }), n.dirty()) : a.kind === "time" ? wt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
738
+ code: u.invalid_string,
736
739
  validation: "time",
737
740
  message: a.message
738
- }), n.dirty()) : a.kind === "duration" ? pt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
741
+ }), n.dirty()) : a.kind === "duration" ? ht.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
739
742
  validation: "duration",
740
- code: d.invalid_string,
743
+ code: u.invalid_string,
741
744
  message: a.message
742
- }), n.dirty()) : a.kind === "ip" ? St(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
745
+ }), n.dirty()) : a.kind === "ip" ? Tt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
743
746
  validation: "ip",
744
- code: d.invalid_string,
747
+ code: u.invalid_string,
745
748
  message: a.message
746
- }), n.dirty()) : a.kind === "jwt" ? Ct(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
749
+ }), n.dirty()) : a.kind === "jwt" ? It(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
747
750
  validation: "jwt",
748
- code: d.invalid_string,
751
+ code: u.invalid_string,
749
752
  message: a.message
750
- }), n.dirty()) : a.kind === "cidr" ? Zt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
753
+ }), n.dirty()) : a.kind === "cidr" ? St(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
751
754
  validation: "cidr",
752
- code: d.invalid_string,
755
+ code: u.invalid_string,
753
756
  message: a.message
754
- }), n.dirty()) : a.kind === "base64" ? xt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
757
+ }), n.dirty()) : a.kind === "base64" ? bt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
755
758
  validation: "base64",
756
- code: d.invalid_string,
759
+ code: u.invalid_string,
757
760
  message: a.message
758
- }), n.dirty()) : a.kind === "base64url" ? kt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
761
+ }), n.dirty()) : a.kind === "base64url" ? xt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
759
762
  validation: "base64url",
760
- code: d.invalid_string,
763
+ code: u.invalid_string,
761
764
  message: a.message
762
- }), n.dirty()) : b.assertNever(a);
765
+ }), n.dirty()) : x.assertNever(a);
763
766
  return { status: n.value, value: e.data };
764
767
  }
765
768
  _regex(e, t, n) {
766
769
  return this.refinement((s) => e.test(s), {
767
770
  validation: t,
768
- code: d.invalid_string,
769
- ...m.errToObj(n)
771
+ code: u.invalid_string,
772
+ ...p.errToObj(n)
770
773
  });
771
774
  }
772
775
  _addCheck(e) {
773
- return new I({
776
+ return new N({
774
777
  ...this._def,
775
778
  checks: [...this._def.checks, e]
776
779
  });
777
780
  }
778
781
  email(e) {
779
- return this._addCheck({ kind: "email", ...m.errToObj(e) });
782
+ return this._addCheck({ kind: "email", ...p.errToObj(e) });
780
783
  }
781
784
  url(e) {
782
- return this._addCheck({ kind: "url", ...m.errToObj(e) });
785
+ return this._addCheck({ kind: "url", ...p.errToObj(e) });
783
786
  }
784
787
  emoji(e) {
785
- return this._addCheck({ kind: "emoji", ...m.errToObj(e) });
788
+ return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
786
789
  }
787
790
  uuid(e) {
788
- return this._addCheck({ kind: "uuid", ...m.errToObj(e) });
791
+ return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
789
792
  }
790
793
  nanoid(e) {
791
- return this._addCheck({ kind: "nanoid", ...m.errToObj(e) });
794
+ return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
792
795
  }
793
796
  cuid(e) {
794
- return this._addCheck({ kind: "cuid", ...m.errToObj(e) });
797
+ return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
795
798
  }
796
799
  cuid2(e) {
797
- return this._addCheck({ kind: "cuid2", ...m.errToObj(e) });
800
+ return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
798
801
  }
799
802
  ulid(e) {
800
- return this._addCheck({ kind: "ulid", ...m.errToObj(e) });
803
+ return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
801
804
  }
802
805
  base64(e) {
803
- return this._addCheck({ kind: "base64", ...m.errToObj(e) });
806
+ return this._addCheck({ kind: "base64", ...p.errToObj(e) });
804
807
  }
805
808
  base64url(e) {
806
809
  return this._addCheck({
807
810
  kind: "base64url",
808
- ...m.errToObj(e)
811
+ ...p.errToObj(e)
809
812
  });
810
813
  }
811
814
  jwt(e) {
812
- return this._addCheck({ kind: "jwt", ...m.errToObj(e) });
815
+ return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
813
816
  }
814
817
  ip(e) {
815
- return this._addCheck({ kind: "ip", ...m.errToObj(e) });
818
+ return this._addCheck({ kind: "ip", ...p.errToObj(e) });
816
819
  }
817
820
  cidr(e) {
818
- return this._addCheck({ kind: "cidr", ...m.errToObj(e) });
821
+ return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
819
822
  }
820
823
  datetime(e) {
821
824
  var t, n;
@@ -830,7 +833,7 @@ class I extends _ {
830
833
  precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
831
834
  offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
832
835
  local: (n = e == null ? void 0 : e.local) !== null && n !== void 0 ? n : !1,
833
- ...m.errToObj(e == null ? void 0 : e.message)
836
+ ...p.errToObj(e == null ? void 0 : e.message)
834
837
  });
835
838
  }
836
839
  date(e) {
@@ -844,17 +847,17 @@ class I extends _ {
844
847
  }) : this._addCheck({
845
848
  kind: "time",
846
849
  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)
850
+ ...p.errToObj(e == null ? void 0 : e.message)
848
851
  });
849
852
  }
850
853
  duration(e) {
851
- return this._addCheck({ kind: "duration", ...m.errToObj(e) });
854
+ return this._addCheck({ kind: "duration", ...p.errToObj(e) });
852
855
  }
853
856
  regex(e, t) {
854
857
  return this._addCheck({
855
858
  kind: "regex",
856
859
  regex: e,
857
- ...m.errToObj(t)
860
+ ...p.errToObj(t)
858
861
  });
859
862
  }
860
863
  includes(e, t) {
@@ -862,64 +865,64 @@ class I extends _ {
862
865
  kind: "includes",
863
866
  value: e,
864
867
  position: t == null ? void 0 : t.position,
865
- ...m.errToObj(t == null ? void 0 : t.message)
868
+ ...p.errToObj(t == null ? void 0 : t.message)
866
869
  });
867
870
  }
868
871
  startsWith(e, t) {
869
872
  return this._addCheck({
870
873
  kind: "startsWith",
871
874
  value: e,
872
- ...m.errToObj(t)
875
+ ...p.errToObj(t)
873
876
  });
874
877
  }
875
878
  endsWith(e, t) {
876
879
  return this._addCheck({
877
880
  kind: "endsWith",
878
881
  value: e,
879
- ...m.errToObj(t)
882
+ ...p.errToObj(t)
880
883
  });
881
884
  }
882
885
  min(e, t) {
883
886
  return this._addCheck({
884
887
  kind: "min",
885
888
  value: e,
886
- ...m.errToObj(t)
889
+ ...p.errToObj(t)
887
890
  });
888
891
  }
889
892
  max(e, t) {
890
893
  return this._addCheck({
891
894
  kind: "max",
892
895
  value: e,
893
- ...m.errToObj(t)
896
+ ...p.errToObj(t)
894
897
  });
895
898
  }
896
899
  length(e, t) {
897
900
  return this._addCheck({
898
901
  kind: "length",
899
902
  value: e,
900
- ...m.errToObj(t)
903
+ ...p.errToObj(t)
901
904
  });
902
905
  }
903
906
  /**
904
907
  * Equivalent to `.min(1)`
905
908
  */
906
909
  nonempty(e) {
907
- return this.min(1, m.errToObj(e));
910
+ return this.min(1, p.errToObj(e));
908
911
  }
909
912
  trim() {
910
- return new I({
913
+ return new N({
911
914
  ...this._def,
912
915
  checks: [...this._def.checks, { kind: "trim" }]
913
916
  });
914
917
  }
915
918
  toLowerCase() {
916
- return new I({
919
+ return new N({
917
920
  ...this._def,
918
921
  checks: [...this._def.checks, { kind: "toLowerCase" }]
919
922
  });
920
923
  }
921
924
  toUpperCase() {
922
- return new I({
925
+ return new N({
923
926
  ...this._def,
924
927
  checks: [...this._def.checks, { kind: "toUpperCase" }]
925
928
  });
@@ -985,18 +988,18 @@ class I extends _ {
985
988
  return e;
986
989
  }
987
990
  }
988
- I.create = (r) => {
991
+ N.create = (r) => {
989
992
  var e;
990
- return new I({
993
+ return new N({
991
994
  checks: [],
992
995
  typeName: y.ZodString,
993
996
  coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
994
997
  ...v(r)
995
998
  });
996
999
  };
997
- function It(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(".", "")), c = parseInt(e.toFixed(s).replace(".", ""));
999
- return a % c / Math.pow(10, s);
1000
+ function Ct(r, e) {
1001
+ 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(".", ""));
1002
+ return a % o / Math.pow(10, s);
1000
1003
  }
1001
1004
  class V extends _ {
1002
1005
  constructor() {
@@ -1006,7 +1009,7 @@ class V extends _ {
1006
1009
  if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.number) {
1007
1010
  const a = this._getOrReturnCtx(e);
1008
1011
  return f(a, {
1009
- code: d.invalid_type,
1012
+ code: u.invalid_type,
1010
1013
  expected: h.number,
1011
1014
  received: a.parsedType
1012
1015
  }), g;
@@ -1014,46 +1017,46 @@ class V extends _ {
1014
1017
  let n;
1015
1018
  const s = new T();
1016
1019
  for (const a of this._def.checks)
1017
- a.kind === "int" ? b.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
1018
- code: d.invalid_type,
1020
+ a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
1021
+ code: u.invalid_type,
1019
1022
  expected: "integer",
1020
1023
  received: "float",
1021
1024
  message: a.message
1022
1025
  }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
1023
- code: d.too_small,
1026
+ code: u.too_small,
1024
1027
  minimum: a.value,
1025
1028
  type: "number",
1026
1029
  inclusive: a.inclusive,
1027
1030
  exact: !1,
1028
1031
  message: a.message
1029
1032
  }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
1030
- code: d.too_big,
1033
+ code: u.too_big,
1031
1034
  maximum: a.value,
1032
1035
  type: "number",
1033
1036
  inclusive: a.inclusive,
1034
1037
  exact: !1,
1035
1038
  message: a.message
1036
- }), s.dirty()) : a.kind === "multipleOf" ? It(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
1037
- code: d.not_multiple_of,
1039
+ }), s.dirty()) : a.kind === "multipleOf" ? Ct(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
1040
+ code: u.not_multiple_of,
1038
1041
  multipleOf: a.value,
1039
1042
  message: a.message
1040
1043
  }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
1041
- code: d.not_finite,
1044
+ code: u.not_finite,
1042
1045
  message: a.message
1043
- }), s.dirty()) : b.assertNever(a);
1046
+ }), s.dirty()) : x.assertNever(a);
1044
1047
  return { status: s.value, value: e.data };
1045
1048
  }
1046
1049
  gte(e, t) {
1047
- return this.setLimit("min", e, !0, m.toString(t));
1050
+ return this.setLimit("min", e, !0, p.toString(t));
1048
1051
  }
1049
1052
  gt(e, t) {
1050
- return this.setLimit("min", e, !1, m.toString(t));
1053
+ return this.setLimit("min", e, !1, p.toString(t));
1051
1054
  }
1052
1055
  lte(e, t) {
1053
- return this.setLimit("max", e, !0, m.toString(t));
1056
+ return this.setLimit("max", e, !0, p.toString(t));
1054
1057
  }
1055
1058
  lt(e, t) {
1056
- return this.setLimit("max", e, !1, m.toString(t));
1059
+ return this.setLimit("max", e, !1, p.toString(t));
1057
1060
  }
1058
1061
  setLimit(e, t, n, s) {
1059
1062
  return new V({
@@ -1064,7 +1067,7 @@ class V extends _ {
1064
1067
  kind: e,
1065
1068
  value: t,
1066
1069
  inclusive: n,
1067
- message: m.toString(s)
1070
+ message: p.toString(s)
1068
1071
  }
1069
1072
  ]
1070
1073
  });
@@ -1078,7 +1081,7 @@ class V extends _ {
1078
1081
  int(e) {
1079
1082
  return this._addCheck({
1080
1083
  kind: "int",
1081
- message: m.toString(e)
1084
+ message: p.toString(e)
1082
1085
  });
1083
1086
  }
1084
1087
  positive(e) {
@@ -1086,7 +1089,7 @@ class V extends _ {
1086
1089
  kind: "min",
1087
1090
  value: 0,
1088
1091
  inclusive: !1,
1089
- message: m.toString(e)
1092
+ message: p.toString(e)
1090
1093
  });
1091
1094
  }
1092
1095
  negative(e) {
@@ -1094,7 +1097,7 @@ class V extends _ {
1094
1097
  kind: "max",
1095
1098
  value: 0,
1096
1099
  inclusive: !1,
1097
- message: m.toString(e)
1100
+ message: p.toString(e)
1098
1101
  });
1099
1102
  }
1100
1103
  nonpositive(e) {
@@ -1102,7 +1105,7 @@ class V extends _ {
1102
1105
  kind: "max",
1103
1106
  value: 0,
1104
1107
  inclusive: !0,
1105
- message: m.toString(e)
1108
+ message: p.toString(e)
1106
1109
  });
1107
1110
  }
1108
1111
  nonnegative(e) {
@@ -1110,20 +1113,20 @@ class V extends _ {
1110
1113
  kind: "min",
1111
1114
  value: 0,
1112
1115
  inclusive: !0,
1113
- message: m.toString(e)
1116
+ message: p.toString(e)
1114
1117
  });
1115
1118
  }
1116
1119
  multipleOf(e, t) {
1117
1120
  return this._addCheck({
1118
1121
  kind: "multipleOf",
1119
1122
  value: e,
1120
- message: m.toString(t)
1123
+ message: p.toString(t)
1121
1124
  });
1122
1125
  }
1123
1126
  finite(e) {
1124
1127
  return this._addCheck({
1125
1128
  kind: "finite",
1126
- message: m.toString(e)
1129
+ message: p.toString(e)
1127
1130
  });
1128
1131
  }
1129
1132
  safe(e) {
@@ -1131,12 +1134,12 @@ class V extends _ {
1131
1134
  kind: "min",
1132
1135
  inclusive: !0,
1133
1136
  value: Number.MIN_SAFE_INTEGER,
1134
- message: m.toString(e)
1137
+ message: p.toString(e)
1135
1138
  })._addCheck({
1136
1139
  kind: "max",
1137
1140
  inclusive: !0,
1138
1141
  value: Number.MAX_SAFE_INTEGER,
1139
- message: m.toString(e)
1142
+ message: p.toString(e)
1140
1143
  });
1141
1144
  }
1142
1145
  get minValue() {
@@ -1152,7 +1155,7 @@ class V extends _ {
1152
1155
  return e;
1153
1156
  }
1154
1157
  get isInt() {
1155
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value));
1158
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
1156
1159
  }
1157
1160
  get isFinite() {
1158
1161
  let e = null, t = null;
@@ -1170,7 +1173,7 @@ V.create = (r) => new V({
1170
1173
  coerce: (r == null ? void 0 : r.coerce) || !1,
1171
1174
  ...v(r)
1172
1175
  });
1173
- class L extends _ {
1176
+ class F extends _ {
1174
1177
  constructor() {
1175
1178
  super(...arguments), this.min = this.gte, this.max = this.lte;
1176
1179
  }
@@ -1187,46 +1190,46 @@ class L extends _ {
1187
1190
  const s = new T();
1188
1191
  for (const a of this._def.checks)
1189
1192
  a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
1190
- code: d.too_small,
1193
+ code: u.too_small,
1191
1194
  type: "bigint",
1192
1195
  minimum: a.value,
1193
1196
  inclusive: a.inclusive,
1194
1197
  message: a.message
1195
1198
  }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
1196
- code: d.too_big,
1199
+ code: u.too_big,
1197
1200
  type: "bigint",
1198
1201
  maximum: a.value,
1199
1202
  inclusive: a.inclusive,
1200
1203
  message: a.message
1201
1204
  }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), f(n, {
1202
- code: d.not_multiple_of,
1205
+ code: u.not_multiple_of,
1203
1206
  multipleOf: a.value,
1204
1207
  message: a.message
1205
- }), s.dirty()) : b.assertNever(a);
1208
+ }), s.dirty()) : x.assertNever(a);
1206
1209
  return { status: s.value, value: e.data };
1207
1210
  }
1208
1211
  _getInvalidInput(e) {
1209
1212
  const t = this._getOrReturnCtx(e);
1210
1213
  return f(t, {
1211
- code: d.invalid_type,
1214
+ code: u.invalid_type,
1212
1215
  expected: h.bigint,
1213
1216
  received: t.parsedType
1214
1217
  }), g;
1215
1218
  }
1216
1219
  gte(e, t) {
1217
- return this.setLimit("min", e, !0, m.toString(t));
1220
+ return this.setLimit("min", e, !0, p.toString(t));
1218
1221
  }
1219
1222
  gt(e, t) {
1220
- return this.setLimit("min", e, !1, m.toString(t));
1223
+ return this.setLimit("min", e, !1, p.toString(t));
1221
1224
  }
1222
1225
  lte(e, t) {
1223
- return this.setLimit("max", e, !0, m.toString(t));
1226
+ return this.setLimit("max", e, !0, p.toString(t));
1224
1227
  }
1225
1228
  lt(e, t) {
1226
- return this.setLimit("max", e, !1, m.toString(t));
1229
+ return this.setLimit("max", e, !1, p.toString(t));
1227
1230
  }
1228
1231
  setLimit(e, t, n, s) {
1229
- return new L({
1232
+ return new F({
1230
1233
  ...this._def,
1231
1234
  checks: [
1232
1235
  ...this._def.checks,
@@ -1234,13 +1237,13 @@ class L extends _ {
1234
1237
  kind: e,
1235
1238
  value: t,
1236
1239
  inclusive: n,
1237
- message: m.toString(s)
1240
+ message: p.toString(s)
1238
1241
  }
1239
1242
  ]
1240
1243
  });
1241
1244
  }
1242
1245
  _addCheck(e) {
1243
- return new L({
1246
+ return new F({
1244
1247
  ...this._def,
1245
1248
  checks: [...this._def.checks, e]
1246
1249
  });
@@ -1250,7 +1253,7 @@ class L extends _ {
1250
1253
  kind: "min",
1251
1254
  value: BigInt(0),
1252
1255
  inclusive: !1,
1253
- message: m.toString(e)
1256
+ message: p.toString(e)
1254
1257
  });
1255
1258
  }
1256
1259
  negative(e) {
@@ -1258,7 +1261,7 @@ class L extends _ {
1258
1261
  kind: "max",
1259
1262
  value: BigInt(0),
1260
1263
  inclusive: !1,
1261
- message: m.toString(e)
1264
+ message: p.toString(e)
1262
1265
  });
1263
1266
  }
1264
1267
  nonpositive(e) {
@@ -1266,7 +1269,7 @@ class L extends _ {
1266
1269
  kind: "max",
1267
1270
  value: BigInt(0),
1268
1271
  inclusive: !0,
1269
- message: m.toString(e)
1272
+ message: p.toString(e)
1270
1273
  });
1271
1274
  }
1272
1275
  nonnegative(e) {
@@ -1274,14 +1277,14 @@ class L extends _ {
1274
1277
  kind: "min",
1275
1278
  value: BigInt(0),
1276
1279
  inclusive: !0,
1277
- message: m.toString(e)
1280
+ message: p.toString(e)
1278
1281
  });
1279
1282
  }
1280
1283
  multipleOf(e, t) {
1281
1284
  return this._addCheck({
1282
1285
  kind: "multipleOf",
1283
1286
  value: e,
1284
- message: m.toString(t)
1287
+ message: p.toString(t)
1285
1288
  });
1286
1289
  }
1287
1290
  get minValue() {
@@ -1297,39 +1300,39 @@ class L extends _ {
1297
1300
  return e;
1298
1301
  }
1299
1302
  }
1300
- L.create = (r) => {
1303
+ F.create = (r) => {
1301
1304
  var e;
1302
- return new L({
1305
+ return new F({
1303
1306
  checks: [],
1304
1307
  typeName: y.ZodBigInt,
1305
1308
  coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1306
1309
  ...v(r)
1307
1310
  });
1308
1311
  };
1309
- class ae extends _ {
1312
+ class se extends _ {
1310
1313
  _parse(e) {
1311
1314
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
1312
1315
  const n = this._getOrReturnCtx(e);
1313
1316
  return f(n, {
1314
- code: d.invalid_type,
1317
+ code: u.invalid_type,
1315
1318
  expected: h.boolean,
1316
1319
  received: n.parsedType
1317
1320
  }), g;
1318
1321
  }
1319
- return S(e.data);
1322
+ return I(e.data);
1320
1323
  }
1321
1324
  }
1322
- ae.create = (r) => new ae({
1325
+ se.create = (r) => new se({
1323
1326
  typeName: y.ZodBoolean,
1324
1327
  coerce: (r == null ? void 0 : r.coerce) || !1,
1325
1328
  ...v(r)
1326
1329
  });
1327
- class q extends _ {
1330
+ class W extends _ {
1328
1331
  _parse(e) {
1329
1332
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
1330
1333
  const a = this._getOrReturnCtx(e);
1331
1334
  return f(a, {
1332
- code: d.invalid_type,
1335
+ code: u.invalid_type,
1333
1336
  expected: h.date,
1334
1337
  received: a.parsedType
1335
1338
  }), g;
@@ -1337,34 +1340,34 @@ class q extends _ {
1337
1340
  if (isNaN(e.data.getTime())) {
1338
1341
  const a = this._getOrReturnCtx(e);
1339
1342
  return f(a, {
1340
- code: d.invalid_date
1343
+ code: u.invalid_date
1341
1344
  }), g;
1342
1345
  }
1343
1346
  const n = new T();
1344
1347
  let s;
1345
1348
  for (const a of this._def.checks)
1346
1349
  a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
1347
- code: d.too_small,
1350
+ code: u.too_small,
1348
1351
  message: a.message,
1349
1352
  inclusive: !0,
1350
1353
  exact: !1,
1351
1354
  minimum: a.value,
1352
1355
  type: "date"
1353
1356
  }), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
1354
- code: d.too_big,
1357
+ code: u.too_big,
1355
1358
  message: a.message,
1356
1359
  inclusive: !0,
1357
1360
  exact: !1,
1358
1361
  maximum: a.value,
1359
1362
  type: "date"
1360
- }), n.dirty()) : b.assertNever(a);
1363
+ }), n.dirty()) : x.assertNever(a);
1361
1364
  return {
1362
1365
  status: n.value,
1363
1366
  value: new Date(e.data.getTime())
1364
1367
  };
1365
1368
  }
1366
1369
  _addCheck(e) {
1367
- return new q({
1370
+ return new W({
1368
1371
  ...this._def,
1369
1372
  checks: [...this._def.checks, e]
1370
1373
  });
@@ -1373,14 +1376,14 @@ class q extends _ {
1373
1376
  return this._addCheck({
1374
1377
  kind: "min",
1375
1378
  value: e.getTime(),
1376
- message: m.toString(t)
1379
+ message: p.toString(t)
1377
1380
  });
1378
1381
  }
1379
1382
  max(e, t) {
1380
1383
  return this._addCheck({
1381
1384
  kind: "max",
1382
1385
  value: e.getTime(),
1383
- message: m.toString(t)
1386
+ message: p.toString(t)
1384
1387
  });
1385
1388
  }
1386
1389
  get minDate() {
@@ -1396,72 +1399,72 @@ class q extends _ {
1396
1399
  return e != null ? new Date(e) : null;
1397
1400
  }
1398
1401
  }
1399
- q.create = (r) => new q({
1402
+ W.create = (r) => new W({
1400
1403
  checks: [],
1401
1404
  coerce: (r == null ? void 0 : r.coerce) || !1,
1402
1405
  typeName: y.ZodDate,
1403
1406
  ...v(r)
1404
1407
  });
1405
- class xe extends _ {
1408
+ class be extends _ {
1406
1409
  _parse(e) {
1407
1410
  if (this._getType(e) !== h.symbol) {
1408
1411
  const n = this._getOrReturnCtx(e);
1409
1412
  return f(n, {
1410
- code: d.invalid_type,
1413
+ code: u.invalid_type,
1411
1414
  expected: h.symbol,
1412
1415
  received: n.parsedType
1413
1416
  }), g;
1414
1417
  }
1415
- return S(e.data);
1418
+ return I(e.data);
1416
1419
  }
1417
1420
  }
1418
- xe.create = (r) => new xe({
1421
+ be.create = (r) => new be({
1419
1422
  typeName: y.ZodSymbol,
1420
1423
  ...v(r)
1421
1424
  });
1422
- class ie extends _ {
1425
+ class ae extends _ {
1423
1426
  _parse(e) {
1424
1427
  if (this._getType(e) !== h.undefined) {
1425
1428
  const n = this._getOrReturnCtx(e);
1426
1429
  return f(n, {
1427
- code: d.invalid_type,
1430
+ code: u.invalid_type,
1428
1431
  expected: h.undefined,
1429
1432
  received: n.parsedType
1430
1433
  }), g;
1431
1434
  }
1432
- return S(e.data);
1435
+ return I(e.data);
1433
1436
  }
1434
1437
  }
1435
- ie.create = (r) => new ie({
1438
+ ae.create = (r) => new ae({
1436
1439
  typeName: y.ZodUndefined,
1437
1440
  ...v(r)
1438
1441
  });
1439
- class oe extends _ {
1442
+ class ie extends _ {
1440
1443
  _parse(e) {
1441
1444
  if (this._getType(e) !== h.null) {
1442
1445
  const n = this._getOrReturnCtx(e);
1443
1446
  return f(n, {
1444
- code: d.invalid_type,
1447
+ code: u.invalid_type,
1445
1448
  expected: h.null,
1446
1449
  received: n.parsedType
1447
1450
  }), g;
1448
1451
  }
1449
- return S(e.data);
1452
+ return I(e.data);
1450
1453
  }
1451
1454
  }
1452
- oe.create = (r) => new oe({
1455
+ ie.create = (r) => new ie({
1453
1456
  typeName: y.ZodNull,
1454
1457
  ...v(r)
1455
1458
  });
1456
- class X extends _ {
1459
+ class G extends _ {
1457
1460
  constructor() {
1458
1461
  super(...arguments), this._any = !0;
1459
1462
  }
1460
1463
  _parse(e) {
1461
- return S(e.data);
1464
+ return I(e.data);
1462
1465
  }
1463
1466
  }
1464
- X.create = (r) => new X({
1467
+ G.create = (r) => new G({
1465
1468
  typeName: y.ZodAny,
1466
1469
  ...v(r)
1467
1470
  });
@@ -1470,59 +1473,59 @@ class U extends _ {
1470
1473
  super(...arguments), this._unknown = !0;
1471
1474
  }
1472
1475
  _parse(e) {
1473
- return S(e.data);
1476
+ return I(e.data);
1474
1477
  }
1475
1478
  }
1476
1479
  U.create = (r) => new U({
1477
1480
  typeName: y.ZodUnknown,
1478
1481
  ...v(r)
1479
1482
  });
1480
- class M extends _ {
1483
+ class $ extends _ {
1481
1484
  _parse(e) {
1482
1485
  const t = this._getOrReturnCtx(e);
1483
1486
  return f(t, {
1484
- code: d.invalid_type,
1487
+ code: u.invalid_type,
1485
1488
  expected: h.never,
1486
1489
  received: t.parsedType
1487
1490
  }), g;
1488
1491
  }
1489
1492
  }
1490
- M.create = (r) => new M({
1493
+ $.create = (r) => new $({
1491
1494
  typeName: y.ZodNever,
1492
1495
  ...v(r)
1493
1496
  });
1494
- class ke extends _ {
1497
+ class xe extends _ {
1495
1498
  _parse(e) {
1496
1499
  if (this._getType(e) !== h.undefined) {
1497
1500
  const n = this._getOrReturnCtx(e);
1498
1501
  return f(n, {
1499
- code: d.invalid_type,
1502
+ code: u.invalid_type,
1500
1503
  expected: h.void,
1501
1504
  received: n.parsedType
1502
1505
  }), g;
1503
1506
  }
1504
- return S(e.data);
1507
+ return I(e.data);
1505
1508
  }
1506
1509
  }
1507
- ke.create = (r) => new ke({
1510
+ xe.create = (r) => new xe({
1508
1511
  typeName: y.ZodVoid,
1509
1512
  ...v(r)
1510
1513
  });
1511
- class A extends _ {
1514
+ class Z extends _ {
1512
1515
  _parse(e) {
1513
1516
  const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
1514
1517
  if (t.parsedType !== h.array)
1515
1518
  return f(t, {
1516
- code: d.invalid_type,
1519
+ code: u.invalid_type,
1517
1520
  expected: h.array,
1518
1521
  received: t.parsedType
1519
1522
  }), g;
1520
1523
  if (s.exactLength !== null) {
1521
- const c = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1522
- (c || o) && (f(t, {
1523
- code: c ? d.too_big : d.too_small,
1524
- minimum: o ? s.exactLength.value : void 0,
1525
- maximum: c ? s.exactLength.value : void 0,
1524
+ const o = t.data.length > s.exactLength.value, c = t.data.length < s.exactLength.value;
1525
+ (o || c) && (f(t, {
1526
+ code: o ? u.too_big : u.too_small,
1527
+ minimum: c ? s.exactLength.value : void 0,
1528
+ maximum: o ? s.exactLength.value : void 0,
1526
1529
  type: "array",
1527
1530
  inclusive: !0,
1528
1531
  exact: !0,
@@ -1530,50 +1533,50 @@ class A extends _ {
1530
1533
  }), n.dirty());
1531
1534
  }
1532
1535
  if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
1533
- code: d.too_small,
1536
+ code: u.too_small,
1534
1537
  minimum: s.minLength.value,
1535
1538
  type: "array",
1536
1539
  inclusive: !0,
1537
1540
  exact: !1,
1538
1541
  message: s.minLength.message
1539
1542
  }), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
1540
- code: d.too_big,
1543
+ code: u.too_big,
1541
1544
  maximum: s.maxLength.value,
1542
1545
  type: "array",
1543
1546
  inclusive: !0,
1544
1547
  exact: !1,
1545
1548
  message: s.maxLength.message
1546
1549
  }), n.dirty()), t.common.async)
1547
- return Promise.all([...t.data].map((c, o) => s.type._parseAsync(new E(t, c, t.path, o)))).then((c) => T.mergeArray(n, c));
1548
- const a = [...t.data].map((c, o) => s.type._parseSync(new E(t, c, t.path, o)));
1550
+ return Promise.all([...t.data].map((o, c) => s.type._parseAsync(new E(t, o, t.path, c)))).then((o) => T.mergeArray(n, o));
1551
+ const a = [...t.data].map((o, c) => s.type._parseSync(new E(t, o, t.path, c)));
1549
1552
  return T.mergeArray(n, a);
1550
1553
  }
1551
1554
  get element() {
1552
1555
  return this._def.type;
1553
1556
  }
1554
1557
  min(e, t) {
1555
- return new A({
1558
+ return new Z({
1556
1559
  ...this._def,
1557
- minLength: { value: e, message: m.toString(t) }
1560
+ minLength: { value: e, message: p.toString(t) }
1558
1561
  });
1559
1562
  }
1560
1563
  max(e, t) {
1561
- return new A({
1564
+ return new Z({
1562
1565
  ...this._def,
1563
- maxLength: { value: e, message: m.toString(t) }
1566
+ maxLength: { value: e, message: p.toString(t) }
1564
1567
  });
1565
1568
  }
1566
1569
  length(e, t) {
1567
- return new A({
1570
+ return new Z({
1568
1571
  ...this._def,
1569
- exactLength: { value: e, message: m.toString(t) }
1572
+ exactLength: { value: e, message: p.toString(t) }
1570
1573
  });
1571
1574
  }
1572
1575
  nonempty(e) {
1573
1576
  return this.min(1, e);
1574
1577
  }
1575
1578
  }
1576
- A.create = (r, e) => new A({
1579
+ Z.create = (r, e) => new Z({
1577
1580
  type: r,
1578
1581
  minLength: null,
1579
1582
  maxLength: null,
@@ -1581,21 +1584,21 @@ A.create = (r, e) => new A({
1581
1584
  typeName: y.ZodArray,
1582
1585
  ...v(e)
1583
1586
  });
1584
- function J(r) {
1587
+ function Q(r) {
1585
1588
  if (r instanceof k) {
1586
1589
  const e = {};
1587
1590
  for (const t in r.shape) {
1588
1591
  const n = r.shape[t];
1589
- e[t] = j.create(J(n));
1592
+ e[t] = j.create(Q(n));
1590
1593
  }
1591
1594
  return new k({
1592
1595
  ...r._def,
1593
1596
  shape: () => e
1594
1597
  });
1595
- } else return r instanceof A ? new A({
1598
+ } else return r instanceof Z ? new Z({
1596
1599
  ...r._def,
1597
- type: J(r.element)
1598
- }) : r instanceof j ? j.create(J(r.unwrap())) : r instanceof F ? F.create(J(r.unwrap())) : r instanceof R ? R.create(r.items.map((e) => J(e))) : r;
1600
+ type: Q(r.element)
1601
+ }) : r instanceof j ? j.create(Q(r.unwrap())) : r instanceof z ? z.create(Q(r.unwrap())) : r instanceof R ? R.create(r.items.map((e) => Q(e))) : r;
1599
1602
  }
1600
1603
  class k extends _ {
1601
1604
  constructor() {
@@ -1604,87 +1607,87 @@ class k extends _ {
1604
1607
  _getCached() {
1605
1608
  if (this._cached !== null)
1606
1609
  return this._cached;
1607
- const e = this._def.shape(), t = b.objectKeys(e);
1610
+ const e = this._def.shape(), t = x.objectKeys(e);
1608
1611
  return this._cached = { shape: e, keys: t };
1609
1612
  }
1610
1613
  _parse(e) {
1611
1614
  if (this._getType(e) !== h.object) {
1612
- const u = this._getOrReturnCtx(e);
1613
- return f(u, {
1614
- code: d.invalid_type,
1615
+ const l = this._getOrReturnCtx(e);
1616
+ return f(l, {
1617
+ code: u.invalid_type,
1615
1618
  expected: h.object,
1616
- received: u.parsedType
1619
+ received: l.parsedType
1617
1620
  }), g;
1618
1621
  }
1619
- const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: c } = this._getCached(), o = [];
1620
- if (!(this._def.catchall instanceof M && this._def.unknownKeys === "strip"))
1621
- for (const u in s.data)
1622
- c.includes(u) || o.push(u);
1623
- const l = [];
1624
- for (const u of c) {
1625
- const p = a[u], x = s.data[u];
1626
- l.push({
1627
- key: { status: "valid", value: u },
1628
- value: p._parse(new E(s, x, s.path, u)),
1629
- alwaysSet: u in s.data
1622
+ const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), c = [];
1623
+ if (!(this._def.catchall instanceof $ && this._def.unknownKeys === "strip"))
1624
+ for (const l in s.data)
1625
+ o.includes(l) || c.push(l);
1626
+ const d = [];
1627
+ for (const l of o) {
1628
+ const m = a[l], b = s.data[l];
1629
+ d.push({
1630
+ key: { status: "valid", value: l },
1631
+ value: m._parse(new E(s, b, s.path, l)),
1632
+ alwaysSet: l in s.data
1630
1633
  });
1631
1634
  }
1632
- if (this._def.catchall instanceof M) {
1633
- const u = this._def.unknownKeys;
1634
- if (u === "passthrough")
1635
- for (const p of o)
1636
- l.push({
1637
- key: { status: "valid", value: p },
1638
- value: { status: "valid", value: s.data[p] }
1635
+ if (this._def.catchall instanceof $) {
1636
+ const l = this._def.unknownKeys;
1637
+ if (l === "passthrough")
1638
+ for (const m of c)
1639
+ d.push({
1640
+ key: { status: "valid", value: m },
1641
+ value: { status: "valid", value: s.data[m] }
1639
1642
  });
1640
- else if (u === "strict")
1641
- o.length > 0 && (f(s, {
1642
- code: d.unrecognized_keys,
1643
- keys: o
1643
+ else if (l === "strict")
1644
+ c.length > 0 && (f(s, {
1645
+ code: u.unrecognized_keys,
1646
+ keys: c
1644
1647
  }), n.dirty());
1645
- else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1648
+ else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1646
1649
  } else {
1647
- const u = this._def.catchall;
1648
- for (const p of o) {
1649
- const x = s.data[p];
1650
- l.push({
1651
- key: { status: "valid", value: p },
1652
- value: u._parse(
1653
- new E(s, x, s.path, p)
1650
+ const l = this._def.catchall;
1651
+ for (const m of c) {
1652
+ const b = s.data[m];
1653
+ d.push({
1654
+ key: { status: "valid", value: m },
1655
+ value: l._parse(
1656
+ new E(s, b, s.path, m)
1654
1657
  //, ctx.child(key), value, getParsedType(value)
1655
1658
  ),
1656
- alwaysSet: p in s.data
1659
+ alwaysSet: m in s.data
1657
1660
  });
1658
1661
  }
1659
1662
  }
1660
1663
  return s.common.async ? Promise.resolve().then(async () => {
1661
- const u = [];
1662
- for (const p of l) {
1663
- const x = await p.key, O = await p.value;
1664
- u.push({
1665
- key: x,
1666
- value: O,
1667
- alwaysSet: p.alwaysSet
1664
+ const l = [];
1665
+ for (const m of d) {
1666
+ const b = await m.key, w = await m.value;
1667
+ l.push({
1668
+ key: b,
1669
+ value: w,
1670
+ alwaysSet: m.alwaysSet
1668
1671
  });
1669
1672
  }
1670
- return u;
1671
- }).then((u) => T.mergeObjectSync(n, u)) : T.mergeObjectSync(n, l);
1673
+ return l;
1674
+ }).then((l) => T.mergeObjectSync(n, l)) : T.mergeObjectSync(n, d);
1672
1675
  }
1673
1676
  get shape() {
1674
1677
  return this._def.shape();
1675
1678
  }
1676
1679
  strict(e) {
1677
- return m.errToObj, new k({
1680
+ return p.errToObj, new k({
1678
1681
  ...this._def,
1679
1682
  unknownKeys: "strict",
1680
1683
  ...e !== void 0 ? {
1681
1684
  errorMap: (t, n) => {
1682
- var s, a, c, o;
1683
- const l = (c = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && c !== void 0 ? c : n.defaultError;
1685
+ var s, a, o, c;
1686
+ const d = (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
1687
  return t.code === "unrecognized_keys" ? {
1685
- message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : l
1688
+ message: (c = p.errToObj(e).message) !== null && c !== void 0 ? c : d
1686
1689
  } : {
1687
- message: l
1690
+ message: d
1688
1691
  };
1689
1692
  }
1690
1693
  } : {}
@@ -1811,7 +1814,7 @@ class k extends _ {
1811
1814
  }
1812
1815
  pick(e) {
1813
1816
  const t = {};
1814
- return b.objectKeys(e).forEach((n) => {
1817
+ return x.objectKeys(e).forEach((n) => {
1815
1818
  e[n] && this.shape[n] && (t[n] = this.shape[n]);
1816
1819
  }), new k({
1817
1820
  ...this._def,
@@ -1820,7 +1823,7 @@ class k extends _ {
1820
1823
  }
1821
1824
  omit(e) {
1822
1825
  const t = {};
1823
- return b.objectKeys(this.shape).forEach((n) => {
1826
+ return x.objectKeys(this.shape).forEach((n) => {
1824
1827
  e[n] || (t[n] = this.shape[n]);
1825
1828
  }), new k({
1826
1829
  ...this._def,
@@ -1831,11 +1834,11 @@ class k extends _ {
1831
1834
  * @deprecated
1832
1835
  */
1833
1836
  deepPartial() {
1834
- return J(this);
1837
+ return Q(this);
1835
1838
  }
1836
1839
  partial(e) {
1837
1840
  const t = {};
1838
- return b.objectKeys(this.shape).forEach((n) => {
1841
+ return x.objectKeys(this.shape).forEach((n) => {
1839
1842
  const s = this.shape[n];
1840
1843
  e && !e[n] ? t[n] = s : t[n] = s.optional();
1841
1844
  }), new k({
@@ -1845,7 +1848,7 @@ class k extends _ {
1845
1848
  }
1846
1849
  required(e) {
1847
1850
  const t = {};
1848
- return b.objectKeys(this.shape).forEach((n) => {
1851
+ return x.objectKeys(this.shape).forEach((n) => {
1849
1852
  if (e && !e[n])
1850
1853
  t[n] = this.shape[n];
1851
1854
  else {
@@ -1860,49 +1863,49 @@ class k extends _ {
1860
1863
  });
1861
1864
  }
1862
1865
  keyof() {
1863
- return Ye(b.objectKeys(this.shape));
1866
+ return Be(x.objectKeys(this.shape));
1864
1867
  }
1865
1868
  }
1866
1869
  k.create = (r, e) => new k({
1867
1870
  shape: () => r,
1868
1871
  unknownKeys: "strip",
1869
- catchall: M.create(),
1872
+ catchall: $.create(),
1870
1873
  typeName: y.ZodObject,
1871
1874
  ...v(e)
1872
1875
  });
1873
1876
  k.strictCreate = (r, e) => new k({
1874
1877
  shape: () => r,
1875
1878
  unknownKeys: "strict",
1876
- catchall: M.create(),
1879
+ catchall: $.create(),
1877
1880
  typeName: y.ZodObject,
1878
1881
  ...v(e)
1879
1882
  });
1880
1883
  k.lazycreate = (r, e) => new k({
1881
1884
  shape: r,
1882
1885
  unknownKeys: "strip",
1883
- catchall: M.create(),
1886
+ catchall: $.create(),
1884
1887
  typeName: y.ZodObject,
1885
1888
  ...v(e)
1886
1889
  });
1887
- class ce extends _ {
1890
+ class oe extends _ {
1888
1891
  _parse(e) {
1889
1892
  const { ctx: t } = this._processInputParams(e), n = this._def.options;
1890
1893
  function s(a) {
1891
- for (const o of a)
1892
- if (o.result.status === "valid")
1893
- return o.result;
1894
- for (const o of a)
1895
- if (o.result.status === "dirty")
1896
- return t.common.issues.push(...o.ctx.common.issues), o.result;
1897
- const c = a.map((o) => new C(o.ctx.common.issues));
1894
+ for (const c of a)
1895
+ if (c.result.status === "valid")
1896
+ return c.result;
1897
+ for (const c of a)
1898
+ if (c.result.status === "dirty")
1899
+ return t.common.issues.push(...c.ctx.common.issues), c.result;
1900
+ const o = a.map((c) => new C(c.ctx.common.issues));
1898
1901
  return f(t, {
1899
- code: d.invalid_union,
1900
- unionErrors: c
1902
+ code: u.invalid_union,
1903
+ unionErrors: o
1901
1904
  }), g;
1902
1905
  }
1903
1906
  if (t.common.async)
1904
1907
  return Promise.all(n.map(async (a) => {
1905
- const c = {
1908
+ const o = {
1906
1909
  ...t,
1907
1910
  common: {
1908
1911
  ...t.common,
@@ -1914,37 +1917,37 @@ class ce extends _ {
1914
1917
  result: await a._parseAsync({
1915
1918
  data: t.data,
1916
1919
  path: t.path,
1917
- parent: c
1920
+ parent: o
1918
1921
  }),
1919
- ctx: c
1922
+ ctx: o
1920
1923
  };
1921
1924
  })).then(s);
1922
1925
  {
1923
1926
  let a;
1924
- const c = [];
1925
- for (const l of n) {
1926
- const u = {
1927
+ const o = [];
1928
+ for (const d of n) {
1929
+ const l = {
1927
1930
  ...t,
1928
1931
  common: {
1929
1932
  ...t.common,
1930
1933
  issues: []
1931
1934
  },
1932
1935
  parent: null
1933
- }, p = l._parseSync({
1936
+ }, m = d._parseSync({
1934
1937
  data: t.data,
1935
1938
  path: t.path,
1936
- parent: u
1939
+ parent: l
1937
1940
  });
1938
- if (p.status === "valid")
1939
- return p;
1940
- p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length && c.push(u.common.issues);
1941
+ if (m.status === "valid")
1942
+ return m;
1943
+ m.status === "dirty" && !a && (a = { result: m, ctx: l }), l.common.issues.length && o.push(l.common.issues);
1941
1944
  }
1942
1945
  if (a)
1943
1946
  return t.common.issues.push(...a.ctx.common.issues), a.result;
1944
- const o = c.map((l) => new C(l));
1947
+ const c = o.map((d) => new C(d));
1945
1948
  return f(t, {
1946
- code: d.invalid_union,
1947
- unionErrors: o
1949
+ code: u.invalid_union,
1950
+ unionErrors: c
1948
1951
  }), g;
1949
1952
  }
1950
1953
  }
@@ -1952,18 +1955,18 @@ class ce extends _ {
1952
1955
  return this._def.options;
1953
1956
  }
1954
1957
  }
1955
- ce.create = (r, e) => new ce({
1958
+ oe.create = (r, e) => new oe({
1956
1959
  options: r,
1957
1960
  typeName: y.ZodUnion,
1958
1961
  ...v(e)
1959
1962
  });
1960
- const P = (r) => r instanceof le ? P(r.schema) : r instanceof N ? P(r.innerType()) : r instanceof fe ? [r.value] : r instanceof z ? r.options : r instanceof he ? b.objectValues(r.enum) : r instanceof pe ? P(r._def.innerType) : r instanceof ie ? [void 0] : r instanceof oe ? [null] : r instanceof j ? [void 0, ...P(r.unwrap())] : r instanceof F ? [null, ...P(r.unwrap())] : r instanceof Re || r instanceof ye ? P(r.unwrap()) : r instanceof me ? P(r._def.innerType) : [];
1961
- class Se extends _ {
1963
+ const P = (r) => r instanceof ue ? P(r.schema) : r instanceof O ? P(r.innerType()) : r instanceof le ? [r.value] : r instanceof L ? r.options : r instanceof fe ? x.objectValues(r.enum) : r instanceof he ? P(r._def.innerType) : r instanceof ae ? [void 0] : r instanceof ie ? [null] : r instanceof j ? [void 0, ...P(r.unwrap())] : r instanceof z ? [null, ...P(r.unwrap())] : r instanceof Ee || r instanceof pe ? P(r.unwrap()) : r instanceof me ? P(r._def.innerType) : [];
1964
+ class Te extends _ {
1962
1965
  _parse(e) {
1963
1966
  const { ctx: t } = this._processInputParams(e);
1964
1967
  if (t.parsedType !== h.object)
1965
1968
  return f(t, {
1966
- code: d.invalid_type,
1969
+ code: u.invalid_type,
1967
1970
  expected: h.object,
1968
1971
  received: t.parsedType
1969
1972
  }), g;
@@ -1977,7 +1980,7 @@ class Se extends _ {
1977
1980
  path: t.path,
1978
1981
  parent: t
1979
1982
  }) : (f(t, {
1980
- code: d.invalid_union_discriminator,
1983
+ code: u.invalid_union_discriminator,
1981
1984
  options: Array.from(this.optionsMap.keys()),
1982
1985
  path: [n]
1983
1986
  }), g);
@@ -2002,16 +2005,16 @@ class Se extends _ {
2002
2005
  static create(e, t, n) {
2003
2006
  const s = /* @__PURE__ */ new Map();
2004
2007
  for (const a of t) {
2005
- const c = P(a.shape[e]);
2006
- if (!c.length)
2008
+ const o = P(a.shape[e]);
2009
+ if (!o.length)
2007
2010
  throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2008
- for (const o of c) {
2009
- if (s.has(o))
2010
- throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
2011
- s.set(o, a);
2011
+ for (const c of o) {
2012
+ if (s.has(c))
2013
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);
2014
+ s.set(c, a);
2012
2015
  }
2013
2016
  }
2014
- return new Se({
2017
+ return new Te({
2015
2018
  typeName: y.ZodDiscriminatedUnion,
2016
2019
  discriminator: e,
2017
2020
  options: t,
@@ -2020,40 +2023,40 @@ class Se extends _ {
2020
2023
  });
2021
2024
  }
2022
2025
  }
2023
- function Ee(r, e) {
2024
- const t = $(r), n = $(e);
2026
+ function je(r, e) {
2027
+ const t = D(r), n = D(e);
2025
2028
  if (r === e)
2026
2029
  return { valid: !0, data: r };
2027
2030
  if (t === h.object && n === h.object) {
2028
- const s = b.objectKeys(e), a = b.objectKeys(r).filter((o) => s.indexOf(o) !== -1), c = { ...r, ...e };
2029
- for (const o of a) {
2030
- const l = Ee(r[o], e[o]);
2031
- if (!l.valid)
2031
+ const s = x.objectKeys(e), a = x.objectKeys(r).filter((c) => s.indexOf(c) !== -1), o = { ...r, ...e };
2032
+ for (const c of a) {
2033
+ const d = je(r[c], e[c]);
2034
+ if (!d.valid)
2032
2035
  return { valid: !1 };
2033
- c[o] = l.data;
2036
+ o[c] = d.data;
2034
2037
  }
2035
- return { valid: !0, data: c };
2038
+ return { valid: !0, data: o };
2036
2039
  } else if (t === h.array && n === h.array) {
2037
2040
  if (r.length !== e.length)
2038
2041
  return { valid: !1 };
2039
2042
  const s = [];
2040
2043
  for (let a = 0; a < r.length; a++) {
2041
- const c = r[a], o = e[a], l = Ee(c, o);
2042
- if (!l.valid)
2044
+ const o = r[a], c = e[a], d = je(o, c);
2045
+ if (!d.valid)
2043
2046
  return { valid: !1 };
2044
- s.push(l.data);
2047
+ s.push(d.data);
2045
2048
  }
2046
2049
  return { valid: !0, data: s };
2047
2050
  } else return t === h.date && n === h.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
2048
2051
  }
2049
- class de extends _ {
2052
+ class ce extends _ {
2050
2053
  _parse(e) {
2051
- const { status: t, ctx: n } = this._processInputParams(e), s = (a, c) => {
2052
- if (Oe(a) || Oe(c))
2054
+ const { status: t, ctx: n } = this._processInputParams(e), s = (a, o) => {
2055
+ if (Ze(a) || Ze(o))
2053
2056
  return g;
2054
- const o = Ee(a.value, c.value);
2055
- return o.valid ? ((je(a) || je(c)) && t.dirty(), { status: t.value, value: o.data }) : (f(n, {
2056
- code: d.invalid_intersection_types
2057
+ const c = je(a.value, o.value);
2058
+ return c.valid ? ((Oe(a) || Oe(o)) && t.dirty(), { status: t.value, value: c.data }) : (f(n, {
2059
+ code: u.invalid_intersection_types
2057
2060
  }), g);
2058
2061
  };
2059
2062
  return n.common.async ? Promise.all([
@@ -2067,7 +2070,7 @@ class de extends _ {
2067
2070
  path: n.path,
2068
2071
  parent: n
2069
2072
  })
2070
- ]).then(([a, c]) => s(a, c)) : s(this._def.left._parseSync({
2073
+ ]).then(([a, o]) => s(a, o)) : s(this._def.left._parseSync({
2071
2074
  data: n.data,
2072
2075
  path: n.path,
2073
2076
  parent: n
@@ -2078,7 +2081,7 @@ class de extends _ {
2078
2081
  }));
2079
2082
  }
2080
2083
  }
2081
- de.create = (r, e, t) => new de({
2084
+ ce.create = (r, e, t) => new ce({
2082
2085
  left: r,
2083
2086
  right: e,
2084
2087
  typeName: y.ZodIntersection,
@@ -2089,30 +2092,30 @@ class R extends _ {
2089
2092
  const { status: t, ctx: n } = this._processInputParams(e);
2090
2093
  if (n.parsedType !== h.array)
2091
2094
  return f(n, {
2092
- code: d.invalid_type,
2095
+ code: u.invalid_type,
2093
2096
  expected: h.array,
2094
2097
  received: n.parsedType
2095
2098
  }), g;
2096
2099
  if (n.data.length < this._def.items.length)
2097
2100
  return f(n, {
2098
- code: d.too_small,
2101
+ code: u.too_small,
2099
2102
  minimum: this._def.items.length,
2100
2103
  inclusive: !0,
2101
2104
  exact: !1,
2102
2105
  type: "array"
2103
2106
  }), g;
2104
2107
  !this._def.rest && n.data.length > this._def.items.length && (f(n, {
2105
- code: d.too_big,
2108
+ code: u.too_big,
2106
2109
  maximum: this._def.items.length,
2107
2110
  inclusive: !0,
2108
2111
  exact: !1,
2109
2112
  type: "array"
2110
2113
  }), t.dirty());
2111
- const a = [...n.data].map((c, o) => {
2112
- const l = this._def.items[o] || this._def.rest;
2113
- return l ? l._parse(new E(n, c, n.path, o)) : null;
2114
- }).filter((c) => !!c);
2115
- return n.common.async ? Promise.all(a).then((c) => T.mergeArray(t, c)) : T.mergeArray(t, a);
2114
+ const a = [...n.data].map((o, c) => {
2115
+ const d = this._def.items[c] || this._def.rest;
2116
+ return d ? d._parse(new E(n, o, n.path, c)) : null;
2117
+ }).filter((o) => !!o);
2118
+ return n.common.async ? Promise.all(a).then((o) => T.mergeArray(t, o)) : T.mergeArray(t, a);
2116
2119
  }
2117
2120
  get items() {
2118
2121
  return this._def.items;
@@ -2134,7 +2137,7 @@ R.create = (r, e) => {
2134
2137
  ...v(e)
2135
2138
  });
2136
2139
  };
2137
- class ue extends _ {
2140
+ class de extends _ {
2138
2141
  get keySchema() {
2139
2142
  return this._def.keyType;
2140
2143
  }
@@ -2145,16 +2148,16 @@ class ue extends _ {
2145
2148
  const { status: t, ctx: n } = this._processInputParams(e);
2146
2149
  if (n.parsedType !== h.object)
2147
2150
  return f(n, {
2148
- code: d.invalid_type,
2151
+ code: u.invalid_type,
2149
2152
  expected: h.object,
2150
2153
  received: n.parsedType
2151
2154
  }), g;
2152
- const s = [], a = this._def.keyType, c = this._def.valueType;
2153
- for (const o in n.data)
2155
+ const s = [], a = this._def.keyType, o = this._def.valueType;
2156
+ for (const c in n.data)
2154
2157
  s.push({
2155
- key: a._parse(new E(n, o, n.path, o)),
2156
- value: c._parse(new E(n, n.data[o], n.path, o)),
2157
- alwaysSet: o in n.data
2158
+ key: a._parse(new E(n, c, n.path, c)),
2159
+ value: o._parse(new E(n, n.data[c], n.path, c)),
2160
+ alwaysSet: c in n.data
2158
2161
  });
2159
2162
  return n.common.async ? T.mergeObjectAsync(t, s) : T.mergeObjectSync(t, s);
2160
2163
  }
@@ -2162,20 +2165,20 @@ class ue extends _ {
2162
2165
  return this._def.valueType;
2163
2166
  }
2164
2167
  static create(e, t, n) {
2165
- return t instanceof _ ? new ue({
2168
+ return t instanceof _ ? new de({
2166
2169
  keyType: e,
2167
2170
  valueType: t,
2168
2171
  typeName: y.ZodRecord,
2169
2172
  ...v(n)
2170
- }) : new ue({
2171
- keyType: I.create(),
2173
+ }) : new de({
2174
+ keyType: N.create(),
2172
2175
  valueType: e,
2173
2176
  typeName: y.ZodRecord,
2174
2177
  ...v(t)
2175
2178
  });
2176
2179
  }
2177
2180
  }
2178
- class we extends _ {
2181
+ class ke extends _ {
2179
2182
  get keySchema() {
2180
2183
  return this._def.keyType;
2181
2184
  }
@@ -2186,62 +2189,62 @@ class we extends _ {
2186
2189
  const { status: t, ctx: n } = this._processInputParams(e);
2187
2190
  if (n.parsedType !== h.map)
2188
2191
  return f(n, {
2189
- code: d.invalid_type,
2192
+ code: u.invalid_type,
2190
2193
  expected: h.map,
2191
2194
  received: n.parsedType
2192
2195
  }), g;
2193
- const s = this._def.keyType, a = this._def.valueType, c = [...n.data.entries()].map(([o, l], u) => ({
2194
- key: s._parse(new E(n, o, n.path, [u, "key"])),
2195
- value: a._parse(new E(n, l, n.path, [u, "value"]))
2196
+ const s = this._def.keyType, a = this._def.valueType, o = [...n.data.entries()].map(([c, d], l) => ({
2197
+ key: s._parse(new E(n, c, n.path, [l, "key"])),
2198
+ value: a._parse(new E(n, d, n.path, [l, "value"]))
2196
2199
  }));
2197
2200
  if (n.common.async) {
2198
- const o = /* @__PURE__ */ new Map();
2201
+ const c = /* @__PURE__ */ new Map();
2199
2202
  return Promise.resolve().then(async () => {
2200
- for (const l of c) {
2201
- const u = await l.key, p = await l.value;
2202
- if (u.status === "aborted" || p.status === "aborted")
2203
+ for (const d of o) {
2204
+ const l = await d.key, m = await d.value;
2205
+ if (l.status === "aborted" || m.status === "aborted")
2203
2206
  return g;
2204
- (u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
2207
+ (l.status === "dirty" || m.status === "dirty") && t.dirty(), c.set(l.value, m.value);
2205
2208
  }
2206
- return { status: t.value, value: o };
2209
+ return { status: t.value, value: c };
2207
2210
  });
2208
2211
  } else {
2209
- const o = /* @__PURE__ */ new Map();
2210
- for (const l of c) {
2211
- const u = l.key, p = l.value;
2212
- if (u.status === "aborted" || p.status === "aborted")
2212
+ const c = /* @__PURE__ */ new Map();
2213
+ for (const d of o) {
2214
+ const l = d.key, m = d.value;
2215
+ if (l.status === "aborted" || m.status === "aborted")
2213
2216
  return g;
2214
- (u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
2217
+ (l.status === "dirty" || m.status === "dirty") && t.dirty(), c.set(l.value, m.value);
2215
2218
  }
2216
- return { status: t.value, value: o };
2219
+ return { status: t.value, value: c };
2217
2220
  }
2218
2221
  }
2219
2222
  }
2220
- we.create = (r, e, t) => new we({
2223
+ ke.create = (r, e, t) => new ke({
2221
2224
  valueType: e,
2222
2225
  keyType: r,
2223
2226
  typeName: y.ZodMap,
2224
2227
  ...v(t)
2225
2228
  });
2226
- class W extends _ {
2229
+ class q extends _ {
2227
2230
  _parse(e) {
2228
2231
  const { status: t, ctx: n } = this._processInputParams(e);
2229
2232
  if (n.parsedType !== h.set)
2230
2233
  return f(n, {
2231
- code: d.invalid_type,
2234
+ code: u.invalid_type,
2232
2235
  expected: h.set,
2233
2236
  received: n.parsedType
2234
2237
  }), g;
2235
2238
  const s = this._def;
2236
2239
  s.minSize !== null && n.data.size < s.minSize.value && (f(n, {
2237
- code: d.too_small,
2240
+ code: u.too_small,
2238
2241
  minimum: s.minSize.value,
2239
2242
  type: "set",
2240
2243
  inclusive: !0,
2241
2244
  exact: !1,
2242
2245
  message: s.minSize.message
2243
2246
  }), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (f(n, {
2244
- code: d.too_big,
2247
+ code: u.too_big,
2245
2248
  maximum: s.maxSize.value,
2246
2249
  type: "set",
2247
2250
  inclusive: !0,
@@ -2249,28 +2252,28 @@ class W extends _ {
2249
2252
  message: s.maxSize.message
2250
2253
  }), t.dirty());
2251
2254
  const a = this._def.valueType;
2252
- function c(l) {
2253
- const u = /* @__PURE__ */ new Set();
2254
- for (const p of l) {
2255
- if (p.status === "aborted")
2255
+ function o(d) {
2256
+ const l = /* @__PURE__ */ new Set();
2257
+ for (const m of d) {
2258
+ if (m.status === "aborted")
2256
2259
  return g;
2257
- p.status === "dirty" && t.dirty(), u.add(p.value);
2260
+ m.status === "dirty" && t.dirty(), l.add(m.value);
2258
2261
  }
2259
- return { status: t.value, value: u };
2262
+ return { status: t.value, value: l };
2260
2263
  }
2261
- const o = [...n.data.values()].map((l, u) => a._parse(new E(n, l, n.path, u)));
2262
- return n.common.async ? Promise.all(o).then((l) => c(l)) : c(o);
2264
+ const c = [...n.data.values()].map((d, l) => a._parse(new E(n, d, n.path, l)));
2265
+ return n.common.async ? Promise.all(c).then((d) => o(d)) : o(c);
2263
2266
  }
2264
2267
  min(e, t) {
2265
- return new W({
2268
+ return new q({
2266
2269
  ...this._def,
2267
- minSize: { value: e, message: m.toString(t) }
2270
+ minSize: { value: e, message: p.toString(t) }
2268
2271
  });
2269
2272
  }
2270
2273
  max(e, t) {
2271
- return new W({
2274
+ return new q({
2272
2275
  ...this._def,
2273
- maxSize: { value: e, message: m.toString(t) }
2276
+ maxSize: { value: e, message: p.toString(t) }
2274
2277
  });
2275
2278
  }
2276
2279
  size(e, t) {
@@ -2280,14 +2283,14 @@ class W extends _ {
2280
2283
  return this.min(1, e);
2281
2284
  }
2282
2285
  }
2283
- W.create = (r, e) => new W({
2286
+ q.create = (r, e) => new q({
2284
2287
  valueType: r,
2285
2288
  minSize: null,
2286
2289
  maxSize: null,
2287
2290
  typeName: y.ZodSet,
2288
2291
  ...v(e)
2289
2292
  });
2290
- class Q extends _ {
2293
+ class Y extends _ {
2291
2294
  constructor() {
2292
2295
  super(...arguments), this.validate = this.implement;
2293
2296
  }
@@ -2295,63 +2298,63 @@ class Q extends _ {
2295
2298
  const { ctx: t } = this._processInputParams(e);
2296
2299
  if (t.parsedType !== h.function)
2297
2300
  return f(t, {
2298
- code: d.invalid_type,
2301
+ code: u.invalid_type,
2299
2302
  expected: h.function,
2300
2303
  received: t.parsedType
2301
2304
  }), g;
2302
- function n(o, l) {
2303
- return _e({
2304
- data: o,
2305
+ function n(c, d) {
2306
+ return ve({
2307
+ data: c,
2305
2308
  path: t.path,
2306
2309
  errorMaps: [
2307
2310
  t.common.contextualErrorMap,
2308
2311
  t.schemaErrorMap,
2309
- ve(),
2310
- G
2311
- ].filter((u) => !!u),
2312
+ ge(),
2313
+ H
2314
+ ].filter((l) => !!l),
2312
2315
  issueData: {
2313
- code: d.invalid_arguments,
2314
- argumentsError: l
2316
+ code: u.invalid_arguments,
2317
+ argumentsError: d
2315
2318
  }
2316
2319
  });
2317
2320
  }
2318
- function s(o, l) {
2319
- return _e({
2320
- data: o,
2321
+ function s(c, d) {
2322
+ return ve({
2323
+ data: c,
2321
2324
  path: t.path,
2322
2325
  errorMaps: [
2323
2326
  t.common.contextualErrorMap,
2324
2327
  t.schemaErrorMap,
2325
- ve(),
2326
- G
2327
- ].filter((u) => !!u),
2328
+ ge(),
2329
+ H
2330
+ ].filter((l) => !!l),
2328
2331
  issueData: {
2329
- code: d.invalid_return_type,
2330
- returnTypeError: l
2332
+ code: u.invalid_return_type,
2333
+ returnTypeError: d
2331
2334
  }
2332
2335
  });
2333
2336
  }
2334
- const a = { errorMap: t.common.contextualErrorMap }, c = t.data;
2335
- if (this._def.returns instanceof K) {
2336
- const o = this;
2337
- return S(async function(...l) {
2338
- const u = new C([]), p = await o._def.args.parseAsync(l, a).catch((w) => {
2339
- throw u.addIssue(n(l, w)), u;
2340
- }), x = await Reflect.apply(c, this, p);
2341
- return await o._def.returns._def.type.parseAsync(x, a).catch((w) => {
2342
- throw u.addIssue(s(x, w)), u;
2337
+ const a = { errorMap: t.common.contextualErrorMap }, o = t.data;
2338
+ if (this._def.returns instanceof X) {
2339
+ const c = this;
2340
+ return I(async function(...d) {
2341
+ const l = new C([]), m = await c._def.args.parseAsync(d, a).catch((S) => {
2342
+ throw l.addIssue(n(d, S)), l;
2343
+ }), b = await Reflect.apply(o, this, m);
2344
+ return await c._def.returns._def.type.parseAsync(b, a).catch((S) => {
2345
+ throw l.addIssue(s(b, S)), l;
2343
2346
  });
2344
2347
  });
2345
2348
  } else {
2346
- const o = this;
2347
- return S(function(...l) {
2348
- const u = o._def.args.safeParse(l, a);
2349
- if (!u.success)
2350
- throw new C([n(l, u.error)]);
2351
- const p = Reflect.apply(c, this, u.data), x = o._def.returns.safeParse(p, a);
2352
- if (!x.success)
2353
- throw new C([s(p, x.error)]);
2354
- return x.data;
2349
+ const c = this;
2350
+ return I(function(...d) {
2351
+ const l = c._def.args.safeParse(d, a);
2352
+ if (!l.success)
2353
+ throw new C([n(d, l.error)]);
2354
+ const m = Reflect.apply(o, this, l.data), b = c._def.returns.safeParse(m, a);
2355
+ if (!b.success)
2356
+ throw new C([s(m, b.error)]);
2357
+ return b.data;
2355
2358
  });
2356
2359
  }
2357
2360
  }
@@ -2362,13 +2365,13 @@ class Q extends _ {
2362
2365
  return this._def.returns;
2363
2366
  }
2364
2367
  args(...e) {
2365
- return new Q({
2368
+ return new Y({
2366
2369
  ...this._def,
2367
2370
  args: R.create(e).rest(U.create())
2368
2371
  });
2369
2372
  }
2370
2373
  returns(e) {
2371
- return new Q({
2374
+ return new Y({
2372
2375
  ...this._def,
2373
2376
  returns: e
2374
2377
  });
@@ -2380,7 +2383,7 @@ class Q extends _ {
2380
2383
  return this.parse(e);
2381
2384
  }
2382
2385
  static create(e, t, n) {
2383
- return new Q({
2386
+ return new Y({
2384
2387
  args: e || R.create([]).rest(U.create()),
2385
2388
  returns: t || U.create(),
2386
2389
  typeName: y.ZodFunction,
@@ -2388,7 +2391,7 @@ class Q extends _ {
2388
2391
  });
2389
2392
  }
2390
2393
  }
2391
- class le extends _ {
2394
+ class ue extends _ {
2392
2395
  get schema() {
2393
2396
  return this._def.getter();
2394
2397
  }
@@ -2397,18 +2400,18 @@ class le extends _ {
2397
2400
  return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2398
2401
  }
2399
2402
  }
2400
- le.create = (r, e) => new le({
2403
+ ue.create = (r, e) => new ue({
2401
2404
  getter: r,
2402
2405
  typeName: y.ZodLazy,
2403
2406
  ...v(e)
2404
2407
  });
2405
- class fe extends _ {
2408
+ class le extends _ {
2406
2409
  _parse(e) {
2407
2410
  if (e.data !== this._def.value) {
2408
2411
  const t = this._getOrReturnCtx(e);
2409
2412
  return f(t, {
2410
2413
  received: t.data,
2411
- code: d.invalid_literal,
2414
+ code: u.invalid_literal,
2412
2415
  expected: this._def.value
2413
2416
  }), g;
2414
2417
  }
@@ -2418,40 +2421,40 @@ class fe extends _ {
2418
2421
  return this._def.value;
2419
2422
  }
2420
2423
  }
2421
- fe.create = (r, e) => new fe({
2424
+ le.create = (r, e) => new le({
2422
2425
  value: r,
2423
2426
  typeName: y.ZodLiteral,
2424
2427
  ...v(e)
2425
2428
  });
2426
- function Ye(r, e) {
2427
- return new z({
2429
+ function Be(r, e) {
2430
+ return new L({
2428
2431
  values: r,
2429
2432
  typeName: y.ZodEnum,
2430
2433
  ...v(e)
2431
2434
  });
2432
2435
  }
2433
- class z extends _ {
2436
+ class L extends _ {
2434
2437
  constructor() {
2435
- super(...arguments), re.set(this, void 0);
2438
+ super(...arguments), ee.set(this, void 0);
2436
2439
  }
2437
2440
  _parse(e) {
2438
2441
  if (typeof e.data != "string") {
2439
2442
  const t = this._getOrReturnCtx(e), n = this._def.values;
2440
2443
  return f(t, {
2441
- expected: b.joinValues(n),
2444
+ expected: x.joinValues(n),
2442
2445
  received: t.parsedType,
2443
- code: d.invalid_type
2446
+ code: u.invalid_type
2444
2447
  }), g;
2445
2448
  }
2446
- if (be(this, re) || Be(this, re, new Set(this._def.values)), !be(this, re).has(e.data)) {
2449
+ if (_e(this, ee) || Fe(this, ee, new Set(this._def.values)), !_e(this, ee).has(e.data)) {
2447
2450
  const t = this._getOrReturnCtx(e), n = this._def.values;
2448
2451
  return f(t, {
2449
2452
  received: t.data,
2450
- code: d.invalid_enum_value,
2453
+ code: u.invalid_enum_value,
2451
2454
  options: n
2452
2455
  }), g;
2453
2456
  }
2454
- return S(e.data);
2457
+ return I(e.data);
2455
2458
  }
2456
2459
  get options() {
2457
2460
  return this._def.values;
@@ -2475,55 +2478,55 @@ class z extends _ {
2475
2478
  return e;
2476
2479
  }
2477
2480
  extract(e, t = this._def) {
2478
- return z.create(e, {
2481
+ return L.create(e, {
2479
2482
  ...this._def,
2480
2483
  ...t
2481
2484
  });
2482
2485
  }
2483
2486
  exclude(e, t = this._def) {
2484
- return z.create(this.options.filter((n) => !e.includes(n)), {
2487
+ return L.create(this.options.filter((n) => !e.includes(n)), {
2485
2488
  ...this._def,
2486
2489
  ...t
2487
2490
  });
2488
2491
  }
2489
2492
  }
2490
- re = /* @__PURE__ */ new WeakMap();
2491
- z.create = Ye;
2492
- class he extends _ {
2493
+ ee = /* @__PURE__ */ new WeakMap();
2494
+ L.create = Be;
2495
+ class fe extends _ {
2493
2496
  constructor() {
2494
- super(...arguments), ne.set(this, void 0);
2497
+ super(...arguments), te.set(this, void 0);
2495
2498
  }
2496
2499
  _parse(e) {
2497
- const t = b.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2500
+ const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2498
2501
  if (n.parsedType !== h.string && n.parsedType !== h.number) {
2499
- const s = b.objectValues(t);
2502
+ const s = x.objectValues(t);
2500
2503
  return f(n, {
2501
- expected: b.joinValues(s),
2504
+ expected: x.joinValues(s),
2502
2505
  received: n.parsedType,
2503
- code: d.invalid_type
2506
+ code: u.invalid_type
2504
2507
  }), g;
2505
2508
  }
2506
- if (be(this, ne) || Be(this, ne, new Set(b.getValidEnumValues(this._def.values))), !be(this, ne).has(e.data)) {
2507
- const s = b.objectValues(t);
2509
+ if (_e(this, te) || Fe(this, te, new Set(x.getValidEnumValues(this._def.values))), !_e(this, te).has(e.data)) {
2510
+ const s = x.objectValues(t);
2508
2511
  return f(n, {
2509
2512
  received: n.data,
2510
- code: d.invalid_enum_value,
2513
+ code: u.invalid_enum_value,
2511
2514
  options: s
2512
2515
  }), g;
2513
2516
  }
2514
- return S(e.data);
2517
+ return I(e.data);
2515
2518
  }
2516
2519
  get enum() {
2517
2520
  return this._def.values;
2518
2521
  }
2519
2522
  }
2520
- ne = /* @__PURE__ */ new WeakMap();
2521
- he.create = (r, e) => new he({
2523
+ te = /* @__PURE__ */ new WeakMap();
2524
+ fe.create = (r, e) => new fe({
2522
2525
  values: r,
2523
2526
  typeName: y.ZodNativeEnum,
2524
2527
  ...v(e)
2525
2528
  });
2526
- class K extends _ {
2529
+ class X extends _ {
2527
2530
  unwrap() {
2528
2531
  return this._def.type;
2529
2532
  }
@@ -2531,23 +2534,23 @@ class K extends _ {
2531
2534
  const { ctx: t } = this._processInputParams(e);
2532
2535
  if (t.parsedType !== h.promise && t.common.async === !1)
2533
2536
  return f(t, {
2534
- code: d.invalid_type,
2537
+ code: u.invalid_type,
2535
2538
  expected: h.promise,
2536
2539
  received: t.parsedType
2537
2540
  }), g;
2538
2541
  const n = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
2539
- return S(n.then((s) => this._def.type.parseAsync(s, {
2542
+ return I(n.then((s) => this._def.type.parseAsync(s, {
2540
2543
  path: t.path,
2541
2544
  errorMap: t.common.contextualErrorMap
2542
2545
  })));
2543
2546
  }
2544
2547
  }
2545
- K.create = (r, e) => new K({
2548
+ X.create = (r, e) => new X({
2546
2549
  type: r,
2547
2550
  typeName: y.ZodPromise,
2548
2551
  ...v(e)
2549
2552
  });
2550
- class N extends _ {
2553
+ class O extends _ {
2551
2554
  innerType() {
2552
2555
  return this._def.schema;
2553
2556
  }
@@ -2556,81 +2559,81 @@ class N extends _ {
2556
2559
  }
2557
2560
  _parse(e) {
2558
2561
  const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
2559
- addIssue: (c) => {
2560
- f(n, c), c.fatal ? t.abort() : t.dirty();
2562
+ addIssue: (o) => {
2563
+ f(n, o), o.fatal ? t.abort() : t.dirty();
2561
2564
  },
2562
2565
  get path() {
2563
2566
  return n.path;
2564
2567
  }
2565
2568
  };
2566
2569
  if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
2567
- const c = s.transform(n.data, a);
2570
+ const o = s.transform(n.data, a);
2568
2571
  if (n.common.async)
2569
- return Promise.resolve(c).then(async (o) => {
2572
+ return Promise.resolve(o).then(async (c) => {
2570
2573
  if (t.value === "aborted")
2571
2574
  return g;
2572
- const l = await this._def.schema._parseAsync({
2573
- data: o,
2575
+ const d = await this._def.schema._parseAsync({
2576
+ data: c,
2574
2577
  path: n.path,
2575
2578
  parent: n
2576
2579
  });
2577
- return l.status === "aborted" ? g : l.status === "dirty" || t.value === "dirty" ? Y(l.value) : l;
2580
+ return d.status === "aborted" ? g : d.status === "dirty" || t.value === "dirty" ? J(d.value) : d;
2578
2581
  });
2579
2582
  {
2580
2583
  if (t.value === "aborted")
2581
2584
  return g;
2582
- const o = this._def.schema._parseSync({
2583
- data: c,
2585
+ const c = this._def.schema._parseSync({
2586
+ data: o,
2584
2587
  path: n.path,
2585
2588
  parent: n
2586
2589
  });
2587
- return o.status === "aborted" ? g : o.status === "dirty" || t.value === "dirty" ? Y(o.value) : o;
2590
+ return c.status === "aborted" ? g : c.status === "dirty" || t.value === "dirty" ? J(c.value) : c;
2588
2591
  }
2589
2592
  }
2590
2593
  if (s.type === "refinement") {
2591
- const c = (o) => {
2592
- const l = s.refinement(o, a);
2594
+ const o = (c) => {
2595
+ const d = s.refinement(c, a);
2593
2596
  if (n.common.async)
2594
- return Promise.resolve(l);
2595
- if (l instanceof Promise)
2597
+ return Promise.resolve(d);
2598
+ if (d instanceof Promise)
2596
2599
  throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2597
- return o;
2600
+ return c;
2598
2601
  };
2599
2602
  if (n.common.async === !1) {
2600
- const o = this._def.schema._parseSync({
2603
+ const c = this._def.schema._parseSync({
2601
2604
  data: n.data,
2602
2605
  path: n.path,
2603
2606
  parent: n
2604
2607
  });
2605
- return o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), c(o.value), { status: t.value, value: o.value });
2608
+ return c.status === "aborted" ? g : (c.status === "dirty" && t.dirty(), o(c.value), { status: t.value, value: c.value });
2606
2609
  } else
2607
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), c(o.value).then(() => ({ status: t.value, value: o.value }))));
2610
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => c.status === "aborted" ? g : (c.status === "dirty" && t.dirty(), o(c.value).then(() => ({ status: t.value, value: c.value }))));
2608
2611
  }
2609
2612
  if (s.type === "transform")
2610
2613
  if (n.common.async === !1) {
2611
- const c = this._def.schema._parseSync({
2614
+ const o = this._def.schema._parseSync({
2612
2615
  data: n.data,
2613
2616
  path: n.path,
2614
2617
  parent: n
2615
2618
  });
2616
- if (!B(c))
2617
- return c;
2618
- const o = s.transform(c.value, a);
2619
- if (o instanceof Promise)
2619
+ if (!B(o))
2620
+ return o;
2621
+ const c = s.transform(o.value, a);
2622
+ if (c instanceof Promise)
2620
2623
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2621
- return { status: t.value, value: o };
2624
+ return { status: t.value, value: c };
2622
2625
  } else
2623
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => B(c) ? Promise.resolve(s.transform(c.value, a)).then((o) => ({ status: t.value, value: o })) : c);
2624
- b.assertNever(s);
2626
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => B(o) ? Promise.resolve(s.transform(o.value, a)).then((c) => ({ status: t.value, value: c })) : o);
2627
+ x.assertNever(s);
2625
2628
  }
2626
2629
  }
2627
- N.create = (r, e, t) => new N({
2630
+ O.create = (r, e, t) => new O({
2628
2631
  schema: r,
2629
2632
  typeName: y.ZodEffects,
2630
2633
  effect: e,
2631
2634
  ...v(t)
2632
2635
  });
2633
- N.createWithPreprocess = (r, e, t) => new N({
2636
+ O.createWithPreprocess = (r, e, t) => new O({
2634
2637
  schema: e,
2635
2638
  effect: { type: "preprocess", transform: r },
2636
2639
  typeName: y.ZodEffects,
@@ -2638,7 +2641,7 @@ N.createWithPreprocess = (r, e, t) => new N({
2638
2641
  });
2639
2642
  class j extends _ {
2640
2643
  _parse(e) {
2641
- return this._getType(e) === h.undefined ? S(void 0) : this._def.innerType._parse(e);
2644
+ return this._getType(e) === h.undefined ? I(void 0) : this._def.innerType._parse(e);
2642
2645
  }
2643
2646
  unwrap() {
2644
2647
  return this._def.innerType;
@@ -2649,20 +2652,20 @@ j.create = (r, e) => new j({
2649
2652
  typeName: y.ZodOptional,
2650
2653
  ...v(e)
2651
2654
  });
2652
- class F extends _ {
2655
+ class z extends _ {
2653
2656
  _parse(e) {
2654
- return this._getType(e) === h.null ? S(null) : this._def.innerType._parse(e);
2657
+ return this._getType(e) === h.null ? I(null) : this._def.innerType._parse(e);
2655
2658
  }
2656
2659
  unwrap() {
2657
2660
  return this._def.innerType;
2658
2661
  }
2659
2662
  }
2660
- F.create = (r, e) => new F({
2663
+ z.create = (r, e) => new z({
2661
2664
  innerType: r,
2662
2665
  typeName: y.ZodNullable,
2663
2666
  ...v(e)
2664
2667
  });
2665
- class pe extends _ {
2668
+ class he extends _ {
2666
2669
  _parse(e) {
2667
2670
  const { ctx: t } = this._processInputParams(e);
2668
2671
  let n = t.data;
@@ -2676,7 +2679,7 @@ class pe extends _ {
2676
2679
  return this._def.innerType;
2677
2680
  }
2678
2681
  }
2679
- pe.create = (r, e) => new pe({
2682
+ he.create = (r, e) => new he({
2680
2683
  innerType: r,
2681
2684
  typeName: y.ZodDefault,
2682
2685
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
@@ -2697,7 +2700,7 @@ class me extends _ {
2697
2700
  ...n
2698
2701
  }
2699
2702
  });
2700
- return se(s) ? s.then((a) => ({
2703
+ return ne(s) ? s.then((a) => ({
2701
2704
  status: "valid",
2702
2705
  value: a.status === "valid" ? a.value : this._def.catchValue({
2703
2706
  get error() {
@@ -2725,12 +2728,12 @@ me.create = (r, e) => new me({
2725
2728
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2726
2729
  ...v(e)
2727
2730
  });
2728
- class Te extends _ {
2731
+ class we extends _ {
2729
2732
  _parse(e) {
2730
2733
  if (this._getType(e) !== h.nan) {
2731
2734
  const n = this._getOrReturnCtx(e);
2732
2735
  return f(n, {
2733
- code: d.invalid_type,
2736
+ code: u.invalid_type,
2734
2737
  expected: h.nan,
2735
2738
  received: n.parsedType
2736
2739
  }), g;
@@ -2738,12 +2741,12 @@ class Te extends _ {
2738
2741
  return { status: "valid", value: e.data };
2739
2742
  }
2740
2743
  }
2741
- Te.create = (r) => new Te({
2744
+ we.create = (r) => new we({
2742
2745
  typeName: y.ZodNaN,
2743
2746
  ...v(r)
2744
2747
  });
2745
2748
  const At = Symbol("zod_brand");
2746
- class Re extends _ {
2749
+ class Ee extends _ {
2747
2750
  _parse(e) {
2748
2751
  const { ctx: t } = this._processInputParams(e), n = t.data;
2749
2752
  return this._def.type._parse({
@@ -2756,7 +2759,7 @@ class Re extends _ {
2756
2759
  return this._def.type;
2757
2760
  }
2758
2761
  }
2759
- class ge extends _ {
2762
+ class ye extends _ {
2760
2763
  _parse(e) {
2761
2764
  const { status: t, ctx: n } = this._processInputParams(e);
2762
2765
  if (n.common.async)
@@ -2766,7 +2769,7 @@ class ge extends _ {
2766
2769
  path: n.path,
2767
2770
  parent: n
2768
2771
  });
2769
- return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), Y(a.value)) : this._def.out._parseAsync({
2772
+ return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), J(a.value)) : this._def.out._parseAsync({
2770
2773
  data: a.value,
2771
2774
  path: n.path,
2772
2775
  parent: n
@@ -2789,48 +2792,48 @@ class ge extends _ {
2789
2792
  }
2790
2793
  }
2791
2794
  static create(e, t) {
2792
- return new ge({
2795
+ return new ye({
2793
2796
  in: e,
2794
2797
  out: t,
2795
2798
  typeName: y.ZodPipeline
2796
2799
  });
2797
2800
  }
2798
2801
  }
2799
- class ye extends _ {
2802
+ class pe extends _ {
2800
2803
  _parse(e) {
2801
2804
  const t = this._def.innerType._parse(e), n = (s) => (B(s) && (s.value = Object.freeze(s.value)), s);
2802
- return se(t) ? t.then((s) => n(s)) : n(t);
2805
+ return ne(t) ? t.then((s) => n(s)) : n(t);
2803
2806
  }
2804
2807
  unwrap() {
2805
2808
  return this._def.innerType;
2806
2809
  }
2807
2810
  }
2808
- ye.create = (r, e) => new ye({
2811
+ pe.create = (r, e) => new pe({
2809
2812
  innerType: r,
2810
2813
  typeName: y.ZodReadonly,
2811
2814
  ...v(e)
2812
2815
  });
2813
- function Ve(r, e) {
2816
+ function Me(r, e) {
2814
2817
  const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
2815
2818
  return typeof t == "string" ? { message: t } : t;
2816
2819
  }
2817
- function Qe(r, e = {}, t) {
2818
- return r ? X.create().superRefine((n, s) => {
2819
- var a, c;
2820
- const o = r(n);
2821
- if (o instanceof Promise)
2822
- return o.then((l) => {
2823
- var u, p;
2824
- if (!l) {
2825
- const x = Ve(e, n), O = (p = (u = x.fatal) !== null && u !== void 0 ? u : t) !== null && p !== void 0 ? p : !0;
2826
- s.addIssue({ code: "custom", ...x, fatal: O });
2820
+ function We(r, e = {}, t) {
2821
+ return r ? G.create().superRefine((n, s) => {
2822
+ var a, o;
2823
+ const c = r(n);
2824
+ if (c instanceof Promise)
2825
+ return c.then((d) => {
2826
+ var l, m;
2827
+ if (!d) {
2828
+ const b = Me(e, n), w = (m = (l = b.fatal) !== null && l !== void 0 ? l : t) !== null && m !== void 0 ? m : !0;
2829
+ s.addIssue({ code: "custom", ...b, fatal: w });
2827
2830
  }
2828
2831
  });
2829
- if (!o) {
2830
- const l = Ve(e, n), u = (c = (a = l.fatal) !== null && a !== void 0 ? a : t) !== null && c !== void 0 ? c : !0;
2831
- s.addIssue({ code: "custom", ...l, fatal: u });
2832
+ if (!c) {
2833
+ const d = Me(e, n), l = (o = (a = d.fatal) !== null && a !== void 0 ? a : t) !== null && o !== void 0 ? o : !0;
2834
+ s.addIssue({ code: "custom", ...d, fatal: l });
2832
2835
  }
2833
- }) : X.create();
2836
+ }) : G.create();
2834
2837
  }
2835
2838
  const Nt = {
2836
2839
  object: k.lazycreate
@@ -2839,135 +2842,135 @@ var y;
2839
2842
  (function(r) {
2840
2843
  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
2844
  })(y || (y = {}));
2842
- const Ot = (r, e = {
2845
+ const Zt = (r, e = {
2843
2846
  message: `Input not instance of ${r.name}`
2844
- }) => Qe((t) => t instanceof r, e), He = I.create, Ge = V.create, jt = Te.create, Et = L.create, Xe = ae.create, Rt = q.create, Pt = xe.create, $t = ie.create, Dt = oe.create, Mt = X.create, Vt = U.create, Lt = M.create, zt = ke.create, Ft = A.create, Ut = k.create, Bt = k.strictCreate, qt = ce.create, Wt = Se.create, Jt = de.create, Yt = R.create, Qt = ue.create, Ht = we.create, Gt = W.create, Xt = Q.create, Kt = le.create, er = fe.create, tr = z.create, rr = he.create, nr = K.create, Le = N.create, sr = j.create, ar = F.create, ir = N.createWithPreprocess, or = ge.create, cr = () => He().optional(), dr = () => Ge().optional(), ur = () => Xe().optional(), lr = {
2845
- string: (r) => I.create({ ...r, coerce: !0 }),
2847
+ }) => We((t) => t instanceof r, e), qe = N.create, Qe = V.create, Ot = we.create, jt = F.create, Je = se.create, Et = W.create, Rt = be.create, Pt = ae.create, Dt = ie.create, Mt = G.create, $t = U.create, Vt = $.create, Ft = xe.create, Lt = Z.create, zt = k.create, Ut = k.strictCreate, Bt = oe.create, Wt = Te.create, qt = ce.create, Qt = R.create, Jt = de.create, Yt = ke.create, Ht = q.create, Gt = Y.create, Xt = ue.create, Kt = le.create, er = L.create, tr = fe.create, rr = X.create, $e = O.create, nr = j.create, sr = z.create, ar = O.createWithPreprocess, ir = ye.create, or = () => qe().optional(), cr = () => Qe().optional(), dr = () => Je().optional(), ur = {
2848
+ string: (r) => N.create({ ...r, coerce: !0 }),
2846
2849
  number: (r) => V.create({ ...r, coerce: !0 }),
2847
- boolean: (r) => ae.create({
2850
+ boolean: (r) => se.create({
2848
2851
  ...r,
2849
2852
  coerce: !0
2850
2853
  }),
2851
- bigint: (r) => L.create({ ...r, coerce: !0 }),
2852
- date: (r) => q.create({ ...r, coerce: !0 })
2853
- }, fr = g;
2854
+ bigint: (r) => F.create({ ...r, coerce: !0 }),
2855
+ date: (r) => W.create({ ...r, coerce: !0 })
2856
+ }, lr = g;
2854
2857
  var i = /* @__PURE__ */ Object.freeze({
2855
2858
  __proto__: null,
2856
- defaultErrorMap: G,
2857
- setErrorMap: it,
2858
- getErrorMap: ve,
2859
- makeIssue: _e,
2860
- EMPTY_PATH: ot,
2859
+ defaultErrorMap: H,
2860
+ setErrorMap: at,
2861
+ getErrorMap: ge,
2862
+ makeIssue: ve,
2863
+ EMPTY_PATH: it,
2861
2864
  addIssueToContext: f,
2862
2865
  ParseStatus: T,
2863
2866
  INVALID: g,
2864
- DIRTY: Y,
2865
- OK: S,
2866
- isAborted: Oe,
2867
- isDirty: je,
2867
+ DIRTY: J,
2868
+ OK: I,
2869
+ isAborted: Ze,
2870
+ isDirty: Oe,
2868
2871
  isValid: B,
2869
- isAsync: se,
2872
+ isAsync: ne,
2870
2873
  get util() {
2871
- return b;
2874
+ return x;
2872
2875
  },
2873
2876
  get objectUtil() {
2874
2877
  return Ne;
2875
2878
  },
2876
2879
  ZodParsedType: h,
2877
- getParsedType: $,
2880
+ getParsedType: D,
2878
2881
  ZodType: _,
2879
- datetimeRegex: Je,
2880
- ZodString: I,
2882
+ datetimeRegex: Ue,
2883
+ ZodString: N,
2881
2884
  ZodNumber: V,
2882
- ZodBigInt: L,
2883
- ZodBoolean: ae,
2884
- ZodDate: q,
2885
- ZodSymbol: xe,
2886
- ZodUndefined: ie,
2887
- ZodNull: oe,
2888
- ZodAny: X,
2885
+ ZodBigInt: F,
2886
+ ZodBoolean: se,
2887
+ ZodDate: W,
2888
+ ZodSymbol: be,
2889
+ ZodUndefined: ae,
2890
+ ZodNull: ie,
2891
+ ZodAny: G,
2889
2892
  ZodUnknown: U,
2890
- ZodNever: M,
2891
- ZodVoid: ke,
2892
- ZodArray: A,
2893
+ ZodNever: $,
2894
+ ZodVoid: xe,
2895
+ ZodArray: Z,
2893
2896
  ZodObject: k,
2894
- ZodUnion: ce,
2895
- ZodDiscriminatedUnion: Se,
2896
- ZodIntersection: de,
2897
+ ZodUnion: oe,
2898
+ ZodDiscriminatedUnion: Te,
2899
+ ZodIntersection: ce,
2897
2900
  ZodTuple: R,
2898
- ZodRecord: ue,
2899
- ZodMap: we,
2900
- ZodSet: W,
2901
- ZodFunction: Q,
2902
- ZodLazy: le,
2903
- ZodLiteral: fe,
2904
- ZodEnum: z,
2905
- ZodNativeEnum: he,
2906
- ZodPromise: K,
2907
- ZodEffects: N,
2908
- ZodTransformer: N,
2901
+ ZodRecord: de,
2902
+ ZodMap: ke,
2903
+ ZodSet: q,
2904
+ ZodFunction: Y,
2905
+ ZodLazy: ue,
2906
+ ZodLiteral: le,
2907
+ ZodEnum: L,
2908
+ ZodNativeEnum: fe,
2909
+ ZodPromise: X,
2910
+ ZodEffects: O,
2911
+ ZodTransformer: O,
2909
2912
  ZodOptional: j,
2910
- ZodNullable: F,
2911
- ZodDefault: pe,
2913
+ ZodNullable: z,
2914
+ ZodDefault: he,
2912
2915
  ZodCatch: me,
2913
- ZodNaN: Te,
2916
+ ZodNaN: we,
2914
2917
  BRAND: At,
2915
- ZodBranded: Re,
2916
- ZodPipeline: ge,
2917
- ZodReadonly: ye,
2918
- custom: Qe,
2918
+ ZodBranded: Ee,
2919
+ ZodPipeline: ye,
2920
+ ZodReadonly: pe,
2921
+ custom: We,
2919
2922
  Schema: _,
2920
2923
  ZodSchema: _,
2921
2924
  late: Nt,
2922
2925
  get ZodFirstPartyTypeKind() {
2923
2926
  return y;
2924
2927
  },
2925
- coerce: lr,
2928
+ coerce: ur,
2926
2929
  any: Mt,
2927
- array: Ft,
2928
- bigint: Et,
2929
- boolean: Xe,
2930
- date: Rt,
2930
+ array: Lt,
2931
+ bigint: jt,
2932
+ boolean: Je,
2933
+ date: Et,
2931
2934
  discriminatedUnion: Wt,
2932
- effect: Le,
2933
- enum: tr,
2934
- function: Xt,
2935
- instanceof: Ot,
2936
- intersection: Jt,
2937
- lazy: Kt,
2938
- literal: er,
2939
- map: Ht,
2940
- nan: jt,
2941
- nativeEnum: rr,
2942
- never: Lt,
2935
+ effect: $e,
2936
+ enum: er,
2937
+ function: Gt,
2938
+ instanceof: Zt,
2939
+ intersection: qt,
2940
+ lazy: Xt,
2941
+ literal: Kt,
2942
+ map: Yt,
2943
+ nan: Ot,
2944
+ nativeEnum: tr,
2945
+ never: Vt,
2943
2946
  null: Dt,
2944
- nullable: ar,
2945
- number: Ge,
2946
- object: Ut,
2947
- oboolean: ur,
2948
- onumber: dr,
2949
- optional: sr,
2950
- ostring: cr,
2951
- pipeline: or,
2952
- preprocess: ir,
2953
- promise: nr,
2954
- record: Qt,
2955
- set: Gt,
2956
- strictObject: Bt,
2957
- string: He,
2958
- symbol: Pt,
2959
- transformer: Le,
2960
- tuple: Yt,
2961
- undefined: $t,
2962
- union: qt,
2963
- unknown: Vt,
2964
- void: zt,
2965
- NEVER: fr,
2966
- ZodIssueCode: d,
2967
- quotelessJson: at,
2947
+ nullable: sr,
2948
+ number: Qe,
2949
+ object: zt,
2950
+ oboolean: dr,
2951
+ onumber: cr,
2952
+ optional: nr,
2953
+ ostring: or,
2954
+ pipeline: ir,
2955
+ preprocess: ar,
2956
+ promise: rr,
2957
+ record: Jt,
2958
+ set: Ht,
2959
+ strictObject: Ut,
2960
+ string: qe,
2961
+ symbol: Rt,
2962
+ transformer: $e,
2963
+ tuple: Qt,
2964
+ undefined: Pt,
2965
+ union: Bt,
2966
+ unknown: $t,
2967
+ void: Ft,
2968
+ NEVER: lr,
2969
+ ZodIssueCode: u,
2970
+ quotelessJson: st,
2968
2971
  ZodError: C
2969
2972
  });
2970
- const hr = i.object({
2973
+ const fr = i.object({
2971
2974
  country: i.string(),
2972
2975
  city: i.string(),
2973
2976
  street: i.string(),
@@ -2975,37 +2978,37 @@ const hr = i.object({
2975
2978
  floor: i.string(),
2976
2979
  apartmentEnterNumber: i.string(),
2977
2980
  apartmentNumber: i.string()
2978
- }), D = i.string().min(1, { message: "שדה חובה" }), br = i.string().regex(/^\d+$/, "Must be a numeric string"), xr = i.object({ url: i.string().url(), id: i.string() });
2979
- function kr(r) {
2981
+ }), M = i.string().min(1, { message: "שדה חובה" }), Ir = i.string().regex(/^\d+$/, "Must be a numeric string"), Sr = i.object({ url: i.string().url(), id: i.string() });
2982
+ function Cr(r) {
2980
2983
  return !!(r != null && r.url);
2981
2984
  }
2982
- const H = i.object({
2985
+ const re = i.object({
2983
2986
  lang: i.enum(["he"]),
2984
2987
  value: i.string()
2985
- }), wr = i.array(H), Ke = i.object({
2988
+ }), Ar = i.array(re), Ye = i.object({
2986
2989
  id: i.string().min(1),
2987
2990
  companyId: i.string().min(1),
2988
2991
  storeId: i.string().min(1),
2989
2992
  parentId: i.string().nullish(),
2990
2993
  tag: i.string().optional(),
2991
- locales: i.array(H),
2994
+ locales: i.array(re),
2992
2995
  depth: i.number()
2993
- }), Pe = Ke.extend({
2994
- children: i.lazy(() => Pe.array())
2995
- }), Tr = Ke.extend({
2996
+ }), Re = Ye.extend({
2997
+ children: i.lazy(() => Re.array())
2998
+ }), Nr = Ye.extend({
2996
2999
  index: i.number(),
2997
3000
  depth: i.number(),
2998
3001
  collapsed: i.boolean().optional(),
2999
- children: i.array(Pe)
3000
- }), te = i.string().min(1), et = i.object({
3002
+ children: i.array(Re)
3003
+ }), K = i.string().min(1), He = i.object({
3001
3004
  type: i.literal("Product"),
3002
- storeId: te,
3003
- companyId: te,
3004
- id: te,
3005
- objectID: te,
3006
- sku: te,
3007
- name: i.array(H),
3008
- description: i.array(H),
3005
+ storeId: K,
3006
+ companyId: K,
3007
+ id: K,
3008
+ objectID: K,
3009
+ sku: K,
3010
+ name: i.array(re),
3011
+ description: i.array(re),
3009
3012
  isPublished: i.boolean(),
3010
3013
  vat: i.boolean(),
3011
3014
  priceType: i.object({
@@ -3034,12 +3037,12 @@ const H = i.object({
3034
3037
  brand: i.string(),
3035
3038
  importer: i.string(),
3036
3039
  supplier: i.string(),
3037
- ingredients: i.array(H),
3040
+ ingredients: i.array(re),
3038
3041
  created_at: i.number(),
3039
3042
  updated_at: i.number(),
3040
3043
  categoryIds: i.array(i.string().nonempty()),
3041
3044
  // @deprecated
3042
- categoryList: i.array(Pe),
3045
+ categoryList: i.array(Re),
3043
3046
  // @deprecated
3044
3047
  categories: i.object({
3045
3048
  lvl0: i.array(i.string()),
@@ -3050,51 +3053,51 @@ const H = i.object({
3050
3053
  }),
3051
3054
  // @deprecated
3052
3055
  categoryNames: i.array(i.string())
3053
- }), Sr = et.extend({
3056
+ }), Zr = He.extend({
3054
3057
  image: i.instanceof(File).optional()
3055
- }), tt = i.object({
3056
- product: et,
3058
+ }), Ge = i.object({
3059
+ product: He,
3057
3060
  originalPrice: i.number().optional(),
3058
3061
  finalPrice: i.number().optional(),
3059
3062
  finalDiscount: i.number().optional(),
3060
3063
  amount: i.number().positive({ message: "Quantity must be a positive number." })
3061
- }), Cr = i.object({
3064
+ }), Or = i.object({
3062
3065
  type: i.literal("Cart"),
3063
3066
  id: i.string().uuid(),
3064
3067
  companyId: i.string().uuid(),
3065
3068
  storeId: i.string().uuid(),
3066
3069
  userId: i.string().uuid(),
3067
3070
  status: i.enum(["active", "draft", "completed"]),
3068
- items: i.array(tt)
3069
- }), Zr = i.object({
3071
+ items: i.array(Ge)
3072
+ }), jr = i.object({
3070
3073
  id: i.string(),
3071
3074
  name: i.string(),
3072
3075
  websiteDomains: i.array(i.string())
3073
- }), Ir = i.object({
3076
+ }), Er = i.object({
3074
3077
  type: i.literal("FavoriteProduct"),
3075
3078
  id: i.string().uuid(),
3076
3079
  companyId: i.string().uuid(),
3077
3080
  storeId: i.string().uuid(),
3078
3081
  userId: i.string().uuid(),
3079
3082
  productId: i.string().uuid()
3080
- }), rt = i.enum(["default", "delayed"]), pr = i.object({
3083
+ }), Xe = i.enum(["default", "delayed"]), hr = i.object({
3081
3084
  type: i.literal("Profile"),
3082
- id: D,
3083
- companyId: D,
3084
- storeId: D,
3085
- tenantId: D,
3085
+ id: M,
3086
+ companyId: M,
3087
+ storeId: M,
3088
+ tenantId: M,
3086
3089
  clientType: i.enum(["user", "company"]),
3087
3090
  companyName: i.string().optional(),
3088
- displayName: D,
3091
+ displayName: M,
3089
3092
  email: i.string().email(),
3090
3093
  phoneNumber: i.string().optional(),
3091
- address: hr.optional(),
3094
+ address: fr.optional(),
3092
3095
  isAnonymous: i.boolean(),
3093
3096
  createdDate: i.number(),
3094
3097
  lastActivityDate: i.number(),
3095
- paymentType: rt
3098
+ paymentType: Xe
3096
3099
  });
3097
- function Ar() {
3100
+ function Rr() {
3098
3101
  return {
3099
3102
  type: "Profile",
3100
3103
  id: "",
@@ -3117,15 +3120,15 @@ function Ar() {
3117
3120
  createdDate: 0,
3118
3121
  lastActivityDate: 0,
3119
3122
  isAnonymous: !0,
3120
- paymentType: rt.Values.default
3123
+ paymentType: Xe.Values.default
3121
3124
  };
3122
3125
  }
3123
- const Nr = i.object({
3126
+ const Pr = i.object({
3124
3127
  type: i.literal("Order"),
3125
- id: D,
3126
- companyId: D,
3127
- storeId: D,
3128
- userId: D,
3128
+ id: M,
3129
+ companyId: M,
3130
+ storeId: M,
3131
+ userId: M,
3129
3132
  status: i.enum([
3130
3133
  "draft",
3131
3134
  // before payment
@@ -3144,7 +3147,7 @@ const Nr = i.object({
3144
3147
  //todo check if hyp support partial refund
3145
3148
  cart: i.object({
3146
3149
  id: i.string(),
3147
- items: i.array(tt),
3150
+ items: i.array(Ge),
3148
3151
  cartDiscount: i.number(),
3149
3152
  cartTotal: i.number(),
3150
3153
  cartVat: i.number()
@@ -3155,10 +3158,10 @@ const Nr = i.object({
3155
3158
  // what store charge
3156
3159
  date: i.number(),
3157
3160
  deliveryDate: i.coerce.number().optional(),
3158
- client: pr.required({}),
3161
+ client: hr.required({}),
3159
3162
  nameOnInvoice: i.string().optional(),
3160
3163
  clientComment: i.string().optional()
3161
- }), mr = i.enum(["individual", "company"]), Or = i.object({
3164
+ }), mr = i.enum(["individual", "company"]), Dr = i.object({
3162
3165
  id: i.string(),
3163
3166
  companyId: i.string(),
3164
3167
  name: i.string(),
@@ -3173,30 +3176,181 @@ const Nr = i.object({
3173
3176
  minimumOrder: i.number().optional(),
3174
3177
  freeDeliveryPrice: i.number().optional(),
3175
3178
  deliveryPrice: i.number().optional()
3176
- }), Ie = i.string().min(1), jr = i.object({
3179
+ }), pr = i.object({
3180
+ minSpend: i.number().positive().optional(),
3181
+ stackable: i.boolean().default(!1)
3182
+ }).optional(), yr = i.discriminatedUnion("variantType", [
3183
+ i.object({
3184
+ variantType: i.literal("bundle"),
3185
+ productsId: i.array(i.string().nonempty()).min(1),
3186
+ // Which products are included
3187
+ requiredQuantity: i.number().positive(),
3188
+ // How many items needed (e.g., 3)
3189
+ bundlePrice: i.number().positive()
3190
+ // Total price for the bundle (e.g., $25)
3191
+ })
3192
+ ]), Mr = i.object({
3177
3193
  type: i.literal("Discount"),
3178
- storeId: Ie,
3179
- companyId: Ie,
3180
- id: Ie,
3181
- name: i.array(H),
3194
+ storeId: i.string().min(1),
3195
+ companyId: i.string().min(1),
3196
+ id: i.string().min(1),
3197
+ name: i.array(i.object({ lang: i.enum(["he"]), value: i.string().nonempty() })),
3182
3198
  active: i.boolean(),
3183
- variant: i.discriminatedUnion("variantType", [
3184
- i.object({
3185
- variantType: i.literal("bundle"),
3186
- productsId: i.array(i.string()).min(1),
3187
- requiredQuantity: i.number().positive(),
3188
- discountPrice: i.number().positive()
3189
- })
3190
- ]),
3191
- images: i.array(i.string().nonempty()).optional()
3192
- }), Ae = {
3199
+ startDate: i.number(),
3200
+ endDate: i.number(),
3201
+ variant: yr,
3202
+ conditions: pr
3203
+ });
3204
+ class gr {
3205
+ canApply(e, t) {
3206
+ if (e.variant.variantType !== "bundle" || !this.isDiscountActive(e)) return !1;
3207
+ const { productsId: n, requiredQuantity: s } = e.variant;
3208
+ return this.getTotalQuantity(t.cart, n) >= s;
3209
+ }
3210
+ calculate(e, t) {
3211
+ if (e.variant.variantType !== "bundle")
3212
+ return { applicable: !1, discountAmount: 0, affectedItems: [] };
3213
+ const { productsId: n, requiredQuantity: s, bundlePrice: a } = e.variant, o = t.cart.filter((A) => n.includes(A.product.id)), c = this.getTotalQuantity(t.cart, n), d = Math.floor(c / s);
3214
+ if (d === 0)
3215
+ return { applicable: !1, discountAmount: 0, affectedItems: [] };
3216
+ const l = this.calculateOriginalPrice(o), m = this.getTotalQuantity(t.cart, n), b = this.calculateDiscountedPrice(
3217
+ l,
3218
+ a,
3219
+ d,
3220
+ s,
3221
+ m
3222
+ ), w = l - b, S = this.distributeDiscount(o, w, l);
3223
+ return {
3224
+ applicable: !0,
3225
+ discountAmount: Number(w.toFixed(2)),
3226
+ affectedItems: S
3227
+ };
3228
+ }
3229
+ isDiscountActive(e) {
3230
+ const t = Date.now();
3231
+ return e.active && e.startDate <= t && e.endDate >= t;
3232
+ }
3233
+ getTotalQuantity(e, t) {
3234
+ return e.filter((n) => t.includes(n.product.id)).reduce((n, s) => n + s.amount, 0);
3235
+ }
3236
+ calculateOriginalPrice(e) {
3237
+ return e.reduce((t, n) => t + n.product.price * n.amount, 0);
3238
+ }
3239
+ calculateDiscountedPrice(e, t, n, s, a) {
3240
+ const o = t * n, c = n * s, l = Math.max(0, a - c) / a * e;
3241
+ return o + l;
3242
+ }
3243
+ distributeDiscount(e, t, n) {
3244
+ const s = t / n;
3245
+ return e.map((a) => {
3246
+ const o = a.product.price * a.amount * s;
3247
+ return {
3248
+ productId: a.product.id,
3249
+ quantity: a.amount,
3250
+ originalPrice: Number(a.product.price.toFixed(2)),
3251
+ discountedPrice: Number((a.product.price - o / a.amount).toFixed(2)),
3252
+ discountAmount: Number(o.toFixed(2))
3253
+ };
3254
+ });
3255
+ }
3256
+ }
3257
+ class Ke {
3258
+ static getStrategy(e) {
3259
+ return this.strategies.get(e.variant.variantType) || null;
3260
+ }
3261
+ static registerStrategy(e, t) {
3262
+ this.strategies.set(e, t);
3263
+ }
3264
+ static getRegisteredTypes() {
3265
+ return Array.from(this.strategies.keys());
3266
+ }
3267
+ static clearStrategies() {
3268
+ this.strategies.clear();
3269
+ }
3270
+ }
3271
+ Pe(Ke, "strategies", /* @__PURE__ */ new Map([
3272
+ ["bundle", new gr()]
3273
+ ]));
3274
+ class vr {
3275
+ static calculateDiscounts(e, t, n) {
3276
+ var l, m;
3277
+ const s = {
3278
+ cart: e,
3279
+ user: n,
3280
+ appliedDiscounts: []
3281
+ }, a = this.filterActiveDiscounts(t), o = [];
3282
+ for (const b of a) {
3283
+ const w = Ke.getStrategy(b);
3284
+ if (!w || !w.canApply(b, s) || !((l = b.conditions) != null && l.stackable) && o.length > 0) continue;
3285
+ const S = w.calculate(b, s);
3286
+ S.applicable && (o.push({
3287
+ discountId: b.id,
3288
+ discountName: ((m = b.name[0]) == null ? void 0 : m.value) || "Discount",
3289
+ discountAmount: Number(S.discountAmount.toFixed(2)),
3290
+ affectedItems: S.affectedItems
3291
+ }), s.appliedDiscounts = o);
3292
+ }
3293
+ const c = this.calculateFinalPrices(e, o), d = o.reduce((b, w) => b + w.discountAmount, 0);
3294
+ return {
3295
+ items: c,
3296
+ totalDiscount: Number(d.toFixed(2)),
3297
+ appliedDiscounts: o
3298
+ };
3299
+ }
3300
+ static filterActiveDiscounts(e) {
3301
+ const t = Date.now();
3302
+ return e.filter(
3303
+ (n) => n.active && n.startDate <= t && n.endDate >= t
3304
+ );
3305
+ }
3306
+ static calculateFinalPrices(e, t) {
3307
+ return e.map((n) => {
3308
+ const s = t.filter(
3309
+ (d) => d.affectedItems.some((l) => l.productId === n.product.id)
3310
+ ), a = s.reduce((d, l) => {
3311
+ const m = l.affectedItems.find((b) => b.productId === n.product.id);
3312
+ return d + ((m == null ? void 0 : m.discountAmount) || 0);
3313
+ }, 0), o = a / n.amount, c = n.product.price - o;
3314
+ return {
3315
+ amount: n.amount,
3316
+ product: n.product,
3317
+ originalPrice: Number(n.product.price.toFixed(2)),
3318
+ finalPrice: Number(Math.max(0, c).toFixed(2)),
3319
+ finalDiscount: Number(a.toFixed(2)),
3320
+ appliedDiscounts: s.map((d) => d.discountId)
3321
+ };
3322
+ });
3323
+ }
3324
+ static isDiscountActive(e) {
3325
+ const t = Date.now();
3326
+ return e.active && e.startDate <= t && e.endDate >= t;
3327
+ }
3328
+ static getActiveDiscounts(e) {
3329
+ return this.filterActiveDiscounts(e);
3330
+ }
3331
+ }
3332
+ function et(r) {
3333
+ return Number(r.toFixed(2));
3334
+ }
3335
+ function $r(r) {
3336
+ return r.toFixed(2);
3337
+ }
3338
+ function Vr(r) {
3339
+ return Math.max(0, et(r));
3340
+ }
3341
+ function Fr(r, e) {
3342
+ if (r <= 0) return 0;
3343
+ const t = r - e;
3344
+ return et(t / r * 100);
3345
+ }
3346
+ const Ae = {
3193
3347
  VAT: 18
3194
3348
  };
3195
- function ze(r) {
3349
+ function _r(r) {
3196
3350
  var e, t;
3197
3351
  return ((e = r.discount) == null ? void 0 : e.type) === "percent" ? r.price * (r.discount.value ?? 100) / 100 : ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.discount.value ?? 0 : 0;
3198
3352
  }
3199
- function Fe(r) {
3353
+ function br(r) {
3200
3354
  var e, t;
3201
3355
  if (((e = r.discount) == null ? void 0 : e.type) === "percent") {
3202
3356
  const n = r.price * r.discount.value / 100;
@@ -3204,55 +3358,43 @@ function Fe(r) {
3204
3358
  }
3205
3359
  return ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.price - r.discount.value : r.price;
3206
3360
  }
3207
- function Er({
3361
+ function Lr({
3208
3362
  cart: r,
3209
3363
  discounts: e,
3210
3364
  store: t
3211
3365
  }) {
3212
- const { isVatIncludedInPrice: n } = t;
3213
- let s = r.map((o) => ({
3214
- amount: o.amount,
3215
- product: { ...o.product },
3216
- originalPrice: o.product.price,
3217
- finalPrice: Fe(o.product),
3218
- finalDiscount: ze(o.product)
3219
- }));
3220
- const a = e.filter((o) => o.variant.variantType === "bundle" && ((r == null ? void 0 : r.reduce((u, p) => (o.variant.productsId.includes(p.product.id) && (u += p.amount), u), 0)) ?? 0) >= o.variant.requiredQuantity);
3221
- console.log("activeDiscounts", a), a.forEach((o) => {
3222
- var l, u;
3223
- if (o.variant.variantType === "bundle") {
3224
- const p = r.filter(
3225
- (Z) => o.variant.productsId.includes(Z.product.id)
3226
- ), x = (p == null ? void 0 : p.reduce((Z, De) => (o.variant.productsId.includes(De.product.id) && (Z += De.amount), Z), 0)) ?? 0, O = Math.floor(x / o.variant.requiredQuantity), w = Fe((l = p[0]) == null ? void 0 : l.product), ee = ze((u = p[0]) == null ? void 0 : u.product);
3227
- console.log("price", w, ee);
3228
- const Ce = Number(
3229
- (o.variant.discountPrice / o.variant.requiredQuantity).toFixed(2)
3230
- ) * 1;
3231
- console.log("discountPrice", Ce);
3232
- const nt = (w * o.variant.requiredQuantity - o.variant.discountPrice) * O, st = x * w - nt, $e = Number((st / x).toFixed(2));
3233
- s = s.map((Z) => o.variant.productsId.includes(Z.product.id) ? {
3234
- ...Z,
3235
- finalPrice: $e,
3236
- originalPrice: Z.product.price,
3237
- discountPrice: w,
3238
- finalDiscount: Z.finalDiscount + (Z.product.price - $e)
3239
- } : Z);
3366
+ const { isVatIncludedInPrice: n } = t, s = r.map((d) => ({
3367
+ amount: d.amount,
3368
+ product: {
3369
+ id: d.product.id,
3370
+ price: d.product.price
3240
3371
  }
3241
- });
3242
- const c = s.reduce(
3243
- (o, l) => {
3244
- const { product: u, amount: p, finalPrice: x, finalDiscount: O } = l;
3245
- let w = 0;
3246
- if (u.vat) {
3247
- let ee = 0;
3372
+ })), a = vr.calculateDiscounts(s, e);
3373
+ console.log("discountResult", a);
3374
+ const o = r.map((d, l) => {
3375
+ const m = a.items[l];
3376
+ return {
3377
+ amount: d.amount,
3378
+ product: { ...d.product },
3379
+ originalPrice: d.product.price,
3380
+ finalPrice: m ? m.finalPrice : br(d.product),
3381
+ finalDiscount: m ? m.finalDiscount : _r(d.product)
3382
+ };
3383
+ }), c = o.reduce(
3384
+ (d, l) => {
3385
+ const { product: m, amount: b, finalPrice: w, finalDiscount: S } = l;
3386
+ let A = 0;
3387
+ if (m.vat) {
3388
+ let Se = 0;
3248
3389
  if (n) {
3249
- const Ce = x * (Ae.VAT / (100 + Ae.VAT));
3250
- w = Number(Ce.toFixed(2)), w = w * p, ee = Number(w.toFixed(2));
3390
+ const tt = w * (Ae.VAT / (100 + Ae.VAT));
3391
+ A = Number(tt.toFixed(2)), A = A * b, Se = Number(A.toFixed(2));
3251
3392
  } else
3252
- w = x * Ae.VAT / 100, w = w * p, ee = Number(w.toFixed(2));
3253
- o.vat = Number((o.vat + ee).toFixed(2));
3393
+ A = w * Ae.VAT / 100, A = A * b, Se = Number(A.toFixed(2));
3394
+ d.vat = Number((d.vat + Se).toFixed(2));
3254
3395
  }
3255
- return o.cost += p * x, o.discount += O && p * O, o.finalCost += p * x + (n ? 0 : w), o.productsCost += p * x + (n ? 0 : w), o;
3396
+ const Ie = Number(w.toFixed(2));
3397
+ return d.cost += b * Ie, d.discount += S && b * S, d.finalCost += b * Ie + (n ? 0 : A), d.productsCost += b * Ie + (n ? 0 : A), d.cost = Number(d.cost.toFixed(2)), d.discount = Number(d.discount.toFixed(2)), d.finalCost = Number(d.finalCost.toFixed(2)), d.productsCost = Number(d.productsCost.toFixed(2)), d;
3256
3398
  },
3257
3399
  {
3258
3400
  discount: 0,
@@ -3263,12 +3405,12 @@ function Er({
3263
3405
  deliveryPrice: (t == null ? void 0 : t.deliveryPrice) ?? 0
3264
3406
  }
3265
3407
  );
3266
- return c.deliveryPrice && c.productsCost >= (t.freeDeliveryPrice ?? 0) ? c.deliveryPrice = 0 : c.finalCost += c.deliveryPrice, console.log("cartDetails", c), { items: s, ...c };
3408
+ return c.deliveryPrice && c.productsCost >= (t.freeDeliveryPrice ?? 0) ? c.deliveryPrice = 0 : c.finalCost += c.deliveryPrice, console.log("cartDetails", c), { items: o, ...c };
3267
3409
  }
3268
- const yr = {
3410
+ const xr = {
3269
3411
  stores: "STORES",
3270
3412
  companies: "COMPANIES"
3271
- }, gr = {
3413
+ }, kr = {
3272
3414
  products: "products",
3273
3415
  profiles: "profiles",
3274
3416
  cart: "cart",
@@ -3279,9 +3421,9 @@ const yr = {
3279
3421
  payments: "payments",
3280
3422
  settings: "settings",
3281
3423
  discounts: "discounts"
3282
- }, vr = {
3283
- systemCollections: yr,
3284
- storeCollections: gr,
3424
+ }, wr = {
3425
+ systemCollections: xr,
3426
+ storeCollections: kr,
3285
3427
  // for client
3286
3428
  getPath: ({
3287
3429
  companyId: r,
@@ -3291,34 +3433,43 @@ const yr = {
3291
3433
  }) => `${r}/${e}/${t}${n ? `/${n}` : ""}`,
3292
3434
  // for backend
3293
3435
  getDocPath: (r) => `{companyId}/{storeId}/${r}/{id}`
3294
- }, Rr = {
3295
- firestore: vr
3436
+ }, zr = {
3437
+ firestore: wr
3296
3438
  };
3297
3439
  export {
3298
- hr as AddressSchema,
3299
- Ke as BaseCategorySchema,
3300
- tt as CartItemProductSchema,
3301
- Cr as CartSchema,
3302
- Pe as CategorySchema,
3303
- Zr as CompanySchema,
3304
- jr as DiscountSchema,
3305
- Ir as FavoriteProductSchema,
3306
- xr as FileSchema,
3307
- Rr as FirebaseAPI,
3308
- H as LocaleSchema,
3309
- wr as LocaleValueSchema,
3310
- Sr as NewProductSchema,
3311
- Nr as OrderSchema,
3312
- et as ProductSchema,
3313
- rt as ProfilePaymentTypeSchema,
3314
- pr as ProfileSchema,
3315
- Or as StoreSchema,
3316
- Tr as TFlattenCategorySchema,
3440
+ fr as AddressSchema,
3441
+ Ye as BaseCategorySchema,
3442
+ gr as BundleDiscountStrategy,
3443
+ Ge as CartItemProductSchema,
3444
+ Or as CartSchema,
3445
+ Re as CategorySchema,
3446
+ jr as CompanySchema,
3447
+ pr as DiscountConditionsSchema,
3448
+ vr as DiscountEngine,
3449
+ Mr as DiscountSchema,
3450
+ Ke as DiscountStrategyFactory,
3451
+ yr as DiscountVariantSchema,
3452
+ Er as FavoriteProductSchema,
3453
+ Sr as FileSchema,
3454
+ zr as FirebaseAPI,
3455
+ re as LocaleSchema,
3456
+ Ar as LocaleValueSchema,
3457
+ Zr as NewProductSchema,
3458
+ Pr as OrderSchema,
3459
+ He as ProductSchema,
3460
+ Xe as ProfilePaymentTypeSchema,
3461
+ hr as ProfileSchema,
3462
+ Dr as StoreSchema,
3463
+ Nr as TFlattenCategorySchema,
3464
+ Fr as calculatePercentageDiscount,
3317
3465
  mr as clientTypesSchema,
3318
- Ar as createEmptyProfile,
3319
- Er as getCartCost,
3320
- kr as isFile,
3321
- D as notEmptyTextSchema,
3322
- br as numericTextSchema
3466
+ Rr as createEmptyProfile,
3467
+ Vr as ensureNonNegative,
3468
+ et as formatCurrency,
3469
+ $r as formatCurrencyString,
3470
+ Lr as getCartCost,
3471
+ Cr as isFile,
3472
+ M as notEmptyTextSchema,
3473
+ Ir as numericTextSchema
3323
3474
  };
3324
3475
  //# sourceMappingURL=core.es.js.map