@jsdev_ninja/core 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.es.js CHANGED
@@ -87,7 +87,7 @@ const p = b.arrayToEnum([
87
87
  default:
88
88
  return p.unknown;
89
89
  }
90
- }, u = b.arrayToEnum([
90
+ }, d = b.arrayToEnum([
91
91
  "invalid_type",
92
92
  "invalid_literal",
93
93
  "custom",
@@ -104,7 +104,7 @@ const p = b.arrayToEnum([
104
104
  "invalid_intersection_types",
105
105
  "not_multiple_of",
106
106
  "not_finite"
107
- ]), ut = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
107
+ ]), dt = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
108
108
  class A extends Error {
109
109
  get errors() {
110
110
  return this.issues;
@@ -134,8 +134,8 @@ class A extends Error {
134
134
  else {
135
135
  let o = i, l = 0;
136
136
  for (; l < c.path.length; ) {
137
- const d = c.path[l];
138
- l === c.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(c))) : o[d] = o[d] || { _errors: [] }, o = o[d], l++;
137
+ const u = c.path[l];
138
+ 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++;
139
139
  }
140
140
  }
141
141
  };
@@ -168,52 +168,52 @@ A.create = (n) => new A(n);
168
168
  const X = (n, e) => {
169
169
  let t;
170
170
  switch (n.code) {
171
- case u.invalid_type:
171
+ case d.invalid_type:
172
172
  n.received === p.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
173
173
  break;
174
- case u.invalid_literal:
174
+ case d.invalid_literal:
175
175
  t = `Invalid literal value, expected ${JSON.stringify(n.expected, b.jsonStringifyReplacer)}`;
176
176
  break;
177
- case u.unrecognized_keys:
177
+ case d.unrecognized_keys:
178
178
  t = `Unrecognized key(s) in object: ${b.joinValues(n.keys, ", ")}`;
179
179
  break;
180
- case u.invalid_union:
180
+ case d.invalid_union:
181
181
  t = "Invalid input";
182
182
  break;
183
- case u.invalid_union_discriminator:
183
+ case d.invalid_union_discriminator:
184
184
  t = `Invalid discriminator value. Expected ${b.joinValues(n.options)}`;
185
185
  break;
186
- case u.invalid_enum_value:
186
+ case d.invalid_enum_value:
187
187
  t = `Invalid enum value. Expected ${b.joinValues(n.options)}, received '${n.received}'`;
188
188
  break;
189
- case u.invalid_arguments:
189
+ case d.invalid_arguments:
190
190
  t = "Invalid function arguments";
191
191
  break;
192
- case u.invalid_return_type:
192
+ case d.invalid_return_type:
193
193
  t = "Invalid function return type";
194
194
  break;
195
- case u.invalid_date:
195
+ case d.invalid_date:
196
196
  t = "Invalid date";
197
197
  break;
198
- case u.invalid_string:
198
+ case d.invalid_string:
199
199
  typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : b.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
200
200
  break;
201
- case u.too_small:
201
+ case d.too_small:
202
202
  n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
203
203
  break;
204
- case u.too_big:
204
+ case d.too_big:
205
205
  n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
206
206
  break;
207
- case u.custom:
207
+ case d.custom:
208
208
  t = "Invalid input";
209
209
  break;
210
- case u.invalid_intersection_types:
210
+ case d.invalid_intersection_types:
211
211
  t = "Intersection results could not be merged";
212
212
  break;
213
- case u.not_multiple_of:
213
+ case d.not_multiple_of:
214
214
  t = `Number must be a multiple of ${n.multipleOf}`;
215
215
  break;
216
- case u.not_finite:
216
+ case d.not_finite:
217
217
  t = "Number must be finite";
218
218
  break;
219
219
  default:
@@ -222,7 +222,7 @@ const X = (n, e) => {
222
222
  return { message: t };
223
223
  };
224
224
  let Ue = X;
225
- function dt(n) {
225
+ function ut(n) {
226
226
  Ue = n;
227
227
  }
228
228
  function ye() {
@@ -240,9 +240,9 @@ const ve = (n) => {
240
240
  message: a.message
241
241
  };
242
242
  let o = "";
243
- const l = i.filter((d) => !!d).slice().reverse();
244
- for (const d of l)
245
- o = d(c, { data: e, defaultError: o }).message;
243
+ const l = i.filter((u) => !!u).slice().reverse();
244
+ for (const u of l)
245
+ o = u(c, { data: e, defaultError: o }).message;
246
246
  return {
247
247
  ...a,
248
248
  path: s,
@@ -354,9 +354,9 @@ function v(n) {
354
354
  if (e && (t || i))
355
355
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
356
356
  return e ? { errorMap: e, description: a } : { errorMap: (c, o) => {
357
- var l, d;
357
+ var l, u;
358
358
  const { message: f } = n;
359
- return c.code === "invalid_enum_value" ? { message: f ?? o.defaultError } : typeof o.data > "u" ? { message: (l = f ?? i) !== null && l !== void 0 ? l : o.defaultError } : c.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = f ?? t) !== null && d !== void 0 ? d : o.defaultError };
359
+ return c.code === "invalid_enum_value" ? { message: f ?? o.defaultError } : typeof o.data > "u" ? { message: (l = f ?? i) !== null && l !== void 0 ? l : o.defaultError } : c.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = f ?? t) !== null && u !== void 0 ? u : o.defaultError };
360
360
  }, description: a };
361
361
  }
362
362
  class _ {
@@ -479,7 +479,7 @@ class _ {
479
479
  const i = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
480
480
  return this._refinement((a, s) => {
481
481
  const c = e(a), o = () => s.addIssue({
482
- code: u.custom,
482
+ code: d.custom,
483
483
  ...i(a)
484
484
  });
485
485
  return typeof Promise < "u" && c instanceof Promise ? c.then((l) => l ? !0 : (o(), !1)) : c ? !0 : (o(), !1);
@@ -544,7 +544,7 @@ class _ {
544
544
  });
545
545
  }
546
546
  brand() {
547
- return new Pe({
547
+ return new De({
548
548
  typeName: g.ZodBranded,
549
549
  type: this,
550
550
  ...v(this._def)
@@ -615,7 +615,7 @@ class N extends _ {
615
615
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
616
616
  const s = this._getOrReturnCtx(e);
617
617
  return m(s, {
618
- code: u.invalid_type,
618
+ code: d.invalid_type,
619
619
  expected: p.string,
620
620
  received: s.parsedType
621
621
  }), y;
@@ -625,7 +625,7 @@ class N extends _ {
625
625
  for (const s of this._def.checks)
626
626
  if (s.kind === "min")
627
627
  e.data.length < s.value && (a = this._getOrReturnCtx(e, a), m(a, {
628
- code: u.too_small,
628
+ code: d.too_small,
629
629
  minimum: s.value,
630
630
  type: "string",
631
631
  inclusive: !0,
@@ -634,7 +634,7 @@ class N extends _ {
634
634
  }), i.dirty());
635
635
  else if (s.kind === "max")
636
636
  e.data.length > s.value && (a = this._getOrReturnCtx(e, a), m(a, {
637
- code: u.too_big,
637
+ code: d.too_big,
638
638
  maximum: s.value,
639
639
  type: "string",
640
640
  inclusive: !0,
@@ -644,14 +644,14 @@ class N extends _ {
644
644
  else if (s.kind === "length") {
645
645
  const c = e.data.length > s.value, o = e.data.length < s.value;
646
646
  (c || o) && (a = this._getOrReturnCtx(e, a), c ? m(a, {
647
- code: u.too_big,
647
+ code: d.too_big,
648
648
  maximum: s.value,
649
649
  type: "string",
650
650
  inclusive: !0,
651
651
  exact: !0,
652
652
  message: s.message
653
653
  }) : o && m(a, {
654
- code: u.too_small,
654
+ code: d.too_small,
655
655
  minimum: s.value,
656
656
  type: "string",
657
657
  inclusive: !0,
@@ -661,43 +661,43 @@ class N extends _ {
661
661
  } else if (s.kind === "email")
662
662
  _t.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
663
663
  validation: "email",
664
- code: u.invalid_string,
664
+ code: d.invalid_string,
665
665
  message: s.message
666
666
  }), i.dirty());
667
667
  else if (s.kind === "emoji")
668
668
  Ne || (Ne = new RegExp(bt, "u")), Ne.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
669
669
  validation: "emoji",
670
- code: u.invalid_string,
670
+ code: d.invalid_string,
671
671
  message: s.message
672
672
  }), i.dirty());
673
673
  else if (s.kind === "uuid")
674
674
  ht.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
675
675
  validation: "uuid",
676
- code: u.invalid_string,
676
+ code: d.invalid_string,
677
677
  message: s.message
678
678
  }), i.dirty());
679
679
  else if (s.kind === "nanoid")
680
680
  gt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
681
681
  validation: "nanoid",
682
- code: u.invalid_string,
682
+ code: d.invalid_string,
683
683
  message: s.message
684
684
  }), i.dirty());
685
685
  else if (s.kind === "cuid")
686
686
  mt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
687
687
  validation: "cuid",
688
- code: u.invalid_string,
688
+ code: d.invalid_string,
689
689
  message: s.message
690
690
  }), i.dirty());
691
691
  else if (s.kind === "cuid2")
692
692
  pt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
693
693
  validation: "cuid2",
694
- code: u.invalid_string,
694
+ code: d.invalid_string,
695
695
  message: s.message
696
696
  }), i.dirty());
697
697
  else if (s.kind === "ulid")
698
698
  ft.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
699
699
  validation: "ulid",
700
- code: u.invalid_string,
700
+ code: d.invalid_string,
701
701
  message: s.message
702
702
  }), i.dirty());
703
703
  else if (s.kind === "url")
@@ -706,61 +706,61 @@ class N extends _ {
706
706
  } catch {
707
707
  a = this._getOrReturnCtx(e, a), m(a, {
708
708
  validation: "url",
709
- code: u.invalid_string,
709
+ code: d.invalid_string,
710
710
  message: s.message
711
711
  }), i.dirty();
712
712
  }
