@coursebuilder/adapter-drizzle 0.1.3 → 0.1.4

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 (134) hide show
  1. package/dist/{chunk-XXZQBN6S.js → chunk-2CI3IGR2.js} +4 -4
  2. package/dist/{chunk-3LWFRGZT.js → chunk-3RJVKNXB.js} +458 -381
  3. package/dist/{chunk-NXFHRDLS.js → chunk-53266VWH.js} +3 -3
  4. package/dist/{chunk-OIUOQ3TT.js → chunk-57CX5SOI.js} +2 -2
  5. package/dist/{chunk-75V6F7LZ.js → chunk-5HT43CVZ.js} +2 -2
  6. package/dist/{chunk-SFJM6FKE.js → chunk-BX5SO2JG.js} +2 -2
  7. package/dist/{chunk-LSOPFMDB.js → chunk-FNYW3XKR.js} +3 -3
  8. package/dist/{chunk-V6QEDDFG.js → chunk-GLPDG7UE.js} +2 -2
  9. package/dist/{chunk-VNI36MMC.js → chunk-H736K5TN.js} +1 -1
  10. package/dist/{chunk-6CBAFOL3.js → chunk-J4LBG2TH.js} +2 -2
  11. package/dist/{chunk-JD4KFACE.js → chunk-JKOYOL7A.js} +2 -2
  12. package/dist/{chunk-TMQIGK3N.js → chunk-MBB4GIJI.js} +2 -2
  13. package/dist/{chunk-27KREOQW.js → chunk-PJHGIRZM.js} +2 -2
  14. package/dist/{chunk-L2TQQYG4.js → chunk-PPBEA4EM.js} +2 -2
  15. package/dist/{chunk-ULABK6XG.js → chunk-Q5WENQT6.js} +3 -3
  16. package/dist/{chunk-H4MXNDWO.js → chunk-V23SCQL7.js} +2 -2
  17. package/dist/{chunk-NZDLUQWP.js → chunk-VDVCCU7D.js} +2 -2
  18. package/dist/{chunk-IN6G6MTW.js → chunk-VXZRMVNY.js} +2 -2
  19. package/dist/{chunk-XSXWLOIN.js → chunk-WQ7UXKZC.js} +920 -482
  20. package/dist/{chunk-JKRFXYAR.js → chunk-Y7QZGEPT.js} +2 -2
  21. package/dist/index.js +20 -21
  22. package/dist/lib/mysql/index.cjs +926 -465
  23. package/dist/lib/mysql/index.cjs.map +1 -1
  24. package/dist/lib/mysql/index.d.cts +6143 -0
  25. package/dist/lib/mysql/index.d.ts +41 -9
  26. package/dist/lib/mysql/index.js +20 -21
  27. package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
  28. package/dist/lib/mysql/schemas/auth/accounts.d.cts +184 -0
  29. package/dist/lib/mysql/schemas/auth/accounts.js +10 -11
  30. package/dist/lib/mysql/schemas/auth/permissions.d.cts +98 -0
  31. package/dist/lib/mysql/schemas/auth/permissions.js +2 -2
  32. package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
  33. package/dist/lib/mysql/schemas/auth/role-permissions.d.cts +89 -0
  34. package/dist/lib/mysql/schemas/auth/role-permissions.js +11 -12
  35. package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
  36. package/dist/lib/mysql/schemas/auth/roles.d.cts +100 -0
  37. package/dist/lib/mysql/schemas/auth/roles.js +10 -11
  38. package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
  39. package/dist/lib/mysql/schemas/auth/sessions.d.cts +52 -0
  40. package/dist/lib/mysql/schemas/auth/sessions.js +11 -12
  41. package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
  42. package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +89 -0
  43. package/dist/lib/mysql/schemas/auth/user-permissions.js +10 -11
  44. package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
  45. package/dist/lib/mysql/schemas/auth/user-roles.d.cts +89 -0
  46. package/dist/lib/mysql/schemas/auth/user-roles.js +10 -11
  47. package/dist/lib/mysql/schemas/auth/users.cjs +1 -1
  48. package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
  49. package/dist/lib/mysql/schemas/auth/users.d.cts +106 -0
  50. package/dist/lib/mysql/schemas/auth/users.js +10 -11
  51. package/dist/lib/mysql/schemas/auth/verification-tokens.d.cts +60 -0
  52. package/dist/lib/mysql/schemas/auth/verification-tokens.js +2 -2
  53. package/dist/lib/mysql/schemas/commerce/coupon.cjs +180 -17
  54. package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
  55. package/dist/lib/mysql/schemas/commerce/coupon.d.cts +172 -0
  56. package/dist/lib/mysql/schemas/commerce/coupon.d.ts +6 -2
  57. package/dist/lib/mysql/schemas/commerce/coupon.js +12 -2
  58. package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +72 -0
  59. package/dist/lib/mysql/schemas/commerce/merchant-account.js +2 -2
  60. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +108 -0
  61. package/dist/lib/mysql/schemas/commerce/merchant-charge.js +2 -2
  62. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +84 -0
  63. package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +2 -2
  64. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +84 -0
  65. package/dist/lib/mysql/schemas/commerce/merchant-customer.js +2 -2
  66. package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +96 -0
  67. package/dist/lib/mysql/schemas/commerce/merchant-price.js +2 -2
  68. package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +84 -0
  69. package/dist/lib/mysql/schemas/commerce/merchant-product.js +2 -2
  70. package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +48 -0
  71. package/dist/lib/mysql/schemas/commerce/merchant-session.js +2 -2
  72. package/dist/lib/mysql/schemas/commerce/price.cjs +4 -1
  73. package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
  74. package/dist/lib/mysql/schemas/commerce/price.d.cts +101 -0
  75. package/dist/lib/mysql/schemas/commerce/price.d.ts +1 -1
  76. package/dist/lib/mysql/schemas/commerce/price.js +10 -11
  77. package/dist/lib/mysql/schemas/commerce/product.cjs +4 -1
  78. package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
  79. package/dist/lib/mysql/schemas/commerce/product.d.cts +114 -0
  80. package/dist/lib/mysql/schemas/commerce/product.d.ts +12 -0
  81. package/dist/lib/mysql/schemas/commerce/product.js +10 -11
  82. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +132 -0
  83. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +2 -2
  84. package/dist/lib/mysql/schemas/commerce/purchase.cjs +14 -2
  85. package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
  86. package/dist/lib/mysql/schemas/commerce/purchase.d.cts +225 -0
  87. package/dist/lib/mysql/schemas/commerce/purchase.d.ts +2 -1
  88. package/dist/lib/mysql/schemas/commerce/purchase.js +10 -11
  89. package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +3 -0
  90. package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
  91. package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +101 -0
  92. package/dist/lib/mysql/schemas/commerce/upgradable-products.js +11 -12
  93. package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +96 -0
  94. package/dist/lib/mysql/schemas/communication/communication-channel.js +2 -2
  95. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +96 -0
  96. package/dist/lib/mysql/schemas/communication/communication-preference-types.js +2 -2
  97. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
  98. package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +150 -0
  99. package/dist/lib/mysql/schemas/communication/communication-preferences.js +10 -11
  100. package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
  101. package/dist/lib/mysql/schemas/content/content-contributions.d.cts +114 -0
  102. package/dist/lib/mysql/schemas/content/content-contributions.js +10 -11
  103. package/dist/lib/mysql/schemas/content/content-resource-product.cjs +3 -0
  104. package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
  105. package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +101 -0
  106. package/dist/lib/mysql/schemas/content/content-resource-product.js +10 -11
  107. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
  108. package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +101 -0
  109. package/dist/lib/mysql/schemas/content/content-resource-resource.js +10 -11
  110. package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
  111. package/dist/lib/mysql/schemas/content/content-resource.d.cts +103 -0
  112. package/dist/lib/mysql/schemas/content/content-resource.js +10 -11
  113. package/dist/lib/mysql/schemas/content/contribution-types.d.cts +110 -0
  114. package/dist/lib/mysql/schemas/content/contribution-types.js +2 -2
  115. package/dist/lib/mysql/schemas/content/resource-progress.cjs +1 -1
  116. package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
  117. package/dist/lib/mysql/schemas/content/resource-progress.d.cts +84 -0
  118. package/dist/lib/mysql/schemas/content/resource-progress.d.ts +1 -1
  119. package/dist/lib/mysql/schemas/content/resource-progress.js +2 -2
  120. package/dist/lib/mysql/utils.cjs.map +1 -1
  121. package/dist/lib/mysql/utils.d.cts +12 -0
  122. package/dist/lib/mysql/utils.js +1 -1
  123. package/dist/lib/mysql/utils.js.map +1 -1
  124. package/dist/lib/utils.d.cts +22 -0
  125. package/dist/lib/utils.d.ts +1 -1
  126. package/dist/lib/utils.js +1 -1
  127. package/package.json +5 -5
  128. package/src/lib/mysql/index.ts +464 -113
  129. package/src/lib/mysql/schemas/commerce/coupon.ts +18 -2
  130. package/src/lib/mysql/schemas/commerce/price.ts +1 -1
  131. package/src/lib/mysql/schemas/commerce/product.ts +1 -0
  132. package/src/lib/mysql/schemas/commerce/purchase.ts +6 -1
  133. package/src/lib/mysql/schemas/content/resource-progress.ts +1 -1
  134. package/dist/chunk-QK6CINAJ.js +0 -60
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  getResourceProgressSchema
3
- } from "./chunk-LSOPFMDB.js";
3
+ } from "./chunk-FNYW3XKR.js";
4
4
  import {
5
5
  getUpgradableProductsRelationsSchema,
6
6
  getUpgradableProductsSchema
7
- } from "./chunk-NXFHRDLS.js";
7
+ } from "./chunk-53266VWH.js";
8
8
  import {
9
9
  getMerchantCouponSchema
10
- } from "./chunk-JD4KFACE.js";
10
+ } from "./chunk-JKOYOL7A.js";
11
11
  import {
12
12
  getMerchantCustomerSchema
13
- } from "./chunk-OIUOQ3TT.js";
13
+ } from "./chunk-57CX5SOI.js";
14
14
  import {
15
15
  getPurchaseUserTransferSchema
16
- } from "./chunk-75V6F7LZ.js";
16
+ } from "./chunk-5HT43CVZ.js";
17
17
  import {
18
18
  getSessionRelationsSchema,
19
19
  getSessionsSchema
20
- } from "./chunk-ULABK6XG.js";
20
+ } from "./chunk-Q5WENQT6.js";
21
21
  import {
22
22
  getVerificationTokensSchema
23
- } from "./chunk-TMQIGK3N.js";
23
+ } from "./chunk-MBB4GIJI.js";
24
24
  import {
25
25
  getMerchantAccountSchema
26
- } from "./chunk-IN6G6MTW.js";
26
+ } from "./chunk-VXZRMVNY.js";
27
27
  import {
28
28
  getRolePermissionsRelationsSchema,
29
29
  getRolePermissionsSchema
30
- } from "./chunk-XXZQBN6S.js";
30
+ } from "./chunk-2CI3IGR2.js";
31
31
  import {
32
32
  getAccountsRelationsSchema,
33
33
  getAccountsSchema,
@@ -41,6 +41,8 @@ import {
41
41
  getContentResourceResourceRelationsSchema,
42
42
  getContentResourceResourceSchema,
43
43
  getContentResourceSchema,
44
+ getCouponRelationsSchema,
45
+ getCouponSchema,
44
46
  getPriceSchema,
45
47
  getProductRelationsSchema2 as getProductRelationsSchema,
46
48
  getProductSchema,
@@ -54,43 +56,40 @@ import {
54
56
  getUserRolesSchema,
55
57
  getUsersRelationsSchema,
56
58
  getUsersSchema
57
- } from "./chunk-3LWFRGZT.js";
59
+ } from "./chunk-3RJVKNXB.js";
58
60
  import {
59
61
  getContributionTypesRelationsSchema,
60
62
  getContributionTypesSchema
61
- } from "./chunk-V6QEDDFG.js";
63
+ } from "./chunk-GLPDG7UE.js";
62
64
  import {
63
65
  getCommunicationChannelSchema
64
- } from "./chunk-6CBAFOL3.js";
66
+ } from "./chunk-J4LBG2TH.js";
65
67
  import {
66
68
  getCommunicationPreferenceTypesSchema
67
- } from "./chunk-SFJM6FKE.js";
69
+ } from "./chunk-BX5SO2JG.js";
68
70
  import {
69
71
  getMerchantPriceSchema
70
- } from "./chunk-L2TQQYG4.js";
72
+ } from "./chunk-PPBEA4EM.js";
71
73
  import {
72
74
  getMerchantProductSchema
73
- } from "./chunk-JKRFXYAR.js";
75
+ } from "./chunk-Y7QZGEPT.js";
74
76
  import {
75
77
  getMerchantSessionSchema
76
- } from "./chunk-H4MXNDWO.js";
77
- import {
78
- getCouponSchema
79
- } from "./chunk-QK6CINAJ.js";
78
+ } from "./chunk-V23SCQL7.js";
80
79
  import {
81
80
  getMerchantChargeSchema
82
- } from "./chunk-27KREOQW.js";
81
+ } from "./chunk-PJHGIRZM.js";
83
82
  import {
84
83
  getPermissionsRelationsSchema,
85
84
  getPermissionsSchema
86
- } from "./chunk-NZDLUQWP.js";
85
+ } from "./chunk-VDVCCU7D.js";
87
86
  import {
88
87
  __name
89
- } from "./chunk-VNI36MMC.js";
88
+ } from "./chunk-H736K5TN.js";
90
89
 
91
90
  // src/lib/mysql/index.ts
92
91
  import { addSeconds, isAfter } from "date-fns";
93
- import { and, asc, eq, inArray, not, or, sql } from "drizzle-orm";
92
+ import { and, asc, eq, inArray, isNull, not, or, sql } from "drizzle-orm";
94
93
  import { mysqlTable as defaultMySqlTableFn } from "drizzle-orm/mysql-core";
95
94
  import { v4 } from "uuid";
96
95
 
@@ -251,7 +250,7 @@ var quotelessJson = /* @__PURE__ */ __name((obj) => {
251
250
  const json = JSON.stringify(obj, null, 2);
252
251
  return json.replace(/"([^"]+)":/g, "$1:");
253
252
  }, "quotelessJson");
254
- var ZodError = class extends Error {
253
+ var _ZodError = class _ZodError extends Error {
255
254
  constructor(issues) {
256
255
  super();
257
256
  this.issues = [];
@@ -335,7 +334,8 @@ var ZodError = class extends Error {
335
334
  return this.flatten();
336
335
  }
337
336
  };
338
- __name(ZodError, "ZodError");
337
+ __name(_ZodError, "ZodError");
338
+ var ZodError = _ZodError;
339
339
  ZodError.create = (issues) => {
340
340
  const error = new ZodError(issues);
341
341
  return error;
@@ -482,7 +482,7 @@ function addIssueToContext(ctx, issueData) {
482
482
  ctx.common.issues.push(issue);
483
483
  }
484
484
  __name(addIssueToContext, "addIssueToContext");
485
- var ParseStatus = class {
485
+ var _ParseStatus = class _ParseStatus {
486
486
  constructor() {
487
487
  this.value = "valid";
488
488
  }
@@ -513,7 +513,7 @@ var ParseStatus = class {
513
513
  value: await pair.value
514
514
  });
515
515
  }
516
- return ParseStatus.mergeObjectSync(status, syncPairs);
516
+ return _ParseStatus.mergeObjectSync(status, syncPairs);
517
517
  }
518
518
  static mergeObjectSync(status, pairs) {
519
519
  const finalObject = {};
@@ -534,7 +534,8 @@ var ParseStatus = class {
534
534
  return { status: status.value, value: finalObject };
535
535
  }
536
536
  };
537
- __name(ParseStatus, "ParseStatus");
537
+ __name(_ParseStatus, "ParseStatus");
538
+ var ParseStatus = _ParseStatus;
538
539
  var INVALID = Object.freeze({
539
540
  status: "aborted"
540
541
  });
@@ -549,7 +550,7 @@ var errorUtil;
549
550
  errorUtil3.errToObj = (message) => typeof message === "string" ? { message } : message || {};
550
551
  errorUtil3.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
551
552
  })(errorUtil || (errorUtil = {}));