713
713
  else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
714
714
  validation: "regex",
715
- code: u.invalid_string,
715
+ code: d.invalid_string,
716
716
  message: s.message
717
717
  }), i.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (a = this._getOrReturnCtx(e, a), m(a, {
718
- code: u.invalid_string,
718
+ code: d.invalid_string,
719
719
  validation: { includes: s.value, position: s.position },
720
720
  message: s.message
721
721
  }), i.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (a = this._getOrReturnCtx(e, a), m(a, {
722
- code: u.invalid_string,
722
+ code: d.invalid_string,
723
723
  validation: { startsWith: s.value },
724
724
  message: s.message
725
725
  }), i.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (a = this._getOrReturnCtx(e, a), m(a, {
726
- code: u.invalid_string,
726
+ code: d.invalid_string,
727
727
  validation: { endsWith: s.value },
728
728
  message: s.message
729
729
  }), i.dirty()) : s.kind === "datetime" ? Qe(s).test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
730
- code: u.invalid_string,
730
+ code: d.invalid_string,
731
731
  validation: "datetime",
732
732
  message: s.message
733
733
  }), i.dirty()) : s.kind === "date" ? At.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
734
- code: u.invalid_string,
734
+ code: d.invalid_string,
735
735
  validation: "date",
736
736
  message: s.message
737
737
  }), i.dirty()) : s.kind === "time" ? Nt(s).test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
738
- code: u.invalid_string,
738
+ code: d.invalid_string,
739
739
  validation: "time",
740
740
  message: s.message
741
741
  }), i.dirty()) : s.kind === "duration" ? vt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
742
742
  validation: "duration",
743
- code: u.invalid_string,
743
+ code: d.invalid_string,
744
744
  message: s.message
745
745
  }), i.dirty()) : s.kind === "ip" ? Ct(e.data, s.version) || (a = this._getOrReturnCtx(e, a), m(a, {
746
746
  validation: "ip",
747
- code: u.invalid_string,
747
+ code: d.invalid_string,
748
748
  message: s.message
749
749
  }), i.dirty()) : s.kind === "jwt" ? jt(e.data, s.alg) || (a = this._getOrReturnCtx(e, a), m(a, {
750
750
  validation: "jwt",
751
- code: u.invalid_string,
751
+ code: d.invalid_string,
752
752
  message: s.message
753
753
  }), i.dirty()) : s.kind === "cidr" ? Zt(e.data, s.version) || (a = this._getOrReturnCtx(e, a), m(a, {
754
754
  validation: "cidr",
755
- code: u.invalid_string,
755
+ code: d.invalid_string,
756
756
  message: s.message
757
757
  }), i.dirty()) : s.kind === "base64" ? St.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
758
758
  validation: "base64",
759
- code: u.invalid_string,
759
+ code: d.invalid_string,
760
760
  message: s.message
761
761
  }), i.dirty()) : s.kind === "base64url" ? It.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
762
762
  validation: "base64url",
763
- code: u.invalid_string,
763
+ code: d.invalid_string,
764
764
  message: s.message
765
765
  }), i.dirty()) : b.assertNever(s);
766
766
  return { status: i.value, value: e.data };
@@ -768,7 +768,7 @@ class N extends _ {
768
768
  _regex(e, t, i) {
769
769
  return this.refinement((a) => e.test(a), {
770
770
  validation: t,
771
- code: u.invalid_string,
771
+ code: d.invalid_string,
772
772
  ...h.errToObj(i)
773
773
  });
774
774
  }
@@ -1009,7 +1009,7 @@ class M extends _ {
1009
1009
  if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
1010
1010
  const s = this._getOrReturnCtx(e);
1011
1011
  return m(s, {
1012
- code: u.invalid_type,
1012
+ code: d.invalid_type,
1013
1013
  expected: p.number,
1014
1014
  received: s.parsedType
1015
1015
  }), y;
@@ -1018,30 +1018,30 @@ class M extends _ {
1018
1018
  const a = new S();
1019
1019
  for (const s of this._def.checks)
1020
1020
  s.kind === "int" ? b.isInteger(e.data) || (i = this._getOrReturnCtx(e, i), m(i, {
1021
- code: u.invalid_type,
1021
+ code: d.invalid_type,
1022
1022
  expected: "integer",
1023
1023
  received: "float",
1024
1024
  message: s.message
1025
1025
  }), a.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (i = this._getOrReturnCtx(e, i), m(i, {
1026
- code: u.too_small,
1026
+ code: d.too_small,
1027
1027
  minimum: s.value,
1028
1028
  type: "number",
1029
1029
  inclusive: s.inclusive,
1030
1030
  exact: !1,
1031
1031
  message: s.message
1032
1032
  }), a.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (i = this._getOrReturnCtx(e, i), m(i, {
1033
- code: u.too_big,
1033
+ code: d.too_big,
1034
1034
  maximum: s.value,
1035
1035
  type: "number",
1036
1036
  inclusive: s.inclusive,
1037
1037
  exact: !1,
1038
1038
  message: s.message
1039
1039
  }), a.dirty()) : s.kind === "multipleOf" ? Ot(e.data, s.value) !== 0 && (i = this._getOrReturnCtx(e, i), m(i, {
1040
- code: u.not_multiple_of,
1040
+ code: d.not_multiple_of,
1041
1041
  multipleOf: s.value,
1042
1042
  message: s.message
1043
1043
  }), a.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (i = this._getOrReturnCtx(e, i), m(i, {
1044
- code: u.not_finite,
1044
+ code: d.not_finite,
1045
1045
  message: s.message
1046
1046
  }), a.dirty()) : b.assertNever(s);
1047
1047
  return { status: a.value, value: e.data };
@@ -1190,19 +1190,19 @@ class z extends _ {
1190
1190
  const a = new S();
1191
1191
  for (const s of this._def.checks)
1192
1192
  s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (i = this._getOrReturnCtx(e, i), m(i, {
1193
- code: u.too_small,
1193
+ code: d.too_small,
1194
1194
  type: "bigint",
1195
1195
  minimum: s.value,
1196
1196
  inclusive: s.inclusive,
1197
1197
  message: s.message
1198
1198
  }), a.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (i = this._getOrReturnCtx(e, i), m(i, {
1199
- code: u.too_big,
1199
+ code: d.too_big,
1200
1200
  type: "bigint",
1201
1201
  maximum: s.value,
1202
1202
  inclusive: s.inclusive,
1203
1203
  message: s.message
1204
1204
  }), a.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (i = this._getOrReturnCtx(e, i), m(i, {
1205
- code: u.not_multiple_of,
1205
+ code: d.not_multiple_of,
1206
1206
  multipleOf: s.value,
1207
1207
  message: s.message
1208
1208
  }), a.dirty()) : b.assertNever(s);
@@ -1211,7 +1211,7 @@ class z extends _ {
1211
1211
  _getInvalidInput(e) {
1212
1212
  const t = this._getOrReturnCtx(e);
1213
1213
  return m(t, {
1214
- code: u.invalid_type,
1214
+ code: d.invalid_type,
1215
1215
  expected: p.bigint,
1216
1216
  received: t.parsedType
1217
1217
  }), y;
@@ -1314,7 +1314,7 @@ class re extends _ {
1314
1314
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
1315
1315
  const i = this._getOrReturnCtx(e);
1316
1316
  return m(i, {
1317
- code: u.invalid_type,
1317
+ code: d.invalid_type,
1318
1318
  expected: p.boolean,
1319
1319
  received: i.parsedType
1320
1320
  }), y;
@@ -1332,7 +1332,7 @@ class q extends _ {
1332
1332
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
1333
1333
  const s = this._getOrReturnCtx(e);
1334
1334
  return m(s, {
1335
- code: u.invalid_type,
1335
+ code: d.invalid_type,
1336
1336
  expected: p.date,
1337
1337
  received: s.parsedType
1338
1338
  }), y;
@@ -1340,21 +1340,21 @@ class q extends _ {
1340
1340
  if (isNaN(e.data.getTime())) {
1341
1341
  const s = this._getOrReturnCtx(e);
1342
1342
  return m(s, {
1343
- code: u.invalid_date
1343
+ code: d.invalid_date
1344
1344
  }), y;
1345
1345
  }
1346
1346
  const i = new S();
1347
1347
  let a;
1348
1348
  for (const s of this._def.checks)
1349
1349
  s.kind === "min" ? e.data.getTime() < s.value && (a = this._getOrReturnCtx(e, a), m(a, {
1350
- code: u.too_small,
1350
+ code: d.too_small,
1351
1351
  message: s.message,
1352
1352
  inclusive: !0,
1353
1353
  exact: !1,
1354
1354
  minimum: s.value,
1355
1355
  type: "date"
1356
1356
  }), i.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (a = this._getOrReturnCtx(e, a), m(a, {
1357
- code: u.too_big,
1357
+ code: d.too_big,
1358
1358
  message: s.message,
1359
1359
  inclusive: !0,
1360
1360
  exact: !1,
@@ -1410,7 +1410,7 @@ class be extends _ {
1410
1410
  if (this._getType(e) !== p.symbol) {
1411
1411
  const i = this._getOrReturnCtx(e);
1412
1412
  return m(i, {
1413
- code: u.invalid_type,
1413
+ code: d.invalid_type,
1414
1414
  expected: p.symbol,
1415
1415
  received: i.parsedType
1416
1416
  }), y;
@@ -1427,7 +1427,7 @@ class ie extends _ {
1427
1427
  if (this._getType(e) !== p.undefined) {
1428
1428
  const i = this._getOrReturnCtx(e);
1429
1429
  return m(i, {
1430
- code: u.invalid_type,
1430
+ code: d.invalid_type,
1431
1431
  expected: p.undefined,
1432
1432
  received: i.parsedType
1433
1433
  }), y;
@@ -1444,7 +1444,7 @@ class ae extends _ {
1444
1444
  if (this._getType(e) !== p.null) {
1445
1445
  const i = this._getOrReturnCtx(e);
1446
1446
  return m(i, {
1447
- code: u.invalid_type,
1447
+ code: d.invalid_type,
1448
1448
  expected: p.null,
1449
1449
  received: i.parsedType
1450
1450
  }), y;
@@ -1484,7 +1484,7 @@ class $ extends _ {
1484
1484
  _parse(e) {
1485
1485
  const t = this._getOrReturnCtx(e);
1486
1486
  return m(t, {
1487
- code: u.invalid_type,
1487
+ code: d.invalid_type,
1488
1488
  expected: p.never,
1489
1489
  received: t.parsedType
1490
1490
  }), y;
@@ -1499,7 +1499,7 @@ class xe extends _ {
1499
1499
  if (this._getType(e) !== p.undefined) {
1500
1500
  const i = this._getOrReturnCtx(e);
1501
1501
  return m(i, {
1502
- code: u.invalid_type,
1502
+ code: d.invalid_type,
1503
1503
  expected: p.void,
1504
1504
  received: i.parsedType
1505
1505
  }), y;
@@ -1516,14 +1516,14 @@ class C extends _ {
1516
1516
  const { ctx: t, status: i } = this._processInputParams(e), a = this._def;
1517
1517
  if (t.parsedType !== p.array)
1518
1518
  return m(t, {
1519
- code: u.invalid_type,
1519
+ code: d.invalid_type,
1520
1520
  expected: p.array,
1521
1521
  received: t.parsedType
1522
1522
  }), y;
1523
1523
  if (a.exactLength !== null) {
1524
1524
  const c = t.data.length > a.exactLength.value, o = t.data.length < a.exactLength.value;
1525
1525
  (c || o) && (m(t, {
1526
- code: c ? u.too_big : u.too_small,
1526
+ code: c ? d.too_big : d.too_small,
1527
1527
  minimum: o ? a.exactLength.value : void 0,
1528
1528
  maximum: c ? a.exactLength.value : void 0,
1529
1529
  type: "array",
@@ -1533,14 +1533,14 @@ class C extends _ {
1533
1533
  }), i.dirty());
1534
1534
  }
1535
1535
  if (a.minLength !== null && t.data.length < a.minLength.value && (m(t, {
1536
- code: u.too_small,
1536
+ code: d.too_small,
1537
1537
  minimum: a.minLength.value,
1538
1538
  type: "array",
1539
1539
  inclusive: !0,
1540
1540
  exact: !1,
1541
1541
  message: a.minLength.message
1542
1542
  }), i.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (m(t, {
1543
- code: u.too_big,
1543
+ code: d.too_big,
1544
1544
  maximum: a.maxLength.value,
1545
1545
  type: "array",
1546
1546
  inclusive: !0,
@@ -1598,7 +1598,7 @@ function W(n) {
1598
1598
  } else return n instanceof C ? new C({
1599
1599
  ...n._def,
1600
1600
  type: W(n.element)
1601
- }) : n instanceof Z ? Z.create(W(n.unwrap())) : n instanceof L ? L.create(W(n.unwrap())) : n instanceof D ? D.create(n.items.map((e) => W(e))) : n;
1601
+ }) : n instanceof Z ? Z.create(W(n.unwrap())) : n instanceof L ? L.create(W(n.unwrap())) : n instanceof P ? P.create(n.items.map((e) => W(e))) : n;
1602
1602
  }
1603
1603
  class k extends _ {
1604
1604
  constructor() {
@@ -1612,47 +1612,47 @@ class k extends _ {
1612
1612
  }
1613
1613
  _parse(e) {
1614
1614
  if (this._getType(e) !== p.object) {
1615
- const d = this._getOrReturnCtx(e);
1616
- return m(d, {
1617
- code: u.invalid_type,
1615
+ const u = this._getOrReturnCtx(e);
1616
+ return m(u, {
1617
+ code: d.invalid_type,
1618
1618
  expected: p.object,
1619
- received: d.parsedType
1619
+ received: u.parsedType
1620
1620
  }), y;
1621
1621
  }
1622
1622
  const { status: i, ctx: a } = this._processInputParams(e), { shape: s, keys: c } = this._getCached(), o = [];
1623
1623
  if (!(this._def.catchall instanceof $ && this._def.unknownKeys === "strip"))
1624
- for (const d in a.data)
1625
- c.includes(d) || o.push(d);
1624
+ for (const u in a.data)
1625
+ c.includes(u) || o.push(u);
1626
1626
  const l = [];
1627
- for (const d of c) {
1628
- const f = s[d], x = a.data[d];
1627
+ for (const u of c) {
1628
+ const f = s[u], x = a.data[u];
1629
1629
  l.push({
1630
- key: { status: "valid", value: d },
1631
- value: f._parse(new O(a, x, a.path, d)),
1632
- alwaysSet: d in a.data
1630
+ key: { status: "valid", value: u },
1631
+ value: f._parse(new O(a, x, a.path, u)),
1632
+ alwaysSet: u in a.data
1633
1633
  });
1634
1634
  }
1635
1635
  if (this._def.catchall instanceof $) {
1636
- const d = this._def.unknownKeys;
1637
- if (d === "passthrough")
1636
+ const u = this._def.unknownKeys;
1637
+ if (u === "passthrough")
1638
1638
  for (const f of o)
1639
1639
  l.push({
1640
1640
  key: { status: "valid", value: f },
1641
1641
  value: { status: "valid", value: a.data[f] }
1642
1642
  });
1643
- else if (d === "strict")
1643
+ else if (u === "strict")
1644
1644
  o.length > 0 && (m(a, {
1645
- code: u.unrecognized_keys,
1645
+ code: d.unrecognized_keys,
1646
1646
  keys: o
1647
1647
  }), i.dirty());
1648
- else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1648
+ else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1649
1649
  } else {
1650
- const d = this._def.catchall;
1650
+ const u = this._def.catchall;
1651
1651
  for (const f of o) {
1652
1652
  const x = a.data[f];
1653
1653
  l.push({
1654
1654
  key: { status: "valid", value: f },
1655
- value: d._parse(
1655
+ value: u._parse(
1656
1656
  new O(a, x, a.path, f)
1657
1657
  //, ctx.child(key), value, getParsedType(value)
1658
1658
  ),
@@ -1661,17 +1661,17 @@ class k extends _ {
1661
1661
  }
1662
1662
  }
1663
1663
  return a.common.async ? Promise.resolve().then(async () => {
1664
- const d = [];
1664
+ const u = [];
1665
1665
  for (const f of l) {
1666
1666
  const x = await f.key, T = await f.value;
1667
- d.push({
1667
+ u.push({
1668
1668
  key: x,
1669
1669
  value: T,
1670
1670
  alwaysSet: f.alwaysSet
1671
1671
  });
1672
1672
  }
1673
- return d;
1674
- }).then((d) => S.mergeObjectSync(i, d)) : S.mergeObjectSync(i, l);
1673
+ return u;
1674
+ }).then((u) => S.mergeObjectSync(i, u)) : S.mergeObjectSync(i, l);
1675
1675
  }
1676
1676
  get shape() {
1677
1677
  return this._def.shape();
@@ -1899,7 +1899,7 @@ class se extends _ {
1899
1899
  return t.common.issues.push(...o.ctx.common.issues), o.result;
1900
1900
  const c = s.map((o) => new A(o.ctx.common.issues));
1901
1901
  return m(t, {
1902
- code: u.invalid_union,
1902
+ code: d.invalid_union,
1903
1903
  unionErrors: c
1904
1904
  }), y;
1905
1905
  }
@@ -1926,7 +1926,7 @@ class se extends _ {
1926
1926
  let s;
1927
1927
  const c = [];
1928
1928
  for (const l of i) {
1929
- const d = {
1929
+ const u = {
1930
1930
  ...t,
1931
1931
  common: {
1932
1932
  ...t.common,
@@ -1936,17 +1936,17 @@ class se extends _ {
1936
1936
  }, f = l._parseSync({
1937
1937
  data: t.data,
1938
1938
  path: t.path,
1939
- parent: d
1939
+ parent: u
1940
1940
  });
1941
1941
  if (f.status === "valid")
1942
1942
  return f;
1943
- f.status === "dirty" && !s && (s = { result: f, ctx: d }), d.common.issues.length && c.push(d.common.issues);
1943
+ f.status === "dirty" && !s && (s = { result: f, ctx: u }), u.common.issues.length && c.push(u.common.issues);
1944
1944
  }
1945
1945
  if (s)
1946
1946
  return t.common.issues.push(...s.ctx.common.issues), s.result;
1947
1947
  const o = c.map((l) => new A(l));
1948
1948
  return m(t, {
1949
- code: u.invalid_union,
1949
+ code: d.invalid_union,
1950
1950
  unionErrors: o
1951
1951
  }), y;
1952
1952
  }
@@ -1960,13 +1960,13 @@ se.create = (n, e) => new se({
1960
1960
  typeName: g.ZodUnion,
1961
1961
  ...v(e)
1962
1962
  });
1963
- const P = (n) => n instanceof ue ? P(n.schema) : n instanceof j ? P(n.innerType()) : n instanceof de ? [n.value] : n instanceof V ? n.options : n instanceof le ? b.objectValues(n.enum) : n instanceof me ? P(n._def.innerType) : n instanceof ie ? [void 0] : n instanceof ae ? [null] : n instanceof Z ? [void 0, ...P(n.unwrap())] : n instanceof L ? [null, ...P(n.unwrap())] : n instanceof Pe || n instanceof fe ? P(n.unwrap()) : n instanceof pe ? P(n._def.innerType) : [];
1963
+ const D = (n) => n instanceof de ? D(n.schema) : n instanceof j ? D(n.innerType()) : n instanceof ue ? [n.value] : n instanceof V ? n.options : n instanceof le ? b.objectValues(n.enum) : n instanceof me ? D(n._def.innerType) : n instanceof ie ? [void 0] : n instanceof ae ? [null] : n instanceof Z ? [void 0, ...D(n.unwrap())] : n instanceof L ? [null, ...D(n.unwrap())] : n instanceof De || n instanceof fe ? D(n.unwrap()) : n instanceof pe ? D(n._def.innerType) : [];
1964
1964
  class Te extends _ {
1965
1965
  _parse(e) {
1966
1966
  const { ctx: t } = this._processInputParams(e);
1967
1967
  if (t.parsedType !== p.object)
1968
1968
  return m(t, {
1969
- code: u.invalid_type,
1969
+ code: d.invalid_type,
1970
1970
  expected: p.object,
1971
1971
  received: t.parsedType
1972
1972
  }), y;
@@ -1980,7 +1980,7 @@ class Te extends _ {
1980
1980
  path: t.path,
1981
1981
  parent: t
1982
1982
  }) : (m(t, {
1983
- code: u.invalid_union_discriminator,
1983
+ code: d.invalid_union_discriminator,
1984
1984
  options: Array.from(this.optionsMap.keys()),
1985
1985
  path: [i]
1986
1986
  }), y);
@@ -2005,7 +2005,7 @@ class Te extends _ {
2005
2005
  static create(e, t, i) {
2006
2006
  const a = /* @__PURE__ */ new Map();
2007
2007
  for (const s of t) {
2008
- const c = P(s.shape[e]);
2008
+ const c = D(s.shape[e]);
2009
2009
  if (!c.length)
2010
2010
  throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2011
2011
  for (const o of c) {
@@ -2056,7 +2056,7 @@ class oe extends _ {
2056
2056
  return y;
2057
2057
  const o = Oe(s.value, c.value);
2058
2058
  return o.valid ? ((Ze(s) || Ze(c)) && t.dirty(), { status: t.value, value: o.data }) : (m(i, {
2059
- code: u.invalid_intersection_types
2059
+ code: d.invalid_intersection_types
2060
2060
  }), y);
2061
2061
  };
2062
2062
  return i.common.async ? Promise.all([
@@ -2087,25 +2087,25 @@ oe.create = (n, e, t) => new oe({
2087
2087
  typeName: g.ZodIntersection,
2088
2088
  ...v(t)
2089
2089
  });
2090
- class D extends _ {
2090
+ class P extends _ {
2091
2091
  _parse(e) {
2092
2092
  const { status: t, ctx: i } = this._processInputParams(e);
2093
2093
  if (i.parsedType !== p.array)
2094
2094
  return m(i, {
2095
- code: u.invalid_type,
2095
+ code: d.invalid_type,
2096
2096
  expected: p.array,
2097
2097
  received: i.parsedType
2098
2098
  }), y;
2099
2099
  if (i.data.length < this._def.items.length)
2100
2100
  return m(i, {
2101
- code: u.too_small,
2101
+ code: d.too_small,
2102
2102
  minimum: this._def.items.length,
2103
2103
  inclusive: !0,
2104
2104
  exact: !1,
2105
2105
  type: "array"
2106
2106
  }), y;
2107
2107
  !this._def.rest && i.data.length > this._def.items.length && (m(i, {
2108
- code: u.too_big,
2108
+ code: d.too_big,
2109
2109
  maximum: this._def.items.length,
2110
2110
  inclusive: !0,
2111
2111
  exact: !1,
@@ -2121,16 +2121,16 @@ class D extends _ {
2121
2121
  return this._def.items;
2122
2122
  }
2123
2123
  rest(e) {
2124
- return new D({
2124
+ return new P({
2125
2125
  ...this._def,
2126
2126
  rest: e
2127
2127
  });
2128
2128
  }
2129
2129
  }
2130
- D.create = (n, e) => {
2130
+ P.create = (n, e) => {
2131
2131
  if (!Array.isArray(n))
2132
2132
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2133
- return new D({
2133
+ return new P({
2134
2134
  items: n,
2135
2135
  typeName: g.ZodTuple,
2136
2136
  rest: null,
@@ -2148,7 +2148,7 @@ class ce extends _ {
2148
2148
  const { status: t, ctx: i } = this._processInputParams(e);
2149
2149
  if (i.parsedType !== p.object)
2150
2150
  return m(i, {
2151
- code: u.invalid_type,
2151
+ code: d.invalid_type,
2152
2152
  expected: p.object,
2153
2153
  received: i.parsedType
2154
2154
  }), y;
@@ -2189,32 +2189,32 @@ class ke extends _ {
2189
2189
  const { status: t, ctx: i } = this._processInputParams(e);
2190
2190
  if (i.parsedType !== p.map)
2191
2191
  return m(i, {
2192
- code: u.invalid_type,
2192
+ code: d.invalid_type,
2193
2193
  expected: p.map,
2194
2194
  received: i.parsedType
2195
2195
  }), y;
2196
- const a = this._def.keyType, s = this._def.valueType, c = [...i.data.entries()].map(([o, l], d) => ({
2197
- key: a._parse(new O(i, o, i.path, [d, "key"])),
2198
- value: s._parse(new O(i, l, i.path, [d, "value"]))
2196
+ const a = this._def.keyType, s = this._def.valueType, c = [...i.data.entries()].map(([o, l], u) => ({
2197
+ key: a._parse(new O(i, o, i.path, [u, "key"])),
2198
+ value: s._parse(new O(i, l, i.path, [u, "value"]))
2199
2199
  }));
2200
2200
  if (i.common.async) {
2201
2201
  const o = /* @__PURE__ */ new Map();
2202
2202
  return Promise.resolve().then(async () => {
2203
2203
  for (const l of c) {
2204
- const d = await l.key, f = await l.value;
2205
- if (d.status === "aborted" || f.status === "aborted")
2204
+ const u = await l.key, f = await l.value;
2205
+ if (u.status === "aborted" || f.status === "aborted")
2206
2206
  return y;
2207
- (d.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(d.value, f.value);
2207
+ (u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
2208
2208
  }
2209
2209
  return { status: t.value, value: o };
2210
2210
  });
2211
2211
  } else {
2212
2212
  const o = /* @__PURE__ */ new Map();
2213
2213
  for (const l of c) {
2214
- const d = l.key, f = l.value;
2215
- if (d.status === "aborted" || f.status === "aborted")
2214
+ const u = l.key, f = l.value;
2215
+ if (u.status === "aborted" || f.status === "aborted")
2216
2216
  return y;
2217
- (d.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(d.value, f.value);
2217
+ (u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
2218
2218
  }
2219
2219
  return { status: t.value, value: o };
2220
2220
  }
@@ -2231,20 +2231,20 @@ class B extends _ {
2231
2231
  const { status: t, ctx: i } = this._processInputParams(e);
2232
2232
  if (i.parsedType !== p.set)
2233
2233
  return m(i, {
2234
- code: u.invalid_type,
2234
+ code: d.invalid_type,
2235
2235
  expected: p.set,
2236
2236
  received: i.parsedType
2237
2237
  }), y;
2238
2238
  const a = this._def;
2239
2239
  a.minSize !== null && i.data.size < a.minSize.value && (m(i, {
2240
- code: u.too_small,
2240
+ code: d.too_small,
2241
2241
  minimum: a.minSize.value,
2242
2242
  type: "set",
2243
2243
  inclusive: !0,
2244
2244
  exact: !1,
2245
2245
  message: a.minSize.message
2246
2246
  }), t.dirty()), a.maxSize !== null && i.data.size > a.maxSize.value && (m(i, {
2247
- code: u.too_big,
2247
+ code: d.too_big,
2248
2248
  maximum: a.maxSize.value,
2249
2249
  type: "set",
2250
2250
  inclusive: !0,
@@ -2253,15 +2253,15 @@ class B extends _ {
2253
2253
  }), t.dirty());
2254
2254
  const s = this._def.valueType;
2255
2255
  function c(l) {
2256
- const d = /* @__PURE__ */ new Set();
2256
+ const u = /* @__PURE__ */ new Set();
2257
2257
  for (const f of l) {
2258
2258
  if (f.status === "aborted")
2259
2259
  return y;
2260
- f.status === "dirty" && t.dirty(), d.add(f.value);
2260
+ f.status === "dirty" && t.dirty(), u.add(f.value);
2261
2261
  }
2262
- return { status: t.value, value: d };
2262
+ return { status: t.value, value: u };
2263
2263
  }
2264
- const o = [...i.data.values()].map((l, d) => s._parse(new O(i, l, i.path, d)));
2264
+ const o = [...i.data.values()].map((l, u) => s._parse(new O(i, l, i.path, u)));
2265
2265
  return i.common.async ? Promise.all(o).then((l) => c(l)) : c(o);
2266
2266
  }
2267
2267
  min(e, t) {
@@ -2298,7 +2298,7 @@ class Y extends _ {
2298
2298
  const { ctx: t } = this._processInputParams(e);
2299
2299
  if (t.parsedType !== p.function)
2300
2300
  return m(t, {
2301
- code: u.invalid_type,
2301
+ code: d.invalid_type,
2302
2302
  expected: p.function,
2303
2303
  received: t.parsedType
2304
2304
  }), y;
@@ -2311,9 +2311,9 @@ class Y extends _ {
2311
2311
  t.schemaErrorMap,
2312
2312
  ye(),
2313
2313
  X
2314
- ].filter((d) => !!d),
2314
+ ].filter((u) => !!u),
2315
2315
  issueData: {
2316
- code: u.invalid_arguments,
2316
+ code: d.invalid_arguments,
2317
2317
  argumentsError: l
2318
2318
  }
2319
2319
  });
@@ -2327,9 +2327,9 @@ class Y extends _ {
2327
2327
  t.schemaErrorMap,
2328
2328
  ye(),
2329
2329
  X
2330
- ].filter((d) => !!d),
2330
+ ].filter((u) => !!u),
2331
2331
  issueData: {
2332
- code: u.invalid_return_type,
2332
+ code: d.invalid_return_type,
2333
2333
  returnTypeError: l
2334
2334
  }
2335
2335
  });
@@ -2338,20 +2338,20 @@ class Y extends _ {
2338
2338
  if (this._def.returns instanceof J) {
2339
2339
  const o = this;
2340
2340
  return I(async function(...l) {
2341
- const d = new A([]), f = await o._def.args.parseAsync(l, s).catch((w) => {
2342
- throw d.addIssue(i(l, w)), d;
2341
+ const u = new A([]), f = await o._def.args.parseAsync(l, s).catch((w) => {
2342
+ throw u.addIssue(i(l, w)), u;
2343
2343
  }), x = await Reflect.apply(c, this, f);
2344
2344
  return await o._def.returns._def.type.parseAsync(x, s).catch((w) => {
2345
- throw d.addIssue(a(x, w)), d;
2345
+ throw u.addIssue(a(x, w)), u;
2346
2346
  });
2347
2347
  });
2348
2348
  } else {
2349
2349
  const o = this;
2350
2350
  return I(function(...l) {
2351
- const d = o._def.args.safeParse(l, s);
2352
- if (!d.success)
2353
- throw new A([i(l, d.error)]);
2354
- const f = Reflect.apply(c, this, d.data), x = o._def.returns.safeParse(f, s);
2351
+ const u = o._def.args.safeParse(l, s);
2352
+ if (!u.success)
2353
+ throw new A([i(l, u.error)]);
2354
+ const f = Reflect.apply(c, this, u.data), x = o._def.returns.safeParse(f, s);
2355
2355
  if (!x.success)
2356
2356
  throw new A([a(f, x.error)]);
2357
2357
  return x.data;
@@ -2367,7 +2367,7 @@ class Y extends _ {
2367
2367
  args(...e) {
2368
2368
  return new Y({
2369
2369
  ...this._def,
2370
- args: D.create(e).rest(F.create())
2370
+ args: P.create(e).rest(F.create())
2371
2371
  });
2372
2372
  }
2373
2373
  returns(e) {
@@ -2384,14 +2384,14 @@ class Y extends _ {
2384
2384
  }
2385
2385
  static create(e, t, i) {
2386
2386
  return new Y({
2387
- args: e || D.create([]).rest(F.create()),
2387
+ args: e || P.create([]).rest(F.create()),
2388
2388
  returns: t || F.create(),
2389
2389
  typeName: g.ZodFunction,
2390
2390
  ...v(i)
2391
2391
  });
2392
2392
  }
2393
2393
  }
2394
- class ue extends _ {
2394
+ class de extends _ {
2395
2395
  get schema() {
2396
2396
  return this._def.getter();
2397
2397
  }
@@ -2400,18 +2400,18 @@ class ue extends _ {
2400
2400
  return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2401
2401
  }
2402
2402
  }
2403
- ue.create = (n, e) => new ue({
2403
+ de.create = (n, e) => new de({
2404
2404
  getter: n,
2405
2405
  typeName: g.ZodLazy,
2406
2406
  ...v(e)
2407
2407
  });
2408
- class de extends _ {
2408
+ class ue extends _ {
2409
2409
  _parse(e) {
2410
2410
  if (e.data !== this._def.value) {
2411
2411
  const t = this._getOrReturnCtx(e);
2412
2412
  return m(t, {
2413
2413
  received: t.data,
2414
- code: u.invalid_literal,
2414
+ code: d.invalid_literal,
2415
2415
  expected: this._def.value
2416
2416
  }), y;
2417
2417
  }
@@ -2421,7 +2421,7 @@ class de extends _ {
2421
2421
  return this._def.value;
2422
2422
  }
2423
2423
  }
2424
- de.create = (n, e) => new de({
2424
+ ue.create = (n, e) => new ue({
2425
2425
  value: n,
2426
2426
  typeName: g.ZodLiteral,
2427
2427
  ...v(e)
@@ -2443,14 +2443,14 @@ class V extends _ {
2443
2443
  return m(t, {
2444
2444
  expected: b.joinValues(i),
2445
2445
  received: t.parsedType,
2446
- code: u.invalid_type
2446
+ code: d.invalid_type
2447
2447
  }), y;
2448
2448
  }
2449
2449
  if (_e(this, ee) || qe(this, ee, new Set(this._def.values)), !_e(this, ee).has(e.data)) {
2450
2450
  const t = this._getOrReturnCtx(e), i = this._def.values;
2451
2451
  return m(t, {
2452
2452
  received: t.data,
2453
- code: u.invalid_enum_value,
2453
+ code: d.invalid_enum_value,
2454
2454
  options: i
2455
2455
  }), y;
2456
2456
  }
@@ -2503,14 +2503,14 @@ class le extends _ {
2503
2503
  return m(i, {
2504
2504
  expected: b.joinValues(a),
2505
2505
  received: i.parsedType,
2506
- code: u.invalid_type
2506
+ code: d.invalid_type
2507
2507
  }), y;
2508
2508
  }
2509
2509
  if (_e(this, te) || qe(this, te, new Set(b.getValidEnumValues(this._def.values))), !_e(this, te).has(e.data)) {
2510
2510
  const a = b.objectValues(t);
2511
2511
  return m(i, {
2512
2512
  received: i.data,
2513
- code: u.invalid_enum_value,
2513
+ code: d.invalid_enum_value,
2514
2514
  options: a
2515
2515
  }), y;
2516
2516
  }
@@ -2534,7 +2534,7 @@ class J extends _ {
2534
2534
  const { ctx: t } = this._processInputParams(e);
2535
2535
  if (t.parsedType !== p.promise && t.common.async === !1)
2536
2536
  return m(t, {
2537
- code: u.invalid_type,
2537
+ code: d.invalid_type,
2538
2538
  expected: p.promise,
2539
2539
  received: t.parsedType
2540
2540
  }), y;
@@ -2733,7 +2733,7 @@ class we extends _ {
2733
2733
  if (this._getType(e) !== p.nan) {
2734
2734
  const i = this._getOrReturnCtx(e);
2735
2735
  return m(i, {
2736
- code: u.invalid_type,
2736
+ code: d.invalid_type,
2737
2737
  expected: p.nan,
2738
2738
  received: i.parsedType
2739
2739
  }), y;
@@ -2745,8 +2745,8 @@ we.create = (n) => new we({
2745
2745
  typeName: g.ZodNaN,
2746
2746
  ...v(n)
2747
2747
  });
2748
- const Dt = Symbol("zod_brand");
2749
- class Pe extends _ {
2748
+ const Pt = Symbol("zod_brand");
2749
+ class De extends _ {
2750
2750
  _parse(e) {
2751
2751
  const { ctx: t } = this._processInputParams(e), i = t.data;
2752
2752
  return this._def.type._parse({
@@ -2823,19 +2823,19 @@ function Xe(n, e = {}, t) {
2823
2823
  const o = n(i);
2824
2824
  if (o instanceof Promise)
2825
2825
  return o.then((l) => {
2826
- var d, f;
2826
+ var u, f;
2827
2827
  if (!l) {
2828
- const x = ze(e, i), T = (f = (d = x.fatal) !== null && d !== void 0 ? d : t) !== null && f !== void 0 ? f : !0;
2828
+ const x = ze(e, i), T = (f = (u = x.fatal) !== null && u !== void 0 ? u : t) !== null && f !== void 0 ? f : !0;
2829
2829
  a.addIssue({ code: "custom", ...x, fatal: T });
2830
2830
  }
2831
2831
  });
2832
2832
  if (!o) {
2833
- const l = ze(e, i), d = (c = (s = l.fatal) !== null && s !== void 0 ? s : t) !== null && c !== void 0 ? c : !0;
2834
- a.addIssue({ code: "custom", ...l, fatal: d });
2833
+ const l = ze(e, i), u = (c = (s = l.fatal) !== null && s !== void 0 ? s : t) !== null && c !== void 0 ? c : !0;
2834
+ a.addIssue({ code: "custom", ...l, fatal: u });
2835
2835
  }
2836
2836
  }) : G.create();
2837
2837
  }
2838
- const Pt = {
2838
+ const Dt = {
2839
2839
  object: k.lazycreate
2840
2840
  };
2841
2841
  var g;
@@ -2844,7 +2844,7 @@ var g;
2844
2844
  })(g || (g = {}));
2845
2845
  const Et = (n, e = {
2846
2846
  message: `Input not instance of ${n.name}`
2847
- }) => Xe((t) => t instanceof n, e), Ge = N.create, Je = M.create, Rt = we.create, $t = z.create, He = re.create, Mt = q.create, zt = be.create, Vt = ie.create, Lt = ae.create, Ft = G.create, Ut = F.create, qt = $.create, Bt = xe.create, Wt = C.create, Qt = k.create, Yt = k.strictCreate, Xt = se.create, Gt = Te.create, Jt = oe.create, Ht = D.create, Kt = ce.create, en = ke.create, tn = B.create, nn = Y.create, rn = ue.create, an = de.create, sn = V.create, on = le.create, cn = J.create, Ve = j.create, un = Z.create, dn = L.create, ln = j.createWithPreprocess, mn = he.create, pn = () => Ge().optional(), fn = () => Je().optional(), hn = () => He().optional(), gn = {
2847
+ }) => Xe((t) => t instanceof n, e), Ge = N.create, Je = M.create, Rt = we.create, $t = z.create, He = re.create, Mt = q.create, zt = be.create, Vt = ie.create, Lt = ae.create, Ft = G.create, Ut = F.create, qt = $.create, Bt = xe.create, Wt = C.create, Qt = k.create, Yt = k.strictCreate, Xt = se.create, Gt = Te.create, Jt = oe.create, Ht = P.create, Kt = ce.create, en = ke.create, tn = B.create, nn = Y.create, rn = de.create, an = ue.create, sn = V.create, on = le.create, cn = J.create, Ve = j.create, dn = Z.create, un = L.create, ln = j.createWithPreprocess, mn = he.create, pn = () => Ge().optional(), fn = () => Je().optional(), hn = () => He().optional(), gn = {
2848
2848
  string: (n) => N.create({ ...n, coerce: !0 }),
2849
2849
  number: (n) => M.create({ ...n, coerce: !0 }),
2850
2850
  boolean: (n) => re.create({
@@ -2857,7 +2857,7 @@ const Et = (n, e = {
2857
2857
  var r = /* @__PURE__ */ Object.freeze({
2858
2858
  __proto__: null,
2859
2859
  defaultErrorMap: X,
2860
- setErrorMap: dt,
2860
+ setErrorMap: ut,
2861
2861
  getErrorMap: ye,
2862
2862
  makeIssue: ve,
2863
2863
  EMPTY_PATH: lt,
@@ -2897,13 +2897,13 @@ var r = /* @__PURE__ */ Object.freeze({
2897
2897
  ZodUnion: se,
2898
2898
  ZodDiscriminatedUnion: Te,
2899
2899
  ZodIntersection: oe,
2900
- ZodTuple: D,
2900
+ ZodTuple: P,
2901
2901
  ZodRecord: ce,
2902
2902
  ZodMap: ke,
2903
2903
  ZodSet: B,
2904
2904
  ZodFunction: Y,
2905
- ZodLazy: ue,
2906
- ZodLiteral: de,
2905
+ ZodLazy: de,
2906
+ ZodLiteral: ue,
2907
2907
  ZodEnum: V,
2908
2908
  ZodNativeEnum: le,
2909
2909
  ZodPromise: J,
@@ -2914,14 +2914,14 @@ var r = /* @__PURE__ */ Object.freeze({
2914
2914
  ZodDefault: me,
2915
2915
  ZodCatch: pe,
2916
2916
  ZodNaN: we,
2917
- BRAND: Dt,
2918
- ZodBranded: Pe,
2917
+ BRAND: Pt,
2918
+ ZodBranded: De,
2919
2919
  ZodPipeline: he,
2920
2920
  ZodReadonly: fe,
2921
2921
  custom: Xe,
2922
2922
  Schema: _,
2923
2923
  ZodSchema: _,
2924
- late: Pt,
2924
+ late: Dt,
2925
2925
  get ZodFirstPartyTypeKind() {
2926
2926
  return g;
2927
2927
  },
@@ -2944,12 +2944,12 @@ var r = /* @__PURE__ */ Object.freeze({
2944
2944
  nativeEnum: on,
2945
2945
  never: qt,
2946
2946
  null: Lt,
2947
- nullable: dn,
2947
+ nullable: un,
2948
2948
  number: Je,
2949
2949
  object: Qt,
2950
2950
  oboolean: hn,
2951
2951
  onumber: fn,
2952
- optional: un,
2952
+ optional: dn,
2953
2953
  ostring: pn,
2954
2954
  pipeline: mn,
2955
2955
  preprocess: ln,
@@ -2966,8 +2966,8 @@ var r = /* @__PURE__ */ Object.freeze({
2966
2966
  unknown: Ut,
2967
2967
  void: Bt,
2968
2968
  NEVER: yn,
2969
- ZodIssueCode: u,
2970
- quotelessJson: ut,
2969
+ ZodIssueCode: d,
2970
+ quotelessJson: dt,
2971
2971
  ZodError: A
2972
2972
  });
2973
2973
  const Se = r.object({
@@ -2979,8 +2979,8 @@ const Se = r.object({
2979
2979
  apartmentEnterNumber: r.string().optional(),
2980
2980
  apartmentNumber: r.string().optional(),
2981
2981
  zip: r.string().optional()
2982
- }), R = r.string().min(1, { message: "שדה חובה" }), Mn = r.string().regex(/^\d+$/, "Must be a numeric string"), zn = r.object({ url: r.string().url(), id: r.string() });
2983
- function Vn(n) {
2982
+ }), R = r.string().min(1, { message: "שדה חובה" }), zn = r.string().regex(/^\d+$/, "Must be a numeric string"), Vn = r.object({ url: r.string().url(), id: r.string() });
2983
+ function Ln(n) {
2984
2984
  return !!(n != null && n.url);
2985
2985
  }
2986
2986
  const ge = r.object({
@@ -2996,7 +2996,7 @@ const ge = r.object({
2996
2996
  depth: r.number()
2997
2997
  }), Ee = Ke.extend({
2998
2998
  children: r.lazy(() => Ee.array())
2999
- }), Ln = Ke.extend({
2999
+ }), Fn = Ke.extend({
3000
3000
  index: r.number(),
3001
3001
  depth: r.number(),
3002
3002
  collapsed: r.boolean().optional(),
@@ -3058,7 +3058,7 @@ const ge = r.object({
3058
3058
  }).optional(),
3059
3059
  // @deprecated
3060
3060
  categoryNames: r.array(r.string()).optional()
3061
- }), Fn = Re.extend({
3061
+ }), Un = Re.extend({
3062
3062
  image: r.instanceof(File).optional()
3063
3063
  }), vn = r.enum(["delivered", "missing", "substituted"]), _n = r.object({
3064
3064
  product: Re,
@@ -3073,7 +3073,7 @@ const ge = r.object({
3073
3073
  // Picking / fulfillment — optional so existing items stay valid (treated as "delivered").
3074
3074
  status: vn.optional(),
3075
3075
  substitutedWith: _n.nullable().optional()
3076
- }), Un = r.object({
3076
+ }), qn = r.object({
3077
3077
  type: r.literal("Cart"),
3078
3078
  id: r.string().uuid(),
3079
3079
  companyId: r.string().uuid(),
@@ -3081,11 +3081,11 @@ const ge = r.object({
3081
3081
  userId: r.string().uuid(),
3082
3082
  status: r.enum(["active", "draft", "completed"]),
3083
3083
  items: r.array(et)
3084
- }), qn = r.object({
3084
+ }), Bn = r.object({
3085
3085
  id: r.string(),
3086
3086
  name: r.string(),
3087
3087
  websiteDomains: r.array(r.string())
3088
- }), Bn = r.object({
3088
+ }), Wn = r.object({
3089
3089
  type: r.literal("FavoriteProduct"),
3090
3090
  id: r.string().uuid(),
3091
3091
  companyId: r.string().uuid(),
@@ -3166,11 +3166,25 @@ const ge = r.object({
3166
3166
  total: r.number().min(1, "Total is required").optional(),
3167
3167
  vat: r.number().min(1, "VAT is required").optional(),
3168
3168
  link: r.string().url("Link must be a valid URL").optional()
3169
- }), nt = r.object({
3169
+ }), wn = r.enum([
3170
+ "credit",
3171
+ "net15",
3172
+ "net30",
3173
+ "net60",
3174
+ "net90"
3175
+ ]), nt = r.object({
3170
3176
  number: r.string(),
3171
3177
  name: r.string(),
3172
- id: r.string()
3173
- }), wn = r.object({
3178
+ id: r.string(),
3179
+ // Optional, admin-managed billing config (see company-edit-like-demo plan, Phase 2)
3180
+ payTerms: wn.optional(),
3181
+ creditLimit: r.number().optional(),
3182
+ isPrimary: r.boolean().optional(),
3183
+ // Optional category restriction — when `restricted`, the account is limited to
3184
+ // `allowedCategories` (category ids). Order-time enforcement is a separate concern.
3185
+ restricted: r.boolean().optional(),
3186
+ allowedCategories: r.array(r.string()).optional()
3187
+ }), Tn = r.object({
3174
3188
  id: r.string(),
3175
3189
  name: r.string(),
3176
3190
  discountPercentage: r.number().positive().min(0).max(100).optional(),
@@ -3185,7 +3199,7 @@ const ge = r.object({
3185
3199
  email: r.string().optional(),
3186
3200
  notes: r.string().optional(),
3187
3201
  freeShipping: r.boolean().optional()
3188
- }), Wn = wn.omit({ id: !0 }), Le = r.object({
3202
+ }), Qn = Tn.omit({ id: !0 }), Le = r.object({
3189
3203
  doc_uuid: r.string().uuid("Document UUID must be a valid UUID"),
3190
3204
  pdf_link: r.string().url("PDF link must be a valid URL"),
3191
3205
  pdf_link_copy: r.string().url("PDF copy link must be a valid URL"),
@@ -3196,7 +3210,7 @@ const ge = r.object({
3196
3210
  calculatedData: tt,
3197
3211
  warning: r.string().optional(),
3198
3212
  date: r.number().optional()
3199
- }), Tn = r.object({
3213
+ }), Sn = r.object({
3200
3214
  id: r.string().min(1, "ID is required"),
3201
3215
  number: r.string().min(1, "Number is required"),
3202
3216
  date: r.string().min(1, "Date is required"),
@@ -3225,7 +3239,7 @@ const ge = r.object({
3225
3239
  total: r.number().min(1, "Total is required").optional(),
3226
3240
  vat: r.number().min(1, "VAT is required").optional(),
3227
3241
  link: r.string().url("Link must be a valid URL").optional()
3228
- }), Qn = r.object({
3242
+ }), Yn = r.object({
3229
3243
  type: r.literal("Order"),
3230
3244
  createdBy: r.enum(["user", "admin"]).optional(),
3231
3245
  id: R,
@@ -3292,7 +3306,7 @@ const ge = r.object({
3292
3306
  organizationId: r.string().optional(),
3293
3307
  billingAccount: nt.optional(),
3294
3308
  deliveryNote: kn.optional(),
3295
- invoice: Tn.optional(),
3309
+ invoice: Sn.optional(),
3296
3310
  ezInvoice: Le.optional(),
3297
3311
  ezDeliveryNote: xn.optional(),
3298
3312
  /**
@@ -3310,7 +3324,7 @@ const ge = r.object({
3310
3324
  // Audit: who last changed the order + when (epoch millis). Stamped by admin writes.
3311
3325
  updatedBy: r.string().optional(),
3312
3326
  updatedAt: r.number().optional()
3313
- }), Sn = r.enum(["individual", "company"]), Yn = r.object({
3327
+ }), In = r.enum(["individual", "company"]), Xn = r.object({
3314
3328
  id: r.string(),
3315
3329
  companyId: r.string(),
3316
3330
  name: r.string(),
@@ -3321,17 +3335,17 @@ const ge = r.object({
3321
3335
  paymentType: Ie,
3322
3336
  allowAnonymousClients: r.boolean(),
3323
3337
  isVatIncludedInPrice: r.boolean(),
3324
- clientTypes: r.array(Sn),
3338
+ clientTypes: r.array(In),
3325
3339
  minimumOrder: r.number().optional(),
3326
3340
  freeDeliveryPrice: r.number().optional(),
3327
3341
  deliveryPrice: r.number().optional(),
3328
3342
  address: Se.optional(),
3329
3343
  companyNumber: r.string().optional()
3330
3344
  // חפ של החברה
3331
- }), In = r.object({
3345
+ }), An = r.object({
3332
3346
  minSpend: r.number().positive().optional(),
3333
3347
  stackable: r.boolean().default(!1)
3334
- }).optional(), An = r.discriminatedUnion("variantType", [
3348
+ }).optional(), Nn = r.discriminatedUnion("variantType", [
3335
3349
  r.object({
3336
3350
  variantType: r.literal("bundle"),
3337
3351
  productsId: r.array(r.string().nonempty()).min(1),
@@ -3341,7 +3355,7 @@ const ge = r.object({
3341
3355
  bundlePrice: r.number().positive()
3342
3356
  // Total price for the bundle (e.g., $25)
3343
3357
  })
3344
- ]), Xn = r.object({
3358
+ ]), Gn = r.object({
3345
3359
  type: r.literal("Discount"),
3346
3360
  storeId: r.string().min(1),
3347
3361
  companyId: r.string().min(1),
@@ -3350,10 +3364,10 @@ const ge = r.object({
3350
3364
  active: r.boolean(),
3351
3365
  startDate: r.number(),
3352
3366
  endDate: r.number(),
3353
- variant: An,
3354
- conditions: In
3367
+ variant: Nn,
3368
+ conditions: An
3355
3369
  });
3356
- class Nn {
3370
+ class Cn {
3357
3371
  canApply(e, t) {
3358
3372
  if (e.variant.variantType !== "bundle" || !this.isDiscountActive(e)) return !1;
3359
3373
  const { productsId: i, requiredQuantity: a } = e.variant;
@@ -3365,13 +3379,13 @@ class Nn {
3365
3379
  const { productsId: i, requiredQuantity: a, bundlePrice: s } = e.variant, c = t.cart.filter((H) => i.includes(H.product.id)), o = this.getTotalQuantity(t.cart, i), l = Math.floor(o / a);
3366
3380
  if (l === 0)
3367
3381
  return { applicable: !1, discountAmount: 0, affectedItems: [] };
3368
- const d = this.calculateOriginalPrice(c), f = this.getTotalQuantity(t.cart, i), x = this.calculateDiscountedPrice(
3369
- d,
3382
+ const u = this.calculateOriginalPrice(c), f = this.getTotalQuantity(t.cart, i), x = this.calculateDiscountedPrice(
3383
+ u,
3370
3384
  s,
3371
3385
  l,
3372
3386
  a,
3373
3387
  f
3374
- ), T = d - x, w = this.distributeDiscount(c, T, d);
3388
+ ), T = u - x, w = this.distributeDiscount(c, T, u);
3375
3389
  return {
3376
3390
  applicable: !0,
3377
3391
  discountAmount: Number(T.toFixed(2)),
@@ -3389,8 +3403,8 @@ class Nn {
3389
3403
  return e.reduce((t, i) => t + i.product.price * i.amount, 0);
3390
3404
  }
3391
3405
  calculateDiscountedPrice(e, t, i, a, s) {
3392
- const c = t * i, o = i * a, d = Math.max(0, s - o) / s * e;
3393
- return c + d;
3406
+ const c = t * i, o = i * a, u = Math.max(0, s - o) / s * e;
3407
+ return c + u;
3394
3408
  }
3395
3409
  distributeDiscount(e, t, i) {
3396
3410
  const a = t / i;
@@ -3421,11 +3435,11 @@ class rt {
3421
3435
  }
3422
3436
  }
3423
3437
  $e(rt, "strategies", /* @__PURE__ */ new Map([
3424
- ["bundle", new Nn()]
3438
+ ["bundle", new Cn()]
3425
3439
  ]));
3426
- class Gn {
3440
+ class Jn {
3427
3441
  static calculateDiscounts(e, t, i) {
3428
- var d, f;
3442
+ var u, f;
3429
3443
  const a = {
3430
3444
  cart: e,
3431
3445
  user: i,
@@ -3433,7 +3447,7 @@ class Gn {
3433
3447
  }, s = this.filterActiveDiscounts(t), c = [];
3434
3448
  for (const x of s) {
3435
3449
  const T = rt.getStrategy(x);
3436
- if (!T || !T.canApply(x, a) || !((d = x.conditions) != null && d.stackable) && c.length > 0) continue;
3450
+ if (!T || !T.canApply(x, a) || !((u = x.conditions) != null && u.stackable) && c.length > 0) continue;
3437
3451
  const w = T.calculate(x, a);
3438
3452
  w.applicable && (c.push({
3439
3453
  discountId: x.id,
@@ -3461,9 +3475,9 @@ class Gn {
3461
3475
  static calculateFinalPrices(e, t) {
3462
3476
  return e.map((i) => {
3463
3477
  const a = t.filter(
3464
- (l) => l.affectedItems.some((d) => d.productId === i.product.id)
3465
- ), s = a.reduce((l, d) => {
3466
- const f = d.affectedItems.find(
3478
+ (l) => l.affectedItems.some((u) => u.productId === i.product.id)
3479
+ ), s = a.reduce((l, u) => {
3480
+ const f = u.affectedItems.find(
3467
3481
  (x) => x.productId === i.product.id
3468
3482
  );
3469
3483
  return l + ((f == null ? void 0 : f.discountAmount) || 0);
@@ -3486,16 +3500,16 @@ class Gn {
3486
3500
  return this.filterActiveDiscounts(e);
3487
3501
  }
3488
3502
  }
3489
- const Cn = r.object({
3503
+ const jn = r.object({
3490
3504
  id: r.string(),
3491
3505
  name: r.string()
3492
- }), Jn = Cn.omit({ id: !0 }), it = r.object({
3506
+ }), Hn = jn.omit({ id: !0 }), it = r.object({
3493
3507
  type: r.literal("Supplier"),
3494
3508
  id: r.string(),
3495
3509
  name: r.string(),
3496
3510
  code: r.string()
3497
3511
  // supplier code number
3498
- }), Hn = it.omit({ id: !0 }), jn = r.object({
3512
+ }), Kn = it.omit({ id: !0 }), Zn = r.object({
3499
3513
  type: r.literal("SupplierInvoice"),
3500
3514
  id: r.string(),
3501
3515
  // "draft" = work-in-progress, NOT yet finalized. Product prices are only
@@ -3540,14 +3554,14 @@ const Cn = r.object({
3540
3554
  total: r.number().optional(),
3541
3555
  totalBeforeVat: r.number().optional(),
3542
3556
  vat: r.number().optional()
3543
- }), Kn = jn.omit({ id: !0 }), Zn = r.enum(["debt_increase", "debt_reduction"]), er = r.object({
3557
+ }), er = Zn.omit({ id: !0 }), On = r.enum(["debt_increase", "debt_reduction"]), tr = r.object({
3544
3558
  recordId: r.string().min(1),
3545
3559
  organizationId: r.string().min(1),
3546
3560
  customerId: r.string(),
3547
3561
  // "system" when no acting user
3548
3562
  customerName: r.string(),
3549
3563
  billingAccountId: r.string().nullable(),
3550
- type: Zn,
3564
+ type: On,
3551
3565
  /** Integer agorot, always positive */
3552
3566
  amount: r.number().int().positive(),
3553
3567
  currency: r.literal("ILS"),
@@ -3565,7 +3579,7 @@ const Cn = r.object({
3565
3579
  yearMonth: r.string(),
3566
3580
  companyId: r.string().min(1),
3567
3581
  storeId: r.string().min(1)
3568
- }), tr = r.object({
3582
+ }), nr = r.object({
3569
3583
  /** = doc id */
3570
3584
  organizationId: r.string().min(1),
3571
3585
  organizationName: r.string(),
@@ -3579,7 +3593,7 @@ const Cn = r.object({
3579
3593
  updatedAt: r.number().int().positive(),
3580
3594
  companyId: r.string().min(1),
3581
3595
  storeId: r.string().min(1)
3582
- }), nr = r.enum([
3596
+ }), rr = r.enum([
3583
3597
  "delivery_note",
3584
3598
  "payment_received",
3585
3599
  "credit_note",
@@ -3590,7 +3604,7 @@ const Cn = r.object({
3590
3604
  // legacy
3591
3605
  "order_refunded"
3592
3606
  // legacy
3593
- ]), rr = r.enum(["check", "bank_transfer", "cash", "credit_card", "other"]), ir = r.object({
3607
+ ]), ir = r.enum(["check", "bank_transfer", "cash", "credit_card", "other"]), ar = r.object({
3594
3608
  /** = deterministic dedup doc id */
3595
3609
  id: r.string().min(1),
3596
3610
  organizationId: r.string().min(1),
@@ -3622,7 +3636,7 @@ const Cn = r.object({
3622
3636
  createdAt: r.number().int().positive(),
3623
3637
  companyId: r.string().min(1),
3624
3638
  storeId: r.string().min(1)
3625
- }), ar = r.object({
3639
+ }), sr = r.object({
3626
3640
  /** = doc id */
3627
3641
  organizationId: r.string().min(1),
3628
3642
  /** Σ(+) − Σ(−), clamped ≥ 0; integer agorot. Non-zero only when totalAccrued > totalSettled. */
@@ -3642,23 +3656,23 @@ const Cn = r.object({
3642
3656
  updatedAt: r.number().int().positive(),
3643
3657
  companyId: r.string().min(1),
3644
3658
  storeId: r.string().min(1)
3645
- }), De = {
3659
+ }), Pe = {
3646
3660
  VAT: 18
3647
3661
  };
3648
- function On(n, e) {
3662
+ function Pn(n, e) {
3649
3663
  var t, i;
3650
3664
  return ((t = n.discount) == null ? void 0 : t.type) === "percent" ? n.price * (n.discount.value ?? 100) / 100 : ((i = n.discount) == null ? void 0 : i.type) === "number" ? n.discount.value ?? 0 : 0;
3651
3665
  }
3652
3666
  function Dn(n, e) {
3653
3667
  var i, a;
3654
- const t = e && n.vat ? n.price + n.price * De.VAT / 100 : n.price;
3668
+ const t = e && n.vat ? n.price + n.price * Pe.VAT / 100 : n.price;
3655
3669
  if (((i = n.discount) == null ? void 0 : i.type) === "percent") {
3656
3670
  const s = t * n.discount.value / 100;
3657
3671
  return n.price - s;
3658
3672
  }
3659
3673
  return ((a = n.discount) == null ? void 0 : a.type) === "number" ? t - n.discount.value : t;
3660
3674
  }
3661
- function sr({
3675
+ function or({
3662
3676
  cart: n,
3663
3677
  discounts: e,
3664
3678
  deliveryPrice: t = 0,
@@ -3670,18 +3684,18 @@ function sr({
3670
3684
  product: { ...o.product },
3671
3685
  originalPrice: o.product.price,
3672
3686
  finalPrice: Dn(o.product, a),
3673
- finalDiscount: On(o.product)
3687
+ finalDiscount: Pn(o.product)
3674
3688
  })), c = s.reduce(
3675
3689
  (o, l) => {
3676
- const { product: d, amount: f, finalPrice: x, finalDiscount: T } = l;
3690
+ const { product: u, amount: f, finalPrice: x, finalDiscount: T } = l;
3677
3691
  let w = 0;
3678
- if (d.vat) {
3692
+ if (u.vat) {
3679
3693
  let Ae = 0;
3680
3694
  if (a) {
3681
- const at = Number((x / (1 + De.VAT / 100)).toFixed(2)), st = x - at;
3695
+ const at = Number((x / (1 + Pe.VAT / 100)).toFixed(2)), st = x - at;
3682
3696
  w = Number(st.toFixed(2)), w = w * f, Ae = Number(w.toFixed(2));
3683
3697
  } else
3684
- w = x * De.VAT / 100, w = w * f, Ae = Number(w.toFixed(2));
3698
+ w = x * Pe.VAT / 100, w = w * f, Ae = Number(w.toFixed(2));
3685
3699
  o.vat = Number((o.vat + Ae).toFixed(2));
3686
3700
  }
3687
3701
  const H = Number(x.toFixed(2));
@@ -3698,10 +3712,10 @@ function sr({
3698
3712
  );
3699
3713
  return c.deliveryPrice && c.productsCost >= i ? c.deliveryPrice = 0 : c.finalCost += c.deliveryPrice, { items: s, ...c };
3700
3714
  }
3701
- const Pn = {
3715
+ const En = {
3702
3716
  stores: "STORES",
3703
3717
  companies: "COMPANIES"
3704
- }, En = {
3718
+ }, Rn = {
3705
3719
  products: "products",
3706
3720
  "favorite-products": "favorite-products",
3707
3721
  profiles: "profiles",
@@ -3730,9 +3744,9 @@ const Pn = {
3730
3744
  duplicateChargeAlerts: "duplicateChargeAlerts",
3731
3745
  organizationBalance: "organizationBalance",
3732
3746
  organizationBalanceRollup: "organizationBalanceRollup"
3733
- }, Rn = {
3734
- systemCollections: Pn,
3735
- storeCollections: En,
3747
+ }, $n = {
3748
+ systemCollections: En,
3749
+ storeCollections: Rn,
3736
3750
  // for client and server
3737
3751
  getPath: ({
3738
3752
  companyId: n,
@@ -3751,14 +3765,14 @@ const Pn = {
3751
3765
  // for firestore events
3752
3766
  getDocPath: (n) => `{companyId}/{storeId}/${n}/{id}`,
3753
3767
  getSubDocPath: (n, e, t) => `{companyId}/{storeId}/${n}/${e}/${t}/{id}`
3754
- }, or = {
3755
- firestore: Rn
3768
+ }, cr = {
3769
+ firestore: $n
3756
3770
  }, Fe = {
3757
3771
  round: (n, e = 2) => {
3758
3772
  const t = 10 ** e;
3759
3773
  return Math.round((n + Number.EPSILON) * t) / t;
3760
3774
  }
3761
- }, cr = {
3775
+ }, dr = {
3762
3776
  calcSalePriceFromMargin: (n, e) => n <= 0 || e <= 0 || n >= 100 ? e : Fe.round(e / (1 - n / 100)),
3763
3777
  calcMarginFromSalePrice: (n, e) => n <= 0 || e <= 0 ? 0 : Fe.round((n - e) / n * 100)
3764
3778
  };
@@ -3766,57 +3780,58 @@ export {
3766
3780
  Se as AddressSchema,
3767
3781
  Ke as BaseCategorySchema,
3768
3782
  nt as BillingAccountSchema,
3769
- er as BudgetRecordSchema,
3770
- Zn as BudgetRecordTypeSchema,
3771
- nr as BudgetTransactionTypeSchema,
3772
- Nn as BundleDiscountStrategy,
3783
+ tr as BudgetRecordSchema,
3784
+ On as BudgetRecordTypeSchema,
3785
+ rr as BudgetTransactionTypeSchema,
3786
+ Cn as BundleDiscountStrategy,
3773
3787
  tt as CalculatedDataSchema,
3774
3788
  et as CartItemProductSchema,
3775
- Un as CartSchema,
3789
+ qn as CartSchema,
3776
3790
  Ee as CategorySchema,
3777
- qn as CompanySchema,
3791
+ Bn as CompanySchema,
3778
3792
  kn as DeliveryNoteSchema,
3779
- In as DiscountConditionsSchema,
3780
- Gn as DiscountEngine,
3781
- Xn as DiscountSchema,
3793
+ An as DiscountConditionsSchema,
3794
+ Jn as DiscountEngine,
3795
+ Gn as DiscountSchema,
3782
3796
  rt as DiscountStrategyFactory,
3783
- An as DiscountVariantSchema,
3797
+ Nn as DiscountVariantSchema,
3784
3798
  xn as EzDeliveryNoteSchema,
3785
3799
  Le as EzInvoiceSchema,
3786
- Bn as FavoriteProductSchema,
3787
- zn as FileSchema,
3788
- or as FirebaseAPI,
3800
+ Wn as FavoriteProductSchema,
3801
+ Vn as FileSchema,
3802
+ cr as FirebaseAPI,
3789
3803
  vn as FulfillmentStatusSchema,
3790
- Tn as InvoiceSchema,
3804
+ Sn as InvoiceSchema,
3791
3805
  ge as LocaleSchema,
3792
- Jn as NewOrganizationGroupSchema,
3793
- Wn as NewOrganizationSchema,
3794
- Fn as NewProductSchema,
3795
- Kn as NewSupplierInvoiceSchema,
3796
- Hn as NewSupplierSchema,
3797
- Qn as OrderSchema,
3798
- ir as OrganizationBalanceEntrySchema,
3799
- ar as OrganizationBalanceRollupSchema,
3800
- tr as OrganizationBudgetSchema,
3801
- Cn as OrganizationGroupSchema,
3802
- wn as OrganizationSchema,
3803
- rr as PaymentMethodSchema,
3806
+ Hn as NewOrganizationGroupSchema,
3807
+ Qn as NewOrganizationSchema,
3808
+ Un as NewProductSchema,
3809
+ er as NewSupplierInvoiceSchema,
3810
+ Kn as NewSupplierSchema,
3811
+ Yn as OrderSchema,
3812
+ ar as OrganizationBalanceEntrySchema,
3813
+ sr as OrganizationBalanceRollupSchema,
3814
+ nr as OrganizationBudgetSchema,
3815
+ jn as OrganizationGroupSchema,
3816
+ Tn as OrganizationSchema,
3817
+ ir as PaymentMethodSchema,
3818
+ wn as PaymentTermsSchema,
3804
3819
  Ie as PaymentTypeSchema,
3805
3820
  Re as ProductSchema,
3806
3821
  bn as ProfileSchema,
3807
- Yn as StoreSchema,
3822
+ Xn as StoreSchema,
3808
3823
  _n as SubstitutedWithSchema,
3809
- jn as SupplierInvoiceSchema,
3824
+ Zn as SupplierInvoiceSchema,
3810
3825
  it as SupplierSchema,
3811
- Ln as TFlattenCategorySchema,
3812
- Sn as clientTypesSchema,
3813
- sr as getCartCost,
3814
- Vn as isFile,
3826
+ Fn as TFlattenCategorySchema,
3827
+ In as clientTypesSchema,
3828
+ or as getCartCost,
3829
+ Ln as isFile,
3815
3830
  Fe as math,
3816
3831
  R as notEmptyTextSchema,
3817
- Mn as numericTextSchema,
3818
- cr as storeCalculator,
3819
- En as storeCollections,
3820
- Pn as systemCollections
3832
+ zn as numericTextSchema,
3833
+ dr as storeCalculator,
3834
+ Rn as storeCollections,
3835
+ En as systemCollections
3821
3836
  };
3822
3837
  //# sourceMappingURL=core.es.js.map