552
- var ParseInputLazyPath = class {
553
+ var _ParseInputLazyPath = class _ParseInputLazyPath {
553
554
  constructor(parent, value, path, key) {
554
555
  this._cachedPath = [];
555
556
  this.parent = parent;
@@ -568,7 +569,8 @@ var ParseInputLazyPath = class {
568
569
  return this._cachedPath;
569
570
  }
570
571
  };
571
- __name(ParseInputLazyPath, "ParseInputLazyPath");
572
+ __name(_ParseInputLazyPath, "ParseInputLazyPath");
573
+ var ParseInputLazyPath = _ParseInputLazyPath;
572
574
  var handleResult = /* @__PURE__ */ __name((ctx, result) => {
573
575
  if (isValid(result)) {
574
576
  return { success: true, data: result.value };
@@ -608,7 +610,7 @@ function processCreateParams(params) {
608
610
  return { errorMap: customMap, description };
609
611
  }
610
612
  __name(processCreateParams, "processCreateParams");
611
- var ZodType = class {
613
+ var _ZodType = class _ZodType {
612
614
  constructor(def) {
613
615
  this.spa = this.safeParseAsync;
614
616
  this._def = def;
@@ -684,11 +686,11 @@ var ZodType = class {
684
686
  throw result.error;
685
687
  }
686
688
  safeParse(data, params) {
687
- var _a;
689
+ var _a41;
688
690
  const ctx = {
689
691
  common: {
690
692
  issues: [],
691
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
693
+ async: (_a41 = params === null || params === void 0 ? void 0 : params.async) !== null && _a41 !== void 0 ? _a41 : false,
692
694
  contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
693
695
  },
694
696
  path: (params === null || params === void 0 ? void 0 : params.path) || [],
@@ -851,7 +853,8 @@ var ZodType = class {
851
853
  return this.safeParse(null).success;
852
854
  }
853
855
  };
854
- __name(ZodType, "ZodType");
856
+ __name(_ZodType, "ZodType");
857
+ var ZodType = _ZodType;
855
858
  var cuidRegex = /^c[^\s-]{8,}$/i;
856
859
  var cuid2Regex = /^[a-z][a-z0-9]*$/;
857
860
  var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
@@ -892,7 +895,7 @@ function isValidIP(ip, version) {
892
895
  return false;
893
896
  }
894
897
  __name(isValidIP, "isValidIP");
895
- var ZodString = class extends ZodType {
898
+ var _ZodString = class _ZodString extends ZodType {
896
899
  _parse(input) {
897
900
  if (this._def.coerce) {
898
901
  input.data = String(input.data);
@@ -1032,7 +1035,7 @@ var ZodString = class extends ZodType {
1032
1035
  } else if (check.kind === "url") {
1033
1036
  try {
1034
1037
  new URL(input.data);
1035
- } catch (_a) {
1038
+ } catch (_a41) {
1036
1039
  ctx = this._getOrReturnCtx(input, ctx);
1037
1040
  addIssueToContext(ctx, {
1038
1041
  validation: "url",
@@ -1124,7 +1127,7 @@ var ZodString = class extends ZodType {
1124
1127
  });
1125
1128
  }
1126
1129
  _addCheck(check) {
1127
- return new ZodString({
1130
+ return new _ZodString({
1128
1131
  ...this._def,
1129
1132
  checks: [...this._def.checks, check]
1130
1133
  });
@@ -1154,7 +1157,7 @@ var ZodString = class extends ZodType {
1154
1157
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1155
1158
  }
1156
1159
  datetime(options) {
1157
- var _a;
1160
+ var _a41;
1158
1161
  if (typeof options === "string") {
1159
1162
  return this._addCheck({
1160
1163
  kind: "datetime",
@@ -1166,7 +1169,7 @@ var ZodString = class extends ZodType {
1166
1169
  return this._addCheck({
1167
1170
  kind: "datetime",
1168
1171
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1169
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1172
+ offset: (_a41 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a41 !== void 0 ? _a41 : false,
1170
1173
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1171
1174
  });
1172
1175
  }
@@ -1228,19 +1231,19 @@ var ZodString = class extends ZodType {
1228
1231
  return this.min(1, errorUtil.errToObj(message));
1229
1232
  }
1230
1233
  trim() {
1231
- return new ZodString({
1234
+ return new _ZodString({
1232
1235
  ...this._def,
1233
1236
  checks: [...this._def.checks, { kind: "trim" }]
1234
1237
  });
1235
1238
  }
1236
1239
  toLowerCase() {
1237
- return new ZodString({
1240
+ return new _ZodString({
1238
1241
  ...this._def,
1239
1242
  checks: [...this._def.checks, { kind: "toLowerCase" }]
1240
1243
  });
1241
1244
  }
1242
1245
  toUpperCase() {
1243
- return new ZodString({
1246
+ return new _ZodString({
1244
1247
  ...this._def,
1245
1248
  checks: [...this._def.checks, { kind: "toUpperCase" }]
1246
1249
  });
@@ -1293,13 +1296,14 @@ var ZodString = class extends ZodType {
1293
1296
  return max;
1294
1297
  }
1295
1298
  };
1296
- __name(ZodString, "ZodString");
1299
+ __name(_ZodString, "ZodString");
1300
+ var ZodString = _ZodString;
1297
1301
  ZodString.create = (params) => {
1298
- var _a;
1302
+ var _a41;
1299
1303
  return new ZodString({
1300
1304
  checks: [],
1301
1305
  typeName: ZodFirstPartyTypeKind.ZodString,
1302
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1306
+ coerce: (_a41 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a41 !== void 0 ? _a41 : false,
1303
1307
  ...processCreateParams(params)
1304
1308
  });
1305
1309
  };
@@ -1312,7 +1316,7 @@ function floatSafeRemainder(val, step) {
1312
1316
  return valInt % stepInt / Math.pow(10, decCount);
1313
1317
  }
1314
1318
  __name(floatSafeRemainder, "floatSafeRemainder");
1315
- var ZodNumber = class extends ZodType {
1319
+ var _ZodNumber = class _ZodNumber extends ZodType {
1316
1320
  constructor() {
1317
1321
  super(...arguments);
1318
1322
  this.min = this.gte;
@@ -1413,7 +1417,7 @@ var ZodNumber = class extends ZodType {
1413
1417
  return this.setLimit("max", value, false, errorUtil.toString(message));
1414
1418
  }
1415
1419
  setLimit(kind, value, inclusive, message) {
1416
- return new ZodNumber({
1420
+ return new _ZodNumber({
1417
1421
  ...this._def,
1418
1422
  checks: [
1419
1423
  ...this._def.checks,
@@ -1427,7 +1431,7 @@ var ZodNumber = class extends ZodType {
1427
1431
  });
1428
1432
  }
1429
1433
  _addCheck(check) {
1430
- return new ZodNumber({
1434
+ return new _ZodNumber({
1431
1435
  ...this._def,
1432
1436
  checks: [...this._def.checks, check]
1433
1437
  });
@@ -1535,7 +1539,8 @@ var ZodNumber = class extends ZodType {
1535
1539
  return Number.isFinite(min) && Number.isFinite(max);
1536
1540
  }
1537
1541
  };
1538
- __name(ZodNumber, "ZodNumber");
1542
+ __name(_ZodNumber, "ZodNumber");
1543
+ var ZodNumber = _ZodNumber;
1539
1544
  ZodNumber.create = (params) => {
1540
1545
  return new ZodNumber({
1541
1546
  checks: [],
@@ -1544,7 +1549,7 @@ ZodNumber.create = (params) => {
1544
1549
  ...processCreateParams(params)
1545
1550
  });
1546
1551
  };
1547
- var ZodBigInt = class extends ZodType {
1552
+ var _ZodBigInt = class _ZodBigInt extends ZodType {
1548
1553
  constructor() {
1549
1554
  super(...arguments);
1550
1555
  this.min = this.gte;
@@ -1622,7 +1627,7 @@ var ZodBigInt = class extends ZodType {
1622
1627
  return this.setLimit("max", value, false, errorUtil.toString(message));
1623
1628
  }
1624
1629
  setLimit(kind, value, inclusive, message) {
1625
- return new ZodBigInt({
1630
+ return new _ZodBigInt({
1626
1631
  ...this._def,
1627
1632
  checks: [
1628
1633
  ...this._def.checks,
@@ -1636,7 +1641,7 @@ var ZodBigInt = class extends ZodType {
1636
1641
  });
1637
1642
  }
1638
1643
  _addCheck(check) {
1639
- return new ZodBigInt({
1644
+ return new _ZodBigInt({
1640
1645
  ...this._def,
1641
1646
  checks: [...this._def.checks, check]
1642
1647
  });
@@ -1701,17 +1706,18 @@ var ZodBigInt = class extends ZodType {
1701
1706
  return max;
1702
1707
  }
1703
1708
  };
1704
- __name(ZodBigInt, "ZodBigInt");
1709
+ __name(_ZodBigInt, "ZodBigInt");
1710
+ var ZodBigInt = _ZodBigInt;
1705
1711
  ZodBigInt.create = (params) => {
1706
- var _a;
1712
+ var _a41;
1707
1713
  return new ZodBigInt({
1708
1714
  checks: [],
1709
1715
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
1710
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1716
+ coerce: (_a41 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a41 !== void 0 ? _a41 : false,
1711
1717
  ...processCreateParams(params)
1712
1718
  });
1713
1719
  };
1714
- var ZodBoolean = class extends ZodType {
1720
+ var _ZodBoolean = class _ZodBoolean extends ZodType {
1715
1721
  _parse(input) {
1716
1722
  if (this._def.coerce) {
1717
1723
  input.data = Boolean(input.data);
@@ -1729,7 +1735,8 @@ var ZodBoolean = class extends ZodType {
1729
1735
  return OK(input.data);
1730
1736
  }
1731
1737
  };
1732
- __name(ZodBoolean, "ZodBoolean");
1738
+ __name(_ZodBoolean, "ZodBoolean");
1739
+ var ZodBoolean = _ZodBoolean;
1733
1740
  ZodBoolean.create = (params) => {
1734
1741
  return new ZodBoolean({
1735
1742
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
@@ -1737,7 +1744,7 @@ ZodBoolean.create = (params) => {
1737
1744
  ...processCreateParams(params)
1738
1745
  });
1739
1746
  };
1740
- var ZodDate = class extends ZodType {
1747
+ var _ZodDate = class _ZodDate extends ZodType {
1741
1748
  _parse(input) {
1742
1749
  if (this._def.coerce) {
1743
1750
  input.data = new Date(input.data);
@@ -1798,7 +1805,7 @@ var ZodDate = class extends ZodType {
1798
1805
  };
1799
1806
  }
1800
1807
  _addCheck(check) {
1801
- return new ZodDate({
1808
+ return new _ZodDate({
1802
1809
  ...this._def,
1803
1810
  checks: [...this._def.checks, check]
1804
1811
  });
@@ -1838,7 +1845,8 @@ var ZodDate = class extends ZodType {
1838
1845
  return max != null ? new Date(max) : null;
1839
1846
  }
1840
1847
  };
1841
- __name(ZodDate, "ZodDate");
1848
+ __name(_ZodDate, "ZodDate");
1849
+ var ZodDate = _ZodDate;
1842
1850
  ZodDate.create = (params) => {
1843
1851
  return new ZodDate({
1844
1852
  checks: [],
@@ -1847,7 +1855,7 @@ ZodDate.create = (params) => {
1847
1855
  ...processCreateParams(params)
1848
1856
  });
1849
1857
  };
1850
- var ZodSymbol = class extends ZodType {
1858
+ var _ZodSymbol = class _ZodSymbol extends ZodType {
1851
1859
  _parse(input) {
1852
1860
  const parsedType = this._getType(input);
1853
1861
  if (parsedType !== ZodParsedType.symbol) {
@@ -1862,14 +1870,15 @@ var ZodSymbol = class extends ZodType {
1862
1870
  return OK(input.data);
1863
1871
  }
1864
1872
  };
1865
- __name(ZodSymbol, "ZodSymbol");
1873
+ __name(_ZodSymbol, "ZodSymbol");
1874
+ var ZodSymbol = _ZodSymbol;
1866
1875
  ZodSymbol.create = (params) => {
1867
1876
  return new ZodSymbol({
1868
1877
  typeName: ZodFirstPartyTypeKind.ZodSymbol,
1869
1878
  ...processCreateParams(params)
1870
1879
  });
1871
1880
  };
1872
- var ZodUndefined = class extends ZodType {
1881
+ var _ZodUndefined = class _ZodUndefined extends ZodType {
1873
1882
  _parse(input) {
1874
1883
  const parsedType = this._getType(input);
1875
1884
  if (parsedType !== ZodParsedType.undefined) {
@@ -1884,14 +1893,15 @@ var ZodUndefined = class extends ZodType {
1884
1893
  return OK(input.data);
1885
1894
  }
1886
1895
  };
1887
- __name(ZodUndefined, "ZodUndefined");
1896
+ __name(_ZodUndefined, "ZodUndefined");
1897
+ var ZodUndefined = _ZodUndefined;
1888
1898
  ZodUndefined.create = (params) => {
1889
1899
  return new ZodUndefined({
1890
1900
  typeName: ZodFirstPartyTypeKind.ZodUndefined,
1891
1901
  ...processCreateParams(params)
1892
1902
  });
1893
1903
  };
1894
- var ZodNull = class extends ZodType {
1904
+ var _ZodNull = class _ZodNull extends ZodType {
1895
1905
  _parse(input) {
1896
1906
  const parsedType = this._getType(input);
1897
1907
  if (parsedType !== ZodParsedType.null) {
@@ -1906,14 +1916,15 @@ var ZodNull = class extends ZodType {
1906
1916
  return OK(input.data);
1907
1917
  }
1908
1918
  };
1909
- __name(ZodNull, "ZodNull");
1919
+ __name(_ZodNull, "ZodNull");
1920
+ var ZodNull = _ZodNull;
1910
1921
  ZodNull.create = (params) => {
1911
1922
  return new ZodNull({
1912
1923
  typeName: ZodFirstPartyTypeKind.ZodNull,
1913
1924
  ...processCreateParams(params)
1914
1925
  });
1915
1926
  };
1916
- var ZodAny = class extends ZodType {
1927
+ var _ZodAny = class _ZodAny extends ZodType {
1917
1928
  constructor() {
1918
1929
  super(...arguments);
1919
1930
  this._any = true;
@@ -1922,14 +1933,15 @@ var ZodAny = class extends ZodType {
1922
1933
  return OK(input.data);
1923
1934
  }
1924
1935
  };
1925
- __name(ZodAny, "ZodAny");
1936
+ __name(_ZodAny, "ZodAny");
1937
+ var ZodAny = _ZodAny;
1926
1938
  ZodAny.create = (params) => {
1927
1939
  return new ZodAny({
1928
1940
  typeName: ZodFirstPartyTypeKind.ZodAny,
1929
1941
  ...processCreateParams(params)
1930
1942
  });
1931
1943
  };
1932
- var ZodUnknown = class extends ZodType {
1944
+ var _ZodUnknown = class _ZodUnknown extends ZodType {
1933
1945
  constructor() {
1934
1946
  super(...arguments);
1935
1947
  this._unknown = true;
@@ -1938,14 +1950,15 @@ var ZodUnknown = class extends ZodType {
1938
1950
  return OK(input.data);
1939
1951
  }
1940
1952
  };
1941
- __name(ZodUnknown, "ZodUnknown");
1953
+ __name(_ZodUnknown, "ZodUnknown");
1954
+ var ZodUnknown = _ZodUnknown;
1942
1955
  ZodUnknown.create = (params) => {
1943
1956
  return new ZodUnknown({
1944
1957
  typeName: ZodFirstPartyTypeKind.ZodUnknown,
1945
1958
  ...processCreateParams(params)
1946
1959
  });
1947
1960
  };
1948
- var ZodNever = class extends ZodType {
1961
+ var _ZodNever = class _ZodNever extends ZodType {
1949
1962
  _parse(input) {
1950
1963
  const ctx = this._getOrReturnCtx(input);
1951
1964
  addIssueToContext(ctx, {
@@ -1956,14 +1969,15 @@ var ZodNever = class extends ZodType {
1956
1969
  return INVALID;
1957
1970
  }
1958
1971
  };
1959
- __name(ZodNever, "ZodNever");
1972
+ __name(_ZodNever, "ZodNever");
1973
+ var ZodNever = _ZodNever;
1960
1974
  ZodNever.create = (params) => {
1961
1975
  return new ZodNever({
1962
1976
  typeName: ZodFirstPartyTypeKind.ZodNever,
1963
1977
  ...processCreateParams(params)
1964
1978
  });
1965
1979
  };
1966
- var ZodVoid = class extends ZodType {
1980
+ var _ZodVoid = class _ZodVoid extends ZodType {
1967
1981
  _parse(input) {
1968
1982
  const parsedType = this._getType(input);
1969
1983
  if (parsedType !== ZodParsedType.undefined) {
@@ -1978,14 +1992,15 @@ var ZodVoid = class extends ZodType {
1978
1992
  return OK(input.data);
1979
1993
  }
1980
1994
  };
1981
- __name(ZodVoid, "ZodVoid");
1995
+ __name(_ZodVoid, "ZodVoid");
1996
+ var ZodVoid = _ZodVoid;
1982
1997
  ZodVoid.create = (params) => {
1983
1998
  return new ZodVoid({
1984
1999
  typeName: ZodFirstPartyTypeKind.ZodVoid,
1985
2000
  ...processCreateParams(params)
1986
2001
  });
1987
2002
  };
1988
- var ZodArray = class extends ZodType {
2003
+ var _ZodArray = class _ZodArray extends ZodType {
1989
2004
  _parse(input) {
1990
2005
  const { ctx, status } = this._processInputParams(input);
1991
2006
  const def = this._def;
@@ -2055,19 +2070,19 @@ var ZodArray = class extends ZodType {
2055
2070
  return this._def.type;
2056
2071
  }
2057
2072
  min(minLength, message) {
2058
- return new ZodArray({
2073
+ return new _ZodArray({
2059
2074
  ...this._def,
2060
2075
  minLength: { value: minLength, message: errorUtil.toString(message) }
2061
2076
  });
2062
2077
  }
2063
2078
  max(maxLength, message) {
2064
- return new ZodArray({
2079
+ return new _ZodArray({
2065
2080
  ...this._def,
2066
2081
  maxLength: { value: maxLength, message: errorUtil.toString(message) }
2067
2082
  });
2068
2083
  }
2069
2084
  length(len, message) {
2070
- return new ZodArray({
2085
+ return new _ZodArray({
2071
2086
  ...this._def,
2072
2087
  exactLength: { value: len, message: errorUtil.toString(message) }
2073
2088
  });
@@ -2076,7 +2091,8 @@ var ZodArray = class extends ZodType {
2076
2091
  return this.min(1, message);
2077
2092
  }
2078
2093
  };
2079
- __name(ZodArray, "ZodArray");
2094
+ __name(_ZodArray, "ZodArray");
2095
+ var ZodArray = _ZodArray;
2080
2096
  ZodArray.create = (schema, params) => {
2081
2097
  return new ZodArray({
2082
2098
  type: schema,
@@ -2114,7 +2130,7 @@ function deepPartialify(schema) {
2114
2130
  }
2115
2131
  }
2116
2132
  __name(deepPartialify, "deepPartialify");
2117
- var ZodObject = class extends ZodType {
2133
+ var _ZodObject = class _ZodObject extends ZodType {
2118
2134
  constructor() {
2119
2135
  super(...arguments);
2120
2136
  this._cached = null;
@@ -2219,13 +2235,13 @@ var ZodObject = class extends ZodType {
2219
2235
  }
2220
2236
  strict(message) {
2221
2237
  errorUtil.errToObj;
2222
- return new ZodObject({
2238
+ return new _ZodObject({
2223
2239
  ...this._def,
2224
2240
  unknownKeys: "strict",
2225
2241
  ...message !== void 0 ? {
2226
2242
  errorMap: (issue, ctx) => {
2227
- var _a, _b, _c, _d;
2228
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2243
+ var _a41, _b, _c, _d;
2244
+ const defaultError = (_c = (_b = (_a41 = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a41, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2229
2245
  if (issue.code === "unrecognized_keys")
2230
2246
  return {
2231
2247
  message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
@@ -2238,13 +2254,13 @@ var ZodObject = class extends ZodType {
2238
2254
  });
2239
2255
  }
2240
2256
  strip() {
2241
- return new ZodObject({
2257
+ return new _ZodObject({
2242
2258
  ...this._def,
2243
2259
  unknownKeys: "strip"
2244
2260
  });
2245
2261
  }
2246
2262
  passthrough() {
2247
- return new ZodObject({
2263
+ return new _ZodObject({
2248
2264
  ...this._def,
2249
2265
  unknownKeys: "passthrough"
2250
2266
  });
@@ -2267,7 +2283,7 @@ var ZodObject = class extends ZodType {
2267
2283
  // }) as any;
2268
2284
  // };
2269
2285
  extend(augmentation) {
2270
- return new ZodObject({
2286
+ return new _ZodObject({
2271
2287
  ...this._def,
2272
2288
  shape: () => ({
2273
2289
  ...this._def.shape(),
@@ -2281,7 +2297,7 @@ var ZodObject = class extends ZodType {
2281
2297
  * upgrade if you are experiencing issues.
2282
2298
  */
2283
2299
  merge(merging) {
2284
- const merged = new ZodObject({
2300
+ const merged = new _ZodObject({
2285
2301
  unknownKeys: merging._def.unknownKeys,
2286
2302
  catchall: merging._def.catchall,
2287
2303
  shape: () => ({
@@ -2352,7 +2368,7 @@ var ZodObject = class extends ZodType {
2352
2368
  // return merged;
2353
2369
  // }
2354
2370
  catchall(index) {
2355
- return new ZodObject({
2371
+ return new _ZodObject({
2356
2372
  ...this._def,
2357
2373
  catchall: index
2358
2374
  });
@@ -2364,7 +2380,7 @@ var ZodObject = class extends ZodType {
2364
2380
  shape[key] = this.shape[key];
2365
2381
  }
2366
2382
  });
2367
- return new ZodObject({
2383
+ return new _ZodObject({
2368
2384
  ...this._def,
2369
2385
  shape: () => shape
2370
2386
  });
@@ -2376,7 +2392,7 @@ var ZodObject = class extends ZodType {
2376
2392
  shape[key] = this.shape[key];
2377
2393
  }
2378
2394
  });
2379
- return new ZodObject({
2395
+ return new _ZodObject({
2380
2396
  ...this._def,
2381
2397
  shape: () => shape
2382
2398
  });
@@ -2397,7 +2413,7 @@ var ZodObject = class extends ZodType {
2397
2413
  newShape[key] = fieldSchema.optional();
2398
2414
  }
2399
2415
  });
2400
- return new ZodObject({
2416
+ return new _ZodObject({
2401
2417
  ...this._def,
2402
2418
  shape: () => newShape
2403
2419
  });
@@ -2416,7 +2432,7 @@ var ZodObject = class extends ZodType {
2416
2432
  newShape[key] = newField;
2417
2433
  }
2418
2434
  });
2419
- return new ZodObject({
2435
+ return new _ZodObject({
2420
2436
  ...this._def,
2421
2437
  shape: () => newShape
2422
2438
  });
@@ -2425,7 +2441,8 @@ var ZodObject = class extends ZodType {
2425
2441
  return createZodEnum(util.objectKeys(this.shape));
2426
2442
  }
2427
2443
  };
2428
- __name(ZodObject, "ZodObject");
2444
+ __name(_ZodObject, "ZodObject");
2445
+ var ZodObject = _ZodObject;
2429
2446
  ZodObject.create = (shape, params) => {
2430
2447
  return new ZodObject({
2431
2448
  shape: () => shape,
@@ -2453,7 +2470,7 @@ ZodObject.lazycreate = (shape, params) => {
2453
2470
  ...processCreateParams(params)
2454
2471
  });
2455
2472
  };
2456
- var ZodUnion = class extends ZodType {
2473
+ var _ZodUnion = class _ZodUnion extends ZodType {
2457
2474
  _parse(input) {
2458
2475
  const { ctx } = this._processInputParams(input);
2459
2476
  const options = this._def.options;
@@ -2538,7 +2555,8 @@ var ZodUnion = class extends ZodType {
2538
2555
  return this._def.options;
2539
2556
  }
2540
2557
  };
2541
- __name(ZodUnion, "ZodUnion");
2558
+ __name(_ZodUnion, "ZodUnion");
2559
+ var ZodUnion = _ZodUnion;
2542
2560
  ZodUnion.create = (types, params) => {
2543
2561
  return new ZodUnion({
2544
2562
  options: types,
@@ -2567,7 +2585,7 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
2567
2585
  return null;
2568
2586
  }
2569
2587
  }, "getDiscriminator");
2570
- var ZodDiscriminatedUnion = class extends ZodType {
2588
+ var _ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
2571
2589
  _parse(input) {
2572
2590
  const { ctx } = this._processInputParams(input);
2573
2591
  if (ctx.parsedType !== ZodParsedType.object) {
@@ -2634,7 +2652,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
2634
2652
  optionsMap.set(value, type);
2635
2653
  }
2636
2654
  }
2637
- return new ZodDiscriminatedUnion({
2655
+ return new _ZodDiscriminatedUnion({
2638
2656
  typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2639
2657
  discriminator,
2640
2658
  options,
@@ -2643,7 +2661,8 @@ var ZodDiscriminatedUnion = class extends ZodType {
2643
2661
  });
2644
2662
  }
2645
2663
  };
2646
- __name(ZodDiscriminatedUnion, "ZodDiscriminatedUnion");
2664
+ __name(_ZodDiscriminatedUnion, "ZodDiscriminatedUnion");
2665
+ var ZodDiscriminatedUnion = _ZodDiscriminatedUnion;
2647
2666
  function mergeValues(a, b) {
2648
2667
  const aType = getParsedType(a);
2649
2668
  const bType = getParsedType(b);
@@ -2683,7 +2702,7 @@ function mergeValues(a, b) {
2683
2702
  }
2684
2703
  }
2685
2704
  __name(mergeValues, "mergeValues");
2686
- var ZodIntersection = class extends ZodType {
2705
+ var _ZodIntersection = class _ZodIntersection extends ZodType {
2687
2706
  _parse(input) {
2688
2707
  const { status, ctx } = this._processInputParams(input);
2689
2708
  const handleParsed = /* @__PURE__ */ __name((parsedLeft, parsedRight) => {
@@ -2728,7 +2747,8 @@ var ZodIntersection = class extends ZodType {
2728
2747
  }
2729
2748
  }
2730
2749
  };
2731
- __name(ZodIntersection, "ZodIntersection");
2750
+ __name(_ZodIntersection, "ZodIntersection");
2751
+ var ZodIntersection = _ZodIntersection;
2732
2752
  ZodIntersection.create = (left, right, params) => {
2733
2753
  return new ZodIntersection({
2734
2754
  left,
@@ -2737,7 +2757,7 @@ ZodIntersection.create = (left, right, params) => {
2737
2757
  ...processCreateParams(params)
2738
2758
  });
2739
2759
  };
2740
- var ZodTuple = class extends ZodType {
2760
+ var _ZodTuple = class _ZodTuple extends ZodType {
2741
2761
  _parse(input) {
2742
2762
  const { status, ctx } = this._processInputParams(input);
2743
2763
  if (ctx.parsedType !== ZodParsedType.array) {
@@ -2787,13 +2807,14 @@ var ZodTuple = class extends ZodType {
2787
2807
  return this._def.items;
2788
2808
  }
2789
2809
  rest(rest) {
2790
- return new ZodTuple({
2810
+ return new _ZodTuple({
2791
2811
  ...this._def,
2792
2812
  rest
2793
2813
  });
2794
2814
  }
2795
2815
  };
2796
- __name(ZodTuple, "ZodTuple");
2816
+ __name(_ZodTuple, "ZodTuple");
2817
+ var ZodTuple = _ZodTuple;
2797
2818
  ZodTuple.create = (schemas, params) => {
2798
2819
  if (!Array.isArray(schemas)) {
2799
2820
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
@@ -2805,7 +2826,7 @@ ZodTuple.create = (schemas, params) => {
2805
2826
  ...processCreateParams(params)
2806
2827
  });
2807
2828
  };
2808
- var ZodRecord = class extends ZodType {
2829
+ var _ZodRecord = class _ZodRecord extends ZodType {
2809
2830
  get keySchema() {
2810
2831
  return this._def.keyType;
2811
2832
  }
@@ -2842,14 +2863,14 @@ var ZodRecord = class extends ZodType {
2842
2863
  }
2843
2864
  static create(first, second, third) {
2844
2865
  if (second instanceof ZodType) {
2845
- return new ZodRecord({
2866
+ return new _ZodRecord({
2846
2867
  keyType: first,
2847
2868
  valueType: second,
2848
2869
  typeName: ZodFirstPartyTypeKind.ZodRecord,
2849
2870
  ...processCreateParams(third)
2850
2871
  });
2851
2872
  }
2852
- return new ZodRecord({
2873
+ return new _ZodRecord({
2853
2874
  keyType: ZodString.create(),
2854
2875
  valueType: first,
2855
2876
  typeName: ZodFirstPartyTypeKind.ZodRecord,
@@ -2857,8 +2878,9 @@ var ZodRecord = class extends ZodType {
2857
2878
  });
2858
2879
  }
2859
2880
  };
2860
- __name(ZodRecord, "ZodRecord");
2861
- var ZodMap = class extends ZodType {
2881
+ __name(_ZodRecord, "ZodRecord");
2882
+ var ZodRecord = _ZodRecord;
2883
+ var _ZodMap = class _ZodMap extends ZodType {
2862
2884
  get keySchema() {
2863
2885
  return this._def.keyType;
2864
2886
  }
@@ -2916,7 +2938,8 @@ var ZodMap = class extends ZodType {
2916
2938
  }
2917
2939
  }
2918
2940
  };
2919
- __name(ZodMap, "ZodMap");
2941
+ __name(_ZodMap, "ZodMap");
2942
+ var ZodMap = _ZodMap;
2920
2943
  ZodMap.create = (keyType, valueType, params) => {
2921
2944
  return new ZodMap({
2922
2945
  valueType,
@@ -2925,7 +2948,7 @@ ZodMap.create = (keyType, valueType, params) => {
2925
2948
  ...processCreateParams(params)
2926
2949
  });
2927
2950
  };
2928
- var ZodSet = class extends ZodType {
2951
+ var _ZodSet = class _ZodSet extends ZodType {
2929
2952
  _parse(input) {
2930
2953
  const { status, ctx } = this._processInputParams(input);
2931
2954
  if (ctx.parsedType !== ZodParsedType.set) {
@@ -2984,13 +3007,13 @@ var ZodSet = class extends ZodType {
2984
3007
  }
2985
3008
  }
2986
3009
  min(minSize, message) {
2987
- return new ZodSet({
3010
+ return new _ZodSet({
2988
3011
  ...this._def,
2989
3012
  minSize: { value: minSize, message: errorUtil.toString(message) }
2990
3013
  });
2991
3014
  }
2992
3015
  max(maxSize, message) {
2993
- return new ZodSet({
3016
+ return new _ZodSet({
2994
3017
  ...this._def,
2995
3018
  maxSize: { value: maxSize, message: errorUtil.toString(message) }
2996
3019
  });
@@ -3002,7 +3025,8 @@ var ZodSet = class extends ZodType {
3002
3025
  return this.min(1, message);
3003
3026
  }
3004
3027
  };
3005
- __name(ZodSet, "ZodSet");
3028
+ __name(_ZodSet, "ZodSet");
3029
+ var ZodSet = _ZodSet;
3006
3030
  ZodSet.create = (valueType, params) => {
3007
3031
  return new ZodSet({
3008
3032
  valueType,
@@ -3012,7 +3036,7 @@ ZodSet.create = (valueType, params) => {
3012
3036
  ...processCreateParams(params)
3013
3037
  });
3014
3038
  };
3015
- var ZodFunction = class extends ZodType {
3039
+ var _ZodFunction = class _ZodFunction extends ZodType {
3016
3040
  constructor() {
3017
3041
  super(...arguments);
3018
3042
  this.validate = this.implement;
@@ -3101,13 +3125,13 @@ var ZodFunction = class extends ZodType {
3101
3125
  return this._def.returns;
3102
3126
  }
3103
3127
  args(...items) {
3104
- return new ZodFunction({
3128
+ return new _ZodFunction({
3105
3129
  ...this._def,
3106
3130
  args: ZodTuple.create(items).rest(ZodUnknown.create())
3107
3131
  });
3108
3132
  }
3109
3133
  returns(returnType) {
3110
- return new ZodFunction({
3134
+ return new _ZodFunction({
3111
3135
  ...this._def,
3112
3136
  returns: returnType
3113
3137
  });
@@ -3121,7 +3145,7 @@ var ZodFunction = class extends ZodType {
3121
3145
  return validatedFunc;
3122
3146
  }
3123
3147
  static create(args, returns, params) {
3124
- return new ZodFunction({
3148
+ return new _ZodFunction({
3125
3149
  args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
3126
3150
  returns: returns || ZodUnknown.create(),
3127
3151
  typeName: ZodFirstPartyTypeKind.ZodFunction,
@@ -3129,8 +3153,9 @@ var ZodFunction = class extends ZodType {
3129
3153
  });
3130
3154
  }
3131
3155
  };
3132
- __name(ZodFunction, "ZodFunction");
3133
- var ZodLazy = class extends ZodType {
3156
+ __name(_ZodFunction, "ZodFunction");
3157
+ var ZodFunction = _ZodFunction;
3158
+ var _ZodLazy = class _ZodLazy extends ZodType {
3134
3159
  get schema() {
3135
3160
  return this._def.getter();
3136
3161
  }
@@ -3140,7 +3165,8 @@ var ZodLazy = class extends ZodType {
3140
3165
  return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3141
3166
  }
3142
3167
  };
3143
- __name(ZodLazy, "ZodLazy");
3168
+ __name(_ZodLazy, "ZodLazy");
3169
+ var ZodLazy = _ZodLazy;
3144
3170
  ZodLazy.create = (getter, params) => {
3145
3171
  return new ZodLazy({
3146
3172
  getter,
@@ -3148,7 +3174,7 @@ ZodLazy.create = (getter, params) => {
3148
3174
  ...processCreateParams(params)
3149
3175
  });
3150
3176
  };
3151
- var ZodLiteral = class extends ZodType {
3177
+ var _ZodLiteral = class _ZodLiteral extends ZodType {
3152
3178
  _parse(input) {
3153
3179
  if (input.data !== this._def.value) {
3154
3180
  const ctx = this._getOrReturnCtx(input);
@@ -3165,7 +3191,8 @@ var ZodLiteral = class extends ZodType {
3165
3191
  return this._def.value;
3166
3192
  }
3167
3193
  };
3168
- __name(ZodLiteral, "ZodLiteral");
3194
+ __name(_ZodLiteral, "ZodLiteral");
3195
+ var ZodLiteral = _ZodLiteral;
3169
3196
  ZodLiteral.create = (value, params) => {
3170
3197
  return new ZodLiteral({
3171
3198
  value,
@@ -3181,7 +3208,7 @@ function createZodEnum(values, params) {
3181
3208
  });
3182
3209
  }
3183
3210
  __name(createZodEnum, "createZodEnum");
3184
- var ZodEnum = class extends ZodType {
3211
+ var _ZodEnum = class _ZodEnum extends ZodType {
3185
3212
  _parse(input) {
3186
3213
  if (typeof input.data !== "string") {
3187
3214
  const ctx = this._getOrReturnCtx(input);
@@ -3230,15 +3257,16 @@ var ZodEnum = class extends ZodType {
3230
3257
  return enumValues;
3231
3258
  }
3232
3259
  extract(values) {
3233
- return ZodEnum.create(values);
3260
+ return _ZodEnum.create(values);
3234
3261
  }
3235
3262
  exclude(values) {
3236
- return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
3263
+ return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
3237
3264
  }
3238
3265
  };
3239
- __name(ZodEnum, "ZodEnum");
3266
+ __name(_ZodEnum, "ZodEnum");
3267
+ var ZodEnum = _ZodEnum;
3240
3268
  ZodEnum.create = createZodEnum;
3241
- var ZodNativeEnum = class extends ZodType {
3269
+ var _ZodNativeEnum = class _ZodNativeEnum extends ZodType {
3242
3270
  _parse(input) {
3243
3271
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
3244
3272
  const ctx = this._getOrReturnCtx(input);
@@ -3266,7 +3294,8 @@ var ZodNativeEnum = class extends ZodType {
3266
3294
  return this._def.values;
3267
3295
  }
3268
3296
  };
3269
- __name(ZodNativeEnum, "ZodNativeEnum");
3297
+ __name(_ZodNativeEnum, "ZodNativeEnum");
3298
+ var ZodNativeEnum = _ZodNativeEnum;
3270
3299
  ZodNativeEnum.create = (values, params) => {
3271
3300
  return new ZodNativeEnum({
3272
3301
  values,
@@ -3274,7 +3303,7 @@ ZodNativeEnum.create = (values, params) => {
3274
3303
  ...processCreateParams(params)
3275
3304
  });
3276
3305
  };
3277
- var ZodPromise = class extends ZodType {
3306
+ var _ZodPromise = class _ZodPromise extends ZodType {
3278
3307
  unwrap() {
3279
3308
  return this._def.type;
3280
3309
  }
@@ -3297,7 +3326,8 @@ var ZodPromise = class extends ZodType {
3297
3326
  }));
3298
3327
  }
3299
3328
  };
3300
- __name(ZodPromise, "ZodPromise");
3329
+ __name(_ZodPromise, "ZodPromise");
3330
+ var ZodPromise = _ZodPromise;
3301
3331
  ZodPromise.create = (schema, params) => {
3302
3332
  return new ZodPromise({
3303
3333
  type: schema,
@@ -3305,7 +3335,7 @@ ZodPromise.create = (schema, params) => {
3305
3335
  ...processCreateParams(params)
3306
3336
  });
3307
3337
  };
3308
- var ZodEffects = class extends ZodType {
3338
+ var _ZodEffects = class _ZodEffects extends ZodType {
3309
3339
  innerType() {
3310
3340
  return this._def.schema;
3311
3341
  }
@@ -3413,7 +3443,8 @@ var ZodEffects = class extends ZodType {
3413
3443
  util.assertNever(effect);
3414
3444
  }
3415
3445
  };
3416
- __name(ZodEffects, "ZodEffects");
3446
+ __name(_ZodEffects, "ZodEffects");
3447
+ var ZodEffects = _ZodEffects;
3417
3448
  ZodEffects.create = (schema, effect, params) => {
3418
3449
  return new ZodEffects({
3419
3450
  schema,
@@ -3430,7 +3461,7 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3430
3461
  ...processCreateParams(params)
3431
3462
  });
3432
3463
  };
3433
- var ZodOptional = class extends ZodType {
3464
+ var _ZodOptional = class _ZodOptional extends ZodType {
3434
3465
  _parse(input) {
3435
3466
  const parsedType = this._getType(input);
3436
3467
  if (parsedType === ZodParsedType.undefined) {
@@ -3442,7 +3473,8 @@ var ZodOptional = class extends ZodType {
3442
3473
  return this._def.innerType;
3443
3474
  }
3444
3475
  };
3445
- __name(ZodOptional, "ZodOptional");
3476
+ __name(_ZodOptional, "ZodOptional");
3477
+ var ZodOptional = _ZodOptional;
3446
3478
  ZodOptional.create = (type, params) => {
3447
3479
  return new ZodOptional({
3448
3480
  innerType: type,
@@ -3450,7 +3482,7 @@ ZodOptional.create = (type, params) => {
3450
3482
  ...processCreateParams(params)
3451
3483
  });
3452
3484
  };
3453
- var ZodNullable = class extends ZodType {
3485
+ var _ZodNullable = class _ZodNullable extends ZodType {
3454
3486
  _parse(input) {
3455
3487
  const parsedType = this._getType(input);
3456
3488
  if (parsedType === ZodParsedType.null) {
@@ -3462,7 +3494,8 @@ var ZodNullable = class extends ZodType {
3462
3494
  return this._def.innerType;
3463
3495
  }
3464
3496
  };
3465
- __name(ZodNullable, "ZodNullable");
3497
+ __name(_ZodNullable, "ZodNullable");
3498
+ var ZodNullable = _ZodNullable;
3466
3499
  ZodNullable.create = (type, params) => {
3467
3500
  return new ZodNullable({
3468
3501
  innerType: type,
@@ -3470,7 +3503,7 @@ ZodNullable.create = (type, params) => {
3470
3503
  ...processCreateParams(params)
3471
3504
  });
3472
3505
  };
3473
- var ZodDefault = class extends ZodType {
3506
+ var _ZodDefault = class _ZodDefault extends ZodType {
3474
3507
  _parse(input) {
3475
3508
  const { ctx } = this._processInputParams(input);
3476
3509
  let data = ctx.data;
@@ -3487,7 +3520,8 @@ var ZodDefault = class extends ZodType {
3487
3520
  return this._def.innerType;
3488
3521
  }
3489
3522
  };
3490
- __name(ZodDefault, "ZodDefault");
3523
+ __name(_ZodDefault, "ZodDefault");
3524
+ var ZodDefault = _ZodDefault;
3491
3525
  ZodDefault.create = (type, params) => {
3492
3526
  return new ZodDefault({
3493
3527
  innerType: type,
@@ -3496,7 +3530,7 @@ ZodDefault.create = (type, params) => {
3496
3530
  ...processCreateParams(params)
3497
3531
  });
3498
3532
  };
3499
- var ZodCatch = class extends ZodType {
3533
+ var _ZodCatch = class _ZodCatch extends ZodType {
3500
3534
  _parse(input) {
3501
3535
  const { ctx } = this._processInputParams(input);
3502
3536
  const newCtx = {
@@ -3541,7 +3575,8 @@ var ZodCatch = class extends ZodType {
3541
3575
  return this._def.innerType;
3542
3576
  }
3543
3577
  };
3544
- __name(ZodCatch, "ZodCatch");
3578
+ __name(_ZodCatch, "ZodCatch");
3579
+ var ZodCatch = _ZodCatch;
3545
3580
  ZodCatch.create = (type, params) => {
3546
3581
  return new ZodCatch({
3547
3582
  innerType: type,
@@ -3550,7 +3585,7 @@ ZodCatch.create = (type, params) => {
3550
3585
  ...processCreateParams(params)
3551
3586
  });
3552
3587
  };
3553
- var ZodNaN = class extends ZodType {
3588
+ var _ZodNaN = class _ZodNaN extends ZodType {
3554
3589
  _parse(input) {
3555
3590
  const parsedType = this._getType(input);
3556
3591
  if (parsedType !== ZodParsedType.nan) {
@@ -3565,7 +3600,8 @@ var ZodNaN = class extends ZodType {
3565
3600
  return { status: "valid", value: input.data };
3566
3601
  }
3567
3602
  };
3568
- __name(ZodNaN, "ZodNaN");
3603
+ __name(_ZodNaN, "ZodNaN");
3604
+ var ZodNaN = _ZodNaN;
3569
3605
  ZodNaN.create = (params) => {
3570
3606
  return new ZodNaN({
3571
3607
  typeName: ZodFirstPartyTypeKind.ZodNaN,
@@ -3573,7 +3609,7 @@ ZodNaN.create = (params) => {
3573
3609
  });
3574
3610
  };
3575
3611
  var BRAND = Symbol("zod_brand");
3576
- var ZodBranded = class extends ZodType {
3612
+ var _ZodBranded = class _ZodBranded extends ZodType {
3577
3613
  _parse(input) {
3578
3614
  const { ctx } = this._processInputParams(input);
3579
3615
  const data = ctx.data;
@@ -3587,8 +3623,9 @@ var ZodBranded = class extends ZodType {
3587
3623
  return this._def.type;
3588
3624
  }
3589
3625
  };
3590
- __name(ZodBranded, "ZodBranded");
3591
- var ZodPipeline = class extends ZodType {
3626
+ __name(_ZodBranded, "ZodBranded");
3627
+ var ZodBranded = _ZodBranded;
3628
+ var _ZodPipeline = class _ZodPipeline extends ZodType {
3592
3629
  _parse(input) {
3593
3630
  const { status, ctx } = this._processInputParams(input);
3594
3631
  if (ctx.common.async) {
@@ -3636,15 +3673,16 @@ var ZodPipeline = class extends ZodType {
3636
3673
  }
3637
3674
  }
3638
3675
  static create(a, b) {
3639
- return new ZodPipeline({
3676
+ return new _ZodPipeline({
3640
3677
  in: a,
3641
3678
  out: b,
3642
3679
  typeName: ZodFirstPartyTypeKind.ZodPipeline
3643
3680
  });
3644
3681
  }
3645
3682
  };
3646
- __name(ZodPipeline, "ZodPipeline");
3647
- var ZodReadonly = class extends ZodType {
3683
+ __name(_ZodPipeline, "ZodPipeline");
3684
+ var ZodPipeline = _ZodPipeline;
3685
+ var _ZodReadonly = class _ZodReadonly extends ZodType {
3648
3686
  _parse(input) {
3649
3687
  const result = this._def.innerType._parse(input);
3650
3688
  if (isValid(result)) {
@@ -3653,7 +3691,8 @@ var ZodReadonly = class extends ZodType {
3653
3691
  return result;
3654
3692
  }
3655
3693
  };
3656
- __name(ZodReadonly, "ZodReadonly");
3694
+ __name(_ZodReadonly, "ZodReadonly");
3695
+ var ZodReadonly = _ZodReadonly;
3657
3696
  ZodReadonly.create = (type, params) => {
3658
3697
  return new ZodReadonly({
3659
3698
  innerType: type,
@@ -3664,10 +3703,10 @@ ZodReadonly.create = (type, params) => {
3664
3703
  var custom = /* @__PURE__ */ __name((check, params = {}, fatal) => {
3665
3704
  if (check)
3666
3705
  return ZodAny.create().superRefine((data, ctx) => {
3667
- var _a, _b;
3706
+ var _a41, _b;
3668
3707
  if (!check(data)) {
3669
3708
  const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3670
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3709
+ const _fatal = (_b = (_a41 = p.fatal) !== null && _a41 !== void 0 ? _a41 : fatal) !== null && _b !== void 0 ? _b : true;
3671
3710
  const p2 = typeof p === "string" ? { message: p } : p;
3672
3711
  ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3673
3712
  }
@@ -3883,14 +3922,14 @@ var z = /* @__PURE__ */ Object.freeze({
3883
3922
  ZodError
3884
3923
  });
3885
3924
 
3886
- // ../core/dist/chunk-DFHEFTJZ.js
3925
+ // ../core/dist/chunk-VLQXSCFN.js
3887
3926
  var __defProp = Object.defineProperty;
3888
3927
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp(target, "name", {
3889
3928
  value,
3890
3929
  configurable: true
3891
3930
  }), "__name");
3892
3931
 
3893
- // ../core/dist/chunk-EK2ZQYRJ.js
3932
+ // ../core/dist/chunk-KQBRKKMR.js
3894
3933
  var util2;
3895
3934
  (function(util22) {
3896
3935
  util22.assertEqual = (val) => val;
@@ -4049,7 +4088,8 @@ var quotelessJson2 = /* @__PURE__ */ __name2((obj) => {
4049
4088
  const json = JSON.stringify(obj, null, 2);
4050
4089
  return json.replace(/"([^"]+)":/g, "$1:");
4051
4090
  }, "quotelessJson");
4052
- var ZodError2 = /* @__PURE__ */ __name(class extends Error {
4091
+ var _a;
4092
+ var _ZodError2 = (_a = class extends Error {
4053
4093
  constructor(issues) {
4054
4094
  super();
4055
4095
  this.issues = [];
@@ -4147,8 +4187,9 @@ var ZodError2 = /* @__PURE__ */ __name(class extends Error {
4147
4187
  get formErrors() {
4148
4188
  return this.flatten();
4149
4189
  }
4150
- }, "ZodError");
4151
- __name2(ZodError2, "ZodError");
4190
+ }, __name(_a, "_ZodError"), _a);
4191
+ __name2(_ZodError2, "ZodError");
4192
+ var ZodError2 = _ZodError2;
4152
4193
  ZodError2.create = (issues) => {
4153
4194
  const error = new ZodError2(issues);
4154
4195
  return error;
@@ -4305,7 +4346,8 @@ function addIssueToContext2(ctx, issueData) {
4305
4346
  }
4306
4347
  __name(addIssueToContext2, "addIssueToContext");
4307
4348
  __name2(addIssueToContext2, "addIssueToContext");
4308
- var ParseStatus2 = /* @__PURE__ */ __name(class {
4349
+ var _a2;
4350
+ var _ParseStatus2 = (_a2 = class {
4309
4351
  constructor() {
4310
4352
  this.value = "valid";
4311
4353
  }
@@ -4339,7 +4381,7 @@ var ParseStatus2 = /* @__PURE__ */ __name(class {
4339
4381
  value: await pair.value
4340
4382
  });
4341
4383
  }
4342
- return ParseStatus2.mergeObjectSync(status, syncPairs);
4384
+ return _a2.mergeObjectSync(status, syncPairs);
4343
4385
  }
4344
4386
  static mergeObjectSync(status, pairs) {
4345
4387
  const finalObject = {};
@@ -4362,8 +4404,9 @@ var ParseStatus2 = /* @__PURE__ */ __name(class {
4362
4404
  value: finalObject
4363
4405
  };
4364
4406
  }
4365
- }, "ParseStatus");
4366
- __name2(ParseStatus2, "ParseStatus");
4407
+ }, __name(_a2, "_ParseStatus"), _a2);
4408
+ __name2(_ParseStatus2, "ParseStatus");
4409
+ var ParseStatus2 = _ParseStatus2;
4367
4410
  var INVALID2 = Object.freeze({
4368
4411
  status: "aborted"
4369
4412
  });
@@ -4386,7 +4429,8 @@ var errorUtil2;
4386
4429
  } : message || {};
4387
4430
  errorUtil22.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
4388
4431
  })(errorUtil2 || (errorUtil2 = {}));
4389
- var ParseInputLazyPath2 = /* @__PURE__ */ __name(class {
4432
+ var _a3;
4433
+ var _ParseInputLazyPath2 = (_a3 = class {
4390
4434
  constructor(parent, value, path, key) {
4391
4435
  this._cachedPath = [];
4392
4436
  this.parent = parent;
@@ -4404,8 +4448,9 @@ var ParseInputLazyPath2 = /* @__PURE__ */ __name(class {
4404
4448
  }
4405
4449
  return this._cachedPath;
4406
4450
  }
4407
- }, "ParseInputLazyPath");
4408
- __name2(ParseInputLazyPath2, "ParseInputLazyPath");
4451
+ }, __name(_a3, "_ParseInputLazyPath"), _a3);
4452
+ __name2(_ParseInputLazyPath2, "ParseInputLazyPath");
4453
+ var ParseInputLazyPath2 = _ParseInputLazyPath2;
4409
4454
  var handleResult2 = /* @__PURE__ */ __name2((ctx, result) => {
4410
4455
  if (isValid2(result)) {
4411
4456
  return {
@@ -4461,7 +4506,8 @@ function processCreateParams2(params) {
4461
4506
  }
4462
4507
  __name(processCreateParams2, "processCreateParams");
4463
4508
  __name2(processCreateParams2, "processCreateParams");
4464
- var ZodType2 = /* @__PURE__ */ __name(class {
4509
+ var _a4;
4510
+ var _ZodType2 = (_a4 = class {
4465
4511
  constructor(def) {
4466
4512
  this.spa = this.safeParseAsync;
4467
4513
  this._def = def;
@@ -4537,11 +4583,11 @@ var ZodType2 = /* @__PURE__ */ __name(class {
4537
4583
  throw result.error;
4538
4584
  }
4539
4585
  safeParse(data, params) {
4540
- var _a;
4586
+ var _a41;
4541
4587
  const ctx = {
4542
4588
  common: {
4543
4589
  issues: [],
4544
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
4590
+ async: (_a41 = params === null || params === void 0 ? void 0 : params.async) !== null && _a41 !== void 0 ? _a41 : false,
4545
4591
  contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
4546
4592
  },
4547
4593
  path: (params === null || params === void 0 ? void 0 : params.path) || [],
@@ -4722,8 +4768,9 @@ var ZodType2 = /* @__PURE__ */ __name(class {
4722
4768
  isNullable() {
4723
4769
  return this.safeParse(null).success;
4724
4770
  }
4725
- }, "ZodType");
4726
- __name2(ZodType2, "ZodType");
4771
+ }, __name(_a4, "_ZodType"), _a4);
4772
+ __name2(_ZodType2, "ZodType");
4773
+ var ZodType2 = _ZodType2;
4727
4774
  var cuidRegex2 = /^c[^\s-]{8,}$/i;
4728
4775
  var cuid2Regex2 = /^[a-z][a-z0-9]*$/;
4729
4776
  var ulidRegex2 = /^[0-9A-HJKMNP-TV-Z]{26}$/;
@@ -4765,7 +4812,8 @@ function isValidIP2(ip, version) {
4765
4812
  }
4766
4813
  __name(isValidIP2, "isValidIP");
4767
4814
  __name2(isValidIP2, "isValidIP");
4768
- var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
4815
+ var _a5;
4816
+ var _ZodString2 = (_a5 = class extends ZodType2 {
4769
4817
  _parse(input) {
4770
4818
  if (this._def.coerce) {
4771
4819
  input.data = String(input.data);
@@ -4901,7 +4949,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
4901
4949
  } else if (check.kind === "url") {
4902
4950
  try {
4903
4951
  new URL(input.data);
4904
- } catch (_a) {
4952
+ } catch (_a41) {
4905
4953
  ctx = this._getOrReturnCtx(input, ctx);
4906
4954
  addIssueToContext2(ctx, {
4907
4955
  validation: "url",
@@ -5003,7 +5051,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
5003
5051
  });
5004
5052
  }
5005
5053
  _addCheck(check) {
5006
- return new ZodString2({
5054
+ return new _a5({
5007
5055
  ...this._def,
5008
5056
  checks: [
5009
5057
  ...this._def.checks,
@@ -5060,7 +5108,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
5060
5108
  });
5061
5109
  }
5062
5110
  datetime(options) {
5063
- var _a;
5111
+ var _a41;
5064
5112
  if (typeof options === "string") {
5065
5113
  return this._addCheck({
5066
5114
  kind: "datetime",
@@ -5072,7 +5120,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
5072
5120
  return this._addCheck({
5073
5121
  kind: "datetime",
5074
5122
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
5075
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
5123
+ offset: (_a41 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a41 !== void 0 ? _a41 : false,
5076
5124
  ...errorUtil2.errToObj(options === null || options === void 0 ? void 0 : options.message)
5077
5125
  });
5078
5126
  }
@@ -5134,7 +5182,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
5134
5182
  return this.min(1, errorUtil2.errToObj(message));
5135
5183
  }
5136
5184
  trim() {
5137
- return new ZodString2({
5185
+ return new _a5({
5138
5186
  ...this._def,
5139
5187
  checks: [
5140
5188
  ...this._def.checks,
@@ -5145,7 +5193,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
5145
5193
  });
5146
5194
  }
5147
5195
  toLowerCase() {
5148
- return new ZodString2({
5196
+ return new _a5({
5149
5197
  ...this._def,
5150
5198
  checks: [
5151
5199
  ...this._def.checks,
@@ -5156,7 +5204,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
5156
5204
  });
5157
5205
  }
5158
5206
  toUpperCase() {
5159
- return new ZodString2({
5207
+ return new _a5({
5160
5208
  ...this._def,
5161
5209
  checks: [
5162
5210
  ...this._def.checks,
@@ -5213,14 +5261,15 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
5213
5261
  }
5214
5262
  return max;
5215
5263
  }
5216
- }, "ZodString");
5217
- __name2(ZodString2, "ZodString");
5264
+ }, __name(_a5, "_ZodString"), _a5);
5265
+ __name2(_ZodString2, "ZodString");
5266
+ var ZodString2 = _ZodString2;
5218
5267
  ZodString2.create = (params) => {
5219
- var _a;
5268
+ var _a41;
5220
5269
  return new ZodString2({
5221
5270
  checks: [],
5222
5271
  typeName: ZodFirstPartyTypeKind2.ZodString,
5223
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
5272
+ coerce: (_a41 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a41 !== void 0 ? _a41 : false,
5224
5273
  ...processCreateParams2(params)
5225
5274
  });
5226
5275
  };
@@ -5234,7 +5283,8 @@ function floatSafeRemainder2(val, step) {
5234
5283
  }
5235
5284
  __name(floatSafeRemainder2, "floatSafeRemainder");
5236
5285
  __name2(floatSafeRemainder2, "floatSafeRemainder");
5237
- var ZodNumber2 = /* @__PURE__ */ __name(class extends ZodType2 {
5286
+ var _a6;
5287
+ var _ZodNumber2 = (_a6 = class extends ZodType2 {
5238
5288
  constructor() {
5239
5289
  super(...arguments);
5240
5290
  this.min = this.gte;
@@ -5338,7 +5388,7 @@ var ZodNumber2 = /* @__PURE__ */ __name(class extends ZodType2 {
5338
5388
  return this.setLimit("max", value, false, errorUtil2.toString(message));
5339
5389
  }
5340
5390
  setLimit(kind, value, inclusive, message) {
5341
- return new ZodNumber2({
5391
+ return new _a6({
5342
5392
  ...this._def,
5343
5393
  checks: [
5344
5394
  ...this._def.checks,
@@ -5352,7 +5402,7 @@ var ZodNumber2 = /* @__PURE__ */ __name(class extends ZodType2 {
5352
5402
  });
5353
5403
  }
5354
5404
  _addCheck(check) {
5355
- return new ZodNumber2({
5405
+ return new _a6({
5356
5406
  ...this._def,
5357
5407
  checks: [
5358
5408
  ...this._def.checks,
@@ -5462,8 +5512,9 @@ var ZodNumber2 = /* @__PURE__ */ __name(class extends ZodType2 {
5462
5512
  }
5463
5513
  return Number.isFinite(min) && Number.isFinite(max);
5464
5514
  }
5465
- }, "ZodNumber");
5466
- __name2(ZodNumber2, "ZodNumber");
5515
+ }, __name(_a6, "_ZodNumber"), _a6);
5516
+ __name2(_ZodNumber2, "ZodNumber");
5517
+ var ZodNumber2 = _ZodNumber2;
5467
5518
  ZodNumber2.create = (params) => {
5468
5519
  return new ZodNumber2({
5469
5520
  checks: [],
@@ -5472,7 +5523,8 @@ ZodNumber2.create = (params) => {
5472
5523
  ...processCreateParams2(params)
5473
5524
  });
5474
5525
  };
5475
- var ZodBigInt2 = /* @__PURE__ */ __name(class extends ZodType2 {
5526
+ var _a7;
5527
+ var _ZodBigInt2 = (_a7 = class extends ZodType2 {
5476
5528
  constructor() {
5477
5529
  super(...arguments);
5478
5530
  this.min = this.gte;
@@ -5553,7 +5605,7 @@ var ZodBigInt2 = /* @__PURE__ */ __name(class extends ZodType2 {
5553
5605
  return this.setLimit("max", value, false, errorUtil2.toString(message));
5554
5606
  }
5555
5607
  setLimit(kind, value, inclusive, message) {
5556
- return new ZodBigInt2({
5608
+ return new _a7({
5557
5609
  ...this._def,
5558
5610
  checks: [
5559
5611
  ...this._def.checks,
@@ -5567,7 +5619,7 @@ var ZodBigInt2 = /* @__PURE__ */ __name(class extends ZodType2 {
5567
5619
  });
5568
5620
  }
5569
5621
  _addCheck(check) {
5570
- return new ZodBigInt2({
5622
+ return new _a7({
5571
5623
  ...this._def,
5572
5624
  checks: [
5573
5625
  ...this._def.checks,
@@ -5634,18 +5686,20 @@ var ZodBigInt2 = /* @__PURE__ */ __name(class extends ZodType2 {
5634
5686
  }
5635
5687
  return max;
5636
5688
  }
5637
- }, "ZodBigInt");
5638
- __name2(ZodBigInt2, "ZodBigInt");
5689
+ }, __name(_a7, "_ZodBigInt"), _a7);
5690
+ __name2(_ZodBigInt2, "ZodBigInt");
5691
+ var ZodBigInt2 = _ZodBigInt2;
5639
5692
  ZodBigInt2.create = (params) => {
5640
- var _a;
5693
+ var _a41;
5641
5694
  return new ZodBigInt2({
5642
5695
  checks: [],
5643
5696
  typeName: ZodFirstPartyTypeKind2.ZodBigInt,
5644
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
5697
+ coerce: (_a41 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a41 !== void 0 ? _a41 : false,
5645
5698
  ...processCreateParams2(params)
5646
5699
  });
5647
5700
  };
5648
- var ZodBoolean2 = /* @__PURE__ */ __name(class extends ZodType2 {
5701
+ var _a8;
5702
+ var _ZodBoolean2 = (_a8 = class extends ZodType2 {
5649
5703
  _parse(input) {
5650
5704
  if (this._def.coerce) {
5651
5705
  input.data = Boolean(input.data);
@@ -5662,8 +5716,9 @@ var ZodBoolean2 = /* @__PURE__ */ __name(class extends ZodType2 {
5662
5716
  }
5663
5717
  return OK2(input.data);
5664
5718
  }
5665
- }, "ZodBoolean");
5666
- __name2(ZodBoolean2, "ZodBoolean");
5719
+ }, __name(_a8, "_ZodBoolean"), _a8);
5720
+ __name2(_ZodBoolean2, "ZodBoolean");
5721
+ var ZodBoolean2 = _ZodBoolean2;
5667
5722
  ZodBoolean2.create = (params) => {
5668
5723
  return new ZodBoolean2({
5669
5724
  typeName: ZodFirstPartyTypeKind2.ZodBoolean,
@@ -5671,7 +5726,8 @@ ZodBoolean2.create = (params) => {
5671
5726
  ...processCreateParams2(params)
5672
5727
  });
5673
5728
  };
5674
- var ZodDate2 = /* @__PURE__ */ __name(class extends ZodType2 {
5729
+ var _a9;
5730
+ var _ZodDate2 = (_a9 = class extends ZodType2 {
5675
5731
  _parse(input) {
5676
5732
  if (this._def.coerce) {
5677
5733
  input.data = new Date(input.data);
@@ -5732,7 +5788,7 @@ var ZodDate2 = /* @__PURE__ */ __name(class extends ZodType2 {
5732
5788
  };
5733
5789
  }
5734
5790
  _addCheck(check) {
5735
- return new ZodDate2({
5791
+ return new _a9({
5736
5792
  ...this._def,
5737
5793
  checks: [
5738
5794
  ...this._def.checks,
@@ -5774,8 +5830,9 @@ var ZodDate2 = /* @__PURE__ */ __name(class extends ZodType2 {
5774
5830
  }
5775
5831
  return max != null ? new Date(max) : null;
5776
5832
  }
5777
- }, "ZodDate");
5778
- __name2(ZodDate2, "ZodDate");
5833
+ }, __name(_a9, "_ZodDate"), _a9);
5834
+ __name2(_ZodDate2, "ZodDate");
5835
+ var ZodDate2 = _ZodDate2;
5779
5836
  ZodDate2.create = (params) => {
5780
5837
  return new ZodDate2({
5781
5838
  checks: [],
@@ -5784,7 +5841,8 @@ ZodDate2.create = (params) => {
5784
5841
  ...processCreateParams2(params)
5785
5842
  });
5786
5843
  };
5787
- var ZodSymbol2 = /* @__PURE__ */ __name(class extends ZodType2 {
5844
+ var _a10;
5845
+ var _ZodSymbol2 = (_a10 = class extends ZodType2 {
5788
5846
  _parse(input) {
5789
5847
  const parsedType = this._getType(input);
5790
5848
  if (parsedType !== ZodParsedType2.symbol) {
@@ -5798,15 +5856,17 @@ var ZodSymbol2 = /* @__PURE__ */ __name(class extends ZodType2 {
5798
5856
  }
5799
5857
  return OK2(input.data);
5800
5858
  }
5801
- }, "ZodSymbol");
5802
- __name2(ZodSymbol2, "ZodSymbol");
5859
+ }, __name(_a10, "_ZodSymbol"), _a10);
5860
+ __name2(_ZodSymbol2, "ZodSymbol");
5861
+ var ZodSymbol2 = _ZodSymbol2;
5803
5862
  ZodSymbol2.create = (params) => {
5804
5863
  return new ZodSymbol2({
5805
5864
  typeName: ZodFirstPartyTypeKind2.ZodSymbol,
5806
5865
  ...processCreateParams2(params)
5807
5866
  });
5808
5867
  };
5809
- var ZodUndefined2 = /* @__PURE__ */ __name(class extends ZodType2 {
5868
+ var _a11;
5869
+ var _ZodUndefined2 = (_a11 = class extends ZodType2 {
5810
5870
  _parse(input) {
5811
5871
  const parsedType = this._getType(input);
5812
5872
  if (parsedType !== ZodParsedType2.undefined) {
@@ -5820,15 +5880,17 @@ var ZodUndefined2 = /* @__PURE__ */ __name(class extends ZodType2 {
5820
5880
  }
5821
5881
  return OK2(input.data);
5822
5882
  }
5823
- }, "ZodUndefined");
5824
- __name2(ZodUndefined2, "ZodUndefined");
5883
+ }, __name(_a11, "_ZodUndefined"), _a11);
5884
+ __name2(_ZodUndefined2, "ZodUndefined");
5885
+ var ZodUndefined2 = _ZodUndefined2;
5825
5886
  ZodUndefined2.create = (params) => {
5826
5887
  return new ZodUndefined2({
5827
5888
  typeName: ZodFirstPartyTypeKind2.ZodUndefined,
5828
5889
  ...processCreateParams2(params)
5829
5890
  });
5830
5891
  };
5831
- var ZodNull2 = /* @__PURE__ */ __name(class extends ZodType2 {
5892
+ var _a12;
5893
+ var _ZodNull2 = (_a12 = class extends ZodType2 {
5832
5894
  _parse(input) {
5833
5895
  const parsedType = this._getType(input);
5834
5896
  if (parsedType !== ZodParsedType2.null) {
@@ -5842,15 +5904,17 @@ var ZodNull2 = /* @__PURE__ */ __name(class extends ZodType2 {
5842
5904
  }
5843
5905
  return OK2(input.data);
5844
5906
  }
5845
- }, "ZodNull");
5846
- __name2(ZodNull2, "ZodNull");
5907
+ }, __name(_a12, "_ZodNull"), _a12);
5908
+ __name2(_ZodNull2, "ZodNull");
5909
+ var ZodNull2 = _ZodNull2;
5847
5910
  ZodNull2.create = (params) => {
5848
5911
  return new ZodNull2({
5849
5912
  typeName: ZodFirstPartyTypeKind2.ZodNull,
5850
5913
  ...processCreateParams2(params)
5851
5914
  });
5852
5915
  };
5853
- var ZodAny2 = /* @__PURE__ */ __name(class extends ZodType2 {
5916
+ var _a13;
5917
+ var _ZodAny2 = (_a13 = class extends ZodType2 {
5854
5918
  constructor() {
5855
5919
  super(...arguments);
5856
5920
  this._any = true;
@@ -5858,15 +5922,17 @@ var ZodAny2 = /* @__PURE__ */ __name(class extends ZodType2 {
5858
5922
  _parse(input) {
5859
5923
  return OK2(input.data);
5860
5924
  }
5861
- }, "ZodAny");
5862
- __name2(ZodAny2, "ZodAny");
5925
+ }, __name(_a13, "_ZodAny"), _a13);
5926
+ __name2(_ZodAny2, "ZodAny");
5927
+ var ZodAny2 = _ZodAny2;
5863
5928
  ZodAny2.create = (params) => {
5864
5929
  return new ZodAny2({
5865
5930
  typeName: ZodFirstPartyTypeKind2.ZodAny,
5866
5931
  ...processCreateParams2(params)
5867
5932
  });
5868
5933
  };
5869
- var ZodUnknown2 = /* @__PURE__ */ __name(class extends ZodType2 {
5934
+ var _a14;
5935
+ var _ZodUnknown2 = (_a14 = class extends ZodType2 {
5870
5936
  constructor() {
5871
5937
  super(...arguments);
5872
5938
  this._unknown = true;
@@ -5874,15 +5940,17 @@ var ZodUnknown2 = /* @__PURE__ */ __name(class extends ZodType2 {
5874
5940
  _parse(input) {
5875
5941
  return OK2(input.data);
5876
5942
  }
5877
- }, "ZodUnknown");
5878
- __name2(ZodUnknown2, "ZodUnknown");
5943
+ }, __name(_a14, "_ZodUnknown"), _a14);
5944
+ __name2(_ZodUnknown2, "ZodUnknown");
5945
+ var ZodUnknown2 = _ZodUnknown2;
5879
5946
  ZodUnknown2.create = (params) => {
5880
5947
  return new ZodUnknown2({
5881
5948
  typeName: ZodFirstPartyTypeKind2.ZodUnknown,
5882
5949
  ...processCreateParams2(params)
5883
5950
  });
5884
5951
  };
5885
- var ZodNever2 = /* @__PURE__ */ __name(class extends ZodType2 {
5952
+ var _a15;
5953
+ var _ZodNever2 = (_a15 = class extends ZodType2 {
5886
5954
  _parse(input) {
5887
5955
  const ctx = this._getOrReturnCtx(input);
5888
5956
  addIssueToContext2(ctx, {
@@ -5892,15 +5960,17 @@ var ZodNever2 = /* @__PURE__ */ __name(class extends ZodType2 {
5892
5960
  });
5893
5961
  return INVALID2;
5894
5962
  }
5895
- }, "ZodNever");
5896
- __name2(ZodNever2, "ZodNever");
5963
+ }, __name(_a15, "_ZodNever"), _a15);
5964
+ __name2(_ZodNever2, "ZodNever");
5965
+ var ZodNever2 = _ZodNever2;
5897
5966
  ZodNever2.create = (params) => {
5898
5967
  return new ZodNever2({
5899
5968
  typeName: ZodFirstPartyTypeKind2.ZodNever,
5900
5969
  ...processCreateParams2(params)
5901
5970
  });
5902
5971
  };
5903
- var ZodVoid2 = /* @__PURE__ */ __name(class extends ZodType2 {
5972
+ var _a16;
5973
+ var _ZodVoid2 = (_a16 = class extends ZodType2 {
5904
5974
  _parse(input) {
5905
5975
  const parsedType = this._getType(input);
5906
5976
  if (parsedType !== ZodParsedType2.undefined) {
@@ -5914,15 +5984,17 @@ var ZodVoid2 = /* @__PURE__ */ __name(class extends ZodType2 {
5914
5984
  }
5915
5985
  return OK2(input.data);
5916
5986
  }
5917
- }, "ZodVoid");
5918
- __name2(ZodVoid2, "ZodVoid");
5987
+ }, __name(_a16, "_ZodVoid"), _a16);
5988
+ __name2(_ZodVoid2, "ZodVoid");
5989
+ var ZodVoid2 = _ZodVoid2;
5919
5990
  ZodVoid2.create = (params) => {
5920
5991
  return new ZodVoid2({
5921
5992
  typeName: ZodFirstPartyTypeKind2.ZodVoid,
5922
5993
  ...processCreateParams2(params)
5923
5994
  });
5924
5995
  };
5925
- var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
5996
+ var _a17;
5997
+ var _ZodArray2 = (_a17 = class extends ZodType2 {
5926
5998
  _parse(input) {
5927
5999
  const { ctx, status } = this._processInputParams(input);
5928
6000
  const def = this._def;
@@ -5996,7 +6068,7 @@ var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
5996
6068
  return this._def.type;
5997
6069
  }
5998
6070
  min(minLength, message) {
5999
- return new ZodArray2({
6071
+ return new _a17({
6000
6072
  ...this._def,
6001
6073
  minLength: {
6002
6074
  value: minLength,
@@ -6005,7 +6077,7 @@ var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
6005
6077
  });
6006
6078
  }
6007
6079
  max(maxLength, message) {
6008
- return new ZodArray2({
6080
+ return new _a17({
6009
6081
  ...this._def,
6010
6082
  maxLength: {
6011
6083
  value: maxLength,
@@ -6014,7 +6086,7 @@ var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
6014
6086
  });
6015
6087
  }
6016
6088
  length(len, message) {
6017
- return new ZodArray2({
6089
+ return new _a17({
6018
6090
  ...this._def,
6019
6091
  exactLength: {
6020
6092
  value: len,
@@ -6025,8 +6097,9 @@ var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
6025
6097
  nonempty(message) {
6026
6098
  return this.min(1, message);
6027
6099
  }
6028
- }, "ZodArray");
6029
- __name2(ZodArray2, "ZodArray");
6100
+ }, __name(_a17, "_ZodArray"), _a17);
6101
+ __name2(_ZodArray2, "ZodArray");
6102
+ var ZodArray2 = _ZodArray2;
6030
6103
  ZodArray2.create = (schema, params) => {
6031
6104
  return new ZodArray2({
6032
6105
  type: schema,
@@ -6065,7 +6138,8 @@ function deepPartialify2(schema) {
6065
6138
  }
6066
6139
  __name(deepPartialify2, "deepPartialify");
6067
6140
  __name2(deepPartialify2, "deepPartialify");
6068
- var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6141
+ var _a18;
6142
+ var _ZodObject2 = (_a18 = class extends ZodType2 {
6069
6143
  constructor() {
6070
6144
  super(...arguments);
6071
6145
  this._cached = null;
@@ -6182,13 +6256,13 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6182
6256
  }
6183
6257
  strict(message) {
6184
6258
  errorUtil2.errToObj;
6185
- return new ZodObject2({
6259
+ return new _a18({
6186
6260
  ...this._def,
6187
6261
  unknownKeys: "strict",
6188
6262
  ...message !== void 0 ? {
6189
6263
  errorMap: (issue, ctx) => {
6190
- var _a, _b, _c, _d;
6191
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
6264
+ var _a41, _b, _c, _d;
6265
+ const defaultError = (_c = (_b = (_a41 = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a41, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
6192
6266
  if (issue.code === "unrecognized_keys")
6193
6267
  return {
6194
6268
  message: (_d = errorUtil2.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
@@ -6201,13 +6275,13 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6201
6275
  });
6202
6276
  }
6203
6277
  strip() {
6204
- return new ZodObject2({
6278
+ return new _a18({
6205
6279
  ...this._def,
6206
6280
  unknownKeys: "strip"
6207
6281
  });
6208
6282
  }
6209
6283
  passthrough() {
6210
- return new ZodObject2({
6284
+ return new _a18({
6211
6285
  ...this._def,
6212
6286
  unknownKeys: "passthrough"
6213
6287
  });
@@ -6230,7 +6304,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6230
6304
  // }) as any;
6231
6305
  // };
6232
6306
  extend(augmentation) {
6233
- return new ZodObject2({
6307
+ return new _a18({
6234
6308
  ...this._def,
6235
6309
  shape: () => ({
6236
6310
  ...this._def.shape(),
@@ -6244,7 +6318,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6244
6318
  * upgrade if you are experiencing issues.
6245
6319
  */
6246
6320
  merge(merging) {
6247
- const merged = new ZodObject2({
6321
+ const merged = new _a18({
6248
6322
  unknownKeys: merging._def.unknownKeys,
6249
6323
  catchall: merging._def.catchall,
6250
6324
  shape: () => ({
@@ -6317,7 +6391,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6317
6391
  // return merged;
6318
6392
  // }
6319
6393
  catchall(index) {
6320
- return new ZodObject2({
6394
+ return new _a18({
6321
6395
  ...this._def,
6322
6396
  catchall: index
6323
6397
  });
@@ -6329,7 +6403,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6329
6403
  shape[key] = this.shape[key];
6330
6404
  }
6331
6405
  });
6332
- return new ZodObject2({
6406
+ return new _a18({
6333
6407
  ...this._def,
6334
6408
  shape: () => shape
6335
6409
  });
@@ -6341,7 +6415,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6341
6415
  shape[key] = this.shape[key];
6342
6416
  }
6343
6417
  });
6344
- return new ZodObject2({
6418
+ return new _a18({
6345
6419
  ...this._def,
6346
6420
  shape: () => shape
6347
6421
  });
@@ -6362,7 +6436,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6362
6436
  newShape[key] = fieldSchema.optional();
6363
6437
  }
6364
6438
  });
6365
- return new ZodObject2({
6439
+ return new _a18({
6366
6440
  ...this._def,
6367
6441
  shape: () => newShape
6368
6442
  });
@@ -6381,7 +6455,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6381
6455
  newShape[key] = newField;
6382
6456
  }
6383
6457
  });
6384
- return new ZodObject2({
6458
+ return new _a18({
6385
6459
  ...this._def,
6386
6460
  shape: () => newShape
6387
6461
  });
@@ -6389,8 +6463,9 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
6389
6463
  keyof() {
6390
6464
  return createZodEnum2(util2.objectKeys(this.shape));
6391
6465
  }
6392
- }, "ZodObject");
6393
- __name2(ZodObject2, "ZodObject");
6466
+ }, __name(_a18, "_ZodObject"), _a18);
6467
+ __name2(_ZodObject2, "ZodObject");
6468
+ var ZodObject2 = _ZodObject2;
6394
6469
  ZodObject2.create = (shape, params) => {
6395
6470
  return new ZodObject2({
6396
6471
  shape: () => shape,
@@ -6418,7 +6493,8 @@ ZodObject2.lazycreate = (shape, params) => {
6418
6493
  ...processCreateParams2(params)
6419
6494
  });
6420
6495
  };
6421
- var ZodUnion2 = /* @__PURE__ */ __name(class extends ZodType2 {
6496
+ var _a19;
6497
+ var _ZodUnion2 = (_a19 = class extends ZodType2 {
6422
6498
  _parse(input) {
6423
6499
  const { ctx } = this._processInputParams(input);
6424
6500
  const options = this._def.options;
@@ -6506,8 +6582,9 @@ var ZodUnion2 = /* @__PURE__ */ __name(class extends ZodType2 {
6506
6582
  get options() {
6507
6583
  return this._def.options;
6508
6584
  }
6509
- }, "ZodUnion");
6510
- __name2(ZodUnion2, "ZodUnion");
6585
+ }, __name(_a19, "_ZodUnion"), _a19);
6586
+ __name2(_ZodUnion2, "ZodUnion");
6587
+ var ZodUnion2 = _ZodUnion2;
6511
6588
  ZodUnion2.create = (types, params) => {
6512
6589
  return new ZodUnion2({
6513
6590
  options: types,
@@ -6542,7 +6619,8 @@ var getDiscriminator2 = /* @__PURE__ */ __name2((type) => {
6542
6619
  return null;
6543
6620
  }
6544
6621
  }, "getDiscriminator");
6545
- var ZodDiscriminatedUnion2 = /* @__PURE__ */ __name(class extends ZodType2 {
6622
+ var _a20;
6623
+ var _ZodDiscriminatedUnion2 = (_a20 = class extends ZodType2 {
6546
6624
  _parse(input) {
6547
6625
  const { ctx } = this._processInputParams(input);
6548
6626
  if (ctx.parsedType !== ZodParsedType2.object) {
@@ -6611,7 +6689,7 @@ var ZodDiscriminatedUnion2 = /* @__PURE__ */ __name(class extends ZodType2 {
6611
6689
  optionsMap.set(value, type);
6612
6690
  }
6613
6691
  }
6614
- return new ZodDiscriminatedUnion2({
6692
+ return new _a20({
6615
6693
  typeName: ZodFirstPartyTypeKind2.ZodDiscriminatedUnion,
6616
6694
  discriminator,
6617
6695
  options,
@@ -6619,8 +6697,9 @@ var ZodDiscriminatedUnion2 = /* @__PURE__ */ __name(class extends ZodType2 {
6619
6697
  ...processCreateParams2(params)
6620
6698
  });
6621
6699
  }
6622
- }, "ZodDiscriminatedUnion");
6623
- __name2(ZodDiscriminatedUnion2, "ZodDiscriminatedUnion");
6700
+ }, __name(_a20, "_ZodDiscriminatedUnion"), _a20);
6701
+ __name2(_ZodDiscriminatedUnion2, "ZodDiscriminatedUnion");
6702
+ var ZodDiscriminatedUnion2 = _ZodDiscriminatedUnion2;
6624
6703
  function mergeValues2(a, b) {
6625
6704
  const aType = getParsedType2(a);
6626
6705
  const bType = getParsedType2(b);
@@ -6684,7 +6763,8 @@ function mergeValues2(a, b) {
6684
6763
  }
6685
6764
  __name(mergeValues2, "mergeValues");
6686
6765
  __name2(mergeValues2, "mergeValues");
6687
- var ZodIntersection2 = /* @__PURE__ */ __name(class extends ZodType2 {
6766
+ var _a21;
6767
+ var _ZodIntersection2 = (_a21 = class extends ZodType2 {
6688
6768
  _parse(input) {
6689
6769
  const { status, ctx } = this._processInputParams(input);
6690
6770
  const handleParsed = /* @__PURE__ */ __name2((parsedLeft, parsedRight) => {
@@ -6731,8 +6811,9 @@ var ZodIntersection2 = /* @__PURE__ */ __name(class extends ZodType2 {
6731
6811
  }));
6732
6812
  }
6733
6813
  }
6734
- }, "ZodIntersection");
6735
- __name2(ZodIntersection2, "ZodIntersection");
6814
+ }, __name(_a21, "_ZodIntersection"), _a21);
6815
+ __name2(_ZodIntersection2, "ZodIntersection");
6816
+ var ZodIntersection2 = _ZodIntersection2;
6736
6817
  ZodIntersection2.create = (left, right, params) => {
6737
6818
  return new ZodIntersection2({
6738
6819
  left,
@@ -6741,7 +6822,8 @@ ZodIntersection2.create = (left, right, params) => {
6741
6822
  ...processCreateParams2(params)
6742
6823
  });
6743
6824
  };
6744
- var ZodTuple2 = /* @__PURE__ */ __name(class extends ZodType2 {
6825
+ var _a22;
6826
+ var _ZodTuple2 = (_a22 = class extends ZodType2 {
6745
6827
  _parse(input) {
6746
6828
  const { status, ctx } = this._processInputParams(input);
6747
6829
  if (ctx.parsedType !== ZodParsedType2.array) {
@@ -6793,13 +6875,14 @@ var ZodTuple2 = /* @__PURE__ */ __name(class extends ZodType2 {
6793
6875
  return this._def.items;
6794
6876
  }
6795
6877
  rest(rest) {
6796
- return new ZodTuple2({
6878
+ return new _a22({
6797
6879
  ...this._def,
6798
6880
  rest
6799
6881
  });
6800
6882
  }
6801
- }, "ZodTuple");
6802
- __name2(ZodTuple2, "ZodTuple");
6883
+ }, __name(_a22, "_ZodTuple"), _a22);
6884
+ __name2(_ZodTuple2, "ZodTuple");
6885
+ var ZodTuple2 = _ZodTuple2;
6803
6886
  ZodTuple2.create = (schemas, params) => {
6804
6887
  if (!Array.isArray(schemas)) {
6805
6888
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
@@ -6811,7 +6894,8 @@ ZodTuple2.create = (schemas, params) => {
6811
6894
  ...processCreateParams2(params)
6812
6895
  });
6813
6896
  };
6814
- var ZodRecord2 = /* @__PURE__ */ __name(class extends ZodType2 {
6897
+ var _a23;
6898
+ var _ZodRecord2 = (_a23 = class extends ZodType2 {
6815
6899
  get keySchema() {
6816
6900
  return this._def.keyType;
6817
6901
  }
@@ -6848,23 +6932,25 @@ var ZodRecord2 = /* @__PURE__ */ __name(class extends ZodType2 {
6848
6932
  }
6849
6933
  static create(first, second, third) {
6850
6934
  if (second instanceof ZodType2) {
6851
- return new ZodRecord2({
6935
+ return new _a23({
6852
6936
  keyType: first,
6853
6937
  valueType: second,
6854
6938
  typeName: ZodFirstPartyTypeKind2.ZodRecord,
6855
6939
  ...processCreateParams2(third)
6856
6940
  });
6857
6941
  }
6858
- return new ZodRecord2({
6942
+ return new _a23({
6859
6943
  keyType: ZodString2.create(),
6860
6944
  valueType: first,
6861
6945
  typeName: ZodFirstPartyTypeKind2.ZodRecord,
6862
6946
  ...processCreateParams2(second)
6863
6947
  });
6864
6948
  }
6865
- }, "ZodRecord");
6866
- __name2(ZodRecord2, "ZodRecord");
6867
- var ZodMap2 = /* @__PURE__ */ __name(class extends ZodType2 {
6949
+ }, __name(_a23, "_ZodRecord"), _a23);
6950
+ __name2(_ZodRecord2, "ZodRecord");
6951
+ var ZodRecord2 = _ZodRecord2;
6952
+ var _a24;
6953
+ var _ZodMap2 = (_a24 = class extends ZodType2 {
6868
6954
  get keySchema() {
6869
6955
  return this._def.keyType;
6870
6956
  }
@@ -6935,8 +7021,9 @@ var ZodMap2 = /* @__PURE__ */ __name(class extends ZodType2 {
6935
7021
  };
6936
7022
  }
6937
7023
  }
6938
- }, "ZodMap");
6939
- __name2(ZodMap2, "ZodMap");
7024
+ }, __name(_a24, "_ZodMap"), _a24);
7025
+ __name2(_ZodMap2, "ZodMap");
7026
+ var ZodMap2 = _ZodMap2;
6940
7027
  ZodMap2.create = (keyType, valueType, params) => {
6941
7028
  return new ZodMap2({
6942
7029
  valueType,
@@ -6945,7 +7032,8 @@ ZodMap2.create = (keyType, valueType, params) => {
6945
7032
  ...processCreateParams2(params)
6946
7033
  });
6947
7034
  };
6948
- var ZodSet2 = /* @__PURE__ */ __name(class extends ZodType2 {
7035
+ var _a25;
7036
+ var _ZodSet2 = (_a25 = class extends ZodType2 {
6949
7037
  _parse(input) {
6950
7038
  const { status, ctx } = this._processInputParams(input);
6951
7039
  if (ctx.parsedType !== ZodParsedType2.set) {
@@ -7010,7 +7098,7 @@ var ZodSet2 = /* @__PURE__ */ __name(class extends ZodType2 {
7010
7098
  }
7011
7099
  }
7012
7100
  min(minSize, message) {
7013
- return new ZodSet2({
7101
+ return new _a25({
7014
7102
  ...this._def,
7015
7103
  minSize: {
7016
7104
  value: minSize,
@@ -7019,7 +7107,7 @@ var ZodSet2 = /* @__PURE__ */ __name(class extends ZodType2 {
7019
7107
  });
7020
7108
  }
7021
7109
  max(maxSize, message) {
7022
- return new ZodSet2({
7110
+ return new _a25({
7023
7111
  ...this._def,
7024
7112
  maxSize: {
7025
7113
  value: maxSize,
@@ -7033,8 +7121,9 @@ var ZodSet2 = /* @__PURE__ */ __name(class extends ZodType2 {
7033
7121
  nonempty(message) {
7034
7122
  return this.min(1, message);
7035
7123
  }
7036
- }, "ZodSet");
7037
- __name2(ZodSet2, "ZodSet");
7124
+ }, __name(_a25, "_ZodSet"), _a25);
7125
+ __name2(_ZodSet2, "ZodSet");
7126
+ var ZodSet2 = _ZodSet2;
7038
7127
  ZodSet2.create = (valueType, params) => {
7039
7128
  return new ZodSet2({
7040
7129
  valueType,
@@ -7044,7 +7133,8 @@ ZodSet2.create = (valueType, params) => {
7044
7133
  ...processCreateParams2(params)
7045
7134
  });
7046
7135
  };
7047
- var ZodFunction2 = /* @__PURE__ */ __name(class extends ZodType2 {
7136
+ var _a26;
7137
+ var _ZodFunction2 = (_a26 = class extends ZodType2 {
7048
7138
  constructor() {
7049
7139
  super(...arguments);
7050
7140
  this.validate = this.implement;
@@ -7141,13 +7231,13 @@ var ZodFunction2 = /* @__PURE__ */ __name(class extends ZodType2 {
7141
7231
  return this._def.returns;
7142
7232
  }
7143
7233
  args(...items) {
7144
- return new ZodFunction2({
7234
+ return new _a26({
7145
7235
  ...this._def,
7146
7236
  args: ZodTuple2.create(items).rest(ZodUnknown2.create())
7147
7237
  });
7148
7238
  }
7149
7239
  returns(returnType) {
7150
- return new ZodFunction2({
7240
+ return new _a26({
7151
7241
  ...this._def,
7152
7242
  returns: returnType
7153
7243
  });
@@ -7161,16 +7251,18 @@ var ZodFunction2 = /* @__PURE__ */ __name(class extends ZodType2 {
7161
7251
  return validatedFunc;
7162
7252
  }
7163
7253
  static create(args, returns, params) {
7164
- return new ZodFunction2({
7254
+ return new _a26({
7165
7255
  args: args ? args : ZodTuple2.create([]).rest(ZodUnknown2.create()),
7166
7256
  returns: returns || ZodUnknown2.create(),
7167
7257
  typeName: ZodFirstPartyTypeKind2.ZodFunction,
7168
7258
  ...processCreateParams2(params)
7169
7259
  });
7170
7260
  }
7171
- }, "ZodFunction");
7172
- __name2(ZodFunction2, "ZodFunction");
7173
- var ZodLazy2 = /* @__PURE__ */ __name(class extends ZodType2 {
7261
+ }, __name(_a26, "_ZodFunction"), _a26);
7262
+ __name2(_ZodFunction2, "ZodFunction");
7263
+ var ZodFunction2 = _ZodFunction2;
7264
+ var _a27;
7265
+ var _ZodLazy2 = (_a27 = class extends ZodType2 {
7174
7266
  get schema() {
7175
7267
  return this._def.getter();
7176
7268
  }
@@ -7183,8 +7275,9 @@ var ZodLazy2 = /* @__PURE__ */ __name(class extends ZodType2 {
7183
7275
  parent: ctx
7184
7276
  });
7185
7277
  }
7186
- }, "ZodLazy");
7187
- __name2(ZodLazy2, "ZodLazy");
7278
+ }, __name(_a27, "_ZodLazy"), _a27);
7279
+ __name2(_ZodLazy2, "ZodLazy");
7280
+ var ZodLazy2 = _ZodLazy2;
7188
7281
  ZodLazy2.create = (getter, params) => {
7189
7282
  return new ZodLazy2({
7190
7283
  getter,
@@ -7192,7 +7285,8 @@ ZodLazy2.create = (getter, params) => {
7192
7285
  ...processCreateParams2(params)
7193
7286
  });
7194
7287
  };
7195
- var ZodLiteral2 = /* @__PURE__ */ __name(class extends ZodType2 {
7288
+ var _a28;
7289
+ var _ZodLiteral2 = (_a28 = class extends ZodType2 {
7196
7290
  _parse(input) {
7197
7291
  if (input.data !== this._def.value) {
7198
7292
  const ctx = this._getOrReturnCtx(input);
@@ -7211,8 +7305,9 @@ var ZodLiteral2 = /* @__PURE__ */ __name(class extends ZodType2 {
7211
7305
  get value() {
7212
7306
  return this._def.value;
7213
7307
  }
7214
- }, "ZodLiteral");
7215
- __name2(ZodLiteral2, "ZodLiteral");
7308
+ }, __name(_a28, "_ZodLiteral"), _a28);
7309
+ __name2(_ZodLiteral2, "ZodLiteral");
7310
+ var ZodLiteral2 = _ZodLiteral2;
7216
7311
  ZodLiteral2.create = (value, params) => {
7217
7312
  return new ZodLiteral2({
7218
7313
  value,
@@ -7229,7 +7324,8 @@ function createZodEnum2(values, params) {
7229
7324
  }
7230
7325
  __name(createZodEnum2, "createZodEnum");
7231
7326
  __name2(createZodEnum2, "createZodEnum");
7232
- var ZodEnum2 = /* @__PURE__ */ __name(class extends ZodType2 {
7327
+ var _a29;
7328
+ var _ZodEnum2 = (_a29 = class extends ZodType2 {
7233
7329
  _parse(input) {
7234
7330
  if (typeof input.data !== "string") {
7235
7331
  const ctx = this._getOrReturnCtx(input);
@@ -7278,15 +7374,17 @@ var ZodEnum2 = /* @__PURE__ */ __name(class extends ZodType2 {
7278
7374
  return enumValues;
7279
7375
  }
7280
7376
  extract(values) {
7281
- return ZodEnum2.create(values);
7377
+ return _a29.create(values);
7282
7378
  }
7283
7379
  exclude(values) {
7284
- return ZodEnum2.create(this.options.filter((opt) => !values.includes(opt)));
7380
+ return _a29.create(this.options.filter((opt) => !values.includes(opt)));
7285
7381
  }
7286
- }, "ZodEnum");
7287
- __name2(ZodEnum2, "ZodEnum");
7382
+ }, __name(_a29, "_ZodEnum"), _a29);
7383
+ __name2(_ZodEnum2, "ZodEnum");
7384
+ var ZodEnum2 = _ZodEnum2;
7288
7385
  ZodEnum2.create = createZodEnum2;
7289
- var ZodNativeEnum2 = /* @__PURE__ */ __name(class extends ZodType2 {
7386
+ var _a30;
7387
+ var _ZodNativeEnum2 = (_a30 = class extends ZodType2 {
7290
7388
  _parse(input) {
7291
7389
  const nativeEnumValues = util2.getValidEnumValues(this._def.values);
7292
7390
  const ctx = this._getOrReturnCtx(input);
@@ -7313,8 +7411,9 @@ var ZodNativeEnum2 = /* @__PURE__ */ __name(class extends ZodType2 {
7313
7411
  get enum() {
7314
7412
  return this._def.values;
7315
7413
  }
7316
- }, "ZodNativeEnum");
7317
- __name2(ZodNativeEnum2, "ZodNativeEnum");
7414
+ }, __name(_a30, "_ZodNativeEnum"), _a30);
7415
+ __name2(_ZodNativeEnum2, "ZodNativeEnum");
7416
+ var ZodNativeEnum2 = _ZodNativeEnum2;
7318
7417
  ZodNativeEnum2.create = (values, params) => {
7319
7418
  return new ZodNativeEnum2({
7320
7419
  values,
@@ -7322,7 +7421,8 @@ ZodNativeEnum2.create = (values, params) => {
7322
7421
  ...processCreateParams2(params)
7323
7422
  });
7324
7423
  };
7325
- var ZodPromise2 = /* @__PURE__ */ __name(class extends ZodType2 {
7424
+ var _a31;
7425
+ var _ZodPromise2 = (_a31 = class extends ZodType2 {
7326
7426
  unwrap() {
7327
7427
  return this._def.type;
7328
7428
  }
@@ -7344,8 +7444,9 @@ var ZodPromise2 = /* @__PURE__ */ __name(class extends ZodType2 {
7344
7444
  });
7345
7445
  }));
7346
7446
  }
7347
- }, "ZodPromise");
7348
- __name2(ZodPromise2, "ZodPromise");
7447
+ }, __name(_a31, "_ZodPromise"), _a31);
7448
+ __name2(_ZodPromise2, "ZodPromise");
7449
+ var ZodPromise2 = _ZodPromise2;
7349
7450
  ZodPromise2.create = (schema, params) => {
7350
7451
  return new ZodPromise2({
7351
7452
  type: schema,
@@ -7353,7 +7454,8 @@ ZodPromise2.create = (schema, params) => {
7353
7454
  ...processCreateParams2(params)
7354
7455
  });
7355
7456
  };
7356
- var ZodEffects2 = /* @__PURE__ */ __name(class extends ZodType2 {
7457
+ var _a32;
7458
+ var _ZodEffects2 = (_a32 = class extends ZodType2 {
7357
7459
  innerType() {
7358
7460
  return this._def.schema;
7359
7461
  }
@@ -7480,8 +7582,9 @@ var ZodEffects2 = /* @__PURE__ */ __name(class extends ZodType2 {
7480
7582
  }
7481
7583
  util2.assertNever(effect);
7482
7584
  }
7483
- }, "ZodEffects");
7484
- __name2(ZodEffects2, "ZodEffects");
7585
+ }, __name(_a32, "_ZodEffects"), _a32);
7586
+ __name2(_ZodEffects2, "ZodEffects");
7587
+ var ZodEffects2 = _ZodEffects2;
7485
7588
  ZodEffects2.create = (schema, effect, params) => {
7486
7589
  return new ZodEffects2({
7487
7590
  schema,
@@ -7501,7 +7604,8 @@ ZodEffects2.createWithPreprocess = (preprocess, schema, params) => {
7501
7604
  ...processCreateParams2(params)
7502
7605
  });
7503
7606
  };
7504
- var ZodOptional2 = /* @__PURE__ */ __name(class extends ZodType2 {
7607
+ var _a33;
7608
+ var _ZodOptional2 = (_a33 = class extends ZodType2 {
7505
7609
  _parse(input) {
7506
7610
  const parsedType = this._getType(input);
7507
7611
  if (parsedType === ZodParsedType2.undefined) {
@@ -7512,8 +7616,9 @@ var ZodOptional2 = /* @__PURE__ */ __name(class extends ZodType2 {
7512
7616
  unwrap() {
7513
7617
  return this._def.innerType;
7514
7618
  }
7515
- }, "ZodOptional");
7516
- __name2(ZodOptional2, "ZodOptional");
7619
+ }, __name(_a33, "_ZodOptional"), _a33);
7620
+ __name2(_ZodOptional2, "ZodOptional");
7621
+ var ZodOptional2 = _ZodOptional2;
7517
7622
  ZodOptional2.create = (type, params) => {
7518
7623
  return new ZodOptional2({
7519
7624
  innerType: type,
@@ -7521,7 +7626,8 @@ ZodOptional2.create = (type, params) => {
7521
7626
  ...processCreateParams2(params)
7522
7627
  });
7523
7628
  };
7524
- var ZodNullable2 = /* @__PURE__ */ __name(class extends ZodType2 {
7629
+ var _a34;
7630
+ var _ZodNullable2 = (_a34 = class extends ZodType2 {
7525
7631
  _parse(input) {
7526
7632
  const parsedType = this._getType(input);
7527
7633
  if (parsedType === ZodParsedType2.null) {
@@ -7532,8 +7638,9 @@ var ZodNullable2 = /* @__PURE__ */ __name(class extends ZodType2 {
7532
7638
  unwrap() {
7533
7639
  return this._def.innerType;
7534
7640
  }
7535
- }, "ZodNullable");
7536
- __name2(ZodNullable2, "ZodNullable");
7641
+ }, __name(_a34, "_ZodNullable"), _a34);
7642
+ __name2(_ZodNullable2, "ZodNullable");
7643
+ var ZodNullable2 = _ZodNullable2;
7537
7644
  ZodNullable2.create = (type, params) => {
7538
7645
  return new ZodNullable2({
7539
7646
  innerType: type,
@@ -7541,7 +7648,8 @@ ZodNullable2.create = (type, params) => {
7541
7648
  ...processCreateParams2(params)
7542
7649
  });
7543
7650
  };
7544
- var ZodDefault2 = /* @__PURE__ */ __name(class extends ZodType2 {
7651
+ var _a35;
7652
+ var _ZodDefault2 = (_a35 = class extends ZodType2 {
7545
7653
  _parse(input) {
7546
7654
  const { ctx } = this._processInputParams(input);
7547
7655
  let data = ctx.data;
@@ -7557,8 +7665,9 @@ var ZodDefault2 = /* @__PURE__ */ __name(class extends ZodType2 {
7557
7665
  removeDefault() {
7558
7666
  return this._def.innerType;
7559
7667
  }
7560
- }, "ZodDefault");
7561
- __name2(ZodDefault2, "ZodDefault");
7668
+ }, __name(_a35, "_ZodDefault"), _a35);
7669
+ __name2(_ZodDefault2, "ZodDefault");
7670
+ var ZodDefault2 = _ZodDefault2;
7562
7671
  ZodDefault2.create = (type, params) => {
7563
7672
  return new ZodDefault2({
7564
7673
  innerType: type,
@@ -7567,7 +7676,8 @@ ZodDefault2.create = (type, params) => {
7567
7676
  ...processCreateParams2(params)
7568
7677
  });
7569
7678
  };
7570
- var ZodCatch2 = /* @__PURE__ */ __name(class extends ZodType2 {
7679
+ var _a36;
7680
+ var _ZodCatch2 = (_a36 = class extends ZodType2 {
7571
7681
  _parse(input) {
7572
7682
  const { ctx } = this._processInputParams(input);
7573
7683
  const newCtx = {
@@ -7611,8 +7721,9 @@ var ZodCatch2 = /* @__PURE__ */ __name(class extends ZodType2 {
7611
7721
  removeCatch() {
7612
7722
  return this._def.innerType;
7613
7723
  }
7614
- }, "ZodCatch");
7615
- __name2(ZodCatch2, "ZodCatch");
7724
+ }, __name(_a36, "_ZodCatch"), _a36);
7725
+ __name2(_ZodCatch2, "ZodCatch");
7726
+ var ZodCatch2 = _ZodCatch2;
7616
7727
  ZodCatch2.create = (type, params) => {
7617
7728
  return new ZodCatch2({
7618
7729
  innerType: type,
@@ -7621,7 +7732,8 @@ ZodCatch2.create = (type, params) => {
7621
7732
  ...processCreateParams2(params)
7622
7733
  });
7623
7734
  };
7624
- var ZodNaN2 = /* @__PURE__ */ __name(class extends ZodType2 {
7735
+ var _a37;
7736
+ var _ZodNaN2 = (_a37 = class extends ZodType2 {
7625
7737
  _parse(input) {
7626
7738
  const parsedType = this._getType(input);
7627
7739
  if (parsedType !== ZodParsedType2.nan) {
@@ -7638,8 +7750,9 @@ var ZodNaN2 = /* @__PURE__ */ __name(class extends ZodType2 {
7638
7750
  value: input.data
7639
7751
  };
7640
7752
  }
7641
- }, "ZodNaN");
7642
- __name2(ZodNaN2, "ZodNaN");
7753
+ }, __name(_a37, "_ZodNaN"), _a37);
7754
+ __name2(_ZodNaN2, "ZodNaN");
7755
+ var ZodNaN2 = _ZodNaN2;
7643
7756
  ZodNaN2.create = (params) => {
7644
7757
  return new ZodNaN2({
7645
7758
  typeName: ZodFirstPartyTypeKind2.ZodNaN,
@@ -7647,7 +7760,8 @@ ZodNaN2.create = (params) => {
7647
7760
  });
7648
7761
  };
7649
7762
  var BRAND2 = Symbol("zod_brand");
7650
- var ZodBranded2 = /* @__PURE__ */ __name(class extends ZodType2 {
7763
+ var _a38;
7764
+ var _ZodBranded2 = (_a38 = class extends ZodType2 {
7651
7765
  _parse(input) {
7652
7766
  const { ctx } = this._processInputParams(input);
7653
7767
  const data = ctx.data;
@@ -7660,9 +7774,11 @@ var ZodBranded2 = /* @__PURE__ */ __name(class extends ZodType2 {
7660
7774
  unwrap() {
7661
7775
  return this._def.type;
7662
7776
  }
7663
- }, "ZodBranded");
7664
- __name2(ZodBranded2, "ZodBranded");
7665
- var ZodPipeline2 = /* @__PURE__ */ __name(class extends ZodType2 {
7777
+ }, __name(_a38, "_ZodBranded"), _a38);
7778
+ __name2(_ZodBranded2, "ZodBranded");
7779
+ var ZodBranded2 = _ZodBranded2;
7780
+ var _a39;
7781
+ var _ZodPipeline2 = (_a39 = class extends ZodType2 {
7666
7782
  _parse(input) {
7667
7783
  const { status, ctx } = this._processInputParams(input);
7668
7784
  if (ctx.common.async) {
@@ -7710,15 +7826,17 @@ var ZodPipeline2 = /* @__PURE__ */ __name(class extends ZodType2 {
7710
7826
  }
7711
7827
  }
7712
7828
  static create(a, b) {
7713
- return new ZodPipeline2({
7829
+ return new _a39({
7714
7830
  in: a,
7715
7831
  out: b,
7716
7832
  typeName: ZodFirstPartyTypeKind2.ZodPipeline
7717
7833
  });
7718
7834
  }
7719
- }, "ZodPipeline");
7720
- __name2(ZodPipeline2, "ZodPipeline");
7721
- var ZodReadonly2 = /* @__PURE__ */ __name(class extends ZodType2 {
7835
+ }, __name(_a39, "_ZodPipeline"), _a39);
7836
+ __name2(_ZodPipeline2, "ZodPipeline");
7837
+ var ZodPipeline2 = _ZodPipeline2;
7838
+ var _a40;
7839
+ var _ZodReadonly2 = (_a40 = class extends ZodType2 {
7722
7840
  _parse(input) {
7723
7841
  const result = this._def.innerType._parse(input);
7724
7842
  if (isValid2(result)) {
@@ -7726,8 +7844,9 @@ var ZodReadonly2 = /* @__PURE__ */ __name(class extends ZodType2 {
7726
7844
  }
7727
7845
  return result;
7728
7846
  }
7729
- }, "ZodReadonly");
7730
- __name2(ZodReadonly2, "ZodReadonly");
7847
+ }, __name(_a40, "_ZodReadonly"), _a40);
7848
+ __name2(_ZodReadonly2, "ZodReadonly");
7849
+ var ZodReadonly2 = _ZodReadonly2;
7731
7850
  ZodReadonly2.create = (type, params) => {
7732
7851
  return new ZodReadonly2({
7733
7852
  innerType: type,
@@ -7738,12 +7857,12 @@ ZodReadonly2.create = (type, params) => {
7738
7857
  var custom2 = /* @__PURE__ */ __name2((check, params = {}, fatal) => {
7739
7858
  if (check)
7740
7859
  return ZodAny2.create().superRefine((data, ctx) => {
7741
- var _a, _b;
7860
+ var _a41, _b;
7742
7861
  if (!check(data)) {
7743
7862
  const p = typeof params === "function" ? params(data) : typeof params === "string" ? {
7744
7863
  message: params
7745
7864
  } : params;
7746
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
7865
+ const _fatal = (_b = (_a41 = p.fatal) !== null && _a41 !== void 0 ? _a41 : fatal) !== null && _b !== void 0 ? _b : true;
7747
7866
  const p2 = typeof p === "string" ? {
7748
7867
  message: p
7749
7868
  } : p;
@@ -7977,7 +8096,7 @@ var z2 = /* @__PURE__ */ Object.freeze({
7977
8096
  ZodError: ZodError2
7978
8097
  });
7979
8098
 
7980
- // ../core/dist/chunk-625UEV4B.js
8099
+ // ../core/dist/chunk-OMI2MGEL.js
7981
8100
  var purchaseUserTransferSchema = z2.object({
7982
8101
  id: z2.string().max(191),
7983
8102
  transferState: z2.enum([
@@ -7991,7 +8110,7 @@ var purchaseUserTransferSchema = z2.object({
7991
8110
  ]).default("AVAILABLE"),
7992
8111
  purchaseId: z2.string().max(191),
7993
8112
  sourceUserId: z2.string().max(191),
7994
- targetUserId: z2.string().max(191).optional(),
8113
+ targetUserId: z2.string().max(191).optional().nullable(),
7995
8114
  createdAt: z2.date().nullable(),
7996
8115
  expiresAt: z2.date().nullable(),
7997
8116
  canceledAt: z2.date().nullable(),
@@ -7999,20 +8118,20 @@ var purchaseUserTransferSchema = z2.object({
7999
8118
  completedAt: z2.date().nullable()
8000
8119
  });
8001
8120
 
8002
- // ../core/dist/chunk-NH6Z6YIN.js
8121
+ // ../core/dist/chunk-UKYAUN7W.js
8003
8122
  var resourceProgressSchema = z2.object({
8004
8123
  userId: z2.string().max(191),
8005
8124
  contentResourceId: z2.string().max(191).optional().nullable(),
8006
- metadata: z2.record(z2.any()).default({}),
8125
+ fields: z2.record(z2.any()).default({}),
8007
8126
  completedAt: z2.date().nullable(),
8008
8127
  updatedAt: z2.date().nullable(),
8009
8128
  createdAt: z2.date().nullable()
8010
8129
  });
8011
8130
 
8012
- // ../core/dist/chunk-N2FP5B4I.js
8131
+ // ../core/dist/chunk-3K3P6UHD.js
8013
8132
  var upgradableProductSchema = z2.object({
8014
- upgradableToId: z2.string().length(255),
8015
- upgradableFromId: z2.string().length(255),
8133
+ upgradableToId: z2.string().max(255),
8134
+ upgradableFromId: z2.string().max(255),
8016
8135
  position: z2.number().default(0),
8017
8136
  metadata: z2.record(z2.any()).default({}),
8018
8137
  createdAt: z2.date().nullable(),
@@ -8020,7 +8139,7 @@ var upgradableProductSchema = z2.object({
8020
8139
  deletedAt: z2.date().nullable()
8021
8140
  });
8022
8141
 
8023
- // ../core/dist/chunk-TNQGNJIQ.js
8142
+ // ../core/dist/chunk-QWXG37EL.js
8024
8143
  var VideoResourceSchema = z2.object({
8025
8144
  id: z2.string(),
8026
8145
  updatedAt: z2.string().optional(),
@@ -8042,42 +8161,18 @@ var VideoResourceSchema = z2.object({
8042
8161
  ])
8043
8162
  });
8044
8163
 
8045
- // ../core/dist/chunk-AYRXRIAF.js
8046
- var merchantChargeSchema = z2.object({
8047
- id: z2.string().length(191),
8048
- status: z2.number().int().default(0),
8049
- identifier: z2.string().length(191),
8050
- userId: z2.string().length(191),
8051
- merchantAccountId: z2.string().length(191),
8052
- merchantProductId: z2.string().length(191),
8053
- createdAt: z2.date().nullable(),
8054
- merchantCustomerId: z2.string().length(191)
8055
- });
8056
-
8057
- // ../core/dist/chunk-NTKCZFHE.js
8058
- var merchantCouponSchema = z2.object({
8164
+ // ../core/dist/chunk-QWVS7RLZ.js
8165
+ var merchantPriceSchema = z2.object({
8059
8166
  id: z2.string().max(191),
8060
- identifier: z2.string().max(191).optional().nullable(),
8061
- status: z2.number().int().default(0),
8062
8167
  merchantAccountId: z2.string().max(191),
8063
- percentageDiscount: z2.coerce.number().refine((value) => {
8064
- const decimalPlaces = value.toString().split(".")[1]?.length || 0;
8065
- return decimalPlaces <= 2;
8066
- }),
8067
- type: z2.string().max(191).optional().nullable()
8068
- });
8069
-
8070
- // ../core/dist/chunk-BRSSFQ7G.js
8071
- var merchantCustomerSchema = z2.object({
8072
- id: z2.string().max(191),
8073
- userId: z2.string().max(191),
8074
- merchantAccountId: z2.string().max(191),
8075
- identifier: z2.string().max(191),
8076
- createdAt: z2.date().nullable(),
8077
- status: z2.number().int().default(0)
8168
+ merchantProductId: z2.string().max(191),
8169
+ status: z2.number().int().default(0),
8170
+ identifier: z2.string().max(191).optional().nullable(),
8171
+ createdAt: z2.date(),
8172
+ priceId: z2.string().max(191).optional().nullable()
8078
8173
  });
8079
8174
 
8080
- // ../core/dist/chunk-NBGPMD5L.js
8175
+ // ../core/dist/chunk-5FAFQVN5.js
8081
8176
  var merchantProductSchema = z2.object({
8082
8177
  id: z2.string().max(191),
8083
8178
  merchantAccountId: z2.string().max(191),
@@ -8087,21 +8182,21 @@ var merchantProductSchema = z2.object({
8087
8182
  createdAt: z2.date().nullable()
8088
8183
  });
8089
8184
 
8090
- // ../core/dist/chunk-3PNHS6OB.js
8185
+ // ../core/dist/chunk-E2O65L6F.js
8091
8186
  var userSchema = z2.object({
8092
- id: z2.string().length(255),
8093
- name: z2.string().length(255).optional().nullable(),
8187
+ id: z2.string().max(255),
8188
+ name: z2.string().max(255).optional().nullable(),
8094
8189
  role: z2.enum([
8095
8190
  "user",
8096
8191
  "admin"
8097
8192
  ]).default("user"),
8098
- email: z2.string().length(255).email(),
8193
+ email: z2.string().max(255).email(),
8099
8194
  emailVerified: z2.date().nullable(),
8100
- image: z2.string().length(255).optional().nullable(),
8195
+ image: z2.string().max(255).optional().nullable(),
8101
8196
  createdAt: z2.date().nullable()
8102
8197
  });
8103
8198
 
8104
- // ../core/dist/chunk-FM4F3ZJD.js
8199
+ // ../core/dist/chunk-BEN776QX.js
8105
8200
  var priceSchema = z2.object({
8106
8201
  id: z2.string().max(191),
8107
8202
  productId: z2.string().max(191).optional().nullable(),
@@ -8112,28 +8207,99 @@ var priceSchema = z2.object({
8112
8207
  return decimalPlaces <= 2;
8113
8208
  }),
8114
8209
  createdAt: z2.date().nullable(),
8115
- metadata: z2.record(z2.any()).default({})
8210
+ fields: z2.record(z2.any()).default({})
8116
8211
  });
8117
8212
 
8118
- // ../core/dist/chunk-QVE5LSW7.js
8213
+ // ../core/dist/chunk-DBONTSXM.js
8214
+ var ContentResourceResourceSchema = z2.object({
8215
+ resourceId: z2.string(),
8216
+ resourceOfId: z2.string(),
8217
+ position: z2.number().default(0),
8218
+ metadata: z2.record(z2.string(), z2.any()).default({}).nullable(),
8219
+ createdAt: z2.date().nullable(),
8220
+ updatedAt: z2.date().nullable(),
8221
+ deletedAt: z2.date().nullable(),
8222
+ resource: z2.any()
8223
+ });
8224
+ var ContentResourceSchema = z2.object({
8225
+ id: z2.string(),
8226
+ type: z2.string(),
8227
+ createdById: z2.string(),
8228
+ fields: z2.record(z2.string(), z2.any()).default({}).nullable().optional(),
8229
+ createdAt: z2.date().nullable(),
8230
+ updatedAt: z2.date().nullable(),
8231
+ deletedAt: z2.date().nullable(),
8232
+ resources: z2.array(ContentResourceResourceSchema).default([]).nullable()
8233
+ });
8234
+ var ContentResourceProductSchema = z2.object({
8235
+ resourceId: z2.string(),
8236
+ productId: z2.string(),
8237
+ position: z2.number().default(0),
8238
+ metadata: z2.record(z2.string(), z2.any()).default({}).nullable(),
8239
+ createdAt: z2.date().nullable(),
8240
+ updatedAt: z2.date().nullable(),
8241
+ deletedAt: z2.date().nullable(),
8242
+ resource: z2.any(),
8243
+ product: z2.any()
8244
+ });
8245
+ var ResourceStateSchema = z2.union([
8246
+ z2.literal("draft"),
8247
+ z2.literal("published"),
8248
+ z2.literal("archived"),
8249
+ z2.literal("deleted")
8250
+ ]);
8251
+ var ResourceVisibilitySchema = z2.union([
8252
+ z2.literal("public"),
8253
+ z2.literal("private"),
8254
+ z2.literal("unlisted")
8255
+ ]);
8256
+
8257
+ // ../core/dist/chunk-EHEPZVSG.js
8119
8258
  var productSchema = z2.object({
8120
8259
  id: z2.string().max(191),
8121
8260
  name: z2.string().max(191),
8122
8261
  key: z2.string().max(191).optional().nullable(),
8123
- metadata: z2.record(z2.any()).default({}),
8262
+ type: z2.enum([
8263
+ "live",
8264
+ "self-paced"
8265
+ ]).default("self-paced"),
8266
+ fields: z2.object({
8267
+ body: z2.string().nullable().optional(),
8268
+ description: z2.string().optional().nullable(),
8269
+ slug: z2.string(),
8270
+ image: z2.object({
8271
+ url: z2.string().url(),
8272
+ alt: z2.string().optional().nullable(),
8273
+ width: z2.number(),
8274
+ height: z2.number()
8275
+ }).optional().nullable(),
8276
+ action: z2.string().optional().nullable().default("Buy Now"),
8277
+ state: z2.enum([
8278
+ "draft",
8279
+ "published",
8280
+ "archived",
8281
+ "deleted"
8282
+ ]).default("draft"),
8283
+ visibility: z2.enum([
8284
+ "public",
8285
+ "private",
8286
+ "unlisted"
8287
+ ]).default("unlisted")
8288
+ }),
8124
8289
  createdAt: z2.date().nullable(),
8125
8290
  status: z2.number().int().default(0),
8126
8291
  quantityAvailable: z2.number().int().default(-1),
8127
- price: priceSchema.nullable().optional()
8292
+ price: priceSchema.nullable().optional(),
8293
+ resources: z2.array(ContentResourceProductSchema).default([]).nullable()
8128
8294
  });
8129
8295
 
8130
- // ../core/dist/chunk-ZVLW7GN3.js
8296
+ // ../core/dist/chunk-VQL6W6PO.js
8131
8297
  var couponSchema = z2.object({
8132
8298
  id: z2.string(),
8133
8299
  code: z2.string().max(191).optional().nullable(),
8134
8300
  createdAt: z2.date().nullable(),
8135
8301
  expires: z2.date().nullable(),
8136
- metadata: z2.record(z2.any()).default({}),
8302
+ fields: z2.record(z2.any()).default({}),
8137
8303
  maxUses: z2.number().int().default(-1),
8138
8304
  default: z2.boolean().default(false),
8139
8305
  merchantCouponId: z2.string().max(191).optional().nullable(),
@@ -8144,10 +8310,11 @@ var couponSchema = z2.object({
8144
8310
  return decimalPlaces <= 2;
8145
8311
  }),
8146
8312
  restrictedToProductId: z2.string().max(191).optional().nullable(),
8147
- bulkPurchaseId: z2.string().max(191).optional().nullable()
8313
+ bulkPurchaseId: z2.string().max(191).optional().nullable(),
8314
+ bulkCouponPurchases: z2.any().optional().nullable()
8148
8315
  });
8149
8316
 
8150
- // ../core/dist/chunk-4IVPKC6V.js
8317
+ // ../core/dist/chunk-L7DZR25Q.js
8151
8318
  var purchaseSchema = z2.object({
8152
8319
  id: z2.string().max(191),
8153
8320
  userId: z2.string().max(191).optional().nullable(),
@@ -8168,44 +8335,83 @@ var purchaseSchema = z2.object({
8168
8335
  bulkCouponId: z2.string().max(191).optional().nullable(),
8169
8336
  merchantSessionId: z2.string().max(191).optional().nullable(),
8170
8337
  redeemedBulkCouponId: z2.string().max(191).optional().nullable(),
8171
- metadata: z2.record(z2.any()).default({}),
8338
+ fields: z2.record(z2.any()).default({}),
8172
8339
  user: userSchema.optional().nullable(),
8173
8340
  bulkCoupon: couponSchema.optional().nullable(),
8174
8341
  product: productSchema.optional().nullable()
8175
8342
  });
8176
8343
 
8177
- // ../core/dist/schemas/content-resource-schema.js
8178
- var ContentResourceResourceSchema = z2.object({
8179
- resourceId: z2.string(),
8180
- resourceOfId: z2.string(),
8181
- position: z2.number().default(0),
8182
- metadata: z2.record(z2.string(), z2.any()).default({}).nullable(),
8344
+ // ../core/dist/chunk-5RZIDLCA.js
8345
+ var merchantChargeSchema = z2.object({
8346
+ id: z2.string().max(191),
8347
+ status: z2.number().int().default(0),
8348
+ identifier: z2.string().max(191),
8349
+ userId: z2.string().max(191),
8350
+ merchantAccountId: z2.string().max(191),
8351
+ merchantProductId: z2.string().max(191),
8183
8352
  createdAt: z2.date().nullable(),
8184
- updatedAt: z2.date().nullable(),
8185
- deletedAt: z2.date().nullable(),
8186
- resource: z2.any()
8353
+ merchantCustomerId: z2.string().max(191)
8187
8354
  });
8188
- var ContentResourceSchema = z2.object({
8189
- id: z2.string(),
8190
- type: z2.string(),
8191
- createdById: z2.string(),
8192
- fields: z2.record(z2.string(), z2.any()).default({}).nullable().optional(),
8355
+
8356
+ // ../core/dist/chunk-GSATJJT4.js
8357
+ var merchantCouponSchema = z2.object({
8358
+ id: z2.string().max(191),
8359
+ identifier: z2.string().max(191).optional().nullable(),
8360
+ status: z2.number().int().default(0),
8361
+ merchantAccountId: z2.string().max(191),
8362
+ percentageDiscount: z2.coerce.number().refine((value) => {
8363
+ const decimalPlaces = value.toString().split(".")[1]?.length || 0;
8364
+ return decimalPlaces <= 2;
8365
+ }),
8366
+ type: z2.string().max(191).optional().nullable()
8367
+ });
8368
+
8369
+ // ../core/dist/chunk-LQYMTPOB.js
8370
+ var merchantCustomerSchema = z2.object({
8371
+ id: z2.string().max(191),
8372
+ userId: z2.string().max(191),
8373
+ merchantAccountId: z2.string().max(191),
8374
+ identifier: z2.string().max(191),
8193
8375
  createdAt: z2.date().nullable(),
8194
- updatedAt: z2.date().nullable(),
8195
- deletedAt: z2.date().nullable(),
8196
- resources: z2.array(ContentResourceResourceSchema).default([]).nullable()
8376
+ status: z2.number().int().default(0)
8197
8377
  });
8198
- var ResourceStateSchema = z2.union([
8199
- z2.literal("draft"),
8200
- z2.literal("published"),
8201
- z2.literal("archived"),
8202
- z2.literal("deleted")
8203
- ]);
8204
- var ResourceVisibilitySchema = z2.union([
8205
- z2.literal("public"),
8206
- z2.literal("private"),
8207
- z2.literal("unlisted")
8208
- ]);
8378
+
8379
+ // ../core/dist/schemas/merchant-account-schema.js
8380
+ var merchantAccountSchema = z2.object({
8381
+ id: z2.string().max(191),
8382
+ label: z2.string().max(191),
8383
+ identifier: z2.string().max(191),
8384
+ createdAt: z2.date().nullable(),
8385
+ status: z2.number().int().default(0)
8386
+ });
8387
+
8388
+ // ../core/dist/lib/utils/validate-coupon.js
8389
+ import { isBefore } from "date-fns";
8390
+ var validateCoupon = /* @__PURE__ */ __name2((coupon, productIds = []) => {
8391
+ if (!coupon) {
8392
+ return {
8393
+ isValid: false,
8394
+ isRedeemable: false,
8395
+ error: "coupon-not-found"
8396
+ };
8397
+ }
8398
+ const isUsedUp = coupon.maxUses > 0 ? coupon.usedCount >= coupon.maxUses : false;
8399
+ const isExpired = coupon.expires ? isBefore(new Date(coupon.expires), /* @__PURE__ */ new Date()) : false;
8400
+ if (coupon.restrictedToProductId && !productIds.includes(coupon.restrictedToProductId)) {
8401
+ return {
8402
+ isValid: false,
8403
+ isRedeemable: false,
8404
+ error: "coupon-not-valid-for-product"
8405
+ };
8406
+ }
8407
+ const isValid3 = !isUsedUp && !isExpired;
8408
+ return {
8409
+ isExpired,
8410
+ isUsedUp,
8411
+ isRedeemable: isValid3 && coupon.percentageDiscount >= 1 && !coupon.default,
8412
+ isValid: isValid3
8413
+ };
8414
+ }, "validateCoupon");
8209
8415
 
8210
8416
  // src/lib/mysql/index.ts
8211
8417
  function getCourseBuilderSchema(mysqlTable) {
@@ -8228,6 +8434,7 @@ function getCourseBuilderSchema(mysqlTable) {
8228
8434
  usersRelations: getUsersRelationsSchema(mysqlTable),
8229
8435
  verificationTokens: getVerificationTokensSchema(mysqlTable),
8230
8436
  coupon: getCouponSchema(mysqlTable),
8437
+ couponRelations: getCouponRelationsSchema(mysqlTable),
8231
8438
  merchantAccount: getMerchantAccountSchema(mysqlTable),
8232
8439
  merchantCharge: getMerchantChargeSchema(mysqlTable),
8233
8440
  merchantCoupon: getMerchantCouponSchema(mysqlTable),
@@ -8266,9 +8473,126 @@ function createTables(mySqlTable) {
8266
8473
  }
8267
8474
  __name(createTables, "createTables");
8268
8475
  function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8269
- const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts } = createTables(tableFn);
8476
+ const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts, resourceProgress } = createTables(tableFn);
8270
8477
  return {
8271
8478
  client,
8479
+ async redeemFullPriceCoupon(options) {
8480
+ const { email: baseEmail, couponId, productIds, currentUserId, redeemingProductId } = options;
8481
+ const email = String(baseEmail).replace(" ", "+");
8482
+ const coupon2 = await this.getCouponWithBulkPurchases(couponId);
8483
+ const productId = coupon2 && coupon2.restrictedToProductId || redeemingProductId;
8484
+ if (!productId)
8485
+ throw new Error(`unable-to-find-any-product-id`);
8486
+ const couponValidation = validateCoupon(coupon2, productIds);
8487
+ if (coupon2 && couponValidation.isRedeemable) {
8488
+ const bulkCouponRedemption = Boolean(coupon2.bulkCouponPurchases[0]?.bulkCouponId);
8489
+ const { user } = await this.findOrCreateUser(email);
8490
+ if (!user)
8491
+ throw new Error(`unable-to-create-user-${email}`);
8492
+ const currentUser = currentUserId ? await this.getUserById(currentUserId) : null;
8493
+ const redeemingForCurrentUser = currentUser?.id === user.id;
8494
+ const existingPurchases = await this.getExistingNonBulkValidPurchasesOfProduct({
8495
+ userId: user.id,
8496
+ productId
8497
+ });
8498
+ if (existingPurchases.length > 0)
8499
+ throw new Error(`already-purchased-${email}`);
8500
+ const purchaseId = `purchase-${v4()}`;
8501
+ await this.createPurchase({
8502
+ id: purchaseId,
8503
+ userId: user.id,
8504
+ couponId: bulkCouponRedemption ? null : coupon2.id,
8505
+ redeemedBulkCouponId: bulkCouponRedemption ? coupon2.id : null,
8506
+ productId,
8507
+ totalAmount: "0",
8508
+ metadata: {
8509
+ couponUsedId: bulkCouponRedemption ? null : coupon2.id
8510
+ }
8511
+ });
8512
+ const newPurchase = await this.getPurchase(purchaseId);
8513
+ await this.incrementCouponUsedCount(coupon2.id);
8514
+ await this.createPurchaseTransfer({
8515
+ sourceUserId: user.id,
8516
+ purchaseId,
8517
+ expiresAt: new Date(Date.now() + 1e3 * 60 * 60 * 24 * 7)
8518
+ });
8519
+ return {
8520
+ purchase: newPurchase,
8521
+ redeemingForCurrentUser
8522
+ };
8523
+ }
8524
+ return null;
8525
+ },
8526
+ createPurchaseTransfer: async (options) => {
8527
+ const id = `put_${v4()}`;
8528
+ await client.insert(purchaseUserTransfer).values({
8529
+ id,
8530
+ purchaseId: options.purchaseId,
8531
+ sourceUserId: options.sourceUserId,
8532
+ expiresAt: options.expiresAt
8533
+ });
8534
+ },
8535
+ incrementCouponUsedCount: async (couponId) => {
8536
+ await client.update(coupon).set({
8537
+ usedCount: sql`${coupon.usedCount} + 1`
8538
+ }).where(eq(coupon.id, couponId));
8539
+ },
8540
+ getExistingNonBulkValidPurchasesOfProduct: async ({ userId, productId }) => {
8541
+ const existingPurchases = await client.query.purchases.findMany({
8542
+ where: and(eq(purchaseTable.userId, userId), productId ? eq(purchaseTable.productId, productId) : void 0, eq(purchaseTable.status, "Valid"), isNull(purchaseTable.bulkCouponId))
8543
+ });
8544
+ return z.array(purchaseSchema).parse(existingPurchases);
8545
+ },
8546
+ createMerchantCustomer: async (options) => {
8547
+ await client.insert(merchantCustomer).values({
8548
+ id: `mc_${v4()}`,
8549
+ identifier: options.identifier,
8550
+ merchantAccountId: options.merchantAccountId,
8551
+ userId: options.userId,
8552
+ status: 1
8553
+ });
8554
+ return merchantCustomerSchema.parse(await client.query.merchantCustomer.findFirst({
8555
+ where: eq(merchantCustomer.identifier, options.identifier)
8556
+ }));
8557
+ },
8558
+ getMerchantAccount: async (options) => {
8559
+ return merchantAccountSchema.parse(await client.query.merchantAccount.findFirst({
8560
+ where: eq(merchantAccount.label, options.provider)
8561
+ }));
8562
+ },
8563
+ getMerchantPriceForProductId: async (productId) => {
8564
+ const merchantPriceData = await client.query.merchantPrice.findFirst({
8565
+ where: eq(merchantPrice.merchantProductId, productId)
8566
+ });
8567
+ const parsedMerchantPrice = merchantPriceSchema.safeParse(merchantPriceData);
8568
+ if (!parsedMerchantPrice.success) {
8569
+ console.error("Error parsing merchant price", JSON.stringify(parsedMerchantPrice.error));
8570
+ return null;
8571
+ }
8572
+ return parsedMerchantPrice.data;
8573
+ },
8574
+ getMerchantProductForProductId: async (productId) => {
8575
+ const merchantProductData = await client.query.merchantProduct.findFirst({
8576
+ where: eq(merchantProduct.productId, productId)
8577
+ });
8578
+ if (!merchantProductData)
8579
+ return null;
8580
+ return merchantProductSchema.parse(merchantProductData);
8581
+ },
8582
+ getMerchantCustomerForUserId: async (userId) => {
8583
+ const merchantCustomerData = await client.query.merchantCustomer.findFirst({
8584
+ where: eq(merchantCustomer.userId, userId)
8585
+ });
8586
+ if (!merchantCustomerData)
8587
+ return null;
8588
+ return merchantCustomerSchema.parse(merchantCustomerData);
8589
+ },
8590
+ getUpgradableProducts: async (options) => {
8591
+ const { upgradableFromId, upgradableToId } = options;
8592
+ return z.array(upgradableProductSchema).parse(await client.query.upgradableProducts.findMany({
8593
+ where: and(eq(upgradableProducts.upgradableFromId, upgradableFromId), eq(upgradableProducts.upgradableToId, upgradableToId))
8594
+ }));
8595
+ },
8272
8596
  availableUpgradesForProduct(purchases, productId) {
8273
8597
  const previousPurchaseProductIds = purchases.map(({ productId: productId2 }) => productId2);
8274
8598
  return client.query.upgradableProducts.findMany({
@@ -8278,8 +8602,38 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8278
8602
  clearLessonProgressForUser(options) {
8279
8603
  throw new Error("Method not implemented.");
8280
8604
  },
8281
- completeLessonProgressForUser(options) {
8282
- throw new Error("Method not implemented.");
8605
+ async completeLessonProgressForUser(options) {
8606
+ if (!options.lessonId) {
8607
+ throw new Error("No lessonId provided");
8608
+ }
8609
+ let lessonProgress = await client.query.resourceProgress.findFirst({
8610
+ where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.contentResourceId, options.lessonId))
8611
+ });
8612
+ const now = /* @__PURE__ */ new Date();
8613
+ if (lessonProgress) {
8614
+ if (!lessonProgress.completedAt) {
8615
+ await client.update(resourceProgress).set({
8616
+ completedAt: now,
8617
+ updatedAt: now
8618
+ }).where(eq(resourceProgress.contentResourceId, options.lessonId));
8619
+ }
8620
+ } else {
8621
+ await client.insert(resourceProgress).values({
8622
+ userId: options.userId,
8623
+ contentResourceId: options.lessonId,
8624
+ completedAt: now,
8625
+ updatedAt: now
8626
+ });
8627
+ }
8628
+ lessonProgress = await client.query.resourceProgress.findFirst({
8629
+ where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.contentResourceId, options.lessonId))
8630
+ });
8631
+ const parsedLessonProgress = resourceProgressSchema.safeParse(lessonProgress);
8632
+ if (!parsedLessonProgress.success) {
8633
+ console.error("Error parsing lesson progress", lessonProgress);
8634
+ return null;
8635
+ }
8636
+ return parsedLessonProgress.data;
8283
8637
  },
8284
8638
  couponForIdOrCode(options) {
8285
8639
  throw new Error("Method not implemented.");
@@ -8291,7 +8645,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8291
8645
  const existingMerchantCharge = merchantChargeSchema.nullable().parse(await client.query.merchantCharge.findFirst({
8292
8646
  where: eq(merchantCharge.identifier, stripeChargeId)
8293
8647
  }) || null);
8294
- const existingPurchaseForCharge = existingMerchantCharge ? await client.query.purchase.findFirst({
8648
+ const existingPurchaseForCharge = existingMerchantCharge ? await client.query.purchases.findFirst({
8295
8649
  where: eq(purchaseTable.merchantChargeId, existingMerchantCharge.id),
8296
8650
  with: {
8297
8651
  user: true,
@@ -8300,11 +8654,11 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8300
8654
  }
8301
8655
  }) : null;
8302
8656
  if (existingPurchaseForCharge) {
8303
- return purchaseSchema.parse(existingPurchaseForCharge);
8657
+ return existingPurchaseForCharge.id;
8304
8658
  }
8305
- const merchantChargeId = v4();
8306
- const purchaseId2 = v4();
8307
- const newMerchantCharge = trx.insert(merchantCharge).values({
8659
+ const merchantChargeId = `mc_${v4()}`;
8660
+ const purchaseId2 = `purch_${v4()}`;
8661
+ const newMerchantCharge = await client.insert(merchantCharge).values({
8308
8662
  id: merchantChargeId,
8309
8663
  userId,
8310
8664
  identifier: stripeChargeId,
@@ -8318,21 +8672,29 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8318
8672
  "Restricted"
8319
8673
  ]))
8320
8674
  }) || null);
8321
- const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, and(eq(coupon.id, purchaseTable.bulkCouponId), eq(purchaseTable.userId, userId))).then((res) => res[0] ?? null));
8675
+ const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, and(eq(coupon.id, purchaseTable.bulkCouponId), eq(purchaseTable.userId, userId))).where(and(eq(coupon.restrictedToProductId, productId), eq(purchaseTable.userId, userId))).then((res) => {
8676
+ console.log({
8677
+ res
8678
+ });
8679
+ return res[0]?.coupons ?? null;
8680
+ }));
8681
+ console.log({
8682
+ existingBulkCoupon
8683
+ });
8322
8684
  const isBulkPurchase = quantity > 1 || Boolean(existingBulkCoupon) || options.bulk || Boolean(existingPurchase?.status === "Valid");
8323
8685
  let bulkCouponId = null;
8324
8686
  let couponToUpdate = null;
8325
8687
  if (isBulkPurchase) {
8326
8688
  bulkCouponId = existingBulkCoupon !== null ? existingBulkCoupon.id : v4();
8327
8689
  if (existingBulkCoupon !== null) {
8328
- couponToUpdate = trx.update(coupon).set({
8690
+ couponToUpdate = await client.update(coupon).set({
8329
8691
  maxUses: (existingBulkCoupon?.maxUses || 0) + quantity
8330
8692
  }).where(eq(coupon.id, bulkCouponId));
8331
8693
  } else {
8332
8694
  const merchantCouponToUse = stripeCouponId ? merchantCouponSchema.nullable().parse(await client.query.merchantCoupon.findFirst({
8333
8695
  where: eq(merchantCoupon.identifier, stripeCouponId)
8334
8696
  })) : null;
8335
- couponToUpdate = await trx.insert(coupon).values({
8697
+ couponToUpdate = await client.insert(coupon).values({
8336
8698
  id: bulkCouponId,
8337
8699
  percentageDiscount: "1.0",
8338
8700
  restrictedToProductId: productId,
@@ -8344,20 +8706,29 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8344
8706
  });
8345
8707
  }
8346
8708
  }
8347
- const merchantSessionId = v4();
8348
- const newMerchantSession = trx.insert(merchantSession).values({
8709
+ const merchantSessionId = `ms_${v4()}`;
8710
+ const newMerchantSession = await client.insert(merchantSession).values({
8349
8711
  id: merchantSessionId,
8350
8712
  identifier: checkoutSessionId,
8351
8713
  merchantAccountId
8352
8714
  });
8715
+ console.log({
8716
+ newMerchantSession
8717
+ });
8353
8718
  const merchantCouponUsed = stripeCouponId ? await client.query.merchantCoupon.findFirst({
8354
8719
  where: eq(merchantCoupon.identifier, stripeCouponId)
8355
8720
  }) : null;
8721
+ console.log({
8722
+ merchantCouponUsed
8723
+ });
8356
8724
  const pppMerchantCoupon = appliedPPPStripeCouponId ? await client.query.merchantCoupon.findFirst({
8357
8725
  where: and(eq(merchantCoupon.identifier, appliedPPPStripeCouponId), eq(merchantCoupon.type, "ppp"))
8358
8726
  }) : null;
8727
+ console.log({
8728
+ pppMerchantCoupon
8729
+ });
8359
8730
  const newPurchaseStatus = merchantCouponUsed?.type === "ppp" || pppMerchantCoupon ? "Restricted" : "Valid";
8360
- const newPurchase = trx.insert(purchaseTable).values({
8731
+ const newPurchase = await client.insert(purchaseTable).values({
8361
8732
  id: purchaseId2,
8362
8733
  status: newPurchaseStatus,
8363
8734
  userId,
@@ -8370,22 +8741,22 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8370
8741
  upgradedFromId: upgradedFromPurchaseId || null,
8371
8742
  couponId: usedCouponId || null
8372
8743
  });
8744
+ console.log({
8745
+ newPurchase
8746
+ });
8373
8747
  const oneWeekInMilliseconds = 1e3 * 60 * 60 * 24 * 7;
8374
- const newPurchaseUserTransfer = trx.insert(purchaseUserTransfer).values({
8375
- id: v4(),
8748
+ const newPurchaseUserTransfer = await client.insert(purchaseUserTransfer).values({
8749
+ id: `put_${v4()}`,
8376
8750
  purchaseId: purchaseId2,
8377
8751
  expiresAt: existingPurchase ? /* @__PURE__ */ new Date() : new Date(Date.now() + oneWeekInMilliseconds),
8378
8752
  sourceUserId: userId
8379
8753
  });
8380
- await Promise.all([
8381
- newMerchantCharge,
8382
- newPurchase,
8383
- newPurchaseUserTransfer,
8384
- newMerchantSession,
8385
- ...couponToUpdate ? [
8386
- couponToUpdate
8387
- ] : []
8388
- ]);
8754
+ console.log({
8755
+ newPurchaseUserTransfer
8756
+ });
8757
+ console.log("inside", {
8758
+ purchaseId: purchaseId2
8759
+ });
8389
8760
  return purchaseId2;
8390
8761
  } catch (error) {
8391
8762
  console.error(error);
@@ -8393,15 +8764,52 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8393
8764
  throw error;
8394
8765
  }
8395
8766
  });
8396
- return purchaseSchema.parse(await client.query.purchases.findFirst({
8767
+ console.log("putside", {
8768
+ purchaseId
8769
+ });
8770
+ const parsedPurchase = purchaseSchema.safeParse(await client.query.purchases.findFirst({
8397
8771
  where: eq(purchaseTable.id, purchaseId)
8398
8772
  }));
8773
+ if (!parsedPurchase.success) {
8774
+ console.error("Error parsing purchase", parsedPurchase, JSON.stringify(parsedPurchase, null, 2));
8775
+ throw new Error("Error parsing purchase");
8776
+ }
8777
+ return parsedPurchase.data;
8399
8778
  },
8400
- findOrCreateMerchantCustomer(options) {
8401
- throw new Error("Method not implemented.");
8779
+ async findOrCreateMerchantCustomer(options) {
8780
+ const merchantCustomer2 = merchantCustomerSchema.nullable().optional().parse(await client.query.merchantCustomer.findFirst({
8781
+ where: (merchantCustomer3, { eq: eq2 }) => eq2(merchantCustomer3.identifier, options.identifier)
8782
+ }));
8783
+ if (merchantCustomer2) {
8784
+ return merchantCustomer2;
8785
+ }
8786
+ return await this.createMerchantCustomer({
8787
+ identifier: options.identifier,
8788
+ merchantAccountId: options.merchantAccountId,
8789
+ userId: options.user.id
8790
+ });
8402
8791
  },
8403
- findOrCreateUser(email, name) {
8404
- throw new Error("Method not implemented.");
8792
+ async findOrCreateUser(email, name) {
8793
+ const user = await this.getUserByEmail?.(email);
8794
+ if (!user) {
8795
+ const newUser = await this.createUser?.({
8796
+ id: `u_${v4()}`,
8797
+ email,
8798
+ name,
8799
+ emailVerified: null
8800
+ });
8801
+ if (!newUser) {
8802
+ throw new Error("Could not create user");
8803
+ }
8804
+ return {
8805
+ user: newUser,
8806
+ isNewUser: true
8807
+ };
8808
+ }
8809
+ return {
8810
+ user,
8811
+ isNewUser: false
8812
+ };
8405
8813
  },
8406
8814
  async getCoupon(couponIdOrCode) {
8407
8815
  return couponSchema.nullable().parse(await client.select().from(coupon).where(or(eq(coupon.id, couponIdOrCode), eq(coupon.code, couponIdOrCode))).then((res) => res[0] ?? null));
@@ -8421,8 +8829,17 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8421
8829
  getLessonProgresses() {
8422
8830
  throw new Error("Method not implemented.");
8423
8831
  },
8424
- getMerchantCharge(merchantChargeId) {
8425
- throw new Error("Method not implemented.");
8832
+ async getMerchantCharge(merchantChargeId) {
8833
+ const mCharge = await client.query.merchantCharge.findFirst({
8834
+ where: eq(merchantCharge.id, merchantChargeId)
8835
+ });
8836
+ console.log("mCharge", mCharge);
8837
+ const parsed = merchantChargeSchema.safeParse(mCharge);
8838
+ if (!parsed.success) {
8839
+ console.error("Error parsing merchantCharge", mCharge);
8840
+ return null;
8841
+ }
8842
+ return parsed.data;
8426
8843
  },
8427
8844
  async getMerchantCouponsForTypeAndPercent(params) {
8428
8845
  return z.array(merchantCouponSchema).parse(await client.query.merchantCoupon.findMany({
@@ -8482,48 +8899,10 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8482
8899
  const newPurchase = await this.getPurchase(newPurchaseId);
8483
8900
  return purchaseSchema.parse(newPurchase);
8484
8901
  },
8485
- async getPurchaseDetails(purchaseId, userId) {
8486
- const allPurchases = await this.getPurchasesForUser(userId);
8487
- const thePurchase = await client.query.purchases.findFirst({
8488
- where: and(eq(purchaseTable.id, purchaseId), eq(purchaseTable.userId, userId)),
8489
- with: {
8490
- user: true,
8491
- product: true,
8492
- bulkCoupon: true
8493
- }
8494
- });
8495
- const parsedPurchase = purchaseSchema.safeParse(thePurchase);
8496
- if (!parsedPurchase.success) {
8497
- console.error("Error parsing purchase", parsedPurchase);
8498
- return {
8499
- availableUpgrades: []
8500
- };
8501
- }
8502
- const purchaseCanUpgrade = [
8503
- "Valid",
8504
- "Restricted"
8505
- ].includes(parsedPurchase.data.state || "");
8506
- if (!purchaseCanUpgrade) {
8507
- return {
8508
- availableUpgrades: []
8509
- };
8510
- }
8511
- const availableUpgrades = await client.query.upgradableProducts.findMany({
8512
- where: and(eq(upgradableProducts.upgradableFromId, parsedPurchase.data.product?.id), not(inArray(upgradableProducts.upgradableToId, allPurchases.map((p) => p.product?.id)))),
8513
- with: {
8514
- upgradableTo: true,
8515
- upgradableFrom: true
8516
- }
8517
- });
8518
- const existingPurchase = allPurchases.find((p) => p.product?.id === parsedPurchase.data.product?.id);
8519
- return Promise.resolve({
8520
- availableUpgrades: z.array(upgradableProductSchema).parse(availableUpgrades),
8521
- existingPurchase,
8522
- purchase: parsedPurchase.data
8523
- });
8524
- },
8525
8902
  async getPurchaseForStripeCharge(stripeChargeId) {
8526
- const purchase = purchaseSchema.safeParse(await client.select().from(purchaseTable).leftJoin(merchantCharge, and(eq(merchantCharge.identifier, stripeChargeId), eq(merchantCharge.id, purchaseTable.merchantChargeId))).then((res) => res[0] ?? null));
8903
+ const purchase = purchaseSchema.safeParse(await client.select().from(purchaseTable).leftJoin(merchantCharge, and(eq(merchantCharge.identifier, stripeChargeId), eq(merchantCharge.id, purchaseTable.merchantChargeId))).then((res) => {
8904
+ return res[0]?.purchases ?? null;
8905
+ }));
8527
8906
  if (!purchase.success) {
8528
8907
  return null;
8529
8908
  }
@@ -8555,11 +8934,70 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8555
8934
  });
8556
8935
  const parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases);
8557
8936
  if (!parsedPurchases.success) {
8558
- console.error("Error parsing purchases", parsedPurchases);
8937
+ console.error("Error parsing purchases", JSON.stringify(parsedPurchases.error));
8559
8938
  return [];
8560
8939
  }
8561
8940
  return parsedPurchases.data;
8562
8941
  },
8942
+ async getPurchaseDetails(purchaseId, userId) {
8943
+ const visiblePurchaseStates = [
8944
+ "Valid",
8945
+ "Refunded",
8946
+ "Restricted"
8947
+ ];
8948
+ const userPurchases = await client.query.purchases.findMany({
8949
+ where: and(eq(purchaseTable.userId, userId), inArray(purchaseTable.status, visiblePurchaseStates)),
8950
+ with: {
8951
+ user: true,
8952
+ product: true,
8953
+ bulkCoupon: true
8954
+ },
8955
+ orderBy: asc(purchaseTable.createdAt)
8956
+ });
8957
+ const parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases);
8958
+ const allPurchases = parsedPurchases.success ? parsedPurchases.data : [];
8959
+ console.log("\u{1F9A6}", {
8960
+ allPurchases
8961
+ });
8962
+ const thePurchase = await client.query.purchases.findFirst({
8963
+ where: and(eq(purchaseTable.id, purchaseId), eq(purchaseTable.userId, userId)),
8964
+ with: {
8965
+ user: true,
8966
+ product: true,
8967
+ bulkCoupon: true
8968
+ }
8969
+ });
8970
+ const parsedPurchase = purchaseSchema.safeParse(thePurchase);
8971
+ if (!parsedPurchase.success) {
8972
+ console.error("Error parsing purchase", parsedPurchase);
8973
+ return {
8974
+ availableUpgrades: []
8975
+ };
8976
+ }
8977
+ console.log("\u{1F9A6}", {
8978
+ parsedPurchase: parsedPurchase.data
8979
+ });
8980
+ const purchaseCanUpgrade = [
8981
+ "Valid",
8982
+ "Restricted"
8983
+ ].includes(parsedPurchase.data.state || "");
8984
+ let availableUpgrades = [];
8985
+ if (purchaseCanUpgrade) {
8986
+ availableUpgrades = await client.query.upgradableProducts.findMany({
8987
+ where: and(eq(upgradableProducts.upgradableFromId, parsedPurchase.data.product?.id), not(inArray(upgradableProducts.upgradableToId, allPurchases.map((p) => p.product?.id)))),
8988
+ with: {
8989
+ upgradableTo: true,
8990
+ upgradableFrom: true
8991
+ }
8992
+ });
8993
+ }
8994
+ const existingPurchase = allPurchases.find((p) => p.product?.id === parsedPurchase.data.product?.id);
8995
+ return Promise.resolve({
8996
+ availableUpgrades: z.array(upgradableProductSchema).parse(availableUpgrades),
8997
+ existingPurchase,
8998
+ purchase: parsedPurchase.data
8999
+ });
9000
+ },
8563
9001
  async getUserById(userId) {
8564
9002
  return userSchema.nullable().parse(await client.query.users.findFirst({
8565
9003
  where: eq(users.id, userId)
@@ -8577,13 +9015,13 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
8577
9015
  const purchases = await client.query.purchases.findMany({
8578
9016
  where: and(eq(purchaseTable.userId, userId), inArray(purchaseTable.productId, upgradableFrom))
8579
9017
  });
8580
- const purchasesMade = z.array(z.string()).parse(purchases.map((purchase) => {
9018
+ const productsPurchased = z.array(z.string()).parse(purchases.map((purchase) => {
8581
9019
  return purchase.productId;
8582
9020
  }));
8583
- if (purchasesMade.length === 0)
9021
+ if (productsPurchased.length === 0)
8584
9022
  return [];
8585
9023
  const foundPrices = await client.query.prices.findMany({
8586
- where: and(eq(prices.productId, bundleId), inArray(prices.productId, purchasesMade))
9024
+ where: inArray(prices.productId, productsPurchased)
8587
9025
  });
8588
9026
  return z.array(priceSchema).parse(foundPrices);
8589
9027
  },
@@ -8852,4 +9290,4 @@ export {
8852
9290
  createTables,
8853
9291
  mySqlDrizzleAdapter
8854
9292
  };
8855
- //# sourceMappingURL=chunk-XSXWLOIN.js.map
9293
+ //# sourceMappingURL=chunk-WQ7UXKZC.js.map